From 7cf5c48f3e3e19d4e02c47ba524743c53e69666c Mon Sep 17 00:00:00 2001 From: Charles Xie Date: Thu, 28 Nov 2024 17:19:48 -0500 Subject: [PATCH] Updates --- .../{index-Bw8XMzWS.js => index-Dq1JhGjS.js} | 298 +++++++++--------- index.html | 2 +- 2 files changed, 150 insertions(+), 150 deletions(-) rename assets/{index-Bw8XMzWS.js => index-Dq1JhGjS.js} (81%) diff --git a/assets/index-Bw8XMzWS.js b/assets/index-Dq1JhGjS.js similarity index 81% rename from assets/index-Bw8XMzWS.js rename to assets/index-Dq1JhGjS.js index 69d1e1cb..58c1b65e 100644 --- a/assets/index-Bw8XMzWS.js +++ b/assets/index-Dq1JhGjS.js @@ -1,4 +1,4 @@ -var E0t=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var iYo=E0t((vg,hh)=>{function OFe(t,e){for(var n=0;no[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function VFe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}var _Fe={exports:{}},EK={},GFe={exports:{}},nl={};/** +var E0t=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var iYo=E0t((vg,ph)=>{function OFe(t,e){for(var n=0;no[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function VFe(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:function(){return t[o]}})}),n}var _Fe={exports:{}},EK={},GFe={exports:{}},nl={};/** * @license React * react.production.min.js * @@ -35,9 +35,9 @@ var E0t=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var iYo=E0t((vg, `),i=o.stack.split(` `),a=r.length-1,l=i.length-1;1<=a&&0<=l&&r[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(r[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||r[a]!==i[l]){var s=` `+r[a].replace(" at new "," at ");return t.displayName&&s.includes("")&&(s=s.replace("",t.displayName)),s}while(1<=a&&0<=l);break}}}finally{_ne=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?TD(t):""}function aut(t){switch(t.tag){case 5:return TD(t.type);case 16:return TD("Lazy");case 13:return TD("Suspense");case 19:return TD("SuspenseList");case 0:case 2:case 15:return t=Gne(t.type,!1),t;case 11:return t=Gne(t.type.render,!1),t;case 1:return t=Gne(t.type,!0),t;default:return""}}function Xle(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case WP:return"Fragment";case LP:return"Portal";case Vle:return"Profiler";case Hpe:return"StrictMode";case _le:return"Suspense";case Gle:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case lke:return(t.displayName||"Context")+".Consumer";case ake:return(t._context.displayName||"Context")+".Provider";case Mpe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ipe:return e=t.displayName||null,e!==null?e:Xle(t.type)||"Memo";case _4:e=t._payload,t=t._init;try{return Xle(t(e))}catch{}}return null}function lut(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xle(e);case 8:return e===Hpe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Z8(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function cke(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function sut(t){var e=cke(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),o=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(a){o=""+a,i.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return o},setValue:function(a){o=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function qj(t){t._valueTracker||(t._valueTracker=sut(t))}function uke(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),o="";return t&&(o=cke(t)?t.checked?"true":"false":t.value),t=o,t!==n?(e.setValue(t),!0):!1}function S_(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Jle(t,e){var n=e.checked;return a0({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Y6e(t,e){var n=e.defaultValue==null?"":e.defaultValue,o=e.checked!=null?e.checked:e.defaultChecked;n=Z8(e.value!=null?e.value:n),t._wrapperState={initialChecked:o,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dke(t,e){e=e.checked,e!=null&&Rpe(t,"checked",e,!1)}function Kle(t,e){dke(t,e);var n=Z8(e.value),o=e.type;if(n!=null)o==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(o==="submit"||o==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?qle(t,e.type,n):e.hasOwnProperty("defaultValue")&&qle(t,e.type,Z8(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function O6e(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var o=e.type;if(!(o!=="submit"&&o!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function qle(t,e,n){(e!=="number"||S_(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var PD=Array.isArray;function AC(t,e,n,o){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=$j.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function lF(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var rE={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},cut=["Webkit","ms","Moz","O"];Object.keys(rE).forEach(function(t){cut.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),rE[e]=rE[t]})});function gke(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||rE.hasOwnProperty(t)&&rE[t]?(""+e).trim():e+"px"}function mke(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var o=n.indexOf("--")===0,r=gke(n,e[n],o);n==="float"&&(n="cssFloat"),o?t.setProperty(n,r):t[n]=r}}var uut=a0({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Zle(t,e){if(e){if(uut[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Jo(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Jo(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Jo(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Jo(62))}}function ese(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";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 tse=null;function zpe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var nse=null,wC=null,vC=null;function G6e(t){if(t=$L(t)){if(typeof nse!="function")throw Error(Jo(280));var e=t.stateNode;e&&(e=UK(e),nse(t.stateNode,t.type,e))}}function yke(t){wC?vC?vC.push(t):vC=[t]:wC=t}function Ake(){if(wC){var t=wC,e=vC;if(vC=wC=null,G6e(t),e)for(t=0;t>>=0,t===0?32:31-(xut(t)/but|0)|0}var Qj=64,Zj=4194304;function CD(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function R_(t,e){var n=t.pendingLanes;if(n===0)return 0;var o=0,r=t.suspendedLanes,i=t.pingedLanes,a=n&268435455;if(a!==0){var l=a&~r;l!==0?o=CD(l):(i&=a,i!==0&&(o=CD(i)))}else a=n&~r,a!==0?o=CD(a):i!==0&&(o=CD(i));if(o===0)return 0;if(e!==0&&e!==o&&!(e&r)&&(r=o&-o,i=e&-e,r>=i||r===16&&(i&4194240)!==0))return e;if(o&4&&(o|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=o;0n;n++)e.push(t);return e}function KL(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-M2(e),t[e]=n}function Cut(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var o=t.eventTimes;for(t=t.expirationTimes;0=aE),tAe=" ",nAe=!1;function Nke(t,e){switch(t){case"keyup":return edt.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uke(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var NP=!1;function ndt(t,e){switch(t){case"compositionend":return Uke(e);case"keypress":return e.which!==32?null:(nAe=!0,tAe);case"textInput":return t=e.data,t===tAe&&nAe?null:t;default:return null}}function odt(t,e){if(NP)return t==="compositionend"||!Upe&&Nke(t,e)?(t=Lke(),wV=Lpe=f8=null,NP=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=o}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=aAe(n)}}function Oke(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Oke(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vke(){for(var t=window,e=S_();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=S_(t.document)}return e}function jpe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function fdt(t){var e=Vke(),n=t.focusedElem,o=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Oke(n.ownerDocument.documentElement,n)){if(o!==null&&jpe(n)){if(e=o.start,t=o.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,i=Math.min(o.start,r);o=o.end===void 0?i:Math.min(o.end,r),!t.extend&&i>o&&(r=o,o=i,i=r),r=lAe(n,i);var a=lAe(n,o);r&&a&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),i>o?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,UP=null,sse=null,sE=null,cse=!1;function sAe(t,e,n){var o=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;cse||UP==null||UP!==S_(o)||(o=UP,"selectionStart"in o&&jpe(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),sE&&hF(sE,o)||(sE=o,o=I_(sse,"onSelect"),0YP||(t.current=gse[YP],gse[YP]=null,YP--)}function Js(t,e){YP++,gse[YP]=t.current,t.current=e}var ew={},mh=Hw(ew),Kp=Hw(!1),jx=ew;function KC(t,e){var n=t.type.contextTypes;if(!n)return ew;var o=t.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===e)return o.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=e[i];return o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function qp(t){return t=t.childContextTypes,t!=null}function D_(){wc(Kp),wc(mh)}function gAe(t,e,n){if(mh.current!==ew)throw Error(Jo(168));Js(mh,e),Js(Kp,n)}function Zke(t,e,n){var o=t.stateNode;if(e=e.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var r in o)if(!(r in e))throw Error(Jo(108,lut(t)||"Unknown",r));return a0({},n,o)}function E_(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ew,jx=mh.current,Js(mh,t),Js(Kp,Kp.current),!0}function mAe(t,e,n){var o=t.stateNode;if(!o)throw Error(Jo(169));n?(t=Zke(t,e,jx),o.__reactInternalMemoizedMergedChildContext=t,wc(Kp),wc(mh),Js(mh,t)):wc(Kp),Js(Kp,n)}var y6=null,jK=!1,aoe=!1;function eLe(t){y6===null?y6=[t]:y6.push(t)}function Tdt(t){jK=!0,eLe(t)}function Mw(){if(!aoe&&y6!==null){aoe=!0;var t=0,e=fs;try{var n=y6;for(fs=1;t>=a,r-=a,b6=1<<32-M2(e)+r|n<b?(R=x,x=null):R=x.sibling;var H=f(S,x,P[b],v);if(H===null){x===null&&(x=R);break}t&&x&&H.alternate===null&&e(S,x),C=i(H,C,b),w===null?T=H:w.sibling=H,w=H,x=R}if(b===P.length)return n(S,x),Nc&&sv(S,b),T;if(x===null){for(;bb?(R=x,x=null):R=x.sibling;var F=f(S,x,H.value,v);if(F===null){x===null&&(x=R);break}t&&x&&F.alternate===null&&e(S,x),C=i(F,C,b),w===null?T=F:w.sibling=F,w=F,x=R}if(H.done)return n(S,x),Nc&&sv(S,b),T;if(x===null){for(;!H.done;b++,H=P.next())H=d(S,H.value,v),H!==null&&(C=i(H,C,b),w===null?T=H:w.sibling=H,w=H);return Nc&&sv(S,b),T}for(x=o(S,x);!H.done;b++,H=P.next())H=p(x,S,b,H.value,v),H!==null&&(t&&H.alternate!==null&&x.delete(H.key===null?b:H.key),C=i(H,C,b),w===null?T=H:w.sibling=H,w=H);return t&&x.forEach(function(E){return e(S,E)}),Nc&&sv(S,b),T}function y(S,C,P,v){if(typeof P=="object"&&P!==null&&P.type===WP&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case Kj:e:{for(var T=P.key,w=C;w!==null;){if(w.key===T){if(T=P.type,T===WP){if(w.tag===7){n(S,w.sibling),C=r(w,P.props.children),C.return=S,S=C;break e}}else if(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===_4&&SAe(T)===w.type){n(S,w.sibling),C=r(w,P.props),C.ref=fz(S,w,P),C.return=S,S=C;break e}n(S,w);break}else e(S,w);w=w.sibling}P.type===WP?(C=cx(P.props.children,S.mode,v,P.key),C.return=S,S=C):(v=RV(P.type,P.key,P.props,null,S.mode,v),v.ref=fz(S,C,P),v.return=S,S=v)}return a(S);case LP:e:{for(w=P.key;C!==null;){if(C.key===w)if(C.tag===4&&C.stateNode.containerInfo===P.containerInfo&&C.stateNode.implementation===P.implementation){n(S,C.sibling),C=r(C,P.children||[]),C.return=S,S=C;break e}else{n(S,C);break}else e(S,C);C=C.sibling}C=poe(P,S.mode,v),C.return=S,S=C}return a(S);case _4:return w=P._init,y(S,C,w(P._payload),v)}if(PD(P))return g(S,C,P,v);if(lz(P))return A(S,C,P,v);aB(S,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,C!==null&&C.tag===6?(n(S,C.sibling),C=r(C,P),C.return=S,S=C):(n(S,C),C=hoe(P,S.mode,v),C.return=S,S=C),a(S)):n(S,C)}return y}var $C=sLe(!0),cLe=sLe(!1),QL={},b9=Hw(QL),yF=Hw(QL),AF=Hw(QL);function Ev(t){if(t===QL)throw Error(Jo(174));return t}function Kpe(t,e){switch(Js(AF,e),Js(yF,t),Js(b9,QL),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Qle(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Qle(e,t)}wc(b9),Js(b9,e)}function QC(){wc(b9),wc(yF),wc(AF)}function uLe(t){Ev(AF.current);var e=Ev(b9.current),n=Qle(e,t.type);e!==n&&(Js(yF,t),Js(b9,n))}function qpe(t){yF.current===t&&(wc(b9),wc(yF))}var Zc=Hw(0);function U_(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var loe=[];function $pe(){for(var t=0;tn?n:4,t(!0);var o=soe.transition;soe.transition={};try{t(!1),e()}finally{fs=n,soe.transition=o}}function CLe(){return Km().memoizedState}function Hdt(t,e,n){var o=U8(t);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},RLe(t))HLe(e,n);else if(n=rLe(t,e,n,o),n!==null){var r=up();I2(n,t,o,r),MLe(n,e,o)}}function Mdt(t,e,n){var o=U8(t),r={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(RLe(t))HLe(e,r);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,l=i(a,n);if(r.hasEagerState=!0,r.eagerState=l,Y2(l,a)){var s=e.interleaved;s===null?(r.next=r,Xpe(e)):(r.next=s.next,s.next=r),e.interleaved=r;return}}catch{}finally{}n=rLe(t,e,r,o),n!==null&&(r=up(),I2(n,t,o,r),MLe(n,e,o))}}function RLe(t){var e=t.alternate;return t===o0||e!==null&&e===o0}function HLe(t,e){cE=j_=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function MLe(t,e,n){if(n&4194240){var o=e.lanes;o&=t.pendingLanes,n|=o,e.lanes=n,Epe(t,n)}}var B_={readContext:Jm,useCallback:Nf,useContext:Nf,useEffect:Nf,useImperativeHandle:Nf,useInsertionEffect:Nf,useLayoutEffect:Nf,useMemo:Nf,useReducer:Nf,useRef:Nf,useState:Nf,useDebugValue:Nf,useDeferredValue:Nf,useTransition:Nf,useMutableSource:Nf,useSyncExternalStore:Nf,useId:Nf,unstable_isNewReconciler:!1},Idt={readContext:Jm,useCallback:function(t,e){return Q5().memoizedState=[t,e===void 0?null:e],t},useContext:Jm,useEffect:PAe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,SV(4194308,4,xLe.bind(null,e,t),n)},useLayoutEffect:function(t,e){return SV(4194308,4,t,e)},useInsertionEffect:function(t,e){return SV(4,2,t,e)},useMemo:function(t,e){var n=Q5();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var o=Q5();return e=n!==void 0?n(e):e,o.memoizedState=o.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},o.queue=t,t=t.dispatch=Hdt.bind(null,o0,t),[o.memoizedState,t]},useRef:function(t){var e=Q5();return t={current:t},e.memoizedState=t},useState:TAe,useDebugValue:n1e,useDeferredValue:function(t){return Q5().memoizedState=t},useTransition:function(){var t=TAe(!1),e=t[0];return t=Rdt.bind(null,t[1]),Q5().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var o=o0,r=Q5();if(Nc){if(n===void 0)throw Error(Jo(407));n=n()}else{if(n=e(),Pd===null)throw Error(Jo(349));Yx&30||hLe(o,e,n)}r.memoizedState=n;var i={value:n,getSnapshot:e};return r.queue=i,PAe(gLe.bind(null,o,i,t),[t]),o.flags|=2048,xF(9,pLe.bind(null,o,i,n,e),void 0,null),n},useId:function(){var t=Q5(),e=Pd.identifierPrefix;if(Nc){var n=S6,o=b6;n=(o&~(1<<32-M2(o)-1)).toString(32)+n,e=":"+e+"R"+n,n=wF++,0YP||(t.current=gse[YP],gse[YP]=null,YP--)}function Js(t,e){YP++,gse[YP]=t.current,t.current=e}var ew={},yh=Hw(ew),Kp=Hw(!1),jx=ew;function KC(t,e){var n=t.type.contextTypes;if(!n)return ew;var o=t.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===e)return o.__reactInternalMemoizedMaskedChildContext;var r={},i;for(i in n)r[i]=e[i];return o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function qp(t){return t=t.childContextTypes,t!=null}function D_(){wc(Kp),wc(yh)}function gAe(t,e,n){if(yh.current!==ew)throw Error(Jo(168));Js(yh,e),Js(Kp,n)}function Zke(t,e,n){var o=t.stateNode;if(e=e.childContextTypes,typeof o.getChildContext!="function")return n;o=o.getChildContext();for(var r in o)if(!(r in e))throw Error(Jo(108,lut(t)||"Unknown",r));return a0({},n,o)}function E_(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ew,jx=yh.current,Js(yh,t),Js(Kp,Kp.current),!0}function mAe(t,e,n){var o=t.stateNode;if(!o)throw Error(Jo(169));n?(t=Zke(t,e,jx),o.__reactInternalMemoizedMergedChildContext=t,wc(Kp),wc(yh),Js(yh,t)):wc(Kp),Js(Kp,n)}var y6=null,jK=!1,aoe=!1;function eLe(t){y6===null?y6=[t]:y6.push(t)}function Tdt(t){jK=!0,eLe(t)}function Mw(){if(!aoe&&y6!==null){aoe=!0;var t=0,e=fs;try{var n=y6;for(fs=1;t>=a,r-=a,b6=1<<32-M2(e)+r|n<b?(R=x,x=null):R=x.sibling;var H=f(S,x,P[b],v);if(H===null){x===null&&(x=R);break}t&&x&&H.alternate===null&&e(S,x),C=i(H,C,b),w===null?T=H:w.sibling=H,w=H,x=R}if(b===P.length)return n(S,x),Nc&&sv(S,b),T;if(x===null){for(;bb?(R=x,x=null):R=x.sibling;var F=f(S,x,H.value,v);if(F===null){x===null&&(x=R);break}t&&x&&F.alternate===null&&e(S,x),C=i(F,C,b),w===null?T=F:w.sibling=F,w=F,x=R}if(H.done)return n(S,x),Nc&&sv(S,b),T;if(x===null){for(;!H.done;b++,H=P.next())H=d(S,H.value,v),H!==null&&(C=i(H,C,b),w===null?T=H:w.sibling=H,w=H);return Nc&&sv(S,b),T}for(x=o(S,x);!H.done;b++,H=P.next())H=p(x,S,b,H.value,v),H!==null&&(t&&H.alternate!==null&&x.delete(H.key===null?b:H.key),C=i(H,C,b),w===null?T=H:w.sibling=H,w=H);return t&&x.forEach(function(E){return e(S,E)}),Nc&&sv(S,b),T}function y(S,C,P,v){if(typeof P=="object"&&P!==null&&P.type===WP&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case Kj:e:{for(var T=P.key,w=C;w!==null;){if(w.key===T){if(T=P.type,T===WP){if(w.tag===7){n(S,w.sibling),C=r(w,P.props.children),C.return=S,S=C;break e}}else if(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===_4&&SAe(T)===w.type){n(S,w.sibling),C=r(w,P.props),C.ref=fz(S,w,P),C.return=S,S=C;break e}n(S,w);break}else e(S,w);w=w.sibling}P.type===WP?(C=cx(P.props.children,S.mode,v,P.key),C.return=S,S=C):(v=RV(P.type,P.key,P.props,null,S.mode,v),v.ref=fz(S,C,P),v.return=S,S=v)}return a(S);case LP:e:{for(w=P.key;C!==null;){if(C.key===w)if(C.tag===4&&C.stateNode.containerInfo===P.containerInfo&&C.stateNode.implementation===P.implementation){n(S,C.sibling),C=r(C,P.children||[]),C.return=S,S=C;break e}else{n(S,C);break}else e(S,C);C=C.sibling}C=poe(P,S.mode,v),C.return=S,S=C}return a(S);case _4:return w=P._init,y(S,C,w(P._payload),v)}if(PD(P))return g(S,C,P,v);if(lz(P))return A(S,C,P,v);aB(S,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,C!==null&&C.tag===6?(n(S,C.sibling),C=r(C,P),C.return=S,S=C):(n(S,C),C=hoe(P,S.mode,v),C.return=S,S=C),a(S)):n(S,C)}return y}var $C=sLe(!0),cLe=sLe(!1),QL={},b9=Hw(QL),yF=Hw(QL),AF=Hw(QL);function Ev(t){if(t===QL)throw Error(Jo(174));return t}function Kpe(t,e){switch(Js(AF,e),Js(yF,t),Js(b9,QL),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Qle(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Qle(e,t)}wc(b9),Js(b9,e)}function QC(){wc(b9),wc(yF),wc(AF)}function uLe(t){Ev(AF.current);var e=Ev(b9.current),n=Qle(e,t.type);e!==n&&(Js(yF,t),Js(b9,n))}function qpe(t){yF.current===t&&(wc(b9),wc(yF))}var Zc=Hw(0);function U_(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var loe=[];function $pe(){for(var t=0;tn?n:4,t(!0);var o=soe.transition;soe.transition={};try{t(!1),e()}finally{fs=n,soe.transition=o}}function CLe(){return Km().memoizedState}function Hdt(t,e,n){var o=U8(t);if(n={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null},RLe(t))HLe(e,n);else if(n=rLe(t,e,n,o),n!==null){var r=up();I2(n,t,o,r),MLe(n,e,o)}}function Mdt(t,e,n){var o=U8(t),r={lane:o,action:n,hasEagerState:!1,eagerState:null,next:null};if(RLe(t))HLe(e,r);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var a=e.lastRenderedState,l=i(a,n);if(r.hasEagerState=!0,r.eagerState=l,Y2(l,a)){var s=e.interleaved;s===null?(r.next=r,Xpe(e)):(r.next=s.next,s.next=r),e.interleaved=r;return}}catch{}finally{}n=rLe(t,e,r,o),n!==null&&(r=up(),I2(n,t,o,r),MLe(n,e,o))}}function RLe(t){var e=t.alternate;return t===o0||e!==null&&e===o0}function HLe(t,e){cE=j_=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function MLe(t,e,n){if(n&4194240){var o=e.lanes;o&=t.pendingLanes,n|=o,e.lanes=n,Epe(t,n)}}var B_={readContext:Jm,useCallback:Uf,useContext:Uf,useEffect:Uf,useImperativeHandle:Uf,useInsertionEffect:Uf,useLayoutEffect:Uf,useMemo:Uf,useReducer:Uf,useRef:Uf,useState:Uf,useDebugValue:Uf,useDeferredValue:Uf,useTransition:Uf,useMutableSource:Uf,useSyncExternalStore:Uf,useId:Uf,unstable_isNewReconciler:!1},Idt={readContext:Jm,useCallback:function(t,e){return Q5().memoizedState=[t,e===void 0?null:e],t},useContext:Jm,useEffect:PAe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,SV(4194308,4,xLe.bind(null,e,t),n)},useLayoutEffect:function(t,e){return SV(4194308,4,t,e)},useInsertionEffect:function(t,e){return SV(4,2,t,e)},useMemo:function(t,e){var n=Q5();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var o=Q5();return e=n!==void 0?n(e):e,o.memoizedState=o.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},o.queue=t,t=t.dispatch=Hdt.bind(null,o0,t),[o.memoizedState,t]},useRef:function(t){var e=Q5();return t={current:t},e.memoizedState=t},useState:TAe,useDebugValue:n1e,useDeferredValue:function(t){return Q5().memoizedState=t},useTransition:function(){var t=TAe(!1),e=t[0];return t=Rdt.bind(null,t[1]),Q5().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var o=o0,r=Q5();if(Nc){if(n===void 0)throw Error(Jo(407));n=n()}else{if(n=e(),Pd===null)throw Error(Jo(349));Yx&30||hLe(o,e,n)}r.memoizedState=n;var i={value:n,getSnapshot:e};return r.queue=i,PAe(gLe.bind(null,o,i,t),[t]),o.flags|=2048,xF(9,pLe.bind(null,o,i,n,e),void 0,null),n},useId:function(){var t=Q5(),e=Pd.identifierPrefix;if(Nc){var n=S6,o=b6;n=(o&~(1<<32-M2(o)-1)).toString(32)+n,e=":"+e+"R"+n,n=wF++,0<\/script>",t=t.removeChild(t.firstChild)):typeof o.is=="string"?t=a.createElement(n,{is:o.is}):(t=a.createElement(n),n==="select"&&(a=t,o.multiple?a.multiple=!0:o.size&&(a.size=o.size))):t=a.createElementNS(t,n),t[u9]=e,t[mF]=o,NLe(t,e,!1,!1),e.stateNode=t;e:{switch(a=ese(n,o),n){case"dialog":ac("cancel",t),ac("close",t),r=o;break;case"iframe":case"object":case"embed":ac("load",t),r=o;break;case"video":case"audio":for(r=0;reR&&(e.flags|=128,o=!0,hz(i,!1),e.lanes=4194304)}else{if(!o)if(t=U_(a),t!==null){if(e.flags|=128,o=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),hz(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Nc)return Uf(e),null}else 2*L0()-i.renderingStartTime>eR&&n!==1073741824&&(e.flags|=128,o=!0,hz(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(n=i.last,n!==null?n.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=L0(),e.sibling=null,n=Zc.current,Js(Zc,o?n&1|2:n&1),e):(Uf(e),null);case 22:case 23:return s1e(),o=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==o&&(e.flags|=8192),o&&e.mode&1?Q1&1073741824&&(Uf(e),e.subtreeFlags&6&&(e.flags|=8192)):Uf(e),null;case 24:return null;case 25:return null}throw Error(Jo(156,e.tag))}function Ndt(t,e){switch(Ype(e),e.tag){case 1:return qp(e.type)&&D_(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return QC(),wc(Kp),wc(mh),$pe(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return qpe(e),null;case 13:if(wc(Zc),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Jo(340));qC()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return wc(Zc),null;case 4:return QC(),null;case 10:return Gpe(e.type._context),null;case 22:case 23:return s1e(),null;case 24:return null;default:return null}}var sB=!1,rh=!1,Udt=typeof WeakSet=="function"?WeakSet:Set,jr=null;function GP(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){d0(t,e,o)}else n.current=null}function Rse(t,e,n){try{n()}catch(o){d0(t,e,o)}}var FAe=!1;function jdt(t,e){if(use=H_,t=Vke(),jpe(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var r=o.anchorOffset,i=o.focusNode;o=o.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,s=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var p;d!==n||r!==0&&d.nodeType!==3||(l=a+r),d!==i||o!==0&&d.nodeType!==3||(s=a+o),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++c===r&&(l=a),f===i&&++u===o&&(s=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=l===-1||s===-1?null:{start:l,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(dse={focusedElem:t,selectionRange:n},H_=!1,jr=e;jr!==null;)if(e=jr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,jr=t;else for(;jr!==null;){e=jr;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var A=g.memoizedProps,y=g.memoizedState,S=e.stateNode,C=S.getSnapshotBeforeUpdate(e.elementType===e.type?A:a2(e.type,A),y);S.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var P=e.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Jo(163))}}catch(v){d0(e,e.return,v)}if(t=e.sibling,t!==null){t.return=e.return,jr=t;break}jr=e.return}return g=FAe,FAe=!1,g}function uE(t,e,n){var o=e.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var r=o=o.next;do{if((r.tag&t)===t){var i=r.destroy;r.destroy=void 0,i!==void 0&&Rse(e,n,i)}r=r.next}while(r!==o)}}function OK(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var o=n.create;n.destroy=o()}n=n.next}while(n!==e)}}function Hse(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function BLe(t){var e=t.alternate;e!==null&&(t.alternate=null,BLe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[u9],delete e[mF],delete e[pse],delete e[bdt],delete e[Sdt])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function YLe(t){return t.tag===5||t.tag===3||t.tag===4}function kAe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||YLe(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.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Mse(t,e,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=z_));else if(o!==4&&(t=t.child,t!==null))for(Mse(t,e,n),t=t.sibling;t!==null;)Mse(t,e,n),t=t.sibling}function Ise(t,e,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(o!==4&&(t=t.child,t!==null))for(Ise(t,e,n),t=t.sibling;t!==null;)Ise(t,e,n),t=t.sibling}var of=null,c2=!1;function y4(t,e,n){for(n=n.child;n!==null;)OLe(t,e,n),n=n.sibling}function OLe(t,e,n){if(x9&&typeof x9.onCommitFiberUnmount=="function")try{x9.onCommitFiberUnmount(kK,n)}catch{}switch(n.tag){case 5:rh||GP(n,e);case 6:var o=of,r=c2;of=null,y4(t,e,n),of=o,c2=r,of!==null&&(c2?(t=of,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):of.removeChild(n.stateNode));break;case 18:of!==null&&(c2?(t=of,n=n.stateNode,t.nodeType===8?ioe(t.parentNode,n):t.nodeType===1&&ioe(t,n),dF(t)):ioe(of,n.stateNode));break;case 4:o=of,r=c2,of=n.stateNode.containerInfo,c2=!0,y4(t,e,n),of=o,c2=r;break;case 0:case 11:case 14:case 15:if(!rh&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){r=o=o.next;do{var i=r,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Rse(n,e,a),r=r.next}while(r!==o)}y4(t,e,n);break;case 1:if(!rh&&(GP(n,e),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(l){d0(n,e,l)}y4(t,e,n);break;case 21:y4(t,e,n);break;case 22:n.mode&1?(rh=(o=rh)||n.memoizedState!==null,y4(t,e,n),rh=o):y4(t,e,n);break;default:y4(t,e,n)}}function LAe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Udt),e.forEach(function(o){var r=Kdt.bind(null,t,o);n.has(o)||(n.add(o),o.then(r,r))})}}function _y(t,e){var n=e.deletions;if(n!==null)for(var o=0;or&&(r=a),o&=~i}if(o=r,o=L0()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Ydt(o/1960))-o,10t?16:t,h8===null)var o=!1;else{if(t=h8,h8=null,V_=0,Hl&6)throw Error(Jo(331));var r=Hl;for(Hl|=4,jr=t.current;jr!==null;){var i=jr,a=i.child;if(jr.flags&16){var l=i.deletions;if(l!==null){for(var s=0;sL0()-a1e?sx(t,0):i1e|=n),$p(t,e)}function $Le(t,e){e===0&&(t.mode&1?(e=Zj,Zj<<=1,!(Zj&130023424)&&(Zj=4194304)):e=1);var n=up();t=J6(t,e),t!==null&&(KL(t,e,n),$p(t,n))}function Jdt(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),$Le(t,n)}function Kdt(t,e){var n=0;switch(t.tag){case 13:var o=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:o=t.stateNode;break;default:throw Error(Jo(314))}o!==null&&o.delete(e),$Le(t,n)}var QLe;QLe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Kp.current)Yp=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Yp=!1,Ldt(t,e,n);Yp=!!(t.flags&131072)}else Yp=!1,Nc&&e.flags&1048576&&tLe(e,k_,e.index);switch(e.lanes=0,e.tag){case 2:var o=e.type;TV(t,e),t=e.pendingProps;var r=KC(e,mh.current);bC(e,n),r=Zpe(null,e,o,t,r,n);var i=e1e();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,qp(o)?(i=!0,E_(e)):i=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Jpe(e),r.updater=BK,e.stateNode=r,r._reactInternals=e,vse(e,o,t,n),e=Sse(null,e,o,!0,i,n)):(e.tag=0,Nc&&i&&Bpe(e),Kh(null,e,r,n),e=e.child),e;case 16:o=e.elementType;e:{switch(TV(t,e),t=e.pendingProps,r=o._init,o=r(o._payload),e.type=o,r=e.tag=$dt(o),t=a2(o,t),r){case 0:e=bse(null,e,o,t,n);break e;case 1:e=zAe(null,e,o,t,n);break e;case 11:e=MAe(null,e,o,t,n);break e;case 14:e=IAe(null,e,o,a2(o.type,t),n);break e}throw Error(Jo(306,o,""))}return e;case 0:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),bse(t,e,o,r,n);case 1:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),zAe(t,e,o,r,n);case 3:e:{if(kLe(e),t===null)throw Error(Jo(387));o=e.pendingProps,i=e.memoizedState,r=i.element,iLe(t,e),N_(e,o,null,n);var a=e.memoizedState;if(o=a.element,i.isDehydrated)if(i={element:o,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){r=ZC(Error(Jo(423)),e),e=DAe(t,e,o,n,r);break e}else if(o!==r){r=ZC(Error(Jo(424)),e),e=DAe(t,e,o,n,r);break e}else for(hg=L8(e.stateNode.containerInfo.firstChild),xg=e,Nc=!0,g2=null,n=cLe(e,null,o,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qC(),o===r){e=K6(t,e,n);break e}Kh(t,e,o,n)}e=e.child}return e;case 5:return uLe(e),t===null&&yse(e),o=e.type,r=e.pendingProps,i=t!==null?t.memoizedProps:null,a=r.children,fse(o,r)?a=null:i!==null&&fse(o,i)&&(e.flags|=32),FLe(t,e),Kh(t,e,a,n),e.child;case 6:return t===null&&yse(e),null;case 13:return LLe(t,e,n);case 4:return Kpe(e,e.stateNode.containerInfo),o=e.pendingProps,t===null?e.child=$C(e,null,o,n):Kh(t,e,o,n),e.child;case 11:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),MAe(t,e,o,r,n);case 7:return Kh(t,e,e.pendingProps,n),e.child;case 8:return Kh(t,e,e.pendingProps.children,n),e.child;case 12:return Kh(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(o=e.type._context,r=e.pendingProps,i=e.memoizedProps,a=r.value,Js(L_,o._currentValue),o._currentValue=a,i!==null)if(Y2(i.value,a)){if(i.children===r.children&&!Kp.current){e=K6(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var s=l.firstContext;s!==null;){if(s.context===o){if(i.tag===1){s=F6(-1,n&-n),s.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?s.next=s:(s.next=u.next,u.next=s),c.pending=s}}i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Ase(i.return,n,e),l.lanes|=n;break}s=s.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Jo(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Ase(a,n,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Kh(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,o=e.pendingProps.children,bC(e,n),r=Jm(r),o=o(r),e.flags|=1,Kh(t,e,o,n),e.child;case 14:return o=e.type,r=a2(o,e.pendingProps),r=a2(o.type,r),IAe(t,e,o,r,n);case 15:return DLe(t,e,e.type,e.pendingProps,n);case 17:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),TV(t,e),e.tag=1,qp(o)?(t=!0,E_(e)):t=!1,bC(e,n),lLe(e,o,r),vse(e,o,r,n),Sse(null,e,o,!0,t,n);case 19:return WLe(t,e,n);case 22:return ELe(t,e,n)}throw Error(Jo(156,e.tag))};function ZLe(t,e){return Pke(t,e)}function qdt(t,e,n,o){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lm(t,e,n,o){return new qdt(t,e,n,o)}function u1e(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $dt(t){if(typeof t=="function")return u1e(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Mpe)return 11;if(t===Ipe)return 14}return 2}function j8(t,e){var n=t.alternate;return n===null?(n=Lm(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function RV(t,e,n,o,r,i){var a=2;if(o=t,typeof t=="function")u1e(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case WP:return cx(n.children,r,i,e);case Hpe:a=8,r|=8;break;case Vle:return t=Lm(12,n,e,r|2),t.elementType=Vle,t.lanes=i,t;case _le:return t=Lm(13,n,e,r),t.elementType=_le,t.lanes=i,t;case Gle:return t=Lm(19,n,e,r),t.elementType=Gle,t.lanes=i,t;case ske:return _K(n,r,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ake:a=10;break e;case lke:a=9;break e;case Mpe:a=11;break e;case Ipe:a=14;break e;case _4:a=16,o=null;break e}throw Error(Jo(130,t==null?t:typeof t,""))}return e=Lm(a,n,e,r),e.elementType=t,e.type=o,e.lanes=i,e}function cx(t,e,n,o){return t=Lm(7,t,o,e),t.lanes=n,t}function _K(t,e,n,o){return t=Lm(22,t,o,e),t.elementType=ske,t.lanes=n,t.stateNode={isHidden:!1},t}function hoe(t,e,n){return t=Lm(6,t,null,e),t.lanes=n,t}function poe(t,e,n){return e=Lm(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Qdt(t,e,n,o,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jne(0),this.expirationTimes=Jne(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jne(0),this.identifierPrefix=o,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function d1e(t,e,n,o,r,i,a,l,s){return t=new Qdt(t,e,n,l,s),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Lm(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jpe(i),t}function Zdt(t,e,n){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oWe)}catch(t){console.error(t)}}oWe(),tke.exports=kg;var Hd=tke.exports;const X_=Wi(Hd),rft=OFe({__proto__:null,default:X_},[Hd]);var rWe,VAe=Hd;rWe=VAe.createRoot,VAe.hydrateRoot;var iWe={exports:{}},aWe={},lWe={exports:{}},sWe={};/** +`+i.stack}return{value:t,source:e,stack:r,digest:null}}function doe(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function xse(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Edt=typeof WeakMap=="function"?WeakMap:Map;function ILe(t,e,n){n=F6(-1,n),n.tag=3,n.payload={element:null};var o=e.value;return n.callback=function(){O_||(O_=!0,zse=o),xse(t,e)},n}function zLe(t,e,n){n=F6(-1,n),n.tag=3;var o=t.type.getDerivedStateFromError;if(typeof o=="function"){var r=e.value;n.payload=function(){return o(r)},n.callback=function(){xse(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){xse(t,e),typeof o!="function"&&(N8===null?N8=new Set([this]):N8.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function CAe(t,e,n){var o=t.pingCache;if(o===null){o=t.pingCache=new Edt;var r=new Set;o.set(e,r)}else r=o.get(e),r===void 0&&(r=new Set,o.set(e,r));r.has(n)||(r.add(n),t=Xdt.bind(null,t,e,n),e.then(t,t))}function RAe(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function HAe(t,e,n,o,r){return t.mode&1?(t.flags|=65536,t.lanes=r,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=F6(-1,1),e.tag=2,W8(n,e,1))),n.lanes|=1),t)}var Fdt=pA.ReactCurrentOwner,Yp=!1;function Kh(t,e,n,o){e.child=t===null?cLe(e,null,n,o):$C(e,t.child,n,o)}function MAe(t,e,n,o,r){n=n.render;var i=e.ref;return bC(e,r),o=Zpe(t,e,n,o,i,r),n=e1e(),t!==null&&!Yp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,K6(t,e,r)):(Nc&&n&&Bpe(e),e.flags|=1,Kh(t,e,o,r),e.child)}function IAe(t,e,n,o,r){if(t===null){var i=n.type;return typeof i=="function"&&!u1e(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,DLe(t,e,i,o,r)):(t=RV(n.type,null,o,e,e.mode,r),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&r)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:hF,n(a,o)&&t.ref===e.ref)return K6(t,e,r)}return e.flags|=1,t=j8(i,o),t.ref=e.ref,t.return=e,e.child=t}function DLe(t,e,n,o,r){if(t!==null){var i=t.memoizedProps;if(hF(i,o)&&t.ref===e.ref)if(Yp=!1,e.pendingProps=o=i,(t.lanes&r)!==0)t.flags&131072&&(Yp=!0);else return e.lanes=t.lanes,K6(t,e,r)}return bse(t,e,n,o,r)}function ELe(t,e,n){var o=e.pendingProps,r=o.children,i=t!==null?t.memoizedState:null;if(o.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Js(XP,Q1),Q1|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Js(XP,Q1),Q1|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=i!==null?i.baseLanes:n,Js(XP,Q1),Q1|=o}else i!==null?(o=i.baseLanes|n,e.memoizedState=null):o=n,Js(XP,Q1),Q1|=o;return Kh(t,e,r,n),e.child}function FLe(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function bse(t,e,n,o,r){var i=qp(n)?jx:yh.current;return i=KC(e,i),bC(e,r),n=Zpe(t,e,n,o,i,r),o=e1e(),t!==null&&!Yp?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~r,K6(t,e,r)):(Nc&&o&&Bpe(e),e.flags|=1,Kh(t,e,n,r),e.child)}function zAe(t,e,n,o,r){if(qp(n)){var i=!0;E_(e)}else i=!1;if(bC(e,r),e.stateNode===null)TV(t,e),lLe(e,n,o),vse(e,n,o,r),o=!0;else if(t===null){var a=e.stateNode,l=e.memoizedProps;a.props=l;var s=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=Jm(c):(c=qp(n)?jx:yh.current,c=KC(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==o||s!==c)&&bAe(e,a,o,c),G4=!1;var f=e.memoizedState;a.state=f,N_(e,o,a,r),s=e.memoizedState,l!==o||f!==s||Kp.current||G4?(typeof u=="function"&&(wse(e,n,u,o),s=e.memoizedState),(l=G4||xAe(e,n,l,o,f,s,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=o,e.memoizedState=s),a.props=o,a.state=s,a.context=c,o=l):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),o=!1)}else{a=e.stateNode,iLe(t,e),l=e.memoizedProps,c=e.type===e.elementType?l:a2(e.type,l),a.props=c,d=e.pendingProps,f=a.context,s=n.contextType,typeof s=="object"&&s!==null?s=Jm(s):(s=qp(n)?jx:yh.current,s=KC(e,s));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==d||f!==s)&&bAe(e,a,o,s),G4=!1,f=e.memoizedState,a.state=f,N_(e,o,a,r);var g=e.memoizedState;l!==d||f!==g||Kp.current||G4?(typeof p=="function"&&(wse(e,n,p,o),g=e.memoizedState),(c=G4||xAe(e,n,c,o,f,g,s)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(o,g,s),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(o,g,s)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=o,e.memoizedState=g),a.props=o,a.state=g,a.context=s,o=c):(typeof a.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),o=!1)}return Sse(t,e,n,o,i,r)}function Sse(t,e,n,o,r,i){FLe(t,e);var a=(e.flags&128)!==0;if(!o&&!a)return r&&mAe(e,n,!1),K6(t,e,i);o=e.stateNode,Fdt.current=e;var l=a&&typeof n.getDerivedStateFromError!="function"?null:o.render();return e.flags|=1,t!==null&&a?(e.child=$C(e,t.child,null,i),e.child=$C(e,null,l,i)):Kh(t,e,l,i),e.memoizedState=o.state,r&&mAe(e,n,!0),e.child}function kLe(t){var e=t.stateNode;e.pendingContext?gAe(t,e.pendingContext,e.pendingContext!==e.context):e.context&&gAe(t,e.context,!1),Kpe(t,e.containerInfo)}function DAe(t,e,n,o,r){return qC(),Ope(r),e.flags|=256,Kh(t,e,n,o),e.child}var Tse={dehydrated:null,treeContext:null,retryLane:0};function Pse(t){return{baseLanes:t,cachePool:null,transitions:null}}function LLe(t,e,n){var o=e.pendingProps,r=Zc.current,i=!1,a=(e.flags&128)!==0,l;if((l=a)||(l=t!==null&&t.memoizedState===null?!1:(r&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(r|=1),Js(Zc,r&1),t===null)return yse(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=o.children,t=o.fallback,i?(o=e.mode,i=e.child,a={mode:"hidden",children:a},!(o&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=_K(a,o,0,null),t=cx(t,o,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Pse(n),e.memoizedState=Tse,t):o1e(e,a));if(r=t.memoizedState,r!==null&&(l=r.dehydrated,l!==null))return kdt(t,e,a,o,l,r,n);if(i){i=o.fallback,a=e.mode,r=t.child,l=r.sibling;var s={mode:"hidden",children:o.children};return!(a&1)&&e.child!==r?(o=e.child,o.childLanes=0,o.pendingProps=s,e.deletions=null):(o=j8(r,s),o.subtreeFlags=r.subtreeFlags&14680064),l!==null?i=j8(l,i):(i=cx(i,a,n,null),i.flags|=2),i.return=e,o.return=e,o.sibling=i,e.child=o,o=i,i=e.child,a=t.child.memoizedState,a=a===null?Pse(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~n,e.memoizedState=Tse,o}return i=t.child,t=i.sibling,o=j8(i,{mode:"visible",children:o.children}),!(e.mode&1)&&(o.lanes=n),o.return=e,o.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=o,e.memoizedState=null,o}function o1e(t,e){return e=_K({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function lB(t,e,n,o){return o!==null&&Ope(o),$C(e,t.child,null,n),t=o1e(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function kdt(t,e,n,o,r,i,a){if(n)return e.flags&256?(e.flags&=-257,o=doe(Error(Jo(422))),lB(t,e,a,o)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=o.fallback,r=e.mode,o=_K({mode:"visible",children:o.children},r,0,null),i=cx(i,r,a,null),i.flags|=2,o.return=e,i.return=e,o.sibling=i,e.child=o,e.mode&1&&$C(e,t.child,null,a),e.child.memoizedState=Pse(a),e.memoizedState=Tse,i);if(!(e.mode&1))return lB(t,e,a,null);if(r.data==="$!"){if(o=r.nextSibling&&r.nextSibling.dataset,o)var l=o.dgst;return o=l,i=Error(Jo(419)),o=doe(i,o,void 0),lB(t,e,a,o)}if(l=(a&t.childLanes)!==0,Yp||l){if(o=Pd,o!==null){switch(a&-a){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(o.suspendedLanes|a)?0:r,r!==0&&r!==i.retryLane&&(i.retryLane=r,J6(t,r),I2(o,t,r,-1))}return c1e(),o=doe(Error(Jo(421))),lB(t,e,a,o)}return r.data==="$?"?(e.flags|=128,e.child=t.child,e=Jdt.bind(null,t),r._reactRetry=e,null):(t=i.treeContext,hg=L8(r.nextSibling),xg=e,Nc=!0,g2=null,t!==null&&(Cm[Rm++]=b6,Cm[Rm++]=S6,Cm[Rm++]=Bx,b6=t.id,S6=t.overflow,Bx=e),e=o1e(e,o.children),e.flags|=4096,e)}function EAe(t,e,n){t.lanes|=e;var o=t.alternate;o!==null&&(o.lanes|=e),Ase(t.return,e,n)}function foe(t,e,n,o,r){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:o,tail:n,tailMode:r}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=o,i.tail=n,i.tailMode=r)}function WLe(t,e,n){var o=e.pendingProps,r=o.revealOrder,i=o.tail;if(Kh(t,e,o.children,n),o=Zc.current,o&2)o=o&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&EAe(t,n,e);else if(t.tag===19)EAe(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}o&=1}if(Js(Zc,o),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(n=e.child,r=null;n!==null;)t=n.alternate,t!==null&&U_(t)===null&&(r=n),n=n.sibling;n=r,n===null?(r=e.child,e.child=null):(r=n.sibling,n.sibling=null),foe(e,!1,r,n,i);break;case"backwards":for(n=null,r=e.child,e.child=null;r!==null;){if(t=r.alternate,t!==null&&U_(t)===null){e.child=r;break}t=r.sibling,r.sibling=n,n=r,r=t}foe(e,!0,n,null,i);break;case"together":foe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function TV(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function K6(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Ox|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Jo(153));if(e.child!==null){for(t=e.child,n=j8(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=j8(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Ldt(t,e,n){switch(e.tag){case 3:kLe(e),qC();break;case 5:uLe(e);break;case 1:qp(e.type)&&E_(e);break;case 4:Kpe(e,e.stateNode.containerInfo);break;case 10:var o=e.type._context,r=e.memoizedProps.value;Js(L_,o._currentValue),o._currentValue=r;break;case 13:if(o=e.memoizedState,o!==null)return o.dehydrated!==null?(Js(Zc,Zc.current&1),e.flags|=128,null):n&e.child.childLanes?LLe(t,e,n):(Js(Zc,Zc.current&1),t=K6(t,e,n),t!==null?t.sibling:null);Js(Zc,Zc.current&1);break;case 19:if(o=(n&e.childLanes)!==0,t.flags&128){if(o)return WLe(t,e,n);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Js(Zc,Zc.current),o)break;return null;case 22:case 23:return e.lanes=0,ELe(t,e,n)}return K6(t,e,n)}var NLe,Cse,ULe,jLe;NLe=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Cse=function(){};ULe=function(t,e,n,o){var r=t.memoizedProps;if(r!==o){t=e.stateNode,Ev(b9.current);var i=null;switch(n){case"input":r=Jle(t,r),o=Jle(t,o),i=[];break;case"select":r=a0({},r,{value:void 0}),o=a0({},o,{value:void 0}),i=[];break;case"textarea":r=$le(t,r),o=$le(t,o),i=[];break;default:typeof r.onClick!="function"&&typeof o.onClick=="function"&&(t.onclick=z_)}Zle(n,o);var a;n=null;for(c in r)if(!o.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var l=r[c];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(aF.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in o){var s=o[c];if(l=r!=null?r[c]:void 0,o.hasOwnProperty(c)&&s!==l&&(s!=null||l!=null))if(c==="style")if(l){for(a in l)!l.hasOwnProperty(a)||s&&s.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in s)s.hasOwnProperty(a)&&l[a]!==s[a]&&(n||(n={}),n[a]=s[a])}else n||(i||(i=[]),i.push(c,n)),n=s;else c==="dangerouslySetInnerHTML"?(s=s?s.__html:void 0,l=l?l.__html:void 0,s!=null&&l!==s&&(i=i||[]).push(c,s)):c==="children"?typeof s!="string"&&typeof s!="number"||(i=i||[]).push(c,""+s):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(aF.hasOwnProperty(c)?(s!=null&&c==="onScroll"&&ac("scroll",t),i||l===s||(i=[])):(i=i||[]).push(c,s))}n&&(i=i||[]).push("style",n);var c=i;(e.updateQueue=c)&&(e.flags|=4)}};jLe=function(t,e,n,o){n!==o&&(e.flags|=4)};function hz(t,e){if(!Nc)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var o=null;n!==null;)n.alternate!==null&&(o=n),n=n.sibling;o===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function jf(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,o=0;if(e)for(var r=t.child;r!==null;)n|=r.lanes|r.childLanes,o|=r.subtreeFlags&14680064,o|=r.flags&14680064,r.return=t,r=r.sibling;else for(r=t.child;r!==null;)n|=r.lanes|r.childLanes,o|=r.subtreeFlags,o|=r.flags,r.return=t,r=r.sibling;return t.subtreeFlags|=o,t.childLanes=n,e}function Wdt(t,e,n){var o=e.pendingProps;switch(Ype(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jf(e),null;case 1:return qp(e.type)&&D_(),jf(e),null;case 3:return o=e.stateNode,QC(),wc(Kp),wc(yh),$pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(iB(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,g2!==null&&(Fse(g2),g2=null))),Cse(t,e),jf(e),null;case 5:qpe(e);var r=Ev(AF.current);if(n=e.type,t!==null&&e.stateNode!=null)ULe(t,e,n,o,r),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!o){if(e.stateNode===null)throw Error(Jo(166));return jf(e),null}if(t=Ev(b9.current),iB(e)){o=e.stateNode,n=e.type;var i=e.memoizedProps;switch(o[u9]=e,o[mF]=i,t=(e.mode&1)!==0,n){case"dialog":ac("cancel",o),ac("close",o);break;case"iframe":case"object":case"embed":ac("load",o);break;case"video":case"audio":for(r=0;r<\/script>",t=t.removeChild(t.firstChild)):typeof o.is=="string"?t=a.createElement(n,{is:o.is}):(t=a.createElement(n),n==="select"&&(a=t,o.multiple?a.multiple=!0:o.size&&(a.size=o.size))):t=a.createElementNS(t,n),t[u9]=e,t[mF]=o,NLe(t,e,!1,!1),e.stateNode=t;e:{switch(a=ese(n,o),n){case"dialog":ac("cancel",t),ac("close",t),r=o;break;case"iframe":case"object":case"embed":ac("load",t),r=o;break;case"video":case"audio":for(r=0;reR&&(e.flags|=128,o=!0,hz(i,!1),e.lanes=4194304)}else{if(!o)if(t=U_(a),t!==null){if(e.flags|=128,o=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),hz(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Nc)return jf(e),null}else 2*L0()-i.renderingStartTime>eR&&n!==1073741824&&(e.flags|=128,o=!0,hz(i,!1),e.lanes=4194304);i.isBackwards?(a.sibling=e.child,e.child=a):(n=i.last,n!==null?n.sibling=a:e.child=a,i.last=a)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=L0(),e.sibling=null,n=Zc.current,Js(Zc,o?n&1|2:n&1),e):(jf(e),null);case 22:case 23:return s1e(),o=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==o&&(e.flags|=8192),o&&e.mode&1?Q1&1073741824&&(jf(e),e.subtreeFlags&6&&(e.flags|=8192)):jf(e),null;case 24:return null;case 25:return null}throw Error(Jo(156,e.tag))}function Ndt(t,e){switch(Ype(e),e.tag){case 1:return qp(e.type)&&D_(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return QC(),wc(Kp),wc(yh),$pe(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return qpe(e),null;case 13:if(wc(Zc),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Jo(340));qC()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return wc(Zc),null;case 4:return QC(),null;case 10:return Gpe(e.type._context),null;case 22:case 23:return s1e(),null;case 24:return null;default:return null}}var sB=!1,ih=!1,Udt=typeof WeakSet=="function"?WeakSet:Set,jr=null;function GP(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(o){d0(t,e,o)}else n.current=null}function Rse(t,e,n){try{n()}catch(o){d0(t,e,o)}}var FAe=!1;function jdt(t,e){if(use=H_,t=Vke(),jpe(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var o=n.getSelection&&n.getSelection();if(o&&o.rangeCount!==0){n=o.anchorNode;var r=o.anchorOffset,i=o.focusNode;o=o.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,s=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var p;d!==n||r!==0&&d.nodeType!==3||(l=a+r),d!==i||o!==0&&d.nodeType!==3||(s=a+o),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++c===r&&(l=a),f===i&&++u===o&&(s=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=l===-1||s===-1?null:{start:l,end:s}}else n=null}n=n||{start:0,end:0}}else n=null;for(dse={focusedElem:t,selectionRange:n},H_=!1,jr=e;jr!==null;)if(e=jr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,jr=t;else for(;jr!==null;){e=jr;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var A=g.memoizedProps,y=g.memoizedState,S=e.stateNode,C=S.getSnapshotBeforeUpdate(e.elementType===e.type?A:a2(e.type,A),y);S.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var P=e.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Jo(163))}}catch(v){d0(e,e.return,v)}if(t=e.sibling,t!==null){t.return=e.return,jr=t;break}jr=e.return}return g=FAe,FAe=!1,g}function uE(t,e,n){var o=e.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var r=o=o.next;do{if((r.tag&t)===t){var i=r.destroy;r.destroy=void 0,i!==void 0&&Rse(e,n,i)}r=r.next}while(r!==o)}}function OK(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var o=n.create;n.destroy=o()}n=n.next}while(n!==e)}}function Hse(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function BLe(t){var e=t.alternate;e!==null&&(t.alternate=null,BLe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[u9],delete e[mF],delete e[pse],delete e[bdt],delete e[Sdt])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function YLe(t){return t.tag===5||t.tag===3||t.tag===4}function kAe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||YLe(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.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Mse(t,e,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=z_));else if(o!==4&&(t=t.child,t!==null))for(Mse(t,e,n),t=t.sibling;t!==null;)Mse(t,e,n),t=t.sibling}function Ise(t,e,n){var o=t.tag;if(o===5||o===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(o!==4&&(t=t.child,t!==null))for(Ise(t,e,n),t=t.sibling;t!==null;)Ise(t,e,n),t=t.sibling}var of=null,c2=!1;function y4(t,e,n){for(n=n.child;n!==null;)OLe(t,e,n),n=n.sibling}function OLe(t,e,n){if(x9&&typeof x9.onCommitFiberUnmount=="function")try{x9.onCommitFiberUnmount(kK,n)}catch{}switch(n.tag){case 5:ih||GP(n,e);case 6:var o=of,r=c2;of=null,y4(t,e,n),of=o,c2=r,of!==null&&(c2?(t=of,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):of.removeChild(n.stateNode));break;case 18:of!==null&&(c2?(t=of,n=n.stateNode,t.nodeType===8?ioe(t.parentNode,n):t.nodeType===1&&ioe(t,n),dF(t)):ioe(of,n.stateNode));break;case 4:o=of,r=c2,of=n.stateNode.containerInfo,c2=!0,y4(t,e,n),of=o,c2=r;break;case 0:case 11:case 14:case 15:if(!ih&&(o=n.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){r=o=o.next;do{var i=r,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Rse(n,e,a),r=r.next}while(r!==o)}y4(t,e,n);break;case 1:if(!ih&&(GP(n,e),o=n.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=n.memoizedProps,o.state=n.memoizedState,o.componentWillUnmount()}catch(l){d0(n,e,l)}y4(t,e,n);break;case 21:y4(t,e,n);break;case 22:n.mode&1?(ih=(o=ih)||n.memoizedState!==null,y4(t,e,n),ih=o):y4(t,e,n);break;default:y4(t,e,n)}}function LAe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Udt),e.forEach(function(o){var r=Kdt.bind(null,t,o);n.has(o)||(n.add(o),o.then(r,r))})}}function _y(t,e){var n=e.deletions;if(n!==null)for(var o=0;or&&(r=a),o&=~i}if(o=r,o=L0()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*Ydt(o/1960))-o,10t?16:t,h8===null)var o=!1;else{if(t=h8,h8=null,V_=0,Hl&6)throw Error(Jo(331));var r=Hl;for(Hl|=4,jr=t.current;jr!==null;){var i=jr,a=i.child;if(jr.flags&16){var l=i.deletions;if(l!==null){for(var s=0;sL0()-a1e?sx(t,0):i1e|=n),$p(t,e)}function $Le(t,e){e===0&&(t.mode&1?(e=Zj,Zj<<=1,!(Zj&130023424)&&(Zj=4194304)):e=1);var n=up();t=J6(t,e),t!==null&&(KL(t,e,n),$p(t,n))}function Jdt(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),$Le(t,n)}function Kdt(t,e){var n=0;switch(t.tag){case 13:var o=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:o=t.stateNode;break;default:throw Error(Jo(314))}o!==null&&o.delete(e),$Le(t,n)}var QLe;QLe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Kp.current)Yp=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Yp=!1,Ldt(t,e,n);Yp=!!(t.flags&131072)}else Yp=!1,Nc&&e.flags&1048576&&tLe(e,k_,e.index);switch(e.lanes=0,e.tag){case 2:var o=e.type;TV(t,e),t=e.pendingProps;var r=KC(e,yh.current);bC(e,n),r=Zpe(null,e,o,t,r,n);var i=e1e();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,qp(o)?(i=!0,E_(e)):i=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,Jpe(e),r.updater=BK,e.stateNode=r,r._reactInternals=e,vse(e,o,t,n),e=Sse(null,e,o,!0,i,n)):(e.tag=0,Nc&&i&&Bpe(e),Kh(null,e,r,n),e=e.child),e;case 16:o=e.elementType;e:{switch(TV(t,e),t=e.pendingProps,r=o._init,o=r(o._payload),e.type=o,r=e.tag=$dt(o),t=a2(o,t),r){case 0:e=bse(null,e,o,t,n);break e;case 1:e=zAe(null,e,o,t,n);break e;case 11:e=MAe(null,e,o,t,n);break e;case 14:e=IAe(null,e,o,a2(o.type,t),n);break e}throw Error(Jo(306,o,""))}return e;case 0:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),bse(t,e,o,r,n);case 1:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),zAe(t,e,o,r,n);case 3:e:{if(kLe(e),t===null)throw Error(Jo(387));o=e.pendingProps,i=e.memoizedState,r=i.element,iLe(t,e),N_(e,o,null,n);var a=e.memoizedState;if(o=a.element,i.isDehydrated)if(i={element:o,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){r=ZC(Error(Jo(423)),e),e=DAe(t,e,o,n,r);break e}else if(o!==r){r=ZC(Error(Jo(424)),e),e=DAe(t,e,o,n,r);break e}else for(hg=L8(e.stateNode.containerInfo.firstChild),xg=e,Nc=!0,g2=null,n=cLe(e,null,o,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qC(),o===r){e=K6(t,e,n);break e}Kh(t,e,o,n)}e=e.child}return e;case 5:return uLe(e),t===null&&yse(e),o=e.type,r=e.pendingProps,i=t!==null?t.memoizedProps:null,a=r.children,fse(o,r)?a=null:i!==null&&fse(o,i)&&(e.flags|=32),FLe(t,e),Kh(t,e,a,n),e.child;case 6:return t===null&&yse(e),null;case 13:return LLe(t,e,n);case 4:return Kpe(e,e.stateNode.containerInfo),o=e.pendingProps,t===null?e.child=$C(e,null,o,n):Kh(t,e,o,n),e.child;case 11:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),MAe(t,e,o,r,n);case 7:return Kh(t,e,e.pendingProps,n),e.child;case 8:return Kh(t,e,e.pendingProps.children,n),e.child;case 12:return Kh(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(o=e.type._context,r=e.pendingProps,i=e.memoizedProps,a=r.value,Js(L_,o._currentValue),o._currentValue=a,i!==null)if(Y2(i.value,a)){if(i.children===r.children&&!Kp.current){e=K6(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var s=l.firstContext;s!==null;){if(s.context===o){if(i.tag===1){s=F6(-1,n&-n),s.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?s.next=s:(s.next=u.next,u.next=s),c.pending=s}}i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Ase(i.return,n,e),l.lanes|=n;break}s=s.next}}else if(i.tag===10)a=i.type===e.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Jo(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Ase(a,n,e),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===e){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}Kh(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,o=e.pendingProps.children,bC(e,n),r=Jm(r),o=o(r),e.flags|=1,Kh(t,e,o,n),e.child;case 14:return o=e.type,r=a2(o,e.pendingProps),r=a2(o.type,r),IAe(t,e,o,r,n);case 15:return DLe(t,e,e.type,e.pendingProps,n);case 17:return o=e.type,r=e.pendingProps,r=e.elementType===o?r:a2(o,r),TV(t,e),e.tag=1,qp(o)?(t=!0,E_(e)):t=!1,bC(e,n),lLe(e,o,r),vse(e,o,r,n),Sse(null,e,o,!0,t,n);case 19:return WLe(t,e,n);case 22:return ELe(t,e,n)}throw Error(Jo(156,e.tag))};function ZLe(t,e){return Pke(t,e)}function qdt(t,e,n,o){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lm(t,e,n,o){return new qdt(t,e,n,o)}function u1e(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $dt(t){if(typeof t=="function")return u1e(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Mpe)return 11;if(t===Ipe)return 14}return 2}function j8(t,e){var n=t.alternate;return n===null?(n=Lm(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function RV(t,e,n,o,r,i){var a=2;if(o=t,typeof t=="function")u1e(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case WP:return cx(n.children,r,i,e);case Hpe:a=8,r|=8;break;case Vle:return t=Lm(12,n,e,r|2),t.elementType=Vle,t.lanes=i,t;case _le:return t=Lm(13,n,e,r),t.elementType=_le,t.lanes=i,t;case Gle:return t=Lm(19,n,e,r),t.elementType=Gle,t.lanes=i,t;case ske:return _K(n,r,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ake:a=10;break e;case lke:a=9;break e;case Mpe:a=11;break e;case Ipe:a=14;break e;case _4:a=16,o=null;break e}throw Error(Jo(130,t==null?t:typeof t,""))}return e=Lm(a,n,e,r),e.elementType=t,e.type=o,e.lanes=i,e}function cx(t,e,n,o){return t=Lm(7,t,o,e),t.lanes=n,t}function _K(t,e,n,o){return t=Lm(22,t,o,e),t.elementType=ske,t.lanes=n,t.stateNode={isHidden:!1},t}function hoe(t,e,n){return t=Lm(6,t,null,e),t.lanes=n,t}function poe(t,e,n){return e=Lm(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Qdt(t,e,n,o,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jne(0),this.expirationTimes=Jne(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jne(0),this.identifierPrefix=o,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function d1e(t,e,n,o,r,i,a,l,s){return t=new Qdt(t,e,n,l,s),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Lm(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:o,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Jpe(i),t}function Zdt(t,e,n){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(oWe)}catch(t){console.error(t)}}oWe(),tke.exports=kg;var Hd=tke.exports;const X_=Wi(Hd),rft=OFe({__proto__:null,default:X_},[Hd]);var rWe,VAe=Hd;rWe=VAe.createRoot,VAe.hydrateRoot;var iWe={exports:{}},aWe={},lWe={exports:{}},sWe={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -53,21 +53,21 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var qK=m,gft=pft;function mft(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var yft=typeof Object.is=="function"?Object.is:mft,Aft=gft.useSyncExternalStore,wft=qK.useRef,vft=qK.useEffect,xft=qK.useMemo,bft=qK.useDebugValue;aWe.useSyncExternalStoreWithSelector=function(t,e,n,o,r){var i=wft(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=xft(function(){function s(p){if(!c){if(c=!0,u=p,p=o(p),r!==void 0&&a.hasValue){var g=a.value;if(r(g,p))return d=g}return d=p}if(g=d,yft(u,p))return g;var A=o(p);return r!==void 0&&r(g,A)?g:(u=p,d=A)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return s(e())},f===null?void 0:function(){return s(f())}]},[e,n,o,r]);var l=Aft(t,i[0],i[1]);return vft(function(){a.hasValue=!0,a.value=l},[l]),bft(l),l};iWe.exports=aWe;var Sft=iWe.exports;const Tft=Wi(Sft);var Pft={VITE_MAPS_API_KEY:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",VITE_FIREBASE_API_KEY:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",VITE_FIREBASE_AUTH_DOMAIN:"aladdin-316017.firebaseapp.com",VITE_FIREBASE_DATABASE_URL:"https://aladdin-316017.firebaseio.com",VITE_FIREBASE_PROJECT_ID:"aladdin-316017",VITE_FIREBASE_STORAGE_BUCKET:"aladdin-316017.appspot.com",VITE_FIREBASE_MESSAGING_SENDER_ID:"169516488625",VITE_FIREBASE_APP_ID:"1:169516488625:web:bb0ae3c3f7c6e813250f90",VITE_FIREBASE_MEASUREMENT_ID:"G-G0XPQ7JNYJ",VITE_FIREBASE_LOGGER_DATABASE_URL:"https://aladdin-2024.firebaseio.com",VITE_EXAMPLE_PROJECT_OWNER:"QWecNcxhyvP6j6sBN11hBsfZDau1",BASE_URL:"/aladdin",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const _Ae=t=>{let e;const n=new Set,o=(s,c)=>{const u=typeof s=="function"?s(e):s;if(!Object.is(u,e)){const d=e;e=c??typeof u!="object"?u:Object.assign({},e,u),n.forEach(f=>f(e,d))}},r=()=>e,l={setState:o,getState:r,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>{(Pft?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(o,r,l),l},Cft=t=>t?_Ae(t):_Ae,{useDebugValue:Rft}=be,{useSyncExternalStoreWithSelector:Hft}=Tft;function Mft(t,e=t.getState,n){const o=Hft(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return Rft(o),o}const Ift=(t,e)=>{const n=Cft(t),o=(r,i=e)=>Mft(n,r,i);return Object.assign(o,n),o},$K=(t,e)=>Ift;var dB,zft=new Uint8Array(16);function cWe(){if(!dB&&(dB=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!dB))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return dB(zft)}const Dft=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function QK(t){return typeof t=="string"&&Dft.test(t)}var ef=[];for(var moe=0;moe<256;++moe)ef.push((moe+256).toString(16).substr(1));function ZK(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ef[t[e+0]]+ef[t[e+1]]+ef[t[e+2]]+ef[t[e+3]]+"-"+ef[t[e+4]]+ef[t[e+5]]+"-"+ef[t[e+6]]+ef[t[e+7]]+"-"+ef[t[e+8]]+ef[t[e+9]]+"-"+ef[t[e+10]]+ef[t[e+11]]+ef[t[e+12]]+ef[t[e+13]]+ef[t[e+14]]+ef[t[e+15]]).toLowerCase();if(!QK(n))throw TypeError("Stringified UUID is invalid");return n}var GAe,yoe,Aoe=0,woe=0;function Eft(t,e,n){var o=e&&n||0,r=e||new Array(16);t=t||{};var i=t.node||GAe,a=t.clockseq!==void 0?t.clockseq:yoe;if(i==null||a==null){var l=t.random||(t.rng||cWe)();i==null&&(i=GAe=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),a==null&&(a=yoe=(l[6]<<8|l[7])&16383)}var s=t.msecs!==void 0?t.msecs:Date.now(),c=t.nsecs!==void 0?t.nsecs:woe+1,u=s-Aoe+(c-woe)/1e4;if(u<0&&t.clockseq===void 0&&(a=a+1&16383),(u<0||s>Aoe)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Aoe=s,woe=c,yoe=a,s+=122192928e5;var d=((s&268435455)*1e4+c)%4294967296;r[o++]=d>>>24&255,r[o++]=d>>>16&255,r[o++]=d>>>8&255,r[o++]=d&255;var f=s/4294967296*1e4&268435455;r[o++]=f>>>8&255,r[o++]=f&255,r[o++]=f>>>24&15|16,r[o++]=f>>>16&255,r[o++]=a>>>8|128,r[o++]=a&255;for(var p=0;p<6;++p)r[o+p]=i[p];return e||ZK(r)}function uWe(t){if(!QK(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function Fft(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>r%32&255,a=parseInt(o.charAt(i>>>4&15)+o.charAt(i&15),16);e.push(a)}return e}function fWe(t){return(t+64>>>9<<4)+14+1}function Uft(t,e){t[e>>5]|=128<>5]|=(t[o/8]&255)<>16)+(e>>16)+(n>>16);return o<<16|n&65535}function Bft(t,e){return t<>>32-e}function eq(t,e,n,o,r,i){return p8(Bft(p8(p8(e,t),p8(o,i)),r),n)}function jf(t,e,n,o,r,i,a){return eq(e&n|~e&o,t,e,r,i,a)}function Bf(t,e,n,o,r,i,a){return eq(e&o|n&~o,t,e,r,i,a)}function Yf(t,e,n,o,r,i,a){return eq(e^n^o,t,e,r,i,a)}function Of(t,e,n,o,r,i,a){return eq(n^(e|~o),t,e,r,i,a)}var Yft=dWe("v3",48,Wft);const Oft=Yft;function Vft(t,e,n){t=t||{};var o=t.random||(t.rng||cWe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=o[r];return e}return ZK(o)}function _ft(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:return e^n^o;case 2:return e&n^e&o^n&o;case 3:return e^n^o}}function voe(t,e){return t<>>32-e}function Gft(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var o=unescape(encodeURIComponent(t));t=[];for(var r=0;r>>0;P=C,C=S,S=voe(y,30)>>>0,y=A,A=w}n[0]=n[0]+A>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+S>>>0,n[3]=n[3]+C>>>0,n[4]=n[4]+P>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var Xft=dWe("v5",80,Gft);const Jft=Xft,Kft="00000000-0000-0000-0000-000000000000";function qft(t){if(!QK(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const $ft=Object.freeze(Object.defineProperty({__proto__:null,NIL:Kft,parse:uWe,stringify:ZK,v1:Eft,v3:Oft,v4:Vft,v5:Jft,validate:QK,version:qft},Symbol.toStringTag,{value:"Module"})),Qft=VFe($ft);function g1e(t,e){if(!t||!e||!t.length||!e.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}g1e.prototype.convert=function(t){var e,n,o,r={},i=this.srcAlphabet.length,a=this.dstAlphabet.length,l=t.length,s=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=a?(r[o++]=parseInt(n/a,10),n=n%a):o>0&&(r[o++]=0);l=o,s=this.dstAlphabet.slice(n,n+1).concat(s)}while(o!==0);return s};g1e.prototype.isValid=function(t){for(var e=0;e?@[]^_`{|}~",oht={consistentLength:!0};let Soe;const XAe=(t,e,n)=>{const o=e(t.toLowerCase().replace(/-/g,""));return!n||!n.consistentLength?o:o.padStart(n.shortIdLength,n.paddingChar)},rht=(t,e)=>{const o=e(t).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[o[1],o[2],o[3],o[4],o[5]].join("-")},iht=t=>Math.ceil(Math.log(2**128)/Math.log(t));var aht=(()=>{const t=(e,n)=>{const o=e||boe,r={...oht,...n};if([...new Set(Array.from(o))].length!==o.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const i=iht(o.length),a={shortIdLength:i,consistentLength:r.consistentLength,paddingChar:o[0]},l=fB(fB.HEX,o),s=fB(o,fB.HEX),c=()=>XAe(xoe(),l,a),u={new:c,generate:c,uuid:xoe,fromUUID:d=>XAe(d,l,a),toUUID:d=>rht(d,s),alphabet:o,maxLength:i};return Object.freeze(u),u};return t.constants={flickrBase58:boe,cookieBase90:nht},t.uuid=xoe,t.generate=()=>(Soe||(Soe=t(boe).generate),Soe()),t})();const Gi=Wi(aht);var hWe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){var n=1e3,o=6e4,r=36e5,i="millisecond",a="second",l="minute",s="hour",c="day",u="week",d="month",f="quarter",p="year",g="date",A="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(U){var W=["th","st","nd","rd"],k=U%100;return"["+U+(W[(k-20)%10]||W[k]||W[0])+"]"}},P=function(U,W,k){var D=String(U);return!D||D.length>=W?U:""+Array(W+1-D.length).join(k)+U},v={s:P,z:function(U){var W=-U.utcOffset(),k=Math.abs(W),D=Math.floor(k/60),L=k%60;return(W<=0?"+":"-")+P(D,2,"0")+":"+P(L,2,"0")},m:function U(W,k){if(W.date()1)return U(B[0])}else{var O=W.name;w[O]=W,L=O}return!D&&L&&(T=L),L||!D&&T},H=function(U,W){if(b(U))return U.clone();var k=typeof W=="object"?W:{};return k.date=U,k.args=arguments,new E(k)},F=v;F.l=R,F.i=b,F.w=function(U,W){return H(U,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var E=function(){function U(k){this.$L=R(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[x]=!0}var W=U.prototype;return W.parse=function(k){this.$d=function(D){var L=D.date,j=D.utc;if(L===null)return new Date(NaN);if(F.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var B=L.match(y);if(B){var O=B[2]-1||0,V=(B[7]||"0").substring(0,3);return j?new Date(Date.UTC(B[1],O,B[3]||1,B[4]||0,B[5]||0,B[6]||0,V)):new Date(B[1],O,B[3]||1,B[4]||0,B[5]||0,B[6]||0,V)}}return new Date(L)}(k),this.init()},W.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},W.$utils=function(){return F},W.isValid=function(){return this.$d.toString()!==A},W.isSame=function(k,D){var L=H(k);return this.startOf(D)<=L&&L<=this.endOf(D)},W.isAfter=function(k,D){return H(k){let e;const n=new Set,o=(s,c)=>{const u=typeof s=="function"?s(e):s;if(!Object.is(u,e)){const d=e;e=c??typeof u!="object"?u:Object.assign({},e,u),n.forEach(f=>f(e,d))}},r=()=>e,l={setState:o,getState:r,subscribe:s=>(n.add(s),()=>n.delete(s)),destroy:()=>{(Pft?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(o,r,l),l},Cft=t=>t?_Ae(t):_Ae,{useDebugValue:Rft}=be,{useSyncExternalStoreWithSelector:Hft}=Tft;function Mft(t,e=t.getState,n){const o=Hft(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return Rft(o),o}const Ift=(t,e)=>{const n=Cft(t),o=(r,i=e)=>Mft(n,r,i);return Object.assign(o,n),o},$K=(t,e)=>Ift;var dB,zft=new Uint8Array(16);function cWe(){if(!dB&&(dB=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!dB))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return dB(zft)}const Dft=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function QK(t){return typeof t=="string"&&Dft.test(t)}var ef=[];for(var moe=0;moe<256;++moe)ef.push((moe+256).toString(16).substr(1));function ZK(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ef[t[e+0]]+ef[t[e+1]]+ef[t[e+2]]+ef[t[e+3]]+"-"+ef[t[e+4]]+ef[t[e+5]]+"-"+ef[t[e+6]]+ef[t[e+7]]+"-"+ef[t[e+8]]+ef[t[e+9]]+"-"+ef[t[e+10]]+ef[t[e+11]]+ef[t[e+12]]+ef[t[e+13]]+ef[t[e+14]]+ef[t[e+15]]).toLowerCase();if(!QK(n))throw TypeError("Stringified UUID is invalid");return n}var GAe,yoe,Aoe=0,woe=0;function Eft(t,e,n){var o=e&&n||0,r=e||new Array(16);t=t||{};var i=t.node||GAe,a=t.clockseq!==void 0?t.clockseq:yoe;if(i==null||a==null){var l=t.random||(t.rng||cWe)();i==null&&(i=GAe=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),a==null&&(a=yoe=(l[6]<<8|l[7])&16383)}var s=t.msecs!==void 0?t.msecs:Date.now(),c=t.nsecs!==void 0?t.nsecs:woe+1,u=s-Aoe+(c-woe)/1e4;if(u<0&&t.clockseq===void 0&&(a=a+1&16383),(u<0||s>Aoe)&&t.nsecs===void 0&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Aoe=s,woe=c,yoe=a,s+=122192928e5;var d=((s&268435455)*1e4+c)%4294967296;r[o++]=d>>>24&255,r[o++]=d>>>16&255,r[o++]=d>>>8&255,r[o++]=d&255;var f=s/4294967296*1e4&268435455;r[o++]=f>>>8&255,r[o++]=f&255,r[o++]=f>>>24&15|16,r[o++]=f>>>16&255,r[o++]=a>>>8|128,r[o++]=a&255;for(var p=0;p<6;++p)r[o+p]=i[p];return e||ZK(r)}function uWe(t){if(!QK(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function Fft(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>r%32&255,a=parseInt(o.charAt(i>>>4&15)+o.charAt(i&15),16);e.push(a)}return e}function fWe(t){return(t+64>>>9<<4)+14+1}function Uft(t,e){t[e>>5]|=128<>5]|=(t[o/8]&255)<>16)+(e>>16)+(n>>16);return o<<16|n&65535}function Bft(t,e){return t<>>32-e}function eq(t,e,n,o,r,i){return p8(Bft(p8(p8(e,t),p8(o,i)),r),n)}function Bf(t,e,n,o,r,i,a){return eq(e&n|~e&o,t,e,r,i,a)}function Yf(t,e,n,o,r,i,a){return eq(e&o|n&~o,t,e,r,i,a)}function Of(t,e,n,o,r,i,a){return eq(e^n^o,t,e,r,i,a)}function Vf(t,e,n,o,r,i,a){return eq(n^(e|~o),t,e,r,i,a)}var Yft=dWe("v3",48,Wft);const Oft=Yft;function Vft(t,e,n){t=t||{};var o=t.random||(t.rng||cWe)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=o[r];return e}return ZK(o)}function _ft(t,e,n,o){switch(t){case 0:return e&n^~e&o;case 1:return e^n^o;case 2:return e&n^e&o^n&o;case 3:return e^n^o}}function voe(t,e){return t<>>32-e}function Gft(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var o=unescape(encodeURIComponent(t));t=[];for(var r=0;r>>0;P=C,C=S,S=voe(y,30)>>>0,y=A,A=w}n[0]=n[0]+A>>>0,n[1]=n[1]+y>>>0,n[2]=n[2]+S>>>0,n[3]=n[3]+C>>>0,n[4]=n[4]+P>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var Xft=dWe("v5",80,Gft);const Jft=Xft,Kft="00000000-0000-0000-0000-000000000000";function qft(t){if(!QK(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const $ft=Object.freeze(Object.defineProperty({__proto__:null,NIL:Kft,parse:uWe,stringify:ZK,v1:Eft,v3:Oft,v4:Vft,v5:Jft,validate:QK,version:qft},Symbol.toStringTag,{value:"Module"})),Qft=VFe($ft);function g1e(t,e){if(!t||!e||!t.length||!e.length)throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}g1e.prototype.convert=function(t){var e,n,o,r={},i=this.srcAlphabet.length,a=this.dstAlphabet.length,l=t.length,s=typeof t=="string"?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=a?(r[o++]=parseInt(n/a,10),n=n%a):o>0&&(r[o++]=0);l=o,s=this.dstAlphabet.slice(n,n+1).concat(s)}while(o!==0);return s};g1e.prototype.isValid=function(t){for(var e=0;e?@[]^_`{|}~",oht={consistentLength:!0};let Soe;const XAe=(t,e,n)=>{const o=e(t.toLowerCase().replace(/-/g,""));return!n||!n.consistentLength?o:o.padStart(n.shortIdLength,n.paddingChar)},rht=(t,e)=>{const o=e(t).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[o[1],o[2],o[3],o[4],o[5]].join("-")},iht=t=>Math.ceil(Math.log(2**128)/Math.log(t));var aht=(()=>{const t=(e,n)=>{const o=e||boe,r={...oht,...n};if([...new Set(Array.from(o))].length!==o.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");const i=iht(o.length),a={shortIdLength:i,consistentLength:r.consistentLength,paddingChar:o[0]},l=fB(fB.HEX,o),s=fB(o,fB.HEX),c=()=>XAe(xoe(),l,a),u={new:c,generate:c,uuid:xoe,fromUUID:d=>XAe(d,l,a),toUUID:d=>rht(d,s),alphabet:o,maxLength:i};return Object.freeze(u),u};return t.constants={flickrBase58:boe,cookieBase90:nht},t.uuid=xoe,t.generate=()=>(Soe||(Soe=t(boe).generate),Soe()),t})();const Gi=Wi(aht);var hWe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){var n=1e3,o=6e4,r=36e5,i="millisecond",a="second",l="minute",s="hour",c="day",u="week",d="month",f="quarter",p="year",g="date",A="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(U){var W=["th","st","nd","rd"],k=U%100;return"["+U+(W[(k-20)%10]||W[k]||W[0])+"]"}},P=function(U,W,k){var D=String(U);return!D||D.length>=W?U:""+Array(W+1-D.length).join(k)+U},v={s:P,z:function(U){var W=-U.utcOffset(),k=Math.abs(W),D=Math.floor(k/60),L=k%60;return(W<=0?"+":"-")+P(D,2,"0")+":"+P(L,2,"0")},m:function U(W,k){if(W.date()1)return U(B[0])}else{var O=W.name;w[O]=W,L=O}return!D&&L&&(T=L),L||!D&&T},H=function(U,W){if(b(U))return U.clone();var k=typeof W=="object"?W:{};return k.date=U,k.args=arguments,new E(k)},F=v;F.l=R,F.i=b,F.w=function(U,W){return H(U,{locale:W.$L,utc:W.$u,x:W.$x,$offset:W.$offset})};var E=function(){function U(k){this.$L=R(k.locale,null,!0),this.parse(k),this.$x=this.$x||k.x||{},this[x]=!0}var W=U.prototype;return W.parse=function(k){this.$d=function(D){var L=D.date,j=D.utc;if(L===null)return new Date(NaN);if(F.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var B=L.match(y);if(B){var O=B[2]-1||0,V=(B[7]||"0").substring(0,3);return j?new Date(Date.UTC(B[1],O,B[3]||1,B[4]||0,B[5]||0,B[6]||0,V)):new Date(B[1],O,B[3]||1,B[4]||0,B[5]||0,B[6]||0,V)}}return new Date(L)}(k),this.init()},W.init=function(){var k=this.$d;this.$y=k.getFullYear(),this.$M=k.getMonth(),this.$D=k.getDate(),this.$W=k.getDay(),this.$H=k.getHours(),this.$m=k.getMinutes(),this.$s=k.getSeconds(),this.$ms=k.getMilliseconds()},W.$utils=function(){return F},W.isValid=function(){return this.$d.toString()!==A},W.isSame=function(k,D){var L=H(k);return this.startOf(D)<=L&&L<=this.endOf(D)},W.isAfter=function(k,D){return H(k)=this._config.preview;if(i)o.postMessage({results:N,workerId:s.WORKER_ID,finished:W});else if(x(this._config.chunk)&&!H){if(this._config.chunk(N,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);N=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(N.data),this._completeResults.errors=this._completeResults.errors.concat(N.errors),this._completeResults.meta=N.meta),this._completed||!W||!x(this._config.complete)||N&&N.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),W||N&&N.meta.paused||this._nextChunk(),N}this._halted=!0},this._sendError=function(R){x(this._config.error)?this._config.error(R):i&&this._config.error&&o.postMessage({workerId:s.WORKER_ID,error:R,finished:!1})}}function d(b){var R;(b=b||{}).chunkSize||(b.chunkSize=s.RemoteChunkSize),u.call(this,b),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(H){this._input=H,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(R=new XMLHttpRequest,this._config.withCredentials&&(R.withCredentials=this._config.withCredentials),r||(R.onload=w(this._chunkLoaded,this),R.onerror=w(this._chunkError,this)),R.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var H=this._config.downloadRequestHeaders;for(var F in H)R.setRequestHeader(F,H[F])}if(this._config.chunkSize){var E=this._start+this._config.chunkSize-1;R.setRequestHeader("Range","bytes="+this._start+"-"+E)}try{R.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}r&&R.status===0&&this._chunkError()}},this._chunkLoaded=function(){R.readyState===4&&(R.status<200||400<=R.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:R.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(H){var F=H.getResponseHeader("Content-Range");return F===null?-1:parseInt(F.substring(F.lastIndexOf("/")+1))}(R),this.parseChunk(R.responseText)))},this._chunkError=function(H){var F=R.statusText||H;this._sendError(new Error(F))}}function f(b){var R,H;(b=b||{}).chunkSize||(b.chunkSize=s.LocalChunkSize),u.call(this,b);var F=typeof FileReader<"u";this.stream=function(E){this._input=E,H=E.slice||E.webkitSlice||E.mozSlice,F?((R=new FileReader).onload=w(this._chunkLoaded,this),R.onerror=w(this._chunkError,this)):R=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(E.target.result)},this._chunkError=function(){this._sendError(R.error)}}function p(b){var R;u.call(this,b=b||{}),this.stream=function(H){return R=H,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var H,F=this._config.chunkSize;return F?(H=R.substring(0,F),R=R.substring(F)):(H=R,R=""),this._finished=!R,this.parseChunk(H)}}}function g(b){u.call(this,b=b||{});var R=[],H=!0,F=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(E){this._input=E,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){F&&R.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),R.length?this.parseChunk(R.shift()):H=!0},this._streamData=w(function(E){try{R.push(typeof E=="string"?E:E.toString(this._config.encoding)),H&&(H=!1,this._checkIsFinished(),this.parseChunk(R.shift()))}catch(N){this._streamError(N)}},this),this._streamError=w(function(E){this._streamCleanUp(),this._sendError(E)},this),this._streamEnd=w(function(){this._streamCleanUp(),F=!0,this._streamData("")},this),this._streamCleanUp=w(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function A(b){var R,H,F,E=Math.pow(2,53),N=-E,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,k=this,D=0,L=0,j=!1,B=!1,O=[],V={data:[],errors:[],meta:{}};if(x(b.step)){var G=b.step;b.step=function(Z){if(V=Z,ie())$();else{if($(),V.data.length===0)return;D+=Z.data.length,b.preview&&D>b.preview?H.abort():(V.data=V.data[0],G(V,k))}}}function q(Z){return b.skipEmptyLines==="greedy"?Z.join("").trim()==="":Z.length===1&&Z[0].length===0}function $(){return V&&F&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),F=!1),b.skipEmptyLines&&(V.data=V.data.filter(function(Z){return!q(Z)})),ie()&&function(){if(!V)return;function Z(te,oe){x(b.transformHeader)&&(te=b.transformHeader(te,oe)),O.push(te)}if(Array.isArray(V.data[0])){for(var ee=0;ie()&&ee=O.length?"__parsed_extra":O[de]),b.transform&&(me=b.transform(me,pe)),me=Q(pe,me),pe==="__parsed_extra"?(he[pe]=he[pe]||[],he[pe].push(me)):he[pe]=me}return b.header&&(de>O.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+O.length+" fields but parsed "+de,L+oe):de=this._config.preview;if(i)o.postMessage({results:N,workerId:s.WORKER_ID,finished:W});else if(x(this._config.chunk)&&!H){if(this._config.chunk(N,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);N=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(N.data),this._completeResults.errors=this._completeResults.errors.concat(N.errors),this._completeResults.meta=N.meta),this._completed||!W||!x(this._config.complete)||N&&N.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),W||N&&N.meta.paused||this._nextChunk(),N}this._halted=!0},this._sendError=function(R){x(this._config.error)?this._config.error(R):i&&this._config.error&&o.postMessage({workerId:s.WORKER_ID,error:R,finished:!1})}}function d(b){var R;(b=b||{}).chunkSize||(b.chunkSize=s.RemoteChunkSize),u.call(this,b),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(H){this._input=H,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(R=new XMLHttpRequest,this._config.withCredentials&&(R.withCredentials=this._config.withCredentials),r||(R.onload=w(this._chunkLoaded,this),R.onerror=w(this._chunkError,this)),R.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var H=this._config.downloadRequestHeaders;for(var F in H)R.setRequestHeader(F,H[F])}if(this._config.chunkSize){var E=this._start+this._config.chunkSize-1;R.setRequestHeader("Range","bytes="+this._start+"-"+E)}try{R.send(this._config.downloadRequestBody)}catch(N){this._chunkError(N.message)}r&&R.status===0&&this._chunkError()}},this._chunkLoaded=function(){R.readyState===4&&(R.status<200||400<=R.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:R.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(H){var F=H.getResponseHeader("Content-Range");return F===null?-1:parseInt(F.substring(F.lastIndexOf("/")+1))}(R),this.parseChunk(R.responseText)))},this._chunkError=function(H){var F=R.statusText||H;this._sendError(new Error(F))}}function f(b){var R,H;(b=b||{}).chunkSize||(b.chunkSize=s.LocalChunkSize),u.call(this,b);var F=typeof FileReader<"u";this.stream=function(E){this._input=E,H=E.slice||E.webkitSlice||E.mozSlice,F?((R=new FileReader).onload=w(this._chunkLoaded,this),R.onerror=w(this._chunkError,this)):R=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(E.target.result)},this._chunkError=function(){this._sendError(R.error)}}function p(b){var R;u.call(this,b=b||{}),this.stream=function(H){return R=H,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var H,F=this._config.chunkSize;return F?(H=R.substring(0,F),R=R.substring(F)):(H=R,R=""),this._finished=!R,this.parseChunk(H)}}}function g(b){u.call(this,b=b||{});var R=[],H=!0,F=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(E){this._input=E,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){F&&R.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),R.length?this.parseChunk(R.shift()):H=!0},this._streamData=w(function(E){try{R.push(typeof E=="string"?E:E.toString(this._config.encoding)),H&&(H=!1,this._checkIsFinished(),this.parseChunk(R.shift()))}catch(N){this._streamError(N)}},this),this._streamError=w(function(E){this._streamCleanUp(),this._sendError(E)},this),this._streamEnd=w(function(){this._streamCleanUp(),F=!0,this._streamData("")},this),this._streamCleanUp=w(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function A(b){var R,H,F,E=Math.pow(2,53),N=-E,U=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,W=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,k=this,D=0,L=0,j=!1,B=!1,O=[],V={data:[],errors:[],meta:{}};if(x(b.step)){var G=b.step;b.step=function(oe){if(V=oe,ie())$();else{if($(),V.data.length===0)return;D+=oe.data.length,b.preview&&D>b.preview?H.abort():(V.data=V.data[0],G(V,k))}}}function q(oe){return b.skipEmptyLines==="greedy"?oe.join("").trim()==="":oe.length===1&&oe[0].length===0}function $(){return V&&F&&(se("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),F=!1),b.skipEmptyLines&&(V.data=V.data.filter(function(oe){return!q(oe)})),ie()&&function(){if(!V)return;function oe(te,ee){x(b.transformHeader)&&(te=b.transformHeader(te,ee)),O.push(te)}if(Array.isArray(V.data[0])){for(var Z=0;ie()&&Z=O.length?"__parsed_extra":O[de]),b.transform&&(ye=b.transform(ye,pe)),ye=Q(pe,ye),pe==="__parsed_extra"?(fe[pe]=fe[pe]||[],fe[pe].push(ye)):fe[pe]=ye}return b.header&&(de>O.length?se("FieldMismatch","TooManyFields","Too many fields: expected "+O.length+" fields but parsed "+de,L+ee):de=Te.length/2?`\r -`:"\r"}(Z,oe)),F=!1,b.delimiter)x(b.delimiter)&&(b.delimiter=b.delimiter(Z),V.meta.delimiter=b.delimiter);else{var de=function(pe,me,le,Te,ge){var Se,Re,De,Ae;ge=ge||[","," ","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var ue=0;ue=U)return Ne(!0)}else for(fe=D,D++;;){if((fe=j.indexOf(R,fe+1))===-1)return O||se.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Q.length,index:D}),Me();if(fe===V-1)return Me(j.substring(D,fe).replace(ue,R));if(R!==k||j[fe+1]!==k){if(R===k||fe===0||j[fe-1]!==k){De!==-1&&De=U)return Ne(!0);break}se.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Q.length,index:D}),fe++}}else fe++}return Me();function Pe(Ue){Q.push(Ue),ee=D}function Ie(Ue){var nt=0;if(Ue!==-1){var We=j.substring(fe+1,Ue);We&&We.trim()===""&&(nt=We.length)}return nt}function Me(Ue){return O||(Ue===void 0&&(Ue=j.substring(D)),Z.push(Ue),D=V,Pe(Z),ie&&Je()),Ne()}function ze(Ue){D=Ue,Pe(Z),Z=[],Ae=j.indexOf(F,D)}function Ne(Ue){return{data:Q,errors:se,meta:{delimiter:H,linebreak:F,aborted:L,truncated:!!Ue,cursor:ee+(B||0)}}}function Je(){N(Ne()),Q=[],se=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return D}}function C(b){var R=b.data,H=a[R.workerId],F=!1;if(R.error)H.userError(R.error,R.file);else if(R.results&&R.results.data){var E={abort:function(){F=!0,P(R.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(x(H.userStep)){for(var N=0;N1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||cht,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),o=0;o{this.observers[o]||(this.observers[o]=new Map);const r=this.observers[o].get(n)||0;this.observers[o].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r{let[l,s]=a;for(let c=0;c{let[l,s]=a;for(let c=0;c{t=o,e=r});return n.resolve=t,n.reject=e,n}function JAe(t){return t==null?"":""+t}function dht(t,e,n){t.forEach(o=>{e[o]&&(n[o]=e[o])})}const fht=/###/g;function hE(t,e,n){function o(l){return l&&l.indexOf("###")>-1?l.replace(fht,"."):l}function r(){return!t||typeof t=="string"}const i=typeof e!="string"?e:e.split(".");let a=0;for(;a":">",'"':""","'":"'","/":"/"};function mht(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>ght[e]):t}class yht{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}const Aht=[" ",",","?","!",";"],wht=new yht(20);function vht(t,e,n){e=e||"",n=n||"";const o=Aht.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(o.length===0)return!0;const r=wht.getRegExp(`(${o.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!r.test(t);if(!i){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(i=!0)}return i}function Lse(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const o=e.split(n);let r=t;for(let i=0;i-1&&s0?t.replace("_","-"):t}class qAe extends tq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],o&&(Array.isArray(o)?l.push(...o):typeof o=="string"&&i?l.push(...o.split(i)):l.push(o)));const s=J_(this.data,l);return!s&&!n&&!o&&e.indexOf(".")>-1&&(e=l[0],n=l[1],o=l.slice(2).join(".")),s||!a||typeof o!="string"?s:Lse(this.data&&this.data[e]&&this.data[e][n],o,i)}addResource(e,n,o,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[e,n];o&&(l=l.concat(a?o.split(a):o)),e.indexOf(".")>-1&&(l=e.split("."),r=n,n=l[1]),this.addNamespaces(n),KAe(this.data,l,r),i.silent||this.emit("added",e,n,o,r)}addResources(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in o)(typeof o[i]=="string"||Object.prototype.toString.apply(o[i])==="[object Array]")&&this.addResource(e,n,i,o[i],{silent:!0});r.silent||this.emit("added",e,n,o)}addResourceBundle(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),r=o,o=n,n=l[1]),this.addNamespaces(n);let s=J_(this.data,l)||{};a.skipCopy||(o=JSON.parse(JSON.stringify(o))),r?gWe(s,o,i):s={...s,...o},KAe(this.data,l,s),a.silent||this.emit("added",e,n,o)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var mWe={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,o,r){return t.forEach(i=>{this.processors[i]&&(e=this.processors[i].process(e,n,o,r))}),e}};const $Ae={};class q_ extends tq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),dht(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=p9.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const o=this.resolve(e,n);return o&&o.res!==void 0}extractFromKey(e,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=o&&e.indexOf(o)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!vht(e,o,r);if(a&&!l){const s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};const c=e.split(o);(o!==r||o===r&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(r)}return typeof i=="string"&&(i=[i]),{key:e,namespaces:i}}translate(e,n,o){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),s=l[l.length-1],c=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const v=n.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${v}${a}`,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:`${s}${v}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(e,n);let f=d&&d.res;const p=d&&d.usedKey||a,g=d&&d.exactUsedKey||a,A=Object.prototype.toString.apply(f),y=["[object Number]","[object Function]","[object RegExp]"],S=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject;if(C&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&y.indexOf(A)<0&&!(typeof S=="string"&&A==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const v=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=v,d.usedParams=this.getUsedParamsDetails(n),d):v}if(i){const v=A==="[object Array]",T=v?[]:{},w=v?g:p;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const b=`${w}${i}${x}`;T[x]=this.translate(b,{...n,joinArrays:!1,ns:l}),T[x]===b&&(T[x]=f[x])}f=T}}else if(C&&typeof S=="string"&&A==="[object Array]")f=f.join(S),f&&(f=this.extendTranslation(f,e,n,o));else{let v=!1,T=!1;const w=n.count!==void 0&&typeof n.count!="string",x=q_.hasDefaultValue(n),b=w?this.pluralResolver.getSuffix(c,n.count,n):"",R=n.ordinal&&w?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",H=w&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),F=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${b}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(v=!0,f=F),this.isValidLookup(f)||(T=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&T?void 0:f,U=x&&F!==f&&this.options.updateMissing;if(T||v||U){if(this.logger.log(U?"updateKey":"missingKey",c,s,a,U?F:f),i){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const k=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&k&&k[0])for(let L=0;L{const O=x&&B!==f?B:N;this.options.missingKeyHandler?this.options.missingKeyHandler(L,s,j,O,U,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,s,j,O,U,n),this.emit("missingKey",L,s,j,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?W.forEach(L=>{const j=this.pluralResolver.getSuffixes(L,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(B=>{D([L],a+B,n[`defaultValue${B}`]||F)})}):D(W,a,F))}f=this.extendTranslation(f,e,n,d,o),T&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${a}`),(T||v)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${a}`:a,v?f:void 0):f=this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,o,r,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=typeof e=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,o.lng||this.language,o),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},o,r,i,a,l;return typeof e=="string"&&(e=[e]),e.forEach(s=>{if(this.isValidLookup(o))return;const c=this.extractFromKey(s,n),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",A=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(y=>{this.isValidLookup(o)||(l=y,!$Ae[`${A[0]}-${y}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&($Ae[`${A[0]}-${y}`]=!0,this.logger.warn(`key "${r}" for languages "${A.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),A.forEach(S=>{if(this.isValidLookup(o))return;a=S;const C=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(C,u,S,y,n);else{let v;f&&(v=this.pluralResolver.getSuffix(S,n.count,n));const T=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(C.push(u+v),n.ordinal&&v.indexOf(w)===0&&C.push(u+v.replace(w,this.options.pluralSeparator)),p&&C.push(u+T)),g){const x=`${u}${this.options.contextSeparator}${n.context}`;C.push(x),f&&(C.push(x+v),n.ordinal&&v.indexOf(w)===0&&C.push(x+v.replace(w,this.options.pluralSeparator)),p&&C.push(x+T))}}let P;for(;P=C.pop();)this.isValidLookup(o)||(i=P,o=this.getResource(S,y,P,n))}))})}),{res:o,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,o,r):this.resourceStore.getResource(e,n,o,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&typeof e.replace!="string";let r=o?e.replace:e;if(o&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!o){r={...r};for(const i of n)delete r[i]}return r}static hasDefaultValue(e){const n="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&n===o.substring(0,n.length)&&e[o]!==void 0)return!0;return!1}}function Toe(t){return t.charAt(0).toUpperCase()+t.slice(1)}class QAe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=p9.create("languageUtils")}getScriptPartFromCode(e){if(e=K_(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=K_(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let o=e.split("-");return this.options.lowerCaseLng?o=o.map(r=>r.toLowerCase()):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=Toe(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=Toe(o[1].toLowerCase())),n.indexOf(o[2].toLowerCase())>-1&&(o[2]=Toe(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(o=>{if(n)return;const r=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(o=>{if(n)return;const r=this.getLanguagePartFromCode(o);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>{if(i===r)return i;if(!(i.indexOf("-")<0&&r.indexOf("-")<0)&&(i.indexOf("-")>0&&r.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===r||i.indexOf(r)===0&&r.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let o=e[n];return o||(o=e[this.getScriptPartFromCode(n)]),o||(o=e[this.formatLanguageCode(n)]),o||(o=e[this.getLanguagePartFromCode(n)]),o||(o=e.default),o||[]}toResolveHierarchy(e,n){const o=this.getFallbackCodes(n||this.options.fallbackLng||[],e),r=[],i=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):typeof e=="string"&&i(this.formatLanguageCode(e)),o.forEach(a=>{r.indexOf(a)<0&&i(this.formatLanguageCode(a))}),r}}let xht=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],bht={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const Sht=["v1","v2","v3"],Tht=["v4"],ZAe={zero:0,one:1,two:2,few:3,many:4,other:5};function Pht(){const t={};return xht.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:bht[e.fc]}})}),t}class Cht{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=p9.create("pluralResolver"),(!this.options.compatibilityJSON||Tht.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Pht()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(K_(e==="dev"?"en":e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}getPluralFormsOfKey(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,o).map(r=>`${n}${r}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort((r,i)=>ZAe[r]-ZAe[i]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):o.numbers.map(r=>this.getSuffix(e,r,n)):[]}getSuffix(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,o);return r?this.shouldUseIntlApi()?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:this.getSuffixRetroCompatible(r,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const o=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let r=e.numbers[o];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const i=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?i():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}shouldUseIntlApi(){return!Sht.includes(this.options.compatibilityJSON)}}function e4e(t,e,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=pht(t,e,n);return!i&&r&&typeof n=="string"&&(i=Lse(t,n,o),i===void 0&&(i=Lse(e,n,o))),i}class Rht{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=p9.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:mht,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?rT(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?rT(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?rT(n.nestingPrefix):n.nestingPrefixEscaped||rT("$t("),this.nestingSuffix=n.nestingSuffix?rT(n.nestingSuffix):n.nestingSuffixEscaped||rT(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,o)=>n&&n.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,o,r){let i,a,l;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(g){return g.replace(/\$/g,"$$$$")}const u=g=>{if(g.indexOf(this.formatSeparator)<0){const C=e4e(n,s,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,o,{...r,...n,interpolationkey:g}):C}const A=g.split(this.formatSeparator),y=A.shift().trim(),S=A.join(this.formatSeparator).trim();return this.format(e4e(n,s,y,this.options.keySeparator,this.options.ignoreJSONStructure),S,o,{...r,...n,interpolationkey:y})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>c(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?c(this.escape(g)):c(g)}].forEach(g=>{for(l=0;i=g.regex.exec(e);){const A=i[1].trim();if(a=u(A),a===void 0)if(typeof d=="function"){const S=d(e,i,r);a=typeof S=="string"?S:""}else if(r&&Object.prototype.hasOwnProperty.call(r,A))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${A} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=JAe(a));const y=g.safeValue(a);if(e=e.replace(i[0],y),f?(g.regex.lastIndex+=a.length,g.regex.lastIndex-=i[0].length):g.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,i,a;function l(s,c){const u=this.nestingOptionsSeparator;if(s.indexOf(u)<0)return s;const d=s.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;s=d[0],f=this.interpolate(f,a);const p=f.match(/'/g),g=f.match(/"/g);(p&&p.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),c&&(a={...c,...a})}catch(A){return this.logger.warn(`failed parsing options string in nesting for key ${s}`,A),`${s}${u}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,s}for(;r=this.nestingRegexp.exec(e);){let s=[];a={...o},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),s=u,c=!0}if(i=n(l.call(this,r[1].trim(),a),a),i&&r[0]===e&&typeof i!="string")return i;typeof i!="string"&&(i=JAe(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=""),c&&(i=s.reduce((u,d)=>this.format(u,d,o.lng,{...o,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}function Hht(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const o=t.split("(");e=o[0].toLowerCase().trim();const r=o[1].substring(0,o[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(!a)return;const[l,...s]=a.split(":"),c=s.join(":").trim().replace(/^'+|'+$/g,"");n[l.trim()]||(n[l.trim()]=c),c==="false"&&(n[l.trim()]=!1),c==="true"&&(n[l.trim()]=!0),isNaN(c)||(n[l.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:n}}function iT(t){const e={};return function(o,r,i){const a=r+JSON.stringify(i);let l=e[a];return l||(l=t(K_(r),i),e[a]=l),l(o)}}class Mht{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=p9.create("formatter"),this.options=e,this.formats={number:iT((n,o)=>{const r=new Intl.NumberFormat(n,{...o});return i=>r.format(i)}),currency:iT((n,o)=>{const r=new Intl.NumberFormat(n,{...o,style:"currency"});return i=>r.format(i)}),datetime:iT((n,o)=>{const r=new Intl.DateTimeFormat(n,{...o});return i=>r.format(i)}),relativetime:iT((n,o)=>{const r=new Intl.RelativeTimeFormat(n,{...o});return i=>r.format(i,o.range||"day")}),list:iT((n,o)=>{const r=new Intl.ListFormat(n,{...o});return i=>r.format(i)})},this.init(e)}init(e){const o=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=iT(n)}format(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((l,s)=>{const{formatName:c,formatOptions:u}=Hht(s);if(this.formats[c]){let d=l;try{const f=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},p=f.locale||f.lng||r.locale||r.lng||o;d=this.formats[c](l,p,{...u,...r,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return l},e)}}function Iht(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class zht extends tq{constructor(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=r,this.logger=p9.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(o,r.backend,r)}queueLoad(e,n,o,r){const i={},a={},l={},s={};return e.forEach(c=>{let u=!0;n.forEach(d=>{const f=`${c}|${d}`;!o.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,u=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),s[d]===void 0&&(s[d]=!0)))}),u||(l[c]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(s)}}loaded(e,n,o){const r=e.split("|"),i=r[0],a=r[1];n&&this.emit("failedLoading",i,a,n),o&&this.store.addResourceBundle(i,a,o,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2;const l={};this.queue.forEach(s=>{hht(s.loaded,[i],a),Iht(s,e),n&&s.errors.push(n),s.pendingCount===0&&!s.done&&(Object.keys(s.loaded).forEach(c=>{l[c]||(l[c]={});const u=s.loaded[c];u.length&&u.forEach(d=>{l[c][d]===void 0&&(l[c][d]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(s=>!s.done)}read(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:o,tried:r,wait:i,callback:a});return}this.readingCalls++;const l=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,n,o,r+1,i*2,a)},i);return}a(c,u)},s=this.backend[o].bind(this.backend);if(s.length===2){try{const c=s(e,n);c&&typeof c.then=="function"?c.then(u=>l(null,u)).catch(l):l(null,c)}catch(c){l(c)}return}return s(e,n,l)}prepareLoading(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(e,n,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,o){this.prepareLoading(e,n,{},o)}reload(e,n,o){this.prepareLoading(e,n,{reload:!0},o)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const o=e.split("|"),r=o[0],i=o[1];this.read(r,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${r} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${r}`,l),this.loaded(e,a,l)})}saveMissing(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){const s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,n,o,r,s):u=c(e,n,o,r),u&&typeof u.then=="function"?u.then(d=>l(null,d)).catch(l):l(null,u)}catch(u){l(u)}else c(e,n,o,r,l,s)}!e||!e[0]||this.store.addResource(e[0],n,o,r)}}}function t4e(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const o=e[3]||e[2];Object.keys(o).forEach(r=>{n[r]=o[r]})}return n},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function n4e(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function pB(){}function Dht(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class SF extends tq{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=n4e(e),this.services={},this.logger=p9,this.modules={external:[]},Dht(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(o=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const r=t4e();this.options={...r,...this.options,...n4e(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?p9.init(i(this.modules.logger),this.options):p9.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=Mht);const d=new QAe(this.options);this.store=new qAe(this.options.resources,this.options);const f=this.services;f.logger=p9,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Cht(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=i(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Rht(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new zht(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var g=arguments.length,A=new Array(g>1?g-1:0),y=1;y1?g-1:0),y=1;y{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,o||(o=pB),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const s=gz(),c=()=>{const u=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(f),o(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),s}loadResources(e){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pB;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(c=>{c!=="cimode"&&i.indexOf(c)<0&&i.push(c)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(s=>a(s)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(e,n,o){const r=gz();return e||(e=this.languages),n||(n=this.options.ns),o||(o=pB),this.services.backendConnector.reload(e,n,i=>{r.resolve(),o(i)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&mWe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}changeLanguage(e,n){var o=this;this.isLanguageChangingTo=e;const r=gz();this.emit("languageChanging",e);const i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return o.t(...arguments)}),n&&n(s,function(){return o.t(...arguments)})},l=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const c=typeof s=="string"?s:this.services.languageUtils.getBestMatchFromCodes(s);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{a(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),r}getFixedT(e,n,o){var r=this;const i=function(a,l){let s;if(typeof l!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${s.keyPrefix}${f}${g}`):p=s.keyPrefix?`${s.keyPrefix}${f}${a}`:a,r.t(p,s)};return typeof e=="string"?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=o,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=this.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(o,e)&&(!r||a(i,e)))}loadNamespaces(e,n){const o=gz();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{o.resolve(),n&&n(r)}),o):(n&&n(),Promise.resolve())}loadLanguages(e,n){const o=gz();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],i=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=r.concat(i),this.loadResources(a=>{o.resolve(),n&&n(a)}),o):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new QAe(t4e());return n.indexOf(o.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new SF(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pB;const o=e.forkResourceStore;o&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},i=new SF(r);return(e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},o&&(i.store=new qAe(this.store.data,r),i.services.resourceStore=i.store),i.translator=new q_(i.services,r),i.translator.on("*",function(l){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function r4e(t,e,n){t.loadNamespaces(e,yWe(t,n))}function i4e(t,e,n,o){typeof n=="string"&&(n=[n]),n.forEach(r=>{t.options.ns.indexOf(r)<0&&t.options.ns.push(r)}),t.loadLanguages(e,yWe(t,o))}function Fht(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=e.languages[0],r=e.options?e.options.fallbackLng:!1,i=e.languages[e.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=e.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!a(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(o,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||a(o,t)&&(!r||a(i,t)))}function kht(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Wse("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}):Fht(t,e,n)}const Lht=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Wht={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Nht=t=>Wht[t],Uht=t=>t.replace(Lht,Nht);let Nse={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Uht};function jht(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nse={...Nse,...t}}function Bht(){return Nse}let AWe;function Yht(t){AWe=t}function Oht(){return AWe}const Vht={type:"3rdParty",init(t){jht(t.options.react),Yht(t)}},_ht=m.createContext();class Ght{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Xht=(t,e)=>{const n=m.useRef();return m.useEffect(()=>{n.current=t},[t,e]),n.current};function Xl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:o,defaultNS:r}=m.useContext(_ht)||{},i=n||o||Oht();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new Ght),!i){Wse("You will need to pass in an i18next instance by using initReactI18next");const P=(T,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(T)?T[T.length-1]:T,v=[P,{},!1];return v.t=P,v.i18n={},v.ready=!1,v}i.options.react&&i.options.react.wait!==void 0&&Wse("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Bht(),...i.options.react,...e},{useSuspense:l,keyPrefix:s}=a;let c=r||i.options&&i.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(c);const u=(i.isInitialized||i.initializedStoreOnce)&&c.every(P=>kht(P,i,a));function d(){return i.getFixedT(e.lng||null,a.nsMode==="fallback"?c:c[0],s)}const[f,p]=m.useState(d);let g=c.join();e.lng&&(g=`${e.lng}${g}`);const A=Xht(g),y=m.useRef(!0);m.useEffect(()=>{const{bindI18n:P,bindI18nStore:v}=a;y.current=!0,!u&&!l&&(e.lng?i4e(i,e.lng,c,()=>{y.current&&p(d)}):r4e(i,c,()=>{y.current&&p(d)})),u&&A&&A!==g&&y.current&&p(d);function T(){y.current&&p(d)}return P&&i&&i.on(P,T),v&&i&&i.store.on(v,T),()=>{y.current=!1,P&&i&&P.split(" ").forEach(w=>i.off(w,T)),v&&i&&v.split(" ").forEach(w=>i.store.off(w,T))}},[i,g]);const S=m.useRef(!0);m.useEffect(()=>{y.current&&!S.current&&p(d),S.current=!1},[i,s]);const C=[f,i,u];if(C.t=f,C.i18n=i,C.ready=u,u||!u&&!l)return C;throw new Promise(P=>{e.lng?i4e(i,e.lng,c,()=>P()):r4e(i,c,()=>P())})}function Jht(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TF(t){"@babel/helpers - typeof";return TF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TF(t)}function Kht(t,e){if(TF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(TF(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function qht(t){var e=Kht(t,"string");return TF(e)==="symbol"?e:String(e)}function $ht(t,e){for(var n=0;n0){var l=r.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(r.domain){if(!a4e.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!a4e.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var s=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(s){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},l4e={create:function(e,n,o,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};o&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+o*60*1e3)),r&&(i.domain=r),document.cookie=npt(e,encodeURIComponent(n),i)},read:function(e){for(var n="".concat(e,"="),o=document.cookie.split(";"),r=0;r-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=o.substring(1),i=r.split("&"),a=0;a0){var s=i[a].substring(0,l);s===e.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},mz=null,s4e=function(){if(mz!==null)return mz;try{mz=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{mz=!1}return mz},ipt={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&s4e()){var o=window.localStorage.getItem(e.lookupLocalStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&s4e()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},yz=null,c4e=function(){if(yz!==null)return yz;try{yz=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{yz=!1}return yz},apt={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&c4e()){var o=window.sessionStorage.getItem(e.lookupSessionStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&c4e()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},lpt={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var o=0;o0?n:void 0}},spt={name:"htmlTag",lookup:function(e){var n,o=e.htmlTag||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(n=o.getAttribute("lang")),n}},cpt={name:"path",lookup:function(e){var n;if(typeof window<"u"){var o=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(o instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof o[e.lookupFromPathIndex]!="string")return;n=o[e.lookupFromPathIndex].replace("/","")}else n=o[0].replace("/","")}return n}},upt={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,o=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[n]}};function dpt(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var vWe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jht(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return Qht(t,[{key:"init",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=tpt(o,this.options||{},dpt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(opt),this.addDetector(rpt),this.addDetector(ipt),this.addDetector(apt),this.addDetector(lpt),this.addDetector(spt),this.addDetector(cpt),this.addDetector(upt)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var o=this;n||(n=this.options.order);var r=[];return n.forEach(function(i){if(o.detectors[i]){var a=o.detectors[i].lookup(o.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(i){return o.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(n,o){var r=this;o||(o=this.options.caches),o&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||o.forEach(function(i){r.detectors[i]&&r.detectors[i].cacheUserLanguage(n,r.options)}))}}]),t}();vWe.type="languageDetector";const fpt={translation:{name:{IFI:"Institute for Future Intelligence",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"By clicking Accept, you agree to our use of cookies to improve your experience with Aladdin.",Accept:"Accept"},aboutUs:{ProductBroughtToYouBy:"This product is brought to you by",TermsOfService:"Terms of Service",PrivacyPolicy:"Privacy Policy",Software:"Software",Content:"Content",Research:"Research",Support:"Support",Acknowledgment:"Acknowledgment",FundingInformation:"The National Science Foundation (NSF) generously provided funding for the research and development of this product through grants #2105695, #2131097, and #2301164. Any opinions, findings, and conclusions or recommendations expressed in this product, however, are those of the authors and do not necessarily reflect the views of NSF.",Contact:"For more information, please contact Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"All Rights Reserved",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Version",VersionInitial:"V",Options:"Options",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Maximum Number",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"Or",None:"None",High:"High",Partial:"Partial",Teacher:"Teacher",Class:"Class",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Range",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",BuildingHVACSystem:"Building HVAC System",ThermostatSetpoint:"Thermostat Setpoint",TemperatureToleranceThreshold:"Tolerance Threshold",TemperatureToleranceThresholdExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. +`);var D=0,L=!1;this.parse=function(j,B,O){if(typeof j!="string")throw new Error("Input must be a string");var V=j.length,G=H.length,q=F.length,$=E.length,ie=x(N),Q=[],se=[],oe=[],Z=D=0;if(!j)return Ne();if(b.header&&!B){var te=j.split(F)[0].split(H),ee=[],de={},fe=!1;for(var pe in te){var ye=te[pe];x(b.transformHeader)&&(ye=b.transformHeader(ye,pe));var ae=ye,Te=de[ye]||0;for(0=U)return Ne(!0)}else for(he=D,D++;;){if((he=j.indexOf(R,he+1))===-1)return O||se.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Q.length,index:D}),Me();if(he===V-1)return Me(j.substring(D,he).replace(ue,R));if(R!==k||j[he+1]!==k){if(R===k||he===0||j[he-1]!==k){De!==-1&&De=U)return Ne(!0);break}se.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Q.length,index:D}),he++}}else he++}return Me();function Pe(Ue){Q.push(Ue),Z=D}function Ie(Ue){var nt=0;if(Ue!==-1){var We=j.substring(he+1,Ue);We&&We.trim()===""&&(nt=We.length)}return nt}function Me(Ue){return O||(Ue===void 0&&(Ue=j.substring(D)),oe.push(Ue),D=V,Pe(oe),ie&&Je()),Ne()}function ze(Ue){D=Ue,Pe(oe),oe=[],Ae=j.indexOf(F,D)}function Ne(Ue){return{data:Q,errors:se,meta:{delimiter:H,linebreak:F,aborted:L,truncated:!!Ue,cursor:Z+(B||0)}}}function Je(){N(Ne()),Q=[],se=[]}},this.abort=function(){L=!0},this.getCharIndex=function(){return D}}function C(b){var R=b.data,H=a[R.workerId],F=!1;if(R.error)H.userError(R.error,R.file);else if(R.results&&R.results.data){var E={abort:function(){F=!0,P(R.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(x(H.userStep)){for(var N=0;N1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||cht,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),o=0;o{this.observers[o]||(this.observers[o]=new Map);const r=this.observers[o].get(n)||0;this.observers[o].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r{let[l,s]=a;for(let c=0;c{let[l,s]=a;for(let c=0;c{t=o,e=r});return n.resolve=t,n.reject=e,n}function JAe(t){return t==null?"":""+t}function dht(t,e,n){t.forEach(o=>{e[o]&&(n[o]=e[o])})}const fht=/###/g;function hE(t,e,n){function o(l){return l&&l.indexOf("###")>-1?l.replace(fht,"."):l}function r(){return!t||typeof t=="string"}const i=typeof e!="string"?e:e.split(".");let a=0;for(;a":">",'"':""","'":"'","/":"/"};function mht(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>ght[e]):t}class yht{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const o=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,o),this.regExpQueue.push(e),o}}const Aht=[" ",",","?","!",";"],wht=new yht(20);function vht(t,e,n){e=e||"",n=n||"";const o=Aht.filter(a=>e.indexOf(a)<0&&n.indexOf(a)<0);if(o.length===0)return!0;const r=wht.getRegExp(`(${o.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!r.test(t);if(!i){const a=t.indexOf(n);a>0&&!r.test(t.substring(0,a))&&(i=!0)}return i}function Lse(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const o=e.split(n);let r=t;for(let i=0;i-1&&s0?t.replace("_","-"):t}class qAe extends tq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,a=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;e.indexOf(".")>-1?l=e.split("."):(l=[e,n],o&&(Array.isArray(o)?l.push(...o):typeof o=="string"&&i?l.push(...o.split(i)):l.push(o)));const s=J_(this.data,l);return!s&&!n&&!o&&e.indexOf(".")>-1&&(e=l[0],n=l[1],o=l.slice(2).join(".")),s||!a||typeof o!="string"?s:Lse(this.data&&this.data[e]&&this.data[e][n],o,i)}addResource(e,n,o,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[e,n];o&&(l=l.concat(a?o.split(a):o)),e.indexOf(".")>-1&&(l=e.split("."),r=n,n=l[1]),this.addNamespaces(n),KAe(this.data,l,r),i.silent||this.emit("added",e,n,o,r)}addResources(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in o)(typeof o[i]=="string"||Object.prototype.toString.apply(o[i])==="[object Array]")&&this.addResource(e,n,i,o[i],{silent:!0});r.silent||this.emit("added",e,n,o)}addResourceBundle(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[e,n];e.indexOf(".")>-1&&(l=e.split("."),r=o,o=n,n=l[1]),this.addNamespaces(n);let s=J_(this.data,l)||{};a.skipCopy||(o=JSON.parse(JSON.stringify(o))),r?gWe(s,o,i):s={...s,...o},KAe(this.data,l,s),a.silent||this.emit("added",e,n,o)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var mWe={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,o,r){return t.forEach(i=>{this.processors[i]&&(e=this.processors[i].process(e,n,o,r))}),e}};const $Ae={};class q_ extends tq{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),dht(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=p9.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const o=this.resolve(e,n);return o&&o.res!==void 0}extractFromKey(e,n){let o=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=o&&e.indexOf(o)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!vht(e,o,r);if(a&&!l){const s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:i};const c=e.split(o);(o!==r||o===r&&this.options.ns.indexOf(c[0])>-1)&&(i=c.shift()),e=c.join(r)}return typeof i=="string"&&(i=[i]),{key:e,namespaces:i}}translate(e,n,o){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const r=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],n),s=l[l.length-1],c=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const v=n.nsSeparator||this.options.nsSeparator;return r?{res:`${s}${v}${a}`,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:`${s}${v}${a}`}return r?{res:a,usedKey:a,exactUsedKey:a,usedLng:c,usedNS:s,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(e,n);let f=d&&d.res;const p=d&&d.usedKey||a,g=d&&d.exactUsedKey||a,A=Object.prototype.toString.apply(f),y=["[object Number]","[object Function]","[object RegExp]"],S=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject;if(C&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&y.indexOf(A)<0&&!(typeof S=="string"&&A==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const v=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return r?(d.res=v,d.usedParams=this.getUsedParamsDetails(n),d):v}if(i){const v=A==="[object Array]",T=v?[]:{},w=v?g:p;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const b=`${w}${i}${x}`;T[x]=this.translate(b,{...n,joinArrays:!1,ns:l}),T[x]===b&&(T[x]=f[x])}f=T}}else if(C&&typeof S=="string"&&A==="[object Array]")f=f.join(S),f&&(f=this.extendTranslation(f,e,n,o));else{let v=!1,T=!1;const w=n.count!==void 0&&typeof n.count!="string",x=q_.hasDefaultValue(n),b=w?this.pluralResolver.getSuffix(c,n.count,n):"",R=n.ordinal&&w?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",H=w&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),F=H&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${b}`]||n[`defaultValue${R}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(v=!0,f=F),this.isValidLookup(f)||(T=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&T?void 0:f,U=x&&F!==f&&this.options.updateMissing;if(T||v||U){if(this.logger.log(U?"updateKey":"missingKey",c,s,a,U?F:f),i){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let W=[];const k=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&k&&k[0])for(let L=0;L{const O=x&&B!==f?B:N;this.options.missingKeyHandler?this.options.missingKeyHandler(L,s,j,O,U,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,s,j,O,U,n),this.emit("missingKey",L,s,j,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?W.forEach(L=>{const j=this.pluralResolver.getSuffixes(L,n);H&&n[`defaultValue${this.options.pluralSeparator}zero`]&&j.indexOf(`${this.options.pluralSeparator}zero`)<0&&j.push(`${this.options.pluralSeparator}zero`),j.forEach(B=>{D([L],a+B,n[`defaultValue${B}`]||F)})}):D(W,a,F))}f=this.extendTranslation(f,e,n,d,o),T&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${s}:${a}`),(T||v)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${s}:${a}`:a,v?f:void 0):f=this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,o,r,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const c=typeof e=="string"&&(o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const f=e.match(this.interpolator.nestingRegexp);u=f&&f.length}let d=o.replace&&typeof o.replace!="string"?o.replace:o;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,o.lng||this.language,o),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;u1&&arguments[1]!==void 0?arguments[1]:{},o,r,i,a,l;return typeof e=="string"&&(e=[e]),e.forEach(s=>{if(this.isValidLookup(o))return;const c=this.extractFromKey(s,n),u=c.key;r=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",p=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",A=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(y=>{this.isValidLookup(o)||(l=y,!$Ae[`${A[0]}-${y}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&($Ae[`${A[0]}-${y}`]=!0,this.logger.warn(`key "${r}" for languages "${A.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),A.forEach(S=>{if(this.isValidLookup(o))return;a=S;const C=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(C,u,S,y,n);else{let v;f&&(v=this.pluralResolver.getSuffix(S,n.count,n));const T=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(C.push(u+v),n.ordinal&&v.indexOf(w)===0&&C.push(u+v.replace(w,this.options.pluralSeparator)),p&&C.push(u+T)),g){const x=`${u}${this.options.contextSeparator}${n.context}`;C.push(x),f&&(C.push(x+v),n.ordinal&&v.indexOf(w)===0&&C.push(x+v.replace(w,this.options.pluralSeparator)),p&&C.push(x+T))}}let P;for(;P=C.pop();)this.isValidLookup(o)||(i=P,o=this.getResource(S,y,P,n))}))})}),{res:o,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,o,r):this.resourceStore.getResource(e,n,o,r)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=e.replace&&typeof e.replace!="string";let r=o?e.replace:e;if(o&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!o){r={...r};for(const i of n)delete r[i]}return r}static hasDefaultValue(e){const n="defaultValue";for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&n===o.substring(0,n.length)&&e[o]!==void 0)return!0;return!1}}function Toe(t){return t.charAt(0).toUpperCase()+t.slice(1)}class QAe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=p9.create("languageUtils")}getScriptPartFromCode(e){if(e=K_(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=K_(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let o=e.split("-");return this.options.lowerCaseLng?o=o.map(r=>r.toLowerCase()):o.length===2?(o[0]=o[0].toLowerCase(),o[1]=o[1].toUpperCase(),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=Toe(o[1].toLowerCase()))):o.length===3&&(o[0]=o[0].toLowerCase(),o[1].length===2&&(o[1]=o[1].toUpperCase()),o[0]!=="sgn"&&o[2].length===2&&(o[2]=o[2].toUpperCase()),n.indexOf(o[1].toLowerCase())>-1&&(o[1]=Toe(o[1].toLowerCase())),n.indexOf(o[2].toLowerCase())>-1&&(o[2]=Toe(o[2].toLowerCase()))),o.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(o=>{if(n)return;const r=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(o=>{if(n)return;const r=this.getLanguagePartFromCode(o);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>{if(i===r)return i;if(!(i.indexOf("-")<0&&r.indexOf("-")<0)&&(i.indexOf("-")>0&&r.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===r||i.indexOf(r)===0&&r.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let o=e[n];return o||(o=e[this.getScriptPartFromCode(n)]),o||(o=e[this.formatLanguageCode(n)]),o||(o=e[this.getLanguagePartFromCode(n)]),o||(o=e.default),o||[]}toResolveHierarchy(e,n){const o=this.getFallbackCodes(n||this.options.fallbackLng||[],e),r=[],i=a=>{a&&(this.isSupportedCode(a)?r.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(e))):typeof e=="string"&&i(this.formatLanguageCode(e)),o.forEach(a=>{r.indexOf(a)<0&&i(this.formatLanguageCode(a))}),r}}let xht=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],bht={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const Sht=["v1","v2","v3"],Tht=["v4"],ZAe={zero:0,one:1,two:2,few:3,many:4,other:5};function Pht(){const t={};return xht.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:bht[e.fc]}})}),t}class Cht{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=p9.create("pluralResolver"),(!this.options.compatibilityJSON||Tht.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Pht()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(K_(e==="dev"?"en":e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return this.shouldUseIntlApi()?o&&o.resolvedOptions().pluralCategories.length>1:o&&o.numbers.length>1}getPluralFormsOfKey(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,o).map(r=>`${n}${r}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=this.getRule(e,n);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort((r,i)=>ZAe[r]-ZAe[i]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):o.numbers.map(r=>this.getSuffix(e,r,n)):[]}getSuffix(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=this.getRule(e,o);return r?this.shouldUseIntlApi()?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:this.getSuffixRetroCompatible(r,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const o=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let r=e.numbers[o];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(r===2?r="plural":r===1&&(r=""));const i=()=>this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString();return this.options.compatibilityJSON==="v1"?r===1?"":typeof r=="number"?`_plural_${r.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?i():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}shouldUseIntlApi(){return!Sht.includes(this.options.compatibilityJSON)}}function e4e(t,e,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=pht(t,e,n);return!i&&r&&typeof n=="string"&&(i=Lse(t,n,o),i===void 0&&(i=Lse(e,n,o))),i}class Rht{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=p9.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:mht,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?rT(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?rT(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?rT(n.nestingPrefix):n.nestingPrefixEscaped||rT("$t("),this.nestingSuffix=n.nestingSuffix?rT(n.nestingSuffix):n.nestingSuffixEscaped||rT(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,o)=>n&&n.source===o?(n.lastIndex=0,n):new RegExp(o,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,o,r){let i,a,l;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(g){return g.replace(/\$/g,"$$$$")}const u=g=>{if(g.indexOf(this.formatSeparator)<0){const C=e4e(n,s,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,o,{...r,...n,interpolationkey:g}):C}const A=g.split(this.formatSeparator),y=A.shift().trim(),S=A.join(this.formatSeparator).trim();return this.format(e4e(n,s,y,this.options.keySeparator,this.options.ignoreJSONStructure),S,o,{...r,...n,interpolationkey:y})};this.resetRegExp();const d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>c(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?c(this.escape(g)):c(g)}].forEach(g=>{for(l=0;i=g.regex.exec(e);){const A=i[1].trim();if(a=u(A),a===void 0)if(typeof d=="function"){const S=d(e,i,r);a=typeof S=="string"?S:""}else if(r&&Object.prototype.hasOwnProperty.call(r,A))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${A} for interpolating ${e}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=JAe(a));const y=g.safeValue(a);if(e=e.replace(i[0],y),f?(g.regex.lastIndex+=a.length,g.regex.lastIndex-=i[0].length):g.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),e}nest(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r,i,a;function l(s,c){const u=this.nestingOptionsSeparator;if(s.indexOf(u)<0)return s;const d=s.split(new RegExp(`${u}[ ]*{`));let f=`{${d[1]}`;s=d[0],f=this.interpolate(f,a);const p=f.match(/'/g),g=f.match(/"/g);(p&&p.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),c&&(a={...c,...a})}catch(A){return this.logger.warn(`failed parsing options string in nesting for key ${s}`,A),`${s}${u}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,s}for(;r=this.nestingRegexp.exec(e);){let s=[];a={...o},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const u=r[1].split(this.formatSeparator).map(d=>d.trim());r[1]=u.shift(),s=u,c=!0}if(i=n(l.call(this,r[1].trim(),a),a),i&&r[0]===e&&typeof i!="string")return i;typeof i!="string"&&(i=JAe(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=""),c&&(i=s.reduce((u,d)=>this.format(u,d,o.lng,{...o,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}}function Hht(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const o=t.split("(");e=o[0].toLowerCase().trim();const r=o[1].substring(0,o[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(a=>{if(!a)return;const[l,...s]=a.split(":"),c=s.join(":").trim().replace(/^'+|'+$/g,"");n[l.trim()]||(n[l.trim()]=c),c==="false"&&(n[l.trim()]=!1),c==="true"&&(n[l.trim()]=!0),isNaN(c)||(n[l.trim()]=parseInt(c,10))})}return{formatName:e,formatOptions:n}}function iT(t){const e={};return function(o,r,i){const a=r+JSON.stringify(i);let l=e[a];return l||(l=t(K_(r),i),e[a]=l),l(o)}}class Mht{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=p9.create("formatter"),this.options=e,this.formats={number:iT((n,o)=>{const r=new Intl.NumberFormat(n,{...o});return i=>r.format(i)}),currency:iT((n,o)=>{const r=new Intl.NumberFormat(n,{...o,style:"currency"});return i=>r.format(i)}),datetime:iT((n,o)=>{const r=new Intl.DateTimeFormat(n,{...o});return i=>r.format(i)}),relativetime:iT((n,o)=>{const r=new Intl.RelativeTimeFormat(n,{...o});return i=>r.format(i,o.range||"day")}),list:iT((n,o)=>{const r=new Intl.ListFormat(n,{...o});return i=>r.format(i)})},this.init(e)}init(e){const o=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=o.formatSeparator?o.formatSeparator:o.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=iT(n)}format(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((l,s)=>{const{formatName:c,formatOptions:u}=Hht(s);if(this.formats[c]){let d=l;try{const f=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},p=f.locale||f.lng||r.locale||r.lng||o;d=this.formats[c](l,p,{...u,...r,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${c}`);return l},e)}}function Iht(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class zht extends tq{constructor(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=o,this.languageUtils=o.languageUtils,this.options=r,this.logger=p9.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(o,r.backend,r)}queueLoad(e,n,o,r){const i={},a={},l={},s={};return e.forEach(c=>{let u=!0;n.forEach(d=>{const f=`${c}|${d}`;!o.reload&&this.store.hasResourceBundle(c,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,u=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),s[d]===void 0&&(s[d]=!0)))}),u||(l[c]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(s)}}loaded(e,n,o){const r=e.split("|"),i=r[0],a=r[1];n&&this.emit("failedLoading",i,a,n),o&&this.store.addResourceBundle(i,a,o,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2;const l={};this.queue.forEach(s=>{hht(s.loaded,[i],a),Iht(s,e),n&&s.errors.push(n),s.pendingCount===0&&!s.done&&(Object.keys(s.loaded).forEach(c=>{l[c]||(l[c]={});const u=s.loaded[c];u.length&&u.forEach(d=>{l[c][d]===void 0&&(l[c][d]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(s=>!s.done)}read(e,n,o){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:o,tried:r,wait:i,callback:a});return}this.readingCalls++;const l=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&r{this.read.call(this,e,n,o,r+1,i*2,a)},i);return}a(c,u)},s=this.backend[o].bind(this.backend);if(s.length===2){try{const c=s(e,n);c&&typeof c.then=="function"?c.then(u=>l(null,u)).catch(l):l(null,c)}catch(c){l(c)}return}return s(e,n,l)}prepareLoading(e,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(e,n,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(e,n,o){this.prepareLoading(e,n,{},o)}reload(e,n,o){this.prepareLoading(e,n,{reload:!0},o)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const o=e.split("|"),r=o[0],i=o[1];this.read(r,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${r} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${r}`,l),this.loaded(e,a,l)})}saveMissing(e,n,o,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${o}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){const s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,n,o,r,s):u=c(e,n,o,r),u&&typeof u.then=="function"?u.then(d=>l(null,d)).catch(l):l(null,u)}catch(u){l(u)}else c(e,n,o,r,l,s)}!e||!e[0]||this.store.addResource(e[0],n,o,r)}}}function t4e(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const o=e[3]||e[2];Object.keys(o).forEach(r=>{n[r]=o[r]})}return n},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function n4e(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function pB(){}function Dht(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class SF extends tq{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=n4e(e),this.services={},this.logger=p9,this.modules={external:[]},Dht(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(o=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const r=t4e();this.options={...r,...this.options,...n4e(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...r.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function i(u){return u?typeof u=="function"?new u:u:null}if(!this.options.isClone){this.modules.logger?p9.init(i(this.modules.logger),this.options):p9.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=Mht);const d=new QAe(this.options);this.store=new qAe(this.options.resources,this.options);const f=this.services;f.logger=p9,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Cht(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(f.formatter=i(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Rht(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new zht(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(p){for(var g=arguments.length,A=new Array(g>1?g-1:0),y=1;y1?g-1:0),y=1;y{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,o||(o=pB),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const s=gz(),c=()=>{const u=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(f),o(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),s}loadResources(e){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pB;const r=typeof e=="string"?e:this.language;if(typeof e=="function"&&(o=e),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(c=>{c!=="cimode"&&i.indexOf(c)<0&&i.push(c)})};r?a(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(s=>a(s)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(l)})}else o(null)}reloadResources(e,n,o){const r=gz();return e||(e=this.languages),n||(n=this.options.ns),o||(o=pB),this.services.backendConnector.reload(e,n,i=>{r.resolve(),o(i)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&mWe.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}changeLanguage(e,n){var o=this;this.isLanguageChangingTo=e;const r=gz();this.emit("languageChanging",e);const i=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,c)=>{c?(i(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve(function(){return o.t(...arguments)}),n&&n(s,function(){return o.t(...arguments)})},l=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const c=typeof s=="string"?s:this.services.languageUtils.getBestMatchFromCodes(s);c&&(this.language||i(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{a(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(e),r}getFixedT(e,n,o){var r=this;const i=function(a,l){let s;if(typeof l!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),d=2;d`${s.keyPrefix}${f}${g}`):p=s.keyPrefix?`${s.keyPrefix}${f}${a}`:a,r.t(p,s)};return typeof e=="string"?i.lng=e:i.lngs=e,i.ns=n,i.keyPrefix=o,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=this.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(o,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(o,e)&&(!r||a(i,e)))}loadNamespaces(e,n){const o=gz();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{o.resolve(),n&&n(r)}),o):(n&&n(),Promise.resolve())}loadLanguages(e,n){const o=gz();typeof e=="string"&&(e=[e]);const r=this.options.preload||[],i=e.filter(a=>r.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=r.concat(i),this.loadResources(a=>{o.resolve(),n&&n(a)}),o):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new QAe(t4e());return n.indexOf(o.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new SF(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pB;const o=e.forkResourceStore;o&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},i=new SF(r);return(e.debug!==void 0||e.prefix!==void 0)&&(i.logger=i.logger.clone(e)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},o&&(i.store=new qAe(this.store.data,r),i.services.resourceStore=i.store),i.translator=new q_(i.services,r),i.translator.on("*",function(l){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}};function r4e(t,e,n){t.loadNamespaces(e,yWe(t,n))}function i4e(t,e,n,o){typeof n=="string"&&(n=[n]),n.forEach(r=>{t.options.ns.indexOf(r)<0&&t.options.ns.push(r)}),t.loadLanguages(e,yWe(t,o))}function Fht(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const o=e.languages[0],r=e.options?e.options.fallbackLng:!1,i=e.languages[e.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const a=(l,s)=>{const c=e.services.backendConnector.state[`${l}|${s}`];return c===-1||c===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!a(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(o,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||a(o,t)&&(!r||a(i,t)))}function kht(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!e.languages||!e.languages.length?(Wse("i18n.languages were undefined or empty",e.languages),!0):e.options.ignoreJSONStructure!==void 0?e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}):Fht(t,e,n)}const Lht=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Wht={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Nht=t=>Wht[t],Uht=t=>t.replace(Lht,Nht);let Nse={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Uht};function jht(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nse={...Nse,...t}}function Bht(){return Nse}let AWe;function Yht(t){AWe=t}function Oht(){return AWe}const Vht={type:"3rdParty",init(t){jht(t.options.react),Yht(t)}},_ht=m.createContext();class Ght{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Xht=(t,e)=>{const n=m.useRef();return m.useEffect(()=>{n.current=t},[t,e]),n.current};function Xl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=e,{i18n:o,defaultNS:r}=m.useContext(_ht)||{},i=n||o||Oht();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new Ght),!i){Wse("You will need to pass in an i18next instance by using initReactI18next");const P=(T,w)=>typeof w=="string"?w:w&&typeof w=="object"&&typeof w.defaultValue=="string"?w.defaultValue:Array.isArray(T)?T[T.length-1]:T,v=[P,{},!1];return v.t=P,v.i18n={},v.ready=!1,v}i.options.react&&i.options.react.wait!==void 0&&Wse("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...Bht(),...i.options.react,...e},{useSuspense:l,keyPrefix:s}=a;let c=r||i.options&&i.options.defaultNS;c=typeof c=="string"?[c]:c||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(c);const u=(i.isInitialized||i.initializedStoreOnce)&&c.every(P=>kht(P,i,a));function d(){return i.getFixedT(e.lng||null,a.nsMode==="fallback"?c:c[0],s)}const[f,p]=m.useState(d);let g=c.join();e.lng&&(g=`${e.lng}${g}`);const A=Xht(g),y=m.useRef(!0);m.useEffect(()=>{const{bindI18n:P,bindI18nStore:v}=a;y.current=!0,!u&&!l&&(e.lng?i4e(i,e.lng,c,()=>{y.current&&p(d)}):r4e(i,c,()=>{y.current&&p(d)})),u&&A&&A!==g&&y.current&&p(d);function T(){y.current&&p(d)}return P&&i&&i.on(P,T),v&&i&&i.store.on(v,T),()=>{y.current=!1,P&&i&&P.split(" ").forEach(w=>i.off(w,T)),v&&i&&v.split(" ").forEach(w=>i.store.off(w,T))}},[i,g]);const S=m.useRef(!0);m.useEffect(()=>{y.current&&!S.current&&p(d),S.current=!1},[i,s]);const C=[f,i,u];if(C.t=f,C.i18n=i,C.ready=u,u||!u&&!l)return C;throw new Promise(P=>{e.lng?i4e(i,e.lng,c,()=>P()):r4e(i,c,()=>P())})}function Jht(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TF(t){"@babel/helpers - typeof";return TF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TF(t)}function Kht(t,e){if(TF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(TF(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function qht(t){var e=Kht(t,"string");return TF(e)==="symbol"?e:String(e)}function $ht(t,e){for(var n=0;n0){var l=r.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(r.domain){if(!a4e.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(r.domain)}if(r.path){if(!a4e.test(r.path))throw new TypeError("option path is invalid");a+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){var s=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(s){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},l4e={create:function(e,n,o,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};o&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+o*60*1e3)),r&&(i.domain=r),document.cookie=npt(e,encodeURIComponent(n),i)},read:function(e){for(var n="".concat(e,"="),o=document.cookie.split(";"),r=0;r-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=o.substring(1),i=r.split("&"),a=0;a0){var s=i[a].substring(0,l);s===e.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},mz=null,s4e=function(){if(mz!==null)return mz;try{mz=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{mz=!1}return mz},ipt={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&s4e()){var o=window.localStorage.getItem(e.lookupLocalStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&s4e()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},yz=null,c4e=function(){if(yz!==null)return yz;try{yz=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{yz=!1}return yz},apt={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&c4e()){var o=window.sessionStorage.getItem(e.lookupSessionStorage);o&&(n=o)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&c4e()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},lpt={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var o=0;o0?n:void 0}},spt={name:"htmlTag",lookup:function(e){var n,o=e.htmlTag||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(n=o.getAttribute("lang")),n}},cpt={name:"path",lookup:function(e){var n;if(typeof window<"u"){var o=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(o instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof o[e.lookupFromPathIndex]!="string")return;n=o[e.lookupFromPathIndex].replace("/","")}else n=o[0].replace("/","")}return n}},upt={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,o=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[n]}};function dpt(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var vWe=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jht(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return Qht(t,[{key:"init",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=tpt(o,this.options||{},dpt()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(opt),this.addDetector(rpt),this.addDetector(ipt),this.addDetector(apt),this.addDetector(lpt),this.addDetector(spt),this.addDetector(cpt),this.addDetector(upt)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var o=this;n||(n=this.options.order);var r=[];return n.forEach(function(i){if(o.detectors[i]){var a=o.detectors[i].lookup(o.options);a&&typeof a=="string"&&(a=[a]),a&&(r=r.concat(a))}}),r=r.map(function(i){return o.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}},{key:"cacheUserLanguage",value:function(n,o){var r=this;o||(o=this.options.caches),o&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||o.forEach(function(i){r.detectors[i]&&r.detectors[i].cacheUserLanguage(n,r.options)}))}}]),t}();vWe.type="languageDetector";const fpt={translation:{name:{IFI:"Institute for Future Intelligence",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"By clicking Accept, you agree to our use of cookies to improve your experience with Aladdin.",Accept:"Accept"},aboutUs:{ProductBroughtToYouBy:"This product is brought to you by",TermsOfService:"Terms of Service",PrivacyPolicy:"Privacy Policy",Software:"Software",Content:"Content",Research:"Research",Support:"Support",Acknowledgment:"Acknowledgment",FundingInformation:"The National Science Foundation (NSF) generously provided funding for the research and development of this product through grants #2105695, #2131097, and #2301164. Any opinions, findings, and conclusions or recommendations expressed in this product, however, are those of the authors and do not necessarily reflect the views of NSF.",Contact:"For more information, please contact Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"All Rights Reserved",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Version",VersionInitial:"V",Options:"Options",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Maximum Number",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"Or",None:"None",High:"High",Partial:"Partial",Teacher:"Teacher",Class:"Class",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Range",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",BuildingHVACSystem:"Building HVAC System",ThermostatSetpoint:"Thermostat Setpoint",TemperatureToleranceThreshold:"Tolerance Threshold",TemperatureToleranceThresholdExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. AC will not run if the highest outside temperature of the day is lower than the setpoint plus this threshold.`,Press:"Press",Open:"Open",Save:"Save",SaveAsImage:"Save as Image",SaveAsCsv:"Save as CSV",Update:"Update",Paste:"Paste",Copy:"Copy",Cut:"Cut",Delete:"Delete",Add:"Add",Lock:"Lock",Translucent:"Translucent",Transparency:"Transparency",Color:"Color",Pattern:"Pattern",Texture:"Texture",Size:"Size",Thickness:"Thickness",Yes:"Yes",No:"No",OK:"OK",Cancel:"Cancel",Apply:"Apply",Close:"Close",ApplyTo:"Apply to",Run:"Run",Pause:"Pause",Resume:"Resume",Clear:"Clear",Warning:"Warning",Caution:"Caution",Reminder:"Reminder",Length:"Length",Width:"Width",Height:"Height",Radius:"Radius",Angle:"Angle",Azimuth:"Azimuth",Coordinates:"Coordinates",Weather:"Weather",Show:"Show",Animate:"Animate",Date:"Date",Time:"Time",Title:"Title",Owner:"Owner",Action:"Action",Rename:"Rename",Location:"Location",Latitude:"Latitude",Month:"Month",Day:"Day",Hour:"Hour",Daylight:"Daylight",Radiation:"Radiation",Temperature:"Temperature",kWh:"kWh",dollar:"dollar",MeterPerSecond:"m/s",NorthInitial:"N",SouthInitial:"S",EastInitial:"E",WestInitial:"W",Fixed:"Fixed",Elements:"Elements",Energy:"Energy",Unknown:"Unknown",Label:"Label",Description:"Description",NoDescription:"No description",MaximumCharacters:"Maximum characters",Author:"Author",Publisher:"Publisher",Building:"Building",ResidentialBuilding:"Residential Building",CommercialBuilding:"Commercial Building",SchoolBuilding:"School Building",TouristAttraction:"Tourist Attraction",UnderConstruction:"Under Construction",Photovoltaic:"Photovoltaic",WindPower:"Wind Power",ColocationProjects:"Colocation Projects",Anonymous:"Anonymous",Nickname:"Nickname",Pin:"Pin",Unpin:"Unpin"},shared:{NoTexture:"No Texture",FoundationElement:"Foundation",CuboidElement:"Cuboid",PolygonElement:"Polygon",SensorElement:"Sensor",SolarPanelElement:"Solar Panel",SolarWaterHeaterElement:"Solar Water Heater",ParabolicDishElement:"Parabolic Dish",ParabolicTroughElement:"Parabolic Trough",FresnelReflectorElement:"Fresnel Reflector",HeliostatElement:"Heliostat",WindTurbineElement:"Wind Turbine",LightElement:"Light",ElementLocked:"Locked",ModelType:"Model Type",OutputBreakdown:"Breakdown",MoreResults:"More Results"},message:{NewVersionAvailable:"A new version is available",CalculationMayBeSlowDoYouWantToContinue:"Calculation may be slow. Do you want to continue?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"Increase solar radiation heatmap grid cell size to speed up",ModelNotFound:"Model not found",CannotSignIn:"Cannot sign in",CannotSignOut:"Cannot sign out",YourAccountWasCreated:"Your account was created.",CannotCreateAccount:"Cannot create an account",YourAccountSettingsWereSaved:"Your account settings were saved.",CannotSaveYourAccountSettings:"Cannot save your account settings",CannotSaveYourFileToCloud:"Cannot save your file to the cloud",CannotCreateNewProject:"Cannot create a new project",CannotCreateNewProjectWithoutTitle:"Cannot create a new project without a title",CannotOpenYourProjects:"Cannot open your projects",CannotOpenProject:"Cannot open the project",CannotDeleteProject:"Cannot delete the project",CannotRenameProject:"Cannot rename the project",CannotAddDesignToProject:"Cannot add this design to the project",CannotAddDesignToProjectOwnedByOthers:"Cannot add this design to a project owned by others",DesignRemovedFromProject:"The design was successfully removed from the project",CannotRemoveDesignFromProject:"Cannot remove this design from the project",CannotUpdateProject:"Cannot update the project",CannotFetchProjectData:"Cannot fetch project data",TitleUsedChooseDifferentOne:"This title has been used. Choose a different one",CloudFileWithTitleExistsDoYouWantToOverwrite:"A cloud file with the title exists. Do you want to overwrite it?",CloudFileNotFound:"The cloud file was not found",CannotLoadModelsOnMap:"Cannot load models on map",CannotLoadLeaderboard:"Cannot load leaderboard",CannotPublishModelOnMap:"Cannot publish model on map",CannotLikeModelFromMap:"Cannot like model from map",CannotDeleteModelFromMap:"Cannot delete model from map",ModelDeletedFromMap:"Model is deleted from map",DoYouWantToDeleteModelFromMap:"Do you want to delete the model from map?",CannotOpenCloudFile:"Cannot open the cloud file",CannotReadCloudFile:"Cannot read the cloud file",CannotWriteCloudFile:"Cannot write the cloud file",CloudFileCopied:"Cloud file copied",CannotOpenCloudFolder:"Cannot open your cloud folder",CannotDeleteCloudFile:"Cannot delete the cloud file",CannotRenameCloudFile:"Cannot rename the cloud file",DoYouWantToSaveChanges:"Do you want to save changes?",NotApplicableToSelectedAction:"Not Applicable to Selected Action",ThisElementIsLocked:"This element is locked.",ThisCannotBeUndone:"This cannot be undone.",AzimuthOfNorthIsZero:"Azimuth of north is 0°",CounterclockwiseAzimuthIsPositive:"Counter-clockwise is positive",SouthFacingIsZero:"South-facing is 0°",ClockwiseRotationIsPositive:"Clockwise is positive",MoveCancelledBecauseOfOverlap:"Move cancelled because of overlap.",MoveOutsideBoundaryCancelled:"Move outside the boundary cancelled.",RotationCancelledBecauseOfOverlap:"Rotation cancelled because of overlap.",RotationOutsideBoundaryCancelled:"Rotation outside the boundary cancelled.",ResizingCancelledBecauseOfOverlap:"Resizing cancelled because of overlap.",ResizingOutsideBoundaryCancelled:"Resizing outside the boundary cancelled.",CannotPasteOutsideBoundary:"Cannot paste outside the boundary.",CannotPasteBecauseOfOverlap:"Cannot paste because of overlap.",CannotMoveObjectTooFar:"Cannot move object too far.",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"Existing solar panels will be removed before applying the new layout.",DoYouWantToContinue:"Do you want to continue?",SolarPanelsCannotIntersectWithGround:"Solar panels cannot intersect with the ground.",SolarPanelsCannotOverlapWithOneAnother:"Solar panels cannot overlap with one another.",ScreenshotSaved:"A screenshot was saved.",CsvFileSaved:"A CSV file was saved.",SimulationStarted:"Simulation started.",SimulationCompleted:"Simulation completed.",SimulationAborted:"Simulation aborted.",SimulationPaused:"Simulation paused.",CancelSimulation:"Cancel simulation",PauseSimulation:"Pause simulation",ResumeSimulation:"Resume simulation",SimulationWillNotStartDueToErrors:"Simulation will not start due to errors",SimulationWillStartDespiteWarnings:"Simulation will start despite warnings.",EvolutionStarted:"Evolution started.",EvolutionCompleted:"Evolution completed.",EvolutionAborted:"Evolution aborted.",EvolutionPaused:"Evolution paused.",EncounterEvolutionError:"Encountered an evolution error.",CancelEvolution:"Cancel evolution",PauseEvolution:"Pause evolution",ResumeEvolution:"Resume evolution",ConvergenceThresholdHasBeenReached:"The convergence threshold has been reached.",MaximumNumberOfGenerationsHasBeenReached:"The maximum number of generations has been reached.",MaximumNumberOfStepsHasBeenReached:"The maximum number of steps has been reached.",ObjectiveFunctionTypeError:"The current objective function is not supported by this operation. Please start from the menu.",WallsAreNotAtSameHeight:"Walls are not at the same height.",WallsAreNotPerpendicular:"Walls are not perpendicular.",WallsAreNotConnected:"Walls are not connected.",WallsNumberNeedToBeFour:"The number of walls needs to be four.",BuildingContainsEmptyWall:"Building contains one or more empty wall.",BuildingRoofMissing:"Building has a missing roof.",UnknownErrors:"Unknown errors.",SigningOutAnonymousAccount:"Are you sure you want to sign out? This anonymous account will be lost."},menu:{AnalysisOptions:"Analysis Options",option:{GridCellSize:"Grid Cell Size",SamplingFrequency:"Sampling Frequency",TimesPerHour:"Times per Hour",DaysPerYear:"Days per Year"},mainMenu:"Main Menu",cloudMenu:"Cloud Menu",projectSubMenu:"Project",project:{CreateNewProject:"Create New Project",OpenProject:"Open Project",SaveProject:"Save Project",SaveProjectAs:"Save Project As",YouMustLogInToCreateProject:"You must log in to create a new project",YouMustLogInToOpenProject:"You must log in to open a project"},fileSubMenu:"File",file:{CreateNewFile:"Create New File",OpenLocalFile:"Open Local File",SaveAsLocalFile:"Save as Local File",SavingAbortedMustHaveValidFileName:"Saving aborted! You must have a valid file name",OpenCloudFile:"Open Cloud File",SaveCloudFile:"Save Cloud File",SaveAsCloudFile:"Save as Cloud File",SavingAbortedMustHaveValidTitle:"Saving aborted! You must have a valid title for a cloud file",ToSaveYourWorkPleaseSignIn:"To save your work, please sign in.",TakeScreenshot:"Take Screenshot",UseCloudFileName:"Use Cloud File Name",PublishOnModelsMap:"Publish on Models Map",PublishedOnModelsMap:"Your model has been published on the Models Map",UpdatedOnModelsMap:"Your model has been updated on the Models Map",YouMustLogInToPublishYourModel:"You must log in to publish your model",YouCannotPublishAModelThatYouDoNotOwn:"You cannot publish a model that you do not own",YouMustSaveModelOnCloudBeforePublishingIt:"You must save the model on the cloud before publishing it"},editSubMenu:"Edit",edit:{Undo:"Undo",Redo:"Redo"},viewSubMenu:"View",view:{NavigationView:"Navigation View",TwoDimensionalView:"2D View",ResetView:"Reset",ZoomIn:"Zoom In",ZoomOut:"Zoom Out",AutoRotate:"Auto Rotate",ShowShadow:"Show Shadow",ShowSurfaceShininess:"Show Surface Shininess",TranslucentFloatingWindows:"Translucent Floating Windows",accessoriesSubMenu:"Accessories",accessories:{SiteInformation:"Site Information",DesignInformation:"Design Information",Instruction:"Instruction",StickyNote:"Sticky Note",Note:"Note"}},settingsSubMenu:"Settings",settings:{WeatherData:"Weather Data",DiurnalTemperature:"Diurnal Temperature",Heliodon:"Heliodon",SunAndTime:"Sun & Time",CustomSolarPanels:"Custom Solar Panels",CustomizeSolarPanel:"Customize Solar Panel"},benchmarksSubMenu:"Benchmarks",benchmarks:{SolarRadiationPredictionVsMeasurement:"Solar Radiation Prediction vs. Measurement",BESTESTCase600:"Building Energy Simulation Test: BESTEST Case 600",BESTESTCase610:"Building Energy Simulation Test: BESTEST Case 610",BESTESTCase620:"Building Energy Simulation Test: BESTEST Case 620",BESTESTCase630:"Building Energy Simulation Test: BESTEST Case 630"},graph:{LineWidth:"Line Width",SymbolSize:"Symbol Size",BarCategoryGap:"Bar Category Gap",ShowHorizontalGridLines:"Show Horizontal Grid Lines",ShowVerticalGridLines:"Show Vertical Grid Lines"},analysisSubMenu:"Analysis",physicsSubMenu:"Physics",physics:{DailySolarRadiationHeatmap:"Daily Solar Radiation Heatmap",SolarRadiationHeatmapOptions:"Solar Radiation Heatmap Options",SolarRadiationHeatmapGridCellSize:"Solar Radiation Heatmap Grid Cell Size",SolarRadiationHeatmapMaxValue:"Solar Radiation Heatmap Maximum Value",SolarRadiationHeatmapNoAnimation:"No Animation for Static Model",ReflectionHeatmap:"Reflection Heatmap"},sensorSubMenu:"Sensor",sensor:{CollectDailyData:"Collect Daily Data",CollectYearlyData:"Collect Yearly Data",SensorSimulationNoAnimation:"No Animation for Collecting Sensor Data"},buildingSubMenu:"Building",building:{AnalyzeDailyBuildingEnergy:"Analyze Daily Building Energy",AnalyzeYearlyBuildingEnergy:"Analyze Yearly Building Energy",EnergyAnalysisOptions:"Energy Analysis Options",EnergyGridCellSize:"Energy Grid Cell Size",BuildingEnergySimulationNoAnimation:"No Animation for Building Energy Simulation"},solarPanelSubMenu:"Solar Panel",solarPanel:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",AnalyzeVisibility:"Analyze Visibility",PanelDiscretization:"Panel Discretization",Exact:"Exact",Approximate:"Approximate",EnergyGridCellSize:"Energy Grid Cell Size",VisibilityGridCellSize:"View Factor Grid Cell Size",EnergyAnalysisOptions:"Energy Analysis Options",VisibilityAnalysisOptions:"Visibility Analysis Options",SolarPanelSimulationNoAnimation:"No Animation for Solar Panel Simulation"},parabolicTroughSubMenu:"Parabolic Trough",parabolicTrough:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},parabolicDishSubMenu:"Parabolic Dish",parabolicDish:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},fresnelReflectorSubMenu:"Fresnel Reflector",fresnelReflector:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},heliostatSubMenu:"Heliostat",heliostat:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield"},solarUpdraftTowerSubMenu:"Solar Updraft Tower",solarUpdraftTower:{AnalyzeDailyYield:"Analyze Daily Yield",AnalyzeYearlyYield:"Analyze Yearly Yield",SolarUpdraftTowerSimulationNoAnimation:"No Animation for Solar Updraft Tower Simulation"},tutorialsSubMenu:"Tutorials",solarEnergyScienceSubMenu:"Solar Science",solarEnergyScienceTutorials:{SunAngles:"Sun Angles Relative to an Observer on the Ground",InsolationAndClimate:"Insolation and Climate",SolarRadiationToBox:"Solar Radiation to a Box"},buildingScienceSubMenu:"Building Science",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"Thermal Envelope vs. Building Envelope",EffectOfSizeOnBuildingEnergy:"Effect of Size on Building Energy",EffectOfOrientationOnBuildingEnergy:"Effect of Orientation on Building Energy",EffectOfInsulationOnBuildingEnergy:"Effect of Insulation on Building Energy",EffectOfRoofColorOnBuildingEnergy:"Effect of Roof Color on Building Energy",EffectOfEavesOverhangLengthOnBuildingEnergy:"Effect of Eaves Overhang Length on Building Energy",EffectOfWindowSHGCOnBuildingEnergy:"Effect of Window Solar Heat Gain on Building Energy",EffectOfThermostatSetpointOnBuildingEnergy:"Effect of Thermostat Setpoint on Building Energy",EffectOfSolarPanelsOnBuildingEnergy:"Effect of Solar Panels on Building Energy",EffectOfGroundTemperatureOnBuildingEnergy:"Effect of Ground Temperature on Building Energy",EffectOfTreesOnBuildingEnergy:"Effect of Trees on Building Energy"},buildingDesignSubMenu:"Building Design",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"Cape Cod Style House with Shed Dormer",MansardRoofWithDormers:"Mansard Roof with Dormers",GableRoofVsHipRoof:"Gable Roof vs. Hip Roof",ColonialVsSaltbox:"Colonial vs. Saltbox",GambrelRoofVsMansardRoof:"Gambrel Roof vs. Mansard Roof",CombinationRoofVsBonnetRoof:"Combination Roof vs. Bonnet Roof",DutchGableRoof:"Dutch Gable Roof",GableAndValleyRoof:"Gable and Valley Roof",ClerestoryRoof:"Clerestory Roof",MonitorRoof:"Monitor Roof",AFrameHouse:"A-Frame House",HalfTimberedHouse:"Half-Timbered House",AllBasicRoofTypes:"All Basic Roof Types"},photovoltaicSolarPowerSubMenu:"Photovoltaic Solar Power",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"Effect of Tilt Angle of a Solar Panel",EffectOfAzimuthOfSolarPanel:"Effect of Azimuth of a Solar Panel",SolarPanelTypes:"Solar Panel Types",DefineYourOwnSolarPanels:"Define Your Own Solar Panels",VerticalBifacialSolarPanels:"Vertical Bifacial Solar Panels",CompareMonofacialAndBifacialSolarPanels:"Monofacial vs. Bifacial Solar Panels",SolarTrackers:"Solar Trackers",CoveringGroundWithSolarPanels:"Why Just Covering the Ground with Solar Panels is not a Good Idea",InterRowSpacingOfSolarPanelArray:"Effect of Inter-Row Spacing in a Solar Panel Array",EffectOfOrientationOfSolarPanels:"Effect of Orientation of Solar Panels",SolarPanelArrayAutomaticLayout:"Solar Panel Array Automatic Layout"},concentratedSolarPowerSubMenu:"Concentrated Solar Power",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"Effect of Azimuth of a Parabolic Trough",EffectOfLatusRectumOfParabolicTrough:"Effect of Latus Rectum of a Parabolic Trough",FocusSunlightWithParabolicDish:"Focus Sunlight with a Parabolic Dish",LinearFresnelReflectors:"Linear Fresnel Reflectors",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"Effect of Absorber Pipe Height for Linear Fresnel Reflectors",EffectOfAzimuthOfLinearFresnelReflectors:"Effect of Azimuth of Linear Fresnel Reflectors",LinearFresnelReflectorsWithTwoAbsorbers:"Linear Fresnel Reflectors with Two Absorbers",CosineEfficiencyOfHeliostats:"Cosine Efficiency of Heliostats",ShadowingAndBlockingOfHeliostats:"Shadowing and Blocking of Heliostats",EffectSolarPowerTowerHeight:"Effect of Solar Power Tower Height",SolarPowerTower:"Solar Power Tower"},otherTypesOfSolarPowerSubMenu:"Other Types of Solar Power",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"Solar Water Heaters",SolarUpdraftTower:"Solar Updraft Tower"},windPowerSubMenu:"Wind Power",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"Effect of Blade Number of Wind Turbine",EffectOfPitchAngleOfWindTurbineBlades:"Effect of Pitch Angle of Wind Turbine Blades",BirdSafeBladeDesign:"Bird-Safe Blade Design",OffshoreWindFarm:"Offshore Wind Farm"},colocationSubMenu:"Colocation",colocationTutorials:{AgricultureSolarWindColocation:"Agriculture-Solar-Wind Colocation"},generativeDesignSubMenu:"Generative Design",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Monofacial Solar Panel Array",BifacialSolarPanelArrayTiltAngle:"The Tilt Angle of a Bifacial Solar Panel Array",OutputOfSolarPanelArrayInDifferentPlaces:"The Output of a Solar Panel Array in Different Places",SimpleSolarFarmParetoFront:"The Pareto Front for Designing a Simple Solar Farm"},examplesSubMenu:"Examples",solarEnergySubMenu:"Solar Energy",solarEnergyExamples:{SunBeamAndHeliodon:"Sun Beam and Heliodon",RooftopSolarPanels:"Rooftop Solar Panels",NevadaSolarOneParabolicTroughArray:"Nevada Solar One Parabolic Trough Array",TooeleParabolicDishArray:"Tooele Parabolic Dish Array",PS10SolarPowerTower:"PS10 Solar Power Tower",TucsonLinearFresnelReflectors:"Tucson Linear Fresnel Reflectors",SolarCanopyFormFactors:"Solar Canopy Form Factors",SolarCanopyOverBleachers:"Solar Canopy Over Bleachers",SolarCanopyOverGarage:"Solar Canopy Over Garage",SolarBusStop:"Solar Bus Stop",SolarFacadeTesla:"Tesla Solar Façade",BuildingIntegratedPhotovoltaics:"Building-Integrated Photovoltaics",Floatovoltaics:"Floatovoltaics",Agrivoltaics:"Agrivoltaics",VegetativeBuffer:"Vegetative Buffer",RainbowSwashSolarFarmBostonMA:"Rainbow Swash Solar Farm in Boston, MA",MickeyMouseSolarFarmOrlandoFL:"Mickey Mouse Solar Farm in Orlando, FL",SolarPanelsOverCanalBakersfieldCA:"Hypothetical Solar Panels Over Canal in Bakersfield, CA",SolarNoiseBarrierLexingtonMA:"Hypothetical Solar Noise Barrier in Lexington, MA",HSATSolarTrackersRaleighNC:"Horizontal Single Axis Trackers (HSAT) in Raleigh, NC",AADATSolarTrackersLancasterCA:"Azimuth–Altitude Dual Axis Trackers (AADAT) in Lancaster, CA",SolarUpdraftTowerInCity:"Solar Updraft Tower in City"},builtEnvironmentSubMenu:"Built Environment",residentialBuildingsSubMenu:"Residential Buildings",residentialBuildingExamples:{ColonialHouse:"Colonial House",DutchColonialHouse:"Dutch Colonial House",TShapedHouse:"T-Shaped House",CapeCodHouseWithGarage:"Cape Cod House with Garage",Solarium:"Solarium",Church1:"Church 1",Cathedral1:"Cathedral 1",Cathedral2:"Cathedral 2",Mosque1:"Mosque 1",AdobeTaosHouse:"Adobe Taos House",RanchHouse:"Ranch House",BonnetHouse:"Bonnet House",BarnStyleHouse:"Barn Style House",ModernHouse:"Modern House",ButterflyRoofHouse:"Butterfly Roof House"},commercialBuildingsSubMenu:"Commercial Buildings",commercialBuildingExamples:{WhiteHouse:"White House",HaroldWashingtonCollege:"Harold Washington College",BilimMersinTurkiye:"BILIM, Mersin, Turkiye",SpanishStyleHotel:"Spanish Style Hotel",ApartmentBuilding:"Apartment Building",OfficeBuilding:"Office Building",Hotel:"Hotel"},buildingComplexesSubMenu:"Building Complexes",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"South Burlington High School, VT",MescaleroApacheSchoolNewMexico:"Mescalero Apache School, NM"},urbanPlanningSubMenu:"Urban Planning",urbanPlanningExamples:{CityBlockHeatmap:"City Block Heatmap",ChicagoSkyline:"Chicago Skyline"},otherBuildingsSubMenu:"Other Buildings",otherBuildingExamples:{Greenhouse:"Greenhouse",Pavilion:"Pavilion in a Park",OctagonalPagoda:"Octagonal Pagoda",OceanFront:"Ocean Front",EgyptianPyramids:"Egyptian Pyramids",MayanPyramid:"Mayan Pyramid",SiOSePol:"Si-o-se-pol",StackedCuboids:"Stacked Cuboids"},artificialIntelligenceSubMenu:"Artificial Intelligence",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"Optimizing the Tilt Angle of a Solar Panel Row",OptimizingTiltAnglesOfMultipleSolarPanelRows:"Optimizing the Tilt Angles of Multiple Solar Panel Rows",SolarFarmGenerativeDesign:"Solar Farm Generative Design",SolarFarmGenerativeDesignWithBlock:"Solar Farm Generative Design in the Presence of a Block",FitchburgSolarFarmGenerativeDesign:"Fitchburg Solar Farm Generative Design"},languageSubMenu:"Language",publicSubMenu:"Public",ModelsGallery:"Models Gallery",ModelsMap:"Models Map",AboutUs:"About Us"},avatarMenu:{AccountSettings:"Account Settings",PrivacyStatementTitle:"User Privacy Protection Statement",PrivacyStatement:"When you sign in, your Google ID is used to create and access your Aladdin account. Only a random alphanumeric string is stored in our database as a reference. No personally identifiable data such as your name or email is ever gathered. For more information, see our ",SignIn:"Sign In",SignInAsMe:"Sign in as me",SignInAnonymously:"Sign in anonymously",SignOut:"Sign Out",IfYouAreAStudent:"If you are a student"},skyMenu:{Axes:"Axes",Theme:"Theme",ThemeDefault:"Default",ThemeDesert:"Desert",ThemeDune:"Dune",ThemeForest:"Forest",ThemeGrassland:"Grassland",ThemeHill:"Hill",ThemeLake:"Lake",ThemeMountain:"Mountain",ThemeRural:"Rural",SunlightAttenuationCoefficientInAir:"Sunlight Attenuation Coefficient in Air",ConvectiveCoefficientOfAir:"Convective Coefficient of Air",HighestTemperatureTimeInMinutes:"Highest Temperature Time (Minutes)",SelectSunAnglesToShow:"Select Sun Angles to Show",ShowAzimuthAngle:"Show Azimuth Angle",ShowElevationAngle:"Show Elevation Angle",ShowZenithAngle:"Show Zenith Angle",DirectLightBrightnessAtNoon:"Direct Light Brightness at Noon",AmbientLightBrightnessAtNoon:"Ambient Light Brightness at Noon"},groundMenu:{MonthlyIrradianceLoss:"Monthly Irradiance Loss",Vegetation:"Vegetation",LeafOutDay:"Leaf-Out Day",LeafOffDay:"Leaf-Off Day",Albedo:"Albedo",ImageOnGround:"Image on Ground",WaterSurface:"Water Surface",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedPeople:"Remove All Unlocked People",RemoveAllUnlockedFoundations:"Remove All Unlocked Foundations",RemoveAllUnlockedCuboids:"Remove All Unlocked Cuboids",DoYouReallyWantToRemoveAllPeople:"Do you really want to remove all the people who are not locked",DoYouReallyWantToRemoveAllTrees:"Do you really want to remove all the trees that are not locked",DoYouReallyWantToRemoveAllFlowers:"Do you really want to remove all the flowers that are not locked",DoYouReallyWantToRemoveAllSolarPanels:"Do you really want to remove all the solar panels that are not locked",DoYouReallyWantToRemoveAllFoundations:"Do you really want to remove all the foundations that are not locked",DoYouReallyWantToRemoveAllCuboids:"Do you really want to remove all the cuboids that are not locked",LockAllUnlockedElements:"Lock All Unlocked Elements",UnlockAllLockedElements:"Unlock All Locked Elements"},labelSubMenu:{Label:"Label",LabelText:"Label Text",LabelHeight:"Label Height",LabelSize:"Label Size",LabelFontSize:"Font Size",LabelColor:"Label Color",KeepShowingLabel:"Keep Showing Label"},foundationMenu:{RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedParabolicTroughs:"Remove All Unlocked Parabolic Troughs",RemoveAllUnlockedParabolicDishes:"Remove All Unlocked Parabolic Dishes",RemoveAllUnlockedFresnelReflectors:"Remove All Unlocked Fresnel Reflectors",RemoveAllUnlockedHeliostats:"Remove All Unlocked Heliostats",RemoveAllUnlockedWindTurbines:"Remove All Unlocked Wind Turbines",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",RemoveAllUnlockedLights:"Remove All Unlocked Lights",RemoveAllUnlockedWalls:"Remove All Unlocked Walls",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",RemoveAllUnlockedDoors:"Remove All Unlocked Doors",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",RemoveAllUnlockedHumans:"Remove All Unlocked Humans",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",Racks:"Racks",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",SolarPanels:"Solar Panels",SolarPanelArray:"Solar Panel Array",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"Do you really want to remove all the solar panels on this foundation that are not locked",ParabolicTroughs:"Parabolic Troughs",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"Do you really want to remove all the parabolic troughs on this foundation that are not locked",ParabolicDishes:"Parabolic Dishes",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"Do you really want to remove all the parabolic dishes on this foundation that are not locked",FresnelReflectors:"Fresnel Reflectors",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"Do you really want to remove all the Fresnel reflectors on this foundation that are not locked",Heliostats:"Heliostats",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"Do you really want to remove all the heliostats on this foundation that are not locked",WindTurbines:"Wind Turbines",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"Do you really want to remove all the wind turbines on this foundation that are not locked",Sensors:"Sensors",DoYouReallyWantToRemoveAllSensorsOnFoundation:"Do you really want to remove all the sensors on this foundation that are not locked",Lights:"Lights",DoYouReallyWantToRemoveAllLightsOnFoundation:"Do you really want to remove all the lights on this foundation that are not locked",Walls:"Walls",DoYouReallyWantToRemoveAllWallsOnFoundation:"Do you really want to remove all the walls on this foundation that are not locked",Windows:"Windows",DoYouReallyWantToRemoveAllWindowsOnFoundation:"Do you really want to remove all the windows on this foundation that are not locked",Doors:"Doors",DoYouReallyWantToRemoveAllDoorsOnFoundation:"Do you really want to remove all the doors on this foundation that are not locked",Polygons:"Polygons",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"Do you really want to remove all the polygons on this foundation that are not locked",Humans:"Humans",DoYouReallyWantToRemoveAllHumansOnFoundation:"Do you really want to remove all the humans on this foundation who are not locked",Trees:"Trees",DoYouReallyWantToRemoveAllTreesOnFoundation:"Do you really want to remove all the trees on this foundation that are not locked",Flowers:"Flowers",DoYouReallyWantToRemoveAllFlowersOnFoundation:"Do you really want to remove all the flowers on this foundation that are not locked",OnlyThisFoundation:"Only This Foundation",AllConnectedFoundations:"All Connected Foundations",AllSelectedFoundations:"All Selected Foundations",AllFoundations:"All Foundations",AddPolygon:"Add Polygon",SolarStructure:"Solar Structure",GroupMaster:"Group Master",LockAllUnlockedElementsOnThisFoundation:"Lock All Unlocked Elements on This Foundation",UnlockAllLockedElementsOnThisFoundation:"Unlock All Locked Elements on This Foundation",GroundFloorRValue:"Ground Floor R-Value",OnlyThisGroundFloor:"Only This Ground Floor",AllGroundFloors:"All Ground Floors"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"Receiver Tower for Heliostats",ReceiverTowerPhysicalProperties:"Physical Properties of Receiver Tower",ReceiverTowerHeight:"Height of Receiver Tower",ReceiverTowerRadius:"Radius of Receiver Tower",ReceiverAbsorptance:"Absorptance of Receiver",ReceiverOpticalEfficiency:"Optical Efficiency of Receiver",ReceiverThermalEfficiency:"Thermal Efficiency of Receiver"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"Absorber Pipe for Fresnel Reflectors",AbsorberPipePhysicalProperties:"Physical Properties of Absorber Pipe",AbsorberHeight:"Height of Absorber Pipe",AbsorberApertureWidth:"Aperture Width of Absorber Pipe",AbsorberPipePoleNumber:"Pole Number for Absorber Pipe",AbsorberAbsorptance:"Absorptance of Absorber",AbsorberOpticalEfficiency:"Optical Efficiency of Absorber",AbsorberThermalEfficiency:"Thermal Efficiency of Absorber"},solarUpdraftTowerMenu:{SolarUpdraftTower:"Solar Updraft Tower",SolarUpdraftTowerPhysicalProperties:"Physical Properties of Solar Updraft Tower",SolarUpdraftTowerChimneyHeight:"Solar Updraft Tower Chimney Height",SolarUpdraftTowerChimneyRadius:"Solar Updraft Tower Chimney Radius",SolarUpdraftTowerCollectorHeight:"Solar Updraft Tower Collector Height",SolarUpdraftTowerCollectorRadius:"Solar Updraft Tower Collector Radius",SolarUpdraftTowerCollectorTransmissivity:"Solar Updraft Tower Collector Transmissivity",SolarUpdraftTowerCollectorEmissivity:"Solar Updraft Tower Collector Emissivity",SolarUpdraftTowerDischargeCoefficient:"Solar Updraft Tower Discharge Coefficient",SolarUpdraftTowerTurbineEfficiency:"Solar Updraft Tower Turbine Efficiency"},cuboidMenu:{Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",RemoveAllUnlockedHumans:"Remove All Unlocked Humans",RemoveAllUnlockedTrees:"Remove All Unlocked Trees",RemoveAllUnlockedFlowers:"Remove All Unlocked Flowers",RemoveAllUnlockedLights:"Remove All Unlocked Lights",Racks:"Racks",SolarPanels:"Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"Do you really want to remove all the solar panels on this cuboid that are not locked",Lights:"Lights",DoYouReallyWantToRemoveAllLightsOnCuboid:"Do you really want to remove all the lights on this cuboid that are not locked",Sensors:"Sensors",DoYouReallyWantToRemoveAllSensorsOnCuboid:"Do you really want to remove all the sensors on this cuboid that are not locked",Polygons:"Polygons",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"Do you really want to remove all the polygons on this cuboid that are not locked",Humans:"Humans",DoYouReallyWantToRemoveAllHumansOnCuboid:"Do you really want to remove all the humans on this cuboid who are not locked",Trees:"Trees",DoYouReallyWantToRemoveAllTreesOnCuboid:"Do you really want to remove all the trees on this cuboid that are not locked",Flowers:"Flowers",DoYouReallyWantToRemoveAllFlowersOnCuboid:"Do you really want to remove all the flowers on this cuboid that are not locked",OnlyThisCuboid:"Only This Cuboid",AllCuboidsOnSameSurface:"All Cuboids on Same Surface",AllCuboidsAboveSameBase:"All Cuboids Above Same Base",AllSelectedCuboids:"All Selected Cuboids",AllCuboids:"All Cuboids",OnlyThisSide:"Only This Side",AllSidesOfThisCuboid:"All Sides of This Cuboid",AllSidesOfSelectedCuboids:"All Sides of Selected Cuboids",AllSidesOfAllCuboids:"All Sides of All Cuboids",AddPolygon:"Add Polygon",Stackable:"Stackable",GroupMaster:"Group Master"},polygonMenu:{Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",TextBox:"Text Box",FontOutlineColor:"Font Outline Color",FontOutlineWidth:"Font Outline Width",FontStrokeColor:"Font Stroke Color",FontStrokeWidth:"Font Stroke Width",NoOutline:"No Outline",Shiny:"Shiny",Filled:"Filled",FillTexture:"Fill Texture",FillColor:"Fill Color",Opacity:"Opacity",LineColor:"Line Color",LineWidth:"Line Width",LineStyle:"Line Style",SolidLine:"Solid Line",DashedLine:"Dashed Line",DottedLine:"Dotted Line",InsertVertexBeforeIndex:"Insert Vertex Before Index",InsertVertexAfterIndex:"Insert Vertex After Index",DeleteVertex:"Delete Vertex",OnlyThisPolygon:"Only This Polygon",AllPolygonsOnSurface:"All Polygons on the Same Surface",AllPolygonsAboveFoundation:"All Polygons Above Foundation",AllSelectedPolygons:"All Selected Polygons",AllPolygons:"All Polygons",Layout:"Layout",SolarPanelArrayLayout:"Solar Panel Array Layout",SolarPanelArrayLayoutParametricDesign:"Solar Panel Array Layout: Parametric Design",SolarPanelArrayLayoutGenerativeDesign:"Solar Panel Array Layout: Generative Design",SolarPanelArrayModel:"Solar Panel Model",SolarPanelArrayOrientation:"Orientation",SolarPanelArrayTiltAngle:"Tilt Angle",SolarPanelArrayRowWidth:"Row Width",SolarPanelArrayInterRowSpacing:"Inter-Row Spacing",SolarPanelArrayRowSpacing:"Row Spacing",SolarPanelArrayRowAxis:"Row Axis",SolarPanelArrayLeftRightRowAxis:"Left-Right (Relative)",SolarPanelArrayUpDownRowAxis:"Up-Down (Relative)",SolarPanelArrayEastWestRowAxis:"East-West (Absolute)",SolarPanelArrayNorthSouthRowAxis:"North-South (Absolute)",SolarPanelArrayMargin:"Margin",SolarPanelArrayPoleHeight:"Pole Height",SolarPanelArrayPoleSpacing:"Pole Spacing",SolarPanelArrayTotalYearlyCost:"Total Cost",SolarPanelArrayTotalYearlyRevenue:"Total Revenue",SolarPanelArrayTotalYearlyYield:"Total Yield",SolarPanelArrayMeanYearlyYield:"Mean Yield",SolarPanelArrayYearlyProfit:"Profit",LayoutNotAcceptedCheckYourParameters:"This layout is not accepted. Please check your parameters."},optimizationMenu:{Optimization:"Optimization",Parameters:"Parameters",Variables:"Variables",Constants:"Constants",GeneticAlgorithm:"Genetic Algorithm",GeneticAlgorithmSettings:"Genetic Algorithm Settings",ParticleSwarmOptimization:"Particle Swarm Optimization",ParticleSwarmOptimizationSettings:"Particle Swarm Optimization Settings",SolarPanelTiltAngleOptimization:"Solar Panel Tilt Angle Optimization",SolarPanelArrayLayout:"Solar Panel Array Layout",Generation:"Generation",Gene:"Gene",NormalizedVariables:"Normalized Variables",Objective:"Objective",ObjectiveFunctionDailyTotalYield:"Daily Total Yield",ObjectiveFunctionYearlyTotalYield:"Yearly Total Yield",ObjectiveFunctionDailyMeanYield:"Daily Mean Yield",ObjectiveFunctionYearlyMeanYield:"Yearly Mean Yield",ObjectiveFunctionDailyProfit:"Daily Profit",ObjectiveFunctionYearlyProfit:"Yearly Profit",GeneticAlgorithmSelectionMethod:"Genetic Algorithm Selection Method",RouletteWheel:"Roulette Wheel",Tournament:"Tournament",SearchMethod:"Search Method",GlobalSearchUniformSelection:"Global Search Uniform Selection",LocalSearchRandomOptimization:"Local Search Random Optimization",PopulationSize:"Population Size",MaximumGenerations:"Maximum Generations",SelectionRate:"Selection Rate",CrossoverRate:"Crossover Rate",MutationRate:"Mutation Rate",Step:"Step",SwarmSize:"Swarm Size",MaximumSteps:"Maximum Steps",MaximumVelocity:"Maximum Velocity",InertiaWeight:"Inertia Weight",CognitiveCoefficient:"Cognitive Coefficient",SocialCoefficient:"Social Coefficient",ConvergenceThreshold:"Convergence Threshold for Termination",LocalSearchRadius:"Local Search Radius",RowsPerRackRange:"Range for Rows per Rack",TiltAngleRange:"Range for Tilt Angle",InterRowSpacingRange:"Range for Inter-Row Spacing",ClickTargetPolygonToActivate:"Click Target Polygon to Activate",ClickTargetFoundationToActivate:"Click Target Foundation to Activate"},treeMenu:{ShowModel:"Show Model",Flip:"Flip",Type:"Type",Spread:"Spread"},flowerMenu:{Flip:"Flip",Type:"Type",Spread:"Spread"},peopleMenu:{ChangePerson:"Change Person",Flip:"Flip",Observer:"Observer",ViewFromThisPerson:"View from This Person"},lightMenu:{Color:"Color",Intensity:"Intensity",Decay:"Decay",MaximumDistance:"Distance",Inside:"Inside"},solarCollectorMenu:{Coordinates:"Coordinates",RelativeXCoordinateOfCenter:"Relative X Coordinate of Center",RelativeYCoordinateOfCenter:"Relative Y Coordinate of Center",RelativeAzimuth:"Relative Azimuth",Pole:"Pole",PoleHeight:"Pole Height",PoleRadius:"Pole Radius",ExtraPoleHeight:"Extra Pole Height",ExtraPoleHeightInAdditionToHalfWidth:"Extra Pole Height in Addition to Half Width",DrawSunBeam:"Draw Sun Beam"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"Reflector Reflectance",ReceiverAbsorptance:"Receiver Absorptance",ReflectorOpticalEfficiency:"Reflector Optical Efficiency",ReceiverThermalEfficiency:"Receiver Thermal Efficiency"},solarPanelMenu:{ElectricalProperties:"Electrical Properties",InverterEfficiency:"Inverter Efficiency",InverterEfficiencyExplained:"The efficiency for converting direct current (DC) to alternating current (AC).",DcToAcSizeRatio:"DC-to-AC Size Ratio",DcToAcSizeRatioExplained:"The ratio of the solar panels' DC-rated size to the inverter's AC-rated size.",ChangePvModel:"Change PV Model",Orientation:"Orientation",Portrait:"Portrait",Landscape:"Landscape",FrameColor:"Frame Color",Panels:"panels",PanelsWide:"panels wide",PanelsLong:"panels long",TiltAngle:"Tilt Angle",SouthFacingIsPositive:"South facing is positive",Tracker:"Tracker",SolarTrackerFollowsSun:"A tracker follows the sun to increase solar panel outputs.",PoleSpacing:"Pole Spacing",NoTracker:"No Tracker",HorizontalSingleAxisTracker:"Horizontal Single Axis Tracker",VerticalSingleAxisTracker:"Vertical Single Axis Tracker",AltazimuthDualAxisTracker:"Altazimuth Dual Axis Tracker",OnlyThisSolarPanel:"Only This Solar Panel",AllSolarPanelsOnSurface:"All Solar Panels on the Same Surface",AllSolarPanelsAboveFoundation:"All Solar Panels Above the Same Foundation",AllSelectedSolarPanels:"All Selected Solar Panels",AllSolarPanels:"All Solar Panels"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"Only This Solar Water Heater",AllSolarWaterHeatersOnSurface:"All Solar Water Heaters on the Same Surface",AllSolarWaterHeatersAboveFoundation:"All Solar Water Heaters Above the Same Foundation",AllSelectedSolarWaterHeaters:"All Selected Solar Water Heaters",AllSolarWaterHeaters:"All Solar Water Heaters"},pvModelPanel:{SolarPanelSpecs:"Solar Panel Specs",General:"General",Electrical:"Electrical",CellCountInXDirection:"Cell Count in X Direction",CellCountInYDirection:"Cell Count in Y Direction",Weight:"Weight",Kilogram:"kg",RatedVoltage:"Rated Voltage",RatedCurrent:"Rated Current",OpenCircuitVoltage:"Open-Circuit Voltage",ShortCircuitCurrent:"Short-Circuit Current",MaximumRatedPower:"Maximum Rated Power",Model:"Model",PanelSize:"Panel Size",Cells:"Cells",CellType:"Cell Type",Monocrystalline:"Monocrystalline",Polycrystalline:"Polycrystalline",ThinFilm:"Thin Film",Bifacial:"Bifacial",PowerBifaciality:"Power Bifaciality (Rear/Front)",Black:"Black",Blue:"Blue",ShadeTolerance:"Shade Tolerance",SolarCellEfficiency:"Solar Cell Efficiency",NominalOperatingCellTemperature:"Nominal Operating Cell Temperature",TemperatureCoefficientOfPmax:"Temperature Coefficient of Pmax",AddedCustomSolarPanels:"Added",DisplayThisCustomSolarPanel:"Display this custom solar panel",ExportThisCustomSolarPanel:"Export this custom solar panel",ImportCustomSolarPanelFromClipboard:"Import custom solar panel from clipboard",CustomSolarPanelExportedToClipboard:"Custom solar panel exported to Clipboard",DoYouReallyWantToRemoveThisCustomSolarPanel:"Do you really want to remove this custom solar panel",MakeSureThisCustomSolarPanelIsNotUsed:"Make sure this custom solar panel is not used in the current model",ThisCustomSolarPanelIsUsed:"This custom solar panel is used in the current model",DoYouReallyWantToImportCustomSolarPanel:"Do you really want to import a custom solar panel",ExistingSettingsWillBeOverwritten:"The existing settings will be overwritten",CannotAddCustomSolarPanel:"Cannot add custom solar panel",CustomSolarPanelMustHaveModelName:"A custom solar panel must have a model name",CustomSolarPanelExists:"A custom solar panel with this name already exists",FailInImportingDataFromClipboard:"Failed in importing data from the clipboard",NoNeedToAddThisCustomSolarPanel:"No Need to Add This",SolarPanelModelAlreadyProvidedBySystem:"This solar panel model is already provided by the system"},parabolicTroughMenu:{ModuleLength:"Module Length",Modules:"modules",ModulesLong:"modules long",LatusRectum:"Latus Rectum",OnlyThisParabolicTrough:"Only This Parabolic Trough",AllParabolicTroughsAboveFoundation:"All Parabolic Troughs Above the Same Foundation",AllSelectedParabolicTroughs:"All Selected Parabolic Troughs",AllParabolicTroughs:"All Parabolic Troughs"},fresnelReflectorMenu:{AbsorberPipe:"Absorber Pipe",SelectAbsorberToReflectSunlightTo:"Select Absorber to Reflect Sunlight to",ModuleLength:"Module Length",Modules:"modules",ModulesLong:"modules long",OnlyThisFresnelReflector:"Only This Fresnel Reflector",AllFresnelReflectorsAboveFoundation:"All Fresnel Reflectors Above the Same Foundation",AllSelectedFresnelReflectors:"All Selected Fresnel Reflectors",AllFresnelReflectors:"All Fresnel Reflectors"},heliostatMenu:{Tower:"Tower",SelectTowerToReflectSunlightTo:"Select Tower to Reflect Sunlight to",OnlyThisHeliostat:"Only This Heliostat",AllHeliostatsAboveFoundation:"All Heliostats Above the Same Foundation",AllSelectedHeliostats:"All Selected Heliostats",AllHeliostats:"All Heliostats"},parabolicDishMenu:{ReceiverStructure:"Receiver Structure",CentralPole:"Central Pole",CentralPoleWithTripod:"Central Pole with Tripod",Quadrupod:"Quadrupod",RimDiameter:"Rim Diameter",LatusRectum:"Latus Rectum",ExtraPoleHeightInAdditionToRadius:"Extra Pole Height in Addition to Radius",OnlyThisParabolicDish:"Only This Parabolic Dish",AllParabolicDishesAboveFoundation:"All Parabolic Dishes Above the Same Foundation",AllSelectedParabolicDishes:"All Selected Parabolic Dishes",AllParabolicDishes:"All Parabolic Dishes"},windTurbineMenu:{BirdSafeDesign:"Bird-Safe Design",BirdSafeNone:"None",BirdSafeBicolor:"Bicolor",BirdSafeStriped:"Striped",Rotor:"Rotor",BladeNumber:"Blade Number",RotorInitialAngle:"Rotor Initial Angle",RotorBladeDesign:"Rotor Blade Design",RotorBladeRadius:"Rotor Blade Radius",RotorBladePitchAngle:"Rotor Blade Pitch Angle",RelativeYawAngle:"Relative Yaw Angle",MaximumChordLength:"Maximum Chord Length",Tower:"Tower",TowerHeight:"Tower Height",TowerRadius:"Tower Radius",HubDesign:"Hub Design",HubRadius:"Hub Radius",HubLength:"Hub Length",OnlyThisWindTurbine:"Only This Wind Turbine",AllWindTurbinesAboveFoundation:"All Wind Turbines Above the Same Foundation",AllSelectedWindTurbines:"All Selected Wind Turbines",AllWindTurbines:"All Wind Turbines"},wallMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",SizeOfWall:"Size of Wall",OnlyThisWall:"Only This Wall",AllConnectedWalls:"All Connected Walls",AllWallsAboveFoundation:"All Walls Above the Same Foundation",AllSelectedWalls:"All Selected Walls",AllWalls:"All Walls",Windows:"Windows",LockAllUnlockedWindows:"Lock All Unlocked Windows",UnlockAllLockedWindows:"Unlock All Locked Windows",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",DoYouReallyWantToRemoveAllWindowsOnThisWall:"Do you really want to remove all the windows on this wall",Doors:"Doors",LockAllUnlockedDoors:"Lock All Unlocked Doors",UnlockAllLockedDoors:"Unlock All Locked Doors",RemoveAllUnlockedDoors:"Remove All Unlocked Doors",DoYouReallyWantToRemoveAllDoorsOnThisWall:"Do you really want to remove all the doors on this wall",SolarPanels:"Solar Panels",LockAllUnlockedSolarPanels:"Lock All Unlocked Solar Panels",UnlockAllLockedSolarPanels:"Unlock All Locked Solar Panels",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"Do you really want to remove all the solar panels on this wall",Sensors:"Sensors",LockAllUnlockedSensors:"Lock All Unlocked Sensors",UnlockAllLockedSensors:"Unlock All Locked Sensors",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",DoYouReallyWantToRemoveAllSensorsOnThisWall:"Do you really want to remove all the sensors on this wall",Lights:"Lights",LockAllUnlockedLights:"Lock All Unlocked Lights",UnlockAllLockedLights:"Unlock All Locked Lights",RemoveAllUnlockedLights:"Remove All Unlocked Lights",DoYouReallyWantToRemoveAllLightsOnThisWall:"Do you really want to remove all the lights on this wall",Polygons:"Polygons",LockAllUnlockedPolygons:"Lock All Unlocked Polygons",UnlockAllLockedPolygons:"Unlock All Locked Polygons",RemoveAllUnlockedPolygons:"Remove All Unlocked Polygons",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"Do you really want to remove all the polygons on this wall",WallStructure:"Wall Structure",DefaultStructure:"Default",StudStructure:"Stud",PillarStructure:"Pillar",Opacity:"Opacity",StructureSpacing:"Structure Spacing",StructureWidth:"Structure Width",StructureThickness:"Structure Thickness",StructureColor:"Structure Color",Color:"Wall Color",Height:"Height",Thickness:"Thickness",Texture:"Texture",AllLightsOnWallInside:"All Lights on Wall Inside",AllLightsOnWallOutside:"All Lights on Wall Outside",Fill:"Fill",Full:"Full",Partial:"Partial",Empty:"Empty",OpenToOutside:"Open to Outside",EavesLength:"Eaves Overhang Length",Parapet:"Parapet",ParapetColor:"Parapet Color",ParapetTexture:"Parapet Texture",ParapetHeight:"Parapet Height",CopingsHeight:"Copings Height",CopingsWidth:"Copings Width"},windowMenu:{OnlyThisWindow:"Only This Window",AllWindowsOnSurface:"All Windows on the Same Surface",AllWindowsAboveFoundation:"All Windows Above the Same Foundation",AllSelectedWindows:"All Selected Windows",AllWindows:"All Windows",Width:"Width",Height:"Height",Setback:"Setback from Exterior Surface",RelativeToWallThickness:"Relative to wall thickness",Mullion:"Mullion",HorizontalMullion:"Horizontal Mullion",VerticalMullion:"Vertical Mullion",MullionWidth:"Mullion Width",HorizontalMullionSpacing:"Horizontal Mullion Spacing",VerticalMullionSpacing:"Vertical Mullion Spacing",MullionColor:"Mullion Color",Tint:"Tint",Opacity:"Opacity",SolarHeatGainCoefficient:"Solar heat gain coefficient (SHGC) = 1 - opacity",Shutter:"Shutter",LeftShutter:"Left Shutter",RightShutter:"Right Shutter",BothShutters:"Both Shutters",ShutterWidth:"Relative Width",ShutterColor:"Shutter Color",Frame:"Frame",FrameWidth:"Frame Width",SillWidth:"Sill Width",Color:"Frame Color",WindowType:"Window Type",Default:"Default",Arched:"Arched",Polygonal:"Polygonal",Interior:"Interior",Empty:"Empty"},roofMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",OnlyThisRoof:"Only This Roof",AllRoofsAboveFoundation:"All Roofs Above the Same Foundation",AllSelectedRoofs:"All Selected Roofs",AllRoofs:"All Roofs",OnlyThisCeiling:"Only This Ceiling",AllCeilingsAboveFoundation:"All Ceilings Above the Same Foundation",AllCeilings:"All Ceilings",EavesOverhangLength:"Eaves Overhang Length",RafterSpacing:"Rafter Spacing",RafterWidth:"Rafter Width",RafterThickness:"Rafter Thickness",RafterColor:"Rafter Color",RoofColor:"Roof Color",RoofSideColor:"Roof Side Color",GlassTint:"Glass Tint",Opacity:"Opacity",RoofStructure:"Roof Structure",DefaultStructure:"Default",RafterStructure:"Rafter",GlassStructure:"Glass",SolarPanels:"Solar Panels",LockAllUnlockedSolarPanels:"Lock All Unlocked Solar Panels",UnlockAllLockedSolarPanels:"Unlock All Locked Solar Panels",RemoveAllUnlockedSolarPanels:"Remove All Unlocked Solar Panels",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"Do you really want to remove all the solar panels on this roof",Windows:"Windows",LockAllUnlockedWindows:"Lock All Unlocked Windows",UnlockAllLockedWindows:"Unlock All Locked Windows",RemoveAllUnlockedWindows:"Remove All Unlocked Windows",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"Do you really want to remove all the windows on this roof",Sensors:"Sensors",LockAllUnlockedSensors:"Lock All Unlocked Sensors",UnlockAllLockedSensors:"Unlock All Locked Sensors",RemoveAllUnlockedSensors:"Remove All Unlocked Sensors",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"Do you really want to remove all the sensors on this roof",Lights:"Lights",RemoveAllUnlockedLights:"Remove All Unlocked Lights",DoYouReallyWantToRemoveAllLightsOnThisRoof:"Do you really want to remove all the lights on this roof",AllLightsOnRoofInside:"All Lights on Roof Inside",AllLightsOnRoofOutside:"All Lights on Roof Outside",Rise:"Rise",Ceiling:"Ceiling",RoofRValue:"Roof R-Value",CeilingRValue:"Ceiling R-Value"},doorMenu:{TextureDefault:"Default",Texture01:"Texture 1",Texture02:"Texture 2",Texture03:"Texture 3",Texture04:"Texture 4",Texture05:"Texture 5",Texture06:"Texture 6",Texture07:"Texture 7",Texture08:"Texture 8",Texture09:"Texture 9",Texture10:"Texture 10",Texture11:"Texture 11",Texture12:"Texture 12",Texture13:"Texture 13",Texture14:"Texture 14",Texture15:"Texture 15",Texture16:"Texture 16",Texture17:"Texture 17",OnlyThisDoor:"Only This Door",AllDoorsOnWall:"All Doors on the Same Wall",AllDoorsAboveFoundation:"All Doors Above the Same Foundation",AllSelectedDoors:"All Selected Doors",AllDoors:"All Doors",DoorType:"Door Type",Default:"Default",Arched:"Arched",Filled:"Filled",FrameColor:"Frame Color",Interior:"Interior"},siteInfoPanel:{High:"High",Low:"Low"},designInfoPanel:{NumberOfSelectedHeliostats:"Number of selected heliostats",NumberOfSelectedSolarPanels:"Number of selected solar panels",ElectricityGeneratedDailyBySolarPanels:"Electricity generated daily by these solar panels",SceneDiameter:"Scene diameter",BuildingArea:"Building area"},visualizationControlPanel:{ColorContrast:"Color Contrast",FluxScale:"Flux Scale",ClickUpOrDownArrowButtonsToChange:"Click up or down arrow buttons to change"},instructionPanel:{Rotate:"Rotate",DragMouse:"Drag mouse",Zoom:"Zoom",MouseWheelOrKeys:"Rotate mouse wheel or press Ctrl+[ or Ctrl+]",MouseWheelOrKeysMac:"Rotate mouse wheel or press ⌘+[ or ⌘+]",Pan:"Pan",HoldCtrlDragMouse:"Hold Ctrl and drag mouse",HoldMetaDragMouse:"Hold ⌘ and drag mouse",Enter2DMode:"Enter 2D mode",Exit2DMode:"Exit 2D mode",NavigationMode:"Navigation mode",EnableNavigation:"Enable navigation",DisableNavigation:"Disable navigation",MoveForwardBack:"Move forward/back",MoveForwardBackInstruction:"Press W/S",MoveLeftRight:"Move left/right",MoveLeftRightInstruction:"Press A/D",MoveUpDown:"Move up/down",MoveUpDownInstruction:"Press Z/X",Turn:"Turn",TurnInstruction:"Press arrow keys",ResetView:"Reset",AutoRotate:"Auto rotate",StartOrStop:"Press F4 to start or stop"},mapPanel:{ImageOnGround:"Image on Ground",HideAddress:"Hide Address",WeatherStations:"Weather Stations",WeatherStationsNote:"Turn this off to speed up",Coordinates:"Coordinates",Zoom:"Zoom"},visibilityPanel:{SolarPanelVisibility:"Solar Panel Visibility",Observer:"Observer",VantagePoint:"Vantage Point",ItemizedVisibilityByFields:"Itemized by Fields",TotalVisibility:"Total"},sensorPanel:{LightSensor:"Light Sensor",WeatherDataFrom:"Weather Data from"},buildingEnergyPanel:{DailyBuildingEnergy:"Daily Building Energy",YearlyBuildingEnergy:"Yearly Building Energy",Heater:"Heater",AC:"AC",SolarPanel:"Solar Panel",Net:"Net"},solarPanelYieldPanel:{SolarPanelDailyYield:"Solar Panel Daily Yield",SolarPanelYearlyYield:"Solar Panel Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualSolarPanels:"Show outputs of individual solar panels",Profit:"Profit",TotalCost:"Total Cost",TotalRevenue:"Total Revenue",TotalYield:"Total Yield",MeanYield:"Mean Yield",ModuleCount:"Module Count"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"Parabolic Trough Daily Yield",ParabolicTroughYearlyYield:"Parabolic Trough Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualParabolicTroughs:"Show outputs of individual parabolic troughs"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"Parabolic Dish Daily Yield",ParabolicDishYearlyYield:"Parabolic Dish Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualParabolicDishes:"Show outputs of individual parabolic dishes"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"Fresnel Reflector Daily Yield",FresnelReflectorYearlyYield:"Fresnel Reflector Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualFresnelReflectors:"Show outputs of individual Fresnel feflectors"},heliostatYieldPanel:{HeliostatDailyYield:"Heliostat Daily Yield",HeliostatYearlyYield:"Heliostat Yearly Yield",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualHeliostats:"Show outputs of individual heliostats"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"Solar Updraft Tower Daily Yield",UpdraftTowerYearlyYield:"Solar Updraft Tower Yearly Yield",ChimneyAirTemperature:"Chimney Air Temperature",ChimneyWindSpeed:"Chimney Wind Speed",Yield:"Yield",YieldPerHour:"Yield per Hour",DailyTotal:"Daily Total",YearlyTotal:"Yearly Total",ShowOutputsOfIndividualUpdraftTowers:"Show outputs of individual updraft towers"},heliodonPanel:{SunAndTimeSettings:"Sun & Time Settings",SunAngles:"Angles",TwentyFourHours:"24 Hours"},cloudFilePanel:{CopyTitle:"Copy Title",TitleCopiedToClipBoard:"The title was copied to the clip board",SearchByTitle:"Search by title",MyLikes:"My Likes",MyCloudFiles:"My Cloud Files",GenerateLink:"Generate Link",LinkGeneratedInClipBoard:"A link was generated in the clip board",DoYouReallyWantToDelete:"Do you really want to delete",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"If this file has been shared or published, renaming it breaks existing links"},projectListPanel:{CopyTitle:"Copy Title",TitleCopiedToClipBoard:"The title was copied to the clip board",SearchByTitle:"Search by title",MyProjects:"My Projects",GenerateProjectLink:"Generate Project Link",ProjectLinkGeneratedInClipBoard:"A link to the project was generated in the clip board",DoYouReallyWantToDeleteProject:"Do you really want to delete Project",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"If this project has been shared or published, renaming it breaks existing links"},projectPanel:{ProjectSettings:"Project Settings",ThumbnailImageSize:"Thumbnail Image Size",ProjectByOtherPeople:"Project by Other People",Project:"Project",ProjectType:"Type",ProjectDescription:"Description",MakeDescriptionEditable:"Make this description editable",MakeDescriptionNonEditable:"Make this description non-editable",DoubleClickToMakeDescriptionEditable:"Double-click to make this description editable",SolarPanelArray:"Solar Panel Array",CurateCurrentDesign:"Curate current design",UpdateSelectedDesign:"Update selected design",RemoveSelectedDesign:"Remove selected design",ClickToFlipSortingOrder:"Click to flip the sorting order",DesignNotShownInSolutionSpaceClickToShow:"This design is not shown in solution space; click to show",DesignShownInSolutionSpaceClickToHide:"This design is shown in solution space; click to hide",SolutionSpace:"Solution Space",ChooseSolutionSpace:"Choose solution space",ChooseDataColoring:"Choose data coloring",SameColorForAllDesigns:"Same color for all designs",OneColorForEachDesign:"One color for each design",SolutionSpaceScreenshot:"Take a screenshot of the solution space",ScatterPlotScreenshot:"Take a screenshot of the scatter plot",SingleClickToSelectDoubleClickToOpen:"Single-click to select, double-click to open.",SingleClickToDeselectDoubleClickToOpen:"Single-click to deselect, double-click to open.",GenerateScatterPlot:"Generate Scatter Plot",SelectXAxis:"Select X Axis",SelectYAxis:"Select Y Axis"},accountSettingsPanel:{MyAccountSettings:"My Account Settings",MyID:"My 🆔",ClickToCopyMyID:"Click to copy my ID",IDInClipBoard:"Your ID was copied and is ready to paste.",StoreMyNameInMyFilesWhenSaving:"Store my name in my files when saving",DoYouReallyWantToShowYourNameInYourFiles:"Do you really want to show your display name in your files?",SignFileDisclaimer:"If yes, your display name may be seen by anyone who can access your files.",Likes:"Likes",AllPublished:"All Published",PublishedUnderAliases:"Aliases",UserCount:"User Count",SchoolID:"School ID",ClassID:"Class ID"},weatherPanel:{SunshineHours:"Sunshine"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"Select Air Temperature Model",Sinusoidal:"Sinusoidal"},economicsPanel:{EconomicsParameters:"Economics Parameters",ElectricitySellingPrice:"Electricity Selling Price",OperationalCostPerUnit:"Operational Cost per Unit",SellingPrice:"Selling Price",UnitCost:"Unit Cost"},navigationPanel:{NavigationParameters:"Navigation Parameters",MinimumMoveSpeed:"Minimum Move Speed",MinimumTurnSpeed:"Minimum Turn Speed"},shadowSettingsPanel:{ShadowSettings:"Shadow Settings",ShadowCameraFarDistance:"Shadow Camera Far Distance",ShadowMapSize:"Shadow Map Size",Notes:"Notes",RefreshPageNote:"Refresh the page for the new settings to take effect.",MapSizeWarning:"A large shadow map size may cause Aladdin to crash on some computers."},yearlyLightSensorPanel:{SkyClearness:"Clearness",ShowDaylightResults:"Show daylight results",ShowSkyClearnessResults:"Show sky clearness results",ShowAverageDailySolarRadiation:"Show average daily solar radiation"},analysisManager:{NoSensorForCollectingData:"There is no sensor for collecting data.",NoSolarPanelForAnalysis:"There is no solar panel for analysis.",NoObserverForVisibilityAnalysis:"There is no observer for visibility analysis.",NoSolarWaterHeaterForAnalysis:"There is no solar water heater for analysis.",NoParabolicDishForAnalysis:"There is no parabolic dish for analysis.",NoParabolicTroughForAnalysis:"There is no parabolic trough for analysis.",NoFresnelReflectorForAnalysis:"There is no Fresnel reflector for analysis.",NoHeliostatForAnalysis:"There is no heliostat for analysis.",NoSolarUpdraftTowerForAnalysis:"There is no solar updraft tower for analysis.",NoBuildingForAnalysis:"There is no building for analysis."},toolbar:{CloudFile:"Cloud file",Select:"Select",AddFoundation:"Add Foundation",AddWall:"Add Wall",AddWindow:"Add Window",AddDoor:"Add Door",AddPyramidRoof:"Add Pyramid Roof",AddGableRoof:"Add Gable Roof",AddHipRoof:"Add Hip Roof",AddGambrelRoof:"Add Gambrel Roof",AddMansardRoof:"Add Mansard Roof",AddCuboid:"Add Cuboid",AddSensor:"Add Sensor",AddSolarPanel:"Add Solar Panel",AddSolarWaterHeater:"Add Solar Water Heater",AddBatteryStorage:"Add Battery Storage",AddParabolicDish:"Add Parabolic Dish",AddParabolicTrough:"Add Parabolic Trough",AddFresnelReflector:"Add Fresnel Reflector",AddHeliostat:"Add Heliostat",AddWindTurbine:"Add Horizontal Axis Wind Turbine",AddVerticalAxisWindTurbine:"Add Vertical Axis Wind Turbine",AddLight:"Add Light",AddTree:"Add Tree",AddFlower:"Add Flower",AddPeople:"Add People",DoubleClickToLockThisModeForNextAction:"Double-click to lock this mode for next action",ClickToUnlockThisModeForNextAction:"Click to unlock this mode for next action",ManipulateGroup:"Manipulate a group",ClearScene:"Clear scene",ShowSunAndTimeSettings:"Show sun and time settings",SpatialAnalysisOfEnergy:"Spatial analysis of energy",DoYouReallyWantToClearContent:"Do you really want to clear the content",ClickForMoreButtons:"Click for more buttons"},tooltip:{gotoIFI:"Go to Institute for Future Intelligence",visitAladdinHomePage:"Visit Aladdin Homepage",clickToOpenMenu:"Click to open main menu",clickToAccessAccountSettings:"Click to access account settings"},tree:{Apple:"Apple",Birch:"Birch",Coconut:"Coconut",Dogwood:"Dogwood",Elm:"Elm",FanPalm:"Fan Palm",Linden:"Linden",Magnolia:"Magnolia",Maple:"Maple",Oak:"Oak",Pine:"Pine",Spruce:"Spruce"},flower:{Bellflower:"Bellflower",Boxwood:"Boxwood",CactusCombo1:"Cactus Combo 1",CactusCombo2:"Cactus Combo 2",CactusCombo3:"Cactus Combo 3",CactusCombo4:"Cactus Combo 4",Hibiscus:"Hibiscus",Hosta:"Hosta",Hydrangea:"Hydrangea",Peony:"Peony",RedRose:"Red Rose",Spirea:"Spirea",Sunflower:"Sunflower",TallBush:"Tall Bush",Tulip:"Tulip",WhiteFlower:"White Flower",YellowFlower:"Yellow Flower"},people:{Jaah:"Jaah",Jack:"Jack",Jacob:"Jacob",Jacqueline:"Jacqueline",Jade:"Jade",Jamelia:"Jamelia",James:"James",Jane:"Jane",Jaya:"Jaya",Jaye:"Jaye",Jeanette:"Jeanette",Jedi:"Jedi",Jeff:"Jeff",Jena:"Jena",Jennifer:"Jennifer",Jess:"Jess",Jett:"Jett",Jill:"Jill",Jiya:"Jiya",Joan:"Joan",Jocelyn:"Jocelyn",Joel:"Joel",Joey:"Joey",John:"John",Jonathon:"Jonathon",Jose:"Jose",Joseph:"Joseph",Joshua:"Joshua",Judd:"Judd",Judy:"Judy",Julia:"Julia",Julio:"Julio",Jumapili:"Jumapili",June:"June",Juro:"Juro",Justin:"Justin"},compass:{N:"N",S:"S",W:"W",E:"E"},month:{January:"Jan",February:"Feb",March:"Mar",April:"Apr",May:"May",June:"Jun",July:"Jul",August:"Aug",September:"Sep",October:"Oct",November:"Nov",December:"Dec"},modelsMap:{AllTime:"All Time",SearchByPublisher:"Search by publisher",SearchByLabel:"Search by label",MyPublishedModels:"My Published Models",TotalNumberOfUserPublishedModelsInSelectedPeriod:"Total number of user-published models in the selected period",AllTimeTotal:"All-time total",SortFromOldestToNewest:"Sort from oldest to newest",SortFromNewestToOldest:"Sort from newest to oldest",SitesFound:"sites found",ModelsFoundOnThisSite:"models found on this site",ShowModelsPublishedByThisAuthor:"Show the models published by this author"}}},hpt={translation:{name:{IFI:"未来智能研究所",Aladdin:"阿拉丁",Tagline:"阿拉丁: 探索人工智能时代的设计软件 — 未来智能研究所研发"},cookie:{Statement:"声明:为了改善您的用户体验,阿拉丁采用cookie储存少量数据。",Accept:"同意"},aboutUs:{ProductBroughtToYouBy:"未来智能研究所荣誉出品",TermsOfService:"服务条款",PrivacyPolicy:"隐私政策",Software:"软件",Content:"课件",Research:"研究",Support:"服务",Acknowledgment:"鸣谢",FundingInformation:"本产品的研发承蒙美国国家科学基金会慷慨资助(项目号#2105695,#2131097,#2301164)。本产品的任何观点或结论仅代表创作者个人意见。",Contact:"如您需要更多信息,请联系 Charles Xie (charles@intofuture.org)。我们会尽快回复。",Translators:"翻译"},word:{BrandName:"品牌",Name:"名字",Refresh:"刷新",LastUpdate:"上一次更新",Small:"小",Medium:"中",Large:"大",Design:"设计",Information:"信息",Type:"类别",Text:"文字",FontSize:"字体大小",FontColor:"字体颜色",Model:"模型",Models:"模型",Upload:"上传",ClickCount:"点击数",Share:"分享",AlreadyLike:"已点赞",Like:"点赞",MustLogInToLike:"必须登录才能点赞",AllRightsReserved:"版权所有",MeterAbbreviation:"米",VoltAbbreviation:"伏",AmpereAbbreviation:"安",WattAbbreviation:"瓦",Version:"版本",VersionInitial:"版本",Options:"选项",Maximum:"最大",Minimum:"最小",MaximumNumber:"最多",MinimumNumber:"最少",MaximumValue:"最大值",MinimumValue:"最小值",Or:"或",None:"无",High:"高",Partial:"部分",Teacher:"老师",Class:"班级",Total:"总数",Leaderboard:"用戶排行榜",Latest:"最新",Range:"范围",SIUnit:"国际单位制",USUnit:"美国单位制",ThermalTransmittance:"热透过率",ThermalResistance:"热阻",UValue:"U值",RValue:"R值",VolumetricHeatCapacity:"容积热容",BuildingHVACSystem:"建筑物暖通空调系统",ThermostatSetpoint:"恒温器设定值",TemperatureToleranceThreshold:"温度忍耐阈值",TemperatureToleranceThresholdExplanation:`当日最低外面温度高于恒温器设定值减去此阈值,暖气不开。 当日最高外面温度低于恒温器设定值加上此阈值,空调不开。`,Press:"按",Open:"打开",Save:"保存",SaveAsImage:"保存为图像",SaveAsCsv:"保存为CSV",Update:"刷新",Paste:"粘贴",Copy:"复制",Cut:"剪切",Delete:"删除",Add:"添加",Lock:"固定",Translucent:"半透明",Transparency:"透明度",Color:"颜色",Pattern:"图案",Texture:"材质",Thickness:"厚度",Size:"尺寸",Yes:"是",No:"不",OK:"确定",Cancel:"取消",Apply:"应用",Close:"关闭",ApplyTo:"适用于",Run:"运行",Pause:"暂停",Resume:"继续",Clear:"清空",Warning:"警告",Caution:"小心",Reminder:"提醒",Length:"长度",Width:"宽度",Height:"高度",Radius:"半径",Angle:"角度",Azimuth:"方位角",Coordinates:"坐标",Weather:"天气",Show:"显示",Animate:"动画",Date:"日期",Time:"时间",Title:"标题",Owner:"所有者",Action:"操作",Rename:"改名",Location:"位置",Latitude:"纬度",Month:"月份",Day:"天",Hour:"小时",Daylight:"白天长度",Radiation:"辐射",Temperature:"温度",kWh:"千瓦时",dollar:"元",MeterPerSecond:"米/秒",NorthInitial:"北",SouthInitial:"南",EastInitial:"东",WestInitial:"西",Fixed:"固定",Elements:"部件",Energy:"能量",Unknown:"未知",Label:"标签",Description:"描述",NoDescription:"无描述",MaximumCharacters:"最多字符数",Author:"作者",Publisher:"发布者",Building:"建筑",ResidentialBuilding:"住宅建筑",CommercialBuilding:"商用建筑",SchoolBuilding:"学校建筑",TouristAttraction:"旅游景点",UnderConstruction:"在建",Photovoltaic:"光伏",WindPower:"风能",ColocationProjects:"共用空间项目",Anonymous:"无名氏",Nickname:"别名",Pin:"置顶",Unpin:"解除置顶"},shared:{NoTexture:"无材质",FoundationElement:"地基",CuboidElement:"长方体",PolygonElement:"多边形",SensorElement:"传感器",SolarPanelElement:"光伏板",SolarWaterHeaterElement:"太阳能热水器",ParabolicDishElement:"抛物线碟",ParabolicTroughElement:"抛物线槽",FresnelReflectorElement:"菲涅耳反射镜",HeliostatElement:"定日镜",WindTurbineElement:"风力涡轮机",LightElement:"电灯",ElementLocked:"固定",ModelType:"模型类别",OutputBreakdown:"分列发电量",MoreResults:"更多结果"},message:{NewVersionAvailable:"有新版本",CalculationMayBeSlowDoYouWantToContinue:"计算可能会很慢。您想继续吗?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"加大太阳辐射热图网格的尺寸可加速",ModelNotFound:"没有找到模型",CannotSignIn:"登录失败",CannotSignOut:"退出失败",YourAccountWasCreated:"成功建立您的账号。",CannotCreateAccount:"无法创建账号",YourAccountSettingsWereSaved:"您的账号设定已保存。",CannotSaveYourAccountSettings:"您的账号设定无法保存",CannotSaveYourFileToCloud:"无法保存您的文件到云端",CannotCreateNewProject:"无法创建新项目",CannotCreateNewProjectWithoutTitle:"没有标题, 无法创建新项目",CannotOpenYourProjects:"无法打开您的项目列表",CannotOpenProject:"无法打开项目",CannotDeleteProject:"无法删除项目",CannotRenameProject:"无法给项目改名",CannotAddDesignToProject:"无法把此设计加到项目里",CannotAddDesignToProjectOwnedByOthers:"不能把此设计加到别人的项目里",DesignRemovedFromProject:"设计被成功地从项目里删除",CannotRemoveDesignFromProject:"无法把此设计从项目里删除",CannotUpdateProject:"无法更新项目",CannotFetchProjectData:"无法取得项目数据",TitleUsedChooseDifferentOne:"此标题已经被使用, 请采用不同的标题",CloudFileWithTitleExistsDoYouWantToOverwrite:"使用此标题的云文件已经存在,您确定要覆盖它吗?",CloudFileNotFound:"找不到此云端文件",CannotLoadModelsOnMap:"无法下载地图上的模型",CannotLoadLeaderboard:"无法下载排行榜",CannotPublishModelOnMap:"模型无法发布到地图上",CannotLikeModelFromMap:"无法点赞地图上的模型",CannotDeleteModelFromMap:"无法删除地图上的模型",ModelDeletedFromMap:"模型已从地图上删除",DoYouWantToDeleteModelFromMap:"您要删除地图上的这个模型吗?",CannotOpenCloudFile:"此云端文件无法打开",CannotReadCloudFile:"无法读取此云端文件",CannotWriteCloudFile:"无法存储此云端文件",CloudFileCopied:"拷贝云端文件",CannotOpenCloudFolder:"您的云端文件夹无法打开",CannotDeleteCloudFile:"无法删除此云端文件",CannotRenameCloudFile:"此云端文件的名字无法更改",DoYouWantToSaveChanges:"您要保存当前文件吗?",NotApplicableToSelectedAction:"此值不适用于当前选择范围",ThisElementIsLocked:"这个部件被锁定。",ThisCannotBeUndone:"这个操作一旦执行就不能撤销。",AzimuthOfNorthIsZero:"正北的方位角为零度",CounterclockwiseAzimuthIsPositive:"逆时针为正",SouthFacingIsZero:"朝南为零度",ClockwiseRotationIsPositive:"顺时针为正",MoveCancelledBecauseOfOverlap:"位置重叠,移动取消。",MoveOutsideBoundaryCancelled:"位置出界,移动取消。",RotationCancelledBecauseOfOverlap:"位置重叠,旋转取消。",RotationOutsideBoundaryCancelled:"位置出界,旋转取消。",ResizingCancelledBecauseOfOverlap:"位置重叠,尺寸调整取消。",ResizingOutsideBoundaryCancelled:"位置出界,尺寸调整取消。",CannotPasteOutsideBoundary:"位置出界,不能复制。",CannotPasteBecauseOfOverlap:"位置重叠,不能复制。",CannotMoveObjectTooFar:"位置太远,移动取消。",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"采用新布局之前必须移除现有的光伏板。",DoYouWantToContinue:"您想继续吗?",SolarPanelsCannotIntersectWithGround:"光伏板不能和地面接触。",SolarPanelsCannotOverlapWithOneAnother:"光伏板不能重叠。",ScreenshotSaved:"截屏图片保存在下载文件夹里。",CsvFileSaved:"CSV保存在下载文件夹里。",SimulationStarted:"模拟开始。",SimulationCompleted:"模拟结束。",SimulationAborted:"模拟取消。",SimulationPaused:"模拟暂停。",CancelSimulation:"取消模拟",PauseSimulation:"暂停模拟",ResumeSimulation:"继续模拟",SimulationWillNotStartDueToErrors:"由于错误模拟无法运行",SimulationWillStartDespiteWarnings:"发现问题,但模拟仍然将运行。",EvolutionStarted:"演化开始。",EvolutionCompleted:"演化结束。",EvolutionAborted:"演化取消。",EvolutionPaused:"演化暂停。",EncounterEvolutionError:"演化出错。",CancelEvolution:"取消演化",PauseEvolution:"暂停演化",ResumeEvolution:"继续演化",ConvergenceThresholdHasBeenReached:"收敛阈值已达到。",MaximumNumberOfGenerationsHasBeenReached:"最大世代数已达到。",MaximumNumberOfStepsHasBeenReached:"最大步数已达到。",ObjectiveFunctionTypeError:"此操作不支持当前的目标函数。请从菜单启动此功能。",WallsAreNotAtSameHeight:"墙体高度不同。",WallsAreNotPerpendicular:"墙体不垂直。",WallsAreNotConnected:"墙体不相连。",WallsNumberNeedToBeFour:"墙体数量必须为四个。",BuildingContainsEmptyWall:"建筑物有空墙。",BuildingRoofMissing:"建筑物没有屋顶。",UnknownErrors:"未知错误。",SigningOutAnonymousAccount:"你确定退出吗?一旦退出,此匿名账号将不可恢复。"},menu:{AnalysisOptions:"分析选项",option:{GridCellSize:"计算网格的尺寸",SamplingFrequency:"采样频率",TimesPerHour:"每小时采样次数",DaysPerYear:"每一年采样天数"},mainMenu:"主菜单",cloudMenu:"云菜单",projectSubMenu:"项目",project:{CreateNewProject:"创建新项目",OpenProject:"打开项目",SaveProject:"保存项目",SaveProjectAs:"另存项目为",YouMustLogInToCreateProject:"您必须登录才能创建项目",YouMustLogInToOpenProject:"您必须登录才能打开项目"},fileSubMenu:"文件",file:{CreateNewFile:"创建新文件",OpenLocalFile:"打开本地文件",SaveAsLocalFile:"保存为本地文件",SavingAbortedMustHaveValidFileName:"文件名无效,保存失败",OpenCloudFile:"打开云端文件",SaveCloudFile:"保存云端文件",SaveAsCloudFile:"另存云端文件为",SavingAbortedMustHaveValidTitle:"云端文件名无效,保存失败",ToSaveYourWorkPleaseSignIn:"为了保存您的云端文件,请先登录。",TakeScreenshot:"截屏",UseCloudFileName:"采用云端文件名",PublishOnModelsMap:"发布到地图上",PublishedOnModelsMap:"您的模型成功发布到地图上",UpdatedOnModelsMap:"您的模型更新成功",YouMustLogInToPublishYourModel:"您必须登录才能发布模型",YouCannotPublishAModelThatYouDoNotOwn:"您不能发布他人的模型",YouMustSaveModelOnCloudBeforePublishingIt:"您必须先把此模型保存在云端才能发布它"},editSubMenu:"编辑",edit:{Undo:"撤销",Redo:"重做"},viewSubMenu:"视界",view:{NavigationView:"导航模式",TwoDimensionalView:"二维模式",ResetView:"重置视角",ZoomIn:"放大",ZoomOut:"缩小",AutoRotate:"自动旋转",ShowShadow:"显示阴影",ShowSurfaceShininess:"显示表面光泽",TranslucentFloatingWindows:"透明浮动窗口",accessoriesSubMenu:"配件",accessories:{SiteInformation:"位置信息",DesignInformation:"设计信息",Instruction:"操作说明",StickyNote:"便签",Note:"便签"}},settingsSubMenu:"设置",settings:{WeatherData:"气象数据",DiurnalTemperature:"昼夜温度",Heliodon:"日影仪",SunAndTime:"太阳和时间",CustomSolarPanels:"定制的光伏板",CustomizeSolarPanel:"定制光伏板"},benchmarksSubMenu:"基准",benchmarks:{SolarRadiationPredictionVsMeasurement:"太阳能辐射模型预测和实际测量的对比",BESTESTCase600:"建筑物能耗模拟测试:BESTEST案例600",BESTESTCase610:"建筑物能耗模拟测试:BESTEST案例610",BESTESTCase620:"建筑物能耗模拟测试:BESTEST案例620",BESTESTCase630:"建筑物能耗模拟测试:BESTEST案例630"},graph:{LineWidth:"线条宽度",SymbolSize:"符号大小",BarCategoryGap:"直条间隙",ShowHorizontalGridLines:"显示格子的水平线条",ShowVerticalGridLines:"显示格子的竖直线条"},analysisSubMenu:"分析",physicsSubMenu:"物理",physics:{DailySolarRadiationHeatmap:"当日太阳辐射总量分布热图",SolarRadiationHeatmapOptions:"太阳辐射热图选项",SolarRadiationHeatmapGridCellSize:"太阳辐射热图网格的尺寸",SolarRadiationHeatmapMaxValue:"太阳辐射热图最大值",SolarRadiationHeatmapNoAnimation:"若无移动部件则省略动画",ReflectionHeatmap:"反射热图"},sensorSubMenu:"传感器",sensor:{CollectDailyData:"收集当天数据",CollectYearlyData:"收集全年数据",SensorSimulationNoAnimation:"若无移动部件则省略动画"},buildingSubMenu:"建筑物",building:{AnalyzeDailyBuildingEnergy:"建筑物当天能耗分析",AnalyzeYearlyBuildingEnergy:"建筑物全年能耗分析",EnergyAnalysisOptions:"能耗分析选项",EnergyGridCellSize:"计算网格的尺寸",BuildingEnergySimulationNoAnimation:"若无移动部件则省略动画"},solarPanelSubMenu:"太阳能光伏板",solarPanel:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出",AnalyzeVisibility:"分析可见度",PanelDiscretization:"光伏板离散化方法",Exact:"准确",Approximate:"近似",EnergyGridCellSize:"计算网格的尺寸",VisibilityGridCellSize:"视界因子计算网格的尺寸",EnergyAnalysisOptions:"能量分析选项",VisibilityAnalysisOptions:"可见度分析选项",SolarPanelSimulationNoAnimation:"若无移动部件则省略动画"},parabolicTroughSubMenu:"抛物线槽",parabolicTrough:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},parabolicDishSubMenu:"抛物线碟",parabolicDish:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},fresnelReflectorSubMenu:"菲涅尔反射镜",fresnelReflector:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},heliostatSubMenu:"定日镜",heliostat:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出"},solarUpdraftTowerSubMenu:"太阳能上升气流塔",solarUpdraftTower:{AnalyzeDailyYield:"分析当天产出",AnalyzeYearlyYield:"分析全年产出",SolarUpdraftTowerSimulationNoAnimation:"若无移动部件则省略动画"},tutorialsSubMenu:"教程",solarEnergyScienceSubMenu:"太阳能科学",solarEnergyScienceTutorials:{SunAngles:"太阳相对于地面观察者的角度",InsolationAndClimate:"太阳辐射和气候的关系",SolarRadiationToBox:"一个长方体受到的太阳能辐射分析"},buildingScienceSubMenu:"建筑科学",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"房屋的热学封套和围护封套",EffectOfSizeOnBuildingEnergy:"房屋大小对能耗的影响",EffectOfOrientationOnBuildingEnergy:"房屋方位对能耗的影响",EffectOfInsulationOnBuildingEnergy:"房屋隔热对能耗的影响",EffectOfRoofColorOnBuildingEnergy:"屋顶颜色对建筑物能耗的影响",EffectOfEavesOverhangLengthOnBuildingEnergy:"屋檐延伸长度对建筑物能耗的影响",EffectOfWindowSHGCOnBuildingEnergy:"窗户太阳能输入对房屋能耗的影响",EffectOfThermostatSetpointOnBuildingEnergy:"恒温器设定值对房屋能耗的影响",EffectOfSolarPanelsOnBuildingEnergy:"光伏板对房屋能耗的影响",EffectOfGroundTemperatureOnBuildingEnergy:"地表温度对房屋能耗的影响",EffectOfTreesOnBuildingEnergy:"树荫对房屋能耗的影响"},buildingDesignSubMenu:"建筑设计",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"有棚顶窗的科德角风格的住宅",MansardRoofWithDormers:"有天窗的折线屋顶",GableRoofVsHipRoof:"双坡屋顶和四坡屋顶的对比",ColonialVsSaltbox:"殖民地风格和盐盒风格的对比",GambrelRoofVsMansardRoof:"复斜屋顶和折线屋顶的对比",CombinationRoofVsBonnetRoof:"组合屋顶和帽檐屋顶的对比",DutchGableRoof:"荷兰双坡屋顶",GableAndValleyRoof:"坡谷屋顶",ClerestoryRoof:"天窗屋顶",MonitorRoof:"采光屋顶",AFrameHouse:"A字形房子",HalfTimberedHouse:"半木骨架房子",AllBasicRoofTypes:"所有的基本屋顶类型"},photovoltaicSolarPowerSubMenu:"光伏发电",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"光伏板倾斜角对发电量的影响",EffectOfAzimuthOfSolarPanel:"光伏板方位角对发电量的影响",SolarPanelTypes:"光伏板类型",DefineYourOwnSolarPanels:"定义自己的光伏板",VerticalBifacialSolarPanels:"竖直的双面光伏板",CompareMonofacialAndBifacialSolarPanels:"单面光伏板和双面光伏板的对比",SolarTrackers:"自动追日器",CoveringGroundWithSolarPanels:"为什么我们不简单地用光伏板覆盖地面",InterRowSpacingOfSolarPanelArray:"光伏板阵列行间距对发电量的影响",EffectOfOrientationOfSolarPanels:"光伏板排列方向对发电量的影响",SolarPanelArrayAutomaticLayout:"光伏板自动排列"},concentratedSolarPowerSubMenu:"光热发电",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"抛物线槽方位角对发电量的影响",EffectOfLatusRectumOfParabolicTrough:"抛物线槽通径对发电量的影响",FocusSunlightWithParabolicDish:"用抛物线碟聚焦陽光",LinearFresnelReflectors:"用直线式菲涅尔反射镜聚焦陽光",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"吸热管的安装高度对直线式菲涅尔反射镜发电量的影响",EffectOfAzimuthOfLinearFresnelReflectors:"直线式菲涅尔反射镜方位角对发电量的影响",LinearFresnelReflectorsWithTwoAbsorbers:"配备两个吸收管的直线式菲涅尔反射镜阵列",CosineEfficiencyOfHeliostats:"定日镜的余弦效率",ShadowingAndBlockingOfHeliostats:"定日镜的阴影和遮挡",EffectSolarPowerTowerHeight:"吸收塔高度对发电量的影响",SolarPowerTower:"塔式光热发电站"},otherTypesOfSolarPowerSubMenu:"其它类型的太阳能发电",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"太阳能热水器",SolarUpdraftTower:"太阳能上升气流塔"},windPowerSubMenu:"风力发电",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"转子叶片的数目对风力涡轮机输出的影响",EffectOfPitchAngleOfWindTurbineBlades:"转子叶片的俯仰角对风力涡轮机输出的影响",BirdSafeBladeDesign:"对鸟类安全的叶片设计",OffshoreWindFarm:"海上风电场"},colocationSubMenu:"共用空间项目",colocationTutorials:{AgricultureSolarWindColocation:"农业光伏风力共用空间"},generativeDesignSubMenu:"生成式设计",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"单面光伏板阵列的倾斜角",BifacialSolarPanelArrayTiltAngle:"双面光伏板阵列的倾斜角",OutputOfSolarPanelArrayInDifferentPlaces:"一个光伏板阵列在不同地区的产出",SimpleSolarFarmParetoFront:"简单太阳能农场设计的帕累托前沿"},examplesSubMenu:"例子",solarEnergySubMenu:"太阳能",solarEnergyExamples:{SunBeamAndHeliodon:"太阳光束和日影仪",RooftopSolarPanels:"屋顶光伏板",NevadaSolarOneParabolicTroughArray:"内华达州太阳能一号的抛物线槽阵列",TooeleParabolicDishArray:"犹他州图埃勒的抛物线碟阵列",PS10SolarPowerTower:"西班牙塞维利亚的PS10太阳能发电塔",TucsonLinearFresnelReflectors:"亚利桑那州图森的直线式菲涅尔反射镜阵列",SolarCanopyFormFactors:"太阳能天篷外形设计",SolarCanopyOverBleachers:"看台太阳能天篷",SolarCanopyOverGarage:"车库太阳能天篷",SolarBusStop:"太阳能候车亭",SolarFacadeTesla:"特斯拉光伏墙",BuildingIntegratedPhotovoltaics:"建筑整合光伏",Floatovoltaics:"浮动光伏",Agrivoltaics:"农业光伏",VegetativeBuffer:"太阳能农场绿化带",RainbowSwashSolarFarmBostonMA:"马萨诸塞州波士顿彩虹激流旁边的光伏板阵列",MickeyMouseSolarFarmOrlandoFL:"佛罗里达州奥兰多的米老鼠形状光伏板阵列",SolarPanelsOverCanalBakersfieldCA:"加利福尼亚州贝克斯菲尔德灌溉渠上假想的光伏板阵列",SolarNoiseBarrierLexingtonMA:"马萨诸塞州列克星敦高速公路噪音墙上假想的光伏板",HSATSolarTrackersRaleighNC:"北卡罗来纳州罗利的一个水平方向单轴旋转追日光伏板阵列(HSAT)",AADATSolarTrackersLancasterCA:"加利福尼亚州兰开斯特的一个双轴旋转追日光伏板阵列(AADAT)",SolarUpdraftTowerInCity:"太阳能上升气流塔在城市中的应用"},builtEnvironmentSubMenu:"建造环境",residentialBuildingsSubMenu:"住宅建筑",residentialBuildingExamples:{ColonialHouse:"殖民地风格的住宅",DutchColonialHouse:"荷兰殖民地风格的住宅",TShapedHouse:"T字型房子",CapeCodHouseWithGarage:"有车库的科德角风格的住宅",Solarium:"有日光浴室的房子",Church1:"教堂例一",Cathedral1:"主教座堂例一",Cathedral2:"主教座堂例二",Mosque1:"清真寺例一",AdobeTaosHouse:"陶斯土坯房",RanchHouse:"牧场风格的住宅",BonnetHouse:"有帽檐屋顶的住宅",BarnStyleHouse:"谷仓式风格的住宅",ModernHouse:"现代风格的住宅",ButterflyRoofHouse:"蝴蝶型屋顶的住宅"},commercialBuildingsSubMenu:"商用建筑",commercialBuildingExamples:{WhiteHouse:"白宫",HaroldWashingtonCollege:"哈罗德华盛顿学院",BilimMersinTurkiye:"土耳其梅尔辛科学教育中心",SpanishStyleHotel:"西班牙风格旅馆",ApartmentBuilding:"公寓楼",OfficeBuilding:"办公楼",Hotel:"旅馆"},buildingComplexesSubMenu:"建筑群",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"佛蒙特州南伯灵顿高中",MescaleroApacheSchoolNewMexico:"新墨西哥州梅斯卡勒罗阿帕奇学校"},urbanPlanningSubMenu:"城市规划",urbanPlanningExamples:{CityBlockHeatmap:"城市街区热图",ChicagoSkyline:"芝加哥天际线"},otherBuildingsSubMenu:"其它建筑",otherBuildingExamples:{Greenhouse:"温室",Pavilion:"公园的亭子",OctagonalPagoda:"八角塔",OceanFront:"海边",EgyptianPyramids:"埃及金字塔",MayanPyramid:"玛雅金字塔",SiOSePol:"三十三孔桥",StackedCuboids:"堆砌长方体"},artificialIntelligenceSubMenu:"人工智能",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"优化单排光伏板的倾斜角",OptimizingTiltAnglesOfMultipleSolarPanelRows:"优化多排光伏板的倾斜角",SolarFarmGenerativeDesign:"生成式设计太阳能农场",SolarFarmGenerativeDesignWithBlock:"生成式设计太阳能农场:周边有建筑物的情况",FitchburgSolarFarmGenerativeDesign:"生成式设计太阳能农场:真实世界案例"},languageSubMenu:"语言",publicSubMenu:"公共",ModelsGallery:"模型画廊",ModelsMap:"模型地图",AboutUs:"关于我们"},avatarMenu:{AccountSettings:"账号设定",PrivacyStatementTitle:"用户隐私保护声明",PrivacyStatement:"登录需要采用您的谷歌ID建立或进入您的阿拉丁账户。 我们只储存一个随机的字符串作为您的ID。 任何关于您的可辨识的个人信息都没有被收集。 详情请参考我们的",SignIn:"登录",SignInAsMe:"实名登录",SignInAnonymously:"匿名登录",SignOut:"退出账号",IfYouAreAStudent:"如果您是一个学生"},skyMenu:{Axes:"显示坐标轴",Theme:"环境主题",ThemeDefault:"默认",ThemeDesert:"沙漠",ThemeDune:"沙丘",ThemeForest:"森林",ThemeGrassland:"草原",ThemeHill:"丘陵",ThemeLake:"湖泊",ThemeMountain:"山脉",ThemeRural:"田园",SunlightAttenuationCoefficientInAir:"阳光在空气中传播的衰减系数",ConvectiveCoefficientOfAir:"空气对流传热系数",HighestTemperatureTimeInMinutes:"最高气温时间(分钟)",SelectSunAnglesToShow:"选择太阳角度显示",ShowAzimuthAngle:"显示方位角",ShowElevationAngle:"显示高度角",ShowZenithAngle:"显示天顶角",DirectLightBrightnessAtNoon:"正午直射光照度",AmbientLightBrightnessAtNoon:"正午环境光照度"},groundMenu:{MonthlyIrradianceLoss:"月份辐射度损失比",Vegetation:"植被",LeafOutDay:"树叶长出的日子",LeafOffDay:"树叶脱落的日子",Albedo:"反照率",ImageOnGround:"地面显示图像",WaterSurface:"水面",RemoveAllUnlockedTrees:"删除所有非固定的树木",RemoveAllUnlockedFlowers:"删除所有非固定的花草",RemoveAllUnlockedSolarPanels:"删除所有非固定的光伏板",RemoveAllUnlockedPeople:"删除所有非固定的人物",RemoveAllUnlockedFoundations:"删除所有非固定的地基",RemoveAllUnlockedCuboids:"删除所有非固定的长方体",DoYouReallyWantToRemoveAllPeople:"你确定删除所有非固定的人物吗",DoYouReallyWantToRemoveAllTrees:"你确定删除所有非固定的树木吗",DoYouReallyWantToRemoveAllFlowers:"你确定删除所有非固定的花草吗",DoYouReallyWantToRemoveAllSolarPanels:"你确定删除所有非固定的光伏板吗",DoYouReallyWantToRemoveAllFoundations:"你确定删除所有非固定的地基吗",DoYouReallyWantToRemoveAllCuboids:"你确定删除所有非固定的长方体吗",LockAllUnlockedElements:"固定所有非固定的部件",UnlockAllLockedElements:"解除所有的固定"},labelSubMenu:{Label:"标签",LabelText:"标签的内容",LabelHeight:"标签的高度",LabelSize:"标签的大小",LabelFontSize:"字体的大小",LabelColor:"标签的颜色",KeepShowingLabel:"显示标签"},foundationMenu:{RemoveAllUnlockedSolarPanels:"删除此地基上所有非固定的光伏板",RemoveAllUnlockedParabolicTroughs:"删除此地基上所有非固定的抛物线槽",RemoveAllUnlockedParabolicDishes:"删除此地基上所有非固定的抛物线碟",RemoveAllUnlockedFresnelReflectors:"删除此地基上所有非固定的菲涅耳反射镜",RemoveAllUnlockedHeliostats:"删除此地基上所有非固定的定日镜",RemoveAllUnlockedWindTurbines:"删除此地基上所有非固定的风力涡轮机",RemoveAllUnlockedSensors:"删除此地基上所有非固定的传感器",RemoveAllUnlockedLights:"删除此地基上所有非固定的电灯",RemoveAllUnlockedWalls:"删除此地基上所有非固定的墙",RemoveAllUnlockedWindows:"删除此地基上所有非固定的窗户",RemoveAllUnlockedDoors:"删除此地基上所有非固定的门",RemoveAllUnlockedPolygons:"删除此地基上所有非固定的多边形",RemoveAllUnlockedHumans:"删除此地基上所有非固定的人物",RemoveAllUnlockedTrees:"删除此地基上所有非固定的树木",RemoveAllUnlockedFlowers:"删除此地基上所有非固定的花草",Racks:"支架",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",SolarPanels:"光伏板",SolarPanelArray:"光伏板阵列",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"你确定删除此地基上所有非固定的光伏板吗",ParabolicTroughs:"抛物线槽",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"你确定删除此地基上所有非固定的抛物线槽吗",ParabolicDishes:"抛物线碟",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"你确定删除此地基上所有非固定的抛物线碟吗",FresnelReflectors:"菲涅耳反射镜",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"你确定删除此地基上所有非固定的菲涅耳反射镜吗",Heliostats:"定日镜",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"你确定删除此地基上所有非固定的定日镜吗",WindTurbines:"风力涡轮机",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"你确定删除此地基上所有非固定的风力涡轮机吗",Sensors:"传感器",DoYouReallyWantToRemoveAllSensorsOnFoundation:"你确定删除此地基上所有非固定的传感器吗",Lights:"电灯",DoYouReallyWantToRemoveAllLightsOnFoundation:"你确定删除此地基上所有非固定的电灯吗",Walls:"墙",DoYouReallyWantToRemoveAllWallsOnFoundation:"你确定删除此地基上所有非固定的墙吗",Windows:"窗户",DoYouReallyWantToRemoveAllWindowsOnFoundation:"你确定删除此地基上所有非固定的窗户吗",Doors:"门",DoYouReallyWantToRemoveAllDoorsOnFoundation:"你确定删除此地基上所有非固定的门吗",Polygons:"多边形",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"你确定删除此地基上所有非固定的多边形吗",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnFoundation:"你确定删除此地基上所有非固定的人物吗",Trees:"树木",DoYouReallyWantToRemoveAllTreesOnFoundation:"你确定删除此地基上所有非固定的树木吗",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnFoundation:"你确定删除此地基上所有非固定的花草吗",OnlyThisFoundation:"只这块地基",AllSelectedFoundations:"所有选中的地基",AllConnectedFoundations:"所有相连的地基",AllFoundations:"所有的地基",AddPolygon:"添加多边形",SolarStructure:"太阳能构型",GroupMaster:"主地基",LockAllUnlockedElementsOnThisFoundation:"固定此地基上所有非固定的部件",UnlockAllLockedElementsOnThisFoundation:"解除此地基上所有的固定",GroundFloorRValue:"建筑物地板的R值",OnlyThisGroundFloor:"只这个建筑物的地板",AllGroundFloors:"所有建筑物的地板"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"和定日镜配套的吸收塔",ReceiverTowerPhysicalProperties:"太阳能吸收塔的物理性质",ReceiverTowerHeight:"太阳能吸收塔的高度",ReceiverTowerRadius:"太阳能吸收塔的半径",ReceiverAbsorptance:"太阳能吸收器的吸收率",ReceiverOpticalEfficiency:"太阳能吸收器的光效率",ReceiverThermalEfficiency:"太阳能吸收器的热效率"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"和菲涅尔反射镜配套的吸收管",AbsorberPipePhysicalProperties:"太阳能吸收管的物理性质",AbsorberHeight:"太阳能吸收管的安装高度",AbsorberApertureWidth:"太阳能吸收管的孔径",AbsorberPipePoleNumber:"太阳能吸收管的支柱数量",AbsorberAbsorptance:"太阳能吸收管的吸收率",AbsorberOpticalEfficiency:"太阳能吸收管的光效率",AbsorberThermalEfficiency:"太阳能吸收管的热效率"},solarUpdraftTowerMenu:{SolarUpdraftTower:"太阳能上升气流塔",SolarUpdraftTowerPhysicalProperties:"太阳能上升气流塔的物理性质",SolarUpdraftTowerChimneyHeight:"太阳能上升气流塔烟囱的高度",SolarUpdraftTowerChimneyRadius:"太阳能上升气流塔烟囱的半径",SolarUpdraftTowerCollectorHeight:"太阳能上升气流塔集热棚的高度",SolarUpdraftTowerCollectorRadius:"太阳能上升气流塔集热棚的半径",SolarUpdraftTowerCollectorTransmissivity:"太阳能上升气流塔集热棚的透射率",SolarUpdraftTowerCollectorEmissivity:"太阳能上升气流塔集热棚的发射率",SolarUpdraftTowerDischargeCoefficient:"太阳能上升气流塔的流量系数",SolarUpdraftTowerTurbineEfficiency:"太阳能上升气流塔的涡轮机效率"},cuboidMenu:{Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",RemoveAllUnlockedSolarPanels:"删除此长方体表面上所有非固定的光伏板",RemoveAllUnlockedSensors:"删除此长方体表面上所有非固定的传感器",RemoveAllUnlockedPolygons:"删除此长方体表面上所有非固定的多边形",RemoveAllUnlockedHumans:"删除此长方体表面上所有非固定的人物",RemoveAllUnlockedTrees:"删除此长方体表面上所有非固定的树木",RemoveAllUnlockedFlowers:"删除此长方体表面上所有非固定的花草",RemoveAllUnlockedLights:"删除此长方体表面上所有非固定的电灯",Racks:"支架",SolarPanels:"光伏板",Lights:"电灯",DoYouReallyWantToRemoveAllLightsOnCuboid:"你确定删除此长方体表面上所有非固定的电灯吗",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"你确定删除此长方体表面上所有非固定的光伏板吗",Sensors:"传感器",DoYouReallyWantToRemoveAllSensorsOnCuboid:"你确定删除此长方体表面上所有非固定的传感器吗",Polygons:"多边形",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"你确定删除此长方体表面上所有非固定的多边形吗",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnCuboid:"你确定删除此长方体表面上所有非固定的人物吗",Trees:"树木",DoYouReallyWantToRemoveAllTreesOnCuboid:"你确定删除此长方体表面上所有非固定的树木吗",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnCuboid:"你确定删除此长方体表面上所有非固定的花草吗",OnlyThisCuboid:"只这个长方体",AllCuboidsOnSameSurface:"同一表面上所有的长方体",AllCuboidsAboveSameBase:"同一地基上所有的长方体",AllSelectedCuboids:"所有选中的长方体",AllCuboids:"所有的长方体",OnlyThisSide:"只这个表面",AllSidesOfThisCuboid:"这个长方体所有的侧面",AllSidesOfSelectedCuboids:"所有选中长方体所有的侧面",AllSidesOfAllCuboids:"所有的长方体所有的侧面",AddPolygon:"添加多边形",Stackable:"可堆砌",GroupMaster:"主长方体"},polygonMenu:{Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",TextBox:"文字框",FontOutlineColor:"字体轮廓颜色",FontOutlineWidth:"字体轮廓线宽",FontStrokeColor:"字体描边颜色",FontStrokeWidth:"字体描边线宽",NoOutline:"无轮廓线",Shiny:"光泽",Filled:"填充",FillTexture:"填充材质",FillColor:"填充颜色",Opacity:"遮光度",LineColor:"线条颜色",LineWidth:"线条宽度",LineStyle:"线条样式",SolidLine:"实线",DashedLine:"虚线",DottedLine:"点线",InsertVertexBeforeIndex:"前面插入顶点",InsertVertexAfterIndex:"后面插入顶点",DeleteVertex:"移除顶点",OnlyThisPolygon:"只这个多边形",AllPolygonsOnSurface:"同一表面上所有的多边形",AllPolygonsAboveFoundation:"同一地基上所有的多边形",AllSelectedPolygons:"所有选中的多边形",AllPolygons:"所有的多边形",Layout:"布局",SolarPanelArrayLayout:"光伏板阵列布局",SolarPanelArrayLayoutParametricDesign:"光伏板阵列布局参数化设计",SolarPanelArrayLayoutGenerativeDesign:"光伏板阵列布局生成式设计",SolarPanelArrayModel:"光伏板型号",SolarPanelArrayOrientation:"排列方向",SolarPanelArrayTiltAngle:"倾斜角度",SolarPanelArrayRowWidth:"行宽度",SolarPanelArrayInterRowSpacing:"行间距",SolarPanelArrayRowSpacing:"行间距",SolarPanelArrayRowAxis:"行轴方向",SolarPanelArrayLeftRightRowAxis:"左右方向(相对)",SolarPanelArrayUpDownRowAxis:"上下方向(相对)",SolarPanelArrayEastWestRowAxis:"东西方向(绝对)",SolarPanelArrayNorthSouthRowAxis:"南北方向(绝对)",SolarPanelArrayMargin:"边缘余地",SolarPanelArrayPoleHeight:"支架高度",SolarPanelArrayPoleSpacing:"支柱间隔",SolarPanelArrayTotalYearlyCost:"全年总成本",SolarPanelArrayTotalYearlyRevenue:"全年总收入",SolarPanelArrayTotalYearlyYield:"全年总发电量",SolarPanelArrayMeanYearlyYield:"平均年发电量",SolarPanelArrayYearlyProfit:"全年利润",LayoutNotAcceptedCheckYourParameters:"恕不能采用此布局。请检查您的参数设置。"},optimizationMenu:{Optimization:"优化",Parameters:"参数",Variables:"变量",Constants:"常量",GeneticAlgorithm:"遗传算法",GeneticAlgorithmSettings:"遗传算法设定",ParticleSwarmOptimization:"粒子群优化",ParticleSwarmOptimizationSettings:"粒子群优化设定",SolarPanelTiltAngleOptimization:"光伏板倾斜角度优化",SolarPanelArrayLayout:"光伏板阵列布局",Generation:"世代",Gene:"基因",NormalizedVariables:"标准化变量",Objective:"目标函数",ObjectiveFunctionDailyTotalYield:"当日总产出",ObjectiveFunctionYearlyTotalYield:"全年总产出",ObjectiveFunctionDailyMeanYield:"当日平均产出",ObjectiveFunctionYearlyMeanYield:"全年平均产出",ObjectiveFunctionDailyProfit:"当日利润",ObjectiveFunctionYearlyProfit:"全年利润",GeneticAlgorithmSelectionMethod:"遗传算法选择方法",RouletteWheel:"轮盘制",Tournament:"淘汰制",SearchMethod:"搜索方法",GlobalSearchUniformSelection:"全局搜索均匀取样",LocalSearchRandomOptimization:"局部搜索随机优化",PopulationSize:"种群个体数目",MaximumGenerations:"最大世代数目",SelectionRate:"选择概率",CrossoverRate:"交配概率",MutationRate:"突变概率",Step:"步数",SwarmSize:"粒子数目",MaximumSteps:"最大步数",MaximumVelocity:"最大速度",InertiaWeight:"惯性权重",CognitiveCoefficient:"认知系数",SocialCoefficient:"社会系数",ConvergenceThreshold:"终止条件的收敛阈值",LocalSearchRadius:"局部搜索的半径",RowsPerRackRange:"单个支架上光伏板行数的变化范围",TiltAngleRange:"光伏板倾斜角度的变化范围",InterRowSpacingRange:"光伏板阵列行间距的变化范围",ClickTargetPolygonToActivate:"点击目标多边形激活",ClickTargetFoundationToActivate:"点击目标地基激活"},treeMenu:{ShowModel:"显示近似模型",Flip:"翻转",Type:"树种",Spread:"树冠直径"},flowerMenu:{Flip:"翻转",Type:"品种",Spread:"直径"},peopleMenu:{ChangePerson:"改变人物",Flip:"转身",Observer:"观察者",ViewFromThisPerson:"视角移到此人位置"},lightMenu:{Color:"颜色",Intensity:"亮度",Decay:"衰减",MaximumDistance:"最大距离",Inside:"内部"},solarCollectorMenu:{Coordinates:"坐标",RelativeXCoordinateOfCenter:"中心的相对X坐标",RelativeYCoordinateOfCenter:"中心的相对Y坐标",RelativeAzimuth:"相对方位角",Pole:"支柱",PoleHeight:"支柱高度",PoleRadius:"支柱半径",ExtraPoleHeight:"额外的支柱高度",ExtraPoleHeightInAdditionToHalfWidth:"宽度一半额外的支柱高度",DrawSunBeam:"显示光束"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"反射器镜面反射率",ReceiverAbsorptance:"接收器吸收率",ReflectorOpticalEfficiency:"反射器光效率",ReceiverThermalEfficiency:"接收器热效率"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"只这个太阳能热水器",AllSolarWaterHeatersOnSurface:"同一表面上所有的太阳能热水器",AllSolarWaterHeatersAboveFoundation:"同一地基上所有的太阳能热水器",AllSelectedSolarWaterHeaters:"所有选中的太阳能热水器",AllSolarWaterHeaters:"所有的太阳能热水器"},solarPanelMenu:{ElectricalProperties:"电气特性",InverterEfficiency:"逆变器效率",InverterEfficiencyExplained:"直流电转换为交流电的效率。",DcToAcSizeRatio:"直流-交流容量比例",DcToAcSizeRatioExplained:"直流电容量和交流电容量的比例。",ChangePvModel:"改变光伏板型号",Orientation:"排列方向",Portrait:"纵向",Landscape:"橫向",FrameColor:"框架颜色",Panels:"块",PanelsWide:"块光伏板宽",PanelsLong:"块光伏板长",TiltAngle:"倾斜角度",SouthFacingIsPositive:"朝南为正",Tracker:"追日系统",SolarTrackerFollowsSun:"追日系统提高光伏板产出。",PoleSpacing:"支柱间隔",NoTracker:"无追日系统",HorizontalSingleAxisTracker:"水平单轴追日系统",VerticalSingleAxisTracker:"竖直单轴追日系统",AltazimuthDualAxisTracker:"地平双轴追日系统",OnlyThisSolarPanel:"只这个光伏板",AllSolarPanelsOnSurface:"同一表面上所有的光伏板",AllSolarPanelsAboveFoundation:"同一地基上所有的光伏板",AllSelectedSolarPanels:"所有选中的光伏板",AllSolarPanels:"所有的光伏板"},pvModelPanel:{SolarPanelSpecs:"光伏板型号性能",General:"概况",Electrical:"电气",CellCountInXDirection:"X方向电池数目",CellCountInYDirection:"Y方向电池数目",Weight:"重量",Kilogram:"千克",RatedVoltage:"额定电压",RatedCurrent:"额定电流",OpenCircuitVoltage:"开路电压",ShortCircuitCurrent:"短路电流",MaximumRatedPower:"最大额定功率",Model:"型号",PanelSize:"尺寸",Cells:"电池組",CellType:"光伏电池类型",Monocrystalline:"单晶硅",Polycrystalline:"多晶硅",ThinFilm:"薄膜",Bifacial:"双面",PowerBifaciality:"功率双面性因子(背面对正面)",Black:"黑色",Blue:"蓝色",ShadeTolerance:"阴影耐受度",SolarCellEfficiency:"光伏电池效率",NominalOperatingCellTemperature:"名义电池运行温度",TemperatureCoefficientOfPmax:"Pmax温度系数",AddedCustomSolarPanels:"已有",DisplayThisCustomSolarPanel:"展示这个定制光伏板",ExportThisCustomSolarPanel:"输出此定制光伏板",ImportCustomSolarPanelFromClipboard:"从系统剪切板输入定制光伏板数据d",CustomSolarPanelExportedToClipboard:"定制光伏板拷贝到剪贴板",DoYouReallyWantToRemoveThisCustomSolarPanel:"你确定删除此定制光伏板",MakeSureThisCustomSolarPanelIsNotUsed:"删除之前请确认此定制光伏板没有被当前模型采用",ThisCustomSolarPanelIsUsed:"此定制光伏板被当前模型采用",DoYouReallyWantToImportCustomSolarPanel:"你确定輸入定制光伏板",ExistingSettingsWillBeOverwritten:"现有的设定将被取代",CannotAddCustomSolarPanel:"无法添加此定制光伏板",CustomSolarPanelMustHaveModelName:"定制光伏板必须要有型号",CustomSolarPanelExists:"当前文件已经定义了此名字的定制光伏板",FailInImportingDataFromClipboard:"从系统剪切板输入数据失败",NoNeedToAddThisCustomSolarPanel:"无需定义此光伏板",SolarPanelModelAlreadyProvidedBySystem:"系统已提供此光伏板"},parabolicTroughMenu:{ModuleLength:"模块长度",Modules:"模块",ModulesLong:"模块长",LatusRectum:"通径",OnlyThisParabolicTrough:"只这个抛物线槽",AllParabolicTroughsAboveFoundation:"同一地基上所有的抛物线槽",AllSelectedParabolicTroughs:"所有选中的抛物线槽",AllParabolicTroughs:"所有的抛物线槽"},fresnelReflectorMenu:{AbsorberPipe:"吸收管",SelectAbsorberToReflectSunlightTo:"选择阳光反射到的吸收管",ModuleLength:"模块长度",Modules:"模块",ModulesLong:"模块长",OnlyThisFresnelReflector:"只这个菲涅耳反射镜",AllFresnelReflectorsAboveFoundation:"同一地基上所有的菲涅耳反射镜",AllSelectedFresnelReflectors:"所有选中的菲涅耳反射镜",AllFresnelReflectors:"所有的菲涅耳反射镜"},heliostatMenu:{Tower:"吸收塔",SelectTowerToReflectSunlightTo:"选择阳光反射到的吸收塔",OnlyThisHeliostat:"只这个定日镜",AllHeliostatsAboveFoundation:"同一地基上所有的定日镜",AllSelectedHeliostats:"所有选中的定日镜",AllHeliostats:"所有的定日镜"},parabolicDishMenu:{ReceiverStructure:"接收器结构",CentralPole:"中心直柱",CentralPoleWithTripod:"三脚架和中心直柱",Quadrupod:"四脚架",RimDiameter:"外圈直径",LatusRectum:"通径",ExtraPoleHeightInAdditionToRadius:"半径之外额外的支架高度",OnlyThisParabolicDish:"只这个抛物线碟",AllParabolicDishesAboveFoundation:"同一地基上所有的抛物线碟",AllSelectedParabolicDishes:"所有选中的抛物线碟",AllParabolicDishes:"所有的抛物线碟"},windTurbineMenu:{BirdSafeDesign:"鸟类安全设计",BirdSafeNone:"无",BirdSafeBicolor:"双色",BirdSafeStriped:"条纹",Rotor:"转子",BladeNumber:"叶片数目",RotorInitialAngle:"转子初始角度",RotorBladeDesign:"转子叶片设计",RotorBladeRadius:"转子叶片半径",RotorBladePitchAngle:"转子叶片俯仰角",RelativeYawAngle:"相对偏流角",MaximumChordLength:"最大弦长度",Tower:"塔架",TowerHeight:"塔架高度",TowerRadius:"塔架半径",HubDesign:"转子轮毂设计",HubRadius:"轮毂半径",HubLength:"轮毂长度",OnlyThisWindTurbine:"只这个风力涡轮机",AllWindTurbinesAboveFoundation:"同一地基上所有的风力涡轮机",AllSelectedWindTurbines:"所有选中的风力涡轮机",AllWindTurbines:"所有的风力涡轮机"},wallMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",SizeOfWall:"墙的尺寸",OnlyThisWall:"只这堵墙",AllConnectedWalls:"所有连接的墙",AllWallsAboveFoundation:"同一地基上所有的墙",AllSelectedWalls:"所有选中的墙",AllWalls:"所有的墙",Windows:"窗户",LockAllUnlockedWindows:"固定所有非固定的窗户",UnlockAllLockedWindows:"解除所有的窗户固定",RemoveAllUnlockedWindows:"删除这堵墙上所有非固定的窗户",DoYouReallyWantToRemoveAllWindowsOnThisWall:"你确定删除这堵墙上所有非固定的窗户吗",Doors:"门",LockAllUnlockedDoors:"固定所有非固定的门",UnlockAllLockedDoors:"解除所有的门固定",RemoveAllUnlockedDoors:"删除这堵墙上所有非固定的门",DoYouReallyWantToRemoveAllDoorsOnThisWall:"你确定删除这堵墙上所有非固定的门吗",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"删除这堵墙上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"你确定删除这堵墙上所有非固定的光伏板吗",Sensors:"传感器",LockAllUnlockedSensors:"固定所有非固定的传感器",UnlockAllLockedSensors:"解除所有的传感器固定",RemoveAllUnlockedSensors:"删除这堵墙上所有非固定的传感器",DoYouReallyWantToRemoveAllSensorsOnThisWall:"你确定删除这堵墙上所有非固定的传感器吗",Lights:"电灯",LockAllUnlockedLights:"固定这堵墙上所有非固定的电灯",UnlockAllLockedLights:"解除这堵墙上所有的电灯固定",RemoveAllUnlockedLights:"删除这堵墙上所有非固定的电灯",DoYouReallyWantToRemoveAllLightsOnThisWall:"你确定删除这堵墙上所有非固定的电灯吗",Polygons:"多边形",LockAllUnlockedPolygons:"固定这堵墙上所有非固定的多边形",UnlockAllLockedPolygons:"解除这堵墙上所有的多边形固定",RemoveAllUnlockedPolygons:"删除这堵墙上所有非固定的多边形",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"你确定删除这堵墙上所有非固定的多边形吗",WallStructure:"墙结构",DefaultStructure:"默认",StudStructure:"墙柱",PillarStructure:"圆柱",Opacity:"遮光度",StructureSpacing:"结构间距",StructureWidth:"结构宽度",StructureThickness:"结构厚度",StructureColor:"结构颜色",Color:"牆体颜色",Height:"高度",Thickness:"厚度",Texture:"材质",AllLightsOnWallInside:"所有电灯在牆内",AllLightsOnWallOutside:"所有电灯在牆外",Fill:"填充",Full:"全部",Partial:"部分",Empty:"空白",OpenToOutside:"对外面开放",EavesLength:"屋檐延伸长度",Parapet:"女墙",ParapetColor:"女墙颜色",ParapetTexture:"女墙材质",ParapetHeight:"女墙高度",CopingsHeight:"顶盖高度",CopingsWidth:"顶盖宽度"},windowMenu:{OnlyThisWindow:"只这个窗户",AllWindowsOnSurface:"同一表面上所有的窗户",AllWindowsAboveFoundation:"同一地基上所有的窗户",AllSelectedWindows:"所有选中的窗户",AllWindows:"所有的窗户",Width:"宽度",Height:"高度",Setback:"离墙体外表面的距离",RelativeToWallThickness:"相对于墙的厚度",Mullion:"直棂",HorizontalMullion:"水平的直棂",VerticalMullion:"竖直的直棂",MullionWidth:"直棂宽度",HorizontalMullionSpacing:"水平直棂的间距",VerticalMullionSpacing:"竖直直棂的间距",MullionColor:"直棂颜色",Tint:"着色",Opacity:"不透明度",SolarHeatGainCoefficient:"太阳辐射热获取系数(SHGC) = 1 - 不透明度",Shutter:"百叶窗",LeftShutter:"左侧百叶窗",RightShutter:"右侧百叶窗",BothShutters:"两侧百叶窗",ShutterWidth:"相对宽度",ShutterColor:"百叶窗颜色",Frame:"边框",FrameWidth:"边框宽度",SillWidth:"窗台宽度",Color:"边框颜色",WindowType:"窗户种类",Default:"默认",Arched:"拱形",Polygonal:"多边形",Interior:"内窗",Empty:"空白"},roofMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",OnlyThisRoof:"只这个屋顶",AllRoofsAboveFoundation:"同一地基上所有的屋顶",AllSelectedRoofs:"所有选中的屋顶",AllRoofs:"所有的屋顶",OnlyThisCeiling:"只这个天花板",AllCeilingsAboveFoundation:"同一地基上所有的天花板",AllCeilings:"所有的天花板",EavesOverhangLength:"屋檐延伸长度",RafterSpacing:"屋椽间距",RafterWidth:"屋椽宽度",RafterThickness:"屋椽厚度",RafterColor:"屋椽颜色",RoofColor:"屋顶颜色",RoofSideColor:"屋顶侧面颜色",GlassTint:"玻璃颜色",Opacity:"遮光度",RoofStructure:"屋顶结构",DefaultStructure:"默认",RafterStructure:"屋椽",GlassStructure:"玻璃",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"删除这个屋顶上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"你确定删除这个屋顶上所有非固定的光伏板吗",Windows:"天窗",LockAllUnlockedWindows:"固定所有非固定的天窗",UnlockAllLockedWindows:"解除所有的天窗固定",RemoveAllUnlockedWindows:"删除这个屋顶上所有非固定的天窗",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"你确定删除这个屋顶上所有非固定的天窗吗",Sensors:"传感器",LockAllUnlockedSensors:"固定所有非固定的传感器",UnlockAllLockedSensors:"解除所有的传感器固定",RemoveAllUnlockedSensors:"删除这个屋顶上所有非固定的传感器",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"你确定删除这个屋顶上所有非固定的传感器吗",Lights:"电灯",RemoveAllUnlockedLights:"删除这个屋顶上所有非固定的电灯",DoYouReallyWantToRemoveAllLightsOnThisRoof:"你确定删除这个屋顶上所有非固定的电灯吗",AllLightsOnRoofInside:"所有电灯在屋顶内",AllLightsOnRoofOutside:"所有电灯在屋顶外",Rise:"相对高度",Ceiling:"天花板",RoofRValue:"屋顶R值",CeilingRValue:"天花板R值"},doorMenu:{TextureDefault:"默认材质",Texture01:"一号材质",Texture02:"二号材质",Texture03:"三号材质",Texture04:"四号材质",Texture05:"五号材质",Texture06:"六号材质",Texture07:"七号材质",Texture08:"八号材质",Texture09:"九号材质",Texture10:"十号材质",Texture11:"十一号材质",Texture12:"十二号材质",Texture13:"十三号材质",Texture14:"十四号材质",Texture15:"十五号材质",Texture16:"十六号材质",Texture17:"十七号材质",OnlyThisDoor:"只这个门",AllDoorsOnWall:"同一面墙上所有的门",AllDoorsAboveFoundation:"同一地基上所有的门",AllSelectedDoors:"所有选中的门",AllDoors:"所有的门",DoorType:"门种类",Default:"默认",Arched:"拱形",Filled:"填充",FrameColor:"门框颜色",Interior:"内门"},siteInfoPanel:{High:"最高温度",Low:"最低温度"},designInfoPanel:{NumberOfSelectedHeliostats:"选中的定日镜总数",NumberOfSelectedSolarPanels:"选中的光伏板总数",ElectricityGeneratedDailyBySolarPanels:"这些光伏板的日发电量",SceneDiameter:"场景直径",BuildingArea:"建筑面积"},visualizationControlPanel:{ColorContrast:"热图颜色对比度",FluxScale:"热通量长度",ClickUpOrDownArrowButtonsToChange:"点击上下箭头改变参数"},instructionPanel:{Rotate:"旋转",DragMouse:"拖动鼠标",Zoom:"缩放",MouseWheelOrKeys:"鼠标滚轮或者Ctrl+[和Ctrl+]",MouseWheelOrKeysMac:"鼠标滚轮或者⌘+[和⌘+]",Pan:"平移",HoldCtrlDragMouse:"按下Ctrl键并拖动鼠标",HoldMetaDragMouse:"按下⌘键并拖动鼠标",Enter2DMode:"進入二维模式",Exit2DMode:"退出二维模式",NavigationMode:"导航模式",EnableNavigation:"進入导航模式",DisableNavigation:"退出导航模式",MoveForwardBack:"前后移动",MoveForwardBackInstruction:"按W/S键",MoveLeftRight:"左右移动",MoveLeftRightInstruction:"按A/D键",MoveUpDown:"上下移动",MoveUpDownInstruction:"按Z/X键",Turn:"拐弯",TurnInstruction:"按方向键",ResetView:"重置视角",AutoRotate:"自动旋转",StartOrStop:"按F4键启动或停止"},mapPanel:{ImageOnGround:"地面显示图像",HideAddress:"隐藏地址",WeatherStations:"气象站",WeatherStationsNote:"关闭此选项以提高地图速度",Coordinates:"经纬度坐标",Zoom:"放大程度"},visibilityPanel:{SolarPanelVisibility:"光伏板对观察者的可见度",Observer:"观察者",VantagePoint:"观察位置",ItemizedVisibilityByFields:"每个场的可见度",TotalVisibility:"总可见度"},sensorPanel:{LightSensor:"光传感器",WeatherDataFrom:"气象数据来自"},buildingEnergyPanel:{DailyBuildingEnergy:"建筑物日能耗",YearlyBuildingEnergy:"建筑物年能耗",Heater:"暖气",AC:"空调",SolarPanel:"光伏",Net:"净能耗"},solarPanelYieldPanel:{SolarPanelDailyYield:"光伏日发电量",SolarPanelYearlyYield:"光伏年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualSolarPanels:"显示每行光伏板单独发电量",Profit:"利润",TotalCost:"总成本",TotalRevenue:"总收入",TotalYield:"总发电量",MeanYield:"平均发电量",ModuleCount:"光伏板总数"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"抛物线槽日发电量",ParabolicTroughYearlyYield:"抛物线槽年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualParabolicTroughs:"显示每行抛物线槽单独发电量"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"抛物线碟日发电量",ParabolicDishYearlyYield:"抛物线碟年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualParabolicDishes:"显示每个抛物线碟单独发电量"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"菲涅耳反射镜日发电量",FresnelReflectorYearlyYield:"菲涅耳反射镜年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualFresnelReflectors:"显示每个菲涅耳反射镜单独发电量"},heliostatYieldPanel:{HeliostatDailyYield:"定日镜日发电量",HeliostatYearlyYield:"定日镜年发电量",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualHeliostats:"显示每个定日镜单独发电量"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"太阳能上升气流塔日发电量",UpdraftTowerYearlyYield:"太阳能上升气流塔年发电量",ChimneyAirTemperature:"烟囱空气温度",ChimneyWindSpeed:"烟囱风速",Yield:"发电量",YieldPerHour:"每小时发电量",DailyTotal:"日发电总量",YearlyTotal:"年发电总量",ShowOutputsOfIndividualUpdraftTowers:"显示每个太阳能上升气流塔单独发电量"},heliodonPanel:{SunAndTimeSettings:"太阳和时间设置",SunAngles:"角度",TwentyFourHours:"24小时"},cloudFilePanel:{CopyTitle:"拷贝标题",TitleCopiedToClipBoard:"标题拷贝到剪贴板",SearchByTitle:"按标题搜索",MyLikes:"我喜欢的模型",MyCloudFiles:"我的云文件",GenerateLink:"生成链接",LinkGeneratedInClipBoard:"链接生成到剪贴板",DoYouReallyWantToDelete:"您确定删除此文件",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"如果此文件已被分享或发布, 改名会使已有链接失效"},projectListPanel:{CopyTitle:"拷贝标题",TitleCopiedToClipBoard:"标题拷贝到剪贴板",SearchByTitle:"按标题搜索",MyProjects:"我的项目",GenerateProjectLink:"生成项目链接",ProjectLinkGeneratedInClipBoard:"项目链接生成到剪贴板",DoYouReallyWantToDeleteProject:"您确定删除项目",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"如果此项目已被分享或发布, 改名会使已有链接失效"},projectPanel:{ProjectSettings:"项目设定",ThumbnailImageSize:"缩略图大小",ProjectByOtherPeople:"别人的项目",Project:"项目",ProjectType:"类别",ProjectDescription:"描述",MakeDescriptionEditable:"编辑描述",MakeDescriptionNonEditable:"不编辑描述",DoubleClickToMakeDescriptionEditable:"双击此描述激活编辑功能",SolarPanelArray:"光伏板阵列设计",CurateCurrentDesign:"收藏当前设计",UpdateSelectedDesign:"更新选中设计",RemoveSelectedDesign:"删除选中设计",ClickToFlipSortingOrder:"点击逆转排序方向",DesignNotShownInSolutionSpaceClickToShow:"此设计目前不显示在设计空间内,点击显示",DesignShownInSolutionSpaceClickToHide:"此设计目前显示在设计空间内,点击隐藏",SolutionSpace:"设计空间",ChooseSolutionSpace:"选择设计空间",ChooseDataColoring:"选择数据着色",SameColorForAllDesigns:"所有设计一个颜色",OneColorForEachDesign:"每个设计一个颜色",SolutionSpaceScreenshot:"设计空间截屏",ScatterPlotScreenshot:"散点图截屏",SingleClickToSelectDoubleClickToOpen:"单击选择,双击打开。",SingleClickToDeselectDoubleClickToOpen:"单击取消选择,双击打开。",GenerateScatterPlot:"生成散点图",SelectXAxis:"选择X轴",SelectYAxis:"选择Y轴"},accountSettingsPanel:{MyAccountSettings:"我的账户设定",MyID:"我的🆔",ClickToCopyMyID:"点击此处拷贝我的ID",IDInClipBoard:"您现在可以粘贴ID了。",StoreMyNameInMyFilesWhenSaving:"保存文件时签上我的大名",DoYouReallyWantToShowYourNameInYourFiles:"您确定在您的文件里保存您的大名吗?",SignFileDisclaimer:"如果您选择保存,您的大名可能被所有打开您的文件的人看到。",Likes:"点赞总数",AllPublished:"发布总数",PublishedUnderAliases:"别名发布",UserCount:"用户总数",SchoolID:"学校编号",ClassID:"班级编号"},weatherPanel:{SunshineHours:"日照时间"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"选择气温模型",Sinusoidal:"正弦函数"},economicsPanel:{EconomicsParameters:"经济学参数",ElectricitySellingPrice:"销售电价",OperationalCostPerUnit:"单位运行成本",SellingPrice:"销售电价",UnitCost:"单位成本"},navigationPanel:{NavigationParameters:"导航模式参数",MinimumMoveSpeed:"最小移动速度",MinimumTurnSpeed:"最小拐弯速度"},shadowSettingsPanel:{ShadowSettings:"阴影设定",ShadowCameraFarDistance:"最远距离",ShadowMapSize:"映射图长宽",Notes:"注意事项",RefreshPageNote:"改变设置后须刷新页面。",MapSizeWarning:"大的映射图长宽可能导致阿拉丁无法在某些电脑上运行。"},yearlyLightSensorPanel:{SkyClearness:"天空清晰度",ShowDaylightResults:"显示日照时间结果",ShowSkyClearnessResults:"显示天空清晰度结果",ShowAverageDailySolarRadiation:"显示日平均辐射结果"},analysisManager:{NoSensorForCollectingData:"没有传感器收集数据。",NoSolarPanelForAnalysis:"没有光伏板可以分析。",NoObserverForVisibilityAnalysis:"没有找到可见度分析的观察者。",NoSolarWaterHeaterForAnalysis:"沒有太阳能热水器可以分析。",NoParabolicDishForAnalysis:"沒有抛物线碟可以分析。",NoParabolicTroughForAnalysis:"沒有抛物线槽可以分析。",NoFresnelReflectorForAnalysis:"沒有菲涅耳反射镜可以分析。",NoHeliostatForAnalysis:"沒有定日镜可以分析。",NoSolarUpdraftTowerForAnalysis:"沒有太阳能上升气流塔可以分析。",NoBuildingForAnalysis:"沒有建筑物可以分析。"},toolbar:{CloudFile:"云文件",Select:"选择",AddFoundation:"添加地基",AddWall:"添加墙体",AddWindow:"添加窗户",AddDoor:"添加门",AddPyramidRoof:"添加金字塔屋顶",AddGableRoof:"添加双坡屋顶",AddHipRoof:"添加四坡屋顶",AddGambrelRoof:"添加复斜屋顶",AddMansardRoof:"添加折线屋顶",AddCuboid:"添加长方体",AddSensor:"添加传感器",AddSolarPanel:"添加光伏板",AddSolarWaterHeater:"添加太阳能热水器",AddBatteryStorage:"添加储蓄电池",AddParabolicDish:"添加抛物线碟",AddParabolicTrough:"添加抛物线槽",AddFresnelReflector:"添加菲涅耳反射镜",AddHeliostat:"添加定日镜",AddWindTurbine:"添加水平轴风力涡轮机",AddVerticalAxisWindTurbine:"添加垂直轴风力涡轮机",AddLight:"添加电灯",AddTree:"添加树木",AddFlower:"添加花草",AddPeople:"添加人物",DoubleClickToLockThisModeForNextAction:"双击按钮给下个动作锁定此模式",ClickToUnlockThisModeForNextAction:"点击按钮让动作完成即离开此模式",ManipulateGroup:"整体操作一个组",ClearScene:"清空场景",ShowSunAndTimeSettings:"显示太阳和时间设置",SpatialAnalysisOfEnergy:"能量的空间分析",DoYouReallyWantToClearContent:"您确定清空场景吗",ClickForMoreButtons:"点击此处切换到更多的按钮模式"},tooltip:{gotoIFI:"访问未来智能研究所",visitAladdinHomePage:"访问阿拉丁主页",clickToOpenMenu:"点击打开主菜单",clickToAccessAccountSettings:"点击打开账号设定"},tree:{Apple:"苹果树",Birch:"白桦",Coconut:"椰子树",Dogwood:"茱萸",Elm:"榆树",FanPalm:"扇叶棕榈",Linden:"菩提",Magnolia:"玉兰",Maple:"枫树",Oak:"橡树",Pine:"松树",Spruce:"云杉"},flower:{Bellflower:"铃兰",Boxwood:"黄杨",CactusCombo1:"仙人掌组合一",CactusCombo2:"仙人掌组合二",CactusCombo3:"仙人掌组合三",CactusCombo4:"仙人掌组合四",Hibiscus:"木槿",Hosta:"玉簪",Hydrangea:"绣球花",Peony:"牡丹",RedRose:"红玫瑰",Spirea:"绣线菊",Sunflower:"向日葵",TallBush:"高灌木",Tulip:"郁金香",WhiteFlower:"白花",YellowFlower:"黄花"},people:{Jaah:"贾阿",Jack:"杰克",Jacob:"雅各布",Jacqueline:"杰奎琳",Jade:"美玉",Jamelia:"洁米莉雅",James:"詹姆斯",Jane:"简",Jaya:"佳娅",Jaye:"杰伊",Jeanette:"珍妮特",Jedi:"杰迪",Jeff:"杰夫",Jena:"珍娜",Jennifer:"珍尼弗",Jess:"杰西",Jett:"杰特",Jill:"吉尔",Jiya:"吉娅",Joan:"琼",Jocelyn:"乔斯林",Joel:"乔尔",Joey:"乔伊",John:"约翰",Jonathon:"乔纳森",Jose:"何塞",Joseph:"约瑟夫",Joshua:"约书亚",Judd:"贾德",Judy:"朱蒂",Julia:"朱莉娅",Julio:"胡里奥",Jumapili:"祖玛匹莉",June:"准卫",Juro:"朱诺",Justin:"贾斯汀"},compass:{N:"北",S:"南",W:"西",E:"东"},month:{January:"一月",February:"二月",March:"三月",April:"四月",May:"五月",June:"六月",July:"七月",August:"八月",September:"九月",October:"十月",November:"十一月",December:"十二月"},modelsMap:{AllTime:"全部时间",SearchByPublisher:"按发布者搜索",SearchByLabel:"按标签搜索",MyPublishedModels:"我发布的模型",TotalNumberOfUserPublishedModelsInSelectedPeriod:"选定时间段用户发布的模型总数",AllTimeTotal:"全部时间用户发布的模型总数",SortFromOldestToNewest:"从早到晚排序",SortFromNewestToOldest:"从晚到早排序",SitesFound:"个位置",ModelsFoundOnThisSite:"个模型在此位置",ShowModelsPublishedByThisAuthor:"展示此用户发布的模型"}}},ppt={translation:{name:{IFI:"未來智能研究所",Aladdin:"阿拉丁",Tagline:"阿拉丁: 探索人工智慧時代的設計軟體 — 未來智能研究所研發"},cookie:{Statement:"聲明:為了改善您的用戶體驗,阿拉丁採用cookie儲存少量數據。",Accept:"同意"},aboutUs:{ProductBroughtToYouBy:"未來智能研究所榮譽出品",TermsOfService:"服務條款",PrivacyPolicy:"隱私政策",Software:"軟體",Content:"課件",Research:"研究",Support:"服務",Acknowledgment:"鳴謝",FundingInformation:"本產品的研發承蒙美國國家科學基金會慷慨資助(項目號#2105695,#2131097,#2301164)。本產品的任何觀點或結論僅代表創作者個人意見。",Contact:"如您需要更多資訊,請聯繫 Charles Xie (charles@intofuture.org)。我們會盡快回复。",Translators:"翻譯"},word:{BrandName:"品牌",Name:"名字",Refresh:"刷新",LastUpdate:"上一次更新",Small:"小",Medium:"中",Large:"大",Design:"設計",Information:"資訊",Type:"類别",Text:"文字",FontSize:"字體大小",FontColor:"字體顏色",Model:"模型",Models:"模型",Upload:"上傳",ClickCount:"點擊數",Share:"分享",AlreadyLike:"已點贊",Like:"點贊",MustLogInToLike:"必須登錄才能點贊",AllRightsReserved:"版權所有",MeterAbbreviation:"米",VoltAbbreviation:"伏",AmpereAbbreviation:"安",WattAbbreviation:"瓦",Version:"版本",VersionInitial:"版本",Options:"選項",Maximum:"最大",Minimum:"最小",MaximumNumber:"最多",MinimumNumber:"最少",MaximumValue:"最大值",MinimumValue:"最小值",Or:"或",None:"無",High:"高",Partial:"部分",Teacher:"老師",Class:"班級",Total:"總數",Leaderboard:"用戶排行榜",Latest:"最新",Range:"範圍",SIUnit:"國際單位制",USUnit:"美國單位制",ThermalTransmittance:"熱透過率",ThermalResistance:"熱阻",UValue:"U值",RValue:"R值",VolumetricHeatCapacity:"容積熱容",BuildingHVACSystem:"建築物暖通空調系統",ThermostatSetpoint:"恆溫器設定值",TemperatureToleranceThreshold:"溫度忍耐閾值",TemperatureToleranceThresholdExplanation:`當日最低外面溫度高於恆溫器設定值減去此閾值,暖氣不開。 當日最高外面溫度低於恆溫器設定值加上此閾值,空調不開。`,Press:"按",Open:"打開",Save:"保存",SaveAsImage:"保存為圖像",SaveAsCsv:"保存為CSV",Update:"刷新",Paste:"粘貼",Copy:"複製",Cut:"剪切",Delete:"删除",Add:"添加",Lock:"固定",Translucent:"半透明",Transparency:"透明度",Color:"顏色",Pattern:"圖案",Texture:"材質",Thickness:"厚度",Size:"尺寸",Yes:"是",No:"不",OK:"確定",Cancel:"取消",Apply:"應用",Close:"關閉",ApplyTo:"適用於",Run:"運行",Pause:"暫停",Resume:"繼續",Clear:"清空",Warning:"警告",Caution:"小心",Reminder:"提醒",Length:"長度",Width:"寬度",Height:"高度",Radius:"半徑",Angle:"角度",Azimuth:"方位角",Coordinates:"坐標",Weather:"天氣",Show:"顯示",Animate:"動畫",Date:"日期",Time:"時間",Title:"標題",Owner:"所有者",Action:"操作",Rename:"改名",Location:"位置",Latitude:"緯度",Month:"月份",Day:"天",Hour:"小時",Daylight:"白天長度",Radiation:"輻射",Temperature:"温度",kWh:"千瓦時",dollar:"元",MeterPerSecond:"米/秒",NorthInitial:"北",SouthInitial:"南",EastInitial:"東",WestInitial:"西",Fixed:"固定",Elements:"部件",Energy:"能量",Unknown:"未知",Label:"標籤",Description:"描述",NoDescription:"無描述",MaximumCharacters:"最多字符數",Author:"作者",Publisher:"發布者",Building:"建築",ResidentialBuilding:"住宅建築",CommercialBuilding:"商用建築",SchoolBuilding:"學校建築",TouristAttraction:"旅遊景點",UnderConstruction:"在建",Photovoltaic:"光伏",WindPower:"風能",ColocationProjects:"共用空間專案",Anonymous:"無名氏",Nickname:"别名",Pin:"置頂",Unpin:"解除置頂"},shared:{NoTexture:"無材質",FoundationElement:"地基",CuboidElement:"長方體",PolygonElement:"多邊形",SensorElement:"傳感器",SolarPanelElement:"光伏板",SolarWaterHeaterElement:"太陽能熱水器",ParabolicDishElement:"拋物線碟",ParabolicTroughElement:"拋物線槽",FresnelReflectorElement:"菲涅耳反射鏡",HeliostatElement:"定日鏡",WindTurbineElement:"風力渦輪機",LightElement:"電燈",ElementLocked:"固定",ModelType:"模型類别",OutputBreakdown:"分列發電量",MoreResults:"更多結果"},message:{NewVersionAvailable:"有新版本",CalculationMayBeSlowDoYouWantToContinue:"計算可能會很慢。您想繼續嗎?",IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp:"加大太陽輻射熱圖網格的尺寸可加速",ModelNotFound:"沒有找到模型",CannotSignIn:"登錄失敗",CannotSignOut:"退出失敗",YourAccountWasCreated:"成功建立您的賬號。",CannotCreateAccount:"無法創建賬號",YourAccountSettingsWereSaved:"您的賬號設定已保存。",CannotSaveYourAccountSettings:"您的賬號設定無法保存",CannotSaveYourFileToCloud:"無法保存您的文檔到雲端",CannotCreateNewProject:"無法創建新專案",CannotCreateNewProjectWithoutTitle:"沒有標題, 無法創建新專案",CannotOpenYourProjects:"無法打開您的專案列表",CannotOpenProject:"無法打開專案",CannotDeleteProject:"無法刪除專案",CannotRenameProject:"無法給專案改名",CannotAddDesignToProject:"無法把此設計加到專案裡",CannotAddDesignToProjectOwnedByOthers:"不能把此設計加到別人的專案裡",DesignRemovedFromProject:"設計被成功地從專案裡刪除",CannotRemoveDesignFromProject:"無法把此設計從專案裡刪除",CannotUpdateProject:"無法更新專案",CannotFetchProjectData:"無法取得專案數據",TitleUsedChooseDifferentOne:"此標題已經被使用, 請採用不同的標題",CloudFileWithTitleExistsDoYouWantToOverwrite:"使用此標題的雲文檔已經存在,您確定要覆蓋它嗎?",CloudFileNotFound:"找不到此云端文檔",CannotLoadModelsOnMap:"無法下載地圖上的模型",CannotLoadLeaderboard:"無法下載排行榜",CannotPublishModelOnMap:"模型無法發佈到地圖上",CannotLikeModelFromMap:"無法點贊地圖上的模型",CannotDeleteModelFromMap:"無法删除地圖上的模型",ModelDeletedFromMap:"模型已從地圖上刪除",DoYouWantToDeleteModelFromMap:"您要删除地圖上的這個模型嗎?",CannotOpenCloudFile:"此云端文檔無法打開",CannotReadCloudFile:"無法讀取此云端文檔",CannotWriteCloudFile:"無法存儲此云端文檔",CloudFileCopied:"拷貝云端文檔",CannotOpenCloudFolder:"您的雲端文檔夾無法打開",CannotDeleteCloudFile:"無法刪除此云端文檔",CannotRenameCloudFile:"此云端文檔的名字無法更改",DoYouWantToSaveChanges:"您要保存當前文檔嗎?",NotApplicableToSelectedAction:"此值不適用於當前選擇範圍",ThisElementIsLocked:"這個部件被鎖定。",ThisCannotBeUndone:"這個操作一旦執行就不能撤銷。",AzimuthOfNorthIsZero:"正北的方位角為零度",CounterclockwiseAzimuthIsPositive:"逆時針為正",SouthFacingIsZero:"朝南為零度",ClockwiseRotationIsPositive:"順時針為正",MoveCancelledBecauseOfOverlap:"位置重疊,移動取消。",MoveOutsideBoundaryCancelled:"位置出界,移動取消。",RotationCancelledBecauseOfOverlap:"位置重疊,旋轉取消。",RotationOutsideBoundaryCancelled:"位置出界,旋轉取消。",ResizingCancelledBecauseOfOverlap:"位置重疊,尺寸調整取消。",ResizingOutsideBoundaryCancelled:"位置出界,尺寸調整取消。",CannotPasteOutsideBoundary:"位置出界,不能複制。",CannotPasteBecauseOfOverlap:"位置重疊,不能複制。",CannotMoveObjectTooFar:"位置太遠,移動取消。",ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout:"採用新佈局之前必須移除現有的光伏板。",DoYouWantToContinue:"您想繼續嗎?",SolarPanelsCannotIntersectWithGround:"光伏板不能和地面接觸。",SolarPanelsCannotOverlapWithOneAnother:"光伏板不能重疊。",ScreenshotSaved:"截屏圖片保存在下載文檔夾裡。",CsvFileSaved:"CSV保存在下載文檔夾裡。",SimulationStarted:"模擬開始。",SimulationCompleted:"模擬結束。",SimulationAborted:"模擬取消。",SimulationPaused:"模擬暫停。",CancelSimulation:"取消模擬",PauseSimulation:"暫停模擬",ResumeSimulation:"繼續模擬",SimulationWillNotStartDueToErrors:"由於錯誤模擬無法運行",SimulationWillStartDespiteWarnings:"發現問題,但模擬仍然將運行。",EvolutionStarted:"演化開始。",EvolutionCompleted:"演化結束。",EvolutionAborted:"演化取消。",EvolutionPaused:"演化暫停。",EncounterEvolutionError:"演化出錯。",CancelEvolution:"取消演化",PauseEvolution:"暫停演化",ResumeEvolution:"繼續演化",ConvergenceThresholdHasBeenReached:"收斂閾值已達到。",MaximumNumberOfGenerationsHasBeenReached:"最大世代數已達到。",MaximumNumberOfStepsHasBeenReached:"最大步數已達到。",ObjectiveFunctionTypeError:"此操作不支持當前的目標函數。請從菜單啟動此功能。",WallsAreNotAtSameHeight:"墻體高度不同。",WallsAreNotPerpendicular:"墻體不垂直。",WallsAreNotConnected:"墻體不相連。",WallsNumberNeedToBeFour:"墻體數量必須為四個。",BuildingContainsEmptyWall:"建築物有空牆。",BuildingRoofMissing:"建築物沒有屋頂。",UnknownErrors:"未知錯誤。",SigningOutAnonymousAccount:"你確定退出嗎?一旦退出,此匿名帳號將不可恢復。"},menu:{AnalysisOptions:"分析選項",option:{GridCellSize:"計算網格的尺寸",SamplingFrequency:"採樣頻率",TimesPerHour:"每小時採樣次數",DaysPerYear:"每一年採樣天數"},mainMenu:"主菜單",cloudMenu:"雲菜單",projectSubMenu:"專案",project:{CreateNewProject:"創建新專案",OpenProject:"打開專案",SaveProject:"保存專案",SaveProjectAs:"另存專案為",YouMustLogInToCreateProject:"您必須登錄才能創建專案",YouMustLogInToOpenProject:"您必須登錄才能打開專案"},fileSubMenu:"文檔",file:{CreateNewFile:"創建新文檔",OpenLocalFile:"打開本地文檔",SaveAsLocalFile:"保存為本地文檔",SavingAbortedMustHaveValidFileName:"文檔名無效,保存失敗",OpenCloudFile:"打開雲端文檔",SaveCloudFile:"保存雲端文檔",SaveAsCloudFile:"另存雲端文檔為",SavingAbortedMustHaveValidTitle:"雲端文檔名無效,保存失敗",ToSaveYourWorkPleaseSignIn:"為了保存您的雲端文檔,請先登錄。",TakeScreenshot:"截屏",UseCloudFileName:"採用雲端文件名",PublishOnModelsMap:"發佈到地圖上",PublishedOnModelsMap:"您的模型成功發佈到地圖上",UpdatedOnModelsMap:"您的模型更新成功",YouMustLogInToPublishYourModel:"您必須登錄才能發布模型",YouCannotPublishAModelThatYouDoNotOwn:"您不能發布他人的模型",YouMustSaveModelOnCloudBeforePublishingIt:"您必須先把此模型保存在雲端才能發布它"},editSubMenu:"編輯",edit:{Undo:"撤銷",Redo:"重做"},viewSubMenu:"視界",view:{NavigationView:"導航模式",TwoDimensionalView:"二維模式",ResetView:"重置視角",ZoomIn:"放大",ZoomOut:"縮小",AutoRotate:"自動旋轉",ShowShadow:"顯示陰影",ShowSurfaceShininess:"顯示表面光澤",TranslucentFloatingWindows:"透明浮動窗口",accessoriesSubMenu:"配件",accessories:{SiteInformation:"位置資訊",DesignInformation:"設計資訊",Instruction:"操作說明",StickyNote:"便簽",Note:"便簽"}},settingsSubMenu:"設置",settings:{WeatherData:"氣象數據",DiurnalTemperature:"晝夜溫度",Heliodon:"日影儀",SunAndTime:"太陽和時間",CustomSolarPanels:"客製化的光伏板",CustomizeSolarPanel:"客製化光伏板"},benchmarksSubMenu:"基準",benchmarks:{SolarRadiationPredictionVsMeasurement:"太陽能輻射模型預測和實際測量的對比",BESTESTCase600:"建築物能耗模擬測試:BESTEST案例600",BESTESTCase610:"建築物能耗模擬測試:BESTEST案例610",BESTESTCase620:"建築物能耗模擬測試:BESTEST案例620",BESTESTCase630:"建築物能耗模擬測試:BESTEST案例630"},graph:{LineWidth:"線條寬度",SymbolSize:"符號大小",BarCategoryGap:"直條間隙",ShowHorizontalGridLines:"顯示格子的水平線條",ShowVerticalGridLines:"顯示格子的豎直線條"},analysisSubMenu:"分析",physicsSubMenu:"物理",physics:{DailySolarRadiationHeatmap:"當日太陽輻射總量分佈熱圖",SolarRadiationHeatmapOptions:"太陽輻射熱圖選項",SolarRadiationHeatmapGridCellSize:"太陽輻射熱圖網格的尺寸",SolarRadiationHeatmapMaxValue:"太陽輻射熱圖最大值",SolarRadiationHeatmapNoAnimation:"若無移動部件則省略動畫",ReflectionHeatmap:"反射熱圖"},sensorSubMenu:"傳感器",sensor:{CollectDailyData:"收集當天數據",CollectYearlyData:"收集全年數據",SensorSimulationNoAnimation:"若無移動部件則省略動畫"},buildingSubMenu:"建築物",building:{AnalyzeDailyBuildingEnergy:"建築物當天能耗分析",AnalyzeYearlyBuildingEnergy:"建築物全年能耗分析",EnergyAnalysisOptions:"能耗分析選項",EnergyGridCellSize:"計算網格的尺寸",BuildingEnergySimulationNoAnimation:"若無移動部件則省略動畫"},solarPanelSubMenu:"太陽能光伏板",solarPanel:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出",AnalyzeVisibility:"分析可見度",PanelDiscretization:"光伏板離散化方法",Exact:"準確",Approximate:"近似",EnergyGridCellSize:"計算網格的尺寸",VisibilityGridCellSize:"視界因子計算網格的尺寸",EnergyAnalysisOptions:"能量分析選項",VisibilityAnalysisOptions:"可見度分析選項",SolarPanelSimulationNoAnimation:"若無移動部件則省略動畫"},parabolicTroughSubMenu:"拋物線槽",parabolicTrough:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},parabolicDishSubMenu:"拋物線碟",parabolicDish:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},fresnelReflectorSubMenu:"菲涅爾反射鏡",fresnelReflector:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},heliostatSubMenu:"定日鏡",heliostat:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出"},solarUpdraftTowerSubMenu:"太陽能上升氣流塔",solarUpdraftTower:{AnalyzeDailyYield:"分析當天產出",AnalyzeYearlyYield:"分析全年產出",SolarUpdraftTowerSimulationNoAnimation:"若無移動部件則省略動畫"},tutorialsSubMenu:"教程",solarEnergyScienceSubMenu:"太陽能科學",solarEnergyScienceTutorials:{SunAngles:"太陽相對於地面觀察者的角度",InsolationAndClimate:"太陽輻射和氣候的關係",SolarRadiationToBox:"一個長方體受到的太陽能輻射分析"},buildingScienceSubMenu:"建築科學",buildingScienceTutorials:{ThermalEnvelopeVsBuildingEnvelope:"房屋的熱學封套和圍護封套",EffectOfSizeOnBuildingEnergy:"房屋大小對能耗的影響",EffectOfOrientationOnBuildingEnergy:"房屋方位對能耗的影響",EffectOfInsulationOnBuildingEnergy:"房屋隔熱對能耗的影響",EffectOfRoofColorOnBuildingEnergy:"屋頂顏色對建築物能耗的影響",EffectOfEavesOverhangLengthOnBuildingEnergy:"屋簷延伸長度對建築物能耗的影響",EffectOfWindowSHGCOnBuildingEnergy:"窗戶太陽能輸入對房屋能耗的影響",EffectOfThermostatSetpointOnBuildingEnergy:"恆溫器設定值對房屋能耗的影響",EffectOfSolarPanelsOnBuildingEnergy:"光伏板對房屋能耗的影響",EffectOfGroundTemperatureOnBuildingEnergy:"地表温度對房屋能耗的影響",EffectOfTreesOnBuildingEnergy:"樹蔭對房屋能耗的影響"},buildingDesignSubMenu:"建築設計",buildingDesignTutorials:{CapeCodStyleHouseWithShedDormer:"有棚頂窗的科德角風格的住宅",MansardRoofWithDormers:"有天窗的折線屋頂",GableRoofVsHipRoof:"雙坡屋頂和四坡屋顶的對比",ColonialVsSaltbox:"殖民地風格和鹽盒風格的對比",GambrelRoofVsMansardRoof:"复斜屋顶和折線屋頂的對比",CombinationRoofVsBonnetRoof:"組合屋頂和帽簷屋頂的對比",DutchGableRoof:"荷蘭雙坡屋頂",GableAndValleyRoof:"坡谷屋頂",ClerestoryRoof:"天窗屋頂",MonitorRoof:"採光屋頂",AFrameHouse:"A字形房子",HalfTimberedHouse:"半木骨架房子",AllBasicRoofTypes:"所有的基本屋頂類型"},photovoltaicSolarPowerSubMenu:"光伏發電",photovoltaicSolarPowerTutorials:{EffectOfTiltAngleOfSolarPanel:"光伏板傾斜角對發電量的影響",EffectOfAzimuthOfSolarPanel:"光伏板方位角對發電量的影響",SolarPanelTypes:"光伏板類型",DefineYourOwnSolarPanels:"定義自己的光伏板",VerticalBifacialSolarPanels:"豎直的雙面光伏板",CompareMonofacialAndBifacialSolarPanels:"單面光伏板和雙面光伏板的對比",SolarTrackers:"自動追日器",CoveringGroundWithSolarPanels:"為什麼我們不簡單地用光伏板覆蓋地面",InterRowSpacingOfSolarPanelArray:"光伏板陣列行間距對發電量的影響",EffectOfOrientationOfSolarPanels:"光伏板排列方向對發電量的影響",SolarPanelArrayAutomaticLayout:"光伏板自動排列"},concentratedSolarPowerSubMenu:"光熱發電",concentratedSolarPowerTutorials:{EffectOfAzimuthOfParabolicTrough:"拋物線槽方位角對發電量的影響",EffectOfLatusRectumOfParabolicTrough:"拋物線槽通徑對發電量的影響",FocusSunlightWithParabolicDish:"用拋物線碟聚焦阳光",LinearFresnelReflectors:"用直線式菲涅爾反射鏡聚焦阳光",EffectOfAbsorberPipeHeightForLinearFresnelReflectors:"吸熱管的安装高度對直線式菲涅爾反射鏡發電量的影響",EffectOfAzimuthOfLinearFresnelReflectors:"直線式菲涅爾反射鏡方位角對發電量的影響",LinearFresnelReflectorsWithTwoAbsorbers:"配備兩個吸收管的直線式菲涅爾反射鏡陣列",CosineEfficiencyOfHeliostats:"定日鏡的餘弦效率",ShadowingAndBlockingOfHeliostats:"定日鏡的陰影和遮擋",EffectSolarPowerTowerHeight:"吸收塔高度對發電量的影響",SolarPowerTower:"塔式光熱發電站"},otherTypesOfSolarPowerSubMenu:"其它類型的太陽能發電",otherTypesOfSolarPowerTutorials:{SolarWaterHeaters:"太陽能熱水器",SolarUpdraftTower:"太陽能上升氣流塔"},windPowerSubMenu:"風力發電",windPowerTutorials:{EffectOfBladeNumberOfWindTurbine:"轉子葉片的數目對風力渦輪機輸出的影響",EffectOfPitchAngleOfWindTurbineBlades:"轉子葉片的俯仰角對風力渦輪機輸出的影響",BirdSafeBladeDesign:"對鳥類安全的葉片設計",OffshoreWindFarm:"離岸風電場"},colocationSubMenu:"共用空間項目",colocationTutorials:{AgricultureSolarWindColocation:"農業光電風力共用空間"},generativeDesignSubMenu:"生成式設計",generativeDesignTutorials:{MonofacialSolarPanelArrayTiltAngle:"單面光伏板陣列的傾斜角",BifacialSolarPanelArrayTiltAngle:"雙面光伏板陣列的傾斜角",OutputOfSolarPanelArrayInDifferentPlaces:"一個光伏板陣列在不同地區的產出",SimpleSolarFarmParetoFront:"簡單太陽能農場設計的帕累托前沿"},examplesSubMenu:"例子",solarEnergySubMenu:"太陽能",solarEnergyExamples:{SunBeamAndHeliodon:"太陽光束和日影儀",RooftopSolarPanels:"屋頂光伏板",NevadaSolarOneParabolicTroughArray:"內華達州太陽能一號的拋物線槽陣列",TooeleParabolicDishArray:"猶他州圖埃勒的拋物線碟陣列",PS10SolarPowerTower:"西班牙塞維利亞的PS10太陽能發電塔",TucsonLinearFresnelReflectors:"亞利桑那州圖森的直線式菲涅爾反射鏡陣列",SolarCanopyFormFactors:"太陽能天篷外形設計",SolarCanopyOverBleachers:"看台太陽能天篷",SolarCanopyOverGarage:"車庫太陽能天篷",SolarBusStop:"太陽能候車亭",SolarFacadeTesla:"特斯拉光伏牆",BuildingIntegratedPhotovoltaics:"建築整合光伏",Floatovoltaics:"浮動光伏",Agrivoltaics:"農業光伏",VegetativeBuffer:"太陽能農場绿化带",RainbowSwashSolarFarmBostonMA:"馬薩諸塞州波士頓彩虹激流旁邊的光伏板陣列",MickeyMouseSolarFarmOrlandoFL:"佛羅里達州奧蘭多的米老鼠形狀光伏板陣列",SolarPanelsOverCanalBakersfieldCA:"加利福尼亞州貝克斯菲爾德灌溉渠上假想的光伏板陣列",SolarNoiseBarrierLexingtonMA:"馬薩諸塞州列剋星敦高速公路噪音牆上假想的光伏板",HSATSolarTrackersRaleighNC:"北卡羅來納州羅利的一個水平方向單軸旋轉追日光伏板陣列(HSAT)",AADATSolarTrackersLancasterCA:"加利福尼亞州蘭開斯特的一個雙軸旋轉追日光伏板陣列(AADAT)",SolarTrackersInRealWorld:"模擬",SolarUpdraftTowerInCity:"太陽能上升氣流塔在城市中的應用"},builtEnvironmentSubMenu:"建造環境",residentialBuildingsSubMenu:"住宅建築",residentialBuildingExamples:{ColonialHouse:"殖民地風格的住宅",DutchColonialHouse:"荷蘭殖民地風格的住宅",TShapedHouse:"T字型房子",CapeCodHouseWithGarage:"有車庫的科德角風格的住宅",Solarium:"有日光浴室的房子",Church1:"教堂例一",Cathedral1:"主教座堂例一",Cathedral2:"主教座堂例二",Mosque1:"清真寺例一",AdobeTaosHouse:"陶斯土坯房",RanchHouse:"牧場風格的住宅",BonnetHouse:"有帽簷屋頂的住宅",BarnStyleHouse:"穀倉式風格的住宅",ModernHouse:"現代風格的住宅",ButterflyRoofHouse:"蝴蝶型屋頂的住宅"},commercialBuildingsSubMenu:"商用建築",commercialBuildingExamples:{WhiteHouse:"白宫",HaroldWashingtonCollege:"哈羅德華盛頓學院",BilimMersinTurkiye:"土耳其梅爾辛科學教育中心",SpanishStyleHotel:"西班牙風格旅館",ApartmentBuilding:"公寓樓",OfficeBuilding:"寫字樓",Hotel:"旅館"},buildingComplexesSubMenu:"建築群",buildingComplexExamples:{SouthBurlingtonHighSchoolVermont:"佛蒙特州南伯靈頓高中",MescaleroApacheSchoolNewMexico:"新墨西哥州梅斯卡勒羅阿帕奇學校"},urbanPlanningSubMenu:"城市規劃",urbanPlanningExamples:{CityBlockHeatmap:"城市街區熱圖",ChicagoSkyline:"芝加哥天際線"},otherBuildingsSubMenu:"其它建築",otherBuildingExamples:{Greenhouse:"溫室",Pavilion:"公園的亭子",OctagonalPagoda:"八角塔",OceanFront:"海邊",EgyptianPyramids:"埃及金字塔",MayanPyramid:"瑪雅金字塔",SiOSePol:"三十三孔橋",StackedCuboids:"堆砌長方體"},artificialIntelligenceSubMenu:"人工智慧",artificialIntelligenceExamples:{OptimizingTiltAngleOfOneSolarPanelRow:"優化單排光伏板的傾斜角",OptimizingTiltAnglesOfMultipleSolarPanelRows:"優化多排光伏板的傾斜角",SolarFarmGenerativeDesign:"生成式設計太陽能農場",SolarFarmGenerativeDesignWithBlock:"生成式設計太陽能農場:周邊有建築物的情況",FitchburgSolarFarmGenerativeDesign:"生成式設計太陽能農場:真實世界案例"},languageSubMenu:"語言",publicSubMenu:"公共",ModelsGallery:"模型畫廊",ModelsMap:"模型地圖",AboutUs:"關於我們"},avatarMenu:{AccountSettings:"賬號設定",PrivacyStatementTitle:"用戶隱私權保護聲明",PrivacyStatement:"登錄需要採用您的谷歌ID建立或進入您的阿拉丁賬戶。 我們只儲存一個隨機的字符串作為您的ID。 任何關於您的可辨識的個人信息都沒有被收集。 詳情請參考我們的",SignIn:"登錄",SignInAsMe:"實名登錄",SignInAnonymously:"匿名登錄",SignOut:"退出賬號",IfYouAreAStudent:"如果您是一個學生"},skyMenu:{Axes:"顯示坐標軸",Theme:"環境主題",ThemeDefault:"默認",ThemeDesert:"沙漠",ThemeDune:"沙丘",ThemeForest:"森林",ThemeGrassland:"草原",ThemeHill:"丘陵",ThemeLake:"湖泊",ThemeMountain:"山脈",ThemeRural:"田園",SunlightAttenuationCoefficientInAir:"陽光在空氣中傳播的衰減係數",ConvectiveCoefficientOfAir:"空氣對流傳熱係數",HighestTemperatureTimeInMinutes:"最高氣溫時間(分鐘)",SelectSunAnglesToShow:"選擇太陽角度顯示",ShowAzimuthAngle:"顯示方位角",ShowElevationAngle:"顯示高度角",ShowZenithAngle:"顯示天頂角",DirectLightBrightnessAtNoon:"正午直射光照度",AmbientLightBrightnessAtNoon:"正午環境光照度"},groundMenu:{MonthlyIrradianceLoss:"月份輻射度損失比",Vegetation:"植被",LeafOutDay:"樹葉長出的日子",LeafOffDay:"樹葉脫落的日子",Albedo:"反照率",ImageOnGround:"地面顯示圖像",WaterSurface:"水面",RemoveAllUnlockedTrees:"刪除所有非固定的樹木",RemoveAllUnlockedFlowers:"删除所有非固定的花草",RemoveAllUnlockedSolarPanels:"删除所有非固定的光伏板",RemoveAllUnlockedPeople:"删除所有非固定的人物",RemoveAllUnlockedFoundations:"删除所有非固定的地基",RemoveAllUnlockedCuboids:"删除所有非固定的長方體",DoYouReallyWantToRemoveAllPeople:"你確定刪除所有非固定的人物嗎",DoYouReallyWantToRemoveAllTrees:"你確定刪除所有非固定的樹木嗎",DoYouReallyWantToRemoveAllFlowers:"你確定刪除所有非固定的花草嗎",DoYouReallyWantToRemoveAllSolarPanels:"你確定刪除所有非固定的光伏板嗎",DoYouReallyWantToRemoveAllFoundations:"你確定刪除所有非固定的地基嗎",DoYouReallyWantToRemoveAllCuboids:"你確定刪除所有非固定的長方體嗎",LockAllUnlockedElements:"固定所有非固定的部件",UnlockAllLockedElements:"解除所有的固定"},labelSubMenu:{Label:"標籤",LabelText:"標籤的内容",LabelHeight:"標籤的高度",LabelSize:"標籤的大小",LabelFontSize:"字體的大小",LabelColor:"標籤的顏色",KeepShowingLabel:"顯示標籤"},foundationMenu:{RemoveAllUnlockedSolarPanels:"刪除此地基上所有非固定的光伏板",RemoveAllUnlockedParabolicTroughs:"刪除此地基上所有非固定的拋物線槽",RemoveAllUnlockedParabolicDishes:"刪除此地基上所有非固定的拋物線碟",RemoveAllUnlockedFresnelReflectors:"刪除此地基上所有非固定的菲涅耳反射鏡",RemoveAllUnlockedHeliostats:"刪除此地基上所有非固定的定日鏡",RemoveAllUnlockedWindTurbines:"刪除此地基上所有非固定的風力渦輪機",RemoveAllUnlockedSensors:"刪除此地基上所有非固定的傳感器",RemoveAllUnlockedLights:"刪除此地基上所有非固定的電燈",RemoveAllUnlockedWalls:"刪除此地基上所有非固定的牆",RemoveAllUnlockedWindows:"刪除此地基上所有非固定的窗戶",RemoveAllUnlockedDoors:"刪除此地基上所有非固定的門",RemoveAllUnlockedPolygons:"刪除此地基上所有非固定的多邊形",RemoveAllUnlockedHumans:"刪除此地基上所有非固定的人物",RemoveAllUnlockedTrees:"刪除此地基上所有非固定的樹木",RemoveAllUnlockedFlowers:"刪除此地基上所有非固定的花草",Racks:"支架",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",SolarPanels:"光伏板",SolarPanelArray:"光伏板陣列",DoYouReallyWantToRemoveAllSolarPanelsOnFoundation:"你確定刪除此地基上所有非固定的光伏板嗎",ParabolicTroughs:"拋物線槽",DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation:"你確定刪除此地基上所有非固定的拋物線槽嗎",ParabolicDishes:"拋物線碟",DoYouReallyWantToRemoveAllParabolicDishesOnFoundation:"你確定刪除此地基上所有非固定的拋物線碟嗎",FresnelReflectors:"菲涅耳反射鏡",DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation:"你確定刪除此地基上所有非固定的菲涅耳反射鏡嗎",Heliostats:"定日鏡",DoYouReallyWantToRemoveAllHeliostatsOnFoundation:"你確定刪除此地基上所有非固定的定日鏡嗎",WindTurbines:"風力渦輪機",DoYouReallyWantToRemoveAllWindTurbinesOnFoundation:"你確定刪除此地基上所有非固定的風力渦輪機嗎",Sensors:"傳感器",DoYouReallyWantToRemoveAllSensorsOnFoundation:"你確定刪除此地基上所有非固定的傳感器嗎",Lights:"電燈",DoYouReallyWantToRemoveAllLightsOnFoundation:"你確定刪除此地基上所有非固定的電燈嗎",Walls:"牆",DoYouReallyWantToRemoveAllWallsOnFoundation:"你確定刪除此地基上所有非固定的牆嗎",Windows:"窗戶",DoYouReallyWantToRemoveAllWindowsOnFoundation:"你確定刪除此地基上所有非固定的窗戶嗎",Doors:"門",DoYouReallyWantToRemoveAllDoorsOnFoundation:"你確定刪除此地基上所有非固定的門嗎",Polygons:"多邊形",DoYouReallyWantToRemoveAllPolygonsOnFoundation:"你確定刪除此地基上所有非固定的多邊形嗎",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnFoundation:"你確定刪除此地基上所有非固定的人物嗎",Trees:"樹木",DoYouReallyWantToRemoveAllTreesOnFoundation:"你確定刪除此地基上所有非固定的樹木嗎",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnFoundation:"你確定刪除此地基上所有非固定的花草嗎",OnlyThisFoundation:"只這塊地基",AllConnectedFoundations:"所有相連的地基",AllSelectedFoundations:"所有選中的地基",AllFoundations:"所有的地基",AddPolygon:"添加多邊形",SolarStructure:"太陽能構型",GroupMaster:"主地基",LockAllUnlockedElementsOnThisFoundation:"固定此地基上所有非固定的部件",UnlockAllLockedElementsOnThisFoundation:"解除此地基上所有的固定",GroundFloorRValue:"建築物地板的R值",OnlyThisGroundFloor:"只這個建築物的地板",AllGroundFloors:"所有建築物的地板"},solarPowerTowerMenu:{ReceiverTowerForHeliostats:"和定日鏡配套的吸收塔",ReceiverTowerPhysicalProperties:"太陽能吸收塔的物理性質",ReceiverTowerHeight:"太陽能吸收塔的高度",ReceiverTowerRadius:"太陽能吸收塔的半徑",ReceiverAbsorptance:"太陽能吸收器的吸收率",ReceiverOpticalEfficiency:"太陽能吸收器的光效率",ReceiverThermalEfficiency:"太陽能吸收器的熱效率"},solarAbsorberPipeMenu:{AbsorberPipeForFresnelReflectors:"和菲涅爾反射鏡配套的吸收管",AbsorberPipePhysicalProperties:"太陽能吸收管的物理性質",AbsorberHeight:"太陽能吸收管的安装高度",AbsorberApertureWidth:"太陽能吸收管的孔徑",AbsorberPipePoleNumber:"太陽能吸收管的支柱數量",AbsorberAbsorptance:"太陽能吸收管的吸收率",AbsorberOpticalEfficiency:"太陽能吸收管的光效率",AbsorberThermalEfficiency:"太陽能吸收管的熱效率"},solarUpdraftTowerMenu:{SolarUpdraftTower:"太陽能上升氣流塔",SolarUpdraftTowerPhysicalProperties:"太陽能上升氣流塔的物理性質",SolarUpdraftTowerChimneyHeight:"太陽能上升氣流塔煙囪的高度",SolarUpdraftTowerChimneyRadius:"太陽能上升氣流塔煙囪的半徑",SolarUpdraftTowerCollectorHeight:"太陽能上升氣流塔集熱棚的高度",SolarUpdraftTowerCollectorRadius:"太陽能上升氣流塔集熱棚的半徑",SolarUpdraftTowerCollectorTransmissivity:"太陽能上升氣流塔集熱棚的透射率",SolarUpdraftTowerCollectorEmissivity:"太陽能上升氣流塔集熱棚的發射率",SolarUpdraftTowerDischargeCoefficient:"太陽能上升氣流塔的流量係數",SolarUpdraftTowerTurbineEfficiency:"太陽能上升氣流塔的渦輪機效率"},cuboidMenu:{Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",RemoveAllUnlockedSolarPanels:"刪除此長方體表面上所有非固定的光伏板",RemoveAllUnlockedSensors:"刪除此長方體表面上所有非固定的傳感器",RemoveAllUnlockedPolygons:"刪除此長方體表面上所有非固定的多邊形",RemoveAllUnlockedHumans:"刪除此長方體表面上所有非固定的人物",RemoveAllUnlockedTrees:"刪除此長方體表面上所有非固定的樹木",RemoveAllUnlockedFlowers:"刪除此長方體表面上所有非固定的花草",RemoveAllUnlockedLights:"刪除此長方體表面上所有非固定的電燈",Racks:"支架",Lights:"電燈",DoYouReallyWantToRemoveAllLightsOnCuboid:"你確定刪除此長方體表面上所有非固定的電燈嗎",SolarPanels:"光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnCuboid:"你確定刪除此長方體表面上所有非固定的光伏板嗎",Sensors:"傳感器",DoYouReallyWantToRemoveAllSensorsOnCuboid:"你確定刪除此長方體表面上所有非固定的傳感器嗎",Polygons:"多邊形",DoYouReallyWantToRemoveAllPolygonsOnCuboid:"你確定刪除此長方體表面上所有非固定的多邊形嗎",Humans:"人物",DoYouReallyWantToRemoveAllHumansOnCuboid:"你確定刪除此長方體表面上所有非固定的人物嗎",Trees:"樹木",DoYouReallyWantToRemoveAllTreesOnCuboid:"你確定刪除此長方體表面上所有非固定的樹木嗎",Flowers:"花草",DoYouReallyWantToRemoveAllFlowersOnCuboid:"你確定刪除此長方體表面上所有非固定的花草嗎",OnlyThisCuboid:"只這個長方體",AllCuboidsOnSameSurface:"同一表面上所有的長方體",AllCuboidsAboveSameBase:"同一地基上所有的長方體",AllSelectedCuboids:"所有選中的長方體",AllCuboids:"所有的長方體",OnlyThisSide:"只這個表面",AllSidesOfThisCuboid:"這個長方體所有的側面",AllSidesOfSelectedCuboids:"所有選中長方體所有的側面",AllSidesOfAllCuboids:"所有的長方體所有的側面",AddPolygon:"添加多邊形",Stackable:"可堆砌",GroupMaster:"主長方體"},polygonMenu:{Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",TextBox:"文字框",FontOutlineColor:"字體輪廓顏色",FontOutlineWidth:"字體輪廓線寬",FontStrokeColor:"字體描邊顏色",FontStrokeWidth:"字體描邊線寬",NoOutline:"無輪廓線",Shiny:"光澤",Filled:"填充",FillTexture:"填充材質",FillColor:"填充顏色",Opacity:"遮光度",LineColor:"線條顏色",LineWidth:"線條寬度",LineStyle:"線條樣式",SolidLine:"實線",DashedLine:"虛線",DottedLine:"點線",InsertVertexBeforeIndex:"前面插入頂點",InsertVertexAfterIndex:"後面插入頂點",DeleteVertex:"移除頂點",OnlyThisPolygon:"只這個多邊形",AllPolygonsOnSurface:"同一表面上所有的多邊形",AllPolygonsAboveFoundation:"同一地基上所有的多邊形",AllSelectedPolygons:"所有選中的多邊形",AllPolygons:"所有的多邊形",Layout:"佈局",SolarPanelArrayLayout:"光伏板陣列佈局",SolarPanelArrayLayoutParametricDesign:"光伏板陣列佈局參數化設計",SolarPanelArrayLayoutGenerativeDesign:"光伏板陣列佈局生成式設計",SolarPanelArrayModel:"光伏板型號",SolarPanelArrayOrientation:"排列方向",SolarPanelArrayTiltAngle:"傾斜角度",SolarPanelArrayRowWidth:"行寬度",SolarPanelArrayInterRowSpacing:"行間距",SolarPanelArrayRowSpacing:"行間距",SolarPanelArrayRowAxis:"行軸方向",SolarPanelArrayLeftRightRowAxis:"左右方向(相對)",SolarPanelArrayUpDownRowAxis:"上下方向(相對)",SolarPanelArrayEastWestRowAxis:"東西方向(絕對)",SolarPanelArrayNorthSouthRowAxis:"南北方向(絕對)",SolarPanelArrayMargin:"邊緣餘地",SolarPanelArrayPoleHeight:"支架高度",SolarPanelArrayPoleSpacing:"支柱間隔",SolarPanelArrayTotalYearlyCost:"全年總成本",SolarPanelArrayTotalYearlyRevenue:"全年總收入",SolarPanelArrayTotalYearlyYield:"全年總發電量",SolarPanelArrayMeanYearlyYield:"平均年發電量",SolarPanelArrayYearlyProfit:"全年利潤",LayoutNotAcceptedCheckYourParameters:"恕不能採用此佈局。請檢查您的參數設置。"},optimizationMenu:{Optimization:"優化",Parameters:"參數",Variables:"變量",Constants:"常量",GeneticAlgorithm:"遺傳算法",GeneticAlgorithmSettings:"遺傳算法設定",ParticleSwarmOptimization:"粒子群優化",ParticleSwarmOptimizationSettings:"粒子群優化設定",SolarPanelTiltAngleOptimization:"光伏板傾斜角度優化",SolarPanelArrayLayout:"光伏板陣列佈局",Generation:"世代",Gene:"基因",NormalizedVariables:"標準化變量",Objective:"目標函數",ObjectiveFunctionDailyTotalYield:"當日總產出",ObjectiveFunctionYearlyTotalYield:"全年總產出",ObjectiveFunctionDailyMeanYield:"當日平均產出",ObjectiveFunctionYearlyMeanYield:"全年平均產出",ObjectiveFunctionDailyProfit:"當日利潤",ObjectiveFunctionYearlyProfit:"全年利潤",GeneticAlgorithmSelectionMethod:"遺傳算法選擇方法",RouletteWheel:"輪盤制",Tournament:"淘汰制",SearchMethod:"搜索方法",GlobalSearchUniformSelection:"全局搜索均勻取樣",LocalSearchRandomOptimization:"局部搜索隨機優化",PopulationSize:"種群個體數目",MaximumGenerations:"最大世代數目",SelectionRate:"選擇概率",CrossoverRate:"交配概率",MutationRate:"突變概率",Step:"步數",SwarmSize:"粒子數目",MaximumSteps:"最大步數",MaximumVelocity:"最大速度",InertiaWeight:"慣性權重",CognitiveCoefficient:"認知係數",SocialCoefficient:"社會係數",ConvergenceThreshold:"終止條件的收斂閾值",LocalSearchRadius:"局部搜索的半徑",RowsPerRackRange:"單個支架上光伏板行數的變化範圍",TiltAngleRange:"光伏板傾斜角度的變化範圍",InterRowSpacingRange:"光伏板陣列行間距的變化範圍",ClickTargetPolygonToActivate:"點擊目標多邊形激活",ClickTargetFoundationToActivate:"點擊目標地基激活"},treeMenu:{ShowModel:"顯示近似模型",Flip:"翻轉",Type:"樹種",Spread:"樹冠直徑"},flowerMenu:{Flip:"翻轉",Type:"品種",Spread:"直徑"},peopleMenu:{ChangePerson:"改變人物",Flip:"轉身",Observer:"觀察者",ViewFromThisPerson:"視角移到此人位置"},lightMenu:{Color:"顏色",Intensity:"亮度",Decay:"衰减",MaximumDistance:"最大距離",Inside:"内部"},solarCollectorMenu:{Coordinates:"座標",RelativeXCoordinateOfCenter:"中心的相對X座標",RelativeYCoordinateOfCenter:"中心的相對Y座標",RelativeAzimuth:"相對方位角",Pole:"支柱",PoleHeight:"支柱高度",PoleRadius:"支柱半徑",ExtraPoleHeight:"額外的支柱高度",ExtraPoleHeightInAdditionToHalfWidth:"寬度一半額外的支柱高度",DrawSunBeam:"顯示光束"},concentratedSolarPowerCollectorMenu:{ReflectorReflectance:"反射器鏡面反射率",ReceiverAbsorptance:"接收器吸收率",ReflectorOpticalEfficiency:"反射器光效率",ReceiverThermalEfficiency:"接收器熱效率"},solarWaterHeaterMenu:{OnlyThisSolarWaterHeater:"只這個太陽能熱水器",AllSolarWaterHeatersOnSurface:"同一表面上所有的太陽能熱水器",AllSolarWaterHeatersAboveFoundation:"同一地基上所有的太陽能熱水器",AllSelectedSolarWaterHeaters:"所有選中的太陽能熱水器",AllSolarWaterHeaters:"所有的太陽能熱水器"},solarPanelMenu:{ElectricalProperties:"電氣特性",InverterEfficiency:"逆變器效率",InverterEfficiencyExplained:"直流電轉換為交流電的效率。",DcToAcSizeRatio:"直流-交流容量比例",DcToAcSizeRatioExplained:"直流電容量和交流電容量的比例。",ChangePvModel:"改變光伏板型號",Orientation:"排列方向",Portrait:"縱向",Landscape:"橫向",FrameColor:"框架顏色",Panels:"塊",PanelsWide:"塊光伏板寬",PanelsLong:"塊光伏板長",TiltAngle:"傾斜角度",SouthFacingIsPositive:"朝南為正",Tracker:"追日系統",SolarTrackerFollowsSun:"追日系統提高光伏板產出。",PoleSpacing:"支柱間隔",NoTracker:"無追日系統",HorizontalSingleAxisTracker:"水平單軸追日系統",VerticalSingleAxisTracker:"豎直單軸追日系統",AltazimuthDualAxisTracker:"地平雙軸追日系統",OnlyThisSolarPanel:"只這個光伏板",AllSolarPanelsOnSurface:"同一表面上所有的光伏板",AllSolarPanelsAboveFoundation:"同一地基上所有的光伏板",AllSelectedSolarPanels:"所有選中的光伏板",AllSolarPanels:"所有的光伏板"},pvModelPanel:{SolarPanelSpecs:"光伏板型號性能",General:"概況",Electrical:"電力",CellCountInXDirection:"X方向電池數目",CellCountInYDirection:"Y方向電池數目",Weight:"重量",Kilogram:"公斤",RatedVoltage:"額定電壓",RatedCurrent:"額定電流",OpenCircuitVoltage:"開路電壓",ShortCircuitCurrent:"短路電流",MaximumRatedPower:"最大額定功率",Model:"型號",PanelSize:"尺寸",Cells:"電池組",CellType:"光伏電池類型",Monocrystalline:"單晶矽",Polycrystalline:"多晶矽",ThinFilm:"薄膜",Bifacial:"雙面",PowerBifaciality:"功率雙面性因子(背面對正面)",Black:"黑色",Blue:"藍色",ShadeTolerance:"陰影耐受度",SolarCellEfficiency:"光伏電池效率",NominalOperatingCellTemperature:"名義電池運行溫度",TemperatureCoefficientOfPmax:"Pmax溫度係數",AddedCustomSolarPanels:"已有",DisplayThisCustomSolarPanel:"展示這個客製化光伏板",ExportThisCustomSolarPanel:"輸出此客製化光伏板",ImportCustomSolarPanelFromClipboard:"從系統剪切板輸入客製化光伏板數據",CustomSolarPanelExportedToClipboard:"客製化光伏板拷貝到剪貼板",DoYouReallyWantToRemoveThisCustomSolarPanel:"你確定刪除此客製化光伏板",MakeSureThisCustomSolarPanelIsNotUsed:"刪除之前請確認此客製化光伏板沒有被當前模型採用",ThisCustomSolarPanelIsUsed:"此客製化光伏板被當前模型採用",DoYouReallyWantToImportCustomSolarPanel:"你確定輸入客製化光伏板",ExistingSettingsWillBeOverwritten:"現有的設定將被取代",CannotAddCustomSolarPanel:"無法添加此客製化光伏板",CustomSolarPanelMustHaveModelName:"客製化光伏板必須要有型號",CustomSolarPanelExists:"目前文件已經定義了此名字的客製化光伏板",FailInImportingDataFromClipboard:"從系統剪切板輸入資料失敗",NoNeedToAddThisCustomSolarPanel:"無需定義此光伏板",SolarPanelModelAlreadyProvidedBySystem:"系統已提供此光伏板"},parabolicTroughMenu:{ModuleLength:"模塊長度",Modules:"模塊",ModulesLong:"模塊長",LatusRectum:"通徑",OnlyThisParabolicTrough:"只這個拋物線槽",AllParabolicTroughsAboveFoundation:"同一地基上所有的拋物線槽",AllSelectedParabolicTroughs:"所有選中的抛物线槽",AllParabolicTroughs:"所有的拋物線槽"},fresnelReflectorMenu:{AbsorberPipe:"吸收管",SelectAbsorberToReflectSunlightTo:"選擇陽光反射到的吸收管",ModuleLength:"模塊長度",Modules:"模塊",ModulesLong:"模塊長",OnlyThisFresnelReflector:"只這個菲涅耳反射鏡",AllFresnelReflectorsAboveFoundation:"同一地基上所有的菲涅耳反射鏡",AllSelectedFresnelReflectors:"所有選中的菲涅耳反射镜",AllFresnelReflectors:"所有的菲涅耳反射鏡"},heliostatMenu:{Tower:"吸收塔",SelectTowerToReflectSunlightTo:"選擇陽光反射到的吸收塔",OnlyThisHeliostat:"只這個定日鏡",AllHeliostatsAboveFoundation:"同一地基上所有的定日鏡",AllSelectedHeliostats:"所有選中的定日镜",AllHeliostats:"所有的定日鏡"},parabolicDishMenu:{ReceiverStructure:"接收器結構",CentralPole:"中心直柱",CentralPoleWithTripod:"三腳架和中心直柱",Quadrupod:"四脚架",RimDiameter:"外圈直徑",LatusRectum:"通徑",ExtraPoleHeightInAdditionToRadius:"半徑之外額外的支架高度",OnlyThisParabolicDish:"只這個拋物線碟",AllParabolicDishesAboveFoundation:"同一地基上所有的拋物線碟",AllSelectedParabolicDishes:"所有選中的抛物线碟",AllParabolicDishes:"所有的拋物線碟"},windTurbineMenu:{BirdSafeDesign:"鳥類安全設計",BirdSafeNone:"無",BirdSafeBicolor:"雙色",BirdSafeStriped:"條紋",Rotor:"轉子",BladeNumber:"葉片數目",RotorInitialAngle:"轉子初始角度",RotorBladeDesign:"轉子葉片設計",RotorBladeRadius:"轉子葉片半徑",RotorBladePitchAngle:"轉子葉片俯仰角",RelativeYawAngle:"相對偏流角",MaximumChordLength:"最大弦長度",Tower:"塔架",TowerHeight:"塔架高度",TowerRadius:"塔架半徑",HubDesign:"轉子輪轂設計",HubRadius:"輪轂半徑",HubLength:"輪轂長度",OnlyThisWindTurbine:"只這個風力渦輪機",AllWindTurbinesAboveFoundation:"同一地基上所有的風力渦輪機",AllSelectedWindTurbines:"所有選中的風力渦輪機",AllWindTurbines:"所有的風力渦輪機"},wallMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",SizeOfWall:"牆的尺寸",OnlyThisWall:"只這堵牆",AllConnectedWalls:"所有連接的牆",AllWallsAboveFoundation:"同一地基上所有的牆",AllSelectedWalls:"所有選中的墙",AllWalls:"所有的牆",Windows:"窗戶",LockAllUnlockedWindows:"固定所有非固定的窗戶",UnlockAllLockedWindows:"解除所有的窗戶固定",RemoveAllUnlockedWindows:"刪除這堵牆上所有非固定的窗戶",DoYouReallyWantToRemoveAllWindowsOnThisWall:"你確定刪除這堵牆上所有非固定的窗戶嗎",Doors:"門",LockAllUnlockedDoors:"固定所有非固定的門",UnlockAllLockedDoors:"解除所有的門固定",RemoveAllUnlockedDoors:"刪除這堵牆上所有非固定的門",DoYouReallyWantToRemoveAllDoorsOnThisWall:"你確定刪除這堵牆上所有非固定的門嗎",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"刪除這堵牆上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisWall:"你確定刪除這堵牆上所有非固定的光伏板嗎",Sensors:"傳感器",LockAllUnlockedSensors:"固定所有非固定的傳感器",UnlockAllLockedSensors:"解除所有的傳感器固定",RemoveAllUnlockedSensors:"刪除這堵牆上所有非固定的傳感器",DoYouReallyWantToRemoveAllSensorsOnThisWall:"你確定刪除這堵牆上所有非固定的傳感器嗎",Lights:"電燈",LockAllUnlockedLights:"固定這堵牆上所有非固定的電燈",UnlockAllLockedLights:"解除這堵牆上所有的電燈固定",RemoveAllUnlockedLights:"刪除這堵牆上所有非固定的電燈",DoYouReallyWantToRemoveAllLightsOnThisWall:"你確定刪除這堵牆上所有非固定的電燈嗎",Polygons:"多邊形",LockAllUnlockedPolygons:"固定這堵牆上所有非固定的多邊形",UnlockAllLockedPolygons:"解除這堵牆上所有的多邊形固定",RemoveAllUnlockedPolygons:"刪除這堵牆上所有非固定的多邊形",DoYouReallyWantToRemoveAllPolygonsOnThisWall:"你確定刪除這堵牆上所有非固定的多邊形嗎",WallStructure:"牆結構",DefaultStructure:"默認",StudStructure:"牆柱",PillarStructure:"圓柱",Opacity:"遮光度",StructureSpacing:"結構間距",StructureWidth:"結構寬度",StructureThickness:"結構厚度",StructureColor:"結構颜色",Color:"牆体颜色",Height:"高度",Thickness:"厚度",Texture:"材質",AllLightsOnWallInside:"所有電燈在牆內",AllLightsOnWallOutside:"所有電燈在牆外",Fill:"填充",Full:"全部",Partial:"部分",Empty:"空白",OpenToOutside:"對外面開放",EavesLength:"屋簷延伸長度",Parapet:"女牆",ParapetColor:"女牆颜色",ParapetTexture:"女牆材質",ParapetHeight:"女牆高度",CopingsHeight:"頂蓋高度",CopingsWidth:"頂蓋寬度"},windowMenu:{OnlyThisWindow:"只這個窗戶",AllWindowsOnSurface:"同一表面上所有的窗戶",AllWindowsAboveFoundation:"同一地基上所有的窗戶",AllSelectedWindows:"所有選中的窗户",AllWindows:"所有的窗戶",Width:"寬度",Height:"高度",Setback:"離牆體外表面的距離",RelativeToWallThickness:"相對於牆的厚度",Mullion:"直櫺",HorizontalMullion:"水平的直櫺",VerticalMullion:"豎直的直櫺",MullionWidth:"直櫺寬度",HorizontalMullionSpacing:"水平直櫺的間距",VerticalMullionSpacing:"豎直直櫺的間距",MullionColor:"直櫺颜色",Tint:"著色",Opacity:"不透明度",SolarHeatGainCoefficient:"太陽輻射熱獲取係數(SHGC) = 1 - 不透明度",Shutter:"百葉窗",LeftShutter:"左側百葉窗",RightShutter:"右側百葉窗",BothShutters:"兩側百葉窗",ShutterWidth:"相對寬度",ShutterColor:"百葉窗顏色",Frame:"邊框",FrameWidth:"邊框寬度",SillWidth:"窗台寬度",Color:"邊框顔色",WindowType:"窗戶種類",Default:"默認",Arched:"拱形",Polygonal:"多邊形",Interior:"内窗",Empty:"空白"},roofMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",OnlyThisRoof:"只這個屋顶",AllRoofsAboveFoundation:"同一地基上所有的屋顶",AllSelectedRoofs:"所有選中的屋顶",AllRoofs:"所有的屋顶",OnlyThisCeiling:"只這個天花板",AllCeilingsAboveFoundation:"同一地基上所有的天花板",AllCeilings:"所有的天花板",EavesOverhangLength:"屋簷延伸長度",RafterSpacing:"屋椽間距",RafterWidth:"屋椽寬度",RafterThickness:"屋椽厚度",RafterColor:"屋椽颜色",RoofColor:"屋顶颜色",RoofSideColor:"屋顶側面颜色",GlassTint:"玻璃顏色",Opacity:"遮光度",RoofStructure:"屋頂結構",DefaultStructure:"默認",RafterStructure:"屋椽",GlassStructure:"玻璃",SolarPanels:"光伏板",LockAllUnlockedSolarPanels:"固定所有非固定的光伏板",UnlockAllLockedSolarPanels:"解除所有的光伏板固定",RemoveAllUnlockedSolarPanels:"刪除這個屋顶上所有非固定的光伏板",DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof:"你確定刪除這個屋顶上所有非固定的光伏板嗎",Windows:"天窗",LockAllUnlockedWindows:"固定所有非固定的天窗",UnlockAllLockedWindows:"解除所有的天窗固定",RemoveAllUnlockedWindows:"刪除這個屋顶上所有非固定的天窗",DoYouReallyWantToRemoveAllWindowsOnThisRoof:"你確定刪除這個屋顶上所有非固定的天窗嗎",Sensors:"傳感器",LockAllUnlockedSensors:"固定所有非固定的傳感器",UnlockAllLockedSensors:"解除所有的傳感器固定",RemoveAllUnlockedSensors:"刪除這個屋顶上所有非固定的傳感器",DoYouReallyWantToRemoveAllSensorsOnThisRoof:"你確定刪除這個屋顶上所有非固定的傳感器嗎",Lights:"電燈",RemoveAllUnlockedLights:"刪除這個屋顶上所有非固定的電燈",DoYouReallyWantToRemoveAllLightsOnThisRoof:"你確定刪除這個屋顶上所有非固定的電燈嗎",AllLightsOnRoofInside:"所有電燈在屋頂內",AllLightsOnRoofOutside:"所有電燈在屋頂外",Rise:"相對高度",Ceiling:"天花板",RoofRValue:"屋顶R值",CeilingRValue:"天花板R值"},doorMenu:{TextureDefault:"默認材質",Texture01:"一號材質",Texture02:"二號材質",Texture03:"三號材質",Texture04:"四號材質",Texture05:"五號材質",Texture06:"六號材質",Texture07:"七號材質",Texture08:"八號材質",Texture09:"九號材質",Texture10:"十號材質",Texture11:"十一號材質",Texture12:"十二號材質",Texture13:"十三號材質",Texture14:"十四號材質",Texture15:"十五號材質",Texture16:"十六號材質",Texture17:"十七號材質",OnlyThisDoor:"只這個門",AllDoorsOnWall:"同一面牆上所有的門",AllDoorsAboveFoundation:"同一地基上所有的門",AllSelectedDoors:"所有選中的门",AllDoors:"所有的門",DoorType:"門種類",Default:"默認",Arched:"拱形",Filled:"填充",FrameColor:"門框顏色",Interior:"內門"},siteInfoPanel:{High:"最高溫度",Low:"最低温度"},designInfoPanel:{NumberOfSelectedHeliostats:"選中的定日鏡總數",NumberOfSelectedSolarPanels:"選中的光伏板總數",ElectricityGeneratedDailyBySolarPanels:"這些光伏板的日發電量",SceneDiameter:"場景直徑",BuildingArea:"建築面積"},visualizationControlPanel:{ColorContrast:"熱圖顏色對比度",FluxScale:"熱通量長度",ClickUpOrDownArrowButtonsToChange:"點擊上下箭頭改變參數"},instructionPanel:{Rotate:"旋轉",DragMouse:"拖動滑鼠",Zoom:"缩放",MouseWheelOrKeys:"滑鼠滾輪或者Ctrl+[和Ctrl+]",MouseWheelOrKeysMac:"滑鼠滾輪或者⌘+[和⌘+]",Pan:"平移",HoldCtrlDragMouse:"按下Ctrl鍵並拖動滑鼠",HoldMetaDragMouse:"按下⌘鍵並拖動滑鼠",Enter2DMode:"進入二維模式",Exit2DMode:"退出二維模式",NavigationMode:"導航模式",EnableNavigation:"進入導航模式",DisableNavigation:"退出導航模式",MoveForwardBack:"前後移動",MoveForwardBackInstruction:"按W/S鍵",MoveLeftRight:"左右移動",MoveLeftRightInstruction:"按A/D鍵",MoveUpDown:"上下移動",MoveUpDownInstruction:"按Z/X鍵",Turn:"拐彎",TurnInstruction:"按方向鍵",ResetView:"重置視角",AutoRotate:"自動旋轉",StartOrStop:"按F4鍵啟動或停止"},mapPanel:{ImageOnGround:"地面顯示圖像",HideAddress:"隱藏地址",WeatherStations:"氣象站",WeatherStationsNote:"關閉此選項以提高地圖速度",Coordinates:"經緯度坐標",Zoom:"放大程度"},visibilityPanel:{SolarPanelVisibility:"光伏板對觀察者的可見度",Observer:"觀察者",VantagePoint:"觀察位置",ItemizedVisibilityByFields:"每個場的可見度",TotalVisibility:"總可見度"},sensorPanel:{LightSensor:"光傳感器",WeatherDataFrom:"氣象數據來自"},buildingEnergyPanel:{DailyBuildingEnergy:"建築物日能耗",YearlyBuildingEnergy:"建築物年能耗",Heater:"暖氣",AC:"空調",SolarPanel:"光伏",Net:"淨能耗"},solarPanelYieldPanel:{SolarPanelDailyYield:"光伏日發電量",SolarPanelYearlyYield:"光伏年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualSolarPanels:"顯示每行光伏板單獨發電量",Profit:"利潤",TotalCost:"總成本",TotalRevenue:"總收入",TotalYield:"總發電量",MeanYield:"平均發電量",ModuleCount:"光伏板總數"},parabolicTroughYieldPanel:{ParabolicTroughDailyYield:"拋物線槽日發電量",ParabolicTroughYearlyYield:"拋物線槽年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualParabolicTroughs:"顯示每行拋物線槽單獨發電量"},parabolicDishYieldPanel:{ParabolicDishDailyYield:"拋物線碟日發電量",ParabolicDishYearlyYield:"拋物線碟年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualParabolicDishes:"顯示每個拋物線碟單獨發電量"},fresnelReflectorYieldPanel:{FresnelReflectorDailyYield:"菲涅耳反射鏡日發電量",FresnelReflectorYearlyYield:"菲涅耳反射鏡年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualFresnelReflectors:"顯示每個菲涅耳反射鏡單獨發電量"},heliostatYieldPanel:{HeliostatDailyYield:"定日鏡日發電量",HeliostatYearlyYield:"定日鏡年發電量",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualHeliostats:"顯示每個定日鏡單獨發電量"},updraftTowerYieldPanel:{UpdraftTowerDailyYield:"太陽能上升氣流塔日發電量",UpdraftTowerYearlyYield:"太陽能上升氣流塔年發電量",ChimneyAirTemperature:"煙囪空氣溫度",ChimneyWindSpeed:"煙囪風速",Yield:"發電量",YieldPerHour:"每小時發電量",DailyTotal:"日發電總量",YearlyTotal:"年發電總量",ShowOutputsOfIndividualUpdraftTowers:"顯示每個太陽能上升氣流塔單獨發電量"},heliodonPanel:{SunAndTimeSettings:"太陽和時間設置",SunAngles:"角度",TwentyFourHours:"24小時"},cloudFilePanel:{CopyTitle:"拷貝標題",TitleCopiedToClipBoard:"標題拷貝到剪貼板",SearchByTitle:"按標題搜索",MyLikes:"我喜歡的模型",MyCloudFiles:"我的雲文件",GenerateLink:"生成鏈接",LinkGeneratedInClipBoard:"鏈接生成到剪貼板",DoYouReallyWantToDelete:"您確定刪除此文檔",IfSharedOrPublishedRenamingFileBreaksExistingLinks:"如果此文檔已被分享或發布, 改名會使已有鏈接失效"},projectListPanel:{CopyTitle:"拷貝標題",TitleCopiedToClipBoard:"標題拷貝到剪貼板",SearchByTitle:"按標題搜索",MyProjects:"我的專案",GenerateProjectLink:"生成專案鏈接",ProjectLinkGeneratedInClipBoard:"專案鏈接生成到剪貼板",DoYouReallyWantToDeleteProject:"您確定刪除專案",IfSharedOrPublishedRenamingProjectBreaksExistingLinks:"如果此專案已被分享或發布, 改名會使已有鏈接失效"},projectPanel:{ProjectSettings:"專案設定",ThumbnailImageSize:"縮略圖大小",ProjectByOtherPeople:"別人的專案",Project:"專案",ProjectType:"類别",ProjectDescription:"描述",MakeDescriptionEditable:"編輯描述",MakeDescriptionNonEditable:"不編輯描述",DoubleClickToMakeDescriptionEditable:"雙擊此描述激活編輯功能",SolarPanelArray:"光伏板陣列設計",CurateCurrentDesign:"收藏當前設計",UpdateSelectedDesign:"更新選中設計",RemoveSelectedDesign:"刪除選中設計",ClickToFlipSortingOrder:"點擊逆轉排序方向",DesignNotShownInSolutionSpaceClickToShow:"此設計目前不顯示在設計空間內,點擊顯示",DesignShownInSolutionSpaceClickToHide:"此設計目前顯示在設計空間內,點擊隱藏",SolutionSpace:"設計空間",ChooseSolutionSpace:"選擇設計空間",ChooseDataColoring:"選擇數據著色",SameColorForAllDesigns:"所有設計一個顏色",OneColorForEachDesign:"每個設計一個顏色",SolutionSpaceScreenshot:"設計空間截屏",ScatterPlotScreenshot:"散點圖截屏",SingleClickToSelectDoubleClickToOpen:"單擊選擇,雙擊打開。",SingleClickToDeselectDoubleClickToOpen:"單擊取消選擇,雙擊打開。",GenerateScatterPlot:"生成散點圖",SelectXAxis:"選擇X軸",SelectYAxis:"選擇Y軸"},accountSettingsPanel:{MyAccountSettings:"我的賬戶設定",MyID:"我的🆔",ClickToCopyMyID:"點擊此處拷貝我的ID",IDInClipBoard:"您現在可以粘貼ID了。",StoreMyNameInMyFilesWhenSaving:"保存文檔時籤上我的大名",DoYouReallyWantToShowYourNameInYourFiles:"您確定在您的文檔裡保存您的大名嗎?",SignFileDisclaimer:"如果您選擇保存,您的大名可能被所有打開您的文檔的人看到。",Likes:"點贊總數",AllPublished:"發佈總數",PublishedUnderAliases:"别名發佈",UserCount:"用戶總數",SchoolID:"學校編號",ClassID:"班級編號"},weatherPanel:{SunshineHours:"日照時間"},diurnalTemperaturePanel:{SelectAirTemperatureModel:"選擇氣溫模型",Sinusoidal:"正弦函數"},economicsPanel:{EconomicsParameters:"經濟學參數",ElectricitySellingPrice:"銷售電價",OperationalCostPerUnit:"單位運行成本",SellingPrice:"銷售電價",UnitCost:"單位成本"},navigationPanel:{NavigationParameters:"導航模式參數",MinimumMoveSpeed:"最小移動速度",MinimumTurnSpeed:"最小拐彎速度"},shadowSettingsPanel:{ShadowSettings:"陰影設定",ShadowCameraFarDistance:"最遠距離",ShadowMapSize:"映射圖長寬",Notes:"注意事項",RefreshPageNote:"改變設定後須刷新頁面。",MapSizeWarning:"大的映射圖長寬可能導致阿拉丁無法在某些電腦上運作。"},yearlyLightSensorPanel:{SkyClearness:"天空清晰度",ShowDaylightResults:"顯示日照時間結果",ShowSkyClearnessResults:"顯示天空清晰度結果",ShowAverageDailySolarRadiation:"顯示日平均輻射結果"},analysisManager:{NoSensorForCollectingData:"沒有傳感器收集數據。",NoSolarPanelForAnalysis:"沒有光伏板可以分析。",NoObserverForVisibilityAnalysis:"沒有找到可見度分析的觀察者。",NoSolarWaterHeaterForAnalysis:"沒有太陽能熱水器可以分析。",NoParabolicDishForAnalysis:"沒有拋物線碟可以分析。",NoParabolicTroughForAnalysis:"沒有拋物線槽可以分析。",NoFresnelReflectorForAnalysis:"沒有菲涅耳反射鏡可以分析。",NoHeliostatForAnalysis:"沒有定日鏡可以分析。",NoSolarUpdraftTowerForAnalysis:"沒有太陽能上升氣流塔可以分析。",NoBuildingForAnalysis:"沒有建築物可以分析。"},toolbar:{CloudFile:"雲文檔",Select:"選擇",AddFoundation:"添加地基",AddWall:"添加牆體",AddWindow:"添加窗戶",AddDoor:"添加門",AddPyramidRoof:"添加金字塔屋頂",AddGableRoof:"添加雙坡屋頂",AddHipRoof:"添加四坡屋顶",AddGambrelRoof:"添加复斜屋顶",AddMansardRoof:"添加折線屋顶",AddCuboid:"添加長方體",AddSensor:"添加傳感器",AddSolarPanel:"添加光伏板",AddSolarWaterHeater:"添加太陽能熱水器",AddBatteryStorage:"添加儲蓄電池",AddParabolicDish:"添加拋物線碟",AddParabolicTrough:"添加拋物線槽",AddFresnelReflector:"添加菲涅耳反射鏡",AddHeliostat:"添加定日鏡",AddWindTurbine:"添加水平轴風力渦輪機",AddVerticalAxisWindTurbine:"添加垂直軸風力渦輪機",AddLight:"添加電燈",AddTree:"添加樹木",AddFlower:"添加花草",AddPeople:"添加人物",DoubleClickToLockThisModeForNextAction:"雙擊按鈕給下個動作鎖定此模式",ClickToUnlockThisModeForNextAction:"點擊按鈕讓動作完成即離開此模式",ManipulateGroup:"整體操作一個組",ClearScene:"清空場景",ShowSunAndTimeSettings:"顯示太陽和時間設置",SpatialAnalysisOfEnergy:"能量的空間分析",DoYouReallyWantToClearContent:"您確定清空場景嗎",ClickForMoreButtons:"點擊此處切換到更多的按鈕模式"},tooltip:{gotoIFI:"訪問未來智能研究所",visitAladdinHomePage:"訪問阿拉丁主頁",clickToOpenMenu:"點擊打開主菜單",clickToAccessAccountSettings:"點擊打開賬號設定"},tree:{Apple:"蘋果樹",Birch:"白樺",Coconut:"椰子樹",Dogwood:"茱萸",Elm:"榆樹",FanPalm:"扇葉棕櫚",Linden:"菩提",Magnolia:"玉蘭",Maple:"楓樹",Oak:"橡樹",Pine:"松樹",Spruce:"雲杉"},flower:{Bellflower:"鈴蘭",Boxwood:"黃楊",CactusCombo1:"仙人掌組合一",CactusCombo2:"仙人掌組合二",CactusCombo3:"仙人掌組合三",CactusCombo4:"仙人掌組合四",Hibiscus:"木槿",Hosta:"玉簪",Hydrangea:"繡球花",Peony:"牡丹",RedRose:"紅玫瑰",Spirea:"繡線菊",Sunflower:"向日葵",TallBush:"高灌木",Tulip:"鬱金香",WhiteFlower:"白花",YellowFlower:"黄花"},people:{Jaah:"賈阿",Jack:"傑克",Jacob:"雅各布",Jacqueline:"杰奎琳",Jade:"美玉",Jamelia:"潔米莉雅",James:"詹姆斯",Jane:"簡",Jaya:"佳婭",Jaye:"傑伊",Jeanette:"珍妮特",Jedi:"傑迪",Jeff:"傑夫",Jena:"珍娜",Jennifer:"珍尼弗",Jess:"傑西",Jett:"傑特",Jill:"吉爾",Jiya:"吉娅",Joan:"瓊",Jocelyn:"喬斯林",Joel:"喬爾",Joey:"喬伊",John:"約翰",Jonathon:"喬納森",Jose:"何塞",Joseph:"約瑟夫",Joshua:"約書亞",Judd:"賈德",Judy:"朱蒂",Julia:"朱莉婭",Julio:"胡里奥",Jumapili:"祖瑪匹莉",June:"準衛",Juro:"朱諾",Justin:"賈斯汀"},compass:{N:"北",S:"南",W:"西",E:"東"},month:{January:"一月",February:"二月",March:"三月",April:"四月",May:"五月",June:"六月",July:"七月",August:"八月",September:"九月",October:"十月",November:"十一月",December:"十二月"},modelsMap:{AllTime:"全部時間",SearchByPublisher:"按發布者搜索",SearchByLabel:"按標籤搜索",MyPublishedModels:"我發布的模型",TotalNumberOfUserPublishedModelsInSelectedPeriod:"選定時間段用戶發布的模型總數",AllTimeTotal:"全部時間用戶發布的模型總數",SortFromOldestToNewest:"從早到晚排序",SortFromNewestToOldest:"從晚到早排序",SitesFound:"個位置",ModelsFoundOnThisSite:"個模型在此位置",ShowModelsPublishedByThisAuthor:"展示此用戶發布的模型"}}},gpt={translation:{name:{IFI:"Instituto de inteligencia futura",Aladdin:"Aladdin",Tagline:"Aladdin: Reimagining Design with Explainable AI — Institute for Future Intelligence"},cookie:{Statement:"Clicando Aceptar, autoriza el uso de cookies para mejora la experiencia con Aladdin",Accept:"Aceptar"},aboutUs:{ProductBroughtToYouBy:"Este producto esta hecho por",TermsOfService:"Términos de servicio",PrivacyPolicy:"Política de privacidad",Software:"Programa",Content:"Contenido",Research:"Investigación",Support:"Ayuda",Acknowledgment:"Agradecimientos",FundingInformation:"La National Science Foundation (NSF) proporcionó generosamente fondos para la investigación y el desarrollo de este producto a través de las subvenciones con número #2105695, #2131097, y #2301164. Sin embargo, todas las opiniones, hallazgos y conclusiones o recomendaciones expresados en este producto pertenecen a los autores y no reflejan necesariamente los puntos de vista de la NSF.",Contact:"Para más información, por favor contacte con Charles Xie (charles@intofuture.org).",Translators:"Translators"},word:{BrandName:"Brand Name",Name:"Name",Refresh:"Refresh",LastUpdate:"Last Update",Small:"Small",Medium:"Medium",Large:"Large",Design:"Design",Information:"Information",Type:"Type",Text:"Text",FontSize:"Font Size",FontColor:"Font Color",Model:"Model",Models:"Models",Upload:"Upload",ClickCount:"Click Count",Share:"Share",AlreadyLike:"Already like",Like:"Like",MustLogInToLike:"Must log in to like",AllRightsReserved:"Todos los derechos reservados",MeterAbbreviation:"m",VoltAbbreviation:"V",AmpereAbbreviation:"A",WattAbbreviation:"W",Version:"Versión",VersionInitial:"V",Options:"Opciones",Maximum:"Maximum",Minimum:"Minimum",MaximumNumber:"Número máximo",MinimumNumber:"Minimum Number",MaximumValue:"Maximum Value",MinimumValue:"Minimum Value",Or:"O",None:"Ninguno",High:"High",Partial:"Partial",Teacher:"Profesor",Class:"Clase",Total:"Total",Leaderboard:"Leaderboard",Latest:"Latest",Range:"Rango",SIUnit:"SI Unit",USUnit:"US Unit",ThermalTransmittance:"Thermal Transmittance",ThermalResistance:"Thermal Resistance",UValue:"U-Value",RValue:"R-Value",VolumetricHeatCapacity:"Volumetric Heat Capacity",BuildingHVACSystem:"Building HVAC System",ThermostatSetpoint:"Thermostat Setpoint",TemperatureToleranceThreshold:"Tolerance Threshold",TemperatureToleranceThresholdExplanation:`Heater will not run if the lowest outside temperature of the day is higher than the setpoint minus this threshold. @@ -76,7 +76,7 @@ AC will not run if the highest outside temperature of the day is lower than the * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const nW="158",uv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},dv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PWe=0,Ose=1,CWe=2,Xpt=3,RWe=0,aq=1,pE=2,l2=3,Da=0,r0=1,ti=2,Jpt=2,k6=0,ux=1,rR=2,Vse=3,_se=4,HWe=5,r8=100,MWe=101,IWe=102,Gse=103,Xse=104,zWe=200,DWe=201,EWe=202,FWe=203,tG=204,nG=205,kWe=206,LWe=207,WWe=208,NWe=209,UWe=210,jWe=211,BWe=212,YWe=213,OWe=214,VWe=0,_We=1,GWe=2,RF=3,XWe=4,JWe=5,KWe=6,qWe=7,oW=0,$We=1,QWe=2,T9=0,ZWe=1,eNe=2,tNe=3,P1e=4,nNe=5,Jse="attached",oNe="detached",lq=300,$6=301,tw=302,HF=303,MF=304,CH=306,bs=1e3,uh=1001,IF=1002,F0=1003,oG=1004,Kpt=1004,gE=1005,qpt=1005,Gs=1006,C1e=1007,$pt=1007,nw=1008,Qpt=1008,P9=1009,rNe=1010,iNe=1011,sq=1012,R1e=1013,T6=1014,v2=1015,_x=1016,H1e=1017,M1e=1018,B8=1020,aNe=1021,Up=1023,lNe=1024,sNe=1025,Y8=1026,Gx=1027,cNe=1028,I1e=1029,uNe=1030,z1e=1031,D1e=1033,HV=33776,MV=33777,IV=33778,zV=33779,Kse=35840,qse=35841,$se=35842,Qse=35843,dNe=36196,Zse=37492,ece=37496,tce=37808,nce=37809,oce=37810,rce=37811,ice=37812,ace=37813,lce=37814,sce=37815,cce=37816,uce=37817,dce=37818,fce=37819,hce=37820,pce=37821,DV=36492,gce=36494,mce=36495,fNe=36283,yce=36284,Ace=36285,wce=36286,hNe=2200,pNe=2201,gNe=2202,zF=2300,DF=2301,EV=2302,Fv=2400,kv=2401,EF=2402,cq=2500,E1e=2501,Zpt=0,e1t=1,t1t=2,F1e=3e3,O8=3001,mNe=3200,k1e=3201,Iw=0,yNe=1,cg="",ou="srgb",W9="srgb-linear",uq="display-p3",rW="display-p3-linear",FF="linear",Ys="srgb",kF="rec709",LF="p3",n1t=0,fv=7680,o1t=7681,r1t=7682,i1t=7683,a1t=34055,l1t=34056,s1t=5386,c1t=512,u1t=513,d1t=514,f1t=515,h1t=516,p1t=517,g1t=518,vce=519,ANe=512,wNe=513,vNe=514,xNe=515,bNe=516,SNe=517,TNe=518,PNe=519,WF=35044,m1t=35048,y1t=35040,A1t=35045,w1t=35049,v1t=35041,x1t=35046,b1t=35050,S1t=35042,T1t="100",xce="300 es",rG=1035,g9=2e3,NF=2001;class e3{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const o=this._listeners;o[e]===void 0&&(o[e]=[]),o[e].indexOf(n)===-1&&o[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const o=this._listeners;return o[e]!==void 0&&o[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const o=this._listeners[e.type];if(o!==void 0){e.target=this;const r=o.slice(0);for(let i=0,a=r.length;i>8&255]+Vf[t>>16&255]+Vf[t>>24&255]+"-"+Vf[e&255]+Vf[e>>8&255]+"-"+Vf[e>>16&15|64]+Vf[e>>24&255]+"-"+Vf[n&63|128]+Vf[n>>8&255]+"-"+Vf[n>>16&255]+Vf[n>>24&255]+Vf[o&255]+Vf[o>>8&255]+Vf[o>>16&255]+Vf[o>>24&255]).toLowerCase()}function h0(t,e,n){return Math.max(e,Math.min(n,t))}function L1e(t,e){return(t%e+e)%e}function P1t(t,e,n,o,r){return o+(t-e)*(r-o)/(n-e)}function C1t(t,e,n){return t!==e?(n-t)/(e-t):0}function mE(t,e,n){return(1-n)*t+n*e}function R1t(t,e,n,o){return mE(t,e,1-Math.exp(-n*o))}function H1t(t,e=1){return e-Math.abs(L1e(t,e*2)-e)}function M1t(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function I1t(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function z1t(t,e){return t+Math.floor(Math.random()*(e-t+1))}function D1t(t,e){return t+Math.random()*(e-t)}function E1t(t){return t*(.5-Math.random())}function F1t(t){t!==void 0&&(m4e=t);let e=m4e+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function k1t(t){return t*dx}function L1t(t){return t*iR}function bce(t){return(t&t-1)===0&&t!==0}function CNe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function iG(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function W1t(t,e,n,o,r){const i=Math.cos,a=Math.sin,l=i(n/2),s=a(n/2),c=i((e+o)/2),u=a((e+o)/2),d=i((e-o)/2),f=a((e-o)/2),p=i((o-e)/2),g=a((o-e)/2);switch(r){case"XYX":t.set(l*u,s*d,s*f,l*c);break;case"YZY":t.set(s*f,l*u,s*d,l*c);break;case"ZXZ":t.set(s*d,s*f,l*u,l*c);break;case"XZX":t.set(l*u,s*g,s*p,l*c);break;case"YXY":t.set(s*p,l*u,s*g,l*c);break;case"ZYZ":t.set(s*g,s*p,l*u,l*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function jp(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function wa(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const RNe={DEG2RAD:dx,RAD2DEG:iR,generateUUID:bg,clamp:h0,euclideanModulo:L1e,mapLinear:P1t,inverseLerp:C1t,lerp:mE,damp:R1t,pingpong:H1t,smoothstep:M1t,smootherstep:I1t,randInt:z1t,randFloat:D1t,randFloatSpread:E1t,seededRandom:F1t,degToRad:k1t,radToDeg:L1t,isPowerOfTwo:bce,ceilPowerOfTwo:CNe,floorPowerOfTwo:iG,setQuaternionFromProperEuler:W1t,normalize:wa,denormalize:jp};class Kt{constructor(e=0,n=0){Kt.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,o=this.y,r=e.elements;return this.x=r[0]*n+r[3]*o+r[6],this.y=r[1]*n+r[4]*o+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const o=this.dot(e)/n;return Math.acos(h0(o,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,o=this.y-e.y;return n*n+o*o}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const o=Math.cos(n),r=Math.sin(n),i=this.x-e.x,a=this.y-e.y;return this.x=i*o-a*r+e.x,this.y=i*r+a*o+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ha{constructor(e,n,o,r,i,a,l,s,c){ha.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,o,r,i,a,l,s,c)}set(e,n,o,r,i,a,l,s,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=l,u[3]=n,u[4]=i,u[5]=s,u[6]=o,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,o=e.elements;return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],this}extractBasis(e,n,o){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const o=e.elements,r=n.elements,i=this.elements,a=o[0],l=o[3],s=o[6],c=o[1],u=o[4],d=o[7],f=o[2],p=o[5],g=o[8],A=r[0],y=r[3],S=r[6],C=r[1],P=r[4],v=r[7],T=r[2],w=r[5],x=r[8];return i[0]=a*A+l*C+s*T,i[3]=a*y+l*P+s*w,i[6]=a*S+l*v+s*x,i[1]=c*A+u*C+d*T,i[4]=c*y+u*P+d*w,i[7]=c*S+u*v+d*x,i[2]=f*A+p*C+g*T,i[5]=f*y+p*P+g*w,i[8]=f*S+p*v+g*x,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8];return n*a*u-n*l*c-o*i*u+o*l*s+r*i*c-r*a*s}invert(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8],d=u*a-l*c,f=l*s-u*i,p=c*i-a*s,g=n*d+o*f+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/g;return e[0]=d*A,e[1]=(r*c-u*o)*A,e[2]=(l*o-r*a)*A,e[3]=f*A,e[4]=(u*n-r*s)*A,e[5]=(r*i-l*n)*A,e[6]=p*A,e[7]=(o*s-c*n)*A,e[8]=(a*n-o*i)*A,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,o,r,i,a,l){const s=Math.cos(i),c=Math.sin(i);return this.set(o*s,o*c,-o*(s*a+c*l)+a+e,-r*c,r*s,-r*(-c*a+s*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(Moe.makeScale(e,n)),this}rotate(e){return this.premultiply(Moe.makeRotation(-e)),this}translate(e,n){return this.premultiply(Moe.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,-o,0,o,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,o=e.elements;for(let r=0;r<9;r++)if(n[r]!==o[r])return!1;return!0}fromArray(e,n=0){for(let o=0;o<9;o++)this.elements[o]=e[o+n];return this}toArray(e=[],n=0){const o=this.elements;return e[n]=o[0],e[n+1]=o[1],e[n+2]=o[2],e[n+3]=o[3],e[n+4]=o[4],e[n+5]=o[5],e[n+6]=o[6],e[n+7]=o[7],e[n+8]=o[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Moe=new ha;function HNe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const N1t={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function KP(t,e){return new N1t[t](e)}function UF(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function MNe(){const t=UF("canvas");return t.style.display="block",t}const y4e={};function yE(t){t in y4e||(y4e[t]=!0,console.warn(t))}const A4e=new ha().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),w4e=new ha().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),mB={[W9]:{transfer:FF,primaries:kF,toReference:t=>t,fromReference:t=>t},[ou]:{transfer:Ys,primaries:kF,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[rW]:{transfer:FF,primaries:LF,toReference:t=>t.applyMatrix3(w4e),fromReference:t=>t.applyMatrix3(A4e)},[uq]:{transfer:Ys,primaries:LF,toReference:t=>t.convertSRGBToLinear().applyMatrix3(w4e),fromReference:t=>t.applyMatrix3(A4e).convertLinearToSRGB()}},U1t=new Set([W9,rW]),us={enabled:!0,_workingColorSpace:W9,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!U1t.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const o=mB[e].toReference,r=mB[n].fromReference;return r(o(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return mB[t].primaries},getTransfer:function(t){return t===cg?FF:mB[t].transfer}};function TC(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ioe(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let aT;class W1e{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{aT===void 0&&(aT=UF("canvas")),aT.width=e.width,aT.height=e.height;const o=aT.getContext("2d");e instanceof ImageData?o.putImageData(e,0,0):o.drawImage(e,0,0,e.width,e.height),n=aT}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=UF("canvas");n.width=e.width,n.height=e.height;const o=n.getContext("2d");o.drawImage(e,0,0,e.width,e.height);const r=o.getImageData(0,0,e.width,e.height),i=r.data;for(let a=0;a0&&(o.userData=this.userData),n||(e.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==lq)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bs:e.x=e.x-Math.floor(e.x);break;case uh:e.x=e.x<0?0:1;break;case IF:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case bs:e.y=e.y-Math.floor(e.y);break;case uh:e.y=e.y<0?0:1;break;case IF:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return yE("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ou?O8:F1e}set encoding(e){yE("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===O8?ou:cg}}Vc.DEFAULT_IMAGE=null;Vc.DEFAULT_MAPPING=lq;Vc.DEFAULT_ANISOTROPY=1;class qa{constructor(e=0,n=0,o=0,r=1){qa.prototype.isVector4=!0,this.x=e,this.y=n,this.z=o,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,o,r){return this.x=e,this.y=n,this.z=o,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,o=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*n+a[4]*o+a[8]*r+a[12]*i,this.y=a[1]*n+a[5]*o+a[9]*r+a[13]*i,this.z=a[2]*n+a[6]*o+a[10]*r+a[14]*i,this.w=a[3]*n+a[7]*o+a[11]*r+a[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,o,r,i;const s=e.elements,c=s[0],u=s[4],d=s[8],f=s[1],p=s[5],g=s[9],A=s[2],y=s[6],S=s[10];if(Math.abs(u-f)<.01&&Math.abs(d-A)<.01&&Math.abs(g-y)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+A)<.1&&Math.abs(g+y)<.1&&Math.abs(c+p+S-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const P=(c+1)/2,v=(p+1)/2,T=(S+1)/2,w=(u+f)/4,x=(d+A)/4,b=(g+y)/4;return P>v&&P>T?P<.01?(o=0,r=.707106781,i=.707106781):(o=Math.sqrt(P),r=w/o,i=x/o):v>T?v<.01?(o=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),o=w/r,i=b/r):T<.01?(o=.707106781,r=.707106781,i=0):(i=Math.sqrt(T),o=x/i,r=b/i),this.set(o,r,i,n),this}let C=Math.sqrt((y-g)*(y-g)+(d-A)*(d-A)+(f-u)*(f-u));return Math.abs(C)<.001&&(C=1),this.x=(y-g)/C,this.y=(d-A)/C,this.z=(f-u)/C,this.w=Math.acos((c+p+S-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this.z=e.z+(n.z-e.z)*o,this.w=e.w+(n.w-e.w)*o,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class INe extends e3{constructor(e=1,n=1,o={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new qa(0,0,e,n),this.scissorTest=!1,this.viewport=new qa(0,0,e,n);const r={width:e,height:n,depth:1};o.encoding!==void 0&&(yE("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===O8?ou:cg),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gs,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Vc(r,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(e,n,o=1){(this.width!==e||this.height!==n||this.depth!==o)&&(this.width=e,this.height=n,this.depth=o,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new Lv(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class $m extends INe{constructor(e=1,n=1,o={}){super(e,n,o),this.isWebGLRenderTarget=!0}}class dq extends Vc{constructor(e=null,n=1,o=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:o,depth:r},this.magFilter=F0,this.minFilter=F0,this.wrapR=uh,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Y1t extends $m{constructor(e=1,n=1,o=1){super(e,n),this.isWebGLArrayRenderTarget=!0,this.depth=o,this.texture=new dq(null,e,n,o),this.texture.isRenderTargetTexture=!0}}class N1e extends Vc{constructor(e=null,n=1,o=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:o,depth:r},this.magFilter=F0,this.minFilter=F0,this.wrapR=uh,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class O1t extends $m{constructor(e=1,n=1,o=1){super(e,n),this.isWebGL3DRenderTarget=!0,this.depth=o,this.texture=new N1e(null,e,n,o),this.texture.isRenderTargetTexture=!0}}class V1t extends $m{constructor(e=1,n=1,o=1,r={}){super(e,n,r),this.isWebGLMultipleRenderTargets=!0;const i=this.texture;this.texture=[];for(let a=0;a=0?1:-1,P=1-S*S;if(P>Number.EPSILON){const T=Math.sqrt(P),w=Math.atan2(T,S*C);y=Math.sin(y*w)/T,l=Math.sin(l*w)/T}const v=l*C;if(s=s*y+f*v,c=c*y+p*v,u=u*y+g*v,d=d*y+A*v,y===1-l){const T=1/Math.sqrt(s*s+c*c+u*u+d*d);s*=T,c*=T,u*=T,d*=T}}e[n]=s,e[n+1]=c,e[n+2]=u,e[n+3]=d}static multiplyQuaternionsFlat(e,n,o,r,i,a){const l=o[r],s=o[r+1],c=o[r+2],u=o[r+3],d=i[a],f=i[a+1],p=i[a+2],g=i[a+3];return e[n]=l*g+u*d+s*p-c*f,e[n+1]=s*g+u*f+c*d-l*p,e[n+2]=c*g+u*p+l*f-s*d,e[n+3]=u*g-l*d-s*f-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,o,r){return this._x=e,this._y=n,this._z=o,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n){const o=e._x,r=e._y,i=e._z,a=e._order,l=Math.cos,s=Math.sin,c=l(o/2),u=l(r/2),d=l(i/2),f=s(o/2),p=s(r/2),g=s(i/2);switch(a){case"XYZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"YXZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"ZXY":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"ZYX":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"YZX":this._x=f*u*d+c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d-f*p*g;break;case"XZY":this._x=f*u*d-c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d+f*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const o=n/2,r=Math.sin(o);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,o=n[0],r=n[4],i=n[8],a=n[1],l=n[5],s=n[9],c=n[2],u=n[6],d=n[10],f=o+l+d;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-s)*p,this._y=(i-c)*p,this._z=(a-r)*p}else if(o>l&&o>d){const p=2*Math.sqrt(1+o-l-d);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+c)/p}else if(l>d){const p=2*Math.sqrt(1+l-o-d);this._w=(i-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+u)/p}else{const p=2*Math.sqrt(1+d-o-l);this._w=(a-r)/p,this._x=(i+c)/p,this._y=(s+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let o=e.dot(n)+1;return oMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=o):(this._x=0,this._y=-e.z,this._z=e.y,this._w=o)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=o),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(h0(this.dot(e),-1,1)))}rotateTowards(e,n){const o=this.angleTo(e);if(o===0)return this;const r=Math.min(1,n/o);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const o=e._x,r=e._y,i=e._z,a=e._w,l=n._x,s=n._y,c=n._z,u=n._w;return this._x=o*u+a*l+r*c-i*s,this._y=r*u+a*s+i*l-o*c,this._z=i*u+a*c+o*s-r*l,this._w=a*u-o*l-r*s-i*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const o=this._x,r=this._y,i=this._z,a=this._w;let l=a*e._w+o*e._x+r*e._y+i*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=o,this._y=r,this._z=i,this;const s=1-l*l;if(s<=Number.EPSILON){const p=1-n;return this._w=p*a+n*this._w,this._x=p*o+n*this._x,this._y=p*r+n*this._y,this._z=p*i+n*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(s),u=Math.atan2(c,l),d=Math.sin((1-n)*u)/c,f=Math.sin(n*u)/c;return this._w=a*d+this._w*f,this._x=o*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,n,o){return this.copy(e).slerp(n,o)}random(){const e=Math.random(),n=Math.sqrt(1-e),o=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(n*Math.cos(r),o*Math.sin(i),o*Math.cos(i),n*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ae{constructor(e=0,n=0,o=0){ae.prototype.isVector3=!0,this.x=e,this.y=n,this.z=o}set(e,n,o){return o===void 0&&(o=this.z),this.x=e,this.y=n,this.z=o,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(v4e.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(v4e.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,o=this.y,r=this.z,i=e.elements;return this.x=i[0]*n+i[3]*o+i[6]*r,this.y=i[1]*n+i[4]*o+i[7]*r,this.z=i[2]*n+i[5]*o+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,o=this.y,r=this.z,i=e.elements,a=1/(i[3]*n+i[7]*o+i[11]*r+i[15]);return this.x=(i[0]*n+i[4]*o+i[8]*r+i[12])*a,this.y=(i[1]*n+i[5]*o+i[9]*r+i[13])*a,this.z=(i[2]*n+i[6]*o+i[10]*r+i[14])*a,this}applyQuaternion(e){const n=this.x,o=this.y,r=this.z,i=e.x,a=e.y,l=e.z,s=e.w,c=2*(a*r-l*o),u=2*(l*n-i*r),d=2*(i*o-a*n);return this.x=n+s*c+a*d-l*u,this.y=o+s*u+l*c-i*d,this.z=r+s*d+i*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,o=this.y,r=this.z,i=e.elements;return this.x=i[0]*n+i[4]*o+i[8]*r,this.y=i[1]*n+i[5]*o+i[9]*r,this.z=i[2]*n+i[6]*o+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this.z=e.z+(n.z-e.z)*o,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const o=e.x,r=e.y,i=e.z,a=n.x,l=n.y,s=n.z;return this.x=r*s-i*l,this.y=i*a-o*s,this.z=o*l-r*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const o=e.dot(this)/n;return this.copy(e).multiplyScalar(o)}projectOnPlane(e){return Doe.copy(this).projectOnVector(e),this.sub(Doe)}reflect(e){return this.sub(Doe.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const o=this.dot(e)/n;return Math.acos(h0(o,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,o=this.y-e.y,r=this.z-e.z;return n*n+o*o+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,o){const r=Math.sin(n)*e;return this.x=r*Math.sin(o),this.y=Math.cos(n)*e,this.z=r*Math.cos(o),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,o){return this.x=e*Math.sin(n),this.y=o,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),o=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=o,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,o=Math.sqrt(1-e**2);return this.x=o*Math.cos(n),this.y=o*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Doe=new ae,v4e=new Ts;class vf{constructor(e=new ae(1/0,1/0,1/0),n=new ae(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,o=e.length;nthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Gy),Gy.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,o;return e.normal.x>0?(n=e.normal.x*this.min.x,o=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,o=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,o+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,o+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,o+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,o+=e.normal.z*this.min.z),n<=-e.constant&&o>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Az),AB.subVectors(this.max,Az),lT.subVectors(e.a,Az),sT.subVectors(e.b,Az),cT.subVectors(e.c,Az),A4.subVectors(sT,lT),w4.subVectors(cT,sT),W7.subVectors(lT,cT);let n=[0,-A4.z,A4.y,0,-w4.z,w4.y,0,-W7.z,W7.y,A4.z,0,-A4.x,w4.z,0,-w4.x,W7.z,0,-W7.x,-A4.y,A4.x,0,-w4.y,w4.x,0,-W7.y,W7.x,0];return!Eoe(n,lT,sT,cT,AB)||(n=[1,0,0,0,1,0,0,0,1],!Eoe(n,lT,sT,cT,AB))?!1:(wB.crossVectors(A4,w4),n=[wB.x,wB.y,wB.z],Eoe(n,lT,sT,cT,AB))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gy).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gy).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Z3[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Z3[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Z3[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Z3[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Z3[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Z3[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Z3[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Z3[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Z3),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Z3=[new ae,new ae,new ae,new ae,new ae,new ae,new ae,new ae],Gy=new ae,yB=new vf,lT=new ae,sT=new ae,cT=new ae,A4=new ae,w4=new ae,W7=new ae,Az=new ae,AB=new ae,wB=new ae,N7=new ae;function Eoe(t,e,n,o,r){for(let i=0,a=t.length-3;i<=a;i+=3){N7.fromArray(t,i);const l=r.x*Math.abs(N7.x)+r.y*Math.abs(N7.y)+r.z*Math.abs(N7.z),s=e.dot(N7),c=n.dot(N7),u=o.dot(N7);if(Math.max(-Math.max(s,c,u),Math.min(s,c,u))>l)return!1}return!0}const _1t=new vf,wz=new ae,Foe=new ae;let s1=class{constructor(e=new ae,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const o=this.center;n!==void 0?o.copy(n):_1t.setFromPoints(e).getCenter(o);let r=0;for(let i=0,a=e.length;ithis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;wz.subVectors(e,this.center);const n=wz.lengthSq();if(n>this.radius*this.radius){const o=Math.sqrt(n),r=(o-this.radius)*.5;this.center.addScaledVector(wz,r/o),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Foe.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(wz.copy(e.center).add(Foe)),this.expandByPoint(wz.copy(e.center).sub(Foe))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const e6=new ae,koe=new ae,vB=new ae,v4=new ae,Loe=new ae,xB=new ae,Woe=new ae;class RH{constructor(e=new ae,n=new ae(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,e6)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const o=n.dot(this.direction);return o<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=e6.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(e6.copy(this.origin).addScaledVector(this.direction,n),e6.distanceToSquared(e))}distanceSqToSegment(e,n,o,r){koe.copy(e).add(n).multiplyScalar(.5),vB.copy(n).sub(e).normalize(),v4.copy(this.origin).sub(koe);const i=e.distanceTo(n)*.5,a=-this.direction.dot(vB),l=v4.dot(this.direction),s=-v4.dot(vB),c=v4.lengthSq(),u=Math.abs(1-a*a);let d,f,p,g;if(u>0)if(d=a*s-l,f=a*l-s,g=i*u,d>=0)if(f>=-g)if(f<=g){const A=1/u;d*=A,f*=A,p=d*(d+a*f+2*l)+f*(a*d+f+2*s)+c}else f=i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;else f=-i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;else f<=-g?(d=Math.max(0,-(-a*i+l)),f=d>0?-i:Math.min(Math.max(-i,-s),i),p=-d*d+f*(f+2*s)+c):f<=g?(d=0,f=Math.min(Math.max(-i,-s),i),p=f*(f+2*s)+c):(d=Math.max(0,-(a*i+l)),f=d>0?i:Math.min(Math.max(-i,-s),i),p=-d*d+f*(f+2*s)+c);else f=a>0?-i:i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;return o&&o.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(koe).addScaledVector(vB,f),p}intersectSphere(e,n){e6.subVectors(e.center,this.origin);const o=e6.dot(this.direction),r=e6.dot(e6)-o*o,i=e.radius*e.radius;if(r>i)return null;const a=Math.sqrt(i-r),l=o-a,s=o+a;return s<0?null:l<0?this.at(s,n):this.at(l,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const o=-(this.origin.dot(e.normal)+e.constant)/n;return o>=0?o:null}intersectPlane(e,n){const o=this.distanceToPlane(e);return o===null?null:this.at(o,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let o,r,i,a,l,s;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(o=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(o=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(i=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(i=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),o>a||i>r||((i>o||isNaN(o))&&(o=i),(a=0?(l=(e.min.z-f.z)*d,s=(e.max.z-f.z)*d):(l=(e.max.z-f.z)*d,s=(e.min.z-f.z)*d),o>s||l>r)||((l>o||o!==o)&&(o=l),(s=0?o:r,n)}intersectsBox(e){return this.intersectBox(e,e6)!==null}intersectTriangle(e,n,o,r,i){Loe.subVectors(n,e),xB.subVectors(o,e),Woe.crossVectors(Loe,xB);let a=this.direction.dot(Woe),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;v4.subVectors(this.origin,e);const s=l*this.direction.dot(xB.crossVectors(v4,xB));if(s<0)return null;const c=l*this.direction.dot(Loe.cross(v4));if(c<0||s+c>a)return null;const u=-l*v4.dot(Woe);return u<0?null:this.at(u/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ki{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){Ki.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y)}set(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){const S=this.elements;return S[0]=e,S[4]=n,S[8]=o,S[12]=r,S[1]=i,S[5]=a,S[9]=l,S[13]=s,S[2]=c,S[6]=u,S[10]=d,S[14]=f,S[3]=p,S[7]=g,S[11]=A,S[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ki().fromArray(this.elements)}copy(e){const n=this.elements,o=e.elements;return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],n[9]=o[9],n[10]=o[10],n[11]=o[11],n[12]=o[12],n[13]=o[13],n[14]=o[14],n[15]=o[15],this}copyPosition(e){const n=this.elements,o=e.elements;return n[12]=o[12],n[13]=o[13],n[14]=o[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,o){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(e,n,o){return this.set(e.x,n.x,o.x,0,e.y,n.y,o.y,0,e.z,n.z,o.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,o=e.elements,r=1/uT.setFromMatrixColumn(e,0).length(),i=1/uT.setFromMatrixColumn(e,1).length(),a=1/uT.setFromMatrixColumn(e,2).length();return n[0]=o[0]*r,n[1]=o[1]*r,n[2]=o[2]*r,n[3]=0,n[4]=o[4]*i,n[5]=o[5]*i,n[6]=o[6]*i,n[7]=0,n[8]=o[8]*a,n[9]=o[9]*a,n[10]=o[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,o=e.x,r=e.y,i=e.z,a=Math.cos(o),l=Math.sin(o),s=Math.cos(r),c=Math.sin(r),u=Math.cos(i),d=Math.sin(i);if(e.order==="XYZ"){const f=a*u,p=a*d,g=l*u,A=l*d;n[0]=s*u,n[4]=-s*d,n[8]=c,n[1]=p+g*c,n[5]=f-A*c,n[9]=-l*s,n[2]=A-f*c,n[6]=g+p*c,n[10]=a*s}else if(e.order==="YXZ"){const f=s*u,p=s*d,g=c*u,A=c*d;n[0]=f+A*l,n[4]=g*l-p,n[8]=a*c,n[1]=a*d,n[5]=a*u,n[9]=-l,n[2]=p*l-g,n[6]=A+f*l,n[10]=a*s}else if(e.order==="ZXY"){const f=s*u,p=s*d,g=c*u,A=c*d;n[0]=f-A*l,n[4]=-a*d,n[8]=g+p*l,n[1]=p+g*l,n[5]=a*u,n[9]=A-f*l,n[2]=-a*c,n[6]=l,n[10]=a*s}else if(e.order==="ZYX"){const f=a*u,p=a*d,g=l*u,A=l*d;n[0]=s*u,n[4]=g*c-p,n[8]=f*c+A,n[1]=s*d,n[5]=A*c+f,n[9]=p*c-g,n[2]=-c,n[6]=l*s,n[10]=a*s}else if(e.order==="YZX"){const f=a*s,p=a*c,g=l*s,A=l*c;n[0]=s*u,n[4]=A-f*d,n[8]=g*d+p,n[1]=d,n[5]=a*u,n[9]=-l*u,n[2]=-c*u,n[6]=p*d+g,n[10]=f-A*d}else if(e.order==="XZY"){const f=a*s,p=a*c,g=l*s,A=l*c;n[0]=s*u,n[4]=-d,n[8]=c*u,n[1]=f*d+A,n[5]=a*u,n[9]=p*d-g,n[2]=g*d-p,n[6]=l*u,n[10]=A*d+f}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(G1t,e,X1t)}lookAt(e,n,o){const r=this.elements;return E1.subVectors(e,n),E1.lengthSq()===0&&(E1.z=1),E1.normalize(),x4.crossVectors(o,E1),x4.lengthSq()===0&&(Math.abs(o.z)===1?E1.x+=1e-4:E1.z+=1e-4,E1.normalize(),x4.crossVectors(o,E1)),x4.normalize(),bB.crossVectors(E1,x4),r[0]=x4.x,r[4]=bB.x,r[8]=E1.x,r[1]=x4.y,r[5]=bB.y,r[9]=E1.y,r[2]=x4.z,r[6]=bB.z,r[10]=E1.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const o=e.elements,r=n.elements,i=this.elements,a=o[0],l=o[4],s=o[8],c=o[12],u=o[1],d=o[5],f=o[9],p=o[13],g=o[2],A=o[6],y=o[10],S=o[14],C=o[3],P=o[7],v=o[11],T=o[15],w=r[0],x=r[4],b=r[8],R=r[12],H=r[1],F=r[5],E=r[9],N=r[13],U=r[2],W=r[6],k=r[10],D=r[14],L=r[3],j=r[7],B=r[11],O=r[15];return i[0]=a*w+l*H+s*U+c*L,i[4]=a*x+l*F+s*W+c*j,i[8]=a*b+l*E+s*k+c*B,i[12]=a*R+l*N+s*D+c*O,i[1]=u*w+d*H+f*U+p*L,i[5]=u*x+d*F+f*W+p*j,i[9]=u*b+d*E+f*k+p*B,i[13]=u*R+d*N+f*D+p*O,i[2]=g*w+A*H+y*U+S*L,i[6]=g*x+A*F+y*W+S*j,i[10]=g*b+A*E+y*k+S*B,i[14]=g*R+A*N+y*D+S*O,i[3]=C*w+P*H+v*U+T*L,i[7]=C*x+P*F+v*W+T*j,i[11]=C*b+P*E+v*k+T*B,i[15]=C*R+P*N+v*D+T*O,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],o=e[4],r=e[8],i=e[12],a=e[1],l=e[5],s=e[9],c=e[13],u=e[2],d=e[6],f=e[10],p=e[14],g=e[3],A=e[7],y=e[11],S=e[15];return g*(+i*s*d-r*c*d-i*l*f+o*c*f+r*l*p-o*s*p)+A*(+n*s*p-n*c*f+i*a*f-r*a*p+r*c*u-i*s*u)+y*(+n*c*d-n*l*p-i*a*d+o*a*p+i*l*u-o*c*u)+S*(-r*l*u-n*s*d+n*l*f+r*a*d-o*a*f+o*s*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,o){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=o),this}invert(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8],d=e[9],f=e[10],p=e[11],g=e[12],A=e[13],y=e[14],S=e[15],C=d*y*c-A*f*c+A*s*p-l*y*p-d*s*S+l*f*S,P=g*f*c-u*y*c-g*s*p+a*y*p+u*s*S-a*f*S,v=u*A*c-g*d*c+g*l*p-a*A*p-u*l*S+a*d*S,T=g*d*s-u*A*s-g*l*f+a*A*f+u*l*y-a*d*y,w=n*C+o*P+r*v+i*T;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/w;return e[0]=C*x,e[1]=(A*f*i-d*y*i-A*r*p+o*y*p+d*r*S-o*f*S)*x,e[2]=(l*y*i-A*s*i+A*r*c-o*y*c-l*r*S+o*s*S)*x,e[3]=(d*s*i-l*f*i-d*r*c+o*f*c+l*r*p-o*s*p)*x,e[4]=P*x,e[5]=(u*y*i-g*f*i+g*r*p-n*y*p-u*r*S+n*f*S)*x,e[6]=(g*s*i-a*y*i-g*r*c+n*y*c+a*r*S-n*s*S)*x,e[7]=(a*f*i-u*s*i+u*r*c-n*f*c-a*r*p+n*s*p)*x,e[8]=v*x,e[9]=(g*d*i-u*A*i-g*o*p+n*A*p+u*o*S-n*d*S)*x,e[10]=(a*A*i-g*l*i+g*o*c-n*A*c-a*o*S+n*l*S)*x,e[11]=(u*l*i-a*d*i-u*o*c+n*d*c+a*o*p-n*l*p)*x,e[12]=T*x,e[13]=(u*A*r-g*d*r+g*o*f-n*A*f-u*o*y+n*d*y)*x,e[14]=(g*l*r-a*A*r-g*o*s+n*A*s+a*o*y-n*l*y)*x,e[15]=(a*d*r-u*l*r+u*o*s-n*d*s-a*o*f+n*l*f)*x,this}scale(e){const n=this.elements,o=e.x,r=e.y,i=e.z;return n[0]*=o,n[4]*=r,n[8]*=i,n[1]*=o,n[5]*=r,n[9]*=i,n[2]*=o,n[6]*=r,n[10]*=i,n[3]*=o,n[7]*=r,n[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],o=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,o,r))}makeTranslation(e,n,o){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,o,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),o=Math.sin(e);return this.set(1,0,0,0,0,n,-o,0,0,o,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,0,o,0,0,1,0,0,-o,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,-o,0,0,o,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const o=Math.cos(n),r=Math.sin(n),i=1-o,a=e.x,l=e.y,s=e.z,c=i*a,u=i*l;return this.set(c*a+o,c*l-r*s,c*s+r*l,0,c*l+r*s,u*l+o,u*s-r*a,0,c*s-r*l,u*s+r*a,i*s*s+o,0,0,0,0,1),this}makeScale(e,n,o){return this.set(e,0,0,0,0,n,0,0,0,0,o,0,0,0,0,1),this}makeShear(e,n,o,r,i,a){return this.set(1,o,i,0,e,1,a,0,n,r,1,0,0,0,0,1),this}compose(e,n,o){const r=this.elements,i=n._x,a=n._y,l=n._z,s=n._w,c=i+i,u=a+a,d=l+l,f=i*c,p=i*u,g=i*d,A=a*u,y=a*d,S=l*d,C=s*c,P=s*u,v=s*d,T=o.x,w=o.y,x=o.z;return r[0]=(1-(A+S))*T,r[1]=(p+v)*T,r[2]=(g-P)*T,r[3]=0,r[4]=(p-v)*w,r[5]=(1-(f+S))*w,r[6]=(y+C)*w,r[7]=0,r[8]=(g+P)*x,r[9]=(y-C)*x,r[10]=(1-(f+A))*x,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,o){const r=this.elements;let i=uT.set(r[0],r[1],r[2]).length();const a=uT.set(r[4],r[5],r[6]).length(),l=uT.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Xy.copy(this);const c=1/i,u=1/a,d=1/l;return Xy.elements[0]*=c,Xy.elements[1]*=c,Xy.elements[2]*=c,Xy.elements[4]*=u,Xy.elements[5]*=u,Xy.elements[6]*=u,Xy.elements[8]*=d,Xy.elements[9]*=d,Xy.elements[10]*=d,n.setFromRotationMatrix(Xy),o.x=i,o.y=a,o.z=l,this}makePerspective(e,n,o,r,i,a,l=g9){const s=this.elements,c=2*i/(n-e),u=2*i/(o-r),d=(n+e)/(n-e),f=(o+r)/(o-r);let p,g;if(l===g9)p=-(a+i)/(a-i),g=-2*a*i/(a-i);else if(l===NF)p=-a/(a-i),g=-a*i/(a-i);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return s[0]=c,s[4]=0,s[8]=d,s[12]=0,s[1]=0,s[5]=u,s[9]=f,s[13]=0,s[2]=0,s[6]=0,s[10]=p,s[14]=g,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,n,o,r,i,a,l=g9){const s=this.elements,c=1/(n-e),u=1/(o-r),d=1/(a-i),f=(n+e)*c,p=(o+r)*u;let g,A;if(l===g9)g=(a+i)*d,A=-2*d;else if(l===NF)g=i*d,A=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-f,s[1]=0,s[5]=2*u,s[9]=0,s[13]=-p,s[2]=0,s[6]=0,s[10]=A,s[14]=-g,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const n=this.elements,o=e.elements;for(let r=0;r<16;r++)if(n[r]!==o[r])return!1;return!0}fromArray(e,n=0){for(let o=0;o<16;o++)this.elements[o]=e[o+n];return this}toArray(e=[],n=0){const o=this.elements;return e[n]=o[0],e[n+1]=o[1],e[n+2]=o[2],e[n+3]=o[3],e[n+4]=o[4],e[n+5]=o[5],e[n+6]=o[6],e[n+7]=o[7],e[n+8]=o[8],e[n+9]=o[9],e[n+10]=o[10],e[n+11]=o[11],e[n+12]=o[12],e[n+13]=o[13],e[n+14]=o[14],e[n+15]=o[15],e}}const uT=new ae,Xy=new Ki,G1t=new ae(0,0,0),X1t=new ae(1,1,1),x4=new ae,bB=new ae,E1=new ae,x4e=new Ki,b4e=new Ts;class ln{constructor(e=0,n=0,o=0,r=ln.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=o,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,o,r=this._order){return this._x=e,this._y=n,this._z=o,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,o=!0){const r=e.elements,i=r[0],a=r[4],l=r[8],s=r[1],c=r[5],u=r[9],d=r[2],f=r[6],p=r[10];switch(n){case"XYZ":this._y=Math.asin(h0(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-h0(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,p),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-d,i),this._z=0);break;case"ZXY":this._x=Math.asin(h0(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-h0(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(h0(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,i)):(this._x=0,this._y=Math.atan2(l,p));break;case"XZY":this._z=Math.asin(-h0(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(l,i)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,o===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,o){return x4e.makeRotationFromQuaternion(e),this.setFromRotationMatrix(x4e,n,o)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return b4e.setFromEuler(this),this.setFromQuaternion(b4e,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ln.DEFAULT_ORDER="XYZ";class fx{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let o=0;o0&&(o=o.concat(a))}return o}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vz,e,K1t),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vz,q1t,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let o=0,r=n.length;o0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function i(l,s){return l[s.uuid]===void 0&&(l[s.uuid]=s.toJSON(e)),s.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const s=l.shapes;if(Array.isArray(s))for(let c=0,u=s.length;c0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(o.geometries=l),s.length>0&&(o.materials=s),c.length>0&&(o.textures=c),u.length>0&&(o.images=u),d.length>0&&(o.shapes=d),f.length>0&&(o.skeletons=f),p.length>0&&(o.animations=p),g.length>0&&(o.nodes=g)}return o.object=r,o;function a(l){const s=[];for(const c in l){const u=l[c];delete u.metadata,s.push(u)}return s}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let o=0;o0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,n,o,r,i){Jy.subVectors(r,n),n6.subVectors(o,n),Noe.subVectors(e,n);const a=Jy.dot(Jy),l=Jy.dot(n6),s=Jy.dot(Noe),c=n6.dot(n6),u=n6.dot(Noe),d=a*c-l*l;if(d===0)return i.set(-2,-1,-1);const f=1/d,p=(c*s-l*u)*f,g=(a*u-l*s)*f;return i.set(1-p-g,g,p)}static containsPoint(e,n,o,r){return this.getBarycoord(e,n,o,r,o6),o6.x>=0&&o6.y>=0&&o6.x+o6.y<=1}static getUV(e,n,o,r,i,a,l,s){return TB===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),TB=!0),this.getInterpolation(e,n,o,r,i,a,l,s)}static getInterpolation(e,n,o,r,i,a,l,s){return this.getBarycoord(e,n,o,r,o6),s.setScalar(0),s.addScaledVector(i,o6.x),s.addScaledVector(a,o6.y),s.addScaledVector(l,o6.z),s}static isFrontFacing(e,n,o,r){return Jy.subVectors(o,n),n6.subVectors(e,n),Jy.cross(n6).dot(r)<0}set(e,n,o){return this.a.copy(e),this.b.copy(n),this.c.copy(o),this}setFromPointsAndIndices(e,n,o,r){return this.a.copy(e[n]),this.b.copy(e[o]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,o,r){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,o),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Jy.subVectors(this.c,this.b),n6.subVectors(this.a,this.b),Jy.cross(n6).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ih.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return ih.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,o,r,i){return TB===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),TB=!0),ih.getInterpolation(e,this.a,this.b,this.c,n,o,r,i)}getInterpolation(e,n,o,r,i){return ih.getInterpolation(e,this.a,this.b,this.c,n,o,r,i)}containsPoint(e){return ih.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ih.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const o=this.a,r=this.b,i=this.c;let a,l;fT.subVectors(r,o),hT.subVectors(i,o),Uoe.subVectors(e,o);const s=fT.dot(Uoe),c=hT.dot(Uoe);if(s<=0&&c<=0)return n.copy(o);joe.subVectors(e,r);const u=fT.dot(joe),d=hT.dot(joe);if(u>=0&&d<=u)return n.copy(r);const f=s*d-u*c;if(f<=0&&s>=0&&u<=0)return a=s/(s-u),n.copy(o).addScaledVector(fT,a);Boe.subVectors(e,i);const p=fT.dot(Boe),g=hT.dot(Boe);if(g>=0&&p<=g)return n.copy(i);const A=p*c-s*g;if(A<=0&&c>=0&&g<=0)return l=c/(c-g),n.copy(o).addScaledVector(hT,l);const y=u*g-p*d;if(y<=0&&d-u>=0&&p-g>=0)return R4e.subVectors(i,r),l=(d-u)/(d-u+(p-g)),n.copy(r).addScaledVector(R4e,l);const S=1/(y+A+f);return a=A*S,l=f*S,n.copy(o).addScaledVector(fT,a).addScaledVector(hT,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const zNe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},b4={h:0,s:0,l:0},PB={h:0,s:0,l:0};function Yoe(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let rr=class{constructor(e,n,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,o)}set(e,n,o){if(n===void 0&&o===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,o);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ou){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,us.toWorkingColorSpace(this,n),this}setRGB(e,n,o,r=us.workingColorSpace){return this.r=e,this.g=n,this.b=o,us.toWorkingColorSpace(this,r),this}setHSL(e,n,o,r=us.workingColorSpace){if(e=L1e(e,1),n=h0(n,0,1),o=h0(o,0,1),n===0)this.r=this.g=this.b=o;else{const i=o<=.5?o*(1+n):o+n-o*n,a=2*o-i;this.r=Yoe(a,i,e+1/3),this.g=Yoe(a,i,e),this.b=Yoe(a,i,e-1/3)}return us.toWorkingColorSpace(this,r),this}setStyle(e,n=ou){function o(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=r[1],a=i.length;if(a===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(i,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ou){const o=zNe[e.toLowerCase()];return o!==void 0?this.setHex(o,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=TC(e.r),this.g=TC(e.g),this.b=TC(e.b),this}copyLinearToSRGB(e){return this.r=Ioe(e.r),this.g=Ioe(e.g),this.b=Ioe(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ou){return us.fromWorkingColorSpace(_f.copy(this),e),Math.round(h0(_f.r*255,0,255))*65536+Math.round(h0(_f.g*255,0,255))*256+Math.round(h0(_f.b*255,0,255))}getHexString(e=ou){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=us.workingColorSpace){us.fromWorkingColorSpace(_f.copy(this),n);const o=_f.r,r=_f.g,i=_f.b,a=Math.max(o,r,i),l=Math.min(o,r,i);let s,c;const u=(l+a)/2;if(l===a)s=0,c=0;else{const d=a-l;switch(c=u<=.5?d/(a+l):d/(2-a-l),a){case o:s=(r-i)/d+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const o=e[n];if(o===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(o):r&&r.isVector3&&o&&o.isVector3?r.copy(o):this[n]=o}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(e).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(e).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(e).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(e).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(e).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==ux&&(o.blending=this.blending),this.side!==Da&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),this.blendSrc!==tG&&(o.blendSrc=this.blendSrc),this.blendDst!==nG&&(o.blendDst=this.blendDst),this.blendEquation!==r8&&(o.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(o.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(o.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(o.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(o.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(o.blendAlpha=this.blendAlpha),this.depthFunc!==RF&&(o.depthFunc=this.depthFunc),this.depthTest===!1&&(o.depthTest=this.depthTest),this.depthWrite===!1&&(o.depthWrite=this.depthWrite),this.colorWrite===!1&&(o.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(o.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vce&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fv&&(o.stencilFail=this.stencilFail),this.stencilZFail!==fv&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==fv&&(o.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(o.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function r(i){const a=[];for(const l in i){const s=i[l];delete s.metadata,a.push(s)}return a}if(n){const i=r(e.textures),a=r(e.images);i.length>0&&(o.textures=i),a.length>0&&(o.images=a)}return o}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let o=null;if(n!==null){const r=n.length;o=new Array(r);for(let i=0;i!==r;++i)o[i]=n[i].clone()}return this.clippingPlanes=o,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};class t3 extends Tf{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const x6=egt();function egt(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),o=new Uint32Array(512),r=new Uint32Array(512);for(let s=0;s<256;++s){const c=s-127;c<-27?(o[s]=0,o[s|256]=32768,r[s]=24,r[s|256]=24):c<-14?(o[s]=1024>>-c-14,o[s|256]=1024>>-c-14|32768,r[s]=-c-1,r[s|256]=-c-1):c<=15?(o[s]=c+15<<10,o[s|256]=c+15<<10|32768,r[s]=13,r[s|256]=13):c<128?(o[s]=31744,o[s|256]=64512,r[s]=24,r[s|256]=24):(o[s]=31744,o[s|256]=64512,r[s]=13,r[s|256]=13)}const i=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let s=1;s<1024;++s){let c=s<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,i[s]=c|u}for(let s=1024;s<2048;++s)i[s]=939524096+(s-1024<<13);for(let s=1;s<31;++s)a[s]=s<<23;a[31]=1199570944,a[32]=2147483648;for(let s=33;s<63;++s)a[s]=2147483648+(s-32<<23);a[63]=3347054592;for(let s=1;s<64;++s)s!==32&&(l[s]=1024);return{floatView:e,uint32View:n,baseTable:o,shiftTable:r,mantissaTable:i,exponentTable:a,offsetTable:l}}function Ep(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=h0(t,-65504,65504),x6.floatView[0]=t;const e=x6.uint32View[0],n=e>>23&511;return x6.baseTable[n]+((e&8388607)>>x6.shiftTable[n])}function MD(t){const e=t>>10;return x6.uint32View[0]=x6.mantissaTable[x6.offsetTable[e]+(t&1023)]+x6.exponentTable[e],x6.floatView[0]}const tgt={toHalfFloat:Ep,fromHalfFloat:MD},Z0=new ae,CB=new Kt;class tl{constructor(e,n,o=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=o,this.usage=WF,this.updateRange={offset:0,count:-1},this.gpuType=v2,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,o){e*=this.itemSize,o*=n.itemSize;for(let r=0,i=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const s=this.parameters;for(const c in s)s[c]!==void 0&&(e[c]=s[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const o=this.attributes;for(const s in o){const c=o[s];e.data.attributes[s]=c.toJSON(e.data)}const r={};let i=!1;for(const s in this.morphAttributes){const c=this.morphAttributes[s],u=[];for(let d=0,f=c.length;d0&&(r[s]=u,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const o=e.index;o!==null&&this.setIndex(o.clone(n));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(n))}const i=e.morphAttributes;for(const c in i){const u=[],d=i[c];for(let f=0,p=d.length;f0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i(e.far-e.near)**2))&&(H4e.copy(i).invert(),U7.copy(e.ray).applyMatrix4(H4e),!(o.boundingBox!==null&&U7.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(e,n,U7)))}_computeIntersections(e,n,o){let r;const i=this.geometry,a=this.material,l=i.index,s=i.attributes.position,c=i.attributes.uv,u=i.attributes.uv1,d=i.attributes.normal,f=i.groups,p=i.drawRange;if(l!==null)if(Array.isArray(a))for(let g=0,A=f.length;gn.far?null:{distance:c,point:EB.clone(),object:t}}function FB(t,e,n,o,r,i,a,l,s,c){t.getVertexPosition(l,gT),t.getVertexPosition(s,mT),t.getVertexPosition(c,yT);const u=ugt(t,e,n,o,gT,mT,yT,DB);if(u){r&&(MB.fromBufferAttribute(r,l),IB.fromBufferAttribute(r,s),zB.fromBufferAttribute(r,c),u.uv=ih.getInterpolation(DB,gT,mT,yT,MB,IB,zB,new Kt)),i&&(MB.fromBufferAttribute(i,l),IB.fromBufferAttribute(i,s),zB.fromBufferAttribute(i,c),u.uv1=ih.getInterpolation(DB,gT,mT,yT,MB,IB,zB,new Kt),u.uv2=u.uv1),a&&(I4e.fromBufferAttribute(a,l),z4e.fromBufferAttribute(a,s),D4e.fromBufferAttribute(a,c),u.normal=ih.getInterpolation(DB,gT,mT,yT,I4e,z4e,D4e,new ae),u.normal.dot(o.direction)>0&&u.normal.multiplyScalar(-1));const d={a:l,b:s,c,normal:new ae,materialIndex:0};ih.getNormal(gT,mT,yT,d.normal),u.face=d}return u}class n3 extends ji{constructor(e=1,n=1,o=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:o,widthSegments:r,heightSegments:i,depthSegments:a};const l=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);const s=[],c=[],u=[],d=[];let f=0,p=0;g("z","y","x",-1,-1,o,n,e,a,i,0),g("z","y","x",1,-1,o,n,-e,a,i,1),g("x","z","y",1,1,e,o,n,r,a,2),g("x","z","y",1,-1,e,o,-n,r,a,3),g("x","y","z",1,-1,e,n,o,r,i,4),g("x","y","z",-1,-1,e,n,-o,r,i,5),this.setIndex(s),this.setAttribute("position",new gr(c,3)),this.setAttribute("normal",new gr(u,3)),this.setAttribute("uv",new gr(d,2));function g(A,y,S,C,P,v,T,w,x,b,R){const H=v/x,F=T/b,E=v/2,N=T/2,U=w/2,W=x+1,k=b+1;let D=0,L=0;const j=new ae;for(let B=0;B0?1:-1,u.push(j.x,j.y,j.z),d.push(V/x),d.push(1-B/b),D+=1}}for(let B=0;B>8&255]+_f[t>>16&255]+_f[t>>24&255]+"-"+_f[e&255]+_f[e>>8&255]+"-"+_f[e>>16&15|64]+_f[e>>24&255]+"-"+_f[n&63|128]+_f[n>>8&255]+"-"+_f[n>>16&255]+_f[n>>24&255]+_f[o&255]+_f[o>>8&255]+_f[o>>16&255]+_f[o>>24&255]).toLowerCase()}function h0(t,e,n){return Math.max(e,Math.min(n,t))}function L1e(t,e){return(t%e+e)%e}function P1t(t,e,n,o,r){return o+(t-e)*(r-o)/(n-e)}function C1t(t,e,n){return t!==e?(n-t)/(e-t):0}function mE(t,e,n){return(1-n)*t+n*e}function R1t(t,e,n,o){return mE(t,e,1-Math.exp(-n*o))}function H1t(t,e=1){return e-Math.abs(L1e(t,e*2)-e)}function M1t(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function I1t(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function z1t(t,e){return t+Math.floor(Math.random()*(e-t+1))}function D1t(t,e){return t+Math.random()*(e-t)}function E1t(t){return t*(.5-Math.random())}function F1t(t){t!==void 0&&(m4e=t);let e=m4e+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function k1t(t){return t*dx}function L1t(t){return t*iR}function bce(t){return(t&t-1)===0&&t!==0}function CNe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function iG(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function W1t(t,e,n,o,r){const i=Math.cos,a=Math.sin,l=i(n/2),s=a(n/2),c=i((e+o)/2),u=a((e+o)/2),d=i((e-o)/2),f=a((e-o)/2),p=i((o-e)/2),g=a((o-e)/2);switch(r){case"XYX":t.set(l*u,s*d,s*f,l*c);break;case"YZY":t.set(s*f,l*u,s*d,l*c);break;case"ZXZ":t.set(s*d,s*f,l*u,l*c);break;case"XZX":t.set(l*u,s*g,s*p,l*c);break;case"YXY":t.set(s*p,l*u,s*g,l*c);break;case"ZYZ":t.set(s*g,s*p,l*u,l*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function jp(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function wa(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const RNe={DEG2RAD:dx,RAD2DEG:iR,generateUUID:bg,clamp:h0,euclideanModulo:L1e,mapLinear:P1t,inverseLerp:C1t,lerp:mE,damp:R1t,pingpong:H1t,smoothstep:M1t,smootherstep:I1t,randInt:z1t,randFloat:D1t,randFloatSpread:E1t,seededRandom:F1t,degToRad:k1t,radToDeg:L1t,isPowerOfTwo:bce,ceilPowerOfTwo:CNe,floorPowerOfTwo:iG,setQuaternionFromProperEuler:W1t,normalize:wa,denormalize:jp};class Kt{constructor(e=0,n=0){Kt.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,o=this.y,r=e.elements;return this.x=r[0]*n+r[3]*o+r[6],this.y=r[1]*n+r[4]*o+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const o=this.dot(e)/n;return Math.acos(h0(o,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,o=this.y-e.y;return n*n+o*o}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const o=Math.cos(n),r=Math.sin(n),i=this.x-e.x,a=this.y-e.y;return this.x=i*o-a*r+e.x,this.y=i*r+a*o+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ha{constructor(e,n,o,r,i,a,l,s,c){ha.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,o,r,i,a,l,s,c)}set(e,n,o,r,i,a,l,s,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=l,u[3]=n,u[4]=i,u[5]=s,u[6]=o,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,o=e.elements;return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],this}extractBasis(e,n,o){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const o=e.elements,r=n.elements,i=this.elements,a=o[0],l=o[3],s=o[6],c=o[1],u=o[4],d=o[7],f=o[2],p=o[5],g=o[8],A=r[0],y=r[3],S=r[6],C=r[1],P=r[4],v=r[7],T=r[2],w=r[5],x=r[8];return i[0]=a*A+l*C+s*T,i[3]=a*y+l*P+s*w,i[6]=a*S+l*v+s*x,i[1]=c*A+u*C+d*T,i[4]=c*y+u*P+d*w,i[7]=c*S+u*v+d*x,i[2]=f*A+p*C+g*T,i[5]=f*y+p*P+g*w,i[8]=f*S+p*v+g*x,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8];return n*a*u-n*l*c-o*i*u+o*l*s+r*i*c-r*a*s}invert(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8],d=u*a-l*c,f=l*s-u*i,p=c*i-a*s,g=n*d+o*f+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/g;return e[0]=d*A,e[1]=(r*c-u*o)*A,e[2]=(l*o-r*a)*A,e[3]=f*A,e[4]=(u*n-r*s)*A,e[5]=(r*i-l*n)*A,e[6]=p*A,e[7]=(o*s-c*n)*A,e[8]=(a*n-o*i)*A,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,o,r,i,a,l){const s=Math.cos(i),c=Math.sin(i);return this.set(o*s,o*c,-o*(s*a+c*l)+a+e,-r*c,r*s,-r*(-c*a+s*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(Moe.makeScale(e,n)),this}rotate(e){return this.premultiply(Moe.makeRotation(-e)),this}translate(e,n){return this.premultiply(Moe.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,-o,0,o,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,o=e.elements;for(let r=0;r<9;r++)if(n[r]!==o[r])return!1;return!0}fromArray(e,n=0){for(let o=0;o<9;o++)this.elements[o]=e[o+n];return this}toArray(e=[],n=0){const o=this.elements;return e[n]=o[0],e[n+1]=o[1],e[n+2]=o[2],e[n+3]=o[3],e[n+4]=o[4],e[n+5]=o[5],e[n+6]=o[6],e[n+7]=o[7],e[n+8]=o[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Moe=new ha;function HNe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const N1t={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function KP(t,e){return new N1t[t](e)}function UF(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function MNe(){const t=UF("canvas");return t.style.display="block",t}const y4e={};function yE(t){t in y4e||(y4e[t]=!0,console.warn(t))}const A4e=new ha().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),w4e=new ha().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),mB={[W9]:{transfer:FF,primaries:kF,toReference:t=>t,fromReference:t=>t},[ou]:{transfer:Ys,primaries:kF,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[rW]:{transfer:FF,primaries:LF,toReference:t=>t.applyMatrix3(w4e),fromReference:t=>t.applyMatrix3(A4e)},[uq]:{transfer:Ys,primaries:LF,toReference:t=>t.convertSRGBToLinear().applyMatrix3(w4e),fromReference:t=>t.applyMatrix3(A4e).convertLinearToSRGB()}},U1t=new Set([W9,rW]),us={enabled:!0,_workingColorSpace:W9,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!U1t.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const o=mB[e].toReference,r=mB[n].fromReference;return r(o(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return mB[t].primaries},getTransfer:function(t){return t===cg?FF:mB[t].transfer}};function TC(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ioe(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let aT;class W1e{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{aT===void 0&&(aT=UF("canvas")),aT.width=e.width,aT.height=e.height;const o=aT.getContext("2d");e instanceof ImageData?o.putImageData(e,0,0):o.drawImage(e,0,0,e.width,e.height),n=aT}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=UF("canvas");n.width=e.width,n.height=e.height;const o=n.getContext("2d");o.drawImage(e,0,0,e.width,e.height);const r=o.getImageData(0,0,e.width,e.height),i=r.data;for(let a=0;a0&&(o.userData=this.userData),n||(e.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==lq)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bs:e.x=e.x-Math.floor(e.x);break;case dh:e.x=e.x<0?0:1;break;case IF:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case bs:e.y=e.y-Math.floor(e.y);break;case dh:e.y=e.y<0?0:1;break;case IF:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return yE("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===ou?O8:F1e}set encoding(e){yE("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===O8?ou:cg}}Vc.DEFAULT_IMAGE=null;Vc.DEFAULT_MAPPING=lq;Vc.DEFAULT_ANISOTROPY=1;class qa{constructor(e=0,n=0,o=0,r=1){qa.prototype.isVector4=!0,this.x=e,this.y=n,this.z=o,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,o,r){return this.x=e,this.y=n,this.z=o,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,o=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*n+a[4]*o+a[8]*r+a[12]*i,this.y=a[1]*n+a[5]*o+a[9]*r+a[13]*i,this.z=a[2]*n+a[6]*o+a[10]*r+a[14]*i,this.w=a[3]*n+a[7]*o+a[11]*r+a[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,o,r,i;const s=e.elements,c=s[0],u=s[4],d=s[8],f=s[1],p=s[5],g=s[9],A=s[2],y=s[6],S=s[10];if(Math.abs(u-f)<.01&&Math.abs(d-A)<.01&&Math.abs(g-y)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+A)<.1&&Math.abs(g+y)<.1&&Math.abs(c+p+S-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const P=(c+1)/2,v=(p+1)/2,T=(S+1)/2,w=(u+f)/4,x=(d+A)/4,b=(g+y)/4;return P>v&&P>T?P<.01?(o=0,r=.707106781,i=.707106781):(o=Math.sqrt(P),r=w/o,i=x/o):v>T?v<.01?(o=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),o=w/r,i=b/r):T<.01?(o=.707106781,r=.707106781,i=0):(i=Math.sqrt(T),o=x/i,r=b/i),this.set(o,r,i,n),this}let C=Math.sqrt((y-g)*(y-g)+(d-A)*(d-A)+(f-u)*(f-u));return Math.abs(C)<.001&&(C=1),this.x=(y-g)/C,this.y=(d-A)/C,this.z=(f-u)/C,this.w=Math.acos((c+p+S-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this.z=e.z+(n.z-e.z)*o,this.w=e.w+(n.w-e.w)*o,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class INe extends e3{constructor(e=1,n=1,o={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new qa(0,0,e,n),this.scissorTest=!1,this.viewport=new qa(0,0,e,n);const r={width:e,height:n,depth:1};o.encoding!==void 0&&(yE("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===O8?ou:cg),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gs,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new Vc(r,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=o.generateMipmaps,this.texture.internalFormat=o.internalFormat,this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}setSize(e,n,o=1){(this.width!==e||this.height!==n||this.depth!==o)&&(this.width=e,this.height=n,this.depth=o,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=o,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new Lv(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class $m extends INe{constructor(e=1,n=1,o={}){super(e,n,o),this.isWebGLRenderTarget=!0}}class dq extends Vc{constructor(e=null,n=1,o=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:o,depth:r},this.magFilter=F0,this.minFilter=F0,this.wrapR=dh,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Y1t extends $m{constructor(e=1,n=1,o=1){super(e,n),this.isWebGLArrayRenderTarget=!0,this.depth=o,this.texture=new dq(null,e,n,o),this.texture.isRenderTargetTexture=!0}}class N1e extends Vc{constructor(e=null,n=1,o=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:o,depth:r},this.magFilter=F0,this.minFilter=F0,this.wrapR=dh,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class O1t extends $m{constructor(e=1,n=1,o=1){super(e,n),this.isWebGL3DRenderTarget=!0,this.depth=o,this.texture=new N1e(null,e,n,o),this.texture.isRenderTargetTexture=!0}}class V1t extends $m{constructor(e=1,n=1,o=1,r={}){super(e,n,r),this.isWebGLMultipleRenderTargets=!0;const i=this.texture;this.texture=[];for(let a=0;a=0?1:-1,P=1-S*S;if(P>Number.EPSILON){const T=Math.sqrt(P),w=Math.atan2(T,S*C);y=Math.sin(y*w)/T,l=Math.sin(l*w)/T}const v=l*C;if(s=s*y+f*v,c=c*y+p*v,u=u*y+g*v,d=d*y+A*v,y===1-l){const T=1/Math.sqrt(s*s+c*c+u*u+d*d);s*=T,c*=T,u*=T,d*=T}}e[n]=s,e[n+1]=c,e[n+2]=u,e[n+3]=d}static multiplyQuaternionsFlat(e,n,o,r,i,a){const l=o[r],s=o[r+1],c=o[r+2],u=o[r+3],d=i[a],f=i[a+1],p=i[a+2],g=i[a+3];return e[n]=l*g+u*d+s*p-c*f,e[n+1]=s*g+u*f+c*d-l*p,e[n+2]=c*g+u*p+l*f-s*d,e[n+3]=u*g-l*d-s*f-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,o,r){return this._x=e,this._y=n,this._z=o,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n){const o=e._x,r=e._y,i=e._z,a=e._order,l=Math.cos,s=Math.sin,c=l(o/2),u=l(r/2),d=l(i/2),f=s(o/2),p=s(r/2),g=s(i/2);switch(a){case"XYZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"YXZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"ZXY":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"ZYX":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"YZX":this._x=f*u*d+c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d-f*p*g;break;case"XZY":this._x=f*u*d-c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d+f*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const o=n/2,r=Math.sin(o);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,o=n[0],r=n[4],i=n[8],a=n[1],l=n[5],s=n[9],c=n[2],u=n[6],d=n[10],f=o+l+d;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-s)*p,this._y=(i-c)*p,this._z=(a-r)*p}else if(o>l&&o>d){const p=2*Math.sqrt(1+o-l-d);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+c)/p}else if(l>d){const p=2*Math.sqrt(1+l-o-d);this._w=(i-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+u)/p}else{const p=2*Math.sqrt(1+d-o-l);this._w=(a-r)/p,this._x=(i+c)/p,this._y=(s+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let o=e.dot(n)+1;return oMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=o):(this._x=0,this._y=-e.z,this._z=e.y,this._w=o)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=o),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(h0(this.dot(e),-1,1)))}rotateTowards(e,n){const o=this.angleTo(e);if(o===0)return this;const r=Math.min(1,n/o);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const o=e._x,r=e._y,i=e._z,a=e._w,l=n._x,s=n._y,c=n._z,u=n._w;return this._x=o*u+a*l+r*c-i*s,this._y=r*u+a*s+i*l-o*c,this._z=i*u+a*c+o*s-r*l,this._w=a*u-o*l-r*s-i*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const o=this._x,r=this._y,i=this._z,a=this._w;let l=a*e._w+o*e._x+r*e._y+i*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=a,this._x=o,this._y=r,this._z=i,this;const s=1-l*l;if(s<=Number.EPSILON){const p=1-n;return this._w=p*a+n*this._w,this._x=p*o+n*this._x,this._y=p*r+n*this._y,this._z=p*i+n*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(s),u=Math.atan2(c,l),d=Math.sin((1-n)*u)/c,f=Math.sin(n*u)/c;return this._w=a*d+this._w*f,this._x=o*d+this._x*f,this._y=r*d+this._y*f,this._z=i*d+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,n,o){return this.copy(e).slerp(n,o)}random(){const e=Math.random(),n=Math.sqrt(1-e),o=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(n*Math.cos(r),o*Math.sin(i),o*Math.cos(i),n*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class le{constructor(e=0,n=0,o=0){le.prototype.isVector3=!0,this.x=e,this.y=n,this.z=o}set(e,n,o){return o===void 0&&(o=this.z),this.x=e,this.y=n,this.z=o,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(v4e.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(v4e.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,o=this.y,r=this.z,i=e.elements;return this.x=i[0]*n+i[3]*o+i[6]*r,this.y=i[1]*n+i[4]*o+i[7]*r,this.z=i[2]*n+i[5]*o+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,o=this.y,r=this.z,i=e.elements,a=1/(i[3]*n+i[7]*o+i[11]*r+i[15]);return this.x=(i[0]*n+i[4]*o+i[8]*r+i[12])*a,this.y=(i[1]*n+i[5]*o+i[9]*r+i[13])*a,this.z=(i[2]*n+i[6]*o+i[10]*r+i[14])*a,this}applyQuaternion(e){const n=this.x,o=this.y,r=this.z,i=e.x,a=e.y,l=e.z,s=e.w,c=2*(a*r-l*o),u=2*(l*n-i*r),d=2*(i*o-a*n);return this.x=n+s*c+a*d-l*u,this.y=o+s*u+l*c-i*d,this.z=r+s*d+i*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,o=this.y,r=this.z,i=e.elements;return this.x=i[0]*n+i[4]*o+i[8]*r,this.y=i[1]*n+i[5]*o+i[9]*r,this.z=i[2]*n+i[6]*o+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(e,Math.min(n,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,o){return this.x=e.x+(n.x-e.x)*o,this.y=e.y+(n.y-e.y)*o,this.z=e.z+(n.z-e.z)*o,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const o=e.x,r=e.y,i=e.z,a=n.x,l=n.y,s=n.z;return this.x=r*s-i*l,this.y=i*a-o*s,this.z=o*l-r*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const o=e.dot(this)/n;return this.copy(e).multiplyScalar(o)}projectOnPlane(e){return Doe.copy(this).projectOnVector(e),this.sub(Doe)}reflect(e){return this.sub(Doe.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const o=this.dot(e)/n;return Math.acos(h0(o,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,o=this.y-e.y,r=this.z-e.z;return n*n+o*o+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,o){const r=Math.sin(n)*e;return this.x=r*Math.sin(o),this.y=Math.cos(n)*e,this.z=r*Math.cos(o),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,o){return this.x=e*Math.sin(n),this.y=o,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),o=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=o,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,o=Math.sqrt(1-e**2);return this.x=o*Math.cos(n),this.y=o*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Doe=new le,v4e=new Ts;class vf{constructor(e=new le(1/0,1/0,1/0),n=new le(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,o=e.length;nthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Gy),Gy.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,o;return e.normal.x>0?(n=e.normal.x*this.min.x,o=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,o=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,o+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,o+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,o+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,o+=e.normal.z*this.min.z),n<=-e.constant&&o>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Az),AB.subVectors(this.max,Az),lT.subVectors(e.a,Az),sT.subVectors(e.b,Az),cT.subVectors(e.c,Az),A4.subVectors(sT,lT),w4.subVectors(cT,sT),W7.subVectors(lT,cT);let n=[0,-A4.z,A4.y,0,-w4.z,w4.y,0,-W7.z,W7.y,A4.z,0,-A4.x,w4.z,0,-w4.x,W7.z,0,-W7.x,-A4.y,A4.x,0,-w4.y,w4.x,0,-W7.y,W7.x,0];return!Eoe(n,lT,sT,cT,AB)||(n=[1,0,0,0,1,0,0,0,1],!Eoe(n,lT,sT,cT,AB))?!1:(wB.crossVectors(A4,w4),n=[wB.x,wB.y,wB.z],Eoe(n,lT,sT,cT,AB))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gy).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gy).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Z3[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Z3[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Z3[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Z3[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Z3[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Z3[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Z3[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Z3[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Z3),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Z3=[new le,new le,new le,new le,new le,new le,new le,new le],Gy=new le,yB=new vf,lT=new le,sT=new le,cT=new le,A4=new le,w4=new le,W7=new le,Az=new le,AB=new le,wB=new le,N7=new le;function Eoe(t,e,n,o,r){for(let i=0,a=t.length-3;i<=a;i+=3){N7.fromArray(t,i);const l=r.x*Math.abs(N7.x)+r.y*Math.abs(N7.y)+r.z*Math.abs(N7.z),s=e.dot(N7),c=n.dot(N7),u=o.dot(N7);if(Math.max(-Math.max(s,c,u),Math.min(s,c,u))>l)return!1}return!0}const _1t=new vf,wz=new le,Foe=new le;let s1=class{constructor(e=new le,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const o=this.center;n!==void 0?o.copy(n):_1t.setFromPoints(e).getCenter(o);let r=0;for(let i=0,a=e.length;ithis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;wz.subVectors(e,this.center);const n=wz.lengthSq();if(n>this.radius*this.radius){const o=Math.sqrt(n),r=(o-this.radius)*.5;this.center.addScaledVector(wz,r/o),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Foe.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(wz.copy(e.center).add(Foe)),this.expandByPoint(wz.copy(e.center).sub(Foe))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const e6=new le,koe=new le,vB=new le,v4=new le,Loe=new le,xB=new le,Woe=new le;class RH{constructor(e=new le,n=new le(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,e6)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const o=n.dot(this.direction);return o<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=e6.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(e6.copy(this.origin).addScaledVector(this.direction,n),e6.distanceToSquared(e))}distanceSqToSegment(e,n,o,r){koe.copy(e).add(n).multiplyScalar(.5),vB.copy(n).sub(e).normalize(),v4.copy(this.origin).sub(koe);const i=e.distanceTo(n)*.5,a=-this.direction.dot(vB),l=v4.dot(this.direction),s=-v4.dot(vB),c=v4.lengthSq(),u=Math.abs(1-a*a);let d,f,p,g;if(u>0)if(d=a*s-l,f=a*l-s,g=i*u,d>=0)if(f>=-g)if(f<=g){const A=1/u;d*=A,f*=A,p=d*(d+a*f+2*l)+f*(a*d+f+2*s)+c}else f=i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;else f=-i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;else f<=-g?(d=Math.max(0,-(-a*i+l)),f=d>0?-i:Math.min(Math.max(-i,-s),i),p=-d*d+f*(f+2*s)+c):f<=g?(d=0,f=Math.min(Math.max(-i,-s),i),p=f*(f+2*s)+c):(d=Math.max(0,-(a*i+l)),f=d>0?i:Math.min(Math.max(-i,-s),i),p=-d*d+f*(f+2*s)+c);else f=a>0?-i:i,d=Math.max(0,-(a*f+l)),p=-d*d+f*(f+2*s)+c;return o&&o.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(koe).addScaledVector(vB,f),p}intersectSphere(e,n){e6.subVectors(e.center,this.origin);const o=e6.dot(this.direction),r=e6.dot(e6)-o*o,i=e.radius*e.radius;if(r>i)return null;const a=Math.sqrt(i-r),l=o-a,s=o+a;return s<0?null:l<0?this.at(s,n):this.at(l,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const o=-(this.origin.dot(e.normal)+e.constant)/n;return o>=0?o:null}intersectPlane(e,n){const o=this.distanceToPlane(e);return o===null?null:this.at(o,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let o,r,i,a,l,s;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(o=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(o=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(i=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(i=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),o>a||i>r||((i>o||isNaN(o))&&(o=i),(a=0?(l=(e.min.z-f.z)*d,s=(e.max.z-f.z)*d):(l=(e.max.z-f.z)*d,s=(e.min.z-f.z)*d),o>s||l>r)||((l>o||o!==o)&&(o=l),(s=0?o:r,n)}intersectsBox(e){return this.intersectBox(e,e6)!==null}intersectTriangle(e,n,o,r,i){Loe.subVectors(n,e),xB.subVectors(o,e),Woe.crossVectors(Loe,xB);let a=this.direction.dot(Woe),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;v4.subVectors(this.origin,e);const s=l*this.direction.dot(xB.crossVectors(v4,xB));if(s<0)return null;const c=l*this.direction.dot(Loe.cross(v4));if(c<0||s+c>a)return null;const u=-l*v4.dot(Woe);return u<0?null:this.at(u/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ki{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){Ki.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y)}set(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){const S=this.elements;return S[0]=e,S[4]=n,S[8]=o,S[12]=r,S[1]=i,S[5]=a,S[9]=l,S[13]=s,S[2]=c,S[6]=u,S[10]=d,S[14]=f,S[3]=p,S[7]=g,S[11]=A,S[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ki().fromArray(this.elements)}copy(e){const n=this.elements,o=e.elements;return n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3],n[4]=o[4],n[5]=o[5],n[6]=o[6],n[7]=o[7],n[8]=o[8],n[9]=o[9],n[10]=o[10],n[11]=o[11],n[12]=o[12],n[13]=o[13],n[14]=o[14],n[15]=o[15],this}copyPosition(e){const n=this.elements,o=e.elements;return n[12]=o[12],n[13]=o[13],n[14]=o[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,o){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(e,n,o){return this.set(e.x,n.x,o.x,0,e.y,n.y,o.y,0,e.z,n.z,o.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,o=e.elements,r=1/uT.setFromMatrixColumn(e,0).length(),i=1/uT.setFromMatrixColumn(e,1).length(),a=1/uT.setFromMatrixColumn(e,2).length();return n[0]=o[0]*r,n[1]=o[1]*r,n[2]=o[2]*r,n[3]=0,n[4]=o[4]*i,n[5]=o[5]*i,n[6]=o[6]*i,n[7]=0,n[8]=o[8]*a,n[9]=o[9]*a,n[10]=o[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,o=e.x,r=e.y,i=e.z,a=Math.cos(o),l=Math.sin(o),s=Math.cos(r),c=Math.sin(r),u=Math.cos(i),d=Math.sin(i);if(e.order==="XYZ"){const f=a*u,p=a*d,g=l*u,A=l*d;n[0]=s*u,n[4]=-s*d,n[8]=c,n[1]=p+g*c,n[5]=f-A*c,n[9]=-l*s,n[2]=A-f*c,n[6]=g+p*c,n[10]=a*s}else if(e.order==="YXZ"){const f=s*u,p=s*d,g=c*u,A=c*d;n[0]=f+A*l,n[4]=g*l-p,n[8]=a*c,n[1]=a*d,n[5]=a*u,n[9]=-l,n[2]=p*l-g,n[6]=A+f*l,n[10]=a*s}else if(e.order==="ZXY"){const f=s*u,p=s*d,g=c*u,A=c*d;n[0]=f-A*l,n[4]=-a*d,n[8]=g+p*l,n[1]=p+g*l,n[5]=a*u,n[9]=A-f*l,n[2]=-a*c,n[6]=l,n[10]=a*s}else if(e.order==="ZYX"){const f=a*u,p=a*d,g=l*u,A=l*d;n[0]=s*u,n[4]=g*c-p,n[8]=f*c+A,n[1]=s*d,n[5]=A*c+f,n[9]=p*c-g,n[2]=-c,n[6]=l*s,n[10]=a*s}else if(e.order==="YZX"){const f=a*s,p=a*c,g=l*s,A=l*c;n[0]=s*u,n[4]=A-f*d,n[8]=g*d+p,n[1]=d,n[5]=a*u,n[9]=-l*u,n[2]=-c*u,n[6]=p*d+g,n[10]=f-A*d}else if(e.order==="XZY"){const f=a*s,p=a*c,g=l*s,A=l*c;n[0]=s*u,n[4]=-d,n[8]=c*u,n[1]=f*d+A,n[5]=a*u,n[9]=p*d-g,n[2]=g*d-p,n[6]=l*u,n[10]=A*d+f}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(G1t,e,X1t)}lookAt(e,n,o){const r=this.elements;return E1.subVectors(e,n),E1.lengthSq()===0&&(E1.z=1),E1.normalize(),x4.crossVectors(o,E1),x4.lengthSq()===0&&(Math.abs(o.z)===1?E1.x+=1e-4:E1.z+=1e-4,E1.normalize(),x4.crossVectors(o,E1)),x4.normalize(),bB.crossVectors(E1,x4),r[0]=x4.x,r[4]=bB.x,r[8]=E1.x,r[1]=x4.y,r[5]=bB.y,r[9]=E1.y,r[2]=x4.z,r[6]=bB.z,r[10]=E1.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const o=e.elements,r=n.elements,i=this.elements,a=o[0],l=o[4],s=o[8],c=o[12],u=o[1],d=o[5],f=o[9],p=o[13],g=o[2],A=o[6],y=o[10],S=o[14],C=o[3],P=o[7],v=o[11],T=o[15],w=r[0],x=r[4],b=r[8],R=r[12],H=r[1],F=r[5],E=r[9],N=r[13],U=r[2],W=r[6],k=r[10],D=r[14],L=r[3],j=r[7],B=r[11],O=r[15];return i[0]=a*w+l*H+s*U+c*L,i[4]=a*x+l*F+s*W+c*j,i[8]=a*b+l*E+s*k+c*B,i[12]=a*R+l*N+s*D+c*O,i[1]=u*w+d*H+f*U+p*L,i[5]=u*x+d*F+f*W+p*j,i[9]=u*b+d*E+f*k+p*B,i[13]=u*R+d*N+f*D+p*O,i[2]=g*w+A*H+y*U+S*L,i[6]=g*x+A*F+y*W+S*j,i[10]=g*b+A*E+y*k+S*B,i[14]=g*R+A*N+y*D+S*O,i[3]=C*w+P*H+v*U+T*L,i[7]=C*x+P*F+v*W+T*j,i[11]=C*b+P*E+v*k+T*B,i[15]=C*R+P*N+v*D+T*O,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],o=e[4],r=e[8],i=e[12],a=e[1],l=e[5],s=e[9],c=e[13],u=e[2],d=e[6],f=e[10],p=e[14],g=e[3],A=e[7],y=e[11],S=e[15];return g*(+i*s*d-r*c*d-i*l*f+o*c*f+r*l*p-o*s*p)+A*(+n*s*p-n*c*f+i*a*f-r*a*p+r*c*u-i*s*u)+y*(+n*c*d-n*l*p-i*a*d+o*a*p+i*l*u-o*c*u)+S*(-r*l*u-n*s*d+n*l*f+r*a*d-o*a*f+o*s*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,o){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=o),this}invert(){const e=this.elements,n=e[0],o=e[1],r=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],u=e[8],d=e[9],f=e[10],p=e[11],g=e[12],A=e[13],y=e[14],S=e[15],C=d*y*c-A*f*c+A*s*p-l*y*p-d*s*S+l*f*S,P=g*f*c-u*y*c-g*s*p+a*y*p+u*s*S-a*f*S,v=u*A*c-g*d*c+g*l*p-a*A*p-u*l*S+a*d*S,T=g*d*s-u*A*s-g*l*f+a*A*f+u*l*y-a*d*y,w=n*C+o*P+r*v+i*T;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/w;return e[0]=C*x,e[1]=(A*f*i-d*y*i-A*r*p+o*y*p+d*r*S-o*f*S)*x,e[2]=(l*y*i-A*s*i+A*r*c-o*y*c-l*r*S+o*s*S)*x,e[3]=(d*s*i-l*f*i-d*r*c+o*f*c+l*r*p-o*s*p)*x,e[4]=P*x,e[5]=(u*y*i-g*f*i+g*r*p-n*y*p-u*r*S+n*f*S)*x,e[6]=(g*s*i-a*y*i-g*r*c+n*y*c+a*r*S-n*s*S)*x,e[7]=(a*f*i-u*s*i+u*r*c-n*f*c-a*r*p+n*s*p)*x,e[8]=v*x,e[9]=(g*d*i-u*A*i-g*o*p+n*A*p+u*o*S-n*d*S)*x,e[10]=(a*A*i-g*l*i+g*o*c-n*A*c-a*o*S+n*l*S)*x,e[11]=(u*l*i-a*d*i-u*o*c+n*d*c+a*o*p-n*l*p)*x,e[12]=T*x,e[13]=(u*A*r-g*d*r+g*o*f-n*A*f-u*o*y+n*d*y)*x,e[14]=(g*l*r-a*A*r-g*o*s+n*A*s+a*o*y-n*l*y)*x,e[15]=(a*d*r-u*l*r+u*o*s-n*d*s-a*o*f+n*l*f)*x,this}scale(e){const n=this.elements,o=e.x,r=e.y,i=e.z;return n[0]*=o,n[4]*=r,n[8]*=i,n[1]*=o,n[5]*=r,n[9]*=i,n[2]*=o,n[6]*=r,n[10]*=i,n[3]*=o,n[7]*=r,n[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],o=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,o,r))}makeTranslation(e,n,o){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,o,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),o=Math.sin(e);return this.set(1,0,0,0,0,n,-o,0,0,o,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,0,o,0,0,1,0,0,-o,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),o=Math.sin(e);return this.set(n,-o,0,0,o,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const o=Math.cos(n),r=Math.sin(n),i=1-o,a=e.x,l=e.y,s=e.z,c=i*a,u=i*l;return this.set(c*a+o,c*l-r*s,c*s+r*l,0,c*l+r*s,u*l+o,u*s-r*a,0,c*s-r*l,u*s+r*a,i*s*s+o,0,0,0,0,1),this}makeScale(e,n,o){return this.set(e,0,0,0,0,n,0,0,0,0,o,0,0,0,0,1),this}makeShear(e,n,o,r,i,a){return this.set(1,o,i,0,e,1,a,0,n,r,1,0,0,0,0,1),this}compose(e,n,o){const r=this.elements,i=n._x,a=n._y,l=n._z,s=n._w,c=i+i,u=a+a,d=l+l,f=i*c,p=i*u,g=i*d,A=a*u,y=a*d,S=l*d,C=s*c,P=s*u,v=s*d,T=o.x,w=o.y,x=o.z;return r[0]=(1-(A+S))*T,r[1]=(p+v)*T,r[2]=(g-P)*T,r[3]=0,r[4]=(p-v)*w,r[5]=(1-(f+S))*w,r[6]=(y+C)*w,r[7]=0,r[8]=(g+P)*x,r[9]=(y-C)*x,r[10]=(1-(f+A))*x,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,o){const r=this.elements;let i=uT.set(r[0],r[1],r[2]).length();const a=uT.set(r[4],r[5],r[6]).length(),l=uT.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Xy.copy(this);const c=1/i,u=1/a,d=1/l;return Xy.elements[0]*=c,Xy.elements[1]*=c,Xy.elements[2]*=c,Xy.elements[4]*=u,Xy.elements[5]*=u,Xy.elements[6]*=u,Xy.elements[8]*=d,Xy.elements[9]*=d,Xy.elements[10]*=d,n.setFromRotationMatrix(Xy),o.x=i,o.y=a,o.z=l,this}makePerspective(e,n,o,r,i,a,l=g9){const s=this.elements,c=2*i/(n-e),u=2*i/(o-r),d=(n+e)/(n-e),f=(o+r)/(o-r);let p,g;if(l===g9)p=-(a+i)/(a-i),g=-2*a*i/(a-i);else if(l===NF)p=-a/(a-i),g=-a*i/(a-i);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return s[0]=c,s[4]=0,s[8]=d,s[12]=0,s[1]=0,s[5]=u,s[9]=f,s[13]=0,s[2]=0,s[6]=0,s[10]=p,s[14]=g,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,n,o,r,i,a,l=g9){const s=this.elements,c=1/(n-e),u=1/(o-r),d=1/(a-i),f=(n+e)*c,p=(o+r)*u;let g,A;if(l===g9)g=(a+i)*d,A=-2*d;else if(l===NF)g=i*d,A=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-f,s[1]=0,s[5]=2*u,s[9]=0,s[13]=-p,s[2]=0,s[6]=0,s[10]=A,s[14]=-g,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const n=this.elements,o=e.elements;for(let r=0;r<16;r++)if(n[r]!==o[r])return!1;return!0}fromArray(e,n=0){for(let o=0;o<16;o++)this.elements[o]=e[o+n];return this}toArray(e=[],n=0){const o=this.elements;return e[n]=o[0],e[n+1]=o[1],e[n+2]=o[2],e[n+3]=o[3],e[n+4]=o[4],e[n+5]=o[5],e[n+6]=o[6],e[n+7]=o[7],e[n+8]=o[8],e[n+9]=o[9],e[n+10]=o[10],e[n+11]=o[11],e[n+12]=o[12],e[n+13]=o[13],e[n+14]=o[14],e[n+15]=o[15],e}}const uT=new le,Xy=new Ki,G1t=new le(0,0,0),X1t=new le(1,1,1),x4=new le,bB=new le,E1=new le,x4e=new Ki,b4e=new Ts;class ln{constructor(e=0,n=0,o=0,r=ln.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=o,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,o,r=this._order){return this._x=e,this._y=n,this._z=o,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,o=!0){const r=e.elements,i=r[0],a=r[4],l=r[8],s=r[1],c=r[5],u=r[9],d=r[2],f=r[6],p=r[10];switch(n){case"XYZ":this._y=Math.asin(h0(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-h0(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(l,p),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-d,i),this._z=0);break;case"ZXY":this._x=Math.asin(h0(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-h0(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(h0(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,i)):(this._x=0,this._y=Math.atan2(l,p));break;case"XZY":this._z=Math.asin(-h0(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(l,i)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,o===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,o){return x4e.makeRotationFromQuaternion(e),this.setFromRotationMatrix(x4e,n,o)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return b4e.setFromEuler(this),this.setFromQuaternion(b4e,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ln.DEFAULT_ORDER="XYZ";class fx{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let o=0;o0&&(o=o.concat(a))}return o}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vz,e,K1t),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(vz,q1t,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let o=0,r=n.length;o0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function i(l,s){return l[s.uuid]===void 0&&(l[s.uuid]=s.toJSON(e)),s.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const s=l.shapes;if(Array.isArray(s))for(let c=0,u=s.length;c0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(o.geometries=l),s.length>0&&(o.materials=s),c.length>0&&(o.textures=c),u.length>0&&(o.images=u),d.length>0&&(o.shapes=d),f.length>0&&(o.skeletons=f),p.length>0&&(o.animations=p),g.length>0&&(o.nodes=g)}return o.object=r,o;function a(l){const s=[];for(const c in l){const u=l[c];delete u.metadata,s.push(u)}return s}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let o=0;o0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,n,o,r,i){Jy.subVectors(r,n),n6.subVectors(o,n),Noe.subVectors(e,n);const a=Jy.dot(Jy),l=Jy.dot(n6),s=Jy.dot(Noe),c=n6.dot(n6),u=n6.dot(Noe),d=a*c-l*l;if(d===0)return i.set(-2,-1,-1);const f=1/d,p=(c*s-l*u)*f,g=(a*u-l*s)*f;return i.set(1-p-g,g,p)}static containsPoint(e,n,o,r){return this.getBarycoord(e,n,o,r,o6),o6.x>=0&&o6.y>=0&&o6.x+o6.y<=1}static getUV(e,n,o,r,i,a,l,s){return TB===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),TB=!0),this.getInterpolation(e,n,o,r,i,a,l,s)}static getInterpolation(e,n,o,r,i,a,l,s){return this.getBarycoord(e,n,o,r,o6),s.setScalar(0),s.addScaledVector(i,o6.x),s.addScaledVector(a,o6.y),s.addScaledVector(l,o6.z),s}static isFrontFacing(e,n,o,r){return Jy.subVectors(o,n),n6.subVectors(e,n),Jy.cross(n6).dot(r)<0}set(e,n,o){return this.a.copy(e),this.b.copy(n),this.c.copy(o),this}setFromPointsAndIndices(e,n,o,r){return this.a.copy(e[n]),this.b.copy(e[o]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,o,r){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,o),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Jy.subVectors(this.c,this.b),n6.subVectors(this.a,this.b),Jy.cross(n6).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ah.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return ah.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,o,r,i){return TB===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),TB=!0),ah.getInterpolation(e,this.a,this.b,this.c,n,o,r,i)}getInterpolation(e,n,o,r,i){return ah.getInterpolation(e,this.a,this.b,this.c,n,o,r,i)}containsPoint(e){return ah.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ah.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const o=this.a,r=this.b,i=this.c;let a,l;fT.subVectors(r,o),hT.subVectors(i,o),Uoe.subVectors(e,o);const s=fT.dot(Uoe),c=hT.dot(Uoe);if(s<=0&&c<=0)return n.copy(o);joe.subVectors(e,r);const u=fT.dot(joe),d=hT.dot(joe);if(u>=0&&d<=u)return n.copy(r);const f=s*d-u*c;if(f<=0&&s>=0&&u<=0)return a=s/(s-u),n.copy(o).addScaledVector(fT,a);Boe.subVectors(e,i);const p=fT.dot(Boe),g=hT.dot(Boe);if(g>=0&&p<=g)return n.copy(i);const A=p*c-s*g;if(A<=0&&c>=0&&g<=0)return l=c/(c-g),n.copy(o).addScaledVector(hT,l);const y=u*g-p*d;if(y<=0&&d-u>=0&&p-g>=0)return R4e.subVectors(i,r),l=(d-u)/(d-u+(p-g)),n.copy(r).addScaledVector(R4e,l);const S=1/(y+A+f);return a=A*S,l=f*S,n.copy(o).addScaledVector(fT,a).addScaledVector(hT,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const zNe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},b4={h:0,s:0,l:0},PB={h:0,s:0,l:0};function Yoe(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let rr=class{constructor(e,n,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,o)}set(e,n,o){if(n===void 0&&o===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,o);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ou){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,us.toWorkingColorSpace(this,n),this}setRGB(e,n,o,r=us.workingColorSpace){return this.r=e,this.g=n,this.b=o,us.toWorkingColorSpace(this,r),this}setHSL(e,n,o,r=us.workingColorSpace){if(e=L1e(e,1),n=h0(n,0,1),o=h0(o,0,1),n===0)this.r=this.g=this.b=o;else{const i=o<=.5?o*(1+n):o+n-o*n,a=2*o-i;this.r=Yoe(a,i,e+1/3),this.g=Yoe(a,i,e),this.b=Yoe(a,i,e-1/3)}return us.toWorkingColorSpace(this,r),this}setStyle(e,n=ou){function o(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return o(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=r[1],a=i.length;if(a===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(i,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ou){const o=zNe[e.toLowerCase()];return o!==void 0?this.setHex(o,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=TC(e.r),this.g=TC(e.g),this.b=TC(e.b),this}copyLinearToSRGB(e){return this.r=Ioe(e.r),this.g=Ioe(e.g),this.b=Ioe(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ou){return us.fromWorkingColorSpace(Gf.copy(this),e),Math.round(h0(Gf.r*255,0,255))*65536+Math.round(h0(Gf.g*255,0,255))*256+Math.round(h0(Gf.b*255,0,255))}getHexString(e=ou){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=us.workingColorSpace){us.fromWorkingColorSpace(Gf.copy(this),n);const o=Gf.r,r=Gf.g,i=Gf.b,a=Math.max(o,r,i),l=Math.min(o,r,i);let s,c;const u=(l+a)/2;if(l===a)s=0,c=0;else{const d=a-l;switch(c=u<=.5?d/(a+l):d/(2-a-l),a){case o:s=(r-i)/d+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const o=e[n];if(o===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(o):r&&r.isVector3&&o&&o.isVector3?r.copy(o):this[n]=o}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(e).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(e).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(e).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(e).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(e).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==ux&&(o.blending=this.blending),this.side!==Da&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),this.blendSrc!==tG&&(o.blendSrc=this.blendSrc),this.blendDst!==nG&&(o.blendDst=this.blendDst),this.blendEquation!==r8&&(o.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(o.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(o.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(o.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(o.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(o.blendAlpha=this.blendAlpha),this.depthFunc!==RF&&(o.depthFunc=this.depthFunc),this.depthTest===!1&&(o.depthTest=this.depthTest),this.depthWrite===!1&&(o.depthWrite=this.depthWrite),this.colorWrite===!1&&(o.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(o.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vce&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==fv&&(o.stencilFail=this.stencilFail),this.stencilZFail!==fv&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==fv&&(o.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(o.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function r(i){const a=[];for(const l in i){const s=i[l];delete s.metadata,a.push(s)}return a}if(n){const i=r(e.textures),a=r(e.images);i.length>0&&(o.textures=i),a.length>0&&(o.images=a)}return o}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let o=null;if(n!==null){const r=n.length;o=new Array(r);for(let i=0;i!==r;++i)o[i]=n[i].clone()}return this.clippingPlanes=o,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};class t3 extends Tf{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const x6=egt();function egt(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),o=new Uint32Array(512),r=new Uint32Array(512);for(let s=0;s<256;++s){const c=s-127;c<-27?(o[s]=0,o[s|256]=32768,r[s]=24,r[s|256]=24):c<-14?(o[s]=1024>>-c-14,o[s|256]=1024>>-c-14|32768,r[s]=-c-1,r[s|256]=-c-1):c<=15?(o[s]=c+15<<10,o[s|256]=c+15<<10|32768,r[s]=13,r[s|256]=13):c<128?(o[s]=31744,o[s|256]=64512,r[s]=24,r[s|256]=24):(o[s]=31744,o[s|256]=64512,r[s]=13,r[s|256]=13)}const i=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let s=1;s<1024;++s){let c=s<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,i[s]=c|u}for(let s=1024;s<2048;++s)i[s]=939524096+(s-1024<<13);for(let s=1;s<31;++s)a[s]=s<<23;a[31]=1199570944,a[32]=2147483648;for(let s=33;s<63;++s)a[s]=2147483648+(s-32<<23);a[63]=3347054592;for(let s=1;s<64;++s)s!==32&&(l[s]=1024);return{floatView:e,uint32View:n,baseTable:o,shiftTable:r,mantissaTable:i,exponentTable:a,offsetTable:l}}function Ep(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=h0(t,-65504,65504),x6.floatView[0]=t;const e=x6.uint32View[0],n=e>>23&511;return x6.baseTable[n]+((e&8388607)>>x6.shiftTable[n])}function MD(t){const e=t>>10;return x6.uint32View[0]=x6.mantissaTable[x6.offsetTable[e]+(t&1023)]+x6.exponentTable[e],x6.floatView[0]}const tgt={toHalfFloat:Ep,fromHalfFloat:MD},Z0=new le,CB=new Kt;class tl{constructor(e,n,o=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=o,this.usage=WF,this.updateRange={offset:0,count:-1},this.gpuType=v2,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,o){e*=this.itemSize,o*=n.itemSize;for(let r=0,i=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const s=this.parameters;for(const c in s)s[c]!==void 0&&(e[c]=s[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const o=this.attributes;for(const s in o){const c=o[s];e.data.attributes[s]=c.toJSON(e.data)}const r={};let i=!1;for(const s in this.morphAttributes){const c=this.morphAttributes[s],u=[];for(let d=0,f=c.length;d0&&(r[s]=u,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const o=e.index;o!==null&&this.setIndex(o.clone(n));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(n))}const i=e.morphAttributes;for(const c in i){const u=[],d=i[c];for(let f=0,p=d.length;f0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i(e.far-e.near)**2))&&(H4e.copy(i).invert(),U7.copy(e.ray).applyMatrix4(H4e),!(o.boundingBox!==null&&U7.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(e,n,U7)))}_computeIntersections(e,n,o){let r;const i=this.geometry,a=this.material,l=i.index,s=i.attributes.position,c=i.attributes.uv,u=i.attributes.uv1,d=i.attributes.normal,f=i.groups,p=i.drawRange;if(l!==null)if(Array.isArray(a))for(let g=0,A=f.length;gn.far?null:{distance:c,point:EB.clone(),object:t}}function FB(t,e,n,o,r,i,a,l,s,c){t.getVertexPosition(l,gT),t.getVertexPosition(s,mT),t.getVertexPosition(c,yT);const u=ugt(t,e,n,o,gT,mT,yT,DB);if(u){r&&(MB.fromBufferAttribute(r,l),IB.fromBufferAttribute(r,s),zB.fromBufferAttribute(r,c),u.uv=ah.getInterpolation(DB,gT,mT,yT,MB,IB,zB,new Kt)),i&&(MB.fromBufferAttribute(i,l),IB.fromBufferAttribute(i,s),zB.fromBufferAttribute(i,c),u.uv1=ah.getInterpolation(DB,gT,mT,yT,MB,IB,zB,new Kt),u.uv2=u.uv1),a&&(I4e.fromBufferAttribute(a,l),z4e.fromBufferAttribute(a,s),D4e.fromBufferAttribute(a,c),u.normal=ah.getInterpolation(DB,gT,mT,yT,I4e,z4e,D4e,new le),u.normal.dot(o.direction)>0&&u.normal.multiplyScalar(-1));const d={a:l,b:s,c,normal:new le,materialIndex:0};ah.getNormal(gT,mT,yT,d.normal),u.face=d}return u}class n3 extends ji{constructor(e=1,n=1,o=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:o,widthSegments:r,heightSegments:i,depthSegments:a};const l=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);const s=[],c=[],u=[],d=[];let f=0,p=0;g("z","y","x",-1,-1,o,n,e,a,i,0),g("z","y","x",1,-1,o,n,-e,a,i,1),g("x","z","y",1,1,e,o,n,r,a,2),g("x","z","y",1,-1,e,o,-n,r,a,3),g("x","y","z",1,-1,e,n,o,r,i,4),g("x","y","z",-1,-1,e,n,-o,r,i,5),this.setIndex(s),this.setAttribute("position",new gr(c,3)),this.setAttribute("normal",new gr(u,3)),this.setAttribute("uv",new gr(d,2));function g(A,y,S,C,P,v,T,w,x,b,R){const H=v/x,F=T/b,E=v/2,N=T/2,U=w/2,W=x+1,k=b+1;let D=0,L=0;const j=new le;for(let B=0;B0?1:-1,u.push(j.x,j.y,j.z),d.push(V/x),d.push(1-B/b),D+=1}}for(let B=0;B1?null:n.copy(e.start).addScaledVector(o,i)}intersectsLine(e){const n=this.distanceToPoint(e.start),o=this.distanceToPoint(e.end);return n<0&&o>0||o<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const o=n||ggt.getNormalMatrix(e),r=this.coplanarPoint(_oe).applyMatrix4(e),i=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};const j7=new s1,kB=new ae;class fq{constructor(e=new l9,n=new l9,o=new l9,r=new l9,i=new l9,a=new l9){this.planes=[e,n,o,r,i,a]}set(e,n,o,r,i,a){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(o),l[3].copy(r),l[4].copy(i),l[5].copy(a),this}copy(e){const n=this.planes;for(let o=0;o<6;o++)n[o].copy(e.planes[o]);return this}setFromProjectionMatrix(e,n=g9){const o=this.planes,r=e.elements,i=r[0],a=r[1],l=r[2],s=r[3],c=r[4],u=r[5],d=r[6],f=r[7],p=r[8],g=r[9],A=r[10],y=r[11],S=r[12],C=r[13],P=r[14],v=r[15];if(o[0].setComponents(s-i,f-c,y-p,v-S).normalize(),o[1].setComponents(s+i,f+c,y+p,v+S).normalize(),o[2].setComponents(s+a,f+u,y+g,v+C).normalize(),o[3].setComponents(s-a,f-u,y-g,v-C).normalize(),o[4].setComponents(s-l,f-d,y-A,v-P).normalize(),n===g9)o[5].setComponents(s+l,f+d,y+A,v+P).normalize();else if(n===NF)o[5].setComponents(l,d,A,P).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),j7.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),j7.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(j7)}intersectsSprite(e){return j7.center.set(0,0,0),j7.radius=.7071067811865476,j7.applyMatrix4(e.matrixWorld),this.intersectsSphere(j7)}intersectsSphere(e){const n=this.planes,o=e.center,r=-e.radius;for(let i=0;i<6;i++)if(n[i].distanceToPoint(o)0?e.max.x:e.min.x,kB.y=r.normal.y>0?e.max.y:e.min.y,kB.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(kB)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let o=0;o<6;o++)if(n[o].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function kNe(){let t=null,e=!1,n=null,o=null;function r(i,a){n(i,a),o=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(o=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(o),e=!1},setAnimationLoop:function(i){n=i},setContext:function(i){t=i}}}function mgt(t,e){const n=e.isWebGL2,o=new WeakMap;function r(c,u){const d=c.array,f=c.usage,p=t.createBuffer();t.bindBuffer(u,p),t.bufferData(u,d,f),c.onUploadCallback();let g;if(d instanceof Float32Array)g=t.FLOAT;else if(d instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(n)g=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)g=t.SHORT;else if(d instanceof Uint32Array)g=t.UNSIGNED_INT;else if(d instanceof Int32Array)g=t.INT;else if(d instanceof Int8Array)g=t.BYTE;else if(d instanceof Uint8Array)g=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)g=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:g,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version}}function i(c,u,d){const f=u.array,p=u.updateRange;t.bindBuffer(d,c),p.count===-1?t.bufferSubData(d,0,f):(n?t.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):t.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),o.get(c)}function l(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=o.get(c);u&&(t.deleteBuffer(u.buffer),o.delete(c))}function s(c,u){if(c.isGLBufferAttribute){const f=o.get(c);(!f||f.version1?null:n.copy(e.start).addScaledVector(o,i)}intersectsLine(e){const n=this.distanceToPoint(e.start),o=this.distanceToPoint(e.end);return n<0&&o>0||o<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const o=n||ggt.getNormalMatrix(e),r=this.coplanarPoint(_oe).applyMatrix4(e),i=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};const j7=new s1,kB=new le;class fq{constructor(e=new l9,n=new l9,o=new l9,r=new l9,i=new l9,a=new l9){this.planes=[e,n,o,r,i,a]}set(e,n,o,r,i,a){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(o),l[3].copy(r),l[4].copy(i),l[5].copy(a),this}copy(e){const n=this.planes;for(let o=0;o<6;o++)n[o].copy(e.planes[o]);return this}setFromProjectionMatrix(e,n=g9){const o=this.planes,r=e.elements,i=r[0],a=r[1],l=r[2],s=r[3],c=r[4],u=r[5],d=r[6],f=r[7],p=r[8],g=r[9],A=r[10],y=r[11],S=r[12],C=r[13],P=r[14],v=r[15];if(o[0].setComponents(s-i,f-c,y-p,v-S).normalize(),o[1].setComponents(s+i,f+c,y+p,v+S).normalize(),o[2].setComponents(s+a,f+u,y+g,v+C).normalize(),o[3].setComponents(s-a,f-u,y-g,v-C).normalize(),o[4].setComponents(s-l,f-d,y-A,v-P).normalize(),n===g9)o[5].setComponents(s+l,f+d,y+A,v+P).normalize();else if(n===NF)o[5].setComponents(l,d,A,P).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),j7.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),j7.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(j7)}intersectsSprite(e){return j7.center.set(0,0,0),j7.radius=.7071067811865476,j7.applyMatrix4(e.matrixWorld),this.intersectsSphere(j7)}intersectsSphere(e){const n=this.planes,o=e.center,r=-e.radius;for(let i=0;i<6;i++)if(n[i].distanceToPoint(o)0?e.max.x:e.min.x,kB.y=r.normal.y>0?e.max.y:e.min.y,kB.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(kB)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let o=0;o<6;o++)if(n[o].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function kNe(){let t=null,e=!1,n=null,o=null;function r(i,a){n(i,a),o=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(o=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(o),e=!1},setAnimationLoop:function(i){n=i},setContext:function(i){t=i}}}function mgt(t,e){const n=e.isWebGL2,o=new WeakMap;function r(c,u){const d=c.array,f=c.usage,p=t.createBuffer();t.bindBuffer(u,p),t.bufferData(u,d,f),c.onUploadCallback();let g;if(d instanceof Float32Array)g=t.FLOAT;else if(d instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(n)g=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)g=t.SHORT;else if(d instanceof Uint32Array)g=t.UNSIGNED_INT;else if(d instanceof Int32Array)g=t.INT;else if(d instanceof Int8Array)g=t.BYTE;else if(d instanceof Uint8Array)g=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)g=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:g,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version}}function i(c,u,d){const f=u.array,p=u.updateRange;t.bindBuffer(d,c),p.count===-1?t.bufferSubData(d,0,f):(n?t.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):t.bufferSubData(d,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),o.get(c)}function l(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=o.get(c);u&&(t.deleteBuffer(u.buffer),o.delete(c))}function s(c,u){if(c.isGLBufferAttribute){const f=o.get(c);(!f||f.version #include #include -}`,da={alphahash_fragment:ygt,alphahash_pars_fragment:Agt,alphamap_fragment:wgt,alphamap_pars_fragment:vgt,alphatest_fragment:xgt,alphatest_pars_fragment:bgt,aomap_fragment:Sgt,aomap_pars_fragment:Tgt,begin_vertex:Pgt,beginnormal_vertex:Cgt,bsdfs:Rgt,iridescence_fragment:Hgt,bumpmap_pars_fragment:Mgt,clipping_planes_fragment:Igt,clipping_planes_pars_fragment:zgt,clipping_planes_pars_vertex:Dgt,clipping_planes_vertex:Egt,color_fragment:Fgt,color_pars_fragment:kgt,color_pars_vertex:Lgt,color_vertex:Wgt,common:Ngt,cube_uv_reflection_fragment:Ugt,defaultnormal_vertex:jgt,displacementmap_pars_vertex:Bgt,displacementmap_vertex:Ygt,emissivemap_fragment:Ogt,emissivemap_pars_fragment:Vgt,colorspace_fragment:_gt,colorspace_pars_fragment:Ggt,envmap_fragment:Xgt,envmap_common_pars_fragment:Jgt,envmap_pars_fragment:Kgt,envmap_pars_vertex:qgt,envmap_physical_pars_fragment:smt,envmap_vertex:$gt,fog_vertex:Qgt,fog_pars_vertex:Zgt,fog_fragment:emt,fog_pars_fragment:tmt,gradientmap_pars_fragment:nmt,lightmap_fragment:omt,lightmap_pars_fragment:rmt,lights_lambert_fragment:imt,lights_lambert_pars_fragment:amt,lights_pars_begin:lmt,lights_toon_fragment:cmt,lights_toon_pars_fragment:umt,lights_phong_fragment:dmt,lights_phong_pars_fragment:fmt,lights_physical_fragment:hmt,lights_physical_pars_fragment:pmt,lights_fragment_begin:gmt,lights_fragment_maps:mmt,lights_fragment_end:ymt,logdepthbuf_fragment:Amt,logdepthbuf_pars_fragment:wmt,logdepthbuf_pars_vertex:vmt,logdepthbuf_vertex:xmt,map_fragment:bmt,map_pars_fragment:Smt,map_particle_fragment:Tmt,map_particle_pars_fragment:Pmt,metalnessmap_fragment:Cmt,metalnessmap_pars_fragment:Rmt,morphcolor_vertex:Hmt,morphnormal_vertex:Mmt,morphtarget_pars_vertex:Imt,morphtarget_vertex:zmt,normal_fragment_begin:Dmt,normal_fragment_maps:Emt,normal_pars_fragment:Fmt,normal_pars_vertex:kmt,normal_vertex:Lmt,normalmap_pars_fragment:Wmt,clearcoat_normal_fragment_begin:Nmt,clearcoat_normal_fragment_maps:Umt,clearcoat_pars_fragment:jmt,iridescence_pars_fragment:Bmt,opaque_fragment:Ymt,packing:Omt,premultiplied_alpha_fragment:Vmt,project_vertex:_mt,dithering_fragment:Gmt,dithering_pars_fragment:Xmt,roughnessmap_fragment:Jmt,roughnessmap_pars_fragment:Kmt,shadowmap_pars_fragment:qmt,shadowmap_pars_vertex:$mt,shadowmap_vertex:Qmt,shadowmask_pars_fragment:Zmt,skinbase_vertex:eyt,skinning_pars_vertex:tyt,skinning_vertex:nyt,skinnormal_vertex:oyt,specularmap_fragment:ryt,specularmap_pars_fragment:iyt,tonemapping_fragment:ayt,tonemapping_pars_fragment:lyt,transmission_fragment:syt,transmission_pars_fragment:cyt,uv_pars_fragment:uyt,uv_pars_vertex:dyt,uv_vertex:fyt,worldpos_vertex:hyt,background_vert:pyt,background_frag:gyt,backgroundCube_vert:myt,backgroundCube_frag:yyt,cube_vert:Ayt,cube_frag:wyt,depth_vert:vyt,depth_frag:xyt,distanceRGBA_vert:byt,distanceRGBA_frag:Syt,equirect_vert:Tyt,equirect_frag:Pyt,linedashed_vert:Cyt,linedashed_frag:Ryt,meshbasic_vert:Hyt,meshbasic_frag:Myt,meshlambert_vert:Iyt,meshlambert_frag:zyt,meshmatcap_vert:Dyt,meshmatcap_frag:Eyt,meshnormal_vert:Fyt,meshnormal_frag:kyt,meshphong_vert:Lyt,meshphong_frag:Wyt,meshphysical_vert:Nyt,meshphysical_frag:Uyt,meshtoon_vert:jyt,meshtoon_frag:Byt,points_vert:Yyt,points_frag:Oyt,shadow_vert:Vyt,shadow_frag:_yt,sprite_vert:Gyt,sprite_frag:Xyt},mr={common:{diffuse:{value:new rr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ha},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ha}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ha}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ha}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ha},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ha},normalScale:{value:new Kt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ha},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ha}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ha}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ha}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new rr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0},uvTransform:{value:new ha}},sprite:{diffuse:{value:new rr(16777215)},opacity:{value:1},center:{value:new Kt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ha},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0}}},m2={basic:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.fog]),vertexShader:da.meshbasic_vert,fragmentShader:da.meshbasic_frag},lambert:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,mr.lights,{emissive:{value:new rr(0)}}]),vertexShader:da.meshlambert_vert,fragmentShader:da.meshlambert_frag},phong:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,mr.lights,{emissive:{value:new rr(0)},specular:{value:new rr(1118481)},shininess:{value:30}}]),vertexShader:da.meshphong_vert,fragmentShader:da.meshphong_frag},standard:{uniforms:_h([mr.common,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.roughnessmap,mr.metalnessmap,mr.fog,mr.lights,{emissive:{value:new rr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:da.meshphysical_vert,fragmentShader:da.meshphysical_frag},toon:{uniforms:_h([mr.common,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.gradientmap,mr.fog,mr.lights,{emissive:{value:new rr(0)}}]),vertexShader:da.meshtoon_vert,fragmentShader:da.meshtoon_frag},matcap:{uniforms:_h([mr.common,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,{matcap:{value:null}}]),vertexShader:da.meshmatcap_vert,fragmentShader:da.meshmatcap_frag},points:{uniforms:_h([mr.points,mr.fog]),vertexShader:da.points_vert,fragmentShader:da.points_frag},dashed:{uniforms:_h([mr.common,mr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:da.linedashed_vert,fragmentShader:da.linedashed_frag},depth:{uniforms:_h([mr.common,mr.displacementmap]),vertexShader:da.depth_vert,fragmentShader:da.depth_frag},normal:{uniforms:_h([mr.common,mr.bumpmap,mr.normalmap,mr.displacementmap,{opacity:{value:1}}]),vertexShader:da.meshnormal_vert,fragmentShader:da.meshnormal_frag},sprite:{uniforms:_h([mr.sprite,mr.fog]),vertexShader:da.sprite_vert,fragmentShader:da.sprite_frag},background:{uniforms:{uvTransform:{value:new ha},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:da.background_vert,fragmentShader:da.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:da.backgroundCube_vert,fragmentShader:da.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:da.cube_vert,fragmentShader:da.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:da.equirect_vert,fragmentShader:da.equirect_frag},distanceRGBA:{uniforms:_h([mr.common,mr.displacementmap,{referencePosition:{value:new ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:da.distanceRGBA_vert,fragmentShader:da.distanceRGBA_frag},shadow:{uniforms:_h([mr.lights,mr.fog,{color:{value:new rr(0)},opacity:{value:1}}]),vertexShader:da.shadow_vert,fragmentShader:da.shadow_frag}};m2.physical={uniforms:_h([m2.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ha},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ha},clearcoatNormalScale:{value:new Kt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ha},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ha},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ha},sheen:{value:0},sheenColor:{value:new rr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ha},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ha},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ha},transmissionSamplerSize:{value:new Kt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ha},attenuationDistance:{value:0},attenuationColor:{value:new rr(0)},specularColor:{value:new rr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ha},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ha},anisotropyVector:{value:new Kt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ha}}]),vertexShader:da.meshphysical_vert,fragmentShader:da.meshphysical_frag};const LB={r:0,b:0,g:0};function Jyt(t,e,n,o,r,i,a){const l=new rr(0);let s=i===!0?0:1,c,u,d=null,f=0,p=null;function g(y,S){let C=!1,P=S.isScene===!0?S.background:null;P&&P.isTexture&&(P=(S.backgroundBlurriness>0?n:e).get(P)),P===null?A(l,s):P&&P.isColor&&(A(P,1),C=!0);const v=t.xr.getEnvironmentBlendMode();v==="additive"?o.buffers.color.setClear(0,0,0,1,a):v==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,a),(t.autoClear||C)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),P&&(P.isCubeTexture||P.mapping===CH)?(u===void 0&&(u=new ls(new n3(1,1,1),new O2({name:"BackgroundCubeMaterial",uniforms:aR(m2.backgroundCube.uniforms),vertexShader:m2.backgroundCube.vertexShader,fragmentShader:m2.backgroundCube.fragmentShader,side:r0,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(T,w,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=P,u.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.toneMapped=us.getTransfer(P.colorSpace)!==Ys,(d!==P||f!==P.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new ls(new zw(2,2),new O2({name:"BackgroundMaterial",uniforms:aR(m2.background.uniforms),vertexShader:m2.background.vertexShader,fragmentShader:m2.background.fragmentShader,side:Da,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=P,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=us.getTransfer(P.colorSpace)!==Ys,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(d!==P||f!==P.version||p!==t.toneMapping)&&(c.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function A(y,S){y.getRGB(LB,DNe(t)),o.buffers.color.setClear(LB.r,LB.g,LB.b,S,a)}return{getClearColor:function(){return l},setClearColor:function(y,S=1){l.set(y),s=S,A(l,s)},getClearAlpha:function(){return s},setClearAlpha:function(y){s=y,A(l,s)},render:g}}function Kyt(t,e,n,o){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),i=o.isWebGL2?null:e.get("OES_vertex_array_object"),a=o.isWebGL2||i!==null,l={},s=y(null);let c=s,u=!1;function d(U,W,k,D,L){let j=!1;if(a){const B=A(D,k,W);c!==B&&(c=B,p(c.object)),j=S(U,D,k,L),j&&C(U,D,k,L)}else{const B=W.wireframe===!0;(c.geometry!==D.id||c.program!==k.id||c.wireframe!==B)&&(c.geometry=D.id,c.program=k.id,c.wireframe=B,j=!0)}L!==null&&n.update(L,t.ELEMENT_ARRAY_BUFFER),(j||u)&&(u=!1,b(U,W,k,D),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(L).buffer))}function f(){return o.isWebGL2?t.createVertexArray():i.createVertexArrayOES()}function p(U){return o.isWebGL2?t.bindVertexArray(U):i.bindVertexArrayOES(U)}function g(U){return o.isWebGL2?t.deleteVertexArray(U):i.deleteVertexArrayOES(U)}function A(U,W,k){const D=k.wireframe===!0;let L=l[U.id];L===void 0&&(L={},l[U.id]=L);let j=L[W.id];j===void 0&&(j={},L[W.id]=j);let B=j[D];return B===void 0&&(B=y(f()),j[D]=B),B}function y(U){const W=[],k=[],D=[];for(let L=0;L=0){const q=L[V];let $=j[V];if($===void 0&&(V==="instanceMatrix"&&U.instanceMatrix&&($=U.instanceMatrix),V==="instanceColor"&&U.instanceColor&&($=U.instanceColor)),q===void 0||q.attribute!==$||$&&q.data!==$.data)return!0;B++}return c.attributesNum!==B||c.index!==D}function C(U,W,k,D){const L={},j=W.attributes;let B=0;const O=k.getAttributes();for(const V in O)if(O[V].location>=0){let q=j[V];q===void 0&&(V==="instanceMatrix"&&U.instanceMatrix&&(q=U.instanceMatrix),V==="instanceColor"&&U.instanceColor&&(q=U.instanceColor));const $={};$.attribute=q,q&&q.data&&($.data=q.data),L[V]=$,B++}c.attributes=L,c.attributesNum=B,c.index=D}function P(){const U=c.newAttributes;for(let W=0,k=U.length;W=0){let G=L[O];if(G===void 0&&(O==="instanceMatrix"&&U.instanceMatrix&&(G=U.instanceMatrix),O==="instanceColor"&&U.instanceColor&&(G=U.instanceColor)),G!==void 0){const q=G.normalized,$=G.itemSize,ie=n.get(G);if(ie===void 0)continue;const Q=ie.buffer,se=ie.type,Z=ie.bytesPerElement,ee=o.isWebGL2===!0&&(se===t.INT||se===t.UNSIGNED_INT||G.gpuType===R1e);if(G.isInterleavedBufferAttribute){const te=G.data,oe=te.stride,de=G.offset;if(te.isInstancedInterleavedBuffer){for(let he=0;he0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const s=i(l);s!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",s,"instead."),l=s);const c=a||e.has("WEBGL_draw_buffers"),u=n.logarithmicDepthBuffer===!0,d=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_TEXTURE_SIZE),g=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),A=t.getParameter(t.MAX_VERTEX_ATTRIBS),y=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),S=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=f>0,v=a||e.has("OES_texture_float"),T=P&&v,w=a?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:i,precision:l,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:g,maxAttributes:A,maxVertexUniforms:y,maxVaryings:S,maxFragmentUniforms:C,vertexTextures:P,floatFragmentTextures:v,floatVertexTextures:T,maxSamples:w}}function Qyt(t){const e=this;let n=null,o=0,r=!1,i=!1;const a=new l9,l=new ha,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||o!==0||r;return r=f,o=d.length,p},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,p){const g=d.clippingPlanes,A=d.clipIntersection,y=d.clipShadows,S=t.get(d);if(!r||g===null||g.length===0||i&&!y)i?u(null):c();else{const C=i?0:o,P=C*4;let v=S.clippingState||null;s.value=v,v=u(g,f,P,p);for(let T=0;T!==P;++T)v[T]=n[T];S.clippingState=v,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=C}};function c(){s.value!==n&&(s.value=n,s.needsUpdate=o>0),e.numPlanes=o,e.numIntersection=0}function u(d,f,p,g){const A=d!==null?d.length:0;let y=null;if(A!==0){if(y=s.value,g!==!0||y===null){const S=p+A*4,C=f.matrixWorldInverse;l.getNormalMatrix(C),(y===null||y.length0){const c=new FNe(s.height/2);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",r),n(c.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const s=e.get(l);s!==void 0&&(e.delete(l),s.dispose())}function i(){e=new WeakMap}return{get:o,dispose:i}}let lW=class extends iW{constructor(e=-1,n=1,o=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=o,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,o,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=o,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=o-e,a=o+e,l=r+n,s=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,l-=u*this.view.offsetY,s=l-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,l,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const qP=4,E4e=[.125,.215,.35,.446,.526,.582],bv=20,Goe=new lW,F4e=new rr;let Xoe=null,Joe=0,Koe=0;const hv=(1+Math.sqrt(5))/2,vT=1/hv,k4e=[new ae(1,1,1),new ae(-1,1,1),new ae(1,1,-1),new ae(-1,1,-1),new ae(0,hv,vT),new ae(0,hv,-vT),new ae(vT,0,hv),new ae(-vT,0,hv),new ae(hv,vT,0),new ae(-hv,vT,0)];class Sce{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,o=.1,r=100){Xoe=this._renderer.getRenderTarget(),Joe=this._renderer.getActiveCubeFace(),Koe=this._renderer.getActiveMipmapLevel(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,o,r,i),n>0&&this._blur(i,0,0,n),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=N4e(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=W4e(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),u.setRenderTarget(r),A&&u.render(g,l),u.render(e,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=y}_textureToCubeUV(e,n){const o=this._renderer,r=e.mapping===$6||e.mapping===tw;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=N4e()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=W4e());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new ls(this._lodPlanes[0],i),l=i.uniforms;l.envMap.value=e;const s=this._cubeSize;WB(n,0,0,3*s,2*s),o.setRenderTarget(n),o.render(a,Goe)}_applyPMREM(e){const n=this._renderer,o=n.autoClear;n.autoClear=!1;for(let r=1;rbv&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${bv}`);const S=[];let C=0;for(let x=0;xP-qP?r-P+qP:0),w=4*(this._cubeSize-v);WB(n,T,w,3*v,2*v),s.setRenderTarget(n),s.render(d,Goe)}}function e2t(t){const e=[],n=[],o=[];let r=t;const i=t-qP+1+E4e.length;for(let a=0;at-qP?s=E4e[a-t+qP-1]:a===0&&(s=0),o.push(s);const c=1/(l-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,g=6,A=3,y=2,S=1,C=new Float32Array(A*g*p),P=new Float32Array(y*g*p),v=new Float32Array(S*g*p);for(let w=0;w2?0:-1,R=[x,b,0,x+2/3,b,0,x+2/3,b+1,0,x,b,0,x+2/3,b+1,0,x,b+1,0];C.set(R,A*g*w),P.set(f,y*g*w);const H=[w,w,w,w,w,w];v.set(H,S*g*w)}const T=new ji;T.setAttribute("position",new tl(C,A)),T.setAttribute("uv",new tl(P,y)),T.setAttribute("faceIndex",new tl(v,S)),e.push(T),r>qP&&r--}return{lodPlanes:e,sizeLods:n,sigmas:o}}function L4e(t,e,n){const o=new $m(t,e,n);return o.texture.mapping=CH,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function WB(t,e,n,o,r){t.viewport.set(e,n,o,r),t.scissor.set(e,n,o,r)}function t2t(t,e,n){const o=new Float32Array(bv),r=new ae(0,1,0);return new O2({name:"SphericalGaussianBlur",defines:{n:bv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:B1e(),fragmentShader:` +}`,da={alphahash_fragment:ygt,alphahash_pars_fragment:Agt,alphamap_fragment:wgt,alphamap_pars_fragment:vgt,alphatest_fragment:xgt,alphatest_pars_fragment:bgt,aomap_fragment:Sgt,aomap_pars_fragment:Tgt,begin_vertex:Pgt,beginnormal_vertex:Cgt,bsdfs:Rgt,iridescence_fragment:Hgt,bumpmap_pars_fragment:Mgt,clipping_planes_fragment:Igt,clipping_planes_pars_fragment:zgt,clipping_planes_pars_vertex:Dgt,clipping_planes_vertex:Egt,color_fragment:Fgt,color_pars_fragment:kgt,color_pars_vertex:Lgt,color_vertex:Wgt,common:Ngt,cube_uv_reflection_fragment:Ugt,defaultnormal_vertex:jgt,displacementmap_pars_vertex:Bgt,displacementmap_vertex:Ygt,emissivemap_fragment:Ogt,emissivemap_pars_fragment:Vgt,colorspace_fragment:_gt,colorspace_pars_fragment:Ggt,envmap_fragment:Xgt,envmap_common_pars_fragment:Jgt,envmap_pars_fragment:Kgt,envmap_pars_vertex:qgt,envmap_physical_pars_fragment:smt,envmap_vertex:$gt,fog_vertex:Qgt,fog_pars_vertex:Zgt,fog_fragment:emt,fog_pars_fragment:tmt,gradientmap_pars_fragment:nmt,lightmap_fragment:omt,lightmap_pars_fragment:rmt,lights_lambert_fragment:imt,lights_lambert_pars_fragment:amt,lights_pars_begin:lmt,lights_toon_fragment:cmt,lights_toon_pars_fragment:umt,lights_phong_fragment:dmt,lights_phong_pars_fragment:fmt,lights_physical_fragment:hmt,lights_physical_pars_fragment:pmt,lights_fragment_begin:gmt,lights_fragment_maps:mmt,lights_fragment_end:ymt,logdepthbuf_fragment:Amt,logdepthbuf_pars_fragment:wmt,logdepthbuf_pars_vertex:vmt,logdepthbuf_vertex:xmt,map_fragment:bmt,map_pars_fragment:Smt,map_particle_fragment:Tmt,map_particle_pars_fragment:Pmt,metalnessmap_fragment:Cmt,metalnessmap_pars_fragment:Rmt,morphcolor_vertex:Hmt,morphnormal_vertex:Mmt,morphtarget_pars_vertex:Imt,morphtarget_vertex:zmt,normal_fragment_begin:Dmt,normal_fragment_maps:Emt,normal_pars_fragment:Fmt,normal_pars_vertex:kmt,normal_vertex:Lmt,normalmap_pars_fragment:Wmt,clearcoat_normal_fragment_begin:Nmt,clearcoat_normal_fragment_maps:Umt,clearcoat_pars_fragment:jmt,iridescence_pars_fragment:Bmt,opaque_fragment:Ymt,packing:Omt,premultiplied_alpha_fragment:Vmt,project_vertex:_mt,dithering_fragment:Gmt,dithering_pars_fragment:Xmt,roughnessmap_fragment:Jmt,roughnessmap_pars_fragment:Kmt,shadowmap_pars_fragment:qmt,shadowmap_pars_vertex:$mt,shadowmap_vertex:Qmt,shadowmask_pars_fragment:Zmt,skinbase_vertex:eyt,skinning_pars_vertex:tyt,skinning_vertex:nyt,skinnormal_vertex:oyt,specularmap_fragment:ryt,specularmap_pars_fragment:iyt,tonemapping_fragment:ayt,tonemapping_pars_fragment:lyt,transmission_fragment:syt,transmission_pars_fragment:cyt,uv_pars_fragment:uyt,uv_pars_vertex:dyt,uv_vertex:fyt,worldpos_vertex:hyt,background_vert:pyt,background_frag:gyt,backgroundCube_vert:myt,backgroundCube_frag:yyt,cube_vert:Ayt,cube_frag:wyt,depth_vert:vyt,depth_frag:xyt,distanceRGBA_vert:byt,distanceRGBA_frag:Syt,equirect_vert:Tyt,equirect_frag:Pyt,linedashed_vert:Cyt,linedashed_frag:Ryt,meshbasic_vert:Hyt,meshbasic_frag:Myt,meshlambert_vert:Iyt,meshlambert_frag:zyt,meshmatcap_vert:Dyt,meshmatcap_frag:Eyt,meshnormal_vert:Fyt,meshnormal_frag:kyt,meshphong_vert:Lyt,meshphong_frag:Wyt,meshphysical_vert:Nyt,meshphysical_frag:Uyt,meshtoon_vert:jyt,meshtoon_frag:Byt,points_vert:Yyt,points_frag:Oyt,shadow_vert:Vyt,shadow_frag:_yt,sprite_vert:Gyt,sprite_frag:Xyt},mr={common:{diffuse:{value:new rr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ha},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ha}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ha}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ha}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ha},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ha},normalScale:{value:new Kt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ha},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ha}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ha}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ha}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new rr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0},uvTransform:{value:new ha}},sprite:{diffuse:{value:new rr(16777215)},opacity:{value:1},center:{value:new Kt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ha},alphaMap:{value:null},alphaMapTransform:{value:new ha},alphaTest:{value:0}}},m2={basic:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.fog]),vertexShader:da.meshbasic_vert,fragmentShader:da.meshbasic_frag},lambert:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,mr.lights,{emissive:{value:new rr(0)}}]),vertexShader:da.meshlambert_vert,fragmentShader:da.meshlambert_frag},phong:{uniforms:_h([mr.common,mr.specularmap,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,mr.lights,{emissive:{value:new rr(0)},specular:{value:new rr(1118481)},shininess:{value:30}}]),vertexShader:da.meshphong_vert,fragmentShader:da.meshphong_frag},standard:{uniforms:_h([mr.common,mr.envmap,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.roughnessmap,mr.metalnessmap,mr.fog,mr.lights,{emissive:{value:new rr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:da.meshphysical_vert,fragmentShader:da.meshphysical_frag},toon:{uniforms:_h([mr.common,mr.aomap,mr.lightmap,mr.emissivemap,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.gradientmap,mr.fog,mr.lights,{emissive:{value:new rr(0)}}]),vertexShader:da.meshtoon_vert,fragmentShader:da.meshtoon_frag},matcap:{uniforms:_h([mr.common,mr.bumpmap,mr.normalmap,mr.displacementmap,mr.fog,{matcap:{value:null}}]),vertexShader:da.meshmatcap_vert,fragmentShader:da.meshmatcap_frag},points:{uniforms:_h([mr.points,mr.fog]),vertexShader:da.points_vert,fragmentShader:da.points_frag},dashed:{uniforms:_h([mr.common,mr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:da.linedashed_vert,fragmentShader:da.linedashed_frag},depth:{uniforms:_h([mr.common,mr.displacementmap]),vertexShader:da.depth_vert,fragmentShader:da.depth_frag},normal:{uniforms:_h([mr.common,mr.bumpmap,mr.normalmap,mr.displacementmap,{opacity:{value:1}}]),vertexShader:da.meshnormal_vert,fragmentShader:da.meshnormal_frag},sprite:{uniforms:_h([mr.sprite,mr.fog]),vertexShader:da.sprite_vert,fragmentShader:da.sprite_frag},background:{uniforms:{uvTransform:{value:new ha},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:da.background_vert,fragmentShader:da.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:da.backgroundCube_vert,fragmentShader:da.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:da.cube_vert,fragmentShader:da.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:da.equirect_vert,fragmentShader:da.equirect_frag},distanceRGBA:{uniforms:_h([mr.common,mr.displacementmap,{referencePosition:{value:new le},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:da.distanceRGBA_vert,fragmentShader:da.distanceRGBA_frag},shadow:{uniforms:_h([mr.lights,mr.fog,{color:{value:new rr(0)},opacity:{value:1}}]),vertexShader:da.shadow_vert,fragmentShader:da.shadow_frag}};m2.physical={uniforms:_h([m2.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ha},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ha},clearcoatNormalScale:{value:new Kt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ha},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ha},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ha},sheen:{value:0},sheenColor:{value:new rr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ha},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ha},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ha},transmissionSamplerSize:{value:new Kt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ha},attenuationDistance:{value:0},attenuationColor:{value:new rr(0)},specularColor:{value:new rr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ha},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ha},anisotropyVector:{value:new Kt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ha}}]),vertexShader:da.meshphysical_vert,fragmentShader:da.meshphysical_frag};const LB={r:0,b:0,g:0};function Jyt(t,e,n,o,r,i,a){const l=new rr(0);let s=i===!0?0:1,c,u,d=null,f=0,p=null;function g(y,S){let C=!1,P=S.isScene===!0?S.background:null;P&&P.isTexture&&(P=(S.backgroundBlurriness>0?n:e).get(P)),P===null?A(l,s):P&&P.isColor&&(A(P,1),C=!0);const v=t.xr.getEnvironmentBlendMode();v==="additive"?o.buffers.color.setClear(0,0,0,1,a):v==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,a),(t.autoClear||C)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),P&&(P.isCubeTexture||P.mapping===CH)?(u===void 0&&(u=new ls(new n3(1,1,1),new O2({name:"BackgroundCubeMaterial",uniforms:aR(m2.backgroundCube.uniforms),vertexShader:m2.backgroundCube.vertexShader,fragmentShader:m2.backgroundCube.fragmentShader,side:r0,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(T,w,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=P,u.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,u.material.toneMapped=us.getTransfer(P.colorSpace)!==Ys,(d!==P||f!==P.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new ls(new zw(2,2),new O2({name:"BackgroundMaterial",uniforms:aR(m2.background.uniforms),vertexShader:m2.background.vertexShader,fragmentShader:m2.background.fragmentShader,side:Da,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=P,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.toneMapped=us.getTransfer(P.colorSpace)!==Ys,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(d!==P||f!==P.version||p!==t.toneMapping)&&(c.material.needsUpdate=!0,d=P,f=P.version,p=t.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function A(y,S){y.getRGB(LB,DNe(t)),o.buffers.color.setClear(LB.r,LB.g,LB.b,S,a)}return{getClearColor:function(){return l},setClearColor:function(y,S=1){l.set(y),s=S,A(l,s)},getClearAlpha:function(){return s},setClearAlpha:function(y){s=y,A(l,s)},render:g}}function Kyt(t,e,n,o){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),i=o.isWebGL2?null:e.get("OES_vertex_array_object"),a=o.isWebGL2||i!==null,l={},s=y(null);let c=s,u=!1;function d(U,W,k,D,L){let j=!1;if(a){const B=A(D,k,W);c!==B&&(c=B,p(c.object)),j=S(U,D,k,L),j&&C(U,D,k,L)}else{const B=W.wireframe===!0;(c.geometry!==D.id||c.program!==k.id||c.wireframe!==B)&&(c.geometry=D.id,c.program=k.id,c.wireframe=B,j=!0)}L!==null&&n.update(L,t.ELEMENT_ARRAY_BUFFER),(j||u)&&(u=!1,b(U,W,k,D),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(L).buffer))}function f(){return o.isWebGL2?t.createVertexArray():i.createVertexArrayOES()}function p(U){return o.isWebGL2?t.bindVertexArray(U):i.bindVertexArrayOES(U)}function g(U){return o.isWebGL2?t.deleteVertexArray(U):i.deleteVertexArrayOES(U)}function A(U,W,k){const D=k.wireframe===!0;let L=l[U.id];L===void 0&&(L={},l[U.id]=L);let j=L[W.id];j===void 0&&(j={},L[W.id]=j);let B=j[D];return B===void 0&&(B=y(f()),j[D]=B),B}function y(U){const W=[],k=[],D=[];for(let L=0;L=0){const q=L[V];let $=j[V];if($===void 0&&(V==="instanceMatrix"&&U.instanceMatrix&&($=U.instanceMatrix),V==="instanceColor"&&U.instanceColor&&($=U.instanceColor)),q===void 0||q.attribute!==$||$&&q.data!==$.data)return!0;B++}return c.attributesNum!==B||c.index!==D}function C(U,W,k,D){const L={},j=W.attributes;let B=0;const O=k.getAttributes();for(const V in O)if(O[V].location>=0){let q=j[V];q===void 0&&(V==="instanceMatrix"&&U.instanceMatrix&&(q=U.instanceMatrix),V==="instanceColor"&&U.instanceColor&&(q=U.instanceColor));const $={};$.attribute=q,q&&q.data&&($.data=q.data),L[V]=$,B++}c.attributes=L,c.attributesNum=B,c.index=D}function P(){const U=c.newAttributes;for(let W=0,k=U.length;W=0){let G=L[O];if(G===void 0&&(O==="instanceMatrix"&&U.instanceMatrix&&(G=U.instanceMatrix),O==="instanceColor"&&U.instanceColor&&(G=U.instanceColor)),G!==void 0){const q=G.normalized,$=G.itemSize,ie=n.get(G);if(ie===void 0)continue;const Q=ie.buffer,se=ie.type,oe=ie.bytesPerElement,Z=o.isWebGL2===!0&&(se===t.INT||se===t.UNSIGNED_INT||G.gpuType===R1e);if(G.isInterleavedBufferAttribute){const te=G.data,ee=te.stride,de=G.offset;if(te.isInstancedInterleavedBuffer){for(let fe=0;fe0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const s=i(l);s!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",s,"instead."),l=s);const c=a||e.has("WEBGL_draw_buffers"),u=n.logarithmicDepthBuffer===!0,d=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),f=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_TEXTURE_SIZE),g=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),A=t.getParameter(t.MAX_VERTEX_ATTRIBS),y=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),S=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),P=f>0,v=a||e.has("OES_texture_float"),T=P&&v,w=a?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:i,precision:l,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:g,maxAttributes:A,maxVertexUniforms:y,maxVaryings:S,maxFragmentUniforms:C,vertexTextures:P,floatFragmentTextures:v,floatVertexTextures:T,maxSamples:w}}function Qyt(t){const e=this;let n=null,o=0,r=!1,i=!1;const a=new l9,l=new ha,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||o!==0||r;return r=f,o=d.length,p},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,p){const g=d.clippingPlanes,A=d.clipIntersection,y=d.clipShadows,S=t.get(d);if(!r||g===null||g.length===0||i&&!y)i?u(null):c();else{const C=i?0:o,P=C*4;let v=S.clippingState||null;s.value=v,v=u(g,f,P,p);for(let T=0;T!==P;++T)v[T]=n[T];S.clippingState=v,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=C}};function c(){s.value!==n&&(s.value=n,s.needsUpdate=o>0),e.numPlanes=o,e.numIntersection=0}function u(d,f,p,g){const A=d!==null?d.length:0;let y=null;if(A!==0){if(y=s.value,g!==!0||y===null){const S=p+A*4,C=f.matrixWorldInverse;l.getNormalMatrix(C),(y===null||y.length0){const c=new FNe(s.height/2);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",r),n(c.texture,a.mapping)}else return null}}return a}function r(a){const l=a.target;l.removeEventListener("dispose",r);const s=e.get(l);s!==void 0&&(e.delete(l),s.dispose())}function i(){e=new WeakMap}return{get:o,dispose:i}}let lW=class extends iW{constructor(e=-1,n=1,o=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=o,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,o,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=o,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=o-e,a=o+e,l=r+n,s=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,l-=u*this.view.offsetY,s=l-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,l,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};const qP=4,E4e=[.125,.215,.35,.446,.526,.582],bv=20,Goe=new lW,F4e=new rr;let Xoe=null,Joe=0,Koe=0;const hv=(1+Math.sqrt(5))/2,vT=1/hv,k4e=[new le(1,1,1),new le(-1,1,1),new le(1,1,-1),new le(-1,1,-1),new le(0,hv,vT),new le(0,hv,-vT),new le(vT,0,hv),new le(-vT,0,hv),new le(hv,vT,0),new le(-hv,vT,0)];class Sce{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,o=.1,r=100){Xoe=this._renderer.getRenderTarget(),Joe=this._renderer.getActiveCubeFace(),Koe=this._renderer.getActiveMipmapLevel(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,o,r,i),n>0&&this._blur(i,0,0,n),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=N4e(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=W4e(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?P:0,P,P),u.setRenderTarget(r),A&&u.render(g,l),u.render(e,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=d,e.background=y}_textureToCubeUV(e,n){const o=this._renderer,r=e.mapping===$6||e.mapping===tw;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=N4e()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=W4e());const i=r?this._cubemapMaterial:this._equirectMaterial,a=new ls(this._lodPlanes[0],i),l=i.uniforms;l.envMap.value=e;const s=this._cubeSize;WB(n,0,0,3*s,2*s),o.setRenderTarget(n),o.render(a,Goe)}_applyPMREM(e){const n=this._renderer,o=n.autoClear;n.autoClear=!1;for(let r=1;rbv&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${bv}`);const S=[];let C=0;for(let x=0;xP-qP?r-P+qP:0),w=4*(this._cubeSize-v);WB(n,T,w,3*v,2*v),s.setRenderTarget(n),s.render(d,Goe)}}function e2t(t){const e=[],n=[],o=[];let r=t;const i=t-qP+1+E4e.length;for(let a=0;at-qP?s=E4e[a-t+qP-1]:a===0&&(s=0),o.push(s);const c=1/(l-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,g=6,A=3,y=2,S=1,C=new Float32Array(A*g*p),P=new Float32Array(y*g*p),v=new Float32Array(S*g*p);for(let w=0;w2?0:-1,R=[x,b,0,x+2/3,b,0,x+2/3,b+1,0,x,b,0,x+2/3,b+1,0,x,b+1,0];C.set(R,A*g*w),P.set(f,y*g*w);const H=[w,w,w,w,w,w];v.set(H,S*g*w)}const T=new ji;T.setAttribute("position",new tl(C,A)),T.setAttribute("uv",new tl(P,y)),T.setAttribute("faceIndex",new tl(v,S)),e.push(T),r>qP&&r--}return{lodPlanes:e,sizeLods:n,sigmas:o}}function L4e(t,e,n){const o=new $m(t,e,n);return o.texture.mapping=CH,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function WB(t,e,n,o,r){t.viewport.set(e,n,o,r),t.scissor.set(e,n,o,r)}function t2t(t,e,n){const o=new Float32Array(bv),r=new le(0,1,0);return new O2({name:"SphericalGaussianBlur",defines:{n:bv,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:B1e(),fragmentShader:` precision mediump float; precision mediump int; @@ -3632,7 +3632,7 @@ precision `+t.precision+" int;";return t.precision==="highp"?e+=` Program Info Log: `+E+` `+D+` -`+L)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(N===""||U==="")&&(k=!1);k&&(F.diagnostics={runnable:W,programLog:E,vertexShader:{log:N,prefix:y},fragmentShader:{log:U,prefix:S}})}r.deleteShader(T),r.deleteShader(w),b=new FV(r,A),R=c5t(r,A)}let b;this.getUniforms=function(){return b===void 0&&x(this),b};let R;this.getAttributes=function(){return R===void 0&&x(this),R};let H=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return H===!1&&(H=r.getProgramParameter(A,t5t)),H},this.destroy=function(){o.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=n5t++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=T,this.fragmentShader=w,this}let x5t=0;class b5t{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,o=e.fragmentShader,r=this._getShaderStage(n),i=this._getShaderStage(o),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const o of n)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let o=n.get(e);return o===void 0&&(o=new Set,n.set(e,o)),o}_getShaderStage(e){const n=this.shaderCache;let o=n.get(e);return o===void 0&&(o=new S5t(e),n.set(e,o)),o}}class S5t{constructor(e){this.id=x5t++,this.code=e,this.usedTimes=0}}function T5t(t,e,n,o,r,i,a){const l=new fx,s=new b5t,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(R){return R===0?"uv":`uv${R}`}function y(R,H,F,E,N){const U=E.fog,W=N.geometry,k=R.isMeshStandardMaterial?E.environment:null,D=(R.isMeshStandardMaterial?n:e).get(R.envMap||k),L=D&&D.mapping===CH?D.image.height:null,j=g[R.type];R.precision!==null&&(p=r.getMaxPrecision(R.precision),p!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",p,"instead."));const B=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,O=B!==void 0?B.length:0;let V=0;W.morphAttributes.position!==void 0&&(V=1),W.morphAttributes.normal!==void 0&&(V=2),W.morphAttributes.color!==void 0&&(V=3);let G,q,$,ie;if(j){const lt=m2[j];G=lt.vertexShader,q=lt.fragmentShader}else G=R.vertexShader,q=R.fragmentShader,s.update(R),$=s.getVertexShaderID(R),ie=s.getFragmentShaderID(R);const Q=t.getRenderTarget(),se=N.isInstancedMesh===!0,Z=!!R.map,ee=!!R.matcap,te=!!D,oe=!!R.aoMap,de=!!R.lightMap,he=!!R.bumpMap,pe=!!R.normalMap,me=!!R.displacementMap,le=!!R.emissiveMap,Te=!!R.metalnessMap,ge=!!R.roughnessMap,Se=R.anisotropy>0,Re=R.clearcoat>0,De=R.iridescence>0,Ae=R.sheen>0,ue=R.transmission>0,fe=Se&&!!R.anisotropyMap,ve=Re&&!!R.clearcoatMap,we=Re&&!!R.clearcoatNormalMap,Pe=Re&&!!R.clearcoatRoughnessMap,Ie=De&&!!R.iridescenceMap,Me=De&&!!R.iridescenceThicknessMap,ze=Ae&&!!R.sheenColorMap,Ne=Ae&&!!R.sheenRoughnessMap,Je=!!R.specularMap,Ue=!!R.specularColorMap,nt=!!R.specularIntensityMap,We=ue&&!!R.transmissionMap,Ee=ue&&!!R.thicknessMap,ke=!!R.gradientMap,Oe=!!R.alphaMap,st=R.alphaTest>0,je=!!R.alphaHash,xt=!!R.extensions,gt=!!W.attributes.uv1,Ye=!!W.attributes.uv2,it=!!W.attributes.uv3;let ut=T9;return R.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(ut=t.toneMapping),{isWebGL2:u,shaderID:j,shaderType:R.type,shaderName:R.name,vertexShader:G,fragmentShader:q,defines:R.defines,customVertexShaderID:$,customFragmentShaderID:ie,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:p,instancing:se,instancingColor:se&&N.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:Q===null?t.outputColorSpace:Q.isXRRenderTarget===!0?Q.texture.colorSpace:W9,map:Z,matcap:ee,envMap:te,envMapMode:te&&D.mapping,envMapCubeUVHeight:L,aoMap:oe,lightMap:de,bumpMap:he,normalMap:pe,displacementMap:f&&me,emissiveMap:le,normalMapObjectSpace:pe&&R.normalMapType===yNe,normalMapTangentSpace:pe&&R.normalMapType===Iw,metalnessMap:Te,roughnessMap:ge,anisotropy:Se,anisotropyMap:fe,clearcoat:Re,clearcoatMap:ve,clearcoatNormalMap:we,clearcoatRoughnessMap:Pe,iridescence:De,iridescenceMap:Ie,iridescenceThicknessMap:Me,sheen:Ae,sheenColorMap:ze,sheenRoughnessMap:Ne,specularMap:Je,specularColorMap:Ue,specularIntensityMap:nt,transmission:ue,transmissionMap:We,thicknessMap:Ee,gradientMap:ke,opaque:R.transparent===!1&&R.blending===ux,alphaMap:Oe,alphaTest:st,alphaHash:je,combine:R.combine,mapUv:Z&&A(R.map.channel),aoMapUv:oe&&A(R.aoMap.channel),lightMapUv:de&&A(R.lightMap.channel),bumpMapUv:he&&A(R.bumpMap.channel),normalMapUv:pe&&A(R.normalMap.channel),displacementMapUv:me&&A(R.displacementMap.channel),emissiveMapUv:le&&A(R.emissiveMap.channel),metalnessMapUv:Te&&A(R.metalnessMap.channel),roughnessMapUv:ge&&A(R.roughnessMap.channel),anisotropyMapUv:fe&&A(R.anisotropyMap.channel),clearcoatMapUv:ve&&A(R.clearcoatMap.channel),clearcoatNormalMapUv:we&&A(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Pe&&A(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ie&&A(R.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&A(R.iridescenceThicknessMap.channel),sheenColorMapUv:ze&&A(R.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&A(R.sheenRoughnessMap.channel),specularMapUv:Je&&A(R.specularMap.channel),specularColorMapUv:Ue&&A(R.specularColorMap.channel),specularIntensityMapUv:nt&&A(R.specularIntensityMap.channel),transmissionMapUv:We&&A(R.transmissionMap.channel),thicknessMapUv:Ee&&A(R.thicknessMap.channel),alphaMapUv:Oe&&A(R.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(pe||Se),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:gt,vertexUv2s:Ye,vertexUv3s:it,pointsUvs:N.isPoints===!0&&!!W.attributes.uv&&(Z||Oe),fog:!!U,useFog:R.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:N.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:O,morphTextureStride:V,numDirLights:H.directional.length,numPointLights:H.point.length,numSpotLights:H.spot.length,numSpotLightMaps:H.spotLightMap.length,numRectAreaLights:H.rectArea.length,numHemiLights:H.hemi.length,numDirLightShadows:H.directionalShadowMap.length,numPointLightShadows:H.pointShadowMap.length,numSpotLightShadows:H.spotShadowMap.length,numSpotLightShadowsWithMaps:H.numSpotLightShadowsWithMaps,numLightProbes:H.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:ut,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Z&&R.map.isVideoTexture===!0&&us.getTransfer(R.map.colorSpace)===Ys,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===ti,flipSided:R.side===r0,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:xt&&R.extensions.derivatives===!0,extensionFragDepth:xt&&R.extensions.fragDepth===!0,extensionDrawBuffers:xt&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:xt&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()}}function S(R){const H=[];if(R.shaderID?H.push(R.shaderID):(H.push(R.customVertexShaderID),H.push(R.customFragmentShaderID)),R.defines!==void 0)for(const F in R.defines)H.push(F),H.push(R.defines[F]);return R.isRawShaderMaterial===!1&&(C(H,R),P(H,R),H.push(t.outputColorSpace)),H.push(R.customProgramCacheKey),H.join()}function C(R,H){R.push(H.precision),R.push(H.outputColorSpace),R.push(H.envMapMode),R.push(H.envMapCubeUVHeight),R.push(H.mapUv),R.push(H.alphaMapUv),R.push(H.lightMapUv),R.push(H.aoMapUv),R.push(H.bumpMapUv),R.push(H.normalMapUv),R.push(H.displacementMapUv),R.push(H.emissiveMapUv),R.push(H.metalnessMapUv),R.push(H.roughnessMapUv),R.push(H.anisotropyMapUv),R.push(H.clearcoatMapUv),R.push(H.clearcoatNormalMapUv),R.push(H.clearcoatRoughnessMapUv),R.push(H.iridescenceMapUv),R.push(H.iridescenceThicknessMapUv),R.push(H.sheenColorMapUv),R.push(H.sheenRoughnessMapUv),R.push(H.specularMapUv),R.push(H.specularColorMapUv),R.push(H.specularIntensityMapUv),R.push(H.transmissionMapUv),R.push(H.thicknessMapUv),R.push(H.combine),R.push(H.fogExp2),R.push(H.sizeAttenuation),R.push(H.morphTargetsCount),R.push(H.morphAttributeCount),R.push(H.numDirLights),R.push(H.numPointLights),R.push(H.numSpotLights),R.push(H.numSpotLightMaps),R.push(H.numHemiLights),R.push(H.numRectAreaLights),R.push(H.numDirLightShadows),R.push(H.numPointLightShadows),R.push(H.numSpotLightShadows),R.push(H.numSpotLightShadowsWithMaps),R.push(H.numLightProbes),R.push(H.shadowMapType),R.push(H.toneMapping),R.push(H.numClippingPlanes),R.push(H.numClipIntersection),R.push(H.depthPacking)}function P(R,H){l.disableAll(),H.isWebGL2&&l.enable(0),H.supportsVertexTextures&&l.enable(1),H.instancing&&l.enable(2),H.instancingColor&&l.enable(3),H.matcap&&l.enable(4),H.envMap&&l.enable(5),H.normalMapObjectSpace&&l.enable(6),H.normalMapTangentSpace&&l.enable(7),H.clearcoat&&l.enable(8),H.iridescence&&l.enable(9),H.alphaTest&&l.enable(10),H.vertexColors&&l.enable(11),H.vertexAlphas&&l.enable(12),H.vertexUv1s&&l.enable(13),H.vertexUv2s&&l.enable(14),H.vertexUv3s&&l.enable(15),H.vertexTangents&&l.enable(16),H.anisotropy&&l.enable(17),H.alphaHash&&l.enable(18),R.push(l.mask),l.disableAll(),H.fog&&l.enable(0),H.useFog&&l.enable(1),H.flatShading&&l.enable(2),H.logarithmicDepthBuffer&&l.enable(3),H.skinning&&l.enable(4),H.morphTargets&&l.enable(5),H.morphNormals&&l.enable(6),H.morphColors&&l.enable(7),H.premultipliedAlpha&&l.enable(8),H.shadowMapEnabled&&l.enable(9),H.useLegacyLights&&l.enable(10),H.doubleSided&&l.enable(11),H.flipSided&&l.enable(12),H.useDepthPacking&&l.enable(13),H.dithering&&l.enable(14),H.transmission&&l.enable(15),H.sheen&&l.enable(16),H.opaque&&l.enable(17),H.pointsUvs&&l.enable(18),H.decodeVideoTexture&&l.enable(19),R.push(l.mask)}function v(R){const H=g[R.type];let F;if(H){const E=m2[H];F=jF.clone(E.uniforms)}else F=R.uniforms;return F}function T(R,H){let F;for(let E=0,N=c.length;E0?o.push(S):p.transparent===!0?r.push(S):n.push(S)}function s(d,f,p,g,A,y){const S=a(d,f,p,g,A,y);p.transmission>0?o.unshift(S):p.transparent===!0?r.unshift(S):n.unshift(S)}function c(d,f){n.length>1&&n.sort(d||C5t),o.length>1&&o.sort(f||$4e),r.length>1&&r.sort(f||$4e)}function u(){for(let d=e,f=t.length;d=i.length?(a=new Q4e,i.push(a)):a=i[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function H5t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new ae,color:new rr};break;case"SpotLight":n={position:new ae,direction:new ae,color:new rr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ae,color:new rr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ae,skyColor:new rr,groundColor:new rr};break;case"RectAreaLight":n={color:new rr,position:new ae,halfWidth:new ae,halfHeight:new ae};break}return t[e.id]=n,n}}}function M5t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let I5t=0;function z5t(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function D5t(t,e){const n=new H5t,o=M5t(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new ae);const i=new ae,a=new Ki,l=new Ki;function s(u,d){let f=0,p=0,g=0;for(let E=0;E<9;E++)r.probe[E].set(0,0,0);let A=0,y=0,S=0,C=0,P=0,v=0,T=0,w=0,x=0,b=0,R=0;u.sort(z5t);const H=d===!0?Math.PI:1;for(let E=0,N=u.length;E0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=mr.LTC_FLOAT_1,r.rectAreaLTC2=mr.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=mr.LTC_HALF_1,r.rectAreaLTC2=mr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=g;const F=r.hash;(F.directionalLength!==A||F.pointLength!==y||F.spotLength!==S||F.rectAreaLength!==C||F.hemiLength!==P||F.numDirectionalShadows!==v||F.numPointShadows!==T||F.numSpotShadows!==w||F.numSpotMaps!==x||F.numLightProbes!==R)&&(r.directional.length=A,r.spot.length=S,r.rectArea.length=C,r.point.length=y,r.hemi.length=P,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=w,r.spotShadowMap.length=w,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=w+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=R,F.directionalLength=A,F.pointLength=y,F.spotLength=S,F.rectAreaLength=C,F.hemiLength=P,F.numDirectionalShadows=v,F.numPointShadows=T,F.numSpotShadows=w,F.numSpotMaps=x,F.numLightProbes=R,r.version=I5t++)}function c(u,d){let f=0,p=0,g=0,A=0,y=0;const S=d.matrixWorldInverse;for(let C=0,P=u.length;C=l.length?(s=new Z4e(t,e),l.push(s)):s=l[a],s}function r(){n=new WeakMap}return{get:o,dispose:r}}class pq extends Tf{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mNe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class gq extends Tf{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const F5t=`void main() { +`+L)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(N===""||U==="")&&(k=!1);k&&(F.diagnostics={runnable:W,programLog:E,vertexShader:{log:N,prefix:y},fragmentShader:{log:U,prefix:S}})}r.deleteShader(T),r.deleteShader(w),b=new FV(r,A),R=c5t(r,A)}let b;this.getUniforms=function(){return b===void 0&&x(this),b};let R;this.getAttributes=function(){return R===void 0&&x(this),R};let H=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return H===!1&&(H=r.getProgramParameter(A,t5t)),H},this.destroy=function(){o.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=n5t++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=T,this.fragmentShader=w,this}let x5t=0;class b5t{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,o=e.fragmentShader,r=this._getShaderStage(n),i=this._getShaderStage(o),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const o of n)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let o=n.get(e);return o===void 0&&(o=new Set,n.set(e,o)),o}_getShaderStage(e){const n=this.shaderCache;let o=n.get(e);return o===void 0&&(o=new S5t(e),n.set(e,o)),o}}class S5t{constructor(e){this.id=x5t++,this.code=e,this.usedTimes=0}}function T5t(t,e,n,o,r,i,a){const l=new fx,s=new b5t,c=[],u=r.isWebGL2,d=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(R){return R===0?"uv":`uv${R}`}function y(R,H,F,E,N){const U=E.fog,W=N.geometry,k=R.isMeshStandardMaterial?E.environment:null,D=(R.isMeshStandardMaterial?n:e).get(R.envMap||k),L=D&&D.mapping===CH?D.image.height:null,j=g[R.type];R.precision!==null&&(p=r.getMaxPrecision(R.precision),p!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",p,"instead."));const B=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,O=B!==void 0?B.length:0;let V=0;W.morphAttributes.position!==void 0&&(V=1),W.morphAttributes.normal!==void 0&&(V=2),W.morphAttributes.color!==void 0&&(V=3);let G,q,$,ie;if(j){const lt=m2[j];G=lt.vertexShader,q=lt.fragmentShader}else G=R.vertexShader,q=R.fragmentShader,s.update(R),$=s.getVertexShaderID(R),ie=s.getFragmentShaderID(R);const Q=t.getRenderTarget(),se=N.isInstancedMesh===!0,oe=!!R.map,Z=!!R.matcap,te=!!D,ee=!!R.aoMap,de=!!R.lightMap,fe=!!R.bumpMap,pe=!!R.normalMap,ye=!!R.displacementMap,ae=!!R.emissiveMap,Te=!!R.metalnessMap,ge=!!R.roughnessMap,Se=R.anisotropy>0,Re=R.clearcoat>0,De=R.iridescence>0,Ae=R.sheen>0,ue=R.transmission>0,he=Se&&!!R.anisotropyMap,ve=Re&&!!R.clearcoatMap,we=Re&&!!R.clearcoatNormalMap,Pe=Re&&!!R.clearcoatRoughnessMap,Ie=De&&!!R.iridescenceMap,Me=De&&!!R.iridescenceThicknessMap,ze=Ae&&!!R.sheenColorMap,Ne=Ae&&!!R.sheenRoughnessMap,Je=!!R.specularMap,Ue=!!R.specularColorMap,nt=!!R.specularIntensityMap,We=ue&&!!R.transmissionMap,Ee=ue&&!!R.thicknessMap,ke=!!R.gradientMap,Oe=!!R.alphaMap,st=R.alphaTest>0,je=!!R.alphaHash,xt=!!R.extensions,gt=!!W.attributes.uv1,Ye=!!W.attributes.uv2,it=!!W.attributes.uv3;let ut=T9;return R.toneMapped&&(Q===null||Q.isXRRenderTarget===!0)&&(ut=t.toneMapping),{isWebGL2:u,shaderID:j,shaderType:R.type,shaderName:R.name,vertexShader:G,fragmentShader:q,defines:R.defines,customVertexShaderID:$,customFragmentShaderID:ie,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:p,instancing:se,instancingColor:se&&N.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:Q===null?t.outputColorSpace:Q.isXRRenderTarget===!0?Q.texture.colorSpace:W9,map:oe,matcap:Z,envMap:te,envMapMode:te&&D.mapping,envMapCubeUVHeight:L,aoMap:ee,lightMap:de,bumpMap:fe,normalMap:pe,displacementMap:f&&ye,emissiveMap:ae,normalMapObjectSpace:pe&&R.normalMapType===yNe,normalMapTangentSpace:pe&&R.normalMapType===Iw,metalnessMap:Te,roughnessMap:ge,anisotropy:Se,anisotropyMap:he,clearcoat:Re,clearcoatMap:ve,clearcoatNormalMap:we,clearcoatRoughnessMap:Pe,iridescence:De,iridescenceMap:Ie,iridescenceThicknessMap:Me,sheen:Ae,sheenColorMap:ze,sheenRoughnessMap:Ne,specularMap:Je,specularColorMap:Ue,specularIntensityMap:nt,transmission:ue,transmissionMap:We,thicknessMap:Ee,gradientMap:ke,opaque:R.transparent===!1&&R.blending===ux,alphaMap:Oe,alphaTest:st,alphaHash:je,combine:R.combine,mapUv:oe&&A(R.map.channel),aoMapUv:ee&&A(R.aoMap.channel),lightMapUv:de&&A(R.lightMap.channel),bumpMapUv:fe&&A(R.bumpMap.channel),normalMapUv:pe&&A(R.normalMap.channel),displacementMapUv:ye&&A(R.displacementMap.channel),emissiveMapUv:ae&&A(R.emissiveMap.channel),metalnessMapUv:Te&&A(R.metalnessMap.channel),roughnessMapUv:ge&&A(R.roughnessMap.channel),anisotropyMapUv:he&&A(R.anisotropyMap.channel),clearcoatMapUv:ve&&A(R.clearcoatMap.channel),clearcoatNormalMapUv:we&&A(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Pe&&A(R.clearcoatRoughnessMap.channel),iridescenceMapUv:Ie&&A(R.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&A(R.iridescenceThicknessMap.channel),sheenColorMapUv:ze&&A(R.sheenColorMap.channel),sheenRoughnessMapUv:Ne&&A(R.sheenRoughnessMap.channel),specularMapUv:Je&&A(R.specularMap.channel),specularColorMapUv:Ue&&A(R.specularColorMap.channel),specularIntensityMapUv:nt&&A(R.specularIntensityMap.channel),transmissionMapUv:We&&A(R.transmissionMap.channel),thicknessMapUv:Ee&&A(R.thicknessMap.channel),alphaMapUv:Oe&&A(R.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(pe||Se),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:gt,vertexUv2s:Ye,vertexUv3s:it,pointsUvs:N.isPoints===!0&&!!W.attributes.uv&&(oe||Oe),fog:!!U,useFog:R.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:N.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:O,morphTextureStride:V,numDirLights:H.directional.length,numPointLights:H.point.length,numSpotLights:H.spot.length,numSpotLightMaps:H.spotLightMap.length,numRectAreaLights:H.rectArea.length,numHemiLights:H.hemi.length,numDirLightShadows:H.directionalShadowMap.length,numPointLightShadows:H.pointShadowMap.length,numSpotLightShadows:H.spotShadowMap.length,numSpotLightShadowsWithMaps:H.numSpotLightShadowsWithMaps,numLightProbes:H.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:ut,useLegacyLights:t._useLegacyLights,decodeVideoTexture:oe&&R.map.isVideoTexture===!0&&us.getTransfer(R.map.colorSpace)===Ys,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===ti,flipSided:R.side===r0,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:xt&&R.extensions.derivatives===!0,extensionFragDepth:xt&&R.extensions.fragDepth===!0,extensionDrawBuffers:xt&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:xt&&R.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()}}function S(R){const H=[];if(R.shaderID?H.push(R.shaderID):(H.push(R.customVertexShaderID),H.push(R.customFragmentShaderID)),R.defines!==void 0)for(const F in R.defines)H.push(F),H.push(R.defines[F]);return R.isRawShaderMaterial===!1&&(C(H,R),P(H,R),H.push(t.outputColorSpace)),H.push(R.customProgramCacheKey),H.join()}function C(R,H){R.push(H.precision),R.push(H.outputColorSpace),R.push(H.envMapMode),R.push(H.envMapCubeUVHeight),R.push(H.mapUv),R.push(H.alphaMapUv),R.push(H.lightMapUv),R.push(H.aoMapUv),R.push(H.bumpMapUv),R.push(H.normalMapUv),R.push(H.displacementMapUv),R.push(H.emissiveMapUv),R.push(H.metalnessMapUv),R.push(H.roughnessMapUv),R.push(H.anisotropyMapUv),R.push(H.clearcoatMapUv),R.push(H.clearcoatNormalMapUv),R.push(H.clearcoatRoughnessMapUv),R.push(H.iridescenceMapUv),R.push(H.iridescenceThicknessMapUv),R.push(H.sheenColorMapUv),R.push(H.sheenRoughnessMapUv),R.push(H.specularMapUv),R.push(H.specularColorMapUv),R.push(H.specularIntensityMapUv),R.push(H.transmissionMapUv),R.push(H.thicknessMapUv),R.push(H.combine),R.push(H.fogExp2),R.push(H.sizeAttenuation),R.push(H.morphTargetsCount),R.push(H.morphAttributeCount),R.push(H.numDirLights),R.push(H.numPointLights),R.push(H.numSpotLights),R.push(H.numSpotLightMaps),R.push(H.numHemiLights),R.push(H.numRectAreaLights),R.push(H.numDirLightShadows),R.push(H.numPointLightShadows),R.push(H.numSpotLightShadows),R.push(H.numSpotLightShadowsWithMaps),R.push(H.numLightProbes),R.push(H.shadowMapType),R.push(H.toneMapping),R.push(H.numClippingPlanes),R.push(H.numClipIntersection),R.push(H.depthPacking)}function P(R,H){l.disableAll(),H.isWebGL2&&l.enable(0),H.supportsVertexTextures&&l.enable(1),H.instancing&&l.enable(2),H.instancingColor&&l.enable(3),H.matcap&&l.enable(4),H.envMap&&l.enable(5),H.normalMapObjectSpace&&l.enable(6),H.normalMapTangentSpace&&l.enable(7),H.clearcoat&&l.enable(8),H.iridescence&&l.enable(9),H.alphaTest&&l.enable(10),H.vertexColors&&l.enable(11),H.vertexAlphas&&l.enable(12),H.vertexUv1s&&l.enable(13),H.vertexUv2s&&l.enable(14),H.vertexUv3s&&l.enable(15),H.vertexTangents&&l.enable(16),H.anisotropy&&l.enable(17),H.alphaHash&&l.enable(18),R.push(l.mask),l.disableAll(),H.fog&&l.enable(0),H.useFog&&l.enable(1),H.flatShading&&l.enable(2),H.logarithmicDepthBuffer&&l.enable(3),H.skinning&&l.enable(4),H.morphTargets&&l.enable(5),H.morphNormals&&l.enable(6),H.morphColors&&l.enable(7),H.premultipliedAlpha&&l.enable(8),H.shadowMapEnabled&&l.enable(9),H.useLegacyLights&&l.enable(10),H.doubleSided&&l.enable(11),H.flipSided&&l.enable(12),H.useDepthPacking&&l.enable(13),H.dithering&&l.enable(14),H.transmission&&l.enable(15),H.sheen&&l.enable(16),H.opaque&&l.enable(17),H.pointsUvs&&l.enable(18),H.decodeVideoTexture&&l.enable(19),R.push(l.mask)}function v(R){const H=g[R.type];let F;if(H){const E=m2[H];F=jF.clone(E.uniforms)}else F=R.uniforms;return F}function T(R,H){let F;for(let E=0,N=c.length;E0?o.push(S):p.transparent===!0?r.push(S):n.push(S)}function s(d,f,p,g,A,y){const S=a(d,f,p,g,A,y);p.transmission>0?o.unshift(S):p.transparent===!0?r.unshift(S):n.unshift(S)}function c(d,f){n.length>1&&n.sort(d||C5t),o.length>1&&o.sort(f||$4e),r.length>1&&r.sort(f||$4e)}function u(){for(let d=e,f=t.length;d=i.length?(a=new Q4e,i.push(a)):a=i[r],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function H5t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new le,color:new rr};break;case"SpotLight":n={position:new le,direction:new le,color:new rr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new le,color:new rr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new le,skyColor:new rr,groundColor:new rr};break;case"RectAreaLight":n={color:new rr,position:new le,halfWidth:new le,halfHeight:new le};break}return t[e.id]=n,n}}}function M5t(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Kt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let I5t=0;function z5t(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function D5t(t,e){const n=new H5t,o=M5t(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new le);const i=new le,a=new Ki,l=new Ki;function s(u,d){let f=0,p=0,g=0;for(let E=0;E<9;E++)r.probe[E].set(0,0,0);let A=0,y=0,S=0,C=0,P=0,v=0,T=0,w=0,x=0,b=0,R=0;u.sort(z5t);const H=d===!0?Math.PI:1;for(let E=0,N=u.length;E0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=mr.LTC_FLOAT_1,r.rectAreaLTC2=mr.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=mr.LTC_HALF_1,r.rectAreaLTC2=mr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=g;const F=r.hash;(F.directionalLength!==A||F.pointLength!==y||F.spotLength!==S||F.rectAreaLength!==C||F.hemiLength!==P||F.numDirectionalShadows!==v||F.numPointShadows!==T||F.numSpotShadows!==w||F.numSpotMaps!==x||F.numLightProbes!==R)&&(r.directional.length=A,r.spot.length=S,r.rectArea.length=C,r.point.length=y,r.hemi.length=P,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=w,r.spotShadowMap.length=w,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=w+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=R,F.directionalLength=A,F.pointLength=y,F.spotLength=S,F.rectAreaLength=C,F.hemiLength=P,F.numDirectionalShadows=v,F.numPointShadows=T,F.numSpotShadows=w,F.numSpotMaps=x,F.numLightProbes=R,r.version=I5t++)}function c(u,d){let f=0,p=0,g=0,A=0,y=0;const S=d.matrixWorldInverse;for(let C=0,P=u.length;C=l.length?(s=new Z4e(t,e),l.push(s)):s=l[a],s}function r(){n=new WeakMap}return{get:o,dispose:r}}class pq extends Tf{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mNe,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class gq extends Tf{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const F5t=`void main() { gl_Position = vec4( position, 1.0 ); }`,k5t=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3660,7 +3660,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function L5t(t,e,n){let o=new fq;const r=new Kt,i=new Kt,a=new qa,l=new pq({depthPacking:k1e}),s=new gq,c={},u=n.maxTextureSize,d={[Da]:r0,[r0]:Da,[ti]:ti},f=new O2({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Kt},radius:{value:4}},vertexShader:F5t,fragmentShader:k5t}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const g=new ji;g.setAttribute("position",new tl(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new ls(g,f),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=aq;let S=this.type;this.render=function(T,w,x){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||T.length===0)return;const b=t.getRenderTarget(),R=t.getActiveCubeFace(),H=t.getActiveMipmapLevel(),F=t.state;F.setBlending(k6),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const E=S!==l2&&this.type===l2,N=S===l2&&this.type!==l2;for(let U=0,W=T.length;Uu||r.y>u)&&(r.x>u&&(i.x=Math.floor(u/L.x),r.x=i.x*L.x,D.mapSize.x=i.x),r.y>u&&(i.y=Math.floor(u/L.y),r.y=i.y*L.y,D.mapSize.y=i.y)),D.map===null||E===!0||N===!0){const B=this.type!==l2?{minFilter:F0,magFilter:F0}:{};D.map!==null&&D.map.dispose(),D.map=new $m(r.x,r.y,B),D.map.texture.name=k.name+".shadowMap",D.camera.updateProjectionMatrix()}t.setRenderTarget(D.map),t.clear();const j=D.getViewportCount();for(let B=0;B0||w.map&&w.alphaTest>0){const F=R.uuid,E=w.uuid;let N=c[F];N===void 0&&(N={},c[F]=N);let U=N[E];U===void 0&&(U=R.clone(),N[E]=U),R=U}if(R.visible=w.visible,R.wireframe=w.wireframe,b===l2?R.side=w.shadowSide!==null?w.shadowSide:w.side:R.side=w.shadowSide!==null?w.shadowSide:d[w.side],R.alphaMap=w.alphaMap,R.alphaTest=w.alphaTest,R.map=w.map,R.clipShadows=w.clipShadows,R.clippingPlanes=w.clippingPlanes,R.clipIntersection=w.clipIntersection,R.displacementMap=w.displacementMap,R.displacementScale=w.displacementScale,R.displacementBias=w.displacementBias,R.wireframeLinewidth=w.wireframeLinewidth,R.linewidth=w.linewidth,x.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const F=t.properties.get(R);F.light=x}return R}function v(T,w,x,b,R){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&R===l2)&&(!T.frustumCulled||o.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,T.matrixWorld);const E=e.update(T),N=T.material;if(Array.isArray(N)){const U=E.groups;for(let W=0,k=U.length;W=1):B.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),L=j>=2);let O=null,V={};const G=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),$=new qa().fromArray(G),ie=new qa().fromArray(q);function Q(je,xt,gt,Ye){const it=new Uint8Array(4),ut=t.createTexture();t.bindTexture(je,ut),t.texParameteri(je,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(je,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;Qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let A;const y=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function C(Ae,ue){return S?new OffscreenCanvas(Ae,ue):UF("canvas")}function P(Ae,ue,fe,ve){let we=1;if((Ae.width>ve||Ae.height>ve)&&(we=ve/Math.max(Ae.width,Ae.height)),we<1||ue===!0)if(typeof HTMLImageElement<"u"&&Ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Ae instanceof ImageBitmap){const Pe=ue?iG:Math.floor,Ie=Pe(we*Ae.width),Me=Pe(we*Ae.height);A===void 0&&(A=C(Ie,Me));const ze=fe?C(Ie,Me):A;return ze.width=Ie,ze.height=Me,ze.getContext("2d").drawImage(Ae,0,0,Ie,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+Ie+"x"+Me+")."),ze}else return"data"in Ae&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),Ae;return Ae}function v(Ae){return bce(Ae.width)&&bce(Ae.height)}function T(Ae){return l?!1:Ae.wrapS!==uh||Ae.wrapT!==uh||Ae.minFilter!==F0&&Ae.minFilter!==Gs}function w(Ae,ue){return Ae.generateMipmaps&&ue&&Ae.minFilter!==F0&&Ae.minFilter!==Gs}function x(Ae){t.generateMipmap(Ae)}function b(Ae,ue,fe,ve,we=!1){if(l===!1)return ue;if(Ae!==null){if(t[Ae]!==void 0)return t[Ae];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Ae+"'")}let Pe=ue;if(ue===t.RED&&(fe===t.FLOAT&&(Pe=t.R32F),fe===t.HALF_FLOAT&&(Pe=t.R16F),fe===t.UNSIGNED_BYTE&&(Pe=t.R8)),ue===t.RED_INTEGER&&(fe===t.UNSIGNED_BYTE&&(Pe=t.R8UI),fe===t.UNSIGNED_SHORT&&(Pe=t.R16UI),fe===t.UNSIGNED_INT&&(Pe=t.R32UI),fe===t.BYTE&&(Pe=t.R8I),fe===t.SHORT&&(Pe=t.R16I),fe===t.INT&&(Pe=t.R32I)),ue===t.RG&&(fe===t.FLOAT&&(Pe=t.RG32F),fe===t.HALF_FLOAT&&(Pe=t.RG16F),fe===t.UNSIGNED_BYTE&&(Pe=t.RG8)),ue===t.RGBA){const Ie=we?FF:us.getTransfer(ve);fe===t.FLOAT&&(Pe=t.RGBA32F),fe===t.HALF_FLOAT&&(Pe=t.RGBA16F),fe===t.UNSIGNED_BYTE&&(Pe=Ie===Ys?t.SRGB8_ALPHA8:t.RGBA8),fe===t.UNSIGNED_SHORT_4_4_4_4&&(Pe=t.RGBA4),fe===t.UNSIGNED_SHORT_5_5_5_1&&(Pe=t.RGB5_A1)}return(Pe===t.R16F||Pe===t.R32F||Pe===t.RG16F||Pe===t.RG32F||Pe===t.RGBA16F||Pe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Pe}function R(Ae,ue,fe){return w(Ae,fe)===!0||Ae.isFramebufferTexture&&Ae.minFilter!==F0&&Ae.minFilter!==Gs?Math.log2(Math.max(ue.width,ue.height))+1:Ae.mipmaps!==void 0&&Ae.mipmaps.length>0?Ae.mipmaps.length:Ae.isCompressedTexture&&Array.isArray(Ae.image)?ue.mipmaps.length:1}function H(Ae){return Ae===F0||Ae===oG||Ae===gE?t.NEAREST:t.LINEAR}function F(Ae){const ue=Ae.target;ue.removeEventListener("dispose",F),N(ue),ue.isVideoTexture&&g.delete(ue)}function E(Ae){const ue=Ae.target;ue.removeEventListener("dispose",E),W(ue)}function N(Ae){const ue=o.get(Ae);if(ue.__webglInit===void 0)return;const fe=Ae.source,ve=y.get(fe);if(ve){const we=ve[ue.__cacheKey];we.usedTimes--,we.usedTimes===0&&U(Ae),Object.keys(ve).length===0&&y.delete(fe)}o.remove(Ae)}function U(Ae){const ue=o.get(Ae);t.deleteTexture(ue.__webglTexture);const fe=Ae.source,ve=y.get(fe);delete ve[ue.__cacheKey],a.memory.textures--}function W(Ae){const ue=Ae.texture,fe=o.get(Ae),ve=o.get(ue);if(ve.__webglTexture!==void 0&&(t.deleteTexture(ve.__webglTexture),a.memory.textures--),Ae.depthTexture&&Ae.depthTexture.dispose(),Ae.isWebGLCubeRenderTarget)for(let we=0;we<6;we++){if(Array.isArray(fe.__webglFramebuffer[we]))for(let Pe=0;Pe=s&&console.warn("THREE.WebGLTextures: Trying to use "+Ae+" texture units while this GPU supports only "+s),k+=1,Ae}function j(Ae){const ue=[];return ue.push(Ae.wrapS),ue.push(Ae.wrapT),ue.push(Ae.wrapR||0),ue.push(Ae.magFilter),ue.push(Ae.minFilter),ue.push(Ae.anisotropy),ue.push(Ae.internalFormat),ue.push(Ae.format),ue.push(Ae.type),ue.push(Ae.generateMipmaps),ue.push(Ae.premultiplyAlpha),ue.push(Ae.flipY),ue.push(Ae.unpackAlignment),ue.push(Ae.colorSpace),ue.join()}function B(Ae,ue){const fe=o.get(Ae);if(Ae.isVideoTexture&&Re(Ae),Ae.isRenderTargetTexture===!1&&Ae.version>0&&fe.__version!==Ae.version){const ve=Ae.image;if(ve===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Z(fe,Ae,ue);return}}n.bindTexture(t.TEXTURE_2D,fe.__webglTexture,t.TEXTURE0+ue)}function O(Ae,ue){const fe=o.get(Ae);if(Ae.version>0&&fe.__version!==Ae.version){Z(fe,Ae,ue);return}n.bindTexture(t.TEXTURE_2D_ARRAY,fe.__webglTexture,t.TEXTURE0+ue)}function V(Ae,ue){const fe=o.get(Ae);if(Ae.version>0&&fe.__version!==Ae.version){Z(fe,Ae,ue);return}n.bindTexture(t.TEXTURE_3D,fe.__webglTexture,t.TEXTURE0+ue)}function G(Ae,ue){const fe=o.get(Ae);if(Ae.version>0&&fe.__version!==Ae.version){ee(fe,Ae,ue);return}n.bindTexture(t.TEXTURE_CUBE_MAP,fe.__webglTexture,t.TEXTURE0+ue)}const q={[bs]:t.REPEAT,[uh]:t.CLAMP_TO_EDGE,[IF]:t.MIRRORED_REPEAT},$={[F0]:t.NEAREST,[oG]:t.NEAREST_MIPMAP_NEAREST,[gE]:t.NEAREST_MIPMAP_LINEAR,[Gs]:t.LINEAR,[C1e]:t.LINEAR_MIPMAP_NEAREST,[nw]:t.LINEAR_MIPMAP_LINEAR},ie={[ANe]:t.NEVER,[PNe]:t.ALWAYS,[wNe]:t.LESS,[xNe]:t.LEQUAL,[vNe]:t.EQUAL,[TNe]:t.GEQUAL,[bNe]:t.GREATER,[SNe]:t.NOTEQUAL};function Q(Ae,ue,fe){if(fe?(t.texParameteri(Ae,t.TEXTURE_WRAP_S,q[ue.wrapS]),t.texParameteri(Ae,t.TEXTURE_WRAP_T,q[ue.wrapT]),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,q[ue.wrapR]),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,$[ue.magFilter]),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,$[ue.minFilter])):(t.texParameteri(Ae,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(Ae,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(ue.wrapS!==uh||ue.wrapT!==uh)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,H(ue.magFilter)),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,H(ue.minFilter)),ue.minFilter!==F0&&ue.minFilter!==Gs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),ue.compareFunction&&(t.texParameteri(Ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Ae,t.TEXTURE_COMPARE_FUNC,ie[ue.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ve=e.get("EXT_texture_filter_anisotropic");if(ue.magFilter===F0||ue.minFilter!==gE&&ue.minFilter!==nw||ue.type===v2&&e.has("OES_texture_float_linear")===!1||l===!1&&ue.type===_x&&e.has("OES_texture_half_float_linear")===!1)return;(ue.anisotropy>1||o.get(ue).__currentAnisotropy)&&(t.texParameterf(Ae,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ue.anisotropy,r.getMaxAnisotropy())),o.get(ue).__currentAnisotropy=ue.anisotropy)}}function se(Ae,ue){let fe=!1;Ae.__webglInit===void 0&&(Ae.__webglInit=!0,ue.addEventListener("dispose",F));const ve=ue.source;let we=y.get(ve);we===void 0&&(we={},y.set(ve,we));const Pe=j(ue);if(Pe!==Ae.__cacheKey){we[Pe]===void 0&&(we[Pe]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,fe=!0),we[Pe].usedTimes++;const Ie=we[Ae.__cacheKey];Ie!==void 0&&(we[Ae.__cacheKey].usedTimes--,Ie.usedTimes===0&&U(ue)),Ae.__cacheKey=Pe,Ae.__webglTexture=we[Pe].texture}return fe}function Z(Ae,ue,fe){let ve=t.TEXTURE_2D;(ue.isDataArrayTexture||ue.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),ue.isData3DTexture&&(ve=t.TEXTURE_3D);const we=se(Ae,ue),Pe=ue.source;n.bindTexture(ve,Ae.__webglTexture,t.TEXTURE0+fe);const Ie=o.get(Pe);if(Pe.version!==Ie.__version||we===!0){n.activeTexture(t.TEXTURE0+fe);const Me=us.getPrimaries(us.workingColorSpace),ze=ue.colorSpace===cg?null:us.getPrimaries(ue.colorSpace),Ne=ue.colorSpace===cg||Me===ze?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,ue.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ue.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,ue.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne);const Je=T(ue)&&v(ue.image)===!1;let Ue=P(ue.image,Je,!1,u);Ue=De(ue,Ue);const nt=v(Ue)||l,We=i.convert(ue.format,ue.colorSpace);let Ee=i.convert(ue.type),ke=b(ue.internalFormat,We,Ee,ue.colorSpace,ue.isVideoTexture);Q(ve,ue,nt);let Oe;const st=ue.mipmaps,je=l&&ue.isVideoTexture!==!0,xt=Ie.__version===void 0||we===!0,gt=R(ue,Ue,nt);if(ue.isDepthTexture)ke=t.DEPTH_COMPONENT,l?ue.type===v2?ke=t.DEPTH_COMPONENT32F:ue.type===T6?ke=t.DEPTH_COMPONENT24:ue.type===B8?ke=t.DEPTH24_STENCIL8:ke=t.DEPTH_COMPONENT16:ue.type===v2&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),ue.format===Y8&&ke===t.DEPTH_COMPONENT&&ue.type!==sq&&ue.type!==T6&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),ue.type=T6,Ee=i.convert(ue.type)),ue.format===Gx&&ke===t.DEPTH_COMPONENT&&(ke=t.DEPTH_STENCIL,ue.type!==B8&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),ue.type=B8,Ee=i.convert(ue.type))),xt&&(je?n.texStorage2D(t.TEXTURE_2D,1,ke,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,ke,Ue.width,Ue.height,0,We,Ee,null));else if(ue.isDataTexture)if(st.length>0&&nt){je&&xt&&n.texStorage2D(t.TEXTURE_2D,gt,ke,st[0].width,st[0].height);for(let Ye=0,it=st.length;Ye>=1,it>>=1}}else if(st.length>0&&nt){je&&xt&&n.texStorage2D(t.TEXTURE_2D,gt,ke,st[0].width,st[0].height);for(let Ye=0,it=st.length;Ye0&&xt++,n.texStorage2D(t.TEXTURE_CUBE_MAP,xt,Oe,Ue[0].width,Ue[0].height));for(let Ye=0;Ye<6;Ye++)if(Je){st?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0,0,0,Ue[Ye].width,Ue[Ye].height,Ee,ke,Ue[Ye].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0,Oe,Ue[Ye].width,Ue[Ye].height,0,Ee,ke,Ue[Ye].data);for(let it=0;it>Pe),Ue=Math.max(1,ue.height>>Pe);we===t.TEXTURE_3D||we===t.TEXTURE_2D_ARRAY?n.texImage3D(we,Pe,ze,Je,Ue,ue.depth,0,Ie,Me,null):n.texImage2D(we,Pe,ze,Je,Ue,0,Ie,Me,null)}n.bindFramebuffer(t.FRAMEBUFFER,Ae),Se(ue)?f.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,we,o.get(fe).__webglTexture,0,ge(ue)):(we===t.TEXTURE_2D||we>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,we,o.get(fe).__webglTexture,Pe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function oe(Ae,ue,fe){if(t.bindRenderbuffer(t.RENDERBUFFER,Ae),ue.depthBuffer&&!ue.stencilBuffer){let ve=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(fe||Se(ue)){const we=ue.depthTexture;we&&we.isDepthTexture&&(we.type===v2?ve=t.DEPTH_COMPONENT32F:we.type===T6&&(ve=t.DEPTH_COMPONENT24));const Pe=ge(ue);Se(ue)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Pe,ve,ue.width,ue.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,Pe,ve,ue.width,ue.height)}else t.renderbufferStorage(t.RENDERBUFFER,ve,ue.width,ue.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,Ae)}else if(ue.depthBuffer&&ue.stencilBuffer){const ve=ge(ue);fe&&Se(ue)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,ue.width,ue.height):Se(ue)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,ue.width,ue.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,ue.width,ue.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,Ae)}else{const ve=ue.isWebGLMultipleRenderTargets===!0?ue.texture:[ue.texture];for(let we=0;we0){fe.__webglFramebuffer[Me]=[];for(let ze=0;ze0){fe.__webglFramebuffer=[];for(let Me=0;Me0&&Se(Ae)===!1){const Me=Pe?ue:[ue];fe.__webglMultisampledFramebuffer=t.createFramebuffer(),fe.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,fe.__webglMultisampledFramebuffer);for(let ze=0;ze0)for(let ze=0;ze0)for(let ze=0;ze0&&Se(Ae)===!1){const ue=Ae.isWebGLMultipleRenderTargets?Ae.texture:[Ae.texture],fe=Ae.width,ve=Ae.height;let we=t.COLOR_BUFFER_BIT;const Pe=[],Ie=Ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Me=o.get(Ae),ze=Ae.isWebGLMultipleRenderTargets===!0;if(ze)for(let Ne=0;Ne0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&ue.__useRenderToTexture!==!1}function Re(Ae){const ue=a.render.frame;g.get(Ae)!==ue&&(g.set(Ae,ue),Ae.update())}function De(Ae,ue){const fe=Ae.colorSpace,ve=Ae.format,we=Ae.type;return Ae.isCompressedTexture===!0||Ae.isVideoTexture===!0||Ae.format===rG||fe!==W9&&fe!==cg&&(us.getTransfer(fe)===Ys?l===!1?e.has("EXT_sRGB")===!0&&ve===Up?(Ae.format=rG,Ae.minFilter=Gs,Ae.generateMipmaps=!1):ue=W1e.sRGBToLinear(ue):(ve!==Up||we!==P9)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",fe)),ue}this.allocateTextureUnit=L,this.resetTextureUnits=D,this.setTexture2D=B,this.setTexture2DArray=O,this.setTexture3D=V,this.setTextureCube=G,this.rebindTextures=pe,this.setupRenderTarget=me,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=Te,this.setupDepthRenderbuffer=he,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Se}function jNe(t,e,n){const o=n.isWebGL2;function r(i,a=cg){let l;const s=us.getTransfer(a);if(i===P9)return t.UNSIGNED_BYTE;if(i===H1e)return t.UNSIGNED_SHORT_4_4_4_4;if(i===M1e)return t.UNSIGNED_SHORT_5_5_5_1;if(i===rNe)return t.BYTE;if(i===iNe)return t.SHORT;if(i===sq)return t.UNSIGNED_SHORT;if(i===R1e)return t.INT;if(i===T6)return t.UNSIGNED_INT;if(i===v2)return t.FLOAT;if(i===_x)return o?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(i===aNe)return t.ALPHA;if(i===Up)return t.RGBA;if(i===lNe)return t.LUMINANCE;if(i===sNe)return t.LUMINANCE_ALPHA;if(i===Y8)return t.DEPTH_COMPONENT;if(i===Gx)return t.DEPTH_STENCIL;if(i===rG)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(i===cNe)return t.RED;if(i===I1e)return t.RED_INTEGER;if(i===uNe)return t.RG;if(i===z1e)return t.RG_INTEGER;if(i===D1e)return t.RGBA_INTEGER;if(i===HV||i===MV||i===IV||i===zV)if(s===Ys)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(i===HV)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===MV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===IV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===zV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(i===HV)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===MV)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===IV)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===zV)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Kse||i===qse||i===$se||i===Qse)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(i===Kse)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===qse)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===$se)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Qse)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===dNe)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===Zse||i===ece)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(i===Zse)return s===Ys?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(i===ece)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===tce||i===nce||i===oce||i===rce||i===ice||i===ace||i===lce||i===sce||i===cce||i===uce||i===dce||i===fce||i===hce||i===pce)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(i===tce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===nce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===oce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===rce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ice)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ace)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===lce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===sce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===cce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===uce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===dce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===fce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===hce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===pce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===DV||i===gce||i===mce)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(i===DV)return s===Ys?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===gce)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===mce)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===fNe||i===yce||i===Ace||i===wce)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(i===DV)return l.COMPRESSED_RED_RGTC1_EXT;if(i===yce)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ace)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===wce)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===B8?o?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[i]!==void 0?t[i]:null}return{convert:r}}class BNe extends zu{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let $P=class extends Ul{constructor(){super(),this.isGroup=!0,this.type="Group"}};const U5t={type:"move"};class $oe{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $P,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new $P,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ae),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $P,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ae),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const o of e.hand.values())this._getHandJoint(n,o)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,o){let r=null,i=null,a=null;const l=this._targetRay,s=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const A of e.hand.values()){const y=n.getJointPose(A,o),S=this._getHandJoint(c,A);y!==null&&(S.matrix.fromArray(y.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=y.radius),S.visible=y!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),p=.02,g=.005;c.inputState.pinching&&f>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=n.getPose(e.gripSpace,o),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,o),r===null&&i!==null&&(r=i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(U5t)))}return l!==null&&(l.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const o=new $P;o.matrixAutoUpdate=!1,o.visible=!1,e.joints[n.jointName]=o,e.add(o)}return e.joints[n.jointName]}}class Y1e extends Vc{constructor(e,n,o,r,i,a,l,s,c,u){if(u=u!==void 0?u:Y8,u!==Y8&&u!==Gx)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&u===Y8&&(o=T6),o===void 0&&u===Gx&&(o=B8),super(null,r,i,a,l,s,u,o,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:F0,this.minFilter=s!==void 0?s:F0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class j5t extends e3{constructor(e,n){super();const o=this;let r=null,i=1,a=null,l="local-floor",s=1,c=null,u=null,d=null,f=null,p=null,g=null;const A=n.getContextAttributes();let y=null,S=null;const C=[],P=[],v=new zu;v.layers.enable(1),v.viewport=new qa;const T=new zu;T.layers.enable(2),T.viewport=new qa;const w=[v,T],x=new BNe;x.layers.enable(1),x.layers.enable(2);let b=null,R=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getTargetRaySpace()},this.getControllerGrip=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getGripSpace()},this.getHand=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getHandSpace()};function H(O){const V=P.indexOf(O.inputSource);if(V===-1)return;const G=C[V];G!==void 0&&(G.update(O.inputSource,O.frame,c||a),G.dispatchEvent({type:O.type,data:O.inputSource}))}function F(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",E);for(let O=0;O=0&&(P[q]=null,C[q].disconnect(G))}for(let V=0;V=P.length){P.push(G),q=ie;break}else if(P[ie]===null){P[ie]=G,q=ie;break}if(q===-1)break}const $=C[q];$&&$.connect(G)}}const N=new ae,U=new ae;function W(O,V,G){N.setFromMatrixPosition(V.matrixWorld),U.setFromMatrixPosition(G.matrixWorld);const q=N.distanceTo(U),$=V.projectionMatrix.elements,ie=G.projectionMatrix.elements,Q=$[14]/($[10]-1),se=$[14]/($[10]+1),Z=($[9]+1)/$[5],ee=($[9]-1)/$[5],te=($[8]-1)/$[0],oe=(ie[8]+1)/ie[0],de=Q*te,he=Q*oe,pe=q/(-te+oe),me=pe*-te;V.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(me),O.translateZ(pe),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const le=Q+pe,Te=se+pe,ge=de-me,Se=he+(q-me),Re=Z*se/Te*le,De=ee*se/Te*le;O.projectionMatrix.makePerspective(ge,Se,Re,De,le,Te),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function k(O,V){V===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(V.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;x.near=T.near=v.near=O.near,x.far=T.far=v.far=O.far,(b!==x.near||R!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,R=x.far);const V=O.parent,G=x.cameras;k(x,V);for(let q=0;q0&&(y.alphaTest.value=S.alphaTest);const C=e.get(S).envMap;if(C&&(y.envMap.value=C,y.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=S.reflectivity,y.ior.value=S.ior,y.refractionRatio.value=S.refractionRatio),S.lightMap){y.lightMap.value=S.lightMap;const P=t._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=S.lightMapIntensity*P,n(S.lightMap,y.lightMapTransform)}S.aoMap&&(y.aoMap.value=S.aoMap,y.aoMapIntensity.value=S.aoMapIntensity,n(S.aoMap,y.aoMapTransform))}function a(y,S){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,S.map&&(y.map.value=S.map,n(S.map,y.mapTransform))}function l(y,S){y.dashSize.value=S.dashSize,y.totalSize.value=S.dashSize+S.gapSize,y.scale.value=S.scale}function s(y,S,C,P){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,y.size.value=S.size*C,y.scale.value=P*.5,S.map&&(y.map.value=S.map,n(S.map,y.uvTransform)),S.alphaMap&&(y.alphaMap.value=S.alphaMap,n(S.alphaMap,y.alphaMapTransform)),S.alphaTest>0&&(y.alphaTest.value=S.alphaTest)}function c(y,S){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,y.rotation.value=S.rotation,S.map&&(y.map.value=S.map,n(S.map,y.mapTransform)),S.alphaMap&&(y.alphaMap.value=S.alphaMap,n(S.alphaMap,y.alphaMapTransform)),S.alphaTest>0&&(y.alphaTest.value=S.alphaTest)}function u(y,S){y.specular.value.copy(S.specular),y.shininess.value=Math.max(S.shininess,1e-4)}function d(y,S){S.gradientMap&&(y.gradientMap.value=S.gradientMap)}function f(y,S){y.metalness.value=S.metalness,S.metalnessMap&&(y.metalnessMap.value=S.metalnessMap,n(S.metalnessMap,y.metalnessMapTransform)),y.roughness.value=S.roughness,S.roughnessMap&&(y.roughnessMap.value=S.roughnessMap,n(S.roughnessMap,y.roughnessMapTransform)),e.get(S).envMap&&(y.envMapIntensity.value=S.envMapIntensity)}function p(y,S,C){y.ior.value=S.ior,S.sheen>0&&(y.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),y.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(y.sheenColorMap.value=S.sheenColorMap,n(S.sheenColorMap,y.sheenColorMapTransform)),S.sheenRoughnessMap&&(y.sheenRoughnessMap.value=S.sheenRoughnessMap,n(S.sheenRoughnessMap,y.sheenRoughnessMapTransform))),S.clearcoat>0&&(y.clearcoat.value=S.clearcoat,y.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(y.clearcoatMap.value=S.clearcoatMap,n(S.clearcoatMap,y.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,n(S.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(y.clearcoatNormalMap.value=S.clearcoatNormalMap,n(S.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===r0&&y.clearcoatNormalScale.value.negate())),S.iridescence>0&&(y.iridescence.value=S.iridescence,y.iridescenceIOR.value=S.iridescenceIOR,y.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(y.iridescenceMap.value=S.iridescenceMap,n(S.iridescenceMap,y.iridescenceMapTransform)),S.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=S.iridescenceThicknessMap,n(S.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),S.transmission>0&&(y.transmission.value=S.transmission,y.transmissionSamplerMap.value=C.texture,y.transmissionSamplerSize.value.set(C.width,C.height),S.transmissionMap&&(y.transmissionMap.value=S.transmissionMap,n(S.transmissionMap,y.transmissionMapTransform)),y.thickness.value=S.thickness,S.thicknessMap&&(y.thicknessMap.value=S.thicknessMap,n(S.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=S.attenuationDistance,y.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(y.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(y.anisotropyMap.value=S.anisotropyMap,n(S.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=S.specularIntensity,y.specularColor.value.copy(S.specularColor),S.specularColorMap&&(y.specularColorMap.value=S.specularColorMap,n(S.specularColorMap,y.specularColorMapTransform)),S.specularIntensityMap&&(y.specularIntensityMap.value=S.specularIntensityMap,n(S.specularIntensityMap,y.specularIntensityMapTransform))}function g(y,S){S.matcap&&(y.matcap.value=S.matcap)}function A(y,S){const C=e.get(S).light;y.referencePosition.value.setFromMatrixPosition(C.matrixWorld),y.nearDistance.value=C.shadow.camera.near,y.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:r}}function Y5t(t,e,n,o){let r={},i={},a=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function s(C,P){const v=P.program;o.uniformBlockBinding(C,v)}function c(C,P){let v=r[C.id];v===void 0&&(g(C),v=u(C),r[C.id]=v,C.addEventListener("dispose",y));const T=P.program;o.updateUBOMapping(C,T);const w=e.render.frame;i[C.id]!==w&&(f(C),i[C.id]=w)}function u(C){const P=d();C.__bindingPointIndex=P;const v=t.createBuffer(),T=C.__size,w=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,T,w),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,P,v),v}function d(){for(let C=0;C0){w=v%T;const E=T-w;w!==0&&E-H.boundary<0&&(v+=T-w,R.__offset=v)}v+=H.storage}return w=v%T,w>0&&(v+=T-w),C.__size=v,C.__cache={},this}function A(C){const P={boundary:0,storage:0};return typeof C=="number"?(P.boundary=4,P.storage=4):C.isVector2?(P.boundary=8,P.storage=8):C.isVector3||C.isColor?(P.boundary=16,P.storage=12):C.isVector4?(P.boundary=16,P.storage=16):C.isMatrix3?(P.boundary=48,P.storage=48):C.isMatrix4?(P.boundary=64,P.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),P}function y(C){const P=C.target;P.removeEventListener("dispose",y);const v=a.indexOf(P.__bindingPointIndex);a.splice(v,1),t.deleteBuffer(r[P.id]),delete r[P.id],delete i[P.id]}function S(){for(const C in r)t.deleteBuffer(r[C]);a=[],r={},i={}}return{bind:s,update:c,dispose:S}}class O1e{constructor(e={}){const{canvas:n=MNe(),context:o=null,depth:r=!0,stencil:i=!0,alpha:a=!1,antialias:l=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;o!==null?f=o.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),g=new Int32Array(4);let A=null,y=null;const S=[],C=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ou,this._useLegacyLights=!1,this.toneMapping=T9,this.toneMappingExposure=1;const P=this;let v=!1,T=0,w=0,x=null,b=-1,R=null;const H=new qa,F=new qa;let E=null;const N=new rr(0);let U=0,W=n.width,k=n.height,D=1,L=null,j=null;const B=new qa(0,0,W,k),O=new qa(0,0,W,k);let V=!1;const G=new fq;let q=!1,$=!1,ie=null;const Q=new Ki,se=new Kt,Z=new ae,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return x===null?D:1}let oe=o;function de(Ve,ft){for(let kt=0;kt{function Ge(){if(rt.forEach(function(yt){Te.get(yt).currentProgram.isReady()&&rt.delete(yt)}),rt.size===0){at(Ve);return}setTimeout(Ge,10)}he.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let Qe=null;function lt(Ve){Qe&&Qe(Ve)}function Ze(){$e.stop()}function Be(){$e.start()}const $e=new kNe;$e.setAnimationLoop(lt),typeof self<"u"&&$e.setContext(self),this.setAnimationLoop=function(Ve){Qe=Ve,Oe.setAnimationLoop(Ve),Ve===null?$e.stop():$e.start()},Oe.addEventListener("sessionstart",Ze),Oe.addEventListener("sessionend",Be),this.render=function(Ve,ft){if(ft!==void 0&&ft.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;Ve.matrixWorldAutoUpdate===!0&&Ve.updateMatrixWorld(),ft.parent===null&&ft.matrixWorldAutoUpdate===!0&&ft.updateMatrixWorld(),Oe.enabled===!0&&Oe.isPresenting===!0&&(Oe.cameraAutoUpdate===!0&&Oe.updateCamera(ft),ft=Oe.getCamera()),Ve.isScene===!0&&Ve.onBeforeRender(P,Ve,ft,x),y=Pe.get(Ve,C.length),y.init(),C.push(y),Q.multiplyMatrices(ft.projectionMatrix,ft.matrixWorldInverse),G.setFromProjectionMatrix(Q),$=this.localClippingEnabled,q=Ie.init(this.clippingPlanes,$),A=we.get(Ve,S.length),A.init(),S.push(A),wt(Ve,ft,0,P.sortObjects),A.finish(),P.sortObjects===!0&&A.sort(L,j),this.info.render.frame++,q===!0&&Ie.beginShadows();const kt=y.state.shadowsArray;if(Me.render(kt,Ve,ft),q===!0&&Ie.endShadows(),this.info.autoReset===!0&&this.info.reset(),ze.render(A,Ve),y.setupLights(P._useLegacyLights),ft.isArrayCamera){const rt=ft.cameras;for(let at=0,Ge=rt.length;at0?y=C[C.length-1]:y=null,S.pop(),S.length>0?A=S[S.length-1]:A=null};function wt(Ve,ft,kt,rt){if(Ve.visible===!1)return;if(Ve.layers.test(ft.layers)){if(Ve.isGroup)kt=Ve.renderOrder;else if(Ve.isLOD)Ve.autoUpdate===!0&&Ve.update(ft);else if(Ve.isLight)y.pushLight(Ve),Ve.castShadow&&y.pushShadow(Ve);else if(Ve.isSprite){if(!Ve.frustumCulled||G.intersectsSprite(Ve)){rt&&Z.setFromMatrixPosition(Ve.matrixWorld).applyMatrix4(Q);const yt=ue.update(Ve),Pt=Ve.material;Pt.visible&&A.push(Ve,yt,Pt,kt,Z.z,null)}}else if((Ve.isMesh||Ve.isLine||Ve.isPoints)&&(!Ve.frustumCulled||G.intersectsObject(Ve))){const yt=ue.update(Ve),Pt=Ve.material;if(rt&&(Ve.boundingSphere!==void 0?(Ve.boundingSphere===null&&Ve.computeBoundingSphere(),Z.copy(Ve.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Z.copy(yt.boundingSphere.center)),Z.applyMatrix4(Ve.matrixWorld).applyMatrix4(Q)),Array.isArray(Pt)){const ot=yt.groups;for(let bt=0,zt=ot.length;bt0&&Rt(at,Ge,ft,kt),rt&&me.viewport(H.copy(rt)),at.length>0&&Gt(at,ft,kt),Ge.length>0&&Gt(Ge,ft,kt),yt.length>0&&Gt(yt,ft,kt),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Rt(Ve,ft,kt,rt){if((kt.isScene===!0?kt.overrideMaterial:null)!==null)return;const Ge=pe.isWebGL2;ie===null&&(ie=new $m(1,1,{generateMipmaps:!0,type:he.has("EXT_color_buffer_half_float")?_x:P9,minFilter:nw,samples:Ge?4:0})),P.getDrawingBufferSize(se),Ge?ie.setSize(se.x,se.y):ie.setSize(iG(se.x),iG(se.y));const yt=P.getRenderTarget();P.setRenderTarget(ie),P.getClearColor(N),U=P.getClearAlpha(),U<1&&P.setClearColor(16777215,.5),P.clear();const Pt=P.toneMapping;P.toneMapping=T9,Gt(Ve,kt,rt),ge.updateMultisampleRenderTarget(ie),ge.updateRenderTargetMipmap(ie);let ot=!1;for(let bt=0,zt=ft.length;bt0),Bt=!!kt.morphAttributes.position,tt=!!kt.morphAttributes.normal,Ht=!!kt.morphAttributes.color;let _t=T9;rt.toneMapped&&(x===null||x.isXRRenderTarget===!0)&&(_t=P.toneMapping);const qt=kt.morphAttributes.position||kt.morphAttributes.normal||kt.morphAttributes.color,un=qt!==void 0?qt.length:0,Rn=Te.get(rt),yo=y.state.lights;if(q===!0&&($===!0||Ve!==R)){const br=Ve===R&&rt.id===b;Ie.setState(rt,Ve,br)}let Ao=!1;rt.version===Rn.__version?(Rn.needsLights&&Rn.lightsStateVersion!==yo.state.version||Rn.outputColorSpace!==Pt||at.isInstancedMesh&&Rn.instancing===!1||!at.isInstancedMesh&&Rn.instancing===!0||at.isSkinnedMesh&&Rn.skinning===!1||!at.isSkinnedMesh&&Rn.skinning===!0||at.isInstancedMesh&&Rn.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&Rn.instancingColor===!1&&at.instanceColor!==null||Rn.envMap!==ot||rt.fog===!0&&Rn.fog!==Ge||Rn.numClippingPlanes!==void 0&&(Rn.numClippingPlanes!==Ie.numPlanes||Rn.numIntersection!==Ie.numIntersection)||Rn.vertexAlphas!==bt||Rn.vertexTangents!==zt||Rn.morphTargets!==Bt||Rn.morphNormals!==tt||Rn.morphColors!==Ht||Rn.toneMapping!==_t||pe.isWebGL2===!0&&Rn.morphTargetsCount!==un)&&(Ao=!0):(Ao=!0,Rn.__version=rt.version);let wo=Rn.currentProgram;Ao===!0&&(wo=pt(rt,ft,at));let Io=!1,po=!1,On=!1;const fo=wo.getUniforms(),ir=Rn.uniforms;if(me.useProgram(wo.program)&&(Io=!0,po=!0,On=!0),rt.id!==b&&(b=rt.id,po=!0),Io||R!==Ve){fo.setValue(oe,"projectionMatrix",Ve.projectionMatrix),fo.setValue(oe,"viewMatrix",Ve.matrixWorldInverse);const br=fo.map.cameraPosition;br!==void 0&&br.setValue(oe,Z.setFromMatrixPosition(Ve.matrixWorld)),pe.logarithmicDepthBuffer&&fo.setValue(oe,"logDepthBufFC",2/(Math.log(Ve.far+1)/Math.LN2)),(rt.isMeshPhongMaterial||rt.isMeshToonMaterial||rt.isMeshLambertMaterial||rt.isMeshBasicMaterial||rt.isMeshStandardMaterial||rt.isShaderMaterial)&&fo.setValue(oe,"isOrthographic",Ve.isOrthographicCamera===!0),R!==Ve&&(R=Ve,po=!0,On=!0)}if(at.isSkinnedMesh){fo.setOptional(oe,at,"bindMatrix"),fo.setOptional(oe,at,"bindMatrixInverse");const br=at.skeleton;br&&(pe.floatVertexTextures?(br.boneTexture===null&&br.computeBoneTexture(),fo.setValue(oe,"boneTexture",br.boneTexture,ge),fo.setValue(oe,"boneTextureSize",br.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Rr=kt.morphAttributes;if((Rr.position!==void 0||Rr.normal!==void 0||Rr.color!==void 0&&pe.isWebGL2===!0)&&Ne.update(at,kt,wo),(po||Rn.receiveShadow!==at.receiveShadow)&&(Rn.receiveShadow=at.receiveShadow,fo.setValue(oe,"receiveShadow",at.receiveShadow)),rt.isMeshGouraudMaterial&&rt.envMap!==null&&(ir.envMap.value=ot,ir.flipEnvMap.value=ot.isCubeTexture&&ot.isRenderTargetTexture===!1?-1:1),po&&(fo.setValue(oe,"toneMappingExposure",P.toneMappingExposure),Rn.needsLights&&It(ir,On),Ge&&rt.fog===!0&&ve.refreshFogUniforms(ir,Ge),ve.refreshMaterialUniforms(ir,rt,D,k,ie),FV.upload(oe,Wt(Rn),ir,ge)),rt.isShaderMaterial&&rt.uniformsNeedUpdate===!0&&(FV.upload(oe,Wt(Rn),ir,ge),rt.uniformsNeedUpdate=!1),rt.isSpriteMaterial&&fo.setValue(oe,"center",at.center),fo.setValue(oe,"modelViewMatrix",at.modelViewMatrix),fo.setValue(oe,"normalMatrix",at.normalMatrix),fo.setValue(oe,"modelMatrix",at.matrixWorld),rt.isShaderMaterial||rt.isRawShaderMaterial){const br=rt.uniformsGroups;for(let _r=0,jo=br.length;_r0&&ge.useMultisampledRTT(Ve)===!1?at=Te.get(Ve).__webglMultisampledFramebuffer:Array.isArray(zt)?at=zt[kt]:at=zt,H.copy(Ve.viewport),F.copy(Ve.scissor),E=Ve.scissorTest}else H.copy(B).multiplyScalar(D).floor(),F.copy(O).multiplyScalar(D).floor(),E=V;if(me.bindFramebuffer(oe.FRAMEBUFFER,at)&&pe.drawBuffers&&rt&&me.drawBuffers(Ve,at),me.viewport(H),me.scissor(F),me.setScissorTest(E),Ge){const ot=Te.get(Ve.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+ft,ot.__webglTexture,kt)}else if(yt){const ot=Te.get(Ve.texture),bt=ft||0;oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,ot.__webglTexture,kt||0,bt)}b=-1},this.readRenderTargetPixels=function(Ve,ft,kt,rt,at,Ge,yt){if(!(Ve&&Ve.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Pt=Te.get(Ve).__webglFramebuffer;if(Ve.isWebGLCubeRenderTarget&&yt!==void 0&&(Pt=Pt[yt]),Pt){me.bindFramebuffer(oe.FRAMEBUFFER,Pt);try{const ot=Ve.texture,bt=ot.format,zt=ot.type;if(bt!==Up&&nt.convert(bt)!==oe.getParameter(oe.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Bt=zt===_x&&(he.has("EXT_color_buffer_half_float")||pe.isWebGL2&&he.has("EXT_color_buffer_float"));if(zt!==P9&&nt.convert(zt)!==oe.getParameter(oe.IMPLEMENTATION_COLOR_READ_TYPE)&&!(zt===v2&&(pe.isWebGL2||he.has("OES_texture_float")||he.has("WEBGL_color_buffer_float")))&&!Bt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ft>=0&&ft<=Ve.width-rt&&kt>=0&&kt<=Ve.height-at&&oe.readPixels(ft,kt,rt,at,nt.convert(bt),nt.convert(zt),Ge)}finally{const ot=x!==null?Te.get(x).__webglFramebuffer:null;me.bindFramebuffer(oe.FRAMEBUFFER,ot)}}},this.copyFramebufferToTexture=function(Ve,ft,kt=0){const rt=Math.pow(2,-kt),at=Math.floor(ft.image.width*rt),Ge=Math.floor(ft.image.height*rt);ge.setTexture2D(ft,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,kt,0,0,Ve.x,Ve.y,at,Ge),me.unbindTexture()},this.copyTextureToTexture=function(Ve,ft,kt,rt=0){const at=ft.image.width,Ge=ft.image.height,yt=nt.convert(kt.format),Pt=nt.convert(kt.type);ge.setTexture2D(kt,0),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,kt.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,kt.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,kt.unpackAlignment),ft.isDataTexture?oe.texSubImage2D(oe.TEXTURE_2D,rt,Ve.x,Ve.y,at,Ge,yt,Pt,ft.image.data):ft.isCompressedTexture?oe.compressedTexSubImage2D(oe.TEXTURE_2D,rt,Ve.x,Ve.y,ft.mipmaps[0].width,ft.mipmaps[0].height,yt,ft.mipmaps[0].data):oe.texSubImage2D(oe.TEXTURE_2D,rt,Ve.x,Ve.y,yt,Pt,ft.image),rt===0&&kt.generateMipmaps&&oe.generateMipmap(oe.TEXTURE_2D),me.unbindTexture()},this.copyTextureToTexture3D=function(Ve,ft,kt,rt,at=0){if(P.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=Ve.max.x-Ve.min.x+1,yt=Ve.max.y-Ve.min.y+1,Pt=Ve.max.z-Ve.min.z+1,ot=nt.convert(rt.format),bt=nt.convert(rt.type);let zt;if(rt.isData3DTexture)ge.setTexture3D(rt,0),zt=oe.TEXTURE_3D;else if(rt.isDataArrayTexture)ge.setTexture2DArray(rt,0),zt=oe.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,rt.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,rt.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,rt.unpackAlignment);const Bt=oe.getParameter(oe.UNPACK_ROW_LENGTH),tt=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),Ht=oe.getParameter(oe.UNPACK_SKIP_PIXELS),_t=oe.getParameter(oe.UNPACK_SKIP_ROWS),qt=oe.getParameter(oe.UNPACK_SKIP_IMAGES),un=kt.isCompressedTexture?kt.mipmaps[0]:kt.image;oe.pixelStorei(oe.UNPACK_ROW_LENGTH,un.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,un.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,Ve.min.x),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Ve.min.y),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Ve.min.z),kt.isDataTexture||kt.isData3DTexture?oe.texSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,bt,un.data):kt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),oe.compressedTexSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,un.data)):oe.texSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,bt,un),oe.pixelStorei(oe.UNPACK_ROW_LENGTH,Bt),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,tt),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,Ht),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,_t),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,qt),at===0&&rt.generateMipmaps&&oe.generateMipmap(zt),me.unbindTexture()},this.initTexture=function(Ve){Ve.isCubeTexture?ge.setTextureCube(Ve,0):Ve.isData3DTexture?ge.setTexture3D(Ve,0):Ve.isDataArrayTexture||Ve.isCompressedArrayTexture?ge.setTexture2DArray(Ve,0):ge.setTexture2D(Ve,0),me.unbindTexture()},this.resetState=function(){T=0,w=0,x=null,me.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return g9}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===uq?"display-p3":"srgb",n.unpackColorSpace=us.workingColorSpace===rW?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ou?O8:F1e}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===O8?ou:W9}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class YNe extends O1e{}YNe.prototype.isWebGL1Renderer=!0;class mq{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new rr(e),this.density=n}clone(){return new mq(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class yq{constructor(e,n=1,o=1e3){this.isFog=!0,this.name="",this.color=new rr(e),this.near=n,this.far=o}clone(){return new yq(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class aG extends Ul{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class Aq{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=WF,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bg()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,o){e*=this.stride,o*=n.stride;for(let r=0,i=this.stride;re.far||n.push({distance:s,point:bz.clone(),uv:ih.getInterpolation(bz,NB,Tz,UB,e8e,Qoe,t8e,new Kt),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function jB(t,e,n,o,r,i){TT.subVectors(t,n).addScalar(.5).multiply(o),r!==void 0?(Sz.x=i*TT.x-r*TT.y,Sz.y=r*TT.x+i*TT.y):Sz.copy(TT),t.copy(e),t.x+=Sz.x,t.y+=Sz.y,t.applyMatrix4(ONe)}const BB=new ae,n8e=new ae;class VNe extends Ul{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let o=0,r=n.length;o0){let o,r;for(o=1,r=n.length;o0){BB.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(BB);this.getObjectForDistance(r).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){BB.setFromMatrixPosition(e.matrixWorld),n8e.setFromMatrixPosition(this.matrixWorld);const o=BB.distanceTo(n8e)/e.zoom;n[0].object.visible=!0;let r,i;for(r=1,i=n.length;r=a)n[r-1].object.visible=!1,n[r].object.visible=!0;else break}for(this._currentLevel=r-1;rs)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||n.push({distance:b,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}else{const S=Math.max(0,a.start),C=Math.min(y.count,a.start+a.count);for(let P=S,v=C-1;Ps)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);we.far||n.push({distance:w,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,o=Object.keys(n);if(o.length>0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;ir.far)return;i.push({distance:c,distanceToRay:Math.sqrt(l),point:s,index:e,face:null,object:a})}}class G5t extends Vc{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Gs,this.magFilter=i!==void 0?i:Gs,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class X5t extends Vc{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=F0,this.minFilter=F0,this.generateMipmaps=!1,this.needsUpdate=!0}}class xq extends Vc{constructor(e,n,o,r,i,a,l,s,c,u,d,f){super(null,a,l,s,c,u,r,i,d,f),this.isCompressedTexture=!0,this.image={width:n,height:o},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class J5t extends xq{constructor(e,n,o,r,i,a){super(e,n,o,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=uh}}class K5t extends xq{constructor(e,n,o){super(void 0,e[0].width,e[0].height,n,o,$6),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class g8 extends Vc{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let $2=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const o=this.getUtoTmapping(e);return this.getPoint(o,n)}getPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPoint(o/e));return n}getSpacedPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPointAt(o/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let o,r=this.getPoint(0),i=0;n.push(0);for(let a=1;a<=e;a++)o=this.getPoint(a/e),i+=o.distanceTo(r),n.push(i),r=o;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const o=this.getLengths();let r=0;const i=o.length;let a;n?a=n:a=e*o[i-1];let l=0,s=i-1,c;for(;l<=s;)if(r=Math.floor(l+(s-l)/2),c=o[r]-a,c<0)l=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,o[r]===a)return r/(i-1);const u=o[r],f=o[r+1]-u,p=(a-u)/f;return(r+p)/(i-1)}getTangent(e,n){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),l=this.getPoint(i),s=n||(a.isVector2?new Kt:new ae);return s.copy(l).sub(a).normalize(),s}getTangentAt(e,n){const o=this.getUtoTmapping(e);return this.getTangent(o,n)}computeFrenetFrames(e,n){const o=new ae,r=[],i=[],a=[],l=new ae,s=new Ki;for(let p=0;p<=e;p++){const g=p/e;r[p]=this.getTangentAt(g,new ae)}i[0]=new ae,a[0]=new ae;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,o.set(1,0,0)),d<=c&&(c=d,o.set(0,1,0)),f<=c&&o.set(0,0,1),l.crossVectors(r[0],o).normalize(),i[0].crossVectors(r[0],l),a[0].crossVectors(r[0],i[0]);for(let p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(r[p-1],r[p]),l.length()>Number.EPSILON){l.normalize();const g=Math.acos(h0(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(l,g))}a[p].crossVectors(r[p],i[p])}if(n===!0){let p=Math.acos(h0(i[0].dot(i[e]),-1,1));p/=e,r[0].dot(l.crossVectors(i[0],i[e]))>0&&(p=-p);for(let g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],p*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};class z2 extends $2{constructor(e=0,n=0,o=1,r=1,i=0,a=Math.PI*2,l=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=o,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=l,this.aRotation=s}getPoint(e,n){const o=n||new Kt,r=Math.PI*2;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:s===0&&l===i-1&&(l=i-2,s=1);let c,u;this.closed||l>0?c=r[(l-1)%i]:(XB.subVectors(r[0],r[1]).add(r[0]),c=XB);const d=r[l%i],f=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return o.set(A8e(l,s.x,c.x,u.x,d.x),A8e(l,s.y,c.y,u.y,d.y)),o}copy(e){super.copy(e),this.points=[];for(let n=0,o=e.points.length;n=o){const a=r[i]-o,l=this.curves[i],s=l.getLength(),c=s===0?0:1-a/s;return l.getPointAt(c,n)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let o=0,r=this.curves.length;o1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,o=e.curves.length;n0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class sW extends ji{constructor(e=[new Kt(0,-.5),new Kt(.5,0),new Kt(0,.5)],n=12,o=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:o,phiLength:r},n=Math.floor(n),r=h0(r,0,Math.PI*2);const i=[],a=[],l=[],s=[],c=[],u=1/n,d=new ae,f=new Kt,p=new ae,g=new ae,A=new ae;let y=0,S=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:y=e[C+1].x-e[C].x,S=e[C+1].y-e[C].y,p.x=S*1,p.y=-y,p.z=S*0,A.copy(p),p.normalize(),s.push(p.x,p.y,p.z);break;case e.length-1:s.push(A.x,A.y,A.z);break;default:y=e[C+1].x-e[C].x,S=e[C+1].y-e[C].y,p.x=S*1,p.y=-y,p.z=S*0,g.copy(p),p.x+=A.x,p.y+=A.y,p.z+=A.z,p.normalize(),s.push(p.x,p.y,p.z),A.copy(g)}for(let C=0;C<=n;C++){const P=o+C*u*r,v=Math.sin(P),T=Math.cos(P);for(let w=0;w<=e.length-1;w++){d.x=e[w].x*v,d.y=e[w].y,d.z=e[w].x*T,a.push(d.x,d.y,d.z),f.x=C/n,f.y=w/(e.length-1),l.push(f.x,f.y);const x=s[3*w+0]*v,b=s[3*w+1],R=s[3*w+0]*T;c.push(x,b,R)}}for(let C=0;C0&&P(!0),n>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new gr(d,3)),this.setAttribute("normal",new gr(f,3)),this.setAttribute("uv",new gr(p,2));function C(){const v=new ae,T=new ae;let w=0;const x=(n-e)/o;for(let b=0;b<=i;b++){const R=[],H=b/i,F=H*(n-e)+e;for(let E=0;E<=r;E++){const N=E/r,U=N*s+l,W=Math.sin(U),k=Math.cos(U);T.x=F*W,T.y=-H*o+y,T.z=F*k,d.push(T.x,T.y,T.z),v.set(W,x,k).normalize(),f.push(v.x,v.y,v.z),p.push(N,1-H),R.push(g++)}A.push(R)}for(let b=0;b.9&&x<.1&&(P<.2&&(a[C+0]+=1),v<.2&&(a[C+2]+=1),T<.2&&(a[C+4]+=1))}}function f(C){i.push(C.x,C.y,C.z)}function p(C,P){const v=C*3;P.x=e[v+0],P.y=e[v+1],P.z=e[v+2]}function g(){const C=new ae,P=new ae,v=new ae,T=new ae,w=new Kt,x=new Kt,b=new Kt;for(let R=0,H=0;R80*n){l=c=t[0],s=u=t[1];for(let g=n;gc&&(c=d),f>u&&(u=f);p=Math.max(c-l,u-s),p=p!==0?32767/p:0}return YF(i,a,n,l,s,p,0),a}};function eUe(t,e,n,o,r){let i,a;if(r===w9t(t,e,n,o)>0)for(i=e;i=e;i-=o)a=w8e(i,t[i],t[i+1],a);return a&&Hq(a,a.next)&&(VF(a),a=a.next),a}function Jx(t,e){if(!t)return t;e||(e=t);let n=t,o;do if(o=!1,!n.steiner&&(Hq(n,n.next)||n0(n.prev,n,n.next)===0)){if(VF(n),n=e=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==e);return e}function YF(t,e,n,o,r,i,a){if(!t)return;!a&&i&&h9t(t,o,r,i);let l=t,s,c;for(;t.prev!==t.next;){if(s=t.prev,c=t.next,i?i9t(t,o,r,i):r9t(t)){e.push(s.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),VF(t),t=c.next,l=c.next;continue}if(t=c,t===l){a?a===1?(t=a9t(Jx(t),e,n),YF(t,e,n,o,r,i,2)):a===2&&l9t(t,e,n,o,r,i):YF(Jx(t),e,n,o,r,i,1);break}}}function r9t(t){const e=t.prev,n=t,o=t.next;if(n0(e,n,o)>=0)return!1;const r=e.x,i=n.x,a=o.x,l=e.y,s=n.y,c=o.y,u=ri?r>a?r:a:i>a?i:a,p=l>s?l>c?l:c:s>c?s:c;let g=o.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=d&&g.y<=p&&QP(r,l,i,s,a,c,g.x,g.y)&&n0(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function i9t(t,e,n,o){const r=t.prev,i=t,a=t.next;if(n0(r,i,a)>=0)return!1;const l=r.x,s=i.x,c=a.x,u=r.y,d=i.y,f=a.y,p=ls?l>c?l:c:s>c?s:c,y=u>d?u>f?u:f:d>f?d:f,S=Cce(p,g,e,n,o),C=Cce(A,y,e,n,o);let P=t.prevZ,v=t.nextZ;for(;P&&P.z>=S&&v&&v.z<=C;){if(P.x>=p&&P.x<=A&&P.y>=g&&P.y<=y&&P!==r&&P!==a&&QP(l,u,s,d,c,f,P.x,P.y)&&n0(P.prev,P,P.next)>=0||(P=P.prevZ,v.x>=p&&v.x<=A&&v.y>=g&&v.y<=y&&v!==r&&v!==a&&QP(l,u,s,d,c,f,v.x,v.y)&&n0(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;P&&P.z>=S;){if(P.x>=p&&P.x<=A&&P.y>=g&&P.y<=y&&P!==r&&P!==a&&QP(l,u,s,d,c,f,P.x,P.y)&&n0(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;v&&v.z<=C;){if(v.x>=p&&v.x<=A&&v.y>=g&&v.y<=y&&v!==r&&v!==a&&QP(l,u,s,d,c,f,v.x,v.y)&&n0(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function a9t(t,e,n){let o=t;do{const r=o.prev,i=o.next.next;!Hq(r,i)&&tUe(r,o,o.next,i)&&OF(r,i)&&OF(i,r)&&(e.push(r.i/n|0),e.push(o.i/n|0),e.push(i.i/n|0),VF(o),VF(o.next),o=t=i),o=o.next}while(o!==t);return Jx(o)}function l9t(t,e,n,o,r,i){let a=t;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&m9t(a,l)){let s=nUe(a,l);a=Jx(a,a.next),s=Jx(s,s.next),YF(a,e,n,o,r,i,0),YF(s,e,n,o,r,i,0);return}l=l.next}a=a.next}while(a!==t)}function s9t(t,e,n,o){const r=[];let i,a,l,s,c;for(i=0,a=e.length;i=n.next.y&&n.next.y!==n.y){const f=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>o&&(o=f,r=n.x=n.x&&n.x>=s&&i!==n.x&&QP(ar.x||n.x===r.x&&f9t(r,n)))&&(r=n,u=d)),n=n.next;while(n!==l);return r}function f9t(t,e){return n0(t.prev,t,e.prev)<0&&n0(e.next,t,t.next)<0}function h9t(t,e,n,o){let r=t;do r.z===0&&(r.z=Cce(r.x,r.y,e,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,p9t(r)}function p9t(t){let e,n,o,r,i,a,l,s,c=1;do{for(n=t,t=null,i=null,a=0;n;){for(a++,o=n,l=0,e=0;e0||s>0&&o;)l!==0&&(s===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,l--):(r=o,o=o.nextZ,s--),i?i.nextZ=r:t=r,r.prevZ=i,i=r;n=o}i.nextZ=null,c*=2}while(a>1);return t}function Cce(t,e,n,o,r){return t=(t-n)*r|0,e=(e-o)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function g9t(t){let e=t,n=t;do(e.x=(t-a)*(i-l)&&(t-a)*(o-l)>=(n-a)*(e-l)&&(n-a)*(i-l)>=(r-a)*(o-l)}function m9t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!y9t(t,e)&&(OF(t,e)&&OF(e,t)&&A9t(t,e)&&(n0(t.prev,t,e.prev)||n0(t,e.prev,e))||Hq(t,e)&&n0(t.prev,t,t.next)>0&&n0(e.prev,e,e.next)>0)}function n0(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Hq(t,e){return t.x===e.x&&t.y===e.y}function tUe(t,e,n,o){const r=QB(n0(t,e,n)),i=QB(n0(t,e,o)),a=QB(n0(n,o,t)),l=QB(n0(n,o,e));return!!(r!==i&&a!==l||r===0&&$B(t,n,e)||i===0&&$B(t,o,e)||a===0&&$B(n,t,o)||l===0&&$B(n,e,o))}function $B(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function QB(t){return t>0?1:t<0?-1:0}function y9t(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&tUe(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function OF(t,e){return n0(t.prev,t,t.next)<0?n0(t,e,t.next)>=0&&n0(t,t.prev,e)>=0:n0(t,e,t.prev)<0||n0(t,t.next,e)<0}function A9t(t,e){let n=t,o=!1;const r=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==t);return o}function nUe(t,e){const n=new Rce(t.i,t.x,t.y),o=new Rce(e.i,e.x,e.y),r=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function w8e(t,e,n,o){const r=new Rce(t,e,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function VF(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Rce(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w9t(t,e,n,o){let r=0;for(let i=e,a=n-o;i2&&t[e-1].equals(t[0])&&t.pop()}function x8e(t,e){for(let n=0;nNumber.EPSILON){const ue=Math.sqrt(De),fe=Math.sqrt(Se*Se+Re*Re),ve=de.x-ge/ue,we=de.y+Te/ue,Pe=he.x-Re/fe,Ie=he.y+Se/fe,Me=((Pe-ve)*Re-(Ie-we)*Se)/(Te*Re-ge*Se);pe=ve+Te*Me-oe.x,me=we+ge*Me-oe.y;const ze=pe*pe+me*me;if(ze<=2)return new Kt(pe,me);le=Math.sqrt(ze/2)}else{let ue=!1;Te>Number.EPSILON?Se>Number.EPSILON&&(ue=!0):Te<-Number.EPSILON?Se<-Number.EPSILON&&(ue=!0):Math.sign(ge)===Math.sign(Re)&&(ue=!0),ue?(pe=-ge,me=Te,le=Math.sqrt(De)):(pe=Te,me=ge,le=Math.sqrt(De/2))}return new Kt(pe/le,me/le)}const j=[];for(let oe=0,de=U.length,he=de-1,pe=oe+1;oe=0;oe--){const de=oe/y,he=p*Math.cos(de*Math.PI/2),pe=g*Math.sin(de*Math.PI/2)+A;for(let me=0,le=U.length;me=0;){const pe=he;let me=he-1;me<0&&(me=oe.length-1);for(let le=0,Te=u+y*2;le0)&&p.push(P,v,w),(S!==o-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Z1e extends Tf{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new rr(16777215),this.specular=new rr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aUe extends Tf{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new rr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class lUe extends Tf{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class sUe extends Tf{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new rr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class cUe extends Tf{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new rr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class uUe extends gp{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Wv(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function dUe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fUe(t){function e(r,i){return t[r]-t[i]}const n=t.length,o=new Array(n);for(let r=0;r!==n;++r)o[r]=r;return o.sort(e),o}function Hce(t,e,n){const o=t.length,r=new t.constructor(o);for(let i=0,a=0;a!==o;++i){const l=n[i]*e;for(let s=0;s!==e;++s)r[a++]=t[l+s]}return r}function ege(t,e,n,o){let r=1,i=t[0];for(;i!==void 0&&i[o]===void 0;)i=t[r++];if(i===void 0)return;let a=i[o];if(a!==void 0)if(Array.isArray(a))do a=i[o],a!==void 0&&(e.push(i.time),n.push.apply(n,a)),i=t[r++];while(i!==void 0);else if(a.toArray!==void 0)do a=i[o],a!==void 0&&(e.push(i.time),a.toArray(n,n.length)),i=t[r++];while(i!==void 0);else do a=i[o],a!==void 0&&(e.push(i.time),n.push(a)),i=t[r++];while(i!==void 0)}function S9t(t,e,n,o,r=30){const i=t.clone();i.name=e;const a=[];for(let s=0;s=o)){d.push(c.times[p]);for(let A=0;Ai.tracks[s].times[0]&&(l=i.tracks[s].times[0]);for(let s=0;s=l.times[g]){const S=g*d+u,C=S+d-u;A=l.values.slice(S,C)}else{const S=l.createInterpolant(),C=u,P=d-u;S.evaluate(i),A=S.resultBuffer.slice(C,P)}s==="quaternion"&&new Ts().fromArray(A).normalize().conjugate().toArray(A);const y=c.times.length;for(let S=0;S=i)){const l=n[1];e=i)break t}a=o,o=0;break n}break e}for(;o>>1;en;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);const l=this.getValueSize();this.times=o.slice(i,a),this.values=this.values.slice(i*l,a*l)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const o=this.times,r=this.values,i=o.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==i;l++){const s=o[l];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,s,a),e=!1;break}a=s}if(r!==void 0&&dUe(r))for(let l=0,s=r.length;l!==s;++l){const c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),o=this.getValueSize(),r=this.getInterpolation()===EV,i=e.length-1;let a=1;for(let l=1;l0){e[a]=e[i];for(let l=i*o,s=a*o,c=0;c!==o;++c)n[s+c]=n[l+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*o)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),o=this.constructor,r=new o(this.name,e,n);return r.createInterpolant=this.createInterpolant,r}}Q2.prototype.TimeBufferType=Float32Array;Q2.prototype.ValueBufferType=Float32Array;Q2.prototype.DefaultInterpolation=DF;class Tb extends Q2{}Tb.prototype.ValueTypeName="bool";Tb.prototype.ValueBufferType=Array;Tb.prototype.DefaultInterpolation=zF;Tb.prototype.InterpolantFactoryMethodLinear=void 0;Tb.prototype.InterpolantFactoryMethodSmooth=void 0;class nge extends Q2{}nge.prototype.ValueTypeName="color";class _F extends Q2{}_F.prototype.ValueTypeName="number";class gUe extends dW{constructor(e,n,o,r){super(e,n,o,r)}interpolate_(e,n,o,r){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,s=(o-n)/(r-n);let c=e*l;for(let u=c+l;c!==u;c+=4)Ts.slerpFlat(i,0,a,c-l,a,c,s);return i}}class IH extends Q2{InterpolantFactoryMethodLinear(e){return new gUe(this.times,this.values,this.getValueSize(),e)}}IH.prototype.ValueTypeName="quaternion";IH.prototype.DefaultInterpolation=DF;IH.prototype.InterpolantFactoryMethodSmooth=void 0;class Pb extends Q2{}Pb.prototype.ValueTypeName="string";Pb.prototype.ValueBufferType=Array;Pb.prototype.DefaultInterpolation=zF;Pb.prototype.InterpolantFactoryMethodLinear=void 0;Pb.prototype.InterpolantFactoryMethodSmooth=void 0;class GF extends Q2{}GF.prototype.ValueTypeName="vector";class XF{constructor(e,n=-1,o,r=cq){this.name=e,this.tracks=o,this.duration=n,this.blendMode=r,this.uuid=bg(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],o=e.tracks,r=1/(e.fps||1);for(let a=0,l=o.length;a!==l;++a)n.push(R9t(o[a]).scale(r));const i=new this(e.name,e.duration,n,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const n=[],o=e.tracks,r={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let i=0,a=o.length;i!==a;++i)n.push(Q2.toJSON(o[i]));return r}static CreateFromMorphTargetSequence(e,n,o,r){const i=n.length,a=[];for(let l=0;l1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],n,o));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const o=function(d,f,p,g,A){if(p.length!==0){const y=[],S=[];ege(p,y,S,g),y.length!==0&&A.push(new d(f,y,S))}},r=[],i=e.name||"default",a=e.fps||30,l=e.blendMode;let s=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{n&&n(i),this.manager.itemEnd(e)},0),i;if(r6[e]!==void 0){r6[e].push({onLoad:n,onProgress:o,onError:r});return}r6[e]=[],r6[e].push({onLoad:n,onProgress:o,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,s=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=r6[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,g=p!==0;let A=0;const y=new ReadableStream({start(S){C();function C(){d.read().then(({done:P,value:v})=>{if(P)S.close();else{A+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:g,loaded:A,total:p});for(let w=0,x=u.length;w{switch(s){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,l));case"json":return c.json();default:if(l===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(l),f=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Kx.add(e,c);const u=r6[e];delete r6[e];for(let d=0,f=u.length;d{const u=r6[e];if(u===void 0)throw this.manager.itemError(e),c;delete r6[e];for(let d=0,f=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class M9t extends mp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new U9(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{n(i.parse(JSON.parse(l)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},o,r)}parse(e){const n=[];for(let o=0;o0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const i in e.uniforms){const a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=o(a.value);break;case"c":r.uniforms[i].value=new rr().setHex(a.value);break;case"v2":r.uniforms[i].value=new Kt().fromArray(a.value);break;case"v3":r.uniforms[i].value=new ae().fromArray(a.value);break;case"v4":r.uniforms[i].value=new qa().fromArray(a.value);break;case"m3":r.uniforms[i].value=new ha().fromArray(a.value);break;case"m4":r.uniforms[i].value=new Ki().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)r.extensions[i]=e.extensions[i];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=o(e.map)),e.matcap!==void 0&&(r.matcap=o(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=o(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=o(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=o(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),r.normalScale=new Kt().fromArray(i)}return e.displacementMap!==void 0&&(r.displacementMap=o(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=o(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=o(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=o(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=o(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=o(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=o(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=o(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=o(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=o(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=o(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=o(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=o(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=o(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Kt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=o(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=o(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=o(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=o(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=o(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=o(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=o(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:oUe,SpriteMaterial:wq,RawShaderMaterial:rUe,ShaderMaterial:O2,PointsMaterial:G1e,MeshPhysicalMaterial:iUe,MeshStandardMaterial:pf,MeshPhongMaterial:Z1e,MeshToonMaterial:aUe,MeshNormalMaterial:lUe,MeshLambertMaterial:sUe,MeshDepthMaterial:pq,MeshDistanceMaterial:gq,MeshBasicMaterial:t3,MeshMatcapMaterial:cUe,LineDashedMaterial:uUe,LineBasicMaterial:gp,Material:Tf};return new n[e]}}class Mce{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let o=0,r=e.length;o0){const s=new oge(n);i=new JF(s),i.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new JF(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,o,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,a=Kx.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){n&&n(a),i.manager.itemEnd(e)},0),a;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(s){return s.blob()}).then(function(s){return createImageBitmap(s,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(s){Kx.add(e,s),n&&n(s),i.manager.itemEnd(e)}).catch(function(s){r&&r(s),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}let ZB;class ige{static getContext(){return ZB===void 0&&(ZB=new(window.AudioContext||window.webkitAudioContext)),ZB}static setContext(e){ZB=e}}class U9t extends mp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new U9(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(s){try{const c=s.slice(0);ige.getContext().decodeAudioData(c,function(d){n(d)},l)}catch(c){l(c)}},o,r);function l(s){r?r(s):console.error(s),i.manager.itemError(e)}}}const M8e=new Ki,I8e=new Ki,B7=new Ki;class j9t{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,B7.copy(e.projectionMatrix);const r=n.eyeSep/2,i=r*n.near/n.focus,a=n.near*Math.tan(dx*n.fov*.5)/n.zoom;let l,s;I8e.elements[12]=-r,M8e.elements[12]=r,l=-a*n.aspect+i,s=a*n.aspect+i,B7.elements[0]=2*n.near/(s-l),B7.elements[8]=(s+l)/(s-l),this.cameraL.projectionMatrix.copy(B7),l=-a*n.aspect-i,s=a*n.aspect-i,B7.elements[0]=2*n.near/(s-l),B7.elements[8]=(s+l)/(s-l),this.cameraR.projectionMatrix.copy(B7)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(I8e),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(M8e)}}class age{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=z8e(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=z8e();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function z8e(){return(typeof performance>"u"?Date:performance).now()}const Y7=new ae,D8e=new Ts,B9t=new ae,O7=new ae;class Y9t extends Ul{constructor(){super(),this.type="AudioListener",this.context=ige.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new age}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,o=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Y7,D8e,B9t),O7.set(0,0,-1).applyQuaternion(D8e),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Y7.x,r),n.positionY.linearRampToValueAtTime(Y7.y,r),n.positionZ.linearRampToValueAtTime(Y7.z,r),n.forwardX.linearRampToValueAtTime(O7.x,r),n.forwardY.linearRampToValueAtTime(O7.y,r),n.forwardZ.linearRampToValueAtTime(O7.z,r),n.upX.linearRampToValueAtTime(o.x,r),n.upY.linearRampToValueAtTime(o.y,r),n.upZ.linearRampToValueAtTime(o.z,r)}else n.setPosition(Y7.x,Y7.y,Y7.z),n.setOrientation(O7.x,O7.y,O7.z,o.x,o.y,o.z)}}class CUe extends Ul{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(o,r,this._addIndex*n,1,n);for(let s=n,c=n+n;s!==c;++s)if(o[s]!==o[s+n]){l.setValue(o,r);break}}saveOriginalState(){const e=this.binding,n=this.buffer,o=this.valueSize,r=o*this._origIndex;e.getValue(n,r);for(let i=o,a=r;i!==a;++i)n[i]=n[r+i%o];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let o=e;o=.5)for(let a=0;a!==i;++a)e[n+a]=e[o+a]}_slerp(e,n,o,r){Ts.slerpFlat(e,n,e,n,e,o,r)}_slerpAdditive(e,n,o,r,i){const a=this._workIndex*i;Ts.multiplyQuaternionsFlat(e,a,e,n,e,o),Ts.slerpFlat(e,n,e,n,e,a,r)}_lerp(e,n,o,r,i){const a=1-r;for(let l=0;l!==i;++l){const s=n+l;e[s]=e[s]*a+e[o+l]*r}}_lerpAdditive(e,n,o,r,i){for(let a=0;a!==i;++a){const l=n+a;e[l]=e[l]+e[o+a]*r}}}const lge="\\[\\]\\.:\\/",G9t=new RegExp("["+lge+"]","g"),sge="[^"+lge+"]",X9t="[^"+lge.replace("\\.","")+"]",J9t=/((?:WC+[\/:])*)/.source.replace("WC",sge),K9t=/(WCOD+)?/.source.replace("WCOD",X9t),q9t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sge),$9t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sge),Q9t=new RegExp("^"+J9t+K9t+q9t+$9t+"$"),Z9t=["material","materials","bones","map"];class e3t{constructor(e,n,o){const r=o||Cl.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,r)}getValue(e,n){this.bind();const o=this._targetGroup.nCachedObjects_,r=this._bindings[o];r!==void 0&&r.getValue(e,n)}setValue(e,n){const o=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=o.length;r!==i;++r)o[r].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].unbind()}}class Cl{constructor(e,n,o){this.path=n,this.parsedPath=o||Cl.parseTrackName(n),this.node=Cl.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,o){return e&&e.isAnimationObjectGroup?new Cl.Composite(e,n,o):new Cl(e,n,o)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(G9t,"")}static parseTrackName(e){const n=Q9t.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const o={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=o.nodeName&&o.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const i=o.nodeName.substring(r+1);Z9t.indexOf(i)!==-1&&(o.nodeName=o.nodeName.substring(0,r),o.objectName=i)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return o}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const o=e.skeleton.getBoneByName(n);if(o!==void 0)return o}if(e.children){const o=function(i){for(let a=0;a=i){const d=i++,f=e[d];n[f.uuid]=u,e[u]=f,n[c]=d,e[d]=s;for(let p=0,g=r;p!==g;++p){const A=o[p],y=A[d],S=A[u];A[u]=y,A[d]=S}}}this.nCachedObjects_=i}uncache(){const e=this._objects,n=this._indicesByUUID,o=this._bindings,r=o.length;let i=this.nCachedObjects_,a=e.length;for(let l=0,s=arguments.length;l!==s;++l){const c=arguments[l],u=c.uuid,d=n[u];if(d!==void 0)if(delete n[u],d0&&(n[p.uuid]=d),e[d]=p,e.pop();for(let g=0,A=r;g!==A;++g){const y=o[g];y[d]=y[f],y.pop()}}}this.nCachedObjects_=i}subscribe_(e,n){const o=this._bindingsIndicesByPath;let r=o[e];const i=this._bindings;if(r!==void 0)return i[r];const a=this._paths,l=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,d=new Array(c);r=i.length,o[e]=r,a.push(e),l.push(n),i.push(d);for(let f=u,p=s.length;f!==p;++f){const g=s[f];d[f]=new Cl(g,e,n)}return d}unsubscribe_(e){const n=this._bindingsIndicesByPath,o=n[e];if(o!==void 0){const r=this._paths,i=this._parsedPaths,a=this._bindings,l=a.length-1,s=a[l],c=e[l];n[c]=o,a[o]=s,a.pop(),i[o]=i[l],i.pop(),r[o]=r[l],r.pop()}}}class HUe{constructor(e,n,o=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=o,this.blendMode=r;const i=n.tracks,a=i.length,l=new Array(a),s={endingStart:Fv,endingEnd:Fv};for(let c=0;c!==a;++c){const u=i[c].createInterpolant(null);l[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pNe,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,o){if(e.fadeOut(n),this.fadeIn(n),o){const r=this._clip.duration,i=e._clip.duration,a=i/r,l=r/i;e.warp(1,a,n),this.warp(l,1,n)}return this}crossFadeTo(e,n,o){return e.crossFadeFrom(this,n,o)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,o){const r=this._mixer,i=r.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const s=l.parameterPositions,c=l.sampleValues;return s[0]=i,s[1]=i+o,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,o,r){if(!this.enabled){this._updateWeight(e);return}const i=this._startTime;if(i!==null){const s=(e-i)*o;s<0||o===0?n=0:(this._startTime=null,n=o*s)}n*=this._updateTimeScale(e);const a=this._updateTime(n),l=this._updateWeight(e);if(l>0){const s=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case E1e:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulateAdditive(l);break;case cq:default:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulate(r,l)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const o=this._weightInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const o=this._timeScaleInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,o=this.loop;let r=this.time+e,i=this._loopCount;const a=o===gNe;if(e===0)return i===-1?r:a&&(i&1)===1?n-r:r;if(o===hNe){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=n||r<0){const l=Math.floor(r/n);r-=n*l,i+=Math.abs(l);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(a&&(i&1)===1)return n-r}return r}_setEndings(e,n,o){const r=this._interpolantSettings;o?(r.endingStart=kv,r.endingEnd=kv):(e?r.endingStart=this.zeroSlopeAtStart?kv:Fv:r.endingStart=EF,n?r.endingEnd=this.zeroSlopeAtEnd?kv:Fv:r.endingEnd=EF)}_scheduleFading(e,n,o){const r=this._mixer,i=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,s=a.sampleValues;return l[0]=i,s[0]=n,l[1]=i+e,s[1]=o,this}}const n3t=new Float32Array(1);class o3t extends e3{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const o=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,l=e._interpolants,s=o.uuid,c=this._bindingsByRootAndName;let u=c[s];u===void 0&&(u={},c[s]=u);for(let d=0;d!==i;++d){const f=r[d],p=f.name;let g=u[p];if(g!==void 0)++g.referenceCount,a[d]=g;else{if(g=a[d],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,s,p));continue}const A=n&&n._propertyBindings[d].binding.parsedPath;g=new RUe(Cl.create(o,p,A),f.ValueTypeName,f.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,s,p),a[d]=g}l[d].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const o=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,o)}const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];i.useCount++===0&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--o)e[o].stop();return this}update(e){e*=this.timeScale;const n=this._actions,o=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==o;++c)n[c]._update(r,e,i,a);const l=this._bindings,s=this._nActiveBindings;for(let c=0;c!==s;++c)l[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,k8e).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const L8e=new ae,eY=new ae;class uge{constructor(e=new ae,n=new ae){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){L8e.subVectors(e,this.start),eY.subVectors(this.end,this.start);const o=eY.dot(eY);let i=eY.dot(L8e)/o;return n&&(i=h0(i,0,1)),i}closestPointToPoint(e,n,o){const r=this.closestPointToPointParameter(e,n);return this.delta(o).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const W8e=new ae;class c3t extends Ul{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const o=new ji,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,s=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Y8e.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Y8e,n)}}setLength(e,n=e*.2,o=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(o,n,o),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class b3t extends o3{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new ji;r.setAttribute("position",new gr(n,3)),r.setAttribute("color",new gr(o,3));const i=new gp({vertexColors:!0,toneMapped:!1});super(r,i),this.type="AxesHelper"}setColors(e,n,o){const r=new rr,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(n),r.toArray(i,6),r.toArray(i,9),r.set(o),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class IUe{constructor(){this.type="ShapePath",this.color=new rr,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new BF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,o,r){return this.currentPath.quadraticCurveTo(e,n,o,r),this}bezierCurveTo(e,n,o,r,i,a){return this.currentPath.bezierCurveTo(e,n,o,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(S){const C=[];for(let P=0,v=S.length;PNumber.EPSILON){if(H<0&&(x=C[w],R=-R,b=C[T],H=-H),S.yb.y)continue;if(S.y===x.y){if(S.x===x.x)return!0}else{const F=H*(S.x-x.x)-R*(S.y-x.y);if(F===0)return!0;if(F<0)continue;v=!v}}else{if(S.y!==x.y)continue;if(b.x<=S.x&&S.x<=x.x||x.x<=S.x&&S.x<=b.x)return!0}}return v}const r=C9.isClockWise,i=this.subPaths;if(i.length===0)return[];let a,l,s;const c=[];if(i.length===1)return l=i[0],s=new kl,s.curves=l.curves,c.push(s),c;let u=!r(i[0].getPoints());u=e?!u:u;const d=[],f=[];let p=[],g=0,A;f[g]=void 0,p[g]=[];for(let S=0,C=i.length;S1){let S=!1,C=0;for(let P=0,v=f.length;P0&&S===!1&&(p=d)}let y;for(let S=0,C=f.length;Su||r.y>u)&&(r.x>u&&(i.x=Math.floor(u/L.x),r.x=i.x*L.x,D.mapSize.x=i.x),r.y>u&&(i.y=Math.floor(u/L.y),r.y=i.y*L.y,D.mapSize.y=i.y)),D.map===null||E===!0||N===!0){const B=this.type!==l2?{minFilter:F0,magFilter:F0}:{};D.map!==null&&D.map.dispose(),D.map=new $m(r.x,r.y,B),D.map.texture.name=k.name+".shadowMap",D.camera.updateProjectionMatrix()}t.setRenderTarget(D.map),t.clear();const j=D.getViewportCount();for(let B=0;B0||w.map&&w.alphaTest>0){const F=R.uuid,E=w.uuid;let N=c[F];N===void 0&&(N={},c[F]=N);let U=N[E];U===void 0&&(U=R.clone(),N[E]=U),R=U}if(R.visible=w.visible,R.wireframe=w.wireframe,b===l2?R.side=w.shadowSide!==null?w.shadowSide:w.side:R.side=w.shadowSide!==null?w.shadowSide:d[w.side],R.alphaMap=w.alphaMap,R.alphaTest=w.alphaTest,R.map=w.map,R.clipShadows=w.clipShadows,R.clippingPlanes=w.clippingPlanes,R.clipIntersection=w.clipIntersection,R.displacementMap=w.displacementMap,R.displacementScale=w.displacementScale,R.displacementBias=w.displacementBias,R.wireframeLinewidth=w.wireframeLinewidth,R.linewidth=w.linewidth,x.isPointLight===!0&&R.isMeshDistanceMaterial===!0){const F=t.properties.get(R);F.light=x}return R}function v(T,w,x,b,R){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&R===l2)&&(!T.frustumCulled||o.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,T.matrixWorld);const E=e.update(T),N=T.material;if(Array.isArray(N)){const U=E.groups;for(let W=0,k=U.length;W=1):B.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),L=j>=2);let O=null,V={};const G=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),$=new qa().fromArray(G),ie=new qa().fromArray(q);function Q(je,xt,gt,Ye){const it=new Uint8Array(4),ut=t.createTexture();t.bindTexture(je,ut),t.texParameteri(je,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(je,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;Qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let A;const y=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function C(Ae,ue){return S?new OffscreenCanvas(Ae,ue):UF("canvas")}function P(Ae,ue,he,ve){let we=1;if((Ae.width>ve||Ae.height>ve)&&(we=ve/Math.max(Ae.width,Ae.height)),we<1||ue===!0)if(typeof HTMLImageElement<"u"&&Ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Ae instanceof ImageBitmap){const Pe=ue?iG:Math.floor,Ie=Pe(we*Ae.width),Me=Pe(we*Ae.height);A===void 0&&(A=C(Ie,Me));const ze=he?C(Ie,Me):A;return ze.width=Ie,ze.height=Me,ze.getContext("2d").drawImage(Ae,0,0,Ie,Me),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+Ie+"x"+Me+")."),ze}else return"data"in Ae&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),Ae;return Ae}function v(Ae){return bce(Ae.width)&&bce(Ae.height)}function T(Ae){return l?!1:Ae.wrapS!==dh||Ae.wrapT!==dh||Ae.minFilter!==F0&&Ae.minFilter!==Gs}function w(Ae,ue){return Ae.generateMipmaps&&ue&&Ae.minFilter!==F0&&Ae.minFilter!==Gs}function x(Ae){t.generateMipmap(Ae)}function b(Ae,ue,he,ve,we=!1){if(l===!1)return ue;if(Ae!==null){if(t[Ae]!==void 0)return t[Ae];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Ae+"'")}let Pe=ue;if(ue===t.RED&&(he===t.FLOAT&&(Pe=t.R32F),he===t.HALF_FLOAT&&(Pe=t.R16F),he===t.UNSIGNED_BYTE&&(Pe=t.R8)),ue===t.RED_INTEGER&&(he===t.UNSIGNED_BYTE&&(Pe=t.R8UI),he===t.UNSIGNED_SHORT&&(Pe=t.R16UI),he===t.UNSIGNED_INT&&(Pe=t.R32UI),he===t.BYTE&&(Pe=t.R8I),he===t.SHORT&&(Pe=t.R16I),he===t.INT&&(Pe=t.R32I)),ue===t.RG&&(he===t.FLOAT&&(Pe=t.RG32F),he===t.HALF_FLOAT&&(Pe=t.RG16F),he===t.UNSIGNED_BYTE&&(Pe=t.RG8)),ue===t.RGBA){const Ie=we?FF:us.getTransfer(ve);he===t.FLOAT&&(Pe=t.RGBA32F),he===t.HALF_FLOAT&&(Pe=t.RGBA16F),he===t.UNSIGNED_BYTE&&(Pe=Ie===Ys?t.SRGB8_ALPHA8:t.RGBA8),he===t.UNSIGNED_SHORT_4_4_4_4&&(Pe=t.RGBA4),he===t.UNSIGNED_SHORT_5_5_5_1&&(Pe=t.RGB5_A1)}return(Pe===t.R16F||Pe===t.R32F||Pe===t.RG16F||Pe===t.RG32F||Pe===t.RGBA16F||Pe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Pe}function R(Ae,ue,he){return w(Ae,he)===!0||Ae.isFramebufferTexture&&Ae.minFilter!==F0&&Ae.minFilter!==Gs?Math.log2(Math.max(ue.width,ue.height))+1:Ae.mipmaps!==void 0&&Ae.mipmaps.length>0?Ae.mipmaps.length:Ae.isCompressedTexture&&Array.isArray(Ae.image)?ue.mipmaps.length:1}function H(Ae){return Ae===F0||Ae===oG||Ae===gE?t.NEAREST:t.LINEAR}function F(Ae){const ue=Ae.target;ue.removeEventListener("dispose",F),N(ue),ue.isVideoTexture&&g.delete(ue)}function E(Ae){const ue=Ae.target;ue.removeEventListener("dispose",E),W(ue)}function N(Ae){const ue=o.get(Ae);if(ue.__webglInit===void 0)return;const he=Ae.source,ve=y.get(he);if(ve){const we=ve[ue.__cacheKey];we.usedTimes--,we.usedTimes===0&&U(Ae),Object.keys(ve).length===0&&y.delete(he)}o.remove(Ae)}function U(Ae){const ue=o.get(Ae);t.deleteTexture(ue.__webglTexture);const he=Ae.source,ve=y.get(he);delete ve[ue.__cacheKey],a.memory.textures--}function W(Ae){const ue=Ae.texture,he=o.get(Ae),ve=o.get(ue);if(ve.__webglTexture!==void 0&&(t.deleteTexture(ve.__webglTexture),a.memory.textures--),Ae.depthTexture&&Ae.depthTexture.dispose(),Ae.isWebGLCubeRenderTarget)for(let we=0;we<6;we++){if(Array.isArray(he.__webglFramebuffer[we]))for(let Pe=0;Pe=s&&console.warn("THREE.WebGLTextures: Trying to use "+Ae+" texture units while this GPU supports only "+s),k+=1,Ae}function j(Ae){const ue=[];return ue.push(Ae.wrapS),ue.push(Ae.wrapT),ue.push(Ae.wrapR||0),ue.push(Ae.magFilter),ue.push(Ae.minFilter),ue.push(Ae.anisotropy),ue.push(Ae.internalFormat),ue.push(Ae.format),ue.push(Ae.type),ue.push(Ae.generateMipmaps),ue.push(Ae.premultiplyAlpha),ue.push(Ae.flipY),ue.push(Ae.unpackAlignment),ue.push(Ae.colorSpace),ue.join()}function B(Ae,ue){const he=o.get(Ae);if(Ae.isVideoTexture&&Re(Ae),Ae.isRenderTargetTexture===!1&&Ae.version>0&&he.__version!==Ae.version){const ve=Ae.image;if(ve===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(he,Ae,ue);return}}n.bindTexture(t.TEXTURE_2D,he.__webglTexture,t.TEXTURE0+ue)}function O(Ae,ue){const he=o.get(Ae);if(Ae.version>0&&he.__version!==Ae.version){oe(he,Ae,ue);return}n.bindTexture(t.TEXTURE_2D_ARRAY,he.__webglTexture,t.TEXTURE0+ue)}function V(Ae,ue){const he=o.get(Ae);if(Ae.version>0&&he.__version!==Ae.version){oe(he,Ae,ue);return}n.bindTexture(t.TEXTURE_3D,he.__webglTexture,t.TEXTURE0+ue)}function G(Ae,ue){const he=o.get(Ae);if(Ae.version>0&&he.__version!==Ae.version){Z(he,Ae,ue);return}n.bindTexture(t.TEXTURE_CUBE_MAP,he.__webglTexture,t.TEXTURE0+ue)}const q={[bs]:t.REPEAT,[dh]:t.CLAMP_TO_EDGE,[IF]:t.MIRRORED_REPEAT},$={[F0]:t.NEAREST,[oG]:t.NEAREST_MIPMAP_NEAREST,[gE]:t.NEAREST_MIPMAP_LINEAR,[Gs]:t.LINEAR,[C1e]:t.LINEAR_MIPMAP_NEAREST,[nw]:t.LINEAR_MIPMAP_LINEAR},ie={[ANe]:t.NEVER,[PNe]:t.ALWAYS,[wNe]:t.LESS,[xNe]:t.LEQUAL,[vNe]:t.EQUAL,[TNe]:t.GEQUAL,[bNe]:t.GREATER,[SNe]:t.NOTEQUAL};function Q(Ae,ue,he){if(he?(t.texParameteri(Ae,t.TEXTURE_WRAP_S,q[ue.wrapS]),t.texParameteri(Ae,t.TEXTURE_WRAP_T,q[ue.wrapT]),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,q[ue.wrapR]),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,$[ue.magFilter]),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,$[ue.minFilter])):(t.texParameteri(Ae,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(Ae,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(Ae===t.TEXTURE_3D||Ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Ae,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(ue.wrapS!==dh||ue.wrapT!==dh)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(Ae,t.TEXTURE_MAG_FILTER,H(ue.magFilter)),t.texParameteri(Ae,t.TEXTURE_MIN_FILTER,H(ue.minFilter)),ue.minFilter!==F0&&ue.minFilter!==Gs&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),ue.compareFunction&&(t.texParameteri(Ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Ae,t.TEXTURE_COMPARE_FUNC,ie[ue.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ve=e.get("EXT_texture_filter_anisotropic");if(ue.magFilter===F0||ue.minFilter!==gE&&ue.minFilter!==nw||ue.type===v2&&e.has("OES_texture_float_linear")===!1||l===!1&&ue.type===_x&&e.has("OES_texture_half_float_linear")===!1)return;(ue.anisotropy>1||o.get(ue).__currentAnisotropy)&&(t.texParameterf(Ae,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(ue.anisotropy,r.getMaxAnisotropy())),o.get(ue).__currentAnisotropy=ue.anisotropy)}}function se(Ae,ue){let he=!1;Ae.__webglInit===void 0&&(Ae.__webglInit=!0,ue.addEventListener("dispose",F));const ve=ue.source;let we=y.get(ve);we===void 0&&(we={},y.set(ve,we));const Pe=j(ue);if(Pe!==Ae.__cacheKey){we[Pe]===void 0&&(we[Pe]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,he=!0),we[Pe].usedTimes++;const Ie=we[Ae.__cacheKey];Ie!==void 0&&(we[Ae.__cacheKey].usedTimes--,Ie.usedTimes===0&&U(ue)),Ae.__cacheKey=Pe,Ae.__webglTexture=we[Pe].texture}return he}function oe(Ae,ue,he){let ve=t.TEXTURE_2D;(ue.isDataArrayTexture||ue.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),ue.isData3DTexture&&(ve=t.TEXTURE_3D);const we=se(Ae,ue),Pe=ue.source;n.bindTexture(ve,Ae.__webglTexture,t.TEXTURE0+he);const Ie=o.get(Pe);if(Pe.version!==Ie.__version||we===!0){n.activeTexture(t.TEXTURE0+he);const Me=us.getPrimaries(us.workingColorSpace),ze=ue.colorSpace===cg?null:us.getPrimaries(ue.colorSpace),Ne=ue.colorSpace===cg||Me===ze?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,ue.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ue.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,ue.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne);const Je=T(ue)&&v(ue.image)===!1;let Ue=P(ue.image,Je,!1,u);Ue=De(ue,Ue);const nt=v(Ue)||l,We=i.convert(ue.format,ue.colorSpace);let Ee=i.convert(ue.type),ke=b(ue.internalFormat,We,Ee,ue.colorSpace,ue.isVideoTexture);Q(ve,ue,nt);let Oe;const st=ue.mipmaps,je=l&&ue.isVideoTexture!==!0,xt=Ie.__version===void 0||we===!0,gt=R(ue,Ue,nt);if(ue.isDepthTexture)ke=t.DEPTH_COMPONENT,l?ue.type===v2?ke=t.DEPTH_COMPONENT32F:ue.type===T6?ke=t.DEPTH_COMPONENT24:ue.type===B8?ke=t.DEPTH24_STENCIL8:ke=t.DEPTH_COMPONENT16:ue.type===v2&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),ue.format===Y8&&ke===t.DEPTH_COMPONENT&&ue.type!==sq&&ue.type!==T6&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),ue.type=T6,Ee=i.convert(ue.type)),ue.format===Gx&&ke===t.DEPTH_COMPONENT&&(ke=t.DEPTH_STENCIL,ue.type!==B8&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),ue.type=B8,Ee=i.convert(ue.type))),xt&&(je?n.texStorage2D(t.TEXTURE_2D,1,ke,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,ke,Ue.width,Ue.height,0,We,Ee,null));else if(ue.isDataTexture)if(st.length>0&&nt){je&&xt&&n.texStorage2D(t.TEXTURE_2D,gt,ke,st[0].width,st[0].height);for(let Ye=0,it=st.length;Ye>=1,it>>=1}}else if(st.length>0&&nt){je&&xt&&n.texStorage2D(t.TEXTURE_2D,gt,ke,st[0].width,st[0].height);for(let Ye=0,it=st.length;Ye0&&xt++,n.texStorage2D(t.TEXTURE_CUBE_MAP,xt,Oe,Ue[0].width,Ue[0].height));for(let Ye=0;Ye<6;Ye++)if(Je){st?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0,0,0,Ue[Ye].width,Ue[Ye].height,Ee,ke,Ue[Ye].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0,Oe,Ue[Ye].width,Ue[Ye].height,0,Ee,ke,Ue[Ye].data);for(let it=0;it>Pe),Ue=Math.max(1,ue.height>>Pe);we===t.TEXTURE_3D||we===t.TEXTURE_2D_ARRAY?n.texImage3D(we,Pe,ze,Je,Ue,ue.depth,0,Ie,Me,null):n.texImage2D(we,Pe,ze,Je,Ue,0,Ie,Me,null)}n.bindFramebuffer(t.FRAMEBUFFER,Ae),Se(ue)?f.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,we,o.get(he).__webglTexture,0,ge(ue)):(we===t.TEXTURE_2D||we>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,we,o.get(he).__webglTexture,Pe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function ee(Ae,ue,he){if(t.bindRenderbuffer(t.RENDERBUFFER,Ae),ue.depthBuffer&&!ue.stencilBuffer){let ve=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(he||Se(ue)){const we=ue.depthTexture;we&&we.isDepthTexture&&(we.type===v2?ve=t.DEPTH_COMPONENT32F:we.type===T6&&(ve=t.DEPTH_COMPONENT24));const Pe=ge(ue);Se(ue)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Pe,ve,ue.width,ue.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,Pe,ve,ue.width,ue.height)}else t.renderbufferStorage(t.RENDERBUFFER,ve,ue.width,ue.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,Ae)}else if(ue.depthBuffer&&ue.stencilBuffer){const ve=ge(ue);he&&Se(ue)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,ue.width,ue.height):Se(ue)?f.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ve,t.DEPTH24_STENCIL8,ue.width,ue.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,ue.width,ue.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,Ae)}else{const ve=ue.isWebGLMultipleRenderTargets===!0?ue.texture:[ue.texture];for(let we=0;we0){he.__webglFramebuffer[Me]=[];for(let ze=0;ze0){he.__webglFramebuffer=[];for(let Me=0;Me0&&Se(Ae)===!1){const Me=Pe?ue:[ue];he.__webglMultisampledFramebuffer=t.createFramebuffer(),he.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,he.__webglMultisampledFramebuffer);for(let ze=0;ze0)for(let ze=0;ze0)for(let ze=0;ze0&&Se(Ae)===!1){const ue=Ae.isWebGLMultipleRenderTargets?Ae.texture:[Ae.texture],he=Ae.width,ve=Ae.height;let we=t.COLOR_BUFFER_BIT;const Pe=[],Ie=Ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Me=o.get(Ae),ze=Ae.isWebGLMultipleRenderTargets===!0;if(ze)for(let Ne=0;Ne0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&ue.__useRenderToTexture!==!1}function Re(Ae){const ue=a.render.frame;g.get(Ae)!==ue&&(g.set(Ae,ue),Ae.update())}function De(Ae,ue){const he=Ae.colorSpace,ve=Ae.format,we=Ae.type;return Ae.isCompressedTexture===!0||Ae.isVideoTexture===!0||Ae.format===rG||he!==W9&&he!==cg&&(us.getTransfer(he)===Ys?l===!1?e.has("EXT_sRGB")===!0&&ve===Up?(Ae.format=rG,Ae.minFilter=Gs,Ae.generateMipmaps=!1):ue=W1e.sRGBToLinear(ue):(ve!==Up||we!==P9)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",he)),ue}this.allocateTextureUnit=L,this.resetTextureUnits=D,this.setTexture2D=B,this.setTexture2DArray=O,this.setTexture3D=V,this.setTextureCube=G,this.rebindTextures=pe,this.setupRenderTarget=ye,this.updateRenderTargetMipmap=ae,this.updateMultisampleRenderTarget=Te,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=te,this.useMultisampledRTT=Se}function jNe(t,e,n){const o=n.isWebGL2;function r(i,a=cg){let l;const s=us.getTransfer(a);if(i===P9)return t.UNSIGNED_BYTE;if(i===H1e)return t.UNSIGNED_SHORT_4_4_4_4;if(i===M1e)return t.UNSIGNED_SHORT_5_5_5_1;if(i===rNe)return t.BYTE;if(i===iNe)return t.SHORT;if(i===sq)return t.UNSIGNED_SHORT;if(i===R1e)return t.INT;if(i===T6)return t.UNSIGNED_INT;if(i===v2)return t.FLOAT;if(i===_x)return o?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(i===aNe)return t.ALPHA;if(i===Up)return t.RGBA;if(i===lNe)return t.LUMINANCE;if(i===sNe)return t.LUMINANCE_ALPHA;if(i===Y8)return t.DEPTH_COMPONENT;if(i===Gx)return t.DEPTH_STENCIL;if(i===rG)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(i===cNe)return t.RED;if(i===I1e)return t.RED_INTEGER;if(i===uNe)return t.RG;if(i===z1e)return t.RG_INTEGER;if(i===D1e)return t.RGBA_INTEGER;if(i===HV||i===MV||i===IV||i===zV)if(s===Ys)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(i===HV)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===MV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===IV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===zV)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(i===HV)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===MV)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===IV)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===zV)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Kse||i===qse||i===$se||i===Qse)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(i===Kse)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===qse)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===$se)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Qse)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===dNe)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===Zse||i===ece)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(i===Zse)return s===Ys?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(i===ece)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===tce||i===nce||i===oce||i===rce||i===ice||i===ace||i===lce||i===sce||i===cce||i===uce||i===dce||i===fce||i===hce||i===pce)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(i===tce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===nce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===oce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===rce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ice)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ace)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===lce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===sce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===cce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===uce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===dce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===fce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===hce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===pce)return s===Ys?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===DV||i===gce||i===mce)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(i===DV)return s===Ys?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===gce)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===mce)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===fNe||i===yce||i===Ace||i===wce)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(i===DV)return l.COMPRESSED_RED_RGTC1_EXT;if(i===yce)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Ace)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===wce)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===B8?o?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[i]!==void 0?t[i]:null}return{convert:r}}class BNe extends zu{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let $P=class extends Ul{constructor(){super(),this.isGroup=!0,this.type="Group"}};const U5t={type:"move"};class $oe{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $P,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new $P,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new le,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new le),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $P,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new le,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new le),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const o of e.hand.values())this._getHandJoint(n,o)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,o){let r=null,i=null,a=null;const l=this._targetRay,s=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const A of e.hand.values()){const y=n.getJointPose(A,o),S=this._getHandJoint(c,A);y!==null&&(S.matrix.fromArray(y.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=y.radius),S.visible=y!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),p=.02,g=.005;c.inputState.pinching&&f>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=n.getPose(e.gripSpace,o),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,o),r===null&&i!==null&&(r=i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(U5t)))}return l!==null&&(l.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const o=new $P;o.matrixAutoUpdate=!1,o.visible=!1,e.joints[n.jointName]=o,e.add(o)}return e.joints[n.jointName]}}class Y1e extends Vc{constructor(e,n,o,r,i,a,l,s,c,u){if(u=u!==void 0?u:Y8,u!==Y8&&u!==Gx)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&u===Y8&&(o=T6),o===void 0&&u===Gx&&(o=B8),super(null,r,i,a,l,s,u,o,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:F0,this.minFilter=s!==void 0?s:F0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class j5t extends e3{constructor(e,n){super();const o=this;let r=null,i=1,a=null,l="local-floor",s=1,c=null,u=null,d=null,f=null,p=null,g=null;const A=n.getContextAttributes();let y=null,S=null;const C=[],P=[],v=new zu;v.layers.enable(1),v.viewport=new qa;const T=new zu;T.layers.enable(2),T.viewport=new qa;const w=[v,T],x=new BNe;x.layers.enable(1),x.layers.enable(2);let b=null,R=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getTargetRaySpace()},this.getControllerGrip=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getGripSpace()},this.getHand=function(O){let V=C[O];return V===void 0&&(V=new $oe,C[O]=V),V.getHandSpace()};function H(O){const V=P.indexOf(O.inputSource);if(V===-1)return;const G=C[V];G!==void 0&&(G.update(O.inputSource,O.frame,c||a),G.dispatchEvent({type:O.type,data:O.inputSource}))}function F(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",F),r.removeEventListener("inputsourceschange",E);for(let O=0;O=0&&(P[q]=null,C[q].disconnect(G))}for(let V=0;V=P.length){P.push(G),q=ie;break}else if(P[ie]===null){P[ie]=G,q=ie;break}if(q===-1)break}const $=C[q];$&&$.connect(G)}}const N=new le,U=new le;function W(O,V,G){N.setFromMatrixPosition(V.matrixWorld),U.setFromMatrixPosition(G.matrixWorld);const q=N.distanceTo(U),$=V.projectionMatrix.elements,ie=G.projectionMatrix.elements,Q=$[14]/($[10]-1),se=$[14]/($[10]+1),oe=($[9]+1)/$[5],Z=($[9]-1)/$[5],te=($[8]-1)/$[0],ee=(ie[8]+1)/ie[0],de=Q*te,fe=Q*ee,pe=q/(-te+ee),ye=pe*-te;V.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(ye),O.translateZ(pe),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const ae=Q+pe,Te=se+pe,ge=de-ye,Se=fe+(q-ye),Re=oe*se/Te*ae,De=Z*se/Te*ae;O.projectionMatrix.makePerspective(ge,Se,Re,De,ae,Te),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function k(O,V){V===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(V.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;x.near=T.near=v.near=O.near,x.far=T.far=v.far=O.far,(b!==x.near||R!==x.far)&&(r.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,R=x.far);const V=O.parent,G=x.cameras;k(x,V);for(let q=0;q0&&(y.alphaTest.value=S.alphaTest);const C=e.get(S).envMap;if(C&&(y.envMap.value=C,y.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=S.reflectivity,y.ior.value=S.ior,y.refractionRatio.value=S.refractionRatio),S.lightMap){y.lightMap.value=S.lightMap;const P=t._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=S.lightMapIntensity*P,n(S.lightMap,y.lightMapTransform)}S.aoMap&&(y.aoMap.value=S.aoMap,y.aoMapIntensity.value=S.aoMapIntensity,n(S.aoMap,y.aoMapTransform))}function a(y,S){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,S.map&&(y.map.value=S.map,n(S.map,y.mapTransform))}function l(y,S){y.dashSize.value=S.dashSize,y.totalSize.value=S.dashSize+S.gapSize,y.scale.value=S.scale}function s(y,S,C,P){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,y.size.value=S.size*C,y.scale.value=P*.5,S.map&&(y.map.value=S.map,n(S.map,y.uvTransform)),S.alphaMap&&(y.alphaMap.value=S.alphaMap,n(S.alphaMap,y.alphaMapTransform)),S.alphaTest>0&&(y.alphaTest.value=S.alphaTest)}function c(y,S){y.diffuse.value.copy(S.color),y.opacity.value=S.opacity,y.rotation.value=S.rotation,S.map&&(y.map.value=S.map,n(S.map,y.mapTransform)),S.alphaMap&&(y.alphaMap.value=S.alphaMap,n(S.alphaMap,y.alphaMapTransform)),S.alphaTest>0&&(y.alphaTest.value=S.alphaTest)}function u(y,S){y.specular.value.copy(S.specular),y.shininess.value=Math.max(S.shininess,1e-4)}function d(y,S){S.gradientMap&&(y.gradientMap.value=S.gradientMap)}function f(y,S){y.metalness.value=S.metalness,S.metalnessMap&&(y.metalnessMap.value=S.metalnessMap,n(S.metalnessMap,y.metalnessMapTransform)),y.roughness.value=S.roughness,S.roughnessMap&&(y.roughnessMap.value=S.roughnessMap,n(S.roughnessMap,y.roughnessMapTransform)),e.get(S).envMap&&(y.envMapIntensity.value=S.envMapIntensity)}function p(y,S,C){y.ior.value=S.ior,S.sheen>0&&(y.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),y.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(y.sheenColorMap.value=S.sheenColorMap,n(S.sheenColorMap,y.sheenColorMapTransform)),S.sheenRoughnessMap&&(y.sheenRoughnessMap.value=S.sheenRoughnessMap,n(S.sheenRoughnessMap,y.sheenRoughnessMapTransform))),S.clearcoat>0&&(y.clearcoat.value=S.clearcoat,y.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(y.clearcoatMap.value=S.clearcoatMap,n(S.clearcoatMap,y.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,n(S.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(y.clearcoatNormalMap.value=S.clearcoatNormalMap,n(S.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===r0&&y.clearcoatNormalScale.value.negate())),S.iridescence>0&&(y.iridescence.value=S.iridescence,y.iridescenceIOR.value=S.iridescenceIOR,y.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(y.iridescenceMap.value=S.iridescenceMap,n(S.iridescenceMap,y.iridescenceMapTransform)),S.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=S.iridescenceThicknessMap,n(S.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),S.transmission>0&&(y.transmission.value=S.transmission,y.transmissionSamplerMap.value=C.texture,y.transmissionSamplerSize.value.set(C.width,C.height),S.transmissionMap&&(y.transmissionMap.value=S.transmissionMap,n(S.transmissionMap,y.transmissionMapTransform)),y.thickness.value=S.thickness,S.thicknessMap&&(y.thicknessMap.value=S.thicknessMap,n(S.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=S.attenuationDistance,y.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(y.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(y.anisotropyMap.value=S.anisotropyMap,n(S.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=S.specularIntensity,y.specularColor.value.copy(S.specularColor),S.specularColorMap&&(y.specularColorMap.value=S.specularColorMap,n(S.specularColorMap,y.specularColorMapTransform)),S.specularIntensityMap&&(y.specularIntensityMap.value=S.specularIntensityMap,n(S.specularIntensityMap,y.specularIntensityMapTransform))}function g(y,S){S.matcap&&(y.matcap.value=S.matcap)}function A(y,S){const C=e.get(S).light;y.referencePosition.value.setFromMatrixPosition(C.matrixWorld),y.nearDistance.value=C.shadow.camera.near,y.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:r}}function Y5t(t,e,n,o){let r={},i={},a=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function s(C,P){const v=P.program;o.uniformBlockBinding(C,v)}function c(C,P){let v=r[C.id];v===void 0&&(g(C),v=u(C),r[C.id]=v,C.addEventListener("dispose",y));const T=P.program;o.updateUBOMapping(C,T);const w=e.render.frame;i[C.id]!==w&&(f(C),i[C.id]=w)}function u(C){const P=d();C.__bindingPointIndex=P;const v=t.createBuffer(),T=C.__size,w=C.usage;return t.bindBuffer(t.UNIFORM_BUFFER,v),t.bufferData(t.UNIFORM_BUFFER,T,w),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,P,v),v}function d(){for(let C=0;C0){w=v%T;const E=T-w;w!==0&&E-H.boundary<0&&(v+=T-w,R.__offset=v)}v+=H.storage}return w=v%T,w>0&&(v+=T-w),C.__size=v,C.__cache={},this}function A(C){const P={boundary:0,storage:0};return typeof C=="number"?(P.boundary=4,P.storage=4):C.isVector2?(P.boundary=8,P.storage=8):C.isVector3||C.isColor?(P.boundary=16,P.storage=12):C.isVector4?(P.boundary=16,P.storage=16):C.isMatrix3?(P.boundary=48,P.storage=48):C.isMatrix4?(P.boundary=64,P.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),P}function y(C){const P=C.target;P.removeEventListener("dispose",y);const v=a.indexOf(P.__bindingPointIndex);a.splice(v,1),t.deleteBuffer(r[P.id]),delete r[P.id],delete i[P.id]}function S(){for(const C in r)t.deleteBuffer(r[C]);a=[],r={},i={}}return{bind:s,update:c,dispose:S}}class O1e{constructor(e={}){const{canvas:n=MNe(),context:o=null,depth:r=!0,stencil:i=!0,alpha:a=!1,antialias:l=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let f;o!==null?f=o.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),g=new Int32Array(4);let A=null,y=null;const S=[],C=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ou,this._useLegacyLights=!1,this.toneMapping=T9,this.toneMappingExposure=1;const P=this;let v=!1,T=0,w=0,x=null,b=-1,R=null;const H=new qa,F=new qa;let E=null;const N=new rr(0);let U=0,W=n.width,k=n.height,D=1,L=null,j=null;const B=new qa(0,0,W,k),O=new qa(0,0,W,k);let V=!1;const G=new fq;let q=!1,$=!1,ie=null;const Q=new Ki,se=new Kt,oe=new le,Z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return x===null?D:1}let ee=o;function de(Ve,ft){for(let kt=0;kt{function Ge(){if(rt.forEach(function(yt){Te.get(yt).currentProgram.isReady()&&rt.delete(yt)}),rt.size===0){at(Ve);return}setTimeout(Ge,10)}fe.get("KHR_parallel_shader_compile")!==null?Ge():setTimeout(Ge,10)})};let Qe=null;function lt(Ve){Qe&&Qe(Ve)}function Ze(){$e.stop()}function Be(){$e.start()}const $e=new kNe;$e.setAnimationLoop(lt),typeof self<"u"&&$e.setContext(self),this.setAnimationLoop=function(Ve){Qe=Ve,Oe.setAnimationLoop(Ve),Ve===null?$e.stop():$e.start()},Oe.addEventListener("sessionstart",Ze),Oe.addEventListener("sessionend",Be),this.render=function(Ve,ft){if(ft!==void 0&&ft.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;Ve.matrixWorldAutoUpdate===!0&&Ve.updateMatrixWorld(),ft.parent===null&&ft.matrixWorldAutoUpdate===!0&&ft.updateMatrixWorld(),Oe.enabled===!0&&Oe.isPresenting===!0&&(Oe.cameraAutoUpdate===!0&&Oe.updateCamera(ft),ft=Oe.getCamera()),Ve.isScene===!0&&Ve.onBeforeRender(P,Ve,ft,x),y=Pe.get(Ve,C.length),y.init(),C.push(y),Q.multiplyMatrices(ft.projectionMatrix,ft.matrixWorldInverse),G.setFromProjectionMatrix(Q),$=this.localClippingEnabled,q=Ie.init(this.clippingPlanes,$),A=we.get(Ve,S.length),A.init(),S.push(A),wt(Ve,ft,0,P.sortObjects),A.finish(),P.sortObjects===!0&&A.sort(L,j),this.info.render.frame++,q===!0&&Ie.beginShadows();const kt=y.state.shadowsArray;if(Me.render(kt,Ve,ft),q===!0&&Ie.endShadows(),this.info.autoReset===!0&&this.info.reset(),ze.render(A,Ve),y.setupLights(P._useLegacyLights),ft.isArrayCamera){const rt=ft.cameras;for(let at=0,Ge=rt.length;at0?y=C[C.length-1]:y=null,S.pop(),S.length>0?A=S[S.length-1]:A=null};function wt(Ve,ft,kt,rt){if(Ve.visible===!1)return;if(Ve.layers.test(ft.layers)){if(Ve.isGroup)kt=Ve.renderOrder;else if(Ve.isLOD)Ve.autoUpdate===!0&&Ve.update(ft);else if(Ve.isLight)y.pushLight(Ve),Ve.castShadow&&y.pushShadow(Ve);else if(Ve.isSprite){if(!Ve.frustumCulled||G.intersectsSprite(Ve)){rt&&oe.setFromMatrixPosition(Ve.matrixWorld).applyMatrix4(Q);const yt=ue.update(Ve),Pt=Ve.material;Pt.visible&&A.push(Ve,yt,Pt,kt,oe.z,null)}}else if((Ve.isMesh||Ve.isLine||Ve.isPoints)&&(!Ve.frustumCulled||G.intersectsObject(Ve))){const yt=ue.update(Ve),Pt=Ve.material;if(rt&&(Ve.boundingSphere!==void 0?(Ve.boundingSphere===null&&Ve.computeBoundingSphere(),oe.copy(Ve.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),oe.copy(yt.boundingSphere.center)),oe.applyMatrix4(Ve.matrixWorld).applyMatrix4(Q)),Array.isArray(Pt)){const ot=yt.groups;for(let bt=0,zt=ot.length;bt0&&Rt(at,Ge,ft,kt),rt&&ye.viewport(H.copy(rt)),at.length>0&&Gt(at,ft,kt),Ge.length>0&&Gt(Ge,ft,kt),yt.length>0&&Gt(yt,ft,kt),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function Rt(Ve,ft,kt,rt){if((kt.isScene===!0?kt.overrideMaterial:null)!==null)return;const Ge=pe.isWebGL2;ie===null&&(ie=new $m(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")?_x:P9,minFilter:nw,samples:Ge?4:0})),P.getDrawingBufferSize(se),Ge?ie.setSize(se.x,se.y):ie.setSize(iG(se.x),iG(se.y));const yt=P.getRenderTarget();P.setRenderTarget(ie),P.getClearColor(N),U=P.getClearAlpha(),U<1&&P.setClearColor(16777215,.5),P.clear();const Pt=P.toneMapping;P.toneMapping=T9,Gt(Ve,kt,rt),ge.updateMultisampleRenderTarget(ie),ge.updateRenderTargetMipmap(ie);let ot=!1;for(let bt=0,zt=ft.length;bt0),Bt=!!kt.morphAttributes.position,tt=!!kt.morphAttributes.normal,Ht=!!kt.morphAttributes.color;let _t=T9;rt.toneMapped&&(x===null||x.isXRRenderTarget===!0)&&(_t=P.toneMapping);const qt=kt.morphAttributes.position||kt.morphAttributes.normal||kt.morphAttributes.color,un=qt!==void 0?qt.length:0,Rn=Te.get(rt),yo=y.state.lights;if(q===!0&&($===!0||Ve!==R)){const br=Ve===R&&rt.id===b;Ie.setState(rt,Ve,br)}let Ao=!1;rt.version===Rn.__version?(Rn.needsLights&&Rn.lightsStateVersion!==yo.state.version||Rn.outputColorSpace!==Pt||at.isInstancedMesh&&Rn.instancing===!1||!at.isInstancedMesh&&Rn.instancing===!0||at.isSkinnedMesh&&Rn.skinning===!1||!at.isSkinnedMesh&&Rn.skinning===!0||at.isInstancedMesh&&Rn.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&Rn.instancingColor===!1&&at.instanceColor!==null||Rn.envMap!==ot||rt.fog===!0&&Rn.fog!==Ge||Rn.numClippingPlanes!==void 0&&(Rn.numClippingPlanes!==Ie.numPlanes||Rn.numIntersection!==Ie.numIntersection)||Rn.vertexAlphas!==bt||Rn.vertexTangents!==zt||Rn.morphTargets!==Bt||Rn.morphNormals!==tt||Rn.morphColors!==Ht||Rn.toneMapping!==_t||pe.isWebGL2===!0&&Rn.morphTargetsCount!==un)&&(Ao=!0):(Ao=!0,Rn.__version=rt.version);let wo=Rn.currentProgram;Ao===!0&&(wo=pt(rt,ft,at));let Io=!1,po=!1,On=!1;const fo=wo.getUniforms(),ir=Rn.uniforms;if(ye.useProgram(wo.program)&&(Io=!0,po=!0,On=!0),rt.id!==b&&(b=rt.id,po=!0),Io||R!==Ve){fo.setValue(ee,"projectionMatrix",Ve.projectionMatrix),fo.setValue(ee,"viewMatrix",Ve.matrixWorldInverse);const br=fo.map.cameraPosition;br!==void 0&&br.setValue(ee,oe.setFromMatrixPosition(Ve.matrixWorld)),pe.logarithmicDepthBuffer&&fo.setValue(ee,"logDepthBufFC",2/(Math.log(Ve.far+1)/Math.LN2)),(rt.isMeshPhongMaterial||rt.isMeshToonMaterial||rt.isMeshLambertMaterial||rt.isMeshBasicMaterial||rt.isMeshStandardMaterial||rt.isShaderMaterial)&&fo.setValue(ee,"isOrthographic",Ve.isOrthographicCamera===!0),R!==Ve&&(R=Ve,po=!0,On=!0)}if(at.isSkinnedMesh){fo.setOptional(ee,at,"bindMatrix"),fo.setOptional(ee,at,"bindMatrixInverse");const br=at.skeleton;br&&(pe.floatVertexTextures?(br.boneTexture===null&&br.computeBoneTexture(),fo.setValue(ee,"boneTexture",br.boneTexture,ge),fo.setValue(ee,"boneTextureSize",br.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Rr=kt.morphAttributes;if((Rr.position!==void 0||Rr.normal!==void 0||Rr.color!==void 0&&pe.isWebGL2===!0)&&Ne.update(at,kt,wo),(po||Rn.receiveShadow!==at.receiveShadow)&&(Rn.receiveShadow=at.receiveShadow,fo.setValue(ee,"receiveShadow",at.receiveShadow)),rt.isMeshGouraudMaterial&&rt.envMap!==null&&(ir.envMap.value=ot,ir.flipEnvMap.value=ot.isCubeTexture&&ot.isRenderTargetTexture===!1?-1:1),po&&(fo.setValue(ee,"toneMappingExposure",P.toneMappingExposure),Rn.needsLights&&It(ir,On),Ge&&rt.fog===!0&&ve.refreshFogUniforms(ir,Ge),ve.refreshMaterialUniforms(ir,rt,D,k,ie),FV.upload(ee,Wt(Rn),ir,ge)),rt.isShaderMaterial&&rt.uniformsNeedUpdate===!0&&(FV.upload(ee,Wt(Rn),ir,ge),rt.uniformsNeedUpdate=!1),rt.isSpriteMaterial&&fo.setValue(ee,"center",at.center),fo.setValue(ee,"modelViewMatrix",at.modelViewMatrix),fo.setValue(ee,"normalMatrix",at.normalMatrix),fo.setValue(ee,"modelMatrix",at.matrixWorld),rt.isShaderMaterial||rt.isRawShaderMaterial){const br=rt.uniformsGroups;for(let _r=0,jo=br.length;_r0&&ge.useMultisampledRTT(Ve)===!1?at=Te.get(Ve).__webglMultisampledFramebuffer:Array.isArray(zt)?at=zt[kt]:at=zt,H.copy(Ve.viewport),F.copy(Ve.scissor),E=Ve.scissorTest}else H.copy(B).multiplyScalar(D).floor(),F.copy(O).multiplyScalar(D).floor(),E=V;if(ye.bindFramebuffer(ee.FRAMEBUFFER,at)&&pe.drawBuffers&&rt&&ye.drawBuffers(Ve,at),ye.viewport(H),ye.scissor(F),ye.setScissorTest(E),Ge){const ot=Te.get(Ve.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+ft,ot.__webglTexture,kt)}else if(yt){const ot=Te.get(Ve.texture),bt=ft||0;ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ot.__webglTexture,kt||0,bt)}b=-1},this.readRenderTargetPixels=function(Ve,ft,kt,rt,at,Ge,yt){if(!(Ve&&Ve.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Pt=Te.get(Ve).__webglFramebuffer;if(Ve.isWebGLCubeRenderTarget&&yt!==void 0&&(Pt=Pt[yt]),Pt){ye.bindFramebuffer(ee.FRAMEBUFFER,Pt);try{const ot=Ve.texture,bt=ot.format,zt=ot.type;if(bt!==Up&&nt.convert(bt)!==ee.getParameter(ee.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Bt=zt===_x&&(fe.has("EXT_color_buffer_half_float")||pe.isWebGL2&&fe.has("EXT_color_buffer_float"));if(zt!==P9&&nt.convert(zt)!==ee.getParameter(ee.IMPLEMENTATION_COLOR_READ_TYPE)&&!(zt===v2&&(pe.isWebGL2||fe.has("OES_texture_float")||fe.has("WEBGL_color_buffer_float")))&&!Bt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ft>=0&&ft<=Ve.width-rt&&kt>=0&&kt<=Ve.height-at&&ee.readPixels(ft,kt,rt,at,nt.convert(bt),nt.convert(zt),Ge)}finally{const ot=x!==null?Te.get(x).__webglFramebuffer:null;ye.bindFramebuffer(ee.FRAMEBUFFER,ot)}}},this.copyFramebufferToTexture=function(Ve,ft,kt=0){const rt=Math.pow(2,-kt),at=Math.floor(ft.image.width*rt),Ge=Math.floor(ft.image.height*rt);ge.setTexture2D(ft,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,kt,0,0,Ve.x,Ve.y,at,Ge),ye.unbindTexture()},this.copyTextureToTexture=function(Ve,ft,kt,rt=0){const at=ft.image.width,Ge=ft.image.height,yt=nt.convert(kt.format),Pt=nt.convert(kt.type);ge.setTexture2D(kt,0),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,kt.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,kt.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,kt.unpackAlignment),ft.isDataTexture?ee.texSubImage2D(ee.TEXTURE_2D,rt,Ve.x,Ve.y,at,Ge,yt,Pt,ft.image.data):ft.isCompressedTexture?ee.compressedTexSubImage2D(ee.TEXTURE_2D,rt,Ve.x,Ve.y,ft.mipmaps[0].width,ft.mipmaps[0].height,yt,ft.mipmaps[0].data):ee.texSubImage2D(ee.TEXTURE_2D,rt,Ve.x,Ve.y,yt,Pt,ft.image),rt===0&&kt.generateMipmaps&&ee.generateMipmap(ee.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(Ve,ft,kt,rt,at=0){if(P.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=Ve.max.x-Ve.min.x+1,yt=Ve.max.y-Ve.min.y+1,Pt=Ve.max.z-Ve.min.z+1,ot=nt.convert(rt.format),bt=nt.convert(rt.type);let zt;if(rt.isData3DTexture)ge.setTexture3D(rt,0),zt=ee.TEXTURE_3D;else if(rt.isDataArrayTexture)ge.setTexture2DArray(rt,0),zt=ee.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,rt.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,rt.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,rt.unpackAlignment);const Bt=ee.getParameter(ee.UNPACK_ROW_LENGTH),tt=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Ht=ee.getParameter(ee.UNPACK_SKIP_PIXELS),_t=ee.getParameter(ee.UNPACK_SKIP_ROWS),qt=ee.getParameter(ee.UNPACK_SKIP_IMAGES),un=kt.isCompressedTexture?kt.mipmaps[0]:kt.image;ee.pixelStorei(ee.UNPACK_ROW_LENGTH,un.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,un.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ve.min.x),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ve.min.y),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Ve.min.z),kt.isDataTexture||kt.isData3DTexture?ee.texSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,bt,un.data):kt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ee.compressedTexSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,un.data)):ee.texSubImage3D(zt,at,ft.x,ft.y,ft.z,Ge,yt,Pt,ot,bt,un),ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Bt),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,tt),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ht),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,_t),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,qt),at===0&&rt.generateMipmaps&&ee.generateMipmap(zt),ye.unbindTexture()},this.initTexture=function(Ve){Ve.isCubeTexture?ge.setTextureCube(Ve,0):Ve.isData3DTexture?ge.setTexture3D(Ve,0):Ve.isDataArrayTexture||Ve.isCompressedArrayTexture?ge.setTexture2DArray(Ve,0):ge.setTexture2D(Ve,0),ye.unbindTexture()},this.resetState=function(){T=0,w=0,x=null,ye.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return g9}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===uq?"display-p3":"srgb",n.unpackColorSpace=us.workingColorSpace===rW?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===ou?O8:F1e}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===O8?ou:W9}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class YNe extends O1e{}YNe.prototype.isWebGL1Renderer=!0;class mq{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new rr(e),this.density=n}clone(){return new mq(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class yq{constructor(e,n=1,o=1e3){this.isFog=!0,this.name="",this.color=new rr(e),this.near=n,this.far=o}clone(){return new yq(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class aG extends Ul{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class Aq{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=WF,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=bg()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,o){e*=this.stride,o*=n.stride;for(let r=0,i=this.stride;re.far||n.push({distance:s,point:bz.clone(),uv:ah.getInterpolation(bz,NB,Tz,UB,e8e,Qoe,t8e,new Kt),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function jB(t,e,n,o,r,i){TT.subVectors(t,n).addScalar(.5).multiply(o),r!==void 0?(Sz.x=i*TT.x-r*TT.y,Sz.y=r*TT.x+i*TT.y):Sz.copy(TT),t.copy(e),t.x+=Sz.x,t.y+=Sz.y,t.applyMatrix4(ONe)}const BB=new le,n8e=new le;class VNe extends Ul{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let o=0,r=n.length;o0){let o,r;for(o=1,r=n.length;o0){BB.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(BB);this.getObjectForDistance(r).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){BB.setFromMatrixPosition(e.matrixWorld),n8e.setFromMatrixPosition(this.matrixWorld);const o=BB.distanceTo(n8e)/e.zoom;n[0].object.visible=!0;let r,i;for(r=1,i=n.length;r=a)n[r-1].object.visible=!1,n[r].object.visible=!0;else break}for(this._currentLevel=r-1;rs)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||n.push({distance:b,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}else{const S=Math.max(0,a.start),C=Math.min(y.count,a.start+a.count);for(let P=S,v=C-1;Ps)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);we.far||n.push({distance:w,point:d.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,o=Object.keys(n);if(o.length>0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;i0){const r=n[o[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,a=r.length;ir.far)return;i.push({distance:c,distanceToRay:Math.sqrt(l),point:s,index:e,face:null,object:a})}}class G5t extends Vc{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Gs,this.magFilter=i!==void 0?i:Gs,this.generateMipmaps=!1;const u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class X5t extends Vc{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=F0,this.minFilter=F0,this.generateMipmaps=!1,this.needsUpdate=!0}}class xq extends Vc{constructor(e,n,o,r,i,a,l,s,c,u,d,f){super(null,a,l,s,c,u,r,i,d,f),this.isCompressedTexture=!0,this.image={width:n,height:o},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class J5t extends xq{constructor(e,n,o,r,i,a){super(e,n,o,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=dh}}class K5t extends xq{constructor(e,n,o){super(void 0,e[0].width,e[0].height,n,o,$6),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class g8 extends Vc{constructor(e,n,o,r,i,a,l,s,c){super(e,n,o,r,i,a,l,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let $2=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const o=this.getUtoTmapping(e);return this.getPoint(o,n)}getPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPoint(o/e));return n}getSpacedPoints(e=5){const n=[];for(let o=0;o<=e;o++)n.push(this.getPointAt(o/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let o,r=this.getPoint(0),i=0;n.push(0);for(let a=1;a<=e;a++)o=this.getPoint(a/e),i+=o.distanceTo(r),n.push(i),r=o;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const o=this.getLengths();let r=0;const i=o.length;let a;n?a=n:a=e*o[i-1];let l=0,s=i-1,c;for(;l<=s;)if(r=Math.floor(l+(s-l)/2),c=o[r]-a,c<0)l=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,o[r]===a)return r/(i-1);const u=o[r],f=o[r+1]-u,p=(a-u)/f;return(r+p)/(i-1)}getTangent(e,n){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);const a=this.getPoint(r),l=this.getPoint(i),s=n||(a.isVector2?new Kt:new le);return s.copy(l).sub(a).normalize(),s}getTangentAt(e,n){const o=this.getUtoTmapping(e);return this.getTangent(o,n)}computeFrenetFrames(e,n){const o=new le,r=[],i=[],a=[],l=new le,s=new Ki;for(let p=0;p<=e;p++){const g=p/e;r[p]=this.getTangentAt(g,new le)}i[0]=new le,a[0]=new le;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,o.set(1,0,0)),d<=c&&(c=d,o.set(0,1,0)),f<=c&&o.set(0,0,1),l.crossVectors(r[0],o).normalize(),i[0].crossVectors(r[0],l),a[0].crossVectors(r[0],i[0]);for(let p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),l.crossVectors(r[p-1],r[p]),l.length()>Number.EPSILON){l.normalize();const g=Math.acos(h0(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(l,g))}a[p].crossVectors(r[p],i[p])}if(n===!0){let p=Math.acos(h0(i[0].dot(i[e]),-1,1));p/=e,r[0].dot(l.crossVectors(i[0],i[e]))>0&&(p=-p);for(let g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],p*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}};class z2 extends $2{constructor(e=0,n=0,o=1,r=1,i=0,a=Math.PI*2,l=!1,s=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=o,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=l,this.aRotation=s}getPoint(e,n){const o=n||new Kt,r=Math.PI*2;let i=this.aEndAngle-this.aStartAngle;const a=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/i)+1)*i:s===0&&l===i-1&&(l=i-2,s=1);let c,u;this.closed||l>0?c=r[(l-1)%i]:(XB.subVectors(r[0],r[1]).add(r[0]),c=XB);const d=r[l%i],f=r[(l+1)%i];if(this.closed||l+2r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return o.set(A8e(l,s.x,c.x,u.x,d.x),A8e(l,s.y,c.y,u.y,d.y)),o}copy(e){super.copy(e),this.points=[];for(let n=0,o=e.points.length;n=o){const a=r[i]-o,l=this.curves[i],s=l.getLength(),c=s===0?0:1-a/s;return l.getPointAt(c,n)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let o=0,r=this.curves.length;o1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,o=e.curves.length;n0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class sW extends ji{constructor(e=[new Kt(0,-.5),new Kt(.5,0),new Kt(0,.5)],n=12,o=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:o,phiLength:r},n=Math.floor(n),r=h0(r,0,Math.PI*2);const i=[],a=[],l=[],s=[],c=[],u=1/n,d=new le,f=new Kt,p=new le,g=new le,A=new le;let y=0,S=0;for(let C=0;C<=e.length-1;C++)switch(C){case 0:y=e[C+1].x-e[C].x,S=e[C+1].y-e[C].y,p.x=S*1,p.y=-y,p.z=S*0,A.copy(p),p.normalize(),s.push(p.x,p.y,p.z);break;case e.length-1:s.push(A.x,A.y,A.z);break;default:y=e[C+1].x-e[C].x,S=e[C+1].y-e[C].y,p.x=S*1,p.y=-y,p.z=S*0,g.copy(p),p.x+=A.x,p.y+=A.y,p.z+=A.z,p.normalize(),s.push(p.x,p.y,p.z),A.copy(g)}for(let C=0;C<=n;C++){const P=o+C*u*r,v=Math.sin(P),T=Math.cos(P);for(let w=0;w<=e.length-1;w++){d.x=e[w].x*v,d.y=e[w].y,d.z=e[w].x*T,a.push(d.x,d.y,d.z),f.x=C/n,f.y=w/(e.length-1),l.push(f.x,f.y);const x=s[3*w+0]*v,b=s[3*w+1],R=s[3*w+0]*T;c.push(x,b,R)}}for(let C=0;C0&&P(!0),n>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new gr(d,3)),this.setAttribute("normal",new gr(f,3)),this.setAttribute("uv",new gr(p,2));function C(){const v=new le,T=new le;let w=0;const x=(n-e)/o;for(let b=0;b<=i;b++){const R=[],H=b/i,F=H*(n-e)+e;for(let E=0;E<=r;E++){const N=E/r,U=N*s+l,W=Math.sin(U),k=Math.cos(U);T.x=F*W,T.y=-H*o+y,T.z=F*k,d.push(T.x,T.y,T.z),v.set(W,x,k).normalize(),f.push(v.x,v.y,v.z),p.push(N,1-H),R.push(g++)}A.push(R)}for(let b=0;b.9&&x<.1&&(P<.2&&(a[C+0]+=1),v<.2&&(a[C+2]+=1),T<.2&&(a[C+4]+=1))}}function f(C){i.push(C.x,C.y,C.z)}function p(C,P){const v=C*3;P.x=e[v+0],P.y=e[v+1],P.z=e[v+2]}function g(){const C=new le,P=new le,v=new le,T=new le,w=new Kt,x=new Kt,b=new Kt;for(let R=0,H=0;R80*n){l=c=t[0],s=u=t[1];for(let g=n;gc&&(c=d),f>u&&(u=f);p=Math.max(c-l,u-s),p=p!==0?32767/p:0}return YF(i,a,n,l,s,p,0),a}};function eUe(t,e,n,o,r){let i,a;if(r===w9t(t,e,n,o)>0)for(i=e;i=e;i-=o)a=w8e(i,t[i],t[i+1],a);return a&&Hq(a,a.next)&&(VF(a),a=a.next),a}function Jx(t,e){if(!t)return t;e||(e=t);let n=t,o;do if(o=!1,!n.steiner&&(Hq(n,n.next)||n0(n.prev,n,n.next)===0)){if(VF(n),n=e=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==e);return e}function YF(t,e,n,o,r,i,a){if(!t)return;!a&&i&&h9t(t,o,r,i);let l=t,s,c;for(;t.prev!==t.next;){if(s=t.prev,c=t.next,i?i9t(t,o,r,i):r9t(t)){e.push(s.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),VF(t),t=c.next,l=c.next;continue}if(t=c,t===l){a?a===1?(t=a9t(Jx(t),e,n),YF(t,e,n,o,r,i,2)):a===2&&l9t(t,e,n,o,r,i):YF(Jx(t),e,n,o,r,i,1);break}}}function r9t(t){const e=t.prev,n=t,o=t.next;if(n0(e,n,o)>=0)return!1;const r=e.x,i=n.x,a=o.x,l=e.y,s=n.y,c=o.y,u=ri?r>a?r:a:i>a?i:a,p=l>s?l>c?l:c:s>c?s:c;let g=o.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=d&&g.y<=p&&QP(r,l,i,s,a,c,g.x,g.y)&&n0(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function i9t(t,e,n,o){const r=t.prev,i=t,a=t.next;if(n0(r,i,a)>=0)return!1;const l=r.x,s=i.x,c=a.x,u=r.y,d=i.y,f=a.y,p=ls?l>c?l:c:s>c?s:c,y=u>d?u>f?u:f:d>f?d:f,S=Cce(p,g,e,n,o),C=Cce(A,y,e,n,o);let P=t.prevZ,v=t.nextZ;for(;P&&P.z>=S&&v&&v.z<=C;){if(P.x>=p&&P.x<=A&&P.y>=g&&P.y<=y&&P!==r&&P!==a&&QP(l,u,s,d,c,f,P.x,P.y)&&n0(P.prev,P,P.next)>=0||(P=P.prevZ,v.x>=p&&v.x<=A&&v.y>=g&&v.y<=y&&v!==r&&v!==a&&QP(l,u,s,d,c,f,v.x,v.y)&&n0(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;P&&P.z>=S;){if(P.x>=p&&P.x<=A&&P.y>=g&&P.y<=y&&P!==r&&P!==a&&QP(l,u,s,d,c,f,P.x,P.y)&&n0(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;v&&v.z<=C;){if(v.x>=p&&v.x<=A&&v.y>=g&&v.y<=y&&v!==r&&v!==a&&QP(l,u,s,d,c,f,v.x,v.y)&&n0(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function a9t(t,e,n){let o=t;do{const r=o.prev,i=o.next.next;!Hq(r,i)&&tUe(r,o,o.next,i)&&OF(r,i)&&OF(i,r)&&(e.push(r.i/n|0),e.push(o.i/n|0),e.push(i.i/n|0),VF(o),VF(o.next),o=t=i),o=o.next}while(o!==t);return Jx(o)}function l9t(t,e,n,o,r,i){let a=t;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&m9t(a,l)){let s=nUe(a,l);a=Jx(a,a.next),s=Jx(s,s.next),YF(a,e,n,o,r,i,0),YF(s,e,n,o,r,i,0);return}l=l.next}a=a.next}while(a!==t)}function s9t(t,e,n,o){const r=[];let i,a,l,s,c;for(i=0,a=e.length;i=n.next.y&&n.next.y!==n.y){const f=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=i&&f>o&&(o=f,r=n.x=n.x&&n.x>=s&&i!==n.x&&QP(ar.x||n.x===r.x&&f9t(r,n)))&&(r=n,u=d)),n=n.next;while(n!==l);return r}function f9t(t,e){return n0(t.prev,t,e.prev)<0&&n0(e.next,t,t.next)<0}function h9t(t,e,n,o){let r=t;do r.z===0&&(r.z=Cce(r.x,r.y,e,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,p9t(r)}function p9t(t){let e,n,o,r,i,a,l,s,c=1;do{for(n=t,t=null,i=null,a=0;n;){for(a++,o=n,l=0,e=0;e0||s>0&&o;)l!==0&&(s===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,l--):(r=o,o=o.nextZ,s--),i?i.nextZ=r:t=r,r.prevZ=i,i=r;n=o}i.nextZ=null,c*=2}while(a>1);return t}function Cce(t,e,n,o,r){return t=(t-n)*r|0,e=(e-o)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function g9t(t){let e=t,n=t;do(e.x=(t-a)*(i-l)&&(t-a)*(o-l)>=(n-a)*(e-l)&&(n-a)*(i-l)>=(r-a)*(o-l)}function m9t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!y9t(t,e)&&(OF(t,e)&&OF(e,t)&&A9t(t,e)&&(n0(t.prev,t,e.prev)||n0(t,e.prev,e))||Hq(t,e)&&n0(t.prev,t,t.next)>0&&n0(e.prev,e,e.next)>0)}function n0(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Hq(t,e){return t.x===e.x&&t.y===e.y}function tUe(t,e,n,o){const r=QB(n0(t,e,n)),i=QB(n0(t,e,o)),a=QB(n0(n,o,t)),l=QB(n0(n,o,e));return!!(r!==i&&a!==l||r===0&&$B(t,n,e)||i===0&&$B(t,o,e)||a===0&&$B(n,t,o)||l===0&&$B(n,e,o))}function $B(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function QB(t){return t>0?1:t<0?-1:0}function y9t(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&tUe(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function OF(t,e){return n0(t.prev,t,t.next)<0?n0(t,e,t.next)>=0&&n0(t,t.prev,e)>=0:n0(t,e,t.prev)<0||n0(t,t.next,e)<0}function A9t(t,e){let n=t,o=!1;const r=(t.x+e.x)/2,i=(t.y+e.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==t);return o}function nUe(t,e){const n=new Rce(t.i,t.x,t.y),o=new Rce(e.i,e.x,e.y),r=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function w8e(t,e,n,o){const r=new Rce(t,e,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function VF(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Rce(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function w9t(t,e,n,o){let r=0;for(let i=e,a=n-o;i2&&t[e-1].equals(t[0])&&t.pop()}function x8e(t,e){for(let n=0;nNumber.EPSILON){const ue=Math.sqrt(De),he=Math.sqrt(Se*Se+Re*Re),ve=de.x-ge/ue,we=de.y+Te/ue,Pe=fe.x-Re/he,Ie=fe.y+Se/he,Me=((Pe-ve)*Re-(Ie-we)*Se)/(Te*Re-ge*Se);pe=ve+Te*Me-ee.x,ye=we+ge*Me-ee.y;const ze=pe*pe+ye*ye;if(ze<=2)return new Kt(pe,ye);ae=Math.sqrt(ze/2)}else{let ue=!1;Te>Number.EPSILON?Se>Number.EPSILON&&(ue=!0):Te<-Number.EPSILON?Se<-Number.EPSILON&&(ue=!0):Math.sign(ge)===Math.sign(Re)&&(ue=!0),ue?(pe=-ge,ye=Te,ae=Math.sqrt(De)):(pe=Te,ye=ge,ae=Math.sqrt(De/2))}return new Kt(pe/ae,ye/ae)}const j=[];for(let ee=0,de=U.length,fe=de-1,pe=ee+1;ee=0;ee--){const de=ee/y,fe=p*Math.cos(de*Math.PI/2),pe=g*Math.sin(de*Math.PI/2)+A;for(let ye=0,ae=U.length;ye=0;){const pe=fe;let ye=fe-1;ye<0&&(ye=ee.length-1);for(let ae=0,Te=u+y*2;ae0)&&p.push(P,v,w),(S!==o-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Z1e extends Tf{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new rr(16777215),this.specular=new rr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aUe extends Tf{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new rr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class lUe extends Tf{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class sUe extends Tf{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new rr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=oW,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class cUe extends Tf{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new rr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Iw,this.normalScale=new Kt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class uUe extends gp{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Wv(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function dUe(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fUe(t){function e(r,i){return t[r]-t[i]}const n=t.length,o=new Array(n);for(let r=0;r!==n;++r)o[r]=r;return o.sort(e),o}function Hce(t,e,n){const o=t.length,r=new t.constructor(o);for(let i=0,a=0;a!==o;++i){const l=n[i]*e;for(let s=0;s!==e;++s)r[a++]=t[l+s]}return r}function ege(t,e,n,o){let r=1,i=t[0];for(;i!==void 0&&i[o]===void 0;)i=t[r++];if(i===void 0)return;let a=i[o];if(a!==void 0)if(Array.isArray(a))do a=i[o],a!==void 0&&(e.push(i.time),n.push.apply(n,a)),i=t[r++];while(i!==void 0);else if(a.toArray!==void 0)do a=i[o],a!==void 0&&(e.push(i.time),a.toArray(n,n.length)),i=t[r++];while(i!==void 0);else do a=i[o],a!==void 0&&(e.push(i.time),n.push(a)),i=t[r++];while(i!==void 0)}function S9t(t,e,n,o,r=30){const i=t.clone();i.name=e;const a=[];for(let s=0;s=o)){d.push(c.times[p]);for(let A=0;Ai.tracks[s].times[0]&&(l=i.tracks[s].times[0]);for(let s=0;s=l.times[g]){const S=g*d+u,C=S+d-u;A=l.values.slice(S,C)}else{const S=l.createInterpolant(),C=u,P=d-u;S.evaluate(i),A=S.resultBuffer.slice(C,P)}s==="quaternion"&&new Ts().fromArray(A).normalize().conjugate().toArray(A);const y=c.times.length;for(let S=0;S=i)){const l=n[1];e=i)break t}a=o,o=0;break n}break e}for(;o>>1;en;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);const l=this.getValueSize();this.times=o.slice(i,a),this.values=this.values.slice(i*l,a*l)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const o=this.times,r=this.values,i=o.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==i;l++){const s=o[l];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,s,a),e=!1;break}a=s}if(r!==void 0&&dUe(r))for(let l=0,s=r.length;l!==s;++l){const c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),o=this.getValueSize(),r=this.getInterpolation()===EV,i=e.length-1;let a=1;for(let l=1;l0){e[a]=e[i];for(let l=i*o,s=a*o,c=0;c!==o;++c)n[s+c]=n[l+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*o)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),o=this.constructor,r=new o(this.name,e,n);return r.createInterpolant=this.createInterpolant,r}}Q2.prototype.TimeBufferType=Float32Array;Q2.prototype.ValueBufferType=Float32Array;Q2.prototype.DefaultInterpolation=DF;class Tb extends Q2{}Tb.prototype.ValueTypeName="bool";Tb.prototype.ValueBufferType=Array;Tb.prototype.DefaultInterpolation=zF;Tb.prototype.InterpolantFactoryMethodLinear=void 0;Tb.prototype.InterpolantFactoryMethodSmooth=void 0;class nge extends Q2{}nge.prototype.ValueTypeName="color";class _F extends Q2{}_F.prototype.ValueTypeName="number";class gUe extends dW{constructor(e,n,o,r){super(e,n,o,r)}interpolate_(e,n,o,r){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,s=(o-n)/(r-n);let c=e*l;for(let u=c+l;c!==u;c+=4)Ts.slerpFlat(i,0,a,c-l,a,c,s);return i}}class IH extends Q2{InterpolantFactoryMethodLinear(e){return new gUe(this.times,this.values,this.getValueSize(),e)}}IH.prototype.ValueTypeName="quaternion";IH.prototype.DefaultInterpolation=DF;IH.prototype.InterpolantFactoryMethodSmooth=void 0;class Pb extends Q2{}Pb.prototype.ValueTypeName="string";Pb.prototype.ValueBufferType=Array;Pb.prototype.DefaultInterpolation=zF;Pb.prototype.InterpolantFactoryMethodLinear=void 0;Pb.prototype.InterpolantFactoryMethodSmooth=void 0;class GF extends Q2{}GF.prototype.ValueTypeName="vector";class XF{constructor(e,n=-1,o,r=cq){this.name=e,this.tracks=o,this.duration=n,this.blendMode=r,this.uuid=bg(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],o=e.tracks,r=1/(e.fps||1);for(let a=0,l=o.length;a!==l;++a)n.push(R9t(o[a]).scale(r));const i=new this(e.name,e.duration,n,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const n=[],o=e.tracks,r={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let i=0,a=o.length;i!==a;++i)n.push(Q2.toJSON(o[i]));return r}static CreateFromMorphTargetSequence(e,n,o,r){const i=n.length,a=[];for(let l=0;l1){const d=u[1];let f=r[d];f||(r[d]=f=[]),f.push(c)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],n,o));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const o=function(d,f,p,g,A){if(p.length!==0){const y=[],S=[];ege(p,y,S,g),y.length!==0&&A.push(new d(f,y,S))}},r=[],i=e.name||"default",a=e.fps||30,l=e.blendMode;let s=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{n&&n(i),this.manager.itemEnd(e)},0),i;if(r6[e]!==void 0){r6[e].push({onLoad:n,onProgress:o,onError:r});return}r6[e]=[],r6[e].push({onLoad:n,onProgress:o,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,s=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=r6[e],d=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,g=p!==0;let A=0;const y=new ReadableStream({start(S){C();function C(){d.read().then(({done:P,value:v})=>{if(P)S.close();else{A+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:g,loaded:A,total:p});for(let w=0,x=u.length;w{switch(s){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,l));case"json":return c.json();default:if(l===void 0)return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(l),f=d&&d[1]?d[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{Kx.add(e,c);const u=r6[e];delete r6[e];for(let d=0,f=u.length;d{const u=r6[e];if(u===void 0)throw this.manager.itemError(e),c;delete r6[e];for(let d=0,f=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class M9t extends mp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new U9(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{n(i.parse(JSON.parse(l)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},o,r)}parse(e){const n=[];for(let o=0;o0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const i in e.uniforms){const a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=o(a.value);break;case"c":r.uniforms[i].value=new rr().setHex(a.value);break;case"v2":r.uniforms[i].value=new Kt().fromArray(a.value);break;case"v3":r.uniforms[i].value=new le().fromArray(a.value);break;case"v4":r.uniforms[i].value=new qa().fromArray(a.value);break;case"m3":r.uniforms[i].value=new ha().fromArray(a.value);break;case"m4":r.uniforms[i].value=new Ki().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const i in e.extensions)r.extensions[i]=e.extensions[i];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=o(e.map)),e.matcap!==void 0&&(r.matcap=o(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=o(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=o(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=o(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let i=e.normalScale;Array.isArray(i)===!1&&(i=[i,i]),r.normalScale=new Kt().fromArray(i)}return e.displacementMap!==void 0&&(r.displacementMap=o(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=o(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=o(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=o(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=o(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=o(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=o(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=o(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=o(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=o(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=o(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=o(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=o(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=o(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Kt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=o(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=o(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=o(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=o(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=o(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=o(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=o(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:oUe,SpriteMaterial:wq,RawShaderMaterial:rUe,ShaderMaterial:O2,PointsMaterial:G1e,MeshPhysicalMaterial:iUe,MeshStandardMaterial:pf,MeshPhongMaterial:Z1e,MeshToonMaterial:aUe,MeshNormalMaterial:lUe,MeshLambertMaterial:sUe,MeshDepthMaterial:pq,MeshDistanceMaterial:gq,MeshBasicMaterial:t3,MeshMatcapMaterial:cUe,LineDashedMaterial:uUe,LineBasicMaterial:gp,Material:Tf};return new n[e]}}class Mce{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let o=0,r=e.length;o0){const s=new oge(n);i=new JF(s),i.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new JF(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,o,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,a=Kx.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){n&&n(a),i.manager.itemEnd(e)},0),a;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(s){return s.blob()}).then(function(s){return createImageBitmap(s,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(s){Kx.add(e,s),n&&n(s),i.manager.itemEnd(e)}).catch(function(s){r&&r(s),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}let ZB;class ige{static getContext(){return ZB===void 0&&(ZB=new(window.AudioContext||window.webkitAudioContext)),ZB}static setContext(e){ZB=e}}class U9t extends mp{constructor(e){super(e)}load(e,n,o,r){const i=this,a=new U9(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(s){try{const c=s.slice(0);ige.getContext().decodeAudioData(c,function(d){n(d)},l)}catch(c){l(c)}},o,r);function l(s){r?r(s):console.error(s),i.manager.itemError(e)}}}const M8e=new Ki,I8e=new Ki,B7=new Ki;class j9t{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zu,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zu,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,B7.copy(e.projectionMatrix);const r=n.eyeSep/2,i=r*n.near/n.focus,a=n.near*Math.tan(dx*n.fov*.5)/n.zoom;let l,s;I8e.elements[12]=-r,M8e.elements[12]=r,l=-a*n.aspect+i,s=a*n.aspect+i,B7.elements[0]=2*n.near/(s-l),B7.elements[8]=(s+l)/(s-l),this.cameraL.projectionMatrix.copy(B7),l=-a*n.aspect-i,s=a*n.aspect-i,B7.elements[0]=2*n.near/(s-l),B7.elements[8]=(s+l)/(s-l),this.cameraR.projectionMatrix.copy(B7)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(I8e),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(M8e)}}class age{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=z8e(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=z8e();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function z8e(){return(typeof performance>"u"?Date:performance).now()}const Y7=new le,D8e=new Ts,B9t=new le,O7=new le;class Y9t extends Ul{constructor(){super(),this.type="AudioListener",this.context=ige.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new age}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,o=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Y7,D8e,B9t),O7.set(0,0,-1).applyQuaternion(D8e),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Y7.x,r),n.positionY.linearRampToValueAtTime(Y7.y,r),n.positionZ.linearRampToValueAtTime(Y7.z,r),n.forwardX.linearRampToValueAtTime(O7.x,r),n.forwardY.linearRampToValueAtTime(O7.y,r),n.forwardZ.linearRampToValueAtTime(O7.z,r),n.upX.linearRampToValueAtTime(o.x,r),n.upY.linearRampToValueAtTime(o.y,r),n.upZ.linearRampToValueAtTime(o.z,r)}else n.setPosition(Y7.x,Y7.y,Y7.z),n.setOrientation(O7.x,O7.y,O7.z,o.x,o.y,o.z)}}class CUe extends Ul{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(o,r,this._addIndex*n,1,n);for(let s=n,c=n+n;s!==c;++s)if(o[s]!==o[s+n]){l.setValue(o,r);break}}saveOriginalState(){const e=this.binding,n=this.buffer,o=this.valueSize,r=o*this._origIndex;e.getValue(n,r);for(let i=o,a=r;i!==a;++i)n[i]=n[r+i%o];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let o=e;o=.5)for(let a=0;a!==i;++a)e[n+a]=e[o+a]}_slerp(e,n,o,r){Ts.slerpFlat(e,n,e,n,e,o,r)}_slerpAdditive(e,n,o,r,i){const a=this._workIndex*i;Ts.multiplyQuaternionsFlat(e,a,e,n,e,o),Ts.slerpFlat(e,n,e,n,e,a,r)}_lerp(e,n,o,r,i){const a=1-r;for(let l=0;l!==i;++l){const s=n+l;e[s]=e[s]*a+e[o+l]*r}}_lerpAdditive(e,n,o,r,i){for(let a=0;a!==i;++a){const l=n+a;e[l]=e[l]+e[o+a]*r}}}const lge="\\[\\]\\.:\\/",G9t=new RegExp("["+lge+"]","g"),sge="[^"+lge+"]",X9t="[^"+lge.replace("\\.","")+"]",J9t=/((?:WC+[\/:])*)/.source.replace("WC",sge),K9t=/(WCOD+)?/.source.replace("WCOD",X9t),q9t=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sge),$9t=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sge),Q9t=new RegExp("^"+J9t+K9t+q9t+$9t+"$"),Z9t=["material","materials","bones","map"];class e3t{constructor(e,n,o){const r=o||Cl.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,r)}getValue(e,n){this.bind();const o=this._targetGroup.nCachedObjects_,r=this._bindings[o];r!==void 0&&r.getValue(e,n)}setValue(e,n){const o=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=o.length;r!==i;++r)o[r].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,o=e.length;n!==o;++n)e[n].unbind()}}class Cl{constructor(e,n,o){this.path=n,this.parsedPath=o||Cl.parseTrackName(n),this.node=Cl.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,o){return e&&e.isAnimationObjectGroup?new Cl.Composite(e,n,o):new Cl(e,n,o)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(G9t,"")}static parseTrackName(e){const n=Q9t.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const o={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=o.nodeName&&o.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const i=o.nodeName.substring(r+1);Z9t.indexOf(i)!==-1&&(o.nodeName=o.nodeName.substring(0,r),o.objectName=i)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return o}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const o=e.skeleton.getBoneByName(n);if(o!==void 0)return o}if(e.children){const o=function(i){for(let a=0;a=i){const d=i++,f=e[d];n[f.uuid]=u,e[u]=f,n[c]=d,e[d]=s;for(let p=0,g=r;p!==g;++p){const A=o[p],y=A[d],S=A[u];A[u]=y,A[d]=S}}}this.nCachedObjects_=i}uncache(){const e=this._objects,n=this._indicesByUUID,o=this._bindings,r=o.length;let i=this.nCachedObjects_,a=e.length;for(let l=0,s=arguments.length;l!==s;++l){const c=arguments[l],u=c.uuid,d=n[u];if(d!==void 0)if(delete n[u],d0&&(n[p.uuid]=d),e[d]=p,e.pop();for(let g=0,A=r;g!==A;++g){const y=o[g];y[d]=y[f],y.pop()}}}this.nCachedObjects_=i}subscribe_(e,n){const o=this._bindingsIndicesByPath;let r=o[e];const i=this._bindings;if(r!==void 0)return i[r];const a=this._paths,l=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,d=new Array(c);r=i.length,o[e]=r,a.push(e),l.push(n),i.push(d);for(let f=u,p=s.length;f!==p;++f){const g=s[f];d[f]=new Cl(g,e,n)}return d}unsubscribe_(e){const n=this._bindingsIndicesByPath,o=n[e];if(o!==void 0){const r=this._paths,i=this._parsedPaths,a=this._bindings,l=a.length-1,s=a[l],c=e[l];n[c]=o,a[o]=s,a.pop(),i[o]=i[l],i.pop(),r[o]=r[l],r.pop()}}}class HUe{constructor(e,n,o=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=o,this.blendMode=r;const i=n.tracks,a=i.length,l=new Array(a),s={endingStart:Fv,endingEnd:Fv};for(let c=0;c!==a;++c){const u=i[c].createInterpolant(null);l[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=pNe,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,o){if(e.fadeOut(n),this.fadeIn(n),o){const r=this._clip.duration,i=e._clip.duration,a=i/r,l=r/i;e.warp(1,a,n),this.warp(l,1,n)}return this}crossFadeTo(e,n,o){return e.crossFadeFrom(this,n,o)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,o){const r=this._mixer,i=r.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const s=l.parameterPositions,c=l.sampleValues;return s[0]=i,s[1]=i+o,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,o,r){if(!this.enabled){this._updateWeight(e);return}const i=this._startTime;if(i!==null){const s=(e-i)*o;s<0||o===0?n=0:(this._startTime=null,n=o*s)}n*=this._updateTimeScale(e);const a=this._updateTime(n),l=this._updateWeight(e);if(l>0){const s=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case E1e:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulateAdditive(l);break;case cq:default:for(let u=0,d=s.length;u!==d;++u)s[u].evaluate(a),c[u].accumulate(r,l)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const o=this._weightInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const o=this._timeScaleInterpolant;if(o!==null){const r=o.evaluate(e)[0];n*=r,e>o.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,o=this.loop;let r=this.time+e,i=this._loopCount;const a=o===gNe;if(e===0)return i===-1?r:a&&(i&1)===1?n-r:r;if(o===hNe){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=n||r<0){const l=Math.floor(r/n);r-=n*l,i+=Math.abs(l);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(a&&(i&1)===1)return n-r}return r}_setEndings(e,n,o){const r=this._interpolantSettings;o?(r.endingStart=kv,r.endingEnd=kv):(e?r.endingStart=this.zeroSlopeAtStart?kv:Fv:r.endingStart=EF,n?r.endingEnd=this.zeroSlopeAtEnd?kv:Fv:r.endingEnd=EF)}_scheduleFading(e,n,o){const r=this._mixer,i=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,s=a.sampleValues;return l[0]=i,s[0]=n,l[1]=i+e,s[1]=o,this}}const n3t=new Float32Array(1);class o3t extends e3{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const o=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,l=e._interpolants,s=o.uuid,c=this._bindingsByRootAndName;let u=c[s];u===void 0&&(u={},c[s]=u);for(let d=0;d!==i;++d){const f=r[d],p=f.name;let g=u[p];if(g!==void 0)++g.referenceCount,a[d]=g;else{if(g=a[d],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,s,p));continue}const A=n&&n._propertyBindings[d].binding.parsedPath;g=new RUe(Cl.create(o,p,A),f.ValueTypeName,f.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,s,p),a[d]=g}l[d].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const o=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,o)}const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];i.useCount++===0&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let o=0,r=n.length;o!==r;++o){const i=n[o];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--o)e[o].stop();return this}update(e){e*=this.timeScale;const n=this._actions,o=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==o;++c)n[c]._update(r,e,i,a);const l=this._bindings,s=this._nActiveBindings;for(let c=0;c!==s;++c)l[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,k8e).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const L8e=new le,eY=new le;class uge{constructor(e=new le,n=new le){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){L8e.subVectors(e,this.start),eY.subVectors(this.end,this.start);const o=eY.dot(eY);let i=eY.dot(L8e)/o;return n&&(i=h0(i,0,1)),i}closestPointToPoint(e,n,o){const r=this.closestPointToPointParameter(e,n);return this.delta(o).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const W8e=new le;class c3t extends Ul{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const o=new ji,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,s=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Y8e.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Y8e,n)}}setLength(e,n=e*.2,o=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(o,n,o),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class b3t extends o3{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new ji;r.setAttribute("position",new gr(n,3)),r.setAttribute("color",new gr(o,3));const i=new gp({vertexColors:!0,toneMapped:!1});super(r,i),this.type="AxesHelper"}setColors(e,n,o){const r=new rr,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(n),r.toArray(i,6),r.toArray(i,9),r.set(o),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class IUe{constructor(){this.type="ShapePath",this.color=new rr,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new BF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,o,r){return this.currentPath.quadraticCurveTo(e,n,o,r),this}bezierCurveTo(e,n,o,r,i,a){return this.currentPath.bezierCurveTo(e,n,o,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(S){const C=[];for(let P=0,v=S.length;PNumber.EPSILON){if(H<0&&(x=C[w],R=-R,b=C[T],H=-H),S.yb.y)continue;if(S.y===x.y){if(S.x===x.x)return!0}else{const F=H*(S.x-x.x)-R*(S.y-x.y);if(F===0)return!0;if(F<0)continue;v=!v}}else{if(S.y!==x.y)continue;if(b.x<=S.x&&S.x<=x.x||x.x<=S.x&&S.x<=b.x)return!0}}return v}const r=C9.isClockWise,i=this.subPaths;if(i.length===0)return[];let a,l,s;const c=[];if(i.length===1)return l=i[0],s=new kl,s.curves=l.curves,c.push(s),c;let u=!r(i[0].getPoints());u=e?!u:u;const d=[],f=[];let p=[],g=0,A;f[g]=void 0,p[g]=[];for(let S=0,C=i.length;S1){let S=!1,C=0;for(let P=0,v=f.length;P0&&S===!1&&(p=d)}let y;for(let S=0,C=f.length;SPn||Xe[rn]!==mt[Pn]){var Zn=` -`+Xe[rn].replace(" at new "," at ");return J.displayName&&Zn.includes("")&&(Zn=Zn.replace("",J.displayName)),Zn}while(1<=rn&&0<=Pn);break}}}finally{zt=!1,Error.prepareStackTrace=xe}return(J=J?J.displayName||J.name:"")?bt(J):""}var tt=Object.prototype.hasOwnProperty,Ht=[],_t=-1;function qt(J){return{current:J}}function un(J){0>_t||(J.current=Ht[_t],Ht[_t]=null,_t--)}function Rn(J,K){_t++,Ht[_t]=J.current,J.current=K}var yo={},Ao=qt(yo),wo=qt(!1),Io=yo;function po(J,K){var xe=J.type.contextTypes;if(!xe)return yo;var Fe=J.stateNode;if(Fe&&Fe.__reactInternalMemoizedUnmaskedChildContext===K)return Fe.__reactInternalMemoizedMaskedChildContext;var Xe={},mt;for(mt in xe)Xe[mt]=K[mt];return Fe&&(J=J.stateNode,J.__reactInternalMemoizedUnmaskedChildContext=K,J.__reactInternalMemoizedMaskedChildContext=Xe),Xe}function On(J){return J=J.childContextTypes,J!=null}function fo(){un(wo),un(Ao)}function ir(J,K,xe){if(Ao.current!==yo)throw Error(a(168));Rn(Ao,K),Rn(wo,xe)}function Rr(J,K,xe){var Fe=J.stateNode;if(K=K.childContextTypes,typeof Fe.getChildContext!="function")return xe;Fe=Fe.getChildContext();for(var Xe in Fe)if(!(Xe in K))throw Error(a(108,b(J)||"Unknown",Xe));return i({},xe,Fe)}function br(J){return J=(J=J.stateNode)&&J.__reactInternalMemoizedMergedChildContext||yo,Io=Ao.current,Rn(Ao,J),Rn(wo,wo.current),!0}function _r(J,K,xe){var Fe=J.stateNode;if(!Fe)throw Error(a(169));xe?(J=Rr(J,K,Io),Fe.__reactInternalMemoizedMergedChildContext=J,un(wo),un(Ao),Rn(Ao,J)):un(wo),Rn(wo,xe)}var jo=Math.clz32?Math.clz32:ar,wn=Math.log,In=Math.LN2;function ar(J){return J>>>=0,J===0?32:31-(wn(J)/In|0)|0}var Wo=64,to=4194304;function Bn(J){switch(J&-J){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return J&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return J&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return J}}function Ko(J,K){var xe=J.pendingLanes;if(xe===0)return 0;var Fe=0,Xe=J.suspendedLanes,mt=J.pingedLanes,rn=xe&268435455;if(rn!==0){var Pn=rn&~Xe;Pn!==0?Fe=Bn(Pn):(mt&=rn,mt!==0&&(Fe=Bn(mt)))}else rn=xe&~Xe,rn!==0?Fe=Bn(rn):mt!==0&&(Fe=Bn(mt));if(Fe===0)return 0;if(K!==0&&K!==Fe&&!(K&Xe)&&(Xe=Fe&-Fe,mt=K&-K,Xe>=mt||Xe===16&&(mt&4194240)!==0))return K;if(Fe&4&&(Fe|=xe&16),K=J.entangledLanes,K!==0)for(J=J.entanglements,K&=Fe;0xe;xe++)K.push(J);return K}function fr(J,K,xe){J.pendingLanes|=K,K!==536870912&&(J.suspendedLanes=0,J.pingedLanes=0),J=J.eventTimes,K=31-jo(K),J[K]=xe}function ei(J,K){var xe=J.pendingLanes&~K;J.pendingLanes=K,J.suspendedLanes=0,J.pingedLanes=0,J.expiredLanes&=K,J.mutableReadLanes&=K,J.entangledLanes&=K,K=J.entanglements;var Fe=J.eventTimes;for(J=J.expirationTimes;0>=rn,Xe-=rn,m1=1<<32-jo(K)+Xe|xe<ra?(Ba=Vi,Vi=null):Ba=Vi.sibling;var Pa=Xr(Fn,Vi,_n[ra],xr);if(Pa===null){Vi===null&&(Vi=Ba);break}J&&Vi&&Pa.alternate===null&&K(Fn,Vi),Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa,Vi=Ba}if(ra===_n.length)return xe(Fn,Vi),xl&&Ih(Fn,ra),Fr;if(Vi===null){for(;ra<_n.length;ra++)Vi=Ei(Fn,_n[ra],xr),Vi!==null&&(Mn=mt(Vi,Mn,ra),Zi===null?Fr=Vi:Zi.sibling=Vi,Zi=Vi);return xl&&Ih(Fn,ra),Fr}for(Vi=Fe(Fn,Vi);ra<_n.length;ra++)Ba=pl(Vi,Fn,ra,_n[ra],xr),Ba!==null&&(J&&Ba.alternate!==null&&Vi.delete(Ba.key===null?ra:Ba.key),Mn=mt(Ba,Mn,ra),Zi===null?Fr=Ba:Zi.sibling=Ba,Zi=Ba);return J&&Vi.forEach(function(Mp){return K(Fn,Mp)}),xl&&Ih(Fn,ra),Fr}function S0(Fn,Mn,_n,xr){var Fr=w(_n);if(typeof Fr!="function")throw Error(a(150));if(_n=Fr.call(_n),_n==null)throw Error(a(151));for(var Zi=Fr=null,Vi=Mn,ra=Mn=0,Ba=null,Pa=_n.next();Vi!==null&&!Pa.done;ra++,Pa=_n.next()){Vi.index>ra?(Ba=Vi,Vi=null):Ba=Vi.sibling;var Mp=Xr(Fn,Vi,Pa.value,xr);if(Mp===null){Vi===null&&(Vi=Ba);break}J&&Vi&&Mp.alternate===null&&K(Fn,Vi),Mn=mt(Mp,Mn,ra),Zi===null?Fr=Mp:Zi.sibling=Mp,Zi=Mp,Vi=Ba}if(Pa.done)return xe(Fn,Vi),xl&&Ih(Fn,ra),Fr;if(Vi===null){for(;!Pa.done;ra++,Pa=_n.next())Pa=Ei(Fn,Pa.value,xr),Pa!==null&&(Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa);return xl&&Ih(Fn,ra),Fr}for(Vi=Fe(Fn,Vi);!Pa.done;ra++,Pa=_n.next())Pa=pl(Vi,Fn,ra,Pa.value,xr),Pa!==null&&(J&&Pa.alternate!==null&&Vi.delete(Pa.key===null?ra:Pa.key),Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa);return J&&Vi.forEach(function(a4){return K(Fn,a4)}),xl&&Ih(Fn,ra),Fr}function Kd(Fn,Mn,_n,xr){if(typeof _n=="object"&&_n!==null&&_n.type===u&&_n.key===null&&(_n=_n.props.children),typeof _n=="object"&&_n!==null){switch(_n.$$typeof){case s:e:{for(var Fr=_n.key,Zi=Mn;Zi!==null;){if(Zi.key===Fr){if(Fr=_n.type,Fr===u){if(Zi.tag===7){xe(Fn,Zi.sibling),Mn=Xe(Zi,_n.props.children),Mn.return=Fn,Fn=Mn;break e}}else if(Zi.elementType===Fr||typeof Fr=="object"&&Fr!==null&&Fr.$$typeof===P&&R3(Fr)===Zi.type){xe(Fn,Zi.sibling),Mn=Xe(Zi,_n.props),Mn.ref=g5(Fn,Zi,_n),Mn.return=Fn,Fn=Mn;break e}xe(Fn,Zi);break}else K(Fn,Zi);Zi=Zi.sibling}_n.type===u?(Mn=am(_n.props.children,Fn.mode,xr,_n.key),Mn.return=Fn,Fn=Mn):(xr=Wy(_n.type,_n.key,_n.props,null,Fn.mode,xr),xr.ref=g5(Fn,Mn,_n),xr.return=Fn,Fn=xr)}return rn(Fn);case c:e:{for(Zi=_n.key;Mn!==null;){if(Mn.key===Zi)if(Mn.tag===4&&Mn.stateNode.containerInfo===_n.containerInfo&&Mn.stateNode.implementation===_n.implementation){xe(Fn,Mn.sibling),Mn=Xe(Mn,_n.children||[]),Mn.return=Fn,Fn=Mn;break e}else{xe(Fn,Mn);break}else K(Fn,Mn);Mn=Mn.sibling}Mn=Jd(_n,Fn.mode,xr),Mn.return=Fn,Fn=Mn}return rn(Fn);case P:return Zi=_n._init,Kd(Fn,Mn,Zi(_n._payload),xr)}if(W(_n))return Vr(Fn,Mn,_n,xr);if(w(_n))return S0(Fn,Mn,_n,xr);Dh(Fn,_n)}return typeof _n=="string"&&_n!==""||typeof _n=="number"?(_n=""+_n,Mn!==null&&Mn.tag===6?(xe(Fn,Mn.sibling),Mn=Xe(Mn,_n),Mn.return=Fn,Fn=Mn):(xe(Fn,Mn),Mn=b0(_n,Fn.mode,xr),Mn.return=Fn,Fn=Mn),rn(Fn)):xe(Fn,Mn)}return Kd}var jd=Vg(!0),r7=Vg(!1),Gc={},ys=qt(Gc),xy=qt(Gc),by=qt(Gc);function vu(J){if(J===Gc)throw Error(a(174));return J}function i7(J,K){Rn(by,K),Rn(xy,J),Rn(ys,Gc),J=D(K),un(ys),Rn(ys,J)}function Sy(){un(ys),un(xy),un(by)}function wS(J){var K=vu(by.current),xe=vu(ys.current);K=L(xe,J.type,K),xe!==K&&(Rn(xy,J),Rn(ys,K))}function Sp(J){xy.current===J&&(un(ys),un(xy))}var vn=qt(0);function ao(J){for(var K=J;K!==null;){if(K.tag===13){var xe=K.memoizedState;if(xe!==null&&(xe=xe.dehydrated,xe===null||vt(xe)||Rt(xe)))return K}else if(K.tag===19&&K.memoizedProps.revealOrder!==void 0){if(K.flags&128)return K}else if(K.child!==null){K.child.return=K,K=K.child;continue}if(K===J)break;for(;K.sibling===null;){if(K.return===null||K.return===J)return null;K=K.return}K.sibling.return=K.return,K=K.sibling}return null}var Nn=[];function Sr(){for(var J=0;Jxe?xe:4,J(!0);var Fe=Oi.transition;Oi.transition={};try{J(!1),K()}finally{tr=xe,Oi.transition=Fe}}function l7(){return Ns().memoizedState}function Jc(J,K,xe){var Fe=kf(J);xe={lane:Fe,action:xe,hasEagerState:!1,eagerState:null,next:null},s7(J)?FA(K,xe):(z3(J,K,xe),xe=v0(),J=cd(J,Fe,xe),J!==null&&kA(J,K,Fe))}function G0(J,K,xe){var Fe=kf(J),Xe={lane:Fe,action:xe,hasEagerState:!1,eagerState:null,next:null};if(s7(J))FA(K,Xe);else{z3(J,K,Xe);var mt=J.alternate;if(J.lanes===0&&(mt===null||mt.lanes===0)&&(mt=K.lastRenderedReducer,mt!==null))try{var rn=K.lastRenderedState,Pn=mt(rn,xe);if(Xe.hasEagerState=!0,Xe.eagerState=Pn,Vl(Pn,rn))return}catch{}finally{}xe=v0(),J=cd(J,Fe,xe),J!==null&&kA(J,K,Fe)}}function s7(J){var K=J.alternate;return J===Ti||K!==null&&K===Ti}function FA(J,K){_g=_0=!0;var xe=J.pending;xe===null?K.next=K:(K.next=xe.next,xe.next=K),J.pending=K}function z3(J,K,xe){Ic!==null&&J.mode&1&&!(Hi&2)?(J=K.interleaved,J===null?(xe.next=xe,Yn===null?Yn=[K]:Yn.push(K)):(xe.next=J.next,J.next=xe),K.interleaved=xe):(J=K.pending,J===null?xe.next=xe:(xe.next=J.next,J.next=xe),K.pending=xe)}function kA(J,K,xe){if(xe&4194240){var Fe=K.lanes;Fe&=J.pendingLanes,xe|=Fe,K.lanes=xe,hr(J,xe)}}var Hr={readContext:Ln,useCallback:Ws,useContext:Ws,useEffect:Ws,useImperativeHandle:Ws,useInsertionEffect:Ws,useLayoutEffect:Ws,useMemo:Ws,useReducer:Ws,useRef:Ws,useState:Ws,useDebugValue:Ws,useDeferredValue:Ws,useTransition:Ws,useMutableSource:Ws,useSyncExternalStore:Ws,useId:Ws,unstable_isNewReconciler:!1},Kc={readContext:Ln,useCallback:function(J,K){return Rc().memoizedState=[J,K===void 0?null:K],J},useContext:Ln,useEffect:Tp,useImperativeHandle:function(J,K,xe){return xe=xe!=null?xe.concat([J]):null,Bd(4194308,4,T5.bind(null,K,J),xe)},useLayoutEffect:function(J,K){return Bd(4194308,4,J,K)},useInsertionEffect:function(J,K){return Bd(4,2,J,K)},useMemo:function(J,K){var xe=Rc();return K=K===void 0?null:K,J=J(),xe.memoizedState=[J,K],J},useReducer:function(J,K,xe){var Fe=Rc();return K=xe!==void 0?xe(K):K,Fe.memoizedState=Fe.baseState=K,J={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:J,lastRenderedState:K},Fe.queue=J,J=J.dispatch=Jc.bind(null,Ti,J),[Fe.memoizedState,J]},useRef:function(J){var K=Rc();return J={current:J},K.memoizedState=J},useState:x5,useDebugValue:Df,useDeferredValue:function(J){var K=x5(J),xe=K[0],Fe=K[1];return Tp(function(){var Xe=Oi.transition;Oi.transition={};try{Fe(J)}finally{Oi.transition=Xe}},[J]),xe},useTransition:function(){var J=x5(!1),K=J[0];return J=I3.bind(null,J[1]),Rc().memoizedState=J,[K,J]},useMutableSource:function(){},useSyncExternalStore:function(J,K,xe){var Fe=Ti,Xe=Rc();if(xl){if(xe===void 0)throw Error(a(407));xe=xe()}else{if(xe=K(),Ic===null)throw Error(a(349));cs&30||v5(Fe,K,xe)}Xe.memoizedState=xe;var mt={value:xe,getSnapshot:K};return Xe.queue=mt,Tp(tc.bind(null,Fe,mt,J),[J]),Fe.flags|=2048,nd(9,Xg.bind(null,Fe,mt,xe,K),void 0,null),xe},useId:function(){var J=Rc(),K=Ic.identifierPrefix;if(xl){var xe=V0,Fe=m1;xe=(Fe&~(1<<32-jo(Fe)-1)).toString(32)+xe,K=":"+K+"R"+xe,xe=H3++,0")&&(Zn=Zn.replace("",J.displayName)),Zn}while(1<=rn&&0<=Pn);break}}}finally{zt=!1,Error.prepareStackTrace=xe}return(J=J?J.displayName||J.name:"")?bt(J):""}var tt=Object.prototype.hasOwnProperty,Ht=[],_t=-1;function qt(J){return{current:J}}function un(J){0>_t||(J.current=Ht[_t],Ht[_t]=null,_t--)}function Rn(J,K){_t++,Ht[_t]=J.current,J.current=K}var yo={},Ao=qt(yo),wo=qt(!1),Io=yo;function po(J,K){var xe=J.type.contextTypes;if(!xe)return yo;var Fe=J.stateNode;if(Fe&&Fe.__reactInternalMemoizedUnmaskedChildContext===K)return Fe.__reactInternalMemoizedMaskedChildContext;var Xe={},mt;for(mt in xe)Xe[mt]=K[mt];return Fe&&(J=J.stateNode,J.__reactInternalMemoizedUnmaskedChildContext=K,J.__reactInternalMemoizedMaskedChildContext=Xe),Xe}function On(J){return J=J.childContextTypes,J!=null}function fo(){un(wo),un(Ao)}function ir(J,K,xe){if(Ao.current!==yo)throw Error(a(168));Rn(Ao,K),Rn(wo,xe)}function Rr(J,K,xe){var Fe=J.stateNode;if(K=K.childContextTypes,typeof Fe.getChildContext!="function")return xe;Fe=Fe.getChildContext();for(var Xe in Fe)if(!(Xe in K))throw Error(a(108,b(J)||"Unknown",Xe));return i({},xe,Fe)}function br(J){return J=(J=J.stateNode)&&J.__reactInternalMemoizedMergedChildContext||yo,Io=Ao.current,Rn(Ao,J),Rn(wo,wo.current),!0}function _r(J,K,xe){var Fe=J.stateNode;if(!Fe)throw Error(a(169));xe?(J=Rr(J,K,Io),Fe.__reactInternalMemoizedMergedChildContext=J,un(wo),un(Ao),Rn(Ao,J)):un(wo),Rn(wo,xe)}var jo=Math.clz32?Math.clz32:ar,wn=Math.log,In=Math.LN2;function ar(J){return J>>>=0,J===0?32:31-(wn(J)/In|0)|0}var Wo=64,to=4194304;function Bn(J){switch(J&-J){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return J&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return J&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return J}}function Ko(J,K){var xe=J.pendingLanes;if(xe===0)return 0;var Fe=0,Xe=J.suspendedLanes,mt=J.pingedLanes,rn=xe&268435455;if(rn!==0){var Pn=rn&~Xe;Pn!==0?Fe=Bn(Pn):(mt&=rn,mt!==0&&(Fe=Bn(mt)))}else rn=xe&~Xe,rn!==0?Fe=Bn(rn):mt!==0&&(Fe=Bn(mt));if(Fe===0)return 0;if(K!==0&&K!==Fe&&!(K&Xe)&&(Xe=Fe&-Fe,mt=K&-K,Xe>=mt||Xe===16&&(mt&4194240)!==0))return K;if(Fe&4&&(Fe|=xe&16),K=J.entangledLanes,K!==0)for(J=J.entanglements,K&=Fe;0xe;xe++)K.push(J);return K}function fr(J,K,xe){J.pendingLanes|=K,K!==536870912&&(J.suspendedLanes=0,J.pingedLanes=0),J=J.eventTimes,K=31-jo(K),J[K]=xe}function ei(J,K){var xe=J.pendingLanes&~K;J.pendingLanes=K,J.suspendedLanes=0,J.pingedLanes=0,J.expiredLanes&=K,J.mutableReadLanes&=K,J.entangledLanes&=K,K=J.entanglements;var Fe=J.eventTimes;for(J=J.expirationTimes;0>=rn,Xe-=rn,m1=1<<32-jo(K)+Xe|xe<ra?(Ba=Vi,Vi=null):Ba=Vi.sibling;var Pa=Xr(Fn,Vi,_n[ra],xr);if(Pa===null){Vi===null&&(Vi=Ba);break}J&&Vi&&Pa.alternate===null&&K(Fn,Vi),Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa,Vi=Ba}if(ra===_n.length)return xe(Fn,Vi),xl&&Ih(Fn,ra),Fr;if(Vi===null){for(;ra<_n.length;ra++)Vi=Ei(Fn,_n[ra],xr),Vi!==null&&(Mn=mt(Vi,Mn,ra),Zi===null?Fr=Vi:Zi.sibling=Vi,Zi=Vi);return xl&&Ih(Fn,ra),Fr}for(Vi=Fe(Fn,Vi);ra<_n.length;ra++)Ba=pl(Vi,Fn,ra,_n[ra],xr),Ba!==null&&(J&&Ba.alternate!==null&&Vi.delete(Ba.key===null?ra:Ba.key),Mn=mt(Ba,Mn,ra),Zi===null?Fr=Ba:Zi.sibling=Ba,Zi=Ba);return J&&Vi.forEach(function(Mp){return K(Fn,Mp)}),xl&&Ih(Fn,ra),Fr}function S0(Fn,Mn,_n,xr){var Fr=w(_n);if(typeof Fr!="function")throw Error(a(150));if(_n=Fr.call(_n),_n==null)throw Error(a(151));for(var Zi=Fr=null,Vi=Mn,ra=Mn=0,Ba=null,Pa=_n.next();Vi!==null&&!Pa.done;ra++,Pa=_n.next()){Vi.index>ra?(Ba=Vi,Vi=null):Ba=Vi.sibling;var Mp=Xr(Fn,Vi,Pa.value,xr);if(Mp===null){Vi===null&&(Vi=Ba);break}J&&Vi&&Mp.alternate===null&&K(Fn,Vi),Mn=mt(Mp,Mn,ra),Zi===null?Fr=Mp:Zi.sibling=Mp,Zi=Mp,Vi=Ba}if(Pa.done)return xe(Fn,Vi),xl&&Ih(Fn,ra),Fr;if(Vi===null){for(;!Pa.done;ra++,Pa=_n.next())Pa=Ei(Fn,Pa.value,xr),Pa!==null&&(Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa);return xl&&Ih(Fn,ra),Fr}for(Vi=Fe(Fn,Vi);!Pa.done;ra++,Pa=_n.next())Pa=pl(Vi,Fn,ra,Pa.value,xr),Pa!==null&&(J&&Pa.alternate!==null&&Vi.delete(Pa.key===null?ra:Pa.key),Mn=mt(Pa,Mn,ra),Zi===null?Fr=Pa:Zi.sibling=Pa,Zi=Pa);return J&&Vi.forEach(function(a4){return K(Fn,a4)}),xl&&Ih(Fn,ra),Fr}function Kd(Fn,Mn,_n,xr){if(typeof _n=="object"&&_n!==null&&_n.type===u&&_n.key===null&&(_n=_n.props.children),typeof _n=="object"&&_n!==null){switch(_n.$$typeof){case s:e:{for(var Fr=_n.key,Zi=Mn;Zi!==null;){if(Zi.key===Fr){if(Fr=_n.type,Fr===u){if(Zi.tag===7){xe(Fn,Zi.sibling),Mn=Xe(Zi,_n.props.children),Mn.return=Fn,Fn=Mn;break e}}else if(Zi.elementType===Fr||typeof Fr=="object"&&Fr!==null&&Fr.$$typeof===P&&R3(Fr)===Zi.type){xe(Fn,Zi.sibling),Mn=Xe(Zi,_n.props),Mn.ref=g5(Fn,Zi,_n),Mn.return=Fn,Fn=Mn;break e}xe(Fn,Zi);break}else K(Fn,Zi);Zi=Zi.sibling}_n.type===u?(Mn=am(_n.props.children,Fn.mode,xr,_n.key),Mn.return=Fn,Fn=Mn):(xr=Wy(_n.type,_n.key,_n.props,null,Fn.mode,xr),xr.ref=g5(Fn,Mn,_n),xr.return=Fn,Fn=xr)}return rn(Fn);case c:e:{for(Zi=_n.key;Mn!==null;){if(Mn.key===Zi)if(Mn.tag===4&&Mn.stateNode.containerInfo===_n.containerInfo&&Mn.stateNode.implementation===_n.implementation){xe(Fn,Mn.sibling),Mn=Xe(Mn,_n.children||[]),Mn.return=Fn,Fn=Mn;break e}else{xe(Fn,Mn);break}else K(Fn,Mn);Mn=Mn.sibling}Mn=Jd(_n,Fn.mode,xr),Mn.return=Fn,Fn=Mn}return rn(Fn);case P:return Zi=_n._init,Kd(Fn,Mn,Zi(_n._payload),xr)}if(W(_n))return Vr(Fn,Mn,_n,xr);if(w(_n))return S0(Fn,Mn,_n,xr);Dh(Fn,_n)}return typeof _n=="string"&&_n!==""||typeof _n=="number"?(_n=""+_n,Mn!==null&&Mn.tag===6?(xe(Fn,Mn.sibling),Mn=Xe(Mn,_n),Mn.return=Fn,Fn=Mn):(xe(Fn,Mn),Mn=b0(_n,Fn.mode,xr),Mn.return=Fn,Fn=Mn),rn(Fn)):xe(Fn,Mn)}return Kd}var jd=Vg(!0),r7=Vg(!1),Gc={},ys=qt(Gc),xy=qt(Gc),by=qt(Gc);function vu(J){if(J===Gc)throw Error(a(174));return J}function i7(J,K){Rn(by,K),Rn(xy,J),Rn(ys,Gc),J=D(K),un(ys),Rn(ys,J)}function Sy(){un(ys),un(xy),un(by)}function wS(J){var K=vu(by.current),xe=vu(ys.current);K=L(xe,J.type,K),xe!==K&&(Rn(xy,J),Rn(ys,K))}function Sp(J){xy.current===J&&(un(ys),un(xy))}var vn=qt(0);function ao(J){for(var K=J;K!==null;){if(K.tag===13){var xe=K.memoizedState;if(xe!==null&&(xe=xe.dehydrated,xe===null||vt(xe)||Rt(xe)))return K}else if(K.tag===19&&K.memoizedProps.revealOrder!==void 0){if(K.flags&128)return K}else if(K.child!==null){K.child.return=K,K=K.child;continue}if(K===J)break;for(;K.sibling===null;){if(K.return===null||K.return===J)return null;K=K.return}K.sibling.return=K.return,K=K.sibling}return null}var Nn=[];function Sr(){for(var J=0;Jxe?xe:4,J(!0);var Fe=Oi.transition;Oi.transition={};try{J(!1),K()}finally{tr=xe,Oi.transition=Fe}}function l7(){return Ns().memoizedState}function Jc(J,K,xe){var Fe=Lf(J);xe={lane:Fe,action:xe,hasEagerState:!1,eagerState:null,next:null},s7(J)?FA(K,xe):(z3(J,K,xe),xe=v0(),J=cd(J,Fe,xe),J!==null&&kA(J,K,Fe))}function G0(J,K,xe){var Fe=Lf(J),Xe={lane:Fe,action:xe,hasEagerState:!1,eagerState:null,next:null};if(s7(J))FA(K,Xe);else{z3(J,K,Xe);var mt=J.alternate;if(J.lanes===0&&(mt===null||mt.lanes===0)&&(mt=K.lastRenderedReducer,mt!==null))try{var rn=K.lastRenderedState,Pn=mt(rn,xe);if(Xe.hasEagerState=!0,Xe.eagerState=Pn,Vl(Pn,rn))return}catch{}finally{}xe=v0(),J=cd(J,Fe,xe),J!==null&&kA(J,K,Fe)}}function s7(J){var K=J.alternate;return J===Ti||K!==null&&K===Ti}function FA(J,K){_g=_0=!0;var xe=J.pending;xe===null?K.next=K:(K.next=xe.next,xe.next=K),J.pending=K}function z3(J,K,xe){Ic!==null&&J.mode&1&&!(Hi&2)?(J=K.interleaved,J===null?(xe.next=xe,Yn===null?Yn=[K]:Yn.push(K)):(xe.next=J.next,J.next=xe),K.interleaved=xe):(J=K.pending,J===null?xe.next=xe:(xe.next=J.next,J.next=xe),K.pending=xe)}function kA(J,K,xe){if(xe&4194240){var Fe=K.lanes;Fe&=J.pendingLanes,xe|=Fe,K.lanes=xe,hr(J,xe)}}var Hr={readContext:Ln,useCallback:Ws,useContext:Ws,useEffect:Ws,useImperativeHandle:Ws,useInsertionEffect:Ws,useLayoutEffect:Ws,useMemo:Ws,useReducer:Ws,useRef:Ws,useState:Ws,useDebugValue:Ws,useDeferredValue:Ws,useTransition:Ws,useMutableSource:Ws,useSyncExternalStore:Ws,useId:Ws,unstable_isNewReconciler:!1},Kc={readContext:Ln,useCallback:function(J,K){return Rc().memoizedState=[J,K===void 0?null:K],J},useContext:Ln,useEffect:Tp,useImperativeHandle:function(J,K,xe){return xe=xe!=null?xe.concat([J]):null,Bd(4194308,4,T5.bind(null,K,J),xe)},useLayoutEffect:function(J,K){return Bd(4194308,4,J,K)},useInsertionEffect:function(J,K){return Bd(4,2,J,K)},useMemo:function(J,K){var xe=Rc();return K=K===void 0?null:K,J=J(),xe.memoizedState=[J,K],J},useReducer:function(J,K,xe){var Fe=Rc();return K=xe!==void 0?xe(K):K,Fe.memoizedState=Fe.baseState=K,J={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:J,lastRenderedState:K},Fe.queue=J,J=J.dispatch=Jc.bind(null,Ti,J),[Fe.memoizedState,J]},useRef:function(J){var K=Rc();return J={current:J},K.memoizedState=J},useState:x5,useDebugValue:Ef,useDeferredValue:function(J){var K=x5(J),xe=K[0],Fe=K[1];return Tp(function(){var Xe=Oi.transition;Oi.transition={};try{Fe(J)}finally{Oi.transition=Xe}},[J]),xe},useTransition:function(){var J=x5(!1),K=J[0];return J=I3.bind(null,J[1]),Rc().memoizedState=J,[K,J]},useMutableSource:function(){},useSyncExternalStore:function(J,K,xe){var Fe=Ti,Xe=Rc();if(xl){if(xe===void 0)throw Error(a(407));xe=xe()}else{if(xe=K(),Ic===null)throw Error(a(349));cs&30||v5(Fe,K,xe)}Xe.memoizedState=xe;var mt={value:xe,getSnapshot:K};return Xe.queue=mt,Tp(tc.bind(null,Fe,mt,J),[J]),Fe.flags|=2048,nd(9,Xg.bind(null,Fe,mt,xe,K),void 0,null),xe},useId:function(){var J=Rc(),K=Ic.identifierPrefix;if(xl){var xe=V0,Fe=m1;xe=(Fe&~(1<<32-jo(Fe)-1)).toString(32)+xe,K=":"+K+"R"+xe,xe=H3++,0U3&&(K.flags|=128,Fe=!0,X0(Xe,!1),K.lanes=4194304)}else{if(!Fe)if(J=ao(mt),J!==null){if(K.flags|=128,Fe=!0,J=J.updateQueue,J!==null&&(K.updateQueue=J,K.flags|=4),X0(Xe,!0),Xe.tail===null&&Xe.tailMode==="hidden"&&!mt.alternate&&!xl)return di(K),null}else 2*or()-Xe.renderingStartTime>U3&&xe!==1073741824&&(K.flags|=128,Fe=!0,X0(Xe,!1),K.lanes=4194304);Xe.isBackwards?(mt.sibling=K.child,K.child=mt):(J=Xe.last,J!==null?J.sibling=mt:K.child=mt,Xe.last=mt)}return Xe.tail!==null?(K=Xe.tail,Xe.rendering=K,Xe.tail=K.sibling,Xe.renderingStartTime=or(),K.sibling=null,J=vn.current,Rn(vn,Fe?J&1|2:J&1),K):(di(K),null);case 22:case 23:return O3(),Fe=K.memoizedState!==null,J!==null&&J.memoizedState!==null!==Fe&&(K.flags|=8192),Fe&&K.mode&1?Su&1073741824&&(di(K),te&&K.subtreeFlags&6&&(K.flags|=8192)):di(K),null;case 24:return null;case 25:return null}throw Error(a(156,K.tag))}var xS=l.ReactCurrentOwner,Yd=!1;function Us(J,K,xe,Fe){K.child=J===null?r7(K,null,xe,Fe):jd(K,J.child,xe,Fe)}function bS(J,K,xe,Fe,Xe){xe=xe.render;var mt=K.ref;return Tn(K,Xe),Fe=ja(J,K,xe,Fe,mt,Xe),xe=M3(),J!==null&&!Yd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~Xe,Hc(J,K,Xe)):(xl&&xe&&T3(K),K.flags|=1,Us(J,K,Fe,Xe),K.child)}function SS(J,K,xe,Fe,Xe){if(J===null){var mt=xe.type;return typeof mt=="function"&&!Lh(mt)&&mt.defaultProps===void 0&&xe.compare===null&&xe.defaultProps===void 0?(K.tag=15,K.type=mt,UA(J,K,mt,Fe,Xe)):(J=Wy(xe.type,null,Fe,K,K.mode,Xe),J.ref=K.ref,J.return=K,K.child=J)}if(mt=J.child,!(J.lanes&Xe)){var rn=mt.memoizedProps;if(xe=xe.compare,xe=xe!==null?xe:mn,xe(rn,Fe)&&J.ref===K.ref)return Hc(J,K,Xe)}return K.flags|=1,J=Xd(mt,Fe),J.ref=K.ref,J.return=K,K.child=J}function UA(J,K,xe,Fe,Xe){if(J!==null&&mn(J.memoizedProps,Fe)&&J.ref===K.ref)if(Yd=!1,(J.lanes&Xe)!==0)J.flags&131072&&(Yd=!0);else return K.lanes=J.lanes,Hc(J,K,Xe);return Fh(J,K,xe,Fe,Xe)}function u7(J,K,xe){var Fe=K.pendingProps,Xe=Fe.children,mt=J!==null?J.memoizedState:null;if(Fe.mode==="hidden")if(!(K.mode&1))K.memoizedState={baseLanes:0,cachePool:null},Rn(_d,Su),Su|=xe;else if(xe&1073741824)K.memoizedState={baseLanes:0,cachePool:null},Fe=mt!==null?mt.baseLanes:xe,Rn(_d,Su),Su|=Fe;else return J=mt!==null?mt.baseLanes|xe:xe,K.lanes=K.childLanes=1073741824,K.memoizedState={baseLanes:J,cachePool:null},K.updateQueue=null,Rn(_d,Su),Su|=J,null;else mt!==null?(Fe=mt.baseLanes|xe,K.memoizedState=null):Fe=xe,Rn(_d,Su),Su|=Fe;return Us(J,K,Xe,xe),K.child}function d7(J,K){var xe=K.ref;(J===null&&xe!==null||J!==null&&J.ref!==xe)&&(K.flags|=512,K.flags|=2097152)}function Fh(J,K,xe,Fe,Xe){var mt=On(xe)?Io:Ao.current;return mt=po(K,mt),Tn(K,Xe),xe=ja(J,K,xe,Fe,mt,Xe),Fe=M3(),J!==null&&!Yd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~Xe,Hc(J,K,Xe)):(xl&&Fe&&T3(K),K.flags|=1,Us(J,K,xe,Xe),K.child)}function TS(J,K,xe,Fe,Xe){if(On(xe)){var mt=!0;br(K)}else mt=!1;if(Tn(K,Xe),K.stateNode===null)J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),ed(K,xe,Fe),Kl(K,xe,Fe,Xe),Fe=!0;else if(J===null){var rn=K.stateNode,Pn=K.memoizedProps;rn.props=Pn;var Zn=rn.context,Oo=xe.contextType;typeof Oo=="object"&&Oo!==null?Oo=Ln(Oo):(Oo=On(xe)?Io:Ao.current,Oo=po(K,Oo));var Er=xe.getDerivedStateFromProps,Ei=typeof Er=="function"||typeof rn.getSnapshotBeforeUpdate=="function";Ei||typeof rn.UNSAFE_componentWillReceiveProps!="function"&&typeof rn.componentWillReceiveProps!="function"||(Pn!==Fe||Zn!==Oo)&&zf(K,rn,Fe,Oo),Wn=!1;var Xr=K.memoizedState;rn.state=Xr,ya(K,Fe,rn,Xe),Zn=K.memoizedState,Pn!==Fe||Xr!==Zn||wo.current||Wn?(typeof Er=="function"&&(Zu(K,xe,Er,Fe),Zn=K.memoizedState),(Pn=Wn||If(K,xe,Pn,Fe,Xr,Zn,Oo))?(Ei||typeof rn.UNSAFE_componentWillMount!="function"&&typeof rn.componentWillMount!="function"||(typeof rn.componentWillMount=="function"&&rn.componentWillMount(),typeof rn.UNSAFE_componentWillMount=="function"&&rn.UNSAFE_componentWillMount()),typeof rn.componentDidMount=="function"&&(K.flags|=4194308)):(typeof rn.componentDidMount=="function"&&(K.flags|=4194308),K.memoizedProps=Fe,K.memoizedState=Zn),rn.props=Fe,rn.state=Zn,rn.context=Oo,Fe=Pn):(typeof rn.componentDidMount=="function"&&(K.flags|=4194308),Fe=!1)}else{rn=K.stateNode,qn(J,K),Pn=K.memoizedProps,Oo=K.type===K.elementType?Pn:qe(K.type,Pn),rn.props=Oo,Ei=K.pendingProps,Xr=rn.context,Zn=xe.contextType,typeof Zn=="object"&&Zn!==null?Zn=Ln(Zn):(Zn=On(xe)?Io:Ao.current,Zn=po(K,Zn));var pl=xe.getDerivedStateFromProps;(Er=typeof pl=="function"||typeof rn.getSnapshotBeforeUpdate=="function")||typeof rn.UNSAFE_componentWillReceiveProps!="function"&&typeof rn.componentWillReceiveProps!="function"||(Pn!==Ei||Xr!==Zn)&&zf(K,rn,Fe,Zn),Wn=!1,Xr=K.memoizedState,rn.state=Xr,ya(K,Fe,rn,Xe);var Vr=K.memoizedState;Pn!==Ei||Xr!==Vr||wo.current||Wn?(typeof pl=="function"&&(Zu(K,xe,pl,Fe),Vr=K.memoizedState),(Oo=Wn||If(K,xe,Oo,Fe,Xr,Vr,Zn)||!1)?(Er||typeof rn.UNSAFE_componentWillUpdate!="function"&&typeof rn.componentWillUpdate!="function"||(typeof rn.componentWillUpdate=="function"&&rn.componentWillUpdate(Fe,Vr,Zn),typeof rn.UNSAFE_componentWillUpdate=="function"&&rn.UNSAFE_componentWillUpdate(Fe,Vr,Zn)),typeof rn.componentDidUpdate=="function"&&(K.flags|=4),typeof rn.getSnapshotBeforeUpdate=="function"&&(K.flags|=1024)):(typeof rn.componentDidUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=4),typeof rn.getSnapshotBeforeUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=1024),K.memoizedProps=Fe,K.memoizedState=Vr),rn.props=Fe,rn.state=Vr,rn.context=Zn,Fe=Oo):(typeof rn.componentDidUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=4),typeof rn.getSnapshotBeforeUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=1024),Fe=!1)}return jA(J,K,xe,Fe,mt,Xe)}function jA(J,K,xe,Fe,Xe,mt){d7(J,K);var rn=(K.flags&128)!==0;if(!Fe&&!rn)return Xe&&_r(K,xe,!1),Hc(J,K,mt);Fe=K.stateNode,xS.current=K;var Pn=rn&&typeof xe.getDerivedStateFromError!="function"?null:Fe.render();return K.flags|=1,J!==null&&rn?(K.child=jd(K,J.child,null,mt),K.child=jd(K,null,Pn,mt)):Us(J,K,Pn,mt),K.memoizedState=Fe.state,Xe&&_r(K,xe,!0),K.child}function PS(J){var K=J.stateNode;K.pendingContext?ir(J,K.pendingContext,K.pendingContext!==K.context):K.context&&ir(J,K.context,!1),i7(J,K.containerInfo)}function CS(J,K,xe,Fe,Xe){return vy(),C3(Xe),K.flags|=256,Us(J,K,xe,Fe),K.child}var F3={dehydrated:null,treeContext:null,retryLane:0};function xu(J){return{baseLanes:J,cachePool:null}}function f7(J,K,xe){var Fe=K.pendingProps,Xe=vn.current,mt=!1,rn=(K.flags&128)!==0,Pn;if((Pn=rn)||(Pn=J!==null&&J.memoizedState===null?!1:(Xe&2)!==0),Pn?(mt=!0,K.flags&=-129):(J===null||J.memoizedState!==null)&&(Xe|=1),Rn(vn,Xe&1),J===null)return wy(K),J=K.memoizedState,J!==null&&(J=J.dehydrated,J!==null)?(K.mode&1?Rt(J)?K.lanes=8:K.lanes=1073741824:K.lanes=1,null):(Xe=Fe.children,J=Fe.fallback,mt?(Fe=K.mode,mt=K.child,Xe={mode:"hidden",children:Xe},!(Fe&1)&&mt!==null?(mt.childLanes=0,mt.pendingProps=Xe):mt=Ny(Xe,Fe,0,null),J=am(J,Fe,xe,null),mt.return=K,J.return=K,mt.sibling=J,K.child=mt,K.child.memoizedState=xu(xe),K.memoizedState=F3,J):BA(K,Xe));if(Xe=J.memoizedState,Xe!==null){if(Pn=Xe.dehydrated,Pn!==null){if(rn)return K.flags&256?(K.flags&=-257,OA(J,K,xe,Error(a(422)))):K.memoizedState!==null?(K.child=J.child,K.flags|=128,null):(mt=Fe.fallback,Xe=K.mode,Fe=Ny({mode:"visible",children:Fe.children},Xe,0,null),mt=am(mt,Xe,xe,null),mt.flags|=2,Fe.return=K,mt.return=K,Fe.sibling=mt,K.child=Fe,K.mode&1&&jd(K,J.child,null,xe),K.child.memoizedState=xu(xe),K.memoizedState=F3,mt);if(!(K.mode&1))K=OA(J,K,xe,null);else if(Rt(Pn))K=OA(J,K,xe,Error(a(419)));else if(Fe=(xe&J.childLanes)!==0,Yd||Fe){if(Fe=Ic,Fe!==null){switch(xe&-xe){case 4:mt=2;break;case 16:mt=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:mt=32;break;case 536870912:mt=268435456;break;default:mt=0}Fe=mt&(Fe.suspendedLanes|xe)?0:mt,Fe!==0&&Fe!==Xe.retryLane&&(Xe.retryLane=Fe,cd(J,Fe,-1))}W5(),K=OA(J,K,xe,Error(a(421)))}else vt(Pn)?(K.flags|=128,K.child=J.child,K=R1.bind(null,J),Gt(Pn,K),K=null):(xe=Xe.treeContext,de&&(ec=ht(Pn),Ls=K,xl=!0,ol=null,Og=!1,xe!==null&&(_c[yu++]=m1,_c[yu++]=V0,_c[yu++]=g1,m1=xe.id,V0=xe.overflow,g1=K)),K=BA(K,K.pendingProps.children),K.flags|=4096);return K}return mt?(Fe=h7(J,K,Fe.children,Fe.fallback,xe),mt=K.child,Xe=J.child.memoizedState,mt.memoizedState=Xe===null?xu(xe):{baseLanes:Xe.baseLanes|xe,cachePool:null},mt.childLanes=J.childLanes&~xe,K.memoizedState=F3,Fe):(xe=YA(J,K,Fe.children,xe),K.memoizedState=null,xe)}return mt?(Fe=h7(J,K,Fe.children,Fe.fallback,xe),mt=K.child,Xe=J.child.memoizedState,mt.memoizedState=Xe===null?xu(xe):{baseLanes:Xe.baseLanes|xe,cachePool:null},mt.childLanes=J.childLanes&~xe,K.memoizedState=F3,Fe):(xe=YA(J,K,Fe.children,xe),K.memoizedState=null,xe)}function BA(J,K){return K=Ny({mode:"visible",children:K},J.mode,0,null),K.return=J,J.child=K}function YA(J,K,xe,Fe){var Xe=J.child;return J=Xe.sibling,xe=Xd(Xe,{mode:"visible",children:xe}),!(K.mode&1)&&(xe.lanes=Fe),xe.return=K,xe.sibling=null,J!==null&&(Fe=K.deletions,Fe===null?(K.deletions=[J],K.flags|=16):Fe.push(J)),K.child=xe}function h7(J,K,xe,Fe,Xe){var mt=K.mode;J=J.child;var rn=J.sibling,Pn={mode:"hidden",children:xe};return!(mt&1)&&K.child!==J?(xe=K.child,xe.childLanes=0,xe.pendingProps=Pn,K.deletions=null):(xe=Xd(J,Pn),xe.subtreeFlags=J.subtreeFlags&14680064),rn!==null?Fe=Xd(rn,Fe):(Fe=am(Fe,mt,Xe,null),Fe.flags|=2),Fe.return=K,xe.return=K,xe.sibling=Fe,K.child=xe,Fe}function OA(J,K,xe,Fe){return Fe!==null&&C3(Fe),jd(K,J.child,null,xe),J=BA(K,K.pendingProps.children),J.flags|=2,K.memoizedState=null,J}function x1(J,K,xe){J.lanes|=K;var Fe=J.alternate;Fe!==null&&(Fe.lanes|=K),An(J.return,K,xe)}function VA(J,K,xe,Fe,Xe){var mt=J.memoizedState;mt===null?J.memoizedState={isBackwards:K,rendering:null,renderingStartTime:0,last:Fe,tail:xe,tailMode:Xe}:(mt.isBackwards=K,mt.rendering=null,mt.renderingStartTime=0,mt.last=Fe,mt.tail=xe,mt.tailMode=Xe)}function p7(J,K,xe){var Fe=K.pendingProps,Xe=Fe.revealOrder,mt=Fe.tail;if(Us(J,K,Fe.children,xe),Fe=vn.current,Fe&2)Fe=Fe&1|2,K.flags|=128;else{if(J!==null&&J.flags&128)e:for(J=K.child;J!==null;){if(J.tag===13)J.memoizedState!==null&&x1(J,xe,K);else if(J.tag===19)x1(J,xe,K);else if(J.child!==null){J.child.return=J,J=J.child;continue}if(J===K)break e;for(;J.sibling===null;){if(J.return===null||J.return===K)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}Fe&=1}if(Rn(vn,Fe),!(K.mode&1))K.memoizedState=null;else switch(Xe){case"forwards":for(xe=K.child,Xe=null;xe!==null;)J=xe.alternate,J!==null&&ao(J)===null&&(Xe=xe),xe=xe.sibling;xe=Xe,xe===null?(Xe=K.child,K.child=null):(Xe=xe.sibling,xe.sibling=null),VA(K,!1,Xe,xe,mt);break;case"backwards":for(xe=null,Xe=K.child,K.child=null;Xe!==null;){if(J=Xe.alternate,J!==null&&ao(J)===null){K.child=Xe;break}J=Xe.sibling,Xe.sibling=xe,xe=Xe,Xe=J}VA(K,!0,xe,null,mt);break;case"together":VA(K,!1,null,null,void 0);break;default:K.memoizedState=null}return K.child}function Hc(J,K,xe){if(J!==null&&(K.dependencies=J.dependencies),sd|=K.lanes,!(xe&K.childLanes))return null;if(J!==null&&K.child!==J.child)throw Error(a(153));if(K.child!==null){for(J=K.child,xe=Xd(J,J.pendingProps),K.child=xe,xe.return=K;J.sibling!==null;)J=J.sibling,xe=xe.sibling=Xd(J,J.pendingProps),xe.return=K;xe.sibling=null}return K.child}function _A(J,K,xe){switch(K.tag){case 3:PS(K),vy();break;case 5:wS(K);break;case 1:On(K.type)&&br(K);break;case 4:i7(K,K.stateNode.containerInfo);break;case 10:cn(K,K.type._context,K.memoizedProps.value);break;case 13:var Fe=K.memoizedState;if(Fe!==null)return Fe.dehydrated!==null?(Rn(vn,vn.current&1),K.flags|=128,null):xe&K.child.childLanes?f7(J,K,xe):(Rn(vn,vn.current&1),J=Hc(J,K,xe),J!==null?J.sibling:null);Rn(vn,vn.current&1);break;case 19:if(Fe=(xe&K.childLanes)!==0,J.flags&128){if(Fe)return p7(J,K,xe);K.flags|=128}var Xe=K.memoizedState;if(Xe!==null&&(Xe.rendering=null,Xe.tail=null,Xe.lastEffect=null),Rn(vn,vn.current),Fe)break;return null;case 22:case 23:return K.lanes=0,u7(J,K,xe)}return Hc(J,K,xe)}function OM(J,K){switch(Au(K),K.tag){case 1:return On(K.type)&&fo(),J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 3:return Sy(),un(wo),un(Ao),Sr(),J=K.flags,J&65536&&!(J&128)?(K.flags=J&-65537|128,K):null;case 5:return Sp(K),null;case 13:if(un(vn),J=K.memoizedState,J!==null&&J.dehydrated!==null){if(K.alternate===null)throw Error(a(340));vy()}return J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 19:return un(vn),null;case 4:return Sy(),null;case 10:return yn(K.type._context),null;case 22:case 23:return O3(),null;case 24:return null;default:return null}}var Kg=!1,Cy=!1,VM=typeof WeakSet=="function"?WeakSet:Set,Ar=null;function qg(J,K){var xe=J.ref;if(xe!==null)if(typeof xe=="function")try{xe(null)}catch(Fe){q0(J,K,Fe)}else xe.current=null}function H5(J,K,xe){try{xe()}catch(Fe){q0(J,K,Fe)}}var g7=!1;function GA(J,K){for(j(J.containerInfo),Ar=K;Ar!==null;)if(J=Ar,K=J.child,(J.subtreeFlags&1028)!==0&&K!==null)K.return=J,Ar=K;else for(;Ar!==null;){J=Ar;try{var xe=J.alternate;if(J.flags&1024)switch(J.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var Fe=xe.memoizedProps,Xe=xe.memoizedState,mt=J.stateNode,rn=mt.getSnapshotBeforeUpdate(J.elementType===J.type?Fe:qe(J.type,Fe),Xe);mt.__reactInternalSnapshotBeforeUpdate=rn}break;case 3:te&&xt(J.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(Pn){q0(J,J.return,Pn)}if(K=J.sibling,K!==null){K.return=J.return,Ar=K;break}Ar=J.return}return xe=g7,g7=!1,xe}function id(J,K,xe){var Fe=K.updateQueue;if(Fe=Fe!==null?Fe.lastEffect:null,Fe!==null){var Xe=Fe=Fe.next;do{if((Xe.tag&J)===J){var mt=Xe.destroy;Xe.destroy=void 0,mt!==void 0&&H5(K,xe,mt)}Xe=Xe.next}while(Xe!==Fe)}}function Pp(J,K){if(K=K.updateQueue,K=K!==null?K.lastEffect:null,K!==null){var xe=K=K.next;do{if((xe.tag&J)===J){var Fe=xe.create;xe.destroy=Fe()}xe=xe.next}while(xe!==K)}}function k3(J){var K=J.ref;if(K!==null){var xe=J.stateNode;switch(J.tag){case 5:J=k(xe);break;default:J=xe}typeof K=="function"?K(J):K.current=J}}function XA(J,K,xe){if(Zs&&typeof Zs.onCommitFiberUnmount=="function")try{Zs.onCommitFiberUnmount(ks,K)}catch{}switch(K.tag){case 0:case 11:case 14:case 15:if(J=K.updateQueue,J!==null&&(J=J.lastEffect,J!==null)){var Fe=J=J.next;do{var Xe=Fe,mt=Xe.destroy;Xe=Xe.tag,mt!==void 0&&(Xe&2||Xe&4)&&H5(K,xe,mt),Fe=Fe.next}while(Fe!==J)}break;case 1:if(qg(K,xe),J=K.stateNode,typeof J.componentWillUnmount=="function")try{J.props=K.memoizedProps,J.state=K.memoizedState,J.componentWillUnmount()}catch(rn){q0(K,xe,rn)}break;case 5:qg(K,xe);break;case 4:te?qA(J,K,xe):oe&&oe&&(K=K.stateNode.containerInfo,xe=Ye(K),Qe(K,xe))}}function JA(J,K,xe){for(var Fe=K;;)if(XA(J,Fe,xe),Fe.child===null||te&&Fe.tag===4){if(Fe===K)break;for(;Fe.sibling===null;){if(Fe.return===null||Fe.return===K)return;Fe=Fe.return}Fe.sibling.return=Fe.return,Fe=Fe.sibling}else Fe.child.return=Fe,Fe=Fe.child}function kh(J){var K=J.alternate;K!==null&&(J.alternate=null,kh(K)),J.child=null,J.deletions=null,J.sibling=null,J.tag===5&&(K=J.stateNode,K!==null&&le(K)),J.stateNode=null,J.return=null,J.dependencies=null,J.memoizedProps=null,J.memoizedState=null,J.pendingProps=null,J.stateNode=null,J.updateQueue=null}function M5(J){return J.tag===5||J.tag===3||J.tag===4}function w0(J){e:for(;;){for(;J.sibling===null;){if(J.return===null||M5(J.return))return null;J=J.return}for(J.sibling.return=J.return,J=J.sibling;J.tag!==5&&J.tag!==6&&J.tag!==18;){if(J.flags&2||J.child===null||J.tag===4)continue e;J.child.return=J,J=J.child}if(!(J.flags&2))return J.stateNode}}function ad(J){if(te){e:{for(var K=J.return;K!==null;){if(M5(K))break e;K=K.return}throw Error(a(160))}var xe=K;switch(xe.tag){case 5:K=xe.stateNode,xe.flags&32&&(Ee(K),xe.flags&=-33),xe=w0(J),L3(J,xe,K);break;case 3:case 4:K=xe.stateNode.containerInfo,xe=w0(J),KA(J,xe,K);break;default:throw Error(a(161))}}}function KA(J,K,xe){var Fe=J.tag;if(Fe===5||Fe===6)J=J.stateNode,K?Ue(xe,J,K):Ie(xe,J);else if(Fe!==4&&(J=J.child,J!==null))for(KA(J,K,xe),J=J.sibling;J!==null;)KA(J,K,xe),J=J.sibling}function L3(J,K,xe){var Fe=J.tag;if(Fe===5||Fe===6)J=J.stateNode,K?Je(xe,J,K):Pe(xe,J);else if(Fe!==4&&(J=J.child,J!==null))for(L3(J,K,xe),J=J.sibling;J!==null;)L3(J,K,xe),J=J.sibling}function qA(J,K,xe){for(var Fe=K,Xe=!1,mt,rn;;){if(!Xe){Xe=Fe.return;e:for(;;){if(Xe===null)throw Error(a(160));switch(mt=Xe.stateNode,Xe.tag){case 5:rn=!1;break e;case 3:mt=mt.containerInfo,rn=!0;break e;case 4:mt=mt.containerInfo,rn=!0;break e}Xe=Xe.return}Xe=!0}if(Fe.tag===5||Fe.tag===6)JA(J,Fe,xe),rn?We(mt,Fe.stateNode):nt(mt,Fe.stateNode);else if(Fe.tag===18)rn?at(mt,Fe.stateNode):rt(mt,Fe.stateNode);else if(Fe.tag===4){if(Fe.child!==null){mt=Fe.stateNode.containerInfo,rn=!0,Fe.child.return=Fe,Fe=Fe.child;continue}}else if(XA(J,Fe,xe),Fe.child!==null){Fe.child.return=Fe,Fe=Fe.child;continue}if(Fe===K)break;for(;Fe.sibling===null;){if(Fe.return===null||Fe.return===K)return;Fe=Fe.return,Fe.tag===4&&(Xe=!1)}Fe.sibling.return=Fe.return,Fe=Fe.sibling}}function $g(J,K){if(te){switch(K.tag){case 0:case 11:case 14:case 15:id(3,K,K.return),Pp(3,K),id(5,K,K.return);return;case 1:return;case 5:var xe=K.stateNode;if(xe!=null){var Fe=K.memoizedProps;J=J!==null?J.memoizedProps:Fe;var Xe=K.type,mt=K.updateQueue;K.updateQueue=null,mt!==null&&Ne(xe,mt,Xe,J,Fe,K)}return;case 6:if(K.stateNode===null)throw Error(a(162));xe=K.memoizedProps,Me(K.stateNode,J!==null?J.memoizedProps:xe,xe);return;case 3:de&&J!==null&&J.memoizedState.isDehydrated&&ft(K.stateNode.containerInfo);return;case 12:return;case 13:ld(K);return;case 19:ld(K);return;case 17:return}throw Error(a(163))}switch(K.tag){case 0:case 11:case 14:case 15:id(3,K,K.return),Pp(3,K),id(5,K,K.return);return;case 12:return;case 13:ld(K);return;case 19:ld(K);return;case 3:de&&J!==null&&J.memoizedState.isDehydrated&&ft(K.stateNode.containerInfo);break;case 22:case 23:return}e:if(oe){switch(K.tag){case 1:case 5:case 6:break e;case 3:case 4:K=K.stateNode,Qe(K.containerInfo,K.pendingChildren);break e}throw Error(a(163))}}function ld(J){var K=J.updateQueue;if(K!==null){J.updateQueue=null;var xe=J.stateNode;xe===null&&(xe=J.stateNode=new VM),K.forEach(function(Fe){var Xe=V3.bind(null,J,Fe);xe.has(Fe)||(xe.add(Fe),Fe.then(Xe,Xe))})}}function I5(J,K){for(Ar=K;Ar!==null;){K=Ar;var xe=K.deletions;if(xe!==null)for(var Fe=0;Fe";case Od:return":has("+(E5(J)||"")+")";case bu:return'[role="'+J.value+'"]';case Vd:return'"'+J.value+'"';case D5:return'[data-testname="'+J.value+'"]';default:throw Error(a(365))}}function Qg(J,K){var xe=[];J=[J,0];for(var Fe=0;FeXe&&(Xe=rn),Fe&=~mt}if(Fe=Xe,Fe=or()-Fe,Fe=(120>Fe?120:480>Fe?480:1080>Fe?1080:1920>Fe?1920:3e3>Fe?3e3:4320>Fe?4320:1960*Hy(Fe/1960))-Fe,10J?16:J,Gd===null)var Fe=!1;else{if(J=Gd,Gd=null,k5=0,Hi&6)throw Error(a(331));var Xe=Hi;for(Hi|=4,Ar=J.current;Ar!==null;){var mt=Ar,rn=mt.child;if(Ar.flags&16){var Pn=mt.deletions;if(Pn!==null){for(var Zn=0;Znor()-ZA?oc(J,0):N3|=xe),$r(J,K)}function A7(J,K){K===0&&(J.mode&1?(K=to,to<<=1,!(to&130023424)&&(to=4194304)):K=1);var xe=v0();J=tm(J,K),J!==null&&(fr(J,K,xe),$r(J,xe))}function R1(J){var K=J.memoizedState,xe=0;K!==null&&(xe=K.retryLane),A7(J,xe)}function V3(J,K){var xe=0;switch(J.tag){case 13:var Fe=J.stateNode,Xe=J.memoizedState;Xe!==null&&(xe=Xe.retryLane);break;case 19:Fe=J.stateNode;break;default:throw Error(a(314))}Fe!==null&&Fe.delete(K),A7(J,xe)}var n4;n4=function(J,K,xe){if(J!==null)if(J.memoizedProps!==K.pendingProps||wo.current)Yd=!0;else{if(!(J.lanes&xe)&&!(K.flags&128))return Yd=!1,_A(J,K,xe);Yd=!!(J.flags&131072)}else Yd=!1,xl&&K.flags&1048576&&Yg(K,Ay,K.index);switch(K.lanes=0,K.tag){case 2:var Fe=K.type;J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps;var Xe=po(K,Ao.current);Tn(K,xe),Xe=ja(null,K,Fe,J,Xe,xe);var mt=M3();return K.flags|=1,typeof Xe=="object"&&Xe!==null&&typeof Xe.render=="function"&&Xe.$$typeof===void 0?(K.tag=1,K.memoizedState=null,K.updateQueue=null,On(Fe)?(mt=!0,br(K)):mt=!1,K.memoizedState=Xe.state!==null&&Xe.state!==void 0?Xe.state:null,oo(K),Xe.updater=Hh,K.stateNode=Xe,Xe._reactInternals=K,Kl(K,Fe,J,xe),K=jA(null,K,Fe,!0,mt,xe)):(K.tag=0,xl&&mt&&T3(K),Us(null,K,Xe,xe),K=K.child),K;case 16:Fe=K.elementType;e:{switch(J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps,Xe=Fe._init,Fe=Xe(Fe._payload),K.type=Fe,Xe=K.tag=im(Fe),J=qe(Fe,J),Xe){case 0:K=Fh(null,K,Fe,J,xe);break e;case 1:K=TS(null,K,Fe,J,xe);break e;case 11:K=bS(null,K,Fe,J,xe);break e;case 14:K=SS(null,K,Fe,qe(Fe.type,J),xe);break e}throw Error(a(306,Fe,""))}return K;case 0:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),Fh(J,K,Fe,Xe,xe);case 1:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),TS(J,K,Fe,Xe,xe);case 3:e:{if(PS(K),J===null)throw Error(a(387));Fe=K.pendingProps,mt=K.memoizedState,Xe=mt.element,qn(J,K),ya(K,Fe,null,xe);var rn=K.memoizedState;if(Fe=rn.element,de&&mt.isDehydrated)if(mt={element:Fe,isDehydrated:!1,cache:rn.cache,transitions:rn.transitions},K.updateQueue.baseState=mt,K.memoizedState=mt,K.flags&256){Xe=Error(a(423)),K=CS(J,K,Fe,xe,Xe);break e}else if(Fe!==Xe){Xe=Error(a(424)),K=CS(J,K,Fe,xe,Xe);break e}else for(de&&(ec=Wt(K.stateNode.containerInfo),Ls=K,xl=!0,ol=null,Og=!1),xe=r7(K,null,Fe,xe),K.child=xe;xe;)xe.flags=xe.flags&-3|4096,xe=xe.sibling;else{if(vy(),Fe===Xe){K=Hc(J,K,xe);break e}Us(J,K,Fe,xe)}K=K.child}return K;case 5:return wS(K),J===null&&wy(K),Fe=K.type,Xe=K.pendingProps,mt=J!==null?J.memoizedProps:null,rn=Xe.children,$(Fe,Xe)?rn=null:mt!==null&&$(Fe,mt)&&(K.flags|=32),d7(J,K),Us(J,K,rn,xe),K.child;case 6:return J===null&&wy(K),null;case 13:return f7(J,K,xe);case 4:return i7(K,K.stateNode.containerInfo),Fe=K.pendingProps,J===null?K.child=jd(K,null,Fe,xe):Us(J,K,Fe,xe),K.child;case 11:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),bS(J,K,Fe,Xe,xe);case 7:return Us(J,K,K.pendingProps,xe),K.child;case 8:return Us(J,K,K.pendingProps.children,xe),K.child;case 12:return Us(J,K,K.pendingProps.children,xe),K.child;case 10:e:{if(Fe=K.type._context,Xe=K.pendingProps,mt=K.memoizedProps,rn=Xe.value,cn(K,Fe,rn),mt!==null)if(Vl(mt.value,rn)){if(mt.children===Xe.children&&!wo.current){K=Hc(J,K,xe);break e}}else for(mt=K.child,mt!==null&&(mt.return=K);mt!==null;){var Pn=mt.dependencies;if(Pn!==null){rn=mt.child;for(var Zn=Pn.firstContext;Zn!==null;){if(Zn.context===Fe){if(mt.tag===1){Zn=qo(-1,xe&-xe),Zn.tag=2;var Oo=mt.updateQueue;if(Oo!==null){Oo=Oo.shared;var Er=Oo.pending;Er===null?Zn.next=Zn:(Zn.next=Er.next,Er.next=Zn),Oo.pending=Zn}}mt.lanes|=xe,Zn=mt.alternate,Zn!==null&&(Zn.lanes|=xe),An(mt.return,xe,K),Pn.lanes|=xe;break}Zn=Zn.next}}else if(mt.tag===10)rn=mt.type===K.type?null:mt.child;else if(mt.tag===18){if(rn=mt.return,rn===null)throw Error(a(341));rn.lanes|=xe,Pn=rn.alternate,Pn!==null&&(Pn.lanes|=xe),An(rn,xe,K),rn=mt.sibling}else rn=mt.child;if(rn!==null)rn.return=mt;else for(rn=mt;rn!==null;){if(rn===K){rn=null;break}if(mt=rn.sibling,mt!==null){mt.return=rn.return,rn=mt;break}rn=rn.return}mt=rn}Us(J,K,Xe.children,xe),K=K.child}return K;case 9:return Xe=K.type,Fe=K.pendingProps.children,Tn(K,xe),Xe=Ln(Xe),Fe=Fe(Xe),K.flags|=1,Us(J,K,Fe,xe),K.child;case 14:return Fe=K.type,Xe=qe(Fe,K.pendingProps),Xe=qe(Fe.type,Xe),SS(J,K,Fe,Xe,xe);case 15:return UA(J,K,K.type,K.pendingProps,xe);case 17:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),K.tag=1,On(Fe)?(J=!0,br(K)):J=!1,Tn(K,xe),ed(K,Fe,Xe),Kl(K,Fe,Xe,xe),jA(null,K,Fe,!0,J,xe);case 19:return p7(J,K,xe);case 22:return u7(J,K,xe)}throw Error(a(156,K.tag))};function rm(J,K){return Fo(J,K)}function o4(J,K,xe,Fe){this.tag=J,this.key=xe,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=K,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=Fe,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wf(J,K,xe,Fe){return new o4(J,K,xe,Fe)}function Lh(J){return J=J.prototype,!(!J||!J.isReactComponent)}function im(J){if(typeof J=="function")return Lh(J)?1:0;if(J!=null){if(J=J.$$typeof,J===A)return 11;if(J===C)return 14}return 2}function Xd(J,K){var xe=J.alternate;return xe===null?(xe=Wf(J.tag,K,J.key,J.mode),xe.elementType=J.elementType,xe.type=J.type,xe.stateNode=J.stateNode,xe.alternate=J,J.alternate=xe):(xe.pendingProps=K,xe.type=J.type,xe.flags=0,xe.subtreeFlags=0,xe.deletions=null),xe.flags=J.flags&14680064,xe.childLanes=J.childLanes,xe.lanes=J.lanes,xe.child=J.child,xe.memoizedProps=J.memoizedProps,xe.memoizedState=J.memoizedState,xe.updateQueue=J.updateQueue,K=J.dependencies,xe.dependencies=K===null?null:{lanes:K.lanes,firstContext:K.firstContext},xe.sibling=J.sibling,xe.index=J.index,xe.ref=J.ref,xe}function Wy(J,K,xe,Fe,Xe,mt){var rn=2;if(Fe=J,typeof J=="function")Lh(J)&&(rn=1);else if(typeof J=="string")rn=5;else e:switch(J){case u:return am(xe.children,Xe,mt,K);case d:rn=8,Xe|=8;break;case f:return J=Wf(12,xe,K,Xe|2),J.elementType=f,J.lanes=mt,J;case y:return J=Wf(13,xe,K,Xe),J.elementType=y,J.lanes=mt,J;case S:return J=Wf(19,xe,K,Xe),J.elementType=S,J.lanes=mt,J;case v:return Ny(xe,Xe,mt,K);default:if(typeof J=="object"&&J!==null)switch(J.$$typeof){case p:rn=10;break e;case g:rn=9;break e;case A:rn=11;break e;case C:rn=14;break e;case P:rn=16,Fe=null;break e}throw Error(a(130,J==null?J:typeof J,""))}return K=Wf(rn,xe,K,Xe),K.elementType=J,K.type=Fe,K.lanes=mt,K}function am(J,K,xe,Fe){return J=Wf(7,J,Fe,K),J.lanes=xe,J}function Ny(J,K,xe,Fe){return J=Wf(22,J,Fe,K),J.elementType=v,J.lanes=xe,J.stateNode={},J}function b0(J,K,xe){return J=Wf(6,J,null,K),J.lanes=xe,J}function Jd(J,K,xe){return K=Wf(4,J.children!==null?J.children:[],J.key,K),K.lanes=xe,K.stateNode={containerInfo:J.containerInfo,pendingChildren:null,implementation:J.implementation},K}function r4(J,K,xe,Fe,Xe){this.tag=K,this.containerInfo=J,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Z,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lr(0),this.expirationTimes=lr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lr(0),this.identifierPrefix=Fe,this.onRecoverableError=Xe,de&&(this.mutableSourceEagerHydrationData=null)}function U5(J,K,xe,Fe,Xe,mt,rn,Pn,Zn){return J=new r4(J,K,xe,Pn,Zn),K===1?(K=1,mt===!0&&(K|=8)):K=0,mt=Wf(3,null,null,K),J.current=mt,mt.stateNode=J,mt.memoizedState={element:Fe,isDehydrated:xe,cache:null,transitions:null},oo(mt),J}function j5(J){if(!J)return yo;J=J._reactInternals;e:{if(R(J)!==J||J.tag!==1)throw Error(a(170));var K=J;do{switch(K.tag){case 3:K=K.stateNode.context;break e;case 1:if(On(K.type)){K=K.stateNode.__reactInternalMemoizedMergedChildContext;break e}}K=K.return}while(K!==null);throw Error(a(171))}if(J.tag===1){var xe=J.type;if(On(xe))return Rr(J,xe,K)}return K}function Hp(J){var K=J._reactInternals;if(K===void 0)throw typeof J.render=="function"?Error(a(188)):(J=Object.keys(J).join(","),Error(a(268,J)));return J=E(K),J===null?null:J.stateNode}function _3(J,K){if(J=J.memoizedState,J!==null&&J.dehydrated!==null){var xe=J.retryLane;J.retryLane=xe!==0&&xe=Oo&&mt>=Ei&&Xe<=Er&&rn<=Xr){J.splice(K,1);break}else if(Fe!==Oo||xe.width!==Zn.width||Xrrn){if(!(mt!==Ei||xe.height!==Zn.height||ErXe)){Oo>Fe&&(Zn.width+=Oo-Fe,Zn.x=Fe),Ermt&&(Zn.height+=Ei-mt,Zn.y=mt),Xrxe&&(xe=rn)),rnU3&&(K.flags|=128,Fe=!0,X0(Xe,!1),K.lanes=4194304)}else{if(!Fe)if(J=ao(mt),J!==null){if(K.flags|=128,Fe=!0,J=J.updateQueue,J!==null&&(K.updateQueue=J,K.flags|=4),X0(Xe,!0),Xe.tail===null&&Xe.tailMode==="hidden"&&!mt.alternate&&!xl)return di(K),null}else 2*or()-Xe.renderingStartTime>U3&&xe!==1073741824&&(K.flags|=128,Fe=!0,X0(Xe,!1),K.lanes=4194304);Xe.isBackwards?(mt.sibling=K.child,K.child=mt):(J=Xe.last,J!==null?J.sibling=mt:K.child=mt,Xe.last=mt)}return Xe.tail!==null?(K=Xe.tail,Xe.rendering=K,Xe.tail=K.sibling,Xe.renderingStartTime=or(),K.sibling=null,J=vn.current,Rn(vn,Fe?J&1|2:J&1),K):(di(K),null);case 22:case 23:return O3(),Fe=K.memoizedState!==null,J!==null&&J.memoizedState!==null!==Fe&&(K.flags|=8192),Fe&&K.mode&1?Su&1073741824&&(di(K),te&&K.subtreeFlags&6&&(K.flags|=8192)):di(K),null;case 24:return null;case 25:return null}throw Error(a(156,K.tag))}var xS=l.ReactCurrentOwner,Yd=!1;function Us(J,K,xe,Fe){K.child=J===null?r7(K,null,xe,Fe):jd(K,J.child,xe,Fe)}function bS(J,K,xe,Fe,Xe){xe=xe.render;var mt=K.ref;return Tn(K,Xe),Fe=ja(J,K,xe,Fe,mt,Xe),xe=M3(),J!==null&&!Yd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~Xe,Hc(J,K,Xe)):(xl&&xe&&T3(K),K.flags|=1,Us(J,K,Fe,Xe),K.child)}function SS(J,K,xe,Fe,Xe){if(J===null){var mt=xe.type;return typeof mt=="function"&&!Lh(mt)&&mt.defaultProps===void 0&&xe.compare===null&&xe.defaultProps===void 0?(K.tag=15,K.type=mt,UA(J,K,mt,Fe,Xe)):(J=Wy(xe.type,null,Fe,K,K.mode,Xe),J.ref=K.ref,J.return=K,K.child=J)}if(mt=J.child,!(J.lanes&Xe)){var rn=mt.memoizedProps;if(xe=xe.compare,xe=xe!==null?xe:mn,xe(rn,Fe)&&J.ref===K.ref)return Hc(J,K,Xe)}return K.flags|=1,J=Xd(mt,Fe),J.ref=K.ref,J.return=K,K.child=J}function UA(J,K,xe,Fe,Xe){if(J!==null&&mn(J.memoizedProps,Fe)&&J.ref===K.ref)if(Yd=!1,(J.lanes&Xe)!==0)J.flags&131072&&(Yd=!0);else return K.lanes=J.lanes,Hc(J,K,Xe);return Fh(J,K,xe,Fe,Xe)}function u7(J,K,xe){var Fe=K.pendingProps,Xe=Fe.children,mt=J!==null?J.memoizedState:null;if(Fe.mode==="hidden")if(!(K.mode&1))K.memoizedState={baseLanes:0,cachePool:null},Rn(_d,Su),Su|=xe;else if(xe&1073741824)K.memoizedState={baseLanes:0,cachePool:null},Fe=mt!==null?mt.baseLanes:xe,Rn(_d,Su),Su|=Fe;else return J=mt!==null?mt.baseLanes|xe:xe,K.lanes=K.childLanes=1073741824,K.memoizedState={baseLanes:J,cachePool:null},K.updateQueue=null,Rn(_d,Su),Su|=J,null;else mt!==null?(Fe=mt.baseLanes|xe,K.memoizedState=null):Fe=xe,Rn(_d,Su),Su|=Fe;return Us(J,K,Xe,xe),K.child}function d7(J,K){var xe=K.ref;(J===null&&xe!==null||J!==null&&J.ref!==xe)&&(K.flags|=512,K.flags|=2097152)}function Fh(J,K,xe,Fe,Xe){var mt=On(xe)?Io:Ao.current;return mt=po(K,mt),Tn(K,Xe),xe=ja(J,K,xe,Fe,mt,Xe),Fe=M3(),J!==null&&!Yd?(K.updateQueue=J.updateQueue,K.flags&=-2053,J.lanes&=~Xe,Hc(J,K,Xe)):(xl&&Fe&&T3(K),K.flags|=1,Us(J,K,xe,Xe),K.child)}function TS(J,K,xe,Fe,Xe){if(On(xe)){var mt=!0;br(K)}else mt=!1;if(Tn(K,Xe),K.stateNode===null)J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),ed(K,xe,Fe),Kl(K,xe,Fe,Xe),Fe=!0;else if(J===null){var rn=K.stateNode,Pn=K.memoizedProps;rn.props=Pn;var Zn=rn.context,Oo=xe.contextType;typeof Oo=="object"&&Oo!==null?Oo=Ln(Oo):(Oo=On(xe)?Io:Ao.current,Oo=po(K,Oo));var Er=xe.getDerivedStateFromProps,Ei=typeof Er=="function"||typeof rn.getSnapshotBeforeUpdate=="function";Ei||typeof rn.UNSAFE_componentWillReceiveProps!="function"&&typeof rn.componentWillReceiveProps!="function"||(Pn!==Fe||Zn!==Oo)&&Df(K,rn,Fe,Oo),Wn=!1;var Xr=K.memoizedState;rn.state=Xr,ya(K,Fe,rn,Xe),Zn=K.memoizedState,Pn!==Fe||Xr!==Zn||wo.current||Wn?(typeof Er=="function"&&(Zu(K,xe,Er,Fe),Zn=K.memoizedState),(Pn=Wn||zf(K,xe,Pn,Fe,Xr,Zn,Oo))?(Ei||typeof rn.UNSAFE_componentWillMount!="function"&&typeof rn.componentWillMount!="function"||(typeof rn.componentWillMount=="function"&&rn.componentWillMount(),typeof rn.UNSAFE_componentWillMount=="function"&&rn.UNSAFE_componentWillMount()),typeof rn.componentDidMount=="function"&&(K.flags|=4194308)):(typeof rn.componentDidMount=="function"&&(K.flags|=4194308),K.memoizedProps=Fe,K.memoizedState=Zn),rn.props=Fe,rn.state=Zn,rn.context=Oo,Fe=Pn):(typeof rn.componentDidMount=="function"&&(K.flags|=4194308),Fe=!1)}else{rn=K.stateNode,qn(J,K),Pn=K.memoizedProps,Oo=K.type===K.elementType?Pn:qe(K.type,Pn),rn.props=Oo,Ei=K.pendingProps,Xr=rn.context,Zn=xe.contextType,typeof Zn=="object"&&Zn!==null?Zn=Ln(Zn):(Zn=On(xe)?Io:Ao.current,Zn=po(K,Zn));var pl=xe.getDerivedStateFromProps;(Er=typeof pl=="function"||typeof rn.getSnapshotBeforeUpdate=="function")||typeof rn.UNSAFE_componentWillReceiveProps!="function"&&typeof rn.componentWillReceiveProps!="function"||(Pn!==Ei||Xr!==Zn)&&Df(K,rn,Fe,Zn),Wn=!1,Xr=K.memoizedState,rn.state=Xr,ya(K,Fe,rn,Xe);var Vr=K.memoizedState;Pn!==Ei||Xr!==Vr||wo.current||Wn?(typeof pl=="function"&&(Zu(K,xe,pl,Fe),Vr=K.memoizedState),(Oo=Wn||zf(K,xe,Oo,Fe,Xr,Vr,Zn)||!1)?(Er||typeof rn.UNSAFE_componentWillUpdate!="function"&&typeof rn.componentWillUpdate!="function"||(typeof rn.componentWillUpdate=="function"&&rn.componentWillUpdate(Fe,Vr,Zn),typeof rn.UNSAFE_componentWillUpdate=="function"&&rn.UNSAFE_componentWillUpdate(Fe,Vr,Zn)),typeof rn.componentDidUpdate=="function"&&(K.flags|=4),typeof rn.getSnapshotBeforeUpdate=="function"&&(K.flags|=1024)):(typeof rn.componentDidUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=4),typeof rn.getSnapshotBeforeUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=1024),K.memoizedProps=Fe,K.memoizedState=Vr),rn.props=Fe,rn.state=Vr,rn.context=Zn,Fe=Oo):(typeof rn.componentDidUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=4),typeof rn.getSnapshotBeforeUpdate!="function"||Pn===J.memoizedProps&&Xr===J.memoizedState||(K.flags|=1024),Fe=!1)}return jA(J,K,xe,Fe,mt,Xe)}function jA(J,K,xe,Fe,Xe,mt){d7(J,K);var rn=(K.flags&128)!==0;if(!Fe&&!rn)return Xe&&_r(K,xe,!1),Hc(J,K,mt);Fe=K.stateNode,xS.current=K;var Pn=rn&&typeof xe.getDerivedStateFromError!="function"?null:Fe.render();return K.flags|=1,J!==null&&rn?(K.child=jd(K,J.child,null,mt),K.child=jd(K,null,Pn,mt)):Us(J,K,Pn,mt),K.memoizedState=Fe.state,Xe&&_r(K,xe,!0),K.child}function PS(J){var K=J.stateNode;K.pendingContext?ir(J,K.pendingContext,K.pendingContext!==K.context):K.context&&ir(J,K.context,!1),i7(J,K.containerInfo)}function CS(J,K,xe,Fe,Xe){return vy(),C3(Xe),K.flags|=256,Us(J,K,xe,Fe),K.child}var F3={dehydrated:null,treeContext:null,retryLane:0};function xu(J){return{baseLanes:J,cachePool:null}}function f7(J,K,xe){var Fe=K.pendingProps,Xe=vn.current,mt=!1,rn=(K.flags&128)!==0,Pn;if((Pn=rn)||(Pn=J!==null&&J.memoizedState===null?!1:(Xe&2)!==0),Pn?(mt=!0,K.flags&=-129):(J===null||J.memoizedState!==null)&&(Xe|=1),Rn(vn,Xe&1),J===null)return wy(K),J=K.memoizedState,J!==null&&(J=J.dehydrated,J!==null)?(K.mode&1?Rt(J)?K.lanes=8:K.lanes=1073741824:K.lanes=1,null):(Xe=Fe.children,J=Fe.fallback,mt?(Fe=K.mode,mt=K.child,Xe={mode:"hidden",children:Xe},!(Fe&1)&&mt!==null?(mt.childLanes=0,mt.pendingProps=Xe):mt=Ny(Xe,Fe,0,null),J=am(J,Fe,xe,null),mt.return=K,J.return=K,mt.sibling=J,K.child=mt,K.child.memoizedState=xu(xe),K.memoizedState=F3,J):BA(K,Xe));if(Xe=J.memoizedState,Xe!==null){if(Pn=Xe.dehydrated,Pn!==null){if(rn)return K.flags&256?(K.flags&=-257,OA(J,K,xe,Error(a(422)))):K.memoizedState!==null?(K.child=J.child,K.flags|=128,null):(mt=Fe.fallback,Xe=K.mode,Fe=Ny({mode:"visible",children:Fe.children},Xe,0,null),mt=am(mt,Xe,xe,null),mt.flags|=2,Fe.return=K,mt.return=K,Fe.sibling=mt,K.child=Fe,K.mode&1&&jd(K,J.child,null,xe),K.child.memoizedState=xu(xe),K.memoizedState=F3,mt);if(!(K.mode&1))K=OA(J,K,xe,null);else if(Rt(Pn))K=OA(J,K,xe,Error(a(419)));else if(Fe=(xe&J.childLanes)!==0,Yd||Fe){if(Fe=Ic,Fe!==null){switch(xe&-xe){case 4:mt=2;break;case 16:mt=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:mt=32;break;case 536870912:mt=268435456;break;default:mt=0}Fe=mt&(Fe.suspendedLanes|xe)?0:mt,Fe!==0&&Fe!==Xe.retryLane&&(Xe.retryLane=Fe,cd(J,Fe,-1))}W5(),K=OA(J,K,xe,Error(a(421)))}else vt(Pn)?(K.flags|=128,K.child=J.child,K=R1.bind(null,J),Gt(Pn,K),K=null):(xe=Xe.treeContext,de&&(ec=ht(Pn),Ls=K,xl=!0,ol=null,Og=!1,xe!==null&&(_c[yu++]=m1,_c[yu++]=V0,_c[yu++]=g1,m1=xe.id,V0=xe.overflow,g1=K)),K=BA(K,K.pendingProps.children),K.flags|=4096);return K}return mt?(Fe=h7(J,K,Fe.children,Fe.fallback,xe),mt=K.child,Xe=J.child.memoizedState,mt.memoizedState=Xe===null?xu(xe):{baseLanes:Xe.baseLanes|xe,cachePool:null},mt.childLanes=J.childLanes&~xe,K.memoizedState=F3,Fe):(xe=YA(J,K,Fe.children,xe),K.memoizedState=null,xe)}return mt?(Fe=h7(J,K,Fe.children,Fe.fallback,xe),mt=K.child,Xe=J.child.memoizedState,mt.memoizedState=Xe===null?xu(xe):{baseLanes:Xe.baseLanes|xe,cachePool:null},mt.childLanes=J.childLanes&~xe,K.memoizedState=F3,Fe):(xe=YA(J,K,Fe.children,xe),K.memoizedState=null,xe)}function BA(J,K){return K=Ny({mode:"visible",children:K},J.mode,0,null),K.return=J,J.child=K}function YA(J,K,xe,Fe){var Xe=J.child;return J=Xe.sibling,xe=Xd(Xe,{mode:"visible",children:xe}),!(K.mode&1)&&(xe.lanes=Fe),xe.return=K,xe.sibling=null,J!==null&&(Fe=K.deletions,Fe===null?(K.deletions=[J],K.flags|=16):Fe.push(J)),K.child=xe}function h7(J,K,xe,Fe,Xe){var mt=K.mode;J=J.child;var rn=J.sibling,Pn={mode:"hidden",children:xe};return!(mt&1)&&K.child!==J?(xe=K.child,xe.childLanes=0,xe.pendingProps=Pn,K.deletions=null):(xe=Xd(J,Pn),xe.subtreeFlags=J.subtreeFlags&14680064),rn!==null?Fe=Xd(rn,Fe):(Fe=am(Fe,mt,Xe,null),Fe.flags|=2),Fe.return=K,xe.return=K,xe.sibling=Fe,K.child=xe,Fe}function OA(J,K,xe,Fe){return Fe!==null&&C3(Fe),jd(K,J.child,null,xe),J=BA(K,K.pendingProps.children),J.flags|=2,K.memoizedState=null,J}function x1(J,K,xe){J.lanes|=K;var Fe=J.alternate;Fe!==null&&(Fe.lanes|=K),An(J.return,K,xe)}function VA(J,K,xe,Fe,Xe){var mt=J.memoizedState;mt===null?J.memoizedState={isBackwards:K,rendering:null,renderingStartTime:0,last:Fe,tail:xe,tailMode:Xe}:(mt.isBackwards=K,mt.rendering=null,mt.renderingStartTime=0,mt.last=Fe,mt.tail=xe,mt.tailMode=Xe)}function p7(J,K,xe){var Fe=K.pendingProps,Xe=Fe.revealOrder,mt=Fe.tail;if(Us(J,K,Fe.children,xe),Fe=vn.current,Fe&2)Fe=Fe&1|2,K.flags|=128;else{if(J!==null&&J.flags&128)e:for(J=K.child;J!==null;){if(J.tag===13)J.memoizedState!==null&&x1(J,xe,K);else if(J.tag===19)x1(J,xe,K);else if(J.child!==null){J.child.return=J,J=J.child;continue}if(J===K)break e;for(;J.sibling===null;){if(J.return===null||J.return===K)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}Fe&=1}if(Rn(vn,Fe),!(K.mode&1))K.memoizedState=null;else switch(Xe){case"forwards":for(xe=K.child,Xe=null;xe!==null;)J=xe.alternate,J!==null&&ao(J)===null&&(Xe=xe),xe=xe.sibling;xe=Xe,xe===null?(Xe=K.child,K.child=null):(Xe=xe.sibling,xe.sibling=null),VA(K,!1,Xe,xe,mt);break;case"backwards":for(xe=null,Xe=K.child,K.child=null;Xe!==null;){if(J=Xe.alternate,J!==null&&ao(J)===null){K.child=Xe;break}J=Xe.sibling,Xe.sibling=xe,xe=Xe,Xe=J}VA(K,!0,xe,null,mt);break;case"together":VA(K,!1,null,null,void 0);break;default:K.memoizedState=null}return K.child}function Hc(J,K,xe){if(J!==null&&(K.dependencies=J.dependencies),sd|=K.lanes,!(xe&K.childLanes))return null;if(J!==null&&K.child!==J.child)throw Error(a(153));if(K.child!==null){for(J=K.child,xe=Xd(J,J.pendingProps),K.child=xe,xe.return=K;J.sibling!==null;)J=J.sibling,xe=xe.sibling=Xd(J,J.pendingProps),xe.return=K;xe.sibling=null}return K.child}function _A(J,K,xe){switch(K.tag){case 3:PS(K),vy();break;case 5:wS(K);break;case 1:On(K.type)&&br(K);break;case 4:i7(K,K.stateNode.containerInfo);break;case 10:cn(K,K.type._context,K.memoizedProps.value);break;case 13:var Fe=K.memoizedState;if(Fe!==null)return Fe.dehydrated!==null?(Rn(vn,vn.current&1),K.flags|=128,null):xe&K.child.childLanes?f7(J,K,xe):(Rn(vn,vn.current&1),J=Hc(J,K,xe),J!==null?J.sibling:null);Rn(vn,vn.current&1);break;case 19:if(Fe=(xe&K.childLanes)!==0,J.flags&128){if(Fe)return p7(J,K,xe);K.flags|=128}var Xe=K.memoizedState;if(Xe!==null&&(Xe.rendering=null,Xe.tail=null,Xe.lastEffect=null),Rn(vn,vn.current),Fe)break;return null;case 22:case 23:return K.lanes=0,u7(J,K,xe)}return Hc(J,K,xe)}function OM(J,K){switch(Au(K),K.tag){case 1:return On(K.type)&&fo(),J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 3:return Sy(),un(wo),un(Ao),Sr(),J=K.flags,J&65536&&!(J&128)?(K.flags=J&-65537|128,K):null;case 5:return Sp(K),null;case 13:if(un(vn),J=K.memoizedState,J!==null&&J.dehydrated!==null){if(K.alternate===null)throw Error(a(340));vy()}return J=K.flags,J&65536?(K.flags=J&-65537|128,K):null;case 19:return un(vn),null;case 4:return Sy(),null;case 10:return yn(K.type._context),null;case 22:case 23:return O3(),null;case 24:return null;default:return null}}var Kg=!1,Cy=!1,VM=typeof WeakSet=="function"?WeakSet:Set,Ar=null;function qg(J,K){var xe=J.ref;if(xe!==null)if(typeof xe=="function")try{xe(null)}catch(Fe){q0(J,K,Fe)}else xe.current=null}function H5(J,K,xe){try{xe()}catch(Fe){q0(J,K,Fe)}}var g7=!1;function GA(J,K){for(j(J.containerInfo),Ar=K;Ar!==null;)if(J=Ar,K=J.child,(J.subtreeFlags&1028)!==0&&K!==null)K.return=J,Ar=K;else for(;Ar!==null;){J=Ar;try{var xe=J.alternate;if(J.flags&1024)switch(J.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var Fe=xe.memoizedProps,Xe=xe.memoizedState,mt=J.stateNode,rn=mt.getSnapshotBeforeUpdate(J.elementType===J.type?Fe:qe(J.type,Fe),Xe);mt.__reactInternalSnapshotBeforeUpdate=rn}break;case 3:te&&xt(J.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(Pn){q0(J,J.return,Pn)}if(K=J.sibling,K!==null){K.return=J.return,Ar=K;break}Ar=J.return}return xe=g7,g7=!1,xe}function id(J,K,xe){var Fe=K.updateQueue;if(Fe=Fe!==null?Fe.lastEffect:null,Fe!==null){var Xe=Fe=Fe.next;do{if((Xe.tag&J)===J){var mt=Xe.destroy;Xe.destroy=void 0,mt!==void 0&&H5(K,xe,mt)}Xe=Xe.next}while(Xe!==Fe)}}function Pp(J,K){if(K=K.updateQueue,K=K!==null?K.lastEffect:null,K!==null){var xe=K=K.next;do{if((xe.tag&J)===J){var Fe=xe.create;xe.destroy=Fe()}xe=xe.next}while(xe!==K)}}function k3(J){var K=J.ref;if(K!==null){var xe=J.stateNode;switch(J.tag){case 5:J=k(xe);break;default:J=xe}typeof K=="function"?K(J):K.current=J}}function XA(J,K,xe){if(Zs&&typeof Zs.onCommitFiberUnmount=="function")try{Zs.onCommitFiberUnmount(ks,K)}catch{}switch(K.tag){case 0:case 11:case 14:case 15:if(J=K.updateQueue,J!==null&&(J=J.lastEffect,J!==null)){var Fe=J=J.next;do{var Xe=Fe,mt=Xe.destroy;Xe=Xe.tag,mt!==void 0&&(Xe&2||Xe&4)&&H5(K,xe,mt),Fe=Fe.next}while(Fe!==J)}break;case 1:if(qg(K,xe),J=K.stateNode,typeof J.componentWillUnmount=="function")try{J.props=K.memoizedProps,J.state=K.memoizedState,J.componentWillUnmount()}catch(rn){q0(K,xe,rn)}break;case 5:qg(K,xe);break;case 4:te?qA(J,K,xe):ee&&ee&&(K=K.stateNode.containerInfo,xe=Ye(K),Qe(K,xe))}}function JA(J,K,xe){for(var Fe=K;;)if(XA(J,Fe,xe),Fe.child===null||te&&Fe.tag===4){if(Fe===K)break;for(;Fe.sibling===null;){if(Fe.return===null||Fe.return===K)return;Fe=Fe.return}Fe.sibling.return=Fe.return,Fe=Fe.sibling}else Fe.child.return=Fe,Fe=Fe.child}function kh(J){var K=J.alternate;K!==null&&(J.alternate=null,kh(K)),J.child=null,J.deletions=null,J.sibling=null,J.tag===5&&(K=J.stateNode,K!==null&&ae(K)),J.stateNode=null,J.return=null,J.dependencies=null,J.memoizedProps=null,J.memoizedState=null,J.pendingProps=null,J.stateNode=null,J.updateQueue=null}function M5(J){return J.tag===5||J.tag===3||J.tag===4}function w0(J){e:for(;;){for(;J.sibling===null;){if(J.return===null||M5(J.return))return null;J=J.return}for(J.sibling.return=J.return,J=J.sibling;J.tag!==5&&J.tag!==6&&J.tag!==18;){if(J.flags&2||J.child===null||J.tag===4)continue e;J.child.return=J,J=J.child}if(!(J.flags&2))return J.stateNode}}function ad(J){if(te){e:{for(var K=J.return;K!==null;){if(M5(K))break e;K=K.return}throw Error(a(160))}var xe=K;switch(xe.tag){case 5:K=xe.stateNode,xe.flags&32&&(Ee(K),xe.flags&=-33),xe=w0(J),L3(J,xe,K);break;case 3:case 4:K=xe.stateNode.containerInfo,xe=w0(J),KA(J,xe,K);break;default:throw Error(a(161))}}}function KA(J,K,xe){var Fe=J.tag;if(Fe===5||Fe===6)J=J.stateNode,K?Ue(xe,J,K):Ie(xe,J);else if(Fe!==4&&(J=J.child,J!==null))for(KA(J,K,xe),J=J.sibling;J!==null;)KA(J,K,xe),J=J.sibling}function L3(J,K,xe){var Fe=J.tag;if(Fe===5||Fe===6)J=J.stateNode,K?Je(xe,J,K):Pe(xe,J);else if(Fe!==4&&(J=J.child,J!==null))for(L3(J,K,xe),J=J.sibling;J!==null;)L3(J,K,xe),J=J.sibling}function qA(J,K,xe){for(var Fe=K,Xe=!1,mt,rn;;){if(!Xe){Xe=Fe.return;e:for(;;){if(Xe===null)throw Error(a(160));switch(mt=Xe.stateNode,Xe.tag){case 5:rn=!1;break e;case 3:mt=mt.containerInfo,rn=!0;break e;case 4:mt=mt.containerInfo,rn=!0;break e}Xe=Xe.return}Xe=!0}if(Fe.tag===5||Fe.tag===6)JA(J,Fe,xe),rn?We(mt,Fe.stateNode):nt(mt,Fe.stateNode);else if(Fe.tag===18)rn?at(mt,Fe.stateNode):rt(mt,Fe.stateNode);else if(Fe.tag===4){if(Fe.child!==null){mt=Fe.stateNode.containerInfo,rn=!0,Fe.child.return=Fe,Fe=Fe.child;continue}}else if(XA(J,Fe,xe),Fe.child!==null){Fe.child.return=Fe,Fe=Fe.child;continue}if(Fe===K)break;for(;Fe.sibling===null;){if(Fe.return===null||Fe.return===K)return;Fe=Fe.return,Fe.tag===4&&(Xe=!1)}Fe.sibling.return=Fe.return,Fe=Fe.sibling}}function $g(J,K){if(te){switch(K.tag){case 0:case 11:case 14:case 15:id(3,K,K.return),Pp(3,K),id(5,K,K.return);return;case 1:return;case 5:var xe=K.stateNode;if(xe!=null){var Fe=K.memoizedProps;J=J!==null?J.memoizedProps:Fe;var Xe=K.type,mt=K.updateQueue;K.updateQueue=null,mt!==null&&Ne(xe,mt,Xe,J,Fe,K)}return;case 6:if(K.stateNode===null)throw Error(a(162));xe=K.memoizedProps,Me(K.stateNode,J!==null?J.memoizedProps:xe,xe);return;case 3:de&&J!==null&&J.memoizedState.isDehydrated&&ft(K.stateNode.containerInfo);return;case 12:return;case 13:ld(K);return;case 19:ld(K);return;case 17:return}throw Error(a(163))}switch(K.tag){case 0:case 11:case 14:case 15:id(3,K,K.return),Pp(3,K),id(5,K,K.return);return;case 12:return;case 13:ld(K);return;case 19:ld(K);return;case 3:de&&J!==null&&J.memoizedState.isDehydrated&&ft(K.stateNode.containerInfo);break;case 22:case 23:return}e:if(ee){switch(K.tag){case 1:case 5:case 6:break e;case 3:case 4:K=K.stateNode,Qe(K.containerInfo,K.pendingChildren);break e}throw Error(a(163))}}function ld(J){var K=J.updateQueue;if(K!==null){J.updateQueue=null;var xe=J.stateNode;xe===null&&(xe=J.stateNode=new VM),K.forEach(function(Fe){var Xe=V3.bind(null,J,Fe);xe.has(Fe)||(xe.add(Fe),Fe.then(Xe,Xe))})}}function I5(J,K){for(Ar=K;Ar!==null;){K=Ar;var xe=K.deletions;if(xe!==null)for(var Fe=0;Fe";case Od:return":has("+(E5(J)||"")+")";case bu:return'[role="'+J.value+'"]';case Vd:return'"'+J.value+'"';case D5:return'[data-testname="'+J.value+'"]';default:throw Error(a(365))}}function Qg(J,K){var xe=[];J=[J,0];for(var Fe=0;FeXe&&(Xe=rn),Fe&=~mt}if(Fe=Xe,Fe=or()-Fe,Fe=(120>Fe?120:480>Fe?480:1080>Fe?1080:1920>Fe?1920:3e3>Fe?3e3:4320>Fe?4320:1960*Hy(Fe/1960))-Fe,10J?16:J,Gd===null)var Fe=!1;else{if(J=Gd,Gd=null,k5=0,Hi&6)throw Error(a(331));var Xe=Hi;for(Hi|=4,Ar=J.current;Ar!==null;){var mt=Ar,rn=mt.child;if(Ar.flags&16){var Pn=mt.deletions;if(Pn!==null){for(var Zn=0;Znor()-ZA?oc(J,0):N3|=xe),$r(J,K)}function A7(J,K){K===0&&(J.mode&1?(K=to,to<<=1,!(to&130023424)&&(to=4194304)):K=1);var xe=v0();J=tm(J,K),J!==null&&(fr(J,K,xe),$r(J,xe))}function R1(J){var K=J.memoizedState,xe=0;K!==null&&(xe=K.retryLane),A7(J,xe)}function V3(J,K){var xe=0;switch(J.tag){case 13:var Fe=J.stateNode,Xe=J.memoizedState;Xe!==null&&(xe=Xe.retryLane);break;case 19:Fe=J.stateNode;break;default:throw Error(a(314))}Fe!==null&&Fe.delete(K),A7(J,xe)}var n4;n4=function(J,K,xe){if(J!==null)if(J.memoizedProps!==K.pendingProps||wo.current)Yd=!0;else{if(!(J.lanes&xe)&&!(K.flags&128))return Yd=!1,_A(J,K,xe);Yd=!!(J.flags&131072)}else Yd=!1,xl&&K.flags&1048576&&Yg(K,Ay,K.index);switch(K.lanes=0,K.tag){case 2:var Fe=K.type;J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps;var Xe=po(K,Ao.current);Tn(K,xe),Xe=ja(null,K,Fe,J,Xe,xe);var mt=M3();return K.flags|=1,typeof Xe=="object"&&Xe!==null&&typeof Xe.render=="function"&&Xe.$$typeof===void 0?(K.tag=1,K.memoizedState=null,K.updateQueue=null,On(Fe)?(mt=!0,br(K)):mt=!1,K.memoizedState=Xe.state!==null&&Xe.state!==void 0?Xe.state:null,oo(K),Xe.updater=Hh,K.stateNode=Xe,Xe._reactInternals=K,Kl(K,Fe,J,xe),K=jA(null,K,Fe,!0,mt,xe)):(K.tag=0,xl&&mt&&T3(K),Us(null,K,Xe,xe),K=K.child),K;case 16:Fe=K.elementType;e:{switch(J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),J=K.pendingProps,Xe=Fe._init,Fe=Xe(Fe._payload),K.type=Fe,Xe=K.tag=im(Fe),J=qe(Fe,J),Xe){case 0:K=Fh(null,K,Fe,J,xe);break e;case 1:K=TS(null,K,Fe,J,xe);break e;case 11:K=bS(null,K,Fe,J,xe);break e;case 14:K=SS(null,K,Fe,qe(Fe.type,J),xe);break e}throw Error(a(306,Fe,""))}return K;case 0:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),Fh(J,K,Fe,Xe,xe);case 1:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),TS(J,K,Fe,Xe,xe);case 3:e:{if(PS(K),J===null)throw Error(a(387));Fe=K.pendingProps,mt=K.memoizedState,Xe=mt.element,qn(J,K),ya(K,Fe,null,xe);var rn=K.memoizedState;if(Fe=rn.element,de&&mt.isDehydrated)if(mt={element:Fe,isDehydrated:!1,cache:rn.cache,transitions:rn.transitions},K.updateQueue.baseState=mt,K.memoizedState=mt,K.flags&256){Xe=Error(a(423)),K=CS(J,K,Fe,xe,Xe);break e}else if(Fe!==Xe){Xe=Error(a(424)),K=CS(J,K,Fe,xe,Xe);break e}else for(de&&(ec=Wt(K.stateNode.containerInfo),Ls=K,xl=!0,ol=null,Og=!1),xe=r7(K,null,Fe,xe),K.child=xe;xe;)xe.flags=xe.flags&-3|4096,xe=xe.sibling;else{if(vy(),Fe===Xe){K=Hc(J,K,xe);break e}Us(J,K,Fe,xe)}K=K.child}return K;case 5:return wS(K),J===null&&wy(K),Fe=K.type,Xe=K.pendingProps,mt=J!==null?J.memoizedProps:null,rn=Xe.children,$(Fe,Xe)?rn=null:mt!==null&&$(Fe,mt)&&(K.flags|=32),d7(J,K),Us(J,K,rn,xe),K.child;case 6:return J===null&&wy(K),null;case 13:return f7(J,K,xe);case 4:return i7(K,K.stateNode.containerInfo),Fe=K.pendingProps,J===null?K.child=jd(K,null,Fe,xe):Us(J,K,Fe,xe),K.child;case 11:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),bS(J,K,Fe,Xe,xe);case 7:return Us(J,K,K.pendingProps,xe),K.child;case 8:return Us(J,K,K.pendingProps.children,xe),K.child;case 12:return Us(J,K,K.pendingProps.children,xe),K.child;case 10:e:{if(Fe=K.type._context,Xe=K.pendingProps,mt=K.memoizedProps,rn=Xe.value,cn(K,Fe,rn),mt!==null)if(Vl(mt.value,rn)){if(mt.children===Xe.children&&!wo.current){K=Hc(J,K,xe);break e}}else for(mt=K.child,mt!==null&&(mt.return=K);mt!==null;){var Pn=mt.dependencies;if(Pn!==null){rn=mt.child;for(var Zn=Pn.firstContext;Zn!==null;){if(Zn.context===Fe){if(mt.tag===1){Zn=qo(-1,xe&-xe),Zn.tag=2;var Oo=mt.updateQueue;if(Oo!==null){Oo=Oo.shared;var Er=Oo.pending;Er===null?Zn.next=Zn:(Zn.next=Er.next,Er.next=Zn),Oo.pending=Zn}}mt.lanes|=xe,Zn=mt.alternate,Zn!==null&&(Zn.lanes|=xe),An(mt.return,xe,K),Pn.lanes|=xe;break}Zn=Zn.next}}else if(mt.tag===10)rn=mt.type===K.type?null:mt.child;else if(mt.tag===18){if(rn=mt.return,rn===null)throw Error(a(341));rn.lanes|=xe,Pn=rn.alternate,Pn!==null&&(Pn.lanes|=xe),An(rn,xe,K),rn=mt.sibling}else rn=mt.child;if(rn!==null)rn.return=mt;else for(rn=mt;rn!==null;){if(rn===K){rn=null;break}if(mt=rn.sibling,mt!==null){mt.return=rn.return,rn=mt;break}rn=rn.return}mt=rn}Us(J,K,Xe.children,xe),K=K.child}return K;case 9:return Xe=K.type,Fe=K.pendingProps.children,Tn(K,xe),Xe=Ln(Xe),Fe=Fe(Xe),K.flags|=1,Us(J,K,Fe,xe),K.child;case 14:return Fe=K.type,Xe=qe(Fe,K.pendingProps),Xe=qe(Fe.type,Xe),SS(J,K,Fe,Xe,xe);case 15:return UA(J,K,K.type,K.pendingProps,xe);case 17:return Fe=K.type,Xe=K.pendingProps,Xe=K.elementType===Fe?Xe:qe(Fe,Xe),J!==null&&(J.alternate=null,K.alternate=null,K.flags|=2),K.tag=1,On(Fe)?(J=!0,br(K)):J=!1,Tn(K,xe),ed(K,Fe,Xe),Kl(K,Fe,Xe,xe),jA(null,K,Fe,!0,J,xe);case 19:return p7(J,K,xe);case 22:return u7(J,K,xe)}throw Error(a(156,K.tag))};function rm(J,K){return Fo(J,K)}function o4(J,K,xe,Fe){this.tag=J,this.key=xe,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=K,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=Fe,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nf(J,K,xe,Fe){return new o4(J,K,xe,Fe)}function Lh(J){return J=J.prototype,!(!J||!J.isReactComponent)}function im(J){if(typeof J=="function")return Lh(J)?1:0;if(J!=null){if(J=J.$$typeof,J===A)return 11;if(J===C)return 14}return 2}function Xd(J,K){var xe=J.alternate;return xe===null?(xe=Nf(J.tag,K,J.key,J.mode),xe.elementType=J.elementType,xe.type=J.type,xe.stateNode=J.stateNode,xe.alternate=J,J.alternate=xe):(xe.pendingProps=K,xe.type=J.type,xe.flags=0,xe.subtreeFlags=0,xe.deletions=null),xe.flags=J.flags&14680064,xe.childLanes=J.childLanes,xe.lanes=J.lanes,xe.child=J.child,xe.memoizedProps=J.memoizedProps,xe.memoizedState=J.memoizedState,xe.updateQueue=J.updateQueue,K=J.dependencies,xe.dependencies=K===null?null:{lanes:K.lanes,firstContext:K.firstContext},xe.sibling=J.sibling,xe.index=J.index,xe.ref=J.ref,xe}function Wy(J,K,xe,Fe,Xe,mt){var rn=2;if(Fe=J,typeof J=="function")Lh(J)&&(rn=1);else if(typeof J=="string")rn=5;else e:switch(J){case u:return am(xe.children,Xe,mt,K);case d:rn=8,Xe|=8;break;case f:return J=Nf(12,xe,K,Xe|2),J.elementType=f,J.lanes=mt,J;case y:return J=Nf(13,xe,K,Xe),J.elementType=y,J.lanes=mt,J;case S:return J=Nf(19,xe,K,Xe),J.elementType=S,J.lanes=mt,J;case v:return Ny(xe,Xe,mt,K);default:if(typeof J=="object"&&J!==null)switch(J.$$typeof){case p:rn=10;break e;case g:rn=9;break e;case A:rn=11;break e;case C:rn=14;break e;case P:rn=16,Fe=null;break e}throw Error(a(130,J==null?J:typeof J,""))}return K=Nf(rn,xe,K,Xe),K.elementType=J,K.type=Fe,K.lanes=mt,K}function am(J,K,xe,Fe){return J=Nf(7,J,Fe,K),J.lanes=xe,J}function Ny(J,K,xe,Fe){return J=Nf(22,J,Fe,K),J.elementType=v,J.lanes=xe,J.stateNode={},J}function b0(J,K,xe){return J=Nf(6,J,null,K),J.lanes=xe,J}function Jd(J,K,xe){return K=Nf(4,J.children!==null?J.children:[],J.key,K),K.lanes=xe,K.stateNode={containerInfo:J.containerInfo,pendingChildren:null,implementation:J.implementation},K}function r4(J,K,xe,Fe,Xe){this.tag=K,this.containerInfo=J,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=oe,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=lr(0),this.expirationTimes=lr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=lr(0),this.identifierPrefix=Fe,this.onRecoverableError=Xe,de&&(this.mutableSourceEagerHydrationData=null)}function U5(J,K,xe,Fe,Xe,mt,rn,Pn,Zn){return J=new r4(J,K,xe,Pn,Zn),K===1?(K=1,mt===!0&&(K|=8)):K=0,mt=Nf(3,null,null,K),J.current=mt,mt.stateNode=J,mt.memoizedState={element:Fe,isDehydrated:xe,cache:null,transitions:null},oo(mt),J}function j5(J){if(!J)return yo;J=J._reactInternals;e:{if(R(J)!==J||J.tag!==1)throw Error(a(170));var K=J;do{switch(K.tag){case 3:K=K.stateNode.context;break e;case 1:if(On(K.type)){K=K.stateNode.__reactInternalMemoizedMergedChildContext;break e}}K=K.return}while(K!==null);throw Error(a(171))}if(J.tag===1){var xe=J.type;if(On(xe))return Rr(J,xe,K)}return K}function Hp(J){var K=J._reactInternals;if(K===void 0)throw typeof J.render=="function"?Error(a(188)):(J=Object.keys(J).join(","),Error(a(268,J)));return J=E(K),J===null?null:J.stateNode}function _3(J,K){if(J=J.memoizedState,J!==null&&J.dehydrated!==null){var xe=J.retryLane;J.retryLane=xe!==0&&xe=Oo&&mt>=Ei&&Xe<=Er&&rn<=Xr){J.splice(K,1);break}else if(Fe!==Oo||xe.width!==Zn.width||Xrrn){if(!(mt!==Ei||xe.height!==Zn.height||ErXe)){Oo>Fe&&(Zn.width+=Oo-Fe,Zn.x=Fe),Ermt&&(Zn.height+=Ei-mt,Zn.y=mt),Xrxe&&(xe=rn)),rn ")+` No matching component was found for: - `)+J.join(" > ")}return null},n.getPublicRootInstance=function(J){if(J=J.current,!J.child)return null;switch(J.child.tag){case 5:return k(J.child.stateNode);default:return J.child.stateNode}},n.injectIntoDevTools=function(J){if(J={bundleType:J.bundleType,version:J.version,rendererPackageName:J.rendererPackageName,rendererConfig:J.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:_M,findFiberByHostInstance:J.findFiberByHostInstance||G3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")J=!1;else{var K=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(K.isDisabled||!K.supportsFiber)J=!0;else{try{ks=K.inject(J),Zs=K}catch{}J=!!K.checkDCE}}return J},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(J,K,xe,Fe){if(!Se)throw Error(a(363));J=QA(J,K);var Xe=we(J,xe,Fe).disconnect;return{disconnect:function(){Xe()}}},n.registerMutableSourceForHydration=function(J,K){var xe=K._getVersion;xe=xe(K._source),J.mutableSourceEagerHydrationData==null?J.mutableSourceEagerHydrationData=[K,xe]:J.mutableSourceEagerHydrationData.push(K,xe)},n.runWithPriority=function(J,K){var xe=tr;try{return tr=J,K()}finally{tr=xe}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(J,K,xe,Fe){var Xe=K.current,mt=v0(),rn=kf(Xe);return xe=j5(xe),K.context===null?K.context=xe:K.pendingContext=xe,K=qo(mt,rn),K.payload={element:J},Fe=Fe===void 0?null:Fe,Fe!==null&&(K.callback=Fe),ii(Xe,K),J=cd(Xe,rn,mt),J!==null&&Qi(J,Xe,rn),rn},n};DUe.exports=R3t;var H3t=DUe.exports;const M3t=Wi(H3t),I3t=t=>typeof t=="object"&&typeof t.then=="function",Nv=[];function kUe(t,e,n=(o,r)=>o===r){if(t===e)return!0;if(!t||!e)return!1;const o=t.length;if(e.length!==o)return!1;for(let r=0;r0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,o.lifespan)),i.response;if(!n)throw i.promise}const r={keys:e,equal:o.equal,remove:()=>{const i=Nv.indexOf(r);i!==-1&&Nv.splice(i,1)},promise:(I3t(t)?t:t(...e)).then(i=>{r.response=i,o.lifespan&&o.lifespan>0&&(r.timeout=setTimeout(r.remove,o.lifespan))}).catch(i=>r.error=i)};if(Nv.push(r),!n)throw r.promise}const WUe=(t,e,n)=>LUe(t,e,!1,n),z3t=(t,e,n)=>void LUe(t,e,!0,n),D3t=t=>{if(t===void 0||t.length===0)Nv.splice(0,Nv.length);else{const e=Nv.find(n=>kUe(t,n.keys,n.equal));e&&e.remove()}},dge={},Rb=t=>void Object.assign(dge,t);function E3t(t,e){function n(u,{args:d=[],attach:f,...p},g){let A=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const S=p.object;y=sP(S,{type:u,root:g,attach:f,primitive:!0})}else{const S=dge[A];if(!S)throw new Error(`R3F: ${A} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");y=sP(new S(...d),{type:u,root:g,attach:f,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y instanceof ji?y.__r3f.attach="geometry":y instanceof Tf&&(y.__r3f.attach="material")),A!=="inject"&&fre(y,p),y}function o(u,d){let f=!1;if(d){var p,g;(p=d.__r3f)!=null&&p.attach?dre(u,d,d.__r3f.attach):d.isObject3D&&u.isObject3D&&(u.add(d),f=!0),f||(g=u.__r3f)==null||g.objects.push(d),d.__r3f||sP(d,{}),d.__r3f.parent=u,Fce(d),cP(d)}}function r(u,d,f){let p=!1;if(d){var g,A;if((g=d.__r3f)!=null&&g.attach)dre(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){d.parent=u,d.dispatchEvent({type:"added"});const y=u.children.filter(C=>C!==d),S=y.indexOf(f);u.children=[...y.slice(0,S),d,...y.slice(S)],p=!0}p||(A=u.__r3f)==null||A.objects.push(d),d.__r3f||sP(d,{}),d.__r3f.parent=u,Fce(d),cP(d)}}function i(u,d,f=!1){u&&[...u].forEach(p=>a(d,p,f))}function a(u,d,f){if(d){var p,g,A;if(d.__r3f&&(d.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(v=>v!==d)),(g=d.__r3f)!=null&&g.attach)J8e(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){var y;u.remove(d),(y=d.__r3f)!=null&&y.root&&Y3t(d.__r3f.root,d)}const C=(A=d.__r3f)==null?void 0:A.primitive,P=f===void 0?d.dispose!==null&&!C:f;if(!C){var S;i((S=d.__r3f)==null?void 0:S.objects,d,P),i(d.children,d,P)}delete d.__r3f,P&&d.dispose&&d.type!=="Scene"&&Dce.unstable_scheduleCallback(Dce.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),cP(u)}}function l(u,d,f,p){var g;const A=(g=u.__r3f)==null?void 0:g.parent;if(!A)return;const y=n(d,f,u.__r3f.root);if(u.children){for(const S of u.children)S.__r3f&&o(y,S);u.children=u.children.filter(S=>!S.__r3f)}u.__r3f.objects.forEach(S=>o(y,S)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(A,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),o(A,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[p,p.alternate].forEach(S=>{S!==null&&(S.stateNode=y,S.ref&&(typeof S.ref=="function"?S.ref(y):S.ref.current=y))})}const s=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:M3t({createInstance:n,removeChild:a,appendChild:o,appendInitialChild:o,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,d)=>{if(!d)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,o(f,d))},removeChildFromContainer:(u,d)=>{d&&a(u.getState().scene,d)},insertInContainerBefore:(u,d,f)=>{if(!d||!f)return;const p=u.getState().scene;p.__r3f&&r(p,d,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var d;return!!((d=u==null?void 0:u.__r3f)!=null?d:{}).handlers},prepareUpdate(u,d,f,p){var g;if(((g=u==null?void 0:u.__r3f)!=null?g:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:y=[],children:S,...C}=p,{args:P=[],children:v,...T}=f;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((x,b)=>x!==P[b]))return[!0];const w=VUe(u,C,T,!0);return w.changes.length?[!1,w]:null}},commitUpdate(u,[d,f],p,g,A,y){d?l(u,p,A,y):fre(u,f)},commitMount(u,d,f,p){var g;const A=(g=u.__r3f)!=null?g:{};u.raycast&&A.handlers&&A.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>sP(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var d;const{attach:f,parent:p}=(d=u.__r3f)!=null?d:{};f&&p&&J8e(p,u,f),u.isObject3D&&(u.visible=!1),cP(u)},unhideInstance(u,d){var f;const{attach:p,parent:g}=(f=u.__r3f)!=null?f:{};p&&g&&dre(g,u,p),(u.isObject3D&&d.visible==null||d.visible)&&(u.visible=!0),cP(u)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:()=>e?e():ZP.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&pc.fun(performance.now)?performance.now:pc.fun(Date.now)?Date.now:()=>0,scheduleTimeout:pc.fun(setTimeout)?setTimeout:void 0,cancelTimeout:pc.fun(clearTimeout)?clearTimeout:void 0}),applyProps:fre}}var V8e,_8e;const ure=t=>"colorSpace"in t||"outputColorSpace"in t,NUe=()=>{var t;return(t=dge.ColorManagement)!=null?t:null},UUe=t=>t&&t.isOrthographicCamera,F3t=t=>t&&t.hasOwnProperty("current"),fW=typeof window<"u"&&((V8e=window.document)!=null&&V8e.createElement||((_8e=window.navigator)==null?void 0:_8e.product)==="ReactNative")?m.useLayoutEffect:m.useEffect;function jUe(t){const e=m.useRef(t);return fW(()=>void(e.current=t),[t]),e}function k3t({set:t}){return fW(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class BUe extends m.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}BUe.getDerivedStateFromError=()=>({error:!0});const YUe="__default",G8e=new Map,L3t=t=>t&&!!t.memoized&&!!t.changes;function OUe(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const Hz=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()},pc={obj:t=>t===Object(t)&&!pc.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:o="reference",strict:r=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(pc.str(t)||pc.num(t))return t===e;const i=pc.obj(t);if(i&&o==="reference")return t===e;const a=pc.arr(t);if(a&&n==="reference")return t===e;if((a||i)&&t===e)return!0;let l;for(l in t)if(!(l in e))return!1;if(i&&n==="shallow"&&o==="shallow"){for(l in r?e:t)if(!pc.equ(t[l],e[l],{strict:r,objects:"reference"}))return!1}else for(l in r?e:t)if(t[l]!==e[l])return!1;if(pc.und(l)){if(a&&t.length===0&&e.length===0||i&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function W3t(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function N3t(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function sP(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function Ece(t,e){let n=t;if(e.includes("-")){const o=e.split("-"),r=o.pop();return n=o.reduce((i,a)=>i[a],t),{target:n,key:r}}else return{target:n,key:e}}const X8e=/-\d+$/;function dre(t,e,n){if(pc.str(n)){if(X8e.test(n)){const i=n.replace(X8e,""),{target:a,key:l}=Ece(t,i);Array.isArray(a[l])||(a[l]=[])}const{target:o,key:r}=Ece(t,n);e.__r3f.previousAttach=o[r],o[r]=e}else e.__r3f.previousAttach=n(t,e)}function J8e(t,e,n){var o,r;if(pc.str(n)){const{target:i,key:a}=Ece(t,n),l=e.__r3f.previousAttach;l===void 0?delete i[a]:i[a]=l}else(o=e.__r3f)==null||o.previousAttach==null||o.previousAttach(t,e);(r=e.__r3f)==null||delete r.previousAttach}function VUe(t,{children:e,key:n,ref:o,...r},{children:i,key:a,ref:l,...s}={},c=!1){var u;const d=(u=t==null?void 0:t.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const A=Object.keys(s);for(let y=0;y{var S;if((S=t.__r3f)!=null&&S.primitive&&A==="object"||pc.equ(y,s[A]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(A))return p.push([A,y,!0,[]]);let C=[];A.includes("-")&&(C=A.split("-")),p.push([A,y,!1,C]);for(const P in r){const v=r[P];P.startsWith(`${A}-`)&&p.push([P,v,!1,P.split("-")])}});const g={...r};return d.memoizedProps&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:p}}const U3t=typeof process<"u"&&!1;function fre(t,e){var n,o,r;const i=(n=t.__r3f)!=null?n:{},a=i.root,l=(o=a==null||a.getState==null?void 0:a.getState())!=null?o:{},{memoized:s,changes:c}=L3t(e)?e:VUe(t,e),u=i.eventCount;t.__r3f&&(t.__r3f.memoizedProps=s);for(let f=0;fP[v],t),!(C&&C.set))){const[P,...v]=y.reverse();S=v.reverse().reduce((T,w)=>T[w],t),p=P}if(g===YUe+"remove")if(S.constructor){let P=G8e.get(S.constructor);P||(P=new S.constructor,G8e.set(S.constructor,P)),g=P[p]}else g=0;if(A)g?i.handlers[p]=g:delete i.handlers[p],i.eventCount=Object.keys(i.handlers).length;else if(C&&C.set&&(C.copy||C instanceof fx)){if(Array.isArray(g))C.fromArray?C.fromArray(g):C.set(...g);else if(C.copy&&g&&g.constructor&&(U3t?C.constructor.name===g.constructor.name:C.constructor===g.constructor))C.copy(g);else if(g!==void 0){const P=C instanceof rr;!P&&C.setScalar?C.setScalar(g):C instanceof fx&&g instanceof fx?C.mask=g.mask:C.set(g),!NUe()&&!l.linear&&P&&C.convertSRGBToLinear()}}else if(S[p]=g,S[p]instanceof Vc&&S[p].format===Up&&S[p].type===P9){const P=S[p];ure(P)&&ure(l.gl)?P.colorSpace=l.gl.outputColorSpace:P.encoding=l.gl.outputEncoding}cP(t)}if(i.parent&&l.internal&&t.raycast&&u!==i.eventCount){const f=l.internal.interaction.indexOf(t);f>-1&&l.internal.interaction.splice(f,1),i.eventCount&&l.internal.interaction.push(t)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=t.__r3f)!=null&&r.parent&&Fce(t),t}function cP(t){var e,n;const o=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();o&&o.internal.frames===0&&o.invalidate()}function Fce(t){t.onUpdate==null||t.onUpdate(t)}function j3t(t,e){t.manual||(UUe(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function aY(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function B3t(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return ZP.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ZP.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ZP.ContinuousEventPriority;default:return ZP.DefaultEventPriority}}function _Ue(t,e,n,o){const r=n.get(e);r&&(n.delete(e),n.size===0&&(t.delete(o),r.target.releasePointerCapture(o)))}function Y3t(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(o=>o!==e),n.initialHits=n.initialHits.filter(o=>o!==e),n.hovered.forEach((o,r)=>{(o.eventObject===e||o.object===e)&&n.hovered.delete(r)}),n.capturedMap.forEach((o,r)=>{_Ue(n.capturedMap,e,o,r)})}function O3t(t){function e(s){const{internal:c}=t.getState(),u=s.offsetX-c.initialClick[0],d=s.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+d*d))}function n(s){return s.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+u]}))}function o(s,c){const u=t.getState(),d=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let S=0;S{const P=Hz(S.object),v=Hz(C.object);return!P||!v?S.distance-C.distance:v.events.priority-P.events.priority||S.distance-C.distance}).filter(S=>{const C=aY(S);return d.has(C)?!1:(d.add(C),!0)});u.events.filter&&(A=u.events.filter(A,u));for(const S of A){let C=S.object;for(;C;){var y;(y=C.__r3f)!=null&&y.eventCount&&f.push({...S,eventObject:C}),C=C.parent}}if("pointerId"in s&&u.internal.capturedMap.has(s.pointerId))for(let S of u.internal.capturedMap.get(s.pointerId).values())d.has(aY(S.intersection))||f.push(S.intersection);return f}function r(s,c,u,d){const f=t.getState();if(s.length){const p={stopped:!1};for(const g of s){const A=Hz(g.object)||f,{raycaster:y,pointer:S,camera:C,internal:P}=A,v=new ae(S.x,S.y,0).unproject(C),T=H=>{var F,E;return(F=(E=P.capturedMap.get(H))==null?void 0:E.has(g.eventObject))!=null?F:!1},w=H=>{const F={intersection:g,target:c.target};P.capturedMap.has(H)?P.capturedMap.get(H).set(g.eventObject,F):P.capturedMap.set(H,new Map([[g.eventObject,F]])),c.target.setPointerCapture(H)},x=H=>{const F=P.capturedMap.get(H);F&&_Ue(P.capturedMap,g.eventObject,F,H)};let b={};for(let H in c){let F=c[H];typeof F!="function"&&(b[H]=F)}let R={...g,...b,pointer:S,intersections:s,stopped:p.stopped,delta:u,unprojectedPoint:v,ray:y.ray,camera:C,stopPropagation(){const H="pointerId"in c&&P.capturedMap.get(c.pointerId);if((!H||H.has(g.eventObject))&&(R.stopped=p.stopped=!0,P.hovered.size&&Array.from(P.hovered.values()).find(F=>F.eventObject===g.eventObject))){const F=s.slice(0,s.indexOf(g));i([...F,g])}},target:{hasPointerCapture:T,setPointerCapture:w,releasePointerCapture:x},currentTarget:{hasPointerCapture:T,setPointerCapture:w,releasePointerCapture:x},nativeEvent:c};if(d(R),p.stopped===!0)break}}return s}function i(s){const{internal:c}=t.getState();for(const u of c.hovered.values())if(!s.length||!s.find(d=>d.object===u.object&&d.index===u.index&&d.instanceId===u.instanceId)){const f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(aY(u)),f!=null&&f.eventCount){const g={...u,intersections:s};p.onPointerOut==null||p.onPointerOut(g),p.onPointerLeave==null||p.onPointerLeave(g)}}}function a(s,c){for(let u=0;ui([]);case"onLostPointerCapture":return c=>{const{internal:u}=t.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),i([]))})}}return function(u){const{onPointerMissed:d,internal:f}=t.getState();f.lastEvent.current=u;const p=s==="onPointerMove",g=s==="onClick"||s==="onContextMenu"||s==="onDoubleClick",y=o(u,p?n:void 0),S=g?e(u):0;s==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=y.map(P=>P.eventObject)),g&&!y.length&&S<=2&&(a(u,f.interaction),d&&d(u)),p&&i(y);function C(P){const v=P.eventObject,T=v.__r3f,w=T==null?void 0:T.handlers;if(T!=null&&T.eventCount)if(p){if(w.onPointerOver||w.onPointerEnter||w.onPointerOut||w.onPointerLeave){const x=aY(P),b=f.hovered.get(x);b?b.stopped&&P.stopPropagation():(f.hovered.set(x,P),w.onPointerOver==null||w.onPointerOver(P),w.onPointerEnter==null||w.onPointerEnter(P))}w.onPointerMove==null||w.onPointerMove(P)}else{const x=w[s];x?(!g||f.initialHits.includes(v))&&(a(u,f.interaction.filter(b=>!f.initialHits.includes(b))),x(P)):g&&f.initialHits.includes(v)&&a(u,f.interaction.filter(b=>!f.initialHits.includes(b)))}}r(y,u,S,C)}}return{handlePointer:l}}const GUe=t=>!!(t!=null&&t.render),XUe=m.createContext(null),V3t=(t,e)=>{const n=C3t((l,s)=>{const c=new ae,u=new ae,d=new ae;function f(S=s().camera,C=u,P=s().size){const{width:v,height:T,top:w,left:x}=P,b=v/T;C instanceof ae?d.copy(C):d.set(...C);const R=S.getWorldPosition(c).distanceTo(d);if(UUe(S))return{width:v/S.zoom,height:T/S.zoom,top:w,left:x,factor:1,distance:R,aspect:b};{const H=S.fov*Math.PI/180,F=2*Math.tan(H/2)*R,E=F*(v/T);return{width:E,height:F,top:w,left:x,factor:v/E,distance:R,aspect:b}}}let p;const g=S=>l(C=>({performance:{...C.performance,current:S}})),A=new Kt;return{set:l,get:s,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(S=1)=>t(s(),S),advance:(S,C)=>e(S,C,s()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new age,pointer:A,mouse:A,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=s();p&&clearTimeout(p),S.performance.current!==S.performance.min&&g(S.performance.min),p=setTimeout(()=>g(s().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:S=>l(C=>({...C,events:{...C.events,...S}})),setSize:(S,C,P,v,T)=>{const w=s().camera,x={width:S,height:C,top:v||0,left:T||0,updateStyle:P};l(b=>({size:x,viewport:{...b.viewport,...f(w,u,x)}}))},setDpr:S=>l(C=>{const P=OUe(S);return{viewport:{...C.viewport,dpr:P,initialDpr:C.viewport.initialDpr||P}}}),setFrameloop:(S="always")=>{const C=s().clock;C.stop(),C.elapsedTime=0,S!=="never"&&(C.start(),C.elapsedTime=0),l(()=>({frameloop:S}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:m.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(S,C,P)=>{const v=s().internal;return v.priority=v.priority+(C>0?1:0),v.subscribers.push({ref:S,priority:C,store:P}),v.subscribers=v.subscribers.sort((T,w)=>T.priority-w.priority),()=>{const T=s().internal;T!=null&&T.subscribers&&(T.priority=T.priority-(C>0?1:0),T.subscribers=T.subscribers.filter(w=>w.ref!==S))}}}}}),o=n.getState();let r=o.size,i=o.viewport.dpr,a=o.camera;return n.subscribe(()=>{const{camera:l,size:s,viewport:c,gl:u,set:d}=n.getState();if(s.width!==r.width||s.height!==r.height||c.dpr!==i){var f;r=s,i=c.dpr,j3t(l,s),u.setPixelRatio(c.dpr);const p=(f=s.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(s.width,s.height,p)}l!==a&&(a=l,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(l)}})))}),n.subscribe(l=>t(l)),n};let lY,_3t=new Set,G3t=new Set,X3t=new Set;function hre(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Mz(t,e){switch(t){case"before":return hre(_3t,e);case"after":return hre(G3t,e);case"tail":return hre(X3t,e)}}let pre,gre;function mre(t,e,n){let o=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(o=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),pre=e.internal.subscribers,lY=0;lY0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(n+=mre(s,r))}if(Mz("after",s),n===0)return Mz("tail",s),e=!1,cancelAnimationFrame(o)}function a(s,c=1){var u;if(!s)return t.forEach(d=>a(d.store.getState()),c);(u=s.gl.xr)!=null&&u.isPresenting||!s.internal.active||s.frameloop==="never"||(s.internal.frames=Math.min(60,s.internal.frames+c),e||(e=!0,requestAnimationFrame(i)))}function l(s,c=!0,u,d){if(c&&Mz("before",s),u)mre(s,u,d);else for(const f of t.values())mre(s,f.store.getState());c&&Mz("after",s)}return{loop:i,invalidate:a,advance:l}}function JUe(){const t=m.useContext(XUe);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ri(t=n=>n,e){return JUe()(t,e)}function Z2(t,e=0){const n=JUe(),o=n.getState().internal.subscribe,r=jUe(t);return fW(()=>o(r,e,n),[e,o,n]),null}const K8e=new WeakMap;function KUe(t,e){return function(n,...o){let r=K8e.get(n);return r||(r=new n,K8e.set(n,r)),t&&t(r),Promise.all(o.map(i=>new Promise((a,l)=>r.load(i,s=>{s.scene&&Object.assign(s,W3t(s.scene)),a(s)},e,s=>l(new Error(`Could not load ${i}: ${s==null?void 0:s.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function r3(t,e,n,o){const r=Array.isArray(e)?e:[e],i=WUe(KUe(n,o),[t,...r],{equal:pc.equ});return Array.isArray(e)?i:i[0]}r3.preload=function(t,e,n){const o=Array.isArray(e)?e:[e];return z3t(KUe(n),[t,...o])};r3.clear=function(t,e){const n=Array.isArray(e)?e:[e];return D3t([t,...n])};const lR=new Map,{invalidate:op,advance:q8e}=J3t(lR),{reconciler:cG,applyProps:CT}=E3t(lR,B3t),RT={objects:"shallow",strict:!1},K3t=(t,e)=>{const n=typeof t=="function"?t(e):t;return GUe(n)?n:new O1e({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function q3t(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:o,height:r,top:i,left:a,updateStyle:l=n}=e;return{width:o,height:r,top:i,left:a,updateStyle:l}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:o,height:r,top:i,left:a}=t.parentElement.getBoundingClientRect();return{width:o,height:r,top:i,left:a,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function $3t(t){const e=lR.get(t),n=e==null?void 0:e.fiber,o=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,i=o||V3t(op,q8e),a=n||cG.createContainer(i,ZP.ConcurrentRoot,null,!1,null,"",r,null);e||lR.set(t,{fiber:a,store:i});let l,s=!1,c;return{configure(u={}){let{gl:d,size:f,scene:p,events:g,onCreated:A,shadows:y=!1,linear:S=!1,flat:C=!1,legacy:P=!1,orthographic:v=!1,frameloop:T="always",dpr:w=[1,2],performance:x,raycaster:b,camera:R,onPointerMissed:H}=u,F=i.getState(),E=F.gl;F.gl||F.set({gl:E=K3t(d,t)});let N=F.raycaster;N||F.set({raycaster:N=new l0});const{params:U,...W}=b||{};if(pc.equ(W,N,RT)||CT(N,{...W}),pc.equ(U,N.params,RT)||CT(N,{params:{...N.params,...U}}),!F.camera||F.camera===c&&!pc.equ(c,R,RT)){c=R;const V=R instanceof iW,G=V?R:v?new lW(0,0,0,0,.1,1e3):new zu(75,0,.1,1e3);V||(G.position.z=5,R&&CT(G,R),!F.camera&&!(R!=null&&R.rotation)&&G.lookAt(0,0,0)),F.set({camera:G}),N.camera=G}if(!F.scene){let V;p instanceof aG?V=p:(V=new aG,p&&CT(V,p)),F.set({scene:sP(V)})}if(!F.xr){var k;const V=($,ie)=>{const Q=i.getState();Q.frameloop!=="never"&&q8e($,!0,Q,ie)},G=()=>{const $=i.getState();$.gl.xr.enabled=$.gl.xr.isPresenting,$.gl.xr.setAnimationLoop($.gl.xr.isPresenting?V:null),$.gl.xr.isPresenting||op($)},q={connect(){const $=i.getState().gl;$.xr.addEventListener("sessionstart",G),$.xr.addEventListener("sessionend",G)},disconnect(){const $=i.getState().gl;$.xr.removeEventListener("sessionstart",G),$.xr.removeEventListener("sessionend",G)}};typeof((k=E.xr)==null?void 0:k.addEventListener)=="function"&&q.connect(),F.set({xr:q})}if(E.shadowMap){const V=E.shadowMap.enabled,G=E.shadowMap.type;if(E.shadowMap.enabled=!!y,pc.boo(y))E.shadowMap.type=pE;else if(pc.str(y)){var D;const q={basic:RWe,percentage:aq,soft:pE,variance:l2};E.shadowMap.type=(D=q[y])!=null?D:pE}else pc.obj(y)&&Object.assign(E.shadowMap,y);(V!==E.shadowMap.enabled||G!==E.shadowMap.type)&&(E.shadowMap.needsUpdate=!0)}const L=NUe();L&&("enabled"in L?L.enabled=!P:"legacyMode"in L&&(L.legacyMode=P)),CT(E,{outputEncoding:S?3e3:3001,toneMapping:C?T9:P1e}),F.legacy!==P&&F.set(()=>({legacy:P})),F.linear!==S&&F.set(()=>({linear:S})),F.flat!==C&&F.set(()=>({flat:C})),d&&!pc.fun(d)&&!GUe(d)&&!pc.equ(d,E,RT)&&CT(E,d),g&&!F.events.handlers&&F.set({events:g(i)});const O=q3t(t,f);return pc.equ(O,F.size,RT)||F.setSize(O.width,O.height,O.updateStyle,O.top,O.left),w&&F.viewport.dpr!==OUe(w)&&F.setDpr(w),F.frameloop!==T&&F.setFrameloop(T),F.onPointerMissed||F.set({onPointerMissed:H}),x&&!pc.equ(x,F.performance,RT)&&F.set(V=>({performance:{...V.performance,...x}})),l=A,s=!0,this},render(u){return s||this.configure(),cG.updateContainer(m.createElement(Q3t,{store:i,children:u,onCreated:l,rootElement:t}),a,null,()=>{}),i},unmount(){qUe(t)}}}function Q3t({store:t,children:e,onCreated:n,rootElement:o}){return fW(()=>{const r=t.getState();r.set(i=>({internal:{...i.internal,active:!0}})),n&&n(r),t.getState().events.connected||r.events.connect==null||r.events.connect(o)},[]),m.createElement(XUe.Provider,{value:t},e)}function qUe(t,e){const n=lR.get(t),o=n==null?void 0:n.fiber;if(o){const r=n==null?void 0:n.store.getState();r&&(r.internal.active=!1),cG.updateContainer(null,o,null,()=>{r&&setTimeout(()=>{try{var i,a,l,s;r.events.disconnect==null||r.events.disconnect(),(i=r.gl)==null||(a=i.renderLists)==null||a.dispose==null||a.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(s=r.gl)!=null&&s.xr&&r.xr.disconnect(),N3t(r),lR.delete(t)}catch{}},500)})}}cG.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:m.version});function uG(){return uG=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?o=setTimeout(s,e-u):(o=null,n||(l=t.apply(i,r),i=r=null))}var c=function(){i=this,r=arguments,a=Date.now();var u=n&&!o;return o||(o=setTimeout(s,e)),u&&(l=t.apply(i,r),i=r=null),l};return c.clear=function(){o&&(clearTimeout(o),o=null)},c.flush=function(){o&&(l=t.apply(i,r),i=r=null,clearTimeout(o),o=null)},c}kce.debounce=kce;var Z3t=kce;const $8e=Wi(Z3t);function e6t(t){let{debounce:e,scroll:n,polyfill:o,offsetSize:r}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const i=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=m.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),s=m.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,d=m.useRef(!1);m.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,g]=m.useMemo(()=>{const C=()=>{if(!s.current.element)return;const{left:P,top:v,width:T,height:w,bottom:x,right:b,x:R,y:H}=s.current.element.getBoundingClientRect(),F={left:P,top:v,width:T,height:w,bottom:x,right:b,x:R,y:H};s.current.element instanceof HTMLElement&&r&&(F.height=s.current.element.offsetHeight,F.width=s.current.element.offsetWidth),Object.freeze(F),d.current&&!r6t(s.current.lastBounds,F)&&l(s.current.lastBounds=F)};return[C,u?$8e(C,u):C,c?$8e(C,c):C]},[l,r,c,u]);function A(){s.current.scrollContainers&&(s.current.scrollContainers.forEach(C=>C.removeEventListener("scroll",g,!0)),s.current.scrollContainers=null),s.current.resizeObserver&&(s.current.resizeObserver.disconnect(),s.current.resizeObserver=null)}function y(){s.current.element&&(s.current.resizeObserver=new i(g),s.current.resizeObserver.observe(s.current.element),n&&s.current.scrollContainers&&s.current.scrollContainers.forEach(C=>C.addEventListener("scroll",g,{capture:!0,passive:!0})))}const S=C=>{!C||C===s.current.element||(A(),s.current.element=C,s.current.scrollContainers=$Ue(C),y())};return n6t(g,!!n),t6t(p),m.useEffect(()=>{A(),y()},[n,g,p]),m.useEffect(()=>A,[]),[S,a,f]}function t6t(t){m.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function n6t(t,e){m.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function $Ue(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:o,overflowY:r}=window.getComputedStyle(t);return[n,o,r].some(i=>i==="auto"||i==="scroll")&&e.push(t),[...e,...$Ue(t.parentElement)]}const o6t=["x","y","top","bottom","left","right","width","height"],r6t=(t,e)=>o6t.every(n=>t[n]===e[n]);var i6t=Object.defineProperty,a6t=Object.defineProperties,l6t=Object.getOwnPropertyDescriptors,Q8e=Object.getOwnPropertySymbols,s6t=Object.prototype.hasOwnProperty,c6t=Object.prototype.propertyIsEnumerable,Z8e=(t,e,n)=>e in t?i6t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ewe=(t,e)=>{for(var n in e||(e={}))s6t.call(e,n)&&Z8e(t,n,e[n]);if(Q8e)for(var n of Q8e(e))c6t.call(e,n)&&Z8e(t,n,e[n]);return t},u6t=(t,e)=>a6t(t,l6t(e));function QUe(t,e,n){if(!t)return;if(n(t)===!0)return t;let o=t.child;for(;o;){const r=QUe(o,e,n);if(r)return r;o=o.sibling}}function ZUe(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const fge=ZUe(m.createContext(null));class eje extends m.Component{render(){return m.createElement(fge.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:twe,ReactCurrentDispatcher:nwe}=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function d6t(){const t=m.useContext(fge);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=m.useId();return m.useMemo(()=>{for(const o of[twe==null?void 0:twe.current,t,t==null?void 0:t.alternate]){if(!o)continue;const r=QUe(o,!1,i=>{let a=i.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[t,e])}function f6t(){var t,e;const n=d6t(),[o]=m.useState(()=>new Map);o.clear();let r=n;for(;r;){const i=(t=r.type)==null?void 0:t._context;i&&i!==fge&&!o.has(i)&&o.set(i,(e=nwe==null?void 0:nwe.current)==null?void 0:e.readContext(ZUe(i))),r=r.return}return o}function h6t(){const t=f6t();return m.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>o=>m.createElement(e,null,m.createElement(n.Provider,u6t(ewe({},o),{value:t.get(n)}))),e=>m.createElement(eje,ewe({},e))),[t])}const yre={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function p6t(t){const{handlePointer:e}=O3t(t);return{priority:1,enabled:!0,compute(n,o,r){o.pointer.set(n.offsetX/o.size.width*2-1,-(n.offsetY/o.size.height)*2+1),o.raycaster.setFromCamera(o.pointer,o.camera)},connected:void 0,handlers:Object.keys(yre).reduce((n,o)=>({...n,[o]:e(o)}),{}),update:()=>{var n;const{events:o,internal:r}=t.getState();(n=r.lastEvent)!=null&&n.current&&o.handlers&&o.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{var o;const{set:r,events:i}=t.getState();i.disconnect==null||i.disconnect(),r(a=>({events:{...a.events,connected:n}})),Object.entries((o=i.handlers)!=null?o:[]).forEach(([a,l])=>{const[s,c]=yre[a];n.addEventListener(s,l,{passive:c})})},disconnect:()=>{const{set:n,events:o}=t.getState();if(o.connected){var r;Object.entries((r=o.handlers)!=null?r:[]).forEach(([i,a])=>{if(o&&o.connected instanceof HTMLElement){const[l]=yre[i];o.connected.removeEventListener(l,a)}}),n(i=>({events:{...i.events,connected:void 0}}))}}}}const g6t=m.forwardRef(function({children:e,fallback:n,resize:o,style:r,gl:i,events:a=p6t,eventSource:l,eventPrefix:s,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:g,dpr:A,performance:y,raycaster:S,camera:C,scene:P,onPointerMissed:v,onCreated:T,...w},x){m.useMemo(()=>Rb(S3t),[]);const b=h6t(),[R,H]=e6t({scroll:!0,debounce:{scroll:50,resize:0},...o}),F=m.useRef(null),E=m.useRef(null);m.useImperativeHandle(x,()=>F.current);const N=jUe(v),[U,W]=m.useState(!1),[k,D]=m.useState(!1);if(U)throw U;if(k)throw k;const L=m.useRef(null);fW(()=>{const B=F.current;H.width>0&&H.height>0&&B&&(L.current||(L.current=$3t(B)),L.current.configure({gl:i,events:a,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:g,dpr:A,performance:y,raycaster:S,camera:C,scene:P,size:H,onPointerMissed:(...O)=>N.current==null?void 0:N.current(...O),onCreated:O=>{O.events.connect==null||O.events.connect(l?F3t(l)?l.current:l:E.current),s&&O.setEvents({compute:(V,G)=>{const q=V[s+"X"],$=V[s+"Y"];G.pointer.set(q/G.size.width*2-1,-($/G.size.height)*2+1),G.raycaster.setFromCamera(G.pointer,G.camera)}}),T==null||T(O)}}),L.current.render(m.createElement(b,null,m.createElement(BUe,{set:D},m.createElement(m.Suspense,{fallback:m.createElement(k3t,{set:W})},e)))))}),m.useEffect(()=>{const B=F.current;if(B)return()=>qUe(B)},[]);const j=l?"none":"auto";return m.createElement("div",uG({ref:E,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...r}},w),m.createElement("div",{ref:R,style:{width:"100%",height:"100%"}},m.createElement("canvas",{ref:F,style:{display:"block"}},n)))}),m6t=m.forwardRef(function(e,n){return m.createElement(eje,null,m.createElement(g6t,uG({},e,{ref:n})))});function y6t(t,e,n){return e=dG(e),C6t(t,tje()?Reflect.construct(e,n||[],dG(t).constructor):e.apply(t,n))}function tje(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tje=function(){return!!t})()}function A6t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function w6t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function v6t(t){var e=w6t(t,"string");return typeof e=="symbol"?e:String(e)}function x6t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b6t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n ")}return null},n.getPublicRootInstance=function(J){if(J=J.current,!J.child)return null;switch(J.child.tag){case 5:return k(J.child.stateNode);default:return J.child.stateNode}},n.injectIntoDevTools=function(J){if(J={bundleType:J.bundleType,version:J.version,rendererPackageName:J.rendererPackageName,rendererConfig:J.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:_M,findFiberByHostInstance:J.findFiberByHostInstance||G3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")J=!1;else{var K=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(K.isDisabled||!K.supportsFiber)J=!0;else{try{ks=K.inject(J),Zs=K}catch{}J=!!K.checkDCE}}return J},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(J,K,xe,Fe){if(!Se)throw Error(a(363));J=QA(J,K);var Xe=we(J,xe,Fe).disconnect;return{disconnect:function(){Xe()}}},n.registerMutableSourceForHydration=function(J,K){var xe=K._getVersion;xe=xe(K._source),J.mutableSourceEagerHydrationData==null?J.mutableSourceEagerHydrationData=[K,xe]:J.mutableSourceEagerHydrationData.push(K,xe)},n.runWithPriority=function(J,K){var xe=tr;try{return tr=J,K()}finally{tr=xe}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(J,K,xe,Fe){var Xe=K.current,mt=v0(),rn=Lf(Xe);return xe=j5(xe),K.context===null?K.context=xe:K.pendingContext=xe,K=qo(mt,rn),K.payload={element:J},Fe=Fe===void 0?null:Fe,Fe!==null&&(K.callback=Fe),ii(Xe,K),J=cd(Xe,rn,mt),J!==null&&Qi(J,Xe,rn),rn},n};DUe.exports=R3t;var H3t=DUe.exports;const M3t=Wi(H3t),I3t=t=>typeof t=="object"&&typeof t.then=="function",Nv=[];function kUe(t,e,n=(o,r)=>o===r){if(t===e)return!0;if(!t||!e)return!1;const o=t.length;if(e.length!==o)return!1;for(let r=0;r0&&(i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.remove,o.lifespan)),i.response;if(!n)throw i.promise}const r={keys:e,equal:o.equal,remove:()=>{const i=Nv.indexOf(r);i!==-1&&Nv.splice(i,1)},promise:(I3t(t)?t:t(...e)).then(i=>{r.response=i,o.lifespan&&o.lifespan>0&&(r.timeout=setTimeout(r.remove,o.lifespan))}).catch(i=>r.error=i)};if(Nv.push(r),!n)throw r.promise}const WUe=(t,e,n)=>LUe(t,e,!1,n),z3t=(t,e,n)=>void LUe(t,e,!0,n),D3t=t=>{if(t===void 0||t.length===0)Nv.splice(0,Nv.length);else{const e=Nv.find(n=>kUe(t,n.keys,n.equal));e&&e.remove()}},dge={},Rb=t=>void Object.assign(dge,t);function E3t(t,e){function n(u,{args:d=[],attach:f,...p},g){let A=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const S=p.object;y=sP(S,{type:u,root:g,attach:f,primitive:!0})}else{const S=dge[A];if(!S)throw new Error(`R3F: ${A} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");y=sP(new S(...d),{type:u,root:g,attach:f,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y instanceof ji?y.__r3f.attach="geometry":y instanceof Tf&&(y.__r3f.attach="material")),A!=="inject"&&fre(y,p),y}function o(u,d){let f=!1;if(d){var p,g;(p=d.__r3f)!=null&&p.attach?dre(u,d,d.__r3f.attach):d.isObject3D&&u.isObject3D&&(u.add(d),f=!0),f||(g=u.__r3f)==null||g.objects.push(d),d.__r3f||sP(d,{}),d.__r3f.parent=u,Fce(d),cP(d)}}function r(u,d,f){let p=!1;if(d){var g,A;if((g=d.__r3f)!=null&&g.attach)dre(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){d.parent=u,d.dispatchEvent({type:"added"});const y=u.children.filter(C=>C!==d),S=y.indexOf(f);u.children=[...y.slice(0,S),d,...y.slice(S)],p=!0}p||(A=u.__r3f)==null||A.objects.push(d),d.__r3f||sP(d,{}),d.__r3f.parent=u,Fce(d),cP(d)}}function i(u,d,f=!1){u&&[...u].forEach(p=>a(d,p,f))}function a(u,d,f){if(d){var p,g,A;if(d.__r3f&&(d.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(v=>v!==d)),(g=d.__r3f)!=null&&g.attach)J8e(u,d,d.__r3f.attach);else if(d.isObject3D&&u.isObject3D){var y;u.remove(d),(y=d.__r3f)!=null&&y.root&&Y3t(d.__r3f.root,d)}const C=(A=d.__r3f)==null?void 0:A.primitive,P=f===void 0?d.dispose!==null&&!C:f;if(!C){var S;i((S=d.__r3f)==null?void 0:S.objects,d,P),i(d.children,d,P)}delete d.__r3f,P&&d.dispose&&d.type!=="Scene"&&Dce.unstable_scheduleCallback(Dce.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),cP(u)}}function l(u,d,f,p){var g;const A=(g=u.__r3f)==null?void 0:g.parent;if(!A)return;const y=n(d,f,u.__r3f.root);if(u.children){for(const S of u.children)S.__r3f&&o(y,S);u.children=u.children.filter(S=>!S.__r3f)}u.__r3f.objects.forEach(S=>o(y,S)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(A,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),o(A,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[p,p.alternate].forEach(S=>{S!==null&&(S.stateNode=y,S.ref&&(typeof S.ref=="function"?S.ref(y):S.ref.current=y))})}const s=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:M3t({createInstance:n,removeChild:a,appendChild:o,appendInitialChild:o,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,d)=>{if(!d)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,o(f,d))},removeChildFromContainer:(u,d)=>{d&&a(u.getState().scene,d)},insertInContainerBefore:(u,d,f)=>{if(!d||!f)return;const p=u.getState().scene;p.__r3f&&r(p,d,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var d;return!!((d=u==null?void 0:u.__r3f)!=null?d:{}).handlers},prepareUpdate(u,d,f,p){var g;if(((g=u==null?void 0:u.__r3f)!=null?g:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:y=[],children:S,...C}=p,{args:P=[],children:v,...T}=f;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((x,b)=>x!==P[b]))return[!0];const w=VUe(u,C,T,!0);return w.changes.length?[!1,w]:null}},commitUpdate(u,[d,f],p,g,A,y){d?l(u,p,A,y):fre(u,f)},commitMount(u,d,f,p){var g;const A=(g=u.__r3f)!=null?g:{};u.raycast&&A.handlers&&A.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>sP(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var d;const{attach:f,parent:p}=(d=u.__r3f)!=null?d:{};f&&p&&J8e(p,u,f),u.isObject3D&&(u.visible=!1),cP(u)},unhideInstance(u,d){var f;const{attach:p,parent:g}=(f=u.__r3f)!=null?f:{};p&&g&&dre(g,u,p),(u.isObject3D&&d.visible==null||d.visible)&&(u.visible=!0),cP(u)},createTextInstance:s,hideTextInstance:s,unhideTextInstance:s,getCurrentEventPriority:()=>e?e():ZP.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&pc.fun(performance.now)?performance.now:pc.fun(Date.now)?Date.now:()=>0,scheduleTimeout:pc.fun(setTimeout)?setTimeout:void 0,cancelTimeout:pc.fun(clearTimeout)?clearTimeout:void 0}),applyProps:fre}}var V8e,_8e;const ure=t=>"colorSpace"in t||"outputColorSpace"in t,NUe=()=>{var t;return(t=dge.ColorManagement)!=null?t:null},UUe=t=>t&&t.isOrthographicCamera,F3t=t=>t&&t.hasOwnProperty("current"),fW=typeof window<"u"&&((V8e=window.document)!=null&&V8e.createElement||((_8e=window.navigator)==null?void 0:_8e.product)==="ReactNative")?m.useLayoutEffect:m.useEffect;function jUe(t){const e=m.useRef(t);return fW(()=>void(e.current=t),[t]),e}function k3t({set:t}){return fW(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class BUe extends m.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}BUe.getDerivedStateFromError=()=>({error:!0});const YUe="__default",G8e=new Map,L3t=t=>t&&!!t.memoized&&!!t.changes;function OUe(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const Hz=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()},pc={obj:t=>t===Object(t)&&!pc.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:o="reference",strict:r=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(pc.str(t)||pc.num(t))return t===e;const i=pc.obj(t);if(i&&o==="reference")return t===e;const a=pc.arr(t);if(a&&n==="reference")return t===e;if((a||i)&&t===e)return!0;let l;for(l in t)if(!(l in e))return!1;if(i&&n==="shallow"&&o==="shallow"){for(l in r?e:t)if(!pc.equ(t[l],e[l],{strict:r,objects:"reference"}))return!1}else for(l in r?e:t)if(t[l]!==e[l])return!1;if(pc.und(l)){if(a&&t.length===0&&e.length===0||i&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function W3t(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function N3t(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function sP(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function Ece(t,e){let n=t;if(e.includes("-")){const o=e.split("-"),r=o.pop();return n=o.reduce((i,a)=>i[a],t),{target:n,key:r}}else return{target:n,key:e}}const X8e=/-\d+$/;function dre(t,e,n){if(pc.str(n)){if(X8e.test(n)){const i=n.replace(X8e,""),{target:a,key:l}=Ece(t,i);Array.isArray(a[l])||(a[l]=[])}const{target:o,key:r}=Ece(t,n);e.__r3f.previousAttach=o[r],o[r]=e}else e.__r3f.previousAttach=n(t,e)}function J8e(t,e,n){var o,r;if(pc.str(n)){const{target:i,key:a}=Ece(t,n),l=e.__r3f.previousAttach;l===void 0?delete i[a]:i[a]=l}else(o=e.__r3f)==null||o.previousAttach==null||o.previousAttach(t,e);(r=e.__r3f)==null||delete r.previousAttach}function VUe(t,{children:e,key:n,ref:o,...r},{children:i,key:a,ref:l,...s}={},c=!1){var u;const d=(u=t==null?void 0:t.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const A=Object.keys(s);for(let y=0;y{var S;if((S=t.__r3f)!=null&&S.primitive&&A==="object"||pc.equ(y,s[A]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(A))return p.push([A,y,!0,[]]);let C=[];A.includes("-")&&(C=A.split("-")),p.push([A,y,!1,C]);for(const P in r){const v=r[P];P.startsWith(`${A}-`)&&p.push([P,v,!1,P.split("-")])}});const g={...r};return d.memoizedProps&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:p}}const U3t=typeof process<"u"&&!1;function fre(t,e){var n,o,r;const i=(n=t.__r3f)!=null?n:{},a=i.root,l=(o=a==null||a.getState==null?void 0:a.getState())!=null?o:{},{memoized:s,changes:c}=L3t(e)?e:VUe(t,e),u=i.eventCount;t.__r3f&&(t.__r3f.memoizedProps=s);for(let f=0;fP[v],t),!(C&&C.set))){const[P,...v]=y.reverse();S=v.reverse().reduce((T,w)=>T[w],t),p=P}if(g===YUe+"remove")if(S.constructor){let P=G8e.get(S.constructor);P||(P=new S.constructor,G8e.set(S.constructor,P)),g=P[p]}else g=0;if(A)g?i.handlers[p]=g:delete i.handlers[p],i.eventCount=Object.keys(i.handlers).length;else if(C&&C.set&&(C.copy||C instanceof fx)){if(Array.isArray(g))C.fromArray?C.fromArray(g):C.set(...g);else if(C.copy&&g&&g.constructor&&(U3t?C.constructor.name===g.constructor.name:C.constructor===g.constructor))C.copy(g);else if(g!==void 0){const P=C instanceof rr;!P&&C.setScalar?C.setScalar(g):C instanceof fx&&g instanceof fx?C.mask=g.mask:C.set(g),!NUe()&&!l.linear&&P&&C.convertSRGBToLinear()}}else if(S[p]=g,S[p]instanceof Vc&&S[p].format===Up&&S[p].type===P9){const P=S[p];ure(P)&&ure(l.gl)?P.colorSpace=l.gl.outputColorSpace:P.encoding=l.gl.outputEncoding}cP(t)}if(i.parent&&l.internal&&t.raycast&&u!==i.eventCount){const f=l.internal.interaction.indexOf(t);f>-1&&l.internal.interaction.splice(f,1),i.eventCount&&l.internal.interaction.push(t)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=t.__r3f)!=null&&r.parent&&Fce(t),t}function cP(t){var e,n;const o=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();o&&o.internal.frames===0&&o.invalidate()}function Fce(t){t.onUpdate==null||t.onUpdate(t)}function j3t(t,e){t.manual||(UUe(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function aY(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function B3t(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return ZP.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ZP.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ZP.ContinuousEventPriority;default:return ZP.DefaultEventPriority}}function _Ue(t,e,n,o){const r=n.get(e);r&&(n.delete(e),n.size===0&&(t.delete(o),r.target.releasePointerCapture(o)))}function Y3t(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(o=>o!==e),n.initialHits=n.initialHits.filter(o=>o!==e),n.hovered.forEach((o,r)=>{(o.eventObject===e||o.object===e)&&n.hovered.delete(r)}),n.capturedMap.forEach((o,r)=>{_Ue(n.capturedMap,e,o,r)})}function O3t(t){function e(s){const{internal:c}=t.getState(),u=s.offsetX-c.initialClick[0],d=s.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+d*d))}function n(s){return s.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var d;return(d=c.__r3f)==null?void 0:d.handlers["onPointer"+u]}))}function o(s,c){const u=t.getState(),d=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let S=0;S{const P=Hz(S.object),v=Hz(C.object);return!P||!v?S.distance-C.distance:v.events.priority-P.events.priority||S.distance-C.distance}).filter(S=>{const C=aY(S);return d.has(C)?!1:(d.add(C),!0)});u.events.filter&&(A=u.events.filter(A,u));for(const S of A){let C=S.object;for(;C;){var y;(y=C.__r3f)!=null&&y.eventCount&&f.push({...S,eventObject:C}),C=C.parent}}if("pointerId"in s&&u.internal.capturedMap.has(s.pointerId))for(let S of u.internal.capturedMap.get(s.pointerId).values())d.has(aY(S.intersection))||f.push(S.intersection);return f}function r(s,c,u,d){const f=t.getState();if(s.length){const p={stopped:!1};for(const g of s){const A=Hz(g.object)||f,{raycaster:y,pointer:S,camera:C,internal:P}=A,v=new le(S.x,S.y,0).unproject(C),T=H=>{var F,E;return(F=(E=P.capturedMap.get(H))==null?void 0:E.has(g.eventObject))!=null?F:!1},w=H=>{const F={intersection:g,target:c.target};P.capturedMap.has(H)?P.capturedMap.get(H).set(g.eventObject,F):P.capturedMap.set(H,new Map([[g.eventObject,F]])),c.target.setPointerCapture(H)},x=H=>{const F=P.capturedMap.get(H);F&&_Ue(P.capturedMap,g.eventObject,F,H)};let b={};for(let H in c){let F=c[H];typeof F!="function"&&(b[H]=F)}let R={...g,...b,pointer:S,intersections:s,stopped:p.stopped,delta:u,unprojectedPoint:v,ray:y.ray,camera:C,stopPropagation(){const H="pointerId"in c&&P.capturedMap.get(c.pointerId);if((!H||H.has(g.eventObject))&&(R.stopped=p.stopped=!0,P.hovered.size&&Array.from(P.hovered.values()).find(F=>F.eventObject===g.eventObject))){const F=s.slice(0,s.indexOf(g));i([...F,g])}},target:{hasPointerCapture:T,setPointerCapture:w,releasePointerCapture:x},currentTarget:{hasPointerCapture:T,setPointerCapture:w,releasePointerCapture:x},nativeEvent:c};if(d(R),p.stopped===!0)break}}return s}function i(s){const{internal:c}=t.getState();for(const u of c.hovered.values())if(!s.length||!s.find(d=>d.object===u.object&&d.index===u.index&&d.instanceId===u.instanceId)){const f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(aY(u)),f!=null&&f.eventCount){const g={...u,intersections:s};p.onPointerOut==null||p.onPointerOut(g),p.onPointerLeave==null||p.onPointerLeave(g)}}}function a(s,c){for(let u=0;ui([]);case"onLostPointerCapture":return c=>{const{internal:u}=t.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),i([]))})}}return function(u){const{onPointerMissed:d,internal:f}=t.getState();f.lastEvent.current=u;const p=s==="onPointerMove",g=s==="onClick"||s==="onContextMenu"||s==="onDoubleClick",y=o(u,p?n:void 0),S=g?e(u):0;s==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=y.map(P=>P.eventObject)),g&&!y.length&&S<=2&&(a(u,f.interaction),d&&d(u)),p&&i(y);function C(P){const v=P.eventObject,T=v.__r3f,w=T==null?void 0:T.handlers;if(T!=null&&T.eventCount)if(p){if(w.onPointerOver||w.onPointerEnter||w.onPointerOut||w.onPointerLeave){const x=aY(P),b=f.hovered.get(x);b?b.stopped&&P.stopPropagation():(f.hovered.set(x,P),w.onPointerOver==null||w.onPointerOver(P),w.onPointerEnter==null||w.onPointerEnter(P))}w.onPointerMove==null||w.onPointerMove(P)}else{const x=w[s];x?(!g||f.initialHits.includes(v))&&(a(u,f.interaction.filter(b=>!f.initialHits.includes(b))),x(P)):g&&f.initialHits.includes(v)&&a(u,f.interaction.filter(b=>!f.initialHits.includes(b)))}}r(y,u,S,C)}}return{handlePointer:l}}const GUe=t=>!!(t!=null&&t.render),XUe=m.createContext(null),V3t=(t,e)=>{const n=C3t((l,s)=>{const c=new le,u=new le,d=new le;function f(S=s().camera,C=u,P=s().size){const{width:v,height:T,top:w,left:x}=P,b=v/T;C instanceof le?d.copy(C):d.set(...C);const R=S.getWorldPosition(c).distanceTo(d);if(UUe(S))return{width:v/S.zoom,height:T/S.zoom,top:w,left:x,factor:1,distance:R,aspect:b};{const H=S.fov*Math.PI/180,F=2*Math.tan(H/2)*R,E=F*(v/T);return{width:E,height:F,top:w,left:x,factor:v/E,distance:R,aspect:b}}}let p;const g=S=>l(C=>({performance:{...C.performance,current:S}})),A=new Kt;return{set:l,get:s,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(S=1)=>t(s(),S),advance:(S,C)=>e(S,C,s()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new age,pointer:A,mouse:A,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=s();p&&clearTimeout(p),S.performance.current!==S.performance.min&&g(S.performance.min),p=setTimeout(()=>g(s().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:S=>l(C=>({...C,events:{...C.events,...S}})),setSize:(S,C,P,v,T)=>{const w=s().camera,x={width:S,height:C,top:v||0,left:T||0,updateStyle:P};l(b=>({size:x,viewport:{...b.viewport,...f(w,u,x)}}))},setDpr:S=>l(C=>{const P=OUe(S);return{viewport:{...C.viewport,dpr:P,initialDpr:C.viewport.initialDpr||P}}}),setFrameloop:(S="always")=>{const C=s().clock;C.stop(),C.elapsedTime=0,S!=="never"&&(C.start(),C.elapsedTime=0),l(()=>({frameloop:S}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:m.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(S,C,P)=>{const v=s().internal;return v.priority=v.priority+(C>0?1:0),v.subscribers.push({ref:S,priority:C,store:P}),v.subscribers=v.subscribers.sort((T,w)=>T.priority-w.priority),()=>{const T=s().internal;T!=null&&T.subscribers&&(T.priority=T.priority-(C>0?1:0),T.subscribers=T.subscribers.filter(w=>w.ref!==S))}}}}}),o=n.getState();let r=o.size,i=o.viewport.dpr,a=o.camera;return n.subscribe(()=>{const{camera:l,size:s,viewport:c,gl:u,set:d}=n.getState();if(s.width!==r.width||s.height!==r.height||c.dpr!==i){var f;r=s,i=c.dpr,j3t(l,s),u.setPixelRatio(c.dpr);const p=(f=s.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(s.width,s.height,p)}l!==a&&(a=l,d(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(l)}})))}),n.subscribe(l=>t(l)),n};let lY,_3t=new Set,G3t=new Set,X3t=new Set;function hre(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Mz(t,e){switch(t){case"before":return hre(_3t,e);case"after":return hre(G3t,e);case"tail":return hre(X3t,e)}}let pre,gre;function mre(t,e,n){let o=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(o=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),pre=e.internal.subscribers,lY=0;lY0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(n+=mre(s,r))}if(Mz("after",s),n===0)return Mz("tail",s),e=!1,cancelAnimationFrame(o)}function a(s,c=1){var u;if(!s)return t.forEach(d=>a(d.store.getState()),c);(u=s.gl.xr)!=null&&u.isPresenting||!s.internal.active||s.frameloop==="never"||(s.internal.frames=Math.min(60,s.internal.frames+c),e||(e=!0,requestAnimationFrame(i)))}function l(s,c=!0,u,d){if(c&&Mz("before",s),u)mre(s,u,d);else for(const f of t.values())mre(s,f.store.getState());c&&Mz("after",s)}return{loop:i,invalidate:a,advance:l}}function JUe(){const t=m.useContext(XUe);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ri(t=n=>n,e){return JUe()(t,e)}function Z2(t,e=0){const n=JUe(),o=n.getState().internal.subscribe,r=jUe(t);return fW(()=>o(r,e,n),[e,o,n]),null}const K8e=new WeakMap;function KUe(t,e){return function(n,...o){let r=K8e.get(n);return r||(r=new n,K8e.set(n,r)),t&&t(r),Promise.all(o.map(i=>new Promise((a,l)=>r.load(i,s=>{s.scene&&Object.assign(s,W3t(s.scene)),a(s)},e,s=>l(new Error(`Could not load ${i}: ${s==null?void 0:s.message}`)))))).finally(()=>r.dispose==null?void 0:r.dispose())}}function r3(t,e,n,o){const r=Array.isArray(e)?e:[e],i=WUe(KUe(n,o),[t,...r],{equal:pc.equ});return Array.isArray(e)?i:i[0]}r3.preload=function(t,e,n){const o=Array.isArray(e)?e:[e];return z3t(KUe(n),[t,...o])};r3.clear=function(t,e){const n=Array.isArray(e)?e:[e];return D3t([t,...n])};const lR=new Map,{invalidate:op,advance:q8e}=J3t(lR),{reconciler:cG,applyProps:CT}=E3t(lR,B3t),RT={objects:"shallow",strict:!1},K3t=(t,e)=>{const n=typeof t=="function"?t(e):t;return GUe(n)?n:new O1e({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function q3t(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:o,height:r,top:i,left:a,updateStyle:l=n}=e;return{width:o,height:r,top:i,left:a,updateStyle:l}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:o,height:r,top:i,left:a}=t.parentElement.getBoundingClientRect();return{width:o,height:r,top:i,left:a,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function $3t(t){const e=lR.get(t),n=e==null?void 0:e.fiber,o=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,i=o||V3t(op,q8e),a=n||cG.createContainer(i,ZP.ConcurrentRoot,null,!1,null,"",r,null);e||lR.set(t,{fiber:a,store:i});let l,s=!1,c;return{configure(u={}){let{gl:d,size:f,scene:p,events:g,onCreated:A,shadows:y=!1,linear:S=!1,flat:C=!1,legacy:P=!1,orthographic:v=!1,frameloop:T="always",dpr:w=[1,2],performance:x,raycaster:b,camera:R,onPointerMissed:H}=u,F=i.getState(),E=F.gl;F.gl||F.set({gl:E=K3t(d,t)});let N=F.raycaster;N||F.set({raycaster:N=new l0});const{params:U,...W}=b||{};if(pc.equ(W,N,RT)||CT(N,{...W}),pc.equ(U,N.params,RT)||CT(N,{params:{...N.params,...U}}),!F.camera||F.camera===c&&!pc.equ(c,R,RT)){c=R;const V=R instanceof iW,G=V?R:v?new lW(0,0,0,0,.1,1e3):new zu(75,0,.1,1e3);V||(G.position.z=5,R&&CT(G,R),!F.camera&&!(R!=null&&R.rotation)&&G.lookAt(0,0,0)),F.set({camera:G}),N.camera=G}if(!F.scene){let V;p instanceof aG?V=p:(V=new aG,p&&CT(V,p)),F.set({scene:sP(V)})}if(!F.xr){var k;const V=($,ie)=>{const Q=i.getState();Q.frameloop!=="never"&&q8e($,!0,Q,ie)},G=()=>{const $=i.getState();$.gl.xr.enabled=$.gl.xr.isPresenting,$.gl.xr.setAnimationLoop($.gl.xr.isPresenting?V:null),$.gl.xr.isPresenting||op($)},q={connect(){const $=i.getState().gl;$.xr.addEventListener("sessionstart",G),$.xr.addEventListener("sessionend",G)},disconnect(){const $=i.getState().gl;$.xr.removeEventListener("sessionstart",G),$.xr.removeEventListener("sessionend",G)}};typeof((k=E.xr)==null?void 0:k.addEventListener)=="function"&&q.connect(),F.set({xr:q})}if(E.shadowMap){const V=E.shadowMap.enabled,G=E.shadowMap.type;if(E.shadowMap.enabled=!!y,pc.boo(y))E.shadowMap.type=pE;else if(pc.str(y)){var D;const q={basic:RWe,percentage:aq,soft:pE,variance:l2};E.shadowMap.type=(D=q[y])!=null?D:pE}else pc.obj(y)&&Object.assign(E.shadowMap,y);(V!==E.shadowMap.enabled||G!==E.shadowMap.type)&&(E.shadowMap.needsUpdate=!0)}const L=NUe();L&&("enabled"in L?L.enabled=!P:"legacyMode"in L&&(L.legacyMode=P)),CT(E,{outputEncoding:S?3e3:3001,toneMapping:C?T9:P1e}),F.legacy!==P&&F.set(()=>({legacy:P})),F.linear!==S&&F.set(()=>({linear:S})),F.flat!==C&&F.set(()=>({flat:C})),d&&!pc.fun(d)&&!GUe(d)&&!pc.equ(d,E,RT)&&CT(E,d),g&&!F.events.handlers&&F.set({events:g(i)});const O=q3t(t,f);return pc.equ(O,F.size,RT)||F.setSize(O.width,O.height,O.updateStyle,O.top,O.left),w&&F.viewport.dpr!==OUe(w)&&F.setDpr(w),F.frameloop!==T&&F.setFrameloop(T),F.onPointerMissed||F.set({onPointerMissed:H}),x&&!pc.equ(x,F.performance,RT)&&F.set(V=>({performance:{...V.performance,...x}})),l=A,s=!0,this},render(u){return s||this.configure(),cG.updateContainer(m.createElement(Q3t,{store:i,children:u,onCreated:l,rootElement:t}),a,null,()=>{}),i},unmount(){qUe(t)}}}function Q3t({store:t,children:e,onCreated:n,rootElement:o}){return fW(()=>{const r=t.getState();r.set(i=>({internal:{...i.internal,active:!0}})),n&&n(r),t.getState().events.connected||r.events.connect==null||r.events.connect(o)},[]),m.createElement(XUe.Provider,{value:t},e)}function qUe(t,e){const n=lR.get(t),o=n==null?void 0:n.fiber;if(o){const r=n==null?void 0:n.store.getState();r&&(r.internal.active=!1),cG.updateContainer(null,o,null,()=>{r&&setTimeout(()=>{try{var i,a,l,s;r.events.disconnect==null||r.events.disconnect(),(i=r.gl)==null||(a=i.renderLists)==null||a.dispose==null||a.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(s=r.gl)!=null&&s.xr&&r.xr.disconnect(),N3t(r),lR.delete(t)}catch{}},500)})}}cG.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:m.version});function uG(){return uG=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0?o=setTimeout(s,e-u):(o=null,n||(l=t.apply(i,r),i=r=null))}var c=function(){i=this,r=arguments,a=Date.now();var u=n&&!o;return o||(o=setTimeout(s,e)),u&&(l=t.apply(i,r),i=r=null),l};return c.clear=function(){o&&(clearTimeout(o),o=null)},c.flush=function(){o&&(l=t.apply(i,r),i=r=null,clearTimeout(o),o=null)},c}kce.debounce=kce;var Z3t=kce;const $8e=Wi(Z3t);function e6t(t){let{debounce:e,scroll:n,polyfill:o,offsetSize:r}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const i=o||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=m.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),s=m.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,d=m.useRef(!1);m.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,p,g]=m.useMemo(()=>{const C=()=>{if(!s.current.element)return;const{left:P,top:v,width:T,height:w,bottom:x,right:b,x:R,y:H}=s.current.element.getBoundingClientRect(),F={left:P,top:v,width:T,height:w,bottom:x,right:b,x:R,y:H};s.current.element instanceof HTMLElement&&r&&(F.height=s.current.element.offsetHeight,F.width=s.current.element.offsetWidth),Object.freeze(F),d.current&&!r6t(s.current.lastBounds,F)&&l(s.current.lastBounds=F)};return[C,u?$8e(C,u):C,c?$8e(C,c):C]},[l,r,c,u]);function A(){s.current.scrollContainers&&(s.current.scrollContainers.forEach(C=>C.removeEventListener("scroll",g,!0)),s.current.scrollContainers=null),s.current.resizeObserver&&(s.current.resizeObserver.disconnect(),s.current.resizeObserver=null)}function y(){s.current.element&&(s.current.resizeObserver=new i(g),s.current.resizeObserver.observe(s.current.element),n&&s.current.scrollContainers&&s.current.scrollContainers.forEach(C=>C.addEventListener("scroll",g,{capture:!0,passive:!0})))}const S=C=>{!C||C===s.current.element||(A(),s.current.element=C,s.current.scrollContainers=$Ue(C),y())};return n6t(g,!!n),t6t(p),m.useEffect(()=>{A(),y()},[n,g,p]),m.useEffect(()=>A,[]),[S,a,f]}function t6t(t){m.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function n6t(t,e){m.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function $Ue(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:o,overflowY:r}=window.getComputedStyle(t);return[n,o,r].some(i=>i==="auto"||i==="scroll")&&e.push(t),[...e,...$Ue(t.parentElement)]}const o6t=["x","y","top","bottom","left","right","width","height"],r6t=(t,e)=>o6t.every(n=>t[n]===e[n]);var i6t=Object.defineProperty,a6t=Object.defineProperties,l6t=Object.getOwnPropertyDescriptors,Q8e=Object.getOwnPropertySymbols,s6t=Object.prototype.hasOwnProperty,c6t=Object.prototype.propertyIsEnumerable,Z8e=(t,e,n)=>e in t?i6t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ewe=(t,e)=>{for(var n in e||(e={}))s6t.call(e,n)&&Z8e(t,n,e[n]);if(Q8e)for(var n of Q8e(e))c6t.call(e,n)&&Z8e(t,n,e[n]);return t},u6t=(t,e)=>a6t(t,l6t(e));function QUe(t,e,n){if(!t)return;if(n(t)===!0)return t;let o=t.child;for(;o;){const r=QUe(o,e,n);if(r)return r;o=o.sibling}}function ZUe(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const fge=ZUe(m.createContext(null));class eje extends m.Component{render(){return m.createElement(fge.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:twe,ReactCurrentDispatcher:nwe}=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function d6t(){const t=m.useContext(fge);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=m.useId();return m.useMemo(()=>{for(const o of[twe==null?void 0:twe.current,t,t==null?void 0:t.alternate]){if(!o)continue;const r=QUe(o,!1,i=>{let a=i.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[t,e])}function f6t(){var t,e;const n=d6t(),[o]=m.useState(()=>new Map);o.clear();let r=n;for(;r;){const i=(t=r.type)==null?void 0:t._context;i&&i!==fge&&!o.has(i)&&o.set(i,(e=nwe==null?void 0:nwe.current)==null?void 0:e.readContext(ZUe(i))),r=r.return}return o}function h6t(){const t=f6t();return m.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>o=>m.createElement(e,null,m.createElement(n.Provider,u6t(ewe({},o),{value:t.get(n)}))),e=>m.createElement(eje,ewe({},e))),[t])}const yre={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function p6t(t){const{handlePointer:e}=O3t(t);return{priority:1,enabled:!0,compute(n,o,r){o.pointer.set(n.offsetX/o.size.width*2-1,-(n.offsetY/o.size.height)*2+1),o.raycaster.setFromCamera(o.pointer,o.camera)},connected:void 0,handlers:Object.keys(yre).reduce((n,o)=>({...n,[o]:e(o)}),{}),update:()=>{var n;const{events:o,internal:r}=t.getState();(n=r.lastEvent)!=null&&n.current&&o.handlers&&o.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{var o;const{set:r,events:i}=t.getState();i.disconnect==null||i.disconnect(),r(a=>({events:{...a.events,connected:n}})),Object.entries((o=i.handlers)!=null?o:[]).forEach(([a,l])=>{const[s,c]=yre[a];n.addEventListener(s,l,{passive:c})})},disconnect:()=>{const{set:n,events:o}=t.getState();if(o.connected){var r;Object.entries((r=o.handlers)!=null?r:[]).forEach(([i,a])=>{if(o&&o.connected instanceof HTMLElement){const[l]=yre[i];o.connected.removeEventListener(l,a)}}),n(i=>({events:{...i.events,connected:void 0}}))}}}}const g6t=m.forwardRef(function({children:e,fallback:n,resize:o,style:r,gl:i,events:a=p6t,eventSource:l,eventPrefix:s,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:g,dpr:A,performance:y,raycaster:S,camera:C,scene:P,onPointerMissed:v,onCreated:T,...w},x){m.useMemo(()=>Rb(S3t),[]);const b=h6t(),[R,H]=e6t({scroll:!0,debounce:{scroll:50,resize:0},...o}),F=m.useRef(null),E=m.useRef(null);m.useImperativeHandle(x,()=>F.current);const N=jUe(v),[U,W]=m.useState(!1),[k,D]=m.useState(!1);if(U)throw U;if(k)throw k;const L=m.useRef(null);fW(()=>{const B=F.current;H.width>0&&H.height>0&&B&&(L.current||(L.current=$3t(B)),L.current.configure({gl:i,events:a,shadows:c,linear:u,flat:d,legacy:f,orthographic:p,frameloop:g,dpr:A,performance:y,raycaster:S,camera:C,scene:P,size:H,onPointerMissed:(...O)=>N.current==null?void 0:N.current(...O),onCreated:O=>{O.events.connect==null||O.events.connect(l?F3t(l)?l.current:l:E.current),s&&O.setEvents({compute:(V,G)=>{const q=V[s+"X"],$=V[s+"Y"];G.pointer.set(q/G.size.width*2-1,-($/G.size.height)*2+1),G.raycaster.setFromCamera(G.pointer,G.camera)}}),T==null||T(O)}}),L.current.render(m.createElement(b,null,m.createElement(BUe,{set:D},m.createElement(m.Suspense,{fallback:m.createElement(k3t,{set:W})},e)))))}),m.useEffect(()=>{const B=F.current;if(B)return()=>qUe(B)},[]);const j=l?"none":"auto";return m.createElement("div",uG({ref:E,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...r}},w),m.createElement("div",{ref:R,style:{width:"100%",height:"100%"}},m.createElement("canvas",{ref:F,style:{display:"block"}},n)))}),m6t=m.forwardRef(function(e,n){return m.createElement(eje,null,m.createElement(g6t,uG({},e,{ref:n})))});function y6t(t,e,n){return e=dG(e),C6t(t,tje()?Reflect.construct(e,n||[],dG(t).constructor):e.apply(t,n))}function tje(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tje=function(){return!!t})()}function A6t(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function w6t(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function v6t(t){var e=w6t(t,"string");return typeof e=="symbol"?e:String(e)}function x6t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b6t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"rgba(255, 255, 255, 1)";return x6t(this,e),n=y6t(this,e,[new HT.SpriteMaterial]),n._text="".concat(o),n._textHeight=r,n._color=i,n._backgroundColor=!1,n._padding=0,n._borderWidth=0,n._borderRadius=0,n._borderColor="white",n._strokeWidth=0,n._strokeColor="white",n._fontFace="system-ui",n._fontSize=90,n._fontWeight="normal",n._canvas=document.createElement("canvas"),n._genCanvas(),n}return S6t(e,[{key:"text",get:function(){return this._text},set:function(o){this._text=o,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(o){this._textHeight=o,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(o){this._color=o,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(o){this._backgroundColor=o,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(o){this._padding=o,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(o){this._borderWidth=o,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(o){this._borderRadius=o,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(o){this._borderColor=o,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(o){this._fontFace=o,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(o){this._fontSize=o,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(o){this._fontWeight=o,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(o){this._strokeWidth=o,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(o){this._strokeColor=o,this._genCanvas()}},{key:"_genCanvas",value:function(){var o=this,r=this._canvas,i=r.getContext("2d"),a=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],l=a.map(function(x){return x*o.fontSize*.1}),s=Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius],c=s.map(function(x){return x*o.fontSize*.1}),u=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],d=u.map(function(x){return x*o.fontSize*.1}),f=this.text.split(` -`),p="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);i.font=p;var g=Math.max.apply(Math,sY(f.map(function(x){return i.measureText(x).width}))),A=this.fontSize*f.length;if(r.width=g+l[0]*2+d[0]*2,r.height=A+l[1]*2+d[1]*2,this.borderWidth){if(i.strokeStyle=this.borderColor,l[0]){var y=l[0]/2;i.lineWidth=l[0],i.beginPath(),i.moveTo(y,c[0]),i.lineTo(y,r.height-c[3]),i.moveTo(r.width-y,c[1]),i.lineTo(r.width-y,r.height-c[2]),i.stroke()}if(l[1]){var S=l[1]/2;i.lineWidth=l[1],i.beginPath(),i.moveTo(Math.max(l[0],c[0]),S),i.lineTo(r.width-Math.max(l[0],c[1]),S),i.moveTo(Math.max(l[0],c[3]),r.height-S),i.lineTo(r.width-Math.max(l[0],c[2]),r.height-S),i.stroke()}if(this.borderRadius){var C=Math.max.apply(Math,sY(l)),P=C/2;i.lineWidth=C,i.beginPath(),[!!c[0]&&[c[0],P,P,c[0]],!!c[1]&&[r.width-c[1],r.width-P,P,c[1]],!!c[2]&&[r.width-c[2],r.width-P,r.height-P,r.height-c[2]],!!c[3]&&[c[3],P,r.height-P,r.height-c[3]]].filter(function(x){return x}).forEach(function(x){var b=owe(x,4),R=b[0],H=b[1],F=b[2],E=b[3];i.moveTo(R,F),i.quadraticCurveTo(H,F,H,E)}),i.stroke()}}this.backgroundColor&&(i.fillStyle=this.backgroundColor,this.borderRadius?(i.beginPath(),i.moveTo(l[0],c[0]),[[l[0],c[0],r.width-c[1],l[1],l[1],l[1]],[r.width-l[0],r.width-l[0],r.width-l[0],l[1],c[1],r.height-c[2]],[r.width-l[0],r.width-c[2],c[3],r.height-l[1],r.height-l[1],r.height-l[1]],[l[0],l[0],l[0],r.height-l[1],r.height-c[3],c[0]]].forEach(function(x){var b=owe(x,6),R=b[0],H=b[1],F=b[2],E=b[3],N=b[4],U=b[5];i.quadraticCurveTo(R,E,H,N),i.lineTo(F,U)}),i.closePath(),i.fill()):i.fillRect(l[0],l[1],r.width-l[0]*2,r.height-l[1]*2)),i.translate.apply(i,sY(l)),i.translate.apply(i,sY(d)),i.font=p,i.fillStyle=this.color,i.textBaseline="bottom";var v=this.strokeWidth>0;v&&(i.lineWidth=this.strokeWidth*this.fontSize/10,i.strokeStyle=this.strokeColor),f.forEach(function(x,b){var R=(g-i.measureText(x).width)/2,H=(b+1)*o.fontSize;v&&i.strokeText(x,R,H),i.fillText(x,R,H)}),this.material.map&&this.material.map.dispose();var T=this.material.map=new HT.Texture(r);T.minFilter=HT.LinearFilter,T.colorSpace=HT.SRGBColorSpace,T.needsUpdate=!0;var w=this.textHeight*f.length+a[1]*2+u[1]*2;this.scale.set(w*r.width/r.height,w,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(o){return HT.Sprite.prototype.copy.call(this,o),this.color=o.color,this.backgroundColor=o.backgroundColor,this.padding=o.padding,this.borderWidth=o.borderWidth,this.borderColor=o.borderColor,this.fontFace=o.fontFace,this.fontSize=o.fontSize,this.fontWeight=o.fontWeight,this.strokeWidth=o.strokeWidth,this.strokeColor=o.strokeColor,this}}]),e}(HT.Sprite);const G7={type:"change"},Are={type:"start"},X7={type:"end"};class E6t extends e3{constructor(e,n){super(),n===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new ae,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.moveSpeed=1,this.turnSpeed=1,this.keys={MOVE_LEFT:"KeyA",MOVE_RIGHT:"KeyD",MOVE_FORWARD:"KeyW",MOVE_BACKWARD:"KeyS",MOVE_UP:"KeyZ",MOVE_DOWN:"KeyX",ROTATE_LEFT:"ArrowLeft",ROTATE_UP:"ArrowUp",ROTATE_RIGHT:"ArrowRight",ROTATE_DOWN:"ArrowDown"},this.mouseButtons={LEFT:uv.ROTATE,MIDDLE:uv.DOLLY,RIGHT:uv.PAN},this.touches={ONE:dv.ROTATE,TWO:dv.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(We){We.addEventListener("keydown",Pe),this._domElementKeyEvents=We,x=!1,b=0},this.removeKeyEvents=function(){o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Pe)},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(G7),o.update(),i=r.NONE},this.update=function(){const We=new ae,Ee=new Ts().setFromUnitVectors(e.up,new ae(0,1,0)),ke=Ee.clone().invert(),Oe=new ae,st=new Ts,je=2*Math.PI;return function(){const gt=o.object.position;We.copy(gt).sub(o.target),We.applyQuaternion(Ee),l.setFromVector3(We),o.autoRotate&&i===r.NONE&&F(R()),o.enableDamping?(l.theta+=s.theta*o.dampingFactor,l.phi+=s.phi*o.dampingFactor):(l.theta+=s.theta,l.phi+=s.phi);let Ye=o.minAzimuthAngle,it=o.maxAzimuthAngle;return isFinite(Ye)&&isFinite(it)&&(Ye<-Math.PI?Ye+=je:Ye>Math.PI&&(Ye-=je),it<-Math.PI?it+=je:it>Math.PI&&(it-=je),Ye<=it?l.theta=Math.max(Ye,Math.min(it,l.theta)):l.theta=l.theta>(Ye+it)/2?Math.max(Ye,l.theta):Math.min(it,l.theta)),l.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=c,l.radius=Math.max(o.minDistance,Math.min(o.maxDistance,l.radius)),o.enableDamping===!0?o.target.addScaledVector(u,o.dampingFactor):o.target.add(u),We.setFromSpherical(l),We.applyQuaternion(ke),gt.copy(o.target).add(We),o.object.lookAt(o.target),o.enableDamping===!0?(s.theta*=1-o.dampingFactor,s.phi*=1-o.dampingFactor,u.multiplyScalar(1-o.dampingFactor)):(s.set(0,0,0),u.set(0,0,0)),c=1,d||Oe.distanceToSquared(o.object.position)>a||8*(1-st.dot(o.object.quaternion))>a?(o.dispatchEvent(G7),Oe.copy(o.object.position),st.copy(o.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){o.domElement.removeEventListener("contextmenu",ze),o.domElement.removeEventListener("pointerdown",Re),o.domElement.removeEventListener("pointercancel",ue),o.domElement.removeEventListener("wheel",we),o.domElement.removeEventListener("pointermove",De),o.domElement.removeEventListener("pointerup",Ae),o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Pe)};const o=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const a=1e-6,l=new zce,s=new zce;let c=1;const u=new ae;let d=!1;const f=new Kt,p=new Kt,g=new Kt,A=new Kt,y=new Kt,S=new Kt,C=new Kt,P=new Kt,v=new Kt,T=[],w={};let x=!1,b=0;function R(){return 2*Math.PI/60/60*o.autoRotateSpeed}function H(){return Math.pow(.95,o.zoomSpeed)}function F(We){s.theta-=We}function E(We){s.phi-=We}const N=function(){const We=new ae;return function(ke,Oe){We.setFromMatrixColumn(Oe,0),We.multiplyScalar(-ke),u.add(We)}}(),U=function(){const We=new ae;return function(ke,Oe){o.screenSpacePanning===!0?We.setFromMatrixColumn(Oe,1):(We.setFromMatrixColumn(Oe,0),We.crossVectors(o.object.up,We)),We.multiplyScalar(ke),u.add(We)}}(),W=function(){const We=new ae;return function(ke,Oe){const st=o.domElement;if(o.object.isPerspectiveCamera){const je=o.object.position;We.copy(je).sub(o.target);let xt=We.length();xt*=Math.tan(o.object.fov/2*Math.PI/180),N(2*ke*xt/st.clientHeight,o.object.matrix),U(2*Oe*xt/st.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(N(ke*(o.object.right-o.object.left)/o.object.zoom/st.clientWidth,o.object.matrix),U(Oe*(o.object.top-o.object.bottom)/o.object.zoom/st.clientHeight,o.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)}}(),k=function(){const We=new ae;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,1),We.multiplyScalar(ke*.1),Oe.position.add(We),Oe.position.z=Math.max(0,Oe.position.z),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),D=function(){const We=new ae;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,0),We.crossVectors(Oe.up,We),We.multiplyScalar(ke*.1),Oe.position.add(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),L=function(){const We=new ae;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,0),We.multiplyScalar(ke*.1),Oe.position.add(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),j=function(){const We=new ln(0,0,0,"ZXY");return function(ke){const Oe=o.object;We.setFromQuaternion(Oe.quaternion),Math.abs(Math.abs(We.z-b)-Math.PI)<.01&&(x=!x),x?We.x-=.01*ke:We.x+=.01*ke,We.x=Math.max(.1,We.x),b=We.z,Oe.quaternion.setFromEuler(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),B=function(){const We=new ln(0,0,0,"ZXY");return function(ke){const Oe=o.object;We.setFromQuaternion(Oe.quaternion),We.z-=.01*ke,Oe.quaternion.setFromEuler(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}();function O(We){o.object.isPerspectiveCamera?c/=We:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*We)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function V(We){o.object.isPerspectiveCamera?c*=We:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/We)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function G(We){f.set(We.clientX,We.clientY)}function q(We){C.set(We.clientX,We.clientY)}function $(We){A.set(We.clientX,We.clientY)}function ie(We){p.set(We.clientX,We.clientY),g.subVectors(p,f).multiplyScalar(o.rotateSpeed);const Ee=o.domElement;F(2*Math.PI*g.x/Ee.clientHeight),E(2*Math.PI*g.y/Ee.clientHeight),f.copy(p),o.update()}function Q(We){P.set(We.clientX,We.clientY),v.subVectors(P,C),v.y>0?O(H()):v.y<0&&V(H()),C.copy(P),o.update()}function se(We){y.set(We.clientX,We.clientY),S.subVectors(y,A).multiplyScalar(o.panSpeed),W(S.x,S.y),A.copy(y),o.update()}function Z(We){We.deltaY<0?V(H()):We.deltaY>0&&O(H()),o.update()}function ee(We){switch(We.code){case o.keys.MOVE_FORWARD:D(o.moveSpeed);break;case o.keys.MOVE_BACKWARD:D(-o.moveSpeed);break;case o.keys.MOVE_UP:k(o.moveSpeed);break;case o.keys.MOVE_DOWN:k(-o.moveSpeed);break;case o.keys.MOVE_RIGHT:L(o.moveSpeed);break;case o.keys.MOVE_LEFT:L(-o.moveSpeed);break;case o.keys.ROTATE_UP:j(o.turnSpeed);break;case o.keys.ROTATE_DOWN:j(-o.turnSpeed);break;case o.keys.ROTATE_LEFT:B(-o.turnSpeed);break;case o.keys.ROTATE_RIGHT:B(o.turnSpeed);break}}function te(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const We=.5*(T[0].pageX+T[1].pageX),Ee=.5*(T[0].pageY+T[1].pageY);f.set(We,Ee)}}function oe(){if(T.length===1)A.set(T[0].pageX,T[0].pageY);else{const We=.5*(T[0].pageX+T[1].pageX),Ee=.5*(T[0].pageY+T[1].pageY);A.set(We,Ee)}}function de(){const We=T[0].pageX-T[1].pageX,Ee=T[0].pageY-T[1].pageY,ke=Math.sqrt(We*We+Ee*Ee);C.set(0,ke)}function he(){o.enableZoom&&de(),o.enablePan&&oe()}function pe(){o.enableZoom&&de(),o.enableRotate&&te()}function me(We){if(T.length===1)p.set(We.pageX,We.pageY);else{const ke=nt(We),Oe=.5*(We.pageX+ke.x),st=.5*(We.pageY+ke.y);p.set(Oe,st)}g.subVectors(p,f).multiplyScalar(o.rotateSpeed);const Ee=o.domElement;F(2*Math.PI*g.x/Ee.clientHeight),E(2*Math.PI*g.y/Ee.clientHeight),f.copy(p)}function le(We){if(T.length===1)y.set(We.pageX,We.pageY);else{const Ee=nt(We),ke=.5*(We.pageX+Ee.x),Oe=.5*(We.pageY+Ee.y);y.set(ke,Oe)}S.subVectors(y,A).multiplyScalar(o.panSpeed),W(S.x,S.y),A.copy(y)}function Te(We){const Ee=nt(We),ke=We.pageX-Ee.x,Oe=We.pageY-Ee.y,st=Math.sqrt(ke*ke+Oe*Oe);P.set(0,st),v.set(0,Math.pow(P.y/C.y,o.zoomSpeed)),O(v.y),C.copy(P)}function ge(We){o.enableZoom&&Te(We),o.enablePan&&le(We)}function Se(We){o.enableZoom&&Te(We),o.enableRotate&&me(We)}function Re(We){o.enabled!==!1&&(T.length===0&&(o.domElement.setPointerCapture(We.pointerId),o.domElement.addEventListener("pointermove",De),o.domElement.addEventListener("pointerup",Ae)),Ne(We),We.pointerType==="touch"?Ie(We):fe(We))}function De(We){o.enabled!==!1&&(We.pointerType==="touch"?Me(We):ve(We))}function Ae(We){Je(We),T.length===0&&(o.domElement.releasePointerCapture(We.pointerId),o.domElement.removeEventListener("pointermove",De),o.domElement.removeEventListener("pointerup",Ae)),o.dispatchEvent(X7),i=r.NONE}function ue(We){Je(We)}function fe(We){let Ee;switch(We.button){case 0:Ee=o.mouseButtons.LEFT;break;case 1:Ee=o.mouseButtons.MIDDLE;break;case 2:Ee=o.mouseButtons.RIGHT;break;default:Ee=-1}switch(Ee){case uv.DOLLY:if(o.enableZoom===!1)return;q(We),i=r.DOLLY;break;case uv.ROTATE:if(o.object.isOrthographicCamera){if(o.enablePan===!1)return;$(We),i=r.PAN}else if(We.ctrlKey||We.metaKey){if(o.enablePan===!1)return;$(We),i=r.PAN}else{if(o.enableRotate===!1)return;G(We),i=r.ROTATE}break;case uv.PAN:if(We.ctrlKey||We.metaKey){if(o.enableRotate===!1)return;G(We),i=r.ROTATE}else{if(o.enablePan===!1)return;$(We),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(Are)}function ve(We){if(o.enabled!==!1)switch(i){case r.ROTATE:if(o.enableRotate===!1)return;ie(We);break;case r.DOLLY:if(o.enableZoom===!1)return;Q(We);break;case r.PAN:if(o.enablePan===!1)return;se(We);break}}function we(We){o.enabled===!1||o.enableZoom===!1||i!==r.NONE||(We.preventDefault(),o.dispatchEvent(Are),Z(We),o.dispatchEvent(X7))}function Pe(We){o.enabled===!1||o.enablePan===!1||ee(We)}function Ie(We){switch(Ue(We),T.length){case 1:switch(o.touches.ONE){case dv.ROTATE:if(o.enableRotate===!1)return;te(),i=r.TOUCH_ROTATE;break;case dv.PAN:if(o.enablePan===!1)return;oe(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(o.touches.TWO){case dv.DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;he(),i=r.TOUCH_DOLLY_PAN;break;case dv.DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;pe(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(Are)}function Me(We){switch(Ue(We),i){case r.TOUCH_ROTATE:if(o.enableRotate===!1)return;me(We),o.update();break;case r.TOUCH_PAN:if(o.enablePan===!1)return;le(We),o.update();break;case r.TOUCH_DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;ge(We),o.update();break;case r.TOUCH_DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;Se(We),o.update();break;default:i=r.NONE}}function ze(We){o.enabled!==!1&&We.preventDefault()}function Ne(We){T.push(We)}function Je(We){delete w[We.pointerId];for(let Ee=0;Ee=4){this.makeEmpty();for(let n=0,o=e.length;nthis.tolerance)return!1;return!0}intersectRay(e,n){const o=this.faces;let r=-1/0,i=1/0;for(let a=0,l=o.length;a0&&u>=0)return null;const d=u!==0?-c/u:0;if(!(d<=0)&&(u>0?i=Math.min(d,i):r=Math.max(d,r),r>i))return null}return r!==-1/0?e.at(r,n):e.at(i,n),n}intersectsRay(e){return this.intersectRay(e,k6t)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,n){return e.face=n,n.outside===null?this.assigned.append(e):this.assigned.insertBefore(n.outside,e),n.outside=e,this}removeVertexFromFace(e,n){return e===n.outside&&(e.next!==null&&e.next.face===n?n.outside=e.next:n.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const n=e.outside;let o=e.outside;for(;o.next!==null&&o.next.face===e;)o=o.next;return this.assigned.removeSubList(n,o),n.prev=o.next=null,e.outside=null,n}}deleteFaceVertices(e,n){const o=this.removeAllVerticesFromFace(e);if(o!==void 0)if(n===void 0)this.unassigned.appendChain(o);else{let r=o;do{const i=r.next;n.distanceToPoint(r.point)>this.tolerance?this.addVertexToFace(r,n):this.unassigned.append(r),r=i}while(r!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let n=this.unassigned.first();do{const o=n.next;let r=this.tolerance,i=null;for(let a=0;ar&&(r=s,i=l),r>1e3*this.tolerance)break}}i!==null&&this.addVertexToFace(n,i),n=o}while(n!==null)}return this}computeExtremes(){const e=new ae,n=new ae,o=[],r=[];for(let i=0;i<3;i++)o[i]=r[i]=this.vertices[0];e.copy(this.vertices[0].point),n.copy(this.vertices[0].point);for(let i=0,a=this.vertices.length;in.getComponent(c)&&(n.setComponent(c,s.getComponent(c)),r[c]=l)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(n.x))+Math.max(Math.abs(e.y),Math.abs(n.y))+Math.max(Math.abs(e.z),Math.abs(n.z))),{min:o,max:r}}computeInitialHull(){const e=this.vertices,n=this.computeExtremes(),o=n.min,r=n.max;let i=0,a=0;for(let f=0;f<3;f++){const p=r[f].point.getComponent(f)-o[f].point.getComponent(f);p>i&&(i=p,a=f)}const l=o[a],s=r[a];let c,u;i=0,rwe.set(l.point,s.point);for(let f=0,p=this.vertices.length;fi&&(i=A,c=g)}}i=-1,wre.setFromCoplanarPoints(l.point,s.point,c.point);for(let f=0,p=this.vertices.length;fi&&(i=A,u=g)}}const d=[];if(wre.distanceToPoint(u.point)<0){d.push(o2.create(l,s,c),o2.create(u,s,l),o2.create(u,c,s),o2.create(u,l,c));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge(p)),d[f+1].getEdge(1).setTwin(d[p+1].getEdge(0))}}else{d.push(o2.create(l,c,s),o2.create(u,l,s),o2.create(u,s,c),o2.create(u,c,l));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge((3-f)%3)),d[f+1].getEdge(0).setTwin(d[p+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(d[f]);for(let f=0,p=e.length;fi&&(i=S,A=this.faces[y])}A!==null&&this.addVertexToFace(g,A)}}return this}reindexFaces(){const e=[];for(let n=0;nn&&(n=i,e=r),r=r.next}while(r!==null&&r.face===o);return e}}computeHorizon(e,n,o,r){this.deleteFaceVertices(o),o.mark=F6t;let i;n===null?i=n=o.getEdge(0):i=n.next;do{const a=i.twin,l=a.face;l.mark===kV&&(l.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,a,l,r):r.push(i)),i=i.next}while(i!==n);return this}addAdjoiningFace(e,n){const o=o2.create(e,n.tail(),n.head());return this.faces.push(o),o.getEdge(-1).setTwin(n.twin),o.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let o=null,r=null;for(let i=0;i0;)n=n.next,e--;for(;e<0;)n=n.prev,e++;return n}compute(){const e=this.edge.tail(),n=this.edge.head(),o=this.edge.next.head();return cY.set(e.point,n.point,o.point),cY.getNormal(this.normal),cY.getMidpoint(this.midpoint),this.area=cY.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class vre{constructor(e,n){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=n}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class W6t{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class awe{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,n){return n.prev=e.prev,n.next=e,n.prev===null?this.head=n:n.prev.next=n,e.prev=n,this}insertAfter(e,n){return n.prev=e,n.next=e.next,n.next===null?this.tail=n:n.next.prev=n,e.next=n,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,n){return e.prev===null?this.head=n.next:e.prev.next=n.next,n.next===null?this.tail=e.prev:n.next.prev=e.prev,this}isEmpty(){return this.head===null}}class Nce extends ji{constructor(e,n,o){super();const r=[],i=[],a=[],l=new ln(0,0,n),c=new L6t().setFromPoints(e).faces;for(let u=0;u(t.FILES="Files",t.LOG_DATA="Log Data",t))(fG||{}),sc=(t=>(t.UNKNOWN="UNKNOWN SCHOOL",t.SCHOOL1="SCHOOL 1",t.SCHOOL2="SCHOOL 2",t.SCHOOL3="SCHOOL 3",t.SCHOOL4="SCHOOL 4",t.SCHOOL5="SCHOOL 5",t))(sc||{}),Oa=(t=>(t.UNKNOWN="UNKNOWN CLASS",t.CLASS1="CLASS 1",t.CLASS2="CLASS 2",t.CLASS3="CLASS 3",t.CLASS4="CLASS 4",t.CLASS5="CLASS 5",t.CLASS6="CLASS 6",t.CLASS7="CLASS 7",t.CLASS8="CLASS 8",t.CLASS9="CLASS 9",t))(Oa||{}),d9=(t=>(t[t.ALL=0]="ALL",t[t.INDIVIDUALS=1]="INDIVIDUALS",t[t.GROUPS=2]="GROUPS",t))(d9||{}),fa=(t=>(t.UNKNOWN="Unknown",t.UNDER_CONSTRUCTION="Under Construction",t.RESIDENTIAL_BUILDING="Residential Building",t.COMMERCIAL_BUILDING="Commercial Building",t.SCHOOL_BUILDING="School Building",t.TOURIST_ATTRACTION="Tourist Attraction",t.PHOTOVOLTAIC="Photovoltaic",t.PARABOLIC_DISH="Parabolic Dish",t.PARABOLIC_TROUGH="Parabolic Trough",t.FRESNEL_REFLECTOR="Fresnel Reflector",t.SOLAR_POWER_TOWER="Solar Power Tower",t.WIND_TURBINE="Wind Turbine",t.COLOCATION_PROJECTS="Colocation Projects",t))(fa||{}),Uc=(t=>(t[t.COMPLETE=0]="COMPLETE",t[t.ROOF_MISSING=1]="ROOF_MISSING",t[t.WALL_DISJOINED=2]="WALL_DISJOINED",t[t.WALL_EMPTY=3]="WALL_EMPTY",t))(Uc||{}),Ri=(t=>(t.SOLAR_PANEL_TILT_ANGLE="Solar Panel Tilt Angle",t.SOLAR_PANEL_ARRAY="Solar Panel Array",t))(Ri||{}),Po=(t=>(t[t.DAILY_TOTAL_OUTPUT=1]="DAILY_TOTAL_OUTPUT",t[t.YEARLY_TOTAL_OUTPUT=2]="YEARLY_TOTAL_OUTPUT",t[t.DAILY_AVERAGE_OUTPUT=3]="DAILY_AVERAGE_OUTPUT",t[t.YEARLY_AVERAGE_OUTPUT=4]="YEARLY_AVERAGE_OUTPUT",t[t.DAILY_PROFIT=5]="DAILY_PROFIT",t[t.YEARLY_PROFIT=6]="YEARLY_PROFIT",t))(Po||{}),_s=(t=>(t[t.GENETIC_ALGORITHM=1]="GENETIC_ALGORITHM",t[t.PARTICLE_SWARM_OPTIMIZATION=2]="PARTICLE_SWARM_OPTIMIZATION",t))(_s||{}),Wm=(t=>(t[t.ROULETTE_WHEEL=1]="ROULETTE_WHEEL",t[t.TOURNAMENT=2]="TOURNAMENT",t))(Wm||{}),ds=(t=>(t[t.GLOBAL_SEARCH_UNIFORM_SELECTION=1]="GLOBAL_SEARCH_UNIFORM_SELECTION",t[t.LOCAL_SEARCH_RANDOM_OPTIMIZATION=2]="LOCAL_SEARCH_RANDOM_OPTIMIZATION",t[t.GLOBAL_SEARCH_FITNESS_SHARING=3]="GLOBAL_SEARCH_FITNESS_SHARING",t))(ds||{}),Xh=(t=>(t[t.Solid=1]="Solid",t[t.Dashed=2]="Dashed",t[t.Dotted=3]="Dotted",t))(Xh||{}),$y=(t=>(t[t.One=1]="One",t[t.Two=2]="Two",t[t.Three=3]="Three",t[t.Four=4]="Four",t[t.Five=5]="Five",t))($y||{}),Il=(t=>(t[t.Line=1]="Line",t[t.Area=2]="Area",t))(Il||{}),vi=(t=>(t[t.HourlyTemperatures=1]="HourlyTemperatures",t[t.MonthlyTemperatures=2]="MonthlyTemperatures",t[t.SunshineHours=3]="SunshineHours",t[t.DaylightData=4]="DaylightData",t[t.ClearnessData=5]="ClearnessData",t[t.YearlyRadiationSensorData=6]="YearlyRadiationSensorData",t[t.DailyRadiationSensorData=7]="DailyRadiationSensorData",t[t.YearlyPvYield=8]="YearlyPvYield",t[t.DailyPvYield=9]="DailyPvYield",t[t.YearlyParabolicTroughYield=10]="YearlyParabolicTroughYield",t[t.DailyParabolicTroughYield=11]="DailyParabolicTroughYield",t[t.YearlyParabolicDishYield=12]="YearlyParabolicDishYield",t[t.DailyParabolicDishYield=13]="DailyParabolicDishYield",t[t.YearlyFresnelReflectorYield=14]="YearlyFresnelReflectorYield",t[t.DailyFresnelReflectorYield=15]="DailyFresnelReflectorYield",t[t.YearlyHeliostatYield=16]="YearlyHeliostatYield",t[t.DailyHeliostatYield=17]="DailyHeliostatYield",t[t.YearlyUpdraftTowerYield=18]="YearlyUpdraftTowerYield",t[t.DailyUpdraftTowerYield=19]="DailyUpdraftTowerYield",t[t.YearlyBuildingEnergy=20]="YearlyBuildingEnergy",t[t.DailyBuildingEnergy=21]="DailyBuildingEnergy",t))(vi||{}),Os=(t=>(t.Default="Default",t.Desert="Desert",t.Dune="Dune",t.Forest="Forest",t.Grassland="Grassland",t.Hill="Hill",t.Lake="Lake",t.Mountain="Mountain",t.Rural="Rural",t))(Os||{}),y2=(t=>(t[t.Sinusoidal=1]="Sinusoidal",t[t.PartonLogan=2]="PartonLogan",t))(y2||{}),s9=(t=>(t.English="English",t.ChineseSimplified="简体中文",t.ChineseTraditional="繁体中文",t.Turkish="Türkçe",t.Spanish="Español",t.Ukrainian="Українська",t))(s9||{}),z=(t=>(t.Sky="Sky",t.Ground="Ground",t.Foundation="Foundation",t.Wall="Wall",t.Window="Window",t.Door="Door",t.Roof="Roof",t.PyramidRoof="Pyramid Roof",t.GableRoof="Gable Roof",t.HipRoof="Hip Roof",t.GambrelRoof="Gambrel Roof",t.MansardRoof="Mansard Roof",t.Sensor="Sensor",t.SolarPanel="Solar Panel",t.SolarWaterHeater="Solar Water Heater",t.ParabolicDish="Parabolic Dish",t.ParabolicTrough="Parabolic Trough",t.FresnelReflector="Fresnel Reflector",t.Heliostat="Heliostat",t.WindTurbine="Wind Turbine",t.VerticalAxisWindTurbine="Vertical Axis Wind Turbine",t.Cuboid="Cuboid",t.Human="Human",t.Tree="Tree",t.Flower="Flower",t.Polygon="Polygon",t.PolygonVertex="Polygon Vertex",t.Light="Light",t.BatteryStorage="Battery Storage",t.None="None",t))(z||{}),sf=(t=>(t[t.CentralPole=1]="CentralPole",t[t.CentralPoleWithTripod=2]="CentralPoleWithTripod",t[t.Quadrupod=3]="Quadrupod",t))(sf||{}),Dn=(t=>(t[t.None=0]="None",t[t.FocusPipe=1]="FocusPipe",t[t.FocusTower=2]="FocusTower",t[t.UpdraftTower=3]="UpdraftTower",t))(Dn||{}),uc=(t=>(t[t.None=0]="None",t[t.Bicolor=1]="Bicolor",t[t.Striped=2]="Striped",t))(uc||{}),Xo=(t=>(t.Select="Select",t.Move="Move",t.Resize="Resize",t.Rotate="Rotate",t.ContextMenu="ContextMenu",t))(Xo||{}),zo=(t=>(t.Default="Move Handle",t.Lower="Move Handle Lower",t.Upper="Move Handle Upper",t.Left="Move Handle Left",t.Right="Move Handle Right",t.Top="Move Handle Top",t.Mid="Move Handle Mid",t))(zo||{}),Sl=(t=>(t.Left="Left",t.Right="Right",t.Up="Up",t.Down="Down",t))(Sl||{}),Mt=(t=>(t.LowerLeft="Resize Handle Lower Left",t.UpperLeft="Resize Handle Upper Left",t.LowerRight="Resize Handle Lower Right",t.UpperRight="Resize Handle Upper Right",t.LowerLeftTop="Resize Handle Lower Left Top",t.UpperLeftTop="Resize Handle Upper Left Top",t.LowerRightTop="Resize Handle Lower Right Top",t.UpperRightTop="Resize Handle Upper Right Top",t.Lower="Resize Handle Lower",t.Upper="Resize Handle Upper",t.Left="Resize Handle Left",t.Right="Resize Handle Right",t.Top="Resize Handle Top",t.Default="Resize Handle",t.Arch="Resize Handle Arch",t.WallPartialResizeLeft="Wall Partial Resize Handle Left",t.WallPartialResizeRight="Wall Partial Resize Handle Right",t.WallPartialResizeLeftTop="Wall Partial Resize Handle Left Top",t.WallPartialResizeRightTop="Wall Partial Resize Handle Right Top",t))(Mt||{}),Di=(t=>(t.Lower="Rotate Handle Lower",t.Upper="Rotate Handle Upper",t.Tilt="Rotate Handle Tilt",t))(Di||{}),hx=(t=>(t.Delete="Delete Vertex",t.InsertBeforeIndex="Insert Vertex Before Index",t.InsertAfterIndex="Insert Vertex After Index",t))(hx||{}),Qf=(t=>(t.Horizontal="Horizontal",t.Vertical="Vertical",t.Ground="Ground",t.Sky="Sky",t))(Qf||{}),re=(t=>(t[t.OnlyThisObject=1]="OnlyThisObject",t[t.AllObjectsOfThisTypeOnSurface=2]="AllObjectsOfThisTypeOnSurface",t[t.AllObjectsOfThisTypeAboveFoundation=3]="AllObjectsOfThisTypeAboveFoundation",t[t.AllObjectsOfThisType=4]="AllObjectsOfThisType",t[t.AllConnectedObjects=5]="AllConnectedObjects",t[t.OnlyThisSide=6]="OnlyThisSide",t[t.AllSelectedObjectsOfThisType=7]="AllSelectedObjectsOfThisType",t))(re||{}),vr=(t=>(t.portrait="Portrait",t.landscape="Landscape",t))(vr||{}),El=(t=>(t.eastWest="East-West",t.northSouth="North-South",t.leftRight="Left-Right",t.upDown="Up-Down",t))(El||{}),Ll=(t=>(t.NO_TRACKER="None",t.HORIZONTAL_SINGLE_AXIS_TRACKER="HSAT",t.ALTAZIMUTH_DUAL_AXIS_TRACKER="AADAT",t.VERTICAL_SINGLE_AXIS_TRACKER="VSAT",t.TILTED_SINGLE_AXIS_TRACKER="TSAT",t))(Ll||{}),m8=(t=>(t.NONE="None",t.HIGH="High",t.PARTIAL="Partial",t))(m8||{}),Em=(t=>(t.EXACT="Exact",t.APPROXIMATE="Approximate",t))(Em||{}),pr=(t=>(t.Apple="Apple",t.Birch="Birch",t.Coconut="Coconut",t.Dogwood="Dogwood",t.Elm="Elm",t.FanPalm="Fan Palm",t.Linden="Linden",t.Magnolia="Magnolia",t.Maple="Maple",t.Oak="Oak",t.Pine="Pine",t.Spruce="Spruce",t))(pr||{}),ro=(t=>(t.Bellflower="Bellflower",t.Boxwood="Boxwood",t.CactusCombo1="Cactus Combo 1",t.CactusCombo2="Cactus Combo 2",t.CactusCombo3="Cactus Combo 3",t.CactusCombo4="Cactus Combo 4",t.Hibiscus="Hibiscus",t.Hosta="Hosta",t.Hydrangea="Hydrangea",t.Peony="Peony",t.RedRose="Red Rose",t.Spirea="Spirea",t.Sunflower="Sunflower",t.TallBush="Tall Bush",t.Tulip="Tulip",t.WhiteFlower="White Flower",t.YellowFlower="Yellow Flower",t))(ro||{}),Ha=(t=>(t.Male="Male",t.Female="Female",t.Other="Other",t))(Ha||{}),Vt=(t=>(t.Jaah="Jaah",t.Jack="Jack",t.Jacob="Jacob",t.Jacqueline="Jacqueline",t.Jade="Jade",t.Jamelia="Jamelia",t.James="James",t.Jane="Jane",t.Jaya="Jaya",t.Jaye="Jaye",t.Jeanette="Jeanette",t.Jedi="Jedi",t.Jeff="Jeff",t.Jena="Jena",t.Jennifer="Jennifer",t.Jess="Jess",t.Jett="Jett",t.Jill="Jill",t.Jiya="Jiya",t.Jocelyn="Jocelyn",t.Joan="Joan",t.Joel="Joel",t.Joey="Joey",t.John="John",t.Jonathon="Jonathon",t.Joseph="Joseph",t.Jose="Jose",t.Joshua="Joshua",t.Judd="Judd",t.Judy="Judy",t.Julia="Julia",t.Julio="Julio",t.Jumapili="Jumapili",t.June="June",t.Juro="Juro",t.Justin="Justin",t))(Vt||{}),Kr=(t=>(t.Texture01="Polygon Texture #1",t.Texture02="Polygon Texture #2",t.Texture03="Polygon Texture #3",t.Texture04="Polygon Texture #4",t.Texture05="Polygon Texture #5",t.Texture06="Polygon Texture #6",t.Texture07="Polygon Texture #7",t.Texture08="Polygon Texture #8",t.Texture09="Polygon Texture #9",t.Texture10="Polygon Texture #10",t.NoTexture="No Polygon Texture",t))(Kr||{}),_i=(t=>(t.Texture01="Foundation Texture #1",t.Texture02="Foundation Texture #2",t.Texture03="Foundation Texture #3",t.Texture04="Foundation Texture #4",t.Texture05="Foundation Texture #5",t.Texture06="Foundation Texture #6",t.Texture07="Foundation Texture #7",t.Texture08="Foundation Texture #8",t.Texture09="Foundation Texture #9",t.Texture10="Foundation Texture #10",t.NoTexture="No Foundation Texture",t))(_i||{}),Ro=(t=>(t.Facade01="Facade #1",t.Facade02="Facade #2",t.Facade03="Facade #3",t.Facade04="Facade #4",t.Facade05="Facade #5",t.Facade06="Facade #6",t.Facade07="Facade #7",t.Facade08="Facade #8",t.Facade09="Facade #9",t.Facade10="Facade #10",t.NoTexture="No Facade Texture",t))(Ro||{}),Bo=(t=>(t.Default="Wall Texture Default",t.Texture01="Wall Texture #1",t.Texture02="Wall Texture #2",t.Texture03="Wall Texture #3",t.Texture04="Wall Texture #4",t.Texture05="Wall Texture #5",t.Texture06="Wall Texture #6",t.Texture07="Wall Texture #7",t.Texture08="Wall Texture #8",t.Texture09="Wall Texture #9",t.Texture10="Wall Texture #10",t.NoTexture="No Wall Texture",t))(Bo||{}),sr=(t=>(t.Default="Door Texture Default",t.Texture01="Door Texture #1",t.Texture02="Door Texture #2",t.Texture03="Door Texture #3",t.Texture04="Door Texture #4",t.Texture05="Door Texture #5",t.Texture06="Door Texture #6",t.Texture07="Door Texture #7",t.Texture08="Door Texture #8",t.Texture09="Door Texture #9",t.Texture10="Door Texture #10",t.Texture11="Door Texture #11",t.Texture12="Door Texture #12",t.Texture13="Door Texture #13",t.Texture14="Door Texture #14",t.Texture15="Door Texture #15",t.Texture16="Door Texture #16",t.Texture17="Door Texture #17",t.NoTexture="No Door Texture",t))(sr||{}),Ur=(t=>(t.Default="Roof Texture Default",t.Texture01="Roof Texture #1",t.Texture02="Roof Texture #2",t.Texture03="Roof Texture #3",t.Texture04="Roof Texture #4",t.Texture05="Roof Texture #5",t.Texture06="Roof Texture #6",t.Texture07="Roof Texture #7",t.NoTexture="No Roof Texture",t))(Ur||{}),V1=(t=>(t.Left="Left",t.Right="Right",t))(V1||{}),pa=(t=>(t.Valid="Valid",t.OverLap="OverLap",t.OutsideBoundary="OutsideBoundary",t.Invalid="Invalid",t))(pa||{}),Lr=(t=>(t.Mid="Mid",t.Left="Left",t.Right="Right",t.TopMid="TopMid",t.TopLeft="TopLeft",t.TopRight="TopRight",t.FrontLeft="FrontLeft",t.FrontRight="FrontRight",t.BackLeft="BackLeft",t.BackRight="BackRight",t.Top="Top",t.Ridge="Ridge",t.Null="Null",t))(Lr||{}),rs=(t=>(t.BUILDING="Building",t.PV="PV",t.CSP="CSP",t.SUT="SUT",t.WIND="Wind",t))(rs||{}),LV={VITE_MAPS_API_KEY:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",VITE_FIREBASE_API_KEY:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",VITE_FIREBASE_AUTH_DOMAIN:"aladdin-316017.firebaseapp.com",VITE_FIREBASE_DATABASE_URL:"https://aladdin-316017.firebaseio.com",VITE_FIREBASE_PROJECT_ID:"aladdin-316017",VITE_FIREBASE_STORAGE_BUCKET:"aladdin-316017.appspot.com",VITE_FIREBASE_MESSAGING_SENDER_ID:"169516488625",VITE_FIREBASE_APP_ID:"1:169516488625:web:bb0ae3c3f7c6e813250f90",VITE_FIREBASE_MEASUREMENT_ID:"G-G0XPQ7JNYJ",VITE_FIREBASE_LOGGER_DATABASE_URL:"https://aladdin-2024.firebaseio.com",VITE_EXAMPLE_PROJECT_OWNER:"QWecNcxhyvP6j6sBN11hBsfZDau1",BASE_URL:"/aladdin",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Uce=new Map,uY=t=>{const e=Uce.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},Y6t=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Uce.get(n.name);if(o)return{type:"tracked",store:t,...o};const r={connection:e.connect(n),stores:{}};return Uce.set(n.name,r),{type:"tracked",store:t,...r}},O6t=(t,e={})=>(n,o,r)=>{const{enabled:i,anonymousActionType:a,store:l,...s}=e;let c;try{c=(i??(LV?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(LV?"production":void 0)!=="production"&&i&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,r);const{connection:u,...d}=Y6t(l,c,s);let f=!0;r.setState=(A,y,S)=>{const C=n(A,y);if(!f)return C;const P=S===void 0?{type:a||"anonymous"}:typeof S=="string"?{type:S}:S;return l===void 0?(u==null||u.send(P,o()),C):(u==null||u.send({...P,type:`${l}/${P.type}`},{...uY(s.name),[l]:r.getState()}),C)};const p=(...A)=>{const y=f;f=!1,n(...A),f=y},g=t(r.setState,o,r);if(d.type==="untracked"?u==null||u.init(g):(d.stores[d.store]=r,u==null||u.init(Object.fromEntries(Object.entries(d.stores).map(([A,y])=>[A,A===d.store?g:y.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let A=!1;const y=r.dispatch;r.dispatch=(...S)=>{(LV?"production":void 0)!=="production"&&S[0].type==="__setState"&&!A&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),A=!0),y(...S)}}return u.subscribe(A=>{var y;switch(A.type){case"ACTION":if(typeof A.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return xre(A.payload,S=>{if(S.type==="__setState"){if(l===void 0){p(S.state);return}Object.keys(S.state).length!==1&&console.error(` +`),p="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);i.font=p;var g=Math.max.apply(Math,sY(f.map(function(x){return i.measureText(x).width}))),A=this.fontSize*f.length;if(r.width=g+l[0]*2+d[0]*2,r.height=A+l[1]*2+d[1]*2,this.borderWidth){if(i.strokeStyle=this.borderColor,l[0]){var y=l[0]/2;i.lineWidth=l[0],i.beginPath(),i.moveTo(y,c[0]),i.lineTo(y,r.height-c[3]),i.moveTo(r.width-y,c[1]),i.lineTo(r.width-y,r.height-c[2]),i.stroke()}if(l[1]){var S=l[1]/2;i.lineWidth=l[1],i.beginPath(),i.moveTo(Math.max(l[0],c[0]),S),i.lineTo(r.width-Math.max(l[0],c[1]),S),i.moveTo(Math.max(l[0],c[3]),r.height-S),i.lineTo(r.width-Math.max(l[0],c[2]),r.height-S),i.stroke()}if(this.borderRadius){var C=Math.max.apply(Math,sY(l)),P=C/2;i.lineWidth=C,i.beginPath(),[!!c[0]&&[c[0],P,P,c[0]],!!c[1]&&[r.width-c[1],r.width-P,P,c[1]],!!c[2]&&[r.width-c[2],r.width-P,r.height-P,r.height-c[2]],!!c[3]&&[c[3],P,r.height-P,r.height-c[3]]].filter(function(x){return x}).forEach(function(x){var b=owe(x,4),R=b[0],H=b[1],F=b[2],E=b[3];i.moveTo(R,F),i.quadraticCurveTo(H,F,H,E)}),i.stroke()}}this.backgroundColor&&(i.fillStyle=this.backgroundColor,this.borderRadius?(i.beginPath(),i.moveTo(l[0],c[0]),[[l[0],c[0],r.width-c[1],l[1],l[1],l[1]],[r.width-l[0],r.width-l[0],r.width-l[0],l[1],c[1],r.height-c[2]],[r.width-l[0],r.width-c[2],c[3],r.height-l[1],r.height-l[1],r.height-l[1]],[l[0],l[0],l[0],r.height-l[1],r.height-c[3],c[0]]].forEach(function(x){var b=owe(x,6),R=b[0],H=b[1],F=b[2],E=b[3],N=b[4],U=b[5];i.quadraticCurveTo(R,E,H,N),i.lineTo(F,U)}),i.closePath(),i.fill()):i.fillRect(l[0],l[1],r.width-l[0]*2,r.height-l[1]*2)),i.translate.apply(i,sY(l)),i.translate.apply(i,sY(d)),i.font=p,i.fillStyle=this.color,i.textBaseline="bottom";var v=this.strokeWidth>0;v&&(i.lineWidth=this.strokeWidth*this.fontSize/10,i.strokeStyle=this.strokeColor),f.forEach(function(x,b){var R=(g-i.measureText(x).width)/2,H=(b+1)*o.fontSize;v&&i.strokeText(x,R,H),i.fillText(x,R,H)}),this.material.map&&this.material.map.dispose();var T=this.material.map=new HT.Texture(r);T.minFilter=HT.LinearFilter,T.colorSpace=HT.SRGBColorSpace,T.needsUpdate=!0;var w=this.textHeight*f.length+a[1]*2+u[1]*2;this.scale.set(w*r.width/r.height,w,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(o){return HT.Sprite.prototype.copy.call(this,o),this.color=o.color,this.backgroundColor=o.backgroundColor,this.padding=o.padding,this.borderWidth=o.borderWidth,this.borderColor=o.borderColor,this.fontFace=o.fontFace,this.fontSize=o.fontSize,this.fontWeight=o.fontWeight,this.strokeWidth=o.strokeWidth,this.strokeColor=o.strokeColor,this}}]),e}(HT.Sprite);const G7={type:"change"},Are={type:"start"},X7={type:"end"};class E6t extends e3{constructor(e,n){super(),n===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new le,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.moveSpeed=1,this.turnSpeed=1,this.keys={MOVE_LEFT:"KeyA",MOVE_RIGHT:"KeyD",MOVE_FORWARD:"KeyW",MOVE_BACKWARD:"KeyS",MOVE_UP:"KeyZ",MOVE_DOWN:"KeyX",ROTATE_LEFT:"ArrowLeft",ROTATE_UP:"ArrowUp",ROTATE_RIGHT:"ArrowRight",ROTATE_DOWN:"ArrowDown"},this.mouseButtons={LEFT:uv.ROTATE,MIDDLE:uv.DOLLY,RIGHT:uv.PAN},this.touches={ONE:dv.ROTATE,TWO:dv.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(We){We.addEventListener("keydown",Pe),this._domElementKeyEvents=We,x=!1,b=0},this.removeKeyEvents=function(){o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Pe)},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(G7),o.update(),i=r.NONE},this.update=function(){const We=new le,Ee=new Ts().setFromUnitVectors(e.up,new le(0,1,0)),ke=Ee.clone().invert(),Oe=new le,st=new Ts,je=2*Math.PI;return function(){const gt=o.object.position;We.copy(gt).sub(o.target),We.applyQuaternion(Ee),l.setFromVector3(We),o.autoRotate&&i===r.NONE&&F(R()),o.enableDamping?(l.theta+=s.theta*o.dampingFactor,l.phi+=s.phi*o.dampingFactor):(l.theta+=s.theta,l.phi+=s.phi);let Ye=o.minAzimuthAngle,it=o.maxAzimuthAngle;return isFinite(Ye)&&isFinite(it)&&(Ye<-Math.PI?Ye+=je:Ye>Math.PI&&(Ye-=je),it<-Math.PI?it+=je:it>Math.PI&&(it-=je),Ye<=it?l.theta=Math.max(Ye,Math.min(it,l.theta)):l.theta=l.theta>(Ye+it)/2?Math.max(Ye,l.theta):Math.min(it,l.theta)),l.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=c,l.radius=Math.max(o.minDistance,Math.min(o.maxDistance,l.radius)),o.enableDamping===!0?o.target.addScaledVector(u,o.dampingFactor):o.target.add(u),We.setFromSpherical(l),We.applyQuaternion(ke),gt.copy(o.target).add(We),o.object.lookAt(o.target),o.enableDamping===!0?(s.theta*=1-o.dampingFactor,s.phi*=1-o.dampingFactor,u.multiplyScalar(1-o.dampingFactor)):(s.set(0,0,0),u.set(0,0,0)),c=1,d||Oe.distanceToSquared(o.object.position)>a||8*(1-st.dot(o.object.quaternion))>a?(o.dispatchEvent(G7),Oe.copy(o.object.position),st.copy(o.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){o.domElement.removeEventListener("contextmenu",ze),o.domElement.removeEventListener("pointerdown",Re),o.domElement.removeEventListener("pointercancel",ue),o.domElement.removeEventListener("wheel",we),o.domElement.removeEventListener("pointermove",De),o.domElement.removeEventListener("pointerup",Ae),o._domElementKeyEvents!==null&&o._domElementKeyEvents.removeEventListener("keydown",Pe)};const o=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const a=1e-6,l=new zce,s=new zce;let c=1;const u=new le;let d=!1;const f=new Kt,p=new Kt,g=new Kt,A=new Kt,y=new Kt,S=new Kt,C=new Kt,P=new Kt,v=new Kt,T=[],w={};let x=!1,b=0;function R(){return 2*Math.PI/60/60*o.autoRotateSpeed}function H(){return Math.pow(.95,o.zoomSpeed)}function F(We){s.theta-=We}function E(We){s.phi-=We}const N=function(){const We=new le;return function(ke,Oe){We.setFromMatrixColumn(Oe,0),We.multiplyScalar(-ke),u.add(We)}}(),U=function(){const We=new le;return function(ke,Oe){o.screenSpacePanning===!0?We.setFromMatrixColumn(Oe,1):(We.setFromMatrixColumn(Oe,0),We.crossVectors(o.object.up,We)),We.multiplyScalar(ke),u.add(We)}}(),W=function(){const We=new le;return function(ke,Oe){const st=o.domElement;if(o.object.isPerspectiveCamera){const je=o.object.position;We.copy(je).sub(o.target);let xt=We.length();xt*=Math.tan(o.object.fov/2*Math.PI/180),N(2*ke*xt/st.clientHeight,o.object.matrix),U(2*Oe*xt/st.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(N(ke*(o.object.right-o.object.left)/o.object.zoom/st.clientWidth,o.object.matrix),U(Oe*(o.object.top-o.object.bottom)/o.object.zoom/st.clientHeight,o.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)}}(),k=function(){const We=new le;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,1),We.multiplyScalar(ke*.1),Oe.position.add(We),Oe.position.z=Math.max(0,Oe.position.z),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),D=function(){const We=new le;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,0),We.crossVectors(Oe.up,We),We.multiplyScalar(ke*.1),Oe.position.add(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),L=function(){const We=new le;return function(ke){const Oe=o.object;We.setFromMatrixColumn(Oe.matrix,0),We.multiplyScalar(ke*.1),Oe.position.add(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),j=function(){const We=new ln(0,0,0,"ZXY");return function(ke){const Oe=o.object;We.setFromQuaternion(Oe.quaternion),Math.abs(Math.abs(We.z-b)-Math.PI)<.01&&(x=!x),x?We.x-=.01*ke:We.x+=.01*ke,We.x=Math.max(.1,We.x),b=We.z,Oe.quaternion.setFromEuler(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}(),B=function(){const We=new ln(0,0,0,"ZXY");return function(ke){const Oe=o.object;We.setFromQuaternion(Oe.quaternion),We.z-=.01*ke,Oe.quaternion.setFromEuler(We),o.dispatchEvent(G7),o.dispatchEvent(X7)}}();function O(We){o.object.isPerspectiveCamera?c/=We:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*We)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function V(We){o.object.isPerspectiveCamera?c*=We:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/We)),o.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function G(We){f.set(We.clientX,We.clientY)}function q(We){C.set(We.clientX,We.clientY)}function $(We){A.set(We.clientX,We.clientY)}function ie(We){p.set(We.clientX,We.clientY),g.subVectors(p,f).multiplyScalar(o.rotateSpeed);const Ee=o.domElement;F(2*Math.PI*g.x/Ee.clientHeight),E(2*Math.PI*g.y/Ee.clientHeight),f.copy(p),o.update()}function Q(We){P.set(We.clientX,We.clientY),v.subVectors(P,C),v.y>0?O(H()):v.y<0&&V(H()),C.copy(P),o.update()}function se(We){y.set(We.clientX,We.clientY),S.subVectors(y,A).multiplyScalar(o.panSpeed),W(S.x,S.y),A.copy(y),o.update()}function oe(We){We.deltaY<0?V(H()):We.deltaY>0&&O(H()),o.update()}function Z(We){switch(We.code){case o.keys.MOVE_FORWARD:D(o.moveSpeed);break;case o.keys.MOVE_BACKWARD:D(-o.moveSpeed);break;case o.keys.MOVE_UP:k(o.moveSpeed);break;case o.keys.MOVE_DOWN:k(-o.moveSpeed);break;case o.keys.MOVE_RIGHT:L(o.moveSpeed);break;case o.keys.MOVE_LEFT:L(-o.moveSpeed);break;case o.keys.ROTATE_UP:j(o.turnSpeed);break;case o.keys.ROTATE_DOWN:j(-o.turnSpeed);break;case o.keys.ROTATE_LEFT:B(-o.turnSpeed);break;case o.keys.ROTATE_RIGHT:B(o.turnSpeed);break}}function te(){if(T.length===1)f.set(T[0].pageX,T[0].pageY);else{const We=.5*(T[0].pageX+T[1].pageX),Ee=.5*(T[0].pageY+T[1].pageY);f.set(We,Ee)}}function ee(){if(T.length===1)A.set(T[0].pageX,T[0].pageY);else{const We=.5*(T[0].pageX+T[1].pageX),Ee=.5*(T[0].pageY+T[1].pageY);A.set(We,Ee)}}function de(){const We=T[0].pageX-T[1].pageX,Ee=T[0].pageY-T[1].pageY,ke=Math.sqrt(We*We+Ee*Ee);C.set(0,ke)}function fe(){o.enableZoom&&de(),o.enablePan&&ee()}function pe(){o.enableZoom&&de(),o.enableRotate&&te()}function ye(We){if(T.length===1)p.set(We.pageX,We.pageY);else{const ke=nt(We),Oe=.5*(We.pageX+ke.x),st=.5*(We.pageY+ke.y);p.set(Oe,st)}g.subVectors(p,f).multiplyScalar(o.rotateSpeed);const Ee=o.domElement;F(2*Math.PI*g.x/Ee.clientHeight),E(2*Math.PI*g.y/Ee.clientHeight),f.copy(p)}function ae(We){if(T.length===1)y.set(We.pageX,We.pageY);else{const Ee=nt(We),ke=.5*(We.pageX+Ee.x),Oe=.5*(We.pageY+Ee.y);y.set(ke,Oe)}S.subVectors(y,A).multiplyScalar(o.panSpeed),W(S.x,S.y),A.copy(y)}function Te(We){const Ee=nt(We),ke=We.pageX-Ee.x,Oe=We.pageY-Ee.y,st=Math.sqrt(ke*ke+Oe*Oe);P.set(0,st),v.set(0,Math.pow(P.y/C.y,o.zoomSpeed)),O(v.y),C.copy(P)}function ge(We){o.enableZoom&&Te(We),o.enablePan&&ae(We)}function Se(We){o.enableZoom&&Te(We),o.enableRotate&&ye(We)}function Re(We){o.enabled!==!1&&(T.length===0&&(o.domElement.setPointerCapture(We.pointerId),o.domElement.addEventListener("pointermove",De),o.domElement.addEventListener("pointerup",Ae)),Ne(We),We.pointerType==="touch"?Ie(We):he(We))}function De(We){o.enabled!==!1&&(We.pointerType==="touch"?Me(We):ve(We))}function Ae(We){Je(We),T.length===0&&(o.domElement.releasePointerCapture(We.pointerId),o.domElement.removeEventListener("pointermove",De),o.domElement.removeEventListener("pointerup",Ae)),o.dispatchEvent(X7),i=r.NONE}function ue(We){Je(We)}function he(We){let Ee;switch(We.button){case 0:Ee=o.mouseButtons.LEFT;break;case 1:Ee=o.mouseButtons.MIDDLE;break;case 2:Ee=o.mouseButtons.RIGHT;break;default:Ee=-1}switch(Ee){case uv.DOLLY:if(o.enableZoom===!1)return;q(We),i=r.DOLLY;break;case uv.ROTATE:if(o.object.isOrthographicCamera){if(o.enablePan===!1)return;$(We),i=r.PAN}else if(We.ctrlKey||We.metaKey){if(o.enablePan===!1)return;$(We),i=r.PAN}else{if(o.enableRotate===!1)return;G(We),i=r.ROTATE}break;case uv.PAN:if(We.ctrlKey||We.metaKey){if(o.enableRotate===!1)return;G(We),i=r.ROTATE}else{if(o.enablePan===!1)return;$(We),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(Are)}function ve(We){if(o.enabled!==!1)switch(i){case r.ROTATE:if(o.enableRotate===!1)return;ie(We);break;case r.DOLLY:if(o.enableZoom===!1)return;Q(We);break;case r.PAN:if(o.enablePan===!1)return;se(We);break}}function we(We){o.enabled===!1||o.enableZoom===!1||i!==r.NONE||(We.preventDefault(),o.dispatchEvent(Are),oe(We),o.dispatchEvent(X7))}function Pe(We){o.enabled===!1||o.enablePan===!1||Z(We)}function Ie(We){switch(Ue(We),T.length){case 1:switch(o.touches.ONE){case dv.ROTATE:if(o.enableRotate===!1)return;te(),i=r.TOUCH_ROTATE;break;case dv.PAN:if(o.enablePan===!1)return;ee(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(o.touches.TWO){case dv.DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;fe(),i=r.TOUCH_DOLLY_PAN;break;case dv.DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;pe(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&o.dispatchEvent(Are)}function Me(We){switch(Ue(We),i){case r.TOUCH_ROTATE:if(o.enableRotate===!1)return;ye(We),o.update();break;case r.TOUCH_PAN:if(o.enablePan===!1)return;ae(We),o.update();break;case r.TOUCH_DOLLY_PAN:if(o.enableZoom===!1&&o.enablePan===!1)return;ge(We),o.update();break;case r.TOUCH_DOLLY_ROTATE:if(o.enableZoom===!1&&o.enableRotate===!1)return;Se(We),o.update();break;default:i=r.NONE}}function ze(We){o.enabled!==!1&&We.preventDefault()}function Ne(We){T.push(We)}function Je(We){delete w[We.pointerId];for(let Ee=0;Ee=4){this.makeEmpty();for(let n=0,o=e.length;nthis.tolerance)return!1;return!0}intersectRay(e,n){const o=this.faces;let r=-1/0,i=1/0;for(let a=0,l=o.length;a0&&u>=0)return null;const d=u!==0?-c/u:0;if(!(d<=0)&&(u>0?i=Math.min(d,i):r=Math.max(d,r),r>i))return null}return r!==-1/0?e.at(r,n):e.at(i,n),n}intersectsRay(e){return this.intersectRay(e,k6t)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,n){return e.face=n,n.outside===null?this.assigned.append(e):this.assigned.insertBefore(n.outside,e),n.outside=e,this}removeVertexFromFace(e,n){return e===n.outside&&(e.next!==null&&e.next.face===n?n.outside=e.next:n.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const n=e.outside;let o=e.outside;for(;o.next!==null&&o.next.face===e;)o=o.next;return this.assigned.removeSubList(n,o),n.prev=o.next=null,e.outside=null,n}}deleteFaceVertices(e,n){const o=this.removeAllVerticesFromFace(e);if(o!==void 0)if(n===void 0)this.unassigned.appendChain(o);else{let r=o;do{const i=r.next;n.distanceToPoint(r.point)>this.tolerance?this.addVertexToFace(r,n):this.unassigned.append(r),r=i}while(r!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let n=this.unassigned.first();do{const o=n.next;let r=this.tolerance,i=null;for(let a=0;ar&&(r=s,i=l),r>1e3*this.tolerance)break}}i!==null&&this.addVertexToFace(n,i),n=o}while(n!==null)}return this}computeExtremes(){const e=new le,n=new le,o=[],r=[];for(let i=0;i<3;i++)o[i]=r[i]=this.vertices[0];e.copy(this.vertices[0].point),n.copy(this.vertices[0].point);for(let i=0,a=this.vertices.length;in.getComponent(c)&&(n.setComponent(c,s.getComponent(c)),r[c]=l)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(n.x))+Math.max(Math.abs(e.y),Math.abs(n.y))+Math.max(Math.abs(e.z),Math.abs(n.z))),{min:o,max:r}}computeInitialHull(){const e=this.vertices,n=this.computeExtremes(),o=n.min,r=n.max;let i=0,a=0;for(let f=0;f<3;f++){const p=r[f].point.getComponent(f)-o[f].point.getComponent(f);p>i&&(i=p,a=f)}const l=o[a],s=r[a];let c,u;i=0,rwe.set(l.point,s.point);for(let f=0,p=this.vertices.length;fi&&(i=A,c=g)}}i=-1,wre.setFromCoplanarPoints(l.point,s.point,c.point);for(let f=0,p=this.vertices.length;fi&&(i=A,u=g)}}const d=[];if(wre.distanceToPoint(u.point)<0){d.push(o2.create(l,s,c),o2.create(u,s,l),o2.create(u,c,s),o2.create(u,l,c));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge(p)),d[f+1].getEdge(1).setTwin(d[p+1].getEdge(0))}}else{d.push(o2.create(l,c,s),o2.create(u,l,s),o2.create(u,s,c),o2.create(u,c,l));for(let f=0;f<3;f++){const p=(f+1)%3;d[f+1].getEdge(2).setTwin(d[0].getEdge((3-f)%3)),d[f+1].getEdge(0).setTwin(d[p+1].getEdge(1))}}for(let f=0;f<4;f++)this.faces.push(d[f]);for(let f=0,p=e.length;fi&&(i=S,A=this.faces[y])}A!==null&&this.addVertexToFace(g,A)}}return this}reindexFaces(){const e=[];for(let n=0;nn&&(n=i,e=r),r=r.next}while(r!==null&&r.face===o);return e}}computeHorizon(e,n,o,r){this.deleteFaceVertices(o),o.mark=F6t;let i;n===null?i=n=o.getEdge(0):i=n.next;do{const a=i.twin,l=a.face;l.mark===kV&&(l.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,a,l,r):r.push(i)),i=i.next}while(i!==n);return this}addAdjoiningFace(e,n){const o=o2.create(e,n.tail(),n.head());return this.faces.push(o),o.getEdge(-1).setTwin(n.twin),o.getEdge(0)}addNewFaces(e,n){this.newFaces=[];let o=null,r=null;for(let i=0;i0;)n=n.next,e--;for(;e<0;)n=n.prev,e++;return n}compute(){const e=this.edge.tail(),n=this.edge.head(),o=this.edge.next.head();return cY.set(e.point,n.point,o.point),cY.getNormal(this.normal),cY.getMidpoint(this.midpoint),this.area=cY.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class vre{constructor(e,n){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=n}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),n=this.tail();return n!==null?n.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class W6t{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class awe{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,n){return n.prev=e.prev,n.next=e,n.prev===null?this.head=n:n.prev.next=n,e.prev=n,this}insertAfter(e,n){return n.prev=e,n.next=e.next,n.next===null?this.tail=n:n.next.prev=n,e.next=n,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,n){return e.prev===null?this.head=n.next:e.prev.next=n.next,n.next===null?this.tail=e.prev:n.next.prev=e.prev,this}isEmpty(){return this.head===null}}class Nce extends ji{constructor(e,n,o){super();const r=[],i=[],a=[],l=new ln(0,0,n),c=new L6t().setFromPoints(e).faces;for(let u=0;u(t.FILES="Files",t.LOG_DATA="Log Data",t))(fG||{}),sc=(t=>(t.UNKNOWN="UNKNOWN SCHOOL",t.SCHOOL1="SCHOOL 1",t.SCHOOL2="SCHOOL 2",t.SCHOOL3="SCHOOL 3",t.SCHOOL4="SCHOOL 4",t.SCHOOL5="SCHOOL 5",t))(sc||{}),Oa=(t=>(t.UNKNOWN="UNKNOWN CLASS",t.CLASS1="CLASS 1",t.CLASS2="CLASS 2",t.CLASS3="CLASS 3",t.CLASS4="CLASS 4",t.CLASS5="CLASS 5",t.CLASS6="CLASS 6",t.CLASS7="CLASS 7",t.CLASS8="CLASS 8",t.CLASS9="CLASS 9",t))(Oa||{}),d9=(t=>(t[t.ALL=0]="ALL",t[t.INDIVIDUALS=1]="INDIVIDUALS",t[t.GROUPS=2]="GROUPS",t))(d9||{}),fa=(t=>(t.UNKNOWN="Unknown",t.UNDER_CONSTRUCTION="Under Construction",t.RESIDENTIAL_BUILDING="Residential Building",t.COMMERCIAL_BUILDING="Commercial Building",t.SCHOOL_BUILDING="School Building",t.TOURIST_ATTRACTION="Tourist Attraction",t.PHOTOVOLTAIC="Photovoltaic",t.PARABOLIC_DISH="Parabolic Dish",t.PARABOLIC_TROUGH="Parabolic Trough",t.FRESNEL_REFLECTOR="Fresnel Reflector",t.SOLAR_POWER_TOWER="Solar Power Tower",t.WIND_TURBINE="Wind Turbine",t.COLOCATION_PROJECTS="Colocation Projects",t))(fa||{}),Uc=(t=>(t[t.COMPLETE=0]="COMPLETE",t[t.ROOF_MISSING=1]="ROOF_MISSING",t[t.WALL_DISJOINED=2]="WALL_DISJOINED",t[t.WALL_EMPTY=3]="WALL_EMPTY",t))(Uc||{}),Ri=(t=>(t.SOLAR_PANEL_TILT_ANGLE="Solar Panel Tilt Angle",t.SOLAR_PANEL_ARRAY="Solar Panel Array",t))(Ri||{}),Po=(t=>(t[t.DAILY_TOTAL_OUTPUT=1]="DAILY_TOTAL_OUTPUT",t[t.YEARLY_TOTAL_OUTPUT=2]="YEARLY_TOTAL_OUTPUT",t[t.DAILY_AVERAGE_OUTPUT=3]="DAILY_AVERAGE_OUTPUT",t[t.YEARLY_AVERAGE_OUTPUT=4]="YEARLY_AVERAGE_OUTPUT",t[t.DAILY_PROFIT=5]="DAILY_PROFIT",t[t.YEARLY_PROFIT=6]="YEARLY_PROFIT",t))(Po||{}),_s=(t=>(t[t.GENETIC_ALGORITHM=1]="GENETIC_ALGORITHM",t[t.PARTICLE_SWARM_OPTIMIZATION=2]="PARTICLE_SWARM_OPTIMIZATION",t))(_s||{}),Wm=(t=>(t[t.ROULETTE_WHEEL=1]="ROULETTE_WHEEL",t[t.TOURNAMENT=2]="TOURNAMENT",t))(Wm||{}),ds=(t=>(t[t.GLOBAL_SEARCH_UNIFORM_SELECTION=1]="GLOBAL_SEARCH_UNIFORM_SELECTION",t[t.LOCAL_SEARCH_RANDOM_OPTIMIZATION=2]="LOCAL_SEARCH_RANDOM_OPTIMIZATION",t[t.GLOBAL_SEARCH_FITNESS_SHARING=3]="GLOBAL_SEARCH_FITNESS_SHARING",t))(ds||{}),Xh=(t=>(t[t.Solid=1]="Solid",t[t.Dashed=2]="Dashed",t[t.Dotted=3]="Dotted",t))(Xh||{}),$y=(t=>(t[t.One=1]="One",t[t.Two=2]="Two",t[t.Three=3]="Three",t[t.Four=4]="Four",t[t.Five=5]="Five",t))($y||{}),Il=(t=>(t[t.Line=1]="Line",t[t.Area=2]="Area",t))(Il||{}),vi=(t=>(t[t.HourlyTemperatures=1]="HourlyTemperatures",t[t.MonthlyTemperatures=2]="MonthlyTemperatures",t[t.SunshineHours=3]="SunshineHours",t[t.DaylightData=4]="DaylightData",t[t.ClearnessData=5]="ClearnessData",t[t.YearlyRadiationSensorData=6]="YearlyRadiationSensorData",t[t.DailyRadiationSensorData=7]="DailyRadiationSensorData",t[t.YearlyPvYield=8]="YearlyPvYield",t[t.DailyPvYield=9]="DailyPvYield",t[t.YearlyParabolicTroughYield=10]="YearlyParabolicTroughYield",t[t.DailyParabolicTroughYield=11]="DailyParabolicTroughYield",t[t.YearlyParabolicDishYield=12]="YearlyParabolicDishYield",t[t.DailyParabolicDishYield=13]="DailyParabolicDishYield",t[t.YearlyFresnelReflectorYield=14]="YearlyFresnelReflectorYield",t[t.DailyFresnelReflectorYield=15]="DailyFresnelReflectorYield",t[t.YearlyHeliostatYield=16]="YearlyHeliostatYield",t[t.DailyHeliostatYield=17]="DailyHeliostatYield",t[t.YearlyUpdraftTowerYield=18]="YearlyUpdraftTowerYield",t[t.DailyUpdraftTowerYield=19]="DailyUpdraftTowerYield",t[t.YearlyBuildingEnergy=20]="YearlyBuildingEnergy",t[t.DailyBuildingEnergy=21]="DailyBuildingEnergy",t))(vi||{}),Os=(t=>(t.Default="Default",t.Desert="Desert",t.Dune="Dune",t.Forest="Forest",t.Grassland="Grassland",t.Hill="Hill",t.Lake="Lake",t.Mountain="Mountain",t.Rural="Rural",t))(Os||{}),y2=(t=>(t[t.Sinusoidal=1]="Sinusoidal",t[t.PartonLogan=2]="PartonLogan",t))(y2||{}),s9=(t=>(t.English="English",t.ChineseSimplified="简体中文",t.ChineseTraditional="繁体中文",t.Turkish="Türkçe",t.Spanish="Español",t.Ukrainian="Українська",t))(s9||{}),z=(t=>(t.Sky="Sky",t.Ground="Ground",t.Foundation="Foundation",t.Wall="Wall",t.Window="Window",t.Door="Door",t.Roof="Roof",t.PyramidRoof="Pyramid Roof",t.GableRoof="Gable Roof",t.HipRoof="Hip Roof",t.GambrelRoof="Gambrel Roof",t.MansardRoof="Mansard Roof",t.Sensor="Sensor",t.SolarPanel="Solar Panel",t.SolarWaterHeater="Solar Water Heater",t.ParabolicDish="Parabolic Dish",t.ParabolicTrough="Parabolic Trough",t.FresnelReflector="Fresnel Reflector",t.Heliostat="Heliostat",t.WindTurbine="Wind Turbine",t.VerticalAxisWindTurbine="Vertical Axis Wind Turbine",t.Cuboid="Cuboid",t.Human="Human",t.Tree="Tree",t.Flower="Flower",t.Polygon="Polygon",t.PolygonVertex="Polygon Vertex",t.Light="Light",t.BatteryStorage="Battery Storage",t.None="None",t))(z||{}),sf=(t=>(t[t.CentralPole=1]="CentralPole",t[t.CentralPoleWithTripod=2]="CentralPoleWithTripod",t[t.Quadrupod=3]="Quadrupod",t))(sf||{}),Dn=(t=>(t[t.None=0]="None",t[t.FocusPipe=1]="FocusPipe",t[t.FocusTower=2]="FocusTower",t[t.UpdraftTower=3]="UpdraftTower",t))(Dn||{}),uc=(t=>(t[t.None=0]="None",t[t.Bicolor=1]="Bicolor",t[t.Striped=2]="Striped",t))(uc||{}),Xo=(t=>(t.Select="Select",t.Move="Move",t.Resize="Resize",t.Rotate="Rotate",t.ContextMenu="ContextMenu",t))(Xo||{}),zo=(t=>(t.Default="Move Handle",t.Lower="Move Handle Lower",t.Upper="Move Handle Upper",t.Left="Move Handle Left",t.Right="Move Handle Right",t.Top="Move Handle Top",t.Mid="Move Handle Mid",t))(zo||{}),Sl=(t=>(t.Left="Left",t.Right="Right",t.Up="Up",t.Down="Down",t))(Sl||{}),Mt=(t=>(t.LowerLeft="Resize Handle Lower Left",t.UpperLeft="Resize Handle Upper Left",t.LowerRight="Resize Handle Lower Right",t.UpperRight="Resize Handle Upper Right",t.LowerLeftTop="Resize Handle Lower Left Top",t.UpperLeftTop="Resize Handle Upper Left Top",t.LowerRightTop="Resize Handle Lower Right Top",t.UpperRightTop="Resize Handle Upper Right Top",t.Lower="Resize Handle Lower",t.Upper="Resize Handle Upper",t.Left="Resize Handle Left",t.Right="Resize Handle Right",t.Top="Resize Handle Top",t.Default="Resize Handle",t.Arch="Resize Handle Arch",t.WallPartialResizeLeft="Wall Partial Resize Handle Left",t.WallPartialResizeRight="Wall Partial Resize Handle Right",t.WallPartialResizeLeftTop="Wall Partial Resize Handle Left Top",t.WallPartialResizeRightTop="Wall Partial Resize Handle Right Top",t))(Mt||{}),Di=(t=>(t.Lower="Rotate Handle Lower",t.Upper="Rotate Handle Upper",t.Tilt="Rotate Handle Tilt",t))(Di||{}),hx=(t=>(t.Delete="Delete Vertex",t.InsertBeforeIndex="Insert Vertex Before Index",t.InsertAfterIndex="Insert Vertex After Index",t))(hx||{}),Zf=(t=>(t.Horizontal="Horizontal",t.Vertical="Vertical",t.Ground="Ground",t.Sky="Sky",t))(Zf||{}),re=(t=>(t[t.OnlyThisObject=1]="OnlyThisObject",t[t.AllObjectsOfThisTypeOnSurface=2]="AllObjectsOfThisTypeOnSurface",t[t.AllObjectsOfThisTypeAboveFoundation=3]="AllObjectsOfThisTypeAboveFoundation",t[t.AllObjectsOfThisType=4]="AllObjectsOfThisType",t[t.AllConnectedObjects=5]="AllConnectedObjects",t[t.OnlyThisSide=6]="OnlyThisSide",t[t.AllSelectedObjectsOfThisType=7]="AllSelectedObjectsOfThisType",t))(re||{}),vr=(t=>(t.portrait="Portrait",t.landscape="Landscape",t))(vr||{}),El=(t=>(t.eastWest="East-West",t.northSouth="North-South",t.leftRight="Left-Right",t.upDown="Up-Down",t))(El||{}),Ll=(t=>(t.NO_TRACKER="None",t.HORIZONTAL_SINGLE_AXIS_TRACKER="HSAT",t.ALTAZIMUTH_DUAL_AXIS_TRACKER="AADAT",t.VERTICAL_SINGLE_AXIS_TRACKER="VSAT",t.TILTED_SINGLE_AXIS_TRACKER="TSAT",t))(Ll||{}),m8=(t=>(t.NONE="None",t.HIGH="High",t.PARTIAL="Partial",t))(m8||{}),Em=(t=>(t.EXACT="Exact",t.APPROXIMATE="Approximate",t))(Em||{}),pr=(t=>(t.Apple="Apple",t.Birch="Birch",t.Coconut="Coconut",t.Dogwood="Dogwood",t.Elm="Elm",t.FanPalm="Fan Palm",t.Linden="Linden",t.Magnolia="Magnolia",t.Maple="Maple",t.Oak="Oak",t.Pine="Pine",t.Spruce="Spruce",t))(pr||{}),ro=(t=>(t.Bellflower="Bellflower",t.Boxwood="Boxwood",t.CactusCombo1="Cactus Combo 1",t.CactusCombo2="Cactus Combo 2",t.CactusCombo3="Cactus Combo 3",t.CactusCombo4="Cactus Combo 4",t.Hibiscus="Hibiscus",t.Hosta="Hosta",t.Hydrangea="Hydrangea",t.Peony="Peony",t.RedRose="Red Rose",t.Spirea="Spirea",t.Sunflower="Sunflower",t.TallBush="Tall Bush",t.Tulip="Tulip",t.WhiteFlower="White Flower",t.YellowFlower="Yellow Flower",t))(ro||{}),Ha=(t=>(t.Male="Male",t.Female="Female",t.Other="Other",t))(Ha||{}),Vt=(t=>(t.Jaah="Jaah",t.Jack="Jack",t.Jacob="Jacob",t.Jacqueline="Jacqueline",t.Jade="Jade",t.Jamelia="Jamelia",t.James="James",t.Jane="Jane",t.Jaya="Jaya",t.Jaye="Jaye",t.Jeanette="Jeanette",t.Jedi="Jedi",t.Jeff="Jeff",t.Jena="Jena",t.Jennifer="Jennifer",t.Jess="Jess",t.Jett="Jett",t.Jill="Jill",t.Jiya="Jiya",t.Jocelyn="Jocelyn",t.Joan="Joan",t.Joel="Joel",t.Joey="Joey",t.John="John",t.Jonathon="Jonathon",t.Joseph="Joseph",t.Jose="Jose",t.Joshua="Joshua",t.Judd="Judd",t.Judy="Judy",t.Julia="Julia",t.Julio="Julio",t.Jumapili="Jumapili",t.June="June",t.Juro="Juro",t.Justin="Justin",t))(Vt||{}),Kr=(t=>(t.Texture01="Polygon Texture #1",t.Texture02="Polygon Texture #2",t.Texture03="Polygon Texture #3",t.Texture04="Polygon Texture #4",t.Texture05="Polygon Texture #5",t.Texture06="Polygon Texture #6",t.Texture07="Polygon Texture #7",t.Texture08="Polygon Texture #8",t.Texture09="Polygon Texture #9",t.Texture10="Polygon Texture #10",t.NoTexture="No Polygon Texture",t))(Kr||{}),_i=(t=>(t.Texture01="Foundation Texture #1",t.Texture02="Foundation Texture #2",t.Texture03="Foundation Texture #3",t.Texture04="Foundation Texture #4",t.Texture05="Foundation Texture #5",t.Texture06="Foundation Texture #6",t.Texture07="Foundation Texture #7",t.Texture08="Foundation Texture #8",t.Texture09="Foundation Texture #9",t.Texture10="Foundation Texture #10",t.NoTexture="No Foundation Texture",t))(_i||{}),Ro=(t=>(t.Facade01="Facade #1",t.Facade02="Facade #2",t.Facade03="Facade #3",t.Facade04="Facade #4",t.Facade05="Facade #5",t.Facade06="Facade #6",t.Facade07="Facade #7",t.Facade08="Facade #8",t.Facade09="Facade #9",t.Facade10="Facade #10",t.NoTexture="No Facade Texture",t))(Ro||{}),Bo=(t=>(t.Default="Wall Texture Default",t.Texture01="Wall Texture #1",t.Texture02="Wall Texture #2",t.Texture03="Wall Texture #3",t.Texture04="Wall Texture #4",t.Texture05="Wall Texture #5",t.Texture06="Wall Texture #6",t.Texture07="Wall Texture #7",t.Texture08="Wall Texture #8",t.Texture09="Wall Texture #9",t.Texture10="Wall Texture #10",t.NoTexture="No Wall Texture",t))(Bo||{}),sr=(t=>(t.Default="Door Texture Default",t.Texture01="Door Texture #1",t.Texture02="Door Texture #2",t.Texture03="Door Texture #3",t.Texture04="Door Texture #4",t.Texture05="Door Texture #5",t.Texture06="Door Texture #6",t.Texture07="Door Texture #7",t.Texture08="Door Texture #8",t.Texture09="Door Texture #9",t.Texture10="Door Texture #10",t.Texture11="Door Texture #11",t.Texture12="Door Texture #12",t.Texture13="Door Texture #13",t.Texture14="Door Texture #14",t.Texture15="Door Texture #15",t.Texture16="Door Texture #16",t.Texture17="Door Texture #17",t.NoTexture="No Door Texture",t))(sr||{}),Ur=(t=>(t.Default="Roof Texture Default",t.Texture01="Roof Texture #1",t.Texture02="Roof Texture #2",t.Texture03="Roof Texture #3",t.Texture04="Roof Texture #4",t.Texture05="Roof Texture #5",t.Texture06="Roof Texture #6",t.Texture07="Roof Texture #7",t.NoTexture="No Roof Texture",t))(Ur||{}),V1=(t=>(t.Left="Left",t.Right="Right",t))(V1||{}),pa=(t=>(t.Valid="Valid",t.OverLap="OverLap",t.OutsideBoundary="OutsideBoundary",t.Invalid="Invalid",t))(pa||{}),Lr=(t=>(t.Mid="Mid",t.Left="Left",t.Right="Right",t.TopMid="TopMid",t.TopLeft="TopLeft",t.TopRight="TopRight",t.FrontLeft="FrontLeft",t.FrontRight="FrontRight",t.BackLeft="BackLeft",t.BackRight="BackRight",t.Top="Top",t.Ridge="Ridge",t.Null="Null",t))(Lr||{}),rs=(t=>(t.BUILDING="Building",t.PV="PV",t.CSP="CSP",t.SUT="SUT",t.WIND="Wind",t))(rs||{}),LV={VITE_MAPS_API_KEY:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",VITE_FIREBASE_API_KEY:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",VITE_FIREBASE_AUTH_DOMAIN:"aladdin-316017.firebaseapp.com",VITE_FIREBASE_DATABASE_URL:"https://aladdin-316017.firebaseio.com",VITE_FIREBASE_PROJECT_ID:"aladdin-316017",VITE_FIREBASE_STORAGE_BUCKET:"aladdin-316017.appspot.com",VITE_FIREBASE_MESSAGING_SENDER_ID:"169516488625",VITE_FIREBASE_APP_ID:"1:169516488625:web:bb0ae3c3f7c6e813250f90",VITE_FIREBASE_MEASUREMENT_ID:"G-G0XPQ7JNYJ",VITE_FIREBASE_LOGGER_DATABASE_URL:"https://aladdin-2024.firebaseio.com",VITE_EXAMPLE_PROJECT_OWNER:"QWecNcxhyvP6j6sBN11hBsfZDau1",BASE_URL:"/aladdin",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Uce=new Map,uY=t=>{const e=Uce.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},Y6t=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Uce.get(n.name);if(o)return{type:"tracked",store:t,...o};const r={connection:e.connect(n),stores:{}};return Uce.set(n.name,r),{type:"tracked",store:t,...r}},O6t=(t,e={})=>(n,o,r)=>{const{enabled:i,anonymousActionType:a,store:l,...s}=e;let c;try{c=(i??(LV?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(LV?"production":void 0)!=="production"&&i&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,r);const{connection:u,...d}=Y6t(l,c,s);let f=!0;r.setState=(A,y,S)=>{const C=n(A,y);if(!f)return C;const P=S===void 0?{type:a||"anonymous"}:typeof S=="string"?{type:S}:S;return l===void 0?(u==null||u.send(P,o()),C):(u==null||u.send({...P,type:`${l}/${P.type}`},{...uY(s.name),[l]:r.getState()}),C)};const p=(...A)=>{const y=f;f=!1,n(...A),f=y},g=t(r.setState,o,r);if(d.type==="untracked"?u==null||u.init(g):(d.stores[d.store]=r,u==null||u.init(Object.fromEntries(Object.entries(d.stores).map(([A,y])=>[A,A===d.store?g:y.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let A=!1;const y=r.dispatch;r.dispatch=(...S)=>{(LV?"production":void 0)!=="production"&&S[0].type==="__setState"&&!A&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),A=!0),y(...S)}}return u.subscribe(A=>{var y;switch(A.type){case"ACTION":if(typeof A.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return xre(A.payload,S=>{if(S.type==="__setState"){if(l===void 0){p(S.state);return}Object.keys(S.state).length!==1&&console.error(` [zustand devtools middleware] Unsupported __setState action format. When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(), and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } } @@ -3707,7 +3707,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * Copyright 2014-2020 Benjamin Tan * Copyright 2011-2013 John-David Dalton * Available under MIT license - */hG.exports;(function(t,e){(function(){var n={function:!0,object:!0},o=n[typeof window]&&window||this,r=e,i=t&&!t.nodeType&&t,a=r&&i&&typeof yc=="object"&&yc;a&&(a.global===a||a.window===a||a.self===a)&&(o=a);var l=Math.pow(2,53)-1,s=/\bOpera/,c=Object.prototype,u=c.hasOwnProperty,d=c.toString;function f(b){return b=String(b),b.charAt(0).toUpperCase()+b.slice(1)}function p(b,R,H){var F={"10.0":"10","6.4":"10 Technical Preview","6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return R&&H&&/^Win/i.test(b)&&!/^Windows Phone /i.test(b)&&(F=F[/[\d.]+$/.exec(b)])&&(b="Windows "+F),b=String(b),R&&H&&(b=b.replace(RegExp(R,"i"),H)),b=A(b.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0]),b}function g(b,R){var H=-1,F=b?b.length:0;if(typeof F=="number"&&F>-1&&F<=l)for(;++H3&&"WebKit"||/\bOpera\b/.test(he)&&(/\bOPR\b/.test(b)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(b)&&!/^(?:Trident|EdgeHTML)$/.test(de)&&"WebKit"||!de&&/\bMSIE\b/i.test(b)&&(le=="Mac OS"?"Tasman":"Trident")||de=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(he)&&"NetFront")&&(de=[ie]),he=="IE"&&(ie=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(b)||0)[1])?(he+=" Mobile",le="Windows Phone "+(/\+$/.test(ie)?ie:ie+".x"),se.unshift("desktop mode")):/\bWPDesktop\b/i.test(b)?(he="IE Mobile",le="Windows Phone 8.x",se.unshift("desktop mode"),te||(te=(/\brv:([\d.]+)/.exec(b)||0)[1])):he!="IE"&&de=="Trident"&&(ie=/\brv:([\d.]+)/.exec(b))&&(he&&se.push("identifying as "+he+(te?" "+te:"")),he="IE",te=ie[1]),ee){if(C(R,"global"))if(j&&(ie=j.lang.System,Q=ie.getProperty("os.arch"),le=le||ie.getProperty("os.name")+" "+ie.getProperty("os.version")),B){try{te=R.require("ringo/engine").version.join("."),he="RingoJS"}catch{(ie=R.system)&&ie.global.system==R.system&&(he="Narwhal",le||(le=ie[0].os||null))}he||(he="Rhino")}else typeof R.process=="object"&&!R.process.browser&&(ie=R.process)&&(typeof ie.versions=="object"&&(typeof ie.versions.electron=="string"?(se.push("Node "+ie.versions.node),he="Electron",te=ie.versions.electron):typeof ie.versions.nw=="string"&&(se.push("Chromium "+te,"Node "+ie.versions.node),he="NW.js",te=ie.versions.nw)),he||(he="Node.js",Q=ie.arch,le=ie.platform,te=/[\d.]+/.exec(ie.version),te=te?te[0]:null));else S(ie=R.runtime)==W?(he="Adobe AIR",le=ie.flash.system.Capabilities.os):S(ie=R.phantom)==L?(he="PhantomJS",te=(ie=ie.version||null)&&ie.major+"."+ie.minor+"."+ie.patch):typeof G.documentMode=="number"&&(ie=/\bTrident\/(\d+)/i.exec(b))?(te=[te,G.documentMode],(ie=+ie[1]+4)!=te[1]&&(se.push("IE "+te[1]+" mode"),de&&(de[1]=""),te[1]=ie),te=he=="IE"?String(te[1].toFixed(1)):te[0]):typeof G.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(he)&&(se.push("masking as "+he+" "+te),he="IE",te="11.0",de=["Trident"],le="Windows");le=le&&A(le)}if(te&&(ie=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(te)||/(?:alpha|beta)(?: ?\d)?/i.exec(b+";"+(ee&&F.appMinorVersion))||/\bMinefield\b/i.test(b)&&"a")&&(Z=/b/i.test(ie)?"beta":"alpha",te=te.replace(RegExp(ie+"\\+?$"),"")+(Z=="beta"?V:O)+(/\d+\+?/.exec(ie)||"")),he=="Fennec"||he=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(le))he="Firefox Mobile";else if(he=="Maxthon"&&te)te=te.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(pe))pe=="Xbox 360"&&(le=null),pe=="Xbox 360"&&/\bIEMobile\b/.test(b)&&se.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(he)||he&&!pe&&!/Browser|Mobi/.test(he))&&(le=="Windows CE"||/Mobi/i.test(b)))he+=" Mobile";else if(he=="IE"&&ee)try{R.external===null&&se.unshift("platform preview")}catch{se.unshift("embedded")}else(/\bBlackBerry\b/.test(pe)||/\bBB10\b/.test(b))&&(ie=(RegExp(pe.replace(/ +/g," *")+"/([.\\d]+)","i").exec(b)||0)[1]||te)?(ie=[ie,/BB10/.test(b)],le=(ie[1]?(pe=null,me="BlackBerry"):"Device Software")+" "+ie[0],te=null):this!=y&&pe!="Wii"&&(ee&&q||/Opera/.test(he)&&/\b(?:MSIE|Firefox)\b/i.test(b)||he=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(le)||he=="IE"&&(le&&!/^Win/.test(le)&&te>5.5||/\bWindows XP\b/.test(le)&&te>8||te==8&&!/\bTrident\b/.test(b)))&&!s.test(ie=w.call(y,b.replace(s,"")+";"))&&ie.name&&(ie="ing as "+ie.name+((ie=ie.version)?" "+ie:""),s.test(he)?(/\bIE\b/.test(ie)&&le=="Mac OS"&&(le=null),ie="identify"+ie):(ie="mask"+ie,$?he=A($.replace(/([a-z])([A-Z])/g,"$1 $2")):he="Opera",/\bIE\b/.test(ie)&&(le=null),ee||(te=null)),de=["Presto"],se.push(ie));(ie=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(b)||0)[1])&&(ie=[parseFloat(ie.replace(/\.(\d)$/,".0$1")),ie],he=="Safari"&&ie[1].slice(-1)=="+"?(he="WebKit Nightly",Z="alpha",te=ie[1].slice(0,-1)):(te==ie[1]||te==(ie[2]=(/\bSafari\/([\d.]+\+?)/i.exec(b)||0)[1]))&&(te=null),ie[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(b)||0)[1],ie[0]==537.36&&ie[2]==537.36&&parseFloat(ie[1])>=28&&de=="WebKit"&&(de=["Blink"]),!ee||!N&&!ie[1]?(de&&(de[1]="like Safari"),ie=(ie=ie[0],ie<400?1:ie<500?2:ie<526?3:ie<533?4:ie<534?"4+":ie<535?5:ie<537?6:ie<538?7:ie<601?8:ie<602?9:ie<604?10:ie<606?11:ie<608?12:"12")):(de&&(de[1]="like Chrome"),ie=ie[1]||(ie=ie[0],ie<530?1:ie<532?2:ie<532.05?3:ie<533?4:ie<534.03?5:ie<534.07?6:ie<534.1?7:ie<534.13?8:ie<534.16?9:ie<534.24?10:ie<534.3?11:ie<535.01?12:ie<535.02?"13+":ie<535.07?15:ie<535.11?16:ie<535.19?17:ie<536.05?18:ie<536.1?19:ie<537.01?20:ie<537.11?"21+":ie<537.13?23:ie<537.18?24:ie<537.24?25:ie<537.36?26:de!="Blink"?"27":"28")),de&&(de[1]+=" "+(ie+=typeof ie=="number"?".x":/[.+]/.test(ie)?"":"+")),he=="Safari"&&(!te||parseInt(te)>45)?te=ie:he=="Chrome"&&/\bHeadlessChrome/i.test(b)&&se.unshift("headless")),he=="Opera"&&(ie=/\bzbov|zvav$/.exec(le))?(he+=" ",se.unshift("desktop mode"),ie=="zvav"?(he+="Mini",te=null):he+="Mobile",le=le.replace(RegExp(" *"+ie+"$"),"")):he=="Safari"&&/\bChrome\b/.exec(de&&de[1])?(se.unshift("desktop mode"),he="Chrome Mobile",te=null,/\bOS X\b/.test(le)?(me="Apple",le="iOS 4.3+"):le=null):/\bSRWare Iron\b/.test(he)&&!te&&(te=Ae("Chrome")),te&&te.indexOf(ie=/[\d.]+$/.exec(le))==0&&b.indexOf("/"+ie+"-")>-1&&(le=T(le.replace(ie,""))),le&&le.indexOf(he)!=-1&&!RegExp(he+" OS").test(le)&&(le=le.replace(RegExp(" *"+P(he)+" *"),"")),de&&!/\b(?:Avant|Nook)\b/.test(he)&&(/Browser|Lunascape|Maxthon/.test(he)||he!="Safari"&&/^iOS/.test(le)&&/\bSafari\b/.test(de[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(he)&&de[1])&&(ie=de[de.length-1])&&se.push(ie),se.length&&(se=["("+se.join("; ")+")"]),me&&pe&&pe.indexOf(me)<0&&se.push("on "+me),pe&&se.push((/^on /.test(se[se.length-1])?"":"on ")+pe),le&&(ie=/ ([\d.+]+)$/.exec(le),oe=ie&&le.charAt(le.length-ie[0].length-1)=="/",le={architecture:32,family:ie&&!oe?le.replace(ie[0],""):le,version:ie?ie[1]:null,toString:function(){var ve=this.version;return this.family+(ve&&!oe?" "+ve:"")+(this.architecture==64?" 64-bit":"")}}),(ie=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(Q))&&!/\bi686\b/i.test(Q)?(le&&(le.architecture=64,le.family=le.family.replace(RegExp(" *"+ie),"")),he&&(/\bWOW64\b/i.test(b)||ee&&/\w(?:86|32)$/.test(F.cpuClass||F.platform)&&!/\bWin64; x64\b/i.test(b))&&se.unshift("32-bit")):le&&/^OS X/.test(le.family)&&he=="Chrome"&&parseFloat(te)>=39&&(le.architecture=64),b||(b=null);var fe={};return fe.description=b,fe.layout=de&&de[0],fe.manufacturer=me,fe.name=he,fe.prerelease=Z,fe.product=pe,fe.ua=b,fe.version=he&&te,fe.os=le||{architecture:null,family:null,version:null,toString:function(){return"null"}},fe.parse=w,fe.toString=ue,fe.version&&se.unshift(te),fe.name&&se.unshift(he),le&&he&&!(le==String(le).split(" ")[0]&&(le==he.split(" ")[0]||pe))&&se.push(pe?"("+le+")":"on "+le),se.length&&(fe.description=se.join(" ")),fe}var x=w();r&&i?y(x,function(b,R){r[R]=b}):o.platform=x}).call(yc)})(hG,hG.exports);var K6t=hG.exports;const rje=Wi(K6t),CC="1.6.9",q6t="1.5.0",t1="https://institute-for-future-intelligence.github.io/aladdin/",pG="Natick, MA",ng=["#627682","#8884d8","#f97356","#1bc32c","#c6502d","#82ca9d","#3eaec0","#445111"],bc=15,qF=50,gG=.5,g0=.8,$6t=new rr(0,0,1),Q6t=new rr(0,1,0),Z6t=new rr(1,1,0),eAt=new rr(1,0,0),Iz=[$6t,Q6t,Z6t,eAt],Qm=20,p0="gray",Zm=.5,i3=4,i8=2,p6=2,a8=2,w6=2,X4=2,J4=1,ije=1,R9="SPR-X21-335-BLK",rw=100,mG=200,lwe="#3BB9FF",yG="#36454F",t9="#FFFFFF",n9="#404040",aje=10,y8=4,zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],swe=["January","February","March","April","May","June","July","August","September","October","November","December"],Nq=105,Uq=320,tAt=5e3,lje=45,$F=1e4,nAt=4096,oAt=.1,Wg=.1,sR=.16,iw="orange",QF="orchid",rAt="pink",$a="white",ga="red",B0="yellow",Z5=5,m9=.1,P6=Z5*m9,sje=1e4,cwe=250,iAt=.01,aAt=.005,lAt="#000",sAt="#01345B",jce="#fe6f5e",Zo="Ground",Qt=Math.PI/2,sa=Math.PI*2,Et=1e-4,as=[0,0,1],cAt=[0,-1,0],Op=new ae(1,0,0),Vp=new ae(-1,0,0),Yc=new ae(0,1,0),_p=new ae(0,-1,0),ko=new ae(0,0,1);new ae(0,0,-1);const ai=new Kt(0,0);new ae(0,0,0);const AG=new ln(0,0,Qt),cR=/^[A-Za-z0-9\s-_()!?%&,]*$/,bre=uAt()?"⌘":"Ctrl";function uAt(){var e;const t=(e=rje.os)==null?void 0:e.family;return t?t.includes("Mac")||t.includes("OS X"):!1}var Fl=(t=>(t.Full="Full",t.Partial="Partial",t.Empty="Empty",t))(Fl||{}),gc=(t=>(t.Default="Default",t.Stud="Stud",t.Pillar="Pillar",t))(gc||{});let cr=class{constructor(e,n,o,r){this.x=e,this.y=n,this.width=o,this.height=r}centerX(){return this.x+this.width/2}centerY(){return this.y+this.height/2}minX(){return this.x}maxX(){return this.x+this.width}minY(){return this.y}maxY(){return this.y+this.height}contains(e,n){return e>this.x&&ethis.y&&n(t.Pyramid="Pyramid",t.Gable="Gable",t.Hip="Hip",t.Gambrel="Gambrel",t.Mansard="Mansard",t))(Go||{}),Ac=(t=>(t.Default="Default",t.Rafter="Rafter",t.Glass="Glass",t))(Ac||{});function j9(){return j9=Object.assign?Object.assign.bind():function(t){for(var e=1;en&&s.add(F)}s.normalize(),g.setXYZ(S+T,s.x,s.y,s.z)}}return u.setAttribute("normal",g),u}const uwe=new vf,dY=new ae;class mge extends Wq{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new gr(e,3)),this.setAttribute("uv",new gr(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new sG(n,6,1);return this.setAttribute("instanceStart",new pg(o,3,0)),this.setAttribute("instanceEnd",new pg(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new sG(n,6,1);return this.setAttribute("instanceColorStart",new pg(o,3,0)),this.setAttribute("instanceColorEnd",new pg(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Q1e(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vf);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),uwe.setFromBufferAttribute(n),this.boundingBox.union(uwe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new s1),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let r=0;for(let i=0,a=e.count;i-1&&F<=l)for(;++H3&&"WebKit"||/\bOpera\b/.test(fe)&&(/\bOPR\b/.test(b)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(b)&&!/^(?:Trident|EdgeHTML)$/.test(de)&&"WebKit"||!de&&/\bMSIE\b/i.test(b)&&(ae=="Mac OS"?"Tasman":"Trident")||de=="WebKit"&&/\bPlayStation\b(?! Vita\b)/i.test(fe)&&"NetFront")&&(de=[ie]),fe=="IE"&&(ie=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(b)||0)[1])?(fe+=" Mobile",ae="Windows Phone "+(/\+$/.test(ie)?ie:ie+".x"),se.unshift("desktop mode")):/\bWPDesktop\b/i.test(b)?(fe="IE Mobile",ae="Windows Phone 8.x",se.unshift("desktop mode"),te||(te=(/\brv:([\d.]+)/.exec(b)||0)[1])):fe!="IE"&&de=="Trident"&&(ie=/\brv:([\d.]+)/.exec(b))&&(fe&&se.push("identifying as "+fe+(te?" "+te:"")),fe="IE",te=ie[1]),Z){if(C(R,"global"))if(j&&(ie=j.lang.System,Q=ie.getProperty("os.arch"),ae=ae||ie.getProperty("os.name")+" "+ie.getProperty("os.version")),B){try{te=R.require("ringo/engine").version.join("."),fe="RingoJS"}catch{(ie=R.system)&&ie.global.system==R.system&&(fe="Narwhal",ae||(ae=ie[0].os||null))}fe||(fe="Rhino")}else typeof R.process=="object"&&!R.process.browser&&(ie=R.process)&&(typeof ie.versions=="object"&&(typeof ie.versions.electron=="string"?(se.push("Node "+ie.versions.node),fe="Electron",te=ie.versions.electron):typeof ie.versions.nw=="string"&&(se.push("Chromium "+te,"Node "+ie.versions.node),fe="NW.js",te=ie.versions.nw)),fe||(fe="Node.js",Q=ie.arch,ae=ie.platform,te=/[\d.]+/.exec(ie.version),te=te?te[0]:null));else S(ie=R.runtime)==W?(fe="Adobe AIR",ae=ie.flash.system.Capabilities.os):S(ie=R.phantom)==L?(fe="PhantomJS",te=(ie=ie.version||null)&&ie.major+"."+ie.minor+"."+ie.patch):typeof G.documentMode=="number"&&(ie=/\bTrident\/(\d+)/i.exec(b))?(te=[te,G.documentMode],(ie=+ie[1]+4)!=te[1]&&(se.push("IE "+te[1]+" mode"),de&&(de[1]=""),te[1]=ie),te=fe=="IE"?String(te[1].toFixed(1)):te[0]):typeof G.documentMode=="number"&&/^(?:Chrome|Firefox)\b/.test(fe)&&(se.push("masking as "+fe+" "+te),fe="IE",te="11.0",de=["Trident"],ae="Windows");ae=ae&&A(ae)}if(te&&(ie=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(te)||/(?:alpha|beta)(?: ?\d)?/i.exec(b+";"+(Z&&F.appMinorVersion))||/\bMinefield\b/i.test(b)&&"a")&&(oe=/b/i.test(ie)?"beta":"alpha",te=te.replace(RegExp(ie+"\\+?$"),"")+(oe=="beta"?V:O)+(/\d+\+?/.exec(ie)||"")),fe=="Fennec"||fe=="Firefox"&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(ae))fe="Firefox Mobile";else if(fe=="Maxthon"&&te)te=te.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(pe))pe=="Xbox 360"&&(ae=null),pe=="Xbox 360"&&/\bIEMobile\b/.test(b)&&se.unshift("mobile mode");else if((/^(?:Chrome|IE|Opera)$/.test(fe)||fe&&!pe&&!/Browser|Mobi/.test(fe))&&(ae=="Windows CE"||/Mobi/i.test(b)))fe+=" Mobile";else if(fe=="IE"&&Z)try{R.external===null&&se.unshift("platform preview")}catch{se.unshift("embedded")}else(/\bBlackBerry\b/.test(pe)||/\bBB10\b/.test(b))&&(ie=(RegExp(pe.replace(/ +/g," *")+"/([.\\d]+)","i").exec(b)||0)[1]||te)?(ie=[ie,/BB10/.test(b)],ae=(ie[1]?(pe=null,ye="BlackBerry"):"Device Software")+" "+ie[0],te=null):this!=y&&pe!="Wii"&&(Z&&q||/Opera/.test(fe)&&/\b(?:MSIE|Firefox)\b/i.test(b)||fe=="Firefox"&&/\bOS X (?:\d+\.){2,}/.test(ae)||fe=="IE"&&(ae&&!/^Win/.test(ae)&&te>5.5||/\bWindows XP\b/.test(ae)&&te>8||te==8&&!/\bTrident\b/.test(b)))&&!s.test(ie=w.call(y,b.replace(s,"")+";"))&&ie.name&&(ie="ing as "+ie.name+((ie=ie.version)?" "+ie:""),s.test(fe)?(/\bIE\b/.test(ie)&&ae=="Mac OS"&&(ae=null),ie="identify"+ie):(ie="mask"+ie,$?fe=A($.replace(/([a-z])([A-Z])/g,"$1 $2")):fe="Opera",/\bIE\b/.test(ie)&&(ae=null),Z||(te=null)),de=["Presto"],se.push(ie));(ie=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(b)||0)[1])&&(ie=[parseFloat(ie.replace(/\.(\d)$/,".0$1")),ie],fe=="Safari"&&ie[1].slice(-1)=="+"?(fe="WebKit Nightly",oe="alpha",te=ie[1].slice(0,-1)):(te==ie[1]||te==(ie[2]=(/\bSafari\/([\d.]+\+?)/i.exec(b)||0)[1]))&&(te=null),ie[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(b)||0)[1],ie[0]==537.36&&ie[2]==537.36&&parseFloat(ie[1])>=28&&de=="WebKit"&&(de=["Blink"]),!Z||!N&&!ie[1]?(de&&(de[1]="like Safari"),ie=(ie=ie[0],ie<400?1:ie<500?2:ie<526?3:ie<533?4:ie<534?"4+":ie<535?5:ie<537?6:ie<538?7:ie<601?8:ie<602?9:ie<604?10:ie<606?11:ie<608?12:"12")):(de&&(de[1]="like Chrome"),ie=ie[1]||(ie=ie[0],ie<530?1:ie<532?2:ie<532.05?3:ie<533?4:ie<534.03?5:ie<534.07?6:ie<534.1?7:ie<534.13?8:ie<534.16?9:ie<534.24?10:ie<534.3?11:ie<535.01?12:ie<535.02?"13+":ie<535.07?15:ie<535.11?16:ie<535.19?17:ie<536.05?18:ie<536.1?19:ie<537.01?20:ie<537.11?"21+":ie<537.13?23:ie<537.18?24:ie<537.24?25:ie<537.36?26:de!="Blink"?"27":"28")),de&&(de[1]+=" "+(ie+=typeof ie=="number"?".x":/[.+]/.test(ie)?"":"+")),fe=="Safari"&&(!te||parseInt(te)>45)?te=ie:fe=="Chrome"&&/\bHeadlessChrome/i.test(b)&&se.unshift("headless")),fe=="Opera"&&(ie=/\bzbov|zvav$/.exec(ae))?(fe+=" ",se.unshift("desktop mode"),ie=="zvav"?(fe+="Mini",te=null):fe+="Mobile",ae=ae.replace(RegExp(" *"+ie+"$"),"")):fe=="Safari"&&/\bChrome\b/.exec(de&&de[1])?(se.unshift("desktop mode"),fe="Chrome Mobile",te=null,/\bOS X\b/.test(ae)?(ye="Apple",ae="iOS 4.3+"):ae=null):/\bSRWare Iron\b/.test(fe)&&!te&&(te=Ae("Chrome")),te&&te.indexOf(ie=/[\d.]+$/.exec(ae))==0&&b.indexOf("/"+ie+"-")>-1&&(ae=T(ae.replace(ie,""))),ae&&ae.indexOf(fe)!=-1&&!RegExp(fe+" OS").test(ae)&&(ae=ae.replace(RegExp(" *"+P(fe)+" *"),"")),de&&!/\b(?:Avant|Nook)\b/.test(fe)&&(/Browser|Lunascape|Maxthon/.test(fe)||fe!="Safari"&&/^iOS/.test(ae)&&/\bSafari\b/.test(de[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(fe)&&de[1])&&(ie=de[de.length-1])&&se.push(ie),se.length&&(se=["("+se.join("; ")+")"]),ye&&pe&&pe.indexOf(ye)<0&&se.push("on "+ye),pe&&se.push((/^on /.test(se[se.length-1])?"":"on ")+pe),ae&&(ie=/ ([\d.+]+)$/.exec(ae),ee=ie&&ae.charAt(ae.length-ie[0].length-1)=="/",ae={architecture:32,family:ie&&!ee?ae.replace(ie[0],""):ae,version:ie?ie[1]:null,toString:function(){var ve=this.version;return this.family+(ve&&!ee?" "+ve:"")+(this.architecture==64?" 64-bit":"")}}),(ie=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(Q))&&!/\bi686\b/i.test(Q)?(ae&&(ae.architecture=64,ae.family=ae.family.replace(RegExp(" *"+ie),"")),fe&&(/\bWOW64\b/i.test(b)||Z&&/\w(?:86|32)$/.test(F.cpuClass||F.platform)&&!/\bWin64; x64\b/i.test(b))&&se.unshift("32-bit")):ae&&/^OS X/.test(ae.family)&&fe=="Chrome"&&parseFloat(te)>=39&&(ae.architecture=64),b||(b=null);var he={};return he.description=b,he.layout=de&&de[0],he.manufacturer=ye,he.name=fe,he.prerelease=oe,he.product=pe,he.ua=b,he.version=fe&&te,he.os=ae||{architecture:null,family:null,version:null,toString:function(){return"null"}},he.parse=w,he.toString=ue,he.version&&se.unshift(te),he.name&&se.unshift(fe),ae&&fe&&!(ae==String(ae).split(" ")[0]&&(ae==fe.split(" ")[0]||pe))&&se.push(pe?"("+ae+")":"on "+ae),se.length&&(he.description=se.join(" ")),he}var x=w();r&&i?y(x,function(b,R){r[R]=b}):o.platform=x}).call(yc)})(hG,hG.exports);var K6t=hG.exports;const rje=Wi(K6t),CC="1.6.9",q6t="1.5.0",t1="https://institute-for-future-intelligence.github.io/aladdin/",pG="Natick, MA",ng=["#627682","#8884d8","#f97356","#1bc32c","#c6502d","#82ca9d","#3eaec0","#445111"],bc=15,qF=50,gG=.5,g0=.8,$6t=new rr(0,0,1),Q6t=new rr(0,1,0),Z6t=new rr(1,1,0),eAt=new rr(1,0,0),Iz=[$6t,Q6t,Z6t,eAt],Qm=20,p0="gray",Zm=.5,i3=4,i8=2,p6=2,a8=2,w6=2,X4=2,J4=1,ije=1,R9="SPR-X21-335-BLK",rw=100,mG=200,lwe="#3BB9FF",yG="#36454F",t9="#FFFFFF",n9="#404040",aje=10,y8=4,zs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],swe=["January","February","March","April","May","June","July","August","September","October","November","December"],Nq=105,Uq=320,tAt=5e3,lje=45,$F=1e4,nAt=4096,oAt=.1,Wg=.1,sR=.16,iw="orange",QF="orchid",rAt="pink",$a="white",ga="red",B0="yellow",Z5=5,m9=.1,P6=Z5*m9,sje=1e4,cwe=250,iAt=.01,aAt=.005,lAt="#000",sAt="#01345B",jce="#fe6f5e",Zo="Ground",Qt=Math.PI/2,sa=Math.PI*2,Et=1e-4,as=[0,0,1],cAt=[0,-1,0],Op=new le(1,0,0),Vp=new le(-1,0,0),Yc=new le(0,1,0),_p=new le(0,-1,0),ko=new le(0,0,1);new le(0,0,-1);const ai=new Kt(0,0);new le(0,0,0);const AG=new ln(0,0,Qt),cR=/^[A-Za-z0-9\s-_()!?%&,]*$/,bre=uAt()?"⌘":"Ctrl";function uAt(){var e;const t=(e=rje.os)==null?void 0:e.family;return t?t.includes("Mac")||t.includes("OS X"):!1}var Fl=(t=>(t.Full="Full",t.Partial="Partial",t.Empty="Empty",t))(Fl||{}),gc=(t=>(t.Default="Default",t.Stud="Stud",t.Pillar="Pillar",t))(gc||{});let cr=class{constructor(e,n,o,r){this.x=e,this.y=n,this.width=o,this.height=r}centerX(){return this.x+this.width/2}centerY(){return this.y+this.height/2}minX(){return this.x}maxX(){return this.x+this.width}minY(){return this.y}maxY(){return this.y+this.height}contains(e,n){return e>this.x&&ethis.y&&n(t.Pyramid="Pyramid",t.Gable="Gable",t.Hip="Hip",t.Gambrel="Gambrel",t.Mansard="Mansard",t))(Go||{}),Ac=(t=>(t.Default="Default",t.Rafter="Rafter",t.Glass="Glass",t))(Ac||{});function j9(){return j9=Object.assign?Object.assign.bind():function(t){for(var e=1;en&&s.add(F)}s.normalize(),g.setXYZ(S+T,s.x,s.y,s.z)}}return u.setAttribute("normal",g),u}const uwe=new vf,dY=new le;class mge extends Wq{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],o=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(o),this.setAttribute("position",new gr(e,3)),this.setAttribute("uv",new gr(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,o=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),o.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new sG(n,6,1);return this.setAttribute("instanceStart",new pg(o,3,0)),this.setAttribute("instanceEnd",new pg(o,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const o=new sG(n,6,1);return this.setAttribute("instanceColorStart",new pg(o,3,0)),this.setAttribute("instanceColorEnd",new pg(o,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Q1e(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new vf);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),uwe.setFromBufferAttribute(n),this.boundingBox.union(uwe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new s1),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const o=this.boundingSphere.center;this.boundingBox.getCenter(o);let r=0;for(let i=0,a=e.count;i #include #include @@ -4094,7 +4094,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho #include } - `,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const dwe=new ae,fwe=new ae,$d=new qa,Qd=new qa,_5=new qa,Sre=new ae,Tre=new Ki,Kf=new uge,hwe=new ae,fY=new vf,hY=new s1,G5=new qa;let f9,Bce,uje,px;function pwe(t,e,n){return G5.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),G5.multiplyScalar(1/G5.w),G5.x=px/n.width,G5.y=px/n.height,G5.applyMatrix4(t.projectionMatrixInverse),G5.multiplyScalar(1/G5.w),Math.abs(Math.max(G5.x,G5.y))}function fAt(t,e){for(let n=0,o=Bce.count;nu&&Qd.z>u)continue;if($d.z>u){const C=$d.z-Qd.z,P=($d.z-u)/C;$d.lerp(Qd,P)}else if(Qd.z>u){const C=Qd.z-$d.z,P=(Qd.z-u)/C;Qd.lerp($d,P)}$d.applyMatrix4(o),Qd.applyMatrix4(o),$d.multiplyScalar(1/$d.w),Qd.multiplyScalar(1/Qd.w),$d.x*=i.x/2,$d.y*=i.y/2,Qd.x*=i.x/2,Qd.y*=i.y/2,Kf.start.copy($d),Kf.start.z=0,Kf.end.copy(Qd),Kf.end.z=0;const g=Kf.closestPointToPointParameter(Sre,!0);Kf.at(g,hwe);const A=RNe.lerp($d.z,Qd.z,g),y=A>=-1&&A<=1,S=Sre.distanceTo(hwe){if(!e||!l.current)return;const c=l.current.rotation.clone();s.getWorldQuaternion(l.current.quaternion),n&&(l.current.rotation.x=c.x),o&&(l.current.rotation.y=c.y),r&&(l.current.rotation.z=c.z)}),m.createElement("group",j9({ref:gge([l,a])},i))}),Gn=m.forwardRef(function({points:e,color:n="black",vertexColors:o,linewidth:r,lineWidth:i,segments:a,dashed:l,...s},c){const u=ri(g=>g.size),d=m.useMemo(()=>a?new dje:new pAt,[a]),[f]=m.useState(()=>new yge),p=m.useMemo(()=>{const g=a?new mge:new cje,A=e.map(y=>{const S=Array.isArray(y);return y instanceof ae?[y.x,y.y,y.z]:y instanceof Kt?[y.x,y.y,0]:S&&y.length===3?[y[0],y[1],y[2]]:S&&y.length===2?[y[0],y[1],0]:y});if(g.setPositions(A.flat()),o){const y=o.map(S=>S instanceof rr?S.toArray():S);g.setColors(y.flat())}return g},[e,a,o]);return m.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),m.useLayoutEffect(()=>{l?f.defines.USE_DASH="":delete f.defines.USE_DASH,f.needsUpdate=!0},[l,f]),m.useEffect(()=>()=>p.dispose(),[p]),m.createElement("primitive",j9({object:d,ref:c},s),m.createElement("primitive",{object:p,attach:"geometry"}),m.createElement("primitive",j9({object:f,attach:"material",color:n,vertexColors:!!o,resolution:[u.width,u.height],linewidth:r??i,dashed:l},s)))});function gAt(){var t=Object.create(null);function e(r,i){var a=r.id,l=r.name,s=r.dependencies;s===void 0&&(s=[]);var c=r.init;c===void 0&&(c=function(){});var u=r.getTransferables;if(u===void 0&&(u=null),!t[a])try{s=s.map(function(f){return f&&f.isWorkerModule&&(e(f,function(p){if(p instanceof Error)throw p}),f=t[f.id].value),f}),c=o("<"+l+">.init",c),u&&(u=o("<"+l+">.getTransferables",u));var d=null;typeof c=="function"?d=c.apply(void 0,s):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:d,getTransferables:u},i(d)}catch(f){f&&f.noLog||console.error(f),i(f)}}function n(r,i){var a,l=r.id,s=r.args;(!t[l]||typeof t[l].value!="function")&&i(new Error("Worker module "+l+": not found or its 'init' did not return a function"));try{var c=(a=t[l]).value.apply(a,s);c&&typeof c.then=="function"?c.then(u,function(d){return i(d instanceof Error?d:new Error(""+d))}):u(c)}catch(d){i(d)}function u(d){try{var f=t[l].getTransferables&&t[l].getTransferables(d);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),i(d,f)}catch(p){console.error(p),i(p)}}}function o(r,i){var a=void 0;self.troikaDefine=function(s){return a=s};var l=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/ + `,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const dwe=new le,fwe=new le,$d=new qa,Qd=new qa,_5=new qa,Sre=new le,Tre=new Ki,qf=new uge,hwe=new le,fY=new vf,hY=new s1,G5=new qa;let f9,Bce,uje,px;function pwe(t,e,n){return G5.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),G5.multiplyScalar(1/G5.w),G5.x=px/n.width,G5.y=px/n.height,G5.applyMatrix4(t.projectionMatrixInverse),G5.multiplyScalar(1/G5.w),Math.abs(Math.max(G5.x,G5.y))}function fAt(t,e){for(let n=0,o=Bce.count;nu&&Qd.z>u)continue;if($d.z>u){const C=$d.z-Qd.z,P=($d.z-u)/C;$d.lerp(Qd,P)}else if(Qd.z>u){const C=Qd.z-$d.z,P=(Qd.z-u)/C;Qd.lerp($d,P)}$d.applyMatrix4(o),Qd.applyMatrix4(o),$d.multiplyScalar(1/$d.w),Qd.multiplyScalar(1/Qd.w),$d.x*=i.x/2,$d.y*=i.y/2,Qd.x*=i.x/2,Qd.y*=i.y/2,qf.start.copy($d),qf.start.z=0,qf.end.copy(Qd),qf.end.z=0;const g=qf.closestPointToPointParameter(Sre,!0);qf.at(g,hwe);const A=RNe.lerp($d.z,Qd.z,g),y=A>=-1&&A<=1,S=Sre.distanceTo(hwe){if(!e||!l.current)return;const c=l.current.rotation.clone();s.getWorldQuaternion(l.current.quaternion),n&&(l.current.rotation.x=c.x),o&&(l.current.rotation.y=c.y),r&&(l.current.rotation.z=c.z)}),m.createElement("group",j9({ref:gge([l,a])},i))}),Gn=m.forwardRef(function({points:e,color:n="black",vertexColors:o,linewidth:r,lineWidth:i,segments:a,dashed:l,...s},c){const u=ri(g=>g.size),d=m.useMemo(()=>a?new dje:new pAt,[a]),[f]=m.useState(()=>new yge),p=m.useMemo(()=>{const g=a?new mge:new cje,A=e.map(y=>{const S=Array.isArray(y);return y instanceof le?[y.x,y.y,y.z]:y instanceof Kt?[y.x,y.y,0]:S&&y.length===3?[y[0],y[1],y[2]]:S&&y.length===2?[y[0],y[1],0]:y});if(g.setPositions(A.flat()),o){const y=o.map(S=>S instanceof rr?S.toArray():S);g.setColors(y.flat())}return g},[e,a,o]);return m.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),m.useLayoutEffect(()=>{l?f.defines.USE_DASH="":delete f.defines.USE_DASH,f.needsUpdate=!0},[l,f]),m.useEffect(()=>()=>p.dispose(),[p]),m.createElement("primitive",j9({object:d,ref:c},s),m.createElement("primitive",{object:p,attach:"geometry"}),m.createElement("primitive",j9({object:f,attach:"material",color:n,vertexColors:!!o,resolution:[u.width,u.height],linewidth:r??i,dashed:l},s)))});function gAt(){var t=Object.create(null);function e(r,i){var a=r.id,l=r.name,s=r.dependencies;s===void 0&&(s=[]);var c=r.init;c===void 0&&(c=function(){});var u=r.getTransferables;if(u===void 0&&(u=null),!t[a])try{s=s.map(function(f){return f&&f.isWorkerModule&&(e(f,function(p){if(p instanceof Error)throw p}),f=t[f.id].value),f}),c=o("<"+l+">.init",c),u&&(u=o("<"+l+">.getTransferables",u));var d=null;typeof c=="function"?d=c.apply(void 0,s):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:d,getTransferables:u},i(d)}catch(f){f&&f.noLog||console.error(f),i(f)}}function n(r,i){var a,l=r.id,s=r.args;(!t[l]||typeof t[l].value!="function")&&i(new Error("Worker module "+l+": not found or its 'init' did not return a function"));try{var c=(a=t[l]).value.apply(a,s);c&&typeof c.then=="function"?c.then(u,function(d){return i(d instanceof Error?d:new Error(""+d))}):u(c)}catch(d){i(d)}function u(d){try{var f=t[l].getTransferables&&t[l].getTransferables(d);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),i(d,f)}catch(p){console.error(p),i(p)}}}function o(r,i){var a=void 0;self.troikaDefine=function(s){return a=s};var l=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/ troikaDefine( `+i+` @@ -4102,7 +4102,7 @@ troikaDefine( `+WV(c)+` )}`}),Pre=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function s(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!l){l=gwe(r,"registerModule",s.workerModuleData);var d=function(){l=null,xE[r].delete(d)};(xE[r]||(xE[r]=new Set)).add(d)}return l.then(function(f){var p=f.isCallable;if(p)return gwe(r,"callModule",{id:i,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return s.workerModuleData={isWorkerModule:!0,id:i,name:a,dependencies:e,init:WV(n),getTransferables:o&&WV(o)},s}function wAt(t){xE[t]&&xE[t].forEach(function(e){e()}),vE[t]&&(vE[t].terminate(),delete vE[t])}function WV(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function vAt(t){var e=vE[t];if(!e){var n=WV(gAt);e=vE[t]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+t.replace(/\*/g,"")+` **/ -;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(o){var r=o.data,i=r.messageId,a=Yce[i];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete Yce[i],a(r)}}return e}function gwe(t,e,n){return new Promise(function(o,r){var i=++AAt;Yce[i]=function(a){a.success?o(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},vAt(t).postMessage({messageId:i,action:e,data:n})})}function hje(){var t=function(e){function n(j,B,O,V,G,q,$,ie){var Q=1-$;ie.x=Q*Q*j+2*Q*$*O+$*$*G,ie.y=Q*Q*B+2*Q*$*V+$*$*q}function o(j,B,O,V,G,q,$,ie,Q,se){var Z=1-Q;se.x=Z*Z*Z*j+3*Z*Z*Q*O+3*Z*Q*Q*G+Q*Q*Q*$,se.y=Z*Z*Z*B+3*Z*Z*Q*V+3*Z*Q*Q*q+Q*Q*Q*ie}function r(j,B){for(var O=/([MLQCZ])([^MLQCZ]*)/g,V,G,q,$,ie;V=O.exec(j);){var Q=V[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(se){return parseFloat(se)});switch(V[1]){case"M":$=G=Q[0],ie=q=Q[1];break;case"L":(Q[0]!==$||Q[1]!==ie)&&B("L",$,ie,$=Q[0],ie=Q[1]);break;case"Q":{B("Q",$,ie,$=Q[2],ie=Q[3],Q[0],Q[1]);break}case"C":{B("C",$,ie,$=Q[4],ie=Q[5],Q[0],Q[1],Q[2],Q[3]);break}case"Z":($!==G||ie!==q)&&B("L",$,ie,G,q);break}}}function i(j,B,O){O===void 0&&(O=16);var V={x:0,y:0};r(j,function(G,q,$,ie,Q,se,Z,ee,te){switch(G){case"L":B(q,$,ie,Q);break;case"Q":{for(var oe=q,de=$,he=1;he0;)Je[Ue]=arguments[Ue+2];var nt=ve[Ne]||(ve[Ne]=O.getUniformLocation(we,Ne));O["uniform"+ze].apply(O,[nt].concat(Je))},setAttribute:function(ze,Ne,Je,Ue,nt){var We=fe[ze];We||(We=fe[ze]={buf:O.createBuffer(),loc:O.getAttribLocation(we,ze),data:null}),O.bindBuffer(O.ARRAY_BUFFER,We.buf),O.vertexAttribPointer(We.loc,Ne,O.FLOAT,!1,0,0),O.enableVertexAttribArray(We.loc),G?O.vertexAttribDivisor(We.loc,Ue):pe("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(We.loc,Ue),nt!==We.data&&(O.bufferData(O.ARRAY_BUFFER,nt,Je),We.data=nt)}})}}}$[Re].transaction(ue)},Te=function(Re,De){Q++;try{O.activeTexture(O.TEXTURE0+Q);var Ae=ie[Re];Ae||(Ae=ie[Re]=O.createTexture(),O.bindTexture(O.TEXTURE_2D,Ae),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,O.NEAREST),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,O.NEAREST)),O.bindTexture(O.TEXTURE_2D,Ae),De(Ae,Q)}finally{Q--}},ge=function(Re,De,Ae){var ue=O.createFramebuffer();se.push(ue),O.bindFramebuffer(O.FRAMEBUFFER,ue),O.activeTexture(O.TEXTURE0+De),O.bindTexture(O.TEXTURE_2D,Re),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,Re,0);try{Ae(ue)}finally{O.deleteFramebuffer(ue),O.bindFramebuffer(O.FRAMEBUFFER,se[--se.length-1]||null)}},Se=function(){q={},$={},ie={},Q=-1,se.length=0};var Z=pe,ee=me,te=le,oe=Te,de=ge,he=Se,G=typeof WebGL2RenderingContext<"u"&&O instanceof WebGL2RenderingContext,q={},$={},ie={},Q=-1,se=[];O.canvas.addEventListener("webglcontextlost",function(Re){Se(),Re.preventDefault()},!1),s.set(O,V={gl:O,isWebGL2:G,getExtension:pe,withProgram:le,withTexture:Te,withTextureFramebuffer:ge,handleContextLoss:Se})}B(V)}function d(j,B,O,V,G,q,$,ie){$===void 0&&($=15),ie===void 0&&(ie=null),u(j,function(Q){var se=Q.gl,Z=Q.withProgram,ee=Q.withTexture;ee("copy",function(te,oe){se.texImage2D(se.TEXTURE_2D,0,se.RGBA,G,q,0,se.RGBA,se.UNSIGNED_BYTE,B),Z("copy",a,l,function(de){var he=de.setUniform,pe=de.setAttribute;pe("aUV",2,se.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),he("1i","image",oe),se.bindFramebuffer(se.FRAMEBUFFER,ie||null),se.disable(se.BLEND),se.colorMask($&8,$&4,$&2,$&1),se.viewport(O,V,G,q),se.scissor(O,V,G,q),se.drawArrays(se.TRIANGLES,0,3)})})})}function f(j,B,O){var V=j.width,G=j.height;u(j,function(q){var $=q.gl,ie=new Uint8Array(V*G*4);$.readPixels(0,0,V,G,$.RGBA,$.UNSIGNED_BYTE,ie),j.width=B,j.height=O,d($,ie,0,0,V,G)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:f});function g(j,B,O,V,G,q){q===void 0&&(q=1);var $=new Uint8Array(j*B),ie=V[2]-V[0],Q=V[3]-V[1],se=[];i(O,function(pe,me,le,Te){se.push({x1:pe,y1:me,x2:le,y2:Te,minX:Math.min(pe,le),minY:Math.min(me,Te),maxX:Math.max(pe,le),maxY:Math.max(me,Te)})}),se.sort(function(pe,me){return pe.maxX-me.maxX});for(var Z=0;ZSe.minX&&me-TeSe.minY){var Re=S(pe,me,Se.x1,Se.y1,Se.x2,Se.y2);Reme!=ge.y2>me&&pe<(ge.x2-ge.x1)*(me-ge.y1)/(ge.y2-ge.y1)+ge.x1;Se&&(le+=ge.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function A(Te,ge){var Se=36,Re=0,De=new Map,Ae=ge&&new Map,ue;return Te.split(",").forEach(function fe(ve){if(ve.indexOf("+")!==-1)for(var we=+ve;we--;)fe(ue);else{ue=ve;var Pe=ve.split(">"),Ie=Pe[0],Me=Pe[1];Ie=String.fromCodePoint(Re+=parseInt(Ie,Se)),Me=String.fromCodePoint(Re+=parseInt(Me,Se)),De.set(Ie,Me),ge&&Ae.set(Me,Ie)}}),{map:De,reverseMap:Ae}}var y,S,C;function P(){if(!y){var Te=A(g.pairs,!0),ge=Te.map,Se=Te.reverseMap;y=ge,S=Se,C=A(g.canonical,!1).map}}function v(Te){return P(),y.get(Te)||null}function T(Te){return P(),S.get(Te)||null}function w(Te){return P(),C.get(Te)||null}var x=o.L,b=o.R,R=o.EN,H=o.ES,F=o.ET,E=o.AN,N=o.CS,U=o.B,W=o.S,k=o.ON,D=o.BN,L=o.NSM,j=o.AL,B=o.LRO,O=o.RLO,V=o.LRE,G=o.RLE,q=o.PDF,$=o.LRI,ie=o.RLI,Q=o.FSI,se=o.PDI;function Z(Te,ge){for(var Se=125,Re=new Uint32Array(Te.length),De=0;De0)We--;else if(ke>0){for(Ee=0;!Ue[Ue.length-1]._isolate;)Ue.pop();var Ye=Ue[Ue.length-1]._isolInitIndex;Ye!=null&&(ve.set(Ye,Oe),ve.set(Oe,Ye)),Ue.pop(),ke--}nt=Ue[Ue.length-1],fe[Oe]=nt._level,nt._override&&ue(Oe,nt._override)}else st&q?(We===0&&(Ee>0?Ee--:!nt._isolate&&Ue.length>1&&(Ue.pop(),nt=Ue[Ue.length-1])),fe[Oe]=nt._level):st&U&&(fe[Oe]=Pe.level);else fe[Oe]=nt._level,nt._override&&st!==D&&ue(Oe,nt._override)}for(var it=[],ut=null,Qe=Pe.start;Qe<=Pe.end;Qe++){var lt=Re[Qe];if(!(lt&s)){var Ze=fe[Qe],Be=lt&i,$e=lt===se;ut&&Ze===ut._level?(ut._end=Qe,ut._endsWithIsolInit=Be):it.push(ut={_start:Qe,_end:Qe,_level:Ze,_startsWithPDI:$e,_endsWithIsolInit:Be})}}for(var wt=[],vt=0;vt=0;ft--)if(!(Re[ft]&s)){Ve=fe[ft];break}var kt=Wt[Wt.length-1],rt=fe[kt],at=Pe.level;if(!(Re[kt]&i)){for(var Ge=kt+1;Ge<=Pe.end;Ge++)if(!(Re[Ge]&s)){at=fe[Ge];break}}wt.push({_seqIndices:Wt,_sosType:Math.max(Ve,Ft)%2?b:x,_eosType:Math.max(at,rt)%2?b:x})}}for(var yt=0;yt=0;qt--)if(!(Re[ot[qt]]&s)){_t=Re[ot[qt]];break}ue(Ht,_t&(i|se)?k:_t)}}if(Ae.get(R))for(var un=0;un=-1;yo--){var Ao=yo===-1?bt:Re[ot[yo]];if(Ao&a){Ao===j&&ue(Rn,E);break}}}if(Ae.get(j))for(var wo=0;wo=0&&(fo=Re[ot[Rr]],!!(fo&s));Rr--);for(var br=po+1;br=0&&Re[ot[wn]]&(F|s);wn--)ue(ot[wn],R);for(_r++;_r=0&&Re[ot[Wo]]&s;Wo--)ue(ot[Wo],k);for(var to=In+1;to=0;Fo--){var Si=ei[Fo].char;if(Si===bi||Si===T(w(tr))||v(w(Si))===tr){fr.push([ei[Fo].seqIndex,hr]),ei.length=Fo;break}}}fr.sort(function(yn,An){return yn[0]-An[0]})}for(var hl=0;hl=0;Yi--){var ua=ot[Yi];if(Re[ua]&lr){var Vl=Re[ua]&Yo?b:x;Vl!==Bt?wi=Vl:wi=Bt;break}}}if(wi){if(Re[ot[or]]=Re[ot[Ai]]=wi,wi!==Bt){for(var Jl=or+1;Jl=0;Ot--)if(Re[ot[Ot]]&s)mu=Ot;else{tn=Re[ot[Ot]]&Yo?b:x;break}for(var mn=zt,Hn=Cc+1;Hn=0&&f(Te[Yt])&c;Yt--)fe[Yt]=Pe.level}}return{levels:fe,paragraphs:we};function Zt(yn,An){for(var Tn=yn;Tn=fe&&f(Te[Pe])&c;Pe--)we[Pe]=ue.level;for(var Ie=ue.level,Me=1/0,ze=0;zeIe&&(Ie=Ne),Ne=Me;Je--)for(var Ue=0;Ue=Je){for(var nt=Ue;Ue+1=Je;)Ue++;Ue>nt&&Ae.push([nt+fe,Ue+fe])}}}),Ae}function me(Te,ge,Se,Re){var De=le(Te,ge,Se,Re),Ae=[].concat(Te);return De.forEach(function(ue,fe){Ae[fe]=(ge.levels[ue]&1?de(Te[ue]):null)||Te[ue]}),Ae.join("")}function le(Te,ge,Se,Re){for(var De=pe(Te,ge,Se,Re),Ae=[],ue=0;ue/gm;function n(o,r){let i=da[r];return i?Oce(i):o}return t.replace(e,n)}const tf=[];for(let t=0;t<256;t++)tf[t]=(t<16?"0":"")+t.toString(16);function bAt(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(tf[t&255]+tf[t>>8&255]+tf[t>>16&255]+tf[t>>24&255]+"-"+tf[e&255]+tf[e>>8&255]+"-"+tf[e>>16&15|64]+tf[e>>24&255]+"-"+tf[n&63|128]+tf[n>>8&255]+"-"+tf[n>>16&255]+tf[n>>24&255]+tf[o&255]+tf[o>>8&255]+tf[o>>16&255]+tf[o>>24&255]).toUpperCase()}const J7=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e/gm,` +;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(o){var r=o.data,i=r.messageId,a=Yce[i];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete Yce[i],a(r)}}return e}function gwe(t,e,n){return new Promise(function(o,r){var i=++AAt;Yce[i]=function(a){a.success?o(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},vAt(t).postMessage({messageId:i,action:e,data:n})})}function hje(){var t=function(e){function n(j,B,O,V,G,q,$,ie){var Q=1-$;ie.x=Q*Q*j+2*Q*$*O+$*$*G,ie.y=Q*Q*B+2*Q*$*V+$*$*q}function o(j,B,O,V,G,q,$,ie,Q,se){var oe=1-Q;se.x=oe*oe*oe*j+3*oe*oe*Q*O+3*oe*Q*Q*G+Q*Q*Q*$,se.y=oe*oe*oe*B+3*oe*oe*Q*V+3*oe*Q*Q*q+Q*Q*Q*ie}function r(j,B){for(var O=/([MLQCZ])([^MLQCZ]*)/g,V,G,q,$,ie;V=O.exec(j);){var Q=V[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(se){return parseFloat(se)});switch(V[1]){case"M":$=G=Q[0],ie=q=Q[1];break;case"L":(Q[0]!==$||Q[1]!==ie)&&B("L",$,ie,$=Q[0],ie=Q[1]);break;case"Q":{B("Q",$,ie,$=Q[2],ie=Q[3],Q[0],Q[1]);break}case"C":{B("C",$,ie,$=Q[4],ie=Q[5],Q[0],Q[1],Q[2],Q[3]);break}case"Z":($!==G||ie!==q)&&B("L",$,ie,G,q);break}}}function i(j,B,O){O===void 0&&(O=16);var V={x:0,y:0};r(j,function(G,q,$,ie,Q,se,oe,Z,te){switch(G){case"L":B(q,$,ie,Q);break;case"Q":{for(var ee=q,de=$,fe=1;fe0;)Je[Ue]=arguments[Ue+2];var nt=ve[Ne]||(ve[Ne]=O.getUniformLocation(we,Ne));O["uniform"+ze].apply(O,[nt].concat(Je))},setAttribute:function(ze,Ne,Je,Ue,nt){var We=he[ze];We||(We=he[ze]={buf:O.createBuffer(),loc:O.getAttribLocation(we,ze),data:null}),O.bindBuffer(O.ARRAY_BUFFER,We.buf),O.vertexAttribPointer(We.loc,Ne,O.FLOAT,!1,0,0),O.enableVertexAttribArray(We.loc),G?O.vertexAttribDivisor(We.loc,Ue):pe("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(We.loc,Ue),nt!==We.data&&(O.bufferData(O.ARRAY_BUFFER,nt,Je),We.data=nt)}})}}}$[Re].transaction(ue)},Te=function(Re,De){Q++;try{O.activeTexture(O.TEXTURE0+Q);var Ae=ie[Re];Ae||(Ae=ie[Re]=O.createTexture(),O.bindTexture(O.TEXTURE_2D,Ae),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MIN_FILTER,O.NEAREST),O.texParameteri(O.TEXTURE_2D,O.TEXTURE_MAG_FILTER,O.NEAREST)),O.bindTexture(O.TEXTURE_2D,Ae),De(Ae,Q)}finally{Q--}},ge=function(Re,De,Ae){var ue=O.createFramebuffer();se.push(ue),O.bindFramebuffer(O.FRAMEBUFFER,ue),O.activeTexture(O.TEXTURE0+De),O.bindTexture(O.TEXTURE_2D,Re),O.framebufferTexture2D(O.FRAMEBUFFER,O.COLOR_ATTACHMENT0,O.TEXTURE_2D,Re,0);try{Ae(ue)}finally{O.deleteFramebuffer(ue),O.bindFramebuffer(O.FRAMEBUFFER,se[--se.length-1]||null)}},Se=function(){q={},$={},ie={},Q=-1,se.length=0};var oe=pe,Z=ye,te=ae,ee=Te,de=ge,fe=Se,G=typeof WebGL2RenderingContext<"u"&&O instanceof WebGL2RenderingContext,q={},$={},ie={},Q=-1,se=[];O.canvas.addEventListener("webglcontextlost",function(Re){Se(),Re.preventDefault()},!1),s.set(O,V={gl:O,isWebGL2:G,getExtension:pe,withProgram:ae,withTexture:Te,withTextureFramebuffer:ge,handleContextLoss:Se})}B(V)}function d(j,B,O,V,G,q,$,ie){$===void 0&&($=15),ie===void 0&&(ie=null),u(j,function(Q){var se=Q.gl,oe=Q.withProgram,Z=Q.withTexture;Z("copy",function(te,ee){se.texImage2D(se.TEXTURE_2D,0,se.RGBA,G,q,0,se.RGBA,se.UNSIGNED_BYTE,B),oe("copy",a,l,function(de){var fe=de.setUniform,pe=de.setAttribute;pe("aUV",2,se.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),fe("1i","image",ee),se.bindFramebuffer(se.FRAMEBUFFER,ie||null),se.disable(se.BLEND),se.colorMask($&8,$&4,$&2,$&1),se.viewport(O,V,G,q),se.scissor(O,V,G,q),se.drawArrays(se.TRIANGLES,0,3)})})})}function f(j,B,O){var V=j.width,G=j.height;u(j,function(q){var $=q.gl,ie=new Uint8Array(V*G*4);$.readPixels(0,0,V,G,$.RGBA,$.UNSIGNED_BYTE,ie),j.width=B,j.height=O,d($,ie,0,0,V,G)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:d,resizeWebGLCanvasWithoutClearing:f});function g(j,B,O,V,G,q){q===void 0&&(q=1);var $=new Uint8Array(j*B),ie=V[2]-V[0],Q=V[3]-V[1],se=[];i(O,function(pe,ye,ae,Te){se.push({x1:pe,y1:ye,x2:ae,y2:Te,minX:Math.min(pe,ae),minY:Math.min(ye,Te),maxX:Math.max(pe,ae),maxY:Math.max(ye,Te)})}),se.sort(function(pe,ye){return pe.maxX-ye.maxX});for(var oe=0;oeSe.minX&&ye-TeSe.minY){var Re=S(pe,ye,Se.x1,Se.y1,Se.x2,Se.y2);Reye!=ge.y2>ye&&pe<(ge.x2-ge.x1)*(ye-ge.y1)/(ge.y2-ge.y1)+ge.x1;Se&&(ae+=ge.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function A(Te,ge){var Se=36,Re=0,De=new Map,Ae=ge&&new Map,ue;return Te.split(",").forEach(function he(ve){if(ve.indexOf("+")!==-1)for(var we=+ve;we--;)he(ue);else{ue=ve;var Pe=ve.split(">"),Ie=Pe[0],Me=Pe[1];Ie=String.fromCodePoint(Re+=parseInt(Ie,Se)),Me=String.fromCodePoint(Re+=parseInt(Me,Se)),De.set(Ie,Me),ge&&Ae.set(Me,Ie)}}),{map:De,reverseMap:Ae}}var y,S,C;function P(){if(!y){var Te=A(g.pairs,!0),ge=Te.map,Se=Te.reverseMap;y=ge,S=Se,C=A(g.canonical,!1).map}}function v(Te){return P(),y.get(Te)||null}function T(Te){return P(),S.get(Te)||null}function w(Te){return P(),C.get(Te)||null}var x=o.L,b=o.R,R=o.EN,H=o.ES,F=o.ET,E=o.AN,N=o.CS,U=o.B,W=o.S,k=o.ON,D=o.BN,L=o.NSM,j=o.AL,B=o.LRO,O=o.RLO,V=o.LRE,G=o.RLE,q=o.PDF,$=o.LRI,ie=o.RLI,Q=o.FSI,se=o.PDI;function oe(Te,ge){for(var Se=125,Re=new Uint32Array(Te.length),De=0;De0)We--;else if(ke>0){for(Ee=0;!Ue[Ue.length-1]._isolate;)Ue.pop();var Ye=Ue[Ue.length-1]._isolInitIndex;Ye!=null&&(ve.set(Ye,Oe),ve.set(Oe,Ye)),Ue.pop(),ke--}nt=Ue[Ue.length-1],he[Oe]=nt._level,nt._override&&ue(Oe,nt._override)}else st&q?(We===0&&(Ee>0?Ee--:!nt._isolate&&Ue.length>1&&(Ue.pop(),nt=Ue[Ue.length-1])),he[Oe]=nt._level):st&U&&(he[Oe]=Pe.level);else he[Oe]=nt._level,nt._override&&st!==D&&ue(Oe,nt._override)}for(var it=[],ut=null,Qe=Pe.start;Qe<=Pe.end;Qe++){var lt=Re[Qe];if(!(lt&s)){var Ze=he[Qe],Be=lt&i,$e=lt===se;ut&&Ze===ut._level?(ut._end=Qe,ut._endsWithIsolInit=Be):it.push(ut={_start:Qe,_end:Qe,_level:Ze,_startsWithPDI:$e,_endsWithIsolInit:Be})}}for(var wt=[],vt=0;vt=0;ft--)if(!(Re[ft]&s)){Ve=he[ft];break}var kt=Wt[Wt.length-1],rt=he[kt],at=Pe.level;if(!(Re[kt]&i)){for(var Ge=kt+1;Ge<=Pe.end;Ge++)if(!(Re[Ge]&s)){at=he[Ge];break}}wt.push({_seqIndices:Wt,_sosType:Math.max(Ve,Ft)%2?b:x,_eosType:Math.max(at,rt)%2?b:x})}}for(var yt=0;yt=0;qt--)if(!(Re[ot[qt]]&s)){_t=Re[ot[qt]];break}ue(Ht,_t&(i|se)?k:_t)}}if(Ae.get(R))for(var un=0;un=-1;yo--){var Ao=yo===-1?bt:Re[ot[yo]];if(Ao&a){Ao===j&&ue(Rn,E);break}}}if(Ae.get(j))for(var wo=0;wo=0&&(fo=Re[ot[Rr]],!!(fo&s));Rr--);for(var br=po+1;br=0&&Re[ot[wn]]&(F|s);wn--)ue(ot[wn],R);for(_r++;_r=0&&Re[ot[Wo]]&s;Wo--)ue(ot[Wo],k);for(var to=In+1;to=0;Fo--){var Si=ei[Fo].char;if(Si===bi||Si===T(w(tr))||v(w(Si))===tr){fr.push([ei[Fo].seqIndex,hr]),ei.length=Fo;break}}}fr.sort(function(yn,An){return yn[0]-An[0]})}for(var hl=0;hl=0;Yi--){var ua=ot[Yi];if(Re[ua]&lr){var Vl=Re[ua]&Yo?b:x;Vl!==Bt?wi=Vl:wi=Bt;break}}}if(wi){if(Re[ot[or]]=Re[ot[Ai]]=wi,wi!==Bt){for(var Jl=or+1;Jl=0;Ot--)if(Re[ot[Ot]]&s)mu=Ot;else{tn=Re[ot[Ot]]&Yo?b:x;break}for(var mn=zt,Hn=Cc+1;Hn=0&&f(Te[Yt])&c;Yt--)he[Yt]=Pe.level}}return{levels:he,paragraphs:we};function Zt(yn,An){for(var Tn=yn;Tn=he&&f(Te[Pe])&c;Pe--)we[Pe]=ue.level;for(var Ie=ue.level,Me=1/0,ze=0;zeIe&&(Ie=Ne),Ne=Me;Je--)for(var Ue=0;Ue=Je){for(var nt=Ue;Ue+1=Je;)Ue++;Ue>nt&&Ae.push([nt+he,Ue+he])}}}),Ae}function ye(Te,ge,Se,Re){var De=ae(Te,ge,Se,Re),Ae=[].concat(Te);return De.forEach(function(ue,he){Ae[he]=(ge.levels[ue]&1?de(Te[ue]):null)||Te[ue]}),Ae.join("")}function ae(Te,ge,Se,Re){for(var De=pe(Te,ge,Se,Re),Ae=[],ue=0;ue/gm;function n(o,r){let i=da[r];return i?Oce(i):o}return t.replace(e,n)}const tf=[];for(let t=0;t<256;t++)tf[t]=(t<16?"0":"")+t.toString(16);function bAt(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(tf[t&255]+tf[t>>8&255]+tf[t>>16&255]+tf[t>>24&255]+"-"+tf[e&255]+tf[e>>8&255]+"-"+tf[e>>16&15|64]+tf[e>>24&255]+"-"+tf[n&63|128]+tf[n>>8&255]+"-"+tf[n>>16&255]+tf[n>>24&255]+tf[o&255]+tf[o>>8&255]+tf[o>>16&255]+tf[o>>24&255]).toUpperCase()}const J7=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e/gm,` //!BEGIN_POST_CHUNK $1 $& //!END_POST_CHUNK @@ -4134,8 +4134,8 @@ void main() { ${r} }`),t}function CAt(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let RAt=0;const wwe=new Map;function HAt(t){const e=JSON.stringify(t,CAt);let n=wwe.get(e);return n==null&&wwe.set(e,n=++RAt),n}function MAt(t,e,n){const{defaultFontURL:o}=n,r=Object.create(null),i=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,l="[^\\S\\u00A0]",s=new RegExp(`${l}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(C,P){function v(){const T=w=>{console.error(`Failure loading font ${C}${C===o?"":"; trying fallback"}`,w),C!==o&&(C=o,v())};try{const w=new XMLHttpRequest;w.open("get",C,!0),w.responseType="arraybuffer",w.onload=function(){if(w.status>=400)T(new Error(w.statusText));else if(w.status>0)try{const x=t(w.response);P(x)}catch(x){T(x)}},w.onerror=T,w.send()}catch(w){T(w)}}v()}function u(C,P){C||(C=o);let v=r[C];v?v.pending?v.pending.push(P):P(v):(r[C]={pending:[P]},c(C,T=>{let w=r[C].pending;r[C]=T,w.forEach(x=>x(T))}))}function d({text:C="",font:P=o,sdfGlyphSize:v=64,fontSize:T=1,letterSpacing:w=0,lineHeight:x="normal",maxWidth:b=i,direction:R,textAlign:H="left",textIndent:F=0,whiteSpace:E="normal",overflowWrap:N="normal",anchorX:U=0,anchorY:W=0,includeCaretPositions:k=!1,chunkedBoundsSize:D=8192,colorRanges:L=null},j,B=!1){const O=A(),V={fontLoad:0,typesetting:0};C.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),C=C.replace(/\r\n/g,` `).replace(/\r/g,` -`)),T=+T,w=+w,b=+b,x=x||"normal",F=+F,u(P,G=>{const q=isFinite(b);let $=null,ie=null,Q=null,se=null,Z=null,ee=null,te=null,oe=0,de=0,he=E!=="nowrap";const{ascender:pe,descender:me,unitsPerEm:le,lineGap:Te,capHeight:ge,xHeight:Se}=G;V.fontLoad=A()-O;const Re=A(),De=T/le;x==="normal"&&(x=(pe-me+Te)/le),x=x*T;const Ae=(x-(pe-me)*De)/2,ue=-(pe*De+Ae),fe=Math.min(x,(pe-me)*De),ve=(pe+me)/2*De-fe/2;let we=F,Pe=new y;const Ie=[Pe];G.forEachGlyph(C,T,w,(Ne,Je,Ue)=>{const nt=C.charAt(Ue),We=Ne.advanceWidth*De,Ee=Pe.count;let ke;if("isEmpty"in Ne||(Ne.isWhitespace=!!nt&&new RegExp(l).test(nt),Ne.canBreakAfter=!!nt&&s.test(nt),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||a.test(nt)),!Ne.isWhitespace&&!Ne.isEmpty&&de++,he&&q&&!Ne.isWhitespace&&Je+We+we>b&&Ee){if(Pe.glyphAt(Ee-1).glyphObj.canBreakAfter)ke=new y,we=-Je;else for(let st=Ee;st--;)if(st===0&&N==="break-word"){ke=new y,we=-Je;break}else if(Pe.glyphAt(st).glyphObj.canBreakAfter){ke=Pe.splitAt(st+1);const je=ke.glyphAt(0).x;we-=je;for(let xt=ke.count;xt--;)ke.glyphAt(xt).x-=je;break}ke&&(Pe.isSoftWrapped=!0,Pe=ke,Ie.push(Pe),oe=b)}let Oe=Pe.glyphAt(Pe.count);Oe.glyphObj=Ne,Oe.x=Je+we,Oe.width=We,Oe.charIndex=Ue,nt===` -`&&(Pe=new y,Ie.push(Pe),we=-(Je+We+w*T)+F)}),Ie.forEach(Ne=>{for(let Je=Ne.count;Je--;){let{glyphObj:Ue,x:nt,width:We}=Ne.glyphAt(Je);if(!Ue.isWhitespace){Ne.width=nt+We,Ne.width>oe&&(oe=Ne.width);return}}});let Me=0,ze=0;if(U&&(typeof U=="number"?Me=-U:typeof U=="string"&&(Me=-oe*(U==="left"?0:U==="center"?.5:U==="right"?1:p(U)))),W){if(typeof W=="number")ze=-W;else if(typeof W=="string"){let Ne=Ie.length*x;ze=W==="top"?0:W==="top-baseline"?-ue:W==="top-cap"?-ue-ge*De:W==="top-ex"?-ue-Se*De:W==="middle"?Ne/2:W==="bottom"?Ne:W==="bottom-baseline"?Ne-Ae+me*De:p(W)*Ne}}if(!B){const Ne=e.getEmbeddingLevels(C,R);$=new Uint16Array(de),ie=new Float32Array(de*2),Q={},ee=[i,i,-i,-i],te=[];let Je=ue;k&&(Z=new Float32Array(C.length*3)),L&&(se=new Uint8Array(de*3));let Ue=0,nt=-1,We=-1,Ee,ke;if(Ie.forEach((Oe,st)=>{let{count:je,width:xt}=Oe;if(je>0){let gt=0;for(let Ze=je;Ze--&&Oe.glyphAt(Ze).glyphObj.isWhitespace;)gt++;let Ye=0,it=0;if(H==="center")Ye=(oe-xt)/2;else if(H==="right")Ye=oe-xt;else if(H==="justify"&&Oe.isSoftWrapped){let Ze=0;for(let Be=je-gt;Be--;)Oe.glyphAt(Be).glyphObj.isWhitespace&&Ze++;it=(oe-xt)/Ze}if(it||Ye){let Ze=0;for(let Be=0;Be=Be){let Gt=Rt,At=Rt;for(;At$e)break;AtQe=Ze;for(let Ze=0;Ze1&&g(Z,nt,At),nt=vt}if(L){const{charIndex:vt}=Be;for(;vt>We;)We++,L.hasOwnProperty(We)&&(ke=L[We])}if(!Qe.isWhitespace&&!Qe.isEmpty){const vt=Ue++;Q[$e]||(Q[$e]={path:Qe.path,pathBounds:[Qe.xMin,Qe.yMin,Qe.xMax,Qe.yMax]});const Rt=Be.x+Me,Gt=Je+ze;ie[vt*2]=Rt,ie[vt*2+1]=Gt;const At=Rt+Qe.xMin*De,pt=Gt+Qe.yMin*De,Wt=Rt+Qe.xMax*De,ht=Gt+Qe.yMax*De;Atee[2]&&(ee[2]=Wt),ht>ee[3]&&(ee[3]=ht),vt%D===0&&(Ee={start:vt,end:vt,rect:[i,i,-i,-i]},te.push(Ee)),Ee.end++;const ct=Ee.rect;if(Atct[2]&&(ct[2]=Wt),ht>ct[3]&&(ct[3]=ht),$[vt]=$e,L){const It=vt*3;se[It]=ke>>16&255,se[It+1]=ke>>8&255,se[It+2]=ke&255}}}}Je-=x}),Z){const Oe=C.length-nt;Oe>1&&g(Z,nt,Oe)}}V.typesetting=A()-Re,j({glyphIds:$,glyphPositions:ie,glyphData:Q,caretPositions:Z,caretHeight:fe,glyphColors:se,chunkedBounds:te,fontSize:T,unitsPerEm:le,ascender:pe*De,descender:me*De,capHeight:ge*De,xHeight:Se*De,lineHeight:x,topBaseline:ue,blockBounds:[Me,ze-Ie.length*x,Me+oe,ze],visibleBounds:ee,timings:V})})}function f(C,P){d(C,v=>{const[T,w,x,b]=v.blockBounds;P({width:x-T,height:b-w})},{metricsOnly:!0})}function p(C){let P=C.match(/^([\d.]+)%$/),v=P?parseFloat(P[1]):NaN;return isNaN(v)?0:v/100}function g(C,P,v){const T=C[P*3],w=C[P*3+1],x=C[P*3+2],b=(w-T)/v;for(let R=0;R(Object.defineProperty(C,P,{get(){return this.data[this.index*S.length+v]},set(w){this.data[this.index*S.length+v]=w}}),C),{data:null,index:0}),{typeset:d,measure:f,loadFont:u}}const gx=()=>(self.performance||Date).now(),jq=hje();let vwe;function IAt(t,e,n,o,r,i,a,l,s,c,u=!0){return u?DAt(t,e,n,o,r,i,a,l,s,c).then(null,d=>(vwe||(console.warn("WebGL SDF generation failed, falling back to JS",d),vwe=!0),bwe(t,e,n,o,r,i,a,l,s,c))):bwe(t,e,n,o,r,i,a,l,s,c)}const NV=[],zAt=5;let _ce=0;function gje(){const t=gx();for(;NV.length&&gx()-tnew Promise((e,n)=>{NV.push(()=>{const o=gx();try{jq.webgl.generateIntoCanvas(...t),e({timing:gx()-o})}catch(r){n(r)}}),_ce||(_ce=setTimeout(gje,0))}),EAt=4,FAt=2e3,xwe={};let kAt=0;function bwe(t,e,n,o,r,i,a,l,s,c){const u="TroikaTextSDFGenerator_JS_"+kAt++%EAt;let d=xwe[u];return d||(d=xwe[u]={workerModule:pW({name:u,workerId:u,dependencies:[hje,gx],init(f,p){const g=f().javascript.generate;return function(...A){const y=p();return{textureData:g(...A),timing:p()-y}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(t,e,n,o,r,i).then(({textureData:f,timing:p})=>{const g=gx(),A=new Uint8Array(f.length*4);for(let y=0;y{wAt(u)},FAt)),{timing:p}})}function LAt(t){t._warm||(jq.webgl.isSupported(t),t._warm=!0)}const WAt=jq.webglUtils.resizeWebGLCanvasWithoutClearing;/*! +`)),T=+T,w=+w,b=+b,x=x||"normal",F=+F,u(P,G=>{const q=isFinite(b);let $=null,ie=null,Q=null,se=null,oe=null,Z=null,te=null,ee=0,de=0,fe=E!=="nowrap";const{ascender:pe,descender:ye,unitsPerEm:ae,lineGap:Te,capHeight:ge,xHeight:Se}=G;V.fontLoad=A()-O;const Re=A(),De=T/ae;x==="normal"&&(x=(pe-ye+Te)/ae),x=x*T;const Ae=(x-(pe-ye)*De)/2,ue=-(pe*De+Ae),he=Math.min(x,(pe-ye)*De),ve=(pe+ye)/2*De-he/2;let we=F,Pe=new y;const Ie=[Pe];G.forEachGlyph(C,T,w,(Ne,Je,Ue)=>{const nt=C.charAt(Ue),We=Ne.advanceWidth*De,Ee=Pe.count;let ke;if("isEmpty"in Ne||(Ne.isWhitespace=!!nt&&new RegExp(l).test(nt),Ne.canBreakAfter=!!nt&&s.test(nt),Ne.isEmpty=Ne.xMin===Ne.xMax||Ne.yMin===Ne.yMax||a.test(nt)),!Ne.isWhitespace&&!Ne.isEmpty&&de++,fe&&q&&!Ne.isWhitespace&&Je+We+we>b&&Ee){if(Pe.glyphAt(Ee-1).glyphObj.canBreakAfter)ke=new y,we=-Je;else for(let st=Ee;st--;)if(st===0&&N==="break-word"){ke=new y,we=-Je;break}else if(Pe.glyphAt(st).glyphObj.canBreakAfter){ke=Pe.splitAt(st+1);const je=ke.glyphAt(0).x;we-=je;for(let xt=ke.count;xt--;)ke.glyphAt(xt).x-=je;break}ke&&(Pe.isSoftWrapped=!0,Pe=ke,Ie.push(Pe),ee=b)}let Oe=Pe.glyphAt(Pe.count);Oe.glyphObj=Ne,Oe.x=Je+we,Oe.width=We,Oe.charIndex=Ue,nt===` +`&&(Pe=new y,Ie.push(Pe),we=-(Je+We+w*T)+F)}),Ie.forEach(Ne=>{for(let Je=Ne.count;Je--;){let{glyphObj:Ue,x:nt,width:We}=Ne.glyphAt(Je);if(!Ue.isWhitespace){Ne.width=nt+We,Ne.width>ee&&(ee=Ne.width);return}}});let Me=0,ze=0;if(U&&(typeof U=="number"?Me=-U:typeof U=="string"&&(Me=-ee*(U==="left"?0:U==="center"?.5:U==="right"?1:p(U)))),W){if(typeof W=="number")ze=-W;else if(typeof W=="string"){let Ne=Ie.length*x;ze=W==="top"?0:W==="top-baseline"?-ue:W==="top-cap"?-ue-ge*De:W==="top-ex"?-ue-Se*De:W==="middle"?Ne/2:W==="bottom"?Ne:W==="bottom-baseline"?Ne-Ae+ye*De:p(W)*Ne}}if(!B){const Ne=e.getEmbeddingLevels(C,R);$=new Uint16Array(de),ie=new Float32Array(de*2),Q={},Z=[i,i,-i,-i],te=[];let Je=ue;k&&(oe=new Float32Array(C.length*3)),L&&(se=new Uint8Array(de*3));let Ue=0,nt=-1,We=-1,Ee,ke;if(Ie.forEach((Oe,st)=>{let{count:je,width:xt}=Oe;if(je>0){let gt=0;for(let Ze=je;Ze--&&Oe.glyphAt(Ze).glyphObj.isWhitespace;)gt++;let Ye=0,it=0;if(H==="center")Ye=(ee-xt)/2;else if(H==="right")Ye=ee-xt;else if(H==="justify"&&Oe.isSoftWrapped){let Ze=0;for(let Be=je-gt;Be--;)Oe.glyphAt(Be).glyphObj.isWhitespace&&Ze++;it=(ee-xt)/Ze}if(it||Ye){let Ze=0;for(let Be=0;Be=Be){let Gt=Rt,At=Rt;for(;At$e)break;AtQe=Ze;for(let Ze=0;Ze1&&g(oe,nt,At),nt=vt}if(L){const{charIndex:vt}=Be;for(;vt>We;)We++,L.hasOwnProperty(We)&&(ke=L[We])}if(!Qe.isWhitespace&&!Qe.isEmpty){const vt=Ue++;Q[$e]||(Q[$e]={path:Qe.path,pathBounds:[Qe.xMin,Qe.yMin,Qe.xMax,Qe.yMax]});const Rt=Be.x+Me,Gt=Je+ze;ie[vt*2]=Rt,ie[vt*2+1]=Gt;const At=Rt+Qe.xMin*De,pt=Gt+Qe.yMin*De,Wt=Rt+Qe.xMax*De,ht=Gt+Qe.yMax*De;AtZ[2]&&(Z[2]=Wt),ht>Z[3]&&(Z[3]=ht),vt%D===0&&(Ee={start:vt,end:vt,rect:[i,i,-i,-i]},te.push(Ee)),Ee.end++;const ct=Ee.rect;if(Atct[2]&&(ct[2]=Wt),ht>ct[3]&&(ct[3]=ht),$[vt]=$e,L){const It=vt*3;se[It]=ke>>16&255,se[It+1]=ke>>8&255,se[It+2]=ke&255}}}}Je-=x}),oe){const Oe=C.length-nt;Oe>1&&g(oe,nt,Oe)}}V.typesetting=A()-Re,j({glyphIds:$,glyphPositions:ie,glyphData:Q,caretPositions:oe,caretHeight:he,glyphColors:se,chunkedBounds:te,fontSize:T,unitsPerEm:ae,ascender:pe*De,descender:ye*De,capHeight:ge*De,xHeight:Se*De,lineHeight:x,topBaseline:ue,blockBounds:[Me,ze-Ie.length*x,Me+ee,ze],visibleBounds:Z,timings:V})})}function f(C,P){d(C,v=>{const[T,w,x,b]=v.blockBounds;P({width:x-T,height:b-w})},{metricsOnly:!0})}function p(C){let P=C.match(/^([\d.]+)%$/),v=P?parseFloat(P[1]):NaN;return isNaN(v)?0:v/100}function g(C,P,v){const T=C[P*3],w=C[P*3+1],x=C[P*3+2],b=(w-T)/v;for(let R=0;R(Object.defineProperty(C,P,{get(){return this.data[this.index*S.length+v]},set(w){this.data[this.index*S.length+v]=w}}),C),{data:null,index:0}),{typeset:d,measure:f,loadFont:u}}const gx=()=>(self.performance||Date).now(),jq=hje();let vwe;function IAt(t,e,n,o,r,i,a,l,s,c,u=!0){return u?DAt(t,e,n,o,r,i,a,l,s,c).then(null,d=>(vwe||(console.warn("WebGL SDF generation failed, falling back to JS",d),vwe=!0),bwe(t,e,n,o,r,i,a,l,s,c))):bwe(t,e,n,o,r,i,a,l,s,c)}const NV=[],zAt=5;let _ce=0;function gje(){const t=gx();for(;NV.length&&gx()-tnew Promise((e,n)=>{NV.push(()=>{const o=gx();try{jq.webgl.generateIntoCanvas(...t),e({timing:gx()-o})}catch(r){n(r)}}),_ce||(_ce=setTimeout(gje,0))}),EAt=4,FAt=2e3,xwe={};let kAt=0;function bwe(t,e,n,o,r,i,a,l,s,c){const u="TroikaTextSDFGenerator_JS_"+kAt++%EAt;let d=xwe[u];return d||(d=xwe[u]={workerModule:pW({name:u,workerId:u,dependencies:[hje,gx],init(f,p){const g=f().javascript.generate;return function(...A){const y=p();return{textureData:g(...A),timing:p()-y}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),d.requests++,clearTimeout(d.idleTimer),d.workerModule(t,e,n,o,r,i).then(({textureData:f,timing:p})=>{const g=gx(),A=new Uint8Array(f.length*4);for(let y=0;y{wAt(u)},FAt)),{timing:p}})}function LAt(t){t._warm||(jq.webgl.isSupported(t),t._warm=!0)}const WAt=jq.webglUtils.resizeWebGLCanvasWithoutClearing;/*! Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE */function NAt(){return typeof window>"u"&&(self.window=self),function(t){var e={parse:function(r){var i=e._bin,a=new Uint8Array(r);if(i.readASCII(a,0,4)=="ttcf"){var l=4;i.readUshort(a,l),l+=2,i.readUshort(a,l),l+=2;var s=i.readUint(a,l);l+=4;for(var c=[],u=0;u>>a&1&&i++;return i},e._lctf.readClassDef=function(r,i){var a=e._bin,l=[],s=a.readUshort(r,i);if(i+=2,s==1){var c=a.readUshort(r,i);i+=2;var u=a.readUshort(r,i);i+=2;for(var d=0;d0&&(s.featureParams=l+c);var u=a.readUshort(r,i);i+=2,s.tab=[];for(var d=0;d255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[i])},e.CFF.readEncoding=function(r,i,a){e._bin;var l=[".notdef"],s=r[i];if(i++,s!=0)throw"error: unknown encoding format: "+s;var c=r[i];i++;for(var u=0;u>4,C=15&y;if(S!=15&&A.push(S),C!=15&&A.push(C),C==15)break}for(var P="",v=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],T=0;T=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=s.readUshort(r,a),a+=2;var g=s.readUshort(r,a);a+=2,p=e._lctf.numOfOnes(f);var A=e._lctf.numOfOnes(g);if(u.fmt==1){u.pairsets=[];var y=s.readUshort(r,a);a+=2;for(var S=0;S=1&&u.fmt<=2){if(u.fmt==1)u.delta=s.readShort(r,a),a+=2;else if(u.fmt==2){var f=s.readUshort(r,a);a+=2,u.newg=s.readUshorts(r,a,f),a+=2*u.newg.length}}else if(i==4){u.vals=[],f=s.readUshort(r,a),a+=2;for(var p=0;p>>8;if((g&=15)!=0)throw"unknown kern table format: "+g;i=e.kern.readFormat0(r,i,d)}return d},e.kern.parseV1=function(r,i,a,l){var s=e._bin;s.readFixed(r,i),i+=4;var c=s.readUint(r,i);i+=4;for(var u={glyph1:[],rval:[]},d=0;d>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;i=e.kern.readFormat0(r,i,u)}return u},e.kern.readFormat0=function(r,i,a){var l=e._bin,s=-1,c=l.readUshort(r,i);i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2,l.readUshort(r,i),i+=2;for(var u=0;u=s.map.length?0:s.map[i];if(s.format==4){for(var c=-1,u=0;ui?0:65535&(s.idRangeOffset[c]!=0?s.glyphIdArray[i-s.startCount[c]+(s.idRangeOffset[c]>>1)-(s.idRangeOffset.length-c)]:i+s.idDelta[c])}if(s.format==12){if(i>s.groups[s.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(l,a):e.U._compoGlyph(l,i,a))},e.U._simpleGlyph=function(r,i){for(var a=0;as)){for(var y=!0,S=0,C=0;Cs)){for(y=!0,C=0;C>1,c.length=0,d=!0;else if(E=="o3"||E=="o23")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0;else if(E=="o4")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),p&&e.U.P.closePath(s),y+=c.pop(),e.U.P.moveTo(s,A,y),p=!0;else if(E=="o5")for(;c.length>0;)A+=c.shift(),y+=c.shift(),e.U.P.lineTo(s,A,y);else if(E=="o6"||E=="o7")for(var N=c.length,U=E=="o6",W=0;WMath.abs(b-y)?A=x+c.shift():y=b+c.shift(),e.U.P.curveTo(s,S,C,P,v,R,H),e.U.P.curveTo(s,T,w,x,b,A,y));else if(E=="o14"){if(c.length>0&&!d&&(f=c.shift()+a.nominalWidthX,d=!0),c.length==4){var L=c.shift(),j=c.shift(),B=c.shift(),O=c.shift(),V=e.CFF.glyphBySE(a,B),G=e.CFF.glyphBySE(a,O);e.U._drawCFF(a.CharStrings[V],i,a,l,s),i.x=L,i.y=j,e.U._drawCFF(a.CharStrings[G],i,a,l,s)}p&&(e.U.P.closePath(s),p=!1)}else if(E=="o19"||E=="o20")c.length%2!=0&&!d&&(f=c.shift()+l.nominalWidthX),u+=c.length>>1,c.length=0,d=!0,g+=u+7>>3;else if(E=="o21")c.length>2&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),y+=c.pop(),A+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,A,y),p=!0;else if(E=="o22")c.length>1&&!d&&(f=c.shift()+l.nominalWidthX,d=!0),A+=c.pop(),p&&e.U.P.closePath(s),e.U.P.moveTo(s,A,y),p=!0;else if(E=="o25"){for(;c.length>6;)A+=c.shift(),y+=c.shift(),e.U.P.lineTo(s,A,y);S=A+c.shift(),C=y+c.shift(),P=S+c.shift(),v=C+c.shift(),A=P+c.shift(),y=v+c.shift(),e.U.P.curveTo(s,S,C,P,v,A,y)}else if(E=="o26")for(c.length%2&&(A+=c.shift());c.length>0;)S=A,C=y+c.shift(),A=P=S+c.shift(),y=(v=C+c.shift())+c.shift(),e.U.P.curveTo(s,S,C,P,v,A,y);else if(E=="o27")for(c.length%2&&(y+=c.shift());c.length>0;)C=y,P=(S=A+c.shift())+c.shift(),v=C+c.shift(),A=P+c.shift(),y=v,e.U.P.curveTo(s,S,C,P,v,A,y);else if(E=="o10"||E=="o29"){var q=E=="o10"?l:a;if(c.length==0)console.debug("error: empty stack");else{var $=c.pop(),ie=q.Subrs[$+q.Bias];i.x=A,i.y=y,i.nStems=u,i.haveWidth=d,i.width=f,i.open=p,e.U._drawCFF(ie,i,a,l,s),A=i.x,y=i.y,u=i.nStems,d=i.haveWidth,f=i.width,p=i.open}}else if(E=="o30"||E=="o31"){var Q=c.length,se=(D=0,E=="o31");for(D+=Q-(N=-3&Q);D>>1|(21845&p)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,f[p]=((65280&g)>>>8|(255&g)<<8)>>>1}var A=function(E,N,U){for(var W=E.length,k=0,D=new n(N);k>>B]=O}return L},y=new e(288);for(p=0;p<144;++p)y[p]=8;for(p=144;p<256;++p)y[p]=9;for(p=256;p<280;++p)y[p]=7;for(p=280;p<288;++p)y[p]=8;var S=new e(32);for(p=0;p<32;++p)S[p]=5;var C=A(y,9),P=A(S,5),v=function(E){for(var N=E[0],U=1;UN&&(N=E[U]);return N},T=function(E,N,U){var W=N/8|0;return(E[W]|E[W+1]<<8)>>(7&N)&U},w=function(E,N){var U=N/8|0;return(E[U]|E[U+1]<<8|E[U+2]<<16)>>(7&N)},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(E,N,U){var W=new Error(N||x[E]);if(W.code=E,Error.captureStackTrace&&Error.captureStackTrace(W,b),!U)throw W;return W},R=function(E,N,U){var W=E.length;if(!W||U&&!U.l&&W<5)return N||new e(0);var k=!N||U,D=!U||U.i;U||(U={}),N||(N=new e(3*W));var L,j=function(nt){var We=N.length;if(nt>We){var Ee=new e(Math.max(2*We,nt));Ee.set(N),N=Ee}},B=U.f||0,O=U.p||0,V=U.b||0,G=U.l,q=U.d,$=U.m,ie=U.n,Q=8*W;do{if(!G){U.f=B=T(E,O,1);var se=T(E,O+1,3);if(O+=3,!se){var Z=E[(Se=((L=O)/8|0)+(7&L&&1)+4)-4]|E[Se-3]<<8,ee=Se+Z;if(ee>W){D&&b(0);break}k&&j(V+Z),N.set(E.subarray(Se,ee),V),U.b=V+=Z,U.p=O=8*ee;continue}if(se==1)G=C,q=P,$=9,ie=5;else if(se==2){var te=T(E,O,31)+257,oe=T(E,O+10,15)+4,de=te+T(E,O+5,31)+1;O+=14;for(var he=new e(de),pe=new e(19),me=0;me>>4)<16)he[me++]=Se;else{var De=0,Ae=0;for(Se==16?(Ae=3+T(E,O,3),O+=2,De=he[me-1]):Se==17?(Ae=3+T(E,O,7),O+=3):Se==18&&(Ae=11+T(E,O,127),O+=7);Ae--;)he[me++]=De}}var ue=he.subarray(0,te),fe=he.subarray(te);$=v(ue),ie=v(fe),G=A(ue,$),q=A(fe,ie)}else b(1);if(O>Q){D&&b(0);break}}k&&j(V+131072);for(var ve=(1<<$)-1,we=(1<>>4;if((O+=15&De)>Q){D&&b(0);break}if(De||b(2),Ie<256)N[V++]=Ie;else{if(Ie==256){Pe=O,G=null;break}var Me=Ie-254;if(Ie>264){var ze=r[me=Ie-257];Me=T(E,O,(1<>>4;if(Ne||b(3),O+=15&Ne,fe=d[Je],Je>3&&(ze=i[Je],fe+=w(E,O)&(1<Q){D&&b(0);break}k&&j(V+131072);for(var Ue=V+Me;Vnt.length)&&(Ee=nt.length);var ke=new(nt instanceof n?n:nt instanceof o?o:e)(Ee-We);return ke.set(nt.subarray(We,Ee)),ke}(N,0,V)},H=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(H,{stream:!0})}catch{}return t.convert_streams=function(E){var N=new DataView(E),U=0;function W(){var te=N.getUint16(U);return U+=2,te}function k(){var te=N.getUint32(U);return U+=4,te}function D(te){Z.setUint16(ee,te),ee+=2}function L(te){Z.setUint32(ee,te),ee+=4}for(var j={signature:k(),flavor:k(),length:k(),numTables:W(),reserved:W(),totalSfntSize:k(),majorVersion:W(),minorVersion:W(),metaOffset:k(),metaLength:k(),metaOrigLength:k(),privOffset:k(),privLength:k()},B=0;Math.pow(2,B)<=j.numTables;)B++;B--;for(var O=16*Math.pow(2,B),V=16*j.numTables-O,G=12,q=[],$=0;${let[H,F]=R.split("+");H=parseInt(H,36),F=F?parseInt(F,36):0,u.set(b+=H,w[x]);for(let E=F;E--;)u.set(++b,w[x])})}}return u.get(T)||c}const f=1,p=2,g=3,A=4,y=[null,"isol","init","fina","medi"];function S(T){const w=new Uint8Array(T.length);let x=c,b=f,R=-1;for(let H=0;H65535&&H++)}return w}function C(T,w){const x=[];for(let R=0;R65535&&R++,x.push(t.U.codeToGlyph(T,H))}const b=T.GSUB;if(b){const{lookupList:R,featureList:H}=b;let F;const E=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,N=[];H.forEach(U=>{if(E.test(U.tag))for(let W=0;W{if(O!==-1){let G=w[O];if(!G){const{cmds:q,crds:$}=t.U.glyphToPath(T,O);let ie="",Q=0;for(let oe=0,de=q.length;oe1?",":"")+$[Q++]}let se,Z,ee,te;if($.length){se=Z=1/0,ee=te=-1/0;for(let oe=0,de=$.length;oeee&&(ee=he),pe>te&&(te=pe)}}else se=ee=Z=te=0;G=w[O]={index:O,advanceWidth:T.hmtx.aWidth[O],xMin:se,yMin:Z,xMax:ee,yMax:te,path:ie,pathCommandCount:q.length}}B!==-1&&(k+=t.U.getPairAdjustment(T,B,O)*D),W.call(null,G,k,j),G.advanceWidth&&(k+=G.advanceWidth*D),U&&(k+=U*N),B=O}j+=E.codePointAt(j)>65535?2:1}),k}};return F}return function(w){const x=new Uint8Array(w,0,4),b=t._bin.readASCII(x,0,4);if(b==="wOFF")w=e(w);else if(b==="wOF2")throw new Error("woff2 fonts not supported");return v(t.parse(w)[0])}}const BAt=pW({name:"Typr Font Parser",dependencies:[NAt,UAt,jAt],init(t,e,n){const o=t(),r=e();return n(o,r)}}),eC={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},YAt=new rr;function MT(){return(self.performance||Date).now()}const Swe=Object.create(null);function mje(t,e){t=_At({},t);const n=MT();if(t.font=GAt(t.font||eC.defaultFontURL),t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||eC.sdfGlyphSize,t.colorRanges!=null){let d={};for(let f in t.colorRanges)if(t.colorRanges.hasOwnProperty(f)){let p=t.colorRanges[f];typeof p!="number"&&(p=YAt.set(p).getHex()),d[f]=p}t.colorRanges=d}Object.freeze(t);const{textureWidth:o,sdfExponent:r}=eC,{sdfGlyphSize:i}=t,a=o/i*4;let l=Swe[i];if(!l){const d=document.createElement("canvas");d.width=o,d.height=i*256/a,l=Swe[i]={glyphCount:0,sdfGlyphSize:i,sdfCanvas:d,sdfTexture:new Vc(d,void 0,void 0,void 0,Gs,Gs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,OAt(l)}const{sdfTexture:s,sdfCanvas:c}=l;let u=l.glyphsByFont.get(t.font);u||l.glyphsByFont.set(t.font,u=new Map),JAt(t).then(d=>{const{glyphIds:f,glyphPositions:p,fontSize:g,unitsPerEm:A,timings:y}=d,S=[],C=new Float32Array(f.length*4),P=g/A;let v=0,T=0;const w=MT();f.forEach((F,E)=>{let N=u.get(F);if(!N){const{path:D,pathBounds:L}=d.glyphData[F],j=Math.max(L[2]-L[0],L[3]-L[1])/i*(eC.sdfMargin*i+.5),B=l.glyphCount++,O=[L[0]-j,L[1]-j,L[2]+j,L[3]+j];u.set(F,N={path:D,atlasIndex:B,sdfViewBox:O}),S.push(N)}const{sdfViewBox:U}=N,W=p[T++],k=p[T++];C[v++]=W+U[0]*P,C[v++]=k+U[1]*P,C[v++]=W+U[2]*P,C[v++]=k+U[3]*P,f[E]=N.atlasIndex}),y.quads=(y.quads||0)+(MT()-w);const x=MT();y.sdf={};const b=c.height,R=Math.ceil(l.glyphCount/a),H=Math.pow(2,Math.ceil(Math.log2(R*i)));H>b&&(console.info(`Increasing SDF texture size ${b}->${H}`),WAt(c,o,H),s.dispose()),Promise.all(S.map(F=>yje(F,l,t.gpuAccelerateSDF).then(({timing:E})=>{y.sdf[F.atlasIndex]=E}))).then(()=>{S.length&&!l.contextLost&&(Aje(l),s.needsUpdate=!0),y.sdfTotal=MT()-x,y.total=MT()-n,e(Object.freeze({parameters:t,sdfTexture:s,sdfGlyphSize:i,sdfExponent:r,glyphBounds:C,glyphAtlasIndices:f,glyphColors:d.glyphColors,caretPositions:d.caretPositions,caretHeight:d.caretHeight,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{l.contextLost||LAt(c)})}function yje({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:o,sdfCanvas:r,contextLost:i},a){if(i)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:s}=eC,c=Math.max(n[2]-n[0],n[3]-n[1]),u=Math.floor(e/4),d=u%(l/o)*o,f=Math.floor(u/(l/o))*o,p=e%4;return IAt(o,o,t,n,c,s,r,d,f,p,a)}function OAt(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const o=[];t.glyphsByFont.forEach(r=>{r.forEach(i=>{o.push(yje(i,t,!0))})}),Promise.all(o).then(()=>{Aje(t),t.sdfTexture.needsUpdate=!0})})}function VAt({font:t,characters:e,sdfGlyphSize:n},o){let r=Array.isArray(e)?e.join(` +*/function UAt(){return function(t){var e=Uint8Array,n=Uint16Array,o=Uint32Array,r=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=function(E,N){for(var U=new n(31),W=0;W<31;++W)U[W]=N+=1<>>1|(21845&p)<<1;g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4,f[p]=((65280&g)>>>8|(255&g)<<8)>>>1}var A=function(E,N,U){for(var W=E.length,k=0,D=new n(N);k>>B]=O}return L},y=new e(288);for(p=0;p<144;++p)y[p]=8;for(p=144;p<256;++p)y[p]=9;for(p=256;p<280;++p)y[p]=7;for(p=280;p<288;++p)y[p]=8;var S=new e(32);for(p=0;p<32;++p)S[p]=5;var C=A(y,9),P=A(S,5),v=function(E){for(var N=E[0],U=1;UN&&(N=E[U]);return N},T=function(E,N,U){var W=N/8|0;return(E[W]|E[W+1]<<8)>>(7&N)&U},w=function(E,N){var U=N/8|0;return(E[U]|E[U+1]<<8|E[U+2]<<16)>>(7&N)},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(E,N,U){var W=new Error(N||x[E]);if(W.code=E,Error.captureStackTrace&&Error.captureStackTrace(W,b),!U)throw W;return W},R=function(E,N,U){var W=E.length;if(!W||U&&!U.l&&W<5)return N||new e(0);var k=!N||U,D=!U||U.i;U||(U={}),N||(N=new e(3*W));var L,j=function(nt){var We=N.length;if(nt>We){var Ee=new e(Math.max(2*We,nt));Ee.set(N),N=Ee}},B=U.f||0,O=U.p||0,V=U.b||0,G=U.l,q=U.d,$=U.m,ie=U.n,Q=8*W;do{if(!G){U.f=B=T(E,O,1);var se=T(E,O+1,3);if(O+=3,!se){var oe=E[(Se=((L=O)/8|0)+(7&L&&1)+4)-4]|E[Se-3]<<8,Z=Se+oe;if(Z>W){D&&b(0);break}k&&j(V+oe),N.set(E.subarray(Se,Z),V),U.b=V+=oe,U.p=O=8*Z;continue}if(se==1)G=C,q=P,$=9,ie=5;else if(se==2){var te=T(E,O,31)+257,ee=T(E,O+10,15)+4,de=te+T(E,O+5,31)+1;O+=14;for(var fe=new e(de),pe=new e(19),ye=0;ye>>4)<16)fe[ye++]=Se;else{var De=0,Ae=0;for(Se==16?(Ae=3+T(E,O,3),O+=2,De=fe[ye-1]):Se==17?(Ae=3+T(E,O,7),O+=3):Se==18&&(Ae=11+T(E,O,127),O+=7);Ae--;)fe[ye++]=De}}var ue=fe.subarray(0,te),he=fe.subarray(te);$=v(ue),ie=v(he),G=A(ue,$),q=A(he,ie)}else b(1);if(O>Q){D&&b(0);break}}k&&j(V+131072);for(var ve=(1<<$)-1,we=(1<>>4;if((O+=15&De)>Q){D&&b(0);break}if(De||b(2),Ie<256)N[V++]=Ie;else{if(Ie==256){Pe=O,G=null;break}var Me=Ie-254;if(Ie>264){var ze=r[ye=Ie-257];Me=T(E,O,(1<>>4;if(Ne||b(3),O+=15&Ne,he=d[Je],Je>3&&(ze=i[Je],he+=w(E,O)&(1<Q){D&&b(0);break}k&&j(V+131072);for(var Ue=V+Me;Vnt.length)&&(Ee=nt.length);var ke=new(nt instanceof n?n:nt instanceof o?o:e)(Ee-We);return ke.set(nt.subarray(We,Ee)),ke}(N,0,V)},H=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(H,{stream:!0})}catch{}return t.convert_streams=function(E){var N=new DataView(E),U=0;function W(){var te=N.getUint16(U);return U+=2,te}function k(){var te=N.getUint32(U);return U+=4,te}function D(te){oe.setUint16(Z,te),Z+=2}function L(te){oe.setUint32(Z,te),Z+=4}for(var j={signature:k(),flavor:k(),length:k(),numTables:W(),reserved:W(),totalSfntSize:k(),majorVersion:W(),minorVersion:W(),metaOffset:k(),metaLength:k(),metaOrigLength:k(),privOffset:k(),privLength:k()},B=0;Math.pow(2,B)<=j.numTables;)B++;B--;for(var O=16*Math.pow(2,B),V=16*j.numTables-O,G=12,q=[],$=0;${let[H,F]=R.split("+");H=parseInt(H,36),F=F?parseInt(F,36):0,u.set(b+=H,w[x]);for(let E=F;E--;)u.set(++b,w[x])})}}return u.get(T)||c}const f=1,p=2,g=3,A=4,y=[null,"isol","init","fina","medi"];function S(T){const w=new Uint8Array(T.length);let x=c,b=f,R=-1;for(let H=0;H65535&&H++)}return w}function C(T,w){const x=[];for(let R=0;R65535&&R++,x.push(t.U.codeToGlyph(T,H))}const b=T.GSUB;if(b){const{lookupList:R,featureList:H}=b;let F;const E=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,N=[];H.forEach(U=>{if(E.test(U.tag))for(let W=0;W{if(O!==-1){let G=w[O];if(!G){const{cmds:q,crds:$}=t.U.glyphToPath(T,O);let ie="",Q=0;for(let ee=0,de=q.length;ee1?",":"")+$[Q++]}let se,oe,Z,te;if($.length){se=oe=1/0,Z=te=-1/0;for(let ee=0,de=$.length;eeZ&&(Z=fe),pe>te&&(te=pe)}}else se=Z=oe=te=0;G=w[O]={index:O,advanceWidth:T.hmtx.aWidth[O],xMin:se,yMin:oe,xMax:Z,yMax:te,path:ie,pathCommandCount:q.length}}B!==-1&&(k+=t.U.getPairAdjustment(T,B,O)*D),W.call(null,G,k,j),G.advanceWidth&&(k+=G.advanceWidth*D),U&&(k+=U*N),B=O}j+=E.codePointAt(j)>65535?2:1}),k}};return F}return function(w){const x=new Uint8Array(w,0,4),b=t._bin.readASCII(x,0,4);if(b==="wOFF")w=e(w);else if(b==="wOF2")throw new Error("woff2 fonts not supported");return v(t.parse(w)[0])}}const BAt=pW({name:"Typr Font Parser",dependencies:[NAt,UAt,jAt],init(t,e,n){const o=t(),r=e();return n(o,r)}}),eC={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},YAt=new rr;function MT(){return(self.performance||Date).now()}const Swe=Object.create(null);function mje(t,e){t=_At({},t);const n=MT();if(t.font=GAt(t.font||eC.defaultFontURL),t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||eC.sdfGlyphSize,t.colorRanges!=null){let d={};for(let f in t.colorRanges)if(t.colorRanges.hasOwnProperty(f)){let p=t.colorRanges[f];typeof p!="number"&&(p=YAt.set(p).getHex()),d[f]=p}t.colorRanges=d}Object.freeze(t);const{textureWidth:o,sdfExponent:r}=eC,{sdfGlyphSize:i}=t,a=o/i*4;let l=Swe[i];if(!l){const d=document.createElement("canvas");d.width=o,d.height=i*256/a,l=Swe[i]={glyphCount:0,sdfGlyphSize:i,sdfCanvas:d,sdfTexture:new Vc(d,void 0,void 0,void 0,Gs,Gs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,OAt(l)}const{sdfTexture:s,sdfCanvas:c}=l;let u=l.glyphsByFont.get(t.font);u||l.glyphsByFont.set(t.font,u=new Map),JAt(t).then(d=>{const{glyphIds:f,glyphPositions:p,fontSize:g,unitsPerEm:A,timings:y}=d,S=[],C=new Float32Array(f.length*4),P=g/A;let v=0,T=0;const w=MT();f.forEach((F,E)=>{let N=u.get(F);if(!N){const{path:D,pathBounds:L}=d.glyphData[F],j=Math.max(L[2]-L[0],L[3]-L[1])/i*(eC.sdfMargin*i+.5),B=l.glyphCount++,O=[L[0]-j,L[1]-j,L[2]+j,L[3]+j];u.set(F,N={path:D,atlasIndex:B,sdfViewBox:O}),S.push(N)}const{sdfViewBox:U}=N,W=p[T++],k=p[T++];C[v++]=W+U[0]*P,C[v++]=k+U[1]*P,C[v++]=W+U[2]*P,C[v++]=k+U[3]*P,f[E]=N.atlasIndex}),y.quads=(y.quads||0)+(MT()-w);const x=MT();y.sdf={};const b=c.height,R=Math.ceil(l.glyphCount/a),H=Math.pow(2,Math.ceil(Math.log2(R*i)));H>b&&(console.info(`Increasing SDF texture size ${b}->${H}`),WAt(c,o,H),s.dispose()),Promise.all(S.map(F=>yje(F,l,t.gpuAccelerateSDF).then(({timing:E})=>{y.sdf[F.atlasIndex]=E}))).then(()=>{S.length&&!l.contextLost&&(Aje(l),s.needsUpdate=!0),y.sdfTotal=MT()-x,y.total=MT()-n,e(Object.freeze({parameters:t,sdfTexture:s,sdfGlyphSize:i,sdfExponent:r,glyphBounds:C,glyphAtlasIndices:f,glyphColors:d.glyphColors,caretPositions:d.caretPositions,caretHeight:d.caretHeight,chunkedBounds:d.chunkedBounds,ascender:d.ascender,descender:d.descender,lineHeight:d.lineHeight,capHeight:d.capHeight,xHeight:d.xHeight,topBaseline:d.topBaseline,blockBounds:d.blockBounds,visibleBounds:d.visibleBounds,timings:d.timings}))})}),Promise.resolve().then(()=>{l.contextLost||LAt(c)})}function yje({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:o,sdfCanvas:r,contextLost:i},a){if(i)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:s}=eC,c=Math.max(n[2]-n[0],n[3]-n[1]),u=Math.floor(e/4),d=u%(l/o)*o,f=Math.floor(u/(l/o))*o,p=e%4;return IAt(o,o,t,n,c,s,r,d,f,p,a)}function OAt(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const o=[];t.glyphsByFont.forEach(r=>{r.forEach(i=>{o.push(yje(i,t,!0))})}),Promise.all(o).then(()=>{Aje(t),t.sdfTexture.needsUpdate=!0})})}function VAt({font:t,characters:e,sdfGlyphSize:n},o){let r=Array.isArray(e)?e.join(` `):""+e;mje({font:t,sdfGlyphSize:n,text:r},o)}function _At(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let pY;function GAt(t){return pY||(pY=typeof document>"u"?{}:document.createElement("a")),pY.href=t,pY.href}function Aje(t){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:o,height:r}=e,i=t.sdfCanvas.getContext("webgl");let a=n.image.data;(!a||a.length!==o*r*4)&&(a=new Uint8Array(o*r*4),n.image={width:o,height:r,data:a},n.flipY=!1,n.isDataTexture=!0),i.readPixels(0,0,o,r,i.RGBA,i.UNSIGNED_BYTE,a)}}const XAt=pW({name:"Typesetter",dependencies:[eC,BAt,MAt,xAt],init(t,e,n,o){const{defaultFontURL:r}=t;return n(e,o(),{defaultFontURL:r})}}),JAt=pW({name:"Typesetter",dependencies:[XAt],init(t){return function(e){return new Promise(n=>{t.typeset(e,n)})}},getTransferables(t){const e=[t.glyphPositions.buffer,t.glyphIds.buffer];return t.caretPositions&&e.push(t.caretPositions.buffer),t.glyphColors&&e.push(t.glyphColors.buffer),e}}),Twe={};function KAt(t){let e=Twe[t];if(!e){const n=new zw(1,1,t,t),o=n.clone(),r=n.attributes,i=o.attributes,a=new ji,l=r.uv.count;for(let s=0;s{a.setAttribute(s,new gr([...r[s].array,...i[s].array],r[s].itemSize))}),a.setIndex([...n.index.array,...o.index.array.map(s=>s+l)]),a.translate(.5,.5,0),e=Twe[t]=a}return e}const qAt="aTroikaGlyphBounds",Pwe="aTroikaGlyphIndex",$At="aTroikaGlyphColor";class QAt extends Wq{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new s1,this.boundingBox=new vf}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const n=this.getIndex().count;this.setDrawRange(e===r0?n/2:0,e===ti?n:n/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=KAt(e);["position","normal","uv"].forEach(o=>{this.attributes[o]=n.attributes[o].clone()}),this.setIndex(n.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,n,o,r,i){Cre(this,qAt,e,4),Cre(this,Pwe,n,1),Cre(this,$At,i,3),this._blockBounds=o,this._chunkedBounds=r,this.instanceCount=n.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:n,boundingBox:o}=this;if(n){const{PI:r,floor:i,min:a,max:l,sin:s,cos:c}=Math,u=r/2,d=r*2,f=Math.abs(n),p=e[0]/f,g=e[2]/f,A=i((p+u)/d)!==i((g+u)/d)?-f:a(s(p)*f,s(g)*f),y=i((p-u)/d)!==i((g-u)/d)?f:l(s(p)*f,s(g)*f),S=i((p+r)/d)!==i((g+r)/d)?f*2:l(f-c(p)*f,f-c(g)*f);o.min.set(A,e[1],n<0?-S:0),o.max.set(y,e[3],n<0?0:S)}else o.min.set(e[0],e[1],0),o.max.set(e[2],e[3],0);o.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let n=this.getAttribute(Pwe).count,o=this._chunkedBounds;if(o)for(let r=o.length;r--;){n=o[r].end;let i=o[r].rect;if(i[1]e.y&&i[0]e.x)break}this.instanceCount=n}}function Cre(t,e,n,o){const r=t.getAttribute(e);n?r&&r.array.length===n.length?(r.array.set(n),r.needsUpdate=!0):(t.setAttribute(e,new Xx(n,o)),delete t._maxInstanceCount,t.dispose()):r&&t.deleteAttribute(e)}const ZAt=` uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; @@ -4306,7 +4306,7 @@ if (edgeAlpha == 0.0) { `;function o4t(t){const e=Vce(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Kt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new qa(0,0,0,0)},uTroikaClipRect:{value:new qa(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Kt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new rr},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new ha},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:ZAt,vertexTransform:e4t,fragmentDefs:t4t,fragmentColorTransform:n4t,customRewriter({vertexShader:n,fragmentShader:o}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(o)&&(o=o.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(n)||(n=n.replace(pje,`uniform vec3 diffuse; $& vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; -`))),{vertexShader:n,fragmentShader:o}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const Age=new t3({color:16777215,side:ti,transparent:!0}),Cwe=8421504,Rwe=new Ki,gY=new ae,Rre=new ae,zz=[],r4t=new ae,Hre="+x+y";function Hwe(t){return Array.isArray(t)?t[0]:t}let wje=()=>{const t=new ls(new zw(1,1),Age);return wje=()=>t,t},vje=()=>{const t=new ls(new zw(1,1,32,1),Age);return vje=()=>t,t};const i4t={type:"syncstart"},a4t={type:"synccomplete"},xje=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],l4t=xje.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let bje=class extends ls{constructor(){const e=new QAt;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Cwe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Hre,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(i4t),mje({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const o=this._queuedSyncs;o&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{o.forEach(r=>r&&r())})),this.dispatchEvent(a4t),e&&e()})))}onBeforeRender(e,n,o,r,i,a){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i),i._hadOwnSide=i.hasOwnProperty("side"),this.geometry.setSide(i._actualSide=i.side),i.side=Da}onAfterRender(e,n,o,r,i,a){i._hadOwnSide?i.side=i._actualSide:delete i.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Age.clone());if((!e||e.baseMaterial!==n)&&(e=this._derivedMaterial=o4t(n),n.addEventListener("dispose",function o(){n.removeEventListener("dispose",o),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let o=e._outlineMtl;return o||(o=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),o.isTextOutlineMaterial=!0,o.depthWrite=!1,o.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),o.dispose()})),[o,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Hwe(this.material).getDepthMaterial()}get customDistanceMaterial(){return Hwe(this.material).getDistanceMaterial()}_prepareForRender(e){const n=e.isTextOutlineMaterial,o=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:l,blockBounds:s}=r;o.uTroikaSDFTexture.value=l,o.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),o.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,o.uTroikaSDFExponent.value=r.sdfExponent,o.uTroikaTotalBounds.value.fromArray(s),o.uTroikaUseGlyphColors.value=!n&&!!r.glyphColors;let c=0,u=0,d=0,f,p,g,A=0,y=0;if(n){let{outlineWidth:C,outlineOffsetX:P,outlineOffsetY:v,outlineBlur:T,outlineOpacity:w}=this;c=this._parsePercent(C)||0,u=Math.max(0,this._parsePercent(T)||0),f=w,A=this._parsePercent(P)||0,y=this._parsePercent(v)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(g=this.strokeColor,o.uTroikaStrokeColor.value.set(g??Cwe),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;o.uTroikaDistanceOffset.value=c,o.uTroikaPositionOffset.value.set(A,y),o.uTroikaBlurRadius.value=u,o.uTroikaStrokeWidth.value=d,o.uTroikaStrokeOpacity.value=p,o.uTroikaFillOpacity.value=f??1,o.uTroikaCurveRadius.value=this.curveRadius||0;let S=this.clipRect;if(S&&Array.isArray(S)&&S.length===4)o.uTroikaClipRect.value.fromArray(S);else{const C=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(s[0]-C,s[1]-C,s[2]+C,s[3]+C)}this.geometry.applyClipRect(o.uTroikaClipRect.value)}o.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const i=n?this.outlineColor||0:this.color;if(i==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new rr;(i!==l._input||typeof i=="object")&&l.set(l._input=i)}let a=this.orientation||Hre;if(a!==e._orientation){let l=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let s=a!==Hre&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(s){let[,c,u,d,f]=s;gY.set(0,0,0)[u]=c==="-"?1:-1,Rre.set(0,0,0)[f]=d==="-"?-1:1,Rwe.lookAt(r4t,gY.cross(Rre),Rre),l.setFromMatrix4(Rwe)}else l.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),o=n?parseFloat(n[1]):NaN;e=(isNaN(o)?0:o/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new Kt){n.copy(e);const o=this.curveRadius;return o&&(n.x=Math.atan2(e.x,Math.abs(o)-Math.abs(e.z))*Math.abs(o)),n}worldPositionToTextCoords(e,n=new Kt){return gY.copy(e),this.localPositionToTextCoords(this.worldToLocal(gY),n)}raycast(e,n){const{textRenderInfo:o,curveRadius:r}=this;if(o){const i=o.blockBounds,a=r?vje():wje(),l=a.geometry,{position:s,uv:c}=l.attributes;for(let u=0;u{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};xje.forEach(t=>{const e="_private_"+t;Object.defineProperty(bje.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});const s4t=m.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:o,fontSize:r=1,children:i,characters:a,onSync:l,...s},c)=>{const u=ri(({invalidate:g})=>g),[d]=m.useState(()=>new bje),[f,p]=m.useMemo(()=>{const g=[];let A="";return m.Children.forEach(i,y=>{typeof y=="string"||typeof y=="number"?A+=y:g.push(y)}),[g,A]},[i]);return WUe(()=>new Promise(g=>VAt({font:o,characters:a},g)),["troika-text",o,a]),m.useLayoutEffect(()=>void d.sync(()=>{u(),l&&l(d)})),m.useEffect(()=>()=>d.dispose(),[d]),m.createElement("primitive",j9({object:d,ref:c,font:o,text:p,anchorX:e,anchorY:n,fontSize:r,sdfGlyphSize:t},s),f)}),Mwe=t=>t===Object(t)&&!Array.isArray(t)&&typeof t!="function";function Hb(t,e){const n=ri(r=>r.gl),o=r3(cf,Mwe(t)?Object.values(t):t);if(m.useLayoutEffect(()=>{e==null||e(o)},[e]),m.useEffect(()=>{"initTexture"in n&&(Array.isArray(o)?o:[o]).forEach(n.initTexture)},[n,o]),Mwe(t)){const r=Object.keys(t),i={};return r.forEach(a=>Object.assign(i,{[a]:o[r.indexOf(a)]})),i}else return o}Hb.preload=t=>r3.preload(cf,t);Hb.clear=t=>r3.clear(cf,t);function Sje(t,e,n){const o=ri(f=>f.size),r=ri(f=>f.viewport),i=typeof t=="number"?t:o.width*r.dpr,a=o.height*r.dpr,l=(typeof t=="number"?n:t)||{},{samples:s=0,depth:c,...u}=l,d=m.useMemo(()=>{const f=new $m(i,a,{minFilter:Gs,magFilter:Gs,type:_x,...u});return c&&(f.depthTexture=new Y1e(i,a,v2)),f.samples=s,f},[]);return m.useLayoutEffect(()=>{d.setSize(i,a),s&&(d.samples=s)},[s,d,i,a]),m.useEffect(()=>()=>d.dispose(),[]),d}const c4t=t=>typeof t=="function",u4t=m.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:o,makeDefault:r,...i},a)=>{const l=ri(({set:y})=>y),s=ri(({camera:y})=>y),c=ri(({size:y})=>y),u=m.useRef(null),d=m.useRef(null),f=Sje(e);m.useLayoutEffect(()=>{i.manual||u.current.updateProjectionMatrix()},[c,i]),m.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),m.useLayoutEffect(()=>{if(r){const y=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:y}))}},[u,r,l]);let p=0,g=null;const A=c4t(o);return Z2(y=>{A&&(n===1/0||ptypeof t=="function",f4t=m.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,makeDefault:o,children:r,...i},a)=>{const l=ri(({set:y})=>y),s=ri(({camera:y})=>y),c=ri(({size:y})=>y),u=m.useRef(null),d=m.useRef(null),f=Sje(e);m.useLayoutEffect(()=>{i.manual||(u.current.aspect=c.width/c.height)},[c,i]),m.useLayoutEffect(()=>{u.current.updateProjectionMatrix()});let p=0,g=null;const A=d4t(r);return Z2(y=>{A&&(n===1/0||p{if(o){const y=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:y}))}},[u,o,l]),m.createElement(m.Fragment,null,m.createElement("perspectiveCamera",j9({ref:gge([u,a])},i),!A&&r),m.createElement("group",{ref:d},A&&r(f.texture)))});function gA(t,e){const n=t+"Geometry";return m.forwardRef(({args:o,children:r,...i},a)=>{const l=m.useRef(null);return m.useImperativeHandle(a,()=>l.current),m.useLayoutEffect(()=>void(e==null?void 0:e(l.current))),m.createElement("mesh",j9({ref:l},i),m.createElement(n,{attach:"geometry",args:o}),r)})}const si=gA("box"),uR=gA("circle"),xf=gA("cone"),ma=gA("cylinder"),Ps=gA("sphere"),ta=gA("plane"),wge=gA("torus"),wG=gA("ring"),aw=gA("extrude"),K5=1e-5;function h4t(t,e,n){const o=new kl,r=n-K5;return o.absarc(K5,K5,K5,-Math.PI/2,-Math.PI,!0),o.absarc(K5,e-r*2,K5,Math.PI,Math.PI/2,!0),o.absarc(t-r*2,e-r*2,K5,Math.PI/2,0,!0),o.absarc(t-r*2,K5,K5,0,-Math.PI/2,!0),o}const p4t=m.forwardRef(function({args:[e=1,n=1,o=1]=[],radius:r=.05,steps:i=1,smoothness:a=4,bevelSegments:l=4,creaseAngle:s=.4,children:c,...u},d){const f=m.useMemo(()=>h4t(e,n,r),[e,n,r]),p=m.useMemo(()=>({depth:o-r*2,bevelEnabled:!0,bevelSegments:l*2,steps:i,bevelSize:r-K5,bevelThickness:r,curveSegments:a}),[o,r,a]),g=m.useRef(null);return m.useLayoutEffect(()=>{g.current&&(g.current.center(),dAt(g.current,s))},[f,p]),m.createElement("mesh",j9({ref:d},u),m.createElement("extrudeGeometry",{ref:g,args:[f,p]}),c)});var Tje={exports:{}},g4t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",m4t=g4t,y4t=m4t;function Pje(){}function Cje(){}Cje.resetWarningCache=Pje;var A4t=function(){function t(o,r,i,a,l,s){if(s!==y4t){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Cje,resetWarningCache:Pje};return n.PropTypes=n,n};Tje.exports=A4t();var Bq=Tje.exports;const mo=Wi(Bq),kn=$K()((t,e)=>({setEnableOrbitController:n=>{M.getState().viewState.navigationView||t(o=>{var r;return(r=o.orbitControlsRef)!=null&&r.current&&(o.orbitControlsRef.current.enabled=n),o})},selectNone:()=>{t({humanRef:null,treeRef:null,foundationRef:null})},contentRef:null,compassRef:null,orbitControlsRef:null,humanRef:null,treeRef:null,flowerRef:null,foundationRef:null,cuboidRef:null,listenToAutoDeletionByCutRef:null,listenToAutoDeletionByDeleteRef:null,setListenToAutoDeletionByCut:n=>{const o=e().listenToAutoDeletionByCutRef;o&&(o.current=n)},setListenToAutoDeletionByDelete:n=>{const o=e().listenToAutoDeletionByDeleteRef;o&&(o.current=n)},canvas:null,pointer:new Kt,solarPanelCountRef:null}));var Ci=(t=>(t.Default="Default",t.Arched="Arched",t.Circular="Circular",t.Polygonal="Polygonal",t))(Ci||{});const Rje="/aladdin/assets/jaah-XpG2K-Xo.png",Hje="/aladdin/assets/jack-DVed1dhl.png",Mje="/aladdin/assets/jacob-D-6uVZRV.png",Ije="/aladdin/assets/jacqueline-DZtJs4FX.png",zje="/aladdin/assets/jade-Cxa-afE4.png",Dje="/aladdin/assets/jamelia-Bmq4EsGl.png",Eje="/aladdin/assets/james-QtBSrtsa.png",Fje="/aladdin/assets/jane-ZqCTWK8F.png",kje="/aladdin/assets/jaya-DD0RNxX8.png",Lje="/aladdin/assets/jaye-DPA2kSta.png",Wje="/aladdin/assets/jeanette-D3EEzZKV.png",Nje="/aladdin/assets/jedi-CUm23-QH.png",Uje="/aladdin/assets/jeff-931UF5LC.png",jje="/aladdin/assets/jena-qnIKFCdf.png",Bje="/aladdin/assets/jennifer-Cvadr5-Q.png",Yje="/aladdin/assets/jess-DyGUx_b1.png",Oje="/aladdin/assets/jett-B01M7z86.png",Vje="/aladdin/assets/jill-CxIC2A4v.png",_je="/aladdin/assets/jiya-CF0SpO2m.png",Gje="/aladdin/assets/joan-DWpjHIrM.png",Xje="/aladdin/assets/jocelyn-DGLHmbKA.png",Jje="/aladdin/assets/joel-DhW3d8dZ.png",Kje="/aladdin/assets/joey-Dmd3kcA2.png",qje="/aladdin/assets/john-QF2zQU-p.png",$je="/aladdin/assets/jonathon-TM1sY2jf.png",Qje="/aladdin/assets/jose-CtYKGQoQ.png",Zje="/aladdin/assets/joseph-C7wga7kl.png",eBe="/aladdin/assets/joshua-CqTzsm-K.png",tBe="/aladdin/assets/judd-C8GabaWl.png",nBe="/aladdin/assets/judy-Cv4UEjOl.png",oBe="/aladdin/assets/julia-Ckjw2r2H.png",rBe="/aladdin/assets/julio-CPCcOGMU.png",iBe="/aladdin/assets/jumapili-TjSAWyhv.png",aBe="/aladdin/assets/june-Bkxc2WDe.png",lBe="/aladdin/assets/juro-BAi3R6Hw.png",sBe="/aladdin/assets/justin-DLG1o6Q7.png";class kp{static fetchGender(e){switch(e){case Vt.Jaah:return Ha.Male;case Vt.Jacqueline:return Ha.Female;case Vt.Jade:return Ha.Female;case Vt.Jamelia:return Ha.Female;case Vt.James:return Ha.Male;case Vt.Jane:return Ha.Female;case Vt.Jaya:return Ha.Female;case Vt.Jaye:return Ha.Male;case Vt.Jeanette:return Ha.Female;case Vt.Jedi:return Ha.Male;case Vt.Jeff:return Ha.Male;case Vt.Jena:return Ha.Female;case Vt.Jennifer:return Ha.Female;case Vt.Jess:return Ha.Female;case Vt.Jett:return Ha.Male;case Vt.Jill:return Ha.Female;case Vt.Jiya:return Ha.Female;case Vt.Joan:return Ha.Female;case Vt.Jocelyn:return Ha.Female;case Vt.Joel:return Ha.Male;case Vt.Joey:return Ha.Female;case Vt.John:return Ha.Male;case Vt.Jonathon:return Ha.Male;case Vt.Jose:return Ha.Male;case Vt.Joseph:return Ha.Male;case Vt.Joshua:return Ha.Male;case Vt.Judd:return Ha.Male;case Vt.Judy:return Ha.Female;case Vt.Julia:return Ha.Female;case Vt.Julio:return Ha.Male;case Vt.Jumapili:return Ha.Female;case Vt.June:return Ha.Female;case Vt.Juro:return Ha.Male;case Vt.Justin:return Ha.Male;default:return Ha.Male}}static fetchLabel(e,n){switch(e){case Vt.Jaah:return Y.t("people.Jaah",n);case Vt.Jacob:return Y.t("people.Jacob",n);case Vt.Jacqueline:return Y.t("people.Jacqueline",n);case Vt.Jade:return Y.t("people.Jade",n);case Vt.Jamelia:return Y.t("people.Jamelia",n);case Vt.James:return Y.t("people.James",n);case Vt.Jane:return Y.t("people.Jane",n);case Vt.Jaya:return Y.t("people.Jaya",n);case Vt.Jaye:return Y.t("people.Jaye",n);case Vt.Jeanette:return Y.t("people.Jeanette",n);case Vt.Jedi:return Y.t("people.Jedi",n);case Vt.Jeff:return Y.t("people.Jeff",n);case Vt.Jena:return Y.t("people.Jena",n);case Vt.Jennifer:return Y.t("people.Jennifer",n);case Vt.Jess:return Y.t("people.Jess",n);case Vt.Jett:return Y.t("people.Jett",n);case Vt.Jill:return Y.t("people.Jill",n);case Vt.Jiya:return Y.t("people.Jiya",n);case Vt.Joan:return Y.t("people.Joan",n);case Vt.Jocelyn:return Y.t("people.Jocelyn",n);case Vt.Joel:return Y.t("people.Joel",n);case Vt.Joey:return Y.t("people.Joey",n);case Vt.John:return Y.t("people.John",n);case Vt.Jonathon:return Y.t("people.Jonathon",n);case Vt.Jose:return Y.t("people.Jose",n);case Vt.Joseph:return Y.t("people.Joseph",n);case Vt.Joshua:return Y.t("people.Joshua",n);case Vt.Judd:return Y.t("people.Judd",n);case Vt.Judy:return Y.t("people.Judy",n);case Vt.Julia:return Y.t("people.Julia",n);case Vt.Julio:return Y.t("people.Julio",n);case Vt.Jumapili:return Y.t("people.Jumapili",n);case Vt.June:return Y.t("people.June",n);case Vt.Juro:return Y.t("people.Juro",n);case Vt.Justin:return Y.t("people.Justin",n);default:return Y.t("people.Jack",n)}}static fetchHatOffsetY(e){switch(e){case Vt.Jonathon:return-.22}return 0}static fetchHatOffsetX(e){switch(e){case Vt.Jaah:return-.05;case Vt.Jack:return-.05;case Vt.Jacob:return .09;case Vt.Jade:return-.04;case Vt.Jaya:return .04;case Vt.Jaye:return 0;case Vt.Jamelia:return .05;case Vt.Jane:return .02;case Vt.Jeanette:return .08;case Vt.Jedi:return-.02;case Vt.Jeff:return-.05;case Vt.Jena:return .05;case Vt.Jennifer:return .02;case Vt.Jess:return .01;case Vt.Jett:return-.04;case Vt.Jill:return-.03;case Vt.Jiya:return-.03;case Vt.Joan:return-.45;case Vt.Jocelyn:return-.01;case Vt.Joel:return-.48;case Vt.Joey:return .01;case Vt.John:return .01;case Vt.Jonathon:return .02;case Vt.Jose:return .05;case Vt.Joseph:return .05;case Vt.Joshua:return-.01;case Vt.Judy:return .02;case Vt.Julia:return-.02;case Vt.Jumapili:return-.04;case Vt.June:return-.1;case Vt.Juro:return-.08;case Vt.Justin:return-.06;default:return 0}}static fetchHeight(e){switch(e){case Vt.Jaah:return 1.78;case Vt.Jack:return 1.8;case Vt.Jacob:return 1.82;case Vt.Jacqueline:return 1.78;case Vt.Jade:return 1.6;case Vt.James:return 1.75;case Vt.Jane:return 1.67;case Vt.Jaya:return 1.55;case Vt.Jaye:return 1.65;case Vt.Jamelia:return 1.8;case Vt.Jeanette:return 1.62;case Vt.Jedi:return 1.75;case Vt.Jeff:return 1.65;case Vt.Jena:return 1.6;case Vt.Jennifer:return 1.7;case Vt.Jess:return 1.5;case Vt.Jett:return 1.85;case Vt.Jill:return 1.71;case Vt.Jiya:return 1.74;case Vt.Joan:return 1.68;case Vt.Jocelyn:return 1.72;case Vt.Joel:return 1.75;case Vt.Joey:return 1.72;case Vt.John:return 1.85;case Vt.Jonathon:return 1.9;case Vt.Jose:return 1.6;case Vt.Joseph:return 1.88;case Vt.Joshua:return 1.79;case Vt.Judd:return 1.68;case Vt.Judy:return 1.75;case Vt.Julia:return 1.71;case Vt.Julio:return 1.76;case Vt.Jumapili:return 1.65;case Vt.June:return 1.85;case Vt.Juro:return 1.72;case Vt.Justin:return 1.755;default:return 1.8}}static fetchWidth(e){switch(e){case Vt.Jaah:return .74;case Vt.Jack:return .42;case Vt.Jacqueline:return .43;case Vt.Jacob:return .8;case Vt.Jade:return .48;case Vt.James:return .472;case Vt.Jane:return .4;case Vt.Jaya:return .6;case Vt.Jaye:return .55;case Vt.Jamelia:return .65;case Vt.Jeanette:return .4;case Vt.Jedi:return .56;case Vt.Jena:return .695;case Vt.Jennifer:return .45;case Vt.Jess:return .43;case Vt.Jill:return .42;case Vt.Joan:return 1.7;case Vt.Jocelyn:return .4;case Vt.Joel:return 1.8;case Vt.Joey:return .462;case Vt.John:return .6;case Vt.Jonathon:return .6;case Vt.Jose:return 2;case Vt.Joseph:return .6;case Vt.Joshua:return .5;case Vt.Judd:return .544;case Vt.Judy:return .41;case Vt.Julia:return .43;case Vt.Julio:return .5;case Vt.Jumapili:return .75;case Vt.June:return .65;case Vt.Juro:return .494;case Vt.Justin:return .6;default:return .6}}static fetchTextureImage(e){let n;switch(e){case Vt.Jaah:n=Rje;break;case Vt.Jacob:n=Mje;break;case Vt.Jacqueline:n=Ije;break;case Vt.Jade:n=zje;break;case Vt.Jamelia:n=Dje;break;case Vt.James:n=Eje;break;case Vt.Jane:n=Fje;break;case Vt.Jaya:n=kje;break;case Vt.Jaye:n=Lje;break;case Vt.Jeanette:n=Wje;break;case Vt.Jedi:n=Nje;break;case Vt.Jeff:n=Uje;break;case Vt.Jena:n=jje;break;case Vt.Jennifer:n=Bje;break;case Vt.Jess:n=Yje;break;case Vt.Jett:n=Oje;break;case Vt.Jill:n=Vje;break;case Vt.Jiya:n=_je;break;case Vt.Joan:n=Gje;break;case Vt.Jocelyn:n=Xje;break;case Vt.Joel:n=Jje;break;case Vt.Joey:n=Kje;break;case Vt.John:n=qje;break;case Vt.Jonathon:n=$je;break;case Vt.Jose:n=Qje;break;case Vt.Joseph:n=Zje;break;case Vt.Joshua:n=eBe;break;case Vt.Judd:n=tBe;break;case Vt.Judy:n=nBe;break;case Vt.Julia:n=oBe;break;case Vt.Julio:n=rBe;break;case Vt.Jumapili:n=iBe;break;case Vt.June:n=aBe;break;case Vt.Juro:n=lBe;break;case Vt.Justin:n=sBe;break;default:n=Hje}return n}}const w4t="/aladdin/assets/no_leaf_flower-CjefG9cq.png",v4t="/aladdin/assets/no_leaf_shrub-DDlKdxg_.png",cBe="/aladdin/assets/bellflower-C5sA-Fge.png",Gce="/aladdin/assets/boxwood-cAqkPwU6.png",Xce="/aladdin/assets/cactus_combo_1-DgrI_pBB.png",Jce="/aladdin/assets/cactus_combo_2-CnD7zsEV.png",Kce="/aladdin/assets/cactus_combo_3-CTLr6iHA.png",qce="/aladdin/assets/cactus_combo_4-Bv3aYeWB.png",uBe="/aladdin/assets/hibiscus-DqTQjw28.png",dBe="/aladdin/assets/hydrangea-D6uimbNa.png",fBe="/aladdin/assets/hosta-Ds5QIDtm.png",hBe="/aladdin/assets/peony-pnxufFxy.png",pBe="/aladdin/assets/red_rose-BhP67K90.png",gBe="/aladdin/assets/spirea-aOcGALMo.png",mBe="/aladdin/assets/sunflower-l75w306z.png",$ce="/aladdin/assets/tall_bush-g5bJ_GuV.png",yBe="/aladdin/assets/tulip-BqSv3XYD.png",ABe="/aladdin/assets/white_flower-BUfV78a-.png",wBe="/aladdin/assets/yellow_flower-BQ5dOM0H.png";class A8{static fetchSpread(e){switch(e){case ro.Bellflower:return .45;case ro.Boxwood:return 1.6;case ro.CactusCombo1:return 1;case ro.CactusCombo2:return 1;case ro.CactusCombo3:return 1;case ro.CactusCombo4:return 1;case ro.Hosta:return 1;case ro.Hibiscus:return 2;case ro.Hydrangea:return 2;case ro.Peony:return 1.5;case ro.RedRose:return .5;case ro.Spirea:return 1.8;case ro.Sunflower:return 1;case ro.TallBush:return 1;case ro.Tulip:return .4;case ro.YellowFlower:return 2;default:return .8}}static fetchHeight(e){switch(e){case ro.Bellflower:return .4;case ro.Boxwood:return 1.44;case ro.CactusCombo1:return 1.18;case ro.CactusCombo2:return 1.35;case ro.CactusCombo3:return 1.24;case ro.CactusCombo4:return 1.35;case ro.Hosta:return .7;case ro.Hibiscus:return 1.7;case ro.Hydrangea:return 1.5;case ro.Peony:return 1;case ro.RedRose:return .8;case ro.Spirea:return 1.6;case ro.Sunflower:return 2;case ro.TallBush:return 2;case ro.Tulip:return .7;case ro.YellowFlower:return 1.4;default:return .5}}static fetchLabel(e,n){switch(e){case ro.Bellflower:return Y.t("flower.Bellflower",n);case ro.Boxwood:return Y.t("flower.Boxwood",n);case ro.CactusCombo1:return Y.t("flower.CactusCombo1",n);case ro.CactusCombo2:return Y.t("flower.CactusCombo2",n);case ro.CactusCombo3:return Y.t("flower.CactusCombo3",n);case ro.CactusCombo4:return Y.t("flower.CactusCombo4",n);case ro.Hibiscus:return Y.t("flower.Hibiscus",n);case ro.Hydrangea:return Y.t("flower.Hydrangea",n);case ro.Hosta:return Y.t("flower.Hosta",n);case ro.Peony:return Y.t("flower.Peony",n);case ro.RedRose:return Y.t("flower.RedRose",n);case ro.Spirea:return Y.t("flower.Spirea",n);case ro.Sunflower:return Y.t("flower.Sunflower",n);case ro.TallBush:return Y.t("flower.TallBush",n);case ro.Tulip:return Y.t("flower.Tulip",n);case ro.YellowFlower:return Y.t("flower.YellowFlower",n);default:return Y.t("flower.WhiteFlower",n)}}static fetchTextureImage(e,n){if(n)return e===ro.Hibiscus||e===ro.Hydrangea||e===ro.YellowFlower||e===ro.Spirea?v4t:e===ro.Boxwood?Gce:e===ro.TallBush?$ce:e===ro.CactusCombo1?Xce:e===ro.CactusCombo2?Jce:e===ro.CactusCombo3?Kce:e===ro.CactusCombo4?qce:w4t;let o;switch(e){case ro.Bellflower:o=cBe;break;case ro.Boxwood:o=Gce;break;case ro.CactusCombo1:o=Xce;break;case ro.CactusCombo2:o=Jce;break;case ro.CactusCombo3:o=Kce;break;case ro.CactusCombo4:o=qce;break;case ro.Hibiscus:o=uBe;break;case ro.Hydrangea:o=dBe;break;case ro.Hosta:o=fBe;break;case ro.Peony:o=hBe;break;case ro.RedRose:o=pBe;break;case ro.Spirea:o=gBe;break;case ro.Sunflower:o=mBe;break;case ro.TallBush:o=$ce;break;case ro.Tulip:o=yBe;break;case ro.YellowFlower:o=wBe;break;default:o=ABe}return o}}class Va{static makeHuman(e,n,o,r,i){return{type:z.Human,name:e??Vt.Jack,cx:o,cy:r,cz:i,lx:kp.fetchWidth(e??Vt.Jack),lz:kp.fetchHeight(e??Vt.Jack),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Gi.generate()}}static makeTree(e,n,o,r,i,a,l){return{type:z.Tree,name:e??pr.Dogwood,cx:i,cy:a,cz:l,lx:n??3,lz:o??4,normal:[0,1,0],rotation:[0,0,0],parentId:r,id:Gi.generate()}}static makeSolarPanel(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){let S;switch(e.type){case z.Foundation:S=e.id,y=z.Foundation;break;case z.Cuboid:S=e.id,y=z.Cuboid;break;case z.Wall:case z.Roof:S=e.parentId;break}return{type:z.SolarPanel,pvModelName:n.name,trackerType:Ll.NO_TRACKER,relativeAzimuth:u??0,tiltAngle:c??0,orientation:a??vr.landscape,drawSunBeam:!1,poleHeight:l??1,poleRadius:.05,poleSpacing:s??3,cx:o,cy:r,cz:i,lx:g??(a===vr.landscape?n.length:n.width),ly:A??(a===vr.landscape?n.width:n.length),lz:n.thickness,showLabel:!1,normal:d?d.toArray():[0,0,1],rotation:f||[0,0,0],color:"#fff",frameColor:p??"white",parentType:y??e.type,parentId:e.id,foundationId:S,id:Gi.generate(),version:1}}static makeSolarWaterHeater(e,n,o,r,i,a){const l=M.getState().actionState;return{type:z.SolarWaterHeater,cx:n,cy:o,cz:r,lx:2.092,ly:1.558+l.solarWaterHeaterTankRadius,lz:l.solarWaterHeaterHeight,waterTankRadius:l.solarWaterHeaterTankRadius,relativeAzimuth:l.solarWaterHeaterRelativeAzimuth,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],color:l.solarWaterHeaterColor,parentType:e.type,parentId:e.id,foundationId:e.parentId,id:Gi.generate()}}static makeBatteryStorage(e,n,o,r){return{type:z.BatteryStorage,id:Gi.generate(),parentId:e.id,foundationId:e.parentId,cx:n,cy:o,cz:r,lx:1,ly:.35,lz:1.6,normal:[0,-1,0],rotation:[0,0,0],color:"#C7BABE"}}static makeFlower(e,n,o,r,i){return{type:z.Flower,name:e??ro.YellowFlower,cx:o,cy:r,cz:i,lx:A8.fetchSpread(e??ro.YellowFlower),lz:A8.fetchHeight(e??ro.YellowFlower),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Gi.generate()}}static makeCuboid(e,n,o,r,i){return{type:z.Cuboid,cx:e,cy:n,cz:o?o/2:2,lx:.1,ly:.1,lz:o??4,color:"#808080",faceColors:r??["#808080","#808080","#808080","#808080","#808080","#808080"],textureTypes:i??[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],stackable:M.getState().actionState.cuboidStackable,transparency:M.getState().actionState.cuboidTransparency,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,selected:!1,id:Gi.generate()}}static makeFoundation(e,n,o,r,i){return{type:z.Foundation,cx:e,cy:n,cz:o?o/2:.05,lx:0,ly:0,lz:o??.1,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,selected:!1,color:r??"#808080",textureType:i??_i.NoTexture,solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:Gi.generate()}}static makeParabolicTrough(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A){let y;switch(e.type){case z.Foundation:y=e.id;break}return{type:z.ParabolicTrough,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:s??3,latusRectum:a??2,relativeAzimuth:0,tiltAngle:0,absorberTubeRadius:.05,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.05,cx:c,cy:u,cz:d,lx:g??2,ly:A??9,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:y,id:Gi.generate()}}static makeParabolicDish(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A){let y;switch(e.type){case z.Foundation:y=e.id;break}return{type:z.ParabolicDish,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:3,latusRectum:a??8,relativeAzimuth:0,tiltAngle:0,structureType:s??sf.CentralPole,receiverRadius:.25,receiverPoleRadius:.1,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.2,cx:c,cy:u,cz:d,lx:g??4,ly:A??4,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:y,id:Gi.generate()}}static makeFresnelReflector(e,n,o,r,i,a,l,s,c,u,d,f){let p;switch(e.type){case z.Foundation:p=e.id;break}return{type:z.FresnelReflector,receiverId:n??"None",reflectance:o??.9,moduleLength:i??3,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.05,cx:a,cy:l,cz:s,lx:d??2,ly:f??9,lz:.1,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:p,id:Gi.generate()}}static makeWindTurbine(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P){let v;switch(e.type){case z.Foundation:v=e.id;break}return{type:z.WindTurbine,birdSafe:n,bladeColor:o,stripeColor:r,numberOfBlades:i,initialRotorAngle:a,relativeYawAngle:l,pitchAngle:s,bladeRadius:c,bladeTipWidth:.2,bladeRootRadius:u,maximumChordRadius:f,maximumChordLength:d,towerRadius:p,towerHeight:g,hubRadius:A,hubLength:y,cx:S,cy:C,cz:P,lx:p*4,ly:p*4,lz:g+c,normal:[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:v,id:Gi.generate()}}static makeHeliostat(e,n,o,r,i,a,l,s,c,u,d){let f;switch(e.type){case z.Foundation:f=e.id;break}return{type:z.Heliostat,towerId:n??"None",reflectance:o??.9,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.1,cx:i,cy:a,cz:l,lx:u??2,ly:d??4,lz:.1,showLabel:!1,normal:s?s.toArray():[0,0,1],rotation:c||[0,0,0],parentId:e.id,foundationId:f,id:Gi.generate()}}static makePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=.2,u=.2,d=.2;let f=n,p=o;return e.type===z.Cuboid&&i?ye.isUnitVectorX(i)?f=r:ye.isUnitVectorY(i)&&(p=r):e.type===z.Wall&&(p=r),{type:z.Polygon,cx:f,cy:p,cz:0,lx:2*c,ly:2*u,lz:2*d,color:"#ffffff",normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],vertices:[{x:Math.max(-.5,f-c),y:Math.max(-.5,p-u)},{x:Math.max(-.5,f-c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.max(-.5,p-u)}],parentId:e.id,parentType:l,foundationId:s,selected:!1,filled:!0,selectedIndex:-1,id:Gi.generate()}}static makeWall(e,n,o,r,i){const a=M.getState().actionState;return{type:z.Wall,cx:n,cy:o,cz:r,lx:0,ly:a.wallThickness??.3,lz:a.wallHeight??5,parapet:a.wallParapet,eavesLength:a.wallEavesLength??.3,rValue:a.wallRValue??3,fill:Fl.Full,leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:a.wallHeight-.5,rightTopPartialHeight:a.wallHeight-.5,relativeAngle:0,leftPoint:[],rightPoint:[],leftJoints:[],rightJoints:[],textureType:a.wallTexture??Bo.Default,color:a.wallColor??"#ffffff",volumetricHeatCapacity:a.wallVolumetricHeatCapacity??.5,wallStructure:a.wallStructure??gc.Default,studSpacing:a.wallStructureSpacing??2,studWidth:a.wallStructureWidth??.1,studColor:a.wallStructureColor??"#ffffff",opacity:a.wallOpacity!==void 0?a.wallOpacity:.5,selected:!1,lineWidth:.2,lineColor:"#000000",windows:[],showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:e.id,id:Gi.generate()}}static makeSensor(e,n,o,r,i,a){let l;switch(e.type){case z.Foundation:case z.Cuboid:l=e.id;break;case z.Wall:case z.Roof:l=e.parentId;break}return{type:z.Sensor,cx:n,cy:o,cz:r,lx:.1,ly:.1,lz:.01,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],parentId:e.id,foundationId:l,parentType:e.type,id:Gi.generate()}}static makeLight(e,n,o,r,i,a,l,s,c,u){let d;switch(e.type){case z.Foundation:case z.Cuboid:d=e.id;break;case z.Wall:case z.Roof:d=e.parentId;break}return{type:z.Light,decay:n??2,distance:o??5,intensity:r??3,color:i??"#ffff99",cx:a,cy:l,cz:s,lx:.16,ly:.16,lz:.08,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:d,parentType:e.type,id:Gi.generate()}}static makeWindow(e,n,o,r,i,a,l=0,s=0){let c,u=0;switch(e.type){case z.Cuboid:c=e.id;break;case z.Wall:c=e.parentId,u=e.ly;break;case z.Roof:c=e.parentId,u=e.thickness;break}const d=M.getState().actionState;return{type:z.Window,cx:n,cy:o,cz:r,lx:l,ly:u,lz:s,leftShutter:d.windowShutterLeft,rightShutter:d.windowShutterRight,shutterColor:d.windowShutterColor,shutterWidth:d.windowShutterWidth,horizontalMullion:d.windowHorizontalMullion,verticalMullion:d.windowVerticalMullion,mullionWidth:d.windowMullionWidth,horizontalMullionSpacing:d.windowHorizontalMullionSpacing,verticalMullionSpacing:d.windowVerticalMullionSpacing,mullionColor:d.windowMullionColor,frame:d.windowFrame,frameWidth:d.windowFrameWidth,sillWidth:bn.isTypeRoof(i)?0:d.windowSillWidth,windowType:d.windowType,empty:d.windowEmpty,interior:d.windowInterior,archHeight:d.windowArchHeight,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,color:d.windowColor??"#ffffff",tint:d.windowTint??"#73D8FF",opacity:d.windowOpacity!==void 0?d.windowOpacity:.5,uValue:d.windowUValue??.5,normal:[0,-1,0],rotation:a?[...a]:[0,0,0],parentId:e.id,parentType:i,foundationId:c,id:Gi.generate()}}static makeDoor(e){let n;switch(e.type){case z.Cuboid:n=e.id;break;case z.Wall:n=e.parentId;break}const o=M.getState().actionState;return{type:z.Door,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,doorType:o.doorType,filled:o.doorFilled,interior:o.doorInterior,archHeight:o.doorArchHeight,textureType:o.doorTexture??sr.Default,color:o.doorColor??"#ffffff",uValue:o.doorUValue??.5,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:e.id,foundationId:n,id:Gi.generate()}}static makePyramidRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Pyramid,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}static makeGableRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Gable,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate(),ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1]}}static makeHipRoof(e,n,o){const r=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Ur.Default,roofType:Go.Hip,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate(),leftRidgeLength:(o??2)/2,rightRidgeLength:(o??2)/2}}static makeGambrelRoof(e,n){const r=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Ur.Default,roofType:Go.Gambrel,roofStructure:Ac.Default,wallsId:[...e],topRidgePoint:[0,1],frontRidgePoint:[.35,.5],backRidgePoint:[.35,.5],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}static makeMansardRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Mansard,roofStructure:Ac.Default,wallsId:[...e],ridgeWidth:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}}const x4t=t=>t.solarPanelArrayLayoutParams.pvModelName,b4t=t=>t.solarPanelArrayLayoutParams.rowAxis,S4t=t=>t.solarPanelArrayLayoutParams.rowsPerRack,T4t=t=>t.solarPanelArrayLayoutParams.interRowSpacing,P4t=t=>t.solarPanelArrayLayoutParams.margin,C4t=t=>t.solarPanelArrayLayoutParams.poleHeight,R4t=t=>t.solarPanelArrayLayoutParams.poleSpacing,H4t=t=>t.solarPanelArrayLayoutParams.tiltAngle,M4t=t=>t.solarPanelArrayLayoutParams.orientation,Yq=t=>t.viewState.navigationView,Cs=t=>t.viewState.shadowEnabled,Oq=t=>t.viewState.shadowCameraFar,vge=t=>t.viewState.solarPanelShininess,vBe=t=>t.viewState.windowShininess,e5=t=>t.viewState.heatFluxScaleFactor,a3=t=>t.viewState.heatFluxColor,l3=t=>t.viewState.heatFluxWidth,Pf=t=>t.viewState.solarRadiationHeatMapMaxValue,xge=t=>t.viewState.solarRadiationHeatMapReflectionOnly,bge=t=>t.viewState.axes,xBe=t=>t.viewState.ambientLightIntensity,bBe=t=>t.viewState.directLightIntensity,SBe=t=>t.viewState.theme,TBe=t=>t.viewState.showAzimuthAngle,PBe=t=>t.viewState.showElevationAngle,CBe=t=>t.viewState.showZenithAngle,RBe=t=>t.viewState.autoRotate,HBe=t=>t.viewState.hideAddress,mA=t=>t.viewState.groundImage,I4t=t=>t.viewState.groundImageType,MBe=t=>t.viewState.groundColor,IBe=t=>t.viewState.waterSurface,Ju=t=>t.viewState.orthographic,z4t=t=>t.viewState.enableRotate,D4t=t=>t.viewState.cameraPosition,E4t=t=>t.viewState.cameraZoom,zBe=t=>t.viewState.heliodon,DBe=t=>t.viewState.showSunAngles,Sge=t=>t.viewState.mapZoom,F4t=t=>t.viewState.mapTilt,EBe=t=>t.viewState.mapType,Tge=t=>t.viewState.showSiteInfoPanel,Vq=t=>t.viewState.showDesignInfoPanel,FBe=t=>t.viewState.showInstructionPanel,kBe=t=>t.viewState.showHeliodonPanel,k4t=t=>t.viewState.heliodonPanelX,L4t=t=>t.viewState.heliodonPanelY,W4t=t=>t.viewState.showMapPanel,N4t=t=>t.viewState.mapPanelX,U4t=t=>t.viewState.mapPanelY,j4t=t=>t.viewState.showWeatherPanel,B4t=t=>t.viewState.weatherPanelRect,Y4t=t=>t.viewState.showDiurnalTemperaturePanel,O4t=t=>t.viewState.diurnalTemperaturePanelRect,LBe=t=>t.viewState.showStickyNotePanel,V4t=t=>t.viewState.stickyNotePanelRect,_4t=t=>t.viewState.showDailyBuildingEnergyPanel,G4t=t=>t.viewState.dailyBuildingEnergyPanelRect,X4t=t=>t.viewState.showYearlyBuildingEnergyPanel,J4t=t=>t.viewState.yearlyBuildingEnergyPanelRect,WBe=t=>t.viewState.showDailyLightSensorPanel,K4t=t=>t.viewState.dailyLightSensorPanelRect,q4t=t=>t.viewState.showYearlyLightSensorPanel,$4t=t=>t.viewState.yearlyLightSensorPanelRect,Q4t=t=>t.viewState.yearlyLightSensorPanelShowDaylight,Z4t=t=>t.viewState.yearlyLightSensorPanelShowClearness,NBe=t=>t.viewState.showDailyPvYieldPanel,e8t=t=>t.viewState.dailyPvYieldPanelRect,t8t=t=>t.viewState.showYearlyPvYieldPanel,n8t=t=>t.viewState.yearlyPvYieldPanelRect,o8t=t=>t.viewState.showSolarPanelVisibilityResultsPanel,r8t=t=>t.viewState.visibilityResultsPanelRect,UBe=t=>t.viewState.showDailyParabolicTroughYieldPanel,i8t=t=>t.viewState.dailyParabolicTroughYieldPanelRect,a8t=t=>t.viewState.showYearlyParabolicTroughYieldPanel,l8t=t=>t.viewState.yearlyParabolicTroughYieldPanelRect,jBe=t=>t.viewState.showDailyParabolicDishYieldPanel,s8t=t=>t.viewState.dailyParabolicDishYieldPanelRect,c8t=t=>t.viewState.showYearlyParabolicDishYieldPanel,u8t=t=>t.viewState.yearlyParabolicDishYieldPanelRect,BBe=t=>t.viewState.showDailyFresnelReflectorYieldPanel,d8t=t=>t.viewState.dailyFresnelReflectorYieldPanelRect,f8t=t=>t.viewState.showYearlyFresnelReflectorYieldPanel,h8t=t=>t.viewState.yearlyFresnelReflectorYieldPanelRect,YBe=t=>t.viewState.showDailyHeliostatYieldPanel,p8t=t=>t.viewState.dailyHeliostatYieldPanelRect,g8t=t=>t.viewState.showYearlyHeliostatYieldPanel,m8t=t=>t.viewState.yearlyHeliostatYieldPanelRect,OBe=t=>t.viewState.showDailyUpdraftTowerYieldPanel,y8t=t=>t.viewState.dailyUpdraftTowerYieldPanelRect,A8t=t=>t.viewState.showYearlyUpdraftTowerYieldPanel,w8t=t=>t.viewState.yearlyUpdraftTowerYieldPanelRect,v8t=t=>t.viewState.showEvolutionPanel,x8t=t=>t.viewState.evolutionPanelRect,s0=t=>t.world.latitude,Mb=t=>t.world.longitude,Al=t=>t.world.date,Pge=t=>t.world.leafDayOfYear1,Cge=t=>t.world.leafDayOfYear2,b8t=t=>t.world.ground,_q=t=>t.world.address,S8t=t=>t.world.countryCode,T8t=t=>t.world.airAttenuationCoefficient,P8t=t=>t.world.airConvectiveCoefficient,VBe=t=>t.world.timesPerHour,zH=t=>t.world.daysPerYear,C8t=t=>t.world.discretization,_Be=t=>t.world.diurnalTemperatureModel,gW=t=>t.world.highestTemperatureTimeInMinutes,R8t=t=>t.world.solarRadiationHeatmapGridCellSize,H8t=t=>t.world.pvGridCellSize,M8t=t=>t.world.solarPanelVisibilityGridCellSize,I8t=t=>t.world.cspTimesPerHour,mW=t=>t.world.cspDaysPerYear,z8t=t=>t.world.cspGridCellSize,D8t=t=>t.world.sutTimesPerHour,GBe=t=>t.world.sutDaysPerYear,E8t=t=>t.world.sutGridCellSize,Rge=t=>t.world.noAnimationForHeatmapSimulation,F8t=t=>t.world.noAnimationForThermalSimulation,Hge=t=>t.world.noAnimationForSensorDataCollection,Mge=t=>t.world.noAnimationForSolarPanelSimulation,XBe=t=>t.world.noAnimationForSolarUpdraftTowerSimulation,pn=t=>t.set,yp=t=>t.user,k8t=t=>t.userCount,L8t=t=>t.showSolarPanelCustomizationPanel,W8t=t=>t.showEconomicsPanel,N8t=t=>t.showNavigationPanel,U8t=t=>t.showShadowSettings,j8t=t=>t.minimumNavigationMoveSpeed,B8t=t=>t.minimumNavigationTurnSpeed,Y8t=t=>t.navigationMoveSpeed,O8t=t=>t.navigationTurnSpeed,c1=t=>t.getHeatmap,Ige=t=>t.setHeatmap,JBe=t=>t.clearHeatmaps,zge=t=>t.flagOfDailySimulation,Ib=t=>t.hourlyHeatExchangeArrayMap,V8t=t=>t.setHourlyHeatExchangeArray,_8t=t=>t.hourlySolarHeatGainArrayMap,G8t=t=>t.setHourlySolarHeatGainArray,X8t=t=>t.hourlySolarPanelOutputArrayMap,J8t=t=>t.setHourlySolarPanelOutputArray,Dge=t=>t.getRoofSegmentVertices,yW=t=>t.getRoofSegmentVerticesWithoutOverhang,K8t=t=>t.latestVersion,KBe=t=>t.changed,q8t=t=>t.setChanged,$8t=t=>t.setSkipChange,no=t=>t.applyCount,Qn=t=>t.setApplyCount,Xi=t=>t.revertApply,Kn=t=>t.elements,Q8t=t=>t.notes,DH=t=>t.supportedPvModules,EH=t=>t.customPvModules,Z8t=t=>t.loadSupportedPvModules,ewt=t=>t.addCustomPvModule,twt=t=>t.removeCustomPvModule,t5=t=>t.getPvModule,hu=t=>t.floatingWindowOpacity,Sc=t=>t.selectedFloatingWindow,m0=t=>t.language,nwt=t=>t.locale,oa=t=>t.loggable,owt=t=>t.actionInfo,rwt=t=>t.currentUndoable,Gq=t=>t.openModelsMap,iwt=t=>t.modelsMapLatitude,awt=t=>t.modelsMapLongitude,lwt=t=>t.modelsMapZoom,swt=t=>t.modelsMapTilt,Ege=t=>t.modelsMapType,qBe=t=>t.modelsMapWeatherStations,cwt=t=>t.showCloudFileTitleDialog,$Be=t=>t.showCloudFileTitleDialogFlag,zb=t=>t.cloudFile,uwt=t=>t.latestModelSite,QBe=t=>t.modelSites,dwt=t=>t.allModelSites,ZBe=t=>t.peopleModels,fwt=t=>t.allPeopleModels,hwt=t=>t.saveAccountSettingsFlag,pwt=t=>t.saveCloudFileFlag,gwt=t=>t.createProjectFlag,mwt=t=>t.saveProjectAsFlag,ywt=t=>t.curateDesignToProjectFlag,Awt=t=>t.showProjectsFlag,wwt=t=>t.updateProjectsFlag,vwt=t=>t.modelsMapFlag,eYe=t=>t.showModelsAllTime,tYe=t=>t.showModelsFromDate,nYe=t=>t.showModelsToDate,xwt=t=>t.leaderboardFlag,bwt=t=>t.showLeaderboard,Swt=t=>t.publishOnModelsMapFlag,Twt=t=>t.listCloudFilesFlag,Pwt=t=>t.refreshCloudFilesFlag,Cwt=t=>t.localContentToImportAfterCloudFileUpdate,Rwt=t=>t.localFileName,Hwt=t=>t.createNewFileFlag,Mwt=t=>t.openLocalFileFlag,oYe=t=>t.saveLocalFileDialogVisible,FH=t=>t.fileChanged,Fge=t=>t.undoManager,En=t=>t.addUndoable,kge=t=>t.importContent,rYe=t=>t.exportContent,Iwt=t=>t.clearContent,iYe=t=>t.createEmptyFile,zwt=t=>t.aabb,aYe=t=>t.animateSun,Dwt=t=>t.animate24Hours,AW=t=>t.runDailyThermalSimulation,Ewt=t=>t.pauseDailyThermalSimulation,Xq=t=>t.runYearlyThermalSimulation,Fwt=t=>t.pauseYearlyThermalSimulation,kwt=t=>t.clearDailySimulationResultsFlag,Lwt=t=>t.clearYearlySimulationResultsFlag,wW=t=>t.runDynamicSimulation,Lge=t=>t.runStaticSimulation,Wwt=t=>t.pauseSimulation,n5=t=>t.runEvolution,Jq=t=>t.pauseEvolution,Kq=t=>t.objectiveEvaluationIndex,kH=t=>t.evolutionMethod,Nwt=t=>t.updateSceneRadiusFlag,lYe=t=>t.updateSceneRadius,ay=t=>t.sceneRadius,Uwt=t=>t.cameraDirection,Wge=t=>t.getCameraDirection,Jn=t=>t.getElementById,yA=t=>t.getFoundation,Gr=t=>t.getParent,LH=t=>t.getChildren,s3=t=>t.getChildrenOfType,c3=t=>t.selectedElement,jwt=t=>t.selectedElementIdSet,Db=t=>t.getSelectedElement,Nge=t=>t.overlapWithSibling,sYe=t=>t.selectedSideIndex,u3=t=>t.setElementPosition,Uge=t=>t.setElementSize,Bwt=t=>t.setElementNormal,Ywt=t=>t.updateElementLockById,Owt=t=>t.updateElementReferenceById,Vwt=t=>t.updateElementLabelById,_wt=t=>t.updateElementShowLabelById,cYe=t=>t.updateElementCxById,uYe=t=>t.updateElementCyById,Gwt=t=>t.updateElementCzById,Xwt=t=>t.updateElementCzForAll,d3=t=>t.updateElementLxById,qq=t=>t.updateElementLxAboveFoundation,vW=t=>t.updateElementLxForAll,Fw=t=>t.updateElementLyById,$q=t=>t.updateElementLyAboveFoundation,xW=t=>t.updateElementLyForAll,jge=t=>t.updateElementLzById,Jwt=t=>t.updateElementLzForAll,dYe=t=>t.updateElementColorById,Kwt=t=>t.updateElementColorOnSurface,qwt=t=>t.updateElementColorAboveFoundation,fYe=t=>t.updateElementColorForAll,$wt=t=>t.updateElementLineColorById,Qwt=t=>t.updateElementLineColorOnSurface,Zwt=t=>t.updateElementLineColorAboveFoundation,e7t=t=>t.updateElementLineColorForAll,t7t=t=>t.updateElementLineWidthById,n7t=t=>t.updateElementLineWidthOnSurface,o7t=t=>t.updateElementLineWidthAboveFoundation,r7t=t=>t.updateElementLineWidthForAll,Bge=t=>t.updateElementRotationById,i7t=t=>t.updateElementRotationForAll,$s=t=>t.foundationActionScope,a7t=t=>t.setFoundationActionScope,WH=t=>t.polygonActionScope,NH=t=>t.setPolygonActionScope,hYe=t=>t.updatePolygonVertexPositionById,kw=t=>t.updatePolygonVerticesById,Eb=t=>t.cuboidActionScope,Fb=t=>t.setCuboidActionScope,vh=t=>t.solarPanelActionScope,xh=t=>t.setSolarPanelActionScope,Yge=t=>t.solarWaterHeaterActionScope,Oge=t=>t.setSolarWaterHeaterActionScope,bW=t=>t.updateSolarCollectorDailyYieldById,SW=t=>t.updateSolarCollectorYearlyYieldById,l7t=t=>t.updateSolarPanelTiltAngleById,pYe=t=>t.updateSolarCollectorDrawSunBeamById,gYe=t=>t.updateSolarCollectorDrawSunBeamAboveFoundation,mYe=t=>t.updateSolarCollectorDrawSunBeamForAll,Qq=t=>t.updateSolarCollectorRelativeAzimuthById,yYe=t=>t.updateSolarCollectorRelativeAzimuthOnSurface,AYe=t=>t.updateSolarCollectorRelativeAzimuthAboveFoundation,wYe=t=>t.updateSolarCollectorRelativeAzimuthForAll,s7t=t=>t.updateSolarCollectorXById,c7t=t=>t.updateSolarCollectorXAboveFoundation,u7t=t=>t.updateSolarCollectorXForAll,d7t=t=>t.updateSolarCollectorYById,f7t=t=>t.updateSolarCollectorYAboveFoundation,h7t=t=>t.updateSolarCollectorYForAll,TW=t=>t.updateSolarCollectorPoleHeightById,p7t=t=>t.updateSolarCollectorPoleHeightOnSurface,PW=t=>t.updateSolarCollectorPoleHeightAboveFoundation,CW=t=>t.updateSolarCollectorPoleHeightForAll,vYe=t=>t.updateSolarCollectorPoleRadiusById,xYe=t=>t.updateSolarCollectorPoleRadiusAboveFoundation,bYe=t=>t.updateSolarCollectorPoleRadiusForAll,Zq=t=>t.updateCspReflectanceById,e$=t=>t.updateCspReflectanceAboveFoundation,t$=t=>t.updateCspReflectanceForAll,SYe=t=>t.updateParabolicCollectorAbsorptanceById,TYe=t=>t.updateParabolicCollectorAbsorptanceAboveFoundation,PYe=t=>t.updateParabolicCollectorAbsorptanceForAll,CYe=t=>t.updateParabolicCollectorOpticalEfficiencyById,RYe=t=>t.updateParabolicCollectorOpticalEfficiencyAboveFoundation,HYe=t=>t.updateParabolicCollectorOpticalEfficiencyForAll,MYe=t=>t.updateParabolicCollectorThermalEfficiencyById,IYe=t=>t.updateParabolicCollectorThermalEfficiencyAboveFoundation,zYe=t=>t.updateParabolicCollectorThermalEfficiencyForAll,AA=t=>t.parabolicTroughActionScope,wA=t=>t.setParabolicTroughActionScope,kb=t=>t.fresnelReflectorActionScope,Lb=t=>t.setFresnelReflectorActionScope,Wb=t=>t.heliostatActionScope,Nb=t=>t.setHeliostatActionScope,DYe=t=>t.updateSolarReceiverById,EYe=t=>t.updateSolarReceiverAboveFoundation,FYe=t=>t.updateSolarReceiverForAll,vA=t=>t.parabolicDishActionScope,xA=t=>t.setParabolicDishActionScope,kYe=t=>t.updateParabolaLatusRectumById,LYe=t=>t.updateParabolaLatusRectumAboveFoundation,WYe=t=>t.updateParabolaLatusRectumForAll,NYe=t=>t.updateModuleLengthById,UYe=t=>t.updateModuleLengthAboveFoundation,jYe=t=>t.updateModuleLengthForAll,f3=t=>t.windTurbineActionScope,h3=t=>t.setWindTurbineActionScope,BYe=t=>t.copyElementById,Ap=t=>t.removeElementById,g7t=t=>t.clearDeletedElements,m7t=t=>t.countElementsByReferenceId,Vge=t=>t.removeElementsByReferenceId,YYe=t=>t.pasteElementsToPoint,y7t=t=>t.pasteElementsByKey,OYe=t=>t.elementsToPaste,pu=t=>t.selectMe,RW=t=>t.selectNone,_ge=t=>t.addElement,n$=t=>t.objectTypeToAdd,A7t=t=>t.actionModeLock,Ng=t=>t.countElementsByType,VYe=t=>t.countSolarStructuresByType,w7t=t=>t.countObservers,v7t=t=>t.countSolarPanelsOnRack,x7t=t=>t.selectedElementAngle,b7t=t=>t.waiting,Cf=t=>t.simulationInProgress,Gge=t=>t.simulationPaused,_Ye=t=>t.evolutionInProgress,GYe=t=>t.evolutionPaused,S7t=t=>t.contextMenuObjectType,T7t=t=>t.enableFineGrid,P7t=t=>t.setEnableFineGrid,C7t=t=>t.showCloudFilePanel,Xge=t=>t.projectState.title,XYe=t=>t.projectState.owner,R7t=t=>t.projectState.description,H7t=t=>t.projectState.designs,M7t=t=>t.projectState.type,JYe=t=>t.projectState.selectedProperty,I7t=t=>t.projectState.dataColoring,z7t=t=>t.projectState.thumbnailWidth,D7t=t=>t.projectState.xAxisNameScatterPlot,E7t=t=>t.projectState.yAxisNameScatterPlot,F7t=t=>t.projectState.dotSizeScatterPlot,k7t=t=>t.projectState.sortDescending,L7t=t=>t.projectState.filters,W7t=t=>t.projectState.ranges,N7t=t=>t.projectState.hiddenParameters,HW=t=>t.projectView,U7t=t=>t.showProjectListPanel,j7t=t=>t.showModelsGallery,B7t=t=>t.showAccountSettingsPanel,Y7t=t=>t.showLikesPanel,O7t=t=>t.showPublishedModelsPanel,V7t=t=>t.weatherModel,KYe=t=>t.setWeatherModel,Jge=t=>t.weatherData,_7t=t=>t.loadWeatherData,G7t=t=>t.loadHorizontalSolarRadiationData,X7t=t=>t.getHorizontalSolarRadiation,J7t=t=>t.loadVerticalSolarRadiationData,K7t=t=>t.getVerticalSolarRadiation,qYe=t=>t.getClosestCity,Lw=t=>t.sunlightDirection,q7t=t=>t.setSunlightDirection,hs=t=>t.showSolarRadiationHeatmap,$7t=t=>t.selectButtonClicked,p3=t=>t.showHeatFluxes,Q7t=t=>t.runSolarPanelVisibilityAnalysis,Z7t=t=>t.solarPanelVisibilityResults,$Ye=t=>t.runDailySimulationForSolarPanels,evt=t=>t.runDailySimulationForSolarPanelsLastStep,QYe=t=>t.runYearlySimulationForSolarPanels,tvt=t=>t.runYearlySimulationForSolarPanelsLastStep,nvt=t=>t.pauseDailySimulationForSolarPanels,ovt=t=>t.pauseYearlySimulationForSolarPanels,rvt=t=>t.dailyPvYield,ZYe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyPvIndividualOutputs},ivt=t=>t.setDailyPvYield,avt=t=>t.yearlyPvYield,eOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyPvIndividualOutputs},lvt=t=>t.setYearlyPvYield,tOe=t=>t.solarPanelLabels,svt=t=>t.setSolarPanelLabels,nOe=t=>t.setTotalBuildingHeater,oOe=t=>t.setTotalBuildingAc,rOe=t=>t.setTotalBuildingSolarPanel,cvt=t=>t.runDailySimulationForParabolicTroughs,uvt=t=>t.runYearlySimulationForParabolicTroughs,dvt=t=>t.pauseDailySimulationForParabolicTroughs,fvt=t=>t.pauseYearlySimulationForParabolicTroughs,hvt=t=>t.dailyParabolicTroughYield,iOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicTroughIndividualOutputs},pvt=t=>t.setDailyParabolicTroughYield,gvt=t=>t.yearlyParabolicTroughYield,aOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicTroughIndividualOutputs},mvt=t=>t.setYearlyParabolicTroughYield,lOe=t=>t.parabolicTroughLabels,yvt=t=>t.setParabolicTroughLabels,Avt=t=>t.runDailySimulationForFresnelReflectors,wvt=t=>t.runYearlySimulationForFresnelReflectors,vvt=t=>t.pauseDailySimulationForFresnelReflectors,xvt=t=>t.pauseYearlySimulationForFresnelReflectors,bvt=t=>t.dailyFresnelReflectorYield,sOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyFresnelReflectorIndividualOutputs},Svt=t=>t.setDailyFresnelReflectorYield,Tvt=t=>t.yearlyFresnelReflectorYield,cOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyFresnelReflectorIndividualOutputs},Pvt=t=>t.setYearlyFresnelReflectorYield,uOe=t=>t.fresnelReflectorLabels,Cvt=t=>t.setFresnelReflectorLabels,Rvt=t=>t.runDailySimulationForHeliostats,Hvt=t=>t.runYearlySimulationForHeliostats,Mvt=t=>t.pauseDailySimulationForHeliostats,Ivt=t=>t.pauseYearlySimulationForHeliostats,zvt=t=>t.dailyHeliostatYield,dOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyHeliostatIndividualOutputs},Dvt=t=>t.setDailyHeliostatYield,Evt=t=>t.yearlyHeliostatYield,fOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyHeliostatIndividualOutputs},Fvt=t=>t.setYearlyHeliostatYield,hOe=t=>t.heliostatLabels,kvt=t=>t.setHeliostatLabels,pOe=t=>t.runDailySimulationForUpdraftTower,gOe=t=>t.runYearlySimulationForUpdraftTower,Lvt=t=>t.pauseDailySimulationForUpdraftTower,Wvt=t=>t.pauseYearlySimulationForUpdraftTower,Nvt=t=>t.dailyUpdraftTowerResults,Uvt=t=>t.dailyUpdraftTowerYield,jvt=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyUpdraftTowerIndividualOutputs},Bvt=t=>t.setDailyUpdraftTowerResults,Yvt=t=>t.setDailyUpdraftTowerYield,Ovt=t=>t.yearlyUpdraftTowerYield,Vvt=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyUpdraftTowerIndividualOutputs},_vt=t=>t.setYearlyUpdraftTowerYield,mOe=t=>t.updraftTowerLabels,Gvt=t=>t.setUpdraftTowerLabels,Xvt=t=>t.runDailySimulationForParabolicDishes,Jvt=t=>t.runYearlySimulationForParabolicDishes,Kvt=t=>t.pauseDailySimulationForParabolicDishes,qvt=t=>t.pauseYearlySimulationForParabolicDishes,$vt=t=>t.dailyParabolicDishYield,yOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicDishIndividualOutputs},Qvt=t=>t.setDailyParabolicDishYield,Zvt=t=>t.yearlyParabolicDishYield,AOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicDishIndividualOutputs},ext=t=>t.setYearlyParabolicDishYield,wOe=t=>t.parabolicDishLabels,txt=t=>t.setParabolicDishLabels,vOe=t=>t.runDailyLightSensor,nxt=t=>t.pauseDailyLightSensor,xOe=t=>t.runYearlyLightSensor,oxt=t=>t.pauseYearlyLightSensor,rxt=t=>t.dailyLightSensorData,ixt=t=>t.setDailyLightSensorData,axt=t=>t.yearlyLightSensorData,lxt=t=>t.setYearlyLightSensorData,bOe=t=>t.sensorLabels,sxt=t=>t.setSensorLabels,ly=t=>t.hoveredHandle,Ub=t=>t.moveHandleType,Ug=t=>t.resizeHandleType,Kge=t=>t.getResizeHandlePosition,o$=t=>t.rotateHandleType,cxt=t=>t.resizeAnchor,qge=t=>t.isAddingElement,r$=t=>t.addedFoundationId,uxt=t=>t.deletedFoundationId,i$=t=>t.addedCuboidId,dxt=t=>t.deletedCuboidId,SOe=t=>t.addedWallId,fxt=t=>t.deletedWallId,hxt=t=>t.deletedRoofId,$ge=t=>t.deletedRoofIdSet,TOe=t=>t.autoDeletedRoofIdSet,pxt=t=>t.autoDeletedRoofs,POe=t=>t.autoDeletedChild,COe=t=>t.groupActionMode,gxt=t=>t.groupActionUpdateFlag,mxt=t=>t.addedWindowId,yxt=t=>t.addedDoorId,Axt=t=>t.updateWallMapOnFoundationFlag,g3=t=>t.wallActionScope,sy=t=>t.roofActionScope,MW=t=>t.windowActionScope,Ww=t=>t.doorActionScope,ROe=t=>t.setRoofActionScope,Qge=t=>t.updateWallLeftJointsById,Zge=t=>t.updateWallRightJointsById,wxt=t=>t.updateWallLeftPointById,a$=t=>t.economicsParams,vxt=t=>t.fittestIndividualResults,l$=t=>t.setFittestIndividualResults,IW=t=>t.variableLabels,s$=t=>t.setVariableLabels,bA=t=>t.evolutionaryAlgorithmState,c$=t=>t.solarPanelArrayLayoutConstraints,xxt=t=>t.geneticAlgorithmWizardSelectedTab,bxt=t=>t.particleSwarmOptimizationWizardSelectedTab,Sxt=t=>t.countHeatmapCells,bh=t=>t.setPrimitiveStore,eme=be.memo(({hx:t,hy:e,hz:n,position:o,rotation:r})=>{const i=M(T7t),a=M(mA),l=a?"#888888":"#444444",s=Math.max(t,e),[c,u]=m.useState(Math.floor(s/50)+1),[d,f]=m.useState(.5);m.useEffect(()=>{i?(u((Math.floor(s/25)+1)*m9),f(a?.05:.1)):(u((Math.floor(s/25)+1)*P6),f((a?.05:.1)*Z5))},[i,s,a]);const p=m.useMemo(()=>{const A=[0];for(let y=c;y<=t;y+=c)A.push(y),A.push(-y);return A},[c,t]),g=m.useMemo(()=>{const A=[0];for(let y=c;y<=e;y+=c)A.push(y),A.push(-y);return A},[c,e]);return h.jsxs("group",{position:o??[0,0,n+.01],rotation:r,children:[p.map(A=>h.jsx(Gn,{points:[[A,-e,0],[A,e,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},A)),g.map(A=>h.jsx(Gn,{points:[[-t,A,0],[t,A,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},A))]})}),Mre=.2,Txt=({x:t,z:e,handleType:n,scale:o=[1,1,1]})=>{const r=M(pn),i=M(Ug),a=m.useRef(null),[l,s]=m.useState("white"),[c,u,d]=o;return m.useEffect(()=>{s(i===n?"red":"white")},[i]),h.jsx(si,{ref:a,name:n,args:[Mre*c,Mre*u,Mre*d],position:[t,0,e],onPointerEnter:()=>{s("red"),r(f=>{f.hoveredHandle=n})},onPointerLeave:()=>{i===null&&s("white"),r(f=>{f.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:l})})},Sv=be.memo(Txt),Pxt=({handleType:t})=>{const e=M(Ub),n=m.useRef(null),[o,r]=m.useState("white");return m.useEffect(()=>{e===zo.Mid?r("red"):r("white")},[e]),h.jsx(Ps,{ref:n,name:t,args:[.1,6,6],onPointerEnter:()=>{r("red")},onPointerLeave:()=>{e===null&&r("white")},children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},Cxt=be.memo(Pxt);class Ire{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y,this.array[this.top++]=e.z}}class Rxt{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y}}let IT=class UV{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygons=[],e&&this.build(e)}clone(){const e=new UV;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map(n=>n.clone()),e}invert(){for(let n=0;nUv.EPSILON?1:0;u|=g,d.push(g)}switch(u){case 0:(this.normal.dot(e.plane.normal)>0?n:o).push(e);break;case 1:r.push(e);break;case 2:i.push(e);break;case 3:{const f=[],p=[];for(let g=0;g=3&&r.push(new vG(f,e.shared)),p.length>=3&&i.push(new vG(p,e.shared));break}}}static fromPoints(e,n,o){const r=new x2().copy(n).sub(e).cross(new x2().copy(o).sub(e)).normalize();return new Uv(r.clone(),r.dot(e))}}Uv.EPSILON=1e-5;let vG=class HOe{constructor(e,n){this.vertices=e,this.shared=n,this.plane=Uv.fromPoints(e[0].pos,e[1].pos,e[2].pos)}clone(){return new HOe(this.vertices.map(e=>e.clone()),this.shared)}flip(){this.vertices.reverse().map(e=>e.flip()),this.plane.flip()}};class xG{constructor(e,n,o,r){this.pos=new x2().copy(e),this.normal=new x2().copy(n),this.uv=new x2().copy(o),this.uv.z=0,r&&(this.color=new x2().copy(r))}clone(){return new xG(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(e,n){return new xG(this.pos.clone().lerp(e.pos,n),this.normal.clone().lerp(e.normal,n),this.uv.clone().lerp(e.uv,n),this.color&&e.color&&this.color.clone().lerp(e.color,n))}}class cc{constructor(){this.polygons=[]}static fromPolygons(e){const n=new cc;return n.polygons=e,n}static fromGeometry(e,n){let o=[];const r=e.attributes.position,i=e.attributes.normal,a=e.attributes.uv,l=e.attributes.color,s=e.groups;let c;if(e.index)c=e.index.array;else{c=new Array(r.array.length/r.itemSize|0);for(let d=0;d0)for(const A of s)d>=A.start&&d!Number.isNaN(d.plane.normal.x)))}static toGeometry(e,n){let o=0;const r=e.polygons;for(const p of r)o+=p.vertices.length-2;const i=new ji,a=new Ire(o*3*3),l=new Ire(o*3*3),s=new Rxt(o*2*3);let c;const u=[],d=[];for(const p of r){const g=p.vertices,A=g.length;p.shared!==void 0&&(u[p.shared]||(u[p.shared]=[])),A&&g[0].color!==void 0&&(c||(c=new Ire(o*3*3)));for(let y=3;y<=A;y++)(p.shared===void 0?d:u[p.shared]).push(a.top/3,a.top/3+1,a.top/3+2),a.write(g[0].pos),a.write(g[y-2].pos),a.write(g[y-1].pos),l.write(g[0].normal),l.write(g[y-2].normal),l.write(g[y-1].normal),s&&(s.write(g[0].uv),s.write(g[y-2].uv),s.write(g[y-1].uv)),c&&(c.write(g[0].color),c.write(g[y-2].color),c.write(g[y-1].color))}i.setAttribute("position",new tl(a.array,3)),i.setAttribute("normal",new tl(l.array,3)),s&&i.setAttribute("uv",new tl(s.array,2)),c&&i.setAttribute("color",new tl(c.array,3));for(let p=0;pn.clone()).filter(n=>Number.isFinite(n.plane.w)),e}toPolygons(){return this.polygons}union(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),cc.fromPolygons(n.allPolygons())}subtract(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.invert(),n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),n.invert(),cc.fromPolygons(n.allPolygons())}intersect(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.invert(),o.clipTo(n),o.invert(),n.clipTo(o),o.clipTo(n),n.build(o.allPolygons()),n.invert(),cc.fromPolygons(n.allPolygons())}inverse(){const e=this.clone();for(const n of e.polygons)n.flip();return e}toMesh(e,n){return cc.toMesh(this,e,n)}toGeometry(e){return cc.toGeometry(this,e)}}const dt=$K()((t,e)=>{const n=o=>t(JP(o));return{set:o=>{try{n(o)}catch(r){console.log(r)}},setPrimitiveStore(o,r){n(i=>{i[o]!==void 0?i[o]=r:console.error(`key ${o} is not defined in PrimitiveStoreState`)})},latestVersion:void 0,changed:!1,setChanged(o){n(r=>{r.changed=o})},skipChange:!0,setSkipChange(o){n(r=>{r.skipChange=o})},localFileName:"aladdin.ala",createNewFileFlag:!1,setCreateNewFileFlag(o){n(r=>{r.createNewFileFlag=o})},openLocalFileFlag:!1,setOpenLocalFileFlag(o){n(r=>{r.openLocalFileFlag=o})},waiting:!1,contextMenuFlag:!1,updateContextMenu(){n(o=>{o.contextMenuFlag=!o.contextMenuFlag})},showSolarPanelCustomizationPanel:!1,showEconomicsPanel:!1,showNavigationPanel:!1,showShadowSettings:!1,saveAccountSettingsFlag:!1,saveCloudFileFlag:!1,setSaveCloudFileFlag(o){n(r=>{r.saveCloudFileFlag=o})},listCloudFilesFlag:!1,refreshCloudFilesFlag:!1,saveLocalFileDialogVisible:!1,modelsMapFlag:!1,leaderboardFlag:!1,showLeaderboard:!1,publishOnModelsMapFlag:!1,modelsMapWeatherStations:!1,createProjectFlag:!1,saveProjectAsFlag:!1,curateDesignToProjectFlag:!1,showProjectsFlag:!1,updateProjectsFlag:!1,showProjectListPanel:!1,projectImagesUpdateFlag:!1,projectType:Ri.SOLAR_PANEL_ARRAY,projectTitle:null,projectDescription:null,userCount:0,showCloudFilePanel:!1,openModelsMap:!1,showModelsGallery:!1,showAccountSettingsPanel:!1,showLikesPanel:!1,showPublishedModelsPanel:!1,animateSun:!1,simulationInProgress:!1,simulationPaused:!1,evolutionInProgress:!1,evolutionPaused:!1,runEvolution:!1,pauseEvolution:!1,objectiveEvaluationIndex:0,runDailyThermalSimulation:!1,pauseDailyThermalSimulation:!1,runYearlyThermalSimulation:!1,pauseYearlyThermalSimulation:!1,clearDailySimulationResultsFlag:!1,clearYearlySimulationResultsFlag:!1,runDynamicSimulation:!1,runStaticSimulation:!1,pauseSimulation:!1,runDailySimulationForParabolicDishes:!1,runYearlySimulationForParabolicDishes:!1,pauseDailySimulationForParabolicDishes:!1,pauseYearlySimulationForParabolicDishes:!1,runDailySimulationForParabolicTroughs:!1,runYearlySimulationForParabolicTroughs:!1,pauseDailySimulationForParabolicTroughs:!1,pauseYearlySimulationForParabolicTroughs:!1,runDailySimulationForFresnelReflectors:!1,runYearlySimulationForFresnelReflectors:!1,pauseDailySimulationForFresnelReflectors:!1,pauseYearlySimulationForFresnelReflectors:!1,runDailySimulationForHeliostats:!1,runYearlySimulationForHeliostats:!1,pauseDailySimulationForHeliostats:!1,pauseYearlySimulationForHeliostats:!1,runSolarPanelVisibilityAnalysis:!1,runDailySimulationForSolarPanels:!1,pauseDailySimulationForSolarPanels:!1,runYearlySimulationForSolarPanels:!1,pauseYearlySimulationForSolarPanels:!1,runDailySimulationForSolarPanelsLastStep:!1,runYearlySimulationForSolarPanelsLastStep:!1,runDailyLightSensor:!1,pauseDailyLightSensor:!1,runYearlyLightSensor:!1,pauseYearlyLightSensor:!1,runDailySimulationForUpdraftTower:!1,runYearlySimulationForUpdraftTower:!1,pauseDailySimulationForUpdraftTower:!1,pauseYearlySimulationForUpdraftTower:!1,flagOfDailySimulation:!1,showSolarRadiationHeatmap:!1,showHeatFluxes:!1,duringCameraInteraction:!1,navigationMoveSpeed:3,navigationTurnSpeed:3,elementBeingCanceledId:null,showWallIntersectionPlaneId:null,oldParentId:null,oldFoundationId:null,selectedElementId:null,foundationMovedFlag:!1,updateFoundationMovedFlag(){n(o=>{o.foundationMovedFlag=!o.foundationMovedFlag})},isCameraUnderGround:!1,selectButtonClicked:!1,setSelectButtonClicked(o){n(r=>{r.selectButtonClicked=o})}}}),Cn=$K()((t,e)=>({roofSegmentVerticesMap:new Map,setRoofSegmentVertices(n,o){t(r=>(r.roofSegmentVerticesMap.set(n,[...o]),r))},getRoofSegmentVertices(n){return e().roofSegmentVerticesMap.get(n)},deleteRoofSegmentVertices(n){t(o=>(o.roofSegmentVerticesMap.delete(n),o))},roofSegmentVerticesWithoutOverhangMap:new Map,setRoofSegmentVerticesWithoutOverhang(n,o){t(r=>(r.roofSegmentVerticesWithoutOverhangMap.set(n,o),r))},getRoofSegmentVerticesWithoutOverhang(n){return e().roofSegmentVerticesWithoutOverhangMap.get(n)},deleteRoofSegmentVerticesWithoutOverhang(n){t(o=>(o.roofSegmentVerticesWithoutOverhangMap.delete(n),o))},dailyLightSensorData:[],setDailyLightSensorData(n){t({dailyLightSensorData:[...n]})},yearlyLightSensorData:[],setYearlyLightSensorData(n){t({yearlyLightSensorData:[...n]})},sensorLabels:[],setSensorLabels(n){t({sensorLabels:[...n]})},dailyPvYield:[],setDailyPvYield(n){t({dailyPvYield:[...n]}),dt.getState().set(o=>{o.runEvolution&&o.objectiveEvaluationIndex++})},sumDailyPvYield(){let n=0;for(const o of this.dailyPvYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},getDailyPvProfit(){const n=this.sumDailyPvYield(),o=ye.countAllSolarPanels();return n*M.getState().economicsParams.electricitySellingPrice-o*M.getState().economicsParams.operationalCostPerUnit},yearlyPvYield:[],setYearlyPvYield(n){t({yearlyPvYield:[...n]}),dt.getState().set(o=>(o.runEvolution&&o.objectiveEvaluationIndex++,o))},sumYearlyPvYield(){var r;let n=0;for(const i of this.yearlyPvYield)for(const a in i)Object.hasOwn(i,a)&&a!=="Month"&&(n+=i[a]);const o=12/(((r=M.getState().world)==null?void 0:r.daysPerYear)??6);return n*o},getYearlyPvProfit(){const n=ye.countAllSolarPanels();return this.sumYearlyPvYield()*M.getState().economicsParams.electricitySellingPrice-n*M.getState().economicsParams.operationalCostPerUnit*365},solarPanelLabels:[],setSolarPanelLabels(n){t({solarPanelLabels:[...n]})},solarPanelVisibilityResults:new Map,setSolarPanelVisibilityResult(n,o){t(r=>(r.solarPanelVisibilityResults.set(n,o),r))},clearSolarPanelVisibilityResults(){t({solarPanelVisibilityResults:new Map})},dailyParabolicDishYield:[],setDailyParabolicDishYield(n){t({dailyParabolicDishYield:[...n]})},sumDailyParabolicDishYield(){let n=0;for(const o of this.dailyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicDishYield:[],setYearlyParabolicDishYield(n){t({yearlyParabolicDishYield:[...n]})},sumYearlyParabolicDishYield(){let n=0;for(const o of this.yearlyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicDishLabels:[],setParabolicDishLabels(n){t({parabolicDishLabels:[...n]})},dailyParabolicTroughYield:[],setDailyParabolicTroughYield(n){t({dailyParabolicTroughYield:[...n]})},sumDailyParabolicTroughYield(){let n=0;for(const o of this.dailyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicTroughYield:[],setYearlyParabolicTroughYield(n){t({yearlyParabolicTroughYield:[...n]})},sumYearlyParabolicTroughYield(){let n=0;for(const o of this.yearlyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicTroughLabels:[],setParabolicTroughLabels(n){t({parabolicTroughLabels:[...n]})},dailyFresnelReflectorYield:[],setDailyFresnelReflectorYield(n){t({dailyFresnelReflectorYield:[...n]})},sumDailyFresnelReflectorYield(){let n=0;for(const o of this.dailyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyFresnelReflectorYield:[],setYearlyFresnelReflectorYield(n){t({yearlyFresnelReflectorYield:[...n]})},sumYearlyFresnelReflectorYield(){let n=0;for(const o of this.yearlyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},fresnelReflectorLabels:[],setFresnelReflectorLabels(n){t({fresnelReflectorLabels:[...n]})},dailyHeliostatYield:[],setDailyHeliostatYield(n){t({dailyHeliostatYield:[...n]})},sumDailyHeliostatYield(){let n=0;for(const o of this.dailyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyHeliostatYield:[],setYearlyHeliostatYield(n){t({yearlyHeliostatYield:[...n]})},sumYearlyHeliostatYield(){let n=0;for(const o of this.yearlyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},heliostatLabels:[],setHeliostatLabels(n){t({heliostatLabels:[...n]})},dailyUpdraftTowerResults:[],dailyUpdraftTowerYield:[],setDailyUpdraftTowerResults(n){t({dailyUpdraftTowerResults:[...n]})},setDailyUpdraftTowerYield(n){t({dailyUpdraftTowerYield:[...n]})},sumDailyUpdraftTowerYield(){let n=0;for(const o of this.dailyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyUpdraftTowerYield:[],setYearlyUpdraftTowerYield(n){t({yearlyUpdraftTowerYield:[...n]})},sumYearlyUpdraftTowerYield(){let n=0;for(const o of this.yearlyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},updraftTowerLabels:[],setUpdraftTowerLabels(n){t({updraftTowerLabels:[...n]})},heatmaps:new Map,setHeatmap(n,o){t(r=>(r.heatmaps.set(n,o),r))},getHeatmap(n){return e().heatmaps.get(n)},hourlyHeatExchangeArrayMap:new Map,setHourlyHeatExchangeArray(n,o){t(r=>(r.hourlyHeatExchangeArrayMap.set(n,o),r))},hourlySolarHeatGainArrayMap:new Map,setHourlySolarHeatGainArray(n,o){t(r=>(r.hourlySolarHeatGainArrayMap.set(n,o),r))},hourlySolarPanelOutputArrayMap:new Map,setHourlySolarPanelOutputArray(n,o){t(r=>(r.hourlySolarPanelOutputArrayMap.set(n,o),r))},totalBuildingHeater:0,setTotalBuildingHeater:n=>{t({totalBuildingHeater:n})},totalBuildingAc:0,setTotalBuildingAc:n=>{t({totalBuildingAc:n})},totalBuildingSolarPanel:0,setTotalBuildingSolarPanel:n=>{t({totalBuildingSolarPanel:n})},clearHeatmaps(){t(n=>(n.heatmaps.clear(),n))},clearDataStore(){t({heatmaps:new Map,hourlyHeatExchangeArrayMap:new Map,hourlySolarHeatGainArrayMap:new Map,hourlySolarPanelOutputArrayMap:new Map,solarPanelVisibilityResults:new Map,dailyLightSensorData:[],yearlyLightSensorData:[],sensorLabels:[],dailyPvYield:[],yearlyPvYield:[],solarPanelLabels:[],dailyParabolicDishYield:[],yearlyParabolicDishYield:[],parabolicDishLabels:[],dailyParabolicTroughYield:[],yearlyParabolicTroughYield:[],parabolicTroughLabels:[],dailyFresnelReflectorYield:[],yearlyFresnelReflectorYield:[],fresnelReflectorLabels:[],dailyHeliostatYield:[],yearlyHeliostatYield:[],heliostatLabels:[],dailyUpdraftTowerYield:[],dailyUpdraftTowerResults:[],yearlyUpdraftTowerYield:[],updraftTowerLabels:[]})},clearRoofVerticesMap(){t(n=>(n.roofSegmentVerticesMap.clear(),n.roofSegmentVerticesWithoutOverhangMap.clear(),n))}})),Hxt="/aladdin/assets/roof_edge-DBy_1Q5D.png",og="/aladdin/assets/tiny_white_square-B_qAXRfa.png",Mxt="/aladdin/assets/roof_01-BwuyLpwq.png",Ixt="/aladdin/assets/roof_02-DAbYjnV7.png",zxt="/aladdin/assets/roof_03-haZGIixv.png",Dxt="/aladdin/assets/roof_04-DDuwUcDr.png",Ext="/aladdin/assets/roof_05-CtBb5xIW.png",Fxt="/aladdin/assets/roof_06-DuyyebV8.png",kxt="/aladdin/assets/roof_07-DXWGQN8a.png",Lxt=new pf({color:"white",side:Da}),Wxt=be.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=Math.min(a,i,o/2),{width:s,horizontalMullionSpacing:c,verticalMullionSpacing:u,color:d}=e,f=3,p=1,g=s/2,A=m.useMemo(()=>Math.atan2(o/2,l),[o,l]),y=m.useMemo(()=>{if(l===0||o===0)return 0;const b=l/2+o**2/(8*l),R=b-l,H=Math.PI-A,F=R**2,E=b**2,N=F+E-2*F*Math.sin(H)**2-2*R*Math.sqrt((E-F*Math.sin(H)**2)*Math.cos(H)**2);return Math.sqrt(N)},[o,l,A]),S=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:d}),[d]),C=b=>new kl().moveTo(0,b).quadraticCurveTo(b,b,b,0).quadraticCurveTo(b,-b,0,-b).quadraticCurveTo(-b,-b,-b,0).quadraticCurveTo(-b,b,0,b),P=(b,R)=>{const H=b*R/(o/2),F=H/2+(R*2)**2/(8*H),E=Math.acos(Math.min(1,R/F)),N=Math.PI-E,U=new z2(0,H-F,F,F,E,N,!1,0).getPoints(24).map(W=>new ae(W.x,W.y));return new bq(U)},v=m.useMemo(()=>{const b=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const H=o/(R+1);let F=H/2;R%2!==0&&(b.push(0),F=H);for(let E=0;E{const b=[];if(s===0)return b;const R=i/2-l,H=i-l,F=Math.ceil(H/c);let E=R;for(let N=0;N{const b=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const H=o/(R+1);let F=H/2;R%2!==0&&(F=H);for(let N=0;Nlh.jsx("group",{position:[0,0,i/2-l],rotation:[0,R,0],children:h.jsx(ma,{position:[0,0,b/2],args:[g,g,b,f,p],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:S})});return h.jsxs("group",{name:"Window Mullion Group",position:[0,-.001,0],children:[e.horizontalMullion&&T.map((b,R)=>h.jsx(ma,{position:[0,0,b],args:[g,g,o,f,p],rotation:[0,0,Qt],receiveShadow:n,castShadow:n,children:S},R)),e.verticalMullion&&(v==null?void 0:v.map((b,R)=>h.jsx(ma,{position:[b,0,-l/2],args:[g,g,i-l,f,p],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:S},R))),l>0&&(w==null?void 0:w.map((b,R)=>{if(b===null)return null;const{shape:H,path:F}=b;return h.jsx(aw,{position:[0,g/2,i/2-l],rotation:[Qt,0,0],args:[H,{extrudePath:F,steps:12,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:S},R)})),y>0&&h.jsxs(h.Fragment,{children:[x(l,0),x(y,A),x(y,-A)]})]})}),Nxt=be.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=o/2,s=Math.min(a,i,l),{color:c,width:u,sillWidth:d}=e,f=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),p=u/2,g=p/2,A=o+u*3,y=u,S=m.useMemo(()=>{const[C,P]=[l+u,l],v=s+u,T=v/2+(C*2)**2/(8*v),w=Math.acos(Math.min(1,C/T)),x=Math.PI-w,b=v-T,R=s,H=R/2+(P*2)**2/(8*R),F=Math.acos(Math.min(1,P/H)),E=Math.PI-F,N=R-H,U=new z2(0,b,T,T,w,x,!1,0).getPoints(36),W=new z2(0,N,H,H,E,F,!0,0).getPoints(36);return new kl([...U,...W])},[a,i,o,u]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-g/2,0],children:[s>.1?h.jsx(aw,{position:[0,g/2,i/2-s],rotation:[Qt,0,0],args:[S,{depth:g,steps:1,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:f}):h.jsx(si,{position:[0,0,i/2],args:[o+2*u,g,u],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[-o/2-p,0,-s/2],args:[u,g,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[o/2+p,0,-s/2],args:[u,g,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[0,0,-i/2-(d===0?0:y/2)],args:d===0?[o+2*u,g,u]:[A,d??u,y],castShadow:n,receiveShadow:n,children:f})]})}),Zce=be.memo(({cy:t,dimension:e,wireframeData:n,drawBottom:o})=>{const[r,i,a,l]=e,{lineWidth:s,lineColor:c,selected:u,locked:d,opacity:f}=n,p=s/20,g=s/5,A=r/2,y=a/2,S=Math.min(l,a,A),C=6,P=1,v=(R,H)=>{const F=R/2+(H*2)**2/(8*R),E=Math.acos(Math.min(1,H/F)),N=Math.PI-E,U=new z2(0,R-F,F,F,E,N,!1,0).getPoints(24).map(W=>new ae(W.x,W.y));return new bq(U)},T=R=>new kl().moveTo(0,R).quadraticCurveTo(R,R,R,0).quadraticCurveTo(R,-R,0,-R).quadraticCurveTo(-R,-R,-R,0).quadraticCurveTo(-R,R,0,R),w=m.useMemo(()=>new pf({color:c}),[c]),x=m.useMemo(()=>new pf({color:B0}),[]),b=(R,H)=>h.jsxs(h.Fragment,{children:[S>.1?h.jsx(aw,{position:[0,0,a/2-S],rotation:[Qt,0,0],args:[T(R),{extrudePath:v(S,A),steps:24,bevelEnabled:!1}],material:H}):h.jsx(ma,{args:[R,R,r,C,P],rotation:[0,0,Qt],position:[0,0,y-R/2],material:H}),o&&h.jsx(ma,{args:[R,R,r,C,P],rotation:[0,0,Qt],position:[0,0,-y],material:H}),h.jsx(ma,{args:[R,R,a-S,C,P],rotation:[Qt,Qt,0],position:[A,0,-S/2],material:H}),h.jsx(ma,{args:[R,R,a-S,C,P],rotation:[Qt,Qt,0],position:[-A,0,-S/2],material:H})]});return h.jsxs("group",{name:"Window Wireframe Group",children:[f>0&&h.jsx("group",{position:[0,t,0],children:b(p,w)}),d&&u&&b(g,x)]})}),Uxt=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=M(Cs),T=Cn(Ib),w=m.useRef(0),x=m.useRef(),[b,R,H,F]=e,[E,N,U]=n,W=(G,q)=>{if(F>0){const $=.5*b,ie=.5*H,Q=Math.min(F,H,$),se=.5*(Q+$*$/Q);if(Math.abs(G)<$&&q-ie)return!0;const Z=q-(H-se-ie);return G*G+Z*Z{if(!d||g||A&&A.notBuilding)return;const G=T.get(t);if(!G)return;const q=G.reduce((oe,de)=>oe+de,0);if(f===0)return;const $=i3*(y.solarRadiationHeatmapGridCellSize??.5),ie=Math.max(2,Math.round(b/$)),Q=Math.max(2,Math.round(H/$)),se=b/ie,Z=H/Q,ee=q/f*(S??Qm);w.current=ee<0?1:0,x.current=ye.getEuler(ko,Yc,"YXZ",Math.sign(ee)*Qt);const te=[];if(ee<0)for(let oe=0;oec*b,[b,c]),L=m.useMemo(()=>H-Math.min(F,H,b/2),[b,H,F]),j=m.useMemo(()=>(D+r.width+b)/2*1.025,[b,D,r.width]),B=m.useMemo(()=>-Math.min(F,H,b/2)/2,[H,L]),O=m.useMemo(()=>bG(b,H,F),[b,H,F]),V=(G,q,$)=>h.jsx(ta,{name:"Window Seal Plane",args:G,position:q,rotation:$,material:Lxt,receiveShadow:v,castShadow:v});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Arched Window Plane Group",position:[0,N,0],children:[h.jsxs("mesh",{name:"Window Glass mesh",rotation:[Qt,0,0],children:[h.jsx("shapeGeometry",{args:[O]}),u]}),(o.horizontalMullion||o.verticalMullion)&&F!==void 0&&h.jsx(Wxt,{dimension:e,mullionData:o,shadowEnabled:v})]}),r.showFrame&&h.jsx(Nxt,{dimension:e,frameData:r,shadowEnabled:v}),h.jsx(Zce,{cy:N,dimension:e,wireframeData:i,drawBottom:!0}),h.jsx(Qye,{cx:j,cz:B,lx:D,lz:L,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),V([R,H],[-b/2,R/2,0],[Qt,Qt,0]),V([R,H],[b/2,R/2,0],[Qt,-Qt,0]),V([b,R],[0,R/2,-H/2]),k&&k.map((G,q)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:G,name:"Heat Flux "+q,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:G[w.current].clone().add(new ae(0,w.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},q))]})},bG=(t,e,n,o=0,r=0)=>{const i=new kl,a=t/2,l=e/2,s=Math.min(n,e,a);if(i.moveTo(o-a,r-l),i.lineTo(o+a,r-l),i.lineTo(o+a,r+l-s),s>.01){const c=s/2+t**2/(8*s),[u,d]=[o,r+l-c],f=Math.acos(Math.min(1,a/c)),p=Math.PI-f;i.absarc(u,d,c,f,p,!1)}else i.lineTo(o-a,r+l);return i.closePath(),i},jxt=be.memo(Uxt),Bxt=1,Yxt=3,Oxt=new pf({color:"white",side:ti}),Vxt=new ln(0,0,-Qt),_xt=be.memo(({dimension:t,polygonTop:e,frameData:n,shadowEnabled:o})=>{const[r,i,a]=t,[l,s]=e,{color:c,width:u,sillWidth:d}=n,f=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),[p,g]=[r/2,a/2],y=u/2/2,S=r+u*3,C=u,P=m.useMemo(()=>{const w=new ae(p,-g),x=new ae(p,g),b=new ae(-p,g),R=new ae(-p,-g),H=new ae(l*r,s+g);return[w,x,H,b,R]},[p,g,l,s]),v=m.useMemo(()=>{const w=[];for(let R=1;R{const w=new kl;for(let x=0;x=0;x--){const b=P[x];w.lineTo(b.x,b.y)}return w.closePath(),w},[P,v]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-y/2,0],children:[h.jsx(aw,{position:[0,y/2,0],rotation:[Qt,0,0],args:[T,{steps:1,depth:y,bevelEnabled:!1}],children:f}),h.jsx(si,{position:[0,0,-a/2-(d===0?0:C/2)],args:d===0?[r+2*u,y,u]:[S,d??u,C],castShadow:o,receiveShadow:o,children:f})]})}),Gxt=({id:t,dimension:e,polygonTop:n,position:o,glassMaterial:r,empty:i,interior:a,wireframeData:l,frameData:s,leftShutter:c,rightShutter:u,shutterColor:d,shutterWidth:f,area:p,showHeatFluxes:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=Cn(Ib),T=m.useRef(0),w=m.useRef(),[x,b,R]=o,[H,F,E]=e,[N,U,W]=e.map(ge=>ge/2),[k,D]=n,{lineWidth:L,lineColor:j,selected:B,locked:O,opacity:V}=l,G=k*H,q=Math.hypot(D,N-G),$=Math.asin(D/q),ie=Math.hypot(D,N+G),Q=-Math.asin(D/ie),se=M(Cs),Z=(ge,Se)=>{const Re=.5*H,De=.5*(E+n[1]),Ae=n[1],ue=[{x:-Re,y:-De},{x:Re,y:-De},{x:Re,y:De-Ae},{x:H*n[0],y:De},{x:-Re,y:De-Ae}];return ye.isPointInside(ge,Se,ue)},ee=m.useMemo(()=>{if(!g||a||A&&A.notBuilding)return;const ge=v.get(t);if(!ge)return;const Se=ge.reduce((Me,ze)=>Me+ze,0);if(p===0)return;const Re=i3*(y.solarRadiationHeatmapGridCellSize??.5),De=E+n[1],Ae=Math.max(2,Math.round(H/Re)),ue=Math.max(2,Math.round(De/Re)),fe=H/Ae,ve=De/ue,we=Se/p*(S??Qm);T.current=we<0?1:0,w.current=ye.getEuler(ko,Yc,"YXZ",Math.sign(we)*Qt);const Pe=[],Ie=n[1]/2;if(we<0)for(let Me=0;Mef*H,[H,f]),oe=m.useMemo(()=>(te+s.width+H)/2*1.025,[H,te,s.width]),de=m.useMemo(()=>{const[ge,Se]=[H/2,E/2],Re=k*H;return SG(ge,Se,Re,D)},[H,E,k,D]),he=m.useMemo(()=>B&&O?new pf({color:B0}):new pf({color:j}),[j,B,O]),pe=m.useMemo(()=>O&&B?L/5:L/20,[L,B,O]),me=m.useMemo(()=>O&&B?-F/2:-b,[b,F,B,O]),le=(ge,Se=0)=>h.jsx(ma,{args:[pe,pe,ge,Yxt,Bxt],position:[Se,me,0],rotation:[0,0,Qt],material:he}),Te=(ge,Se=0)=>h.jsx(ta,{args:[ge,F],position:[Se,0,0],material:Oxt,receiveShadow:se,castShadow:se});return h.jsxs(h.Fragment,{children:[!i&&h.jsxs("mesh",{name:"Triangle Glass Plane",position:[0,b,0],rotation:[Qt,0,0],children:[h.jsx("shapeGeometry",{args:[de]}),r]}),s.showFrame&&h.jsx(_xt,{dimension:e,polygonTop:n,frameData:s,shadowEnabled:se}),h.jsx(Qye,{cx:oe,lx:te,lz:E,color:d,showLeft:c,showRight:u,spacing:s.showFrame?s.width/2:0}),h.jsxs("group",{position:[0,U,-W+.001],children:[Te(H),le(H)]}),h.jsxs("group",{position:[-N+.001,U,0],rotation:[0,Qt,0],children:[Te(E),le(E)]}),h.jsxs("group",{position:[N-.001,U,0],rotation:[0,-Qt,0],children:[Te(E),le(E)]}),h.jsxs("group",{position:[-N+.001,U,W-.01],rotation:[0,Q,0],children:[Te(ie,ie/2),le(ie,ie/2)]}),h.jsxs("group",{position:[N-.001,U,W-.01],rotation:[0,$,0],children:[Te(q,-q/2),le(q,-q/2)]}),ee&&ee.map((ge,Se)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:ge,name:"Heat Flux "+Se,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:ge[T.current].clone().add(new ae(0,T.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:w.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},Se))]})},SG=(t,e,n,o,r=0,i=0)=>{const a=new kl;return a.moveTo(r-t,i-e),a.lineTo(r+t,i-e),a.lineTo(r+t,i+e),a.lineTo(r+n,i+e+o),a.lineTo(r-t,i+e),a.closePath(),a},Xxt=be.memo(Gxt),Jxt=({id:t,index:e,foundationModel:n,roofType:o,segment:r,centroid:i,thickness:a,color:l,sideColor:s,texture:c,heatmap:u,windows:d})=>{const f=M(s3),p=dt(p3),g=M(e5),A=M(a3),y=M(l3),S=Cn(yW),{transparent:C,opacity:P}=tM(),v=m.useRef(0),T=m.useRef(),w=m.useRef(),x=M.getState().world,b=Cn.getState().hourlyHeatExchangeArrayMap,{points:R}=r,H=m.useMemo(()=>{if(!p)return;const E=S(t);if(!E)return;const N=[],U=new ae(0,0,a+.1);switch(o){case Go.Hip:case Go.Pyramid:for(const W of E){const k=[];k.push(W[0].clone().sub(i).add(U)),k.push(W[1].clone().sub(i).add(U)),N.push(k)}break;case Go.Mansard:for(const[W,k]of E.entries()){if(W===E.length-1)continue;const D=[];D.push(k[0].clone().sub(i).add(U)),D.push(k[1].clone().sub(i).add(U)),N.push(D)}break;case Go.Gambrel:for(const[W,k]of E.entries()){if(W===0||W===3){const L=[];L.push(k[0].clone().sub(i).add(U)),L.push(k[1].clone().sub(i).add(U)),N.push(L)}let D=[];D.push(k[0].clone().sub(i).add(U)),D.push(k[3].clone().sub(i).add(U)),N.push(D),D=[],D.push(k[1].clone().sub(i).add(U)),D.push(k[2].clone().sub(i).add(U)),N.push(D)}break}return N},[p]),F=m.useMemo(()=>{if(!p||n&&n.notBuilding)return;const E=b.get(t+"-"+e);if(!E)return;const N=E.reduce((fe,ve)=>fe+ve,0),U=S(t);if(!U||!U[e])return;const[W,k,D,L,j]=R,B=j.z-W.z,O=U[e].map(fe=>fe.clone().sub(i).add(new ae(0,0,B)));if(!O)return;const V=[];for(const fe of O)V.push({x:fe.x,y:fe.y});const G=i3*(x.solarRadiationHeatmapGridCellSize??.5),q=O[0].clone(),$=O[1].clone(),ie=O[2].clone(),Q=new ae().subVectors($,q),se=new ae().subVectors(ie,q),Z=new ae().subVectors(ie,$),ee=Q.length(),te=new ae().crossVectors(se,Z).length()/ee,oe=Math.max(2,Math.floor(ee/G)),de=Math.max(2,Math.floor(te/G));Q.normalize(),se.normalize(),Z.normalize();const he=new ae().crossVectors(se,Z).normalize(),pe=Q.multiplyScalar(.5*ee/oe),me=new ae().crossVectors(he,Q).normalize().multiplyScalar(.5*te/de),le=q.clone().add(pe).add(me);pe.multiplyScalar(2),me.multiplyScalar(2),T.current=he.clone().multiplyScalar(.1);const Te=[],ge=new ae;let Se=O.length===4?ye.getTriangleArea(O[0],O[1],O[2])+ye.getTriangleArea(O[2],O[3],O[0]):ye.getTriangleArea(O[0],O[1],O[2]);if(Se===0)return;let Re=f(z.Window,t);const De=S(t);if(De&&De[e]&&(Re=Re.filter(fe=>{const ve=fe,we=ve.cy+(ve.windowType===Ci.Polygonal&&ve.polygonTop?ve.polygonTop[1]/2:0);return bn.onSegment(De[e],fe.cx,we)})),Re&&Re.length>0)for(const fe of Re)Se-=ye.getWindowArea(fe);const Ae=N/Se*(g??Qm);v.current=Ae<0?1:0,w.current=ye.getEuler(ko,he,"YXZ",-Math.sign(Ae)*Qt);let ue;for(let fe=0;fe0){const Pe=ge.x+i.x,Ie=ge.y+i.y;for(const Me of Re){const ze=bn.getRelativeWindowVerticesOnRoof(Me),Ne=ye.getPoints(ze);if(ye.isPointInside(Pe,Ie,Ne)){ue=!1;break}}}if(ue&&ye.isPointInside(ge.x,ge.y,V)){const Pe=[];Ae<0?(Pe.push(ge.clone()),Pe.push(ge.clone().add(he.clone().multiplyScalar(-Ae)))):(Pe.push(ge.clone()),Pe.push(ge.clone().add(he.clone().multiplyScalar(Ae)))),Te.push(Pe)}}}return Te},[p,g]);return h.jsxs(h.Fragment,{children:[h.jsx(MOe,{id:t,index:e,segment:r,color:l,sideColor:s,texture:c,heatmap:u,transparent:C,opacity:P,windows:d,centroid:i}),H&&H.map((E,N)=>h.jsx(Gn,{points:E,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+N},N)),F&&F.map((E,N)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:E,name:"Heat Flux "+N,lineWidth:y??Zm,color:A??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:T.current?E[v.current].clone().add(T.current):E[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head "+N,rotation:w.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:A??p0})})]},N))]})},MOe=be.memo(({id:t,index:e,segment:n,color:o,sideColor:r,texture:i,heatmap:a,transparent:l,opacity:s,windows:c,centroid:u})=>{const d=dt(hs),f=m.useRef(null),{points:p}=n,g=d?a:i,A=p.length===6,y=p.length===8,S=m.useMemo(()=>c.map(R=>{const H=new ae(R.lx,R.lz,R.ly*2),F=new ae(R.cx,R.cy,R.cz).sub(u),E=new ln().fromArray([R.rotation[0],R.rotation[1],R.rotation[2],"ZXY"]);if(R.windowType===Ci.Polygonal){const[N,U]=R.polygonTop??Gp,[W,k,D]=[H.x/2,H.y/2,N*H.x],L=SG(W,k,D,U),j=new ls(new N9([L],{steps:1,depth:H.z,bevelEnabled:!1})),B=new ae(0,0,-H.z).applyEuler(E);return j.position.copy(F.clone().add(B)),j.rotation.copy(E),j.updateMatrix(),j}else if(R.windowType===Ci.Arched){const N=bG(H.x,H.y,R.archHeight),U=new ls(new N9([N],{steps:1,depth:H.z,bevelEnabled:!1})),W=new ae(0,0,-H.z).applyEuler(E);return U.position.copy(F.clone().add(W)),U.rotation.copy(E),U.updateMatrix(),U}else{const N=new ls(new n3(H.x,H.y,H.z));return N.position.copy(F),N.rotation.copy(E),N.updateMatrix(),N}}),[c,u]),C=v()??6,P=m.useMemo(()=>Array(C).fill(0),[C]);if(m.useEffect(()=>{v()},[]),!A&&!y)return null;function v(){if(!f.current||!A&&!y)return;const R=f.current.geometry;R.index=null,R.clearGroups();const H=[],F=[];let E=0,N=0;if(A){const j=p.slice(p.length/2);U(j),d?k():W(j),D(3);const B=p.slice(0,p.length/2).reverse();U(B),F.push(0,0,1,0,0,1),D(3),L([[0,1,4,3],[1,2,5,4],[2,0,3,5]])}else if(y){const j=p.slice(p.length/2),[B,O]=T(j);U(B),U(O);const[V,G,q,$]=j,ie=B[2].equals($);if(d)k(ie);else{const ee=new ae().subVectors(G,V),te=new ae().subVectors(q,V),oe=new ae().subVectors($,V),he=new Kt(G.x-V.x,G.y-V.y).length(),pe=he,me=0,le=ee.dot(te)/he,Te=ee.clone().cross(te).length()/he,ge=ee.dot(oe)/he,Se=ee.clone().cross(oe).length()/he;ie?(F.push(0,0,pe,me,ge,Se),F.push(pe,me,le,Te,ge,Se)):(F.push(0,0,pe,me,le,Te),F.push(0,0,le,Te,ge,Se))}D(6);const Q=p.slice(0,p.length/2),[se,Z]=T(Q);U(se.reverse()),U(Z.reverse()),F.push(0,0,1,0,0,1),F.push(0,1,1,0,1,1),D(6),L([[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]])}else throw new Error("segment is neither quad nor tri");if(R.setAttribute("position",new gr(H,3)),R.setAttribute("uv",new gr(F,2)),R.computeVertexNormals(),R.computeBoundingSphere(),c.length>0){const j=[];for(let O=0;OQ.concat(p[se].x,p[se].y,p[se].z),[]),ie=[q,V,G].reduce((Q,se)=>Q.concat(p[se].x,p[se].y,p[se].z),[]);H.push(...$),H.push(...ie),F.push(0,0,1,0,0,1),F.push(0,1,1,0,1,1),D(6)}}}function T(R){const[H,F,E,N]=R,U=ye.distanceFromPointToLine2D(N,H,F),W=ye.distanceFromPointToLine2D(E,H,F),k=[],D=[];return Math.abs(U-W)<.01?H.z>F.z?(k.push(H,F,E),D.push(H,E,N)):(k.push(H,F,N),D.push(F,E,N)):U<=W?(k.push(H,F,N),D.push(F,E,N)):(k.push(H,F,E),D.push(H,E,N)),[k,D]}const w=({i:R})=>h.jsx("meshBasicMaterial",{attach:`material-${R}`,map:g,transparent:l,opacity:s}),x=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:o,map:g,transparent:l,opacity:s}),b=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:r,transparent:l,opacity:s});return h.jsx("mesh",{ref:f,name:`Buffer Roof Segment ${e}`,uuid:t+"-"+e,userData:{simulation:!0},receiveShadow:!d,castShadow:!0,frustumCulled:!1,children:P.map((R,H)=>H!==0?h.jsx(b,{i:H},"side"+H):d?h.jsx(w,{i:H},"heatmap"+H):h.jsx(x,{i:H},"texture"+H))})}),u$=be.memo(Jxt),Kxt=({cz:t,points:e})=>{const n=new kl;n.moveTo(e[0].x,e[0].y);for(const{x:o,y:r}of e)n.lineTo(o,r);return n.closePath(),h.jsx(aw,{scale:.99,position:[0,0,t],args:[n,{steps:1,depth:.1,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{side:ti,color:"white"})})},zW=be.memo(Kxt);function cy(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;oM(e=>e.selectedElementIdSet.has(t)&&!e.groupActionMode),$t=()=>{const t=M(m0);return m.useMemo(()=>({lng:t}),[t])},u1=t=>M.getState().getWeather(t??"Boston MA, USA"),Iwe=new ae,zwe=new ln,mY=new ae,qxt=new ae(0,0,1),$xt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ae(0,0,e);for(let l=0;l{const[c,u,d]=l.points,f=Math.abs(c.z)<.015,p=[c.clone().sub(i),c];return f||p.push(d),h.jsx(Gn,{points:p,lineWidth:n,color:o},s)})]})]})}),Qxt=({roofModel:t,foundationModel:e})=>{let{cx:n,cy:o,lz:r,id:i,wallsId:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineWidth:f=.2,lineColor:p="black",roofType:g,foundationId:A,rise:y=r,ceiling:S=!1}=t;const C=eM(l),P=Tc(i);[p,f]=bn.getWireframetStyle(p,f,P,d);const v=M(pn),T=M(Ap),{camera:w,gl:x}=ri(),b=m.useMemo(()=>new l0,[]),R=m.useMemo(()=>new Kt,[]),[H,F]=m.useState(!1),E=m.useRef(null),N=m.useRef(!1),U=m.useRef(y),W=new Set(a),k=Ie=>{R.x=Ie.offsetX/x.domElement.clientWidth*2-1,R.y=-(Ie.offsetY/x.domElement.clientHeight)*2+1,b.setFromCamera(R,w)},D=Ie=>{const Me=[],ze=Ie.length;for(const Ne of Ie)Ne.leftPoint[0]!==void 0&&Ne.leftPoint[1]!==void 0&&Me.push({x:Ne.leftPoint[0],y:Ne.leftPoint[1]});return O.current||(Ie[ze-1].rightPoint[0]||Ie[ze-1].rightPoint[0]===0)&&(Ie[ze-1].rightPoint[1]||Ie[ze-1].rightPoint[1]===0)&&Me.push({x:Ie[ze-1].rightPoint[0],y:Ie[ze-1].rightPoint[1]}),Me},L=(Ie,Me)=>{if(Ie.length!==Me.size)return!0;for(const ze of Ie)if(!Me.has(ze.id))return!0;return!1},j=()=>{let Ie=1/0;for(let Me=0;Me{if(B.length<2)return{x:0,y:0};const Ie=D(B);if(Ie.length<3)return{x:0,y:0};const Me=ye.calculatePolygonCentroid(Ie);return Number.isNaN(Me.x)||Number.isNaN(Me.y)?{x:0,y:0}:Me},[B,G]),$=m.useMemo(()=>new ae(q.x,q.y,G),[q,G]),ie=m.useMemo(()=>{const Ie=B.map(Me=>bn.getWallNormal(Me).multiplyScalar(Me.eavesLength??0));if(!O.current&&Ie.length!==0){const Me=new ae().subVectors(new ae(B[B.length-1].rightPoint[0],B[B.length-1].rightPoint[1]),new ae(B[0].leftPoint[0],B[0].leftPoint[1])).applyEuler(AG).normalize().multiplyScalar(.3);Ie.push(Me)}return Ie},[B]),Q=m.useMemo(()=>{const Ie=B.map((Me,ze)=>({leftPoint:new ae(Me.leftPoint[0],Me.leftPoint[1]).add(ie[ze]),rightPoint:new ae(Me.rightPoint[0],Me.rightPoint[1]).add(ie[ze])}));return!O.current&&Ie.length!==0&&Ie.push({leftPoint:new ae(B[B.length-1].rightPoint[0],B[B.length-1].rightPoint[1]).add(ie[ie.length-1]),rightPoint:new ae(B[0].leftPoint[0],B[0].leftPoint[1]).add(ie[ie.length-1])}),Ie},[B,ie]),se=m.useMemo(()=>qxt.clone().multiplyScalar(u),[u]),Z=m.useMemo(()=>{const Ie=[];if(B.length<2)return Ie;const Me=j();for(let ze=0;ze0&&Ne.rightPoint.length>0&&(Ne.leftPoint[0]!==Ne.rightPoint[0]||Ne.leftPoint[1]!==Ne.rightPoint[1])){const Je=[];let{lh:Ue,rh:nt}=bn.getWallHeight(B,ze);O.current||(ze===0&&(Ue=B[0].lz),ze===B.length-1&&(nt=B[B.length-1].lz));const We=bn.getIntersectionPoint(Q[(ze+Q.length-1)%Q.length].leftPoint,Q[(ze+Q.length-1)%Q.length].rightPoint,Q[ze].leftPoint,Q[ze].rightPoint).setZ(Ue-Me).sub($),Ee=bn.getIntersectionPoint(Q[ze].leftPoint,Q[ze].rightPoint,Q[(ze+1)%Q.length].leftPoint,Q[(ze+1)%Q.length].rightPoint).setZ(nt-Me).sub($),ke=new ae(Ne.cx,Ne.cy).sub($.clone().setZ(0)).length();Je.push(We,Ee,mY),Je.push(We.clone().add(se),Ee.clone().add(se),mY.clone().add(se)),Ie.push({points:Je,angle:-Ne.relativeAngle,length:ke})}}if(!O.current){const ze=Q.length-1,Ne=bn.getIntersectionPoint(Q[ze-1].leftPoint,Q[ze-1].rightPoint,Q[ze].leftPoint,Q[ze].rightPoint).setZ(B[B.length-1].lz-Me).sub($),Je=bn.getIntersectionPoint(Q[ze].leftPoint,Q[ze].rightPoint,Q[0].leftPoint,Q[0].rightPoint).setZ(B[0].lz-Me).sub($);let Ue=Math.atan2(Je.y-Ne.y,Je.x-Ne.x);Ue=Ue>=0?Ue:(sa+Ue)%sa;const nt=new ae().addVectors(Ne,Je).setZ(0).divideScalar(2).length(),We=[];We.push(Ne,Je,mY),We.push(Ne.clone().add(se),Je.clone().add(se),mY.clone().add(se)),Ie.push({points:We,angle:-Ue,length:nt})}return Ie},[B,q,u]),ee=m.useMemo(()=>{const Ie=[];if(B.length===0)return Ie;Ie.push(new ae().fromArray(B[0].leftPoint));for(const Me of B)Ie.push(new ae().fromArray(Me.rightPoint));return Ie},[B]);let te=0;if(e){n=e.cx,o=e.cy,te=e.rotation[2];const Ie=-Math.atan2(w.position.x-n,w.position.y-o)-te;Iwe.set(q.x,q.y,G),zwe.set(-Qt,0,Ie,"ZXY")}const oe=EQ();m.useEffect(()=>{if(oe)return;if(M.getState().addedRoofIdSet.has(i)&&B.length>=2&&L(B,W)){const Me=B.map(Ne=>Ne.id),ze=new Set(Me);v(Ne=>{for(const Je of Ne.elements)if(Je.type===z.Roof)Je.id===i&&(Je.wallsId=Me);else if(Je.type===z.Wall&&W.has(Je.id)&&!ze.has(Je.id)){const Ue=Je;Ue.roofId=null,Ue.leftRoofHeight=void 0,Ue.rightRoofHeight=void 0}}),M.getState().deleteAddedRoofId(i)}},[W]),m.useEffect(()=>{if(B.length>1){if(M.getState().addedRoofIdSet.has(i)){for(let Me=0;Me{for(const Ne of ze.elements)if(Ne.id===B[Me].id&&Ne.type===z.Wall){const Je=Ne;Je.roofId=i,Je.leftRoofHeight=void 0,Je.rightRoofHeight=void 0;break}});M.getState().deleteAddedRoofId(i)}}else T(i,!1,!1,!0)},[B]),Oye(e,i,Z,$,G,u);const de=()=>{if(B.length<2)return!1;const Ie=B[0].lz;for(const Me of B)if(Math.abs(Me.lz-Ie)>.01)return!1;for(const Me of Z){const[ze,Ne]=Me.points;if(Math.abs(ze.z)>.01||Math.abs(Ne.z)>.01)return!1}return!0},[he,pe]=m.useState(de);m.useEffect(()=>{pe(de())},[B,G]);const me=dt(hs),le=M(Pf),Te=Cn(c1),[ge,Se]=m.useState([]),[Re,De]=m.useState(null),Ae=M(pu),ue=fN(i,$,Z,he,Go.Pyramid);m.useEffect(()=>{if(me)if(he){const Ie=Te(i);if(Ie){const Me=ye.fetchHeatmapTexture(Ie,le??5);if(Me){const ze=ue();if(ze&&ze.length>0&&e){const Ne=new ln(0,0,e.rotation[2],"ZYX");let Je=Number.MAX_VALUE,Ue=Number.MAX_VALUE,nt=-Number.MAX_VALUE,We=-Number.MAX_VALUE;for(const xt of ze)for(const gt of xt){const Ye=gt.clone().applyEuler(Ne);Ye.x>nt&&(nt=Ye.x),Ye.xWe&&(We=Ye.y),Ye.y0){const Me=[];if(ue()){for(let Ne=0;Ne{const Ie=[];for(let Me=0;Me0&&ze.rightPoint.length>0&&(ze.leftPoint[0]!==ze.rightPoint[0]||ze.leftPoint[1]!==ze.rightPoint[1])){let{lh:Ne,rh:Je}=bn.getWallHeight(B,Me);O.current||(Me===0&&(Ne=B[0].lz),Me===B.length-1&&(Je=B[B.length-1].lz));const Ue=new ae(ze.leftPoint[0],ze.leftPoint[1],Ne),nt=new ae(ze.rightPoint[0],ze.rightPoint[1],Je);Ie.push([Ue,nt,$.clone()])}}if(!O.current){const Me=B[0],ze=B[B.length-1],Ne=new ae(ze.rightPoint[0],ze.rightPoint[1],ze.lz),Je=new ae(Me.leftPoint[0],Me.leftPoint[1],Me.lz);Ie.push([Ne,Je,$.clone()])}if(he){const Me=[];for(const ze of Ie)Me.push(ze[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(i,[Me])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(i,Ie)});const ve=M(Ie=>Ie.elements.filter(Me=>Me.parentId===i&&Me.type===z.Window),cy),we=gN(i,e,$,Z),Pe=l===Ur.Default||l===Ur.NoTexture?s:"white";return h.jsxs("group",{name:`Pyramid Roof Group ${i}`,children:[h.jsx("group",{name:`Pyramid Roof Segments Group ${i}`,userData:we,position:[q.x,q.y,G],onPointerDown:Ie=>{cN(Ie,e.id,i,Z,$)},onPointerMove:Ie=>{dN(Ie,i)},onPointerUp:Ie=>{uN(Ie,t)},onContextMenu:Ie=>{CR(Ie,i)},children:he?h.jsx(FQ,{id:i,foundationModel:e,roofType:g,roofSegments:Z,center:$,thickness:u,lineWidth:f,lineColor:p,sideColor:c,color:Pe,textureType:l,heatmap:Re}):h.jsxs(h.Fragment,{children:[Z.map((Ie,Me)=>{const{points:ze}=Ie;if(ze.length>0){const[Ne,Je]=ze;if(Ne.distanceTo(Je)>.1)return h.jsx("group",{name:`Roof segment ${Me}`,children:h.jsx(u$,{id:i,index:Me,foundationModel:e,roofType:g,segment:Ie,centroid:$,thickness:u,color:Pe,sideColor:c,texture:C,heatmap:ge&&Me0&&h.jsx(zW,{points:ee,cz:B[0].lz}),P&&!d&&h.jsx(th,{position:[q.x,q.y,G+u+.15],onPointerDown:Ie=>{Ae(t.id,Ie,Xo.Select),F(!0),kn.getState().setEnableOrbitController(!1),N.current=!0,U.current=y,v(Me=>{Me.resizeHandleType=Mt.Top,Me.selectedElementHeight=G+t.thickness})},onPointerUp:()=>{F(!1),kn.getState().setEnableOrbitController(!0)},onPointerOver:()=>{v(Ie=>{Ie.hoveredHandle=Lr.Top,Ie.selectedElementHeight=G+t.thickness,Ie.selectedElementX=q.x,Ie.selectedElementY=q.y})}}),H&&h.jsx(ta,{name:"Roof Intersection Plane",ref:E,args:[1e3,100],visible:!1,rotation:zwe,position:Iwe,onPointerMove:Ie=>{if(E.current&&N.current&&e){k(Ie);const Me=b.intersectObjects([E.current]);if(Me[0]){const ze=Me[0].point;if(ze.z<.001)return;const Ne=Math.max(0,ze.z-e.lz-.3-V);M.getState().updateRoofRiseById(i,Ne,G+t.thickness)}}},onPointerUp:Ie=>{sN(i,U.current,y),F(!1),kn.getState().setEnableOrbitController(!0),N.current=!1}})]})},Zxt=be.memo(Qxt,ZH),ebt=(t,e,n)=>{const{left:o,right:r,center:i,centerLeft:a,centerRight:l}=n,[s,c]=[t/2,e/2],u=[{x:-s,y:o-c},{x:-s,y:-c},{x:s,y:-c},{x:s,y:r-c}];if(l){const[d,f]=l;u.push({x:d*t,y:f-c})}if(i){const[d,f]=i;u.push({x:d*t,y:f-c})}if(a){const[d,f]=a;u.push({x:d*t,y:f-c})}return u},o9=(t,e)=>{for(const n of M.getState().elements)if(n.type===z.Wall&&n.foundationId===e&&t.has(n.id)){const o=t.get(n.id);if(o){const r=n,i=ebt(r.lx,r.lz,o);for(const a of M.getState().elements)if(a.parentId===r.id){let{cx:l,cz:s,lx:c,ly:u,lz:d}=a;if(l*=r.lx,s*=r.lz,a.type!==z.SolarPanel?(c*=r.lx,d*=r.lz):d=u,a.type===z.Window&&a.windowType===Ci.Polygonal){const[f,p]=a.polygonTop??Gp,g=l+f*c,A=s+d/2+p;if(!ye.isPointInside(g,A,i))return!1}if(!ye.isElementInsideWall(new ae(l,0,s),c,d,i,a.type===z.Door))return!1}}}return!0},tbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ae(0,0,e),a=t[0].points,l=t[1].points,s=t[2].points,c=t[3].points;r.push(l[3],l[0],a[0],a[1],a[2],l[2],s[0],c[0],c[1],s[1],l[3]);const u=Math.abs(a[0].z)<.15,d=h.jsx(Gn,{points:r,lineWidth:n,color:o}),f=h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[l[0],l[1]],lineWidth:n,color:o}),h.jsx(Gn,{points:[l[2],l[3]],lineWidth:n,color:o}),h.jsx(Gn,{points:[s[2],s[3]],lineWidth:n,color:o})]});return h.jsxs(h.Fragment,{children:[d,!u&&f,h.jsxs("group",{position:[0,0,e],children:[d,!u&&f]}),h.jsx(Gn,{points:[a[0],a[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[a[1],a[1].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[c[0],c[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[c[1],c[1].clone().add(i)],lineWidth:n,color:o})]})}),zre=new ae,Dre=new ln,Dwe=new Kt,nbt=new ae(0,0,1),obt=({roofModel:t,foundationModel:e})=>{let{id:n,cx:o,cy:r,lz:i,wallsId:a,parentId:l,topRidgeLeftPoint:s,frontRidgeLeftPoint:c,backRidgeLeftPoint:u,topRidgePoint:d,frontRidgePoint:f,backRidgePoint:p,textureType:g,color:A="white",sideColor:y="white",thickness:S=.2,locked:C,lineColor:P="black",lineWidth:v=.2,roofType:T,rise:w=i,ceiling:x=!1}=t;d===void 0&&(d=s?[...s]:[0,1]),f===void 0&&(f=c?[...c]:[.35,.5]),p===void 0&&(p=u?[...u]:[.35,.5]);const b=Tc(n);[P,v]=bn.getWireframetStyle(P,v,b,C);const R=M(pn),H=M(Ap),F=eM(g),[E,N]=m.useState(Lr.Null),[U,W]=m.useState(!1),k=m.useRef(null),{gl:D,camera:L}=ri(),j=m.useMemo(()=>new l0,[]),B=m.useMemo(()=>new Kt,[]),O=m.useRef([0,0]),V=m.useRef(w),G=m.useRef(!1),q=w<.01,$=(Ze,Be,$e)=>{R(wt=>{for(const vt of wt.elements)if(vt.id===Ze&&vt.type===z.Roof&&vt.roofType===Go.Gambrel){const Rt=vt;switch(Be){case Lr.FrontLeft:case Lr.FrontRight:Rt.frontRidgePoint=[...$e];break;case Lr.TopLeft:case Lr.TopRight:Rt.topRidgePoint=[...$e];break;case Lr.BackLeft:case Lr.BackRight:Rt.backRidgePoint=[...$e];break}break}})},ie=(Ze,Be,$e,wt)=>{const vt={name:"Resize Gambrel Roof Ridge",timestamp:Date.now(),resizedElementId:Ze,resizedElementType:z.Roof,oldVal:[...$e],newVal:[...wt],type:Be,undo:()=>{$(vt.resizedElementId,vt.type,vt.oldVal)},redo:()=>{$(vt.resizedElementId,vt.type,vt.newVal)}};M.getState().addUndoable(vt)},Q=Ze=>{B.x=Ze.offsetX/D.domElement.clientWidth*2-1,B.y=-(Ze.offsetY/D.domElement.clientHeight)*2+1,j.setFromCamera(B,L)},se=(Ze,Be)=>{W(!0),kn.getState().setEnableOrbitController(!1),zre.set(Ze.x,Ze.y,Ze.z).add(Ae),e&&Be&&Dre.set(Qt,0,Be.relativeAngle,"ZXY")},Z=(Ze,Be,$e)=>{const wt=new Kt(Ze.cx,Ze.cy),vt=bn.getComposedWallCenter(Be),Rt=bn.getComposedWallLength(Be),Gt=new Kt(vt.x,vt.y).rotateAround(Dwe,Ze.rotation[2]).add(wt),At=Ze.rotation[2]+Be.relativeAngle,Wt=new Kt($e.x,$e.y).sub(Gt).rotateAround(Dwe,-At).x/Rt;return Math.min(Math.abs(Wt),.5)*(Wt>=0?1:-1)},ee=(Ze,Be,$e,wt)=>{if(!Ze)return new ae;const vt=bn.getComposedWallLength(Ze),Rt=new ln(0,0,Ze.relativeAngle),Gt=new ae(Be*vt,0,0);let At=De;wt&&(At=$e*(De-wt.lz)+wt.lz);const pt=bn.getComposedWallCenter(Ze);return new ae(pt.x,pt.y,At).add(Gt.applyEuler(Rt))},te=(Ze,Be)=>{const $e=Ze[Be];let wt,vt;return Be===0||Be===2?(wt=$e.lz,vt=$e.lz):Be===1?(wt=Ze[0].lz,vt=Ze[2].lz):(wt=Ze[2].lz,vt=Ze[0].lz),{lh:wt,rh:vt}},oe=Ze=>Ze.id===n&&Ze.type===z.Roof&&Ze.roofType===Go.Gambrel,de=(Ze,Be)=>{const $e=Be.x-Ze.x,vt=(Be.y-Ze.y)/$e,Rt=Ze.y-vt*Ze.x;return{start:Ze.x,end:Be.x,k:vt,b:Rt}},he=(Ze,Be,$e,wt,vt,Rt,Gt,At)=>{const pt=Ze[Be],{lh:Wt,rh:ht}=te(Ze,Be),ct=new ae().subVectors(pt.leftPoint,pt.rightPoint).length(),It=ct/2,Ft=rt=>rt*ct+It,Ve=(rt,at)=>rt*($e-at)+at,ft=[new Kt(Ft(-Rt[0]),Ve(Rt[1],wt)),new Kt(Ft(Gt[0]),$e),new Kt(Ft(At[0]),Ve(At[1],vt)),new Kt(ct,ht)];return ft.map((rt,at)=>{const Ge=at===0?new Kt(0,Wt):ft[at-1];return de(Ge,rt)})},pe=(Ze,Be)=>{for(const $e of Ze){const{start:wt,end:vt,k:Rt,b:Gt}=$e;if(Be>=wt&&Be<=vt)return Rt*Be+Gt}return null},me=Ze=>{const Be=new Set;for(const $e of Ze)$e.wallsId.forEach(wt=>Be.add(wt));R($e=>{for(const wt of $e.elements)if(wt.type===z.Wall&&wt.foundationId===l&&Be.has(wt.id)){const vt=wt;vt.leftRoofHeight=De,vt.rightRoofHeight=De,vt.centerLeftRoofHeight=void 0,vt.centerRightRoofHeight=void 0,vt.centerRoofHeight=void 0}})},le=(Ze,Be,$e,wt,vt,Rt,Gt)=>{if($e!==1&&$e!==3)return;const At=$e===3,{lh:pt,rh:Wt}=te(Be,$e),ht=At?Gt:vt,ct=At?vt:Gt,It=At?Rt:[-Rt[0],Rt[1]],Ft=he(Be,$e,wt,pt,Wt,ht,It,ct),Ve=Ft.slice(1).map(rt=>rt.start),ft=Be[$e],kt=ft.wallsId.reduce((rt,at)=>{const Ge=M.getState().elements.find(yt=>yt.id===at);return Ge?[...rt,Ge.lx+rt[rt.length-1]]:rt},[0]);for(let rt=0;rt=Ge&&Ht<=yt){const _t=(Ht-zt)/bt,qt=pe(Ft,Ht);qt!==null&&(tt===0?Bt.centerLeft=[_t,qt]:tt===1?Bt.center=[_t,qt]:tt===2&&(Bt.centerRight=[_t,qt]))}}Ze.set(at,Bt)}}return Ze},Te=(Ze,Be,$e,wt,vt)=>{const Rt=new Map;return le(Rt,Ze,1,Be,$e,wt,vt),le(Rt,Ze,3,Be,$e,wt,vt),Rt},ge=(Ze,Be,$e,wt,vt)=>{const Rt=new Set(Ze[0].wallsId),Gt=new Set(Ze[2].wallsId),At=Te(Ze,Be,$e,wt,vt);R(pt=>{for(const Wt of pt.elements)if(Wt.type===z.Wall&&Wt.foundationId===l){if(Rt.has(Wt.id)){const ht=Wt,{lh:ct,rh:It}=te(Ze,0);ht.roofId=n,ht.leftRoofHeight=ct,ht.rightRoofHeight=It}else if(Gt.has(Wt.id)){const ht=Wt,{lh:ct,rh:It}=te(Ze,2);ht.roofId=n,ht.leftRoofHeight=ct,ht.rightRoofHeight=It}else if(At.has(Wt.id)){const ht=At.get(Wt.id);if(ht){const ct=Wt,{left:It,right:Ft,center:Ve,centerLeft:ft,centerRight:kt}=ht;if(ct.roofId=n,ct.leftRoofHeight=It,ct.rightRoofHeight=Ft,ft){const[rt,at]=ft;ct.centerLeftRoofHeight?(ct.centerLeftRoofHeight[0]=rt,ct.centerLeftRoofHeight[1]=at):ct.centerLeftRoofHeight=[rt,at]}else ct.centerLeftRoofHeight=void 0;if(Ve){const[rt,at]=Ve;ct.centerRoofHeight?(ct.centerRoofHeight[0]=rt,ct.centerRoofHeight[1]=at):ct.centerRoofHeight=[rt,at]}else ct.centerRoofHeight=void 0;if(kt){const[rt,at]=kt;ct.centerRightRoofHeight?(ct.centerRightRoofHeight[0]=rt,ct.centerRightRoofHeight[1]=at):ct.centerRightRoofHeight=[rt,at]}else ct.centerRightRoofHeight=void 0}}}})},Se=jye(a[0],l),{highestWallHeight:Re,topZ:De}=Bye(Se,w,!0);pN(t,Re);const Ae=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se.map($e=>({x:$e.leftPoint.x,y:$e.leftPoint.y})),Be=ye.calculatePolygonCentroid(Ze);return new ae(Be.x,Be.y,De)},[Se,De]),ue=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[3],[Be,$e]=d;return ee(Ze,Be,$e).sub(Ae)},[Se,Ae,d]),fe=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[1],[Be,$e]=d;return ee(Ze,-Be,$e).sub(Ae)},[Se,Ae,d]),ve=m.useMemo(()=>new ae().addVectors(ue,fe).divideScalar(2),[ue,fe]),we=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[3],[Be,$e]=f;return ee(Ze,Be,$e,Se[0]).sub(Ae)},[Se,Ae,f]),Pe=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[1],[Be,$e]=f;return ee(Ze,-Be,$e,Se[0]).sub(Ae)},[Se,Ae,f]),Ie=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[1],[Be,$e]=p;return ee(Ze,Be,$e,Se[2]).sub(Ae)},[Se,Ae,p]),Me=m.useMemo(()=>{if(!Se||Se.length!==4)return new ae;const Ze=Se[3],[Be,$e]=p;return ee(Ze,-Be,$e,Se[2]).sub(Ae)},[Se,Ae,p]),ze=m.useMemo(()=>!Se||Se.length!==4?[]:Se.map(Ze=>bn.getComposedWallNormal(Ze).multiplyScalar(Ze.eavesLength)),[Se]),Ne=m.useMemo(()=>nbt.clone().multiplyScalar(S),[S]),Je=m.useMemo(()=>{const Ze=[];if(!Se||Se.length!==4)return Ze;const[Be,$e,wt,vt]=Se,[Rt,Gt,At,pt]=ze,Wt=Be.leftPoint,ht=Be.rightPoint,ct=wt.leftPoint,It=wt.rightPoint,Ft=Wt.clone().add(Rt),Ve=ht.clone().add(Rt),ft=It.clone().add(pt),kt=Wt.clone().add(pt),rt=ht.clone().add(Gt),at=ct.clone().add(Gt),Ge=ct.clone().add(At),yt=It.clone().add(At),Pt=[],{lh:ot,rh:bt}=te(Se,0),zt=bn.getDistance(Wt,ht,we.clone().add(Ae)),Bt=Math.min((Be.eavesLength??0)/zt*(we.clone().add(Ae).z-ot),ot),tt=bn.getDistance(Wt,ht,Pe.clone().add(Ae)),Ht=Math.min((Be.eavesLength??0)/tt*(Pe.clone().add(Ae).z-bt),bt),_t=bn.getIntersectionPoint(ft,kt,Ft,Ve).setZ(ot-Bt).sub(Ae),qt=bn.getIntersectionPoint(Ft,Ve,rt,at).setZ(bt-Ht).sub(Ae),un=bn.getIntersectionPoint(we,Pe,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(we.z),Rn=bn.getIntersectionPoint(Pe,we,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(Pe.z);Pt.push(_t,qt,Rn,un),Pt.push(_t.clone().add(Ne),qt.clone().add(Ne),Rn.clone().add(Ne),un.clone().add(Ne));const yo=bn.getComposedWallCenter(Be),Ao=-Be.relativeAngle,wo=new ae(yo.x,yo.y).sub(ve.clone().setZ(0)).length();Ze.push({points:Pt,angle:Ao,length:wo});const Io=[],po=bn.getIntersectionPoint(ue,fe,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(ue.z),On=bn.getIntersectionPoint(ue,fe,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(fe.z);Io.push(un,Rn,On,po),Io.push(un.clone().add(Ne),Rn.clone().add(Ne),On.clone().add(Ne),po.clone().add(Ne)),Ze.push({points:Io,angle:Ao,length:wo});const fo=-wt.relativeAngle,{lh:ir,rh:Rr}=te(Se,2),br=bn.getDistance(ct,It,Ie.clone().add(Ae)),_r=Math.min((wt.eavesLength??0)/br*(Ie.clone().add(Ae).z-ir),ir),jo=bn.getDistance(ct,It,Me.clone().add(Ae)),wn=Math.min((wt.eavesLength??0)/jo*(Me.clone().add(Ae).z-Rr),Rr),In=bn.getIntersectionPoint(rt,at,Ge,yt).setZ(ir-_r).sub(Ae),ar=bn.getIntersectionPoint(Ge,yt,ft,kt).setZ(Rr-wn).sub(Ae),Wo=bn.getIntersectionPoint(Ie,Me,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(Me.z),to=bn.getIntersectionPoint(Me,Ie,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(Me.z),Bn=bn.getComposedWallCenter(wt),Ko=new ae(Bn.x,Bn.y).sub(ve.clone().setZ(0)).length(),So=[];So.push(Wo,to,po,On),So.push(Wo.clone().add(Ne),to.clone().add(Ne),po.clone().add(Ne),On.clone().add(Ne)),Ze.push({points:So,angle:fo,length:Ko});const Qo=[];return Qo.push(In,ar,to,Wo),Qo.push(In.clone().add(Ne),ar.clone().add(Ne),to.clone().add(Ne),Wo.clone().add(Ne)),Ze.push({points:Qo,angle:fo,length:Ko}),Ze},[Se,De,S,d,f,p]),Ue=m.useMemo(()=>!Se||Se.length!==4?null:Se.map(Ze=>Ze.leftPoint),[Se]);m.useEffect(()=>{(!Se||Se.length!==4)&&H(n,!1,!1,!0)},[Se]);const nt=EQ();m.useEffect(()=>{if((Se==null?void 0:Se.length)!==4)return;(M.getState().addedRoofIdSet.has(n)||!nt)&&(q?me(Se):ge(Se,De,f,d,p),DQ(e,n,Je,Ae,De,S,q),M.getState().deleteAddedRoofId(n))},[Je]),Yye(e,n,Je,Ae,De,S,q);const We=()=>{const Ze=[];if(!Se||Se.length!==4)return Ze;const Be=Se.map((pt,Wt,ht)=>new ae(pt.leftPoint.x,pt.leftPoint.y,te(ht,Wt).lh)),$e=we.clone().add(Ae),wt=Pe.clone().add(Ae),vt=Ie.clone().add(Ae),Rt=Me.clone().add(Ae),Gt=ue.clone().add(Ae),At=fe.clone().add(Ae);Ze.push([Be[0],Be[1],wt,$e]),Ze.push([$e,wt,At,Gt]),Ze.push([Gt,At,vt,Rt]),Ze.push([Be[2],Be[3],Rt,vt]),q?Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[Be]):Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,Ze)},Ee=fN(n,Ae,Je,q,Go.Gambrel);hN(We);const ke=M(Ze=>Ze.elements.filter(Be=>Be.parentId===n&&Be.type===z.Window),cy),Oe=M(pu),st=dt(hs),je=M(Pf),xt=Cn(c1),[gt,Ye]=m.useState(null),[it,ut]=m.useState([]);m.useEffect(()=>{if(st)if(q){const Ze=xt(n);if(Ze){const Be=ye.fetchHeatmapTexture(Ze,je??5);if(Be){const $e=Ee();if($e&&$e.length>0&&e){const wt=new ln(0,0,e.rotation[2],"ZYX");let vt=Number.MAX_VALUE,Rt=Number.MAX_VALUE,Gt=-Number.MAX_VALUE,At=-Number.MAX_VALUE;for(const Ft of $e)for(const Ve of Ft){const ft=Ve.clone().applyEuler(wt);ft.x>Gt&&(Gt=ft.x),ft.xAt&&(At=ft.y),ft.y0){const Be=[];for(let $e=0;$e{cN(Ze,e.id,n,Je,Ae)},onPointerMove:Ze=>{dN(Ze,n)},onPointerUp:Ze=>{uN(Ze,t)},onContextMenu:Ze=>{CR(Ze,n)},children:q?h.jsx(FQ,{id:n,foundationModel:e,roofType:T,roofSegments:Je,center:new ae(Ae.x,Ae.y,De),thickness:S,lineWidth:v,lineColor:P,sideColor:y,color:lt,textureType:g,heatmap:gt}):h.jsxs(h.Fragment,{children:[Je.map((Ze,Be,$e)=>h.jsx(u$,{id:n,index:Be,foundationModel:e,roofType:T,segment:Ze,centroid:Ae,thickness:S,color:lt,sideColor:y,texture:F,heatmap:it&&Be0&&Se[0].lz===Se[2].lz&&Ue&&h.jsx(zW,{cz:Se[0].lz,points:Ue}),b&&!C&&h.jsxs("group",{position:[Ae.x,Ae.y,Ae.z+S],children:[h.jsx(th,{position:[ve.x,ve.y,ve.z],onPointerDown:Ze=>{if(Oe(t.id,Ze,Xo.Select),G.current=!0,V.current=w,W(!0),zre.set(ve.x,ve.y,De).add(Ae),e){const Be=-Math.atan2(L.position.x-o,L.position.y-r)-e.rotation[2];Dre.set(-Qt,0,Be,"ZXY")}N(Lr.TopMid),kn.getState().setEnableOrbitController(!1),R(Be=>{Be.resizeHandleType=Mt.Top,Be.selectedElementHeight=De+t.thickness})},onPointerOver:()=>{R(Ze=>{Ze.hoveredHandle=Lr.TopMid,Ze.selectedElementHeight=De+t.thickness,Ze.selectedElementX=ve.x,Ze.selectedElementY=ve.y})}}),!q&&h.jsxs(h.Fragment,{children:[h.jsx(th,{position:[ue.x,ue.y,ue.z],onPointerDown:()=>{G.current=!0,O.current=[...d],se(ue,Se[3]),N(Lr.TopLeft)}}),h.jsx(th,{position:[fe.x,fe.y,fe.z],onPointerDown:()=>{G.current=!0,O.current=[...d],se(fe,Se[1]),N(Lr.TopRight)}}),h.jsx(th,{position:[we.x,we.y,we.z],onPointerDown:()=>{G.current=!0,O.current=[...f],se(we,Se[3]),N(Lr.FrontLeft)}}),h.jsx(th,{position:[Pe.x,Pe.y,Pe.z],onPointerDown:()=>{G.current=!0,O.current=[...f],se(Pe,Se[1]),N(Lr.FrontRight)}}),h.jsx(th,{position:[Ie.x,Ie.y,Ie.z],onPointerDown:()=>{G.current=!0,O.current=[...p],se(Ie,Se[1]),N(Lr.BackLeft)}}),h.jsx(th,{position:[Me.x,Me.y,Me.z],onPointerDown:()=>{G.current=!0,O.current=[...p],se(Me,Se[3]),N(Lr.BackRight)}})]})]}),U&&h.jsx(ta,{name:"Roof Intersection Plane",ref:k,args:[1e3,100],visible:!1,position:zre,rotation:Dre,onPointerMove:Ze=>{if(k.current&&G.current&&Se&&Se.length===4){Q(Ze);const Be=j.intersectObjects([k.current]);if(Be[0]&&e){const $e=Be[0].point;if($e.z<.001)return;switch(E){case Lr.TopMid:{const wt=Math.max(0,$e.z-e.lz-.3-Re),vt=Re+wt,Rt=Te(Se,vt,f,d,p);o9(Rt,l)&&M.getState().updateRoofRiseById(n,wt,vt+t.thickness);break}case Lr.FrontLeft:{if(e&&Se&&Se.length===4){const wt=ye.clamp(Z(e,Se[3],$e),d[0]+.05,.45),vt=De-Se[0].lz,Rt=ye.clamp(($e.z-e.lz-Se[0].lz)/vt,0,1),Gt=[wt,Rt],At=Te(Se,De,Gt,d,p);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>oe(ht));Wt&&(Wt.frontRidgePoint[0]=Gt[0],Wt.frontRidgePoint[1]=Gt[1])})}break}case Lr.FrontRight:{if(e&&Se&&Se.length===4){const wt=ye.clamp(Z(e,Se[1],$e),-.45,-d[0]-.05),vt=De-Se[0].lz,Rt=ye.clamp(($e.z-e.lz-Se[0].lz)/vt,0,1),Gt=[-wt,Rt],At=Te(Se,De,Gt,d,p);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>oe(ht));Wt&&(Wt.frontRidgePoint=[...Gt])})}break}case Lr.TopLeft:{if(e&&Se&&Se.length===4){const vt=[ye.clamp(Z(e,Se[3],$e),-p[0]+.05,f[0]-.05),d[1]],Rt=Te(Se,De,f,vt,p);o9(Rt,l)&&R(Gt=>{const At=Gt.elements.find(pt=>oe(pt));At&&(At.topRidgePoint=[...vt])})}break}case Lr.TopRight:{if(e&&Se&&Se.length===4){const vt=[-ye.clamp(Z(e,Se[1],$e),-f[0]+.05,p[0]-.05),d[1]],Rt=Te(Se,De,f,vt,p);o9(Rt,l)&&R(Gt=>{const At=Gt.elements.find(pt=>oe(pt));At&&(At.topRidgePoint=[...vt])})}break}case Lr.BackLeft:{if(e&&Se&&Se.length===4){const wt=ye.clamp(Z(e,Se[1],$e),-d[0]+.05,.45),vt=De-Se[2].lz,Rt=ye.clamp(($e.z-e.lz-Se[2].lz)/vt,0,1),Gt=[wt,Rt],At=Te(Se,De,f,d,Gt);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>oe(ht));Wt&&(Wt.backRidgePoint=[...Gt])})}break}case Lr.BackRight:{if(e&&Se&&Se.length===4){const wt=ye.clamp(Z(e,Se[3],$e),-.45,d[0]-.05),vt=De-Se[2].lz,Rt=ye.clamp(($e.z-e.lz-Se[2].lz)/vt,0,1),Gt=[-wt,Rt],At=Te(Se,De,f,d,Gt);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>oe(ht));Wt&&(Wt.backRidgePoint=[...Gt])})}break}}}}},onPointerUp:()=>{switch(E){case Lr.TopMid:{sN(n,V.current,w);break}case Lr.TopLeft:case Lr.TopRight:{ie(n,E,O.current,d);break}case Lr.FrontLeft:case Lr.FrontRight:{ie(n,E,O.current,f);break}case Lr.BackLeft:case Lr.BackRight:{ie(n,E,O.current,p);break}}G.current=!1,W(!1),N(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},rbt=be.memo(obt,ZH),yY=new ae,AY=new ln,Ewe=new Kt,ibt=new ae(0,0,1),Dz=be.memo(({start:t,end:e,width:n,height:o,offset:r,color:i})=>{const a=m.useMemo(()=>new Kt(t.x,t.y),[t]),l=m.useMemo(()=>new Kt(e.x,e.y),[e]),s=m.useMemo(()=>new Kt().subVectors(l,a).angle(),[a,l]),c=m.useMemo(()=>{const u=new kl,d=a.distanceTo(l),f=t.z-e.z;return u.moveTo(0,0),u.lineTo(d,-f),u.lineTo(d,-f+o),u.lineTo(0,o),u.closePath(),u},[t,e,a,l,o]);return h.jsx("group",{position:r,children:h.jsx(aw,{args:[c,{steps:1,depth:n,bevelEnabled:!1}],position:t,rotation:[Qt,0,s,"ZXY"],castShadow:!0,receiveShadow:!0,children:h.jsx("meshStandardMaterial",{color:i})})})}),abt=({ridgeLeftPoint:t,ridgeRightPoint:e,wallArray:n,height:o,isShed:r,width:i,spacing:a,color:l})=>{const[s,c,u,d]=n,f=m.useMemo(()=>new ae().subVectors(e,t).normalize(),[]),p=m.useMemo(()=>t.clone().add(f.clone().multiplyScalar(-(d.eavesLength??0)/2)),[t,d.eavesLength]),g=m.useMemo(()=>e.clone().add(f.clone().multiplyScalar((c.eavesLength??0)/2)),[t,c.eavesLength]),A=s.leftPoint.clone().setZ(s.lz),y=u.rightPoint.clone().setZ(u.lz),S=m.useMemo(()=>{if(n.length<4)return[];const T=new ae().subVectors(new ae(s.rightPoint.x,s.rightPoint.y,s.lz),A).normalize(),w=new ae().subVectors(new ae(u.leftPoint.x,u.leftPoint.y,u.lz),y).normalize(),x=t.distanceTo(e),b=new ae().subVectors(s.leftPoint,s.rightPoint).length(),R=new ae().subVectors(u.leftPoint,u.rightPoint).length(),H=i,F=Math.floor((Math.min(x,b,R)-i)/a)+2;return new Array(F).fill(0).map((E,N)=>{let U;N===F-1?U=x:U=N*a+H;const W=t.clone().add(f.clone().multiplyScalar(U)),k=A.clone().add(T.clone().multiplyScalar(U)),D=y.clone().add(w.clone().multiplyScalar(U)),L=new ae().subVectors(k,W).normalize().multiplyScalar(s.eavesLength??0),j=new ae().subVectors(D,W).normalize().multiplyScalar(u.eavesLength??0);return k.add(L),D.add(j),{ridge:W,front:k,back:D}})},[a,t]),C=t.distanceTo(A)>t.distanceTo(y),P=new ae(-i,0,0),v=new ae(0,i/2,0);return h.jsxs(h.Fragment,{children:[S.map((T,w)=>h.jsx(be.Fragment,{children:r?C?h.jsx(Dz,{start:T.ridge,end:T.front,width:i,height:o,color:l}):h.jsx(Dz,{start:T.ridge,end:T.back,width:i,height:o,color:l}):h.jsxs(h.Fragment,{children:[h.jsx(Dz,{start:T.ridge,end:T.front,width:i,height:o,color:l}),h.jsx(Dz,{start:T.ridge,end:T.back,width:i,height:o,color:l,offset:P})]})},w)),h.jsx(Dz,{start:p,end:g,width:i,height:o,color:l,offset:v})]})},lbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ae(0,0,e),a=t.length===1;for(const f of t){const[p,g,A,y]=f.points;r.push(y,p,g,A),a&&r.push(y)}const l=Math.abs(t[0].points[0].z)<.015,s=t[0].points[3],c=t[0].points[2],u=h.jsx(Gn,{points:r,lineWidth:n,color:o}),d=h.jsx(Gn,{points:[s,c],lineWidth:n,color:o});return h.jsxs(h.Fragment,{children:[u,!l&&!a&&d,h.jsxs("group",{position:[0,0,e],children:[u,!l&&!a&&d]}),t.map((f,p)=>{const[g,A,y,S]=f.points;return h.jsxs("group",{children:[h.jsx(Gn,{points:[g,g.clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[A,A.clone().add(i)],lineWidth:n,color:o}),a&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[y,y.clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[S,S.clone().add(i)],lineWidth:n,color:o})]})]},p)})]})}),sbt=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,wallsId:r,lz:i,rise:a=i,thickness:l=.2,ridgeLeftPoint:s,ridgeRightPoint:c,textureType:u,color:d="white",sideColor:f="white",locked:p,lineColor:g="black",lineWidth:A=.2,roofStructure:y,rafterSpacing:S=2,rafterWidth:C=.1,rafterColor:P="white",glassTint:v="#73D8FF",opacity:T=.5,ceiling:w=!1}=t;const x=M(pn),b=M(Ap),R=Tc(n);[g,A]=bn.getWireframetStyle(g,A,R,p);const{gl:H,camera:F}=ri(),E=m.useMemo(()=>new l0,[]),N=m.useMemo(()=>new Kt,[]),[U,W]=m.useState(!1),[k,D]=m.useState(Lr.Null),L=Math.abs(s[0])>.45,j=m.useRef(null),B=m.useRef(s[0]),O=m.useRef(c[0]),V=m.useRef(a),G=m.useRef(!1),q=(Ee,ke,Oe)=>{x(st=>{for(const je of st.elements)if(je.id===Ee&&je.type===z.Roof&&je.roofType===Go.Gable){je.ridgeLeftPoint[0]=ke,je.ridgeRightPoint[0]=Oe;break}})},$=(Ee,ke,Oe,st,je)=>{const xt={name:"Resize Gable Roof Ridge",timestamp:Date.now(),resizedElementId:Ee,resizedElementType:z.Roof,oldLeft:ke,oldRight:Oe,newLeft:st,newRight:je,undo:()=>{q(xt.resizedElementId,ke,Oe)},redo:()=>{q(xt.resizedElementId,st,je)}};M.getState().addUndoable(xt)},ie=Ee=>{N.x=Ee.offsetX/H.domElement.clientWidth*2-1,N.y=-(Ee.offsetY/H.domElement.clientHeight)*2+1,E.setFromCamera(N,F)},Q=(Ee,ke,Oe)=>{const st=new Kt(Ee.cx,Ee.cy),je=new ae().addVectors(ke.leftPoint,ke.rightPoint).divideScalar(2),xt=new ae().subVectors(ke.leftPoint,ke.rightPoint).length(),gt=new Kt(je.x,je.y).rotateAround(Ewe,Ee.rotation[2]).add(st),Ye=Ee.rotation[2]+ke.relativeAngle,ut=new Kt(Oe.x,Oe.y).sub(gt).rotateAround(Ewe,-Ye).x/xt;return Math.min(Math.abs(ut),.5)*(ut>=0?1:-1)},se=(Ee,ke,Oe)=>{if(!Ee)return new ae;const st=new ae().subVectors(Ee.leftPoint,Ee.rightPoint).length(),je=new ae().addVectors(Ee.leftPoint,Ee.rightPoint).divideScalar(2),xt=new ln(0,0,Ee.relativeAngle),gt=new ae(ke*st,0,0),Ye=Oe*a+le;return new ae(je.x,je.y,Ye).add(gt.applyEuler(xt))},Z=(Ee,ke)=>{const Oe=Ee[ke];let st,je;return ke===0||ke===2?(st=Oe.lz,je=Oe.lz):ke===1?(st=Ee[0].lz,je=Ee[2].lz):(st=Ee[2].lz,je=Ee[0].lz),{lh:st,rh:je}},ee=(Ee,ke)=>{const Oe=Ee.slice().reverse();return te(Oe,0,ke-1),te(Oe,ke,Oe.length-1),Oe},te=(Ee,ke,Oe)=>{for(;keEe*Oe+ke,de=(Ee,ke,Oe,st,je)=>{const xt=ke[Oe],gt=new ae().subVectors(xt.leftPoint,xt.rightPoint).length(),Ye=(je[0]+.5)*gt,{lh:it,rh:ut}=Z(ke,Oe),Qe=je[1]*(st-it)/Ye,lt=it,Ze=-(je[1]*(st-ut))/(gt-Ye),Be=ut-Ze*gt,$e=xt.wallsId.reduce((wt,vt)=>{const Rt=M.getState().elements.find(Gt=>Gt.id===vt);return Rt?[...wt,Rt.lx+wt[wt.length-1]]:wt},[0]);for(let wt=0;wtYe&&(pt.center=[(Ye-Rt)/At-.5,st]),Ee.set(vt,pt)}return Ee},he=(Ee,ke,Oe,st)=>{const je=new Map;return de(je,Ee,1,ke,st),de(je,Ee,3,ke,Oe),je},pe=(Ee,ke,Oe,st)=>{const[je,xt,gt,Ye]=Ee,it=new Set(je.wallsId),ut=new Set(gt.wallsId),Qe=he(Ee,ke,Oe,st);x(lt=>{for(const Ze of lt.elements)if(Ze.type===z.Wall&&Ze.foundationId===o){if(it.has(Ze.id)){const Be=Ze;if(Be.roofId=n,Oe[0]===.5)Be.leftRoofHeight=ke,Be.rightRoofHeight=ke,Be.centerRoofHeight=void 0;else{const{lh:$e,rh:wt}=Z(Ee,0);Be.leftRoofHeight=$e,Be.rightRoofHeight=wt}}else if(ut.has(Ze.id)){const Be=Ze;if(Be.roofId=n,Oe[0]===-.5)Be.leftRoofHeight=ke,Be.rightRoofHeight=ke,Be.centerRoofHeight=void 0;else{const{lh:$e,rh:wt}=Z(Ee,2);Be.leftRoofHeight=$e,Be.rightRoofHeight=wt}}else if(Qe.has(Ze.id)){const Be=Qe.get(Ze.id);if(Be){const $e=Ze,{left:wt,right:vt,center:Rt}=Be;if($e.roofId=n,$e.leftRoofHeight=wt,$e.rightRoofHeight=vt,Rt){const[Gt,At]=Rt;$e.centerRoofHeight?($e.centerRoofHeight[0]=Gt,$e.centerRoofHeight[1]=At):$e.centerRoofHeight=[Gt,At]}else $e.centerRoofHeight=void 0}}}})},me=jye(r[0],o),{highestWallHeight:le,topZ:Te}=Bye(me,a,!0);pN(t,le);const ge=m.useMemo(()=>{if(me===null||me.length!==4)return new ae;const Ee=me.map(Oe=>({x:Oe.leftPoint.x,y:Oe.leftPoint.y})),ke=ye.calculatePolygonCentroid(Ee);return new ae(ke.x,ke.y,Te)},[me,Te]),Se=m.useMemo(()=>{if(me===null)return new ae;const Ee=me[3],[ke,Oe]=s;return se(Ee,ke,Oe)},[me,Te,s]),Re=m.useMemo(()=>{if(me===null)return new ae;const Ee=me[1],[ke,Oe]=c;return se(Ee,ke,Oe)},[me,Te,c]),De=m.useMemo(()=>new ae((Se.x+Re.x)/2,(Se.y+Re.y)/2,Te),[Se,Re]),Ae=m.useMemo(()=>!me||me.length!==4?null:me.map(Ee=>bn.getComposedWallNormal(Ee).multiplyScalar(Ee.eavesLength)),[me]),ue=m.useMemo(()=>ibt.clone().multiplyScalar(l),[l]),fe=m.useMemo(()=>{const Ee=[];if(!me||me.length!==4||!Ae)return Ee;if(L){const ke=[],Oe=s[0]<0?0:2,st=ee(me,Oe),je=ee(Ae,Oe),[xt,gt,Ye,it]=st,[ut,Qe,lt,Ze]=je,Be=xt.leftPoint,$e=xt.rightPoint,wt=Ye.leftPoint,vt=Ye.rightPoint,Rt=Be.clone().add(ut),Gt=$e.clone().add(ut),At=vt.clone().add(Ze),pt=Be.clone().add(Ze),Wt=$e.clone().add(Qe),ht=wt.clone().add(Qe),ct=wt.clone().add(lt),It=vt.clone().add(lt),{lh:Ft,rh:Ve}=Z(st,0),{lh:ft,rh:kt}=Z(st,2),rt=bn.getDistance(Be,$e,vt),at=Math.min((xt.eavesLength??0)/rt*(Te-Ft),Ft),Ge=bn.getDistance(Be,$e,wt),yt=Math.min((xt.eavesLength??0)/Ge*(Te-Ve),Ve),Pt=bn.getDistance(wt,vt,$e),ot=Math.min((Ye.eavesLength??0)/Pt*(Te-Ve),ft),bt=bn.getDistance(wt,vt,Be),zt=Math.min((Ye.eavesLength??0)/bt*(Te-Ft),kt),Bt=bn.getIntersectionPoint(At,pt,Rt,Gt).setZ(Ft-at).sub(ge),tt=bn.getIntersectionPoint(Rt,Gt,Wt,ht).setZ(Ve-yt).sub(ge),Ht=bn.getIntersectionPoint(Wt,ht,ct,It).setZ(Te+ot).sub(ge),_t=bn.getIntersectionPoint(ct,It,At,pt).setZ(Te+zt).sub(ge);ke.push(Bt,tt,Ht,_t),ke.push(Bt.clone().add(ue),tt.clone().add(ue),Ht.clone().add(ue),_t.clone().add(ue));const un=new ae().addVectors(xt.leftPoint,xt.rightPoint).divideScalar(2).clone().sub(De.clone().setZ(0)).length();Ee.push({points:ke,angle:-xt.relativeAngle,length:un})}else{const[ke,Oe,st,je]=me,[xt,gt,Ye,it]=Ae,ut=ke.leftPoint.clone().add(xt),Qe=ke.rightPoint.clone().add(xt),lt=st.rightPoint.clone().add(it),Ze=ke.leftPoint.clone().add(it),Be=ke.rightPoint.clone().add(gt),$e=st.leftPoint.clone().add(gt),wt=st.leftPoint.clone().add(Ye),vt=st.rightPoint.clone().add(Ye),Rt=bn.getIntersectionPoint(Se,Re,lt.clone(),Ze.clone()).setZ(Se.z).sub(ge),Gt=bn.getIntersectionPoint(Se,Re,Be.clone(),$e.clone()).setZ(Re.z).sub(ge),At=[],{lh:pt,rh:Wt}=Z(me,0),ht=bn.getDistance(ke.leftPoint,ke.rightPoint,Se),ct=Math.min((ke.eavesLength??0)/ht*(Se.z-pt),pt),It=bn.getDistance(ke.leftPoint,ke.rightPoint,Re),Ft=Math.min((ke.eavesLength??0)/It*(Re.z-Wt),Wt),Ve=bn.getIntersectionPoint(lt,Ze,ut,Qe).setZ(pt-ct).sub(ge),ft=bn.getIntersectionPoint(ut,Qe,Be,$e).setZ(Wt-Ft).sub(ge);At.push(Ve,ft,Gt,Rt),At.push(Ve.clone().add(ue),ft.clone().add(ue),Gt.clone().add(ue),Rt.clone().add(ue));const rt=new ae().addVectors(ke.leftPoint,ke.rightPoint).divideScalar(2).clone().sub(ge.clone().setZ(0)).length();Ee.push({points:At,angle:-ke.relativeAngle,length:rt});const at=[],{lh:Ge,rh:yt}=Z(me,2),Pt=bn.getDistance(st.leftPoint,st.rightPoint,Re),ot=Math.min((st.eavesLength??0)/Pt*(Re.z-Ge),Ge),bt=bn.getDistance(st.leftPoint,st.rightPoint,Se),zt=Math.min((st.eavesLength??0)/bt*(Se.z-yt),yt),Bt=bn.getIntersectionPoint(Be,$e,wt,vt).setZ(Ge-ot).sub(ge),tt=bn.getIntersectionPoint(wt,vt,lt,Ze).setZ(yt-zt).sub(ge);at.push(Bt,tt,Rt,Gt),at.push(Bt.clone().add(ue),tt.clone().add(ue),Rt.clone().add(ue),Gt.clone().add(ue));const _t=new ae().addVectors(st.leftPoint,st.rightPoint).divideScalar(2).clone().sub(ge.clone().setZ(0)).length();Ee.push({points:at,angle:-st.relativeAngle,length:_t})}return Ee},[me,Se,Re,Te,l]),ve=m.useMemo(()=>!me||me.length!==4?null:me.map(Ee=>Ee.leftPoint),[me]);m.useEffect(()=>{(!me||me.length!==4)&&b(n,!1,!1,!0)},[me]);const we=EQ();m.useEffect(()=>{if((me==null?void 0:me.length)!==4)return;(M.getState().addedRoofIdSet.has(n)||!we)&&(pe(me,Te,s,c),DQ(e,n,fe,ge,Te,l),M.getState().deleteAddedRoofId(n))},[fe]),Yye(e,n,fe,ge,Te,l);const Pe=()=>{if(!me||me.length!==4)return;const Ee=[];if(L){const ke=s[0]<0?0:2,st=ee(me,ke).map((je,xt,gt)=>new ae(je.leftPoint.x,je.leftPoint.y,Z(gt,xt).lh));Ee.push(st)}else{const ke=me.map((Oe,st,je)=>new ae(Oe.leftPoint.x,Oe.leftPoint.y,Z(je,st).lh));Ee.push([ke[0],ke[1],Re.clone(),Se.clone()]),Ee.push([ke[2],ke[3],Se.clone(),Re.clone()])}Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,Ee)};fN(n,ge,fe,!1,Go.Gable),hN(Pe);const Ie=M(Ee=>Ee.elements.filter(ke=>ke.parentId===n&&ke.type===z.Window),cy),Me=M(pu),ze=dt(hs),Ne=M(Pf),Je=Cn(c1),[Ue,nt]=m.useState([]);m.useEffect(()=>{if(ze){const Ee=fe.length;if(Ee>0){const ke=[];for(let Oe=0;Oe{cN(Ee,e.id,n,fe,ge)},onPointerMove:Ee=>{dN(Ee,n)},onPointerUp:Ee=>{uN(Ee,t)},onContextMenu:Ee=>{CR(Ee,n)},children:[fe.map((Ee,ke,Oe)=>{const{points:st,angle:je,length:xt}=Ee,gt=Math.abs(st[0].z)<.1;return me?h.jsx(cbt,{index:ke,id:n,points:st,centroid:ge,angle:gt?Oe[0].angle:je,length:gt?1:xt,textureType:u,heatmaps:Ue,color:d,sideColor:f,roofStructure:y,glassTint:v,opacity:T,relativeAngle:ke===0?me[0].relativeAngle:me[2].relativeAngle,foundation:e,windows:Ie},ke):null}),T>0&&h.jsx(lbt,{roofSegments:fe,thickness:l,lineColor:g,lineWidth:y===Ac.Rafter?.1:A})]}),w&&a>0&&me[0].lz===me[2].lz&&ve&&h.jsx(zW,{cz:me[0].lz,points:ve}),y===Ac.Rafter&&me&&me.length===4&&h.jsx("group",{onContextMenu:Ee=>{CR(Ee,n)},onPointerDown:Ee=>{p$e(Ee,n,o)},children:h.jsx(abt,{ridgeLeftPoint:Se,ridgeRightPoint:Re,wallArray:me,overhang:0,isShed:L,height:l,spacing:S,color:P,width:C})}),R&&!p&&h.jsxs("group",{position:[0,0,l],children:[h.jsx(th,{position:[De.x,De.y,De.z+.15],onPointerDown:Ee=>{if(Me(t.id,Ee,Xo.Select),G.current=!0,V.current=a,W(!0),yY.set(De.x,De.y,Te),e){const ke=-Math.atan2(F.position.x-e.cx,F.position.y-e.cy)-e.rotation[2];AY.set(-Qt,0,ke,"ZXY")}D(Lr.Mid),kn.getState().setEnableOrbitController(!1),x(ke=>{ke.resizeHandleType=Mt.Top,ke.selectedElementHeight=Te+t.thickness})},onPointerOver:()=>{x(Ee=>{Ee.hoveredHandle=Lr.Mid,Ee.selectedElementHeight=Te+t.thickness,Ee.selectedElementX=De.x,Ee.selectedElementY=De.y})}}),h.jsx(th,{position:[Se.x,Se.y,Se.z+.15],onPointerDown:()=>{if(G.current=!0,B.current=s[0],O.current=c[0],W(!0),yY.set(Se.x,Se.y,Te),e&&me&&me[3]){const Ee=new ae().subVectors(Se,F.position).normalize(),ke=Math.atan2(Ee.z,Math.hypot(Ee.x,Ee.y)),Oe=me[3].relativeAngle;AY.set(-Qt+ke,0,Oe,"ZXY")}D(Lr.Left),kn.getState().setEnableOrbitController(!1)}}),h.jsx(th,{position:[Re.x,Re.y,Re.z+.15],onPointerDown:()=>{if(G.current=!0,B.current=s[0],O.current=c[0],W(!0),yY.set(Re.x,Re.y,Te),e&&me&&me[1]){const Ee=new ae().subVectors(Re,F.position).normalize(),ke=Math.atan2(Ee.z,Math.hypot(Ee.x,Ee.y)),Oe=me[1].relativeAngle;AY.set(-Qt+ke,0,Oe,"ZXY")}D(Lr.Right),kn.getState().setEnableOrbitController(!1)}})]}),U&&h.jsx(ta,{name:"Roof Intersection Plane",ref:j,args:[1e3,100],visible:!1,position:yY,rotation:AY,onPointerMove:Ee=>{if(j.current&&G.current&&e&&me&&me.length===4){ie(Ee);const ke=E.intersectObjects([j.current]);if(ke[0]){const Oe=ke[0].point;if(Oe.z<.001)return;switch(k){case Lr.Left:{const st=me[3];if(st){let je=Q(e,st,Oe);Math.abs(je)>=.45&&Math.abs(je)<.5&&(je=.45*Math.sign(je));const xt=[je,s[1]],gt=[-je,c[1]],Ye=he(me,Te,xt,gt);o9(Ye,o)&&q(n,je,-je)}break}case Lr.Right:{const st=me[1];if(st){let je=Q(e,st,Oe);Math.abs(je)>=.45&&Math.abs(je)<.5&&(je=.45*Math.sign(je));const xt=[-je,s[1]],gt=[je,c[1]],Ye=he(me,Te,xt,gt);o9(Ye,o)&&q(n,-je,je)}break}case Lr.Mid:{let st;L?st=Math.max(0,Oe.z-e.lz-.3-le):st=Math.max(-le+.01,Oe.z-e.lz-.3-le);const je=le+st,xt=he(me,je,s,c);o9(xt,o)&&M.getState().updateRoofRiseById(n,st,Te+t.thickness);break}}}}},onPointerUp:()=>{switch(k){case Lr.Mid:{sN(n,V.current,a);break}case Lr.Left:case Lr.Right:$(n,B.current,O.current,s[0],c[0])}G.current=!1,W(!1),D(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},cbt=({index:t,id:e,points:n,centroid:o,angle:r,length:i,textureType:a,heatmaps:l,color:s="white",sideColor:c,relativeAngle:u,foundation:d,roofStructure:f,glassTint:p,opacity:g=.5,windows:A})=>{const y=M.getState().world;M(Jn);const S=M(s3),C=dt(hs),P=dt(p3),v=M(e5),T=M(a3),w=M(l3),x=Cn(yW),b=Cn.getState().hourlyHeatExchangeArrayMap,R=eM(f===Ac.Rafter?Ur.NoTexture:a),{transparent:H,opacity:F}=tM(f===Ac.Rafter,g),{invalidate:E}=ri(),N=m.useRef(null),U=m.useRef(null),W=m.useRef(null),k=m.useRef(null),D=m.useRef(0),L=m.useRef(),j=m.useRef(),[B,O]=m.useState(0),[V,G]=m.useState(0),[q,$]=m.useState(!0),ie=(oe,de)=>oe.clone().setZ(0).distanceTo(de.clone().setZ(0))>2,Q=oe=>Math.abs(oe){if(!P)return;const oe=x(e);if(!oe)return;const de=[],[he,pe,me,le,Te]=n,ge=Te.z-he.z,Se=new ae(0,0,ge+.1);for(const Re of oe.values()){let De=[];De.push(Re[0].clone().sub(o).add(Se)),De.push(Re[1].clone().sub(o).add(Se)),de.push(De),De=[],De.push(Re[0].clone().sub(o).add(Se)),De.push(Re[3].clone().sub(o).add(Se)),de.push(De),De=[],De.push(Re[1].clone().sub(o).add(Se)),De.push(Re[2].clone().sub(o).add(Se)),de.push(De)}return de},[P]),Z=m.useMemo(()=>{if(!P||d&&d.notBuilding)return;const oe=b.get(e+"-"+t);if(!oe)return;const de=oe.reduce((Ye,it)=>Ye+it,0),he=x(e);if(!he||!he[t])return;const[pe,me,le,Te,ge]=n,Se=ge.z-pe.z,Re=he[t].map(Ye=>Ye.clone().sub(o).add(new ae(0,0,Se)));if(!Re)return;let De=ye.getTriangleArea(Re[0],Re[1],Re[2])+ye.getTriangleArea(Re[2],Re[3],Re[0]);if(De===0)return;let Ae=S(z.Window,e);const ue=x(e);if(ue&&ue[t]&&(Ae=Ae.filter(Ye=>{const it=Ye,ut=it.cy+(it.windowType===Ci.Polygonal&&it.polygonTop?it.polygonTop[1]/2:0);return bn.onSegment(ue[t],Ye.cx,ut)})),Ae&&Ae.length>0)for(const Ye of Ae)De-=ye.getWindowArea(Ye);const fe=i3*(y.solarRadiationHeatmapGridCellSize??.5),ve=Re[0].clone(),we=Re[1].clone(),Pe=Re[2].clone(),Ie=new ae().subVectors(we,ve),Me=new ae().subVectors(Pe,ve),ze=new ae().subVectors(Pe,we),Ne=Ie.length(),Je=new ae().crossVectors(Me,ze).length()/Ne,Ue=Math.max(2,Math.round(Ne/fe)),nt=Math.max(2,Math.round(Je/fe));Ie.normalize(),Me.normalize(),ze.normalize();const We=new ae().crossVectors(Me,ze).normalize(),Ee=Ie.multiplyScalar(.5*Ne/Ue),ke=new ae().crossVectors(We,Ie).normalize().multiplyScalar(.5*Je/nt),Oe=ve.clone().add(Ee).add(ke);Ee.multiplyScalar(2),ke.multiplyScalar(2);const st=de/De*(v??Qm);D.current=st<0?1:0,L.current=We.clone().multiplyScalar(.1),j.current=ye.getEuler(ko,We,"YXZ",-Math.sign(st)*Qt);const je=[],xt=new ae;let gt;for(let Ye=0;Ye0){const Qe=xt.x+o.x,lt=xt.y+o.y;for(const Ze of Ae){const Be=bn.getRelativeWindowVerticesOnRoof(Ze),$e=ye.getPoints(Be);if(ye.isPointInside(Qe,lt,$e)){gt=!1;break}}}if(gt){const Qe=[];st<0?(Qe.push(xt.clone()),Qe.push(xt.clone().add(We.clone().multiplyScalar(-st)))):(Qe.push(xt.clone()),Qe.push(xt.clone().add(We.clone().multiplyScalar(st)))),je.push(Qe)}}}return je},[P,v,o,n]);m.useEffect(()=>{const[oe,de,he,pe,me]=n,le=me.z-oe.z;if(N.current){const Te=N.current.geometry;if(Te){const ge=new Float32Array(18),Se=le+.01;ge[0]=n[0].x,ge[1]=n[0].y,ge[2]=n[0].z+Se,ge[3]=n[1].x,ge[4]=n[1].y,ge[5]=n[1].z+Se,ge[6]=n[2].x,ge[7]=n[2].y,ge[8]=n[2].z+Se,ge[9]=n[2].x,ge[10]=n[2].y,ge[11]=n[2].z+Se,ge[12]=n[3].x,ge[13]=n[3].y,ge[14]=n[3].z+Se,ge[15]=n[0].x,ge[16]=n[0].y,ge[17]=n[0].z+Se,Te.setAttribute("position",new gr(ge,3)),Te.computeVertexNormals();const Re=[];Re.push(0,0),Re.push(1,0),Re.push(1,1),Re.push(1,1),Re.push(0,1),Re.push(0,0),Te.setAttribute("uv",new gr(Re,2))}}if(U.current){U.current.geometry=new Nce(n,r,i);const Te=ie(oe,pe)&&ie(de,he);if($(Te),f===Ac.Glass&&Te){const ge=ye.calculatePolygonCentroid(n.map(ye.mapVector3ToPoint2)),Se=new ae(ge.x,ge.y,0),Re=.25,De=new ae().addVectors(oe,Se.clone().sub(oe).setZ(0).normalize().multiplyScalar(Re)),Ae=new ae().addVectors(de,Se.clone().sub(de).setZ(0).normalize().multiplyScalar(Re)),ue=new ae().addVectors(he,Se.clone().sub(he).normalize().multiplyScalar(Re)),fe=new ae().addVectors(pe,Se.clone().sub(pe).normalize().multiplyScalar(Re)),ve=[];ve.push(De),ve.push(Ae),ve.push(ue.setZ(Ae.z)),ve.push(fe.setZ(De.z)),ve.push(De.clone().setZ(1)),ve.push(Ae.clone().setZ(1)),ve.push(ue.clone().setZ(1)),ve.push(fe.clone().setZ(1));const we=new ls(new Nce(ve)),Pe=cc.subtract(U.current,we);if(U.current.geometry=Pe.geometry,Q(u)){const Me=De.distanceTo(Ae),ze=oe.distanceTo(pe);O(Me),G(ze);const Ne=new ae().subVectors(oe,pe).angleTo(new ae(0,-1,0));W.current&&(W.current.scale.set(Me,ze,1),W.current.rotation.set(Ne,0,0)),k.current&&k.current.rotation.set(Ne-Qt,0,0)}else{const Me=oe.distanceTo(pe),ze=De.distanceTo(Ae);O(Me),G(ze);const Ne=new ae().subVectors(oe,pe).angleTo(new ae(1,0,0));W.current&&(W.current.scale.set(Me,ze,1),W.current.rotation.set(0,Ne,0)),k.current&&k.current.rotation.set(Qt,Ne,0,"YXZ")}const Ie=(oe.z+pe.z)/2+le*.75;W.current&&W.current.position.set(ge.x,ge.y,Ie),k.current&&k.current.position.set(ge.x,ge.y,Ie)}}E()},[n,r,i,u,q,C,f]);const ee={points:n,angle:r,length:i},te=a===Ur.Default||a===Ur.NoTexture?s:"white";return h.jsxs(h.Fragment,{children:[(F>0&&f===Ac.Rafter||f!==Ac.Rafter)&&h.jsx(h.Fragment,{children:h.jsx(MOe,{id:e,index:t,segment:ee,color:te,sideColor:c??"white",texture:R,heatmap:l[t],transparent:H,opacity:F,windows:A,centroid:o})}),se&&se.map((oe,de)=>h.jsx(Gn,{points:oe,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+de},de)),Z&&Z.map((oe,de)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:oe,name:"Heat Flux "+de,lineWidth:w??Zm,color:T??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:L.current?oe[D.current].clone().add(L.current):oe[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:j.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:T??p0})})]},de))]})},ubt=be.memo(sbt,ZH),dbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new ae(0,0,e);for(let u=0;u{const[f,p,g,A]=u.points,y=[f.clone().sub(i),f];return h.jsx(Gn,{points:y,lineWidth:n,color:o},d)})]})]})}),T4=new ae,P4=new ln,fbt=new ae(0,0,1),hbt=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,cx:r,cy:i,lz:a,wallsId:l,leftRidgeLength:s,rightRidgeLength:c,textureType:u,color:d="white",sideColor:f="white",thickness:p=.2,locked:g,lineColor:A="black",lineWidth:y=.2,roofType:S,rise:C=a,ceiling:P=!1}=t;const v=M(Jn),T=M(pn),w=M(Ap),x=jye(l[0],o),b=eM(u),R=Tc(n),[H,F]=m.useState(!1),[E,N]=m.useState(Lr.Null),[U,W]=m.useState(s),[k,D]=m.useState(c),{highestWallHeight:L,topZ:j}=Bye(x,C);pN(t,L);const B=m.useRef(null),{gl:O,camera:V}=ri(),G=m.useMemo(()=>new l0,[]),q=m.useMemo(()=>new Kt,[]),$=m.useRef(!1),ie=m.useRef(C),Q=C<.01;[A,y]=bn.getWireframetStyle(A,y,R,g),m.useEffect(()=>{W(s)},[s]),m.useEffect(()=>{D(c)},[c]);const se=(We,Ee,ke,Oe=!1)=>{T(st=>{for(const je of st.elements)if(je.id===We&&je.type===z.Roof&&je.roofType===Go.Hip){je.leftRidgeLength=Ee,je.rightRidgeLength=ke,Oe&&(st.updateElementOnRoofFlag=!0);break}})},Z=(We,Ee,ke,Oe,st)=>{const je={name:"Resize Hip Roof Ridge",timestamp:Date.now(),resizedElementId:We,resizedElementType:z.Roof,oldLeftRidgeLength:Ee,oldRightRidgeLength:ke,newLeftRidgeLength:Oe,newRightRidgeLength:st,undo:()=>{se(je.resizedElementId,je.oldLeftRidgeLength,je.oldRightRidgeLength,!0)},redo:()=>{se(je.resizedElementId,je.newLeftRidgeLength,je.newRightRidgeLength,!0)}};M.getState().addUndoable(je)},ee=We=>{const Ee=[];for(const ke of We)Ee.push({x:ke.leftPoint.x,y:ke.leftPoint.y});return Ee},te=We=>{q.x=We.offsetX/O.domElement.clientWidth*2-1,q.y=-(We.offsetY/O.domElement.clientHeight)*2+1,G.setFromCamera(q,V)},oe=(We,Ee,ke,Oe,st)=>{We.push(Ee,ke,Oe),st&&We.push(st),We.push(Ee.clone().add(ge),ke.clone().add(ge),Oe.clone().add(ge)),st&&We.push(st.clone().add(ge))},de=()=>{if(x===null||x.length!==4)return 0;const We=x.map(Oe=>Oe.leftPoint),Ee=[pe,me,me,pe];let ke=1/0;for(let Oe=0;Oe<4;Oe++){const st=x[Oe],je=bn.getDistance(We[Oe],We[(Oe+1)%4],Ee[Oe]),xt=Math.min((st.eavesLength??0)/je*(Ee[Oe].z-st.lz),st.lz),gt=bn.getDistance(We[Oe],We[(Oe+1)%4],Ee[(Oe+1)%4]),Ye=Math.min((st.eavesLength??0)/gt*(Ee[(Oe+1)%4].z-st.lz),st.lz);ke=Math.min(Math.min(xt,Ye),ke)}return Number.isNaN(ke)?0:ke},he=m.useMemo(()=>{if(x===null||x.length!==4)return new Kt;const We=ee(x),Ee=ye.calculatePolygonCentroid(We);return new Kt(Ee.x,Ee.y)},[x]),pe=m.useMemo(()=>{const We=new ae,Ee=new ae(he.x,he.y,j),ke=v(l[0]);return ke&&We.setX(-U).applyEuler(new ln(0,0,ke.relativeAngle)).add(Ee),We},[he,j,U]),me=m.useMemo(()=>{const We=new ae,Ee=new ae(he.x,he.y,j),ke=v(l[0]);return ke&&We.setX(k).applyEuler(new ln(0,0,ke.relativeAngle)).add(Ee),We},[he,j,k]),le=m.useMemo(()=>new ae(he.x,he.y,j),[he,j]),Te=m.useMemo(()=>x===null||x.length!==4?[]:x.map(We=>bn.getComposedWallNormal(We).multiplyScalar(We.eavesLength)),[x]),ge=m.useMemo(()=>fbt.clone().multiplyScalar(p),[p]),Se=m.useMemo(()=>x===null||x.length!==4?null:x.map((We,Ee)=>({leftPoint:We.leftPoint.clone().add(Te[Ee]),rightPoint:We.rightPoint.clone().add(Te[Ee])})),[x,Te]),Re=m.useMemo(()=>{const We=[];if(x===null||x.length!==4||Se===null)return We;const Ee=de();for(let ke=0;ke<4;ke++){const Oe=[],st=x[ke],{lh:je,rh:xt}=bn.getComposedWallHeight(x,ke),gt=bn.getIntersectionPoint(Se[(ke+3)%4].leftPoint,Se[(ke+3)%4].rightPoint,Se[ke].leftPoint,Se[ke].rightPoint).setZ(je-Ee).sub(le),Ye=bn.getIntersectionPoint(Se[ke].leftPoint,Se[ke].rightPoint,Se[(ke+1)%4].leftPoint,Se[(ke+1)%4].rightPoint).setZ(xt-Ee).sub(le),it=new ae().addVectors(st.leftPoint,st.rightPoint).divideScalar(2),ut=pe.clone().sub(le),Qe=me.clone().sub(le);let lt=0;switch(ke){case 0:lt=it.clone().sub(le.clone().setZ(0)).length(),oe(Oe,gt,Ye,Qe,ut);break;case 1:lt=it.clone().sub(me.clone().setZ(0)).length(),oe(Oe,gt,Ye,Qe);break;case 2:lt=it.clone().sub(le.clone().setZ(0)).length(),oe(Oe,gt,Ye,ut,Qe);break;case 3:lt=it.clone().sub(pe.clone().setZ(0)).length(),oe(Oe,gt,Ye,ut);break}We.push({points:Oe,angle:-st.relativeAngle,length:lt})}return We},[x,pe,me,j,p]),De=m.useMemo(()=>!x||x.length!==4?null:x.map(We=>We.leftPoint),[x]);m.useEffect(()=>{if(x===null||x.length!==4)w(n,!1,!1,!0);else if(M.getState().addedRoofIdSet.has(n)){for(let Ee=0;Ee{for(const st of Oe.elements)if(st.type===z.Wall&&ke.has(st.id)){const je=st;je.roofId=n,je.leftRoofHeight=void 0,je.rightRoofHeight=void 0}})}M.getState().deleteAddedRoofId(n)}},[x]),Oye(e,n,Re,le,j,p);const Ae=()=>{if(!x)return;const We=[];for(let Ee=0;Ee<4;Ee++){const ke=x[Ee],{lh:Oe,rh:st}=bn.getComposedWallHeight(x,Ee),je=ke.leftPoint.clone().setZ(Oe),xt=ke.rightPoint.clone().setZ(st),gt=pe.clone(),Ye=me.clone();switch(Ee){case 0:We.push([je,xt,Ye,gt]);break;case 1:We.push([je,xt,Ye]);break;case 2:We.push([je,xt,gt,Ye]);break;case 3:We.push([je,xt,gt]);break}}if(Q){const Ee=[];for(const ke of We)Ee.push(ke[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[Ee])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,We)},ue=fN(n,new ae(he.x,he.y,j),Re,Q,Go.Hip);hN(Ae);const fe=M(We=>We.elements.filter(Ee=>Ee.parentId===n&&Ee.type===z.Window),cy),ve=M(pu),we=dt(hs),Pe=M(Pf),Ie=Cn(c1),[Me,ze]=m.useState(null),[Ne,Je]=m.useState([]);m.useEffect(()=>{if(we)if(C>0){const We=Re.length;if(We>0){const Ee=[];for(let ke=0;ke0&&e){const Oe=new ln(0,0,e.rotation[2],"ZYX");let st=Number.MAX_VALUE,je=Number.MAX_VALUE,xt=-Number.MAX_VALUE,gt=-Number.MAX_VALUE;for(const Ze of ke)for(const Be of Ze){const $e=Be.clone().applyEuler(Oe);$e.x>xt&&(xt=$e.x),$e.xgt&&(gt=$e.y),$e.y{cN(We,e.id,n,Re,le)},onPointerMove:We=>{dN(We,n)},onPointerUp:We=>{uN(We,t)},onContextMenu:We=>{CR(We,n)},children:Q?h.jsx(FQ,{id:n,foundationModel:e,roofType:S,roofSegments:Re,center:new ae(he.x,he.y,j),thickness:p,lineWidth:y,lineColor:A,sideColor:f,color:nt,textureType:u,heatmap:Me}):h.jsxs(h.Fragment,{children:[Re.map((We,Ee,ke)=>h.jsx(u$,{id:n,index:Ee,foundationModel:e,roofType:S,segment:We,centroid:le,thickness:p,color:nt,sideColor:f,texture:b,heatmap:Ne&&Ee0&&De&&h.jsx(zW,{cz:x[0].lz,points:De}),R&&!g&&h.jsxs("group",{position:[0,0,p+.15],children:[h.jsx(th,{position:[pe.x,pe.y,pe.z],onPointerDown:()=>{if($.current=!0,F(!0),T4.set(pe.x,pe.y,j),e&&x[0]){const We=M.getState().cameraDirection,Ee=Math.atan2(We.z,We.y),ke=x[0].relativeAngle;P4.set(-Qt-Ee,0,ke,"ZXY")}N(Lr.Left),kn.getState().setEnableOrbitController(!1)}}),h.jsx(th,{position:[le.x,le.y,le.z],onPointerDown:We=>{if(ve(t.id,We,Xo.Select),$.current=!0,ie.current=C,F(!0),T4.set(le.x,le.y,j),e){const Ee=-Math.atan2(V.position.x-r,V.position.y-i)-e.rotation[2];P4.set(-Qt,0,Ee,"ZXY")}N(Lr.Mid),kn.getState().setEnableOrbitController(!1),T(Ee=>{Ee.resizeHandleType=Mt.Top,Ee.selectedElementHeight=j+t.thickness})},onPointerOver:()=>{T(We=>{We.hoveredHandle=Lr.Mid,We.selectedElementHeight=j+t.thickness,We.selectedElementX=he.x,We.selectedElementY=he.y})}}),h.jsx(th,{position:[me.x,me.y,me.z],onPointerDown:()=>{if($.current=!0,F(!0),T4.set(me.x,me.y,j),e&&x[0]){const We=M.getState().cameraDirection,Ee=Math.atan2(We.z,We.y),ke=x[0].relativeAngle;P4.set(-Qt-Ee,0,ke,"ZXY")}N(Lr.Right),kn.getState().setEnableOrbitController(!1)}})]}),H&&h.jsx(ta,{name:"Roof Intersection Plane",ref:B,args:[1e3,100],visible:!1,position:T4,rotation:P4,onPointerMove:We=>{if(B.current&&$.current){te(We);const Ee=G.intersectObjects([B.current]);if(Ee[0]&&e){const ke=Ee[0].point;if(ke.z<.001)return;const Oe=x[0],st=new ae().subVectors(Oe.rightPoint,Oe.leftPoint).length();switch(E){case Lr.Left:{const je=le.clone().sub(T4).applyEuler(new ln(0,0,-P4.z)),xt=ke.clone().sub(new ae(e.cx,e.cy,e.cz)).applyEuler(new ln(0,0,-e.rotation[2])).sub(T4).applyEuler(new ln(0,0,-P4.z)),gt=new ae().subVectors(xt,je).x;W(ye.clamp(-gt,-k+.1,st/2-.01));break}case Lr.Right:{const je=le.clone().sub(T4).applyEuler(new ln(0,0,-P4.z)),xt=ke.clone().sub(new ae(e.cx,e.cy,e.cz)).applyEuler(new ln(0,0,-e.rotation[2])).sub(T4).applyEuler(new ln(0,0,-P4.z)),gt=new ae().subVectors(xt,je).x;D(ye.clamp(gt,-U+.1,st/2-.01));break}case Lr.Mid:{const je=Math.max(0,ke.z-e.lz-.3-L);M.getState().updateRoofRiseById(n,je,j+t.thickness);break}}}}},onPointerUp:()=>{switch(E){case Lr.Mid:{sN(n,ie.current,C);break}case Lr.Left:case Lr.Right:se(n,U,k),Z(n,s,c,U,k)}$.current=!1,F(!1),N(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},pbt=be.memo(hbt,ZH),Ere=new ae,Fre=new ln,gbt=new ae(0,0,1),mbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{const r=m.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[1]),[t[0].points[0]]),[t]),i=m.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[6].clone()),[t[0].points[7].clone()]),[t]),a=m.useMemo(()=>h.jsx(Gn,{points:r,lineWidth:n,color:o}),[r,n,o]);if(t.length<2)return null;const l=Math.abs(t[0].points[0].z-t[0].points[3].z)<.1;return h.jsxs(h.Fragment,{children:[!l&&h.jsx(Gn,{points:i,lineWidth:n,color:o}),a,h.jsx("group",{position:[0,0,e],children:a}),t.map((s,c)=>h.jsxs(be.Fragment,{children:[!l&&h.jsx(Gn,{points:[s.points[7],s.points[4]],lineWidth:n,color:o}),h.jsx(Gn,{points:[s.points[4],s.points[0]],lineWidth:n,color:o})]},c))]})}),ybt=({roofModel:t,foundationModel:e})=>{let{id:n,wallsId:o,cx:r,cy:i,lz:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineColor:f="black",lineWidth:p=.2,roofType:g,foundationId:A,ridgeWidth:y=1,rise:S=a,ceiling:C=!1,frontRidge:P,backRidge:v}=t;const T=eM(l),w=Tc(n);[f,p]=bn.getWireframetStyle(f,p,w,d);const x=M(pn),b=M(Ap),R=M(Cs),H=M(ht=>ht.ray),F=M(ht=>ht.mouse),[E,N]=m.useState(y),[U,W]=m.useState(null),[k,D]=m.useState(!1),[L,j]=m.useState(Lr.Null),[B,O]=m.useState(null),V=m.useRef(E),G=m.useRef(S),q=m.useRef(null),$=m.useRef(!1),{gl:ie,camera:Q}=ri(),se=S<.01,Z=ht=>{const ct=[],It=ht.length;for(const Ft of ht)Ft.leftPoint[0]!==void 0&&Ft.leftPoint[1]!==void 0&&ct.push({x:Ft.leftPoint[0],y:Ft.leftPoint[1]});return me.current||(ht[It-1].rightPoint[0]||ht[It-1].rightPoint[0]===0)&&(ht[It-1].rightPoint[1]||ht[It-1].rightPoint[1]===0)&&ct.push({x:ht[It-1].rightPoint[0],y:ht[It-1].rightPoint[1]}),ct},ee=ht=>{if(ht{F.x=ht.offsetX/ie.domElement.clientWidth*2-1,F.y=-(ht.offsetY/ie.domElement.clientHeight)*2+1,H.setFromCamera(F,Q)},oe=(ht,ct)=>{x(It=>{for(const Ft of It.elements)if(Ft.id===ht&&Ft.type===z.Roof&&Ft.roofType===Go.Mansard){Ft.ridgeWidth=ct;break}})},de=()=>{let ht=1/0;for(let ct=0;ct{const Ve={name:"Resize Mansard Roof Ridge",timestamp:Date.now(),resizedElementId:ht,resizedElementType:z.Roof,oldVal:It,newVal:Ft,type:ct,undo:()=>{oe(Ve.resizedElementId,Ve.oldVal)},redo:()=>{oe(Ve.resizedElementId,Ve.newVal)}};M.getState().addUndoable(Ve)},{currentWallArray:pe,isLoopRef:me}=y$e(A,n,o),{highestWallHeight:le,topZ:Te}=A$e(pe,S);pN(t,le);const ge=m.useMemo(()=>{if(pe.length<2)return new ae;const ht=Z(pe),ct=ye.calculatePolygonCentroid(ht);return Number.isNaN(ct.x)||Number.isNaN(ct.y)?new ae:new ae(ct.x,ct.y,Te)},[pe,Te]),Se=m.useMemo(()=>{const ht=pe.map(ct=>bn.getWallNormal(ct).multiplyScalar(ct.eavesLength??0));if(!me.current&&ht.length!==0){const ct=new ae().subVectors(new ae(pe[pe.length-1].rightPoint[0],pe[pe.length-1].rightPoint[1]),new ae(pe[0].leftPoint[0],pe[0].leftPoint[1])).applyEuler(AG).normalize().multiplyScalar(.3);ht.push(ct)}return ht},[pe]),Re=m.useMemo(()=>{const ht=pe.map((ct,It)=>({leftPoint:new ae(ct.leftPoint[0],ct.leftPoint[1]).add(Se[It]),rightPoint:new ae(ct.rightPoint[0],ct.rightPoint[1]).add(Se[It])}));return!me.current&&ht.length!==0&&ht.push({leftPoint:new ae(pe[pe.length-1].rightPoint[0],pe[pe.length-1].rightPoint[1]).add(Se[Se.length-1]),rightPoint:new ae(pe[0].leftPoint[0],pe[0].leftPoint[1]).add(Se[Se.length-1])}),ht},[pe,Se]),De=m.useMemo(()=>{const ht=pe.map((ct,It)=>{const Ft=new ae(ct.leftPoint[0],ct.leftPoint[1]),Ve=new ae(ct.rightPoint[0],ct.rightPoint[1]),ft=new ae().subVectors(ge,Ft).setZ(0).normalize().multiplyScalar(E),kt=new ae().subVectors(ge,Ve).setZ(0).normalize().multiplyScalar(E);return Ft.add(ft).setZ(Te),Ve.add(kt).setZ(Te),{leftPoint:Ft,rightPoint:Ve}});return!me.current&&ht.length!==0&&ht.push({leftPoint:ht[ht.length-1].rightPoint,rightPoint:ht[0].leftPoint}),ht},[pe,ge,E]),Ae=m.useMemo(()=>gbt.clone().multiplyScalar(u),[u]),ue=m.useMemo(()=>{const ht=[];if(pe.length<2)return ht;const ct=de();for(let It=0;It0&&Ft.rightPoint.length>0&&(Ft.leftPoint[0]!==Ft.rightPoint[0]||Ft.leftPoint[1]!==Ft.rightPoint[1])){const Ve=[];let{lh:ft,rh:kt}=bn.getWallHeight(pe,It);me.current||(It===0&&(ft=pe[0].lz),It===pe.length-1&&(kt=pe[pe.length-1].lz));const rt=bn.getIntersectionPoint(Re[(It+Re.length-1)%Re.length].leftPoint,Re[(It+Re.length-1)%Re.length].rightPoint,Re[It].leftPoint,Re[It].rightPoint).setZ(ft-ct).sub(ge),at=bn.getIntersectionPoint(Re[It].leftPoint,Re[It].rightPoint,Re[(It+1)%Re.length].leftPoint,Re[(It+1)%Re.length].rightPoint).setZ(kt-ct).sub(ge),Ge=De[It].leftPoint.clone().sub(ge),yt=De[It].rightPoint.clone().sub(ge),Pt=new ae(Ft.cx,Ft.cy).sub(ge.clone().setZ(0)).length();Ve.push(rt,at,yt,Ge),Ve.push(rt.clone().add(Ae),at.clone().add(Ae),yt.clone().add(Ae),Ge.clone().add(Ae)),ht.push({points:Ve,angle:-Ft.relativeAngle,length:Pt})}}if(!me.current){const It=Re.length-1,Ft=bn.getIntersectionPoint(Re[It-1].leftPoint,Re[It-1].rightPoint,Re[It].leftPoint,Re[It].rightPoint).setZ(pe[pe.length-1].lz-ct).sub(ge),Ve=bn.getIntersectionPoint(Re[It].leftPoint,Re[It].rightPoint,Re[0].leftPoint,Re[0].rightPoint).setZ(pe[0].lz-ct).sub(ge),ft=De[It].leftPoint.clone().sub(ge),kt=De[It].rightPoint.clone().sub(ge);let rt=Math.atan2(Ve.y-Ft.y,Ve.x-Ft.x);rt=rt>=0?rt:(sa+rt)%sa;const at=new ae().addVectors(Ft,Ve).setZ(0).divideScalar(2).length(),Ge=[];Ge.push(Ft,Ve,kt,ft),Ge.push(Ft.clone().add(Ae),Ve.clone().add(Ae),kt.clone().add(Ae),ft.clone().add(Ae)),ht.push({points:Ge,angle:-rt,length:at})}return ht},[pe,Te,E,u]),fe=m.useMemo(()=>{const ht=new kl;if(De.length>0){const ct=De[0].leftPoint.clone().sub(ge);ht.moveTo(ct.x,ct.y);for(const It of De){const Ft=It.rightPoint.clone().sub(ge);ht.lineTo(Ft.x,Ft.y)}ht.closePath()}return ht},[pe,De]),ve=m.useMemo(()=>{const ht=[];if(pe.length===0)return ht;ht.push(new ae().fromArray(pe[0].leftPoint));for(const ct of pe)ht.push(new ae().fromArray(ct.rightPoint));return ht},[pe]);m.useEffect(()=>{y!==E&&N(y)},[y]),m.useEffect(()=>{if(pe.length>1){if(M.getState().addedRoofIdSet.has(n)){for(let ht=0;ht{for(const It of ct.elements)if(It.id===pe[ht].id&&It.type===z.Wall){const Ft=It;Ft.roofId=n,Ft.leftRoofHeight=void 0,Ft.rightRoofHeight=void 0;break}});M.getState().deleteAddedRoofId(n)}}else b(n,!1,!1,!0)},[pe]),Oye(e,n,ue,ge,Te,u),m.useEffect(()=>{(P!==void 0||v!==void 0)&&x(ht=>{for(const ct of ht.elements)if(ct.type===z.Wall){const It=ct;It.roofId===n&&(It.centerLeftRoofHeight=void 0,It.centerRightRoofHeight=void 0)}else ct.type===z.Roof&&ct.roofType===Go.Mansard&&ct.id===n&&(ct.frontRidge=void 0,ct.backRidge=void 0)})},[]);const we=()=>{const ht=[];for(let It=0;It0&&Ft.rightPoint.length>0&&(Ft.leftPoint[0]!==Ft.rightPoint[0]||Ft.leftPoint[1]!==Ft.rightPoint[1])){let{lh:Ve,rh:ft}=bn.getWallHeight(pe,It);me.current||(It===0&&(Ve=pe[0].lz),It===pe.length-1&&(ft=pe[pe.length-1].lz));const kt=new ae(Ft.leftPoint[0],Ft.leftPoint[1],Ve),rt=new ae(Ft.rightPoint[0],Ft.rightPoint[1],ft),at=De[It].leftPoint.clone(),Ge=De[It].rightPoint.clone();ht.push([kt,rt,Ge,at])}}if(!me.current){const It=pe.length-1,Ft=pe[0],Ve=pe[It],ft=new ae(Ve.rightPoint[0],Ve.rightPoint[1],Ve.lz),kt=new ae(Ft.leftPoint[0],Ft.leftPoint[1],Ft.lz),rt=De[It].leftPoint.clone(),at=De[It].rightPoint.clone();ht.push([ft,kt,at,rt])}const ct=De.map(It=>It.leftPoint.clone());if(ht.push(ct),se){const It=[];for(const Ft of ht.slice(0,-1))It.push(Ft[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[It])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,ht)},Pe=fN(n,ge,ue,se,Go.Mansard,De.map(ht=>ht.leftPoint.clone().add(Ae)));hN(we);const Ie=M.getState().world,Me=M(pu),ze=dt(hs),Ne=M(Pf),Je=Cn(c1),[Ue,nt]=m.useState([]),[We,Ee]=m.useState(null),[ke,Oe]=m.useState(!1),st=dt(p3),je=M(e5),xt=M(a3),gt=M(l3),Ye=Cn(yW),it=Cn.getState().hourlyHeatExchangeArrayMap,ut=m.useRef(null),Qe=m.useRef(0),lt=m.useRef(),Ze=m.useRef(),{transparent:Be,opacity:$e}=tM();m.useEffect(()=>{if(ze)if(se){const ht=Je(n);if(ht){const ct=ye.fetchHeatmapTexture(ht,Ne??5);if(ct){const It=Pe();if(It&&It.length>0&&e){const Ft=new ln(0,0,e.rotation[2],"ZYX");let Ve=Number.MAX_VALUE,ft=Number.MAX_VALUE,kt=-Number.MAX_VALUE,rt=-Number.MAX_VALUE;for(const bt of It)for(const zt of bt){const Bt=zt.clone().applyEuler(Ft);Bt.x>kt&&(kt=Bt.x),Bt.xrt&&(rt=Bt.y),Bt.y{if(ut.current){const ht=fe.extractPoints(1).shape,ct=.01,It=ut.current.geometry,Ft=ht.length-1;if(Ft===4){const Ve=new Float32Array(18);Ve[0]=ht[3].x,Ve[1]=ht[3].y,Ve[2]=ct,Ve[3]=ht[0].x,Ve[4]=ht[0].y,Ve[5]=ct,Ve[6]=ht[2].x,Ve[7]=ht[2].y,Ve[8]=ct,Ve[9]=ht[2].x,Ve[10]=ht[2].y,Ve[11]=ct,Ve[12]=ht[0].x,Ve[13]=ht[0].y,Ve[14]=ct,Ve[15]=ht[1].x,Ve[16]=ht[1].y,Ve[17]=ct,It.setAttribute("position",new gr(Ve,3)),It.computeVertexNormals();const ft=ze?1:6,kt=[];kt.push(0,0),kt.push(ft,0),kt.push(0,ft),kt.push(0,ft),kt.push(ft,0),kt.push(ft,ft),It.setAttribute("uv",new gr(kt,2))}else{const Ve=ut.current.geometry,ft=new Float32Array(Ft*9),kt=ze?1:6,rt=[];let at=Number.MAX_VALUE,Ge=Number.MAX_VALUE,yt=-Number.MAX_VALUE,Pt=-Number.MAX_VALUE;for(const zt of ht)zt.x>yt?yt=zt.x:zt.xPt?Pt=zt.y:zt.y{if(!st||e&&e.notBuilding)return;const ht=it.get(n+"-"+ue.length);if(!ht)return;const ct=ht.reduce((wo,Io)=>wo+Io,0),It=Ye(n);if(!It||!It[ue.length])return;const Ft=It[ue.length].map(wo=>wo.clone().sub(ge).add(new ae(0,0,ge.z+u)));if(!Ft)return;const Ve=i3*(Ie.solarRadiationHeatmapGridCellSize??.5),ft=Ft[0].clone(),kt=Ft[1].clone(),rt=Ft[2].clone(),at=new ae().subVectors(kt,ft),Ge=new ae().subVectors(rt,ft),yt=new ae().subVectors(rt,kt),Pt=at.length(),ot=new ae().crossVectors(Ge,yt).length()/Pt,bt=Math.max(2,Math.floor(Pt/Ve)),zt=Math.max(2,Math.floor(ot/Ve));at.normalize(),Ge.normalize(),yt.normalize();const Bt=new ae().crossVectors(Ge,yt).normalize(),tt=at.multiplyScalar(.5*Pt/bt),Ht=new ae().crossVectors(Bt,at).normalize().multiplyScalar(.5*ot/zt),_t=ft.clone().add(tt).add(Ht).add(new ae(0,0,u));tt.multiplyScalar(2),Ht.multiplyScalar(2),lt.current=Bt.clone().multiplyScalar(.1);const qt=[],un=new ae,Rn=new Array;for(const wo of Ft)Rn.push({x:wo.x,y:wo.y});const yo=ye.getPolygonArea(Rn);if(yo===0)return;const Ao=ct/yo*(je??Qm);Qe.current=Ao<0?1:0,Ze.current=new ln(-Math.sign(Ao)*Qt,0,0);for(let wo=0;woht.elements.filter(ct=>ct.parentId===n&&ct.type===z.Window),cy),At=m.useMemo(()=>Gt.map(ht=>{const ct=new ae(ht.lx,ht.lz,ht.ly*2),It=new ae(ht.cx,ht.cy,ht.cz).sub(ge),Ft=new ln().fromArray([ht.rotation[0],ht.rotation[1],ht.rotation[2],"ZXY"]),Ve=new ls(new n3(ct.x,ct.y,ct.z));return Ve.position.copy(It),Ve.rotation.copy(Ft),Ve.updateMatrix(),Ve}),[Gt,ge]),pt=l===Ur.NoTexture&&s&&s===c,Wt=R&&!Be;return h.jsxs("group",{name:`Mansard Roof Group ${n}`,children:[h.jsx("group",{name:`Mansard Roof Segments Group ${n}`,position:[ge.x,ge.y,ge.z],userData:vt,onPointerDown:ht=>{cN(ht,e.id,n,ue,ge)},onPointerMove:ht=>{dN(ht,n)},onPointerUp:ht=>{uN(ht,t)},onContextMenu:ht=>{CR(ht,n)},children:se?h.jsx(FQ,{id:n,foundationModel:e,roofType:g,roofSegments:ue,center:new ae(ge.x,ge.y,Te),thickness:u,lineWidth:p,lineColor:f,sideColor:c,color:Rt,textureType:l,heatmap:We}):h.jsxs(h.Fragment,{children:[ue.map((ht,ct,It)=>h.jsx(u$,{id:n,index:ct,foundationModel:e,roofType:g,segment:ht,centroid:ge,thickness:u,color:Rt,sideColor:c,texture:T,heatmap:Ue&&ct0&&h.jsx(mbt,{roofSegments:ue,thickness:u,lineColor:f,lineWidth:p})]})}),C&&S>0&&h.jsx(zW,{points:ve,cz:pe[0].lz}),w&&!d&&h.jsxs("group",{position:[ge.x,ge.y,ge.z+u],children:[h.jsx(th,{position:[0,0,.3],onPointerDown:ht=>{if(Me(t.id,ht,Xo.Select),$.current=!0,G.current=S,D(!0),Ere.set(ge.x,ge.y,Te),e){const ct=-Math.atan2(Q.position.x-r,Q.position.y-i)-e.rotation[2];Fre.set(-Qt,0,ct,"ZXY")}j(Lr.Top),kn.getState().setEnableOrbitController(!1),x(ct=>{ct.resizeHandleType=Mt.Top,ct.selectedElementHeight=Te+t.thickness})},onPointerOver:()=>{x(ht=>{ht.hoveredHandle=Lr.Top,ht.selectedElementHeight=Te+t.thickness,ht.selectedElementX=ge.x,ht.selectedElementY=ge.y})}}),De.map((ht,ct)=>{const It=ht.leftPoint.clone().sub(ge);return h.jsx(th,{position:[It.x,It.y,0],onPointerDown:()=>{$.current=!0,D(!0),Ere.set(It.x,It.y,Te+.15),Fre.set(0,0,0),j(Lr.Ridge),O(ct),W(pe.reduce((Ft,Ve)=>Math.min(Ft,new ae(Ve.leftPoint[0],Ve.leftPoint[1],Te).distanceTo(ge)-1),1/0)),kn.getState().setEnableOrbitController(!1),V.current=E}},ct)})]}),k&&h.jsx(ta,{name:"Roof Intersection Plane",ref:q,args:[1e3,100],visible:!1,position:Ere,rotation:Fre,onPointerMove:ht=>{if(q.current&&$.current){te(ht);const ct=H.intersectObjects([q.current]);if(ct[0]&&e){const It=ct[0].point;if(It.z<.001)return;switch(L){case Lr.Top:{const Ft=Math.max(0,It.z-e.lz-.6-le);M.getState().updateRoofRiseById(n,Ft,Te+t.thickness);break}case Lr.Ridge:{if(e&&B!==null){const Ft=It.clone().applyEuler(new ln(0,0,e.rotation[2])).sub(new ae(e.cx,e.cy)).setZ(0),Ve=ee(B),ft=Ft.distanceTo(Ve),kt=new ae().subVectors(ge.clone().setZ(0),Ve);Ft.clone().sub(Ve).angleTo(kt){switch(L){case Lr.Top:{sN(n,G.current,S);break}case Lr.Ridge:{he(n,L,V.current,E);break}}x(ht=>{for(const ct of ht.elements)if(ct.id===n&&ct.type===z.Roof&&ct.roofType===Go.Mansard){ct.ridgeWidth=E;break}}),$.current=!1,D(!1),j(Lr.Null),O(null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})}),wt&&wt.map((ht,ct)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:ht,name:"Heat Flux "+ct,lineWidth:gt??Zm,color:xt??p0}),";",h.jsx(xf,{userData:{unintersectable:!0},position:lt.current?ht[Qe.current].clone().add(lt.current):ht[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:Ze.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:xt??p0})})]},ct))]})},Abt=be.memo(ybt,ZH);var IOe={exports:{}};/*! +`))),{vertexShader:n,fragmentShader:o}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const Age=new t3({color:16777215,side:ti,transparent:!0}),Cwe=8421504,Rwe=new Ki,gY=new le,Rre=new le,zz=[],r4t=new le,Hre="+x+y";function Hwe(t){return Array.isArray(t)?t[0]:t}let wje=()=>{const t=new ls(new zw(1,1),Age);return wje=()=>t,t},vje=()=>{const t=new ls(new zw(1,1,32,1),Age);return vje=()=>t,t};const i4t={type:"syncstart"},a4t={type:"synccomplete"},xje=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],l4t=xje.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let bje=class extends ls{constructor(){const e=new QAt;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=Cwe,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Hre,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(i4t),mje({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const o=this._queuedSyncs;o&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{o.forEach(r=>r&&r())})),this.dispatchEvent(a4t),e&&e()})))}onBeforeRender(e,n,o,r,i,a){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i),i._hadOwnSide=i.hasOwnProperty("side"),this.geometry.setSide(i._actualSide=i.side),i.side=Da}onAfterRender(e,n,o,r,i,a){i._hadOwnSide?i.side=i._actualSide:delete i.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Age.clone());if((!e||e.baseMaterial!==n)&&(e=this._derivedMaterial=o4t(n),n.addEventListener("dispose",function o(){n.removeEventListener("dispose",o),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let o=e._outlineMtl;return o||(o=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),o.isTextOutlineMaterial=!0,o.depthWrite=!1,o.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),o.dispose()})),[o,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return Hwe(this.material).getDepthMaterial()}get customDistanceMaterial(){return Hwe(this.material).getDistanceMaterial()}_prepareForRender(e){const n=e.isTextOutlineMaterial,o=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:l,blockBounds:s}=r;o.uTroikaSDFTexture.value=l,o.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),o.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,o.uTroikaSDFExponent.value=r.sdfExponent,o.uTroikaTotalBounds.value.fromArray(s),o.uTroikaUseGlyphColors.value=!n&&!!r.glyphColors;let c=0,u=0,d=0,f,p,g,A=0,y=0;if(n){let{outlineWidth:C,outlineOffsetX:P,outlineOffsetY:v,outlineBlur:T,outlineOpacity:w}=this;c=this._parsePercent(C)||0,u=Math.max(0,this._parsePercent(T)||0),f=w,A=this._parsePercent(P)||0,y=this._parsePercent(v)||0}else d=Math.max(0,this._parsePercent(this.strokeWidth)||0),d&&(g=this.strokeColor,o.uTroikaStrokeColor.value.set(g??Cwe),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;o.uTroikaDistanceOffset.value=c,o.uTroikaPositionOffset.value.set(A,y),o.uTroikaBlurRadius.value=u,o.uTroikaStrokeWidth.value=d,o.uTroikaStrokeOpacity.value=p,o.uTroikaFillOpacity.value=f??1,o.uTroikaCurveRadius.value=this.curveRadius||0;let S=this.clipRect;if(S&&Array.isArray(S)&&S.length===4)o.uTroikaClipRect.value.fromArray(S);else{const C=(this.fontSize||.1)*100;o.uTroikaClipRect.value.set(s[0]-C,s[1]-C,s[2]+C,s[3]+C)}this.geometry.applyClipRect(o.uTroikaClipRect.value)}o.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const i=n?this.outlineColor||0:this.color;if(i==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new rr;(i!==l._input||typeof i=="object")&&l.set(l._input=i)}let a=this.orientation||Hre;if(a!==e._orientation){let l=o.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let s=a!==Hre&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(s){let[,c,u,d,f]=s;gY.set(0,0,0)[u]=c==="-"?1:-1,Rre.set(0,0,0)[f]=d==="-"?-1:1,Rwe.lookAt(r4t,gY.cross(Rre),Rre),l.setFromMatrix4(Rwe)}else l.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),o=n?parseFloat(n[1]):NaN;e=(isNaN(o)?0:o/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new Kt){n.copy(e);const o=this.curveRadius;return o&&(n.x=Math.atan2(e.x,Math.abs(o)-Math.abs(e.z))*Math.abs(o)),n}worldPositionToTextCoords(e,n=new Kt){return gY.copy(e),this.localPositionToTextCoords(this.worldToLocal(gY),n)}raycast(e,n){const{textRenderInfo:o,curveRadius:r}=this;if(o){const i=o.blockBounds,a=r?vje():wje(),l=a.geometry,{position:s,uv:c}=l.attributes;for(let u=0;u{this[o]=e[o]}),this}clone(){return new this.constructor().copy(this)}};xje.forEach(t=>{const e="_private_"+t;Object.defineProperty(bje.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});const s4t=m.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:o,fontSize:r=1,children:i,characters:a,onSync:l,...s},c)=>{const u=ri(({invalidate:g})=>g),[d]=m.useState(()=>new bje),[f,p]=m.useMemo(()=>{const g=[];let A="";return m.Children.forEach(i,y=>{typeof y=="string"||typeof y=="number"?A+=y:g.push(y)}),[g,A]},[i]);return WUe(()=>new Promise(g=>VAt({font:o,characters:a},g)),["troika-text",o,a]),m.useLayoutEffect(()=>void d.sync(()=>{u(),l&&l(d)})),m.useEffect(()=>()=>d.dispose(),[d]),m.createElement("primitive",j9({object:d,ref:c,font:o,text:p,anchorX:e,anchorY:n,fontSize:r,sdfGlyphSize:t},s),f)}),Mwe=t=>t===Object(t)&&!Array.isArray(t)&&typeof t!="function";function Hb(t,e){const n=ri(r=>r.gl),o=r3(cf,Mwe(t)?Object.values(t):t);if(m.useLayoutEffect(()=>{e==null||e(o)},[e]),m.useEffect(()=>{"initTexture"in n&&(Array.isArray(o)?o:[o]).forEach(n.initTexture)},[n,o]),Mwe(t)){const r=Object.keys(t),i={};return r.forEach(a=>Object.assign(i,{[a]:o[r.indexOf(a)]})),i}else return o}Hb.preload=t=>r3.preload(cf,t);Hb.clear=t=>r3.clear(cf,t);function Sje(t,e,n){const o=ri(f=>f.size),r=ri(f=>f.viewport),i=typeof t=="number"?t:o.width*r.dpr,a=o.height*r.dpr,l=(typeof t=="number"?n:t)||{},{samples:s=0,depth:c,...u}=l,d=m.useMemo(()=>{const f=new $m(i,a,{minFilter:Gs,magFilter:Gs,type:_x,...u});return c&&(f.depthTexture=new Y1e(i,a,v2)),f.samples=s,f},[]);return m.useLayoutEffect(()=>{d.setSize(i,a),s&&(d.samples=s)},[s,d,i,a]),m.useEffect(()=>()=>d.dispose(),[]),d}const c4t=t=>typeof t=="function",u4t=m.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,children:o,makeDefault:r,...i},a)=>{const l=ri(({set:y})=>y),s=ri(({camera:y})=>y),c=ri(({size:y})=>y),u=m.useRef(null),d=m.useRef(null),f=Sje(e);m.useLayoutEffect(()=>{i.manual||u.current.updateProjectionMatrix()},[c,i]),m.useLayoutEffect(()=>{u.current.updateProjectionMatrix()}),m.useLayoutEffect(()=>{if(r){const y=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:y}))}},[u,r,l]);let p=0,g=null;const A=c4t(o);return Z2(y=>{A&&(n===1/0||ptypeof t=="function",f4t=m.forwardRef(({envMap:t,resolution:e=256,frames:n=1/0,makeDefault:o,children:r,...i},a)=>{const l=ri(({set:y})=>y),s=ri(({camera:y})=>y),c=ri(({size:y})=>y),u=m.useRef(null),d=m.useRef(null),f=Sje(e);m.useLayoutEffect(()=>{i.manual||(u.current.aspect=c.width/c.height)},[c,i]),m.useLayoutEffect(()=>{u.current.updateProjectionMatrix()});let p=0,g=null;const A=d4t(r);return Z2(y=>{A&&(n===1/0||p{if(o){const y=s;return l(()=>({camera:u.current})),()=>l(()=>({camera:y}))}},[u,o,l]),m.createElement(m.Fragment,null,m.createElement("perspectiveCamera",j9({ref:gge([u,a])},i),!A&&r),m.createElement("group",{ref:d},A&&r(f.texture)))});function gA(t,e){const n=t+"Geometry";return m.forwardRef(({args:o,children:r,...i},a)=>{const l=m.useRef(null);return m.useImperativeHandle(a,()=>l.current),m.useLayoutEffect(()=>void(e==null?void 0:e(l.current))),m.createElement("mesh",j9({ref:l},i),m.createElement(n,{attach:"geometry",args:o}),r)})}const si=gA("box"),uR=gA("circle"),xf=gA("cone"),ma=gA("cylinder"),Ps=gA("sphere"),ta=gA("plane"),wge=gA("torus"),wG=gA("ring"),aw=gA("extrude"),K5=1e-5;function h4t(t,e,n){const o=new kl,r=n-K5;return o.absarc(K5,K5,K5,-Math.PI/2,-Math.PI,!0),o.absarc(K5,e-r*2,K5,Math.PI,Math.PI/2,!0),o.absarc(t-r*2,e-r*2,K5,Math.PI/2,0,!0),o.absarc(t-r*2,K5,K5,0,-Math.PI/2,!0),o}const p4t=m.forwardRef(function({args:[e=1,n=1,o=1]=[],radius:r=.05,steps:i=1,smoothness:a=4,bevelSegments:l=4,creaseAngle:s=.4,children:c,...u},d){const f=m.useMemo(()=>h4t(e,n,r),[e,n,r]),p=m.useMemo(()=>({depth:o-r*2,bevelEnabled:!0,bevelSegments:l*2,steps:i,bevelSize:r-K5,bevelThickness:r,curveSegments:a}),[o,r,a]),g=m.useRef(null);return m.useLayoutEffect(()=>{g.current&&(g.current.center(),dAt(g.current,s))},[f,p]),m.createElement("mesh",j9({ref:d},u),m.createElement("extrudeGeometry",{ref:g,args:[f,p]}),c)});var Tje={exports:{}},g4t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",m4t=g4t,y4t=m4t;function Pje(){}function Cje(){}Cje.resetWarningCache=Pje;var A4t=function(){function t(o,r,i,a,l,s){if(s!==y4t){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Cje,resetWarningCache:Pje};return n.PropTypes=n,n};Tje.exports=A4t();var Bq=Tje.exports;const mo=Wi(Bq),kn=$K()((t,e)=>({setEnableOrbitController:n=>{M.getState().viewState.navigationView||t(o=>{var r;return(r=o.orbitControlsRef)!=null&&r.current&&(o.orbitControlsRef.current.enabled=n),o})},selectNone:()=>{t({humanRef:null,treeRef:null,foundationRef:null})},contentRef:null,compassRef:null,orbitControlsRef:null,humanRef:null,treeRef:null,flowerRef:null,foundationRef:null,cuboidRef:null,listenToAutoDeletionByCutRef:null,listenToAutoDeletionByDeleteRef:null,setListenToAutoDeletionByCut:n=>{const o=e().listenToAutoDeletionByCutRef;o&&(o.current=n)},setListenToAutoDeletionByDelete:n=>{const o=e().listenToAutoDeletionByDeleteRef;o&&(o.current=n)},canvas:null,pointer:new Kt,solarPanelCountRef:null}));var Ci=(t=>(t.Default="Default",t.Arched="Arched",t.Circular="Circular",t.Polygonal="Polygonal",t))(Ci||{});const Rje="/aladdin/assets/jaah-XpG2K-Xo.png",Hje="/aladdin/assets/jack-DVed1dhl.png",Mje="/aladdin/assets/jacob-D-6uVZRV.png",Ije="/aladdin/assets/jacqueline-DZtJs4FX.png",zje="/aladdin/assets/jade-Cxa-afE4.png",Dje="/aladdin/assets/jamelia-Bmq4EsGl.png",Eje="/aladdin/assets/james-QtBSrtsa.png",Fje="/aladdin/assets/jane-ZqCTWK8F.png",kje="/aladdin/assets/jaya-DD0RNxX8.png",Lje="/aladdin/assets/jaye-DPA2kSta.png",Wje="/aladdin/assets/jeanette-D3EEzZKV.png",Nje="/aladdin/assets/jedi-CUm23-QH.png",Uje="/aladdin/assets/jeff-931UF5LC.png",jje="/aladdin/assets/jena-qnIKFCdf.png",Bje="/aladdin/assets/jennifer-Cvadr5-Q.png",Yje="/aladdin/assets/jess-DyGUx_b1.png",Oje="/aladdin/assets/jett-B01M7z86.png",Vje="/aladdin/assets/jill-CxIC2A4v.png",_je="/aladdin/assets/jiya-CF0SpO2m.png",Gje="/aladdin/assets/joan-DWpjHIrM.png",Xje="/aladdin/assets/jocelyn-DGLHmbKA.png",Jje="/aladdin/assets/joel-DhW3d8dZ.png",Kje="/aladdin/assets/joey-Dmd3kcA2.png",qje="/aladdin/assets/john-QF2zQU-p.png",$je="/aladdin/assets/jonathon-TM1sY2jf.png",Qje="/aladdin/assets/jose-CtYKGQoQ.png",Zje="/aladdin/assets/joseph-C7wga7kl.png",eBe="/aladdin/assets/joshua-CqTzsm-K.png",tBe="/aladdin/assets/judd-C8GabaWl.png",nBe="/aladdin/assets/judy-Cv4UEjOl.png",oBe="/aladdin/assets/julia-Ckjw2r2H.png",rBe="/aladdin/assets/julio-CPCcOGMU.png",iBe="/aladdin/assets/jumapili-TjSAWyhv.png",aBe="/aladdin/assets/june-Bkxc2WDe.png",lBe="/aladdin/assets/juro-BAi3R6Hw.png",sBe="/aladdin/assets/justin-DLG1o6Q7.png";class kp{static fetchGender(e){switch(e){case Vt.Jaah:return Ha.Male;case Vt.Jacqueline:return Ha.Female;case Vt.Jade:return Ha.Female;case Vt.Jamelia:return Ha.Female;case Vt.James:return Ha.Male;case Vt.Jane:return Ha.Female;case Vt.Jaya:return Ha.Female;case Vt.Jaye:return Ha.Male;case Vt.Jeanette:return Ha.Female;case Vt.Jedi:return Ha.Male;case Vt.Jeff:return Ha.Male;case Vt.Jena:return Ha.Female;case Vt.Jennifer:return Ha.Female;case Vt.Jess:return Ha.Female;case Vt.Jett:return Ha.Male;case Vt.Jill:return Ha.Female;case Vt.Jiya:return Ha.Female;case Vt.Joan:return Ha.Female;case Vt.Jocelyn:return Ha.Female;case Vt.Joel:return Ha.Male;case Vt.Joey:return Ha.Female;case Vt.John:return Ha.Male;case Vt.Jonathon:return Ha.Male;case Vt.Jose:return Ha.Male;case Vt.Joseph:return Ha.Male;case Vt.Joshua:return Ha.Male;case Vt.Judd:return Ha.Male;case Vt.Judy:return Ha.Female;case Vt.Julia:return Ha.Female;case Vt.Julio:return Ha.Male;case Vt.Jumapili:return Ha.Female;case Vt.June:return Ha.Female;case Vt.Juro:return Ha.Male;case Vt.Justin:return Ha.Male;default:return Ha.Male}}static fetchLabel(e,n){switch(e){case Vt.Jaah:return Y.t("people.Jaah",n);case Vt.Jacob:return Y.t("people.Jacob",n);case Vt.Jacqueline:return Y.t("people.Jacqueline",n);case Vt.Jade:return Y.t("people.Jade",n);case Vt.Jamelia:return Y.t("people.Jamelia",n);case Vt.James:return Y.t("people.James",n);case Vt.Jane:return Y.t("people.Jane",n);case Vt.Jaya:return Y.t("people.Jaya",n);case Vt.Jaye:return Y.t("people.Jaye",n);case Vt.Jeanette:return Y.t("people.Jeanette",n);case Vt.Jedi:return Y.t("people.Jedi",n);case Vt.Jeff:return Y.t("people.Jeff",n);case Vt.Jena:return Y.t("people.Jena",n);case Vt.Jennifer:return Y.t("people.Jennifer",n);case Vt.Jess:return Y.t("people.Jess",n);case Vt.Jett:return Y.t("people.Jett",n);case Vt.Jill:return Y.t("people.Jill",n);case Vt.Jiya:return Y.t("people.Jiya",n);case Vt.Joan:return Y.t("people.Joan",n);case Vt.Jocelyn:return Y.t("people.Jocelyn",n);case Vt.Joel:return Y.t("people.Joel",n);case Vt.Joey:return Y.t("people.Joey",n);case Vt.John:return Y.t("people.John",n);case Vt.Jonathon:return Y.t("people.Jonathon",n);case Vt.Jose:return Y.t("people.Jose",n);case Vt.Joseph:return Y.t("people.Joseph",n);case Vt.Joshua:return Y.t("people.Joshua",n);case Vt.Judd:return Y.t("people.Judd",n);case Vt.Judy:return Y.t("people.Judy",n);case Vt.Julia:return Y.t("people.Julia",n);case Vt.Julio:return Y.t("people.Julio",n);case Vt.Jumapili:return Y.t("people.Jumapili",n);case Vt.June:return Y.t("people.June",n);case Vt.Juro:return Y.t("people.Juro",n);case Vt.Justin:return Y.t("people.Justin",n);default:return Y.t("people.Jack",n)}}static fetchHatOffsetY(e){switch(e){case Vt.Jonathon:return-.22}return 0}static fetchHatOffsetX(e){switch(e){case Vt.Jaah:return-.05;case Vt.Jack:return-.05;case Vt.Jacob:return .09;case Vt.Jade:return-.04;case Vt.Jaya:return .04;case Vt.Jaye:return 0;case Vt.Jamelia:return .05;case Vt.Jane:return .02;case Vt.Jeanette:return .08;case Vt.Jedi:return-.02;case Vt.Jeff:return-.05;case Vt.Jena:return .05;case Vt.Jennifer:return .02;case Vt.Jess:return .01;case Vt.Jett:return-.04;case Vt.Jill:return-.03;case Vt.Jiya:return-.03;case Vt.Joan:return-.45;case Vt.Jocelyn:return-.01;case Vt.Joel:return-.48;case Vt.Joey:return .01;case Vt.John:return .01;case Vt.Jonathon:return .02;case Vt.Jose:return .05;case Vt.Joseph:return .05;case Vt.Joshua:return-.01;case Vt.Judy:return .02;case Vt.Julia:return-.02;case Vt.Jumapili:return-.04;case Vt.June:return-.1;case Vt.Juro:return-.08;case Vt.Justin:return-.06;default:return 0}}static fetchHeight(e){switch(e){case Vt.Jaah:return 1.78;case Vt.Jack:return 1.8;case Vt.Jacob:return 1.82;case Vt.Jacqueline:return 1.78;case Vt.Jade:return 1.6;case Vt.James:return 1.75;case Vt.Jane:return 1.67;case Vt.Jaya:return 1.55;case Vt.Jaye:return 1.65;case Vt.Jamelia:return 1.8;case Vt.Jeanette:return 1.62;case Vt.Jedi:return 1.75;case Vt.Jeff:return 1.65;case Vt.Jena:return 1.6;case Vt.Jennifer:return 1.7;case Vt.Jess:return 1.5;case Vt.Jett:return 1.85;case Vt.Jill:return 1.71;case Vt.Jiya:return 1.74;case Vt.Joan:return 1.68;case Vt.Jocelyn:return 1.72;case Vt.Joel:return 1.75;case Vt.Joey:return 1.72;case Vt.John:return 1.85;case Vt.Jonathon:return 1.9;case Vt.Jose:return 1.6;case Vt.Joseph:return 1.88;case Vt.Joshua:return 1.79;case Vt.Judd:return 1.68;case Vt.Judy:return 1.75;case Vt.Julia:return 1.71;case Vt.Julio:return 1.76;case Vt.Jumapili:return 1.65;case Vt.June:return 1.85;case Vt.Juro:return 1.72;case Vt.Justin:return 1.755;default:return 1.8}}static fetchWidth(e){switch(e){case Vt.Jaah:return .74;case Vt.Jack:return .42;case Vt.Jacqueline:return .43;case Vt.Jacob:return .8;case Vt.Jade:return .48;case Vt.James:return .472;case Vt.Jane:return .4;case Vt.Jaya:return .6;case Vt.Jaye:return .55;case Vt.Jamelia:return .65;case Vt.Jeanette:return .4;case Vt.Jedi:return .56;case Vt.Jena:return .695;case Vt.Jennifer:return .45;case Vt.Jess:return .43;case Vt.Jill:return .42;case Vt.Joan:return 1.7;case Vt.Jocelyn:return .4;case Vt.Joel:return 1.8;case Vt.Joey:return .462;case Vt.John:return .6;case Vt.Jonathon:return .6;case Vt.Jose:return 2;case Vt.Joseph:return .6;case Vt.Joshua:return .5;case Vt.Judd:return .544;case Vt.Judy:return .41;case Vt.Julia:return .43;case Vt.Julio:return .5;case Vt.Jumapili:return .75;case Vt.June:return .65;case Vt.Juro:return .494;case Vt.Justin:return .6;default:return .6}}static fetchTextureImage(e){let n;switch(e){case Vt.Jaah:n=Rje;break;case Vt.Jacob:n=Mje;break;case Vt.Jacqueline:n=Ije;break;case Vt.Jade:n=zje;break;case Vt.Jamelia:n=Dje;break;case Vt.James:n=Eje;break;case Vt.Jane:n=Fje;break;case Vt.Jaya:n=kje;break;case Vt.Jaye:n=Lje;break;case Vt.Jeanette:n=Wje;break;case Vt.Jedi:n=Nje;break;case Vt.Jeff:n=Uje;break;case Vt.Jena:n=jje;break;case Vt.Jennifer:n=Bje;break;case Vt.Jess:n=Yje;break;case Vt.Jett:n=Oje;break;case Vt.Jill:n=Vje;break;case Vt.Jiya:n=_je;break;case Vt.Joan:n=Gje;break;case Vt.Jocelyn:n=Xje;break;case Vt.Joel:n=Jje;break;case Vt.Joey:n=Kje;break;case Vt.John:n=qje;break;case Vt.Jonathon:n=$je;break;case Vt.Jose:n=Qje;break;case Vt.Joseph:n=Zje;break;case Vt.Joshua:n=eBe;break;case Vt.Judd:n=tBe;break;case Vt.Judy:n=nBe;break;case Vt.Julia:n=oBe;break;case Vt.Julio:n=rBe;break;case Vt.Jumapili:n=iBe;break;case Vt.June:n=aBe;break;case Vt.Juro:n=lBe;break;case Vt.Justin:n=sBe;break;default:n=Hje}return n}}const w4t="/aladdin/assets/no_leaf_flower-CjefG9cq.png",v4t="/aladdin/assets/no_leaf_shrub-DDlKdxg_.png",cBe="/aladdin/assets/bellflower-C5sA-Fge.png",Gce="/aladdin/assets/boxwood-cAqkPwU6.png",Xce="/aladdin/assets/cactus_combo_1-DgrI_pBB.png",Jce="/aladdin/assets/cactus_combo_2-CnD7zsEV.png",Kce="/aladdin/assets/cactus_combo_3-CTLr6iHA.png",qce="/aladdin/assets/cactus_combo_4-Bv3aYeWB.png",uBe="/aladdin/assets/hibiscus-DqTQjw28.png",dBe="/aladdin/assets/hydrangea-D6uimbNa.png",fBe="/aladdin/assets/hosta-Ds5QIDtm.png",hBe="/aladdin/assets/peony-pnxufFxy.png",pBe="/aladdin/assets/red_rose-BhP67K90.png",gBe="/aladdin/assets/spirea-aOcGALMo.png",mBe="/aladdin/assets/sunflower-l75w306z.png",$ce="/aladdin/assets/tall_bush-g5bJ_GuV.png",yBe="/aladdin/assets/tulip-BqSv3XYD.png",ABe="/aladdin/assets/white_flower-BUfV78a-.png",wBe="/aladdin/assets/yellow_flower-BQ5dOM0H.png";class A8{static fetchSpread(e){switch(e){case ro.Bellflower:return .45;case ro.Boxwood:return 1.6;case ro.CactusCombo1:return 1;case ro.CactusCombo2:return 1;case ro.CactusCombo3:return 1;case ro.CactusCombo4:return 1;case ro.Hosta:return 1;case ro.Hibiscus:return 2;case ro.Hydrangea:return 2;case ro.Peony:return 1.5;case ro.RedRose:return .5;case ro.Spirea:return 1.8;case ro.Sunflower:return 1;case ro.TallBush:return 1;case ro.Tulip:return .4;case ro.YellowFlower:return 2;default:return .8}}static fetchHeight(e){switch(e){case ro.Bellflower:return .4;case ro.Boxwood:return 1.44;case ro.CactusCombo1:return 1.18;case ro.CactusCombo2:return 1.35;case ro.CactusCombo3:return 1.24;case ro.CactusCombo4:return 1.35;case ro.Hosta:return .7;case ro.Hibiscus:return 1.7;case ro.Hydrangea:return 1.5;case ro.Peony:return 1;case ro.RedRose:return .8;case ro.Spirea:return 1.6;case ro.Sunflower:return 2;case ro.TallBush:return 2;case ro.Tulip:return .7;case ro.YellowFlower:return 1.4;default:return .5}}static fetchLabel(e,n){switch(e){case ro.Bellflower:return Y.t("flower.Bellflower",n);case ro.Boxwood:return Y.t("flower.Boxwood",n);case ro.CactusCombo1:return Y.t("flower.CactusCombo1",n);case ro.CactusCombo2:return Y.t("flower.CactusCombo2",n);case ro.CactusCombo3:return Y.t("flower.CactusCombo3",n);case ro.CactusCombo4:return Y.t("flower.CactusCombo4",n);case ro.Hibiscus:return Y.t("flower.Hibiscus",n);case ro.Hydrangea:return Y.t("flower.Hydrangea",n);case ro.Hosta:return Y.t("flower.Hosta",n);case ro.Peony:return Y.t("flower.Peony",n);case ro.RedRose:return Y.t("flower.RedRose",n);case ro.Spirea:return Y.t("flower.Spirea",n);case ro.Sunflower:return Y.t("flower.Sunflower",n);case ro.TallBush:return Y.t("flower.TallBush",n);case ro.Tulip:return Y.t("flower.Tulip",n);case ro.YellowFlower:return Y.t("flower.YellowFlower",n);default:return Y.t("flower.WhiteFlower",n)}}static fetchTextureImage(e,n){if(n)return e===ro.Hibiscus||e===ro.Hydrangea||e===ro.YellowFlower||e===ro.Spirea?v4t:e===ro.Boxwood?Gce:e===ro.TallBush?$ce:e===ro.CactusCombo1?Xce:e===ro.CactusCombo2?Jce:e===ro.CactusCombo3?Kce:e===ro.CactusCombo4?qce:w4t;let o;switch(e){case ro.Bellflower:o=cBe;break;case ro.Boxwood:o=Gce;break;case ro.CactusCombo1:o=Xce;break;case ro.CactusCombo2:o=Jce;break;case ro.CactusCombo3:o=Kce;break;case ro.CactusCombo4:o=qce;break;case ro.Hibiscus:o=uBe;break;case ro.Hydrangea:o=dBe;break;case ro.Hosta:o=fBe;break;case ro.Peony:o=hBe;break;case ro.RedRose:o=pBe;break;case ro.Spirea:o=gBe;break;case ro.Sunflower:o=mBe;break;case ro.TallBush:o=$ce;break;case ro.Tulip:o=yBe;break;case ro.YellowFlower:o=wBe;break;default:o=ABe}return o}}class Va{static makeHuman(e,n,o,r,i){return{type:z.Human,name:e??Vt.Jack,cx:o,cy:r,cz:i,lx:kp.fetchWidth(e??Vt.Jack),lz:kp.fetchHeight(e??Vt.Jack),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Gi.generate()}}static makeTree(e,n,o,r,i,a,l){return{type:z.Tree,name:e??pr.Dogwood,cx:i,cy:a,cz:l,lx:n??3,lz:o??4,normal:[0,1,0],rotation:[0,0,0],parentId:r,id:Gi.generate()}}static makeSolarPanel(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y){let S;switch(e.type){case z.Foundation:S=e.id,y=z.Foundation;break;case z.Cuboid:S=e.id,y=z.Cuboid;break;case z.Wall:case z.Roof:S=e.parentId;break}return{type:z.SolarPanel,pvModelName:n.name,trackerType:Ll.NO_TRACKER,relativeAzimuth:u??0,tiltAngle:c??0,orientation:a??vr.landscape,drawSunBeam:!1,poleHeight:l??1,poleRadius:.05,poleSpacing:s??3,cx:o,cy:r,cz:i,lx:g??(a===vr.landscape?n.length:n.width),ly:A??(a===vr.landscape?n.width:n.length),lz:n.thickness,showLabel:!1,normal:d?d.toArray():[0,0,1],rotation:f||[0,0,0],color:"#fff",frameColor:p??"white",parentType:y??e.type,parentId:e.id,foundationId:S,id:Gi.generate(),version:1}}static makeSolarWaterHeater(e,n,o,r,i,a){const l=M.getState().actionState;return{type:z.SolarWaterHeater,cx:n,cy:o,cz:r,lx:2.092,ly:1.558+l.solarWaterHeaterTankRadius,lz:l.solarWaterHeaterHeight,waterTankRadius:l.solarWaterHeaterTankRadius,relativeAzimuth:l.solarWaterHeaterRelativeAzimuth,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],color:l.solarWaterHeaterColor,parentType:e.type,parentId:e.id,foundationId:e.parentId,id:Gi.generate()}}static makeBatteryStorage(e,n,o,r){return{type:z.BatteryStorage,id:Gi.generate(),parentId:e.id,foundationId:e.parentId,cx:n,cy:o,cz:r,lx:1,ly:.35,lz:1.6,normal:[0,-1,0],rotation:[0,0,0],color:"#C7BABE"}}static makeFlower(e,n,o,r,i){return{type:z.Flower,name:e??ro.YellowFlower,cx:o,cy:r,cz:i,lx:A8.fetchSpread(e??ro.YellowFlower),lz:A8.fetchHeight(e??ro.YellowFlower),normal:[0,1,0],rotation:[0,0,0],parentId:n,id:Gi.generate()}}static makeCuboid(e,n,o,r,i){return{type:z.Cuboid,cx:e,cy:n,cz:o?o/2:2,lx:.1,ly:.1,lz:o??4,color:"#808080",faceColors:r??["#808080","#808080","#808080","#808080","#808080","#808080"],textureTypes:i??[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],stackable:M.getState().actionState.cuboidStackable,transparency:M.getState().actionState.cuboidTransparency,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,selected:!1,id:Gi.generate()}}static makeFoundation(e,n,o,r,i){return{type:z.Foundation,cx:e,cy:n,cz:o?o/2:.05,lx:0,ly:0,lz:o??.1,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,selected:!1,color:r??"#808080",textureType:i??_i.NoTexture,solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:Gi.generate()}}static makeParabolicTrough(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A){let y;switch(e.type){case z.Foundation:y=e.id;break}return{type:z.ParabolicTrough,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:s??3,latusRectum:a??2,relativeAzimuth:0,tiltAngle:0,absorberTubeRadius:.05,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.05,cx:c,cy:u,cz:d,lx:g??2,ly:A??9,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:y,id:Gi.generate()}}static makeParabolicDish(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A){let y;switch(e.type){case z.Foundation:y=e.id;break}return{type:z.ParabolicDish,reflectance:n??.9,absorptance:o??.95,opticalEfficiency:r??.7,thermalEfficiency:i??.3,moduleLength:3,latusRectum:a??8,relativeAzimuth:0,tiltAngle:0,structureType:s??sf.CentralPole,receiverRadius:.25,receiverPoleRadius:.1,drawSunBeam:!1,poleHeight:l??.2,poleRadius:.2,cx:c,cy:u,cz:d,lx:g??4,ly:A??4,lz:.1,showLabel:!1,normal:f?f.toArray():[0,0,1],rotation:p||[0,0,0],parentId:e.id,foundationId:y,id:Gi.generate()}}static makeFresnelReflector(e,n,o,r,i,a,l,s,c,u,d,f){let p;switch(e.type){case z.Foundation:p=e.id;break}return{type:z.FresnelReflector,receiverId:n??"None",reflectance:o??.9,moduleLength:i??3,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.05,cx:a,cy:l,cz:s,lx:d??2,ly:f??9,lz:.1,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:p,id:Gi.generate()}}static makeWindTurbine(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P){let v;switch(e.type){case z.Foundation:v=e.id;break}return{type:z.WindTurbine,birdSafe:n,bladeColor:o,stripeColor:r,numberOfBlades:i,initialRotorAngle:a,relativeYawAngle:l,pitchAngle:s,bladeRadius:c,bladeTipWidth:.2,bladeRootRadius:u,maximumChordRadius:f,maximumChordLength:d,towerRadius:p,towerHeight:g,hubRadius:A,hubLength:y,cx:S,cy:C,cz:P,lx:p*4,ly:p*4,lz:g+c,normal:[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:v,id:Gi.generate()}}static makeHeliostat(e,n,o,r,i,a,l,s,c,u,d){let f;switch(e.type){case z.Foundation:f=e.id;break}return{type:z.Heliostat,towerId:n??"None",reflectance:o??.9,relativeAzimuth:0,tiltAngle:0,drawSunBeam:!1,poleHeight:r??.2,poleRadius:.1,cx:i,cy:a,cz:l,lx:u??2,ly:d??4,lz:.1,showLabel:!1,normal:s?s.toArray():[0,0,1],rotation:c||[0,0,0],parentId:e.id,foundationId:f,id:Gi.generate()}}static makePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=.2,u=.2,d=.2;let f=n,p=o;return e.type===z.Cuboid&&i?me.isUnitVectorX(i)?f=r:me.isUnitVectorY(i)&&(p=r):e.type===z.Wall&&(p=r),{type:z.Polygon,cx:f,cy:p,cz:0,lx:2*c,ly:2*u,lz:2*d,color:"#ffffff",normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],vertices:[{x:Math.max(-.5,f-c),y:Math.max(-.5,p-u)},{x:Math.max(-.5,f-c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.min(.5,p+u)},{x:Math.min(.5,f+c),y:Math.max(-.5,p-u)}],parentId:e.id,parentType:l,foundationId:s,selected:!1,filled:!0,selectedIndex:-1,id:Gi.generate()}}static makeWall(e,n,o,r,i){const a=M.getState().actionState;return{type:z.Wall,cx:n,cy:o,cz:r,lx:0,ly:a.wallThickness??.3,lz:a.wallHeight??5,parapet:a.wallParapet,eavesLength:a.wallEavesLength??.3,rValue:a.wallRValue??3,fill:Fl.Full,leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:a.wallHeight-.5,rightTopPartialHeight:a.wallHeight-.5,relativeAngle:0,leftPoint:[],rightPoint:[],leftJoints:[],rightJoints:[],textureType:a.wallTexture??Bo.Default,color:a.wallColor??"#ffffff",volumetricHeatCapacity:a.wallVolumetricHeatCapacity??.5,wallStructure:a.wallStructure??gc.Default,studSpacing:a.wallStructureSpacing??2,studWidth:a.wallStructureWidth??.1,studColor:a.wallStructureColor??"#ffffff",opacity:a.wallOpacity!==void 0?a.wallOpacity:.5,selected:!1,lineWidth:.2,lineColor:"#000000",windows:[],showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:[0,0,0],parentId:e.id,foundationId:e.id,id:Gi.generate()}}static makeSensor(e,n,o,r,i,a){let l;switch(e.type){case z.Foundation:case z.Cuboid:l=e.id;break;case z.Wall:case z.Roof:l=e.parentId;break}return{type:z.Sensor,cx:n,cy:o,cz:r,lx:.1,ly:.1,lz:.01,showLabel:!1,normal:i?i.toArray():[0,0,1],rotation:a||[0,0,0],parentId:e.id,foundationId:l,parentType:e.type,id:Gi.generate()}}static makeLight(e,n,o,r,i,a,l,s,c,u){let d;switch(e.type){case z.Foundation:case z.Cuboid:d=e.id;break;case z.Wall:case z.Roof:d=e.parentId;break}return{type:z.Light,decay:n??2,distance:o??5,intensity:r??3,color:i??"#ffff99",cx:a,cy:l,cz:s,lx:.16,ly:.16,lz:.08,showLabel:!1,normal:c?c.toArray():[0,0,1],rotation:u||[0,0,0],parentId:e.id,foundationId:d,parentType:e.type,id:Gi.generate()}}static makeWindow(e,n,o,r,i,a,l=0,s=0){let c,u=0;switch(e.type){case z.Cuboid:c=e.id;break;case z.Wall:c=e.parentId,u=e.ly;break;case z.Roof:c=e.parentId,u=e.thickness;break}const d=M.getState().actionState;return{type:z.Window,cx:n,cy:o,cz:r,lx:l,ly:u,lz:s,leftShutter:d.windowShutterLeft,rightShutter:d.windowShutterRight,shutterColor:d.windowShutterColor,shutterWidth:d.windowShutterWidth,horizontalMullion:d.windowHorizontalMullion,verticalMullion:d.windowVerticalMullion,mullionWidth:d.windowMullionWidth,horizontalMullionSpacing:d.windowHorizontalMullionSpacing,verticalMullionSpacing:d.windowVerticalMullionSpacing,mullionColor:d.windowMullionColor,frame:d.windowFrame,frameWidth:d.windowFrameWidth,sillWidth:bn.isTypeRoof(i)?0:d.windowSillWidth,windowType:d.windowType,empty:d.windowEmpty,interior:d.windowInterior,archHeight:d.windowArchHeight,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,color:d.windowColor??"#ffffff",tint:d.windowTint??"#73D8FF",opacity:d.windowOpacity!==void 0?d.windowOpacity:.5,uValue:d.windowUValue??.5,normal:[0,-1,0],rotation:a?[...a]:[0,0,0],parentId:e.id,parentType:i,foundationId:c,id:Gi.generate()}}static makeDoor(e){let n;switch(e.type){case z.Cuboid:n=e.id;break;case z.Wall:n=e.parentId;break}const o=M.getState().actionState;return{type:z.Door,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,doorType:o.doorType,filled:o.doorFilled,interior:o.doorInterior,archHeight:o.doorArchHeight,textureType:o.doorTexture??sr.Default,color:o.doorColor??"#ffffff",uValue:o.doorUValue??.5,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:e.id,foundationId:n,id:Gi.generate()}}static makePyramidRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Pyramid,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}static makeGableRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Gable,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate(),ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1]}}static makeHipRoof(e,n,o){const r=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Ur.Default,roofType:Go.Hip,roofStructure:Ac.Default,wallsId:[...e],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate(),leftRidgeLength:(o??2)/2,rightRidgeLength:(o??2)/2}}static makeGambrelRoof(e,n){const r=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:r.roofCeiling??!1,rise:r.roofRise<0?2:r.roofRise,thickness:r.roofThickness??.2,rValue:r.roofRValue??3,color:r.roofColor??"#454769",sideColor:r.roofSideColor??"#ffffff",textureType:r.roofTexture??Ur.Default,roofType:Go.Gambrel,roofStructure:Ac.Default,wallsId:[...e],topRidgePoint:[0,1],frontRidgePoint:[.35,.5],backRidgePoint:[.35,.5],selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}static makeMansardRoof(e,n){const o=M.getState().actionState;return{type:z.Roof,cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:o.roofCeiling??!1,rise:o.roofRise<0?2:o.roofRise,thickness:o.roofThickness??.2,rValue:o.roofRValue??3,color:o.roofColor??"#454769",sideColor:o.roofSideColor??"#ffffff",textureType:o.roofTexture??Ur.Default,roofType:Go.Mansard,roofStructure:Ac.Default,wallsId:[...e],ridgeWidth:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:n.id,foundationId:n.id,id:Gi.generate()}}}const x4t=t=>t.solarPanelArrayLayoutParams.pvModelName,b4t=t=>t.solarPanelArrayLayoutParams.rowAxis,S4t=t=>t.solarPanelArrayLayoutParams.rowsPerRack,T4t=t=>t.solarPanelArrayLayoutParams.interRowSpacing,P4t=t=>t.solarPanelArrayLayoutParams.margin,C4t=t=>t.solarPanelArrayLayoutParams.poleHeight,R4t=t=>t.solarPanelArrayLayoutParams.poleSpacing,H4t=t=>t.solarPanelArrayLayoutParams.tiltAngle,M4t=t=>t.solarPanelArrayLayoutParams.orientation,Yq=t=>t.viewState.navigationView,Cs=t=>t.viewState.shadowEnabled,Oq=t=>t.viewState.shadowCameraFar,vge=t=>t.viewState.solarPanelShininess,vBe=t=>t.viewState.windowShininess,e5=t=>t.viewState.heatFluxScaleFactor,a3=t=>t.viewState.heatFluxColor,l3=t=>t.viewState.heatFluxWidth,Pf=t=>t.viewState.solarRadiationHeatMapMaxValue,xge=t=>t.viewState.solarRadiationHeatMapReflectionOnly,bge=t=>t.viewState.axes,xBe=t=>t.viewState.ambientLightIntensity,bBe=t=>t.viewState.directLightIntensity,SBe=t=>t.viewState.theme,TBe=t=>t.viewState.showAzimuthAngle,PBe=t=>t.viewState.showElevationAngle,CBe=t=>t.viewState.showZenithAngle,RBe=t=>t.viewState.autoRotate,HBe=t=>t.viewState.hideAddress,mA=t=>t.viewState.groundImage,I4t=t=>t.viewState.groundImageType,MBe=t=>t.viewState.groundColor,IBe=t=>t.viewState.waterSurface,Ju=t=>t.viewState.orthographic,z4t=t=>t.viewState.enableRotate,D4t=t=>t.viewState.cameraPosition,E4t=t=>t.viewState.cameraZoom,zBe=t=>t.viewState.heliodon,DBe=t=>t.viewState.showSunAngles,Sge=t=>t.viewState.mapZoom,F4t=t=>t.viewState.mapTilt,EBe=t=>t.viewState.mapType,Tge=t=>t.viewState.showSiteInfoPanel,Vq=t=>t.viewState.showDesignInfoPanel,FBe=t=>t.viewState.showInstructionPanel,kBe=t=>t.viewState.showHeliodonPanel,k4t=t=>t.viewState.heliodonPanelX,L4t=t=>t.viewState.heliodonPanelY,W4t=t=>t.viewState.showMapPanel,N4t=t=>t.viewState.mapPanelX,U4t=t=>t.viewState.mapPanelY,j4t=t=>t.viewState.showWeatherPanel,B4t=t=>t.viewState.weatherPanelRect,Y4t=t=>t.viewState.showDiurnalTemperaturePanel,O4t=t=>t.viewState.diurnalTemperaturePanelRect,LBe=t=>t.viewState.showStickyNotePanel,V4t=t=>t.viewState.stickyNotePanelRect,_4t=t=>t.viewState.showDailyBuildingEnergyPanel,G4t=t=>t.viewState.dailyBuildingEnergyPanelRect,X4t=t=>t.viewState.showYearlyBuildingEnergyPanel,J4t=t=>t.viewState.yearlyBuildingEnergyPanelRect,WBe=t=>t.viewState.showDailyLightSensorPanel,K4t=t=>t.viewState.dailyLightSensorPanelRect,q4t=t=>t.viewState.showYearlyLightSensorPanel,$4t=t=>t.viewState.yearlyLightSensorPanelRect,Q4t=t=>t.viewState.yearlyLightSensorPanelShowDaylight,Z4t=t=>t.viewState.yearlyLightSensorPanelShowClearness,NBe=t=>t.viewState.showDailyPvYieldPanel,e8t=t=>t.viewState.dailyPvYieldPanelRect,t8t=t=>t.viewState.showYearlyPvYieldPanel,n8t=t=>t.viewState.yearlyPvYieldPanelRect,o8t=t=>t.viewState.showSolarPanelVisibilityResultsPanel,r8t=t=>t.viewState.visibilityResultsPanelRect,UBe=t=>t.viewState.showDailyParabolicTroughYieldPanel,i8t=t=>t.viewState.dailyParabolicTroughYieldPanelRect,a8t=t=>t.viewState.showYearlyParabolicTroughYieldPanel,l8t=t=>t.viewState.yearlyParabolicTroughYieldPanelRect,jBe=t=>t.viewState.showDailyParabolicDishYieldPanel,s8t=t=>t.viewState.dailyParabolicDishYieldPanelRect,c8t=t=>t.viewState.showYearlyParabolicDishYieldPanel,u8t=t=>t.viewState.yearlyParabolicDishYieldPanelRect,BBe=t=>t.viewState.showDailyFresnelReflectorYieldPanel,d8t=t=>t.viewState.dailyFresnelReflectorYieldPanelRect,f8t=t=>t.viewState.showYearlyFresnelReflectorYieldPanel,h8t=t=>t.viewState.yearlyFresnelReflectorYieldPanelRect,YBe=t=>t.viewState.showDailyHeliostatYieldPanel,p8t=t=>t.viewState.dailyHeliostatYieldPanelRect,g8t=t=>t.viewState.showYearlyHeliostatYieldPanel,m8t=t=>t.viewState.yearlyHeliostatYieldPanelRect,OBe=t=>t.viewState.showDailyUpdraftTowerYieldPanel,y8t=t=>t.viewState.dailyUpdraftTowerYieldPanelRect,A8t=t=>t.viewState.showYearlyUpdraftTowerYieldPanel,w8t=t=>t.viewState.yearlyUpdraftTowerYieldPanelRect,v8t=t=>t.viewState.showEvolutionPanel,x8t=t=>t.viewState.evolutionPanelRect,s0=t=>t.world.latitude,Mb=t=>t.world.longitude,Al=t=>t.world.date,Pge=t=>t.world.leafDayOfYear1,Cge=t=>t.world.leafDayOfYear2,b8t=t=>t.world.ground,_q=t=>t.world.address,S8t=t=>t.world.countryCode,T8t=t=>t.world.airAttenuationCoefficient,P8t=t=>t.world.airConvectiveCoefficient,VBe=t=>t.world.timesPerHour,zH=t=>t.world.daysPerYear,C8t=t=>t.world.discretization,_Be=t=>t.world.diurnalTemperatureModel,gW=t=>t.world.highestTemperatureTimeInMinutes,R8t=t=>t.world.solarRadiationHeatmapGridCellSize,H8t=t=>t.world.pvGridCellSize,M8t=t=>t.world.solarPanelVisibilityGridCellSize,I8t=t=>t.world.cspTimesPerHour,mW=t=>t.world.cspDaysPerYear,z8t=t=>t.world.cspGridCellSize,D8t=t=>t.world.sutTimesPerHour,GBe=t=>t.world.sutDaysPerYear,E8t=t=>t.world.sutGridCellSize,Rge=t=>t.world.noAnimationForHeatmapSimulation,F8t=t=>t.world.noAnimationForThermalSimulation,Hge=t=>t.world.noAnimationForSensorDataCollection,Mge=t=>t.world.noAnimationForSolarPanelSimulation,XBe=t=>t.world.noAnimationForSolarUpdraftTowerSimulation,pn=t=>t.set,yp=t=>t.user,k8t=t=>t.userCount,L8t=t=>t.showSolarPanelCustomizationPanel,W8t=t=>t.showEconomicsPanel,N8t=t=>t.showNavigationPanel,U8t=t=>t.showShadowSettings,j8t=t=>t.minimumNavigationMoveSpeed,B8t=t=>t.minimumNavigationTurnSpeed,Y8t=t=>t.navigationMoveSpeed,O8t=t=>t.navigationTurnSpeed,c1=t=>t.getHeatmap,Ige=t=>t.setHeatmap,JBe=t=>t.clearHeatmaps,zge=t=>t.flagOfDailySimulation,Ib=t=>t.hourlyHeatExchangeArrayMap,V8t=t=>t.setHourlyHeatExchangeArray,_8t=t=>t.hourlySolarHeatGainArrayMap,G8t=t=>t.setHourlySolarHeatGainArray,X8t=t=>t.hourlySolarPanelOutputArrayMap,J8t=t=>t.setHourlySolarPanelOutputArray,Dge=t=>t.getRoofSegmentVertices,yW=t=>t.getRoofSegmentVerticesWithoutOverhang,K8t=t=>t.latestVersion,KBe=t=>t.changed,q8t=t=>t.setChanged,$8t=t=>t.setSkipChange,no=t=>t.applyCount,Qn=t=>t.setApplyCount,Xi=t=>t.revertApply,Kn=t=>t.elements,Q8t=t=>t.notes,DH=t=>t.supportedPvModules,EH=t=>t.customPvModules,Z8t=t=>t.loadSupportedPvModules,ewt=t=>t.addCustomPvModule,twt=t=>t.removeCustomPvModule,t5=t=>t.getPvModule,hu=t=>t.floatingWindowOpacity,Sc=t=>t.selectedFloatingWindow,m0=t=>t.language,nwt=t=>t.locale,oa=t=>t.loggable,owt=t=>t.actionInfo,rwt=t=>t.currentUndoable,Gq=t=>t.openModelsMap,iwt=t=>t.modelsMapLatitude,awt=t=>t.modelsMapLongitude,lwt=t=>t.modelsMapZoom,swt=t=>t.modelsMapTilt,Ege=t=>t.modelsMapType,qBe=t=>t.modelsMapWeatherStations,cwt=t=>t.showCloudFileTitleDialog,$Be=t=>t.showCloudFileTitleDialogFlag,zb=t=>t.cloudFile,uwt=t=>t.latestModelSite,QBe=t=>t.modelSites,dwt=t=>t.allModelSites,ZBe=t=>t.peopleModels,fwt=t=>t.allPeopleModels,hwt=t=>t.saveAccountSettingsFlag,pwt=t=>t.saveCloudFileFlag,gwt=t=>t.createProjectFlag,mwt=t=>t.saveProjectAsFlag,ywt=t=>t.curateDesignToProjectFlag,Awt=t=>t.showProjectsFlag,wwt=t=>t.updateProjectsFlag,vwt=t=>t.modelsMapFlag,eYe=t=>t.showModelsAllTime,tYe=t=>t.showModelsFromDate,nYe=t=>t.showModelsToDate,xwt=t=>t.leaderboardFlag,bwt=t=>t.showLeaderboard,Swt=t=>t.publishOnModelsMapFlag,Twt=t=>t.listCloudFilesFlag,Pwt=t=>t.refreshCloudFilesFlag,Cwt=t=>t.localContentToImportAfterCloudFileUpdate,Rwt=t=>t.localFileName,Hwt=t=>t.createNewFileFlag,Mwt=t=>t.openLocalFileFlag,oYe=t=>t.saveLocalFileDialogVisible,FH=t=>t.fileChanged,Fge=t=>t.undoManager,En=t=>t.addUndoable,kge=t=>t.importContent,rYe=t=>t.exportContent,Iwt=t=>t.clearContent,iYe=t=>t.createEmptyFile,zwt=t=>t.aabb,aYe=t=>t.animateSun,Dwt=t=>t.animate24Hours,AW=t=>t.runDailyThermalSimulation,Ewt=t=>t.pauseDailyThermalSimulation,Xq=t=>t.runYearlyThermalSimulation,Fwt=t=>t.pauseYearlyThermalSimulation,kwt=t=>t.clearDailySimulationResultsFlag,Lwt=t=>t.clearYearlySimulationResultsFlag,wW=t=>t.runDynamicSimulation,Lge=t=>t.runStaticSimulation,Wwt=t=>t.pauseSimulation,n5=t=>t.runEvolution,Jq=t=>t.pauseEvolution,Kq=t=>t.objectiveEvaluationIndex,kH=t=>t.evolutionMethod,Nwt=t=>t.updateSceneRadiusFlag,lYe=t=>t.updateSceneRadius,ay=t=>t.sceneRadius,Uwt=t=>t.cameraDirection,Wge=t=>t.getCameraDirection,Jn=t=>t.getElementById,yA=t=>t.getFoundation,Gr=t=>t.getParent,LH=t=>t.getChildren,s3=t=>t.getChildrenOfType,c3=t=>t.selectedElement,jwt=t=>t.selectedElementIdSet,Db=t=>t.getSelectedElement,Nge=t=>t.overlapWithSibling,sYe=t=>t.selectedSideIndex,u3=t=>t.setElementPosition,Uge=t=>t.setElementSize,Bwt=t=>t.setElementNormal,Ywt=t=>t.updateElementLockById,Owt=t=>t.updateElementReferenceById,Vwt=t=>t.updateElementLabelById,_wt=t=>t.updateElementShowLabelById,cYe=t=>t.updateElementCxById,uYe=t=>t.updateElementCyById,Gwt=t=>t.updateElementCzById,Xwt=t=>t.updateElementCzForAll,d3=t=>t.updateElementLxById,qq=t=>t.updateElementLxAboveFoundation,vW=t=>t.updateElementLxForAll,Fw=t=>t.updateElementLyById,$q=t=>t.updateElementLyAboveFoundation,xW=t=>t.updateElementLyForAll,jge=t=>t.updateElementLzById,Jwt=t=>t.updateElementLzForAll,dYe=t=>t.updateElementColorById,Kwt=t=>t.updateElementColorOnSurface,qwt=t=>t.updateElementColorAboveFoundation,fYe=t=>t.updateElementColorForAll,$wt=t=>t.updateElementLineColorById,Qwt=t=>t.updateElementLineColorOnSurface,Zwt=t=>t.updateElementLineColorAboveFoundation,e7t=t=>t.updateElementLineColorForAll,t7t=t=>t.updateElementLineWidthById,n7t=t=>t.updateElementLineWidthOnSurface,o7t=t=>t.updateElementLineWidthAboveFoundation,r7t=t=>t.updateElementLineWidthForAll,Bge=t=>t.updateElementRotationById,i7t=t=>t.updateElementRotationForAll,$s=t=>t.foundationActionScope,a7t=t=>t.setFoundationActionScope,WH=t=>t.polygonActionScope,NH=t=>t.setPolygonActionScope,hYe=t=>t.updatePolygonVertexPositionById,kw=t=>t.updatePolygonVerticesById,Eb=t=>t.cuboidActionScope,Fb=t=>t.setCuboidActionScope,xh=t=>t.solarPanelActionScope,bh=t=>t.setSolarPanelActionScope,Yge=t=>t.solarWaterHeaterActionScope,Oge=t=>t.setSolarWaterHeaterActionScope,bW=t=>t.updateSolarCollectorDailyYieldById,SW=t=>t.updateSolarCollectorYearlyYieldById,l7t=t=>t.updateSolarPanelTiltAngleById,pYe=t=>t.updateSolarCollectorDrawSunBeamById,gYe=t=>t.updateSolarCollectorDrawSunBeamAboveFoundation,mYe=t=>t.updateSolarCollectorDrawSunBeamForAll,Qq=t=>t.updateSolarCollectorRelativeAzimuthById,yYe=t=>t.updateSolarCollectorRelativeAzimuthOnSurface,AYe=t=>t.updateSolarCollectorRelativeAzimuthAboveFoundation,wYe=t=>t.updateSolarCollectorRelativeAzimuthForAll,s7t=t=>t.updateSolarCollectorXById,c7t=t=>t.updateSolarCollectorXAboveFoundation,u7t=t=>t.updateSolarCollectorXForAll,d7t=t=>t.updateSolarCollectorYById,f7t=t=>t.updateSolarCollectorYAboveFoundation,h7t=t=>t.updateSolarCollectorYForAll,TW=t=>t.updateSolarCollectorPoleHeightById,p7t=t=>t.updateSolarCollectorPoleHeightOnSurface,PW=t=>t.updateSolarCollectorPoleHeightAboveFoundation,CW=t=>t.updateSolarCollectorPoleHeightForAll,vYe=t=>t.updateSolarCollectorPoleRadiusById,xYe=t=>t.updateSolarCollectorPoleRadiusAboveFoundation,bYe=t=>t.updateSolarCollectorPoleRadiusForAll,Zq=t=>t.updateCspReflectanceById,e$=t=>t.updateCspReflectanceAboveFoundation,t$=t=>t.updateCspReflectanceForAll,SYe=t=>t.updateParabolicCollectorAbsorptanceById,TYe=t=>t.updateParabolicCollectorAbsorptanceAboveFoundation,PYe=t=>t.updateParabolicCollectorAbsorptanceForAll,CYe=t=>t.updateParabolicCollectorOpticalEfficiencyById,RYe=t=>t.updateParabolicCollectorOpticalEfficiencyAboveFoundation,HYe=t=>t.updateParabolicCollectorOpticalEfficiencyForAll,MYe=t=>t.updateParabolicCollectorThermalEfficiencyById,IYe=t=>t.updateParabolicCollectorThermalEfficiencyAboveFoundation,zYe=t=>t.updateParabolicCollectorThermalEfficiencyForAll,AA=t=>t.parabolicTroughActionScope,wA=t=>t.setParabolicTroughActionScope,kb=t=>t.fresnelReflectorActionScope,Lb=t=>t.setFresnelReflectorActionScope,Wb=t=>t.heliostatActionScope,Nb=t=>t.setHeliostatActionScope,DYe=t=>t.updateSolarReceiverById,EYe=t=>t.updateSolarReceiverAboveFoundation,FYe=t=>t.updateSolarReceiverForAll,vA=t=>t.parabolicDishActionScope,xA=t=>t.setParabolicDishActionScope,kYe=t=>t.updateParabolaLatusRectumById,LYe=t=>t.updateParabolaLatusRectumAboveFoundation,WYe=t=>t.updateParabolaLatusRectumForAll,NYe=t=>t.updateModuleLengthById,UYe=t=>t.updateModuleLengthAboveFoundation,jYe=t=>t.updateModuleLengthForAll,f3=t=>t.windTurbineActionScope,h3=t=>t.setWindTurbineActionScope,BYe=t=>t.copyElementById,Ap=t=>t.removeElementById,g7t=t=>t.clearDeletedElements,m7t=t=>t.countElementsByReferenceId,Vge=t=>t.removeElementsByReferenceId,YYe=t=>t.pasteElementsToPoint,y7t=t=>t.pasteElementsByKey,OYe=t=>t.elementsToPaste,pu=t=>t.selectMe,RW=t=>t.selectNone,_ge=t=>t.addElement,n$=t=>t.objectTypeToAdd,A7t=t=>t.actionModeLock,Ng=t=>t.countElementsByType,VYe=t=>t.countSolarStructuresByType,w7t=t=>t.countObservers,v7t=t=>t.countSolarPanelsOnRack,x7t=t=>t.selectedElementAngle,b7t=t=>t.waiting,Cf=t=>t.simulationInProgress,Gge=t=>t.simulationPaused,_Ye=t=>t.evolutionInProgress,GYe=t=>t.evolutionPaused,S7t=t=>t.contextMenuObjectType,T7t=t=>t.enableFineGrid,P7t=t=>t.setEnableFineGrid,C7t=t=>t.showCloudFilePanel,Xge=t=>t.projectState.title,XYe=t=>t.projectState.owner,R7t=t=>t.projectState.description,H7t=t=>t.projectState.designs,M7t=t=>t.projectState.type,JYe=t=>t.projectState.selectedProperty,I7t=t=>t.projectState.dataColoring,z7t=t=>t.projectState.thumbnailWidth,D7t=t=>t.projectState.xAxisNameScatterPlot,E7t=t=>t.projectState.yAxisNameScatterPlot,F7t=t=>t.projectState.dotSizeScatterPlot,k7t=t=>t.projectState.sortDescending,L7t=t=>t.projectState.filters,W7t=t=>t.projectState.ranges,N7t=t=>t.projectState.hiddenParameters,HW=t=>t.projectView,U7t=t=>t.showProjectListPanel,j7t=t=>t.showModelsGallery,B7t=t=>t.showAccountSettingsPanel,Y7t=t=>t.showLikesPanel,O7t=t=>t.showPublishedModelsPanel,V7t=t=>t.weatherModel,KYe=t=>t.setWeatherModel,Jge=t=>t.weatherData,_7t=t=>t.loadWeatherData,G7t=t=>t.loadHorizontalSolarRadiationData,X7t=t=>t.getHorizontalSolarRadiation,J7t=t=>t.loadVerticalSolarRadiationData,K7t=t=>t.getVerticalSolarRadiation,qYe=t=>t.getClosestCity,Lw=t=>t.sunlightDirection,q7t=t=>t.setSunlightDirection,hs=t=>t.showSolarRadiationHeatmap,$7t=t=>t.selectButtonClicked,p3=t=>t.showHeatFluxes,Q7t=t=>t.runSolarPanelVisibilityAnalysis,Z7t=t=>t.solarPanelVisibilityResults,$Ye=t=>t.runDailySimulationForSolarPanels,evt=t=>t.runDailySimulationForSolarPanelsLastStep,QYe=t=>t.runYearlySimulationForSolarPanels,tvt=t=>t.runYearlySimulationForSolarPanelsLastStep,nvt=t=>t.pauseDailySimulationForSolarPanels,ovt=t=>t.pauseYearlySimulationForSolarPanels,rvt=t=>t.dailyPvYield,ZYe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyPvIndividualOutputs},ivt=t=>t.setDailyPvYield,avt=t=>t.yearlyPvYield,eOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyPvIndividualOutputs},lvt=t=>t.setYearlyPvYield,tOe=t=>t.solarPanelLabels,svt=t=>t.setSolarPanelLabels,nOe=t=>t.setTotalBuildingHeater,oOe=t=>t.setTotalBuildingAc,rOe=t=>t.setTotalBuildingSolarPanel,cvt=t=>t.runDailySimulationForParabolicTroughs,uvt=t=>t.runYearlySimulationForParabolicTroughs,dvt=t=>t.pauseDailySimulationForParabolicTroughs,fvt=t=>t.pauseYearlySimulationForParabolicTroughs,hvt=t=>t.dailyParabolicTroughYield,iOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicTroughIndividualOutputs},pvt=t=>t.setDailyParabolicTroughYield,gvt=t=>t.yearlyParabolicTroughYield,aOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicTroughIndividualOutputs},mvt=t=>t.setYearlyParabolicTroughYield,lOe=t=>t.parabolicTroughLabels,yvt=t=>t.setParabolicTroughLabels,Avt=t=>t.runDailySimulationForFresnelReflectors,wvt=t=>t.runYearlySimulationForFresnelReflectors,vvt=t=>t.pauseDailySimulationForFresnelReflectors,xvt=t=>t.pauseYearlySimulationForFresnelReflectors,bvt=t=>t.dailyFresnelReflectorYield,sOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyFresnelReflectorIndividualOutputs},Svt=t=>t.setDailyFresnelReflectorYield,Tvt=t=>t.yearlyFresnelReflectorYield,cOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyFresnelReflectorIndividualOutputs},Pvt=t=>t.setYearlyFresnelReflectorYield,uOe=t=>t.fresnelReflectorLabels,Cvt=t=>t.setFresnelReflectorLabels,Rvt=t=>t.runDailySimulationForHeliostats,Hvt=t=>t.runYearlySimulationForHeliostats,Mvt=t=>t.pauseDailySimulationForHeliostats,Ivt=t=>t.pauseYearlySimulationForHeliostats,zvt=t=>t.dailyHeliostatYield,dOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyHeliostatIndividualOutputs},Dvt=t=>t.setDailyHeliostatYield,Evt=t=>t.yearlyHeliostatYield,fOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyHeliostatIndividualOutputs},Fvt=t=>t.setYearlyHeliostatYield,hOe=t=>t.heliostatLabels,kvt=t=>t.setHeliostatLabels,pOe=t=>t.runDailySimulationForUpdraftTower,gOe=t=>t.runYearlySimulationForUpdraftTower,Lvt=t=>t.pauseDailySimulationForUpdraftTower,Wvt=t=>t.pauseYearlySimulationForUpdraftTower,Nvt=t=>t.dailyUpdraftTowerResults,Uvt=t=>t.dailyUpdraftTowerYield,jvt=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyUpdraftTowerIndividualOutputs},Bvt=t=>t.setDailyUpdraftTowerResults,Yvt=t=>t.setDailyUpdraftTowerYield,Ovt=t=>t.yearlyUpdraftTowerYield,Vvt=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyUpdraftTowerIndividualOutputs},_vt=t=>t.setYearlyUpdraftTowerYield,mOe=t=>t.updraftTowerLabels,Gvt=t=>t.setUpdraftTowerLabels,Xvt=t=>t.runDailySimulationForParabolicDishes,Jvt=t=>t.runYearlySimulationForParabolicDishes,Kvt=t=>t.pauseDailySimulationForParabolicDishes,qvt=t=>t.pauseYearlySimulationForParabolicDishes,$vt=t=>t.dailyParabolicDishYield,yOe=t=>{var e;return(e=t.graphState)==null?void 0:e.dailyParabolicDishIndividualOutputs},Qvt=t=>t.setDailyParabolicDishYield,Zvt=t=>t.yearlyParabolicDishYield,AOe=t=>{var e;return(e=t.graphState)==null?void 0:e.yearlyParabolicDishIndividualOutputs},ext=t=>t.setYearlyParabolicDishYield,wOe=t=>t.parabolicDishLabels,txt=t=>t.setParabolicDishLabels,vOe=t=>t.runDailyLightSensor,nxt=t=>t.pauseDailyLightSensor,xOe=t=>t.runYearlyLightSensor,oxt=t=>t.pauseYearlyLightSensor,rxt=t=>t.dailyLightSensorData,ixt=t=>t.setDailyLightSensorData,axt=t=>t.yearlyLightSensorData,lxt=t=>t.setYearlyLightSensorData,bOe=t=>t.sensorLabels,sxt=t=>t.setSensorLabels,ly=t=>t.hoveredHandle,Ub=t=>t.moveHandleType,Ug=t=>t.resizeHandleType,Kge=t=>t.getResizeHandlePosition,o$=t=>t.rotateHandleType,cxt=t=>t.resizeAnchor,qge=t=>t.isAddingElement,r$=t=>t.addedFoundationId,uxt=t=>t.deletedFoundationId,i$=t=>t.addedCuboidId,dxt=t=>t.deletedCuboidId,SOe=t=>t.addedWallId,fxt=t=>t.deletedWallId,hxt=t=>t.deletedRoofId,$ge=t=>t.deletedRoofIdSet,TOe=t=>t.autoDeletedRoofIdSet,pxt=t=>t.autoDeletedRoofs,POe=t=>t.autoDeletedChild,COe=t=>t.groupActionMode,gxt=t=>t.groupActionUpdateFlag,mxt=t=>t.addedWindowId,yxt=t=>t.addedDoorId,Axt=t=>t.updateWallMapOnFoundationFlag,g3=t=>t.wallActionScope,sy=t=>t.roofActionScope,MW=t=>t.windowActionScope,Ww=t=>t.doorActionScope,ROe=t=>t.setRoofActionScope,Qge=t=>t.updateWallLeftJointsById,Zge=t=>t.updateWallRightJointsById,wxt=t=>t.updateWallLeftPointById,a$=t=>t.economicsParams,vxt=t=>t.fittestIndividualResults,l$=t=>t.setFittestIndividualResults,IW=t=>t.variableLabels,s$=t=>t.setVariableLabels,bA=t=>t.evolutionaryAlgorithmState,c$=t=>t.solarPanelArrayLayoutConstraints,xxt=t=>t.geneticAlgorithmWizardSelectedTab,bxt=t=>t.particleSwarmOptimizationWizardSelectedTab,Sxt=t=>t.countHeatmapCells,Rf=t=>t.setPrimitiveStore,eme=be.memo(({hx:t,hy:e,hz:n,position:o,rotation:r})=>{const i=M(T7t),a=M(mA),l=a?"#888888":"#444444",s=Math.max(t,e),[c,u]=m.useState(Math.floor(s/50)+1),[d,f]=m.useState(.5);m.useEffect(()=>{i?(u((Math.floor(s/25)+1)*m9),f(a?.05:.1)):(u((Math.floor(s/25)+1)*P6),f((a?.05:.1)*Z5))},[i,s,a]);const p=m.useMemo(()=>{const A=[0];for(let y=c;y<=t;y+=c)A.push(y),A.push(-y);return A},[c,t]),g=m.useMemo(()=>{const A=[0];for(let y=c;y<=e;y+=c)A.push(y),A.push(-y);return A},[c,e]);return h.jsxs("group",{position:o??[0,0,n+.01],rotation:r,children:[p.map(A=>h.jsx(Gn,{points:[[A,-e,0],[A,e,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},A)),g.map(A=>h.jsx(Gn,{points:[[-t,A,0],[t,A,0]],color:l,lineWidth:d,userData:{unintersectable:!0}},A))]})}),Mre=.2,Txt=({x:t,z:e,handleType:n,scale:o=[1,1,1]})=>{const r=M(pn),i=M(Ug),a=m.useRef(null),[l,s]=m.useState("white"),[c,u,d]=o;return m.useEffect(()=>{s(i===n?"red":"white")},[i]),h.jsx(si,{ref:a,name:n,args:[Mre*c,Mre*u,Mre*d],position:[t,0,e],onPointerEnter:()=>{s("red"),r(f=>{f.hoveredHandle=n})},onPointerLeave:()=>{i===null&&s("white"),r(f=>{f.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:l})})},Sv=be.memo(Txt),Pxt=({handleType:t})=>{const e=M(Ub),n=m.useRef(null),[o,r]=m.useState("white");return m.useEffect(()=>{e===zo.Mid?r("red"):r("white")},[e]),h.jsx(Ps,{ref:n,name:t,args:[.1,6,6],onPointerEnter:()=>{r("red")},onPointerLeave:()=>{e===null&&r("white")},children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},Cxt=be.memo(Pxt);class Ire{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y,this.array[this.top++]=e.z}}class Rxt{constructor(e){this.top=0,this.array=new Float32Array(e)}write(e){this.array[this.top++]=e.x,this.array[this.top++]=e.y}}let IT=class UV{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygons=[],e&&this.build(e)}clone(){const e=new UV;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map(n=>n.clone()),e}invert(){for(let n=0;nUv.EPSILON?1:0;u|=g,d.push(g)}switch(u){case 0:(this.normal.dot(e.plane.normal)>0?n:o).push(e);break;case 1:r.push(e);break;case 2:i.push(e);break;case 3:{const f=[],p=[];for(let g=0;g=3&&r.push(new vG(f,e.shared)),p.length>=3&&i.push(new vG(p,e.shared));break}}}static fromPoints(e,n,o){const r=new x2().copy(n).sub(e).cross(new x2().copy(o).sub(e)).normalize();return new Uv(r.clone(),r.dot(e))}}Uv.EPSILON=1e-5;let vG=class HOe{constructor(e,n){this.vertices=e,this.shared=n,this.plane=Uv.fromPoints(e[0].pos,e[1].pos,e[2].pos)}clone(){return new HOe(this.vertices.map(e=>e.clone()),this.shared)}flip(){this.vertices.reverse().map(e=>e.flip()),this.plane.flip()}};class xG{constructor(e,n,o,r){this.pos=new x2().copy(e),this.normal=new x2().copy(n),this.uv=new x2().copy(o),this.uv.z=0,r&&(this.color=new x2().copy(r))}clone(){return new xG(this.pos,this.normal,this.uv,this.color)}flip(){this.normal.negate()}interpolate(e,n){return new xG(this.pos.clone().lerp(e.pos,n),this.normal.clone().lerp(e.normal,n),this.uv.clone().lerp(e.uv,n),this.color&&e.color&&this.color.clone().lerp(e.color,n))}}class cc{constructor(){this.polygons=[]}static fromPolygons(e){const n=new cc;return n.polygons=e,n}static fromGeometry(e,n){let o=[];const r=e.attributes.position,i=e.attributes.normal,a=e.attributes.uv,l=e.attributes.color,s=e.groups;let c;if(e.index)c=e.index.array;else{c=new Array(r.array.length/r.itemSize|0);for(let d=0;d0)for(const A of s)d>=A.start&&d!Number.isNaN(d.plane.normal.x)))}static toGeometry(e,n){let o=0;const r=e.polygons;for(const p of r)o+=p.vertices.length-2;const i=new ji,a=new Ire(o*3*3),l=new Ire(o*3*3),s=new Rxt(o*2*3);let c;const u=[],d=[];for(const p of r){const g=p.vertices,A=g.length;p.shared!==void 0&&(u[p.shared]||(u[p.shared]=[])),A&&g[0].color!==void 0&&(c||(c=new Ire(o*3*3)));for(let y=3;y<=A;y++)(p.shared===void 0?d:u[p.shared]).push(a.top/3,a.top/3+1,a.top/3+2),a.write(g[0].pos),a.write(g[y-2].pos),a.write(g[y-1].pos),l.write(g[0].normal),l.write(g[y-2].normal),l.write(g[y-1].normal),s&&(s.write(g[0].uv),s.write(g[y-2].uv),s.write(g[y-1].uv)),c&&(c.write(g[0].color),c.write(g[y-2].color),c.write(g[y-1].color))}i.setAttribute("position",new tl(a.array,3)),i.setAttribute("normal",new tl(l.array,3)),s&&i.setAttribute("uv",new tl(s.array,2)),c&&i.setAttribute("color",new tl(c.array,3));for(let p=0;pn.clone()).filter(n=>Number.isFinite(n.plane.w)),e}toPolygons(){return this.polygons}union(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),cc.fromPolygons(n.allPolygons())}subtract(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.invert(),n.clipTo(o),o.clipTo(n),o.invert(),o.clipTo(n),o.invert(),n.build(o.allPolygons()),n.invert(),cc.fromPolygons(n.allPolygons())}intersect(e){const n=new IT(this.clone().polygons),o=new IT(e.clone().polygons);return n.invert(),o.clipTo(n),o.invert(),n.clipTo(o),o.clipTo(n),n.build(o.allPolygons()),n.invert(),cc.fromPolygons(n.allPolygons())}inverse(){const e=this.clone();for(const n of e.polygons)n.flip();return e}toMesh(e,n){return cc.toMesh(this,e,n)}toGeometry(e){return cc.toGeometry(this,e)}}const dt=$K()((t,e)=>{const n=o=>t(JP(o));return{set:o=>{try{n(o)}catch(r){console.log(r)}},setPrimitiveStore(o,r){n(i=>{i[o]!==void 0?i[o]=r:console.error(`key ${o} is not defined in PrimitiveStoreState`)})},latestVersion:void 0,changed:!1,setChanged(o){n(r=>{r.changed=o})},skipChange:!0,setSkipChange(o){n(r=>{r.skipChange=o})},localFileName:"aladdin.ala",createNewFileFlag:!1,setCreateNewFileFlag(o){n(r=>{r.createNewFileFlag=o})},openLocalFileFlag:!1,setOpenLocalFileFlag(o){n(r=>{r.openLocalFileFlag=o})},waiting:!1,contextMenuFlag:!1,updateContextMenu(){n(o=>{o.contextMenuFlag=!o.contextMenuFlag})},showSolarPanelCustomizationPanel:!1,showEconomicsPanel:!1,showNavigationPanel:!1,showShadowSettings:!1,saveAccountSettingsFlag:!1,saveCloudFileFlag:!1,setSaveCloudFileFlag(o){n(r=>{r.saveCloudFileFlag=o})},listCloudFilesFlag:!1,refreshCloudFilesFlag:!1,saveLocalFileDialogVisible:!1,modelsMapFlag:!1,modelsMapSelectedSite:void 0,leaderboardFlag:!1,showLeaderboard:!1,publishOnModelsMapFlag:!1,modelsMapWeatherStations:!1,createProjectFlag:!1,saveProjectAsFlag:!1,curateDesignToProjectFlag:!1,showProjectsFlag:!1,updateProjectsFlag:!1,showProjectListPanel:!1,projectImagesUpdateFlag:!1,projectType:Ri.SOLAR_PANEL_ARRAY,projectTitle:null,projectDescription:null,userCount:0,showCloudFilePanel:!1,openModelsMap:!1,showModelsGallery:!1,showAccountSettingsPanel:!1,showLikesPanel:!1,showPublishedModelsPanel:!1,animateSun:!1,simulationInProgress:!1,simulationPaused:!1,evolutionInProgress:!1,evolutionPaused:!1,runEvolution:!1,pauseEvolution:!1,objectiveEvaluationIndex:0,runDailyThermalSimulation:!1,pauseDailyThermalSimulation:!1,runYearlyThermalSimulation:!1,pauseYearlyThermalSimulation:!1,clearDailySimulationResultsFlag:!1,clearYearlySimulationResultsFlag:!1,runDynamicSimulation:!1,runStaticSimulation:!1,pauseSimulation:!1,runDailySimulationForParabolicDishes:!1,runYearlySimulationForParabolicDishes:!1,pauseDailySimulationForParabolicDishes:!1,pauseYearlySimulationForParabolicDishes:!1,runDailySimulationForParabolicTroughs:!1,runYearlySimulationForParabolicTroughs:!1,pauseDailySimulationForParabolicTroughs:!1,pauseYearlySimulationForParabolicTroughs:!1,runDailySimulationForFresnelReflectors:!1,runYearlySimulationForFresnelReflectors:!1,pauseDailySimulationForFresnelReflectors:!1,pauseYearlySimulationForFresnelReflectors:!1,runDailySimulationForHeliostats:!1,runYearlySimulationForHeliostats:!1,pauseDailySimulationForHeliostats:!1,pauseYearlySimulationForHeliostats:!1,runSolarPanelVisibilityAnalysis:!1,runDailySimulationForSolarPanels:!1,pauseDailySimulationForSolarPanels:!1,runYearlySimulationForSolarPanels:!1,pauseYearlySimulationForSolarPanels:!1,runDailySimulationForSolarPanelsLastStep:!1,runYearlySimulationForSolarPanelsLastStep:!1,runDailyLightSensor:!1,pauseDailyLightSensor:!1,runYearlyLightSensor:!1,pauseYearlyLightSensor:!1,runDailySimulationForUpdraftTower:!1,runYearlySimulationForUpdraftTower:!1,pauseDailySimulationForUpdraftTower:!1,pauseYearlySimulationForUpdraftTower:!1,flagOfDailySimulation:!1,showSolarRadiationHeatmap:!1,showHeatFluxes:!1,duringCameraInteraction:!1,navigationMoveSpeed:3,navigationTurnSpeed:3,elementBeingCanceledId:null,showWallIntersectionPlaneId:null,oldParentId:null,oldFoundationId:null,selectedElementId:null,foundationMovedFlag:!1,updateFoundationMovedFlag(){n(o=>{o.foundationMovedFlag=!o.foundationMovedFlag})},isCameraUnderGround:!1,selectButtonClicked:!1,setSelectButtonClicked(o){n(r=>{r.selectButtonClicked=o})}}}),Cn=$K()((t,e)=>({roofSegmentVerticesMap:new Map,setRoofSegmentVertices(n,o){t(r=>(r.roofSegmentVerticesMap.set(n,[...o]),r))},getRoofSegmentVertices(n){return e().roofSegmentVerticesMap.get(n)},deleteRoofSegmentVertices(n){t(o=>(o.roofSegmentVerticesMap.delete(n),o))},roofSegmentVerticesWithoutOverhangMap:new Map,setRoofSegmentVerticesWithoutOverhang(n,o){t(r=>(r.roofSegmentVerticesWithoutOverhangMap.set(n,o),r))},getRoofSegmentVerticesWithoutOverhang(n){return e().roofSegmentVerticesWithoutOverhangMap.get(n)},deleteRoofSegmentVerticesWithoutOverhang(n){t(o=>(o.roofSegmentVerticesWithoutOverhangMap.delete(n),o))},dailyLightSensorData:[],setDailyLightSensorData(n){t({dailyLightSensorData:[...n]})},yearlyLightSensorData:[],setYearlyLightSensorData(n){t({yearlyLightSensorData:[...n]})},sensorLabels:[],setSensorLabels(n){t({sensorLabels:[...n]})},dailyPvYield:[],setDailyPvYield(n){t({dailyPvYield:[...n]}),dt.getState().set(o=>{o.runEvolution&&o.objectiveEvaluationIndex++})},sumDailyPvYield(){let n=0;for(const o of this.dailyPvYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},getDailyPvProfit(){const n=this.sumDailyPvYield(),o=me.countAllSolarPanels();return n*M.getState().economicsParams.electricitySellingPrice-o*M.getState().economicsParams.operationalCostPerUnit},yearlyPvYield:[],setYearlyPvYield(n){t({yearlyPvYield:[...n]}),dt.getState().set(o=>(o.runEvolution&&o.objectiveEvaluationIndex++,o))},sumYearlyPvYield(){var r;let n=0;for(const i of this.yearlyPvYield)for(const a in i)Object.hasOwn(i,a)&&a!=="Month"&&(n+=i[a]);const o=12/(((r=M.getState().world)==null?void 0:r.daysPerYear)??6);return n*o},getYearlyPvProfit(){const n=me.countAllSolarPanels();return this.sumYearlyPvYield()*M.getState().economicsParams.electricitySellingPrice-n*M.getState().economicsParams.operationalCostPerUnit*365},solarPanelLabels:[],setSolarPanelLabels(n){t({solarPanelLabels:[...n]})},solarPanelVisibilityResults:new Map,setSolarPanelVisibilityResult(n,o){t(r=>(r.solarPanelVisibilityResults.set(n,o),r))},clearSolarPanelVisibilityResults(){t({solarPanelVisibilityResults:new Map})},dailyParabolicDishYield:[],setDailyParabolicDishYield(n){t({dailyParabolicDishYield:[...n]})},sumDailyParabolicDishYield(){let n=0;for(const o of this.dailyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicDishYield:[],setYearlyParabolicDishYield(n){t({yearlyParabolicDishYield:[...n]})},sumYearlyParabolicDishYield(){let n=0;for(const o of this.yearlyParabolicDishYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicDishLabels:[],setParabolicDishLabels(n){t({parabolicDishLabels:[...n]})},dailyParabolicTroughYield:[],setDailyParabolicTroughYield(n){t({dailyParabolicTroughYield:[...n]})},sumDailyParabolicTroughYield(){let n=0;for(const o of this.dailyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyParabolicTroughYield:[],setYearlyParabolicTroughYield(n){t({yearlyParabolicTroughYield:[...n]})},sumYearlyParabolicTroughYield(){let n=0;for(const o of this.yearlyParabolicTroughYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},parabolicTroughLabels:[],setParabolicTroughLabels(n){t({parabolicTroughLabels:[...n]})},dailyFresnelReflectorYield:[],setDailyFresnelReflectorYield(n){t({dailyFresnelReflectorYield:[...n]})},sumDailyFresnelReflectorYield(){let n=0;for(const o of this.dailyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyFresnelReflectorYield:[],setYearlyFresnelReflectorYield(n){t({yearlyFresnelReflectorYield:[...n]})},sumYearlyFresnelReflectorYield(){let n=0;for(const o of this.yearlyFresnelReflectorYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},fresnelReflectorLabels:[],setFresnelReflectorLabels(n){t({fresnelReflectorLabels:[...n]})},dailyHeliostatYield:[],setDailyHeliostatYield(n){t({dailyHeliostatYield:[...n]})},sumDailyHeliostatYield(){let n=0;for(const o of this.dailyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyHeliostatYield:[],setYearlyHeliostatYield(n){t({yearlyHeliostatYield:[...n]})},sumYearlyHeliostatYield(){let n=0;for(const o of this.yearlyHeliostatYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},heliostatLabels:[],setHeliostatLabels(n){t({heliostatLabels:[...n]})},dailyUpdraftTowerResults:[],dailyUpdraftTowerYield:[],setDailyUpdraftTowerResults(n){t({dailyUpdraftTowerResults:[...n]})},setDailyUpdraftTowerYield(n){t({dailyUpdraftTowerYield:[...n]})},sumDailyUpdraftTowerYield(){let n=0;for(const o of this.dailyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Hour"&&(n+=o[r]);return n},yearlyUpdraftTowerYield:[],setYearlyUpdraftTowerYield(n){t({yearlyUpdraftTowerYield:[...n]})},sumYearlyUpdraftTowerYield(){let n=0;for(const o of this.yearlyUpdraftTowerYield)for(const r in o)Object.hasOwn(o,r)&&r!=="Month"&&(n+=o[r]);return n},updraftTowerLabels:[],setUpdraftTowerLabels(n){t({updraftTowerLabels:[...n]})},heatmaps:new Map,setHeatmap(n,o){t(r=>(r.heatmaps.set(n,o),r))},getHeatmap(n){return e().heatmaps.get(n)},hourlyHeatExchangeArrayMap:new Map,setHourlyHeatExchangeArray(n,o){t(r=>(r.hourlyHeatExchangeArrayMap.set(n,o),r))},hourlySolarHeatGainArrayMap:new Map,setHourlySolarHeatGainArray(n,o){t(r=>(r.hourlySolarHeatGainArrayMap.set(n,o),r))},hourlySolarPanelOutputArrayMap:new Map,setHourlySolarPanelOutputArray(n,o){t(r=>(r.hourlySolarPanelOutputArrayMap.set(n,o),r))},totalBuildingHeater:0,setTotalBuildingHeater:n=>{t({totalBuildingHeater:n})},totalBuildingAc:0,setTotalBuildingAc:n=>{t({totalBuildingAc:n})},totalBuildingSolarPanel:0,setTotalBuildingSolarPanel:n=>{t({totalBuildingSolarPanel:n})},clearHeatmaps(){t(n=>(n.heatmaps.clear(),n))},clearDataStore(){t({heatmaps:new Map,hourlyHeatExchangeArrayMap:new Map,hourlySolarHeatGainArrayMap:new Map,hourlySolarPanelOutputArrayMap:new Map,solarPanelVisibilityResults:new Map,dailyLightSensorData:[],yearlyLightSensorData:[],sensorLabels:[],dailyPvYield:[],yearlyPvYield:[],solarPanelLabels:[],dailyParabolicDishYield:[],yearlyParabolicDishYield:[],parabolicDishLabels:[],dailyParabolicTroughYield:[],yearlyParabolicTroughYield:[],parabolicTroughLabels:[],dailyFresnelReflectorYield:[],yearlyFresnelReflectorYield:[],fresnelReflectorLabels:[],dailyHeliostatYield:[],yearlyHeliostatYield:[],heliostatLabels:[],dailyUpdraftTowerYield:[],dailyUpdraftTowerResults:[],yearlyUpdraftTowerYield:[],updraftTowerLabels:[]})},clearRoofVerticesMap(){t(n=>(n.roofSegmentVerticesMap.clear(),n.roofSegmentVerticesWithoutOverhangMap.clear(),n))}})),Hxt="/aladdin/assets/roof_edge-DBy_1Q5D.png",og="/aladdin/assets/tiny_white_square-B_qAXRfa.png",Mxt="/aladdin/assets/roof_01-BwuyLpwq.png",Ixt="/aladdin/assets/roof_02-DAbYjnV7.png",zxt="/aladdin/assets/roof_03-haZGIixv.png",Dxt="/aladdin/assets/roof_04-DDuwUcDr.png",Ext="/aladdin/assets/roof_05-CtBb5xIW.png",Fxt="/aladdin/assets/roof_06-DuyyebV8.png",kxt="/aladdin/assets/roof_07-DXWGQN8a.png",Lxt=new pf({color:"white",side:Da}),Wxt=be.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=Math.min(a,i,o/2),{width:s,horizontalMullionSpacing:c,verticalMullionSpacing:u,color:d}=e,f=3,p=1,g=s/2,A=m.useMemo(()=>Math.atan2(o/2,l),[o,l]),y=m.useMemo(()=>{if(l===0||o===0)return 0;const b=l/2+o**2/(8*l),R=b-l,H=Math.PI-A,F=R**2,E=b**2,N=F+E-2*F*Math.sin(H)**2-2*R*Math.sqrt((E-F*Math.sin(H)**2)*Math.cos(H)**2);return Math.sqrt(N)},[o,l,A]),S=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:d}),[d]),C=b=>new kl().moveTo(0,b).quadraticCurveTo(b,b,b,0).quadraticCurveTo(b,-b,0,-b).quadraticCurveTo(-b,-b,-b,0).quadraticCurveTo(-b,b,0,b),P=(b,R)=>{const H=b*R/(o/2),F=H/2+(R*2)**2/(8*H),E=Math.acos(Math.min(1,R/F)),N=Math.PI-E,U=new z2(0,H-F,F,F,E,N,!1,0).getPoints(24).map(W=>new le(W.x,W.y));return new bq(U)},v=m.useMemo(()=>{const b=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const H=o/(R+1);let F=H/2;R%2!==0&&(b.push(0),F=H);for(let E=0;E{const b=[];if(s===0)return b;const R=i/2-l,H=i-l,F=Math.ceil(H/c);let E=R;for(let N=0;N{const b=[],R=Math.round(o/u)-1;if(R<=0||s===0)return null;const H=o/(R+1);let F=H/2;R%2!==0&&(F=H);for(let N=0;Nlh.jsx("group",{position:[0,0,i/2-l],rotation:[0,R,0],children:h.jsx(ma,{position:[0,0,b/2],args:[g,g,b,f,p],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:S})});return h.jsxs("group",{name:"Window Mullion Group",position:[0,-.001,0],children:[e.horizontalMullion&&T.map((b,R)=>h.jsx(ma,{position:[0,0,b],args:[g,g,o,f,p],rotation:[0,0,Qt],receiveShadow:n,castShadow:n,children:S},R)),e.verticalMullion&&(v==null?void 0:v.map((b,R)=>h.jsx(ma,{position:[b,0,-l/2],args:[g,g,i-l,f,p],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:S},R))),l>0&&(w==null?void 0:w.map((b,R)=>{if(b===null)return null;const{shape:H,path:F}=b;return h.jsx(aw,{position:[0,g/2,i/2-l],rotation:[Qt,0,0],args:[H,{extrudePath:F,steps:12,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:S},R)})),y>0&&h.jsxs(h.Fragment,{children:[x(l,0),x(y,A),x(y,-A)]})]})}),Nxt=be.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i,a]=t,l=o/2,s=Math.min(a,i,l),{color:c,width:u,sillWidth:d}=e,f=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),p=u/2,g=p/2,A=o+u*3,y=u,S=m.useMemo(()=>{const[C,P]=[l+u,l],v=s+u,T=v/2+(C*2)**2/(8*v),w=Math.acos(Math.min(1,C/T)),x=Math.PI-w,b=v-T,R=s,H=R/2+(P*2)**2/(8*R),F=Math.acos(Math.min(1,P/H)),E=Math.PI-F,N=R-H,U=new z2(0,b,T,T,w,x,!1,0).getPoints(36),W=new z2(0,N,H,H,E,F,!0,0).getPoints(36);return new kl([...U,...W])},[a,i,o,u]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-g/2,0],children:[s>.1?h.jsx(aw,{position:[0,g/2,i/2-s],rotation:[Qt,0,0],args:[S,{depth:g,steps:1,bevelEnabled:!1}],castShadow:n,receiveShadow:n,children:f}):h.jsx(si,{position:[0,0,i/2],args:[o+2*u,g,u],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[-o/2-p,0,-s/2],args:[u,g,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[o/2+p,0,-s/2],args:[u,g,i-s],castShadow:n,receiveShadow:n,children:f}),h.jsx(si,{position:[0,0,-i/2-(d===0?0:y/2)],args:d===0?[o+2*u,g,u]:[A,d??u,y],castShadow:n,receiveShadow:n,children:f})]})}),Zce=be.memo(({cy:t,dimension:e,wireframeData:n,drawBottom:o})=>{const[r,i,a,l]=e,{lineWidth:s,lineColor:c,selected:u,locked:d,opacity:f}=n,p=s/20,g=s/5,A=r/2,y=a/2,S=Math.min(l,a,A),C=6,P=1,v=(R,H)=>{const F=R/2+(H*2)**2/(8*R),E=Math.acos(Math.min(1,H/F)),N=Math.PI-E,U=new z2(0,R-F,F,F,E,N,!1,0).getPoints(24).map(W=>new le(W.x,W.y));return new bq(U)},T=R=>new kl().moveTo(0,R).quadraticCurveTo(R,R,R,0).quadraticCurveTo(R,-R,0,-R).quadraticCurveTo(-R,-R,-R,0).quadraticCurveTo(-R,R,0,R),w=m.useMemo(()=>new pf({color:c}),[c]),x=m.useMemo(()=>new pf({color:B0}),[]),b=(R,H)=>h.jsxs(h.Fragment,{children:[S>.1?h.jsx(aw,{position:[0,0,a/2-S],rotation:[Qt,0,0],args:[T(R),{extrudePath:v(S,A),steps:24,bevelEnabled:!1}],material:H}):h.jsx(ma,{args:[R,R,r,C,P],rotation:[0,0,Qt],position:[0,0,y-R/2],material:H}),o&&h.jsx(ma,{args:[R,R,r,C,P],rotation:[0,0,Qt],position:[0,0,-y],material:H}),h.jsx(ma,{args:[R,R,a-S,C,P],rotation:[Qt,Qt,0],position:[A,0,-S/2],material:H}),h.jsx(ma,{args:[R,R,a-S,C,P],rotation:[Qt,Qt,0],position:[-A,0,-S/2],material:H})]});return h.jsxs("group",{name:"Window Wireframe Group",children:[f>0&&h.jsx("group",{position:[0,t,0],children:b(p,w)}),d&&u&&b(g,x)]})}),Uxt=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=M(Cs),T=Cn(Ib),w=m.useRef(0),x=m.useRef(),[b,R,H,F]=e,[E,N,U]=n,W=(G,q)=>{if(F>0){const $=.5*b,ie=.5*H,Q=Math.min(F,H,$),se=.5*(Q+$*$/Q);if(Math.abs(G)<$&&q-ie)return!0;const oe=q-(H-se-ie);return G*G+oe*oe{if(!d||g||A&&A.notBuilding)return;const G=T.get(t);if(!G)return;const q=G.reduce((ee,de)=>ee+de,0);if(f===0)return;const $=i3*(y.solarRadiationHeatmapGridCellSize??.5),ie=Math.max(2,Math.round(b/$)),Q=Math.max(2,Math.round(H/$)),se=b/ie,oe=H/Q,Z=q/f*(S??Qm);w.current=Z<0?1:0,x.current=me.getEuler(ko,Yc,"YXZ",Math.sign(Z)*Qt);const te=[];if(Z<0)for(let ee=0;eec*b,[b,c]),L=m.useMemo(()=>H-Math.min(F,H,b/2),[b,H,F]),j=m.useMemo(()=>(D+r.width+b)/2*1.025,[b,D,r.width]),B=m.useMemo(()=>-Math.min(F,H,b/2)/2,[H,L]),O=m.useMemo(()=>bG(b,H,F),[b,H,F]),V=(G,q,$)=>h.jsx(ta,{name:"Window Seal Plane",args:G,position:q,rotation:$,material:Lxt,receiveShadow:v,castShadow:v});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Arched Window Plane Group",position:[0,N,0],children:[h.jsxs("mesh",{name:"Window Glass mesh",rotation:[Qt,0,0],children:[h.jsx("shapeGeometry",{args:[O]}),u]}),(o.horizontalMullion||o.verticalMullion)&&F!==void 0&&h.jsx(Wxt,{dimension:e,mullionData:o,shadowEnabled:v})]}),r.showFrame&&h.jsx(Nxt,{dimension:e,frameData:r,shadowEnabled:v}),h.jsx(Zce,{cy:N,dimension:e,wireframeData:i,drawBottom:!0}),h.jsx(Qye,{cx:j,cz:B,lx:D,lz:L,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),V([R,H],[-b/2,R/2,0],[Qt,Qt,0]),V([R,H],[b/2,R/2,0],[Qt,-Qt,0]),V([b,R],[0,R/2,-H/2]),k&&k.map((G,q)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:G,name:"Heat Flux "+q,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:G[w.current].clone().add(new le(0,w.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},q))]})},bG=(t,e,n,o=0,r=0)=>{const i=new kl,a=t/2,l=e/2,s=Math.min(n,e,a);if(i.moveTo(o-a,r-l),i.lineTo(o+a,r-l),i.lineTo(o+a,r+l-s),s>.01){const c=s/2+t**2/(8*s),[u,d]=[o,r+l-c],f=Math.acos(Math.min(1,a/c)),p=Math.PI-f;i.absarc(u,d,c,f,p,!1)}else i.lineTo(o-a,r+l);return i.closePath(),i},jxt=be.memo(Uxt),Bxt=1,Yxt=3,Oxt=new pf({color:"white",side:ti}),Vxt=new ln(0,0,-Qt),_xt=be.memo(({dimension:t,polygonTop:e,frameData:n,shadowEnabled:o})=>{const[r,i,a]=t,[l,s]=e,{color:c,width:u,sillWidth:d}=n,f=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),[p,g]=[r/2,a/2],y=u/2/2,S=r+u*3,C=u,P=m.useMemo(()=>{const w=new le(p,-g),x=new le(p,g),b=new le(-p,g),R=new le(-p,-g),H=new le(l*r,s+g);return[w,x,H,b,R]},[p,g,l,s]),v=m.useMemo(()=>{const w=[];for(let R=1;R{const w=new kl;for(let x=0;x=0;x--){const b=P[x];w.lineTo(b.x,b.y)}return w.closePath(),w},[P,v]);return h.jsxs("group",{name:"Window Frame Group",position:[0,-y/2,0],children:[h.jsx(aw,{position:[0,y/2,0],rotation:[Qt,0,0],args:[T,{steps:1,depth:y,bevelEnabled:!1}],children:f}),h.jsx(si,{position:[0,0,-a/2-(d===0?0:C/2)],args:d===0?[r+2*u,y,u]:[S,d??u,C],castShadow:o,receiveShadow:o,children:f})]})}),Gxt=({id:t,dimension:e,polygonTop:n,position:o,glassMaterial:r,empty:i,interior:a,wireframeData:l,frameData:s,leftShutter:c,rightShutter:u,shutterColor:d,shutterWidth:f,area:p,showHeatFluxes:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=Cn(Ib),T=m.useRef(0),w=m.useRef(),[x,b,R]=o,[H,F,E]=e,[N,U,W]=e.map(ge=>ge/2),[k,D]=n,{lineWidth:L,lineColor:j,selected:B,locked:O,opacity:V}=l,G=k*H,q=Math.hypot(D,N-G),$=Math.asin(D/q),ie=Math.hypot(D,N+G),Q=-Math.asin(D/ie),se=M(Cs),oe=(ge,Se)=>{const Re=.5*H,De=.5*(E+n[1]),Ae=n[1],ue=[{x:-Re,y:-De},{x:Re,y:-De},{x:Re,y:De-Ae},{x:H*n[0],y:De},{x:-Re,y:De-Ae}];return me.isPointInside(ge,Se,ue)},Z=m.useMemo(()=>{if(!g||a||A&&A.notBuilding)return;const ge=v.get(t);if(!ge)return;const Se=ge.reduce((Me,ze)=>Me+ze,0);if(p===0)return;const Re=i3*(y.solarRadiationHeatmapGridCellSize??.5),De=E+n[1],Ae=Math.max(2,Math.round(H/Re)),ue=Math.max(2,Math.round(De/Re)),he=H/Ae,ve=De/ue,we=Se/p*(S??Qm);T.current=we<0?1:0,w.current=me.getEuler(ko,Yc,"YXZ",Math.sign(we)*Qt);const Pe=[],Ie=n[1]/2;if(we<0)for(let Me=0;Mef*H,[H,f]),ee=m.useMemo(()=>(te+s.width+H)/2*1.025,[H,te,s.width]),de=m.useMemo(()=>{const[ge,Se]=[H/2,E/2],Re=k*H;return SG(ge,Se,Re,D)},[H,E,k,D]),fe=m.useMemo(()=>B&&O?new pf({color:B0}):new pf({color:j}),[j,B,O]),pe=m.useMemo(()=>O&&B?L/5:L/20,[L,B,O]),ye=m.useMemo(()=>O&&B?-F/2:-b,[b,F,B,O]),ae=(ge,Se=0)=>h.jsx(ma,{args:[pe,pe,ge,Yxt,Bxt],position:[Se,ye,0],rotation:[0,0,Qt],material:fe}),Te=(ge,Se=0)=>h.jsx(ta,{args:[ge,F],position:[Se,0,0],material:Oxt,receiveShadow:se,castShadow:se});return h.jsxs(h.Fragment,{children:[!i&&h.jsxs("mesh",{name:"Triangle Glass Plane",position:[0,b,0],rotation:[Qt,0,0],children:[h.jsx("shapeGeometry",{args:[de]}),r]}),s.showFrame&&h.jsx(_xt,{dimension:e,polygonTop:n,frameData:s,shadowEnabled:se}),h.jsx(Qye,{cx:ee,lx:te,lz:E,color:d,showLeft:c,showRight:u,spacing:s.showFrame?s.width/2:0}),h.jsxs("group",{position:[0,U,-W+.001],children:[Te(H),ae(H)]}),h.jsxs("group",{position:[-N+.001,U,0],rotation:[0,Qt,0],children:[Te(E),ae(E)]}),h.jsxs("group",{position:[N-.001,U,0],rotation:[0,-Qt,0],children:[Te(E),ae(E)]}),h.jsxs("group",{position:[-N+.001,U,W-.01],rotation:[0,Q,0],children:[Te(ie,ie/2),ae(ie,ie/2)]}),h.jsxs("group",{position:[N-.001,U,W-.01],rotation:[0,$,0],children:[Te(q,-q/2),ae(q,-q/2)]}),Z&&Z.map((ge,Se)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:ge,name:"Heat Flux "+Se,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:ge[T.current].clone().add(new le(0,T.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:w.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},Se))]})},SG=(t,e,n,o,r=0,i=0)=>{const a=new kl;return a.moveTo(r-t,i-e),a.lineTo(r+t,i-e),a.lineTo(r+t,i+e),a.lineTo(r+n,i+e+o),a.lineTo(r-t,i+e),a.closePath(),a},Xxt=be.memo(Gxt),Jxt=({id:t,index:e,foundationModel:n,roofType:o,segment:r,centroid:i,thickness:a,color:l,sideColor:s,texture:c,heatmap:u,windows:d})=>{const f=M(s3),p=dt(p3),g=M(e5),A=M(a3),y=M(l3),S=Cn(yW),{transparent:C,opacity:P}=tM(),v=m.useRef(0),T=m.useRef(),w=m.useRef(),x=M.getState().world,b=Cn.getState().hourlyHeatExchangeArrayMap,{points:R}=r,H=m.useMemo(()=>{if(!p)return;const E=S(t);if(!E)return;const N=[],U=new le(0,0,a+.1);switch(o){case Go.Hip:case Go.Pyramid:for(const W of E){const k=[];k.push(W[0].clone().sub(i).add(U)),k.push(W[1].clone().sub(i).add(U)),N.push(k)}break;case Go.Mansard:for(const[W,k]of E.entries()){if(W===E.length-1)continue;const D=[];D.push(k[0].clone().sub(i).add(U)),D.push(k[1].clone().sub(i).add(U)),N.push(D)}break;case Go.Gambrel:for(const[W,k]of E.entries()){if(W===0||W===3){const L=[];L.push(k[0].clone().sub(i).add(U)),L.push(k[1].clone().sub(i).add(U)),N.push(L)}let D=[];D.push(k[0].clone().sub(i).add(U)),D.push(k[3].clone().sub(i).add(U)),N.push(D),D=[],D.push(k[1].clone().sub(i).add(U)),D.push(k[2].clone().sub(i).add(U)),N.push(D)}break}return N},[p]),F=m.useMemo(()=>{if(!p||n&&n.notBuilding)return;const E=b.get(t+"-"+e);if(!E)return;const N=E.reduce((he,ve)=>he+ve,0),U=S(t);if(!U||!U[e])return;const[W,k,D,L,j]=R,B=j.z-W.z,O=U[e].map(he=>he.clone().sub(i).add(new le(0,0,B)));if(!O)return;const V=[];for(const he of O)V.push({x:he.x,y:he.y});const G=i3*(x.solarRadiationHeatmapGridCellSize??.5),q=O[0].clone(),$=O[1].clone(),ie=O[2].clone(),Q=new le().subVectors($,q),se=new le().subVectors(ie,q),oe=new le().subVectors(ie,$),Z=Q.length(),te=new le().crossVectors(se,oe).length()/Z,ee=Math.max(2,Math.floor(Z/G)),de=Math.max(2,Math.floor(te/G));Q.normalize(),se.normalize(),oe.normalize();const fe=new le().crossVectors(se,oe).normalize(),pe=Q.multiplyScalar(.5*Z/ee),ye=new le().crossVectors(fe,Q).normalize().multiplyScalar(.5*te/de),ae=q.clone().add(pe).add(ye);pe.multiplyScalar(2),ye.multiplyScalar(2),T.current=fe.clone().multiplyScalar(.1);const Te=[],ge=new le;let Se=O.length===4?me.getTriangleArea(O[0],O[1],O[2])+me.getTriangleArea(O[2],O[3],O[0]):me.getTriangleArea(O[0],O[1],O[2]);if(Se===0)return;let Re=f(z.Window,t);const De=S(t);if(De&&De[e]&&(Re=Re.filter(he=>{const ve=he,we=ve.cy+(ve.windowType===Ci.Polygonal&&ve.polygonTop?ve.polygonTop[1]/2:0);return bn.onSegment(De[e],he.cx,we)})),Re&&Re.length>0)for(const he of Re)Se-=me.getWindowArea(he);const Ae=N/Se*(g??Qm);v.current=Ae<0?1:0,w.current=me.getEuler(ko,fe,"YXZ",-Math.sign(Ae)*Qt);let ue;for(let he=0;he0){const Pe=ge.x+i.x,Ie=ge.y+i.y;for(const Me of Re){const ze=bn.getRelativeWindowVerticesOnRoof(Me),Ne=me.getPoints(ze);if(me.isPointInside(Pe,Ie,Ne)){ue=!1;break}}}if(ue&&me.isPointInside(ge.x,ge.y,V)){const Pe=[];Ae<0?(Pe.push(ge.clone()),Pe.push(ge.clone().add(fe.clone().multiplyScalar(-Ae)))):(Pe.push(ge.clone()),Pe.push(ge.clone().add(fe.clone().multiplyScalar(Ae)))),Te.push(Pe)}}}return Te},[p,g]);return h.jsxs(h.Fragment,{children:[h.jsx(MOe,{id:t,index:e,segment:r,color:l,sideColor:s,texture:c,heatmap:u,transparent:C,opacity:P,windows:d,centroid:i}),H&&H.map((E,N)=>h.jsx(Gn,{points:E,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+N},N)),F&&F.map((E,N)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:E,name:"Heat Flux "+N,lineWidth:y??Zm,color:A??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:T.current?E[v.current].clone().add(T.current):E[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head "+N,rotation:w.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:A??p0})})]},N))]})},MOe=be.memo(({id:t,index:e,segment:n,color:o,sideColor:r,texture:i,heatmap:a,transparent:l,opacity:s,windows:c,centroid:u})=>{const d=dt(hs),f=m.useRef(null),{points:p}=n,g=d?a:i,A=p.length===6,y=p.length===8,S=m.useMemo(()=>c.map(R=>{const H=new le(R.lx,R.lz,R.ly*2),F=new le(R.cx,R.cy,R.cz).sub(u),E=new ln().fromArray([R.rotation[0],R.rotation[1],R.rotation[2],"ZXY"]);if(R.windowType===Ci.Polygonal){const[N,U]=R.polygonTop??Gp,[W,k,D]=[H.x/2,H.y/2,N*H.x],L=SG(W,k,D,U),j=new ls(new N9([L],{steps:1,depth:H.z,bevelEnabled:!1})),B=new le(0,0,-H.z).applyEuler(E);return j.position.copy(F.clone().add(B)),j.rotation.copy(E),j.updateMatrix(),j}else if(R.windowType===Ci.Arched){const N=bG(H.x,H.y,R.archHeight),U=new ls(new N9([N],{steps:1,depth:H.z,bevelEnabled:!1})),W=new le(0,0,-H.z).applyEuler(E);return U.position.copy(F.clone().add(W)),U.rotation.copy(E),U.updateMatrix(),U}else{const N=new ls(new n3(H.x,H.y,H.z));return N.position.copy(F),N.rotation.copy(E),N.updateMatrix(),N}}),[c,u]),C=v()??6,P=m.useMemo(()=>Array(C).fill(0),[C]);if(m.useEffect(()=>{v()},[]),!A&&!y)return null;function v(){if(!f.current||!A&&!y)return;const R=f.current.geometry;R.index=null,R.clearGroups();const H=[],F=[];let E=0,N=0;if(A){const j=p.slice(p.length/2);U(j),d?k():W(j),D(3);const B=p.slice(0,p.length/2).reverse();U(B),F.push(0,0,1,0,0,1),D(3),L([[0,1,4,3],[1,2,5,4],[2,0,3,5]])}else if(y){const j=p.slice(p.length/2),[B,O]=T(j);U(B),U(O);const[V,G,q,$]=j,ie=B[2].equals($);if(d)k(ie);else{const Z=new le().subVectors(G,V),te=new le().subVectors(q,V),ee=new le().subVectors($,V),fe=new Kt(G.x-V.x,G.y-V.y).length(),pe=fe,ye=0,ae=Z.dot(te)/fe,Te=Z.clone().cross(te).length()/fe,ge=Z.dot(ee)/fe,Se=Z.clone().cross(ee).length()/fe;ie?(F.push(0,0,pe,ye,ge,Se),F.push(pe,ye,ae,Te,ge,Se)):(F.push(0,0,pe,ye,ae,Te),F.push(0,0,ae,Te,ge,Se))}D(6);const Q=p.slice(0,p.length/2),[se,oe]=T(Q);U(se.reverse()),U(oe.reverse()),F.push(0,0,1,0,0,1),F.push(0,1,1,0,1,1),D(6),L([[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]])}else throw new Error("segment is neither quad nor tri");if(R.setAttribute("position",new gr(H,3)),R.setAttribute("uv",new gr(F,2)),R.computeVertexNormals(),R.computeBoundingSphere(),c.length>0){const j=[];for(let O=0;OQ.concat(p[se].x,p[se].y,p[se].z),[]),ie=[q,V,G].reduce((Q,se)=>Q.concat(p[se].x,p[se].y,p[se].z),[]);H.push(...$),H.push(...ie),F.push(0,0,1,0,0,1),F.push(0,1,1,0,1,1),D(6)}}}function T(R){const[H,F,E,N]=R,U=me.distanceFromPointToLine2D(N,H,F),W=me.distanceFromPointToLine2D(E,H,F),k=[],D=[];return Math.abs(U-W)<.01?H.z>F.z?(k.push(H,F,E),D.push(H,E,N)):(k.push(H,F,N),D.push(F,E,N)):U<=W?(k.push(H,F,N),D.push(F,E,N)):(k.push(H,F,E),D.push(H,E,N)),[k,D]}const w=({i:R})=>h.jsx("meshBasicMaterial",{attach:`material-${R}`,map:g,transparent:l,opacity:s}),x=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:o,map:g,transparent:l,opacity:s}),b=({i:R})=>h.jsx("meshStandardMaterial",{attach:`material-${R}`,color:r,transparent:l,opacity:s});return h.jsx("mesh",{ref:f,name:`Buffer Roof Segment ${e}`,uuid:t+"-"+e,userData:{simulation:!0},receiveShadow:!d,castShadow:!0,frustumCulled:!1,children:P.map((R,H)=>H!==0?h.jsx(b,{i:H},"side"+H):d?h.jsx(w,{i:H},"heatmap"+H):h.jsx(x,{i:H},"texture"+H))})}),u$=be.memo(Jxt),Kxt=({cz:t,points:e})=>{const n=new kl;n.moveTo(e[0].x,e[0].y);for(const{x:o,y:r}of e)n.lineTo(o,r);return n.closePath(),h.jsx(aw,{scale:.99,position:[0,0,t],args:[n,{steps:1,depth:.1,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{side:ti,color:"white"})})},zW=be.memo(Kxt);function cy(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,r]of t)if(!Object.is(r,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let o=0;oM(e=>e.selectedElementIdSet.has(t)&&!e.groupActionMode),$t=()=>{const t=M(m0);return m.useMemo(()=>({lng:t}),[t])},u1=t=>M.getState().getWeather(t??"Boston MA, USA"),Iwe=new le,zwe=new ln,mY=new le,qxt=new le(0,0,1),$xt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new le(0,0,e);for(let l=0;l{const[c,u,d]=l.points,f=Math.abs(c.z)<.015,p=[c.clone().sub(i),c];return f||p.push(d),h.jsx(Gn,{points:p,lineWidth:n,color:o},s)})]})]})}),Qxt=({roofModel:t,foundationModel:e})=>{let{cx:n,cy:o,lz:r,id:i,wallsId:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineWidth:f=.2,lineColor:p="black",roofType:g,foundationId:A,rise:y=r,ceiling:S=!1}=t;const C=eM(l),P=Tc(i);[p,f]=bn.getWireframetStyle(p,f,P,d);const v=M(pn),T=M(Ap),{camera:w,gl:x}=ri(),b=m.useMemo(()=>new l0,[]),R=m.useMemo(()=>new Kt,[]),[H,F]=m.useState(!1),E=m.useRef(null),N=m.useRef(!1),U=m.useRef(y),W=new Set(a),k=Ie=>{R.x=Ie.offsetX/x.domElement.clientWidth*2-1,R.y=-(Ie.offsetY/x.domElement.clientHeight)*2+1,b.setFromCamera(R,w)},D=Ie=>{const Me=[],ze=Ie.length;for(const Ne of Ie)Ne.leftPoint[0]!==void 0&&Ne.leftPoint[1]!==void 0&&Me.push({x:Ne.leftPoint[0],y:Ne.leftPoint[1]});return O.current||(Ie[ze-1].rightPoint[0]||Ie[ze-1].rightPoint[0]===0)&&(Ie[ze-1].rightPoint[1]||Ie[ze-1].rightPoint[1]===0)&&Me.push({x:Ie[ze-1].rightPoint[0],y:Ie[ze-1].rightPoint[1]}),Me},L=(Ie,Me)=>{if(Ie.length!==Me.size)return!0;for(const ze of Ie)if(!Me.has(ze.id))return!0;return!1},j=()=>{let Ie=1/0;for(let Me=0;Me{if(B.length<2)return{x:0,y:0};const Ie=D(B);if(Ie.length<3)return{x:0,y:0};const Me=me.calculatePolygonCentroid(Ie);return Number.isNaN(Me.x)||Number.isNaN(Me.y)?{x:0,y:0}:Me},[B,G]),$=m.useMemo(()=>new le(q.x,q.y,G),[q,G]),ie=m.useMemo(()=>{const Ie=B.map(Me=>bn.getWallNormal(Me).multiplyScalar(Me.eavesLength??0));if(!O.current&&Ie.length!==0){const Me=new le().subVectors(new le(B[B.length-1].rightPoint[0],B[B.length-1].rightPoint[1]),new le(B[0].leftPoint[0],B[0].leftPoint[1])).applyEuler(AG).normalize().multiplyScalar(.3);Ie.push(Me)}return Ie},[B]),Q=m.useMemo(()=>{const Ie=B.map((Me,ze)=>({leftPoint:new le(Me.leftPoint[0],Me.leftPoint[1]).add(ie[ze]),rightPoint:new le(Me.rightPoint[0],Me.rightPoint[1]).add(ie[ze])}));return!O.current&&Ie.length!==0&&Ie.push({leftPoint:new le(B[B.length-1].rightPoint[0],B[B.length-1].rightPoint[1]).add(ie[ie.length-1]),rightPoint:new le(B[0].leftPoint[0],B[0].leftPoint[1]).add(ie[ie.length-1])}),Ie},[B,ie]),se=m.useMemo(()=>qxt.clone().multiplyScalar(u),[u]),oe=m.useMemo(()=>{const Ie=[];if(B.length<2)return Ie;const Me=j();for(let ze=0;ze0&&Ne.rightPoint.length>0&&(Ne.leftPoint[0]!==Ne.rightPoint[0]||Ne.leftPoint[1]!==Ne.rightPoint[1])){const Je=[];let{lh:Ue,rh:nt}=bn.getWallHeight(B,ze);O.current||(ze===0&&(Ue=B[0].lz),ze===B.length-1&&(nt=B[B.length-1].lz));const We=bn.getIntersectionPoint(Q[(ze+Q.length-1)%Q.length].leftPoint,Q[(ze+Q.length-1)%Q.length].rightPoint,Q[ze].leftPoint,Q[ze].rightPoint).setZ(Ue-Me).sub($),Ee=bn.getIntersectionPoint(Q[ze].leftPoint,Q[ze].rightPoint,Q[(ze+1)%Q.length].leftPoint,Q[(ze+1)%Q.length].rightPoint).setZ(nt-Me).sub($),ke=new le(Ne.cx,Ne.cy).sub($.clone().setZ(0)).length();Je.push(We,Ee,mY),Je.push(We.clone().add(se),Ee.clone().add(se),mY.clone().add(se)),Ie.push({points:Je,angle:-Ne.relativeAngle,length:ke})}}if(!O.current){const ze=Q.length-1,Ne=bn.getIntersectionPoint(Q[ze-1].leftPoint,Q[ze-1].rightPoint,Q[ze].leftPoint,Q[ze].rightPoint).setZ(B[B.length-1].lz-Me).sub($),Je=bn.getIntersectionPoint(Q[ze].leftPoint,Q[ze].rightPoint,Q[0].leftPoint,Q[0].rightPoint).setZ(B[0].lz-Me).sub($);let Ue=Math.atan2(Je.y-Ne.y,Je.x-Ne.x);Ue=Ue>=0?Ue:(sa+Ue)%sa;const nt=new le().addVectors(Ne,Je).setZ(0).divideScalar(2).length(),We=[];We.push(Ne,Je,mY),We.push(Ne.clone().add(se),Je.clone().add(se),mY.clone().add(se)),Ie.push({points:We,angle:-Ue,length:nt})}return Ie},[B,q,u]),Z=m.useMemo(()=>{const Ie=[];if(B.length===0)return Ie;Ie.push(new le().fromArray(B[0].leftPoint));for(const Me of B)Ie.push(new le().fromArray(Me.rightPoint));return Ie},[B]);let te=0;if(e){n=e.cx,o=e.cy,te=e.rotation[2];const Ie=-Math.atan2(w.position.x-n,w.position.y-o)-te;Iwe.set(q.x,q.y,G),zwe.set(-Qt,0,Ie,"ZXY")}const ee=EQ();m.useEffect(()=>{if(ee)return;if(M.getState().addedRoofIdSet.has(i)&&B.length>=2&&L(B,W)){const Me=B.map(Ne=>Ne.id),ze=new Set(Me);v(Ne=>{for(const Je of Ne.elements)if(Je.type===z.Roof)Je.id===i&&(Je.wallsId=Me);else if(Je.type===z.Wall&&W.has(Je.id)&&!ze.has(Je.id)){const Ue=Je;Ue.roofId=null,Ue.leftRoofHeight=void 0,Ue.rightRoofHeight=void 0}}),M.getState().deleteAddedRoofId(i)}},[W]),m.useEffect(()=>{if(B.length>1){if(M.getState().addedRoofIdSet.has(i)){for(let Me=0;Me{for(const Ne of ze.elements)if(Ne.id===B[Me].id&&Ne.type===z.Wall){const Je=Ne;Je.roofId=i,Je.leftRoofHeight=void 0,Je.rightRoofHeight=void 0;break}});M.getState().deleteAddedRoofId(i)}}else T(i,!1,!1,!0)},[B]),Oye(e,i,oe,$,G,u);const de=()=>{if(B.length<2)return!1;const Ie=B[0].lz;for(const Me of B)if(Math.abs(Me.lz-Ie)>.01)return!1;for(const Me of oe){const[ze,Ne]=Me.points;if(Math.abs(ze.z)>.01||Math.abs(Ne.z)>.01)return!1}return!0},[fe,pe]=m.useState(de);m.useEffect(()=>{pe(de())},[B,G]);const ye=dt(hs),ae=M(Pf),Te=Cn(c1),[ge,Se]=m.useState([]),[Re,De]=m.useState(null),Ae=M(pu),ue=fN(i,$,oe,fe,Go.Pyramid);m.useEffect(()=>{if(ye)if(fe){const Ie=Te(i);if(Ie){const Me=me.fetchHeatmapTexture(Ie,ae??5);if(Me){const ze=ue();if(ze&&ze.length>0&&e){const Ne=new ln(0,0,e.rotation[2],"ZYX");let Je=Number.MAX_VALUE,Ue=Number.MAX_VALUE,nt=-Number.MAX_VALUE,We=-Number.MAX_VALUE;for(const xt of ze)for(const gt of xt){const Ye=gt.clone().applyEuler(Ne);Ye.x>nt&&(nt=Ye.x),Ye.xWe&&(We=Ye.y),Ye.y0){const Me=[];if(ue()){for(let Ne=0;Ne{const Ie=[];for(let Me=0;Me0&&ze.rightPoint.length>0&&(ze.leftPoint[0]!==ze.rightPoint[0]||ze.leftPoint[1]!==ze.rightPoint[1])){let{lh:Ne,rh:Je}=bn.getWallHeight(B,Me);O.current||(Me===0&&(Ne=B[0].lz),Me===B.length-1&&(Je=B[B.length-1].lz));const Ue=new le(ze.leftPoint[0],ze.leftPoint[1],Ne),nt=new le(ze.rightPoint[0],ze.rightPoint[1],Je);Ie.push([Ue,nt,$.clone()])}}if(!O.current){const Me=B[0],ze=B[B.length-1],Ne=new le(ze.rightPoint[0],ze.rightPoint[1],ze.lz),Je=new le(Me.leftPoint[0],Me.leftPoint[1],Me.lz);Ie.push([Ne,Je,$.clone()])}if(fe){const Me=[];for(const ze of Ie)Me.push(ze[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(i,[Me])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(i,Ie)});const ve=M(Ie=>Ie.elements.filter(Me=>Me.parentId===i&&Me.type===z.Window),cy),we=gN(i,e,$,oe),Pe=l===Ur.Default||l===Ur.NoTexture?s:"white";return h.jsxs("group",{name:`Pyramid Roof Group ${i}`,children:[h.jsx("group",{name:`Pyramid Roof Segments Group ${i}`,userData:we,position:[q.x,q.y,G],onPointerDown:Ie=>{cN(Ie,e.id,i,oe,$)},onPointerMove:Ie=>{dN(Ie,i)},onPointerUp:Ie=>{uN(Ie,t)},onContextMenu:Ie=>{CR(Ie,i)},children:fe?h.jsx(FQ,{id:i,foundationModel:e,roofType:g,roofSegments:oe,center:$,thickness:u,lineWidth:f,lineColor:p,sideColor:c,color:Pe,textureType:l,heatmap:Re}):h.jsxs(h.Fragment,{children:[oe.map((Ie,Me)=>{const{points:ze}=Ie;if(ze.length>0){const[Ne,Je]=ze;if(Ne.distanceTo(Je)>.1)return h.jsx("group",{name:`Roof segment ${Me}`,children:h.jsx(u$,{id:i,index:Me,foundationModel:e,roofType:g,segment:Ie,centroid:$,thickness:u,color:Pe,sideColor:c,texture:C,heatmap:ge&&Me0&&h.jsx(zW,{points:Z,cz:B[0].lz}),P&&!d&&h.jsx(nh,{position:[q.x,q.y,G+u+.15],onPointerDown:Ie=>{Ae(t.id,Ie,Xo.Select),F(!0),kn.getState().setEnableOrbitController(!1),N.current=!0,U.current=y,v(Me=>{Me.resizeHandleType=Mt.Top,Me.selectedElementHeight=G+t.thickness})},onPointerUp:()=>{F(!1),kn.getState().setEnableOrbitController(!0)},onPointerOver:()=>{v(Ie=>{Ie.hoveredHandle=Lr.Top,Ie.selectedElementHeight=G+t.thickness,Ie.selectedElementX=q.x,Ie.selectedElementY=q.y})}}),H&&h.jsx(ta,{name:"Roof Intersection Plane",ref:E,args:[1e3,100],visible:!1,rotation:zwe,position:Iwe,onPointerMove:Ie=>{if(E.current&&N.current&&e){k(Ie);const Me=b.intersectObjects([E.current]);if(Me[0]){const ze=Me[0].point;if(ze.z<.001)return;const Ne=Math.max(0,ze.z-e.lz-.3-V);M.getState().updateRoofRiseById(i,Ne,G+t.thickness)}}},onPointerUp:Ie=>{sN(i,U.current,y),F(!1),kn.getState().setEnableOrbitController(!0),N.current=!1}})]})},Zxt=be.memo(Qxt,ZH),ebt=(t,e,n)=>{const{left:o,right:r,center:i,centerLeft:a,centerRight:l}=n,[s,c]=[t/2,e/2],u=[{x:-s,y:o-c},{x:-s,y:-c},{x:s,y:-c},{x:s,y:r-c}];if(l){const[d,f]=l;u.push({x:d*t,y:f-c})}if(i){const[d,f]=i;u.push({x:d*t,y:f-c})}if(a){const[d,f]=a;u.push({x:d*t,y:f-c})}return u},o9=(t,e)=>{for(const n of M.getState().elements)if(n.type===z.Wall&&n.foundationId===e&&t.has(n.id)){const o=t.get(n.id);if(o){const r=n,i=ebt(r.lx,r.lz,o);for(const a of M.getState().elements)if(a.parentId===r.id){let{cx:l,cz:s,lx:c,ly:u,lz:d}=a;if(l*=r.lx,s*=r.lz,a.type!==z.SolarPanel?(c*=r.lx,d*=r.lz):d=u,a.type===z.Window&&a.windowType===Ci.Polygonal){const[f,p]=a.polygonTop??Gp,g=l+f*c,A=s+d/2+p;if(!me.isPointInside(g,A,i))return!1}if(!me.isElementInsideWall(new le(l,0,s),c,d,i,a.type===z.Door))return!1}}}return!0},tbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new le(0,0,e),a=t[0].points,l=t[1].points,s=t[2].points,c=t[3].points;r.push(l[3],l[0],a[0],a[1],a[2],l[2],s[0],c[0],c[1],s[1],l[3]);const u=Math.abs(a[0].z)<.15,d=h.jsx(Gn,{points:r,lineWidth:n,color:o}),f=h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[l[0],l[1]],lineWidth:n,color:o}),h.jsx(Gn,{points:[l[2],l[3]],lineWidth:n,color:o}),h.jsx(Gn,{points:[s[2],s[3]],lineWidth:n,color:o})]});return h.jsxs(h.Fragment,{children:[d,!u&&f,h.jsxs("group",{position:[0,0,e],children:[d,!u&&f]}),h.jsx(Gn,{points:[a[0],a[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[a[1],a[1].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[c[0],c[0].clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[c[1],c[1].clone().add(i)],lineWidth:n,color:o})]})}),zre=new le,Dre=new ln,Dwe=new Kt,nbt=new le(0,0,1),obt=({roofModel:t,foundationModel:e})=>{let{id:n,cx:o,cy:r,lz:i,wallsId:a,parentId:l,topRidgeLeftPoint:s,frontRidgeLeftPoint:c,backRidgeLeftPoint:u,topRidgePoint:d,frontRidgePoint:f,backRidgePoint:p,textureType:g,color:A="white",sideColor:y="white",thickness:S=.2,locked:C,lineColor:P="black",lineWidth:v=.2,roofType:T,rise:w=i,ceiling:x=!1}=t;d===void 0&&(d=s?[...s]:[0,1]),f===void 0&&(f=c?[...c]:[.35,.5]),p===void 0&&(p=u?[...u]:[.35,.5]);const b=Tc(n);[P,v]=bn.getWireframetStyle(P,v,b,C);const R=M(pn),H=M(Ap),F=eM(g),[E,N]=m.useState(Lr.Null),[U,W]=m.useState(!1),k=m.useRef(null),{gl:D,camera:L}=ri(),j=m.useMemo(()=>new l0,[]),B=m.useMemo(()=>new Kt,[]),O=m.useRef([0,0]),V=m.useRef(w),G=m.useRef(!1),q=w<.01,$=(Ze,Be,$e)=>{R(wt=>{for(const vt of wt.elements)if(vt.id===Ze&&vt.type===z.Roof&&vt.roofType===Go.Gambrel){const Rt=vt;switch(Be){case Lr.FrontLeft:case Lr.FrontRight:Rt.frontRidgePoint=[...$e];break;case Lr.TopLeft:case Lr.TopRight:Rt.topRidgePoint=[...$e];break;case Lr.BackLeft:case Lr.BackRight:Rt.backRidgePoint=[...$e];break}break}})},ie=(Ze,Be,$e,wt)=>{const vt={name:"Resize Gambrel Roof Ridge",timestamp:Date.now(),resizedElementId:Ze,resizedElementType:z.Roof,oldVal:[...$e],newVal:[...wt],type:Be,undo:()=>{$(vt.resizedElementId,vt.type,vt.oldVal)},redo:()=>{$(vt.resizedElementId,vt.type,vt.newVal)}};M.getState().addUndoable(vt)},Q=Ze=>{B.x=Ze.offsetX/D.domElement.clientWidth*2-1,B.y=-(Ze.offsetY/D.domElement.clientHeight)*2+1,j.setFromCamera(B,L)},se=(Ze,Be)=>{W(!0),kn.getState().setEnableOrbitController(!1),zre.set(Ze.x,Ze.y,Ze.z).add(Ae),e&&Be&&Dre.set(Qt,0,Be.relativeAngle,"ZXY")},oe=(Ze,Be,$e)=>{const wt=new Kt(Ze.cx,Ze.cy),vt=bn.getComposedWallCenter(Be),Rt=bn.getComposedWallLength(Be),Gt=new Kt(vt.x,vt.y).rotateAround(Dwe,Ze.rotation[2]).add(wt),At=Ze.rotation[2]+Be.relativeAngle,Wt=new Kt($e.x,$e.y).sub(Gt).rotateAround(Dwe,-At).x/Rt;return Math.min(Math.abs(Wt),.5)*(Wt>=0?1:-1)},Z=(Ze,Be,$e,wt)=>{if(!Ze)return new le;const vt=bn.getComposedWallLength(Ze),Rt=new ln(0,0,Ze.relativeAngle),Gt=new le(Be*vt,0,0);let At=De;wt&&(At=$e*(De-wt.lz)+wt.lz);const pt=bn.getComposedWallCenter(Ze);return new le(pt.x,pt.y,At).add(Gt.applyEuler(Rt))},te=(Ze,Be)=>{const $e=Ze[Be];let wt,vt;return Be===0||Be===2?(wt=$e.lz,vt=$e.lz):Be===1?(wt=Ze[0].lz,vt=Ze[2].lz):(wt=Ze[2].lz,vt=Ze[0].lz),{lh:wt,rh:vt}},ee=Ze=>Ze.id===n&&Ze.type===z.Roof&&Ze.roofType===Go.Gambrel,de=(Ze,Be)=>{const $e=Be.x-Ze.x,vt=(Be.y-Ze.y)/$e,Rt=Ze.y-vt*Ze.x;return{start:Ze.x,end:Be.x,k:vt,b:Rt}},fe=(Ze,Be,$e,wt,vt,Rt,Gt,At)=>{const pt=Ze[Be],{lh:Wt,rh:ht}=te(Ze,Be),ct=new le().subVectors(pt.leftPoint,pt.rightPoint).length(),It=ct/2,Ft=rt=>rt*ct+It,Ve=(rt,at)=>rt*($e-at)+at,ft=[new Kt(Ft(-Rt[0]),Ve(Rt[1],wt)),new Kt(Ft(Gt[0]),$e),new Kt(Ft(At[0]),Ve(At[1],vt)),new Kt(ct,ht)];return ft.map((rt,at)=>{const Ge=at===0?new Kt(0,Wt):ft[at-1];return de(Ge,rt)})},pe=(Ze,Be)=>{for(const $e of Ze){const{start:wt,end:vt,k:Rt,b:Gt}=$e;if(Be>=wt&&Be<=vt)return Rt*Be+Gt}return null},ye=Ze=>{const Be=new Set;for(const $e of Ze)$e.wallsId.forEach(wt=>Be.add(wt));R($e=>{for(const wt of $e.elements)if(wt.type===z.Wall&&wt.foundationId===l&&Be.has(wt.id)){const vt=wt;vt.leftRoofHeight=De,vt.rightRoofHeight=De,vt.centerLeftRoofHeight=void 0,vt.centerRightRoofHeight=void 0,vt.centerRoofHeight=void 0}})},ae=(Ze,Be,$e,wt,vt,Rt,Gt)=>{if($e!==1&&$e!==3)return;const At=$e===3,{lh:pt,rh:Wt}=te(Be,$e),ht=At?Gt:vt,ct=At?vt:Gt,It=At?Rt:[-Rt[0],Rt[1]],Ft=fe(Be,$e,wt,pt,Wt,ht,It,ct),Ve=Ft.slice(1).map(rt=>rt.start),ft=Be[$e],kt=ft.wallsId.reduce((rt,at)=>{const Ge=M.getState().elements.find(yt=>yt.id===at);return Ge?[...rt,Ge.lx+rt[rt.length-1]]:rt},[0]);for(let rt=0;rt=Ge&&Ht<=yt){const _t=(Ht-zt)/bt,qt=pe(Ft,Ht);qt!==null&&(tt===0?Bt.centerLeft=[_t,qt]:tt===1?Bt.center=[_t,qt]:tt===2&&(Bt.centerRight=[_t,qt]))}}Ze.set(at,Bt)}}return Ze},Te=(Ze,Be,$e,wt,vt)=>{const Rt=new Map;return ae(Rt,Ze,1,Be,$e,wt,vt),ae(Rt,Ze,3,Be,$e,wt,vt),Rt},ge=(Ze,Be,$e,wt,vt)=>{const Rt=new Set(Ze[0].wallsId),Gt=new Set(Ze[2].wallsId),At=Te(Ze,Be,$e,wt,vt);R(pt=>{for(const Wt of pt.elements)if(Wt.type===z.Wall&&Wt.foundationId===l){if(Rt.has(Wt.id)){const ht=Wt,{lh:ct,rh:It}=te(Ze,0);ht.roofId=n,ht.leftRoofHeight=ct,ht.rightRoofHeight=It}else if(Gt.has(Wt.id)){const ht=Wt,{lh:ct,rh:It}=te(Ze,2);ht.roofId=n,ht.leftRoofHeight=ct,ht.rightRoofHeight=It}else if(At.has(Wt.id)){const ht=At.get(Wt.id);if(ht){const ct=Wt,{left:It,right:Ft,center:Ve,centerLeft:ft,centerRight:kt}=ht;if(ct.roofId=n,ct.leftRoofHeight=It,ct.rightRoofHeight=Ft,ft){const[rt,at]=ft;ct.centerLeftRoofHeight?(ct.centerLeftRoofHeight[0]=rt,ct.centerLeftRoofHeight[1]=at):ct.centerLeftRoofHeight=[rt,at]}else ct.centerLeftRoofHeight=void 0;if(Ve){const[rt,at]=Ve;ct.centerRoofHeight?(ct.centerRoofHeight[0]=rt,ct.centerRoofHeight[1]=at):ct.centerRoofHeight=[rt,at]}else ct.centerRoofHeight=void 0;if(kt){const[rt,at]=kt;ct.centerRightRoofHeight?(ct.centerRightRoofHeight[0]=rt,ct.centerRightRoofHeight[1]=at):ct.centerRightRoofHeight=[rt,at]}else ct.centerRightRoofHeight=void 0}}}})},Se=jye(a[0],l),{highestWallHeight:Re,topZ:De}=Bye(Se,w,!0);pN(t,Re);const Ae=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se.map($e=>({x:$e.leftPoint.x,y:$e.leftPoint.y})),Be=me.calculatePolygonCentroid(Ze);return new le(Be.x,Be.y,De)},[Se,De]),ue=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[3],[Be,$e]=d;return Z(Ze,Be,$e).sub(Ae)},[Se,Ae,d]),he=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[1],[Be,$e]=d;return Z(Ze,-Be,$e).sub(Ae)},[Se,Ae,d]),ve=m.useMemo(()=>new le().addVectors(ue,he).divideScalar(2),[ue,he]),we=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[3],[Be,$e]=f;return Z(Ze,Be,$e,Se[0]).sub(Ae)},[Se,Ae,f]),Pe=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[1],[Be,$e]=f;return Z(Ze,-Be,$e,Se[0]).sub(Ae)},[Se,Ae,f]),Ie=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[1],[Be,$e]=p;return Z(Ze,Be,$e,Se[2]).sub(Ae)},[Se,Ae,p]),Me=m.useMemo(()=>{if(!Se||Se.length!==4)return new le;const Ze=Se[3],[Be,$e]=p;return Z(Ze,-Be,$e,Se[2]).sub(Ae)},[Se,Ae,p]),ze=m.useMemo(()=>!Se||Se.length!==4?[]:Se.map(Ze=>bn.getComposedWallNormal(Ze).multiplyScalar(Ze.eavesLength)),[Se]),Ne=m.useMemo(()=>nbt.clone().multiplyScalar(S),[S]),Je=m.useMemo(()=>{const Ze=[];if(!Se||Se.length!==4)return Ze;const[Be,$e,wt,vt]=Se,[Rt,Gt,At,pt]=ze,Wt=Be.leftPoint,ht=Be.rightPoint,ct=wt.leftPoint,It=wt.rightPoint,Ft=Wt.clone().add(Rt),Ve=ht.clone().add(Rt),ft=It.clone().add(pt),kt=Wt.clone().add(pt),rt=ht.clone().add(Gt),at=ct.clone().add(Gt),Ge=ct.clone().add(At),yt=It.clone().add(At),Pt=[],{lh:ot,rh:bt}=te(Se,0),zt=bn.getDistance(Wt,ht,we.clone().add(Ae)),Bt=Math.min((Be.eavesLength??0)/zt*(we.clone().add(Ae).z-ot),ot),tt=bn.getDistance(Wt,ht,Pe.clone().add(Ae)),Ht=Math.min((Be.eavesLength??0)/tt*(Pe.clone().add(Ae).z-bt),bt),_t=bn.getIntersectionPoint(ft,kt,Ft,Ve).setZ(ot-Bt).sub(Ae),qt=bn.getIntersectionPoint(Ft,Ve,rt,at).setZ(bt-Ht).sub(Ae),un=bn.getIntersectionPoint(we,Pe,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(we.z),Rn=bn.getIntersectionPoint(Pe,we,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(Pe.z);Pt.push(_t,qt,Rn,un),Pt.push(_t.clone().add(Ne),qt.clone().add(Ne),Rn.clone().add(Ne),un.clone().add(Ne));const yo=bn.getComposedWallCenter(Be),Ao=-Be.relativeAngle,wo=new le(yo.x,yo.y).sub(ve.clone().setZ(0)).length();Ze.push({points:Pt,angle:Ao,length:wo});const Io=[],po=bn.getIntersectionPoint(ue,he,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(ue.z),On=bn.getIntersectionPoint(ue,he,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(he.z);Io.push(un,Rn,On,po),Io.push(un.clone().add(Ne),Rn.clone().add(Ne),On.clone().add(Ne),po.clone().add(Ne)),Ze.push({points:Io,angle:Ao,length:wo});const fo=-wt.relativeAngle,{lh:ir,rh:Rr}=te(Se,2),br=bn.getDistance(ct,It,Ie.clone().add(Ae)),_r=Math.min((wt.eavesLength??0)/br*(Ie.clone().add(Ae).z-ir),ir),jo=bn.getDistance(ct,It,Me.clone().add(Ae)),wn=Math.min((wt.eavesLength??0)/jo*(Me.clone().add(Ae).z-Rr),Rr),In=bn.getIntersectionPoint(rt,at,Ge,yt).setZ(ir-_r).sub(Ae),ar=bn.getIntersectionPoint(Ge,yt,ft,kt).setZ(Rr-wn).sub(Ae),Wo=bn.getIntersectionPoint(Ie,Me,rt.clone().sub(Ae),at.clone().sub(Ae)).setZ(Me.z),to=bn.getIntersectionPoint(Me,Ie,ft.clone().sub(Ae),kt.clone().sub(Ae)).setZ(Me.z),Bn=bn.getComposedWallCenter(wt),Ko=new le(Bn.x,Bn.y).sub(ve.clone().setZ(0)).length(),So=[];So.push(Wo,to,po,On),So.push(Wo.clone().add(Ne),to.clone().add(Ne),po.clone().add(Ne),On.clone().add(Ne)),Ze.push({points:So,angle:fo,length:Ko});const Qo=[];return Qo.push(In,ar,to,Wo),Qo.push(In.clone().add(Ne),ar.clone().add(Ne),to.clone().add(Ne),Wo.clone().add(Ne)),Ze.push({points:Qo,angle:fo,length:Ko}),Ze},[Se,De,S,d,f,p]),Ue=m.useMemo(()=>!Se||Se.length!==4?null:Se.map(Ze=>Ze.leftPoint),[Se]);m.useEffect(()=>{(!Se||Se.length!==4)&&H(n,!1,!1,!0)},[Se]);const nt=EQ();m.useEffect(()=>{if((Se==null?void 0:Se.length)!==4)return;(M.getState().addedRoofIdSet.has(n)||!nt)&&(q?ye(Se):ge(Se,De,f,d,p),DQ(e,n,Je,Ae,De,S,q),M.getState().deleteAddedRoofId(n))},[Je]),Yye(e,n,Je,Ae,De,S,q);const We=()=>{const Ze=[];if(!Se||Se.length!==4)return Ze;const Be=Se.map((pt,Wt,ht)=>new le(pt.leftPoint.x,pt.leftPoint.y,te(ht,Wt).lh)),$e=we.clone().add(Ae),wt=Pe.clone().add(Ae),vt=Ie.clone().add(Ae),Rt=Me.clone().add(Ae),Gt=ue.clone().add(Ae),At=he.clone().add(Ae);Ze.push([Be[0],Be[1],wt,$e]),Ze.push([$e,wt,At,Gt]),Ze.push([Gt,At,vt,Rt]),Ze.push([Be[2],Be[3],Rt,vt]),q?Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[Be]):Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,Ze)},Ee=fN(n,Ae,Je,q,Go.Gambrel);hN(We);const ke=M(Ze=>Ze.elements.filter(Be=>Be.parentId===n&&Be.type===z.Window),cy),Oe=M(pu),st=dt(hs),je=M(Pf),xt=Cn(c1),[gt,Ye]=m.useState(null),[it,ut]=m.useState([]);m.useEffect(()=>{if(st)if(q){const Ze=xt(n);if(Ze){const Be=me.fetchHeatmapTexture(Ze,je??5);if(Be){const $e=Ee();if($e&&$e.length>0&&e){const wt=new ln(0,0,e.rotation[2],"ZYX");let vt=Number.MAX_VALUE,Rt=Number.MAX_VALUE,Gt=-Number.MAX_VALUE,At=-Number.MAX_VALUE;for(const Ft of $e)for(const Ve of Ft){const ft=Ve.clone().applyEuler(wt);ft.x>Gt&&(Gt=ft.x),ft.xAt&&(At=ft.y),ft.y0){const Be=[];for(let $e=0;$e{cN(Ze,e.id,n,Je,Ae)},onPointerMove:Ze=>{dN(Ze,n)},onPointerUp:Ze=>{uN(Ze,t)},onContextMenu:Ze=>{CR(Ze,n)},children:q?h.jsx(FQ,{id:n,foundationModel:e,roofType:T,roofSegments:Je,center:new le(Ae.x,Ae.y,De),thickness:S,lineWidth:v,lineColor:P,sideColor:y,color:lt,textureType:g,heatmap:gt}):h.jsxs(h.Fragment,{children:[Je.map((Ze,Be,$e)=>h.jsx(u$,{id:n,index:Be,foundationModel:e,roofType:T,segment:Ze,centroid:Ae,thickness:S,color:lt,sideColor:y,texture:F,heatmap:it&&Be0&&Se[0].lz===Se[2].lz&&Ue&&h.jsx(zW,{cz:Se[0].lz,points:Ue}),b&&!C&&h.jsxs("group",{position:[Ae.x,Ae.y,Ae.z+S],children:[h.jsx(nh,{position:[ve.x,ve.y,ve.z],onPointerDown:Ze=>{if(Oe(t.id,Ze,Xo.Select),G.current=!0,V.current=w,W(!0),zre.set(ve.x,ve.y,De).add(Ae),e){const Be=-Math.atan2(L.position.x-o,L.position.y-r)-e.rotation[2];Dre.set(-Qt,0,Be,"ZXY")}N(Lr.TopMid),kn.getState().setEnableOrbitController(!1),R(Be=>{Be.resizeHandleType=Mt.Top,Be.selectedElementHeight=De+t.thickness})},onPointerOver:()=>{R(Ze=>{Ze.hoveredHandle=Lr.TopMid,Ze.selectedElementHeight=De+t.thickness,Ze.selectedElementX=ve.x,Ze.selectedElementY=ve.y})}}),!q&&h.jsxs(h.Fragment,{children:[h.jsx(nh,{position:[ue.x,ue.y,ue.z],onPointerDown:()=>{G.current=!0,O.current=[...d],se(ue,Se[3]),N(Lr.TopLeft)}}),h.jsx(nh,{position:[he.x,he.y,he.z],onPointerDown:()=>{G.current=!0,O.current=[...d],se(he,Se[1]),N(Lr.TopRight)}}),h.jsx(nh,{position:[we.x,we.y,we.z],onPointerDown:()=>{G.current=!0,O.current=[...f],se(we,Se[3]),N(Lr.FrontLeft)}}),h.jsx(nh,{position:[Pe.x,Pe.y,Pe.z],onPointerDown:()=>{G.current=!0,O.current=[...f],se(Pe,Se[1]),N(Lr.FrontRight)}}),h.jsx(nh,{position:[Ie.x,Ie.y,Ie.z],onPointerDown:()=>{G.current=!0,O.current=[...p],se(Ie,Se[1]),N(Lr.BackLeft)}}),h.jsx(nh,{position:[Me.x,Me.y,Me.z],onPointerDown:()=>{G.current=!0,O.current=[...p],se(Me,Se[3]),N(Lr.BackRight)}})]})]}),U&&h.jsx(ta,{name:"Roof Intersection Plane",ref:k,args:[1e3,100],visible:!1,position:zre,rotation:Dre,onPointerMove:Ze=>{if(k.current&&G.current&&Se&&Se.length===4){Q(Ze);const Be=j.intersectObjects([k.current]);if(Be[0]&&e){const $e=Be[0].point;if($e.z<.001)return;switch(E){case Lr.TopMid:{const wt=Math.max(0,$e.z-e.lz-.3-Re),vt=Re+wt,Rt=Te(Se,vt,f,d,p);o9(Rt,l)&&M.getState().updateRoofRiseById(n,wt,vt+t.thickness);break}case Lr.FrontLeft:{if(e&&Se&&Se.length===4){const wt=me.clamp(oe(e,Se[3],$e),d[0]+.05,.45),vt=De-Se[0].lz,Rt=me.clamp(($e.z-e.lz-Se[0].lz)/vt,0,1),Gt=[wt,Rt],At=Te(Se,De,Gt,d,p);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>ee(ht));Wt&&(Wt.frontRidgePoint[0]=Gt[0],Wt.frontRidgePoint[1]=Gt[1])})}break}case Lr.FrontRight:{if(e&&Se&&Se.length===4){const wt=me.clamp(oe(e,Se[1],$e),-.45,-d[0]-.05),vt=De-Se[0].lz,Rt=me.clamp(($e.z-e.lz-Se[0].lz)/vt,0,1),Gt=[-wt,Rt],At=Te(Se,De,Gt,d,p);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>ee(ht));Wt&&(Wt.frontRidgePoint=[...Gt])})}break}case Lr.TopLeft:{if(e&&Se&&Se.length===4){const vt=[me.clamp(oe(e,Se[3],$e),-p[0]+.05,f[0]-.05),d[1]],Rt=Te(Se,De,f,vt,p);o9(Rt,l)&&R(Gt=>{const At=Gt.elements.find(pt=>ee(pt));At&&(At.topRidgePoint=[...vt])})}break}case Lr.TopRight:{if(e&&Se&&Se.length===4){const vt=[-me.clamp(oe(e,Se[1],$e),-f[0]+.05,p[0]-.05),d[1]],Rt=Te(Se,De,f,vt,p);o9(Rt,l)&&R(Gt=>{const At=Gt.elements.find(pt=>ee(pt));At&&(At.topRidgePoint=[...vt])})}break}case Lr.BackLeft:{if(e&&Se&&Se.length===4){const wt=me.clamp(oe(e,Se[1],$e),-d[0]+.05,.45),vt=De-Se[2].lz,Rt=me.clamp(($e.z-e.lz-Se[2].lz)/vt,0,1),Gt=[wt,Rt],At=Te(Se,De,f,d,Gt);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>ee(ht));Wt&&(Wt.backRidgePoint=[...Gt])})}break}case Lr.BackRight:{if(e&&Se&&Se.length===4){const wt=me.clamp(oe(e,Se[3],$e),-.45,d[0]-.05),vt=De-Se[2].lz,Rt=me.clamp(($e.z-e.lz-Se[2].lz)/vt,0,1),Gt=[-wt,Rt],At=Te(Se,De,f,d,Gt);o9(At,l)&&R(pt=>{const Wt=pt.elements.find(ht=>ee(ht));Wt&&(Wt.backRidgePoint=[...Gt])})}break}}}}},onPointerUp:()=>{switch(E){case Lr.TopMid:{sN(n,V.current,w);break}case Lr.TopLeft:case Lr.TopRight:{ie(n,E,O.current,d);break}case Lr.FrontLeft:case Lr.FrontRight:{ie(n,E,O.current,f);break}case Lr.BackLeft:case Lr.BackRight:{ie(n,E,O.current,p);break}}G.current=!1,W(!1),N(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},rbt=be.memo(obt,ZH),yY=new le,AY=new ln,Ewe=new Kt,ibt=new le(0,0,1),Dz=be.memo(({start:t,end:e,width:n,height:o,offset:r,color:i})=>{const a=m.useMemo(()=>new Kt(t.x,t.y),[t]),l=m.useMemo(()=>new Kt(e.x,e.y),[e]),s=m.useMemo(()=>new Kt().subVectors(l,a).angle(),[a,l]),c=m.useMemo(()=>{const u=new kl,d=a.distanceTo(l),f=t.z-e.z;return u.moveTo(0,0),u.lineTo(d,-f),u.lineTo(d,-f+o),u.lineTo(0,o),u.closePath(),u},[t,e,a,l,o]);return h.jsx("group",{position:r,children:h.jsx(aw,{args:[c,{steps:1,depth:n,bevelEnabled:!1}],position:t,rotation:[Qt,0,s,"ZXY"],castShadow:!0,receiveShadow:!0,children:h.jsx("meshStandardMaterial",{color:i})})})}),abt=({ridgeLeftPoint:t,ridgeRightPoint:e,wallArray:n,height:o,isShed:r,width:i,spacing:a,color:l})=>{const[s,c,u,d]=n,f=m.useMemo(()=>new le().subVectors(e,t).normalize(),[]),p=m.useMemo(()=>t.clone().add(f.clone().multiplyScalar(-(d.eavesLength??0)/2)),[t,d.eavesLength]),g=m.useMemo(()=>e.clone().add(f.clone().multiplyScalar((c.eavesLength??0)/2)),[t,c.eavesLength]),A=s.leftPoint.clone().setZ(s.lz),y=u.rightPoint.clone().setZ(u.lz),S=m.useMemo(()=>{if(n.length<4)return[];const T=new le().subVectors(new le(s.rightPoint.x,s.rightPoint.y,s.lz),A).normalize(),w=new le().subVectors(new le(u.leftPoint.x,u.leftPoint.y,u.lz),y).normalize(),x=t.distanceTo(e),b=new le().subVectors(s.leftPoint,s.rightPoint).length(),R=new le().subVectors(u.leftPoint,u.rightPoint).length(),H=i,F=Math.floor((Math.min(x,b,R)-i)/a)+2;return new Array(F).fill(0).map((E,N)=>{let U;N===F-1?U=x:U=N*a+H;const W=t.clone().add(f.clone().multiplyScalar(U)),k=A.clone().add(T.clone().multiplyScalar(U)),D=y.clone().add(w.clone().multiplyScalar(U)),L=new le().subVectors(k,W).normalize().multiplyScalar(s.eavesLength??0),j=new le().subVectors(D,W).normalize().multiplyScalar(u.eavesLength??0);return k.add(L),D.add(j),{ridge:W,front:k,back:D}})},[a,t]),C=t.distanceTo(A)>t.distanceTo(y),P=new le(-i,0,0),v=new le(0,i/2,0);return h.jsxs(h.Fragment,{children:[S.map((T,w)=>h.jsx(be.Fragment,{children:r?C?h.jsx(Dz,{start:T.ridge,end:T.front,width:i,height:o,color:l}):h.jsx(Dz,{start:T.ridge,end:T.back,width:i,height:o,color:l}):h.jsxs(h.Fragment,{children:[h.jsx(Dz,{start:T.ridge,end:T.front,width:i,height:o,color:l}),h.jsx(Dz,{start:T.ridge,end:T.back,width:i,height:o,color:l,offset:P})]})},w)),h.jsx(Dz,{start:p,end:g,width:i,height:o,color:l,offset:v})]})},lbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new le(0,0,e),a=t.length===1;for(const f of t){const[p,g,A,y]=f.points;r.push(y,p,g,A),a&&r.push(y)}const l=Math.abs(t[0].points[0].z)<.015,s=t[0].points[3],c=t[0].points[2],u=h.jsx(Gn,{points:r,lineWidth:n,color:o}),d=h.jsx(Gn,{points:[s,c],lineWidth:n,color:o});return h.jsxs(h.Fragment,{children:[u,!l&&!a&&d,h.jsxs("group",{position:[0,0,e],children:[u,!l&&!a&&d]}),t.map((f,p)=>{const[g,A,y,S]=f.points;return h.jsxs("group",{children:[h.jsx(Gn,{points:[g,g.clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[A,A.clone().add(i)],lineWidth:n,color:o}),a&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[y,y.clone().add(i)],lineWidth:n,color:o}),h.jsx(Gn,{points:[S,S.clone().add(i)],lineWidth:n,color:o})]})]},p)})]})}),sbt=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,wallsId:r,lz:i,rise:a=i,thickness:l=.2,ridgeLeftPoint:s,ridgeRightPoint:c,textureType:u,color:d="white",sideColor:f="white",locked:p,lineColor:g="black",lineWidth:A=.2,roofStructure:y,rafterSpacing:S=2,rafterWidth:C=.1,rafterColor:P="white",glassTint:v="#73D8FF",opacity:T=.5,ceiling:w=!1}=t;const x=M(pn),b=M(Ap),R=Tc(n);[g,A]=bn.getWireframetStyle(g,A,R,p);const{gl:H,camera:F}=ri(),E=m.useMemo(()=>new l0,[]),N=m.useMemo(()=>new Kt,[]),[U,W]=m.useState(!1),[k,D]=m.useState(Lr.Null),L=Math.abs(s[0])>.45,j=m.useRef(null),B=m.useRef(s[0]),O=m.useRef(c[0]),V=m.useRef(a),G=m.useRef(!1),q=(Ee,ke,Oe)=>{x(st=>{for(const je of st.elements)if(je.id===Ee&&je.type===z.Roof&&je.roofType===Go.Gable){je.ridgeLeftPoint[0]=ke,je.ridgeRightPoint[0]=Oe;break}})},$=(Ee,ke,Oe,st,je)=>{const xt={name:"Resize Gable Roof Ridge",timestamp:Date.now(),resizedElementId:Ee,resizedElementType:z.Roof,oldLeft:ke,oldRight:Oe,newLeft:st,newRight:je,undo:()=>{q(xt.resizedElementId,ke,Oe)},redo:()=>{q(xt.resizedElementId,st,je)}};M.getState().addUndoable(xt)},ie=Ee=>{N.x=Ee.offsetX/H.domElement.clientWidth*2-1,N.y=-(Ee.offsetY/H.domElement.clientHeight)*2+1,E.setFromCamera(N,F)},Q=(Ee,ke,Oe)=>{const st=new Kt(Ee.cx,Ee.cy),je=new le().addVectors(ke.leftPoint,ke.rightPoint).divideScalar(2),xt=new le().subVectors(ke.leftPoint,ke.rightPoint).length(),gt=new Kt(je.x,je.y).rotateAround(Ewe,Ee.rotation[2]).add(st),Ye=Ee.rotation[2]+ke.relativeAngle,ut=new Kt(Oe.x,Oe.y).sub(gt).rotateAround(Ewe,-Ye).x/xt;return Math.min(Math.abs(ut),.5)*(ut>=0?1:-1)},se=(Ee,ke,Oe)=>{if(!Ee)return new le;const st=new le().subVectors(Ee.leftPoint,Ee.rightPoint).length(),je=new le().addVectors(Ee.leftPoint,Ee.rightPoint).divideScalar(2),xt=new ln(0,0,Ee.relativeAngle),gt=new le(ke*st,0,0),Ye=Oe*a+ae;return new le(je.x,je.y,Ye).add(gt.applyEuler(xt))},oe=(Ee,ke)=>{const Oe=Ee[ke];let st,je;return ke===0||ke===2?(st=Oe.lz,je=Oe.lz):ke===1?(st=Ee[0].lz,je=Ee[2].lz):(st=Ee[2].lz,je=Ee[0].lz),{lh:st,rh:je}},Z=(Ee,ke)=>{const Oe=Ee.slice().reverse();return te(Oe,0,ke-1),te(Oe,ke,Oe.length-1),Oe},te=(Ee,ke,Oe)=>{for(;keEe*Oe+ke,de=(Ee,ke,Oe,st,je)=>{const xt=ke[Oe],gt=new le().subVectors(xt.leftPoint,xt.rightPoint).length(),Ye=(je[0]+.5)*gt,{lh:it,rh:ut}=oe(ke,Oe),Qe=je[1]*(st-it)/Ye,lt=it,Ze=-(je[1]*(st-ut))/(gt-Ye),Be=ut-Ze*gt,$e=xt.wallsId.reduce((wt,vt)=>{const Rt=M.getState().elements.find(Gt=>Gt.id===vt);return Rt?[...wt,Rt.lx+wt[wt.length-1]]:wt},[0]);for(let wt=0;wtYe&&(pt.center=[(Ye-Rt)/At-.5,st]),Ee.set(vt,pt)}return Ee},fe=(Ee,ke,Oe,st)=>{const je=new Map;return de(je,Ee,1,ke,st),de(je,Ee,3,ke,Oe),je},pe=(Ee,ke,Oe,st)=>{const[je,xt,gt,Ye]=Ee,it=new Set(je.wallsId),ut=new Set(gt.wallsId),Qe=fe(Ee,ke,Oe,st);x(lt=>{for(const Ze of lt.elements)if(Ze.type===z.Wall&&Ze.foundationId===o){if(it.has(Ze.id)){const Be=Ze;if(Be.roofId=n,Oe[0]===.5)Be.leftRoofHeight=ke,Be.rightRoofHeight=ke,Be.centerRoofHeight=void 0;else{const{lh:$e,rh:wt}=oe(Ee,0);Be.leftRoofHeight=$e,Be.rightRoofHeight=wt}}else if(ut.has(Ze.id)){const Be=Ze;if(Be.roofId=n,Oe[0]===-.5)Be.leftRoofHeight=ke,Be.rightRoofHeight=ke,Be.centerRoofHeight=void 0;else{const{lh:$e,rh:wt}=oe(Ee,2);Be.leftRoofHeight=$e,Be.rightRoofHeight=wt}}else if(Qe.has(Ze.id)){const Be=Qe.get(Ze.id);if(Be){const $e=Ze,{left:wt,right:vt,center:Rt}=Be;if($e.roofId=n,$e.leftRoofHeight=wt,$e.rightRoofHeight=vt,Rt){const[Gt,At]=Rt;$e.centerRoofHeight?($e.centerRoofHeight[0]=Gt,$e.centerRoofHeight[1]=At):$e.centerRoofHeight=[Gt,At]}else $e.centerRoofHeight=void 0}}}})},ye=jye(r[0],o),{highestWallHeight:ae,topZ:Te}=Bye(ye,a,!0);pN(t,ae);const ge=m.useMemo(()=>{if(ye===null||ye.length!==4)return new le;const Ee=ye.map(Oe=>({x:Oe.leftPoint.x,y:Oe.leftPoint.y})),ke=me.calculatePolygonCentroid(Ee);return new le(ke.x,ke.y,Te)},[ye,Te]),Se=m.useMemo(()=>{if(ye===null)return new le;const Ee=ye[3],[ke,Oe]=s;return se(Ee,ke,Oe)},[ye,Te,s]),Re=m.useMemo(()=>{if(ye===null)return new le;const Ee=ye[1],[ke,Oe]=c;return se(Ee,ke,Oe)},[ye,Te,c]),De=m.useMemo(()=>new le((Se.x+Re.x)/2,(Se.y+Re.y)/2,Te),[Se,Re]),Ae=m.useMemo(()=>!ye||ye.length!==4?null:ye.map(Ee=>bn.getComposedWallNormal(Ee).multiplyScalar(Ee.eavesLength)),[ye]),ue=m.useMemo(()=>ibt.clone().multiplyScalar(l),[l]),he=m.useMemo(()=>{const Ee=[];if(!ye||ye.length!==4||!Ae)return Ee;if(L){const ke=[],Oe=s[0]<0?0:2,st=Z(ye,Oe),je=Z(Ae,Oe),[xt,gt,Ye,it]=st,[ut,Qe,lt,Ze]=je,Be=xt.leftPoint,$e=xt.rightPoint,wt=Ye.leftPoint,vt=Ye.rightPoint,Rt=Be.clone().add(ut),Gt=$e.clone().add(ut),At=vt.clone().add(Ze),pt=Be.clone().add(Ze),Wt=$e.clone().add(Qe),ht=wt.clone().add(Qe),ct=wt.clone().add(lt),It=vt.clone().add(lt),{lh:Ft,rh:Ve}=oe(st,0),{lh:ft,rh:kt}=oe(st,2),rt=bn.getDistance(Be,$e,vt),at=Math.min((xt.eavesLength??0)/rt*(Te-Ft),Ft),Ge=bn.getDistance(Be,$e,wt),yt=Math.min((xt.eavesLength??0)/Ge*(Te-Ve),Ve),Pt=bn.getDistance(wt,vt,$e),ot=Math.min((Ye.eavesLength??0)/Pt*(Te-Ve),ft),bt=bn.getDistance(wt,vt,Be),zt=Math.min((Ye.eavesLength??0)/bt*(Te-Ft),kt),Bt=bn.getIntersectionPoint(At,pt,Rt,Gt).setZ(Ft-at).sub(ge),tt=bn.getIntersectionPoint(Rt,Gt,Wt,ht).setZ(Ve-yt).sub(ge),Ht=bn.getIntersectionPoint(Wt,ht,ct,It).setZ(Te+ot).sub(ge),_t=bn.getIntersectionPoint(ct,It,At,pt).setZ(Te+zt).sub(ge);ke.push(Bt,tt,Ht,_t),ke.push(Bt.clone().add(ue),tt.clone().add(ue),Ht.clone().add(ue),_t.clone().add(ue));const un=new le().addVectors(xt.leftPoint,xt.rightPoint).divideScalar(2).clone().sub(De.clone().setZ(0)).length();Ee.push({points:ke,angle:-xt.relativeAngle,length:un})}else{const[ke,Oe,st,je]=ye,[xt,gt,Ye,it]=Ae,ut=ke.leftPoint.clone().add(xt),Qe=ke.rightPoint.clone().add(xt),lt=st.rightPoint.clone().add(it),Ze=ke.leftPoint.clone().add(it),Be=ke.rightPoint.clone().add(gt),$e=st.leftPoint.clone().add(gt),wt=st.leftPoint.clone().add(Ye),vt=st.rightPoint.clone().add(Ye),Rt=bn.getIntersectionPoint(Se,Re,lt.clone(),Ze.clone()).setZ(Se.z).sub(ge),Gt=bn.getIntersectionPoint(Se,Re,Be.clone(),$e.clone()).setZ(Re.z).sub(ge),At=[],{lh:pt,rh:Wt}=oe(ye,0),ht=bn.getDistance(ke.leftPoint,ke.rightPoint,Se),ct=Math.min((ke.eavesLength??0)/ht*(Se.z-pt),pt),It=bn.getDistance(ke.leftPoint,ke.rightPoint,Re),Ft=Math.min((ke.eavesLength??0)/It*(Re.z-Wt),Wt),Ve=bn.getIntersectionPoint(lt,Ze,ut,Qe).setZ(pt-ct).sub(ge),ft=bn.getIntersectionPoint(ut,Qe,Be,$e).setZ(Wt-Ft).sub(ge);At.push(Ve,ft,Gt,Rt),At.push(Ve.clone().add(ue),ft.clone().add(ue),Gt.clone().add(ue),Rt.clone().add(ue));const rt=new le().addVectors(ke.leftPoint,ke.rightPoint).divideScalar(2).clone().sub(ge.clone().setZ(0)).length();Ee.push({points:At,angle:-ke.relativeAngle,length:rt});const at=[],{lh:Ge,rh:yt}=oe(ye,2),Pt=bn.getDistance(st.leftPoint,st.rightPoint,Re),ot=Math.min((st.eavesLength??0)/Pt*(Re.z-Ge),Ge),bt=bn.getDistance(st.leftPoint,st.rightPoint,Se),zt=Math.min((st.eavesLength??0)/bt*(Se.z-yt),yt),Bt=bn.getIntersectionPoint(Be,$e,wt,vt).setZ(Ge-ot).sub(ge),tt=bn.getIntersectionPoint(wt,vt,lt,Ze).setZ(yt-zt).sub(ge);at.push(Bt,tt,Rt,Gt),at.push(Bt.clone().add(ue),tt.clone().add(ue),Rt.clone().add(ue),Gt.clone().add(ue));const _t=new le().addVectors(st.leftPoint,st.rightPoint).divideScalar(2).clone().sub(ge.clone().setZ(0)).length();Ee.push({points:at,angle:-st.relativeAngle,length:_t})}return Ee},[ye,Se,Re,Te,l]),ve=m.useMemo(()=>!ye||ye.length!==4?null:ye.map(Ee=>Ee.leftPoint),[ye]);m.useEffect(()=>{(!ye||ye.length!==4)&&b(n,!1,!1,!0)},[ye]);const we=EQ();m.useEffect(()=>{if((ye==null?void 0:ye.length)!==4)return;(M.getState().addedRoofIdSet.has(n)||!we)&&(pe(ye,Te,s,c),DQ(e,n,he,ge,Te,l),M.getState().deleteAddedRoofId(n))},[he]),Yye(e,n,he,ge,Te,l);const Pe=()=>{if(!ye||ye.length!==4)return;const Ee=[];if(L){const ke=s[0]<0?0:2,st=Z(ye,ke).map((je,xt,gt)=>new le(je.leftPoint.x,je.leftPoint.y,oe(gt,xt).lh));Ee.push(st)}else{const ke=ye.map((Oe,st,je)=>new le(Oe.leftPoint.x,Oe.leftPoint.y,oe(je,st).lh));Ee.push([ke[0],ke[1],Re.clone(),Se.clone()]),Ee.push([ke[2],ke[3],Se.clone(),Re.clone()])}Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,Ee)};fN(n,ge,he,!1,Go.Gable),hN(Pe);const Ie=M(Ee=>Ee.elements.filter(ke=>ke.parentId===n&&ke.type===z.Window),cy),Me=M(pu),ze=dt(hs),Ne=M(Pf),Je=Cn(c1),[Ue,nt]=m.useState([]);m.useEffect(()=>{if(ze){const Ee=he.length;if(Ee>0){const ke=[];for(let Oe=0;Oe{cN(Ee,e.id,n,he,ge)},onPointerMove:Ee=>{dN(Ee,n)},onPointerUp:Ee=>{uN(Ee,t)},onContextMenu:Ee=>{CR(Ee,n)},children:[he.map((Ee,ke,Oe)=>{const{points:st,angle:je,length:xt}=Ee,gt=Math.abs(st[0].z)<.1;return ye?h.jsx(cbt,{index:ke,id:n,points:st,centroid:ge,angle:gt?Oe[0].angle:je,length:gt?1:xt,textureType:u,heatmaps:Ue,color:d,sideColor:f,roofStructure:y,glassTint:v,opacity:T,relativeAngle:ke===0?ye[0].relativeAngle:ye[2].relativeAngle,foundation:e,windows:Ie},ke):null}),T>0&&h.jsx(lbt,{roofSegments:he,thickness:l,lineColor:g,lineWidth:y===Ac.Rafter?.1:A})]}),w&&a>0&&ye[0].lz===ye[2].lz&&ve&&h.jsx(zW,{cz:ye[0].lz,points:ve}),y===Ac.Rafter&&ye&&ye.length===4&&h.jsx("group",{onContextMenu:Ee=>{CR(Ee,n)},onPointerDown:Ee=>{p$e(Ee,n,o)},children:h.jsx(abt,{ridgeLeftPoint:Se,ridgeRightPoint:Re,wallArray:ye,overhang:0,isShed:L,height:l,spacing:S,color:P,width:C})}),R&&!p&&h.jsxs("group",{position:[0,0,l],children:[h.jsx(nh,{position:[De.x,De.y,De.z+.15],onPointerDown:Ee=>{if(Me(t.id,Ee,Xo.Select),G.current=!0,V.current=a,W(!0),yY.set(De.x,De.y,Te),e){const ke=-Math.atan2(F.position.x-e.cx,F.position.y-e.cy)-e.rotation[2];AY.set(-Qt,0,ke,"ZXY")}D(Lr.Mid),kn.getState().setEnableOrbitController(!1),x(ke=>{ke.resizeHandleType=Mt.Top,ke.selectedElementHeight=Te+t.thickness})},onPointerOver:()=>{x(Ee=>{Ee.hoveredHandle=Lr.Mid,Ee.selectedElementHeight=Te+t.thickness,Ee.selectedElementX=De.x,Ee.selectedElementY=De.y})}}),h.jsx(nh,{position:[Se.x,Se.y,Se.z+.15],onPointerDown:()=>{if(G.current=!0,B.current=s[0],O.current=c[0],W(!0),yY.set(Se.x,Se.y,Te),e&&ye&&ye[3]){const Ee=new le().subVectors(Se,F.position).normalize(),ke=Math.atan2(Ee.z,Math.hypot(Ee.x,Ee.y)),Oe=ye[3].relativeAngle;AY.set(-Qt+ke,0,Oe,"ZXY")}D(Lr.Left),kn.getState().setEnableOrbitController(!1)}}),h.jsx(nh,{position:[Re.x,Re.y,Re.z+.15],onPointerDown:()=>{if(G.current=!0,B.current=s[0],O.current=c[0],W(!0),yY.set(Re.x,Re.y,Te),e&&ye&&ye[1]){const Ee=new le().subVectors(Re,F.position).normalize(),ke=Math.atan2(Ee.z,Math.hypot(Ee.x,Ee.y)),Oe=ye[1].relativeAngle;AY.set(-Qt+ke,0,Oe,"ZXY")}D(Lr.Right),kn.getState().setEnableOrbitController(!1)}})]}),U&&h.jsx(ta,{name:"Roof Intersection Plane",ref:j,args:[1e3,100],visible:!1,position:yY,rotation:AY,onPointerMove:Ee=>{if(j.current&&G.current&&e&&ye&&ye.length===4){ie(Ee);const ke=E.intersectObjects([j.current]);if(ke[0]){const Oe=ke[0].point;if(Oe.z<.001)return;switch(k){case Lr.Left:{const st=ye[3];if(st){let je=Q(e,st,Oe);Math.abs(je)>=.45&&Math.abs(je)<.5&&(je=.45*Math.sign(je));const xt=[je,s[1]],gt=[-je,c[1]],Ye=fe(ye,Te,xt,gt);o9(Ye,o)&&q(n,je,-je)}break}case Lr.Right:{const st=ye[1];if(st){let je=Q(e,st,Oe);Math.abs(je)>=.45&&Math.abs(je)<.5&&(je=.45*Math.sign(je));const xt=[-je,s[1]],gt=[je,c[1]],Ye=fe(ye,Te,xt,gt);o9(Ye,o)&&q(n,-je,je)}break}case Lr.Mid:{let st;L?st=Math.max(0,Oe.z-e.lz-.3-ae):st=Math.max(-ae+.01,Oe.z-e.lz-.3-ae);const je=ae+st,xt=fe(ye,je,s,c);o9(xt,o)&&M.getState().updateRoofRiseById(n,st,Te+t.thickness);break}}}}},onPointerUp:()=>{switch(k){case Lr.Mid:{sN(n,V.current,a);break}case Lr.Left:case Lr.Right:$(n,B.current,O.current,s[0],c[0])}G.current=!1,W(!1),D(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},cbt=({index:t,id:e,points:n,centroid:o,angle:r,length:i,textureType:a,heatmaps:l,color:s="white",sideColor:c,relativeAngle:u,foundation:d,roofStructure:f,glassTint:p,opacity:g=.5,windows:A})=>{const y=M.getState().world;M(Jn);const S=M(s3),C=dt(hs),P=dt(p3),v=M(e5),T=M(a3),w=M(l3),x=Cn(yW),b=Cn.getState().hourlyHeatExchangeArrayMap,R=eM(f===Ac.Rafter?Ur.NoTexture:a),{transparent:H,opacity:F}=tM(f===Ac.Rafter,g),{invalidate:E}=ri(),N=m.useRef(null),U=m.useRef(null),W=m.useRef(null),k=m.useRef(null),D=m.useRef(0),L=m.useRef(),j=m.useRef(),[B,O]=m.useState(0),[V,G]=m.useState(0),[q,$]=m.useState(!0),ie=(ee,de)=>ee.clone().setZ(0).distanceTo(de.clone().setZ(0))>2,Q=ee=>Math.abs(ee){if(!P)return;const ee=x(e);if(!ee)return;const de=[],[fe,pe,ye,ae,Te]=n,ge=Te.z-fe.z,Se=new le(0,0,ge+.1);for(const Re of ee.values()){let De=[];De.push(Re[0].clone().sub(o).add(Se)),De.push(Re[1].clone().sub(o).add(Se)),de.push(De),De=[],De.push(Re[0].clone().sub(o).add(Se)),De.push(Re[3].clone().sub(o).add(Se)),de.push(De),De=[],De.push(Re[1].clone().sub(o).add(Se)),De.push(Re[2].clone().sub(o).add(Se)),de.push(De)}return de},[P]),oe=m.useMemo(()=>{if(!P||d&&d.notBuilding)return;const ee=b.get(e+"-"+t);if(!ee)return;const de=ee.reduce((Ye,it)=>Ye+it,0),fe=x(e);if(!fe||!fe[t])return;const[pe,ye,ae,Te,ge]=n,Se=ge.z-pe.z,Re=fe[t].map(Ye=>Ye.clone().sub(o).add(new le(0,0,Se)));if(!Re)return;let De=me.getTriangleArea(Re[0],Re[1],Re[2])+me.getTriangleArea(Re[2],Re[3],Re[0]);if(De===0)return;let Ae=S(z.Window,e);const ue=x(e);if(ue&&ue[t]&&(Ae=Ae.filter(Ye=>{const it=Ye,ut=it.cy+(it.windowType===Ci.Polygonal&&it.polygonTop?it.polygonTop[1]/2:0);return bn.onSegment(ue[t],Ye.cx,ut)})),Ae&&Ae.length>0)for(const Ye of Ae)De-=me.getWindowArea(Ye);const he=i3*(y.solarRadiationHeatmapGridCellSize??.5),ve=Re[0].clone(),we=Re[1].clone(),Pe=Re[2].clone(),Ie=new le().subVectors(we,ve),Me=new le().subVectors(Pe,ve),ze=new le().subVectors(Pe,we),Ne=Ie.length(),Je=new le().crossVectors(Me,ze).length()/Ne,Ue=Math.max(2,Math.round(Ne/he)),nt=Math.max(2,Math.round(Je/he));Ie.normalize(),Me.normalize(),ze.normalize();const We=new le().crossVectors(Me,ze).normalize(),Ee=Ie.multiplyScalar(.5*Ne/Ue),ke=new le().crossVectors(We,Ie).normalize().multiplyScalar(.5*Je/nt),Oe=ve.clone().add(Ee).add(ke);Ee.multiplyScalar(2),ke.multiplyScalar(2);const st=de/De*(v??Qm);D.current=st<0?1:0,L.current=We.clone().multiplyScalar(.1),j.current=me.getEuler(ko,We,"YXZ",-Math.sign(st)*Qt);const je=[],xt=new le;let gt;for(let Ye=0;Ye0){const Qe=xt.x+o.x,lt=xt.y+o.y;for(const Ze of Ae){const Be=bn.getRelativeWindowVerticesOnRoof(Ze),$e=me.getPoints(Be);if(me.isPointInside(Qe,lt,$e)){gt=!1;break}}}if(gt){const Qe=[];st<0?(Qe.push(xt.clone()),Qe.push(xt.clone().add(We.clone().multiplyScalar(-st)))):(Qe.push(xt.clone()),Qe.push(xt.clone().add(We.clone().multiplyScalar(st)))),je.push(Qe)}}}return je},[P,v,o,n]);m.useEffect(()=>{const[ee,de,fe,pe,ye]=n,ae=ye.z-ee.z;if(N.current){const Te=N.current.geometry;if(Te){const ge=new Float32Array(18),Se=ae+.01;ge[0]=n[0].x,ge[1]=n[0].y,ge[2]=n[0].z+Se,ge[3]=n[1].x,ge[4]=n[1].y,ge[5]=n[1].z+Se,ge[6]=n[2].x,ge[7]=n[2].y,ge[8]=n[2].z+Se,ge[9]=n[2].x,ge[10]=n[2].y,ge[11]=n[2].z+Se,ge[12]=n[3].x,ge[13]=n[3].y,ge[14]=n[3].z+Se,ge[15]=n[0].x,ge[16]=n[0].y,ge[17]=n[0].z+Se,Te.setAttribute("position",new gr(ge,3)),Te.computeVertexNormals();const Re=[];Re.push(0,0),Re.push(1,0),Re.push(1,1),Re.push(1,1),Re.push(0,1),Re.push(0,0),Te.setAttribute("uv",new gr(Re,2))}}if(U.current){U.current.geometry=new Nce(n,r,i);const Te=ie(ee,pe)&&ie(de,fe);if($(Te),f===Ac.Glass&&Te){const ge=me.calculatePolygonCentroid(n.map(me.mapVector3ToPoint2)),Se=new le(ge.x,ge.y,0),Re=.25,De=new le().addVectors(ee,Se.clone().sub(ee).setZ(0).normalize().multiplyScalar(Re)),Ae=new le().addVectors(de,Se.clone().sub(de).setZ(0).normalize().multiplyScalar(Re)),ue=new le().addVectors(fe,Se.clone().sub(fe).normalize().multiplyScalar(Re)),he=new le().addVectors(pe,Se.clone().sub(pe).normalize().multiplyScalar(Re)),ve=[];ve.push(De),ve.push(Ae),ve.push(ue.setZ(Ae.z)),ve.push(he.setZ(De.z)),ve.push(De.clone().setZ(1)),ve.push(Ae.clone().setZ(1)),ve.push(ue.clone().setZ(1)),ve.push(he.clone().setZ(1));const we=new ls(new Nce(ve)),Pe=cc.subtract(U.current,we);if(U.current.geometry=Pe.geometry,Q(u)){const Me=De.distanceTo(Ae),ze=ee.distanceTo(pe);O(Me),G(ze);const Ne=new le().subVectors(ee,pe).angleTo(new le(0,-1,0));W.current&&(W.current.scale.set(Me,ze,1),W.current.rotation.set(Ne,0,0)),k.current&&k.current.rotation.set(Ne-Qt,0,0)}else{const Me=ee.distanceTo(pe),ze=De.distanceTo(Ae);O(Me),G(ze);const Ne=new le().subVectors(ee,pe).angleTo(new le(1,0,0));W.current&&(W.current.scale.set(Me,ze,1),W.current.rotation.set(0,Ne,0)),k.current&&k.current.rotation.set(Qt,Ne,0,"YXZ")}const Ie=(ee.z+pe.z)/2+ae*.75;W.current&&W.current.position.set(ge.x,ge.y,Ie),k.current&&k.current.position.set(ge.x,ge.y,Ie)}}E()},[n,r,i,u,q,C,f]);const Z={points:n,angle:r,length:i},te=a===Ur.Default||a===Ur.NoTexture?s:"white";return h.jsxs(h.Fragment,{children:[(F>0&&f===Ac.Rafter||f!==Ac.Rafter)&&h.jsx(h.Fragment,{children:h.jsx(MOe,{id:e,index:t,segment:Z,color:te,sideColor:c??"white",texture:R,heatmap:l[t],transparent:H,opacity:F,windows:A,centroid:o})}),se&&se.map((ee,de)=>h.jsx(Gn,{points:ee,color:"gray",lineWidth:.5,dashed:!0,dashSize:.2,gapSize:.1,receiveShadow:!1,castShadow:!1,name:"Overhang Boundary "+de},de)),oe&&oe.map((ee,de)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:ee,name:"Heat Flux "+de,lineWidth:w??Zm,color:T??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:L.current?ee[D.current].clone().add(L.current):ee[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:j.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:T??p0})})]},de))]})},ubt=be.memo(sbt,ZH),dbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{if(t.length===0)return null;const r=[],i=new le(0,0,e);for(let u=0;u{const[f,p,g,A]=u.points,y=[f.clone().sub(i),f];return h.jsx(Gn,{points:y,lineWidth:n,color:o},d)})]})]})}),T4=new le,P4=new ln,fbt=new le(0,0,1),hbt=({roofModel:t,foundationModel:e})=>{let{id:n,parentId:o,cx:r,cy:i,lz:a,wallsId:l,leftRidgeLength:s,rightRidgeLength:c,textureType:u,color:d="white",sideColor:f="white",thickness:p=.2,locked:g,lineColor:A="black",lineWidth:y=.2,roofType:S,rise:C=a,ceiling:P=!1}=t;const v=M(Jn),T=M(pn),w=M(Ap),x=jye(l[0],o),b=eM(u),R=Tc(n),[H,F]=m.useState(!1),[E,N]=m.useState(Lr.Null),[U,W]=m.useState(s),[k,D]=m.useState(c),{highestWallHeight:L,topZ:j}=Bye(x,C);pN(t,L);const B=m.useRef(null),{gl:O,camera:V}=ri(),G=m.useMemo(()=>new l0,[]),q=m.useMemo(()=>new Kt,[]),$=m.useRef(!1),ie=m.useRef(C),Q=C<.01;[A,y]=bn.getWireframetStyle(A,y,R,g),m.useEffect(()=>{W(s)},[s]),m.useEffect(()=>{D(c)},[c]);const se=(We,Ee,ke,Oe=!1)=>{T(st=>{for(const je of st.elements)if(je.id===We&&je.type===z.Roof&&je.roofType===Go.Hip){je.leftRidgeLength=Ee,je.rightRidgeLength=ke,Oe&&(st.updateElementOnRoofFlag=!0);break}})},oe=(We,Ee,ke,Oe,st)=>{const je={name:"Resize Hip Roof Ridge",timestamp:Date.now(),resizedElementId:We,resizedElementType:z.Roof,oldLeftRidgeLength:Ee,oldRightRidgeLength:ke,newLeftRidgeLength:Oe,newRightRidgeLength:st,undo:()=>{se(je.resizedElementId,je.oldLeftRidgeLength,je.oldRightRidgeLength,!0)},redo:()=>{se(je.resizedElementId,je.newLeftRidgeLength,je.newRightRidgeLength,!0)}};M.getState().addUndoable(je)},Z=We=>{const Ee=[];for(const ke of We)Ee.push({x:ke.leftPoint.x,y:ke.leftPoint.y});return Ee},te=We=>{q.x=We.offsetX/O.domElement.clientWidth*2-1,q.y=-(We.offsetY/O.domElement.clientHeight)*2+1,G.setFromCamera(q,V)},ee=(We,Ee,ke,Oe,st)=>{We.push(Ee,ke,Oe),st&&We.push(st),We.push(Ee.clone().add(ge),ke.clone().add(ge),Oe.clone().add(ge)),st&&We.push(st.clone().add(ge))},de=()=>{if(x===null||x.length!==4)return 0;const We=x.map(Oe=>Oe.leftPoint),Ee=[pe,ye,ye,pe];let ke=1/0;for(let Oe=0;Oe<4;Oe++){const st=x[Oe],je=bn.getDistance(We[Oe],We[(Oe+1)%4],Ee[Oe]),xt=Math.min((st.eavesLength??0)/je*(Ee[Oe].z-st.lz),st.lz),gt=bn.getDistance(We[Oe],We[(Oe+1)%4],Ee[(Oe+1)%4]),Ye=Math.min((st.eavesLength??0)/gt*(Ee[(Oe+1)%4].z-st.lz),st.lz);ke=Math.min(Math.min(xt,Ye),ke)}return Number.isNaN(ke)?0:ke},fe=m.useMemo(()=>{if(x===null||x.length!==4)return new Kt;const We=Z(x),Ee=me.calculatePolygonCentroid(We);return new Kt(Ee.x,Ee.y)},[x]),pe=m.useMemo(()=>{const We=new le,Ee=new le(fe.x,fe.y,j),ke=v(l[0]);return ke&&We.setX(-U).applyEuler(new ln(0,0,ke.relativeAngle)).add(Ee),We},[fe,j,U]),ye=m.useMemo(()=>{const We=new le,Ee=new le(fe.x,fe.y,j),ke=v(l[0]);return ke&&We.setX(k).applyEuler(new ln(0,0,ke.relativeAngle)).add(Ee),We},[fe,j,k]),ae=m.useMemo(()=>new le(fe.x,fe.y,j),[fe,j]),Te=m.useMemo(()=>x===null||x.length!==4?[]:x.map(We=>bn.getComposedWallNormal(We).multiplyScalar(We.eavesLength)),[x]),ge=m.useMemo(()=>fbt.clone().multiplyScalar(p),[p]),Se=m.useMemo(()=>x===null||x.length!==4?null:x.map((We,Ee)=>({leftPoint:We.leftPoint.clone().add(Te[Ee]),rightPoint:We.rightPoint.clone().add(Te[Ee])})),[x,Te]),Re=m.useMemo(()=>{const We=[];if(x===null||x.length!==4||Se===null)return We;const Ee=de();for(let ke=0;ke<4;ke++){const Oe=[],st=x[ke],{lh:je,rh:xt}=bn.getComposedWallHeight(x,ke),gt=bn.getIntersectionPoint(Se[(ke+3)%4].leftPoint,Se[(ke+3)%4].rightPoint,Se[ke].leftPoint,Se[ke].rightPoint).setZ(je-Ee).sub(ae),Ye=bn.getIntersectionPoint(Se[ke].leftPoint,Se[ke].rightPoint,Se[(ke+1)%4].leftPoint,Se[(ke+1)%4].rightPoint).setZ(xt-Ee).sub(ae),it=new le().addVectors(st.leftPoint,st.rightPoint).divideScalar(2),ut=pe.clone().sub(ae),Qe=ye.clone().sub(ae);let lt=0;switch(ke){case 0:lt=it.clone().sub(ae.clone().setZ(0)).length(),ee(Oe,gt,Ye,Qe,ut);break;case 1:lt=it.clone().sub(ye.clone().setZ(0)).length(),ee(Oe,gt,Ye,Qe);break;case 2:lt=it.clone().sub(ae.clone().setZ(0)).length(),ee(Oe,gt,Ye,ut,Qe);break;case 3:lt=it.clone().sub(pe.clone().setZ(0)).length(),ee(Oe,gt,Ye,ut);break}We.push({points:Oe,angle:-st.relativeAngle,length:lt})}return We},[x,pe,ye,j,p]),De=m.useMemo(()=>!x||x.length!==4?null:x.map(We=>We.leftPoint),[x]);m.useEffect(()=>{if(x===null||x.length!==4)w(n,!1,!1,!0);else if(M.getState().addedRoofIdSet.has(n)){for(let Ee=0;Ee{for(const st of Oe.elements)if(st.type===z.Wall&&ke.has(st.id)){const je=st;je.roofId=n,je.leftRoofHeight=void 0,je.rightRoofHeight=void 0}})}M.getState().deleteAddedRoofId(n)}},[x]),Oye(e,n,Re,ae,j,p);const Ae=()=>{if(!x)return;const We=[];for(let Ee=0;Ee<4;Ee++){const ke=x[Ee],{lh:Oe,rh:st}=bn.getComposedWallHeight(x,Ee),je=ke.leftPoint.clone().setZ(Oe),xt=ke.rightPoint.clone().setZ(st),gt=pe.clone(),Ye=ye.clone();switch(Ee){case 0:We.push([je,xt,Ye,gt]);break;case 1:We.push([je,xt,Ye]);break;case 2:We.push([je,xt,gt,Ye]);break;case 3:We.push([je,xt,gt]);break}}if(Q){const Ee=[];for(const ke of We)Ee.push(ke[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[Ee])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,We)},ue=fN(n,new le(fe.x,fe.y,j),Re,Q,Go.Hip);hN(Ae);const he=M(We=>We.elements.filter(Ee=>Ee.parentId===n&&Ee.type===z.Window),cy),ve=M(pu),we=dt(hs),Pe=M(Pf),Ie=Cn(c1),[Me,ze]=m.useState(null),[Ne,Je]=m.useState([]);m.useEffect(()=>{if(we)if(C>0){const We=Re.length;if(We>0){const Ee=[];for(let ke=0;ke0&&e){const Oe=new ln(0,0,e.rotation[2],"ZYX");let st=Number.MAX_VALUE,je=Number.MAX_VALUE,xt=-Number.MAX_VALUE,gt=-Number.MAX_VALUE;for(const Ze of ke)for(const Be of Ze){const $e=Be.clone().applyEuler(Oe);$e.x>xt&&(xt=$e.x),$e.xgt&&(gt=$e.y),$e.y{cN(We,e.id,n,Re,ae)},onPointerMove:We=>{dN(We,n)},onPointerUp:We=>{uN(We,t)},onContextMenu:We=>{CR(We,n)},children:Q?h.jsx(FQ,{id:n,foundationModel:e,roofType:S,roofSegments:Re,center:new le(fe.x,fe.y,j),thickness:p,lineWidth:y,lineColor:A,sideColor:f,color:nt,textureType:u,heatmap:Me}):h.jsxs(h.Fragment,{children:[Re.map((We,Ee,ke)=>h.jsx(u$,{id:n,index:Ee,foundationModel:e,roofType:S,segment:We,centroid:ae,thickness:p,color:nt,sideColor:f,texture:b,heatmap:Ne&&Ee0&&De&&h.jsx(zW,{cz:x[0].lz,points:De}),R&&!g&&h.jsxs("group",{position:[0,0,p+.15],children:[h.jsx(nh,{position:[pe.x,pe.y,pe.z],onPointerDown:()=>{if($.current=!0,F(!0),T4.set(pe.x,pe.y,j),e&&x[0]){const We=M.getState().cameraDirection,Ee=Math.atan2(We.z,We.y),ke=x[0].relativeAngle;P4.set(-Qt-Ee,0,ke,"ZXY")}N(Lr.Left),kn.getState().setEnableOrbitController(!1)}}),h.jsx(nh,{position:[ae.x,ae.y,ae.z],onPointerDown:We=>{if(ve(t.id,We,Xo.Select),$.current=!0,ie.current=C,F(!0),T4.set(ae.x,ae.y,j),e){const Ee=-Math.atan2(V.position.x-r,V.position.y-i)-e.rotation[2];P4.set(-Qt,0,Ee,"ZXY")}N(Lr.Mid),kn.getState().setEnableOrbitController(!1),T(Ee=>{Ee.resizeHandleType=Mt.Top,Ee.selectedElementHeight=j+t.thickness})},onPointerOver:()=>{T(We=>{We.hoveredHandle=Lr.Mid,We.selectedElementHeight=j+t.thickness,We.selectedElementX=fe.x,We.selectedElementY=fe.y})}}),h.jsx(nh,{position:[ye.x,ye.y,ye.z],onPointerDown:()=>{if($.current=!0,F(!0),T4.set(ye.x,ye.y,j),e&&x[0]){const We=M.getState().cameraDirection,Ee=Math.atan2(We.z,We.y),ke=x[0].relativeAngle;P4.set(-Qt-Ee,0,ke,"ZXY")}N(Lr.Right),kn.getState().setEnableOrbitController(!1)}})]}),H&&h.jsx(ta,{name:"Roof Intersection Plane",ref:B,args:[1e3,100],visible:!1,position:T4,rotation:P4,onPointerMove:We=>{if(B.current&&$.current){te(We);const Ee=G.intersectObjects([B.current]);if(Ee[0]&&e){const ke=Ee[0].point;if(ke.z<.001)return;const Oe=x[0],st=new le().subVectors(Oe.rightPoint,Oe.leftPoint).length();switch(E){case Lr.Left:{const je=ae.clone().sub(T4).applyEuler(new ln(0,0,-P4.z)),xt=ke.clone().sub(new le(e.cx,e.cy,e.cz)).applyEuler(new ln(0,0,-e.rotation[2])).sub(T4).applyEuler(new ln(0,0,-P4.z)),gt=new le().subVectors(xt,je).x;W(me.clamp(-gt,-k+.1,st/2-.01));break}case Lr.Right:{const je=ae.clone().sub(T4).applyEuler(new ln(0,0,-P4.z)),xt=ke.clone().sub(new le(e.cx,e.cy,e.cz)).applyEuler(new ln(0,0,-e.rotation[2])).sub(T4).applyEuler(new ln(0,0,-P4.z)),gt=new le().subVectors(xt,je).x;D(me.clamp(gt,-U+.1,st/2-.01));break}case Lr.Mid:{const je=Math.max(0,ke.z-e.lz-.3-L);M.getState().updateRoofRiseById(n,je,j+t.thickness);break}}}}},onPointerUp:()=>{switch(E){case Lr.Mid:{sN(n,ie.current,C);break}case Lr.Left:case Lr.Right:se(n,U,k),oe(n,s,c,U,k)}$.current=!1,F(!1),N(Lr.Null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})})]})},pbt=be.memo(hbt,ZH),Ere=new le,Fre=new ln,gbt=new le(0,0,1),mbt=be.memo(({roofSegments:t,thickness:e,lineWidth:n,lineColor:o})=>{const r=m.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[1]),[t[0].points[0]]),[t]),i=m.useMemo(()=>t.reduce((s,c)=>s.concat(c.points[6].clone()),[t[0].points[7].clone()]),[t]),a=m.useMemo(()=>h.jsx(Gn,{points:r,lineWidth:n,color:o}),[r,n,o]);if(t.length<2)return null;const l=Math.abs(t[0].points[0].z-t[0].points[3].z)<.1;return h.jsxs(h.Fragment,{children:[!l&&h.jsx(Gn,{points:i,lineWidth:n,color:o}),a,h.jsx("group",{position:[0,0,e],children:a}),t.map((s,c)=>h.jsxs(be.Fragment,{children:[!l&&h.jsx(Gn,{points:[s.points[7],s.points[4]],lineWidth:n,color:o}),h.jsx(Gn,{points:[s.points[4],s.points[0]],lineWidth:n,color:o})]},c))]})}),ybt=({roofModel:t,foundationModel:e})=>{let{id:n,wallsId:o,cx:r,cy:i,lz:a,textureType:l,color:s="white",sideColor:c="white",thickness:u=.2,locked:d,lineColor:f="black",lineWidth:p=.2,roofType:g,foundationId:A,ridgeWidth:y=1,rise:S=a,ceiling:C=!1,frontRidge:P,backRidge:v}=t;const T=eM(l),w=Tc(n);[f,p]=bn.getWireframetStyle(f,p,w,d);const x=M(pn),b=M(Ap),R=M(Cs),H=M(ht=>ht.ray),F=M(ht=>ht.mouse),[E,N]=m.useState(y),[U,W]=m.useState(null),[k,D]=m.useState(!1),[L,j]=m.useState(Lr.Null),[B,O]=m.useState(null),V=m.useRef(E),G=m.useRef(S),q=m.useRef(null),$=m.useRef(!1),{gl:ie,camera:Q}=ri(),se=S<.01,oe=ht=>{const ct=[],It=ht.length;for(const Ft of ht)Ft.leftPoint[0]!==void 0&&Ft.leftPoint[1]!==void 0&&ct.push({x:Ft.leftPoint[0],y:Ft.leftPoint[1]});return ye.current||(ht[It-1].rightPoint[0]||ht[It-1].rightPoint[0]===0)&&(ht[It-1].rightPoint[1]||ht[It-1].rightPoint[1]===0)&&ct.push({x:ht[It-1].rightPoint[0],y:ht[It-1].rightPoint[1]}),ct},Z=ht=>{if(ht{F.x=ht.offsetX/ie.domElement.clientWidth*2-1,F.y=-(ht.offsetY/ie.domElement.clientHeight)*2+1,H.setFromCamera(F,Q)},ee=(ht,ct)=>{x(It=>{for(const Ft of It.elements)if(Ft.id===ht&&Ft.type===z.Roof&&Ft.roofType===Go.Mansard){Ft.ridgeWidth=ct;break}})},de=()=>{let ht=1/0;for(let ct=0;ct{const Ve={name:"Resize Mansard Roof Ridge",timestamp:Date.now(),resizedElementId:ht,resizedElementType:z.Roof,oldVal:It,newVal:Ft,type:ct,undo:()=>{ee(Ve.resizedElementId,Ve.oldVal)},redo:()=>{ee(Ve.resizedElementId,Ve.newVal)}};M.getState().addUndoable(Ve)},{currentWallArray:pe,isLoopRef:ye}=y$e(A,n,o),{highestWallHeight:ae,topZ:Te}=A$e(pe,S);pN(t,ae);const ge=m.useMemo(()=>{if(pe.length<2)return new le;const ht=oe(pe),ct=me.calculatePolygonCentroid(ht);return Number.isNaN(ct.x)||Number.isNaN(ct.y)?new le:new le(ct.x,ct.y,Te)},[pe,Te]),Se=m.useMemo(()=>{const ht=pe.map(ct=>bn.getWallNormal(ct).multiplyScalar(ct.eavesLength??0));if(!ye.current&&ht.length!==0){const ct=new le().subVectors(new le(pe[pe.length-1].rightPoint[0],pe[pe.length-1].rightPoint[1]),new le(pe[0].leftPoint[0],pe[0].leftPoint[1])).applyEuler(AG).normalize().multiplyScalar(.3);ht.push(ct)}return ht},[pe]),Re=m.useMemo(()=>{const ht=pe.map((ct,It)=>({leftPoint:new le(ct.leftPoint[0],ct.leftPoint[1]).add(Se[It]),rightPoint:new le(ct.rightPoint[0],ct.rightPoint[1]).add(Se[It])}));return!ye.current&&ht.length!==0&&ht.push({leftPoint:new le(pe[pe.length-1].rightPoint[0],pe[pe.length-1].rightPoint[1]).add(Se[Se.length-1]),rightPoint:new le(pe[0].leftPoint[0],pe[0].leftPoint[1]).add(Se[Se.length-1])}),ht},[pe,Se]),De=m.useMemo(()=>{const ht=pe.map((ct,It)=>{const Ft=new le(ct.leftPoint[0],ct.leftPoint[1]),Ve=new le(ct.rightPoint[0],ct.rightPoint[1]),ft=new le().subVectors(ge,Ft).setZ(0).normalize().multiplyScalar(E),kt=new le().subVectors(ge,Ve).setZ(0).normalize().multiplyScalar(E);return Ft.add(ft).setZ(Te),Ve.add(kt).setZ(Te),{leftPoint:Ft,rightPoint:Ve}});return!ye.current&&ht.length!==0&&ht.push({leftPoint:ht[ht.length-1].rightPoint,rightPoint:ht[0].leftPoint}),ht},[pe,ge,E]),Ae=m.useMemo(()=>gbt.clone().multiplyScalar(u),[u]),ue=m.useMemo(()=>{const ht=[];if(pe.length<2)return ht;const ct=de();for(let It=0;It0&&Ft.rightPoint.length>0&&(Ft.leftPoint[0]!==Ft.rightPoint[0]||Ft.leftPoint[1]!==Ft.rightPoint[1])){const Ve=[];let{lh:ft,rh:kt}=bn.getWallHeight(pe,It);ye.current||(It===0&&(ft=pe[0].lz),It===pe.length-1&&(kt=pe[pe.length-1].lz));const rt=bn.getIntersectionPoint(Re[(It+Re.length-1)%Re.length].leftPoint,Re[(It+Re.length-1)%Re.length].rightPoint,Re[It].leftPoint,Re[It].rightPoint).setZ(ft-ct).sub(ge),at=bn.getIntersectionPoint(Re[It].leftPoint,Re[It].rightPoint,Re[(It+1)%Re.length].leftPoint,Re[(It+1)%Re.length].rightPoint).setZ(kt-ct).sub(ge),Ge=De[It].leftPoint.clone().sub(ge),yt=De[It].rightPoint.clone().sub(ge),Pt=new le(Ft.cx,Ft.cy).sub(ge.clone().setZ(0)).length();Ve.push(rt,at,yt,Ge),Ve.push(rt.clone().add(Ae),at.clone().add(Ae),yt.clone().add(Ae),Ge.clone().add(Ae)),ht.push({points:Ve,angle:-Ft.relativeAngle,length:Pt})}}if(!ye.current){const It=Re.length-1,Ft=bn.getIntersectionPoint(Re[It-1].leftPoint,Re[It-1].rightPoint,Re[It].leftPoint,Re[It].rightPoint).setZ(pe[pe.length-1].lz-ct).sub(ge),Ve=bn.getIntersectionPoint(Re[It].leftPoint,Re[It].rightPoint,Re[0].leftPoint,Re[0].rightPoint).setZ(pe[0].lz-ct).sub(ge),ft=De[It].leftPoint.clone().sub(ge),kt=De[It].rightPoint.clone().sub(ge);let rt=Math.atan2(Ve.y-Ft.y,Ve.x-Ft.x);rt=rt>=0?rt:(sa+rt)%sa;const at=new le().addVectors(Ft,Ve).setZ(0).divideScalar(2).length(),Ge=[];Ge.push(Ft,Ve,kt,ft),Ge.push(Ft.clone().add(Ae),Ve.clone().add(Ae),kt.clone().add(Ae),ft.clone().add(Ae)),ht.push({points:Ge,angle:-rt,length:at})}return ht},[pe,Te,E,u]),he=m.useMemo(()=>{const ht=new kl;if(De.length>0){const ct=De[0].leftPoint.clone().sub(ge);ht.moveTo(ct.x,ct.y);for(const It of De){const Ft=It.rightPoint.clone().sub(ge);ht.lineTo(Ft.x,Ft.y)}ht.closePath()}return ht},[pe,De]),ve=m.useMemo(()=>{const ht=[];if(pe.length===0)return ht;ht.push(new le().fromArray(pe[0].leftPoint));for(const ct of pe)ht.push(new le().fromArray(ct.rightPoint));return ht},[pe]);m.useEffect(()=>{y!==E&&N(y)},[y]),m.useEffect(()=>{if(pe.length>1){if(M.getState().addedRoofIdSet.has(n)){for(let ht=0;ht{for(const It of ct.elements)if(It.id===pe[ht].id&&It.type===z.Wall){const Ft=It;Ft.roofId=n,Ft.leftRoofHeight=void 0,Ft.rightRoofHeight=void 0;break}});M.getState().deleteAddedRoofId(n)}}else b(n,!1,!1,!0)},[pe]),Oye(e,n,ue,ge,Te,u),m.useEffect(()=>{(P!==void 0||v!==void 0)&&x(ht=>{for(const ct of ht.elements)if(ct.type===z.Wall){const It=ct;It.roofId===n&&(It.centerLeftRoofHeight=void 0,It.centerRightRoofHeight=void 0)}else ct.type===z.Roof&&ct.roofType===Go.Mansard&&ct.id===n&&(ct.frontRidge=void 0,ct.backRidge=void 0)})},[]);const we=()=>{const ht=[];for(let It=0;It0&&Ft.rightPoint.length>0&&(Ft.leftPoint[0]!==Ft.rightPoint[0]||Ft.leftPoint[1]!==Ft.rightPoint[1])){let{lh:Ve,rh:ft}=bn.getWallHeight(pe,It);ye.current||(It===0&&(Ve=pe[0].lz),It===pe.length-1&&(ft=pe[pe.length-1].lz));const kt=new le(Ft.leftPoint[0],Ft.leftPoint[1],Ve),rt=new le(Ft.rightPoint[0],Ft.rightPoint[1],ft),at=De[It].leftPoint.clone(),Ge=De[It].rightPoint.clone();ht.push([kt,rt,Ge,at])}}if(!ye.current){const It=pe.length-1,Ft=pe[0],Ve=pe[It],ft=new le(Ve.rightPoint[0],Ve.rightPoint[1],Ve.lz),kt=new le(Ft.leftPoint[0],Ft.leftPoint[1],Ft.lz),rt=De[It].leftPoint.clone(),at=De[It].rightPoint.clone();ht.push([ft,kt,at,rt])}const ct=De.map(It=>It.leftPoint.clone());if(ht.push(ct),se){const It=[];for(const Ft of ht.slice(0,-1))It.push(Ft[0].clone());Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,[It])}else Cn.getState().setRoofSegmentVerticesWithoutOverhang(n,ht)},Pe=fN(n,ge,ue,se,Go.Mansard,De.map(ht=>ht.leftPoint.clone().add(Ae)));hN(we);const Ie=M.getState().world,Me=M(pu),ze=dt(hs),Ne=M(Pf),Je=Cn(c1),[Ue,nt]=m.useState([]),[We,Ee]=m.useState(null),[ke,Oe]=m.useState(!1),st=dt(p3),je=M(e5),xt=M(a3),gt=M(l3),Ye=Cn(yW),it=Cn.getState().hourlyHeatExchangeArrayMap,ut=m.useRef(null),Qe=m.useRef(0),lt=m.useRef(),Ze=m.useRef(),{transparent:Be,opacity:$e}=tM();m.useEffect(()=>{if(ze)if(se){const ht=Je(n);if(ht){const ct=me.fetchHeatmapTexture(ht,Ne??5);if(ct){const It=Pe();if(It&&It.length>0&&e){const Ft=new ln(0,0,e.rotation[2],"ZYX");let Ve=Number.MAX_VALUE,ft=Number.MAX_VALUE,kt=-Number.MAX_VALUE,rt=-Number.MAX_VALUE;for(const bt of It)for(const zt of bt){const Bt=zt.clone().applyEuler(Ft);Bt.x>kt&&(kt=Bt.x),Bt.xrt&&(rt=Bt.y),Bt.y{if(ut.current){const ht=he.extractPoints(1).shape,ct=.01,It=ut.current.geometry,Ft=ht.length-1;if(Ft===4){const Ve=new Float32Array(18);Ve[0]=ht[3].x,Ve[1]=ht[3].y,Ve[2]=ct,Ve[3]=ht[0].x,Ve[4]=ht[0].y,Ve[5]=ct,Ve[6]=ht[2].x,Ve[7]=ht[2].y,Ve[8]=ct,Ve[9]=ht[2].x,Ve[10]=ht[2].y,Ve[11]=ct,Ve[12]=ht[0].x,Ve[13]=ht[0].y,Ve[14]=ct,Ve[15]=ht[1].x,Ve[16]=ht[1].y,Ve[17]=ct,It.setAttribute("position",new gr(Ve,3)),It.computeVertexNormals();const ft=ze?1:6,kt=[];kt.push(0,0),kt.push(ft,0),kt.push(0,ft),kt.push(0,ft),kt.push(ft,0),kt.push(ft,ft),It.setAttribute("uv",new gr(kt,2))}else{const Ve=ut.current.geometry,ft=new Float32Array(Ft*9),kt=ze?1:6,rt=[];let at=Number.MAX_VALUE,Ge=Number.MAX_VALUE,yt=-Number.MAX_VALUE,Pt=-Number.MAX_VALUE;for(const zt of ht)zt.x>yt?yt=zt.x:zt.xPt?Pt=zt.y:zt.y{if(!st||e&&e.notBuilding)return;const ht=it.get(n+"-"+ue.length);if(!ht)return;const ct=ht.reduce((wo,Io)=>wo+Io,0),It=Ye(n);if(!It||!It[ue.length])return;const Ft=It[ue.length].map(wo=>wo.clone().sub(ge).add(new le(0,0,ge.z+u)));if(!Ft)return;const Ve=i3*(Ie.solarRadiationHeatmapGridCellSize??.5),ft=Ft[0].clone(),kt=Ft[1].clone(),rt=Ft[2].clone(),at=new le().subVectors(kt,ft),Ge=new le().subVectors(rt,ft),yt=new le().subVectors(rt,kt),Pt=at.length(),ot=new le().crossVectors(Ge,yt).length()/Pt,bt=Math.max(2,Math.floor(Pt/Ve)),zt=Math.max(2,Math.floor(ot/Ve));at.normalize(),Ge.normalize(),yt.normalize();const Bt=new le().crossVectors(Ge,yt).normalize(),tt=at.multiplyScalar(.5*Pt/bt),Ht=new le().crossVectors(Bt,at).normalize().multiplyScalar(.5*ot/zt),_t=ft.clone().add(tt).add(Ht).add(new le(0,0,u));tt.multiplyScalar(2),Ht.multiplyScalar(2),lt.current=Bt.clone().multiplyScalar(.1);const qt=[],un=new le,Rn=new Array;for(const wo of Ft)Rn.push({x:wo.x,y:wo.y});const yo=me.getPolygonArea(Rn);if(yo===0)return;const Ao=ct/yo*(je??Qm);Qe.current=Ao<0?1:0,Ze.current=new ln(-Math.sign(Ao)*Qt,0,0);for(let wo=0;woht.elements.filter(ct=>ct.parentId===n&&ct.type===z.Window),cy),At=m.useMemo(()=>Gt.map(ht=>{const ct=new le(ht.lx,ht.lz,ht.ly*2),It=new le(ht.cx,ht.cy,ht.cz).sub(ge),Ft=new ln().fromArray([ht.rotation[0],ht.rotation[1],ht.rotation[2],"ZXY"]),Ve=new ls(new n3(ct.x,ct.y,ct.z));return Ve.position.copy(It),Ve.rotation.copy(Ft),Ve.updateMatrix(),Ve}),[Gt,ge]),pt=l===Ur.NoTexture&&s&&s===c,Wt=R&&!Be;return h.jsxs("group",{name:`Mansard Roof Group ${n}`,children:[h.jsx("group",{name:`Mansard Roof Segments Group ${n}`,position:[ge.x,ge.y,ge.z],userData:vt,onPointerDown:ht=>{cN(ht,e.id,n,ue,ge)},onPointerMove:ht=>{dN(ht,n)},onPointerUp:ht=>{uN(ht,t)},onContextMenu:ht=>{CR(ht,n)},children:se?h.jsx(FQ,{id:n,foundationModel:e,roofType:g,roofSegments:ue,center:new le(ge.x,ge.y,Te),thickness:u,lineWidth:p,lineColor:f,sideColor:c,color:Rt,textureType:l,heatmap:We}):h.jsxs(h.Fragment,{children:[ue.map((ht,ct,It)=>h.jsx(u$,{id:n,index:ct,foundationModel:e,roofType:g,segment:ht,centroid:ge,thickness:u,color:Rt,sideColor:c,texture:T,heatmap:Ue&&ct0&&h.jsx(mbt,{roofSegments:ue,thickness:u,lineColor:f,lineWidth:p})]})}),C&&S>0&&h.jsx(zW,{points:ve,cz:pe[0].lz}),w&&!d&&h.jsxs("group",{position:[ge.x,ge.y,ge.z+u],children:[h.jsx(nh,{position:[0,0,.3],onPointerDown:ht=>{if(Me(t.id,ht,Xo.Select),$.current=!0,G.current=S,D(!0),Ere.set(ge.x,ge.y,Te),e){const ct=-Math.atan2(Q.position.x-r,Q.position.y-i)-e.rotation[2];Fre.set(-Qt,0,ct,"ZXY")}j(Lr.Top),kn.getState().setEnableOrbitController(!1),x(ct=>{ct.resizeHandleType=Mt.Top,ct.selectedElementHeight=Te+t.thickness})},onPointerOver:()=>{x(ht=>{ht.hoveredHandle=Lr.Top,ht.selectedElementHeight=Te+t.thickness,ht.selectedElementX=ge.x,ht.selectedElementY=ge.y})}}),De.map((ht,ct)=>{const It=ht.leftPoint.clone().sub(ge);return h.jsx(nh,{position:[It.x,It.y,0],onPointerDown:()=>{$.current=!0,D(!0),Ere.set(It.x,It.y,Te+.15),Fre.set(0,0,0),j(Lr.Ridge),O(ct),W(pe.reduce((Ft,Ve)=>Math.min(Ft,new le(Ve.leftPoint[0],Ve.leftPoint[1],Te).distanceTo(ge)-1),1/0)),kn.getState().setEnableOrbitController(!1),V.current=E}},ct)})]}),k&&h.jsx(ta,{name:"Roof Intersection Plane",ref:q,args:[1e3,100],visible:!1,position:Ere,rotation:Fre,onPointerMove:ht=>{if(q.current&&$.current){te(ht);const ct=H.intersectObjects([q.current]);if(ct[0]&&e){const It=ct[0].point;if(It.z<.001)return;switch(L){case Lr.Top:{const Ft=Math.max(0,It.z-e.lz-.6-ae);M.getState().updateRoofRiseById(n,Ft,Te+t.thickness);break}case Lr.Ridge:{if(e&&B!==null){const Ft=It.clone().applyEuler(new ln(0,0,e.rotation[2])).sub(new le(e.cx,e.cy)).setZ(0),Ve=Z(B),ft=Ft.distanceTo(Ve),kt=new le().subVectors(ge.clone().setZ(0),Ve);Ft.clone().sub(Ve).angleTo(kt){switch(L){case Lr.Top:{sN(n,G.current,S);break}case Lr.Ridge:{fe(n,L,V.current,E);break}}x(ht=>{for(const ct of ht.elements)if(ct.id===n&&ct.type===z.Roof&&ct.roofType===Go.Mansard){ct.ridgeWidth=E;break}}),$.current=!1,D(!1),j(Lr.Null),O(null),kn.getState().setEnableOrbitController(!0)},children:h.jsx("meshBasicMaterial",{side:ti,transparent:!0,opacity:.5})}),wt&&wt.map((ht,ct)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:ht,name:"Heat Flux "+ct,lineWidth:gt??Zm,color:xt??p0}),";",h.jsx(xf,{userData:{unintersectable:!0},position:lt.current?ht[Qe.current].clone().add(lt.current):ht[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:Ze.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:xt??p0})})]},ct))]})},Abt=be.memo(ybt,ZH);var IOe={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames @@ -4376,7 +4376,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o=[],r=0;r1&&arguments[1]!==void 0?arguments[1]:1;m7e+=1;var o=m7e;function r(i){if(i===0)r_e(o),e();else{var a=n_e(function(){r(i-1)});Sme.set(o,a)}}return r(n),o};Ea.cancel=function(t){var e=Sme.get(t);return r_e(t),o_e(e)};const qPt=function(){var t=m.useRef(null);function e(){Ea.cancel(t.current)}function n(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Ea(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return m.useEffect(function(){return function(){e()}},[]),[n,e]};var $Pt=[u2,tC,nC,bme],QPt=[u2,KVe],i_e=!1,ZPt=!0;function a_e(t){return t===nC||t===bme}const eCt=function(t,e,n){var o=MC(d7e),r=sn(o,2),i=r[0],a=r[1],l=qPt(),s=sn(l,2),c=s[0],u=s[1];function d(){a(u2,!0)}var f=e?QPt:$Pt;return t_e(function(){if(i!==d7e&&i!==bme){var p=f.indexOf(i),g=f[p+1],A=n(i);A===i_e?a(g,!0):g&&c(function(y){function S(){y.isCanceled()||a(g,!0)}A===!0?S():Promise.resolve(A).then(S)})}},[t,i]),m.useEffect(function(){return function(){u()}},[]),[d,i]};function tCt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,g=o.onLeavePrepare,A=o.onAppearStart,y=o.onEnterStart,S=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,v=o.onLeaveActive,T=o.onAppearEnd,w=o.onEnterEnd,x=o.onLeaveEnd,b=o.onVisibleChanged,R=MC(),H=sn(R,2),F=H[0],E=H[1],N=MC(pv),U=sn(N,2),W=U[0],k=U[1],D=MC(null),L=sn(D,2),j=L[0],B=L[1],O=m.useRef(!1),V=m.useRef(null);function G(){return n()}var q=m.useRef(!1);function $(){k(pv,!0),B(null,!0)}function ie(ge){var Se=G();if(!(ge&&!ge.deadline&&ge.target!==Se)){var Re=q.current,De;W===PY&&Re?De=T==null?void 0:T(Se,ge):W===CY&&Re?De=w==null?void 0:w(Se,ge):W===RY&&Re&&(De=x==null?void 0:x(Se,ge)),W!==pv&&Re&&De!==!1&&$()}}var Q=KPt(ie),se=sn(Q,1),Z=se[0],ee=function(Se){var Re,De,Ae;switch(Se){case PY:return Re={},Jt(Re,u2,f),Jt(Re,tC,A),Jt(Re,nC,C),Re;case CY:return De={},Jt(De,u2,p),Jt(De,tC,y),Jt(De,nC,P),De;case RY:return Ae={},Jt(Ae,u2,g),Jt(Ae,tC,S),Jt(Ae,nC,v),Ae;default:return{}}},te=m.useMemo(function(){return ee(W)},[W]),oe=eCt(W,!t,function(ge){if(ge===u2){var Se=te[u2];return Se?Se(G()):i_e}if(pe in te){var Re;B(((Re=te[pe])===null||Re===void 0?void 0:Re.call(te,G(),null))||null)}return pe===nC&&(Z(G()),u>0&&(clearTimeout(V.current),V.current=setTimeout(function(){ie({deadline:!0})},u))),pe===KVe&&$(),ZPt}),de=sn(oe,2),he=de[0],pe=de[1],me=a_e(pe);q.current=me,t_e(function(){E(e);var ge=O.current;O.current=!0;var Se;!ge&&e&&l&&(Se=PY),ge&&e&&i&&(Se=CY),(ge&&!e&&c||!ge&&d&&!e&&c)&&(Se=RY);var Re=ee(Se);Se&&(t||Re[u2])?(k(Se),he()):k(pv)},[e]),m.useEffect(function(){(W===PY&&!l||W===CY&&!i||W===RY&&!c)&&k(pv)},[l,i,c]),m.useEffect(function(){return function(){O.current=!1,clearTimeout(V.current)}},[]);var le=m.useRef(!1);m.useEffect(function(){F&&(le.current=!0),F!==void 0&&W===pv&&((le.current||F)&&(b==null||b(F)),le.current=!0)},[F,W]);var Te=j;return te[u2]&&pe===tC&&(Te=en({transition:"none"},Te)),[W,pe,Te,F??e]}function nCt(t){var e=t;hi(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=m.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,g=r.eventProps,A=m.useContext(JVe),y=A.motion,S=n(r,y),C=m.useRef(),P=m.useRef();function v(){try{return C.current instanceof HTMLElement?C.current:bE(P.current)}catch{return null}}var T=tCt(S,l,v,r),w=sn(T,4),x=w[0],b=w[1],R=w[2],H=w[3],F=m.useRef(H);H&&(F.current=!0);var E=m.useCallback(function(B){C.current=B,ZF(i,B)},[i]),N,U=en(en({},g),{},{visible:l});if(!d)N=null;else if(x===pv)H?N=d(en({},U),E):!c&&F.current&&p?N=d(en(en({},U),{},{className:p}),E):u||!c&&!p?N=d(en(en({},U),{},{style:{display:"none"}}),E):N=null;else{var W,k;b===u2?k="prepare":a_e(b)?k="active":b===tC&&(k="start");var D=g7e(f,"".concat(x,"-").concat(k));N=d(en(en({},U),{},{className:Xn(g7e(f,x),(W={},Jt(W,D,D&&k),Jt(W,f,typeof f=="string"),W)),style:R}),E)}if(m.isValidElement(N)&&sw(N)){var L=N,j=L.ref;j||(N=m.cloneElement(N,{ref:E}))}return m.createElement(_Pt,{ref:P},N)});return o.displayName="CSSMotion",o}const o1=nCt(e_e);var P0e="add",C0e="keep",R0e="remove",Xre="removed";function oCt(t){var e;return t&&hi(t)==="object"&&"key"in t?e=t:e={key:t},en(en({},e),{},{key:String(e.key)})}function H0e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(oCt)}function rCt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=H0e(t),a=H0e(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==R0e}),n.forEach(function(u){u.key===c&&(u.status=C0e)})}),n}var iCt=["component","children","onVisibleChanged","onAllRemoved"],aCt=["status"],lCt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function sCt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o1,n=function(o){EW(i,o);var r=FW(i);function i(){var a;wp(this,i);for(var l=arguments.length,s=new Array(l),c=0;cnull;var fCt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re.endsWith("Color"))}const yCt=t=>{const{prefixCls:e,iconPrefixCls:n,theme:o,holderRender:r}=t;e!==void 0&&(FG=e),n!==void 0&&(l_e=n),"holderRender"in t&&(c_e=r),o&&(mCt(o)?uPt(JV(),o):s_e=o)},u_e=()=>({getPrefixCls:(t,e)=>e||(t?`${JV()}-${t}`:JV()),getIconPrefixCls:gCt,getRootPrefixCls:()=>FG||JV(),getTheme:()=>s_e,holderRender:c_e}),ACt=t=>{const{children:e,csp:n,autoInsertSpaceInButton:o,alert:r,anchor:i,form:a,locale:l,componentSize:s,direction:c,space:u,virtual:d,dropdownMatchSelectWidth:f,popupMatchSelectWidth:p,popupOverflow:g,legacyLocale:A,parentContext:y,iconPrefixCls:S,theme:C,componentDisabled:P,segmented:v,statistic:T,spin:w,calendar:x,carousel:b,cascader:R,collapse:H,typography:F,checkbox:E,descriptions:N,divider:U,drawer:W,skeleton:k,steps:D,image:L,layout:j,list:B,mentions:O,modal:V,progress:G,result:q,slider:$,breadcrumb:ie,menu:Q,pagination:se,input:Z,textArea:ee,empty:te,badge:oe,radio:de,rate:he,switch:pe,transfer:me,avatar:le,message:Te,tag:ge,table:Se,card:Re,tabs:De,timeline:Ae,timePicker:ue,upload:fe,notification:ve,tree:we,colorPicker:Pe,datePicker:Ie,rangePicker:Me,flex:ze,wave:Ne,dropdown:Je,warning:Ue,tour:nt,floatButtonGroup:We}=t,Ee=m.useCallback((lt,Ze)=>{const{prefixCls:Be}=t;if(Ze)return Ze;const $e=Be||y.getPrefixCls("");return lt?`${$e}-${lt}`:$e},[y.getPrefixCls,t.prefixCls]),ke=S||y.iconPrefixCls||hme,Oe=n||y.csp;VVe(ke,Oe);const st=BPt(C,y.theme,{prefixCls:Ee("")}),je={csp:Oe,autoInsertSpaceInButton:o,alert:r,anchor:i,locale:l||A,direction:c,space:u,virtual:d,popupMatchSelectWidth:p??f,popupOverflow:g,getPrefixCls:Ee,iconPrefixCls:ke,theme:st,segmented:v,statistic:T,spin:w,calendar:x,carousel:b,cascader:R,collapse:H,typography:F,checkbox:E,descriptions:N,divider:U,drawer:W,skeleton:k,steps:D,image:L,input:Z,textArea:ee,layout:j,list:B,mentions:O,modal:V,progress:G,result:q,slider:$,breadcrumb:ie,menu:Q,pagination:se,empty:te,badge:oe,radio:de,rate:he,switch:pe,transfer:me,avatar:le,message:Te,tag:ge,table:Se,card:Re,tabs:De,timeline:Ae,timePicker:ue,upload:fe,notification:ve,tree:we,colorPicker:Pe,datePicker:Ie,rangePicker:Me,flex:ze,wave:Ne,dropdown:Je,warning:Ue,tour:nt,floatButtonGroup:We},xt=Object.assign({},y);Object.keys(je).forEach(lt=>{je[lt]!==void 0&&(xt[lt]=je[lt])}),hCt.forEach(lt=>{const Ze=t[lt];Ze&&(xt[lt]=Ze)}),typeof o<"u"&&(xt.button=Object.assign({autoInsertSpace:o},xt.button));const gt=ume(()=>xt,xt,(lt,Ze)=>{const Be=Object.keys(lt),$e=Object.keys(Ze);return Be.length!==$e.length||Be.some(wt=>lt[wt]!==Ze[wt])}),Ye=m.useMemo(()=>({prefixCls:ke,csp:Oe}),[ke,Oe]);let it=m.createElement(m.Fragment,null,m.createElement(dCt,{dropdownMatchSelectWidth:f}),e);const ut=m.useMemo(()=>{var lt,Ze,Be,$e;return vTt(((lt=uw.Form)===null||lt===void 0?void 0:lt.defaultValidateMessages)||{},((Be=(Ze=gt.locale)===null||Ze===void 0?void 0:Ze.Form)===null||Be===void 0?void 0:Be.defaultValidateMessages)||{},(($e=gt.form)===null||$e===void 0?void 0:$e.validateMessages)||{},(a==null?void 0:a.validateMessages)||{})},[gt,a==null?void 0:a.validateMessages]);Object.keys(ut).length>0&&(it=m.createElement(STt.Provider,{value:ut},it)),l&&(it=m.createElement(RTt,{locale:l,_ANT_MARK__:CTt},it)),(ke||Oe)&&(it=m.createElement(cme.Provider,{value:Ye},it)),s&&(it=m.createElement(dPt,{size:s},it)),it=m.createElement(uCt,null,it);const Qe=m.useMemo(()=>{const lt=st||{},{algorithm:Ze,token:Be,components:$e,cssVar:wt}=lt,vt=fCt(lt,["algorithm","token","components","cssVar"]),Rt=Ze&&(!Array.isArray(Ze)||Ze.length>0)?c0e(Ze):CVe,Gt={};Object.entries($e||{}).forEach(pt=>{let[Wt,ht]=pt;const ct=Object.assign({},ht);"algorithm"in ct&&(ct.algorithm===!0?ct.theme=Rt:(Array.isArray(ct.algorithm)||typeof ct.algorithm=="function")&&(ct.theme=c0e(ct.algorithm)),delete ct.algorithm),Gt[Wt]=ct});const At=Object.assign(Object.assign({},ok),Be);return Object.assign(Object.assign({},vt),{theme:Rt,token:At,components:Gt,override:Object.assign({override:At},Gt),cssVar:wt})},[st]);return C&&(it=m.createElement(RVe.Provider,{value:Qe},it)),gt.warning&&(it=m.createElement(bTt.Provider,{value:gt.warning},it)),P!==void 0&&(it=m.createElement(IVe,{disabled:P},it)),m.createElement(Cr.Provider,{value:gt},it)},fy=t=>{const e=m.useContext(Cr),n=m.useContext(fme);return m.createElement(ACt,Object.assign({parentContext:e,legacyLocale:n},t))};fy.ConfigContext=Cr;fy.SizeContext=mR;fy.config=yCt;fy.useConfig=fPt;Object.defineProperty(fy,"SizeContext",{get:()=>mR});function Ir(){return Ir=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:1;m7e+=1;var o=m7e;function r(i){if(i===0)r_e(o),e();else{var a=n_e(function(){r(i-1)});Sme.set(o,a)}}return r(n),o};Ea.cancel=function(t){var e=Sme.get(t);return r_e(t),o_e(e)};const qPt=function(){var t=m.useRef(null);function e(){Ea.cancel(t.current)}function n(o){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;e();var i=Ea(function(){r<=1?o({isCanceled:function(){return i!==t.current}}):n(o,r-1)});t.current=i}return m.useEffect(function(){return function(){e()}},[]),[n,e]};var $Pt=[u2,tC,nC,bme],QPt=[u2,KVe],i_e=!1,ZPt=!0;function a_e(t){return t===nC||t===bme}const eCt=function(t,e,n){var o=MC(d7e),r=sn(o,2),i=r[0],a=r[1],l=qPt(),s=sn(l,2),c=s[0],u=s[1];function d(){a(u2,!0)}var f=e?QPt:$Pt;return t_e(function(){if(i!==d7e&&i!==bme){var p=f.indexOf(i),g=f[p+1],A=n(i);A===i_e?a(g,!0):g&&c(function(y){function S(){y.isCanceled()||a(g,!0)}A===!0?S():Promise.resolve(A).then(S)})}},[t,i]),m.useEffect(function(){return function(){u()}},[]),[d,i]};function tCt(t,e,n,o){var r=o.motionEnter,i=r===void 0?!0:r,a=o.motionAppear,l=a===void 0?!0:a,s=o.motionLeave,c=s===void 0?!0:s,u=o.motionDeadline,d=o.motionLeaveImmediately,f=o.onAppearPrepare,p=o.onEnterPrepare,g=o.onLeavePrepare,A=o.onAppearStart,y=o.onEnterStart,S=o.onLeaveStart,C=o.onAppearActive,P=o.onEnterActive,v=o.onLeaveActive,T=o.onAppearEnd,w=o.onEnterEnd,x=o.onLeaveEnd,b=o.onVisibleChanged,R=MC(),H=sn(R,2),F=H[0],E=H[1],N=MC(pv),U=sn(N,2),W=U[0],k=U[1],D=MC(null),L=sn(D,2),j=L[0],B=L[1],O=m.useRef(!1),V=m.useRef(null);function G(){return n()}var q=m.useRef(!1);function $(){k(pv,!0),B(null,!0)}function ie(ge){var Se=G();if(!(ge&&!ge.deadline&&ge.target!==Se)){var Re=q.current,De;W===PY&&Re?De=T==null?void 0:T(Se,ge):W===CY&&Re?De=w==null?void 0:w(Se,ge):W===RY&&Re&&(De=x==null?void 0:x(Se,ge)),W!==pv&&Re&&De!==!1&&$()}}var Q=KPt(ie),se=sn(Q,1),oe=se[0],Z=function(Se){var Re,De,Ae;switch(Se){case PY:return Re={},Jt(Re,u2,f),Jt(Re,tC,A),Jt(Re,nC,C),Re;case CY:return De={},Jt(De,u2,p),Jt(De,tC,y),Jt(De,nC,P),De;case RY:return Ae={},Jt(Ae,u2,g),Jt(Ae,tC,S),Jt(Ae,nC,v),Ae;default:return{}}},te=m.useMemo(function(){return Z(W)},[W]),ee=eCt(W,!t,function(ge){if(ge===u2){var Se=te[u2];return Se?Se(G()):i_e}if(pe in te){var Re;B(((Re=te[pe])===null||Re===void 0?void 0:Re.call(te,G(),null))||null)}return pe===nC&&(oe(G()),u>0&&(clearTimeout(V.current),V.current=setTimeout(function(){ie({deadline:!0})},u))),pe===KVe&&$(),ZPt}),de=sn(ee,2),fe=de[0],pe=de[1],ye=a_e(pe);q.current=ye,t_e(function(){E(e);var ge=O.current;O.current=!0;var Se;!ge&&e&&l&&(Se=PY),ge&&e&&i&&(Se=CY),(ge&&!e&&c||!ge&&d&&!e&&c)&&(Se=RY);var Re=Z(Se);Se&&(t||Re[u2])?(k(Se),fe()):k(pv)},[e]),m.useEffect(function(){(W===PY&&!l||W===CY&&!i||W===RY&&!c)&&k(pv)},[l,i,c]),m.useEffect(function(){return function(){O.current=!1,clearTimeout(V.current)}},[]);var ae=m.useRef(!1);m.useEffect(function(){F&&(ae.current=!0),F!==void 0&&W===pv&&((ae.current||F)&&(b==null||b(F)),ae.current=!0)},[F,W]);var Te=j;return te[u2]&&pe===tC&&(Te=en({transition:"none"},Te)),[W,pe,Te,F??e]}function nCt(t){var e=t;hi(t)==="object"&&(e=t.transitionSupport);function n(r,i){return!!(r.motionName&&e&&i!==!1)}var o=m.forwardRef(function(r,i){var a=r.visible,l=a===void 0?!0:a,s=r.removeOnLeave,c=s===void 0?!0:s,u=r.forceRender,d=r.children,f=r.motionName,p=r.leavedClassName,g=r.eventProps,A=m.useContext(JVe),y=A.motion,S=n(r,y),C=m.useRef(),P=m.useRef();function v(){try{return C.current instanceof HTMLElement?C.current:bE(P.current)}catch{return null}}var T=tCt(S,l,v,r),w=sn(T,4),x=w[0],b=w[1],R=w[2],H=w[3],F=m.useRef(H);H&&(F.current=!0);var E=m.useCallback(function(B){C.current=B,ZF(i,B)},[i]),N,U=en(en({},g),{},{visible:l});if(!d)N=null;else if(x===pv)H?N=d(en({},U),E):!c&&F.current&&p?N=d(en(en({},U),{},{className:p}),E):u||!c&&!p?N=d(en(en({},U),{},{style:{display:"none"}}),E):N=null;else{var W,k;b===u2?k="prepare":a_e(b)?k="active":b===tC&&(k="start");var D=g7e(f,"".concat(x,"-").concat(k));N=d(en(en({},U),{},{className:Xn(g7e(f,x),(W={},Jt(W,D,D&&k),Jt(W,f,typeof f=="string"),W)),style:R}),E)}if(m.isValidElement(N)&&sw(N)){var L=N,j=L.ref;j||(N=m.cloneElement(N,{ref:E}))}return m.createElement(_Pt,{ref:P},N)});return o.displayName="CSSMotion",o}const o1=nCt(e_e);var P0e="add",C0e="keep",R0e="remove",Xre="removed";function oCt(t){var e;return t&&hi(t)==="object"&&"key"in t?e=t:e={key:t},en(en({},e),{},{key:String(e.key)})}function H0e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return t.map(oCt)}function rCt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],o=0,r=e.length,i=H0e(t),a=H0e(e);i.forEach(function(c){for(var u=!1,d=o;d1});return s.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==R0e}),n.forEach(function(u){u.key===c&&(u.status=C0e)})}),n}var iCt=["component","children","onVisibleChanged","onAllRemoved"],aCt=["status"],lCt=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function sCt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o1,n=function(o){EW(i,o);var r=FW(i);function i(){var a;wp(this,i);for(var l=arguments.length,s=new Array(l),c=0;cnull;var fCt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re.endsWith("Color"))}const yCt=t=>{const{prefixCls:e,iconPrefixCls:n,theme:o,holderRender:r}=t;e!==void 0&&(FG=e),n!==void 0&&(l_e=n),"holderRender"in t&&(c_e=r),o&&(mCt(o)?uPt(JV(),o):s_e=o)},u_e=()=>({getPrefixCls:(t,e)=>e||(t?`${JV()}-${t}`:JV()),getIconPrefixCls:gCt,getRootPrefixCls:()=>FG||JV(),getTheme:()=>s_e,holderRender:c_e}),ACt=t=>{const{children:e,csp:n,autoInsertSpaceInButton:o,alert:r,anchor:i,form:a,locale:l,componentSize:s,direction:c,space:u,virtual:d,dropdownMatchSelectWidth:f,popupMatchSelectWidth:p,popupOverflow:g,legacyLocale:A,parentContext:y,iconPrefixCls:S,theme:C,componentDisabled:P,segmented:v,statistic:T,spin:w,calendar:x,carousel:b,cascader:R,collapse:H,typography:F,checkbox:E,descriptions:N,divider:U,drawer:W,skeleton:k,steps:D,image:L,layout:j,list:B,mentions:O,modal:V,progress:G,result:q,slider:$,breadcrumb:ie,menu:Q,pagination:se,input:oe,textArea:Z,empty:te,badge:ee,radio:de,rate:fe,switch:pe,transfer:ye,avatar:ae,message:Te,tag:ge,table:Se,card:Re,tabs:De,timeline:Ae,timePicker:ue,upload:he,notification:ve,tree:we,colorPicker:Pe,datePicker:Ie,rangePicker:Me,flex:ze,wave:Ne,dropdown:Je,warning:Ue,tour:nt,floatButtonGroup:We}=t,Ee=m.useCallback((lt,Ze)=>{const{prefixCls:Be}=t;if(Ze)return Ze;const $e=Be||y.getPrefixCls("");return lt?`${$e}-${lt}`:$e},[y.getPrefixCls,t.prefixCls]),ke=S||y.iconPrefixCls||hme,Oe=n||y.csp;VVe(ke,Oe);const st=BPt(C,y.theme,{prefixCls:Ee("")}),je={csp:Oe,autoInsertSpaceInButton:o,alert:r,anchor:i,locale:l||A,direction:c,space:u,virtual:d,popupMatchSelectWidth:p??f,popupOverflow:g,getPrefixCls:Ee,iconPrefixCls:ke,theme:st,segmented:v,statistic:T,spin:w,calendar:x,carousel:b,cascader:R,collapse:H,typography:F,checkbox:E,descriptions:N,divider:U,drawer:W,skeleton:k,steps:D,image:L,input:oe,textArea:Z,layout:j,list:B,mentions:O,modal:V,progress:G,result:q,slider:$,breadcrumb:ie,menu:Q,pagination:se,empty:te,badge:ee,radio:de,rate:fe,switch:pe,transfer:ye,avatar:ae,message:Te,tag:ge,table:Se,card:Re,tabs:De,timeline:Ae,timePicker:ue,upload:he,notification:ve,tree:we,colorPicker:Pe,datePicker:Ie,rangePicker:Me,flex:ze,wave:Ne,dropdown:Je,warning:Ue,tour:nt,floatButtonGroup:We},xt=Object.assign({},y);Object.keys(je).forEach(lt=>{je[lt]!==void 0&&(xt[lt]=je[lt])}),hCt.forEach(lt=>{const Ze=t[lt];Ze&&(xt[lt]=Ze)}),typeof o<"u"&&(xt.button=Object.assign({autoInsertSpace:o},xt.button));const gt=ume(()=>xt,xt,(lt,Ze)=>{const Be=Object.keys(lt),$e=Object.keys(Ze);return Be.length!==$e.length||Be.some(wt=>lt[wt]!==Ze[wt])}),Ye=m.useMemo(()=>({prefixCls:ke,csp:Oe}),[ke,Oe]);let it=m.createElement(m.Fragment,null,m.createElement(dCt,{dropdownMatchSelectWidth:f}),e);const ut=m.useMemo(()=>{var lt,Ze,Be,$e;return vTt(((lt=uw.Form)===null||lt===void 0?void 0:lt.defaultValidateMessages)||{},((Be=(Ze=gt.locale)===null||Ze===void 0?void 0:Ze.Form)===null||Be===void 0?void 0:Be.defaultValidateMessages)||{},(($e=gt.form)===null||$e===void 0?void 0:$e.validateMessages)||{},(a==null?void 0:a.validateMessages)||{})},[gt,a==null?void 0:a.validateMessages]);Object.keys(ut).length>0&&(it=m.createElement(STt.Provider,{value:ut},it)),l&&(it=m.createElement(RTt,{locale:l,_ANT_MARK__:CTt},it)),(ke||Oe)&&(it=m.createElement(cme.Provider,{value:Ye},it)),s&&(it=m.createElement(dPt,{size:s},it)),it=m.createElement(uCt,null,it);const Qe=m.useMemo(()=>{const lt=st||{},{algorithm:Ze,token:Be,components:$e,cssVar:wt}=lt,vt=fCt(lt,["algorithm","token","components","cssVar"]),Rt=Ze&&(!Array.isArray(Ze)||Ze.length>0)?c0e(Ze):CVe,Gt={};Object.entries($e||{}).forEach(pt=>{let[Wt,ht]=pt;const ct=Object.assign({},ht);"algorithm"in ct&&(ct.algorithm===!0?ct.theme=Rt:(Array.isArray(ct.algorithm)||typeof ct.algorithm=="function")&&(ct.theme=c0e(ct.algorithm)),delete ct.algorithm),Gt[Wt]=ct});const At=Object.assign(Object.assign({},ok),Be);return Object.assign(Object.assign({},vt),{theme:Rt,token:At,components:Gt,override:Object.assign({override:At},Gt),cssVar:wt})},[st]);return C&&(it=m.createElement(RVe.Provider,{value:Qe},it)),gt.warning&&(it=m.createElement(bTt.Provider,{value:gt.warning},it)),P!==void 0&&(it=m.createElement(IVe,{disabled:P},it)),m.createElement(Cr.Provider,{value:gt},it)},fy=t=>{const e=m.useContext(Cr),n=m.useContext(fme);return m.createElement(ACt,Object.assign({parentContext:e,legacyLocale:n},t))};fy.ConfigContext=Cr;fy.SizeContext=mR;fy.config=yCt;fy.useConfig=fPt;Object.defineProperty(fy,"SizeContext",{get:()=>mR});function Ir(){return Ir=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function f_e(t,e){if(t==null)return{};var n=CCt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var MY=2,A7e=.16,RCt=.05,HCt=.05,MCt=.15,h_e=5,p_e=4,ICt=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function w7e(t){var e=t.r,n=t.g,o=t.b,r=zG(e,n,o);return{h:r.h*360,s:r.s,v:r.v}}function IY(t){var e=t.r,n=t.g,o=t.b;return"#".concat(DG(e,n,o,!1))}function zCt(t,e,n){var o=n/100,r={r:(e.r-t.r)*o+t.r,g:(e.g-t.g)*o+t.g,b:(e.b-t.b)*o+t.b};return r}function v7e(t,e,n){var o;return Math.round(t.h)>=60&&Math.round(t.h)<=240?o=n?Math.round(t.h)-MY*e:Math.round(t.h)+MY*e:o=n?Math.round(t.h)+MY*e:Math.round(t.h)-MY*e,o<0?o+=360:o>=360&&(o-=360),o}function x7e(t,e,n){if(t.h===0&&t.s===0)return t.s;var o;return n?o=t.s-A7e*e:e===p_e?o=t.s+A7e:o=t.s+RCt*e,o>1&&(o=1),n&&e===h_e&&o>.1&&(o=.1),o<.06&&(o=.06),Number(o.toFixed(2))}function b7e(t,e,n){var o;return n?o=t.v+HCt*e:o=t.v-MCt*e,o>1&&(o=1),Number(o.toFixed(2))}function I0e(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],o=A2(t),r=h_e;r>0;r-=1){var i=w7e(o),a=IY(A2({h:v7e(i,r,!0),s:x7e(i,r,!0),v:b7e(i,r,!0)}));n.push(a)}n.push(IY(o));for(var l=1;l<=p_e;l+=1){var s=w7e(o),c=IY(A2({h:v7e(s,l),s:x7e(s,l),v:b7e(s,l)}));n.push(c)}return e.theme==="dark"?ICt.map(function(u){var d=u.index,f=u.opacity,p=IY(zCt(A2(e.backgroundColor||"#141414"),A2(n[d]),f*100));return p}):n}var Jre={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},KV={},Kre={};Object.keys(Jre).forEach(function(t){KV[t]=I0e(Jre[t]),KV[t].primary=KV[t][5],Kre[t]=I0e(Jre[t],{theme:"dark",backgroundColor:"#141414"}),Kre[t].primary=Kre[t][5]});var DCt=KV.blue;function S7e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function b8(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(e,n){var o=t[n];switch(n){case"class":e.className=o,delete e.class;break;default:delete e[n],e[FCt(n)]=o}return e},{})}function z0e(t,e,n){return n?be.createElement(t.tag,b8(b8({key:e},P7e(t.attrs)),n),(t.children||[]).map(function(o,r){return z0e(o,"".concat(e,"-").concat(t.tag,"-").concat(r))})):be.createElement(t.tag,b8({key:e},P7e(t.attrs)),(t.children||[]).map(function(o,r){return z0e(o,"".concat(e,"-").concat(t.tag,"-").concat(r))}))}function m_e(t){return I0e(t)[0]}function y_e(t){return t?Array.isArray(t)?t:[t]:[]}var LCt=` .anticon { display: inline-flex; @@ -4466,18 +4466,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata - onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,sRt="".concat(aRt," ").concat(lRt).split(/[\s\n]+/),cRt="aria-",uRt="data-";function R7e(t,e){return t.indexOf(e)===0}function bf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=en({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||R7e(r,cRt))||n.data&&R7e(r,uRt)||n.attr&&sRt.includes(r))&&(o[r]=t[r])}),o}var S_e=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.className,i=t.duration,a=i===void 0?4.5:i,l=t.eventKey,s=t.content,c=t.closable,u=t.closeIcon,d=u===void 0?"x":u,f=t.props,p=t.onClick,g=t.onNoticeClose,A=t.times,y=t.hovering,S=m.useState(!1),C=sn(S,2),P=C[0],v=C[1],T=y||P,w=function(){g(l)},x=function(E){(E.key==="Enter"||E.code==="Enter"||E.keyCode===jn.ENTER)&&w()};m.useEffect(function(){if(!T&&a>0){var F=setTimeout(function(){w()},a*1e3);return function(){clearTimeout(F)}}},[a,T,A]);var b=m.useMemo(function(){return hi(c)==="object"&&c!==null?c:c?{closeIcon:d}:{}},[c,d]),R=bf(b,!0),H="".concat(n,"-notice");return m.createElement("div",go({},f,{ref:e,className:Xn(H,r,Jt({},"".concat(H,"-closable"),c)),style:o,onMouseEnter:function(E){var N;v(!0),f==null||(N=f.onMouseEnter)===null||N===void 0||N.call(f,E)},onMouseLeave:function(E){var N;v(!1),f==null||(N=f.onMouseLeave)===null||N===void 0||N.call(f,E)},onClick:p}),m.createElement("div",{className:"".concat(H,"-content")},s),c&&m.createElement("a",go({tabIndex:0,className:"".concat(H,"-close"),onKeyDown:x,"aria-label":"Close"},R,{onClick:function(E){E.preventDefault(),E.stopPropagation(),w()}}),b.closeIcon))}),T_e=be.createContext({}),dRt=function(e){var n=e.children,o=e.classNames;return be.createElement(T_e.Provider,{value:{classNames:o}},n)},H7e=8,M7e=3,I7e=16,fRt=function(e){var n={offset:H7e,threshold:M7e,gap:I7e};if(e&&hi(e)==="object"){var o,r,i;n.offset=(o=e.offset)!==null&&o!==void 0?o:H7e,n.threshold=(r=e.threshold)!==null&&r!==void 0?r:M7e,n.gap=(i=e.gap)!==null&&i!==void 0?i:I7e}return[!!e,n]},hRt=["className","style","classNames","styles"],pRt=function(e){var n=e.configList,o=e.placement,r=e.prefixCls,i=e.className,a=e.style,l=e.motion,s=e.onAllNoticeRemoved,c=e.onNoticeClose,u=e.stack,d=m.useContext(T_e),f=d.classNames,p=m.useRef({}),g=m.useState(null),A=sn(g,2),y=A[0],S=A[1],C=m.useState([]),P=sn(C,2),v=P[0],T=P[1],w=n.map(function(k){return{config:k,key:String(k.key)}}),x=fRt(u),b=sn(x,2),R=b[0],H=b[1],F=H.offset,E=H.threshold,N=H.gap,U=R&&(v.length>0||w.length<=E),W=typeof l=="function"?l(o):l;return m.useEffect(function(){R&&v.length>1&&T(function(k){return k.filter(function(D){return w.some(function(L){var j=L.key;return D===j})})})},[v,w,R]),m.useEffect(function(){var k;if(R&&p.current[(k=w[w.length-1])===null||k===void 0?void 0:k.key]){var D;S(p.current[(D=w[w.length-1])===null||D===void 0?void 0:D.key])}},[w,R]),be.createElement(cCt,go({key:o,className:Xn(r,"".concat(r,"-").concat(o),f==null?void 0:f.list,i,Jt(Jt({},"".concat(r,"-stack"),!!R),"".concat(r,"-stack-expanded"),U)),style:a,keys:w,motionAppear:!0},W,{onAllRemoved:function(){s(o)}}),function(k,D){var L=k.config,j=k.className,B=k.style,O=k.index,V=L,G=V.key,q=V.times,$=String(G),ie=L,Q=ie.className,se=ie.style,Z=ie.classNames,ee=ie.styles,te=oi(ie,hRt),oe=w.findIndex(function(ue){return ue.key===$}),de={};if(R){var he=w.length-1-(oe>-1?oe:O-1),pe=o==="top"||o==="bottom"?"-50%":"0";if(he>0){var me,le,Te;de.height=U?(me=p.current[$])===null||me===void 0?void 0:me.offsetHeight:y==null?void 0:y.offsetHeight;for(var ge=0,Se=0;Se-1?p.current[$]=fe:delete p.current[$]},prefixCls:r,classNames:Z,styles:ee,className:Xn(Q,f==null?void 0:f.notice),style:se,times:q,key:G,eventKey:G,onNoticeClose:c,hovering:R&&v.length>0})))})},gRt=m.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-notification":n,r=t.container,i=t.motion,a=t.maxCount,l=t.className,s=t.style,c=t.onAllRemoved,u=t.stack,d=t.renderNotifications,f=m.useState([]),p=sn(f,2),g=p[0],A=p[1],y=function(R){var H,F=g.find(function(E){return E.key===R});F==null||(H=F.onClose)===null||H===void 0||H.call(F),A(function(E){return E.filter(function(N){return N.key!==R})})};m.useImperativeHandle(e,function(){return{open:function(R){A(function(H){var F=No(H),E=F.findIndex(function(W){return W.key===R.key}),N=en({},R);if(E>=0){var U;N.times=(((U=H[E])===null||U===void 0?void 0:U.times)||0)+1,F[E]=N}else N.times=0,F.push(N);return a>0&&F.length>a&&(F=F.slice(-a)),F})},close:function(R){y(R)},destroy:function(){A([])}}});var S=m.useState({}),C=sn(S,2),P=C[0],v=C[1];m.useEffect(function(){var b={};g.forEach(function(R){var H=R.placement,F=H===void 0?"topRight":H;F&&(b[F]=b[F]||[],b[F].push(R))}),Object.keys(P).forEach(function(R){b[R]=b[R]||[]}),v(b)},[g]);var T=function(R){v(function(H){var F=en({},H),E=F[R]||[];return E.length||delete F[R],F})},w=m.useRef(!1);if(m.useEffect(function(){Object.keys(P).length>0?w.current=!0:w.current&&(c==null||c(),w.current=!1)},[P]),!r)return null;var x=Object.keys(P);return Hd.createPortal(m.createElement(m.Fragment,null,x.map(function(b){var R=P[b],H=m.createElement(pRt,{key:b,configList:R,placement:b,prefixCls:o,className:l==null?void 0:l(b),style:s==null?void 0:s(b),motion:i,onNoticeClose:y,onAllNoticeRemoved:T,stack:u});return d?d(H,{prefixCls:o,key:b}):H})),r)}),mRt=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],yRt=function(){return document.body},z7e=0;function ARt(){for(var t={},e=arguments.length,n=new Array(e),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},e=t.getContainer,n=e===void 0?yRt:e,o=t.motion,r=t.prefixCls,i=t.maxCount,a=t.className,l=t.style,s=t.onAllRemoved,c=t.stack,u=t.renderNotifications,d=oi(t,mRt),f=m.useState(),p=sn(f,2),g=p[0],A=p[1],y=m.useRef(),S=m.createElement(gRt,{container:g,ref:y,prefixCls:r,motion:o,maxCount:i,className:a,style:l,onAllRemoved:s,stack:c,renderNotifications:u}),C=m.useState([]),P=sn(C,2),v=P[0],T=P[1],w=m.useMemo(function(){return{open:function(b){var R=ARt(d,b);(R.key===null||R.key===void 0)&&(R.key="rc-notification-".concat(z7e),z7e+=1),T(function(H){return[].concat(No(H),[{type:"open",config:R}])})},close:function(b){T(function(R){return[].concat(No(R),[{type:"close",key:b}])})},destroy:function(){T(function(b){return[].concat(No(b),[{type:"destroy"}])})}}},[]);return m.useEffect(function(){A(n())}),m.useEffect(function(){y.current&&v.length&&(v.forEach(function(x){switch(x.type){case"open":y.current.open(x.config);break;case"close":y.current.close(x.key);break;case"destroy":y.current.destroy();break}}),T(function(x){return x.filter(function(b){return!v.includes(b)})}))},[v]),[w,S]}var vRt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},xRt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:vRt}))},YH=m.forwardRef(xRt);const WW=be.createContext(void 0),gv=100,bRt=10,Cme=gv*bRt,P_e={Modal:gv,Drawer:gv,Popover:gv,Popconfirm:gv,Tooltip:gv,Tour:gv},SRt={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function TRt(t){return t in P_e}function Bw(t,e){const[,n]=Vu(),o=be.useContext(WW),r=TRt(t);if(e!==void 0)return[e,e];let i=o??0;return r?(i+=(o?0:n.zIndexPopupBase)+P_e[t],i=Math.min(i,n.zIndexPopupBase+Cme)):i+=SRt[t],[o===void 0?e:i,i]}const PRt=t=>{const{componentCls:e,iconCls:n,boxShadow:o,colorText:r,colorSuccess:i,colorError:a,colorWarning:l,colorInfo:s,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:g,zIndexPopup:A,contentPadding:y,contentBg:S}=t,C=`${e}-notice`,P=new ba("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),v=new ba("MessageMoveOut",{"0%":{maxHeight:t.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),T={padding:p,textAlign:"center",[`${e}-custom-content > ${n}`]:{verticalAlign:"text-bottom",marginInlineEnd:f,fontSize:c},[`${C}-content`]:{display:"inline-block",padding:y,background:S,borderRadius:g,boxShadow:o,pointerEvents:"all"},[`${e}-success > ${n}`]:{color:i},[`${e}-error > ${n}`]:{color:a},[`${e}-warning > ${n}`]:{color:l},[`${e}-info > ${n}, + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,sRt="".concat(aRt," ").concat(lRt).split(/[\s\n]+/),cRt="aria-",uRt="data-";function R7e(t,e){return t.indexOf(e)===0}function bf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=en({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||R7e(r,cRt))||n.data&&R7e(r,uRt)||n.attr&&sRt.includes(r))&&(o[r]=t[r])}),o}var S_e=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.className,i=t.duration,a=i===void 0?4.5:i,l=t.eventKey,s=t.content,c=t.closable,u=t.closeIcon,d=u===void 0?"x":u,f=t.props,p=t.onClick,g=t.onNoticeClose,A=t.times,y=t.hovering,S=m.useState(!1),C=sn(S,2),P=C[0],v=C[1],T=y||P,w=function(){g(l)},x=function(E){(E.key==="Enter"||E.code==="Enter"||E.keyCode===jn.ENTER)&&w()};m.useEffect(function(){if(!T&&a>0){var F=setTimeout(function(){w()},a*1e3);return function(){clearTimeout(F)}}},[a,T,A]);var b=m.useMemo(function(){return hi(c)==="object"&&c!==null?c:c?{closeIcon:d}:{}},[c,d]),R=bf(b,!0),H="".concat(n,"-notice");return m.createElement("div",go({},f,{ref:e,className:Xn(H,r,Jt({},"".concat(H,"-closable"),c)),style:o,onMouseEnter:function(E){var N;v(!0),f==null||(N=f.onMouseEnter)===null||N===void 0||N.call(f,E)},onMouseLeave:function(E){var N;v(!1),f==null||(N=f.onMouseLeave)===null||N===void 0||N.call(f,E)},onClick:p}),m.createElement("div",{className:"".concat(H,"-content")},s),c&&m.createElement("a",go({tabIndex:0,className:"".concat(H,"-close"),onKeyDown:x,"aria-label":"Close"},R,{onClick:function(E){E.preventDefault(),E.stopPropagation(),w()}}),b.closeIcon))}),T_e=be.createContext({}),dRt=function(e){var n=e.children,o=e.classNames;return be.createElement(T_e.Provider,{value:{classNames:o}},n)},H7e=8,M7e=3,I7e=16,fRt=function(e){var n={offset:H7e,threshold:M7e,gap:I7e};if(e&&hi(e)==="object"){var o,r,i;n.offset=(o=e.offset)!==null&&o!==void 0?o:H7e,n.threshold=(r=e.threshold)!==null&&r!==void 0?r:M7e,n.gap=(i=e.gap)!==null&&i!==void 0?i:I7e}return[!!e,n]},hRt=["className","style","classNames","styles"],pRt=function(e){var n=e.configList,o=e.placement,r=e.prefixCls,i=e.className,a=e.style,l=e.motion,s=e.onAllNoticeRemoved,c=e.onNoticeClose,u=e.stack,d=m.useContext(T_e),f=d.classNames,p=m.useRef({}),g=m.useState(null),A=sn(g,2),y=A[0],S=A[1],C=m.useState([]),P=sn(C,2),v=P[0],T=P[1],w=n.map(function(k){return{config:k,key:String(k.key)}}),x=fRt(u),b=sn(x,2),R=b[0],H=b[1],F=H.offset,E=H.threshold,N=H.gap,U=R&&(v.length>0||w.length<=E),W=typeof l=="function"?l(o):l;return m.useEffect(function(){R&&v.length>1&&T(function(k){return k.filter(function(D){return w.some(function(L){var j=L.key;return D===j})})})},[v,w,R]),m.useEffect(function(){var k;if(R&&p.current[(k=w[w.length-1])===null||k===void 0?void 0:k.key]){var D;S(p.current[(D=w[w.length-1])===null||D===void 0?void 0:D.key])}},[w,R]),be.createElement(cCt,go({key:o,className:Xn(r,"".concat(r,"-").concat(o),f==null?void 0:f.list,i,Jt(Jt({},"".concat(r,"-stack"),!!R),"".concat(r,"-stack-expanded"),U)),style:a,keys:w,motionAppear:!0},W,{onAllRemoved:function(){s(o)}}),function(k,D){var L=k.config,j=k.className,B=k.style,O=k.index,V=L,G=V.key,q=V.times,$=String(G),ie=L,Q=ie.className,se=ie.style,oe=ie.classNames,Z=ie.styles,te=oi(ie,hRt),ee=w.findIndex(function(ue){return ue.key===$}),de={};if(R){var fe=w.length-1-(ee>-1?ee:O-1),pe=o==="top"||o==="bottom"?"-50%":"0";if(fe>0){var ye,ae,Te;de.height=U?(ye=p.current[$])===null||ye===void 0?void 0:ye.offsetHeight:y==null?void 0:y.offsetHeight;for(var ge=0,Se=0;Se-1?p.current[$]=he:delete p.current[$]},prefixCls:r,classNames:oe,styles:Z,className:Xn(Q,f==null?void 0:f.notice),style:se,times:q,key:G,eventKey:G,onNoticeClose:c,hovering:R&&v.length>0})))})},gRt=m.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-notification":n,r=t.container,i=t.motion,a=t.maxCount,l=t.className,s=t.style,c=t.onAllRemoved,u=t.stack,d=t.renderNotifications,f=m.useState([]),p=sn(f,2),g=p[0],A=p[1],y=function(R){var H,F=g.find(function(E){return E.key===R});F==null||(H=F.onClose)===null||H===void 0||H.call(F),A(function(E){return E.filter(function(N){return N.key!==R})})};m.useImperativeHandle(e,function(){return{open:function(R){A(function(H){var F=No(H),E=F.findIndex(function(W){return W.key===R.key}),N=en({},R);if(E>=0){var U;N.times=(((U=H[E])===null||U===void 0?void 0:U.times)||0)+1,F[E]=N}else N.times=0,F.push(N);return a>0&&F.length>a&&(F=F.slice(-a)),F})},close:function(R){y(R)},destroy:function(){A([])}}});var S=m.useState({}),C=sn(S,2),P=C[0],v=C[1];m.useEffect(function(){var b={};g.forEach(function(R){var H=R.placement,F=H===void 0?"topRight":H;F&&(b[F]=b[F]||[],b[F].push(R))}),Object.keys(P).forEach(function(R){b[R]=b[R]||[]}),v(b)},[g]);var T=function(R){v(function(H){var F=en({},H),E=F[R]||[];return E.length||delete F[R],F})},w=m.useRef(!1);if(m.useEffect(function(){Object.keys(P).length>0?w.current=!0:w.current&&(c==null||c(),w.current=!1)},[P]),!r)return null;var x=Object.keys(P);return Hd.createPortal(m.createElement(m.Fragment,null,x.map(function(b){var R=P[b],H=m.createElement(pRt,{key:b,configList:R,placement:b,prefixCls:o,className:l==null?void 0:l(b),style:s==null?void 0:s(b),motion:i,onNoticeClose:y,onAllNoticeRemoved:T,stack:u});return d?d(H,{prefixCls:o,key:b}):H})),r)}),mRt=["getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","stack","renderNotifications"],yRt=function(){return document.body},z7e=0;function ARt(){for(var t={},e=arguments.length,n=new Array(e),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},e=t.getContainer,n=e===void 0?yRt:e,o=t.motion,r=t.prefixCls,i=t.maxCount,a=t.className,l=t.style,s=t.onAllRemoved,c=t.stack,u=t.renderNotifications,d=oi(t,mRt),f=m.useState(),p=sn(f,2),g=p[0],A=p[1],y=m.useRef(),S=m.createElement(gRt,{container:g,ref:y,prefixCls:r,motion:o,maxCount:i,className:a,style:l,onAllRemoved:s,stack:c,renderNotifications:u}),C=m.useState([]),P=sn(C,2),v=P[0],T=P[1],w=m.useMemo(function(){return{open:function(b){var R=ARt(d,b);(R.key===null||R.key===void 0)&&(R.key="rc-notification-".concat(z7e),z7e+=1),T(function(H){return[].concat(No(H),[{type:"open",config:R}])})},close:function(b){T(function(R){return[].concat(No(R),[{type:"close",key:b}])})},destroy:function(){T(function(b){return[].concat(No(b),[{type:"destroy"}])})}}},[]);return m.useEffect(function(){A(n())}),m.useEffect(function(){y.current&&v.length&&(v.forEach(function(x){switch(x.type){case"open":y.current.open(x.config);break;case"close":y.current.close(x.key);break;case"destroy":y.current.destroy();break}}),T(function(x){return x.filter(function(b){return!v.includes(b)})}))},[v]),[w,S]}var vRt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"},xRt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:vRt}))},YH=m.forwardRef(xRt);const WW=be.createContext(void 0),gv=100,bRt=10,Cme=gv*bRt,P_e={Modal:gv,Drawer:gv,Popover:gv,Popconfirm:gv,Tooltip:gv,Tour:gv},SRt={SelectLike:50,Dropdown:50,DatePicker:50,Menu:50,ImagePreview:1};function TRt(t){return t in P_e}function Bw(t,e){const[,n]=Vu(),o=be.useContext(WW),r=TRt(t);if(e!==void 0)return[e,e];let i=o??0;return r?(i+=(o?0:n.zIndexPopupBase)+P_e[t],i=Math.min(i,n.zIndexPopupBase+Cme)):i+=SRt[t],[o===void 0?e:i,i]}const PRt=t=>{const{componentCls:e,iconCls:n,boxShadow:o,colorText:r,colorSuccess:i,colorError:a,colorWarning:l,colorInfo:s,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:f,paddingXS:p,borderRadiusLG:g,zIndexPopup:A,contentPadding:y,contentBg:S}=t,C=`${e}-notice`,P=new ba("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:p,transform:"translateY(0)",opacity:1}}),v=new ba("MessageMoveOut",{"0%":{maxHeight:t.height,padding:p,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}}),T={padding:p,textAlign:"center",[`${e}-custom-content > ${n}`]:{verticalAlign:"text-bottom",marginInlineEnd:f,fontSize:c},[`${C}-content`]:{display:"inline-block",padding:y,background:S,borderRadius:g,boxShadow:o,pointerEvents:"all"},[`${e}-success > ${n}`]:{color:i},[`${e}-error > ${n}`]:{color:a},[`${e}-warning > ${n}`]:{color:l},[`${e}-info > ${n}, ${e}-loading > ${n}`]:{color:s}};return[{[e]:Object.assign(Object.assign({},Na(t)),{color:r,position:"fixed",top:f,width:"100%",pointerEvents:"none",zIndex:A,[`${e}-move-up`]:{animationFillMode:"forwards"},[` ${e}-move-up-appear, ${e}-move-up-enter `]:{animationName:P,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[` ${e}-move-up-appear${e}-move-up-appear-active, ${e}-move-up-enter${e}-move-up-enter-active - `]:{animationPlayState:"running"},[`${e}-move-up-leave`]:{animationName:v,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[`${e}-move-up-leave${e}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[e]:{[`${C}-wrapper`]:Object.assign({},T)}},{[`${e}-notice-pure-panel`]:Object.assign(Object.assign({},T),{padding:0,textAlign:"start"})}]},CRt=t=>({zIndexPopup:t.zIndexPopupBase+Cme+10,contentBg:t.colorBgElevated,contentPadding:`${(t.controlHeightLG-t.fontSize*t.lineHeight)/2}px ${t.paddingSM}px`}),C_e=wl("Message",t=>{const e=qi(t,{height:150});return[PRt(e)]},CRt);var RRt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{prefixCls:e,type:n,icon:o,children:r}=t;return m.createElement("div",{className:Un(`${e}-custom-content`,`${e}-${n}`)},o||HRt[n],m.createElement("span",null,r))},MRt=t=>{const{prefixCls:e,className:n,type:o,icon:r,content:i}=t,a=RRt(t,["prefixCls","className","type","icon","content"]),{getPrefixCls:l}=m.useContext(Cr),s=e||l("message"),c=Y0(s),[u,d,f]=C_e(s,c);return u(m.createElement(S_e,Object.assign({},a,{prefixCls:s,className:Un(n,d,`${s}-notice-pure-panel`,f,c),eventKey:"pure",duration:null,content:m.createElement(R_e,{prefixCls:s,type:o,icon:r},i)})))};function IRt(t,e){return{motionName:e??`${t}-move-up`}}function Rme(t){let e;const n=new Promise(r=>{e=t(()=>{r(!0)})}),o=()=>{e==null||e()};return o.then=(r,i)=>n.then(r,i),o.promise=n,o}var zRt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{children:e,prefixCls:n}=t;const o=Y0(n),[r,i,a]=C_e(n,o);return r(m.createElement(dRt,{classNames:{list:Un(i,a,o)}},e))},kRt=(t,e)=>{let{prefixCls:n,key:o}=e;return m.createElement(FRt,{prefixCls:n,key:o},t)},LRt=m.forwardRef((t,e)=>{const{top:n,prefixCls:o,getContainer:r,maxCount:i,duration:a=ERt,rtl:l,transitionName:s,onAllRemoved:c}=t,{getPrefixCls:u,getPopupContainer:d,message:f,direction:p}=m.useContext(Cr),g=o||u("message"),A=()=>({left:"50%",transform:"translateX(-50%)",top:n??DRt}),y=()=>Un({[`${g}-rtl`]:l??p==="rtl"}),S=()=>IRt(g,s),C=m.createElement("span",{className:`${g}-close-x`},m.createElement(jw,{className:`${g}-close-icon`})),[P,v]=wRt({prefixCls:g,style:A,className:y,motion:S,closable:!1,closeIcon:C,duration:a,getContainer:()=>(r==null?void 0:r())||(d==null?void 0:d())||document.body,maxCount:i,onAllRemoved:c,renderNotifications:kRt});return m.useImperativeHandle(e,()=>Object.assign(Object.assign({},P),{prefixCls:g,message:f})),v});let D7e=0;function H_e(t){const e=m.useRef(null);return Bb(),[m.useMemo(()=>{const o=s=>{var c;(c=e.current)===null||c===void 0||c.close(s)},r=s=>{if(!e.current){const w=()=>{};return w.then=()=>{},w}const{open:c,prefixCls:u,message:d}=e.current,f=`${u}-notice`,{content:p,icon:g,type:A,key:y,className:S,style:C,onClose:P}=s,v=zRt(s,["content","icon","type","key","className","style","onClose"]);let T=y;return T==null&&(D7e+=1,T=`antd-message-${D7e}`),Rme(w=>(c(Object.assign(Object.assign({},v),{key:T,content:m.createElement(R_e,{prefixCls:u,type:A,icon:g},p),placement:"top",className:Un(A&&`${f}-${A}`,S,d==null?void 0:d.className),style:Object.assign(Object.assign({},d==null?void 0:d.style),C),onClose:()=>{P==null||P(),w()}})),()=>{o(T)}))},a={open:r,destroy:s=>{var c;s!==void 0?o(s):(c=e.current)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(s=>{const c=(u,d,f)=>{let p;u&&typeof u=="object"&&"content"in u?p=u:p={content:u};let g,A;typeof d=="function"?A=d:(g=d,A=f);const y=Object.assign(Object.assign({onClose:A,duration:g},p),{type:s});return r(y)};a[s]=c}),a},[]),m.createElement(LRt,Object.assign({key:"message-holder"},t,{ref:e}))]}function WRt(t){return H_e(t)}function NRt(){const[t,e]=m.useState([]),n=m.useCallback(o=>(e(r=>[].concat(Qa(r),[o])),()=>{e(r=>r.filter(i=>i!==o))}),[]);return[t,n]}function ak(){ak=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(k,D,L){k[D]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(k,D,L){return Object.defineProperty(k,D,{value:L,enumerable:!0,configurable:!0,writable:!0}),k[D]}try{c({},"")}catch{c=function(L,j,B){return L[j]=B}}function u(k,D,L,j){var B=D&&D.prototype instanceof S?D:S,O=Object.create(B.prototype),V=new U(j||[]);return r(O,"_invoke",{value:H(k,L,V)}),O}function d(k,D,L){try{return{type:"normal",arg:k.call(D,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",g="executing",A="completed",y={};function S(){}function C(){}function P(){}var v={};c(v,a,function(){return this});var T=Object.getPrototypeOf,w=T&&T(T(W([])));w&&w!==n&&o.call(w,a)&&(v=w);var x=P.prototype=S.prototype=Object.create(v);function b(k){["next","throw","return"].forEach(function(D){c(k,D,function(L){return this._invoke(D,L)})})}function R(k,D){function L(B,O,V,G){var q=d(k[B],k,O);if(q.type!=="throw"){var $=q.arg,ie=$.value;return ie&&Mg(ie)=="object"&&o.call(ie,"__await")?D.resolve(ie.__await).then(function(Q){L("next",Q,V,G)},function(Q){L("throw",Q,V,G)}):D.resolve(ie).then(function(Q){$.value=Q,V($)},function(Q){return L("throw",Q,V,G)})}G(q.arg)}var j;r(this,"_invoke",{value:function(O,V){function G(){return new D(function(q,$){L(O,V,q,$)})}return j=j?j.then(G,G):G()}})}function H(k,D,L){var j=f;return function(B,O){if(j===g)throw new Error("Generator is already running");if(j===A){if(B==="throw")throw O;return{value:t,done:!0}}for(L.method=B,L.arg=O;;){var V=L.delegate;if(V){var G=F(V,L);if(G){if(G===y)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=A,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=g;var q=d(k,D,L);if(q.type==="normal"){if(j=L.done?A:p,q.arg===y)continue;return{value:q.arg,done:L.done}}q.type==="throw"&&(j=A,L.method="throw",L.arg=q.arg)}}}function F(k,D){var L=D.method,j=k.iterator[L];if(j===t)return D.delegate=null,L==="throw"&&k.iterator.return&&(D.method="return",D.arg=t,F(k,D),D.method==="throw")||L!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+L+"' method")),y;var B=d(j,k.iterator,D.arg);if(B.type==="throw")return D.method="throw",D.arg=B.arg,D.delegate=null,y;var O=B.arg;return O?O.done?(D[k.resultName]=O.value,D.next=k.nextLoc,D.method!=="return"&&(D.method="next",D.arg=t),D.delegate=null,y):O:(D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,y)}function E(k){var D={tryLoc:k[0]};1 in k&&(D.catchLoc=k[1]),2 in k&&(D.finallyLoc=k[2],D.afterLoc=k[3]),this.tryEntries.push(D)}function N(k){var D=k.completion||{};D.type="normal",delete D.arg,k.completion=D}function U(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(E,this),this.reset(!0)}function W(k){if(k||k===""){var D=k[a];if(D)return D.call(k);if(typeof k.next=="function")return k;if(!isNaN(k.length)){var L=-1,j=function B(){for(;++L=0;--B){var O=this.tryEntries[B],V=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),q=o.call(O,"finallyLoc");if(G&&q){if(this.prev=0;--j){var B=this.tryEntries[j];if(B.tryLoc<=this.prev&&o.call(B,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===D)return this.complete(j.completion,j.afterLoc),N(j),y}},catch:function(D){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===D){var B=j.completion;if(B.type==="throw"){var O=B.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(D,L,j){return this.delegate={iterator:W(D),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),y}},e}function E7e(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function M_e(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){E7e(i,o,r,a,l,"next",s)}function l(s){E7e(i,o,r,a,l,"throw",s)}a(void 0)})}}var NW=fR({},rft),URt=NW.version,jRt=NW.render,BRt=NW.unmountComponentAtNode,N$;try{var YRt=Number((URt||"").split(".")[0]);YRt>=18&&(N$=NW.createRoot)}catch{}function F7e(t){var e=NW.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&Mg(e)==="object"&&(e.usingClientEntryPoint=t)}var LG="__rc_react_root__";function ORt(t,e){F7e(!0);var n=e[LG]||N$(e);F7e(!1),n.render(t),e[LG]=n}function VRt(t,e){jRt(t,e)}function Hme(t,e){if(N$){ORt(t,e);return}VRt(t,e)}function _Rt(t){return E0e.apply(this,arguments)}function E0e(){return E0e=M_e(ak().mark(function t(e){return ak().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",Promise.resolve().then(function(){var r;(r=e[LG])===null||r===void 0||r.unmount(),delete e[LG]}));case 1:case"end":return o.stop()}},t)})),E0e.apply(this,arguments)}function GRt(t){BRt(t)}function I_e(t){return F0e.apply(this,arguments)}function F0e(){return F0e=M_e(ak().mark(function t(e){return ak().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(N$===void 0){o.next=2;break}return o.abrupt("return",_Rt(e));case 2:GRt(e);case 3:case"end":return o.stop()}},t)})),F0e.apply(this,arguments)}const qre=()=>({height:0,opacity:0}),k7e=t=>{const{scrollHeight:e}=t;return{height:e,opacity:1}},XRt=t=>({height:t?t.offsetHeight:0}),$re=(t,e)=>(e==null?void 0:e.deadline)===!0||e.propertyName==="height",JRt=function(){return{motionName:`${arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ant"}-motion-collapse`,onAppearStart:qre,onEnterStart:qre,onAppearActive:k7e,onEnterActive:k7e,onLeaveStart:XRt,onLeaveActive:qre,onAppearEnd:$re,onEnterEnd:$re,onLeaveEnd:$re,motionDeadline:500}},B9=(t,e,n)=>n!==void 0?n:`${t}-${e}`,Mme=JRt,KRt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1},qRt=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},$Rt=xme("Wave",t=>[qRt(t)]),U$="ant-wave-target";function QRt(t){const e=(t||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);return e&&e[1]&&e[2]&&e[3]?!(e[1]===e[2]&&e[2]===e[3]):!0}function Qre(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&QRt(t)&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function ZRt(t){const{borderTopColor:e,borderColor:n,backgroundColor:o}=getComputedStyle(t);return Qre(e)?e:Qre(n)?n:Qre(o)?o:null}function Zre(t){return Number.isNaN(t)?0:t}const eHt=t=>{const{className:e,target:n,component:o}=t,r=m.useRef(null),[i,a]=m.useState(null),[l,s]=m.useState([]),[c,u]=m.useState(0),[d,f]=m.useState(0),[p,g]=m.useState(0),[A,y]=m.useState(0),[S,C]=m.useState(!1),P={left:c,top:d,width:p,height:A,borderRadius:l.map(w=>`${w}px`).join(" ")};i&&(P["--wave-color"]=i);function v(){const w=getComputedStyle(n);a(ZRt(n));const x=w.position==="static",{borderLeftWidth:b,borderTopWidth:R}=w;u(x?n.offsetLeft:Zre(-parseFloat(b))),f(x?n.offsetTop:Zre(-parseFloat(R))),g(n.offsetWidth),y(n.offsetHeight);const{borderTopLeftRadius:H,borderTopRightRadius:F,borderBottomLeftRadius:E,borderBottomRightRadius:N}=w;s([H,F,N,E].map(U=>Zre(parseFloat(U))))}if(m.useEffect(()=>{if(n){const w=Ig(()=>{v(),C(!0)});let x;return typeof ResizeObserver<"u"&&(x=new ResizeObserver(v),x.observe(n)),()=>{Ig.cancel(w),x==null||x.disconnect()}}},[]),!S)return null;const T=(o==="Checkbox"||o==="Radio")&&(n==null?void 0:n.classList.contains(U$));return m.createElement(o1,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(w,x)=>{var b;if(x.deadline||x.propertyName==="opacity"){const R=(b=r.current)===null||b===void 0?void 0:b.parentElement;I_e(R).then(()=>{R==null||R.remove()})}return!1}},w=>{let{className:x}=w;return m.createElement("div",{ref:r,className:Un(e,{"wave-quick":T},x),style:P})})},tHt=(t,e)=>{var n;const{component:o}=e;if(o==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",t==null||t.insertBefore(r,t==null?void 0:t.firstChild),Hme(m.createElement(eHt,Object.assign({},e,{target:t})),r)},nHt=(t,e,n)=>{const{wave:o}=m.useContext(Cr),[,r,i]=Vu(),a=Q6(c=>{const u=t.current;if(o!=null&&o.disabled||!u)return;const d=u.querySelector(`.${U$}`)||u,{showEffect:f}=o||{};(f||tHt)(d,{className:e,token:r,component:n,event:c,hashId:i})}),l=m.useRef();return c=>{Ig.cancel(l.current),l.current=Ig(()=>{a(c)})}},UW=t=>{const{children:e,disabled:n,component:o}=t,{getPrefixCls:r}=m.useContext(Cr),i=m.useRef(null),a=r("wave"),[,l]=$Rt(a),s=nHt(i,Un(a,l),o);if(be.useEffect(()=>{const u=i.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!KRt(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||s(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!be.isValidElement(e))return e??null;const c=YVe(e)?o5(e.ref,i):i;return j0(e,{ref:c})},zd=t=>{const e=be.useContext(mR);return be.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])};function Y9(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return be.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Y9(o)):HC.isFragment(o)&&o.props?n=n.concat(Y9(o.props.children,e)):n.push(o))}),n}const oHt=t=>{const{componentCls:e}=t;return{[e]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},rHt=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${e}-item:empty`]:{display:"none"},[`${e}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},iHt=t=>{const{componentCls:e}=t;return{[e]:{"&-gap-row-small":{rowGap:t.spaceGapSmallSize},"&-gap-row-middle":{rowGap:t.spaceGapMiddleSize},"&-gap-row-large":{rowGap:t.spaceGapLargeSize},"&-gap-col-small":{columnGap:t.spaceGapSmallSize},"&-gap-col-middle":{columnGap:t.spaceGapMiddleSize},"&-gap-col-large":{columnGap:t.spaceGapLargeSize}}}},z_e=wl("Space",t=>{const e=qi(t,{spaceGapSmallSize:t.paddingXS,spaceGapMiddleSize:t.padding,spaceGapLargeSize:t.paddingLG});return[rHt(e),iHt(e),oHt(e)]},()=>({}),{resetStyle:!1});var D_e=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=m.useContext(j$),o=m.useMemo(()=>{if(!n)return"";const{compactDirection:r,isFirstItem:i,isLastItem:a}=n,l=r==="vertical"?"-vertical-":"-";return Un(`${t}-compact${l}item`,{[`${t}-compact${l}first-item`]:i,[`${t}-compact${l}last-item`]:a,[`${t}-compact${l}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:o}},O9=t=>{let{children:e}=t;return m.createElement(j$.Provider,{value:null},e)},aHt=t=>{var{children:e}=t,n=D_e(t,["children"]);return m.createElement(j$.Provider,{value:n},e)},lHt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{size:o,direction:r,block:i,prefixCls:a,className:l,rootClassName:s,children:c}=t,u=D_e(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=zd(P=>o??P),f=e("space-compact",a),[p,g]=z_e(f),A=Un(f,g,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:i,[`${f}-vertical`]:r==="vertical"},l,s),y=m.useContext(j$),S=Y9(c),C=m.useMemo(()=>S.map((P,v)=>{const T=P&&P.key||`${f}-item-${v}`;return m.createElement(aHt,{key:T,compactSize:d,compactDirection:r,isFirstItem:v===0&&(!y||(y==null?void 0:y.isFirstItem)),isLastItem:v===S.length-1&&(!y||(y==null?void 0:y.isLastItem))},P)}),[o,S,y]);return S.length===0?null:p(m.createElement("div",Object.assign({className:A},u),C))},sHt=lHt;var cHt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,size:r,className:i}=t,a=cHt(t,["prefixCls","size","className"]),l=e("btn-group",o),[,,s]=Vu();let c="";switch(r){case"large":c="lg";break;case"small":c="sm";break}const u=Un(l,{[`${l}-${c}`]:c,[`${l}-rtl`]:n==="rtl"},i,s);return m.createElement(E_e.Provider,{value:r},m.createElement("div",Object.assign({},a,{className:u})))},L7e=/^[\u4e00-\u9fa5]{2}$/,k0e=L7e.test.bind(L7e);function F_e(t){return t==="danger"?{danger:!0}:{type:t}}function W7e(t){return typeof t=="string"}function eie(t){return t==="text"||t==="link"}function dHt(t,e){if(t==null)return;const n=e?" ":"";return typeof t!="string"&&typeof t!="number"&&W7e(t.type)&&k0e(t.props.children)?j0(t,{children:t.props.children.split("").join(n)}):W7e(t)?k0e(t)?be.createElement("span",null,t.split("").join(n)):be.createElement("span",null,t):x_e(t)?be.createElement("span",null,t):t}function fHt(t,e){let n=!1;const o=[];return be.Children.forEach(t,r=>{const i=typeof r,a=i==="string"||i==="number";if(n&&a){const l=o.length-1,s=o[l];o[l]=`${s}${r}`}else o.push(r);n=a}),be.Children.map(o,r=>dHt(r,e))}const k_e=m.forwardRef((t,e)=>{const{className:n,style:o,children:r,prefixCls:i}=t,a=Un(`${i}-icon`,n);return be.createElement("span",{ref:e,className:a,style:o},r)}),N7e=m.forwardRef((t,e)=>{const{prefixCls:n,className:o,style:r,iconClassName:i,iconPosition:a="start"}=t,l=Un(o,{[`${n}-loading-icon-end`]:a==="end",[`${n}-loading-icon`]:a==="start"});return be.createElement(k_e,{prefixCls:n,className:l,style:r,ref:e},be.createElement(YH,{className:i}))}),tie=()=>({width:0,opacity:0,transform:"scale(0)"}),nie=t=>({width:t.scrollWidth,opacity:1,transform:"scale(1)"}),hHt=t=>{const{prefixCls:e,loading:n,existIcon:o,className:r,style:i,iconPosition:a}=t,l=!!n;return o?be.createElement(N7e,{prefixCls:e,className:r,style:i,iconPosition:a}):be.createElement(o1,{visible:l,motionName:`${e}-loading-icon-motion`,motionLeave:l,removeOnLeave:!0,onAppearStart:tie,onAppearActive:nie,onEnterStart:tie,onEnterActive:nie,onLeaveStart:nie,onLeaveActive:tie},(s,c)=>{let{className:u,style:d}=s;return be.createElement(N7e,{prefixCls:e,className:r,style:Object.assign(Object.assign({},i),d),ref:c,iconClassName:u,iconPosition:a})})},U7e=(t,e)=>({[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineEndColor:e}}},"&:not(:first-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineStartColor:e}}}}}),pHt=t=>{const{componentCls:e,fontSize:n,lineWidth:o,groupBorderColor:r,colorErrorHover:i}=t;return{[`${e}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:t.calc(o).mul(-1).equal(),[`&, & > ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[e]:{position:"relative",zIndex:1,"&:hover,\n &:focus,\n &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${e}-icon-only`]:{fontSize:n}},U7e(`${e}-primary`,r),U7e(`${e}-danger`,i)]}},L_e=t=>{const{paddingInline:e,onlyIconSize:n,paddingBlock:o}=t;return qi(t,{buttonPaddingHorizontal:e,buttonPaddingVertical:o,buttonIconOnlyFontSize:n})},W_e=t=>{var e,n,o,r,i,a;const l=(e=t.contentFontSize)!==null&&e!==void 0?e:t.fontSize,s=(n=t.contentFontSizeSM)!==null&&n!==void 0?n:t.fontSize,c=(o=t.contentFontSizeLG)!==null&&o!==void 0?o:t.fontSizeLG,u=(r=t.contentLineHeight)!==null&&r!==void 0?r:XV(l),d=(i=t.contentLineHeightSM)!==null&&i!==void 0?i:XV(s),f=(a=t.contentLineHeightLG)!==null&&a!==void 0?a:XV(c);return{fontWeight:400,defaultShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlTmpOutline}`,primaryShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlOutline}`,dangerShadow:`0 ${t.controlOutlineWidth}px 0 ${t.colorErrorOutline}`,primaryColor:t.colorTextLightSolid,dangerColor:t.colorTextLightSolid,borderColorDisabled:t.colorBorder,defaultGhostColor:t.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:t.colorBgContainer,paddingInline:t.paddingContentHorizontal-t.lineWidth,paddingInlineLG:t.paddingContentHorizontal-t.lineWidth,paddingInlineSM:8-t.lineWidth,onlyIconSize:t.fontSizeLG,onlyIconSizeSM:t.fontSizeLG-2,onlyIconSizeLG:t.fontSizeLG+2,groupBorderColor:t.colorPrimaryHover,linkHoverBg:"transparent",textHoverBg:t.colorBgTextHover,defaultColor:t.colorText,defaultBg:t.colorBgContainer,defaultBorderColor:t.colorBorder,defaultBorderColorDisabled:t.colorBorder,defaultHoverBg:t.colorBgContainer,defaultHoverColor:t.colorPrimaryHover,defaultHoverBorderColor:t.colorPrimaryHover,defaultActiveBg:t.colorBgContainer,defaultActiveColor:t.colorPrimaryActive,defaultActiveBorderColor:t.colorPrimaryActive,contentFontSize:l,contentFontSizeSM:s,contentFontSizeLG:c,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((t.controlHeight-l*u)/2-t.lineWidth,0),paddingBlockSM:Math.max((t.controlHeightSM-s*d)/2-t.lineWidth,0),paddingBlockLG:Math.max((t.controlHeightLG-c*f)/2-t.lineWidth,0)}},gHt=t=>{const{componentCls:e,iconCls:n,fontWeight:o}=t;return{[e]:{outline:"none",position:"relative",display:"inline-block",fontWeight:o,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:t.colorText,"&:disabled > *":{pointerEvents:"none"},"> span":{display:"inline-block"},[`${e}-icon`]:{lineHeight:0,"&-end":{marginInlineStart:t.marginXS}},[`> ${n} + span, > span + ${n}`]:{marginInlineStart:t.marginXS},[`&:not(${e}-icon-only) > ${e}-icon`]:{[`&${e}-loading-icon, &:not(:last-child)`]:{marginInlineEnd:t.marginXS},[`&${e}-loading-icon-end`]:{marginInlineStart:t.marginXS}},"> a":{color:"currentColor"},"&:not(:disabled)":Object.assign({},eA(t)),[`&${e}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${e}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&-icon-only${e}-compact-item`]:{flex:"none"}}}},tA=(t,e,n)=>({[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":e,"&:active":n}}),mHt=t=>({minWidth:t.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),yHt=t=>({borderRadius:t.controlHeight,paddingInlineStart:t.calc(t.controlHeight).div(2).equal(),paddingInlineEnd:t.calc(t.controlHeight).div(2).equal()}),AHt=t=>({cursor:"not-allowed",borderColor:t.borderColorDisabled,color:t.colorTextDisabled,background:t.colorBgContainerDisabled,boxShadow:"none"}),lk=(t,e,n,o,r,i,a,l)=>({[`&${t}-background-ghost`]:Object.assign(Object.assign({color:n||void 0,background:e,borderColor:o||void 0,boxShadow:"none"},tA(t,Object.assign({background:e},a),Object.assign({background:e},l))),{"&:disabled":{cursor:"not-allowed",color:r||void 0,borderColor:i||void 0}})}),Ime=t=>({[`&:disabled, &${t.componentCls}-disabled`]:Object.assign({},AHt(t))}),N_e=t=>Object.assign({},Ime(t)),WG=t=>({[`&:disabled, &${t.componentCls}-disabled`]:{cursor:"not-allowed",color:t.colorTextDisabled}}),U_e=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N_e(t)),{background:t.defaultBg,borderColor:t.defaultBorderColor,color:t.defaultColor,boxShadow:t.defaultShadow}),tA(t.componentCls,{color:t.defaultHoverColor,borderColor:t.defaultHoverBorderColor,background:t.defaultHoverBg},{color:t.defaultActiveColor,borderColor:t.defaultActiveBorderColor,background:t.defaultActiveBg})),lk(t.componentCls,t.ghostBg,t.defaultGhostColor,t.defaultGhostBorderColor,t.colorTextDisabled,t.colorBorder)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign(Object.assign({color:t.colorError,borderColor:t.colorError},tA(t.componentCls,{color:t.colorErrorHover,borderColor:t.colorErrorBorderHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),lk(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder)),Ime(t))}),wHt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N_e(t)),{color:t.primaryColor,background:t.colorPrimary,boxShadow:t.primaryShadow}),tA(t.componentCls,{color:t.colorTextLightSolid,background:t.colorPrimaryHover},{color:t.colorTextLightSolid,background:t.colorPrimaryActive})),lk(t.componentCls,t.ghostBg,t.colorPrimary,t.colorPrimary,t.colorTextDisabled,t.colorBorder,{color:t.colorPrimaryHover,borderColor:t.colorPrimaryHover},{color:t.colorPrimaryActive,borderColor:t.colorPrimaryActive})),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign(Object.assign({background:t.colorError,boxShadow:t.dangerShadow,color:t.dangerColor},tA(t.componentCls,{background:t.colorErrorHover},{background:t.colorErrorActive})),lk(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder,{color:t.colorErrorHover,borderColor:t.colorErrorHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),Ime(t))}),vHt=t=>Object.assign(Object.assign({},U_e(t)),{borderStyle:"dashed"}),xHt=t=>Object.assign(Object.assign(Object.assign({color:t.colorLink},tA(t.componentCls,{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),WG(t)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign({color:t.colorError},tA(t.componentCls,{color:t.colorErrorHover},{color:t.colorErrorActive})),WG(t))}),bHt=t=>Object.assign(Object.assign(Object.assign({},tA(t.componentCls,{color:t.colorText,background:t.textHoverBg},{color:t.colorText,background:t.colorBgTextActive})),WG(t)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign({color:t.colorError},WG(t)),tA(t.componentCls,{color:t.colorErrorHover,background:t.colorErrorBg},{color:t.colorErrorHover,background:t.colorErrorBg}))}),SHt=t=>{const{componentCls:e}=t;return{[`${e}-default`]:U_e(t),[`${e}-primary`]:wHt(t),[`${e}-dashed`]:vHt(t),[`${e}-link`]:xHt(t),[`${e}-text`]:bHt(t),[`${e}-ghost`]:lk(t.componentCls,t.ghostBg,t.colorBgContainer,t.colorBgContainer,t.colorTextDisabled,t.colorBorder)}},zme=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const{componentCls:n,controlHeight:o,fontSize:r,lineHeight:i,borderRadius:a,buttonPaddingHorizontal:l,iconCls:s,buttonPaddingVertical:c}=t,u=`${n}-icon-only`;return[{[`${e}`]:{fontSize:r,lineHeight:i,height:o,padding:`${jt(c)} ${jt(l)}`,borderRadius:a,[`&${u}`]:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:o,paddingInlineStart:0,paddingInlineEnd:0,[`&${n}-round`]:{width:"auto"},[s]:{fontSize:t.buttonIconOnlyFontSize}},[`&${n}-loading`]:{opacity:t.opacityLoading,cursor:"default"},[`${n}-loading-icon`]:{transition:`width ${t.motionDurationSlow} ${t.motionEaseInOut}, opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`}}},{[`${n}${n}-circle${e}`]:mHt(t)},{[`${n}${n}-round${e}`]:yHt(t)}]},THt=t=>{const e=qi(t,{fontSize:t.contentFontSize,lineHeight:t.contentLineHeight});return zme(e,t.componentCls)},PHt=t=>{const e=qi(t,{controlHeight:t.controlHeightSM,fontSize:t.contentFontSizeSM,lineHeight:t.contentLineHeightSM,padding:t.paddingXS,buttonPaddingHorizontal:t.paddingInlineSM,buttonPaddingVertical:t.paddingBlockSM,borderRadius:t.borderRadiusSM,buttonIconOnlyFontSize:t.onlyIconSizeSM});return zme(e,`${t.componentCls}-sm`)},CHt=t=>{const e=qi(t,{controlHeight:t.controlHeightLG,fontSize:t.contentFontSizeLG,lineHeight:t.contentLineHeightLG,buttonPaddingHorizontal:t.paddingInlineLG,buttonPaddingVertical:t.paddingBlockLG,borderRadius:t.borderRadiusLG,buttonIconOnlyFontSize:t.onlyIconSizeLG});return zme(e,`${t.componentCls}-lg`)},RHt=t=>{const{componentCls:e}=t;return{[e]:{[`&${e}-block`]:{width:"100%"}}}},HHt=wl("Button",t=>{const e=L_e(t);return[gHt(e),THt(e),PHt(e),CHt(e),RHt(e),SHt(e),pHt(e)]},W_e,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function MHt(t,e,n){const{focusElCls:o,focus:r,borderElCls:i}=n,a=i?"> *":"",l=["hover",r?"focus":null,"active"].filter(Boolean).map(s=>`&:${s} ${a}`).join(",");return{[`&-item:not(${e}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[l]:{zIndex:2}},o?{[`&${o}`]:{zIndex:2}}:{}),{[`&[disabled] ${a}`]:{zIndex:0}})}}function IHt(t,e,n){const{borderElCls:o}=n,r=o?`> ${o}`:"";return{[`&-item:not(${e}-first-item):not(${e}-last-item) ${r}`]:{borderRadius:0},[`&-item:not(${e}-last-item)${e}-first-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${e}-first-item)${e}-last-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function jW(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=t,o=`${n}-compact`;return{[o]:Object.assign(Object.assign({},MHt(t,o,e)),IHt(n,o,e))}}function zHt(t,e){return{[`&-item:not(${e}-last-item)`]:{marginBottom:t.calc(t.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function DHt(t,e){return{[`&-item:not(${e}-first-item):not(${e}-last-item)`]:{borderRadius:0},[`&-item${e}-first-item:not(${e}-last-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${e}-last-item:not(${e}-first-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function EHt(t){const e=`${t.componentCls}-compact-vertical`;return{[e]:Object.assign(Object.assign({},zHt(t,e)),DHt(t.componentCls,e))}}const FHt=t=>{const{componentCls:e,calc:n}=t;return{[e]:{[`&-compact-item${e}-primary`]:{[`&:not([disabled]) + ${e}-compact-item${e}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:n(t.lineWidth).mul(-1).equal(),insetInlineStart:n(t.lineWidth).mul(-1).equal(),display:"inline-block",width:t.lineWidth,height:`calc(100% + ${jt(t.lineWidth)} * 2)`,backgroundColor:t.colorPrimaryHover,content:'""'}}},"&-compact-vertical-item":{[`&${e}-primary`]:{[`&:not([disabled]) + ${e}-compact-vertical-item${e}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:n(t.lineWidth).mul(-1).equal(),insetInlineStart:n(t.lineWidth).mul(-1).equal(),display:"inline-block",width:`calc(100% + ${jt(t.lineWidth)} * 2)`,height:t.lineWidth,backgroundColor:t.colorPrimaryHover,content:'""'}}}}}}},kHt=LW(["Button","compact"],t=>{const e=L_e(t);return[jW(e),EHt(e),FHt(e)]},W_e);var LHt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r;const{loading:i=!1,prefixCls:a,type:l,danger:s,shape:c="default",size:u,styles:d,disabled:f,className:p,rootClassName:g,children:A,icon:y,iconPosition:S="start",ghost:C=!1,block:P=!1,htmlType:v="button",classNames:T,style:w={},autoInsertSpace:x}=t,b=LHt(t,["loading","prefixCls","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace"]),R=l||"default",{getPrefixCls:H,direction:F,button:E}=m.useContext(Cr),N=(n=x??(E==null?void 0:E.autoInsertSpace))!==null&&n!==void 0?n:!0,U=H("btn",a),[W,k,D]=HHt(U),L=m.useContext(n1),j=f??L,B=m.useContext(E_e),O=m.useMemo(()=>WHt(i),[i]),[V,G]=m.useState(O.loading),[q,$]=m.useState(!1),Q=o5(e,m.createRef()),se=m.Children.count(A)===1&&!y&&!eie(R);m.useEffect(()=>{let ve=null;O.delay>0?ve=setTimeout(()=>{ve=null,G(!0)},O.delay):G(O.loading);function we(){ve&&(clearTimeout(ve),ve=null)}return we},[O]),m.useEffect(()=>{if(!Q||!Q.current||!N)return;const ve=Q.current.textContent;se&&k0e(ve)?q||$(!0):q&&$(!1)},[Q]);const Z=ve=>{const{onClick:we}=t;if(V||j){ve.preventDefault();return}we==null||we(ve)},{compactSize:ee,compactItemClassnames:te}=Yw(U,F),oe={large:"lg",small:"sm",middle:void 0},de=zd(ve=>{var we,Pe;return(Pe=(we=u??ee)!==null&&we!==void 0?we:B)!==null&&Pe!==void 0?Pe:ve}),he=de&&oe[de]||"",pe=V?"loading":y,me=dp(b,["navigate"]),le=Un(U,k,D,{[`${U}-${c}`]:c!=="default"&&c,[`${U}-${R}`]:R,[`${U}-${he}`]:he,[`${U}-icon-only`]:!A&&A!==0&&!!pe,[`${U}-background-ghost`]:C&&!eie(R),[`${U}-loading`]:V,[`${U}-two-chinese-chars`]:q&&N&&!V,[`${U}-block`]:P,[`${U}-dangerous`]:!!s,[`${U}-rtl`]:F==="rtl"},te,p,g,E==null?void 0:E.className),Te=Object.assign(Object.assign({},E==null?void 0:E.style),w),ge=S==="end"&&A&&A!==0&&pe,Se=Un(T==null?void 0:T.icon,(o=E==null?void 0:E.classNames)===null||o===void 0?void 0:o.icon,{[`${U}-icon-end`]:ge}),Re=Object.assign(Object.assign({},(d==null?void 0:d.icon)||{}),((r=E==null?void 0:E.styles)===null||r===void 0?void 0:r.icon)||{}),De=y&&!V?be.createElement(k_e,{prefixCls:U,className:Se,style:Re},y):be.createElement(hHt,{existIcon:!!y,prefixCls:U,loading:!!V,iconPosition:S}),Ae=A||A===0?fHt(A,se&&N):null,ue=(ve,we)=>{const Pe=F==="rtl",Ie=S==="start"&&!Pe||S==="end"&&Pe;return be.createElement(be.Fragment,null,Ie?ve:we,Ie?we:ve)};if(me.href!==void 0)return W(be.createElement("a",Object.assign({},me,{className:Un(le,{[`${U}-disabled`]:j}),href:j?void 0:me.href,style:Te,onClick:Z,ref:Q,tabIndex:j?-1:0}),ue(De,Ae)));let fe=be.createElement("button",Object.assign({},b,{type:v,className:le,style:Te,onClick:Z,disabled:j,ref:Q}),ue(De,Ae),!!te&&be.createElement(kHt,{key:"compact",prefixCls:U}));return eie(R)||(fe=be.createElement(UW,{component:"Button",disabled:!!V},fe)),W(fe)}),io=NHt;io.Group=uHt;io.__ANT_BUTTON=!0;function j7e(t){return!!(t&&t.then)}const j_e=t=>{const{type:e,children:n,prefixCls:o,buttonProps:r,close:i,autoFocus:a,emitEvent:l,isSilent:s,quitOnNullishReturnValue:c,actionFn:u}=t,d=m.useRef(!1),f=m.useRef(null),[p,g]=S0e(!1),A=function(){i==null||i.apply(void 0,arguments)};m.useEffect(()=>{let C=null;return a&&(C=setTimeout(()=>{var P;(P=f.current)===null||P===void 0||P.focus()})),()=>{C&&clearTimeout(C)}},[]);const y=C=>{j7e(C)&&(g(!0),C.then(function(){g(!1,!0),A.apply(void 0,arguments),d.current=!1},P=>{if(g(!1,!0),d.current=!1,!(s!=null&&s()))return Promise.reject(P)}))},S=C=>{if(d.current)return;if(d.current=!0,!u){A();return}let P;if(l){if(P=u(C),c&&!j7e(P)){d.current=!1,A(C);return}}else if(u.length)P=u(i),d.current=!1;else if(P=u(),!P){A();return}y(P)};return m.createElement(io,Object.assign({},F_e(e),{onClick:S,loading:p,prefixCls:o},r,{ref:f}),n)},BW=be.createContext({}),{Provider:B_e}=BW,B7e=()=>{const{autoFocusButton:t,cancelButtonProps:e,cancelTextLocale:n,isSilent:o,mergedOkCancel:r,rootPrefixCls:i,close:a,onCancel:l,onConfirm:s}=m.useContext(BW);return r?be.createElement(j_e,{isSilent:o,actionFn:l,close:function(){a==null||a.apply(void 0,arguments),s==null||s(!1)},autoFocus:t==="cancel",buttonProps:e,prefixCls:`${i}-btn`},n):null},Y7e=()=>{const{autoFocusButton:t,close:e,isSilent:n,okButtonProps:o,rootPrefixCls:r,okTextLocale:i,okType:a,onConfirm:l,onOk:s}=m.useContext(BW);return be.createElement(j_e,{isSilent:n,type:a||"primary",actionFn:s,close:function(){e==null||e.apply(void 0,arguments),l==null||l(!0)},autoFocus:t==="ok",buttonProps:o,prefixCls:`${r}-btn`},i)};var Y_e=m.createContext(null),O7e=[];function UHt(t,e){var n=m.useState(function(){if(!fp())return null;var g=document.createElement("div");return g}),o=sn(n,1),r=o[0],i=m.useRef(!1),a=m.useContext(Y_e),l=m.useState(O7e),s=sn(l,2),c=s[0],u=s[1],d=a||(i.current?void 0:function(g){u(function(A){var y=[g].concat(No(A));return y})});function f(){r.parentElement||document.body.appendChild(r),i.current=!0}function p(){var g;(g=r.parentElement)===null||g===void 0||g.removeChild(r),i.current=!1}return _a(function(){return t?a?a(f):f():p(),p},[t]),_a(function(){c.length&&(c.forEach(function(g){return g()}),u(O7e))},[c]),[r,d]}var oie;function L0e(t){if(typeof document>"u")return 0;if(oie===void 0){var e=document.createElement("div");e.style.width="100%",e.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(e),document.body.appendChild(n);var r=e.offsetWidth;n.style.overflow="scroll";var i=e.offsetWidth;r===i&&(i=n.clientWidth),document.body.removeChild(n),oie=r-i}return oie}function V7e(t){var e=t.match(/^(.*)px$/),n=Number(e==null?void 0:e[1]);return Number.isNaN(n)?L0e():n}function W0e(t){if(typeof document>"u"||!t||!(t instanceof Element))return{width:0,height:0};var e=getComputedStyle(t,"::-webkit-scrollbar"),n=e.width,o=e.height;return{width:V7e(n),height:V7e(o)}}function jHt(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var BHt="rc-util-locker-".concat(Date.now()),_7e=0;function YHt(t){var e=!!t,n=m.useState(function(){return _7e+=1,"".concat(BHt,"_").concat(_7e)}),o=sn(n,1),r=o[0];_a(function(){if(e){var i=W0e(document.body).width,a=jHt();mx(` + `]:{animationPlayState:"running"},[`${e}-move-up-leave`]:{animationName:v,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},[`${e}-move-up-leave${e}-move-up-leave-active`]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{[e]:{[`${C}-wrapper`]:Object.assign({},T)}},{[`${e}-notice-pure-panel`]:Object.assign(Object.assign({},T),{padding:0,textAlign:"start"})}]},CRt=t=>({zIndexPopup:t.zIndexPopupBase+Cme+10,contentBg:t.colorBgElevated,contentPadding:`${(t.controlHeightLG-t.fontSize*t.lineHeight)/2}px ${t.paddingSM}px`}),C_e=wl("Message",t=>{const e=qi(t,{height:150});return[PRt(e)]},CRt);var RRt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{prefixCls:e,type:n,icon:o,children:r}=t;return m.createElement("div",{className:Un(`${e}-custom-content`,`${e}-${n}`)},o||HRt[n],m.createElement("span",null,r))},MRt=t=>{const{prefixCls:e,className:n,type:o,icon:r,content:i}=t,a=RRt(t,["prefixCls","className","type","icon","content"]),{getPrefixCls:l}=m.useContext(Cr),s=e||l("message"),c=Y0(s),[u,d,f]=C_e(s,c);return u(m.createElement(S_e,Object.assign({},a,{prefixCls:s,className:Un(n,d,`${s}-notice-pure-panel`,f,c),eventKey:"pure",duration:null,content:m.createElement(R_e,{prefixCls:s,type:o,icon:r},i)})))};function IRt(t,e){return{motionName:e??`${t}-move-up`}}function Rme(t){let e;const n=new Promise(r=>{e=t(()=>{r(!0)})}),o=()=>{e==null||e()};return o.then=(r,i)=>n.then(r,i),o.promise=n,o}var zRt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{children:e,prefixCls:n}=t;const o=Y0(n),[r,i,a]=C_e(n,o);return r(m.createElement(dRt,{classNames:{list:Un(i,a,o)}},e))},kRt=(t,e)=>{let{prefixCls:n,key:o}=e;return m.createElement(FRt,{prefixCls:n,key:o},t)},LRt=m.forwardRef((t,e)=>{const{top:n,prefixCls:o,getContainer:r,maxCount:i,duration:a=ERt,rtl:l,transitionName:s,onAllRemoved:c}=t,{getPrefixCls:u,getPopupContainer:d,message:f,direction:p}=m.useContext(Cr),g=o||u("message"),A=()=>({left:"50%",transform:"translateX(-50%)",top:n??DRt}),y=()=>Un({[`${g}-rtl`]:l??p==="rtl"}),S=()=>IRt(g,s),C=m.createElement("span",{className:`${g}-close-x`},m.createElement(jw,{className:`${g}-close-icon`})),[P,v]=wRt({prefixCls:g,style:A,className:y,motion:S,closable:!1,closeIcon:C,duration:a,getContainer:()=>(r==null?void 0:r())||(d==null?void 0:d())||document.body,maxCount:i,onAllRemoved:c,renderNotifications:kRt});return m.useImperativeHandle(e,()=>Object.assign(Object.assign({},P),{prefixCls:g,message:f})),v});let D7e=0;function H_e(t){const e=m.useRef(null);return Bb(),[m.useMemo(()=>{const o=s=>{var c;(c=e.current)===null||c===void 0||c.close(s)},r=s=>{if(!e.current){const w=()=>{};return w.then=()=>{},w}const{open:c,prefixCls:u,message:d}=e.current,f=`${u}-notice`,{content:p,icon:g,type:A,key:y,className:S,style:C,onClose:P}=s,v=zRt(s,["content","icon","type","key","className","style","onClose"]);let T=y;return T==null&&(D7e+=1,T=`antd-message-${D7e}`),Rme(w=>(c(Object.assign(Object.assign({},v),{key:T,content:m.createElement(R_e,{prefixCls:u,type:A,icon:g},p),placement:"top",className:Un(A&&`${f}-${A}`,S,d==null?void 0:d.className),style:Object.assign(Object.assign({},d==null?void 0:d.style),C),onClose:()=>{P==null||P(),w()}})),()=>{o(T)}))},a={open:r,destroy:s=>{var c;s!==void 0?o(s):(c=e.current)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(s=>{const c=(u,d,f)=>{let p;u&&typeof u=="object"&&"content"in u?p=u:p={content:u};let g,A;typeof d=="function"?A=d:(g=d,A=f);const y=Object.assign(Object.assign({onClose:A,duration:g},p),{type:s});return r(y)};a[s]=c}),a},[]),m.createElement(LRt,Object.assign({key:"message-holder"},t,{ref:e}))]}function WRt(t){return H_e(t)}function NRt(){const[t,e]=m.useState([]),n=m.useCallback(o=>(e(r=>[].concat(Qa(r),[o])),()=>{e(r=>r.filter(i=>i!==o))}),[]);return[t,n]}function ak(){ak=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(k,D,L){k[D]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(k,D,L){return Object.defineProperty(k,D,{value:L,enumerable:!0,configurable:!0,writable:!0}),k[D]}try{c({},"")}catch{c=function(L,j,B){return L[j]=B}}function u(k,D,L,j){var B=D&&D.prototype instanceof S?D:S,O=Object.create(B.prototype),V=new U(j||[]);return r(O,"_invoke",{value:H(k,L,V)}),O}function d(k,D,L){try{return{type:"normal",arg:k.call(D,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",g="executing",A="completed",y={};function S(){}function C(){}function P(){}var v={};c(v,a,function(){return this});var T=Object.getPrototypeOf,w=T&&T(T(W([])));w&&w!==n&&o.call(w,a)&&(v=w);var x=P.prototype=S.prototype=Object.create(v);function b(k){["next","throw","return"].forEach(function(D){c(k,D,function(L){return this._invoke(D,L)})})}function R(k,D){function L(B,O,V,G){var q=d(k[B],k,O);if(q.type!=="throw"){var $=q.arg,ie=$.value;return ie&&Mg(ie)=="object"&&o.call(ie,"__await")?D.resolve(ie.__await).then(function(Q){L("next",Q,V,G)},function(Q){L("throw",Q,V,G)}):D.resolve(ie).then(function(Q){$.value=Q,V($)},function(Q){return L("throw",Q,V,G)})}G(q.arg)}var j;r(this,"_invoke",{value:function(O,V){function G(){return new D(function(q,$){L(O,V,q,$)})}return j=j?j.then(G,G):G()}})}function H(k,D,L){var j=f;return function(B,O){if(j===g)throw new Error("Generator is already running");if(j===A){if(B==="throw")throw O;return{value:t,done:!0}}for(L.method=B,L.arg=O;;){var V=L.delegate;if(V){var G=F(V,L);if(G){if(G===y)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=A,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=g;var q=d(k,D,L);if(q.type==="normal"){if(j=L.done?A:p,q.arg===y)continue;return{value:q.arg,done:L.done}}q.type==="throw"&&(j=A,L.method="throw",L.arg=q.arg)}}}function F(k,D){var L=D.method,j=k.iterator[L];if(j===t)return D.delegate=null,L==="throw"&&k.iterator.return&&(D.method="return",D.arg=t,F(k,D),D.method==="throw")||L!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+L+"' method")),y;var B=d(j,k.iterator,D.arg);if(B.type==="throw")return D.method="throw",D.arg=B.arg,D.delegate=null,y;var O=B.arg;return O?O.done?(D[k.resultName]=O.value,D.next=k.nextLoc,D.method!=="return"&&(D.method="next",D.arg=t),D.delegate=null,y):O:(D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,y)}function E(k){var D={tryLoc:k[0]};1 in k&&(D.catchLoc=k[1]),2 in k&&(D.finallyLoc=k[2],D.afterLoc=k[3]),this.tryEntries.push(D)}function N(k){var D=k.completion||{};D.type="normal",delete D.arg,k.completion=D}function U(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(E,this),this.reset(!0)}function W(k){if(k||k===""){var D=k[a];if(D)return D.call(k);if(typeof k.next=="function")return k;if(!isNaN(k.length)){var L=-1,j=function B(){for(;++L=0;--B){var O=this.tryEntries[B],V=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),q=o.call(O,"finallyLoc");if(G&&q){if(this.prev=0;--j){var B=this.tryEntries[j];if(B.tryLoc<=this.prev&&o.call(B,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===D)return this.complete(j.completion,j.afterLoc),N(j),y}},catch:function(D){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===D){var B=j.completion;if(B.type==="throw"){var O=B.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(D,L,j){return this.delegate={iterator:W(D),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),y}},e}function E7e(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function M_e(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){E7e(i,o,r,a,l,"next",s)}function l(s){E7e(i,o,r,a,l,"throw",s)}a(void 0)})}}var NW=fR({},rft),URt=NW.version,jRt=NW.render,BRt=NW.unmountComponentAtNode,N$;try{var YRt=Number((URt||"").split(".")[0]);YRt>=18&&(N$=NW.createRoot)}catch{}function F7e(t){var e=NW.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e&&Mg(e)==="object"&&(e.usingClientEntryPoint=t)}var LG="__rc_react_root__";function ORt(t,e){F7e(!0);var n=e[LG]||N$(e);F7e(!1),n.render(t),e[LG]=n}function VRt(t,e){jRt(t,e)}function Hme(t,e){if(N$){ORt(t,e);return}VRt(t,e)}function _Rt(t){return E0e.apply(this,arguments)}function E0e(){return E0e=M_e(ak().mark(function t(e){return ak().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",Promise.resolve().then(function(){var r;(r=e[LG])===null||r===void 0||r.unmount(),delete e[LG]}));case 1:case"end":return o.stop()}},t)})),E0e.apply(this,arguments)}function GRt(t){BRt(t)}function I_e(t){return F0e.apply(this,arguments)}function F0e(){return F0e=M_e(ak().mark(function t(e){return ak().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(N$===void 0){o.next=2;break}return o.abrupt("return",_Rt(e));case 2:GRt(e);case 3:case"end":return o.stop()}},t)})),F0e.apply(this,arguments)}const qre=()=>({height:0,opacity:0}),k7e=t=>{const{scrollHeight:e}=t;return{height:e,opacity:1}},XRt=t=>({height:t?t.offsetHeight:0}),$re=(t,e)=>(e==null?void 0:e.deadline)===!0||e.propertyName==="height",JRt=function(){return{motionName:`${arguments.length>0&&arguments[0]!==void 0?arguments[0]:"ant"}-motion-collapse`,onAppearStart:qre,onEnterStart:qre,onAppearActive:k7e,onEnterActive:k7e,onLeaveStart:XRt,onLeaveActive:qre,onAppearEnd:$re,onEnterEnd:$re,onLeaveEnd:$re,motionDeadline:500}},B9=(t,e,n)=>n!==void 0?n:`${t}-${e}`,Mme=JRt,KRt=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1},qRt=t=>{const{componentCls:e,colorPrimary:n}=t;return{[e]:{position:"absolute",background:"transparent",pointerEvents:"none",boxSizing:"border-box",color:`var(--wave-color, ${n})`,boxShadow:"0 0 0 0 currentcolor",opacity:.2,"&.wave-motion-appear":{transition:[`box-shadow 0.4s ${t.motionEaseOutCirc}`,`opacity 2s ${t.motionEaseOutCirc}`].join(","),"&-active":{boxShadow:"0 0 0 6px currentcolor",opacity:0},"&.wave-quick":{transition:[`box-shadow ${t.motionDurationSlow} ${t.motionEaseInOut}`,`opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`].join(",")}}}}},$Rt=xme("Wave",t=>[qRt(t)]),U$="ant-wave-target";function QRt(t){const e=(t||"").match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/);return e&&e[1]&&e[2]&&e[3]?!(e[1]===e[2]&&e[2]===e[3]):!0}function Qre(t){return t&&t!=="#fff"&&t!=="#ffffff"&&t!=="rgb(255, 255, 255)"&&t!=="rgba(255, 255, 255, 1)"&&QRt(t)&&!/rgba\((?:\d*, ){3}0\)/.test(t)&&t!=="transparent"}function ZRt(t){const{borderTopColor:e,borderColor:n,backgroundColor:o}=getComputedStyle(t);return Qre(e)?e:Qre(n)?n:Qre(o)?o:null}function Zre(t){return Number.isNaN(t)?0:t}const eHt=t=>{const{className:e,target:n,component:o}=t,r=m.useRef(null),[i,a]=m.useState(null),[l,s]=m.useState([]),[c,u]=m.useState(0),[d,f]=m.useState(0),[p,g]=m.useState(0),[A,y]=m.useState(0),[S,C]=m.useState(!1),P={left:c,top:d,width:p,height:A,borderRadius:l.map(w=>`${w}px`).join(" ")};i&&(P["--wave-color"]=i);function v(){const w=getComputedStyle(n);a(ZRt(n));const x=w.position==="static",{borderLeftWidth:b,borderTopWidth:R}=w;u(x?n.offsetLeft:Zre(-parseFloat(b))),f(x?n.offsetTop:Zre(-parseFloat(R))),g(n.offsetWidth),y(n.offsetHeight);const{borderTopLeftRadius:H,borderTopRightRadius:F,borderBottomLeftRadius:E,borderBottomRightRadius:N}=w;s([H,F,N,E].map(U=>Zre(parseFloat(U))))}if(m.useEffect(()=>{if(n){const w=Ig(()=>{v(),C(!0)});let x;return typeof ResizeObserver<"u"&&(x=new ResizeObserver(v),x.observe(n)),()=>{Ig.cancel(w),x==null||x.disconnect()}}},[]),!S)return null;const T=(o==="Checkbox"||o==="Radio")&&(n==null?void 0:n.classList.contains(U$));return m.createElement(o1,{visible:!0,motionAppear:!0,motionName:"wave-motion",motionDeadline:5e3,onAppearEnd:(w,x)=>{var b;if(x.deadline||x.propertyName==="opacity"){const R=(b=r.current)===null||b===void 0?void 0:b.parentElement;I_e(R).then(()=>{R==null||R.remove()})}return!1}},w=>{let{className:x}=w;return m.createElement("div",{ref:r,className:Un(e,{"wave-quick":T},x),style:P})})},tHt=(t,e)=>{var n;const{component:o}=e;if(o==="Checkbox"&&!(!((n=t.querySelector("input"))===null||n===void 0)&&n.checked))return;const r=document.createElement("div");r.style.position="absolute",r.style.left="0px",r.style.top="0px",t==null||t.insertBefore(r,t==null?void 0:t.firstChild),Hme(m.createElement(eHt,Object.assign({},e,{target:t})),r)},nHt=(t,e,n)=>{const{wave:o}=m.useContext(Cr),[,r,i]=Vu(),a=Q6(c=>{const u=t.current;if(o!=null&&o.disabled||!u)return;const d=u.querySelector(`.${U$}`)||u,{showEffect:f}=o||{};(f||tHt)(d,{className:e,token:r,component:n,event:c,hashId:i})}),l=m.useRef();return c=>{Ig.cancel(l.current),l.current=Ig(()=>{a(c)})}},UW=t=>{const{children:e,disabled:n,component:o}=t,{getPrefixCls:r}=m.useContext(Cr),i=m.useRef(null),a=r("wave"),[,l]=$Rt(a),s=nHt(i,Un(a,l),o);if(be.useEffect(()=>{const u=i.current;if(!u||u.nodeType!==1||n)return;const d=f=>{!KRt(f.target)||!u.getAttribute||u.getAttribute("disabled")||u.disabled||u.className.includes("disabled")||u.className.includes("-leave")||s(f)};return u.addEventListener("click",d,!0),()=>{u.removeEventListener("click",d,!0)}},[n]),!be.isValidElement(e))return e??null;const c=YVe(e)?o5(e.ref,i):i;return j0(e,{ref:c})},zd=t=>{const e=be.useContext(mR);return be.useMemo(()=>t?typeof t=="string"?t??e:t instanceof Function?t(e):e:e,[t,e])};function Y9(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[];return be.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Y9(o)):HC.isFragment(o)&&o.props?n=n.concat(Y9(o.props.children,e)):n.push(o))}),n}const oHt=t=>{const{componentCls:e}=t;return{[e]:{"&-block":{display:"flex",width:"100%"},"&-vertical":{flexDirection:"column"}}}},rHt=t=>{const{componentCls:e,antCls:n}=t;return{[e]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${e}-item:empty`]:{display:"none"},[`${e}-item > ${n}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},iHt=t=>{const{componentCls:e}=t;return{[e]:{"&-gap-row-small":{rowGap:t.spaceGapSmallSize},"&-gap-row-middle":{rowGap:t.spaceGapMiddleSize},"&-gap-row-large":{rowGap:t.spaceGapLargeSize},"&-gap-col-small":{columnGap:t.spaceGapSmallSize},"&-gap-col-middle":{columnGap:t.spaceGapMiddleSize},"&-gap-col-large":{columnGap:t.spaceGapLargeSize}}}},z_e=wl("Space",t=>{const e=qi(t,{spaceGapSmallSize:t.paddingXS,spaceGapMiddleSize:t.padding,spaceGapLargeSize:t.paddingLG});return[rHt(e),iHt(e),oHt(e)]},()=>({}),{resetStyle:!1});var D_e=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=m.useContext(j$),o=m.useMemo(()=>{if(!n)return"";const{compactDirection:r,isFirstItem:i,isLastItem:a}=n,l=r==="vertical"?"-vertical-":"-";return Un(`${t}-compact${l}item`,{[`${t}-compact${l}first-item`]:i,[`${t}-compact${l}last-item`]:a,[`${t}-compact${l}item-rtl`]:e==="rtl"})},[t,e,n]);return{compactSize:n==null?void 0:n.compactSize,compactDirection:n==null?void 0:n.compactDirection,compactItemClassnames:o}},O9=t=>{let{children:e}=t;return m.createElement(j$.Provider,{value:null},e)},aHt=t=>{var{children:e}=t,n=D_e(t,["children"]);return m.createElement(j$.Provider,{value:n},e)},lHt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{size:o,direction:r,block:i,prefixCls:a,className:l,rootClassName:s,children:c}=t,u=D_e(t,["size","direction","block","prefixCls","className","rootClassName","children"]),d=zd(P=>o??P),f=e("space-compact",a),[p,g]=z_e(f),A=Un(f,g,{[`${f}-rtl`]:n==="rtl",[`${f}-block`]:i,[`${f}-vertical`]:r==="vertical"},l,s),y=m.useContext(j$),S=Y9(c),C=m.useMemo(()=>S.map((P,v)=>{const T=P&&P.key||`${f}-item-${v}`;return m.createElement(aHt,{key:T,compactSize:d,compactDirection:r,isFirstItem:v===0&&(!y||(y==null?void 0:y.isFirstItem)),isLastItem:v===S.length-1&&(!y||(y==null?void 0:y.isLastItem))},P)}),[o,S,y]);return S.length===0?null:p(m.createElement("div",Object.assign({className:A},u),C))},sHt=lHt;var cHt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,size:r,className:i}=t,a=cHt(t,["prefixCls","size","className"]),l=e("btn-group",o),[,,s]=Vu();let c="";switch(r){case"large":c="lg";break;case"small":c="sm";break}const u=Un(l,{[`${l}-${c}`]:c,[`${l}-rtl`]:n==="rtl"},i,s);return m.createElement(E_e.Provider,{value:r},m.createElement("div",Object.assign({},a,{className:u})))},L7e=/^[\u4e00-\u9fa5]{2}$/,k0e=L7e.test.bind(L7e);function F_e(t){return t==="danger"?{danger:!0}:{type:t}}function W7e(t){return typeof t=="string"}function eie(t){return t==="text"||t==="link"}function dHt(t,e){if(t==null)return;const n=e?" ":"";return typeof t!="string"&&typeof t!="number"&&W7e(t.type)&&k0e(t.props.children)?j0(t,{children:t.props.children.split("").join(n)}):W7e(t)?k0e(t)?be.createElement("span",null,t.split("").join(n)):be.createElement("span",null,t):x_e(t)?be.createElement("span",null,t):t}function fHt(t,e){let n=!1;const o=[];return be.Children.forEach(t,r=>{const i=typeof r,a=i==="string"||i==="number";if(n&&a){const l=o.length-1,s=o[l];o[l]=`${s}${r}`}else o.push(r);n=a}),be.Children.map(o,r=>dHt(r,e))}const k_e=m.forwardRef((t,e)=>{const{className:n,style:o,children:r,prefixCls:i}=t,a=Un(`${i}-icon`,n);return be.createElement("span",{ref:e,className:a,style:o},r)}),N7e=m.forwardRef((t,e)=>{const{prefixCls:n,className:o,style:r,iconClassName:i,iconPosition:a="start"}=t,l=Un(o,{[`${n}-loading-icon-end`]:a==="end",[`${n}-loading-icon`]:a==="start"});return be.createElement(k_e,{prefixCls:n,className:l,style:r,ref:e},be.createElement(YH,{className:i}))}),tie=()=>({width:0,opacity:0,transform:"scale(0)"}),nie=t=>({width:t.scrollWidth,opacity:1,transform:"scale(1)"}),hHt=t=>{const{prefixCls:e,loading:n,existIcon:o,className:r,style:i,iconPosition:a}=t,l=!!n;return o?be.createElement(N7e,{prefixCls:e,className:r,style:i,iconPosition:a}):be.createElement(o1,{visible:l,motionName:`${e}-loading-icon-motion`,motionLeave:l,removeOnLeave:!0,onAppearStart:tie,onAppearActive:nie,onEnterStart:tie,onEnterActive:nie,onLeaveStart:nie,onLeaveActive:tie},(s,c)=>{let{className:u,style:d}=s;return be.createElement(N7e,{prefixCls:e,className:r,style:Object.assign(Object.assign({},i),d),ref:c,iconClassName:u,iconPosition:a})})},U7e=(t,e)=>({[`> span, > ${t}`]:{"&:not(:last-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineEndColor:e}}},"&:not(:first-child)":{[`&, & > ${t}`]:{"&:not(:disabled)":{borderInlineStartColor:e}}}}}),pHt=t=>{const{componentCls:e,fontSize:n,lineWidth:o,groupBorderColor:r,colorErrorHover:i}=t;return{[`${e}-group`]:[{position:"relative",display:"inline-flex",[`> span, > ${e}`]:{"&:not(:last-child)":{[`&, & > ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},"&:not(:first-child)":{marginInlineStart:t.calc(o).mul(-1).equal(),[`&, & > ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}},[e]:{position:"relative",zIndex:1,"&:hover,\n &:focus,\n &:active":{zIndex:2},"&[disabled]":{zIndex:0}},[`${e}-icon-only`]:{fontSize:n}},U7e(`${e}-primary`,r),U7e(`${e}-danger`,i)]}},L_e=t=>{const{paddingInline:e,onlyIconSize:n,paddingBlock:o}=t;return qi(t,{buttonPaddingHorizontal:e,buttonPaddingVertical:o,buttonIconOnlyFontSize:n})},W_e=t=>{var e,n,o,r,i,a;const l=(e=t.contentFontSize)!==null&&e!==void 0?e:t.fontSize,s=(n=t.contentFontSizeSM)!==null&&n!==void 0?n:t.fontSize,c=(o=t.contentFontSizeLG)!==null&&o!==void 0?o:t.fontSizeLG,u=(r=t.contentLineHeight)!==null&&r!==void 0?r:XV(l),d=(i=t.contentLineHeightSM)!==null&&i!==void 0?i:XV(s),f=(a=t.contentLineHeightLG)!==null&&a!==void 0?a:XV(c);return{fontWeight:400,defaultShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlTmpOutline}`,primaryShadow:`0 ${t.controlOutlineWidth}px 0 ${t.controlOutline}`,dangerShadow:`0 ${t.controlOutlineWidth}px 0 ${t.colorErrorOutline}`,primaryColor:t.colorTextLightSolid,dangerColor:t.colorTextLightSolid,borderColorDisabled:t.colorBorder,defaultGhostColor:t.colorBgContainer,ghostBg:"transparent",defaultGhostBorderColor:t.colorBgContainer,paddingInline:t.paddingContentHorizontal-t.lineWidth,paddingInlineLG:t.paddingContentHorizontal-t.lineWidth,paddingInlineSM:8-t.lineWidth,onlyIconSize:t.fontSizeLG,onlyIconSizeSM:t.fontSizeLG-2,onlyIconSizeLG:t.fontSizeLG+2,groupBorderColor:t.colorPrimaryHover,linkHoverBg:"transparent",textHoverBg:t.colorBgTextHover,defaultColor:t.colorText,defaultBg:t.colorBgContainer,defaultBorderColor:t.colorBorder,defaultBorderColorDisabled:t.colorBorder,defaultHoverBg:t.colorBgContainer,defaultHoverColor:t.colorPrimaryHover,defaultHoverBorderColor:t.colorPrimaryHover,defaultActiveBg:t.colorBgContainer,defaultActiveColor:t.colorPrimaryActive,defaultActiveBorderColor:t.colorPrimaryActive,contentFontSize:l,contentFontSizeSM:s,contentFontSizeLG:c,contentLineHeight:u,contentLineHeightSM:d,contentLineHeightLG:f,paddingBlock:Math.max((t.controlHeight-l*u)/2-t.lineWidth,0),paddingBlockSM:Math.max((t.controlHeightSM-s*d)/2-t.lineWidth,0),paddingBlockLG:Math.max((t.controlHeightLG-c*f)/2-t.lineWidth,0)}},gHt=t=>{const{componentCls:e,iconCls:n,fontWeight:o}=t;return{[e]:{outline:"none",position:"relative",display:"inline-block",fontWeight:o,whiteSpace:"nowrap",textAlign:"center",backgroundImage:"none",background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,cursor:"pointer",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,userSelect:"none",touchAction:"manipulation",color:t.colorText,"&:disabled > *":{pointerEvents:"none"},"> span":{display:"inline-block"},[`${e}-icon`]:{lineHeight:0,"&-end":{marginInlineStart:t.marginXS}},[`> ${n} + span, > span + ${n}`]:{marginInlineStart:t.marginXS},[`&:not(${e}-icon-only) > ${e}-icon`]:{[`&${e}-loading-icon, &:not(:last-child)`]:{marginInlineEnd:t.marginXS},[`&${e}-loading-icon-end`]:{marginInlineStart:t.marginXS}},"> a":{color:"currentColor"},"&:not(:disabled)":Object.assign({},eA(t)),[`&${e}-two-chinese-chars::first-letter`]:{letterSpacing:"0.34em"},[`&${e}-two-chinese-chars > *:not(${n})`]:{marginInlineEnd:"-0.34em",letterSpacing:"0.34em"},[`&-icon-only${e}-compact-item`]:{flex:"none"}}}},tA=(t,e,n)=>({[`&:not(:disabled):not(${t}-disabled)`]:{"&:hover":e,"&:active":n}}),mHt=t=>({minWidth:t.controlHeight,paddingInlineStart:0,paddingInlineEnd:0,borderRadius:"50%"}),yHt=t=>({borderRadius:t.controlHeight,paddingInlineStart:t.calc(t.controlHeight).div(2).equal(),paddingInlineEnd:t.calc(t.controlHeight).div(2).equal()}),AHt=t=>({cursor:"not-allowed",borderColor:t.borderColorDisabled,color:t.colorTextDisabled,background:t.colorBgContainerDisabled,boxShadow:"none"}),lk=(t,e,n,o,r,i,a,l)=>({[`&${t}-background-ghost`]:Object.assign(Object.assign({color:n||void 0,background:e,borderColor:o||void 0,boxShadow:"none"},tA(t,Object.assign({background:e},a),Object.assign({background:e},l))),{"&:disabled":{cursor:"not-allowed",color:r||void 0,borderColor:i||void 0}})}),Ime=t=>({[`&:disabled, &${t.componentCls}-disabled`]:Object.assign({},AHt(t))}),N_e=t=>Object.assign({},Ime(t)),WG=t=>({[`&:disabled, &${t.componentCls}-disabled`]:{cursor:"not-allowed",color:t.colorTextDisabled}}),U_e=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N_e(t)),{background:t.defaultBg,borderColor:t.defaultBorderColor,color:t.defaultColor,boxShadow:t.defaultShadow}),tA(t.componentCls,{color:t.defaultHoverColor,borderColor:t.defaultHoverBorderColor,background:t.defaultHoverBg},{color:t.defaultActiveColor,borderColor:t.defaultActiveBorderColor,background:t.defaultActiveBg})),lk(t.componentCls,t.ghostBg,t.defaultGhostColor,t.defaultGhostBorderColor,t.colorTextDisabled,t.colorBorder)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign(Object.assign({color:t.colorError,borderColor:t.colorError},tA(t.componentCls,{color:t.colorErrorHover,borderColor:t.colorErrorBorderHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),lk(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder)),Ime(t))}),wHt=t=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},N_e(t)),{color:t.primaryColor,background:t.colorPrimary,boxShadow:t.primaryShadow}),tA(t.componentCls,{color:t.colorTextLightSolid,background:t.colorPrimaryHover},{color:t.colorTextLightSolid,background:t.colorPrimaryActive})),lk(t.componentCls,t.ghostBg,t.colorPrimary,t.colorPrimary,t.colorTextDisabled,t.colorBorder,{color:t.colorPrimaryHover,borderColor:t.colorPrimaryHover},{color:t.colorPrimaryActive,borderColor:t.colorPrimaryActive})),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign(Object.assign({background:t.colorError,boxShadow:t.dangerShadow,color:t.dangerColor},tA(t.componentCls,{background:t.colorErrorHover},{background:t.colorErrorActive})),lk(t.componentCls,t.ghostBg,t.colorError,t.colorError,t.colorTextDisabled,t.colorBorder,{color:t.colorErrorHover,borderColor:t.colorErrorHover},{color:t.colorErrorActive,borderColor:t.colorErrorActive})),Ime(t))}),vHt=t=>Object.assign(Object.assign({},U_e(t)),{borderStyle:"dashed"}),xHt=t=>Object.assign(Object.assign(Object.assign({color:t.colorLink},tA(t.componentCls,{color:t.colorLinkHover,background:t.linkHoverBg},{color:t.colorLinkActive})),WG(t)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign({color:t.colorError},tA(t.componentCls,{color:t.colorErrorHover},{color:t.colorErrorActive})),WG(t))}),bHt=t=>Object.assign(Object.assign(Object.assign({},tA(t.componentCls,{color:t.colorText,background:t.textHoverBg},{color:t.colorText,background:t.colorBgTextActive})),WG(t)),{[`&${t.componentCls}-dangerous`]:Object.assign(Object.assign({color:t.colorError},WG(t)),tA(t.componentCls,{color:t.colorErrorHover,background:t.colorErrorBg},{color:t.colorErrorHover,background:t.colorErrorBg}))}),SHt=t=>{const{componentCls:e}=t;return{[`${e}-default`]:U_e(t),[`${e}-primary`]:wHt(t),[`${e}-dashed`]:vHt(t),[`${e}-link`]:xHt(t),[`${e}-text`]:bHt(t),[`${e}-ghost`]:lk(t.componentCls,t.ghostBg,t.colorBgContainer,t.colorBgContainer,t.colorTextDisabled,t.colorBorder)}},zme=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const{componentCls:n,controlHeight:o,fontSize:r,lineHeight:i,borderRadius:a,buttonPaddingHorizontal:l,iconCls:s,buttonPaddingVertical:c}=t,u=`${n}-icon-only`;return[{[`${e}`]:{fontSize:r,lineHeight:i,height:o,padding:`${jt(c)} ${jt(l)}`,borderRadius:a,[`&${u}`]:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:o,paddingInlineStart:0,paddingInlineEnd:0,[`&${n}-round`]:{width:"auto"},[s]:{fontSize:t.buttonIconOnlyFontSize}},[`&${n}-loading`]:{opacity:t.opacityLoading,cursor:"default"},[`${n}-loading-icon`]:{transition:`width ${t.motionDurationSlow} ${t.motionEaseInOut}, opacity ${t.motionDurationSlow} ${t.motionEaseInOut}`}}},{[`${n}${n}-circle${e}`]:mHt(t)},{[`${n}${n}-round${e}`]:yHt(t)}]},THt=t=>{const e=qi(t,{fontSize:t.contentFontSize,lineHeight:t.contentLineHeight});return zme(e,t.componentCls)},PHt=t=>{const e=qi(t,{controlHeight:t.controlHeightSM,fontSize:t.contentFontSizeSM,lineHeight:t.contentLineHeightSM,padding:t.paddingXS,buttonPaddingHorizontal:t.paddingInlineSM,buttonPaddingVertical:t.paddingBlockSM,borderRadius:t.borderRadiusSM,buttonIconOnlyFontSize:t.onlyIconSizeSM});return zme(e,`${t.componentCls}-sm`)},CHt=t=>{const e=qi(t,{controlHeight:t.controlHeightLG,fontSize:t.contentFontSizeLG,lineHeight:t.contentLineHeightLG,buttonPaddingHorizontal:t.paddingInlineLG,buttonPaddingVertical:t.paddingBlockLG,borderRadius:t.borderRadiusLG,buttonIconOnlyFontSize:t.onlyIconSizeLG});return zme(e,`${t.componentCls}-lg`)},RHt=t=>{const{componentCls:e}=t;return{[e]:{[`&${e}-block`]:{width:"100%"}}}},HHt=wl("Button",t=>{const e=L_e(t);return[gHt(e),THt(e),PHt(e),CHt(e),RHt(e),SHt(e),pHt(e)]},W_e,{unitless:{fontWeight:!0,contentLineHeight:!0,contentLineHeightSM:!0,contentLineHeightLG:!0}});function MHt(t,e,n){const{focusElCls:o,focus:r,borderElCls:i}=n,a=i?"> *":"",l=["hover",r?"focus":null,"active"].filter(Boolean).map(s=>`&:${s} ${a}`).join(",");return{[`&-item:not(${e}-last-item)`]:{marginInlineEnd:t.calc(t.lineWidth).mul(-1).equal()},"&-item":Object.assign(Object.assign({[l]:{zIndex:2}},o?{[`&${o}`]:{zIndex:2}}:{}),{[`&[disabled] ${a}`]:{zIndex:0}})}}function IHt(t,e,n){const{borderElCls:o}=n,r=o?`> ${o}`:"";return{[`&-item:not(${e}-first-item):not(${e}-last-item) ${r}`]:{borderRadius:0},[`&-item:not(${e}-last-item)${e}-first-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&-item:not(${e}-first-item)${e}-last-item`]:{[`& ${r}, &${t}-sm ${r}, &${t}-lg ${r}`]:{borderStartStartRadius:0,borderEndStartRadius:0}}}}function jW(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{focus:!0};const{componentCls:n}=t,o=`${n}-compact`;return{[o]:Object.assign(Object.assign({},MHt(t,o,e)),IHt(n,o,e))}}function zHt(t,e){return{[`&-item:not(${e}-last-item)`]:{marginBottom:t.calc(t.lineWidth).mul(-1).equal()},"&-item":{"&:hover,&:focus,&:active":{zIndex:2},"&[disabled]":{zIndex:0}}}}function DHt(t,e){return{[`&-item:not(${e}-first-item):not(${e}-last-item)`]:{borderRadius:0},[`&-item${e}-first-item:not(${e}-last-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderEndEndRadius:0,borderEndStartRadius:0}},[`&-item${e}-last-item:not(${e}-first-item)`]:{[`&, &${t}-sm, &${t}-lg`]:{borderStartStartRadius:0,borderStartEndRadius:0}}}}function EHt(t){const e=`${t.componentCls}-compact-vertical`;return{[e]:Object.assign(Object.assign({},zHt(t,e)),DHt(t.componentCls,e))}}const FHt=t=>{const{componentCls:e,calc:n}=t;return{[e]:{[`&-compact-item${e}-primary`]:{[`&:not([disabled]) + ${e}-compact-item${e}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:n(t.lineWidth).mul(-1).equal(),insetInlineStart:n(t.lineWidth).mul(-1).equal(),display:"inline-block",width:t.lineWidth,height:`calc(100% + ${jt(t.lineWidth)} * 2)`,backgroundColor:t.colorPrimaryHover,content:'""'}}},"&-compact-vertical-item":{[`&${e}-primary`]:{[`&:not([disabled]) + ${e}-compact-vertical-item${e}-primary:not([disabled])`]:{position:"relative","&:before":{position:"absolute",top:n(t.lineWidth).mul(-1).equal(),insetInlineStart:n(t.lineWidth).mul(-1).equal(),display:"inline-block",width:`calc(100% + ${jt(t.lineWidth)} * 2)`,height:t.lineWidth,backgroundColor:t.colorPrimaryHover,content:'""'}}}}}}},kHt=LW(["Button","compact"],t=>{const e=L_e(t);return[jW(e),EHt(e),FHt(e)]},W_e);var LHt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r;const{loading:i=!1,prefixCls:a,type:l,danger:s,shape:c="default",size:u,styles:d,disabled:f,className:p,rootClassName:g,children:A,icon:y,iconPosition:S="start",ghost:C=!1,block:P=!1,htmlType:v="button",classNames:T,style:w={},autoInsertSpace:x}=t,b=LHt(t,["loading","prefixCls","type","danger","shape","size","styles","disabled","className","rootClassName","children","icon","iconPosition","ghost","block","htmlType","classNames","style","autoInsertSpace"]),R=l||"default",{getPrefixCls:H,direction:F,button:E}=m.useContext(Cr),N=(n=x??(E==null?void 0:E.autoInsertSpace))!==null&&n!==void 0?n:!0,U=H("btn",a),[W,k,D]=HHt(U),L=m.useContext(n1),j=f??L,B=m.useContext(E_e),O=m.useMemo(()=>WHt(i),[i]),[V,G]=m.useState(O.loading),[q,$]=m.useState(!1),Q=o5(e,m.createRef()),se=m.Children.count(A)===1&&!y&&!eie(R);m.useEffect(()=>{let ve=null;O.delay>0?ve=setTimeout(()=>{ve=null,G(!0)},O.delay):G(O.loading);function we(){ve&&(clearTimeout(ve),ve=null)}return we},[O]),m.useEffect(()=>{if(!Q||!Q.current||!N)return;const ve=Q.current.textContent;se&&k0e(ve)?q||$(!0):q&&$(!1)},[Q]);const oe=ve=>{const{onClick:we}=t;if(V||j){ve.preventDefault();return}we==null||we(ve)},{compactSize:Z,compactItemClassnames:te}=Yw(U,F),ee={large:"lg",small:"sm",middle:void 0},de=zd(ve=>{var we,Pe;return(Pe=(we=u??Z)!==null&&we!==void 0?we:B)!==null&&Pe!==void 0?Pe:ve}),fe=de&&ee[de]||"",pe=V?"loading":y,ye=dp(b,["navigate"]),ae=Un(U,k,D,{[`${U}-${c}`]:c!=="default"&&c,[`${U}-${R}`]:R,[`${U}-${fe}`]:fe,[`${U}-icon-only`]:!A&&A!==0&&!!pe,[`${U}-background-ghost`]:C&&!eie(R),[`${U}-loading`]:V,[`${U}-two-chinese-chars`]:q&&N&&!V,[`${U}-block`]:P,[`${U}-dangerous`]:!!s,[`${U}-rtl`]:F==="rtl"},te,p,g,E==null?void 0:E.className),Te=Object.assign(Object.assign({},E==null?void 0:E.style),w),ge=S==="end"&&A&&A!==0&&pe,Se=Un(T==null?void 0:T.icon,(o=E==null?void 0:E.classNames)===null||o===void 0?void 0:o.icon,{[`${U}-icon-end`]:ge}),Re=Object.assign(Object.assign({},(d==null?void 0:d.icon)||{}),((r=E==null?void 0:E.styles)===null||r===void 0?void 0:r.icon)||{}),De=y&&!V?be.createElement(k_e,{prefixCls:U,className:Se,style:Re},y):be.createElement(hHt,{existIcon:!!y,prefixCls:U,loading:!!V,iconPosition:S}),Ae=A||A===0?fHt(A,se&&N):null,ue=(ve,we)=>{const Pe=F==="rtl",Ie=S==="start"&&!Pe||S==="end"&&Pe;return be.createElement(be.Fragment,null,Ie?ve:we,Ie?we:ve)};if(ye.href!==void 0)return W(be.createElement("a",Object.assign({},ye,{className:Un(ae,{[`${U}-disabled`]:j}),href:j?void 0:ye.href,style:Te,onClick:oe,ref:Q,tabIndex:j?-1:0}),ue(De,Ae)));let he=be.createElement("button",Object.assign({},b,{type:v,className:ae,style:Te,onClick:oe,disabled:j,ref:Q}),ue(De,Ae),!!te&&be.createElement(kHt,{key:"compact",prefixCls:U}));return eie(R)||(he=be.createElement(UW,{component:"Button",disabled:!!V},he)),W(he)}),io=NHt;io.Group=uHt;io.__ANT_BUTTON=!0;function j7e(t){return!!(t&&t.then)}const j_e=t=>{const{type:e,children:n,prefixCls:o,buttonProps:r,close:i,autoFocus:a,emitEvent:l,isSilent:s,quitOnNullishReturnValue:c,actionFn:u}=t,d=m.useRef(!1),f=m.useRef(null),[p,g]=S0e(!1),A=function(){i==null||i.apply(void 0,arguments)};m.useEffect(()=>{let C=null;return a&&(C=setTimeout(()=>{var P;(P=f.current)===null||P===void 0||P.focus()})),()=>{C&&clearTimeout(C)}},[]);const y=C=>{j7e(C)&&(g(!0),C.then(function(){g(!1,!0),A.apply(void 0,arguments),d.current=!1},P=>{if(g(!1,!0),d.current=!1,!(s!=null&&s()))return Promise.reject(P)}))},S=C=>{if(d.current)return;if(d.current=!0,!u){A();return}let P;if(l){if(P=u(C),c&&!j7e(P)){d.current=!1,A(C);return}}else if(u.length)P=u(i),d.current=!1;else if(P=u(),!P){A();return}y(P)};return m.createElement(io,Object.assign({},F_e(e),{onClick:S,loading:p,prefixCls:o},r,{ref:f}),n)},BW=be.createContext({}),{Provider:B_e}=BW,B7e=()=>{const{autoFocusButton:t,cancelButtonProps:e,cancelTextLocale:n,isSilent:o,mergedOkCancel:r,rootPrefixCls:i,close:a,onCancel:l,onConfirm:s}=m.useContext(BW);return r?be.createElement(j_e,{isSilent:o,actionFn:l,close:function(){a==null||a.apply(void 0,arguments),s==null||s(!1)},autoFocus:t==="cancel",buttonProps:e,prefixCls:`${i}-btn`},n):null},Y7e=()=>{const{autoFocusButton:t,close:e,isSilent:n,okButtonProps:o,rootPrefixCls:r,okTextLocale:i,okType:a,onConfirm:l,onOk:s}=m.useContext(BW);return be.createElement(j_e,{isSilent:n,type:a||"primary",actionFn:s,close:function(){e==null||e.apply(void 0,arguments),l==null||l(!0)},autoFocus:t==="ok",buttonProps:o,prefixCls:`${r}-btn`},i)};var Y_e=m.createContext(null),O7e=[];function UHt(t,e){var n=m.useState(function(){if(!fp())return null;var g=document.createElement("div");return g}),o=sn(n,1),r=o[0],i=m.useRef(!1),a=m.useContext(Y_e),l=m.useState(O7e),s=sn(l,2),c=s[0],u=s[1],d=a||(i.current?void 0:function(g){u(function(A){var y=[g].concat(No(A));return y})});function f(){r.parentElement||document.body.appendChild(r),i.current=!0}function p(){var g;(g=r.parentElement)===null||g===void 0||g.removeChild(r),i.current=!1}return _a(function(){return t?a?a(f):f():p(),p},[t]),_a(function(){c.length&&(c.forEach(function(g){return g()}),u(O7e))},[c]),[r,d]}var oie;function L0e(t){if(typeof document>"u")return 0;if(oie===void 0){var e=document.createElement("div");e.style.width="100%",e.style.height="200px";var n=document.createElement("div"),o=n.style;o.position="absolute",o.top="0",o.left="0",o.pointerEvents="none",o.visibility="hidden",o.width="200px",o.height="150px",o.overflow="hidden",n.appendChild(e),document.body.appendChild(n);var r=e.offsetWidth;n.style.overflow="scroll";var i=e.offsetWidth;r===i&&(i=n.clientWidth),document.body.removeChild(n),oie=r-i}return oie}function V7e(t){var e=t.match(/^(.*)px$/),n=Number(e==null?void 0:e[1]);return Number.isNaN(n)?L0e():n}function W0e(t){if(typeof document>"u"||!t||!(t instanceof Element))return{width:0,height:0};var e=getComputedStyle(t,"::-webkit-scrollbar"),n=e.width,o=e.height;return{width:V7e(n),height:V7e(o)}}function jHt(){return document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth}var BHt="rc-util-locker-".concat(Date.now()),_7e=0;function YHt(t){var e=!!t,n=m.useState(function(){return _7e+=1,"".concat(BHt,"_").concat(_7e)}),o=sn(n,1),r=o[0];_a(function(){if(e){var i=W0e(document.body).width,a=jHt();mx(` html body { overflow-y: hidden; `.concat(a?"width: calc(100% - ".concat(i,"px);"):"",` -}`),r)}else HG(r);return function(){HG(r)}},[e,r])}var OHt=!1;function VHt(t){return OHt}var G7e=function(e){return e===!1?!1:!fp()||!e?null:typeof e=="string"?document.querySelector(e):typeof e=="function"?e():e},B$=m.forwardRef(function(t,e){var n=t.open,o=t.autoLock,r=t.getContainer;t.debug;var i=t.autoDestroy,a=i===void 0?!0:i,l=t.children,s=m.useState(n),c=sn(s,2),u=c[0],d=c[1],f=u||n;m.useEffect(function(){(a||n)&&d(n)},[n,a]);var p=m.useState(function(){return G7e(r)}),g=sn(p,2),A=g[0],y=g[1];m.useEffect(function(){var F=G7e(r);y(F??null)});var S=UHt(f&&!A),C=sn(S,2),P=C[0],v=C[1],T=A??P;YHt(o&&n&&fp()&&(T===P||T===document.body));var w=null;if(l&&sw(l)&&e){var x=l;w=x.ref}var b=Nw(w,e);if(!f||!fp()||A===void 0)return null;var R=T===!1||VHt(),H=l;return e&&(H=m.cloneElement(l,{ref:b})),m.createElement(Y_e.Provider,{value:v},R?H:Hd.createPortal(H,T))}),O_e=m.createContext({});function _Ht(){var t=en({},FK);return t.useId}var X7e=0,J7e=_Ht();const V_e=J7e?function(e){var n=J7e();return e||n}:function(e){var n=m.useState("ssr-id"),o=sn(n,2),r=o[0],i=o[1];return m.useEffect(function(){var a=X7e;X7e+=1,i("rc_unique_".concat(a))},[]),e||r};function K7e(t,e,n){var o=e;return!o&&n&&(o="".concat(t,"-").concat(n)),o}function q7e(t,e){var n=t["page".concat(e?"Y":"X","Offset")],o="scroll".concat(e?"Top":"Left");if(typeof n!="number"){var r=t.document;n=r.documentElement[o],typeof n!="number"&&(n=r.body[o])}return n}function GHt(t){var e=t.getBoundingClientRect(),n={left:e.left,top:e.top},o=t.ownerDocument,r=o.defaultView||o.parentWindow;return n.left+=q7e(r),n.top+=q7e(r,!0),n}const XHt=m.memo(function(t){var e=t.children;return e},function(t,e){var n=e.shouldUpdate;return!n});var $7e={width:0,height:0,overflow:"hidden",outline:"none"},JHt={outline:"none"},__e=be.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.title,a=t.ariaId,l=t.footer,s=t.closable,c=t.closeIcon,u=t.onClose,d=t.children,f=t.bodyStyle,p=t.bodyProps,g=t.modalRender,A=t.onMouseDown,y=t.onMouseUp,S=t.holderRef,C=t.visible,P=t.forceRender,v=t.width,T=t.height,w=t.classNames,x=t.styles,b=be.useContext(O_e),R=b.panel,H=Nw(S,R),F=m.useRef(),E=m.useRef(),N=m.useRef();be.useImperativeHandle(e,function(){return{focus:function(){var V;(V=N.current)===null||V===void 0||V.focus()},changeActive:function(V){var G=document,q=G.activeElement;V&&q===E.current?F.current.focus():!V&&q===F.current&&E.current.focus()}}});var U={};v!==void 0&&(U.width=v),T!==void 0&&(U.height=T);var W;l&&(W=be.createElement("div",{className:Xn("".concat(n,"-footer"),w==null?void 0:w.footer),style:en({},x==null?void 0:x.footer)},l));var k;i&&(k=be.createElement("div",{className:Xn("".concat(n,"-header"),w==null?void 0:w.header),style:en({},x==null?void 0:x.header)},be.createElement("div",{className:"".concat(n,"-title"),id:a},i)));var D=m.useMemo(function(){return hi(s)==="object"&&s!==null?s:s?{closeIcon:c??be.createElement("span",{className:"".concat(n,"-close-x")})}:{}},[s,c]),L=bf(D,!0),j;s&&(j=be.createElement("button",go({type:"button",onClick:u,"aria-label":"Close"},L,{className:"".concat(n,"-close")}),D.closeIcon));var B=be.createElement("div",{className:Xn("".concat(n,"-content"),w==null?void 0:w.content),style:x==null?void 0:x.content},j,k,be.createElement("div",go({className:Xn("".concat(n,"-body"),w==null?void 0:w.body),style:en(en({},f),x==null?void 0:x.body)},p),d),W);return be.createElement("div",{key:"dialog-element",role:"dialog","aria-labelledby":i?a:null,"aria-modal":"true",ref:H,style:en(en({},r),U),className:Xn(n,o),onMouseDown:A,onMouseUp:y},be.createElement("div",{tabIndex:0,ref:F,style:$7e,"aria-hidden":"true"}),be.createElement("div",{ref:N,tabIndex:-1,style:JHt},be.createElement(XHt,{shouldUpdate:C||P},g?g(B):B)),be.createElement("div",{tabIndex:0,ref:E,style:$7e,"aria-hidden":"true"}))}),G_e=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.title,r=t.style,i=t.className,a=t.visible,l=t.forceRender,s=t.destroyOnClose,c=t.motionName,u=t.ariaId,d=t.onVisibleChanged,f=t.mousePosition,p=m.useRef(),g=m.useState(),A=sn(g,2),y=A[0],S=A[1],C={};y&&(C.transformOrigin=y);function P(){var v=GHt(p.current);S(f?"".concat(f.x-v.left,"px ").concat(f.y-v.top,"px"):"")}return m.createElement(o1,{visible:a,onVisibleChanged:d,onAppearPrepare:P,onEnterPrepare:P,forceRender:l,motionName:c,removeOnLeave:s,ref:p},function(v,T){var w=v.className,x=v.style;return m.createElement(__e,go({},t,{ref:e,title:o,ariaId:u,prefixCls:n,holderRef:T,style:en(en(en({},x),r),C),className:Xn(i,w)}))})});G_e.displayName="Content";function KHt(t){var e=t.prefixCls,n=t.style,o=t.visible,r=t.maskProps,i=t.motionName,a=t.className;return m.createElement(o1,{key:"mask",visible:o,motionName:i,leavedClassName:"".concat(e,"-mask-hidden")},function(l,s){var c=l.className,u=l.style;return m.createElement("div",go({ref:s,style:en(en({},u),n),className:Xn("".concat(e,"-mask"),c,a)},r))})}function qHt(t){var e=t.prefixCls,n=e===void 0?"rc-dialog":e,o=t.zIndex,r=t.visible,i=r===void 0?!1:r,a=t.keyboard,l=a===void 0?!0:a,s=t.focusTriggerAfterClose,c=s===void 0?!0:s,u=t.wrapStyle,d=t.wrapClassName,f=t.wrapProps,p=t.onClose,g=t.afterOpenChange,A=t.afterClose,y=t.transitionName,S=t.animation,C=t.closable,P=C===void 0?!0:C,v=t.mask,T=v===void 0?!0:v,w=t.maskTransitionName,x=t.maskAnimation,b=t.maskClosable,R=b===void 0?!0:b,H=t.maskStyle,F=t.maskProps,E=t.rootClassName,N=t.classNames,U=t.styles,W=m.useRef(),k=m.useRef(),D=m.useRef(),L=m.useState(i),j=sn(L,2),B=j[0],O=j[1],V=V_e();function G(){a0e(k.current,document.activeElement)||(W.current=document.activeElement)}function q(){if(!a0e(k.current,document.activeElement)){var de;(de=D.current)===null||de===void 0||de.focus()}}function $(de){if(de)q();else{if(O(!1),T&&W.current&&c){try{W.current.focus({preventScroll:!0})}catch{}W.current=null}B&&(A==null||A())}g==null||g(de)}function ie(de){p==null||p(de)}var Q=m.useRef(!1),se=m.useRef(),Z=function(){clearTimeout(se.current),Q.current=!0},ee=function(){se.current=setTimeout(function(){Q.current=!1})},te=null;R&&(te=function(he){Q.current?Q.current=!1:k.current===he.target&&ie(he)});function oe(de){if(l&&de.keyCode===jn.ESC){de.stopPropagation(),ie(de);return}i&&de.keyCode===jn.TAB&&D.current.changeActive(!de.shiftKey)}return m.useEffect(function(){i&&(O(!0),G())},[i]),m.useEffect(function(){return function(){clearTimeout(se.current)}},[]),m.createElement("div",go({className:Xn("".concat(n,"-root"),E)},bf(t,{data:!0})),m.createElement(KHt,{prefixCls:n,visible:T&&i,motionName:K7e(n,w,x),style:en(en({zIndex:o},H),U==null?void 0:U.mask),maskProps:F,className:N==null?void 0:N.mask}),m.createElement("div",go({tabIndex:-1,onKeyDown:oe,className:Xn("".concat(n,"-wrap"),d,N==null?void 0:N.wrapper),ref:k,onClick:te,style:en(en(en({zIndex:o},u),U==null?void 0:U.wrapper),{},{display:B?null:"none"})},f),m.createElement(G_e,go({},t,{onMouseDown:Z,onMouseUp:ee,ref:D,closable:P,ariaId:V,prefixCls:n,visible:i&&B,onClose:ie,onVisibleChanged:$,motionName:K7e(n,y,S)}))))}var X_e=function(e){var n=e.visible,o=e.getContainer,r=e.forceRender,i=e.destroyOnClose,a=i===void 0?!1:i,l=e.afterClose,s=e.panelRef,c=m.useState(n),u=sn(c,2),d=u[0],f=u[1],p=m.useMemo(function(){return{panel:s}},[s]);return m.useEffect(function(){n&&f(!0)},[n]),!r&&a&&!d?null:m.createElement(O_e.Provider,{value:p},m.createElement(B$,{open:n||r||d,autoDestroy:!1,getContainer:o,autoLock:n||d},m.createElement(qHt,go({},e,{destroyOnClose:a,afterClose:function(){l==null||l(),f(!1)}}))))};X_e.displayName="Dialog";function AR(t){if(t)return{closable:t.closable,closeIcon:t.closeIcon}}function Q7e(t){const{closable:e,closeIcon:n}=t||{};return be.useMemo(()=>{if(!e&&(e===!1||n===!1||n===null))return!1;if(e===void 0&&n===void 0)return null;let o={closeIcon:typeof n!="boolean"&&n!==null?n:void 0};return e&&typeof e=="object"&&(o=Object.assign(Object.assign({},o),e)),o},[e,n])}function Z7e(){const t={};for(var e=arguments.length,n=new Array(e),o=0;o{r&&Object.keys(r).forEach(i=>{r[i]!==void 0&&(t[i]=r[i])})}),t}const $Ht={};function Dme(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$Ht;const o=Q7e(t),r=Q7e(e),i=be.useMemo(()=>Object.assign({closeIcon:be.createElement(jw,null)},n),[n]),a=be.useMemo(()=>o===!1?!1:o?Z7e(i,r,o):r===!1?!1:r?Z7e(i,r):i.closable?i:!1,[o,r,i]);return be.useMemo(()=>{if(a===!1)return[!1,null];const{closeIconRender:l}=i,{closeIcon:s}=a;let c=s;if(c!=null){l&&(c=l(s));const u=Pme(a,!0);Object.keys(u).length&&(c=be.isValidElement(c)?be.cloneElement(c,u):be.createElement("span",Object.assign({},u),c))}return[!0,c]},[a,i])}var J_e=function(e){if(kW()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1},QHt=function(e,n){if(!J_e(e))return!1;var o=document.createElement("div"),r=o.style[e];return o.style[e]=n,o.style[e]!==r};function eve(t,e){return!Array.isArray(t)&&e!==void 0?QHt(t,e):J_e(t)}const ZHt=()=>kW()&&window.document.documentElement;function V2(){V2=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(k,D,L){k[D]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(k,D,L){return Object.defineProperty(k,D,{value:L,enumerable:!0,configurable:!0,writable:!0}),k[D]}try{c({},"")}catch{c=function(L,j,B){return L[j]=B}}function u(k,D,L,j){var B=D&&D.prototype instanceof S?D:S,O=Object.create(B.prototype),V=new U(j||[]);return r(O,"_invoke",{value:H(k,L,V)}),O}function d(k,D,L){try{return{type:"normal",arg:k.call(D,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",g="executing",A="completed",y={};function S(){}function C(){}function P(){}var v={};c(v,a,function(){return this});var T=Object.getPrototypeOf,w=T&&T(T(W([])));w&&w!==n&&o.call(w,a)&&(v=w);var x=P.prototype=S.prototype=Object.create(v);function b(k){["next","throw","return"].forEach(function(D){c(k,D,function(L){return this._invoke(D,L)})})}function R(k,D){function L(B,O,V,G){var q=d(k[B],k,O);if(q.type!=="throw"){var $=q.arg,ie=$.value;return ie&&hi(ie)=="object"&&o.call(ie,"__await")?D.resolve(ie.__await).then(function(Q){L("next",Q,V,G)},function(Q){L("throw",Q,V,G)}):D.resolve(ie).then(function(Q){$.value=Q,V($)},function(Q){return L("throw",Q,V,G)})}G(q.arg)}var j;r(this,"_invoke",{value:function(O,V){function G(){return new D(function(q,$){L(O,V,q,$)})}return j=j?j.then(G,G):G()}})}function H(k,D,L){var j=f;return function(B,O){if(j===g)throw new Error("Generator is already running");if(j===A){if(B==="throw")throw O;return{value:t,done:!0}}for(L.method=B,L.arg=O;;){var V=L.delegate;if(V){var G=F(V,L);if(G){if(G===y)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=A,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=g;var q=d(k,D,L);if(q.type==="normal"){if(j=L.done?A:p,q.arg===y)continue;return{value:q.arg,done:L.done}}q.type==="throw"&&(j=A,L.method="throw",L.arg=q.arg)}}}function F(k,D){var L=D.method,j=k.iterator[L];if(j===t)return D.delegate=null,L==="throw"&&k.iterator.return&&(D.method="return",D.arg=t,F(k,D),D.method==="throw")||L!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+L+"' method")),y;var B=d(j,k.iterator,D.arg);if(B.type==="throw")return D.method="throw",D.arg=B.arg,D.delegate=null,y;var O=B.arg;return O?O.done?(D[k.resultName]=O.value,D.next=k.nextLoc,D.method!=="return"&&(D.method="next",D.arg=t),D.delegate=null,y):O:(D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,y)}function E(k){var D={tryLoc:k[0]};1 in k&&(D.catchLoc=k[1]),2 in k&&(D.finallyLoc=k[2],D.afterLoc=k[3]),this.tryEntries.push(D)}function N(k){var D=k.completion||{};D.type="normal",delete D.arg,k.completion=D}function U(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(E,this),this.reset(!0)}function W(k){if(k||k===""){var D=k[a];if(D)return D.call(k);if(typeof k.next=="function")return k;if(!isNaN(k.length)){var L=-1,j=function B(){for(;++L=0;--B){var O=this.tryEntries[B],V=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),q=o.call(O,"finallyLoc");if(G&&q){if(this.prev=0;--j){var B=this.tryEntries[j];if(B.tryLoc<=this.prev&&o.call(B,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===D)return this.complete(j.completion,j.afterLoc),N(j),y}},catch:function(D){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===D){var B=j.completion;if(B.type==="throw"){var O=B.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(D,L,j){return this.delegate={iterator:W(D),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),y}},e}function tve(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function YW(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){tve(i,o,r,a,l,"next",s)}function l(s){tve(i,o,r,a,l,"throw",s)}a(void 0)})}}var Bv="RC_FORM_INTERNAL_HOOKS",vs=function(){U0(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},wR=m.createContext({getFieldValue:vs,getFieldsValue:vs,getFieldError:vs,getFieldWarning:vs,getFieldsError:vs,isFieldsTouched:vs,isFieldTouched:vs,isFieldValidating:vs,isFieldsValidating:vs,resetFields:vs,setFields:vs,setFieldValue:vs,setFieldsValue:vs,validateFields:vs,submit:vs,getInternalHooks:function(){return vs(),{dispatch:vs,initEntityValue:vs,registerField:vs,useSubscribe:vs,setInitialValues:vs,destroyForm:vs,setCallbacks:vs,registerWatch:vs,getFields:vs,setValidateMessages:vs,setPreserve:vs,getInitialValue:vs}}}),NG=m.createContext(null);function N0e(t){return t==null?[]:Array.isArray(t)?t:[t]}function eMt(t){return t&&!!t._init}function rp(t){"@babel/helpers - typeof";return rp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rp(t)}function tMt(t,e){if(rp(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(rp(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K_e(t){var e=tMt(t,"string");return rp(e)=="symbol"?e:e+""}function nA(t,e,n){return e=K_e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function K4(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n{if(!e&&(e===!1||n===!1||n===null))return!1;if(e===void 0&&n===void 0)return null;let o={closeIcon:typeof n!="boolean"&&n!==null?n:void 0};return e&&typeof e=="object"&&(o=Object.assign(Object.assign({},o),e)),o},[e,n])}function Z7e(){const t={};for(var e=arguments.length,n=new Array(e),o=0;o{r&&Object.keys(r).forEach(i=>{r[i]!==void 0&&(t[i]=r[i])})}),t}const $Ht={};function Dme(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$Ht;const o=Q7e(t),r=Q7e(e),i=be.useMemo(()=>Object.assign({closeIcon:be.createElement(jw,null)},n),[n]),a=be.useMemo(()=>o===!1?!1:o?Z7e(i,r,o):r===!1?!1:r?Z7e(i,r):i.closable?i:!1,[o,r,i]);return be.useMemo(()=>{if(a===!1)return[!1,null];const{closeIconRender:l}=i,{closeIcon:s}=a;let c=s;if(c!=null){l&&(c=l(s));const u=Pme(a,!0);Object.keys(u).length&&(c=be.isValidElement(c)?be.cloneElement(c,u):be.createElement("span",Object.assign({},u),c))}return[!0,c]},[a,i])}var J_e=function(e){if(kW()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1},QHt=function(e,n){if(!J_e(e))return!1;var o=document.createElement("div"),r=o.style[e];return o.style[e]=n,o.style[e]!==r};function eve(t,e){return!Array.isArray(t)&&e!==void 0?QHt(t,e):J_e(t)}const ZHt=()=>kW()&&window.document.documentElement;function V2(){V2=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(k,D,L){k[D]=L.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(k,D,L){return Object.defineProperty(k,D,{value:L,enumerable:!0,configurable:!0,writable:!0}),k[D]}try{c({},"")}catch{c=function(L,j,B){return L[j]=B}}function u(k,D,L,j){var B=D&&D.prototype instanceof S?D:S,O=Object.create(B.prototype),V=new U(j||[]);return r(O,"_invoke",{value:H(k,L,V)}),O}function d(k,D,L){try{return{type:"normal",arg:k.call(D,L)}}catch(j){return{type:"throw",arg:j}}}e.wrap=u;var f="suspendedStart",p="suspendedYield",g="executing",A="completed",y={};function S(){}function C(){}function P(){}var v={};c(v,a,function(){return this});var T=Object.getPrototypeOf,w=T&&T(T(W([])));w&&w!==n&&o.call(w,a)&&(v=w);var x=P.prototype=S.prototype=Object.create(v);function b(k){["next","throw","return"].forEach(function(D){c(k,D,function(L){return this._invoke(D,L)})})}function R(k,D){function L(B,O,V,G){var q=d(k[B],k,O);if(q.type!=="throw"){var $=q.arg,ie=$.value;return ie&&hi(ie)=="object"&&o.call(ie,"__await")?D.resolve(ie.__await).then(function(Q){L("next",Q,V,G)},function(Q){L("throw",Q,V,G)}):D.resolve(ie).then(function(Q){$.value=Q,V($)},function(Q){return L("throw",Q,V,G)})}G(q.arg)}var j;r(this,"_invoke",{value:function(O,V){function G(){return new D(function(q,$){L(O,V,q,$)})}return j=j?j.then(G,G):G()}})}function H(k,D,L){var j=f;return function(B,O){if(j===g)throw new Error("Generator is already running");if(j===A){if(B==="throw")throw O;return{value:t,done:!0}}for(L.method=B,L.arg=O;;){var V=L.delegate;if(V){var G=F(V,L);if(G){if(G===y)continue;return G}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(j===f)throw j=A,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);j=g;var q=d(k,D,L);if(q.type==="normal"){if(j=L.done?A:p,q.arg===y)continue;return{value:q.arg,done:L.done}}q.type==="throw"&&(j=A,L.method="throw",L.arg=q.arg)}}}function F(k,D){var L=D.method,j=k.iterator[L];if(j===t)return D.delegate=null,L==="throw"&&k.iterator.return&&(D.method="return",D.arg=t,F(k,D),D.method==="throw")||L!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+L+"' method")),y;var B=d(j,k.iterator,D.arg);if(B.type==="throw")return D.method="throw",D.arg=B.arg,D.delegate=null,y;var O=B.arg;return O?O.done?(D[k.resultName]=O.value,D.next=k.nextLoc,D.method!=="return"&&(D.method="next",D.arg=t),D.delegate=null,y):O:(D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,y)}function E(k){var D={tryLoc:k[0]};1 in k&&(D.catchLoc=k[1]),2 in k&&(D.finallyLoc=k[2],D.afterLoc=k[3]),this.tryEntries.push(D)}function N(k){var D=k.completion||{};D.type="normal",delete D.arg,k.completion=D}function U(k){this.tryEntries=[{tryLoc:"root"}],k.forEach(E,this),this.reset(!0)}function W(k){if(k||k===""){var D=k[a];if(D)return D.call(k);if(typeof k.next=="function")return k;if(!isNaN(k.length)){var L=-1,j=function B(){for(;++L=0;--B){var O=this.tryEntries[B],V=O.completion;if(O.tryLoc==="root")return j("end");if(O.tryLoc<=this.prev){var G=o.call(O,"catchLoc"),q=o.call(O,"finallyLoc");if(G&&q){if(this.prev=0;--j){var B=this.tryEntries[j];if(B.tryLoc<=this.prev&&o.call(B,"finallyLoc")&&this.prev=0;--L){var j=this.tryEntries[L];if(j.finallyLoc===D)return this.complete(j.completion,j.afterLoc),N(j),y}},catch:function(D){for(var L=this.tryEntries.length-1;L>=0;--L){var j=this.tryEntries[L];if(j.tryLoc===D){var B=j.completion;if(B.type==="throw"){var O=B.arg;N(j)}return O}}throw new Error("illegal catch attempt")},delegateYield:function(D,L,j){return this.delegate={iterator:W(D),resultName:L,nextLoc:j},this.method==="next"&&(this.arg=t),y}},e}function tve(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){n(c);return}l.done?e(s):Promise.resolve(s).then(o,r)}function YW(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){tve(i,o,r,a,l,"next",s)}function l(s){tve(i,o,r,a,l,"throw",s)}a(void 0)})}}var Bv="RC_FORM_INTERNAL_HOOKS",vs=function(){U0(!1,"Can not find FormContext. Please make sure you wrap Field under Form.")},wR=m.createContext({getFieldValue:vs,getFieldsValue:vs,getFieldError:vs,getFieldWarning:vs,getFieldsError:vs,isFieldsTouched:vs,isFieldTouched:vs,isFieldValidating:vs,isFieldsValidating:vs,resetFields:vs,setFields:vs,setFieldValue:vs,setFieldsValue:vs,validateFields:vs,submit:vs,getInternalHooks:function(){return vs(),{dispatch:vs,initEntityValue:vs,registerField:vs,useSubscribe:vs,setInitialValues:vs,destroyForm:vs,setCallbacks:vs,registerWatch:vs,getFields:vs,setValidateMessages:vs,setPreserve:vs,getInitialValue:vs}}}),NG=m.createContext(null);function N0e(t){return t==null?[]:Array.isArray(t)?t:[t]}function eMt(t){return t&&!!t._init}function rp(t){"@babel/helpers - typeof";return rp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rp(t)}function tMt(t,e){if(rp(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(rp(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K_e(t){var e=tMt(t,"string");return rp(e)=="symbol"?e:e+""}function nA(t,e,n){return e=K_e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function K4(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n1?e-1:0),o=1;o=i)return l;switch(l){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}break;default:return l}});return a}return t}function pMt(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function uu(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||pMt(e)&&typeof t=="string"&&!t)}function gMt(t,e,n){var o=[],r=0,i=t.length;function a(l){o.push.apply(o,oC(l||[])),r++,r===i&&n(o)}t.forEach(function(l){e(l,a)})}function ove(t,e,n){var o=0,r=t.length;function i(a){if(a&&a.length){n(a);return}var l=o;o=o+1,le.max?r.push(gg(i.messages[d].max,e.fullField,e.max)):l&&s&&(ue.max)&&r.push(gg(i.messages[d].range,e.fullField,e.min,e.max))},Q_e=function(e,n,o,r,i,a){e.required&&(!o.hasOwnProperty(e.field)||uu(n,a||e.type))&&r.push(gg(i.messages.required,e.fullField))},zY;const SMt=function(){if(zY)return zY;var t="[a-fA-F\\d:]",e=function(w){return w&&w.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(t,")(?=\\s|$))"):""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",o="[a-fA-F\\d]{1,4}",r=["(?:".concat(o,":){7}(?:").concat(o,"|:)"),"(?:".concat(o,":){6}(?:").concat(n,"|:").concat(o,"|:)"),"(?:".concat(o,":){5}(?::").concat(n,"|(?::").concat(o,"){1,2}|:)"),"(?:".concat(o,":){4}(?:(?::").concat(o,"){0,1}:").concat(n,"|(?::").concat(o,"){1,3}|:)"),"(?:".concat(o,":){3}(?:(?::").concat(o,"){0,2}:").concat(n,"|(?::").concat(o,"){1,4}|:)"),"(?:".concat(o,":){2}(?:(?::").concat(o,"){0,3}:").concat(n,"|(?::").concat(o,"){1,5}|:)"),"(?:".concat(o,":){1}(?:(?::").concat(o,"){0,4}:").concat(n,"|(?::").concat(o,"){1,6}|:)"),"(?::(?:(?::".concat(o,"){0,5}:").concat(n,"|(?::").concat(o,"){1,7}|:))")],i="(?:%[0-9a-zA-Z]{1,})?",a="(?:".concat(r.join("|"),")").concat(i),l=new RegExp("(?:^".concat(n,"$)|(?:^").concat(a,"$)")),s=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(a,"$")),u=function(w){return w&&w.exact?l:new RegExp("(?:".concat(e(w)).concat(n).concat(e(w),")|(?:").concat(e(w)).concat(a).concat(e(w),")"),"g")};u.v4=function(T){return T&&T.exact?s:new RegExp("".concat(e(T)).concat(n).concat(e(T)),"g")},u.v6=function(T){return T&&T.exact?c:new RegExp("".concat(e(T)).concat(a).concat(e(T)),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",p=u.v4().source,g=u.v6().source,A="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",y="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",S="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",C="(?::\\d{2,5})?",P='(?:[/?#][^\\s"]*)?',v="(?:".concat(d,"|www\\.)").concat(f,"(?:localhost|").concat(p,"|").concat(g,"|").concat(A).concat(y).concat(S,")").concat(C).concat(P);return zY=new RegExp("(?:^".concat(v,"$)"),"i"),zY};var lve={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},zD={integer:function(e){return zD.number(e)&&parseInt(e,10)===e},float:function(e){return zD.number(e)&&!zD.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return rp(e)==="object"&&!zD.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(lve.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(SMt())},hex:function(e){return typeof e=="string"&&!!e.match(lve.hex)}},TMt=function(e,n,o,r,i){if(e.required&&n===void 0){Q_e(e,n,o,r,i);return}var a=["integer","float","array","regexp","object","method","email","number","date","url","hex"],l=e.type;a.indexOf(l)>-1?zD[l](n)||r.push(gg(i.messages.types[l],e.fullField,e.type)):l&&rp(n)!==e.type&&r.push(gg(i.messages.types[l],e.fullField,e.type))},PMt=function(e,n,o,r,i){(/^\s+$/.test(n)||n==="")&&r.push(gg(i.messages.whitespace,e.fullField))};const el={required:Q_e,whitespace:PMt,type:TMt,range:bMt,enum:vMt,pattern:xMt};var CMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i)}o(a)},RMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n==null&&!e.required)return o();el.required(e,n,r,a,i,"array"),n!=null&&(el.type(e,n,r,a,i),el.range(e,n,r,a,i))}o(a)},HMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&el.type(e,n,r,a,i)}o(a)},MMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n,"date")&&!e.required)return o();if(el.required(e,n,r,a,i),!uu(n,"date")){var s;n instanceof Date?s=n:s=new Date(n),el.type(e,s,r,a,i),s&&el.range(e,s.getTime(),r,a,i)}}o(a)},IMt="enum",zMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&el[IMt](e,n,r,a,i)}o(a)},DMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&(el.type(e,n,r,a,i),el.range(e,n,r,a,i))}o(a)},EMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&(el.type(e,n,r,a,i),el.range(e,n,r,a,i))}o(a)},FMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&el.type(e,n,r,a,i)}o(a)},kMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(n===""&&(n=void 0),uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&(el.type(e,n,r,a,i),el.range(e,n,r,a,i))}o(a)},LMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),n!==void 0&&el.type(e,n,r,a,i)}o(a)},WMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n,"string")&&!e.required)return o();el.required(e,n,r,a,i),uu(n,"string")||el.pattern(e,n,r,a,i)}o(a)},NMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n)&&!e.required)return o();el.required(e,n,r,a,i),uu(n)||el.type(e,n,r,a,i)}o(a)},UMt=function(e,n,o,r,i){var a=[],l=Array.isArray(n)?"array":rp(n);el.required(e,n,r,a,i,l),o(a)},jMt=function(e,n,o,r,i){var a=[],l=e.required||!e.required&&r.hasOwnProperty(e.field);if(l){if(uu(n,"string")&&!e.required)return o();el.required(e,n,r,a,i,"string"),uu(n,"string")||(el.type(e,n,r,a,i),el.range(e,n,r,a,i),el.pattern(e,n,r,a,i),e.whitespace===!0&&el.whitespace(e,n,r,a,i))}o(a)},rie=function(e,n,o,r,i){var a=e.type,l=[],s=e.required||!e.required&&r.hasOwnProperty(e.field);if(s){if(uu(n,a)&&!e.required)return o();el.required(e,n,r,l,i,a),uu(n,a)||el.type(e,n,r,l,i)}o(l)};const PE={string:jMt,method:FMt,number:kMt,boolean:HMt,regexp:NMt,integer:EMt,float:DMt,array:RMt,object:LMt,enum:zMt,pattern:WMt,date:MMt,url:rie,hex:rie,email:rie,required:UMt,any:CMt};var OW=function(){function t(e){q_e(this,t),nA(this,"rules",null),nA(this,"_messages",B0e),this.define(e)}return $_e(t,[{key:"define",value:function(n){var o=this;if(!n)throw new Error("Cannot configure a schema with no rules");if(rp(n)!=="object"||Array.isArray(n))throw new Error("Rules must be an object");this.rules={},Object.keys(n).forEach(function(r){var i=n[r];o.rules[r]=Array.isArray(i)?i:[i]})}},{key:"messages",value:function(n){return n&&(this._messages=ave(j0e(),n)),this._messages}},{key:"validate",value:function(n){var o=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},a=n,l=r,s=i;if(typeof l=="function"&&(s=l,l={}),!this.rules||Object.keys(this.rules).length===0)return s&&s(null,a),Promise.resolve(a);function c(g){var A=[],y={};function S(P){if(Array.isArray(P)){var v;A=(v=A).concat.apply(v,oC(P))}else A.push(P)}for(var C=0;C0&&arguments[0]!==void 0?arguments[0]:[],b=Array.isArray(x)?x:[x];!l.suppressWarning&&b.length&&t.warning("async-validator:",b),b.length&&y.message!==void 0&&(b=[].concat(y.message));var R=b.map(ive(y,a));if(l.first&&R.length)return p[y.field]=1,A(R);if(!S)A(R);else{if(y.required&&!g.value)return y.message!==void 0?R=[].concat(y.message).map(ive(y,a)):l.error&&(R=[l.error(y,gg(l.messages.required,y.field))]),A(R);var H={};y.defaultField&&Object.keys(g.value).map(function(N){H[N]=y.defaultField}),H=K4(K4({},H),g.rule.fields);var F={};Object.keys(H).forEach(function(N){var U=H[N],W=Array.isArray(U)?U:[U];F[N]=W.map(C.bind(null,N))});var E=new t(F);E.messages(l.messages),g.rule.options&&(g.rule.options.messages=l.messages,g.rule.options.error=l.error),E.validate(g.value,g.rule.options||l,function(N){var U=[];R&&R.length&&U.push.apply(U,oC(R)),N&&N.length&&U.push.apply(U,oC(N)),A(U.length?U:null)})}}var v;if(y.asyncValidator)v=y.asyncValidator(y,g.value,P,g.source,l);else if(y.validator){try{v=y.validator(y,g.value,P,g.source,l)}catch(x){var T,w;(T=(w=console).error)===null||T===void 0||T.call(w,x),l.suppressValidatorError||setTimeout(function(){throw x},0),P(x.message)}v===!0?P():v===!1?P(typeof y.message=="function"?y.message(y.fullField||y.field):y.message||"".concat(y.fullField||y.field," fails")):v instanceof Array?P(v):v instanceof Error&&P(v.message)}v&&v.then&&v.then(function(){return P()},function(x){return P(x)})},function(g){c(g)},a)}},{key:"getType",value:function(n){if(n.type===void 0&&n.pattern instanceof RegExp&&(n.type="pattern"),typeof n.validator!="function"&&n.type&&!PE.hasOwnProperty(n.type))throw new Error(gg("Unknown rule type %s",n.type));return n.type||"string"}},{key:"getValidationMethod",value:function(n){if(typeof n.validator=="function")return n.validator;var o=Object.keys(n),r=o.indexOf("message");return r!==-1&&o.splice(r,1),o.length===1&&o[0]==="required"?PE.required:PE[this.getType(n)]||void 0}}]),t}();nA(OW,"register",function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");PE[e]=n});nA(OW,"warning",hMt);nA(OW,"messages",B0e);nA(OW,"validators",PE);var L1="'${name}' is not a valid ${type}",Z_e={default:"Validation error on field '${name}'",required:"'${name}' is required",enum:"'${name}' must be one of [${enum}]",whitespace:"'${name}' cannot be empty",date:{format:"'${name}' is invalid for format date",parse:"'${name}' could not be parsed as date",invalid:"'${name}' is invalid date"},types:{string:L1,method:L1,array:L1,object:L1,number:L1,date:L1,boolean:L1,integer:L1,float:L1,regexp:L1,email:L1,url:L1,hex:L1},string:{len:"'${name}' must be exactly ${len} characters",min:"'${name}' must be at least ${min} characters",max:"'${name}' cannot be longer than ${max} characters",range:"'${name}' must be between ${min} and ${max} characters"},number:{len:"'${name}' must equal ${len}",min:"'${name}' cannot be less than ${min}",max:"'${name}' cannot be greater than ${max}",range:"'${name}' must be between ${min} and ${max}"},array:{len:"'${name}' must be exactly ${len} in length",min:"'${name}' cannot be less than ${min} in length",max:"'${name}' cannot be greater than ${max} in length",range:"'${name}' must be between ${min} and ${max} in length"},pattern:{mismatch:"'${name}' does not match pattern ${pattern}"}};function eGe(t){return GOe(t)||JOe(t)||rme(t)||XOe()}function mg(t,e){for(var n=t,o=0;o3&&arguments[3]!==void 0?arguments[3]:!1;return e.length&&o&&n===void 0&&!mg(t,e.slice(0,-1))?t:tGe(t,e,n,o)}function BMt(t){return hi(t)==="object"&&t!==null&&Object.getPrototypeOf(t)===Object.prototype}function sve(t){return Array.isArray(t)?[]:{}}var YMt=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function DD(){for(var t=arguments.length,e=new Array(t),n=0;n2&&arguments[2]!==void 0?arguments[2]:!1;return t&&t.some(function(o){return nGe(e,o,n)})}function nGe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return!t||!e||!n&&t.length!==e.length?!1:e.every(function(o,r){return t[r]===o})}function XMt(t,e){if(t===e)return!0;if(!t&&e||t&&!e||!t||!e||hi(t)!=="object"||hi(e)!=="object")return!1;var n=Object.keys(t),o=Object.keys(e),r=new Set([].concat(n,o));return No(r).every(function(i){var a=t[i],l=e[i];return typeof a=="function"&&typeof l=="function"?!0:a===l})}function JMt(t){var e=arguments.length<=1?void 0:arguments[1];return e&&e.target&&hi(e.target)==="object"&&t in e.target?e.target[t]:e}function fve(t,e,n){var o=t.length;if(e<0||e>=o||n<0||n>=o)return t;var r=t[e],i=e-n;return i>0?[].concat(No(t.slice(0,n)),[r],No(t.slice(n,e)),No(t.slice(e+1,o))):i<0?[].concat(No(t.slice(0,e)),No(t.slice(e+1,n+1)),[r],No(t.slice(n+1,o))):t}var KMt=["name"],fm=[];function hve(t,e,n,o,r,i){return typeof t=="function"?t(e,n,"source"in i?{source:i.source}:{}):o!==r}var Fme=function(t){EW(n,t);var e=FW(n);function n(o){var r;if(wp(this,n),r=e.call(this,o),Jt(Pl(r),"state",{resetCount:0}),Jt(Pl(r),"cancelRegisterFunc",null),Jt(Pl(r),"mounted",!1),Jt(Pl(r),"touched",!1),Jt(Pl(r),"dirty",!1),Jt(Pl(r),"validatePromise",void 0),Jt(Pl(r),"prevValidating",void 0),Jt(Pl(r),"errors",fm),Jt(Pl(r),"warnings",fm),Jt(Pl(r),"cancelRegister",function(){var s=r.props,c=s.preserve,u=s.isListField,d=s.name;r.cancelRegisterFunc&&r.cancelRegisterFunc(u,c,z0(d)),r.cancelRegisterFunc=null}),Jt(Pl(r),"getNamePath",function(){var s=r.props,c=s.name,u=s.fieldContext,d=u.prefixName,f=d===void 0?[]:d;return c!==void 0?[].concat(No(f),No(c)):[]}),Jt(Pl(r),"getRules",function(){var s=r.props,c=s.rules,u=c===void 0?[]:c,d=s.fieldContext;return u.map(function(f){return typeof f=="function"?f(d):f})}),Jt(Pl(r),"refresh",function(){r.mounted&&r.setState(function(s){var c=s.resetCount;return{resetCount:c+1}})}),Jt(Pl(r),"metaCache",null),Jt(Pl(r),"triggerMetaEvent",function(s){var c=r.props.onMetaChange;if(c){var u=en(en({},r.getMeta()),{},{destroy:s});cw(r.metaCache,u)||c(u),r.metaCache=u}else r.metaCache=null}),Jt(Pl(r),"onStoreChange",function(s,c,u){var d=r.props,f=d.shouldUpdate,p=d.dependencies,g=p===void 0?[]:p,A=d.onReset,y=u.store,S=r.getNamePath(),C=r.getValue(s),P=r.getValue(y),v=c&&IC(c,S);switch(u.type==="valueUpdate"&&u.source==="external"&&!cw(C,P)&&(r.touched=!0,r.dirty=!0,r.validatePromise=null,r.errors=fm,r.warnings=fm,r.triggerMetaEvent()),u.type){case"reset":if(!c||v){r.touched=!1,r.dirty=!1,r.validatePromise=void 0,r.errors=fm,r.warnings=fm,r.triggerMetaEvent(),A==null||A(),r.refresh();return}break;case"remove":{if(f){r.reRender();return}break}case"setField":{var T=u.data;if(v){"touched"in T&&(r.touched=T.touched),"validating"in T&&!("originRCField"in T)&&(r.validatePromise=T.validating?Promise.resolve([]):null),"errors"in T&&(r.errors=T.errors||fm),"warnings"in T&&(r.warnings=T.warnings||fm),r.dirty=!0,r.triggerMetaEvent(),r.reRender();return}else if("value"in T&&IC(c,S,!0)){r.reRender();return}if(f&&!S.length&&hve(f,s,y,C,P,u)){r.reRender();return}break}case"dependenciesUpdate":{var w=g.map(z0);if(w.some(function(x){return IC(u.relatedFields,x)})){r.reRender();return}break}default:if(v||(!g.length||S.length||f)&&hve(f,s,y,C,P,u)){r.reRender();return}break}f===!0&&r.reRender()}),Jt(Pl(r),"validateRules",function(s){var c=r.getNamePath(),u=r.getValue(),d=s||{},f=d.triggerName,p=d.validateOnly,g=p===void 0?!1:p,A=Promise.resolve().then(YW(V2().mark(function y(){var S,C,P,v,T,w,x;return V2().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(r.mounted){R.next=2;break}return R.abrupt("return",[]);case 2:if(S=r.props,C=S.validateFirst,P=C===void 0?!1:C,v=S.messageVariables,T=S.validateDebounce,w=r.getRules(),f&&(w=w.filter(function(H){return H}).filter(function(H){var F=H.validateTrigger;if(!F)return!0;var E=N0e(F);return E.includes(f)})),!(T&&f)){R.next=10;break}return R.next=8,new Promise(function(H){setTimeout(H,T)});case 8:if(r.validatePromise===A){R.next=10;break}return R.abrupt("return",[]);case 10:return x=VMt(c,u,w,s,P,v),x.catch(function(H){return H}).then(function(){var H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fm;if(r.validatePromise===A){var F;r.validatePromise=null;var E=[],N=[];(F=H.forEach)===null||F===void 0||F.call(H,function(U){var W=U.rule.warningOnly,k=U.errors,D=k===void 0?fm:k;W?N.push.apply(N,No(D)):E.push.apply(E,No(D))}),r.errors=E,r.warnings=N,r.triggerMetaEvent(),r.reRender()}}),R.abrupt("return",x);case 13:case"end":return R.stop()}},y)})));return g||(r.validatePromise=A,r.dirty=!0,r.errors=fm,r.warnings=fm,r.triggerMetaEvent(),r.reRender()),A}),Jt(Pl(r),"isFieldValidating",function(){return!!r.validatePromise}),Jt(Pl(r),"isFieldTouched",function(){return r.touched}),Jt(Pl(r),"isFieldDirty",function(){if(r.dirty||r.props.initialValue!==void 0)return!0;var s=r.props.fieldContext,c=s.getInternalHooks(Bv),u=c.getInitialValue;return u(r.getNamePath())!==void 0}),Jt(Pl(r),"getErrors",function(){return r.errors}),Jt(Pl(r),"getWarnings",function(){return r.warnings}),Jt(Pl(r),"isListField",function(){return r.props.isListField}),Jt(Pl(r),"isList",function(){return r.props.isList}),Jt(Pl(r),"isPreserve",function(){return r.props.preserve}),Jt(Pl(r),"getMeta",function(){r.prevValidating=r.isFieldValidating();var s={touched:r.isFieldTouched(),validating:r.prevValidating,errors:r.errors,warnings:r.warnings,name:r.getNamePath(),validated:r.validatePromise===null};return s}),Jt(Pl(r),"getOnlyChild",function(s){if(typeof s=="function"){var c=r.getMeta();return en(en({},r.getOnlyChild(s(r.getControlled(),c,r.props.fieldContext))),{},{isFunction:!0})}var u=lw(s);return u.length!==1||!m.isValidElement(u[0])?{child:u,isFunction:!1}:{child:u[0],isFunction:!1}}),Jt(Pl(r),"getValue",function(s){var c=r.props.fieldContext.getFieldsValue,u=r.getNamePath();return mg(s||c(!0),u)}),Jt(Pl(r),"getControlled",function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},c=r.props,u=c.name,d=c.trigger,f=c.validateTrigger,p=c.getValueFromEvent,g=c.normalize,A=c.valuePropName,y=c.getValueProps,S=c.fieldContext,C=f!==void 0?f:S.validateTrigger,P=r.getNamePath(),v=S.getInternalHooks,T=S.getFieldsValue,w=v(Bv),x=w.dispatch,b=r.getValue(),R=y||function(U){return Jt({},A,U)},H=s[d],F=u!==void 0?R(b):{},E=en(en({},s),F);E[d]=function(){r.touched=!0,r.dirty=!0,r.triggerMetaEvent();for(var U,W=arguments.length,k=new Array(W),D=0;D=0&&H<=F.length?(u.keys=[].concat(No(u.keys.slice(0,H)),[u.id],No(u.keys.slice(H))),P([].concat(No(F.slice(0,H)),[R],No(F.slice(H))))):(u.keys=[].concat(No(u.keys),[u.id]),P([].concat(No(F),[R]))),u.id+=1},remove:function(R){var H=T(),F=new Set(Array.isArray(R)?R:[R]);F.size<=0||(u.keys=u.keys.filter(function(E,N){return!F.has(N)}),P(H.filter(function(E,N){return!F.has(N)})))},move:function(R,H){if(R!==H){var F=T();R<0||R>=F.length||H<0||H>=F.length||(u.keys=fve(u.keys,R,H),P(fve(F,R,H)))}}},x=C||[];return Array.isArray(x)||(x=[]),o(x.map(function(b,R){var H=u.keys[R];return H===void 0&&(u.keys[R]=u.id,H=u.keys[R],u.id+=1),{name:R,key:H,isListField:!0}}),w,y)})))}function $Mt(t){var e=!1,n=t.length,o=[];return t.length?new Promise(function(r,i){t.forEach(function(a,l){a.catch(function(s){return e=!0,s}).then(function(s){n-=1,o[l]=s,!(n>0)&&(e&&i(o),r(o))})})}):Promise.resolve([])}var rGe="__@field_split__";function iie(t){return t.map(function(e){return"".concat(hi(e),":").concat(e)}).join(rGe)}var ET=function(){function t(){wp(this,t),Jt(this,"kvs",new Map)}return vp(t,[{key:"set",value:function(n,o){this.kvs.set(iie(n),o)}},{key:"get",value:function(n){return this.kvs.get(iie(n))}},{key:"update",value:function(n,o){var r=this.get(n),i=o(r);i?this.set(n,i):this.delete(n)}},{key:"delete",value:function(n){this.kvs.delete(iie(n))}},{key:"map",value:function(n){return No(this.kvs.entries()).map(function(o){var r=sn(o,2),i=r[0],a=r[1],l=i.split(rGe);return n({key:l.map(function(s){var c=s.match(/^([^:]*):(.*)$/),u=sn(c,3),d=u[1],f=u[2];return d==="number"?Number(f):f}),value:a})})}},{key:"toJSON",value:function(){var n={};return this.map(function(o){var r=o.key,i=o.value;return n[r.join(".")]=i,null}),n}}]),t}(),QMt=["name"],ZMt=vp(function t(e){var n=this;wp(this,t),Jt(this,"formHooked",!1),Jt(this,"forceRootUpdate",void 0),Jt(this,"subscribable",!0),Jt(this,"store",{}),Jt(this,"fieldEntities",[]),Jt(this,"initialValues",{}),Jt(this,"callbacks",{}),Jt(this,"validateMessages",null),Jt(this,"preserve",null),Jt(this,"lastValidatePromise",null),Jt(this,"getForm",function(){return{getFieldValue:n.getFieldValue,getFieldsValue:n.getFieldsValue,getFieldError:n.getFieldError,getFieldWarning:n.getFieldWarning,getFieldsError:n.getFieldsError,isFieldsTouched:n.isFieldsTouched,isFieldTouched:n.isFieldTouched,isFieldValidating:n.isFieldValidating,isFieldsValidating:n.isFieldsValidating,resetFields:n.resetFields,setFields:n.setFields,setFieldValue:n.setFieldValue,setFieldsValue:n.setFieldsValue,validateFields:n.validateFields,submit:n.submit,_init:!0,getInternalHooks:n.getInternalHooks}}),Jt(this,"getInternalHooks",function(o){return o===Bv?(n.formHooked=!0,{dispatch:n.dispatch,initEntityValue:n.initEntityValue,registerField:n.registerField,useSubscribe:n.useSubscribe,setInitialValues:n.setInitialValues,destroyForm:n.destroyForm,setCallbacks:n.setCallbacks,setValidateMessages:n.setValidateMessages,getFields:n.getFields,setPreserve:n.setPreserve,getInitialValue:n.getInitialValue,registerWatch:n.registerWatch}):(U0(!1,"`getInternalHooks` is internal usage. Should not call directly."),null)}),Jt(this,"useSubscribe",function(o){n.subscribable=o}),Jt(this,"prevWithoutPreserves",null),Jt(this,"setInitialValues",function(o,r){if(n.initialValues=o||{},r){var i,a=DD(o,n.store);(i=n.prevWithoutPreserves)===null||i===void 0||i.map(function(l){var s=l.key;a=d2(a,s,mg(o,s))}),n.prevWithoutPreserves=null,n.updateStore(a)}}),Jt(this,"destroyForm",function(){var o=new ET;n.getFieldEntities(!0).forEach(function(r){n.isMergedPreserve(r.isPreserve())||o.set(r.getNamePath(),!0)}),n.prevWithoutPreserves=o}),Jt(this,"getInitialValue",function(o){var r=mg(n.initialValues,o);return o.length?DD(r):r}),Jt(this,"setCallbacks",function(o){n.callbacks=o}),Jt(this,"setValidateMessages",function(o){n.validateMessages=o}),Jt(this,"setPreserve",function(o){n.preserve=o}),Jt(this,"watchList",[]),Jt(this,"registerWatch",function(o){return n.watchList.push(o),function(){n.watchList=n.watchList.filter(function(r){return r!==o})}}),Jt(this,"notifyWatch",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(n.watchList.length){var r=n.getFieldsValue(),i=n.getFieldsValue(!0);n.watchList.forEach(function(a){a(r,i,o)})}}),Jt(this,"timeoutId",null),Jt(this,"warningUnhooked",function(){}),Jt(this,"updateStore",function(o){n.store=o}),Jt(this,"getFieldEntities",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return o?n.fieldEntities.filter(function(r){return r.getNamePath().length}):n.fieldEntities}),Jt(this,"getFieldsMap",function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=new ET;return n.getFieldEntities(o).forEach(function(i){var a=i.getNamePath();r.set(a,i)}),r}),Jt(this,"getFieldEntitiesForNamePathList",function(o){if(!o)return n.getFieldEntities(!0);var r=n.getFieldsMap(!0);return o.map(function(i){var a=z0(i);return r.get(a)||{INVALIDATE_NAME_PATH:z0(i)}})}),Jt(this,"getFieldsValue",function(o,r){n.warningUnhooked();var i,a,l;if(o===!0||Array.isArray(o)?(i=o,a=r):o&&hi(o)==="object"&&(l=o.strict,a=o.filter),i===!0&&!a)return n.store;var s=n.getFieldEntitiesForNamePathList(Array.isArray(i)?i:null),c=[];return s.forEach(function(u){var d,f,p="INVALIDATE_NAME_PATH"in u?u.INVALIDATE_NAME_PATH:u.getNamePath();if(l){var g,A;if((g=(A=u).isList)!==null&&g!==void 0&&g.call(A))return}else if(!i&&(d=(f=u).isListField)!==null&&d!==void 0&&d.call(f))return;if(!a)c.push(p);else{var y="getMeta"in u?u.getMeta():null;a(y)&&c.push(p)}}),dve(n.store,c.map(z0))}),Jt(this,"getFieldValue",function(o){n.warningUnhooked();var r=z0(o);return mg(n.store,r)}),Jt(this,"getFieldsError",function(o){n.warningUnhooked();var r=n.getFieldEntitiesForNamePathList(o);return r.map(function(i,a){return i&&!("INVALIDATE_NAME_PATH"in i)?{name:i.getNamePath(),errors:i.getErrors(),warnings:i.getWarnings()}:{name:z0(o[a]),errors:[],warnings:[]}})}),Jt(this,"getFieldError",function(o){n.warningUnhooked();var r=z0(o),i=n.getFieldsError([r])[0];return i.errors}),Jt(this,"getFieldWarning",function(o){n.warningUnhooked();var r=z0(o),i=n.getFieldsError([r])[0];return i.warnings}),Jt(this,"isFieldsTouched",function(){n.warningUnhooked();for(var o=arguments.length,r=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:{},r=new ET,i=n.getFieldEntities(!0);i.forEach(function(s){var c=s.props.initialValue,u=s.getNamePath();if(c!==void 0){var d=r.get(u)||new Set;d.add({entity:s,value:c}),r.set(u,d)}});var a=function(c){c.forEach(function(u){var d=u.props.initialValue;if(d!==void 0){var f=u.getNamePath(),p=n.getInitialValue(f);if(p!==void 0)U0(!1,"Form already set 'initialValues' with path '".concat(f.join("."),"'. Field can not overwrite it."));else{var g=r.get(f);if(g&&g.size>1)U0(!1,"Multiple Field with path '".concat(f.join("."),"' set 'initialValue'. Can not decide which one to pick."));else if(g){var A=n.getFieldValue(f),y=u.isListField();!y&&(!o.skipExist||A===void 0)&&n.updateStore(d2(n.store,f,No(g)[0].value))}}}})},l;o.entities?l=o.entities:o.namePathList?(l=[],o.namePathList.forEach(function(s){var c=r.get(s);if(c){var u;(u=l).push.apply(u,No(No(c).map(function(d){return d.entity})))}})):l=i,a(l)}),Jt(this,"resetFields",function(o){n.warningUnhooked();var r=n.store;if(!o){n.updateStore(DD(n.initialValues)),n.resetWithFieldInitialValue(),n.notifyObservers(r,null,{type:"reset"}),n.notifyWatch();return}var i=o.map(z0);i.forEach(function(a){var l=n.getInitialValue(a);n.updateStore(d2(n.store,a,l))}),n.resetWithFieldInitialValue({namePathList:i}),n.notifyObservers(r,i,{type:"reset"}),n.notifyWatch(i)}),Jt(this,"setFields",function(o){n.warningUnhooked();var r=n.store,i=[];o.forEach(function(a){var l=a.name,s=oi(a,QMt),c=z0(l);i.push(c),"value"in s&&n.updateStore(d2(n.store,c,s.value)),n.notifyObservers(r,[c],{type:"setField",data:a})}),n.notifyWatch(i)}),Jt(this,"getFields",function(){var o=n.getFieldEntities(!0),r=o.map(function(i){var a=i.getNamePath(),l=i.getMeta(),s=en(en({},l),{},{name:a,value:n.getFieldValue(a)});return Object.defineProperty(s,"originRCField",{value:!0}),s});return r}),Jt(this,"initEntityValue",function(o){var r=o.props.initialValue;if(r!==void 0){var i=o.getNamePath(),a=mg(n.store,i);a===void 0&&n.updateStore(d2(n.store,i,r))}}),Jt(this,"isMergedPreserve",function(o){var r=o!==void 0?o:n.preserve;return r??!0}),Jt(this,"registerField",function(o){n.fieldEntities.push(o);var r=o.getNamePath();if(n.notifyWatch([r]),o.props.initialValue!==void 0){var i=n.store;n.resetWithFieldInitialValue({entities:[o],skipExist:!0}),n.notifyObservers(i,[o.getNamePath()],{type:"valueUpdate",source:"internal"})}return function(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(n.fieldEntities=n.fieldEntities.filter(function(d){return d!==o}),!n.isMergedPreserve(l)&&(!a||s.length>1)){var c=a?void 0:n.getInitialValue(r);if(r.length&&n.getFieldValue(r)!==c&&n.fieldEntities.every(function(d){return!nGe(d.getNamePath(),r)})){var u=n.store;n.updateStore(d2(u,r,c,!0)),n.notifyObservers(u,[r],{type:"remove"}),n.triggerDependenciesUpdate(u,r)}}n.notifyWatch([r])}}),Jt(this,"dispatch",function(o){switch(o.type){case"updateValue":{var r=o.namePath,i=o.value;n.updateValue(r,i);break}case"validateField":{var a=o.namePath,l=o.triggerName;n.validateFields([a],{triggerName:l});break}}}),Jt(this,"notifyObservers",function(o,r,i){if(n.subscribable){var a=en(en({},i),{},{store:n.getFieldsValue(!0)});n.getFieldEntities().forEach(function(l){var s=l.onStoreChange;s(o,r,a)})}else n.forceRootUpdate()}),Jt(this,"triggerDependenciesUpdate",function(o,r){var i=n.getDependencyChildrenFields(r);return i.length&&n.validateFields(i),n.notifyObservers(o,i,{type:"dependenciesUpdate",relatedFields:[r].concat(No(i))}),i}),Jt(this,"updateValue",function(o,r){var i=z0(o),a=n.store;n.updateStore(d2(n.store,i,r)),n.notifyObservers(a,[i],{type:"valueUpdate",source:"internal"}),n.notifyWatch([i]);var l=n.triggerDependenciesUpdate(a,i),s=n.callbacks.onValuesChange;if(s){var c=dve(n.store,[i]);s(c,n.getFieldsValue())}n.triggerOnFieldsChange([i].concat(No(l)))}),Jt(this,"setFieldsValue",function(o){n.warningUnhooked();var r=n.store;if(o){var i=DD(n.store,o);n.updateStore(i)}n.notifyObservers(r,null,{type:"valueUpdate",source:"external"}),n.notifyWatch()}),Jt(this,"setFieldValue",function(o,r){n.setFields([{name:o,value:r}])}),Jt(this,"getDependencyChildrenFields",function(o){var r=new Set,i=[],a=new ET;n.getFieldEntities().forEach(function(s){var c=s.props.dependencies;(c||[]).forEach(function(u){var d=z0(u);a.update(d,function(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Set;return f.add(s),f})})});var l=function s(c){var u=a.get(c)||new Set;u.forEach(function(d){if(!r.has(d)){r.add(d);var f=d.getNamePath();d.isFieldDirty()&&f.length&&(i.push(f),s(f))}})};return l(o),i}),Jt(this,"triggerOnFieldsChange",function(o,r){var i=n.callbacks.onFieldsChange;if(i){var a=n.getFields();if(r){var l=new ET;r.forEach(function(c){var u=c.name,d=c.errors;l.set(u,d)}),a.forEach(function(c){c.errors=l.get(c.name)||c.errors})}var s=a.filter(function(c){var u=c.name;return IC(o,u)});s.length&&i(s,a)}}),Jt(this,"validateFields",function(o,r){n.warningUnhooked();var i,a;Array.isArray(o)||typeof o=="string"||typeof r=="string"?(i=o,a=r):a=o;var l=!!i,s=l?i.map(z0):[],c=[],u=String(Date.now()),d=new Set,f=a||{},p=f.recursive,g=f.dirty;n.getFieldEntities(!0).forEach(function(C){if(l||s.push(C.getNamePath()),!(!C.props.rules||!C.props.rules.length)&&!(g&&!C.isFieldDirty())){var P=C.getNamePath();if(d.add(P.join(u)),!l||IC(s,P,p)){var v=C.validateRules(en({validateMessages:en(en({},Z_e),n.validateMessages)},a));c.push(v.then(function(){return{name:P,errors:[],warnings:[]}}).catch(function(T){var w,x=[],b=[];return(w=T.forEach)===null||w===void 0||w.call(T,function(R){var H=R.rule.warningOnly,F=R.errors;H?b.push.apply(b,No(F)):x.push.apply(x,No(F))}),x.length?Promise.reject({name:P,errors:x,warnings:b}):{name:P,errors:x,warnings:b}}))}}});var A=$Mt(c);n.lastValidatePromise=A,A.catch(function(C){return C}).then(function(C){var P=C.map(function(v){var T=v.name;return T});n.notifyObservers(n.store,P,{type:"validateFinish"}),n.triggerOnFieldsChange(P,C)});var y=A.then(function(){return n.lastValidatePromise===A?Promise.resolve(n.getFieldsValue(s)):Promise.reject([])}).catch(function(C){var P=C.filter(function(v){return v&&v.errors.length});return Promise.reject({values:n.getFieldsValue(s),errorFields:P,outOfDate:n.lastValidatePromise!==A})});y.catch(function(C){return C});var S=s.filter(function(C){return d.has(C.join(u))});return n.triggerOnFieldsChange(S),y}),Jt(this,"submit",function(){n.warningUnhooked(),n.validateFields().then(function(o){var r=n.callbacks.onFinish;if(r)try{r(o)}catch(i){console.error(i)}}).catch(function(o){var r=n.callbacks.onFinishFailed;r&&r(o)})}),this.forceRootUpdate=e});function iGe(t){var e=m.useRef(),n=m.useState({}),o=sn(n,2),r=o[1];if(!e.current)if(t)e.current=t;else{var i=function(){r({})},a=new ZMt(i);e.current=a.getForm()}return[e.current]}var K0e=m.createContext({triggerFormChange:function(){},triggerFormFinish:function(){},registerForm:function(){},unregisterForm:function(){}}),eIt=function(e){var n=e.validateMessages,o=e.onFormChange,r=e.onFormFinish,i=e.children,a=m.useContext(K0e),l=m.useRef({});return m.createElement(K0e.Provider,{value:en(en({},a),{},{validateMessages:en(en({},a.validateMessages),n),triggerFormChange:function(c,u){o&&o(c,{changedFields:u,forms:l.current}),a.triggerFormChange(c,u)},triggerFormFinish:function(c,u){r&&r(c,{values:u,forms:l.current}),a.triggerFormFinish(c,u)},registerForm:function(c,u){c&&(l.current=en(en({},l.current),{},Jt({},c,u))),a.registerForm(c,u)},unregisterForm:function(c){var u=en({},l.current);delete u[c],l.current=u,a.unregisterForm(c)}})},i)},tIt=["name","initialValues","fields","form","preserve","children","component","validateMessages","validateTrigger","onValuesChange","onFieldsChange","onFinish","onFinishFailed"],nIt=function(e,n){var o=e.name,r=e.initialValues,i=e.fields,a=e.form,l=e.preserve,s=e.children,c=e.component,u=c===void 0?"form":c,d=e.validateMessages,f=e.validateTrigger,p=f===void 0?"onChange":f,g=e.onValuesChange,A=e.onFieldsChange,y=e.onFinish,S=e.onFinishFailed,C=oi(e,tIt),P=m.useContext(K0e),v=iGe(a),T=sn(v,1),w=T[0],x=w.getInternalHooks(Bv),b=x.useSubscribe,R=x.setInitialValues,H=x.setCallbacks,F=x.setValidateMessages,E=x.setPreserve,N=x.destroyForm;m.useImperativeHandle(n,function(){return w}),m.useEffect(function(){return P.registerForm(o,w),function(){P.unregisterForm(o)}},[P,w,o]),F(en(en({},P.validateMessages),d)),H({onValuesChange:g,onFieldsChange:function(V){if(P.triggerFormChange(o,V),A){for(var G=arguments.length,q=new Array(G>1?G-1:0),$=1;${let{children:e,status:n,override:o}=t;const r=m.useContext(r1),i=m.useMemo(()=>{const a=Object.assign({},r);return o&&delete a.isFormItemInput,n&&(delete a.status,delete a.hasFeedback,delete a.feedbackIcon),a},[n,o,r]);return m.createElement(r1.Provider,{value:i},e)},iIt=m.createContext(void 0);function gve(){}const aIt=m.createContext({add:gve,remove:gve});function aGe(t){const e=m.useContext(aIt),n=m.useRef();return Q6(r=>{if(r){const i=t?r.querySelector(t):r;e.add(i),n.current=i}else e.remove(n.current)})}const mve=()=>{const{cancelButtonProps:t,cancelTextLocale:e,onCancel:n}=m.useContext(BW);return be.createElement(io,Object.assign({onClick:n},t),e)},yve=()=>{const{confirmLoading:t,okButtonProps:e,okType:n,okTextLocale:o,onOk:r}=m.useContext(BW);return be.createElement(io,Object.assign({},F_e(n),{loading:t,onClick:r},e),o)};function lGe(t,e){return be.createElement("span",{className:`${t}-close-x`},e||be.createElement(jw,{className:`${t}-close-icon`}))}const sGe=t=>{const{okText:e,okType:n="primary",cancelText:o,confirmLoading:r,onOk:i,onCancel:a,okButtonProps:l,cancelButtonProps:s,footer:c}=t,[u]=Uw("Modal",xVe()),d=e||(u==null?void 0:u.okText),f=o||(u==null?void 0:u.cancelText),p={confirmLoading:r,okButtonProps:l,cancelButtonProps:s,okTextLocale:d,cancelTextLocale:f,okType:n,onOk:i,onCancel:a},g=be.useMemo(()=>p,Qa(Object.values(p)));let A;return typeof c=="function"||typeof c>"u"?(A=be.createElement(be.Fragment,null,be.createElement(mve,null),be.createElement(yve,null)),typeof c=="function"&&(A=c(A,{OkBtn:yve,CancelBtn:mve})),A=be.createElement(B_e,{value:g},A)):A=c,be.createElement(IVe,{disabled:!1},A)},kme=t=>({[t.componentCls]:{[`${t.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${t.motionDurationMid} ${t.motionEaseInOut}, opacity ${t.motionDurationMid} ${t.motionEaseInOut} !important`}},[`${t.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${t.motionDurationMid} ${t.motionEaseInOut}, opacity ${t.motionDurationMid} ${t.motionEaseInOut} !important`}}}),lIt=t=>({animationDuration:t,animationFillMode:"both"}),sIt=t=>({animationDuration:t,animationFillMode:"both"}),Y$=function(t,e,n,o){const i=(arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1)?"&":"";return{[` @@ -4501,11 +4501,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{transform:"scale(0)",opacity:0,animationTimingFunction:t.motionEaseOutCirc,"&-prepare":{transform:"none"}},[`${o}-leave`]:{animationTimingFunction:t.motionEaseInOutCirc}}]};function vve(t){return{position:t,inset:0}}const WIt=t=>{const{componentCls:e,antCls:n}=t;return[{[`${e}-root`]:{[`${e}${n}-zoom-enter, ${e}${n}-zoom-appear`]:{transform:"none",opacity:0,animationDuration:t.motionDurationSlow,userSelect:"none"},[`${e}${n}-zoom-leave ${e}-content`]:{pointerEvents:"none"},[`${e}-mask`]:Object.assign(Object.assign({},vve("fixed")),{zIndex:t.zIndexPopupBase,height:"100%",backgroundColor:t.colorBgMask,pointerEvents:"none",[`${e}-hidden`]:{display:"none"}}),[`${e}-wrap`]:Object.assign(Object.assign({},vve("fixed")),{zIndex:t.zIndexPopupBase,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"})}},{[`${e}-root`]:dIt(t)}]},NIt=t=>{const{componentCls:e}=t;return[{[`${e}-root`]:{[`${e}-wrap-rtl`]:{direction:"rtl"},[`${e}-centered`]:{textAlign:"center","&::before":{display:"inline-block",width:0,height:"100%",verticalAlign:"middle",content:'""'},[e]:{top:0,display:"inline-block",paddingBottom:0,textAlign:"start",verticalAlign:"middle"}},[`@media (max-width: ${t.screenSMMax}px)`]:{[e]:{maxWidth:"calc(100vw - 16px)",margin:`${jt(t.marginXS)} auto`},[`${e}-centered`]:{[e]:{flex:1}}}}},{[e]:Object.assign(Object.assign({},Na(t)),{pointerEvents:"none",position:"relative",top:100,width:"auto",maxWidth:`calc(100vw - ${jt(t.calc(t.margin).mul(2).equal())})`,margin:"0 auto",paddingBottom:t.paddingLG,[`${e}-title`]:{margin:0,color:t.titleColor,fontWeight:t.fontWeightStrong,fontSize:t.titleFontSize,lineHeight:t.titleLineHeight,wordWrap:"break-word"},[`${e}-content`]:{position:"relative",backgroundColor:t.contentBg,backgroundClip:"padding-box",border:0,borderRadius:t.borderRadiusLG,boxShadow:t.boxShadow,pointerEvents:"auto",padding:t.contentPadding},[`${e}-close`]:Object.assign({position:"absolute",top:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),insetInlineEnd:t.calc(t.modalHeaderHeight).sub(t.modalCloseBtnSize).div(2).equal(),zIndex:t.calc(t.zIndexPopupBase).add(10).equal(),padding:0,color:t.modalCloseIconColor,fontWeight:t.fontWeightStrong,lineHeight:1,textDecoration:"none",background:"transparent",borderRadius:t.borderRadiusSM,width:t.modalCloseBtnSize,height:t.modalCloseBtnSize,border:0,outline:0,cursor:"pointer",transition:`color ${t.motionDurationMid}, background-color ${t.motionDurationMid}`,"&-x":{display:"flex",fontSize:t.fontSizeLG,fontStyle:"normal",lineHeight:`${jt(t.modalCloseBtnSize)}`,justifyContent:"center",textTransform:"none",textRendering:"auto"},"&:hover":{color:t.modalCloseIconHoverColor,backgroundColor:t.colorBgTextHover,textDecoration:"none"},"&:active":{backgroundColor:t.colorBgTextActive}},eA(t)),[`${e}-header`]:{color:t.colorText,background:t.headerBg,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,marginBottom:t.headerMarginBottom,padding:t.headerPadding,borderBottom:t.headerBorderBottom},[`${e}-body`]:{fontSize:t.fontSize,lineHeight:t.lineHeight,wordWrap:"break-word",padding:t.bodyPadding},[`${e}-footer`]:{textAlign:"end",background:t.footerBg,marginTop:t.footerMarginTop,padding:t.footerPadding,borderTop:t.footerBorderTop,borderRadius:t.footerBorderRadius,[`> ${t.antCls}-btn + ${t.antCls}-btn`]:{marginInlineStart:t.marginXS}},[`${e}-open`]:{overflow:"hidden"}})},{[`${e}-pure-panel`]:{top:"auto",padding:0,display:"flex",flexDirection:"column",[`${e}-content, ${e}-body, ${e}-confirm-body-wrapper`]:{display:"flex",flexDirection:"column",flex:"auto"},[`${e}-confirm-body`]:{marginBottom:"auto"}}}]},UIt=t=>{const{componentCls:e}=t;return{[`${e}-root`]:{[`${e}-wrap-rtl`]:{direction:"rtl",[`${e}-confirm-body`]:{direction:"rtl"}}}}},cGe=t=>{const e=t.padding,n=t.fontSizeHeading5,o=t.lineHeightHeading5;return qi(t,{modalHeaderHeight:t.calc(t.calc(o).mul(n).equal()).add(t.calc(e).mul(2).equal()).equal(),modalFooterBorderColorSplit:t.colorSplit,modalFooterBorderStyle:t.lineType,modalFooterBorderWidth:t.lineWidth,modalCloseIconColor:t.colorIcon,modalCloseIconHoverColor:t.colorIconHover,modalCloseBtnSize:t.controlHeight,modalConfirmIconSize:t.fontHeight,modalTitleHeight:t.calc(t.titleFontSize).mul(t.titleLineHeight).equal()})},uGe=t=>({footerBg:"transparent",headerBg:t.colorBgElevated,titleLineHeight:t.lineHeightHeading5,titleFontSize:t.fontSizeHeading5,contentBg:t.colorBgElevated,titleColor:t.colorTextHeading,contentPadding:t.wireframe?0:`${jt(t.paddingMD)} ${jt(t.paddingContentHorizontalLG)}`,headerPadding:t.wireframe?`${jt(t.padding)} ${jt(t.paddingLG)}`:0,headerBorderBottom:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",headerMarginBottom:t.wireframe?0:t.marginXS,bodyPadding:t.wireframe?t.paddingLG:0,footerPadding:t.wireframe?`${jt(t.paddingXS)} ${jt(t.padding)}`:0,footerBorderTop:t.wireframe?`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`:"none",footerBorderRadius:t.wireframe?`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`:0,footerMarginTop:t.wireframe?0:t.marginSM,confirmBodyPadding:t.wireframe?`${jt(t.padding*2)} ${jt(t.padding*2)} ${jt(t.paddingLG)}`:0,confirmIconMarginInlineEnd:t.wireframe?t.margin:t.marginSM,confirmBtnsMarginTop:t.wireframe?t.marginLG:t.marginSM}),dGe=wl("Modal",t=>{const e=cGe(t);return[NIt(e),UIt(e),WIt(e),_W(e,"zoom")]},uGe,{unitless:{titleLineHeight:!0}});var jIt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{q0e={x:t.pageX,y:t.pageY},setTimeout(()=>{q0e=null},100)};ZHt()&&document.documentElement.addEventListener("click",BIt,!0);const fGe=t=>{var e;const{getPopupContainer:n,getPrefixCls:o,direction:r,modal:i}=m.useContext(Cr),a=B=>{const{onCancel:O}=t;O==null||O(B)},l=B=>{const{onOk:O}=t;O==null||O(B)},{prefixCls:s,className:c,rootClassName:u,open:d,wrapClassName:f,centered:p,getContainer:g,focusTriggerAfterClose:A=!0,style:y,visible:S,width:C=520,footer:P,classNames:v,styles:T}=t,w=jIt(t,["prefixCls","className","rootClassName","open","wrapClassName","centered","getContainer","focusTriggerAfterClose","style","visible","width","footer","classNames","styles"]),x=o("modal",s),b=o(),R=Y0(x),[H,F,E]=dGe(x,R),N=Un(f,{[`${x}-centered`]:!!p,[`${x}-wrap-rtl`]:r==="rtl"}),U=P!==null&&m.createElement(sGe,Object.assign({},t,{onOk:l,onCancel:a})),[W,k]=Dme(AR(t),AR(i),{closable:!0,closeIcon:m.createElement(jw,{className:`${x}-close-icon`}),closeIconRender:B=>lGe(x,B)}),D=aGe(`.${x}-content`),[L,j]=Bw("Modal",w.zIndex);return H(m.createElement(O9,null,m.createElement(vR,{status:!0,override:!0},m.createElement(WW.Provider,{value:j},m.createElement(X_e,Object.assign({width:C},w,{zIndex:L,getContainer:g===void 0?n:g,prefixCls:x,rootClassName:Un(F,u,E,R),footer:U,visible:d??S,mousePosition:(e=w.mousePosition)!==null&&e!==void 0?e:q0e,onClose:a,closable:W,closeIcon:k,focusTriggerAfterClose:A,transitionName:B9(b,"zoom",t.transitionName),maskTransitionName:B9(b,"fade",t.maskTransitionName),className:Un(F,c,i==null?void 0:i.className),style:Object.assign(Object.assign({},i==null?void 0:i.style),y),classNames:Object.assign(Object.assign(Object.assign({},i==null?void 0:i.classNames),v),{wrapper:Un(N,v==null?void 0:v.wrapper)}),styles:Object.assign(Object.assign({},i==null?void 0:i.styles),T),panelRef:D}))))))},YIt=t=>{const{componentCls:e,titleFontSize:n,titleLineHeight:o,modalConfirmIconSize:r,fontSize:i,lineHeight:a,modalTitleHeight:l,fontHeight:s,confirmBodyPadding:c}=t,u=`${e}-confirm`;return{[u]:{"&-rtl":{direction:"rtl"},[`${t.antCls}-modal-header`]:{display:"none"},[`${u}-body-wrapper`]:Object.assign({},ik()),[`&${e} ${e}-body`]:{padding:c},[`${u}-body`]:{display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t.iconCls}`]:{flex:"none",fontSize:r,marginInlineEnd:t.confirmIconMarginInlineEnd,marginTop:t.calc(t.calc(s).sub(r).equal()).div(2).equal()},[`&-has-title > ${t.iconCls}`]:{marginTop:t.calc(t.calc(l).sub(r).equal()).div(2).equal()}},[`${u}-paragraph`]:{display:"flex",flexDirection:"column",flex:"auto",rowGap:t.marginXS},[`${t.iconCls} + ${u}-paragraph`]:{maxWidth:`calc(100% - ${jt(t.calc(t.modalConfirmIconSize).add(t.marginSM).equal())})`},[`${u}-title`]:{color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:n,lineHeight:o},[`${u}-content`]:{color:t.colorText,fontSize:i,lineHeight:a},[`${u}-btns`]:{textAlign:"end",marginTop:t.confirmBtnsMarginTop,[`${t.antCls}-btn + ${t.antCls}-btn`]:{marginBottom:0,marginInlineStart:t.marginXS}}},[`${u}-error ${u}-body > ${t.iconCls}`]:{color:t.colorError},[`${u}-warning ${u}-body > ${t.iconCls}, - ${u}-confirm ${u}-body > ${t.iconCls}`]:{color:t.colorWarning},[`${u}-info ${u}-body > ${t.iconCls}`]:{color:t.colorInfo},[`${u}-success ${u}-body > ${t.iconCls}`]:{color:t.colorSuccess}}},OIt=LW(["Modal","confirm"],t=>{const e=cGe(t);return[YIt(e)]},uGe,{order:-1e3});var VIt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rC,Qa(Object.values(C))),v=m.createElement(m.Fragment,null,m.createElement(B7e,null),m.createElement(Y7e,null)),T=t.title!==void 0&&t.title!==null,w=`${i}-body`;return m.createElement("div",{className:`${i}-body-wrapper`},m.createElement("div",{className:Un(w,{[`${w}-has-title`]:T})},d,m.createElement("div",{className:`${i}-paragraph`},T&&m.createElement("span",{className:`${i}-title`},t.title),m.createElement("div",{className:`${i}-content`},t.content))),s===void 0||typeof s=="function"?m.createElement(B_e,{value:P},m.createElement("div",{className:`${i}-btns`},typeof s=="function"?s(v,{OkBtn:Y7e,CancelBtn:B7e}):v)):s,m.createElement(OIt,{prefixCls:e}))}const _It=t=>{const{close:e,zIndex:n,afterClose:o,open:r,keyboard:i,centered:a,getContainer:l,maskStyle:s,direction:c,prefixCls:u,wrapClassName:d,rootPrefixCls:f,bodyStyle:p,closable:g=!1,closeIcon:A,modalRender:y,focusTriggerAfterClose:S,onConfirm:C,styles:P}=t,v=`${u}-confirm`,T=t.width||416,w=t.style||{},x=t.mask===void 0?!0:t.mask,b=t.maskClosable===void 0?!1:t.maskClosable,R=Un(v,`${v}-${t.type}`,{[`${v}-rtl`]:c==="rtl"},t.className),[,H]=Vu(),F=m.useMemo(()=>n!==void 0?n:H.zIndexPopupBase+Cme,[n,H]);return m.createElement(fGe,{prefixCls:u,className:R,wrapClassName:Un({[`${v}-centered`]:!!t.centered},d),onCancel:()=>{e==null||e({triggerCancel:!0}),C==null||C(!1)},open:r,title:"",footer:null,transitionName:B9(f||"","zoom",t.transitionName),maskTransitionName:B9(f||"","fade",t.maskTransitionName),mask:x,maskClosable:b,style:w,styles:Object.assign({body:p,mask:s},P),width:T,zIndex:F,afterClose:o,keyboard:i,centered:a,getContainer:l,closable:g,closeIcon:A,modalRender:y,focusTriggerAfterClose:S},m.createElement(hGe,Object.assign({},t,{confirmPrefixCls:v})))},pGe=t=>{const{rootPrefixCls:e,iconPrefixCls:n,direction:o,theme:r}=t;return m.createElement(fy,{prefixCls:e,iconPrefixCls:n,direction:o,theme:r},m.createElement(_It,Object.assign({},t)))},Yv=[];let gGe="";function mGe(){return gGe}const GIt=t=>{var e,n;const{prefixCls:o,getContainer:r,direction:i}=t,a=xVe(),l=m.useContext(Cr),s=mGe()||l.getPrefixCls(),c=o||`${s}-modal`;let u=r;return u===!1&&(u=void 0),be.createElement(pGe,Object.assign({},t,{rootPrefixCls:s,prefixCls:c,iconPrefixCls:l.iconPrefixCls,theme:l.theme,direction:i??l.direction,locale:(n=(e=l.locale)===null||e===void 0?void 0:e.Modal)!==null&&n!==void 0?n:a,getContainer:u}))};function GW(t){const e=u_e(),n=document.createDocumentFragment();let o=Object.assign(Object.assign({},t),{close:l,open:!0}),r;function i(){for(var c=arguments.length,u=new Array(c),d=0;dp&&p.triggerCancel);t.onCancel&&f&&t.onCancel.apply(t,[()=>{}].concat(Qa(u.slice(1))));for(let p=0;p{const u=e.getPrefixCls(void 0,mGe()),d=e.getIconPrefixCls(),f=e.getTheme(),p=be.createElement(GIt,Object.assign({},c));Hme(be.createElement(fy,{prefixCls:u,iconPrefixCls:d,theme:f},e.holderRender?e.holderRender(p):p),n)})}function l(){for(var c=arguments.length,u=new Array(c),d=0;d{typeof t.afterClose=="function"&&t.afterClose(),i.apply(this,u)}}),o.visible&&delete o.visible,a(o)}function s(c){typeof c=="function"?o=c(o):o=Object.assign(Object.assign({},o),c),a(o)}return a(o),Yv.push(l),{destroy:l,update:s}}function yGe(t){return Object.assign(Object.assign({},t),{type:"warning"})}function AGe(t){return Object.assign(Object.assign({},t),{type:"info"})}function wGe(t){return Object.assign(Object.assign({},t),{type:"success"})}function vGe(t){return Object.assign(Object.assign({},t),{type:"error"})}function xGe(t){return Object.assign(Object.assign({},t),{type:"confirm"})}function XIt(t){let{rootPrefixCls:e}=t;gGe=e}var JIt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,{afterClose:o,config:r}=t,i=JIt(t,["afterClose","config"]);const[a,l]=m.useState(!0),[s,c]=m.useState(r),{direction:u,getPrefixCls:d}=m.useContext(Cr),f=d("modal"),p=d(),g=()=>{var C;o(),(C=s.afterClose)===null||C===void 0||C.call(s)},A=function(){l(!1);for(var C=arguments.length,P=new Array(C),v=0;vw&&w.triggerCancel);s.onCancel&&T&&s.onCancel.apply(s,[()=>{}].concat(Qa(P.slice(1))))};m.useImperativeHandle(e,()=>({destroy:A,update:C=>{c(P=>Object.assign(Object.assign({},P),C))}}));const y=(n=s.okCancel)!==null&&n!==void 0?n:s.type==="confirm",[S]=Uw("Modal",uw.Modal);return m.createElement(pGe,Object.assign({prefixCls:f,rootPrefixCls:p},s,{close:A,open:a,afterClose:g,okText:s.okText||(y?S==null?void 0:S.okText:S==null?void 0:S.justOkText),direction:s.direction||u,cancelText:s.cancelText||(S==null?void 0:S.cancelText)},i))},qIt=m.forwardRef(KIt);let xve=0;const $It=m.memo(m.forwardRef((t,e)=>{const[n,o]=NRt();return m.useImperativeHandle(e,()=>({patchElement:o}),[]),m.createElement(m.Fragment,null,n)}));function QIt(){const t=m.useRef(null),[e,n]=m.useState([]);m.useEffect(()=>{e.length&&(Qa(e).forEach(a=>{a()}),n([]))},[e]);const o=m.useCallback(i=>function(l){var s;xve+=1;const c=m.createRef();let u;const d=new Promise(y=>{u=y});let f=!1,p;const g=m.createElement(qIt,{key:`modal-${xve}`,config:i(l),ref:c,afterClose:()=>{p==null||p()},isSilent:()=>f,onConfirm:y=>{u(y)}});return p=(s=t.current)===null||s===void 0?void 0:s.patchElement(g),p&&Yv.push(p),{destroy:()=>{function y(){var S;(S=c.current)===null||S===void 0||S.destroy()}c.current?y():n(S=>[].concat(Qa(S),[y]))},update:y=>{function S(){var C;(C=c.current)===null||C===void 0||C.update(y)}c.current?S():n(C=>[].concat(Qa(C),[S]))},then:y=>(f=!0,d.then(y))}},[]);return[m.useMemo(()=>({info:o(AGe),success:o(wGe),error:o(vGe),warning:o(yGe),confirm:o(xGe)}),[]),m.createElement($It,{key:"modal-holder",ref:t})]}const ZIt=be.createContext({});function bGe(t){return e=>m.createElement(fy,{theme:{token:{motion:!1,zIndexPopupBase:0}}},m.createElement(t,Object.assign({},e)))}const XW=(t,e,n,o)=>bGe(i=>{const{prefixCls:a,style:l}=i,s=m.useRef(null),[c,u]=m.useState(0),[d,f]=m.useState(0),[p,g]=Z6(!1,{value:i.open}),{getPrefixCls:A}=m.useContext(Cr),y=A(e||"select",a);m.useEffect(()=>{if(g(!0),typeof ResizeObserver<"u"){const P=new ResizeObserver(T=>{const w=T[0].target;u(w.offsetHeight+8),f(w.offsetWidth)}),v=setInterval(()=>{var T;const w=n?`.${n(y)}`:`.${y}-dropdown`,x=(T=s.current)===null||T===void 0?void 0:T.querySelector(w);x&&(clearInterval(v),P.observe(x))},10);return()=>{clearInterval(v),P.disconnect()}}},[]);let S=Object.assign(Object.assign({},i),{style:Object.assign(Object.assign({},l),{margin:0}),open:p,visible:p,getPopupContainer:()=>s.current});o&&(S=o(S));const C={paddingBottom:c,position:"relative",minWidth:d};return m.createElement("div",{ref:s,style:C},m.createElement(t,Object.assign({},S)))});function za(t){var e=m.useRef();e.current=t;var n=m.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var J$=function(e){var n=e.className,o=e.customizeIcon,r=e.customizeIconProps,i=e.children,a=e.onMouseDown,l=e.onClick,s=typeof o=="function"?o(r):o;return m.createElement("span",{className:n,onMouseDown:function(u){u.preventDefault(),a==null||a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},s!==void 0?s:m.createElement("span",{className:Xn(n.split(/\s+/).map(function(c){return"".concat(c,"-icon")}))},i))},ezt=function(e,n,o,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,l=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,c=be.useMemo(function(){if(hi(r)==="object")return r.clearIcon;if(i)return i},[r,i]),u=be.useMemo(function(){return!!(!a&&r&&(o.length||l)&&!(s==="combobox"&&l===""))},[r,a,o.length,l,s]);return{allowClear:u,clearIcon:be.createElement(J$,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:c},"×")}},SGe=m.createContext(null);function tzt(){return m.useContext(SGe)}function nzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=m.useState(!1),n=sn(e,2),o=n[0],r=n[1],i=m.useRef(null),a=function(){window.clearTimeout(i.current)};m.useEffect(function(){return a},[]);var l=function(c,u){a(),i.current=window.setTimeout(function(){r(c),u&&u()},t)};return[o,l,a]}function TGe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=m.useRef(null),n=m.useRef(null);m.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function o(r){(r||e.current===null)&&(e.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},o]}function ozt(t,e,n,o){var r=m.useRef(null);r.current={open:e,triggerOpen:n,customizedTrigger:o},m.useEffect(function(){function i(a){var l;if(!((l=r.current)!==null&&l!==void 0&&l.customizedTrigger)){var s=a.target;s.shadowRoot&&a.composed&&(s=a.composedPath()[0]||s),r.current.open&&t().filter(function(c){return c}).every(function(c){return!c.contains(s)&&c!==s})&&r.current.triggerOpen(!1)}}return window.addEventListener("mousedown",i),function(){return window.removeEventListener("mousedown",i)}},[])}function rzt(t){return![jn.ESC,jn.SHIFT,jn.BACKSPACE,jn.TAB,jn.WIN_KEY,jn.ALT,jn.META,jn.WIN_KEY_RIGHT,jn.CTRL,jn.SEMICOLON,jn.EQUALS,jn.CAPS_LOCK,jn.CONTEXT_MENU,jn.F1,jn.F2,jn.F3,jn.F4,jn.F5,jn.F6,jn.F7,jn.F8,jn.F9,jn.F10,jn.F11,jn.F12].includes(t)}var izt=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],FT=void 0;function azt(t,e){var n=t.prefixCls,o=t.invalidate,r=t.item,i=t.renderItem,a=t.responsive,l=t.responsiveDisabled,s=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,g=t.order,A=t.component,y=A===void 0?"div":A,S=oi(t,izt),C=a&&!p;function P(b){s(c,b)}m.useEffect(function(){return function(){P(null)}},[]);var v=i&&r!==FT?i(r):f,T;o||(T={opacity:C?0:1,height:C?0:FT,overflowY:C?"hidden":FT,order:a?g:FT,pointerEvents:C?"none":FT,position:C?"absolute":FT});var w={};C&&(w["aria-hidden"]=!0);var x=m.createElement(y,go({className:Xn(!o&&n,u),style:en(en({},T),d)},w,S,{ref:e}),v);return a&&(x=m.createElement(Cd,{onResize:function(R){var H=R.offsetWidth;P(H)},disabled:l},x)),x}var CE=m.forwardRef(azt);CE.displayName="Item";function lzt(t){if(typeof MessageChannel>"u")Ea(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function szt(){var t=m.useRef(null),e=function(o){t.current||(t.current=[],lzt(function(){Hd.unstable_batchedUpdates(function(){t.current.forEach(function(r){r()}),t.current=null})})),t.current.push(o)};return e}function kz(t,e){var n=m.useState(e),o=sn(n,2),r=o[0],i=o[1],a=za(function(l){t(function(){i(l)})});return[r,a]}var UG=be.createContext(null),czt=["component"],uzt=["className"],dzt=["className"],fzt=function(e,n){var o=m.useContext(UG);if(!o){var r=e.component,i=r===void 0?"div":r,a=oi(e,czt);return m.createElement(i,go({},a,{ref:n}))}var l=o.className,s=oi(o,uzt),c=e.className,u=oi(e,dzt);return m.createElement(UG.Provider,{value:null},m.createElement(CE,go({ref:n,className:Xn(l,c)},s,u)))},PGe=m.forwardRef(fzt);PGe.displayName="RawItem";var hzt=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],CGe="responsive",RGe="invalidate";function pzt(t){return"+ ".concat(t.length," ...")}function gzt(t,e){var n=t.prefixCls,o=n===void 0?"rc-overflow":n,r=t.data,i=r===void 0?[]:r,a=t.renderItem,l=t.renderRawItem,s=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,g=t.maxCount,A=t.renderRest,y=t.renderRawRest,S=t.suffix,C=t.component,P=C===void 0?"div":C,v=t.itemComponent,T=t.onVisibleChange,w=oi(t,hzt),x=d==="full",b=szt(),R=kz(b,null),H=sn(R,2),F=H[0],E=H[1],N=F||0,U=kz(b,new Map),W=sn(U,2),k=W[0],D=W[1],L=kz(b,0),j=sn(L,2),B=j[0],O=j[1],V=kz(b,0),G=sn(V,2),q=G[0],$=G[1],ie=kz(b,0),Q=sn(ie,2),se=Q[0],Z=Q[1],ee=m.useState(null),te=sn(ee,2),oe=te[0],de=te[1],he=m.useState(null),pe=sn(he,2),me=pe[0],le=pe[1],Te=m.useMemo(function(){return me===null&&x?Number.MAX_SAFE_INTEGER:me||0},[me,F]),ge=m.useState(!1),Se=sn(ge,2),Re=Se[0],De=Se[1],Ae="".concat(o,"-item"),ue=Math.max(B,q),fe=g===CGe,ve=i.length&&fe,we=g===RGe,Pe=ve||typeof g=="number"&&i.length>g,Ie=m.useMemo(function(){var Qe=i;return ve?F===null&&x?Qe=i:Qe=i.slice(0,Math.min(i.length,N/u)):typeof g=="number"&&(Qe=i.slice(0,g)),Qe},[i,u,F,g,ve]),Me=m.useMemo(function(){return ve?i.slice(Te+1):i.slice(Ie.length)},[i,Ie,ve,Te]),ze=m.useCallback(function(Qe,lt){var Ze;return typeof s=="function"?s(Qe):(Ze=s&&(Qe==null?void 0:Qe[s]))!==null&&Ze!==void 0?Ze:lt},[s]),Ne=m.useCallback(a||function(Qe){return Qe},[a]);function Je(Qe,lt,Ze){me===Qe&&(lt===void 0||lt===oe)||(le(Qe),Ze||(De(QeN){Je(Be-1,Qe-$e-se+q);break}}S&&ke(0)+se>N&&de(null)}},[N,k,q,se,ze,Ie]);var Oe=Re&&!!Me.length,st={};oe!==null&&ve&&(st={position:"absolute",left:oe,top:0});var je={prefixCls:Ae,responsive:ve,component:v,invalidate:we},xt=l?function(Qe,lt){var Ze=ze(Qe,lt);return m.createElement(UG.Provider,{key:Ze,value:en(en({},je),{},{order:lt,item:Qe,itemKey:Ze,registerSize:nt,display:lt<=Te})},l(Qe,lt))}:function(Qe,lt){var Ze=ze(Qe,lt);return m.createElement(CE,go({},je,{order:lt,key:Ze,item:Qe,renderItem:Ne,itemKey:Ze,registerSize:nt,display:lt<=Te}))},gt,Ye={order:Oe?Te:Number.MAX_SAFE_INTEGER,className:"".concat(Ae,"-rest"),registerSize:We,display:Oe};if(y)y&&(gt=m.createElement(UG.Provider,{value:en(en({},je),Ye)},y(Me)));else{var it=A||pzt;gt=m.createElement(CE,go({},je,Ye),typeof it=="function"?it(Me):it)}var ut=m.createElement(P,go({className:Xn(!we&&o,p),style:f,ref:e},w),Ie.map(xt),Pe?gt:null,S&&m.createElement(CE,go({},je,{responsive:fe,responsiveDisabled:!ve,order:Te,className:"".concat(Ae,"-suffix"),registerSize:Ee,display:!0,style:st}),S));return fe&&(ut=m.createElement(Cd,{onResize:Ue,disabled:!ve},ut)),ut}var F2=m.forwardRef(gzt);F2.displayName="Overflow";F2.Item=PGe;F2.RESPONSIVE=CGe;F2.INVALIDATE=RGe;var mzt=function(e,n){var o,r=e.prefixCls,i=e.id,a=e.inputElement,l=e.disabled,s=e.tabIndex,c=e.autoFocus,u=e.autoComplete,d=e.editable,f=e.activeDescendantId,p=e.value,g=e.maxLength,A=e.onKeyDown,y=e.onMouseDown,S=e.onChange,C=e.onPaste,P=e.onCompositionStart,v=e.onCompositionEnd,T=e.open,w=e.attrs,x=a||m.createElement("input",null),b=x,R=b.ref,H=b.props,F=H.onKeyDown,E=H.onChange,N=H.onMouseDown,U=H.onCompositionStart,W=H.onCompositionEnd,k=H.style;return"maxLength"in x.props,x=m.cloneElement(x,en(en(en({type:"search"},H),{},{id:i,ref:jb(n,R),disabled:l,tabIndex:s,autoComplete:u||"off",autoFocus:c,className:Xn("".concat(r,"-selection-search-input"),(o=x)===null||o===void 0||(o=o.props)===null||o===void 0?void 0:o.className),role:"combobox","aria-expanded":T||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":T?f:void 0},w),{},{value:d?p:"",maxLength:g,readOnly:!d,unselectable:d?null:"on",style:en(en({},k),{},{opacity:d?null:0}),onKeyDown:function(L){A(L),F&&F(L)},onMouseDown:function(L){y(L),N&&N(L)},onChange:function(L){S(L),E&&E(L)},onCompositionStart:function(L){P(L),U&&U(L)},onCompositionEnd:function(L){v(L),W&&W(L)},onPaste:C})),x},HGe=m.forwardRef(mzt);function MGe(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var yzt=typeof window<"u"&&window.document&&window.document.documentElement,Azt=yzt;function wzt(t){return t!=null}function vzt(t){return!t&&t!==0}function bve(t){return["string","number"].includes(hi(t))}function IGe(t){var e=void 0;return t&&(bve(t.title)?e=t.title.toString():bve(t.label)&&(e=t.label.toString())),e}function xzt(t,e){Azt?m.useLayoutEffect(t,e):m.useEffect(t,e)}function bzt(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var Sve=function(e){e.preventDefault(),e.stopPropagation()},Szt=function(e){var n=e.id,o=e.prefixCls,r=e.values,i=e.open,a=e.searchValue,l=e.autoClearSearchValue,s=e.inputRef,c=e.placeholder,u=e.disabled,d=e.mode,f=e.showSearch,p=e.autoFocus,g=e.autoComplete,A=e.activeDescendantId,y=e.tabIndex,S=e.removeIcon,C=e.maxTagCount,P=e.maxTagTextLength,v=e.maxTagPlaceholder,T=v===void 0?function(de){return"+ ".concat(de.length," ...")}:v,w=e.tagRender,x=e.onToggleOpen,b=e.onRemove,R=e.onInputChange,H=e.onInputPaste,F=e.onInputKeyDown,E=e.onInputMouseDown,N=e.onInputCompositionStart,U=e.onInputCompositionEnd,W=m.useRef(null),k=m.useState(0),D=sn(k,2),L=D[0],j=D[1],B=m.useState(!1),O=sn(B,2),V=O[0],G=O[1],q="".concat(o,"-selection"),$=i||d==="multiple"&&l===!1||d==="tags"?a:"",ie=d==="tags"||d==="multiple"&&l===!1||f&&(i||V);xzt(function(){j(W.current.scrollWidth)},[$]);var Q=function(he,pe,me,le,Te){return m.createElement("span",{title:IGe(he),className:Xn("".concat(q,"-item"),Jt({},"".concat(q,"-item-disabled"),me))},m.createElement("span",{className:"".concat(q,"-item-content")},pe),le&&m.createElement(J$,{className:"".concat(q,"-item-remove"),onMouseDown:Sve,onClick:Te,customizeIcon:S},"×"))},se=function(he,pe,me,le,Te,ge){var Se=function(De){Sve(De),x(!i)};return m.createElement("span",{onMouseDown:Se},w({label:pe,value:he,disabled:me,closable:le,onClose:Te,isMaxTag:!!ge}))},Z=function(he){var pe=he.disabled,me=he.label,le=he.value,Te=!u&&!pe,ge=me;if(typeof P=="number"&&(typeof me=="string"||typeof me=="number")){var Se=String(ge);Se.length>P&&(ge="".concat(Se.slice(0,P),"..."))}var Re=function(Ae){Ae&&Ae.stopPropagation(),b(he)};return typeof w=="function"?se(le,ge,pe,Te,Re):Q(he,ge,pe,Te,Re)},ee=function(he){var pe=typeof T=="function"?T(he):T;return typeof w=="function"?se(void 0,pe,!1,!1,void 0,!0):Q({title:pe},pe,!1)},te=m.createElement("div",{className:"".concat(q,"-search"),style:{width:L},onFocus:function(){G(!0)},onBlur:function(){G(!1)}},m.createElement(HGe,{ref:s,open:i,prefixCls:o,id:n,inputElement:null,disabled:u,autoFocus:p,autoComplete:g,editable:ie,activeDescendantId:A,value:$,onKeyDown:F,onMouseDown:E,onChange:R,onPaste:H,onCompositionStart:N,onCompositionEnd:U,tabIndex:y,attrs:bf(e,!0)}),m.createElement("span",{ref:W,className:"".concat(q,"-search-mirror"),"aria-hidden":!0},$," ")),oe=m.createElement(F2,{prefixCls:"".concat(q,"-overflow"),data:r,renderItem:Z,renderRest:ee,suffix:te,itemKey:bzt,maxCount:C});return m.createElement(m.Fragment,null,oe,!r.length&&!$&&m.createElement("span",{className:"".concat(q,"-placeholder")},c))},Tzt=function(e){var n=e.inputElement,o=e.prefixCls,r=e.id,i=e.inputRef,a=e.disabled,l=e.autoFocus,s=e.autoComplete,c=e.activeDescendantId,u=e.mode,d=e.open,f=e.values,p=e.placeholder,g=e.tabIndex,A=e.showSearch,y=e.searchValue,S=e.activeValue,C=e.maxLength,P=e.onInputKeyDown,v=e.onInputMouseDown,T=e.onInputChange,w=e.onInputPaste,x=e.onInputCompositionStart,b=e.onInputCompositionEnd,R=e.title,H=m.useState(!1),F=sn(H,2),E=F[0],N=F[1],U=u==="combobox",W=U||A,k=f[0],D=y||"";U&&S&&!E&&(D=S),m.useEffect(function(){U&&N(!1)},[U,S]);var L=u!=="combobox"&&!d&&!A?!1:!!D,j=R===void 0?IGe(k):R,B=m.useMemo(function(){return k?null:m.createElement("span",{className:"".concat(o,"-selection-placeholder"),style:L?{visibility:"hidden"}:void 0},p)},[k,L,p,o]);return m.createElement(m.Fragment,null,m.createElement("span",{className:"".concat(o,"-selection-search")},m.createElement(HGe,{ref:i,prefixCls:o,id:r,open:d,inputElement:n,disabled:a,autoFocus:l,autoComplete:s,editable:W,activeDescendantId:c,value:D,onKeyDown:P,onMouseDown:v,onChange:function(V){N(!0),T(V)},onPaste:w,onCompositionStart:x,onCompositionEnd:b,tabIndex:g,attrs:bf(e,!0),maxLength:U?C:void 0})),!U&&k?m.createElement("span",{className:"".concat(o,"-selection-item"),title:j,style:L?{visibility:"hidden"}:void 0},k.label):null,B)},Pzt=function(e,n){var o=m.useRef(null),r=m.useRef(!1),i=e.prefixCls,a=e.open,l=e.mode,s=e.showSearch,c=e.tokenWithEnter,u=e.disabled,d=e.autoClearSearchValue,f=e.onSearch,p=e.onSearchSubmit,g=e.onToggleOpen,A=e.onInputKeyDown,y=e.domRef;m.useImperativeHandle(n,function(){return{focus:function(L){o.current.focus(L)},blur:function(){o.current.blur()}}});var S=TGe(0),C=sn(S,2),P=C[0],v=C[1],T=function(L){var j=L.which;(j===jn.UP||j===jn.DOWN)&&L.preventDefault(),A&&A(L),j===jn.ENTER&&l==="tags"&&!r.current&&!a&&(p==null||p(L.target.value)),rzt(j)&&g(!0)},w=function(){v(!0)},x=m.useRef(null),b=function(L){f(L,!0,r.current)!==!1&&g(!0)},R=function(){r.current=!0},H=function(L){r.current=!1,l!=="combobox"&&b(L.target.value)},F=function(L){var j=L.target.value;if(c&&x.current&&/[\r\n]/.test(x.current)){var B=x.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");j=j.replace(B,x.current)}x.current=null,b(j)},E=function(L){var j=L.clipboardData,B=j==null?void 0:j.getData("text");x.current=B||""},N=function(L){var j=L.target;if(j!==o.current){var B=document.body.style.msTouchAction!==void 0;B?setTimeout(function(){o.current.focus()}):o.current.focus()}},U=function(L){var j=P();L.target!==o.current&&!j&&!(l==="combobox"&&u)&&L.preventDefault(),(l!=="combobox"&&(!s||!j)||!a)&&(a&&d!==!1&&f("",!0,!1),g())},W={inputRef:o,onInputKeyDown:T,onInputMouseDown:w,onInputChange:F,onInputPaste:E,onInputCompositionStart:R,onInputCompositionEnd:H},k=l==="multiple"||l==="tags"?m.createElement(Szt,go({},e,W)):m.createElement(Tzt,go({},e,W));return m.createElement("div",{ref:y,className:"".concat(i,"-selector"),onClick:N,onMouseDown:U},k)},Czt=m.forwardRef(Pzt);function uk(t){"@babel/helpers - typeof";return uk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uk(t)}function Rzt(t,e){if(uk(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(uk(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hzt(t){var e=Rzt(t,"string");return uk(e)==="symbol"?e:String(e)}function Mzt(t,e,n){return e=Hzt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function tp(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function Fzt(t,e){if(t==null)return{};var n=Ezt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function jG(){return jG=Object.assign?Object.assign.bind():function(t){for(var e=1;e0,G=m.useState(!P||!V),q=rf(G,2),$=q[0],ie=q[1];if(_a(function(){!$&&V&&a&&ie(!0)},[$,V,a]),!$)return null;var Q="auto",se={left:"-1000vw",top:"-1000vh",right:Q,bottom:Q};if(H||!s){var Z,ee=A.points,te=A.dynamicInset||((Z=A._experimental)===null||Z===void 0?void 0:Z.dynamicInset),oe=te&&ee[0][1]==="r",de=te&&ee[0][0]==="b";oe?(se.right=N,se.left=Q):(se.left=F,se.right=Q),de?(se.bottom=U,se.top=Q):(se.top=E,se.bottom=Q)}var he={};return D&&(D.includes("height")&&j?he.height=j:D.includes("minHeight")&&j&&(he.minHeight=j),D.includes("width")&&L?he.width=L:D.includes("minWidth")&&L&&(he.minWidth=L)),s||(he.pointerEvents="none"),m.createElement(T,{open:C||O,getContainer:P&&function(){return P(a)},autoDestroy:v},m.createElement(Lzt,{prefixCls:r,open:s,zIndex:w,mask:f,motion:S}),m.createElement(Cd,{onResize:W,disabled:!s},function(pe){return m.createElement(o1,jG({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:C,leavedClassName:"".concat(r,"-hidden")},y,{onAppearPrepare:k,onEnterPrepare:k,visible:s,onVisibleChanged:function(le){var Te;y==null||(Te=y.onVisibleChanged)===null||Te===void 0||Te.call(y,le),l(le)}}),function(me,le){var Te=me.className,ge=me.style,Se=Xn(r,Te,o);return m.createElement("div",{ref:jb(pe,e,le),className:Se,style:tp(tp(tp(tp({"--arrow-x":"".concat(g.x||0,"px"),"--arrow-y":"".concat(g.y||0,"px")},se),he),ge),{},{boxSizing:"border-box",zIndex:w},i),onMouseEnter:x,onMouseLeave:b,onPointerEnter:R,onClick:d},p&&m.createElement(kzt,{prefixCls:r,arrow:p,arrowPos:g,align:A}),m.createElement(Wzt,{cache:!s&&!u},B))})}))}),Uzt=m.forwardRef(function(t,e){var n=t.children,o=t.getTriggerDOMNode,r=sw(n),i=m.useCallback(function(l){ZF(e,o?o(l):l)},[o]),a=Nw(i,n.ref);return r?m.cloneElement(n,{ref:a}):n}),Pve=m.createContext(null);function Cve(t){return t?Array.isArray(t)?t:[t]:[]}function jzt(t,e,n,o){return m.useMemo(function(){var r=Cve(n??e),i=Cve(o??e),a=new Set(r),l=new Set(i);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),l.has("hover")&&(l.delete("hover"),l.add("click"))),[a,l]},[t,e,n,o])}const K$=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};function Bzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function Yzt(t,e,n,o){for(var r=n.points,i=Object.keys(t),a=0;a1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function Lz(t){return dk(parseFloat(t),0)}function Hve(t,e){var n=tp({},t);return(e||[]).forEach(function(o){if(!(o instanceof HTMLBodyElement||o instanceof HTMLHtmlElement)){var r=JW(o).getComputedStyle(o),i=r.overflow,a=r.overflowClipMargin,l=r.borderTopWidth,s=r.borderBottomWidth,c=r.borderLeftWidth,u=r.borderRightWidth,d=o.getBoundingClientRect(),f=o.offsetHeight,p=o.clientHeight,g=o.offsetWidth,A=o.clientWidth,y=Lz(l),S=Lz(s),C=Lz(c),P=Lz(u),v=dk(Math.round(d.width/g*1e3)/1e3),T=dk(Math.round(d.height/f*1e3)/1e3),w=(g-A-C-P)*v,x=(f-p-y-S)*T,b=y*T,R=S*T,H=C*v,F=P*v,E=0,N=0;if(i==="clip"){var U=Lz(a);E=U*v,N=U*T}var W=d.x+H-E,k=d.y+b-N,D=W+d.width+2*E-H-F-w,L=k+d.height+2*N-b-R-x;n.left=Math.max(n.left,W),n.top=Math.max(n.top,k),n.right=Math.min(n.right,D),n.bottom=Math.min(n.bottom,L)}}),n}function Mve(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),o=n.match(/^(.*)\%$/);return o?t*(parseFloat(o[1])/100):parseFloat(n)}function Ive(t,e){var n=e||[],o=rf(n,2),r=o[0],i=o[1];return[Mve(t.width,r),Mve(t.height,i)]}function zve(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function kT(t,e){var n=e[0],o=e[1],r,i;return n==="t"?i=t.y:n==="b"?i=t.y+t.height:i=t.y+t.height/2,o==="l"?r=t.x:o==="r"?r=t.x+t.width:r=t.x+t.width/2,{x:r,y:i}}function C4(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(o,r){return r===e?n[o]||"c":o}).join("")}function Ozt(t,e,n,o,r,i,a){var l=m.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:r[o]||{}}),s=rf(l,2),c=s[0],u=s[1],d=m.useRef(0),f=m.useMemo(function(){return e?Q0e(e):[]},[e]),p=m.useRef({}),g=function(){p.current={}};t||g();var A=za(function(){if(e&&n&&t){let So=function(Yo,lr){var fr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Se,ei=B.x+Yo,hr=B.y+lr,tr=ei+Z,bi=hr+se,Fo=Math.max(ei,fr.left),Si=Math.max(hr,fr.top),hl=Math.min(tr,fr.right),nr=Math.min(bi,fr.bottom);return Math.max(0,(hl-Fo)*(nr-Si))},Qo=function(){Wt=B.y+it,ht=Wt+se,ct=B.x+Ye,It=ct+Z};var Bn=So,Ko=Qo,C,P,v=e,T=v.ownerDocument,w=JW(v),x=w.getComputedStyle(v),b=x.width,R=x.height,H=x.position,F=v.style.left,E=v.style.top,N=v.style.right,U=v.style.bottom,W=v.style.overflow,k=tp(tp({},r[o]),i),D=T.createElement("div");(C=v.parentElement)===null||C===void 0||C.appendChild(D),D.style.left="".concat(v.offsetLeft,"px"),D.style.top="".concat(v.offsetTop,"px"),D.style.position=H,D.style.height="".concat(v.offsetHeight,"px"),D.style.width="".concat(v.offsetWidth,"px"),v.style.left="0",v.style.top="0",v.style.right="auto",v.style.bottom="auto",v.style.overflow="hidden";var L;if(Array.isArray(n))L={x:n[0],y:n[1],width:0,height:0};else{var j=n.getBoundingClientRect();L={x:j.x,y:j.y,width:j.width,height:j.height}}var B=v.getBoundingClientRect(),O=T.documentElement,V=O.clientWidth,G=O.clientHeight,q=O.scrollWidth,$=O.scrollHeight,ie=O.scrollTop,Q=O.scrollLeft,se=B.height,Z=B.width,ee=L.height,te=L.width,oe={left:0,top:0,right:V,bottom:G},de={left:-Q,top:-ie,right:q-Q,bottom:$-ie},he=k.htmlRegion,pe="visible",me="visibleFirst";he!=="scroll"&&he!==me&&(he=pe);var le=he===me,Te=Hve(de,f),ge=Hve(oe,f),Se=he===pe?ge:Te,Re=le?ge:Se;v.style.left="auto",v.style.top="auto",v.style.right="0",v.style.bottom="0";var De=v.getBoundingClientRect();v.style.left=F,v.style.top=E,v.style.right=N,v.style.bottom=U,v.style.overflow=W,(P=v.parentElement)===null||P===void 0||P.removeChild(D);var Ae=dk(Math.round(Z/parseFloat(b)*1e3)/1e3),ue=dk(Math.round(se/parseFloat(R)*1e3)/1e3);if(Ae===0||ue===0||TG(n)&&!K$(n))return;var fe=k.offset,ve=k.targetOffset,we=Ive(B,fe),Pe=rf(we,2),Ie=Pe[0],Me=Pe[1],ze=Ive(L,ve),Ne=rf(ze,2),Je=Ne[0],Ue=Ne[1];L.x-=Je,L.y-=Ue;var nt=k.points||[],We=rf(nt,2),Ee=We[0],ke=We[1],Oe=zve(ke),st=zve(Ee),je=kT(L,Oe),xt=kT(B,st),gt=tp({},k),Ye=je.x-xt.x+Ie,it=je.y-xt.y+Me,ut=So(Ye,it),Qe=So(Ye,it,ge),lt=kT(L,["t","l"]),Ze=kT(B,["t","l"]),Be=kT(L,["b","r"]),$e=kT(B,["b","r"]),wt=k.overflow||{},vt=wt.adjustX,Rt=wt.adjustY,Gt=wt.shiftX,At=wt.shiftY,pt=function(lr){return typeof lr=="boolean"?lr:lr>=0},Wt,ht,ct,It;Qo();var Ft=pt(Rt),Ve=st[0]===Oe[0];if(Ft&&st[0]==="t"&&(ht>Re.bottom||p.current.bt)){var ft=it;Ve?ft-=se-ee:ft=lt.y-$e.y-Me;var kt=So(Ye,ft),rt=So(Ye,ft,ge);kt>ut||kt===ut&&(!le||rt>=Qe)?(p.current.bt=!0,it=ft,Me=-Me,gt.points=[C4(st,0),C4(Oe,0)]):p.current.bt=!1}if(Ft&&st[0]==="b"&&(Wtut||Ge===ut&&(!le||yt>=Qe)?(p.current.tb=!0,it=at,Me=-Me,gt.points=[C4(st,0),C4(Oe,0)]):p.current.tb=!1}var Pt=pt(vt),ot=st[1]===Oe[1];if(Pt&&st[1]==="l"&&(It>Re.right||p.current.rl)){var bt=Ye;ot?bt-=Z-te:bt=lt.x-$e.x-Ie;var zt=So(bt,it),Bt=So(bt,it,ge);zt>ut||zt===ut&&(!le||Bt>=Qe)?(p.current.rl=!0,Ye=bt,Ie=-Ie,gt.points=[C4(st,1),C4(Oe,1)]):p.current.rl=!1}if(Pt&&st[1]==="r"&&(ctut||Ht===ut&&(!le||_t>=Qe)?(p.current.lr=!0,Ye=tt,Ie=-Ie,gt.points=[C4(st,1),C4(Oe,1)]):p.current.lr=!1}Qo();var qt=Gt===!0?0:Gt;typeof qt=="number"&&(ctge.right&&(Ye-=It-ge.right-Ie,L.x>ge.right-qt&&(Ye+=L.x-ge.right+qt)));var un=At===!0?0:At;typeof un=="number"&&(Wtge.bottom&&(it-=ht-ge.bottom-Me,L.y>ge.bottom-un&&(it+=L.y-ge.bottom+un)));var Rn=B.x+Ye,yo=Rn+Z,Ao=B.y+it,wo=Ao+se,Io=L.x,po=Io+te,On=L.y,fo=On+ee,ir=Math.max(Rn,Io),Rr=Math.min(yo,po),br=(ir+Rr)/2,_r=br-Rn,jo=Math.max(Ao,On),wn=Math.min(wo,fo),In=(jo+wn)/2,ar=In-Ao;a==null||a(e,gt);var Wo=De.right-B.x-(Ye+B.width),to=De.bottom-B.y-(it+B.height);u({ready:!0,offsetX:Ye/Ae,offsetY:it/ue,offsetR:Wo/Ae,offsetB:to/ue,arrowX:_r/Ae,arrowY:ar/ue,scaleX:Ae,scaleY:ue,align:gt})}}),y=function(){d.current+=1;var P=d.current;Promise.resolve().then(function(){d.current===P&&A()})},S=function(){u(function(P){return tp(tp({},P),{},{ready:!1})})};return _a(S,[o]),_a(function(){t||S()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,y]}function Vzt(t){if(Array.isArray(t))return $0e(t)}function _zt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Gzt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dve(t){return Vzt(t)||_zt(t)||zGe(t)||Gzt()}function Xzt(t,e,n,o,r){_a(function(){if(t&&e&&n){let f=function(){o(),r()};var d=f,i=e,a=n,l=Q0e(i),s=Q0e(a),c=JW(a),u=new Set([c].concat(Dve(l),Dve(s)));return u.forEach(function(p){p.addEventListener("scroll",f,{passive:!0})}),c.addEventListener("resize",f,{passive:!0}),o(),function(){u.forEach(function(p){p.removeEventListener("scroll",f),c.removeEventListener("resize",f)})}}},[t,e,n])}function Jzt(t,e,n,o,r,i,a,l){var s=m.useRef(t);s.current=t,m.useEffect(function(){if(e&&o&&(!r||i)){var c=function(p){var g=p.target;s.current&&!a(g)&&l(!1)},u=JW(o);u.addEventListener("mousedown",c,!0),u.addEventListener("contextmenu",c,!0);var d=kG(n);return d&&(d.addEventListener("mousedown",c,!0),d.addEventListener("contextmenu",c,!0)),function(){u.removeEventListener("mousedown",c,!0),u.removeEventListener("contextmenu",c,!0),d&&(d.removeEventListener("mousedown",c,!0),d.removeEventListener("contextmenu",c,!0))}}},[e,n,o,r,i])}var Kzt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function qzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B$,e=m.forwardRef(function(n,o){var r=n.prefixCls,i=r===void 0?"rc-trigger-popup":r,a=n.children,l=n.action,s=l===void 0?"hover":l,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,g=n.afterPopupVisibleChange,A=n.mouseEnterDelay,y=n.mouseLeaveDelay,S=y===void 0?.1:y,C=n.focusDelay,P=n.blurDelay,v=n.mask,T=n.maskClosable,w=T===void 0?!0:T,x=n.getPopupContainer,b=n.forceRender,R=n.autoDestroy,H=n.destroyPopupOnHide,F=n.popup,E=n.popupClassName,N=n.popupStyle,U=n.popupPlacement,W=n.builtinPlacements,k=W===void 0?{}:W,D=n.popupAlign,L=n.zIndex,j=n.stretch,B=n.getPopupClassNameFromAlign,O=n.fresh,V=n.alignPoint,G=n.onPopupClick,q=n.onPopupAlign,$=n.arrow,ie=n.popupMotion,Q=n.maskMotion,se=n.popupTransitionName,Z=n.popupAnimation,ee=n.maskTransitionName,te=n.maskAnimation,oe=n.className,de=n.getTriggerDOMNode,he=Fzt(n,Kzt),pe=R||H||!1,me=m.useState(!1),le=rf(me,2),Te=le[0],ge=le[1];_a(function(){ge(X$())},[]);var Se=m.useRef({}),Re=m.useContext(Pve),De=m.useMemo(function(){return{registerSubPopup:function(or,Ai){Se.current[or]=Ai,Re==null||Re.registerSubPopup(or,Ai)}}},[Re]),Ae=V_e(),ue=m.useState(null),fe=rf(ue,2),ve=fe[0],we=fe[1],Pe=m.useRef(null),Ie=za(function(nr){Pe.current=nr,TG(nr)&&ve!==nr&&we(nr),Re==null||Re.registerSubPopup(Ae,nr)}),Me=m.useState(null),ze=rf(Me,2),Ne=ze[0],Je=ze[1],Ue=m.useRef(null),nt=za(function(nr){TG(nr)&&Ne!==nr&&(Je(nr),Ue.current=nr)}),We=m.Children.only(a),Ee=(We==null?void 0:We.props)||{},ke={},Oe=za(function(nr){var or,Ai,Fa=Ne;return(Fa==null?void 0:Fa.contains(nr))||((or=kG(Fa))===null||or===void 0?void 0:or.host)===nr||nr===Fa||(ve==null?void 0:ve.contains(nr))||((Ai=kG(ve))===null||Ai===void 0?void 0:Ai.host)===nr||nr===ve||Object.values(Se.current).some(function(wi){return(wi==null?void 0:wi.contains(nr))||nr===wi})}),st=Rve(i,ie,Z,se),je=Rve(i,Q,te,ee),xt=m.useState(f||!1),gt=rf(xt,2),Ye=gt[0],it=gt[1],ut=d??Ye,Qe=za(function(nr){d===void 0&&it(nr)});_a(function(){it(d||!1)},[d]);var lt=m.useRef(ut);lt.current=ut;var Ze=m.useRef([]);Ze.current=[];var Be=za(function(nr){var or;Qe(nr),((or=Ze.current[Ze.current.length-1])!==null&&or!==void 0?or:ut)!==nr&&(Ze.current.push(nr),p==null||p(nr))}),$e=m.useRef(),wt=function(){clearTimeout($e.current)},vt=function(or){var Ai=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;wt(),Ai===0?Be(or):$e.current=setTimeout(function(){Be(or)},Ai*1e3)};m.useEffect(function(){return wt},[]);var Rt=m.useState(!1),Gt=rf(Rt,2),At=Gt[0],pt=Gt[1];_a(function(nr){(!nr||ut)&&pt(!0)},[ut]);var Wt=m.useState(null),ht=rf(Wt,2),ct=ht[0],It=ht[1],Ft=m.useState([0,0]),Ve=rf(Ft,2),ft=Ve[0],kt=Ve[1],rt=function(or){kt([or.clientX,or.clientY])},at=Ozt(ut,ve,V?ft:Ne,U,k,D,q),Ge=rf(at,11),yt=Ge[0],Pt=Ge[1],ot=Ge[2],bt=Ge[3],zt=Ge[4],Bt=Ge[5],tt=Ge[6],Ht=Ge[7],_t=Ge[8],qt=Ge[9],un=Ge[10],Rn=jzt(Te,s,c,u),yo=rf(Rn,2),Ao=yo[0],wo=yo[1],Io=Ao.has("click"),po=wo.has("click")||wo.has("contextMenu"),On=za(function(){At||un()}),fo=function(){lt.current&&V&&po&&vt(!1)};Xzt(ut,Ne,ve,On,fo),_a(function(){On()},[ft,U]),_a(function(){ut&&!(k!=null&&k[U])&&On()},[JSON.stringify(D)]);var ir=m.useMemo(function(){var nr=Yzt(k,i,qt,V);return Xn(nr,B==null?void 0:B(qt))},[qt,B,k,i,V]);m.useImperativeHandle(o,function(){return{nativeElement:Ue.current,popupElement:Pe.current,forceAlign:On}});var Rr=m.useState(0),br=rf(Rr,2),_r=br[0],jo=br[1],wn=m.useState(0),In=rf(wn,2),ar=In[0],Wo=In[1],to=function(){if(j&&Ne){var or=Ne.getBoundingClientRect();jo(or.width),Wo(or.height)}},Bn=function(){to(),On()},Ko=function(or){pt(!1),un(),g==null||g(or)},So=function(){return new Promise(function(or){to(),It(function(){return or})})};_a(function(){ct&&(un(),ct(),It(null))},[ct]);function Qo(nr,or,Ai,Fa){ke[nr]=function(wi){var Fs;Fa==null||Fa(wi),vt(or,Ai);for(var ks=arguments.length,Zs=new Array(ks>1?ks-1:0),Yi=1;Yi1?Ai-1:0),wi=1;wi1?Ai-1:0),wi=1;wi1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,o=e.childrenAsData,r=[],i=DGe(n,!1),a=i.label,l=i.value,s=i.options,c=i.groupLabel;function u(d,f){Array.isArray(d)&&d.forEach(function(p){if(f||!(s in p)){var g=p[l];r.push({key:Eve(p,r.length),groupOption:f,data:p,label:p[a],value:g})}else{var A=p[c];A===void 0&&o&&(A=p.label),r.push({key:Eve(p,r.length),group:!0,data:p,label:A}),u(p[s],!0)}})}return u(t,!1),r}function eue(t){var e=en({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return U0(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var nDt=function(e,n,o){if(!n||!n.length)return null;var r=!1,i=function l(s,c){var u=eGe(c),d=u[0],f=u.slice(1);if(!d)return[s];var p=s.split(d);return r=r||p.length>1,p.reduce(function(g,A){return[].concat(No(g),No(l(A,f)))},[]).filter(Boolean)},a=i(e,n);return r?typeof o<"u"?a.slice(0,o):a:null},Lme=m.createContext(null),oDt=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],rDt=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],tue=function(e){return e==="tags"||e==="multiple"},iDt=m.forwardRef(function(t,e){var n,o=t.id,r=t.prefixCls,i=t.className,a=t.showSearch,l=t.tagRender,s=t.direction,c=t.omitDomProps,u=t.displayValues,d=t.onDisplayValuesChange,f=t.emptyOptions,p=t.notFoundContent,g=p===void 0?"Not Found":p,A=t.onClear,y=t.mode,S=t.disabled,C=t.loading,P=t.getInputElement,v=t.getRawInputElement,T=t.open,w=t.defaultOpen,x=t.onDropdownVisibleChange,b=t.activeValue,R=t.onActiveValueChange,H=t.activeDescendantId,F=t.searchValue,E=t.autoClearSearchValue,N=t.onSearch,U=t.onSearchSplit,W=t.tokenSeparators,k=t.allowClear,D=t.suffixIcon,L=t.clearIcon,j=t.OptionList,B=t.animation,O=t.transitionName,V=t.dropdownStyle,G=t.dropdownClassName,q=t.dropdownMatchSelectWidth,$=t.dropdownRender,ie=t.dropdownAlign,Q=t.placement,se=t.builtinPlacements,Z=t.getPopupContainer,ee=t.showAction,te=ee===void 0?[]:ee,oe=t.onFocus,de=t.onBlur,he=t.onKeyUp,pe=t.onKeyDown,me=t.onMouseDown,le=oi(t,oDt),Te=tue(y),ge=(a!==void 0?a:Te)||y==="combobox",Se=en({},le);rDt.forEach(function(On){delete Se[On]}),c==null||c.forEach(function(On){delete Se[On]});var Re=m.useState(!1),De=sn(Re,2),Ae=De[0],ue=De[1];m.useEffect(function(){ue(X$())},[]);var fe=m.useRef(null),ve=m.useRef(null),we=m.useRef(null),Pe=m.useRef(null),Ie=m.useRef(null),Me=m.useRef(!1),ze=nzt(),Ne=sn(ze,3),Je=Ne[0],Ue=Ne[1],nt=Ne[2];m.useImperativeHandle(e,function(){var On,fo;return{focus:(On=Pe.current)===null||On===void 0?void 0:On.focus,blur:(fo=Pe.current)===null||fo===void 0?void 0:fo.blur,scrollTo:function(Rr){var br;return(br=Ie.current)===null||br===void 0?void 0:br.scrollTo(Rr)}}});var We=m.useMemo(function(){var On;if(y!=="combobox")return F;var fo=(On=u[0])===null||On===void 0?void 0:On.value;return typeof fo=="string"||typeof fo=="number"?String(fo):""},[F,y,u]),Ee=y==="combobox"&&typeof P=="function"&&P()||null,ke=typeof v=="function"&&v(),Oe=Nw(ve,ke==null||(n=ke.props)===null||n===void 0?void 0:n.ref),st=m.useState(!1),je=sn(st,2),xt=je[0],gt=je[1];_a(function(){gt(!0)},[]);var Ye=Es(!1,{defaultValue:w,value:T}),it=sn(Ye,2),ut=it[0],Qe=it[1],lt=xt?ut:!1,Ze=!g&&f;(S||Ze&<&&y==="combobox")&&(lt=!1);var Be=Ze?!1:lt,$e=m.useCallback(function(On){var fo=On!==void 0?On:!lt;S||(Qe(fo),lt!==fo&&(x==null||x(fo)))},[S,lt,Qe,x]),wt=m.useMemo(function(){return(W||[]).some(function(On){return[` + ${u}-confirm ${u}-body > ${t.iconCls}`]:{color:t.colorWarning},[`${u}-info ${u}-body > ${t.iconCls}`]:{color:t.colorInfo},[`${u}-success ${u}-body > ${t.iconCls}`]:{color:t.colorSuccess}}},OIt=LW(["Modal","confirm"],t=>{const e=cGe(t);return[YIt(e)]},uGe,{order:-1e3});var VIt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rC,Qa(Object.values(C))),v=m.createElement(m.Fragment,null,m.createElement(B7e,null),m.createElement(Y7e,null)),T=t.title!==void 0&&t.title!==null,w=`${i}-body`;return m.createElement("div",{className:`${i}-body-wrapper`},m.createElement("div",{className:Un(w,{[`${w}-has-title`]:T})},d,m.createElement("div",{className:`${i}-paragraph`},T&&m.createElement("span",{className:`${i}-title`},t.title),m.createElement("div",{className:`${i}-content`},t.content))),s===void 0||typeof s=="function"?m.createElement(B_e,{value:P},m.createElement("div",{className:`${i}-btns`},typeof s=="function"?s(v,{OkBtn:Y7e,CancelBtn:B7e}):v)):s,m.createElement(OIt,{prefixCls:e}))}const _It=t=>{const{close:e,zIndex:n,afterClose:o,open:r,keyboard:i,centered:a,getContainer:l,maskStyle:s,direction:c,prefixCls:u,wrapClassName:d,rootPrefixCls:f,bodyStyle:p,closable:g=!1,closeIcon:A,modalRender:y,focusTriggerAfterClose:S,onConfirm:C,styles:P}=t,v=`${u}-confirm`,T=t.width||416,w=t.style||{},x=t.mask===void 0?!0:t.mask,b=t.maskClosable===void 0?!1:t.maskClosable,R=Un(v,`${v}-${t.type}`,{[`${v}-rtl`]:c==="rtl"},t.className),[,H]=Vu(),F=m.useMemo(()=>n!==void 0?n:H.zIndexPopupBase+Cme,[n,H]);return m.createElement(fGe,{prefixCls:u,className:R,wrapClassName:Un({[`${v}-centered`]:!!t.centered},d),onCancel:()=>{e==null||e({triggerCancel:!0}),C==null||C(!1)},open:r,title:"",footer:null,transitionName:B9(f||"","zoom",t.transitionName),maskTransitionName:B9(f||"","fade",t.maskTransitionName),mask:x,maskClosable:b,style:w,styles:Object.assign({body:p,mask:s},P),width:T,zIndex:F,afterClose:o,keyboard:i,centered:a,getContainer:l,closable:g,closeIcon:A,modalRender:y,focusTriggerAfterClose:S},m.createElement(hGe,Object.assign({},t,{confirmPrefixCls:v})))},pGe=t=>{const{rootPrefixCls:e,iconPrefixCls:n,direction:o,theme:r}=t;return m.createElement(fy,{prefixCls:e,iconPrefixCls:n,direction:o,theme:r},m.createElement(_It,Object.assign({},t)))},Yv=[];let gGe="";function mGe(){return gGe}const GIt=t=>{var e,n;const{prefixCls:o,getContainer:r,direction:i}=t,a=xVe(),l=m.useContext(Cr),s=mGe()||l.getPrefixCls(),c=o||`${s}-modal`;let u=r;return u===!1&&(u=void 0),be.createElement(pGe,Object.assign({},t,{rootPrefixCls:s,prefixCls:c,iconPrefixCls:l.iconPrefixCls,theme:l.theme,direction:i??l.direction,locale:(n=(e=l.locale)===null||e===void 0?void 0:e.Modal)!==null&&n!==void 0?n:a,getContainer:u}))};function GW(t){const e=u_e(),n=document.createDocumentFragment();let o=Object.assign(Object.assign({},t),{close:l,open:!0}),r;function i(){for(var c=arguments.length,u=new Array(c),d=0;dp&&p.triggerCancel);t.onCancel&&f&&t.onCancel.apply(t,[()=>{}].concat(Qa(u.slice(1))));for(let p=0;p{const u=e.getPrefixCls(void 0,mGe()),d=e.getIconPrefixCls(),f=e.getTheme(),p=be.createElement(GIt,Object.assign({},c));Hme(be.createElement(fy,{prefixCls:u,iconPrefixCls:d,theme:f},e.holderRender?e.holderRender(p):p),n)})}function l(){for(var c=arguments.length,u=new Array(c),d=0;d{typeof t.afterClose=="function"&&t.afterClose(),i.apply(this,u)}}),o.visible&&delete o.visible,a(o)}function s(c){typeof c=="function"?o=c(o):o=Object.assign(Object.assign({},o),c),a(o)}return a(o),Yv.push(l),{destroy:l,update:s}}function yGe(t){return Object.assign(Object.assign({},t),{type:"warning"})}function AGe(t){return Object.assign(Object.assign({},t),{type:"info"})}function wGe(t){return Object.assign(Object.assign({},t),{type:"success"})}function vGe(t){return Object.assign(Object.assign({},t),{type:"error"})}function xGe(t){return Object.assign(Object.assign({},t),{type:"confirm"})}function XIt(t){let{rootPrefixCls:e}=t;gGe=e}var JIt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,{afterClose:o,config:r}=t,i=JIt(t,["afterClose","config"]);const[a,l]=m.useState(!0),[s,c]=m.useState(r),{direction:u,getPrefixCls:d}=m.useContext(Cr),f=d("modal"),p=d(),g=()=>{var C;o(),(C=s.afterClose)===null||C===void 0||C.call(s)},A=function(){l(!1);for(var C=arguments.length,P=new Array(C),v=0;vw&&w.triggerCancel);s.onCancel&&T&&s.onCancel.apply(s,[()=>{}].concat(Qa(P.slice(1))))};m.useImperativeHandle(e,()=>({destroy:A,update:C=>{c(P=>Object.assign(Object.assign({},P),C))}}));const y=(n=s.okCancel)!==null&&n!==void 0?n:s.type==="confirm",[S]=Uw("Modal",uw.Modal);return m.createElement(pGe,Object.assign({prefixCls:f,rootPrefixCls:p},s,{close:A,open:a,afterClose:g,okText:s.okText||(y?S==null?void 0:S.okText:S==null?void 0:S.justOkText),direction:s.direction||u,cancelText:s.cancelText||(S==null?void 0:S.cancelText)},i))},qIt=m.forwardRef(KIt);let xve=0;const $It=m.memo(m.forwardRef((t,e)=>{const[n,o]=NRt();return m.useImperativeHandle(e,()=>({patchElement:o}),[]),m.createElement(m.Fragment,null,n)}));function QIt(){const t=m.useRef(null),[e,n]=m.useState([]);m.useEffect(()=>{e.length&&(Qa(e).forEach(a=>{a()}),n([]))},[e]);const o=m.useCallback(i=>function(l){var s;xve+=1;const c=m.createRef();let u;const d=new Promise(y=>{u=y});let f=!1,p;const g=m.createElement(qIt,{key:`modal-${xve}`,config:i(l),ref:c,afterClose:()=>{p==null||p()},isSilent:()=>f,onConfirm:y=>{u(y)}});return p=(s=t.current)===null||s===void 0?void 0:s.patchElement(g),p&&Yv.push(p),{destroy:()=>{function y(){var S;(S=c.current)===null||S===void 0||S.destroy()}c.current?y():n(S=>[].concat(Qa(S),[y]))},update:y=>{function S(){var C;(C=c.current)===null||C===void 0||C.update(y)}c.current?S():n(C=>[].concat(Qa(C),[S]))},then:y=>(f=!0,d.then(y))}},[]);return[m.useMemo(()=>({info:o(AGe),success:o(wGe),error:o(vGe),warning:o(yGe),confirm:o(xGe)}),[]),m.createElement($It,{key:"modal-holder",ref:t})]}const ZIt=be.createContext({});function bGe(t){return e=>m.createElement(fy,{theme:{token:{motion:!1,zIndexPopupBase:0}}},m.createElement(t,Object.assign({},e)))}const XW=(t,e,n,o)=>bGe(i=>{const{prefixCls:a,style:l}=i,s=m.useRef(null),[c,u]=m.useState(0),[d,f]=m.useState(0),[p,g]=Z6(!1,{value:i.open}),{getPrefixCls:A}=m.useContext(Cr),y=A(e||"select",a);m.useEffect(()=>{if(g(!0),typeof ResizeObserver<"u"){const P=new ResizeObserver(T=>{const w=T[0].target;u(w.offsetHeight+8),f(w.offsetWidth)}),v=setInterval(()=>{var T;const w=n?`.${n(y)}`:`.${y}-dropdown`,x=(T=s.current)===null||T===void 0?void 0:T.querySelector(w);x&&(clearInterval(v),P.observe(x))},10);return()=>{clearInterval(v),P.disconnect()}}},[]);let S=Object.assign(Object.assign({},i),{style:Object.assign(Object.assign({},l),{margin:0}),open:p,visible:p,getPopupContainer:()=>s.current});o&&(S=o(S));const C={paddingBottom:c,position:"relative",minWidth:d};return m.createElement("div",{ref:s,style:C},m.createElement(t,Object.assign({},S)))});function za(t){var e=m.useRef();e.current=t;var n=m.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a"u"||typeof window>"u")return!1;var t=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t==null?void 0:t.substr(0,4))};var J$=function(e){var n=e.className,o=e.customizeIcon,r=e.customizeIconProps,i=e.children,a=e.onMouseDown,l=e.onClick,s=typeof o=="function"?o(r):o;return m.createElement("span",{className:n,onMouseDown:function(u){u.preventDefault(),a==null||a(u)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:l,"aria-hidden":!0},s!==void 0?s:m.createElement("span",{className:Xn(n.split(/\s+/).map(function(c){return"".concat(c,"-icon")}))},i))},ezt=function(e,n,o,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,l=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,c=be.useMemo(function(){if(hi(r)==="object")return r.clearIcon;if(i)return i},[r,i]),u=be.useMemo(function(){return!!(!a&&r&&(o.length||l)&&!(s==="combobox"&&l===""))},[r,a,o.length,l,s]);return{allowClear:u,clearIcon:be.createElement(J$,{className:"".concat(e,"-clear"),onMouseDown:n,customizeIcon:c},"×")}},SGe=m.createContext(null);function tzt(){return m.useContext(SGe)}function nzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,e=m.useState(!1),n=sn(e,2),o=n[0],r=n[1],i=m.useRef(null),a=function(){window.clearTimeout(i.current)};m.useEffect(function(){return a},[]);var l=function(c,u){a(),i.current=window.setTimeout(function(){r(c),u&&u()},t)};return[o,l,a]}function TGe(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,e=m.useRef(null),n=m.useRef(null);m.useEffect(function(){return function(){window.clearTimeout(n.current)}},[]);function o(r){(r||e.current===null)&&(e.current=r),window.clearTimeout(n.current),n.current=window.setTimeout(function(){e.current=null},t)}return[function(){return e.current},o]}function ozt(t,e,n,o){var r=m.useRef(null);r.current={open:e,triggerOpen:n,customizedTrigger:o},m.useEffect(function(){function i(a){var l;if(!((l=r.current)!==null&&l!==void 0&&l.customizedTrigger)){var s=a.target;s.shadowRoot&&a.composed&&(s=a.composedPath()[0]||s),r.current.open&&t().filter(function(c){return c}).every(function(c){return!c.contains(s)&&c!==s})&&r.current.triggerOpen(!1)}}return window.addEventListener("mousedown",i),function(){return window.removeEventListener("mousedown",i)}},[])}function rzt(t){return![jn.ESC,jn.SHIFT,jn.BACKSPACE,jn.TAB,jn.WIN_KEY,jn.ALT,jn.META,jn.WIN_KEY_RIGHT,jn.CTRL,jn.SEMICOLON,jn.EQUALS,jn.CAPS_LOCK,jn.CONTEXT_MENU,jn.F1,jn.F2,jn.F3,jn.F4,jn.F5,jn.F6,jn.F7,jn.F8,jn.F9,jn.F10,jn.F11,jn.F12].includes(t)}var izt=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],FT=void 0;function azt(t,e){var n=t.prefixCls,o=t.invalidate,r=t.item,i=t.renderItem,a=t.responsive,l=t.responsiveDisabled,s=t.registerSize,c=t.itemKey,u=t.className,d=t.style,f=t.children,p=t.display,g=t.order,A=t.component,y=A===void 0?"div":A,S=oi(t,izt),C=a&&!p;function P(b){s(c,b)}m.useEffect(function(){return function(){P(null)}},[]);var v=i&&r!==FT?i(r):f,T;o||(T={opacity:C?0:1,height:C?0:FT,overflowY:C?"hidden":FT,order:a?g:FT,pointerEvents:C?"none":FT,position:C?"absolute":FT});var w={};C&&(w["aria-hidden"]=!0);var x=m.createElement(y,go({className:Xn(!o&&n,u),style:en(en({},T),d)},w,S,{ref:e}),v);return a&&(x=m.createElement(Cd,{onResize:function(R){var H=R.offsetWidth;P(H)},disabled:l},x)),x}var CE=m.forwardRef(azt);CE.displayName="Item";function lzt(t){if(typeof MessageChannel>"u")Ea(t);else{var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(void 0)}}function szt(){var t=m.useRef(null),e=function(o){t.current||(t.current=[],lzt(function(){Hd.unstable_batchedUpdates(function(){t.current.forEach(function(r){r()}),t.current=null})})),t.current.push(o)};return e}function kz(t,e){var n=m.useState(e),o=sn(n,2),r=o[0],i=o[1],a=za(function(l){t(function(){i(l)})});return[r,a]}var UG=be.createContext(null),czt=["component"],uzt=["className"],dzt=["className"],fzt=function(e,n){var o=m.useContext(UG);if(!o){var r=e.component,i=r===void 0?"div":r,a=oi(e,czt);return m.createElement(i,go({},a,{ref:n}))}var l=o.className,s=oi(o,uzt),c=e.className,u=oi(e,dzt);return m.createElement(UG.Provider,{value:null},m.createElement(CE,go({ref:n,className:Xn(l,c)},s,u)))},PGe=m.forwardRef(fzt);PGe.displayName="RawItem";var hzt=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],CGe="responsive",RGe="invalidate";function pzt(t){return"+ ".concat(t.length," ...")}function gzt(t,e){var n=t.prefixCls,o=n===void 0?"rc-overflow":n,r=t.data,i=r===void 0?[]:r,a=t.renderItem,l=t.renderRawItem,s=t.itemKey,c=t.itemWidth,u=c===void 0?10:c,d=t.ssr,f=t.style,p=t.className,g=t.maxCount,A=t.renderRest,y=t.renderRawRest,S=t.suffix,C=t.component,P=C===void 0?"div":C,v=t.itemComponent,T=t.onVisibleChange,w=oi(t,hzt),x=d==="full",b=szt(),R=kz(b,null),H=sn(R,2),F=H[0],E=H[1],N=F||0,U=kz(b,new Map),W=sn(U,2),k=W[0],D=W[1],L=kz(b,0),j=sn(L,2),B=j[0],O=j[1],V=kz(b,0),G=sn(V,2),q=G[0],$=G[1],ie=kz(b,0),Q=sn(ie,2),se=Q[0],oe=Q[1],Z=m.useState(null),te=sn(Z,2),ee=te[0],de=te[1],fe=m.useState(null),pe=sn(fe,2),ye=pe[0],ae=pe[1],Te=m.useMemo(function(){return ye===null&&x?Number.MAX_SAFE_INTEGER:ye||0},[ye,F]),ge=m.useState(!1),Se=sn(ge,2),Re=Se[0],De=Se[1],Ae="".concat(o,"-item"),ue=Math.max(B,q),he=g===CGe,ve=i.length&&he,we=g===RGe,Pe=ve||typeof g=="number"&&i.length>g,Ie=m.useMemo(function(){var Qe=i;return ve?F===null&&x?Qe=i:Qe=i.slice(0,Math.min(i.length,N/u)):typeof g=="number"&&(Qe=i.slice(0,g)),Qe},[i,u,F,g,ve]),Me=m.useMemo(function(){return ve?i.slice(Te+1):i.slice(Ie.length)},[i,Ie,ve,Te]),ze=m.useCallback(function(Qe,lt){var Ze;return typeof s=="function"?s(Qe):(Ze=s&&(Qe==null?void 0:Qe[s]))!==null&&Ze!==void 0?Ze:lt},[s]),Ne=m.useCallback(a||function(Qe){return Qe},[a]);function Je(Qe,lt,Ze){ye===Qe&&(lt===void 0||lt===ee)||(ae(Qe),Ze||(De(QeN){Je(Be-1,Qe-$e-se+q);break}}S&&ke(0)+se>N&&de(null)}},[N,k,q,se,ze,Ie]);var Oe=Re&&!!Me.length,st={};ee!==null&&ve&&(st={position:"absolute",left:ee,top:0});var je={prefixCls:Ae,responsive:ve,component:v,invalidate:we},xt=l?function(Qe,lt){var Ze=ze(Qe,lt);return m.createElement(UG.Provider,{key:Ze,value:en(en({},je),{},{order:lt,item:Qe,itemKey:Ze,registerSize:nt,display:lt<=Te})},l(Qe,lt))}:function(Qe,lt){var Ze=ze(Qe,lt);return m.createElement(CE,go({},je,{order:lt,key:Ze,item:Qe,renderItem:Ne,itemKey:Ze,registerSize:nt,display:lt<=Te}))},gt,Ye={order:Oe?Te:Number.MAX_SAFE_INTEGER,className:"".concat(Ae,"-rest"),registerSize:We,display:Oe};if(y)y&&(gt=m.createElement(UG.Provider,{value:en(en({},je),Ye)},y(Me)));else{var it=A||pzt;gt=m.createElement(CE,go({},je,Ye),typeof it=="function"?it(Me):it)}var ut=m.createElement(P,go({className:Xn(!we&&o,p),style:f,ref:e},w),Ie.map(xt),Pe?gt:null,S&&m.createElement(CE,go({},je,{responsive:he,responsiveDisabled:!ve,order:Te,className:"".concat(Ae,"-suffix"),registerSize:Ee,display:!0,style:st}),S));return he&&(ut=m.createElement(Cd,{onResize:Ue,disabled:!ve},ut)),ut}var F2=m.forwardRef(gzt);F2.displayName="Overflow";F2.Item=PGe;F2.RESPONSIVE=CGe;F2.INVALIDATE=RGe;var mzt=function(e,n){var o,r=e.prefixCls,i=e.id,a=e.inputElement,l=e.disabled,s=e.tabIndex,c=e.autoFocus,u=e.autoComplete,d=e.editable,f=e.activeDescendantId,p=e.value,g=e.maxLength,A=e.onKeyDown,y=e.onMouseDown,S=e.onChange,C=e.onPaste,P=e.onCompositionStart,v=e.onCompositionEnd,T=e.open,w=e.attrs,x=a||m.createElement("input",null),b=x,R=b.ref,H=b.props,F=H.onKeyDown,E=H.onChange,N=H.onMouseDown,U=H.onCompositionStart,W=H.onCompositionEnd,k=H.style;return"maxLength"in x.props,x=m.cloneElement(x,en(en(en({type:"search"},H),{},{id:i,ref:jb(n,R),disabled:l,tabIndex:s,autoComplete:u||"off",autoFocus:c,className:Xn("".concat(r,"-selection-search-input"),(o=x)===null||o===void 0||(o=o.props)===null||o===void 0?void 0:o.className),role:"combobox","aria-expanded":T||!1,"aria-haspopup":"listbox","aria-owns":"".concat(i,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(i,"_list"),"aria-activedescendant":T?f:void 0},w),{},{value:d?p:"",maxLength:g,readOnly:!d,unselectable:d?null:"on",style:en(en({},k),{},{opacity:d?null:0}),onKeyDown:function(L){A(L),F&&F(L)},onMouseDown:function(L){y(L),N&&N(L)},onChange:function(L){S(L),E&&E(L)},onCompositionStart:function(L){P(L),U&&U(L)},onCompositionEnd:function(L){v(L),W&&W(L)},onPaste:C})),x},HGe=m.forwardRef(mzt);function MGe(t){return Array.isArray(t)?t:t!==void 0?[t]:[]}var yzt=typeof window<"u"&&window.document&&window.document.documentElement,Azt=yzt;function wzt(t){return t!=null}function vzt(t){return!t&&t!==0}function bve(t){return["string","number"].includes(hi(t))}function IGe(t){var e=void 0;return t&&(bve(t.title)?e=t.title.toString():bve(t.label)&&(e=t.label.toString())),e}function xzt(t,e){Azt?m.useLayoutEffect(t,e):m.useEffect(t,e)}function bzt(t){var e;return(e=t.key)!==null&&e!==void 0?e:t.value}var Sve=function(e){e.preventDefault(),e.stopPropagation()},Szt=function(e){var n=e.id,o=e.prefixCls,r=e.values,i=e.open,a=e.searchValue,l=e.autoClearSearchValue,s=e.inputRef,c=e.placeholder,u=e.disabled,d=e.mode,f=e.showSearch,p=e.autoFocus,g=e.autoComplete,A=e.activeDescendantId,y=e.tabIndex,S=e.removeIcon,C=e.maxTagCount,P=e.maxTagTextLength,v=e.maxTagPlaceholder,T=v===void 0?function(de){return"+ ".concat(de.length," ...")}:v,w=e.tagRender,x=e.onToggleOpen,b=e.onRemove,R=e.onInputChange,H=e.onInputPaste,F=e.onInputKeyDown,E=e.onInputMouseDown,N=e.onInputCompositionStart,U=e.onInputCompositionEnd,W=m.useRef(null),k=m.useState(0),D=sn(k,2),L=D[0],j=D[1],B=m.useState(!1),O=sn(B,2),V=O[0],G=O[1],q="".concat(o,"-selection"),$=i||d==="multiple"&&l===!1||d==="tags"?a:"",ie=d==="tags"||d==="multiple"&&l===!1||f&&(i||V);xzt(function(){j(W.current.scrollWidth)},[$]);var Q=function(fe,pe,ye,ae,Te){return m.createElement("span",{title:IGe(fe),className:Xn("".concat(q,"-item"),Jt({},"".concat(q,"-item-disabled"),ye))},m.createElement("span",{className:"".concat(q,"-item-content")},pe),ae&&m.createElement(J$,{className:"".concat(q,"-item-remove"),onMouseDown:Sve,onClick:Te,customizeIcon:S},"×"))},se=function(fe,pe,ye,ae,Te,ge){var Se=function(De){Sve(De),x(!i)};return m.createElement("span",{onMouseDown:Se},w({label:pe,value:fe,disabled:ye,closable:ae,onClose:Te,isMaxTag:!!ge}))},oe=function(fe){var pe=fe.disabled,ye=fe.label,ae=fe.value,Te=!u&&!pe,ge=ye;if(typeof P=="number"&&(typeof ye=="string"||typeof ye=="number")){var Se=String(ge);Se.length>P&&(ge="".concat(Se.slice(0,P),"..."))}var Re=function(Ae){Ae&&Ae.stopPropagation(),b(fe)};return typeof w=="function"?se(ae,ge,pe,Te,Re):Q(fe,ge,pe,Te,Re)},Z=function(fe){var pe=typeof T=="function"?T(fe):T;return typeof w=="function"?se(void 0,pe,!1,!1,void 0,!0):Q({title:pe},pe,!1)},te=m.createElement("div",{className:"".concat(q,"-search"),style:{width:L},onFocus:function(){G(!0)},onBlur:function(){G(!1)}},m.createElement(HGe,{ref:s,open:i,prefixCls:o,id:n,inputElement:null,disabled:u,autoFocus:p,autoComplete:g,editable:ie,activeDescendantId:A,value:$,onKeyDown:F,onMouseDown:E,onChange:R,onPaste:H,onCompositionStart:N,onCompositionEnd:U,tabIndex:y,attrs:bf(e,!0)}),m.createElement("span",{ref:W,className:"".concat(q,"-search-mirror"),"aria-hidden":!0},$," ")),ee=m.createElement(F2,{prefixCls:"".concat(q,"-overflow"),data:r,renderItem:oe,renderRest:Z,suffix:te,itemKey:bzt,maxCount:C});return m.createElement(m.Fragment,null,ee,!r.length&&!$&&m.createElement("span",{className:"".concat(q,"-placeholder")},c))},Tzt=function(e){var n=e.inputElement,o=e.prefixCls,r=e.id,i=e.inputRef,a=e.disabled,l=e.autoFocus,s=e.autoComplete,c=e.activeDescendantId,u=e.mode,d=e.open,f=e.values,p=e.placeholder,g=e.tabIndex,A=e.showSearch,y=e.searchValue,S=e.activeValue,C=e.maxLength,P=e.onInputKeyDown,v=e.onInputMouseDown,T=e.onInputChange,w=e.onInputPaste,x=e.onInputCompositionStart,b=e.onInputCompositionEnd,R=e.title,H=m.useState(!1),F=sn(H,2),E=F[0],N=F[1],U=u==="combobox",W=U||A,k=f[0],D=y||"";U&&S&&!E&&(D=S),m.useEffect(function(){U&&N(!1)},[U,S]);var L=u!=="combobox"&&!d&&!A?!1:!!D,j=R===void 0?IGe(k):R,B=m.useMemo(function(){return k?null:m.createElement("span",{className:"".concat(o,"-selection-placeholder"),style:L?{visibility:"hidden"}:void 0},p)},[k,L,p,o]);return m.createElement(m.Fragment,null,m.createElement("span",{className:"".concat(o,"-selection-search")},m.createElement(HGe,{ref:i,prefixCls:o,id:r,open:d,inputElement:n,disabled:a,autoFocus:l,autoComplete:s,editable:W,activeDescendantId:c,value:D,onKeyDown:P,onMouseDown:v,onChange:function(V){N(!0),T(V)},onPaste:w,onCompositionStart:x,onCompositionEnd:b,tabIndex:g,attrs:bf(e,!0),maxLength:U?C:void 0})),!U&&k?m.createElement("span",{className:"".concat(o,"-selection-item"),title:j,style:L?{visibility:"hidden"}:void 0},k.label):null,B)},Pzt=function(e,n){var o=m.useRef(null),r=m.useRef(!1),i=e.prefixCls,a=e.open,l=e.mode,s=e.showSearch,c=e.tokenWithEnter,u=e.disabled,d=e.autoClearSearchValue,f=e.onSearch,p=e.onSearchSubmit,g=e.onToggleOpen,A=e.onInputKeyDown,y=e.domRef;m.useImperativeHandle(n,function(){return{focus:function(L){o.current.focus(L)},blur:function(){o.current.blur()}}});var S=TGe(0),C=sn(S,2),P=C[0],v=C[1],T=function(L){var j=L.which;(j===jn.UP||j===jn.DOWN)&&L.preventDefault(),A&&A(L),j===jn.ENTER&&l==="tags"&&!r.current&&!a&&(p==null||p(L.target.value)),rzt(j)&&g(!0)},w=function(){v(!0)},x=m.useRef(null),b=function(L){f(L,!0,r.current)!==!1&&g(!0)},R=function(){r.current=!0},H=function(L){r.current=!1,l!=="combobox"&&b(L.target.value)},F=function(L){var j=L.target.value;if(c&&x.current&&/[\r\n]/.test(x.current)){var B=x.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");j=j.replace(B,x.current)}x.current=null,b(j)},E=function(L){var j=L.clipboardData,B=j==null?void 0:j.getData("text");x.current=B||""},N=function(L){var j=L.target;if(j!==o.current){var B=document.body.style.msTouchAction!==void 0;B?setTimeout(function(){o.current.focus()}):o.current.focus()}},U=function(L){var j=P();L.target!==o.current&&!j&&!(l==="combobox"&&u)&&L.preventDefault(),(l!=="combobox"&&(!s||!j)||!a)&&(a&&d!==!1&&f("",!0,!1),g())},W={inputRef:o,onInputKeyDown:T,onInputMouseDown:w,onInputChange:F,onInputPaste:E,onInputCompositionStart:R,onInputCompositionEnd:H},k=l==="multiple"||l==="tags"?m.createElement(Szt,go({},e,W)):m.createElement(Tzt,go({},e,W));return m.createElement("div",{ref:y,className:"".concat(i,"-selector"),onClick:N,onMouseDown:U},k)},Czt=m.forwardRef(Pzt);function uk(t){"@babel/helpers - typeof";return uk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uk(t)}function Rzt(t,e){if(uk(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(uk(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hzt(t){var e=Rzt(t,"string");return uk(e)==="symbol"?e:String(e)}function Mzt(t,e,n){return e=Hzt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Tve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function tp(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function Fzt(t,e){if(t==null)return{};var n=Ezt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function jG(){return jG=Object.assign?Object.assign.bind():function(t){for(var e=1;e0,G=m.useState(!P||!V),q=rf(G,2),$=q[0],ie=q[1];if(_a(function(){!$&&V&&a&&ie(!0)},[$,V,a]),!$)return null;var Q="auto",se={left:"-1000vw",top:"-1000vh",right:Q,bottom:Q};if(H||!s){var oe,Z=A.points,te=A.dynamicInset||((oe=A._experimental)===null||oe===void 0?void 0:oe.dynamicInset),ee=te&&Z[0][1]==="r",de=te&&Z[0][0]==="b";ee?(se.right=N,se.left=Q):(se.left=F,se.right=Q),de?(se.bottom=U,se.top=Q):(se.top=E,se.bottom=Q)}var fe={};return D&&(D.includes("height")&&j?fe.height=j:D.includes("minHeight")&&j&&(fe.minHeight=j),D.includes("width")&&L?fe.width=L:D.includes("minWidth")&&L&&(fe.minWidth=L)),s||(fe.pointerEvents="none"),m.createElement(T,{open:C||O,getContainer:P&&function(){return P(a)},autoDestroy:v},m.createElement(Lzt,{prefixCls:r,open:s,zIndex:w,mask:f,motion:S}),m.createElement(Cd,{onResize:W,disabled:!s},function(pe){return m.createElement(o1,jG({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:C,leavedClassName:"".concat(r,"-hidden")},y,{onAppearPrepare:k,onEnterPrepare:k,visible:s,onVisibleChanged:function(ae){var Te;y==null||(Te=y.onVisibleChanged)===null||Te===void 0||Te.call(y,ae),l(ae)}}),function(ye,ae){var Te=ye.className,ge=ye.style,Se=Xn(r,Te,o);return m.createElement("div",{ref:jb(pe,e,ae),className:Se,style:tp(tp(tp(tp({"--arrow-x":"".concat(g.x||0,"px"),"--arrow-y":"".concat(g.y||0,"px")},se),fe),ge),{},{boxSizing:"border-box",zIndex:w},i),onMouseEnter:x,onMouseLeave:b,onPointerEnter:R,onClick:d},p&&m.createElement(kzt,{prefixCls:r,arrow:p,arrowPos:g,align:A}),m.createElement(Wzt,{cache:!s&&!u},B))})}))}),Uzt=m.forwardRef(function(t,e){var n=t.children,o=t.getTriggerDOMNode,r=sw(n),i=m.useCallback(function(l){ZF(e,o?o(l):l)},[o]),a=Nw(i,n.ref);return r?m.cloneElement(n,{ref:a}):n}),Pve=m.createContext(null);function Cve(t){return t?Array.isArray(t)?t:[t]:[]}function jzt(t,e,n,o){return m.useMemo(function(){var r=Cve(n??e),i=Cve(o??e),a=new Set(r),l=new Set(i);return t&&(a.has("hover")&&(a.delete("hover"),a.add("click")),l.has("hover")&&(l.delete("hover"),l.add("click"))),[a,l]},[t,e,n,o])}const K$=function(t){if(!t)return!1;if(t instanceof Element){if(t.offsetParent)return!0;if(t.getBBox){var e=t.getBBox(),n=e.width,o=e.height;if(n||o)return!0}if(t.getBoundingClientRect){var r=t.getBoundingClientRect(),i=r.width,a=r.height;if(i||a)return!0}}return!1};function Bzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function Yzt(t,e,n,o){for(var r=n.points,i=Object.keys(t),a=0;a1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(t)?e:t}function Lz(t){return dk(parseFloat(t),0)}function Hve(t,e){var n=tp({},t);return(e||[]).forEach(function(o){if(!(o instanceof HTMLBodyElement||o instanceof HTMLHtmlElement)){var r=JW(o).getComputedStyle(o),i=r.overflow,a=r.overflowClipMargin,l=r.borderTopWidth,s=r.borderBottomWidth,c=r.borderLeftWidth,u=r.borderRightWidth,d=o.getBoundingClientRect(),f=o.offsetHeight,p=o.clientHeight,g=o.offsetWidth,A=o.clientWidth,y=Lz(l),S=Lz(s),C=Lz(c),P=Lz(u),v=dk(Math.round(d.width/g*1e3)/1e3),T=dk(Math.round(d.height/f*1e3)/1e3),w=(g-A-C-P)*v,x=(f-p-y-S)*T,b=y*T,R=S*T,H=C*v,F=P*v,E=0,N=0;if(i==="clip"){var U=Lz(a);E=U*v,N=U*T}var W=d.x+H-E,k=d.y+b-N,D=W+d.width+2*E-H-F-w,L=k+d.height+2*N-b-R-x;n.left=Math.max(n.left,W),n.top=Math.max(n.top,k),n.right=Math.min(n.right,D),n.bottom=Math.min(n.bottom,L)}}),n}function Mve(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n="".concat(e),o=n.match(/^(.*)\%$/);return o?t*(parseFloat(o[1])/100):parseFloat(n)}function Ive(t,e){var n=e||[],o=rf(n,2),r=o[0],i=o[1];return[Mve(t.width,r),Mve(t.height,i)]}function zve(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[t[0],t[1]]}function kT(t,e){var n=e[0],o=e[1],r,i;return n==="t"?i=t.y:n==="b"?i=t.y+t.height:i=t.y+t.height/2,o==="l"?r=t.x:o==="r"?r=t.x+t.width:r=t.x+t.width/2,{x:r,y:i}}function C4(t,e){var n={t:"b",b:"t",l:"r",r:"l"};return t.map(function(o,r){return r===e?n[o]||"c":o}).join("")}function Ozt(t,e,n,o,r,i,a){var l=m.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:r[o]||{}}),s=rf(l,2),c=s[0],u=s[1],d=m.useRef(0),f=m.useMemo(function(){return e?Q0e(e):[]},[e]),p=m.useRef({}),g=function(){p.current={}};t||g();var A=za(function(){if(e&&n&&t){let So=function(Yo,lr){var fr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Se,ei=B.x+Yo,hr=B.y+lr,tr=ei+oe,bi=hr+se,Fo=Math.max(ei,fr.left),Si=Math.max(hr,fr.top),hl=Math.min(tr,fr.right),nr=Math.min(bi,fr.bottom);return Math.max(0,(hl-Fo)*(nr-Si))},Qo=function(){Wt=B.y+it,ht=Wt+se,ct=B.x+Ye,It=ct+oe};var Bn=So,Ko=Qo,C,P,v=e,T=v.ownerDocument,w=JW(v),x=w.getComputedStyle(v),b=x.width,R=x.height,H=x.position,F=v.style.left,E=v.style.top,N=v.style.right,U=v.style.bottom,W=v.style.overflow,k=tp(tp({},r[o]),i),D=T.createElement("div");(C=v.parentElement)===null||C===void 0||C.appendChild(D),D.style.left="".concat(v.offsetLeft,"px"),D.style.top="".concat(v.offsetTop,"px"),D.style.position=H,D.style.height="".concat(v.offsetHeight,"px"),D.style.width="".concat(v.offsetWidth,"px"),v.style.left="0",v.style.top="0",v.style.right="auto",v.style.bottom="auto",v.style.overflow="hidden";var L;if(Array.isArray(n))L={x:n[0],y:n[1],width:0,height:0};else{var j=n.getBoundingClientRect();L={x:j.x,y:j.y,width:j.width,height:j.height}}var B=v.getBoundingClientRect(),O=T.documentElement,V=O.clientWidth,G=O.clientHeight,q=O.scrollWidth,$=O.scrollHeight,ie=O.scrollTop,Q=O.scrollLeft,se=B.height,oe=B.width,Z=L.height,te=L.width,ee={left:0,top:0,right:V,bottom:G},de={left:-Q,top:-ie,right:q-Q,bottom:$-ie},fe=k.htmlRegion,pe="visible",ye="visibleFirst";fe!=="scroll"&&fe!==ye&&(fe=pe);var ae=fe===ye,Te=Hve(de,f),ge=Hve(ee,f),Se=fe===pe?ge:Te,Re=ae?ge:Se;v.style.left="auto",v.style.top="auto",v.style.right="0",v.style.bottom="0";var De=v.getBoundingClientRect();v.style.left=F,v.style.top=E,v.style.right=N,v.style.bottom=U,v.style.overflow=W,(P=v.parentElement)===null||P===void 0||P.removeChild(D);var Ae=dk(Math.round(oe/parseFloat(b)*1e3)/1e3),ue=dk(Math.round(se/parseFloat(R)*1e3)/1e3);if(Ae===0||ue===0||TG(n)&&!K$(n))return;var he=k.offset,ve=k.targetOffset,we=Ive(B,he),Pe=rf(we,2),Ie=Pe[0],Me=Pe[1],ze=Ive(L,ve),Ne=rf(ze,2),Je=Ne[0],Ue=Ne[1];L.x-=Je,L.y-=Ue;var nt=k.points||[],We=rf(nt,2),Ee=We[0],ke=We[1],Oe=zve(ke),st=zve(Ee),je=kT(L,Oe),xt=kT(B,st),gt=tp({},k),Ye=je.x-xt.x+Ie,it=je.y-xt.y+Me,ut=So(Ye,it),Qe=So(Ye,it,ge),lt=kT(L,["t","l"]),Ze=kT(B,["t","l"]),Be=kT(L,["b","r"]),$e=kT(B,["b","r"]),wt=k.overflow||{},vt=wt.adjustX,Rt=wt.adjustY,Gt=wt.shiftX,At=wt.shiftY,pt=function(lr){return typeof lr=="boolean"?lr:lr>=0},Wt,ht,ct,It;Qo();var Ft=pt(Rt),Ve=st[0]===Oe[0];if(Ft&&st[0]==="t"&&(ht>Re.bottom||p.current.bt)){var ft=it;Ve?ft-=se-Z:ft=lt.y-$e.y-Me;var kt=So(Ye,ft),rt=So(Ye,ft,ge);kt>ut||kt===ut&&(!ae||rt>=Qe)?(p.current.bt=!0,it=ft,Me=-Me,gt.points=[C4(st,0),C4(Oe,0)]):p.current.bt=!1}if(Ft&&st[0]==="b"&&(Wtut||Ge===ut&&(!ae||yt>=Qe)?(p.current.tb=!0,it=at,Me=-Me,gt.points=[C4(st,0),C4(Oe,0)]):p.current.tb=!1}var Pt=pt(vt),ot=st[1]===Oe[1];if(Pt&&st[1]==="l"&&(It>Re.right||p.current.rl)){var bt=Ye;ot?bt-=oe-te:bt=lt.x-$e.x-Ie;var zt=So(bt,it),Bt=So(bt,it,ge);zt>ut||zt===ut&&(!ae||Bt>=Qe)?(p.current.rl=!0,Ye=bt,Ie=-Ie,gt.points=[C4(st,1),C4(Oe,1)]):p.current.rl=!1}if(Pt&&st[1]==="r"&&(ctut||Ht===ut&&(!ae||_t>=Qe)?(p.current.lr=!0,Ye=tt,Ie=-Ie,gt.points=[C4(st,1),C4(Oe,1)]):p.current.lr=!1}Qo();var qt=Gt===!0?0:Gt;typeof qt=="number"&&(ctge.right&&(Ye-=It-ge.right-Ie,L.x>ge.right-qt&&(Ye+=L.x-ge.right+qt)));var un=At===!0?0:At;typeof un=="number"&&(Wtge.bottom&&(it-=ht-ge.bottom-Me,L.y>ge.bottom-un&&(it+=L.y-ge.bottom+un)));var Rn=B.x+Ye,yo=Rn+oe,Ao=B.y+it,wo=Ao+se,Io=L.x,po=Io+te,On=L.y,fo=On+Z,ir=Math.max(Rn,Io),Rr=Math.min(yo,po),br=(ir+Rr)/2,_r=br-Rn,jo=Math.max(Ao,On),wn=Math.min(wo,fo),In=(jo+wn)/2,ar=In-Ao;a==null||a(e,gt);var Wo=De.right-B.x-(Ye+B.width),to=De.bottom-B.y-(it+B.height);u({ready:!0,offsetX:Ye/Ae,offsetY:it/ue,offsetR:Wo/Ae,offsetB:to/ue,arrowX:_r/Ae,arrowY:ar/ue,scaleX:Ae,scaleY:ue,align:gt})}}),y=function(){d.current+=1;var P=d.current;Promise.resolve().then(function(){d.current===P&&A()})},S=function(){u(function(P){return tp(tp({},P),{},{ready:!1})})};return _a(S,[o]),_a(function(){t||S()},[t]),[c.ready,c.offsetX,c.offsetY,c.offsetR,c.offsetB,c.arrowX,c.arrowY,c.scaleX,c.scaleY,c.align,y]}function Vzt(t){if(Array.isArray(t))return $0e(t)}function _zt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Gzt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dve(t){return Vzt(t)||_zt(t)||zGe(t)||Gzt()}function Xzt(t,e,n,o,r){_a(function(){if(t&&e&&n){let f=function(){o(),r()};var d=f,i=e,a=n,l=Q0e(i),s=Q0e(a),c=JW(a),u=new Set([c].concat(Dve(l),Dve(s)));return u.forEach(function(p){p.addEventListener("scroll",f,{passive:!0})}),c.addEventListener("resize",f,{passive:!0}),o(),function(){u.forEach(function(p){p.removeEventListener("scroll",f),c.removeEventListener("resize",f)})}}},[t,e,n])}function Jzt(t,e,n,o,r,i,a,l){var s=m.useRef(t);s.current=t,m.useEffect(function(){if(e&&o&&(!r||i)){var c=function(p){var g=p.target;s.current&&!a(g)&&l(!1)},u=JW(o);u.addEventListener("mousedown",c,!0),u.addEventListener("contextmenu",c,!0);var d=kG(n);return d&&(d.addEventListener("mousedown",c,!0),d.addEventListener("contextmenu",c,!0)),function(){u.removeEventListener("mousedown",c,!0),u.removeEventListener("contextmenu",c,!0),d&&(d.removeEventListener("mousedown",c,!0),d.removeEventListener("contextmenu",c,!0))}}},[e,n,o,r,i])}var Kzt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function qzt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B$,e=m.forwardRef(function(n,o){var r=n.prefixCls,i=r===void 0?"rc-trigger-popup":r,a=n.children,l=n.action,s=l===void 0?"hover":l,c=n.showAction,u=n.hideAction,d=n.popupVisible,f=n.defaultPopupVisible,p=n.onPopupVisibleChange,g=n.afterPopupVisibleChange,A=n.mouseEnterDelay,y=n.mouseLeaveDelay,S=y===void 0?.1:y,C=n.focusDelay,P=n.blurDelay,v=n.mask,T=n.maskClosable,w=T===void 0?!0:T,x=n.getPopupContainer,b=n.forceRender,R=n.autoDestroy,H=n.destroyPopupOnHide,F=n.popup,E=n.popupClassName,N=n.popupStyle,U=n.popupPlacement,W=n.builtinPlacements,k=W===void 0?{}:W,D=n.popupAlign,L=n.zIndex,j=n.stretch,B=n.getPopupClassNameFromAlign,O=n.fresh,V=n.alignPoint,G=n.onPopupClick,q=n.onPopupAlign,$=n.arrow,ie=n.popupMotion,Q=n.maskMotion,se=n.popupTransitionName,oe=n.popupAnimation,Z=n.maskTransitionName,te=n.maskAnimation,ee=n.className,de=n.getTriggerDOMNode,fe=Fzt(n,Kzt),pe=R||H||!1,ye=m.useState(!1),ae=rf(ye,2),Te=ae[0],ge=ae[1];_a(function(){ge(X$())},[]);var Se=m.useRef({}),Re=m.useContext(Pve),De=m.useMemo(function(){return{registerSubPopup:function(or,Ai){Se.current[or]=Ai,Re==null||Re.registerSubPopup(or,Ai)}}},[Re]),Ae=V_e(),ue=m.useState(null),he=rf(ue,2),ve=he[0],we=he[1],Pe=m.useRef(null),Ie=za(function(nr){Pe.current=nr,TG(nr)&&ve!==nr&&we(nr),Re==null||Re.registerSubPopup(Ae,nr)}),Me=m.useState(null),ze=rf(Me,2),Ne=ze[0],Je=ze[1],Ue=m.useRef(null),nt=za(function(nr){TG(nr)&&Ne!==nr&&(Je(nr),Ue.current=nr)}),We=m.Children.only(a),Ee=(We==null?void 0:We.props)||{},ke={},Oe=za(function(nr){var or,Ai,Fa=Ne;return(Fa==null?void 0:Fa.contains(nr))||((or=kG(Fa))===null||or===void 0?void 0:or.host)===nr||nr===Fa||(ve==null?void 0:ve.contains(nr))||((Ai=kG(ve))===null||Ai===void 0?void 0:Ai.host)===nr||nr===ve||Object.values(Se.current).some(function(wi){return(wi==null?void 0:wi.contains(nr))||nr===wi})}),st=Rve(i,ie,oe,se),je=Rve(i,Q,te,Z),xt=m.useState(f||!1),gt=rf(xt,2),Ye=gt[0],it=gt[1],ut=d??Ye,Qe=za(function(nr){d===void 0&&it(nr)});_a(function(){it(d||!1)},[d]);var lt=m.useRef(ut);lt.current=ut;var Ze=m.useRef([]);Ze.current=[];var Be=za(function(nr){var or;Qe(nr),((or=Ze.current[Ze.current.length-1])!==null&&or!==void 0?or:ut)!==nr&&(Ze.current.push(nr),p==null||p(nr))}),$e=m.useRef(),wt=function(){clearTimeout($e.current)},vt=function(or){var Ai=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;wt(),Ai===0?Be(or):$e.current=setTimeout(function(){Be(or)},Ai*1e3)};m.useEffect(function(){return wt},[]);var Rt=m.useState(!1),Gt=rf(Rt,2),At=Gt[0],pt=Gt[1];_a(function(nr){(!nr||ut)&&pt(!0)},[ut]);var Wt=m.useState(null),ht=rf(Wt,2),ct=ht[0],It=ht[1],Ft=m.useState([0,0]),Ve=rf(Ft,2),ft=Ve[0],kt=Ve[1],rt=function(or){kt([or.clientX,or.clientY])},at=Ozt(ut,ve,V?ft:Ne,U,k,D,q),Ge=rf(at,11),yt=Ge[0],Pt=Ge[1],ot=Ge[2],bt=Ge[3],zt=Ge[4],Bt=Ge[5],tt=Ge[6],Ht=Ge[7],_t=Ge[8],qt=Ge[9],un=Ge[10],Rn=jzt(Te,s,c,u),yo=rf(Rn,2),Ao=yo[0],wo=yo[1],Io=Ao.has("click"),po=wo.has("click")||wo.has("contextMenu"),On=za(function(){At||un()}),fo=function(){lt.current&&V&&po&&vt(!1)};Xzt(ut,Ne,ve,On,fo),_a(function(){On()},[ft,U]),_a(function(){ut&&!(k!=null&&k[U])&&On()},[JSON.stringify(D)]);var ir=m.useMemo(function(){var nr=Yzt(k,i,qt,V);return Xn(nr,B==null?void 0:B(qt))},[qt,B,k,i,V]);m.useImperativeHandle(o,function(){return{nativeElement:Ue.current,popupElement:Pe.current,forceAlign:On}});var Rr=m.useState(0),br=rf(Rr,2),_r=br[0],jo=br[1],wn=m.useState(0),In=rf(wn,2),ar=In[0],Wo=In[1],to=function(){if(j&&Ne){var or=Ne.getBoundingClientRect();jo(or.width),Wo(or.height)}},Bn=function(){to(),On()},Ko=function(or){pt(!1),un(),g==null||g(or)},So=function(){return new Promise(function(or){to(),It(function(){return or})})};_a(function(){ct&&(un(),ct(),It(null))},[ct]);function Qo(nr,or,Ai,Fa){ke[nr]=function(wi){var Fs;Fa==null||Fa(wi),vt(or,Ai);for(var ks=arguments.length,Zs=new Array(ks>1?ks-1:0),Yi=1;Yi1?Ai-1:0),wi=1;wi1?Ai-1:0),wi=1;wi1&&arguments[1]!==void 0?arguments[1]:{},n=e.fieldNames,o=e.childrenAsData,r=[],i=DGe(n,!1),a=i.label,l=i.value,s=i.options,c=i.groupLabel;function u(d,f){Array.isArray(d)&&d.forEach(function(p){if(f||!(s in p)){var g=p[l];r.push({key:Eve(p,r.length),groupOption:f,data:p,label:p[a],value:g})}else{var A=p[c];A===void 0&&o&&(A=p.label),r.push({key:Eve(p,r.length),group:!0,data:p,label:A}),u(p[s],!0)}})}return u(t,!1),r}function eue(t){var e=en({},t);return"props"in e||Object.defineProperty(e,"props",{get:function(){return U0(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),e}}),e}var nDt=function(e,n,o){if(!n||!n.length)return null;var r=!1,i=function l(s,c){var u=eGe(c),d=u[0],f=u.slice(1);if(!d)return[s];var p=s.split(d);return r=r||p.length>1,p.reduce(function(g,A){return[].concat(No(g),No(l(A,f)))},[]).filter(Boolean)},a=i(e,n);return r?typeof o<"u"?a.slice(0,o):a:null},Lme=m.createContext(null),oDt=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],rDt=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],tue=function(e){return e==="tags"||e==="multiple"},iDt=m.forwardRef(function(t,e){var n,o=t.id,r=t.prefixCls,i=t.className,a=t.showSearch,l=t.tagRender,s=t.direction,c=t.omitDomProps,u=t.displayValues,d=t.onDisplayValuesChange,f=t.emptyOptions,p=t.notFoundContent,g=p===void 0?"Not Found":p,A=t.onClear,y=t.mode,S=t.disabled,C=t.loading,P=t.getInputElement,v=t.getRawInputElement,T=t.open,w=t.defaultOpen,x=t.onDropdownVisibleChange,b=t.activeValue,R=t.onActiveValueChange,H=t.activeDescendantId,F=t.searchValue,E=t.autoClearSearchValue,N=t.onSearch,U=t.onSearchSplit,W=t.tokenSeparators,k=t.allowClear,D=t.suffixIcon,L=t.clearIcon,j=t.OptionList,B=t.animation,O=t.transitionName,V=t.dropdownStyle,G=t.dropdownClassName,q=t.dropdownMatchSelectWidth,$=t.dropdownRender,ie=t.dropdownAlign,Q=t.placement,se=t.builtinPlacements,oe=t.getPopupContainer,Z=t.showAction,te=Z===void 0?[]:Z,ee=t.onFocus,de=t.onBlur,fe=t.onKeyUp,pe=t.onKeyDown,ye=t.onMouseDown,ae=oi(t,oDt),Te=tue(y),ge=(a!==void 0?a:Te)||y==="combobox",Se=en({},ae);rDt.forEach(function(On){delete Se[On]}),c==null||c.forEach(function(On){delete Se[On]});var Re=m.useState(!1),De=sn(Re,2),Ae=De[0],ue=De[1];m.useEffect(function(){ue(X$())},[]);var he=m.useRef(null),ve=m.useRef(null),we=m.useRef(null),Pe=m.useRef(null),Ie=m.useRef(null),Me=m.useRef(!1),ze=nzt(),Ne=sn(ze,3),Je=Ne[0],Ue=Ne[1],nt=Ne[2];m.useImperativeHandle(e,function(){var On,fo;return{focus:(On=Pe.current)===null||On===void 0?void 0:On.focus,blur:(fo=Pe.current)===null||fo===void 0?void 0:fo.blur,scrollTo:function(Rr){var br;return(br=Ie.current)===null||br===void 0?void 0:br.scrollTo(Rr)}}});var We=m.useMemo(function(){var On;if(y!=="combobox")return F;var fo=(On=u[0])===null||On===void 0?void 0:On.value;return typeof fo=="string"||typeof fo=="number"?String(fo):""},[F,y,u]),Ee=y==="combobox"&&typeof P=="function"&&P()||null,ke=typeof v=="function"&&v(),Oe=Nw(ve,ke==null||(n=ke.props)===null||n===void 0?void 0:n.ref),st=m.useState(!1),je=sn(st,2),xt=je[0],gt=je[1];_a(function(){gt(!0)},[]);var Ye=Es(!1,{defaultValue:w,value:T}),it=sn(Ye,2),ut=it[0],Qe=it[1],lt=xt?ut:!1,Ze=!g&&f;(S||Ze&<&&y==="combobox")&&(lt=!1);var Be=Ze?!1:lt,$e=m.useCallback(function(On){var fo=On!==void 0?On:!lt;S||(Qe(fo),lt!==fo&&(x==null||x(fo)))},[S,lt,Qe,x]),wt=m.useMemo(function(){return(W||[]).some(function(On){return[` `,`\r -`].includes(On)})},[W]),vt=m.useContext(Lme)||{},Rt=vt.maxCount,Gt=vt.rawValues,At=function(fo,ir,Rr){if(!(Te&&Z0e(Rt)&&(Gt==null?void 0:Gt.size)>=Rt)){var br=!0,_r=fo;R==null||R(null);var jo=nDt(fo,W,Z0e(Rt)?Rt-Gt.size:void 0),wn=Rr?null:jo;return y!=="combobox"&&wn&&(_r="",U==null||U(wn),$e(!1),br=!1),N&&We!==_r&&N(_r,{source:ir?"typing":"effect"}),br}},pt=function(fo){!fo||!fo.trim()||N(fo,{source:"submit"})};m.useEffect(function(){!lt&&!Te&&y!=="combobox"&&At("",!1,!1)},[lt]),m.useEffect(function(){ut&&S&&Qe(!1),S&&!Me.current&&Ue(!1)},[S]);var Wt=TGe(),ht=sn(Wt,2),ct=ht[0],It=ht[1],Ft=function(fo){var ir=ct(),Rr=fo.which;if(Rr===jn.ENTER&&(y!=="combobox"&&fo.preventDefault(),lt||$e(!0)),It(!!We),Rr===jn.BACKSPACE&&!ir&&Te&&!We&&u.length){for(var br=No(u),_r=null,jo=br.length-1;jo>=0;jo-=1){var wn=br[jo];if(!wn.disabled){br.splice(jo,1),_r=wn;break}}_r&&d(br,{type:"remove",values:[_r]})}for(var In=arguments.length,ar=new Array(In>1?In-1:0),Wo=1;Wo1?ir-1:0),br=1;br1?jo-1:0),In=1;In0,G=m.useMemo(function(){if(i===0||B===0)return 0;var oe=i/B;return oe*O},[i,B,O]),q=function(de){de.stopPropagation(),de.preventDefault()},$=m.useRef({top:G,dragging:S,pageY:T,startTop:R});$.current={top:G,dragging:S,pageY:T,startTop:R};var ie=function(de){C(!0),w(Fve(de,u)),H($.current.top),l(),de.stopPropagation(),de.preventDefault()};m.useEffect(function(){var oe=function(me){me.preventDefault()},de=E.current,he=N.current;return de.addEventListener("touchstart",oe),he.addEventListener("touchstart",ie),function(){de.removeEventListener("touchstart",oe),he.removeEventListener("touchstart",ie)}},[]);var Q=m.useRef();Q.current=B;var se=m.useRef();se.current=O,m.useEffect(function(){if(S){var oe,de=function(me){var le=$.current,Te=le.dragging,ge=le.pageY,Se=le.startTop;if(Ea.cancel(oe),Te){var Re=Fve(me,u)-ge,De=Se;!F&&u?De-=Re:De+=Re;var Ae=Q.current,ue=se.current,fe=ue?De/ue:0,ve=Math.ceil(fe*Ae);ve=Math.max(ve,0),ve=Math.min(ve,Ae),oe=Ea(function(){c(ve,u)})}},he=function(){C(!1),s()};return window.addEventListener("mousemove",de),window.addEventListener("touchmove",de),window.addEventListener("mouseup",he),window.addEventListener("touchend",he),function(){window.removeEventListener("mousemove",de),window.removeEventListener("touchmove",de),window.removeEventListener("mouseup",he),window.removeEventListener("touchend",he),Ea.cancel(oe)}}},[S]),m.useEffect(function(){j()},[i]),m.useImperativeHandle(e,function(){return{delayHidden:j}});var Z="".concat(o,"-scrollbar"),ee={position:"absolute",visibility:k&&V?null:"hidden"},te={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(ee.height=8,ee.left=0,ee.right=0,ee.bottom=0,te.height="100%",te.width=d,F?te.left=G:te.right=G):(ee.width=8,ee.top=0,ee.bottom=0,F?ee.right=0:ee.left=0,te.width="100%",te.height=d,te.top=G),m.createElement("div",{ref:E,className:Xn(Z,(n={},Jt(n,"".concat(Z,"-horizontal"),u),Jt(n,"".concat(Z,"-vertical"),!u),Jt(n,"".concat(Z,"-visible"),k),n)),style:en(en({},ee),p),onMouseDown:q,onMouseMove:j},m.createElement("div",{ref:N,className:Xn("".concat(Z,"-thumb"),Jt({},"".concat(Z,"-thumb-moving"),S)),style:en(en({},te),g),onMouseDown:ie}))});function aDt(t){var e=t.children,n=t.setRef,o=m.useCallback(function(r){n(r)},[]);return m.cloneElement(e,{ref:o})}function lDt(t,e,n,o,r,i,a){var l=a.getKey;return t.slice(e,n+1).map(function(s,c){var u=e+c,d=i(s,u,{style:{width:o}}),f=l(s);return m.createElement(aDt,{key:f,setRef:function(g){return r(s,g)}},d)})}var sDt=function(){function t(){wp(this,t),this.maps=void 0,this.id=0,this.maps=Object.create(null)}return vp(t,[{key:"set",value:function(n,o){this.maps[n]=o,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}}]),t}();function cDt(t,e,n){var o=m.useState(0),r=sn(o,2),i=r[0],a=r[1],l=m.useRef(new Map),s=m.useRef(new sDt),c=m.useRef();function u(){Ea.cancel(c.current)}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var g=function(){l.current.forEach(function(y,S){if(y&&y.offsetParent){var C=bE(y),P=C.offsetHeight;s.current.get(S)!==P&&s.current.set(S,C.offsetHeight)}}),a(function(y){return y+1})};p?g():c.current=Ea(g)}function f(p,g){var A=t(p);l.current.get(A),g?(l.current.set(A,g),d()):l.current.delete(A)}return m.useEffect(function(){return u},[]),[f,d,s.current,i]}var uDt=10;function dDt(t,e,n,o,r,i,a,l){var s=m.useRef(),c=m.useState(null),u=sn(c,2),d=u[0],f=u[1];return _a(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),k=n.get(W);if(k===void 0){C=!0;break}if(N-=k,N<=0)break}switch(T){case"top":v=x-y;break;case"bottom":v=b-S+y;break;default:{var D=t.current.scrollTop,L=D+S;xL&&(P="bottom")}}v!==null&&a(v),v!==d.lastTop&&(C=!0)}C&&f(en(en({},d),{},{times:d.times+1,targetAlign:P,lastTop:v}))}},[d,t.current]),function(p){if(p==null){l();return}if(Ea.cancel(s.current),typeof p=="number")a(p);else if(p&&hi(p)==="object"){var g,A=p.align;"index"in p?g=p.index:g=e.findIndex(function(C){return r(C)===p.key});var y=p.offset,S=y===void 0?0:y;f({times:0,index:g,offset:S,originAlign:A})}}}function fDt(t,e,n){var o=t.length,r=e.length,i,a;if(o===0&&r===0)return null;o"u"?"undefined":hi(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const FGe=function(t,e){var n=m.useRef(!1),o=m.useRef(null);function r(){clearTimeout(o.current),n.current=!0,o.current=setTimeout(function(){n.current=!1},50)}var i=m.useRef({top:t,bottom:e});return i.current.top=t,i.current.bottom=e,function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=a<0&&i.current.top||a>0&&i.current.bottom;return l&&s?(clearTimeout(o.current),n.current=!1):(!s||n.current)&&r(),!n.current&&s}};function pDt(t,e,n,o,r){var i=m.useRef(0),a=m.useRef(null),l=m.useRef(null),s=m.useRef(!1),c=FGe(e,n);function u(y,S){Ea.cancel(a.current),i.current+=S,l.current=S,!c(S)&&(Lve||y.preventDefault(),a.current=Ea(function(){var C=s.current?10:1;r(i.current*C),i.current=0}))}function d(y,S){r(S,!0),Lve||y.preventDefault()}var f=m.useRef(null),p=m.useRef(null);function g(y){if(t){Ea.cancel(p.current),p.current=Ea(function(){f.current=null},2);var S=y.deltaX,C=y.deltaY,P=y.shiftKey,v=S,T=C;(f.current==="sx"||!f.current&&P&&C&&!S)&&(v=C,T=0,f.current="sx");var w=Math.abs(v),x=Math.abs(T);f.current===null&&(f.current=o&&w>x?"x":"y"),f.current==="y"?u(y,T):d(y,v)}}function A(y){t&&(s.current=y.detail===l.current)}return[g,A]}var gDt=14/15;function mDt(t,e,n){var o=m.useRef(!1),r=m.useRef(0),i=m.useRef(null),a=m.useRef(null),l,s=function(f){if(o.current){var p=Math.ceil(f.touches[0].pageY),g=r.current-p;r.current=p,n(g)&&f.preventDefault(),clearInterval(a.current),a.current=setInterval(function(){g*=gDt,(!n(g,!0)||Math.abs(g)<=.1)&&clearInterval(a.current)},16)}},c=function(){o.current=!1,l()},u=function(f){l(),f.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(f.touches[0].pageY),i.current=f.target,i.current.addEventListener("touchmove",s),i.current.addEventListener("touchend",c))};l=function(){i.current&&(i.current.removeEventListener("touchmove",s),i.current.removeEventListener("touchend",c))},_a(function(){return t&&e.current.addEventListener("touchstart",u),function(){var d;(d=e.current)===null||d===void 0||d.removeEventListener("touchstart",u),l(),clearInterval(a.current)}},[t])}var yDt=20;function Wve(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*100;return isNaN(n)&&(n=0),n=Math.max(n,yDt),n=Math.min(n,t/2),Math.floor(n)}function ADt(t,e,n,o){var r=m.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var g=t.length,A=l.length;Ai||!!A),F=g==="rtl",E=Xn(o,Jt({},"".concat(o,"-rtl"),F),r),N=u||vDt,U=m.useRef(),W=m.useRef(),k=m.useState(0),D=sn(k,2),L=D[0],j=D[1],B=m.useState(0),O=sn(B,2),V=O[0],G=O[1],q=m.useState(!1),$=sn(q,2),ie=$[0],Q=$[1],se=function(){Q(!0)},Z=function(){Q(!1)},ee=m.useCallback(function(Ft){return typeof f=="function"?f(Ft):Ft==null?void 0:Ft[f]},[f]),te={getKey:ee};function oe(Ft){j(function(Ve){var ft;typeof Ft=="function"?ft=Ft(Ve):ft=Ft;var kt=st(ft);return U.current.scrollTop=kt,kt})}var de=m.useRef({start:0,end:N.length}),he=m.useRef(),pe=hDt(N,ee),me=sn(pe,1),le=me[0];he.current=le;var Te=cDt(ee),ge=sn(Te,4),Se=ge[0],Re=ge[1],De=ge[2],Ae=ge[3],ue=m.useMemo(function(){if(!R)return{scrollHeight:void 0,start:0,end:N.length-1,offset:void 0};if(!H){var Ft;return{scrollHeight:((Ft=W.current)===null||Ft===void 0?void 0:Ft.offsetHeight)||0,start:0,end:N.length-1,offset:void 0}}for(var Ve=0,ft,kt,rt,at=N.length,Ge=0;Ge=L&&ft===void 0&&(ft=Ge,kt=Ve),bt>L+i&&rt===void 0&&(rt=Ge),Ve=bt}return ft===void 0&&(ft=0,kt=0,rt=Math.ceil(i/a)),rt===void 0&&(rt=N.length-1),rt=Math.min(rt+1,N.length-1),{scrollHeight:Ve,start:ft,end:rt,offset:kt}},[H,R,L,N,Ae,i]),fe=ue.scrollHeight,ve=ue.start,we=ue.end,Pe=ue.offset;de.current.start=ve,de.current.end=we;var Ie=m.useState({width:0,height:i}),Me=sn(Ie,2),ze=Me[0],Ne=Me[1],Je=function(Ve){Ne({width:Ve.width||Ve.offsetWidth,height:Ve.height||Ve.offsetHeight})},Ue=m.useRef(),nt=m.useRef(),We=m.useMemo(function(){return Wve(ze.width,A)},[ze.width,A]),Ee=m.useMemo(function(){return Wve(ze.height,fe)},[ze.height,fe]),ke=fe-i,Oe=m.useRef(ke);Oe.current=ke;function st(Ft){var Ve=Ft;return Number.isNaN(Oe.current)||(Ve=Math.min(Ve,Oe.current)),Ve=Math.max(Ve,0),Ve}var je=L<=0,xt=L>=ke,gt=FGe(je,xt),Ye=function(){return{x:F?-V:V,y:L}},it=m.useRef(Ye()),ut=za(function(){if(P){var Ft=Ye();(it.current.x!==Ft.x||it.current.y!==Ft.y)&&(P(Ft),it.current=Ft)}});function Qe(Ft,Ve){var ft=Ft;Ve?(Hd.flushSync(function(){G(ft)}),ut()):oe(ft)}function lt(Ft){var Ve=Ft.currentTarget.scrollTop;Ve!==L&&oe(Ve),C==null||C(Ft),ut()}var Ze=function(Ve){var ft=Ve,kt=A-ze.width;return ft=Math.max(ft,0),ft=Math.min(ft,kt),ft},Be=za(function(Ft,Ve){Ve?(Hd.flushSync(function(){G(function(ft){var kt=ft+(F?-Ft:Ft);return Ze(kt)})}),ut()):oe(function(ft){var kt=ft+Ft;return kt})}),$e=pDt(R,je,xt,!!A,Be),wt=sn($e,2),vt=wt[0],Rt=wt[1];mDt(R,U,function(Ft,Ve){return gt(Ft,Ve)?!1:(vt({preventDefault:function(){},deltaY:Ft}),!0)}),_a(function(){function Ft(ft){R&&ft.preventDefault()}var Ve=U.current;return Ve.addEventListener("wheel",vt),Ve.addEventListener("DOMMouseScroll",Rt),Ve.addEventListener("MozMousePixelScroll",Ft),function(){Ve.removeEventListener("wheel",vt),Ve.removeEventListener("DOMMouseScroll",Rt),Ve.removeEventListener("MozMousePixelScroll",Ft)}},[R]),_a(function(){A&&G(function(Ft){return Ze(Ft)})},[ze.width,A]);var Gt=function(){var Ve,ft;(Ve=Ue.current)===null||Ve===void 0||Ve.delayHidden(),(ft=nt.current)===null||ft===void 0||ft.delayHidden()},At=dDt(U,N,De,a,ee,function(){return Re(!0)},oe,Gt);m.useImperativeHandle(e,function(){return{getScrollInfo:Ye,scrollTo:function(Ve){function ft(kt){return kt&&hi(kt)==="object"&&("left"in kt||"top"in kt)}ft(Ve)?(Ve.left!==void 0&&G(Ze(Ve.left)),At(Ve.top)):At(Ve)}}}),_a(function(){if(v){var Ft=N.slice(ve,we+1);v(Ft,N)}},[ve,we,N]);var pt=ADt(N,ee,De,a),Wt=w==null?void 0:w({start:ve,end:we,virtual:H,offsetX:V,offsetY:Pe,rtl:F,getSize:pt}),ht=lDt(N,ve,we,A,Se,d,te),ct=null;i&&(ct=en(Jt({},s?"height":"maxHeight",i),xDt),R&&(ct.overflowY="hidden",A&&(ct.overflowX="hidden"),ie&&(ct.pointerEvents="none")));var It={};return F&&(It.dir="rtl"),m.createElement("div",go({style:en(en({},c),{},{position:"relative"}),className:E},It,b),m.createElement(Cd,{onResize:Je},m.createElement(S,{className:"".concat(o,"-holder"),style:ct,ref:U,onScroll:lt,onMouseEnter:Gt},m.createElement(EGe,{prefixCls:o,height:fe,offsetX:V,offsetY:Pe,scrollWidth:A,onInnerResize:Re,ref:W,innerProps:T,rtl:F,extra:Wt},ht))),H&&fe>i&&m.createElement(kve,{ref:Ue,prefixCls:o,scrollOffset:L,scrollRange:fe,rtl:F,onScroll:Qe,onStartMove:se,onStopMove:Z,spinSize:Ee,containerSize:ze.height,style:x==null?void 0:x.verticalScrollBar,thumbStyle:x==null?void 0:x.verticalScrollBarThumb}),H&&A&&m.createElement(kve,{ref:nt,prefixCls:o,scrollOffset:V,scrollRange:A,rtl:F,onScroll:Qe,onStartMove:se,onStopMove:Z,spinSize:We,containerSize:ze.width,horizontal:!0,style:x==null?void 0:x.horizontalScrollBar,thumbStyle:x==null?void 0:x.horizontalScrollBarThumb}))}var q$=m.forwardRef(bDt);q$.displayName="List";function SDt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var TDt=["disabled","title","children","style","className"];function Nve(t){return typeof t=="string"||typeof t=="number"}var PDt=function(e,n){var o=tzt(),r=o.prefixCls,i=o.id,a=o.open,l=o.multiple,s=o.mode,c=o.searchValue,u=o.toggleOpen,d=o.notFoundContent,f=o.onPopupScroll,p=m.useContext(Lme),g=p.maxCount,A=p.flattenOptions,y=p.onActiveValue,S=p.defaultActiveFirstOption,C=p.onSelect,P=p.menuItemSelectedIcon,v=p.rawValues,T=p.fieldNames,w=p.virtual,x=p.direction,b=p.listHeight,R=p.listItemHeight,H=p.optionRender,F="".concat(r,"-item"),E=DW(function(){return A},[a,A],function(ee,te){return te[0]&&ee[1]!==te[1]}),N=m.useRef(null),U=m.useMemo(function(){return l&&Z0e(g)&&(v==null?void 0:v.size)>=g},[l,g,v==null?void 0:v.size]),W=function(te){te.preventDefault()},k=function(te){var oe;(oe=N.current)===null||oe===void 0||oe.scrollTo(typeof te=="number"?{index:te}:te)},D=function(te){for(var oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=E.length,he=0;he1&&arguments[1]!==void 0?arguments[1]:!1;O(te);var de={source:oe?"keyboard":"mouse"},he=E[te];if(!he){y(null,-1,de);return}y(he.value,te,de)};m.useEffect(function(){V(S!==!1?D(0):-1)},[E.length,c]);var G=m.useCallback(function(ee){return v.has(ee)&&s!=="combobox"},[s,No(v).toString(),v.size]);m.useEffect(function(){var ee=setTimeout(function(){if(!l&&a&&v.size===1){var oe=Array.from(v)[0],de=E.findIndex(function(he){var pe=he.data;return pe.value===oe});de!==-1&&(V(de),k(de))}});if(a){var te;(te=N.current)===null||te===void 0||te.scrollTo(void 0)}return function(){return clearTimeout(ee)}},[a,c]);var q=function(te){te!==void 0&&C(te,{selected:!v.has(te)}),l||u(!1)};if(m.useImperativeHandle(n,function(){return{onKeyDown:function(te){var oe=te.which,de=te.ctrlKey;switch(oe){case jn.N:case jn.P:case jn.UP:case jn.DOWN:{var he=0;if(oe===jn.UP?he=-1:oe===jn.DOWN?he=1:SDt()&&de&&(oe===jn.N?he=1:oe===jn.P&&(he=-1)),he!==0){var pe=D(B+he,he);k(pe),V(pe,!0)}break}case jn.ENTER:{var me,le=E[B];le&&!(le!=null&&(me=le.data)!==null&&me!==void 0&&me.disabled)&&!U?q(le.value):q(void 0),a&&te.preventDefault();break}case jn.ESC:u(!1),a&&te.stopPropagation()}},onKeyUp:function(){},scrollTo:function(te){k(te)}}}),E.length===0)return m.createElement("div",{role:"listbox",id:"".concat(i,"_list"),className:"".concat(F,"-empty"),onMouseDown:W},d);var $=Object.keys(T).map(function(ee){return T[ee]}),ie=function(te){return te.label};function Q(ee,te){var oe=ee.group;return{role:oe?"presentation":"option",id:"".concat(i,"_list_").concat(te)}}var se=function(te){var oe=E[te];if(!oe)return null;var de=oe.data||{},he=de.value,pe=oe.group,me=bf(de,!0),le=ie(oe);return oe?m.createElement("div",go({"aria-label":typeof le=="string"&&!pe?le:null},me,{key:te},Q(oe,te),{"aria-selected":G(he)}),he):null},Z={role:"listbox",id:"".concat(i,"_list")};return m.createElement(m.Fragment,null,w&&m.createElement("div",go({},Z,{style:{height:0,width:0,overflow:"hidden"}}),se(B-1),se(B),se(B+1)),m.createElement(q$,{itemKey:"key",ref:N,data:E,height:b,itemHeight:R,fullHeight:!1,onMouseDown:W,onScroll:f,virtual:w,direction:x,innerProps:w?null:Z},function(ee,te){var oe=ee.group,de=ee.groupOption,he=ee.data,pe=ee.label,me=ee.value,le=he.key;if(oe){var Te,ge=(Te=he.title)!==null&&Te!==void 0?Te:Nve(pe)?pe.toString():void 0;return m.createElement("div",{className:Xn(F,"".concat(F,"-group"),he.className),title:ge},pe!==void 0?pe:le)}var Se=he.disabled,Re=he.title;he.children;var De=he.style,Ae=he.className,ue=oi(he,TDt),fe=OH(ue,$),ve=G(me),we=Se||!ve&&U,Pe="".concat(F,"-option"),Ie=Xn(F,Pe,Ae,Jt(Jt(Jt(Jt({},"".concat(Pe,"-grouped"),de),"".concat(Pe,"-active"),B===te&&!we),"".concat(Pe,"-disabled"),we),"".concat(Pe,"-selected"),ve)),Me=ie(ee),ze=!P||typeof P=="function"||ve,Ne=typeof Me=="number"?Me:Me||me,Je=Nve(Ne)?Ne.toString():void 0;return Re!==void 0&&(Je=Re),m.createElement("div",go({},bf(fe),w?{}:Q(ee,te),{"aria-selected":ve,className:Ie,title:Je,onMouseMove:function(){B===te||we||V(te)},onClick:function(){we||q(me)},style:De}),m.createElement("div",{className:"".concat(Pe,"-content")},typeof H=="function"?H(ee,{index:te}):Ne),m.isValidElement(P)||ve,ze&&m.createElement(J$,{className:"".concat(F,"-option-state"),customizeIcon:P,customizeIconProps:{value:me,disabled:we,isSelected:ve}},ve?"✓":null))}))},CDt=m.forwardRef(PDt);const RDt=function(t,e){var n=m.useRef({values:new Map,options:new Map}),o=m.useMemo(function(){var i=n.current,a=i.values,l=i.options,s=t.map(function(d){if(d.label===void 0){var f;return en(en({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return s.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||l.get(d.value))}),n.current.values=c,n.current.options=u,s},[t,e]),r=m.useCallback(function(i){return e.get(i)||n.current.options.get(i)},[e]);return[o,r]};function lie(t,e){return MGe(t).join("").toUpperCase().includes(e)}const HDt=function(t,e,n,o,r){return m.useMemo(function(){if(!n||o===!1)return t;var i=e.options,a=e.label,l=e.value,s=[],c=typeof o=="function",u=n.toUpperCase(),d=c?o:function(p,g){return r?lie(g[r],u):g[i]?lie(g[a!=="children"?a:"label"],u):lie(g[l],u)},f=c?function(p){return eue(p)}:function(p){return p};return t.forEach(function(p){if(p[i]){var g=d(n,f(p));if(g)s.push(p);else{var A=p[i].filter(function(y){return d(n,f(y))});A.length&&s.push(en(en({},p),{},Jt({},i,A)))}return}d(n,f(p))&&s.push(p)}),s},[t,o,r,n,e])};var Uve=0,MDt=fp();function IDt(){var t;return MDt?(t=Uve,Uve+=1):t="TEST_OR_SSR",t}function zDt(t){var e=m.useState(),n=sn(e,2),o=n[0],r=n[1];return m.useEffect(function(){r("rc_select_".concat(IDt()))},[]),t||o}var DDt=["children","value"],EDt=["children"];function FDt(t){var e=t,n=e.key,o=e.props,r=o.children,i=o.value,a=oi(o,DDt);return en({key:n,value:i!==void 0?i:n,children:r},a)}function kGe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return lw(t).map(function(n,o){if(!m.isValidElement(n)||!n.type)return null;var r=n,i=r.type.isSelectOptGroup,a=r.key,l=r.props,s=l.children,c=oi(l,EDt);return e||!i?FDt(n):en(en({key:"__RC_SELECT_GRP__".concat(a===null?o:a,"__"),label:a},c),{},{options:kGe(s)})}).filter(function(n){return n})}var kDt=function(e,n,o,r,i){return m.useMemo(function(){var a=e,l=!e;l&&(a=kGe(n));var s=new Map,c=new Map,u=function(p,g,A){A&&typeof A=="string"&&p.set(g[A],g)},d=function f(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,A=0;A2&&arguments[2]!==void 0?arguments[2]:{},Rt=vt.source,Gt=Rt===void 0?"keyboard":Rt;xt(wt),a&&o==="combobox"&&$e!==null&&Gt==="keyboard"&&ke(String($e))},[a,o]),it=function(wt,vt,Rt){var Gt=function(){var kt,rt=fe(wt);return[j?{label:rt==null?void 0:rt[Q.label],value:wt,key:(kt=rt==null?void 0:rt.key)!==null&&kt!==void 0?kt:wt}:wt,eue(rt)]};if(vt&&p){var At=Gt(),pt=sn(At,2),Wt=pt[0],ht=pt[1];p(Wt,ht)}else if(!vt&&g&&Rt!=="clear"){var ct=Gt(),It=sn(ct,2),Ft=It[0],Ve=It[1];g(Ft,Ve)}},ut=jve(function($e,wt){var vt,Rt=q?wt.selected:!0;Rt?vt=q?[].concat(No(ue),[$e]):[$e]:vt=ue.filter(function(Gt){return Gt.value!==$e}),Ue(vt),it($e,Rt),o==="combobox"?ke(""):(!tue||f)&&(te(""),ke(""))}),Qe=function(wt,vt){Ue(wt);var Rt=vt.type,Gt=vt.values;(Rt==="remove"||Rt==="clear")&&Gt.forEach(function(At){it(At.value,!1,Rt)})},lt=function(wt,vt){if(te(wt),ke(null),vt.source==="submit"){var Rt=(wt||"").trim();if(Rt){var Gt=Array.from(new Set([].concat(No(we),[Rt])));Ue(Gt),it(Rt,!0),te("")}return}vt.source!=="blur"&&(o==="combobox"&&Ue(wt),u==null||u(wt))},Ze=function(wt){var vt=wt;o!=="tags"&&(vt=wt.map(function(Gt){var At=he.get(Gt);return At==null?void 0:At.value}).filter(function(Gt){return Gt!==void 0}));var Rt=Array.from(new Set([].concat(No(we),No(vt))));Ue(Rt),Rt.forEach(function(Gt){it(Gt,!0)})},Be=m.useMemo(function(){var $e=H!==!1&&y!==!1;return en(en({},oe),{},{flattenOptions:Je,onActiveValue:Ye,defaultActiveFirstOption:gt,onSelect:ut,menuItemSelectedIcon:R,rawValues:we,fieldNames:Q,virtual:$e,direction:F,listHeight:N,listItemHeight:W,childrenAsData:$,maxCount:O,optionRender:w})},[O,oe,Je,Ye,gt,ut,R,we,Q,H,y,F,N,W,$,w]);return m.createElement(Lme.Provider,{value:Be},m.createElement(iDt,go({},V,{id:G,prefixCls:i,ref:e,omitDomProps:WDt,mode:o,displayValues:ve,onDisplayValuesChange:Qe,direction:F,searchValue:ee,onSearch:lt,autoClearSearchValue:f,onSearchSplit:Ze,dropdownMatchSelectWidth:y,OptionList:CDt,emptyOptions:!Je.length,activeValue:Ee,activeDescendantId:"".concat(G,"_list_").concat(je)})))}),Ume=UDt;Ume.Option=Nme;Ume.OptGroup=Wme;function fw(t,e,n){return Un({[`${t}-status-success`]:e==="success",[`${t}-status-warning`]:e==="warning",[`${t}-status-error`]:e==="error",[`${t}-status-validating`]:e==="validating",[`${t}-has-feedback`]:n})}const Yb=(t,e)=>e||t,jDt=()=>{const[,t]=Vu(),n=new Wl(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return m.createElement("svg",{style:n,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},m.createElement("g",{fill:"none",fillRule:"evenodd"},m.createElement("g",{transform:"translate(24 31.67)"},m.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),m.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),m.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),m.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),m.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),m.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),m.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},m.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),m.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},BDt=()=>{const[,t]=Vu(),{colorFill:e,colorFillTertiary:n,colorFillQuaternary:o,colorBgContainer:r}=t,{borderColor:i,shadowColor:a,contentColor:l}=m.useMemo(()=>({borderColor:new Wl(e).onBackground(r).toHexShortString(),shadowColor:new Wl(n).onBackground(r).toHexShortString(),contentColor:new Wl(o).onBackground(r).toHexShortString()}),[e,n,o,r]);return m.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},m.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},m.createElement("ellipse",{fill:a,cx:"32",cy:"33",rx:"32",ry:"7"}),m.createElement("g",{fillRule:"nonzero",stroke:i},m.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),m.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:l}))))},YDt=t=>{const{componentCls:e,margin:n,marginXS:o,marginXL:r,fontSize:i,lineHeight:a}=t;return{[e]:{marginInline:o,fontSize:i,lineHeight:a,textAlign:"center",[`${e}-image`]:{height:t.emptyImgHeight,marginBottom:o,opacity:t.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${e}-description`]:{color:t.colorText},[`${e}-footer`]:{marginTop:n},"&-normal":{marginBlock:r,color:t.colorTextDescription,[`${e}-description`]:{color:t.colorTextDescription},[`${e}-image`]:{height:t.emptyImgHeightMD}},"&-small":{marginBlock:o,color:t.colorTextDescription,[`${e}-image`]:{height:t.emptyImgHeightSM}}}}},ODt=wl("Empty",t=>{const{componentCls:e,controlHeightLG:n,calc:o}=t,r=qi(t,{emptyImgCls:`${e}-img`,emptyImgHeight:o(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:o(n).mul(.875).equal()});return[YDt(r)]});var VDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{className:e,rootClassName:n,prefixCls:o,image:r=LGe,description:i,children:a,imageStyle:l,style:s}=t,c=VDt(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style"]);const{getPrefixCls:u,direction:d,empty:f}=m.useContext(Cr),p=u("empty",o),[g,A,y]=ODt(p),[S]=Uw("Empty"),C=typeof i<"u"?i:S==null?void 0:S.description,P=typeof C=="string"?C:"empty";let v=null;return typeof r=="string"?v=m.createElement("img",{alt:P,src:r}):v=r,g(m.createElement("div",Object.assign({className:Un(A,y,p,f==null?void 0:f.className,{[`${p}-normal`]:r===WGe,[`${p}-rtl`]:d==="rtl"},e,n),style:Object.assign(Object.assign({},f==null?void 0:f.style),s)},c),m.createElement("div",{className:`${p}-image`,style:l},v),C&&m.createElement("div",{className:`${p}-description`},C),a&&m.createElement("div",{className:`${p}-footer`},a)))};ug.PRESENTED_IMAGE_DEFAULT=LGe;ug.PRESENTED_IMAGE_SIMPLE=WGe;const jme=t=>{const{componentName:e}=t,{getPrefixCls:n}=m.useContext(Cr),o=n("empty");switch(e){case"Table":case"List":return be.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return be.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,className:`${o}-small`});default:return be.createElement(ug,null)}},_Dt=["outlined","borderless","filled"],VH=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;const n=m.useContext(iIt);let o;typeof t<"u"?o=t:e===!1?o="borderless":o=n??"outlined";const r=_Dt.includes(o);return[o,r]},GDt=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function XDt(t,e){return t||GDt(e)}const Bve=t=>{const{optionHeight:e,optionFontSize:n,optionLineHeight:o,optionPadding:r}=t;return{position:"relative",display:"block",minHeight:e,padding:r,color:t.colorText,fontWeight:"normal",fontSize:n,lineHeight:o,boxSizing:"border-box"}},JDt=t=>{const{antCls:e,componentCls:n}=t,o=`${n}-item`,r=`&${e}-slide-up-enter${e}-slide-up-enter-active`,i=`&${e}-slide-up-appear${e}-slide-up-appear-active`,a=`&${e}-slide-up-leave${e}-slide-up-leave-active`,l=`${n}-dropdown-placement-`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:-9999,zIndex:t.zIndexPopup,boxSizing:"border-box",padding:t.paddingXXS,overflow:"hidden",fontSize:t.fontSize,fontVariant:"initial",backgroundColor:t.colorBgElevated,borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,[` +`].includes(On)})},[W]),vt=m.useContext(Lme)||{},Rt=vt.maxCount,Gt=vt.rawValues,At=function(fo,ir,Rr){if(!(Te&&Z0e(Rt)&&(Gt==null?void 0:Gt.size)>=Rt)){var br=!0,_r=fo;R==null||R(null);var jo=nDt(fo,W,Z0e(Rt)?Rt-Gt.size:void 0),wn=Rr?null:jo;return y!=="combobox"&&wn&&(_r="",U==null||U(wn),$e(!1),br=!1),N&&We!==_r&&N(_r,{source:ir?"typing":"effect"}),br}},pt=function(fo){!fo||!fo.trim()||N(fo,{source:"submit"})};m.useEffect(function(){!lt&&!Te&&y!=="combobox"&&At("",!1,!1)},[lt]),m.useEffect(function(){ut&&S&&Qe(!1),S&&!Me.current&&Ue(!1)},[S]);var Wt=TGe(),ht=sn(Wt,2),ct=ht[0],It=ht[1],Ft=function(fo){var ir=ct(),Rr=fo.which;if(Rr===jn.ENTER&&(y!=="combobox"&&fo.preventDefault(),lt||$e(!0)),It(!!We),Rr===jn.BACKSPACE&&!ir&&Te&&!We&&u.length){for(var br=No(u),_r=null,jo=br.length-1;jo>=0;jo-=1){var wn=br[jo];if(!wn.disabled){br.splice(jo,1),_r=wn;break}}_r&&d(br,{type:"remove",values:[_r]})}for(var In=arguments.length,ar=new Array(In>1?In-1:0),Wo=1;Wo1?ir-1:0),br=1;br1?jo-1:0),In=1;In0,G=m.useMemo(function(){if(i===0||B===0)return 0;var ee=i/B;return ee*O},[i,B,O]),q=function(de){de.stopPropagation(),de.preventDefault()},$=m.useRef({top:G,dragging:S,pageY:T,startTop:R});$.current={top:G,dragging:S,pageY:T,startTop:R};var ie=function(de){C(!0),w(Fve(de,u)),H($.current.top),l(),de.stopPropagation(),de.preventDefault()};m.useEffect(function(){var ee=function(ye){ye.preventDefault()},de=E.current,fe=N.current;return de.addEventListener("touchstart",ee),fe.addEventListener("touchstart",ie),function(){de.removeEventListener("touchstart",ee),fe.removeEventListener("touchstart",ie)}},[]);var Q=m.useRef();Q.current=B;var se=m.useRef();se.current=O,m.useEffect(function(){if(S){var ee,de=function(ye){var ae=$.current,Te=ae.dragging,ge=ae.pageY,Se=ae.startTop;if(Ea.cancel(ee),Te){var Re=Fve(ye,u)-ge,De=Se;!F&&u?De-=Re:De+=Re;var Ae=Q.current,ue=se.current,he=ue?De/ue:0,ve=Math.ceil(he*Ae);ve=Math.max(ve,0),ve=Math.min(ve,Ae),ee=Ea(function(){c(ve,u)})}},fe=function(){C(!1),s()};return window.addEventListener("mousemove",de),window.addEventListener("touchmove",de),window.addEventListener("mouseup",fe),window.addEventListener("touchend",fe),function(){window.removeEventListener("mousemove",de),window.removeEventListener("touchmove",de),window.removeEventListener("mouseup",fe),window.removeEventListener("touchend",fe),Ea.cancel(ee)}}},[S]),m.useEffect(function(){j()},[i]),m.useImperativeHandle(e,function(){return{delayHidden:j}});var oe="".concat(o,"-scrollbar"),Z={position:"absolute",visibility:k&&V?null:"hidden"},te={position:"absolute",background:"rgba(0, 0, 0, 0.5)",borderRadius:99,cursor:"pointer",userSelect:"none"};return u?(Z.height=8,Z.left=0,Z.right=0,Z.bottom=0,te.height="100%",te.width=d,F?te.left=G:te.right=G):(Z.width=8,Z.top=0,Z.bottom=0,F?Z.right=0:Z.left=0,te.width="100%",te.height=d,te.top=G),m.createElement("div",{ref:E,className:Xn(oe,(n={},Jt(n,"".concat(oe,"-horizontal"),u),Jt(n,"".concat(oe,"-vertical"),!u),Jt(n,"".concat(oe,"-visible"),k),n)),style:en(en({},Z),p),onMouseDown:q,onMouseMove:j},m.createElement("div",{ref:N,className:Xn("".concat(oe,"-thumb"),Jt({},"".concat(oe,"-thumb-moving"),S)),style:en(en({},te),g),onMouseDown:ie}))});function aDt(t){var e=t.children,n=t.setRef,o=m.useCallback(function(r){n(r)},[]);return m.cloneElement(e,{ref:o})}function lDt(t,e,n,o,r,i,a){var l=a.getKey;return t.slice(e,n+1).map(function(s,c){var u=e+c,d=i(s,u,{style:{width:o}}),f=l(s);return m.createElement(aDt,{key:f,setRef:function(g){return r(s,g)}},d)})}var sDt=function(){function t(){wp(this,t),this.maps=void 0,this.id=0,this.maps=Object.create(null)}return vp(t,[{key:"set",value:function(n,o){this.maps[n]=o,this.id+=1}},{key:"get",value:function(n){return this.maps[n]}}]),t}();function cDt(t,e,n){var o=m.useState(0),r=sn(o,2),i=r[0],a=r[1],l=m.useRef(new Map),s=m.useRef(new sDt),c=m.useRef();function u(){Ea.cancel(c.current)}function d(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;u();var g=function(){l.current.forEach(function(y,S){if(y&&y.offsetParent){var C=bE(y),P=C.offsetHeight;s.current.get(S)!==P&&s.current.set(S,C.offsetHeight)}}),a(function(y){return y+1})};p?g():c.current=Ea(g)}function f(p,g){var A=t(p);l.current.get(A),g?(l.current.set(A,g),d()):l.current.delete(A)}return m.useEffect(function(){return u},[]),[f,d,s.current,i]}var uDt=10;function dDt(t,e,n,o,r,i,a,l){var s=m.useRef(),c=m.useState(null),u=sn(c,2),d=u[0],f=u[1];return _a(function(){if(d&&d.times=0;U-=1){var W=r(e[U]),k=n.get(W);if(k===void 0){C=!0;break}if(N-=k,N<=0)break}switch(T){case"top":v=x-y;break;case"bottom":v=b-S+y;break;default:{var D=t.current.scrollTop,L=D+S;xL&&(P="bottom")}}v!==null&&a(v),v!==d.lastTop&&(C=!0)}C&&f(en(en({},d),{},{times:d.times+1,targetAlign:P,lastTop:v}))}},[d,t.current]),function(p){if(p==null){l();return}if(Ea.cancel(s.current),typeof p=="number")a(p);else if(p&&hi(p)==="object"){var g,A=p.align;"index"in p?g=p.index:g=e.findIndex(function(C){return r(C)===p.key});var y=p.offset,S=y===void 0?0:y;f({times:0,index:g,offset:S,originAlign:A})}}}function fDt(t,e,n){var o=t.length,r=e.length,i,a;if(o===0&&r===0)return null;o"u"?"undefined":hi(navigator))==="object"&&/Firefox/i.test(navigator.userAgent);const FGe=function(t,e){var n=m.useRef(!1),o=m.useRef(null);function r(){clearTimeout(o.current),n.current=!0,o.current=setTimeout(function(){n.current=!1},50)}var i=m.useRef({top:t,bottom:e});return i.current.top=t,i.current.bottom=e,function(a){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=a<0&&i.current.top||a>0&&i.current.bottom;return l&&s?(clearTimeout(o.current),n.current=!1):(!s||n.current)&&r(),!n.current&&s}};function pDt(t,e,n,o,r){var i=m.useRef(0),a=m.useRef(null),l=m.useRef(null),s=m.useRef(!1),c=FGe(e,n);function u(y,S){Ea.cancel(a.current),i.current+=S,l.current=S,!c(S)&&(Lve||y.preventDefault(),a.current=Ea(function(){var C=s.current?10:1;r(i.current*C),i.current=0}))}function d(y,S){r(S,!0),Lve||y.preventDefault()}var f=m.useRef(null),p=m.useRef(null);function g(y){if(t){Ea.cancel(p.current),p.current=Ea(function(){f.current=null},2);var S=y.deltaX,C=y.deltaY,P=y.shiftKey,v=S,T=C;(f.current==="sx"||!f.current&&P&&C&&!S)&&(v=C,T=0,f.current="sx");var w=Math.abs(v),x=Math.abs(T);f.current===null&&(f.current=o&&w>x?"x":"y"),f.current==="y"?u(y,T):d(y,v)}}function A(y){t&&(s.current=y.detail===l.current)}return[g,A]}var gDt=14/15;function mDt(t,e,n){var o=m.useRef(!1),r=m.useRef(0),i=m.useRef(null),a=m.useRef(null),l,s=function(f){if(o.current){var p=Math.ceil(f.touches[0].pageY),g=r.current-p;r.current=p,n(g)&&f.preventDefault(),clearInterval(a.current),a.current=setInterval(function(){g*=gDt,(!n(g,!0)||Math.abs(g)<=.1)&&clearInterval(a.current)},16)}},c=function(){o.current=!1,l()},u=function(f){l(),f.touches.length===1&&!o.current&&(o.current=!0,r.current=Math.ceil(f.touches[0].pageY),i.current=f.target,i.current.addEventListener("touchmove",s),i.current.addEventListener("touchend",c))};l=function(){i.current&&(i.current.removeEventListener("touchmove",s),i.current.removeEventListener("touchend",c))},_a(function(){return t&&e.current.addEventListener("touchstart",u),function(){var d;(d=e.current)===null||d===void 0||d.removeEventListener("touchstart",u),l(),clearInterval(a.current)}},[t])}var yDt=20;function Wve(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t/e*100;return isNaN(n)&&(n=0),n=Math.max(n,yDt),n=Math.min(n,t/2),Math.floor(n)}function ADt(t,e,n,o){var r=m.useMemo(function(){return[new Map,[]]},[t,n.id,o]),i=sn(r,2),a=i[0],l=i[1],s=function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,f=a.get(u),p=a.get(d);if(f===void 0||p===void 0)for(var g=t.length,A=l.length;Ai||!!A),F=g==="rtl",E=Xn(o,Jt({},"".concat(o,"-rtl"),F),r),N=u||vDt,U=m.useRef(),W=m.useRef(),k=m.useState(0),D=sn(k,2),L=D[0],j=D[1],B=m.useState(0),O=sn(B,2),V=O[0],G=O[1],q=m.useState(!1),$=sn(q,2),ie=$[0],Q=$[1],se=function(){Q(!0)},oe=function(){Q(!1)},Z=m.useCallback(function(Ft){return typeof f=="function"?f(Ft):Ft==null?void 0:Ft[f]},[f]),te={getKey:Z};function ee(Ft){j(function(Ve){var ft;typeof Ft=="function"?ft=Ft(Ve):ft=Ft;var kt=st(ft);return U.current.scrollTop=kt,kt})}var de=m.useRef({start:0,end:N.length}),fe=m.useRef(),pe=hDt(N,Z),ye=sn(pe,1),ae=ye[0];fe.current=ae;var Te=cDt(Z),ge=sn(Te,4),Se=ge[0],Re=ge[1],De=ge[2],Ae=ge[3],ue=m.useMemo(function(){if(!R)return{scrollHeight:void 0,start:0,end:N.length-1,offset:void 0};if(!H){var Ft;return{scrollHeight:((Ft=W.current)===null||Ft===void 0?void 0:Ft.offsetHeight)||0,start:0,end:N.length-1,offset:void 0}}for(var Ve=0,ft,kt,rt,at=N.length,Ge=0;Ge=L&&ft===void 0&&(ft=Ge,kt=Ve),bt>L+i&&rt===void 0&&(rt=Ge),Ve=bt}return ft===void 0&&(ft=0,kt=0,rt=Math.ceil(i/a)),rt===void 0&&(rt=N.length-1),rt=Math.min(rt+1,N.length-1),{scrollHeight:Ve,start:ft,end:rt,offset:kt}},[H,R,L,N,Ae,i]),he=ue.scrollHeight,ve=ue.start,we=ue.end,Pe=ue.offset;de.current.start=ve,de.current.end=we;var Ie=m.useState({width:0,height:i}),Me=sn(Ie,2),ze=Me[0],Ne=Me[1],Je=function(Ve){Ne({width:Ve.width||Ve.offsetWidth,height:Ve.height||Ve.offsetHeight})},Ue=m.useRef(),nt=m.useRef(),We=m.useMemo(function(){return Wve(ze.width,A)},[ze.width,A]),Ee=m.useMemo(function(){return Wve(ze.height,he)},[ze.height,he]),ke=he-i,Oe=m.useRef(ke);Oe.current=ke;function st(Ft){var Ve=Ft;return Number.isNaN(Oe.current)||(Ve=Math.min(Ve,Oe.current)),Ve=Math.max(Ve,0),Ve}var je=L<=0,xt=L>=ke,gt=FGe(je,xt),Ye=function(){return{x:F?-V:V,y:L}},it=m.useRef(Ye()),ut=za(function(){if(P){var Ft=Ye();(it.current.x!==Ft.x||it.current.y!==Ft.y)&&(P(Ft),it.current=Ft)}});function Qe(Ft,Ve){var ft=Ft;Ve?(Hd.flushSync(function(){G(ft)}),ut()):ee(ft)}function lt(Ft){var Ve=Ft.currentTarget.scrollTop;Ve!==L&&ee(Ve),C==null||C(Ft),ut()}var Ze=function(Ve){var ft=Ve,kt=A-ze.width;return ft=Math.max(ft,0),ft=Math.min(ft,kt),ft},Be=za(function(Ft,Ve){Ve?(Hd.flushSync(function(){G(function(ft){var kt=ft+(F?-Ft:Ft);return Ze(kt)})}),ut()):ee(function(ft){var kt=ft+Ft;return kt})}),$e=pDt(R,je,xt,!!A,Be),wt=sn($e,2),vt=wt[0],Rt=wt[1];mDt(R,U,function(Ft,Ve){return gt(Ft,Ve)?!1:(vt({preventDefault:function(){},deltaY:Ft}),!0)}),_a(function(){function Ft(ft){R&&ft.preventDefault()}var Ve=U.current;return Ve.addEventListener("wheel",vt),Ve.addEventListener("DOMMouseScroll",Rt),Ve.addEventListener("MozMousePixelScroll",Ft),function(){Ve.removeEventListener("wheel",vt),Ve.removeEventListener("DOMMouseScroll",Rt),Ve.removeEventListener("MozMousePixelScroll",Ft)}},[R]),_a(function(){A&&G(function(Ft){return Ze(Ft)})},[ze.width,A]);var Gt=function(){var Ve,ft;(Ve=Ue.current)===null||Ve===void 0||Ve.delayHidden(),(ft=nt.current)===null||ft===void 0||ft.delayHidden()},At=dDt(U,N,De,a,Z,function(){return Re(!0)},ee,Gt);m.useImperativeHandle(e,function(){return{getScrollInfo:Ye,scrollTo:function(Ve){function ft(kt){return kt&&hi(kt)==="object"&&("left"in kt||"top"in kt)}ft(Ve)?(Ve.left!==void 0&&G(Ze(Ve.left)),At(Ve.top)):At(Ve)}}}),_a(function(){if(v){var Ft=N.slice(ve,we+1);v(Ft,N)}},[ve,we,N]);var pt=ADt(N,Z,De,a),Wt=w==null?void 0:w({start:ve,end:we,virtual:H,offsetX:V,offsetY:Pe,rtl:F,getSize:pt}),ht=lDt(N,ve,we,A,Se,d,te),ct=null;i&&(ct=en(Jt({},s?"height":"maxHeight",i),xDt),R&&(ct.overflowY="hidden",A&&(ct.overflowX="hidden"),ie&&(ct.pointerEvents="none")));var It={};return F&&(It.dir="rtl"),m.createElement("div",go({style:en(en({},c),{},{position:"relative"}),className:E},It,b),m.createElement(Cd,{onResize:Je},m.createElement(S,{className:"".concat(o,"-holder"),style:ct,ref:U,onScroll:lt,onMouseEnter:Gt},m.createElement(EGe,{prefixCls:o,height:he,offsetX:V,offsetY:Pe,scrollWidth:A,onInnerResize:Re,ref:W,innerProps:T,rtl:F,extra:Wt},ht))),H&&he>i&&m.createElement(kve,{ref:Ue,prefixCls:o,scrollOffset:L,scrollRange:he,rtl:F,onScroll:Qe,onStartMove:se,onStopMove:oe,spinSize:Ee,containerSize:ze.height,style:x==null?void 0:x.verticalScrollBar,thumbStyle:x==null?void 0:x.verticalScrollBarThumb}),H&&A&&m.createElement(kve,{ref:nt,prefixCls:o,scrollOffset:V,scrollRange:A,rtl:F,onScroll:Qe,onStartMove:se,onStopMove:oe,spinSize:We,containerSize:ze.width,horizontal:!0,style:x==null?void 0:x.horizontalScrollBar,thumbStyle:x==null?void 0:x.horizontalScrollBarThumb}))}var q$=m.forwardRef(bDt);q$.displayName="List";function SDt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var TDt=["disabled","title","children","style","className"];function Nve(t){return typeof t=="string"||typeof t=="number"}var PDt=function(e,n){var o=tzt(),r=o.prefixCls,i=o.id,a=o.open,l=o.multiple,s=o.mode,c=o.searchValue,u=o.toggleOpen,d=o.notFoundContent,f=o.onPopupScroll,p=m.useContext(Lme),g=p.maxCount,A=p.flattenOptions,y=p.onActiveValue,S=p.defaultActiveFirstOption,C=p.onSelect,P=p.menuItemSelectedIcon,v=p.rawValues,T=p.fieldNames,w=p.virtual,x=p.direction,b=p.listHeight,R=p.listItemHeight,H=p.optionRender,F="".concat(r,"-item"),E=DW(function(){return A},[a,A],function(Z,te){return te[0]&&Z[1]!==te[1]}),N=m.useRef(null),U=m.useMemo(function(){return l&&Z0e(g)&&(v==null?void 0:v.size)>=g},[l,g,v==null?void 0:v.size]),W=function(te){te.preventDefault()},k=function(te){var ee;(ee=N.current)===null||ee===void 0||ee.scrollTo(typeof te=="number"?{index:te}:te)},D=function(te){for(var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=E.length,fe=0;fe1&&arguments[1]!==void 0?arguments[1]:!1;O(te);var de={source:ee?"keyboard":"mouse"},fe=E[te];if(!fe){y(null,-1,de);return}y(fe.value,te,de)};m.useEffect(function(){V(S!==!1?D(0):-1)},[E.length,c]);var G=m.useCallback(function(Z){return v.has(Z)&&s!=="combobox"},[s,No(v).toString(),v.size]);m.useEffect(function(){var Z=setTimeout(function(){if(!l&&a&&v.size===1){var ee=Array.from(v)[0],de=E.findIndex(function(fe){var pe=fe.data;return pe.value===ee});de!==-1&&(V(de),k(de))}});if(a){var te;(te=N.current)===null||te===void 0||te.scrollTo(void 0)}return function(){return clearTimeout(Z)}},[a,c]);var q=function(te){te!==void 0&&C(te,{selected:!v.has(te)}),l||u(!1)};if(m.useImperativeHandle(n,function(){return{onKeyDown:function(te){var ee=te.which,de=te.ctrlKey;switch(ee){case jn.N:case jn.P:case jn.UP:case jn.DOWN:{var fe=0;if(ee===jn.UP?fe=-1:ee===jn.DOWN?fe=1:SDt()&&de&&(ee===jn.N?fe=1:ee===jn.P&&(fe=-1)),fe!==0){var pe=D(B+fe,fe);k(pe),V(pe,!0)}break}case jn.ENTER:{var ye,ae=E[B];ae&&!(ae!=null&&(ye=ae.data)!==null&&ye!==void 0&&ye.disabled)&&!U?q(ae.value):q(void 0),a&&te.preventDefault();break}case jn.ESC:u(!1),a&&te.stopPropagation()}},onKeyUp:function(){},scrollTo:function(te){k(te)}}}),E.length===0)return m.createElement("div",{role:"listbox",id:"".concat(i,"_list"),className:"".concat(F,"-empty"),onMouseDown:W},d);var $=Object.keys(T).map(function(Z){return T[Z]}),ie=function(te){return te.label};function Q(Z,te){var ee=Z.group;return{role:ee?"presentation":"option",id:"".concat(i,"_list_").concat(te)}}var se=function(te){var ee=E[te];if(!ee)return null;var de=ee.data||{},fe=de.value,pe=ee.group,ye=bf(de,!0),ae=ie(ee);return ee?m.createElement("div",go({"aria-label":typeof ae=="string"&&!pe?ae:null},ye,{key:te},Q(ee,te),{"aria-selected":G(fe)}),fe):null},oe={role:"listbox",id:"".concat(i,"_list")};return m.createElement(m.Fragment,null,w&&m.createElement("div",go({},oe,{style:{height:0,width:0,overflow:"hidden"}}),se(B-1),se(B),se(B+1)),m.createElement(q$,{itemKey:"key",ref:N,data:E,height:b,itemHeight:R,fullHeight:!1,onMouseDown:W,onScroll:f,virtual:w,direction:x,innerProps:w?null:oe},function(Z,te){var ee=Z.group,de=Z.groupOption,fe=Z.data,pe=Z.label,ye=Z.value,ae=fe.key;if(ee){var Te,ge=(Te=fe.title)!==null&&Te!==void 0?Te:Nve(pe)?pe.toString():void 0;return m.createElement("div",{className:Xn(F,"".concat(F,"-group"),fe.className),title:ge},pe!==void 0?pe:ae)}var Se=fe.disabled,Re=fe.title;fe.children;var De=fe.style,Ae=fe.className,ue=oi(fe,TDt),he=OH(ue,$),ve=G(ye),we=Se||!ve&&U,Pe="".concat(F,"-option"),Ie=Xn(F,Pe,Ae,Jt(Jt(Jt(Jt({},"".concat(Pe,"-grouped"),de),"".concat(Pe,"-active"),B===te&&!we),"".concat(Pe,"-disabled"),we),"".concat(Pe,"-selected"),ve)),Me=ie(Z),ze=!P||typeof P=="function"||ve,Ne=typeof Me=="number"?Me:Me||ye,Je=Nve(Ne)?Ne.toString():void 0;return Re!==void 0&&(Je=Re),m.createElement("div",go({},bf(he),w?{}:Q(Z,te),{"aria-selected":ve,className:Ie,title:Je,onMouseMove:function(){B===te||we||V(te)},onClick:function(){we||q(ye)},style:De}),m.createElement("div",{className:"".concat(Pe,"-content")},typeof H=="function"?H(Z,{index:te}):Ne),m.isValidElement(P)||ve,ze&&m.createElement(J$,{className:"".concat(F,"-option-state"),customizeIcon:P,customizeIconProps:{value:ye,disabled:we,isSelected:ve}},ve?"✓":null))}))},CDt=m.forwardRef(PDt);const RDt=function(t,e){var n=m.useRef({values:new Map,options:new Map}),o=m.useMemo(function(){var i=n.current,a=i.values,l=i.options,s=t.map(function(d){if(d.label===void 0){var f;return en(en({},d),{},{label:(f=a.get(d.value))===null||f===void 0?void 0:f.label})}return d}),c=new Map,u=new Map;return s.forEach(function(d){c.set(d.value,d),u.set(d.value,e.get(d.value)||l.get(d.value))}),n.current.values=c,n.current.options=u,s},[t,e]),r=m.useCallback(function(i){return e.get(i)||n.current.options.get(i)},[e]);return[o,r]};function lie(t,e){return MGe(t).join("").toUpperCase().includes(e)}const HDt=function(t,e,n,o,r){return m.useMemo(function(){if(!n||o===!1)return t;var i=e.options,a=e.label,l=e.value,s=[],c=typeof o=="function",u=n.toUpperCase(),d=c?o:function(p,g){return r?lie(g[r],u):g[i]?lie(g[a!=="children"?a:"label"],u):lie(g[l],u)},f=c?function(p){return eue(p)}:function(p){return p};return t.forEach(function(p){if(p[i]){var g=d(n,f(p));if(g)s.push(p);else{var A=p[i].filter(function(y){return d(n,f(y))});A.length&&s.push(en(en({},p),{},Jt({},i,A)))}return}d(n,f(p))&&s.push(p)}),s},[t,o,r,n,e])};var Uve=0,MDt=fp();function IDt(){var t;return MDt?(t=Uve,Uve+=1):t="TEST_OR_SSR",t}function zDt(t){var e=m.useState(),n=sn(e,2),o=n[0],r=n[1];return m.useEffect(function(){r("rc_select_".concat(IDt()))},[]),t||o}var DDt=["children","value"],EDt=["children"];function FDt(t){var e=t,n=e.key,o=e.props,r=o.children,i=o.value,a=oi(o,DDt);return en({key:n,value:i!==void 0?i:n,children:r},a)}function kGe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return lw(t).map(function(n,o){if(!m.isValidElement(n)||!n.type)return null;var r=n,i=r.type.isSelectOptGroup,a=r.key,l=r.props,s=l.children,c=oi(l,EDt);return e||!i?FDt(n):en(en({key:"__RC_SELECT_GRP__".concat(a===null?o:a,"__"),label:a},c),{},{options:kGe(s)})}).filter(function(n){return n})}var kDt=function(e,n,o,r,i){return m.useMemo(function(){var a=e,l=!e;l&&(a=kGe(n));var s=new Map,c=new Map,u=function(p,g,A){A&&typeof A=="string"&&p.set(g[A],g)},d=function f(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,A=0;A2&&arguments[2]!==void 0?arguments[2]:{},Rt=vt.source,Gt=Rt===void 0?"keyboard":Rt;xt(wt),a&&o==="combobox"&&$e!==null&&Gt==="keyboard"&&ke(String($e))},[a,o]),it=function(wt,vt,Rt){var Gt=function(){var kt,rt=he(wt);return[j?{label:rt==null?void 0:rt[Q.label],value:wt,key:(kt=rt==null?void 0:rt.key)!==null&&kt!==void 0?kt:wt}:wt,eue(rt)]};if(vt&&p){var At=Gt(),pt=sn(At,2),Wt=pt[0],ht=pt[1];p(Wt,ht)}else if(!vt&&g&&Rt!=="clear"){var ct=Gt(),It=sn(ct,2),Ft=It[0],Ve=It[1];g(Ft,Ve)}},ut=jve(function($e,wt){var vt,Rt=q?wt.selected:!0;Rt?vt=q?[].concat(No(ue),[$e]):[$e]:vt=ue.filter(function(Gt){return Gt.value!==$e}),Ue(vt),it($e,Rt),o==="combobox"?ke(""):(!tue||f)&&(te(""),ke(""))}),Qe=function(wt,vt){Ue(wt);var Rt=vt.type,Gt=vt.values;(Rt==="remove"||Rt==="clear")&&Gt.forEach(function(At){it(At.value,!1,Rt)})},lt=function(wt,vt){if(te(wt),ke(null),vt.source==="submit"){var Rt=(wt||"").trim();if(Rt){var Gt=Array.from(new Set([].concat(No(we),[Rt])));Ue(Gt),it(Rt,!0),te("")}return}vt.source!=="blur"&&(o==="combobox"&&Ue(wt),u==null||u(wt))},Ze=function(wt){var vt=wt;o!=="tags"&&(vt=wt.map(function(Gt){var At=fe.get(Gt);return At==null?void 0:At.value}).filter(function(Gt){return Gt!==void 0}));var Rt=Array.from(new Set([].concat(No(we),No(vt))));Ue(Rt),Rt.forEach(function(Gt){it(Gt,!0)})},Be=m.useMemo(function(){var $e=H!==!1&&y!==!1;return en(en({},ee),{},{flattenOptions:Je,onActiveValue:Ye,defaultActiveFirstOption:gt,onSelect:ut,menuItemSelectedIcon:R,rawValues:we,fieldNames:Q,virtual:$e,direction:F,listHeight:N,listItemHeight:W,childrenAsData:$,maxCount:O,optionRender:w})},[O,ee,Je,Ye,gt,ut,R,we,Q,H,y,F,N,W,$,w]);return m.createElement(Lme.Provider,{value:Be},m.createElement(iDt,go({},V,{id:G,prefixCls:i,ref:e,omitDomProps:WDt,mode:o,displayValues:ve,onDisplayValuesChange:Qe,direction:F,searchValue:Z,onSearch:lt,autoClearSearchValue:f,onSearchSplit:Ze,dropdownMatchSelectWidth:y,OptionList:CDt,emptyOptions:!Je.length,activeValue:Ee,activeDescendantId:"".concat(G,"_list_").concat(je)})))}),Ume=UDt;Ume.Option=Nme;Ume.OptGroup=Wme;function fw(t,e,n){return Un({[`${t}-status-success`]:e==="success",[`${t}-status-warning`]:e==="warning",[`${t}-status-error`]:e==="error",[`${t}-status-validating`]:e==="validating",[`${t}-has-feedback`]:n})}const Yb=(t,e)=>e||t,jDt=()=>{const[,t]=Vu(),n=new Wl(t.colorBgBase).toHsl().l<.5?{opacity:.65}:{};return m.createElement("svg",{style:n,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},m.createElement("g",{fill:"none",fillRule:"evenodd"},m.createElement("g",{transform:"translate(24 31.67)"},m.createElement("ellipse",{fillOpacity:".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),m.createElement("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"}),m.createElement("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"}),m.createElement("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"}),m.createElement("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"})),m.createElement("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"}),m.createElement("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},m.createElement("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),m.createElement("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"}))))},BDt=()=>{const[,t]=Vu(),{colorFill:e,colorFillTertiary:n,colorFillQuaternary:o,colorBgContainer:r}=t,{borderColor:i,shadowColor:a,contentColor:l}=m.useMemo(()=>({borderColor:new Wl(e).onBackground(r).toHexShortString(),shadowColor:new Wl(n).onBackground(r).toHexShortString(),contentColor:new Wl(o).onBackground(r).toHexShortString()}),[e,n,o,r]);return m.createElement("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},m.createElement("g",{transform:"translate(0 1)",fill:"none",fillRule:"evenodd"},m.createElement("ellipse",{fill:a,cx:"32",cy:"33",rx:"32",ry:"7"}),m.createElement("g",{fillRule:"nonzero",stroke:i},m.createElement("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"}),m.createElement("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:l}))))},YDt=t=>{const{componentCls:e,margin:n,marginXS:o,marginXL:r,fontSize:i,lineHeight:a}=t;return{[e]:{marginInline:o,fontSize:i,lineHeight:a,textAlign:"center",[`${e}-image`]:{height:t.emptyImgHeight,marginBottom:o,opacity:t.opacityImage,img:{height:"100%"},svg:{maxWidth:"100%",height:"100%",margin:"auto"}},[`${e}-description`]:{color:t.colorText},[`${e}-footer`]:{marginTop:n},"&-normal":{marginBlock:r,color:t.colorTextDescription,[`${e}-description`]:{color:t.colorTextDescription},[`${e}-image`]:{height:t.emptyImgHeightMD}},"&-small":{marginBlock:o,color:t.colorTextDescription,[`${e}-image`]:{height:t.emptyImgHeightSM}}}}},ODt=wl("Empty",t=>{const{componentCls:e,controlHeightLG:n,calc:o}=t,r=qi(t,{emptyImgCls:`${e}-img`,emptyImgHeight:o(n).mul(2.5).equal(),emptyImgHeightMD:n,emptyImgHeightSM:o(n).mul(.875).equal()});return[YDt(r)]});var VDt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{className:e,rootClassName:n,prefixCls:o,image:r=LGe,description:i,children:a,imageStyle:l,style:s}=t,c=VDt(t,["className","rootClassName","prefixCls","image","description","children","imageStyle","style"]);const{getPrefixCls:u,direction:d,empty:f}=m.useContext(Cr),p=u("empty",o),[g,A,y]=ODt(p),[S]=Uw("Empty"),C=typeof i<"u"?i:S==null?void 0:S.description,P=typeof C=="string"?C:"empty";let v=null;return typeof r=="string"?v=m.createElement("img",{alt:P,src:r}):v=r,g(m.createElement("div",Object.assign({className:Un(A,y,p,f==null?void 0:f.className,{[`${p}-normal`]:r===WGe,[`${p}-rtl`]:d==="rtl"},e,n),style:Object.assign(Object.assign({},f==null?void 0:f.style),s)},c),m.createElement("div",{className:`${p}-image`,style:l},v),C&&m.createElement("div",{className:`${p}-description`},C),a&&m.createElement("div",{className:`${p}-footer`},a)))};ug.PRESENTED_IMAGE_DEFAULT=LGe;ug.PRESENTED_IMAGE_SIMPLE=WGe;const jme=t=>{const{componentName:e}=t,{getPrefixCls:n}=m.useContext(Cr),o=n("empty");switch(e){case"Table":case"List":return be.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE});case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return be.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,className:`${o}-small`});default:return be.createElement(ug,null)}},_Dt=["outlined","borderless","filled"],VH=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;const n=m.useContext(iIt);let o;typeof t<"u"?o=t:e===!1?o="borderless":o=n??"outlined";const r=_Dt.includes(o);return[o,r]},GDt=t=>{const n={overflow:{adjustX:!0,adjustY:!0,shiftY:!0},htmlRegion:t==="scroll"?"scroll":"visible",dynamicInset:!0};return{bottomLeft:Object.assign(Object.assign({},n),{points:["tl","bl"],offset:[0,4]}),bottomRight:Object.assign(Object.assign({},n),{points:["tr","br"],offset:[0,4]}),topLeft:Object.assign(Object.assign({},n),{points:["bl","tl"],offset:[0,-4]}),topRight:Object.assign(Object.assign({},n),{points:["br","tr"],offset:[0,-4]})}};function XDt(t,e){return t||GDt(e)}const Bve=t=>{const{optionHeight:e,optionFontSize:n,optionLineHeight:o,optionPadding:r}=t;return{position:"relative",display:"block",minHeight:e,padding:r,color:t.colorText,fontWeight:"normal",fontSize:n,lineHeight:o,boxSizing:"border-box"}},JDt=t=>{const{antCls:e,componentCls:n}=t,o=`${n}-item`,r=`&${e}-slide-up-enter${e}-slide-up-enter-active`,i=`&${e}-slide-up-appear${e}-slide-up-appear-active`,a=`&${e}-slide-up-leave${e}-slide-up-leave-active`,l=`${n}-dropdown-placement-`;return[{[`${n}-dropdown`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:-9999,zIndex:t.zIndexPopup,boxSizing:"border-box",padding:t.paddingXXS,overflow:"hidden",fontSize:t.fontSize,fontVariant:"initial",backgroundColor:t.colorBgElevated,borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,[` ${r}${l}bottomLeft, ${i}${l}bottomLeft `]:{animationName:O$},[` @@ -4528,7 +4528,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{paddingInlineEnd:t.showArrowPaddingInlineEnd},[`&${n}-open ${n}-selection-item`]:{color:t.colorTextPlaceholder},[`&:not(${n}-customize-input)`]:{[`${n}-selector`]:{width:"100%",height:"100%",padding:`0 ${jt(o)}`,[`${n}-selection-search-input`]:{height:i},"&:after":{lineHeight:jt(i)}}},[`&${n}-customize-input`]:{[`${n}-selector`]:{"&:after":{display:"none"},[`${n}-selection-search`]:{position:"static",width:"100%"},[`${n}-selection-placeholder`]:{position:"absolute",insetInlineStart:0,insetInlineEnd:0,padding:`0 ${jt(o)}`,"&:after":{display:"none"}}}}}}}function QDt(t){const{componentCls:e}=t,n=t.calc(t.controlPaddingHorizontalSM).sub(t.lineWidth).equal();return[cie(t),cie(qi(t,{controlHeight:t.controlHeightSM,borderRadius:t.borderRadiusSM}),"sm"),{[`${e}-single${e}-sm`]:{[`&:not(${e}-customize-input)`]:{[`${e}-selection-search`]:{insetInlineStart:n,insetInlineEnd:n},[`${e}-selector`]:{padding:`0 ${jt(n)}`},[`&${e}-show-arrow ${e}-selection-search`]:{insetInlineEnd:t.calc(n).add(t.calc(t.fontSize).mul(1.5)).equal()},[` &${e}-show-arrow ${e}-selection-item, &${e}-show-arrow ${e}-selection-placeholder - `]:{paddingInlineEnd:t.calc(t.fontSize).mul(1.5).equal()}}}},cie(qi(t,{controlHeight:t.singleItemHeightLG,fontSize:t.fontSizeLG,borderRadius:t.borderRadiusLG}),"lg")]}const ZDt=t=>{const{fontSize:e,lineHeight:n,lineWidth:o,controlHeight:r,controlHeightSM:i,controlHeightLG:a,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:g,colorFillSecondary:A,colorBgContainerDisabled:y,colorTextDisabled:S}=t,C=l*2,P=o*2,v=Math.min(r-C,r-P),T=Math.min(i-C,i-P),w=Math.min(a-C,a-P);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(r-e*n)/2}px ${s}px`,optionFontSize:e,optionLineHeight:n,optionHeight:r,selectorBg:g,clearBg:g,singleItemHeightLG:a,multipleItemBg:A,multipleItemBorderColor:"transparent",multipleItemHeight:v,multipleItemHeightSM:T,multipleItemHeightLG:w,multipleSelectorBgDisabled:y,multipleItemColorDisabled:S,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(t.fontSize*1.25)}},jGe=(t,e)=>{const{componentCls:n,antCls:o,controlOutlineWidth:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${e.borderColor}`,background:t.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,boxShadow:`0 0 0 ${jt(r)} ${e.activeShadowColor}`,outline:0}}}},Yve=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},jGe(t,e))}),eEt=t=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},jGe(t,{borderColor:t.colorBorder,hoverBorderHover:t.colorPrimaryHover,activeBorderColor:t.colorPrimary,activeShadowColor:t.controlOutline})),Yve(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeShadowColor:t.colorErrorOutline})),Yve(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeShadowColor:t.colorWarningOutline})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),BGe=(t,e)=>{const{componentCls:n,antCls:o}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:e.bg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,color:e.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:e.hoverBg},[`${n}-focused& ${n}-selector`]:{background:t.selectorBg,borderColor:e.activeBorderColor,outline:0}}}},Ove=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},BGe(t,e))}),tEt=t=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},BGe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.colorPrimary,color:t.colorText})),Ove(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,color:t.colorError})),Ove(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{borderColor:t.colorBorder,background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}})}),nEt=t=>({"&-borderless":{[`${t.componentCls}-selector`]:{background:"transparent",borderColor:"transparent"},[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}}}),oEt=t=>({[t.componentCls]:Object.assign(Object.assign(Object.assign({},eEt(t)),tEt(t)),nEt(t))}),rEt=t=>{const{componentCls:e}=t;return{position:"relative",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,input:{cursor:"pointer"},[`${e}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${e}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},iEt=t=>{const{componentCls:e}=t;return{[`${e}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},aEt=t=>{const{antCls:e,componentCls:n,inputPaddingHorizontalBase:o,iconCls:r}=t;return{[n]:Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},rEt(t)),iEt(t)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},qx),{[`> ${e}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},qx),{flex:1,color:t.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},jH()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${t.motionDurationSlow} ease`,[r]:{verticalAlign:"top",transition:`transform ${t.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,zIndex:1,display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${t.motionDurationMid} ease, opacity ${t.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:t.colorTextTertiary}},"&:hover":{[`${n}-clear`]:{opacity:1},[`${n}-arrow:not(:last-child)`]:{opacity:0}}}),[`${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:t.calc(o).add(t.fontSize).add(t.paddingXS).equal()}}}},lEt=t=>{const{componentCls:e}=t;return[{[e]:{[`&${e}-in-form-item`]:{width:"100%"}}},aEt(t),QDt(t),$Dt(t),JDt(t),{[`${e}-rtl`]:{direction:"rtl"}},jW(t,{borderElCls:`${e}-selector`,focusElCls:`${e}-focused`})]},sEt=wl("Select",(t,e)=>{let{rootPrefixCls:n}=e;const o=qi(t,{rootPrefixCls:n,inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[lEt(o),oEt(o)]},ZDt,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var cEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},uEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:cEt}))},YGe=m.forwardRef(uEt),dEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},fEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:dEt}))},Bme=m.forwardRef(fEt),hEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},pEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hEt}))},$$=m.forwardRef(pEt);function OGe(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:o,removeIcon:r,loading:i,multiple:a,hasFeedback:l,prefixCls:s,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;const p=n??m.createElement(W$,null),g=C=>e===null&&!l&&!d?null:m.createElement(m.Fragment,null,c!==!1&&C,l&&u);let A=null;if(e!==void 0)A=g(e);else if(i)A=g(m.createElement(YH,{spin:!0}));else{const C=`${s}-suffix`;A=P=>{let{open:v,showSearch:T}=P;return g(v&&T?m.createElement($$,{className:C}):m.createElement(Bme,{className:C}))}}let y=null;o!==void 0?y=o:a?y=m.createElement(YGe,null):y=null;let S=null;return r!==void 0?S=r:S=m.createElement(jw,null),{clearIcon:p,suffixIcon:A,itemIcon:y,removeIcon:S}}function gEt(t,e){return e!==void 0?e:t!==null}var mEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r,className:i,rootClassName:a,getPopupContainer:l,popupClassName:s,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:g,notFoundContent:A,status:y,builtinPlacements:S,dropdownMatchSelectWidth:C,popupMatchSelectWidth:P,direction:v,style:T,allowClear:w,variant:x,dropdownStyle:b,transitionName:R,tagRender:H,maxCount:F}=t,E=mEt(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount"]),{getPopupContainer:N,getPrefixCls:U,renderEmpty:W,direction:k,virtual:D,popupMatchSelectWidth:L,popupOverflow:j,select:B}=m.useContext(Cr),[,O]=Vu(),V=f??(O==null?void 0:O.controlHeight),G=U("select",o),q=U(),$=v??k,{compactSize:ie,compactItemClassnames:Q}=Yw(G,$),[se,Z]=VH(x,r),ee=Y0(G),[te,oe,de]=sEt(G,ee),he=m.useMemo(()=>{const{mode:Ee}=t;if(Ee!=="combobox")return Ee===VGe?"combobox":Ee},[t.mode]),pe=he==="multiple"||he==="tags",me=gEt(t.suffixIcon,t.showArrow),le=(n=P??C)!==null&&n!==void 0?n:L,{status:Te,hasFeedback:ge,isFormItemInput:Se,feedbackIcon:Re}=m.useContext(r1),De=Yb(Te,y);let Ae;A!==void 0?Ae=A:he==="combobox"?Ae=null:Ae=(W==null?void 0:W("Select"))||m.createElement(jme,{componentName:"Select"});const{suffixIcon:ue,itemIcon:fe,removeIcon:ve,clearIcon:we}=OGe(Object.assign(Object.assign({},E),{multiple:pe,hasFeedback:ge,feedbackIcon:Re,showSuffixIcon:me,prefixCls:G,componentName:"Select"})),Pe=w===!0?{clearIcon:we}:w,Ie=dp(E,["suffixIcon","itemIcon"]),Me=Un(s||c,{[`${G}-dropdown-${$}`]:$==="rtl"},a,de,ee,oe),ze=zd(Ee=>{var ke;return(ke=p??ie)!==null&&ke!==void 0?ke:Ee}),Ne=m.useContext(n1),Je=g??Ne,Ue=Un({[`${G}-lg`]:ze==="large",[`${G}-sm`]:ze==="small",[`${G}-rtl`]:$==="rtl",[`${G}-${se}`]:Z,[`${G}-in-form-item`]:Se},fw(G,De,ge),Q,B==null?void 0:B.className,i,a,de,ee,oe),nt=m.useMemo(()=>d!==void 0?d:$==="rtl"?"bottomRight":"bottomLeft",[d,$]),[We]=Bw("SelectLike",b==null?void 0:b.zIndex);return te(m.createElement(Ume,Object.assign({ref:e,virtual:D,showSearch:B==null?void 0:B.showSearch},Ie,{style:Object.assign(Object.assign({},B==null?void 0:B.style),T),dropdownMatchSelectWidth:le,transitionName:B9(q,"slide-up",R),builtinPlacements:XDt(S,j),listHeight:u,listItemHeight:V,mode:he,prefixCls:G,placement:nt,direction:$,suffixIcon:ue,menuItemSelectedIcon:fe,removeIcon:ve,allowClear:Pe,notFoundContent:Ae,className:Ue,getPopupContainer:l||N,dropdownClassName:Me,disabled:Je,dropdownStyle:Object.assign(Object.assign({},b),{zIndex:We}),maxCount:pe?F:void 0,tagRender:pe?H:void 0})))},Uo=m.forwardRef(yEt),AEt=XW(Uo);Uo.SECRET_COMBOBOX_MODE_DO_NOT_USE=VGe;Uo.Option=Nme;Uo.OptGroup=Wme;Uo._InternalPanelDoNotUseOrYouWillBeFired=AEt;const hw=["xxl","xl","lg","md","sm","xs"],wEt=t=>({xs:`(max-width: ${t.screenXSMax}px)`,sm:`(min-width: ${t.screenSM}px)`,md:`(min-width: ${t.screenMD}px)`,lg:`(min-width: ${t.screenLG}px)`,xl:`(min-width: ${t.screenXL}px)`,xxl:`(min-width: ${t.screenXXL}px)`}),vEt=t=>{const e=t,n=[].concat(hw).reverse();return n.forEach((o,r)=>{const i=o.toUpperCase(),a=`screen${i}Min`,l=`screen${i}`;if(!(e[a]<=e[l]))throw new Error(`${a}<=${l} fails : !(${e[a]}<=${e[l]})`);if(r{const n=new Map;let o=-1,r={};return{matchHandlers:{},dispatch(i){return r=i,n.forEach(a=>a(r)),n.size>=1},subscribe(i){return n.size||this.register(),o+=1,n.set(o,i),i(r),o},unsubscribe(i){n.delete(i),n.size||this.unregister()},unregister(){Object.keys(e).forEach(i=>{const a=e[i],l=this.matchHandlers[a];l==null||l.mql.removeListener(l==null?void 0:l.listener)}),n.clear()},register(){Object.keys(e).forEach(i=>{const a=e[i],l=c=>{let{matches:u}=c;this.dispatch(Object.assign(Object.assign({},r),{[i]:u}))},s=window.matchMedia(a);s.addListener(l),this.matchHandlers[a]={mql:s,listener:l},l(s)})},responsiveMap:e}},[t])}function GGe(){const[,t]=m.useReducer(e=>e+1,0);return t}function Q$(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const e=m.useRef({}),n=GGe(),o=_Ge();return vx(()=>{const r=o.subscribe(i=>{e.current=i,t&&n()});return()=>o.unsubscribe(r)},[]),e.current}const nue=m.createContext({}),xEt=t=>{const{antCls:e,componentCls:n,iconCls:o,avatarBg:r,avatarColor:i,containerSize:a,containerSizeLG:l,containerSizeSM:s,textFontSize:c,textFontSizeLG:u,textFontSizeSM:d,borderRadius:f,borderRadiusLG:p,borderRadiusSM:g,lineWidth:A,lineType:y}=t,S=(C,P,v)=>({width:C,height:C,borderRadius:"50%",[`&${n}-square`]:{borderRadius:v},[`&${n}-icon`]:{fontSize:P,[`> ${o}`]:{margin:0}}});return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",overflow:"hidden",color:i,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:r,border:`${jt(A)} ${y} transparent`,"&-image":{background:"transparent"},[`${e}-image-img`]:{display:"block"}}),S(a,c,f)),{"&-lg":Object.assign({},S(l,u,p)),"&-sm":Object.assign({},S(s,d,g)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},bEt=t=>{const{componentCls:e,groupBorderColor:n,groupOverlapping:o,groupSpace:r}=t;return{[`${e}-group`]:{display:"inline-flex",[`${e}`]:{borderColor:n},"> *:not(:first-child)":{marginInlineStart:o}},[`${e}-group-popover`]:{[`${e} + ${e}`]:{marginInlineStart:r}}}},SEt=t=>{const{controlHeight:e,controlHeightLG:n,controlHeightSM:o,fontSize:r,fontSizeLG:i,fontSizeXL:a,fontSizeHeading3:l,marginXS:s,marginXXS:c,colorBorderBg:u}=t;return{containerSize:e,containerSizeLG:n,containerSizeSM:o,textFontSize:Math.round((i+a)/2),textFontSizeLG:l,textFontSizeSM:r,groupSpace:c,groupOverlapping:-s,groupBorderColor:u}},XGe=wl("Avatar",t=>{const{colorTextLightSolid:e,colorTextPlaceholder:n}=t,o=qi(t,{avatarBg:n,avatarColor:e});return[xEt(o),bEt(o)]},SEt);var TEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const[n,o]=m.useState(1),[r,i]=m.useState(!1),[a,l]=m.useState(!0),s=m.useRef(null),c=m.useRef(null),u=o5(e,s),{getPrefixCls:d,avatar:f}=m.useContext(Cr),p=m.useContext(nue),g=()=>{if(!c.current||!s.current)return;const se=c.current.offsetWidth,Z=s.current.offsetWidth;if(se!==0&&Z!==0){const{gap:ee=4}=t;ee*2{i(!0)},[]),m.useEffect(()=>{l(!0),o(1)},[t.src]),m.useEffect(g,[t.gap]);const A=()=>{const{onError:se}=t;(se==null?void 0:se())!==!1&&l(!1)},{prefixCls:y,shape:S,size:C,src:P,srcSet:v,icon:T,className:w,rootClassName:x,alt:b,draggable:R,children:H,crossOrigin:F}=t,E=TEt(t,["prefixCls","shape","size","src","srcSet","icon","className","rootClassName","alt","draggable","children","crossOrigin"]),N=zd(se=>{var Z,ee;return(ee=(Z=C??(p==null?void 0:p.size))!==null&&Z!==void 0?Z:se)!==null&&ee!==void 0?ee:"default"}),U=Object.keys(typeof N=="object"?N||{}:{}).some(se=>["xs","sm","md","lg","xl","xxl"].includes(se)),W=Q$(U),k=m.useMemo(()=>{if(typeof N!="object")return{};const se=hw.find(ee=>W[ee]),Z=N[se];return Z?{width:Z,height:Z,fontSize:Z&&(T||H)?Z/2:18}:{}},[W,N]),D=d("avatar",y),L=Y0(D),[j,B,O]=XGe(D,L),V=Un({[`${D}-lg`]:N==="large",[`${D}-sm`]:N==="small"}),G=m.isValidElement(P),q=S||(p==null?void 0:p.shape)||"circle",$=Un(D,V,f==null?void 0:f.className,`${D}-${q}`,{[`${D}-image`]:G||P&&a,[`${D}-icon`]:!!T},O,L,w,x,B),ie=typeof N=="number"?{width:N,height:N,fontSize:T?N/2:18}:{};let Q;if(typeof P=="string"&&a)Q=m.createElement("img",{src:P,draggable:R,srcSet:v,onError:A,alt:b,crossOrigin:F});else if(G)Q=P;else if(T)Q=T;else if(r||n!==1){const se=`scale(${n})`,Z={msTransform:se,WebkitTransform:se,transform:se};Q=m.createElement(Cd,{onResize:g},m.createElement("span",{className:`${D}-string`,ref:c,style:Object.assign({},Z)},H))}else Q=m.createElement("span",{className:`${D}-string`,style:{opacity:0},ref:c},H);return delete E.onError,delete E.gap,j(m.createElement("span",Object.assign({},E,{style:Object.assign(Object.assign(Object.assign(Object.assign({},ie),k),f==null?void 0:f.style),E.style),className:$,ref:u}),Q))},JGe=m.forwardRef(PEt);var fi={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var n=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=fi.F1&&n<=fi.F12)return!1;switch(n){case fi.ALT:case fi.CAPS_LOCK:case fi.CONTEXT_MENU:case fi.CTRL:case fi.DOWN:case fi.END:case fi.ESC:case fi.HOME:case fi.INSERT:case fi.LEFT:case fi.MAC_FF_META:case fi.META:case fi.NUMLOCK:case fi.NUM_CENTER:case fi.PAGE_DOWN:case fi.PAGE_UP:case fi.PAUSE:case fi.PRINT_SCREEN:case fi.RIGHT:case fi.SHIFT:case fi.UP:case fi.WIN_KEY:case fi.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=fi.ZERO&&e<=fi.NINE||e>=fi.NUM_ZERO&&e<=fi.NUM_MULTIPLY||e>=fi.A&&e<=fi.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&e===0)return!0;switch(e){case fi.SPACE:case fi.QUESTION_MARK:case fi.NUM_PLUS:case fi.NUM_MINUS:case fi.NUM_PERIOD:case fi.NUM_DIVISION:case fi.SEMICOLON:case fi.DASH:case fi.EQUALS:case fi.COMMA:case fi.PERIOD:case fi.SLASH:case fi.APOSTROPHE:case fi.SINGLE_QUOTE:case fi.OPEN_SQUARE_BRACKET:case fi.BACKSLASH:case fi.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};const BG=t=>t?typeof t=="function"?t():t:null;function Yme(t){var e=t.children,n=t.prefixCls,o=t.id,r=t.overlayInnerStyle,i=t.className,a=t.style;return m.createElement("div",{className:Xn("".concat(n,"-content"),i),style:a},m.createElement("div",{className:"".concat(n,"-inner"),id:o,role:"tooltip",style:r},typeof e=="function"?e():e))}function oue(){return oue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}function zEt(t,e){if(t==null)return{};var n=IEt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var LT={shiftX:64,adjustY:1},WT={adjustX:1,shiftY:!0},hm=[0,0],DEt={left:{points:["cr","cl"],overflow:WT,offset:[-4,0],targetOffset:hm},right:{points:["cl","cr"],overflow:WT,offset:[4,0],targetOffset:hm},top:{points:["bc","tc"],overflow:LT,offset:[0,-4],targetOffset:hm},bottom:{points:["tc","bc"],overflow:LT,offset:[0,4],targetOffset:hm},topLeft:{points:["bl","tl"],overflow:LT,offset:[0,-4],targetOffset:hm},leftTop:{points:["tr","tl"],overflow:WT,offset:[-4,0],targetOffset:hm},topRight:{points:["br","tr"],overflow:LT,offset:[0,-4],targetOffset:hm},rightTop:{points:["tl","tr"],overflow:WT,offset:[4,0],targetOffset:hm},bottomRight:{points:["tr","br"],overflow:LT,offset:[0,4],targetOffset:hm},rightBottom:{points:["bl","br"],overflow:WT,offset:[4,0],targetOffset:hm},bottomLeft:{points:["tl","bl"],overflow:LT,offset:[0,4],targetOffset:hm},leftBottom:{points:["br","bl"],overflow:WT,offset:[-4,0],targetOffset:hm}},EEt=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],FEt=function(e,n){var o=e.overlayClassName,r=e.trigger,i=r===void 0?["hover"]:r,a=e.mouseEnterDelay,l=a===void 0?0:a,s=e.mouseLeaveDelay,c=s===void 0?.1:s,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,g=e.onVisibleChange,A=e.afterVisibleChange,y=e.transitionName,S=e.animation,C=e.motion,P=e.placement,v=P===void 0?"right":P,T=e.align,w=T===void 0?{}:T,x=e.destroyTooltipOnHide,b=x===void 0?!1:x,R=e.defaultVisible,H=e.getTooltipContainer,F=e.overlayInnerStyle;e.arrowContent;var E=e.overlay,N=e.id,U=e.showArrow,W=U===void 0?!0:U,k=zEt(e,EEt),D=m.useRef(null);m.useImperativeHandle(n,function(){return D.current});var L=MEt({},k);"visible"in e&&(L.popupVisible=e.visible);var j=function(){return m.createElement(Yme,{key:"content",prefixCls:f,id:N,overlayInnerStyle:F},E)};return m.createElement(KW,oue({popupClassName:o,prefixCls:f,popup:j,action:i,builtinPlacements:DEt,popupPlacement:v,ref:D,popupAlign:w,getPopupContainer:H,onPopupVisibleChange:g,afterPopupVisibleChange:A,popupTransitionName:y,popupAnimation:S,popupMotion:C,defaultPopupVisible:R,autoDestroy:b,mouseLeaveDelay:c,popupStyle:u,mouseEnterDelay:l,arrow:W},L),p)};const kEt=m.forwardRef(FEt);function Z$(t){const{sizePopupArrow:e,borderRadiusXS:n,borderRadiusOuter:o}=t,r=e/2,i=0,a=r,l=o*1/Math.sqrt(2),s=r-o*(1-1/Math.sqrt(2)),c=r-n*(1/Math.sqrt(2)),u=o*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),d=2*r-c,f=u,p=2*r-l,g=s,A=2*r-i,y=a,S=r*Math.sqrt(2)+o*(Math.sqrt(2)-2),C=o*(Math.sqrt(2)-1),P=`polygon(${C}px 100%, 50% ${C}px, ${2*r-C}px 100%, ${C}px 100%)`,v=`path('M ${i} ${a} A ${o} ${o} 0 0 0 ${l} ${s} L ${c} ${u} A ${n} ${n} 0 0 1 ${d} ${f} L ${p} ${g} A ${o} ${o} 0 0 0 ${A} ${y} Z')`;return{arrowShadowWidth:S,arrowPath:v,arrowPolygon:P}}const KGe=(t,e,n)=>{const{sizePopupArrow:o,arrowPolygon:r,arrowPath:i,arrowShadowWidth:a,borderRadiusXS:l,calc:s}=t;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:e,clipPath:{_multi_value_:!0,value:[r,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:a,height:a,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${jt(l)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},qGe=8;function eQ(t){const{contentRadius:e,limitVerticalRadius:n}=t,o=e>12?e+2:12;return{arrowOffsetHorizontal:o,arrowOffsetVertical:n?qGe:o}}function DY(t,e){return t?e:{}}function Ome(t,e,n){const{componentCls:o,boxShadowPopoverArrow:r,arrowOffsetVertical:i,arrowOffsetHorizontal:a}=t,{arrowDistance:l=0,arrowPlacement:s={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({[`${o}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},KGe(t,e,r)),{"&:before":{background:e}})]},DY(!!s.top,{[[`&-placement-top > ${o}-arrow`,`&-placement-topLeft > ${o}-arrow`,`&-placement-topRight > ${o}-arrow`].join(",")]:{bottom:l,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft > ${o}-arrow`]:{left:{_skip_check_:!0,value:a}},[`&-placement-topRight > ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}})),DY(!!s.bottom,{[[`&-placement-bottom > ${o}-arrow`,`&-placement-bottomLeft > ${o}-arrow`,`&-placement-bottomRight > ${o}-arrow`].join(",")]:{top:l,transform:"translateY(-100%)"},[`&-placement-bottom > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},[`&-placement-bottomLeft > ${o}-arrow`]:{left:{_skip_check_:!0,value:a}},[`&-placement-bottomRight > ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}})),DY(!!s.left,{[[`&-placement-left > ${o}-arrow`,`&-placement-leftTop > ${o}-arrow`,`&-placement-leftBottom > ${o}-arrow`].join(",")]:{right:{_skip_check_:!0,value:l},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${o}-arrow`]:{top:i},[`&-placement-leftBottom > ${o}-arrow`]:{bottom:i}})),DY(!!s.right,{[[`&-placement-right > ${o}-arrow`,`&-placement-rightTop > ${o}-arrow`,`&-placement-rightBottom > ${o}-arrow`].join(",")]:{left:{_skip_check_:!0,value:l},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${o}-arrow`]:{top:i},[`&-placement-rightBottom > ${o}-arrow`]:{bottom:i}}))}}function LEt(t,e,n,o){if(o===!1)return{adjustX:!1,adjustY:!1};const r=o&&typeof o=="object"?o:{},i={};switch(t){case"top":case"bottom":i.shiftX=e.arrowOffsetHorizontal*2+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=e.arrowOffsetVertical*2+n,i.shiftX=!0,i.adjustX=!0;break}const a=Object.assign(Object.assign({},i),r);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const _ve={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},WEt={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},NEt=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function $Ge(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:o,offset:r,borderRadius:i,visibleFirst:a}=t,l=e/2,s={};return Object.keys(_ve).forEach(c=>{const u=o&&WEt[c]||_ve[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(s[c]=d,NEt.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-l-r;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=l+r;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-l-r;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=l+r;break}const f=eQ({contentRadius:i,limitVerticalRadius:!0});if(o)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal+l;break}d.overflow=LEt(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),s}const UEt=t=>{const{componentCls:e,tooltipMaxWidth:n,tooltipColor:o,tooltipBg:r,tooltipBorderRadius:i,zIndexPopup:a,controlHeight:l,boxShadowSecondary:s,paddingSM:c,paddingXS:u}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"absolute",zIndex:a,display:"block",width:"max-content",maxWidth:n,visibility:"visible",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":r,[`${e}-inner`]:{minWidth:l,minHeight:l,padding:`${jt(t.calc(c).div(2).equal())} ${jt(u)}`,color:o,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:r,borderRadius:i,boxShadow:s,boxSizing:"border-box"},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${e}-inner`]:{borderRadius:t.min(i,qGe)}},[`${e}-content`]:{position:"relative"}}),L$(t,(d,f)=>{let{darkColor:p}=f;return{[`&${e}-${d}`]:{[`${e}-inner`]:{backgroundColor:p},[`${e}-arrow`]:{"--antd-arrow-background-color":p}}}})),{"&-rtl":{direction:"rtl"}})},Ome(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow}}]},jEt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+70},eQ({contentRadius:t.borderRadius,limitVerticalRadius:!0})),Z$(qi(t,{borderRadiusOuter:Math.min(t.borderRadiusOuter,4)}))),QGe=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return wl("Tooltip",o=>{const{borderRadius:r,colorTextLightSolid:i,colorBgSpotlight:a}=o,l=qi(o,{tooltipMaxWidth:250,tooltipColor:i,tooltipBorderRadius:r,tooltipBg:a});return[UEt(l),_W(o,"zoom-big-fast")]},jEt,{resetStyle:!1,injectStyle:e})(t)},BEt=rk.map(t=>`${t}-inverse`),YEt=["success","processing","error","default","warning"];function tQ(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Qa(BEt),Qa(rk)).includes(t):rk.includes(t)}function OEt(t){return YEt.includes(t)}function ZGe(t,e){const n=tQ(e),o=Un({[`${t}-${e}`]:e&&n}),r={},i={};return e&&!n&&(r.background=e,i["--antd-arrow-background-color"]=e),{className:o,overlayStyle:r,arrowStyle:i}}const VEt=t=>{const{prefixCls:e,className:n,placement:o="top",title:r,color:i,overlayInnerStyle:a}=t,{getPrefixCls:l}=m.useContext(Cr),s=l("tooltip",e),[c,u,d]=QGe(s),f=ZGe(s,i),p=f.arrowStyle,g=Object.assign(Object.assign({},a),f.overlayStyle),A=Un(u,d,s,`${s}-pure`,`${s}-placement-${o}`,n,f.className);return c(m.createElement("div",{className:A,style:p},m.createElement("div",{className:`${s}-arrow`}),m.createElement(Yme,Object.assign({},t,{className:u,prefixCls:s,overlayInnerStyle:g}),r)))};var _Et=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,openClassName:i,getTooltipContainer:a,overlayClassName:l,color:s,overlayInnerStyle:c,children:u,afterOpenChange:d,afterVisibleChange:f,destroyTooltipOnHide:p,arrow:g=!0,title:A,overlay:y,builtinPlacements:S,arrowPointAtCenter:C=!1,autoAdjustOverflow:P=!0}=t,v=!!g,[,T]=Vu(),{getPopupContainer:w,getPrefixCls:x,direction:b}=m.useContext(Cr),R=Bb(),H=m.useRef(null),F=()=>{var Ae;(Ae=H.current)===null||Ae===void 0||Ae.forceAlign()};m.useImperativeHandle(e,()=>({forceAlign:F,forcePopupAlign:()=>{R.deprecated(!1,"forcePopupAlign","forceAlign"),F()}}));const[E,N]=Z6(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),U=!A&&!y&&A!==0,W=Ae=>{var ue,fe;N(U?!1:Ae),U||((ue=t.onOpenChange)===null||ue===void 0||ue.call(t,Ae),(fe=t.onVisibleChange)===null||fe===void 0||fe.call(t,Ae))},k=m.useMemo(()=>{var Ae,ue;let fe=C;return typeof g=="object"&&(fe=(ue=(Ae=g.pointAtCenter)!==null&&Ae!==void 0?Ae:g.arrowPointAtCenter)!==null&&ue!==void 0?ue:C),S||$Ge({arrowPointAtCenter:fe,autoAdjustOverflow:P,arrowWidth:v?T.sizePopupArrow:0,borderRadius:T.borderRadius,offset:T.marginXXS,visibleFirst:!0})},[C,g,S,T]),D=m.useMemo(()=>A===0?A:y||A||"",[y,A]),L=m.createElement(O9,null,typeof D=="function"?D():D),{getPopupContainer:j,placement:B="top",mouseEnterDelay:O=.1,mouseLeaveDelay:V=.1,overlayStyle:G,rootClassName:q}=t,$=_Et(t,["getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName"]),ie=x("tooltip",r),Q=x(),se=t["data-popover-inject"];let Z=E;!("open"in t)&&!("visible"in t)&&U&&(Z=!1);const ee=m.isValidElement(u)&&!x_e(u)?u:m.createElement("span",null,u),te=ee.props,oe=!te.className||typeof te.className=="string"?Un(te.className,i||`${ie}-open`):te.className,[de,he,pe]=QGe(ie,!se),me=ZGe(ie,s),le=me.arrowStyle,Te=Object.assign(Object.assign({},c),me.overlayStyle),ge=Un(l,{[`${ie}-rtl`]:b==="rtl"},me.className,q,he,pe),[Se,Re]=Bw("Tooltip",$.zIndex),De=m.createElement(kEt,Object.assign({},$,{zIndex:Se,showArrow:v,placement:B,mouseEnterDelay:O,mouseLeaveDelay:V,prefixCls:ie,overlayClassName:ge,overlayStyle:Object.assign(Object.assign({},le),G),getTooltipContainer:j||a||w,ref:H,builtinPlacements:k,overlay:L,visible:Z,onVisibleChange:W,afterVisibleChange:d??f,overlayInnerStyle:Te,arrowContent:m.createElement("span",{className:`${ie}-arrow-content`}),motion:{motionName:B9(Q,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!p}),Z?j0(ee,{className:oe}):ee);return de(m.createElement(WW.Provider,{value:Re},De))}),oA=GEt;oA._InternalPanelDoNotUseOrYouWillBeFired=VEt;const XEt=t=>{const{componentCls:e,popoverColor:n,titleMinWidth:o,fontWeightStrong:r,innerPadding:i,boxShadowSecondary:a,colorTextHeading:l,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:u,colorBgElevated:d,popoverBg:f,titleBorderBottom:p,innerContentPadding:g,titlePadding:A}=t;return[{[e]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":d,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${e}-content`]:{position:"relative"},[`${e}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:s,boxShadow:a,padding:i},[`${e}-title`]:{minWidth:o,marginBottom:u,color:l,fontWeight:r,borderBottom:p,padding:A},[`${e}-inner-content`]:{color:n,padding:g}})},Ome(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow,display:"inline-block",[`${e}-content`]:{display:"inline-block"}}}]},JEt=t=>{const{componentCls:e}=t;return{[e]:rk.map(n=>{const o=t[`${n}6`];return{[`&${e}-${n}`]:{"--antd-arrow-background-color":o,[`${e}-inner`]:{backgroundColor:o},[`${e}-arrow`]:{background:"transparent"}}}})}},KEt=t=>{const{lineWidth:e,controlHeight:n,fontHeight:o,padding:r,wireframe:i,zIndexPopupBase:a,borderRadiusLG:l,marginXS:s,lineType:c,colorSplit:u,paddingSM:d}=t,f=n-o,p=f/2,g=f/2-e,A=r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},Z$(t)),eQ({contentRadius:l,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:s,titlePadding:i?`${p}px ${A}px ${g}px`:0,titleBorderBottom:i?`${e}px ${c} ${u}`:"none",innerContentPadding:i?`${d}px ${A}px`:0})},eXe=wl("Popover",t=>{const{colorBgElevated:e,colorText:n}=t,o=qi(t,{popoverBg:e,popoverColor:n});return[XEt(o),JEt(o),_W(o,"zoom-big")]},KEt,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var qEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r!e&&!n?null:m.createElement(m.Fragment,null,e&&m.createElement("div",{className:`${t}-title`},BG(e)),m.createElement("div",{className:`${t}-inner-content`},BG(n))),QEt=t=>{const{hashId:e,prefixCls:n,className:o,style:r,placement:i="top",title:a,content:l,children:s}=t;return m.createElement("div",{className:Un(e,n,`${n}-pure`,`${n}-placement-${i}`,o),style:r},m.createElement("div",{className:`${n}-arrow`}),m.createElement(Yme,Object.assign({},t,{className:e,prefixCls:n}),s||$Et(n,a,l)))},ZEt=t=>{const{prefixCls:e,className:n}=t,o=qEt(t,["prefixCls","className"]),{getPrefixCls:r}=m.useContext(Cr),i=r("popover",e),[a,l,s]=eXe(i);return a(m.createElement(QEt,Object.assign({},o,{prefixCls:i,hashId:l,className:Un(n,s)})))};var eFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{title:e,content:n,prefixCls:o}=t;return m.createElement(m.Fragment,null,e&&m.createElement("div",{className:`${o}-title`},BG(e)),m.createElement("div",{className:`${o}-inner-content`},BG(n)))},nFt=m.forwardRef((t,e)=>{var n,o;const{prefixCls:r,title:i,content:a,overlayClassName:l,placement:s="top",trigger:c="hover",children:u,mouseEnterDelay:d=.1,mouseLeaveDelay:f=.1,onOpenChange:p,overlayStyle:g={}}=t,A=eFt(t,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle"]),{getPrefixCls:y}=m.useContext(Cr),S=y("popover",r),[C,P,v]=eXe(S),T=y(),w=Un(l,P,v),[x,b]=Z6(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),R=(E,N)=>{b(E,!0),p==null||p(E,N)},H=E=>{E.keyCode===fi.ESC&&R(!1,E)},F=E=>{R(E)};return C(m.createElement(oA,Object.assign({placement:s,trigger:c,mouseEnterDelay:d,mouseLeaveDelay:f,overlayStyle:g},A,{prefixCls:S,overlayClassName:w,ref:e,open:x,onOpenChange:F,overlay:i||a?m.createElement(tFt,{prefixCls:S,title:i,content:a}):null,transitionName:B9(T,"zoom-big",A.transitionName),"data-popover-inject":!0}),j0(u,{onKeyDown:E=>{var N,U;m.isValidElement(u)&&((U=u==null?void 0:(N=u.props).onKeyDown)===null||U===void 0||U.call(N,E)),H(E)}})))}),Ml=nFt;Ml._InternalPanelDoNotUseOrYouWillBeFired=ZEt;const Gve=t=>{const{size:e,shape:n}=m.useContext(nue),o=m.useMemo(()=>({size:t.size||e,shape:t.shape||n}),[t.size,t.shape,e,n]);return m.createElement(nue.Provider,{value:o},t.children)},oFt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,className:r,rootClassName:i,style:a,maxCount:l,maxStyle:s,size:c,shape:u,maxPopoverPlacement:d="top",maxPopoverTrigger:f="hover",children:p}=t,g=e("avatar",o),A=`${g}-group`,y=Y0(g),[S,C,P]=XGe(g,y),v=Un(A,{[`${A}-rtl`]:n==="rtl"},P,y,r,i,C),T=Y9(p).map((x,b)=>j0(x,{key:`avatar-key-${b}`})),w=T.length;if(l&&l{const{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:r,motionDurationSlow:i,textFontSize:a,textFontSizeSM:l,statusSize:s,dotSize:c,textFontWeight:u,indicatorHeight:d,indicatorHeightSM:f,marginXS:p,calc:g}=t,A=`${o}-scroll-number`,y=L$(t,(S,C)=>{let{darkColor:P}=C;return{[`&${e} ${e}-color-${S}`]:{background:P,[`&:not(${e}-count)`]:{color:P},"a:hover &":{background:P}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:d,height:d,color:t.badgeTextColor,fontWeight:u,fontSize:a,lineHeight:jt(d),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:g(d).div(2).equal(),boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:f,height:f,fontSize:l,lineHeight:jt(f),borderRadius:g(f).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${jt(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:c,minWidth:c,height:c,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`},[`${e}-dot${A}`]:{transition:`background ${i}`},[`${e}-count, ${e}-dot, ${A}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:fFt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:s,height:s,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,"&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:lFt,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:p,color:t.colorText,fontSize:t.fontSize}}}),y),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:sFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:cFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:uFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:dFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${A}-custom-component, ${e}-count`]:{transform:"none"},[`${A}-custom-component, ${A}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[`${A}`]:{overflow:"hidden",[`${A}-only`]:{position:"relative",display:"inline-block",height:d,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${A}-only-unit`]:{height:d,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${A}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${A}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},nXe=t=>{const{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:r}=t,i=e,a=n,l=t.colorBgContainer,s=t.colorError,c=t.colorErrorHover;return qi(t,{badgeFontHeight:i,badgeShadowSize:a,badgeTextColor:l,badgeColor:s,badgeColorHover:c,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},oXe=t=>{const{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*r,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}},pFt=wl("Badge",t=>{const e=nXe(t);return hFt(e)},oXe),gFt=t=>{const{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:r,calc:i}=t,a=`${e}-ribbon`,l=`${e}-ribbon-wrapper`,s=L$(t,(c,u)=>{let{darkColor:d}=u;return{[`&${a}-color-${c}`]:{background:d,color:d}}});return{[`${l}`]:{position:"relative"},[`${a}`]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"absolute",top:o,padding:`0 ${jt(t.paddingXS)}`,color:t.colorPrimary,lineHeight:jt(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.colorTextLightSolid},[`${a}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${jt(i(r).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),s),{[`&${a}-placement-end`]:{insetInlineEnd:i(r).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:i(r).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},mFt=wl(["Badge","Ribbon"],t=>{const e=nXe(t);return gFt(e)},oXe),yFt=t=>{const{className:e,prefixCls:n,style:o,color:r,children:i,text:a,placement:l="end",rootClassName:s}=t,{getPrefixCls:c,direction:u}=m.useContext(Cr),d=c("ribbon",n),f=`${d}-wrapper`,[p,g,A]=mFt(d,f),y=tQ(r,!1),S=Un(d,`${d}-placement-${l}`,{[`${d}-rtl`]:u==="rtl",[`${d}-color-${r}`]:y},e),C={},P={};return r&&!y&&(C.background=r,P.color=r),p(m.createElement("div",{className:Un(f,s,g,A)},i,m.createElement("div",{className:Un(S,g),style:Object.assign(Object.assign({},C),o)},m.createElement("span",{className:`${d}-text`},a),m.createElement("div",{className:`${d}-corner`,style:P}))))};function Xve(t){let{prefixCls:e,value:n,current:o,offset:r=0}=t,i;return r&&(i={position:"absolute",top:`${r}00%`,left:0}),m.createElement("span",{style:i,className:Un(`${e}-only-unit`,{current:o})},n)}function AFt(t,e,n){let o=t,r=0;for(;(o+10)%10!==e;)o+=n,r+=n;return r}function wFt(t){const{prefixCls:e,count:n,value:o}=t,r=Number(o),i=Math.abs(n),[a,l]=m.useState(r),[s,c]=m.useState(i),u=()=>{l(r),c(i)};m.useEffect(()=>{const p=setTimeout(()=>{u()},1e3);return()=>{clearTimeout(p)}},[r]);let d,f;if(a===r||Number.isNaN(r)||Number.isNaN(a))d=[m.createElement(Xve,Object.assign({},t,{key:r,current:!0}))],f={transition:"none"};else{d=[];const p=r+10,g=[];for(let S=r;S<=p;S+=1)g.push(S);const A=g.findIndex(S=>S%10===a);d=g.map((S,C)=>{const P=S%10;return m.createElement(Xve,Object.assign({},t,{key:S,value:P,offset:C-A,current:C===A}))});const y=s{const{prefixCls:n,count:o,className:r,motionClassName:i,style:a,title:l,show:s,component:c="sup",children:u}=t,d=vFt(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=m.useContext(Cr),p=f("scroll-number",n),g=Object.assign(Object.assign({},d),{"data-show":s,style:a,className:Un(p,r,i),title:l});let A=o;if(o&&Number(o)%1===0){const y=String(o).split("");A=m.createElement("bdi",null,y.map((S,C)=>m.createElement(wFt,{prefixCls:p,count:Number(o),value:S,key:y.length-C})))}return a&&a.borderColor&&(g.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),u?j0(u,y=>({className:Un(`${p}-custom-component`,y==null?void 0:y.className,i)})):m.createElement(c,Object.assign({},g,{ref:e}),A)});var bFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a;const{prefixCls:l,scrollNumberPrefixCls:s,children:c,status:u,text:d,color:f,count:p=null,overflowCount:g=99,dot:A=!1,size:y="default",title:S,offset:C,style:P,className:v,rootClassName:T,classNames:w,styles:x,showZero:b=!1}=t,R=bFt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:H,direction:F,badge:E}=m.useContext(Cr),N=H("badge",l),[U,W,k]=pFt(N),D=p>g?`${g}+`:p,L=D==="0"||D===0,j=p===null||L&&!b,B=(u!=null||f!=null)&&j,O=A&&!L,V=O?"":D,G=m.useMemo(()=>(V==null||V===""||L&&!b)&&!O,[V,L,b,O]),q=m.useRef(p);G||(q.current=p);const $=q.current,ie=m.useRef(V);G||(ie.current=V);const Q=ie.current,se=m.useRef(O);G||(se.current=O);const Z=m.useMemo(()=>{if(!C)return Object.assign(Object.assign({},E==null?void 0:E.style),P);const le={marginTop:C[1]};return F==="rtl"?le.left=parseInt(C[0],10):le.right=-parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},le),E==null?void 0:E.style),P)},[F,C,P,E==null?void 0:E.style]),ee=S??(typeof $=="string"||typeof $=="number"?$:void 0),te=G||!d?null:m.createElement("span",{className:`${N}-status-text`},d),oe=!$||typeof $!="object"?void 0:j0($,le=>({style:Object.assign(Object.assign({},Z),le.style)})),de=tQ(f,!1),he=Un(w==null?void 0:w.indicator,(n=E==null?void 0:E.classNames)===null||n===void 0?void 0:n.indicator,{[`${N}-status-dot`]:B,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:de}),pe={};f&&!de&&(pe.color=f,pe.background=f);const me=Un(N,{[`${N}-status`]:B,[`${N}-not-a-wrapper`]:!c,[`${N}-rtl`]:F==="rtl"},v,T,E==null?void 0:E.className,(o=E==null?void 0:E.classNames)===null||o===void 0?void 0:o.root,w==null?void 0:w.root,W,k);if(!c&&B){const le=Z.color;return U(m.createElement("span",Object.assign({},R,{className:me,style:Object.assign(Object.assign(Object.assign({},x==null?void 0:x.root),(r=E==null?void 0:E.styles)===null||r===void 0?void 0:r.root),Z)}),m.createElement("span",{className:he,style:Object.assign(Object.assign(Object.assign({},x==null?void 0:x.indicator),(i=E==null?void 0:E.styles)===null||i===void 0?void 0:i.indicator),pe)}),d&&m.createElement("span",{style:{color:le},className:`${N}-status-text`},d)))}return U(m.createElement("span",Object.assign({ref:e},R,{className:me,style:Object.assign(Object.assign({},(a=E==null?void 0:E.styles)===null||a===void 0?void 0:a.root),x==null?void 0:x.root)}),c,m.createElement(o1,{visible:!G,motionName:`${N}-zoom`,motionAppear:!1,motionDeadline:1e3},le=>{let{className:Te,ref:ge}=le;var Se,Re;const De=H("scroll-number",s),Ae=se.current,ue=Un(w==null?void 0:w.indicator,(Se=E==null?void 0:E.classNames)===null||Se===void 0?void 0:Se.indicator,{[`${N}-dot`]:Ae,[`${N}-count`]:!Ae,[`${N}-count-sm`]:y==="small",[`${N}-multiple-words`]:!Ae&&Q&&Q.toString().length>1,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:de});let fe=Object.assign(Object.assign(Object.assign({},x==null?void 0:x.indicator),(Re=E==null?void 0:E.styles)===null||Re===void 0?void 0:Re.indicator),Z);return f&&!de&&(fe=fe||{},fe.background=f),m.createElement(xFt,{prefixCls:De,show:!G,motionClassName:Te,className:ue,count:Q,title:ee,style:fe,key:"scrollNumber",ref:ge},oe)}),te))}),rXe=SFt;rXe.Ribbon=yFt;var TFt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},PFt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:TFt}))},YG=m.forwardRef(PFt),CFt=jn.ESC,RFt=jn.TAB;function HFt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=m.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case CFt:l();break;case RFt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};m.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&Ea(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var MFt=m.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=m.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=jb(e,i==null?void 0:i.ref);return be.createElement(be.Fragment,null,o&&be.createElement("div",{className:"".concat(r,"-arrow")}),be.cloneElement(i,{ref:sw(i)?a:void 0}))}),NT={adjustX:1,adjustY:1},UT=[0,0],IFt={topLeft:{points:["bl","tl"],overflow:NT,offset:[0,-4],targetOffset:UT},top:{points:["bc","tc"],overflow:NT,offset:[0,-4],targetOffset:UT},topRight:{points:["br","tr"],overflow:NT,offset:[0,-4],targetOffset:UT},bottomLeft:{points:["tl","bl"],overflow:NT,offset:[0,4],targetOffset:UT},bottom:{points:["tc","bc"],overflow:NT,offset:[0,4],targetOffset:UT},bottomRight:{points:["tr","br"],overflow:NT,offset:[0,4],targetOffset:UT}},zFt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function DFt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?IFt:f,g=t.getPopupContainer,A=t.showAction,y=t.hideAction,S=t.overlayClassName,C=t.overlayStyle,P=t.visible,v=t.trigger,T=v===void 0?["hover"]:v,w=t.autoFocus,x=t.overlay,b=t.children,R=t.onVisibleChange,H=oi(t,zFt),F=be.useState(),E=sn(F,2),N=E[0],U=E[1],W="visible"in t?P:N,k=be.useRef(null),D=be.useRef(null),L=be.useRef(null);be.useImperativeHandle(e,function(){return k.current});var j=function(se){U(se),R==null||R(se)};HFt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:w,overlayRef:D});var B=function(se){var Z=t.onOverlayClick;U(!1),Z&&Z(se)},O=function(){return be.createElement(MFt,{ref:D,overlay:x,prefixCls:a,arrow:r})},V=function(){return typeof x=="function"?O:O()},G=function(){var se=t.minOverlayWidthMatchTrigger,Z=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?se:!Z},q=function(){var se=t.openClassName;return se!==void 0?se:"".concat(a,"-open")},$=be.cloneElement(b,{className:Xn((n=b.props)===null||n===void 0?void 0:n.className,W&&q()),ref:sw(b)?jb(L,b.ref):void 0}),ie=y;return!ie&&T.indexOf("contextMenu")!==-1&&(ie=["click"]),be.createElement(KW,go({builtinPlacements:p},H,{prefixCls:a,ref:k,popupClassName:Xn(S,Jt({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:T,showAction:A,hideAction:ie,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:V(),onPopupVisibleChange:j,onPopupClick:B,getPopupContainer:g}),$)}const iXe=be.forwardRef(DFt);var aXe=m.createContext(null);function lXe(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function sXe(t){var e=m.useContext(aXe);return lXe(e,t)}var EFt=["children","locked"],_2=m.createContext(null);function FFt(t,e){var n=en({},t);return Object.keys(e).forEach(function(o){var r=e[o];r!==void 0&&(n[o]=r)}),n}function hk(t){var e=t.children,n=t.locked,o=oi(t,EFt),r=m.useContext(_2),i=DW(function(){return FFt(r,o)},[r,o],function(a,l){return!n&&(a[0]!==l[0]||!cw(a[1],l[1],!0))});return m.createElement(_2.Provider,{value:i},e)}var kFt=[],cXe=m.createContext(null);function nQ(){return m.useContext(cXe)}var uXe=m.createContext(kFt);function _H(t){var e=m.useContext(uXe);return m.useMemo(function(){return t!==void 0?[].concat(No(e),[t]):e},[e,t])}var dXe=m.createContext(null),Vme=m.createContext({});function Jve(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(K$(t)){var n=t.nodeName.toLowerCase(),o=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),r=t.getAttribute("tabindex"),i=Number(r),a=null;return r&&!Number.isNaN(i)?a=i:o&&a===null&&(a=0),o&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function LFt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=No(t.querySelectorAll("*")).filter(function(o){return Jve(o,e)});return Jve(t,e)&&n.unshift(t),n}var rue=jn.LEFT,iue=jn.RIGHT,aue=jn.UP,qV=jn.DOWN,$V=jn.ENTER,fXe=jn.ESC,Wz=jn.HOME,Nz=jn.END,Kve=[aue,qV,rue,iue];function WFt(t,e,n,o){var r,i="prev",a="next",l="children",s="parent";if(t==="inline"&&o===$V)return{inlineTrigger:!0};var c=Jt(Jt({},aue,i),qV,a),u=Jt(Jt(Jt(Jt({},rue,n?a:i),iue,n?i:a),qV,l),$V,l),d=Jt(Jt(Jt(Jt(Jt(Jt({},aue,i),qV,a),$V,l),fXe,s),rue,n?l:s),iue,n?s:l),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(r=f["".concat(t).concat(e?"":"Sub")])===null||r===void 0?void 0:r[o];switch(p){case i:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case s:return{offset:-1,sibling:!1};case l:return{offset:1,sibling:!1};default:return null}}function NFt(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function UFt(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function _me(t,e){var n=LFt(t,!0);return n.filter(function(o){return e.has(o)})}function qve(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var r=_me(t,e),i=r.length,a=r.findIndex(function(l){return n===l});return o<0?a===-1?a=i-1:a-=1:o>0&&(a+=1),a=(a+i)%i,r[a]}var lue=function(e,n){var o=new Set,r=new Map,i=new Map;return e.forEach(function(a){var l=document.querySelector("[data-menu-id='".concat(lXe(n,a),"']"));l&&(o.add(l),i.set(l,a),r.set(a,l))}),{elements:o,key2element:r,element2key:i}};function jFt(t,e,n,o,r,i,a,l,s,c){var u=m.useRef(),d=m.useRef();d.current=e;var f=function(){Ea.cancel(u.current)};return m.useEffect(function(){return function(){f()}},[]),function(p){var g=p.which;if([].concat(Kve,[$V,fXe,Wz,Nz]).includes(g)){var A=i(),y=lue(A,o),S=y,C=S.elements,P=S.key2element,v=S.element2key,T=P.get(e),w=UFt(T,C),x=v.get(w),b=WFt(t,a(x,!0).length===1,n,g);if(!b&&g!==Wz&&g!==Nz)return;(Kve.includes(g)||[Wz,Nz].includes(g))&&p.preventDefault();var R=function(D){if(D){var L=D,j=D.querySelector("a");j!=null&&j.getAttribute("href")&&(L=j);var B=v.get(D);l(B),f(),u.current=Ea(function(){d.current===B&&L.focus()})}};if([Wz,Nz].includes(g)||b.sibling||!w){var H;!w||t==="inline"?H=r.current:H=NFt(w);var F,E=_me(H,C);g===Wz?F=E[0]:g===Nz?F=E[E.length-1]:F=qve(H,C,w,b.offset),R(F)}else if(b.inlineTrigger)s(x);else if(b.offset>0)s(x,!0),f(),u.current=Ea(function(){y=lue(A,o);var k=w.getAttribute("aria-controls"),D=document.getElementById(k),L=qve(D,y.elements);R(L)},5);else if(b.offset<0){var N=a(x,!0),U=N[N.length-2],W=P.get(U);s(U,!1),R(W)}}c==null||c(p)}}function BFt(t){Promise.resolve().then(t)}var Gme="__RC_UTIL_PATH_SPLIT__",$ve=function(e){return e.join(Gme)},YFt=function(e){return e.split(Gme)},sue="rc-menu-more";function OFt(){var t=m.useState({}),e=sn(t,2),n=e[1],o=m.useRef(new Map),r=m.useRef(new Map),i=m.useState([]),a=sn(i,2),l=a[0],s=a[1],c=m.useRef(0),u=m.useRef(!1),d=function(){u.current||n({})},f=m.useCallback(function(P,v){var T=$ve(v);r.current.set(T,P),o.current.set(P,T),c.current+=1;var w=c.current;BFt(function(){w===c.current&&d()})},[]),p=m.useCallback(function(P,v){var T=$ve(v);r.current.delete(T),o.current.delete(P)},[]),g=m.useCallback(function(P){s(P)},[]),A=m.useCallback(function(P,v){var T=o.current.get(P)||"",w=YFt(T);return v&&l.includes(w[0])&&w.unshift(sue),w},[l]),y=m.useCallback(function(P,v){return P.some(function(T){var w=A(T,!0);return w.includes(v)})},[A]),S=function(){var v=No(o.current.keys());return l.length&&v.push(sue),v},C=m.useCallback(function(P){var v="".concat(o.current.get(P)).concat(Gme),T=new Set;return No(r.current.keys()).forEach(function(w){w.startsWith(v)&&T.add(r.current.get(w))}),T},[]);return m.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:g,isSubPathKey:y,getKeyPath:A,getKeys:S,getSubPathKeys:C}}function ED(t){var e=m.useRef(t);e.current=t;var n=m.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&(C.motionAppear=!1);var P=C.onVisibleChanged;return C.onVisibleChanged=function(v){return!f.current&&!v&&y(!0),P==null?void 0:P(v)},A?null:m.createElement(hk,{mode:i,locked:!f.current},m.createElement(o1,go({visible:S},C,{forceRender:s,removeOnLeave:!1,leavedClassName:"".concat(l,"-hidden")}),function(v){var T=v.className,w=v.style;return m.createElement(Xme,{id:e,className:T,style:w},r)}))}var akt=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],lkt=["active"],skt=function(e){var n=e.style,o=e.className,r=e.title,i=e.eventKey;e.warnKey;var a=e.disabled,l=e.internalPopupClose,s=e.children,c=e.itemIcon,u=e.expandIcon,d=e.popupClassName,f=e.popupOffset,p=e.popupStyle,g=e.onClick,A=e.onMouseEnter,y=e.onMouseLeave,S=e.onTitleClick,C=e.onTitleMouseEnter,P=e.onTitleMouseLeave,v=oi(e,akt),T=sXe(i),w=m.useContext(_2),x=w.prefixCls,b=w.mode,R=w.openKeys,H=w.disabled,F=w.overflowDisabled,E=w.activeKey,N=w.selectedKeys,U=w.itemIcon,W=w.expandIcon,k=w.onItemClick,D=w.onOpenChange,L=w.onActive,j=m.useContext(Vme),B=j._internalRenderSubMenuItem,O=m.useContext(dXe),V=O.isSubPathKey,G=_H(),q="".concat(x,"-submenu"),$=H||a,ie=m.useRef(),Q=m.useRef(),se=c??U,Z=u??W,ee=R.includes(i),te=!F&&ee,oe=V(N,i),de=hXe(i,$,C,P),he=de.active,pe=oi(de,lkt),me=m.useState(!1),le=sn(me,2),Te=le[0],ge=le[1],Se=function(nt){$||ge(nt)},Re=function(nt){Se(!0),A==null||A({key:i,domEvent:nt})},De=function(nt){Se(!1),y==null||y({key:i,domEvent:nt})},Ae=m.useMemo(function(){return he||(b!=="inline"?Te||V([E],i):!1)},[b,he,E,Te,i,V]),ue=pXe(G.length),fe=function(nt){$||(S==null||S({key:i,domEvent:nt}),b==="inline"&&D(i,!ee))},ve=ED(function(Ue){g==null||g(OG(Ue)),k(Ue)}),we=function(nt){b!=="inline"&&D(i,nt)},Pe=function(){L(i)},Ie=T&&"".concat(T,"-popup"),Me=m.createElement("div",go({role:"menuitem",style:ue,className:"".concat(q,"-title"),tabIndex:$?null:-1,ref:ie,title:typeof r=="string"?r:null,"data-menu-id":F&&T?null:T,"aria-expanded":te,"aria-haspopup":!0,"aria-controls":Ie,"aria-disabled":$,onClick:fe,onFocus:Pe},pe),r,m.createElement(gXe,{icon:b!=="horizontal"?Z:void 0,props:en(en({},e),{},{isOpen:te,isSubMenu:!0})},m.createElement("i",{className:"".concat(q,"-arrow")}))),ze=m.useRef(b);if(b!=="inline"&&G.length>1?ze.current="vertical":ze.current=b,!F){var Ne=ze.current;Me=m.createElement(rkt,{mode:Ne,prefixCls:q,visible:!l&&te&&b!=="inline",popupClassName:d,popupOffset:f,popupStyle:p,popup:m.createElement(hk,{mode:Ne==="horizontal"?"vertical":Ne},m.createElement(Xme,{id:Ie,ref:Q},s)),disabled:$,onVisibleChange:we},Me)}var Je=m.createElement(F2.Item,go({role:"none"},v,{component:"li",style:n,className:Xn(q,"".concat(q,"-").concat(b),o,Jt(Jt(Jt(Jt({},"".concat(q,"-open"),te),"".concat(q,"-active"),Ae),"".concat(q,"-selected"),oe),"".concat(q,"-disabled"),$)),onMouseEnter:Re,onMouseLeave:De}),Me,!F&&m.createElement(ikt,{id:Ie,open:te,keyPath:G},s));return B&&(Je=B(Je,e,{selected:oe,active:Ae,open:te,disabled:$})),m.createElement(hk,{onItemClick:ve,mode:b==="horizontal"?"vertical":b,itemIcon:se,expandIcon:Z},Je)};function oQ(t){var e=t.eventKey,n=t.children,o=_H(e),r=Jme(n,o),i=nQ();m.useEffect(function(){if(i)return i.registerPath(e,o),function(){i.unregisterPath(e,o)}},[o]);var a;return i?a=r:a=m.createElement(skt,t,r),m.createElement(uXe.Provider,{value:o},a)}var ckt=["className","title","eventKey","children"],ukt=["children"],dkt=function(e){var n=e.className,o=e.title;e.eventKey;var r=e.children,i=oi(e,ckt),a=m.useContext(_2),l=a.prefixCls,s="".concat(l,"-item-group");return m.createElement("li",go({role:"presentation"},i,{onClick:function(u){return u.stopPropagation()},className:Xn(s,n)}),m.createElement("div",{role:"presentation",className:"".concat(s,"-title"),title:typeof o=="string"?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(s,"-list")},r))};function rQ(t){var e=t.children,n=oi(t,ukt),o=_H(n.eventKey),r=Jme(e,o),i=nQ();return i?r:m.createElement(dkt,OH(n,["warnKey"]),r)}function Kme(t){var e=t.className,n=t.style,o=m.useContext(_2),r=o.prefixCls,i=nQ();return i?null:m.createElement("li",{role:"separator",className:Xn("".concat(r,"-item-divider"),e),style:n})}var fkt=["label","children","key","type"];function cue(t){return(t||[]).map(function(e,n){if(e&&hi(e)==="object"){var o=e,r=o.label,i=o.children,a=o.key,l=o.type,s=oi(o,fkt),c=a??"tmp-".concat(n);return i||l==="group"?l==="group"?m.createElement(rQ,go({key:c},s,{title:r}),cue(i)):m.createElement(oQ,go({key:c},s,{title:r}),cue(i)):l==="divider"?m.createElement(Kme,go({key:c},s)):m.createElement(qW,go({key:c},s),r)}return null}).filter(function(e){return e})}function hkt(t,e,n){var o=t;return e&&(o=cue(e)),Jme(o,n)}var pkt=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem"],jT=[],gkt=m.forwardRef(function(t,e){var n,o=t,r=o.prefixCls,i=r===void 0?"rc-menu":r,a=o.rootClassName,l=o.style,s=o.className,c=o.tabIndex,u=c===void 0?0:c,d=o.items,f=o.children,p=o.direction,g=o.id,A=o.mode,y=A===void 0?"vertical":A,S=o.inlineCollapsed,C=o.disabled,P=o.disabledOverflow,v=o.subMenuOpenDelay,T=v===void 0?.1:v,w=o.subMenuCloseDelay,x=w===void 0?.1:w,b=o.forceSubMenuRender,R=o.defaultOpenKeys,H=o.openKeys,F=o.activeKey,E=o.defaultActiveFirst,N=o.selectable,U=N===void 0?!0:N,W=o.multiple,k=W===void 0?!1:W,D=o.defaultSelectedKeys,L=o.selectedKeys,j=o.onSelect,B=o.onDeselect,O=o.inlineIndent,V=O===void 0?24:O,G=o.motion,q=o.defaultMotions,$=o.triggerSubMenuAction,ie=$===void 0?"hover":$,Q=o.builtinPlacements,se=o.itemIcon,Z=o.expandIcon,ee=o.overflowedIndicator,te=ee===void 0?"...":ee,oe=o.overflowedIndicatorPopupClassName,de=o.getPopupContainer,he=o.onClick,pe=o.onOpenChange,me=o.onKeyDown;o.openAnimation,o.openTransitionName;var le=o._internalRenderMenuItem,Te=o._internalRenderSubMenuItem,ge=oi(o,pkt),Se=m.useMemo(function(){return hkt(f,d,jT)},[f,d]),Re=m.useState(!1),De=sn(Re,2),Ae=De[0],ue=De[1],fe=m.useRef(),ve=_Ft(g),we=p==="rtl",Pe=Es(R,{value:H,postState:function(po){return po||jT}}),Ie=sn(Pe,2),Me=Ie[0],ze=Ie[1],Ne=function(po){var On=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function fo(){ze(po),pe==null||pe(po)}On?Hd.flushSync(fo):fo()},Je=m.useState(Me),Ue=sn(Je,2),nt=Ue[0],We=Ue[1],Ee=m.useRef(!1),ke=m.useMemo(function(){return(y==="inline"||y==="vertical")&&S?["vertical",S]:[y,!1]},[y,S]),Oe=sn(ke,2),st=Oe[0],je=Oe[1],xt=st==="inline",gt=m.useState(st),Ye=sn(gt,2),it=Ye[0],ut=Ye[1],Qe=m.useState(je),lt=sn(Qe,2),Ze=lt[0],Be=lt[1];m.useEffect(function(){ut(st),Be(je),Ee.current&&(xt?ze(nt):Ne(jT))},[st,je]);var $e=m.useState(0),wt=sn($e,2),vt=wt[0],Rt=wt[1],Gt=vt>=Se.length-1||it!=="horizontal"||P;m.useEffect(function(){xt&&We(Me)},[Me]),m.useEffect(function(){return Ee.current=!0,function(){Ee.current=!1}},[]);var At=OFt(),pt=At.registerPath,Wt=At.unregisterPath,ht=At.refreshOverflowKeys,ct=At.isSubPathKey,It=At.getKeyPath,Ft=At.getKeys,Ve=At.getSubPathKeys,ft=m.useMemo(function(){return{registerPath:pt,unregisterPath:Wt}},[pt,Wt]),kt=m.useMemo(function(){return{isSubPathKey:ct}},[ct]);m.useEffect(function(){ht(Gt?jT:Se.slice(vt+1).map(function(Io){return Io.key}))},[vt,Gt]);var rt=Es(F||E&&((n=Se[0])===null||n===void 0?void 0:n.key),{value:F}),at=sn(rt,2),Ge=at[0],yt=at[1],Pt=ED(function(Io){yt(Io)}),ot=ED(function(){yt(void 0)});m.useImperativeHandle(e,function(){return{list:fe.current,focus:function(po){var On,fo=Ft(),ir=lue(fo,ve),Rr=ir.elements,br=ir.key2element,_r=ir.element2key,jo=_me(fe.current,Rr),wn=Ge??(jo[0]?_r.get(jo[0]):(On=Se.find(function(Wo){return!Wo.props.disabled}))===null||On===void 0?void 0:On.key),In=br.get(wn);if(wn&&In){var ar;In==null||(ar=In.focus)===null||ar===void 0||ar.call(In,po)}}}});var bt=Es(D||[],{value:L,postState:function(po){return Array.isArray(po)?po:po==null?jT:[po]}}),zt=sn(bt,2),Bt=zt[0],tt=zt[1],Ht=function(po){if(U){var On=po.key,fo=Bt.includes(On),ir;k?fo?ir=Bt.filter(function(br){return br!==On}):ir=[].concat(No(Bt),[On]):ir=[On],tt(ir);var Rr=en(en({},po),{},{selectedKeys:ir});fo?B==null||B(Rr):j==null||j(Rr)}!k&&Me.length&&it!=="inline"&&Ne(jT)},_t=ED(function(Io){he==null||he(OG(Io)),Ht(Io)}),qt=ED(function(Io,po){var On=Me.filter(function(ir){return ir!==Io});if(po)On.push(Io);else if(it!=="inline"){var fo=Ve(Io);On=On.filter(function(ir){return!fo.has(ir)})}cw(Me,On,!0)||Ne(On,!0)}),un=function(po,On){var fo=On??!Me.includes(po);qt(po,fo)},Rn=jFt(it,Ge,we,ve,fe,Ft,It,yt,un,me);m.useEffect(function(){ue(!0)},[]);var yo=m.useMemo(function(){return{_internalRenderMenuItem:le,_internalRenderSubMenuItem:Te}},[le,Te]),Ao=it!=="horizontal"||P?Se:Se.map(function(Io,po){return m.createElement(hk,{key:Io.key,overflowDisabled:po>vt},Io)}),wo=m.createElement(F2,go({id:g,ref:fe,prefixCls:"".concat(i,"-overflow"),component:"ul",itemComponent:qW,className:Xn(i,"".concat(i,"-root"),"".concat(i,"-").concat(it),s,Jt(Jt({},"".concat(i,"-inline-collapsed"),Ze),"".concat(i,"-rtl"),we),a),dir:p,style:l,role:"menu",tabIndex:u,data:Ao,renderRawItem:function(po){return po},renderRawRest:function(po){var On=po.length,fo=On?Se.slice(-On):null;return m.createElement(oQ,{eventKey:sue,title:te,disabled:Gt,internalPopupClose:On===0,popupClassName:oe},fo)},maxCount:it!=="horizontal"||P?F2.INVALIDATE:F2.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(po){Rt(po)},onKeyDown:Rn},ge));return m.createElement(Vme.Provider,{value:yo},m.createElement(aXe.Provider,{value:ve},m.createElement(hk,{prefixCls:i,rootClassName:a,mode:it,openKeys:Me,rtl:we,disabled:C,motion:Ae?G:null,defaultMotions:Ae?q:null,activeKey:Ge,onActive:Pt,onInactive:ot,selectedKeys:Bt,inlineIndent:V,subMenuOpenDelay:T,subMenuCloseDelay:x,forceSubMenuRender:b,builtinPlacements:Q,triggerSubMenuAction:ie,getPopupContainer:de,itemIcon:se,expandIcon:Z,onItemClick:_t,onOpenChange:qt},m.createElement(dXe.Provider,{value:kt},wo),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(cXe.Provider,{value:ft},Se)))))}),GH=gkt;GH.Item=qW;GH.SubMenu=oQ;GH.ItemGroup=rQ;GH.Divider=Kme;var mkt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},ykt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:mkt}))},qme=m.forwardRef(ykt),Akt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},wkt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Akt}))},Zve=m.forwardRef(wkt);const yXe=m.createContext({});var vkt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},xkt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:vkt}))},$me=m.forwardRef(xkt),bkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,className:n,dashed:o}=t,r=bkt(t,["prefixCls","className","dashed"]),{getPrefixCls:i}=m.useContext(Cr),a=i("menu",e),l=Un({[`${a}-item-divider-dashed`]:!!o},n);return m.createElement(Kme,Object.assign({className:l},r))},VG=m.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1}),wXe=t=>{var e;const{className:n,children:o,icon:r,title:i,danger:a}=t,{prefixCls:l,firstLevel:s,direction:c,disableMenuItemTitleTooltip:u,inlineCollapsed:d}=m.useContext(VG),f=C=>{const P=m.createElement("span",{className:`${l}-title-content`},o);return(!r||m.isValidElement(o)&&o.type==="span")&&o&&C&&s&&typeof o=="string"?m.createElement("div",{className:`${l}-inline-collapsed-noicon`},o.charAt(0)):P},{siderCollapsed:p}=m.useContext(yXe);let g=i;typeof i>"u"?g=s?o:"":i===!1&&(g="");const A={title:g};!p&&!d&&(A.title=null,A.open=!1);const y=Y9(o).length;let S=m.createElement(qW,Object.assign({},dp(t,["title","icon","danger"]),{className:Un({[`${l}-item-danger`]:a,[`${l}-item-only-child`]:(r?y+1:y)===1},n),title:typeof i=="string"?i:void 0}),j0(r,{className:Un(m.isValidElement(r)?(e=r.props)===null||e===void 0?void 0:e.className:"",`${l}-item-icon`)}),f(d));return u||(S=m.createElement(oA,Object.assign({},A,{placement:c==="rtl"?"left":"right",overlayClassName:`${l}-inline-collapsed-tooltip`}),S)),S},vXe=t=>{var e;const{popupClassName:n,icon:o,title:r,theme:i}=t,a=m.useContext(VG),{prefixCls:l,inlineCollapsed:s,theme:c}=a,u=_H();let d;if(!o)d=s&&!u.length&&r&&typeof r=="string"?m.createElement("div",{className:`${l}-inline-collapsed-noicon`},r.charAt(0)):m.createElement("span",{className:`${l}-title-content`},r);else{const g=m.isValidElement(r)&&r.type==="span";d=m.createElement(m.Fragment,null,j0(o,{className:Un(m.isValidElement(o)?(e=o.props)===null||e===void 0?void 0:e.className:"",`${l}-item-icon`)}),g?r:m.createElement("span",{className:`${l}-title-content`},r))}const f=m.useMemo(()=>Object.assign(Object.assign({},a),{firstLevel:!1}),[a]),[p]=Bw("Menu");return m.createElement(VG.Provider,{value:f},m.createElement(oQ,Object.assign({},dp(t,["icon"]),{title:d,popupClassName:Un(l,n,`${l}-${i||c}`),popupStyle:{zIndex:p}})))};var Skt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{if(e&&typeof e=="object"){const o=e,{label:r,children:i,key:a,type:l}=o,s=Skt(o,["label","children","key","type"]),c=a??`tmp-${n}`;return i||l==="group"?l==="group"?m.createElement(rQ,Object.assign({key:c},s,{title:r}),uue(i)):m.createElement(vXe,Object.assign({key:c},s,{title:r}),uue(i)):l==="divider"?m.createElement(AXe,Object.assign({key:c},s)):m.createElement(wXe,Object.assign({key:c},s),r)}return null}).filter(e=>e)}function Tkt(t){return m.useMemo(()=>t&&uue(t),[t])}var Pkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{children:n}=t,o=Pkt(t,["children"]),r=m.useContext(_G),i=m.useMemo(()=>Object.assign(Object.assign({},r),o),[r,o.prefixCls,o.mode,o.selectable,o.rootClassName]),a=IPt(n),l=MPt(e,a?n.ref:null);return m.createElement(_G.Provider,{value:i},m.createElement(O9,null,a?m.cloneElement(n,{ref:l}):n))}),Ckt=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:r,lineWidth:i,lineType:a,itemPaddingInline:l}=t;return{[`${e}-horizontal`]:{lineHeight:o,border:0,borderBottom:`${jt(i)} ${a} ${r}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},[`> ${e}-item:hover, + `]:{paddingInlineEnd:t.calc(t.fontSize).mul(1.5).equal()}}}},cie(qi(t,{controlHeight:t.singleItemHeightLG,fontSize:t.fontSizeLG,borderRadius:t.borderRadiusLG}),"lg")]}const ZDt=t=>{const{fontSize:e,lineHeight:n,lineWidth:o,controlHeight:r,controlHeightSM:i,controlHeightLG:a,paddingXXS:l,controlPaddingHorizontal:s,zIndexPopupBase:c,colorText:u,fontWeightStrong:d,controlItemBgActive:f,controlItemBgHover:p,colorBgContainer:g,colorFillSecondary:A,colorBgContainerDisabled:y,colorTextDisabled:S}=t,C=l*2,P=o*2,v=Math.min(r-C,r-P),T=Math.min(i-C,i-P),w=Math.min(a-C,a-P);return{INTERNAL_FIXED_ITEM_MARGIN:Math.floor(l/2),zIndexPopup:c+50,optionSelectedColor:u,optionSelectedFontWeight:d,optionSelectedBg:f,optionActiveBg:p,optionPadding:`${(r-e*n)/2}px ${s}px`,optionFontSize:e,optionLineHeight:n,optionHeight:r,selectorBg:g,clearBg:g,singleItemHeightLG:a,multipleItemBg:A,multipleItemBorderColor:"transparent",multipleItemHeight:v,multipleItemHeightSM:T,multipleItemHeightLG:w,multipleSelectorBgDisabled:y,multipleItemColorDisabled:S,multipleItemBorderColorDisabled:"transparent",showArrowPaddingInlineEnd:Math.ceil(t.fontSize*1.25)}},jGe=(t,e)=>{const{componentCls:n,antCls:o,controlOutlineWidth:r}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${e.borderColor}`,background:t.selectorBg},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{borderColor:e.hoverBorderHover},[`${n}-focused& ${n}-selector`]:{borderColor:e.activeBorderColor,boxShadow:`0 0 0 ${jt(r)} ${e.activeShadowColor}`,outline:0}}}},Yve=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},jGe(t,e))}),eEt=t=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign({},jGe(t,{borderColor:t.colorBorder,hoverBorderHover:t.colorPrimaryHover,activeBorderColor:t.colorPrimary,activeShadowColor:t.controlOutline})),Yve(t,{status:"error",borderColor:t.colorError,hoverBorderHover:t.colorErrorHover,activeBorderColor:t.colorError,activeShadowColor:t.colorErrorOutline})),Yve(t,{status:"warning",borderColor:t.colorWarning,hoverBorderHover:t.colorWarningHover,activeBorderColor:t.colorWarning,activeShadowColor:t.colorWarningOutline})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}})}),BGe=(t,e)=>{const{componentCls:n,antCls:o}=t;return{[`&:not(${n}-customize-input) ${n}-selector`]:{background:e.bg,border:`${jt(t.lineWidth)} ${t.lineType} transparent`,color:e.color},[`&:not(${n}-disabled):not(${n}-customize-input):not(${o}-pagination-size-changer)`]:{[`&:hover ${n}-selector`]:{background:e.hoverBg},[`${n}-focused& ${n}-selector`]:{background:t.selectorBg,borderColor:e.activeBorderColor,outline:0}}}},Ove=(t,e)=>({[`&${t.componentCls}-status-${e.status}`]:Object.assign({},BGe(t,e))}),tEt=t=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign({},BGe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.colorPrimary,color:t.colorText})),Ove(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,color:t.colorError})),Ove(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,color:t.colorWarning})),{[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{borderColor:t.colorBorder,background:t.colorBgContainerDisabled,color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}})}),nEt=t=>({"&-borderless":{[`${t.componentCls}-selector`]:{background:"transparent",borderColor:"transparent"},[`&${t.componentCls}-disabled`]:{[`&:not(${t.componentCls}-customize-input) ${t.componentCls}-selector`]:{color:t.colorTextDisabled}},[`&${t.componentCls}-multiple ${t.componentCls}-selection-item`]:{background:t.multipleItemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.multipleItemBorderColor}`}}}),oEt=t=>({[t.componentCls]:Object.assign(Object.assign(Object.assign({},eEt(t)),tEt(t)),nEt(t))}),rEt=t=>{const{componentCls:e}=t;return{position:"relative",transition:`all ${t.motionDurationMid} ${t.motionEaseInOut}`,input:{cursor:"pointer"},[`${e}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit",height:"100%"}},[`${e}-disabled&`]:{cursor:"not-allowed",input:{cursor:"not-allowed"}}}},iEt=t=>{const{componentCls:e}=t;return{[`${e}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none",fontFamily:"inherit","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},aEt=t=>{const{antCls:e,componentCls:n,inputPaddingHorizontalBase:o,iconCls:r}=t;return{[n]:Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",cursor:"pointer",[`&:not(${n}-customize-input) ${n}-selector`]:Object.assign(Object.assign({},rEt(t)),iEt(t)),[`${n}-selection-item`]:Object.assign(Object.assign({flex:1,fontWeight:"normal",position:"relative",userSelect:"none"},qx),{[`> ${e}-typography`]:{display:"inline"}}),[`${n}-selection-placeholder`]:Object.assign(Object.assign({},qx),{flex:1,color:t.colorTextPlaceholder,pointerEvents:"none"}),[`${n}-arrow`]:Object.assign(Object.assign({},jH()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",transition:`opacity ${t.motionDurationSlow} ease`,[r]:{verticalAlign:"top",transition:`transform ${t.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${n}-suffix)`]:{pointerEvents:"auto"}},[`${n}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${n}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:o,zIndex:1,display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,marginTop:t.calc(t.fontSizeIcon).mul(-1).div(2).equal(),color:t.colorTextQuaternary,fontSize:t.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",cursor:"pointer",opacity:0,transition:`color ${t.motionDurationMid} ease, opacity ${t.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:t.colorTextTertiary}},"&:hover":{[`${n}-clear`]:{opacity:1},[`${n}-arrow:not(:last-child)`]:{opacity:0}}}),[`${n}-has-feedback`]:{[`${n}-clear`]:{insetInlineEnd:t.calc(o).add(t.fontSize).add(t.paddingXS).equal()}}}},lEt=t=>{const{componentCls:e}=t;return[{[e]:{[`&${e}-in-form-item`]:{width:"100%"}}},aEt(t),QDt(t),$Dt(t),JDt(t),{[`${e}-rtl`]:{direction:"rtl"}},jW(t,{borderElCls:`${e}-selector`,focusElCls:`${e}-focused`})]},sEt=wl("Select",(t,e)=>{let{rootPrefixCls:n}=e;const o=qi(t,{rootPrefixCls:n,inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[lEt(o),oEt(o)]},ZDt,{unitless:{optionLineHeight:!0,optionSelectedFontWeight:!0}});var cEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},uEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:cEt}))},YGe=m.forwardRef(uEt),dEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},fEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:dEt}))},Bme=m.forwardRef(fEt),hEt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},pEt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hEt}))},$$=m.forwardRef(pEt);function OGe(t){let{suffixIcon:e,clearIcon:n,menuItemSelectedIcon:o,removeIcon:r,loading:i,multiple:a,hasFeedback:l,prefixCls:s,showSuffixIcon:c,feedbackIcon:u,showArrow:d,componentName:f}=t;const p=n??m.createElement(W$,null),g=C=>e===null&&!l&&!d?null:m.createElement(m.Fragment,null,c!==!1&&C,l&&u);let A=null;if(e!==void 0)A=g(e);else if(i)A=g(m.createElement(YH,{spin:!0}));else{const C=`${s}-suffix`;A=P=>{let{open:v,showSearch:T}=P;return g(v&&T?m.createElement($$,{className:C}):m.createElement(Bme,{className:C}))}}let y=null;o!==void 0?y=o:a?y=m.createElement(YGe,null):y=null;let S=null;return r!==void 0?S=r:S=m.createElement(jw,null),{clearIcon:p,suffixIcon:A,itemIcon:y,removeIcon:S}}function gEt(t,e){return e!==void 0?e:t!==null}var mEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r,className:i,rootClassName:a,getPopupContainer:l,popupClassName:s,dropdownClassName:c,listHeight:u=256,placement:d,listItemHeight:f,size:p,disabled:g,notFoundContent:A,status:y,builtinPlacements:S,dropdownMatchSelectWidth:C,popupMatchSelectWidth:P,direction:v,style:T,allowClear:w,variant:x,dropdownStyle:b,transitionName:R,tagRender:H,maxCount:F}=t,E=mEt(t,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear","variant","dropdownStyle","transitionName","tagRender","maxCount"]),{getPopupContainer:N,getPrefixCls:U,renderEmpty:W,direction:k,virtual:D,popupMatchSelectWidth:L,popupOverflow:j,select:B}=m.useContext(Cr),[,O]=Vu(),V=f??(O==null?void 0:O.controlHeight),G=U("select",o),q=U(),$=v??k,{compactSize:ie,compactItemClassnames:Q}=Yw(G,$),[se,oe]=VH(x,r),Z=Y0(G),[te,ee,de]=sEt(G,Z),fe=m.useMemo(()=>{const{mode:Ee}=t;if(Ee!=="combobox")return Ee===VGe?"combobox":Ee},[t.mode]),pe=fe==="multiple"||fe==="tags",ye=gEt(t.suffixIcon,t.showArrow),ae=(n=P??C)!==null&&n!==void 0?n:L,{status:Te,hasFeedback:ge,isFormItemInput:Se,feedbackIcon:Re}=m.useContext(r1),De=Yb(Te,y);let Ae;A!==void 0?Ae=A:fe==="combobox"?Ae=null:Ae=(W==null?void 0:W("Select"))||m.createElement(jme,{componentName:"Select"});const{suffixIcon:ue,itemIcon:he,removeIcon:ve,clearIcon:we}=OGe(Object.assign(Object.assign({},E),{multiple:pe,hasFeedback:ge,feedbackIcon:Re,showSuffixIcon:ye,prefixCls:G,componentName:"Select"})),Pe=w===!0?{clearIcon:we}:w,Ie=dp(E,["suffixIcon","itemIcon"]),Me=Un(s||c,{[`${G}-dropdown-${$}`]:$==="rtl"},a,de,Z,ee),ze=zd(Ee=>{var ke;return(ke=p??ie)!==null&&ke!==void 0?ke:Ee}),Ne=m.useContext(n1),Je=g??Ne,Ue=Un({[`${G}-lg`]:ze==="large",[`${G}-sm`]:ze==="small",[`${G}-rtl`]:$==="rtl",[`${G}-${se}`]:oe,[`${G}-in-form-item`]:Se},fw(G,De,ge),Q,B==null?void 0:B.className,i,a,de,Z,ee),nt=m.useMemo(()=>d!==void 0?d:$==="rtl"?"bottomRight":"bottomLeft",[d,$]),[We]=Bw("SelectLike",b==null?void 0:b.zIndex);return te(m.createElement(Ume,Object.assign({ref:e,virtual:D,showSearch:B==null?void 0:B.showSearch},Ie,{style:Object.assign(Object.assign({},B==null?void 0:B.style),T),dropdownMatchSelectWidth:ae,transitionName:B9(q,"slide-up",R),builtinPlacements:XDt(S,j),listHeight:u,listItemHeight:V,mode:fe,prefixCls:G,placement:nt,direction:$,suffixIcon:ue,menuItemSelectedIcon:he,removeIcon:ve,allowClear:Pe,notFoundContent:Ae,className:Ue,getPopupContainer:l||N,dropdownClassName:Me,disabled:Je,dropdownStyle:Object.assign(Object.assign({},b),{zIndex:We}),maxCount:pe?F:void 0,tagRender:pe?H:void 0})))},Uo=m.forwardRef(yEt),AEt=XW(Uo);Uo.SECRET_COMBOBOX_MODE_DO_NOT_USE=VGe;Uo.Option=Nme;Uo.OptGroup=Wme;Uo._InternalPanelDoNotUseOrYouWillBeFired=AEt;const hw=["xxl","xl","lg","md","sm","xs"],wEt=t=>({xs:`(max-width: ${t.screenXSMax}px)`,sm:`(min-width: ${t.screenSM}px)`,md:`(min-width: ${t.screenMD}px)`,lg:`(min-width: ${t.screenLG}px)`,xl:`(min-width: ${t.screenXL}px)`,xxl:`(min-width: ${t.screenXXL}px)`}),vEt=t=>{const e=t,n=[].concat(hw).reverse();return n.forEach((o,r)=>{const i=o.toUpperCase(),a=`screen${i}Min`,l=`screen${i}`;if(!(e[a]<=e[l]))throw new Error(`${a}<=${l} fails : !(${e[a]}<=${e[l]})`);if(r{const n=new Map;let o=-1,r={};return{matchHandlers:{},dispatch(i){return r=i,n.forEach(a=>a(r)),n.size>=1},subscribe(i){return n.size||this.register(),o+=1,n.set(o,i),i(r),o},unsubscribe(i){n.delete(i),n.size||this.unregister()},unregister(){Object.keys(e).forEach(i=>{const a=e[i],l=this.matchHandlers[a];l==null||l.mql.removeListener(l==null?void 0:l.listener)}),n.clear()},register(){Object.keys(e).forEach(i=>{const a=e[i],l=c=>{let{matches:u}=c;this.dispatch(Object.assign(Object.assign({},r),{[i]:u}))},s=window.matchMedia(a);s.addListener(l),this.matchHandlers[a]={mql:s,listener:l},l(s)})},responsiveMap:e}},[t])}function GGe(){const[,t]=m.useReducer(e=>e+1,0);return t}function Q$(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const e=m.useRef({}),n=GGe(),o=_Ge();return vx(()=>{const r=o.subscribe(i=>{e.current=i,t&&n()});return()=>o.unsubscribe(r)},[]),e.current}const nue=m.createContext({}),xEt=t=>{const{antCls:e,componentCls:n,iconCls:o,avatarBg:r,avatarColor:i,containerSize:a,containerSizeLG:l,containerSizeSM:s,textFontSize:c,textFontSizeLG:u,textFontSizeSM:d,borderRadius:f,borderRadiusLG:p,borderRadiusSM:g,lineWidth:A,lineType:y}=t,S=(C,P,v)=>({width:C,height:C,borderRadius:"50%",[`&${n}-square`]:{borderRadius:v},[`&${n}-icon`]:{fontSize:P,[`> ${o}`]:{margin:0}}});return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",overflow:"hidden",color:i,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:r,border:`${jt(A)} ${y} transparent`,"&-image":{background:"transparent"},[`${e}-image-img`]:{display:"block"}}),S(a,c,f)),{"&-lg":Object.assign({},S(l,u,p)),"&-sm":Object.assign({},S(s,d,g)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},bEt=t=>{const{componentCls:e,groupBorderColor:n,groupOverlapping:o,groupSpace:r}=t;return{[`${e}-group`]:{display:"inline-flex",[`${e}`]:{borderColor:n},"> *:not(:first-child)":{marginInlineStart:o}},[`${e}-group-popover`]:{[`${e} + ${e}`]:{marginInlineStart:r}}}},SEt=t=>{const{controlHeight:e,controlHeightLG:n,controlHeightSM:o,fontSize:r,fontSizeLG:i,fontSizeXL:a,fontSizeHeading3:l,marginXS:s,marginXXS:c,colorBorderBg:u}=t;return{containerSize:e,containerSizeLG:n,containerSizeSM:o,textFontSize:Math.round((i+a)/2),textFontSizeLG:l,textFontSizeSM:r,groupSpace:c,groupOverlapping:-s,groupBorderColor:u}},XGe=wl("Avatar",t=>{const{colorTextLightSolid:e,colorTextPlaceholder:n}=t,o=qi(t,{avatarBg:n,avatarColor:e});return[xEt(o),bEt(o)]},SEt);var TEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const[n,o]=m.useState(1),[r,i]=m.useState(!1),[a,l]=m.useState(!0),s=m.useRef(null),c=m.useRef(null),u=o5(e,s),{getPrefixCls:d,avatar:f}=m.useContext(Cr),p=m.useContext(nue),g=()=>{if(!c.current||!s.current)return;const se=c.current.offsetWidth,oe=s.current.offsetWidth;if(se!==0&&oe!==0){const{gap:Z=4}=t;Z*2{i(!0)},[]),m.useEffect(()=>{l(!0),o(1)},[t.src]),m.useEffect(g,[t.gap]);const A=()=>{const{onError:se}=t;(se==null?void 0:se())!==!1&&l(!1)},{prefixCls:y,shape:S,size:C,src:P,srcSet:v,icon:T,className:w,rootClassName:x,alt:b,draggable:R,children:H,crossOrigin:F}=t,E=TEt(t,["prefixCls","shape","size","src","srcSet","icon","className","rootClassName","alt","draggable","children","crossOrigin"]),N=zd(se=>{var oe,Z;return(Z=(oe=C??(p==null?void 0:p.size))!==null&&oe!==void 0?oe:se)!==null&&Z!==void 0?Z:"default"}),U=Object.keys(typeof N=="object"?N||{}:{}).some(se=>["xs","sm","md","lg","xl","xxl"].includes(se)),W=Q$(U),k=m.useMemo(()=>{if(typeof N!="object")return{};const se=hw.find(Z=>W[Z]),oe=N[se];return oe?{width:oe,height:oe,fontSize:oe&&(T||H)?oe/2:18}:{}},[W,N]),D=d("avatar",y),L=Y0(D),[j,B,O]=XGe(D,L),V=Un({[`${D}-lg`]:N==="large",[`${D}-sm`]:N==="small"}),G=m.isValidElement(P),q=S||(p==null?void 0:p.shape)||"circle",$=Un(D,V,f==null?void 0:f.className,`${D}-${q}`,{[`${D}-image`]:G||P&&a,[`${D}-icon`]:!!T},O,L,w,x,B),ie=typeof N=="number"?{width:N,height:N,fontSize:T?N/2:18}:{};let Q;if(typeof P=="string"&&a)Q=m.createElement("img",{src:P,draggable:R,srcSet:v,onError:A,alt:b,crossOrigin:F});else if(G)Q=P;else if(T)Q=T;else if(r||n!==1){const se=`scale(${n})`,oe={msTransform:se,WebkitTransform:se,transform:se};Q=m.createElement(Cd,{onResize:g},m.createElement("span",{className:`${D}-string`,ref:c,style:Object.assign({},oe)},H))}else Q=m.createElement("span",{className:`${D}-string`,style:{opacity:0},ref:c},H);return delete E.onError,delete E.gap,j(m.createElement("span",Object.assign({},E,{style:Object.assign(Object.assign(Object.assign(Object.assign({},ie),k),f==null?void 0:f.style),E.style),className:$,ref:u}),Q))},JGe=m.forwardRef(PEt);var fi={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var n=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=fi.F1&&n<=fi.F12)return!1;switch(n){case fi.ALT:case fi.CAPS_LOCK:case fi.CONTEXT_MENU:case fi.CTRL:case fi.DOWN:case fi.END:case fi.ESC:case fi.HOME:case fi.INSERT:case fi.LEFT:case fi.MAC_FF_META:case fi.META:case fi.NUMLOCK:case fi.NUM_CENTER:case fi.PAGE_DOWN:case fi.PAGE_UP:case fi.PAUSE:case fi.PRINT_SCREEN:case fi.RIGHT:case fi.SHIFT:case fi.UP:case fi.WIN_KEY:case fi.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=fi.ZERO&&e<=fi.NINE||e>=fi.NUM_ZERO&&e<=fi.NUM_MULTIPLY||e>=fi.A&&e<=fi.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&e===0)return!0;switch(e){case fi.SPACE:case fi.QUESTION_MARK:case fi.NUM_PLUS:case fi.NUM_MINUS:case fi.NUM_PERIOD:case fi.NUM_DIVISION:case fi.SEMICOLON:case fi.DASH:case fi.EQUALS:case fi.COMMA:case fi.PERIOD:case fi.SLASH:case fi.APOSTROPHE:case fi.SINGLE_QUOTE:case fi.OPEN_SQUARE_BRACKET:case fi.BACKSLASH:case fi.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};const BG=t=>t?typeof t=="function"?t():t:null;function Yme(t){var e=t.children,n=t.prefixCls,o=t.id,r=t.overlayInnerStyle,i=t.className,a=t.style;return m.createElement("div",{className:Xn("".concat(n,"-content"),i),style:a},m.createElement("div",{className:"".concat(n,"-inner"),id:o,role:"tooltip",style:r},typeof e=="function"?e():e))}function oue(){return oue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}function zEt(t,e){if(t==null)return{};var n=IEt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var LT={shiftX:64,adjustY:1},WT={adjustX:1,shiftY:!0},hm=[0,0],DEt={left:{points:["cr","cl"],overflow:WT,offset:[-4,0],targetOffset:hm},right:{points:["cl","cr"],overflow:WT,offset:[4,0],targetOffset:hm},top:{points:["bc","tc"],overflow:LT,offset:[0,-4],targetOffset:hm},bottom:{points:["tc","bc"],overflow:LT,offset:[0,4],targetOffset:hm},topLeft:{points:["bl","tl"],overflow:LT,offset:[0,-4],targetOffset:hm},leftTop:{points:["tr","tl"],overflow:WT,offset:[-4,0],targetOffset:hm},topRight:{points:["br","tr"],overflow:LT,offset:[0,-4],targetOffset:hm},rightTop:{points:["tl","tr"],overflow:WT,offset:[4,0],targetOffset:hm},bottomRight:{points:["tr","br"],overflow:LT,offset:[0,4],targetOffset:hm},rightBottom:{points:["bl","br"],overflow:WT,offset:[4,0],targetOffset:hm},bottomLeft:{points:["tl","bl"],overflow:LT,offset:[0,4],targetOffset:hm},leftBottom:{points:["br","bl"],overflow:WT,offset:[-4,0],targetOffset:hm}},EEt=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],FEt=function(e,n){var o=e.overlayClassName,r=e.trigger,i=r===void 0?["hover"]:r,a=e.mouseEnterDelay,l=a===void 0?0:a,s=e.mouseLeaveDelay,c=s===void 0?.1:s,u=e.overlayStyle,d=e.prefixCls,f=d===void 0?"rc-tooltip":d,p=e.children,g=e.onVisibleChange,A=e.afterVisibleChange,y=e.transitionName,S=e.animation,C=e.motion,P=e.placement,v=P===void 0?"right":P,T=e.align,w=T===void 0?{}:T,x=e.destroyTooltipOnHide,b=x===void 0?!1:x,R=e.defaultVisible,H=e.getTooltipContainer,F=e.overlayInnerStyle;e.arrowContent;var E=e.overlay,N=e.id,U=e.showArrow,W=U===void 0?!0:U,k=zEt(e,EEt),D=m.useRef(null);m.useImperativeHandle(n,function(){return D.current});var L=MEt({},k);"visible"in e&&(L.popupVisible=e.visible);var j=function(){return m.createElement(Yme,{key:"content",prefixCls:f,id:N,overlayInnerStyle:F},E)};return m.createElement(KW,oue({popupClassName:o,prefixCls:f,popup:j,action:i,builtinPlacements:DEt,popupPlacement:v,ref:D,popupAlign:w,getPopupContainer:H,onPopupVisibleChange:g,afterPopupVisibleChange:A,popupTransitionName:y,popupAnimation:S,popupMotion:C,defaultPopupVisible:R,autoDestroy:b,mouseLeaveDelay:c,popupStyle:u,mouseEnterDelay:l,arrow:W},L),p)};const kEt=m.forwardRef(FEt);function Z$(t){const{sizePopupArrow:e,borderRadiusXS:n,borderRadiusOuter:o}=t,r=e/2,i=0,a=r,l=o*1/Math.sqrt(2),s=r-o*(1-1/Math.sqrt(2)),c=r-n*(1/Math.sqrt(2)),u=o*(Math.sqrt(2)-1)+n*(1/Math.sqrt(2)),d=2*r-c,f=u,p=2*r-l,g=s,A=2*r-i,y=a,S=r*Math.sqrt(2)+o*(Math.sqrt(2)-2),C=o*(Math.sqrt(2)-1),P=`polygon(${C}px 100%, 50% ${C}px, ${2*r-C}px 100%, ${C}px 100%)`,v=`path('M ${i} ${a} A ${o} ${o} 0 0 0 ${l} ${s} L ${c} ${u} A ${n} ${n} 0 0 1 ${d} ${f} L ${p} ${g} A ${o} ${o} 0 0 0 ${A} ${y} Z')`;return{arrowShadowWidth:S,arrowPath:v,arrowPolygon:P}}const KGe=(t,e,n)=>{const{sizePopupArrow:o,arrowPolygon:r,arrowPath:i,arrowShadowWidth:a,borderRadiusXS:l,calc:s}=t;return{pointerEvents:"none",width:o,height:o,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:o,height:s(o).div(2).equal(),background:e,clipPath:{_multi_value_:!0,value:[r,i]},content:'""'},"&::after":{content:'""',position:"absolute",width:a,height:a,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${jt(l)} 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:n,zIndex:0,background:"transparent"}}},qGe=8;function eQ(t){const{contentRadius:e,limitVerticalRadius:n}=t,o=e>12?e+2:12;return{arrowOffsetHorizontal:o,arrowOffsetVertical:n?qGe:o}}function DY(t,e){return t?e:{}}function Ome(t,e,n){const{componentCls:o,boxShadowPopoverArrow:r,arrowOffsetVertical:i,arrowOffsetHorizontal:a}=t,{arrowDistance:l=0,arrowPlacement:s={left:!0,right:!0,top:!0,bottom:!0}}=n||{};return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({[`${o}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},KGe(t,e,r)),{"&:before":{background:e}})]},DY(!!s.top,{[[`&-placement-top > ${o}-arrow`,`&-placement-topLeft > ${o}-arrow`,`&-placement-topRight > ${o}-arrow`].join(",")]:{bottom:l,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft > ${o}-arrow`]:{left:{_skip_check_:!0,value:a}},[`&-placement-topRight > ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}})),DY(!!s.bottom,{[[`&-placement-bottom > ${o}-arrow`,`&-placement-bottomLeft > ${o}-arrow`,`&-placement-bottomRight > ${o}-arrow`].join(",")]:{top:l,transform:"translateY(-100%)"},[`&-placement-bottom > ${o}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},[`&-placement-bottomLeft > ${o}-arrow`]:{left:{_skip_check_:!0,value:a}},[`&-placement-bottomRight > ${o}-arrow`]:{right:{_skip_check_:!0,value:a}}})),DY(!!s.left,{[[`&-placement-left > ${o}-arrow`,`&-placement-leftTop > ${o}-arrow`,`&-placement-leftBottom > ${o}-arrow`].join(",")]:{right:{_skip_check_:!0,value:l},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop > ${o}-arrow`]:{top:i},[`&-placement-leftBottom > ${o}-arrow`]:{bottom:i}})),DY(!!s.right,{[[`&-placement-right > ${o}-arrow`,`&-placement-rightTop > ${o}-arrow`,`&-placement-rightBottom > ${o}-arrow`].join(",")]:{left:{_skip_check_:!0,value:l},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right > ${o}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop > ${o}-arrow`]:{top:i},[`&-placement-rightBottom > ${o}-arrow`]:{bottom:i}}))}}function LEt(t,e,n,o){if(o===!1)return{adjustX:!1,adjustY:!1};const r=o&&typeof o=="object"?o:{},i={};switch(t){case"top":case"bottom":i.shiftX=e.arrowOffsetHorizontal*2+n,i.shiftY=!0,i.adjustY=!0;break;case"left":case"right":i.shiftY=e.arrowOffsetVertical*2+n,i.shiftX=!0,i.adjustX=!0;break}const a=Object.assign(Object.assign({},i),r);return a.shiftX||(a.adjustX=!0),a.shiftY||(a.adjustY=!0),a}const _ve={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},WEt={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},NEt=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function $Ge(t){const{arrowWidth:e,autoAdjustOverflow:n,arrowPointAtCenter:o,offset:r,borderRadius:i,visibleFirst:a}=t,l=e/2,s={};return Object.keys(_ve).forEach(c=>{const u=o&&WEt[c]||_ve[c],d=Object.assign(Object.assign({},u),{offset:[0,0],dynamicInset:!0});switch(s[c]=d,NEt.has(c)&&(d.autoArrow=!1),c){case"top":case"topLeft":case"topRight":d.offset[1]=-l-r;break;case"bottom":case"bottomLeft":case"bottomRight":d.offset[1]=l+r;break;case"left":case"leftTop":case"leftBottom":d.offset[0]=-l-r;break;case"right":case"rightTop":case"rightBottom":d.offset[0]=l+r;break}const f=eQ({contentRadius:i,limitVerticalRadius:!0});if(o)switch(c){case"topLeft":case"bottomLeft":d.offset[0]=-f.arrowOffsetHorizontal-l;break;case"topRight":case"bottomRight":d.offset[0]=f.arrowOffsetHorizontal+l;break;case"leftTop":case"rightTop":d.offset[1]=-f.arrowOffsetHorizontal-l;break;case"leftBottom":case"rightBottom":d.offset[1]=f.arrowOffsetHorizontal+l;break}d.overflow=LEt(c,f,e,n),a&&(d.htmlRegion="visibleFirst")}),s}const UEt=t=>{const{componentCls:e,tooltipMaxWidth:n,tooltipColor:o,tooltipBg:r,tooltipBorderRadius:i,zIndexPopup:a,controlHeight:l,boxShadowSecondary:s,paddingSM:c,paddingXS:u}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"absolute",zIndex:a,display:"block",width:"max-content",maxWidth:n,visibility:"visible",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":r,[`${e}-inner`]:{minWidth:l,minHeight:l,padding:`${jt(t.calc(c).div(2).equal())} ${jt(u)}`,color:o,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:r,borderRadius:i,boxShadow:s,boxSizing:"border-box"},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${e}-inner`]:{borderRadius:t.min(i,qGe)}},[`${e}-content`]:{position:"relative"}}),L$(t,(d,f)=>{let{darkColor:p}=f;return{[`&${e}-${d}`]:{[`${e}-inner`]:{backgroundColor:p},[`${e}-arrow`]:{"--antd-arrow-background-color":p}}}})),{"&-rtl":{direction:"rtl"}})},Ome(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow}}]},jEt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+70},eQ({contentRadius:t.borderRadius,limitVerticalRadius:!0})),Z$(qi(t,{borderRadiusOuter:Math.min(t.borderRadiusOuter,4)}))),QGe=function(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return wl("Tooltip",o=>{const{borderRadius:r,colorTextLightSolid:i,colorBgSpotlight:a}=o,l=qi(o,{tooltipMaxWidth:250,tooltipColor:i,tooltipBorderRadius:r,tooltipBg:a});return[UEt(l),_W(o,"zoom-big-fast")]},jEt,{resetStyle:!1,injectStyle:e})(t)},BEt=rk.map(t=>`${t}-inverse`),YEt=["success","processing","error","default","warning"];function tQ(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat(Qa(BEt),Qa(rk)).includes(t):rk.includes(t)}function OEt(t){return YEt.includes(t)}function ZGe(t,e){const n=tQ(e),o=Un({[`${t}-${e}`]:e&&n}),r={},i={};return e&&!n&&(r.background=e,i["--antd-arrow-background-color"]=e),{className:o,overlayStyle:r,arrowStyle:i}}const VEt=t=>{const{prefixCls:e,className:n,placement:o="top",title:r,color:i,overlayInnerStyle:a}=t,{getPrefixCls:l}=m.useContext(Cr),s=l("tooltip",e),[c,u,d]=QGe(s),f=ZGe(s,i),p=f.arrowStyle,g=Object.assign(Object.assign({},a),f.overlayStyle),A=Un(u,d,s,`${s}-pure`,`${s}-placement-${o}`,n,f.className);return c(m.createElement("div",{className:A,style:p},m.createElement("div",{className:`${s}-arrow`}),m.createElement(Yme,Object.assign({},t,{className:u,prefixCls:s,overlayInnerStyle:g}),r)))};var _Et=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,openClassName:i,getTooltipContainer:a,overlayClassName:l,color:s,overlayInnerStyle:c,children:u,afterOpenChange:d,afterVisibleChange:f,destroyTooltipOnHide:p,arrow:g=!0,title:A,overlay:y,builtinPlacements:S,arrowPointAtCenter:C=!1,autoAdjustOverflow:P=!0}=t,v=!!g,[,T]=Vu(),{getPopupContainer:w,getPrefixCls:x,direction:b}=m.useContext(Cr),R=Bb(),H=m.useRef(null),F=()=>{var Ae;(Ae=H.current)===null||Ae===void 0||Ae.forceAlign()};m.useImperativeHandle(e,()=>({forceAlign:F,forcePopupAlign:()=>{R.deprecated(!1,"forcePopupAlign","forceAlign"),F()}}));const[E,N]=Z6(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),U=!A&&!y&&A!==0,W=Ae=>{var ue,he;N(U?!1:Ae),U||((ue=t.onOpenChange)===null||ue===void 0||ue.call(t,Ae),(he=t.onVisibleChange)===null||he===void 0||he.call(t,Ae))},k=m.useMemo(()=>{var Ae,ue;let he=C;return typeof g=="object"&&(he=(ue=(Ae=g.pointAtCenter)!==null&&Ae!==void 0?Ae:g.arrowPointAtCenter)!==null&&ue!==void 0?ue:C),S||$Ge({arrowPointAtCenter:he,autoAdjustOverflow:P,arrowWidth:v?T.sizePopupArrow:0,borderRadius:T.borderRadius,offset:T.marginXXS,visibleFirst:!0})},[C,g,S,T]),D=m.useMemo(()=>A===0?A:y||A||"",[y,A]),L=m.createElement(O9,null,typeof D=="function"?D():D),{getPopupContainer:j,placement:B="top",mouseEnterDelay:O=.1,mouseLeaveDelay:V=.1,overlayStyle:G,rootClassName:q}=t,$=_Et(t,["getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName"]),ie=x("tooltip",r),Q=x(),se=t["data-popover-inject"];let oe=E;!("open"in t)&&!("visible"in t)&&U&&(oe=!1);const Z=m.isValidElement(u)&&!x_e(u)?u:m.createElement("span",null,u),te=Z.props,ee=!te.className||typeof te.className=="string"?Un(te.className,i||`${ie}-open`):te.className,[de,fe,pe]=QGe(ie,!se),ye=ZGe(ie,s),ae=ye.arrowStyle,Te=Object.assign(Object.assign({},c),ye.overlayStyle),ge=Un(l,{[`${ie}-rtl`]:b==="rtl"},ye.className,q,fe,pe),[Se,Re]=Bw("Tooltip",$.zIndex),De=m.createElement(kEt,Object.assign({},$,{zIndex:Se,showArrow:v,placement:B,mouseEnterDelay:O,mouseLeaveDelay:V,prefixCls:ie,overlayClassName:ge,overlayStyle:Object.assign(Object.assign({},ae),G),getTooltipContainer:j||a||w,ref:H,builtinPlacements:k,overlay:L,visible:oe,onVisibleChange:W,afterVisibleChange:d??f,overlayInnerStyle:Te,arrowContent:m.createElement("span",{className:`${ie}-arrow-content`}),motion:{motionName:B9(Q,"zoom-big-fast",t.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!p}),oe?j0(Z,{className:ee}):Z);return de(m.createElement(WW.Provider,{value:Re},De))}),oA=GEt;oA._InternalPanelDoNotUseOrYouWillBeFired=VEt;const XEt=t=>{const{componentCls:e,popoverColor:n,titleMinWidth:o,fontWeightStrong:r,innerPadding:i,boxShadowSecondary:a,colorTextHeading:l,borderRadiusLG:s,zIndexPopup:c,titleMarginBottom:u,colorBgElevated:d,popoverBg:f,titleBorderBottom:p,innerContentPadding:g,titlePadding:A}=t;return[{[e]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:c,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":d,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${e}-content`]:{position:"relative"},[`${e}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:s,boxShadow:a,padding:i},[`${e}-title`]:{minWidth:o,marginBottom:u,color:l,fontWeight:r,borderBottom:p,padding:A},[`${e}-inner-content`]:{color:n,padding:g}})},Ome(t,"var(--antd-arrow-background-color)"),{[`${e}-pure`]:{position:"relative",maxWidth:"none",margin:t.sizePopupArrow,display:"inline-block",[`${e}-content`]:{display:"inline-block"}}}]},JEt=t=>{const{componentCls:e}=t;return{[e]:rk.map(n=>{const o=t[`${n}6`];return{[`&${e}-${n}`]:{"--antd-arrow-background-color":o,[`${e}-inner`]:{backgroundColor:o},[`${e}-arrow`]:{background:"transparent"}}}})}},KEt=t=>{const{lineWidth:e,controlHeight:n,fontHeight:o,padding:r,wireframe:i,zIndexPopupBase:a,borderRadiusLG:l,marginXS:s,lineType:c,colorSplit:u,paddingSM:d}=t,f=n-o,p=f/2,g=f/2-e,A=r;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:a+30},Z$(t)),eQ({contentRadius:l,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:s,titlePadding:i?`${p}px ${A}px ${g}px`:0,titleBorderBottom:i?`${e}px ${c} ${u}`:"none",innerContentPadding:i?`${d}px ${A}px`:0})},eXe=wl("Popover",t=>{const{colorBgElevated:e,colorText:n}=t,o=qi(t,{popoverBg:e,popoverColor:n});return[XEt(o),JEt(o),_W(o,"zoom-big")]},KEt,{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var qEt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r!e&&!n?null:m.createElement(m.Fragment,null,e&&m.createElement("div",{className:`${t}-title`},BG(e)),m.createElement("div",{className:`${t}-inner-content`},BG(n))),QEt=t=>{const{hashId:e,prefixCls:n,className:o,style:r,placement:i="top",title:a,content:l,children:s}=t;return m.createElement("div",{className:Un(e,n,`${n}-pure`,`${n}-placement-${i}`,o),style:r},m.createElement("div",{className:`${n}-arrow`}),m.createElement(Yme,Object.assign({},t,{className:e,prefixCls:n}),s||$Et(n,a,l)))},ZEt=t=>{const{prefixCls:e,className:n}=t,o=qEt(t,["prefixCls","className"]),{getPrefixCls:r}=m.useContext(Cr),i=r("popover",e),[a,l,s]=eXe(i);return a(m.createElement(QEt,Object.assign({},o,{prefixCls:i,hashId:l,className:Un(n,s)})))};var eFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{let{title:e,content:n,prefixCls:o}=t;return m.createElement(m.Fragment,null,e&&m.createElement("div",{className:`${o}-title`},BG(e)),m.createElement("div",{className:`${o}-inner-content`},BG(n)))},nFt=m.forwardRef((t,e)=>{var n,o;const{prefixCls:r,title:i,content:a,overlayClassName:l,placement:s="top",trigger:c="hover",children:u,mouseEnterDelay:d=.1,mouseLeaveDelay:f=.1,onOpenChange:p,overlayStyle:g={}}=t,A=eFt(t,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle"]),{getPrefixCls:y}=m.useContext(Cr),S=y("popover",r),[C,P,v]=eXe(S),T=y(),w=Un(l,P,v),[x,b]=Z6(!1,{value:(n=t.open)!==null&&n!==void 0?n:t.visible,defaultValue:(o=t.defaultOpen)!==null&&o!==void 0?o:t.defaultVisible}),R=(E,N)=>{b(E,!0),p==null||p(E,N)},H=E=>{E.keyCode===fi.ESC&&R(!1,E)},F=E=>{R(E)};return C(m.createElement(oA,Object.assign({placement:s,trigger:c,mouseEnterDelay:d,mouseLeaveDelay:f,overlayStyle:g},A,{prefixCls:S,overlayClassName:w,ref:e,open:x,onOpenChange:F,overlay:i||a?m.createElement(tFt,{prefixCls:S,title:i,content:a}):null,transitionName:B9(T,"zoom-big",A.transitionName),"data-popover-inject":!0}),j0(u,{onKeyDown:E=>{var N,U;m.isValidElement(u)&&((U=u==null?void 0:(N=u.props).onKeyDown)===null||U===void 0||U.call(N,E)),H(E)}})))}),Ml=nFt;Ml._InternalPanelDoNotUseOrYouWillBeFired=ZEt;const Gve=t=>{const{size:e,shape:n}=m.useContext(nue),o=m.useMemo(()=>({size:t.size||e,shape:t.shape||n}),[t.size,t.shape,e,n]);return m.createElement(nue.Provider,{value:o},t.children)},oFt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,className:r,rootClassName:i,style:a,maxCount:l,maxStyle:s,size:c,shape:u,maxPopoverPlacement:d="top",maxPopoverTrigger:f="hover",children:p}=t,g=e("avatar",o),A=`${g}-group`,y=Y0(g),[S,C,P]=XGe(g,y),v=Un(A,{[`${A}-rtl`]:n==="rtl"},P,y,r,i,C),T=Y9(p).map((x,b)=>j0(x,{key:`avatar-key-${b}`})),w=T.length;if(l&&l{const{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:r,motionDurationSlow:i,textFontSize:a,textFontSizeSM:l,statusSize:s,dotSize:c,textFontWeight:u,indicatorHeight:d,indicatorHeightSM:f,marginXS:p,calc:g}=t,A=`${o}-scroll-number`,y=L$(t,(S,C)=>{let{darkColor:P}=C;return{[`&${e} ${e}-color-${S}`]:{background:P,[`&:not(${e}-count)`]:{color:P},"a:hover &":{background:P}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${e}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:d,height:d,color:t.badgeTextColor,fontWeight:u,fontSize:a,lineHeight:jt(d),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:g(d).div(2).equal(),boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${e}-count-sm`]:{minWidth:f,height:f,fontSize:l,lineHeight:jt(f),borderRadius:g(f).div(2).equal()},[`${e}-multiple-words`]:{padding:`0 ${jt(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${e}-dot`]:{zIndex:t.indicatorZIndex,width:c,minWidth:c,height:c,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${jt(r)} ${t.badgeShadowColor}`},[`${e}-dot${A}`]:{transition:`background ${i}`},[`${e}-count, ${e}-dot, ${A}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:fFt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${e}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${e}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:s,height:s,verticalAlign:"middle",borderRadius:"50%"},[`${e}-status-success`]:{backgroundColor:t.colorSuccess},[`${e}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,"&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:lFt,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${e}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${e}-status-error`]:{backgroundColor:t.colorError},[`${e}-status-warning`]:{backgroundColor:t.colorWarning},[`${e}-status-text`]:{marginInlineStart:p,color:t.colorText,fontSize:t.fontSize}}}),y),{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:sFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${e}-zoom-leave`]:{animationName:cFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${e}-not-a-wrapper`]:{[`${e}-zoom-appear, ${e}-zoom-enter`]:{animationName:uFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${e}-zoom-leave`]:{animationName:dFt,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${e}-status)`]:{verticalAlign:"middle"},[`${A}-custom-component, ${e}-count`]:{transform:"none"},[`${A}-custom-component, ${A}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[`${A}`]:{overflow:"hidden",[`${A}-only`]:{position:"relative",display:"inline-block",height:d,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${A}-only-unit`]:{height:d,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${A}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${e}-count, ${e}-dot, ${A}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},nXe=t=>{const{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:r}=t,i=e,a=n,l=t.colorBgContainer,s=t.colorError,c=t.colorErrorHover;return qi(t,{badgeFontHeight:i,badgeShadowSize:a,badgeTextColor:l,badgeColor:s,badgeColorHover:c,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},oXe=t=>{const{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*r,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}},pFt=wl("Badge",t=>{const e=nXe(t);return hFt(e)},oXe),gFt=t=>{const{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:r,calc:i}=t,a=`${e}-ribbon`,l=`${e}-ribbon-wrapper`,s=L$(t,(c,u)=>{let{darkColor:d}=u;return{[`&${a}-color-${c}`]:{background:d,color:d}}});return{[`${l}`]:{position:"relative"},[`${a}`]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"absolute",top:o,padding:`0 ${jt(t.paddingXS)}`,color:t.colorPrimary,lineHeight:jt(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${a}-text`]:{color:t.colorTextLightSolid},[`${a}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${jt(i(r).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),s),{[`&${a}-placement-end`]:{insetInlineEnd:i(r).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:i(r).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},mFt=wl(["Badge","Ribbon"],t=>{const e=nXe(t);return gFt(e)},oXe),yFt=t=>{const{className:e,prefixCls:n,style:o,color:r,children:i,text:a,placement:l="end",rootClassName:s}=t,{getPrefixCls:c,direction:u}=m.useContext(Cr),d=c("ribbon",n),f=`${d}-wrapper`,[p,g,A]=mFt(d,f),y=tQ(r,!1),S=Un(d,`${d}-placement-${l}`,{[`${d}-rtl`]:u==="rtl",[`${d}-color-${r}`]:y},e),C={},P={};return r&&!y&&(C.background=r,P.color=r),p(m.createElement("div",{className:Un(f,s,g,A)},i,m.createElement("div",{className:Un(S,g),style:Object.assign(Object.assign({},C),o)},m.createElement("span",{className:`${d}-text`},a),m.createElement("div",{className:`${d}-corner`,style:P}))))};function Xve(t){let{prefixCls:e,value:n,current:o,offset:r=0}=t,i;return r&&(i={position:"absolute",top:`${r}00%`,left:0}),m.createElement("span",{style:i,className:Un(`${e}-only-unit`,{current:o})},n)}function AFt(t,e,n){let o=t,r=0;for(;(o+10)%10!==e;)o+=n,r+=n;return r}function wFt(t){const{prefixCls:e,count:n,value:o}=t,r=Number(o),i=Math.abs(n),[a,l]=m.useState(r),[s,c]=m.useState(i),u=()=>{l(r),c(i)};m.useEffect(()=>{const p=setTimeout(()=>{u()},1e3);return()=>{clearTimeout(p)}},[r]);let d,f;if(a===r||Number.isNaN(r)||Number.isNaN(a))d=[m.createElement(Xve,Object.assign({},t,{key:r,current:!0}))],f={transition:"none"};else{d=[];const p=r+10,g=[];for(let S=r;S<=p;S+=1)g.push(S);const A=g.findIndex(S=>S%10===a);d=g.map((S,C)=>{const P=S%10;return m.createElement(Xve,Object.assign({},t,{key:S,value:P,offset:C-A,current:C===A}))});const y=s{const{prefixCls:n,count:o,className:r,motionClassName:i,style:a,title:l,show:s,component:c="sup",children:u}=t,d=vFt(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=m.useContext(Cr),p=f("scroll-number",n),g=Object.assign(Object.assign({},d),{"data-show":s,style:a,className:Un(p,r,i),title:l});let A=o;if(o&&Number(o)%1===0){const y=String(o).split("");A=m.createElement("bdi",null,y.map((S,C)=>m.createElement(wFt,{prefixCls:p,count:Number(o),value:S,key:y.length-C})))}return a&&a.borderColor&&(g.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),u?j0(u,y=>({className:Un(`${p}-custom-component`,y==null?void 0:y.className,i)})):m.createElement(c,Object.assign({},g,{ref:e}),A)});var bFt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r,i,a;const{prefixCls:l,scrollNumberPrefixCls:s,children:c,status:u,text:d,color:f,count:p=null,overflowCount:g=99,dot:A=!1,size:y="default",title:S,offset:C,style:P,className:v,rootClassName:T,classNames:w,styles:x,showZero:b=!1}=t,R=bFt(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:H,direction:F,badge:E}=m.useContext(Cr),N=H("badge",l),[U,W,k]=pFt(N),D=p>g?`${g}+`:p,L=D==="0"||D===0,j=p===null||L&&!b,B=(u!=null||f!=null)&&j,O=A&&!L,V=O?"":D,G=m.useMemo(()=>(V==null||V===""||L&&!b)&&!O,[V,L,b,O]),q=m.useRef(p);G||(q.current=p);const $=q.current,ie=m.useRef(V);G||(ie.current=V);const Q=ie.current,se=m.useRef(O);G||(se.current=O);const oe=m.useMemo(()=>{if(!C)return Object.assign(Object.assign({},E==null?void 0:E.style),P);const ae={marginTop:C[1]};return F==="rtl"?ae.left=parseInt(C[0],10):ae.right=-parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},ae),E==null?void 0:E.style),P)},[F,C,P,E==null?void 0:E.style]),Z=S??(typeof $=="string"||typeof $=="number"?$:void 0),te=G||!d?null:m.createElement("span",{className:`${N}-status-text`},d),ee=!$||typeof $!="object"?void 0:j0($,ae=>({style:Object.assign(Object.assign({},oe),ae.style)})),de=tQ(f,!1),fe=Un(w==null?void 0:w.indicator,(n=E==null?void 0:E.classNames)===null||n===void 0?void 0:n.indicator,{[`${N}-status-dot`]:B,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:de}),pe={};f&&!de&&(pe.color=f,pe.background=f);const ye=Un(N,{[`${N}-status`]:B,[`${N}-not-a-wrapper`]:!c,[`${N}-rtl`]:F==="rtl"},v,T,E==null?void 0:E.className,(o=E==null?void 0:E.classNames)===null||o===void 0?void 0:o.root,w==null?void 0:w.root,W,k);if(!c&&B){const ae=oe.color;return U(m.createElement("span",Object.assign({},R,{className:ye,style:Object.assign(Object.assign(Object.assign({},x==null?void 0:x.root),(r=E==null?void 0:E.styles)===null||r===void 0?void 0:r.root),oe)}),m.createElement("span",{className:fe,style:Object.assign(Object.assign(Object.assign({},x==null?void 0:x.indicator),(i=E==null?void 0:E.styles)===null||i===void 0?void 0:i.indicator),pe)}),d&&m.createElement("span",{style:{color:ae},className:`${N}-status-text`},d)))}return U(m.createElement("span",Object.assign({ref:e},R,{className:ye,style:Object.assign(Object.assign({},(a=E==null?void 0:E.styles)===null||a===void 0?void 0:a.root),x==null?void 0:x.root)}),c,m.createElement(o1,{visible:!G,motionName:`${N}-zoom`,motionAppear:!1,motionDeadline:1e3},ae=>{let{className:Te,ref:ge}=ae;var Se,Re;const De=H("scroll-number",s),Ae=se.current,ue=Un(w==null?void 0:w.indicator,(Se=E==null?void 0:E.classNames)===null||Se===void 0?void 0:Se.indicator,{[`${N}-dot`]:Ae,[`${N}-count`]:!Ae,[`${N}-count-sm`]:y==="small",[`${N}-multiple-words`]:!Ae&&Q&&Q.toString().length>1,[`${N}-status-${u}`]:!!u,[`${N}-color-${f}`]:de});let he=Object.assign(Object.assign(Object.assign({},x==null?void 0:x.indicator),(Re=E==null?void 0:E.styles)===null||Re===void 0?void 0:Re.indicator),oe);return f&&!de&&(he=he||{},he.background=f),m.createElement(xFt,{prefixCls:De,show:!G,motionClassName:Te,className:ue,count:Q,title:Z,style:he,key:"scrollNumber",ref:ge},ee)}),te))}),rXe=SFt;rXe.Ribbon=yFt;var TFt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},PFt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:TFt}))},YG=m.forwardRef(PFt),CFt=jn.ESC,RFt=jn.TAB;function HFt(t){var e=t.visible,n=t.triggerRef,o=t.onVisibleChange,r=t.autoFocus,i=t.overlayRef,a=m.useRef(!1),l=function(){if(e){var d,f;(d=n.current)===null||d===void 0||(f=d.focus)===null||f===void 0||f.call(d),o==null||o(!1)}},s=function(){var d;return(d=i.current)!==null&&d!==void 0&&d.focus?(i.current.focus(),a.current=!0,!0):!1},c=function(d){switch(d.keyCode){case CFt:l();break;case RFt:{var f=!1;a.current||(f=s()),f?d.preventDefault():l();break}}};m.useEffect(function(){return e?(window.addEventListener("keydown",c),r&&Ea(s,3),function(){window.removeEventListener("keydown",c),a.current=!1}):function(){a.current=!1}},[e])}var MFt=m.forwardRef(function(t,e){var n=t.overlay,o=t.arrow,r=t.prefixCls,i=m.useMemo(function(){var l;return typeof n=="function"?l=n():l=n,l},[n]),a=jb(e,i==null?void 0:i.ref);return be.createElement(be.Fragment,null,o&&be.createElement("div",{className:"".concat(r,"-arrow")}),be.cloneElement(i,{ref:sw(i)?a:void 0}))}),NT={adjustX:1,adjustY:1},UT=[0,0],IFt={topLeft:{points:["bl","tl"],overflow:NT,offset:[0,-4],targetOffset:UT},top:{points:["bc","tc"],overflow:NT,offset:[0,-4],targetOffset:UT},topRight:{points:["br","tr"],overflow:NT,offset:[0,-4],targetOffset:UT},bottomLeft:{points:["tl","bl"],overflow:NT,offset:[0,4],targetOffset:UT},bottom:{points:["tc","bc"],overflow:NT,offset:[0,4],targetOffset:UT},bottomRight:{points:["tr","br"],overflow:NT,offset:[0,4],targetOffset:UT}},zFt=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function DFt(t,e){var n,o=t.arrow,r=o===void 0?!1:o,i=t.prefixCls,a=i===void 0?"rc-dropdown":i,l=t.transitionName,s=t.animation,c=t.align,u=t.placement,d=u===void 0?"bottomLeft":u,f=t.placements,p=f===void 0?IFt:f,g=t.getPopupContainer,A=t.showAction,y=t.hideAction,S=t.overlayClassName,C=t.overlayStyle,P=t.visible,v=t.trigger,T=v===void 0?["hover"]:v,w=t.autoFocus,x=t.overlay,b=t.children,R=t.onVisibleChange,H=oi(t,zFt),F=be.useState(),E=sn(F,2),N=E[0],U=E[1],W="visible"in t?P:N,k=be.useRef(null),D=be.useRef(null),L=be.useRef(null);be.useImperativeHandle(e,function(){return k.current});var j=function(se){U(se),R==null||R(se)};HFt({visible:W,triggerRef:L,onVisibleChange:j,autoFocus:w,overlayRef:D});var B=function(se){var oe=t.onOverlayClick;U(!1),oe&&oe(se)},O=function(){return be.createElement(MFt,{ref:D,overlay:x,prefixCls:a,arrow:r})},V=function(){return typeof x=="function"?O:O()},G=function(){var se=t.minOverlayWidthMatchTrigger,oe=t.alignPoint;return"minOverlayWidthMatchTrigger"in t?se:!oe},q=function(){var se=t.openClassName;return se!==void 0?se:"".concat(a,"-open")},$=be.cloneElement(b,{className:Xn((n=b.props)===null||n===void 0?void 0:n.className,W&&q()),ref:sw(b)?jb(L,b.ref):void 0}),ie=y;return!ie&&T.indexOf("contextMenu")!==-1&&(ie=["click"]),be.createElement(KW,go({builtinPlacements:p},H,{prefixCls:a,ref:k,popupClassName:Xn(S,Jt({},"".concat(a,"-show-arrow"),r)),popupStyle:C,action:T,showAction:A,hideAction:ie,popupPlacement:d,popupAlign:c,popupTransitionName:l,popupAnimation:s,popupVisible:W,stretch:G()?"minWidth":"",popup:V(),onPopupVisibleChange:j,onPopupClick:B,getPopupContainer:g}),$)}const iXe=be.forwardRef(DFt);var aXe=m.createContext(null);function lXe(t,e){return t===void 0?null:"".concat(t,"-").concat(e)}function sXe(t){var e=m.useContext(aXe);return lXe(e,t)}var EFt=["children","locked"],_2=m.createContext(null);function FFt(t,e){var n=en({},t);return Object.keys(e).forEach(function(o){var r=e[o];r!==void 0&&(n[o]=r)}),n}function hk(t){var e=t.children,n=t.locked,o=oi(t,EFt),r=m.useContext(_2),i=DW(function(){return FFt(r,o)},[r,o],function(a,l){return!n&&(a[0]!==l[0]||!cw(a[1],l[1],!0))});return m.createElement(_2.Provider,{value:i},e)}var kFt=[],cXe=m.createContext(null);function nQ(){return m.useContext(cXe)}var uXe=m.createContext(kFt);function _H(t){var e=m.useContext(uXe);return m.useMemo(function(){return t!==void 0?[].concat(No(e),[t]):e},[e,t])}var dXe=m.createContext(null),Vme=m.createContext({});function Jve(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(K$(t)){var n=t.nodeName.toLowerCase(),o=["input","select","textarea","button"].includes(n)||t.isContentEditable||n==="a"&&!!t.getAttribute("href"),r=t.getAttribute("tabindex"),i=Number(r),a=null;return r&&!Number.isNaN(i)?a=i:o&&a===null&&(a=0),o&&t.disabled&&(a=null),a!==null&&(a>=0||e&&a<0)}return!1}function LFt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=No(t.querySelectorAll("*")).filter(function(o){return Jve(o,e)});return Jve(t,e)&&n.unshift(t),n}var rue=jn.LEFT,iue=jn.RIGHT,aue=jn.UP,qV=jn.DOWN,$V=jn.ENTER,fXe=jn.ESC,Wz=jn.HOME,Nz=jn.END,Kve=[aue,qV,rue,iue];function WFt(t,e,n,o){var r,i="prev",a="next",l="children",s="parent";if(t==="inline"&&o===$V)return{inlineTrigger:!0};var c=Jt(Jt({},aue,i),qV,a),u=Jt(Jt(Jt(Jt({},rue,n?a:i),iue,n?i:a),qV,l),$V,l),d=Jt(Jt(Jt(Jt(Jt(Jt({},aue,i),qV,a),$V,l),fXe,s),rue,n?l:s),iue,n?s:l),f={inline:c,horizontal:u,vertical:d,inlineSub:c,horizontalSub:d,verticalSub:d},p=(r=f["".concat(t).concat(e?"":"Sub")])===null||r===void 0?void 0:r[o];switch(p){case i:return{offset:-1,sibling:!0};case a:return{offset:1,sibling:!0};case s:return{offset:-1,sibling:!1};case l:return{offset:1,sibling:!1};default:return null}}function NFt(t){for(var e=t;e;){if(e.getAttribute("data-menu-list"))return e;e=e.parentElement}return null}function UFt(t,e){for(var n=t||document.activeElement;n;){if(e.has(n))return n;n=n.parentElement}return null}function _me(t,e){var n=LFt(t,!0);return n.filter(function(o){return e.has(o)})}function qve(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!t)return null;var r=_me(t,e),i=r.length,a=r.findIndex(function(l){return n===l});return o<0?a===-1?a=i-1:a-=1:o>0&&(a+=1),a=(a+i)%i,r[a]}var lue=function(e,n){var o=new Set,r=new Map,i=new Map;return e.forEach(function(a){var l=document.querySelector("[data-menu-id='".concat(lXe(n,a),"']"));l&&(o.add(l),i.set(l,a),r.set(a,l))}),{elements:o,key2element:r,element2key:i}};function jFt(t,e,n,o,r,i,a,l,s,c){var u=m.useRef(),d=m.useRef();d.current=e;var f=function(){Ea.cancel(u.current)};return m.useEffect(function(){return function(){f()}},[]),function(p){var g=p.which;if([].concat(Kve,[$V,fXe,Wz,Nz]).includes(g)){var A=i(),y=lue(A,o),S=y,C=S.elements,P=S.key2element,v=S.element2key,T=P.get(e),w=UFt(T,C),x=v.get(w),b=WFt(t,a(x,!0).length===1,n,g);if(!b&&g!==Wz&&g!==Nz)return;(Kve.includes(g)||[Wz,Nz].includes(g))&&p.preventDefault();var R=function(D){if(D){var L=D,j=D.querySelector("a");j!=null&&j.getAttribute("href")&&(L=j);var B=v.get(D);l(B),f(),u.current=Ea(function(){d.current===B&&L.focus()})}};if([Wz,Nz].includes(g)||b.sibling||!w){var H;!w||t==="inline"?H=r.current:H=NFt(w);var F,E=_me(H,C);g===Wz?F=E[0]:g===Nz?F=E[E.length-1]:F=qve(H,C,w,b.offset),R(F)}else if(b.inlineTrigger)s(x);else if(b.offset>0)s(x,!0),f(),u.current=Ea(function(){y=lue(A,o);var k=w.getAttribute("aria-controls"),D=document.getElementById(k),L=qve(D,y.elements);R(L)},5);else if(b.offset<0){var N=a(x,!0),U=N[N.length-2],W=P.get(U);s(U,!1),R(W)}}c==null||c(p)}}function BFt(t){Promise.resolve().then(t)}var Gme="__RC_UTIL_PATH_SPLIT__",$ve=function(e){return e.join(Gme)},YFt=function(e){return e.split(Gme)},sue="rc-menu-more";function OFt(){var t=m.useState({}),e=sn(t,2),n=e[1],o=m.useRef(new Map),r=m.useRef(new Map),i=m.useState([]),a=sn(i,2),l=a[0],s=a[1],c=m.useRef(0),u=m.useRef(!1),d=function(){u.current||n({})},f=m.useCallback(function(P,v){var T=$ve(v);r.current.set(T,P),o.current.set(P,T),c.current+=1;var w=c.current;BFt(function(){w===c.current&&d()})},[]),p=m.useCallback(function(P,v){var T=$ve(v);r.current.delete(T),o.current.delete(P)},[]),g=m.useCallback(function(P){s(P)},[]),A=m.useCallback(function(P,v){var T=o.current.get(P)||"",w=YFt(T);return v&&l.includes(w[0])&&w.unshift(sue),w},[l]),y=m.useCallback(function(P,v){return P.some(function(T){var w=A(T,!0);return w.includes(v)})},[A]),S=function(){var v=No(o.current.keys());return l.length&&v.push(sue),v},C=m.useCallback(function(P){var v="".concat(o.current.get(P)).concat(Gme),T=new Set;return No(r.current.keys()).forEach(function(w){w.startsWith(v)&&T.add(r.current.get(w))}),T},[]);return m.useEffect(function(){return function(){u.current=!0}},[]),{registerPath:f,unregisterPath:p,refreshOverflowKeys:g,isSubPathKey:y,getKeyPath:A,getKeys:S,getSubPathKeys:C}}function ED(t){var e=m.useRef(t);e.current=t;var n=m.useCallback(function(){for(var o,r=arguments.length,i=new Array(r),a=0;a1&&(C.motionAppear=!1);var P=C.onVisibleChanged;return C.onVisibleChanged=function(v){return!f.current&&!v&&y(!0),P==null?void 0:P(v)},A?null:m.createElement(hk,{mode:i,locked:!f.current},m.createElement(o1,go({visible:S},C,{forceRender:s,removeOnLeave:!1,leavedClassName:"".concat(l,"-hidden")}),function(v){var T=v.className,w=v.style;return m.createElement(Xme,{id:e,className:T,style:w},r)}))}var akt=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],lkt=["active"],skt=function(e){var n=e.style,o=e.className,r=e.title,i=e.eventKey;e.warnKey;var a=e.disabled,l=e.internalPopupClose,s=e.children,c=e.itemIcon,u=e.expandIcon,d=e.popupClassName,f=e.popupOffset,p=e.popupStyle,g=e.onClick,A=e.onMouseEnter,y=e.onMouseLeave,S=e.onTitleClick,C=e.onTitleMouseEnter,P=e.onTitleMouseLeave,v=oi(e,akt),T=sXe(i),w=m.useContext(_2),x=w.prefixCls,b=w.mode,R=w.openKeys,H=w.disabled,F=w.overflowDisabled,E=w.activeKey,N=w.selectedKeys,U=w.itemIcon,W=w.expandIcon,k=w.onItemClick,D=w.onOpenChange,L=w.onActive,j=m.useContext(Vme),B=j._internalRenderSubMenuItem,O=m.useContext(dXe),V=O.isSubPathKey,G=_H(),q="".concat(x,"-submenu"),$=H||a,ie=m.useRef(),Q=m.useRef(),se=c??U,oe=u??W,Z=R.includes(i),te=!F&&Z,ee=V(N,i),de=hXe(i,$,C,P),fe=de.active,pe=oi(de,lkt),ye=m.useState(!1),ae=sn(ye,2),Te=ae[0],ge=ae[1],Se=function(nt){$||ge(nt)},Re=function(nt){Se(!0),A==null||A({key:i,domEvent:nt})},De=function(nt){Se(!1),y==null||y({key:i,domEvent:nt})},Ae=m.useMemo(function(){return fe||(b!=="inline"?Te||V([E],i):!1)},[b,fe,E,Te,i,V]),ue=pXe(G.length),he=function(nt){$||(S==null||S({key:i,domEvent:nt}),b==="inline"&&D(i,!Z))},ve=ED(function(Ue){g==null||g(OG(Ue)),k(Ue)}),we=function(nt){b!=="inline"&&D(i,nt)},Pe=function(){L(i)},Ie=T&&"".concat(T,"-popup"),Me=m.createElement("div",go({role:"menuitem",style:ue,className:"".concat(q,"-title"),tabIndex:$?null:-1,ref:ie,title:typeof r=="string"?r:null,"data-menu-id":F&&T?null:T,"aria-expanded":te,"aria-haspopup":!0,"aria-controls":Ie,"aria-disabled":$,onClick:he,onFocus:Pe},pe),r,m.createElement(gXe,{icon:b!=="horizontal"?oe:void 0,props:en(en({},e),{},{isOpen:te,isSubMenu:!0})},m.createElement("i",{className:"".concat(q,"-arrow")}))),ze=m.useRef(b);if(b!=="inline"&&G.length>1?ze.current="vertical":ze.current=b,!F){var Ne=ze.current;Me=m.createElement(rkt,{mode:Ne,prefixCls:q,visible:!l&&te&&b!=="inline",popupClassName:d,popupOffset:f,popupStyle:p,popup:m.createElement(hk,{mode:Ne==="horizontal"?"vertical":Ne},m.createElement(Xme,{id:Ie,ref:Q},s)),disabled:$,onVisibleChange:we},Me)}var Je=m.createElement(F2.Item,go({role:"none"},v,{component:"li",style:n,className:Xn(q,"".concat(q,"-").concat(b),o,Jt(Jt(Jt(Jt({},"".concat(q,"-open"),te),"".concat(q,"-active"),Ae),"".concat(q,"-selected"),ee),"".concat(q,"-disabled"),$)),onMouseEnter:Re,onMouseLeave:De}),Me,!F&&m.createElement(ikt,{id:Ie,open:te,keyPath:G},s));return B&&(Je=B(Je,e,{selected:ee,active:Ae,open:te,disabled:$})),m.createElement(hk,{onItemClick:ve,mode:b==="horizontal"?"vertical":b,itemIcon:se,expandIcon:oe},Je)};function oQ(t){var e=t.eventKey,n=t.children,o=_H(e),r=Jme(n,o),i=nQ();m.useEffect(function(){if(i)return i.registerPath(e,o),function(){i.unregisterPath(e,o)}},[o]);var a;return i?a=r:a=m.createElement(skt,t,r),m.createElement(uXe.Provider,{value:o},a)}var ckt=["className","title","eventKey","children"],ukt=["children"],dkt=function(e){var n=e.className,o=e.title;e.eventKey;var r=e.children,i=oi(e,ckt),a=m.useContext(_2),l=a.prefixCls,s="".concat(l,"-item-group");return m.createElement("li",go({role:"presentation"},i,{onClick:function(u){return u.stopPropagation()},className:Xn(s,n)}),m.createElement("div",{role:"presentation",className:"".concat(s,"-title"),title:typeof o=="string"?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(s,"-list")},r))};function rQ(t){var e=t.children,n=oi(t,ukt),o=_H(n.eventKey),r=Jme(e,o),i=nQ();return i?r:m.createElement(dkt,OH(n,["warnKey"]),r)}function Kme(t){var e=t.className,n=t.style,o=m.useContext(_2),r=o.prefixCls,i=nQ();return i?null:m.createElement("li",{role:"separator",className:Xn("".concat(r,"-item-divider"),e),style:n})}var fkt=["label","children","key","type"];function cue(t){return(t||[]).map(function(e,n){if(e&&hi(e)==="object"){var o=e,r=o.label,i=o.children,a=o.key,l=o.type,s=oi(o,fkt),c=a??"tmp-".concat(n);return i||l==="group"?l==="group"?m.createElement(rQ,go({key:c},s,{title:r}),cue(i)):m.createElement(oQ,go({key:c},s,{title:r}),cue(i)):l==="divider"?m.createElement(Kme,go({key:c},s)):m.createElement(qW,go({key:c},s),r)}return null}).filter(function(e){return e})}function hkt(t,e,n){var o=t;return e&&(o=cue(e)),Jme(o,n)}var pkt=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem"],jT=[],gkt=m.forwardRef(function(t,e){var n,o=t,r=o.prefixCls,i=r===void 0?"rc-menu":r,a=o.rootClassName,l=o.style,s=o.className,c=o.tabIndex,u=c===void 0?0:c,d=o.items,f=o.children,p=o.direction,g=o.id,A=o.mode,y=A===void 0?"vertical":A,S=o.inlineCollapsed,C=o.disabled,P=o.disabledOverflow,v=o.subMenuOpenDelay,T=v===void 0?.1:v,w=o.subMenuCloseDelay,x=w===void 0?.1:w,b=o.forceSubMenuRender,R=o.defaultOpenKeys,H=o.openKeys,F=o.activeKey,E=o.defaultActiveFirst,N=o.selectable,U=N===void 0?!0:N,W=o.multiple,k=W===void 0?!1:W,D=o.defaultSelectedKeys,L=o.selectedKeys,j=o.onSelect,B=o.onDeselect,O=o.inlineIndent,V=O===void 0?24:O,G=o.motion,q=o.defaultMotions,$=o.triggerSubMenuAction,ie=$===void 0?"hover":$,Q=o.builtinPlacements,se=o.itemIcon,oe=o.expandIcon,Z=o.overflowedIndicator,te=Z===void 0?"...":Z,ee=o.overflowedIndicatorPopupClassName,de=o.getPopupContainer,fe=o.onClick,pe=o.onOpenChange,ye=o.onKeyDown;o.openAnimation,o.openTransitionName;var ae=o._internalRenderMenuItem,Te=o._internalRenderSubMenuItem,ge=oi(o,pkt),Se=m.useMemo(function(){return hkt(f,d,jT)},[f,d]),Re=m.useState(!1),De=sn(Re,2),Ae=De[0],ue=De[1],he=m.useRef(),ve=_Ft(g),we=p==="rtl",Pe=Es(R,{value:H,postState:function(po){return po||jT}}),Ie=sn(Pe,2),Me=Ie[0],ze=Ie[1],Ne=function(po){var On=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function fo(){ze(po),pe==null||pe(po)}On?Hd.flushSync(fo):fo()},Je=m.useState(Me),Ue=sn(Je,2),nt=Ue[0],We=Ue[1],Ee=m.useRef(!1),ke=m.useMemo(function(){return(y==="inline"||y==="vertical")&&S?["vertical",S]:[y,!1]},[y,S]),Oe=sn(ke,2),st=Oe[0],je=Oe[1],xt=st==="inline",gt=m.useState(st),Ye=sn(gt,2),it=Ye[0],ut=Ye[1],Qe=m.useState(je),lt=sn(Qe,2),Ze=lt[0],Be=lt[1];m.useEffect(function(){ut(st),Be(je),Ee.current&&(xt?ze(nt):Ne(jT))},[st,je]);var $e=m.useState(0),wt=sn($e,2),vt=wt[0],Rt=wt[1],Gt=vt>=Se.length-1||it!=="horizontal"||P;m.useEffect(function(){xt&&We(Me)},[Me]),m.useEffect(function(){return Ee.current=!0,function(){Ee.current=!1}},[]);var At=OFt(),pt=At.registerPath,Wt=At.unregisterPath,ht=At.refreshOverflowKeys,ct=At.isSubPathKey,It=At.getKeyPath,Ft=At.getKeys,Ve=At.getSubPathKeys,ft=m.useMemo(function(){return{registerPath:pt,unregisterPath:Wt}},[pt,Wt]),kt=m.useMemo(function(){return{isSubPathKey:ct}},[ct]);m.useEffect(function(){ht(Gt?jT:Se.slice(vt+1).map(function(Io){return Io.key}))},[vt,Gt]);var rt=Es(F||E&&((n=Se[0])===null||n===void 0?void 0:n.key),{value:F}),at=sn(rt,2),Ge=at[0],yt=at[1],Pt=ED(function(Io){yt(Io)}),ot=ED(function(){yt(void 0)});m.useImperativeHandle(e,function(){return{list:he.current,focus:function(po){var On,fo=Ft(),ir=lue(fo,ve),Rr=ir.elements,br=ir.key2element,_r=ir.element2key,jo=_me(he.current,Rr),wn=Ge??(jo[0]?_r.get(jo[0]):(On=Se.find(function(Wo){return!Wo.props.disabled}))===null||On===void 0?void 0:On.key),In=br.get(wn);if(wn&&In){var ar;In==null||(ar=In.focus)===null||ar===void 0||ar.call(In,po)}}}});var bt=Es(D||[],{value:L,postState:function(po){return Array.isArray(po)?po:po==null?jT:[po]}}),zt=sn(bt,2),Bt=zt[0],tt=zt[1],Ht=function(po){if(U){var On=po.key,fo=Bt.includes(On),ir;k?fo?ir=Bt.filter(function(br){return br!==On}):ir=[].concat(No(Bt),[On]):ir=[On],tt(ir);var Rr=en(en({},po),{},{selectedKeys:ir});fo?B==null||B(Rr):j==null||j(Rr)}!k&&Me.length&&it!=="inline"&&Ne(jT)},_t=ED(function(Io){fe==null||fe(OG(Io)),Ht(Io)}),qt=ED(function(Io,po){var On=Me.filter(function(ir){return ir!==Io});if(po)On.push(Io);else if(it!=="inline"){var fo=Ve(Io);On=On.filter(function(ir){return!fo.has(ir)})}cw(Me,On,!0)||Ne(On,!0)}),un=function(po,On){var fo=On??!Me.includes(po);qt(po,fo)},Rn=jFt(it,Ge,we,ve,he,Ft,It,yt,un,ye);m.useEffect(function(){ue(!0)},[]);var yo=m.useMemo(function(){return{_internalRenderMenuItem:ae,_internalRenderSubMenuItem:Te}},[ae,Te]),Ao=it!=="horizontal"||P?Se:Se.map(function(Io,po){return m.createElement(hk,{key:Io.key,overflowDisabled:po>vt},Io)}),wo=m.createElement(F2,go({id:g,ref:he,prefixCls:"".concat(i,"-overflow"),component:"ul",itemComponent:qW,className:Xn(i,"".concat(i,"-root"),"".concat(i,"-").concat(it),s,Jt(Jt({},"".concat(i,"-inline-collapsed"),Ze),"".concat(i,"-rtl"),we),a),dir:p,style:l,role:"menu",tabIndex:u,data:Ao,renderRawItem:function(po){return po},renderRawRest:function(po){var On=po.length,fo=On?Se.slice(-On):null;return m.createElement(oQ,{eventKey:sue,title:te,disabled:Gt,internalPopupClose:On===0,popupClassName:ee},fo)},maxCount:it!=="horizontal"||P?F2.INVALIDATE:F2.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(po){Rt(po)},onKeyDown:Rn},ge));return m.createElement(Vme.Provider,{value:yo},m.createElement(aXe.Provider,{value:ve},m.createElement(hk,{prefixCls:i,rootClassName:a,mode:it,openKeys:Me,rtl:we,disabled:C,motion:Ae?G:null,defaultMotions:Ae?q:null,activeKey:Ge,onActive:Pt,onInactive:ot,selectedKeys:Bt,inlineIndent:V,subMenuOpenDelay:T,subMenuCloseDelay:x,forceSubMenuRender:b,builtinPlacements:Q,triggerSubMenuAction:ie,getPopupContainer:de,itemIcon:se,expandIcon:oe,onItemClick:_t,onOpenChange:qt},m.createElement(dXe.Provider,{value:kt},wo),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(cXe.Provider,{value:ft},Se)))))}),GH=gkt;GH.Item=qW;GH.SubMenu=oQ;GH.ItemGroup=rQ;GH.Divider=Kme;var mkt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},ykt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:mkt}))},qme=m.forwardRef(ykt),Akt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},wkt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Akt}))},Zve=m.forwardRef(wkt);const yXe=m.createContext({});var vkt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},xkt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:vkt}))},$me=m.forwardRef(xkt),bkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,className:n,dashed:o}=t,r=bkt(t,["prefixCls","className","dashed"]),{getPrefixCls:i}=m.useContext(Cr),a=i("menu",e),l=Un({[`${a}-item-divider-dashed`]:!!o},n);return m.createElement(Kme,Object.assign({className:l},r))},VG=m.createContext({prefixCls:"",firstLevel:!0,inlineCollapsed:!1}),wXe=t=>{var e;const{className:n,children:o,icon:r,title:i,danger:a}=t,{prefixCls:l,firstLevel:s,direction:c,disableMenuItemTitleTooltip:u,inlineCollapsed:d}=m.useContext(VG),f=C=>{const P=m.createElement("span",{className:`${l}-title-content`},o);return(!r||m.isValidElement(o)&&o.type==="span")&&o&&C&&s&&typeof o=="string"?m.createElement("div",{className:`${l}-inline-collapsed-noicon`},o.charAt(0)):P},{siderCollapsed:p}=m.useContext(yXe);let g=i;typeof i>"u"?g=s?o:"":i===!1&&(g="");const A={title:g};!p&&!d&&(A.title=null,A.open=!1);const y=Y9(o).length;let S=m.createElement(qW,Object.assign({},dp(t,["title","icon","danger"]),{className:Un({[`${l}-item-danger`]:a,[`${l}-item-only-child`]:(r?y+1:y)===1},n),title:typeof i=="string"?i:void 0}),j0(r,{className:Un(m.isValidElement(r)?(e=r.props)===null||e===void 0?void 0:e.className:"",`${l}-item-icon`)}),f(d));return u||(S=m.createElement(oA,Object.assign({},A,{placement:c==="rtl"?"left":"right",overlayClassName:`${l}-inline-collapsed-tooltip`}),S)),S},vXe=t=>{var e;const{popupClassName:n,icon:o,title:r,theme:i}=t,a=m.useContext(VG),{prefixCls:l,inlineCollapsed:s,theme:c}=a,u=_H();let d;if(!o)d=s&&!u.length&&r&&typeof r=="string"?m.createElement("div",{className:`${l}-inline-collapsed-noicon`},r.charAt(0)):m.createElement("span",{className:`${l}-title-content`},r);else{const g=m.isValidElement(r)&&r.type==="span";d=m.createElement(m.Fragment,null,j0(o,{className:Un(m.isValidElement(o)?(e=o.props)===null||e===void 0?void 0:e.className:"",`${l}-item-icon`)}),g?r:m.createElement("span",{className:`${l}-title-content`},r))}const f=m.useMemo(()=>Object.assign(Object.assign({},a),{firstLevel:!1}),[a]),[p]=Bw("Menu");return m.createElement(VG.Provider,{value:f},m.createElement(oQ,Object.assign({},dp(t,["icon"]),{title:d,popupClassName:Un(l,n,`${l}-${i||c}`),popupStyle:{zIndex:p}})))};var Skt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{if(e&&typeof e=="object"){const o=e,{label:r,children:i,key:a,type:l}=o,s=Skt(o,["label","children","key","type"]),c=a??`tmp-${n}`;return i||l==="group"?l==="group"?m.createElement(rQ,Object.assign({key:c},s,{title:r}),uue(i)):m.createElement(vXe,Object.assign({key:c},s,{title:r}),uue(i)):l==="divider"?m.createElement(AXe,Object.assign({key:c},s)):m.createElement(wXe,Object.assign({key:c},s),r)}return null}).filter(e=>e)}function Tkt(t){return m.useMemo(()=>t&&uue(t),[t])}var Pkt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{children:n}=t,o=Pkt(t,["children"]),r=m.useContext(_G),i=m.useMemo(()=>Object.assign(Object.assign({},r),o),[r,o.prefixCls,o.mode,o.selectable,o.rootClassName]),a=IPt(n),l=MPt(e,a?n.ref:null);return m.createElement(_G.Provider,{value:i},m.createElement(O9,null,a?m.cloneElement(n,{ref:l}):n))}),Ckt=t=>{const{componentCls:e,motionDurationSlow:n,horizontalLineHeight:o,colorSplit:r,lineWidth:i,lineType:a,itemPaddingInline:l}=t;return{[`${e}-horizontal`]:{lineHeight:o,border:0,borderBottom:`${jt(i)} ${a} ${r}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${e}-item, ${e}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:l},[`> ${e}-item:hover, > ${e}-item-active, > ${e}-submenu ${e}-submenu-title:hover`]:{backgroundColor:"transparent"},[`${e}-item, ${e}-submenu-title`]:{transition:[`border-color ${n}`,`background ${n}`].join(",")},[`${e}-submenu-arrow`]:{display:"none"}}}},Rkt=t=>{let{componentCls:e,menuArrowOffset:n,calc:o}=t;return{[`${e}-rtl`]:{direction:"rtl"},[`${e}-submenu-rtl`]:{transformOrigin:"100% 0"},[`${e}-rtl${e}-vertical, ${e}-submenu-rtl ${e}-vertical`]:{[`${e}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateY(${jt(o(n).mul(-1).equal())})`},"&::after":{transform:`rotate(45deg) translateY(${jt(n)})`}}}}},exe=t=>Object.assign({},dw(t)),txe=(t,e)=>{const{componentCls:n,itemColor:o,itemSelectedColor:r,groupTitleColor:i,itemBg:a,subMenuItemBg:l,itemSelectedBg:s,activeBarHeight:c,activeBarWidth:u,activeBarBorderWidth:d,motionDurationSlow:f,motionEaseInOut:p,motionEaseOut:g,itemPaddingInline:A,motionDurationMid:y,itemHoverColor:S,lineType:C,colorSplit:P,itemDisabledColor:v,dangerItemColor:T,dangerItemHoverColor:w,dangerItemSelectedColor:x,dangerItemActiveBg:b,dangerItemSelectedBg:R,popupBg:H,itemHoverBg:F,itemActiveBg:E,menuSubMenuBg:N,horizontalItemSelectedColor:U,horizontalItemSelectedBg:W,horizontalItemBorderRadius:k,horizontalItemHoverBg:D}=t;return{[`${n}-${e}, ${n}-${e} > ${n}`]:{color:o,background:a,[`&${n}-root:focus-visible`]:Object.assign({},exe(t)),[`${n}-item-group-title`]:{color:i},[`${n}-submenu-selected`]:{[`> ${n}-submenu-title`]:{color:r}},[`${n}-item, ${n}-submenu-title`]:{color:o,[`&:not(${n}-item-disabled):focus-visible`]:Object.assign({},exe(t))},[`${n}-item-disabled, ${n}-submenu-disabled`]:{color:`${v} !important`},[`${n}-item:not(${n}-item-selected):not(${n}-submenu-selected)`]:{[`&:hover, > ${n}-submenu-title:hover`]:{color:S}},[`&:not(${n}-horizontal)`]:{[`${n}-item:not(${n}-item-selected)`]:{"&:hover":{backgroundColor:F},"&:active":{backgroundColor:E}},[`${n}-submenu-title`]:{"&:hover":{backgroundColor:F},"&:active":{backgroundColor:E}}},[`${n}-item-danger`]:{color:T,[`&${n}-item:hover`]:{[`&:not(${n}-item-selected):not(${n}-submenu-selected)`]:{color:w}},[`&${n}-item:active`]:{background:b}},[`${n}-item a`]:{"&, &:hover":{color:"inherit"}},[`${n}-item-selected`]:{color:r,[`&${n}-item-danger`]:{color:x},"a, a:hover":{color:"inherit"}},[`& ${n}-item-selected`]:{backgroundColor:s,[`&${n}-item-danger`]:{backgroundColor:R}},[`&${n}-submenu > ${n}`]:{backgroundColor:N},[`&${n}-popup > ${n}`]:{backgroundColor:H},[`&${n}-submenu-popup > ${n}`]:{backgroundColor:H},[`&${n}-horizontal`]:Object.assign(Object.assign({},e==="dark"?{borderBottom:0}:{}),{[`> ${n}-item, > ${n}-submenu`]:{top:d,marginTop:t.calc(d).mul(-1).equal(),marginBottom:0,borderRadius:k,"&::after":{position:"absolute",insetInline:A,bottom:0,borderBottom:`${jt(c)} solid transparent`,transition:`border-color ${f} ${p}`,content:'""'},"&:hover, &-active, &-open":{background:D,"&::after":{borderBottomWidth:c,borderBottomColor:U}},"&-selected":{color:U,backgroundColor:W,"&:hover":{backgroundColor:W},"&::after":{borderBottomWidth:c,borderBottomColor:U}}}}),[`&${n}-root`]:{[`&${n}-inline, &${n}-vertical`]:{borderInlineEnd:`${jt(d)} ${C} ${P}`}},[`&${n}-inline`]:{[`${n}-sub${n}-inline`]:{background:l},[`${n}-item`]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:`${jt(u)} solid ${r}`,transform:"scaleY(0.0001)",opacity:0,transition:[`transform ${y} ${g}`,`opacity ${y} ${g}`].join(","),content:'""'},[`&${n}-item-danger`]:{"&::after":{borderInlineEndColor:x}}},[`${n}-selected, ${n}-item-selected`]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:[`transform ${y} ${p}`,`opacity ${y} ${p}`].join(",")}}}}}},nxe=t=>{const{componentCls:e,itemHeight:n,itemMarginInline:o,padding:r,menuArrowSize:i,marginXS:a,itemMarginBlock:l,itemWidth:s}=t,c=t.calc(i).add(r).add(a).equal();return{[`${e}-item`]:{position:"relative",overflow:"hidden"},[`${e}-item, ${e}-submenu-title`]:{height:n,lineHeight:jt(n),paddingInline:r,overflow:"hidden",textOverflow:"ellipsis",marginInline:o,marginBlock:l,width:s},[`> ${e}-item, @@ -4554,7 +4554,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &${a}-slide-down-leave${a}-slide-down-leave-active${e}-placement-bottom, &${a}-slide-down-leave${a}-slide-down-leave-active${e}-placement-bottomRight`]:{animationName:V$},[`&${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-topLeft, &${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-top, - &${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-topRight`]:{animationName:G$}})},Ome(t,A,{arrowPlacement:{top:!0,bottom:!0}}),{[`${e} ${n}`]:{position:"relative",margin:0},[`${n}-submenu-popup`]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},[`${e}, ${e}-menu-submenu`]:{[n]:Object.assign(Object.assign({padding:d,listStyleType:"none",backgroundColor:A,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary},eA(t)),{"&:empty":{padding:0,boxShadow:"none"},[`${n}-item-group-title`]:{padding:`${jt(c)} ${jt(g)}`,color:t.colorTextDescription,transition:`all ${s}`},[`${n}-item`]:{position:"relative",display:"flex",alignItems:"center"},[`${n}-item-icon`]:{minWidth:u,marginInlineEnd:t.marginXS,fontSize:t.fontSizeSM},[`${n}-title-content`]:{flex:"auto","> a":{color:"inherit",transition:`all ${s}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}}},[`${n}-item, ${n}-submenu-title`]:Object.assign(Object.assign({clear:"both",margin:0,padding:`${jt(c)} ${jt(g)}`,color:t.colorText,fontWeight:"normal",fontSize:u,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${s}`,borderRadius:t.borderRadiusSM,"&:hover, &-active":{backgroundColor:t.controlItemBgHover}},eA(t)),{"&-selected":{color:t.colorPrimary,backgroundColor:t.controlItemBgActive,"&:hover, &-active":{backgroundColor:t.controlItemBgActiveHover}},"&-disabled":{color:f,cursor:"not-allowed","&:hover":{color:f,backgroundColor:A,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${jt(t.marginXXS)} 0`,overflow:"hidden",lineHeight:0,backgroundColor:t.colorSplit},[`${e}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:t.paddingXS,[`${e}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:t.colorTextDescription,fontSize:p,fontStyle:"normal"}}}),[`${n}-item-group-list`]:{margin:`0 ${jt(t.marginXS)}`,padding:0,listStyle:"none"},[`${n}-submenu-title`]:{paddingInlineEnd:t.calc(g).add(t.fontSizeSM).equal()},[`${n}-submenu-vertical`]:{position:"relative"},[`${n}-submenu${n}-submenu-disabled ${e}-menu-submenu-title`]:{[`&, ${e}-menu-submenu-arrow-icon`]:{color:f,backgroundColor:A,cursor:"not-allowed"}},[`${n}-submenu-selected ${e}-menu-submenu-title`]:{color:t.colorPrimary}})}},[V9(t,"slide-up"),V9(t,"slide-down"),xR(t,"move-up"),xR(t,"move-down"),_W(t,"zoom-big")]]},Lkt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+50,paddingBlock:(t.controlHeight-t.fontSize*t.lineHeight)/2},eQ({contentRadius:t.borderRadiusLG,limitVerticalRadius:!0})),Z$(t)),Wkt=wl("Dropdown",t=>{const{marginXXS:e,sizePopupArrow:n,paddingXXS:o,componentCls:r}=t,i=qi(t,{menuCls:`${r}-menu`,dropdownArrowDistance:t.calc(n).div(2).add(e).equal(),dropdownEdgeChildPadding:o});return[kkt(i),Fkt(i)]},Lkt),iQ=t=>{const{menu:e,arrow:n,prefixCls:o,children:r,trigger:i,disabled:a,dropdownRender:l,getPopupContainer:s,overlayClassName:c,rootClassName:u,overlayStyle:d,open:f,onOpenChange:p,visible:g,onVisibleChange:A,mouseEnterDelay:y=.15,mouseLeaveDelay:S=.1,autoAdjustOverflow:C=!0,placement:P="",overlay:v,transitionName:T}=t,{getPopupContainer:w,getPrefixCls:x,direction:b,dropdown:R}=m.useContext(Cr);Bb();const H=m.useMemo(()=>{const oe=x();return T!==void 0?T:P.includes("top")?`${oe}-slide-down`:`${oe}-slide-up`},[x,P,T]),F=m.useMemo(()=>P?P.includes("Center")?P.slice(0,P.indexOf("Center")):P:b==="rtl"?"bottomRight":"bottomLeft",[P,b]),E=x("dropdown",o),N=Y0(E),[U,W,k]=Wkt(E,N),[,D]=Vu(),L=m.Children.only(r),j=j0(L,{className:Un(`${E}-trigger`,{[`${E}-rtl`]:b==="rtl"},L.props.className),disabled:a}),B=a?[]:i;let O;B&&B.includes("contextMenu")&&(O=!0);const[V,G]=Z6(!1,{value:f??g}),q=Q6(oe=>{p==null||p(oe,{source:"trigger"}),A==null||A(oe),G(oe)}),$=Un(c,u,W,k,N,R==null?void 0:R.className,{[`${E}-rtl`]:b==="rtl"}),ie=$Ge({arrowPointAtCenter:typeof n=="object"&&n.pointAtCenter,autoAdjustOverflow:C,offset:D.marginXXS,arrowWidth:n?D.sizePopupArrow:0,borderRadius:D.borderRadius}),Q=m.useCallback(()=>{e!=null&&e.selectable&&(e!=null&&e.multiple)||(p==null||p(!1,{source:"menu"}),G(!1))},[e==null?void 0:e.selectable,e==null?void 0:e.multiple]),se=()=>{let oe;return e!=null&&e.items?oe=m.createElement(XH,Object.assign({},e)):typeof v=="function"?oe=v():oe=v,l&&(oe=l(oe)),oe=m.Children.only(typeof oe=="string"?m.createElement("span",null,oe):oe),m.createElement(xXe,{prefixCls:`${E}-menu`,rootClassName:Un(k,N),expandIcon:m.createElement("span",{className:`${E}-menu-submenu-arrow`},m.createElement(YG,{className:`${E}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:Q,validator:de=>{}},oe)},[Z,ee]=Bw("Dropdown",d==null?void 0:d.zIndex);let te=m.createElement(iXe,Object.assign({alignPoint:O},dp(t,["rootClassName"]),{mouseEnterDelay:y,mouseLeaveDelay:S,visible:V,builtinPlacements:ie,arrow:!!n,overlayClassName:$,prefixCls:E,getPopupContainer:s||w,transitionName:H,trigger:B,overlay:se,placement:F,onVisibleChange:q,overlayStyle:Object.assign(Object.assign(Object.assign({},R==null?void 0:R.style),d),{zIndex:Z})}),j);return Z&&(te=m.createElement(WW.Provider,{value:ee},te)),U(te)};function Nkt(t){return Object.assign(Object.assign({},t),{align:{overflow:{adjustX:!1,adjustY:!1}}})}const Ukt=XW(iQ,"dropdown",t=>t,Nkt),jkt=t=>m.createElement(Ukt,Object.assign({},t),m.createElement("span",null));iQ._InternalPanelDoNotUseOrYouWillBeFired=jkt;var bXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){o.prototype.weekday=function(r){var i=this.$locale().weekStart||0,a=this.$W,l=(a25){var u=a(this).startOf(o).add(1,o).date(c),d=a(this).endOf(n);if(u.isBefore(d))return 1}var f=a(this).startOf(o).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?a(this).startOf("week").week():Math.ceil(p)},l.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})})(TXe);var _kt=TXe.exports;const Gkt=Wi(_kt);var PXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){o.prototype.weekYear=function(){var r=this.month(),i=this.week(),a=this.year();return i===1&&r===11?a+1:r===0&&i>=52?a-1:a}}})})(PXe);var Xkt=PXe.exports;const Jkt=Wi(Xkt);var CXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){var r=o.prototype,i=r.format;r.format=function(a){var l=this,s=this.$locale();if(!this.isValid())return i.bind(this)(a);var c=this.$utils(),u=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(d){switch(d){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return s.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return s.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),d==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return d}});return i.bind(this)(u)}}})})(CXe);var Kkt=CXe.exports;const qkt=Wi(Kkt);var RXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},o=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},s=function(A){return(A=+A)+(A>68?1900:2e3)},c=function(A){return function(y){this[A]=+y}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(A){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var S=y.match(/([+-]|\d\d)/g),C=60*S[1]+(+S[2]||0);return C===0?0:S[0]==="+"?-C:C}(A)}],d=function(A){var y=l[A];return y&&(y.indexOf?y:y.s.concat(y.f))},f=function(A,y){var S,C=l.meridiem;if(C){for(var P=1;P<=24;P+=1)if(A.indexOf(C(P,0,y))>-1){S=P>12;break}}else S=A===(y?"pm":"PM");return S},p={A:[a,function(A){this.afternoon=f(A,!1)}],a:[a,function(A){this.afternoon=f(A,!0)}],S:[/\d/,function(A){this.milliseconds=100*+A}],SS:[r,function(A){this.milliseconds=10*+A}],SSS:[/\d{3}/,function(A){this.milliseconds=+A}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[r,c("day")],Do:[a,function(A){var y=l.ordinal,S=A.match(/\d+/);if(this.day=S[0],y)for(var C=1;C<=31;C+=1)y(C).replace(/\[|\]/g,"")===A&&(this.day=C)}],M:[i,c("month")],MM:[r,c("month")],MMM:[a,function(A){var y=d("months"),S=(d("monthsShort")||y.map(function(C){return C.slice(0,3)})).indexOf(A)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[a,function(A){var y=d("months").indexOf(A)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,c("year")],YY:[r,function(A){this.year=s(A)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(A){var y,S;y=A,S=l&&l.formats;for(var C=(A=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(R,H,F){var E=F&&F.toUpperCase();return H||S[F]||n[F]||S[E].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,U,W){return U||W.slice(1)})})).match(o),P=C.length,v=0;v-1)return new Date((D==="X"?1e3:1)*k);var j=g(D)(k),B=j.year,O=j.month,V=j.day,G=j.hours,q=j.minutes,$=j.seconds,ie=j.milliseconds,Q=j.zone,se=new Date,Z=V||(B||O?1:se.getDate()),ee=B||se.getFullYear(),te=0;B&&!O||(te=O>0?O-1:se.getMonth());var oe=G||0,de=q||0,he=$||0,pe=ie||0;return Q?new Date(Date.UTC(ee,te,Z,oe,de,he,pe+60*Q.offset*1e3)):L?new Date(Date.UTC(ee,te,Z,oe,de,he,pe)):new Date(ee,te,Z,oe,de,he,pe)}catch{return new Date("")}}(T,b,w),this.init(),E&&E!==!0&&(this.$L=this.locale(E).$L),F&&T!=this.format(b)&&(this.$d=new Date("")),l={}}else if(b instanceof Array)for(var N=b.length,U=1;U<=N;U+=1){x[1]=b[U-1];var W=S.apply(this,x);if(W.isValid()){this.$d=W.$d,this.$L=W.$L,this.init();break}U===N&&(this.$d=new Date(""))}else P.call(this,v)}}})})(RXe);var $kt=RXe.exports;const Qkt=Wi($kt);ul.extend(Qkt);ul.extend(qkt);ul.extend(Ykt);ul.extend(Vkt);ul.extend(Gkt);ul.extend(Jkt);ul.extend(function(t,e){var n=e.prototype,o=n.format;n.format=function(i){var a=(i||"").replace("Wo","wo");return o.bind(this)(a)}});var Zkt={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},K7=function(e){var n=Zkt[e];return n||e.split("_")[0]},ixe=function(){kOe(!1,"Not match any format. Please help to fire a issue about this.")},eLt={getNow:function(){return ul()},getFixedDate:function(e){return ul(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var n=e.locale("en");return n.weekday()+n.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},getMillisecond:function(e){return e.millisecond()},addYear:function(e,n){return e.add(n,"year")},addMonth:function(e,n){return e.add(n,"month")},addDate:function(e,n){return e.add(n,"day")},setYear:function(e,n){return e.year(n)},setMonth:function(e,n){return e.month(n)},setDate:function(e,n){return e.date(n)},setHour:function(e,n){return e.hour(n)},setMinute:function(e,n){return e.minute(n)},setSecond:function(e,n){return e.second(n)},setMillisecond:function(e,n){return e.millisecond(n)},isAfter:function(e,n){return e.isAfter(n)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return ul().locale(K7(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,n){return n.locale(K7(e)).weekday(0)},getWeek:function(e,n){return n.locale(K7(e)).week()},getShortWeekDays:function(e){return ul().locale(K7(e)).localeData().weekdaysMin()},getShortMonths:function(e){return ul().locale(K7(e)).localeData().monthsShort()},format:function(e,n,o){return n.locale(K7(e)).format(o)},parse:function(e,n,o){for(var r=K7(e),i=0;i2&&arguments[2]!==void 0?arguments[2]:"0",o=String(t);o.length2&&arguments[2]!==void 0?arguments[2]:[],o=m.useState([!1,!1]),r=sn(o,2),i=r[0],a=r[1],l=function(u,d){a(function(f){return RE(f,d,u)})},s=m.useMemo(function(){return i.map(function(c,u){if(c)return!0;var d=t[u];return d?!!(!n[u]&&!d||d&&e(d,{activeIndex:u})):!1})},[t,i,e,n]);return[s,l]}function EXe(t,e,n,o,r){var i="",a=[];return t&&a.push(r?"hh":"HH"),e&&a.push("mm"),n&&a.push("ss"),i=a.join(":"),o&&(i+=".SSS"),r&&(i+=" A"),i}function nLt(t,e,n,o,r,i){var a=t.fieldDateTimeFormat,l=t.fieldDateFormat,s=t.fieldTimeFormat,c=t.fieldMonthFormat,u=t.fieldYearFormat,d=t.fieldWeekFormat,f=t.fieldQuarterFormat,p=t.yearFormat,g=t.cellYearFormat,A=t.cellQuarterFormat,y=t.dayFormat,S=t.cellDateFormat,C=EXe(e,n,o,r,i);return en(en({},t),{},{fieldDateTimeFormat:a||"YYYY-MM-DD ".concat(C),fieldDateFormat:l||"YYYY-MM-DD",fieldTimeFormat:s||C,fieldMonthFormat:c||"YYYY-MM",fieldYearFormat:u||"YYYY",fieldWeekFormat:d||"gggg-wo",fieldQuarterFormat:f||"YYYY-[Q]Q",yearFormat:p||"YYYY",cellYearFormat:g||"YYYY",cellQuarterFormat:A||"[Q]Q",cellDateFormat:S||y||"D"})}function FXe(t,e){var n=e.showHour,o=e.showMinute,r=e.showSecond,i=e.showMillisecond,a=e.use12Hours;return be.useMemo(function(){return nLt(t,n,o,r,i,a)},[t,n,o,r,i,a])}function Uz(t,e,n){return n??e.some(function(o){return t.includes(o)})}var oLt=["showNow","showHour","showMinute","showSecond","showMillisecond","use12Hours","hourStep","minuteStep","secondStep","millisecondStep","hideDisabledOptions","defaultValue","disabledHours","disabledMinutes","disabledSeconds","disabledMilliseconds","disabledTime","changeOnScroll","defaultOpenValue"];function rLt(t){var e=aQ(t,oLt),n=t.format,o=t.picker,r=null;return n&&(r=n,Array.isArray(r)&&(r=r[0]),r=hi(r)==="object"?r.format:r),o==="time"&&(e.format=r),[e,r]}function iLt(t){return t&&typeof t=="string"}function kXe(t,e,n,o){return[t,e,n,o].some(function(r){return r!==void 0})}function LXe(t,e,n,o,r){var i=e,a=n,l=o;if(!t&&!i&&!a&&!l&&!r)i=!0,a=!0,l=!0;else if(t){var s,c,u,d=[i,a,l].some(function(g){return g===!1}),f=[i,a,l].some(function(g){return g===!0}),p=d?!0:!f;i=(s=i)!==null&&s!==void 0?s:p,a=(c=a)!==null&&c!==void 0?c:p,l=(u=l)!==null&&u!==void 0?u:p}return[i,a,l,r]}function WXe(t){var e=t.showTime,n=rLt(t),o=sn(n,2),r=o[0],i=o[1],a=e&&hi(e)==="object"?e:{},l=en(en({defaultOpenValue:a.defaultOpenValue||a.defaultValue},r),a),s=l.showMillisecond,c=l.showHour,u=l.showMinute,d=l.showSecond,f=kXe(c,u,d,s),p=LXe(f,c,u,d,s),g=sn(p,3);return c=g[0],u=g[1],d=g[2],[l,en(en({},l),{},{showHour:c,showMinute:u,showSecond:d,showMillisecond:s}),l.format,i]}function NXe(t,e,n,o,r){var i=t==="time";if(t==="datetime"||i){for(var a=o,l=MXe(t,r,null),s=l,c=[e,n],u=0;u1&&(a=e.addDate(a,-7)),a}function Lu(t,e){var n=e.generateConfig,o=e.locale,r=e.format;return t?typeof r=="function"?r(t):n.locale.format(o.locale,t,r):""}function GG(t,e,n){var o=e,r=["getHour","getMinute","getSecond","getMillisecond"],i=["setHour","setMinute","setSecond","setMillisecond"];return i.forEach(function(a,l){n?o=t[a](o,t[r[l]](n)):o=t[a](o,0)}),o}function cLt(t,e,n,o,r){var i=za(function(a,l){return!!(n&&n(a,l)||o&&t.isAfter(o,a)&&!dh(t,e,o,a,l.type)||r&&t.isAfter(a,r)&&!dh(t,e,r,a,l.type))});return i}function uLt(t,e,n){return m.useMemo(function(){var o=MXe(t,e,n),r=Ob(o),i=r[0],a=hi(i)==="object"&&i.type==="mask"?i.format:null;return[r.map(function(l){return typeof l=="string"||typeof l=="function"?l:l.format}),a]},[t,e,n])}function dLt(t,e,n){return typeof t[0]=="function"||n?!0:e}function fLt(t,e,n,o){var r=za(function(i,a){var l=en({type:e},a);if(delete l.activeIndex,!t.isValidate(i)||n&&n(i,l))return!0;if((e==="date"||e==="time")&&o){var s,c=a&&a.activeIndex===1?"end":"start",u=((s=o.disabledTime)===null||s===void 0?void 0:s.call(o,i,c,{from:l.from}))||{},d=u.disabledHours,f=u.disabledMinutes,p=u.disabledSeconds,g=u.disabledMilliseconds,A=o.disabledHours,y=o.disabledMinutes,S=o.disabledSeconds,C=d||A,P=f||y,v=p||S,T=t.getHour(i),w=t.getMinute(i),x=t.getSecond(i),b=t.getMillisecond(i);if(C&&C().includes(T)||P&&P(T).includes(w)||v&&v(T,w).includes(x)||g&&g(T,w,x).includes(b))return!0}return!1});return r}function FY(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=m.useMemo(function(){var o=t&&Ob(t);return e&&o&&(o[1]=o[1]||o[0]),o},[t,e]);return n}function BXe(t,e){var n=t.generateConfig,o=t.locale,r=t.picker,i=r===void 0?"date":r,a=t.prefixCls,l=a===void 0?"rc-picker":a,s=t.styles,c=s===void 0?{}:s,u=t.classNames,d=u===void 0?{}:u,f=t.order,p=f===void 0?!0:f,g=t.components,A=g===void 0?{}:g,y=t.inputRender,S=t.allowClear,C=t.clearIcon,P=t.needConfirm,v=t.multiple,T=t.format,w=t.inputReadOnly,x=t.disabledDate,b=t.minDate,R=t.maxDate,H=t.showTime,F=t.value,E=t.defaultValue,N=t.pickerValue,U=t.defaultPickerValue,W=FY(F),k=FY(E),D=FY(N),L=FY(U),j=i==="date"&&H?"datetime":i,B=j==="time"||j==="datetime",O=B||v,V=P??B,G=WXe(t),q=sn(G,4),$=q[0],ie=q[1],Q=q[2],se=q[3],Z=FXe(o,ie),ee=m.useMemo(function(){return NXe(j,Q,se,$,Z)},[j,Q,se,$,Z]),te=m.useMemo(function(){return en(en({},t),{},{prefixCls:l,locale:Z,picker:i,styles:c,classNames:d,order:p,components:en({input:y},A),clearIcon:aLt(l,S,C),showTime:ee,value:W,defaultValue:k,pickerValue:D,defaultPickerValue:L},e==null?void 0:e())},[t]),oe=uLt(j,Z,T),de=sn(oe,2),he=de[0],pe=de[1],me=dLt(he,w,v),le=cLt(n,o,x,b,R),Te=fLt(n,i,le,ee),ge=m.useMemo(function(){return en(en({},te),{},{needConfirm:V,inputReadOnly:me,disabledDate:le})},[te,V,me,le]);return[ge,j,O,he,pe,Te]}function hLt(t,e,n){var o=Es(e,{value:t}),r=sn(o,2),i=r[0],a=r[1],l=be.useRef(t),s=be.useRef(),c=function(){Ea.cancel(s.current)},u=za(function(){a(l.current),n&&i!==l.current&&n(l.current)}),d=za(function(f,p){c(),l.current=f,f||p?u():s.current=Ea(u)});return be.useEffect(function(){return c},[]),[i,d]}function YXe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,r=n.every(function(u){return u})?!1:t,i=hLt(r,e||!1,o),a=sn(i,2),l=a[0],s=a[1];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!d.inherit||l)&&s(u,d.force)}return[l,c]}function OXe(t){var e=m.useRef();return m.useImperativeHandle(t,function(){var n;return{nativeElement:(n=e.current)===null||n===void 0?void 0:n.nativeElement,focus:function(r){var i;(i=e.current)===null||i===void 0||i.focus(r)},blur:function(){var r;(r=e.current)===null||r===void 0||r.blur()}}}),e}function VXe(t,e){return m.useMemo(function(){return t||(e?(U0(!1,"`ranges` is deprecated. Please use `presets` instead."),Object.entries(e).map(function(n){var o=sn(n,2),r=o[0],i=o[1];return{label:r,value:i}})):[])},[t,e])}function nye(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,o=m.useRef(e);o.current=e,yx(function(){if(t)o.current(t);else{var r=Ea(function(){o.current(t)},n);return function(){Ea.cancel(r)}}},[t])}function _Xe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=m.useState(0),o=sn(n,2),r=o[0],i=o[1],a=m.useState(!1),l=sn(a,2),s=l[0],c=l[1],u=m.useRef([]),d=m.useRef(null),f=function(y){c(y)},p=function(y){return y&&(d.current=y),d.current},g=function(y){var S=u.current,C=new Set(S.filter(function(v){return y[v]||e[v]})),P=S[S.length-1]===0?1:0;return C.size>=2||t[P]?null:P};return nye(s,function(){s||(u.current=[])}),m.useEffect(function(){s&&u.current.push(r)},[s,r]),[s,f,p,r,i,g,u.current]}function pLt(t,e,n,o,r,i){var a=n[n.length-1],l=function(c,u){var d=sn(t,2),f=d[0],p=d[1],g=en(en({},u),{},{from:IXe(t,n)});return a===1&&e[0]&&f&&!dh(o,r,f,c,g.type)&&o.isAfter(f,c)||a===0&&e[1]&&p&&!dh(o,r,p,c,g.type)&&o.isAfter(c,p)?!0:i==null?void 0:i(c,g)};return l}function kD(t,e,n,o){switch(e){case"date":case"week":return t.addMonth(n,o);case"month":case"quarter":return t.addYear(n,o);case"year":return t.addYear(n,o*10);case"decade":return t.addYear(n,o*100);default:return n}}var fie=[];function GXe(t,e,n,o,r,i,a,l){var s=arguments.length>8&&arguments[8]!==void 0?arguments[8]:fie,c=arguments.length>9&&arguments[9]!==void 0?arguments[9]:fie,u=arguments.length>10&&arguments[10]!==void 0?arguments[10]:fie,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,p=arguments.length>13?arguments[13]:void 0,g=a==="time",A=i||0,y=function(D){var L=t.getNow();return g&&(L=GG(t,L)),s[D]||n[D]||L},S=sn(c,2),C=S[0],P=S[1],v=Es(function(){return y(0)},{value:C}),T=sn(v,2),w=T[0],x=T[1],b=Es(function(){return y(1)},{value:P}),R=sn(b,2),H=R[0],F=R[1],E=m.useMemo(function(){var k=[w,H][A];return g?k:GG(t,k,u[A])},[g,w,H,A,t,u]),N=function(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"panel",j=[x,F][A];j(D);var B=[w,H];B[A]=D,d&&(!dh(t,e,w,B[0],a)||!dh(t,e,H,B[1],a))&&d(B,{source:L,range:A===1?"end":"start",mode:o})},U=function(D,L){if(l){var j={date:"month",week:"month",month:"year",quarter:"year"},B=j[a];if(B&&!dh(t,e,D,L,B))return kD(t,a,L,-1);if(a==="year"){var O=Math.floor(t.getYear(D)/10),V=Math.floor(t.getYear(L)/10);if(O!==V)return kD(t,a,L,-1)}}return L},W=m.useRef(null);return _a(function(){if(r&&!s[A]){var k=g?null:t.getNow();if(W.current!==null&&W.current!==A?k=[w,H][A^1]:n[A]?k=A===0?n[0]:U(n[0],n[1]):n[A^1]&&(k=n[A^1]),k){f&&t.isAfter(f,k)&&(k=f);var D=l?kD(t,a,k,1):k;p&&t.isAfter(D,p)&&(k=l?kD(t,a,p,-1):p),N(k,"reset")}}},[r,A,n[A]]),m.useEffect(function(){r?W.current=A:W.current=null},[r,A]),_a(function(){r&&s&&s[A]&&N(s[A],"reset")},[r,A]),[E,N]}function XXe(t,e){var n=m.useRef(t),o=m.useState({}),r=sn(o,2),i=r[1],a=function(c){return c&&e!==void 0?e:n.current},l=function(c){n.current=c,i({})};return[a,l,a(!0)]}var gLt=[];function JXe(t,e,n){var o=function(a){return a.map(function(l){return Lu(l,{generateConfig:t,locale:e,format:n[0]})})},r=function(a,l){for(var s=Math.max(a.length,l.length),c=-1,u=0;u2&&arguments[2]!==void 0?arguments[2]:1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:2,a=[],l=n>=1?n|0:1,s=t;s<=e;s+=l){var c=r.includes(s);(!c||!o)&&a.push({label:Qme(s,i),value:s,disabled:c})}return a}function oye(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=e||{},r=o.use12Hours,i=o.hourStep,a=i===void 0?1:i,l=o.minuteStep,s=l===void 0?1:l,c=o.secondStep,u=c===void 0?1:c,d=o.millisecondStep,f=d===void 0?100:d,p=o.hideDisabledOptions,g=o.disabledTime,A=o.disabledHours,y=o.disabledMinutes,S=o.disabledSeconds,C=m.useMemo(function(){return n||t.getNow()},[n,t]),P=m.useCallback(function(L){var j=(g==null?void 0:g(L))||{};return[j.disabledHours||A||kY,j.disabledMinutes||y||kY,j.disabledSeconds||S||kY,j.disabledMilliseconds||kY]},[g,A,y,S]),v=m.useMemo(function(){return P(C)},[C,P]),T=sn(v,4),w=T[0],x=T[1],b=T[2],R=T[3],H=m.useCallback(function(L,j,B,O){var V=LY(0,23,a,p,L()),G=r?V.map(function(Q){return en(en({},Q),{},{label:Qme(Q.value%12||12,2)})}):V,q=function(se){return LY(0,59,s,p,j(se))},$=function(se,Z){return LY(0,59,u,p,B(se,Z))},ie=function(se,Z,ee){return LY(0,999,f,p,O(se,Z,ee),3)};return[G,q,$,ie]},[p,a,r,f,s,u]),F=m.useMemo(function(){return H(w,x,b,R)},[H,w,x,b,R]),E=sn(F,4),N=E[0],U=E[1],W=E[2],k=E[3],D=function(j,B){var O=function(){return N},V=U,G=W,q=k;if(B){var $=P(B),ie=sn($,4),Q=ie[0],se=ie[1],Z=ie[2],ee=ie[3],te=H(Q,se,Z,ee),oe=sn(te,4),de=oe[0],he=oe[1],pe=oe[2],me=oe[3];O=function(){return de},V=he,G=pe,q=me}var le=yLt(j,O,V,G,q,t);return le};return[D,N,U,W,k]}function ALt(t){var e=t.mode,n=t.internalMode,o=t.renderExtraFooter,r=t.showNow,i=t.showTime,a=t.onSubmit,l=t.onNow,s=t.invalid,c=t.needConfirm,u=t.generateConfig,d=t.disabledDate,f=m.useContext(r5),p=f.prefixCls,g=f.locale,A=f.button,y=A===void 0?"button":A,S=u.getNow(),C=oye(u,i,S),P=sn(C,1),v=P[0],T=o==null?void 0:o(e),w=d(S,{type:e}),x=function(){if(!w){var U=v(S);l(U)}},b="".concat(p,"-now"),R="".concat(b,"-btn"),H=r&&m.createElement("li",{className:b},m.createElement("a",{className:Xn(R,w&&"".concat(R,"-disabled")),"aria-disabled":w,onClick:x},n==="date"?g.today:g.now)),F=c&&m.createElement("li",{className:"".concat(p,"-ok")},m.createElement(y,{disabled:s,onClick:a},g.ok)),E=(H||F)&&m.createElement("ul",{className:"".concat(p,"-ranges")},H,F);return!T&&!E?null:m.createElement("div",{className:"".concat(p,"-footer")},T&&m.createElement("div",{className:"".concat(p,"-footer-extra")},T),E)}function ZXe(t,e,n){function o(r,i){var a=r.findIndex(function(s){return dh(t,e,s,i,n)});if(a===-1)return[].concat(No(r),[i]);var l=No(r);return l.splice(a,1),l}return o}var Vb=m.createContext(null);function sQ(){return m.useContext(Vb)}function JH(t,e){var n=t.prefixCls,o=t.generateConfig,r=t.locale,i=t.disabledDate,a=t.minDate,l=t.maxDate,s=t.cellRender,c=t.hoverValue,u=t.hoverRangeValue,d=t.onHover,f=t.values,p=t.pickerValue,g=t.onSelect,A=t.prevIcon,y=t.nextIcon,S=t.superPrevIcon,C=t.superNextIcon,P=o.getNow(),v={now:P,values:f,pickerValue:p,prefixCls:n,disabledDate:i,minDate:a,maxDate:l,cellRender:s,hoverValue:c,hoverRangeValue:u,onHover:d,locale:r,generateConfig:o,onSelect:g,panelType:e,prevIcon:A,nextIcon:y,superPrevIcon:S,superNextIcon:C};return[v,P]}var V8=m.createContext({});function $W(t){for(var e=t.rowNum,n=t.colNum,o=t.baseDate,r=t.getCellDate,i=t.prefixColumn,a=t.rowClassName,l=t.titleFormat,s=t.getCellText,c=t.getCellClassName,u=t.headerCells,d=t.cellSelection,f=d===void 0?!0:d,p=t.disabledDate,g=sQ(),A=g.prefixCls,y=g.panelType,S=g.now,C=g.disabledDate,P=g.cellRender,v=g.onHover,T=g.hoverValue,w=g.hoverRangeValue,x=g.generateConfig,b=g.values,R=g.locale,H=g.onSelect,F=p||C,E="".concat(A,"-cell"),N=m.useContext(V8),U=N.onCellDblClick,W=function(G){return b.some(function(q){return q&&dh(x,R,G,q,y)})},k=[],D=0;D1&&arguments[1]!==void 0?arguments[1]:!1;De(nt),y==null||y(nt),We&&Ae(nt)},fe=function(nt,We){Z(nt),We&&ue(We),Ae(We,nt)},ve=function(nt){if(Te(nt),ue(nt),se!==v){var We=["decade","year"],Ee=[].concat(We,["month"]),ke={quarter:[].concat(We,["quarter"]),week:[].concat(No(Ee),["week"]),date:[].concat(No(Ee),["date"])},Oe=ke[v]||Ee,st=Oe.indexOf(se),je=Oe[st+1];je&&fe(je,nt)}},we=m.useMemo(function(){var Ue,nt;if(Array.isArray(x)){var We=sn(x,2);Ue=We[0],nt=We[1]}else Ue=x;return!Ue&&!nt?null:(Ue=Ue||nt,nt=nt||Ue,r.isAfter(Ue,nt)?[nt,Ue]:[Ue,nt])},[x,r]),Pe=Zme(b,R,H),Ie=E[ee]||MLt[ee]||cQ,Me=m.useContext(V8),ze=m.useMemo(function(){return en(en({},Me),{},{hideHeader:N})},[Me,N]),Ne="".concat(U,"-panel"),Je=aQ(t,["showWeek","prevIcon","nextIcon","superPrevIcon","superNextIcon","disabledDate","minDate","maxDate","onHover"]);return m.createElement(V8.Provider,{value:ze},m.createElement("div",{ref:W,tabIndex:s,className:Xn(Ne,Jt({},"".concat(Ne,"-rtl"),i==="rtl"))},m.createElement(Ie,go({},Je,{showTime:q,prefixCls:U,locale:V,generateConfig:r,onModeChange:fe,pickerValue:Re,onPickerValueChange:function(nt){ue(nt,!0)},value:me[0],onSelect:ve,values:me,cellRender:Pe,hoverRangeValue:we,hoverValue:w}))))}var hie=m.memo(m.forwardRef(ILt));function zLt(t){var e=t.picker,n=t.multiplePanel,o=t.pickerValue,r=t.onPickerValueChange,i=t.needConfirm,a=t.onSubmit,l=t.range,s=t.hoverValue,c=m.useContext(r5),u=c.prefixCls,d=c.generateConfig,f=m.useCallback(function(C,P){return kD(d,e,C,P)},[d,e]),p=m.useMemo(function(){return f(o,1)},[o,f]),g=function(P){r(f(P,-1))},A={onCellDblClick:function(){i&&a()}},y=e==="time",S=en(en({},t),{},{hoverValue:null,hoverRangeValue:null,hideHeader:y});return l?S.hoverRangeValue=s:S.hoverValue=s,n?m.createElement("div",{className:"".concat(u,"-panels")},m.createElement(V8.Provider,{value:en(en({},A),{},{hideNext:!0})},m.createElement(hie,S)),m.createElement(V8.Provider,{value:en(en({},A),{},{hidePrev:!0})},m.createElement(hie,go({},S,{pickerValue:p,onPickerValueChange:g})))):m.createElement(V8.Provider,{value:en({},A)},m.createElement(hie,S))}function lxe(t){return typeof t=="function"?t():t}function DLt(t){var e=t.prefixCls,n=t.presets,o=t.onClick,r=t.onHover;return n.length?m.createElement("div",{className:"".concat(e,"-presets")},m.createElement("ul",null,n.map(function(i,a){var l=i.label,s=i.value;return m.createElement("li",{key:a,onClick:function(){o(lxe(s))},onMouseEnter:function(){r(lxe(s))},onMouseLeave:function(){r(null)}},l)}))):null}function tJe(t){var e=t.panelRender,n=t.internalMode,o=t.picker,r=t.showNow,i=t.range,a=t.multiple,l=t.activeOffset,s=l===void 0?0:l,c=t.presets,u=t.onPresetHover,d=t.onPresetSubmit,f=t.onFocus,p=t.onBlur,g=t.direction,A=t.value,y=t.onSelect,S=t.isInvalid,C=t.defaultOpenValue,P=t.onOk,v=t.onSubmit,T=m.useContext(r5),w=T.prefixCls,x="".concat(w,"-panel"),b=g==="rtl",R=m.useRef(null),H=m.useRef(null),F=m.useState(0),E=sn(F,2),N=E[0],U=E[1],W=m.useState(0),k=sn(W,2),D=k[0],L=k[1],j=function(de){de.offsetWidth&&U(de.offsetWidth)};m.useEffect(function(){if(i){var oe,de=((oe=R.current)===null||oe===void 0?void 0:oe.offsetWidth)||0,he=N-de;s<=he?L(0):L(s+de-N)}},[N,s,i]);function B(oe){return oe.filter(function(de){return de})}var O=m.useMemo(function(){return B(Ob(A))},[A]),V=o==="time"&&!O.length,G=m.useMemo(function(){return V?B([C]):O},[V,O,C]),q=V?C:O,$=m.useMemo(function(){return G.length?G.some(function(oe){return S(oe)}):!0},[G,S]),ie=function(){V&&y(C),P(),v()},Q=m.createElement("div",{className:"".concat(w,"-panel-layout")},m.createElement(DLt,{prefixCls:w,presets:c,onClick:d,onHover:u}),m.createElement("div",null,m.createElement(zLt,go({},t,{value:q})),m.createElement(ALt,go({},t,{showNow:a?!1:r,invalid:$,onSubmit:ie}))));e&&(Q=e(Q));var se="".concat(x,"-container"),Z="marginLeft",ee="marginRight",te=m.createElement("div",{tabIndex:-1,className:Xn(se,"".concat(w,"-").concat(n,"-panel-container")),style:Jt(Jt({},b?ee:Z,D),b?Z:ee,"auto"),onFocus:f,onBlur:p},Q);return i&&(te=m.createElement("div",{ref:H,className:Xn("".concat(w,"-range-wrapper"),"".concat(w,"-").concat(o,"-range-wrapper"))},m.createElement("div",{ref:R,className:"".concat(w,"-range-arrow"),style:Jt({},b?"right":"left",s)}),m.createElement(Cd,{onResize:j},te))),te}function nJe(t,e){var n=t.format,o=t.maskFormat,r=t.generateConfig,i=t.locale,a=t.preserveInvalidOnBlur,l=t.inputReadOnly,s=t.required,c=t["aria-required"],u=t.onSubmit,d=t.onFocus,f=t.onBlur,p=t.onInputChange,g=t.onInvalid,A=t.open,y=t.onOpenChange,S=t.onKeyDown,C=t.onChange,P=t.activeHelp,v=t.name,T=t.autoComplete,w=t.id,x=t.value,b=t.invalid,R=t.placeholder,H=t.disabled,F=t.activeIndex,E=t.allHelp,N=t.picker,U=function(V,G){var q=r.locale.parse(i.locale,V,[G]);return q&&r.isValidate(q)?q:null},W=n[0],k=m.useCallback(function(O){return Lu(O,{locale:i,format:W,generateConfig:r})},[i,r,W]),D=m.useMemo(function(){return x.map(k)},[x,k]),L=m.useMemo(function(){var O=N==="time"?8:10,V=typeof W=="function"?W(r.getNow()).length:W.length;return Math.max(O,V)+2},[W,N,r]),j=function(V){for(var G=0;G=l&&n<=s)return i;var c=Math.min(Math.abs(n-l),Math.abs(n-s));c0?Qe:lt));var wt=$e+Ye,vt=lt-Qe+1;return String(Qe+(vt+wt-Qe)%vt)};switch(nt){case"Backspace":case"Delete":We="",Ee=Oe;break;case"ArrowLeft":We="",st(-1);break;case"ArrowRight":We="",st(1);break;case"ArrowUp":We="",Ee=je(1);break;case"ArrowDown":We="",Ee=je(-1);break;default:isNaN(Number(nt))||(We=O+nt,Ee=We);break}if(We!==null&&(V(We),We.length>=ke&&(st(1),V(""))),Ee!==null){var xt=te.slice(0,le)+Qme(Ee,ke)+te.slice(Te);Se(xt.slice(0,a.length))}ee({})},ze=m.useRef();_a(function(){if(!(!N||!a||Ae.current)){if(!he.match(te)){Se(a);return}return de.current.setSelectionRange(le,Te),ze.current=Ea(function(){de.current.setSelectionRange(le,Te)}),function(){Ea.cancel(ze.current)}}},[he,a,N,te,$,le,Te,Z,Se]);var Ne=a?{onFocus:ve,onBlur:Pe,onKeyDown:Me,onMouseDown:ue,onMouseUp:fe,onPaste:De}:{};return m.createElement("div",{ref:oe,className:Xn(H,Jt(Jt({},"".concat(H,"-active"),n&&r),"".concat(H,"-placeholder"),c))},m.createElement(R,go({ref:de,"aria-invalid":A,autoComplete:"off"},S,{onKeyDown:Ie,onBlur:we},Ne,{value:te,onChange:Re})),m.createElement(uQ,{type:"suffix",icon:i}),y)}),ULt=["id","clearIcon","suffixIcon","separator","activeIndex","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","value","onChange","onSubmit","onInputChange","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onActiveOffset","onMouseDown","required","aria-required","autoFocus"],jLt=["index"];function BLt(t,e){var n=t.id,o=t.clearIcon,r=t.suffixIcon,i=t.separator,a=i===void 0?"~":i,l=t.activeIndex;t.activeHelp,t.allHelp;var s=t.focused;t.onFocus,t.onBlur,t.onKeyDown,t.locale,t.generateConfig;var c=t.placeholder,u=t.className,d=t.style,f=t.onClick,p=t.onClear,g=t.value;t.onChange,t.onSubmit,t.onInputChange,t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var A=t.disabled,y=t.invalid;t.inputReadOnly;var S=t.direction;t.onOpenChange;var C=t.onActiveOffset,P=t.onMouseDown;t.required,t["aria-required"];var v=t.autoFocus,T=oi(t,ULt),w=S==="rtl",x=m.useContext(r5),b=x.prefixCls,R=m.useMemo(function(){if(typeof n=="string")return[n];var se=n||{};return[se.start,se.end]},[n]),H=m.useRef(),F=m.useRef(),E=m.useRef(),N=function(Z){var ee;return(ee=[F,E][Z])===null||ee===void 0?void 0:ee.current};m.useImperativeHandle(e,function(){return{nativeElement:H.current,focus:function(Z){if(hi(Z)==="object"){var ee,te=Z||{},oe=te.index,de=oe===void 0?0:oe,he=oi(te,jLt);(ee=N(de))===null||ee===void 0||ee.focus(he)}else{var pe;(pe=N(Z??0))===null||pe===void 0||pe.focus()}},blur:function(){var Z,ee;(Z=N(0))===null||Z===void 0||Z.blur(),(ee=N(1))===null||ee===void 0||ee.blur()}}});var U=oJe(T),W=m.useMemo(function(){return Array.isArray(c)?c:[c,c]},[c]),k=nJe(en(en({},t),{},{id:R,placeholder:W})),D=sn(k,1),L=D[0],j=w?"right":"left",B=m.useState(Jt({position:"absolute",width:0},j,0)),O=sn(B,2),V=O[0],G=O[1],q=za(function(){var se=N(l);if(se){var Z=se.nativeElement,ee=Z.offsetWidth,te=Z.offsetLeft,oe=Z.offsetParent,de=te;if(w){var he=oe,pe=getComputedStyle(he);de=he.offsetWidth-parseFloat(pe.borderRightWidth)-parseFloat(pe.borderLeftWidth)-te-ee}G(function(me){return en(en({},me),{},Jt({width:ee},j,de))}),C(l===0?0:de)}});m.useEffect(function(){q()},[l]);var $=o&&(g[0]&&!A[0]||g[1]&&!A[1]),ie=v&&!A[0],Q=v&&!ie&&!A[1];return m.createElement(Cd,{onResize:q},m.createElement("div",go({},U,{className:Xn(b,"".concat(b,"-range"),Jt(Jt(Jt(Jt({},"".concat(b,"-focused"),s),"".concat(b,"-disabled"),A.every(function(se){return se})),"".concat(b,"-invalid"),y.some(function(se){return se})),"".concat(b,"-rtl"),w),u),style:d,ref:H,onClick:f,onMouseDown:function(Z){var ee=Z.target;ee!==F.current.inputElement&&ee!==E.current.inputElement&&Z.preventDefault(),P==null||P(Z)}}),m.createElement(hue,go({ref:F},L(0),{autoFocus:ie,"date-range":"start"})),m.createElement("div",{className:"".concat(b,"-range-separator")},a),m.createElement(hue,go({ref:E},L(1),{autoFocus:Q,"date-range":"end"})),m.createElement("div",{className:"".concat(b,"-active-bar"),style:V}),m.createElement(uQ,{type:"suffix",icon:r}),$&&m.createElement(fue,{icon:o,onClear:p})))}var YLt=m.forwardRef(BLt);function cxe(t,e){var n=t??e;return Array.isArray(n)?n:[n,n]}function NY(t){return t===1?"end":"start"}function OLt(t,e){var n=BXe(t,function(){var to=t.disabled,Bn=t.allowEmpty,Ko=cxe(to,!1),So=cxe(Bn,!1);return{disabled:Ko,allowEmpty:So}}),o=sn(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r.prefixCls,d=r.styles,f=r.classNames,p=r.defaultValue,g=r.value,A=r.needConfirm,y=r.onKeyDown,S=r.disabled,C=r.allowEmpty,P=r.disabledDate,v=r.minDate,T=r.maxDate,w=r.defaultOpen,x=r.open,b=r.onOpenChange,R=r.locale,H=r.generateConfig,F=r.picker,E=r.showNow,N=r.showToday,U=r.showTime,W=r.mode,k=r.onPanelChange,D=r.onCalendarChange,L=r.onOk,j=r.defaultPickerValue,B=r.pickerValue,O=r.onPickerValueChange,V=r.inputReadOnly,G=r.suffixIcon,q=r.onFocus,$=r.onBlur,ie=r.presets,Q=r.ranges,se=r.components,Z=r.cellRender,ee=r.dateRender,te=r.monthCellRender,oe=r.onClick,de=OXe(e),he=YXe(x,w,S,b),pe=sn(he,2),me=pe[0],le=pe[1],Te=function(Bn,Ko){(S.some(function(So){return!So})||!Bn)&&le(Bn,Ko)},ge=qXe(H,R,l,!0,!1,p,g,D,L),Se=sn(ge,5),Re=Se[0],De=Se[1],Ae=Se[2],ue=Se[3],fe=Se[4],ve=Ae(),we=_Xe(S,C),Pe=sn(we,7),Ie=Pe[0],Me=Pe[1],ze=Pe[2],Ne=Pe[3],Je=Pe[4],Ue=Pe[5],nt=Pe[6],We=function(Bn,Ko){Me(!0),q==null||q(Bn,{range:NY(Ko??Ne)})},Ee=function(Bn,Ko){Me(!1),$==null||$(Bn,{range:NY(Ko??Ne)})},ke=m.useMemo(function(){if(!U)return null;var to=U.disabledTime,Bn=to?function(Ko){var So=NY(Ne),Qo=IXe(ve,nt,Ne);return to(Ko,So,{from:Qo})}:void 0;return en(en({},U),{},{disabledTime:Bn})},[U,Ne,ve,nt]),Oe=Es([F,F],{value:W}),st=sn(Oe,2),je=st[0],xt=st[1],gt=je[Ne]||F,Ye=gt==="date"&&ke?"datetime":gt,it=Ye===F&&Ye!=="time",ut=QXe(F,gt,E,N,!0),Qe=$Xe(r,Re,De,Ae,ue,S,l,Ie,me,c),lt=sn(Qe,2),Ze=lt[0],Be=lt[1],$e=pLt(ve,S,nt,H,R,P),wt=DXe(ve,c,C),vt=sn(wt,2),Rt=vt[0],Gt=vt[1],At=GXe(H,R,ve,je,me,Ne,i,it,j,B,ke==null?void 0:ke.defaultOpenValue,O,v,T),pt=sn(At,2),Wt=pt[0],ht=pt[1],ct=za(function(to,Bn,Ko){var So=RE(je,Ne,Bn);if((So[0]!==je[0]||So[1]!==je[1])&&xt(So),k&&Ko!==!1){var Qo=No(ve);to&&(Qo[Ne]=to),k(Qo,So)}}),It=function(Bn,Ko){return RE(ve,Ko,Bn)},Ft=function(Bn,Ko){var So=ve;Bn&&(So=It(Bn,Ne));var Qo=Ue(So);ue(So),Ze(Ne,Qo===null),Qo===null?Te(!1,{force:!0}):Ko||de.current.focus({index:Qo})},Ve=function(Bn){if(!de.current.nativeElement.contains(document.activeElement)){var Ko=S.findIndex(function(So){return!So});Ko>=0&&de.current.focus({index:Ko})}Te(!0),oe==null||oe(Bn)},ft=function(){Be(null),Te(!1,{force:!0})},kt=m.useState(null),rt=sn(kt,2),at=rt[0],Ge=rt[1],yt=m.useState(null),Pt=sn(yt,2),ot=Pt[0],bt=Pt[1],zt=m.useMemo(function(){return ot||ve},[ve,ot]);m.useEffect(function(){me||bt(null)},[me]);var Bt=m.useState(0),tt=sn(Bt,2),Ht=tt[0],_t=tt[1],qt=VXe(ie,Q),un=function(Bn){bt(Bn),Ge("preset")},Rn=function(Bn){var Ko=Be(Bn);Ko&&Te(!1,{force:!0})},yo=function(Bn){Ft(Bn)},Ao=function(Bn){bt(Bn?It(Bn,Ne):null),Ge("cell")},wo=function(Bn){Te(!0),We(Bn)},Io=function(Bn){ze("panel");var Ko=RE(ve,Ne,Bn);ue(Ko),!A&&!a&&i===Ye&&Ft(Bn)},po=function(){Te(!1)},On=Zme(Z,ee,te,NY(Ne)),fo=ve[Ne]||null,ir=za(function(to){return c(to,{activeIndex:Ne})}),Rr=m.useMemo(function(){var to=bf(r,!1),Bn=OH(r,[].concat(No(Object.keys(to)),["onChange","onCalendarChange","style","className","onPanelChange","disabledTime"]));return Bn},[r]),br=m.createElement(tJe,go({},Rr,{showNow:ut,showTime:ke,range:!0,multiplePanel:it,activeOffset:Ht,disabledDate:$e,onFocus:wo,onBlur:Ee,picker:F,mode:gt,internalMode:Ye,onPanelChange:ct,format:s,value:fo,isInvalid:ir,onChange:null,onSelect:Io,pickerValue:Wt,defaultOpenValue:Ob(U==null?void 0:U.defaultOpenValue)[Ne],onPickerValueChange:ht,hoverValue:zt,onHover:Ao,needConfirm:A,onSubmit:Ft,onOk:fe,presets:qt,onPresetHover:un,onPresetSubmit:Rn,onNow:yo,cellRender:On})),_r=function(Bn,Ko){var So=It(Bn,Ko);ue(So)},jo=function(){ze("input")},wn=function(Bn,Ko){ze("input"),Te(!0,{inherit:!0}),Je(Ko),We(Bn,Ko)},In=function(Bn,Ko){Te(!1),Ee(Bn,Ko)},ar=function(Bn,Ko){Bn.key==="Tab"&&Ft(null,!0),y==null||y(Bn,Ko)},Wo=m.useMemo(function(){return{prefixCls:u,locale:R,generateConfig:H,button:se.button,input:se.input}},[u,R,H,se.button,se.input]);return _a(function(){me&&Ne!==void 0&&ct(null,F,!1)},[me,Ne,F]),_a(function(){var to=ze();!me&&to==="input"&&(Te(!1),Ft(null,!0)),!me&&a&&!A&&to==="panel"&&(Te(!0),Ft())},[me]),m.createElement(r5.Provider,{value:Wo},m.createElement(HXe,go({},zXe(r),{popupElement:br,popupStyle:d.popup,popupClassName:f.popup,visible:me,onClose:po,range:!0}),m.createElement(YLt,go({},r,{ref:de,suffixIcon:G,activeIndex:Ie||me?Ne:null,activeHelp:!!ot,allHelp:!!ot&&at==="preset",focused:Ie,onFocus:wn,onBlur:In,onKeyDown:ar,onSubmit:Ft,value:zt,maskFormat:s,onChange:_r,onInputChange:jo,format:l,inputReadOnly:V,disabled:S,open:me,onOpenChange:Te,onClick:Ve,onClear:ft,invalid:Rt,onInvalid:Gt,onActiveOffset:_t}))))}var VLt=m.forwardRef(OLt);function _Lt(t){var e=t.prefixCls,n=t.value,o=t.onRemove,r=t.removeIcon,i=r===void 0?"×":r,a=t.formatDate,l=t.disabled,s=t.maxTagCount,c=t.placeholder,u="".concat(e,"-selector"),d="".concat(e,"-selection"),f="".concat(d,"-overflow");function p(y,S){return m.createElement("span",{className:Xn("".concat(d,"-item")),title:typeof y=="string"?y:null},m.createElement("span",{className:"".concat(d,"-item-content")},y),!l&&S&&m.createElement("span",{onMouseDown:function(P){P.preventDefault()},onClick:S,className:"".concat(d,"-item-remove")},i))}function g(y){var S=a(y),C=function(v){v&&v.stopPropagation(),o(y)};return p(S,C)}function A(y){var S="+ ".concat(y.length," ...");return p(S)}return m.createElement("div",{className:u},m.createElement(F2,{prefixCls:f,data:n,renderItem:g,renderRest:A,itemKey:function(S){return a(S)},maxCount:s}),!n.length&&m.createElement("span",{className:"".concat(e,"-selection-placeholder")},c))}var GLt=["id","open","clearIcon","suffixIcon","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","internalPicker","value","onChange","onSubmit","onInputChange","multiple","maxTagCount","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onMouseDown","required","aria-required","autoFocus","removeIcon"];function XLt(t,e){t.id;var n=t.open,o=t.clearIcon,r=t.suffixIcon;t.activeHelp,t.allHelp;var i=t.focused;t.onFocus,t.onBlur,t.onKeyDown;var a=t.locale,l=t.generateConfig,s=t.placeholder,c=t.className,u=t.style,d=t.onClick,f=t.onClear,p=t.internalPicker,g=t.value,A=t.onChange,y=t.onSubmit;t.onInputChange;var S=t.multiple,C=t.maxTagCount;t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var P=t.disabled,v=t.invalid;t.inputReadOnly;var T=t.direction;t.onOpenChange;var w=t.onMouseDown;t.required,t["aria-required"];var x=t.autoFocus,b=t.removeIcon,R=oi(t,GLt),H=T==="rtl",F=m.useContext(r5),E=F.prefixCls,N=m.useRef(),U=m.useRef();m.useImperativeHandle(e,function(){return{nativeElement:N.current,focus:function($){var ie;(ie=U.current)===null||ie===void 0||ie.focus($)},blur:function(){var $;($=U.current)===null||$===void 0||$.blur()}}});var W=oJe(R),k=function($){A([$])},D=function($){var ie=g.filter(function(Q){return Q&&!dh(l,a,Q,$,p)});A(ie),n||y()},L=nJe(en(en({},t),{},{onChange:k}),function(q){var $=q.valueTexts;return{value:$[0]||"",active:i}}),j=sn(L,2),B=j[0],O=j[1],V=!!(o&&g.length&&!P),G=S?m.createElement(m.Fragment,null,m.createElement(_Lt,{prefixCls:E,value:g,onRemove:D,formatDate:O,maxTagCount:C,disabled:P,removeIcon:b,placeholder:s}),m.createElement("input",{className:"".concat(E,"-multiple-input"),value:g.map(O).join(","),ref:U,readOnly:!0,autoFocus:x}),m.createElement(uQ,{type:"suffix",icon:r}),V&&m.createElement(fue,{icon:o,onClear:f})):m.createElement(hue,go({ref:U},B(),{autoFocus:x,suffixIcon:r,clearIcon:V&&m.createElement(fue,{icon:o,onClear:f}),showActiveCls:!1}));return m.createElement("div",go({},W,{className:Xn(E,Jt(Jt(Jt(Jt(Jt({},"".concat(E,"-multiple"),S),"".concat(E,"-focused"),i),"".concat(E,"-disabled"),P),"".concat(E,"-invalid"),v),"".concat(E,"-rtl"),H),c),style:u,ref:N,onClick:d,onMouseDown:function($){var ie,Q=$.target;Q!==((ie=U.current)===null||ie===void 0?void 0:ie.inputElement)&&$.preventDefault(),w==null||w($)}}),G)}var JLt=m.forwardRef(XLt);function KLt(t,e){var n=BXe(t),o=sn(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r,d=u.prefixCls,f=u.styles,p=u.classNames,g=u.order,A=u.defaultValue,y=u.value,S=u.needConfirm,C=u.onChange,P=u.onKeyDown,v=u.disabled,T=u.disabledDate,w=u.minDate,x=u.maxDate,b=u.defaultOpen,R=u.open,H=u.onOpenChange,F=u.locale,E=u.generateConfig,N=u.picker,U=u.showNow,W=u.showToday,k=u.showTime,D=u.mode,L=u.onPanelChange,j=u.onCalendarChange,B=u.onOk,O=u.multiple,V=u.defaultPickerValue,G=u.pickerValue,q=u.onPickerValueChange,$=u.inputReadOnly,ie=u.suffixIcon,Q=u.removeIcon,se=u.onFocus,Z=u.onBlur,ee=u.presets,te=u.components,oe=u.cellRender,de=u.dateRender,he=u.monthCellRender,pe=u.onClick,me=OXe(e);function le(jo){return jo===null?null:O?jo:jo[0]}var Te=ZXe(E,F,i),ge=YXe(R,b,[v],H),Se=sn(ge,2),Re=Se[0],De=Se[1],Ae=function(wn,In,ar){if(j){var Wo=en({},ar);delete Wo.range,j(le(wn),le(In),Wo)}},ue=function(wn){B==null||B(le(wn))},fe=qXe(E,F,l,!1,g,A,y,Ae,ue),ve=sn(fe,5),we=ve[0],Pe=ve[1],Ie=ve[2],Me=ve[3],ze=ve[4],Ne=Ie(),Je=_Xe([v]),Ue=sn(Je,4),nt=Ue[0],We=Ue[1],Ee=Ue[2],ke=Ue[3],Oe=function(wn){We(!0),se==null||se(wn,{})},st=function(wn){We(!1),Z==null||Z(wn,{})},je=Es(N,{value:D}),xt=sn(je,2),gt=xt[0],Ye=xt[1],it=gt==="date"&&k?"datetime":gt,ut=QXe(N,gt,U,W),Qe=C&&function(jo,wn){C(le(jo),le(wn))},lt=$Xe(en(en({},r),{},{onChange:Qe}),we,Pe,Ie,Me,[],l,nt,Re,c),Ze=sn(lt,2),Be=Ze[1],$e=DXe(Ne,c),wt=sn($e,2),vt=wt[0],Rt=wt[1],Gt=m.useMemo(function(){return vt.some(function(jo){return jo})},[vt]),At=function(wn,In){if(q){var ar=en(en({},In),{},{mode:In.mode[0]});delete ar.range,q(wn[0],ar)}},pt=GXe(E,F,Ne,[gt],Re,ke,i,!1,V,G,Ob(k==null?void 0:k.defaultOpenValue),At,w,x),Wt=sn(pt,2),ht=Wt[0],ct=Wt[1],It=za(function(jo,wn,In){if(Ye(wn),L&&In!==!1){var ar=jo||Ne[Ne.length-1];L(ar,wn)}}),Ft=function(){Be(Ie()),De(!1,{force:!0})},Ve=function(wn){!v&&!me.current.nativeElement.contains(document.activeElement)&&me.current.focus(),De(!0),pe==null||pe(wn)},ft=function(){Be(null),De(!1,{force:!0})},kt=m.useState(null),rt=sn(kt,2),at=rt[0],Ge=rt[1],yt=m.useState(null),Pt=sn(yt,2),ot=Pt[0],bt=Pt[1],zt=m.useMemo(function(){var jo=[ot].concat(No(Ne)).filter(function(wn){return wn});return O?jo:jo.slice(0,1)},[Ne,ot,O]),Bt=m.useMemo(function(){return!O&&ot?[ot]:Ne.filter(function(jo){return jo})},[Ne,ot,O]);m.useEffect(function(){Re||bt(null)},[Re]);var tt=VXe(ee),Ht=function(wn){bt(wn),Ge("preset")},_t=function(wn){var In=O?Te(Ie(),wn):[wn],ar=Be(In);ar&&!O&&De(!1,{force:!0})},qt=function(wn){_t(wn)},un=function(wn){bt(wn),Ge("cell")},Rn=function(wn){De(!0),Oe(wn)},yo=function(wn){Ee("panel");var In=O?Te(Ie(),wn):[wn];Me(In),!S&&!a&&i===it&&Ft()},Ao=function(){De(!1)},wo=Zme(oe,de,he),Io=m.useMemo(function(){var jo=bf(r,!1),wn=OH(r,[].concat(No(Object.keys(jo)),["onChange","onCalendarChange","style","className","onPanelChange"]));return en(en({},wn),{},{multiple:r.multiple})},[r]),po=m.createElement(tJe,go({},Io,{showNow:ut,showTime:k,disabledDate:T,onFocus:Rn,onBlur:st,picker:N,mode:gt,internalMode:it,onPanelChange:It,format:s,value:Ne,isInvalid:c,onChange:null,onSelect:yo,pickerValue:ht,defaultOpenValue:k==null?void 0:k.defaultOpenValue,onPickerValueChange:ct,hoverValue:zt,onHover:un,needConfirm:S,onSubmit:Ft,onOk:ze,presets:tt,onPresetHover:Ht,onPresetSubmit:_t,onNow:qt,cellRender:wo})),On=function(wn){Me(wn)},fo=function(){Ee("input")},ir=function(wn){Ee("input"),De(!0,{inherit:!0}),Oe(wn)},Rr=function(wn){De(!1),st(wn)},br=function(wn,In){wn.key==="Tab"&&Ft(),P==null||P(wn,In)},_r=m.useMemo(function(){return{prefixCls:d,locale:F,generateConfig:E,button:te.button,input:te.input}},[d,F,E,te.button,te.input]);return _a(function(){Re&&ke!==void 0&&It(null,N,!1)},[Re,ke,N]),_a(function(){var jo=Ee();!Re&&jo==="input"&&(De(!1),Ft()),!Re&&a&&!S&&jo==="panel"&&(De(!0),Ft())},[Re]),m.createElement(r5.Provider,{value:_r},m.createElement(HXe,go({},zXe(r),{popupElement:po,popupStyle:f.popup,popupClassName:p.popup,visible:Re,onClose:Ao}),m.createElement(JLt,go({},r,{ref:me,suffixIcon:ie,removeIcon:Q,activeHelp:!!ot,allHelp:!!ot&&at==="preset",focused:nt,onFocus:ir,onBlur:Rr,onKeyDown:br,onSubmit:Ft,value:Bt,maskFormat:s,onChange:On,onInputChange:fo,internalPicker:i,format:l,inputReadOnly:$,disabled:v,open:Re,onOpenChange:De,onClick:Ve,onClear:ft,invalid:Gt,onInvalid:function(wn){Rt(wn,0)}}))))}var qLt=m.forwardRef(KLt);const rJe=m.createContext(null),$Lt=rJe.Provider,iJe=m.createContext(null),QLt=iJe.Provider;var ZLt=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],aJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-checkbox":n,r=t.className,i=t.style,a=t.checked,l=t.disabled,s=t.defaultChecked,c=s===void 0?!1:s,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,g=oi(t,ZLt),A=m.useRef(null),y=Es(c,{value:a}),S=sn(y,2),C=S[0],P=S[1];m.useImperativeHandle(e,function(){return{focus:function(x){var b;(b=A.current)===null||b===void 0||b.focus(x)},blur:function(){var x;(x=A.current)===null||x===void 0||x.blur()},input:A.current}});var v=Xn(o,r,Jt(Jt({},"".concat(o,"-checked"),C),"".concat(o,"-disabled"),l)),T=function(x){l||("checked"in t||P(x.target.checked),p==null||p({target:en(en({},t),{},{type:d,checked:x.target.checked}),stopPropagation:function(){x.stopPropagation()},preventDefault:function(){x.preventDefault()},nativeEvent:x.nativeEvent}))};return m.createElement("span",{className:v,title:f,style:i},m.createElement("input",go({},g,{className:"".concat(o,"-input"),ref:A,onChange:T,disabled:l,checked:!!C,type:d})),m.createElement("span",{className:"".concat(o,"-inner")}))});const eWt=t=>{const{componentCls:e,antCls:n}=t,o=`${e}-group`;return{[o]:Object.assign(Object.assign({},Na(t)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},tWt=t=>{const{componentCls:e,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:i,motionDurationMid:a,motionEaseInOutCirc:l,colorBgContainer:s,colorBorder:c,lineWidth:u,colorBgContainerDisabled:d,colorTextDisabled:f,paddingXS:p,dotColorDisabled:g,lineType:A,radioColor:y,radioBgColor:S,calc:C}=t,P=`${e}-inner`,T=C(r).sub(C(4).mul(2)),w=C(1).mul(r).equal();return{[`${e}-wrapper`]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer",[`&${e}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:t.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${e}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${jt(u)} ${A} ${o}`,borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${e}-wrapper:hover &, + &${a}-slide-up-leave${a}-slide-up-leave-active${e}-placement-topRight`]:{animationName:G$}})},Ome(t,A,{arrowPlacement:{top:!0,bottom:!0}}),{[`${e} ${n}`]:{position:"relative",margin:0},[`${n}-submenu-popup`]:{position:"absolute",zIndex:o,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},[`${e}, ${e}-menu-submenu`]:{[n]:Object.assign(Object.assign({padding:d,listStyleType:"none",backgroundColor:A,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary},eA(t)),{"&:empty":{padding:0,boxShadow:"none"},[`${n}-item-group-title`]:{padding:`${jt(c)} ${jt(g)}`,color:t.colorTextDescription,transition:`all ${s}`},[`${n}-item`]:{position:"relative",display:"flex",alignItems:"center"},[`${n}-item-icon`]:{minWidth:u,marginInlineEnd:t.marginXS,fontSize:t.fontSizeSM},[`${n}-title-content`]:{flex:"auto","> a":{color:"inherit",transition:`all ${s}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}}},[`${n}-item, ${n}-submenu-title`]:Object.assign(Object.assign({clear:"both",margin:0,padding:`${jt(c)} ${jt(g)}`,color:t.colorText,fontWeight:"normal",fontSize:u,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${s}`,borderRadius:t.borderRadiusSM,"&:hover, &-active":{backgroundColor:t.controlItemBgHover}},eA(t)),{"&-selected":{color:t.colorPrimary,backgroundColor:t.controlItemBgActive,"&:hover, &-active":{backgroundColor:t.controlItemBgActiveHover}},"&-disabled":{color:f,cursor:"not-allowed","&:hover":{color:f,backgroundColor:A,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${jt(t.marginXXS)} 0`,overflow:"hidden",lineHeight:0,backgroundColor:t.colorSplit},[`${e}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:t.paddingXS,[`${e}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:t.colorTextDescription,fontSize:p,fontStyle:"normal"}}}),[`${n}-item-group-list`]:{margin:`0 ${jt(t.marginXS)}`,padding:0,listStyle:"none"},[`${n}-submenu-title`]:{paddingInlineEnd:t.calc(g).add(t.fontSizeSM).equal()},[`${n}-submenu-vertical`]:{position:"relative"},[`${n}-submenu${n}-submenu-disabled ${e}-menu-submenu-title`]:{[`&, ${e}-menu-submenu-arrow-icon`]:{color:f,backgroundColor:A,cursor:"not-allowed"}},[`${n}-submenu-selected ${e}-menu-submenu-title`]:{color:t.colorPrimary}})}},[V9(t,"slide-up"),V9(t,"slide-down"),xR(t,"move-up"),xR(t,"move-down"),_W(t,"zoom-big")]]},Lkt=t=>Object.assign(Object.assign({zIndexPopup:t.zIndexPopupBase+50,paddingBlock:(t.controlHeight-t.fontSize*t.lineHeight)/2},eQ({contentRadius:t.borderRadiusLG,limitVerticalRadius:!0})),Z$(t)),Wkt=wl("Dropdown",t=>{const{marginXXS:e,sizePopupArrow:n,paddingXXS:o,componentCls:r}=t,i=qi(t,{menuCls:`${r}-menu`,dropdownArrowDistance:t.calc(n).div(2).add(e).equal(),dropdownEdgeChildPadding:o});return[kkt(i),Fkt(i)]},Lkt),iQ=t=>{const{menu:e,arrow:n,prefixCls:o,children:r,trigger:i,disabled:a,dropdownRender:l,getPopupContainer:s,overlayClassName:c,rootClassName:u,overlayStyle:d,open:f,onOpenChange:p,visible:g,onVisibleChange:A,mouseEnterDelay:y=.15,mouseLeaveDelay:S=.1,autoAdjustOverflow:C=!0,placement:P="",overlay:v,transitionName:T}=t,{getPopupContainer:w,getPrefixCls:x,direction:b,dropdown:R}=m.useContext(Cr);Bb();const H=m.useMemo(()=>{const ee=x();return T!==void 0?T:P.includes("top")?`${ee}-slide-down`:`${ee}-slide-up`},[x,P,T]),F=m.useMemo(()=>P?P.includes("Center")?P.slice(0,P.indexOf("Center")):P:b==="rtl"?"bottomRight":"bottomLeft",[P,b]),E=x("dropdown",o),N=Y0(E),[U,W,k]=Wkt(E,N),[,D]=Vu(),L=m.Children.only(r),j=j0(L,{className:Un(`${E}-trigger`,{[`${E}-rtl`]:b==="rtl"},L.props.className),disabled:a}),B=a?[]:i;let O;B&&B.includes("contextMenu")&&(O=!0);const[V,G]=Z6(!1,{value:f??g}),q=Q6(ee=>{p==null||p(ee,{source:"trigger"}),A==null||A(ee),G(ee)}),$=Un(c,u,W,k,N,R==null?void 0:R.className,{[`${E}-rtl`]:b==="rtl"}),ie=$Ge({arrowPointAtCenter:typeof n=="object"&&n.pointAtCenter,autoAdjustOverflow:C,offset:D.marginXXS,arrowWidth:n?D.sizePopupArrow:0,borderRadius:D.borderRadius}),Q=m.useCallback(()=>{e!=null&&e.selectable&&(e!=null&&e.multiple)||(p==null||p(!1,{source:"menu"}),G(!1))},[e==null?void 0:e.selectable,e==null?void 0:e.multiple]),se=()=>{let ee;return e!=null&&e.items?ee=m.createElement(XH,Object.assign({},e)):typeof v=="function"?ee=v():ee=v,l&&(ee=l(ee)),ee=m.Children.only(typeof ee=="string"?m.createElement("span",null,ee):ee),m.createElement(xXe,{prefixCls:`${E}-menu`,rootClassName:Un(k,N),expandIcon:m.createElement("span",{className:`${E}-menu-submenu-arrow`},m.createElement(YG,{className:`${E}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:Q,validator:de=>{}},ee)},[oe,Z]=Bw("Dropdown",d==null?void 0:d.zIndex);let te=m.createElement(iXe,Object.assign({alignPoint:O},dp(t,["rootClassName"]),{mouseEnterDelay:y,mouseLeaveDelay:S,visible:V,builtinPlacements:ie,arrow:!!n,overlayClassName:$,prefixCls:E,getPopupContainer:s||w,transitionName:H,trigger:B,overlay:se,placement:F,onVisibleChange:q,overlayStyle:Object.assign(Object.assign(Object.assign({},R==null?void 0:R.style),d),{zIndex:oe})}),j);return oe&&(te=m.createElement(WW.Provider,{value:Z},te)),U(te)};function Nkt(t){return Object.assign(Object.assign({},t),{align:{overflow:{adjustX:!1,adjustY:!1}}})}const Ukt=XW(iQ,"dropdown",t=>t,Nkt),jkt=t=>m.createElement(Ukt,Object.assign({},t),m.createElement("span",null));iQ._InternalPanelDoNotUseOrYouWillBeFired=jkt;var bXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){o.prototype.weekday=function(r){var i=this.$locale().weekStart||0,a=this.$W,l=(a25){var u=a(this).startOf(o).add(1,o).date(c),d=a(this).endOf(n);if(u.isBefore(d))return 1}var f=a(this).startOf(o).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?a(this).startOf("week").week():Math.ceil(p)},l.weeks=function(s){return s===void 0&&(s=null),this.week(s)}}})})(TXe);var _kt=TXe.exports;const Gkt=Wi(_kt);var PXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){o.prototype.weekYear=function(){var r=this.month(),i=this.week(),a=this.year();return i===1&&r===11?a+1:r===0&&i>=52?a-1:a}}})})(PXe);var Xkt=PXe.exports;const Jkt=Wi(Xkt);var CXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){return function(n,o){var r=o.prototype,i=r.format;r.format=function(a){var l=this,s=this.$locale();if(!this.isValid())return i.bind(this)(a);var c=this.$utils(),u=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(d){switch(d){case"Q":return Math.ceil((l.$M+1)/3);case"Do":return s.ordinal(l.$D);case"gggg":return l.weekYear();case"GGGG":return l.isoWeekYear();case"wo":return s.ordinal(l.week(),"W");case"w":case"ww":return c.s(l.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(l.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(l.$H===0?24:l.$H),d==="k"?1:2,"0");case"X":return Math.floor(l.$d.getTime()/1e3);case"x":return l.$d.getTime();case"z":return"["+l.offsetName()+"]";case"zzz":return"["+l.offsetName("long")+"]";default:return d}});return i.bind(this)(u)}}})})(CXe);var Kkt=CXe.exports;const qkt=Wi(Kkt);var RXe={exports:{}};(function(t,e){(function(n,o){t.exports=o()})(yc,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},o=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},s=function(A){return(A=+A)+(A>68?1900:2e3)},c=function(A){return function(y){this[A]=+y}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(A){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var S=y.match(/([+-]|\d\d)/g),C=60*S[1]+(+S[2]||0);return C===0?0:S[0]==="+"?-C:C}(A)}],d=function(A){var y=l[A];return y&&(y.indexOf?y:y.s.concat(y.f))},f=function(A,y){var S,C=l.meridiem;if(C){for(var P=1;P<=24;P+=1)if(A.indexOf(C(P,0,y))>-1){S=P>12;break}}else S=A===(y?"pm":"PM");return S},p={A:[a,function(A){this.afternoon=f(A,!1)}],a:[a,function(A){this.afternoon=f(A,!0)}],S:[/\d/,function(A){this.milliseconds=100*+A}],SS:[r,function(A){this.milliseconds=10*+A}],SSS:[/\d{3}/,function(A){this.milliseconds=+A}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[r,c("day")],Do:[a,function(A){var y=l.ordinal,S=A.match(/\d+/);if(this.day=S[0],y)for(var C=1;C<=31;C+=1)y(C).replace(/\[|\]/g,"")===A&&(this.day=C)}],M:[i,c("month")],MM:[r,c("month")],MMM:[a,function(A){var y=d("months"),S=(d("monthsShort")||y.map(function(C){return C.slice(0,3)})).indexOf(A)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[a,function(A){var y=d("months").indexOf(A)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,c("year")],YY:[r,function(A){this.year=s(A)}],YYYY:[/\d{4}/,c("year")],Z:u,ZZ:u};function g(A){var y,S;y=A,S=l&&l.formats;for(var C=(A=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(R,H,F){var E=F&&F.toUpperCase();return H||S[F]||n[F]||S[E].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(N,U,W){return U||W.slice(1)})})).match(o),P=C.length,v=0;v-1)return new Date((D==="X"?1e3:1)*k);var j=g(D)(k),B=j.year,O=j.month,V=j.day,G=j.hours,q=j.minutes,$=j.seconds,ie=j.milliseconds,Q=j.zone,se=new Date,oe=V||(B||O?1:se.getDate()),Z=B||se.getFullYear(),te=0;B&&!O||(te=O>0?O-1:se.getMonth());var ee=G||0,de=q||0,fe=$||0,pe=ie||0;return Q?new Date(Date.UTC(Z,te,oe,ee,de,fe,pe+60*Q.offset*1e3)):L?new Date(Date.UTC(Z,te,oe,ee,de,fe,pe)):new Date(Z,te,oe,ee,de,fe,pe)}catch{return new Date("")}}(T,b,w),this.init(),E&&E!==!0&&(this.$L=this.locale(E).$L),F&&T!=this.format(b)&&(this.$d=new Date("")),l={}}else if(b instanceof Array)for(var N=b.length,U=1;U<=N;U+=1){x[1]=b[U-1];var W=S.apply(this,x);if(W.isValid()){this.$d=W.$d,this.$L=W.$L,this.init();break}U===N&&(this.$d=new Date(""))}else P.call(this,v)}}})})(RXe);var $kt=RXe.exports;const Qkt=Wi($kt);ul.extend(Qkt);ul.extend(qkt);ul.extend(Ykt);ul.extend(Vkt);ul.extend(Gkt);ul.extend(Jkt);ul.extend(function(t,e){var n=e.prototype,o=n.format;n.format=function(i){var a=(i||"").replace("Wo","wo");return o.bind(this)(a)}});var Zkt={bn_BD:"bn-bd",by_BY:"be",en_GB:"en-gb",en_US:"en",fr_BE:"fr",fr_CA:"fr-ca",hy_AM:"hy-am",kmr_IQ:"ku",nl_BE:"nl-be",pt_BR:"pt-br",zh_CN:"zh-cn",zh_HK:"zh-hk",zh_TW:"zh-tw"},K7=function(e){var n=Zkt[e];return n||e.split("_")[0]},ixe=function(){kOe(!1,"Not match any format. Please help to fire a issue about this.")},eLt={getNow:function(){return ul()},getFixedDate:function(e){return ul(e,["YYYY-M-DD","YYYY-MM-DD"])},getEndDate:function(e){return e.endOf("month")},getWeekDay:function(e){var n=e.locale("en");return n.weekday()+n.localeData().firstDayOfWeek()},getYear:function(e){return e.year()},getMonth:function(e){return e.month()},getDate:function(e){return e.date()},getHour:function(e){return e.hour()},getMinute:function(e){return e.minute()},getSecond:function(e){return e.second()},getMillisecond:function(e){return e.millisecond()},addYear:function(e,n){return e.add(n,"year")},addMonth:function(e,n){return e.add(n,"month")},addDate:function(e,n){return e.add(n,"day")},setYear:function(e,n){return e.year(n)},setMonth:function(e,n){return e.month(n)},setDate:function(e,n){return e.date(n)},setHour:function(e,n){return e.hour(n)},setMinute:function(e,n){return e.minute(n)},setSecond:function(e,n){return e.second(n)},setMillisecond:function(e,n){return e.millisecond(n)},isAfter:function(e,n){return e.isAfter(n)},isValidate:function(e){return e.isValid()},locale:{getWeekFirstDay:function(e){return ul().locale(K7(e)).localeData().firstDayOfWeek()},getWeekFirstDate:function(e,n){return n.locale(K7(e)).weekday(0)},getWeek:function(e,n){return n.locale(K7(e)).week()},getShortWeekDays:function(e){return ul().locale(K7(e)).localeData().weekdaysMin()},getShortMonths:function(e){return ul().locale(K7(e)).localeData().monthsShort()},format:function(e,n,o){return n.locale(K7(e)).format(o)},parse:function(e,n,o){for(var r=K7(e),i=0;i2&&arguments[2]!==void 0?arguments[2]:"0",o=String(t);o.length2&&arguments[2]!==void 0?arguments[2]:[],o=m.useState([!1,!1]),r=sn(o,2),i=r[0],a=r[1],l=function(u,d){a(function(f){return RE(f,d,u)})},s=m.useMemo(function(){return i.map(function(c,u){if(c)return!0;var d=t[u];return d?!!(!n[u]&&!d||d&&e(d,{activeIndex:u})):!1})},[t,i,e,n]);return[s,l]}function EXe(t,e,n,o,r){var i="",a=[];return t&&a.push(r?"hh":"HH"),e&&a.push("mm"),n&&a.push("ss"),i=a.join(":"),o&&(i+=".SSS"),r&&(i+=" A"),i}function nLt(t,e,n,o,r,i){var a=t.fieldDateTimeFormat,l=t.fieldDateFormat,s=t.fieldTimeFormat,c=t.fieldMonthFormat,u=t.fieldYearFormat,d=t.fieldWeekFormat,f=t.fieldQuarterFormat,p=t.yearFormat,g=t.cellYearFormat,A=t.cellQuarterFormat,y=t.dayFormat,S=t.cellDateFormat,C=EXe(e,n,o,r,i);return en(en({},t),{},{fieldDateTimeFormat:a||"YYYY-MM-DD ".concat(C),fieldDateFormat:l||"YYYY-MM-DD",fieldTimeFormat:s||C,fieldMonthFormat:c||"YYYY-MM",fieldYearFormat:u||"YYYY",fieldWeekFormat:d||"gggg-wo",fieldQuarterFormat:f||"YYYY-[Q]Q",yearFormat:p||"YYYY",cellYearFormat:g||"YYYY",cellQuarterFormat:A||"[Q]Q",cellDateFormat:S||y||"D"})}function FXe(t,e){var n=e.showHour,o=e.showMinute,r=e.showSecond,i=e.showMillisecond,a=e.use12Hours;return be.useMemo(function(){return nLt(t,n,o,r,i,a)},[t,n,o,r,i,a])}function Uz(t,e,n){return n??e.some(function(o){return t.includes(o)})}var oLt=["showNow","showHour","showMinute","showSecond","showMillisecond","use12Hours","hourStep","minuteStep","secondStep","millisecondStep","hideDisabledOptions","defaultValue","disabledHours","disabledMinutes","disabledSeconds","disabledMilliseconds","disabledTime","changeOnScroll","defaultOpenValue"];function rLt(t){var e=aQ(t,oLt),n=t.format,o=t.picker,r=null;return n&&(r=n,Array.isArray(r)&&(r=r[0]),r=hi(r)==="object"?r.format:r),o==="time"&&(e.format=r),[e,r]}function iLt(t){return t&&typeof t=="string"}function kXe(t,e,n,o){return[t,e,n,o].some(function(r){return r!==void 0})}function LXe(t,e,n,o,r){var i=e,a=n,l=o;if(!t&&!i&&!a&&!l&&!r)i=!0,a=!0,l=!0;else if(t){var s,c,u,d=[i,a,l].some(function(g){return g===!1}),f=[i,a,l].some(function(g){return g===!0}),p=d?!0:!f;i=(s=i)!==null&&s!==void 0?s:p,a=(c=a)!==null&&c!==void 0?c:p,l=(u=l)!==null&&u!==void 0?u:p}return[i,a,l,r]}function WXe(t){var e=t.showTime,n=rLt(t),o=sn(n,2),r=o[0],i=o[1],a=e&&hi(e)==="object"?e:{},l=en(en({defaultOpenValue:a.defaultOpenValue||a.defaultValue},r),a),s=l.showMillisecond,c=l.showHour,u=l.showMinute,d=l.showSecond,f=kXe(c,u,d,s),p=LXe(f,c,u,d,s),g=sn(p,3);return c=g[0],u=g[1],d=g[2],[l,en(en({},l),{},{showHour:c,showMinute:u,showSecond:d,showMillisecond:s}),l.format,i]}function NXe(t,e,n,o,r){var i=t==="time";if(t==="datetime"||i){for(var a=o,l=MXe(t,r,null),s=l,c=[e,n],u=0;u1&&(a=e.addDate(a,-7)),a}function Lu(t,e){var n=e.generateConfig,o=e.locale,r=e.format;return t?typeof r=="function"?r(t):n.locale.format(o.locale,t,r):""}function GG(t,e,n){var o=e,r=["getHour","getMinute","getSecond","getMillisecond"],i=["setHour","setMinute","setSecond","setMillisecond"];return i.forEach(function(a,l){n?o=t[a](o,t[r[l]](n)):o=t[a](o,0)}),o}function cLt(t,e,n,o,r){var i=za(function(a,l){return!!(n&&n(a,l)||o&&t.isAfter(o,a)&&!fh(t,e,o,a,l.type)||r&&t.isAfter(a,r)&&!fh(t,e,r,a,l.type))});return i}function uLt(t,e,n){return m.useMemo(function(){var o=MXe(t,e,n),r=Ob(o),i=r[0],a=hi(i)==="object"&&i.type==="mask"?i.format:null;return[r.map(function(l){return typeof l=="string"||typeof l=="function"?l:l.format}),a]},[t,e,n])}function dLt(t,e,n){return typeof t[0]=="function"||n?!0:e}function fLt(t,e,n,o){var r=za(function(i,a){var l=en({type:e},a);if(delete l.activeIndex,!t.isValidate(i)||n&&n(i,l))return!0;if((e==="date"||e==="time")&&o){var s,c=a&&a.activeIndex===1?"end":"start",u=((s=o.disabledTime)===null||s===void 0?void 0:s.call(o,i,c,{from:l.from}))||{},d=u.disabledHours,f=u.disabledMinutes,p=u.disabledSeconds,g=u.disabledMilliseconds,A=o.disabledHours,y=o.disabledMinutes,S=o.disabledSeconds,C=d||A,P=f||y,v=p||S,T=t.getHour(i),w=t.getMinute(i),x=t.getSecond(i),b=t.getMillisecond(i);if(C&&C().includes(T)||P&&P(T).includes(w)||v&&v(T,w).includes(x)||g&&g(T,w,x).includes(b))return!0}return!1});return r}function FY(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=m.useMemo(function(){var o=t&&Ob(t);return e&&o&&(o[1]=o[1]||o[0]),o},[t,e]);return n}function BXe(t,e){var n=t.generateConfig,o=t.locale,r=t.picker,i=r===void 0?"date":r,a=t.prefixCls,l=a===void 0?"rc-picker":a,s=t.styles,c=s===void 0?{}:s,u=t.classNames,d=u===void 0?{}:u,f=t.order,p=f===void 0?!0:f,g=t.components,A=g===void 0?{}:g,y=t.inputRender,S=t.allowClear,C=t.clearIcon,P=t.needConfirm,v=t.multiple,T=t.format,w=t.inputReadOnly,x=t.disabledDate,b=t.minDate,R=t.maxDate,H=t.showTime,F=t.value,E=t.defaultValue,N=t.pickerValue,U=t.defaultPickerValue,W=FY(F),k=FY(E),D=FY(N),L=FY(U),j=i==="date"&&H?"datetime":i,B=j==="time"||j==="datetime",O=B||v,V=P??B,G=WXe(t),q=sn(G,4),$=q[0],ie=q[1],Q=q[2],se=q[3],oe=FXe(o,ie),Z=m.useMemo(function(){return NXe(j,Q,se,$,oe)},[j,Q,se,$,oe]),te=m.useMemo(function(){return en(en({},t),{},{prefixCls:l,locale:oe,picker:i,styles:c,classNames:d,order:p,components:en({input:y},A),clearIcon:aLt(l,S,C),showTime:Z,value:W,defaultValue:k,pickerValue:D,defaultPickerValue:L},e==null?void 0:e())},[t]),ee=uLt(j,oe,T),de=sn(ee,2),fe=de[0],pe=de[1],ye=dLt(fe,w,v),ae=cLt(n,o,x,b,R),Te=fLt(n,i,ae,Z),ge=m.useMemo(function(){return en(en({},te),{},{needConfirm:V,inputReadOnly:ye,disabledDate:ae})},[te,V,ye,ae]);return[ge,j,O,fe,pe,Te]}function hLt(t,e,n){var o=Es(e,{value:t}),r=sn(o,2),i=r[0],a=r[1],l=be.useRef(t),s=be.useRef(),c=function(){Ea.cancel(s.current)},u=za(function(){a(l.current),n&&i!==l.current&&n(l.current)}),d=za(function(f,p){c(),l.current=f,f||p?u():s.current=Ea(u)});return be.useEffect(function(){return c},[]),[i,d]}function YXe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,r=n.every(function(u){return u})?!1:t,i=hLt(r,e||!1,o),a=sn(i,2),l=a[0],s=a[1];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(!d.inherit||l)&&s(u,d.force)}return[l,c]}function OXe(t){var e=m.useRef();return m.useImperativeHandle(t,function(){var n;return{nativeElement:(n=e.current)===null||n===void 0?void 0:n.nativeElement,focus:function(r){var i;(i=e.current)===null||i===void 0||i.focus(r)},blur:function(){var r;(r=e.current)===null||r===void 0||r.blur()}}}),e}function VXe(t,e){return m.useMemo(function(){return t||(e?(U0(!1,"`ranges` is deprecated. Please use `presets` instead."),Object.entries(e).map(function(n){var o=sn(n,2),r=o[0],i=o[1];return{label:r,value:i}})):[])},[t,e])}function nye(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,o=m.useRef(e);o.current=e,yx(function(){if(t)o.current(t);else{var r=Ea(function(){o.current(t)},n);return function(){Ea.cancel(r)}}},[t])}function _Xe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=m.useState(0),o=sn(n,2),r=o[0],i=o[1],a=m.useState(!1),l=sn(a,2),s=l[0],c=l[1],u=m.useRef([]),d=m.useRef(null),f=function(y){c(y)},p=function(y){return y&&(d.current=y),d.current},g=function(y){var S=u.current,C=new Set(S.filter(function(v){return y[v]||e[v]})),P=S[S.length-1]===0?1:0;return C.size>=2||t[P]?null:P};return nye(s,function(){s||(u.current=[])}),m.useEffect(function(){s&&u.current.push(r)},[s,r]),[s,f,p,r,i,g,u.current]}function pLt(t,e,n,o,r,i){var a=n[n.length-1],l=function(c,u){var d=sn(t,2),f=d[0],p=d[1],g=en(en({},u),{},{from:IXe(t,n)});return a===1&&e[0]&&f&&!fh(o,r,f,c,g.type)&&o.isAfter(f,c)||a===0&&e[1]&&p&&!fh(o,r,p,c,g.type)&&o.isAfter(c,p)?!0:i==null?void 0:i(c,g)};return l}function kD(t,e,n,o){switch(e){case"date":case"week":return t.addMonth(n,o);case"month":case"quarter":return t.addYear(n,o);case"year":return t.addYear(n,o*10);case"decade":return t.addYear(n,o*100);default:return n}}var fie=[];function GXe(t,e,n,o,r,i,a,l){var s=arguments.length>8&&arguments[8]!==void 0?arguments[8]:fie,c=arguments.length>9&&arguments[9]!==void 0?arguments[9]:fie,u=arguments.length>10&&arguments[10]!==void 0?arguments[10]:fie,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,p=arguments.length>13?arguments[13]:void 0,g=a==="time",A=i||0,y=function(D){var L=t.getNow();return g&&(L=GG(t,L)),s[D]||n[D]||L},S=sn(c,2),C=S[0],P=S[1],v=Es(function(){return y(0)},{value:C}),T=sn(v,2),w=T[0],x=T[1],b=Es(function(){return y(1)},{value:P}),R=sn(b,2),H=R[0],F=R[1],E=m.useMemo(function(){var k=[w,H][A];return g?k:GG(t,k,u[A])},[g,w,H,A,t,u]),N=function(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"panel",j=[x,F][A];j(D);var B=[w,H];B[A]=D,d&&(!fh(t,e,w,B[0],a)||!fh(t,e,H,B[1],a))&&d(B,{source:L,range:A===1?"end":"start",mode:o})},U=function(D,L){if(l){var j={date:"month",week:"month",month:"year",quarter:"year"},B=j[a];if(B&&!fh(t,e,D,L,B))return kD(t,a,L,-1);if(a==="year"){var O=Math.floor(t.getYear(D)/10),V=Math.floor(t.getYear(L)/10);if(O!==V)return kD(t,a,L,-1)}}return L},W=m.useRef(null);return _a(function(){if(r&&!s[A]){var k=g?null:t.getNow();if(W.current!==null&&W.current!==A?k=[w,H][A^1]:n[A]?k=A===0?n[0]:U(n[0],n[1]):n[A^1]&&(k=n[A^1]),k){f&&t.isAfter(f,k)&&(k=f);var D=l?kD(t,a,k,1):k;p&&t.isAfter(D,p)&&(k=l?kD(t,a,p,-1):p),N(k,"reset")}}},[r,A,n[A]]),m.useEffect(function(){r?W.current=A:W.current=null},[r,A]),_a(function(){r&&s&&s[A]&&N(s[A],"reset")},[r,A]),[E,N]}function XXe(t,e){var n=m.useRef(t),o=m.useState({}),r=sn(o,2),i=r[1],a=function(c){return c&&e!==void 0?e:n.current},l=function(c){n.current=c,i({})};return[a,l,a(!0)]}var gLt=[];function JXe(t,e,n){var o=function(a){return a.map(function(l){return Lu(l,{generateConfig:t,locale:e,format:n[0]})})},r=function(a,l){for(var s=Math.max(a.length,l.length),c=-1,u=0;u2&&arguments[2]!==void 0?arguments[2]:1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:2,a=[],l=n>=1?n|0:1,s=t;s<=e;s+=l){var c=r.includes(s);(!c||!o)&&a.push({label:Qme(s,i),value:s,disabled:c})}return a}function oye(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,o=e||{},r=o.use12Hours,i=o.hourStep,a=i===void 0?1:i,l=o.minuteStep,s=l===void 0?1:l,c=o.secondStep,u=c===void 0?1:c,d=o.millisecondStep,f=d===void 0?100:d,p=o.hideDisabledOptions,g=o.disabledTime,A=o.disabledHours,y=o.disabledMinutes,S=o.disabledSeconds,C=m.useMemo(function(){return n||t.getNow()},[n,t]),P=m.useCallback(function(L){var j=(g==null?void 0:g(L))||{};return[j.disabledHours||A||kY,j.disabledMinutes||y||kY,j.disabledSeconds||S||kY,j.disabledMilliseconds||kY]},[g,A,y,S]),v=m.useMemo(function(){return P(C)},[C,P]),T=sn(v,4),w=T[0],x=T[1],b=T[2],R=T[3],H=m.useCallback(function(L,j,B,O){var V=LY(0,23,a,p,L()),G=r?V.map(function(Q){return en(en({},Q),{},{label:Qme(Q.value%12||12,2)})}):V,q=function(se){return LY(0,59,s,p,j(se))},$=function(se,oe){return LY(0,59,u,p,B(se,oe))},ie=function(se,oe,Z){return LY(0,999,f,p,O(se,oe,Z),3)};return[G,q,$,ie]},[p,a,r,f,s,u]),F=m.useMemo(function(){return H(w,x,b,R)},[H,w,x,b,R]),E=sn(F,4),N=E[0],U=E[1],W=E[2],k=E[3],D=function(j,B){var O=function(){return N},V=U,G=W,q=k;if(B){var $=P(B),ie=sn($,4),Q=ie[0],se=ie[1],oe=ie[2],Z=ie[3],te=H(Q,se,oe,Z),ee=sn(te,4),de=ee[0],fe=ee[1],pe=ee[2],ye=ee[3];O=function(){return de},V=fe,G=pe,q=ye}var ae=yLt(j,O,V,G,q,t);return ae};return[D,N,U,W,k]}function ALt(t){var e=t.mode,n=t.internalMode,o=t.renderExtraFooter,r=t.showNow,i=t.showTime,a=t.onSubmit,l=t.onNow,s=t.invalid,c=t.needConfirm,u=t.generateConfig,d=t.disabledDate,f=m.useContext(r5),p=f.prefixCls,g=f.locale,A=f.button,y=A===void 0?"button":A,S=u.getNow(),C=oye(u,i,S),P=sn(C,1),v=P[0],T=o==null?void 0:o(e),w=d(S,{type:e}),x=function(){if(!w){var U=v(S);l(U)}},b="".concat(p,"-now"),R="".concat(b,"-btn"),H=r&&m.createElement("li",{className:b},m.createElement("a",{className:Xn(R,w&&"".concat(R,"-disabled")),"aria-disabled":w,onClick:x},n==="date"?g.today:g.now)),F=c&&m.createElement("li",{className:"".concat(p,"-ok")},m.createElement(y,{disabled:s,onClick:a},g.ok)),E=(H||F)&&m.createElement("ul",{className:"".concat(p,"-ranges")},H,F);return!T&&!E?null:m.createElement("div",{className:"".concat(p,"-footer")},T&&m.createElement("div",{className:"".concat(p,"-footer-extra")},T),E)}function ZXe(t,e,n){function o(r,i){var a=r.findIndex(function(s){return fh(t,e,s,i,n)});if(a===-1)return[].concat(No(r),[i]);var l=No(r);return l.splice(a,1),l}return o}var Vb=m.createContext(null);function sQ(){return m.useContext(Vb)}function JH(t,e){var n=t.prefixCls,o=t.generateConfig,r=t.locale,i=t.disabledDate,a=t.minDate,l=t.maxDate,s=t.cellRender,c=t.hoverValue,u=t.hoverRangeValue,d=t.onHover,f=t.values,p=t.pickerValue,g=t.onSelect,A=t.prevIcon,y=t.nextIcon,S=t.superPrevIcon,C=t.superNextIcon,P=o.getNow(),v={now:P,values:f,pickerValue:p,prefixCls:n,disabledDate:i,minDate:a,maxDate:l,cellRender:s,hoverValue:c,hoverRangeValue:u,onHover:d,locale:r,generateConfig:o,onSelect:g,panelType:e,prevIcon:A,nextIcon:y,superPrevIcon:S,superNextIcon:C};return[v,P]}var V8=m.createContext({});function $W(t){for(var e=t.rowNum,n=t.colNum,o=t.baseDate,r=t.getCellDate,i=t.prefixColumn,a=t.rowClassName,l=t.titleFormat,s=t.getCellText,c=t.getCellClassName,u=t.headerCells,d=t.cellSelection,f=d===void 0?!0:d,p=t.disabledDate,g=sQ(),A=g.prefixCls,y=g.panelType,S=g.now,C=g.disabledDate,P=g.cellRender,v=g.onHover,T=g.hoverValue,w=g.hoverRangeValue,x=g.generateConfig,b=g.values,R=g.locale,H=g.onSelect,F=p||C,E="".concat(A,"-cell"),N=m.useContext(V8),U=N.onCellDblClick,W=function(G){return b.some(function(q){return q&&fh(x,R,G,q,y)})},k=[],D=0;D1&&arguments[1]!==void 0?arguments[1]:!1;De(nt),y==null||y(nt),We&&Ae(nt)},he=function(nt,We){oe(nt),We&&ue(We),Ae(We,nt)},ve=function(nt){if(Te(nt),ue(nt),se!==v){var We=["decade","year"],Ee=[].concat(We,["month"]),ke={quarter:[].concat(We,["quarter"]),week:[].concat(No(Ee),["week"]),date:[].concat(No(Ee),["date"])},Oe=ke[v]||Ee,st=Oe.indexOf(se),je=Oe[st+1];je&&he(je,nt)}},we=m.useMemo(function(){var Ue,nt;if(Array.isArray(x)){var We=sn(x,2);Ue=We[0],nt=We[1]}else Ue=x;return!Ue&&!nt?null:(Ue=Ue||nt,nt=nt||Ue,r.isAfter(Ue,nt)?[nt,Ue]:[Ue,nt])},[x,r]),Pe=Zme(b,R,H),Ie=E[Z]||MLt[Z]||cQ,Me=m.useContext(V8),ze=m.useMemo(function(){return en(en({},Me),{},{hideHeader:N})},[Me,N]),Ne="".concat(U,"-panel"),Je=aQ(t,["showWeek","prevIcon","nextIcon","superPrevIcon","superNextIcon","disabledDate","minDate","maxDate","onHover"]);return m.createElement(V8.Provider,{value:ze},m.createElement("div",{ref:W,tabIndex:s,className:Xn(Ne,Jt({},"".concat(Ne,"-rtl"),i==="rtl"))},m.createElement(Ie,go({},Je,{showTime:q,prefixCls:U,locale:V,generateConfig:r,onModeChange:he,pickerValue:Re,onPickerValueChange:function(nt){ue(nt,!0)},value:ye[0],onSelect:ve,values:ye,cellRender:Pe,hoverRangeValue:we,hoverValue:w}))))}var hie=m.memo(m.forwardRef(ILt));function zLt(t){var e=t.picker,n=t.multiplePanel,o=t.pickerValue,r=t.onPickerValueChange,i=t.needConfirm,a=t.onSubmit,l=t.range,s=t.hoverValue,c=m.useContext(r5),u=c.prefixCls,d=c.generateConfig,f=m.useCallback(function(C,P){return kD(d,e,C,P)},[d,e]),p=m.useMemo(function(){return f(o,1)},[o,f]),g=function(P){r(f(P,-1))},A={onCellDblClick:function(){i&&a()}},y=e==="time",S=en(en({},t),{},{hoverValue:null,hoverRangeValue:null,hideHeader:y});return l?S.hoverRangeValue=s:S.hoverValue=s,n?m.createElement("div",{className:"".concat(u,"-panels")},m.createElement(V8.Provider,{value:en(en({},A),{},{hideNext:!0})},m.createElement(hie,S)),m.createElement(V8.Provider,{value:en(en({},A),{},{hidePrev:!0})},m.createElement(hie,go({},S,{pickerValue:p,onPickerValueChange:g})))):m.createElement(V8.Provider,{value:en({},A)},m.createElement(hie,S))}function lxe(t){return typeof t=="function"?t():t}function DLt(t){var e=t.prefixCls,n=t.presets,o=t.onClick,r=t.onHover;return n.length?m.createElement("div",{className:"".concat(e,"-presets")},m.createElement("ul",null,n.map(function(i,a){var l=i.label,s=i.value;return m.createElement("li",{key:a,onClick:function(){o(lxe(s))},onMouseEnter:function(){r(lxe(s))},onMouseLeave:function(){r(null)}},l)}))):null}function tJe(t){var e=t.panelRender,n=t.internalMode,o=t.picker,r=t.showNow,i=t.range,a=t.multiple,l=t.activeOffset,s=l===void 0?0:l,c=t.presets,u=t.onPresetHover,d=t.onPresetSubmit,f=t.onFocus,p=t.onBlur,g=t.direction,A=t.value,y=t.onSelect,S=t.isInvalid,C=t.defaultOpenValue,P=t.onOk,v=t.onSubmit,T=m.useContext(r5),w=T.prefixCls,x="".concat(w,"-panel"),b=g==="rtl",R=m.useRef(null),H=m.useRef(null),F=m.useState(0),E=sn(F,2),N=E[0],U=E[1],W=m.useState(0),k=sn(W,2),D=k[0],L=k[1],j=function(de){de.offsetWidth&&U(de.offsetWidth)};m.useEffect(function(){if(i){var ee,de=((ee=R.current)===null||ee===void 0?void 0:ee.offsetWidth)||0,fe=N-de;s<=fe?L(0):L(s+de-N)}},[N,s,i]);function B(ee){return ee.filter(function(de){return de})}var O=m.useMemo(function(){return B(Ob(A))},[A]),V=o==="time"&&!O.length,G=m.useMemo(function(){return V?B([C]):O},[V,O,C]),q=V?C:O,$=m.useMemo(function(){return G.length?G.some(function(ee){return S(ee)}):!0},[G,S]),ie=function(){V&&y(C),P(),v()},Q=m.createElement("div",{className:"".concat(w,"-panel-layout")},m.createElement(DLt,{prefixCls:w,presets:c,onClick:d,onHover:u}),m.createElement("div",null,m.createElement(zLt,go({},t,{value:q})),m.createElement(ALt,go({},t,{showNow:a?!1:r,invalid:$,onSubmit:ie}))));e&&(Q=e(Q));var se="".concat(x,"-container"),oe="marginLeft",Z="marginRight",te=m.createElement("div",{tabIndex:-1,className:Xn(se,"".concat(w,"-").concat(n,"-panel-container")),style:Jt(Jt({},b?Z:oe,D),b?oe:Z,"auto"),onFocus:f,onBlur:p},Q);return i&&(te=m.createElement("div",{ref:H,className:Xn("".concat(w,"-range-wrapper"),"".concat(w,"-").concat(o,"-range-wrapper"))},m.createElement("div",{ref:R,className:"".concat(w,"-range-arrow"),style:Jt({},b?"right":"left",s)}),m.createElement(Cd,{onResize:j},te))),te}function nJe(t,e){var n=t.format,o=t.maskFormat,r=t.generateConfig,i=t.locale,a=t.preserveInvalidOnBlur,l=t.inputReadOnly,s=t.required,c=t["aria-required"],u=t.onSubmit,d=t.onFocus,f=t.onBlur,p=t.onInputChange,g=t.onInvalid,A=t.open,y=t.onOpenChange,S=t.onKeyDown,C=t.onChange,P=t.activeHelp,v=t.name,T=t.autoComplete,w=t.id,x=t.value,b=t.invalid,R=t.placeholder,H=t.disabled,F=t.activeIndex,E=t.allHelp,N=t.picker,U=function(V,G){var q=r.locale.parse(i.locale,V,[G]);return q&&r.isValidate(q)?q:null},W=n[0],k=m.useCallback(function(O){return Lu(O,{locale:i,format:W,generateConfig:r})},[i,r,W]),D=m.useMemo(function(){return x.map(k)},[x,k]),L=m.useMemo(function(){var O=N==="time"?8:10,V=typeof W=="function"?W(r.getNow()).length:W.length;return Math.max(O,V)+2},[W,N,r]),j=function(V){for(var G=0;G=l&&n<=s)return i;var c=Math.min(Math.abs(n-l),Math.abs(n-s));c0?Qe:lt));var wt=$e+Ye,vt=lt-Qe+1;return String(Qe+(vt+wt-Qe)%vt)};switch(nt){case"Backspace":case"Delete":We="",Ee=Oe;break;case"ArrowLeft":We="",st(-1);break;case"ArrowRight":We="",st(1);break;case"ArrowUp":We="",Ee=je(1);break;case"ArrowDown":We="",Ee=je(-1);break;default:isNaN(Number(nt))||(We=O+nt,Ee=We);break}if(We!==null&&(V(We),We.length>=ke&&(st(1),V(""))),Ee!==null){var xt=te.slice(0,ae)+Qme(Ee,ke)+te.slice(Te);Se(xt.slice(0,a.length))}Z({})},ze=m.useRef();_a(function(){if(!(!N||!a||Ae.current)){if(!fe.match(te)){Se(a);return}return de.current.setSelectionRange(ae,Te),ze.current=Ea(function(){de.current.setSelectionRange(ae,Te)}),function(){Ea.cancel(ze.current)}}},[fe,a,N,te,$,ae,Te,oe,Se]);var Ne=a?{onFocus:ve,onBlur:Pe,onKeyDown:Me,onMouseDown:ue,onMouseUp:he,onPaste:De}:{};return m.createElement("div",{ref:ee,className:Xn(H,Jt(Jt({},"".concat(H,"-active"),n&&r),"".concat(H,"-placeholder"),c))},m.createElement(R,go({ref:de,"aria-invalid":A,autoComplete:"off"},S,{onKeyDown:Ie,onBlur:we},Ne,{value:te,onChange:Re})),m.createElement(uQ,{type:"suffix",icon:i}),y)}),ULt=["id","clearIcon","suffixIcon","separator","activeIndex","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","value","onChange","onSubmit","onInputChange","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onActiveOffset","onMouseDown","required","aria-required","autoFocus"],jLt=["index"];function BLt(t,e){var n=t.id,o=t.clearIcon,r=t.suffixIcon,i=t.separator,a=i===void 0?"~":i,l=t.activeIndex;t.activeHelp,t.allHelp;var s=t.focused;t.onFocus,t.onBlur,t.onKeyDown,t.locale,t.generateConfig;var c=t.placeholder,u=t.className,d=t.style,f=t.onClick,p=t.onClear,g=t.value;t.onChange,t.onSubmit,t.onInputChange,t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var A=t.disabled,y=t.invalid;t.inputReadOnly;var S=t.direction;t.onOpenChange;var C=t.onActiveOffset,P=t.onMouseDown;t.required,t["aria-required"];var v=t.autoFocus,T=oi(t,ULt),w=S==="rtl",x=m.useContext(r5),b=x.prefixCls,R=m.useMemo(function(){if(typeof n=="string")return[n];var se=n||{};return[se.start,se.end]},[n]),H=m.useRef(),F=m.useRef(),E=m.useRef(),N=function(oe){var Z;return(Z=[F,E][oe])===null||Z===void 0?void 0:Z.current};m.useImperativeHandle(e,function(){return{nativeElement:H.current,focus:function(oe){if(hi(oe)==="object"){var Z,te=oe||{},ee=te.index,de=ee===void 0?0:ee,fe=oi(te,jLt);(Z=N(de))===null||Z===void 0||Z.focus(fe)}else{var pe;(pe=N(oe??0))===null||pe===void 0||pe.focus()}},blur:function(){var oe,Z;(oe=N(0))===null||oe===void 0||oe.blur(),(Z=N(1))===null||Z===void 0||Z.blur()}}});var U=oJe(T),W=m.useMemo(function(){return Array.isArray(c)?c:[c,c]},[c]),k=nJe(en(en({},t),{},{id:R,placeholder:W})),D=sn(k,1),L=D[0],j=w?"right":"left",B=m.useState(Jt({position:"absolute",width:0},j,0)),O=sn(B,2),V=O[0],G=O[1],q=za(function(){var se=N(l);if(se){var oe=se.nativeElement,Z=oe.offsetWidth,te=oe.offsetLeft,ee=oe.offsetParent,de=te;if(w){var fe=ee,pe=getComputedStyle(fe);de=fe.offsetWidth-parseFloat(pe.borderRightWidth)-parseFloat(pe.borderLeftWidth)-te-Z}G(function(ye){return en(en({},ye),{},Jt({width:Z},j,de))}),C(l===0?0:de)}});m.useEffect(function(){q()},[l]);var $=o&&(g[0]&&!A[0]||g[1]&&!A[1]),ie=v&&!A[0],Q=v&&!ie&&!A[1];return m.createElement(Cd,{onResize:q},m.createElement("div",go({},U,{className:Xn(b,"".concat(b,"-range"),Jt(Jt(Jt(Jt({},"".concat(b,"-focused"),s),"".concat(b,"-disabled"),A.every(function(se){return se})),"".concat(b,"-invalid"),y.some(function(se){return se})),"".concat(b,"-rtl"),w),u),style:d,ref:H,onClick:f,onMouseDown:function(oe){var Z=oe.target;Z!==F.current.inputElement&&Z!==E.current.inputElement&&oe.preventDefault(),P==null||P(oe)}}),m.createElement(hue,go({ref:F},L(0),{autoFocus:ie,"date-range":"start"})),m.createElement("div",{className:"".concat(b,"-range-separator")},a),m.createElement(hue,go({ref:E},L(1),{autoFocus:Q,"date-range":"end"})),m.createElement("div",{className:"".concat(b,"-active-bar"),style:V}),m.createElement(uQ,{type:"suffix",icon:r}),$&&m.createElement(fue,{icon:o,onClear:p})))}var YLt=m.forwardRef(BLt);function cxe(t,e){var n=t??e;return Array.isArray(n)?n:[n,n]}function NY(t){return t===1?"end":"start"}function OLt(t,e){var n=BXe(t,function(){var to=t.disabled,Bn=t.allowEmpty,Ko=cxe(to,!1),So=cxe(Bn,!1);return{disabled:Ko,allowEmpty:So}}),o=sn(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r.prefixCls,d=r.styles,f=r.classNames,p=r.defaultValue,g=r.value,A=r.needConfirm,y=r.onKeyDown,S=r.disabled,C=r.allowEmpty,P=r.disabledDate,v=r.minDate,T=r.maxDate,w=r.defaultOpen,x=r.open,b=r.onOpenChange,R=r.locale,H=r.generateConfig,F=r.picker,E=r.showNow,N=r.showToday,U=r.showTime,W=r.mode,k=r.onPanelChange,D=r.onCalendarChange,L=r.onOk,j=r.defaultPickerValue,B=r.pickerValue,O=r.onPickerValueChange,V=r.inputReadOnly,G=r.suffixIcon,q=r.onFocus,$=r.onBlur,ie=r.presets,Q=r.ranges,se=r.components,oe=r.cellRender,Z=r.dateRender,te=r.monthCellRender,ee=r.onClick,de=OXe(e),fe=YXe(x,w,S,b),pe=sn(fe,2),ye=pe[0],ae=pe[1],Te=function(Bn,Ko){(S.some(function(So){return!So})||!Bn)&&ae(Bn,Ko)},ge=qXe(H,R,l,!0,!1,p,g,D,L),Se=sn(ge,5),Re=Se[0],De=Se[1],Ae=Se[2],ue=Se[3],he=Se[4],ve=Ae(),we=_Xe(S,C),Pe=sn(we,7),Ie=Pe[0],Me=Pe[1],ze=Pe[2],Ne=Pe[3],Je=Pe[4],Ue=Pe[5],nt=Pe[6],We=function(Bn,Ko){Me(!0),q==null||q(Bn,{range:NY(Ko??Ne)})},Ee=function(Bn,Ko){Me(!1),$==null||$(Bn,{range:NY(Ko??Ne)})},ke=m.useMemo(function(){if(!U)return null;var to=U.disabledTime,Bn=to?function(Ko){var So=NY(Ne),Qo=IXe(ve,nt,Ne);return to(Ko,So,{from:Qo})}:void 0;return en(en({},U),{},{disabledTime:Bn})},[U,Ne,ve,nt]),Oe=Es([F,F],{value:W}),st=sn(Oe,2),je=st[0],xt=st[1],gt=je[Ne]||F,Ye=gt==="date"&&ke?"datetime":gt,it=Ye===F&&Ye!=="time",ut=QXe(F,gt,E,N,!0),Qe=$Xe(r,Re,De,Ae,ue,S,l,Ie,ye,c),lt=sn(Qe,2),Ze=lt[0],Be=lt[1],$e=pLt(ve,S,nt,H,R,P),wt=DXe(ve,c,C),vt=sn(wt,2),Rt=vt[0],Gt=vt[1],At=GXe(H,R,ve,je,ye,Ne,i,it,j,B,ke==null?void 0:ke.defaultOpenValue,O,v,T),pt=sn(At,2),Wt=pt[0],ht=pt[1],ct=za(function(to,Bn,Ko){var So=RE(je,Ne,Bn);if((So[0]!==je[0]||So[1]!==je[1])&&xt(So),k&&Ko!==!1){var Qo=No(ve);to&&(Qo[Ne]=to),k(Qo,So)}}),It=function(Bn,Ko){return RE(ve,Ko,Bn)},Ft=function(Bn,Ko){var So=ve;Bn&&(So=It(Bn,Ne));var Qo=Ue(So);ue(So),Ze(Ne,Qo===null),Qo===null?Te(!1,{force:!0}):Ko||de.current.focus({index:Qo})},Ve=function(Bn){if(!de.current.nativeElement.contains(document.activeElement)){var Ko=S.findIndex(function(So){return!So});Ko>=0&&de.current.focus({index:Ko})}Te(!0),ee==null||ee(Bn)},ft=function(){Be(null),Te(!1,{force:!0})},kt=m.useState(null),rt=sn(kt,2),at=rt[0],Ge=rt[1],yt=m.useState(null),Pt=sn(yt,2),ot=Pt[0],bt=Pt[1],zt=m.useMemo(function(){return ot||ve},[ve,ot]);m.useEffect(function(){ye||bt(null)},[ye]);var Bt=m.useState(0),tt=sn(Bt,2),Ht=tt[0],_t=tt[1],qt=VXe(ie,Q),un=function(Bn){bt(Bn),Ge("preset")},Rn=function(Bn){var Ko=Be(Bn);Ko&&Te(!1,{force:!0})},yo=function(Bn){Ft(Bn)},Ao=function(Bn){bt(Bn?It(Bn,Ne):null),Ge("cell")},wo=function(Bn){Te(!0),We(Bn)},Io=function(Bn){ze("panel");var Ko=RE(ve,Ne,Bn);ue(Ko),!A&&!a&&i===Ye&&Ft(Bn)},po=function(){Te(!1)},On=Zme(oe,Z,te,NY(Ne)),fo=ve[Ne]||null,ir=za(function(to){return c(to,{activeIndex:Ne})}),Rr=m.useMemo(function(){var to=bf(r,!1),Bn=OH(r,[].concat(No(Object.keys(to)),["onChange","onCalendarChange","style","className","onPanelChange","disabledTime"]));return Bn},[r]),br=m.createElement(tJe,go({},Rr,{showNow:ut,showTime:ke,range:!0,multiplePanel:it,activeOffset:Ht,disabledDate:$e,onFocus:wo,onBlur:Ee,picker:F,mode:gt,internalMode:Ye,onPanelChange:ct,format:s,value:fo,isInvalid:ir,onChange:null,onSelect:Io,pickerValue:Wt,defaultOpenValue:Ob(U==null?void 0:U.defaultOpenValue)[Ne],onPickerValueChange:ht,hoverValue:zt,onHover:Ao,needConfirm:A,onSubmit:Ft,onOk:he,presets:qt,onPresetHover:un,onPresetSubmit:Rn,onNow:yo,cellRender:On})),_r=function(Bn,Ko){var So=It(Bn,Ko);ue(So)},jo=function(){ze("input")},wn=function(Bn,Ko){ze("input"),Te(!0,{inherit:!0}),Je(Ko),We(Bn,Ko)},In=function(Bn,Ko){Te(!1),Ee(Bn,Ko)},ar=function(Bn,Ko){Bn.key==="Tab"&&Ft(null,!0),y==null||y(Bn,Ko)},Wo=m.useMemo(function(){return{prefixCls:u,locale:R,generateConfig:H,button:se.button,input:se.input}},[u,R,H,se.button,se.input]);return _a(function(){ye&&Ne!==void 0&&ct(null,F,!1)},[ye,Ne,F]),_a(function(){var to=ze();!ye&&to==="input"&&(Te(!1),Ft(null,!0)),!ye&&a&&!A&&to==="panel"&&(Te(!0),Ft())},[ye]),m.createElement(r5.Provider,{value:Wo},m.createElement(HXe,go({},zXe(r),{popupElement:br,popupStyle:d.popup,popupClassName:f.popup,visible:ye,onClose:po,range:!0}),m.createElement(YLt,go({},r,{ref:de,suffixIcon:G,activeIndex:Ie||ye?Ne:null,activeHelp:!!ot,allHelp:!!ot&&at==="preset",focused:Ie,onFocus:wn,onBlur:In,onKeyDown:ar,onSubmit:Ft,value:zt,maskFormat:s,onChange:_r,onInputChange:jo,format:l,inputReadOnly:V,disabled:S,open:ye,onOpenChange:Te,onClick:Ve,onClear:ft,invalid:Rt,onInvalid:Gt,onActiveOffset:_t}))))}var VLt=m.forwardRef(OLt);function _Lt(t){var e=t.prefixCls,n=t.value,o=t.onRemove,r=t.removeIcon,i=r===void 0?"×":r,a=t.formatDate,l=t.disabled,s=t.maxTagCount,c=t.placeholder,u="".concat(e,"-selector"),d="".concat(e,"-selection"),f="".concat(d,"-overflow");function p(y,S){return m.createElement("span",{className:Xn("".concat(d,"-item")),title:typeof y=="string"?y:null},m.createElement("span",{className:"".concat(d,"-item-content")},y),!l&&S&&m.createElement("span",{onMouseDown:function(P){P.preventDefault()},onClick:S,className:"".concat(d,"-item-remove")},i))}function g(y){var S=a(y),C=function(v){v&&v.stopPropagation(),o(y)};return p(S,C)}function A(y){var S="+ ".concat(y.length," ...");return p(S)}return m.createElement("div",{className:u},m.createElement(F2,{prefixCls:f,data:n,renderItem:g,renderRest:A,itemKey:function(S){return a(S)},maxCount:s}),!n.length&&m.createElement("span",{className:"".concat(e,"-selection-placeholder")},c))}var GLt=["id","open","clearIcon","suffixIcon","activeHelp","allHelp","focused","onFocus","onBlur","onKeyDown","locale","generateConfig","placeholder","className","style","onClick","onClear","internalPicker","value","onChange","onSubmit","onInputChange","multiple","maxTagCount","format","maskFormat","preserveInvalidOnBlur","onInvalid","disabled","invalid","inputReadOnly","direction","onOpenChange","onMouseDown","required","aria-required","autoFocus","removeIcon"];function XLt(t,e){t.id;var n=t.open,o=t.clearIcon,r=t.suffixIcon;t.activeHelp,t.allHelp;var i=t.focused;t.onFocus,t.onBlur,t.onKeyDown;var a=t.locale,l=t.generateConfig,s=t.placeholder,c=t.className,u=t.style,d=t.onClick,f=t.onClear,p=t.internalPicker,g=t.value,A=t.onChange,y=t.onSubmit;t.onInputChange;var S=t.multiple,C=t.maxTagCount;t.format,t.maskFormat,t.preserveInvalidOnBlur,t.onInvalid;var P=t.disabled,v=t.invalid;t.inputReadOnly;var T=t.direction;t.onOpenChange;var w=t.onMouseDown;t.required,t["aria-required"];var x=t.autoFocus,b=t.removeIcon,R=oi(t,GLt),H=T==="rtl",F=m.useContext(r5),E=F.prefixCls,N=m.useRef(),U=m.useRef();m.useImperativeHandle(e,function(){return{nativeElement:N.current,focus:function($){var ie;(ie=U.current)===null||ie===void 0||ie.focus($)},blur:function(){var $;($=U.current)===null||$===void 0||$.blur()}}});var W=oJe(R),k=function($){A([$])},D=function($){var ie=g.filter(function(Q){return Q&&!fh(l,a,Q,$,p)});A(ie),n||y()},L=nJe(en(en({},t),{},{onChange:k}),function(q){var $=q.valueTexts;return{value:$[0]||"",active:i}}),j=sn(L,2),B=j[0],O=j[1],V=!!(o&&g.length&&!P),G=S?m.createElement(m.Fragment,null,m.createElement(_Lt,{prefixCls:E,value:g,onRemove:D,formatDate:O,maxTagCount:C,disabled:P,removeIcon:b,placeholder:s}),m.createElement("input",{className:"".concat(E,"-multiple-input"),value:g.map(O).join(","),ref:U,readOnly:!0,autoFocus:x}),m.createElement(uQ,{type:"suffix",icon:r}),V&&m.createElement(fue,{icon:o,onClear:f})):m.createElement(hue,go({ref:U},B(),{autoFocus:x,suffixIcon:r,clearIcon:V&&m.createElement(fue,{icon:o,onClear:f}),showActiveCls:!1}));return m.createElement("div",go({},W,{className:Xn(E,Jt(Jt(Jt(Jt(Jt({},"".concat(E,"-multiple"),S),"".concat(E,"-focused"),i),"".concat(E,"-disabled"),P),"".concat(E,"-invalid"),v),"".concat(E,"-rtl"),H),c),style:u,ref:N,onClick:d,onMouseDown:function($){var ie,Q=$.target;Q!==((ie=U.current)===null||ie===void 0?void 0:ie.inputElement)&&$.preventDefault(),w==null||w($)}}),G)}var JLt=m.forwardRef(XLt);function KLt(t,e){var n=BXe(t),o=sn(n,6),r=o[0],i=o[1],a=o[2],l=o[3],s=o[4],c=o[5],u=r,d=u.prefixCls,f=u.styles,p=u.classNames,g=u.order,A=u.defaultValue,y=u.value,S=u.needConfirm,C=u.onChange,P=u.onKeyDown,v=u.disabled,T=u.disabledDate,w=u.minDate,x=u.maxDate,b=u.defaultOpen,R=u.open,H=u.onOpenChange,F=u.locale,E=u.generateConfig,N=u.picker,U=u.showNow,W=u.showToday,k=u.showTime,D=u.mode,L=u.onPanelChange,j=u.onCalendarChange,B=u.onOk,O=u.multiple,V=u.defaultPickerValue,G=u.pickerValue,q=u.onPickerValueChange,$=u.inputReadOnly,ie=u.suffixIcon,Q=u.removeIcon,se=u.onFocus,oe=u.onBlur,Z=u.presets,te=u.components,ee=u.cellRender,de=u.dateRender,fe=u.monthCellRender,pe=u.onClick,ye=OXe(e);function ae(jo){return jo===null?null:O?jo:jo[0]}var Te=ZXe(E,F,i),ge=YXe(R,b,[v],H),Se=sn(ge,2),Re=Se[0],De=Se[1],Ae=function(wn,In,ar){if(j){var Wo=en({},ar);delete Wo.range,j(ae(wn),ae(In),Wo)}},ue=function(wn){B==null||B(ae(wn))},he=qXe(E,F,l,!1,g,A,y,Ae,ue),ve=sn(he,5),we=ve[0],Pe=ve[1],Ie=ve[2],Me=ve[3],ze=ve[4],Ne=Ie(),Je=_Xe([v]),Ue=sn(Je,4),nt=Ue[0],We=Ue[1],Ee=Ue[2],ke=Ue[3],Oe=function(wn){We(!0),se==null||se(wn,{})},st=function(wn){We(!1),oe==null||oe(wn,{})},je=Es(N,{value:D}),xt=sn(je,2),gt=xt[0],Ye=xt[1],it=gt==="date"&&k?"datetime":gt,ut=QXe(N,gt,U,W),Qe=C&&function(jo,wn){C(ae(jo),ae(wn))},lt=$Xe(en(en({},r),{},{onChange:Qe}),we,Pe,Ie,Me,[],l,nt,Re,c),Ze=sn(lt,2),Be=Ze[1],$e=DXe(Ne,c),wt=sn($e,2),vt=wt[0],Rt=wt[1],Gt=m.useMemo(function(){return vt.some(function(jo){return jo})},[vt]),At=function(wn,In){if(q){var ar=en(en({},In),{},{mode:In.mode[0]});delete ar.range,q(wn[0],ar)}},pt=GXe(E,F,Ne,[gt],Re,ke,i,!1,V,G,Ob(k==null?void 0:k.defaultOpenValue),At,w,x),Wt=sn(pt,2),ht=Wt[0],ct=Wt[1],It=za(function(jo,wn,In){if(Ye(wn),L&&In!==!1){var ar=jo||Ne[Ne.length-1];L(ar,wn)}}),Ft=function(){Be(Ie()),De(!1,{force:!0})},Ve=function(wn){!v&&!ye.current.nativeElement.contains(document.activeElement)&&ye.current.focus(),De(!0),pe==null||pe(wn)},ft=function(){Be(null),De(!1,{force:!0})},kt=m.useState(null),rt=sn(kt,2),at=rt[0],Ge=rt[1],yt=m.useState(null),Pt=sn(yt,2),ot=Pt[0],bt=Pt[1],zt=m.useMemo(function(){var jo=[ot].concat(No(Ne)).filter(function(wn){return wn});return O?jo:jo.slice(0,1)},[Ne,ot,O]),Bt=m.useMemo(function(){return!O&&ot?[ot]:Ne.filter(function(jo){return jo})},[Ne,ot,O]);m.useEffect(function(){Re||bt(null)},[Re]);var tt=VXe(Z),Ht=function(wn){bt(wn),Ge("preset")},_t=function(wn){var In=O?Te(Ie(),wn):[wn],ar=Be(In);ar&&!O&&De(!1,{force:!0})},qt=function(wn){_t(wn)},un=function(wn){bt(wn),Ge("cell")},Rn=function(wn){De(!0),Oe(wn)},yo=function(wn){Ee("panel");var In=O?Te(Ie(),wn):[wn];Me(In),!S&&!a&&i===it&&Ft()},Ao=function(){De(!1)},wo=Zme(ee,de,fe),Io=m.useMemo(function(){var jo=bf(r,!1),wn=OH(r,[].concat(No(Object.keys(jo)),["onChange","onCalendarChange","style","className","onPanelChange"]));return en(en({},wn),{},{multiple:r.multiple})},[r]),po=m.createElement(tJe,go({},Io,{showNow:ut,showTime:k,disabledDate:T,onFocus:Rn,onBlur:st,picker:N,mode:gt,internalMode:it,onPanelChange:It,format:s,value:Ne,isInvalid:c,onChange:null,onSelect:yo,pickerValue:ht,defaultOpenValue:k==null?void 0:k.defaultOpenValue,onPickerValueChange:ct,hoverValue:zt,onHover:un,needConfirm:S,onSubmit:Ft,onOk:ze,presets:tt,onPresetHover:Ht,onPresetSubmit:_t,onNow:qt,cellRender:wo})),On=function(wn){Me(wn)},fo=function(){Ee("input")},ir=function(wn){Ee("input"),De(!0,{inherit:!0}),Oe(wn)},Rr=function(wn){De(!1),st(wn)},br=function(wn,In){wn.key==="Tab"&&Ft(),P==null||P(wn,In)},_r=m.useMemo(function(){return{prefixCls:d,locale:F,generateConfig:E,button:te.button,input:te.input}},[d,F,E,te.button,te.input]);return _a(function(){Re&&ke!==void 0&&It(null,N,!1)},[Re,ke,N]),_a(function(){var jo=Ee();!Re&&jo==="input"&&(De(!1),Ft()),!Re&&a&&!S&&jo==="panel"&&(De(!0),Ft())},[Re]),m.createElement(r5.Provider,{value:_r},m.createElement(HXe,go({},zXe(r),{popupElement:po,popupStyle:f.popup,popupClassName:p.popup,visible:Re,onClose:Ao}),m.createElement(JLt,go({},r,{ref:ye,suffixIcon:ie,removeIcon:Q,activeHelp:!!ot,allHelp:!!ot&&at==="preset",focused:nt,onFocus:ir,onBlur:Rr,onKeyDown:br,onSubmit:Ft,value:Bt,maskFormat:s,onChange:On,onInputChange:fo,internalPicker:i,format:l,inputReadOnly:$,disabled:v,open:Re,onOpenChange:De,onClick:Ve,onClear:ft,invalid:Gt,onInvalid:function(wn){Rt(wn,0)}}))))}var qLt=m.forwardRef(KLt);const rJe=m.createContext(null),$Lt=rJe.Provider,iJe=m.createContext(null),QLt=iJe.Provider;var ZLt=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],aJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=n===void 0?"rc-checkbox":n,r=t.className,i=t.style,a=t.checked,l=t.disabled,s=t.defaultChecked,c=s===void 0?!1:s,u=t.type,d=u===void 0?"checkbox":u,f=t.title,p=t.onChange,g=oi(t,ZLt),A=m.useRef(null),y=Es(c,{value:a}),S=sn(y,2),C=S[0],P=S[1];m.useImperativeHandle(e,function(){return{focus:function(x){var b;(b=A.current)===null||b===void 0||b.focus(x)},blur:function(){var x;(x=A.current)===null||x===void 0||x.blur()},input:A.current}});var v=Xn(o,r,Jt(Jt({},"".concat(o,"-checked"),C),"".concat(o,"-disabled"),l)),T=function(x){l||("checked"in t||P(x.target.checked),p==null||p({target:en(en({},t),{},{type:d,checked:x.target.checked}),stopPropagation:function(){x.stopPropagation()},preventDefault:function(){x.preventDefault()},nativeEvent:x.nativeEvent}))};return m.createElement("span",{className:v,title:f,style:i},m.createElement("input",go({},g,{className:"".concat(o,"-input"),ref:A,onChange:T,disabled:l,checked:!!C,type:d})),m.createElement("span",{className:"".concat(o,"-inner")}))});const eWt=t=>{const{componentCls:e,antCls:n}=t,o=`${e}-group`;return{[o]:Object.assign(Object.assign({},Na(t)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},tWt=t=>{const{componentCls:e,wrapperMarginInlineEnd:n,colorPrimary:o,radioSize:r,motionDurationSlow:i,motionDurationMid:a,motionEaseInOutCirc:l,colorBgContainer:s,colorBorder:c,lineWidth:u,colorBgContainerDisabled:d,colorTextDisabled:f,paddingXS:p,dotColorDisabled:g,lineType:A,radioColor:y,radioBgColor:S,calc:C}=t,P=`${e}-inner`,T=C(r).sub(C(4).mul(2)),w=C(1).mul(r).equal();return{[`${e}-wrapper`]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer",[`&${e}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:t.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${e}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${jt(u)} ${A} ${o}`,borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${e}-wrapper:hover &, &:hover ${P}`]:{borderColor:o},[`${e}-input:focus-visible + ${P}`]:Object.assign({},dw(t)),[`${e}:hover::after, ${e}-wrapper:hover &::after`]:{visibility:"visible"},[`${e}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:w,height:w,marginBlockStart:C(1).mul(r).div(-2).equal(),marginInlineStart:C(1).mul(r).div(-2).equal(),backgroundColor:y,borderBlockStart:0,borderInlineStart:0,borderRadius:w,transform:"scale(0)",opacity:0,transition:`all ${i} ${l}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:w,height:w,backgroundColor:s,borderColor:c,borderStyle:"solid",borderWidth:u,borderRadius:"50%",transition:`all ${a}`},[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${e}-checked`]:{[P]:{borderColor:o,backgroundColor:S,"&::after":{transform:`scale(${t.calc(t.dotSize).div(r).equal()})`,opacity:1,transition:`all ${i} ${l}`}}},[`${e}-disabled`]:{cursor:"not-allowed",[P]:{backgroundColor:d,borderColor:c,cursor:"not-allowed","&::after":{backgroundColor:g}},[`${e}-input`]:{cursor:"not-allowed"},[`${e}-disabled + span`]:{color:f,cursor:"not-allowed"},[`&${e}-checked`]:{[P]:{"&::after":{transform:`scale(${C(T).div(r).equal({unit:!1})})`}}}},[`span${e} + *`]:{paddingInlineStart:p,paddingInlineEnd:p}})}},nWt=t=>{const{buttonColor:e,controlHeight:n,componentCls:o,lineWidth:r,lineType:i,colorBorder:a,motionDurationSlow:l,motionDurationMid:s,buttonPaddingInline:c,fontSize:u,buttonBg:d,fontSizeLG:f,controlHeightLG:p,controlHeightSM:g,paddingXS:A,borderRadius:y,borderRadiusSM:S,borderRadiusLG:C,buttonCheckedBg:P,buttonSolidCheckedColor:v,colorTextDisabled:T,colorBgContainerDisabled:w,buttonCheckedBgDisabled:x,buttonCheckedColorDisabled:b,colorPrimary:R,colorPrimaryHover:H,colorPrimaryActive:F,buttonSolidCheckedBg:E,buttonSolidCheckedHoverBg:N,buttonSolidCheckedActiveBg:U,calc:W}=t;return{[`${o}-button-wrapper`]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:c,paddingBlock:0,color:e,fontSize:u,lineHeight:jt(W(n).sub(W(r).mul(2)).equal()),background:d,border:`${jt(r)} ${i} ${a}`,borderBlockStartWidth:W(r).add(.02).equal(),borderInlineStartWidth:0,borderInlineEndWidth:r,cursor:"pointer",transition:[`color ${s}`,`background ${s}`,`box-shadow ${s}`].join(","),a:{color:e},[`> ${o}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:W(r).mul(-1).equal(),insetInlineStart:W(r).mul(-1).equal(),display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:r,paddingInline:0,backgroundColor:a,transition:`background-color ${l}`,content:'""'}},"&:first-child":{borderInlineStart:`${jt(r)} ${i} ${a}`,borderStartStartRadius:y,borderEndStartRadius:y},"&:last-child":{borderStartEndRadius:y,borderEndEndRadius:y},"&:first-child:last-child":{borderRadius:y},[`${o}-group-large &`]:{height:p,fontSize:f,lineHeight:jt(W(p).sub(W(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:C,borderEndStartRadius:C},"&:last-child":{borderStartEndRadius:C,borderEndEndRadius:C}},[`${o}-group-small &`]:{height:g,paddingInline:W(A).sub(r).equal(),paddingBlock:0,lineHeight:jt(W(g).sub(W(r).mul(2)).equal()),"&:first-child":{borderStartStartRadius:S,borderEndStartRadius:S},"&:last-child":{borderStartEndRadius:S,borderEndEndRadius:S}},"&:hover":{position:"relative",color:R},"&:has(:focus-visible)":Object.assign({},dw(t)),[`${o}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${o}-button-wrapper-disabled)`]:{zIndex:1,color:R,background:P,borderColor:R,"&::before":{backgroundColor:R},"&:first-child":{borderColor:R},"&:hover":{color:H,borderColor:H,"&::before":{backgroundColor:H}},"&:active":{color:F,borderColor:F,"&::before":{backgroundColor:F}}},[`${o}-group-solid &-checked:not(${o}-button-wrapper-disabled)`]:{color:v,background:E,borderColor:E,"&:hover":{color:v,background:N,borderColor:N},"&:active":{color:v,background:U,borderColor:U}},"&-disabled":{color:T,backgroundColor:w,borderColor:a,cursor:"not-allowed","&:first-child, &:hover":{color:T,backgroundColor:w,borderColor:a}},[`&-disabled${o}-button-wrapper-checked`]:{color:b,backgroundColor:x,borderColor:a,boxShadow:"none"}}}},oWt=t=>{const{wireframe:e,padding:n,marginXS:o,lineWidth:r,fontSizeLG:i,colorText:a,colorBgContainer:l,colorTextDisabled:s,controlItemBgActiveDisabled:c,colorTextLightSolid:u,colorPrimary:d,colorPrimaryHover:f,colorPrimaryActive:p,colorWhite:g}=t,A=4,y=i,S=e?y-A*2:y-(A+r)*2;return{radioSize:y,dotSize:S,dotColorDisabled:s,buttonSolidCheckedColor:u,buttonSolidCheckedBg:d,buttonSolidCheckedHoverBg:f,buttonSolidCheckedActiveBg:p,buttonBg:l,buttonCheckedBg:l,buttonColor:a,buttonCheckedBgDisabled:c,buttonCheckedColorDisabled:s,buttonPaddingInline:n-r,wrapperMarginInlineEnd:o,radioColor:e?d:g,radioBgColor:e?l:d}},lJe=wl("Radio",t=>{const{controlOutline:e,controlOutlineWidth:n}=t,o=`0 0 0 ${jt(n)} ${e}`,i=qi(t,{radioFocusShadow:o,radioButtonFocusShadow:o});return[eWt(i),tWt(i),nWt(i)]},oWt,{unitless:{radioSize:!0,dotSize:!0}});var rWt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const r=m.useContext(rJe),i=m.useContext(iJe),{getPrefixCls:a,direction:l,radio:s}=m.useContext(Cr),c=m.useRef(null),u=o5(e,c),{isFormItemInput:d}=m.useContext(r1),f=U=>{var W,k;(W=t.onChange)===null||W===void 0||W.call(t,U),(k=r==null?void 0:r.onChange)===null||k===void 0||k.call(r,U)},{prefixCls:p,className:g,rootClassName:A,children:y,style:S,title:C}=t,P=rWt(t,["prefixCls","className","rootClassName","children","style","title"]),v=a("radio",p),T=((r==null?void 0:r.optionType)||i)==="button",w=T?`${v}-button`:v,x=Y0(v),[b,R,H]=lJe(v,x),F=Object.assign({},P),E=m.useContext(n1);r&&(F.name=r.name,F.onChange=f,F.checked=t.value===r.value,F.disabled=(n=F.disabled)!==null&&n!==void 0?n:r.disabled),F.disabled=(o=F.disabled)!==null&&o!==void 0?o:E;const N=Un(`${w}-wrapper`,{[`${w}-wrapper-checked`]:F.checked,[`${w}-wrapper-disabled`]:F.disabled,[`${w}-wrapper-rtl`]:l==="rtl",[`${w}-wrapper-in-form-item`]:d},s==null?void 0:s.className,g,A,R,H,x);return b(m.createElement(UW,{component:"Radio",disabled:F.disabled},m.createElement("label",{className:N,style:Object.assign(Object.assign({},s==null?void 0:s.style),S),onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,title:C},m.createElement(aJe,Object.assign({},F,{className:Un(F.className,!T&&U$),type:"radio",prefixCls:w,ref:u})),y!==void 0?m.createElement("span",null,y):null)))},XG=m.forwardRef(iWt),aWt=m.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o}=m.useContext(Cr),[r,i]=Z6(t.defaultValue,{value:t.value}),a=U=>{const W=r,k=U.target.value;"value"in t||i(k);const{onChange:D}=t;D&&k!==W&&D(U)},{prefixCls:l,className:s,rootClassName:c,options:u,buttonStyle:d="outline",disabled:f,children:p,size:g,style:A,id:y,onMouseEnter:S,onMouseLeave:C,onFocus:P,onBlur:v}=t,T=n("radio",l),w=`${T}-group`,x=Y0(T),[b,R,H]=lJe(T,x);let F=p;u&&u.length>0&&(F=u.map(U=>typeof U=="string"||typeof U=="number"?m.createElement(XG,{key:U.toString(),prefixCls:T,disabled:f,value:U,checked:r===U},U):m.createElement(XG,{key:`radio-group-value-options-${U.value}`,prefixCls:T,disabled:U.disabled||f,value:U.value,checked:r===U.value,title:U.title,style:U.style,id:U.id,required:U.required},U.label)));const E=zd(g),N=Un(w,`${w}-${d}`,{[`${w}-${E}`]:E,[`${w}-rtl`]:o==="rtl"},s,c,R,H,x);return b(m.createElement("div",Object.assign({},Pme(t,{aria:!0,data:!0}),{className:N,style:A,onMouseEnter:S,onMouseLeave:C,onFocus:P,onBlur:v,id:y,ref:e}),m.createElement($Lt,{value:{onChange:a,value:r,disabled:t.disabled,name:t.name,optionType:t.optionType}},F)))}),lWt=m.memo(aWt);var sWt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n}=m.useContext(Cr),{prefixCls:o}=t,r=sWt(t,["prefixCls"]),i=n("radio",o);return m.createElement(QLt,{value:"button"},m.createElement(XG,Object.assign({prefixCls:i},r,{type:"radio",ref:e})))},uWt=m.forwardRef(cWt),Le=XG;Le.Button=uWt;Le.Group=lWt;Le.__ANT_RADIO=!0;function QW(t){return qi(t,{inputAffixPadding:t.paddingXXS})}const ZW=t=>{const{controlHeight:e,fontSize:n,lineHeight:o,lineWidth:r,controlHeightSM:i,controlHeightLG:a,fontSizeLG:l,lineHeightLG:s,paddingSM:c,controlPaddingHorizontalSM:u,controlPaddingHorizontal:d,colorFillAlter:f,colorPrimaryHover:p,colorPrimary:g,controlOutlineWidth:A,controlOutline:y,colorErrorOutline:S,colorWarningOutline:C,colorBgContainer:P}=t;return{paddingBlock:Math.max(Math.round((e-n*o)/2*10)/10-r,0),paddingBlockSM:Math.max(Math.round((i-n*o)/2*10)/10-r,0),paddingBlockLG:Math.ceil((a-l*s)/2*10)/10-r,paddingInline:c-r,paddingInlineSM:u-r,paddingInlineLG:d-r,addonBg:f,activeBorderColor:g,hoverBorderColor:p,activeShadow:`0 0 0 ${A}px ${y}`,errorActiveShadow:`0 0 0 ${A}px ${S}`,warningActiveShadow:`0 0 0 ${A}px ${C}`,hoverBg:P,activeBg:P,inputFontSize:n,inputFontSizeLG:l,inputFontSizeSM:n}},dWt=t=>({borderColor:t.hoverBorderColor,backgroundColor:t.hoverBg}),dQ=t=>({color:t.colorTextDisabled,backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,boxShadow:"none",cursor:"not-allowed",opacity:1,"input[disabled], textarea[disabled]":{cursor:"not-allowed"},"&:hover:not([disabled])":Object.assign({},dWt(qi(t,{hoverBorderColor:t.colorBorder,hoverBg:t.colorBgContainerDisabled})))}),rye=(t,e)=>({background:t.colorBgContainer,borderWidth:t.lineWidth,borderStyle:t.lineType,borderColor:e.borderColor,"&:hover":{borderColor:e.hoverBorderColor,backgroundColor:t.hoverBg},"&:focus, &:focus-within":{borderColor:e.activeBorderColor,boxShadow:e.activeShadow,outline:0,backgroundColor:t.activeBg}}),uxe=(t,e)=>({[`&${t.componentCls}-status-${e.status}:not(${t.componentCls}-disabled)`]:Object.assign(Object.assign({},rye(t,e)),{[`${t.componentCls}-prefix, ${t.componentCls}-suffix`]:{color:e.affixColor}}),[`&${t.componentCls}-status-${e.status}${t.componentCls}-disabled`]:{borderColor:e.borderColor}}),iye=(t,e)=>({"&-outlined":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},rye(t,{borderColor:t.colorBorder,hoverBorderColor:t.hoverBorderColor,activeBorderColor:t.activeBorderColor,activeShadow:t.activeShadow})),{[`&${t.componentCls}-disabled, &[disabled]`]:Object.assign({},dQ(t))}),uxe(t,{status:"error",borderColor:t.colorError,hoverBorderColor:t.colorErrorBorderHover,activeBorderColor:t.colorError,activeShadow:t.errorActiveShadow,affixColor:t.colorError})),uxe(t,{status:"warning",borderColor:t.colorWarning,hoverBorderColor:t.colorWarningBorderHover,activeBorderColor:t.colorWarning,activeShadow:t.warningActiveShadow,affixColor:t.colorWarning})),e)}),dxe=(t,e)=>({[`&${t.componentCls}-group-wrapper-status-${e.status}`]:{[`${t.componentCls}-group-addon`]:{borderColor:e.addonBorderColor,color:e.addonColor}}}),sJe=t=>({"&-outlined":Object.assign(Object.assign(Object.assign({[`${t.componentCls}-group`]:{"&-addon":{background:t.addonBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},"&-addon:first-child":{borderInlineEnd:0},"&-addon:last-child":{borderInlineStart:0}}},dxe(t,{status:"error",addonBorderColor:t.colorError,addonColor:t.colorErrorText})),dxe(t,{status:"warning",addonBorderColor:t.colorWarning,addonColor:t.colorWarningText})),{[`&${t.componentCls}-group-wrapper-disabled`]:{[`${t.componentCls}-group-addon`]:Object.assign({},dQ(t))}})}),aye=(t,e)=>({"&-borderless":Object.assign({background:"transparent",border:"none","&:focus, &:focus-within":{outline:"none"},[`&${t.componentCls}-disabled, &[disabled]`]:{color:t.colorTextDisabled}},e)}),cJe=(t,e)=>({background:e.bg,borderWidth:t.lineWidth,borderStyle:t.lineType,borderColor:"transparent","input&, & input, textarea&, & textarea":{color:e==null?void 0:e.inputColor},"&:hover":{background:e.hoverBg},"&:focus, &:focus-within":{outline:0,borderColor:e.activeBorderColor,backgroundColor:t.activeBg}}),fxe=(t,e)=>({[`&${t.componentCls}-status-${e.status}:not(${t.componentCls}-disabled)`]:Object.assign(Object.assign({},cJe(t,e)),{[`${t.componentCls}-prefix, ${t.componentCls}-suffix`]:{color:e.affixColor}})}),lye=(t,e)=>({"&-filled":Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},cJe(t,{bg:t.colorFillTertiary,hoverBg:t.colorFillSecondary,activeBorderColor:t.colorPrimary})),{[`&${t.componentCls}-disabled, &[disabled]`]:Object.assign({},dQ(t))}),fxe(t,{status:"error",bg:t.colorErrorBg,hoverBg:t.colorErrorBgHover,activeBorderColor:t.colorError,inputColor:t.colorErrorText,affixColor:t.colorError})),fxe(t,{status:"warning",bg:t.colorWarningBg,hoverBg:t.colorWarningBgHover,activeBorderColor:t.colorWarning,inputColor:t.colorWarningText,affixColor:t.colorWarning})),e)}),hxe=(t,e)=>({[`&${t.componentCls}-group-wrapper-status-${e.status}`]:{[`${t.componentCls}-group-addon`]:{background:e.addonBg,color:e.addonColor}}}),uJe=t=>({"&-filled":Object.assign(Object.assign(Object.assign({[`${t.componentCls}-group`]:{"&-addon":{background:t.colorFillTertiary},[`${t.componentCls}-filled:not(:focus):not(:focus-within)`]:{"&:not(:first-child)":{borderInlineStart:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},"&:not(:last-child)":{borderInlineEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`}}}},hxe(t,{status:"error",addonBg:t.colorErrorBg,addonColor:t.colorErrorText})),hxe(t,{status:"warning",addonBg:t.colorWarningBg,addonColor:t.colorWarningText})),{[`&${t.componentCls}-group-wrapper-disabled`]:{[`${t.componentCls}-group`]:{"&-addon":{background:t.colorFillTertiary,color:t.colorTextDisabled},"&-addon:first-child":{borderInlineStart:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},"&-addon:last-child":{borderInlineEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`}}}})}),sye=t=>({"&::-moz-placeholder":{opacity:1},"&::placeholder":{color:t,userSelect:"none"},"&:placeholder-shown":{textOverflow:"ellipsis"}}),dJe=t=>{const{paddingBlockLG:e,lineHeightLG:n,borderRadiusLG:o,paddingInlineLG:r}=t;return{padding:`${jt(e)} ${jt(r)}`,fontSize:t.inputFontSizeLG,lineHeight:n,borderRadius:o}},cye=t=>({padding:`${jt(t.paddingBlockSM)} ${jt(t.paddingInlineSM)}`,fontSize:t.inputFontSizeSM,borderRadius:t.borderRadiusSM}),eN=t=>Object.assign(Object.assign({position:"relative",display:"inline-block",width:"100%",minWidth:0,padding:`${jt(t.paddingBlock)} ${jt(t.paddingInline)}`,color:t.colorText,fontSize:t.inputFontSize,lineHeight:t.lineHeight,borderRadius:t.borderRadius,transition:`all ${t.motionDurationMid}`},sye(t.colorTextPlaceholder)),{"textarea&":{maxWidth:"100%",height:"auto",minHeight:t.controlHeight,lineHeight:t.lineHeight,verticalAlign:"bottom",transition:`all ${t.motionDurationSlow}, height 0s`,resize:"vertical"},"&-lg":Object.assign({},dJe(t)),"&-sm":Object.assign({},cye(t)),"&-rtl":{direction:"rtl"},"&-textarea-rtl":{direction:"rtl"}}),fJe=t=>{const{componentCls:e,antCls:n}=t;return{position:"relative",display:"table",width:"100%",borderCollapse:"separate",borderSpacing:0,"&[class*='col-']":{paddingInlineEnd:t.paddingXS,"&:last-child":{paddingInlineEnd:0}},[`&-lg ${e}, &-lg > ${e}-group-addon`]:Object.assign({},dJe(t)),[`&-sm ${e}, &-sm > ${e}-group-addon`]:Object.assign({},cye(t)),[`&-lg ${n}-select-single ${n}-select-selector`]:{height:t.controlHeightLG},[`&-sm ${n}-select-single ${n}-select-selector`]:{height:t.controlHeightSM},[`> ${e}`]:{display:"table-cell","&:not(:first-child):not(:last-child)":{borderRadius:0}},[`${e}-group`]:{"&-addon, &-wrap":{display:"table-cell",width:1,whiteSpace:"nowrap",verticalAlign:"middle","&:not(:first-child):not(:last-child)":{borderRadius:0}},"&-wrap > *":{display:"block !important"},"&-addon":{position:"relative",padding:`0 ${jt(t.paddingInline)}`,color:t.colorText,fontWeight:"normal",fontSize:t.inputFontSize,textAlign:"center",borderRadius:t.borderRadius,transition:`all ${t.motionDurationSlow}`,lineHeight:1,[`${n}-select`]:{margin:`${jt(t.calc(t.paddingBlock).add(1).mul(-1).equal())} ${jt(t.calc(t.paddingInline).mul(-1).equal())}`,[`&${n}-select-single:not(${n}-select-customize-input):not(${n}-pagination-size-changer)`]:{[`${n}-select-selector`]:{backgroundColor:"inherit",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,boxShadow:"none"}},"&-open, &-focused":{[`${n}-select-selector`]:{color:t.colorPrimary}}},[`${n}-cascader-picker`]:{margin:`-9px ${jt(t.calc(t.paddingInline).mul(-1).equal())}`,backgroundColor:"transparent",[`${n}-cascader-input`]:{textAlign:"start",border:0,boxShadow:"none"}}}},[`${e}`]:{width:"100%",marginBottom:0,textAlign:"inherit","&:focus":{zIndex:1,borderInlineEndWidth:1},"&:hover":{zIndex:1,borderInlineEndWidth:1,[`${e}-search-with-button &`]:{zIndex:0}}},[`> ${e}:first-child, ${e}-group-addon:first-child`]:{borderStartEndRadius:0,borderEndEndRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${e}-affix-wrapper`]:{[`&:not(:first-child) ${e}`]:{borderStartStartRadius:0,borderEndStartRadius:0},[`&:not(:last-child) ${e}`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`> ${e}:last-child, ${e}-group-addon:last-child`]:{borderStartStartRadius:0,borderEndStartRadius:0,[`${n}-select ${n}-select-selector`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`${e}-affix-wrapper`]:{"&:not(:last-child)":{borderStartEndRadius:0,borderEndEndRadius:0,[`${e}-search &`]:{borderStartStartRadius:t.borderRadius,borderEndStartRadius:t.borderRadius}},[`&:not(:first-child), ${e}-search &:not(:first-child)`]:{borderStartStartRadius:0,borderEndStartRadius:0}},[`&${e}-group-compact`]:Object.assign(Object.assign({display:"block"},ik()),{[`${e}-group-addon, ${e}-group-wrap, > ${e}`]:{"&:not(:first-child):not(:last-child)":{borderInlineEndWidth:t.lineWidth,"&:hover":{zIndex:1},"&:focus":{zIndex:1}}},"& > *":{display:"inline-block",float:"none",verticalAlign:"top",borderRadius:0},[` & > ${e}-affix-wrapper, & > ${e}-number-affix-wrapper, @@ -4592,9 +4592,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &${n}-slide-up-leave${n}-slide-up-leave-active${e}-dropdown-placement-bottomRight`]:{animationName:V$},[`${e}-panel > ${e}-time-panel`]:{paddingTop:x},[`${e}-range-wrapper`]:{display:"flex",position:"relative"},[`${e}-range-arrow`]:Object.assign(Object.assign({position:"absolute",zIndex:1,display:"none",paddingInline:t.calc(r).mul(1.5).equal(),boxSizing:"content-box",transition:`left ${T} ease-out`},KGe(t,R,D)),{"&:before":{insetInlineStart:t.calc(r).mul(1.5).equal()}}),[`${e}-panel-container`]:{overflow:"hidden",verticalAlign:"top",background:R,borderRadius:H,boxShadow:F,transition:`margin ${T}`,display:"inline-block",pointerEvents:"auto",[`${e}-panel-layout`]:{display:"flex",flexWrap:"nowrap",alignItems:"stretch"},[`${e}-presets`]:{display:"flex",flexDirection:"column",minWidth:W,maxWidth:k,ul:{height:0,flex:"auto",listStyle:"none",overflow:"auto",margin:0,padding:y,borderInlineEnd:`${jt(i)} ${a} ${N}`,li:Object.assign(Object.assign({},qx),{borderRadius:E,paddingInline:y,paddingBlock:t.calc(g).sub(L).div(2).equal(),cursor:"pointer",transition:`all ${T}`,"+ li":{marginTop:S},"&:hover":{background:U}})}},[`${e}-panels`]:{display:"inline-flex",flexWrap:"nowrap",direction:"ltr","&:last-child":{[`${e}-panel`]:{borderWidth:0}}},[`${e}-panel`]:{verticalAlign:"top",background:"transparent",borderRadius:0,borderWidth:0,[`${e}-content, table`]:{textAlign:"center"},"&-focused":{borderColor:l}}}}),"&-dropdown-range":{padding:`${jt(t.calc(b).mul(2).div(3).equal())} 0`,"&-hidden":{display:"none"}},"&-rtl":{direction:"rtl",[`${e}-separator`]:{transform:"rotate(180deg)"},[`${e}-footer`]:{"&-extra":{direction:"rtl"}}}})},V9(t,"slide-up"),V9(t,"slide-down"),xR(t,"move-up"),xR(t,"move-down")]},hJe=wl("DatePicker",t=>{const e=qi(QW(t),SWt(t),{inputPaddingHorizontalBase:t.calc(t.paddingSM).sub(1).equal(),multipleSelectItemHeight:t.multipleItemHeight,selectHeight:t.controlHeight});return[bWt(e),HWt(e),CWt(e),RWt(e),wWt(e),jW(t,{focusElCls:`${t.componentCls}-focused`})]},PWt);var MWt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM288 604a64 64 0 10128 0 64 64 0 10-128 0zm118-224a48 48 0 1096 0 48 48 0 10-96 0zm158 228a96 96 0 10192 0 96 96 0 10-192 0zm148-314a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"dot-chart",theme:"outlined"},IWt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:MWt}))},zWt=m.forwardRef(IWt),DWt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},EWt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:DWt}))},FWt=m.forwardRef(EWt);function H9(){return H9=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function JG(t,e){if(t==null)return{};var n=jWt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}const fQ=m.createContext(null);function BWt(t){if(Array.isArray(t))return pue(t)}function YWt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function OWt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gxe(t){return BWt(t)||YWt(t)||pJe(t)||OWt()}var VWt=function(e){var n=e.activeTabOffset,o=e.horizontal,r=e.rtl,i=e.indicator,a=i===void 0?{}:i,l=a.size,s=a.align,c=s===void 0?"center":s,u=m.useState(),d=Lc(u,2),f=d[0],p=d[1],g=m.useRef(),A=be.useCallback(function(S){return typeof l=="function"?l(S):typeof l=="number"?l:S},[l]);function y(){Ea.cancel(g.current)}return m.useEffect(function(){var S={};if(n)if(o){S.width=A(n.width);var C=r?"right":"left";c==="start"&&(S[C]=n[C]),c==="center"&&(S[C]=n[C]+n.width/2,S.transform=r?"translateX(50%)":"translateX(-50%)"),c==="end"&&(S[C]=n[C]+n.width,S.transform="translateX(-100%)")}else S.height=A(n.height),c==="start"&&(S.top=n.top),c==="center"&&(S.top=n.top+n.height/2,S.transform="translateY(-50%)"),c==="end"&&(S.top=n.top+n.height,S.transform="translateY(-100%)");return y(),g.current=Ea(function(){p(S)}),y},[n,o,r,c,A]),{style:f}},mxe={width:0,height:0,left:0,top:0};function _Wt(t,e,n){return m.useMemo(function(){for(var o,r=new Map,i=e.get((o=t[0])===null||o===void 0?void 0:o.key)||mxe,a=i.left+i.width,l=0;lU?(E=H,w.current="x"):(E=F,w.current="y"),e(-E,-E)&&R.preventDefault()}var b=m.useRef(null);b.current={onTouchStart:P,onTouchMove:v,onTouchEnd:T,onWheel:x},m.useEffect(function(){function R(N){b.current.onTouchStart(N)}function H(N){b.current.onTouchMove(N)}function F(N){b.current.onTouchEnd(N)}function E(N){b.current.onWheel(N)}return document.addEventListener("touchmove",H,{passive:!1}),document.addEventListener("touchend",F,{passive:!1}),t.current.addEventListener("touchstart",R,{passive:!1}),t.current.addEventListener("wheel",E),function(){document.removeEventListener("touchmove",H),document.removeEventListener("touchend",F)}},[])}function gJe(t){var e=m.useState(0),n=Lc(e,2),o=n[0],r=n[1],i=m.useRef(0),a=m.useRef();return a.current=t,yx(function(){var l;(l=a.current)===null||l===void 0||l.call(a)},[o]),function(){i.current===o&&(i.current+=1,r(i.current))}}function JWt(t){var e=m.useRef([]),n=m.useState({}),o=Lc(n,2),r=o[1],i=m.useRef(typeof t=="function"?t():t),a=gJe(function(){var s=i.current;e.current.forEach(function(c){s=c(s)}),e.current=[],i.current=s,r({})});function l(s){e.current.push(s),a()}return[i.current,l]}var vxe={width:0,height:0,left:0,top:0,right:0};function KWt(t,e,n,o,r,i,a){var l=a.tabs,s=a.tabPosition,c=a.rtl,u,d,f;return["top","bottom"].includes(s)?(u="width",d=c?"right":"left",f=Math.abs(n)):(u="height",d="top",f=-n),m.useMemo(function(){if(!l.length)return[0,0];for(var p=l.length,g=p,A=0;Af+e){g=A-1;break}}for(var S=0,C=p-1;C>=0;C-=1){var P=t.get(l[C].key)||vxe;if(P[d]=g?[0,0]:[S,g]},[t,e,o,r,i,f,s,l.map(function(p){return p.key}).join("_"),c])}function xxe(t){var e;return t instanceof Map?(e={},t.forEach(function(n,o){e[o]=n})):e=t,JSON.stringify(e)}var qWt="TABS_DQ";function mJe(t){return String(t).replace(/"/g,qWt)}function yJe(t,e,n,o){return!(!n||o||t===!1||t===void 0&&(e===!1||e===null))}var AJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.editable,r=t.locale,i=t.style;return!o||o.showAdd===!1?null:m.createElement("button",{ref:e,type:"button",className:"".concat(n,"-nav-add"),style:i,"aria-label":(r==null?void 0:r.addAriaLabel)||"Add tab",onClick:function(l){o.onEdit("add",{event:l})}},o.addIcon||"+")}),bxe=m.forwardRef(function(t,e){var n=t.position,o=t.prefixCls,r=t.extra;if(!r)return null;var i,a={};return pw(r)==="object"&&!m.isValidElement(r)?a=r:a.right=r,n==="right"&&(i=a.right),n==="left"&&(i=a.left),i?m.createElement("div",{className:"".concat(o,"-extra-content"),ref:e},i):null}),$Wt=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.id,r=t.tabs,i=t.locale,a=t.mobile,l=t.more,s=l===void 0?{}:l,c=t.style,u=t.className,d=t.editable,f=t.tabBarGutter,p=t.rtl,g=t.removeAriaLabel,A=t.onTabClick,y=t.getPopupContainer,S=t.popupClassName,C=m.useState(!1),P=Lc(C,2),v=P[0],T=P[1],w=m.useState(null),x=Lc(w,2),b=x[0],R=x[1],H=s.icon,F=H===void 0?"More":H,E="".concat(o,"-more-popup"),N="".concat(n,"-dropdown"),U=b!==null?"".concat(E,"-").concat(b):null,W=i==null?void 0:i.dropdownAriaLabel;function k(G,q){G.preventDefault(),G.stopPropagation(),d.onEdit("remove",{key:q,event:G})}var D=m.createElement(GH,{onClick:function(q){var $=q.key,ie=q.domEvent;A($,ie),T(!1)},prefixCls:"".concat(N,"-menu"),id:E,tabIndex:-1,role:"listbox","aria-activedescendant":U,selectedKeys:[b],"aria-label":W!==void 0?W:"expanded dropdown"},r.map(function(G){var q=G.closable,$=G.disabled,ie=G.closeIcon,Q=G.key,se=G.label,Z=yJe(q,ie,d,$);return m.createElement(qW,{key:Q,id:"".concat(E,"-").concat(Q),role:"option","aria-controls":o&&"".concat(o,"-panel-").concat(Q),disabled:$},m.createElement("span",null,se),Z&&m.createElement("button",{type:"button","aria-label":g||"remove",tabIndex:0,className:"".concat(N,"-menu-item-remove"),onClick:function(te){te.stopPropagation(),k(te,Q)}},ie||d.removeIcon||"×"))}));function L(G){for(var q=r.filter(function(Z){return!Z.disabled}),$=q.findIndex(function(Z){return Z.key===b})||0,ie=q.length,Q=0;Qct?"left":"right"})}),N=Lc(E,2),U=N[0],W=N[1],k=yxe(0,function(ht,ct){!F&&A&&A({direction:ht>ct?"top":"bottom"})}),D=Lc(k,2),L=D[0],j=D[1],B=m.useState([0,0]),O=Lc(B,2),V=O[0],G=O[1],q=m.useState([0,0]),$=Lc(q,2),ie=$[0],Q=$[1],se=m.useState([0,0]),Z=Lc(se,2),ee=Z[0],te=Z[1],oe=m.useState([0,0]),de=Lc(oe,2),he=de[0],pe=de[1],me=JWt(new Map),le=Lc(me,2),Te=le[0],ge=le[1],Se=_Wt(P,Te,ie[0]),Re=UY(V,F),De=UY(ie,F),Ae=UY(ee,F),ue=UY(he,F),fe=ReIe?Ie:ht}var ze=m.useRef(null),Ne=m.useState(),Je=Lc(Ne,2),Ue=Je[0],nt=Je[1];function We(){nt(Date.now())}function Ee(){ze.current&&clearTimeout(ze.current)}XWt(x,function(ht,ct){function It(Ft,Ve){Ft(function(ft){var kt=Me(ft+Ve);return kt})}return fe?(F?It(W,ht):It(j,ct),Ee(),We(),!0):!1}),m.useEffect(function(){return Ee(),Ue&&(ze.current=setTimeout(function(){nt(0)},100)),Ee},[Ue]);var ke=KWt(Se,ve,F?U:L,De,Ae,ue,Nm(Nm({},t),{},{tabs:P})),Oe=Lc(ke,2),st=Oe[0],je=Oe[1],xt=za(function(){var ht=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a,ct=Se.get(ht)||{width:0,height:0,left:0,right:0,top:0};if(F){var It=U;l?ct.rightU+ve&&(It=ct.right+ct.width-ve):ct.left<-U?It=-ct.left:ct.left+ct.width>-U+ve&&(It=-(ct.left+ct.width-ve)),j(0),W(Me(It))}else{var Ft=L;ct.top<-L?Ft=-ct.top:ct.top+ct.height>-L+ve&&(Ft=-(ct.top+ct.height-ve)),W(0),j(Me(Ft))}}),gt={};d==="top"||d==="bottom"?gt[l?"marginRight":"marginLeft"]=f:gt.marginTop=f;var Ye=P.map(function(ht,ct){var It=ht.key;return m.createElement(ZWt,{id:r,prefixCls:C,key:It,tab:ht,style:ct===0?void 0:gt,closable:ht.closable,editable:c,active:It===a,renderWrapper:p,removeAriaLabel:u==null?void 0:u.removeAriaLabel,onClick:function(Ve){g(It,Ve)},onFocus:function(){xt(It),We(),x.current&&(l||(x.current.scrollLeft=0),x.current.scrollTop=0)}})}),it=function(){return ge(function(){var ct,It=new Map,Ft=(ct=b.current)===null||ct===void 0?void 0:ct.getBoundingClientRect();return P.forEach(function(Ve){var ft,kt=Ve.key,rt=(ft=b.current)===null||ft===void 0?void 0:ft.querySelector('[data-node-key="'.concat(mJe(kt),'"]'));if(rt){var at=eNt(rt,Ft),Ge=Lc(at,4),yt=Ge[0],Pt=Ge[1],ot=Ge[2],bt=Ge[3];It.set(kt,{width:yt,height:Pt,left:ot,top:bt})}}),It})};m.useEffect(function(){it()},[P.map(function(ht){return ht.key}).join("_")]);var ut=gJe(function(){var ht=BT(v),ct=BT(T),It=BT(w);G([ht[0]-ct[0]-It[0],ht[1]-ct[1]-It[1]]);var Ft=BT(H);te(Ft);var Ve=BT(R);pe(Ve);var ft=BT(b);Q([ft[0]-Ft[0],ft[1]-Ft[1]]),it()}),Qe=P.slice(0,st),lt=P.slice(je+1),Ze=[].concat(gxe(Qe),gxe(lt)),Be=Se.get(a),$e=VWt({activeTabOffset:Be,horizontal:F,indicator:y,rtl:l}),wt=$e.style;m.useEffect(function(){xt()},[a,Pe,Ie,xxe(Be),xxe(Se),F]),m.useEffect(function(){ut()},[l]);var vt=!!Ze.length,Rt="".concat(C,"-nav-wrap"),Gt,At,pt,Wt;return F?l?(At=U>0,Gt=U!==Ie):(Gt=U<0,At=U!==Pe):(pt=L<0,Wt=L!==Pe),m.createElement(Cd,{onResize:ut},m.createElement("div",{ref:Nw(e,v),role:"tablist",className:Xn("".concat(C,"-nav"),n),style:o,onKeyDown:function(){We()}},m.createElement(bxe,{ref:T,position:"left",extra:s,prefixCls:C}),m.createElement(Cd,{onResize:ut},m.createElement("div",{className:Xn(Rt,np(np(np(np({},"".concat(Rt,"-ping-left"),Gt),"".concat(Rt,"-ping-right"),At),"".concat(Rt,"-ping-top"),pt),"".concat(Rt,"-ping-bottom"),Wt)),ref:x},m.createElement(Cd,{onResize:ut},m.createElement("div",{ref:b,className:"".concat(C,"-nav-list"),style:{transform:"translate(".concat(U,"px, ").concat(L,"px)"),transition:Ue?"none":void 0}},Ye,m.createElement(AJe,{ref:H,prefixCls:C,locale:u,editable:c,style:Nm(Nm({},Ye.length===0?void 0:gt),{},{visibility:vt?"hidden":null})}),m.createElement("div",{className:Xn("".concat(C,"-ink-bar"),np({},"".concat(C,"-ink-bar-animated"),i.inkBar)),style:wt}))))),m.createElement(QWt,H9({},t,{removeAriaLabel:u==null?void 0:u.removeAriaLabel,ref:R,prefixCls:C,tabs:Ze,className:!vt&&we,tabMoving:!!Ue})),m.createElement(bxe,{ref:w,position:"right",extra:s,prefixCls:C})))}),wJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.id,a=t.active,l=t.tabKey,s=t.children;return m.createElement("div",{id:i&&"".concat(i,"-panel-").concat(l),role:"tabpanel",tabIndex:a?0:-1,"aria-labelledby":i&&"".concat(i,"-tab-").concat(l),"aria-hidden":!a,style:r,className:Xn(n,a&&"".concat(n,"-active"),o),ref:e},s)}),tNt=["renderTabBar"],nNt=["label","key"],oNt=function(e){var n=e.renderTabBar,o=JG(e,tNt),r=m.useContext(fQ),i=r.tabs;if(n){var a=Nm(Nm({},o),{},{panes:i.map(function(l){var s=l.label,c=l.key,u=JG(l,nNt);return m.createElement(wJe,H9({tab:s,key:c,tabKey:c},u))})});return n(a,Sxe)}return m.createElement(Sxe,o)},rNt=["key","forceRender","style","className","destroyInactiveTabPane"],iNt=function(e){var n=e.id,o=e.activeKey,r=e.animated,i=e.tabPosition,a=e.destroyInactiveTabPane,l=m.useContext(fQ),s=l.prefixCls,c=l.tabs,u=r.tabPane,d="".concat(s,"-tabpane");return m.createElement("div",{className:Xn("".concat(s,"-content-holder"))},m.createElement("div",{className:Xn("".concat(s,"-content"),"".concat(s,"-content-").concat(i),np({},"".concat(s,"-content-animated"),u))},c.map(function(f){var p=f.key,g=f.forceRender,A=f.style,y=f.className,S=f.destroyInactiveTabPane,C=JG(f,rNt),P=p===o;return m.createElement(o1,H9({key:p,visible:P,forceRender:g,removeOnLeave:!!(a||S),leavedClassName:"".concat(d,"-hidden")},r.tabPaneMotion),function(v,T){var w=v.style,x=v.className;return m.createElement(wJe,H9({},C,{prefixCls:d,id:n,tabKey:p,animated:u,active:P,style:Nm(Nm({},A),w),className:Xn(y,x),ref:T}))})})))};function aNt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},e;return t===!1?e={inkBar:!1,tabPane:!1}:t===!0?e={inkBar:!0,tabPane:!1}:e=Nm({inkBar:!0},pw(t)==="object"?t:{}),e.tabPaneMotion&&e.tabPane===void 0&&(e.tabPane=!0),!e.tabPaneMotion&&e.tabPane&&(e.tabPane=!1),e}var lNt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],Txe=0,sNt=m.forwardRef(function(t,e){var n=t.id,o=t.prefixCls,r=o===void 0?"rc-tabs":o,i=t.className,a=t.items,l=t.direction,s=t.activeKey,c=t.defaultActiveKey,u=t.editable,d=t.animated,f=t.tabPosition,p=f===void 0?"top":f,g=t.tabBarGutter,A=t.tabBarStyle,y=t.tabBarExtraContent,S=t.locale,C=t.more,P=t.destroyInactiveTabPane,v=t.renderTabBar,T=t.onChange,w=t.onTabClick,x=t.onTabScroll,b=t.getPopupContainer,R=t.popupClassName,H=t.indicator,F=JG(t,lNt),E=m.useMemo(function(){return(a||[]).filter(function(he){return he&&pw(he)==="object"&&"key"in he})},[a]),N=l==="rtl",U=aNt(d),W=m.useState(!1),k=Lc(W,2),D=k[0],L=k[1];m.useEffect(function(){L(X$())},[]);var j=Es(function(){var he;return(he=E[0])===null||he===void 0?void 0:he.key},{value:s,defaultValue:c}),B=Lc(j,2),O=B[0],V=B[1],G=m.useState(function(){return E.findIndex(function(he){return he.key===O})}),q=Lc(G,2),$=q[0],ie=q[1];m.useEffect(function(){var he=E.findIndex(function(me){return me.key===O});if(he===-1){var pe;he=Math.max(0,Math.min($,E.length-1)),V((pe=E[he])===null||pe===void 0?void 0:pe.key)}ie(he)},[E.map(function(he){return he.key}).join("_"),O,$]);var Q=Es(null,{value:n}),se=Lc(Q,2),Z=se[0],ee=se[1];m.useEffect(function(){n||(ee("rc-tabs-".concat(Txe)),Txe+=1)},[]);function te(he,pe){w==null||w(he,pe);var me=he!==O;V(he),me&&(T==null||T(he))}var oe={id:Z,activeKey:O,animated:U,tabPosition:p,rtl:N,mobile:D},de=Nm(Nm({},oe),{},{editable:u,locale:S,more:C,tabBarGutter:g,onTabClick:te,onTabScroll:x,extra:y,style:A,panes:null,getPopupContainer:b,popupClassName:R,indicator:H});return m.createElement(fQ.Provider,{value:{tabs:E,prefixCls:r}},m.createElement("div",H9({ref:e,id:n,className:Xn(r,"".concat(r,"-").concat(p),np(np(np({},"".concat(r,"-mobile"),D),"".concat(r,"-editable"),u),"".concat(r,"-rtl"),N),i)},F),m.createElement(oNt,H9({},de,{renderTabBar:v})),m.createElement(iNt,H9({destroyInactiveTabPane:P},oe,{animated:U}))))});const cNt={motionAppear:!1,motionEnter:!0,motionLeave:!0};function uNt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inkBar:!0,tabPane:!1},n;return e===!1?n={inkBar:!1,tabPane:!1}:e===!0?n={inkBar:!0,tabPane:!0}:n=Object.assign({inkBar:!0},typeof e=="object"?e:{}),n.tabPane&&(n.tabPaneMotion=Object.assign(Object.assign({},cNt),{motionName:B9(t,"switch")})),n}var dNt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re)}function hNt(t,e){if(t)return t;const n=Y9(e).map(o=>{if(m.isValidElement(o)){const{key:r,props:i}=o,a=i||{},{tab:l}=a,s=dNt(a,["tab"]);return Object.assign(Object.assign({key:String(r)},s),{label:l})}return null});return fNt(n)}const pNt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return[{[e]:{[`${e}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[V9(t,"slide-up"),V9(t,"slide-down")]]},gNt=t=>{const{componentCls:e,tabsCardPadding:n,cardBg:o,cardGutter:r,colorBorderSecondary:i,itemSelectedColor:a}=t;return{[`${e}-card`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{margin:0,padding:n,background:o,border:`${jt(t.lineWidth)} ${t.lineType} ${i}`,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`},[`${e}-tab-active`]:{color:a,background:t.colorBgContainer},[`${e}-ink-bar`]:{visibility:"hidden"}},[`&${e}-top, &${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginLeft:{_skip_check_:!0,value:jt(r)}}}},[`&${e}-top`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`},[`${e}-tab-active`]:{borderBottomColor:t.colorBgContainer}}},[`&${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`},[`${e}-tab-active`]:{borderTopColor:t.colorBgContainer}}},[`&${e}-left, &${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginTop:jt(r)}}},[`&${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadiusLG)} 0 0 ${jt(t.borderRadiusLG)}`}},[`${e}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:t.colorBgContainer}}}},[`&${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0`}},[`${e}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:t.colorBgContainer}}}}}}},mNt=t=>{const{componentCls:e,itemHoverColor:n,dropdownEdgeChildVerticalPadding:o}=t;return{[`${e}-dropdown`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:t.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${e}-dropdown-menu`]:{maxHeight:t.tabsDropdownHeight,margin:0,padding:`${jt(o)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:t.colorBgContainer,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,"&-item":Object.assign(Object.assign({},qx),{display:"flex",alignItems:"center",minWidth:t.tabsDropdownWidth,margin:0,padding:`${jt(t.paddingXXS)} ${jt(t.paddingSM)}`,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:t.marginSM},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:t.controlItemBgHover},"&-disabled":{"&, &:hover":{color:t.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},yNt=t=>{const{componentCls:e,margin:n,colorBorderSecondary:o,horizontalMargin:r,verticalItemPadding:i,verticalItemMargin:a,calc:l}=t;return{[`${e}-top, ${e}-bottom`]:{flexDirection:"column",[`> ${e}-nav, > div > ${e}-nav`]:{margin:r,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${o}`,content:"''"},[`${e}-ink-bar`]:{height:t.lineWidthBold,"&-animated":{transition:`width ${t.motionDurationSlow}, left ${t.motionDurationSlow}, +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gxe(t){return BWt(t)||YWt(t)||pJe(t)||OWt()}var VWt=function(e){var n=e.activeTabOffset,o=e.horizontal,r=e.rtl,i=e.indicator,a=i===void 0?{}:i,l=a.size,s=a.align,c=s===void 0?"center":s,u=m.useState(),d=Lc(u,2),f=d[0],p=d[1],g=m.useRef(),A=be.useCallback(function(S){return typeof l=="function"?l(S):typeof l=="number"?l:S},[l]);function y(){Ea.cancel(g.current)}return m.useEffect(function(){var S={};if(n)if(o){S.width=A(n.width);var C=r?"right":"left";c==="start"&&(S[C]=n[C]),c==="center"&&(S[C]=n[C]+n.width/2,S.transform=r?"translateX(50%)":"translateX(-50%)"),c==="end"&&(S[C]=n[C]+n.width,S.transform="translateX(-100%)")}else S.height=A(n.height),c==="start"&&(S.top=n.top),c==="center"&&(S.top=n.top+n.height/2,S.transform="translateY(-50%)"),c==="end"&&(S.top=n.top+n.height,S.transform="translateY(-100%)");return y(),g.current=Ea(function(){p(S)}),y},[n,o,r,c,A]),{style:f}},mxe={width:0,height:0,left:0,top:0};function _Wt(t,e,n){return m.useMemo(function(){for(var o,r=new Map,i=e.get((o=t[0])===null||o===void 0?void 0:o.key)||mxe,a=i.left+i.width,l=0;lU?(E=H,w.current="x"):(E=F,w.current="y"),e(-E,-E)&&R.preventDefault()}var b=m.useRef(null);b.current={onTouchStart:P,onTouchMove:v,onTouchEnd:T,onWheel:x},m.useEffect(function(){function R(N){b.current.onTouchStart(N)}function H(N){b.current.onTouchMove(N)}function F(N){b.current.onTouchEnd(N)}function E(N){b.current.onWheel(N)}return document.addEventListener("touchmove",H,{passive:!1}),document.addEventListener("touchend",F,{passive:!1}),t.current.addEventListener("touchstart",R,{passive:!1}),t.current.addEventListener("wheel",E),function(){document.removeEventListener("touchmove",H),document.removeEventListener("touchend",F)}},[])}function gJe(t){var e=m.useState(0),n=Lc(e,2),o=n[0],r=n[1],i=m.useRef(0),a=m.useRef();return a.current=t,yx(function(){var l;(l=a.current)===null||l===void 0||l.call(a)},[o]),function(){i.current===o&&(i.current+=1,r(i.current))}}function JWt(t){var e=m.useRef([]),n=m.useState({}),o=Lc(n,2),r=o[1],i=m.useRef(typeof t=="function"?t():t),a=gJe(function(){var s=i.current;e.current.forEach(function(c){s=c(s)}),e.current=[],i.current=s,r({})});function l(s){e.current.push(s),a()}return[i.current,l]}var vxe={width:0,height:0,left:0,top:0,right:0};function KWt(t,e,n,o,r,i,a){var l=a.tabs,s=a.tabPosition,c=a.rtl,u,d,f;return["top","bottom"].includes(s)?(u="width",d=c?"right":"left",f=Math.abs(n)):(u="height",d="top",f=-n),m.useMemo(function(){if(!l.length)return[0,0];for(var p=l.length,g=p,A=0;Af+e){g=A-1;break}}for(var S=0,C=p-1;C>=0;C-=1){var P=t.get(l[C].key)||vxe;if(P[d]=g?[0,0]:[S,g]},[t,e,o,r,i,f,s,l.map(function(p){return p.key}).join("_"),c])}function xxe(t){var e;return t instanceof Map?(e={},t.forEach(function(n,o){e[o]=n})):e=t,JSON.stringify(e)}var qWt="TABS_DQ";function mJe(t){return String(t).replace(/"/g,qWt)}function yJe(t,e,n,o){return!(!n||o||t===!1||t===void 0&&(e===!1||e===null))}var AJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.editable,r=t.locale,i=t.style;return!o||o.showAdd===!1?null:m.createElement("button",{ref:e,type:"button",className:"".concat(n,"-nav-add"),style:i,"aria-label":(r==null?void 0:r.addAriaLabel)||"Add tab",onClick:function(l){o.onEdit("add",{event:l})}},o.addIcon||"+")}),bxe=m.forwardRef(function(t,e){var n=t.position,o=t.prefixCls,r=t.extra;if(!r)return null;var i,a={};return pw(r)==="object"&&!m.isValidElement(r)?a=r:a.right=r,n==="right"&&(i=a.right),n==="left"&&(i=a.left),i?m.createElement("div",{className:"".concat(o,"-extra-content"),ref:e},i):null}),$Wt=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.id,r=t.tabs,i=t.locale,a=t.mobile,l=t.more,s=l===void 0?{}:l,c=t.style,u=t.className,d=t.editable,f=t.tabBarGutter,p=t.rtl,g=t.removeAriaLabel,A=t.onTabClick,y=t.getPopupContainer,S=t.popupClassName,C=m.useState(!1),P=Lc(C,2),v=P[0],T=P[1],w=m.useState(null),x=Lc(w,2),b=x[0],R=x[1],H=s.icon,F=H===void 0?"More":H,E="".concat(o,"-more-popup"),N="".concat(n,"-dropdown"),U=b!==null?"".concat(E,"-").concat(b):null,W=i==null?void 0:i.dropdownAriaLabel;function k(G,q){G.preventDefault(),G.stopPropagation(),d.onEdit("remove",{key:q,event:G})}var D=m.createElement(GH,{onClick:function(q){var $=q.key,ie=q.domEvent;A($,ie),T(!1)},prefixCls:"".concat(N,"-menu"),id:E,tabIndex:-1,role:"listbox","aria-activedescendant":U,selectedKeys:[b],"aria-label":W!==void 0?W:"expanded dropdown"},r.map(function(G){var q=G.closable,$=G.disabled,ie=G.closeIcon,Q=G.key,se=G.label,oe=yJe(q,ie,d,$);return m.createElement(qW,{key:Q,id:"".concat(E,"-").concat(Q),role:"option","aria-controls":o&&"".concat(o,"-panel-").concat(Q),disabled:$},m.createElement("span",null,se),oe&&m.createElement("button",{type:"button","aria-label":g||"remove",tabIndex:0,className:"".concat(N,"-menu-item-remove"),onClick:function(te){te.stopPropagation(),k(te,Q)}},ie||d.removeIcon||"×"))}));function L(G){for(var q=r.filter(function(oe){return!oe.disabled}),$=q.findIndex(function(oe){return oe.key===b})||0,ie=q.length,Q=0;Qct?"left":"right"})}),N=Lc(E,2),U=N[0],W=N[1],k=yxe(0,function(ht,ct){!F&&A&&A({direction:ht>ct?"top":"bottom"})}),D=Lc(k,2),L=D[0],j=D[1],B=m.useState([0,0]),O=Lc(B,2),V=O[0],G=O[1],q=m.useState([0,0]),$=Lc(q,2),ie=$[0],Q=$[1],se=m.useState([0,0]),oe=Lc(se,2),Z=oe[0],te=oe[1],ee=m.useState([0,0]),de=Lc(ee,2),fe=de[0],pe=de[1],ye=JWt(new Map),ae=Lc(ye,2),Te=ae[0],ge=ae[1],Se=_Wt(P,Te,ie[0]),Re=UY(V,F),De=UY(ie,F),Ae=UY(Z,F),ue=UY(fe,F),he=ReIe?Ie:ht}var ze=m.useRef(null),Ne=m.useState(),Je=Lc(Ne,2),Ue=Je[0],nt=Je[1];function We(){nt(Date.now())}function Ee(){ze.current&&clearTimeout(ze.current)}XWt(x,function(ht,ct){function It(Ft,Ve){Ft(function(ft){var kt=Me(ft+Ve);return kt})}return he?(F?It(W,ht):It(j,ct),Ee(),We(),!0):!1}),m.useEffect(function(){return Ee(),Ue&&(ze.current=setTimeout(function(){nt(0)},100)),Ee},[Ue]);var ke=KWt(Se,ve,F?U:L,De,Ae,ue,Nm(Nm({},t),{},{tabs:P})),Oe=Lc(ke,2),st=Oe[0],je=Oe[1],xt=za(function(){var ht=arguments.length>0&&arguments[0]!==void 0?arguments[0]:a,ct=Se.get(ht)||{width:0,height:0,left:0,right:0,top:0};if(F){var It=U;l?ct.rightU+ve&&(It=ct.right+ct.width-ve):ct.left<-U?It=-ct.left:ct.left+ct.width>-U+ve&&(It=-(ct.left+ct.width-ve)),j(0),W(Me(It))}else{var Ft=L;ct.top<-L?Ft=-ct.top:ct.top+ct.height>-L+ve&&(Ft=-(ct.top+ct.height-ve)),W(0),j(Me(Ft))}}),gt={};d==="top"||d==="bottom"?gt[l?"marginRight":"marginLeft"]=f:gt.marginTop=f;var Ye=P.map(function(ht,ct){var It=ht.key;return m.createElement(ZWt,{id:r,prefixCls:C,key:It,tab:ht,style:ct===0?void 0:gt,closable:ht.closable,editable:c,active:It===a,renderWrapper:p,removeAriaLabel:u==null?void 0:u.removeAriaLabel,onClick:function(Ve){g(It,Ve)},onFocus:function(){xt(It),We(),x.current&&(l||(x.current.scrollLeft=0),x.current.scrollTop=0)}})}),it=function(){return ge(function(){var ct,It=new Map,Ft=(ct=b.current)===null||ct===void 0?void 0:ct.getBoundingClientRect();return P.forEach(function(Ve){var ft,kt=Ve.key,rt=(ft=b.current)===null||ft===void 0?void 0:ft.querySelector('[data-node-key="'.concat(mJe(kt),'"]'));if(rt){var at=eNt(rt,Ft),Ge=Lc(at,4),yt=Ge[0],Pt=Ge[1],ot=Ge[2],bt=Ge[3];It.set(kt,{width:yt,height:Pt,left:ot,top:bt})}}),It})};m.useEffect(function(){it()},[P.map(function(ht){return ht.key}).join("_")]);var ut=gJe(function(){var ht=BT(v),ct=BT(T),It=BT(w);G([ht[0]-ct[0]-It[0],ht[1]-ct[1]-It[1]]);var Ft=BT(H);te(Ft);var Ve=BT(R);pe(Ve);var ft=BT(b);Q([ft[0]-Ft[0],ft[1]-Ft[1]]),it()}),Qe=P.slice(0,st),lt=P.slice(je+1),Ze=[].concat(gxe(Qe),gxe(lt)),Be=Se.get(a),$e=VWt({activeTabOffset:Be,horizontal:F,indicator:y,rtl:l}),wt=$e.style;m.useEffect(function(){xt()},[a,Pe,Ie,xxe(Be),xxe(Se),F]),m.useEffect(function(){ut()},[l]);var vt=!!Ze.length,Rt="".concat(C,"-nav-wrap"),Gt,At,pt,Wt;return F?l?(At=U>0,Gt=U!==Ie):(Gt=U<0,At=U!==Pe):(pt=L<0,Wt=L!==Pe),m.createElement(Cd,{onResize:ut},m.createElement("div",{ref:Nw(e,v),role:"tablist",className:Xn("".concat(C,"-nav"),n),style:o,onKeyDown:function(){We()}},m.createElement(bxe,{ref:T,position:"left",extra:s,prefixCls:C}),m.createElement(Cd,{onResize:ut},m.createElement("div",{className:Xn(Rt,np(np(np(np({},"".concat(Rt,"-ping-left"),Gt),"".concat(Rt,"-ping-right"),At),"".concat(Rt,"-ping-top"),pt),"".concat(Rt,"-ping-bottom"),Wt)),ref:x},m.createElement(Cd,{onResize:ut},m.createElement("div",{ref:b,className:"".concat(C,"-nav-list"),style:{transform:"translate(".concat(U,"px, ").concat(L,"px)"),transition:Ue?"none":void 0}},Ye,m.createElement(AJe,{ref:H,prefixCls:C,locale:u,editable:c,style:Nm(Nm({},Ye.length===0?void 0:gt),{},{visibility:vt?"hidden":null})}),m.createElement("div",{className:Xn("".concat(C,"-ink-bar"),np({},"".concat(C,"-ink-bar-animated"),i.inkBar)),style:wt}))))),m.createElement(QWt,H9({},t,{removeAriaLabel:u==null?void 0:u.removeAriaLabel,ref:R,prefixCls:C,tabs:Ze,className:!vt&&we,tabMoving:!!Ue})),m.createElement(bxe,{ref:w,position:"right",extra:s,prefixCls:C})))}),wJe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.className,r=t.style,i=t.id,a=t.active,l=t.tabKey,s=t.children;return m.createElement("div",{id:i&&"".concat(i,"-panel-").concat(l),role:"tabpanel",tabIndex:a?0:-1,"aria-labelledby":i&&"".concat(i,"-tab-").concat(l),"aria-hidden":!a,style:r,className:Xn(n,a&&"".concat(n,"-active"),o),ref:e},s)}),tNt=["renderTabBar"],nNt=["label","key"],oNt=function(e){var n=e.renderTabBar,o=JG(e,tNt),r=m.useContext(fQ),i=r.tabs;if(n){var a=Nm(Nm({},o),{},{panes:i.map(function(l){var s=l.label,c=l.key,u=JG(l,nNt);return m.createElement(wJe,H9({tab:s,key:c,tabKey:c},u))})});return n(a,Sxe)}return m.createElement(Sxe,o)},rNt=["key","forceRender","style","className","destroyInactiveTabPane"],iNt=function(e){var n=e.id,o=e.activeKey,r=e.animated,i=e.tabPosition,a=e.destroyInactiveTabPane,l=m.useContext(fQ),s=l.prefixCls,c=l.tabs,u=r.tabPane,d="".concat(s,"-tabpane");return m.createElement("div",{className:Xn("".concat(s,"-content-holder"))},m.createElement("div",{className:Xn("".concat(s,"-content"),"".concat(s,"-content-").concat(i),np({},"".concat(s,"-content-animated"),u))},c.map(function(f){var p=f.key,g=f.forceRender,A=f.style,y=f.className,S=f.destroyInactiveTabPane,C=JG(f,rNt),P=p===o;return m.createElement(o1,H9({key:p,visible:P,forceRender:g,removeOnLeave:!!(a||S),leavedClassName:"".concat(d,"-hidden")},r.tabPaneMotion),function(v,T){var w=v.style,x=v.className;return m.createElement(wJe,H9({},C,{prefixCls:d,id:n,tabKey:p,animated:u,active:P,style:Nm(Nm({},A),w),className:Xn(y,x),ref:T}))})})))};function aNt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},e;return t===!1?e={inkBar:!1,tabPane:!1}:t===!0?e={inkBar:!0,tabPane:!1}:e=Nm({inkBar:!0},pw(t)==="object"?t:{}),e.tabPaneMotion&&e.tabPane===void 0&&(e.tabPane=!0),!e.tabPaneMotion&&e.tabPane&&(e.tabPane=!1),e}var lNt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],Txe=0,sNt=m.forwardRef(function(t,e){var n=t.id,o=t.prefixCls,r=o===void 0?"rc-tabs":o,i=t.className,a=t.items,l=t.direction,s=t.activeKey,c=t.defaultActiveKey,u=t.editable,d=t.animated,f=t.tabPosition,p=f===void 0?"top":f,g=t.tabBarGutter,A=t.tabBarStyle,y=t.tabBarExtraContent,S=t.locale,C=t.more,P=t.destroyInactiveTabPane,v=t.renderTabBar,T=t.onChange,w=t.onTabClick,x=t.onTabScroll,b=t.getPopupContainer,R=t.popupClassName,H=t.indicator,F=JG(t,lNt),E=m.useMemo(function(){return(a||[]).filter(function(fe){return fe&&pw(fe)==="object"&&"key"in fe})},[a]),N=l==="rtl",U=aNt(d),W=m.useState(!1),k=Lc(W,2),D=k[0],L=k[1];m.useEffect(function(){L(X$())},[]);var j=Es(function(){var fe;return(fe=E[0])===null||fe===void 0?void 0:fe.key},{value:s,defaultValue:c}),B=Lc(j,2),O=B[0],V=B[1],G=m.useState(function(){return E.findIndex(function(fe){return fe.key===O})}),q=Lc(G,2),$=q[0],ie=q[1];m.useEffect(function(){var fe=E.findIndex(function(ye){return ye.key===O});if(fe===-1){var pe;fe=Math.max(0,Math.min($,E.length-1)),V((pe=E[fe])===null||pe===void 0?void 0:pe.key)}ie(fe)},[E.map(function(fe){return fe.key}).join("_"),O,$]);var Q=Es(null,{value:n}),se=Lc(Q,2),oe=se[0],Z=se[1];m.useEffect(function(){n||(Z("rc-tabs-".concat(Txe)),Txe+=1)},[]);function te(fe,pe){w==null||w(fe,pe);var ye=fe!==O;V(fe),ye&&(T==null||T(fe))}var ee={id:oe,activeKey:O,animated:U,tabPosition:p,rtl:N,mobile:D},de=Nm(Nm({},ee),{},{editable:u,locale:S,more:C,tabBarGutter:g,onTabClick:te,onTabScroll:x,extra:y,style:A,panes:null,getPopupContainer:b,popupClassName:R,indicator:H});return m.createElement(fQ.Provider,{value:{tabs:E,prefixCls:r}},m.createElement("div",H9({ref:e,id:n,className:Xn(r,"".concat(r,"-").concat(p),np(np(np({},"".concat(r,"-mobile"),D),"".concat(r,"-editable"),u),"".concat(r,"-rtl"),N),i)},F),m.createElement(oNt,H9({},de,{renderTabBar:v})),m.createElement(iNt,H9({destroyInactiveTabPane:P},ee,{animated:U}))))});const cNt={motionAppear:!1,motionEnter:!0,motionLeave:!0};function uNt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inkBar:!0,tabPane:!1},n;return e===!1?n={inkBar:!1,tabPane:!1}:e===!0?n={inkBar:!0,tabPane:!0}:n=Object.assign({inkBar:!0},typeof e=="object"?e:{}),n.tabPane&&(n.tabPaneMotion=Object.assign(Object.assign({},cNt),{motionName:B9(t,"switch")})),n}var dNt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);re)}function hNt(t,e){if(t)return t;const n=Y9(e).map(o=>{if(m.isValidElement(o)){const{key:r,props:i}=o,a=i||{},{tab:l}=a,s=dNt(a,["tab"]);return Object.assign(Object.assign({key:String(r)},s),{label:l})}return null});return fNt(n)}const pNt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return[{[e]:{[`${e}-switch`]:{"&-appear, &-enter":{transition:"none","&-start":{opacity:0},"&-active":{opacity:1,transition:`opacity ${n}`}},"&-leave":{position:"absolute",transition:"none",inset:0,"&-start":{opacity:1},"&-active":{opacity:0,transition:`opacity ${n}`}}}}},[V9(t,"slide-up"),V9(t,"slide-down")]]},gNt=t=>{const{componentCls:e,tabsCardPadding:n,cardBg:o,cardGutter:r,colorBorderSecondary:i,itemSelectedColor:a}=t;return{[`${e}-card`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{margin:0,padding:n,background:o,border:`${jt(t.lineWidth)} ${t.lineType} ${i}`,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`},[`${e}-tab-active`]:{color:a,background:t.colorBgContainer},[`${e}-ink-bar`]:{visibility:"hidden"}},[`&${e}-top, &${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginLeft:{_skip_check_:!0,value:jt(r)}}}},[`&${e}-top`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`},[`${e}-tab-active`]:{borderBottomColor:t.colorBgContainer}}},[`&${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)}`},[`${e}-tab-active`]:{borderTopColor:t.colorBgContainer}}},[`&${e}-left, &${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginTop:jt(r)}}},[`&${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadiusLG)} 0 0 ${jt(t.borderRadiusLG)}`}},[`${e}-tab-active`]:{borderRightColor:{_skip_check_:!0,value:t.colorBgContainer}}}},[`&${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0`}},[`${e}-tab-active`]:{borderLeftColor:{_skip_check_:!0,value:t.colorBgContainer}}}}}}},mNt=t=>{const{componentCls:e,itemHoverColor:n,dropdownEdgeChildVerticalPadding:o}=t;return{[`${e}-dropdown`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:t.zIndexPopup,display:"block","&-hidden":{display:"none"},[`${e}-dropdown-menu`]:{maxHeight:t.tabsDropdownHeight,margin:0,padding:`${jt(o)} 0`,overflowX:"hidden",overflowY:"auto",textAlign:{_skip_check_:!0,value:"left"},listStyleType:"none",backgroundColor:t.colorBgContainer,backgroundClip:"padding-box",borderRadius:t.borderRadiusLG,outline:"none",boxShadow:t.boxShadowSecondary,"&-item":Object.assign(Object.assign({},qx),{display:"flex",alignItems:"center",minWidth:t.tabsDropdownWidth,margin:0,padding:`${jt(t.paddingXXS)} ${jt(t.paddingSM)}`,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"> span":{flex:1,whiteSpace:"nowrap"},"&-remove":{flex:"none",marginLeft:{_skip_check_:!0,value:t.marginSM},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:0,cursor:"pointer","&:hover":{color:n}},"&:hover":{background:t.controlItemBgHover},"&-disabled":{"&, &:hover":{color:t.colorTextDisabled,background:"transparent",cursor:"not-allowed"}}})}})}},yNt=t=>{const{componentCls:e,margin:n,colorBorderSecondary:o,horizontalMargin:r,verticalItemPadding:i,verticalItemMargin:a,calc:l}=t;return{[`${e}-top, ${e}-bottom`]:{flexDirection:"column",[`> ${e}-nav, > div > ${e}-nav`]:{margin:r,"&::before":{position:"absolute",right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},borderBottom:`${jt(t.lineWidth)} ${t.lineType} ${o}`,content:"''"},[`${e}-ink-bar`]:{height:t.lineWidthBold,"&-animated":{transition:`width ${t.motionDurationSlow}, left ${t.motionDurationSlow}, right ${t.motionDurationSlow}`}},[`${e}-nav-wrap`]:{"&::before, &::after":{top:0,bottom:0,width:t.controlHeight},"&::before":{left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowLeft},"&::after":{right:{_skip_check_:!0,value:0},boxShadow:t.boxShadowTabsOverflowRight},[`&${e}-nav-wrap-ping-left::before`]:{opacity:1},[`&${e}-nav-wrap-ping-right::after`]:{opacity:1}}}},[`${e}-top`]:{[`> ${e}-nav, - > div > ${e}-nav`]:{"&::before":{bottom:0},[`${e}-ink-bar`]:{bottom:0}}},[`${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,marginTop:n,marginBottom:0,"&::before":{top:0},[`${e}-ink-bar`]:{top:0}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0}},[`${e}-left, ${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{flexDirection:"column",minWidth:l(t.controlHeight).mul(1.25).equal(),[`${e}-tab`]:{padding:i,textAlign:"center"},[`${e}-tab + ${e}-tab`]:{margin:a},[`${e}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:t.controlHeight},"&::before":{top:0,boxShadow:t.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:t.boxShadowTabsOverflowBottom},[`&${e}-nav-wrap-ping-top::before`]:{opacity:1},[`&${e}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${e}-ink-bar`]:{width:t.lineWidthBold,"&-animated":{transition:`height ${t.motionDurationSlow}, top ${t.motionDurationSlow}`}},[`${e}-nav-list, ${e}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{marginLeft:{_skip_check_:!0,value:jt(l(t.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:t.paddingLG}}}},[`${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,[`${e}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:l(t.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingRight:{_skip_check_:!0,value:t.paddingLG}}}}}},ANt=t=>{const{componentCls:e,cardPaddingSM:n,cardPaddingLG:o,horizontalItemPaddingSM:r,horizontalItemPaddingLG:i}=t;return{[e]:{"&-small":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:r,fontSize:t.titleFontSizeSM}}},"&-large":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:i,fontSize:t.titleFontSizeLG}}}},[`${e}-card`]:{[`&${e}-small`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:n}},[`&${e}-bottom`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadius)} ${jt(t.borderRadius)}`}},[`&${e}-top`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`${jt(t.borderRadius)} ${jt(t.borderRadius)} 0 0`}},[`&${e}-right`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadius)} ${jt(t.borderRadius)} 0`}}},[`&${e}-left`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadius)} 0 0 ${jt(t.borderRadius)}`}}}},[`&${e}-large`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:o}}}}}},wNt=t=>{const{componentCls:e,itemActiveColor:n,itemHoverColor:o,iconCls:r,tabsHorizontalItemMargin:i,horizontalItemPadding:a,itemSelectedColor:l,itemColor:s}=t,c=`${e}-tab`;return{[c]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:a,fontSize:t.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:s,"&-btn, &-remove":Object.assign({"&:focus:not(:focus-visible), &:active":{color:n}},eA(t)),"&-btn":{outline:"none",transition:`all ${t.motionDurationSlow}`,[`${c}-icon:not(:last-child)`]:{marginInlineEnd:t.marginSM}},"&-remove":{flex:"none",marginRight:{_skip_check_:!0,value:t.calc(t.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:t.marginXS},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"&:hover":{color:t.colorTextHeading}},"&:hover":{color:o},[`&${c}-active ${c}-btn`]:{color:l,textShadow:t.tabsActiveTextShadow},[`&${c}-disabled`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${c}-disabled ${c}-btn, &${c}-disabled ${e}-remove`]:{"&:focus, &:active":{color:t.colorTextDisabled}},[`& ${c}-remove ${r}`]:{margin:0},[`${r}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:t.marginSM}}},[`${c} + ${c}`]:{margin:{_skip_check_:!0,value:i}}}},vNt=t=>{const{componentCls:e,tabsHorizontalItemMarginRTL:n,iconCls:o,cardGutter:r,calc:i}=t;return{[`${e}-rtl`]:{direction:"rtl",[`${e}-nav`]:{[`${e}-tab`]:{margin:{_skip_check_:!0,value:n},[`${e}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:jt(t.marginSM)}},[`${e}-tab-remove`]:{marginRight:{_skip_check_:!0,value:jt(t.marginXS)},marginLeft:{_skip_check_:!0,value:jt(i(t.marginXXS).mul(-1).equal())},[o]:{margin:0}}}},[`&${e}-left`]:{[`> ${e}-nav`]:{order:1},[`> ${e}-content-holder`]:{order:0}},[`&${e}-right`]:{[`> ${e}-nav`]:{order:0},[`> ${e}-content-holder`]:{order:1}},[`&${e}-card${e}-top, &${e}-card${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginRight:{_skip_check_:!0,value:r},marginLeft:{_skip_check_:!0,value:0}}}}},[`${e}-dropdown-rtl`]:{direction:"rtl"},[`${e}-menu-item`]:{[`${e}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},xNt=t=>{const{componentCls:e,tabsCardPadding:n,cardHeight:o,cardGutter:r,itemHoverColor:i,itemActiveColor:a,colorBorderSecondary:l}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{display:"flex",[`> ${e}-nav, > div > ${e}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${e}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${t.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${e}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${t.motionDurationSlow}`},[`${e}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${e}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${e}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,color:t.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:t.calc(t.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${e}-nav-add`]:Object.assign({minWidth:o,minHeight:o,marginLeft:{_skip_check_:!0,value:r},padding:`0 ${jt(t.paddingXS)}`,background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} ${l}`,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:t.colorText,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:a}},eA(t))},[`${e}-extra-content`]:{flex:"none"},[`${e}-ink-bar`]:{position:"absolute",background:t.inkBarColor,pointerEvents:"none"}}),wNt(t)),{[`${e}-content`]:{position:"relative",width:"100%"},[`${e}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${e}-tabpane`]:{outline:"none","&-hidden":{display:"none"}}}),[`${e}-centered`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-nav-wrap`]:{[`&:not([class*='${e}-nav-wrap-ping'])`]:{justifyContent:"center"}}}}}},bNt=t=>{const e=t.controlHeightLG;return{zIndexPopup:t.zIndexPopupBase+50,cardBg:t.colorFillAlter,cardHeight:e,cardPadding:`${(e-Math.round(t.fontSize*t.lineHeight))/2-t.lineWidth}px ${t.padding}px`,cardPaddingSM:`${t.paddingXXS*1.5}px ${t.padding}px`,cardPaddingLG:`${t.paddingXS}px ${t.padding}px ${t.paddingXXS*1.5}px`,titleFontSize:t.fontSize,titleFontSizeLG:t.fontSizeLG,titleFontSizeSM:t.fontSize,inkBarColor:t.colorPrimary,horizontalMargin:`0 0 ${t.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${t.paddingSM}px 0`,horizontalItemPaddingSM:`${t.paddingXS}px 0`,horizontalItemPaddingLG:`${t.padding}px 0`,verticalItemPadding:`${t.paddingXS}px ${t.paddingLG}px`,verticalItemMargin:`${t.margin}px 0 0 0`,itemColor:t.colorText,itemSelectedColor:t.colorPrimary,itemHoverColor:t.colorPrimaryHover,itemActiveColor:t.colorPrimaryActive,cardGutter:t.marginXXS/2}},SNt=wl("Tabs",t=>{const e=qi(t,{tabsCardPadding:t.cardPadding,dropdownEdgeChildVerticalPadding:t.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${jt(t.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${jt(t.horizontalItemGutter)}`});return[ANt(e),vNt(e),yNt(e),mNt(e),gNt(e),xNt(e),pNt(e)]},bNt),TNt=()=>null;var PNt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s,c,u,d;const{type:f,className:p,rootClassName:g,size:A,onEdit:y,hideAdd:S,centered:C,addIcon:P,removeIcon:v,moreIcon:T,more:w,popupClassName:x,children:b,items:R,animated:H,style:F,indicatorSize:E,indicator:N}=t,U=PNt(t,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator"]),{prefixCls:W}=U,{direction:k,tabs:D,getPrefixCls:L,getPopupContainer:j}=m.useContext(Cr),B=L("tabs",W),O=Y0(B),[V,G,q]=SNt(B,O);let $;f==="editable-card"&&($={onEdit:(oe,de)=>{let{key:he,event:pe}=de;y==null||y(oe==="add"?pe:he,oe)},removeIcon:(e=v??(D==null?void 0:D.removeIcon))!==null&&e!==void 0?e:m.createElement(jw,null),addIcon:(P??(D==null?void 0:D.addIcon))||m.createElement(FWt,null),showAdd:S!==!0});const ie=L(),Q=zd(A),se=hNt(R,b),Z=uNt(B,H),ee=Object.assign(Object.assign({},D==null?void 0:D.style),F),te={align:(n=N==null?void 0:N.align)!==null&&n!==void 0?n:(o=D==null?void 0:D.indicator)===null||o===void 0?void 0:o.align,size:(l=(i=(r=N==null?void 0:N.size)!==null&&r!==void 0?r:E)!==null&&i!==void 0?i:(a=D==null?void 0:D.indicator)===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:D==null?void 0:D.indicatorSize};return V(m.createElement(sNt,Object.assign({direction:k,getPopupContainer:j},U,{items:se,className:Un({[`${B}-${Q}`]:Q,[`${B}-card`]:["card","editable-card"].includes(f),[`${B}-editable-card`]:f==="editable-card",[`${B}-centered`]:C},D==null?void 0:D.className,p,g,G,q,O),popupClassName:Un(x,G,q,O),style:ee,editable:$,more:Object.assign({icon:(d=(u=(c=(s=D==null?void 0:D.more)===null||s===void 0?void 0:s.icon)!==null&&c!==void 0?c:D==null?void 0:D.moreIcon)!==null&&u!==void 0?u:T)!==null&&d!==void 0?d:m.createElement($me,null),transitionName:`${ie}-slide-up`},w),prefixCls:B,animated:Z,indicator:te})))};hQ.TabPane=TNt;function CNt(t,e,n){var o=n||{},r=o.noTrailing,i=r===void 0?!1:r,a=o.noLeading,l=a===void 0?!1:a,s=o.debounceMode,c=s===void 0?void 0:s,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function g(y){var S=y||{},C=S.upcomingOnly,P=C===void 0?!1:C;p(),d=!P}function A(){for(var y=arguments.length,S=new Array(y),C=0;Ct?l?(f=Date.now(),i||(u=setTimeout(c?w:T,t))):T():i!==!0&&(u=setTimeout(c?w:T,c===void 0?t-v:t))}return A.cancel=g,A}function RNt(t,e,n){var o={},r=o.atBegin,i=r===void 0?!1:r;return CNt(t,e,{debounceMode:i!==!1})}const HNt=t=>{const{checkboxCls:e}=t,n=`${e}-wrapper`;return[{[`${e}-group`]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",flexWrap:"wrap",columnGap:t.marginXS,[`> ${t.antCls}-row`]:{flex:1}}),[n]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:t.borderRadiusSM,alignSelf:"center",[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${e}-inner`]:Object.assign({},dw(t))},[`${e}-inner`]:{boxSizing:"border-box",display:"block",width:t.checkboxSize,height:t.checkboxSize,direction:"ltr",backgroundColor:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,borderCollapse:"separate",transition:`all ${t.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:t.calc(t.checkboxSize).div(14).mul(5).equal(),height:t.calc(t.checkboxSize).div(14).mul(8).equal(),border:`${jt(t.lineWidthBold)} solid ${t.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${t.motionDurationFast} ${t.motionEaseInBack}, opacity ${t.motionDurationFast}`}},"& + span":{paddingInlineStart:t.paddingXS,paddingInlineEnd:t.paddingXS}})},{[` + > div > ${e}-nav`]:{"&::before":{bottom:0},[`${e}-ink-bar`]:{bottom:0}}},[`${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,marginTop:n,marginBottom:0,"&::before":{top:0},[`${e}-ink-bar`]:{top:0}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0}},[`${e}-left, ${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{flexDirection:"column",minWidth:l(t.controlHeight).mul(1.25).equal(),[`${e}-tab`]:{padding:i,textAlign:"center"},[`${e}-tab + ${e}-tab`]:{margin:a},[`${e}-nav-wrap`]:{flexDirection:"column","&::before, &::after":{right:{_skip_check_:!0,value:0},left:{_skip_check_:!0,value:0},height:t.controlHeight},"&::before":{top:0,boxShadow:t.boxShadowTabsOverflowTop},"&::after":{bottom:0,boxShadow:t.boxShadowTabsOverflowBottom},[`&${e}-nav-wrap-ping-top::before`]:{opacity:1},[`&${e}-nav-wrap-ping-bottom::after`]:{opacity:1}},[`${e}-ink-bar`]:{width:t.lineWidthBold,"&-animated":{transition:`height ${t.motionDurationSlow}, top ${t.motionDurationSlow}`}},[`${e}-nav-list, ${e}-nav-operations`]:{flex:"1 0 auto",flexDirection:"column"}}},[`${e}-left`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-ink-bar`]:{right:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{marginLeft:{_skip_check_:!0,value:jt(l(t.lineWidth).mul(-1).equal())},borderLeft:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingLeft:{_skip_check_:!0,value:t.paddingLG}}}},[`${e}-right`]:{[`> ${e}-nav, > div > ${e}-nav`]:{order:1,[`${e}-ink-bar`]:{left:{_skip_check_:!0,value:0}}},[`> ${e}-content-holder, > div > ${e}-content-holder`]:{order:0,marginRight:{_skip_check_:!0,value:l(t.lineWidth).mul(-1).equal()},borderRight:{_skip_check_:!0,value:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`},[`> ${e}-content > ${e}-tabpane`]:{paddingRight:{_skip_check_:!0,value:t.paddingLG}}}}}},ANt=t=>{const{componentCls:e,cardPaddingSM:n,cardPaddingLG:o,horizontalItemPaddingSM:r,horizontalItemPaddingLG:i}=t;return{[e]:{"&-small":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:r,fontSize:t.titleFontSizeSM}}},"&-large":{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:i,fontSize:t.titleFontSizeLG}}}},[`${e}-card`]:{[`&${e}-small`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:n}},[`&${e}-bottom`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`0 0 ${jt(t.borderRadius)} ${jt(t.borderRadius)}`}},[`&${e}-top`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:`${jt(t.borderRadius)} ${jt(t.borderRadius)} 0 0`}},[`&${e}-right`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`0 ${jt(t.borderRadius)} ${jt(t.borderRadius)} 0`}}},[`&${e}-left`]:{[`> ${e}-nav ${e}-tab`]:{borderRadius:{_skip_check_:!0,value:`${jt(t.borderRadius)} 0 0 ${jt(t.borderRadius)}`}}}},[`&${e}-large`]:{[`> ${e}-nav`]:{[`${e}-tab`]:{padding:o}}}}}},wNt=t=>{const{componentCls:e,itemActiveColor:n,itemHoverColor:o,iconCls:r,tabsHorizontalItemMargin:i,horizontalItemPadding:a,itemSelectedColor:l,itemColor:s}=t,c=`${e}-tab`;return{[c]:{position:"relative",WebkitTouchCallout:"none",WebkitTapHighlightColor:"transparent",display:"inline-flex",alignItems:"center",padding:a,fontSize:t.titleFontSize,background:"transparent",border:0,outline:"none",cursor:"pointer",color:s,"&-btn, &-remove":Object.assign({"&:focus:not(:focus-visible), &:active":{color:n}},eA(t)),"&-btn":{outline:"none",transition:`all ${t.motionDurationSlow}`,[`${c}-icon:not(:last-child)`]:{marginInlineEnd:t.marginSM}},"&-remove":{flex:"none",marginRight:{_skip_check_:!0,value:t.calc(t.marginXXS).mul(-1).equal()},marginLeft:{_skip_check_:!0,value:t.marginXS},color:t.colorTextDescription,fontSize:t.fontSizeSM,background:"transparent",border:"none",outline:"none",cursor:"pointer",transition:`all ${t.motionDurationSlow}`,"&:hover":{color:t.colorTextHeading}},"&:hover":{color:o},[`&${c}-active ${c}-btn`]:{color:l,textShadow:t.tabsActiveTextShadow},[`&${c}-disabled`]:{color:t.colorTextDisabled,cursor:"not-allowed"},[`&${c}-disabled ${c}-btn, &${c}-disabled ${e}-remove`]:{"&:focus, &:active":{color:t.colorTextDisabled}},[`& ${c}-remove ${r}`]:{margin:0},[`${r}:not(:last-child)`]:{marginRight:{_skip_check_:!0,value:t.marginSM}}},[`${c} + ${c}`]:{margin:{_skip_check_:!0,value:i}}}},vNt=t=>{const{componentCls:e,tabsHorizontalItemMarginRTL:n,iconCls:o,cardGutter:r,calc:i}=t;return{[`${e}-rtl`]:{direction:"rtl",[`${e}-nav`]:{[`${e}-tab`]:{margin:{_skip_check_:!0,value:n},[`${e}-tab:last-of-type`]:{marginLeft:{_skip_check_:!0,value:0}},[o]:{marginRight:{_skip_check_:!0,value:0},marginLeft:{_skip_check_:!0,value:jt(t.marginSM)}},[`${e}-tab-remove`]:{marginRight:{_skip_check_:!0,value:jt(t.marginXS)},marginLeft:{_skip_check_:!0,value:jt(i(t.marginXXS).mul(-1).equal())},[o]:{margin:0}}}},[`&${e}-left`]:{[`> ${e}-nav`]:{order:1},[`> ${e}-content-holder`]:{order:0}},[`&${e}-right`]:{[`> ${e}-nav`]:{order:0},[`> ${e}-content-holder`]:{order:1}},[`&${e}-card${e}-top, &${e}-card${e}-bottom`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-tab + ${e}-tab`]:{marginRight:{_skip_check_:!0,value:r},marginLeft:{_skip_check_:!0,value:0}}}}},[`${e}-dropdown-rtl`]:{direction:"rtl"},[`${e}-menu-item`]:{[`${e}-dropdown-rtl`]:{textAlign:{_skip_check_:!0,value:"right"}}}}},xNt=t=>{const{componentCls:e,tabsCardPadding:n,cardHeight:o,cardGutter:r,itemHoverColor:i,itemActiveColor:a,colorBorderSecondary:l}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{display:"flex",[`> ${e}-nav, > div > ${e}-nav`]:{position:"relative",display:"flex",flex:"none",alignItems:"center",[`${e}-nav-wrap`]:{position:"relative",display:"flex",flex:"auto",alignSelf:"stretch",overflow:"hidden",whiteSpace:"nowrap",transform:"translate(0)","&::before, &::after":{position:"absolute",zIndex:1,opacity:0,transition:`opacity ${t.motionDurationSlow}`,content:"''",pointerEvents:"none"}},[`${e}-nav-list`]:{position:"relative",display:"flex",transition:`opacity ${t.motionDurationSlow}`},[`${e}-nav-operations`]:{display:"flex",alignSelf:"stretch"},[`${e}-nav-operations-hidden`]:{position:"absolute",visibility:"hidden",pointerEvents:"none"},[`${e}-nav-more`]:{position:"relative",padding:n,background:"transparent",border:0,color:t.colorText,"&::after":{position:"absolute",right:{_skip_check_:!0,value:0},bottom:0,left:{_skip_check_:!0,value:0},height:t.calc(t.controlHeightLG).div(8).equal(),transform:"translateY(100%)",content:"''"}},[`${e}-nav-add`]:Object.assign({minWidth:o,minHeight:o,marginLeft:{_skip_check_:!0,value:r},padding:`0 ${jt(t.paddingXS)}`,background:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} ${l}`,borderRadius:`${jt(t.borderRadiusLG)} ${jt(t.borderRadiusLG)} 0 0`,outline:"none",cursor:"pointer",color:t.colorText,transition:`all ${t.motionDurationSlow} ${t.motionEaseInOut}`,"&:hover":{color:i},"&:active, &:focus:not(:focus-visible)":{color:a}},eA(t))},[`${e}-extra-content`]:{flex:"none"},[`${e}-ink-bar`]:{position:"absolute",background:t.inkBarColor,pointerEvents:"none"}}),wNt(t)),{[`${e}-content`]:{position:"relative",width:"100%"},[`${e}-content-holder`]:{flex:"auto",minWidth:0,minHeight:0},[`${e}-tabpane`]:{outline:"none","&-hidden":{display:"none"}}}),[`${e}-centered`]:{[`> ${e}-nav, > div > ${e}-nav`]:{[`${e}-nav-wrap`]:{[`&:not([class*='${e}-nav-wrap-ping'])`]:{justifyContent:"center"}}}}}},bNt=t=>{const e=t.controlHeightLG;return{zIndexPopup:t.zIndexPopupBase+50,cardBg:t.colorFillAlter,cardHeight:e,cardPadding:`${(e-Math.round(t.fontSize*t.lineHeight))/2-t.lineWidth}px ${t.padding}px`,cardPaddingSM:`${t.paddingXXS*1.5}px ${t.padding}px`,cardPaddingLG:`${t.paddingXS}px ${t.padding}px ${t.paddingXXS*1.5}px`,titleFontSize:t.fontSize,titleFontSizeLG:t.fontSizeLG,titleFontSizeSM:t.fontSize,inkBarColor:t.colorPrimary,horizontalMargin:`0 0 ${t.margin}px 0`,horizontalItemGutter:32,horizontalItemMargin:"",horizontalItemMarginRTL:"",horizontalItemPadding:`${t.paddingSM}px 0`,horizontalItemPaddingSM:`${t.paddingXS}px 0`,horizontalItemPaddingLG:`${t.padding}px 0`,verticalItemPadding:`${t.paddingXS}px ${t.paddingLG}px`,verticalItemMargin:`${t.margin}px 0 0 0`,itemColor:t.colorText,itemSelectedColor:t.colorPrimary,itemHoverColor:t.colorPrimaryHover,itemActiveColor:t.colorPrimaryActive,cardGutter:t.marginXXS/2}},SNt=wl("Tabs",t=>{const e=qi(t,{tabsCardPadding:t.cardPadding,dropdownEdgeChildVerticalPadding:t.paddingXXS,tabsActiveTextShadow:"0 0 0.25px currentcolor",tabsDropdownHeight:200,tabsDropdownWidth:120,tabsHorizontalItemMargin:`0 0 0 ${jt(t.horizontalItemGutter)}`,tabsHorizontalItemMarginRTL:`0 0 0 ${jt(t.horizontalItemGutter)}`});return[ANt(e),vNt(e),yNt(e),mNt(e),gNt(e),xNt(e),pNt(e)]},bNt),TNt=()=>null;var PNt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var e,n,o,r,i,a,l,s,c,u,d;const{type:f,className:p,rootClassName:g,size:A,onEdit:y,hideAdd:S,centered:C,addIcon:P,removeIcon:v,moreIcon:T,more:w,popupClassName:x,children:b,items:R,animated:H,style:F,indicatorSize:E,indicator:N}=t,U=PNt(t,["type","className","rootClassName","size","onEdit","hideAdd","centered","addIcon","removeIcon","moreIcon","more","popupClassName","children","items","animated","style","indicatorSize","indicator"]),{prefixCls:W}=U,{direction:k,tabs:D,getPrefixCls:L,getPopupContainer:j}=m.useContext(Cr),B=L("tabs",W),O=Y0(B),[V,G,q]=SNt(B,O);let $;f==="editable-card"&&($={onEdit:(ee,de)=>{let{key:fe,event:pe}=de;y==null||y(ee==="add"?pe:fe,ee)},removeIcon:(e=v??(D==null?void 0:D.removeIcon))!==null&&e!==void 0?e:m.createElement(jw,null),addIcon:(P??(D==null?void 0:D.addIcon))||m.createElement(FWt,null),showAdd:S!==!0});const ie=L(),Q=zd(A),se=hNt(R,b),oe=uNt(B,H),Z=Object.assign(Object.assign({},D==null?void 0:D.style),F),te={align:(n=N==null?void 0:N.align)!==null&&n!==void 0?n:(o=D==null?void 0:D.indicator)===null||o===void 0?void 0:o.align,size:(l=(i=(r=N==null?void 0:N.size)!==null&&r!==void 0?r:E)!==null&&i!==void 0?i:(a=D==null?void 0:D.indicator)===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:D==null?void 0:D.indicatorSize};return V(m.createElement(sNt,Object.assign({direction:k,getPopupContainer:j},U,{items:se,className:Un({[`${B}-${Q}`]:Q,[`${B}-card`]:["card","editable-card"].includes(f),[`${B}-editable-card`]:f==="editable-card",[`${B}-centered`]:C},D==null?void 0:D.className,p,g,G,q,O),popupClassName:Un(x,G,q,O),style:Z,editable:$,more:Object.assign({icon:(d=(u=(c=(s=D==null?void 0:D.more)===null||s===void 0?void 0:s.icon)!==null&&c!==void 0?c:D==null?void 0:D.moreIcon)!==null&&u!==void 0?u:T)!==null&&d!==void 0?d:m.createElement($me,null),transitionName:`${ie}-slide-up`},w),prefixCls:B,animated:oe,indicator:te})))};hQ.TabPane=TNt;function CNt(t,e,n){var o=n||{},r=o.noTrailing,i=r===void 0?!1:r,a=o.noLeading,l=a===void 0?!1:a,s=o.debounceMode,c=s===void 0?void 0:s,u,d=!1,f=0;function p(){u&&clearTimeout(u)}function g(y){var S=y||{},C=S.upcomingOnly,P=C===void 0?!1:C;p(),d=!P}function A(){for(var y=arguments.length,S=new Array(y),C=0;Ct?l?(f=Date.now(),i||(u=setTimeout(c?w:T,t))):T():i!==!0&&(u=setTimeout(c?w:T,c===void 0?t-v:t))}return A.cancel=g,A}function RNt(t,e,n){var o={},r=o.atBegin,i=r===void 0?!1:r;return CNt(t,e,{debounceMode:i!==!1})}const HNt=t=>{const{checkboxCls:e}=t,n=`${e}-wrapper`;return[{[`${e}-group`]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",flexWrap:"wrap",columnGap:t.marginXS,[`> ${t.antCls}-row`]:{flex:1}}),[n]:Object.assign(Object.assign({},Na(t)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${n}`]:{marginInlineStart:0},[`&${n}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:t.borderRadiusSM,alignSelf:"center",[`${e}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${e}-inner`]:Object.assign({},dw(t))},[`${e}-inner`]:{boxSizing:"border-box",display:"block",width:t.checkboxSize,height:t.checkboxSize,direction:"ltr",backgroundColor:t.colorBgContainer,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,borderCollapse:"separate",transition:`all ${t.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:t.calc(t.checkboxSize).div(14).mul(5).equal(),height:t.calc(t.checkboxSize).div(14).mul(8).equal(),border:`${jt(t.lineWidthBold)} solid ${t.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${t.motionDurationFast} ${t.motionEaseInBack}, opacity ${t.motionDurationFast}`}},"& + span":{paddingInlineStart:t.paddingXS,paddingInlineEnd:t.paddingXS}})},{[` ${n}:not(${n}-disabled), ${e}:not(${e}-disabled) `]:{[`&:hover ${e}-inner`]:{borderColor:t.colorPrimary}},[`${n}:not(${n}-disabled)`]:{[`&:hover ${e}-checked:not(${e}-disabled) ${e}-inner`]:{backgroundColor:t.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${e}-checked:not(${e}-disabled):after`]:{borderColor:t.colorPrimaryHover}}},{[`${e}-checked`]:{[`${e}-inner`]:{backgroundColor:t.colorPrimary,borderColor:t.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack} ${t.motionDurationFast}`}}},[` @@ -4605,7 +4605,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho & > ${e}-header`]:{borderRadius:`0 0 ${jt(s)} ${jt(s)}`}},[`> ${e}-header`]:{position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:i,color:p,lineHeight:y,cursor:"pointer",transition:`all ${w}, visibility 0s`,[`> ${e}-header-text`]:{flex:"auto"},"&:focus":{outline:"none"},[`${e}-expand-icon`]:{height:R,display:"flex",alignItems:"center",paddingInlineEnd:C},[`${e}-arrow`]:Object.assign(Object.assign({},jH()),{fontSize:x,transition:`transform ${w}`,svg:{transition:`transform ${w}`}}),[`${e}-header-text`]:{marginInlineEnd:"auto"}},[`${e}-icon-collapsible-only`]:{cursor:"unset",[`${e}-expand-icon`]:{cursor:"pointer"}}},[`${e}-content`]:{color:f,backgroundColor:n,borderTop:F,[`& > ${e}-content-box`]:{padding:b},"&-hidden":{display:"none"}},"&-small":{[`> ${e}-item`]:{[`> ${e}-header`]:{padding:a,paddingInlineStart:T,[`> ${e}-expand-icon`]:{marginInlineStart:t.calc(P).sub(T).equal()}},[`> ${e}-content > ${e}-content-box`]:{padding:P}}},"&-large":{[`> ${e}-item`]:{fontSize:A,lineHeight:S,[`> ${e}-header`]:{padding:l,paddingInlineStart:o,[`> ${e}-expand-icon`]:{height:H,marginInlineStart:t.calc(v).sub(o).equal()}},[`> ${e}-content > ${e}-content-box`]:{padding:v}}},[`${e}-item:last-child`]:{borderBottom:0,[`> ${e}-content`]:{borderRadius:`0 0 ${jt(s)} ${jt(s)}`}},[`& ${e}-item-disabled > ${e}-header`]:{"\n &,\n & > .arrow\n ":{color:g,cursor:"not-allowed"}},[`&${e}-icon-position-end`]:{[`& > ${e}-item`]:{[`> ${e}-header`]:{[`${e}-expand-icon`]:{order:1,paddingInlineEnd:0,paddingInlineStart:C}}}}})}},ZNt=t=>{const{componentCls:e}=t,n=`> ${e}-item > ${e}-header ${e}-arrow`;return{[`${e}-rtl`]:{[n]:{transform:"rotate(180deg)"}}}},eUt=t=>{const{componentCls:e,headerBg:n,paddingXXS:o,colorBorder:r}=t;return{[`${e}-borderless`]:{backgroundColor:n,border:0,[`> ${e}-item`]:{borderBottom:`1px solid ${r}`},[` > ${e}-item:last-child, > ${e}-item:last-child ${e}-header - `]:{borderRadius:0},[`> ${e}-item:last-child`]:{borderBottom:0},[`> ${e}-item > ${e}-content`]:{backgroundColor:"transparent",borderTop:0},[`> ${e}-item > ${e}-content > ${e}-content-box`]:{paddingTop:o}}}},tUt=t=>{const{componentCls:e,paddingSM:n}=t;return{[`${e}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${e}-item`]:{borderBottom:0,[`> ${e}-content`]:{backgroundColor:"transparent",border:0,[`> ${e}-content-box`]:{paddingBlock:n}}}}}},nUt=t=>({headerPadding:`${t.paddingSM}px ${t.padding}px`,headerBg:t.colorFillAlter,contentPadding:`${t.padding}px 16px`,contentBg:t.colorBgContainer}),oUt=wl("Collapse",t=>{const e=qi(t,{collapseHeaderPaddingSM:`${jt(t.paddingXS)} ${jt(t.paddingSM)}`,collapseHeaderPaddingLG:`${jt(t.padding)} ${jt(t.paddingLG)}`,collapsePanelBorderRadius:t.borderRadiusLG});return[QNt(e),eUt(e),tUt(e),ZNt(e),kme(e)]},nUt),rUt=m.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o,collapse:r}=m.useContext(Cr),{prefixCls:i,className:a,rootClassName:l,style:s,bordered:c=!0,ghost:u,size:d,expandIconPosition:f="start",children:p,expandIcon:g}=t,A=zd(F=>{var E;return(E=d??F)!==null&&E!==void 0?E:"middle"}),y=n("collapse",i),S=n(),[C,P,v]=oUt(y),T=m.useMemo(()=>f==="left"?"start":f==="right"?"end":f,[f]),w=g??(r==null?void 0:r.expandIcon),x=m.useCallback(function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const E=typeof w=="function"?w(F):m.createElement(YG,{rotate:F.isActive?90:void 0});return j0(E,()=>{var N;return{className:Un((N=E==null?void 0:E.props)===null||N===void 0?void 0:N.className,`${y}-arrow`)}})},[w,y]),b=Un(`${y}-icon-position-${T}`,{[`${y}-borderless`]:!c,[`${y}-rtl`]:o==="rtl",[`${y}-ghost`]:!!u,[`${y}-${A}`]:A!=="middle"},r==null?void 0:r.className,a,l,P,v),R=Object.assign(Object.assign({},Mme(S)),{motionAppear:!1,leavedClassName:`${y}-content-hidden`}),H=m.useMemo(()=>p?Y9(p).map((F,E)=>{var N,U;if(!((N=F.props)===null||N===void 0)&&N.disabled){const W=(U=F.key)!==null&&U!==void 0?U:String(E),{disabled:k,collapsible:D}=F.props,L=Object.assign(Object.assign({},dp(F.props,["disabled"])),{key:W,collapsible:D??(k?"disabled":void 0)});return j0(F,L)}return F}):null,[p]);return C(m.createElement(dye,Object.assign({ref:e,openMotion:R},dp(t,["rootClassName"]),{expandIcon:x,prefixCls:y,className:b,style:Object.assign(Object.assign({},r==null?void 0:r.style),s)}),H))}),fye=Object.assign(rUt,{Panel:$Nt}),iUt=t=>{const{componentCls:e,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:r,textPaddingInline:i,orientationMargin:a,verticalMarginInline:l}=t;return{[e]:Object.assign(Object.assign({},Na(t)),{borderBlockStart:`${jt(r)} solid ${o}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:l,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${jt(r)} solid ${o}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${jt(t.dividerHorizontalGutterMargin)} 0`},[`&-horizontal${e}-with-text`]:{display:"flex",alignItems:"center",margin:`${jt(t.dividerHorizontalWithTextGutterMargin)} 0`,color:t.colorTextHeading,fontWeight:500,fontSize:t.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${o}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${jt(r)} solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${e}-with-text-left`]:{"&::before":{width:`calc(${a} * 100%)`},"&::after":{width:`calc(100% - ${a} * 100%)`}},[`&-horizontal${e}-with-text-right`]:{"&::before":{width:`calc(100% - ${a} * 100%)`},"&::after":{width:`calc(${a} * 100%)`}},[`${e}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${e}-dashed`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${e}-with-text`]:{color:t.colorText,fontWeight:"normal",fontSize:t.fontSize},[`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${e}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${e}-inner-text`]:{paddingInlineEnd:n}}})}},aUt=t=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:t.marginXS}),lUt=wl("Divider",t=>{const e=qi(t,{dividerHorizontalWithTextGutterMargin:t.margin,dividerHorizontalGutterMargin:t.marginLG,sizePaddingEdgeHorizontal:0});return[iUt(e)]},aUt,{unitless:{orientationMargin:!0}});var sUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n,divider:o}=m.useContext(Cr),{prefixCls:r,type:i="horizontal",orientation:a="center",orientationMargin:l,className:s,rootClassName:c,children:u,dashed:d,plain:f,style:p}=t,g=sUt(t,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),A=e("divider",r),[y,S,C]=lUt(A),P=a.length>0?`-${a}`:a,v=!!u,T=a==="left"&&l!=null,w=a==="right"&&l!=null,x=Un(A,o==null?void 0:o.className,S,C,`${A}-${i}`,{[`${A}-with-text`]:v,[`${A}-with-text${P}`]:v,[`${A}-dashed`]:!!d,[`${A}-plain`]:!!f,[`${A}-rtl`]:n==="rtl",[`${A}-no-default-orientation-margin-left`]:T,[`${A}-no-default-orientation-margin-right`]:w},s,c),b=m.useMemo(()=>typeof l=="number"?l:/^\d+$/.test(l)?Number(l):l,[l]),R=Object.assign(Object.assign({},T&&{marginLeft:b}),w&&{marginRight:b});return y(m.createElement("div",Object.assign({className:x,style:Object.assign(Object.assign({},o==null?void 0:o.style),p)},g,{role:"separator"}),u&&i!=="vertical"&&m.createElement("span",{className:`${A}-inner-text`,style:R},u)))};var cUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},uUt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:cUt}))},dUt=m.forwardRef(uUt);function yue(){return typeof BigInt=="function"}function RJe(t){return!t&&t!==0&&!Number.isNaN(t)||!String(t).trim()}function xx(t){var e=t.trim(),n=e.startsWith("-");n&&(e=e.slice(1)),e=e.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),e.startsWith(".")&&(e="0".concat(e));var o=e||"0",r=o.split("."),i=r[0]||"0",a=r[1]||"0";i==="0"&&a==="0"&&(n=!1);var l=n?"-":"";return{negative:n,negativeStr:l,trimStr:o,integerStr:i,decimalStr:a,fullStr:"".concat(l).concat(o)}}function hye(t){var e=String(t);return!Number.isNaN(Number(e))&&e.includes("e")}function Ov(t){var e=String(t);if(hye(t)){var n=Number(e.slice(e.indexOf("e-")+2)),o=e.match(/\.(\d+)/);return o!=null&&o[1]&&(n+=o[1].length),n}return e.includes(".")&&pye(e)?e.length-e.indexOf(".")-1:0}function pQ(t){var e=String(t);if(hye(t)){if(t>Number.MAX_SAFE_INTEGER)return String(yue()?BigInt(t).toString():Number.MAX_SAFE_INTEGER);if(t0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":xx("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),t}(),hUt=function(){function t(e){if(wp(this,t),Jt(this,"origin",""),Jt(this,"number",void 0),Jt(this,"empty",void 0),RJe(e)){this.empty=!0;return}this.origin=String(e),this.number=Number(e)}return vp(t,[{key:"negate",value:function(){return new t(-this.toNumber())}},{key:"add",value:function(n){if(this.isInvalidate())return new t(n);var o=Number(n);if(Number.isNaN(o))return this;var r=this.number+o;if(r>Number.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(r0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":pQ(this.number):this.origin}}]),t}();function r2(t){return yue()?new fUt(t):new hUt(t)}function ZV(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t==="")return"";var r=xx(t),i=r.negativeStr,a=r.integerStr,l=r.decimalStr,s="".concat(e).concat(l),c="".concat(i).concat(a);if(n>=0){var u=Number(l[n]);if(u>=5&&!o){var d=r2(t).add("".concat(i,"0.").concat("0".repeat(n)).concat(10-u));return ZV(d.toString(),e,n,o)}return n===0?c:"".concat(c).concat(e).concat(l.padEnd(n,"0").slice(0,n))}return s===".0"?c:"".concat(c).concat(s)}function pUt(t){return!!(t.addonBefore||t.addonAfter)}function gUt(t){return!!(t.prefix||t.suffix||t.allowClear)}function Rxe(t,e,n){var o=e.cloneNode(!0),r=Object.create(t,{target:{value:o},currentTarget:{value:o}});return o.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(o.selectionStart=e.selectionStart,o.selectionEnd=e.selectionEnd),r}function KG(t,e,n,o){if(n){var r=e;if(e.type==="click"){r=Rxe(e,t,""),n(r);return}if(t.type!=="file"&&o!==void 0){r=Rxe(e,t,o),n(r);return}n(r)}}function HJe(t,e){if(t){t.focus(e);var n=e||{},o=n.cursor;if(o){var r=t.value.length;switch(o){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(r,r);break;default:t.setSelectionRange(0,r)}}}}var gye=function(e){var n,o,r=e.inputElement,i=e.children,a=e.prefixCls,l=e.prefix,s=e.suffix,c=e.addonBefore,u=e.addonAfter,d=e.className,f=e.style,p=e.disabled,g=e.readOnly,A=e.focused,y=e.triggerFocus,S=e.allowClear,C=e.value,P=e.handleReset,v=e.hidden,T=e.classes,w=e.classNames,x=e.dataAttrs,b=e.styles,R=e.components,H=i??r,F=(R==null?void 0:R.affixWrapper)||"span",E=(R==null?void 0:R.groupWrapper)||"span",N=(R==null?void 0:R.wrapper)||"span",U=(R==null?void 0:R.groupAddon)||"span",W=m.useRef(null),k=function(he){var pe;(pe=W.current)!==null&&pe!==void 0&&pe.contains(he.target)&&(y==null||y())},D=gUt(e),L=m.cloneElement(H,{value:C,className:Xn(H.props.className,!D&&(w==null?void 0:w.variant))||null});if(D){var j,B=null;if(S){var O,V=!p&&!g&&C,G="".concat(a,"-clear-icon"),q=hi(S)==="object"&&S!==null&&S!==void 0&&S.clearIcon?S.clearIcon:"✖";B=be.createElement("span",{onClick:P,onMouseDown:function(he){return he.preventDefault()},className:Xn(G,(O={},Jt(O,"".concat(G,"-hidden"),!V),Jt(O,"".concat(G,"-has-suffix"),!!s),O)),role:"button",tabIndex:-1},q)}var $="".concat(a,"-affix-wrapper"),ie=Xn($,(j={},Jt(j,"".concat(a,"-disabled"),p),Jt(j,"".concat($,"-disabled"),p),Jt(j,"".concat($,"-focused"),A),Jt(j,"".concat($,"-readonly"),g),Jt(j,"".concat($,"-input-with-clear-btn"),s&&S&&C),j),T==null?void 0:T.affixWrapper,w==null?void 0:w.affixWrapper,w==null?void 0:w.variant),Q=(s||S)&&be.createElement("span",{className:Xn("".concat(a,"-suffix"),w==null?void 0:w.suffix),style:b==null?void 0:b.suffix},B,s);L=be.createElement(F,go({className:ie,style:b==null?void 0:b.affixWrapper,onClick:k},x==null?void 0:x.affixWrapper,{ref:W}),l&&be.createElement("span",{className:Xn("".concat(a,"-prefix"),w==null?void 0:w.prefix),style:b==null?void 0:b.prefix},l),L,Q)}if(pUt(e)){var se="".concat(a,"-group"),Z="".concat(se,"-addon"),ee="".concat(se,"-wrapper"),te=Xn("".concat(a,"-wrapper"),se,T==null?void 0:T.wrapper,w==null?void 0:w.wrapper),oe=Xn(ee,Jt({},"".concat(ee,"-disabled"),p),T==null?void 0:T.group,w==null?void 0:w.groupWrapper);L=be.createElement(E,{className:oe},be.createElement(N,{className:te},c&&be.createElement(U,{className:Z},c),L,u&&be.createElement(U,{className:Z},u)))}return be.cloneElement(L,{className:Xn((n=L.props)===null||n===void 0?void 0:n.className,d)||null,style:en(en({},(o=L.props)===null||o===void 0?void 0:o.style),f),hidden:v})},mUt=["show"];function MJe(t,e){return m.useMemo(function(){var n={};e&&(n.show=hi(e)==="object"&&e.formatter?e.formatter:!!e),n=en(en({},n),t);var o=n,r=o.show,i=oi(o,mUt);return en(en({},i),{},{show:!!r,showFormatter:typeof r=="function"?r:void 0,strategy:i.strategy||function(a){return a.length}})},[t,e])}var yUt=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],AUt=m.forwardRef(function(t,e){var n=t.autoComplete,o=t.onChange,r=t.onFocus,i=t.onBlur,a=t.onPressEnter,l=t.onKeyDown,s=t.prefixCls,c=s===void 0?"rc-input":s,u=t.disabled,d=t.htmlSize,f=t.className,p=t.maxLength,g=t.suffix,A=t.showCount,y=t.count,S=t.type,C=S===void 0?"text":S,P=t.classes,v=t.classNames,T=t.styles,w=t.onCompositionStart,x=t.onCompositionEnd,b=oi(t,yUt),R=m.useState(!1),H=sn(R,2),F=H[0],E=H[1],N=m.useRef(!1),U=m.useRef(null),W=function(Se){U.current&&HJe(U.current,Se)},k=Es(t.defaultValue,{value:t.value}),D=sn(k,2),L=D[0],j=D[1],B=L==null?"":String(L),O=m.useState(null),V=sn(O,2),G=V[0],q=V[1],$=MJe(y,A),ie=$.max||p,Q=$.strategy(B),se=!!ie&&Q>ie;m.useImperativeHandle(e,function(){return{focus:W,blur:function(){var Se;(Se=U.current)===null||Se===void 0||Se.blur()},setSelectionRange:function(Se,Re,De){var Ae;(Ae=U.current)===null||Ae===void 0||Ae.setSelectionRange(Se,Re,De)},select:function(){var Se;(Se=U.current)===null||Se===void 0||Se.select()},input:U.current}}),m.useEffect(function(){E(function(ge){return ge&&u?!1:ge})},[u]);var Z=function(Se,Re,De){var Ae=Re;if(!N.current&&$.exceedFormatter&&$.max&&$.strategy(Re)>$.max){if(Ae=$.exceedFormatter(Re,{max:$.max}),Re!==Ae){var ue,fe;q([((ue=U.current)===null||ue===void 0?void 0:ue.selectionStart)||0,((fe=U.current)===null||fe===void 0?void 0:fe.selectionEnd)||0])}}else if(De.source==="compositionEnd")return;j(Ae),U.current&&KG(U.current,Se,o,Ae)};m.useEffect(function(){if(G){var ge;(ge=U.current)===null||ge===void 0||ge.setSelectionRange.apply(ge,No(G))}},[G]);var ee=function(Se){Z(Se,Se.target.value,{source:"change"})},te=function(Se){N.current=!1,Z(Se,Se.currentTarget.value,{source:"compositionEnd"}),x==null||x(Se)},oe=function(Se){a&&Se.key==="Enter"&&a(Se),l==null||l(Se)},de=function(Se){E(!0),r==null||r(Se)},he=function(Se){E(!1),i==null||i(Se)},pe=function(Se){j(""),W(),U.current&&KG(U.current,Se,o)},me=se&&"".concat(c,"-out-of-range"),le=function(){var Se=OH(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames"]);return be.createElement("input",go({autoComplete:n},Se,{onChange:ee,onFocus:de,onBlur:he,onKeyDown:oe,className:Xn(c,Jt({},"".concat(c,"-disabled"),u),v==null?void 0:v.input),style:T==null?void 0:T.input,ref:U,size:d,type:C,onCompositionStart:function(De){N.current=!0,w==null||w(De)},onCompositionEnd:te}))},Te=function(){var Se=Number(ie)>0;if(g||$.show){var Re=$.showFormatter?$.showFormatter({value:B,count:Q,maxLength:ie}):"".concat(Q).concat(Se?" / ".concat(ie):"");return be.createElement(be.Fragment,null,$.show&&be.createElement("span",{className:Xn("".concat(c,"-show-count-suffix"),Jt({},"".concat(c,"-show-count-has-suffix"),!!g),v==null?void 0:v.count),style:en({},T==null?void 0:T.count)},Re),g)}return null};return be.createElement(gye,go({},b,{prefixCls:c,className:Xn(f,me),handleReset:pe,value:B,focused:F,triggerFocus:W,suffix:Te(),disabled:u,classes:P,classNames:v,styles:T}),le())});function wUt(t,e){var n=m.useRef(null);function o(){try{var i=t.selectionStart,a=t.selectionEnd,l=t.value,s=l.substring(0,i),c=l.substring(a);n.current={start:i,end:a,value:l,beforeTxt:s,afterTxt:c}}catch{}}function r(){if(t&&n.current&&e)try{var i=t.value,a=n.current,l=a.beforeTxt,s=a.afterTxt,c=a.start,u=i.length;if(i.endsWith(s))u=i.length-n.current.afterTxt.length;else if(i.startsWith(l))u=l.length;else{var d=l[c-1],f=i.indexOf(d,c-1);f!==-1&&(u=f+1)}t.setSelectionRange(u,u)}catch(p){U0(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(p.message))}}return[o,r]}var vUt=function(){var e=m.useState(!1),n=sn(e,2),o=n[0],r=n[1];return _a(function(){r(X$())},[]),o},xUt=200,bUt=600;function SUt(t){var e=t.prefixCls,n=t.upNode,o=t.downNode,r=t.upDisabled,i=t.downDisabled,a=t.onStep,l=m.useRef(),s=m.useRef([]),c=m.useRef();c.current=a;var u=function(){clearTimeout(l.current)},d=function(P,v){P.preventDefault(),u(),c.current(v);function T(){c.current(v),l.current=setTimeout(T,xUt)}l.current=setTimeout(T,bUt)};m.useEffect(function(){return function(){u(),s.current.forEach(function(C){return Ea.cancel(C)})}},[]);var f=vUt();if(f)return null;var p="".concat(e,"-handler"),g=Xn(p,"".concat(p,"-up"),Jt({},"".concat(p,"-up-disabled"),r)),A=Xn(p,"".concat(p,"-down"),Jt({},"".concat(p,"-down-disabled"),i)),y=function(){return s.current.push(Ea(u))},S={unselectable:"on",role:"button",onMouseUp:y,onMouseLeave:y};return m.createElement("div",{className:"".concat(p,"-wrap")},m.createElement("span",go({},S,{onMouseDown:function(P){d(P,!0)},"aria-label":"Increase Value","aria-disabled":r,className:g}),n||m.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-up-inner")})),m.createElement("span",go({},S,{onMouseDown:function(P){d(P,!1)},"aria-label":"Decrease Value","aria-disabled":i,className:A}),o||m.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-down-inner")})))}function Hxe(t){var e=typeof t=="number"?pQ(t):xx(t).fullStr,n=e.includes(".");return n?xx(e.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:t+"0"}const TUt=function(){var t=m.useRef(0),e=function(){Ea.cancel(t.current)};return m.useEffect(function(){return e},[]),function(n){e(),t.current=Ea(function(){n()})}};var PUt=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur"],CUt=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],Mxe=function(e,n){return e||n.isEmpty()?n.toString():n.toNumber()},Ixe=function(e){var n=r2(e);return n.isInvalidate()?null:n},RUt=m.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-input-number":o,i=t.className,a=t.style,l=t.min,s=t.max,c=t.step,u=c===void 0?1:c,d=t.defaultValue,f=t.value,p=t.disabled,g=t.readOnly,A=t.upHandler,y=t.downHandler,S=t.keyboard,C=t.changeOnWheel,P=C===void 0?!1:C,v=t.controls,T=v===void 0?!0:v;t.classNames;var w=t.stringMode,x=t.parser,b=t.formatter,R=t.precision,H=t.decimalSeparator,F=t.onChange,E=t.onInput,N=t.onPressEnter,U=t.onStep,W=t.changeOnBlur,k=W===void 0?!0:W,D=oi(t,PUt),L="".concat(r,"-input"),j=m.useRef(null),B=m.useState(!1),O=sn(B,2),V=O[0],G=O[1],q=m.useRef(!1),$=m.useRef(!1),ie=m.useRef(!1),Q=m.useState(function(){return r2(f??d)}),se=sn(Q,2),Z=se[0],ee=se[1];function te(gt){f===void 0&&ee(gt)}var oe=m.useCallback(function(gt,Ye){if(!Ye)return R>=0?R:Math.max(Ov(gt),Ov(u))},[R,u]),de=m.useCallback(function(gt){var Ye=String(gt);if(x)return x(Ye);var it=Ye;return H&&(it=it.replace(H,".")),it.replace(/[^\w.-]+/g,"")},[x,H]),he=m.useRef(""),pe=m.useCallback(function(gt,Ye){if(b)return b(gt,{userTyping:Ye,input:String(he.current)});var it=typeof gt=="number"?pQ(gt):gt;if(!Ye){var ut=oe(it,Ye);if(pye(it)&&(H||ut>=0)){var Qe=H||".";it=ZV(it,Qe,ut)}}return it},[b,oe,H]),me=m.useState(function(){var gt=d??f;return Z.isInvalidate()&&["string","number"].includes(hi(gt))?Number.isNaN(gt)?"":gt:pe(Z.toString(),!1)}),le=sn(me,2),Te=le[0],ge=le[1];he.current=Te;function Se(gt,Ye){ge(pe(gt.isInvalidate()?gt.toString(!1):gt.toString(!Ye),Ye))}var Re=m.useMemo(function(){return Ixe(s)},[s,R]),De=m.useMemo(function(){return Ixe(l)},[l,R]),Ae=m.useMemo(function(){return!Re||!Z||Z.isInvalidate()?!1:Re.lessEquals(Z)},[Re,Z]),ue=m.useMemo(function(){return!De||!Z||Z.isInvalidate()?!1:Z.lessEquals(De)},[De,Z]),fe=wUt(j.current,V),ve=sn(fe,2),we=ve[0],Pe=ve[1],Ie=function(Ye){return Re&&!Ye.lessEquals(Re)?Re:De&&!De.lessEquals(Ye)?De:null},Me=function(Ye){return!Ie(Ye)},ze=function(Ye,it){var ut=Ye,Qe=Me(ut)||ut.isEmpty();if(!ut.isEmpty()&&!it&&(ut=Ie(ut)||ut,Qe=!0),!g&&!p&&Qe){var lt=ut.toString(),Ze=oe(lt,it);return Ze>=0&&(ut=r2(ZV(lt,".",Ze)),Me(ut)||(ut=r2(ZV(lt,".",Ze,!0)))),ut.equals(Z)||(te(ut),F==null||F(ut.isEmpty()?null:Mxe(w,ut)),f===void 0&&Se(ut,it)),ut}return Z},Ne=TUt(),Je=function gt(Ye){if(we(),he.current=Ye,ge(Ye),!$.current){var it=de(Ye),ut=r2(it);ut.isNaN()||ze(ut,!0)}E==null||E(Ye),Ne(function(){var Qe=Ye;x||(Qe=Ye.replace(/。/g,".")),Qe!==Ye&>(Qe)})},Ue=function(){$.current=!0},nt=function(){$.current=!1,Je(j.current.value)},We=function(Ye){Je(Ye.target.value)},Ee=function(Ye){var it;if(!(Ye&&Ae||!Ye&&ue)){q.current=!1;var ut=r2(ie.current?Hxe(u):u);Ye||(ut=ut.negate());var Qe=(Z||r2(0)).add(ut.toString()),lt=ze(Qe,!1);U==null||U(Mxe(w,lt),{offset:ie.current?Hxe(u):u,type:Ye?"up":"down"}),(it=j.current)===null||it===void 0||it.focus()}},ke=function(Ye){var it=r2(de(Te)),ut=it;it.isNaN()?ut=ze(Z,Ye):ut=ze(it,Ye),f!==void 0?Se(Z,!1):ut.isNaN()||Se(ut,!1)},Oe=function(){q.current=!0},st=function(Ye){var it=Ye.key,ut=Ye.shiftKey;q.current=!0,ie.current=ut,it==="Enter"&&($.current||(q.current=!1),ke(!1),N==null||N(Ye)),S!==!1&&!$.current&&["Up","ArrowUp","Down","ArrowDown"].includes(it)&&(Ee(it==="Up"||it==="ArrowUp"),Ye.preventDefault())},je=function(){q.current=!1,ie.current=!1};m.useEffect(function(){if(P&&V){var gt=function(ut){Ee(ut.deltaY<0),ut.preventDefault()},Ye=j.current;if(Ye)return Ye.addEventListener("wheel",gt,{passive:!1}),function(){return Ye.removeEventListener("wheel",gt)}}});var xt=function(){k&&ke(!1),G(!1),q.current=!1};return yx(function(){Z.isInvalidate()||Se(Z,!1)},[R,b]),yx(function(){var gt=r2(f);ee(gt);var Ye=r2(de(Te));(!gt.equals(Ye)||!q.current||b)&&Se(gt,q.current)},[f]),yx(function(){b&&Pe()},[Te]),m.createElement("div",{className:Xn(r,i,(n={},Jt(n,"".concat(r,"-focused"),V),Jt(n,"".concat(r,"-disabled"),p),Jt(n,"".concat(r,"-readonly"),g),Jt(n,"".concat(r,"-not-a-number"),Z.isNaN()),Jt(n,"".concat(r,"-out-of-range"),!Z.isInvalidate()&&!Me(Z)),n)),style:a,onFocus:function(){G(!0)},onBlur:xt,onKeyDown:st,onKeyUp:je,onCompositionStart:Ue,onCompositionEnd:nt,onBeforeInput:Oe},T&&m.createElement(SUt,{prefixCls:r,upNode:A,downNode:y,upDisabled:Ae,downDisabled:ue,onStep:Ee}),m.createElement("div",{className:"".concat(L,"-wrap")},m.createElement("input",go({autoComplete:"off",role:"spinbutton","aria-valuemin":l,"aria-valuemax":s,"aria-valuenow":Z.isInvalidate()?null:Z.toString(),step:u},D,{ref:jb(j,e),className:L,value:Te,onChange:We,disabled:p,readOnly:g}))))}),IJe=m.forwardRef(function(t,e){var n=t.disabled,o=t.style,r=t.prefixCls,i=t.value,a=t.prefix,l=t.suffix,s=t.addonBefore,c=t.addonAfter,u=t.className,d=t.classNames,f=oi(t,CUt),p=m.useRef(null),g=function(y){p.current&&HJe(p.current,y)};return m.createElement(gye,{className:u,triggerFocus:g,prefixCls:r,value:i,disabled:n,style:o,prefix:a,suffix:l,addonAfter:c,addonBefore:s,classNames:d,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"}},m.createElement(RUt,go({prefixCls:r,disabled:n,ref:jb(p,e),className:d==null?void 0:d.input},f)))});IJe.displayName="InputNumber";const HUt=t=>{var e;const n=(e=t.handleVisible)!==null&&e!==void 0?e:"auto";return Object.assign(Object.assign({},ZW(t)),{controlWidth:90,handleWidth:t.controlHeightSM-t.lineWidth*2,handleFontSize:t.fontSize/2,handleVisible:n,handleActiveBg:t.colorFillAlter,handleBg:t.colorBgContainer,filledHandleBg:new Wl(t.colorFillSecondary).onBackground(t.colorBgContainer).toHexString(),handleHoverColor:t.colorPrimary,handleBorderColor:t.colorBorder,handleOpacity:n===!0?1:0})},zxe=(t,e)=>{let{componentCls:n,borderRadiusSM:o,borderRadiusLG:r}=t;const i=e==="lg"?r:o;return{[`&-${e}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},MUt=t=>{const{componentCls:e,lineWidth:n,lineType:o,borderRadius:r,fontSizeLG:i,controlHeightLG:a,controlHeightSM:l,colorError:s,paddingInlineSM:c,paddingBlockSM:u,paddingBlockLG:d,paddingInlineLG:f,colorTextDescription:p,motionDurationMid:g,handleHoverColor:A,paddingInline:y,paddingBlock:S,handleBg:C,handleActiveBg:P,colorTextDisabled:v,borderRadiusSM:T,borderRadiusLG:w,controlWidth:x,handleOpacity:b,handleBorderColor:R,filledHandleBg:H,lineHeightLG:F,calc:E}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),eN(t)),{display:"inline-block",width:x,margin:0,padding:0,borderRadius:r}),iye(t,{[`${e}-handler-wrap`]:{background:C,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${R}`}}})),lye(t,{[`${e}-handler-wrap`]:{background:H,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${R}`}},"&:focus-within":{[`${e}-handler-wrap`]:{background:C}}})),aye(t)),{"&-rtl":{direction:"rtl",[`${e}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:i,lineHeight:F,borderRadius:w,[`input${e}-input`]:{height:E(a).sub(E(n).mul(2)).equal(),padding:`${jt(d)} ${jt(f)}`}},"&-sm":{padding:0,borderRadius:T,[`input${e}-input`]:{height:E(l).sub(E(n).mul(2)).equal(),padding:`${jt(u)} ${jt(c)}`}},"&-out-of-range":{[`${e}-input-wrap`]:{input:{color:s}}},"&-group":Object.assign(Object.assign(Object.assign({},Na(t)),fJe(t)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${e}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${e}-group-addon`]:{borderRadius:w,fontSize:t.fontSizeLG}},"&-sm":{[`${e}-group-addon`]:{borderRadius:T}}},sJe(t)),uJe(t)),{[`&:not(${e}-compact-first-item):not(${e}-compact-last-item)${e}-compact-item`]:{[`${e}, ${e}-group-addon`]:{borderRadius:0}},[`&:not(${e}-compact-last-item)${e}-compact-first-item`]:{[`${e}, ${e}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${e}-compact-first-item)${e}-compact-last-item`]:{[`${e}, ${e}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${e}-input`]:{cursor:"not-allowed"},[e]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{width:"100%",padding:`${jt(S)} ${jt(y)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:r,outline:0,transition:`all ${g} linear`,appearance:"textfield",fontSize:"inherit"}),sye(t.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})}})},{[e]:Object.assign(Object.assign(Object.assign({[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{opacity:1},[`${e}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:t.handleWidth,height:"100%",borderStartStartRadius:0,borderStartEndRadius:r,borderEndEndRadius:r,borderEndStartRadius:0,opacity:b,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`opacity ${g} linear ${g}`,[`${e}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[` + `]:{borderRadius:0},[`> ${e}-item:last-child`]:{borderBottom:0},[`> ${e}-item > ${e}-content`]:{backgroundColor:"transparent",borderTop:0},[`> ${e}-item > ${e}-content > ${e}-content-box`]:{paddingTop:o}}}},tUt=t=>{const{componentCls:e,paddingSM:n}=t;return{[`${e}-ghost`]:{backgroundColor:"transparent",border:0,[`> ${e}-item`]:{borderBottom:0,[`> ${e}-content`]:{backgroundColor:"transparent",border:0,[`> ${e}-content-box`]:{paddingBlock:n}}}}}},nUt=t=>({headerPadding:`${t.paddingSM}px ${t.padding}px`,headerBg:t.colorFillAlter,contentPadding:`${t.padding}px 16px`,contentBg:t.colorBgContainer}),oUt=wl("Collapse",t=>{const e=qi(t,{collapseHeaderPaddingSM:`${jt(t.paddingXS)} ${jt(t.paddingSM)}`,collapseHeaderPaddingLG:`${jt(t.padding)} ${jt(t.paddingLG)}`,collapsePanelBorderRadius:t.borderRadiusLG});return[QNt(e),eUt(e),tUt(e),ZNt(e),kme(e)]},nUt),rUt=m.forwardRef((t,e)=>{const{getPrefixCls:n,direction:o,collapse:r}=m.useContext(Cr),{prefixCls:i,className:a,rootClassName:l,style:s,bordered:c=!0,ghost:u,size:d,expandIconPosition:f="start",children:p,expandIcon:g}=t,A=zd(F=>{var E;return(E=d??F)!==null&&E!==void 0?E:"middle"}),y=n("collapse",i),S=n(),[C,P,v]=oUt(y),T=m.useMemo(()=>f==="left"?"start":f==="right"?"end":f,[f]),w=g??(r==null?void 0:r.expandIcon),x=m.useCallback(function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const E=typeof w=="function"?w(F):m.createElement(YG,{rotate:F.isActive?90:void 0});return j0(E,()=>{var N;return{className:Un((N=E==null?void 0:E.props)===null||N===void 0?void 0:N.className,`${y}-arrow`)}})},[w,y]),b=Un(`${y}-icon-position-${T}`,{[`${y}-borderless`]:!c,[`${y}-rtl`]:o==="rtl",[`${y}-ghost`]:!!u,[`${y}-${A}`]:A!=="middle"},r==null?void 0:r.className,a,l,P,v),R=Object.assign(Object.assign({},Mme(S)),{motionAppear:!1,leavedClassName:`${y}-content-hidden`}),H=m.useMemo(()=>p?Y9(p).map((F,E)=>{var N,U;if(!((N=F.props)===null||N===void 0)&&N.disabled){const W=(U=F.key)!==null&&U!==void 0?U:String(E),{disabled:k,collapsible:D}=F.props,L=Object.assign(Object.assign({},dp(F.props,["disabled"])),{key:W,collapsible:D??(k?"disabled":void 0)});return j0(F,L)}return F}):null,[p]);return C(m.createElement(dye,Object.assign({ref:e,openMotion:R},dp(t,["rootClassName"]),{expandIcon:x,prefixCls:y,className:b,style:Object.assign(Object.assign({},r==null?void 0:r.style),s)}),H))}),fye=Object.assign(rUt,{Panel:$Nt}),iUt=t=>{const{componentCls:e,sizePaddingEdgeHorizontal:n,colorSplit:o,lineWidth:r,textPaddingInline:i,orientationMargin:a,verticalMarginInline:l}=t;return{[e]:Object.assign(Object.assign({},Na(t)),{borderBlockStart:`${jt(r)} solid ${o}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:l,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${jt(r)} solid ${o}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${jt(t.dividerHorizontalGutterMargin)} 0`},[`&-horizontal${e}-with-text`]:{display:"flex",alignItems:"center",margin:`${jt(t.dividerHorizontalWithTextGutterMargin)} 0`,color:t.colorTextHeading,fontWeight:500,fontSize:t.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${o}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${jt(r)} solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${e}-with-text-left`]:{"&::before":{width:`calc(${a} * 100%)`},"&::after":{width:`calc(100% - ${a} * 100%)`}},[`&-horizontal${e}-with-text-right`]:{"&::before":{width:`calc(100% - ${a} * 100%)`},"&::after":{width:`calc(${a} * 100%)`}},[`${e}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:o,borderStyle:"dashed",borderWidth:`${jt(r)} 0 0`},[`&-horizontal${e}-with-text${e}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${e}-dashed`]:{borderInlineStartWidth:r,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${e}-with-text`]:{color:t.colorText,fontWeight:"normal",fontSize:t.fontSize},[`&-horizontal${e}-with-text-left${e}-no-default-orientation-margin-left`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${e}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${e}-with-text-right${e}-no-default-orientation-margin-right`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${e}-inner-text`]:{paddingInlineEnd:n}}})}},aUt=t=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:t.marginXS}),lUt=wl("Divider",t=>{const e=qi(t,{dividerHorizontalWithTextGutterMargin:t.margin,dividerHorizontalGutterMargin:t.marginLG,sizePaddingEdgeHorizontal:0});return[iUt(e)]},aUt,{unitless:{orientationMargin:!0}});var sUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:e,direction:n,divider:o}=m.useContext(Cr),{prefixCls:r,type:i="horizontal",orientation:a="center",orientationMargin:l,className:s,rootClassName:c,children:u,dashed:d,plain:f,style:p}=t,g=sUt(t,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","plain","style"]),A=e("divider",r),[y,S,C]=lUt(A),P=a.length>0?`-${a}`:a,v=!!u,T=a==="left"&&l!=null,w=a==="right"&&l!=null,x=Un(A,o==null?void 0:o.className,S,C,`${A}-${i}`,{[`${A}-with-text`]:v,[`${A}-with-text${P}`]:v,[`${A}-dashed`]:!!d,[`${A}-plain`]:!!f,[`${A}-rtl`]:n==="rtl",[`${A}-no-default-orientation-margin-left`]:T,[`${A}-no-default-orientation-margin-right`]:w},s,c),b=m.useMemo(()=>typeof l=="number"?l:/^\d+$/.test(l)?Number(l):l,[l]),R=Object.assign(Object.assign({},T&&{marginLeft:b}),w&&{marginRight:b});return y(m.createElement("div",Object.assign({className:x,style:Object.assign(Object.assign({},o==null?void 0:o.style),p)},g,{role:"separator"}),u&&i!=="vertical"&&m.createElement("span",{className:`${A}-inner-text`,style:R},u)))};var cUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},uUt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:cUt}))},dUt=m.forwardRef(uUt);function yue(){return typeof BigInt=="function"}function RJe(t){return!t&&t!==0&&!Number.isNaN(t)||!String(t).trim()}function xx(t){var e=t.trim(),n=e.startsWith("-");n&&(e=e.slice(1)),e=e.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),e.startsWith(".")&&(e="0".concat(e));var o=e||"0",r=o.split("."),i=r[0]||"0",a=r[1]||"0";i==="0"&&a==="0"&&(n=!1);var l=n?"-":"";return{negative:n,negativeStr:l,trimStr:o,integerStr:i,decimalStr:a,fullStr:"".concat(l).concat(o)}}function hye(t){var e=String(t);return!Number.isNaN(Number(e))&&e.includes("e")}function Ov(t){var e=String(t);if(hye(t)){var n=Number(e.slice(e.indexOf("e-")+2)),o=e.match(/\.(\d+)/);return o!=null&&o[1]&&(n+=o[1].length),n}return e.includes(".")&&pye(e)?e.length-e.indexOf(".")-1:0}function pQ(t){var e=String(t);if(hye(t)){if(t>Number.MAX_SAFE_INTEGER)return String(yue()?BigInt(t).toString():Number.MAX_SAFE_INTEGER);if(t0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":xx("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),t}(),hUt=function(){function t(e){if(wp(this,t),Jt(this,"origin",""),Jt(this,"number",void 0),Jt(this,"empty",void 0),RJe(e)){this.empty=!0;return}this.origin=String(e),this.number=Number(e)}return vp(t,[{key:"negate",value:function(){return new t(-this.toNumber())}},{key:"add",value:function(n){if(this.isInvalidate())return new t(n);var o=Number(n);if(Number.isNaN(o))return this;var r=this.number+o;if(r>Number.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(rNumber.MAX_SAFE_INTEGER)return new t(Number.MAX_SAFE_INTEGER);if(r0&&arguments[0]!==void 0?arguments[0]:!0;return n?this.isInvalidate()?"":pQ(this.number):this.origin}}]),t}();function r2(t){return yue()?new fUt(t):new hUt(t)}function ZV(t,e,n){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t==="")return"";var r=xx(t),i=r.negativeStr,a=r.integerStr,l=r.decimalStr,s="".concat(e).concat(l),c="".concat(i).concat(a);if(n>=0){var u=Number(l[n]);if(u>=5&&!o){var d=r2(t).add("".concat(i,"0.").concat("0".repeat(n)).concat(10-u));return ZV(d.toString(),e,n,o)}return n===0?c:"".concat(c).concat(e).concat(l.padEnd(n,"0").slice(0,n))}return s===".0"?c:"".concat(c).concat(s)}function pUt(t){return!!(t.addonBefore||t.addonAfter)}function gUt(t){return!!(t.prefix||t.suffix||t.allowClear)}function Rxe(t,e,n){var o=e.cloneNode(!0),r=Object.create(t,{target:{value:o},currentTarget:{value:o}});return o.value=n,typeof e.selectionStart=="number"&&typeof e.selectionEnd=="number"&&(o.selectionStart=e.selectionStart,o.selectionEnd=e.selectionEnd),r}function KG(t,e,n,o){if(n){var r=e;if(e.type==="click"){r=Rxe(e,t,""),n(r);return}if(t.type!=="file"&&o!==void 0){r=Rxe(e,t,o),n(r);return}n(r)}}function HJe(t,e){if(t){t.focus(e);var n=e||{},o=n.cursor;if(o){var r=t.value.length;switch(o){case"start":t.setSelectionRange(0,0);break;case"end":t.setSelectionRange(r,r);break;default:t.setSelectionRange(0,r)}}}}var gye=function(e){var n,o,r=e.inputElement,i=e.children,a=e.prefixCls,l=e.prefix,s=e.suffix,c=e.addonBefore,u=e.addonAfter,d=e.className,f=e.style,p=e.disabled,g=e.readOnly,A=e.focused,y=e.triggerFocus,S=e.allowClear,C=e.value,P=e.handleReset,v=e.hidden,T=e.classes,w=e.classNames,x=e.dataAttrs,b=e.styles,R=e.components,H=i??r,F=(R==null?void 0:R.affixWrapper)||"span",E=(R==null?void 0:R.groupWrapper)||"span",N=(R==null?void 0:R.wrapper)||"span",U=(R==null?void 0:R.groupAddon)||"span",W=m.useRef(null),k=function(fe){var pe;(pe=W.current)!==null&&pe!==void 0&&pe.contains(fe.target)&&(y==null||y())},D=gUt(e),L=m.cloneElement(H,{value:C,className:Xn(H.props.className,!D&&(w==null?void 0:w.variant))||null});if(D){var j,B=null;if(S){var O,V=!p&&!g&&C,G="".concat(a,"-clear-icon"),q=hi(S)==="object"&&S!==null&&S!==void 0&&S.clearIcon?S.clearIcon:"✖";B=be.createElement("span",{onClick:P,onMouseDown:function(fe){return fe.preventDefault()},className:Xn(G,(O={},Jt(O,"".concat(G,"-hidden"),!V),Jt(O,"".concat(G,"-has-suffix"),!!s),O)),role:"button",tabIndex:-1},q)}var $="".concat(a,"-affix-wrapper"),ie=Xn($,(j={},Jt(j,"".concat(a,"-disabled"),p),Jt(j,"".concat($,"-disabled"),p),Jt(j,"".concat($,"-focused"),A),Jt(j,"".concat($,"-readonly"),g),Jt(j,"".concat($,"-input-with-clear-btn"),s&&S&&C),j),T==null?void 0:T.affixWrapper,w==null?void 0:w.affixWrapper,w==null?void 0:w.variant),Q=(s||S)&&be.createElement("span",{className:Xn("".concat(a,"-suffix"),w==null?void 0:w.suffix),style:b==null?void 0:b.suffix},B,s);L=be.createElement(F,go({className:ie,style:b==null?void 0:b.affixWrapper,onClick:k},x==null?void 0:x.affixWrapper,{ref:W}),l&&be.createElement("span",{className:Xn("".concat(a,"-prefix"),w==null?void 0:w.prefix),style:b==null?void 0:b.prefix},l),L,Q)}if(pUt(e)){var se="".concat(a,"-group"),oe="".concat(se,"-addon"),Z="".concat(se,"-wrapper"),te=Xn("".concat(a,"-wrapper"),se,T==null?void 0:T.wrapper,w==null?void 0:w.wrapper),ee=Xn(Z,Jt({},"".concat(Z,"-disabled"),p),T==null?void 0:T.group,w==null?void 0:w.groupWrapper);L=be.createElement(E,{className:ee},be.createElement(N,{className:te},c&&be.createElement(U,{className:oe},c),L,u&&be.createElement(U,{className:oe},u)))}return be.cloneElement(L,{className:Xn((n=L.props)===null||n===void 0?void 0:n.className,d)||null,style:en(en({},(o=L.props)===null||o===void 0?void 0:o.style),f),hidden:v})},mUt=["show"];function MJe(t,e){return m.useMemo(function(){var n={};e&&(n.show=hi(e)==="object"&&e.formatter?e.formatter:!!e),n=en(en({},n),t);var o=n,r=o.show,i=oi(o,mUt);return en(en({},i),{},{show:!!r,showFormatter:typeof r=="function"?r:void 0,strategy:i.strategy||function(a){return a.length}})},[t,e])}var yUt=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],AUt=m.forwardRef(function(t,e){var n=t.autoComplete,o=t.onChange,r=t.onFocus,i=t.onBlur,a=t.onPressEnter,l=t.onKeyDown,s=t.prefixCls,c=s===void 0?"rc-input":s,u=t.disabled,d=t.htmlSize,f=t.className,p=t.maxLength,g=t.suffix,A=t.showCount,y=t.count,S=t.type,C=S===void 0?"text":S,P=t.classes,v=t.classNames,T=t.styles,w=t.onCompositionStart,x=t.onCompositionEnd,b=oi(t,yUt),R=m.useState(!1),H=sn(R,2),F=H[0],E=H[1],N=m.useRef(!1),U=m.useRef(null),W=function(Se){U.current&&HJe(U.current,Se)},k=Es(t.defaultValue,{value:t.value}),D=sn(k,2),L=D[0],j=D[1],B=L==null?"":String(L),O=m.useState(null),V=sn(O,2),G=V[0],q=V[1],$=MJe(y,A),ie=$.max||p,Q=$.strategy(B),se=!!ie&&Q>ie;m.useImperativeHandle(e,function(){return{focus:W,blur:function(){var Se;(Se=U.current)===null||Se===void 0||Se.blur()},setSelectionRange:function(Se,Re,De){var Ae;(Ae=U.current)===null||Ae===void 0||Ae.setSelectionRange(Se,Re,De)},select:function(){var Se;(Se=U.current)===null||Se===void 0||Se.select()},input:U.current}}),m.useEffect(function(){E(function(ge){return ge&&u?!1:ge})},[u]);var oe=function(Se,Re,De){var Ae=Re;if(!N.current&&$.exceedFormatter&&$.max&&$.strategy(Re)>$.max){if(Ae=$.exceedFormatter(Re,{max:$.max}),Re!==Ae){var ue,he;q([((ue=U.current)===null||ue===void 0?void 0:ue.selectionStart)||0,((he=U.current)===null||he===void 0?void 0:he.selectionEnd)||0])}}else if(De.source==="compositionEnd")return;j(Ae),U.current&&KG(U.current,Se,o,Ae)};m.useEffect(function(){if(G){var ge;(ge=U.current)===null||ge===void 0||ge.setSelectionRange.apply(ge,No(G))}},[G]);var Z=function(Se){oe(Se,Se.target.value,{source:"change"})},te=function(Se){N.current=!1,oe(Se,Se.currentTarget.value,{source:"compositionEnd"}),x==null||x(Se)},ee=function(Se){a&&Se.key==="Enter"&&a(Se),l==null||l(Se)},de=function(Se){E(!0),r==null||r(Se)},fe=function(Se){E(!1),i==null||i(Se)},pe=function(Se){j(""),W(),U.current&&KG(U.current,Se,o)},ye=se&&"".concat(c,"-out-of-range"),ae=function(){var Se=OH(t,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames"]);return be.createElement("input",go({autoComplete:n},Se,{onChange:Z,onFocus:de,onBlur:fe,onKeyDown:ee,className:Xn(c,Jt({},"".concat(c,"-disabled"),u),v==null?void 0:v.input),style:T==null?void 0:T.input,ref:U,size:d,type:C,onCompositionStart:function(De){N.current=!0,w==null||w(De)},onCompositionEnd:te}))},Te=function(){var Se=Number(ie)>0;if(g||$.show){var Re=$.showFormatter?$.showFormatter({value:B,count:Q,maxLength:ie}):"".concat(Q).concat(Se?" / ".concat(ie):"");return be.createElement(be.Fragment,null,$.show&&be.createElement("span",{className:Xn("".concat(c,"-show-count-suffix"),Jt({},"".concat(c,"-show-count-has-suffix"),!!g),v==null?void 0:v.count),style:en({},T==null?void 0:T.count)},Re),g)}return null};return be.createElement(gye,go({},b,{prefixCls:c,className:Xn(f,ye),handleReset:pe,value:B,focused:F,triggerFocus:W,suffix:Te(),disabled:u,classes:P,classNames:v,styles:T}),ae())});function wUt(t,e){var n=m.useRef(null);function o(){try{var i=t.selectionStart,a=t.selectionEnd,l=t.value,s=l.substring(0,i),c=l.substring(a);n.current={start:i,end:a,value:l,beforeTxt:s,afterTxt:c}}catch{}}function r(){if(t&&n.current&&e)try{var i=t.value,a=n.current,l=a.beforeTxt,s=a.afterTxt,c=a.start,u=i.length;if(i.endsWith(s))u=i.length-n.current.afterTxt.length;else if(i.startsWith(l))u=l.length;else{var d=l[c-1],f=i.indexOf(d,c-1);f!==-1&&(u=f+1)}t.setSelectionRange(u,u)}catch(p){U0(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(p.message))}}return[o,r]}var vUt=function(){var e=m.useState(!1),n=sn(e,2),o=n[0],r=n[1];return _a(function(){r(X$())},[]),o},xUt=200,bUt=600;function SUt(t){var e=t.prefixCls,n=t.upNode,o=t.downNode,r=t.upDisabled,i=t.downDisabled,a=t.onStep,l=m.useRef(),s=m.useRef([]),c=m.useRef();c.current=a;var u=function(){clearTimeout(l.current)},d=function(P,v){P.preventDefault(),u(),c.current(v);function T(){c.current(v),l.current=setTimeout(T,xUt)}l.current=setTimeout(T,bUt)};m.useEffect(function(){return function(){u(),s.current.forEach(function(C){return Ea.cancel(C)})}},[]);var f=vUt();if(f)return null;var p="".concat(e,"-handler"),g=Xn(p,"".concat(p,"-up"),Jt({},"".concat(p,"-up-disabled"),r)),A=Xn(p,"".concat(p,"-down"),Jt({},"".concat(p,"-down-disabled"),i)),y=function(){return s.current.push(Ea(u))},S={unselectable:"on",role:"button",onMouseUp:y,onMouseLeave:y};return m.createElement("div",{className:"".concat(p,"-wrap")},m.createElement("span",go({},S,{onMouseDown:function(P){d(P,!0)},"aria-label":"Increase Value","aria-disabled":r,className:g}),n||m.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-up-inner")})),m.createElement("span",go({},S,{onMouseDown:function(P){d(P,!1)},"aria-label":"Decrease Value","aria-disabled":i,className:A}),o||m.createElement("span",{unselectable:"on",className:"".concat(e,"-handler-down-inner")})))}function Hxe(t){var e=typeof t=="number"?pQ(t):xx(t).fullStr,n=e.includes(".");return n?xx(e.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:t+"0"}const TUt=function(){var t=m.useRef(0),e=function(){Ea.cancel(t.current)};return m.useEffect(function(){return e},[]),function(n){e(),t.current=Ea(function(){n()})}};var PUt=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur"],CUt=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],Mxe=function(e,n){return e||n.isEmpty()?n.toString():n.toNumber()},Ixe=function(e){var n=r2(e);return n.isInvalidate()?null:n},RUt=m.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-input-number":o,i=t.className,a=t.style,l=t.min,s=t.max,c=t.step,u=c===void 0?1:c,d=t.defaultValue,f=t.value,p=t.disabled,g=t.readOnly,A=t.upHandler,y=t.downHandler,S=t.keyboard,C=t.changeOnWheel,P=C===void 0?!1:C,v=t.controls,T=v===void 0?!0:v;t.classNames;var w=t.stringMode,x=t.parser,b=t.formatter,R=t.precision,H=t.decimalSeparator,F=t.onChange,E=t.onInput,N=t.onPressEnter,U=t.onStep,W=t.changeOnBlur,k=W===void 0?!0:W,D=oi(t,PUt),L="".concat(r,"-input"),j=m.useRef(null),B=m.useState(!1),O=sn(B,2),V=O[0],G=O[1],q=m.useRef(!1),$=m.useRef(!1),ie=m.useRef(!1),Q=m.useState(function(){return r2(f??d)}),se=sn(Q,2),oe=se[0],Z=se[1];function te(gt){f===void 0&&Z(gt)}var ee=m.useCallback(function(gt,Ye){if(!Ye)return R>=0?R:Math.max(Ov(gt),Ov(u))},[R,u]),de=m.useCallback(function(gt){var Ye=String(gt);if(x)return x(Ye);var it=Ye;return H&&(it=it.replace(H,".")),it.replace(/[^\w.-]+/g,"")},[x,H]),fe=m.useRef(""),pe=m.useCallback(function(gt,Ye){if(b)return b(gt,{userTyping:Ye,input:String(fe.current)});var it=typeof gt=="number"?pQ(gt):gt;if(!Ye){var ut=ee(it,Ye);if(pye(it)&&(H||ut>=0)){var Qe=H||".";it=ZV(it,Qe,ut)}}return it},[b,ee,H]),ye=m.useState(function(){var gt=d??f;return oe.isInvalidate()&&["string","number"].includes(hi(gt))?Number.isNaN(gt)?"":gt:pe(oe.toString(),!1)}),ae=sn(ye,2),Te=ae[0],ge=ae[1];fe.current=Te;function Se(gt,Ye){ge(pe(gt.isInvalidate()?gt.toString(!1):gt.toString(!Ye),Ye))}var Re=m.useMemo(function(){return Ixe(s)},[s,R]),De=m.useMemo(function(){return Ixe(l)},[l,R]),Ae=m.useMemo(function(){return!Re||!oe||oe.isInvalidate()?!1:Re.lessEquals(oe)},[Re,oe]),ue=m.useMemo(function(){return!De||!oe||oe.isInvalidate()?!1:oe.lessEquals(De)},[De,oe]),he=wUt(j.current,V),ve=sn(he,2),we=ve[0],Pe=ve[1],Ie=function(Ye){return Re&&!Ye.lessEquals(Re)?Re:De&&!De.lessEquals(Ye)?De:null},Me=function(Ye){return!Ie(Ye)},ze=function(Ye,it){var ut=Ye,Qe=Me(ut)||ut.isEmpty();if(!ut.isEmpty()&&!it&&(ut=Ie(ut)||ut,Qe=!0),!g&&!p&&Qe){var lt=ut.toString(),Ze=ee(lt,it);return Ze>=0&&(ut=r2(ZV(lt,".",Ze)),Me(ut)||(ut=r2(ZV(lt,".",Ze,!0)))),ut.equals(oe)||(te(ut),F==null||F(ut.isEmpty()?null:Mxe(w,ut)),f===void 0&&Se(ut,it)),ut}return oe},Ne=TUt(),Je=function gt(Ye){if(we(),fe.current=Ye,ge(Ye),!$.current){var it=de(Ye),ut=r2(it);ut.isNaN()||ze(ut,!0)}E==null||E(Ye),Ne(function(){var Qe=Ye;x||(Qe=Ye.replace(/。/g,".")),Qe!==Ye&>(Qe)})},Ue=function(){$.current=!0},nt=function(){$.current=!1,Je(j.current.value)},We=function(Ye){Je(Ye.target.value)},Ee=function(Ye){var it;if(!(Ye&&Ae||!Ye&&ue)){q.current=!1;var ut=r2(ie.current?Hxe(u):u);Ye||(ut=ut.negate());var Qe=(oe||r2(0)).add(ut.toString()),lt=ze(Qe,!1);U==null||U(Mxe(w,lt),{offset:ie.current?Hxe(u):u,type:Ye?"up":"down"}),(it=j.current)===null||it===void 0||it.focus()}},ke=function(Ye){var it=r2(de(Te)),ut=it;it.isNaN()?ut=ze(oe,Ye):ut=ze(it,Ye),f!==void 0?Se(oe,!1):ut.isNaN()||Se(ut,!1)},Oe=function(){q.current=!0},st=function(Ye){var it=Ye.key,ut=Ye.shiftKey;q.current=!0,ie.current=ut,it==="Enter"&&($.current||(q.current=!1),ke(!1),N==null||N(Ye)),S!==!1&&!$.current&&["Up","ArrowUp","Down","ArrowDown"].includes(it)&&(Ee(it==="Up"||it==="ArrowUp"),Ye.preventDefault())},je=function(){q.current=!1,ie.current=!1};m.useEffect(function(){if(P&&V){var gt=function(ut){Ee(ut.deltaY<0),ut.preventDefault()},Ye=j.current;if(Ye)return Ye.addEventListener("wheel",gt,{passive:!1}),function(){return Ye.removeEventListener("wheel",gt)}}});var xt=function(){k&&ke(!1),G(!1),q.current=!1};return yx(function(){oe.isInvalidate()||Se(oe,!1)},[R,b]),yx(function(){var gt=r2(f);Z(gt);var Ye=r2(de(Te));(!gt.equals(Ye)||!q.current||b)&&Se(gt,q.current)},[f]),yx(function(){b&&Pe()},[Te]),m.createElement("div",{className:Xn(r,i,(n={},Jt(n,"".concat(r,"-focused"),V),Jt(n,"".concat(r,"-disabled"),p),Jt(n,"".concat(r,"-readonly"),g),Jt(n,"".concat(r,"-not-a-number"),oe.isNaN()),Jt(n,"".concat(r,"-out-of-range"),!oe.isInvalidate()&&!Me(oe)),n)),style:a,onFocus:function(){G(!0)},onBlur:xt,onKeyDown:st,onKeyUp:je,onCompositionStart:Ue,onCompositionEnd:nt,onBeforeInput:Oe},T&&m.createElement(SUt,{prefixCls:r,upNode:A,downNode:y,upDisabled:Ae,downDisabled:ue,onStep:Ee}),m.createElement("div",{className:"".concat(L,"-wrap")},m.createElement("input",go({autoComplete:"off",role:"spinbutton","aria-valuemin":l,"aria-valuemax":s,"aria-valuenow":oe.isInvalidate()?null:oe.toString(),step:u},D,{ref:jb(j,e),className:L,value:Te,onChange:We,disabled:p,readOnly:g}))))}),IJe=m.forwardRef(function(t,e){var n=t.disabled,o=t.style,r=t.prefixCls,i=t.value,a=t.prefix,l=t.suffix,s=t.addonBefore,c=t.addonAfter,u=t.className,d=t.classNames,f=oi(t,CUt),p=m.useRef(null),g=function(y){p.current&&HJe(p.current,y)};return m.createElement(gye,{className:u,triggerFocus:g,prefixCls:r,value:i,disabled:n,style:o,prefix:a,suffix:l,addonAfter:c,addonBefore:s,classNames:d,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"}},m.createElement(RUt,go({prefixCls:r,disabled:n,ref:jb(p,e),className:d==null?void 0:d.input},f)))});IJe.displayName="InputNumber";const HUt=t=>{var e;const n=(e=t.handleVisible)!==null&&e!==void 0?e:"auto";return Object.assign(Object.assign({},ZW(t)),{controlWidth:90,handleWidth:t.controlHeightSM-t.lineWidth*2,handleFontSize:t.fontSize/2,handleVisible:n,handleActiveBg:t.colorFillAlter,handleBg:t.colorBgContainer,filledHandleBg:new Wl(t.colorFillSecondary).onBackground(t.colorBgContainer).toHexString(),handleHoverColor:t.colorPrimary,handleBorderColor:t.colorBorder,handleOpacity:n===!0?1:0})},zxe=(t,e)=>{let{componentCls:n,borderRadiusSM:o,borderRadiusLG:r}=t;const i=e==="lg"?r:o;return{[`&-${e}`]:{[`${n}-handler-wrap`]:{borderStartEndRadius:i,borderEndEndRadius:i},[`${n}-handler-up`]:{borderStartEndRadius:i},[`${n}-handler-down`]:{borderEndEndRadius:i}}}},MUt=t=>{const{componentCls:e,lineWidth:n,lineType:o,borderRadius:r,fontSizeLG:i,controlHeightLG:a,controlHeightSM:l,colorError:s,paddingInlineSM:c,paddingBlockSM:u,paddingBlockLG:d,paddingInlineLG:f,colorTextDescription:p,motionDurationMid:g,handleHoverColor:A,paddingInline:y,paddingBlock:S,handleBg:C,handleActiveBg:P,colorTextDisabled:v,borderRadiusSM:T,borderRadiusLG:w,controlWidth:x,handleOpacity:b,handleBorderColor:R,filledHandleBg:H,lineHeightLG:F,calc:E}=t;return[{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),eN(t)),{display:"inline-block",width:x,margin:0,padding:0,borderRadius:r}),iye(t,{[`${e}-handler-wrap`]:{background:C,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${R}`}}})),lye(t,{[`${e}-handler-wrap`]:{background:H,[`${e}-handler-down`]:{borderBlockStart:`${jt(n)} ${o} ${R}`}},"&:focus-within":{[`${e}-handler-wrap`]:{background:C}}})),aye(t)),{"&-rtl":{direction:"rtl",[`${e}-input`]:{direction:"rtl"}},"&-lg":{padding:0,fontSize:i,lineHeight:F,borderRadius:w,[`input${e}-input`]:{height:E(a).sub(E(n).mul(2)).equal(),padding:`${jt(d)} ${jt(f)}`}},"&-sm":{padding:0,borderRadius:T,[`input${e}-input`]:{height:E(l).sub(E(n).mul(2)).equal(),padding:`${jt(u)} ${jt(c)}`}},"&-out-of-range":{[`${e}-input-wrap`]:{input:{color:s}}},"&-group":Object.assign(Object.assign(Object.assign({},Na(t)),fJe(t)),{"&-wrapper":Object.assign(Object.assign(Object.assign({display:"inline-block",textAlign:"start",verticalAlign:"top",[`${e}-affix-wrapper`]:{width:"100%"},"&-lg":{[`${e}-group-addon`]:{borderRadius:w,fontSize:t.fontSizeLG}},"&-sm":{[`${e}-group-addon`]:{borderRadius:T}}},sJe(t)),uJe(t)),{[`&:not(${e}-compact-first-item):not(${e}-compact-last-item)${e}-compact-item`]:{[`${e}, ${e}-group-addon`]:{borderRadius:0}},[`&:not(${e}-compact-last-item)${e}-compact-first-item`]:{[`${e}, ${e}-group-addon`]:{borderStartEndRadius:0,borderEndEndRadius:0}},[`&:not(${e}-compact-first-item)${e}-compact-last-item`]:{[`${e}, ${e}-group-addon`]:{borderStartStartRadius:0,borderEndStartRadius:0}}})}),[`&-disabled ${e}-input`]:{cursor:"not-allowed"},[e]:{"&-input":Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{width:"100%",padding:`${jt(S)} ${jt(y)}`,textAlign:"start",backgroundColor:"transparent",border:0,borderRadius:r,outline:0,transition:`all ${g} linear`,appearance:"textfield",fontSize:"inherit"}),sye(t.colorTextPlaceholder)),{'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':{margin:0,webkitAppearance:"none",appearance:"none"}})}})},{[e]:Object.assign(Object.assign(Object.assign({[`&:hover ${e}-handler-wrap, &-focused ${e}-handler-wrap`]:{opacity:1},[`${e}-handler-wrap`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,width:t.handleWidth,height:"100%",borderStartStartRadius:0,borderStartEndRadius:r,borderEndEndRadius:r,borderEndStartRadius:0,opacity:b,display:"flex",flexDirection:"column",alignItems:"stretch",transition:`opacity ${g} linear ${g}`,[`${e}-handler`]:{display:"flex",alignItems:"center",justifyContent:"center",flex:"auto",height:"40%",[` ${e}-handler-up-inner, ${e}-handler-down-inner `]:{marginInlineEnd:0,fontSize:t.handleFontSize}}},[`${e}-handler`]:{height:"50%",overflow:"hidden",color:p,fontWeight:"bold",lineHeight:0,textAlign:"center",cursor:"pointer",borderInlineStart:`${jt(n)} ${o} ${R}`,transition:`all ${g} linear`,"&:active":{background:P},"&:hover":{height:"60%",[` @@ -4617,7 +4617,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{cursor:"not-allowed"},[` ${e}-handler-up-disabled:hover &-handler-up-inner, ${e}-handler-down-disabled:hover &-handler-down-inner - `]:{color:v}})}]},IUt=t=>{const{componentCls:e,paddingBlock:n,paddingInline:o,inputAffixPadding:r,controlWidth:i,borderRadiusLG:a,borderRadiusSM:l,paddingInlineLG:s,paddingInlineSM:c,paddingBlockLG:u,paddingBlockSM:d}=t;return{[`${e}-affix-wrapper`]:Object.assign(Object.assign({[`input${e}-input`]:{padding:`${jt(n)} 0`}},eN(t)),{position:"relative",display:"inline-flex",width:i,padding:0,paddingInlineStart:o,"&-lg":{borderRadius:a,paddingInlineStart:s,[`input${e}-input`]:{padding:`${jt(u)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:c,[`input${e}-input`]:{padding:`${jt(d)} 0`}},[`&:not(${e}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${e}-disabled`]:{background:"transparent"},[`> div${e}`]:{width:"100%",border:"none",outline:"none",[`&${e}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${e}-handler-wrap`]:{zIndex:2},[e]:{color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:r},"&-suffix":{position:"absolute",insetBlockStart:0,insetInlineEnd:0,zIndex:1,height:"100%",marginInlineEnd:o,marginInlineStart:r}}})}},zUt=wl("InputNumber",t=>{const e=qi(t,QW(t));return[MUt(e),IUt(e),jW(e)]},HUt,{unitless:{handleOpacity:!0}});var DUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=m.useContext(Cr),r=m.useRef(null);m.useImperativeHandle(e,()=>r.current);const{className:i,rootClassName:a,size:l,disabled:s,prefixCls:c,addonBefore:u,addonAfter:d,prefix:f,bordered:p,readOnly:g,status:A,controls:y,variant:S}=t,C=DUt(t,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","bordered","readOnly","status","controls","variant"]),P=n("input-number",c),v=Y0(P),[T,w,x]=zUt(P,v),{compactSize:b,compactItemClassnames:R}=Yw(P,o);let H=m.createElement(dUt,{className:`${P}-handler-up-inner`}),F=m.createElement(Bme,{className:`${P}-handler-down-inner`});const E=typeof y=="boolean"?y:void 0;typeof y=="object"&&(H=typeof y.upIcon>"u"?H:m.createElement("span",{className:`${P}-handler-up-inner`},y.upIcon),F=typeof y.downIcon>"u"?F:m.createElement("span",{className:`${P}-handler-down-inner`},y.downIcon));const{hasFeedback:N,status:U,isFormItemInput:W,feedbackIcon:k}=m.useContext(r1),D=Yb(U,A),L=zd(Q=>{var se;return(se=l??b)!==null&&se!==void 0?se:Q}),j=m.useContext(n1),B=s??j,[O,V]=VH(S,p),G=N&&m.createElement(m.Fragment,null,k),q=Un({[`${P}-lg`]:L==="large",[`${P}-sm`]:L==="small",[`${P}-rtl`]:o==="rtl",[`${P}-in-form-item`]:W},w),$=`${P}-group`,ie=m.createElement(IJe,Object.assign({ref:r,disabled:B,className:Un(x,v,i,a,R),upHandler:H,downHandler:F,prefixCls:P,readOnly:g,controls:E,prefix:f,suffix:G,addonAfter:d&&m.createElement(O9,null,m.createElement(vR,{override:!0,status:!0},d)),addonBefore:u&&m.createElement(O9,null,m.createElement(vR,{override:!0,status:!0},u)),classNames:{input:q,variant:Un({[`${P}-${O}`]:V},fw(P,D,N)),affixWrapper:Un({[`${P}-affix-wrapper-sm`]:L==="small",[`${P}-affix-wrapper-lg`]:L==="large",[`${P}-affix-wrapper-rtl`]:o==="rtl"},w),wrapper:Un({[`${$}-rtl`]:o==="rtl"},w),groupWrapper:Un({[`${P}-group-wrapper-sm`]:L==="small",[`${P}-group-wrapper-lg`]:L==="large",[`${P}-group-wrapper-rtl`]:o==="rtl",[`${P}-group-wrapper-${O}`]:V},fw(`${P}-group-wrapper`,D,N),w)}},C));return T(ie)}),Sn=zJe,EUt=t=>m.createElement(fy,{theme:{components:{InputNumber:{handleVisible:!0}}}},m.createElement(zJe,Object.assign({},t)));Sn._InternalPanelDoNotUseOrYouWillBeFired=EUt;const FUt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,className:r}=t,i=e("input-group",o),a=e("input"),[l,s]=uye(a),c=Un(i,{[`${i}-lg`]:t.size==="large",[`${i}-sm`]:t.size==="small",[`${i}-compact`]:t.compact,[`${i}-rtl`]:n==="rtl"},s,r),u=m.useContext(r1),d=m.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return l(m.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},m.createElement(r1.Provider,{value:d},t.children)))},DJe=t=>{let e;return typeof t=="object"&&(t!=null&&t.clearIcon)?e=t:t&&(e={clearIcon:be.createElement(W$,null)}),e};function EJe(t,e){const n=m.useRef([]),o=()=>{n.current.push(setTimeout(()=>{var r,i,a,l;!((r=t.current)===null||r===void 0)&&r.input&&((i=t.current)===null||i===void 0?void 0:i.input.getAttribute("type"))==="password"&&(!((a=t.current)===null||a===void 0)&&a.input.hasAttribute("value"))&&((l=t.current)===null||l===void 0||l.input.removeAttribute("value"))}))};return m.useEffect(()=>(e&&o(),()=>n.current.forEach(r=>{r&&clearTimeout(r)})),[]),o}function kUt(t){return!!(t.prefix||t.suffix||t.allowClear||t.showCount)}var LUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r=!0,status:i,size:a,disabled:l,onBlur:s,onFocus:c,suffix:u,allowClear:d,addonAfter:f,addonBefore:p,className:g,style:A,styles:y,rootClassName:S,onChange:C,classNames:P,variant:v}=t,T=LUt(t,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:w,direction:x,input:b}=be.useContext(Cr),R=w("input",o),H=m.useRef(null),F=Y0(R),[E,N,U]=uye(R,F),{compactSize:W,compactItemClassnames:k}=Yw(R,x),D=zd(de=>{var he;return(he=a??W)!==null&&he!==void 0?he:de}),L=be.useContext(n1),j=l??L,{status:B,hasFeedback:O,feedbackIcon:V}=m.useContext(r1),G=Yb(B,i),q=kUt(t)||!!O;m.useRef(q);const $=EJe(H,!0),ie=de=>{$(),s==null||s(de)},Q=de=>{$(),c==null||c(de)},se=de=>{$(),C==null||C(de)},Z=(O||u)&&be.createElement(be.Fragment,null,u,O&&V),ee=DJe(d??(b==null?void 0:b.allowClear)),[te,oe]=VH(v,r);return E(be.createElement(AUt,Object.assign({ref:o5(e,H),prefixCls:R,autoComplete:b==null?void 0:b.autoComplete},T,{disabled:j,onBlur:ie,onFocus:Q,style:Object.assign(Object.assign({},b==null?void 0:b.style),A),styles:Object.assign(Object.assign({},b==null?void 0:b.styles),y),suffix:Z,allowClear:ee,className:Un(g,S,U,F,k,b==null?void 0:b.className),onChange:se,addonAfter:f&&be.createElement(O9,null,be.createElement(vR,{override:!0,status:!0},f)),addonBefore:p&&be.createElement(O9,null,be.createElement(vR,{override:!0,status:!0},p)),classNames:Object.assign(Object.assign(Object.assign({},P),b==null?void 0:b.classNames),{input:Un({[`${R}-sm`]:D==="small",[`${R}-lg`]:D==="large",[`${R}-rtl`]:x==="rtl"},P==null?void 0:P.input,(n=b==null?void 0:b.classNames)===null||n===void 0?void 0:n.input,N),variant:Un({[`${R}-${te}`]:oe},fw(R,G)),affixWrapper:Un({[`${R}-affix-wrapper-sm`]:D==="small",[`${R}-affix-wrapper-lg`]:D==="large",[`${R}-affix-wrapper-rtl`]:x==="rtl"},N),wrapper:Un({[`${R}-group-rtl`]:x==="rtl"},N),groupWrapper:Un({[`${R}-group-wrapper-sm`]:D==="small",[`${R}-group-wrapper-lg`]:D==="large",[`${R}-group-wrapper-rtl`]:x==="rtl",[`${R}-group-wrapper-${te}`]:oe},fw(`${R}-group-wrapper`,G,O),N)})})))}),NUt=t=>{const{componentCls:e,paddingXS:n}=t;return{[`${e}`]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,"&-rtl":{direction:"rtl"},[`${e}-input`]:{textAlign:"center",paddingInline:t.paddingXXS},[`&${e}-sm ${e}-input`]:{paddingInline:t.calc(t.paddingXXS).div(2).equal()},[`&${e}-lg ${e}-input`]:{paddingInline:t.paddingXS}}}},UUt=wl(["Input","OTP"],t=>{const e=qi(t,QW(t));return[NUt(e)]},ZW);var jUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{value:n,onChange:o,onActiveChange:r,index:i,mask:a}=t,l=jUt(t,["value","onChange","onActiveChange","index","mask"]),s=n&&typeof a=="string"?a:n,c=g=>{o(i,g.target.value)},u=m.useRef(null);m.useImperativeHandle(e,()=>u.current);const d=()=>{Ig(()=>{var g;const A=(g=u.current)===null||g===void 0?void 0:g.input;document.activeElement===A&&A&&A.select()})},f=g=>{let{key:A}=g;A==="ArrowLeft"?r(i-1):A==="ArrowRight"&&r(i+1),d()},p=g=>{g.key==="Backspace"&&!n&&r(i-1),d()};return m.createElement(gQ,Object.assign({},l,{ref:u,value:s,onInput:c,onFocus:d,onKeyDown:f,onKeyUp:p,onMouseDown:d,onMouseUp:d,type:a===!0?"password":"text"}))});var YUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,length:o=6,size:r,defaultValue:i,value:a,onChange:l,formatter:s,variant:c,disabled:u,status:d,autoFocus:f,mask:p}=t,g=YUt(t,["prefixCls","length","size","defaultValue","value","onChange","formatter","variant","disabled","status","autoFocus","mask"]),{getPrefixCls:A,direction:y}=m.useContext(Cr),S=A("otp",n),C=Pme(g,{aria:!0,data:!0,attr:!0}),P=Y0(S),[v,T,w]=UUt(S,P),x=zd(O=>r??O),b=m.useContext(r1),R=Yb(b.status,d),H=m.useMemo(()=>Object.assign(Object.assign({},b),{status:R,hasFeedback:!1,feedbackIcon:null}),[b,R]),F=m.useRef(null),E=m.useRef({});m.useImperativeHandle(e,()=>({focus:()=>{var O;(O=E.current[0])===null||O===void 0||O.focus()},blur:()=>{var O;for(let V=0;Vs?s(O):O,[U,W]=m.useState(jY(N(i||"")));m.useEffect(()=>{a!==void 0&&W(jY(a))},[a]);const k=Q6(O=>{W(O),l&&O.length===o&&O.every(V=>V)&&O.some((V,G)=>U[G]!==V)&&l(O.join(""))}),D=Q6((O,V)=>{let G=Qa(U);for(let $=0;$=0&&!G[$];$-=1)G.pop();const q=N(G.map($=>$||" ").join(""));return G=jY(q).map(($,ie)=>$===" "&&!G[ie]?G[ie]:$),G}),L=(O,V)=>{var G;const q=D(O,V),$=Math.min(O+V.length,o-1);$!==O&&((G=E.current[$])===null||G===void 0||G.focus()),k(q)},j=O=>{var V;(V=E.current[O])===null||V===void 0||V.focus()},B={variant:c,disabled:u,status:R,mask:p};return v(m.createElement("div",Object.assign({},C,{ref:F,className:Un(S,{[`${S}-sm`]:x==="small",[`${S}-lg`]:x==="large",[`${S}-rtl`]:y==="rtl"},w,T)}),m.createElement(r1.Provider,{value:H},Array.from({length:o}).map((O,V)=>{const G=`otp-${V}`,q=U[V]||"";return m.createElement(BUt,Object.assign({ref:$=>{E.current[V]=$},key:G,index:V,size:x,htmlSize:1,className:`${S}-input`,onChange:L,value:q,onActiveChange:j,autoFocus:V===0&&f},B))}))))});var VUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},_Ut=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:VUt}))},GUt=m.forwardRef(_Ut),XUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},JUt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:XUt}))},KUt=m.forwardRef(JUt),qUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rt?m.createElement(KUt,null):m.createElement(GUt,null),QUt={click:"onClick",hover:"onMouseOver"},ZUt=m.forwardRef((t,e)=>{const{disabled:n,action:o="click",visibilityToggle:r=!0,iconRender:i=$Ut}=t,a=typeof r=="object"&&r.visible!==void 0,[l,s]=m.useState(()=>a?r.visible:!1),c=m.useRef(null);m.useEffect(()=>{a&&s(r.visible)},[a,r]);const u=EJe(c),d=()=>{n||(l&&u(),s(b=>{var R;const H=!b;return typeof r=="object"&&((R=r.onVisibleChange)===null||R===void 0||R.call(r,H)),H}))},f=b=>{const R=QUt[o]||"",H=i(l),F={[R]:d,className:`${b}-icon`,key:"passwordIcon",onMouseDown:E=>{E.preventDefault()},onMouseUp:E=>{E.preventDefault()}};return m.cloneElement(m.isValidElement(H)?H:m.createElement("span",null,H),F)},{className:p,prefixCls:g,inputPrefixCls:A,size:y}=t,S=qUt(t,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:C}=m.useContext(Cr),P=C("input",A),v=C("input-password",g),T=r&&f(v),w=Un(v,p,{[`${v}-${y}`]:!!y}),x=Object.assign(Object.assign({},dp(S,["suffix","iconRender","visibilityToggle"])),{type:l?"text":"password",className:w,prefixCls:P,suffix:T});return y&&(x.size=y),m.createElement(gQ,Object.assign({ref:o5(e,c)},x))});var ejt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,inputPrefixCls:o,className:r,size:i,suffix:a,enterButton:l=!1,addonAfter:s,loading:c,disabled:u,onSearch:d,onChange:f,onCompositionStart:p,onCompositionEnd:g}=t,A=ejt(t,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:y,direction:S}=m.useContext(Cr),C=m.useRef(!1),P=y("input-search",n),v=y("input",o),{compactSize:T}=Yw(P,S),w=zd(B=>{var O;return(O=i??T)!==null&&O!==void 0?O:B}),x=m.useRef(null),b=B=>{B&&B.target&&B.type==="click"&&d&&d(B.target.value,B,{source:"clear"}),f&&f(B)},R=B=>{var O;document.activeElement===((O=x.current)===null||O===void 0?void 0:O.input)&&B.preventDefault()},H=B=>{var O,V;d&&d((V=(O=x.current)===null||O===void 0?void 0:O.input)===null||V===void 0?void 0:V.value,B,{source:"input"})},F=B=>{C.current||c||H(B)},E=typeof l=="boolean"?m.createElement($$,null):null,N=`${P}-button`;let U;const W=l||{},k=W.type&&W.type.__ANT_BUTTON===!0;k||W.type==="button"?U=j0(W,Object.assign({onMouseDown:R,onClick:B=>{var O,V;(V=(O=W==null?void 0:W.props)===null||O===void 0?void 0:O.onClick)===null||V===void 0||V.call(O,B),H(B)},key:"enterButton"},k?{className:N,size:w}:{})):U=m.createElement(io,{className:N,type:l?"primary":void 0,size:w,disabled:u,key:"enterButton",onMouseDown:R,onClick:H,loading:c,icon:E},l),s&&(U=[U,j0(s,{key:"addonAfter"})]);const D=Un(P,{[`${P}-rtl`]:S==="rtl",[`${P}-${w}`]:!!w,[`${P}-with-button`]:!!l},r),L=B=>{C.current=!0,p==null||p(B)},j=B=>{C.current=!1,g==null||g(B)};return m.createElement(gQ,Object.assign({ref:o5(x,e),onPressEnter:F},A,{size:w,onCompositionStart:L,onCompositionEnd:j,prefixCls:v,addonAfter:U,suffix:a,onChange:b,className:D,disabled:u}))});var njt=` + `]:{color:v}})}]},IUt=t=>{const{componentCls:e,paddingBlock:n,paddingInline:o,inputAffixPadding:r,controlWidth:i,borderRadiusLG:a,borderRadiusSM:l,paddingInlineLG:s,paddingInlineSM:c,paddingBlockLG:u,paddingBlockSM:d}=t;return{[`${e}-affix-wrapper`]:Object.assign(Object.assign({[`input${e}-input`]:{padding:`${jt(n)} 0`}},eN(t)),{position:"relative",display:"inline-flex",width:i,padding:0,paddingInlineStart:o,"&-lg":{borderRadius:a,paddingInlineStart:s,[`input${e}-input`]:{padding:`${jt(u)} 0`}},"&-sm":{borderRadius:l,paddingInlineStart:c,[`input${e}-input`]:{padding:`${jt(d)} 0`}},[`&:not(${e}-disabled):hover`]:{zIndex:1},"&-focused, &:focus":{zIndex:1},[`&-disabled > ${e}-disabled`]:{background:"transparent"},[`> div${e}`]:{width:"100%",border:"none",outline:"none",[`&${e}-focused`]:{boxShadow:"none !important"}},"&::before":{display:"inline-block",width:0,visibility:"hidden",content:'"\\a0"'},[`${e}-handler-wrap`]:{zIndex:2},[e]:{color:"inherit","&-prefix, &-suffix":{display:"flex",flex:"none",alignItems:"center",pointerEvents:"none"},"&-prefix":{marginInlineEnd:r},"&-suffix":{position:"absolute",insetBlockStart:0,insetInlineEnd:0,zIndex:1,height:"100%",marginInlineEnd:o,marginInlineStart:r}}})}},zUt=wl("InputNumber",t=>{const e=qi(t,QW(t));return[MUt(e),IUt(e),jW(e)]},HUt,{unitless:{handleOpacity:!0}});var DUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPrefixCls:n,direction:o}=m.useContext(Cr),r=m.useRef(null);m.useImperativeHandle(e,()=>r.current);const{className:i,rootClassName:a,size:l,disabled:s,prefixCls:c,addonBefore:u,addonAfter:d,prefix:f,bordered:p,readOnly:g,status:A,controls:y,variant:S}=t,C=DUt(t,["className","rootClassName","size","disabled","prefixCls","addonBefore","addonAfter","prefix","bordered","readOnly","status","controls","variant"]),P=n("input-number",c),v=Y0(P),[T,w,x]=zUt(P,v),{compactSize:b,compactItemClassnames:R}=Yw(P,o);let H=m.createElement(dUt,{className:`${P}-handler-up-inner`}),F=m.createElement(Bme,{className:`${P}-handler-down-inner`});const E=typeof y=="boolean"?y:void 0;typeof y=="object"&&(H=typeof y.upIcon>"u"?H:m.createElement("span",{className:`${P}-handler-up-inner`},y.upIcon),F=typeof y.downIcon>"u"?F:m.createElement("span",{className:`${P}-handler-down-inner`},y.downIcon));const{hasFeedback:N,status:U,isFormItemInput:W,feedbackIcon:k}=m.useContext(r1),D=Yb(U,A),L=zd(Q=>{var se;return(se=l??b)!==null&&se!==void 0?se:Q}),j=m.useContext(n1),B=s??j,[O,V]=VH(S,p),G=N&&m.createElement(m.Fragment,null,k),q=Un({[`${P}-lg`]:L==="large",[`${P}-sm`]:L==="small",[`${P}-rtl`]:o==="rtl",[`${P}-in-form-item`]:W},w),$=`${P}-group`,ie=m.createElement(IJe,Object.assign({ref:r,disabled:B,className:Un(x,v,i,a,R),upHandler:H,downHandler:F,prefixCls:P,readOnly:g,controls:E,prefix:f,suffix:G,addonAfter:d&&m.createElement(O9,null,m.createElement(vR,{override:!0,status:!0},d)),addonBefore:u&&m.createElement(O9,null,m.createElement(vR,{override:!0,status:!0},u)),classNames:{input:q,variant:Un({[`${P}-${O}`]:V},fw(P,D,N)),affixWrapper:Un({[`${P}-affix-wrapper-sm`]:L==="small",[`${P}-affix-wrapper-lg`]:L==="large",[`${P}-affix-wrapper-rtl`]:o==="rtl"},w),wrapper:Un({[`${$}-rtl`]:o==="rtl"},w),groupWrapper:Un({[`${P}-group-wrapper-sm`]:L==="small",[`${P}-group-wrapper-lg`]:L==="large",[`${P}-group-wrapper-rtl`]:o==="rtl",[`${P}-group-wrapper-${O}`]:V},fw(`${P}-group-wrapper`,D,N),w)}},C));return T(ie)}),Sn=zJe,EUt=t=>m.createElement(fy,{theme:{components:{InputNumber:{handleVisible:!0}}}},m.createElement(zJe,Object.assign({},t)));Sn._InternalPanelDoNotUseOrYouWillBeFired=EUt;const FUt=t=>{const{getPrefixCls:e,direction:n}=m.useContext(Cr),{prefixCls:o,className:r}=t,i=e("input-group",o),a=e("input"),[l,s]=uye(a),c=Un(i,{[`${i}-lg`]:t.size==="large",[`${i}-sm`]:t.size==="small",[`${i}-compact`]:t.compact,[`${i}-rtl`]:n==="rtl"},s,r),u=m.useContext(r1),d=m.useMemo(()=>Object.assign(Object.assign({},u),{isFormItemInput:!1}),[u]);return l(m.createElement("span",{className:c,style:t.style,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onFocus:t.onFocus,onBlur:t.onBlur},m.createElement(r1.Provider,{value:d},t.children)))},DJe=t=>{let e;return typeof t=="object"&&(t!=null&&t.clearIcon)?e=t:t&&(e={clearIcon:be.createElement(W$,null)}),e};function EJe(t,e){const n=m.useRef([]),o=()=>{n.current.push(setTimeout(()=>{var r,i,a,l;!((r=t.current)===null||r===void 0)&&r.input&&((i=t.current)===null||i===void 0?void 0:i.input.getAttribute("type"))==="password"&&(!((a=t.current)===null||a===void 0)&&a.input.hasAttribute("value"))&&((l=t.current)===null||l===void 0||l.input.removeAttribute("value"))}))};return m.useEffect(()=>(e&&o(),()=>n.current.forEach(r=>{r&&clearTimeout(r)})),[]),o}function kUt(t){return!!(t.prefix||t.suffix||t.allowClear||t.showCount)}var LUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n;const{prefixCls:o,bordered:r=!0,status:i,size:a,disabled:l,onBlur:s,onFocus:c,suffix:u,allowClear:d,addonAfter:f,addonBefore:p,className:g,style:A,styles:y,rootClassName:S,onChange:C,classNames:P,variant:v}=t,T=LUt(t,["prefixCls","bordered","status","size","disabled","onBlur","onFocus","suffix","allowClear","addonAfter","addonBefore","className","style","styles","rootClassName","onChange","classNames","variant"]),{getPrefixCls:w,direction:x,input:b}=be.useContext(Cr),R=w("input",o),H=m.useRef(null),F=Y0(R),[E,N,U]=uye(R,F),{compactSize:W,compactItemClassnames:k}=Yw(R,x),D=zd(de=>{var fe;return(fe=a??W)!==null&&fe!==void 0?fe:de}),L=be.useContext(n1),j=l??L,{status:B,hasFeedback:O,feedbackIcon:V}=m.useContext(r1),G=Yb(B,i),q=kUt(t)||!!O;m.useRef(q);const $=EJe(H,!0),ie=de=>{$(),s==null||s(de)},Q=de=>{$(),c==null||c(de)},se=de=>{$(),C==null||C(de)},oe=(O||u)&&be.createElement(be.Fragment,null,u,O&&V),Z=DJe(d??(b==null?void 0:b.allowClear)),[te,ee]=VH(v,r);return E(be.createElement(AUt,Object.assign({ref:o5(e,H),prefixCls:R,autoComplete:b==null?void 0:b.autoComplete},T,{disabled:j,onBlur:ie,onFocus:Q,style:Object.assign(Object.assign({},b==null?void 0:b.style),A),styles:Object.assign(Object.assign({},b==null?void 0:b.styles),y),suffix:oe,allowClear:Z,className:Un(g,S,U,F,k,b==null?void 0:b.className),onChange:se,addonAfter:f&&be.createElement(O9,null,be.createElement(vR,{override:!0,status:!0},f)),addonBefore:p&&be.createElement(O9,null,be.createElement(vR,{override:!0,status:!0},p)),classNames:Object.assign(Object.assign(Object.assign({},P),b==null?void 0:b.classNames),{input:Un({[`${R}-sm`]:D==="small",[`${R}-lg`]:D==="large",[`${R}-rtl`]:x==="rtl"},P==null?void 0:P.input,(n=b==null?void 0:b.classNames)===null||n===void 0?void 0:n.input,N),variant:Un({[`${R}-${te}`]:ee},fw(R,G)),affixWrapper:Un({[`${R}-affix-wrapper-sm`]:D==="small",[`${R}-affix-wrapper-lg`]:D==="large",[`${R}-affix-wrapper-rtl`]:x==="rtl"},N),wrapper:Un({[`${R}-group-rtl`]:x==="rtl"},N),groupWrapper:Un({[`${R}-group-wrapper-sm`]:D==="small",[`${R}-group-wrapper-lg`]:D==="large",[`${R}-group-wrapper-rtl`]:x==="rtl",[`${R}-group-wrapper-${te}`]:ee},fw(`${R}-group-wrapper`,G,O),N)})})))}),NUt=t=>{const{componentCls:e,paddingXS:n}=t;return{[`${e}`]:{display:"inline-flex",alignItems:"center",flexWrap:"nowrap",columnGap:n,"&-rtl":{direction:"rtl"},[`${e}-input`]:{textAlign:"center",paddingInline:t.paddingXXS},[`&${e}-sm ${e}-input`]:{paddingInline:t.calc(t.paddingXXS).div(2).equal()},[`&${e}-lg ${e}-input`]:{paddingInline:t.paddingXS}}}},UUt=wl(["Input","OTP"],t=>{const e=qi(t,QW(t));return[NUt(e)]},ZW);var jUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{value:n,onChange:o,onActiveChange:r,index:i,mask:a}=t,l=jUt(t,["value","onChange","onActiveChange","index","mask"]),s=n&&typeof a=="string"?a:n,c=g=>{o(i,g.target.value)},u=m.useRef(null);m.useImperativeHandle(e,()=>u.current);const d=()=>{Ig(()=>{var g;const A=(g=u.current)===null||g===void 0?void 0:g.input;document.activeElement===A&&A&&A.select()})},f=g=>{let{key:A}=g;A==="ArrowLeft"?r(i-1):A==="ArrowRight"&&r(i+1),d()},p=g=>{g.key==="Backspace"&&!n&&r(i-1),d()};return m.createElement(gQ,Object.assign({},l,{ref:u,value:s,onInput:c,onFocus:d,onKeyDown:f,onKeyUp:p,onMouseDown:d,onMouseUp:d,type:a===!0?"password":"text"}))});var YUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,length:o=6,size:r,defaultValue:i,value:a,onChange:l,formatter:s,variant:c,disabled:u,status:d,autoFocus:f,mask:p}=t,g=YUt(t,["prefixCls","length","size","defaultValue","value","onChange","formatter","variant","disabled","status","autoFocus","mask"]),{getPrefixCls:A,direction:y}=m.useContext(Cr),S=A("otp",n),C=Pme(g,{aria:!0,data:!0,attr:!0}),P=Y0(S),[v,T,w]=UUt(S,P),x=zd(O=>r??O),b=m.useContext(r1),R=Yb(b.status,d),H=m.useMemo(()=>Object.assign(Object.assign({},b),{status:R,hasFeedback:!1,feedbackIcon:null}),[b,R]),F=m.useRef(null),E=m.useRef({});m.useImperativeHandle(e,()=>({focus:()=>{var O;(O=E.current[0])===null||O===void 0||O.focus()},blur:()=>{var O;for(let V=0;Vs?s(O):O,[U,W]=m.useState(jY(N(i||"")));m.useEffect(()=>{a!==void 0&&W(jY(a))},[a]);const k=Q6(O=>{W(O),l&&O.length===o&&O.every(V=>V)&&O.some((V,G)=>U[G]!==V)&&l(O.join(""))}),D=Q6((O,V)=>{let G=Qa(U);for(let $=0;$=0&&!G[$];$-=1)G.pop();const q=N(G.map($=>$||" ").join(""));return G=jY(q).map(($,ie)=>$===" "&&!G[ie]?G[ie]:$),G}),L=(O,V)=>{var G;const q=D(O,V),$=Math.min(O+V.length,o-1);$!==O&&((G=E.current[$])===null||G===void 0||G.focus()),k(q)},j=O=>{var V;(V=E.current[O])===null||V===void 0||V.focus()},B={variant:c,disabled:u,status:R,mask:p};return v(m.createElement("div",Object.assign({},C,{ref:F,className:Un(S,{[`${S}-sm`]:x==="small",[`${S}-lg`]:x==="large",[`${S}-rtl`]:y==="rtl"},w,T)}),m.createElement(r1.Provider,{value:H},Array.from({length:o}).map((O,V)=>{const G=`otp-${V}`,q=U[V]||"";return m.createElement(BUt,Object.assign({ref:$=>{E.current[V]=$},key:G,index:V,size:x,htmlSize:1,className:`${S}-input`,onChange:L,value:q,onActiveChange:j,autoFocus:V===0&&f},B))}))))});var VUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}},{tag:"path",attrs:{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"}}]},name:"eye-invisible",theme:"outlined"},_Ut=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:VUt}))},GUt=m.forwardRef(_Ut),XUt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"}}]},name:"eye",theme:"outlined"},JUt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:XUt}))},KUt=m.forwardRef(JUt),qUt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rt?m.createElement(KUt,null):m.createElement(GUt,null),QUt={click:"onClick",hover:"onMouseOver"},ZUt=m.forwardRef((t,e)=>{const{disabled:n,action:o="click",visibilityToggle:r=!0,iconRender:i=$Ut}=t,a=typeof r=="object"&&r.visible!==void 0,[l,s]=m.useState(()=>a?r.visible:!1),c=m.useRef(null);m.useEffect(()=>{a&&s(r.visible)},[a,r]);const u=EJe(c),d=()=>{n||(l&&u(),s(b=>{var R;const H=!b;return typeof r=="object"&&((R=r.onVisibleChange)===null||R===void 0||R.call(r,H)),H}))},f=b=>{const R=QUt[o]||"",H=i(l),F={[R]:d,className:`${b}-icon`,key:"passwordIcon",onMouseDown:E=>{E.preventDefault()},onMouseUp:E=>{E.preventDefault()}};return m.cloneElement(m.isValidElement(H)?H:m.createElement("span",null,H),F)},{className:p,prefixCls:g,inputPrefixCls:A,size:y}=t,S=qUt(t,["className","prefixCls","inputPrefixCls","size"]),{getPrefixCls:C}=m.useContext(Cr),P=C("input",A),v=C("input-password",g),T=r&&f(v),w=Un(v,p,{[`${v}-${y}`]:!!y}),x=Object.assign(Object.assign({},dp(S,["suffix","iconRender","visibilityToggle"])),{type:l?"text":"password",className:w,prefixCls:P,suffix:T});return y&&(x.size=y),m.createElement(gQ,Object.assign({ref:o5(e,c)},x))});var ejt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,inputPrefixCls:o,className:r,size:i,suffix:a,enterButton:l=!1,addonAfter:s,loading:c,disabled:u,onSearch:d,onChange:f,onCompositionStart:p,onCompositionEnd:g}=t,A=ejt(t,["prefixCls","inputPrefixCls","className","size","suffix","enterButton","addonAfter","loading","disabled","onSearch","onChange","onCompositionStart","onCompositionEnd"]),{getPrefixCls:y,direction:S}=m.useContext(Cr),C=m.useRef(!1),P=y("input-search",n),v=y("input",o),{compactSize:T}=Yw(P,S),w=zd(B=>{var O;return(O=i??T)!==null&&O!==void 0?O:B}),x=m.useRef(null),b=B=>{B&&B.target&&B.type==="click"&&d&&d(B.target.value,B,{source:"clear"}),f&&f(B)},R=B=>{var O;document.activeElement===((O=x.current)===null||O===void 0?void 0:O.input)&&B.preventDefault()},H=B=>{var O,V;d&&d((V=(O=x.current)===null||O===void 0?void 0:O.input)===null||V===void 0?void 0:V.value,B,{source:"input"})},F=B=>{C.current||c||H(B)},E=typeof l=="boolean"?m.createElement($$,null):null,N=`${P}-button`;let U;const W=l||{},k=W.type&&W.type.__ANT_BUTTON===!0;k||W.type==="button"?U=j0(W,Object.assign({onMouseDown:R,onClick:B=>{var O,V;(V=(O=W==null?void 0:W.props)===null||O===void 0?void 0:O.onClick)===null||V===void 0||V.call(O,B),H(B)},key:"enterButton"},k?{className:N,size:w}:{})):U=m.createElement(io,{className:N,type:l?"primary":void 0,size:w,disabled:u,key:"enterButton",onMouseDown:R,onClick:H,loading:c,icon:E},l),s&&(U=[U,j0(s,{key:"addonAfter"})]);const D=Un(P,{[`${P}-rtl`]:S==="rtl",[`${P}-${w}`]:!!w,[`${P}-with-button`]:!!l},r),L=B=>{C.current=!0,p==null||p(B)},j=B=>{C.current=!1,g==null||g(B)};return m.createElement(gQ,Object.assign({ref:o5(x,e),onPressEnter:F},A,{size:w,onCompositionStart:L,onCompositionEnd:j,prefixCls:v,addonAfter:U,suffix:a,onChange:b,className:D,disabled:u}))});var njt=` min-height:0 !important; max-height:none !important; height:0 !important; @@ -4628,8 +4628,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho top:0 !important; right:0 !important; pointer-events: none !important; -`,ojt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],yie={},pm;function rjt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&yie[n])return yie[n];var o=window.getComputedStyle(t),r=o.getPropertyValue("box-sizing")||o.getPropertyValue("-moz-box-sizing")||o.getPropertyValue("-webkit-box-sizing"),i=parseFloat(o.getPropertyValue("padding-bottom"))+parseFloat(o.getPropertyValue("padding-top")),a=parseFloat(o.getPropertyValue("border-bottom-width"))+parseFloat(o.getPropertyValue("border-top-width")),l=ojt.map(function(c){return"".concat(c,":").concat(o.getPropertyValue(c))}).join(";"),s={sizingStyle:l,paddingSize:i,borderSize:a,boxSizing:r};return e&&n&&(yie[n]=s),s}function ijt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;pm||(pm=document.createElement("textarea"),pm.setAttribute("tab-index","-1"),pm.setAttribute("aria-hidden","true"),document.body.appendChild(pm)),t.getAttribute("wrap")?pm.setAttribute("wrap",t.getAttribute("wrap")):pm.removeAttribute("wrap");var r=rjt(t,e),i=r.paddingSize,a=r.borderSize,l=r.boxSizing,s=r.sizingStyle;pm.setAttribute("style","".concat(s,";").concat(njt)),pm.value=t.value||t.placeholder||"";var c=void 0,u=void 0,d,f=pm.scrollHeight;if(l==="border-box"?f+=a:l==="content-box"&&(f-=i),n!==null||o!==null){pm.value=" ";var p=pm.scrollHeight-i;n!==null&&(c=p*n,l==="border-box"&&(c=c+i+a),f=Math.max(c,f)),o!==null&&(u=p*o,l==="border-box"&&(u=u+i+a),d=f>u?"":"hidden",f=Math.min(u,f))}var g={height:f,overflowY:d,resize:"none"};return c&&(g.minHeight=c),u&&(g.maxHeight=u),g}var ajt=["prefixCls","onPressEnter","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Aie=0,wie=1,vie=2,ljt=m.forwardRef(function(t,e){var n=t,o=n.prefixCls;n.onPressEnter;var r=n.defaultValue,i=n.value,a=n.autoSize,l=n.onResize,s=n.className,c=n.style,u=n.disabled,d=n.onChange;n.onInternalAutoSize;var f=oi(n,ajt),p=Es(r,{value:i,postState:function(q){return q??""}}),g=sn(p,2),A=g[0],y=g[1],S=function(q){y(q.target.value),d==null||d(q)},C=m.useRef();m.useImperativeHandle(e,function(){return{textArea:C.current}});var P=m.useMemo(function(){return a&&hi(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),v=sn(P,2),T=v[0],w=v[1],x=!!a,b=function(){try{if(document.activeElement===C.current){var q=C.current,$=q.selectionStart,ie=q.selectionEnd,Q=q.scrollTop;C.current.setSelectionRange($,ie),C.current.scrollTop=Q}}catch{}},R=m.useState(vie),H=sn(R,2),F=H[0],E=H[1],N=m.useState(),U=sn(N,2),W=U[0],k=U[1],D=function(){E(Aie)};_a(function(){x&&D()},[i,T,w,x]),_a(function(){if(F===Aie)E(wie);else if(F===wie){var G=ijt(C.current,!1,T,w);E(vie),k(G)}else b()},[F]);var L=m.useRef(),j=function(){Ea.cancel(L.current)},B=function(q){F===vie&&(l==null||l(q),a&&(j(),L.current=Ea(function(){D()})))};m.useEffect(function(){return j},[]);var O=x?W:null,V=en(en({},c),O);return(F===Aie||F===wie)&&(V.overflowY="hidden",V.overflowX="hidden"),m.createElement(Cd,{onResize:B,disabled:!(a||l)},m.createElement("textarea",go({},f,{ref:C,style:V,className:Xn(o,s,Jt({},"".concat(o,"-disabled"),u)),disabled:u,value:A,onChange:S})))}),sjt=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize"],cjt=be.forwardRef(function(t,e){var n,o,r=t.defaultValue,i=t.value,a=t.onFocus,l=t.onBlur,s=t.onChange,c=t.allowClear,u=t.maxLength,d=t.onCompositionStart,f=t.onCompositionEnd,p=t.suffix,g=t.prefixCls,A=g===void 0?"rc-textarea":g,y=t.showCount,S=t.count,C=t.className,P=t.style,v=t.disabled,T=t.hidden,w=t.classNames,x=t.styles,b=t.onResize,R=oi(t,sjt),H=Es(r,{value:i,defaultValue:r}),F=sn(H,2),E=F[0],N=F[1],U=E==null?"":String(E),W=be.useState(!1),k=sn(W,2),D=k[0],L=k[1],j=be.useRef(!1),B=be.useState(null),O=sn(B,2),V=O[0],G=O[1],q=m.useRef(null),$=function(){var Ie;return(Ie=q.current)===null||Ie===void 0?void 0:Ie.textArea},ie=function(){$().focus()};m.useImperativeHandle(e,function(){return{resizableTextArea:q.current,focus:ie,blur:function(){$().blur()}}}),m.useEffect(function(){L(function(Pe){return!v&&Pe})},[v]);var Q=be.useState(null),se=sn(Q,2),Z=se[0],ee=se[1];be.useEffect(function(){if(Z){var Pe;(Pe=$()).setSelectionRange.apply(Pe,No(Z))}},[Z]);var te=MJe(S,y),oe=(n=te.max)!==null&&n!==void 0?n:u,de=Number(oe)>0,he=te.strategy(U),pe=!!oe&&he>oe,me=function(Ie,Me){var ze=Me;!j.current&&te.exceedFormatter&&te.max&&te.strategy(Me)>te.max&&(ze=te.exceedFormatter(Me,{max:te.max}),Me!==ze&&ee([$().selectionStart||0,$().selectionEnd||0])),N(ze),KG(Ie.currentTarget,Ie,s,ze)},le=function(Ie){j.current=!0,d==null||d(Ie)},Te=function(Ie){j.current=!1,me(Ie,Ie.currentTarget.value),f==null||f(Ie)},ge=function(Ie){me(Ie,Ie.target.value)},Se=function(Ie){var Me=R.onPressEnter,ze=R.onKeyDown;Ie.key==="Enter"&&Me&&Me(Ie),ze==null||ze(Ie)},Re=function(Ie){L(!0),a==null||a(Ie)},De=function(Ie){L(!1),l==null||l(Ie)},Ae=function(Ie){N(""),ie(),KG($(),Ie,s)},ue=p,fe;te.show&&(te.showFormatter?fe=te.showFormatter({value:U,count:he,maxLength:oe}):fe="".concat(he).concat(de?" / ".concat(oe):""),ue=be.createElement(be.Fragment,null,ue,be.createElement("span",{className:Xn("".concat(A,"-data-count"),w==null?void 0:w.count),style:x==null?void 0:x.count},fe)));var ve=function(Ie){var Me;b==null||b(Ie),(Me=$())!==null&&Me!==void 0&&Me.style.height&&G(!0)},we=!R.autoSize&&!y&&!c;return be.createElement(gye,{value:U,allowClear:c,handleReset:Ae,suffix:ue,prefixCls:A,classNames:en(en({},w),{},{affixWrapper:Xn(w==null?void 0:w.affixWrapper,(o={},Jt(o,"".concat(A,"-show-count"),y),Jt(o,"".concat(A,"-textarea-allow-clear"),c),o))}),disabled:v,focused:D,className:Xn(C,pe&&"".concat(A,"-out-of-range")),style:en(en({},P),V&&!we?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof fe=="string"?fe:void 0}},hidden:T},be.createElement(ljt,go({},R,{maxLength:u,onKeyDown:Se,onChange:ge,onFocus:Re,onBlur:De,onCompositionStart:le,onCompositionEnd:Te,className:Xn(w==null?void 0:w.textarea),style:en(en({},x==null?void 0:x.textarea),{},{resize:P==null?void 0:P.resize}),disabled:v,prefixCls:A,onResize:ve,ref:q})))}),ujt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,bordered:i=!0,size:a,disabled:l,status:s,allowClear:c,classNames:u,rootClassName:d,className:f,style:p,styles:g,variant:A}=t,y=ujt(t,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant"]),{getPrefixCls:S,direction:C,textArea:P}=m.useContext(Cr),v=zd(a),T=m.useContext(n1),w=l??T,{status:x,hasFeedback:b,feedbackIcon:R}=m.useContext(r1),H=Yb(x,s),F=m.useRef(null);m.useImperativeHandle(e,()=>{var B;return{resizableTextArea:(B=F.current)===null||B===void 0?void 0:B.resizableTextArea,focus:O=>{var V,G;WUt((G=(V=F.current)===null||V===void 0?void 0:V.resizableTextArea)===null||G===void 0?void 0:G.textArea,O)},blur:()=>{var O;return(O=F.current)===null||O===void 0?void 0:O.blur()}}});const E=S("input",r),N=Y0(E),[U,W,k]=uye(E,N),[D,L]=VH(A,i),j=DJe(c??(P==null?void 0:P.allowClear));return U(m.createElement(cjt,Object.assign({autoComplete:P==null?void 0:P.autoComplete},y,{style:Object.assign(Object.assign({},P==null?void 0:P.style),p),styles:Object.assign(Object.assign({},P==null?void 0:P.styles),g),disabled:w,allowClear:j,className:Un(k,N,f,d,P==null?void 0:P.className),classNames:Object.assign(Object.assign(Object.assign({},u),P==null?void 0:P.classNames),{textarea:Un({[`${E}-sm`]:v==="small",[`${E}-lg`]:v==="large"},W,u==null?void 0:u.textarea,(n=P==null?void 0:P.classNames)===null||n===void 0?void 0:n.textarea),variant:Un({[`${E}-${D}`]:L},fw(E,H)),affixWrapper:Un(`${E}-textarea-affix-wrapper`,{[`${E}-affix-wrapper-rtl`]:C==="rtl",[`${E}-affix-wrapper-sm`]:v==="small",[`${E}-affix-wrapper-lg`]:v==="large",[`${E}-textarea-show-count`]:t.showCount||((o=t.count)===null||o===void 0?void 0:o.show)},W)}),prefixCls:E,suffix:b&&m.createElement("span",{className:`${E}-textarea-suffix`},R),ref:F})))}),jl=gQ;jl.Group=FUt;jl.Search=tjt;jl.TextArea=FJe;jl.Password=ZUt;jl.OTP=OUt;var djt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},fjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:djt}))},kJe=m.forwardRef(fjt),hjt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},pjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hjt}))},LJe=m.forwardRef(pjt),gjt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"}}]},name:"swap-right",theme:"outlined"},mjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gjt}))},yjt=m.forwardRef(mjt);function Ajt(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.yearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.quarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.monthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.weekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.placeholder:t.lang.placeholder}function wjt(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.rangeYearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.rangeQuarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.rangeMonthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.rangeWeekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.rangePlaceholder:t.lang.rangePlaceholder}function mye(t,e){const n={adjustX:1,adjustY:1};switch(e){case"bottomLeft":return{points:["tl","bl"],offset:[0,4],overflow:n};case"bottomRight":return{points:["tr","br"],offset:[0,4],overflow:n};case"topLeft":return{points:["bl","tl"],offset:[0,-4],overflow:n};case"topRight":return{points:["br","tr"],offset:[0,-4],overflow:n};default:return{points:t==="rtl"?["tr","br"]:["tl","bl"],offset:[0,4],overflow:n}}}function WJe(t,e){const{allowClear:n=!0}=t,{clearIcon:o,removeIcon:r}=OGe(Object.assign(Object.assign({},t),{prefixCls:e,componentName:"DatePicker"}));return[m.useMemo(()=>n===!1?!1:Object.assign({clearIcon:o},n===!0?{}:n),[n,o]),r]}function vjt(t){return m.createElement(io,Object.assign({size:"small",type:"primary"},t))}function NJe(t){return m.useMemo(()=>Object.assign({button:vjt},t),[t])}var xjt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var r;const{prefixCls:i,getPopupContainer:a,components:l,className:s,style:c,placement:u,size:d,disabled:f,bordered:p=!0,placeholder:g,popupClassName:A,dropdownClassName:y,status:S,rootClassName:C,variant:P}=n,v=xjt(n,["prefixCls","getPopupContainer","components","className","style","placement","size","disabled","bordered","placeholder","popupClassName","dropdownClassName","status","rootClassName","variant"]),T=m.useRef(null),{getPrefixCls:w,direction:x,getPopupContainer:b,rangePicker:R}=m.useContext(Cr),H=w("picker",i),{compactSize:F,compactItemClassnames:E}=Yw(H,x),{picker:N}=n,U=w(),[W,k]=VH(P,p),D=Y0(H),[L,j,B]=hJe(H,D),[O]=WJe(n,H),V=NJe(l),G=zd(he=>{var pe;return(pe=d??F)!==null&&pe!==void 0?pe:he}),q=m.useContext(n1),$=f??q,ie=m.useContext(r1),{hasFeedback:Q,status:se,feedbackIcon:Z}=ie,ee=m.createElement(m.Fragment,null,N==="time"?m.createElement(LJe,null):m.createElement(kJe,null),Q&&Z);m.useImperativeHandle(o,()=>T.current);const[te]=Uw("Calendar",IG),oe=Object.assign(Object.assign({},te),n.locale),[de]=Bw("DatePicker",(r=n.popupStyle)===null||r===void 0?void 0:r.zIndex);return L(m.createElement(O9,null,m.createElement(VLt,Object.assign({separator:m.createElement("span",{"aria-label":"to",className:`${H}-separator`},m.createElement(yjt,null)),disabled:$,ref:T,popupAlign:mye(x,u),placeholder:wjt(oe,N,g),suffixIcon:ee,prevIcon:m.createElement("span",{className:`${H}-prev-icon`}),nextIcon:m.createElement("span",{className:`${H}-next-icon`}),superPrevIcon:m.createElement("span",{className:`${H}-super-prev-icon`}),superNextIcon:m.createElement("span",{className:`${H}-super-next-icon`}),transitionName:`${U}-slide-up`},v,{className:Un({[`${H}-${G}`]:G,[`${H}-${W}`]:k},fw(H,Yb(se,S),Q),j,E,s,R==null?void 0:R.className,B,D,C),style:Object.assign(Object.assign({},R==null?void 0:R.style),c),locale:oe.lang,prefixCls:H,getPopupContainer:a||b,generateConfig:t,components:V,direction:x,classNames:{popup:Un(j,A||y,B,D,C)},styles:{popup:Object.assign(Object.assign({},n.popupStyle),{zIndex:de})},allowClear:O}))))})}var Sjt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var g;const{prefixCls:A,getPopupContainer:y,components:S,style:C,className:P,rootClassName:v,size:T,bordered:w,placement:x,placeholder:b,popupClassName:R,dropdownClassName:H,disabled:F,status:E,variant:N,onCalendarChange:U}=f,W=Sjt(f,["prefixCls","getPopupContainer","components","style","className","rootClassName","size","bordered","placement","placeholder","popupClassName","dropdownClassName","disabled","status","variant","onCalendarChange"]),{getPrefixCls:k,direction:D,getPopupContainer:L,[u]:j}=m.useContext(Cr),B=k("picker",A),{compactSize:O,compactItemClassnames:V}=Yw(B,D),G=m.useRef(null),[q,$]=VH(N,w),ie=Y0(B),[Q,se,Z]=hJe(B,ie);m.useImperativeHandle(p,()=>G.current);const ee={showToday:!0},te=s||f.picker,oe=k(),{onSelect:de,multiple:he}=W,pe=de&&s==="time"&&!he,me=(ze,Ne,Je)=>{U==null||U(ze,Ne,Je),pe&&de(ze)},[le,Te]=WJe(f,B),ge=NJe(S),Se=zd(ze=>{var Ne;return(Ne=T??O)!==null&&Ne!==void 0?Ne:ze}),Re=m.useContext(n1),De=F??Re,Ae=m.useContext(r1),{hasFeedback:ue,status:fe,feedbackIcon:ve}=Ae,we=m.createElement(m.Fragment,null,te==="time"?m.createElement(LJe,null):m.createElement(kJe,null),ue&&ve),[Pe]=Uw("DatePicker",IG),Ie=Object.assign(Object.assign({},Pe),f.locale),[Me]=Bw("DatePicker",(g=f.popupStyle)===null||g===void 0?void 0:g.zIndex);return Q(m.createElement(O9,null,m.createElement(qLt,Object.assign({ref:G,placeholder:Ajt(Ie,te,b),suffixIcon:we,dropdownAlign:mye(D,x),prevIcon:m.createElement("span",{className:`${B}-prev-icon`}),nextIcon:m.createElement("span",{className:`${B}-next-icon`}),superPrevIcon:m.createElement("span",{className:`${B}-super-prev-icon`}),superNextIcon:m.createElement("span",{className:`${B}-super-next-icon`}),transitionName:`${oe}-slide-up`,picker:s,onCalendarChange:me},ee,W,{locale:Ie.lang,className:Un({[`${B}-${Se}`]:Se,[`${B}-${q}`]:$},fw(B,Yb(fe,E),ue),se,V,j==null?void 0:j.className,P,Z,ie,v),style:Object.assign(Object.assign({},j==null?void 0:j.style),C),prefixCls:B,getPopupContainer:y||L,generateConfig:t,components:ge,direction:D,disabled:De,classNames:{popup:Un(se,Z,ie,v,R||H)},styles:{popup:Object.assign(Object.assign({},f.popupStyle),{zIndex:Me})},allowClear:le,removeIcon:Te}))))})}const n=e(),o=e("week","WeekPicker"),r=e("month","MonthPicker"),i=e("year","YearPicker"),a=e("quarter","QuarterPicker"),l=e("time","TimePicker");return{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a}}function UJe(t){const{DatePicker:e,WeekPicker:n,MonthPicker:o,YearPicker:r,TimePicker:i,QuarterPicker:a}=Tjt(t),l=bjt(t),s=e;return s.WeekPicker=n,s.MonthPicker=o,s.YearPicker=r,s.RangePicker=l,s.TimePicker=i,s.QuarterPicker=a,s}const Vw=UJe(eLt);function jJe(t){const e=mye(t.direction,t.placement);return e.overflow.adjustY=!1,e.overflow.adjustX=!1,Object.assign(Object.assign({},t),{dropdownAlign:e})}const Pjt=XW(Vw,"picker",null,jJe);Vw._InternalPanelDoNotUseOrYouWillBeFired=Pjt;const Cjt=XW(Vw.RangePicker,"picker",null,jJe);Vw._InternalRangePanelDoNotUseOrYouWillBeFired=Cjt;Vw.generatePicker=UJe;function pk(t){"@babel/helpers - typeof";return pk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pk(t)}function Rjt(t,e){if(pk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(pk(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hjt(t){var e=Rjt(t,"string");return pk(e)=="symbol"?e:e+""}function Aue(t,e,n){return e=Hjt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dxe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function i2(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)continue;n[o]=t[o]}return n}function Fjt(t,e){if(t==null)return{};var n=Ejt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var kjt=["prefixCls","className","containerRef"],Ljt=function(e){var n=e.prefixCls,o=e.className,r=e.containerRef,i=Fjt(e,kjt),a=m.useContext(BJe),l=a.panel,s=Nw(l,r);return m.createElement("div",Vv({className:Xn("".concat(n,"-content"),o),role:"dialog",ref:s},bf(e,{aria:!0}),{"aria-modal":"true"},i))};function kxe(t){return typeof t=="string"&&String(Number(t))===t?(U0(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(t)):t}var Lxe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function Wjt(t,e){var n,o,r,i=t.prefixCls,a=t.open,l=t.placement,s=t.inline,c=t.push,u=t.forceRender,d=t.autoFocus,f=t.keyboard,p=t.classNames,g=t.rootClassName,A=t.rootStyle,y=t.zIndex,S=t.className,C=t.id,P=t.style,v=t.motion,T=t.width,w=t.height,x=t.children,b=t.mask,R=t.maskClosable,H=t.maskMotion,F=t.maskClassName,E=t.maskStyle,N=t.afterOpenChange,U=t.onClose,W=t.onMouseEnter,k=t.onMouseOver,D=t.onMouseLeave,L=t.onClick,j=t.onKeyDown,B=t.onKeyUp,O=t.styles,V=m.useRef(),G=m.useRef(),q=m.useRef();m.useImperativeHandle(e,function(){return V.current});var $=function(Re){var De=Re.keyCode,Ae=Re.shiftKey;switch(De){case jn.TAB:{if(De===jn.TAB){if(!Ae&&document.activeElement===q.current){var ue;(ue=G.current)===null||ue===void 0||ue.focus({preventScroll:!0})}else if(Ae&&document.activeElement===G.current){var fe;(fe=q.current)===null||fe===void 0||fe.focus({preventScroll:!0})}}break}case jn.ESC:{U&&f&&(Re.stopPropagation(),U(Re));break}}};m.useEffect(function(){if(a&&d){var Se;(Se=V.current)===null||Se===void 0||Se.focus({preventScroll:!0})}},[a]);var ie=m.useState(!1),Q=wue(ie,2),se=Q[0],Z=Q[1],ee=m.useContext(Fxe),te;typeof c=="boolean"?te=c?{}:{distance:0}:te=c||{};var oe=(n=(o=(r=te)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:ee==null?void 0:ee.pushDistance)!==null&&n!==void 0?n:180,de=m.useMemo(function(){return{pushDistance:oe,push:function(){Z(!0)},pull:function(){Z(!1)}}},[oe]);m.useEffect(function(){if(a){var Se;ee==null||(Se=ee.push)===null||Se===void 0||Se.call(ee)}else{var Re;ee==null||(Re=ee.pull)===null||Re===void 0||Re.call(ee)}},[a]),m.useEffect(function(){return function(){var Se;ee==null||(Se=ee.pull)===null||Se===void 0||Se.call(ee)}},[]);var he=b&&m.createElement(o1,Vv({key:"mask"},H,{visible:a}),function(Se,Re){var De=Se.className,Ae=Se.style;return m.createElement("div",{className:Xn("".concat(i,"-mask"),De,p==null?void 0:p.mask,F),style:i2(i2(i2({},Ae),E),O==null?void 0:O.mask),onClick:R&&a?U:void 0,ref:Re})}),pe=typeof v=="function"?v(l):v,me={};if(se&&oe)switch(l){case"top":me.transform="translateY(".concat(oe,"px)");break;case"bottom":me.transform="translateY(".concat(-oe,"px)");break;case"left":me.transform="translateX(".concat(oe,"px)");break;default:me.transform="translateX(".concat(-oe,"px)");break}l==="left"||l==="right"?me.width=kxe(T):me.height=kxe(w);var le={onMouseEnter:W,onMouseOver:k,onMouseLeave:D,onClick:L,onKeyDown:j,onKeyUp:B},Te=m.createElement(o1,Vv({key:"panel"},pe,{visible:a,forceRender:u,onVisibleChanged:function(Re){N==null||N(Re)},removeOnLeave:!1,leavedClassName:"".concat(i,"-content-wrapper-hidden")}),function(Se,Re){var De=Se.className,Ae=Se.style;return m.createElement("div",Vv({className:Xn("".concat(i,"-content-wrapper"),p==null?void 0:p.wrapper,De),style:i2(i2(i2({},me),Ae),O==null?void 0:O.wrapper)},bf(t,{data:!0})),m.createElement(Ljt,Vv({id:C,containerRef:Re,prefixCls:i,className:Xn(S,p==null?void 0:p.content),style:i2(i2({},P),O==null?void 0:O.content)},bf(t,{aria:!0}),le),x))}),ge=i2({},A);return y&&(ge.zIndex=y),m.createElement(Fxe.Provider,{value:de},m.createElement("div",{className:Xn(i,"".concat(i,"-").concat(l),g,Aue(Aue({},"".concat(i,"-open"),a),"".concat(i,"-inline"),s)),style:ge,tabIndex:-1,ref:V,onKeyDown:$},he,m.createElement("div",{tabIndex:0,ref:G,style:Lxe,"aria-hidden":"true","data-sentinel":"start"}),Te,m.createElement("div",{tabIndex:0,ref:q,style:Lxe,"aria-hidden":"true","data-sentinel":"end"})))}var Njt=m.forwardRef(Wjt),Ujt=function(e){var n=e.open,o=n===void 0?!1:n,r=e.prefixCls,i=r===void 0?"rc-drawer":r,a=e.placement,l=a===void 0?"right":a,s=e.autoFocus,c=s===void 0?!0:s,u=e.keyboard,d=u===void 0?!0:u,f=e.width,p=f===void 0?378:f,g=e.mask,A=g===void 0?!0:g,y=e.maskClosable,S=y===void 0?!0:y,C=e.getContainer,P=e.forceRender,v=e.afterOpenChange,T=e.destroyOnClose,w=e.onMouseEnter,x=e.onMouseOver,b=e.onMouseLeave,R=e.onClick,H=e.onKeyDown,F=e.onKeyUp,E=e.panelRef,N=m.useState(!1),U=wue(N,2),W=U[0],k=U[1],D=m.useState(!1),L=wue(D,2),j=L[0],B=L[1];_a(function(){B(!0)},[]);var O=j?o:!1,V=m.useRef(),G=m.useRef();_a(function(){O&&(G.current=document.activeElement)},[O]);var q=function(Z){var ee;if(k(Z),v==null||v(Z),!Z&&G.current&&!((ee=V.current)!==null&&ee!==void 0&&ee.contains(G.current))){var te;(te=G.current)===null||te===void 0||te.focus({preventScroll:!0})}},$=m.useMemo(function(){return{panel:E}},[E]);if(!P&&!W&&!O&&T)return null;var ie={onMouseEnter:w,onMouseOver:x,onMouseLeave:b,onClick:R,onKeyDown:H,onKeyUp:F},Q=i2(i2({},e),{},{open:O,prefixCls:i,placement:l,autoFocus:c,keyboard:d,width:p,mask:A,maskClosable:S,inline:C===!1,afterOpenChange:q,ref:V},ie);return m.createElement(BJe.Provider,{value:$},m.createElement(B$,{open:O||P||W,autoDestroy:!1,getContainer:C,autoLock:A&&(O||W)},m.createElement(Njt,Q)))};const jjt=new ba("antSpinMove",{to:{opacity:1}}),Bjt=new ba("antRotate",{to:{transform:"rotate(405deg)"}}),Yjt=t=>{const{componentCls:e,calc:n}=t;return{[`${e}`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",display:"none",color:t.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${t.motionDurationSlow} ${t.motionEaseInOutCirc}`,"&-spinning":{position:"static",display:"inline-block",opacity:1},[`${e}-text`]:{fontSize:t.fontSize,paddingTop:n(n(t.dotSize).sub(t.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:t.colorBgMask,zIndex:t.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${t.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[`${e}-dot ${e}-dot-item`]:{backgroundColor:t.colorWhite},[`${e}-text`]:{color:t.colorTextLightSolid}},"&-nested-loading":{position:"relative",[`> div > ${e}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:t.contentHeight,[`${e}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:n(t.dotSize).mul(-1).div(2).equal()},[`${e}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${t.colorBgContainer}`},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${e}-dot`]:{margin:n(t.dotSizeSM).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeSM).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${e}-dot`]:{margin:n(t.dotSizeLG).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeLG).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${e}-container`]:{position:"relative",transition:`opacity ${t.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:t.colorBgContainer,opacity:0,transition:`all ${t.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:t.spinDotDefault},[`${e}-dot`]:{position:"relative",display:"inline-block",fontSize:t.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),height:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),backgroundColor:t.colorPrimary,borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:jjt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:Bjt,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&-sm ${e}-dot`]:{fontSize:t.dotSizeSM,i:{width:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal(),height:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal()}},[`&-lg ${e}-dot`]:{fontSize:t.dotSizeLG,i:{width:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal(),height:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal()}},[`&${e}-show-text ${e}-text`]:{display:"block"}})}},Ojt=t=>{const{controlHeightLG:e,controlHeight:n}=t;return{contentHeight:400,dotSize:e/2,dotSizeSM:e*.35,dotSizeLG:n}},Vjt=wl("Spin",t=>{const e=qi(t,{spinDotDefault:t.colorTextDescription});return[Yjt(e)]},Ojt);var _jt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,spinning:n=!0,delay:o=0,className:r,rootClassName:i,size:a="default",tip:l,wrapperClassName:s,style:c,children:u,fullscreen:d=!1}=t,f=_jt(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen"]),{getPrefixCls:p}=m.useContext(Cr),g=p("spin",e),[A,y,S]=Vjt(g),[C,P]=m.useState(()=>n&&!Xjt(n,o));m.useEffect(()=>{if(n){const E=RNt(o,()=>{P(!0)});return E(),()=>{var N;(N=E==null?void 0:E.cancel)===null||N===void 0||N.call(E)}}P(!1)},[o,n]);const v=m.useMemo(()=>typeof u<"u"&&!d,[u,d]),{direction:T,spin:w}=m.useContext(Cr),x=Un(g,w==null?void 0:w.className,{[`${g}-sm`]:a==="small",[`${g}-lg`]:a==="large",[`${g}-spinning`]:C,[`${g}-show-text`]:!!l,[`${g}-fullscreen`]:d,[`${g}-fullscreen-show`]:d&&C,[`${g}-rtl`]:T==="rtl"},r,i,y,S),b=Un(`${g}-container`,{[`${g}-blur`]:C}),R=dp(f,["indicator"]),H=Object.assign(Object.assign({},w==null?void 0:w.style),c),F=m.createElement("div",Object.assign({},R,{style:H,className:x,"aria-live":"polite","aria-busy":C}),Gjt(g,t),l&&(v||d)?m.createElement("div",{className:`${g}-text`},l):null);return A(v?m.createElement("div",Object.assign({},R,{className:Un(`${g}-nested-loading`,s,y,S)}),C&&m.createElement("div",{key:"loading"},F),m.createElement("div",{className:b,key:"container"},u)):F)};tN.setDefaultIndicator=t=>{e_=t};const YJe=t=>{var e,n;const{prefixCls:o,title:r,footer:i,extra:a,loading:l,onClose:s,headerStyle:c,bodyStyle:u,footerStyle:d,children:f,classNames:p,styles:g}=t,{drawer:A}=m.useContext(Cr),y=m.useCallback(w=>m.createElement("button",{type:"button",onClick:s,"aria-label":"Close",className:`${o}-close`},w),[s]),[S,C]=Dme(AR(t),AR(A),{closable:!0,closeIconRender:y});let P;typeof l=="boolean"?P={spinning:l}:typeof l=="object"&&(P=Object.assign({spinning:!0},l));const v=m.useMemo(()=>{var w,x;return!r&&!S?null:m.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(w=A==null?void 0:A.styles)===null||w===void 0?void 0:w.header),c),g==null?void 0:g.header),className:Un(`${o}-header`,{[`${o}-header-close-only`]:S&&!r&&!a},(x=A==null?void 0:A.classNames)===null||x===void 0?void 0:x.header,p==null?void 0:p.header)},m.createElement("div",{className:`${o}-header-title`},C,r&&m.createElement("div",{className:`${o}-title`},r)),a&&m.createElement("div",{className:`${o}-extra`},a))},[S,C,a,c,o,r]),T=m.useMemo(()=>{var w,x;if(!i)return null;const b=`${o}-footer`;return m.createElement("div",{className:Un(b,(w=A==null?void 0:A.classNames)===null||w===void 0?void 0:w.footer,p==null?void 0:p.footer),style:Object.assign(Object.assign(Object.assign({},(x=A==null?void 0:A.styles)===null||x===void 0?void 0:x.footer),d),g==null?void 0:g.footer)},i)},[i,d,o]);return P!=null&&P.spinning?m.createElement(tN,Object.assign({spinning:!1,style:{height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},P)):m.createElement(m.Fragment,null,v,m.createElement("div",{className:Un(`${o}-body`,p==null?void 0:p.body,(e=A==null?void 0:A.classNames)===null||e===void 0?void 0:e.body),style:Object.assign(Object.assign(Object.assign({},(n=A==null?void 0:A.styles)===null||n===void 0?void 0:n.body),u),g==null?void 0:g.body)},f),T)},Jjt=t=>{const e="100%";return{left:`translateX(-${e})`,right:`translateX(${e})`,top:`translateY(-${e})`,bottom:`translateY(${e})`}[t]},OJe=(t,e)=>({"&-enter, &-appear":Object.assign(Object.assign({},t),{"&-active":e}),"&-leave":Object.assign(Object.assign({},e),{"&-active":t})}),VJe=(t,e)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${e}`}}},OJe({opacity:t},{opacity:1})),Kjt=(t,e)=>[VJe(.7,e),OJe({transform:Jjt(t)},{transform:"none"})],qjt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return{[e]:{[`${e}-mask-motion`]:VJe(0,n),[`${e}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:Kjt(r,n)}),{})}}},$jt=t=>{const{borderRadiusSM:e,componentCls:n,zIndexPopup:o,colorBgMask:r,colorBgElevated:i,motionDurationSlow:a,motionDurationMid:l,paddingXS:s,padding:c,paddingLG:u,fontSizeLG:d,lineHeightLG:f,lineWidth:p,lineType:g,colorSplit:A,marginXS:y,colorIcon:S,colorIconHover:C,colorBgTextHover:P,colorBgTextActive:v,colorText:T,fontWeightStrong:w,footerPaddingBlock:x,footerPaddingInline:b,calc:R}=t,H=`${n}-content-wrapper`;return{[n]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none","&-pure":{position:"relative",background:i,display:"flex",flexDirection:"column",[`&${n}-left`]:{boxShadow:t.boxShadowDrawerLeft},[`&${n}-right`]:{boxShadow:t.boxShadowDrawerRight},[`&${n}-top`]:{boxShadow:t.boxShadowDrawerUp},[`&${n}-bottom`]:{boxShadow:t.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${n}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[H]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${a}`,"&-hidden":{display:"none"}},[`&-left > ${H}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowDrawerLeft},[`&-right > ${H}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:t.boxShadowDrawerRight},[`&-top > ${H}`]:{top:0,insetInline:0,boxShadow:t.boxShadowDrawerUp},[`&-bottom > ${H}`]:{bottom:0,insetInline:0,boxShadow:t.boxShadowDrawerDown},[`${n}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:i,pointerEvents:"auto"},[`${n}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${jt(c)} ${jt(u)}`,fontSize:d,lineHeight:f,borderBottom:`${jt(p)} ${g} ${A}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${n}-extra`]:{flex:"none"},[`${n}-close`]:Object.assign({display:"inline-flex",width:R(d).add(s).equal(),height:R(d).add(s).equal(),borderRadius:e,justifyContent:"center",alignItems:"center",marginInlineEnd:y,color:S,fontWeight:w,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${l}`,textRendering:"auto","&:hover":{color:C,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:v}},eA(t)),[`${n}-title`]:{flex:1,margin:0,color:T,fontWeight:t.fontWeightStrong,fontSize:d,lineHeight:f},[`${n}-body`]:{flex:1,minWidth:0,minHeight:0,padding:u,overflow:"auto"},[`${n}-footer`]:{flexShrink:0,padding:`${jt(x)} ${jt(b)}`,borderTop:`${jt(p)} ${g} ${A}`},"&-rtl":{direction:"rtl"}}}},Qjt=t=>({zIndexPopup:t.zIndexPopupBase,footerPaddingBlock:t.paddingXS,footerPaddingInline:t.padding}),_Je=wl("Drawer",t=>{const e=qi(t,{});return[$jt(e),qjt(e)]},Qjt);var GJe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{rootClassName:e,width:n,height:o,size:r="default",mask:i=!0,push:a=Zjt,open:l,afterOpenChange:s,onClose:c,prefixCls:u,getContainer:d,style:f,className:p,visible:g,afterVisibleChange:A,maskStyle:y,drawerStyle:S,contentWrapperStyle:C}=t,P=GJe(t,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle"]),{getPopupContainer:v,getPrefixCls:T,direction:w,drawer:x}=m.useContext(Cr),b=T("drawer",u),[R,H,F]=_Je(b),E=d===void 0&&v?()=>v(document.body):d,N=Un({"no-mask":!i,[`${b}-rtl`]:w==="rtl"},e,H,F),U=m.useMemo(()=>n??(r==="large"?736:378),[n,r]),W=m.useMemo(()=>o??(r==="large"?736:378),[o,r]),k={motionName:B9(b,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},D=$=>({motionName:B9(b,`panel-motion-${$}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),L=aGe(),[j,B]=Bw("Drawer",P.zIndex),{classNames:O={},styles:V={}}=P,{classNames:G={},styles:q={}}=x||{};return R(m.createElement(O9,null,m.createElement(vR,{status:!0,override:!0},m.createElement(WW.Provider,{value:B},m.createElement(Ujt,Object.assign({prefixCls:b,onClose:c,maskMotion:k,motion:D},P,{classNames:{mask:Un(O.mask,G.mask),content:Un(O.content,G.content),wrapper:Un(O.wrapper,G.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},V.mask),y),q.mask),content:Object.assign(Object.assign(Object.assign({},V.content),S),q.content),wrapper:Object.assign(Object.assign(Object.assign({},V.wrapper),C),q.wrapper)},open:l??g,mask:i,push:a,width:U,height:W,style:Object.assign(Object.assign({},x==null?void 0:x.style),f),className:Un(x==null?void 0:x.className,p),rootClassName:N,getContainer:E,afterOpenChange:s??A,panelRef:L,zIndex:j}),m.createElement(YJe,Object.assign({prefixCls:b},P,{onClose:c})))))))},eBt=t=>{const{prefixCls:e,style:n,className:o,placement:r="right"}=t,i=GJe(t,["prefixCls","style","className","placement"]),{getPrefixCls:a}=m.useContext(Cr),l=a("drawer",e),[s,c,u]=_Je(l),d=Un(l,`${l}-pure`,`${l}-${r}`,c,u,o);return s(m.createElement("div",{className:d,style:n},m.createElement(YJe,Object.assign({prefixCls:l},i))))};vue._InternalPanelDoNotUseOrYouWillBeFired=eBt;function Wxe(t){return["small","middle","large"].includes(t)}function Nxe(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const XJe=be.createContext({latestIndex:0}),tBt=XJe.Provider,nBt=t=>{let{className:e,index:n,children:o,split:r,style:i}=t;const{latestIndex:a}=m.useContext(XJe);return o==null?null:m.createElement(m.Fragment,null,m.createElement("div",{className:e,style:i},o),n{var n,o;const{getPrefixCls:r,space:i,direction:a}=m.useContext(Cr),{size:l=(i==null?void 0:i.size)||"small",align:s,className:c,rootClassName:u,children:d,direction:f="horizontal",prefixCls:p,split:g,style:A,wrap:y=!1,classNames:S,styles:C}=t,P=oBt(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[v,T]=Array.isArray(l)?l:[l,l],w=Wxe(T),x=Wxe(v),b=Nxe(T),R=Nxe(v),H=Y9(d,{keepEmpty:!0}),F=s===void 0&&f==="horizontal"?"center":s,E=r("space",p),[N,U,W]=z_e(E),k=Un(E,i==null?void 0:i.className,U,`${E}-${f}`,{[`${E}-rtl`]:a==="rtl",[`${E}-align-${F}`]:F,[`${E}-gap-row-${T}`]:w,[`${E}-gap-col-${v}`]:x},c,u,W),D=Un(`${E}-item`,(n=S==null?void 0:S.item)!==null&&n!==void 0?n:(o=i==null?void 0:i.classNames)===null||o===void 0?void 0:o.item);let L=0;const j=H.map((V,G)=>{var q,$;V!=null&&(L=G);const ie=V&&V.key||`${D}-${G}`;return m.createElement(nBt,{className:D,key:ie,index:G,split:g,style:(q=C==null?void 0:C.item)!==null&&q!==void 0?q:($=i==null?void 0:i.styles)===null||$===void 0?void 0:$.item},V)}),B=m.useMemo(()=>({latestIndex:L}),[L]);if(H.length===0)return null;const O={};return y&&(O.flexWrap="wrap"),!x&&R&&(O.columnGap=v),!w&&b&&(O.rowGap=T),N(m.createElement("div",Object.assign({ref:e,className:k,style:Object.assign(Object.assign(Object.assign({},O),i==null?void 0:i.style),A)},P),m.createElement(tBt,{value:B},j)))}),on=rBt;on.Compact=sHt;var iBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPopupContainer:e,getPrefixCls:n,direction:o}=m.useContext(Cr),{prefixCls:r,type:i="default",danger:a,disabled:l,loading:s,onClick:c,htmlType:u,children:d,className:f,menu:p,arrow:g,autoFocus:A,overlay:y,trigger:S,align:C,open:P,onOpenChange:v,placement:T,getPopupContainer:w,href:x,icon:b=m.createElement($me,null),title:R,buttonsRender:H=se=>se,mouseEnterDelay:F,mouseLeaveDelay:E,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:k}=t,D=iBt(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),L=n("dropdown",r),j=`${L}-button`,B={menu:p,arrow:g,autoFocus:A,align:C,disabled:l,trigger:l?[]:S,onOpenChange:v,getPopupContainer:w||e,mouseEnterDelay:F,mouseLeaveDelay:E,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:k},{compactSize:O,compactItemClassnames:V}=Yw(L,o),G=Un(j,V,f);"overlay"in t&&(B.overlay=y),"open"in t&&(B.open=P),"placement"in t?B.placement=T:B.placement=o==="rtl"?"bottomLeft":"bottomRight";const q=m.createElement(io,{type:i,danger:a,disabled:l,loading:s,onClick:c,htmlType:u,href:x,title:R},d),$=m.createElement(io,{type:i,danger:a,icon:b}),[ie,Q]=H([q,$]);return m.createElement(on.Compact,Object.assign({className:G,size:O,block:!0},D),ie,m.createElement(iQ,Object.assign({},B),Q))};JJe.__ANT_BUTTON=!0;const rA=iQ;rA.Button=JJe;var aBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},lBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:aBt}))},Zx=m.forwardRef(lBt);function Uxe(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function BY(t,e,n,o){var r=X_.unstable_batchedUpdates?function(a){X_.unstable_batchedUpdates(n,a)}:n;return t!=null&&t.addEventListener&&t.addEventListener(e,r,o),{remove:function(){t!=null&&t.removeEventListener&&t.removeEventListener(e,r,o)}}}const KJe=function(){const t=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let e=1;e{const r=n[o];r!==void 0&&(t[o]=r)})}return t};var sBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},cBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:sBt}))},jxe=m.forwardRef(cBt),uBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},dBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:uBt}))},Bxe=m.forwardRef(dBt),fBt={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},hBt=["10","20","50","100"],pBt=function(e){var n=e.pageSizeOptions,o=n===void 0?hBt:n,r=e.locale,i=e.changeSize,a=e.pageSize,l=e.goButton,s=e.quickGo,c=e.rootPrefixCls,u=e.selectComponentClass,d=e.selectPrefixCls,f=e.disabled,p=e.buildOptionText,g=be.useState(""),A=sn(g,2),y=A[0],S=A[1],C=function(){return!y||Number.isNaN(y)?void 0:Number(y)},P=typeof p=="function"?p:function(U){return"".concat(U," ").concat(r.items_per_page)},v=function(W){i==null||i(Number(W))},T=function(W){S(W.target.value)},w=function(W){l||y===""||(S(""),!(W.relatedTarget&&(W.relatedTarget.className.indexOf("".concat(c,"-item-link"))>=0||W.relatedTarget.className.indexOf("".concat(c,"-item"))>=0))&&(s==null||s(C())))},x=function(W){y!==""&&(W.keyCode===jn.ENTER||W.type==="click")&&(S(""),s==null||s(C()))},b=function(){return o.some(function(W){return W.toString()===a.toString()})?o:o.concat([a.toString()]).sort(function(W,k){var D=Number.isNaN(Number(W))?0:Number(W),L=Number.isNaN(Number(k))?0:Number(k);return D-L})},R="".concat(c,"-options");if(!i&&!s)return null;var H=null,F=null,E=null;if(i&&u){var N=b().map(function(U,W){return be.createElement(u.Option,{key:W,value:U.toString()},P(U))});H=be.createElement(u,{disabled:f,prefixCls:d,showSearch:!1,className:"".concat(R,"-size-changer"),optionLabelProp:"children",popupMatchSelectWidth:!1,value:(a||o[0]).toString(),onChange:v,getPopupContainer:function(W){return W.parentNode},"aria-label":r.page_size,defaultOpen:!1},N)}return s&&(l&&(E=typeof l=="boolean"?be.createElement("button",{type:"button",onClick:x,onKeyUp:x,disabled:f,className:"".concat(R,"-quick-jumper-button")},r.jump_to_confirm):be.createElement("span",{onClick:x,onKeyUp:x},l)),F=be.createElement("div",{className:"".concat(R,"-quick-jumper")},r.jump_to,be.createElement("input",{disabled:f,type:"text",value:y,onChange:T,onKeyUp:x,onBlur:w,"aria-label":r.page}),r.page,E)),be.createElement("li",{className:R},H,F)},Bz=function(e){var n,o=e.rootPrefixCls,r=e.page,i=e.active,a=e.className,l=e.showTitle,s=e.onClick,c=e.onKeyPress,u=e.itemRender,d="".concat(o,"-item"),f=Xn(d,"".concat(d,"-").concat(r),(n={},Jt(n,"".concat(d,"-active"),i),Jt(n,"".concat(d,"-disabled"),!r),n),a),p=function(){s(r)},g=function(S){c(S,s,r)},A=u(r,"page",be.createElement("a",{rel:"nofollow"},r));return A?be.createElement("li",{title:l?String(r):null,className:f,onClick:p,onKeyDown:g,tabIndex:0},A):null},gBt=function(e,n,o){return o};function Yxe(){}function Oxe(t){var e=Number(t);return typeof e=="number"&&!Number.isNaN(e)&&isFinite(e)&&Math.floor(e)===e}function q7(t,e,n){var o=typeof t>"u"?e:t;return Math.floor((n-1)/o)+1}var mBt=function(e){var n,o=e.prefixCls,r=o===void 0?"rc-pagination":o,i=e.selectPrefixCls,a=i===void 0?"rc-select":i,l=e.className,s=e.selectComponentClass,c=e.current,u=e.defaultCurrent,d=u===void 0?1:u,f=e.total,p=f===void 0?0:f,g=e.pageSize,A=e.defaultPageSize,y=A===void 0?10:A,S=e.onChange,C=S===void 0?Yxe:S,P=e.hideOnSinglePage,v=e.showPrevNextJumpers,T=v===void 0?!0:v,w=e.showQuickJumper,x=e.showLessItems,b=e.showTitle,R=b===void 0?!0:b,H=e.onShowSizeChange,F=H===void 0?Yxe:H,E=e.locale,N=E===void 0?fBt:E,U=e.style,W=e.totalBoundaryShowSizeChanger,k=W===void 0?50:W,D=e.disabled,L=e.simple,j=e.showTotal,B=e.showSizeChanger,O=e.pageSizeOptions,V=e.itemRender,G=V===void 0?gBt:V,q=e.jumpPrevIcon,$=e.jumpNextIcon,ie=e.prevIcon,Q=e.nextIcon,se=be.useRef(null),Z=Es(10,{value:g,defaultValue:y}),ee=sn(Z,2),te=ee[0],oe=ee[1],de=Es(1,{value:c,defaultValue:d,postState:function(Ht){return Math.max(1,Math.min(Ht,q7(void 0,te,p)))}}),he=sn(de,2),pe=he[0],me=he[1],le=be.useState(pe),Te=sn(le,2),ge=Te[0],Se=Te[1];m.useEffect(function(){Se(pe)},[pe]);var Re=Math.max(1,pe-(x?3:5)),De=Math.min(q7(void 0,te,p),pe+(x?3:5));function Ae(tt,Ht){var _t=tt||be.createElement("button",{type:"button","aria-label":Ht,className:"".concat(r,"-item-link")});return typeof tt=="function"&&(_t=be.createElement(tt,en({},e))),_t}function ue(tt){var Ht=tt.target.value,_t=q7(void 0,te,p),qt;return Ht===""?qt=Ht:Number.isNaN(Number(Ht))?qt=ge:Ht>=_t?qt=_t:qt=Number(Ht),qt}function fe(tt){return Oxe(tt)&&tt!==pe&&Oxe(p)&&p>0}var ve=p>te?w:!1;function we(tt){(tt.keyCode===jn.UP||tt.keyCode===jn.DOWN)&&tt.preventDefault()}function Pe(tt){var Ht=ue(tt);switch(Ht!==ge&&Se(Ht),tt.keyCode){case jn.ENTER:ze(Ht);break;case jn.UP:ze(Ht-1);break;case jn.DOWN:ze(Ht+1);break}}function Ie(tt){ze(ue(tt))}function Me(tt){var Ht=q7(tt,te,p),_t=pe>Ht&&Ht!==0?Ht:pe;oe(tt),Se(_t),F==null||F(pe,tt),me(_t),C==null||C(_t,tt)}function ze(tt){if(fe(tt)&&!D){var Ht=q7(void 0,te,p),_t=tt;return tt>Ht?_t=Ht:tt<1&&(_t=1),_t!==ge&&Se(_t),me(_t),C==null||C(_t,te),_t}return pe}var Ne=pe>1,Je=pek;function nt(){Ne&&ze(pe-1)}function We(){Je&&ze(pe+1)}function Ee(){ze(Re)}function ke(){ze(De)}function Oe(tt,Ht){if(tt.key==="Enter"||tt.charCode===jn.ENTER||tt.keyCode===jn.ENTER){for(var _t=arguments.length,qt=new Array(_t>2?_t-2:0),un=2;un<_t;un++)qt[un-2]=arguments[un];Ht.apply(void 0,qt)}}function st(tt){Oe(tt,nt)}function je(tt){Oe(tt,We)}function xt(tt){Oe(tt,Ee)}function gt(tt){Oe(tt,ke)}function Ye(tt){var Ht=G(tt,"prev",Ae(ie,"prev page"));return be.isValidElement(Ht)?be.cloneElement(Ht,{disabled:!Ne}):Ht}function it(tt){var Ht=G(tt,"next",Ae(Q,"next page"));return be.isValidElement(Ht)?be.cloneElement(Ht,{disabled:!Je}):Ht}function ut(tt){(tt.type==="click"||tt.keyCode===jn.ENTER)&&ze(ge)}var Qe=null,lt=bf(e,{aria:!0,data:!0}),Ze=j&&be.createElement("li",{className:"".concat(r,"-total-text")},j(p,[p===0?0:(pe-1)*te+1,pe*te>p?p:pe*te])),Be=null,$e=q7(void 0,te,p);if(P&&p<=te)return null;var wt=[],vt={rootPrefixCls:r,onClick:ze,onKeyPress:Oe,showTitle:R,itemRender:G,page:-1},Rt=pe-1>0?pe-1:0,Gt=pe+1<$e?pe+1:$e,At=w&&w.goButton,pt=At,Wt=null;L&&(At&&(typeof At=="boolean"?pt=be.createElement("button",{type:"button",onClick:ut,onKeyUp:ut},N.jump_to_confirm):pt=be.createElement("span",{onClick:ut,onKeyUp:ut},At),pt=be.createElement("li",{title:R?"".concat(N.jump_to).concat(pe,"/").concat($e):null,className:"".concat(r,"-simple-pager")},pt)),Wt=be.createElement("li",{title:R?"".concat(pe,"/").concat($e):null,className:"".concat(r,"-simple-pager")},be.createElement("input",{type:"text",value:ge,disabled:D,onKeyDown:we,onKeyUp:Pe,onChange:Pe,onBlur:Ie,size:3}),be.createElement("span",{className:"".concat(r,"-slash")},"/"),$e));var ht=x?1:2;if($e<=3+ht*2){$e||wt.push(be.createElement(Bz,go({},vt,{key:"noPager",page:1,className:"".concat(r,"-item-disabled")})));for(var ct=1;ct<=$e;ct+=1)wt.push(be.createElement(Bz,go({},vt,{key:ct,page:ct,active:pe===ct})))}else{var It=x?N.prev_3:N.prev_5,Ft=x?N.next_3:N.next_5,Ve=G(Re,"jump-prev",Ae(q,"prev page")),ft=G(De,"jump-next",Ae($,"next page"));T&&(Qe=Ve?be.createElement("li",{title:R?It:null,key:"prev",onClick:Ee,tabIndex:0,onKeyDown:xt,className:Xn("".concat(r,"-jump-prev"),Jt({},"".concat(r,"-jump-prev-custom-icon"),!!q))},Ve):null,Be=ft?be.createElement("li",{title:R?Ft:null,key:"next",onClick:ke,tabIndex:0,onKeyDown:gt,className:Xn("".concat(r,"-jump-next"),Jt({},"".concat(r,"-jump-next-custom-icon"),!!$))},ft):null);var kt=Math.max(1,pe-ht),rt=Math.min(pe+ht,$e);pe-1<=ht&&(rt=1+ht*2),$e-pe<=ht&&(kt=$e-ht*2);for(var at=kt;at<=rt;at+=1)wt.push(be.createElement(Bz,go({},vt,{key:at,page:at,active:pe===at})));if(pe-1>=ht*2&&pe!==3&&(wt[0]=be.cloneElement(wt[0],{className:Xn("".concat(r,"-item-after-jump-prev"),wt[0].props.className)}),wt.unshift(Qe)),$e-pe>=ht*2&&pe!==$e-2){var Ge=wt[wt.length-1];wt[wt.length-1]=be.cloneElement(Ge,{className:Xn("".concat(r,"-item-before-jump-next"),Ge.props.className)}),wt.push(Be)}kt!==1&&wt.unshift(be.createElement(Bz,go({},vt,{key:1,page:1}))),rt!==$e&&wt.push(be.createElement(Bz,go({},vt,{key:$e,page:$e})))}var yt=Ye(Rt);if(yt){var Pt=!Ne||!$e;yt=be.createElement("li",{title:R?N.prev_page:null,onClick:nt,tabIndex:Pt?null:0,onKeyDown:st,className:Xn("".concat(r,"-prev"),Jt({},"".concat(r,"-disabled"),Pt)),"aria-disabled":Pt},yt)}var ot=it(Gt);if(ot){var bt,zt;L?(bt=!Je,zt=Ne?0:null):(bt=!Je||!$e,zt=bt?null:0),ot=be.createElement("li",{title:R?N.next_page:null,onClick:We,tabIndex:zt,onKeyDown:je,className:Xn("".concat(r,"-next"),Jt({},"".concat(r,"-disabled"),bt)),"aria-disabled":bt},ot)}var Bt=Xn(r,l,(n={},Jt(n,"".concat(r,"-simple"),L),Jt(n,"".concat(r,"-disabled"),D),n));return be.createElement("ul",go({className:Bt,style:U,ref:se},lt),Ze,yt,L?Wt:wt,ot,be.createElement(pBt,{locale:N,rootPrefixCls:r,disabled:D,selectComponentClass:s,selectPrefixCls:a,changeSize:Ue?Me:null,pageSize:te,pageSizeOptions:O,quickGo:ve?ze:null,goButton:pt}))};const qJe=t=>m.createElement(Uo,Object.assign({},t,{showSearch:!0,size:"small"})),$Je=t=>m.createElement(Uo,Object.assign({},t,{showSearch:!0,size:"middle"}));qJe.Option=Uo.Option;$Je.Option=Uo.Option;const yBt=t=>{const{componentCls:e}=t;return{[`${e}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-item`]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:t.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:t.colorBorder,backgroundColor:t.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:t.itemActiveBgDisabled},a:{color:t.itemActiveColorDisabled}}},[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${e}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${e}-simple-pager`]:{color:t.colorTextDisabled},[`${e}-jump-prev, ${e}-jump-next`]:{[`${e}-item-link-icon`]:{opacity:0},[`${e}-item-ellipsis`]:{opacity:1}}},[`&${e}-simple`]:{[`${e}-prev, ${e}-next`]:{[`&${e}-disabled ${e}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},ABt=t=>{const{componentCls:e}=t;return{[`&${e}-mini ${e}-total-text, &${e}-mini ${e}-simple-pager`]:{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-item`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.calc(t.itemSizeSM).sub(2).equal())},[`&${e}-mini:not(${e}-disabled) ${e}-item:not(${e}-item-active)`]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},[`&${e}-mini ${e}-prev, &${e}-mini ${e}-next`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini:not(${e}-disabled)`]:{[`${e}-prev, ${e}-next`]:{[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover ${e}-item-link`]:{backgroundColor:"transparent"}}},[` +`,ojt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],yie={},pm;function rjt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=t.getAttribute("id")||t.getAttribute("data-reactid")||t.getAttribute("name");if(e&&yie[n])return yie[n];var o=window.getComputedStyle(t),r=o.getPropertyValue("box-sizing")||o.getPropertyValue("-moz-box-sizing")||o.getPropertyValue("-webkit-box-sizing"),i=parseFloat(o.getPropertyValue("padding-bottom"))+parseFloat(o.getPropertyValue("padding-top")),a=parseFloat(o.getPropertyValue("border-bottom-width"))+parseFloat(o.getPropertyValue("border-top-width")),l=ojt.map(function(c){return"".concat(c,":").concat(o.getPropertyValue(c))}).join(";"),s={sizingStyle:l,paddingSize:i,borderSize:a,boxSizing:r};return e&&n&&(yie[n]=s),s}function ijt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;pm||(pm=document.createElement("textarea"),pm.setAttribute("tab-index","-1"),pm.setAttribute("aria-hidden","true"),document.body.appendChild(pm)),t.getAttribute("wrap")?pm.setAttribute("wrap",t.getAttribute("wrap")):pm.removeAttribute("wrap");var r=rjt(t,e),i=r.paddingSize,a=r.borderSize,l=r.boxSizing,s=r.sizingStyle;pm.setAttribute("style","".concat(s,";").concat(njt)),pm.value=t.value||t.placeholder||"";var c=void 0,u=void 0,d,f=pm.scrollHeight;if(l==="border-box"?f+=a:l==="content-box"&&(f-=i),n!==null||o!==null){pm.value=" ";var p=pm.scrollHeight-i;n!==null&&(c=p*n,l==="border-box"&&(c=c+i+a),f=Math.max(c,f)),o!==null&&(u=p*o,l==="border-box"&&(u=u+i+a),d=f>u?"":"hidden",f=Math.min(u,f))}var g={height:f,overflowY:d,resize:"none"};return c&&(g.minHeight=c),u&&(g.maxHeight=u),g}var ajt=["prefixCls","onPressEnter","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],Aie=0,wie=1,vie=2,ljt=m.forwardRef(function(t,e){var n=t,o=n.prefixCls;n.onPressEnter;var r=n.defaultValue,i=n.value,a=n.autoSize,l=n.onResize,s=n.className,c=n.style,u=n.disabled,d=n.onChange;n.onInternalAutoSize;var f=oi(n,ajt),p=Es(r,{value:i,postState:function(q){return q??""}}),g=sn(p,2),A=g[0],y=g[1],S=function(q){y(q.target.value),d==null||d(q)},C=m.useRef();m.useImperativeHandle(e,function(){return{textArea:C.current}});var P=m.useMemo(function(){return a&&hi(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),v=sn(P,2),T=v[0],w=v[1],x=!!a,b=function(){try{if(document.activeElement===C.current){var q=C.current,$=q.selectionStart,ie=q.selectionEnd,Q=q.scrollTop;C.current.setSelectionRange($,ie),C.current.scrollTop=Q}}catch{}},R=m.useState(vie),H=sn(R,2),F=H[0],E=H[1],N=m.useState(),U=sn(N,2),W=U[0],k=U[1],D=function(){E(Aie)};_a(function(){x&&D()},[i,T,w,x]),_a(function(){if(F===Aie)E(wie);else if(F===wie){var G=ijt(C.current,!1,T,w);E(vie),k(G)}else b()},[F]);var L=m.useRef(),j=function(){Ea.cancel(L.current)},B=function(q){F===vie&&(l==null||l(q),a&&(j(),L.current=Ea(function(){D()})))};m.useEffect(function(){return j},[]);var O=x?W:null,V=en(en({},c),O);return(F===Aie||F===wie)&&(V.overflowY="hidden",V.overflowX="hidden"),m.createElement(Cd,{onResize:B,disabled:!(a||l)},m.createElement("textarea",go({},f,{ref:C,style:V,className:Xn(o,s,Jt({},"".concat(o,"-disabled"),u)),disabled:u,value:A,onChange:S})))}),sjt=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize"],cjt=be.forwardRef(function(t,e){var n,o,r=t.defaultValue,i=t.value,a=t.onFocus,l=t.onBlur,s=t.onChange,c=t.allowClear,u=t.maxLength,d=t.onCompositionStart,f=t.onCompositionEnd,p=t.suffix,g=t.prefixCls,A=g===void 0?"rc-textarea":g,y=t.showCount,S=t.count,C=t.className,P=t.style,v=t.disabled,T=t.hidden,w=t.classNames,x=t.styles,b=t.onResize,R=oi(t,sjt),H=Es(r,{value:i,defaultValue:r}),F=sn(H,2),E=F[0],N=F[1],U=E==null?"":String(E),W=be.useState(!1),k=sn(W,2),D=k[0],L=k[1],j=be.useRef(!1),B=be.useState(null),O=sn(B,2),V=O[0],G=O[1],q=m.useRef(null),$=function(){var Ie;return(Ie=q.current)===null||Ie===void 0?void 0:Ie.textArea},ie=function(){$().focus()};m.useImperativeHandle(e,function(){return{resizableTextArea:q.current,focus:ie,blur:function(){$().blur()}}}),m.useEffect(function(){L(function(Pe){return!v&&Pe})},[v]);var Q=be.useState(null),se=sn(Q,2),oe=se[0],Z=se[1];be.useEffect(function(){if(oe){var Pe;(Pe=$()).setSelectionRange.apply(Pe,No(oe))}},[oe]);var te=MJe(S,y),ee=(n=te.max)!==null&&n!==void 0?n:u,de=Number(ee)>0,fe=te.strategy(U),pe=!!ee&&fe>ee,ye=function(Ie,Me){var ze=Me;!j.current&&te.exceedFormatter&&te.max&&te.strategy(Me)>te.max&&(ze=te.exceedFormatter(Me,{max:te.max}),Me!==ze&&Z([$().selectionStart||0,$().selectionEnd||0])),N(ze),KG(Ie.currentTarget,Ie,s,ze)},ae=function(Ie){j.current=!0,d==null||d(Ie)},Te=function(Ie){j.current=!1,ye(Ie,Ie.currentTarget.value),f==null||f(Ie)},ge=function(Ie){ye(Ie,Ie.target.value)},Se=function(Ie){var Me=R.onPressEnter,ze=R.onKeyDown;Ie.key==="Enter"&&Me&&Me(Ie),ze==null||ze(Ie)},Re=function(Ie){L(!0),a==null||a(Ie)},De=function(Ie){L(!1),l==null||l(Ie)},Ae=function(Ie){N(""),ie(),KG($(),Ie,s)},ue=p,he;te.show&&(te.showFormatter?he=te.showFormatter({value:U,count:fe,maxLength:ee}):he="".concat(fe).concat(de?" / ".concat(ee):""),ue=be.createElement(be.Fragment,null,ue,be.createElement("span",{className:Xn("".concat(A,"-data-count"),w==null?void 0:w.count),style:x==null?void 0:x.count},he)));var ve=function(Ie){var Me;b==null||b(Ie),(Me=$())!==null&&Me!==void 0&&Me.style.height&&G(!0)},we=!R.autoSize&&!y&&!c;return be.createElement(gye,{value:U,allowClear:c,handleReset:Ae,suffix:ue,prefixCls:A,classNames:en(en({},w),{},{affixWrapper:Xn(w==null?void 0:w.affixWrapper,(o={},Jt(o,"".concat(A,"-show-count"),y),Jt(o,"".concat(A,"-textarea-allow-clear"),c),o))}),disabled:v,focused:D,className:Xn(C,pe&&"".concat(A,"-out-of-range")),style:en(en({},P),V&&!we?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof he=="string"?he:void 0}},hidden:T},be.createElement(ljt,go({},R,{maxLength:u,onKeyDown:Se,onChange:ge,onFocus:Re,onBlur:De,onCompositionStart:ae,onCompositionEnd:Te,className:Xn(w==null?void 0:w.textarea),style:en(en({},x==null?void 0:x.textarea),{},{resize:P==null?void 0:P.resize}),disabled:v,prefixCls:A,onResize:ve,ref:q})))}),ujt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o;const{prefixCls:r,bordered:i=!0,size:a,disabled:l,status:s,allowClear:c,classNames:u,rootClassName:d,className:f,style:p,styles:g,variant:A}=t,y=ujt(t,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant"]),{getPrefixCls:S,direction:C,textArea:P}=m.useContext(Cr),v=zd(a),T=m.useContext(n1),w=l??T,{status:x,hasFeedback:b,feedbackIcon:R}=m.useContext(r1),H=Yb(x,s),F=m.useRef(null);m.useImperativeHandle(e,()=>{var B;return{resizableTextArea:(B=F.current)===null||B===void 0?void 0:B.resizableTextArea,focus:O=>{var V,G;WUt((G=(V=F.current)===null||V===void 0?void 0:V.resizableTextArea)===null||G===void 0?void 0:G.textArea,O)},blur:()=>{var O;return(O=F.current)===null||O===void 0?void 0:O.blur()}}});const E=S("input",r),N=Y0(E),[U,W,k]=uye(E,N),[D,L]=VH(A,i),j=DJe(c??(P==null?void 0:P.allowClear));return U(m.createElement(cjt,Object.assign({autoComplete:P==null?void 0:P.autoComplete},y,{style:Object.assign(Object.assign({},P==null?void 0:P.style),p),styles:Object.assign(Object.assign({},P==null?void 0:P.styles),g),disabled:w,allowClear:j,className:Un(k,N,f,d,P==null?void 0:P.className),classNames:Object.assign(Object.assign(Object.assign({},u),P==null?void 0:P.classNames),{textarea:Un({[`${E}-sm`]:v==="small",[`${E}-lg`]:v==="large"},W,u==null?void 0:u.textarea,(n=P==null?void 0:P.classNames)===null||n===void 0?void 0:n.textarea),variant:Un({[`${E}-${D}`]:L},fw(E,H)),affixWrapper:Un(`${E}-textarea-affix-wrapper`,{[`${E}-affix-wrapper-rtl`]:C==="rtl",[`${E}-affix-wrapper-sm`]:v==="small",[`${E}-affix-wrapper-lg`]:v==="large",[`${E}-textarea-show-count`]:t.showCount||((o=t.count)===null||o===void 0?void 0:o.show)},W)}),prefixCls:E,suffix:b&&m.createElement("span",{className:`${E}-textarea-suffix`},R),ref:F})))}),jl=gQ;jl.Group=FUt;jl.Search=tjt;jl.TextArea=FJe;jl.Password=ZUt;jl.OTP=OUt;var djt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},fjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:djt}))},kJe=m.forwardRef(fjt),hjt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},pjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hjt}))},LJe=m.forwardRef(pjt),gjt={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z"}}]},name:"swap-right",theme:"outlined"},mjt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gjt}))},yjt=m.forwardRef(mjt);function Ajt(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.yearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.quarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.monthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.weekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.placeholder:t.lang.placeholder}function wjt(t,e,n){return n!==void 0?n:e==="year"&&t.lang.yearPlaceholder?t.lang.rangeYearPlaceholder:e==="quarter"&&t.lang.quarterPlaceholder?t.lang.rangeQuarterPlaceholder:e==="month"&&t.lang.monthPlaceholder?t.lang.rangeMonthPlaceholder:e==="week"&&t.lang.weekPlaceholder?t.lang.rangeWeekPlaceholder:e==="time"&&t.timePickerLocale.placeholder?t.timePickerLocale.rangePlaceholder:t.lang.rangePlaceholder}function mye(t,e){const n={adjustX:1,adjustY:1};switch(e){case"bottomLeft":return{points:["tl","bl"],offset:[0,4],overflow:n};case"bottomRight":return{points:["tr","br"],offset:[0,4],overflow:n};case"topLeft":return{points:["bl","tl"],offset:[0,-4],overflow:n};case"topRight":return{points:["br","tr"],offset:[0,-4],overflow:n};default:return{points:t==="rtl"?["tr","br"]:["tl","bl"],offset:[0,4],overflow:n}}}function WJe(t,e){const{allowClear:n=!0}=t,{clearIcon:o,removeIcon:r}=OGe(Object.assign(Object.assign({},t),{prefixCls:e,componentName:"DatePicker"}));return[m.useMemo(()=>n===!1?!1:Object.assign({clearIcon:o},n===!0?{}:n),[n,o]),r]}function vjt(t){return m.createElement(io,Object.assign({size:"small",type:"primary"},t))}function NJe(t){return m.useMemo(()=>Object.assign({button:vjt},t),[t])}var xjt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var r;const{prefixCls:i,getPopupContainer:a,components:l,className:s,style:c,placement:u,size:d,disabled:f,bordered:p=!0,placeholder:g,popupClassName:A,dropdownClassName:y,status:S,rootClassName:C,variant:P}=n,v=xjt(n,["prefixCls","getPopupContainer","components","className","style","placement","size","disabled","bordered","placeholder","popupClassName","dropdownClassName","status","rootClassName","variant"]),T=m.useRef(null),{getPrefixCls:w,direction:x,getPopupContainer:b,rangePicker:R}=m.useContext(Cr),H=w("picker",i),{compactSize:F,compactItemClassnames:E}=Yw(H,x),{picker:N}=n,U=w(),[W,k]=VH(P,p),D=Y0(H),[L,j,B]=hJe(H,D),[O]=WJe(n,H),V=NJe(l),G=zd(fe=>{var pe;return(pe=d??F)!==null&&pe!==void 0?pe:fe}),q=m.useContext(n1),$=f??q,ie=m.useContext(r1),{hasFeedback:Q,status:se,feedbackIcon:oe}=ie,Z=m.createElement(m.Fragment,null,N==="time"?m.createElement(LJe,null):m.createElement(kJe,null),Q&&oe);m.useImperativeHandle(o,()=>T.current);const[te]=Uw("Calendar",IG),ee=Object.assign(Object.assign({},te),n.locale),[de]=Bw("DatePicker",(r=n.popupStyle)===null||r===void 0?void 0:r.zIndex);return L(m.createElement(O9,null,m.createElement(VLt,Object.assign({separator:m.createElement("span",{"aria-label":"to",className:`${H}-separator`},m.createElement(yjt,null)),disabled:$,ref:T,popupAlign:mye(x,u),placeholder:wjt(ee,N,g),suffixIcon:Z,prevIcon:m.createElement("span",{className:`${H}-prev-icon`}),nextIcon:m.createElement("span",{className:`${H}-next-icon`}),superPrevIcon:m.createElement("span",{className:`${H}-super-prev-icon`}),superNextIcon:m.createElement("span",{className:`${H}-super-next-icon`}),transitionName:`${U}-slide-up`},v,{className:Un({[`${H}-${G}`]:G,[`${H}-${W}`]:k},fw(H,Yb(se,S),Q),j,E,s,R==null?void 0:R.className,B,D,C),style:Object.assign(Object.assign({},R==null?void 0:R.style),c),locale:ee.lang,prefixCls:H,getPopupContainer:a||b,generateConfig:t,components:V,direction:x,classNames:{popup:Un(j,A||y,B,D,C)},styles:{popup:Object.assign(Object.assign({},n.popupStyle),{zIndex:de})},allowClear:O}))))})}var Sjt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var g;const{prefixCls:A,getPopupContainer:y,components:S,style:C,className:P,rootClassName:v,size:T,bordered:w,placement:x,placeholder:b,popupClassName:R,dropdownClassName:H,disabled:F,status:E,variant:N,onCalendarChange:U}=f,W=Sjt(f,["prefixCls","getPopupContainer","components","style","className","rootClassName","size","bordered","placement","placeholder","popupClassName","dropdownClassName","disabled","status","variant","onCalendarChange"]),{getPrefixCls:k,direction:D,getPopupContainer:L,[u]:j}=m.useContext(Cr),B=k("picker",A),{compactSize:O,compactItemClassnames:V}=Yw(B,D),G=m.useRef(null),[q,$]=VH(N,w),ie=Y0(B),[Q,se,oe]=hJe(B,ie);m.useImperativeHandle(p,()=>G.current);const Z={showToday:!0},te=s||f.picker,ee=k(),{onSelect:de,multiple:fe}=W,pe=de&&s==="time"&&!fe,ye=(ze,Ne,Je)=>{U==null||U(ze,Ne,Je),pe&&de(ze)},[ae,Te]=WJe(f,B),ge=NJe(S),Se=zd(ze=>{var Ne;return(Ne=T??O)!==null&&Ne!==void 0?Ne:ze}),Re=m.useContext(n1),De=F??Re,Ae=m.useContext(r1),{hasFeedback:ue,status:he,feedbackIcon:ve}=Ae,we=m.createElement(m.Fragment,null,te==="time"?m.createElement(LJe,null):m.createElement(kJe,null),ue&&ve),[Pe]=Uw("DatePicker",IG),Ie=Object.assign(Object.assign({},Pe),f.locale),[Me]=Bw("DatePicker",(g=f.popupStyle)===null||g===void 0?void 0:g.zIndex);return Q(m.createElement(O9,null,m.createElement(qLt,Object.assign({ref:G,placeholder:Ajt(Ie,te,b),suffixIcon:we,dropdownAlign:mye(D,x),prevIcon:m.createElement("span",{className:`${B}-prev-icon`}),nextIcon:m.createElement("span",{className:`${B}-next-icon`}),superPrevIcon:m.createElement("span",{className:`${B}-super-prev-icon`}),superNextIcon:m.createElement("span",{className:`${B}-super-next-icon`}),transitionName:`${ee}-slide-up`,picker:s,onCalendarChange:ye},Z,W,{locale:Ie.lang,className:Un({[`${B}-${Se}`]:Se,[`${B}-${q}`]:$},fw(B,Yb(he,E),ue),se,V,j==null?void 0:j.className,P,oe,ie,v),style:Object.assign(Object.assign({},j==null?void 0:j.style),C),prefixCls:B,getPopupContainer:y||L,generateConfig:t,components:ge,direction:D,disabled:De,classNames:{popup:Un(se,oe,ie,v,R||H)},styles:{popup:Object.assign(Object.assign({},f.popupStyle),{zIndex:Me})},allowClear:ae,removeIcon:Te}))))})}const n=e(),o=e("week","WeekPicker"),r=e("month","MonthPicker"),i=e("year","YearPicker"),a=e("quarter","QuarterPicker"),l=e("time","TimePicker");return{DatePicker:n,WeekPicker:o,MonthPicker:r,YearPicker:i,TimePicker:l,QuarterPicker:a}}function UJe(t){const{DatePicker:e,WeekPicker:n,MonthPicker:o,YearPicker:r,TimePicker:i,QuarterPicker:a}=Tjt(t),l=bjt(t),s=e;return s.WeekPicker=n,s.MonthPicker=o,s.YearPicker=r,s.RangePicker=l,s.TimePicker=i,s.QuarterPicker=a,s}const Vw=UJe(eLt);function jJe(t){const e=mye(t.direction,t.placement);return e.overflow.adjustY=!1,e.overflow.adjustX=!1,Object.assign(Object.assign({},t),{dropdownAlign:e})}const Pjt=XW(Vw,"picker",null,jJe);Vw._InternalPanelDoNotUseOrYouWillBeFired=Pjt;const Cjt=XW(Vw.RangePicker,"picker",null,jJe);Vw._InternalRangePanelDoNotUseOrYouWillBeFired=Cjt;Vw.generatePicker=UJe;function pk(t){"@babel/helpers - typeof";return pk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pk(t)}function Rjt(t,e){if(pk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(pk(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hjt(t){var e=Rjt(t,"string");return pk(e)=="symbol"?e:e+""}function Aue(t,e,n){return e=Hjt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dxe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function i2(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)continue;n[o]=t[o]}return n}function Fjt(t,e){if(t==null)return{};var n=Ejt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var kjt=["prefixCls","className","containerRef"],Ljt=function(e){var n=e.prefixCls,o=e.className,r=e.containerRef,i=Fjt(e,kjt),a=m.useContext(BJe),l=a.panel,s=Nw(l,r);return m.createElement("div",Vv({className:Xn("".concat(n,"-content"),o),role:"dialog",ref:s},bf(e,{aria:!0}),{"aria-modal":"true"},i))};function kxe(t){return typeof t=="string"&&String(Number(t))===t?(U0(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(t)):t}var Lxe={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function Wjt(t,e){var n,o,r,i=t.prefixCls,a=t.open,l=t.placement,s=t.inline,c=t.push,u=t.forceRender,d=t.autoFocus,f=t.keyboard,p=t.classNames,g=t.rootClassName,A=t.rootStyle,y=t.zIndex,S=t.className,C=t.id,P=t.style,v=t.motion,T=t.width,w=t.height,x=t.children,b=t.mask,R=t.maskClosable,H=t.maskMotion,F=t.maskClassName,E=t.maskStyle,N=t.afterOpenChange,U=t.onClose,W=t.onMouseEnter,k=t.onMouseOver,D=t.onMouseLeave,L=t.onClick,j=t.onKeyDown,B=t.onKeyUp,O=t.styles,V=m.useRef(),G=m.useRef(),q=m.useRef();m.useImperativeHandle(e,function(){return V.current});var $=function(Re){var De=Re.keyCode,Ae=Re.shiftKey;switch(De){case jn.TAB:{if(De===jn.TAB){if(!Ae&&document.activeElement===q.current){var ue;(ue=G.current)===null||ue===void 0||ue.focus({preventScroll:!0})}else if(Ae&&document.activeElement===G.current){var he;(he=q.current)===null||he===void 0||he.focus({preventScroll:!0})}}break}case jn.ESC:{U&&f&&(Re.stopPropagation(),U(Re));break}}};m.useEffect(function(){if(a&&d){var Se;(Se=V.current)===null||Se===void 0||Se.focus({preventScroll:!0})}},[a]);var ie=m.useState(!1),Q=wue(ie,2),se=Q[0],oe=Q[1],Z=m.useContext(Fxe),te;typeof c=="boolean"?te=c?{}:{distance:0}:te=c||{};var ee=(n=(o=(r=te)===null||r===void 0?void 0:r.distance)!==null&&o!==void 0?o:Z==null?void 0:Z.pushDistance)!==null&&n!==void 0?n:180,de=m.useMemo(function(){return{pushDistance:ee,push:function(){oe(!0)},pull:function(){oe(!1)}}},[ee]);m.useEffect(function(){if(a){var Se;Z==null||(Se=Z.push)===null||Se===void 0||Se.call(Z)}else{var Re;Z==null||(Re=Z.pull)===null||Re===void 0||Re.call(Z)}},[a]),m.useEffect(function(){return function(){var Se;Z==null||(Se=Z.pull)===null||Se===void 0||Se.call(Z)}},[]);var fe=b&&m.createElement(o1,Vv({key:"mask"},H,{visible:a}),function(Se,Re){var De=Se.className,Ae=Se.style;return m.createElement("div",{className:Xn("".concat(i,"-mask"),De,p==null?void 0:p.mask,F),style:i2(i2(i2({},Ae),E),O==null?void 0:O.mask),onClick:R&&a?U:void 0,ref:Re})}),pe=typeof v=="function"?v(l):v,ye={};if(se&&ee)switch(l){case"top":ye.transform="translateY(".concat(ee,"px)");break;case"bottom":ye.transform="translateY(".concat(-ee,"px)");break;case"left":ye.transform="translateX(".concat(ee,"px)");break;default:ye.transform="translateX(".concat(-ee,"px)");break}l==="left"||l==="right"?ye.width=kxe(T):ye.height=kxe(w);var ae={onMouseEnter:W,onMouseOver:k,onMouseLeave:D,onClick:L,onKeyDown:j,onKeyUp:B},Te=m.createElement(o1,Vv({key:"panel"},pe,{visible:a,forceRender:u,onVisibleChanged:function(Re){N==null||N(Re)},removeOnLeave:!1,leavedClassName:"".concat(i,"-content-wrapper-hidden")}),function(Se,Re){var De=Se.className,Ae=Se.style;return m.createElement("div",Vv({className:Xn("".concat(i,"-content-wrapper"),p==null?void 0:p.wrapper,De),style:i2(i2(i2({},ye),Ae),O==null?void 0:O.wrapper)},bf(t,{data:!0})),m.createElement(Ljt,Vv({id:C,containerRef:Re,prefixCls:i,className:Xn(S,p==null?void 0:p.content),style:i2(i2({},P),O==null?void 0:O.content)},bf(t,{aria:!0}),ae),x))}),ge=i2({},A);return y&&(ge.zIndex=y),m.createElement(Fxe.Provider,{value:de},m.createElement("div",{className:Xn(i,"".concat(i,"-").concat(l),g,Aue(Aue({},"".concat(i,"-open"),a),"".concat(i,"-inline"),s)),style:ge,tabIndex:-1,ref:V,onKeyDown:$},fe,m.createElement("div",{tabIndex:0,ref:G,style:Lxe,"aria-hidden":"true","data-sentinel":"start"}),Te,m.createElement("div",{tabIndex:0,ref:q,style:Lxe,"aria-hidden":"true","data-sentinel":"end"})))}var Njt=m.forwardRef(Wjt),Ujt=function(e){var n=e.open,o=n===void 0?!1:n,r=e.prefixCls,i=r===void 0?"rc-drawer":r,a=e.placement,l=a===void 0?"right":a,s=e.autoFocus,c=s===void 0?!0:s,u=e.keyboard,d=u===void 0?!0:u,f=e.width,p=f===void 0?378:f,g=e.mask,A=g===void 0?!0:g,y=e.maskClosable,S=y===void 0?!0:y,C=e.getContainer,P=e.forceRender,v=e.afterOpenChange,T=e.destroyOnClose,w=e.onMouseEnter,x=e.onMouseOver,b=e.onMouseLeave,R=e.onClick,H=e.onKeyDown,F=e.onKeyUp,E=e.panelRef,N=m.useState(!1),U=wue(N,2),W=U[0],k=U[1],D=m.useState(!1),L=wue(D,2),j=L[0],B=L[1];_a(function(){B(!0)},[]);var O=j?o:!1,V=m.useRef(),G=m.useRef();_a(function(){O&&(G.current=document.activeElement)},[O]);var q=function(oe){var Z;if(k(oe),v==null||v(oe),!oe&&G.current&&!((Z=V.current)!==null&&Z!==void 0&&Z.contains(G.current))){var te;(te=G.current)===null||te===void 0||te.focus({preventScroll:!0})}},$=m.useMemo(function(){return{panel:E}},[E]);if(!P&&!W&&!O&&T)return null;var ie={onMouseEnter:w,onMouseOver:x,onMouseLeave:b,onClick:R,onKeyDown:H,onKeyUp:F},Q=i2(i2({},e),{},{open:O,prefixCls:i,placement:l,autoFocus:c,keyboard:d,width:p,mask:A,maskClosable:S,inline:C===!1,afterOpenChange:q,ref:V},ie);return m.createElement(BJe.Provider,{value:$},m.createElement(B$,{open:O||P||W,autoDestroy:!1,getContainer:C,autoLock:A&&(O||W)},m.createElement(Njt,Q)))};const jjt=new ba("antSpinMove",{to:{opacity:1}}),Bjt=new ba("antRotate",{to:{transform:"rotate(405deg)"}}),Yjt=t=>{const{componentCls:e,calc:n}=t;return{[`${e}`]:Object.assign(Object.assign({},Na(t)),{position:"absolute",display:"none",color:t.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${t.motionDurationSlow} ${t.motionEaseInOutCirc}`,"&-spinning":{position:"static",display:"inline-block",opacity:1},[`${e}-text`]:{fontSize:t.fontSize,paddingTop:n(n(t.dotSize).sub(t.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:t.colorBgMask,zIndex:t.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${t.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[`${e}-dot ${e}-dot-item`]:{backgroundColor:t.colorWhite},[`${e}-text`]:{color:t.colorTextLightSolid}},"&-nested-loading":{position:"relative",[`> div > ${e}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:t.contentHeight,[`${e}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:n(t.dotSize).mul(-1).div(2).equal()},[`${e}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${t.colorBgContainer}`},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${e}-dot`]:{margin:n(t.dotSizeSM).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeSM).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${e}-dot`]:{margin:n(t.dotSizeLG).mul(-1).div(2).equal()},[`${e}-text`]:{paddingTop:n(n(t.dotSizeLG).sub(t.fontSize)).div(2).add(2).equal()},[`&${e}-show-text ${e}-dot`]:{marginTop:n(t.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${e}-container`]:{position:"relative",transition:`opacity ${t.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:t.colorBgContainer,opacity:0,transition:`all ${t.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${e}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:t.spinDotDefault},[`${e}-dot`]:{position:"relative",display:"inline-block",fontSize:t.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),height:n(t.dotSize).sub(n(t.marginXXS).div(2)).div(2).equal(),backgroundColor:t.colorPrimary,borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:jjt,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:Bjt,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&-sm ${e}-dot`]:{fontSize:t.dotSizeSM,i:{width:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal(),height:n(n(t.dotSizeSM).sub(n(t.marginXXS).div(2))).div(2).equal()}},[`&-lg ${e}-dot`]:{fontSize:t.dotSizeLG,i:{width:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal(),height:n(n(t.dotSizeLG).sub(t.marginXXS)).div(2).equal()}},[`&${e}-show-text ${e}-text`]:{display:"block"}})}},Ojt=t=>{const{controlHeightLG:e,controlHeight:n}=t;return{contentHeight:400,dotSize:e/2,dotSizeSM:e*.35,dotSizeLG:n}},Vjt=wl("Spin",t=>{const e=qi(t,{spinDotDefault:t.colorTextDescription});return[Yjt(e)]},Ojt);var _jt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,spinning:n=!0,delay:o=0,className:r,rootClassName:i,size:a="default",tip:l,wrapperClassName:s,style:c,children:u,fullscreen:d=!1}=t,f=_jt(t,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen"]),{getPrefixCls:p}=m.useContext(Cr),g=p("spin",e),[A,y,S]=Vjt(g),[C,P]=m.useState(()=>n&&!Xjt(n,o));m.useEffect(()=>{if(n){const E=RNt(o,()=>{P(!0)});return E(),()=>{var N;(N=E==null?void 0:E.cancel)===null||N===void 0||N.call(E)}}P(!1)},[o,n]);const v=m.useMemo(()=>typeof u<"u"&&!d,[u,d]),{direction:T,spin:w}=m.useContext(Cr),x=Un(g,w==null?void 0:w.className,{[`${g}-sm`]:a==="small",[`${g}-lg`]:a==="large",[`${g}-spinning`]:C,[`${g}-show-text`]:!!l,[`${g}-fullscreen`]:d,[`${g}-fullscreen-show`]:d&&C,[`${g}-rtl`]:T==="rtl"},r,i,y,S),b=Un(`${g}-container`,{[`${g}-blur`]:C}),R=dp(f,["indicator"]),H=Object.assign(Object.assign({},w==null?void 0:w.style),c),F=m.createElement("div",Object.assign({},R,{style:H,className:x,"aria-live":"polite","aria-busy":C}),Gjt(g,t),l&&(v||d)?m.createElement("div",{className:`${g}-text`},l):null);return A(v?m.createElement("div",Object.assign({},R,{className:Un(`${g}-nested-loading`,s,y,S)}),C&&m.createElement("div",{key:"loading"},F),m.createElement("div",{className:b,key:"container"},u)):F)};tN.setDefaultIndicator=t=>{e_=t};const YJe=t=>{var e,n;const{prefixCls:o,title:r,footer:i,extra:a,loading:l,onClose:s,headerStyle:c,bodyStyle:u,footerStyle:d,children:f,classNames:p,styles:g}=t,{drawer:A}=m.useContext(Cr),y=m.useCallback(w=>m.createElement("button",{type:"button",onClick:s,"aria-label":"Close",className:`${o}-close`},w),[s]),[S,C]=Dme(AR(t),AR(A),{closable:!0,closeIconRender:y});let P;typeof l=="boolean"?P={spinning:l}:typeof l=="object"&&(P=Object.assign({spinning:!0},l));const v=m.useMemo(()=>{var w,x;return!r&&!S?null:m.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(w=A==null?void 0:A.styles)===null||w===void 0?void 0:w.header),c),g==null?void 0:g.header),className:Un(`${o}-header`,{[`${o}-header-close-only`]:S&&!r&&!a},(x=A==null?void 0:A.classNames)===null||x===void 0?void 0:x.header,p==null?void 0:p.header)},m.createElement("div",{className:`${o}-header-title`},C,r&&m.createElement("div",{className:`${o}-title`},r)),a&&m.createElement("div",{className:`${o}-extra`},a))},[S,C,a,c,o,r]),T=m.useMemo(()=>{var w,x;if(!i)return null;const b=`${o}-footer`;return m.createElement("div",{className:Un(b,(w=A==null?void 0:A.classNames)===null||w===void 0?void 0:w.footer,p==null?void 0:p.footer),style:Object.assign(Object.assign(Object.assign({},(x=A==null?void 0:A.styles)===null||x===void 0?void 0:x.footer),d),g==null?void 0:g.footer)},i)},[i,d,o]);return P!=null&&P.spinning?m.createElement(tN,Object.assign({spinning:!1,style:{height:"100%",display:"flex",justifyContent:"center",alignItems:"center"}},P)):m.createElement(m.Fragment,null,v,m.createElement("div",{className:Un(`${o}-body`,p==null?void 0:p.body,(e=A==null?void 0:A.classNames)===null||e===void 0?void 0:e.body),style:Object.assign(Object.assign(Object.assign({},(n=A==null?void 0:A.styles)===null||n===void 0?void 0:n.body),u),g==null?void 0:g.body)},f),T)},Jjt=t=>{const e="100%";return{left:`translateX(-${e})`,right:`translateX(${e})`,top:`translateY(-${e})`,bottom:`translateY(${e})`}[t]},OJe=(t,e)=>({"&-enter, &-appear":Object.assign(Object.assign({},t),{"&-active":e}),"&-leave":Object.assign(Object.assign({},e),{"&-active":t})}),VJe=(t,e)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${e}`}}},OJe({opacity:t},{opacity:1})),Kjt=(t,e)=>[VJe(.7,e),OJe({transform:Jjt(t)},{transform:"none"})],qjt=t=>{const{componentCls:e,motionDurationSlow:n}=t;return{[e]:{[`${e}-mask-motion`]:VJe(0,n),[`${e}-panel-motion`]:["left","right","top","bottom"].reduce((o,r)=>Object.assign(Object.assign({},o),{[`&-${r}`]:Kjt(r,n)}),{})}}},$jt=t=>{const{borderRadiusSM:e,componentCls:n,zIndexPopup:o,colorBgMask:r,colorBgElevated:i,motionDurationSlow:a,motionDurationMid:l,paddingXS:s,padding:c,paddingLG:u,fontSizeLG:d,lineHeightLG:f,lineWidth:p,lineType:g,colorSplit:A,marginXS:y,colorIcon:S,colorIconHover:C,colorBgTextHover:P,colorBgTextActive:v,colorText:T,fontWeightStrong:w,footerPaddingBlock:x,footerPaddingInline:b,calc:R}=t,H=`${n}-content-wrapper`;return{[n]:{position:"fixed",inset:0,zIndex:o,pointerEvents:"none","&-pure":{position:"relative",background:i,display:"flex",flexDirection:"column",[`&${n}-left`]:{boxShadow:t.boxShadowDrawerLeft},[`&${n}-right`]:{boxShadow:t.boxShadowDrawerRight},[`&${n}-top`]:{boxShadow:t.boxShadowDrawerUp},[`&${n}-bottom`]:{boxShadow:t.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${n}-mask`]:{position:"absolute",inset:0,zIndex:o,background:r,pointerEvents:"auto"},[H]:{position:"absolute",zIndex:o,maxWidth:"100vw",transition:`all ${a}`,"&-hidden":{display:"none"}},[`&-left > ${H}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:t.boxShadowDrawerLeft},[`&-right > ${H}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:t.boxShadowDrawerRight},[`&-top > ${H}`]:{top:0,insetInline:0,boxShadow:t.boxShadowDrawerUp},[`&-bottom > ${H}`]:{bottom:0,insetInline:0,boxShadow:t.boxShadowDrawerDown},[`${n}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:i,pointerEvents:"auto"},[`${n}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${jt(c)} ${jt(u)}`,fontSize:d,lineHeight:f,borderBottom:`${jt(p)} ${g} ${A}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${n}-extra`]:{flex:"none"},[`${n}-close`]:Object.assign({display:"inline-flex",width:R(d).add(s).equal(),height:R(d).add(s).equal(),borderRadius:e,justifyContent:"center",alignItems:"center",marginInlineEnd:y,color:S,fontWeight:w,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${l}`,textRendering:"auto","&:hover":{color:C,backgroundColor:P,textDecoration:"none"},"&:active":{backgroundColor:v}},eA(t)),[`${n}-title`]:{flex:1,margin:0,color:T,fontWeight:t.fontWeightStrong,fontSize:d,lineHeight:f},[`${n}-body`]:{flex:1,minWidth:0,minHeight:0,padding:u,overflow:"auto"},[`${n}-footer`]:{flexShrink:0,padding:`${jt(x)} ${jt(b)}`,borderTop:`${jt(p)} ${g} ${A}`},"&-rtl":{direction:"rtl"}}}},Qjt=t=>({zIndexPopup:t.zIndexPopupBase,footerPaddingBlock:t.paddingXS,footerPaddingInline:t.padding}),_Je=wl("Drawer",t=>{const e=qi(t,{});return[$jt(e),qjt(e)]},Qjt);var GJe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{rootClassName:e,width:n,height:o,size:r="default",mask:i=!0,push:a=Zjt,open:l,afterOpenChange:s,onClose:c,prefixCls:u,getContainer:d,style:f,className:p,visible:g,afterVisibleChange:A,maskStyle:y,drawerStyle:S,contentWrapperStyle:C}=t,P=GJe(t,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","style","className","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle"]),{getPopupContainer:v,getPrefixCls:T,direction:w,drawer:x}=m.useContext(Cr),b=T("drawer",u),[R,H,F]=_Je(b),E=d===void 0&&v?()=>v(document.body):d,N=Un({"no-mask":!i,[`${b}-rtl`]:w==="rtl"},e,H,F),U=m.useMemo(()=>n??(r==="large"?736:378),[n,r]),W=m.useMemo(()=>o??(r==="large"?736:378),[o,r]),k={motionName:B9(b,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},D=$=>({motionName:B9(b,`panel-motion-${$}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),L=aGe(),[j,B]=Bw("Drawer",P.zIndex),{classNames:O={},styles:V={}}=P,{classNames:G={},styles:q={}}=x||{};return R(m.createElement(O9,null,m.createElement(vR,{status:!0,override:!0},m.createElement(WW.Provider,{value:B},m.createElement(Ujt,Object.assign({prefixCls:b,onClose:c,maskMotion:k,motion:D},P,{classNames:{mask:Un(O.mask,G.mask),content:Un(O.content,G.content),wrapper:Un(O.wrapper,G.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},V.mask),y),q.mask),content:Object.assign(Object.assign(Object.assign({},V.content),S),q.content),wrapper:Object.assign(Object.assign(Object.assign({},V.wrapper),C),q.wrapper)},open:l??g,mask:i,push:a,width:U,height:W,style:Object.assign(Object.assign({},x==null?void 0:x.style),f),className:Un(x==null?void 0:x.className,p),rootClassName:N,getContainer:E,afterOpenChange:s??A,panelRef:L,zIndex:j}),m.createElement(YJe,Object.assign({prefixCls:b},P,{onClose:c})))))))},eBt=t=>{const{prefixCls:e,style:n,className:o,placement:r="right"}=t,i=GJe(t,["prefixCls","style","className","placement"]),{getPrefixCls:a}=m.useContext(Cr),l=a("drawer",e),[s,c,u]=_Je(l),d=Un(l,`${l}-pure`,`${l}-${r}`,c,u,o);return s(m.createElement("div",{className:d,style:n},m.createElement(YJe,Object.assign({prefixCls:l},i))))};vue._InternalPanelDoNotUseOrYouWillBeFired=eBt;function Wxe(t){return["small","middle","large"].includes(t)}function Nxe(t){return t?typeof t=="number"&&!Number.isNaN(t):!1}const XJe=be.createContext({latestIndex:0}),tBt=XJe.Provider,nBt=t=>{let{className:e,index:n,children:o,split:r,style:i}=t;const{latestIndex:a}=m.useContext(XJe);return o==null?null:m.createElement(m.Fragment,null,m.createElement("div",{className:e,style:i},o),n{var n,o;const{getPrefixCls:r,space:i,direction:a}=m.useContext(Cr),{size:l=(i==null?void 0:i.size)||"small",align:s,className:c,rootClassName:u,children:d,direction:f="horizontal",prefixCls:p,split:g,style:A,wrap:y=!1,classNames:S,styles:C}=t,P=oBt(t,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[v,T]=Array.isArray(l)?l:[l,l],w=Wxe(T),x=Wxe(v),b=Nxe(T),R=Nxe(v),H=Y9(d,{keepEmpty:!0}),F=s===void 0&&f==="horizontal"?"center":s,E=r("space",p),[N,U,W]=z_e(E),k=Un(E,i==null?void 0:i.className,U,`${E}-${f}`,{[`${E}-rtl`]:a==="rtl",[`${E}-align-${F}`]:F,[`${E}-gap-row-${T}`]:w,[`${E}-gap-col-${v}`]:x},c,u,W),D=Un(`${E}-item`,(n=S==null?void 0:S.item)!==null&&n!==void 0?n:(o=i==null?void 0:i.classNames)===null||o===void 0?void 0:o.item);let L=0;const j=H.map((V,G)=>{var q,$;V!=null&&(L=G);const ie=V&&V.key||`${D}-${G}`;return m.createElement(nBt,{className:D,key:ie,index:G,split:g,style:(q=C==null?void 0:C.item)!==null&&q!==void 0?q:($=i==null?void 0:i.styles)===null||$===void 0?void 0:$.item},V)}),B=m.useMemo(()=>({latestIndex:L}),[L]);if(H.length===0)return null;const O={};return y&&(O.flexWrap="wrap"),!x&&R&&(O.columnGap=v),!w&&b&&(O.rowGap=T),N(m.createElement("div",Object.assign({ref:e,className:k,style:Object.assign(Object.assign(Object.assign({},O),i==null?void 0:i.style),A)},P),m.createElement(tBt,{value:B},j)))}),on=rBt;on.Compact=sHt;var iBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{getPopupContainer:e,getPrefixCls:n,direction:o}=m.useContext(Cr),{prefixCls:r,type:i="default",danger:a,disabled:l,loading:s,onClick:c,htmlType:u,children:d,className:f,menu:p,arrow:g,autoFocus:A,overlay:y,trigger:S,align:C,open:P,onOpenChange:v,placement:T,getPopupContainer:w,href:x,icon:b=m.createElement($me,null),title:R,buttonsRender:H=se=>se,mouseEnterDelay:F,mouseLeaveDelay:E,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:k}=t,D=iBt(t,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),L=n("dropdown",r),j=`${L}-button`,B={menu:p,arrow:g,autoFocus:A,align:C,disabled:l,trigger:l?[]:S,onOpenChange:v,getPopupContainer:w||e,mouseEnterDelay:F,mouseLeaveDelay:E,overlayClassName:N,overlayStyle:U,destroyPopupOnHide:W,dropdownRender:k},{compactSize:O,compactItemClassnames:V}=Yw(L,o),G=Un(j,V,f);"overlay"in t&&(B.overlay=y),"open"in t&&(B.open=P),"placement"in t?B.placement=T:B.placement=o==="rtl"?"bottomLeft":"bottomRight";const q=m.createElement(io,{type:i,danger:a,disabled:l,loading:s,onClick:c,htmlType:u,href:x,title:R},d),$=m.createElement(io,{type:i,danger:a,icon:b}),[ie,Q]=H([q,$]);return m.createElement(on.Compact,Object.assign({className:G,size:O,block:!0},D),ie,m.createElement(iQ,Object.assign({},B),Q))};JJe.__ANT_BUTTON=!0;const rA=iQ;rA.Button=JJe;var aBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"question-circle",theme:"outlined"},lBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:aBt}))},Zx=m.forwardRef(lBt);function Uxe(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function BY(t,e,n,o){var r=X_.unstable_batchedUpdates?function(a){X_.unstable_batchedUpdates(n,a)}:n;return t!=null&&t.addEventListener&&t.addEventListener(e,r,o),{remove:function(){t!=null&&t.removeEventListener&&t.removeEventListener(e,r,o)}}}const KJe=function(){const t=Object.assign({},arguments.length<=0?void 0:arguments[0]);for(let e=1;e{const r=n[o];r!==void 0&&(t[o]=r)})}return t};var sBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"}}]},name:"double-left",theme:"outlined"},cBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:sBt}))},jxe=m.forwardRef(cBt),uBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"}}]},name:"double-right",theme:"outlined"},dBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:uBt}))},Bxe=m.forwardRef(dBt),fBt={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},hBt=["10","20","50","100"],pBt=function(e){var n=e.pageSizeOptions,o=n===void 0?hBt:n,r=e.locale,i=e.changeSize,a=e.pageSize,l=e.goButton,s=e.quickGo,c=e.rootPrefixCls,u=e.selectComponentClass,d=e.selectPrefixCls,f=e.disabled,p=e.buildOptionText,g=be.useState(""),A=sn(g,2),y=A[0],S=A[1],C=function(){return!y||Number.isNaN(y)?void 0:Number(y)},P=typeof p=="function"?p:function(U){return"".concat(U," ").concat(r.items_per_page)},v=function(W){i==null||i(Number(W))},T=function(W){S(W.target.value)},w=function(W){l||y===""||(S(""),!(W.relatedTarget&&(W.relatedTarget.className.indexOf("".concat(c,"-item-link"))>=0||W.relatedTarget.className.indexOf("".concat(c,"-item"))>=0))&&(s==null||s(C())))},x=function(W){y!==""&&(W.keyCode===jn.ENTER||W.type==="click")&&(S(""),s==null||s(C()))},b=function(){return o.some(function(W){return W.toString()===a.toString()})?o:o.concat([a.toString()]).sort(function(W,k){var D=Number.isNaN(Number(W))?0:Number(W),L=Number.isNaN(Number(k))?0:Number(k);return D-L})},R="".concat(c,"-options");if(!i&&!s)return null;var H=null,F=null,E=null;if(i&&u){var N=b().map(function(U,W){return be.createElement(u.Option,{key:W,value:U.toString()},P(U))});H=be.createElement(u,{disabled:f,prefixCls:d,showSearch:!1,className:"".concat(R,"-size-changer"),optionLabelProp:"children",popupMatchSelectWidth:!1,value:(a||o[0]).toString(),onChange:v,getPopupContainer:function(W){return W.parentNode},"aria-label":r.page_size,defaultOpen:!1},N)}return s&&(l&&(E=typeof l=="boolean"?be.createElement("button",{type:"button",onClick:x,onKeyUp:x,disabled:f,className:"".concat(R,"-quick-jumper-button")},r.jump_to_confirm):be.createElement("span",{onClick:x,onKeyUp:x},l)),F=be.createElement("div",{className:"".concat(R,"-quick-jumper")},r.jump_to,be.createElement("input",{disabled:f,type:"text",value:y,onChange:T,onKeyUp:x,onBlur:w,"aria-label":r.page}),r.page,E)),be.createElement("li",{className:R},H,F)},Bz=function(e){var n,o=e.rootPrefixCls,r=e.page,i=e.active,a=e.className,l=e.showTitle,s=e.onClick,c=e.onKeyPress,u=e.itemRender,d="".concat(o,"-item"),f=Xn(d,"".concat(d,"-").concat(r),(n={},Jt(n,"".concat(d,"-active"),i),Jt(n,"".concat(d,"-disabled"),!r),n),a),p=function(){s(r)},g=function(S){c(S,s,r)},A=u(r,"page",be.createElement("a",{rel:"nofollow"},r));return A?be.createElement("li",{title:l?String(r):null,className:f,onClick:p,onKeyDown:g,tabIndex:0},A):null},gBt=function(e,n,o){return o};function Yxe(){}function Oxe(t){var e=Number(t);return typeof e=="number"&&!Number.isNaN(e)&&isFinite(e)&&Math.floor(e)===e}function q7(t,e,n){var o=typeof t>"u"?e:t;return Math.floor((n-1)/o)+1}var mBt=function(e){var n,o=e.prefixCls,r=o===void 0?"rc-pagination":o,i=e.selectPrefixCls,a=i===void 0?"rc-select":i,l=e.className,s=e.selectComponentClass,c=e.current,u=e.defaultCurrent,d=u===void 0?1:u,f=e.total,p=f===void 0?0:f,g=e.pageSize,A=e.defaultPageSize,y=A===void 0?10:A,S=e.onChange,C=S===void 0?Yxe:S,P=e.hideOnSinglePage,v=e.showPrevNextJumpers,T=v===void 0?!0:v,w=e.showQuickJumper,x=e.showLessItems,b=e.showTitle,R=b===void 0?!0:b,H=e.onShowSizeChange,F=H===void 0?Yxe:H,E=e.locale,N=E===void 0?fBt:E,U=e.style,W=e.totalBoundaryShowSizeChanger,k=W===void 0?50:W,D=e.disabled,L=e.simple,j=e.showTotal,B=e.showSizeChanger,O=e.pageSizeOptions,V=e.itemRender,G=V===void 0?gBt:V,q=e.jumpPrevIcon,$=e.jumpNextIcon,ie=e.prevIcon,Q=e.nextIcon,se=be.useRef(null),oe=Es(10,{value:g,defaultValue:y}),Z=sn(oe,2),te=Z[0],ee=Z[1],de=Es(1,{value:c,defaultValue:d,postState:function(Ht){return Math.max(1,Math.min(Ht,q7(void 0,te,p)))}}),fe=sn(de,2),pe=fe[0],ye=fe[1],ae=be.useState(pe),Te=sn(ae,2),ge=Te[0],Se=Te[1];m.useEffect(function(){Se(pe)},[pe]);var Re=Math.max(1,pe-(x?3:5)),De=Math.min(q7(void 0,te,p),pe+(x?3:5));function Ae(tt,Ht){var _t=tt||be.createElement("button",{type:"button","aria-label":Ht,className:"".concat(r,"-item-link")});return typeof tt=="function"&&(_t=be.createElement(tt,en({},e))),_t}function ue(tt){var Ht=tt.target.value,_t=q7(void 0,te,p),qt;return Ht===""?qt=Ht:Number.isNaN(Number(Ht))?qt=ge:Ht>=_t?qt=_t:qt=Number(Ht),qt}function he(tt){return Oxe(tt)&&tt!==pe&&Oxe(p)&&p>0}var ve=p>te?w:!1;function we(tt){(tt.keyCode===jn.UP||tt.keyCode===jn.DOWN)&&tt.preventDefault()}function Pe(tt){var Ht=ue(tt);switch(Ht!==ge&&Se(Ht),tt.keyCode){case jn.ENTER:ze(Ht);break;case jn.UP:ze(Ht-1);break;case jn.DOWN:ze(Ht+1);break}}function Ie(tt){ze(ue(tt))}function Me(tt){var Ht=q7(tt,te,p),_t=pe>Ht&&Ht!==0?Ht:pe;ee(tt),Se(_t),F==null||F(pe,tt),ye(_t),C==null||C(_t,tt)}function ze(tt){if(he(tt)&&!D){var Ht=q7(void 0,te,p),_t=tt;return tt>Ht?_t=Ht:tt<1&&(_t=1),_t!==ge&&Se(_t),ye(_t),C==null||C(_t,te),_t}return pe}var Ne=pe>1,Je=pek;function nt(){Ne&&ze(pe-1)}function We(){Je&&ze(pe+1)}function Ee(){ze(Re)}function ke(){ze(De)}function Oe(tt,Ht){if(tt.key==="Enter"||tt.charCode===jn.ENTER||tt.keyCode===jn.ENTER){for(var _t=arguments.length,qt=new Array(_t>2?_t-2:0),un=2;un<_t;un++)qt[un-2]=arguments[un];Ht.apply(void 0,qt)}}function st(tt){Oe(tt,nt)}function je(tt){Oe(tt,We)}function xt(tt){Oe(tt,Ee)}function gt(tt){Oe(tt,ke)}function Ye(tt){var Ht=G(tt,"prev",Ae(ie,"prev page"));return be.isValidElement(Ht)?be.cloneElement(Ht,{disabled:!Ne}):Ht}function it(tt){var Ht=G(tt,"next",Ae(Q,"next page"));return be.isValidElement(Ht)?be.cloneElement(Ht,{disabled:!Je}):Ht}function ut(tt){(tt.type==="click"||tt.keyCode===jn.ENTER)&&ze(ge)}var Qe=null,lt=bf(e,{aria:!0,data:!0}),Ze=j&&be.createElement("li",{className:"".concat(r,"-total-text")},j(p,[p===0?0:(pe-1)*te+1,pe*te>p?p:pe*te])),Be=null,$e=q7(void 0,te,p);if(P&&p<=te)return null;var wt=[],vt={rootPrefixCls:r,onClick:ze,onKeyPress:Oe,showTitle:R,itemRender:G,page:-1},Rt=pe-1>0?pe-1:0,Gt=pe+1<$e?pe+1:$e,At=w&&w.goButton,pt=At,Wt=null;L&&(At&&(typeof At=="boolean"?pt=be.createElement("button",{type:"button",onClick:ut,onKeyUp:ut},N.jump_to_confirm):pt=be.createElement("span",{onClick:ut,onKeyUp:ut},At),pt=be.createElement("li",{title:R?"".concat(N.jump_to).concat(pe,"/").concat($e):null,className:"".concat(r,"-simple-pager")},pt)),Wt=be.createElement("li",{title:R?"".concat(pe,"/").concat($e):null,className:"".concat(r,"-simple-pager")},be.createElement("input",{type:"text",value:ge,disabled:D,onKeyDown:we,onKeyUp:Pe,onChange:Pe,onBlur:Ie,size:3}),be.createElement("span",{className:"".concat(r,"-slash")},"/"),$e));var ht=x?1:2;if($e<=3+ht*2){$e||wt.push(be.createElement(Bz,go({},vt,{key:"noPager",page:1,className:"".concat(r,"-item-disabled")})));for(var ct=1;ct<=$e;ct+=1)wt.push(be.createElement(Bz,go({},vt,{key:ct,page:ct,active:pe===ct})))}else{var It=x?N.prev_3:N.prev_5,Ft=x?N.next_3:N.next_5,Ve=G(Re,"jump-prev",Ae(q,"prev page")),ft=G(De,"jump-next",Ae($,"next page"));T&&(Qe=Ve?be.createElement("li",{title:R?It:null,key:"prev",onClick:Ee,tabIndex:0,onKeyDown:xt,className:Xn("".concat(r,"-jump-prev"),Jt({},"".concat(r,"-jump-prev-custom-icon"),!!q))},Ve):null,Be=ft?be.createElement("li",{title:R?Ft:null,key:"next",onClick:ke,tabIndex:0,onKeyDown:gt,className:Xn("".concat(r,"-jump-next"),Jt({},"".concat(r,"-jump-next-custom-icon"),!!$))},ft):null);var kt=Math.max(1,pe-ht),rt=Math.min(pe+ht,$e);pe-1<=ht&&(rt=1+ht*2),$e-pe<=ht&&(kt=$e-ht*2);for(var at=kt;at<=rt;at+=1)wt.push(be.createElement(Bz,go({},vt,{key:at,page:at,active:pe===at})));if(pe-1>=ht*2&&pe!==3&&(wt[0]=be.cloneElement(wt[0],{className:Xn("".concat(r,"-item-after-jump-prev"),wt[0].props.className)}),wt.unshift(Qe)),$e-pe>=ht*2&&pe!==$e-2){var Ge=wt[wt.length-1];wt[wt.length-1]=be.cloneElement(Ge,{className:Xn("".concat(r,"-item-before-jump-next"),Ge.props.className)}),wt.push(Be)}kt!==1&&wt.unshift(be.createElement(Bz,go({},vt,{key:1,page:1}))),rt!==$e&&wt.push(be.createElement(Bz,go({},vt,{key:$e,page:$e})))}var yt=Ye(Rt);if(yt){var Pt=!Ne||!$e;yt=be.createElement("li",{title:R?N.prev_page:null,onClick:nt,tabIndex:Pt?null:0,onKeyDown:st,className:Xn("".concat(r,"-prev"),Jt({},"".concat(r,"-disabled"),Pt)),"aria-disabled":Pt},yt)}var ot=it(Gt);if(ot){var bt,zt;L?(bt=!Je,zt=Ne?0:null):(bt=!Je||!$e,zt=bt?null:0),ot=be.createElement("li",{title:R?N.next_page:null,onClick:We,tabIndex:zt,onKeyDown:je,className:Xn("".concat(r,"-next"),Jt({},"".concat(r,"-disabled"),bt)),"aria-disabled":bt},ot)}var Bt=Xn(r,l,(n={},Jt(n,"".concat(r,"-simple"),L),Jt(n,"".concat(r,"-disabled"),D),n));return be.createElement("ul",go({className:Bt,style:U,ref:se},lt),Ze,yt,L?Wt:wt,ot,be.createElement(pBt,{locale:N,rootPrefixCls:r,disabled:D,selectComponentClass:s,selectPrefixCls:a,changeSize:Ue?Me:null,pageSize:te,pageSizeOptions:O,quickGo:ve?ze:null,goButton:pt}))};const qJe=t=>m.createElement(Uo,Object.assign({},t,{showSearch:!0,size:"small"})),$Je=t=>m.createElement(Uo,Object.assign({},t,{showSearch:!0,size:"middle"}));qJe.Option=Uo.Option;$Je.Option=Uo.Option;const yBt=t=>{const{componentCls:e}=t;return{[`${e}-disabled`]:{"&, &:hover":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}},"&:focus-visible":{cursor:"not-allowed",[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}},[`&${e}-disabled`]:{cursor:"not-allowed",[`${e}-item`]:{cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},a:{color:t.colorTextDisabled,backgroundColor:"transparent",border:"none",cursor:"not-allowed"},"&-active":{borderColor:t.colorBorder,backgroundColor:t.itemActiveBgDisabled,"&:hover, &:active":{backgroundColor:t.itemActiveBgDisabled},a:{color:t.itemActiveColorDisabled}}},[`${e}-item-link`]:{color:t.colorTextDisabled,cursor:"not-allowed","&:hover, &:active":{backgroundColor:"transparent"},[`${e}-simple&`]:{backgroundColor:"transparent","&:hover, &:active":{backgroundColor:"transparent"}}},[`${e}-simple-pager`]:{color:t.colorTextDisabled},[`${e}-jump-prev, ${e}-jump-next`]:{[`${e}-item-link-icon`]:{opacity:0},[`${e}-item-ellipsis`]:{opacity:1}}},[`&${e}-simple`]:{[`${e}-prev, ${e}-next`]:{[`&${e}-disabled ${e}-item-link`]:{"&:hover, &:active":{backgroundColor:"transparent"}}}}}},ABt=t=>{const{componentCls:e}=t;return{[`&${e}-mini ${e}-total-text, &${e}-mini ${e}-simple-pager`]:{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-item`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.calc(t.itemSizeSM).sub(2).equal())},[`&${e}-mini:not(${e}-disabled) ${e}-item:not(${e}-item-active)`]:{backgroundColor:"transparent",borderColor:"transparent","&:hover":{backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},[`&${e}-mini ${e}-prev, &${e}-mini ${e}-next`]:{minWidth:t.itemSizeSM,height:t.itemSizeSM,margin:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini:not(${e}-disabled)`]:{[`${e}-prev, ${e}-next`]:{[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover ${e}-item-link`]:{backgroundColor:"transparent"}}},[` &${e}-mini ${e}-prev ${e}-item-link, &${e}-mini ${e}-next ${e}-item-link `]:{backgroundColor:"transparent",borderColor:"transparent","&::after":{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM)}},[`&${e}-mini ${e}-jump-prev, &${e}-mini ${e}-jump-next`]:{height:t.itemSizeSM,marginInlineEnd:0,lineHeight:jt(t.itemSizeSM)},[`&${e}-mini ${e}-options`]:{marginInlineStart:t.paginationMiniOptionsMarginInlineStart,"&-size-changer":{top:t.miniOptionsSizeChangerTop},"&-quick-jumper":{height:t.itemSizeSM,lineHeight:jt(t.itemSizeSM),input:Object.assign(Object.assign({},cye(t)),{width:t.paginationMiniQuickJumperInputWidth,height:t.controlHeightSM})}}}},wBt=t=>{const{componentCls:e}=t;return{[` @@ -4644,7 +4644,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${e}-next, ${e}-jump-prev, ${e}-jump-next - `]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,color:t.colorText,fontFamily:t.fontFamily,lineHeight:`${jt(t.itemSize)}`,textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:t.borderRadius,cursor:"pointer",transition:`all ${t.motionDurationMid}`},[`${e}-prev, ${e}-next`]:{fontFamily:"Arial, Helvetica, sans-serif",outline:0,button:{color:t.colorText,cursor:"pointer",userSelect:"none"},[`${e}-item-link`]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:t.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:"none",transition:`all ${t.motionDurationMid}`},[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover`]:{[`${e}-item-link`]:{backgroundColor:"transparent"}}},[`${e}-slash`]:{marginInlineEnd:t.paginationSlashMarginInlineEnd,marginInlineStart:t.paginationSlashMarginInlineStart},[`${e}-options`]:{display:"inline-block",marginInlineStart:t.margin,verticalAlign:"middle","&-size-changer.-select":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:t.controlHeight,marginInlineStart:t.marginXS,lineHeight:jt(t.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},eN(t)),rye(t,{borderColor:t.colorBorder,hoverBorderColor:t.colorPrimaryHover,activeBorderColor:t.colorPrimary,activeShadow:t.activeShadow})),{"&[disabled]":Object.assign({},dQ(t)),width:t.calc(t.controlHeightLG).mul(1.25).equal(),height:t.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:t.marginXS,marginInlineEnd:t.marginXS})}}}},xBt=t=>{const{componentCls:e}=t;return{[`${e}-item`]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,marginInlineEnd:t.marginXS,fontFamily:t.fontFamily,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${jt(t.paginationItemPaddingInline)}`,color:t.colorText,"&:hover":{textDecoration:"none"}},[`&:not(${e}-item-active)`]:{"&:hover":{transition:`all ${t.motionDurationMid}`,backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},"&-active":{fontWeight:t.fontWeightStrong,backgroundColor:t.itemActiveBg,borderColor:t.colorPrimary,a:{color:t.colorPrimary},"&:hover":{borderColor:t.colorPrimaryHover},"&:hover a":{color:t.colorPrimaryHover}}}}},bBt=t=>{const{componentCls:e}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${e}-total-text`]:{display:"inline-block",height:t.itemSize,marginInlineEnd:t.marginXS,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),verticalAlign:"middle"}}),xBt(t)),vBt(t)),wBt(t)),ABt(t)),yBt(t)),{[`@media only screen and (max-width: ${t.screenLG}px)`]:{[`${e}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${t.screenSM}px)`]:{[`${e}-options`]:{display:"none"}}}),[`&${t.componentCls}-rtl`]:{direction:"rtl"}}},SBt=t=>{const{componentCls:e}=t;return{[`${e}:not(${e}-disabled)`]:{[`${e}-item`]:Object.assign({},eA(t)),[`${e}-jump-prev, ${e}-jump-next`]:{"&:focus-visible":Object.assign({[`${e}-item-link-icon`]:{opacity:1},[`${e}-item-ellipsis`]:{opacity:0}},dw(t))},[`${e}-prev, ${e}-next`]:{[`&:focus-visible ${e}-item-link`]:Object.assign({},dw(t))}}}},QJe=t=>Object.assign({itemBg:t.colorBgContainer,itemSize:t.controlHeight,itemSizeSM:t.controlHeightSM,itemActiveBg:t.colorBgContainer,itemLinkBg:t.colorBgContainer,itemActiveColorDisabled:t.colorTextDisabled,itemActiveBgDisabled:t.controlItemBgActiveDisabled,itemInputBg:t.colorBgContainer,miniOptionsSizeChangerTop:0},ZW(t)),ZJe=t=>qi(t,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:t.calc(t.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:t.calc(t.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:t.calc(t.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:t.calc(t.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:t.marginXXS,paginationSlashMarginInlineEnd:t.marginSM,paginationEllipsisTextIndent:"0.13em"},QW(t)),TBt=wl("Pagination",t=>{const e=ZJe(t);return[bBt(e),SBt(e)]},QJe),PBt=t=>{const{componentCls:e}=t;return{[`${e}${e}-bordered${e}-disabled:not(${e}-mini)`]:{"&, &:hover":{[`${e}-item-link`]:{borderColor:t.colorBorder}},"&:focus-visible":{[`${e}-item-link`]:{borderColor:t.colorBorder}},[`${e}-item, ${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,[`&:hover:not(${e}-item-active)`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,a:{color:t.colorTextDisabled}},[`&${e}-item-active`]:{backgroundColor:t.itemActiveBgDisabled}},[`${e}-prev, ${e}-next`]:{"&:hover button":{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,color:t.colorTextDisabled},[`${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder}}},[`${e}${e}-bordered:not(${e}-mini)`]:{[`${e}-prev, ${e}-next`]:{"&:hover button":{borderColor:t.colorPrimaryHover,backgroundColor:t.itemBg},[`${e}-item-link`]:{backgroundColor:t.itemLinkBg,borderColor:t.colorBorder},[`&:hover ${e}-item-link`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,color:t.colorPrimary},[`&${e}-disabled`]:{[`${e}-item-link`]:{borderColor:t.colorBorder,color:t.colorTextDisabled}}},[`${e}-item`]:{backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,[`&:hover:not(${e}-item-active)`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,a:{color:t.colorPrimary}},"&-active":{borderColor:t.colorPrimary}}}}},CBt=LW(["Pagination","bordered"],t=>{const e=ZJe(t);return[PBt(e)]},QJe);var RBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,selectPrefixCls:n,className:o,rootClassName:r,style:i,size:a,locale:l,selectComponentClass:s,responsive:c,showSizeChanger:u}=t,d=RBt(t,["prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","selectComponentClass","responsive","showSizeChanger"]),{xs:f}=Q$(c),[,p]=Vu(),{getPrefixCls:g,direction:A,pagination:y={}}=m.useContext(Cr),S=g("pagination",e),[C,P,v]=TBt(S),T=u??y.showSizeChanger,w=m.useMemo(()=>{const U=m.createElement("span",{className:`${S}-item-ellipsis`},"•••"),W=m.createElement("button",{className:`${S}-item-link`,type:"button",tabIndex:-1},A==="rtl"?m.createElement(YG,null):m.createElement(Zve,null)),k=m.createElement("button",{className:`${S}-item-link`,type:"button",tabIndex:-1},A==="rtl"?m.createElement(Zve,null):m.createElement(YG,null)),D=m.createElement("a",{className:`${S}-item-link`},m.createElement("div",{className:`${S}-item-container`},A==="rtl"?m.createElement(Bxe,{className:`${S}-item-link-icon`}):m.createElement(jxe,{className:`${S}-item-link-icon`}),U)),L=m.createElement("a",{className:`${S}-item-link`},m.createElement("div",{className:`${S}-item-container`},A==="rtl"?m.createElement(jxe,{className:`${S}-item-link-icon`}):m.createElement(Bxe,{className:`${S}-item-link-icon`}),U));return{prevIcon:W,nextIcon:k,jumpPrevIcon:D,jumpNextIcon:L}},[A,S]),[x]=Uw("Pagination",wVe),b=Object.assign(Object.assign({},x),l),R=zd(a),H=R==="small"||!!(f&&!R&&c),F=g("select",n),E=Un({[`${S}-mini`]:H,[`${S}-rtl`]:A==="rtl",[`${S}-bordered`]:p.wireframe},y==null?void 0:y.className,o,r,P,v),N=Object.assign(Object.assign({},y==null?void 0:y.style),i);return C(m.createElement(m.Fragment,null,p.wireframe&&m.createElement(CBt,{prefixCls:S}),m.createElement(mBt,Object.assign({},w,d,{style:N,prefixCls:S,selectPrefixCls:F,className:E,selectComponentClass:s||(H?qJe:$Je),locale:b,showSizeChanger:T}))))},yye=be.createContext({});yye.Consumer;var tKe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{prefixCls:e,className:n,avatar:o,title:r,description:i}=t,a=tKe(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:l}=m.useContext(Cr),s=l("list",e),c=Un(`${s}-item-meta`,n),u=be.createElement("div",{className:`${s}-item-meta-content`},r&&be.createElement("h4",{className:`${s}-item-meta-title`},r),i&&be.createElement("div",{className:`${s}-item-meta-description`},i));return be.createElement("div",Object.assign({},a,{className:c}),o&&be.createElement("div",{className:`${s}-item-meta-avatar`},o),(r||i)&&u)},MBt=be.forwardRef((t,e)=>{const{prefixCls:n,children:o,actions:r,extra:i,className:a,colStyle:l}=t,s=tKe(t,["prefixCls","children","actions","extra","className","colStyle"]),{grid:c,itemLayout:u}=m.useContext(yye),{getPrefixCls:d}=m.useContext(Cr),f=()=>{let C;return m.Children.forEach(o,P=>{typeof P=="string"&&(C=!0)}),C&&m.Children.count(o)>1},p=()=>u==="vertical"?!!i:!f(),g=d("list",n),A=r&&r.length>0&&be.createElement("ul",{className:`${g}-item-action`,key:"actions"},r.map((C,P)=>be.createElement("li",{key:`${g}-item-action-${P}`},C,P!==r.length-1&&be.createElement("em",{className:`${g}-item-action-split`})))),y=c?"div":"li",S=be.createElement(y,Object.assign({},s,c?{}:{ref:e},{className:Un(`${g}-item`,{[`${g}-item-no-flex`]:!p()},a)}),u==="vertical"&&i?[be.createElement("div",{className:`${g}-item-main`,key:"content"},o,A),be.createElement("div",{className:`${g}-item-extra`,key:"extra"},i)]:[o,A,j0(i,{key:"extra"})]);return c?be.createElement(Ke,{ref:e,flex:1,style:l},S):S}),nKe=MBt;nKe.Meta=HBt;const IBt=t=>{const{listBorderedCls:e,componentCls:n,paddingLG:o,margin:r,itemPaddingSM:i,itemPaddingLG:a,marginLG:l,borderRadiusLG:s}=t;return{[`${e}`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:s,[`${n}-header,${n}-footer,${n}-item`]:{paddingInline:o},[`${n}-pagination`]:{margin:`${jt(r)} ${jt(l)}`}},[`${e}${n}-sm`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:i}},[`${e}${n}-lg`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:a}}}},zBt=t=>{const{componentCls:e,screenSM:n,screenMD:o,marginLG:r,marginSM:i,margin:a}=t;return{[`@media screen and (max-width:${o}px)`]:{[`${e}`]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:r}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:r}}}},[`@media screen and (max-width: ${n}px)`]:{[`${e}`]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:i}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${jt(a)}`}}}}}},DBt=t=>{const{componentCls:e,antCls:n,controlHeight:o,minHeight:r,paddingSM:i,marginLG:a,padding:l,itemPadding:s,colorPrimary:c,itemPaddingSM:u,itemPaddingLG:d,paddingXS:f,margin:p,colorText:g,colorTextDescription:A,motionDurationSlow:y,lineWidth:S,headerBg:C,footerBg:P,emptyTextPadding:v,metaMarginBottom:T,avatarMarginRight:w,titleMarginBottom:x,descriptionFontSize:b}=t,R={};return["start","center","end"].forEach(H=>{R[`&-align-${H}`]={textAlign:H}}),{[`${e}`]:Object.assign(Object.assign({},Na(t)),{position:"relative","*":{outline:"none"},[`${e}-header`]:{background:C},[`${e}-footer`]:{background:P},[`${e}-header, ${e}-footer`]:{paddingBlock:i},[`${e}-pagination`]:Object.assign(Object.assign({marginBlockStart:a},R),{[`${n}-pagination-options`]:{textAlign:"start"}}),[`${e}-spin`]:{minHeight:r,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:g,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:w},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:g},[`${e}-item-meta-title`]:{margin:`0 0 ${jt(t.marginXXS)} 0`,color:g,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:g,transition:`all ${y}`,"&:hover":{color:c}}},[`${e}-item-meta-description`]:{color:A,fontSize:b,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${jt(f)}`,color:A,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:S,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${jt(l)} 0`,color:A,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:v,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${n}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:a},[`${e}-item-meta`]:{marginBlockEnd:T,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:x,color:g,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:`0 ${jt(l)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:o},[`${e}-split${e}-something-after-last-item ${n}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:d},[`${e}-sm ${e}-item`]:{padding:u},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},EBt=t=>({contentWidth:220,itemPadding:`${jt(t.paddingContentVertical)} 0`,itemPaddingSM:`${jt(t.paddingContentVerticalSM)} ${jt(t.paddingContentHorizontal)}`,itemPaddingLG:`${jt(t.paddingContentVerticalLG)} ${jt(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),FBt=wl("List",t=>{const e=qi(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[DBt(e),IBt(e),zBt(e)]},EBt);var kBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r(De,Ae)=>{var ue;b(De),H(Ae),n&&n[Re]&&((ue=n==null?void 0:n[Re])===null||ue===void 0||ue.call(n,De,Ae))},D=k("onChange"),L=k("onShowSizeChange"),j=(Re,De)=>{if(!P)return null;let Ae;return typeof C=="function"?Ae=C(Re):C?Ae=Re[C]:Ae=Re.key,Ae||(Ae=`list-item-${De}`),m.createElement(m.Fragment,{key:Ae},P(Re,De))},B=()=>!!(d||n||y),O=F("list",o),[V,G,q]=FBt(O);let $=S;typeof $=="boolean"&&($={spinning:$});const ie=$&&$.spinning,Q=zd(g);let se="";switch(Q){case"large":se="lg";break;case"small":se="sm";break}const Z=Un(O,{[`${O}-vertical`]:u==="vertical",[`${O}-${se}`]:se,[`${O}-split`]:i,[`${O}-bordered`]:r,[`${O}-loading`]:ie,[`${O}-grid`]:!!f,[`${O}-something-after-last-item`]:B(),[`${O}-rtl`]:N==="rtl"},U==null?void 0:U.className,a,l,G,q),ee=KJe(W,{total:p.length,current:x,pageSize:R},n||{}),te=Math.ceil(ee.total/ee.pageSize);ee.current>te&&(ee.current=te);const oe=n?m.createElement("div",{className:Un(`${O}-pagination`,`${O}-pagination-align-${(e=ee==null?void 0:ee.align)!==null&&e!==void 0?e:"end"}`)},m.createElement(eKe,Object.assign({},ee,{onChange:D,onShowSizeChange:L}))):null;let de=Qa(p);n&&p.length>(ee.current-1)*ee.pageSize&&(de=Qa(p).splice((ee.current-1)*ee.pageSize,ee.pageSize));const he=Object.keys(f||{}).some(Re=>["xs","sm","md","lg","xl","xxl"].includes(Re)),pe=Q$(he),me=m.useMemo(()=>{for(let Re=0;Re{if(!f)return;const Re=me&&f[me]?f[me]:f.column;if(Re)return{width:`${100/Re}%`,maxWidth:`${100/Re}%`}},[JSON.stringify(f),me]);let Te=ie&&m.createElement("div",{style:{minHeight:53}});if(de.length>0){const Re=de.map((De,Ae)=>j(De,Ae));Te=f?m.createElement(nn,{gutter:f.gutter},m.Children.map(Re,De=>m.createElement("div",{key:De==null?void 0:De.key,style:le},De))):m.createElement("ul",{className:`${O}-items`},Re)}else!c&&!ie&&(Te=m.createElement("div",{className:`${O}-empty-text`},v&&v.emptyText||(E==null?void 0:E("List"))||m.createElement(jme,{componentName:"List"})));const ge=ee.position||"bottom",Se=m.useMemo(()=>({grid:f,itemLayout:u}),[JSON.stringify(f),u]);return V(m.createElement(yye.Provider,{value:Se},m.createElement("div",Object.assign({style:Object.assign(Object.assign({},U==null?void 0:U.style),s),className:Z},T),(ge==="top"||ge==="both")&&oe,A&&m.createElement("div",{className:`${O}-header`},A),m.createElement(tN,Object.assign({},$),Te,c),y&&m.createElement("div",{className:`${O}-footer`},y),d||(ge==="bottom"||ge==="both")&&oe)))}gk.Item=nKe;let Pm=null,_v=t=>t(),mk=[],yk={};function Vxe(){const{getContainer:t,duration:e,rtl:n,maxCount:o,top:r}=yk,i=(t==null?void 0:t())||document.body;return{getContainer:()=>i,duration:e,rtl:n,maxCount:o,top:r}}const LBt=be.forwardRef((t,e)=>{const{messageConfig:n,sync:o}=t,{getPrefixCls:r}=m.useContext(Cr),i=yk.prefixCls||r("message"),a=m.useContext(ZIt),[l,s]=H_e(Object.assign(Object.assign(Object.assign({},n),{prefixCls:i}),a.message));return be.useImperativeHandle(e,()=>{const c=Object.assign({},l);return Object.keys(c).forEach(u=>{c[u]=function(){return o(),l[u].apply(l,arguments)}}),{instance:c,sync:o}}),s}),WBt=be.forwardRef((t,e)=>{const[n,o]=be.useState(Vxe),r=()=>{o(Vxe)};be.useEffect(r,[]);const i=u_e(),a=i.getRootPrefixCls(),l=i.getIconPrefixCls(),s=i.getTheme(),c=be.createElement(LBt,{ref:e,sync:r,messageConfig:n});return be.createElement(fy,{prefixCls:a,iconPrefixCls:l,theme:s},i.holderRender?i.holderRender(c):c)});function mQ(){if(!Pm){const t=document.createDocumentFragment(),e={fragment:t};Pm=e,_v(()=>{Hme(be.createElement(WBt,{ref:n=>{const{instance:o,sync:r}=n||{};Promise.resolve().then(()=>{!e.instance&&o&&(e.instance=o,e.sync=r,mQ())})}}),t)});return}Pm.instance&&(mk.forEach(t=>{const{type:e,skipped:n}=t;if(!n)switch(e){case"open":{_v(()=>{const o=Pm.instance.open(Object.assign(Object.assign({},yk),t.config));o==null||o.then(t.resolve),t.setCloseFn(o)});break}case"destroy":_v(()=>{Pm==null||Pm.instance.destroy(t.key)});break;default:_v(()=>{var o;const r=(o=Pm.instance)[e].apply(o,Qa(t.args));r==null||r.then(t.resolve),t.setCloseFn(r)})}}),mk=[])}function NBt(t){yk=Object.assign(Object.assign({},yk),t),_v(()=>{var e;(e=Pm==null?void 0:Pm.sync)===null||e===void 0||e.call(Pm)})}function UBt(t){const e=Rme(n=>{let o;const r={type:"open",config:t,resolve:n,setCloseFn:i=>{o=i}};return mk.push(r),()=>{o?_v(()=>{o()}):r.skipped=!0}});return mQ(),e}function jBt(t,e){const n=Rme(o=>{let r;const i={type:t,args:e,resolve:o,setCloseFn:a=>{r=a}};return mk.push(i),()=>{r?_v(()=>{r()}):i.skipped=!0}});return mQ(),n}const BBt=t=>{mk.push({type:"destroy",key:t}),mQ()},YBt=["success","info","warning","error","loading"],OBt={open:UBt,destroy:BBt,config:NBt,useMessage:WRt,_InternalPanelDoNotUseOrYouWillBeFired:MRt},iA=OBt;YBt.forEach(t=>{iA[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o{const{prefixCls:e,className:n,closeIcon:o,closable:r,type:i,title:a,children:l,footer:s}=t,c=VBt(t,["prefixCls","className","closeIcon","closable","type","title","children","footer"]),{getPrefixCls:u}=m.useContext(Cr),d=u(),f=e||u("modal"),p=Y0(d),[g,A,y]=dGe(f,p),S=`${f}-confirm`;let C={};return i?C={closable:r??!1,title:"",footer:"",children:m.createElement(hGe,Object.assign({},t,{prefixCls:f,confirmPrefixCls:S,rootPrefixCls:d,content:l}))}:C={closable:r??!0,title:a,footer:s!==null&&m.createElement(sGe,Object.assign({},t)),children:l},g(m.createElement(__e,Object.assign({prefixCls:f,className:Un(A,`${f}-pure-panel`,i&&S,i&&`${S}-${i}`,n,y,p)},c,{closeIcon:lGe(f,o),closable:r},C)))},GBt=bGe(_Bt);function oKe(t){return GW(yGe(t))}const yi=fGe;yi.useModal=QIt;yi.info=function(e){return GW(AGe(e))};yi.success=function(e){return GW(wGe(e))};yi.error=function(e){return GW(vGe(e))};yi.warning=oKe;yi.warn=oKe;yi.confirm=function(e){return GW(xGe(e))};yi.destroyAll=function(){for(;Yv.length;){const e=Yv.pop();e&&e()}};yi.config=XIt;yi._InternalPanelDoNotUseOrYouWillBeFired=GBt;var XBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},JBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:XBt}))},Rf=m.forwardRef(JBt);function xue(t,e,n){return(t-e)/(n-e)}function Aye(t,e,n,o){var r=xue(e,n,o),i={};switch(t){case"rtl":i.right="".concat(r*100,"%"),i.transform="translateX(50%)";break;case"btt":i.bottom="".concat(r*100,"%"),i.transform="translateY(50%)";break;case"ttb":i.top="".concat(r*100,"%"),i.transform="translateY(-50%)";break;default:i.left="".concat(r*100,"%"),i.transform="translateX(-50%)";break}return i}function rC(t,e){return Array.isArray(t)?t[e]:t}var _b=m.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),KBt=["prefixCls","value","valueIndex","onStartMove","style","render","dragging","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],_xe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.value,r=t.valueIndex,i=t.onStartMove,a=t.style,l=t.render,s=t.dragging,c=t.onOffsetChange,u=t.onChangeComplete,d=t.onFocus,f=t.onMouseEnter,p=oi(t,KBt),g=m.useContext(_b),A=g.min,y=g.max,S=g.direction,C=g.disabled,P=g.keyboard,v=g.range,T=g.tabIndex,w=g.ariaLabelForHandle,x=g.ariaLabelledByForHandle,b=g.ariaValueTextFormatterForHandle,R=g.styles,H=g.classNames,F="".concat(n,"-handle"),E=function(V){C||i(V,r)},N=function(V){d==null||d(V,r)},U=function(V){f(V,r)},W=function(V){if(!C&&P){var G=null;switch(V.which||V.keyCode){case jn.LEFT:G=S==="ltr"||S==="btt"?-1:1;break;case jn.RIGHT:G=S==="ltr"||S==="btt"?1:-1;break;case jn.UP:G=S!=="ttb"?1:-1;break;case jn.DOWN:G=S!=="ttb"?-1:1;break;case jn.HOME:G="min";break;case jn.END:G="max";break;case jn.PAGE_UP:G=2;break;case jn.PAGE_DOWN:G=-2;break}G!==null&&(V.preventDefault(),c(G,r))}},k=function(V){switch(V.which||V.keyCode){case jn.LEFT:case jn.RIGHT:case jn.UP:case jn.DOWN:case jn.HOME:case jn.END:case jn.PAGE_UP:case jn.PAGE_DOWN:u==null||u();break}},D=Aye(S,o,A,y),L={};if(r!==null){var j;L={tabIndex:C?null:rC(T,r),role:"slider","aria-valuemin":A,"aria-valuemax":y,"aria-valuenow":o,"aria-disabled":C,"aria-label":rC(w,r),"aria-labelledby":rC(x,r),"aria-valuetext":(j=rC(b,r))===null||j===void 0?void 0:j(o),"aria-orientation":S==="ltr"||S==="rtl"?"horizontal":"vertical",onMouseDown:E,onTouchStart:E,onFocus:N,onMouseEnter:U,onKeyDown:W,onKeyUp:k}}var B=m.createElement("div",go({ref:e,className:Xn(F,Jt(Jt({},"".concat(F,"-").concat(r+1),r!==null&&v),"".concat(F,"-dragging"),s),H.handle),style:en(en(en({},D),a),R.handle)},L,p));return l&&(B=l(B,{index:r,prefixCls:n,value:o,dragging:s})),B}),qBt=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","onFocus"],$Bt=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.onStartMove,i=t.onOffsetChange,a=t.values,l=t.handleRender,s=t.activeHandleRender,c=t.draggingIndex,u=t.onFocus,d=oi(t,qBt),f=m.useRef({});m.useImperativeHandle(e,function(){return{focus:function(T){var w;(w=f.current[T])===null||w===void 0||w.focus()}}});var p=m.useState(-1),g=sn(p,2),A=g[0],y=g[1],S=function(T,w){y(w),u==null||u(T)},C=function(T,w){y(w)},P=en({prefixCls:n,onStartMove:r,onOffsetChange:i,render:l,onFocus:S,onMouseEnter:C},d);return m.createElement(m.Fragment,null,a.map(function(v,T){return m.createElement(_xe,go({ref:function(x){x?f.current[T]=x:delete f.current[T]},dragging:c===T,style:rC(o,T),key:T,value:v,valueIndex:T},P))}),s&&m.createElement(_xe,go({key:"a11y"},P,{value:a[A],valueIndex:null,dragging:c!==-1,render:s,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),QBt=function(e){var n=e.prefixCls,o=e.style,r=e.children,i=e.value,a=e.onClick,l=m.useContext(_b),s=l.min,c=l.max,u=l.direction,d=l.includedStart,f=l.includedEnd,p=l.included,g="".concat(n,"-text"),A=Aye(u,i,s,c);return m.createElement("span",{className:Xn(g,Jt({},"".concat(g,"-active"),p&&d<=i&&i<=f)),style:en(en({},A),o),onMouseDown:function(S){S.stopPropagation()},onClick:function(){a(i)}},r)},ZBt=function(e){var n=e.prefixCls,o=e.marks,r=e.onClick,i="".concat(n,"-mark");return o.length?m.createElement("div",{className:i},o.map(function(a){var l=a.value,s=a.style,c=a.label;return m.createElement(QBt,{key:l,prefixCls:i,style:s,value:l,onClick:r},c)})):null},eYt=function(e){var n=e.prefixCls,o=e.value,r=e.style,i=e.activeStyle,a=m.useContext(_b),l=a.min,s=a.max,c=a.direction,u=a.included,d=a.includedStart,f=a.includedEnd,p="".concat(n,"-dot"),g=u&&d<=o&&o<=f,A=en(en({},Aye(c,o,l,s)),typeof r=="function"?r(o):r);return g&&(A=en(en({},A),typeof i=="function"?i(o):i)),m.createElement("span",{className:Xn(p,Jt({},"".concat(p,"-active"),g)),style:A})},tYt=function(e){var n=e.prefixCls,o=e.marks,r=e.dots,i=e.style,a=e.activeStyle,l=m.useContext(_b),s=l.min,c=l.max,u=l.step,d=m.useMemo(function(){var f=new Set;if(o.forEach(function(g){f.add(g.value)}),r&&u!==null)for(var p=s;p<=c;)f.add(p),p+=u;return Array.from(f)},[s,c,u,r,o]);return m.createElement("div",{className:"".concat(n,"-step")},d.map(function(f){return m.createElement(eYt,{prefixCls:n,key:f,value:f,style:i,activeStyle:a})}))},Gxe=function(e){var n=e.prefixCls,o=e.style,r=e.start,i=e.end,a=e.index,l=e.onStartMove,s=e.replaceCls,c=m.useContext(_b),u=c.direction,d=c.min,f=c.max,p=c.disabled,g=c.range,A=c.classNames,y="".concat(n,"-track"),S=xue(r,d,f),C=xue(i,d,f),P=function(x){!p&&l&&l(x,-1)},v={};switch(u){case"rtl":v.right="".concat(S*100,"%"),v.width="".concat(C*100-S*100,"%");break;case"btt":v.bottom="".concat(S*100,"%"),v.height="".concat(C*100-S*100,"%");break;case"ttb":v.top="".concat(S*100,"%"),v.height="".concat(C*100-S*100,"%");break;default:v.left="".concat(S*100,"%"),v.width="".concat(C*100-S*100,"%")}var T=s||Xn(y,Jt(Jt({},"".concat(y,"-").concat(a+1),a!==null&&g),"".concat(n,"-track-draggable"),l),A.track);return m.createElement("div",{className:T,style:en(en({},v),o),onMouseDown:P,onTouchStart:P})},nYt=function(e){var n=e.prefixCls,o=e.style,r=e.values,i=e.startPoint,a=e.onStartMove,l=m.useContext(_b),s=l.included,c=l.range,u=l.min,d=l.styles,f=l.classNames,p=m.useMemo(function(){if(!c){if(r.length===0)return[];var A=i??u,y=r[0];return[{start:Math.min(A,y),end:Math.max(A,y)}]}for(var S=[],C=0;C3&&arguments[3]!==void 0?arguments[3]:"unit";if(typeof A=="number"){var C,P=g[y],v=P+A,T=[];o.forEach(function(H){T.push(H.value)}),T.push(t,e),T.push(l(P));var w=A>0?1:-1;S==="unit"?T.push(l(P+w*n)):T.push(l(v)),T=T.filter(function(H){return H!==null}).filter(function(H){return A<0?H<=P:H>=P}),S==="unit"&&(T=T.filter(function(H){return H!==P}));var x=S==="unit"?P:v;C=T[0];var b=Math.abs(C-x);if(T.forEach(function(H){var F=Math.abs(H-x);F1){var R=No(g);return R[y]=C,p(R,A-w,y,S)}return C}else{if(A==="min")return t;if(A==="max")return e}},u=function(g,A,y){var S=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unit",C=g[y],P=c(g,A,y,S);return{value:P,changed:P!==C}},d=function(g){return i===null&&g===0||typeof i=="number"&&g3&&arguments[3]!==void 0?arguments[3]:"unit",C=g.map(s),P=C[y],v=c(C,A,y,S);if(C[y]=v,r===!1){var T=i||0;y>0&&C[y-1]!==P&&(C[y]=Math.max(C[y],C[y-1]+T)),y0;R-=1)for(var H=!0;d(C[R]-C[R-1])&&H;){var F=u(C,-1,R-1);C[R-1]=F.value,H=F.changed}for(var E=C.length-1;E>0;E-=1)for(var N=!0;d(C[E]-C[E-1])&&N;){var U=u(C,-1,E-1);C[E-1]=U.value,N=U.changed}for(var W=0;W=0?k:!1},[k,De]),ue=m.useMemo(function(){return Object.keys(se||{}).map(function(ct){var It=se[ct],Ft={value:Number(ct)};return It&&hi(It)==="object"&&!m.isValidElement(It)&&("label"in It||"style"in It)?(Ft.style=It.style,Ft.label=It.label):Ft.label=It,Ft}).filter(function(ct){var It=ct.label;return It||typeof It=="number"}).sort(function(ct,It){return ct.value-It.value})},[se]),fe=rYt(Se,Re,De,ue,U,Ae),ve=sn(fe,2),we=ve[0],Pe=ve[1],Ie=Es(w,{value:T}),Me=sn(Ie,2),ze=Me[0],Ne=Me[1],Je=m.useMemo(function(){var ct=ze==null?[]:Array.isArray(ze)?ze:[ze],It=sn(ct,1),Ft=It[0],Ve=Ft===void 0?Se:Ft,ft=ze===null?[]:[Ve];if(x){if(ft=No(ct),b||ze===void 0){var kt=b>=0?b+1:2;for(ft=ft.slice(0,kt);ft.length=0&&le.current.focus(ct)}Ze(null)},[lt]);var $e=m.useMemo(function(){return D&&De===null?!1:D},[D,De]),wt=function(It,Ft){gt(It,Ft),H==null||H(nt(Ue.current))},vt=st!==-1;m.useEffect(function(){if(!vt){var ct=Je.lastIndexOf(je);le.current.focus(ct)}},[vt]);var Rt=m.useMemo(function(){return No(xt).sort(function(ct,It){return ct-It})},[xt]),Gt=m.useMemo(function(){return x?[Rt[0],Rt[Rt.length-1]]:[Se,Rt[0]]},[Rt,x,Se]),At=sn(Gt,2),pt=At[0],Wt=At[1];m.useImperativeHandle(e,function(){return{focus:function(){le.current.focus(0)},blur:function(){var It,Ft=document,Ve=Ft.activeElement;(It=Te.current)!==null&&It!==void 0&&It.contains(Ve)&&(Ve==null||Ve.blur())}}}),m.useEffect(function(){f&&le.current.focus(0)},[]);var ht=m.useMemo(function(){return{min:Se,max:Re,direction:ge,disabled:c,keyboard:d,step:De,included:O,includedStart:pt,includedEnd:Wt,range:x,tabIndex:de,ariaLabelForHandle:he,ariaLabelledByForHandle:pe,ariaValueTextFormatterForHandle:me,styles:l||{},classNames:a||{}}},[Se,Re,ge,c,d,De,O,pt,Wt,x,de,he,pe,me,l,a]);return m.createElement(_b.Provider,{value:ht},m.createElement("div",{ref:Te,className:Xn(o,r,Jt(Jt(Jt(Jt({},"".concat(o,"-disabled"),c),"".concat(o,"-vertical"),j),"".concat(o,"-horizontal"),!j),"".concat(o,"-with-marks"),ue.length)),style:i,onMouseDown:it},m.createElement("div",{className:Xn("".concat(o,"-rail"),a==null?void 0:a.rail),style:en(en({},$),l==null?void 0:l.rail)}),m.createElement(nYt,{prefixCls:o,style:G,values:Rt,startPoint:V,onStartMove:$e?wt:void 0}),m.createElement(tYt,{prefixCls:o,marks:ue,dots:Z,style:ie,activeStyle:Q}),m.createElement($Bt,{ref:le,prefixCls:o,style:q,values:xt,draggingIndex:st,onStartMove:wt,onOffsetChange:Be,onFocus:p,onBlur:g,handleRender:ee,activeHandleRender:te,onChangeComplete:Ee}),m.createElement(ZBt,{prefixCls:o,marks:ue,onClick:Ye})))});const Jxe=m.forwardRef((t,e)=>{const{open:n}=t,o=m.useRef(null),r=m.useRef(null);function i(){Ig.cancel(r.current),r.current=null}function a(){r.current=Ig(()=>{var l;(l=o.current)===null||l===void 0||l.forceAlign(),r.current=null})}return m.useEffect(()=>(n?a():i(),i),[n,t.title]),m.createElement(oA,Object.assign({ref:o5(o,e)},t))}),aYt=t=>{const{componentCls:e,antCls:n,controlSize:o,dotSize:r,marginFull:i,marginPart:a,colorFillContentHover:l,handleColorDisabled:s,calc:c}=t;return{[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",height:o,margin:`${jt(a)} ${jt(i)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${jt(i)} ${jt(a)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${t.motionDurationMid}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${t.motionDurationMid}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:l},[`${e}-handle::after`]:{boxShadow:`0 0 0 ${jt(t.handleLineWidth)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:t.handleSize,height:t.handleSize,outline:"none","&::before":{content:'""',position:"absolute",insetInlineStart:c(t.handleLineWidth).mul(-1).equal(),insetBlockStart:c(t.handleLineWidth).mul(-1).equal(),width:c(t.handleSize).add(c(t.handleLineWidth).mul(2)).equal(),height:c(t.handleSize).add(c(t.handleLineWidth).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:t.handleSize,height:t.handleSize,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${jt(t.handleLineWidth)} ${t.handleColor}`,borderRadius:"50%",cursor:"pointer",transition:` + `]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,color:t.colorText,fontFamily:t.fontFamily,lineHeight:`${jt(t.itemSize)}`,textAlign:"center",verticalAlign:"middle",listStyle:"none",borderRadius:t.borderRadius,cursor:"pointer",transition:`all ${t.motionDurationMid}`},[`${e}-prev, ${e}-next`]:{fontFamily:"Arial, Helvetica, sans-serif",outline:0,button:{color:t.colorText,cursor:"pointer",userSelect:"none"},[`${e}-item-link`]:{display:"block",width:"100%",height:"100%",padding:0,fontSize:t.fontSizeSM,textAlign:"center",backgroundColor:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:"none",transition:`all ${t.motionDurationMid}`},[`&:hover ${e}-item-link`]:{backgroundColor:t.colorBgTextHover},[`&:active ${e}-item-link`]:{backgroundColor:t.colorBgTextActive},[`&${e}-disabled:hover`]:{[`${e}-item-link`]:{backgroundColor:"transparent"}}},[`${e}-slash`]:{marginInlineEnd:t.paginationSlashMarginInlineEnd,marginInlineStart:t.paginationSlashMarginInlineStart},[`${e}-options`]:{display:"inline-block",marginInlineStart:t.margin,verticalAlign:"middle","&-size-changer.-select":{display:"inline-block",width:"auto"},"&-quick-jumper":{display:"inline-block",height:t.controlHeight,marginInlineStart:t.marginXS,lineHeight:jt(t.controlHeight),verticalAlign:"top",input:Object.assign(Object.assign(Object.assign({},eN(t)),rye(t,{borderColor:t.colorBorder,hoverBorderColor:t.colorPrimaryHover,activeBorderColor:t.colorPrimary,activeShadow:t.activeShadow})),{"&[disabled]":Object.assign({},dQ(t)),width:t.calc(t.controlHeightLG).mul(1.25).equal(),height:t.controlHeight,boxSizing:"border-box",margin:0,marginInlineStart:t.marginXS,marginInlineEnd:t.marginXS})}}}},xBt=t=>{const{componentCls:e}=t;return{[`${e}-item`]:{display:"inline-block",minWidth:t.itemSize,height:t.itemSize,marginInlineEnd:t.marginXS,fontFamily:t.fontFamily,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),textAlign:"center",verticalAlign:"middle",listStyle:"none",backgroundColor:"transparent",border:`${jt(t.lineWidth)} ${t.lineType} transparent`,borderRadius:t.borderRadius,outline:0,cursor:"pointer",userSelect:"none",a:{display:"block",padding:`0 ${jt(t.paginationItemPaddingInline)}`,color:t.colorText,"&:hover":{textDecoration:"none"}},[`&:not(${e}-item-active)`]:{"&:hover":{transition:`all ${t.motionDurationMid}`,backgroundColor:t.colorBgTextHover},"&:active":{backgroundColor:t.colorBgTextActive}},"&-active":{fontWeight:t.fontWeightStrong,backgroundColor:t.itemActiveBg,borderColor:t.colorPrimary,a:{color:t.colorPrimary},"&:hover":{borderColor:t.colorPrimaryHover},"&:hover a":{color:t.colorPrimaryHover}}}}},bBt=t=>{const{componentCls:e}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{"ul, ol":{margin:0,padding:0,listStyle:"none"},"&::after":{display:"block",clear:"both",height:0,overflow:"hidden",visibility:"hidden",content:'""'},[`${e}-total-text`]:{display:"inline-block",height:t.itemSize,marginInlineEnd:t.marginXS,lineHeight:jt(t.calc(t.itemSize).sub(2).equal()),verticalAlign:"middle"}}),xBt(t)),vBt(t)),wBt(t)),ABt(t)),yBt(t)),{[`@media only screen and (max-width: ${t.screenLG}px)`]:{[`${e}-item`]:{"&-after-jump-prev, &-before-jump-next":{display:"none"}}},[`@media only screen and (max-width: ${t.screenSM}px)`]:{[`${e}-options`]:{display:"none"}}}),[`&${t.componentCls}-rtl`]:{direction:"rtl"}}},SBt=t=>{const{componentCls:e}=t;return{[`${e}:not(${e}-disabled)`]:{[`${e}-item`]:Object.assign({},eA(t)),[`${e}-jump-prev, ${e}-jump-next`]:{"&:focus-visible":Object.assign({[`${e}-item-link-icon`]:{opacity:1},[`${e}-item-ellipsis`]:{opacity:0}},dw(t))},[`${e}-prev, ${e}-next`]:{[`&:focus-visible ${e}-item-link`]:Object.assign({},dw(t))}}}},QJe=t=>Object.assign({itemBg:t.colorBgContainer,itemSize:t.controlHeight,itemSizeSM:t.controlHeightSM,itemActiveBg:t.colorBgContainer,itemLinkBg:t.colorBgContainer,itemActiveColorDisabled:t.colorTextDisabled,itemActiveBgDisabled:t.controlItemBgActiveDisabled,itemInputBg:t.colorBgContainer,miniOptionsSizeChangerTop:0},ZW(t)),ZJe=t=>qi(t,{inputOutlineOffset:0,paginationMiniOptionsMarginInlineStart:t.calc(t.marginXXS).div(2).equal(),paginationMiniQuickJumperInputWidth:t.calc(t.controlHeightLG).mul(1.1).equal(),paginationItemPaddingInline:t.calc(t.marginXXS).mul(1.5).equal(),paginationEllipsisLetterSpacing:t.calc(t.marginXXS).div(2).equal(),paginationSlashMarginInlineStart:t.marginXXS,paginationSlashMarginInlineEnd:t.marginSM,paginationEllipsisTextIndent:"0.13em"},QW(t)),TBt=wl("Pagination",t=>{const e=ZJe(t);return[bBt(e),SBt(e)]},QJe),PBt=t=>{const{componentCls:e}=t;return{[`${e}${e}-bordered${e}-disabled:not(${e}-mini)`]:{"&, &:hover":{[`${e}-item-link`]:{borderColor:t.colorBorder}},"&:focus-visible":{[`${e}-item-link`]:{borderColor:t.colorBorder}},[`${e}-item, ${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,[`&:hover:not(${e}-item-active)`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,a:{color:t.colorTextDisabled}},[`&${e}-item-active`]:{backgroundColor:t.itemActiveBgDisabled}},[`${e}-prev, ${e}-next`]:{"&:hover button":{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder,color:t.colorTextDisabled},[`${e}-item-link`]:{backgroundColor:t.colorBgContainerDisabled,borderColor:t.colorBorder}}},[`${e}${e}-bordered:not(${e}-mini)`]:{[`${e}-prev, ${e}-next`]:{"&:hover button":{borderColor:t.colorPrimaryHover,backgroundColor:t.itemBg},[`${e}-item-link`]:{backgroundColor:t.itemLinkBg,borderColor:t.colorBorder},[`&:hover ${e}-item-link`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,color:t.colorPrimary},[`&${e}-disabled`]:{[`${e}-item-link`]:{borderColor:t.colorBorder,color:t.colorTextDisabled}}},[`${e}-item`]:{backgroundColor:t.itemBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,[`&:hover:not(${e}-item-active)`]:{borderColor:t.colorPrimary,backgroundColor:t.itemBg,a:{color:t.colorPrimary}},"&-active":{borderColor:t.colorPrimary}}}}},CBt=LW(["Pagination","bordered"],t=>{const e=ZJe(t);return[PBt(e)]},QJe);var RBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:e,selectPrefixCls:n,className:o,rootClassName:r,style:i,size:a,locale:l,selectComponentClass:s,responsive:c,showSizeChanger:u}=t,d=RBt(t,["prefixCls","selectPrefixCls","className","rootClassName","style","size","locale","selectComponentClass","responsive","showSizeChanger"]),{xs:f}=Q$(c),[,p]=Vu(),{getPrefixCls:g,direction:A,pagination:y={}}=m.useContext(Cr),S=g("pagination",e),[C,P,v]=TBt(S),T=u??y.showSizeChanger,w=m.useMemo(()=>{const U=m.createElement("span",{className:`${S}-item-ellipsis`},"•••"),W=m.createElement("button",{className:`${S}-item-link`,type:"button",tabIndex:-1},A==="rtl"?m.createElement(YG,null):m.createElement(Zve,null)),k=m.createElement("button",{className:`${S}-item-link`,type:"button",tabIndex:-1},A==="rtl"?m.createElement(Zve,null):m.createElement(YG,null)),D=m.createElement("a",{className:`${S}-item-link`},m.createElement("div",{className:`${S}-item-container`},A==="rtl"?m.createElement(Bxe,{className:`${S}-item-link-icon`}):m.createElement(jxe,{className:`${S}-item-link-icon`}),U)),L=m.createElement("a",{className:`${S}-item-link`},m.createElement("div",{className:`${S}-item-container`},A==="rtl"?m.createElement(jxe,{className:`${S}-item-link-icon`}):m.createElement(Bxe,{className:`${S}-item-link-icon`}),U));return{prevIcon:W,nextIcon:k,jumpPrevIcon:D,jumpNextIcon:L}},[A,S]),[x]=Uw("Pagination",wVe),b=Object.assign(Object.assign({},x),l),R=zd(a),H=R==="small"||!!(f&&!R&&c),F=g("select",n),E=Un({[`${S}-mini`]:H,[`${S}-rtl`]:A==="rtl",[`${S}-bordered`]:p.wireframe},y==null?void 0:y.className,o,r,P,v),N=Object.assign(Object.assign({},y==null?void 0:y.style),i);return C(m.createElement(m.Fragment,null,p.wireframe&&m.createElement(CBt,{prefixCls:S}),m.createElement(mBt,Object.assign({},w,d,{style:N,prefixCls:S,selectPrefixCls:F,className:E,selectComponentClass:s||(H?qJe:$Je),locale:b,showSizeChanger:T}))))},yye=be.createContext({});yye.Consumer;var tKe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{prefixCls:e,className:n,avatar:o,title:r,description:i}=t,a=tKe(t,["prefixCls","className","avatar","title","description"]);const{getPrefixCls:l}=m.useContext(Cr),s=l("list",e),c=Un(`${s}-item-meta`,n),u=be.createElement("div",{className:`${s}-item-meta-content`},r&&be.createElement("h4",{className:`${s}-item-meta-title`},r),i&&be.createElement("div",{className:`${s}-item-meta-description`},i));return be.createElement("div",Object.assign({},a,{className:c}),o&&be.createElement("div",{className:`${s}-item-meta-avatar`},o),(r||i)&&u)},MBt=be.forwardRef((t,e)=>{const{prefixCls:n,children:o,actions:r,extra:i,className:a,colStyle:l}=t,s=tKe(t,["prefixCls","children","actions","extra","className","colStyle"]),{grid:c,itemLayout:u}=m.useContext(yye),{getPrefixCls:d}=m.useContext(Cr),f=()=>{let C;return m.Children.forEach(o,P=>{typeof P=="string"&&(C=!0)}),C&&m.Children.count(o)>1},p=()=>u==="vertical"?!!i:!f(),g=d("list",n),A=r&&r.length>0&&be.createElement("ul",{className:`${g}-item-action`,key:"actions"},r.map((C,P)=>be.createElement("li",{key:`${g}-item-action-${P}`},C,P!==r.length-1&&be.createElement("em",{className:`${g}-item-action-split`})))),y=c?"div":"li",S=be.createElement(y,Object.assign({},s,c?{}:{ref:e},{className:Un(`${g}-item`,{[`${g}-item-no-flex`]:!p()},a)}),u==="vertical"&&i?[be.createElement("div",{className:`${g}-item-main`,key:"content"},o,A),be.createElement("div",{className:`${g}-item-extra`,key:"extra"},i)]:[o,A,j0(i,{key:"extra"})]);return c?be.createElement(Ke,{ref:e,flex:1,style:l},S):S}),nKe=MBt;nKe.Meta=HBt;const IBt=t=>{const{listBorderedCls:e,componentCls:n,paddingLG:o,margin:r,itemPaddingSM:i,itemPaddingLG:a,marginLG:l,borderRadiusLG:s}=t;return{[`${e}`]:{border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:s,[`${n}-header,${n}-footer,${n}-item`]:{paddingInline:o},[`${n}-pagination`]:{margin:`${jt(r)} ${jt(l)}`}},[`${e}${n}-sm`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:i}},[`${e}${n}-lg`]:{[`${n}-item,${n}-header,${n}-footer`]:{padding:a}}}},zBt=t=>{const{componentCls:e,screenSM:n,screenMD:o,marginLG:r,marginSM:i,margin:a}=t;return{[`@media screen and (max-width:${o}px)`]:{[`${e}`]:{[`${e}-item`]:{[`${e}-item-action`]:{marginInlineStart:r}}},[`${e}-vertical`]:{[`${e}-item`]:{[`${e}-item-extra`]:{marginInlineStart:r}}}},[`@media screen and (max-width: ${n}px)`]:{[`${e}`]:{[`${e}-item`]:{flexWrap:"wrap",[`${e}-action`]:{marginInlineStart:i}}},[`${e}-vertical`]:{[`${e}-item`]:{flexWrap:"wrap-reverse",[`${e}-item-main`]:{minWidth:t.contentWidth},[`${e}-item-extra`]:{margin:`auto auto ${jt(a)}`}}}}}},DBt=t=>{const{componentCls:e,antCls:n,controlHeight:o,minHeight:r,paddingSM:i,marginLG:a,padding:l,itemPadding:s,colorPrimary:c,itemPaddingSM:u,itemPaddingLG:d,paddingXS:f,margin:p,colorText:g,colorTextDescription:A,motionDurationSlow:y,lineWidth:S,headerBg:C,footerBg:P,emptyTextPadding:v,metaMarginBottom:T,avatarMarginRight:w,titleMarginBottom:x,descriptionFontSize:b}=t,R={};return["start","center","end"].forEach(H=>{R[`&-align-${H}`]={textAlign:H}}),{[`${e}`]:Object.assign(Object.assign({},Na(t)),{position:"relative","*":{outline:"none"},[`${e}-header`]:{background:C},[`${e}-footer`]:{background:P},[`${e}-header, ${e}-footer`]:{paddingBlock:i},[`${e}-pagination`]:Object.assign(Object.assign({marginBlockStart:a},R),{[`${n}-pagination-options`]:{textAlign:"start"}}),[`${e}-spin`]:{minHeight:r,textAlign:"center"},[`${e}-items`]:{margin:0,padding:0,listStyle:"none"},[`${e}-item`]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:s,color:g,[`${e}-item-meta`]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",[`${e}-item-meta-avatar`]:{marginInlineEnd:w},[`${e}-item-meta-content`]:{flex:"1 0",width:0,color:g},[`${e}-item-meta-title`]:{margin:`0 0 ${jt(t.marginXXS)} 0`,color:g,fontSize:t.fontSize,lineHeight:t.lineHeight,"> a":{color:g,transition:`all ${y}`,"&:hover":{color:c}}},[`${e}-item-meta-description`]:{color:A,fontSize:b,lineHeight:t.lineHeight}},[`${e}-item-action`]:{flex:"0 0 auto",marginInlineStart:t.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:`0 ${jt(f)}`,color:A,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},[`${e}-item-action-split`]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:S,height:t.calc(t.fontHeight).sub(t.calc(t.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:t.colorSplit}}},[`${e}-empty`]:{padding:`${jt(l)} 0`,color:A,fontSize:t.fontSizeSM,textAlign:"center"},[`${e}-empty-text`]:{padding:v,color:t.colorTextDisabled,fontSize:t.fontSize,textAlign:"center"},[`${e}-item-no-flex`]:{display:"block"}}),[`${e}-grid ${n}-col > ${e}-item`]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},[`${e}-vertical ${e}-item`]:{alignItems:"initial",[`${e}-item-main`]:{display:"block",flex:1},[`${e}-item-extra`]:{marginInlineStart:a},[`${e}-item-meta`]:{marginBlockEnd:T,[`${e}-item-meta-title`]:{marginBlockStart:0,marginBlockEnd:x,color:g,fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}},[`${e}-item-action`]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:`0 ${jt(l)}`,"&:first-child":{paddingInlineStart:0}}}},[`${e}-split ${e}-item`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`,"&:last-child":{borderBlockEnd:"none"}},[`${e}-split ${e}-header`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-split${e}-empty ${e}-footer`]:{borderTop:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-loading ${e}-spin-nested-loading`]:{minHeight:o},[`${e}-split${e}-something-after-last-item ${n}-spin-container > ${e}-items > ${e}-item:last-child`]:{borderBlockEnd:`${jt(t.lineWidth)} ${t.lineType} ${t.colorSplit}`},[`${e}-lg ${e}-item`]:{padding:d},[`${e}-sm ${e}-item`]:{padding:u},[`${e}:not(${e}-vertical)`]:{[`${e}-item-no-flex`]:{[`${e}-item-action`]:{float:"right"}}}}},EBt=t=>({contentWidth:220,itemPadding:`${jt(t.paddingContentVertical)} 0`,itemPaddingSM:`${jt(t.paddingContentVerticalSM)} ${jt(t.paddingContentHorizontal)}`,itemPaddingLG:`${jt(t.paddingContentVerticalLG)} ${jt(t.paddingContentHorizontalLG)}`,headerBg:"transparent",footerBg:"transparent",emptyTextPadding:t.padding,metaMarginBottom:t.padding,avatarMarginRight:t.padding,titleMarginBottom:t.paddingSM,descriptionFontSize:t.fontSize}),FBt=wl("List",t=>{const e=qi(t,{listBorderedCls:`${t.componentCls}-bordered`,minHeight:t.controlHeightLG});return[DBt(e),IBt(e),zBt(e)]},EBt);var kBt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r(De,Ae)=>{var ue;b(De),H(Ae),n&&n[Re]&&((ue=n==null?void 0:n[Re])===null||ue===void 0||ue.call(n,De,Ae))},D=k("onChange"),L=k("onShowSizeChange"),j=(Re,De)=>{if(!P)return null;let Ae;return typeof C=="function"?Ae=C(Re):C?Ae=Re[C]:Ae=Re.key,Ae||(Ae=`list-item-${De}`),m.createElement(m.Fragment,{key:Ae},P(Re,De))},B=()=>!!(d||n||y),O=F("list",o),[V,G,q]=FBt(O);let $=S;typeof $=="boolean"&&($={spinning:$});const ie=$&&$.spinning,Q=zd(g);let se="";switch(Q){case"large":se="lg";break;case"small":se="sm";break}const oe=Un(O,{[`${O}-vertical`]:u==="vertical",[`${O}-${se}`]:se,[`${O}-split`]:i,[`${O}-bordered`]:r,[`${O}-loading`]:ie,[`${O}-grid`]:!!f,[`${O}-something-after-last-item`]:B(),[`${O}-rtl`]:N==="rtl"},U==null?void 0:U.className,a,l,G,q),Z=KJe(W,{total:p.length,current:x,pageSize:R},n||{}),te=Math.ceil(Z.total/Z.pageSize);Z.current>te&&(Z.current=te);const ee=n?m.createElement("div",{className:Un(`${O}-pagination`,`${O}-pagination-align-${(e=Z==null?void 0:Z.align)!==null&&e!==void 0?e:"end"}`)},m.createElement(eKe,Object.assign({},Z,{onChange:D,onShowSizeChange:L}))):null;let de=Qa(p);n&&p.length>(Z.current-1)*Z.pageSize&&(de=Qa(p).splice((Z.current-1)*Z.pageSize,Z.pageSize));const fe=Object.keys(f||{}).some(Re=>["xs","sm","md","lg","xl","xxl"].includes(Re)),pe=Q$(fe),ye=m.useMemo(()=>{for(let Re=0;Re{if(!f)return;const Re=ye&&f[ye]?f[ye]:f.column;if(Re)return{width:`${100/Re}%`,maxWidth:`${100/Re}%`}},[JSON.stringify(f),ye]);let Te=ie&&m.createElement("div",{style:{minHeight:53}});if(de.length>0){const Re=de.map((De,Ae)=>j(De,Ae));Te=f?m.createElement(nn,{gutter:f.gutter},m.Children.map(Re,De=>m.createElement("div",{key:De==null?void 0:De.key,style:ae},De))):m.createElement("ul",{className:`${O}-items`},Re)}else!c&&!ie&&(Te=m.createElement("div",{className:`${O}-empty-text`},v&&v.emptyText||(E==null?void 0:E("List"))||m.createElement(jme,{componentName:"List"})));const ge=Z.position||"bottom",Se=m.useMemo(()=>({grid:f,itemLayout:u}),[JSON.stringify(f),u]);return V(m.createElement(yye.Provider,{value:Se},m.createElement("div",Object.assign({style:Object.assign(Object.assign({},U==null?void 0:U.style),s),className:oe},T),(ge==="top"||ge==="both")&&ee,A&&m.createElement("div",{className:`${O}-header`},A),m.createElement(tN,Object.assign({},$),Te,c),y&&m.createElement("div",{className:`${O}-footer`},y),d||(ge==="bottom"||ge==="both")&&ee)))}gk.Item=nKe;let Pm=null,_v=t=>t(),mk=[],yk={};function Vxe(){const{getContainer:t,duration:e,rtl:n,maxCount:o,top:r}=yk,i=(t==null?void 0:t())||document.body;return{getContainer:()=>i,duration:e,rtl:n,maxCount:o,top:r}}const LBt=be.forwardRef((t,e)=>{const{messageConfig:n,sync:o}=t,{getPrefixCls:r}=m.useContext(Cr),i=yk.prefixCls||r("message"),a=m.useContext(ZIt),[l,s]=H_e(Object.assign(Object.assign(Object.assign({},n),{prefixCls:i}),a.message));return be.useImperativeHandle(e,()=>{const c=Object.assign({},l);return Object.keys(c).forEach(u=>{c[u]=function(){return o(),l[u].apply(l,arguments)}}),{instance:c,sync:o}}),s}),WBt=be.forwardRef((t,e)=>{const[n,o]=be.useState(Vxe),r=()=>{o(Vxe)};be.useEffect(r,[]);const i=u_e(),a=i.getRootPrefixCls(),l=i.getIconPrefixCls(),s=i.getTheme(),c=be.createElement(LBt,{ref:e,sync:r,messageConfig:n});return be.createElement(fy,{prefixCls:a,iconPrefixCls:l,theme:s},i.holderRender?i.holderRender(c):c)});function mQ(){if(!Pm){const t=document.createDocumentFragment(),e={fragment:t};Pm=e,_v(()=>{Hme(be.createElement(WBt,{ref:n=>{const{instance:o,sync:r}=n||{};Promise.resolve().then(()=>{!e.instance&&o&&(e.instance=o,e.sync=r,mQ())})}}),t)});return}Pm.instance&&(mk.forEach(t=>{const{type:e,skipped:n}=t;if(!n)switch(e){case"open":{_v(()=>{const o=Pm.instance.open(Object.assign(Object.assign({},yk),t.config));o==null||o.then(t.resolve),t.setCloseFn(o)});break}case"destroy":_v(()=>{Pm==null||Pm.instance.destroy(t.key)});break;default:_v(()=>{var o;const r=(o=Pm.instance)[e].apply(o,Qa(t.args));r==null||r.then(t.resolve),t.setCloseFn(r)})}}),mk=[])}function NBt(t){yk=Object.assign(Object.assign({},yk),t),_v(()=>{var e;(e=Pm==null?void 0:Pm.sync)===null||e===void 0||e.call(Pm)})}function UBt(t){const e=Rme(n=>{let o;const r={type:"open",config:t,resolve:n,setCloseFn:i=>{o=i}};return mk.push(r),()=>{o?_v(()=>{o()}):r.skipped=!0}});return mQ(),e}function jBt(t,e){const n=Rme(o=>{let r;const i={type:t,args:e,resolve:o,setCloseFn:a=>{r=a}};return mk.push(i),()=>{r?_v(()=>{r()}):i.skipped=!0}});return mQ(),n}const BBt=t=>{mk.push({type:"destroy",key:t}),mQ()},YBt=["success","info","warning","error","loading"],OBt={open:UBt,destroy:BBt,config:NBt,useMessage:WRt,_InternalPanelDoNotUseOrYouWillBeFired:MRt},iA=OBt;YBt.forEach(t=>{iA[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o{const{prefixCls:e,className:n,closeIcon:o,closable:r,type:i,title:a,children:l,footer:s}=t,c=VBt(t,["prefixCls","className","closeIcon","closable","type","title","children","footer"]),{getPrefixCls:u}=m.useContext(Cr),d=u(),f=e||u("modal"),p=Y0(d),[g,A,y]=dGe(f,p),S=`${f}-confirm`;let C={};return i?C={closable:r??!1,title:"",footer:"",children:m.createElement(hGe,Object.assign({},t,{prefixCls:f,confirmPrefixCls:S,rootPrefixCls:d,content:l}))}:C={closable:r??!0,title:a,footer:s!==null&&m.createElement(sGe,Object.assign({},t)),children:l},g(m.createElement(__e,Object.assign({prefixCls:f,className:Un(A,`${f}-pure-panel`,i&&S,i&&`${S}-${i}`,n,y,p)},c,{closeIcon:lGe(f,o),closable:r},C)))},GBt=bGe(_Bt);function oKe(t){return GW(yGe(t))}const yi=fGe;yi.useModal=QIt;yi.info=function(e){return GW(AGe(e))};yi.success=function(e){return GW(wGe(e))};yi.error=function(e){return GW(vGe(e))};yi.warning=oKe;yi.warn=oKe;yi.confirm=function(e){return GW(xGe(e))};yi.destroyAll=function(){for(;Yv.length;){const e=Yv.pop();e&&e()}};yi.config=XIt;yi._InternalPanelDoNotUseOrYouWillBeFired=GBt;var XBt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},JBt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:XBt}))},Hf=m.forwardRef(JBt);function xue(t,e,n){return(t-e)/(n-e)}function Aye(t,e,n,o){var r=xue(e,n,o),i={};switch(t){case"rtl":i.right="".concat(r*100,"%"),i.transform="translateX(50%)";break;case"btt":i.bottom="".concat(r*100,"%"),i.transform="translateY(50%)";break;case"ttb":i.top="".concat(r*100,"%"),i.transform="translateY(-50%)";break;default:i.left="".concat(r*100,"%"),i.transform="translateX(-50%)";break}return i}function rC(t,e){return Array.isArray(t)?t[e]:t}var _b=m.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0,keyboard:!0,styles:{},classNames:{}}),KBt=["prefixCls","value","valueIndex","onStartMove","style","render","dragging","onOffsetChange","onChangeComplete","onFocus","onMouseEnter"],_xe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.value,r=t.valueIndex,i=t.onStartMove,a=t.style,l=t.render,s=t.dragging,c=t.onOffsetChange,u=t.onChangeComplete,d=t.onFocus,f=t.onMouseEnter,p=oi(t,KBt),g=m.useContext(_b),A=g.min,y=g.max,S=g.direction,C=g.disabled,P=g.keyboard,v=g.range,T=g.tabIndex,w=g.ariaLabelForHandle,x=g.ariaLabelledByForHandle,b=g.ariaValueTextFormatterForHandle,R=g.styles,H=g.classNames,F="".concat(n,"-handle"),E=function(V){C||i(V,r)},N=function(V){d==null||d(V,r)},U=function(V){f(V,r)},W=function(V){if(!C&&P){var G=null;switch(V.which||V.keyCode){case jn.LEFT:G=S==="ltr"||S==="btt"?-1:1;break;case jn.RIGHT:G=S==="ltr"||S==="btt"?1:-1;break;case jn.UP:G=S!=="ttb"?1:-1;break;case jn.DOWN:G=S!=="ttb"?-1:1;break;case jn.HOME:G="min";break;case jn.END:G="max";break;case jn.PAGE_UP:G=2;break;case jn.PAGE_DOWN:G=-2;break}G!==null&&(V.preventDefault(),c(G,r))}},k=function(V){switch(V.which||V.keyCode){case jn.LEFT:case jn.RIGHT:case jn.UP:case jn.DOWN:case jn.HOME:case jn.END:case jn.PAGE_UP:case jn.PAGE_DOWN:u==null||u();break}},D=Aye(S,o,A,y),L={};if(r!==null){var j;L={tabIndex:C?null:rC(T,r),role:"slider","aria-valuemin":A,"aria-valuemax":y,"aria-valuenow":o,"aria-disabled":C,"aria-label":rC(w,r),"aria-labelledby":rC(x,r),"aria-valuetext":(j=rC(b,r))===null||j===void 0?void 0:j(o),"aria-orientation":S==="ltr"||S==="rtl"?"horizontal":"vertical",onMouseDown:E,onTouchStart:E,onFocus:N,onMouseEnter:U,onKeyDown:W,onKeyUp:k}}var B=m.createElement("div",go({ref:e,className:Xn(F,Jt(Jt({},"".concat(F,"-").concat(r+1),r!==null&&v),"".concat(F,"-dragging"),s),H.handle),style:en(en(en({},D),a),R.handle)},L,p));return l&&(B=l(B,{index:r,prefixCls:n,value:o,dragging:s})),B}),qBt=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","activeHandleRender","draggingIndex","onFocus"],$Bt=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.style,r=t.onStartMove,i=t.onOffsetChange,a=t.values,l=t.handleRender,s=t.activeHandleRender,c=t.draggingIndex,u=t.onFocus,d=oi(t,qBt),f=m.useRef({});m.useImperativeHandle(e,function(){return{focus:function(T){var w;(w=f.current[T])===null||w===void 0||w.focus()}}});var p=m.useState(-1),g=sn(p,2),A=g[0],y=g[1],S=function(T,w){y(w),u==null||u(T)},C=function(T,w){y(w)},P=en({prefixCls:n,onStartMove:r,onOffsetChange:i,render:l,onFocus:S,onMouseEnter:C},d);return m.createElement(m.Fragment,null,a.map(function(v,T){return m.createElement(_xe,go({ref:function(x){x?f.current[T]=x:delete f.current[T]},dragging:c===T,style:rC(o,T),key:T,value:v,valueIndex:T},P))}),s&&m.createElement(_xe,go({key:"a11y"},P,{value:a[A],valueIndex:null,dragging:c!==-1,render:s,style:{pointerEvents:"none"},tabIndex:null,"aria-hidden":!0})))}),QBt=function(e){var n=e.prefixCls,o=e.style,r=e.children,i=e.value,a=e.onClick,l=m.useContext(_b),s=l.min,c=l.max,u=l.direction,d=l.includedStart,f=l.includedEnd,p=l.included,g="".concat(n,"-text"),A=Aye(u,i,s,c);return m.createElement("span",{className:Xn(g,Jt({},"".concat(g,"-active"),p&&d<=i&&i<=f)),style:en(en({},A),o),onMouseDown:function(S){S.stopPropagation()},onClick:function(){a(i)}},r)},ZBt=function(e){var n=e.prefixCls,o=e.marks,r=e.onClick,i="".concat(n,"-mark");return o.length?m.createElement("div",{className:i},o.map(function(a){var l=a.value,s=a.style,c=a.label;return m.createElement(QBt,{key:l,prefixCls:i,style:s,value:l,onClick:r},c)})):null},eYt=function(e){var n=e.prefixCls,o=e.value,r=e.style,i=e.activeStyle,a=m.useContext(_b),l=a.min,s=a.max,c=a.direction,u=a.included,d=a.includedStart,f=a.includedEnd,p="".concat(n,"-dot"),g=u&&d<=o&&o<=f,A=en(en({},Aye(c,o,l,s)),typeof r=="function"?r(o):r);return g&&(A=en(en({},A),typeof i=="function"?i(o):i)),m.createElement("span",{className:Xn(p,Jt({},"".concat(p,"-active"),g)),style:A})},tYt=function(e){var n=e.prefixCls,o=e.marks,r=e.dots,i=e.style,a=e.activeStyle,l=m.useContext(_b),s=l.min,c=l.max,u=l.step,d=m.useMemo(function(){var f=new Set;if(o.forEach(function(g){f.add(g.value)}),r&&u!==null)for(var p=s;p<=c;)f.add(p),p+=u;return Array.from(f)},[s,c,u,r,o]);return m.createElement("div",{className:"".concat(n,"-step")},d.map(function(f){return m.createElement(eYt,{prefixCls:n,key:f,value:f,style:i,activeStyle:a})}))},Gxe=function(e){var n=e.prefixCls,o=e.style,r=e.start,i=e.end,a=e.index,l=e.onStartMove,s=e.replaceCls,c=m.useContext(_b),u=c.direction,d=c.min,f=c.max,p=c.disabled,g=c.range,A=c.classNames,y="".concat(n,"-track"),S=xue(r,d,f),C=xue(i,d,f),P=function(x){!p&&l&&l(x,-1)},v={};switch(u){case"rtl":v.right="".concat(S*100,"%"),v.width="".concat(C*100-S*100,"%");break;case"btt":v.bottom="".concat(S*100,"%"),v.height="".concat(C*100-S*100,"%");break;case"ttb":v.top="".concat(S*100,"%"),v.height="".concat(C*100-S*100,"%");break;default:v.left="".concat(S*100,"%"),v.width="".concat(C*100-S*100,"%")}var T=s||Xn(y,Jt(Jt({},"".concat(y,"-").concat(a+1),a!==null&&g),"".concat(n,"-track-draggable"),l),A.track);return m.createElement("div",{className:T,style:en(en({},v),o),onMouseDown:P,onTouchStart:P})},nYt=function(e){var n=e.prefixCls,o=e.style,r=e.values,i=e.startPoint,a=e.onStartMove,l=m.useContext(_b),s=l.included,c=l.range,u=l.min,d=l.styles,f=l.classNames,p=m.useMemo(function(){if(!c){if(r.length===0)return[];var A=i??u,y=r[0];return[{start:Math.min(A,y),end:Math.max(A,y)}]}for(var S=[],C=0;C3&&arguments[3]!==void 0?arguments[3]:"unit";if(typeof A=="number"){var C,P=g[y],v=P+A,T=[];o.forEach(function(H){T.push(H.value)}),T.push(t,e),T.push(l(P));var w=A>0?1:-1;S==="unit"?T.push(l(P+w*n)):T.push(l(v)),T=T.filter(function(H){return H!==null}).filter(function(H){return A<0?H<=P:H>=P}),S==="unit"&&(T=T.filter(function(H){return H!==P}));var x=S==="unit"?P:v;C=T[0];var b=Math.abs(C-x);if(T.forEach(function(H){var F=Math.abs(H-x);F1){var R=No(g);return R[y]=C,p(R,A-w,y,S)}return C}else{if(A==="min")return t;if(A==="max")return e}},u=function(g,A,y){var S=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unit",C=g[y],P=c(g,A,y,S);return{value:P,changed:P!==C}},d=function(g){return i===null&&g===0||typeof i=="number"&&g3&&arguments[3]!==void 0?arguments[3]:"unit",C=g.map(s),P=C[y],v=c(C,A,y,S);if(C[y]=v,r===!1){var T=i||0;y>0&&C[y-1]!==P&&(C[y]=Math.max(C[y],C[y-1]+T)),y0;R-=1)for(var H=!0;d(C[R]-C[R-1])&&H;){var F=u(C,-1,R-1);C[R-1]=F.value,H=F.changed}for(var E=C.length-1;E>0;E-=1)for(var N=!0;d(C[E]-C[E-1])&&N;){var U=u(C,-1,E-1);C[E-1]=U.value,N=U.changed}for(var W=0;W=0?k:!1},[k,De]),ue=m.useMemo(function(){return Object.keys(se||{}).map(function(ct){var It=se[ct],Ft={value:Number(ct)};return It&&hi(It)==="object"&&!m.isValidElement(It)&&("label"in It||"style"in It)?(Ft.style=It.style,Ft.label=It.label):Ft.label=It,Ft}).filter(function(ct){var It=ct.label;return It||typeof It=="number"}).sort(function(ct,It){return ct.value-It.value})},[se]),he=rYt(Se,Re,De,ue,U,Ae),ve=sn(he,2),we=ve[0],Pe=ve[1],Ie=Es(w,{value:T}),Me=sn(Ie,2),ze=Me[0],Ne=Me[1],Je=m.useMemo(function(){var ct=ze==null?[]:Array.isArray(ze)?ze:[ze],It=sn(ct,1),Ft=It[0],Ve=Ft===void 0?Se:Ft,ft=ze===null?[]:[Ve];if(x){if(ft=No(ct),b||ze===void 0){var kt=b>=0?b+1:2;for(ft=ft.slice(0,kt);ft.length=0&&ae.current.focus(ct)}Ze(null)},[lt]);var $e=m.useMemo(function(){return D&&De===null?!1:D},[D,De]),wt=function(It,Ft){gt(It,Ft),H==null||H(nt(Ue.current))},vt=st!==-1;m.useEffect(function(){if(!vt){var ct=Je.lastIndexOf(je);ae.current.focus(ct)}},[vt]);var Rt=m.useMemo(function(){return No(xt).sort(function(ct,It){return ct-It})},[xt]),Gt=m.useMemo(function(){return x?[Rt[0],Rt[Rt.length-1]]:[Se,Rt[0]]},[Rt,x,Se]),At=sn(Gt,2),pt=At[0],Wt=At[1];m.useImperativeHandle(e,function(){return{focus:function(){ae.current.focus(0)},blur:function(){var It,Ft=document,Ve=Ft.activeElement;(It=Te.current)!==null&&It!==void 0&&It.contains(Ve)&&(Ve==null||Ve.blur())}}}),m.useEffect(function(){f&&ae.current.focus(0)},[]);var ht=m.useMemo(function(){return{min:Se,max:Re,direction:ge,disabled:c,keyboard:d,step:De,included:O,includedStart:pt,includedEnd:Wt,range:x,tabIndex:de,ariaLabelForHandle:fe,ariaLabelledByForHandle:pe,ariaValueTextFormatterForHandle:ye,styles:l||{},classNames:a||{}}},[Se,Re,ge,c,d,De,O,pt,Wt,x,de,fe,pe,ye,l,a]);return m.createElement(_b.Provider,{value:ht},m.createElement("div",{ref:Te,className:Xn(o,r,Jt(Jt(Jt(Jt({},"".concat(o,"-disabled"),c),"".concat(o,"-vertical"),j),"".concat(o,"-horizontal"),!j),"".concat(o,"-with-marks"),ue.length)),style:i,onMouseDown:it},m.createElement("div",{className:Xn("".concat(o,"-rail"),a==null?void 0:a.rail),style:en(en({},$),l==null?void 0:l.rail)}),m.createElement(nYt,{prefixCls:o,style:G,values:Rt,startPoint:V,onStartMove:$e?wt:void 0}),m.createElement(tYt,{prefixCls:o,marks:ue,dots:oe,style:ie,activeStyle:Q}),m.createElement($Bt,{ref:ae,prefixCls:o,style:q,values:xt,draggingIndex:st,onStartMove:wt,onOffsetChange:Be,onFocus:p,onBlur:g,handleRender:Z,activeHandleRender:te,onChangeComplete:Ee}),m.createElement(ZBt,{prefixCls:o,marks:ue,onClick:Ye})))});const Jxe=m.forwardRef((t,e)=>{const{open:n}=t,o=m.useRef(null),r=m.useRef(null);function i(){Ig.cancel(r.current),r.current=null}function a(){r.current=Ig(()=>{var l;(l=o.current)===null||l===void 0||l.forceAlign(),r.current=null})}return m.useEffect(()=>(n?a():i(),i),[n,t.title]),m.createElement(oA,Object.assign({ref:o5(o,e)},t))}),aYt=t=>{const{componentCls:e,antCls:n,controlSize:o,dotSize:r,marginFull:i,marginPart:a,colorFillContentHover:l,handleColorDisabled:s,calc:c}=t;return{[e]:Object.assign(Object.assign({},Na(t)),{position:"relative",height:o,margin:`${jt(a)} ${jt(i)}`,padding:0,cursor:"pointer",touchAction:"none","&-vertical":{margin:`${jt(i)} ${jt(a)}`},[`${e}-rail`]:{position:"absolute",backgroundColor:t.railBg,borderRadius:t.borderRadiusXS,transition:`background-color ${t.motionDurationMid}`},[`${e}-track,${e}-tracks`]:{position:"absolute",transition:`background-color ${t.motionDurationMid}`},[`${e}-track`]:{backgroundColor:t.trackBg,borderRadius:t.borderRadiusXS},[`${e}-track-draggable`]:{boxSizing:"content-box",backgroundClip:"content-box",border:"solid rgba(0,0,0,0)"},"&:hover":{[`${e}-rail`]:{backgroundColor:t.railHoverBg},[`${e}-track`]:{backgroundColor:t.trackHoverBg},[`${e}-dot`]:{borderColor:l},[`${e}-handle::after`]:{boxShadow:`0 0 0 ${jt(t.handleLineWidth)} ${t.colorPrimaryBorderHover}`},[`${e}-dot-active`]:{borderColor:t.dotActiveBorderColor}},[`${e}-handle`]:{position:"absolute",width:t.handleSize,height:t.handleSize,outline:"none","&::before":{content:'""',position:"absolute",insetInlineStart:c(t.handleLineWidth).mul(-1).equal(),insetBlockStart:c(t.handleLineWidth).mul(-1).equal(),width:c(t.handleSize).add(c(t.handleLineWidth).mul(2)).equal(),height:c(t.handleSize).add(c(t.handleLineWidth).mul(2)).equal(),backgroundColor:"transparent"},"&::after":{content:'""',position:"absolute",insetBlockStart:0,insetInlineStart:0,width:t.handleSize,height:t.handleSize,backgroundColor:t.colorBgElevated,boxShadow:`0 0 0 ${jt(t.handleLineWidth)} ${t.handleColor}`,borderRadius:"50%",cursor:"pointer",transition:` inset-inline-start ${t.motionDurationMid}, inset-block-start ${t.motionDurationMid}, width ${t.motionDurationMid}, @@ -4655,7 +4655,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `]:{backgroundColor:t.colorBgElevated,borderColor:t.trackBgDisabled,boxShadow:"none",cursor:"not-allowed"},[`${e}-handle::after`]:{backgroundColor:t.colorBgElevated,cursor:"not-allowed",width:t.handleSize,height:t.handleSize,boxShadow:`0 0 0 ${jt(t.handleLineWidth)} ${s}`,insetInlineStart:0,insetBlockStart:0},[` ${e}-mark-text, ${e}-dot - `]:{cursor:"not-allowed !important"}},[`&-tooltip ${n}-tooltip-inner`]:{minWidth:"unset"}})}},rKe=(t,e)=>{const{componentCls:n,railSize:o,handleSize:r,dotSize:i,marginFull:a,calc:l}=t,s=e?"paddingBlock":"paddingInline",c=e?"width":"height",u=e?"height":"width",d=e?"insetBlockStart":"insetInlineStart",f=e?"top":"insetInlineStart",p=l(o).mul(3).sub(r).div(2).equal(),g=l(r).sub(o).div(2).equal(),A=e?{borderWidth:`${jt(g)} 0`,transform:`translateY(${jt(l(g).mul(-1).equal())})`}:{borderWidth:`0 ${jt(g)}`,transform:`translateX(${jt(t.calc(g).mul(-1).equal())})`};return{[s]:o,[u]:l(o).mul(3).equal(),[`${n}-rail`]:{[c]:"100%",[u]:o},[`${n}-track,${n}-tracks`]:{[u]:o},[`${n}-track-draggable`]:Object.assign({},A),[`${n}-handle`]:{[d]:p},[`${n}-mark`]:{insetInlineStart:0,top:0,[f]:l(o).mul(3).add(e?0:a).equal(),[c]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[f]:o,[c]:"100%",[u]:o},[`${n}-dot`]:{position:"absolute",[d]:l(o).sub(i).div(2).equal()}}},lYt=t=>{const{componentCls:e,marginPartWithMark:n}=t;return{[`${e}-horizontal`]:Object.assign(Object.assign({},rKe(t,!0)),{[`&${e}-with-marks`]:{marginBottom:n}})}},sYt=t=>{const{componentCls:e}=t;return{[`${e}-vertical`]:Object.assign(Object.assign({},rKe(t,!1)),{height:"100%"})}},cYt=t=>{const n=t.controlHeightLG/4,o=t.controlHeightSM/2,r=t.lineWidth+1,i=t.lineWidth+1*3;return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:o,dotSize:8,handleLineWidth:r,handleLineWidthHover:i,railBg:t.colorFillTertiary,railHoverBg:t.colorFillSecondary,trackBg:t.colorPrimaryBorder,trackHoverBg:t.colorPrimaryBorderHover,handleColor:t.colorPrimaryBorder,handleActiveColor:t.colorPrimary,handleColorDisabled:new Wl(t.colorTextDisabled).onBackground(t.colorBgContainer).toHexShortString(),dotBorderColor:t.colorBorderSecondary,dotActiveBorderColor:t.colorPrimaryBorder,trackBgDisabled:t.colorBgContainerDisabled}},uYt=wl("Slider",t=>{const e=qi(t,{marginPart:t.calc(t.controlHeight).sub(t.controlSize).div(2).equal(),marginFull:t.calc(t.controlSize).div(2).equal(),marginPartWithMark:t.calc(t.controlHeightLG).sub(t.controlSize).equal()});return[aYt(e),lYt(e),sYt(e)]},cYt);function xie(){const[t,e]=m.useState(!1),n=m.useRef(),o=()=>{Ig.cancel(n.current)},r=i=>{o(),i?e(i):n.current=Ig(()=>{e(i)})};return m.useEffect(()=>o,[]),[t,r]}var dYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rtypeof n=="number"?n.toString():""}const Iu=be.forwardRef((t,e)=>{const{prefixCls:n,range:o,className:r,rootClassName:i,style:a,disabled:l,tooltipPrefixCls:s,tipFormatter:c,tooltipVisible:u,getTooltipPopupContainer:d,tooltipPlacement:f,tooltip:p={},onChangeComplete:g}=t,A=dYt(t,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete"]),{vertical:y}=t,{direction:S,slider:C,getPrefixCls:P,getPopupContainer:v}=be.useContext(Cr),T=be.useContext(n1),w=l??T,[x,b]=xie(),[R,H]=xie(),F=Object.assign({},p),{open:E,placement:N,getPopupContainer:U,prefixCls:W,formatter:k}=F,D=E??u,L=(x||R)&&D!==!1,j=fYt(k,c),[B,O]=xie(),V=pe=>{g==null||g(pe),O(!1)},G=(pe,me)=>pe||(me?S==="rtl"?"left":"right":"top"),q=P("slider",n),[$,ie,Q]=uYt(q),se=Un(r,C==null?void 0:C.className,i,{[`${q}-rtl`]:S==="rtl",[`${q}-lock`]:B},ie,Q);S==="rtl"&&!A.vertical&&(A.reverse=!A.reverse);const[Z,ee]=be.useMemo(()=>o?typeof o=="object"?[!0,o.draggableTrack]:[!0,!1]:[!1],[o]);be.useEffect(()=>{const pe=()=>{Ig(()=>{H(!1)},1)};return document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mouseup",pe)}},[]);const te=Z&&!D,oe=(pe,me)=>{const{index:le}=me,Te=pe.props,ge=Object.assign(Object.assign({},Te),{onMouseEnter:De=>{var Ae;b(!0),(Ae=Te.onMouseEnter)===null||Ae===void 0||Ae.call(Te,De)},onMouseLeave:De=>{var Ae;b(!1),(Ae=Te.onMouseLeave)===null||Ae===void 0||Ae.call(Te,De)},onMouseDown:De=>{var Ae;H(!0),O(!0),(Ae=Te.onMouseDown)===null||Ae===void 0||Ae.call(Te,De)},onFocus:De=>{var Ae,ue;H(!0),(Ae=A.onFocus)===null||Ae===void 0||Ae.call(A,De),(ue=Te.onFocus)===null||ue===void 0||ue.call(Te,De)},onBlur:De=>{var Ae,ue;H(!1),(Ae=A.onBlur)===null||Ae===void 0||Ae.call(A,De),(ue=Te.onBlur)===null||ue===void 0||ue.call(Te,De)}}),Se=be.cloneElement(pe,ge),Re=(!!D||L)&&j!==null;return te?Se:be.createElement(Jxe,Object.assign({},F,{prefixCls:P("tooltip",W??s),title:j?j(me.value):"",open:Re,placement:G(N??f,y),key:le,overlayClassName:`${q}-tooltip`,getPopupContainer:U||d||v}),Se)},de=te?(pe,me)=>{const le=be.cloneElement(pe,{style:Object.assign(Object.assign({},pe.props.style),{visibility:"hidden"})});return be.createElement(Jxe,Object.assign({},F,{prefixCls:P("tooltip",W??s),title:j?j(me.value):"",open:j!==null&&L,placement:G(N??f,y),key:"tooltip",overlayClassName:`${q}-tooltip`,getPopupContainer:U||d||v}),le)}:void 0,he=Object.assign(Object.assign({},C==null?void 0:C.style),a);return $(be.createElement(iYt,Object.assign({},A,{step:A.step,range:Z,draggableTrack:ee,className:se,style:he,disabled:w,ref:e,prefixCls:q,handleRender:oe,activeHandleRender:de,onChangeComplete:V})))});var hYt=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],iKe=m.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-switch":o,i=t.className,a=t.checked,l=t.defaultChecked,s=t.disabled,c=t.loadingIcon,u=t.checkedChildren,d=t.unCheckedChildren,f=t.onClick,p=t.onChange,g=t.onKeyDown,A=oi(t,hYt),y=Es(!1,{value:a,defaultValue:l}),S=sn(y,2),C=S[0],P=S[1];function v(b,R){var H=C;return s||(H=b,P(H),p==null||p(H,R)),H}function T(b){b.which===jn.LEFT?v(!1,b):b.which===jn.RIGHT&&v(!0,b),g==null||g(b)}function w(b){var R=v(!C,b);f==null||f(R,b)}var x=Xn(r,i,(n={},Jt(n,"".concat(r,"-checked"),C),Jt(n,"".concat(r,"-disabled"),s),n));return m.createElement("button",go({},A,{type:"button",role:"switch","aria-checked":C,disabled:s,className:x,ref:e,onKeyDown:T,onClick:w}),c,m.createElement("span",{className:"".concat(r,"-inner")},m.createElement("span",{className:"".concat(r,"-inner-checked")},u),m.createElement("span",{className:"".concat(r,"-inner-unchecked")},d)))});iKe.displayName="Switch";const pYt=t=>{const{componentCls:e,trackHeightSM:n,trackPadding:o,trackMinWidthSM:r,innerMinMarginSM:i,innerMaxMarginSM:a,handleSizeSM:l,calc:s}=t,c=`${e}-inner`,u=jt(s(l).add(s(o).mul(2)).equal()),d=jt(s(a).mul(2).equal());return{[e]:{[`&${e}-small`]:{minWidth:r,height:n,lineHeight:jt(n),[`${e}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${d})`,marginInlineEnd:`calc(100% - ${u} + ${d})`},[`${c}-unchecked`]:{marginTop:s(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${e}-handle`]:{width:l,height:l},[`${e}-loading-icon`]:{top:s(s(l).sub(t.switchLoadingIconSize)).div(2).equal(),fontSize:t.switchLoadingIconSize},[`&${e}-checked`]:{[`${e}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${d})`,marginInlineEnd:`calc(-100% + ${u} - ${d})`}},[`${e}-handle`]:{insetInlineStart:`calc(100% - ${jt(s(l).add(o).equal())})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:s(t.marginXXS).div(2).equal(),marginInlineEnd:s(t.marginXXS).mul(-1).div(2).equal()}},[`&${e}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:s(t.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:s(t.marginXXS).div(2).equal()}}}}}}},gYt=t=>{const{componentCls:e,handleSize:n,calc:o}=t;return{[e]:{[`${e}-loading-icon${t.iconCls}`]:{position:"relative",top:o(o(n).sub(t.fontSize)).div(2).equal(),color:t.switchLoadingIconColor,verticalAlign:"top"},[`&${e}-checked ${e}-loading-icon`]:{color:t.switchColor}}}},mYt=t=>{const{componentCls:e,trackPadding:n,handleBg:o,handleShadow:r,handleSize:i,calc:a}=t,l=`${e}-handle`;return{[e]:{[l]:{position:"absolute",top:n,insetInlineStart:n,width:i,height:i,transition:`all ${t.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:o,borderRadius:a(i).div(2).equal(),boxShadow:r,transition:`all ${t.switchDuration} ease-in-out`,content:'""'}},[`&${e}-checked ${l}`]:{insetInlineStart:`calc(100% - ${jt(a(i).add(n).equal())})`},[`&:not(${e}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:t.switchHandleActiveInset,insetInlineStart:0},[`&${e}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:t.switchHandleActiveInset}}}}},yYt=t=>{const{componentCls:e,trackHeight:n,trackPadding:o,innerMinMargin:r,innerMaxMargin:i,handleSize:a,calc:l}=t,s=`${e}-inner`,c=jt(l(a).add(l(o).mul(2)).equal()),u=jt(l(i).mul(2).equal());return{[e]:{[s]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:i,paddingInlineEnd:r,transition:`padding-inline-start ${t.switchDuration} ease-in-out, padding-inline-end ${t.switchDuration} ease-in-out`,[`${s}-checked, ${s}-unchecked`]:{display:"block",color:t.colorTextLightSolid,fontSize:t.fontSizeSM,transition:`margin-inline-start ${t.switchDuration} ease-in-out, margin-inline-end ${t.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${s}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${s}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${e}-checked ${s}`]:{paddingInlineStart:r,paddingInlineEnd:i,[`${s}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${s}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${s}`]:{[`${s}-unchecked`]:{marginInlineStart:l(o).mul(2).equal(),marginInlineEnd:l(o).mul(-1).mul(2).equal()}},[`&${e}-checked ${s}`]:{[`${s}-checked`]:{marginInlineStart:l(o).mul(-1).mul(2).equal(),marginInlineEnd:l(o).mul(2).equal()}}}}}},AYt=t=>{const{componentCls:e,trackHeight:n,trackMinWidth:o}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:o,height:n,lineHeight:`${jt(n)}`,verticalAlign:"middle",background:t.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${t.motionDurationMid}`,userSelect:"none",[`&:hover:not(${e}-disabled)`]:{background:t.colorTextTertiary}}),eA(t)),{[`&${e}-checked`]:{background:t.switchColor,[`&:hover:not(${e}-disabled)`]:{background:t.colorPrimaryHover}},[`&${e}-loading, &${e}-disabled`]:{cursor:"not-allowed",opacity:t.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${e}-rtl`]:{direction:"rtl"}})}},wYt=t=>{const{fontSize:e,lineHeight:n,controlHeight:o,colorWhite:r}=t,i=e*n,a=o/2,l=2,s=i-l*2,c=a-l*2;return{trackHeight:i,trackHeightSM:a,trackMinWidth:s*2+l*4,trackMinWidthSM:c*2+l*2,trackPadding:l,handleBg:r,handleSize:s,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new Wl("#00230b").setAlpha(.2).toRgbString()}`,innerMinMargin:s/2,innerMaxMargin:s+l+l*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+l+l*2}},vYt=wl("Switch",t=>{const e=qi(t,{switchDuration:t.motionDurationMid,switchColor:t.colorPrimary,switchDisabledOpacity:t.opacityLoading,switchLoadingIconSize:t.calc(t.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${t.opacityLoading})`,switchHandleActiveInset:"-30%"});return[AYt(e),yYt(e),mYt(e),gYt(e),pYt(e)]},wYt);var xYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,size:o,disabled:r,loading:i,className:a,rootClassName:l,style:s,checked:c,value:u,defaultChecked:d,defaultValue:f,onChange:p}=t,g=xYt(t,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[A,y]=Z6(!1,{value:c??u,defaultValue:d??f}),{getPrefixCls:S,direction:C,switch:P}=m.useContext(Cr),v=m.useContext(n1),T=(r??v)||i,w=S("switch",n),x=m.createElement("div",{className:`${w}-handle`},i&&m.createElement(YH,{className:`${w}-loading-icon`})),[b,R,H]=vYt(w),F=zd(o),E=Un(P==null?void 0:P.className,{[`${w}-small`]:F==="small",[`${w}-loading`]:i,[`${w}-rtl`]:C==="rtl"},a,l,R,H),N=Object.assign(Object.assign({},P==null?void 0:P.style),s),U=function(){y(arguments.length<=0?void 0:arguments[0]),p==null||p.apply(void 0,arguments)};return b(m.createElement(UW,{component:"Switch"},m.createElement(iKe,Object.assign({},g,{checked:A,onChange:U,prefixCls:w,className:E,style:N,disabled:T,ref:e,loadingIcon:x}))))}),vc=bYt;vc.__ANT_SWITCH=!0;var q4={},nN="rc-table-internal-hook";function wye(t){var e=m.createContext(void 0),n=function(r){var i=r.value,a=r.children,l=m.useRef(i);l.current=i;var s=m.useState(function(){return{getValue:function(){return l.current},listeners:new Set}}),c=sn(s,1),u=c[0];return _a(function(){Hd.unstable_batchedUpdates(function(){u.listeners.forEach(function(d){d(i)})})},[i]),m.createElement(e.Provider,{value:u},a)};return{Context:e,Provider:n,defaultValue:t}}function yh(t,e){var n=za(typeof e=="function"?e:function(d){if(e===void 0)return d;if(!Array.isArray(e))return d[e];var f={};return e.forEach(function(p){f[p]=d[p]}),f}),o=m.useContext(t==null?void 0:t.Context),r=o||{},i=r.listeners,a=r.getValue,l=m.useRef();l.current=n(o?a():t==null?void 0:t.defaultValue);var s=m.useState({}),c=sn(s,2),u=c[1];return _a(function(){if(!o)return;function d(f){var p=n(f);cw(l.current,p,!0)||u({})}return i.add(d),function(){i.delete(d)}},[o]),l.current}function SYt(){var t=m.createContext(null);function e(){return m.useContext(t)}function n(r,i){var a=sw(r),l=function(c,u){var d=a?{ref:u}:{},f=m.useRef(0),p=m.useRef(c),g=e();return g!==null?m.createElement(r,go({},c,d)):((!i||i(p.current,c))&&(f.current+=1),p.current=c,m.createElement(t.Provider,{value:f.current},m.createElement(r,go({},c,d))))};return a?m.forwardRef(l):l}function o(r,i){var a=sw(r),l=function(c,u){var d=a?{ref:u}:{};return e(),m.createElement(r,go({},c,d))};return a?m.memo(m.forwardRef(l),i):m.memo(l,i)}return{makeImmutable:n,responseImmutable:o,useImmutableMark:e}}var vye=SYt(),aKe=vye.makeImmutable,qH=vye.responseImmutable,TYt=vye.useImmutableMark,d1=wye(),lKe=m.createContext({renderWithProps:!1}),PYt="RC_TABLE_KEY";function CYt(t){return t==null?[]:Array.isArray(t)?t:[t]}function yQ(t){var e=[],n={};return t.forEach(function(o){for(var r=o||{},i=r.key,a=r.dataIndex,l=i||CYt(a).join("-")||PYt;n[l];)l="".concat(l,"_next");n[l]=!0,e.push(l)}),e}function bue(t){return t!=null}function RYt(t){return t&&hi(t)==="object"&&!Array.isArray(t)&&!m.isValidElement(t)}function HYt(t,e,n,o,r,i){var a=m.useContext(lKe),l=TYt(),s=DW(function(){if(bue(o))return[o];var c=e==null||e===""?[]:Array.isArray(e)?e:[e],u=mg(t,c),d=u,f=void 0;if(r){var p=r(u,t,n);RYt(p)?(d=p.children,f=p.props,a.renderWithProps=!0):d=p}return[d,f]},[l,t,o,e,r,n],function(c,u){if(i){var d=sn(c,2),f=d[1],p=sn(u,2),g=p[1];return i(g,f)}return a.renderWithProps?!0:!cw(c,u,!0)});return s}function MYt(t,e,n,o){var r=t+e-1;return t<=o&&r>=n}function IYt(t,e){return yh(d1,function(n){var o=MYt(t,e||1,n.hoverStartRow,n.hoverEndRow);return[o,n.onHover]})}var zYt=function(e){var n=e.ellipsis,o=e.rowType,r=e.children,i,a=n===!0?{showTitle:!0}:n;return a&&(a.showTitle||o==="header")&&(typeof r=="string"||typeof r=="number"?i=r.toString():m.isValidElement(r)&&typeof r.props.children=="string"&&(i=r.props.children)),i};function DYt(t){var e,n,o,r,i,a,l,s,c=t.component,u=t.children,d=t.ellipsis,f=t.scope,p=t.prefixCls,g=t.className,A=t.align,y=t.record,S=t.render,C=t.dataIndex,P=t.renderIndex,v=t.shouldCellUpdate,T=t.index,w=t.rowType,x=t.colSpan,b=t.rowSpan,R=t.fixLeft,H=t.fixRight,F=t.firstFixLeft,E=t.lastFixLeft,N=t.firstFixRight,U=t.lastFixRight,W=t.appendNode,k=t.additionalProps,D=k===void 0?{}:k,L=t.isSticky,j="".concat(p,"-cell"),B=yh(d1,["supportSticky","allColumnsFixedLeft","rowHoverable"]),O=B.supportSticky,V=B.allColumnsFixedLeft,G=B.rowHoverable,q=HYt(y,C,P,u,S,v),$=sn(q,2),ie=$[0],Q=$[1],se={},Z=typeof R=="number"&&O,ee=typeof H=="number"&&O;Z&&(se.position="sticky",se.left=R),ee&&(se.position="sticky",se.right=H);var te=(e=(n=(o=Q==null?void 0:Q.colSpan)!==null&&o!==void 0?o:D.colSpan)!==null&&n!==void 0?n:x)!==null&&e!==void 0?e:1,oe=(r=(i=(a=Q==null?void 0:Q.rowSpan)!==null&&a!==void 0?a:D.rowSpan)!==null&&i!==void 0?i:b)!==null&&r!==void 0?r:1,de=IYt(T,oe),he=sn(de,2),pe=he[0],me=he[1],le=za(function(ue){var fe;y&&me(T,T+oe-1),D==null||(fe=D.onMouseEnter)===null||fe===void 0||fe.call(D,ue)}),Te=za(function(ue){var fe;y&&me(-1,-1),D==null||(fe=D.onMouseLeave)===null||fe===void 0||fe.call(D,ue)});if(te===0||oe===0)return null;var ge=(l=D.title)!==null&&l!==void 0?l:zYt({rowType:w,ellipsis:d,children:ie}),Se=Xn(j,g,(s={},Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(s,"".concat(j,"-fix-left"),Z&&O),"".concat(j,"-fix-left-first"),F&&O),"".concat(j,"-fix-left-last"),E&&O),"".concat(j,"-fix-left-all"),E&&V&&O),"".concat(j,"-fix-right"),ee&&O),"".concat(j,"-fix-right-first"),N&&O),"".concat(j,"-fix-right-last"),U&&O),"".concat(j,"-ellipsis"),d),"".concat(j,"-with-append"),W),"".concat(j,"-fix-sticky"),(Z||ee)&&L&&O),Jt(s,"".concat(j,"-row-hover"),!Q&&pe)),D.className,Q==null?void 0:Q.className),Re={};A&&(Re.textAlign=A);var De=en(en(en(en({},se),D.style),Re),Q==null?void 0:Q.style),Ae=ie;return hi(Ae)==="object"&&!Array.isArray(Ae)&&!m.isValidElement(Ae)&&(Ae=null),d&&(E||N)&&(Ae=m.createElement("span",{className:"".concat(j,"-content")},Ae)),m.createElement(c,go({},Q,D,{className:Se,style:De,title:ge,scope:f,onMouseEnter:G?le:void 0,onMouseLeave:G?Te:void 0,colSpan:te!==1?te:null,rowSpan:oe!==1?oe:null}),W,Ae)}const Gb=m.memo(DYt);function xye(t,e,n,o,r){var i=n[t]||{},a=n[e]||{},l,s;i.fixed==="left"?l=o.left[r==="rtl"?e:t]:a.fixed==="right"&&(s=o.right[r==="rtl"?t:e]);var c=!1,u=!1,d=!1,f=!1,p=n[e+1],g=n[t-1],A=p&&!p.fixed||g&&!g.fixed||n.every(function(v){return v.fixed==="left"});if(r==="rtl"){if(l!==void 0){var y=g&&g.fixed==="left";f=!y&&A}else if(s!==void 0){var S=p&&p.fixed==="right";d=!S&&A}}else if(l!==void 0){var C=p&&p.fixed==="left";c=!C&&A}else if(s!==void 0){var P=g&&g.fixed==="right";u=!P&&A}return{fixLeft:l,fixRight:s,lastFixLeft:c,firstFixRight:u,lastFixRight:d,firstFixLeft:f,isSticky:o.isSticky}}var sKe=m.createContext({});function EYt(t){var e=t.className,n=t.index,o=t.children,r=t.colSpan,i=r===void 0?1:r,a=t.rowSpan,l=t.align,s=yh(d1,["prefixCls","direction"]),c=s.prefixCls,u=s.direction,d=m.useContext(sKe),f=d.scrollColumnIndex,p=d.stickyOffsets,g=d.flattenColumns,A=n+i-1,y=A+1===f?i+1:i,S=xye(n,n+y-1,g,p,u);return m.createElement(Gb,go({className:e,index:n,component:"td",prefixCls:c,record:null,dataIndex:null,align:l,colSpan:y,rowSpan:a,render:function(){return o}},S))}var FYt=["children"];function kYt(t){var e=t.children,n=oi(t,FYt);return m.createElement("tr",n,e)}function AQ(t){var e=t.children;return e}AQ.Row=kYt;AQ.Cell=EYt;function LYt(t){var e=t.children,n=t.stickyOffsets,o=t.flattenColumns,r=yh(d1,"prefixCls"),i=o.length-1,a=o[i],l=m.useMemo(function(){return{stickyOffsets:n,flattenColumns:o,scrollColumnIndex:a!=null&&a.scrollbar?i:null}},[a,o,i,n]);return m.createElement(sKe.Provider,{value:l},m.createElement("tfoot",{className:"".concat(r,"-summary")},e))}const YY=qH(LYt);var cKe=AQ;function WYt(t){return null}function NYt(t){return null}var uKe=function(e){if(fp()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1},UYt=function(e,n){if(!uKe(e))return!1;var o=document.createElement("div"),r=o.style[e];return o.style[e]=n,o.style[e]!==r};function jYt(t,e){return!Array.isArray(t)&&e!==void 0?UYt(t,e):uKe(t)}function dKe(t,e,n,o,r,i,a){t.push({record:e,indent:n,index:a});var l=i(e),s=r==null?void 0:r.has(l);if(e&&Array.isArray(e[o])&&s)for(var c=0;c1?F-1:0),N=1;N=1?T:""),style:en(en({},n),S==null?void 0:S.style)}),g.map(function(R,H){var F=R.render,E=R.dataIndex,N=R.className,U=gKe(f,R,H,s,r),W=U.key,k=U.fixedInfo,D=U.appendCellNode,L=U.additionalCellProps;return m.createElement(Gb,go({className:N,ellipsis:R.ellipsis,align:R.align,scope:R.rowScope,component:R.rowScope?d:u,prefixCls:p,key:W,record:o,index:r,renderIndex:i,dataIndex:E,render:F,shouldCellUpdate:R.shouldCellUpdate},k,{appendNode:D,additionalProps:L}))})),x;if(P&&(v.current||C)){var b=y(o,r,s+1,C);x=m.createElement(pKe,{expanded:C,className:Xn("".concat(p,"-expanded-row"),"".concat(p,"-expanded-row-level-").concat(s+1),T),prefixCls:p,component:c,cellComponent:u,colSpan:g.length,isEmpty:!1},b)}return m.createElement(m.Fragment,null,w,x)}const YYt=qH(BYt);function OYt(t){var e=t.columnKey,n=t.onColumnResize,o=m.useRef();return m.useEffect(function(){o.current&&n(e,o.current.offsetWidth)},[]),m.createElement(Cd,{data:e},m.createElement("td",{ref:o,style:{padding:0,border:0,height:0}},m.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}function VYt(t){var e=t.prefixCls,n=t.columnsKey,o=t.onColumnResize;return m.createElement("tr",{"aria-hidden":"true",className:"".concat(e,"-measure-row"),style:{height:0,fontSize:0}},m.createElement(Cd.Collection,{onBatchResize:function(i){i.forEach(function(a){var l=a.data,s=a.size;o(l,s.offsetWidth)})}},n.map(function(r){return m.createElement(OYt,{key:r,columnKey:r,onColumnResize:o})})))}function _Yt(t){var e=t.data,n=t.measureColumnWidth,o=yh(d1,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode"]),r=o.prefixCls,i=o.getComponent,a=o.onColumnResize,l=o.flattenColumns,s=o.getRowKey,c=o.expandedKeys,u=o.childrenColumnName,d=o.emptyNode,f=fKe(e,u,c,s),p=m.useRef({renderWithProps:!1}),g=i(["body","wrapper"],"tbody"),A=i(["body","row"],"tr"),y=i(["body","cell"],"td"),S=i(["body","cell"],"th"),C;e.length?C=f.map(function(v,T){var w=v.record,x=v.indent,b=v.index,R=s(w,T);return m.createElement(YYt,{key:R,rowKey:R,record:w,index:T,renderIndex:b,rowComponent:A,cellComponent:y,scopeCellComponent:S,getRowKey:s,indent:x})}):C=m.createElement(pKe,{expanded:!0,className:"".concat(r,"-placeholder"),prefixCls:r,component:A,cellComponent:y,colSpan:l.length,isEmpty:!0},d);var P=yQ(l);return m.createElement(lKe.Provider,{value:p.current},m.createElement(g,{className:"".concat(r,"-tbody")},n&&m.createElement(VYt,{prefixCls:r,columnsKey:P,onColumnResize:a}),C))}const GYt=qH(_Yt);var XYt=["expandable"],HE="RC_TABLE_INTERNAL_COL_DEFINE";function JYt(t){var e=t.expandable,n=oi(t,XYt),o;return"expandable"in t?o=en(en({},n),e):o=n,o.showExpandColumn===!1&&(o.expandIconColumnIndex=-1),o}var KYt=["columnType"];function mKe(t){for(var e=t.colWidths,n=t.columns,o=t.columCount,r=[],i=o||n.length,a=!1,l=i-1;l>=0;l-=1){var s=e[l],c=n&&n[l],u=c&&c[HE];if(s||u||a){var d=u||{};d.columnType;var f=oi(d,KYt);r.unshift(m.createElement("col",go({key:l,style:{width:s}},f))),a=!0}}return m.createElement("colgroup",null,r)}var qYt=["className","noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","onScroll","maxContentScroll","children"];function $Yt(t,e){return m.useMemo(function(){for(var n=[],o=0;o1?"colgroup":"col":null,ellipsis:y.ellipsis,align:y.align,component:a,prefixCls:u,key:p[A]},S,{additionalProps:C,rowType:"header"}))}))};function eOt(t){var e=[];function n(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;e[s]=e[s]||[];var c=l,u=a.filter(Boolean).map(function(d){var f={key:d.key,className:d.className||"",children:d.title,column:d,colStart:c},p=1,g=d.children;return g&&g.length>0&&(p=n(g,c,s+1).reduce(function(A,y){return A+y},0),f.hasSubColumns=!0),"colSpan"in d&&(p=d.colSpan),"rowSpan"in d&&(f.rowSpan=d.rowSpan),f.colSpan=p,f.colEnd=f.colStart+p-1,e[s].push(f),c+=p,p});return u}n(t,0);for(var o=e.length,r=function(l){e[l].forEach(function(s){!("rowSpan"in s)&&!s.hasSubColumns&&(s.rowSpan=o-l)})},i=0;i1&&arguments[1]!==void 0?arguments[1]:"";return typeof e=="number"?e:e.endsWith("%")?t*parseFloat(e)/100:null}function nOt(t,e,n){return m.useMemo(function(){if(e&&e>0){var o=0,r=0;t.forEach(function(f){var p=$xe(e,f.width);p?o+=p:r+=1});var i=Math.max(e,n),a=Math.max(i-o,r),l=r,s=a/r,c=0,u=t.map(function(f){var p=en({},f),g=$xe(e,p.width);if(g)p.width=g;else{var A=Math.floor(s);p.width=l===1?a:A,a-=A,l-=1}return c+=p.width,p});if(c0?en(en({},e),{},{children:yKe(n)}):e})}function Sue(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key";return t.filter(function(n){return n&&hi(n)==="object"}).reduce(function(n,o,r){var i=o.fixed,a=i===!0?"left":i,l="".concat(e,"-").concat(r),s=o.children;return s&&s.length>0?[].concat(No(n),No(Sue(s,l).map(function(c){return en({fixed:a},c)}))):[].concat(No(n),[en(en({key:l},o),{},{fixed:a})])},[])}function iOt(t){return t.map(function(e){var n=e.fixed,o=oi(e,rOt),r=n;return n==="left"?r="right":n==="right"&&(r="left"),en({fixed:r},o)})}function aOt(t,e){var n=t.prefixCls,o=t.columns,r=t.children,i=t.expandable,a=t.expandedKeys,l=t.columnTitle,s=t.getRowKey,c=t.onTriggerExpand,u=t.expandIcon,d=t.rowExpandable,f=t.expandIconColumnIndex,p=t.direction,g=t.expandRowByClick,A=t.columnWidth,y=t.fixed,S=t.scrollWidth,C=t.clientWidth,P=m.useMemo(function(){var E=o||bye(r)||[];return yKe(E.slice())},[o,r]),v=m.useMemo(function(){if(i){var E=P.slice();if(!E.includes(q4)){var N=f||0;N>=0&&E.splice(N,0,q4)}var U=E.indexOf(q4);E=E.filter(function(L,j){return L!==q4||j===U});var W=P[U],k;(y==="left"||y)&&!f?k="left":(y==="right"||y)&&f===P.length?k="right":k=W?W.fixed:null;var D=Jt(Jt(Jt(Jt(Jt(Jt({},HE,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",l),"fixed",k),"className","".concat(n,"-row-expand-icon-cell")),"width",A),"render",function(j,B,O){var V=s(B,O),G=a.has(V),q=d?d(B):!0,$=u({prefixCls:n,expanded:G,expandable:q,record:B,onExpand:c});return g?m.createElement("span",{onClick:function(Q){return Q.stopPropagation()}},$):$});return E.map(function(L){return L===q4?D:L})}return P.filter(function(L){return L!==q4})},[i,P,s,a,u,p]),T=m.useMemo(function(){var E=v;return e&&(E=e(E)),E.length||(E=[{render:function(){return null}}]),E},[e,v,p]),w=m.useMemo(function(){return p==="rtl"?iOt(Sue(T)):Sue(T)},[T,p,S]),x=m.useMemo(function(){for(var E=-1,N=w.length-1;N>=0;N-=1){var U=w[N].fixed;if(U==="left"||U===!0){E=N;break}}if(E>=0)for(var W=0;W<=E;W+=1){var k=w[W].fixed;if(k!=="left"&&k!==!0)return!0}var D=w.findIndex(function(B){var O=B.fixed;return O==="right"});if(D>=0)for(var L=D;L=d&&(L=d-f),a({scrollLeft:L/d*(u+2)}),C.current.x=U.pageX},F=function(){x.current=Ea(function(){if(i.current){var U=Uxe(i.current).top,W=U+i.current.offsetHeight,k=s===window?document.documentElement.scrollTop+window.innerHeight:Uxe(s).top+s.clientHeight;W-L0e()<=k||U>=k-l?S(function(D){return en(en({},D),{},{isHiddenScrollBar:!0})}):S(function(D){return en(en({},D),{},{isHiddenScrollBar:!1})})}})},E=function(U){S(function(W){return en(en({},W),{},{scrollLeft:U/u*d||0})})};return m.useImperativeHandle(n,function(){return{setScrollLeft:E,checkScrollBarVisible:F}}),m.useEffect(function(){var N=BY(document.body,"mouseup",b,!1),U=BY(document.body,"mousemove",H,!1);return F(),function(){N.remove(),U.remove()}},[f,T]),m.useEffect(function(){var N=BY(s,"scroll",F,!1),U=BY(window,"resize",F,!1);return function(){N.remove(),U.remove()}},[s]),m.useEffect(function(){y.isHiddenScrollBar||S(function(N){var U=i.current;return U?en(en({},N),{},{scrollLeft:U.scrollLeft/U.scrollWidth*U.clientWidth}):N})},[y.isHiddenScrollBar]),u<=d||!f||y.isHiddenScrollBar?null:m.createElement("div",{style:{height:L0e(),width:d,bottom:l},className:"".concat(c,"-sticky-scroll")},m.createElement("div",{onMouseDown:R,ref:p,className:Xn("".concat(c,"-sticky-scroll-bar"),Jt({},"".concat(c,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(f,"px"),transform:"translate3d(".concat(y.scrollLeft,"px, 0, 0)")}}))};const mOt=m.forwardRef(gOt);var wKe="rc-table",yOt=[],AOt={};function wOt(){return"No Data"}function vOt(t,e){var n=en({rowKey:"key",prefixCls:wKe,emptyText:wOt},t),o=n.prefixCls,r=n.className,i=n.rowClassName,a=n.style,l=n.data,s=n.rowKey,c=n.scroll,u=n.tableLayout,d=n.direction,f=n.title,p=n.footer,g=n.summary,A=n.caption,y=n.id,S=n.showHeader,C=n.components,P=n.emptyText,v=n.onRow,T=n.onHeaderRow,w=n.onScroll,x=n.internalHooks,b=n.transformColumns,R=n.internalRefs,H=n.tailor,F=n.getContainerWidth,E=n.sticky,N=n.rowHoverable,U=N===void 0?!0:N,W=l||yOt,k=!!W.length,D=x===nN,L=m.useCallback(function(So,Qo){return mg(C,So)||Qo},[C]),j=m.useMemo(function(){return typeof s=="function"?s:function(So){var Qo=So&&So[s];return Qo}},[s]),B=L(["body"]),O=fOt(),V=sn(O,3),G=V[0],q=V[1],$=V[2],ie=cOt(n,W,j),Q=sn(ie,6),se=Q[0],Z=Q[1],ee=Q[2],te=Q[3],oe=Q[4],de=Q[5],he=c==null?void 0:c.x,pe=m.useState(0),me=sn(pe,2),le=me[0],Te=me[1],ge=aOt(en(en(en({},n),se),{},{expandable:!!se.expandedRowRender,columnTitle:se.columnTitle,expandedKeys:ee,getRowKey:j,onTriggerExpand:de,expandIcon:te,expandIconColumnIndex:se.expandIconColumnIndex,direction:d,scrollWidth:D&&H&&typeof he=="number"?he:null,clientWidth:le}),D?b:null),Se=sn(ge,4),Re=Se[0],De=Se[1],Ae=Se[2],ue=Se[3],fe=Ae??he,ve=m.useMemo(function(){return{columns:Re,flattenColumns:De}},[Re,De]),we=m.useRef(),Pe=m.useRef(),Ie=m.useRef(),Me=m.useRef();m.useImperativeHandle(e,function(){return{nativeElement:we.current,scrollTo:function(Qo){var Yo;if(Ie.current instanceof HTMLElement){var lr=Qo.index,fr=Qo.top,ei=Qo.key;if(fr){var hr;(hr=Ie.current)===null||hr===void 0||hr.scrollTo({top:fr})}else{var tr,bi=ei??j(W[lr]);(tr=Ie.current.querySelector('[data-row-key="'.concat(bi,'"]')))===null||tr===void 0||tr.scrollIntoView()}}else(Yo=Ie.current)!==null&&Yo!==void 0&&Yo.scrollTo&&Ie.current.scrollTo(Qo)}}});var ze=m.useRef(),Ne=m.useState(!1),Je=sn(Ne,2),Ue=Je[0],nt=Je[1],We=m.useState(!1),Ee=sn(We,2),ke=Ee[0],Oe=Ee[1],st=AKe(new Map),je=sn(st,2),xt=je[0],gt=je[1],Ye=yQ(De),it=Ye.map(function(So){return xt.get(So)}),ut=m.useMemo(function(){return it},[it.join("_")]),Qe=pOt(ut,De,d),lt=c&&bue(c.y),Ze=c&&bue(fe)||!!se.fixed,Be=Ze&&De.some(function(So){var Qo=So.fixed;return Qo}),$e=m.useRef(),wt=hOt(E,o),vt=wt.isSticky,Rt=wt.offsetHeader,Gt=wt.offsetSummary,At=wt.offsetScroll,pt=wt.stickyClassName,Wt=wt.container,ht=m.useMemo(function(){return g==null?void 0:g(W)},[g,W]),ct=(lt||vt)&&m.isValidElement(ht)&&ht.type===AQ&&ht.props.fixed,It,Ft,Ve;lt&&(Ft={overflowY:"scroll",maxHeight:c.y}),Ze&&(It={overflowX:"auto"},lt||(Ft={overflowY:"hidden"}),Ve={width:fe===!0?"auto":fe,minWidth:"100%"});var ft=m.useCallback(function(So,Qo){K$(we.current)&>(function(Yo){if(Yo.get(So)!==Qo){var lr=new Map(Yo);return lr.set(So,Qo),lr}return Yo})},[]),kt=dOt(),rt=sn(kt,2),at=rt[0],Ge=rt[1];function yt(So,Qo){Qo&&(typeof Qo=="function"?Qo(So):Qo.scrollLeft!==So&&(Qo.scrollLeft=So,Qo.scrollLeft!==So&&setTimeout(function(){Qo.scrollLeft=So},0)))}var Pt=za(function(So){var Qo=So.currentTarget,Yo=So.scrollLeft,lr=d==="rtl",fr=typeof Yo=="number"?Yo:Qo.scrollLeft,ei=Qo||AOt;if(!Ge()||Ge()===ei){var hr;at(ei),yt(fr,Pe.current),yt(fr,Ie.current),yt(fr,ze.current),yt(fr,(hr=$e.current)===null||hr===void 0?void 0:hr.setScrollLeft)}var tr=Qo||Pe.current;if(tr){var bi=tr.scrollWidth,Fo=tr.clientWidth;if(bi===Fo){nt(!1),Oe(!1);return}lr?(nt(-fr0)):(nt(fr>0),Oe(fr1?y-U:0,k=en(en(en({},b),c),{},{flex:"0 0 ".concat(U,"px"),width:"".concat(U,"px"),marginRight:W,pointerEvents:"auto"}),D=m.useMemo(function(){return d?E<=1:H===0||E===0||E>1},[E,H,d]);D?k.visibility="hidden":d&&(k.height=f==null?void 0:f(E));var L=D?function(){return null}:p,j={};return(E===0||H===0)&&(j.rowSpan=1,j.colSpan=1),m.createElement(Gb,go({className:Xn(A,u),ellipsis:n.ellipsis,align:n.align,scope:n.rowScope,component:a,prefixCls:e.prefixCls,key:v,record:s,index:i,renderIndex:l,dataIndex:g,render:L,shouldCellUpdate:n.shouldCellUpdate},T,{appendNode:w,additionalProps:en(en({},x),{},{style:k},j)}))}var TOt=["data","index","className","rowKey","style","extra","getHeight"],POt=m.forwardRef(function(t,e){var n=t.data,o=t.index,r=t.className,i=t.rowKey,a=t.style,l=t.extra,s=t.getHeight,c=oi(t,TOt),u=n.record,d=n.indent,f=n.index,p=yh(d1,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),g=p.scrollX,A=p.flattenColumns,y=p.prefixCls,S=p.fixColumn,C=p.componentWidth,P=yh(Sye,["getComponent"]),v=P.getComponent,T=hKe(u,i,o,d),w=v(["body","row"],"div"),x=v(["body","cell"],"div"),b=T.rowSupportExpand,R=T.expanded,H=T.rowProps,F=T.expandedRowRender,E=T.expandedRowClassName,N;if(b&&R){var U=F(u,o,d+1,R),W=E==null?void 0:E(u,o,d),k={};S&&(k={style:Jt({},"--virtual-width","".concat(C,"px"))});var D="".concat(y,"-expanded-row-cell");N=m.createElement(w,{className:Xn("".concat(y,"-expanded-row"),"".concat(y,"-expanded-row-level-").concat(d+1),W)},m.createElement(Gb,{component:x,prefixCls:y,className:Xn(D,Jt({},"".concat(D,"-fixed"),S)),additionalProps:k},U))}var L=en(en({},a),{},{width:g});l&&(L.position="absolute",L.pointerEvents="none");var j=m.createElement(w,go({},H,c,{"data-row-key":i,ref:b?null:e,className:Xn(r,"".concat(y,"-row"),H==null?void 0:H.className,Jt({},"".concat(y,"-row-extra"),l)),style:en(en({},L),H==null?void 0:H.style)}),A.map(function(B,O){return m.createElement(SOt,{key:O,component:x,rowInfo:T,column:B,colIndex:O,indent:d,index:o,renderIndex:f,record:u,inverse:l,getHeight:s})}));return b?m.createElement("div",{ref:e},j,N):j}),ebe=qH(POt),COt=m.forwardRef(function(t,e){var n=t.data,o=t.onScroll,r=yh(d1,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","emptyNode","scrollX"]),i=r.flattenColumns,a=r.onColumnResize,l=r.getRowKey,s=r.expandedKeys,c=r.prefixCls,u=r.childrenColumnName,d=r.emptyNode,f=r.scrollX,p=yh(Sye),g=p.sticky,A=p.scrollY,y=p.listItemHeight,S=p.getComponent,C=p.onScroll,P=m.useRef(),v=fKe(n,u,s,l),T=m.useMemo(function(){var k=0;return i.map(function(D){var L=D.width,j=D.key;return k+=L,[j,L,k]})},[i]),w=m.useMemo(function(){return T.map(function(k){return k[2]})},[T]);m.useEffect(function(){T.forEach(function(k){var D=sn(k,2),L=D[0],j=D[1];a(L,j)})},[T]),m.useImperativeHandle(e,function(){var k={scrollTo:function(L){var j;(j=P.current)===null||j===void 0||j.scrollTo(L)}};return Object.defineProperty(k,"scrollLeft",{get:function(){var L;return((L=P.current)===null||L===void 0?void 0:L.getScrollInfo().x)||0},set:function(L){var j;(j=P.current)===null||j===void 0||j.scrollTo({left:L})}}),k});var x=function(D,L){var j,B=(j=v[L])===null||j===void 0?void 0:j.record,O=D.onCell;if(O){var V,G=O(B,L);return(V=G==null?void 0:G.rowSpan)!==null&&V!==void 0?V:1}return 1},b=function(D){var L=D.start,j=D.end,B=D.getSize,O=D.offsetY;if(j<0)return null;for(var V=i.filter(function(he){return x(he,L)===0}),G=L,q=function(pe){if(V=V.filter(function(me){return x(me,pe)===0}),!V.length)return G=pe,1},$=L;$>=0&&!q($);$-=1);for(var ie=i.filter(function(he){return x(he,j)!==1}),Q=j,se=function(pe){if(ie=ie.filter(function(me){return x(me,pe)!==1}),!ie.length)return Q=Math.max(pe-1,j),1},Z=j;Z1})&&ee.push(pe)},oe=G;oe<=Q;oe+=1)te(oe);var de=ee.map(function(he){var pe=v[he],me=l(pe.record,he),le=function(Se){var Re=he+Se-1,De=l(v[Re].record,Re),Ae=B(me,De);return Ae.bottom-Ae.top},Te=B(me);return m.createElement(ebe,{key:he,data:pe,rowKey:me,index:he,style:{top:-O+Te.top},extra:!0,getHeight:le})});return de},R=m.useMemo(function(){return{columnsOffset:w}},[w]),H="".concat(c,"-tbody"),F=S(["body","wrapper"]),E=S(["body","row"],"div"),N=S(["body","cell"],"div"),U;if(v.length){var W={};g&&(W.position="sticky",W.bottom=0,hi(g)==="object"&&g.offsetScroll&&(W.bottom=g.offsetScroll)),U=m.createElement(q$,{fullHeight:!1,ref:P,prefixCls:"".concat(H,"-virtual"),styles:{horizontalScrollBar:W},className:H,height:A,itemHeight:y||24,data:v,itemKey:function(D){return l(D.record)},component:F,scrollWidth:f,onVirtualScroll:function(D){var L=D.x;o({scrollLeft:L})},onScroll:C,extraRender:b},function(k,D,L){var j=l(k.record,D);return m.createElement(ebe,go({data:k,rowKey:j,index:D},L))})}else U=m.createElement(E,{className:Xn("".concat(c,"-placeholder"))},m.createElement(Gb,{component:N,prefixCls:c},d));return m.createElement(xKe.Provider,{value:R},U)}),ROt=qH(COt),HOt=function(e,n){var o=n.ref,r=n.onScroll;return m.createElement(ROt,{ref:o,data:e,onScroll:r})};function MOt(t,e){var n=t.columns,o=t.scroll,r=t.sticky,i=t.prefixCls,a=i===void 0?wKe:i,l=t.className,s=t.listItemHeight,c=t.components,u=t.onScroll,d=o||{},f=d.x,p=d.y;typeof f!="number"&&(f=1),typeof p!="number"&&(p=500);var g=za(function(S,C){return mg(c,S)||C}),A=za(u),y=m.useMemo(function(){return{sticky:r,scrollY:p,listItemHeight:s,getComponent:g,onScroll:A}},[r,p,s,g,A]);return m.createElement(Sye.Provider,{value:y},m.createElement($H,go({},t,{className:Xn(l,"".concat(a,"-virtual")),scroll:en(en({},o),{},{x:f}),components:en(en({},c),{},{body:HOt}),columns:n,internalHooks:nN,tailor:!0,ref:e})))}var IOt=m.forwardRef(MOt);function bKe(t){return aKe(IOt,t)}bKe();function zOt(t){return null}function DOt(t){return null}function Tue(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n{const{componentCls:n,railSize:o,handleSize:r,dotSize:i,marginFull:a,calc:l}=t,s=e?"paddingBlock":"paddingInline",c=e?"width":"height",u=e?"height":"width",d=e?"insetBlockStart":"insetInlineStart",f=e?"top":"insetInlineStart",p=l(o).mul(3).sub(r).div(2).equal(),g=l(r).sub(o).div(2).equal(),A=e?{borderWidth:`${jt(g)} 0`,transform:`translateY(${jt(l(g).mul(-1).equal())})`}:{borderWidth:`0 ${jt(g)}`,transform:`translateX(${jt(t.calc(g).mul(-1).equal())})`};return{[s]:o,[u]:l(o).mul(3).equal(),[`${n}-rail`]:{[c]:"100%",[u]:o},[`${n}-track,${n}-tracks`]:{[u]:o},[`${n}-track-draggable`]:Object.assign({},A),[`${n}-handle`]:{[d]:p},[`${n}-mark`]:{insetInlineStart:0,top:0,[f]:l(o).mul(3).add(e?0:a).equal(),[c]:"100%"},[`${n}-step`]:{insetInlineStart:0,top:0,[f]:o,[c]:"100%",[u]:o},[`${n}-dot`]:{position:"absolute",[d]:l(o).sub(i).div(2).equal()}}},lYt=t=>{const{componentCls:e,marginPartWithMark:n}=t;return{[`${e}-horizontal`]:Object.assign(Object.assign({},rKe(t,!0)),{[`&${e}-with-marks`]:{marginBottom:n}})}},sYt=t=>{const{componentCls:e}=t;return{[`${e}-vertical`]:Object.assign(Object.assign({},rKe(t,!1)),{height:"100%"})}},cYt=t=>{const n=t.controlHeightLG/4,o=t.controlHeightSM/2,r=t.lineWidth+1,i=t.lineWidth+1*3;return{controlSize:n,railSize:4,handleSize:n,handleSizeHover:o,dotSize:8,handleLineWidth:r,handleLineWidthHover:i,railBg:t.colorFillTertiary,railHoverBg:t.colorFillSecondary,trackBg:t.colorPrimaryBorder,trackHoverBg:t.colorPrimaryBorderHover,handleColor:t.colorPrimaryBorder,handleActiveColor:t.colorPrimary,handleColorDisabled:new Wl(t.colorTextDisabled).onBackground(t.colorBgContainer).toHexShortString(),dotBorderColor:t.colorBorderSecondary,dotActiveBorderColor:t.colorPrimaryBorder,trackBgDisabled:t.colorBgContainerDisabled}},uYt=wl("Slider",t=>{const e=qi(t,{marginPart:t.calc(t.controlHeight).sub(t.controlSize).div(2).equal(),marginFull:t.calc(t.controlSize).div(2).equal(),marginPartWithMark:t.calc(t.controlHeightLG).sub(t.controlSize).equal()});return[aYt(e),lYt(e),sYt(e)]},cYt);function xie(){const[t,e]=m.useState(!1),n=m.useRef(),o=()=>{Ig.cancel(n.current)},r=i=>{o(),i?e(i):n.current=Ig(()=>{e(i)})};return m.useEffect(()=>o,[]),[t,r]}var dYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rtypeof n=="number"?n.toString():""}const Iu=be.forwardRef((t,e)=>{const{prefixCls:n,range:o,className:r,rootClassName:i,style:a,disabled:l,tooltipPrefixCls:s,tipFormatter:c,tooltipVisible:u,getTooltipPopupContainer:d,tooltipPlacement:f,tooltip:p={},onChangeComplete:g}=t,A=dYt(t,["prefixCls","range","className","rootClassName","style","disabled","tooltipPrefixCls","tipFormatter","tooltipVisible","getTooltipPopupContainer","tooltipPlacement","tooltip","onChangeComplete"]),{vertical:y}=t,{direction:S,slider:C,getPrefixCls:P,getPopupContainer:v}=be.useContext(Cr),T=be.useContext(n1),w=l??T,[x,b]=xie(),[R,H]=xie(),F=Object.assign({},p),{open:E,placement:N,getPopupContainer:U,prefixCls:W,formatter:k}=F,D=E??u,L=(x||R)&&D!==!1,j=fYt(k,c),[B,O]=xie(),V=pe=>{g==null||g(pe),O(!1)},G=(pe,ye)=>pe||(ye?S==="rtl"?"left":"right":"top"),q=P("slider",n),[$,ie,Q]=uYt(q),se=Un(r,C==null?void 0:C.className,i,{[`${q}-rtl`]:S==="rtl",[`${q}-lock`]:B},ie,Q);S==="rtl"&&!A.vertical&&(A.reverse=!A.reverse);const[oe,Z]=be.useMemo(()=>o?typeof o=="object"?[!0,o.draggableTrack]:[!0,!1]:[!1],[o]);be.useEffect(()=>{const pe=()=>{Ig(()=>{H(!1)},1)};return document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mouseup",pe)}},[]);const te=oe&&!D,ee=(pe,ye)=>{const{index:ae}=ye,Te=pe.props,ge=Object.assign(Object.assign({},Te),{onMouseEnter:De=>{var Ae;b(!0),(Ae=Te.onMouseEnter)===null||Ae===void 0||Ae.call(Te,De)},onMouseLeave:De=>{var Ae;b(!1),(Ae=Te.onMouseLeave)===null||Ae===void 0||Ae.call(Te,De)},onMouseDown:De=>{var Ae;H(!0),O(!0),(Ae=Te.onMouseDown)===null||Ae===void 0||Ae.call(Te,De)},onFocus:De=>{var Ae,ue;H(!0),(Ae=A.onFocus)===null||Ae===void 0||Ae.call(A,De),(ue=Te.onFocus)===null||ue===void 0||ue.call(Te,De)},onBlur:De=>{var Ae,ue;H(!1),(Ae=A.onBlur)===null||Ae===void 0||Ae.call(A,De),(ue=Te.onBlur)===null||ue===void 0||ue.call(Te,De)}}),Se=be.cloneElement(pe,ge),Re=(!!D||L)&&j!==null;return te?Se:be.createElement(Jxe,Object.assign({},F,{prefixCls:P("tooltip",W??s),title:j?j(ye.value):"",open:Re,placement:G(N??f,y),key:ae,overlayClassName:`${q}-tooltip`,getPopupContainer:U||d||v}),Se)},de=te?(pe,ye)=>{const ae=be.cloneElement(pe,{style:Object.assign(Object.assign({},pe.props.style),{visibility:"hidden"})});return be.createElement(Jxe,Object.assign({},F,{prefixCls:P("tooltip",W??s),title:j?j(ye.value):"",open:j!==null&&L,placement:G(N??f,y),key:"tooltip",overlayClassName:`${q}-tooltip`,getPopupContainer:U||d||v}),ae)}:void 0,fe=Object.assign(Object.assign({},C==null?void 0:C.style),a);return $(be.createElement(iYt,Object.assign({},A,{step:A.step,range:oe,draggableTrack:Z,className:se,style:fe,disabled:w,ref:e,prefixCls:q,handleRender:ee,activeHandleRender:de,onChangeComplete:V})))});var hYt=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],iKe=m.forwardRef(function(t,e){var n,o=t.prefixCls,r=o===void 0?"rc-switch":o,i=t.className,a=t.checked,l=t.defaultChecked,s=t.disabled,c=t.loadingIcon,u=t.checkedChildren,d=t.unCheckedChildren,f=t.onClick,p=t.onChange,g=t.onKeyDown,A=oi(t,hYt),y=Es(!1,{value:a,defaultValue:l}),S=sn(y,2),C=S[0],P=S[1];function v(b,R){var H=C;return s||(H=b,P(H),p==null||p(H,R)),H}function T(b){b.which===jn.LEFT?v(!1,b):b.which===jn.RIGHT&&v(!0,b),g==null||g(b)}function w(b){var R=v(!C,b);f==null||f(R,b)}var x=Xn(r,i,(n={},Jt(n,"".concat(r,"-checked"),C),Jt(n,"".concat(r,"-disabled"),s),n));return m.createElement("button",go({},A,{type:"button",role:"switch","aria-checked":C,disabled:s,className:x,ref:e,onKeyDown:T,onClick:w}),c,m.createElement("span",{className:"".concat(r,"-inner")},m.createElement("span",{className:"".concat(r,"-inner-checked")},u),m.createElement("span",{className:"".concat(r,"-inner-unchecked")},d)))});iKe.displayName="Switch";const pYt=t=>{const{componentCls:e,trackHeightSM:n,trackPadding:o,trackMinWidthSM:r,innerMinMarginSM:i,innerMaxMarginSM:a,handleSizeSM:l,calc:s}=t,c=`${e}-inner`,u=jt(s(l).add(s(o).mul(2)).equal()),d=jt(s(a).mul(2).equal());return{[e]:{[`&${e}-small`]:{minWidth:r,height:n,lineHeight:jt(n),[`${e}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${d})`,marginInlineEnd:`calc(100% - ${u} + ${d})`},[`${c}-unchecked`]:{marginTop:s(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${e}-handle`]:{width:l,height:l},[`${e}-loading-icon`]:{top:s(s(l).sub(t.switchLoadingIconSize)).div(2).equal(),fontSize:t.switchLoadingIconSize},[`&${e}-checked`]:{[`${e}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${d})`,marginInlineEnd:`calc(-100% + ${u} - ${d})`}},[`${e}-handle`]:{insetInlineStart:`calc(100% - ${jt(s(l).add(o).equal())})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:s(t.marginXXS).div(2).equal(),marginInlineEnd:s(t.marginXXS).mul(-1).div(2).equal()}},[`&${e}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:s(t.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:s(t.marginXXS).div(2).equal()}}}}}}},gYt=t=>{const{componentCls:e,handleSize:n,calc:o}=t;return{[e]:{[`${e}-loading-icon${t.iconCls}`]:{position:"relative",top:o(o(n).sub(t.fontSize)).div(2).equal(),color:t.switchLoadingIconColor,verticalAlign:"top"},[`&${e}-checked ${e}-loading-icon`]:{color:t.switchColor}}}},mYt=t=>{const{componentCls:e,trackPadding:n,handleBg:o,handleShadow:r,handleSize:i,calc:a}=t,l=`${e}-handle`;return{[e]:{[l]:{position:"absolute",top:n,insetInlineStart:n,width:i,height:i,transition:`all ${t.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:o,borderRadius:a(i).div(2).equal(),boxShadow:r,transition:`all ${t.switchDuration} ease-in-out`,content:'""'}},[`&${e}-checked ${l}`]:{insetInlineStart:`calc(100% - ${jt(a(i).add(n).equal())})`},[`&:not(${e}-disabled):active`]:{[`${l}::before`]:{insetInlineEnd:t.switchHandleActiveInset,insetInlineStart:0},[`&${e}-checked ${l}::before`]:{insetInlineEnd:0,insetInlineStart:t.switchHandleActiveInset}}}}},yYt=t=>{const{componentCls:e,trackHeight:n,trackPadding:o,innerMinMargin:r,innerMaxMargin:i,handleSize:a,calc:l}=t,s=`${e}-inner`,c=jt(l(a).add(l(o).mul(2)).equal()),u=jt(l(i).mul(2).equal());return{[e]:{[s]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:i,paddingInlineEnd:r,transition:`padding-inline-start ${t.switchDuration} ease-in-out, padding-inline-end ${t.switchDuration} ease-in-out`,[`${s}-checked, ${s}-unchecked`]:{display:"block",color:t.colorTextLightSolid,fontSize:t.fontSizeSM,transition:`margin-inline-start ${t.switchDuration} ease-in-out, margin-inline-end ${t.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${s}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${s}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${e}-checked ${s}`]:{paddingInlineStart:r,paddingInlineEnd:i,[`${s}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${s}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${e}-disabled):active`]:{[`&:not(${e}-checked) ${s}`]:{[`${s}-unchecked`]:{marginInlineStart:l(o).mul(2).equal(),marginInlineEnd:l(o).mul(-1).mul(2).equal()}},[`&${e}-checked ${s}`]:{[`${s}-checked`]:{marginInlineStart:l(o).mul(-1).mul(2).equal(),marginInlineEnd:l(o).mul(2).equal()}}}}}},AYt=t=>{const{componentCls:e,trackHeight:n,trackMinWidth:o}=t;return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},Na(t)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:o,height:n,lineHeight:`${jt(n)}`,verticalAlign:"middle",background:t.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${t.motionDurationMid}`,userSelect:"none",[`&:hover:not(${e}-disabled)`]:{background:t.colorTextTertiary}}),eA(t)),{[`&${e}-checked`]:{background:t.switchColor,[`&:hover:not(${e}-disabled)`]:{background:t.colorPrimaryHover}},[`&${e}-loading, &${e}-disabled`]:{cursor:"not-allowed",opacity:t.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${e}-rtl`]:{direction:"rtl"}})}},wYt=t=>{const{fontSize:e,lineHeight:n,controlHeight:o,colorWhite:r}=t,i=e*n,a=o/2,l=2,s=i-l*2,c=a-l*2;return{trackHeight:i,trackHeightSM:a,trackMinWidth:s*2+l*4,trackMinWidthSM:c*2+l*2,trackPadding:l,handleBg:r,handleSize:s,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new Wl("#00230b").setAlpha(.2).toRgbString()}`,innerMinMargin:s/2,innerMaxMargin:s+l+l*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+l+l*2}},vYt=wl("Switch",t=>{const e=qi(t,{switchDuration:t.motionDurationMid,switchColor:t.colorPrimary,switchDisabledOpacity:t.opacityLoading,switchLoadingIconSize:t.calc(t.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${t.opacityLoading})`,switchHandleActiveInset:"-30%"});return[AYt(e),yYt(e),mYt(e),gYt(e),pYt(e)]},wYt);var xYt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,size:o,disabled:r,loading:i,className:a,rootClassName:l,style:s,checked:c,value:u,defaultChecked:d,defaultValue:f,onChange:p}=t,g=xYt(t,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[A,y]=Z6(!1,{value:c??u,defaultValue:d??f}),{getPrefixCls:S,direction:C,switch:P}=m.useContext(Cr),v=m.useContext(n1),T=(r??v)||i,w=S("switch",n),x=m.createElement("div",{className:`${w}-handle`},i&&m.createElement(YH,{className:`${w}-loading-icon`})),[b,R,H]=vYt(w),F=zd(o),E=Un(P==null?void 0:P.className,{[`${w}-small`]:F==="small",[`${w}-loading`]:i,[`${w}-rtl`]:C==="rtl"},a,l,R,H),N=Object.assign(Object.assign({},P==null?void 0:P.style),s),U=function(){y(arguments.length<=0?void 0:arguments[0]),p==null||p.apply(void 0,arguments)};return b(m.createElement(UW,{component:"Switch"},m.createElement(iKe,Object.assign({},g,{checked:A,onChange:U,prefixCls:w,className:E,style:N,disabled:T,ref:e,loadingIcon:x}))))}),vc=bYt;vc.__ANT_SWITCH=!0;var q4={},nN="rc-table-internal-hook";function wye(t){var e=m.createContext(void 0),n=function(r){var i=r.value,a=r.children,l=m.useRef(i);l.current=i;var s=m.useState(function(){return{getValue:function(){return l.current},listeners:new Set}}),c=sn(s,1),u=c[0];return _a(function(){Hd.unstable_batchedUpdates(function(){u.listeners.forEach(function(d){d(i)})})},[i]),m.createElement(e.Provider,{value:u},a)};return{Context:e,Provider:n,defaultValue:t}}function Ah(t,e){var n=za(typeof e=="function"?e:function(d){if(e===void 0)return d;if(!Array.isArray(e))return d[e];var f={};return e.forEach(function(p){f[p]=d[p]}),f}),o=m.useContext(t==null?void 0:t.Context),r=o||{},i=r.listeners,a=r.getValue,l=m.useRef();l.current=n(o?a():t==null?void 0:t.defaultValue);var s=m.useState({}),c=sn(s,2),u=c[1];return _a(function(){if(!o)return;function d(f){var p=n(f);cw(l.current,p,!0)||u({})}return i.add(d),function(){i.delete(d)}},[o]),l.current}function SYt(){var t=m.createContext(null);function e(){return m.useContext(t)}function n(r,i){var a=sw(r),l=function(c,u){var d=a?{ref:u}:{},f=m.useRef(0),p=m.useRef(c),g=e();return g!==null?m.createElement(r,go({},c,d)):((!i||i(p.current,c))&&(f.current+=1),p.current=c,m.createElement(t.Provider,{value:f.current},m.createElement(r,go({},c,d))))};return a?m.forwardRef(l):l}function o(r,i){var a=sw(r),l=function(c,u){var d=a?{ref:u}:{};return e(),m.createElement(r,go({},c,d))};return a?m.memo(m.forwardRef(l),i):m.memo(l,i)}return{makeImmutable:n,responseImmutable:o,useImmutableMark:e}}var vye=SYt(),aKe=vye.makeImmutable,qH=vye.responseImmutable,TYt=vye.useImmutableMark,d1=wye(),lKe=m.createContext({renderWithProps:!1}),PYt="RC_TABLE_KEY";function CYt(t){return t==null?[]:Array.isArray(t)?t:[t]}function yQ(t){var e=[],n={};return t.forEach(function(o){for(var r=o||{},i=r.key,a=r.dataIndex,l=i||CYt(a).join("-")||PYt;n[l];)l="".concat(l,"_next");n[l]=!0,e.push(l)}),e}function bue(t){return t!=null}function RYt(t){return t&&hi(t)==="object"&&!Array.isArray(t)&&!m.isValidElement(t)}function HYt(t,e,n,o,r,i){var a=m.useContext(lKe),l=TYt(),s=DW(function(){if(bue(o))return[o];var c=e==null||e===""?[]:Array.isArray(e)?e:[e],u=mg(t,c),d=u,f=void 0;if(r){var p=r(u,t,n);RYt(p)?(d=p.children,f=p.props,a.renderWithProps=!0):d=p}return[d,f]},[l,t,o,e,r,n],function(c,u){if(i){var d=sn(c,2),f=d[1],p=sn(u,2),g=p[1];return i(g,f)}return a.renderWithProps?!0:!cw(c,u,!0)});return s}function MYt(t,e,n,o){var r=t+e-1;return t<=o&&r>=n}function IYt(t,e){return Ah(d1,function(n){var o=MYt(t,e||1,n.hoverStartRow,n.hoverEndRow);return[o,n.onHover]})}var zYt=function(e){var n=e.ellipsis,o=e.rowType,r=e.children,i,a=n===!0?{showTitle:!0}:n;return a&&(a.showTitle||o==="header")&&(typeof r=="string"||typeof r=="number"?i=r.toString():m.isValidElement(r)&&typeof r.props.children=="string"&&(i=r.props.children)),i};function DYt(t){var e,n,o,r,i,a,l,s,c=t.component,u=t.children,d=t.ellipsis,f=t.scope,p=t.prefixCls,g=t.className,A=t.align,y=t.record,S=t.render,C=t.dataIndex,P=t.renderIndex,v=t.shouldCellUpdate,T=t.index,w=t.rowType,x=t.colSpan,b=t.rowSpan,R=t.fixLeft,H=t.fixRight,F=t.firstFixLeft,E=t.lastFixLeft,N=t.firstFixRight,U=t.lastFixRight,W=t.appendNode,k=t.additionalProps,D=k===void 0?{}:k,L=t.isSticky,j="".concat(p,"-cell"),B=Ah(d1,["supportSticky","allColumnsFixedLeft","rowHoverable"]),O=B.supportSticky,V=B.allColumnsFixedLeft,G=B.rowHoverable,q=HYt(y,C,P,u,S,v),$=sn(q,2),ie=$[0],Q=$[1],se={},oe=typeof R=="number"&&O,Z=typeof H=="number"&&O;oe&&(se.position="sticky",se.left=R),Z&&(se.position="sticky",se.right=H);var te=(e=(n=(o=Q==null?void 0:Q.colSpan)!==null&&o!==void 0?o:D.colSpan)!==null&&n!==void 0?n:x)!==null&&e!==void 0?e:1,ee=(r=(i=(a=Q==null?void 0:Q.rowSpan)!==null&&a!==void 0?a:D.rowSpan)!==null&&i!==void 0?i:b)!==null&&r!==void 0?r:1,de=IYt(T,ee),fe=sn(de,2),pe=fe[0],ye=fe[1],ae=za(function(ue){var he;y&&ye(T,T+ee-1),D==null||(he=D.onMouseEnter)===null||he===void 0||he.call(D,ue)}),Te=za(function(ue){var he;y&&ye(-1,-1),D==null||(he=D.onMouseLeave)===null||he===void 0||he.call(D,ue)});if(te===0||ee===0)return null;var ge=(l=D.title)!==null&&l!==void 0?l:zYt({rowType:w,ellipsis:d,children:ie}),Se=Xn(j,g,(s={},Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(Jt(s,"".concat(j,"-fix-left"),oe&&O),"".concat(j,"-fix-left-first"),F&&O),"".concat(j,"-fix-left-last"),E&&O),"".concat(j,"-fix-left-all"),E&&V&&O),"".concat(j,"-fix-right"),Z&&O),"".concat(j,"-fix-right-first"),N&&O),"".concat(j,"-fix-right-last"),U&&O),"".concat(j,"-ellipsis"),d),"".concat(j,"-with-append"),W),"".concat(j,"-fix-sticky"),(oe||Z)&&L&&O),Jt(s,"".concat(j,"-row-hover"),!Q&&pe)),D.className,Q==null?void 0:Q.className),Re={};A&&(Re.textAlign=A);var De=en(en(en(en({},se),D.style),Re),Q==null?void 0:Q.style),Ae=ie;return hi(Ae)==="object"&&!Array.isArray(Ae)&&!m.isValidElement(Ae)&&(Ae=null),d&&(E||N)&&(Ae=m.createElement("span",{className:"".concat(j,"-content")},Ae)),m.createElement(c,go({},Q,D,{className:Se,style:De,title:ge,scope:f,onMouseEnter:G?ae:void 0,onMouseLeave:G?Te:void 0,colSpan:te!==1?te:null,rowSpan:ee!==1?ee:null}),W,Ae)}const Gb=m.memo(DYt);function xye(t,e,n,o,r){var i=n[t]||{},a=n[e]||{},l,s;i.fixed==="left"?l=o.left[r==="rtl"?e:t]:a.fixed==="right"&&(s=o.right[r==="rtl"?t:e]);var c=!1,u=!1,d=!1,f=!1,p=n[e+1],g=n[t-1],A=p&&!p.fixed||g&&!g.fixed||n.every(function(v){return v.fixed==="left"});if(r==="rtl"){if(l!==void 0){var y=g&&g.fixed==="left";f=!y&&A}else if(s!==void 0){var S=p&&p.fixed==="right";d=!S&&A}}else if(l!==void 0){var C=p&&p.fixed==="left";c=!C&&A}else if(s!==void 0){var P=g&&g.fixed==="right";u=!P&&A}return{fixLeft:l,fixRight:s,lastFixLeft:c,firstFixRight:u,lastFixRight:d,firstFixLeft:f,isSticky:o.isSticky}}var sKe=m.createContext({});function EYt(t){var e=t.className,n=t.index,o=t.children,r=t.colSpan,i=r===void 0?1:r,a=t.rowSpan,l=t.align,s=Ah(d1,["prefixCls","direction"]),c=s.prefixCls,u=s.direction,d=m.useContext(sKe),f=d.scrollColumnIndex,p=d.stickyOffsets,g=d.flattenColumns,A=n+i-1,y=A+1===f?i+1:i,S=xye(n,n+y-1,g,p,u);return m.createElement(Gb,go({className:e,index:n,component:"td",prefixCls:c,record:null,dataIndex:null,align:l,colSpan:y,rowSpan:a,render:function(){return o}},S))}var FYt=["children"];function kYt(t){var e=t.children,n=oi(t,FYt);return m.createElement("tr",n,e)}function AQ(t){var e=t.children;return e}AQ.Row=kYt;AQ.Cell=EYt;function LYt(t){var e=t.children,n=t.stickyOffsets,o=t.flattenColumns,r=Ah(d1,"prefixCls"),i=o.length-1,a=o[i],l=m.useMemo(function(){return{stickyOffsets:n,flattenColumns:o,scrollColumnIndex:a!=null&&a.scrollbar?i:null}},[a,o,i,n]);return m.createElement(sKe.Provider,{value:l},m.createElement("tfoot",{className:"".concat(r,"-summary")},e))}const YY=qH(LYt);var cKe=AQ;function WYt(t){return null}function NYt(t){return null}var uKe=function(e){if(fp()&&window.document.documentElement){var n=Array.isArray(e)?e:[e],o=window.document.documentElement;return n.some(function(r){return r in o.style})}return!1},UYt=function(e,n){if(!uKe(e))return!1;var o=document.createElement("div"),r=o.style[e];return o.style[e]=n,o.style[e]!==r};function jYt(t,e){return!Array.isArray(t)&&e!==void 0?UYt(t,e):uKe(t)}function dKe(t,e,n,o,r,i,a){t.push({record:e,indent:n,index:a});var l=i(e),s=r==null?void 0:r.has(l);if(e&&Array.isArray(e[o])&&s)for(var c=0;c1?F-1:0),N=1;N=1?T:""),style:en(en({},n),S==null?void 0:S.style)}),g.map(function(R,H){var F=R.render,E=R.dataIndex,N=R.className,U=gKe(f,R,H,s,r),W=U.key,k=U.fixedInfo,D=U.appendCellNode,L=U.additionalCellProps;return m.createElement(Gb,go({className:N,ellipsis:R.ellipsis,align:R.align,scope:R.rowScope,component:R.rowScope?d:u,prefixCls:p,key:W,record:o,index:r,renderIndex:i,dataIndex:E,render:F,shouldCellUpdate:R.shouldCellUpdate},k,{appendNode:D,additionalProps:L}))})),x;if(P&&(v.current||C)){var b=y(o,r,s+1,C);x=m.createElement(pKe,{expanded:C,className:Xn("".concat(p,"-expanded-row"),"".concat(p,"-expanded-row-level-").concat(s+1),T),prefixCls:p,component:c,cellComponent:u,colSpan:g.length,isEmpty:!1},b)}return m.createElement(m.Fragment,null,w,x)}const YYt=qH(BYt);function OYt(t){var e=t.columnKey,n=t.onColumnResize,o=m.useRef();return m.useEffect(function(){o.current&&n(e,o.current.offsetWidth)},[]),m.createElement(Cd,{data:e},m.createElement("td",{ref:o,style:{padding:0,border:0,height:0}},m.createElement("div",{style:{height:0,overflow:"hidden"}}," ")))}function VYt(t){var e=t.prefixCls,n=t.columnsKey,o=t.onColumnResize;return m.createElement("tr",{"aria-hidden":"true",className:"".concat(e,"-measure-row"),style:{height:0,fontSize:0}},m.createElement(Cd.Collection,{onBatchResize:function(i){i.forEach(function(a){var l=a.data,s=a.size;o(l,s.offsetWidth)})}},n.map(function(r){return m.createElement(OYt,{key:r,columnKey:r,onColumnResize:o})})))}function _Yt(t){var e=t.data,n=t.measureColumnWidth,o=Ah(d1,["prefixCls","getComponent","onColumnResize","flattenColumns","getRowKey","expandedKeys","childrenColumnName","emptyNode"]),r=o.prefixCls,i=o.getComponent,a=o.onColumnResize,l=o.flattenColumns,s=o.getRowKey,c=o.expandedKeys,u=o.childrenColumnName,d=o.emptyNode,f=fKe(e,u,c,s),p=m.useRef({renderWithProps:!1}),g=i(["body","wrapper"],"tbody"),A=i(["body","row"],"tr"),y=i(["body","cell"],"td"),S=i(["body","cell"],"th"),C;e.length?C=f.map(function(v,T){var w=v.record,x=v.indent,b=v.index,R=s(w,T);return m.createElement(YYt,{key:R,rowKey:R,record:w,index:T,renderIndex:b,rowComponent:A,cellComponent:y,scopeCellComponent:S,getRowKey:s,indent:x})}):C=m.createElement(pKe,{expanded:!0,className:"".concat(r,"-placeholder"),prefixCls:r,component:A,cellComponent:y,colSpan:l.length,isEmpty:!0},d);var P=yQ(l);return m.createElement(lKe.Provider,{value:p.current},m.createElement(g,{className:"".concat(r,"-tbody")},n&&m.createElement(VYt,{prefixCls:r,columnsKey:P,onColumnResize:a}),C))}const GYt=qH(_Yt);var XYt=["expandable"],HE="RC_TABLE_INTERNAL_COL_DEFINE";function JYt(t){var e=t.expandable,n=oi(t,XYt),o;return"expandable"in t?o=en(en({},n),e):o=n,o.showExpandColumn===!1&&(o.expandIconColumnIndex=-1),o}var KYt=["columnType"];function mKe(t){for(var e=t.colWidths,n=t.columns,o=t.columCount,r=[],i=o||n.length,a=!1,l=i-1;l>=0;l-=1){var s=e[l],c=n&&n[l],u=c&&c[HE];if(s||u||a){var d=u||{};d.columnType;var f=oi(d,KYt);r.unshift(m.createElement("col",go({key:l,style:{width:s}},f))),a=!0}}return m.createElement("colgroup",null,r)}var qYt=["className","noData","columns","flattenColumns","colWidths","columCount","stickyOffsets","direction","fixHeader","stickyTopOffset","stickyBottomOffset","stickyClassName","onScroll","maxContentScroll","children"];function $Yt(t,e){return m.useMemo(function(){for(var n=[],o=0;o1?"colgroup":"col":null,ellipsis:y.ellipsis,align:y.align,component:a,prefixCls:u,key:p[A]},S,{additionalProps:C,rowType:"header"}))}))};function eOt(t){var e=[];function n(a,l){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;e[s]=e[s]||[];var c=l,u=a.filter(Boolean).map(function(d){var f={key:d.key,className:d.className||"",children:d.title,column:d,colStart:c},p=1,g=d.children;return g&&g.length>0&&(p=n(g,c,s+1).reduce(function(A,y){return A+y},0),f.hasSubColumns=!0),"colSpan"in d&&(p=d.colSpan),"rowSpan"in d&&(f.rowSpan=d.rowSpan),f.colSpan=p,f.colEnd=f.colStart+p-1,e[s].push(f),c+=p,p});return u}n(t,0);for(var o=e.length,r=function(l){e[l].forEach(function(s){!("rowSpan"in s)&&!s.hasSubColumns&&(s.rowSpan=o-l)})},i=0;i1&&arguments[1]!==void 0?arguments[1]:"";return typeof e=="number"?e:e.endsWith("%")?t*parseFloat(e)/100:null}function nOt(t,e,n){return m.useMemo(function(){if(e&&e>0){var o=0,r=0;t.forEach(function(f){var p=$xe(e,f.width);p?o+=p:r+=1});var i=Math.max(e,n),a=Math.max(i-o,r),l=r,s=a/r,c=0,u=t.map(function(f){var p=en({},f),g=$xe(e,p.width);if(g)p.width=g;else{var A=Math.floor(s);p.width=l===1?a:A,a-=A,l-=1}return c+=p.width,p});if(c0?en(en({},e),{},{children:yKe(n)}):e})}function Sue(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key";return t.filter(function(n){return n&&hi(n)==="object"}).reduce(function(n,o,r){var i=o.fixed,a=i===!0?"left":i,l="".concat(e,"-").concat(r),s=o.children;return s&&s.length>0?[].concat(No(n),No(Sue(s,l).map(function(c){return en({fixed:a},c)}))):[].concat(No(n),[en(en({key:l},o),{},{fixed:a})])},[])}function iOt(t){return t.map(function(e){var n=e.fixed,o=oi(e,rOt),r=n;return n==="left"?r="right":n==="right"&&(r="left"),en({fixed:r},o)})}function aOt(t,e){var n=t.prefixCls,o=t.columns,r=t.children,i=t.expandable,a=t.expandedKeys,l=t.columnTitle,s=t.getRowKey,c=t.onTriggerExpand,u=t.expandIcon,d=t.rowExpandable,f=t.expandIconColumnIndex,p=t.direction,g=t.expandRowByClick,A=t.columnWidth,y=t.fixed,S=t.scrollWidth,C=t.clientWidth,P=m.useMemo(function(){var E=o||bye(r)||[];return yKe(E.slice())},[o,r]),v=m.useMemo(function(){if(i){var E=P.slice();if(!E.includes(q4)){var N=f||0;N>=0&&E.splice(N,0,q4)}var U=E.indexOf(q4);E=E.filter(function(L,j){return L!==q4||j===U});var W=P[U],k;(y==="left"||y)&&!f?k="left":(y==="right"||y)&&f===P.length?k="right":k=W?W.fixed:null;var D=Jt(Jt(Jt(Jt(Jt(Jt({},HE,{className:"".concat(n,"-expand-icon-col"),columnType:"EXPAND_COLUMN"}),"title",l),"fixed",k),"className","".concat(n,"-row-expand-icon-cell")),"width",A),"render",function(j,B,O){var V=s(B,O),G=a.has(V),q=d?d(B):!0,$=u({prefixCls:n,expanded:G,expandable:q,record:B,onExpand:c});return g?m.createElement("span",{onClick:function(Q){return Q.stopPropagation()}},$):$});return E.map(function(L){return L===q4?D:L})}return P.filter(function(L){return L!==q4})},[i,P,s,a,u,p]),T=m.useMemo(function(){var E=v;return e&&(E=e(E)),E.length||(E=[{render:function(){return null}}]),E},[e,v,p]),w=m.useMemo(function(){return p==="rtl"?iOt(Sue(T)):Sue(T)},[T,p,S]),x=m.useMemo(function(){for(var E=-1,N=w.length-1;N>=0;N-=1){var U=w[N].fixed;if(U==="left"||U===!0){E=N;break}}if(E>=0)for(var W=0;W<=E;W+=1){var k=w[W].fixed;if(k!=="left"&&k!==!0)return!0}var D=w.findIndex(function(B){var O=B.fixed;return O==="right"});if(D>=0)for(var L=D;L=d&&(L=d-f),a({scrollLeft:L/d*(u+2)}),C.current.x=U.pageX},F=function(){x.current=Ea(function(){if(i.current){var U=Uxe(i.current).top,W=U+i.current.offsetHeight,k=s===window?document.documentElement.scrollTop+window.innerHeight:Uxe(s).top+s.clientHeight;W-L0e()<=k||U>=k-l?S(function(D){return en(en({},D),{},{isHiddenScrollBar:!0})}):S(function(D){return en(en({},D),{},{isHiddenScrollBar:!1})})}})},E=function(U){S(function(W){return en(en({},W),{},{scrollLeft:U/u*d||0})})};return m.useImperativeHandle(n,function(){return{setScrollLeft:E,checkScrollBarVisible:F}}),m.useEffect(function(){var N=BY(document.body,"mouseup",b,!1),U=BY(document.body,"mousemove",H,!1);return F(),function(){N.remove(),U.remove()}},[f,T]),m.useEffect(function(){var N=BY(s,"scroll",F,!1),U=BY(window,"resize",F,!1);return function(){N.remove(),U.remove()}},[s]),m.useEffect(function(){y.isHiddenScrollBar||S(function(N){var U=i.current;return U?en(en({},N),{},{scrollLeft:U.scrollLeft/U.scrollWidth*U.clientWidth}):N})},[y.isHiddenScrollBar]),u<=d||!f||y.isHiddenScrollBar?null:m.createElement("div",{style:{height:L0e(),width:d,bottom:l},className:"".concat(c,"-sticky-scroll")},m.createElement("div",{onMouseDown:R,ref:p,className:Xn("".concat(c,"-sticky-scroll-bar"),Jt({},"".concat(c,"-sticky-scroll-bar-active"),T)),style:{width:"".concat(f,"px"),transform:"translate3d(".concat(y.scrollLeft,"px, 0, 0)")}}))};const mOt=m.forwardRef(gOt);var wKe="rc-table",yOt=[],AOt={};function wOt(){return"No Data"}function vOt(t,e){var n=en({rowKey:"key",prefixCls:wKe,emptyText:wOt},t),o=n.prefixCls,r=n.className,i=n.rowClassName,a=n.style,l=n.data,s=n.rowKey,c=n.scroll,u=n.tableLayout,d=n.direction,f=n.title,p=n.footer,g=n.summary,A=n.caption,y=n.id,S=n.showHeader,C=n.components,P=n.emptyText,v=n.onRow,T=n.onHeaderRow,w=n.onScroll,x=n.internalHooks,b=n.transformColumns,R=n.internalRefs,H=n.tailor,F=n.getContainerWidth,E=n.sticky,N=n.rowHoverable,U=N===void 0?!0:N,W=l||yOt,k=!!W.length,D=x===nN,L=m.useCallback(function(So,Qo){return mg(C,So)||Qo},[C]),j=m.useMemo(function(){return typeof s=="function"?s:function(So){var Qo=So&&So[s];return Qo}},[s]),B=L(["body"]),O=fOt(),V=sn(O,3),G=V[0],q=V[1],$=V[2],ie=cOt(n,W,j),Q=sn(ie,6),se=Q[0],oe=Q[1],Z=Q[2],te=Q[3],ee=Q[4],de=Q[5],fe=c==null?void 0:c.x,pe=m.useState(0),ye=sn(pe,2),ae=ye[0],Te=ye[1],ge=aOt(en(en(en({},n),se),{},{expandable:!!se.expandedRowRender,columnTitle:se.columnTitle,expandedKeys:Z,getRowKey:j,onTriggerExpand:de,expandIcon:te,expandIconColumnIndex:se.expandIconColumnIndex,direction:d,scrollWidth:D&&H&&typeof fe=="number"?fe:null,clientWidth:ae}),D?b:null),Se=sn(ge,4),Re=Se[0],De=Se[1],Ae=Se[2],ue=Se[3],he=Ae??fe,ve=m.useMemo(function(){return{columns:Re,flattenColumns:De}},[Re,De]),we=m.useRef(),Pe=m.useRef(),Ie=m.useRef(),Me=m.useRef();m.useImperativeHandle(e,function(){return{nativeElement:we.current,scrollTo:function(Qo){var Yo;if(Ie.current instanceof HTMLElement){var lr=Qo.index,fr=Qo.top,ei=Qo.key;if(fr){var hr;(hr=Ie.current)===null||hr===void 0||hr.scrollTo({top:fr})}else{var tr,bi=ei??j(W[lr]);(tr=Ie.current.querySelector('[data-row-key="'.concat(bi,'"]')))===null||tr===void 0||tr.scrollIntoView()}}else(Yo=Ie.current)!==null&&Yo!==void 0&&Yo.scrollTo&&Ie.current.scrollTo(Qo)}}});var ze=m.useRef(),Ne=m.useState(!1),Je=sn(Ne,2),Ue=Je[0],nt=Je[1],We=m.useState(!1),Ee=sn(We,2),ke=Ee[0],Oe=Ee[1],st=AKe(new Map),je=sn(st,2),xt=je[0],gt=je[1],Ye=yQ(De),it=Ye.map(function(So){return xt.get(So)}),ut=m.useMemo(function(){return it},[it.join("_")]),Qe=pOt(ut,De,d),lt=c&&bue(c.y),Ze=c&&bue(he)||!!se.fixed,Be=Ze&&De.some(function(So){var Qo=So.fixed;return Qo}),$e=m.useRef(),wt=hOt(E,o),vt=wt.isSticky,Rt=wt.offsetHeader,Gt=wt.offsetSummary,At=wt.offsetScroll,pt=wt.stickyClassName,Wt=wt.container,ht=m.useMemo(function(){return g==null?void 0:g(W)},[g,W]),ct=(lt||vt)&&m.isValidElement(ht)&&ht.type===AQ&&ht.props.fixed,It,Ft,Ve;lt&&(Ft={overflowY:"scroll",maxHeight:c.y}),Ze&&(It={overflowX:"auto"},lt||(Ft={overflowY:"hidden"}),Ve={width:he===!0?"auto":he,minWidth:"100%"});var ft=m.useCallback(function(So,Qo){K$(we.current)&>(function(Yo){if(Yo.get(So)!==Qo){var lr=new Map(Yo);return lr.set(So,Qo),lr}return Yo})},[]),kt=dOt(),rt=sn(kt,2),at=rt[0],Ge=rt[1];function yt(So,Qo){Qo&&(typeof Qo=="function"?Qo(So):Qo.scrollLeft!==So&&(Qo.scrollLeft=So,Qo.scrollLeft!==So&&setTimeout(function(){Qo.scrollLeft=So},0)))}var Pt=za(function(So){var Qo=So.currentTarget,Yo=So.scrollLeft,lr=d==="rtl",fr=typeof Yo=="number"?Yo:Qo.scrollLeft,ei=Qo||AOt;if(!Ge()||Ge()===ei){var hr;at(ei),yt(fr,Pe.current),yt(fr,Ie.current),yt(fr,ze.current),yt(fr,(hr=$e.current)===null||hr===void 0?void 0:hr.setScrollLeft)}var tr=Qo||Pe.current;if(tr){var bi=tr.scrollWidth,Fo=tr.clientWidth;if(bi===Fo){nt(!1),Oe(!1);return}lr?(nt(-fr0)):(nt(fr>0),Oe(fr1?y-U:0,k=en(en(en({},b),c),{},{flex:"0 0 ".concat(U,"px"),width:"".concat(U,"px"),marginRight:W,pointerEvents:"auto"}),D=m.useMemo(function(){return d?E<=1:H===0||E===0||E>1},[E,H,d]);D?k.visibility="hidden":d&&(k.height=f==null?void 0:f(E));var L=D?function(){return null}:p,j={};return(E===0||H===0)&&(j.rowSpan=1,j.colSpan=1),m.createElement(Gb,go({className:Xn(A,u),ellipsis:n.ellipsis,align:n.align,scope:n.rowScope,component:a,prefixCls:e.prefixCls,key:v,record:s,index:i,renderIndex:l,dataIndex:g,render:L,shouldCellUpdate:n.shouldCellUpdate},T,{appendNode:w,additionalProps:en(en({},x),{},{style:k},j)}))}var TOt=["data","index","className","rowKey","style","extra","getHeight"],POt=m.forwardRef(function(t,e){var n=t.data,o=t.index,r=t.className,i=t.rowKey,a=t.style,l=t.extra,s=t.getHeight,c=oi(t,TOt),u=n.record,d=n.indent,f=n.index,p=Ah(d1,["prefixCls","flattenColumns","fixColumn","componentWidth","scrollX"]),g=p.scrollX,A=p.flattenColumns,y=p.prefixCls,S=p.fixColumn,C=p.componentWidth,P=Ah(Sye,["getComponent"]),v=P.getComponent,T=hKe(u,i,o,d),w=v(["body","row"],"div"),x=v(["body","cell"],"div"),b=T.rowSupportExpand,R=T.expanded,H=T.rowProps,F=T.expandedRowRender,E=T.expandedRowClassName,N;if(b&&R){var U=F(u,o,d+1,R),W=E==null?void 0:E(u,o,d),k={};S&&(k={style:Jt({},"--virtual-width","".concat(C,"px"))});var D="".concat(y,"-expanded-row-cell");N=m.createElement(w,{className:Xn("".concat(y,"-expanded-row"),"".concat(y,"-expanded-row-level-").concat(d+1),W)},m.createElement(Gb,{component:x,prefixCls:y,className:Xn(D,Jt({},"".concat(D,"-fixed"),S)),additionalProps:k},U))}var L=en(en({},a),{},{width:g});l&&(L.position="absolute",L.pointerEvents="none");var j=m.createElement(w,go({},H,c,{"data-row-key":i,ref:b?null:e,className:Xn(r,"".concat(y,"-row"),H==null?void 0:H.className,Jt({},"".concat(y,"-row-extra"),l)),style:en(en({},L),H==null?void 0:H.style)}),A.map(function(B,O){return m.createElement(SOt,{key:O,component:x,rowInfo:T,column:B,colIndex:O,indent:d,index:o,renderIndex:f,record:u,inverse:l,getHeight:s})}));return b?m.createElement("div",{ref:e},j,N):j}),ebe=qH(POt),COt=m.forwardRef(function(t,e){var n=t.data,o=t.onScroll,r=Ah(d1,["flattenColumns","onColumnResize","getRowKey","prefixCls","expandedKeys","childrenColumnName","emptyNode","scrollX"]),i=r.flattenColumns,a=r.onColumnResize,l=r.getRowKey,s=r.expandedKeys,c=r.prefixCls,u=r.childrenColumnName,d=r.emptyNode,f=r.scrollX,p=Ah(Sye),g=p.sticky,A=p.scrollY,y=p.listItemHeight,S=p.getComponent,C=p.onScroll,P=m.useRef(),v=fKe(n,u,s,l),T=m.useMemo(function(){var k=0;return i.map(function(D){var L=D.width,j=D.key;return k+=L,[j,L,k]})},[i]),w=m.useMemo(function(){return T.map(function(k){return k[2]})},[T]);m.useEffect(function(){T.forEach(function(k){var D=sn(k,2),L=D[0],j=D[1];a(L,j)})},[T]),m.useImperativeHandle(e,function(){var k={scrollTo:function(L){var j;(j=P.current)===null||j===void 0||j.scrollTo(L)}};return Object.defineProperty(k,"scrollLeft",{get:function(){var L;return((L=P.current)===null||L===void 0?void 0:L.getScrollInfo().x)||0},set:function(L){var j;(j=P.current)===null||j===void 0||j.scrollTo({left:L})}}),k});var x=function(D,L){var j,B=(j=v[L])===null||j===void 0?void 0:j.record,O=D.onCell;if(O){var V,G=O(B,L);return(V=G==null?void 0:G.rowSpan)!==null&&V!==void 0?V:1}return 1},b=function(D){var L=D.start,j=D.end,B=D.getSize,O=D.offsetY;if(j<0)return null;for(var V=i.filter(function(fe){return x(fe,L)===0}),G=L,q=function(pe){if(V=V.filter(function(ye){return x(ye,pe)===0}),!V.length)return G=pe,1},$=L;$>=0&&!q($);$-=1);for(var ie=i.filter(function(fe){return x(fe,j)!==1}),Q=j,se=function(pe){if(ie=ie.filter(function(ye){return x(ye,pe)!==1}),!ie.length)return Q=Math.max(pe-1,j),1},oe=j;oe1})&&Z.push(pe)},ee=G;ee<=Q;ee+=1)te(ee);var de=Z.map(function(fe){var pe=v[fe],ye=l(pe.record,fe),ae=function(Se){var Re=fe+Se-1,De=l(v[Re].record,Re),Ae=B(ye,De);return Ae.bottom-Ae.top},Te=B(ye);return m.createElement(ebe,{key:fe,data:pe,rowKey:ye,index:fe,style:{top:-O+Te.top},extra:!0,getHeight:ae})});return de},R=m.useMemo(function(){return{columnsOffset:w}},[w]),H="".concat(c,"-tbody"),F=S(["body","wrapper"]),E=S(["body","row"],"div"),N=S(["body","cell"],"div"),U;if(v.length){var W={};g&&(W.position="sticky",W.bottom=0,hi(g)==="object"&&g.offsetScroll&&(W.bottom=g.offsetScroll)),U=m.createElement(q$,{fullHeight:!1,ref:P,prefixCls:"".concat(H,"-virtual"),styles:{horizontalScrollBar:W},className:H,height:A,itemHeight:y||24,data:v,itemKey:function(D){return l(D.record)},component:F,scrollWidth:f,onVirtualScroll:function(D){var L=D.x;o({scrollLeft:L})},onScroll:C,extraRender:b},function(k,D,L){var j=l(k.record,D);return m.createElement(ebe,go({data:k,rowKey:j,index:D},L))})}else U=m.createElement(E,{className:Xn("".concat(c,"-placeholder"))},m.createElement(Gb,{component:N,prefixCls:c},d));return m.createElement(xKe.Provider,{value:R},U)}),ROt=qH(COt),HOt=function(e,n){var o=n.ref,r=n.onScroll;return m.createElement(ROt,{ref:o,data:e,onScroll:r})};function MOt(t,e){var n=t.columns,o=t.scroll,r=t.sticky,i=t.prefixCls,a=i===void 0?wKe:i,l=t.className,s=t.listItemHeight,c=t.components,u=t.onScroll,d=o||{},f=d.x,p=d.y;typeof f!="number"&&(f=1),typeof p!="number"&&(p=500);var g=za(function(S,C){return mg(c,S)||C}),A=za(u),y=m.useMemo(function(){return{sticky:r,scrollY:p,listItemHeight:s,getComponent:g,onScroll:A}},[r,p,s,g,A]);return m.createElement(Sye.Provider,{value:y},m.createElement($H,go({},t,{className:Xn(l,"".concat(a,"-virtual")),scroll:en(en({},o),{},{x:f}),components:en(en({},c),{},{body:HOt}),columns:n,internalHooks:nN,tailor:!0,ref:e})))}var IOt=m.forwardRef(MOt);function bKe(t){return aKe(IOt,t)}bKe();function zOt(t){return null}function DOt(t){return null}function Tue(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&(n[r]=t[r]);return n}function wQ(t,e){if(t==null)return{};var n=LOt(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var Pue={},WOt=function(e){};function NOt(t,e){}function UOt(t,e){}function jOt(){Pue={}}function TKe(t,e,n){!e&&!Pue[n]&&(t(!1,n),Pue[n]=!0)}function b2(t,e){TKe(NOt,t,e)}function BOt(t,e){TKe(UOt,t,e)}b2.preMessage=WOt;b2.resetWarned=jOt;b2.noteOnce=BOt;function YOt(t,e){if(aA(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(aA(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PKe(t){var e=YOt(t,"string");return aA(e)==="symbol"?e:String(e)}function Vo(t,e,n){return e=PKe(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tbe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Ru(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function VOt(t,e){if(e&&(aA(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wr(t)}function MKe(t){var e=OOt();return function(){var o=qG(t),r;if(e){var i=qG(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return VOt(this,r)}}var IKe={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see @@ -4677,8 +4677,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata - onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,JOt="".concat(GOt," ").concat(XOt).split(/[\s\n]+/),KOt="aria-",qOt="data-";function obe(t,e){return t.indexOf(e)===0}function zKe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=Ru({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||obe(r,KOt))||n.data&&obe(r,qOt)||n.attr&&JOt.includes(r))&&(o[r]=t[r])}),o}var Tye=m.createContext(null),$Ot=function(e){for(var n=e.prefixCls,o=e.level,r=e.isStart,i=e.isEnd,a="".concat(n,"-indent-unit"),l=[],s=0;s1&&arguments[1]!==void 0?arguments[1]:{},n=[];return be.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Rue(o)):HC.isFragment(o)&&o.props?n=n.concat(Rue(o.props.children,e)):n.push(o))}),n}function ZOt(t,e){var n=Ru({},t);return Array.isArray(e)&&e.forEach(function(o){delete n[o]}),n}var eVt=["children"];function DKe(t,e){return"".concat(t,"-").concat(e)}function tVt(t){return t&&t.type&&t.type.isTreeNode}function oN(t,e){return t??e}function bR(t){var e=t||{},n=e.title,o=e._title,r=e.key,i=e.children,a=n||"title";return{title:a,_title:o||[a],key:r||"key",children:i||"children"}}function EKe(t){function e(n){var o=Rue(n);return o.map(function(r){if(!tVt(r))return b2(!r,"Tree/TreeNode can only accept TreeNode as children."),null;var i=r.key,a=r.props,l=a.children,s=wQ(a,eVt),c=Ru({key:i},s),u=e(l);return u.length&&(c.children=u),c}).filter(function(r){return r})}return e(t)}function bie(t,e,n){var o=bR(n),r=o._title,i=o.key,a=o.children,l=new Set(e===!0?[]:e),s=[];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return u.map(function(f,p){for(var g=DKe(d?d.pos:"0",p),A=oN(f[i],g),y,S=0;S1&&arguments[1]!==void 0?arguments[1]:{},n=e.initWrapper,o=e.processEntity,r=e.onProcessFinished,i=e.externalGetKey,a=e.childrenPropName,l=e.fieldNames,s=arguments.length>2?arguments[2]:void 0,c=i||s,u={},d={},f={posEntities:u,keyEntities:d};return n&&(f=n(f)||f),nVt(t,function(p){var g=p.node,A=p.index,y=p.pos,S=p.key,C=p.parentPos,P=p.level,v=p.nodes,T={node:g,nodes:v,index:A,key:S,pos:y,level:P},w=oN(S,y);u[y]=T,d[w]=T,T.parent=u[C],T.parent&&(T.parent.children=T.parent.children||[],T.parent.children.push(T)),o&&o(T,f)},{externalGetKey:c,childrenPropName:a,fieldNames:l}),r&&r(f),f}function ME(t,e){var n=e.expandedKeys,o=e.selectedKeys,r=e.loadedKeys,i=e.loadingKeys,a=e.checkedKeys,l=e.halfCheckedKeys,s=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities,d=Np(u,t),f={eventKey:t,expanded:n.indexOf(t)!==-1,selected:o.indexOf(t)!==-1,loaded:r.indexOf(t)!==-1,loading:i.indexOf(t)!==-1,checked:a.indexOf(t)!==-1,halfChecked:l.indexOf(t)!==-1,pos:String(d?d.pos:""),dragOver:s===t&&c===0,dragOverGapTop:s===t&&c===-1,dragOverGapBottom:s===t&&c===1};return f}function tu(t){var e=t.data,n=t.expanded,o=t.selected,r=t.checked,i=t.loaded,a=t.loading,l=t.halfChecked,s=t.dragOver,c=t.dragOverGapTop,u=t.dragOverGapBottom,d=t.pos,f=t.active,p=t.eventKey,g=Ru(Ru({},e),{},{expanded:n,selected:o,checked:r,loaded:i,loading:a,halfChecked:l,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,key:p});return"props"in g||Object.defineProperty(g,"props",{get:function(){return b2(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),g}var oVt=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],rbe="open",ibe="close",rVt="---",iVt=function(t){HKe(n,t);var e=MKe(n);function n(){var o;CKe(this,n);for(var r=arguments.length,i=new Array(r),a=0;a=0&&n.splice(o,1),n}function f6(t,e){var n=(t||[]).slice();return n.indexOf(e)===-1&&n.push(e),n}function Cye(t){return t.split("-")}function aVt(t,e){var n=[],o=Np(e,t);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(a){var l=a.key,s=a.children;n.push(l),r(s)})}return r(o.children),n}function lVt(t){if(t.parent){var e=Cye(t.pos);return Number(e[e.length-1])===t.parent.children.length-1}return!1}function sVt(t){var e=Cye(t.pos);return Number(e[e.length-1])===0}function abe(t,e,n,o,r,i,a,l,s,c){var u,d=t.clientX,f=t.clientY,p=t.target.getBoundingClientRect(),g=p.top,A=p.height,y=(c==="rtl"?-1:1)*(((r==null?void 0:r.x)||0)-d),S=(y-12)/o,C=s.filter(function(k){var D;return(D=l[k])===null||D===void 0||(D=D.children)===null||D===void 0?void 0:D.length}),P=Np(l,n.props.eventKey);if(f-1.5?i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:0})?H=0:i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1,{dropPosition:H,dropLevelOffset:F,dropTargetKey:P.key,dropTargetPos:P.pos,dragOverNodeKey:R,dropContainerKey:H===0?null:((u=P.parent)===null||u===void 0?void 0:u.key)||null,dropAllowed:W}}function lbe(t,e){if(t){var n=e.multiple;return n?t.slice():t.length?[t[0]]:t}}function Sie(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else if(aA(t)==="object")e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0};else return b2(!1,"`checkedKeys` is not an array or an object"),null;return e}function Hue(t,e){var n=new Set;function o(r){if(!n.has(r)){var i=Np(e,r);if(i){n.add(r);var a=i.parent,l=i.node;l.disabled||a&&o(a.key)}}}return(t||[]).forEach(function(r){o(r)}),bx(n)}function FKe(t,e){var n=new Set;return t.forEach(function(o){e.has(o)||n.add(o)}),n}function cVt(t){var e=t||{},n=e.disabled,o=e.disableCheckbox,r=e.checkable;return!!(n||o)||r===!1}function uVt(t,e,n,o){for(var r=new Set(t),i=new Set,a=0;a<=n;a+=1){var l=e.get(a)||new Set;l.forEach(function(d){var f=d.key,p=d.node,g=d.children,A=g===void 0?[]:g;r.has(f)&&!o(p)&&A.filter(function(y){return!o(y.node)}).forEach(function(y){r.add(y.key)})})}for(var s=new Set,c=n;c>=0;c-=1){var u=e.get(c)||new Set;u.forEach(function(d){var f=d.parent,p=d.node;if(!(o(p)||!d.parent||s.has(d.parent.key))){if(o(d.parent.node)){s.add(f.key);return}var g=!0,A=!1;(f.children||[]).filter(function(y){return!o(y.node)}).forEach(function(y){var S=y.key,C=r.has(S);g&&!C&&(g=!1),!A&&(C||i.has(S))&&(A=!0)}),g&&r.add(f.key),A&&i.add(f.key),s.add(f.key)}})}return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(FKe(i,r))}}function dVt(t,e,n,o,r){for(var i=new Set(t),a=new Set(e),l=0;l<=o;l+=1){var s=n.get(l)||new Set;s.forEach(function(f){var p=f.key,g=f.node,A=f.children,y=A===void 0?[]:A;!i.has(p)&&!a.has(p)&&!r(g)&&y.filter(function(S){return!r(S.node)}).forEach(function(S){i.delete(S.key)})})}a=new Set;for(var c=new Set,u=o;u>=0;u-=1){var d=n.get(u)||new Set;d.forEach(function(f){var p=f.parent,g=f.node;if(!(r(g)||!f.parent||c.has(f.parent.key))){if(r(f.parent.node)){c.add(p.key);return}var A=!0,y=!1;(p.children||[]).filter(function(S){return!r(S.node)}).forEach(function(S){var C=S.key,P=i.has(C);A&&!P&&(A=!1),!y&&(P||a.has(C))&&(y=!0)}),A||i.delete(p.key),y&&a.add(p.key),c.add(p.key)}})}return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(FKe(a,i))}}function zC(t,e,n,o){var r=[],i;o?i=o:i=cVt;var a=new Set(t.filter(function(u){var d=!!Np(n,u);return d||r.push(u),d})),l=new Map,s=0;Object.keys(n).forEach(function(u){var d=n[u],f=d.level,p=l.get(f);p||(p=new Set,l.set(f,p)),p.add(d),s=Math.max(s,f)}),b2(!r.length,"Tree missing follow keys: ".concat(r.slice(0,100).map(function(u){return"'".concat(u,"'")}).join(", ")));var c;return e===!0?c=uVt(a,l,s,i):c=dVt(a,e.halfCheckedKeys,l,s,i),c}function fVt(t){const[e,n]=m.useState(null);return[m.useCallback((i,a,l)=>{const s=e??i,c=Math.min(s||0,i),u=Math.max(s||0,i),d=a.slice(c,u+1).map(g=>t(g)),f=d.some(g=>!l.has(g)),p=[];return d.forEach(g=>{f?(l.has(g)||p.push(g),l.add(g)):(l.delete(g),p.push(g))}),n(f?u:null),p},[e]),i=>{n(i)}]}const N4={},Mue="SELECT_ALL",Iue="SELECT_INVERT",zue="SELECT_NONE",sbe=[],kKe=(t,e)=>{let n=[];return(e||[]).forEach(o=>{n.push(o),o&&typeof o=="object"&&t in o&&(n=[].concat(Qa(n),Qa(kKe(t,o[t]))))}),n},hVt=(t,e)=>{const{preserveSelectedRowKeys:n,selectedRowKeys:o,defaultSelectedRowKeys:r,getCheckboxProps:i,onChange:a,onSelect:l,onSelectAll:s,onSelectInvert:c,onSelectNone:u,onSelectMultiple:d,columnWidth:f,type:p,selections:g,fixed:A,renderCell:y,hideSelectAll:S,checkStrictly:C=!0}=e||{},{prefixCls:P,data:v,pageData:T,getRecordByKey:w,getRowKey:x,expandType:b,childrenColumnName:R,locale:H,getPopupContainer:F}=t,E=Bb(),[N,U]=fVt(te=>te),[W,k]=Z6(o||r||sbe,{value:o}),D=m.useRef(new Map),L=m.useCallback(te=>{if(n){const oe=new Map;te.forEach(de=>{let he=w(de);!he&&D.current.has(de)&&(he=D.current.get(de)),oe.set(de,he)}),D.current=oe}},[w,n]);m.useEffect(()=>{L(W)},[W]);const{keyEntities:j}=m.useMemo(()=>{if(C)return{keyEntities:null};let te=v;if(n){const oe=new Set(v.map((he,pe)=>x(he,pe))),de=Array.from(D.current).reduce((he,pe)=>{let[me,le]=pe;return oe.has(me)?he:he.concat(le)},[]);te=[].concat(Qa(te),Qa(de))}return Pye(te,{externalGetKey:x,childrenPropName:R})},[v,x,C,R,n]),B=m.useMemo(()=>kKe(R,T),[R,T]),O=m.useMemo(()=>{const te=new Map;return B.forEach((oe,de)=>{const he=x(oe,de),pe=(i?i(oe):null)||{};te.set(he,pe)}),te},[B,x,i]),V=m.useCallback(te=>{var oe;return!!(!((oe=O.get(x(te)))===null||oe===void 0)&&oe.disabled)},[O,x]),[G,q]=m.useMemo(()=>{if(C)return[W||[],[]];const{checkedKeys:te,halfCheckedKeys:oe}=zC(W,!0,j,V);return[te||[],oe]},[W,C,j,V]),$=m.useMemo(()=>{const te=p==="radio"?G.slice(0,1):G;return new Set(te)},[G,p]),ie=m.useMemo(()=>p==="radio"?new Set:new Set(q),[q,p]);m.useEffect(()=>{e||k(sbe)},[!!e]);const Q=m.useCallback((te,oe)=>{let de,he;L(te),n?(de=te,he=te.map(pe=>D.current.get(pe))):(de=[],he=[],te.forEach(pe=>{const me=w(pe);me!==void 0&&(de.push(pe),he.push(me))})),k(de),a==null||a(de,he,{type:oe})},[k,w,a,n]),se=m.useCallback((te,oe,de,he)=>{if(l){const pe=de.map(me=>w(me));l(w(te),oe,pe,he)}Q(de,"single")},[l,w,Q]),Z=m.useMemo(()=>!g||S?null:(g===!0?[Mue,Iue,zue]:g).map(oe=>oe===Mue?{key:"all",text:H.selectionAll,onSelect(){Q(v.map((de,he)=>x(de,he)).filter(de=>{const he=O.get(de);return!(he!=null&&he.disabled)||$.has(de)}),"all")}}:oe===Iue?{key:"invert",text:H.selectInvert,onSelect(){const de=new Set($);T.forEach((pe,me)=>{const le=x(pe,me),Te=O.get(le);Te!=null&&Te.disabled||(de.has(le)?de.delete(le):de.add(le))});const he=Array.from(de);c&&(E.deprecated(!1,"onSelectInvert","onChange"),c(he)),Q(he,"invert")}}:oe===zue?{key:"none",text:H.selectNone,onSelect(){u==null||u(),Q(Array.from($).filter(de=>{const he=O.get(de);return he==null?void 0:he.disabled}),"none")}}:oe).map(oe=>Object.assign(Object.assign({},oe),{onSelect:function(){for(var de,he,pe=arguments.length,me=new Array(pe),le=0;le{var oe;if(!e)return te.filter(Me=>Me!==N4);let de=Qa(te);const he=new Set($),pe=B.map(x).filter(Me=>!O.get(Me).disabled),me=pe.every(Me=>he.has(Me)),le=pe.some(Me=>he.has(Me)),Te=()=>{const Me=[];me?pe.forEach(Ne=>{he.delete(Ne),Me.push(Ne)}):pe.forEach(Ne=>{he.has(Ne)||(he.add(Ne),Me.push(Ne))});const ze=Array.from(he);s==null||s(!me,ze.map(Ne=>w(Ne)),Me.map(Ne=>w(Ne))),Q(ze,"all"),U(null)};let ge,Se;if(p!=="radio"){let Me;if(Z){const nt={getPopupContainer:F,items:Z.map((We,Ee)=>{const{key:ke,text:Oe,onSelect:st}=We;return{key:ke??Ee,onClick:()=>{st==null||st(pe)},label:Oe}})};Me=m.createElement("div",{className:`${P}-selection-extra`},m.createElement(rA,{menu:nt,getPopupContainer:F},m.createElement("span",null,m.createElement(Bme,null))))}const ze=B.map((nt,We)=>{const Ee=x(nt,We),ke=O.get(Ee)||{};return Object.assign({checked:he.has(Ee)},ke)}).filter(nt=>{let{disabled:We}=nt;return We}),Ne=!!ze.length&&ze.length===B.length,Je=Ne&&ze.every(nt=>{let{checked:We}=nt;return We}),Ue=Ne&&ze.some(nt=>{let{checked:We}=nt;return We});Se=m.createElement(Li,{checked:Ne?Je:!!B.length&&me,indeterminate:Ne?!Je&&Ue:!me&&le,onChange:Te,disabled:B.length===0||Ne,"aria-label":Me?"Custom selection":"Select all",skipGroup:!0}),ge=!S&&m.createElement("div",{className:`${P}-selection`},Se,Me)}let Re;p==="radio"?Re=(Me,ze,Ne)=>{const Je=x(ze,Ne),Ue=he.has(Je);return{node:m.createElement(Le,Object.assign({},O.get(Je),{checked:Ue,onClick:nt=>nt.stopPropagation(),onChange:nt=>{he.has(Je)||se(Je,!0,[Je],nt.nativeEvent)}})),checked:Ue}}:Re=(Me,ze,Ne)=>{var Je;const Ue=x(ze,Ne),nt=he.has(Ue),We=ie.has(Ue),Ee=O.get(Ue);let ke;return b==="nest"?ke=We:ke=(Je=Ee==null?void 0:Ee.indeterminate)!==null&&Je!==void 0?Je:We,{node:m.createElement(Li,Object.assign({},Ee,{indeterminate:ke,checked:nt,skipGroup:!0,onClick:Oe=>Oe.stopPropagation(),onChange:Oe=>{let{nativeEvent:st}=Oe;const{shiftKey:je}=st,xt=pe.findIndex(Ye=>Ye===Ue),gt=G.some(Ye=>pe.includes(Ye));if(je&&C&>){const Ye=N(xt,pe,he),it=Array.from(he);d==null||d(!nt,it.map(ut=>w(ut)),Ye.map(ut=>w(ut))),Q(it,"multiple")}else{const Ye=G;if(C){const it=nt?q5(Ye,Ue):f6(Ye,Ue);se(Ue,!nt,it,st)}else{const it=zC([].concat(Qa(Ye),[Ue]),!0,j,V),{checkedKeys:ut,halfCheckedKeys:Qe}=it;let lt=ut;if(nt){const Ze=new Set(ut);Ze.delete(Ue),lt=zC(Array.from(Ze),{checked:!1,halfCheckedKeys:Qe},j,V).checkedKeys}se(Ue,!nt,lt,st)}}U(nt?null:xt)}})),checked:nt}};const De=(Me,ze,Ne)=>{const{node:Je,checked:Ue}=Re(Me,ze,Ne);return y?y(Ue,ze,Ne,Je):Je};if(!de.includes(N4))if(de.findIndex(Me=>{var ze;return((ze=Me[HE])===null||ze===void 0?void 0:ze.columnType)==="EXPAND_COLUMN"})===0){const[Me,...ze]=de;de=[Me,N4].concat(Qa(ze))}else de=[N4].concat(Qa(de));const Ae=de.indexOf(N4);de=de.filter((Me,ze)=>Me!==N4||ze===Ae);const ue=de[Ae-1],fe=de[Ae+1];let ve=A;ve===void 0&&((fe==null?void 0:fe.fixed)!==void 0?ve=fe.fixed:(ue==null?void 0:ue.fixed)!==void 0&&(ve=ue.fixed)),ve&&ue&&((oe=ue[HE])===null||oe===void 0?void 0:oe.columnType)==="EXPAND_COLUMN"&&ue.fixed===void 0&&(ue.fixed=ve);const we=Un(`${P}-selection-col`,{[`${P}-selection-col-with-dropdown`]:g&&p==="checkbox"}),Pe=()=>e!=null&&e.columnTitle?typeof e.columnTitle=="function"?e.columnTitle(Se):e.columnTitle:ge,Ie={fixed:ve,width:f,className:`${P}-selection-column`,title:Pe(),render:De,onCell:e.onCell,[HE]:{className:we}};return de.map(Me=>Me===N4?Ie:Me)},[x,B,e,G,$,ie,f,Z,b,O,d,se,V]),$]};function pVt(t,e){return t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){const o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t}function gVt(t,e){return m.useImperativeHandle(t,()=>{const n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,i){return n[i]?n[i]:Reflect.get(r,i)}}):pVt(o,n)})}function mVt(t){return function(n){let{prefixCls:o,onExpand:r,record:i,expanded:a,expandable:l}=n;const s=`${o}-row-expand-icon`;return m.createElement("button",{type:"button",onClick:c=>{r(i,c),c.stopPropagation()},className:Un(s,{[`${s}-spaced`]:!l,[`${s}-expanded`]:l&&a,[`${s}-collapsed`]:l&&!a}),"aria-label":a?t.collapse:t.expand,"aria-expanded":a})}}function yVt(t){return(n,o)=>{const r=n.querySelector(`.${t}-container`);let i=o;if(r){const a=getComputedStyle(r),l=parseInt(a.borderLeftWidth,10),s=parseInt(a.borderRightWidth,10);i=o-l-s}return i}}function eb(t,e){return"key"in t&&t.key!==void 0&&t.key!==null?t.key:t.dataIndex?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:e}function rN(t,e){return e?`${e}-${t}`:`${t}`}function vQ(t,e){return typeof t=="function"?t(e):t}function AVt(t,e){const n=vQ(t,e);return Object.prototype.toString.call(n)==="[object Object]"?"":n}var wVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},vVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:wVt}))},xVt=m.forwardRef(vVt);function bVt(t){const e=m.useRef(t),n=GGe();return[()=>e.current,o=>{e.current=o,n()}]}var mi={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var n=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=mi.F1&&n<=mi.F12)return!1;switch(n){case mi.ALT:case mi.CAPS_LOCK:case mi.CONTEXT_MENU:case mi.CTRL:case mi.DOWN:case mi.END:case mi.ESC:case mi.HOME:case mi.INSERT:case mi.LEFT:case mi.MAC_FF_META:case mi.META:case mi.NUMLOCK:case mi.NUM_CENTER:case mi.PAGE_DOWN:case mi.PAGE_UP:case mi.PAUSE:case mi.PRINT_SCREEN:case mi.RIGHT:case mi.SHIFT:case mi.UP:case mi.WIN_KEY:case mi.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=mi.ZERO&&e<=mi.NINE||e>=mi.NUM_ZERO&&e<=mi.NUM_MULTIPLY||e>=mi.A&&e<=mi.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&e===0)return!0;switch(e){case mi.SPACE:case mi.QUESTION_MARK:case mi.NUM_PLUS:case mi.NUM_MINUS:case mi.NUM_PERIOD:case mi.NUM_DIVISION:case mi.SEMICOLON:case mi.DASH:case mi.EQUALS:case mi.COMMA:case mi.PERIOD:case mi.SLASH:case mi.APOSTROPHE:case mi.SINGLE_QUOTE:case mi.OPEN_SQUARE_BRACKET:case mi.BACKSLASH:case mi.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};function SVt(t){var e=t.dropPosition,n=t.dropLevelOffset,o=t.indent,r={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(e){case-1:r.top=0,r.left=-n*o;break;case 1:r.bottom=0,r.left=-n*o;break;case 0:r.bottom=0,r.left=o;break}return m.createElement("div",{style:r})}function LKe(t){if(t==null)throw new TypeError("Cannot destructure "+t)}function TVt(t){if(Array.isArray(t))return t}function PVt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function CVt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pv(t,e){return TVt(t)||PVt(t,e)||SKe(t,e)||CVt()}function RVt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var cbe=RVt()?m.useLayoutEffect:m.useEffect,$G=function(e,n){var o=m.useRef(!0);cbe(function(){return e(o.current)},n),cbe(function(){return o.current=!1,function(){o.current=!0}},[])};function HVt(t,e){var n=m.useState(!1),o=Pv(n,2),r=o[0],i=o[1];$G(function(){if(r)return t(),function(){e()}},[r]),$G(function(){return i(!0),function(){i(!1)}},[])}var MVt=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],WKe=function(e,n){var o=e.className,r=e.style,i=e.motion,a=e.motionNodes,l=e.motionType,s=e.onMotionStart,c=e.onMotionEnd,u=e.active,d=e.treeNodeRequiredProps,f=wQ(e,MVt),p=m.useState(!0),g=Pv(p,2),A=g[0],y=g[1],S=m.useContext(Tye),C=S.prefixCls,P=a&&l!=="hide";$G(function(){a&&P!==A&&y(P)},[a]);var v=function(){a&&s()},T=m.useRef(!1),w=function(){a&&!T.current&&(T.current=!0,c())};HVt(v,w);var x=function(R){P===R&&w()};return a?m.createElement(o1,M9({ref:n,visible:A},i,{motionAppear:l==="show",onVisibleChanged:x}),function(b,R){var H=b.className,F=b.style;return m.createElement("div",{ref:R,className:r9("".concat(C,"-treenode-motion"),H),style:F},a.map(function(E){var N=Object.assign({},(LKe(E.data),E.data)),U=E.title,W=E.key,k=E.isStart,D=E.isEnd;delete N.children;var L=ME(W,d);return m.createElement(SR,M9({},N,L,{title:U,active:u,data:E.data,key:W,isStart:k,isEnd:D}))}))}):m.createElement(SR,M9({domRef:n,className:o,style:r},f,{active:u}))};WKe.displayName="MotionTreeNode";var IVt=m.forwardRef(WKe);function zVt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=t.length,o=e.length;if(Math.abs(n-o)!==1)return{add:!1,key:null};function r(i,a){var l=new Map;i.forEach(function(c){l.set(c,!0)});var s=a.filter(function(c){return!l.has(c)});return s.length===1?s[0]:null}return n ").concat(e);return e}var UKe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.data;t.selectable,t.checkable;var r=t.expandedKeys,i=t.selectedKeys,a=t.checkedKeys,l=t.loadedKeys,s=t.loadingKeys,c=t.halfCheckedKeys,u=t.keyEntities,d=t.disabled,f=t.dragging,p=t.dragOverNodeKey,g=t.dropPosition,A=t.motion,y=t.height,S=t.itemHeight,C=t.virtual,P=t.focusable,v=t.activeItem,T=t.focused,w=t.tabIndex,x=t.onKeyDown,b=t.onFocus,R=t.onBlur,H=t.onActiveChange,F=t.onListChangeStart,E=t.onListChangeEnd,N=wQ(t,DVt),U=m.useRef(null),W=m.useRef(null);m.useImperativeHandle(e,function(){return{scrollTo:function(Re){U.current.scrollTo(Re)},getIndentWidth:function(){return W.current.offsetWidth}}});var k=m.useState(r),D=Pv(k,2),L=D[0],j=D[1],B=m.useState(o),O=Pv(B,2),V=O[0],G=O[1],q=m.useState(o),$=Pv(q,2),ie=$[0],Q=$[1],se=m.useState([]),Z=Pv(se,2),ee=Z[0],te=Z[1],oe=m.useState(null),de=Pv(oe,2),he=de[0],pe=de[1],me=m.useRef(o);me.current=o;function le(){var Se=me.current;G(Se),Q(Se),te([]),pe(null),E()}$G(function(){j(r);var Se=zVt(L,r);if(Se.key!==null)if(Se.add){var Re=V.findIndex(function(we){var Pe=we.key;return Pe===Se.key}),De=hbe(ube(V,o,Se.key),C,y,S),Ae=V.slice();Ae.splice(Re+1,0,fbe),Q(Ae),te(De),pe("show")}else{var ue=o.findIndex(function(we){var Pe=we.key;return Pe===Se.key}),fe=hbe(ube(o,V,Se.key),C,y,S),ve=o.slice();ve.splice(ue+1,0,fbe),Q(ve),te(fe),pe("hide")}else V!==o&&(G(o),Q(o))},[r,o]),m.useEffect(function(){f||le()},[f]);var Te=A?ie:o,ge={expandedKeys:r,selectedKeys:i,loadedKeys:l,loadingKeys:s,checkedKeys:a,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:g,keyEntities:u};return m.createElement(m.Fragment,null,T&&v&&m.createElement("span",{style:dbe,"aria-live":"assertive"},FVt(v)),m.createElement("div",null,m.createElement("input",{style:dbe,disabled:P===!1||d,tabIndex:P!==!1?w:null,onKeyDown:x,onFocus:b,onBlur:R,value:"",onChange:EVt,"aria-label":"for screen reader"})),m.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},m.createElement("div",{className:"".concat(n,"-indent")},m.createElement("div",{ref:W,className:"".concat(n,"-indent-unit")}))),m.createElement(q$,M9({},N,{data:Te,itemKey:pbe,height:y,fullHeight:!1,virtual:C,itemHeight:S,prefixCls:"".concat(n,"-list"),ref:U,onVisibleChange:function(Re,De){var Ae=new Set(Re),ue=De.filter(function(fe){return!Ae.has(fe)});ue.some(function(fe){return pbe(fe)===tb})&&le()}}),function(Se){var Re=Se.pos,De=Object.assign({},(LKe(Se.data),Se.data)),Ae=Se.title,ue=Se.key,fe=Se.isStart,ve=Se.isEnd,we=oN(ue,Re);delete De.key,delete De.children;var Pe=ME(we,ge);return m.createElement(IVt,M9({},De,Pe,{title:Ae,active:!!v&&ue===v.key,pos:Re,data:Se.data,isStart:fe,isEnd:ve,motion:A,motionNodes:ue===tb?ee:null,motionType:he,onMotionStart:F,onMotionEnd:le,treeNodeRequiredProps:ge,onMouseMove:function(){H(null)}}))}))});UKe.displayName="NodeList";var kVt=10,Rye=function(t){HKe(n,t);var e=MKe(n);function n(){var o;CKe(this,n);for(var r=arguments.length,i=new Array(r),a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,d=o.state,f=d.dragChildrenKeys,p=d.dropPosition,g=d.dropTargetKey,A=d.dropTargetPos,y=d.dropAllowed;if(y){var S=o.props.onDrop;if(o.setState({dragOverNodeKey:null}),o.cleanDragState(),g!==null){var C=Ru(Ru({},ME(g,o.getTreeNodeRequiredProps())),{},{active:((c=o.getActiveItem())===null||c===void 0?void 0:c.key)===g,data:Np(o.state.keyEntities,g).node}),P=f.indexOf(g)!==-1;b2(!P,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var v=Cye(A),T={event:l,node:tu(C),dragNode:o.dragNode?tu(o.dragNode.props):null,dragNodesKeys:[o.dragNode.props.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(v[v.length-1])};u||S==null||S(T),o.dragNode=null}}}),Vo(wr(o),"cleanDragState",function(){var l=o.state.draggingNodeKey;l!==null&&o.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),o.dragStartMousePosition=null,o.currentMouseOverDroppableNodeKey=null}),Vo(wr(o),"triggerExpandActionExpand",function(l,s){var c=o.state,u=c.expandedKeys,d=c.flattenNodes,f=s.expanded,p=s.key,g=s.isLeaf;if(!(g||l.shiftKey||l.metaKey||l.ctrlKey)){var A=d.filter(function(S){return S.key===p})[0],y=tu(Ru(Ru({},ME(p,o.getTreeNodeRequiredProps())),{},{data:A.data}));o.setExpandedKeys(f?q5(u,p):f6(u,p)),o.onNodeExpand(l,y)}}),Vo(wr(o),"onNodeClick",function(l,s){var c=o.props,u=c.onClick,d=c.expandAction;d==="click"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Vo(wr(o),"onNodeDoubleClick",function(l,s){var c=o.props,u=c.onDoubleClick,d=c.expandAction;d==="doubleClick"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Vo(wr(o),"onNodeSelect",function(l,s){var c=o.state.selectedKeys,u=o.state,d=u.keyEntities,f=u.fieldNames,p=o.props,g=p.onSelect,A=p.multiple,y=s.selected,S=s[f.key],C=!y;C?A?c=f6(c,S):c=[S]:c=q5(c,S);var P=c.map(function(v){var T=Np(d,v);return T?T.node:null}).filter(function(v){return v});o.setUncontrolledState({selectedKeys:c}),g==null||g(c,{event:"select",selected:C,node:s,selectedNodes:P,nativeEvent:l.nativeEvent})}),Vo(wr(o),"onNodeCheck",function(l,s,c){var u=o.state,d=u.keyEntities,f=u.checkedKeys,p=u.halfCheckedKeys,g=o.props,A=g.checkStrictly,y=g.onCheck,S=s.key,C,P={event:"check",node:s,checked:c,nativeEvent:l.nativeEvent};if(A){var v=c?f6(f,S):q5(f,S),T=q5(p,S);C={checked:v,halfChecked:T},P.checkedNodes=v.map(function(F){return Np(d,F)}).filter(function(F){return F}).map(function(F){return F.node}),o.setUncontrolledState({checkedKeys:v})}else{var w=zC([].concat(bx(f),[S]),!0,d),x=w.checkedKeys,b=w.halfCheckedKeys;if(!c){var R=new Set(x);R.delete(S);var H=zC(Array.from(R),{checked:!1,halfCheckedKeys:b},d);x=H.checkedKeys,b=H.halfCheckedKeys}C=x,P.checkedNodes=[],P.checkedNodesPositions=[],P.halfCheckedKeys=b,x.forEach(function(F){var E=Np(d,F);if(E){var N=E.node,U=E.pos;P.checkedNodes.push(N),P.checkedNodesPositions.push({node:N,pos:U})}}),o.setUncontrolledState({checkedKeys:x},!1,{halfCheckedKeys:b})}y==null||y(C,P)}),Vo(wr(o),"onNodeLoad",function(l){var s,c=l.key,u=o.state.keyEntities,d=Np(u,c);if(!(d!=null&&(s=d.children)!==null&&s!==void 0&&s.length)){var f=new Promise(function(p,g){o.setState(function(A){var y=A.loadedKeys,S=y===void 0?[]:y,C=A.loadingKeys,P=C===void 0?[]:C,v=o.props,T=v.loadData,w=v.onLoad;if(!T||S.indexOf(c)!==-1||P.indexOf(c)!==-1)return null;var x=T(l);return x.then(function(){var b=o.state.loadedKeys,R=f6(b,c);w==null||w(R,{event:"load",node:l}),o.setUncontrolledState({loadedKeys:R}),o.setState(function(H){return{loadingKeys:q5(H.loadingKeys,c)}}),p()}).catch(function(b){if(o.setState(function(H){return{loadingKeys:q5(H.loadingKeys,c)}}),o.loadingRetryTimes[c]=(o.loadingRetryTimes[c]||0)+1,o.loadingRetryTimes[c]>=kVt){var R=o.state.loadedKeys;b2(!1,"Retry for `loadData` many times but still failed. No more retry."),o.setUncontrolledState({loadedKeys:f6(R,c)}),p()}g(b)}),{loadingKeys:f6(P,c)}})});return f.catch(function(){}),f}}),Vo(wr(o),"onNodeMouseEnter",function(l,s){var c=o.props.onMouseEnter;c==null||c({event:l,node:s})}),Vo(wr(o),"onNodeMouseLeave",function(l,s){var c=o.props.onMouseLeave;c==null||c({event:l,node:s})}),Vo(wr(o),"onNodeContextMenu",function(l,s){var c=o.props.onRightClick;c&&(l.preventDefault(),c({event:l,node:s}))}),Vo(wr(o),"onFocus",function(){var l=o.props.onFocus;o.setState({focused:!0});for(var s=arguments.length,c=new Array(s),u=0;u1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!o.destroyed){var u=!1,d=!0,f={};Object.keys(l).forEach(function(p){if(p in o.props){d=!1;return}u=!0,f[p]=l[p]}),u&&(!s||d)&&o.setState(Ru(Ru({},f),c))}}),Vo(wr(o),"scrollTo",function(l){o.listRef.current.scrollTo(l)}),o}return RKe(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var r=this.props,i=r.activeKey,a=r.itemScrollOffset,l=a===void 0?0:a;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i,offset:l}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var r=this.state,i=r.focused,a=r.flattenNodes,l=r.keyEntities,s=r.draggingNodeKey,c=r.activeKey,u=r.dropLevelOffset,d=r.dropContainerKey,f=r.dropTargetKey,p=r.dropPosition,g=r.dragOverNodeKey,A=r.indent,y=this.props,S=y.prefixCls,C=y.className,P=y.style,v=y.showLine,T=y.focusable,w=y.tabIndex,x=w===void 0?0:w,b=y.selectable,R=y.showIcon,H=y.icon,F=y.switcherIcon,E=y.draggable,N=y.checkable,U=y.checkStrictly,W=y.disabled,k=y.motion,D=y.loadData,L=y.filterTreeNode,j=y.height,B=y.itemHeight,O=y.virtual,V=y.titleRender,G=y.dropIndicatorRender,q=y.onContextMenu,$=y.onScroll,ie=y.direction,Q=y.rootClassName,se=y.rootStyle,Z=zKe(this.props,{aria:!0,data:!0}),ee;return E&&(aA(E)==="object"?ee=E:typeof E=="function"?ee={nodeDraggable:E}:ee={}),m.createElement(Tye.Provider,{value:{prefixCls:S,selectable:b,showIcon:R,icon:H,switcherIcon:F,draggable:ee,draggingNodeKey:s,checkable:N,checkStrictly:U,disabled:W,keyEntities:l,dropLevelOffset:u,dropContainerKey:d,dropTargetKey:f,dropPosition:p,dragOverNodeKey:g,indent:A,direction:ie,dropIndicatorRender:G,loadData:D,filterTreeNode:L,titleRender:V,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},m.createElement("div",{role:"tree",className:r9(S,C,Q,Vo(Vo(Vo({},"".concat(S,"-show-line"),v),"".concat(S,"-focused"),i),"".concat(S,"-active-focused"),c!==null)),style:se},m.createElement(UKe,M9({ref:this.listRef,prefixCls:S,style:P,data:a,disabled:W,selectable:b,checkable:!!N,motion:k,dragging:s!==null,height:j,itemHeight:B,virtual:O,focusable:T,focused:i,tabIndex:x,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:q,onScroll:$},this.getTreeNodeRequiredProps(),Z))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){var a=i.prevProps,l={prevProps:r};function s(w){return!a&&w in r||a&&a[w]!==r[w]}var c,u=i.fieldNames;if(s("fieldNames")&&(u=bR(r.fieldNames),l.fieldNames=u),s("treeData")?c=r.treeData:s("children")&&(b2(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),c=EKe(r.children)),c){l.treeData=c;var d=Pye(c,{fieldNames:u});l.keyEntities=Ru(Vo({},tb,NKe),d.keyEntities)}var f=l.keyEntities||i.keyEntities;if(s("expandedKeys")||a&&s("autoExpandParent"))l.expandedKeys=r.autoExpandParent||!a&&r.defaultExpandParent?Hue(r.expandedKeys,f):r.expandedKeys;else if(!a&&r.defaultExpandAll){var p=Ru({},f);delete p[tb],l.expandedKeys=Object.keys(p).map(function(w){return p[w].key})}else!a&&r.defaultExpandedKeys&&(l.expandedKeys=r.autoExpandParent||r.defaultExpandParent?Hue(r.defaultExpandedKeys,f):r.defaultExpandedKeys);if(l.expandedKeys||delete l.expandedKeys,c||l.expandedKeys){var g=bie(c||i.treeData,l.expandedKeys||i.expandedKeys,u);l.flattenNodes=g}if(r.selectable&&(s("selectedKeys")?l.selectedKeys=lbe(r.selectedKeys,r):!a&&r.defaultSelectedKeys&&(l.selectedKeys=lbe(r.defaultSelectedKeys,r))),r.checkable){var A;if(s("checkedKeys")?A=Sie(r.checkedKeys)||{}:!a&&r.defaultCheckedKeys?A=Sie(r.defaultCheckedKeys)||{}:c&&(A=Sie(r.checkedKeys)||{checkedKeys:i.checkedKeys,halfCheckedKeys:i.halfCheckedKeys}),A){var y=A,S=y.checkedKeys,C=S===void 0?[]:S,P=y.halfCheckedKeys,v=P===void 0?[]:P;if(!r.checkStrictly){var T=zC(C,!0,f);C=T.checkedKeys,v=T.halfCheckedKeys}l.checkedKeys=C,l.halfCheckedKeys=v}}return s("loadedKeys")&&(l.loadedKeys=r.loadedKeys),l}}]),n}(m.Component);Vo(Rye,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:SVt,allowDrop:function(){return!0},expandAction:!1});Vo(Rye,"TreeNode",SR);var LVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},WVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:LVt}))},jKe=m.forwardRef(WVt),NVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},UVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:NVt}))},BKe=m.forwardRef(UVt),jVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},BVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:jVt}))},YVt=m.forwardRef(BVt),OVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},VVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:OVt}))},_Vt=m.forwardRef(VVt);const GVt=new ba("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),XVt=(t,e)=>({[`.${t}-switcher-icon`]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:`transform ${e.motionDurationSlow}`}}}),JVt=(t,e)=>({[`.${t}-drop-indicator`]:{position:"absolute",zIndex:1,height:2,backgroundColor:e.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:`${jt(e.lineWidthBold)} solid ${e.colorPrimary}`,borderRadius:"50%",content:'""'}}}),KVt=(t,e)=>{const{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:i,nodeSelectedBg:a,nodeHoverBg:l}=e,s=e.paddingXS;return{[n]:Object.assign(Object.assign({},Na(e)),{background:e.colorBgContainer,borderRadius:e.borderRadius,transition:`background-color ${e.motionDurationSlow}`,[`&${n}-rtl`]:{[`${n}-switcher`]:{"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(90deg)"}}}}},[`&-focused:not(:hover):not(${n}-active-focused)`]:Object.assign({},dw(e)),[`${n}-list-holder-inner`]:{alignItems:"flex-start"},[`&${n}-block-node`]:{[`${n}-list-holder-inner`]:{alignItems:"stretch",[`${n}-node-content-wrapper`]:{flex:"auto"},[`${o}.dragging`]:{position:"relative","&:after":{position:"absolute",top:0,insetInlineEnd:0,bottom:r,insetInlineStart:0,border:`1px solid ${e.colorPrimary}`,opacity:0,animationName:GVt,animationDuration:e.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none"}}}},[`${o}`]:{display:"flex",alignItems:"flex-start",padding:`0 0 ${jt(r)} 0`,outline:"none","&-rtl":{direction:"rtl"},"&-disabled":{[`${n}-node-content-wrapper`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}}},[`&-active ${n}-node-content-wrapper`]:{background:e.controlItemBgHover},[`&:not(${o}-disabled).filter-node ${n}-title`]:{color:"inherit",fontWeight:500},"&-draggable":{cursor:"grab",[`${n}-draggable-icon`]:{flexShrink:0,width:i,lineHeight:`${jt(i)}`,textAlign:"center",visibility:"visible",opacity:.2,transition:`opacity ${e.motionDurationSlow}`,[`${o}:hover &`]:{opacity:.45}},[`&${o}-disabled`]:{[`${n}-draggable-icon`]:{visibility:"hidden"}}}},[`${n}-indent`]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:i}},[`${n}-draggable-icon`]:{visibility:"hidden"},[`${n}-switcher`]:Object.assign(Object.assign({},XVt(t,e)),{position:"relative",flex:"none",alignSelf:"stretch",width:i,margin:0,lineHeight:`${jt(i)}`,textAlign:"center",cursor:"pointer",userSelect:"none",transition:`all ${e.motionDurationSlow}`,borderRadius:e.borderRadius,"&-noop":{cursor:"unset"},[`&:not(${n}-switcher-noop):hover`]:{backgroundColor:e.colorBgTextHover},"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(-90deg)"}}},"&-loading-icon":{color:e.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&:after":{position:"absolute",width:e.calc(e.calc(i).div(2).equal()).mul(.8).equal(),height:e.calc(i).div(2).equal(),borderBottom:`1px solid ${e.colorBorder}`,content:'""'}}}),[`${n}-checkbox`]:{top:"initial",marginInlineEnd:s,alignSelf:"flex-start",marginTop:e.marginXXS},[`${n}-node-content-wrapper, ${n}-checkbox + span`]:{position:"relative",zIndex:"auto",minHeight:i,margin:0,padding:`0 ${jt(e.calc(e.paddingXS).div(2).equal())}`,color:"inherit",lineHeight:`${jt(i)}`,background:"transparent",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,"&:hover":{backgroundColor:l},[`&${n}-node-selected`]:{backgroundColor:a},[`${n}-iconEle`]:{display:"inline-block",width:i,height:i,lineHeight:`${jt(i)}`,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}},[`${n}-unselectable ${n}-node-content-wrapper:hover`]:{backgroundColor:"transparent"},[`${n}-node-content-wrapper`]:Object.assign({lineHeight:`${jt(i)}`,userSelect:"none"},JVt(t,e)),[`${o}.drop-container`]:{"> [draggable]":{boxShadow:`0 0 0 2px ${e.colorPrimary}`}},"&-show-line":{[`${n}-indent`]:{"&-unit":{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&-end":{"&:before":{display:"none"}}}},[`${n}-switcher`]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},[`${o}-leaf-last`]:{[`${n}-switcher`]:{"&-leaf-line":{"&:before":{top:"auto !important",bottom:"auto !important",height:`${jt(e.calc(i).div(2).equal())} !important`}}}}})}},qVt=t=>{const{treeCls:e,treeNodeCls:n,treeNodePadding:o,directoryNodeSelectedBg:r,directoryNodeSelectedColor:i}=t;return{[`${e}${e}-directory`]:{[n]:{position:"relative","&:before":{position:"absolute",top:0,insetInlineEnd:0,bottom:o,insetInlineStart:0,transition:`background-color ${t.motionDurationMid}`,content:'""',pointerEvents:"none"},"&:hover":{"&:before":{background:t.controlItemBgHover}},"> *":{zIndex:1},[`${e}-switcher`]:{transition:`color ${t.motionDurationMid}`},[`${e}-node-content-wrapper`]:{borderRadius:0,userSelect:"none","&:hover":{background:"transparent"},[`&${e}-node-selected`]:{color:i,background:"transparent"}},"&-selected":{"\n &:hover::before,\n &::before\n ":{background:r},[`${e}-switcher`]:{color:i},[`${e}-node-content-wrapper`]:{color:i,background:"transparent"}}}}}},$Vt=(t,e)=>{const n=`.${t}`,o=`${n}-treenode`,r=e.calc(e.paddingXS).div(2).equal(),i=qi(e,{treeCls:n,treeNodeCls:o,treeNodePadding:r});return[KVt(t,i),qVt(i)]},QVt=t=>{const{controlHeightSM:e}=t;return{titleHeight:e,nodeHoverBg:t.controlItemBgHover,nodeSelectedBg:t.controlItemBgActive}},ZVt=t=>{const{colorTextLightSolid:e,colorPrimary:n}=t;return Object.assign(Object.assign({},QVt(t)),{directoryNodeSelectedColor:e,directoryNodeSelectedBg:n})},e_t=wl("Tree",(t,e)=>{let{prefixCls:n}=e;return[{[t.componentCls]:vJe(`${n}-checkbox`,t)},$Vt(n,t),kme(t)]},ZVt),gbe=4;function t_t(t){const{dropPosition:e,dropLevelOffset:n,prefixCls:o,indent:r,direction:i="ltr"}=t,a=i==="ltr"?"left":"right",l=i==="ltr"?"right":"left",s={[a]:-n*r+gbe,[l]:0};switch(e){case-1:s.top=-3;break;case 1:s.bottom=-3;break;default:s.bottom=-3,s[a]=r+gbe;break}return be.createElement("div",{style:s,className:`${o}-drop-indicator`})}var n_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},o_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:n_t}))},r_t=m.forwardRef(o_t),i_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},a_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:i_t}))},l_t=m.forwardRef(a_t),s_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},c_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:s_t}))},u_t=m.forwardRef(c_t);const d_t=t=>{const{prefixCls:e,switcherIcon:n,treeNodeProps:o,showLine:r}=t,{isLeaf:i,expanded:a,loading:l}=o;if(l)return m.createElement(YH,{className:`${e}-switcher-loading-icon`});let s;if(r&&typeof r=="object"&&(s=r.showLeafIcon),i){if(!r)return null;if(typeof s!="boolean"&&s){const d=typeof s=="function"?s(o):s,f=`${e}-switcher-line-custom-icon`;return m.isValidElement(d)?j0(d,{className:Un(d.props.className||"",f)}):d}return s?m.createElement(jKe,{className:`${e}-switcher-line-icon`}):m.createElement("span",{className:`${e}-switcher-leaf-line`})}const c=`${e}-switcher-icon`,u=typeof n=="function"?n(o):n;return m.isValidElement(u)?j0(u,{className:Un(u.props.className||"",c)}):u!==void 0?u:r?a?m.createElement(l_t,{className:`${e}-switcher-line-icon`}):m.createElement(u_t,{className:`${e}-switcher-line-icon`}):m.createElement(r_t,{className:c})},YKe=be.forwardRef((t,e)=>{var n;const{getPrefixCls:o,direction:r,virtual:i,tree:a}=be.useContext(Cr),{prefixCls:l,className:s,showIcon:c=!1,showLine:u,switcherIcon:d,blockNode:f=!1,children:p,checkable:g=!1,selectable:A=!0,draggable:y,motion:S,style:C}=t,P=o("tree",l),v=o(),T=S??Object.assign(Object.assign({},Mme(v)),{motionAppear:!1}),w=Object.assign(Object.assign({},t),{checkable:g,selectable:A,showIcon:c,motion:T,blockNode:f,showLine:!!u,dropIndicatorRender:t_t}),[x,b,R]=e_t(P),[,H]=Vu(),F=H.paddingXS/2+(((n=H.Tree)===null||n===void 0?void 0:n.titleHeight)||H.controlHeightSM),E=be.useMemo(()=>{if(!y)return!1;let U={};switch(typeof y){case"function":U.nodeDraggable=y;break;case"object":U=Object.assign({},y);break}return U.icon!==!1&&(U.icon=U.icon||be.createElement(_Vt,null)),U},[y]),N=U=>be.createElement(d_t,{prefixCls:P,switcherIcon:d,treeNodeProps:U,showLine:u});return x(be.createElement(Rye,Object.assign({itemHeight:F,ref:e,virtual:i},w,{style:Object.assign(Object.assign({},a==null?void 0:a.style),C),prefixCls:P,className:Un({[`${P}-icon-hide`]:!c,[`${P}-block-node`]:f,[`${P}-unselectable`]:!A,[`${P}-rtl`]:r==="rtl"},a==null?void 0:a.className,s,b,R),direction:r,checkable:g&&be.createElement("span",{className:`${P}-checkbox-inner`}),selectable:A,switcherIcon:N,draggable:E}),p))}),mbe=0,Tie=1,ybe=2;function Hye(t,e,n){const{key:o,children:r}=n;function i(a){const l=a[o],s=a[r];e(l,a)!==!1&&Hye(s||[],e,n)}t.forEach(i)}function f_t(t){let{treeData:e,expandedKeys:n,startKey:o,endKey:r,fieldNames:i}=t;const a=[];let l=mbe;if(o&&o===r)return[o];if(!o||!r)return[];function s(c){return c===o||c===r}return Hye(e,c=>{if(l===ybe)return!1;if(s(c)){if(a.push(c),l===mbe)l=Tie;else if(l===Tie)return l=ybe,!1}else l===Tie&&a.push(c);return n.includes(c)},bR(i)),a}function Pie(t,e,n){const o=Qa(e),r=[];return Hye(t,(i,a)=>{const l=o.indexOf(i);return l!==-1&&(r.push(a),o.splice(l,1)),!!o.length},bR(n)),r}var Abe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{defaultExpandAll:n,defaultExpandParent:o,defaultExpandedKeys:r}=t,i=Abe(t,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);const a=m.useRef(),l=m.useRef(),s=()=>{const{keyEntities:b}=Pye(wbe(i));let R;return n?R=Object.keys(b):o?R=Hue(i.expandedKeys||r||[],b):R=i.expandedKeys||r||[],R},[c,u]=m.useState(i.selectedKeys||i.defaultSelectedKeys||[]),[d,f]=m.useState(()=>s());m.useEffect(()=>{"selectedKeys"in i&&u(i.selectedKeys)},[i.selectedKeys]),m.useEffect(()=>{"expandedKeys"in i&&f(i.expandedKeys)},[i.expandedKeys]);const p=(b,R)=>{var H;return"expandedKeys"in i||f(b),(H=i.onExpand)===null||H===void 0?void 0:H.call(i,b,R)},g=(b,R)=>{var H;const{multiple:F,fieldNames:E}=i,{node:N,nativeEvent:U}=R,{key:W=""}=N,k=wbe(i),D=Object.assign(Object.assign({},R),{selected:!0}),L=(U==null?void 0:U.ctrlKey)||(U==null?void 0:U.metaKey),j=U==null?void 0:U.shiftKey;let B;F&&L?(B=b,a.current=W,l.current=B,D.selectedNodes=Pie(k,B,E)):F&&j?(B=Array.from(new Set([].concat(Qa(l.current||[]),Qa(f_t({treeData:k,expandedKeys:d,startKey:W,endKey:a.current,fieldNames:E}))))),D.selectedNodes=Pie(k,B,E)):(B=[W],a.current=W,l.current=B,D.selectedNodes=Pie(k,B,E)),(H=i.onSelect)===null||H===void 0||H.call(i,B,D),"selectedKeys"in i||u(B)},{getPrefixCls:A,direction:y}=m.useContext(Cr),{prefixCls:S,className:C,showIcon:P=!0,expandAction:v="click"}=i,T=Abe(i,["prefixCls","className","showIcon","expandAction"]),w=A("tree",S),x=Un(`${w}-directory`,{[`${w}-directory-rtl`]:y==="rtl"},C);return m.createElement(YKe,Object.assign({icon:h_t,ref:e,blockNode:!0},T,{showIcon:P,expandAction:v,prefixCls:w,className:x,expandedKeys:d,selectedKeys:c,onSelect:g,onExpand:p}))},g_t=m.forwardRef(p_t),Mye=YKe;Mye.DirectoryTree=g_t;Mye.TreeNode=SR;function vbe(t){let{value:e,onChange:n,filterSearch:o,tablePrefixCls:r,locale:i}=t;return o?m.createElement("div",{className:`${r}-filter-dropdown-search`},m.createElement(jl,{prefix:m.createElement($$,null),placeholder:i.filterSearchPlaceholder,onChange:n,value:e,htmlSize:1,className:`${r}-filter-dropdown-search-input`})):null}const m_t=t=>{const{keyCode:e}=t;e===fi.ENTER&&t.stopPropagation()},y_t=m.forwardRef((t,e)=>m.createElement("div",{className:t.className,onClick:n=>n.stopPropagation(),onKeyDown:m_t,ref:e},t.children));function DC(t){let e=[];return(t||[]).forEach(n=>{let{value:o,children:r}=n;e.push(o),r&&(e=[].concat(Qa(e),Qa(DC(r))))}),e}function A_t(t){return t.some(e=>{let{children:n}=e;return n})}function OKe(t,e){return typeof e=="string"||typeof e=="number"?e==null?void 0:e.toString().toLowerCase().includes(t.trim().toLowerCase()):!1}function VKe(t){let{filters:e,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a}=t;return e.map((l,s)=>{const c=String(l.value);if(l.children)return{key:c||s,label:l.text,popupClassName:`${n}-dropdown-submenu`,children:VKe({filters:l.children,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a})};const u=r?Li:Le,d={key:l.value!==void 0?c:s,label:m.createElement(m.Fragment,null,m.createElement(u,{checked:o.includes(c)}),m.createElement("span",null,l.text))};return i.trim()?typeof a=="function"?a(i,l)?d:null:OKe(i,l.text)?d:null:d})}function Cie(t){return t||[]}function w_t(t){var e,n;const{tablePrefixCls:o,prefixCls:r,column:i,dropdownPrefixCls:a,columnKey:l,filterOnClose:s,filterMultiple:c,filterMode:u="menu",filterSearch:d=!1,filterState:f,triggerFilter:p,locale:g,children:A,getPopupContainer:y,rootClassName:S}=t,{filterDropdownOpen:C,onFilterDropdownOpenChange:P,filterResetToDefaultFilteredValue:v,defaultFilteredValue:T,filterDropdownVisible:w,onFilterDropdownVisibleChange:x}=i,[b,R]=m.useState(!1),H=!!(f&&(!((e=f.filteredKeys)===null||e===void 0)&&e.length||f.forceFiltered)),F=le=>{R(le),P==null||P(le),x==null||x(le)},E=(n=C??w)!==null&&n!==void 0?n:b,N=f==null?void 0:f.filteredKeys,[U,W]=bVt(Cie(N)),k=le=>{let{selectedKeys:Te}=le;W(Te)},D=(le,Te)=>{let{node:ge,checked:Se}=Te;k(c?{selectedKeys:le}:{selectedKeys:Se&&ge.key?[ge.key]:[]})};m.useEffect(()=>{b&&k({selectedKeys:Cie(N)})},[N]);const[L,j]=m.useState([]),B=le=>{j(le)},[O,V]=m.useState(""),G=le=>{const{value:Te}=le.target;V(Te)};m.useEffect(()=>{b||V("")},[b]);const q=le=>{const Te=le&&le.length?le:null;if(Te===null&&(!f||!f.filteredKeys)||v0e(Te,f==null?void 0:f.filteredKeys,!0))return null;p({column:i,key:l,filteredKeys:Te})},$=()=>{F(!1),q(U())},ie=function(){let{confirm:le,closeDropdown:Te}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{confirm:!1,closeDropdown:!1};le&&q([]),Te&&F(!1),V(""),W(v?(T||[]).map(ge=>String(ge)):[])},Q=function(){let{closeDropdown:le}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{closeDropdown:!0};le&&F(!1),q(U())},se=(le,Te)=>{Te.source==="trigger"&&(le&&N!==void 0&&W(Cie(N)),F(le),!le&&!i.filterDropdown&&s&&$())},Z=Un({[`${a}-menu-without-submenu`]:!A_t(i.filters||[])}),ee=le=>{if(le.target.checked){const Te=DC(i==null?void 0:i.filters).map(ge=>String(ge));W(Te)}else W([])},te=le=>{let{filters:Te}=le;return(Te||[]).map((ge,Se)=>{const Re=String(ge.value),De={title:ge.text,key:ge.value!==void 0?Re:String(Se)};return ge.children&&(De.children=te({filters:ge.children})),De})},oe=le=>{var Te;return Object.assign(Object.assign({},le),{text:le.title,value:le.key,children:((Te=le.children)===null||Te===void 0?void 0:Te.map(ge=>oe(ge)))||[]})};let de;if(typeof i.filterDropdown=="function")de=i.filterDropdown({prefixCls:`${a}-custom`,setSelectedKeys:le=>k({selectedKeys:le}),selectedKeys:U(),confirm:Q,clearFilters:ie,filters:i.filters,visible:E,close:()=>{F(!1)}});else if(i.filterDropdown)de=i.filterDropdown;else{const le=U()||[],Te=()=>{const Se=m.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,description:g.filterEmptyText,imageStyle:{height:24},style:{margin:0,padding:"16px 0"}});if((i.filters||[]).length===0)return Se;if(u==="tree")return m.createElement(m.Fragment,null,m.createElement(vbe,{filterSearch:d,value:O,onChange:G,tablePrefixCls:o,locale:g}),m.createElement("div",{className:`${o}-filter-dropdown-tree`},c?m.createElement(Li,{checked:le.length===DC(i.filters).length,indeterminate:le.length>0&&le.lengthtypeof d=="function"?d(O,oe(Ae)):OKe(O,Ae.title):void 0})));const Re=VKe({filters:i.filters||[],filterSearch:d,prefixCls:r,filteredKeys:U(),filterMultiple:c,searchValue:O}),De=Re.every(Ae=>Ae===null);return m.createElement(m.Fragment,null,m.createElement(vbe,{filterSearch:d,value:O,onChange:G,tablePrefixCls:o,locale:g}),De?Se:m.createElement(XH,{selectable:!0,multiple:c,prefixCls:`${a}-menu`,className:Z,onSelect:k,onDeselect:k,selectedKeys:le,getPopupContainer:y,openKeys:L,onOpenChange:B,items:Re}))},ge=()=>v?v0e((T||[]).map(Se=>String(Se)),le,!0):le.length===0;de=m.createElement(m.Fragment,null,Te(),m.createElement("div",{className:`${r}-dropdown-btns`},m.createElement(io,{type:"link",size:"small",disabled:ge(),onClick:()=>ie()},g.filterReset),m.createElement(io,{type:"primary",size:"small",onClick:$},g.filterConfirm)))}i.filterDropdown&&(de=m.createElement(xXe,{selectable:void 0},de));const he=()=>m.createElement(y_t,{className:`${r}-dropdown`},de);let pe;typeof i.filterIcon=="function"?pe=i.filterIcon(H):i.filterIcon?pe=i.filterIcon:pe=m.createElement(xVt,null);const{direction:me}=m.useContext(Cr);return m.createElement("div",{className:`${r}-column`},m.createElement("span",{className:`${o}-column-title`},A),m.createElement(rA,{dropdownRender:he,trigger:["click"],open:E,onOpenChange:se,getPopupContainer:y,placement:me==="rtl"?"bottomLeft":"bottomRight",rootClassName:S},m.createElement("span",{role:"button",tabIndex:-1,className:Un(`${r}-trigger`,{active:H}),onClick:le=>{le.stopPropagation()}},pe)))}function Eue(t,e,n){let o=[];return(t||[]).forEach((r,i)=>{var a;const l=rN(i,n);if(r.filters||"filterDropdown"in r||"onFilter"in r)if("filteredValue"in r){let s=r.filteredValue;"filterDropdown"in r||(s=(a=s==null?void 0:s.map(String))!==null&&a!==void 0?a:s),o.push({column:r,key:eb(r,l),filteredKeys:s,forceFiltered:r.filtered})}else o.push({column:r,key:eb(r,l),filteredKeys:e&&r.defaultFilteredValue?r.defaultFilteredValue:void 0,forceFiltered:r.filtered});"children"in r&&(o=[].concat(Qa(o),Qa(Eue(r.children,e,l))))}),o}function _Ke(t,e,n,o,r,i,a,l,s){return n.map((c,u)=>{const d=rN(u,l),{filterOnClose:f=!0,filterMultiple:p=!0,filterMode:g,filterSearch:A}=c;let y=c;if(y.filters||y.filterDropdown){const S=eb(y,d),C=o.find(P=>{let{key:v}=P;return S===v});y=Object.assign(Object.assign({},y),{title:P=>m.createElement(w_t,{tablePrefixCls:t,prefixCls:`${t}-filter`,dropdownPrefixCls:e,column:y,columnKey:S,filterState:C,filterOnClose:f,filterMultiple:p,filterMode:g,filterSearch:A,triggerFilter:i,locale:r,getPopupContainer:a,rootClassName:s},vQ(c.title,P))})}return"children"in y&&(y=Object.assign(Object.assign({},y),{children:_Ke(t,e,y.children,o,r,i,a,d,s)})),y})}function xbe(t){const e={};return t.forEach(n=>{let{key:o,filteredKeys:r,column:i}=n;const a=o,{filters:l,filterDropdown:s}=i;if(s)e[a]=r||null;else if(Array.isArray(r)){const c=DC(l);e[a]=c.filter(u=>r.includes(String(u)))}else e[a]=null}),e}function Fue(t,e,n){return e.reduce((o,r)=>{const{column:{onFilter:i,filters:a},filteredKeys:l}=r;return i&&l&&l.length?o.map(s=>Object.assign({},s)).filter(s=>l.some(c=>{const u=DC(a),d=u.findIndex(p=>String(p)===String(c)),f=d!==-1?u[d]:c;return s[n]&&(s[n]=Fue(s[n],e,n)),i(f,s)})):o},t)}const GKe=t=>t.flatMap(e=>"children"in e?[e].concat(Qa(GKe(e.children||[]))):[e]);function v_t(t){let{prefixCls:e,dropdownPrefixCls:n,mergedColumns:o,onFilterChange:r,getPopupContainer:i,locale:a,rootClassName:l}=t;Bb();const s=m.useMemo(()=>GKe(o||[]),[o]),[c,u]=m.useState(()=>Eue(s,!0)),d=m.useMemo(()=>{const A=Eue(s,!1);if(A.length===0)return A;let y=!0;if(A.forEach(S=>{let{filteredKeys:C}=S;C!==void 0&&(y=!1)}),y){const S=(s||[]).map((C,P)=>eb(C,rN(P)));return c.filter(C=>{let{key:P}=C;return S.includes(P)}).map(C=>{const P=s[S.findIndex(v=>v===C.key)];return Object.assign(Object.assign({},C),{column:Object.assign(Object.assign({},C.column),P),forceFiltered:P.filtered})})}return A},[s,c]),f=m.useMemo(()=>xbe(d),[d]),p=A=>{const y=d.filter(S=>{let{key:C}=S;return C!==A.key});y.push(A),u(y),r(xbe(y),y)};return[A=>_Ke(e,n,A,d,a,p,i,void 0,l),d,f]}function x_t(t,e,n){const o=m.useRef({});function r(i){if(!o.current||o.current.data!==t||o.current.childrenColumnName!==e||o.current.getRowKey!==n){let s=function(c){c.forEach((u,d)=>{const f=n(u,d);l.set(f,u),u&&typeof u=="object"&&e in u&&s(u[e]||[])})};var a=s;const l=new Map;s(t),o.current={data:t,childrenColumnName:e,kvMap:l,getRowKey:n}}return o.current.kvMap.get(i)}return[r]}var b_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const i=t[r];typeof i!="function"&&(n[r]=i)}),n}function T_t(t,e,n){const o=n&&typeof n=="object"?n:{},{total:r=0}=o,i=b_t(o,["total"]),[a,l]=m.useState(()=>({current:"defaultCurrent"in i?i.defaultCurrent:1,pageSize:"defaultPageSize"in i?i.defaultPageSize:XKe})),s=KJe(a,i,{total:r>0?r:t}),c=Math.ceil((r||t)/s.pageSize);s.current>c&&(s.current=c||1);const u=(f,p)=>{l({current:f??1,pageSize:p||s.pageSize})},d=(f,p)=>{var g;n&&((g=n.onChange)===null||g===void 0||g.call(n,f,p)),u(f,p),e(f,p||(s==null?void 0:s.pageSize))};return n===!1?[{},()=>{}]:[Object.assign(Object.assign({},s),{onChange:d}),u]}var P_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},C_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:P_t}))},JKe=m.forwardRef(C_t),R_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},H_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:R_t}))},M_t=m.forwardRef(H_t);const t_="ascend",Rie="descend";function QG(t){return typeof t.sorter=="object"&&typeof t.sorter.multiple=="number"?t.sorter.multiple:!1}function bbe(t){return typeof t=="function"?t:t&&typeof t=="object"&&t.compare?t.compare:!1}function I_t(t,e){return e?t[t.indexOf(e)+1]:t[0]}function kue(t,e,n){let o=[];function r(i,a){o.push({column:i,key:eb(i,a),multiplePriority:QG(i),sortOrder:i.sortOrder})}return(t||[]).forEach((i,a)=>{const l=rN(a,n);i.children?("sortOrder"in i&&r(i,l),o=[].concat(Qa(o),Qa(kue(i.children,e,l)))):i.sorter&&("sortOrder"in i?r(i,l):e&&i.defaultSortOrder&&o.push({column:i,key:eb(i,l),multiplePriority:QG(i),sortOrder:i.defaultSortOrder}))}),o}function KKe(t,e,n,o,r,i,a,l){return(e||[]).map((s,c)=>{const u=rN(c,l);let d=s;if(d.sorter){const f=d.sortDirections||r,p=d.showSorterTooltip===void 0?a:d.showSorterTooltip,g=eb(d,u),A=n.find(b=>{let{key:R}=b;return R===g}),y=A?A.sortOrder:null,S=I_t(f,y);let C;if(s.sortIcon)C=s.sortIcon({sortOrder:y});else{const b=f.includes(t_)&&m.createElement(M_t,{className:Un(`${t}-column-sorter-up`,{active:y===t_})}),R=f.includes(Rie)&&m.createElement(JKe,{className:Un(`${t}-column-sorter-down`,{active:y===Rie})});C=m.createElement("span",{className:Un(`${t}-column-sorter`,{[`${t}-column-sorter-full`]:!!(b&&R)})},m.createElement("span",{className:`${t}-column-sorter-inner`,"aria-hidden":"true"},b,R))}const{cancelSort:P,triggerAsc:v,triggerDesc:T}=i||{};let w=P;S===Rie?w=T:S===t_&&(w=v);const x=typeof p=="object"?Object.assign({title:w},p):{title:w};d=Object.assign(Object.assign({},d),{className:Un(d.className,{[`${t}-column-sort`]:y}),title:b=>{const R=`${t}-column-sorters`,H=m.createElement("span",{className:`${t}-column-title`},vQ(s.title,b)),F=m.createElement("div",{className:R},H,C);return p?typeof p!="boolean"&&(p==null?void 0:p.target)==="sorter-icon"?m.createElement("div",{className:`${R} ${t}-column-sorters-tooltip-target-sorter`},H,m.createElement(oA,Object.assign({},x),C)):m.createElement(oA,Object.assign({},x),F):F},onHeaderCell:b=>{const R=s.onHeaderCell&&s.onHeaderCell(b)||{},H=R.onClick,F=R.onKeyDown;R.onClick=U=>{o({column:s,key:g,sortOrder:S,multiplePriority:QG(s)}),H==null||H(U)},R.onKeyDown=U=>{U.keyCode===fi.ENTER&&(o({column:s,key:g,sortOrder:S,multiplePriority:QG(s)}),F==null||F(U))};const E=AVt(s.title,{}),N=E==null?void 0:E.toString();return y?R["aria-sort"]=y==="ascend"?"ascending":"descending":R["aria-label"]=N||"",R.className=Un(R.className,`${t}-column-has-sorters`),R.tabIndex=0,s.ellipsis&&(R.title=(E??"").toString()),R}})}return"children"in d&&(d=Object.assign(Object.assign({},d),{children:KKe(t,d.children,n,o,r,i,a,u)})),d})}const Sbe=t=>{const{column:e,sortOrder:n}=t;return{column:e,order:n,field:e.dataIndex,columnKey:e.key}},Tbe=t=>{const e=t.filter(n=>{let{sortOrder:o}=n;return o}).map(Sbe);if(e.length===0&&t.length){const n=t.length-1;return Object.assign(Object.assign({},Sbe(t[n])),{column:void 0})}return e.length<=1?e[0]||{}:e};function Lue(t,e,n){const o=e.slice().sort((a,l)=>l.multiplePriority-a.multiplePriority),r=t.slice(),i=o.filter(a=>{let{column:{sorter:l},sortOrder:s}=a;return bbe(l)&&s});return i.length?r.sort((a,l)=>{for(let s=0;s{const l=a[n];return l?Object.assign(Object.assign({},a),{[n]:Lue(l,e,n)}):a}):r}function z_t(t){let{prefixCls:e,mergedColumns:n,onSorterChange:o,sortDirections:r,tableLocale:i,showSorterTooltip:a}=t;const[l,s]=m.useState(kue(n,!0)),c=m.useMemo(()=>{let g=!0;const A=kue(n,!1);if(!A.length)return l;const y=[];function S(P){g?y.push(P):y.push(Object.assign(Object.assign({},P),{sortOrder:null}))}let C=null;return A.forEach(P=>{C===null?(S(P),P.sortOrder&&(P.multiplePriority===!1?g=!1:C=!0)):(C&&P.multiplePriority!==!1||(g=!1),S(P))}),y},[n,l]),u=m.useMemo(()=>{const g=c.map(A=>{let{column:y,sortOrder:S}=A;return{column:y,order:S}});return{sortColumns:g,sortColumn:g[0]&&g[0].column,sortOrder:g[0]&&g[0].order}},[c]),d=g=>{let A;g.multiplePriority===!1||!c.length||c[0].multiplePriority===!1?A=[g]:A=[].concat(Qa(c.filter(y=>{let{key:S}=y;return S!==g.key})),[g]),s(A),o(Tbe(A),A)};return[g=>KKe(e,g,c,d,r,i,a),c,u,()=>Tbe(c)]}function qKe(t,e){return t.map(n=>{const o=Object.assign({},n);return o.title=vQ(n.title,e),"children"in o&&(o.children=qKe(o.children,e)),o})}function D_t(t){return[m.useCallback(n=>qKe(n,t),[t])]}const E_t=vKe((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),F_t=bKe((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),k_t=t=>{const{componentCls:e,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:i,tablePaddingVertical:a,tablePaddingHorizontal:l,calc:s}=t,c=`${jt(n)} ${o} ${r}`,u=(d,f,p)=>({[`&${e}-${d}`]:{[`> ${e}-container`]:{[`> ${e}-content, > ${e}-body`]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{[`> ${e}-expanded-row-fixed`]:{margin:`${jt(s(f).mul(-1).equal())} + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,JOt="".concat(GOt," ").concat(XOt).split(/[\s\n]+/),KOt="aria-",qOt="data-";function obe(t,e){return t.indexOf(e)===0}function zKe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;e===!1?n={aria:!0,data:!0,attr:!0}:e===!0?n={aria:!0}:n=Ru({},e);var o={};return Object.keys(t).forEach(function(r){(n.aria&&(r==="role"||obe(r,KOt))||n.data&&obe(r,qOt)||n.attr&&JOt.includes(r))&&(o[r]=t[r])}),o}var Tye=m.createContext(null),$Ot=function(e){for(var n=e.prefixCls,o=e.level,r=e.isStart,i=e.isEnd,a="".concat(n,"-indent-unit"),l=[],s=0;s1&&arguments[1]!==void 0?arguments[1]:{},n=[];return be.Children.forEach(t,function(o){o==null&&!e.keepEmpty||(Array.isArray(o)?n=n.concat(Rue(o)):HC.isFragment(o)&&o.props?n=n.concat(Rue(o.props.children,e)):n.push(o))}),n}function ZOt(t,e){var n=Ru({},t);return Array.isArray(e)&&e.forEach(function(o){delete n[o]}),n}var eVt=["children"];function DKe(t,e){return"".concat(t,"-").concat(e)}function tVt(t){return t&&t.type&&t.type.isTreeNode}function oN(t,e){return t??e}function bR(t){var e=t||{},n=e.title,o=e._title,r=e.key,i=e.children,a=n||"title";return{title:a,_title:o||[a],key:r||"key",children:i||"children"}}function EKe(t){function e(n){var o=Rue(n);return o.map(function(r){if(!tVt(r))return b2(!r,"Tree/TreeNode can only accept TreeNode as children."),null;var i=r.key,a=r.props,l=a.children,s=wQ(a,eVt),c=Ru({key:i},s),u=e(l);return u.length&&(c.children=u),c}).filter(function(r){return r})}return e(t)}function bie(t,e,n){var o=bR(n),r=o._title,i=o.key,a=o.children,l=new Set(e===!0?[]:e),s=[];function c(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return u.map(function(f,p){for(var g=DKe(d?d.pos:"0",p),A=oN(f[i],g),y,S=0;S1&&arguments[1]!==void 0?arguments[1]:{},n=e.initWrapper,o=e.processEntity,r=e.onProcessFinished,i=e.externalGetKey,a=e.childrenPropName,l=e.fieldNames,s=arguments.length>2?arguments[2]:void 0,c=i||s,u={},d={},f={posEntities:u,keyEntities:d};return n&&(f=n(f)||f),nVt(t,function(p){var g=p.node,A=p.index,y=p.pos,S=p.key,C=p.parentPos,P=p.level,v=p.nodes,T={node:g,nodes:v,index:A,key:S,pos:y,level:P},w=oN(S,y);u[y]=T,d[w]=T,T.parent=u[C],T.parent&&(T.parent.children=T.parent.children||[],T.parent.children.push(T)),o&&o(T,f)},{externalGetKey:c,childrenPropName:a,fieldNames:l}),r&&r(f),f}function ME(t,e){var n=e.expandedKeys,o=e.selectedKeys,r=e.loadedKeys,i=e.loadingKeys,a=e.checkedKeys,l=e.halfCheckedKeys,s=e.dragOverNodeKey,c=e.dropPosition,u=e.keyEntities,d=Np(u,t),f={eventKey:t,expanded:n.indexOf(t)!==-1,selected:o.indexOf(t)!==-1,loaded:r.indexOf(t)!==-1,loading:i.indexOf(t)!==-1,checked:a.indexOf(t)!==-1,halfChecked:l.indexOf(t)!==-1,pos:String(d?d.pos:""),dragOver:s===t&&c===0,dragOverGapTop:s===t&&c===-1,dragOverGapBottom:s===t&&c===1};return f}function tu(t){var e=t.data,n=t.expanded,o=t.selected,r=t.checked,i=t.loaded,a=t.loading,l=t.halfChecked,s=t.dragOver,c=t.dragOverGapTop,u=t.dragOverGapBottom,d=t.pos,f=t.active,p=t.eventKey,g=Ru(Ru({},e),{},{expanded:n,selected:o,checked:r,loaded:i,loading:a,halfChecked:l,dragOver:s,dragOverGapTop:c,dragOverGapBottom:u,pos:d,active:f,key:p});return"props"in g||Object.defineProperty(g,"props",{get:function(){return b2(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),t}}),g}var oVt=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],rbe="open",ibe="close",rVt="---",iVt=function(t){HKe(n,t);var e=MKe(n);function n(){var o;CKe(this,n);for(var r=arguments.length,i=new Array(r),a=0;a=0&&n.splice(o,1),n}function f6(t,e){var n=(t||[]).slice();return n.indexOf(e)===-1&&n.push(e),n}function Cye(t){return t.split("-")}function aVt(t,e){var n=[],o=Np(e,t);function r(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(a){var l=a.key,s=a.children;n.push(l),r(s)})}return r(o.children),n}function lVt(t){if(t.parent){var e=Cye(t.pos);return Number(e[e.length-1])===t.parent.children.length-1}return!1}function sVt(t){var e=Cye(t.pos);return Number(e[e.length-1])===0}function abe(t,e,n,o,r,i,a,l,s,c){var u,d=t.clientX,f=t.clientY,p=t.target.getBoundingClientRect(),g=p.top,A=p.height,y=(c==="rtl"?-1:1)*(((r==null?void 0:r.x)||0)-d),S=(y-12)/o,C=s.filter(function(k){var D;return(D=l[k])===null||D===void 0||(D=D.children)===null||D===void 0?void 0:D.length}),P=Np(l,n.props.eventKey);if(f-1.5?i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:0})?H=0:i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1:i({dragNode:N,dropNode:U,dropPosition:1})?H=1:W=!1,{dropPosition:H,dropLevelOffset:F,dropTargetKey:P.key,dropTargetPos:P.pos,dragOverNodeKey:R,dropContainerKey:H===0?null:((u=P.parent)===null||u===void 0?void 0:u.key)||null,dropAllowed:W}}function lbe(t,e){if(t){var n=e.multiple;return n?t.slice():t.length?[t[0]]:t}}function Sie(t){if(!t)return null;var e;if(Array.isArray(t))e={checkedKeys:t,halfCheckedKeys:void 0};else if(aA(t)==="object")e={checkedKeys:t.checked||void 0,halfCheckedKeys:t.halfChecked||void 0};else return b2(!1,"`checkedKeys` is not an array or an object"),null;return e}function Hue(t,e){var n=new Set;function o(r){if(!n.has(r)){var i=Np(e,r);if(i){n.add(r);var a=i.parent,l=i.node;l.disabled||a&&o(a.key)}}}return(t||[]).forEach(function(r){o(r)}),bx(n)}function FKe(t,e){var n=new Set;return t.forEach(function(o){e.has(o)||n.add(o)}),n}function cVt(t){var e=t||{},n=e.disabled,o=e.disableCheckbox,r=e.checkable;return!!(n||o)||r===!1}function uVt(t,e,n,o){for(var r=new Set(t),i=new Set,a=0;a<=n;a+=1){var l=e.get(a)||new Set;l.forEach(function(d){var f=d.key,p=d.node,g=d.children,A=g===void 0?[]:g;r.has(f)&&!o(p)&&A.filter(function(y){return!o(y.node)}).forEach(function(y){r.add(y.key)})})}for(var s=new Set,c=n;c>=0;c-=1){var u=e.get(c)||new Set;u.forEach(function(d){var f=d.parent,p=d.node;if(!(o(p)||!d.parent||s.has(d.parent.key))){if(o(d.parent.node)){s.add(f.key);return}var g=!0,A=!1;(f.children||[]).filter(function(y){return!o(y.node)}).forEach(function(y){var S=y.key,C=r.has(S);g&&!C&&(g=!1),!A&&(C||i.has(S))&&(A=!0)}),g&&r.add(f.key),A&&i.add(f.key),s.add(f.key)}})}return{checkedKeys:Array.from(r),halfCheckedKeys:Array.from(FKe(i,r))}}function dVt(t,e,n,o,r){for(var i=new Set(t),a=new Set(e),l=0;l<=o;l+=1){var s=n.get(l)||new Set;s.forEach(function(f){var p=f.key,g=f.node,A=f.children,y=A===void 0?[]:A;!i.has(p)&&!a.has(p)&&!r(g)&&y.filter(function(S){return!r(S.node)}).forEach(function(S){i.delete(S.key)})})}a=new Set;for(var c=new Set,u=o;u>=0;u-=1){var d=n.get(u)||new Set;d.forEach(function(f){var p=f.parent,g=f.node;if(!(r(g)||!f.parent||c.has(f.parent.key))){if(r(f.parent.node)){c.add(p.key);return}var A=!0,y=!1;(p.children||[]).filter(function(S){return!r(S.node)}).forEach(function(S){var C=S.key,P=i.has(C);A&&!P&&(A=!1),!y&&(P||a.has(C))&&(y=!0)}),A||i.delete(p.key),y&&a.add(p.key),c.add(p.key)}})}return{checkedKeys:Array.from(i),halfCheckedKeys:Array.from(FKe(a,i))}}function zC(t,e,n,o){var r=[],i;o?i=o:i=cVt;var a=new Set(t.filter(function(u){var d=!!Np(n,u);return d||r.push(u),d})),l=new Map,s=0;Object.keys(n).forEach(function(u){var d=n[u],f=d.level,p=l.get(f);p||(p=new Set,l.set(f,p)),p.add(d),s=Math.max(s,f)}),b2(!r.length,"Tree missing follow keys: ".concat(r.slice(0,100).map(function(u){return"'".concat(u,"'")}).join(", ")));var c;return e===!0?c=uVt(a,l,s,i):c=dVt(a,e.halfCheckedKeys,l,s,i),c}function fVt(t){const[e,n]=m.useState(null);return[m.useCallback((i,a,l)=>{const s=e??i,c=Math.min(s||0,i),u=Math.max(s||0,i),d=a.slice(c,u+1).map(g=>t(g)),f=d.some(g=>!l.has(g)),p=[];return d.forEach(g=>{f?(l.has(g)||p.push(g),l.add(g)):(l.delete(g),p.push(g))}),n(f?u:null),p},[e]),i=>{n(i)}]}const N4={},Mue="SELECT_ALL",Iue="SELECT_INVERT",zue="SELECT_NONE",sbe=[],kKe=(t,e)=>{let n=[];return(e||[]).forEach(o=>{n.push(o),o&&typeof o=="object"&&t in o&&(n=[].concat(Qa(n),Qa(kKe(t,o[t]))))}),n},hVt=(t,e)=>{const{preserveSelectedRowKeys:n,selectedRowKeys:o,defaultSelectedRowKeys:r,getCheckboxProps:i,onChange:a,onSelect:l,onSelectAll:s,onSelectInvert:c,onSelectNone:u,onSelectMultiple:d,columnWidth:f,type:p,selections:g,fixed:A,renderCell:y,hideSelectAll:S,checkStrictly:C=!0}=e||{},{prefixCls:P,data:v,pageData:T,getRecordByKey:w,getRowKey:x,expandType:b,childrenColumnName:R,locale:H,getPopupContainer:F}=t,E=Bb(),[N,U]=fVt(te=>te),[W,k]=Z6(o||r||sbe,{value:o}),D=m.useRef(new Map),L=m.useCallback(te=>{if(n){const ee=new Map;te.forEach(de=>{let fe=w(de);!fe&&D.current.has(de)&&(fe=D.current.get(de)),ee.set(de,fe)}),D.current=ee}},[w,n]);m.useEffect(()=>{L(W)},[W]);const{keyEntities:j}=m.useMemo(()=>{if(C)return{keyEntities:null};let te=v;if(n){const ee=new Set(v.map((fe,pe)=>x(fe,pe))),de=Array.from(D.current).reduce((fe,pe)=>{let[ye,ae]=pe;return ee.has(ye)?fe:fe.concat(ae)},[]);te=[].concat(Qa(te),Qa(de))}return Pye(te,{externalGetKey:x,childrenPropName:R})},[v,x,C,R,n]),B=m.useMemo(()=>kKe(R,T),[R,T]),O=m.useMemo(()=>{const te=new Map;return B.forEach((ee,de)=>{const fe=x(ee,de),pe=(i?i(ee):null)||{};te.set(fe,pe)}),te},[B,x,i]),V=m.useCallback(te=>{var ee;return!!(!((ee=O.get(x(te)))===null||ee===void 0)&&ee.disabled)},[O,x]),[G,q]=m.useMemo(()=>{if(C)return[W||[],[]];const{checkedKeys:te,halfCheckedKeys:ee}=zC(W,!0,j,V);return[te||[],ee]},[W,C,j,V]),$=m.useMemo(()=>{const te=p==="radio"?G.slice(0,1):G;return new Set(te)},[G,p]),ie=m.useMemo(()=>p==="radio"?new Set:new Set(q),[q,p]);m.useEffect(()=>{e||k(sbe)},[!!e]);const Q=m.useCallback((te,ee)=>{let de,fe;L(te),n?(de=te,fe=te.map(pe=>D.current.get(pe))):(de=[],fe=[],te.forEach(pe=>{const ye=w(pe);ye!==void 0&&(de.push(pe),fe.push(ye))})),k(de),a==null||a(de,fe,{type:ee})},[k,w,a,n]),se=m.useCallback((te,ee,de,fe)=>{if(l){const pe=de.map(ye=>w(ye));l(w(te),ee,pe,fe)}Q(de,"single")},[l,w,Q]),oe=m.useMemo(()=>!g||S?null:(g===!0?[Mue,Iue,zue]:g).map(ee=>ee===Mue?{key:"all",text:H.selectionAll,onSelect(){Q(v.map((de,fe)=>x(de,fe)).filter(de=>{const fe=O.get(de);return!(fe!=null&&fe.disabled)||$.has(de)}),"all")}}:ee===Iue?{key:"invert",text:H.selectInvert,onSelect(){const de=new Set($);T.forEach((pe,ye)=>{const ae=x(pe,ye),Te=O.get(ae);Te!=null&&Te.disabled||(de.has(ae)?de.delete(ae):de.add(ae))});const fe=Array.from(de);c&&(E.deprecated(!1,"onSelectInvert","onChange"),c(fe)),Q(fe,"invert")}}:ee===zue?{key:"none",text:H.selectNone,onSelect(){u==null||u(),Q(Array.from($).filter(de=>{const fe=O.get(de);return fe==null?void 0:fe.disabled}),"none")}}:ee).map(ee=>Object.assign(Object.assign({},ee),{onSelect:function(){for(var de,fe,pe=arguments.length,ye=new Array(pe),ae=0;ae{var ee;if(!e)return te.filter(Me=>Me!==N4);let de=Qa(te);const fe=new Set($),pe=B.map(x).filter(Me=>!O.get(Me).disabled),ye=pe.every(Me=>fe.has(Me)),ae=pe.some(Me=>fe.has(Me)),Te=()=>{const Me=[];ye?pe.forEach(Ne=>{fe.delete(Ne),Me.push(Ne)}):pe.forEach(Ne=>{fe.has(Ne)||(fe.add(Ne),Me.push(Ne))});const ze=Array.from(fe);s==null||s(!ye,ze.map(Ne=>w(Ne)),Me.map(Ne=>w(Ne))),Q(ze,"all"),U(null)};let ge,Se;if(p!=="radio"){let Me;if(oe){const nt={getPopupContainer:F,items:oe.map((We,Ee)=>{const{key:ke,text:Oe,onSelect:st}=We;return{key:ke??Ee,onClick:()=>{st==null||st(pe)},label:Oe}})};Me=m.createElement("div",{className:`${P}-selection-extra`},m.createElement(rA,{menu:nt,getPopupContainer:F},m.createElement("span",null,m.createElement(Bme,null))))}const ze=B.map((nt,We)=>{const Ee=x(nt,We),ke=O.get(Ee)||{};return Object.assign({checked:fe.has(Ee)},ke)}).filter(nt=>{let{disabled:We}=nt;return We}),Ne=!!ze.length&&ze.length===B.length,Je=Ne&&ze.every(nt=>{let{checked:We}=nt;return We}),Ue=Ne&&ze.some(nt=>{let{checked:We}=nt;return We});Se=m.createElement(Li,{checked:Ne?Je:!!B.length&&ye,indeterminate:Ne?!Je&&Ue:!ye&&ae,onChange:Te,disabled:B.length===0||Ne,"aria-label":Me?"Custom selection":"Select all",skipGroup:!0}),ge=!S&&m.createElement("div",{className:`${P}-selection`},Se,Me)}let Re;p==="radio"?Re=(Me,ze,Ne)=>{const Je=x(ze,Ne),Ue=fe.has(Je);return{node:m.createElement(Le,Object.assign({},O.get(Je),{checked:Ue,onClick:nt=>nt.stopPropagation(),onChange:nt=>{fe.has(Je)||se(Je,!0,[Je],nt.nativeEvent)}})),checked:Ue}}:Re=(Me,ze,Ne)=>{var Je;const Ue=x(ze,Ne),nt=fe.has(Ue),We=ie.has(Ue),Ee=O.get(Ue);let ke;return b==="nest"?ke=We:ke=(Je=Ee==null?void 0:Ee.indeterminate)!==null&&Je!==void 0?Je:We,{node:m.createElement(Li,Object.assign({},Ee,{indeterminate:ke,checked:nt,skipGroup:!0,onClick:Oe=>Oe.stopPropagation(),onChange:Oe=>{let{nativeEvent:st}=Oe;const{shiftKey:je}=st,xt=pe.findIndex(Ye=>Ye===Ue),gt=G.some(Ye=>pe.includes(Ye));if(je&&C&>){const Ye=N(xt,pe,fe),it=Array.from(fe);d==null||d(!nt,it.map(ut=>w(ut)),Ye.map(ut=>w(ut))),Q(it,"multiple")}else{const Ye=G;if(C){const it=nt?q5(Ye,Ue):f6(Ye,Ue);se(Ue,!nt,it,st)}else{const it=zC([].concat(Qa(Ye),[Ue]),!0,j,V),{checkedKeys:ut,halfCheckedKeys:Qe}=it;let lt=ut;if(nt){const Ze=new Set(ut);Ze.delete(Ue),lt=zC(Array.from(Ze),{checked:!1,halfCheckedKeys:Qe},j,V).checkedKeys}se(Ue,!nt,lt,st)}}U(nt?null:xt)}})),checked:nt}};const De=(Me,ze,Ne)=>{const{node:Je,checked:Ue}=Re(Me,ze,Ne);return y?y(Ue,ze,Ne,Je):Je};if(!de.includes(N4))if(de.findIndex(Me=>{var ze;return((ze=Me[HE])===null||ze===void 0?void 0:ze.columnType)==="EXPAND_COLUMN"})===0){const[Me,...ze]=de;de=[Me,N4].concat(Qa(ze))}else de=[N4].concat(Qa(de));const Ae=de.indexOf(N4);de=de.filter((Me,ze)=>Me!==N4||ze===Ae);const ue=de[Ae-1],he=de[Ae+1];let ve=A;ve===void 0&&((he==null?void 0:he.fixed)!==void 0?ve=he.fixed:(ue==null?void 0:ue.fixed)!==void 0&&(ve=ue.fixed)),ve&&ue&&((ee=ue[HE])===null||ee===void 0?void 0:ee.columnType)==="EXPAND_COLUMN"&&ue.fixed===void 0&&(ue.fixed=ve);const we=Un(`${P}-selection-col`,{[`${P}-selection-col-with-dropdown`]:g&&p==="checkbox"}),Pe=()=>e!=null&&e.columnTitle?typeof e.columnTitle=="function"?e.columnTitle(Se):e.columnTitle:ge,Ie={fixed:ve,width:f,className:`${P}-selection-column`,title:Pe(),render:De,onCell:e.onCell,[HE]:{className:we}};return de.map(Me=>Me===N4?Ie:Me)},[x,B,e,G,$,ie,f,oe,b,O,d,se,V]),$]};function pVt(t,e){return t._antProxy=t._antProxy||{},Object.keys(e).forEach(n=>{if(!(n in t._antProxy)){const o=t[n];t._antProxy[n]=o,t[n]=e[n]}}),t}function gVt(t,e){return m.useImperativeHandle(t,()=>{const n=e(),{nativeElement:o}=n;return typeof Proxy<"u"?new Proxy(o,{get(r,i){return n[i]?n[i]:Reflect.get(r,i)}}):pVt(o,n)})}function mVt(t){return function(n){let{prefixCls:o,onExpand:r,record:i,expanded:a,expandable:l}=n;const s=`${o}-row-expand-icon`;return m.createElement("button",{type:"button",onClick:c=>{r(i,c),c.stopPropagation()},className:Un(s,{[`${s}-spaced`]:!l,[`${s}-expanded`]:l&&a,[`${s}-collapsed`]:l&&!a}),"aria-label":a?t.collapse:t.expand,"aria-expanded":a})}}function yVt(t){return(n,o)=>{const r=n.querySelector(`.${t}-container`);let i=o;if(r){const a=getComputedStyle(r),l=parseInt(a.borderLeftWidth,10),s=parseInt(a.borderRightWidth,10);i=o-l-s}return i}}function eb(t,e){return"key"in t&&t.key!==void 0&&t.key!==null?t.key:t.dataIndex?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:e}function rN(t,e){return e?`${e}-${t}`:`${t}`}function vQ(t,e){return typeof t=="function"?t(e):t}function AVt(t,e){const n=vQ(t,e);return Object.prototype.toString.call(n)==="[object Object]"?"":n}var wVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"}}]},name:"filter",theme:"filled"},vVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:wVt}))},xVt=m.forwardRef(vVt);function bVt(t){const e=m.useRef(t),n=GGe();return[()=>e.current,o=>{e.current=o,n()}]}var mi={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var n=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=mi.F1&&n<=mi.F12)return!1;switch(n){case mi.ALT:case mi.CAPS_LOCK:case mi.CONTEXT_MENU:case mi.CTRL:case mi.DOWN:case mi.END:case mi.ESC:case mi.HOME:case mi.INSERT:case mi.LEFT:case mi.MAC_FF_META:case mi.META:case mi.NUMLOCK:case mi.NUM_CENTER:case mi.PAGE_DOWN:case mi.PAGE_UP:case mi.PAUSE:case mi.PRINT_SCREEN:case mi.RIGHT:case mi.SHIFT:case mi.UP:case mi.WIN_KEY:case mi.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=mi.ZERO&&e<=mi.NINE||e>=mi.NUM_ZERO&&e<=mi.NUM_MULTIPLY||e>=mi.A&&e<=mi.Z||window.navigator.userAgent.indexOf("WebKit")!==-1&&e===0)return!0;switch(e){case mi.SPACE:case mi.QUESTION_MARK:case mi.NUM_PLUS:case mi.NUM_MINUS:case mi.NUM_PERIOD:case mi.NUM_DIVISION:case mi.SEMICOLON:case mi.DASH:case mi.EQUALS:case mi.COMMA:case mi.PERIOD:case mi.SLASH:case mi.APOSTROPHE:case mi.SINGLE_QUOTE:case mi.OPEN_SQUARE_BRACKET:case mi.BACKSLASH:case mi.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};function SVt(t){var e=t.dropPosition,n=t.dropLevelOffset,o=t.indent,r={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(e){case-1:r.top=0,r.left=-n*o;break;case 1:r.bottom=0,r.left=-n*o;break;case 0:r.bottom=0,r.left=o;break}return m.createElement("div",{style:r})}function LKe(t){if(t==null)throw new TypeError("Cannot destructure "+t)}function TVt(t){if(Array.isArray(t))return t}function PVt(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(s=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);s=!0);}catch(u){c=!0,r=u}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return l}}function CVt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pv(t,e){return TVt(t)||PVt(t,e)||SKe(t,e)||CVt()}function RVt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var cbe=RVt()?m.useLayoutEffect:m.useEffect,$G=function(e,n){var o=m.useRef(!0);cbe(function(){return e(o.current)},n),cbe(function(){return o.current=!1,function(){o.current=!0}},[])};function HVt(t,e){var n=m.useState(!1),o=Pv(n,2),r=o[0],i=o[1];$G(function(){if(r)return t(),function(){e()}},[r]),$G(function(){return i(!0),function(){i(!1)}},[])}var MVt=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],WKe=function(e,n){var o=e.className,r=e.style,i=e.motion,a=e.motionNodes,l=e.motionType,s=e.onMotionStart,c=e.onMotionEnd,u=e.active,d=e.treeNodeRequiredProps,f=wQ(e,MVt),p=m.useState(!0),g=Pv(p,2),A=g[0],y=g[1],S=m.useContext(Tye),C=S.prefixCls,P=a&&l!=="hide";$G(function(){a&&P!==A&&y(P)},[a]);var v=function(){a&&s()},T=m.useRef(!1),w=function(){a&&!T.current&&(T.current=!0,c())};HVt(v,w);var x=function(R){P===R&&w()};return a?m.createElement(o1,M9({ref:n,visible:A},i,{motionAppear:l==="show",onVisibleChanged:x}),function(b,R){var H=b.className,F=b.style;return m.createElement("div",{ref:R,className:r9("".concat(C,"-treenode-motion"),H),style:F},a.map(function(E){var N=Object.assign({},(LKe(E.data),E.data)),U=E.title,W=E.key,k=E.isStart,D=E.isEnd;delete N.children;var L=ME(W,d);return m.createElement(SR,M9({},N,L,{title:U,active:u,data:E.data,key:W,isStart:k,isEnd:D}))}))}):m.createElement(SR,M9({domRef:n,className:o,style:r},f,{active:u}))};WKe.displayName="MotionTreeNode";var IVt=m.forwardRef(WKe);function zVt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=t.length,o=e.length;if(Math.abs(n-o)!==1)return{add:!1,key:null};function r(i,a){var l=new Map;i.forEach(function(c){l.set(c,!0)});var s=a.filter(function(c){return!l.has(c)});return s.length===1?s[0]:null}return n ").concat(e);return e}var UKe=m.forwardRef(function(t,e){var n=t.prefixCls,o=t.data;t.selectable,t.checkable;var r=t.expandedKeys,i=t.selectedKeys,a=t.checkedKeys,l=t.loadedKeys,s=t.loadingKeys,c=t.halfCheckedKeys,u=t.keyEntities,d=t.disabled,f=t.dragging,p=t.dragOverNodeKey,g=t.dropPosition,A=t.motion,y=t.height,S=t.itemHeight,C=t.virtual,P=t.focusable,v=t.activeItem,T=t.focused,w=t.tabIndex,x=t.onKeyDown,b=t.onFocus,R=t.onBlur,H=t.onActiveChange,F=t.onListChangeStart,E=t.onListChangeEnd,N=wQ(t,DVt),U=m.useRef(null),W=m.useRef(null);m.useImperativeHandle(e,function(){return{scrollTo:function(Re){U.current.scrollTo(Re)},getIndentWidth:function(){return W.current.offsetWidth}}});var k=m.useState(r),D=Pv(k,2),L=D[0],j=D[1],B=m.useState(o),O=Pv(B,2),V=O[0],G=O[1],q=m.useState(o),$=Pv(q,2),ie=$[0],Q=$[1],se=m.useState([]),oe=Pv(se,2),Z=oe[0],te=oe[1],ee=m.useState(null),de=Pv(ee,2),fe=de[0],pe=de[1],ye=m.useRef(o);ye.current=o;function ae(){var Se=ye.current;G(Se),Q(Se),te([]),pe(null),E()}$G(function(){j(r);var Se=zVt(L,r);if(Se.key!==null)if(Se.add){var Re=V.findIndex(function(we){var Pe=we.key;return Pe===Se.key}),De=hbe(ube(V,o,Se.key),C,y,S),Ae=V.slice();Ae.splice(Re+1,0,fbe),Q(Ae),te(De),pe("show")}else{var ue=o.findIndex(function(we){var Pe=we.key;return Pe===Se.key}),he=hbe(ube(o,V,Se.key),C,y,S),ve=o.slice();ve.splice(ue+1,0,fbe),Q(ve),te(he),pe("hide")}else V!==o&&(G(o),Q(o))},[r,o]),m.useEffect(function(){f||ae()},[f]);var Te=A?ie:o,ge={expandedKeys:r,selectedKeys:i,loadedKeys:l,loadingKeys:s,checkedKeys:a,halfCheckedKeys:c,dragOverNodeKey:p,dropPosition:g,keyEntities:u};return m.createElement(m.Fragment,null,T&&v&&m.createElement("span",{style:dbe,"aria-live":"assertive"},FVt(v)),m.createElement("div",null,m.createElement("input",{style:dbe,disabled:P===!1||d,tabIndex:P!==!1?w:null,onKeyDown:x,onFocus:b,onBlur:R,value:"",onChange:EVt,"aria-label":"for screen reader"})),m.createElement("div",{className:"".concat(n,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},m.createElement("div",{className:"".concat(n,"-indent")},m.createElement("div",{ref:W,className:"".concat(n,"-indent-unit")}))),m.createElement(q$,M9({},N,{data:Te,itemKey:pbe,height:y,fullHeight:!1,virtual:C,itemHeight:S,prefixCls:"".concat(n,"-list"),ref:U,onVisibleChange:function(Re,De){var Ae=new Set(Re),ue=De.filter(function(he){return!Ae.has(he)});ue.some(function(he){return pbe(he)===tb})&&ae()}}),function(Se){var Re=Se.pos,De=Object.assign({},(LKe(Se.data),Se.data)),Ae=Se.title,ue=Se.key,he=Se.isStart,ve=Se.isEnd,we=oN(ue,Re);delete De.key,delete De.children;var Pe=ME(we,ge);return m.createElement(IVt,M9({},De,Pe,{title:Ae,active:!!v&&ue===v.key,pos:Re,data:Se.data,isStart:he,isEnd:ve,motion:A,motionNodes:ue===tb?Z:null,motionType:fe,onMotionStart:F,onMotionEnd:ae,treeNodeRequiredProps:ge,onMouseMove:function(){H(null)}}))}))});UKe.displayName="NodeList";var kVt=10,Rye=function(t){HKe(n,t);var e=MKe(n);function n(){var o;CKe(this,n);for(var r=arguments.length,i=new Array(r),a=0;a2&&arguments[2]!==void 0?arguments[2]:!1,d=o.state,f=d.dragChildrenKeys,p=d.dropPosition,g=d.dropTargetKey,A=d.dropTargetPos,y=d.dropAllowed;if(y){var S=o.props.onDrop;if(o.setState({dragOverNodeKey:null}),o.cleanDragState(),g!==null){var C=Ru(Ru({},ME(g,o.getTreeNodeRequiredProps())),{},{active:((c=o.getActiveItem())===null||c===void 0?void 0:c.key)===g,data:Np(o.state.keyEntities,g).node}),P=f.indexOf(g)!==-1;b2(!P,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var v=Cye(A),T={event:l,node:tu(C),dragNode:o.dragNode?tu(o.dragNode.props):null,dragNodesKeys:[o.dragNode.props.eventKey].concat(f),dropToGap:p!==0,dropPosition:p+Number(v[v.length-1])};u||S==null||S(T),o.dragNode=null}}}),Vo(wr(o),"cleanDragState",function(){var l=o.state.draggingNodeKey;l!==null&&o.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),o.dragStartMousePosition=null,o.currentMouseOverDroppableNodeKey=null}),Vo(wr(o),"triggerExpandActionExpand",function(l,s){var c=o.state,u=c.expandedKeys,d=c.flattenNodes,f=s.expanded,p=s.key,g=s.isLeaf;if(!(g||l.shiftKey||l.metaKey||l.ctrlKey)){var A=d.filter(function(S){return S.key===p})[0],y=tu(Ru(Ru({},ME(p,o.getTreeNodeRequiredProps())),{},{data:A.data}));o.setExpandedKeys(f?q5(u,p):f6(u,p)),o.onNodeExpand(l,y)}}),Vo(wr(o),"onNodeClick",function(l,s){var c=o.props,u=c.onClick,d=c.expandAction;d==="click"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Vo(wr(o),"onNodeDoubleClick",function(l,s){var c=o.props,u=c.onDoubleClick,d=c.expandAction;d==="doubleClick"&&o.triggerExpandActionExpand(l,s),u==null||u(l,s)}),Vo(wr(o),"onNodeSelect",function(l,s){var c=o.state.selectedKeys,u=o.state,d=u.keyEntities,f=u.fieldNames,p=o.props,g=p.onSelect,A=p.multiple,y=s.selected,S=s[f.key],C=!y;C?A?c=f6(c,S):c=[S]:c=q5(c,S);var P=c.map(function(v){var T=Np(d,v);return T?T.node:null}).filter(function(v){return v});o.setUncontrolledState({selectedKeys:c}),g==null||g(c,{event:"select",selected:C,node:s,selectedNodes:P,nativeEvent:l.nativeEvent})}),Vo(wr(o),"onNodeCheck",function(l,s,c){var u=o.state,d=u.keyEntities,f=u.checkedKeys,p=u.halfCheckedKeys,g=o.props,A=g.checkStrictly,y=g.onCheck,S=s.key,C,P={event:"check",node:s,checked:c,nativeEvent:l.nativeEvent};if(A){var v=c?f6(f,S):q5(f,S),T=q5(p,S);C={checked:v,halfChecked:T},P.checkedNodes=v.map(function(F){return Np(d,F)}).filter(function(F){return F}).map(function(F){return F.node}),o.setUncontrolledState({checkedKeys:v})}else{var w=zC([].concat(bx(f),[S]),!0,d),x=w.checkedKeys,b=w.halfCheckedKeys;if(!c){var R=new Set(x);R.delete(S);var H=zC(Array.from(R),{checked:!1,halfCheckedKeys:b},d);x=H.checkedKeys,b=H.halfCheckedKeys}C=x,P.checkedNodes=[],P.checkedNodesPositions=[],P.halfCheckedKeys=b,x.forEach(function(F){var E=Np(d,F);if(E){var N=E.node,U=E.pos;P.checkedNodes.push(N),P.checkedNodesPositions.push({node:N,pos:U})}}),o.setUncontrolledState({checkedKeys:x},!1,{halfCheckedKeys:b})}y==null||y(C,P)}),Vo(wr(o),"onNodeLoad",function(l){var s,c=l.key,u=o.state.keyEntities,d=Np(u,c);if(!(d!=null&&(s=d.children)!==null&&s!==void 0&&s.length)){var f=new Promise(function(p,g){o.setState(function(A){var y=A.loadedKeys,S=y===void 0?[]:y,C=A.loadingKeys,P=C===void 0?[]:C,v=o.props,T=v.loadData,w=v.onLoad;if(!T||S.indexOf(c)!==-1||P.indexOf(c)!==-1)return null;var x=T(l);return x.then(function(){var b=o.state.loadedKeys,R=f6(b,c);w==null||w(R,{event:"load",node:l}),o.setUncontrolledState({loadedKeys:R}),o.setState(function(H){return{loadingKeys:q5(H.loadingKeys,c)}}),p()}).catch(function(b){if(o.setState(function(H){return{loadingKeys:q5(H.loadingKeys,c)}}),o.loadingRetryTimes[c]=(o.loadingRetryTimes[c]||0)+1,o.loadingRetryTimes[c]>=kVt){var R=o.state.loadedKeys;b2(!1,"Retry for `loadData` many times but still failed. No more retry."),o.setUncontrolledState({loadedKeys:f6(R,c)}),p()}g(b)}),{loadingKeys:f6(P,c)}})});return f.catch(function(){}),f}}),Vo(wr(o),"onNodeMouseEnter",function(l,s){var c=o.props.onMouseEnter;c==null||c({event:l,node:s})}),Vo(wr(o),"onNodeMouseLeave",function(l,s){var c=o.props.onMouseLeave;c==null||c({event:l,node:s})}),Vo(wr(o),"onNodeContextMenu",function(l,s){var c=o.props.onRightClick;c&&(l.preventDefault(),c({event:l,node:s}))}),Vo(wr(o),"onFocus",function(){var l=o.props.onFocus;o.setState({focused:!0});for(var s=arguments.length,c=new Array(s),u=0;u1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!o.destroyed){var u=!1,d=!0,f={};Object.keys(l).forEach(function(p){if(p in o.props){d=!1;return}u=!0,f[p]=l[p]}),u&&(!s||d)&&o.setState(Ru(Ru({},f),c))}}),Vo(wr(o),"scrollTo",function(l){o.listRef.current.scrollTo(l)}),o}return RKe(n,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var r=this.props,i=r.activeKey,a=r.itemScrollOffset,l=a===void 0?0:a;i!==void 0&&i!==this.state.activeKey&&(this.setState({activeKey:i}),i!==null&&this.scrollTo({key:i,offset:l}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var r=this.state,i=r.focused,a=r.flattenNodes,l=r.keyEntities,s=r.draggingNodeKey,c=r.activeKey,u=r.dropLevelOffset,d=r.dropContainerKey,f=r.dropTargetKey,p=r.dropPosition,g=r.dragOverNodeKey,A=r.indent,y=this.props,S=y.prefixCls,C=y.className,P=y.style,v=y.showLine,T=y.focusable,w=y.tabIndex,x=w===void 0?0:w,b=y.selectable,R=y.showIcon,H=y.icon,F=y.switcherIcon,E=y.draggable,N=y.checkable,U=y.checkStrictly,W=y.disabled,k=y.motion,D=y.loadData,L=y.filterTreeNode,j=y.height,B=y.itemHeight,O=y.virtual,V=y.titleRender,G=y.dropIndicatorRender,q=y.onContextMenu,$=y.onScroll,ie=y.direction,Q=y.rootClassName,se=y.rootStyle,oe=zKe(this.props,{aria:!0,data:!0}),Z;return E&&(aA(E)==="object"?Z=E:typeof E=="function"?Z={nodeDraggable:E}:Z={}),m.createElement(Tye.Provider,{value:{prefixCls:S,selectable:b,showIcon:R,icon:H,switcherIcon:F,draggable:Z,draggingNodeKey:s,checkable:N,checkStrictly:U,disabled:W,keyEntities:l,dropLevelOffset:u,dropContainerKey:d,dropTargetKey:f,dropPosition:p,dragOverNodeKey:g,indent:A,direction:ie,dropIndicatorRender:G,loadData:D,filterTreeNode:L,titleRender:V,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop}},m.createElement("div",{role:"tree",className:r9(S,C,Q,Vo(Vo(Vo({},"".concat(S,"-show-line"),v),"".concat(S,"-focused"),i),"".concat(S,"-active-focused"),c!==null)),style:se},m.createElement(UKe,M9({ref:this.listRef,prefixCls:S,style:P,data:a,disabled:W,selectable:b,checkable:!!N,motion:k,dragging:s!==null,height:j,itemHeight:B,virtual:O,focusable:T,focused:i,tabIndex:x,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:q,onScroll:$},this.getTreeNodeRequiredProps(),oe))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){var a=i.prevProps,l={prevProps:r};function s(w){return!a&&w in r||a&&a[w]!==r[w]}var c,u=i.fieldNames;if(s("fieldNames")&&(u=bR(r.fieldNames),l.fieldNames=u),s("treeData")?c=r.treeData:s("children")&&(b2(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),c=EKe(r.children)),c){l.treeData=c;var d=Pye(c,{fieldNames:u});l.keyEntities=Ru(Vo({},tb,NKe),d.keyEntities)}var f=l.keyEntities||i.keyEntities;if(s("expandedKeys")||a&&s("autoExpandParent"))l.expandedKeys=r.autoExpandParent||!a&&r.defaultExpandParent?Hue(r.expandedKeys,f):r.expandedKeys;else if(!a&&r.defaultExpandAll){var p=Ru({},f);delete p[tb],l.expandedKeys=Object.keys(p).map(function(w){return p[w].key})}else!a&&r.defaultExpandedKeys&&(l.expandedKeys=r.autoExpandParent||r.defaultExpandParent?Hue(r.defaultExpandedKeys,f):r.defaultExpandedKeys);if(l.expandedKeys||delete l.expandedKeys,c||l.expandedKeys){var g=bie(c||i.treeData,l.expandedKeys||i.expandedKeys,u);l.flattenNodes=g}if(r.selectable&&(s("selectedKeys")?l.selectedKeys=lbe(r.selectedKeys,r):!a&&r.defaultSelectedKeys&&(l.selectedKeys=lbe(r.defaultSelectedKeys,r))),r.checkable){var A;if(s("checkedKeys")?A=Sie(r.checkedKeys)||{}:!a&&r.defaultCheckedKeys?A=Sie(r.defaultCheckedKeys)||{}:c&&(A=Sie(r.checkedKeys)||{checkedKeys:i.checkedKeys,halfCheckedKeys:i.halfCheckedKeys}),A){var y=A,S=y.checkedKeys,C=S===void 0?[]:S,P=y.halfCheckedKeys,v=P===void 0?[]:P;if(!r.checkStrictly){var T=zC(C,!0,f);C=T.checkedKeys,v=T.halfCheckedKeys}l.checkedKeys=C,l.halfCheckedKeys=v}}return s("loadedKeys")&&(l.loadedKeys=r.loadedKeys),l}}]),n}(m.Component);Vo(Rye,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:SVt,allowDrop:function(){return!0},expandAction:!1});Vo(Rye,"TreeNode",SR);var LVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file",theme:"outlined"},WVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:LVt}))},jKe=m.forwardRef(WVt),NVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"}}]},name:"folder-open",theme:"outlined"},UVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:NVt}))},BKe=m.forwardRef(UVt),jVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z"}}]},name:"folder",theme:"outlined"},BVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:jVt}))},YVt=m.forwardRef(BVt),OVt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},VVt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:OVt}))},_Vt=m.forwardRef(VVt);const GVt=new ba("ant-tree-node-fx-do-not-use",{"0%":{opacity:0},"100%":{opacity:1}}),XVt=(t,e)=>({[`.${t}-switcher-icon`]:{display:"inline-block",fontSize:10,verticalAlign:"baseline",svg:{transition:`transform ${e.motionDurationSlow}`}}}),JVt=(t,e)=>({[`.${t}-drop-indicator`]:{position:"absolute",zIndex:1,height:2,backgroundColor:e.colorPrimary,borderRadius:1,pointerEvents:"none","&:after":{position:"absolute",top:-3,insetInlineStart:-6,width:8,height:8,backgroundColor:"transparent",border:`${jt(e.lineWidthBold)} solid ${e.colorPrimary}`,borderRadius:"50%",content:'""'}}}),KVt=(t,e)=>{const{treeCls:n,treeNodeCls:o,treeNodePadding:r,titleHeight:i,nodeSelectedBg:a,nodeHoverBg:l}=e,s=e.paddingXS;return{[n]:Object.assign(Object.assign({},Na(e)),{background:e.colorBgContainer,borderRadius:e.borderRadius,transition:`background-color ${e.motionDurationSlow}`,[`&${n}-rtl`]:{[`${n}-switcher`]:{"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(90deg)"}}}}},[`&-focused:not(:hover):not(${n}-active-focused)`]:Object.assign({},dw(e)),[`${n}-list-holder-inner`]:{alignItems:"flex-start"},[`&${n}-block-node`]:{[`${n}-list-holder-inner`]:{alignItems:"stretch",[`${n}-node-content-wrapper`]:{flex:"auto"},[`${o}.dragging`]:{position:"relative","&:after":{position:"absolute",top:0,insetInlineEnd:0,bottom:r,insetInlineStart:0,border:`1px solid ${e.colorPrimary}`,opacity:0,animationName:GVt,animationDuration:e.motionDurationSlow,animationPlayState:"running",animationFillMode:"forwards",content:'""',pointerEvents:"none"}}}},[`${o}`]:{display:"flex",alignItems:"flex-start",padding:`0 0 ${jt(r)} 0`,outline:"none","&-rtl":{direction:"rtl"},"&-disabled":{[`${n}-node-content-wrapper`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"}}},[`&-active ${n}-node-content-wrapper`]:{background:e.controlItemBgHover},[`&:not(${o}-disabled).filter-node ${n}-title`]:{color:"inherit",fontWeight:500},"&-draggable":{cursor:"grab",[`${n}-draggable-icon`]:{flexShrink:0,width:i,lineHeight:`${jt(i)}`,textAlign:"center",visibility:"visible",opacity:.2,transition:`opacity ${e.motionDurationSlow}`,[`${o}:hover &`]:{opacity:.45}},[`&${o}-disabled`]:{[`${n}-draggable-icon`]:{visibility:"hidden"}}}},[`${n}-indent`]:{alignSelf:"stretch",whiteSpace:"nowrap",userSelect:"none","&-unit":{display:"inline-block",width:i}},[`${n}-draggable-icon`]:{visibility:"hidden"},[`${n}-switcher`]:Object.assign(Object.assign({},XVt(t,e)),{position:"relative",flex:"none",alignSelf:"stretch",width:i,margin:0,lineHeight:`${jt(i)}`,textAlign:"center",cursor:"pointer",userSelect:"none",transition:`all ${e.motionDurationSlow}`,borderRadius:e.borderRadius,"&-noop":{cursor:"unset"},[`&:not(${n}-switcher-noop):hover`]:{backgroundColor:e.colorBgTextHover},"&_close":{[`${n}-switcher-icon`]:{svg:{transform:"rotate(-90deg)"}}},"&-loading-icon":{color:e.colorPrimary},"&-leaf-line":{position:"relative",zIndex:1,display:"inline-block",width:"100%",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),marginInlineStart:-1,borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&:after":{position:"absolute",width:e.calc(e.calc(i).div(2).equal()).mul(.8).equal(),height:e.calc(i).div(2).equal(),borderBottom:`1px solid ${e.colorBorder}`,content:'""'}}}),[`${n}-checkbox`]:{top:"initial",marginInlineEnd:s,alignSelf:"flex-start",marginTop:e.marginXXS},[`${n}-node-content-wrapper, ${n}-checkbox + span`]:{position:"relative",zIndex:"auto",minHeight:i,margin:0,padding:`0 ${jt(e.calc(e.paddingXS).div(2).equal())}`,color:"inherit",lineHeight:`${jt(i)}`,background:"transparent",borderRadius:e.borderRadius,cursor:"pointer",transition:`all ${e.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,"&:hover":{backgroundColor:l},[`&${n}-node-selected`]:{backgroundColor:a},[`${n}-iconEle`]:{display:"inline-block",width:i,height:i,lineHeight:`${jt(i)}`,textAlign:"center",verticalAlign:"top","&:empty":{display:"none"}}},[`${n}-unselectable ${n}-node-content-wrapper:hover`]:{backgroundColor:"transparent"},[`${n}-node-content-wrapper`]:Object.assign({lineHeight:`${jt(i)}`,userSelect:"none"},JVt(t,e)),[`${o}.drop-container`]:{"> [draggable]":{boxShadow:`0 0 0 2px ${e.colorPrimary}`}},"&-show-line":{[`${n}-indent`]:{"&-unit":{position:"relative",height:"100%","&:before":{position:"absolute",top:0,insetInlineEnd:e.calc(i).div(2).equal(),bottom:e.calc(r).mul(-1).equal(),borderInlineEnd:`1px solid ${e.colorBorder}`,content:'""'},"&-end":{"&:before":{display:"none"}}}},[`${n}-switcher`]:{background:"transparent","&-line-icon":{verticalAlign:"-0.15em"}}},[`${o}-leaf-last`]:{[`${n}-switcher`]:{"&-leaf-line":{"&:before":{top:"auto !important",bottom:"auto !important",height:`${jt(e.calc(i).div(2).equal())} !important`}}}}})}},qVt=t=>{const{treeCls:e,treeNodeCls:n,treeNodePadding:o,directoryNodeSelectedBg:r,directoryNodeSelectedColor:i}=t;return{[`${e}${e}-directory`]:{[n]:{position:"relative","&:before":{position:"absolute",top:0,insetInlineEnd:0,bottom:o,insetInlineStart:0,transition:`background-color ${t.motionDurationMid}`,content:'""',pointerEvents:"none"},"&:hover":{"&:before":{background:t.controlItemBgHover}},"> *":{zIndex:1},[`${e}-switcher`]:{transition:`color ${t.motionDurationMid}`},[`${e}-node-content-wrapper`]:{borderRadius:0,userSelect:"none","&:hover":{background:"transparent"},[`&${e}-node-selected`]:{color:i,background:"transparent"}},"&-selected":{"\n &:hover::before,\n &::before\n ":{background:r},[`${e}-switcher`]:{color:i},[`${e}-node-content-wrapper`]:{color:i,background:"transparent"}}}}}},$Vt=(t,e)=>{const n=`.${t}`,o=`${n}-treenode`,r=e.calc(e.paddingXS).div(2).equal(),i=qi(e,{treeCls:n,treeNodeCls:o,treeNodePadding:r});return[KVt(t,i),qVt(i)]},QVt=t=>{const{controlHeightSM:e}=t;return{titleHeight:e,nodeHoverBg:t.controlItemBgHover,nodeSelectedBg:t.controlItemBgActive}},ZVt=t=>{const{colorTextLightSolid:e,colorPrimary:n}=t;return Object.assign(Object.assign({},QVt(t)),{directoryNodeSelectedColor:e,directoryNodeSelectedBg:n})},e_t=wl("Tree",(t,e)=>{let{prefixCls:n}=e;return[{[t.componentCls]:vJe(`${n}-checkbox`,t)},$Vt(n,t),kme(t)]},ZVt),gbe=4;function t_t(t){const{dropPosition:e,dropLevelOffset:n,prefixCls:o,indent:r,direction:i="ltr"}=t,a=i==="ltr"?"left":"right",l=i==="ltr"?"right":"left",s={[a]:-n*r+gbe,[l]:0};switch(e){case-1:s.top=-3;break;case 1:s.bottom=-3;break;default:s.bottom=-3,s[a]=r+gbe;break}return be.createElement("div",{style:s,className:`${o}-drop-indicator`})}var n_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"filled"},o_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:n_t}))},r_t=m.forwardRef(o_t),i_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"minus-square",theme:"outlined"},a_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:i_t}))},l_t=m.forwardRef(a_t),s_t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"},c_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:s_t}))},u_t=m.forwardRef(c_t);const d_t=t=>{const{prefixCls:e,switcherIcon:n,treeNodeProps:o,showLine:r}=t,{isLeaf:i,expanded:a,loading:l}=o;if(l)return m.createElement(YH,{className:`${e}-switcher-loading-icon`});let s;if(r&&typeof r=="object"&&(s=r.showLeafIcon),i){if(!r)return null;if(typeof s!="boolean"&&s){const d=typeof s=="function"?s(o):s,f=`${e}-switcher-line-custom-icon`;return m.isValidElement(d)?j0(d,{className:Un(d.props.className||"",f)}):d}return s?m.createElement(jKe,{className:`${e}-switcher-line-icon`}):m.createElement("span",{className:`${e}-switcher-leaf-line`})}const c=`${e}-switcher-icon`,u=typeof n=="function"?n(o):n;return m.isValidElement(u)?j0(u,{className:Un(u.props.className||"",c)}):u!==void 0?u:r?a?m.createElement(l_t,{className:`${e}-switcher-line-icon`}):m.createElement(u_t,{className:`${e}-switcher-line-icon`}):m.createElement(r_t,{className:c})},YKe=be.forwardRef((t,e)=>{var n;const{getPrefixCls:o,direction:r,virtual:i,tree:a}=be.useContext(Cr),{prefixCls:l,className:s,showIcon:c=!1,showLine:u,switcherIcon:d,blockNode:f=!1,children:p,checkable:g=!1,selectable:A=!0,draggable:y,motion:S,style:C}=t,P=o("tree",l),v=o(),T=S??Object.assign(Object.assign({},Mme(v)),{motionAppear:!1}),w=Object.assign(Object.assign({},t),{checkable:g,selectable:A,showIcon:c,motion:T,blockNode:f,showLine:!!u,dropIndicatorRender:t_t}),[x,b,R]=e_t(P),[,H]=Vu(),F=H.paddingXS/2+(((n=H.Tree)===null||n===void 0?void 0:n.titleHeight)||H.controlHeightSM),E=be.useMemo(()=>{if(!y)return!1;let U={};switch(typeof y){case"function":U.nodeDraggable=y;break;case"object":U=Object.assign({},y);break}return U.icon!==!1&&(U.icon=U.icon||be.createElement(_Vt,null)),U},[y]),N=U=>be.createElement(d_t,{prefixCls:P,switcherIcon:d,treeNodeProps:U,showLine:u});return x(be.createElement(Rye,Object.assign({itemHeight:F,ref:e,virtual:i},w,{style:Object.assign(Object.assign({},a==null?void 0:a.style),C),prefixCls:P,className:Un({[`${P}-icon-hide`]:!c,[`${P}-block-node`]:f,[`${P}-unselectable`]:!A,[`${P}-rtl`]:r==="rtl"},a==null?void 0:a.className,s,b,R),direction:r,checkable:g&&be.createElement("span",{className:`${P}-checkbox-inner`}),selectable:A,switcherIcon:N,draggable:E}),p))}),mbe=0,Tie=1,ybe=2;function Hye(t,e,n){const{key:o,children:r}=n;function i(a){const l=a[o],s=a[r];e(l,a)!==!1&&Hye(s||[],e,n)}t.forEach(i)}function f_t(t){let{treeData:e,expandedKeys:n,startKey:o,endKey:r,fieldNames:i}=t;const a=[];let l=mbe;if(o&&o===r)return[o];if(!o||!r)return[];function s(c){return c===o||c===r}return Hye(e,c=>{if(l===ybe)return!1;if(s(c)){if(a.push(c),l===mbe)l=Tie;else if(l===Tie)return l=ybe,!1}else l===Tie&&a.push(c);return n.includes(c)},bR(i)),a}function Pie(t,e,n){const o=Qa(e),r=[];return Hye(t,(i,a)=>{const l=o.indexOf(i);return l!==-1&&(r.push(a),o.splice(l,1)),!!o.length},bR(n)),r}var Abe=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{defaultExpandAll:n,defaultExpandParent:o,defaultExpandedKeys:r}=t,i=Abe(t,["defaultExpandAll","defaultExpandParent","defaultExpandedKeys"]);const a=m.useRef(),l=m.useRef(),s=()=>{const{keyEntities:b}=Pye(wbe(i));let R;return n?R=Object.keys(b):o?R=Hue(i.expandedKeys||r||[],b):R=i.expandedKeys||r||[],R},[c,u]=m.useState(i.selectedKeys||i.defaultSelectedKeys||[]),[d,f]=m.useState(()=>s());m.useEffect(()=>{"selectedKeys"in i&&u(i.selectedKeys)},[i.selectedKeys]),m.useEffect(()=>{"expandedKeys"in i&&f(i.expandedKeys)},[i.expandedKeys]);const p=(b,R)=>{var H;return"expandedKeys"in i||f(b),(H=i.onExpand)===null||H===void 0?void 0:H.call(i,b,R)},g=(b,R)=>{var H;const{multiple:F,fieldNames:E}=i,{node:N,nativeEvent:U}=R,{key:W=""}=N,k=wbe(i),D=Object.assign(Object.assign({},R),{selected:!0}),L=(U==null?void 0:U.ctrlKey)||(U==null?void 0:U.metaKey),j=U==null?void 0:U.shiftKey;let B;F&&L?(B=b,a.current=W,l.current=B,D.selectedNodes=Pie(k,B,E)):F&&j?(B=Array.from(new Set([].concat(Qa(l.current||[]),Qa(f_t({treeData:k,expandedKeys:d,startKey:W,endKey:a.current,fieldNames:E}))))),D.selectedNodes=Pie(k,B,E)):(B=[W],a.current=W,l.current=B,D.selectedNodes=Pie(k,B,E)),(H=i.onSelect)===null||H===void 0||H.call(i,B,D),"selectedKeys"in i||u(B)},{getPrefixCls:A,direction:y}=m.useContext(Cr),{prefixCls:S,className:C,showIcon:P=!0,expandAction:v="click"}=i,T=Abe(i,["prefixCls","className","showIcon","expandAction"]),w=A("tree",S),x=Un(`${w}-directory`,{[`${w}-directory-rtl`]:y==="rtl"},C);return m.createElement(YKe,Object.assign({icon:h_t,ref:e,blockNode:!0},T,{showIcon:P,expandAction:v,prefixCls:w,className:x,expandedKeys:d,selectedKeys:c,onSelect:g,onExpand:p}))},g_t=m.forwardRef(p_t),Mye=YKe;Mye.DirectoryTree=g_t;Mye.TreeNode=SR;function vbe(t){let{value:e,onChange:n,filterSearch:o,tablePrefixCls:r,locale:i}=t;return o?m.createElement("div",{className:`${r}-filter-dropdown-search`},m.createElement(jl,{prefix:m.createElement($$,null),placeholder:i.filterSearchPlaceholder,onChange:n,value:e,htmlSize:1,className:`${r}-filter-dropdown-search-input`})):null}const m_t=t=>{const{keyCode:e}=t;e===fi.ENTER&&t.stopPropagation()},y_t=m.forwardRef((t,e)=>m.createElement("div",{className:t.className,onClick:n=>n.stopPropagation(),onKeyDown:m_t,ref:e},t.children));function DC(t){let e=[];return(t||[]).forEach(n=>{let{value:o,children:r}=n;e.push(o),r&&(e=[].concat(Qa(e),Qa(DC(r))))}),e}function A_t(t){return t.some(e=>{let{children:n}=e;return n})}function OKe(t,e){return typeof e=="string"||typeof e=="number"?e==null?void 0:e.toString().toLowerCase().includes(t.trim().toLowerCase()):!1}function VKe(t){let{filters:e,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a}=t;return e.map((l,s)=>{const c=String(l.value);if(l.children)return{key:c||s,label:l.text,popupClassName:`${n}-dropdown-submenu`,children:VKe({filters:l.children,prefixCls:n,filteredKeys:o,filterMultiple:r,searchValue:i,filterSearch:a})};const u=r?Li:Le,d={key:l.value!==void 0?c:s,label:m.createElement(m.Fragment,null,m.createElement(u,{checked:o.includes(c)}),m.createElement("span",null,l.text))};return i.trim()?typeof a=="function"?a(i,l)?d:null:OKe(i,l.text)?d:null:d})}function Cie(t){return t||[]}function w_t(t){var e,n;const{tablePrefixCls:o,prefixCls:r,column:i,dropdownPrefixCls:a,columnKey:l,filterOnClose:s,filterMultiple:c,filterMode:u="menu",filterSearch:d=!1,filterState:f,triggerFilter:p,locale:g,children:A,getPopupContainer:y,rootClassName:S}=t,{filterDropdownOpen:C,onFilterDropdownOpenChange:P,filterResetToDefaultFilteredValue:v,defaultFilteredValue:T,filterDropdownVisible:w,onFilterDropdownVisibleChange:x}=i,[b,R]=m.useState(!1),H=!!(f&&(!((e=f.filteredKeys)===null||e===void 0)&&e.length||f.forceFiltered)),F=ae=>{R(ae),P==null||P(ae),x==null||x(ae)},E=(n=C??w)!==null&&n!==void 0?n:b,N=f==null?void 0:f.filteredKeys,[U,W]=bVt(Cie(N)),k=ae=>{let{selectedKeys:Te}=ae;W(Te)},D=(ae,Te)=>{let{node:ge,checked:Se}=Te;k(c?{selectedKeys:ae}:{selectedKeys:Se&&ge.key?[ge.key]:[]})};m.useEffect(()=>{b&&k({selectedKeys:Cie(N)})},[N]);const[L,j]=m.useState([]),B=ae=>{j(ae)},[O,V]=m.useState(""),G=ae=>{const{value:Te}=ae.target;V(Te)};m.useEffect(()=>{b||V("")},[b]);const q=ae=>{const Te=ae&&ae.length?ae:null;if(Te===null&&(!f||!f.filteredKeys)||v0e(Te,f==null?void 0:f.filteredKeys,!0))return null;p({column:i,key:l,filteredKeys:Te})},$=()=>{F(!1),q(U())},ie=function(){let{confirm:ae,closeDropdown:Te}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{confirm:!1,closeDropdown:!1};ae&&q([]),Te&&F(!1),V(""),W(v?(T||[]).map(ge=>String(ge)):[])},Q=function(){let{closeDropdown:ae}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{closeDropdown:!0};ae&&F(!1),q(U())},se=(ae,Te)=>{Te.source==="trigger"&&(ae&&N!==void 0&&W(Cie(N)),F(ae),!ae&&!i.filterDropdown&&s&&$())},oe=Un({[`${a}-menu-without-submenu`]:!A_t(i.filters||[])}),Z=ae=>{if(ae.target.checked){const Te=DC(i==null?void 0:i.filters).map(ge=>String(ge));W(Te)}else W([])},te=ae=>{let{filters:Te}=ae;return(Te||[]).map((ge,Se)=>{const Re=String(ge.value),De={title:ge.text,key:ge.value!==void 0?Re:String(Se)};return ge.children&&(De.children=te({filters:ge.children})),De})},ee=ae=>{var Te;return Object.assign(Object.assign({},ae),{text:ae.title,value:ae.key,children:((Te=ae.children)===null||Te===void 0?void 0:Te.map(ge=>ee(ge)))||[]})};let de;if(typeof i.filterDropdown=="function")de=i.filterDropdown({prefixCls:`${a}-custom`,setSelectedKeys:ae=>k({selectedKeys:ae}),selectedKeys:U(),confirm:Q,clearFilters:ie,filters:i.filters,visible:E,close:()=>{F(!1)}});else if(i.filterDropdown)de=i.filterDropdown;else{const ae=U()||[],Te=()=>{const Se=m.createElement(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,description:g.filterEmptyText,imageStyle:{height:24},style:{margin:0,padding:"16px 0"}});if((i.filters||[]).length===0)return Se;if(u==="tree")return m.createElement(m.Fragment,null,m.createElement(vbe,{filterSearch:d,value:O,onChange:G,tablePrefixCls:o,locale:g}),m.createElement("div",{className:`${o}-filter-dropdown-tree`},c?m.createElement(Li,{checked:ae.length===DC(i.filters).length,indeterminate:ae.length>0&&ae.lengthtypeof d=="function"?d(O,ee(Ae)):OKe(O,Ae.title):void 0})));const Re=VKe({filters:i.filters||[],filterSearch:d,prefixCls:r,filteredKeys:U(),filterMultiple:c,searchValue:O}),De=Re.every(Ae=>Ae===null);return m.createElement(m.Fragment,null,m.createElement(vbe,{filterSearch:d,value:O,onChange:G,tablePrefixCls:o,locale:g}),De?Se:m.createElement(XH,{selectable:!0,multiple:c,prefixCls:`${a}-menu`,className:oe,onSelect:k,onDeselect:k,selectedKeys:ae,getPopupContainer:y,openKeys:L,onOpenChange:B,items:Re}))},ge=()=>v?v0e((T||[]).map(Se=>String(Se)),ae,!0):ae.length===0;de=m.createElement(m.Fragment,null,Te(),m.createElement("div",{className:`${r}-dropdown-btns`},m.createElement(io,{type:"link",size:"small",disabled:ge(),onClick:()=>ie()},g.filterReset),m.createElement(io,{type:"primary",size:"small",onClick:$},g.filterConfirm)))}i.filterDropdown&&(de=m.createElement(xXe,{selectable:void 0},de));const fe=()=>m.createElement(y_t,{className:`${r}-dropdown`},de);let pe;typeof i.filterIcon=="function"?pe=i.filterIcon(H):i.filterIcon?pe=i.filterIcon:pe=m.createElement(xVt,null);const{direction:ye}=m.useContext(Cr);return m.createElement("div",{className:`${r}-column`},m.createElement("span",{className:`${o}-column-title`},A),m.createElement(rA,{dropdownRender:fe,trigger:["click"],open:E,onOpenChange:se,getPopupContainer:y,placement:ye==="rtl"?"bottomLeft":"bottomRight",rootClassName:S},m.createElement("span",{role:"button",tabIndex:-1,className:Un(`${r}-trigger`,{active:H}),onClick:ae=>{ae.stopPropagation()}},pe)))}function Eue(t,e,n){let o=[];return(t||[]).forEach((r,i)=>{var a;const l=rN(i,n);if(r.filters||"filterDropdown"in r||"onFilter"in r)if("filteredValue"in r){let s=r.filteredValue;"filterDropdown"in r||(s=(a=s==null?void 0:s.map(String))!==null&&a!==void 0?a:s),o.push({column:r,key:eb(r,l),filteredKeys:s,forceFiltered:r.filtered})}else o.push({column:r,key:eb(r,l),filteredKeys:e&&r.defaultFilteredValue?r.defaultFilteredValue:void 0,forceFiltered:r.filtered});"children"in r&&(o=[].concat(Qa(o),Qa(Eue(r.children,e,l))))}),o}function _Ke(t,e,n,o,r,i,a,l,s){return n.map((c,u)=>{const d=rN(u,l),{filterOnClose:f=!0,filterMultiple:p=!0,filterMode:g,filterSearch:A}=c;let y=c;if(y.filters||y.filterDropdown){const S=eb(y,d),C=o.find(P=>{let{key:v}=P;return S===v});y=Object.assign(Object.assign({},y),{title:P=>m.createElement(w_t,{tablePrefixCls:t,prefixCls:`${t}-filter`,dropdownPrefixCls:e,column:y,columnKey:S,filterState:C,filterOnClose:f,filterMultiple:p,filterMode:g,filterSearch:A,triggerFilter:i,locale:r,getPopupContainer:a,rootClassName:s},vQ(c.title,P))})}return"children"in y&&(y=Object.assign(Object.assign({},y),{children:_Ke(t,e,y.children,o,r,i,a,d,s)})),y})}function xbe(t){const e={};return t.forEach(n=>{let{key:o,filteredKeys:r,column:i}=n;const a=o,{filters:l,filterDropdown:s}=i;if(s)e[a]=r||null;else if(Array.isArray(r)){const c=DC(l);e[a]=c.filter(u=>r.includes(String(u)))}else e[a]=null}),e}function Fue(t,e,n){return e.reduce((o,r)=>{const{column:{onFilter:i,filters:a},filteredKeys:l}=r;return i&&l&&l.length?o.map(s=>Object.assign({},s)).filter(s=>l.some(c=>{const u=DC(a),d=u.findIndex(p=>String(p)===String(c)),f=d!==-1?u[d]:c;return s[n]&&(s[n]=Fue(s[n],e,n)),i(f,s)})):o},t)}const GKe=t=>t.flatMap(e=>"children"in e?[e].concat(Qa(GKe(e.children||[]))):[e]);function v_t(t){let{prefixCls:e,dropdownPrefixCls:n,mergedColumns:o,onFilterChange:r,getPopupContainer:i,locale:a,rootClassName:l}=t;Bb();const s=m.useMemo(()=>GKe(o||[]),[o]),[c,u]=m.useState(()=>Eue(s,!0)),d=m.useMemo(()=>{const A=Eue(s,!1);if(A.length===0)return A;let y=!0;if(A.forEach(S=>{let{filteredKeys:C}=S;C!==void 0&&(y=!1)}),y){const S=(s||[]).map((C,P)=>eb(C,rN(P)));return c.filter(C=>{let{key:P}=C;return S.includes(P)}).map(C=>{const P=s[S.findIndex(v=>v===C.key)];return Object.assign(Object.assign({},C),{column:Object.assign(Object.assign({},C.column),P),forceFiltered:P.filtered})})}return A},[s,c]),f=m.useMemo(()=>xbe(d),[d]),p=A=>{const y=d.filter(S=>{let{key:C}=S;return C!==A.key});y.push(A),u(y),r(xbe(y),y)};return[A=>_Ke(e,n,A,d,a,p,i,void 0,l),d,f]}function x_t(t,e,n){const o=m.useRef({});function r(i){if(!o.current||o.current.data!==t||o.current.childrenColumnName!==e||o.current.getRowKey!==n){let s=function(c){c.forEach((u,d)=>{const f=n(u,d);l.set(f,u),u&&typeof u=="object"&&e in u&&s(u[e]||[])})};var a=s;const l=new Map;s(t),o.current={data:t,childrenColumnName:e,kvMap:l,getRowKey:n}}return o.current.kvMap.get(i)}return[r]}var b_t=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const i=t[r];typeof i!="function"&&(n[r]=i)}),n}function T_t(t,e,n){const o=n&&typeof n=="object"?n:{},{total:r=0}=o,i=b_t(o,["total"]),[a,l]=m.useState(()=>({current:"defaultCurrent"in i?i.defaultCurrent:1,pageSize:"defaultPageSize"in i?i.defaultPageSize:XKe})),s=KJe(a,i,{total:r>0?r:t}),c=Math.ceil((r||t)/s.pageSize);s.current>c&&(s.current=c||1);const u=(f,p)=>{l({current:f??1,pageSize:p||s.pageSize})},d=(f,p)=>{var g;n&&((g=n.onChange)===null||g===void 0||g.call(n,f,p)),u(f,p),e(f,p||(s==null?void 0:s.pageSize))};return n===!1?[{},()=>{}]:[Object.assign(Object.assign({},s),{onChange:d}),u]}var P_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"}}]},name:"caret-down",theme:"outlined"},C_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:P_t}))},JKe=m.forwardRef(C_t),R_t={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"}}]},name:"caret-up",theme:"outlined"},H_t=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:R_t}))},M_t=m.forwardRef(H_t);const t_="ascend",Rie="descend";function QG(t){return typeof t.sorter=="object"&&typeof t.sorter.multiple=="number"?t.sorter.multiple:!1}function bbe(t){return typeof t=="function"?t:t&&typeof t=="object"&&t.compare?t.compare:!1}function I_t(t,e){return e?t[t.indexOf(e)+1]:t[0]}function kue(t,e,n){let o=[];function r(i,a){o.push({column:i,key:eb(i,a),multiplePriority:QG(i),sortOrder:i.sortOrder})}return(t||[]).forEach((i,a)=>{const l=rN(a,n);i.children?("sortOrder"in i&&r(i,l),o=[].concat(Qa(o),Qa(kue(i.children,e,l)))):i.sorter&&("sortOrder"in i?r(i,l):e&&i.defaultSortOrder&&o.push({column:i,key:eb(i,l),multiplePriority:QG(i),sortOrder:i.defaultSortOrder}))}),o}function KKe(t,e,n,o,r,i,a,l){return(e||[]).map((s,c)=>{const u=rN(c,l);let d=s;if(d.sorter){const f=d.sortDirections||r,p=d.showSorterTooltip===void 0?a:d.showSorterTooltip,g=eb(d,u),A=n.find(b=>{let{key:R}=b;return R===g}),y=A?A.sortOrder:null,S=I_t(f,y);let C;if(s.sortIcon)C=s.sortIcon({sortOrder:y});else{const b=f.includes(t_)&&m.createElement(M_t,{className:Un(`${t}-column-sorter-up`,{active:y===t_})}),R=f.includes(Rie)&&m.createElement(JKe,{className:Un(`${t}-column-sorter-down`,{active:y===Rie})});C=m.createElement("span",{className:Un(`${t}-column-sorter`,{[`${t}-column-sorter-full`]:!!(b&&R)})},m.createElement("span",{className:`${t}-column-sorter-inner`,"aria-hidden":"true"},b,R))}const{cancelSort:P,triggerAsc:v,triggerDesc:T}=i||{};let w=P;S===Rie?w=T:S===t_&&(w=v);const x=typeof p=="object"?Object.assign({title:w},p):{title:w};d=Object.assign(Object.assign({},d),{className:Un(d.className,{[`${t}-column-sort`]:y}),title:b=>{const R=`${t}-column-sorters`,H=m.createElement("span",{className:`${t}-column-title`},vQ(s.title,b)),F=m.createElement("div",{className:R},H,C);return p?typeof p!="boolean"&&(p==null?void 0:p.target)==="sorter-icon"?m.createElement("div",{className:`${R} ${t}-column-sorters-tooltip-target-sorter`},H,m.createElement(oA,Object.assign({},x),C)):m.createElement(oA,Object.assign({},x),F):F},onHeaderCell:b=>{const R=s.onHeaderCell&&s.onHeaderCell(b)||{},H=R.onClick,F=R.onKeyDown;R.onClick=U=>{o({column:s,key:g,sortOrder:S,multiplePriority:QG(s)}),H==null||H(U)},R.onKeyDown=U=>{U.keyCode===fi.ENTER&&(o({column:s,key:g,sortOrder:S,multiplePriority:QG(s)}),F==null||F(U))};const E=AVt(s.title,{}),N=E==null?void 0:E.toString();return y?R["aria-sort"]=y==="ascend"?"ascending":"descending":R["aria-label"]=N||"",R.className=Un(R.className,`${t}-column-has-sorters`),R.tabIndex=0,s.ellipsis&&(R.title=(E??"").toString()),R}})}return"children"in d&&(d=Object.assign(Object.assign({},d),{children:KKe(t,d.children,n,o,r,i,a,u)})),d})}const Sbe=t=>{const{column:e,sortOrder:n}=t;return{column:e,order:n,field:e.dataIndex,columnKey:e.key}},Tbe=t=>{const e=t.filter(n=>{let{sortOrder:o}=n;return o}).map(Sbe);if(e.length===0&&t.length){const n=t.length-1;return Object.assign(Object.assign({},Sbe(t[n])),{column:void 0})}return e.length<=1?e[0]||{}:e};function Lue(t,e,n){const o=e.slice().sort((a,l)=>l.multiplePriority-a.multiplePriority),r=t.slice(),i=o.filter(a=>{let{column:{sorter:l},sortOrder:s}=a;return bbe(l)&&s});return i.length?r.sort((a,l)=>{for(let s=0;s{const l=a[n];return l?Object.assign(Object.assign({},a),{[n]:Lue(l,e,n)}):a}):r}function z_t(t){let{prefixCls:e,mergedColumns:n,onSorterChange:o,sortDirections:r,tableLocale:i,showSorterTooltip:a}=t;const[l,s]=m.useState(kue(n,!0)),c=m.useMemo(()=>{let g=!0;const A=kue(n,!1);if(!A.length)return l;const y=[];function S(P){g?y.push(P):y.push(Object.assign(Object.assign({},P),{sortOrder:null}))}let C=null;return A.forEach(P=>{C===null?(S(P),P.sortOrder&&(P.multiplePriority===!1?g=!1:C=!0)):(C&&P.multiplePriority!==!1||(g=!1),S(P))}),y},[n,l]),u=m.useMemo(()=>{const g=c.map(A=>{let{column:y,sortOrder:S}=A;return{column:y,order:S}});return{sortColumns:g,sortColumn:g[0]&&g[0].column,sortOrder:g[0]&&g[0].order}},[c]),d=g=>{let A;g.multiplePriority===!1||!c.length||c[0].multiplePriority===!1?A=[g]:A=[].concat(Qa(c.filter(y=>{let{key:S}=y;return S!==g.key})),[g]),s(A),o(Tbe(A),A)};return[g=>KKe(e,g,c,d,r,i,a),c,u,()=>Tbe(c)]}function qKe(t,e){return t.map(n=>{const o=Object.assign({},n);return o.title=vQ(n.title,e),"children"in o&&(o.children=qKe(o.children,e)),o})}function D_t(t){return[m.useCallback(n=>qKe(n,t),[t])]}const E_t=vKe((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),F_t=bKe((t,e)=>{const{_renderTimes:n}=t,{_renderTimes:o}=e;return n!==o}),k_t=t=>{const{componentCls:e,lineWidth:n,lineType:o,tableBorderColor:r,tableHeaderBg:i,tablePaddingVertical:a,tablePaddingHorizontal:l,calc:s}=t,c=`${jt(n)} ${o} ${r}`,u=(d,f,p)=>({[`&${e}-${d}`]:{[`> ${e}-container`]:{[`> ${e}-content, > ${e}-body`]:{"\n > table > tbody > tr > th,\n > table > tbody > tr > td\n ":{[`> ${e}-expanded-row-fixed`]:{margin:`${jt(s(f).mul(-1).equal())} ${jt(s(s(p).add(n)).mul(-1).equal())}`}}}}}});return{[`${e}-wrapper`]:{[`${e}${e}-bordered`]:Object.assign(Object.assign(Object.assign({[`> ${e}-title`]:{border:c,borderBottom:0},[`> ${e}-container`]:{borderInlineStart:c,borderTop:c,[` > ${e}-content, > ${e}-header, @@ -4737,7 +4737,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho > ${e}-wrapper:only-child, > ${e}-expanded-row-fixed > ${e}-wrapper:only-child `]:{[e]:{marginBlock:jt(C(o).mul(-1).equal()),marginInline:`${jt(C(i).sub(r).equal())} - ${jt(C(r).mul(-1).equal())}`,[`${e}-tbody > tr:last-child > td`]:{borderBottom:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:g,borderBottom:P,transition:`background ${p} ease`}}},[`${e}-footer`]:{padding:`${jt(o)} ${jt(r)}`,color:y,background:S}})}},q_t=t=>{const{colorFillAlter:e,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:i,controlItemBgActive:a,controlItemBgActiveHover:l,padding:s,paddingSM:c,paddingXS:u,colorBorderSecondary:d,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:g,fontSize:A,fontSizeSM:y,lineHeight:S,lineWidth:C,colorIcon:P,colorIconHover:v,opacityLoading:T,controlInteractiveSize:w}=t,x=new Wl(r).onBackground(n).toHexShortString(),b=new Wl(i).onBackground(n).toHexShortString(),R=new Wl(e).onBackground(n).toHexShortString(),H=new Wl(P),F=new Wl(v),E=w/2-C,N=E*2+C*3;return{headerBg:R,headerColor:o,headerSortActiveBg:x,headerSortHoverBg:b,bodySortBg:R,rowHoverBg:R,rowSelectedBg:a,rowSelectedHoverBg:l,rowExpandedBg:e,cellPaddingBlock:s,cellPaddingInline:s,cellPaddingBlockMD:c,cellPaddingInlineMD:u,cellPaddingBlockSM:u,cellPaddingInlineSM:u,borderColor:d,headerBorderRadius:f,footerBg:R,footerColor:o,cellFontSize:A,cellFontSizeMD:A,cellFontSizeSM:A,headerSplitColor:d,fixedHeaderSortActiveBg:x,headerFilterHoverBg:i,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:g,stickyScrollBarBorderRadius:100,expandIconMarginTop:(A*S-C*3)/2-Math.ceil((y*1.4-C*3)/2),headerIconColor:H.clone().setAlpha(H.getAlpha()*T).toRgbString(),headerIconHoverColor:F.clone().setAlpha(F.getAlpha()*T).toRgbString(),expandIconHalfInner:E,expandIconSize:N,expandIconScale:w/N}},$_t=wl("Table",t=>{const{colorTextHeading:e,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:i,headerColor:a,headerSortActiveBg:l,headerSortHoverBg:s,bodySortBg:c,rowHoverBg:u,rowSelectedBg:d,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:g,cellPaddingInline:A,cellPaddingBlockMD:y,cellPaddingInlineMD:S,cellPaddingBlockSM:C,cellPaddingInlineSM:P,borderColor:v,footerBg:T,footerColor:w,headerBorderRadius:x,cellFontSize:b,cellFontSizeMD:R,cellFontSizeSM:H,headerSplitColor:F,fixedHeaderSortActiveBg:E,headerFilterHoverBg:N,filterDropdownBg:U,expandIconBg:W,selectionColumnWidth:k,stickyScrollBarBg:D,calc:L}=t,j=2,B=qi(t,{tableFontSize:b,tableBg:o,tableRadius:x,tablePaddingVertical:g,tablePaddingHorizontal:A,tablePaddingVerticalMiddle:y,tablePaddingHorizontalMiddle:S,tablePaddingVerticalSmall:C,tablePaddingHorizontalSmall:P,tableBorderColor:v,tableHeaderTextColor:a,tableHeaderBg:i,tableFooterTextColor:w,tableFooterBg:T,tableHeaderCellSplitColor:F,tableHeaderSortBg:l,tableHeaderSortHoverBg:s,tableBodySortBg:c,tableFixedHeaderSortActiveBg:E,tableHeaderFilterActiveBg:N,tableFilterDropdownBg:U,tableRowHoverBg:u,tableSelectedRowBg:d,tableSelectedRowHoverBg:f,zIndexTableFixed:j,zIndexTableSticky:j+1,tableFontSizeMiddle:R,tableFontSizeSmall:H,tableSelectionColumnWidth:k,tableExpandIconBg:W,tableExpandColumnWidth:L(r).add(L(t.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:D,tableScrollThumbBgHover:e,tableScrollBg:n});return[K_t(B),B_t(B),Pbe(B),G_t(B),U_t(B),k_t(B),Y_t(B),N_t(B),Pbe(B),W_t(B),V_t(B),j_t(B),X_t(B),L_t(B),__t(B),O_t(B),J_t(B)]},q_t,{unitless:{expandIconScale:!0}}),Q_t=[],Z_t=(t,e)=>{var n,o;const{prefixCls:r,className:i,rootClassName:a,style:l,size:s,bordered:c,dropdownPrefixCls:u,dataSource:d,pagination:f,rowSelection:p,rowKey:g="key",rowClassName:A,columns:y,children:S,childrenColumnName:C,onChange:P,getPopupContainer:v,loading:T,expandIcon:w,expandable:x,expandedRowRender:b,expandIconColumnIndex:R,indentSize:H,scroll:F,sortDirections:E,locale:N,showSorterTooltip:U={target:"full-header"},virtual:W}=t;Bb();const k=m.useMemo(()=>y||bye(S),[y,S]),D=m.useMemo(()=>k.some(Wt=>Wt.responsive),[k]),L=Q$(D),j=m.useMemo(()=>{const Wt=new Set(Object.keys(L).filter(ht=>L[ht]));return k.filter(ht=>!ht.responsive||ht.responsive.some(ct=>Wt.has(ct)))},[k,L]),B=dp(t,["className","style","columns"]),{locale:O=uw,direction:V,table:G,renderEmpty:q,getPrefixCls:$,getPopupContainer:ie}=m.useContext(Cr),Q=zd(s),se=Object.assign(Object.assign({},O.Table),N),Z=d||Q_t,ee=$("table",r),te=$("dropdown",u),[,oe]=Vu(),de=Y0(ee),[he,pe,me]=$_t(ee,de),le=Object.assign(Object.assign({childrenColumnName:C,expandIconColumnIndex:R},x),{expandIcon:(n=x==null?void 0:x.expandIcon)!==null&&n!==void 0?n:(o=G==null?void 0:G.expandable)===null||o===void 0?void 0:o.expandIcon}),{childrenColumnName:Te="children"}=le,ge=m.useMemo(()=>Z.some(Wt=>Wt==null?void 0:Wt[Te])?"nest":b||x&&x.expandedRowRender?"row":null,[Z]),Se={body:m.useRef()},Re=yVt(ee),De=m.useRef(null),Ae=m.useRef(null);gVt(e,()=>Object.assign(Object.assign({},Ae.current),{nativeElement:De.current}));const ue=m.useMemo(()=>typeof g=="function"?g:Wt=>Wt==null?void 0:Wt[g],[g]),[fe]=x_t(Z,Te,ue),ve={},we=function(Wt,ht){let ct=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;var It,Ft,Ve;const ft=Object.assign(Object.assign({},ve),Wt);ct&&((It=ve.resetPagination)===null||It===void 0||It.call(ve),!((Ft=ft.pagination)===null||Ft===void 0)&&Ft.current&&(ft.pagination.current=1),f&&f.onChange&&f.onChange(1,(Ve=ft.pagination)===null||Ve===void 0?void 0:Ve.pageSize)),F&&F.scrollToFirstRowOnChange!==!1&&Se.body.current&&iRt(0,{getContainer:()=>Se.body.current}),P==null||P(ft.pagination,ft.filters,ft.sorter,{currentDataSource:Fue(Lue(Z,ft.sorterStates,Te),ft.filterStates,Te),action:ht})},Pe=(Wt,ht)=>{we({sorter:Wt,sorterStates:ht},"sort",!1)},[Ie,Me,ze,Ne]=z_t({prefixCls:ee,mergedColumns:j,onSorterChange:Pe,sortDirections:E||["ascend","descend"],tableLocale:se,showSorterTooltip:U}),Je=m.useMemo(()=>Lue(Z,Me,Te),[Z,Me]);ve.sorter=Ne(),ve.sorterStates=Me;const Ue=(Wt,ht)=>{we({filters:Wt,filterStates:ht},"filter",!0)},[nt,We,Ee]=v_t({prefixCls:ee,locale:se,dropdownPrefixCls:te,mergedColumns:j,onFilterChange:Ue,getPopupContainer:v||ie,rootClassName:Un(a,de)}),ke=Fue(Je,We,Te);ve.filters=Ee,ve.filterStates=We;const Oe=m.useMemo(()=>{const Wt={};return Object.keys(Ee).forEach(ht=>{Ee[ht]!==null&&(Wt[ht]=Ee[ht])}),Object.assign(Object.assign({},ze),{filters:Wt})},[ze,Ee]),[st]=D_t(Oe),je=(Wt,ht)=>{we({pagination:Object.assign(Object.assign({},ve.pagination),{current:Wt,pageSize:ht})},"paginate")},[xt,gt]=T_t(ke.length,je,f);ve.pagination=f===!1?{}:S_t(xt,f),ve.resetPagination=gt;const Ye=m.useMemo(()=>{if(f===!1||!xt.pageSize)return ke;const{current:Wt=1,total:ht,pageSize:ct=XKe}=xt;return ke.lengthct?ke.slice((Wt-1)*ct,Wt*ct):ke:ke.slice((Wt-1)*ct,Wt*ct)},[!!f,ke,xt&&xt.current,xt&&xt.pageSize,xt&&xt.total]),[it,ut]=hVt({prefixCls:ee,data:ke,pageData:Ye,getRowKey:ue,getRecordByKey:fe,expandType:ge,childrenColumnName:Te,locale:se,getPopupContainer:v||ie},p),Qe=(Wt,ht,ct)=>{let It;return typeof A=="function"?It=Un(A(Wt,ht,ct)):It=Un(A),Un({[`${ee}-row-selected`]:ut.has(ue(Wt,ht))},It)};le.__PARENT_RENDER_ICON__=le.expandIcon,le.expandIcon=le.expandIcon||w||mVt(se),ge==="nest"&&le.expandIconColumnIndex===void 0?le.expandIconColumnIndex=p?1:0:le.expandIconColumnIndex>0&&p&&(le.expandIconColumnIndex-=1),typeof le.indentSize!="number"&&(le.indentSize=typeof H=="number"?H:15);const lt=m.useCallback(Wt=>st(it(nt(Ie(Wt)))),[Ie,nt,it]);let Ze,Be;if(f!==!1&&(xt!=null&&xt.total)){let Wt;xt.size?Wt=xt.size:Wt=Q==="small"||Q==="middle"?"small":void 0;const ht=Ft=>m.createElement(eKe,Object.assign({},xt,{className:Un(`${ee}-pagination ${ee}-pagination-${Ft}`,xt.className),size:Wt})),ct=V==="rtl"?"left":"right",{position:It}=xt;if(It!==null&&Array.isArray(It)){const Ft=It.find(kt=>kt.includes("top")),Ve=It.find(kt=>kt.includes("bottom")),ft=It.every(kt=>`${kt}`=="none");!Ft&&!Ve&&!ft&&(Be=ht(ct)),Ft&&(Ze=ht(Ft.toLowerCase().replace("top",""))),Ve&&(Be=ht(Ve.toLowerCase().replace("bottom","")))}else Be=ht(ct)}let $e;typeof T=="boolean"?$e={spinning:T}:typeof T=="object"&&($e=Object.assign({spinning:!0},T));const wt=Un(me,de,`${ee}-wrapper`,G==null?void 0:G.className,{[`${ee}-wrapper-rtl`]:V==="rtl"},i,a,pe),vt=Object.assign(Object.assign({},G==null?void 0:G.style),l),Rt=N&&N.emptyText||(q==null?void 0:q("Table"))||m.createElement(jme,{componentName:"Table"}),Gt=W?F_t:E_t,At={},pt=m.useMemo(()=>{const{fontSize:Wt,lineHeight:ht,padding:ct,paddingXS:It,paddingSM:Ft}=oe,Ve=Math.floor(Wt*ht);switch(Q){case"large":return ct*2+Ve;case"small":return It*2+Ve;default:return Ft*2+Ve}},[oe,Q]);return W&&(At.listItemHeight=pt),he(m.createElement("div",{ref:De,className:wt,style:vt},m.createElement(tN,Object.assign({spinning:!1},$e),Ze,m.createElement(Gt,Object.assign({},At,B,{ref:Ae,columns:j,direction:V,expandable:le,prefixCls:ee,className:Un({[`${ee}-middle`]:Q==="middle",[`${ee}-small`]:Q==="small",[`${ee}-bordered`]:c,[`${ee}-empty`]:Z.length===0},me,de,pe),data:Ye,rowKey:ue,rowClassName:Qe,emptyText:Rt,internalHooks:nN,internalRefs:Se,transformColumns:lt,getContainerWidth:Re})),Be)))},eGt=m.forwardRef(Z_t),tGt=(t,e)=>{const n=m.useRef(0);return n.current+=1,m.createElement(eGt,Object.assign({},t,{ref:e,_renderTimes:n.current}))},Dd=m.forwardRef(tGt);Dd.SELECTION_COLUMN=N4;Dd.EXPAND_COLUMN=q4;Dd.SELECTION_ALL=Mue;Dd.SELECTION_INVERT=Iue;Dd.SELECTION_NONE=zue;Dd.Column=zOt;Dd.ColumnGroup=DOt;Dd.Summary=cKe;const nGt=t=>{const{paddingXXS:e,lineWidth:n,tagPaddingHorizontal:o,componentCls:r,calc:i}=t,a=i(o).sub(n).equal(),l=i(e).sub(n).equal();return{[r]:Object.assign(Object.assign({},Na(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,opacity:1,transition:`all ${t.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},[`${r}-close-icon`]:{marginInlineStart:l,fontSize:t.tagIconSize,color:t.colorTextDescription,cursor:"pointer",transition:`all ${t.motionDurationMid}`,"&:hover":{color:t.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${t.iconCls}-close, ${t.iconCls}-close:hover`]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${t.iconCls} + span, > span + ${t.iconCls}`]:{marginInlineStart:a}}),[`${r}-borderless`]:{borderColor:"transparent",background:t.tagBorderlessBg}}},Iye=t=>{const{lineWidth:e,fontSizeIcon:n,calc:o}=t,r=t.fontSizeSM;return qi(t,{tagFontSize:r,tagLineHeight:jt(o(t.lineHeightSM).mul(r).equal()),tagIconSize:o(n).sub(o(e).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},zye=t=>({defaultBg:new Wl(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText}),$Ke=wl("Tag",t=>{const e=Iye(t);return nGt(e)},zye);var oGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,style:o,className:r,checked:i,onChange:a,onClick:l}=t,s=oGt(t,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:c,tag:u}=m.useContext(Cr),d=S=>{a==null||a(!i),l==null||l(S)},f=c("tag",n),[p,g,A]=$Ke(f),y=Un(f,`${f}-checkable`,{[`${f}-checkable-checked`]:i},u==null?void 0:u.className,r,g,A);return p(m.createElement("span",Object.assign({},s,{ref:e,style:Object.assign(Object.assign({},o),u==null?void 0:u.style),className:y,onClick:d})))}),iGt=t=>L$(t,(e,n)=>{let{textColor:o,lightBorderColor:r,lightColor:i,darkColor:a}=n;return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:o,background:i,borderColor:r,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}}),aGt=LW(["Tag","preset"],t=>{const e=Iye(t);return iGt(e)},zye);function lGt(t){return typeof t!="string"?t:t.charAt(0).toUpperCase()+t.slice(1)}const OY=(t,e,n)=>{const o=lGt(n);return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:t[`color${n}`],background:t[`color${o}Bg`],borderColor:t[`color${o}Border`],[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}},sGt=LW(["Tag","status"],t=>{const e=Iye(t);return[OY(e,"success","Success"),OY(e,"processing","Info"),OY(e,"error","Error"),OY(e,"warning","Warning")]},zye);var cGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,className:o,rootClassName:r,style:i,children:a,icon:l,color:s,onClose:c,bordered:u=!0,visible:d}=t,f=cGt(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:g,tag:A}=m.useContext(Cr),[y,S]=m.useState(!0),C=dp(f,["closeIcon","closable"]);m.useEffect(()=>{d!==void 0&&S(d)},[d]);const P=tQ(s),v=OEt(s),T=P||v,w=Object.assign(Object.assign({backgroundColor:s&&!T?s:void 0},A==null?void 0:A.style),i),x=p("tag",n),[b,R,H]=$Ke(x),F=Un(x,A==null?void 0:A.className,{[`${x}-${s}`]:T,[`${x}-has-color`]:s&&!T,[`${x}-hidden`]:!y,[`${x}-rtl`]:g==="rtl",[`${x}-borderless`]:!u},o,r,R,H),E=L=>{L.stopPropagation(),c==null||c(L),!L.defaultPrevented&&S(!1)},[,N]=Dme(AR(t),AR(A),{closable:!1,closeIconRender:L=>{const j=m.createElement("span",{className:`${x}-close-icon`,onClick:E},L);return b_e(L,j,B=>({onClick:O=>{var V;(V=B==null?void 0:B.onClick)===null||V===void 0||V.call(B,O),E(O)},className:Un(B==null?void 0:B.className,`${x}-close-icon`)}))}}),U=typeof f.onClick=="function"||a&&a.type==="a",W=l||null,k=W?m.createElement(m.Fragment,null,W,a&&m.createElement("span",null,a)):a,D=m.createElement("span",Object.assign({},C,{ref:e,className:F,style:w}),k,N,P&&m.createElement(aGt,{key:"preset",prefixCls:x}),v&&m.createElement(sGt,{key:"status",prefixCls:x}));return b(U?m.createElement(UW,{component:"Tag"},D):D)}),QKe=uGt;QKe.CheckableTag=rGt;var dGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rm.createElement(hGt,Object.assign({},t,{picker:"time",mode:void 0,ref:e}))),iN=m.forwardRef((t,e)=>{var{addon:n,renderExtraFooter:o}=t,r=dGt(t,["addon","renderExtraFooter"]);const i=m.useMemo(()=>{if(o)return o;if(n)return n},[n,o]);return m.createElement(fGt,Object.assign({},r,{mode:void 0,ref:e,renderExtraFooter:i}))}),ZKe=XW(iN,"picker");iN._InternalPanelDoNotUseOrYouWillBeFired=ZKe;iN.RangePicker=pGt;iN._InternalPanelDoNotUseOrYouWillBeFired=ZKe;var gGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},mGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gGt}))},eqe=m.forwardRef(mGt),yGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=u=>{const{keyCode:d}=u;d===fi.ENTER&&u.preventDefault()},o=u=>{const{keyCode:d}=u,{onClick:f}=t;d===fi.ENTER&&f&&f()},{style:r,noStyle:i,disabled:a,tabIndex:l=0}=t,s=yGt(t,["style","noStyle","disabled","tabIndex"]);let c={};return i||(c=Object.assign({},AGt)),a&&(c.pointerEvents="none"),c=Object.assign(Object.assign({},c),r),m.createElement("div",Object.assign({role:"button",tabIndex:l,ref:e},s,{onKeyDown:n,onKeyUp:o,style:c}))});var wGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"},vGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:wGt}))},nqe=m.forwardRef(vGt),xGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"},bGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:xGt}))},SGt=m.forwardRef(bGt);const TGt=(t,e,n,o)=>{const{titleMarginBottom:r,fontWeightStrong:i}=o;return{marginBottom:r,color:n,fontWeight:i,fontSize:t,lineHeight:e}},PGt=t=>{const e=[1,2,3,4,5],n={};return e.forEach(o=>{n[` + ${jt(C(r).mul(-1).equal())}`,[`${e}-tbody > tr:last-child > td`]:{borderBottom:0,"&:first-child, &:last-child":{borderRadius:0}}}}},"> th":{position:"relative",color:f,fontWeight:n,textAlign:"start",background:g,borderBottom:P,transition:`background ${p} ease`}}},[`${e}-footer`]:{padding:`${jt(o)} ${jt(r)}`,color:y,background:S}})}},q_t=t=>{const{colorFillAlter:e,colorBgContainer:n,colorTextHeading:o,colorFillSecondary:r,colorFillContent:i,controlItemBgActive:a,controlItemBgActiveHover:l,padding:s,paddingSM:c,paddingXS:u,colorBorderSecondary:d,borderRadiusLG:f,controlHeight:p,colorTextPlaceholder:g,fontSize:A,fontSizeSM:y,lineHeight:S,lineWidth:C,colorIcon:P,colorIconHover:v,opacityLoading:T,controlInteractiveSize:w}=t,x=new Wl(r).onBackground(n).toHexShortString(),b=new Wl(i).onBackground(n).toHexShortString(),R=new Wl(e).onBackground(n).toHexShortString(),H=new Wl(P),F=new Wl(v),E=w/2-C,N=E*2+C*3;return{headerBg:R,headerColor:o,headerSortActiveBg:x,headerSortHoverBg:b,bodySortBg:R,rowHoverBg:R,rowSelectedBg:a,rowSelectedHoverBg:l,rowExpandedBg:e,cellPaddingBlock:s,cellPaddingInline:s,cellPaddingBlockMD:c,cellPaddingInlineMD:u,cellPaddingBlockSM:u,cellPaddingInlineSM:u,borderColor:d,headerBorderRadius:f,footerBg:R,footerColor:o,cellFontSize:A,cellFontSizeMD:A,cellFontSizeSM:A,headerSplitColor:d,fixedHeaderSortActiveBg:x,headerFilterHoverBg:i,filterDropdownMenuBg:n,filterDropdownBg:n,expandIconBg:n,selectionColumnWidth:p,stickyScrollBarBg:g,stickyScrollBarBorderRadius:100,expandIconMarginTop:(A*S-C*3)/2-Math.ceil((y*1.4-C*3)/2),headerIconColor:H.clone().setAlpha(H.getAlpha()*T).toRgbString(),headerIconHoverColor:F.clone().setAlpha(F.getAlpha()*T).toRgbString(),expandIconHalfInner:E,expandIconSize:N,expandIconScale:w/N}},$_t=wl("Table",t=>{const{colorTextHeading:e,colorSplit:n,colorBgContainer:o,controlInteractiveSize:r,headerBg:i,headerColor:a,headerSortActiveBg:l,headerSortHoverBg:s,bodySortBg:c,rowHoverBg:u,rowSelectedBg:d,rowSelectedHoverBg:f,rowExpandedBg:p,cellPaddingBlock:g,cellPaddingInline:A,cellPaddingBlockMD:y,cellPaddingInlineMD:S,cellPaddingBlockSM:C,cellPaddingInlineSM:P,borderColor:v,footerBg:T,footerColor:w,headerBorderRadius:x,cellFontSize:b,cellFontSizeMD:R,cellFontSizeSM:H,headerSplitColor:F,fixedHeaderSortActiveBg:E,headerFilterHoverBg:N,filterDropdownBg:U,expandIconBg:W,selectionColumnWidth:k,stickyScrollBarBg:D,calc:L}=t,j=2,B=qi(t,{tableFontSize:b,tableBg:o,tableRadius:x,tablePaddingVertical:g,tablePaddingHorizontal:A,tablePaddingVerticalMiddle:y,tablePaddingHorizontalMiddle:S,tablePaddingVerticalSmall:C,tablePaddingHorizontalSmall:P,tableBorderColor:v,tableHeaderTextColor:a,tableHeaderBg:i,tableFooterTextColor:w,tableFooterBg:T,tableHeaderCellSplitColor:F,tableHeaderSortBg:l,tableHeaderSortHoverBg:s,tableBodySortBg:c,tableFixedHeaderSortActiveBg:E,tableHeaderFilterActiveBg:N,tableFilterDropdownBg:U,tableRowHoverBg:u,tableSelectedRowBg:d,tableSelectedRowHoverBg:f,zIndexTableFixed:j,zIndexTableSticky:j+1,tableFontSizeMiddle:R,tableFontSizeSmall:H,tableSelectionColumnWidth:k,tableExpandIconBg:W,tableExpandColumnWidth:L(r).add(L(t.padding).mul(2)).equal(),tableExpandedRowBg:p,tableFilterDropdownWidth:120,tableFilterDropdownHeight:264,tableFilterDropdownSearchWidth:140,tableScrollThumbSize:8,tableScrollThumbBg:D,tableScrollThumbBgHover:e,tableScrollBg:n});return[K_t(B),B_t(B),Pbe(B),G_t(B),U_t(B),k_t(B),Y_t(B),N_t(B),Pbe(B),W_t(B),V_t(B),j_t(B),X_t(B),L_t(B),__t(B),O_t(B),J_t(B)]},q_t,{unitless:{expandIconScale:!0}}),Q_t=[],Z_t=(t,e)=>{var n,o;const{prefixCls:r,className:i,rootClassName:a,style:l,size:s,bordered:c,dropdownPrefixCls:u,dataSource:d,pagination:f,rowSelection:p,rowKey:g="key",rowClassName:A,columns:y,children:S,childrenColumnName:C,onChange:P,getPopupContainer:v,loading:T,expandIcon:w,expandable:x,expandedRowRender:b,expandIconColumnIndex:R,indentSize:H,scroll:F,sortDirections:E,locale:N,showSorterTooltip:U={target:"full-header"},virtual:W}=t;Bb();const k=m.useMemo(()=>y||bye(S),[y,S]),D=m.useMemo(()=>k.some(Wt=>Wt.responsive),[k]),L=Q$(D),j=m.useMemo(()=>{const Wt=new Set(Object.keys(L).filter(ht=>L[ht]));return k.filter(ht=>!ht.responsive||ht.responsive.some(ct=>Wt.has(ct)))},[k,L]),B=dp(t,["className","style","columns"]),{locale:O=uw,direction:V,table:G,renderEmpty:q,getPrefixCls:$,getPopupContainer:ie}=m.useContext(Cr),Q=zd(s),se=Object.assign(Object.assign({},O.Table),N),oe=d||Q_t,Z=$("table",r),te=$("dropdown",u),[,ee]=Vu(),de=Y0(Z),[fe,pe,ye]=$_t(Z,de),ae=Object.assign(Object.assign({childrenColumnName:C,expandIconColumnIndex:R},x),{expandIcon:(n=x==null?void 0:x.expandIcon)!==null&&n!==void 0?n:(o=G==null?void 0:G.expandable)===null||o===void 0?void 0:o.expandIcon}),{childrenColumnName:Te="children"}=ae,ge=m.useMemo(()=>oe.some(Wt=>Wt==null?void 0:Wt[Te])?"nest":b||x&&x.expandedRowRender?"row":null,[oe]),Se={body:m.useRef()},Re=yVt(Z),De=m.useRef(null),Ae=m.useRef(null);gVt(e,()=>Object.assign(Object.assign({},Ae.current),{nativeElement:De.current}));const ue=m.useMemo(()=>typeof g=="function"?g:Wt=>Wt==null?void 0:Wt[g],[g]),[he]=x_t(oe,Te,ue),ve={},we=function(Wt,ht){let ct=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;var It,Ft,Ve;const ft=Object.assign(Object.assign({},ve),Wt);ct&&((It=ve.resetPagination)===null||It===void 0||It.call(ve),!((Ft=ft.pagination)===null||Ft===void 0)&&Ft.current&&(ft.pagination.current=1),f&&f.onChange&&f.onChange(1,(Ve=ft.pagination)===null||Ve===void 0?void 0:Ve.pageSize)),F&&F.scrollToFirstRowOnChange!==!1&&Se.body.current&&iRt(0,{getContainer:()=>Se.body.current}),P==null||P(ft.pagination,ft.filters,ft.sorter,{currentDataSource:Fue(Lue(oe,ft.sorterStates,Te),ft.filterStates,Te),action:ht})},Pe=(Wt,ht)=>{we({sorter:Wt,sorterStates:ht},"sort",!1)},[Ie,Me,ze,Ne]=z_t({prefixCls:Z,mergedColumns:j,onSorterChange:Pe,sortDirections:E||["ascend","descend"],tableLocale:se,showSorterTooltip:U}),Je=m.useMemo(()=>Lue(oe,Me,Te),[oe,Me]);ve.sorter=Ne(),ve.sorterStates=Me;const Ue=(Wt,ht)=>{we({filters:Wt,filterStates:ht},"filter",!0)},[nt,We,Ee]=v_t({prefixCls:Z,locale:se,dropdownPrefixCls:te,mergedColumns:j,onFilterChange:Ue,getPopupContainer:v||ie,rootClassName:Un(a,de)}),ke=Fue(Je,We,Te);ve.filters=Ee,ve.filterStates=We;const Oe=m.useMemo(()=>{const Wt={};return Object.keys(Ee).forEach(ht=>{Ee[ht]!==null&&(Wt[ht]=Ee[ht])}),Object.assign(Object.assign({},ze),{filters:Wt})},[ze,Ee]),[st]=D_t(Oe),je=(Wt,ht)=>{we({pagination:Object.assign(Object.assign({},ve.pagination),{current:Wt,pageSize:ht})},"paginate")},[xt,gt]=T_t(ke.length,je,f);ve.pagination=f===!1?{}:S_t(xt,f),ve.resetPagination=gt;const Ye=m.useMemo(()=>{if(f===!1||!xt.pageSize)return ke;const{current:Wt=1,total:ht,pageSize:ct=XKe}=xt;return ke.lengthct?ke.slice((Wt-1)*ct,Wt*ct):ke:ke.slice((Wt-1)*ct,Wt*ct)},[!!f,ke,xt&&xt.current,xt&&xt.pageSize,xt&&xt.total]),[it,ut]=hVt({prefixCls:Z,data:ke,pageData:Ye,getRowKey:ue,getRecordByKey:he,expandType:ge,childrenColumnName:Te,locale:se,getPopupContainer:v||ie},p),Qe=(Wt,ht,ct)=>{let It;return typeof A=="function"?It=Un(A(Wt,ht,ct)):It=Un(A),Un({[`${Z}-row-selected`]:ut.has(ue(Wt,ht))},It)};ae.__PARENT_RENDER_ICON__=ae.expandIcon,ae.expandIcon=ae.expandIcon||w||mVt(se),ge==="nest"&&ae.expandIconColumnIndex===void 0?ae.expandIconColumnIndex=p?1:0:ae.expandIconColumnIndex>0&&p&&(ae.expandIconColumnIndex-=1),typeof ae.indentSize!="number"&&(ae.indentSize=typeof H=="number"?H:15);const lt=m.useCallback(Wt=>st(it(nt(Ie(Wt)))),[Ie,nt,it]);let Ze,Be;if(f!==!1&&(xt!=null&&xt.total)){let Wt;xt.size?Wt=xt.size:Wt=Q==="small"||Q==="middle"?"small":void 0;const ht=Ft=>m.createElement(eKe,Object.assign({},xt,{className:Un(`${Z}-pagination ${Z}-pagination-${Ft}`,xt.className),size:Wt})),ct=V==="rtl"?"left":"right",{position:It}=xt;if(It!==null&&Array.isArray(It)){const Ft=It.find(kt=>kt.includes("top")),Ve=It.find(kt=>kt.includes("bottom")),ft=It.every(kt=>`${kt}`=="none");!Ft&&!Ve&&!ft&&(Be=ht(ct)),Ft&&(Ze=ht(Ft.toLowerCase().replace("top",""))),Ve&&(Be=ht(Ve.toLowerCase().replace("bottom","")))}else Be=ht(ct)}let $e;typeof T=="boolean"?$e={spinning:T}:typeof T=="object"&&($e=Object.assign({spinning:!0},T));const wt=Un(ye,de,`${Z}-wrapper`,G==null?void 0:G.className,{[`${Z}-wrapper-rtl`]:V==="rtl"},i,a,pe),vt=Object.assign(Object.assign({},G==null?void 0:G.style),l),Rt=N&&N.emptyText||(q==null?void 0:q("Table"))||m.createElement(jme,{componentName:"Table"}),Gt=W?F_t:E_t,At={},pt=m.useMemo(()=>{const{fontSize:Wt,lineHeight:ht,padding:ct,paddingXS:It,paddingSM:Ft}=ee,Ve=Math.floor(Wt*ht);switch(Q){case"large":return ct*2+Ve;case"small":return It*2+Ve;default:return Ft*2+Ve}},[ee,Q]);return W&&(At.listItemHeight=pt),fe(m.createElement("div",{ref:De,className:wt,style:vt},m.createElement(tN,Object.assign({spinning:!1},$e),Ze,m.createElement(Gt,Object.assign({},At,B,{ref:Ae,columns:j,direction:V,expandable:ae,prefixCls:Z,className:Un({[`${Z}-middle`]:Q==="middle",[`${Z}-small`]:Q==="small",[`${Z}-bordered`]:c,[`${Z}-empty`]:oe.length===0},ye,de,pe),data:Ye,rowKey:ue,rowClassName:Qe,emptyText:Rt,internalHooks:nN,internalRefs:Se,transformColumns:lt,getContainerWidth:Re})),Be)))},eGt=m.forwardRef(Z_t),tGt=(t,e)=>{const n=m.useRef(0);return n.current+=1,m.createElement(eGt,Object.assign({},t,{ref:e,_renderTimes:n.current}))},Dd=m.forwardRef(tGt);Dd.SELECTION_COLUMN=N4;Dd.EXPAND_COLUMN=q4;Dd.SELECTION_ALL=Mue;Dd.SELECTION_INVERT=Iue;Dd.SELECTION_NONE=zue;Dd.Column=zOt;Dd.ColumnGroup=DOt;Dd.Summary=cKe;const nGt=t=>{const{paddingXXS:e,lineWidth:n,tagPaddingHorizontal:o,componentCls:r,calc:i}=t,a=i(o).sub(n).equal(),l=i(e).sub(n).equal();return{[r]:Object.assign(Object.assign({},Na(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:`${jt(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,borderRadius:t.borderRadiusSM,opacity:1,transition:`all ${t.motionDurationMid}`,textAlign:"start",position:"relative",[`&${r}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},[`${r}-close-icon`]:{marginInlineStart:l,fontSize:t.tagIconSize,color:t.colorTextDescription,cursor:"pointer",transition:`all ${t.motionDurationMid}`,"&:hover":{color:t.colorTextHeading}},[`&${r}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${t.iconCls}-close, ${t.iconCls}-close:hover`]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${r}-checkable-checked):hover`]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${t.iconCls} + span, > span + ${t.iconCls}`]:{marginInlineStart:a}}),[`${r}-borderless`]:{borderColor:"transparent",background:t.tagBorderlessBg}}},Iye=t=>{const{lineWidth:e,fontSizeIcon:n,calc:o}=t,r=t.fontSizeSM;return qi(t,{tagFontSize:r,tagLineHeight:jt(o(t.lineHeightSM).mul(r).equal()),tagIconSize:o(n).sub(o(e).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},zye=t=>({defaultBg:new Wl(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText}),$Ke=wl("Tag",t=>{const e=Iye(t);return nGt(e)},zye);var oGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,style:o,className:r,checked:i,onChange:a,onClick:l}=t,s=oGt(t,["prefixCls","style","className","checked","onChange","onClick"]),{getPrefixCls:c,tag:u}=m.useContext(Cr),d=S=>{a==null||a(!i),l==null||l(S)},f=c("tag",n),[p,g,A]=$Ke(f),y=Un(f,`${f}-checkable`,{[`${f}-checkable-checked`]:i},u==null?void 0:u.className,r,g,A);return p(m.createElement("span",Object.assign({},s,{ref:e,style:Object.assign(Object.assign({},o),u==null?void 0:u.style),className:y,onClick:d})))}),iGt=t=>L$(t,(e,n)=>{let{textColor:o,lightBorderColor:r,lightColor:i,darkColor:a}=n;return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:o,background:i,borderColor:r,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}}),aGt=LW(["Tag","preset"],t=>{const e=Iye(t);return iGt(e)},zye);function lGt(t){return typeof t!="string"?t:t.charAt(0).toUpperCase()+t.slice(1)}const OY=(t,e,n)=>{const o=lGt(n);return{[`${t.componentCls}${t.componentCls}-${e}`]:{color:t[`color${n}`],background:t[`color${o}Bg`],borderColor:t[`color${o}Border`],[`&${t.componentCls}-borderless`]:{borderColor:"transparent"}}}},sGt=LW(["Tag","status"],t=>{const e=Iye(t);return[OY(e,"success","Success"),OY(e,"processing","Info"),OY(e,"error","Error"),OY(e,"warning","Warning")]},zye);var cGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,className:o,rootClassName:r,style:i,children:a,icon:l,color:s,onClose:c,bordered:u=!0,visible:d}=t,f=cGt(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:g,tag:A}=m.useContext(Cr),[y,S]=m.useState(!0),C=dp(f,["closeIcon","closable"]);m.useEffect(()=>{d!==void 0&&S(d)},[d]);const P=tQ(s),v=OEt(s),T=P||v,w=Object.assign(Object.assign({backgroundColor:s&&!T?s:void 0},A==null?void 0:A.style),i),x=p("tag",n),[b,R,H]=$Ke(x),F=Un(x,A==null?void 0:A.className,{[`${x}-${s}`]:T,[`${x}-has-color`]:s&&!T,[`${x}-hidden`]:!y,[`${x}-rtl`]:g==="rtl",[`${x}-borderless`]:!u},o,r,R,H),E=L=>{L.stopPropagation(),c==null||c(L),!L.defaultPrevented&&S(!1)},[,N]=Dme(AR(t),AR(A),{closable:!1,closeIconRender:L=>{const j=m.createElement("span",{className:`${x}-close-icon`,onClick:E},L);return b_e(L,j,B=>({onClick:O=>{var V;(V=B==null?void 0:B.onClick)===null||V===void 0||V.call(B,O),E(O)},className:Un(B==null?void 0:B.className,`${x}-close-icon`)}))}}),U=typeof f.onClick=="function"||a&&a.type==="a",W=l||null,k=W?m.createElement(m.Fragment,null,W,a&&m.createElement("span",null,a)):a,D=m.createElement("span",Object.assign({},C,{ref:e,className:F,style:w}),k,N,P&&m.createElement(aGt,{key:"preset",prefixCls:x}),v&&m.createElement(sGt,{key:"status",prefixCls:x}));return b(U?m.createElement(UW,{component:"Tag"},D):D)}),QKe=uGt;QKe.CheckableTag=rGt;var dGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);rm.createElement(hGt,Object.assign({},t,{picker:"time",mode:void 0,ref:e}))),iN=m.forwardRef((t,e)=>{var{addon:n,renderExtraFooter:o}=t,r=dGt(t,["addon","renderExtraFooter"]);const i=m.useMemo(()=>{if(o)return o;if(n)return n},[n,o]);return m.createElement(fGt,Object.assign({},r,{mode:void 0,ref:e,renderExtraFooter:i}))}),ZKe=XW(iN,"picker");iN._InternalPanelDoNotUseOrYouWillBeFired=ZKe;iN.RangePicker=pGt;iN._InternalPanelDoNotUseOrYouWillBeFired=ZKe;var gGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},mGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gGt}))},eqe=m.forwardRef(mGt),yGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const n=u=>{const{keyCode:d}=u;d===fi.ENTER&&u.preventDefault()},o=u=>{const{keyCode:d}=u,{onClick:f}=t;d===fi.ENTER&&f&&f()},{style:r,noStyle:i,disabled:a,tabIndex:l=0}=t,s=yGt(t,["style","noStyle","disabled","tabIndex"]);let c={};return i||(c=Object.assign({},AGt)),a&&(c.pointerEvents="none"),c=Object.assign(Object.assign({},c),r),m.createElement("div",Object.assign({role:"button",tabIndex:l,ref:e},s,{onKeyDown:n,onKeyUp:o,style:c}))});var wGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"},vGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:wGt}))},nqe=m.forwardRef(vGt),xGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"},bGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:xGt}))},SGt=m.forwardRef(bGt);const TGt=(t,e,n,o)=>{const{titleMarginBottom:r,fontWeightStrong:i}=o;return{marginBottom:r,color:n,fontWeight:i,fontSize:t,lineHeight:e}},PGt=t=>{const e=[1,2,3,4,5],n={};return e.forEach(o=>{n[` h${o}&, div&-h${o}, div&-h${o} > textarea, @@ -4753,7 +4753,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${e}-collapse, ${e}-edit, ${e}-copy - `]:Object.assign(Object.assign({},vme(t)),{marginInlineStart:t.marginXXS})}),HGt(t)),MGt(t)),IGt()),{"&-rtl":{direction:"rtl"}})}},DGt=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),oqe=wl("Typography",t=>[zGt(t)],DGt),EGt=t=>{const{prefixCls:e,"aria-label":n,className:o,style:r,direction:i,maxLength:a,autoSize:l=!0,value:s,onSave:c,onCancel:u,onEnd:d,component:f,enterIcon:p=m.createElement(SGt,null)}=t,g=m.useRef(null),A=m.useRef(!1),y=m.useRef(),[S,C]=m.useState(s);m.useEffect(()=>{C(s)},[s]),m.useEffect(()=>{if(g.current&&g.current.resizableTextArea){const{textArea:W}=g.current.resizableTextArea;W.focus();const{length:k}=W.value;W.setSelectionRange(k,k)}},[]);const P=W=>{let{target:k}=W;C(k.value.replace(/[\n\r]/g,""))},v=()=>{A.current=!0},T=()=>{A.current=!1},w=W=>{let{keyCode:k}=W;A.current||(y.current=k)},x=()=>{c(S.trim())},b=W=>{let{keyCode:k,ctrlKey:D,altKey:L,metaKey:j,shiftKey:B}=W;y.current===k&&!A.current&&!D&&!L&&!j&&!B&&(k===fi.ENTER?(x(),d==null||d()):k===fi.ESC&&u())},R=()=>{x()},H=f?`${e}-${f}`:"",[F,E,N]=oqe(e),U=Un(e,`${e}-edit-content`,{[`${e}-rtl`]:i==="rtl"},o,H,E,N);return F(m.createElement("div",{className:U,style:r},m.createElement(FJe,{ref:g,maxLength:a,value:S,onChange:P,onKeyDown:w,onKeyUp:b,onCompositionStart:v,onCompositionEnd:T,onBlur:R,"aria-label":n,rows:1,autoSize:l}),p!==null?j0(p,{className:`${e}-edit-content-confirm`}):null))};var FGt=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],o=0;o"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Cbe[e.format]||Cbe.default;window.clipboardData.setData(d,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");s=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),o=WGt("message"in e?e.message:LGt),window.prompt(o,t)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return s}var UGt=NGt;const jGt=Wi(UGt);var BGt=function(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,e||[])).next())})};const YGt=t=>{let{copyConfig:e,children:n}=t;const[o,r]=m.useState(!1),[i,a]=m.useState(!1),l=m.useRef(null),s=()=>{l.current&&clearTimeout(l.current)},c={};e.format&&(c.format=e.format),m.useEffect(()=>s,[]);const u=Q6(d=>BGt(void 0,void 0,void 0,function*(){var f;d==null||d.preventDefault(),d==null||d.stopPropagation(),a(!0);try{const p=typeof e.text=="function"?yield e.text():e.text;jGt(p||String(n)||"",c),a(!1),r(!0),s(),l.current=setTimeout(()=>{r(!1)},3e3),(f=e.onCopy)===null||f===void 0||f.call(e,d)}catch(p){throw a(!1),p}}));return{copied:o,copyLoading:i,onClick:u}};function Hie(t,e){return m.useMemo(()=>{const n=!!t;return[n,Object.assign(Object.assign({},e),n&&typeof t=="object"?t:null)]},[t])}const OGt=(t,e)=>{const n=m.useRef(!1);m.useEffect(()=>{n.current?t():n.current=!0},e)},VGt=t=>{const e=m.useRef();return m.useEffect(()=>{e.current=t}),e.current};var _Gt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,component:o="article",className:r,rootClassName:i,setContentRef:a,children:l,direction:s,style:c}=t,u=_Gt(t,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:d,direction:f,typography:p}=m.useContext(Cr),g=s??f;let A=e;a&&(A=o5(e,a));const y=d("typography",n),[S,C,P]=oqe(y),v=Un(y,p==null?void 0:p.className,{[`${y}-rtl`]:g==="rtl"},r,i,C,P),T=Object.assign(Object.assign({},p==null?void 0:p.style),c);return S(m.createElement(o,Object.assign({className:v,style:T,ref:A},u),l))});var GGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},XGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:GGt}))},iqe=m.forwardRef(XGt);function Rbe(t){return t===!1?[!1,!1]:Array.isArray(t)?t:[t]}function VY(t,e,n){return t===!0||t===void 0?e:t||n&&e}const JGt=t=>{const{prefixCls:e,copied:n,locale:o,iconOnly:r,tooltips:i,icon:a,loading:l,tabIndex:s,onCopy:c}=t,u=Rbe(i),d=Rbe(a),{copied:f,copy:p}=o??{},g=n?VY(u[1],f):VY(u[0],p),y=typeof g=="string"?g:n?f:p;return m.createElement(oA,{key:"copy",title:g},m.createElement(tqe,{className:Un(`${e}-copy`,{[`${e}-copy-success`]:n,[`${e}-copy-icon-only`]:r}),onClick:c,"aria-label":y,tabIndex:s},n?VY(d[1],m.createElement(YGe,null),!0):VY(d[0],l?m.createElement(YH,null):m.createElement(iqe,null),!0)))},_Y=m.forwardRef((t,e)=>{let{style:n,children:o}=t;const r=m.useRef(null);return m.useImperativeHandle(e,()=>({isExceed:()=>{const i=r.current;return i.scrollHeight>i.clientHeight},getHeight:()=>r.current.clientHeight})),m.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},o)});function aqe(t){const e=typeof t;return e==="string"||e==="number"}function KGt(t){let e=0;return t.forEach(n=>{aqe(n)?e+=String(n).length:e+=1}),e}function Hbe(t,e){let n=0;const o=[];for(let r=0;re){const c=e-n;return o.push(String(i).slice(0,c)),o}o.push(i),n=s}return t}const Mie=0,Iie=1,zie=2,Mbe=3,GY={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function qGt(t){const{enableMeasure:e,width:n,text:o,children:r,rows:i,expanded:a,miscDeps:l,onEllipsis:s}=t,c=m.useMemo(()=>Y9(o),[o]),u=m.useMemo(()=>KGt(c),[o]),d=m.useMemo(()=>r(c,!1),[o]),[f,p]=m.useState(null),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),[C,P]=m.useState(!1),[v,T]=m.useState(Mie),[w,x]=m.useState(0);vx(()=>{T(e&&n&&u?Iie:Mie)},[n,o,i,e,c]),vx(()=>{var F,E,N,U;if(v===Iie){const W=!!(!((F=A.current)===null||F===void 0)&&F.isExceed());T(W?zie:Mbe),p(W?[0,u]:null),P(W);const k=((E=A.current)===null||E===void 0?void 0:E.getHeight())||0,D=i===1?0:((N=y.current)===null||N===void 0?void 0:N.getHeight())||0,L=((U=S.current)===null||U===void 0?void 0:U.getHeight())||0,j=D+L,B=Math.max(k,j);x(B+1),s(W)}},[v]);const b=f?Math.ceil((f[0]+f[1])/2):0;vx(()=>{var F;const[E,N]=f||[0,0];if(E!==N){const W=(((F=g.current)===null||F===void 0?void 0:F.getHeight())||0)>w;let k=b;N-E===1&&(k=W?E:N),p(W?[E,k]:[k,N])}},[f,b]);const R=m.useMemo(()=>{if(v!==zie||!f||f[0]!==f[1]){const F=r(c,!1);return v!==Mbe&&v!==Mie?m.createElement("span",{style:Object.assign(Object.assign({},GY),{WebkitLineClamp:i})},F):F}return r(a?c:Hbe(c,f[0]),C)},[a,v,f,c].concat(Qa(l))),H={width:n,whiteSpace:"normal",margin:0,padding:0};return m.createElement(m.Fragment,null,R,v===Iie&&m.createElement(m.Fragment,null,m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:i}),ref:A},d),m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:i-1}),ref:y},d),m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:1}),ref:S},r([],!0))),v===zie&&f&&f[0]!==f[1]&&m.createElement(_Y,{style:Object.assign(Object.assign({},H),{top:400}),ref:g},r(Hbe(c,b),!0)))}const $Gt=t=>{let{enableEllipsis:e,isEllipsis:n,children:o,tooltipProps:r}=t;return!(r!=null&&r.title)||!e?o:m.createElement(oA,Object.assign({open:n?void 0:!1},r),o)};var QGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r;const{prefixCls:i,className:a,style:l,type:s,disabled:c,children:u,ellipsis:d,editable:f,copyable:p,component:g,title:A}=t,y=QGt(t,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:S,direction:C}=m.useContext(Cr),[P]=Uw("Text"),v=m.useRef(null),T=m.useRef(null),w=S("typography",i),x=dp(y,["mark","code","delete","underline","strong","keyboard","italic"]),[b,R]=Hie(f),[H,F]=Z6(!1,{value:R.editing}),{triggerType:E=["icon"]}=R,N=ke=>{var Oe;ke&&((Oe=R.onStart)===null||Oe===void 0||Oe.call(R)),F(ke)},U=VGt(H);OGt(()=>{var ke;!H&&U&&((ke=T.current)===null||ke===void 0||ke.focus())},[H]);const W=ke=>{ke==null||ke.preventDefault(),N(!0)},k=ke=>{var Oe;(Oe=R.onChange)===null||Oe===void 0||Oe.call(R,ke),N(!1)},D=()=>{var ke;(ke=R.onCancel)===null||ke===void 0||ke.call(R),N(!1)},[L,j]=Hie(p),{copied:B,copyLoading:O,onClick:V}=YGt({copyConfig:j,children:u}),[G,q]=m.useState(!1),[$,ie]=m.useState(!1),[Q,se]=m.useState(!1),[Z,ee]=m.useState(!1),[te,oe]=m.useState(!0),[de,he]=Hie(d,{expandable:!1,symbol:ke=>ke?P==null?void 0:P.collapse:P==null?void 0:P.expand}),[pe,me]=Z6(he.defaultExpanded||!1,{value:he.expanded}),le=de&&(!pe||he.expandable==="collapsible"),{rows:Te=1}=he,ge=m.useMemo(()=>le&&(he.suffix!==void 0||he.onEllipsis||he.expandable||b||L),[le,he,b,L]);vx(()=>{de&&!ge&&(q(eve("webkitLineClamp")),ie(eve("textOverflow")))},[ge,de]);const[Se,Re]=m.useState(le),De=m.useMemo(()=>ge?!1:Te===1?$:G,[ge,$,G]);vx(()=>{Re(De&&le)},[De,le]);const Ae=le&&(Se?Z:Q),ue=le&&Te===1&&Se,fe=le&&Te>1&&Se,ve=(ke,Oe)=>{var st;me(Oe.expanded),(st=he.onExpand)===null||st===void 0||st.call(he,ke,Oe)},[we,Pe]=m.useState(0),Ie=ke=>{let{offsetWidth:Oe}=ke;Pe(Oe)},Me=ke=>{var Oe;se(ke),Q!==ke&&((Oe=he.onEllipsis)===null||Oe===void 0||Oe.call(he,ke))};m.useEffect(()=>{const ke=v.current;if(de&&Se&&ke){const Oe=fe?ke.offsetHeight{const ke=v.current;if(typeof IntersectionObserver>"u"||!ke||!Se||!le)return;const Oe=new IntersectionObserver(()=>{oe(!!ke.offsetParent)});return Oe.observe(ke),()=>{Oe.disconnect()}},[Se,le]);let ze={};he.tooltip===!0?ze={title:(n=R.text)!==null&&n!==void 0?n:u}:m.isValidElement(he.tooltip)?ze={title:he.tooltip}:typeof he.tooltip=="object"?ze=Object.assign({title:(o=R.text)!==null&&o!==void 0?o:u},he.tooltip):ze={title:he.tooltip};const Ne=m.useMemo(()=>{const ke=Oe=>["string","number"].includes(typeof Oe);if(!(!de||Se)){if(ke(R.text))return R.text;if(ke(u))return u;if(ke(A))return A;if(ke(ze.title))return ze.title}},[de,Se,A,ze.title,Ae]);if(H)return m.createElement(EGt,{value:(r=R.text)!==null&&r!==void 0?r:typeof u=="string"?u:"",onSave:k,onCancel:D,onEnd:R.onEnd,prefixCls:w,className:a,style:l,direction:C,component:g,maxLength:R.maxLength,autoSize:R.autoSize,enterIcon:R.enterIcon});const Je=()=>{const{expandable:ke,symbol:Oe}=he;return!ke||pe&&ke!=="collapsible"?null:m.createElement("a",{key:"expand",className:`${w}-${pe?"collapse":"expand"}`,onClick:st=>ve(st,{expanded:!pe}),"aria-label":pe?P.collapse:P==null?void 0:P.expand},typeof Oe=="function"?Oe(pe):Oe)},Ue=()=>{if(!b)return;const{icon:ke,tooltip:Oe,tabIndex:st}=R,je=Y9(Oe)[0]||(P==null?void 0:P.edit),xt=typeof je=="string"?je:"";return E.includes("icon")?m.createElement(oA,{key:"edit",title:Oe===!1?"":je},m.createElement(tqe,{ref:T,className:`${w}-edit`,onClick:W,"aria-label":xt,tabIndex:st},ke||m.createElement(nqe,{role:"button"}))):null},nt=()=>L?m.createElement(JGt,Object.assign({key:"copy"},j,{prefixCls:w,copied:B,locale:P,onCopy:V,loading:O,iconOnly:u==null})):null,We=ke=>[ke&&Je(),Ue(),nt()],Ee=ke=>[ke&&!pe&&m.createElement("span",{"aria-hidden":!0,key:"ellipsis"},eXt),he.suffix,We(ke)];return m.createElement(Cd,{onResize:Ie,disabled:!le},ke=>m.createElement($Gt,{tooltipProps:ze,enableEllipsis:le,isEllipsis:Ae},m.createElement(rqe,Object.assign({className:Un({[`${w}-${s}`]:s,[`${w}-disabled`]:c,[`${w}-ellipsis`]:de,[`${w}-single-line`]:le&&Te===1&&!pe,[`${w}-ellipsis-single-line`]:ue,[`${w}-ellipsis-multiple-line`]:fe},a),prefixCls:i,style:Object.assign(Object.assign({},l),{WebkitLineClamp:fe?Te:void 0}),component:g,ref:o5(ke,v,e),direction:C,onClick:E.includes("text")?W:void 0,"aria-label":Ne==null?void 0:Ne.toString(),title:A},x),m.createElement(qGt,{enableMeasure:le&&!Se,text:u,rows:Te,width:we,onEllipsis:Me,expanded:pe,miscDeps:[B,pe,O,b,L]},(Oe,st)=>ZGt(t,m.createElement(m.Fragment,null,Oe.length>0&&st&&!pe&&Ne?m.createElement("span",{key:"show-content","aria-hidden":!0},Oe):Oe,Ee(st)))))))});var tXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n,rel:o}=t,r=tXt(t,["ellipsis","rel"]);const i=Object.assign(Object.assign({},r),{rel:o===void 0&&r.target==="_blank"?"noopener noreferrer":o});return delete i.navigate,m.createElement(xQ,Object.assign({},i,{ref:e,ellipsis:!!n,component:"a"}))}),oXt=m.forwardRef((t,e)=>m.createElement(xQ,Object.assign({ref:e},t,{component:"div"})));var rXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n}=t,o=rXt(t,["ellipsis"]);const r=m.useMemo(()=>n&&typeof n=="object"?dp(n,["expandable","rows"]):n,[n]);return m.createElement(xQ,Object.assign({ref:e},o,{ellipsis:r,component:"span"}))},aXt=m.forwardRef(iXt);var lXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{level:n=1}=t,o=lXt(t,["level"]);let r;return sXt.includes(n)?r=`h${n}`:r="h1",m.createElement(xQ,Object.assign({ref:e},o,{component:r}))}),L6=rqe;L6.Text=aXt;L6.Link=nXt;L6.Title=cXt;L6.Paragraph=oXt;/*! + `]:Object.assign(Object.assign({},vme(t)),{marginInlineStart:t.marginXXS})}),HGt(t)),MGt(t)),IGt()),{"&-rtl":{direction:"rtl"}})}},DGt=()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"}),oqe=wl("Typography",t=>[zGt(t)],DGt),EGt=t=>{const{prefixCls:e,"aria-label":n,className:o,style:r,direction:i,maxLength:a,autoSize:l=!0,value:s,onSave:c,onCancel:u,onEnd:d,component:f,enterIcon:p=m.createElement(SGt,null)}=t,g=m.useRef(null),A=m.useRef(!1),y=m.useRef(),[S,C]=m.useState(s);m.useEffect(()=>{C(s)},[s]),m.useEffect(()=>{if(g.current&&g.current.resizableTextArea){const{textArea:W}=g.current.resizableTextArea;W.focus();const{length:k}=W.value;W.setSelectionRange(k,k)}},[]);const P=W=>{let{target:k}=W;C(k.value.replace(/[\n\r]/g,""))},v=()=>{A.current=!0},T=()=>{A.current=!1},w=W=>{let{keyCode:k}=W;A.current||(y.current=k)},x=()=>{c(S.trim())},b=W=>{let{keyCode:k,ctrlKey:D,altKey:L,metaKey:j,shiftKey:B}=W;y.current===k&&!A.current&&!D&&!L&&!j&&!B&&(k===fi.ENTER?(x(),d==null||d()):k===fi.ESC&&u())},R=()=>{x()},H=f?`${e}-${f}`:"",[F,E,N]=oqe(e),U=Un(e,`${e}-edit-content`,{[`${e}-rtl`]:i==="rtl"},o,H,E,N);return F(m.createElement("div",{className:U,style:r},m.createElement(FJe,{ref:g,maxLength:a,value:S,onChange:P,onKeyDown:w,onKeyUp:b,onCompositionStart:v,onCompositionEnd:T,onBlur:R,"aria-label":n,rows:1,autoSize:l}),p!==null?j0(p,{className:`${e}-edit-content-confirm`}):null))};var FGt=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],o=0;o"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var d=Cbe[e.format]||Cbe.default;window.clipboardData.setData(d,t)}else u.clipboardData.clearData(),u.clipboardData.setData(e.format,t);e.onCopy&&(u.preventDefault(),e.onCopy(u.clipboardData))}),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i);var c=document.execCommand("copy");if(!c)throw new Error("copy command was unsuccessful");s=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),s=!0}catch(d){n&&console.error("unable to copy using clipboardData: ",d),n&&console.error("falling back to prompt"),o=WGt("message"in e?e.message:LGt),window.prompt(o,t)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),r()}return s}var UGt=NGt;const jGt=Wi(UGt);var BGt=function(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,e||[])).next())})};const YGt=t=>{let{copyConfig:e,children:n}=t;const[o,r]=m.useState(!1),[i,a]=m.useState(!1),l=m.useRef(null),s=()=>{l.current&&clearTimeout(l.current)},c={};e.format&&(c.format=e.format),m.useEffect(()=>s,[]);const u=Q6(d=>BGt(void 0,void 0,void 0,function*(){var f;d==null||d.preventDefault(),d==null||d.stopPropagation(),a(!0);try{const p=typeof e.text=="function"?yield e.text():e.text;jGt(p||String(n)||"",c),a(!1),r(!0),s(),l.current=setTimeout(()=>{r(!1)},3e3),(f=e.onCopy)===null||f===void 0||f.call(e,d)}catch(p){throw a(!1),p}}));return{copied:o,copyLoading:i,onClick:u}};function Hie(t,e){return m.useMemo(()=>{const n=!!t;return[n,Object.assign(Object.assign({},e),n&&typeof t=="object"?t:null)]},[t])}const OGt=(t,e)=>{const n=m.useRef(!1);m.useEffect(()=>{n.current?t():n.current=!0},e)},VGt=t=>{const e=m.useRef();return m.useEffect(()=>{e.current=t}),e.current};var _Gt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{prefixCls:n,component:o="article",className:r,rootClassName:i,setContentRef:a,children:l,direction:s,style:c}=t,u=_Gt(t,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:d,direction:f,typography:p}=m.useContext(Cr),g=s??f;let A=e;a&&(A=o5(e,a));const y=d("typography",n),[S,C,P]=oqe(y),v=Un(y,p==null?void 0:p.className,{[`${y}-rtl`]:g==="rtl"},r,i,C,P),T=Object.assign(Object.assign({},p==null?void 0:p.style),c);return S(m.createElement(o,Object.assign({className:v,style:T,ref:A},u),l))});var GGt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"}}]},name:"copy",theme:"outlined"},XGt=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:GGt}))},iqe=m.forwardRef(XGt);function Rbe(t){return t===!1?[!1,!1]:Array.isArray(t)?t:[t]}function VY(t,e,n){return t===!0||t===void 0?e:t||n&&e}const JGt=t=>{const{prefixCls:e,copied:n,locale:o,iconOnly:r,tooltips:i,icon:a,loading:l,tabIndex:s,onCopy:c}=t,u=Rbe(i),d=Rbe(a),{copied:f,copy:p}=o??{},g=n?VY(u[1],f):VY(u[0],p),y=typeof g=="string"?g:n?f:p;return m.createElement(oA,{key:"copy",title:g},m.createElement(tqe,{className:Un(`${e}-copy`,{[`${e}-copy-success`]:n,[`${e}-copy-icon-only`]:r}),onClick:c,"aria-label":y,tabIndex:s},n?VY(d[1],m.createElement(YGe,null),!0):VY(d[0],l?m.createElement(YH,null):m.createElement(iqe,null),!0)))},_Y=m.forwardRef((t,e)=>{let{style:n,children:o}=t;const r=m.useRef(null);return m.useImperativeHandle(e,()=>({isExceed:()=>{const i=r.current;return i.scrollHeight>i.clientHeight},getHeight:()=>r.current.clientHeight})),m.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},n)},o)});function aqe(t){const e=typeof t;return e==="string"||e==="number"}function KGt(t){let e=0;return t.forEach(n=>{aqe(n)?e+=String(n).length:e+=1}),e}function Hbe(t,e){let n=0;const o=[];for(let r=0;re){const c=e-n;return o.push(String(i).slice(0,c)),o}o.push(i),n=s}return t}const Mie=0,Iie=1,zie=2,Mbe=3,GY={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function qGt(t){const{enableMeasure:e,width:n,text:o,children:r,rows:i,expanded:a,miscDeps:l,onEllipsis:s}=t,c=m.useMemo(()=>Y9(o),[o]),u=m.useMemo(()=>KGt(c),[o]),d=m.useMemo(()=>r(c,!1),[o]),[f,p]=m.useState(null),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),[C,P]=m.useState(!1),[v,T]=m.useState(Mie),[w,x]=m.useState(0);vx(()=>{T(e&&n&&u?Iie:Mie)},[n,o,i,e,c]),vx(()=>{var F,E,N,U;if(v===Iie){const W=!!(!((F=A.current)===null||F===void 0)&&F.isExceed());T(W?zie:Mbe),p(W?[0,u]:null),P(W);const k=((E=A.current)===null||E===void 0?void 0:E.getHeight())||0,D=i===1?0:((N=y.current)===null||N===void 0?void 0:N.getHeight())||0,L=((U=S.current)===null||U===void 0?void 0:U.getHeight())||0,j=D+L,B=Math.max(k,j);x(B+1),s(W)}},[v]);const b=f?Math.ceil((f[0]+f[1])/2):0;vx(()=>{var F;const[E,N]=f||[0,0];if(E!==N){const W=(((F=g.current)===null||F===void 0?void 0:F.getHeight())||0)>w;let k=b;N-E===1&&(k=W?E:N),p(W?[E,k]:[k,N])}},[f,b]);const R=m.useMemo(()=>{if(v!==zie||!f||f[0]!==f[1]){const F=r(c,!1);return v!==Mbe&&v!==Mie?m.createElement("span",{style:Object.assign(Object.assign({},GY),{WebkitLineClamp:i})},F):F}return r(a?c:Hbe(c,f[0]),C)},[a,v,f,c].concat(Qa(l))),H={width:n,whiteSpace:"normal",margin:0,padding:0};return m.createElement(m.Fragment,null,R,v===Iie&&m.createElement(m.Fragment,null,m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:i}),ref:A},d),m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:i-1}),ref:y},d),m.createElement(_Y,{style:Object.assign(Object.assign(Object.assign({},H),GY),{WebkitLineClamp:1}),ref:S},r([],!0))),v===zie&&f&&f[0]!==f[1]&&m.createElement(_Y,{style:Object.assign(Object.assign({},H),{top:400}),ref:g},r(Hbe(c,b),!0)))}const $Gt=t=>{let{enableEllipsis:e,isEllipsis:n,children:o,tooltipProps:r}=t;return!(r!=null&&r.title)||!e?o:m.createElement(oA,Object.assign({open:n?void 0:!1},r),o)};var QGt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var n,o,r;const{prefixCls:i,className:a,style:l,type:s,disabled:c,children:u,ellipsis:d,editable:f,copyable:p,component:g,title:A}=t,y=QGt(t,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:S,direction:C}=m.useContext(Cr),[P]=Uw("Text"),v=m.useRef(null),T=m.useRef(null),w=S("typography",i),x=dp(y,["mark","code","delete","underline","strong","keyboard","italic"]),[b,R]=Hie(f),[H,F]=Z6(!1,{value:R.editing}),{triggerType:E=["icon"]}=R,N=ke=>{var Oe;ke&&((Oe=R.onStart)===null||Oe===void 0||Oe.call(R)),F(ke)},U=VGt(H);OGt(()=>{var ke;!H&&U&&((ke=T.current)===null||ke===void 0||ke.focus())},[H]);const W=ke=>{ke==null||ke.preventDefault(),N(!0)},k=ke=>{var Oe;(Oe=R.onChange)===null||Oe===void 0||Oe.call(R,ke),N(!1)},D=()=>{var ke;(ke=R.onCancel)===null||ke===void 0||ke.call(R),N(!1)},[L,j]=Hie(p),{copied:B,copyLoading:O,onClick:V}=YGt({copyConfig:j,children:u}),[G,q]=m.useState(!1),[$,ie]=m.useState(!1),[Q,se]=m.useState(!1),[oe,Z]=m.useState(!1),[te,ee]=m.useState(!0),[de,fe]=Hie(d,{expandable:!1,symbol:ke=>ke?P==null?void 0:P.collapse:P==null?void 0:P.expand}),[pe,ye]=Z6(fe.defaultExpanded||!1,{value:fe.expanded}),ae=de&&(!pe||fe.expandable==="collapsible"),{rows:Te=1}=fe,ge=m.useMemo(()=>ae&&(fe.suffix!==void 0||fe.onEllipsis||fe.expandable||b||L),[ae,fe,b,L]);vx(()=>{de&&!ge&&(q(eve("webkitLineClamp")),ie(eve("textOverflow")))},[ge,de]);const[Se,Re]=m.useState(ae),De=m.useMemo(()=>ge?!1:Te===1?$:G,[ge,$,G]);vx(()=>{Re(De&&ae)},[De,ae]);const Ae=ae&&(Se?oe:Q),ue=ae&&Te===1&&Se,he=ae&&Te>1&&Se,ve=(ke,Oe)=>{var st;ye(Oe.expanded),(st=fe.onExpand)===null||st===void 0||st.call(fe,ke,Oe)},[we,Pe]=m.useState(0),Ie=ke=>{let{offsetWidth:Oe}=ke;Pe(Oe)},Me=ke=>{var Oe;se(ke),Q!==ke&&((Oe=fe.onEllipsis)===null||Oe===void 0||Oe.call(fe,ke))};m.useEffect(()=>{const ke=v.current;if(de&&Se&&ke){const Oe=he?ke.offsetHeight{const ke=v.current;if(typeof IntersectionObserver>"u"||!ke||!Se||!ae)return;const Oe=new IntersectionObserver(()=>{ee(!!ke.offsetParent)});return Oe.observe(ke),()=>{Oe.disconnect()}},[Se,ae]);let ze={};fe.tooltip===!0?ze={title:(n=R.text)!==null&&n!==void 0?n:u}:m.isValidElement(fe.tooltip)?ze={title:fe.tooltip}:typeof fe.tooltip=="object"?ze=Object.assign({title:(o=R.text)!==null&&o!==void 0?o:u},fe.tooltip):ze={title:fe.tooltip};const Ne=m.useMemo(()=>{const ke=Oe=>["string","number"].includes(typeof Oe);if(!(!de||Se)){if(ke(R.text))return R.text;if(ke(u))return u;if(ke(A))return A;if(ke(ze.title))return ze.title}},[de,Se,A,ze.title,Ae]);if(H)return m.createElement(EGt,{value:(r=R.text)!==null&&r!==void 0?r:typeof u=="string"?u:"",onSave:k,onCancel:D,onEnd:R.onEnd,prefixCls:w,className:a,style:l,direction:C,component:g,maxLength:R.maxLength,autoSize:R.autoSize,enterIcon:R.enterIcon});const Je=()=>{const{expandable:ke,symbol:Oe}=fe;return!ke||pe&&ke!=="collapsible"?null:m.createElement("a",{key:"expand",className:`${w}-${pe?"collapse":"expand"}`,onClick:st=>ve(st,{expanded:!pe}),"aria-label":pe?P.collapse:P==null?void 0:P.expand},typeof Oe=="function"?Oe(pe):Oe)},Ue=()=>{if(!b)return;const{icon:ke,tooltip:Oe,tabIndex:st}=R,je=Y9(Oe)[0]||(P==null?void 0:P.edit),xt=typeof je=="string"?je:"";return E.includes("icon")?m.createElement(oA,{key:"edit",title:Oe===!1?"":je},m.createElement(tqe,{ref:T,className:`${w}-edit`,onClick:W,"aria-label":xt,tabIndex:st},ke||m.createElement(nqe,{role:"button"}))):null},nt=()=>L?m.createElement(JGt,Object.assign({key:"copy"},j,{prefixCls:w,copied:B,locale:P,onCopy:V,loading:O,iconOnly:u==null})):null,We=ke=>[ke&&Je(),Ue(),nt()],Ee=ke=>[ke&&!pe&&m.createElement("span",{"aria-hidden":!0,key:"ellipsis"},eXt),fe.suffix,We(ke)];return m.createElement(Cd,{onResize:Ie,disabled:!ae},ke=>m.createElement($Gt,{tooltipProps:ze,enableEllipsis:ae,isEllipsis:Ae},m.createElement(rqe,Object.assign({className:Un({[`${w}-${s}`]:s,[`${w}-disabled`]:c,[`${w}-ellipsis`]:de,[`${w}-single-line`]:ae&&Te===1&&!pe,[`${w}-ellipsis-single-line`]:ue,[`${w}-ellipsis-multiple-line`]:he},a),prefixCls:i,style:Object.assign(Object.assign({},l),{WebkitLineClamp:he?Te:void 0}),component:g,ref:o5(ke,v,e),direction:C,onClick:E.includes("text")?W:void 0,"aria-label":Ne==null?void 0:Ne.toString(),title:A},x),m.createElement(qGt,{enableMeasure:ae&&!Se,text:u,rows:Te,width:we,onEllipsis:Me,expanded:pe,miscDeps:[B,pe,O,b,L]},(Oe,st)=>ZGt(t,m.createElement(m.Fragment,null,Oe.length>0&&st&&!pe&&Ne?m.createElement("span",{key:"show-content","aria-hidden":!0},Oe):Oe,Ee(st)))))))});var tXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n,rel:o}=t,r=tXt(t,["ellipsis","rel"]);const i=Object.assign(Object.assign({},r),{rel:o===void 0&&r.target==="_blank"?"noopener noreferrer":o});return delete i.navigate,m.createElement(xQ,Object.assign({},i,{ref:e,ellipsis:!!n,component:"a"}))}),oXt=m.forwardRef((t,e)=>m.createElement(xQ,Object.assign({ref:e},t,{component:"div"})));var rXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{var{ellipsis:n}=t,o=rXt(t,["ellipsis"]);const r=m.useMemo(()=>n&&typeof n=="object"?dp(n,["expandable","rows"]):n,[n]);return m.createElement(xQ,Object.assign({ref:e},o,{ellipsis:r,component:"span"}))},aXt=m.forwardRef(iXt);var lXt=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(t);r{const{level:n=1}=t,o=lXt(t,["level"]);let r;return sXt.includes(n)?r=`h${n}`:r="h1",m.createElement(xQ,Object.assign({ref:e},o,{component:r}))}),L6=rqe;L6.Text=aXt;L6.Link=nXt;L6.Title=cXt;L6.Paragraph=oXt;/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -4770,22 +4770,22 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Wue=function(t,e){return Wue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},Wue(t,e)};function i5(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Wue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Nue=function(){return Nue=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=55296&&r<=56319&&n>10)+55296,a%1024+56320)),(r+1===n||o.length>16384)&&(i+=String.fromCharCode.apply(String,o),o.length=0)}return i},Ibe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dXt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var JY=0;JY"u"?[]:new Uint8Array(256);for(var KY=0;KY>4,u[r++]=(a&15)<<4|l>>2,u[r++]=(l&3)<<6|s&63;return c},hXt=function(t){for(var e=t.length,n=[],o=0;o>Sx,mXt=1<>Sx,AXt=lqe+yXt,wXt=AXt,vXt=32,xXt=wXt+vXt,bXt=65536>>Dye,SXt=1<=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>Sx],n=(n<>Sx)],n=(n<>Dye),n=this.index[n],n+=e>>Sx&TXt,n=this.index[n],n=(n<"u"?[]:new Uint8Array(256);for(var qY=0;qYFbe?(r.push(!0),l-=Fbe):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return o.push(a),n.push(Bue);if(l===zXt||l===Uue){if(a===0)return o.push(a),n.push(Cv);var s=n[a-1];return UXt.indexOf(s)===-1?(o.push(o[a-1]),n.push(s)):(o.push(a),n.push(Cv))}if(o.push(a),l===LXt)return n.push(e==="strict"?Yue:Ak);if(l===dqe||l===kXt)return n.push(Cv);if(l===WXt)return i>=131072&&i<=196605||i>=196608&&i<=262141?n.push(Ak):n.push(Cv);n.push(l)}),[o,n,r]},Lie=function(t,e,n,o){var r=o[n];if(Array.isArray(t)?t.indexOf(r)!==-1:t===r)for(var i=n;i<=o.length;){i++;var a=o[i];if(a===e)return!0;if(a!==S8)break}if(r===S8)for(var i=n;i>0;){i--;var l=o[i];if(Array.isArray(t)?t.indexOf(l)!==-1:t===l)for(var s=n;s<=o.length;){s++;var a=o[s];if(a===e)return!0;if(a!==S8)break}if(l!==S8)break}return!1},Bbe=function(t,e){for(var n=t;n>=0;){var o=e[n];if(o===S8)n--;else return o}return 0},YXt=function(t,e,n,o,r){if(n[o]===0)return Ja;var i=o-1;if(Array.isArray(r)&&r[i]===!0)return Ja;var a=i-1,l=i+1,s=e[i],c=a>=0?e[a]:0,u=e[l];if(s===sqe&&u===cqe)return Ja;if(Jue.indexOf(s)!==-1)return fqe;if(Jue.indexOf(u)!==-1||hqe.indexOf(u)!==-1)return Ja;if(Bbe(i,e)===uqe)return eO;if(Xue.get(t[i])===Uue||(s===QY||s===ZY)&&Xue.get(t[l])===Uue||s===kbe||u===kbe||s===Lbe||[S8,jue,WD].indexOf(s)===-1&&u===Lbe||[$Y,Yz,FXt,YT,OT].indexOf(u)!==-1||Bbe(i,e)===Oz||Lie(Fie,Oz,i,e)||Lie([$Y,Yz],Yue,i,e)||Lie(Wbe,Wbe,i,e))return Ja;if(s===S8)return eO;if(s===Fie||u===Fie)return Ja;if(u===Bue||s===Bue)return eO;if([jue,WD,Yue].indexOf(u)!==-1||s===EXt||c===_ue&&jXt.indexOf(s)!==-1||s===OT&&u===_ue||u===Nbe||l6.indexOf(u)!==-1&&s===G1||l6.indexOf(s)!==-1&&u===G1||s===UD&&[Ak,QY,ZY].indexOf(u)!==-1||[Ak,QY,ZY].indexOf(s)!==-1&&u===ND||l6.indexOf(s)!==-1&&Ube.indexOf(u)!==-1||Ube.indexOf(s)!==-1&&l6.indexOf(u)!==-1||[UD,ND].indexOf(s)!==-1&&(u===G1||[Oz,WD].indexOf(u)!==-1&&e[l+1]===G1)||[Oz,WD].indexOf(s)!==-1&&u===G1||s===G1&&[G1,OT,YT].indexOf(u)!==-1)return Ja;if([G1,OT,YT,$Y,Yz].indexOf(u)!==-1)for(var d=i;d>=0;){var f=e[d];if(f===G1)return Ja;if([OT,YT].indexOf(f)!==-1)d--;else break}if([UD,ND].indexOf(u)!==-1)for(var d=[$Y,Yz].indexOf(s)!==-1?a:i;d>=0;){var f=e[d];if(f===G1)return Ja;if([OT,YT].indexOf(f)!==-1)d--;else break}if(Gue===s&&[Gue,n_,Oue,Vue].indexOf(u)!==-1||[n_,Oue].indexOf(s)!==-1&&[n_,o_].indexOf(u)!==-1||[o_,Vue].indexOf(s)!==-1&&u===o_||jbe.indexOf(s)!==-1&&[Nbe,ND].indexOf(u)!==-1||jbe.indexOf(u)!==-1&&s===UD||l6.indexOf(s)!==-1&&l6.indexOf(u)!==-1||s===YT&&l6.indexOf(u)!==-1||l6.concat(G1).indexOf(s)!==-1&&u===Oz&&NXt.indexOf(t[l])===-1||l6.concat(G1).indexOf(u)!==-1&&s===Yz)return Ja;if(s===kie&&u===kie){for(var p=n[i],g=1;p>0&&(p--,e[p]===kie);)g++;if(g%2!==0)return Ja}return s===QY&&u===ZY?Ja:eO},OXt=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var n=BXt(t,e.lineBreak),o=n[0],r=n[1],i=n[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(l){return[G1,Cv,dqe].indexOf(l)!==-1?Ak:l}));var a=e.wordBreak==="keep-all"?i.map(function(l,s){return l&&t[s]>=19968&&t[s]<=40959}):void 0;return[o,r,a]},VXt=function(){function t(e,n,o,r){this.codePoints=e,this.required=n===fqe,this.start=o,this.end=r}return t.prototype.slice=function(){return D0.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),_Xt=function(t,e){var n=SQ(t),o=OXt(n,e),r=o[0],i=o[1],a=o[2],l=n.length,s=0,c=0;return{next:function(){if(c>=l)return{done:!0,value:null};for(var u=Ja;c=pqe&&t<=57},PJt=function(t){return t>=55296&&t<=57343},VT=function(t){return eh(t)||t>=yqe&&t<=wqe||t>=gqe&&t<=vJt},CJt=function(t){return t>=gqe&&t<=bJt},RJt=function(t){return t>=yqe&&t<=TJt},HJt=function(t){return CJt(t)||RJt(t)},MJt=function(t){return t>=uJt},iO=function(t){return t===ZG||t===JXt||t===KXt},eX=function(t){return HJt(t)||MJt(t)||t===ZXt},Gbe=function(t){return eX(t)||eh(t)||t===Lp},IJt=function(t){return t>=pJt&&t<=gJt||t===mJt||t>=yJt&&t<=AJt||t===wJt},$4=function(t,e){return t!==IE?!1:e!==ZG},aO=function(t,e,n){return t===Lp?eX(e)||$4(e,n):eX(t)?!0:!!(t===IE&&$4(t,e))},Nie=function(t,e,n){return t===Gv||t===Lp?eh(e)?!0:e===wk&&eh(n):eh(t===wk?e:t)},zJt=function(t){var e=0,n=1;(t[e]===Gv||t[e]===Lp)&&(t[e]===Lp&&(n=-1),e++);for(var o=[];eh(t[e]);)o.push(t[e++]);var r=o.length?parseInt(D0.apply(void 0,o),10):0;t[e]===wk&&e++;for(var i=[];eh(t[e]);)i.push(t[e++]);var a=i.length,l=a?parseInt(D0.apply(void 0,i),10):0;(t[e]===Aqe||t[e]===mqe)&&e++;var s=1;(t[e]===Gv||t[e]===Lp)&&(t[e]===Lp&&(s=-1),e++);for(var c=[];eh(t[e]);)c.push(t[e++]);var u=c.length?parseInt(D0.apply(void 0,c),10):0;return n*(r+l*Math.pow(10,-a))*Math.pow(10,s*u)},DJt={type:2},EJt={type:3},FJt={type:4},kJt={type:13},LJt={type:8},WJt={type:21},NJt={type:9},UJt={type:10},jJt={type:11},BJt={type:12},YJt={type:14},lO={type:23},OJt={type:1},VJt={type:25},_Jt={type:24},GJt={type:26},XJt={type:27},JJt={type:28},KJt={type:29},qJt={type:31},Kue={type:32},vqe=function(){function t(){this._value=[]}return t.prototype.write=function(e){this._value=this._value.concat(SQ(e))},t.prototype.read=function(){for(var e=[],n=this.consumeToken();n!==Kue;)e.push(n),n=this.consumeToken();return e},t.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case tO:return this.consumeStringToken(tO);case qXt:var n=this.peekCodePoint(0),o=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Gbe(n)||$4(o,r)){var i=aO(n,o,r)?XXt:GXt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case $Xt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),kJt;break;case nO:return this.consumeStringToken(nO);case oO:return DJt;case _z:return EJt;case Wie:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),YJt;break;case Gv:if(Nie(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case dJt:return FJt;case Lp:var l=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Nie(l,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(aO(l,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===Lp&&c===nJt)return this.consumeCodePoint(),this.consumeCodePoint(),_Jt;break;case wk:if(Nie(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Obe:if(this.peekCodePoint(0)===Wie)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Wie&&(u=this.consumeCodePoint(),u===Obe))return this.consumeToken();if(u===X5)return this.consumeToken()}break;case fJt:return GJt;case hJt:return XJt;case tJt:if(this.peekCodePoint(0)===eJt&&this.peekCodePoint(1)===Lp&&this.peekCodePoint(2)===Lp)return this.consumeCodePoint(),this.consumeCodePoint(),VJt;break;case oJt:var d=this.peekCodePoint(0),f=this.peekCodePoint(1),p=this.peekCodePoint(2);if(aO(d,f,p)){var a=this.consumeName();return{type:7,value:a}}break;case rJt:return JJt;case IE:if($4(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case iJt:return KJt;case aJt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),LJt;break;case lJt:return jJt;case sJt:return BJt;case xJt:case SJt:var g=this.peekCodePoint(0),A=this.peekCodePoint(1);return g===Gv&&(VT(A)||A===rO)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vbe:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),NJt;if(this.peekCodePoint(0)===Vbe)return this.consumeCodePoint(),WJt;break;case cJt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),UJt;break;case X5:return Kue}return iO(e)?(this.consumeWhiteSpace(),qJt):eh(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):eX(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:D0(e)}},t.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},t.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},t.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},t.prototype.consumeUnicodeRangeToken=function(){for(var e=[],n=this.consumeCodePoint();VT(n)&&e.length<6;)e.push(n),n=this.consumeCodePoint();for(var o=!1;n===rO&&e.length<6;)e.push(n),n=this.consumeCodePoint(),o=!0;if(o){var r=parseInt(D0.apply(void 0,e.map(function(s){return s===rO?pqe:s})),16),i=parseInt(D0.apply(void 0,e.map(function(s){return s===rO?wqe:s})),16);return{type:30,start:r,end:i}}var a=parseInt(D0.apply(void 0,e),16);if(this.peekCodePoint(0)===Lp&&VT(this.peekCodePoint(1))){this.consumeCodePoint(),n=this.consumeCodePoint();for(var l=[];VT(n)&&l.length<6;)l.push(n),n=this.consumeCodePoint();var i=parseInt(D0.apply(void 0,l),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},t.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===oO?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===oO?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},t.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===X5)return{type:22,value:""};var n=this.peekCodePoint(0);if(n===nO||n===tO){var o=this.consumeStringToken(this.consumeCodePoint());return o.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===X5||this.peekCodePoint(0)===_z)?(this.consumeCodePoint(),{type:22,value:o.value}):(this.consumeBadUrlRemnants(),lO)}for(;;){var r=this.consumeCodePoint();if(r===X5||r===_z)return{type:22,value:D0.apply(void 0,e)};if(iO(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===X5||this.peekCodePoint(0)===_z?(this.consumeCodePoint(),{type:22,value:D0.apply(void 0,e)}):(this.consumeBadUrlRemnants(),lO);if(r===tO||r===nO||r===oO||IJt(r))return this.consumeBadUrlRemnants(),lO;if(r===IE)if($4(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),lO;else e.push(r)}},t.prototype.consumeWhiteSpace=function(){for(;iO(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===_z||e===X5)return;$4(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(e){for(var n=5e4,o="";e>0;){var r=Math.min(n,e);o+=D0.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),o},t.prototype.consumeStringToken=function(e){var n="",o=0;do{var r=this._value[o];if(r===X5||r===void 0||r===e)return n+=this.consumeStringSlice(o),{type:0,value:n};if(r===ZG)return this._value.splice(0,o),OJt;if(r===IE){var i=this._value[o+1];i!==X5&&i!==void 0&&(i===ZG?(n+=this.consumeStringSlice(o),o=-1,this._value.shift()):$4(r,i)&&(n+=this.consumeStringSlice(o),n+=D0(this.consumeEscapedCodePoint()),o=-1))}o++}while(!0)},t.prototype.consumeNumber=function(){var e=[],n=aN,o=this.peekCodePoint(0);for((o===Gv||o===Lp)&&e.push(this.consumeCodePoint());eh(this.peekCodePoint(0));)e.push(this.consumeCodePoint());o=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(o===wk&&eh(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Ybe;eh(this.peekCodePoint(0));)e.push(this.consumeCodePoint());o=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((o===Aqe||o===mqe)&&((r===Gv||r===Lp)&&eh(i)||eh(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Ybe;eh(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[zJt(e),n]},t.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),n=e[0],o=e[1],r=this.peekCodePoint(0),i=this.peekCodePoint(1),a=this.peekCodePoint(2);if(aO(r,i,a)){var l=this.consumeName();return{type:15,number:n,flags:o,unit:l}}return r===QXt?(this.consumeCodePoint(),{type:16,number:n,flags:o}):{type:17,number:n,flags:o}},t.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(VT(e)){for(var n=D0(e);VT(this.peekCodePoint(0))&&n.length<6;)n+=D0(this.consumeCodePoint());iO(this.peekCodePoint(0))&&this.consumeCodePoint();var o=parseInt(n,16);return o===0||PJt(o)||o>1114111?_be:o}return e===X5?_be:e},t.prototype.consumeName=function(){for(var e="";;){var n=this.consumeCodePoint();if(Gbe(n))e+=D0(n);else if($4(n,this.peekCodePoint(0)))e+=D0(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(n),e}},t}(),xqe=function(){function t(e){this._tokens=e}return t.create=function(e){var n=new vqe;return n.write(e),new t(n.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var n=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return n;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var e=[];;){var n=this.consumeComponentValue();if(n.type===32)return e;e.push(n),e.push()}},t.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},t.prototype.consumeSimpleBlock=function(e){for(var n={type:e,values:[]},o=this.consumeToken();;){if(o.type===32||QJt(o,e))return n;this.reconsumeToken(o),n.values.push(this.consumeComponentValue()),o=this.consumeToken()}},t.prototype.consumeFunction=function(e){for(var n={name:e.value,values:[],type:18};;){var o=this.consumeToken();if(o.type===32||o.type===3)return n;this.reconsumeToken(o),n.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Kue:e},t.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},t}(),lN=function(t){return t.type===15},QH=function(t){return t.type===17},Ss=function(t){return t.type===20},$Jt=function(t){return t.type===0},que=function(t,e){return Ss(t)&&t.value===e},bqe=function(t){return t.type!==31},TR=function(t){return t.type!==31&&t.type!==4},m3=function(t){var e=[],n=[];return t.forEach(function(o){if(o.type===4){if(n.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(n),n=[];return}o.type!==31&&n.push(o)}),n.length&&e.push(n),e},QJt=function(t,e){return e===11&&t.type===12||e===28&&t.type===29?!0:e===2&&t.type===3},gw=function(t){return t.type===17||t.type===15},iu=function(t){return t.type===16||gw(t)},Sqe=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},uf={type:17,number:0,flags:aN},Eye={type:16,number:50,flags:aN},T8={type:16,number:100,flags:aN},jD=function(t,e,n){var o=t[0],r=t[1];return[Xs(o,e),Xs(typeof r<"u"?r:o,n)]},Xs=function(t,e){if(t.type===16)return t.number/100*e;if(lN(t))switch(t.unit){case"rem":case"em":return 16*t.number;case"px":default:return t.number}return t.number},Tqe="deg",Pqe="grad",Cqe="rad",Rqe="turn",TQ={name:"angle",parse:function(t,e){if(e.type===15)switch(e.unit){case Tqe:return Math.PI*e.number/180;case Pqe:return Math.PI/200*e.number;case Cqe:return e.number;case Rqe:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Hqe=function(t){return t.type===15&&(t.unit===Tqe||t.unit===Pqe||t.unit===Cqe||t.unit===Rqe)},Mqe=function(t){var e=t.filter(Ss).map(function(n){return n.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[uf,uf];case"to top":case"bottom":return Um(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[uf,T8];case"to right":case"left":return Um(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[T8,T8];case"to bottom":case"top":return Um(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[T8,uf];case"to left":case"right":return Um(270)}return 0},Um=function(t){return Math.PI*t/180},_8={name:"color",parse:function(t,e){if(e.type===18){var n=ZJt[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return n(t,e.values)}if(e.type===5){if(e.value.length===3){var o=e.value.substring(0,1),r=e.value.substring(1,2),i=e.value.substring(2,3);return P8(parseInt(o+o,16),parseInt(r+r,16),parseInt(i+i,16),1)}if(e.value.length===4){var o=e.value.substring(0,1),r=e.value.substring(1,2),i=e.value.substring(2,3),a=e.value.substring(3,4);return P8(parseInt(o+o,16),parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16)/255)}if(e.value.length===6){var o=e.value.substring(0,2),r=e.value.substring(2,4),i=e.value.substring(4,6);return P8(parseInt(o,16),parseInt(r,16),parseInt(i,16),1)}if(e.value.length===8){var o=e.value.substring(0,2),r=e.value.substring(2,4),i=e.value.substring(4,6),a=e.value.substring(6,8);return P8(parseInt(o,16),parseInt(r,16),parseInt(i,16),parseInt(a,16)/255)}}if(e.type===20){var l=W6[e.value.toUpperCase()];if(typeof l<"u")return l}return W6.TRANSPARENT}},G8=function(t){return(255&t)===0},hd=function(t){var e=255&t,n=255&t>>8,o=255&t>>16,r=255&t>>24;return e<255?"rgba("+r+","+o+","+n+","+e/255+")":"rgb("+r+","+o+","+n+")"},P8=function(t,e,n,o){return(t<<24|e<<16|n<<8|Math.round(o*255)<<0)>>>0},Xbe=function(t,e){if(t.type===17)return t.number;if(t.type===16){var n=e===3?1:255;return e===3?t.number/100*n:Math.round(t.number/100*n)}return 0},Jbe=function(t,e){var n=e.filter(TR);if(n.length===3){var o=n.map(Xbe),r=o[0],i=o[1],a=o[2];return P8(r,i,a,1)}if(n.length===4){var l=n.map(Xbe),r=l[0],i=l[1],a=l[2],s=l[3];return P8(r,i,a,s)}return 0};function Uie(t,e,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(e-t)*n*6+t:n<1/2?e:n<2/3?(e-t)*6*(2/3-n)+t:t}var Kbe=function(t,e){var n=e.filter(TR),o=n[0],r=n[1],i=n[2],a=n[3],l=(o.type===17?Um(o.number):TQ.parse(t,o))/(Math.PI*2),s=iu(r)?r.number/100:0,c=iu(i)?i.number/100:0,u=typeof a<"u"&&iu(a)?Xs(a,1):1;if(s===0)return P8(c*255,c*255,c*255,1);var d=c<=.5?c*(s+1):c+s-c*s,f=c*2-d,p=Uie(f,d,l+1/3),g=Uie(f,d,l),A=Uie(f,d,l-1/3);return P8(p*255,g*255,A*255,u)},ZJt={hsl:Kbe,hsla:Kbe,rgb:Jbe,rgba:Jbe},zE=function(t,e){return _8.parse(t,xqe.create(e).parseComponentValue())},W6={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},eKt={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Ss(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},tKt={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},PQ=function(t,e){var n=_8.parse(t,e[0]),o=e[1];return o&&iu(o)?{color:n,stop:o}:{color:n,stop:null}},qbe=function(t,e){var n=t[0],o=t[t.length-1];n.stop===null&&(n.stop=uf),o.stop===null&&(o.stop=T8);for(var r=[],i=0,a=0;ai?r.push(s):r.push(i),i=s}else r.push(null)}for(var c=null,a=0;aa.optimumDistance)?{optimumCorner:l,optimumDistance:u}:a},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},rKt=function(t,e,n,o,r){var i=0,a=0;switch(t.size){case 0:t.shape===0?i=a=Math.min(Math.abs(e),Math.abs(e-o),Math.abs(n),Math.abs(n-r)):t.shape===1&&(i=Math.min(Math.abs(e),Math.abs(e-o)),a=Math.min(Math.abs(n),Math.abs(n-r)));break;case 2:if(t.shape===0)i=a=Math.min(Zy(e,n),Zy(e,n-r),Zy(e-o,n),Zy(e-o,n-r));else if(t.shape===1){var l=Math.min(Math.abs(n),Math.abs(n-r))/Math.min(Math.abs(e),Math.abs(e-o)),s=$be(o,r,e,n,!0),c=s[0],u=s[1];i=Zy(c-e,(u-n)/l),a=l*i}break;case 1:t.shape===0?i=a=Math.max(Math.abs(e),Math.abs(e-o),Math.abs(n),Math.abs(n-r)):t.shape===1&&(i=Math.max(Math.abs(e),Math.abs(e-o)),a=Math.max(Math.abs(n),Math.abs(n-r)));break;case 3:if(t.shape===0)i=a=Math.max(Zy(e,n),Zy(e,n-r),Zy(e-o,n),Zy(e-o,n-r));else if(t.shape===1){var l=Math.max(Math.abs(n),Math.abs(n-r))/Math.max(Math.abs(e),Math.abs(e-o)),d=$be(o,r,e,n,!1),c=d[0],u=d[1];i=Zy(c-e,(u-n)/l),a=l*i}break}return Array.isArray(t.size)&&(i=Xs(t.size[0],o),a=t.size.length===2?Xs(t.size[1],r):i),[i,a]},iKt=function(t,e){var n=Um(180),o=[];return m3(e).forEach(function(r,i){if(i===0){var a=r[0];if(a.type===20&&a.value==="to"){n=Mqe(r);return}else if(Hqe(a)){n=TQ.parse(t,a);return}}var l=PQ(t,r);o.push(l)}),{angle:n,stops:o,type:1}},sO=function(t,e){var n=Um(180),o=[];return m3(e).forEach(function(r,i){if(i===0){var a=r[0];if(a.type===20&&["top","left","right","bottom"].indexOf(a.value)!==-1){n=Mqe(r);return}else if(Hqe(a)){n=(TQ.parse(t,a)+Um(270))%Um(360);return}}var l=PQ(t,r);o.push(l)}),{angle:n,stops:o,type:1}},aKt=function(t,e){var n=Um(180),o=[],r=1,i=0,a=3,l=[];return m3(e).forEach(function(s,c){var u=s[0];if(c===0){if(Ss(u)&&u.value==="linear"){r=1;return}else if(Ss(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var d=_8.parse(t,u.values[0]);o.push({stop:uf,color:d})}else if(u.name==="to"){var d=_8.parse(t,u.values[0]);o.push({stop:T8,color:d})}else if(u.name==="color-stop"){var f=u.values.filter(TR);if(f.length===2){var d=_8.parse(t,f[1]),p=f[0];QH(p)&&o.push({stop:{type:16,number:p.number*100,flags:p.flags},color:d})}}}}),r===1?{angle:(n+Um(180))%Um(360),stops:o,type:r}:{size:a,shape:i,stops:o,position:l,type:r}},Iqe="closest-side",zqe="farthest-side",Dqe="closest-corner",Eqe="farthest-corner",Fqe="circle",kqe="ellipse",Lqe="cover",Wqe="contain",lKt=function(t,e){var n=0,o=3,r=[],i=[];return m3(e).forEach(function(a,l){var s=!0;if(l===0){var c=!1;s=a.reduce(function(d,f){if(c)if(Ss(f))switch(f.value){case"center":return i.push(Eye),d;case"top":case"left":return i.push(uf),d;case"right":case"bottom":return i.push(T8),d}else(iu(f)||gw(f))&&i.push(f);else if(Ss(f))switch(f.value){case Fqe:return n=0,!1;case kqe:return n=1,!1;case"at":return c=!0,!1;case Iqe:return o=0,!1;case Lqe:case zqe:return o=1,!1;case Wqe:case Dqe:return o=2,!1;case Eqe:return o=3,!1}else if(gw(f)||iu(f))return Array.isArray(o)||(o=[]),o.push(f),!1;return d},s)}if(s){var u=PQ(t,a);r.push(u)}}),{size:o,shape:n,stops:r,position:i,type:2}},cO=function(t,e){var n=0,o=3,r=[],i=[];return m3(e).forEach(function(a,l){var s=!0;if(l===0?s=a.reduce(function(u,d){if(Ss(d))switch(d.value){case"center":return i.push(Eye),!1;case"top":case"left":return i.push(uf),!1;case"right":case"bottom":return i.push(T8),!1}else if(iu(d)||gw(d))return i.push(d),!1;return u},s):l===1&&(s=a.reduce(function(u,d){if(Ss(d))switch(d.value){case Fqe:return n=0,!1;case kqe:return n=1,!1;case Wqe:case Iqe:return o=0,!1;case zqe:return o=1,!1;case Dqe:return o=2,!1;case Lqe:case Eqe:return o=3,!1}else if(gw(d)||iu(d))return Array.isArray(o)||(o=[]),o.push(d),!1;return u},s)),s){var c=PQ(t,a);r.push(c)}}),{size:o,shape:n,stops:r,position:i,type:2}},sKt=function(t){return t.type===1},cKt=function(t){return t.type===2},Fye={name:"image",parse:function(t,e){if(e.type===22){var n={url:e.value,type:0};return t.cache.addImage(e.value),n}if(e.type===18){var o=Nqe[e.name];if(typeof o>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return o(t,e.values)}throw new Error("Unsupported image type "+e.type)}};function uKt(t){return!(t.type===20&&t.value==="none")&&(t.type!==18||!!Nqe[t.name])}var Nqe={"linear-gradient":iKt,"-moz-linear-gradient":sO,"-ms-linear-gradient":sO,"-o-linear-gradient":sO,"-webkit-linear-gradient":sO,"radial-gradient":lKt,"-moz-radial-gradient":cO,"-ms-radial-gradient":cO,"-o-radial-gradient":cO,"-webkit-radial-gradient":cO,"-webkit-gradient":aKt},dKt={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e.filter(function(o){return TR(o)&&uKt(o)}).map(function(o){return Fye.parse(t,o)})}},fKt={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Ss(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},hKt={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return m3(e).map(function(n){return n.filter(iu)}).map(Sqe)}},pKt={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return m3(e).map(function(n){return n.filter(Ss).map(function(o){return o.value}).join(" ")}).map(gKt)}},gKt=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},EC;(function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"})(EC||(EC={}));var mKt={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return m3(e).map(function(n){return n.filter(yKt)})}},yKt=function(t){return Ss(t)||iu(t)},CQ=function(t){return{name:"border-"+t+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},AKt=CQ("top"),wKt=CQ("right"),vKt=CQ("bottom"),xKt=CQ("left"),RQ=function(t){return{name:"border-radius-"+t,initialValue:"0 0",prefix:!1,type:1,parse:function(e,n){return Sqe(n.filter(iu))}}},bKt=RQ("top-left"),SKt=RQ("top-right"),TKt=RQ("bottom-right"),PKt=RQ("bottom-left"),HQ=function(t){return{name:"border-"+t+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,n){switch(n){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},CKt=HQ("top"),RKt=HQ("right"),HKt=HQ("bottom"),MKt=HQ("left"),MQ=function(t){return{name:"border-"+t+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,n){return lN(n)?n.number:0}}},IKt=MQ("top"),zKt=MQ("right"),DKt=MQ("bottom"),EKt=MQ("left"),FKt={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},kKt={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},LKt={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).reduce(function(n,o){return n|WKt(o.value)},0)}},WKt=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},NKt={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},UKt={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},tX;(function(t){t.NORMAL="normal",t.STRICT="strict"})(tX||(tX={}));var jKt={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"strict":return tX.STRICT;case"normal":default:return tX.NORMAL}}},BKt={name:"line-height",initialValue:"normal",prefix:!1,type:4},Qbe=function(t,e){return Ss(t)&&t.value==="normal"?1.2*e:t.type===17?e*t.number:iu(t)?Xs(t,e):e},YKt={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return e.type===20&&e.value==="none"?null:Fye.parse(t,e)}},OKt={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},$ue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},IQ=function(t){return{name:"margin-"+t,initialValue:"0",prefix:!1,type:4}},VKt=IQ("top"),_Kt=IQ("right"),GKt=IQ("bottom"),XKt=IQ("left"),JKt={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).map(function(n){switch(n.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},KKt={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},zQ=function(t){return{name:"padding-"+t,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},qKt=zQ("top"),$Kt=zQ("right"),QKt=zQ("bottom"),ZKt=zQ("left"),eqt={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},tqt={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},nqt={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&que(e[0],"none")?[]:m3(e).map(function(n){for(var o={color:W6.TRANSPARENT,offsetX:uf,offsetY:uf,blur:uf},r=0,i=0;i"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return n(e.values)}return null}},iqt=function(t){var e=t.filter(function(n){return n.type===17}).map(function(n){return n.number});return e.length===6?e:null},aqt=function(t){var e=t.filter(function(s){return s.type===17}).map(function(s){return s.number}),n=e[0],o=e[1];e[2],e[3];var r=e[4],i=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var a=e[12],l=e[13];return e[14],e[15],e.length===16?[n,o,r,i,a,l]:null},lqt={matrix:iqt,matrix3d:aqt},Zbe={type:16,number:50,flags:aN},sqt=[Zbe,Zbe],cqt={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var n=e.filter(iu);return n.length!==2?sqt:[n[0],n[1]]}},uqt={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},DE;(function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"})(DE||(DE={}));var dqt={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return DE.BREAK_ALL;case"keep-all":return DE.KEEP_ALL;case"normal":default:return DE.NORMAL}}},fqt={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(e.type===20)return{auto:!0,order:0};if(QH(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Uqe={name:"time",parse:function(t,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},hqt={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return QH(e)?e.number:1}},pqt={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},gqt={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).map(function(n){switch(n.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(n){return n!==0})}},mqt={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var n=[],o=[];return e.forEach(function(r){switch(r.type){case 20:case 0:n.push(r.value);break;case 17:n.push(r.number.toString());break;case 4:o.push(n.join(" ")),n.length=0;break}}),n.length&&o.push(n.join(" ")),o.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},yqt={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Aqt={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){if(QH(e))return e.number;if(Ss(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},wqt={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(Ss).map(function(n){return n.value})}},vqt={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Du=function(t,e){return(t&e)!==0},xqt={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e}},bqt={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var n=e[0];if(n.type===20&&n.value==="none")return null;for(var o=[],r=e.filter(bqe),i=0;i1?1:0],this.overflowWrap=kr(e,KKt,n.overflowWrap),this.paddingTop=kr(e,qKt,n.paddingTop),this.paddingRight=kr(e,$Kt,n.paddingRight),this.paddingBottom=kr(e,QKt,n.paddingBottom),this.paddingLeft=kr(e,ZKt,n.paddingLeft),this.paintOrder=kr(e,Rqt,n.paintOrder),this.position=kr(e,tqt,n.position),this.textAlign=kr(e,eqt,n.textAlign),this.textDecorationColor=kr(e,pqt,(o=n.textDecorationColor)!==null&&o!==void 0?o:n.color),this.textDecorationLine=kr(e,gqt,(r=n.textDecorationLine)!==null&&r!==void 0?r:n.textDecoration),this.textShadow=kr(e,nqt,n.textShadow),this.textTransform=kr(e,oqt,n.textTransform),this.transform=kr(e,rqt,n.transform),this.transformOrigin=kr(e,cqt,n.transformOrigin),this.visibility=kr(e,uqt,n.visibility),this.webkitTextStrokeColor=kr(e,Hqt,n.webkitTextStrokeColor),this.webkitTextStrokeWidth=kr(e,Mqt,n.webkitTextStrokeWidth),this.wordBreak=kr(e,dqt,n.wordBreak),this.zIndex=kr(e,fqt,n.zIndex)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},t.prototype.isTransparent=function(){return G8(this.backgroundColor)},t.prototype.isTransformed=function(){return this.transform!==null},t.prototype.isPositioned=function(){return this.position!==0},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==0},t.prototype.isInlineLevel=function(){return Du(this.display,4)||Du(this.display,33554432)||Du(this.display,268435456)||Du(this.display,536870912)||Du(this.display,67108864)||Du(this.display,134217728)},t}(),zqt=function(){function t(e,n){this.content=kr(e,xqt,n.content),this.quotes=kr(e,Pqt,n.quotes)}return t}(),tSe=function(){function t(e,n){this.counterIncrement=kr(e,bqt,n.counterIncrement),this.counterReset=kr(e,Sqt,n.counterReset)}return t}(),kr=function(t,e,n){var o=new vqe,r=n!==null&&typeof n<"u"?n.toString():e.initialValue;o.write(r);var i=new xqe(o.read());switch(e.type){case 2:var a=i.parseComponentValue();return e.parse(t,Ss(a)?a.value:e.initialValue);case 0:return e.parse(t,i.parseComponentValue());case 1:return e.parse(t,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(e.format){case"angle":return TQ.parse(t,i.parseComponentValue());case"color":return _8.parse(t,i.parseComponentValue());case"image":return Fye.parse(t,i.parseComponentValue());case"length":var l=i.parseComponentValue();return gw(l)?l:uf;case"length-percentage":var s=i.parseComponentValue();return iu(s)?s:uf;case"time":return Uqe.parse(t,i.parseComponentValue())}break}},Dqt="data-html2canvas-debug",Eqt=function(t){var e=t.getAttribute(Dqt);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Que=function(t,e){var n=Eqt(t);return n===1||e===n},y3=function(){function t(e,n){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Que(n,3))debugger;this.styles=new Iqt(e,window.getComputedStyle(n,null)),tde(n)&&(this.styles.animationDuration.some(function(o){return o>0})&&(n.style.animationDuration="0s"),this.styles.transform!==null&&(n.style.transform="none")),this.bounds=bQ(this.context,n),Que(n,4)&&(this.flags|=16)}return t}(),Fqt="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",nSe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BD=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var uO=0;uO>4,u[r++]=(a&15)<<4|l>>2,u[r++]=(l&3)<<6|s&63;return c},Lqt=function(t){for(var e=t.length,n=[],o=0;o>Tx,Uqt=1<>Tx,Bqt=jqe+jqt,Yqt=Bqt,Oqt=32,Vqt=Yqt+Oqt,_qt=65536>>kye,Gqt=1<=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>Tx],n=(n<>Tx)],n=(n<>kye),n=this.index[n],n+=e>>Tx&Xqt,n=this.index[n],n=(n<"u"?[]:new Uint8Array(256);for(var dO=0;dO=55296&&r<=56319&&n>10)+55296,a%1024+56320)),(r+1===n||o.length>16384)&&(i+=String.fromCharCode.apply(String,o),o.length=0)}return i},n$t=Kqt(Fqt),Sm="×",Xie="÷",o$t=function(t){return n$t.get(t)},r$t=function(t,e,n){var o=n-2,r=e[o],i=e[n-1],a=e[n];if(i===Yie&&a===Oie)return Sm;if(i===Yie||i===Oie||i===iSe||a===Yie||a===Oie||a===iSe)return Xie;if(i===lSe&&[lSe,Vie,sSe,cSe].indexOf(a)!==-1||(i===sSe||i===Vie)&&(a===Vie||a===_ie)||(i===cSe||i===_ie)&&a===_ie||a===uSe||a===aSe||a===Zqt||i===Qqt)return Sm;if(i===uSe&&a===dSe){for(;r===aSe;)r=e[--o];if(r===dSe)return Sm}if(i===Gie&&a===Gie){for(var l=0;r===Gie;)l++,r=e[--o];if(l%2===0)return Sm}return Xie},i$t=function(t){var e=e$t(t),n=e.length,o=0,r=0,i=e.map(o$t);return{next:function(){if(o>=n)return{done:!0,value:null};for(var a=Sm;oa.x||u.y>a.y;return a=u,c===0?!0:d});return t.body.removeChild(e),l},c$t=function(){return typeof new Image().crossOrigin<"u"},u$t=function(){return typeof new XMLHttpRequest().responseType=="string"},d$t=function(t){var e=new Image,n=t.createElement("canvas"),o=n.getContext("2d");if(!o)return!1;e.src="data:image/svg+xml,";try{o.drawImage(e,0,0),n.toDataURL()}catch{return!1}return!0},fSe=function(t){return t[0]===0&&t[1]===255&&t[2]===0&&t[3]===255},f$t=function(t){var e=t.createElement("canvas"),n=100;e.width=n,e.height=n;var o=e.getContext("2d");if(!o)return Promise.reject(!1);o.fillStyle="rgb(0, 255, 0)",o.fillRect(0,0,n,n);var r=new Image,i=e.toDataURL();r.src=i;var a=Zue(n,n,0,0,r);return o.fillStyle="red",o.fillRect(0,0,n,n),hSe(a).then(function(l){o.drawImage(l,0,0);var s=o.getImageData(0,0,n,n).data;o.fillStyle="red",o.fillRect(0,0,n,n);var c=t.createElement("div");return c.style.backgroundImage="url("+i+")",c.style.height=n+"px",fSe(s)?hSe(Zue(n,n,0,0,c)):Promise.reject(!1)}).then(function(l){return o.drawImage(l,0,0),fSe(o.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Zue=function(t,e,n,o,r){var i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"svg"),l=document.createElementNS(i,"foreignObject");return a.setAttributeNS(null,"width",t.toString()),a.setAttributeNS(null,"height",e.toString()),l.setAttributeNS(null,"width","100%"),l.setAttributeNS(null,"height","100%"),l.setAttributeNS(null,"x",n.toString()),l.setAttributeNS(null,"y",o.toString()),l.setAttributeNS(null,"externalResourcesRequired","true"),a.appendChild(l),l.appendChild(r),a},hSe=function(t){return new Promise(function(e,n){var o=new Image;o.onload=function(){return e(o)},o.onerror=n,o.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},af={get SUPPORT_RANGE_BOUNDS(){var t=l$t(document);return Object.defineProperty(af,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=af.SUPPORT_RANGE_BOUNDS&&s$t(document);return Object.defineProperty(af,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=d$t(document);return Object.defineProperty(af,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t=typeof Array.from=="function"&&typeof window.fetch=="function"?f$t(document):Promise.resolve(!1);return Object.defineProperty(af,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=c$t();return Object.defineProperty(af,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t=u$t();return Object.defineProperty(af,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(af,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(af,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},EE=function(){function t(e,n){this.text=e,this.bounds=n}return t}(),h$t=function(t,e,n,o){var r=m$t(e,n),i=[],a=0;return r.forEach(function(l){if(n.textDecorationLine.length||l.trim().length>0)if(af.SUPPORT_RANGE_BOUNDS){var s=pSe(o,a,l.length).getClientRects();if(s.length>1){var c=Lye(l),u=0;c.forEach(function(f){i.push(new EE(f,lA.fromDOMRectList(t,pSe(o,u+a,f.length).getClientRects()))),u+=f.length})}else i.push(new EE(l,lA.fromDOMRectList(t,s)))}else{var d=o.splitText(l.length);i.push(new EE(l,p$t(t,o))),o=d}else af.SUPPORT_RANGE_BOUNDS||(o=o.splitText(l.length));a+=l.length}),i},p$t=function(t,e){var n=e.ownerDocument;if(n){var o=n.createElement("html2canvaswrapper");o.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(o,e);var i=bQ(t,o);return o.firstChild&&r.replaceChild(o.firstChild,o),i}}return lA.EMPTY},pSe=function(t,e,n){var o=t.ownerDocument;if(!o)throw new Error("Node has no owner document");var r=o.createRange();return r.setStart(t,e),r.setEnd(t,e+n),r},Lye=function(t){if(af.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(n){return n.segment})}return a$t(t)},g$t=function(t,e){if(af.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(t)).map(function(o){return o.segment})}return A$t(t,e)},m$t=function(t,e){return e.letterSpacing!==0?Lye(t):g$t(t,e)},y$t=[32,160,4961,65792,65793,4153,4241],A$t=function(t,e){for(var n=_Xt(t,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),o=[],r,i=function(){if(r.value){var a=r.value.slice(),l=SQ(a),s="";l.forEach(function(c){y$t.indexOf(c)===-1?s+=D0(c):(s.length&&o.push(s),o.push(D0(c)),s="")}),s.length&&o.push(s)}};!(r=n.next()).done;)i();return o},w$t=function(){function t(e,n,o){this.text=v$t(n.data,o.textTransform),this.textBounds=h$t(e,this.text,o,n)}return t}(),v$t=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(x$t,b$t);case 2:return t.toUpperCase();default:return t}},x$t=/(^|\s|:|-|\(|\))([a-z])/g,b$t=function(t,e,n){return t.length>0?e+n.toUpperCase():t},Bqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.src=o.currentSrc||o.src,r.intrinsicWidth=o.naturalWidth,r.intrinsicHeight=o.naturalHeight,r.context.cache.addImage(r.src),r}return e}(y3),Yqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.canvas=o,r.intrinsicWidth=o.width,r.intrinsicHeight=o.height,r}return e}(y3),Oqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this,i=new XMLSerializer,a=bQ(n,o);return o.setAttribute("width",a.width+"px"),o.setAttribute("height",a.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(o)),r.intrinsicWidth=o.width.baseVal.value,r.intrinsicHeight=o.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e}(y3),Vqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.value=o.value,r}return e}(y3),ede=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.start=o.start,r.reversed=typeof o.reversed=="boolean"&&o.reversed===!0,r}return e}(y3),S$t=[{type:15,flags:0,unit:"px",number:3}],T$t=[{type:16,flags:0,number:50}],P$t=function(t){return t.width>t.height?new lA(t.left+(t.width-t.height)/2,t.top,t.height,t.height):t.width0)n.textNodes.push(new w$t(t,r,n.styles));else if(iC(r))if(e$e(r)&&r.assignedNodes)r.assignedNodes().forEach(function(l){return r_(t,l,n,o)});else{var a=Jqe(t,r);a.styles.isVisible()&&(M$t(r,a,o)?a.flags|=4:I$t(a.styles)&&(a.flags|=2),H$t.indexOf(r.tagName)!==-1&&(a.flags|=8),n.elements.push(a),r.slot,r.shadowRoot?r_(t,r.shadowRoot,a,o):!rX(r)&&!$qe(r)&&!iX(r)&&r_(t,r,a,o))}},Jqe=function(t,e){return nde(e)?new Bqe(t,e):Qqe(e)?new Yqe(t,e):$qe(e)?new Oqe(t,e):z$t(e)?new Vqe(t,e):D$t(e)?new ede(t,e):E$t(e)?new Wye(t,e):iX(e)?new _qe(t,e):rX(e)?new Gqe(t,e):Zqe(e)?new Xqe(t,e):new y3(t,e)},Kqe=function(t,e){var n=Jqe(t,e);return n.flags|=4,r_(t,e,n,n),n},M$t=function(t,e,n){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Nye(t)&&n.styles.isTransparent()},I$t=function(t){return t.isPositioned()||t.isFloating()},qqe=function(t){return t.nodeType===Node.TEXT_NODE},iC=function(t){return t.nodeType===Node.ELEMENT_NODE},tde=function(t){return iC(t)&&typeof t.style<"u"&&!i_(t)},i_=function(t){return typeof t.className=="object"},z$t=function(t){return t.tagName==="LI"},D$t=function(t){return t.tagName==="OL"},E$t=function(t){return t.tagName==="INPUT"},F$t=function(t){return t.tagName==="HTML"},$qe=function(t){return t.tagName==="svg"},Nye=function(t){return t.tagName==="BODY"},Qqe=function(t){return t.tagName==="CANVAS"},mSe=function(t){return t.tagName==="VIDEO"},nde=function(t){return t.tagName==="IMG"},Zqe=function(t){return t.tagName==="IFRAME"},ySe=function(t){return t.tagName==="STYLE"},k$t=function(t){return t.tagName==="SCRIPT"},rX=function(t){return t.tagName==="TEXTAREA"},iX=function(t){return t.tagName==="SELECT"},e$e=function(t){return t.tagName==="SLOT"},ASe=function(t){return t.tagName.indexOf("-")>0},L$t=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(e){var n=this.counters[e];return n&&n.length?n[n.length-1]:1},t.prototype.getCounterValues=function(e){var n=this.counters[e];return n||[]},t.prototype.pop=function(e){var n=this;e.forEach(function(o){return n.counters[o].pop()})},t.prototype.parse=function(e){var n=this,o=e.counterIncrement,r=e.counterReset,i=!0;o!==null&&o.forEach(function(l){var s=n.counters[l.counter];s&&l.increment!==0&&(i=!1,s.length||s.push(1),s[Math.max(0,s.length-1)]+=l.increment)});var a=[];return i&&r.forEach(function(l){var s=n.counters[l.counter];a.push(l.counter),s||(s=n.counters[l.counter]=[]),s.push(l.reset)}),a},t}(),wSe={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},vSe={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},W$t={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},N$t={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},_T=function(t,e,n,o,r,i){return tn?vk(t,r,i.length>0):o.integers.reduce(function(a,l,s){for(;t>=l;)t-=l,a+=o.values[s];return a},"")+i},t$e=function(t,e,n,o){var r="";do n||t--,r=o(t)+r,t/=e;while(t*e>=e);return r},I0=function(t,e,n,o,r){var i=n-e+1;return(t<0?"-":"")+(t$e(Math.abs(t),i,o,function(a){return D0(Math.floor(a%i)+e)})+r)},$7=function(t,e,n){n===void 0&&(n=". ");var o=e.length;return t$e(Math.abs(t),o,!1,function(r){return e[Math.floor(r%o)]})+n},uP=1,U4=2,j4=4,YD=8,s6=function(t,e,n,o,r,i){if(t<-9999||t>9999)return vk(t,4,r.length>0);var a=Math.abs(t),l=r;if(a===0)return e[0]+l;for(var s=0;a>0&&s<=4;s++){var c=a%10;c===0&&Du(i,uP)&&l!==""?l=e[c]+l:c>1||c===1&&s===0||c===1&&s===1&&Du(i,U4)||c===1&&s===1&&Du(i,j4)&&t>100||c===1&&s>1&&Du(i,YD)?l=e[c]+(s>0?n[s-1]:"")+l:c===1&&s>0&&(l=n[s-1]+l),a=Math.floor(a/10)}return(t<0?o:"")+l},xSe="十百千萬",bSe="拾佰仟萬",SSe="マイナス",Jie="마이너스",vk=function(t,e,n){var o=n?". ":"",r=n?"、":"",i=n?", ":"",a=n?" ":"";switch(e){case 0:return"•"+a;case 1:return"◦"+a;case 2:return"◾"+a;case 5:var l=I0(t,48,57,!0,o);return l.length<4?"0"+l:l;case 4:return $7(t,"〇一二三四五六七八九",r);case 6:return _T(t,1,3999,wSe,3,o).toLowerCase();case 7:return _T(t,1,3999,wSe,3,o);case 8:return I0(t,945,969,!1,o);case 9:return I0(t,97,122,!1,o);case 10:return I0(t,65,90,!1,o);case 11:return I0(t,1632,1641,!0,o);case 12:case 49:return _T(t,1,9999,vSe,3,o);case 35:return _T(t,1,9999,vSe,3,o).toLowerCase();case 13:return I0(t,2534,2543,!0,o);case 14:case 30:return I0(t,6112,6121,!0,o);case 15:return $7(t,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return $7(t,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return s6(t,"零一二三四五六七八九",xSe,"負",r,U4|j4|YD);case 47:return s6(t,"零壹貳參肆伍陸柒捌玖",bSe,"負",r,uP|U4|j4|YD);case 42:return s6(t,"零一二三四五六七八九",xSe,"负",r,U4|j4|YD);case 41:return s6(t,"零壹贰叁肆伍陆柒捌玖",bSe,"负",r,uP|U4|j4|YD);case 26:return s6(t,"〇一二三四五六七八九","十百千万",SSe,r,0);case 25:return s6(t,"零壱弐参四伍六七八九","拾百千万",SSe,r,uP|U4|j4);case 31:return s6(t,"영일이삼사오육칠팔구","십백천만",Jie,i,uP|U4|j4);case 33:return s6(t,"零一二三四五六七八九","十百千萬",Jie,i,0);case 32:return s6(t,"零壹貳參四五六七八九","拾百千",Jie,i,uP|U4|j4);case 18:return I0(t,2406,2415,!0,o);case 20:return _T(t,1,19999,N$t,3,o);case 21:return I0(t,2790,2799,!0,o);case 22:return I0(t,2662,2671,!0,o);case 22:return _T(t,1,10999,W$t,3,o);case 23:return $7(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return $7(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return I0(t,3302,3311,!0,o);case 28:return $7(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return $7(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return I0(t,3792,3801,!0,o);case 37:return I0(t,6160,6169,!0,o);case 38:return I0(t,4160,4169,!0,o);case 39:return I0(t,2918,2927,!0,o);case 40:return I0(t,1776,1785,!0,o);case 43:return I0(t,3046,3055,!0,o);case 44:return I0(t,3174,3183,!0,o);case 45:return I0(t,3664,3673,!0,o);case 46:return I0(t,3872,3881,!0,o);case 3:default:return I0(t,48,57,!0,o)}},n$e="data-html2canvas-ignore",TSe=function(){function t(e,n,o){if(this.context=e,this.options=o,this.scrolledElements=[],this.referenceElement=n,this.counters=new L$t,this.quoteDepth=0,!n.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(n.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(e,n){var o=this,r=U$t(e,n);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var i=e.defaultView.pageXOffset,a=e.defaultView.pageYOffset,l=r.contentWindow,s=l.document,c=Y$t(r).then(function(){return Jh(o,void 0,void 0,function(){var u,d;return qf(this,function(f){switch(f.label){case 0:return this.scrolledElements.forEach(G$t),l&&(l.scrollTo(n.left,n.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(l.scrollY!==n.top||l.scrollX!==n.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-n.left,l.scrollY-n.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:s.fonts&&s.fonts.ready?[4,s.fonts.ready]:[3,2];case 1:f.sent(),f.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,B$t(s)]:[3,4];case 3:f.sent(),f.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(s,d)}).then(function(){return r})]:[2,r]}})})});return s.open(),s.write(V$t(document.doctype)+""),_$t(this.referenceElement.ownerDocument,i,a),s.replaceChild(s.adoptNode(this.documentElement),s.documentElement),s.close(),c},t.prototype.createElementClone=function(e){if(Que(e,2))debugger;if(Qqe(e))return this.createCanvasClone(e);if(mSe(e))return this.createVideoClone(e);if(ySe(e))return this.createStyleClone(e);var n=e.cloneNode(!1);return nde(n)&&(nde(e)&&e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc,n.srcset=""),n.loading==="lazy"&&(n.loading="eager")),ASe(n)?this.createCustomElementClone(n):n},t.prototype.createCustomElementClone=function(e){var n=document.createElement("html2canvascustomelement");return Kie(e.style,n),n},t.prototype.createStyleClone=function(e){try{var n=e.sheet;if(n&&n.cssRules){var o=[].slice.call(n.cssRules,0).reduce(function(i,a){return a&&typeof a.cssText=="string"?i+a.cssText:i},""),r=e.cloneNode(!1);return r.textContent=o,r}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return e.cloneNode(!1)},t.prototype.createCanvasClone=function(e){var n;if(this.options.inlineImages&&e.ownerDocument){var o=e.ownerDocument.createElement("img");try{return o.src=e.toDataURL(),o}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var i=e.getContext("2d"),a=r.getContext("2d");if(a)if(!this.options.allowTaint&&i)a.putImageData(i.getImageData(0,0,e.width,e.height),0,0);else{var l=(n=e.getContext("webgl2"))!==null&&n!==void 0?n:e.getContext("webgl");if(l){var s=l.getContextAttributes();(s==null?void 0:s.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}a.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},t.prototype.createVideoClone=function(e){var n=e.ownerDocument.createElement("canvas");n.width=e.offsetWidth,n.height=e.offsetHeight;var o=n.getContext("2d");try{return o&&(o.drawImage(e,0,0,n.width,n.height),this.options.allowTaint||o.getImageData(0,0,n.width,n.height)),n}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},t.prototype.appendChildNode=function(e,n,o){(!iC(n)||!k$t(n)&&!n.hasAttribute(n$e)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(n)))&&(!this.options.copyStyles||!iC(n)||!ySe(n))&&e.appendChild(this.cloneNode(n,o))},t.prototype.cloneChildNodes=function(e,n,o){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(iC(i)&&e$e(i)&&typeof i.assignedNodes=="function"){var a=i.assignedNodes();a.length&&a.forEach(function(l){return r.appendChildNode(n,l,o)})}else this.appendChildNode(n,i,o)},t.prototype.cloneNode=function(e,n){if(qqe(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var o=e.ownerDocument.defaultView;if(o&&iC(e)&&(tde(e)||i_(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var i=o.getComputedStyle(e),a=o.getComputedStyle(e,":before"),l=o.getComputedStyle(e,":after");this.referenceElement===e&&tde(r)&&(this.clonedReferenceElement=r),Nye(r)&&K$t(r);var s=this.counters.parse(new tSe(this.context,i)),c=this.resolvePseudoContent(e,r,a,FE.BEFORE);ASe(e)&&(n=!0),mSe(e)||this.cloneChildNodes(e,r,n),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,l,FE.AFTER);return u&&r.appendChild(u),this.counters.pop(s),(i&&(this.options.copyStyles||i_(e))&&!Zqe(e)||n)&&Kie(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(rX(e)||iX(e))&&(rX(r)||iX(r))&&(r.value=e.value),r}return e.cloneNode(!1)},t.prototype.resolvePseudoContent=function(e,n,o,r){var i=this;if(o){var a=o.content,l=n.ownerDocument;if(!(!l||!a||a==="none"||a==="-moz-alt-content"||o.display==="none")){this.counters.parse(new tSe(this.context,o));var s=new zqt(this.context,o),c=l.createElement("html2canvaspseudoelement");Kie(o,c),s.content.forEach(function(d){if(d.type===0)c.appendChild(l.createTextNode(d.value));else if(d.type===22){var f=l.createElement("img");f.src=d.value,f.style.opacity="1",c.appendChild(f)}else if(d.type===18){if(d.name==="attr"){var p=d.values.filter(Ss);p.length&&c.appendChild(l.createTextNode(e.getAttribute(p[0].value)||""))}else if(d.name==="counter"){var g=d.values.filter(TR),A=g[0],y=g[1];if(A&&Ss(A)){var S=i.counters.getCounterValue(A.value),C=y&&Ss(y)?$ue.parse(i.context,y.value):3;c.appendChild(l.createTextNode(vk(S,C,!1)))}}else if(d.name==="counters"){var P=d.values.filter(TR),A=P[0],v=P[1],y=P[2];if(A&&Ss(A)){var T=i.counters.getCounterValues(A.value),w=y&&Ss(y)?$ue.parse(i.context,y.value):3,x=v&&v.type===0?v.value:"",b=T.map(function(F){return vk(F,w,!1)}).join(x);c.appendChild(l.createTextNode(b))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(l.createTextNode(eSe(s.quotes,i.quoteDepth++,!0)));break;case"close-quote":c.appendChild(l.createTextNode(eSe(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(l.createTextNode(d.value))}}),c.className=ode+" "+rde;var u=r===FE.BEFORE?" "+ode:" "+rde;return i_(n)?n.className.baseValue+=u:n.className+=u,c}}},t.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},t}(),FE;(function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"})(FE||(FE={}));var U$t=function(t,e){var n=t.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=e.width.toString(),n.height=e.height.toString(),n.scrolling="no",n.setAttribute(n$e,"true"),t.body.appendChild(n),n},j$t=function(t){return new Promise(function(e){if(t.complete){e();return}if(!t.src){e();return}t.onload=e,t.onerror=e})},B$t=function(t){return Promise.all([].slice.call(t.images,0).map(j$t))},Y$t=function(t){return new Promise(function(e,n){var o=t.contentWindow;if(!o)return n("No window assigned for iframe");var r=o.document;o.onload=t.onload=function(){o.onload=t.onload=null;var i=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(i),e(t))},50)}})},O$t=["all","d","content"],Kie=function(t,e){for(var n=t.length-1;n>=0;n--){var o=t.item(n);O$t.indexOf(o)===-1&&e.style.setProperty(o,t.getPropertyValue(o))}return e},V$t=function(t){var e="";return t&&(e+=""),e},_$t=function(t,e,n){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||n!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,n)},G$t=function(t){var e=t[0],n=t[1],o=t[2];e.scrollLeft=n,e.scrollTop=o},X$t=":before",J$t=":after",ode="___html2canvas___pseudoelement_before",rde="___html2canvas___pseudoelement_after",PSe=`{ +***************************************************************************** */var Wue=function(t,e){return Wue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},Wue(t,e)};function i5(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Wue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Nue=function(){return Nue=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=55296&&r<=56319&&n>10)+55296,a%1024+56320)),(r+1===n||o.length>16384)&&(i+=String.fromCharCode.apply(String,o),o.length=0)}return i},Ibe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dXt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var JY=0;JY"u"?[]:new Uint8Array(256);for(var KY=0;KY>4,u[r++]=(a&15)<<4|l>>2,u[r++]=(l&3)<<6|s&63;return c},hXt=function(t){for(var e=t.length,n=[],o=0;o>Sx,mXt=1<>Sx,AXt=lqe+yXt,wXt=AXt,vXt=32,xXt=wXt+vXt,bXt=65536>>Dye,SXt=1<=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>Sx],n=(n<>Sx)],n=(n<>Dye),n=this.index[n],n+=e>>Sx&TXt,n=this.index[n],n=(n<"u"?[]:new Uint8Array(256);for(var qY=0;qYFbe?(r.push(!0),l-=Fbe):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return o.push(a),n.push(Bue);if(l===zXt||l===Uue){if(a===0)return o.push(a),n.push(Cv);var s=n[a-1];return UXt.indexOf(s)===-1?(o.push(o[a-1]),n.push(s)):(o.push(a),n.push(Cv))}if(o.push(a),l===LXt)return n.push(e==="strict"?Yue:Ak);if(l===dqe||l===kXt)return n.push(Cv);if(l===WXt)return i>=131072&&i<=196605||i>=196608&&i<=262141?n.push(Ak):n.push(Cv);n.push(l)}),[o,n,r]},Lie=function(t,e,n,o){var r=o[n];if(Array.isArray(t)?t.indexOf(r)!==-1:t===r)for(var i=n;i<=o.length;){i++;var a=o[i];if(a===e)return!0;if(a!==S8)break}if(r===S8)for(var i=n;i>0;){i--;var l=o[i];if(Array.isArray(t)?t.indexOf(l)!==-1:t===l)for(var s=n;s<=o.length;){s++;var a=o[s];if(a===e)return!0;if(a!==S8)break}if(l!==S8)break}return!1},Bbe=function(t,e){for(var n=t;n>=0;){var o=e[n];if(o===S8)n--;else return o}return 0},YXt=function(t,e,n,o,r){if(n[o]===0)return Ja;var i=o-1;if(Array.isArray(r)&&r[i]===!0)return Ja;var a=i-1,l=i+1,s=e[i],c=a>=0?e[a]:0,u=e[l];if(s===sqe&&u===cqe)return Ja;if(Jue.indexOf(s)!==-1)return fqe;if(Jue.indexOf(u)!==-1||hqe.indexOf(u)!==-1)return Ja;if(Bbe(i,e)===uqe)return eO;if(Xue.get(t[i])===Uue||(s===QY||s===ZY)&&Xue.get(t[l])===Uue||s===kbe||u===kbe||s===Lbe||[S8,jue,WD].indexOf(s)===-1&&u===Lbe||[$Y,Yz,FXt,YT,OT].indexOf(u)!==-1||Bbe(i,e)===Oz||Lie(Fie,Oz,i,e)||Lie([$Y,Yz],Yue,i,e)||Lie(Wbe,Wbe,i,e))return Ja;if(s===S8)return eO;if(s===Fie||u===Fie)return Ja;if(u===Bue||s===Bue)return eO;if([jue,WD,Yue].indexOf(u)!==-1||s===EXt||c===_ue&&jXt.indexOf(s)!==-1||s===OT&&u===_ue||u===Nbe||l6.indexOf(u)!==-1&&s===G1||l6.indexOf(s)!==-1&&u===G1||s===UD&&[Ak,QY,ZY].indexOf(u)!==-1||[Ak,QY,ZY].indexOf(s)!==-1&&u===ND||l6.indexOf(s)!==-1&&Ube.indexOf(u)!==-1||Ube.indexOf(s)!==-1&&l6.indexOf(u)!==-1||[UD,ND].indexOf(s)!==-1&&(u===G1||[Oz,WD].indexOf(u)!==-1&&e[l+1]===G1)||[Oz,WD].indexOf(s)!==-1&&u===G1||s===G1&&[G1,OT,YT].indexOf(u)!==-1)return Ja;if([G1,OT,YT,$Y,Yz].indexOf(u)!==-1)for(var d=i;d>=0;){var f=e[d];if(f===G1)return Ja;if([OT,YT].indexOf(f)!==-1)d--;else break}if([UD,ND].indexOf(u)!==-1)for(var d=[$Y,Yz].indexOf(s)!==-1?a:i;d>=0;){var f=e[d];if(f===G1)return Ja;if([OT,YT].indexOf(f)!==-1)d--;else break}if(Gue===s&&[Gue,n_,Oue,Vue].indexOf(u)!==-1||[n_,Oue].indexOf(s)!==-1&&[n_,o_].indexOf(u)!==-1||[o_,Vue].indexOf(s)!==-1&&u===o_||jbe.indexOf(s)!==-1&&[Nbe,ND].indexOf(u)!==-1||jbe.indexOf(u)!==-1&&s===UD||l6.indexOf(s)!==-1&&l6.indexOf(u)!==-1||s===YT&&l6.indexOf(u)!==-1||l6.concat(G1).indexOf(s)!==-1&&u===Oz&&NXt.indexOf(t[l])===-1||l6.concat(G1).indexOf(u)!==-1&&s===Yz)return Ja;if(s===kie&&u===kie){for(var p=n[i],g=1;p>0&&(p--,e[p]===kie);)g++;if(g%2!==0)return Ja}return s===QY&&u===ZY?Ja:eO},OXt=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var n=BXt(t,e.lineBreak),o=n[0],r=n[1],i=n[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(l){return[G1,Cv,dqe].indexOf(l)!==-1?Ak:l}));var a=e.wordBreak==="keep-all"?i.map(function(l,s){return l&&t[s]>=19968&&t[s]<=40959}):void 0;return[o,r,a]},VXt=function(){function t(e,n,o,r){this.codePoints=e,this.required=n===fqe,this.start=o,this.end=r}return t.prototype.slice=function(){return D0.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),_Xt=function(t,e){var n=SQ(t),o=OXt(n,e),r=o[0],i=o[1],a=o[2],l=n.length,s=0,c=0;return{next:function(){if(c>=l)return{done:!0,value:null};for(var u=Ja;c=pqe&&t<=57},PJt=function(t){return t>=55296&&t<=57343},VT=function(t){return th(t)||t>=yqe&&t<=wqe||t>=gqe&&t<=vJt},CJt=function(t){return t>=gqe&&t<=bJt},RJt=function(t){return t>=yqe&&t<=TJt},HJt=function(t){return CJt(t)||RJt(t)},MJt=function(t){return t>=uJt},iO=function(t){return t===ZG||t===JXt||t===KXt},eX=function(t){return HJt(t)||MJt(t)||t===ZXt},Gbe=function(t){return eX(t)||th(t)||t===Lp},IJt=function(t){return t>=pJt&&t<=gJt||t===mJt||t>=yJt&&t<=AJt||t===wJt},$4=function(t,e){return t!==IE?!1:e!==ZG},aO=function(t,e,n){return t===Lp?eX(e)||$4(e,n):eX(t)?!0:!!(t===IE&&$4(t,e))},Nie=function(t,e,n){return t===Gv||t===Lp?th(e)?!0:e===wk&&th(n):th(t===wk?e:t)},zJt=function(t){var e=0,n=1;(t[e]===Gv||t[e]===Lp)&&(t[e]===Lp&&(n=-1),e++);for(var o=[];th(t[e]);)o.push(t[e++]);var r=o.length?parseInt(D0.apply(void 0,o),10):0;t[e]===wk&&e++;for(var i=[];th(t[e]);)i.push(t[e++]);var a=i.length,l=a?parseInt(D0.apply(void 0,i),10):0;(t[e]===Aqe||t[e]===mqe)&&e++;var s=1;(t[e]===Gv||t[e]===Lp)&&(t[e]===Lp&&(s=-1),e++);for(var c=[];th(t[e]);)c.push(t[e++]);var u=c.length?parseInt(D0.apply(void 0,c),10):0;return n*(r+l*Math.pow(10,-a))*Math.pow(10,s*u)},DJt={type:2},EJt={type:3},FJt={type:4},kJt={type:13},LJt={type:8},WJt={type:21},NJt={type:9},UJt={type:10},jJt={type:11},BJt={type:12},YJt={type:14},lO={type:23},OJt={type:1},VJt={type:25},_Jt={type:24},GJt={type:26},XJt={type:27},JJt={type:28},KJt={type:29},qJt={type:31},Kue={type:32},vqe=function(){function t(){this._value=[]}return t.prototype.write=function(e){this._value=this._value.concat(SQ(e))},t.prototype.read=function(){for(var e=[],n=this.consumeToken();n!==Kue;)e.push(n),n=this.consumeToken();return e},t.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case tO:return this.consumeStringToken(tO);case qXt:var n=this.peekCodePoint(0),o=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Gbe(n)||$4(o,r)){var i=aO(n,o,r)?XXt:GXt,a=this.consumeName();return{type:5,value:a,flags:i}}break;case $Xt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),kJt;break;case nO:return this.consumeStringToken(nO);case oO:return DJt;case _z:return EJt;case Wie:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),YJt;break;case Gv:if(Nie(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case dJt:return FJt;case Lp:var l=e,s=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Nie(l,s,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(aO(l,s,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(s===Lp&&c===nJt)return this.consumeCodePoint(),this.consumeCodePoint(),_Jt;break;case wk:if(Nie(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Obe:if(this.peekCodePoint(0)===Wie)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Wie&&(u=this.consumeCodePoint(),u===Obe))return this.consumeToken();if(u===X5)return this.consumeToken()}break;case fJt:return GJt;case hJt:return XJt;case tJt:if(this.peekCodePoint(0)===eJt&&this.peekCodePoint(1)===Lp&&this.peekCodePoint(2)===Lp)return this.consumeCodePoint(),this.consumeCodePoint(),VJt;break;case oJt:var d=this.peekCodePoint(0),f=this.peekCodePoint(1),p=this.peekCodePoint(2);if(aO(d,f,p)){var a=this.consumeName();return{type:7,value:a}}break;case rJt:return JJt;case IE:if($4(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case iJt:return KJt;case aJt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),LJt;break;case lJt:return jJt;case sJt:return BJt;case xJt:case SJt:var g=this.peekCodePoint(0),A=this.peekCodePoint(1);return g===Gv&&(VT(A)||A===rO)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Vbe:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),NJt;if(this.peekCodePoint(0)===Vbe)return this.consumeCodePoint(),WJt;break;case cJt:if(this.peekCodePoint(0)===Vz)return this.consumeCodePoint(),UJt;break;case X5:return Kue}return iO(e)?(this.consumeWhiteSpace(),qJt):th(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):eX(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:D0(e)}},t.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},t.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},t.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},t.prototype.consumeUnicodeRangeToken=function(){for(var e=[],n=this.consumeCodePoint();VT(n)&&e.length<6;)e.push(n),n=this.consumeCodePoint();for(var o=!1;n===rO&&e.length<6;)e.push(n),n=this.consumeCodePoint(),o=!0;if(o){var r=parseInt(D0.apply(void 0,e.map(function(s){return s===rO?pqe:s})),16),i=parseInt(D0.apply(void 0,e.map(function(s){return s===rO?wqe:s})),16);return{type:30,start:r,end:i}}var a=parseInt(D0.apply(void 0,e),16);if(this.peekCodePoint(0)===Lp&&VT(this.peekCodePoint(1))){this.consumeCodePoint(),n=this.consumeCodePoint();for(var l=[];VT(n)&&l.length<6;)l.push(n),n=this.consumeCodePoint();var i=parseInt(D0.apply(void 0,l),16);return{type:30,start:a,end:i}}else return{type:30,start:a,end:a}},t.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===oO?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===oO?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},t.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===X5)return{type:22,value:""};var n=this.peekCodePoint(0);if(n===nO||n===tO){var o=this.consumeStringToken(this.consumeCodePoint());return o.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===X5||this.peekCodePoint(0)===_z)?(this.consumeCodePoint(),{type:22,value:o.value}):(this.consumeBadUrlRemnants(),lO)}for(;;){var r=this.consumeCodePoint();if(r===X5||r===_z)return{type:22,value:D0.apply(void 0,e)};if(iO(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===X5||this.peekCodePoint(0)===_z?(this.consumeCodePoint(),{type:22,value:D0.apply(void 0,e)}):(this.consumeBadUrlRemnants(),lO);if(r===tO||r===nO||r===oO||IJt(r))return this.consumeBadUrlRemnants(),lO;if(r===IE)if($4(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),lO;else e.push(r)}},t.prototype.consumeWhiteSpace=function(){for(;iO(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===_z||e===X5)return;$4(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(e){for(var n=5e4,o="";e>0;){var r=Math.min(n,e);o+=D0.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),o},t.prototype.consumeStringToken=function(e){var n="",o=0;do{var r=this._value[o];if(r===X5||r===void 0||r===e)return n+=this.consumeStringSlice(o),{type:0,value:n};if(r===ZG)return this._value.splice(0,o),OJt;if(r===IE){var i=this._value[o+1];i!==X5&&i!==void 0&&(i===ZG?(n+=this.consumeStringSlice(o),o=-1,this._value.shift()):$4(r,i)&&(n+=this.consumeStringSlice(o),n+=D0(this.consumeEscapedCodePoint()),o=-1))}o++}while(!0)},t.prototype.consumeNumber=function(){var e=[],n=aN,o=this.peekCodePoint(0);for((o===Gv||o===Lp)&&e.push(this.consumeCodePoint());th(this.peekCodePoint(0));)e.push(this.consumeCodePoint());o=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(o===wk&&th(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Ybe;th(this.peekCodePoint(0));)e.push(this.consumeCodePoint());o=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((o===Aqe||o===mqe)&&((r===Gv||r===Lp)&&th(i)||th(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),n=Ybe;th(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[zJt(e),n]},t.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),n=e[0],o=e[1],r=this.peekCodePoint(0),i=this.peekCodePoint(1),a=this.peekCodePoint(2);if(aO(r,i,a)){var l=this.consumeName();return{type:15,number:n,flags:o,unit:l}}return r===QXt?(this.consumeCodePoint(),{type:16,number:n,flags:o}):{type:17,number:n,flags:o}},t.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(VT(e)){for(var n=D0(e);VT(this.peekCodePoint(0))&&n.length<6;)n+=D0(this.consumeCodePoint());iO(this.peekCodePoint(0))&&this.consumeCodePoint();var o=parseInt(n,16);return o===0||PJt(o)||o>1114111?_be:o}return e===X5?_be:e},t.prototype.consumeName=function(){for(var e="";;){var n=this.consumeCodePoint();if(Gbe(n))e+=D0(n);else if($4(n,this.peekCodePoint(0)))e+=D0(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(n),e}},t}(),xqe=function(){function t(e){this._tokens=e}return t.create=function(e){var n=new vqe;return n.write(e),new t(n.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var n=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return n;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var e=[];;){var n=this.consumeComponentValue();if(n.type===32)return e;e.push(n),e.push()}},t.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},t.prototype.consumeSimpleBlock=function(e){for(var n={type:e,values:[]},o=this.consumeToken();;){if(o.type===32||QJt(o,e))return n;this.reconsumeToken(o),n.values.push(this.consumeComponentValue()),o=this.consumeToken()}},t.prototype.consumeFunction=function(e){for(var n={name:e.value,values:[],type:18};;){var o=this.consumeToken();if(o.type===32||o.type===3)return n;this.reconsumeToken(o),n.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Kue:e},t.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},t}(),lN=function(t){return t.type===15},QH=function(t){return t.type===17},Ss=function(t){return t.type===20},$Jt=function(t){return t.type===0},que=function(t,e){return Ss(t)&&t.value===e},bqe=function(t){return t.type!==31},TR=function(t){return t.type!==31&&t.type!==4},m3=function(t){var e=[],n=[];return t.forEach(function(o){if(o.type===4){if(n.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(n),n=[];return}o.type!==31&&n.push(o)}),n.length&&e.push(n),e},QJt=function(t,e){return e===11&&t.type===12||e===28&&t.type===29?!0:e===2&&t.type===3},gw=function(t){return t.type===17||t.type===15},iu=function(t){return t.type===16||gw(t)},Sqe=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},uf={type:17,number:0,flags:aN},Eye={type:16,number:50,flags:aN},T8={type:16,number:100,flags:aN},jD=function(t,e,n){var o=t[0],r=t[1];return[Xs(o,e),Xs(typeof r<"u"?r:o,n)]},Xs=function(t,e){if(t.type===16)return t.number/100*e;if(lN(t))switch(t.unit){case"rem":case"em":return 16*t.number;case"px":default:return t.number}return t.number},Tqe="deg",Pqe="grad",Cqe="rad",Rqe="turn",TQ={name:"angle",parse:function(t,e){if(e.type===15)switch(e.unit){case Tqe:return Math.PI*e.number/180;case Pqe:return Math.PI/200*e.number;case Cqe:return e.number;case Rqe:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Hqe=function(t){return t.type===15&&(t.unit===Tqe||t.unit===Pqe||t.unit===Cqe||t.unit===Rqe)},Mqe=function(t){var e=t.filter(Ss).map(function(n){return n.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[uf,uf];case"to top":case"bottom":return Um(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[uf,T8];case"to right":case"left":return Um(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[T8,T8];case"to bottom":case"top":return Um(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[T8,uf];case"to left":case"right":return Um(270)}return 0},Um=function(t){return Math.PI*t/180},_8={name:"color",parse:function(t,e){if(e.type===18){var n=ZJt[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return n(t,e.values)}if(e.type===5){if(e.value.length===3){var o=e.value.substring(0,1),r=e.value.substring(1,2),i=e.value.substring(2,3);return P8(parseInt(o+o,16),parseInt(r+r,16),parseInt(i+i,16),1)}if(e.value.length===4){var o=e.value.substring(0,1),r=e.value.substring(1,2),i=e.value.substring(2,3),a=e.value.substring(3,4);return P8(parseInt(o+o,16),parseInt(r+r,16),parseInt(i+i,16),parseInt(a+a,16)/255)}if(e.value.length===6){var o=e.value.substring(0,2),r=e.value.substring(2,4),i=e.value.substring(4,6);return P8(parseInt(o,16),parseInt(r,16),parseInt(i,16),1)}if(e.value.length===8){var o=e.value.substring(0,2),r=e.value.substring(2,4),i=e.value.substring(4,6),a=e.value.substring(6,8);return P8(parseInt(o,16),parseInt(r,16),parseInt(i,16),parseInt(a,16)/255)}}if(e.type===20){var l=W6[e.value.toUpperCase()];if(typeof l<"u")return l}return W6.TRANSPARENT}},G8=function(t){return(255&t)===0},hd=function(t){var e=255&t,n=255&t>>8,o=255&t>>16,r=255&t>>24;return e<255?"rgba("+r+","+o+","+n+","+e/255+")":"rgb("+r+","+o+","+n+")"},P8=function(t,e,n,o){return(t<<24|e<<16|n<<8|Math.round(o*255)<<0)>>>0},Xbe=function(t,e){if(t.type===17)return t.number;if(t.type===16){var n=e===3?1:255;return e===3?t.number/100*n:Math.round(t.number/100*n)}return 0},Jbe=function(t,e){var n=e.filter(TR);if(n.length===3){var o=n.map(Xbe),r=o[0],i=o[1],a=o[2];return P8(r,i,a,1)}if(n.length===4){var l=n.map(Xbe),r=l[0],i=l[1],a=l[2],s=l[3];return P8(r,i,a,s)}return 0};function Uie(t,e,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(e-t)*n*6+t:n<1/2?e:n<2/3?(e-t)*6*(2/3-n)+t:t}var Kbe=function(t,e){var n=e.filter(TR),o=n[0],r=n[1],i=n[2],a=n[3],l=(o.type===17?Um(o.number):TQ.parse(t,o))/(Math.PI*2),s=iu(r)?r.number/100:0,c=iu(i)?i.number/100:0,u=typeof a<"u"&&iu(a)?Xs(a,1):1;if(s===0)return P8(c*255,c*255,c*255,1);var d=c<=.5?c*(s+1):c+s-c*s,f=c*2-d,p=Uie(f,d,l+1/3),g=Uie(f,d,l),A=Uie(f,d,l-1/3);return P8(p*255,g*255,A*255,u)},ZJt={hsl:Kbe,hsla:Kbe,rgb:Jbe,rgba:Jbe},zE=function(t,e){return _8.parse(t,xqe.create(e).parseComponentValue())},W6={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},eKt={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Ss(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},tKt={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},PQ=function(t,e){var n=_8.parse(t,e[0]),o=e[1];return o&&iu(o)?{color:n,stop:o}:{color:n,stop:null}},qbe=function(t,e){var n=t[0],o=t[t.length-1];n.stop===null&&(n.stop=uf),o.stop===null&&(o.stop=T8);for(var r=[],i=0,a=0;ai?r.push(s):r.push(i),i=s}else r.push(null)}for(var c=null,a=0;aa.optimumDistance)?{optimumCorner:l,optimumDistance:u}:a},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},rKt=function(t,e,n,o,r){var i=0,a=0;switch(t.size){case 0:t.shape===0?i=a=Math.min(Math.abs(e),Math.abs(e-o),Math.abs(n),Math.abs(n-r)):t.shape===1&&(i=Math.min(Math.abs(e),Math.abs(e-o)),a=Math.min(Math.abs(n),Math.abs(n-r)));break;case 2:if(t.shape===0)i=a=Math.min(Zy(e,n),Zy(e,n-r),Zy(e-o,n),Zy(e-o,n-r));else if(t.shape===1){var l=Math.min(Math.abs(n),Math.abs(n-r))/Math.min(Math.abs(e),Math.abs(e-o)),s=$be(o,r,e,n,!0),c=s[0],u=s[1];i=Zy(c-e,(u-n)/l),a=l*i}break;case 1:t.shape===0?i=a=Math.max(Math.abs(e),Math.abs(e-o),Math.abs(n),Math.abs(n-r)):t.shape===1&&(i=Math.max(Math.abs(e),Math.abs(e-o)),a=Math.max(Math.abs(n),Math.abs(n-r)));break;case 3:if(t.shape===0)i=a=Math.max(Zy(e,n),Zy(e,n-r),Zy(e-o,n),Zy(e-o,n-r));else if(t.shape===1){var l=Math.max(Math.abs(n),Math.abs(n-r))/Math.max(Math.abs(e),Math.abs(e-o)),d=$be(o,r,e,n,!1),c=d[0],u=d[1];i=Zy(c-e,(u-n)/l),a=l*i}break}return Array.isArray(t.size)&&(i=Xs(t.size[0],o),a=t.size.length===2?Xs(t.size[1],r):i),[i,a]},iKt=function(t,e){var n=Um(180),o=[];return m3(e).forEach(function(r,i){if(i===0){var a=r[0];if(a.type===20&&a.value==="to"){n=Mqe(r);return}else if(Hqe(a)){n=TQ.parse(t,a);return}}var l=PQ(t,r);o.push(l)}),{angle:n,stops:o,type:1}},sO=function(t,e){var n=Um(180),o=[];return m3(e).forEach(function(r,i){if(i===0){var a=r[0];if(a.type===20&&["top","left","right","bottom"].indexOf(a.value)!==-1){n=Mqe(r);return}else if(Hqe(a)){n=(TQ.parse(t,a)+Um(270))%Um(360);return}}var l=PQ(t,r);o.push(l)}),{angle:n,stops:o,type:1}},aKt=function(t,e){var n=Um(180),o=[],r=1,i=0,a=3,l=[];return m3(e).forEach(function(s,c){var u=s[0];if(c===0){if(Ss(u)&&u.value==="linear"){r=1;return}else if(Ss(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var d=_8.parse(t,u.values[0]);o.push({stop:uf,color:d})}else if(u.name==="to"){var d=_8.parse(t,u.values[0]);o.push({stop:T8,color:d})}else if(u.name==="color-stop"){var f=u.values.filter(TR);if(f.length===2){var d=_8.parse(t,f[1]),p=f[0];QH(p)&&o.push({stop:{type:16,number:p.number*100,flags:p.flags},color:d})}}}}),r===1?{angle:(n+Um(180))%Um(360),stops:o,type:r}:{size:a,shape:i,stops:o,position:l,type:r}},Iqe="closest-side",zqe="farthest-side",Dqe="closest-corner",Eqe="farthest-corner",Fqe="circle",kqe="ellipse",Lqe="cover",Wqe="contain",lKt=function(t,e){var n=0,o=3,r=[],i=[];return m3(e).forEach(function(a,l){var s=!0;if(l===0){var c=!1;s=a.reduce(function(d,f){if(c)if(Ss(f))switch(f.value){case"center":return i.push(Eye),d;case"top":case"left":return i.push(uf),d;case"right":case"bottom":return i.push(T8),d}else(iu(f)||gw(f))&&i.push(f);else if(Ss(f))switch(f.value){case Fqe:return n=0,!1;case kqe:return n=1,!1;case"at":return c=!0,!1;case Iqe:return o=0,!1;case Lqe:case zqe:return o=1,!1;case Wqe:case Dqe:return o=2,!1;case Eqe:return o=3,!1}else if(gw(f)||iu(f))return Array.isArray(o)||(o=[]),o.push(f),!1;return d},s)}if(s){var u=PQ(t,a);r.push(u)}}),{size:o,shape:n,stops:r,position:i,type:2}},cO=function(t,e){var n=0,o=3,r=[],i=[];return m3(e).forEach(function(a,l){var s=!0;if(l===0?s=a.reduce(function(u,d){if(Ss(d))switch(d.value){case"center":return i.push(Eye),!1;case"top":case"left":return i.push(uf),!1;case"right":case"bottom":return i.push(T8),!1}else if(iu(d)||gw(d))return i.push(d),!1;return u},s):l===1&&(s=a.reduce(function(u,d){if(Ss(d))switch(d.value){case Fqe:return n=0,!1;case kqe:return n=1,!1;case Wqe:case Iqe:return o=0,!1;case zqe:return o=1,!1;case Dqe:return o=2,!1;case Lqe:case Eqe:return o=3,!1}else if(gw(d)||iu(d))return Array.isArray(o)||(o=[]),o.push(d),!1;return u},s)),s){var c=PQ(t,a);r.push(c)}}),{size:o,shape:n,stops:r,position:i,type:2}},sKt=function(t){return t.type===1},cKt=function(t){return t.type===2},Fye={name:"image",parse:function(t,e){if(e.type===22){var n={url:e.value,type:0};return t.cache.addImage(e.value),n}if(e.type===18){var o=Nqe[e.name];if(typeof o>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return o(t,e.values)}throw new Error("Unsupported image type "+e.type)}};function uKt(t){return!(t.type===20&&t.value==="none")&&(t.type!==18||!!Nqe[t.name])}var Nqe={"linear-gradient":iKt,"-moz-linear-gradient":sO,"-ms-linear-gradient":sO,"-o-linear-gradient":sO,"-webkit-linear-gradient":sO,"radial-gradient":lKt,"-moz-radial-gradient":cO,"-ms-radial-gradient":cO,"-o-radial-gradient":cO,"-webkit-radial-gradient":cO,"-webkit-gradient":aKt},dKt={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e.filter(function(o){return TR(o)&&uKt(o)}).map(function(o){return Fye.parse(t,o)})}},fKt={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(n){if(Ss(n))switch(n.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},hKt={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return m3(e).map(function(n){return n.filter(iu)}).map(Sqe)}},pKt={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return m3(e).map(function(n){return n.filter(Ss).map(function(o){return o.value}).join(" ")}).map(gKt)}},gKt=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},EC;(function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"})(EC||(EC={}));var mKt={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return m3(e).map(function(n){return n.filter(yKt)})}},yKt=function(t){return Ss(t)||iu(t)},CQ=function(t){return{name:"border-"+t+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},AKt=CQ("top"),wKt=CQ("right"),vKt=CQ("bottom"),xKt=CQ("left"),RQ=function(t){return{name:"border-radius-"+t,initialValue:"0 0",prefix:!1,type:1,parse:function(e,n){return Sqe(n.filter(iu))}}},bKt=RQ("top-left"),SKt=RQ("top-right"),TKt=RQ("bottom-right"),PKt=RQ("bottom-left"),HQ=function(t){return{name:"border-"+t+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,n){switch(n){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},CKt=HQ("top"),RKt=HQ("right"),HKt=HQ("bottom"),MKt=HQ("left"),MQ=function(t){return{name:"border-"+t+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,n){return lN(n)?n.number:0}}},IKt=MQ("top"),zKt=MQ("right"),DKt=MQ("bottom"),EKt=MQ("left"),FKt={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},kKt={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},LKt={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).reduce(function(n,o){return n|WKt(o.value)},0)}},WKt=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},NKt={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},UKt={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},tX;(function(t){t.NORMAL="normal",t.STRICT="strict"})(tX||(tX={}));var jKt={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"strict":return tX.STRICT;case"normal":default:return tX.NORMAL}}},BKt={name:"line-height",initialValue:"normal",prefix:!1,type:4},Qbe=function(t,e){return Ss(t)&&t.value==="normal"?1.2*e:t.type===17?e*t.number:iu(t)?Xs(t,e):e},YKt={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return e.type===20&&e.value==="none"?null:Fye.parse(t,e)}},OKt={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},$ue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},IQ=function(t){return{name:"margin-"+t,initialValue:"0",prefix:!1,type:4}},VKt=IQ("top"),_Kt=IQ("right"),GKt=IQ("bottom"),XKt=IQ("left"),JKt={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).map(function(n){switch(n.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},KKt={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},zQ=function(t){return{name:"padding-"+t,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},qKt=zQ("top"),$Kt=zQ("right"),QKt=zQ("bottom"),ZKt=zQ("left"),eqt={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},tqt={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},nqt={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&que(e[0],"none")?[]:m3(e).map(function(n){for(var o={color:W6.TRANSPARENT,offsetX:uf,offsetY:uf,blur:uf},r=0,i=0;i"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return n(e.values)}return null}},iqt=function(t){var e=t.filter(function(n){return n.type===17}).map(function(n){return n.number});return e.length===6?e:null},aqt=function(t){var e=t.filter(function(s){return s.type===17}).map(function(s){return s.number}),n=e[0],o=e[1];e[2],e[3];var r=e[4],i=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var a=e[12],l=e[13];return e[14],e[15],e.length===16?[n,o,r,i,a,l]:null},lqt={matrix:iqt,matrix3d:aqt},Zbe={type:16,number:50,flags:aN},sqt=[Zbe,Zbe],cqt={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var n=e.filter(iu);return n.length!==2?sqt:[n[0],n[1]]}},uqt={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},DE;(function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"})(DE||(DE={}));var dqt={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return DE.BREAK_ALL;case"keep-all":return DE.KEEP_ALL;case"normal":default:return DE.NORMAL}}},fqt={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(e.type===20)return{auto:!0,order:0};if(QH(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Uqe={name:"time",parse:function(t,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},hqt={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return QH(e)?e.number:1}},pqt={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},gqt={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(Ss).map(function(n){switch(n.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(n){return n!==0})}},mqt={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var n=[],o=[];return e.forEach(function(r){switch(r.type){case 20:case 0:n.push(r.value);break;case 17:n.push(r.number.toString());break;case 4:o.push(n.join(" ")),n.length=0;break}}),n.length&&o.push(n.join(" ")),o.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},yqt={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Aqt={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){if(QH(e))return e.number;if(Ss(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},wqt={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(Ss).map(function(n){return n.value})}},vqt={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Du=function(t,e){return(t&e)!==0},xqt={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var n=e[0];return n.type===20&&n.value==="none"?[]:e}},bqt={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var n=e[0];if(n.type===20&&n.value==="none")return null;for(var o=[],r=e.filter(bqe),i=0;i1?1:0],this.overflowWrap=kr(e,KKt,n.overflowWrap),this.paddingTop=kr(e,qKt,n.paddingTop),this.paddingRight=kr(e,$Kt,n.paddingRight),this.paddingBottom=kr(e,QKt,n.paddingBottom),this.paddingLeft=kr(e,ZKt,n.paddingLeft),this.paintOrder=kr(e,Rqt,n.paintOrder),this.position=kr(e,tqt,n.position),this.textAlign=kr(e,eqt,n.textAlign),this.textDecorationColor=kr(e,pqt,(o=n.textDecorationColor)!==null&&o!==void 0?o:n.color),this.textDecorationLine=kr(e,gqt,(r=n.textDecorationLine)!==null&&r!==void 0?r:n.textDecoration),this.textShadow=kr(e,nqt,n.textShadow),this.textTransform=kr(e,oqt,n.textTransform),this.transform=kr(e,rqt,n.transform),this.transformOrigin=kr(e,cqt,n.transformOrigin),this.visibility=kr(e,uqt,n.visibility),this.webkitTextStrokeColor=kr(e,Hqt,n.webkitTextStrokeColor),this.webkitTextStrokeWidth=kr(e,Mqt,n.webkitTextStrokeWidth),this.wordBreak=kr(e,dqt,n.wordBreak),this.zIndex=kr(e,fqt,n.zIndex)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},t.prototype.isTransparent=function(){return G8(this.backgroundColor)},t.prototype.isTransformed=function(){return this.transform!==null},t.prototype.isPositioned=function(){return this.position!==0},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==0},t.prototype.isInlineLevel=function(){return Du(this.display,4)||Du(this.display,33554432)||Du(this.display,268435456)||Du(this.display,536870912)||Du(this.display,67108864)||Du(this.display,134217728)},t}(),zqt=function(){function t(e,n){this.content=kr(e,xqt,n.content),this.quotes=kr(e,Pqt,n.quotes)}return t}(),tSe=function(){function t(e,n){this.counterIncrement=kr(e,bqt,n.counterIncrement),this.counterReset=kr(e,Sqt,n.counterReset)}return t}(),kr=function(t,e,n){var o=new vqe,r=n!==null&&typeof n<"u"?n.toString():e.initialValue;o.write(r);var i=new xqe(o.read());switch(e.type){case 2:var a=i.parseComponentValue();return e.parse(t,Ss(a)?a.value:e.initialValue);case 0:return e.parse(t,i.parseComponentValue());case 1:return e.parse(t,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(e.format){case"angle":return TQ.parse(t,i.parseComponentValue());case"color":return _8.parse(t,i.parseComponentValue());case"image":return Fye.parse(t,i.parseComponentValue());case"length":var l=i.parseComponentValue();return gw(l)?l:uf;case"length-percentage":var s=i.parseComponentValue();return iu(s)?s:uf;case"time":return Uqe.parse(t,i.parseComponentValue())}break}},Dqt="data-html2canvas-debug",Eqt=function(t){var e=t.getAttribute(Dqt);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Que=function(t,e){var n=Eqt(t);return n===1||e===n},y3=function(){function t(e,n){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Que(n,3))debugger;this.styles=new Iqt(e,window.getComputedStyle(n,null)),tde(n)&&(this.styles.animationDuration.some(function(o){return o>0})&&(n.style.animationDuration="0s"),this.styles.transform!==null&&(n.style.transform="none")),this.bounds=bQ(this.context,n),Que(n,4)&&(this.flags|=16)}return t}(),Fqt="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",nSe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BD=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var uO=0;uO>4,u[r++]=(a&15)<<4|l>>2,u[r++]=(l&3)<<6|s&63;return c},Lqt=function(t){for(var e=t.length,n=[],o=0;o>Tx,Uqt=1<>Tx,Bqt=jqe+jqt,Yqt=Bqt,Oqt=32,Vqt=Yqt+Oqt,_qt=65536>>kye,Gqt=1<=0){if(e<55296||e>56319&&e<=65535)return n=this.index[e>>Tx],n=(n<>Tx)],n=(n<>kye),n=this.index[n],n+=e>>Tx&Xqt,n=this.index[n],n=(n<"u"?[]:new Uint8Array(256);for(var dO=0;dO=55296&&r<=56319&&n>10)+55296,a%1024+56320)),(r+1===n||o.length>16384)&&(i+=String.fromCharCode.apply(String,o),o.length=0)}return i},n$t=Kqt(Fqt),Sm="×",Xie="÷",o$t=function(t){return n$t.get(t)},r$t=function(t,e,n){var o=n-2,r=e[o],i=e[n-1],a=e[n];if(i===Yie&&a===Oie)return Sm;if(i===Yie||i===Oie||i===iSe||a===Yie||a===Oie||a===iSe)return Xie;if(i===lSe&&[lSe,Vie,sSe,cSe].indexOf(a)!==-1||(i===sSe||i===Vie)&&(a===Vie||a===_ie)||(i===cSe||i===_ie)&&a===_ie||a===uSe||a===aSe||a===Zqt||i===Qqt)return Sm;if(i===uSe&&a===dSe){for(;r===aSe;)r=e[--o];if(r===dSe)return Sm}if(i===Gie&&a===Gie){for(var l=0;r===Gie;)l++,r=e[--o];if(l%2===0)return Sm}return Xie},i$t=function(t){var e=e$t(t),n=e.length,o=0,r=0,i=e.map(o$t);return{next:function(){if(o>=n)return{done:!0,value:null};for(var a=Sm;oa.x||u.y>a.y;return a=u,c===0?!0:d});return t.body.removeChild(e),l},c$t=function(){return typeof new Image().crossOrigin<"u"},u$t=function(){return typeof new XMLHttpRequest().responseType=="string"},d$t=function(t){var e=new Image,n=t.createElement("canvas"),o=n.getContext("2d");if(!o)return!1;e.src="data:image/svg+xml,";try{o.drawImage(e,0,0),n.toDataURL()}catch{return!1}return!0},fSe=function(t){return t[0]===0&&t[1]===255&&t[2]===0&&t[3]===255},f$t=function(t){var e=t.createElement("canvas"),n=100;e.width=n,e.height=n;var o=e.getContext("2d");if(!o)return Promise.reject(!1);o.fillStyle="rgb(0, 255, 0)",o.fillRect(0,0,n,n);var r=new Image,i=e.toDataURL();r.src=i;var a=Zue(n,n,0,0,r);return o.fillStyle="red",o.fillRect(0,0,n,n),hSe(a).then(function(l){o.drawImage(l,0,0);var s=o.getImageData(0,0,n,n).data;o.fillStyle="red",o.fillRect(0,0,n,n);var c=t.createElement("div");return c.style.backgroundImage="url("+i+")",c.style.height=n+"px",fSe(s)?hSe(Zue(n,n,0,0,c)):Promise.reject(!1)}).then(function(l){return o.drawImage(l,0,0),fSe(o.getImageData(0,0,n,n).data)}).catch(function(){return!1})},Zue=function(t,e,n,o,r){var i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"svg"),l=document.createElementNS(i,"foreignObject");return a.setAttributeNS(null,"width",t.toString()),a.setAttributeNS(null,"height",e.toString()),l.setAttributeNS(null,"width","100%"),l.setAttributeNS(null,"height","100%"),l.setAttributeNS(null,"x",n.toString()),l.setAttributeNS(null,"y",o.toString()),l.setAttributeNS(null,"externalResourcesRequired","true"),a.appendChild(l),l.appendChild(r),a},hSe=function(t){return new Promise(function(e,n){var o=new Image;o.onload=function(){return e(o)},o.onerror=n,o.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},af={get SUPPORT_RANGE_BOUNDS(){var t=l$t(document);return Object.defineProperty(af,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=af.SUPPORT_RANGE_BOUNDS&&s$t(document);return Object.defineProperty(af,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=d$t(document);return Object.defineProperty(af,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t=typeof Array.from=="function"&&typeof window.fetch=="function"?f$t(document):Promise.resolve(!1);return Object.defineProperty(af,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=c$t();return Object.defineProperty(af,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t=u$t();return Object.defineProperty(af,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(af,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(af,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},EE=function(){function t(e,n){this.text=e,this.bounds=n}return t}(),h$t=function(t,e,n,o){var r=m$t(e,n),i=[],a=0;return r.forEach(function(l){if(n.textDecorationLine.length||l.trim().length>0)if(af.SUPPORT_RANGE_BOUNDS){var s=pSe(o,a,l.length).getClientRects();if(s.length>1){var c=Lye(l),u=0;c.forEach(function(f){i.push(new EE(f,lA.fromDOMRectList(t,pSe(o,u+a,f.length).getClientRects()))),u+=f.length})}else i.push(new EE(l,lA.fromDOMRectList(t,s)))}else{var d=o.splitText(l.length);i.push(new EE(l,p$t(t,o))),o=d}else af.SUPPORT_RANGE_BOUNDS||(o=o.splitText(l.length));a+=l.length}),i},p$t=function(t,e){var n=e.ownerDocument;if(n){var o=n.createElement("html2canvaswrapper");o.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(o,e);var i=bQ(t,o);return o.firstChild&&r.replaceChild(o.firstChild,o),i}}return lA.EMPTY},pSe=function(t,e,n){var o=t.ownerDocument;if(!o)throw new Error("Node has no owner document");var r=o.createRange();return r.setStart(t,e),r.setEnd(t,e+n),r},Lye=function(t){if(af.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(n){return n.segment})}return a$t(t)},g$t=function(t,e){if(af.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(t)).map(function(o){return o.segment})}return A$t(t,e)},m$t=function(t,e){return e.letterSpacing!==0?Lye(t):g$t(t,e)},y$t=[32,160,4961,65792,65793,4153,4241],A$t=function(t,e){for(var n=_Xt(t,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),o=[],r,i=function(){if(r.value){var a=r.value.slice(),l=SQ(a),s="";l.forEach(function(c){y$t.indexOf(c)===-1?s+=D0(c):(s.length&&o.push(s),o.push(D0(c)),s="")}),s.length&&o.push(s)}};!(r=n.next()).done;)i();return o},w$t=function(){function t(e,n,o){this.text=v$t(n.data,o.textTransform),this.textBounds=h$t(e,this.text,o,n)}return t}(),v$t=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(x$t,b$t);case 2:return t.toUpperCase();default:return t}},x$t=/(^|\s|:|-|\(|\))([a-z])/g,b$t=function(t,e,n){return t.length>0?e+n.toUpperCase():t},Bqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.src=o.currentSrc||o.src,r.intrinsicWidth=o.naturalWidth,r.intrinsicHeight=o.naturalHeight,r.context.cache.addImage(r.src),r}return e}(y3),Yqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.canvas=o,r.intrinsicWidth=o.width,r.intrinsicHeight=o.height,r}return e}(y3),Oqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this,i=new XMLSerializer,a=bQ(n,o);return o.setAttribute("width",a.width+"px"),o.setAttribute("height",a.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(o)),r.intrinsicWidth=o.width.baseVal.value,r.intrinsicHeight=o.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e}(y3),Vqe=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.value=o.value,r}return e}(y3),ede=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r.start=o.start,r.reversed=typeof o.reversed=="boolean"&&o.reversed===!0,r}return e}(y3),S$t=[{type:15,flags:0,unit:"px",number:3}],T$t=[{type:16,flags:0,number:50}],P$t=function(t){return t.width>t.height?new lA(t.left+(t.width-t.height)/2,t.top,t.height,t.height):t.width0)n.textNodes.push(new w$t(t,r,n.styles));else if(iC(r))if(e$e(r)&&r.assignedNodes)r.assignedNodes().forEach(function(l){return r_(t,l,n,o)});else{var a=Jqe(t,r);a.styles.isVisible()&&(M$t(r,a,o)?a.flags|=4:I$t(a.styles)&&(a.flags|=2),H$t.indexOf(r.tagName)!==-1&&(a.flags|=8),n.elements.push(a),r.slot,r.shadowRoot?r_(t,r.shadowRoot,a,o):!rX(r)&&!$qe(r)&&!iX(r)&&r_(t,r,a,o))}},Jqe=function(t,e){return nde(e)?new Bqe(t,e):Qqe(e)?new Yqe(t,e):$qe(e)?new Oqe(t,e):z$t(e)?new Vqe(t,e):D$t(e)?new ede(t,e):E$t(e)?new Wye(t,e):iX(e)?new _qe(t,e):rX(e)?new Gqe(t,e):Zqe(e)?new Xqe(t,e):new y3(t,e)},Kqe=function(t,e){var n=Jqe(t,e);return n.flags|=4,r_(t,e,n,n),n},M$t=function(t,e,n){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Nye(t)&&n.styles.isTransparent()},I$t=function(t){return t.isPositioned()||t.isFloating()},qqe=function(t){return t.nodeType===Node.TEXT_NODE},iC=function(t){return t.nodeType===Node.ELEMENT_NODE},tde=function(t){return iC(t)&&typeof t.style<"u"&&!i_(t)},i_=function(t){return typeof t.className=="object"},z$t=function(t){return t.tagName==="LI"},D$t=function(t){return t.tagName==="OL"},E$t=function(t){return t.tagName==="INPUT"},F$t=function(t){return t.tagName==="HTML"},$qe=function(t){return t.tagName==="svg"},Nye=function(t){return t.tagName==="BODY"},Qqe=function(t){return t.tagName==="CANVAS"},mSe=function(t){return t.tagName==="VIDEO"},nde=function(t){return t.tagName==="IMG"},Zqe=function(t){return t.tagName==="IFRAME"},ySe=function(t){return t.tagName==="STYLE"},k$t=function(t){return t.tagName==="SCRIPT"},rX=function(t){return t.tagName==="TEXTAREA"},iX=function(t){return t.tagName==="SELECT"},e$e=function(t){return t.tagName==="SLOT"},ASe=function(t){return t.tagName.indexOf("-")>0},L$t=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(e){var n=this.counters[e];return n&&n.length?n[n.length-1]:1},t.prototype.getCounterValues=function(e){var n=this.counters[e];return n||[]},t.prototype.pop=function(e){var n=this;e.forEach(function(o){return n.counters[o].pop()})},t.prototype.parse=function(e){var n=this,o=e.counterIncrement,r=e.counterReset,i=!0;o!==null&&o.forEach(function(l){var s=n.counters[l.counter];s&&l.increment!==0&&(i=!1,s.length||s.push(1),s[Math.max(0,s.length-1)]+=l.increment)});var a=[];return i&&r.forEach(function(l){var s=n.counters[l.counter];a.push(l.counter),s||(s=n.counters[l.counter]=[]),s.push(l.reset)}),a},t}(),wSe={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},vSe={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},W$t={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},N$t={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},_T=function(t,e,n,o,r,i){return tn?vk(t,r,i.length>0):o.integers.reduce(function(a,l,s){for(;t>=l;)t-=l,a+=o.values[s];return a},"")+i},t$e=function(t,e,n,o){var r="";do n||t--,r=o(t)+r,t/=e;while(t*e>=e);return r},I0=function(t,e,n,o,r){var i=n-e+1;return(t<0?"-":"")+(t$e(Math.abs(t),i,o,function(a){return D0(Math.floor(a%i)+e)})+r)},$7=function(t,e,n){n===void 0&&(n=". ");var o=e.length;return t$e(Math.abs(t),o,!1,function(r){return e[Math.floor(r%o)]})+n},uP=1,U4=2,j4=4,YD=8,s6=function(t,e,n,o,r,i){if(t<-9999||t>9999)return vk(t,4,r.length>0);var a=Math.abs(t),l=r;if(a===0)return e[0]+l;for(var s=0;a>0&&s<=4;s++){var c=a%10;c===0&&Du(i,uP)&&l!==""?l=e[c]+l:c>1||c===1&&s===0||c===1&&s===1&&Du(i,U4)||c===1&&s===1&&Du(i,j4)&&t>100||c===1&&s>1&&Du(i,YD)?l=e[c]+(s>0?n[s-1]:"")+l:c===1&&s>0&&(l=n[s-1]+l),a=Math.floor(a/10)}return(t<0?o:"")+l},xSe="十百千萬",bSe="拾佰仟萬",SSe="マイナス",Jie="마이너스",vk=function(t,e,n){var o=n?". ":"",r=n?"、":"",i=n?", ":"",a=n?" ":"";switch(e){case 0:return"•"+a;case 1:return"◦"+a;case 2:return"◾"+a;case 5:var l=I0(t,48,57,!0,o);return l.length<4?"0"+l:l;case 4:return $7(t,"〇一二三四五六七八九",r);case 6:return _T(t,1,3999,wSe,3,o).toLowerCase();case 7:return _T(t,1,3999,wSe,3,o);case 8:return I0(t,945,969,!1,o);case 9:return I0(t,97,122,!1,o);case 10:return I0(t,65,90,!1,o);case 11:return I0(t,1632,1641,!0,o);case 12:case 49:return _T(t,1,9999,vSe,3,o);case 35:return _T(t,1,9999,vSe,3,o).toLowerCase();case 13:return I0(t,2534,2543,!0,o);case 14:case 30:return I0(t,6112,6121,!0,o);case 15:return $7(t,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return $7(t,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return s6(t,"零一二三四五六七八九",xSe,"負",r,U4|j4|YD);case 47:return s6(t,"零壹貳參肆伍陸柒捌玖",bSe,"負",r,uP|U4|j4|YD);case 42:return s6(t,"零一二三四五六七八九",xSe,"负",r,U4|j4|YD);case 41:return s6(t,"零壹贰叁肆伍陆柒捌玖",bSe,"负",r,uP|U4|j4|YD);case 26:return s6(t,"〇一二三四五六七八九","十百千万",SSe,r,0);case 25:return s6(t,"零壱弐参四伍六七八九","拾百千万",SSe,r,uP|U4|j4);case 31:return s6(t,"영일이삼사오육칠팔구","십백천만",Jie,i,uP|U4|j4);case 33:return s6(t,"零一二三四五六七八九","十百千萬",Jie,i,0);case 32:return s6(t,"零壹貳參四五六七八九","拾百千",Jie,i,uP|U4|j4);case 18:return I0(t,2406,2415,!0,o);case 20:return _T(t,1,19999,N$t,3,o);case 21:return I0(t,2790,2799,!0,o);case 22:return I0(t,2662,2671,!0,o);case 22:return _T(t,1,10999,W$t,3,o);case 23:return $7(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return $7(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return I0(t,3302,3311,!0,o);case 28:return $7(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return $7(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return I0(t,3792,3801,!0,o);case 37:return I0(t,6160,6169,!0,o);case 38:return I0(t,4160,4169,!0,o);case 39:return I0(t,2918,2927,!0,o);case 40:return I0(t,1776,1785,!0,o);case 43:return I0(t,3046,3055,!0,o);case 44:return I0(t,3174,3183,!0,o);case 45:return I0(t,3664,3673,!0,o);case 46:return I0(t,3872,3881,!0,o);case 3:default:return I0(t,48,57,!0,o)}},n$e="data-html2canvas-ignore",TSe=function(){function t(e,n,o){if(this.context=e,this.options=o,this.scrolledElements=[],this.referenceElement=n,this.counters=new L$t,this.quoteDepth=0,!n.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(n.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(e,n){var o=this,r=U$t(e,n);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var i=e.defaultView.pageXOffset,a=e.defaultView.pageYOffset,l=r.contentWindow,s=l.document,c=Y$t(r).then(function(){return Jh(o,void 0,void 0,function(){var u,d;return $f(this,function(f){switch(f.label){case 0:return this.scrolledElements.forEach(G$t),l&&(l.scrollTo(n.left,n.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(l.scrollY!==n.top||l.scrollX!==n.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(l.scrollX-n.left,l.scrollY-n.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:s.fonts&&s.fonts.ready?[4,s.fonts.ready]:[3,2];case 1:f.sent(),f.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,B$t(s)]:[3,4];case 3:f.sent(),f.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(s,d)}).then(function(){return r})]:[2,r]}})})});return s.open(),s.write(V$t(document.doctype)+""),_$t(this.referenceElement.ownerDocument,i,a),s.replaceChild(s.adoptNode(this.documentElement),s.documentElement),s.close(),c},t.prototype.createElementClone=function(e){if(Que(e,2))debugger;if(Qqe(e))return this.createCanvasClone(e);if(mSe(e))return this.createVideoClone(e);if(ySe(e))return this.createStyleClone(e);var n=e.cloneNode(!1);return nde(n)&&(nde(e)&&e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc,n.srcset=""),n.loading==="lazy"&&(n.loading="eager")),ASe(n)?this.createCustomElementClone(n):n},t.prototype.createCustomElementClone=function(e){var n=document.createElement("html2canvascustomelement");return Kie(e.style,n),n},t.prototype.createStyleClone=function(e){try{var n=e.sheet;if(n&&n.cssRules){var o=[].slice.call(n.cssRules,0).reduce(function(i,a){return a&&typeof a.cssText=="string"?i+a.cssText:i},""),r=e.cloneNode(!1);return r.textContent=o,r}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return e.cloneNode(!1)},t.prototype.createCanvasClone=function(e){var n;if(this.options.inlineImages&&e.ownerDocument){var o=e.ownerDocument.createElement("img");try{return o.src=e.toDataURL(),o}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var i=e.getContext("2d"),a=r.getContext("2d");if(a)if(!this.options.allowTaint&&i)a.putImageData(i.getImageData(0,0,e.width,e.height),0,0);else{var l=(n=e.getContext("webgl2"))!==null&&n!==void 0?n:e.getContext("webgl");if(l){var s=l.getContextAttributes();(s==null?void 0:s.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}a.drawImage(e,0,0)}return r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},t.prototype.createVideoClone=function(e){var n=e.ownerDocument.createElement("canvas");n.width=e.offsetWidth,n.height=e.offsetHeight;var o=n.getContext("2d");try{return o&&(o.drawImage(e,0,0,n.width,n.height),this.options.allowTaint||o.getImageData(0,0,n.width,n.height)),n}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},t.prototype.appendChildNode=function(e,n,o){(!iC(n)||!k$t(n)&&!n.hasAttribute(n$e)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(n)))&&(!this.options.copyStyles||!iC(n)||!ySe(n))&&e.appendChild(this.cloneNode(n,o))},t.prototype.cloneChildNodes=function(e,n,o){for(var r=this,i=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;i;i=i.nextSibling)if(iC(i)&&e$e(i)&&typeof i.assignedNodes=="function"){var a=i.assignedNodes();a.length&&a.forEach(function(l){return r.appendChildNode(n,l,o)})}else this.appendChildNode(n,i,o)},t.prototype.cloneNode=function(e,n){if(qqe(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var o=e.ownerDocument.defaultView;if(o&&iC(e)&&(tde(e)||i_(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var i=o.getComputedStyle(e),a=o.getComputedStyle(e,":before"),l=o.getComputedStyle(e,":after");this.referenceElement===e&&tde(r)&&(this.clonedReferenceElement=r),Nye(r)&&K$t(r);var s=this.counters.parse(new tSe(this.context,i)),c=this.resolvePseudoContent(e,r,a,FE.BEFORE);ASe(e)&&(n=!0),mSe(e)||this.cloneChildNodes(e,r,n),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,l,FE.AFTER);return u&&r.appendChild(u),this.counters.pop(s),(i&&(this.options.copyStyles||i_(e))&&!Zqe(e)||n)&&Kie(i,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(rX(e)||iX(e))&&(rX(r)||iX(r))&&(r.value=e.value),r}return e.cloneNode(!1)},t.prototype.resolvePseudoContent=function(e,n,o,r){var i=this;if(o){var a=o.content,l=n.ownerDocument;if(!(!l||!a||a==="none"||a==="-moz-alt-content"||o.display==="none")){this.counters.parse(new tSe(this.context,o));var s=new zqt(this.context,o),c=l.createElement("html2canvaspseudoelement");Kie(o,c),s.content.forEach(function(d){if(d.type===0)c.appendChild(l.createTextNode(d.value));else if(d.type===22){var f=l.createElement("img");f.src=d.value,f.style.opacity="1",c.appendChild(f)}else if(d.type===18){if(d.name==="attr"){var p=d.values.filter(Ss);p.length&&c.appendChild(l.createTextNode(e.getAttribute(p[0].value)||""))}else if(d.name==="counter"){var g=d.values.filter(TR),A=g[0],y=g[1];if(A&&Ss(A)){var S=i.counters.getCounterValue(A.value),C=y&&Ss(y)?$ue.parse(i.context,y.value):3;c.appendChild(l.createTextNode(vk(S,C,!1)))}}else if(d.name==="counters"){var P=d.values.filter(TR),A=P[0],v=P[1],y=P[2];if(A&&Ss(A)){var T=i.counters.getCounterValues(A.value),w=y&&Ss(y)?$ue.parse(i.context,y.value):3,x=v&&v.type===0?v.value:"",b=T.map(function(F){return vk(F,w,!1)}).join(x);c.appendChild(l.createTextNode(b))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(l.createTextNode(eSe(s.quotes,i.quoteDepth++,!0)));break;case"close-quote":c.appendChild(l.createTextNode(eSe(s.quotes,--i.quoteDepth,!1)));break;default:c.appendChild(l.createTextNode(d.value))}}),c.className=ode+" "+rde;var u=r===FE.BEFORE?" "+ode:" "+rde;return i_(n)?n.className.baseValue+=u:n.className+=u,c}}},t.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},t}(),FE;(function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"})(FE||(FE={}));var U$t=function(t,e){var n=t.createElement("iframe");return n.className="html2canvas-container",n.style.visibility="hidden",n.style.position="fixed",n.style.left="-10000px",n.style.top="0px",n.style.border="0",n.width=e.width.toString(),n.height=e.height.toString(),n.scrolling="no",n.setAttribute(n$e,"true"),t.body.appendChild(n),n},j$t=function(t){return new Promise(function(e){if(t.complete){e();return}if(!t.src){e();return}t.onload=e,t.onerror=e})},B$t=function(t){return Promise.all([].slice.call(t.images,0).map(j$t))},Y$t=function(t){return new Promise(function(e,n){var o=t.contentWindow;if(!o)return n("No window assigned for iframe");var r=o.document;o.onload=t.onload=function(){o.onload=t.onload=null;var i=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(i),e(t))},50)}})},O$t=["all","d","content"],Kie=function(t,e){for(var n=t.length-1;n>=0;n--){var o=t.item(n);O$t.indexOf(o)===-1&&e.style.setProperty(o,t.getPropertyValue(o))}return e},V$t=function(t){var e="";return t&&(e+=""),e},_$t=function(t,e,n){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||n!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,n)},G$t=function(t){var e=t[0],n=t[1],o=t[2];e.scrollLeft=n,e.scrollTop=o},X$t=":before",J$t=":after",ode="___html2canvas___pseudoelement_before",rde="___html2canvas___pseudoelement_after",PSe=`{ content: "" !important; display: none !important; }`,K$t=function(t){q$t(t,"."+ode+X$t+PSe+` - .`+rde+J$t+PSe)},q$t=function(t,e){var n=t.ownerDocument;if(n){var o=n.createElement("style");o.textContent=e,t.appendChild(o)}},o$e=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),$$t=function(){function t(e,n){this.context=e,this._options=n,this._cache={}}return t.prototype.addImage=function(e){var n=Promise.resolve();return this.has(e)||($ie(e)||tQt(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),n},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Jh(this,void 0,void 0,function(){var n,o,r,i,a=this;return qf(this,function(l){switch(l.label){case 0:return n=o$e.isSameOrigin(e),o=!qie(e)&&this._options.useCORS===!0&&af.SUPPORT_CORS_IMAGES&&!n,r=!qie(e)&&!n&&!$ie(e)&&typeof this._options.proxy=="string"&&af.SUPPORT_CORS_XHR&&!o,!n&&this._options.allowTaint===!1&&!qie(e)&&!$ie(e)&&!r&&!o?[2]:(i=e,r?[4,this.proxy(i)]:[3,2]);case 1:i=l.sent(),l.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(nQt(i)||o)&&(u.crossOrigin="anonymous"),u.src=i,u.complete===!0&&setTimeout(function(){return s(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+a._options.imageTimeout+"ms) loading image")},a._options.imageTimeout)})];case 3:return[2,l.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var n=this,o=this._options.proxy;if(!o)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(i,a){var l=af.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(l==="text")i(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return i(d.result)},!1),d.addEventListener("error",function(f){return a(f)},!1),d.readAsDataURL(s.response)}else a("Failed to proxy resource "+r+" with status code "+s.status)},s.onerror=a;var c=o.indexOf("?")>-1?"&":"?";if(s.open("GET",""+o+c+"url="+encodeURIComponent(e)+"&responseType="+l),l!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=l),n._options.imageTimeout){var u=n._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return a("Timed out ("+u+"ms) proxying "+r)}}s.send()})},t}(),Q$t=/^data:image\/svg\+xml/i,Z$t=/^data:image\/.*;base64,/i,eQt=/^data:image\/.*/i,tQt=function(t){return af.SUPPORT_SVG_DRAWING||!oQt(t)},qie=function(t){return eQt.test(t)},nQt=function(t){return Z$t.test(t)},$ie=function(t){return t.substr(0,4)==="blob"},oQt=function(t){return t.substr(-3).toLowerCase()==="svg"||Q$t.test(t)},Mr=function(){function t(e,n){this.type=0,this.x=e,this.y=n}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),GT=function(t,e,n){return new Mr(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},fO=function(){function t(e,n,o,r){this.type=1,this.start=e,this.startControl=n,this.endControl=o,this.end=r}return t.prototype.subdivide=function(e,n){var o=GT(this.start,this.startControl,e),r=GT(this.startControl,this.endControl,e),i=GT(this.endControl,this.end,e),a=GT(o,r,e),l=GT(r,i,e),s=GT(a,l,e);return n?new t(this.start,o,a,s):new t(s,l,i,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),Hm=function(t){return t.type===1},rQt=function(){function t(e){var n=e.styles,o=e.bounds,r=jD(n.borderTopLeftRadius,o.width,o.height),i=r[0],a=r[1],l=jD(n.borderTopRightRadius,o.width,o.height),s=l[0],c=l[1],u=jD(n.borderBottomRightRadius,o.width,o.height),d=u[0],f=u[1],p=jD(n.borderBottomLeftRadius,o.width,o.height),g=p[0],A=p[1],y=[];y.push((i+s)/o.width),y.push((g+d)/o.width),y.push((a+A)/o.height),y.push((c+f)/o.height);var S=Math.max.apply(Math,y);S>1&&(i/=S,a/=S,s/=S,c/=S,d/=S,f/=S,g/=S,A/=S);var C=o.width-s,P=o.height-f,v=o.width-d,T=o.height-A,w=n.borderTopWidth,x=n.borderRightWidth,b=n.borderBottomWidth,R=n.borderLeftWidth,H=Xs(n.paddingTop,e.bounds.width),F=Xs(n.paddingRight,e.bounds.width),E=Xs(n.paddingBottom,e.bounds.width),N=Xs(n.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||a>0?Fc(o.left+R/3,o.top+w/3,i-R/3,a-w/3,ts.TOP_LEFT):new Mr(o.left+R/3,o.top+w/3),this.topRightBorderDoubleOuterBox=i>0||a>0?Fc(o.left+C,o.top+w/3,s-x/3,c-w/3,ts.TOP_RIGHT):new Mr(o.left+o.width-x/3,o.top+w/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Fc(o.left+v,o.top+P,d-x/3,f-b/3,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x/3,o.top+o.height-b/3),this.bottomLeftBorderDoubleOuterBox=g>0||A>0?Fc(o.left+R/3,o.top+T,g-R/3,A-b/3,ts.BOTTOM_LEFT):new Mr(o.left+R/3,o.top+o.height-b/3),this.topLeftBorderDoubleInnerBox=i>0||a>0?Fc(o.left+R*2/3,o.top+w*2/3,i-R*2/3,a-w*2/3,ts.TOP_LEFT):new Mr(o.left+R*2/3,o.top+w*2/3),this.topRightBorderDoubleInnerBox=i>0||a>0?Fc(o.left+C,o.top+w*2/3,s-x*2/3,c-w*2/3,ts.TOP_RIGHT):new Mr(o.left+o.width-x*2/3,o.top+w*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Fc(o.left+v,o.top+P,d-x*2/3,f-b*2/3,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x*2/3,o.top+o.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||A>0?Fc(o.left+R*2/3,o.top+T,g-R*2/3,A-b*2/3,ts.BOTTOM_LEFT):new Mr(o.left+R*2/3,o.top+o.height-b*2/3),this.topLeftBorderStroke=i>0||a>0?Fc(o.left+R/2,o.top+w/2,i-R/2,a-w/2,ts.TOP_LEFT):new Mr(o.left+R/2,o.top+w/2),this.topRightBorderStroke=i>0||a>0?Fc(o.left+C,o.top+w/2,s-x/2,c-w/2,ts.TOP_RIGHT):new Mr(o.left+o.width-x/2,o.top+w/2),this.bottomRightBorderStroke=d>0||f>0?Fc(o.left+v,o.top+P,d-x/2,f-b/2,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x/2,o.top+o.height-b/2),this.bottomLeftBorderStroke=g>0||A>0?Fc(o.left+R/2,o.top+T,g-R/2,A-b/2,ts.BOTTOM_LEFT):new Mr(o.left+R/2,o.top+o.height-b/2),this.topLeftBorderBox=i>0||a>0?Fc(o.left,o.top,i,a,ts.TOP_LEFT):new Mr(o.left,o.top),this.topRightBorderBox=s>0||c>0?Fc(o.left+C,o.top,s,c,ts.TOP_RIGHT):new Mr(o.left+o.width,o.top),this.bottomRightBorderBox=d>0||f>0?Fc(o.left+v,o.top+P,d,f,ts.BOTTOM_RIGHT):new Mr(o.left+o.width,o.top+o.height),this.bottomLeftBorderBox=g>0||A>0?Fc(o.left,o.top+T,g,A,ts.BOTTOM_LEFT):new Mr(o.left,o.top+o.height),this.topLeftPaddingBox=i>0||a>0?Fc(o.left+R,o.top+w,Math.max(0,i-R),Math.max(0,a-w),ts.TOP_LEFT):new Mr(o.left+R,o.top+w),this.topRightPaddingBox=s>0||c>0?Fc(o.left+Math.min(C,o.width-x),o.top+w,C>o.width+x?0:Math.max(0,s-x),Math.max(0,c-w),ts.TOP_RIGHT):new Mr(o.left+o.width-x,o.top+w),this.bottomRightPaddingBox=d>0||f>0?Fc(o.left+Math.min(v,o.width-R),o.top+Math.min(P,o.height-b),Math.max(0,d-x),Math.max(0,f-b),ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x,o.top+o.height-b),this.bottomLeftPaddingBox=g>0||A>0?Fc(o.left+R,o.top+Math.min(T,o.height-b),Math.max(0,g-R),Math.max(0,A-b),ts.BOTTOM_LEFT):new Mr(o.left+R,o.top+o.height-b),this.topLeftContentBox=i>0||a>0?Fc(o.left+R+N,o.top+w+H,Math.max(0,i-(R+N)),Math.max(0,a-(w+H)),ts.TOP_LEFT):new Mr(o.left+R+N,o.top+w+H),this.topRightContentBox=s>0||c>0?Fc(o.left+Math.min(C,o.width+R+N),o.top+w+H,C>o.width+R+N?0:s-R+N,c-(w+H),ts.TOP_RIGHT):new Mr(o.left+o.width-(x+F),o.top+w+H),this.bottomRightContentBox=d>0||f>0?Fc(o.left+Math.min(v,o.width-(R+N)),o.top+Math.min(P,o.height+w+H),Math.max(0,d-(x+F)),f-(b+E),ts.BOTTOM_RIGHT):new Mr(o.left+o.width-(x+F),o.top+o.height-(b+E)),this.bottomLeftContentBox=g>0||A>0?Fc(o.left+R+N,o.top+T,Math.max(0,g-(R+N)),A-(b+E),ts.BOTTOM_LEFT):new Mr(o.left+R+N,o.top+o.height-(b+E))}return t}(),ts;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ts||(ts={}));var Fc=function(t,e,n,o,r){var i=4*((Math.sqrt(2)-1)/3),a=n*i,l=o*i,s=t+n,c=e+o;switch(r){case ts.TOP_LEFT:return new fO(new Mr(t,c),new Mr(t,c-l),new Mr(s-a,e),new Mr(s,e));case ts.TOP_RIGHT:return new fO(new Mr(t,e),new Mr(t+a,e),new Mr(s,c-l),new Mr(s,c));case ts.BOTTOM_RIGHT:return new fO(new Mr(s,e),new Mr(s,e+l),new Mr(t+a,c),new Mr(t,c));case ts.BOTTOM_LEFT:default:return new fO(new Mr(s,c),new Mr(s-a,c),new Mr(t,e+l),new Mr(t,e))}},aX=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},iQt=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},lX=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},aQt=function(){function t(e,n,o){this.offsetX=e,this.offsetY=n,this.matrix=o,this.type=0,this.target=6}return t}(),hO=function(){function t(e,n){this.path=e,this.target=n,this.type=1}return t}(),lQt=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),sQt=function(t){return t.type===0},r$e=function(t){return t.type===1},cQt=function(t){return t.type===2},CSe=function(t,e){return t.length===e.length?t.some(function(n,o){return n===e[o]}):!1},uQt=function(t,e,n,o,r){return t.map(function(i,a){switch(a){case 0:return i.add(e,n);case 1:return i.add(e+o,n);case 2:return i.add(e+o,n+r);case 3:return i.add(e,n+r)}return i})},i$e=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),a$e=function(){function t(e,n){if(this.container=e,this.parent=n,this.effects=[],this.curves=new rQt(this.container),this.container.styles.opacity<1&&this.effects.push(new lQt(this.container.styles.opacity)),this.container.styles.transform!==null){var o=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new aQt(o,r,i))}if(this.container.styles.overflowX!==0){var a=aX(this.curves),l=lX(this.curves);CSe(a,l)?this.effects.push(new hO(a,6)):(this.effects.push(new hO(a,2)),this.effects.push(new hO(l,4)))}}return t.prototype.getEffects=function(e){for(var n=[2,3].indexOf(this.container.styles.position)===-1,o=this.parent,r=this.effects.slice(0);o;){var i=o.effects.filter(function(s){return!r$e(s)});if(n||o.container.styles.position!==0||!o.parent){if(r.unshift.apply(r,i),n=[2,3].indexOf(o.container.styles.position)===-1,o.container.styles.overflowX!==0){var a=aX(o.curves),l=lX(o.curves);CSe(a,l)||r.unshift(new hO(l,6))}}else r.unshift.apply(r,i);o=o.parent}return r.filter(function(s){return Du(s.target,e)})},t}(),ide=function(t,e,n,o){t.container.elements.forEach(function(r){var i=Du(r.flags,4),a=Du(r.flags,2),l=new a$e(r,t);Du(r.styles.display,2048)&&o.push(l);var s=Du(r.flags,8)?[]:o;if(i||a){var c=i||r.styles.isPositioned()?n:e,u=new i$e(l);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var d=r.styles.zIndex.order;if(d<0){var f=0;c.negativeZIndex.some(function(g,A){return d>g.element.container.styles.zIndex.order?(f=A,!1):f>0}),c.negativeZIndex.splice(f,0,u)}else if(d>0){var p=0;c.positiveZIndex.some(function(g,A){return d>=g.element.container.styles.zIndex.order?(p=A+1,!1):p>0}),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);ide(l,u,i?u:n,s)}else r.styles.isInlineLevel()?e.inlineLevel.push(l):e.nonInlineLevel.push(l),ide(l,e,n,s);Du(r.flags,8)&&l$e(r,s)})},l$e=function(t,e){for(var n=t instanceof ede?t.start:1,o=t instanceof ede?t.reversed:!1,r=0;r"u"?t[0]:n},AQt=function(t,e,n,o,r){var i=e[0],a=e[1],l=n[0],s=n[1];switch(t){case 2:return[new Mr(Math.round(o.left),Math.round(o.top+a)),new Mr(Math.round(o.left+o.width),Math.round(o.top+a)),new Mr(Math.round(o.left+o.width),Math.round(s+o.top+a)),new Mr(Math.round(o.left),Math.round(s+o.top+a))];case 3:return[new Mr(Math.round(o.left+i),Math.round(o.top)),new Mr(Math.round(o.left+i+l),Math.round(o.top)),new Mr(Math.round(o.left+i+l),Math.round(o.height+o.top)),new Mr(Math.round(o.left+i),Math.round(o.height+o.top))];case 1:return[new Mr(Math.round(o.left+i),Math.round(o.top+a)),new Mr(Math.round(o.left+i+l),Math.round(o.top+a)),new Mr(Math.round(o.left+i+l),Math.round(o.top+a+s)),new Mr(Math.round(o.left+i),Math.round(o.top+a+s))];default:return[new Mr(Math.round(r.left),Math.round(r.top)),new Mr(Math.round(r.left+r.width),Math.round(r.top)),new Mr(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Mr(Math.round(r.left),Math.round(r.height+r.top))]}},wQt="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",HSe="Hidden Text",vQt=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,n){var o=this._document.createElement("div"),r=this._document.createElement("img"),i=this._document.createElement("span"),a=this._document.body;o.style.visibility="hidden",o.style.fontFamily=e,o.style.fontSize=n,o.style.margin="0",o.style.padding="0",o.style.whiteSpace="nowrap",a.appendChild(o),r.src=wQt,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",i.style.fontFamily=e,i.style.fontSize=n,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(HSe)),o.appendChild(i),o.appendChild(r);var l=r.offsetTop-i.offsetTop+2;o.removeChild(i),o.appendChild(this._document.createTextNode(HSe)),o.style.lineHeight="normal",r.style.verticalAlign="super";var s=r.offsetTop-o.offsetTop+2;return a.removeChild(o),{baseline:l,middle:s}},t.prototype.getMetrics=function(e,n){var o=e+" "+n;return typeof this._data[o]>"u"&&(this._data[o]=this.parseMetrics(e,n)),this._data[o]},t}(),c$e=function(){function t(e,n){this.context=e,this.options=n}return t}(),xQt=1e4,bQt=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r._activeEffects=[],r.canvas=o.canvas?o.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),o.canvas||(r.canvas.width=Math.floor(o.width*o.scale),r.canvas.height=Math.floor(o.height*o.scale),r.canvas.style.width=o.width+"px",r.canvas.style.height=o.height+"px"),r.fontMetrics=new vQt(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-o.x,-o.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+o.width+"x"+o.height+") with scale "+o.scale),r}return e.prototype.applyEffects=function(n){for(var o=this;this._activeEffects.length;)this.popEffect();n.forEach(function(r){return o.applyEffect(r)})},e.prototype.applyEffect=function(n){this.ctx.save(),cQt(n)&&(this.ctx.globalAlpha=n.opacity),sQt(n)&&(this.ctx.translate(n.offsetX,n.offsetY),this.ctx.transform(n.matrix[0],n.matrix[1],n.matrix[2],n.matrix[3],n.matrix[4],n.matrix[5]),this.ctx.translate(-n.offsetX,-n.offsetY)),r$e(n)&&(this.path(n.path),this.ctx.clip()),this._activeEffects.push(n)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(n){return Jh(this,void 0,void 0,function(){var o;return qf(this,function(r){switch(r.label){case 0:return o=n.element.container.styles,o.isVisible()?[4,this.renderStackContent(n)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(n){return Jh(this,void 0,void 0,function(){return qf(this,function(o){switch(o.label){case 0:if(Du(n.container.flags,16))debugger;return n.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(n)]:[3,3];case 1:return o.sent(),[4,this.renderNodeContent(n)];case 2:o.sent(),o.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(n,o,r){var i=this;if(o===0)this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+r);else{var a=Lye(n.text);a.reduce(function(l,s){return i.ctx.fillText(s,l,n.bounds.top+r),l+i.ctx.measureText(s).width},n.bounds.left)}},e.prototype.createFontStyle=function(n){var o=n.fontVariant.filter(function(a){return a==="normal"||a==="small-caps"}).join(""),r=RQt(n.fontFamily).join(", "),i=lN(n.fontSize)?""+n.fontSize.number+n.fontSize.unit:n.fontSize.number+"px";return[[n.fontStyle,o,n.fontWeight,i,r].join(" "),r,i]},e.prototype.renderTextNode=function(n,o){return Jh(this,void 0,void 0,function(){var r,i,a,l,s,c,u,d,f=this;return qf(this,function(p){return r=this.createFontStyle(o),i=r[0],a=r[1],l=r[2],this.ctx.font=i,this.ctx.direction=o.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(a,l),c=s.baseline,u=s.middle,d=o.paintOrder,n.textBounds.forEach(function(g){d.forEach(function(A){switch(A){case 0:f.ctx.fillStyle=hd(o.color),f.renderTextWithLetterSpacing(g,o.letterSpacing,c);var y=o.textShadow;y.length&&g.text.trim().length&&(y.slice(0).reverse().forEach(function(S){f.ctx.shadowColor=hd(S.color),f.ctx.shadowOffsetX=S.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=S.offsetY.number*f.options.scale,f.ctx.shadowBlur=S.blur.number,f.renderTextWithLetterSpacing(g,o.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),o.textDecorationLine.length&&(f.ctx.fillStyle=hd(o.textDecorationColor||o.color),o.textDecorationLine.forEach(function(S){switch(S){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+c),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+u),g.bounds.width,1);break}}));break;case 1:o.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=hd(o.webkitTextStrokeColor),f.ctx.lineWidth=o.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(n,o,r){if(r&&n.intrinsicWidth>0&&n.intrinsicHeight>0){var i=sX(n),a=lX(o);this.path(a),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,n.intrinsicWidth,n.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(n){return Jh(this,void 0,void 0,function(){var o,r,i,a,l,s,C,C,c,u,d,f,v,p,g,T,A,y,S,C,P,v,T;return qf(this,function(w){switch(w.label){case 0:this.applyEffects(n.getEffects(4)),o=n.container,r=n.curves,i=o.styles,a=0,l=o.textNodes,w.label=1;case 1:return a0&&U>0&&(b=i.ctx.createPattern(T,"repeat"),i.renderRepeat(H,b,k,D))):cKt(u)&&(R=Qie(n,o,[null,null,null]),H=R[0],F=R[1],E=R[2],N=R[3],U=R[4],W=u.position.length===0?[Eye]:u.position,k=Xs(W[0],N),D=Xs(W[W.length-1],U),L=rKt(u,k,D,N,U),j=L[0],B=L[1],j>0&&B>0&&(O=i.ctx.createRadialGradient(F+k,E+D,0,F+k,E+D,j),qbe(u.stops,j*2).forEach(function(Q){return O.addColorStop(Q.stop,hd(Q.color))}),i.path(H),i.ctx.fillStyle=O,j!==B?(V=n.bounds.left+.5*n.bounds.width,G=n.bounds.top+.5*n.bounds.height,q=B/j,$=1/q,i.ctx.save(),i.ctx.translate(V,G),i.ctx.transform(1,0,0,q,0,0),i.ctx.translate(-V,-G),i.ctx.fillRect(F,$*(E-G)+G,N,U*$),i.ctx.restore()):i.ctx.fill())),ie.label=6;case 6:return o--,[2]}})},i=this,a=0,l=n.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return a0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,3)];case 6:return f.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,l,n.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,l,n.curves)];case 10:f.sent(),f.label=11;case 11:l++,f.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(n,o,r,i,a){return Jh(this,void 0,void 0,function(){var l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,T,w;return qf(this,function(x){return this.ctx.save(),l=pQt(i,r),s=RSe(i,r),a===2&&(this.path(s),this.ctx.clip()),Hm(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),Hm(s[1])?(d=s[1].end.x,f=s[1].end.y):(d=s[1].x,f=s[1].y),r===0||r===2?p=Math.abs(c-d):p=Math.abs(u-f),this.ctx.beginPath(),a===3?this.formatPath(l):this.formatPath(s.slice(0,2)),g=o<3?o*3:o*2,A=o<3?o*2:o,a===3&&(g=o,A=o),y=!0,p<=g*2?y=!1:p<=g*2+A?(S=p/(2*g+A),g*=S,A*=S):(C=Math.floor((p+A)/(g+A)),P=(p-C*g)/(C-1),v=(p-(C+1)*g)/C,A=v<=0||Math.abs(A-P)"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function o(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){s(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function i(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof yc=="object"&&yc.global===yc?yc:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,d){var f=a.URL||a.webkitURL,p=document.createElement("a");u=u||c.name||"download",p.download=u,p.rel="noopener",typeof c=="string"?(p.href=c,p.origin===location.origin?i(p):r(p.href)?o(c,u,d):i(p,p.target="_blank")):(p.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){i(p)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,d),u);else if(r(c))o(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){i(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return o(c,u,d);var p=c.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,A=/CriOS\/[\d]+/.test(navigator.userAgent);if((A||p&&g||l)&&typeof FileReader<"u"){var y=new FileReader;y.onloadend=function(){var P=y.result;P=A?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=P:location=P,f=null},y.readAsDataURL(c)}else{var S=a.URL||a.webkitURL,C=S.createObjectURL(c);f?f.location=C:location.href=C,f=null,setTimeout(function(){S.revokeObjectURL(C)},4e4)}});a.saveAs=s.saveAs=s,t.exports=s})})(u$e);var d$e=u$e.exports;const kQt=()=>{window.open("https://intofuture.org/aladdin.html","_blank")},LQt=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",WQt=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&style=feature:poi|element:labels|visibility:off¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",S2=(t,e)=>{iA.success({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},gn=(t,e)=>{iA.info({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},PR=(t,e)=>{iA.warning({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},co=(t,e)=>{iA.error({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},NQt=(t,e)=>{const n=document.createElement("a");n.download=t,n.href=e,n.click()},Ed=async(t,e,n)=>{const o=window.document.getElementById(t);if(o){const r=await DQt(o,{...n,removeContainer:!0}),i=document.createElement("a");i.href=r.toDataURL("image/png",1),i.download=`${e}.png`,i.click()}else throw new Error(`Cannot find element with ID ${t}`)},Sh=(t,e)=>{let n="";for(const r of Object.keys(t[0]))n+=r+", ";n+=` + .`+rde+J$t+PSe)},q$t=function(t,e){var n=t.ownerDocument;if(n){var o=n.createElement("style");o.textContent=e,t.appendChild(o)}},o$e=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),$$t=function(){function t(e,n){this.context=e,this._options=n,this._cache={}}return t.prototype.addImage=function(e){var n=Promise.resolve();return this.has(e)||($ie(e)||tQt(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),n},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Jh(this,void 0,void 0,function(){var n,o,r,i,a=this;return $f(this,function(l){switch(l.label){case 0:return n=o$e.isSameOrigin(e),o=!qie(e)&&this._options.useCORS===!0&&af.SUPPORT_CORS_IMAGES&&!n,r=!qie(e)&&!n&&!$ie(e)&&typeof this._options.proxy=="string"&&af.SUPPORT_CORS_XHR&&!o,!n&&this._options.allowTaint===!1&&!qie(e)&&!$ie(e)&&!r&&!o?[2]:(i=e,r?[4,this.proxy(i)]:[3,2]);case 1:i=l.sent(),l.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(s,c){var u=new Image;u.onload=function(){return s(u)},u.onerror=c,(nQt(i)||o)&&(u.crossOrigin="anonymous"),u.src=i,u.complete===!0&&setTimeout(function(){return s(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+a._options.imageTimeout+"ms) loading image")},a._options.imageTimeout)})];case 3:return[2,l.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var n=this,o=this._options.proxy;if(!o)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(i,a){var l=af.SUPPORT_RESPONSE_TYPE?"blob":"text",s=new XMLHttpRequest;s.onload=function(){if(s.status===200)if(l==="text")i(s.response);else{var d=new FileReader;d.addEventListener("load",function(){return i(d.result)},!1),d.addEventListener("error",function(f){return a(f)},!1),d.readAsDataURL(s.response)}else a("Failed to proxy resource "+r+" with status code "+s.status)},s.onerror=a;var c=o.indexOf("?")>-1?"&":"?";if(s.open("GET",""+o+c+"url="+encodeURIComponent(e)+"&responseType="+l),l!=="text"&&s instanceof XMLHttpRequest&&(s.responseType=l),n._options.imageTimeout){var u=n._options.imageTimeout;s.timeout=u,s.ontimeout=function(){return a("Timed out ("+u+"ms) proxying "+r)}}s.send()})},t}(),Q$t=/^data:image\/svg\+xml/i,Z$t=/^data:image\/.*;base64,/i,eQt=/^data:image\/.*/i,tQt=function(t){return af.SUPPORT_SVG_DRAWING||!oQt(t)},qie=function(t){return eQt.test(t)},nQt=function(t){return Z$t.test(t)},$ie=function(t){return t.substr(0,4)==="blob"},oQt=function(t){return t.substr(-3).toLowerCase()==="svg"||Q$t.test(t)},Mr=function(){function t(e,n){this.type=0,this.x=e,this.y=n}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),GT=function(t,e,n){return new Mr(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},fO=function(){function t(e,n,o,r){this.type=1,this.start=e,this.startControl=n,this.endControl=o,this.end=r}return t.prototype.subdivide=function(e,n){var o=GT(this.start,this.startControl,e),r=GT(this.startControl,this.endControl,e),i=GT(this.endControl,this.end,e),a=GT(o,r,e),l=GT(r,i,e),s=GT(a,l,e);return n?new t(this.start,o,a,s):new t(s,l,i,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),Hm=function(t){return t.type===1},rQt=function(){function t(e){var n=e.styles,o=e.bounds,r=jD(n.borderTopLeftRadius,o.width,o.height),i=r[0],a=r[1],l=jD(n.borderTopRightRadius,o.width,o.height),s=l[0],c=l[1],u=jD(n.borderBottomRightRadius,o.width,o.height),d=u[0],f=u[1],p=jD(n.borderBottomLeftRadius,o.width,o.height),g=p[0],A=p[1],y=[];y.push((i+s)/o.width),y.push((g+d)/o.width),y.push((a+A)/o.height),y.push((c+f)/o.height);var S=Math.max.apply(Math,y);S>1&&(i/=S,a/=S,s/=S,c/=S,d/=S,f/=S,g/=S,A/=S);var C=o.width-s,P=o.height-f,v=o.width-d,T=o.height-A,w=n.borderTopWidth,x=n.borderRightWidth,b=n.borderBottomWidth,R=n.borderLeftWidth,H=Xs(n.paddingTop,e.bounds.width),F=Xs(n.paddingRight,e.bounds.width),E=Xs(n.paddingBottom,e.bounds.width),N=Xs(n.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||a>0?Fc(o.left+R/3,o.top+w/3,i-R/3,a-w/3,ts.TOP_LEFT):new Mr(o.left+R/3,o.top+w/3),this.topRightBorderDoubleOuterBox=i>0||a>0?Fc(o.left+C,o.top+w/3,s-x/3,c-w/3,ts.TOP_RIGHT):new Mr(o.left+o.width-x/3,o.top+w/3),this.bottomRightBorderDoubleOuterBox=d>0||f>0?Fc(o.left+v,o.top+P,d-x/3,f-b/3,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x/3,o.top+o.height-b/3),this.bottomLeftBorderDoubleOuterBox=g>0||A>0?Fc(o.left+R/3,o.top+T,g-R/3,A-b/3,ts.BOTTOM_LEFT):new Mr(o.left+R/3,o.top+o.height-b/3),this.topLeftBorderDoubleInnerBox=i>0||a>0?Fc(o.left+R*2/3,o.top+w*2/3,i-R*2/3,a-w*2/3,ts.TOP_LEFT):new Mr(o.left+R*2/3,o.top+w*2/3),this.topRightBorderDoubleInnerBox=i>0||a>0?Fc(o.left+C,o.top+w*2/3,s-x*2/3,c-w*2/3,ts.TOP_RIGHT):new Mr(o.left+o.width-x*2/3,o.top+w*2/3),this.bottomRightBorderDoubleInnerBox=d>0||f>0?Fc(o.left+v,o.top+P,d-x*2/3,f-b*2/3,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x*2/3,o.top+o.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||A>0?Fc(o.left+R*2/3,o.top+T,g-R*2/3,A-b*2/3,ts.BOTTOM_LEFT):new Mr(o.left+R*2/3,o.top+o.height-b*2/3),this.topLeftBorderStroke=i>0||a>0?Fc(o.left+R/2,o.top+w/2,i-R/2,a-w/2,ts.TOP_LEFT):new Mr(o.left+R/2,o.top+w/2),this.topRightBorderStroke=i>0||a>0?Fc(o.left+C,o.top+w/2,s-x/2,c-w/2,ts.TOP_RIGHT):new Mr(o.left+o.width-x/2,o.top+w/2),this.bottomRightBorderStroke=d>0||f>0?Fc(o.left+v,o.top+P,d-x/2,f-b/2,ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x/2,o.top+o.height-b/2),this.bottomLeftBorderStroke=g>0||A>0?Fc(o.left+R/2,o.top+T,g-R/2,A-b/2,ts.BOTTOM_LEFT):new Mr(o.left+R/2,o.top+o.height-b/2),this.topLeftBorderBox=i>0||a>0?Fc(o.left,o.top,i,a,ts.TOP_LEFT):new Mr(o.left,o.top),this.topRightBorderBox=s>0||c>0?Fc(o.left+C,o.top,s,c,ts.TOP_RIGHT):new Mr(o.left+o.width,o.top),this.bottomRightBorderBox=d>0||f>0?Fc(o.left+v,o.top+P,d,f,ts.BOTTOM_RIGHT):new Mr(o.left+o.width,o.top+o.height),this.bottomLeftBorderBox=g>0||A>0?Fc(o.left,o.top+T,g,A,ts.BOTTOM_LEFT):new Mr(o.left,o.top+o.height),this.topLeftPaddingBox=i>0||a>0?Fc(o.left+R,o.top+w,Math.max(0,i-R),Math.max(0,a-w),ts.TOP_LEFT):new Mr(o.left+R,o.top+w),this.topRightPaddingBox=s>0||c>0?Fc(o.left+Math.min(C,o.width-x),o.top+w,C>o.width+x?0:Math.max(0,s-x),Math.max(0,c-w),ts.TOP_RIGHT):new Mr(o.left+o.width-x,o.top+w),this.bottomRightPaddingBox=d>0||f>0?Fc(o.left+Math.min(v,o.width-R),o.top+Math.min(P,o.height-b),Math.max(0,d-x),Math.max(0,f-b),ts.BOTTOM_RIGHT):new Mr(o.left+o.width-x,o.top+o.height-b),this.bottomLeftPaddingBox=g>0||A>0?Fc(o.left+R,o.top+Math.min(T,o.height-b),Math.max(0,g-R),Math.max(0,A-b),ts.BOTTOM_LEFT):new Mr(o.left+R,o.top+o.height-b),this.topLeftContentBox=i>0||a>0?Fc(o.left+R+N,o.top+w+H,Math.max(0,i-(R+N)),Math.max(0,a-(w+H)),ts.TOP_LEFT):new Mr(o.left+R+N,o.top+w+H),this.topRightContentBox=s>0||c>0?Fc(o.left+Math.min(C,o.width+R+N),o.top+w+H,C>o.width+R+N?0:s-R+N,c-(w+H),ts.TOP_RIGHT):new Mr(o.left+o.width-(x+F),o.top+w+H),this.bottomRightContentBox=d>0||f>0?Fc(o.left+Math.min(v,o.width-(R+N)),o.top+Math.min(P,o.height+w+H),Math.max(0,d-(x+F)),f-(b+E),ts.BOTTOM_RIGHT):new Mr(o.left+o.width-(x+F),o.top+o.height-(b+E)),this.bottomLeftContentBox=g>0||A>0?Fc(o.left+R+N,o.top+T,Math.max(0,g-(R+N)),A-(b+E),ts.BOTTOM_LEFT):new Mr(o.left+R+N,o.top+o.height-(b+E))}return t}(),ts;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ts||(ts={}));var Fc=function(t,e,n,o,r){var i=4*((Math.sqrt(2)-1)/3),a=n*i,l=o*i,s=t+n,c=e+o;switch(r){case ts.TOP_LEFT:return new fO(new Mr(t,c),new Mr(t,c-l),new Mr(s-a,e),new Mr(s,e));case ts.TOP_RIGHT:return new fO(new Mr(t,e),new Mr(t+a,e),new Mr(s,c-l),new Mr(s,c));case ts.BOTTOM_RIGHT:return new fO(new Mr(s,e),new Mr(s,e+l),new Mr(t+a,c),new Mr(t,c));case ts.BOTTOM_LEFT:default:return new fO(new Mr(s,c),new Mr(s-a,c),new Mr(t,e+l),new Mr(t,e))}},aX=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},iQt=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},lX=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},aQt=function(){function t(e,n,o){this.offsetX=e,this.offsetY=n,this.matrix=o,this.type=0,this.target=6}return t}(),hO=function(){function t(e,n){this.path=e,this.target=n,this.type=1}return t}(),lQt=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),sQt=function(t){return t.type===0},r$e=function(t){return t.type===1},cQt=function(t){return t.type===2},CSe=function(t,e){return t.length===e.length?t.some(function(n,o){return n===e[o]}):!1},uQt=function(t,e,n,o,r){return t.map(function(i,a){switch(a){case 0:return i.add(e,n);case 1:return i.add(e+o,n);case 2:return i.add(e+o,n+r);case 3:return i.add(e,n+r)}return i})},i$e=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),a$e=function(){function t(e,n){if(this.container=e,this.parent=n,this.effects=[],this.curves=new rQt(this.container),this.container.styles.opacity<1&&this.effects.push(new lQt(this.container.styles.opacity)),this.container.styles.transform!==null){var o=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new aQt(o,r,i))}if(this.container.styles.overflowX!==0){var a=aX(this.curves),l=lX(this.curves);CSe(a,l)?this.effects.push(new hO(a,6)):(this.effects.push(new hO(a,2)),this.effects.push(new hO(l,4)))}}return t.prototype.getEffects=function(e){for(var n=[2,3].indexOf(this.container.styles.position)===-1,o=this.parent,r=this.effects.slice(0);o;){var i=o.effects.filter(function(s){return!r$e(s)});if(n||o.container.styles.position!==0||!o.parent){if(r.unshift.apply(r,i),n=[2,3].indexOf(o.container.styles.position)===-1,o.container.styles.overflowX!==0){var a=aX(o.curves),l=lX(o.curves);CSe(a,l)||r.unshift(new hO(l,6))}}else r.unshift.apply(r,i);o=o.parent}return r.filter(function(s){return Du(s.target,e)})},t}(),ide=function(t,e,n,o){t.container.elements.forEach(function(r){var i=Du(r.flags,4),a=Du(r.flags,2),l=new a$e(r,t);Du(r.styles.display,2048)&&o.push(l);var s=Du(r.flags,8)?[]:o;if(i||a){var c=i||r.styles.isPositioned()?n:e,u=new i$e(l);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var d=r.styles.zIndex.order;if(d<0){var f=0;c.negativeZIndex.some(function(g,A){return d>g.element.container.styles.zIndex.order?(f=A,!1):f>0}),c.negativeZIndex.splice(f,0,u)}else if(d>0){var p=0;c.positiveZIndex.some(function(g,A){return d>=g.element.container.styles.zIndex.order?(p=A+1,!1):p>0}),c.positiveZIndex.splice(p,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);ide(l,u,i?u:n,s)}else r.styles.isInlineLevel()?e.inlineLevel.push(l):e.nonInlineLevel.push(l),ide(l,e,n,s);Du(r.flags,8)&&l$e(r,s)})},l$e=function(t,e){for(var n=t instanceof ede?t.start:1,o=t instanceof ede?t.reversed:!1,r=0;r"u"?t[0]:n},AQt=function(t,e,n,o,r){var i=e[0],a=e[1],l=n[0],s=n[1];switch(t){case 2:return[new Mr(Math.round(o.left),Math.round(o.top+a)),new Mr(Math.round(o.left+o.width),Math.round(o.top+a)),new Mr(Math.round(o.left+o.width),Math.round(s+o.top+a)),new Mr(Math.round(o.left),Math.round(s+o.top+a))];case 3:return[new Mr(Math.round(o.left+i),Math.round(o.top)),new Mr(Math.round(o.left+i+l),Math.round(o.top)),new Mr(Math.round(o.left+i+l),Math.round(o.height+o.top)),new Mr(Math.round(o.left+i),Math.round(o.height+o.top))];case 1:return[new Mr(Math.round(o.left+i),Math.round(o.top+a)),new Mr(Math.round(o.left+i+l),Math.round(o.top+a)),new Mr(Math.round(o.left+i+l),Math.round(o.top+a+s)),new Mr(Math.round(o.left+i),Math.round(o.top+a+s))];default:return[new Mr(Math.round(r.left),Math.round(r.top)),new Mr(Math.round(r.left+r.width),Math.round(r.top)),new Mr(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Mr(Math.round(r.left),Math.round(r.height+r.top))]}},wQt="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",HSe="Hidden Text",vQt=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,n){var o=this._document.createElement("div"),r=this._document.createElement("img"),i=this._document.createElement("span"),a=this._document.body;o.style.visibility="hidden",o.style.fontFamily=e,o.style.fontSize=n,o.style.margin="0",o.style.padding="0",o.style.whiteSpace="nowrap",a.appendChild(o),r.src=wQt,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",i.style.fontFamily=e,i.style.fontSize=n,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(HSe)),o.appendChild(i),o.appendChild(r);var l=r.offsetTop-i.offsetTop+2;o.removeChild(i),o.appendChild(this._document.createTextNode(HSe)),o.style.lineHeight="normal",r.style.verticalAlign="super";var s=r.offsetTop-o.offsetTop+2;return a.removeChild(o),{baseline:l,middle:s}},t.prototype.getMetrics=function(e,n){var o=e+" "+n;return typeof this._data[o]>"u"&&(this._data[o]=this.parseMetrics(e,n)),this._data[o]},t}(),c$e=function(){function t(e,n){this.context=e,this.options=n}return t}(),xQt=1e4,bQt=function(t){i5(e,t);function e(n,o){var r=t.call(this,n,o)||this;return r._activeEffects=[],r.canvas=o.canvas?o.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),o.canvas||(r.canvas.width=Math.floor(o.width*o.scale),r.canvas.height=Math.floor(o.height*o.scale),r.canvas.style.width=o.width+"px",r.canvas.style.height=o.height+"px"),r.fontMetrics=new vQt(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-o.x,-o.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+o.width+"x"+o.height+") with scale "+o.scale),r}return e.prototype.applyEffects=function(n){for(var o=this;this._activeEffects.length;)this.popEffect();n.forEach(function(r){return o.applyEffect(r)})},e.prototype.applyEffect=function(n){this.ctx.save(),cQt(n)&&(this.ctx.globalAlpha=n.opacity),sQt(n)&&(this.ctx.translate(n.offsetX,n.offsetY),this.ctx.transform(n.matrix[0],n.matrix[1],n.matrix[2],n.matrix[3],n.matrix[4],n.matrix[5]),this.ctx.translate(-n.offsetX,-n.offsetY)),r$e(n)&&(this.path(n.path),this.ctx.clip()),this._activeEffects.push(n)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(n){return Jh(this,void 0,void 0,function(){var o;return $f(this,function(r){switch(r.label){case 0:return o=n.element.container.styles,o.isVisible()?[4,this.renderStackContent(n)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(n){return Jh(this,void 0,void 0,function(){return $f(this,function(o){switch(o.label){case 0:if(Du(n.container.flags,16))debugger;return n.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(n)]:[3,3];case 1:return o.sent(),[4,this.renderNodeContent(n)];case 2:o.sent(),o.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(n,o,r){var i=this;if(o===0)this.ctx.fillText(n.text,n.bounds.left,n.bounds.top+r);else{var a=Lye(n.text);a.reduce(function(l,s){return i.ctx.fillText(s,l,n.bounds.top+r),l+i.ctx.measureText(s).width},n.bounds.left)}},e.prototype.createFontStyle=function(n){var o=n.fontVariant.filter(function(a){return a==="normal"||a==="small-caps"}).join(""),r=RQt(n.fontFamily).join(", "),i=lN(n.fontSize)?""+n.fontSize.number+n.fontSize.unit:n.fontSize.number+"px";return[[n.fontStyle,o,n.fontWeight,i,r].join(" "),r,i]},e.prototype.renderTextNode=function(n,o){return Jh(this,void 0,void 0,function(){var r,i,a,l,s,c,u,d,f=this;return $f(this,function(p){return r=this.createFontStyle(o),i=r[0],a=r[1],l=r[2],this.ctx.font=i,this.ctx.direction=o.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",s=this.fontMetrics.getMetrics(a,l),c=s.baseline,u=s.middle,d=o.paintOrder,n.textBounds.forEach(function(g){d.forEach(function(A){switch(A){case 0:f.ctx.fillStyle=hd(o.color),f.renderTextWithLetterSpacing(g,o.letterSpacing,c);var y=o.textShadow;y.length&&g.text.trim().length&&(y.slice(0).reverse().forEach(function(S){f.ctx.shadowColor=hd(S.color),f.ctx.shadowOffsetX=S.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=S.offsetY.number*f.options.scale,f.ctx.shadowBlur=S.blur.number,f.renderTextWithLetterSpacing(g,o.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),o.textDecorationLine.length&&(f.ctx.fillStyle=hd(o.textDecorationColor||o.color),o.textDecorationLine.forEach(function(S){switch(S){case 1:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top+c),g.bounds.width,1);break;case 2:f.ctx.fillRect(g.bounds.left,Math.round(g.bounds.top),g.bounds.width,1);break;case 3:f.ctx.fillRect(g.bounds.left,Math.ceil(g.bounds.top+u),g.bounds.width,1);break}}));break;case 1:o.webkitTextStrokeWidth&&g.text.trim().length&&(f.ctx.strokeStyle=hd(o.webkitTextStrokeColor),f.ctx.lineWidth=o.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(g.text,g.bounds.left,g.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(n,o,r){if(r&&n.intrinsicWidth>0&&n.intrinsicHeight>0){var i=sX(n),a=lX(o);this.path(a),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,n.intrinsicWidth,n.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(n){return Jh(this,void 0,void 0,function(){var o,r,i,a,l,s,C,C,c,u,d,f,v,p,g,T,A,y,S,C,P,v,T;return $f(this,function(w){switch(w.label){case 0:this.applyEffects(n.getEffects(4)),o=n.container,r=n.curves,i=o.styles,a=0,l=o.textNodes,w.label=1;case 1:return a0&&U>0&&(b=i.ctx.createPattern(T,"repeat"),i.renderRepeat(H,b,k,D))):cKt(u)&&(R=Qie(n,o,[null,null,null]),H=R[0],F=R[1],E=R[2],N=R[3],U=R[4],W=u.position.length===0?[Eye]:u.position,k=Xs(W[0],N),D=Xs(W[W.length-1],U),L=rKt(u,k,D,N,U),j=L[0],B=L[1],j>0&&B>0&&(O=i.ctx.createRadialGradient(F+k,E+D,0,F+k,E+D,j),qbe(u.stops,j*2).forEach(function(Q){return O.addColorStop(Q.stop,hd(Q.color))}),i.path(H),i.ctx.fillStyle=O,j!==B?(V=n.bounds.left+.5*n.bounds.width,G=n.bounds.top+.5*n.bounds.height,q=B/j,$=1/q,i.ctx.save(),i.ctx.translate(V,G),i.ctx.transform(1,0,0,q,0,0),i.ctx.translate(-V,-G),i.ctx.fillRect(F,$*(E-G)+G,N,U*$),i.ctx.restore()):i.ctx.fill())),ie.label=6;case 6:return o--,[2]}})},i=this,a=0,l=n.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return a0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,l,n.curves,3)];case 6:return f.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,l,n.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,l,n.curves)];case 10:f.sent(),f.label=11;case 11:l++,f.label=12;case 12:return s++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(n,o,r,i,a){return Jh(this,void 0,void 0,function(){var l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,T,w;return $f(this,function(x){return this.ctx.save(),l=pQt(i,r),s=RSe(i,r),a===2&&(this.path(s),this.ctx.clip()),Hm(s[0])?(c=s[0].start.x,u=s[0].start.y):(c=s[0].x,u=s[0].y),Hm(s[1])?(d=s[1].end.x,f=s[1].end.y):(d=s[1].x,f=s[1].y),r===0||r===2?p=Math.abs(c-d):p=Math.abs(u-f),this.ctx.beginPath(),a===3?this.formatPath(l):this.formatPath(s.slice(0,2)),g=o<3?o*3:o*2,A=o<3?o*2:o,a===3&&(g=o,A=o),y=!0,p<=g*2?y=!1:p<=g*2+A?(S=p/(2*g+A),g*=S,A*=S):(C=Math.floor((p+A)/(g+A)),P=(p-C*g)/(C-1),v=(p-(C+1)*g)/C,A=v<=0||Math.abs(A-P)"u"?u={autoBom:!1}:typeof u!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(c.type)?new Blob(["\uFEFF",c],{type:c.type}):c}function o(c,u,d){var f=new XMLHttpRequest;f.open("GET",c),f.responseType="blob",f.onload=function(){s(f.response,u,d)},f.onerror=function(){console.error("could not download file")},f.send()}function r(c){var u=new XMLHttpRequest;u.open("HEAD",c,!1);try{u.send()}catch{}return 200<=u.status&&299>=u.status}function i(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var u=document.createEvent("MouseEvents");u.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(u)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof yc=="object"&&yc.global===yc?yc:void 0,l=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(c,u,d){var f=a.URL||a.webkitURL,p=document.createElement("a");u=u||c.name||"download",p.download=u,p.rel="noopener",typeof c=="string"?(p.href=c,p.origin===location.origin?i(p):r(p.href)?o(c,u,d):i(p,p.target="_blank")):(p.href=f.createObjectURL(c),setTimeout(function(){f.revokeObjectURL(p.href)},4e4),setTimeout(function(){i(p)},0))}:"msSaveOrOpenBlob"in navigator?function(c,u,d){if(u=u||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,d),u);else if(r(c))o(c,u,d);else{var f=document.createElement("a");f.href=c,f.target="_blank",setTimeout(function(){i(f)})}}:function(c,u,d,f){if(f=f||open("","_blank"),f&&(f.document.title=f.document.body.innerText="downloading..."),typeof c=="string")return o(c,u,d);var p=c.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,A=/CriOS\/[\d]+/.test(navigator.userAgent);if((A||p&&g||l)&&typeof FileReader<"u"){var y=new FileReader;y.onloadend=function(){var P=y.result;P=A?P:P.replace(/^data:[^;]*;/,"data:attachment/file;"),f?f.location.href=P:location=P,f=null},y.readAsDataURL(c)}else{var S=a.URL||a.webkitURL,C=S.createObjectURL(c);f?f.location=C:location.href=C,f=null,setTimeout(function(){S.revokeObjectURL(C)},4e4)}});a.saveAs=s.saveAs=s,t.exports=s})})(u$e);var d$e=u$e.exports;const kQt=()=>{window.open("https://intofuture.org/aladdin.html","_blank")},LQt=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",WQt=(t,e,n,o)=>"https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&style=feature:poi|element:labels|visibility:off¢er="+e+","+n+"&zoom="+o+"&size="+t+"x"+t+"&scale=2&key=AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",S2=(t,e)=>{iA.success({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},gn=(t,e)=>{iA.info({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},PR=(t,e)=>{iA.warning({duration:2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},co=(t,e)=>{iA.error({duration:e??2,content:t,className:"custom-class",style:{marginTop:"20vh"},onClick:()=>{iA.destroy()}})},NQt=(t,e)=>{const n=document.createElement("a");n.download=t,n.href=e,n.click()},Ed=async(t,e,n)=>{const o=window.document.getElementById(t);if(o){const r=await DQt(o,{...n,removeContainer:!0}),i=document.createElement("a");i.href=r.toDataURL("image/png",1),i.download=`${e}.png`,i.click()}else throw new Error(`Cannot find element with ID ${t}`)},Sh=(t,e)=>{let n="";for(const r of Object.keys(t[0]))n+=r+", ";n+=` `;for(const r of t){for(const i of Object.values(r))n+=i+", ";n+=` -`}const o=new Blob([n],{type:"text/csv;charset=utf-8"});d$e.saveAs(o,e)},sl=new ae,i9=new ae,ade=new ae,cX=new ae,Hu=new ln,yd=new Ts,Uye="/aladdin/assets/wall_edge-B4PmTeCj.png",UQt="/aladdin/assets/wall_01-B-g_tqAI.png",jQt="/aladdin/assets/wall_02-9M_qG3R_.png",BQt="/aladdin/assets/wall_03-ChpvVFgd.png",YQt="/aladdin/assets/wall_04-BkmmH41c.png",OQt="/aladdin/assets/wall_05-DFi74_0h.png",VQt="/aladdin/assets/wall_06-CtX-9FCz.png",_Qt="/aladdin/assets/wall_07-CJgSaJ5B.png",GQt="/aladdin/assets/wall_08-DwhD-VRH.png",XQt="/aladdin/assets/wall_09-D3ncCSYQ.png",JQt="/aladdin/assets/wall_10-RK6QVYt5.png",KQt=(t,e,n,o)=>{const r=c=>c.parentId===t||c.id===o,i=M(c=>{if(e){for(const u of c.elements)if(u.id===e)return u}return null}),a=M(c=>{if(n){for(const u of c.elements)if(u.id===n)return u}return null}),l=M(c=>JSON.stringify(c.elements.filter(r)));return{elementsOnWall:m.useMemo(()=>M.getState().elements.filter(c=>r(c)&&ye.isLegalOnWall(c.type)),[l]),leftWall:i,rightWall:a}},a5=(t=.3)=>{const e=M(i=>i.viewState.orthographic),n=M(i=>i.viewState.cameraPosition),o=M(i=>i.viewState.cameraZoom);let r;if(e)r=Math.max(t,15/o);else{const i=M.getState().viewState.panCenter,a=new ae(...i),s=new ae(...n).distanceTo(a);r=Math.max(t,s/100)}return r},f$e=(t,e)=>{const n=m.useMemo(()=>new cf,[]);return m.useMemo(()=>{let o;switch(t){case Bo.Default:o=Uye;break;case Bo.NoTexture:o=og;break;case Bo.Texture01:o=UQt;break;case Bo.Texture02:o=jQt;break;case Bo.Texture03:o=BQt;break;case Bo.Texture04:o=YQt;break;case Bo.Texture05:o=OQt;break;case Bo.Texture06:o=VQt;break;case Bo.Texture07:o=_Qt;break;case Bo.Texture08:o=GQt;break;case Bo.Texture09:o=XQt;break;case Bo.Texture10:o=JQt;break;default:o=og}return e===gc.Stud&&(o=og),n.load(o,r=>{r.wrapS=r.wrapT=bs,r.offset.set(0,0);let i=.6,a=.6;switch(t){case Bo.Default:i=2,a=2;break;case Bo.Texture03:i=2,a=1;break;case Bo.Texture06:i=1,a=1;break}r.repeat.set(i,a),op()})},[t,e])},h$e=t=>{const e=m.useRef(!0);dt(o=>o.foundationMovedFlag);let n=t;if(!e.current){const o=M.getState().elements.find(r=>r.id===t.id&&r.type===z.Foundation);o&&(n=o)}return e.current=!1,n},zK=class zK{static getIntersectionObjects(e){return e.intersections.filter(n=>n.eventObject.name.includes("Cuboid")||n.eventObject.name==="Foundation"||n.eventObject.name.includes("Roof")||n.eventObject.name.includes(zK.WALL_OUTSIDE_SURFACE_MESH_NAME))}static addUndoableMove(){const e=M.getState().selectedElement;if(!e)return;const n=M.getState().getElementById(e.id),o=dt.getState().oldParentId,r=dt.getState().oldFoundationId;if(!n||!o||!r)return;const i=e.type===z.SolarPanel,a=e.type===z.Polygon,l={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:i?e.parentType:void 0,newParentType:i?n.parentType:void 0,oldParentId:o,newParentId:n.parentId,oldFoundationId:r,newFoundationId:n.foundationId,oldNormal:new ae().fromArray(e.normal),newNormal:new ae().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){s(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.newParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal,a?e.vertices:void 0)},redo(){s(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.oldParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal,a?n.vertices:void 0)}};M.getState().addUndoable(l);const s=(c,u,d,f,p,g,A,y,S)=>{M.getState().set(C=>{const P=C.elements.find(v=>v.id===c);if(P){if(P.type===z.Polygon){if(S){const v=P;v.vertices=[...S]}}else[P.cx,P.cy,P.cz]=[...u];if(d&&f&&p&&(P.parentId=d,P.foundationId=p,g&&P.type===z.SolarPanel&&(P.parentType=g),A&&(P.rotation=[...A]),y&&(P.normal=[y.x,y.y,y.z]),P.type===z.Window)){const v=C.elements.find(b=>b.id===d),T=C.elements.find(b=>b.id===f);if(!v||!T)return;const w=P.lx*T.lx,x=P.lz*T.lz;P.lx=w/v.lx,P.lz=x/v.lz}}})}}static undoInvalidOperation(){M.getState().set(e=>{var n;if(e.selectedElement){for(let o=0;o{const e={name:`Add ${t.type} on Roof`,timestamp:Date.now(),addedElement:t,undo:()=>{M.getState().removeElementById(t.id,!1)},redo:()=>{M.getState().set(n=>{n.elements.push(e.addedElement),n.selectedElement=e.addedElement})}};M.getState().addUndoable(e)},qQt=t=>{for(const e of t.intersections)if(e.eventObject.name.includes("Roof Segments Group"))return e.object.name.includes("Flat roof")?e.point.clone().setZ(e.point.z-.01):e.point;return t.intersections[0].point},$Qt=(t,e,n,o,r)=>{if(t.intersections.length===0)return;const i=M.getState().objectTypeToAdd;if(i===z.None)return;const a=M.getState().getElementById(n),l=M.getState().getElementById(e);if(!a||!l)return;const s=qQt(t),c=new ae().subVectors(s,new ae(l.cx,l.cy,l.lz/2)).applyEuler(new ln(0,0,-l.rotation[2])),u=c.clone().sub(r);let d=null;switch(i){case z.SolarPanel:{const{normal:f,rotation:p}=bn.computeState(o,u),g=M.getState().actionState;let A=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);A||(A=M.getState().getPvModule(R9)),d=Va.makeSolarPanel(a,A,c.x,c.y,c.z,g.solarPanelOrientation??vr.landscape,g.solarPanelPoleHeight??1,g.solarPanelPoleSpacing??3,g.solarPanelTiltAngle??0,g.solarPanelRelativeAzimuth??0,f,p??[0,0,1],g.solarPanelFrameColor),Gz(d);break}case z.SolarWaterHeater:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeSolarWaterHeater(a,c.x,c.y,c.z,f,p??[0,0,1]),Gz(d);break}case z.Window:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeWindow(a,c.x,c.y,c.z,z.Roof,p,.5,.5),Gz(d);break}case z.Sensor:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeSensor(a,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),Gz(d);break}case z.Light:{const{normal:f,rotation:p}=bn.computeState(o,u),g=M.getState().actionState;d=Va.makeLight(a,2,g.lightDistance,g.lightIntensity,g.lightColor,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),Gz(d);break}}d&&M.getState().set(f=>{f.elements.push(d),f.selectedElement=d,f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(d.id),f.actionModeLock||(f.objectTypeToAdd=z.None)})},p$e=(t,e,n)=>{M.getState().isAddingElement()||M.getState().objectTypeToAdd!==z.None||t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),M.getState().set(o=>{if(o.contextMenuObjectType=null,o.groupActionMode)o.multiSelectionsMode||o.selectedElementIdSet.clear(),o.selectedElementIdSet.has(n)?o.selectedElementIdSet.delete(n):o.selectedElementIdSet.add(n);else for(const r of o.elements)r.id===e?(r.selected=!0,o.selectedElement=r,o.multiSelectionsMode?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):(o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e))):r.selected=!1}))},sN=(t,e,n)=>{const o={name:"Resize Roof Rise",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Roof,oldRise:e,newRise:n,undo:()=>{M.getState().updateRoofRiseById(o.resizedElementId,o.oldRise,0)},redo:()=>{M.getState().updateRoofRiseById(o.resizedElementId,o.newRise,0)}};M.getState().addUndoable(o)},g$e=(t,e)=>{const n={lng:M.getState().language};return bn.rooftopElementBoundaryCheck(t,e)?!0:(M.getState().moveHandleType||M.getState().viewState.orthographic?co(Y.t("message.MoveOutsideBoundaryCancelled",n)):M.getState().resizeHandleType?co(Y.t("message.ResizingOutsideBoundaryCancelled",n)):M.getState().rotateHandleType&&co(Y.t("message.RotationOutsideBoundaryCancelled",n)),!1)},m$e=(t,e,n)=>{const o={lng:M.getState().language};return bn.rooftopElementCollisionCheck(t,e,n)?!0:(M.getState().moveHandleType||M.getState().viewState.orthographic?co(Y.t("message.MoveCancelledBecauseOfOverlap",o)):M.getState().resizeHandleType?co(Y.t("message.ResizingCancelledBecauseOfOverlap",o)):M.getState().rotateHandleType&&co(Y.t("message.RotationCancelledBecauseOfOverlap",o)),!1)},DQ=(t,e,n,o,r,i,a)=>{t!==null&&M.getState().set(l=>{if(t!==null){for(const s of l.elements)if(s.parentId===e&&s.foundationId){if(s.type===z.SolarPanel||s.type===z.SolarWaterHeater){const u=new ae(s.cx,s.cy,s.cz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=g+t.lz/2)}else if(s.type===z.Window){const u=new ae(s.cx,s.cy,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.rotation=[...p],s.cz=g)}else if(s.type===z.Sensor||s.type===z.Light){const u=new ae(s.cx*t.lx,s.cy*t.ly,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=g)}}}})},cN=(t,e,n,o,r)=>{t.button!==2&&(t.intersections[0].eventObject.name!==t.eventObject.name||(p$e(t,n,e),$Qt(t,e,n,o,r)))},uN=(t,e)=>{const n=M.getState().selectedElement;if(!n||!bn.isValidOnRoof(n))return;const o=M.getState().getElementById(n.id);if(o&&M.getState().moveHandleType&&Eu.getIntersectionObjects(t)[0].eventObject.userData.roofId===e.id&&o.foundationId){const a=M.getState().getElementById(o.foundationId);if(a)switch(o.type){case z.SolarPanel:{const l=o,s=bn.getRoofBoundaryVertices(e),c=bn.getSolarPanelVerticesOnRoof(l,a);!g$e(c,s)||!m$e(l,a,c)?Eu.undoInvalidOperation():Eu.addUndoableMove();break}case z.Sensor:Eu.addUndoableMove();break;case z.Light:Eu.addUndoableMove();break}}M.getState().set(r=>{r.moveHandleType=null})},dN=(t,e)=>{const n=M.getState().getSelectedElement();if(!(!n||!bn.isValidOnRoof(n)))switch(n.type){case z.Sensor:case z.Light:case z.SolarPanel:{if(n.type===z.SolarPanel&&n.parentType===void 0)return;if(M.getState().moveHandleType){const o=Eu.getIntersectionObjects(t);o[0].eventObject.userData.roofId===e&&M.getState().set(i=>{for(const a of i.elements)if(a.id===n.id){const{roofId:l,foundation:s,centroid:c,roofSegments:u}=o[0].eventObject.userData;if(s&&c&&u&&l){const d=o[0].point,f=new ae().subVectors(d,new ae(s.cx,s.cy)).applyEuler(new ln(0,0,-s.rotation[2])),p=f.clone().sub(c),{normal:g,rotation:A}=bn.computeState(u,p);a.cx=f.x/s.lx,a.cy=f.y/s.ly,a.cz=f.z-s.lz,a.rotation=[...A],a.normal=g.toArray(),a.parentId=l,a.foundationId=s.id,a.type===z.SolarPanel&&(a.parentType=z.Roof,a.color="#fff"),i.selectedElement&&(i.selectedElement.parentId=l,i.selectedElement.foundationId=s.id),dt.getState().setPrimitiveStore("showWallIntersectionPlaneId",null)}break}})}}}},CR=(t,e)=>{t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),M.getState().set(n=>{n.contextMenuObjectType=z.Roof,n.pastePoint.copy(t.intersections[0].point);for(const o of n.elements)if(o.id===e)if(o.selected=!0,n.selectedElement=o,n.selectedElementIdSet.has(e))for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id);else if(n.multiSelectionsMode){n.selectedElementIdSet.add(e);for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id)}else n.selectedElementIdSet.clear(),n.selectedElementIdSet.add(e);else o.selected=!1}))},th=({position:t,onPointerDown:e,onPointerUp:n,onPointerOver:o})=>{const r=M(pn),i=a5(),{gl:a}=ri(),l=m.useRef(!1),s=m.useRef(!1),c=m.useRef(!1),u=m.useRef(null),[d,f]=m.useState("white"),p=A=>{A?(f(ga),a.domElement.style.cursor="pointer"):(f("white"),a.domElement.style.cursor="default")};m.useEffect(()=>{const A=()=>{s.current&&(c.current=!0),!s.current&&l.current&&p(!1),l.current=!1};return window.addEventListener("pointerup",A),()=>{window.removeEventListener("pointerup",A)}},[]);const g=A=>{if(A.intersections.length>0){for(const{eventObject:y}of A.intersections)if(y.name==="Roof Handle")return y===u.current}return!1};return h.jsx(Ps,{name:"Roof Handle",ref:u,args:[i],position:t,onPointerMove:A=>{g(A)?(c.current=!1,s.current||(s.current=!0,p(!0))):f("white")},onPointerOut:A=>{c.current||(l.current||(A.intersections.length>0&&A.intersections[0].eventObject.name==="Roof Handle"?f("white"):p(!1)),s.current=!1,r(y=>{y.hoveredHandle=null}))},onPointerDown:A=>{g(A)&&(e&&e(A),l.current=!0)},onPointerUp:A=>{g(A)&&n&&n(A)},onPointerOver:A=>{g(A)&&o&&o(A)},onPointerLeave:A=>{g(A)&&r(y=>{y.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:d})})},QQt=({roofModel:t,foundationModel:e})=>{const n=M(Ap),{id:o,wallsId:r,roofType:i}=t;return m.useEffect(()=>{r.length===0&&n(o,!1)},[r]),(()=>{switch(i){case Go.Pyramid:return h.jsx(Zxt,{roofModel:t,foundationModel:e});case Go.Gable:return h.jsx(ubt,{roofModel:t,foundationModel:e});case Go.Hip:return h.jsx(pbt,{roofModel:t,foundationModel:e});case Go.Gambrel:return h.jsx(rbt,{roofModel:t,foundationModel:e});case Go.Mansard:return h.jsx(Abt,{roofModel:t,foundationModel:e});default:return null}})()};function ZH(t,e){return t.roofModel===e.roofModel&&t.foundationModel.lx===e.foundationModel.lx&&t.foundationModel.ly===e.foundationModel.ly&&t.foundationModel.lz===e.foundationModel.lz}const ZQt=be.memo(QQt,ZH),eM=t=>{const e=m.useMemo(()=>{let i;switch(t){case Ur.NoTexture:i=og;break;case Ur.Texture01:i=Mxt;break;case Ur.Texture02:i=Ixt;break;case Ur.Texture03:i=zxt;break;case Ur.Texture04:i=Dxt;break;case Ur.Texture05:i=Ext;break;case Ur.Texture06:i=Fxt;break;case Ur.Texture07:i=kxt;break;default:i=Hxt}return new cf().load(i,a=>{switch(a.wrapS=a.wrapT=bs,t){case Ur.NoTexture:case Ur.Default:a.repeat.set(5,3);break;case Ur.Texture01:a.repeat.set(.5,.25);break;case Ur.Texture03:a.repeat.set(.9,.9);break;case Ur.Texture04:case Ur.Texture05:case Ur.Texture06:a.repeat.set(.75,.75);break;default:a.repeat.set(.5,.5)}o(a),r()})},[t]),[n,o]=m.useState(e),{invalidate:r}=ri();return n},tM=(t,e)=>{const n=M(mA),o=M(Ju);return{transparent:t||n&&o,opacity:Math.min(e!==void 0?e:1,n&&o||t?.25:1)}},y$e=(t,e,n)=>{const o=M(l=>l.elements.filter(s=>s.foundationId===t&&s.type===z.Wall),cy),r=l=>o.find(s=>s.id===l),i=m.useRef(!1);return{currentWallArray:m.useMemo(()=>{for(const l of n){let s=r(l);if(!s)return[];const c=[],u=s;let d=0;for(;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.leftJoints[0]);)if(s.leftJoints[0]!==u.id)s=r(s.leftJoints[0]);else return c.reverse(),i.current=!0,c;for(c.reverse(),s=r(u.rightJoints[0]),d=0;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.rightJoints[0]&&s.rightJoints[0]!==u.id);)s=r(s.rightJoints[0]);if(i.current=!1,c.length>1)return c}return[]},[n,o]),isLoopRef:i}},jye=(t,e)=>{const n=M(r=>r.elements.filter(i=>i.foundationId===e&&i.type===z.Wall),cy);return m.useMemo(()=>{var f;const r=p=>n.find(g=>g.id===p),i=new Map,a=new Map,l=r(t);let s=l,c=0,u=!1;for(;s&&s.type===z.Wall&&c<100;){i.set(s.id,s);const p=s.relativeAngle.toFixed(1);if(a.has(p)?(f=a.get(p))==null||f.push(s):a.set(p,[s]),s.rightJoints.length!==0){if(s=r(s.rightJoints[0]),s&&s.id===l.id){u=!0;break}c++}else s=null}if(!u||a.size!==4)return null;const d=[];for(const[p,g]of a){let A=0;for(const v of g){const T=i.get(v.leftJoints[0]),w=i.get(v.rightJoints[0]);if(T&&T.relativeAngle.toFixed(1)!==p&&A++,w&&w.relativeAngle.toFixed(1)!==p&&A++,A>2)break}if(A!==2)return null;let y=null,S=null,C=0,P=-1;for(const v of g){const T=i.get(v.leftJoints[0]),w=i.get(v.rightJoints[0]);C=Math.max(C,v.lz),P=Math.max(P,v.eavesLength),T&&T.relativeAngle.toFixed(1)!==p&&(y=v),w&&w.relativeAngle.toFixed(1)!==p&&(S=v)}y&&S&&C>0&&P!==-1&&d.push({leftPoint:new ae().fromArray(y.leftPoint),rightPoint:new ae().fromArray(S.rightPoint),relativeAngle:y.relativeAngle,lz:C,eavesLength:P,wallsId:g.map(v=>v.id)})}return d.length!==4?null:d},[n])},Bye=(t,e,n)=>{const o=m.useMemo(()=>bn.getHighestComposedWallHeight(t,n),[t]),r=m.useMemo(()=>o+e,[o,e]);return{highestWallHeight:o,topZ:r}},A$e=(t,e,n)=>{const o=m.useMemo(()=>bn.getHighestWallHeight(t,n),[t]),[r,i]=m.useState(e),a=o+r;return m.useEffect(()=>{e!==r&&i(e)},[e]),{highestWallHeight:o,topZ:a,riseInnerState:r,setRiseInnerState:i}},fN=(t,e,n,o,r,i)=>{const a=dt(wW),l=dt(Lge),s=dt(AW),c=()=>{const u=f=>f.clone().add(e),d=[];if(o)if(r===Go.Gambrel)d.push(Vye(n).map(u));else{const f=[];for(const p of n)f.push(p.points[1].clone().add(e));d.push(f)}else{for(const f of n){const p=f.points;if(p.length===6)d.push(p.slice(3).map(u));else if(p.length===8)d.push(p.slice(4).map(u));else throw new Error("Invalid Roof segment data")}i&&d.push(i)}return Cn.getState().setRoofSegmentVertices(t,d),d};return(a||l||s)&&c(),m.useEffect(()=>{c()},[n]),c},hN=t=>{const e=dt(AW),n=dt(Xq);(e||n)&&t()},pN=(t,e)=>{const n=M(FH);m.useEffect(()=>{t.rise===void 0&&M.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Roof){const i=r;i.rise===void 0&&(i.rise=i.lz-e,i.lz=0);break}})},[n])},eZt=()=>{const[,t]=m.useState(!1);m.useEffect(()=>{t(e=>!e)},[])},EQ=()=>{const t=m.useRef(!0);return t.current?(t.current=!1,!0):!1},Yye=(t,e,n,o,r,i,a)=>{const l=M(s=>s.updateElementOnRoofFlag);m.useEffect(()=>{l&&(DQ(t,e,n,o,r,i,a),M.getState().setUpdateElementOnRoofFlag(!1))},[r,i,l])},tZt=(t,e,n,o,r,i,a)=>{const l=EQ();m.useEffect(()=>{l||DQ(t,e,n,o,r,i,a)},[n])},Oye=(t,e,n,o,r,i,a)=>{tZt(t,e,n,o,r,i,a),Yye(t,e,n,o,r,i,a)},gN=(t,e,n,o)=>{const r=h$e(e);return m.useMemo(()=>({roofId:t,foundation:r,centroid:n,roofSegments:o}),[t,n,o,r])},MSe=(t,e)=>{const[n,o,r,i]=e;t.moveTo(n.points[0].x,n.points[0].y),t.lineTo(n.points[1].x,n.points[1].y),t.lineTo(i.points[0].x,i.points[0].y),t.lineTo(i.points[1].x,i.points[1].y),t.closePath()},Vye=(t,e)=>{const n=[],[o,r,i,a]=t;return n.push(o.points[0].clone()),n.push(o.points[1].clone()),n.push(a.points[0].clone()),n.push(a.points[1].clone()),e?(e.push(...n),e):n},uX=({uuid:t,shape:e,thickness:n,holeMeshes:o,simulation:r,castShadow:i,receiveShadow:a,children:l})=>{const s=m.useRef(null);if(s.current&&(s.current.geometry=new N9(e,{steps:1,depth:n,bevelEnabled:!1}),s.current.updateMatrix(),o.length>0)){const c=[];for(let d=0;d{const f=M.getState().world,p=M(Cs),g=dt(hs),A=dt(p3),y=M(e5),S=M(a3),C=M(l3),P=Cn(yW),v=Cn.getState().hourlyHeatExchangeArrayMap,T=m.useRef(0),w=m.useRef(),x=m.useRef(),{transparent:b,opacity:R}=tM(),H=M(V=>V.elements.filter(G=>G.type===z.Window&&G.parentId===t),cy),F=m.useMemo(()=>{if(!A||e&&e.notBuilding)return;const V=v.get(t);if(!V)return;const G=V.reduce((ve,we)=>ve+we,0),q=P(t);if(!q||!q[0])return;const $=[],ie=q[0].map(ve=>ve.clone().sub(r)),Q=i3*(f.solarRadiationHeatmapGridCellSize??.5),se=ie[0].clone(),Z=ie[1].clone(),ee=ie[2].clone(),te=new ae().subVectors(Z,se),oe=new ae().subVectors(ee,se),de=new ae().subVectors(ee,Z),he=te.length(),pe=new ae().crossVectors(oe,de).length()/he,me=Math.max(2,Math.floor(he/Q)),le=Math.max(2,Math.floor(pe/Q));te.normalize(),oe.normalize(),de.normalize();const Te=new ae().crossVectors(oe,de).normalize(),ge=te.multiplyScalar(.5*he/me),Se=new ae().crossVectors(Te,te).normalize().multiplyScalar(.5*pe/le),Re=se.clone().add(ge).add(Se).add(new ae(0,0,i));ge.multiplyScalar(2),Se.multiplyScalar(2),w.current=Te.clone().multiplyScalar(.1);const De=new ae,Ae=new Array;for(const ve of ie)Ae.push({x:ve.x,y:ve.y});const ue=ye.getPolygonArea(Ae);if(ue===0)return;const fe=G/ue*(y??Qm);T.current=fe<0?1:0,x.current=new ln(-Math.sign(fe)*Qt,0,0);for(let ve=0;ve{if(o.length===0)return[new ae];const V=[];if(n===Go.Gambrel){Vye(o,V);const G=V.reduce((q,$)=>Math.max(q,$.z),0);V.forEach(q=>q.setZ(G))}else{V.push(o[0].points[0]);for(const G of o){const q=G.points[1];V.push(q)}}return V},[o,n]),N=m.useMemo(()=>new ae(0,0,i),[i]),U=h.jsx(Gn,{points:E,lineWidth:l,color:a}),W=eM(u),k=m.useMemo(()=>{const V=new kl;if(o.length===0)return V;if(n===Go.Gambrel)MSe(V,o);else{const G=o[0].points[0];V.moveTo(G.x,G.y);for(const q of o){const $=q.points[1];V.lineTo($.x,$.y)}V.closePath()}return V},[o,r,n]),D=m.useMemo(()=>{const V=new kl;if(o.length===0)return V;if(n===Go.Gambrel)MSe(V,o);else{const G=o[0].points[0];V.moveTo(G.x,G.y);for(const q of o){const $=q.points[1];V.lineTo($.x,$.y)}V.closePath()}if(H.length>0)for(const G of H){const q=new ae(G.cx,G.cy,G.cz).sub(r);switch(G.windowType){case Ci.Polygonal:{const[$,ie]=G.polygonTop??Gp,[Q,se,Z]=[G.lx/2,G.lz/2,$*G.lx],ee=SG(Q,se,Z,ie,q.x,q.y);V.holes.push(ee);break}case Ci.Arched:{const $=bG(G.lx,G.lz,G.archHeight,q.x,q.y);V.holes.push($);break}default:{const $=new kl,[ie,Q]=[G.lx/2,G.lz/2];$.moveTo(q.x-ie,q.y-Q),$.lineTo(q.x+ie,q.y-Q),$.lineTo(q.x+ie,q.y+Q),$.lineTo(q.x-ie,q.y+Q),$.closePath(),V.holes.push($)}}}return V},[o,r,H,n]),L=m.useMemo(()=>H.map(V=>{const[G,q,$]=V.rotation,ie=new ae(V.cx,V.cy,V.cz).sub(r),Q=new ln().fromArray([V.rotation[0],V.rotation[1],V.rotation[2],"ZXY"]);switch(V.windowType){case Ci.Polygonal:{const[se,Z]=V.polygonTop??Gp,[ee,te,oe]=[V.lx/2,V.lz/2,se*V.lx],de=SG(ee,te,oe,Z),he=new ls(new N9([de],{steps:1,depth:V.ly,bevelEnabled:!1})),pe=new ae(0,0,-V.ly).applyEuler(Q);return he.position.copy(ie.clone().add(pe)),he.rotation.copy(Q),he.updateMatrix(),he}case Ci.Arched:{const se=bG(V.lx,V.lz,V.archHeight),Z=new ls(new N9([se],{steps:1,depth:V.ly,bevelEnabled:!1})),ee=new ae(0,0,-V.ly).applyEuler(Q);return Z.position.copy(ie.clone().add(ee)),Z.rotation.copy(Q),Z.updateMatrix(),Z}default:{const se=new ls(new n3(V.lx,V.lz,V.ly*2));return se.position.copy(ie),se.rotation.set(G,q,$),se.updateMatrix(),se}}}),[H,i]),j=u===Ur.NoTexture&&c&&c===s,B=p&&!b,O=g&&d;return h.jsxs(h.Fragment,{children:[j&&!O?h.jsx(uX,{uuid:t,simulation:!0,shape:k,holeMeshes:L,thickness:i,castShadow:B,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:c,transparent:b,opacity:R})}):h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{uuid:t,userData:{simulation:!0},name:"Flat roof top shape",position:[0,0,i+.001],receiveShadow:p,children:[h.jsx("shapeGeometry",{args:[D]}),O?h.jsx("meshBasicMaterial",{map:d,side:Da}):h.jsx("meshStandardMaterial",{map:W,color:c,transparent:b,opacity:R,side:Da})]}),h.jsx(uX,{shape:k,holeMeshes:L,thickness:i,castShadow:B,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:s??"white",transparent:b,opacity:R})})]}),U,h.jsxs("group",{position:[0,0,i],children:[U,E.map((V,G)=>{const q=[V.clone().sub(N),V];return h.jsx(Gn,{points:q,lineWidth:l,color:a},G)})]}),F&&F.map((V,G)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:V,name:"Heat Flux "+G,lineWidth:C??Zm,color:S??p0}),";",h.jsx(xf,{userData:{unintersectable:!0},position:w.current?V[T.current].clone().add(w.current):V[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:S??p0})})]},G))]})},w$e="/aladdin/assets/foundation_01--kFbnI98.png",v$e="/aladdin/assets/foundation_02-wZzxF61c.png",x$e="/aladdin/assets/foundation_03-CrR6CCyr.png",b$e="/aladdin/assets/foundation_04-k0ozbTjk.png",S$e="/aladdin/assets/foundation_05-Bwrj98Mu.png",T$e="/aladdin/assets/foundation_06-BOa0J0il.png",P$e="/aladdin/assets/foundation_07-C9gRAfER.png",mN="/aladdin/assets/helvetiker_regular.typeface-B9JafPRX.fnt",_ye=be.memo(({element:t,height:e})=>{const n=M(o$),o=M(ly),r=M(x7t),i=M(Gr),a=M(mA),[l,s]=m.useState(),[c,u]=m.useState(10),[d,f]=m.useState(0);m.useEffect(()=>{if(n||o){const{cx:P,cy:v,lx:T,ly:w,type:x}=t;switch(x){case z.SolarPanel:{const b=i(t);if(b){const R=P*b.lx,H=v*b.ly;s(new ae(R,H,e??b.lz))}break}case z.Foundation:{s(new ae(P,v,a?.1:0));break}case z.Cuboid:{const{pos:b}=ye.getWorldDataById(t.id),{rot:R}=ye.getWorldDataById(t.parentId);s(new ae(b.x,b.y,b.z-t.lz/2+.2)),f(R);break}default:{s(new ae(P,v,a?.2:0));break}}u(Math.max(5,Math.hypot(T,w)*.75))}},[t,n,o,a,e]);const p=r3(hW,mN),g=c*.05,A={font:p,height:0,size:g},y=new Array(25).fill(0),S=P=>P===0?-g*.3:P>0&&P<7?-g*.8:-g*1.2,C=a?"#222":"#ccc";return h.jsx(h.Fragment,{children:l&&h.jsxs("group",{position:l,rotation:[Qt,d,0],name:"Polar Auxiliary",children:[h.jsx("polarGridHelper",{args:[c,24,6,120,C,C],userData:{unintersectable:!0}}),h.jsx(wG,{args:[c*.98,c,24,1,Qt,r],userData:{unintersectable:!0},rotation:[-Qt,0,0],children:h.jsx("meshBasicMaterial",{side:ti,color:"yellow"})}),h.jsx("group",{rotation:[0,r,0],children:h.jsx("mesh",{position:[-.5,0,-c*.9],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(r).toFixed(1)}°`,A]})})}),y.map((P,v)=>{let T=Math.ceil(v/2)*(v%2===0?1:-1);T===-12&&(T=12);const w=S(Math.abs(T));return h.jsx("group",{rotation:[0,T*Math.PI/12,0],children:h.jsxs("mesh",{position:[w,0,-c*1.05],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*T}°`,A]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},v)})]})})}),dX=be.memo(({id:t,position:e,ratio:n,handleType:o,hoverHandle:r,noHoverHandle:i})=>{const a=M(pu),l=M(o$),c=M(ly)===o||l===o?ga:$a,u=h.jsx("meshBasicMaterial",{color:c});return h.jsxs("group",{position:e,rotation:[Qt,0,0],scale:n,name:o,children:[h.jsxs("group",{children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:u}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:u}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:u})]}),h.jsx(ta,{name:o,args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1,onPointerDown:d=>{a(t,d,Xo.Rotate)},onPointerOver:d=>{r(d,o)},onPointerOut:i})]})}),mw=be.memo(({hx:t,hy:e,hz:n,lineColor:o="black",lineWidth:r=.2})=>h.jsx(Gn,{points:[[-t,-e,-n],[t,-e,-n],[t,-e,n],[t,-e,-n],[t,e,-n],[t,e,n],[t,e,-n],[-t,e,-n],[-t,e,n],[-t,e,-n],[-t,-e,-n],[-t,-e,n],[t,-e,n],[t,e,n],[-t,e,n],[-t,-e,n]],name:"Wireframe",userData:{unintersectable:!0},lineWidth:r,color:o}));var Jr=(t=>(t.left="Left",t.right="Right",t.loop="Loop",t.null="Null",t))(Jr||{});const Gye=be.memo(({element:t,verticalLift:e})=>{const n=M(m0),o=M(Ju),r=M(Ug),i=M(ly),a=t.lx/2,l=t.ly/2,s=.2,c=1,u=.5,d=t.lineColor??"white",f="darkorchid",p=Math.max(1,(a+l)/32),g=m.useMemo(()=>({lng:n}),[n]),A=m.useMemo(()=>{switch(t.type){case z.Cuboid:return Math.max(.5,Math.max(a,l)*.1)}return .5},[t.type,a,l]),y=m.useMemo(()=>{switch(t.type){case z.Cuboid:return o?t.lz/2+.1:-t.lz/2+.1;case z.Foundation:return t.lz+.1}return .1},[o,t.type,t.lz]),S=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[-a-A,0,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A,-l,y],[-a-A,l,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A+s,-l+3*s,y],[-a-A,-l,y],[-a-A-s,-l+3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A+s,l-3*s,y],[-a-A,l,y],[-a-A-s,l-3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l,y],[-a-A*2,-l,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l,y],[-a-A*2,l,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),C=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[a+A,0,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A,-l,y],[a+A,l,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A+s,-l+3*s,y],[a+A,-l,y],[a+A-s,-l+3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A+s,l-3*s,y],[a+A,l,y],[a+A-s,l-3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,-l,y],[a+A*2,-l,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,l,y],[a+A*2,l,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),P=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,-l-A,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l-A,y],[a,-l-A,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a+3*s,-l-A-s,y],[-a,-l-A,y],[-a+3*s,-l-A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a-3*s,-l-A-s,y],[a,-l-A,y],[a-3*s,-l-A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l,y],[-a,-l-A*2,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,-l,y],[a,-l-A*2,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),v=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,l+A,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l+A,y],[a,l+A,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a+3*s,l+A-s,y],[-a,l+A,y],[-a+3*s,l+A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a-3*s,l+A-s,y],[a,l+A,y],[a-3*s,l+A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l,y],[-a,l+A*2,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,l,y],[a,l+A*2,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]);if(r)if(t.type===z.Wall)switch(r){case Mt.LowerLeft:return P;case Mt.LowerRight:return P}else switch(r){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[S,P]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[S,v]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[C,v]})}if(i)if(t.type===z.Wall)switch(i){case Mt.LowerLeft:return P;case Mt.LowerRight:return P}else switch(i){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[S,P]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[S,v]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[C,v]})}return h.jsx(h.Fragment,{})}),nZt=1.361,ISe=9.8067,zSe=1012,mO=1.225,H4=273.15,DSe=567e-10,oZt=[.103,.104,.109,.12,.13,.137,.138,.134,.121,.111,.106,.103];var li=(t=>(t[t.NONE=0]="NONE",t[t.KASTEN_YOUNG=1]="KASTEN_YOUNG",t[t.SPHERE_MODEL=2]="SPHERE_MODEL",t))(li||{});const T2=1440,lde=Math.PI/720,Zie=Math.PI/182.5,ESe=30,rZt=120;class FSe{constructor(e,n){this.sunrise=e,this.sunset=n}daylight(){return this.sunset-this.sunrise}}const c6=.5,k0=.1,fP=23.45/180*Math.PI,iZt=1e3*60*60*24,FC=720,yN=t=>{const e=Math.floor((t.getTime()-new Date(t.getFullYear(),0,0).getTime())/iZt);return fP*Math.sin(sa*(284+e)/365.25)},dl=(t,e)=>{const n=Math.tan(ye.toRadians(e))*Math.tan(yN(t));if(Math.abs(n)>1)return new FSe(0,n>0?FC*2:0);const o=60*Math.acos(-n)/ye.toRadians(15);return new FSe(FC-o,FC+o)},Xye=t=>(t.getHours()*60+t.getMinutes()-FC)/FC*Math.PI,yO=t=>(t/FC-1)*Math.PI,ki=(t,e)=>a9(1,Xye(t),yN(t),ye.toRadians(e)).normalize(),a9=(t,e,n,o)=>{const r=Math.cos(n),i=Math.sin(n),a=Math.cos(o),l=Math.sin(o),s=Math.cos(e),c=Math.sin(e),u=Math.asin(i*l+r*s*a),d=c*r,f=a*i-s*r*l,p=Math.atan2(f,d),g=new ae(t,p,u);return ye.sphericalToCartesianZ(g),g.x=-g.x,g},aZt=t=>{const e=sa*t/365,n=1.00011+.034221*Math.cos(e)+.00128*Math.sin(e)+719e-6*Math.cos(2*e)+77e-6*Math.sin(2*e);return nZt*n},lZt=(t,e,n)=>{let o;switch(t){case li.NONE:return 1;case li.KASTEN_YOUNG:return o=e.angleTo(ko),1/(Math.cos(o)+.50572*Math.pow(96.07995-o/Math.PI*180,-1.6364));default:{o=e.angleTo(ko);const r=Math.cos(o),i=708,a=n/9e3;return Math.sqrt((i+a)*(i+a)*r*r+(2*i+1+a)*(1-a))-(i+a)*r}}},xi=(t,e,n,o)=>aZt(e)*Math.pow(.7,Math.pow(lZt(o,t,n),.678)),qr=(t,e,n,o)=>{let r=0;const i=n.dot(ko),a=.5*(1+i);a>0&&(r+=oZt[e]*a*o);const l=.5*Math.abs(1-i);return ye.isZero(l)||(r+=t.albedo*l*o),r},sZt=be.memo(({foundation:t})=>{const e=M(Al),n=M(s0),o=dt(aYe),r=dt(Cf),i=dt(Gge),a=dt(hs),l=M(Pf),s=Cn(c1),[c,u]=m.useState(null),d=m.useRef(null),{lx:f,ly:p,lz:g,solarUpdraftTower:A}=t,y=((A==null?void 0:A.collectorRadius)??100)*.016,S=m.useMemo(()=>ki(new Date(e),n),[e,n]),C=m.useMemo(()=>{const v=[],T=(((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))+g)/2,w=(A==null?void 0:A.chimneyHeight)??Math.max(f,p),x=(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,b=(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),R=x*1.15,H=b*.5,F=b,E=b*2,N=b*4,U=6;for(let W=0;W{const v=[],T=((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))+g,w=(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,x=25,b=2*w/x;for(let R=0;R<=x;R++){const H=[],F=-w+R*b,E=Math.sqrt(w*w-F*F);H.push(new ae(-E,F,T)),H.push(new ae(E,F,T)),v.push({points:H})}for(let R=0;R<=x;R++){const H=[],F=-w+R*b,E=Math.sqrt(w*w-F*F);H.push(new ae(F,-E,T)),H.push(new ae(F,E,T)),v.push({points:H})}return v},[f,p,g,A==null?void 0:A.collectorRadius,A==null?void 0:A.collectorHeight]);return m.useEffect(()=>{if(t&&a){const v=s(t.id+"-sut");v&&u(ye.fetchHeatmapTexture(v,l??5))}},[a,l]),Z2((v,T)=>{(o||r&&!i)&&S.z>0&&d.current&&d.current.children.forEach(w=>{if(w.name==="Streamlines"){const x=w;x.material.uniforms.dashOffset.value-=T*y*10}})}),h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0,simulation:!0},name:"Chimney",castShadow:!0,receiveShadow:!1,args:[(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(A==null?void 0:A.chimneyHeight)??Math.max(f,p),16,2,!0],position:[0,0,((A==null?void 0:A.chimneyHeight)??Math.max(f,p))/2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Chimney Base",castShadow:!0,receiveShadow:!1,args:[(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),((A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)))*1.6,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))*4,16,2,!0],position:[0,0,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))*2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Greenhouse Wall",castShadow:!0,receiveShadow:!0,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,(A==null?void 0:A.collectorHeight)??Math.max(3,10*g),50,2,!0],position:[0,0,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))/2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(uR,{uuid:t.id+"-sut",userData:{unintersectable:!0,simulation:!0},name:"Greenhouse Ceiling",castShadow:!1,receiveShadow:!1,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,50,0,sa],position:[0,0,g+((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))],children:a&&c?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:c}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:50,side:Da,color:"lightskyblue",transparent:!0,opacity:.75})}),h.jsx(uR,{userData:{unintersectable:!0},name:"Greenhouse Ground",castShadow:!1,receiveShadow:!0,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,50,0,sa],position:[0,0,.1],children:h.jsx("meshStandardMaterial",{attach:"material",color:"dimgray"})}),P&&P.map((v,T)=>h.jsx(Gn,{name:"Greenhouse Roof Grid Lines",userData:{unintersectable:!0},points:v.points,castShadow:!1,receiveShadow:!1,lineWidth:.2,color:"gray"},T)),S.z>0&&C&&h.jsx("group",{ref:d,children:C.map((v,T)=>{const w=v.points[0].x+v.points[1].x,x=v.points[0].y+v.points[1].y,b=new ln(0,0,sa*T/C.length+Qt),R=y,H=y;return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Streamlines",userData:{unintersectable:!0},points:v.points,castShadow:!1,receiveShadow:!1,lineWidth:.5,dashed:!0,dashSize:R,gapSize:H,color:"white"}),h.jsx(xf,{userData:{unintersectable:!0},args:[y,y*4,4,2],name:"Streamline Inlet Arrow Head",position:[w*.1,x*.1,v.points[0].z],rotation:b,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(xf,{userData:{unintersectable:!0},args:[y,y*4,4,2],name:"Streamline Inlet Arrow Head",position:[w*.9,x*.9,v.points[0].z],rotation:b,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})})]},T)})})]})}),Jye="/aladdin/assets/glow-CV5NAijT.png",cZt=be.memo(({foundation:t})=>{const e=M(Al),n=M(s0),o=Hb(Jye),r=m.useMemo(()=>ki(new Date(e),n),[e,n]),{lz:i,solarPowerTower:a}=t,l=(a==null?void 0:a.towerRadius)??1,s=(a==null?void 0:a.towerHeight)??20,c=s/10,u=l*1.5,d=Math.max(c,u)*2.4;return h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0},name:"Focus Tower",castShadow:!0,receiveShadow:!1,args:[l,l,s,6,2],position:[0,0,s/2+i/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Center Receiver",castShadow:!0,receiveShadow:!1,args:[u,u,c,10,2],position:[0,0,s+i/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),r.z>0&&h.jsx("mesh",{position:[0,0,s+i/2],children:h.jsx("sprite",{scale:[d,d,d],children:h.jsx("spriteMaterial",{map:o,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})})]})}),uZt=be.memo(({foundation:t})=>{const{ly:e,lz:n,solarAbsorberPipe:o}=t,r=(o==null?void 0:o.absorberHeight)??10,i=(o==null?void 0:o.apertureWidth)??.6,a=(o==null?void 0:o.relativeLength)??.9,l=(o==null?void 0:o.poleNumber)??5,s=m.useMemo(()=>{const c=[],u=a*e/(l+1);for(let d=1;d<=l;d++)c.push(new ae(0,d*u-a*e/2,r/2+n/2));return c},[e,n,l,r,a]);return h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 1",castShadow:!1,receiveShadow:!1,args:[i/4,i/4,r,6,2],position:[0,-a*e/2,r/2+n/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 2",castShadow:!1,receiveShadow:!1,args:[i/4,i/4,r,6,2],position:[0,a*e/2,r/2+n/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Horizontal Pipe",castShadow:!1,receiveShadow:!1,args:[i/2,i/2,a*e+i/2,6,2,!1,3*Qt,Math.PI],position:[0,0,r+n/2-i/4],rotation:[0,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),s&&s.map((c,u)=>h.jsx(ma,{userData:{unintersectable:!0},name:"Solar Receiver Pole "+u,castShadow:!1,receiveShadow:!1,args:[i/8,i/8,r,4,2],position:c,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})},u))]})});class Px{static selectMe(e,n,o,r){var i,a,l;if(o.intersections.length>0&&o.intersections.filter(c=>!c.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===o.eventObject){for(const c of e.elements)c.id===n?(c.selected=!0,e.selectedElement=c,e.selectedElementHeight=c.lz):c.selected=!1;if(!e.selectedElement)return;if(r===Xo.ContextMenu)if(e.selectedElementIdSet.has(n))for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id);else if(e.multiSelectionsMode){e.selectedElementIdSet.add(n);for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id)}else e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n);else e.multiSelectionsMode?e.selectedElementIdSet.has(n)?e.selectedElementIdSet.delete(n):e.selectedElementIdSet.add(n):(e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n));if(e.moveHandleType=null,e.resizeHandleType=null,e.rotateHandleType=null,r)switch(r){case Xo.Move:((i=e.selectedElement)==null?void 0:i.type)===z.Tree||((a=e.selectedElement)==null?void 0:a.type)===z.Human?e.moveHandleType=zo.Default:e.moveHandleType=o.eventObject.name;break;case Xo.Resize:e.resizeHandleType=o.eventObject.name;break;case Xo.Rotate:e.rotateHandleType=o.eventObject.name;break;case Xo.Select:e.selectedElementAngle=((l=o.object.parent)==null?void 0:l.rotation.z)??0;break}}}static selectNone(e){e.selectedElementIdSet.clear();for(const n of e.elements)n.selected=!1;e.selectedElement=null,e.selectedElementIdSet.clear()}static clearThenAddSelectedElementIdSet(e,n){e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n)}}var fX={exports:{}};/** +`}const o=new Blob([n],{type:"text/csv;charset=utf-8"});d$e.saveAs(o,e)},sl=new le,i9=new le,ade=new le,cX=new le,Hu=new ln,yd=new Ts,Uye="/aladdin/assets/wall_edge-B4PmTeCj.png",UQt="/aladdin/assets/wall_01-B-g_tqAI.png",jQt="/aladdin/assets/wall_02-9M_qG3R_.png",BQt="/aladdin/assets/wall_03-ChpvVFgd.png",YQt="/aladdin/assets/wall_04-BkmmH41c.png",OQt="/aladdin/assets/wall_05-DFi74_0h.png",VQt="/aladdin/assets/wall_06-CtX-9FCz.png",_Qt="/aladdin/assets/wall_07-CJgSaJ5B.png",GQt="/aladdin/assets/wall_08-DwhD-VRH.png",XQt="/aladdin/assets/wall_09-D3ncCSYQ.png",JQt="/aladdin/assets/wall_10-RK6QVYt5.png",KQt=(t,e,n,o)=>{const r=c=>c.parentId===t||c.id===o,i=M(c=>{if(e){for(const u of c.elements)if(u.id===e)return u}return null}),a=M(c=>{if(n){for(const u of c.elements)if(u.id===n)return u}return null}),l=M(c=>JSON.stringify(c.elements.filter(r)));return{elementsOnWall:m.useMemo(()=>M.getState().elements.filter(c=>r(c)&&me.isLegalOnWall(c.type)),[l]),leftWall:i,rightWall:a}},a5=(t=.3)=>{const e=M(i=>i.viewState.orthographic),n=M(i=>i.viewState.cameraPosition),o=M(i=>i.viewState.cameraZoom);let r;if(e)r=Math.max(t,15/o);else{const i=M.getState().viewState.panCenter,a=new le(...i),s=new le(...n).distanceTo(a);r=Math.max(t,s/100)}return r},f$e=(t,e)=>{const n=m.useMemo(()=>new cf,[]);return m.useMemo(()=>{let o;switch(t){case Bo.Default:o=Uye;break;case Bo.NoTexture:o=og;break;case Bo.Texture01:o=UQt;break;case Bo.Texture02:o=jQt;break;case Bo.Texture03:o=BQt;break;case Bo.Texture04:o=YQt;break;case Bo.Texture05:o=OQt;break;case Bo.Texture06:o=VQt;break;case Bo.Texture07:o=_Qt;break;case Bo.Texture08:o=GQt;break;case Bo.Texture09:o=XQt;break;case Bo.Texture10:o=JQt;break;default:o=og}return e===gc.Stud&&(o=og),n.load(o,r=>{r.wrapS=r.wrapT=bs,r.offset.set(0,0);let i=.6,a=.6;switch(t){case Bo.Default:i=2,a=2;break;case Bo.Texture03:i=2,a=1;break;case Bo.Texture06:i=1,a=1;break}r.repeat.set(i,a),op()})},[t,e])},h$e=t=>{const e=m.useRef(!0);dt(o=>o.foundationMovedFlag);let n=t;if(!e.current){const o=M.getState().elements.find(r=>r.id===t.id&&r.type===z.Foundation);o&&(n=o)}return e.current=!1,n},zK=class zK{static getIntersectionObjects(e){return e.intersections.filter(n=>n.eventObject.name.includes("Cuboid")||n.eventObject.name==="Foundation"||n.eventObject.name.includes("Roof")||n.eventObject.name.includes(zK.WALL_OUTSIDE_SURFACE_MESH_NAME))}static addUndoableMove(){const e=M.getState().selectedElement;if(!e)return;const n=M.getState().getElementById(e.id),o=dt.getState().oldParentId,r=dt.getState().oldFoundationId;if(!n||!o||!r)return;const i=e.type===z.SolarPanel,a=e.type===z.Polygon,l={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:i?e.parentType:void 0,newParentType:i?n.parentType:void 0,oldParentId:o,newParentId:n.parentId,oldFoundationId:r,newFoundationId:n.foundationId,oldNormal:new le().fromArray(e.normal),newNormal:new le().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){s(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.newParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal,a?e.vertices:void 0)},redo(){s(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.oldParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal,a?n.vertices:void 0)}};M.getState().addUndoable(l);const s=(c,u,d,f,p,g,A,y,S)=>{M.getState().set(C=>{const P=C.elements.find(v=>v.id===c);if(P){if(P.type===z.Polygon){if(S){const v=P;v.vertices=[...S]}}else[P.cx,P.cy,P.cz]=[...u];if(d&&f&&p&&(P.parentId=d,P.foundationId=p,g&&P.type===z.SolarPanel&&(P.parentType=g),A&&(P.rotation=[...A]),y&&(P.normal=[y.x,y.y,y.z]),P.type===z.Window)){const v=C.elements.find(b=>b.id===d),T=C.elements.find(b=>b.id===f);if(!v||!T)return;const w=P.lx*T.lx,x=P.lz*T.lz;P.lx=w/v.lx,P.lz=x/v.lz}}})}}static undoInvalidOperation(){M.getState().set(e=>{var n;if(e.selectedElement){for(let o=0;o{const e={name:`Add ${t.type} on Roof`,timestamp:Date.now(),addedElement:t,undo:()=>{M.getState().removeElementById(t.id,!1)},redo:()=>{M.getState().set(n=>{n.elements.push(e.addedElement),n.selectedElement=e.addedElement})}};M.getState().addUndoable(e)},qQt=t=>{for(const e of t.intersections)if(e.eventObject.name.includes("Roof Segments Group"))return e.object.name.includes("Flat roof")?e.point.clone().setZ(e.point.z-.01):e.point;return t.intersections[0].point},$Qt=(t,e,n,o,r)=>{if(t.intersections.length===0)return;const i=M.getState().objectTypeToAdd;if(i===z.None)return;const a=M.getState().getElementById(n),l=M.getState().getElementById(e);if(!a||!l)return;const s=qQt(t),c=new le().subVectors(s,new le(l.cx,l.cy,l.lz/2)).applyEuler(new ln(0,0,-l.rotation[2])),u=c.clone().sub(r);let d=null;switch(i){case z.SolarPanel:{const{normal:f,rotation:p}=bn.computeState(o,u),g=M.getState().actionState;let A=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);A||(A=M.getState().getPvModule(R9)),d=Va.makeSolarPanel(a,A,c.x,c.y,c.z,g.solarPanelOrientation??vr.landscape,g.solarPanelPoleHeight??1,g.solarPanelPoleSpacing??3,g.solarPanelTiltAngle??0,g.solarPanelRelativeAzimuth??0,f,p??[0,0,1],g.solarPanelFrameColor),Gz(d);break}case z.SolarWaterHeater:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeSolarWaterHeater(a,c.x,c.y,c.z,f,p??[0,0,1]),Gz(d);break}case z.Window:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeWindow(a,c.x,c.y,c.z,z.Roof,p,.5,.5),Gz(d);break}case z.Sensor:{const{normal:f,rotation:p}=bn.computeState(o,u);d=Va.makeSensor(a,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),Gz(d);break}case z.Light:{const{normal:f,rotation:p}=bn.computeState(o,u),g=M.getState().actionState;d=Va.makeLight(a,2,g.lightDistance,g.lightIntensity,g.lightColor,c.x/l.lx,c.y/l.ly,c.z,f,p??[0,0,1]),Gz(d);break}}d&&M.getState().set(f=>{f.elements.push(d),f.selectedElement=d,f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(d.id),f.actionModeLock||(f.objectTypeToAdd=z.None)})},p$e=(t,e,n)=>{M.getState().isAddingElement()||M.getState().objectTypeToAdd!==z.None||t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),M.getState().set(o=>{if(o.contextMenuObjectType=null,o.groupActionMode)o.multiSelectionsMode||o.selectedElementIdSet.clear(),o.selectedElementIdSet.has(n)?o.selectedElementIdSet.delete(n):o.selectedElementIdSet.add(n);else for(const r of o.elements)r.id===e?(r.selected=!0,o.selectedElement=r,o.multiSelectionsMode?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):(o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e))):r.selected=!1}))},sN=(t,e,n)=>{const o={name:"Resize Roof Rise",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Roof,oldRise:e,newRise:n,undo:()=>{M.getState().updateRoofRiseById(o.resizedElementId,o.oldRise,0)},redo:()=>{M.getState().updateRoofRiseById(o.resizedElementId,o.newRise,0)}};M.getState().addUndoable(o)},g$e=(t,e)=>{const n={lng:M.getState().language};return bn.rooftopElementBoundaryCheck(t,e)?!0:(M.getState().moveHandleType||M.getState().viewState.orthographic?co(Y.t("message.MoveOutsideBoundaryCancelled",n)):M.getState().resizeHandleType?co(Y.t("message.ResizingOutsideBoundaryCancelled",n)):M.getState().rotateHandleType&&co(Y.t("message.RotationOutsideBoundaryCancelled",n)),!1)},m$e=(t,e,n)=>{const o={lng:M.getState().language};return bn.rooftopElementCollisionCheck(t,e,n)?!0:(M.getState().moveHandleType||M.getState().viewState.orthographic?co(Y.t("message.MoveCancelledBecauseOfOverlap",o)):M.getState().resizeHandleType?co(Y.t("message.ResizingCancelledBecauseOfOverlap",o)):M.getState().rotateHandleType&&co(Y.t("message.RotationCancelledBecauseOfOverlap",o)),!1)},DQ=(t,e,n,o,r,i,a)=>{t!==null&&M.getState().set(l=>{if(t!==null){for(const s of l.elements)if(s.parentId===e&&s.foundationId){if(s.type===z.SolarPanel||s.type===z.SolarWaterHeater){const u=new le(s.cx,s.cy,s.cz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=g+t.lz/2)}else if(s.type===z.Window){const u=new le(s.cx,s.cy,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.rotation=[...p],s.cz=g)}else if(s.type===z.Sensor||s.type===z.Light){const u=new le(s.cx*t.lx,s.cy*t.ly,s.cz+t.lz).clone().sub(o),{segmentVertices:d,normal:f,rotation:p}=bn.computeState(n,u,a);let g;d?g=bn.getRooftopElementZ(d,u,r+i):g=r+i,f&&p&&g!==void 0&&(s.normal=f.toArray(),s.rotation=[...p],s.cz=g)}}}})},cN=(t,e,n,o,r)=>{t.button!==2&&(t.intersections[0].eventObject.name!==t.eventObject.name||(p$e(t,n,e),$Qt(t,e,n,o,r)))},uN=(t,e)=>{const n=M.getState().selectedElement;if(!n||!bn.isValidOnRoof(n))return;const o=M.getState().getElementById(n.id);if(o&&M.getState().moveHandleType&&Eu.getIntersectionObjects(t)[0].eventObject.userData.roofId===e.id&&o.foundationId){const a=M.getState().getElementById(o.foundationId);if(a)switch(o.type){case z.SolarPanel:{const l=o,s=bn.getRoofBoundaryVertices(e),c=bn.getSolarPanelVerticesOnRoof(l,a);!g$e(c,s)||!m$e(l,a,c)?Eu.undoInvalidOperation():Eu.addUndoableMove();break}case z.Sensor:Eu.addUndoableMove();break;case z.Light:Eu.addUndoableMove();break}}M.getState().set(r=>{r.moveHandleType=null})},dN=(t,e)=>{const n=M.getState().getSelectedElement();if(!(!n||!bn.isValidOnRoof(n)))switch(n.type){case z.Sensor:case z.Light:case z.SolarPanel:{if(n.type===z.SolarPanel&&n.parentType===void 0)return;if(M.getState().moveHandleType){const o=Eu.getIntersectionObjects(t);o[0].eventObject.userData.roofId===e&&M.getState().set(i=>{for(const a of i.elements)if(a.id===n.id){const{roofId:l,foundation:s,centroid:c,roofSegments:u}=o[0].eventObject.userData;if(s&&c&&u&&l){const d=o[0].point,f=new le().subVectors(d,new le(s.cx,s.cy)).applyEuler(new ln(0,0,-s.rotation[2])),p=f.clone().sub(c),{normal:g,rotation:A}=bn.computeState(u,p);a.cx=f.x/s.lx,a.cy=f.y/s.ly,a.cz=f.z-s.lz,a.rotation=[...A],a.normal=g.toArray(),a.parentId=l,a.foundationId=s.id,a.type===z.SolarPanel&&(a.parentType=z.Roof,a.color="#fff"),i.selectedElement&&(i.selectedElement.parentId=l,i.selectedElement.foundationId=s.id),dt.getState().setPrimitiveStore("showWallIntersectionPlaneId",null)}break}})}}}},CR=(t,e)=>{t.intersections.length>0&&t.intersections[0].eventObject.name===t.eventObject.name&&(t.stopPropagation(),M.getState().set(n=>{n.contextMenuObjectType=z.Roof,n.pastePoint.copy(t.intersections[0].point);for(const o of n.elements)if(o.id===e)if(o.selected=!0,n.selectedElement=o,n.selectedElementIdSet.has(e))for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id);else if(n.multiSelectionsMode){n.selectedElementIdSet.add(e);for(const r of n.elements)n.selectedElementIdSet.has(r.id)&&r.type!==n.selectedElement.type&&n.selectedElementIdSet.delete(r.id)}else n.selectedElementIdSet.clear(),n.selectedElementIdSet.add(e);else o.selected=!1}))},nh=({position:t,onPointerDown:e,onPointerUp:n,onPointerOver:o})=>{const r=M(pn),i=a5(),{gl:a}=ri(),l=m.useRef(!1),s=m.useRef(!1),c=m.useRef(!1),u=m.useRef(null),[d,f]=m.useState("white"),p=A=>{A?(f(ga),a.domElement.style.cursor="pointer"):(f("white"),a.domElement.style.cursor="default")};m.useEffect(()=>{const A=()=>{s.current&&(c.current=!0),!s.current&&l.current&&p(!1),l.current=!1};return window.addEventListener("pointerup",A),()=>{window.removeEventListener("pointerup",A)}},[]);const g=A=>{if(A.intersections.length>0){for(const{eventObject:y}of A.intersections)if(y.name==="Roof Handle")return y===u.current}return!1};return h.jsx(Ps,{name:"Roof Handle",ref:u,args:[i],position:t,onPointerMove:A=>{g(A)?(c.current=!1,s.current||(s.current=!0,p(!0))):f("white")},onPointerOut:A=>{c.current||(l.current||(A.intersections.length>0&&A.intersections[0].eventObject.name==="Roof Handle"?f("white"):p(!1)),s.current=!1,r(y=>{y.hoveredHandle=null}))},onPointerDown:A=>{g(A)&&(e&&e(A),l.current=!0)},onPointerUp:A=>{g(A)&&n&&n(A)},onPointerOver:A=>{g(A)&&o&&o(A)},onPointerLeave:A=>{g(A)&&r(y=>{y.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{attach:"material",color:d})})},QQt=({roofModel:t,foundationModel:e})=>{const n=M(Ap),{id:o,wallsId:r,roofType:i}=t;return m.useEffect(()=>{r.length===0&&n(o,!1)},[r]),(()=>{switch(i){case Go.Pyramid:return h.jsx(Zxt,{roofModel:t,foundationModel:e});case Go.Gable:return h.jsx(ubt,{roofModel:t,foundationModel:e});case Go.Hip:return h.jsx(pbt,{roofModel:t,foundationModel:e});case Go.Gambrel:return h.jsx(rbt,{roofModel:t,foundationModel:e});case Go.Mansard:return h.jsx(Abt,{roofModel:t,foundationModel:e});default:return null}})()};function ZH(t,e){return t.roofModel===e.roofModel&&t.foundationModel.lx===e.foundationModel.lx&&t.foundationModel.ly===e.foundationModel.ly&&t.foundationModel.lz===e.foundationModel.lz}const ZQt=be.memo(QQt,ZH),eM=t=>{const e=m.useMemo(()=>{let i;switch(t){case Ur.NoTexture:i=og;break;case Ur.Texture01:i=Mxt;break;case Ur.Texture02:i=Ixt;break;case Ur.Texture03:i=zxt;break;case Ur.Texture04:i=Dxt;break;case Ur.Texture05:i=Ext;break;case Ur.Texture06:i=Fxt;break;case Ur.Texture07:i=kxt;break;default:i=Hxt}return new cf().load(i,a=>{switch(a.wrapS=a.wrapT=bs,t){case Ur.NoTexture:case Ur.Default:a.repeat.set(5,3);break;case Ur.Texture01:a.repeat.set(.5,.25);break;case Ur.Texture03:a.repeat.set(.9,.9);break;case Ur.Texture04:case Ur.Texture05:case Ur.Texture06:a.repeat.set(.75,.75);break;default:a.repeat.set(.5,.5)}o(a),r()})},[t]),[n,o]=m.useState(e),{invalidate:r}=ri();return n},tM=(t,e)=>{const n=M(mA),o=M(Ju);return{transparent:t||n&&o,opacity:Math.min(e!==void 0?e:1,n&&o||t?.25:1)}},y$e=(t,e,n)=>{const o=M(l=>l.elements.filter(s=>s.foundationId===t&&s.type===z.Wall),cy),r=l=>o.find(s=>s.id===l),i=m.useRef(!1);return{currentWallArray:m.useMemo(()=>{for(const l of n){let s=r(l);if(!s)return[];const c=[],u=s;let d=0;for(;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.leftJoints[0]);)if(s.leftJoints[0]!==u.id)s=r(s.leftJoints[0]);else return c.reverse(),i.current=!0,c;for(c.reverse(),s=r(u.rightJoints[0]),d=0;s&&(!s.roofId||s.roofId===e)&&d++<100&&(c.push(s),s.rightJoints[0]&&s.rightJoints[0]!==u.id);)s=r(s.rightJoints[0]);if(i.current=!1,c.length>1)return c}return[]},[n,o]),isLoopRef:i}},jye=(t,e)=>{const n=M(r=>r.elements.filter(i=>i.foundationId===e&&i.type===z.Wall),cy);return m.useMemo(()=>{var f;const r=p=>n.find(g=>g.id===p),i=new Map,a=new Map,l=r(t);let s=l,c=0,u=!1;for(;s&&s.type===z.Wall&&c<100;){i.set(s.id,s);const p=s.relativeAngle.toFixed(1);if(a.has(p)?(f=a.get(p))==null||f.push(s):a.set(p,[s]),s.rightJoints.length!==0){if(s=r(s.rightJoints[0]),s&&s.id===l.id){u=!0;break}c++}else s=null}if(!u||a.size!==4)return null;const d=[];for(const[p,g]of a){let A=0;for(const v of g){const T=i.get(v.leftJoints[0]),w=i.get(v.rightJoints[0]);if(T&&T.relativeAngle.toFixed(1)!==p&&A++,w&&w.relativeAngle.toFixed(1)!==p&&A++,A>2)break}if(A!==2)return null;let y=null,S=null,C=0,P=-1;for(const v of g){const T=i.get(v.leftJoints[0]),w=i.get(v.rightJoints[0]);C=Math.max(C,v.lz),P=Math.max(P,v.eavesLength),T&&T.relativeAngle.toFixed(1)!==p&&(y=v),w&&w.relativeAngle.toFixed(1)!==p&&(S=v)}y&&S&&C>0&&P!==-1&&d.push({leftPoint:new le().fromArray(y.leftPoint),rightPoint:new le().fromArray(S.rightPoint),relativeAngle:y.relativeAngle,lz:C,eavesLength:P,wallsId:g.map(v=>v.id)})}return d.length!==4?null:d},[n])},Bye=(t,e,n)=>{const o=m.useMemo(()=>bn.getHighestComposedWallHeight(t,n),[t]),r=m.useMemo(()=>o+e,[o,e]);return{highestWallHeight:o,topZ:r}},A$e=(t,e,n)=>{const o=m.useMemo(()=>bn.getHighestWallHeight(t,n),[t]),[r,i]=m.useState(e),a=o+r;return m.useEffect(()=>{e!==r&&i(e)},[e]),{highestWallHeight:o,topZ:a,riseInnerState:r,setRiseInnerState:i}},fN=(t,e,n,o,r,i)=>{const a=dt(wW),l=dt(Lge),s=dt(AW),c=()=>{const u=f=>f.clone().add(e),d=[];if(o)if(r===Go.Gambrel)d.push(Vye(n).map(u));else{const f=[];for(const p of n)f.push(p.points[1].clone().add(e));d.push(f)}else{for(const f of n){const p=f.points;if(p.length===6)d.push(p.slice(3).map(u));else if(p.length===8)d.push(p.slice(4).map(u));else throw new Error("Invalid Roof segment data")}i&&d.push(i)}return Cn.getState().setRoofSegmentVertices(t,d),d};return(a||l||s)&&c(),m.useEffect(()=>{c()},[n]),c},hN=t=>{const e=dt(AW),n=dt(Xq);(e||n)&&t()},pN=(t,e)=>{const n=M(FH);m.useEffect(()=>{t.rise===void 0&&M.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Roof){const i=r;i.rise===void 0&&(i.rise=i.lz-e,i.lz=0);break}})},[n])},eZt=()=>{const[,t]=m.useState(!1);m.useEffect(()=>{t(e=>!e)},[])},EQ=()=>{const t=m.useRef(!0);return t.current?(t.current=!1,!0):!1},Yye=(t,e,n,o,r,i,a)=>{const l=M(s=>s.updateElementOnRoofFlag);m.useEffect(()=>{l&&(DQ(t,e,n,o,r,i,a),M.getState().setUpdateElementOnRoofFlag(!1))},[r,i,l])},tZt=(t,e,n,o,r,i,a)=>{const l=EQ();m.useEffect(()=>{l||DQ(t,e,n,o,r,i,a)},[n])},Oye=(t,e,n,o,r,i,a)=>{tZt(t,e,n,o,r,i,a),Yye(t,e,n,o,r,i,a)},gN=(t,e,n,o)=>{const r=h$e(e);return m.useMemo(()=>({roofId:t,foundation:r,centroid:n,roofSegments:o}),[t,n,o,r])},MSe=(t,e)=>{const[n,o,r,i]=e;t.moveTo(n.points[0].x,n.points[0].y),t.lineTo(n.points[1].x,n.points[1].y),t.lineTo(i.points[0].x,i.points[0].y),t.lineTo(i.points[1].x,i.points[1].y),t.closePath()},Vye=(t,e)=>{const n=[],[o,r,i,a]=t;return n.push(o.points[0].clone()),n.push(o.points[1].clone()),n.push(a.points[0].clone()),n.push(a.points[1].clone()),e?(e.push(...n),e):n},uX=({uuid:t,shape:e,thickness:n,holeMeshes:o,simulation:r,castShadow:i,receiveShadow:a,children:l})=>{const s=m.useRef(null);if(s.current&&(s.current.geometry=new N9(e,{steps:1,depth:n,bevelEnabled:!1}),s.current.updateMatrix(),o.length>0)){const c=[];for(let d=0;d{const f=M.getState().world,p=M(Cs),g=dt(hs),A=dt(p3),y=M(e5),S=M(a3),C=M(l3),P=Cn(yW),v=Cn.getState().hourlyHeatExchangeArrayMap,T=m.useRef(0),w=m.useRef(),x=m.useRef(),{transparent:b,opacity:R}=tM(),H=M(V=>V.elements.filter(G=>G.type===z.Window&&G.parentId===t),cy),F=m.useMemo(()=>{if(!A||e&&e.notBuilding)return;const V=v.get(t);if(!V)return;const G=V.reduce((ve,we)=>ve+we,0),q=P(t);if(!q||!q[0])return;const $=[],ie=q[0].map(ve=>ve.clone().sub(r)),Q=i3*(f.solarRadiationHeatmapGridCellSize??.5),se=ie[0].clone(),oe=ie[1].clone(),Z=ie[2].clone(),te=new le().subVectors(oe,se),ee=new le().subVectors(Z,se),de=new le().subVectors(Z,oe),fe=te.length(),pe=new le().crossVectors(ee,de).length()/fe,ye=Math.max(2,Math.floor(fe/Q)),ae=Math.max(2,Math.floor(pe/Q));te.normalize(),ee.normalize(),de.normalize();const Te=new le().crossVectors(ee,de).normalize(),ge=te.multiplyScalar(.5*fe/ye),Se=new le().crossVectors(Te,te).normalize().multiplyScalar(.5*pe/ae),Re=se.clone().add(ge).add(Se).add(new le(0,0,i));ge.multiplyScalar(2),Se.multiplyScalar(2),w.current=Te.clone().multiplyScalar(.1);const De=new le,Ae=new Array;for(const ve of ie)Ae.push({x:ve.x,y:ve.y});const ue=me.getPolygonArea(Ae);if(ue===0)return;const he=G/ue*(y??Qm);T.current=he<0?1:0,x.current=new ln(-Math.sign(he)*Qt,0,0);for(let ve=0;ve{if(o.length===0)return[new le];const V=[];if(n===Go.Gambrel){Vye(o,V);const G=V.reduce((q,$)=>Math.max(q,$.z),0);V.forEach(q=>q.setZ(G))}else{V.push(o[0].points[0]);for(const G of o){const q=G.points[1];V.push(q)}}return V},[o,n]),N=m.useMemo(()=>new le(0,0,i),[i]),U=h.jsx(Gn,{points:E,lineWidth:l,color:a}),W=eM(u),k=m.useMemo(()=>{const V=new kl;if(o.length===0)return V;if(n===Go.Gambrel)MSe(V,o);else{const G=o[0].points[0];V.moveTo(G.x,G.y);for(const q of o){const $=q.points[1];V.lineTo($.x,$.y)}V.closePath()}return V},[o,r,n]),D=m.useMemo(()=>{const V=new kl;if(o.length===0)return V;if(n===Go.Gambrel)MSe(V,o);else{const G=o[0].points[0];V.moveTo(G.x,G.y);for(const q of o){const $=q.points[1];V.lineTo($.x,$.y)}V.closePath()}if(H.length>0)for(const G of H){const q=new le(G.cx,G.cy,G.cz).sub(r);switch(G.windowType){case Ci.Polygonal:{const[$,ie]=G.polygonTop??Gp,[Q,se,oe]=[G.lx/2,G.lz/2,$*G.lx],Z=SG(Q,se,oe,ie,q.x,q.y);V.holes.push(Z);break}case Ci.Arched:{const $=bG(G.lx,G.lz,G.archHeight,q.x,q.y);V.holes.push($);break}default:{const $=new kl,[ie,Q]=[G.lx/2,G.lz/2];$.moveTo(q.x-ie,q.y-Q),$.lineTo(q.x+ie,q.y-Q),$.lineTo(q.x+ie,q.y+Q),$.lineTo(q.x-ie,q.y+Q),$.closePath(),V.holes.push($)}}}return V},[o,r,H,n]),L=m.useMemo(()=>H.map(V=>{const[G,q,$]=V.rotation,ie=new le(V.cx,V.cy,V.cz).sub(r),Q=new ln().fromArray([V.rotation[0],V.rotation[1],V.rotation[2],"ZXY"]);switch(V.windowType){case Ci.Polygonal:{const[se,oe]=V.polygonTop??Gp,[Z,te,ee]=[V.lx/2,V.lz/2,se*V.lx],de=SG(Z,te,ee,oe),fe=new ls(new N9([de],{steps:1,depth:V.ly,bevelEnabled:!1})),pe=new le(0,0,-V.ly).applyEuler(Q);return fe.position.copy(ie.clone().add(pe)),fe.rotation.copy(Q),fe.updateMatrix(),fe}case Ci.Arched:{const se=bG(V.lx,V.lz,V.archHeight),oe=new ls(new N9([se],{steps:1,depth:V.ly,bevelEnabled:!1})),Z=new le(0,0,-V.ly).applyEuler(Q);return oe.position.copy(ie.clone().add(Z)),oe.rotation.copy(Q),oe.updateMatrix(),oe}default:{const se=new ls(new n3(V.lx,V.lz,V.ly*2));return se.position.copy(ie),se.rotation.set(G,q,$),se.updateMatrix(),se}}}),[H,i]),j=u===Ur.NoTexture&&c&&c===s,B=p&&!b,O=g&&d;return h.jsxs(h.Fragment,{children:[j&&!O?h.jsx(uX,{uuid:t,simulation:!0,shape:k,holeMeshes:L,thickness:i,castShadow:B,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:c,transparent:b,opacity:R})}):h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{uuid:t,userData:{simulation:!0},name:"Flat roof top shape",position:[0,0,i+.001],receiveShadow:p,children:[h.jsx("shapeGeometry",{args:[D]}),O?h.jsx("meshBasicMaterial",{map:d,side:Da}):h.jsx("meshStandardMaterial",{map:W,color:c,transparent:b,opacity:R,side:Da})]}),h.jsx(uX,{shape:k,holeMeshes:L,thickness:i,castShadow:B,receiveShadow:p,children:h.jsx("meshStandardMaterial",{color:s??"white",transparent:b,opacity:R})})]}),U,h.jsxs("group",{position:[0,0,i],children:[U,E.map((V,G)=>{const q=[V.clone().sub(N),V];return h.jsx(Gn,{points:q,lineWidth:l,color:a},G)})]}),F&&F.map((V,G)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:V,name:"Heat Flux "+G,lineWidth:C??Zm,color:S??p0}),";",h.jsx(xf,{userData:{unintersectable:!0},position:w.current?V[T.current].clone().add(w.current):V[0],args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:S??p0})})]},G))]})},w$e="/aladdin/assets/foundation_01--kFbnI98.png",v$e="/aladdin/assets/foundation_02-wZzxF61c.png",x$e="/aladdin/assets/foundation_03-CrR6CCyr.png",b$e="/aladdin/assets/foundation_04-k0ozbTjk.png",S$e="/aladdin/assets/foundation_05-Bwrj98Mu.png",T$e="/aladdin/assets/foundation_06-BOa0J0il.png",P$e="/aladdin/assets/foundation_07-C9gRAfER.png",mN="/aladdin/assets/helvetiker_regular.typeface-B9JafPRX.fnt",_ye=be.memo(({element:t,height:e})=>{const n=M(o$),o=M(ly),r=M(x7t),i=M(Gr),a=M(mA),[l,s]=m.useState(),[c,u]=m.useState(10),[d,f]=m.useState(0);m.useEffect(()=>{if(n||o){const{cx:P,cy:v,lx:T,ly:w,type:x}=t;switch(x){case z.SolarPanel:{const b=i(t);if(b){const R=P*b.lx,H=v*b.ly;s(new le(R,H,e??b.lz))}break}case z.Foundation:{s(new le(P,v,a?.1:0));break}case z.Cuboid:{const{pos:b}=me.getWorldDataById(t.id),{rot:R}=me.getWorldDataById(t.parentId);s(new le(b.x,b.y,b.z-t.lz/2+.2)),f(R);break}default:{s(new le(P,v,a?.2:0));break}}u(Math.max(5,Math.hypot(T,w)*.75))}},[t,n,o,a,e]);const p=r3(hW,mN),g=c*.05,A={font:p,height:0,size:g},y=new Array(25).fill(0),S=P=>P===0?-g*.3:P>0&&P<7?-g*.8:-g*1.2,C=a?"#222":"#ccc";return h.jsx(h.Fragment,{children:l&&h.jsxs("group",{position:l,rotation:[Qt,d,0],name:"Polar Auxiliary",children:[h.jsx("polarGridHelper",{args:[c,24,6,120,C,C],userData:{unintersectable:!0}}),h.jsx(wG,{args:[c*.98,c,24,1,Qt,r],userData:{unintersectable:!0},rotation:[-Qt,0,0],children:h.jsx("meshBasicMaterial",{side:ti,color:"yellow"})}),h.jsx("group",{rotation:[0,r,0],children:h.jsx("mesh",{position:[-.5,0,-c*.9],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-me.toDegrees(r).toFixed(1)}°`,A]})})}),y.map((P,v)=>{let T=Math.ceil(v/2)*(v%2===0?1:-1);T===-12&&(T=12);const w=S(Math.abs(T));return h.jsx("group",{rotation:[0,T*Math.PI/12,0],children:h.jsxs("mesh",{position:[w,0,-c*1.05],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*T}°`,A]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},v)})]})})}),dX=be.memo(({id:t,position:e,ratio:n,handleType:o,hoverHandle:r,noHoverHandle:i})=>{const a=M(pu),l=M(o$),c=M(ly)===o||l===o?ga:$a,u=h.jsx("meshBasicMaterial",{color:c});return h.jsxs("group",{position:e,rotation:[Qt,0,0],scale:n,name:o,children:[h.jsxs("group",{children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:u}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:u}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:u})]}),h.jsx(ta,{name:o,args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1,onPointerDown:d=>{a(t,d,Xo.Rotate)},onPointerOver:d=>{r(d,o)},onPointerOut:i})]})}),mw=be.memo(({hx:t,hy:e,hz:n,lineColor:o="black",lineWidth:r=.2})=>h.jsx(Gn,{points:[[-t,-e,-n],[t,-e,-n],[t,-e,n],[t,-e,-n],[t,e,-n],[t,e,n],[t,e,-n],[-t,e,-n],[-t,e,n],[-t,e,-n],[-t,-e,-n],[-t,-e,n],[t,-e,n],[t,e,n],[-t,e,n],[-t,-e,n]],name:"Wireframe",userData:{unintersectable:!0},lineWidth:r,color:o}));var Jr=(t=>(t.left="Left",t.right="Right",t.loop="Loop",t.null="Null",t))(Jr||{});const Gye=be.memo(({element:t,verticalLift:e})=>{const n=M(m0),o=M(Ju),r=M(Ug),i=M(ly),a=t.lx/2,l=t.ly/2,s=.2,c=1,u=.5,d=t.lineColor??"white",f="darkorchid",p=Math.max(1,(a+l)/32),g=m.useMemo(()=>({lng:n}),[n]),A=m.useMemo(()=>{switch(t.type){case z.Cuboid:return Math.max(.5,Math.max(a,l)*.1)}return .5},[t.type,a,l]),y=m.useMemo(()=>{switch(t.type){case z.Cuboid:return o?t.lz/2+.1:-t.lz/2+.1;case z.Foundation:return t.lz+.1}return .1},[o,t.type,t.lz]),S=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[-a-A,0,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A,-l,y],[-a-A,l,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A+s,-l+3*s,y],[-a-A,-l,y],[-a-A-s,-l+3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a-A+s,l-3*s,y],[-a-A,l,y],[-a-A-s,l-3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l,y],[-a-A*2,-l,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l,y],[-a-A*2,l,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),C=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.ly.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[a+A,0,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A,-l,y],[a+A,l,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A+s,-l+3*s,y],[a+A,-l,y],[a+A-s,-l+3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a+A+s,l-3*s,y],[a+A,l,y],[a+A-s,l-3*s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,-l,y],[a+A*2,-l,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,l,y],[a+A*2,l,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),P=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,-l-A,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l-A,y],[a,-l-A,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a+3*s,-l-A-s,y],[-a,-l-A,y],[-a+3*s,-l-A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a-3*s,-l-A-s,y],[a,-l-A,y],[a-3*s,-l-A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,-l,y],[-a,-l-A*2,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,-l,y],[a,-l-A*2,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]),v=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:f,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",g),fontSize:80,fontFace:"Times Roman",textHeight:p,position:[0,l+A,y+e]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l+A,y],[a,l+A,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a+3*s,l+A-s,y],[-a,l+A,y],[-a+3*s,l+A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a-3*s,l+A-s,y],[a,l+A,y],[a-3*s,l+A+s,y]],color:d,linewidth:c}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-a,l,y],[-a,l+A*2,y]],color:d,linewidth:u}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[a,l,y],[a,l+A*2,y]],color:d,linewidth:u})]}),[a,l,y,g,d,e]);if(r)if(t.type===z.Wall)switch(r){case Mt.LowerLeft:return P;case Mt.LowerRight:return P}else switch(r){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[S,P]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[S,v]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[C,v]})}if(i)if(t.type===z.Wall)switch(i){case Mt.LowerLeft:return P;case Mt.LowerRight:return P}else switch(i){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[S,P]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[C,P]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[S,v]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[C,v]})}return h.jsx(h.Fragment,{})}),nZt=1.361,ISe=9.8067,zSe=1012,mO=1.225,H4=273.15,DSe=567e-10,oZt=[.103,.104,.109,.12,.13,.137,.138,.134,.121,.111,.106,.103];var li=(t=>(t[t.NONE=0]="NONE",t[t.KASTEN_YOUNG=1]="KASTEN_YOUNG",t[t.SPHERE_MODEL=2]="SPHERE_MODEL",t))(li||{});const T2=1440,lde=Math.PI/720,Zie=Math.PI/182.5,ESe=30,rZt=120;class FSe{constructor(e,n){this.sunrise=e,this.sunset=n}daylight(){return this.sunset-this.sunrise}}const c6=.5,k0=.1,fP=23.45/180*Math.PI,iZt=1e3*60*60*24,FC=720,yN=t=>{const e=Math.floor((t.getTime()-new Date(t.getFullYear(),0,0).getTime())/iZt);return fP*Math.sin(sa*(284+e)/365.25)},dl=(t,e)=>{const n=Math.tan(me.toRadians(e))*Math.tan(yN(t));if(Math.abs(n)>1)return new FSe(0,n>0?FC*2:0);const o=60*Math.acos(-n)/me.toRadians(15);return new FSe(FC-o,FC+o)},Xye=t=>(t.getHours()*60+t.getMinutes()-FC)/FC*Math.PI,yO=t=>(t/FC-1)*Math.PI,ki=(t,e)=>a9(1,Xye(t),yN(t),me.toRadians(e)).normalize(),a9=(t,e,n,o)=>{const r=Math.cos(n),i=Math.sin(n),a=Math.cos(o),l=Math.sin(o),s=Math.cos(e),c=Math.sin(e),u=Math.asin(i*l+r*s*a),d=c*r,f=a*i-s*r*l,p=Math.atan2(f,d),g=new le(t,p,u);return me.sphericalToCartesianZ(g),g.x=-g.x,g},aZt=t=>{const e=sa*t/365,n=1.00011+.034221*Math.cos(e)+.00128*Math.sin(e)+719e-6*Math.cos(2*e)+77e-6*Math.sin(2*e);return nZt*n},lZt=(t,e,n)=>{let o;switch(t){case li.NONE:return 1;case li.KASTEN_YOUNG:return o=e.angleTo(ko),1/(Math.cos(o)+.50572*Math.pow(96.07995-o/Math.PI*180,-1.6364));default:{o=e.angleTo(ko);const r=Math.cos(o),i=708,a=n/9e3;return Math.sqrt((i+a)*(i+a)*r*r+(2*i+1+a)*(1-a))-(i+a)*r}}},xi=(t,e,n,o)=>aZt(e)*Math.pow(.7,Math.pow(lZt(o,t,n),.678)),qr=(t,e,n,o)=>{let r=0;const i=n.dot(ko),a=.5*(1+i);a>0&&(r+=oZt[e]*a*o);const l=.5*Math.abs(1-i);return me.isZero(l)||(r+=t.albedo*l*o),r},sZt=be.memo(({foundation:t})=>{const e=M(Al),n=M(s0),o=dt(aYe),r=dt(Cf),i=dt(Gge),a=dt(hs),l=M(Pf),s=Cn(c1),[c,u]=m.useState(null),d=m.useRef(null),{lx:f,ly:p,lz:g,solarUpdraftTower:A}=t,y=((A==null?void 0:A.collectorRadius)??100)*.016,S=m.useMemo(()=>ki(new Date(e),n),[e,n]),C=m.useMemo(()=>{const v=[],T=(((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))+g)/2,w=(A==null?void 0:A.chimneyHeight)??Math.max(f,p),x=(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,b=(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),R=x*1.15,H=b*.5,F=b,E=b*2,N=b*4,U=6;for(let W=0;W{const v=[],T=((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))+g,w=(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,x=25,b=2*w/x;for(let R=0;R<=x;R++){const H=[],F=-w+R*b,E=Math.sqrt(w*w-F*F);H.push(new le(-E,F,T)),H.push(new le(E,F,T)),v.push({points:H})}for(let R=0;R<=x;R++){const H=[],F=-w+R*b,E=Math.sqrt(w*w-F*F);H.push(new le(F,-E,T)),H.push(new le(F,E,T)),v.push({points:H})}return v},[f,p,g,A==null?void 0:A.collectorRadius,A==null?void 0:A.collectorHeight]);return m.useEffect(()=>{if(t&&a){const v=s(t.id+"-sut");v&&u(me.fetchHeatmapTexture(v,l??5))}},[a,l]),Z2((v,T)=>{(o||r&&!i)&&S.z>0&&d.current&&d.current.children.forEach(w=>{if(w.name==="Streamlines"){const x=w;x.material.uniforms.dashOffset.value-=T*y*10}})}),h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0,simulation:!0},name:"Chimney",castShadow:!0,receiveShadow:!1,args:[(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),(A==null?void 0:A.chimneyHeight)??Math.max(f,p),16,2,!0],position:[0,0,((A==null?void 0:A.chimneyHeight)??Math.max(f,p))/2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Chimney Base",castShadow:!0,receiveShadow:!1,args:[(A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)),((A==null?void 0:A.chimneyRadius)??Math.max(1,.025*Math.min(f,p)))*1.6,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))*4,16,2,!0],position:[0,0,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))*2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Greenhouse Wall",castShadow:!0,receiveShadow:!0,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,(A==null?void 0:A.collectorHeight)??Math.max(3,10*g),50,2,!0],position:[0,0,((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))/2+g],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),h.jsx(uR,{uuid:t.id+"-sut",userData:{unintersectable:!0,simulation:!0},name:"Greenhouse Ceiling",castShadow:!1,receiveShadow:!1,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,50,0,sa],position:[0,0,g+((A==null?void 0:A.collectorHeight)??Math.max(3,10*g))],children:a&&c?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:c}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:50,side:Da,color:"lightskyblue",transparent:!0,opacity:.75})}),h.jsx(uR,{userData:{unintersectable:!0},name:"Greenhouse Ground",castShadow:!1,receiveShadow:!0,args:[(A==null?void 0:A.collectorRadius)??Math.min(f,p)/2,50,0,sa],position:[0,0,.1],children:h.jsx("meshStandardMaterial",{attach:"material",color:"dimgray"})}),P&&P.map((v,T)=>h.jsx(Gn,{name:"Greenhouse Roof Grid Lines",userData:{unintersectable:!0},points:v.points,castShadow:!1,receiveShadow:!1,lineWidth:.2,color:"gray"},T)),S.z>0&&C&&h.jsx("group",{ref:d,children:C.map((v,T)=>{const w=v.points[0].x+v.points[1].x,x=v.points[0].y+v.points[1].y,b=new ln(0,0,sa*T/C.length+Qt),R=y,H=y;return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Streamlines",userData:{unintersectable:!0},points:v.points,castShadow:!1,receiveShadow:!1,lineWidth:.5,dashed:!0,dashSize:R,gapSize:H,color:"white"}),h.jsx(xf,{userData:{unintersectable:!0},args:[y,y*4,4,2],name:"Streamline Inlet Arrow Head",position:[w*.1,x*.1,v.points[0].z],rotation:b,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(xf,{userData:{unintersectable:!0},args:[y,y*4,4,2],name:"Streamline Inlet Arrow Head",position:[w*.9,x*.9,v.points[0].z],rotation:b,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})})]},T)})})]})}),Jye="/aladdin/assets/glow-CV5NAijT.png",cZt=be.memo(({foundation:t})=>{const e=M(Al),n=M(s0),o=Hb(Jye),r=m.useMemo(()=>ki(new Date(e),n),[e,n]),{lz:i,solarPowerTower:a}=t,l=(a==null?void 0:a.towerRadius)??1,s=(a==null?void 0:a.towerHeight)??20,c=s/10,u=l*1.5,d=Math.max(c,u)*2.4;return h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0},name:"Focus Tower",castShadow:!0,receiveShadow:!1,args:[l,l,s,6,2],position:[0,0,s/2+i/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Center Receiver",castShadow:!0,receiveShadow:!1,args:[u,u,c,10,2],position:[0,0,s+i/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),r.z>0&&h.jsx("mesh",{position:[0,0,s+i/2],children:h.jsx("sprite",{scale:[d,d,d],children:h.jsx("spriteMaterial",{map:o,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})})]})}),uZt=be.memo(({foundation:t})=>{const{ly:e,lz:n,solarAbsorberPipe:o}=t,r=(o==null?void 0:o.absorberHeight)??10,i=(o==null?void 0:o.apertureWidth)??.6,a=(o==null?void 0:o.relativeLength)??.9,l=(o==null?void 0:o.poleNumber)??5,s=m.useMemo(()=>{const c=[],u=a*e/(l+1);for(let d=1;d<=l;d++)c.push(new le(0,d*u-a*e/2,r/2+n/2));return c},[e,n,l,r,a]);return h.jsxs("group",{children:[h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 1",castShadow:!1,receiveShadow:!1,args:[i/4,i/4,r,6,2],position:[0,-a*e/2,r/2+n/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Vertical Pipe 2",castShadow:!1,receiveShadow:!1,args:[i/4,i/4,r,6,2],position:[0,a*e/2,r/2+n/2],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Receiver Horizontal Pipe",castShadow:!1,receiveShadow:!1,args:[i/2,i/2,a*e+i/2,6,2,!1,3*Qt,Math.PI],position:[0,0,r+n/2-i/4],rotation:[0,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white",side:ti})}),s&&s.map((c,u)=>h.jsx(ma,{userData:{unintersectable:!0},name:"Solar Receiver Pole "+u,castShadow:!1,receiveShadow:!1,args:[i/8,i/8,r,4,2],position:c,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})},u))]})});class Px{static selectMe(e,n,o,r){var i,a,l;if(o.intersections.length>0&&o.intersections.filter(c=>!c.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===o.eventObject){for(const c of e.elements)c.id===n?(c.selected=!0,e.selectedElement=c,e.selectedElementHeight=c.lz):c.selected=!1;if(!e.selectedElement)return;if(r===Xo.ContextMenu)if(e.selectedElementIdSet.has(n))for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id);else if(e.multiSelectionsMode){e.selectedElementIdSet.add(n);for(const c of e.elements)e.selectedElementIdSet.has(c.id)&&c.type!==e.selectedElement.type&&e.selectedElementIdSet.delete(c.id)}else e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n);else e.multiSelectionsMode?e.selectedElementIdSet.has(n)?e.selectedElementIdSet.delete(n):e.selectedElementIdSet.add(n):(e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n));if(e.moveHandleType=null,e.resizeHandleType=null,e.rotateHandleType=null,r)switch(r){case Xo.Move:((i=e.selectedElement)==null?void 0:i.type)===z.Tree||((a=e.selectedElement)==null?void 0:a.type)===z.Human?e.moveHandleType=zo.Default:e.moveHandleType=o.eventObject.name;break;case Xo.Resize:e.resizeHandleType=o.eventObject.name;break;case Xo.Rotate:e.rotateHandleType=o.eventObject.name;break;case Xo.Select:e.selectedElementAngle=((l=o.object.parent)==null?void 0:l.rotation.z)??0;break}}}static selectNone(e){e.selectedElementIdSet.clear();for(const n of e.elements)n.selected=!1;e.selectedElement=null,e.selectedElementIdSet.clear()}static clearThenAddSelectedElementIdSet(e,n){e.selectedElementIdSet.clear(),e.selectedElementIdSet.add(n)}}var fX={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */fX.exports;(function(t,e){(function(){var n,o="4.17.21",r=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",d=1,f=2,p=4,g=1,A=2,y=1,S=2,C=4,P=8,v=16,T=32,w=64,x=128,b=256,R=512,H=30,F="...",E=800,N=16,U=1,W=2,k=3,D=1/0,L=9007199254740991,j=17976931348623157e292,B=NaN,O=4294967295,V=O-1,G=O>>>1,q=[["ary",x],["bind",y],["bindKey",S],["curry",P],["curryRight",v],["flip",R],["partial",T],["partialRight",w],["rearg",b]],$="[object Arguments]",ie="[object Array]",Q="[object AsyncFunction]",se="[object Boolean]",Z="[object Date]",ee="[object DOMException]",te="[object Error]",oe="[object Function]",de="[object GeneratorFunction]",he="[object Map]",pe="[object Number]",me="[object Null]",le="[object Object]",Te="[object Promise]",ge="[object Proxy]",Se="[object RegExp]",Re="[object Set]",De="[object String]",Ae="[object Symbol]",ue="[object Undefined]",fe="[object WeakMap]",ve="[object WeakSet]",we="[object ArrayBuffer]",Pe="[object DataView]",Ie="[object Float32Array]",Me="[object Float64Array]",ze="[object Int8Array]",Ne="[object Int16Array]",Je="[object Int32Array]",Ue="[object Uint8Array]",nt="[object Uint8ClampedArray]",We="[object Uint16Array]",Ee="[object Uint32Array]",ke=/\b__p \+= '';/g,Oe=/\b(__p \+=) '' \+/g,st=/(__e\(.*?\)|\b__t\)) \+\n'';/g,je=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,gt=RegExp(je.source),Ye=RegExp(xt.source),it=/<%-([\s\S]+?)%>/g,ut=/<%([\s\S]+?)%>/g,Qe=/<%=([\s\S]+?)%>/g,lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ze=/^\w*$/,Be=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$e=/[\\^$.*+?()[\]{}|]/g,wt=RegExp($e.source),vt=/^\s+/,Rt=/\s/,Gt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,At=/\{\n\/\* \[wrapped with (.+)\] \*/,pt=/,? & /,Wt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,It=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ft=/\w*$/,Ve=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,kt=/^\[object .+?Constructor\]$/,rt=/^0o[0-7]+$/i,at=/^(?:0|[1-9]\d*)$/,Ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yt=/($^)/,Pt=/['\n\r\u2028\u2029\\]/g,ot="\\ud800-\\udfff",bt="\\u0300-\\u036f",zt="\\ufe20-\\ufe2f",Bt="\\u20d0-\\u20ff",tt=bt+zt+Bt,Ht="\\u2700-\\u27bf",_t="a-z\\xdf-\\xf6\\xf8-\\xff",qt="\\xac\\xb1\\xd7\\xf7",un="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rn="\\u2000-\\u206f",yo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ao="A-Z\\xc0-\\xd6\\xd8-\\xde",wo="\\ufe0e\\ufe0f",Io=qt+un+Rn+yo,po="['’]",On="["+ot+"]",fo="["+Io+"]",ir="["+tt+"]",Rr="\\d+",br="["+Ht+"]",_r="["+_t+"]",jo="[^"+ot+Io+Rr+Ht+_t+Ao+"]",wn="\\ud83c[\\udffb-\\udfff]",In="(?:"+ir+"|"+wn+")",ar="[^"+ot+"]",Wo="(?:\\ud83c[\\udde6-\\uddff]){2}",to="[\\ud800-\\udbff][\\udc00-\\udfff]",Bn="["+Ao+"]",Ko="\\u200d",So="(?:"+_r+"|"+jo+")",Qo="(?:"+Bn+"|"+jo+")",Yo="(?:"+po+"(?:d|ll|m|re|s|t|ve))?",lr="(?:"+po+"(?:D|LL|M|RE|S|T|VE))?",fr=In+"?",ei="["+wo+"]?",hr="(?:"+Ko+"(?:"+[ar,Wo,to].join("|")+")"+ei+fr+")*",tr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bi="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fo=ei+fr+hr,Si="(?:"+[br,Wo,to].join("|")+")"+Fo,hl="(?:"+[ar+ir+"?",ir,Wo,to,On].join("|")+")",nr=RegExp(po,"g"),or=RegExp(ir,"g"),Ai=RegExp(wn+"(?="+wn+")|"+hl+Fo,"g"),Fa=RegExp([Bn+"?"+_r+"+"+Yo+"(?="+[fo,Bn,"$"].join("|")+")",Qo+"+"+lr+"(?="+[fo,Bn+So,"$"].join("|")+")",Bn+"?"+So+"+"+Yo,Bn+"+"+lr,bi,tr,Rr,Si].join("|"),"g"),wi=RegExp("["+Ko+ot+tt+wo+"]"),Fs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ks=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zs=-1,Yi={};Yi[Ie]=Yi[Me]=Yi[ze]=Yi[Ne]=Yi[Je]=Yi[Ue]=Yi[nt]=Yi[We]=Yi[Ee]=!0,Yi[$]=Yi[ie]=Yi[we]=Yi[se]=Yi[Pe]=Yi[Z]=Yi[te]=Yi[oe]=Yi[he]=Yi[pe]=Yi[le]=Yi[Se]=Yi[Re]=Yi[De]=Yi[fe]=!1;var ua={};ua[$]=ua[ie]=ua[we]=ua[Pe]=ua[se]=ua[Z]=ua[Ie]=ua[Me]=ua[ze]=ua[Ne]=ua[Je]=ua[he]=ua[pe]=ua[le]=ua[Se]=ua[Re]=ua[De]=ua[Ae]=ua[Ue]=ua[nt]=ua[We]=ua[Ee]=!0,ua[te]=ua[oe]=ua[fe]=!1;var Vl={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Jl={"&":"&","<":"<",">":">",'"':""","'":"'"},$u={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cc={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},mu=parseFloat,fn=parseInt,tn=typeof yc=="object"&&yc&&yc.Object===Object&&yc,Ot=typeof self=="object"&&self&&self.Object===Object&&self,mn=tn||Ot||Function("return this")(),Hn=e&&!e.nodeType&&e,qe=Hn&&!0&&t&&!t.nodeType&&t,Ct=qe&&qe.exports===Hn,Nt=Ct&&tn.process,Tt=function(){try{var vn=qe&&qe.require&&qe.require("util").types;return vn||Nt&&Nt.binding&&Nt.binding("util")}catch{}}(),Yt=Tt&&Tt.isArrayBuffer,Zt=Tt&&Tt.isDate,cn=Tt&&Tt.isMap,yn=Tt&&Tt.isRegExp,An=Tt&&Tt.isSet,Tn=Tt&&Tt.isTypedArray;function Ln(vn,ao,Nn){switch(Nn.length){case 0:return vn.call(ao);case 1:return vn.call(ao,Nn[0]);case 2:return vn.call(ao,Nn[0],Nn[1]);case 3:return vn.call(ao,Nn[0],Nn[1],Nn[2])}return vn.apply(ao,Nn)}function Yn(vn,ao,Nn,Sr){for(var ui=-1,Oi=vn==null?0:vn.length;++ui-1}function Qi(vn,ao,Nn){for(var Sr=-1,ui=vn==null?0:vn.length;++Sr-1;);return Nn}function Og(vn,ao){for(var Nn=vn.length;Nn--&&O0(ao,vn[Nn],0)>-1;);return Nn}function ol(vn,ao){for(var Nn=vn.length,Sr=0;Nn--;)vn[Nn]===ao&&++Sr;return Sr}var Ud=yu(Vl),wu=yu(Jl);function p5(vn){return"\\"+Cc[vn]}function wy(vn,ao){return vn==null?n:vn[ao]}function zh(vn){return wi.test(vn)}function P3(vn){return Fs.test(vn)}function vy(vn){for(var ao,Nn=[];!(ao=vn.next()).done;)Nn.push(ao.value);return Nn}function C3(vn){var ao=-1,Nn=Array(vn.size);return vn.forEach(function(Sr,ui){Nn[++ao]=[ui,Sr]}),Nn}function g5(vn,ao){return function(Nn){return vn(ao(Nn))}}function Dh(vn,ao){for(var Nn=-1,Sr=vn.length,ui=0,Oi=[];++Nn-1}function F3(X,ne){var He=this.__data__,et=Pp(He,X);return et<0?(++this.size,He.push([X,ne])):He[et][1]=ne,this}Fh.prototype.clear=TS,Fh.prototype.delete=jA,Fh.prototype.get=PS,Fh.prototype.has=CS,Fh.prototype.set=F3;function xu(X){var ne=-1,He=X==null?0:X.length;for(this.clear();++ne=ne?X:ne)),X}function ad(X,ne,He,et,Dt,Xt){var hn,xn=ne&d,zn=ne&f,xo=ne&p;if(He&&(hn=Dt?He(X,et,Dt,Xt):He(X)),hn!==n)return hn;if(!ws(X))return X;var To=ea(X);if(To){if(hn=Hte(X),!xn)return b0(X,hn)}else{var Do=$0(X),Tr=Do==oe||Do==de;if(sm(X))return n4(X,xn);if(Do==le||Do==$||Tr&&!Dt){if(hn=zn||Tr?{}:RU(X),!xn)return zn?U5(X,JA(hn,X)):r4(X,XA(hn,X))}else{if(!ua[Do])return Dt?X:{};hn=Mte(X,Do,xn)}}Xt||(Xt=new Hc);var Qr=Xt.get(X);if(Qr)return Qr;Xt.set(X,hn),KS(X)?X.forEach(function(zi){hn.add(ad(zi,ne,He,zi,X,Xt))}):xj(X)&&X.forEach(function(zi,Ya){hn.set(Ya,ad(zi,ne,He,Ya,X,Xt))});var Ii=xo?zn?Pa:Ba:zn?R0:C0,Ca=To?n:Ii(X);return Wn(Ca||X,function(zi,Ya){Ca&&(Ya=zi,zi=X[Ya]),id(hn,Ya,ad(zi,ne,He,Ya,X,Xt))}),hn}function KA(X){var ne=C0(X);return function(He){return L3(He,X,ne)}}function L3(X,ne,He){var et=He.length;if(X==null)return!et;for(X=Ti(X);et--;){var Dt=He[et],Xt=ne[Dt],hn=X[Dt];if(hn===n&&!(Dt in X)||!Xt(hn))return!1}return!0}function qA(X,ne,He){if(typeof X!="function")throw new _0(a);return v7(function(){X.apply(n,He)},ne)}function $g(X,ne,He,et){var Dt=-1,Xt=ii,hn=!0,xn=X.length,zn=[],xo=ne.length;if(!xn)return zn;He&&(ne=Or(ne,Au(He))),et?(Xt=Qi,hn=!1):ne.length>=r&&(Xt=ec,hn=!1,ne=new x1(ne));e:for(;++DtDt?0:Dt+He),et=et===n||et>Dt?Dt:Ji(et),et<0&&(et+=Dt),et=He>et?0:$S(et);He0&&He(xn)?ne>1?Mc(xn,ne-1,He,et,Dt):ya(Dt,xn):et||(Dt[Dt.length]=xn)}return Dt}var z5=i4(),Od=i4(!0);function bu(X,ne){return X&&z5(X,ne,C0)}function D5(X,ne){return X&&Od(X,ne,C0)}function Vd(X,ne){return qo(ne,function(He){return cm(X[He])})}function Ff(X,ne){ne=C1(ne,X);for(var He=0,et=ne.length;X!=null&&Hene}function Qg(X,ne){return X!=null&&ja.call(X,ne)}function QA(X,ne){return X!=null&&ne in Ti(X)}function Hy(X,ne,He){return X>=G0(ne,He)&&X=120&&To.length>=120)?new x1(hn&&To):n}To=X[0];var Do=-1,Tr=xn[0];e:for(;++Do-1;)xn!==X&&nd.call(xn,zn,1),nd.call(X,zn,1);return X}function v0(X,ne){for(var He=X?ne.length:0,et=He-1;He--;){var Dt=ne[He];if(He==et||Dt!==Xt){var Xt=Dt;jy(Dt)?nd.call(X,Dt,1):ky(X,Dt)}}return X}function kf(X,ne){return X+P5(z3()*(ne-X+1))}function cd(X,ne,He,et){for(var Dt=-1,Xt=Jc(T5((ne-X)/(He||1)),0),hn=Nn(Xt);Xt--;)hn[et?Xt:++Dt]=X,X+=He;return hn}function tm(X,ne){var He="";if(!X||ne<1||ne>L)return He;do ne%2&&(He+=X),ne=P5(ne/2),ne&&(X+=X);while(ne);return He}function $r(X,ne){return eI(QM(X,ne,Pu),X+"")}function m7(X){return qg(Yy(X))}function Y3(X,ne){var He=Yy(X);return zS(He,w0(ne,0,He.length))}function Ey(X,ne,He,et){if(!ws(X))return X;ne=C1(ne,X);for(var Dt=-1,Xt=ne.length,hn=Xt-1,xn=X;xn!=null&&++DtDt?0:Dt+ne),He=He>Dt?Dt:He,He<0&&(He+=Dt),Dt=ne>He?0:He-ne>>>0,ne>>>=0;for(var Xt=Nn(Dt);++et>>1,hn=X[Xt];hn!==null&&!T0(hn)&&(He?hn<=ne:hn=r){var xo=ne?null:S0(X);if(xo)return R3(xo);hn=!1,Dt=ec,zn=new x1}else zn=ne?[]:xn;e:for(;++et=et?X:K0(X,ne,He)}var V3=S5||function(X){return mn.clearTimeout(X)};function n4(X,ne){if(ne)return X.slice();var He=X.length,et=Xg?Xg(He):new X.constructor(He);return X.copy(et),et}function rm(X){var ne=new X.constructor(X.byteLength);return new v5(ne).set(new v5(X)),ne}function o4(X,ne){var He=ne?rm(X.buffer):X.buffer;return new X.constructor(He,X.byteOffset,X.byteLength)}function Wf(X){var ne=new X.constructor(X.source,Ft.exec(X));return ne.lastIndex=X.lastIndex,ne}function Lh(X){return Eh?Ti(Eh.call(X)):{}}function im(X,ne){var He=ne?rm(X.buffer):X.buffer;return new X.constructor(He,X.byteOffset,X.length)}function Xd(X,ne){if(X!==ne){var He=X!==n,et=X===null,Dt=X===X,Xt=T0(X),hn=ne!==n,xn=ne===null,zn=ne===ne,xo=T0(ne);if(!xn&&!xo&&!Xt&&X>ne||Xt&&hn&&zn&&!xn&&!xo||et&&hn&&zn||!He&&zn||!Dt)return 1;if(!et&&!Xt&&!xo&&X=xn)return zn;var xo=He[et];return zn*(xo=="desc"?-1:1)}}return X.index-ne.index}function am(X,ne,He,et){for(var Dt=-1,Xt=X.length,hn=He.length,xn=-1,zn=ne.length,xo=Jc(Xt-hn,0),To=Nn(zn+xo),Do=!et;++xn1?He[Dt-1]:n,hn=Dt>2?He[2]:n;for(Xt=X.length>3&&typeof Xt=="function"?(Dt--,Xt):n,hn&&qd(He[0],He[1],hn)&&(Xt=Dt<3?n:Xt,Dt=1),ne=Ti(ne);++et-1?Dt[Xt?ne[hn]:hn]:n}}function Xe(X){return ra(function(ne){var He=ne.length,et=He,Dt=X0.prototype.thru;for(X&&ne.reverse();et--;){var Xt=ne[et];if(typeof Xt!="function")throw new _0(a);if(Dt&&!hn&&a4(Xt)=="wrapper")var hn=new X0([],!0)}for(et=hn?et:He;++et1&&al.reverse(),To&&znxn))return!1;var xo=Xt.get(X),To=Xt.get(ne);if(xo&&To)return xo==ne&&To==X;var Do=-1,Tr=!0,Qr=He&A?new x1:n;for(Xt.set(X,ne),Xt.set(ne,X);++Do1?"& ":"")+ne[et],ne=ne.join(He>2?", ":" "),X.replace(Gt,`{ + */fX.exports;(function(t,e){(function(){var n,o="4.17.21",r=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",l="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",d=1,f=2,p=4,g=1,A=2,y=1,S=2,C=4,P=8,v=16,T=32,w=64,x=128,b=256,R=512,H=30,F="...",E=800,N=16,U=1,W=2,k=3,D=1/0,L=9007199254740991,j=17976931348623157e292,B=NaN,O=4294967295,V=O-1,G=O>>>1,q=[["ary",x],["bind",y],["bindKey",S],["curry",P],["curryRight",v],["flip",R],["partial",T],["partialRight",w],["rearg",b]],$="[object Arguments]",ie="[object Array]",Q="[object AsyncFunction]",se="[object Boolean]",oe="[object Date]",Z="[object DOMException]",te="[object Error]",ee="[object Function]",de="[object GeneratorFunction]",fe="[object Map]",pe="[object Number]",ye="[object Null]",ae="[object Object]",Te="[object Promise]",ge="[object Proxy]",Se="[object RegExp]",Re="[object Set]",De="[object String]",Ae="[object Symbol]",ue="[object Undefined]",he="[object WeakMap]",ve="[object WeakSet]",we="[object ArrayBuffer]",Pe="[object DataView]",Ie="[object Float32Array]",Me="[object Float64Array]",ze="[object Int8Array]",Ne="[object Int16Array]",Je="[object Int32Array]",Ue="[object Uint8Array]",nt="[object Uint8ClampedArray]",We="[object Uint16Array]",Ee="[object Uint32Array]",ke=/\b__p \+= '';/g,Oe=/\b(__p \+=) '' \+/g,st=/(__e\(.*?\)|\b__t\)) \+\n'';/g,je=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,gt=RegExp(je.source),Ye=RegExp(xt.source),it=/<%-([\s\S]+?)%>/g,ut=/<%([\s\S]+?)%>/g,Qe=/<%=([\s\S]+?)%>/g,lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ze=/^\w*$/,Be=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$e=/[\\^$.*+?()[\]{}|]/g,wt=RegExp($e.source),vt=/^\s+/,Rt=/\s/,Gt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,At=/\{\n\/\* \[wrapped with (.+)\] \*/,pt=/,? & /,Wt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ht=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,It=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ft=/\w*$/,Ve=/^[-+]0x[0-9a-f]+$/i,ft=/^0b[01]+$/i,kt=/^\[object .+?Constructor\]$/,rt=/^0o[0-7]+$/i,at=/^(?:0|[1-9]\d*)$/,Ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,yt=/($^)/,Pt=/['\n\r\u2028\u2029\\]/g,ot="\\ud800-\\udfff",bt="\\u0300-\\u036f",zt="\\ufe20-\\ufe2f",Bt="\\u20d0-\\u20ff",tt=bt+zt+Bt,Ht="\\u2700-\\u27bf",_t="a-z\\xdf-\\xf6\\xf8-\\xff",qt="\\xac\\xb1\\xd7\\xf7",un="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rn="\\u2000-\\u206f",yo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ao="A-Z\\xc0-\\xd6\\xd8-\\xde",wo="\\ufe0e\\ufe0f",Io=qt+un+Rn+yo,po="['’]",On="["+ot+"]",fo="["+Io+"]",ir="["+tt+"]",Rr="\\d+",br="["+Ht+"]",_r="["+_t+"]",jo="[^"+ot+Io+Rr+Ht+_t+Ao+"]",wn="\\ud83c[\\udffb-\\udfff]",In="(?:"+ir+"|"+wn+")",ar="[^"+ot+"]",Wo="(?:\\ud83c[\\udde6-\\uddff]){2}",to="[\\ud800-\\udbff][\\udc00-\\udfff]",Bn="["+Ao+"]",Ko="\\u200d",So="(?:"+_r+"|"+jo+")",Qo="(?:"+Bn+"|"+jo+")",Yo="(?:"+po+"(?:d|ll|m|re|s|t|ve))?",lr="(?:"+po+"(?:D|LL|M|RE|S|T|VE))?",fr=In+"?",ei="["+wo+"]?",hr="(?:"+Ko+"(?:"+[ar,Wo,to].join("|")+")"+ei+fr+")*",tr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bi="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fo=ei+fr+hr,Si="(?:"+[br,Wo,to].join("|")+")"+Fo,hl="(?:"+[ar+ir+"?",ir,Wo,to,On].join("|")+")",nr=RegExp(po,"g"),or=RegExp(ir,"g"),Ai=RegExp(wn+"(?="+wn+")|"+hl+Fo,"g"),Fa=RegExp([Bn+"?"+_r+"+"+Yo+"(?="+[fo,Bn,"$"].join("|")+")",Qo+"+"+lr+"(?="+[fo,Bn+So,"$"].join("|")+")",Bn+"?"+So+"+"+Yo,Bn+"+"+lr,bi,tr,Rr,Si].join("|"),"g"),wi=RegExp("["+Ko+ot+tt+wo+"]"),Fs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ks=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zs=-1,Yi={};Yi[Ie]=Yi[Me]=Yi[ze]=Yi[Ne]=Yi[Je]=Yi[Ue]=Yi[nt]=Yi[We]=Yi[Ee]=!0,Yi[$]=Yi[ie]=Yi[we]=Yi[se]=Yi[Pe]=Yi[oe]=Yi[te]=Yi[ee]=Yi[fe]=Yi[pe]=Yi[ae]=Yi[Se]=Yi[Re]=Yi[De]=Yi[he]=!1;var ua={};ua[$]=ua[ie]=ua[we]=ua[Pe]=ua[se]=ua[oe]=ua[Ie]=ua[Me]=ua[ze]=ua[Ne]=ua[Je]=ua[fe]=ua[pe]=ua[ae]=ua[Se]=ua[Re]=ua[De]=ua[Ae]=ua[Ue]=ua[nt]=ua[We]=ua[Ee]=!0,ua[te]=ua[ee]=ua[he]=!1;var Vl={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Jl={"&":"&","<":"<",">":">",'"':""","'":"'"},$u={"&":"&","<":"<",">":">",""":'"',"'":"'"},Cc={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},mu=parseFloat,fn=parseInt,tn=typeof yc=="object"&&yc&&yc.Object===Object&&yc,Ot=typeof self=="object"&&self&&self.Object===Object&&self,mn=tn||Ot||Function("return this")(),Hn=e&&!e.nodeType&&e,qe=Hn&&!0&&t&&!t.nodeType&&t,Ct=qe&&qe.exports===Hn,Nt=Ct&&tn.process,Tt=function(){try{var vn=qe&&qe.require&&qe.require("util").types;return vn||Nt&&Nt.binding&&Nt.binding("util")}catch{}}(),Yt=Tt&&Tt.isArrayBuffer,Zt=Tt&&Tt.isDate,cn=Tt&&Tt.isMap,yn=Tt&&Tt.isRegExp,An=Tt&&Tt.isSet,Tn=Tt&&Tt.isTypedArray;function Ln(vn,ao,Nn){switch(Nn.length){case 0:return vn.call(ao);case 1:return vn.call(ao,Nn[0]);case 2:return vn.call(ao,Nn[0],Nn[1]);case 3:return vn.call(ao,Nn[0],Nn[1],Nn[2])}return vn.apply(ao,Nn)}function Yn(vn,ao,Nn,Sr){for(var ui=-1,Oi=vn==null?0:vn.length;++ui-1}function Qi(vn,ao,Nn){for(var Sr=-1,ui=vn==null?0:vn.length;++Sr-1;);return Nn}function Og(vn,ao){for(var Nn=vn.length;Nn--&&O0(ao,vn[Nn],0)>-1;);return Nn}function ol(vn,ao){for(var Nn=vn.length,Sr=0;Nn--;)vn[Nn]===ao&&++Sr;return Sr}var Ud=yu(Vl),wu=yu(Jl);function p5(vn){return"\\"+Cc[vn]}function wy(vn,ao){return vn==null?n:vn[ao]}function zh(vn){return wi.test(vn)}function P3(vn){return Fs.test(vn)}function vy(vn){for(var ao,Nn=[];!(ao=vn.next()).done;)Nn.push(ao.value);return Nn}function C3(vn){var ao=-1,Nn=Array(vn.size);return vn.forEach(function(Sr,ui){Nn[++ao]=[ui,Sr]}),Nn}function g5(vn,ao){return function(Nn){return vn(ao(Nn))}}function Dh(vn,ao){for(var Nn=-1,Sr=vn.length,ui=0,Oi=[];++Nn-1}function F3(X,ne){var He=this.__data__,et=Pp(He,X);return et<0?(++this.size,He.push([X,ne])):He[et][1]=ne,this}Fh.prototype.clear=TS,Fh.prototype.delete=jA,Fh.prototype.get=PS,Fh.prototype.has=CS,Fh.prototype.set=F3;function xu(X){var ne=-1,He=X==null?0:X.length;for(this.clear();++ne=ne?X:ne)),X}function ad(X,ne,He,et,Dt,Xt){var hn,xn=ne&d,zn=ne&f,xo=ne&p;if(He&&(hn=Dt?He(X,et,Dt,Xt):He(X)),hn!==n)return hn;if(!ws(X))return X;var To=ea(X);if(To){if(hn=Hte(X),!xn)return b0(X,hn)}else{var Do=$0(X),Tr=Do==ee||Do==de;if(sm(X))return n4(X,xn);if(Do==ae||Do==$||Tr&&!Dt){if(hn=zn||Tr?{}:RU(X),!xn)return zn?U5(X,JA(hn,X)):r4(X,XA(hn,X))}else{if(!ua[Do])return Dt?X:{};hn=Mte(X,Do,xn)}}Xt||(Xt=new Hc);var Qr=Xt.get(X);if(Qr)return Qr;Xt.set(X,hn),KS(X)?X.forEach(function(zi){hn.add(ad(zi,ne,He,zi,X,Xt))}):xj(X)&&X.forEach(function(zi,Ya){hn.set(Ya,ad(zi,ne,He,Ya,X,Xt))});var Ii=xo?zn?Pa:Ba:zn?R0:C0,Ca=To?n:Ii(X);return Wn(Ca||X,function(zi,Ya){Ca&&(Ya=zi,zi=X[Ya]),id(hn,Ya,ad(zi,ne,He,Ya,X,Xt))}),hn}function KA(X){var ne=C0(X);return function(He){return L3(He,X,ne)}}function L3(X,ne,He){var et=He.length;if(X==null)return!et;for(X=Ti(X);et--;){var Dt=He[et],Xt=ne[Dt],hn=X[Dt];if(hn===n&&!(Dt in X)||!Xt(hn))return!1}return!0}function qA(X,ne,He){if(typeof X!="function")throw new _0(a);return v7(function(){X.apply(n,He)},ne)}function $g(X,ne,He,et){var Dt=-1,Xt=ii,hn=!0,xn=X.length,zn=[],xo=ne.length;if(!xn)return zn;He&&(ne=Or(ne,Au(He))),et?(Xt=Qi,hn=!1):ne.length>=r&&(Xt=ec,hn=!1,ne=new x1(ne));e:for(;++DtDt?0:Dt+He),et=et===n||et>Dt?Dt:Ji(et),et<0&&(et+=Dt),et=He>et?0:$S(et);He0&&He(xn)?ne>1?Mc(xn,ne-1,He,et,Dt):ya(Dt,xn):et||(Dt[Dt.length]=xn)}return Dt}var z5=i4(),Od=i4(!0);function bu(X,ne){return X&&z5(X,ne,C0)}function D5(X,ne){return X&&Od(X,ne,C0)}function Vd(X,ne){return qo(ne,function(He){return cm(X[He])})}function kf(X,ne){ne=C1(ne,X);for(var He=0,et=ne.length;X!=null&&Hene}function Qg(X,ne){return X!=null&&ja.call(X,ne)}function QA(X,ne){return X!=null&&ne in Ti(X)}function Hy(X,ne,He){return X>=G0(ne,He)&&X=120&&To.length>=120)?new x1(hn&&To):n}To=X[0];var Do=-1,Tr=xn[0];e:for(;++Do-1;)xn!==X&&nd.call(xn,zn,1),nd.call(X,zn,1);return X}function v0(X,ne){for(var He=X?ne.length:0,et=He-1;He--;){var Dt=ne[He];if(He==et||Dt!==Xt){var Xt=Dt;jy(Dt)?nd.call(X,Dt,1):ky(X,Dt)}}return X}function Lf(X,ne){return X+P5(z3()*(ne-X+1))}function cd(X,ne,He,et){for(var Dt=-1,Xt=Jc(T5((ne-X)/(He||1)),0),hn=Nn(Xt);Xt--;)hn[et?Xt:++Dt]=X,X+=He;return hn}function tm(X,ne){var He="";if(!X||ne<1||ne>L)return He;do ne%2&&(He+=X),ne=P5(ne/2),ne&&(X+=X);while(ne);return He}function $r(X,ne){return eI(QM(X,ne,Pu),X+"")}function m7(X){return qg(Yy(X))}function Y3(X,ne){var He=Yy(X);return zS(He,w0(ne,0,He.length))}function Ey(X,ne,He,et){if(!ws(X))return X;ne=C1(ne,X);for(var Dt=-1,Xt=ne.length,hn=Xt-1,xn=X;xn!=null&&++DtDt?0:Dt+ne),He=He>Dt?Dt:He,He<0&&(He+=Dt),Dt=ne>He?0:He-ne>>>0,ne>>>=0;for(var Xt=Nn(Dt);++et>>1,hn=X[Xt];hn!==null&&!T0(hn)&&(He?hn<=ne:hn=r){var xo=ne?null:S0(X);if(xo)return R3(xo);hn=!1,Dt=ec,zn=new x1}else zn=ne?[]:xn;e:for(;++et=et?X:K0(X,ne,He)}var V3=S5||function(X){return mn.clearTimeout(X)};function n4(X,ne){if(ne)return X.slice();var He=X.length,et=Xg?Xg(He):new X.constructor(He);return X.copy(et),et}function rm(X){var ne=new X.constructor(X.byteLength);return new v5(ne).set(new v5(X)),ne}function o4(X,ne){var He=ne?rm(X.buffer):X.buffer;return new X.constructor(He,X.byteOffset,X.byteLength)}function Nf(X){var ne=new X.constructor(X.source,Ft.exec(X));return ne.lastIndex=X.lastIndex,ne}function Lh(X){return Eh?Ti(Eh.call(X)):{}}function im(X,ne){var He=ne?rm(X.buffer):X.buffer;return new X.constructor(He,X.byteOffset,X.length)}function Xd(X,ne){if(X!==ne){var He=X!==n,et=X===null,Dt=X===X,Xt=T0(X),hn=ne!==n,xn=ne===null,zn=ne===ne,xo=T0(ne);if(!xn&&!xo&&!Xt&&X>ne||Xt&&hn&&zn&&!xn&&!xo||et&&hn&&zn||!He&&zn||!Dt)return 1;if(!et&&!Xt&&!xo&&X=xn)return zn;var xo=He[et];return zn*(xo=="desc"?-1:1)}}return X.index-ne.index}function am(X,ne,He,et){for(var Dt=-1,Xt=X.length,hn=He.length,xn=-1,zn=ne.length,xo=Jc(Xt-hn,0),To=Nn(zn+xo),Do=!et;++xn1?He[Dt-1]:n,hn=Dt>2?He[2]:n;for(Xt=X.length>3&&typeof Xt=="function"?(Dt--,Xt):n,hn&&qd(He[0],He[1],hn)&&(Xt=Dt<3?n:Xt,Dt=1),ne=Ti(ne);++et-1?Dt[Xt?ne[hn]:hn]:n}}function Xe(X){return ra(function(ne){var He=ne.length,et=He,Dt=X0.prototype.thru;for(X&&ne.reverse();et--;){var Xt=ne[et];if(typeof Xt!="function")throw new _0(a);if(Dt&&!hn&&a4(Xt)=="wrapper")var hn=new X0([],!0)}for(et=hn?et:He;++et1&&al.reverse(),To&&znxn))return!1;var xo=Xt.get(X),To=Xt.get(ne);if(xo&&To)return xo==ne&&To==X;var Do=-1,Tr=!0,Qr=He&A?new x1:n;for(Xt.set(X,ne),Xt.set(ne,X);++Do1?"& ":"")+ne[et],ne=ne.join(He>2?", ":" "),X.replace(Gt,`{ /* [wrapped with `+ne+`] */ -`)}function zte(X){return ea(X)||B5(X)||!!(b5&&X&&X[b5])}function jy(X,ne){var He=typeof X;return ne=ne??L,!!ne&&(He=="number"||He!="symbol"&&at.test(X))&&X>-1&&X%1==0&&X0){if(++ne>=E)return arguments[0]}else ne=0;return X.apply(n,arguments)}}function zS(X,ne){var He=-1,et=X.length,Dt=et-1;for(ne=ne===n?et:ne;++He1?X[ne-1]:n;return He=typeof He=="function"?(X.pop(),He):n,ZU(X,He)});function K3(X){var ne=Ut(X);return ne.__chain__=!0,ne}function rne(X,ne){return ne(X),X}function By(X,ne){return ne(X)}var ine=ra(function(X){var ne=X.length,He=ne?X[0]:0,et=this.__wrapped__,Dt=function(Xt){return M5(Xt,X)};return ne>1||this.__actions__.length||!(et instanceof di)||!jy(He)?this.thru(Dt):(et=et.slice(He,+He+(ne?1:0)),et.__actions__.push({func:By,args:[Dt],thisArg:n}),new X0(et,this.__chain__).thru(function(Xt){return ne&&!Xt.length&&Xt.push(n),Xt}))});function fI(){return K3(this)}function ane(){return new X0(this.value(),this.__chain__)}function hI(){this.__values__===n&&(this.__values__=UI(this.value()));var X=this.__index__>=this.__values__.length,ne=X?n:this.__values__[this.__index__++];return{done:X,value:ne}}function lne(){return this}function sne(X){for(var ne,He=this;He instanceof E3;){var et=nI(He);et.__index__=0,et.__values__=n,ne?Dt.__wrapped__=et:ne=et;var Dt=et;He=He.__wrapped__}return Dt.__wrapped__=X,ne}function cne(){var X=this.__wrapped__;if(X instanceof di){var ne=X;return this.__actions__.length&&(ne=new di(this)),ne=ne.reverse(),ne.__actions__.push({func:By,args:[x7],thisArg:n}),new X0(ne,this.__chain__)}return this.thru(x7)}function NS(){return nm(this.__wrapped__,this.__actions__)}var US=j5(function(X,ne,He){ja.call(X,He)?++X[He]:kh(X,He,1)});function tj(X,ne,He){var et=ea(X)?qn:$A;return He&&qd(X,ne,He)&&(ne=n),et(X,gi(ne,3))}function une(X,ne){var He=ea(X)?qo:b1;return He(X,gi(ne,3))}var nj=Fe(ES),pI=Fe(FS);function oj(X,ne){return Mc(BS(X,ne),1)}function gI(X,ne){return Mc(BS(X,ne),D)}function mI(X,ne,He){return He=He===n?1:Ji(He),Mc(BS(X,ne),He)}function yI(X,ne){var He=ea(X)?Wn:ld;return He(X,gi(ne,3))}function AI(X,ne){var He=ea(X)?oo:I5;return He(X,gi(ne,3))}var dne=j5(function(X,ne,He){ja.call(X,He)?X[He].push(ne):kh(X,He,[ne])});function rj(X,ne,He,et){X=ud(X)?X:Yy(X),He=He&&!et?Ji(He):0;var Dt=X.length;return He<0&&(He=Jc(Dt+He,0)),qS(X)?He<=Dt&&X.indexOf(ne,He)>-1:!!Dt&&O0(X,ne,He)>-1}var jS=$r(function(X,ne,He){var et=-1,Dt=typeof ne=="function",Xt=ud(X)?Nn(X.length):[];return ld(X,function(hn){Xt[++et]=Dt?Ln(ne,hn,He):$l(hn,ne,He)}),Xt}),fne=j5(function(X,ne,He){kh(X,He,ne)});function BS(X,ne){var He=ea(X)?Or:S1;return He(X,gi(ne,3))}function hne(X,ne,He,et){return X==null?[]:(ea(ne)||(ne=ne==null?[]:[ne]),He=et?n:He,ea(He)||(He=He==null?[]:[He]),k5(X,ne,He))}var ij=j5(function(X,ne,He){X[He?0:1].push(ne)},function(){return[[],[]]});function aj(X,ne,He){var et=ea(X)?Hs:g1,Dt=arguments.length<3;return et(X,gi(ne,4),He,Dt,ld)}function wI(X,ne,He){var et=ea(X)?Qu:g1,Dt=arguments.length<3;return et(X,gi(ne,4),He,Dt,I5)}function pne(X,ne){var He=ea(X)?qo:b1;return He(X,d4(gi(ne,3)))}function gne(X){var ne=ea(X)?qg:m7;return ne(X)}function vI(X,ne,He){(He?qd(X,ne,He):ne===n)?ne=1:ne=Ji(ne);var et=ea(X)?H5:Y3;return et(X,ne)}function mne(X){var ne=ea(X)?g7:e4;return ne(X)}function xI(X){if(X==null)return 0;if(ud(X))return qS(X)?Gc(X):X.length;var ne=$0(X);return ne==he||ne==Re?X.size:Ql(X).length}function yne(X,ne,He){var et=ea(X)?Zu:O3;return He&&qd(X,ne,He)&&(ne=n),et(X,gi(ne,3))}var YS=$r(function(X,ne){if(X==null)return[];var He=ne.length;return He>1&&qd(X,ne[0],ne[1])?ne=[]:He>2&&qd(ne[0],ne[1],ne[2])&&(ne=[ne[0]]),k5(X,Mc(ne,1),[])}),C7=Ty||function(){return mn.Date.now()};function lj(X,ne){if(typeof ne!="function")throw new _0(a);return X=Ji(X),function(){if(--X<1)return ne.apply(this,arguments)}}function bI(X,ne,He){return ne=He?n:ne,ne=X&&ne==null?X.length:ne,Fn(X,x,n,n,n,n,ne)}function R7(X,ne){var He;if(typeof ne!="function")throw new _0(a);return X=Ji(X),function(){return--X>0&&(He=ne.apply(this,arguments)),X<=1&&(ne=n),He}}var H7=$r(function(X,ne,He){var et=y;if(He.length){var Dt=Dh(He,l4(H7));et|=T}return Fn(X,et,ne,He,Dt)}),sj=$r(function(X,ne,He){var et=y|S;if(He.length){var Dt=Dh(He,l4(sj));et|=T}return Fn(ne,et,X,He,Dt)});function cj(X,ne,He){ne=He?n:ne;var et=Fn(X,P,n,n,n,n,n,ne);return et.placeholder=cj.placeholder,et}function SI(X,ne,He){ne=He?n:ne;var et=Fn(X,v,n,n,n,n,n,ne);return et.placeholder=SI.placeholder,et}function OS(X,ne,He){var et,Dt,Xt,hn,xn,zn,xo=0,To=!1,Do=!1,Tr=!0;if(typeof X!="function")throw new _0(a);ne=qc(ne)||0,ws(He)&&(To=!!He.leading,Do="maxWait"in He,Xt=Do?Jc(qc(He.maxWait)||0,ne):Xt,Tr="trailing"in He?!!He.trailing:Tr);function Qr(H0){var Vy=et,Q3=Dt;return et=Dt=n,xo=H0,hn=X.apply(Q3,Vy),hn}function Ii(H0){return xo=H0,xn=v7(Ya,ne),To?Qr(H0):hn}function Ca(H0){var Vy=H0-zn,Q3=H0-xo,k6e=ne-Vy;return Do?G0(k6e,Xt-Q3):k6e}function zi(H0){var Vy=H0-zn,Q3=H0-xo;return zn===n||Vy>=ne||Vy<0||Do&&Q3>=Xt}function Ya(){var H0=C7();if(zi(H0))return al(H0);xn=v7(Ya,Ca(H0))}function al(H0){return xn=n,Tr&&et?Qr(H0):(et=Dt=n,hn)}function I1(){xn!==n&&V3(xn),xo=0,et=zn=Dt=xn=n}function Uh(){return xn===n?hn:al(C7())}function z1(){var H0=C7(),Vy=zi(H0);if(et=arguments,Dt=this,zn=H0,Vy){if(xn===n)return Ii(zn);if(Do)return V3(xn),xn=v7(Ya,ne),Qr(zn)}return xn===n&&(xn=v7(Ya,ne)),hn}return z1.cancel=I1,z1.flush=Uh,z1}var uj=$r(function(X,ne){return qA(X,1,ne)}),dj=$r(function(X,ne,He){return qA(X,qc(ne)||0,He)});function TI(X){return Fn(X,R)}function M7(X,ne){if(typeof X!="function"||ne!=null&&typeof ne!="function")throw new _0(a);var He=function(){var et=arguments,Dt=ne?ne.apply(this,et):et[0],Xt=He.cache;if(Xt.has(Dt))return Xt.get(Dt);var hn=X.apply(this,et);return He.cache=Xt.set(Dt,hn)||Xt,hn};return He.cache=new(M7.Cache||xu),He}M7.Cache=xu;function d4(X){if(typeof X!="function")throw new _0(a);return function(){var ne=arguments;switch(ne.length){case 0:return!X.call(this);case 1:return!X.call(this,ne[0]);case 2:return!X.call(this,ne[0],ne[1]);case 3:return!X.call(this,ne[0],ne[1],ne[2])}return!X.apply(this,ne)}}function VS(X){return R7(2,X)}var fj=A7(function(X,ne){ne=ne.length==1&&ea(ne[0])?Or(ne[0],Au(gi())):Or(Mc(ne,1),Au(gi()));var He=ne.length;return $r(function(et){for(var Dt=-1,Xt=G0(et.length,He);++Dt=ne}),B5=Hi(function(){return arguments}())?Hi:function(X){return Dc(X)&&ja.call(X,"callee")&&!x5.call(X,"callee")},ea=Nn.isArray,bne=Yt?Au(Yt):Ic;function ud(X){return X!=null&&GS(X.length)&&!cm(X)}function zc(X){return Dc(X)&&ud(X)}function h4(X){return X===!0||X===!1||Dc(X)&&Ms(X)==se}var sm=EA||bl,Sne=Zt?Au(Zt):rl;function _S(X){return Dc(X)&&X.nodeType===1&&!D7(X)}function MI(X){if(X==null)return!0;if(ud(X)&&(ea(X)||typeof X=="string"||typeof X.splice=="function"||sm(X)||um(X)||B5(X)))return!X.length;var ne=$0(X);if(ne==he||ne==Re)return!X.size;if(w7(X))return!Ql(X).length;for(var He in X)if(ja.call(X,He))return!1;return!0}function Tne(X,ne){return js(X,ne)}function II(X,ne,He){He=typeof He=="function"?He:n;var et=He?He(X,ne):n;return et===n?js(X,ne,n,He):!!et}function I7(X){if(!Dc(X))return!1;var ne=Ms(X);return ne==te||ne==ee||typeof X.message=="string"&&typeof X.name=="string"&&!D7(X)}function wj(X){return typeof X=="number"&&a7(X)}function cm(X){if(!ws(X))return!1;var ne=Ms(X);return ne==oe||ne==de||ne==Q||ne==ge}function vj(X){return typeof X=="number"&&X==Ji(X)}function GS(X){return typeof X=="number"&&X>-1&&X%1==0&&X<=L}function ws(X){var ne=typeof X;return X!=null&&(ne=="object"||ne=="function")}function Dc(X){return X!=null&&typeof X=="object"}var xj=cn?Au(cn):_d;function Nh(X,ne){return X===ne||nc(X,ne,GM(ne))}function zI(X,ne,He){return He=typeof He=="function"?He:n,nc(X,ne,GM(ne),He)}function DI(X){return XS(X)&&X!=+X}function EI(X){if(Fte(X))throw new ui(i);return Rp(X)}function z7(X){return X===null}function FI(X){return X==null}function XS(X){return typeof X=="number"||Dc(X)&&Ms(X)==pe}function D7(X){if(!Dc(X)||Ms(X)!=le)return!1;var ne=tc(X);if(ne===null)return!0;var He=ja.call(ne,"constructor")&&ne.constructor;return typeof He=="function"&&He instanceof He&&y5.call(He)==Gg}var JS=yn?Au(yn):sd;function kI(X){return vj(X)&&X>=-L&&X<=L}var KS=An?Au(An):W3;function qS(X){return typeof X=="string"||!ea(X)&&Dc(X)&&Ms(X)==De}function T0(X){return typeof X=="symbol"||Dc(X)&&Ms(X)==Ae}var um=Tn?Au(Tn):N3;function bj(X){return X===n}function Sj(X){return Dc(X)&&$0(X)==fe}function LI(X){return Dc(X)&&Ms(X)==ve}var WI=Xr(U3),NI=Xr(function(X,ne){return X<=ne});function UI(X){if(!X)return[];if(ud(X))return qS(X)?ys(X):b0(X);if(Bd&&X[Bd])return vy(X[Bd]());var ne=$0(X),He=ne==he?C3:ne==Re?R3:Yy;return He(X)}function dd(X){if(!X)return X===0?X:0;if(X=qc(X),X===D||X===-D){var ne=X<0?-1:1;return ne*j}return X===X?X:0}function Ji(X){var ne=dd(X),He=ne%1;return ne===ne?He?ne-He:ne:0}function $S(X){return X?w0(Ji(X),0,O):0}function qc(X){if(typeof X=="number")return X;if(T0(X))return B;if(ws(X)){var ne=typeof X.valueOf=="function"?X.valueOf():X;X=ws(ne)?ne+"":ne}if(typeof X!="string")return X===0?X:+X;X=T3(X);var He=ft.test(X);return He||rt.test(X)?fn(X.slice(2),He?2:8):Ve.test(X)?B:+X}function Tj(X){return Jd(X,R0(X))}function Pne(X){return X?w0(Ji(X),-L,L):X===0?X:0}function il(X){return X==null?"":x0(X)}var E7=Hp(function(X,ne){if(w7(ne)||ud(ne)){Jd(ne,C0(ne),X);return}for(var He in ne)ja.call(ne,He)&&id(X,He,ne[He])}),jI=Hp(function(X,ne){Jd(ne,R0(ne),X)}),F7=Hp(function(X,ne,He,et){Jd(ne,R0(ne),X,et)}),Pj=Hp(function(X,ne,He,et){Jd(ne,C0(ne),X,et)}),Cj=ra(M5);function P0(X,ne){var He=v1(X);return ne==null?He:XA(He,ne)}var Cne=$r(function(X,ne){X=Ti(X);var He=-1,et=ne.length,Dt=et>2?ne[2]:n;for(Dt&&qd(ne[0],ne[1],Dt)&&(et=1);++He1),Xt}),Jd(X,Pa(X),He),et&&(He=ad(He,d|f|p,xr));for(var Dt=ne.length;Dt--;)ky(He,ne[Dt]);return He});function Ene(X,ne){return Ej(X,d4(gi(ne)))}var XI=ra(function(X,ne){return X==null?{}:zy(X,ne)});function Ej(X,ne){if(X==null)return{};var He=Or(Pa(X),function(et){return[et]});return ne=gi(ne),Dy(X,He,function(et,Dt){return ne(et,Dt[0])})}function Fj(X,ne,He){ne=C1(ne,X);var et=-1,Dt=ne.length;for(Dt||(Dt=1,X=n);++etne){var et=X;X=ne,ne=et}if(He||X%1||ne%1){var Dt=z3();return G0(X+Dt*(ne-X+mu("1e-"+((Dt+"").length-1))),ne)}return kf(X,ne)}var g4=J(function(X,ne,He){return ne=ne.toLowerCase(),X+(He?QS(ne):ne)});function QS(X){return Y5(il(X).toLowerCase())}function ZS(X){return X=il(X),X&&X.replace(Ge,Ud).replace(or,"")}function Wj(X,ne,He){X=il(X),ne=x0(ne);var et=X.length;He=He===n?et:w0(Ji(He),0,et);var Dt=He;return He-=ne.length,He>=0&&X.slice(He,Dt)==ne}function eT(X){return X=il(X),X&&Ye.test(X)?X.replace(xt,wu):X}function JI(X){return X=il(X),X&&wt.test(X)?X.replace($e,"\\$&"):X}var KI=J(function(X,ne,He){return X+(He?"-":"")+ne.toLowerCase()}),qI=J(function(X,ne,He){return X+(He?" ":"")+ne.toLowerCase()}),$I=G3("toLowerCase");function QI(X,ne,He){X=il(X),ne=Ji(ne);var et=ne?Gc(X):0;if(!ne||et>=ne)return X;var Dt=(ne-et)/2;return Oo(P5(Dt),He)+X+Oo(T5(Dt),He)}function Wne(X,ne,He){X=il(X),ne=Ji(ne);var et=ne?Gc(X):0;return ne&&et>>0,He?(X=il(X),X&&(typeof ne=="string"||ne!=null&&!JS(ne))&&(ne=x0(ne),!ne&&zh(X))?R1(ys(X),0,He):X.split(ne,He)):[]}var Une=J(function(X,ne,He){return X+(He?" ":"")+Y5(ne)});function Bj(X,ne,He){return X=il(X),He=He==null?0:w0(Ji(He),0,X.length),ne=x0(ne),X.slice(He,He+ne.length)==ne}function jne(X,ne,He){var et=Ut.templateSettings;He&&qd(X,ne,He)&&(ne=n),X=il(X),ne=F7({},ne,et,Mn);var Dt=F7({},ne.imports,et.imports,Mn),Xt=C0(Dt),hn=Ls(Dt,Xt),xn,zn,xo=0,To=ne.interpolate||yt,Do="__p += '",Tr=Xc((ne.escape||yt).source+"|"+To.source+"|"+(To===Qe?It:yt).source+"|"+(ne.evaluate||yt).source+"|$","g"),Qr="//# sourceURL="+(ja.call(ne,"sourceURL")?(ne.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zs+"]")+` +`)}function zte(X){return ea(X)||B5(X)||!!(b5&&X&&X[b5])}function jy(X,ne){var He=typeof X;return ne=ne??L,!!ne&&(He=="number"||He!="symbol"&&at.test(X))&&X>-1&&X%1==0&&X0){if(++ne>=E)return arguments[0]}else ne=0;return X.apply(n,arguments)}}function zS(X,ne){var He=-1,et=X.length,Dt=et-1;for(ne=ne===n?et:ne;++He1?X[ne-1]:n;return He=typeof He=="function"?(X.pop(),He):n,ZU(X,He)});function K3(X){var ne=Ut(X);return ne.__chain__=!0,ne}function rne(X,ne){return ne(X),X}function By(X,ne){return ne(X)}var ine=ra(function(X){var ne=X.length,He=ne?X[0]:0,et=this.__wrapped__,Dt=function(Xt){return M5(Xt,X)};return ne>1||this.__actions__.length||!(et instanceof di)||!jy(He)?this.thru(Dt):(et=et.slice(He,+He+(ne?1:0)),et.__actions__.push({func:By,args:[Dt],thisArg:n}),new X0(et,this.__chain__).thru(function(Xt){return ne&&!Xt.length&&Xt.push(n),Xt}))});function fI(){return K3(this)}function ane(){return new X0(this.value(),this.__chain__)}function hI(){this.__values__===n&&(this.__values__=UI(this.value()));var X=this.__index__>=this.__values__.length,ne=X?n:this.__values__[this.__index__++];return{done:X,value:ne}}function lne(){return this}function sne(X){for(var ne,He=this;He instanceof E3;){var et=nI(He);et.__index__=0,et.__values__=n,ne?Dt.__wrapped__=et:ne=et;var Dt=et;He=He.__wrapped__}return Dt.__wrapped__=X,ne}function cne(){var X=this.__wrapped__;if(X instanceof di){var ne=X;return this.__actions__.length&&(ne=new di(this)),ne=ne.reverse(),ne.__actions__.push({func:By,args:[x7],thisArg:n}),new X0(ne,this.__chain__)}return this.thru(x7)}function NS(){return nm(this.__wrapped__,this.__actions__)}var US=j5(function(X,ne,He){ja.call(X,He)?++X[He]:kh(X,He,1)});function tj(X,ne,He){var et=ea(X)?qn:$A;return He&&qd(X,ne,He)&&(ne=n),et(X,gi(ne,3))}function une(X,ne){var He=ea(X)?qo:b1;return He(X,gi(ne,3))}var nj=Fe(ES),pI=Fe(FS);function oj(X,ne){return Mc(BS(X,ne),1)}function gI(X,ne){return Mc(BS(X,ne),D)}function mI(X,ne,He){return He=He===n?1:Ji(He),Mc(BS(X,ne),He)}function yI(X,ne){var He=ea(X)?Wn:ld;return He(X,gi(ne,3))}function AI(X,ne){var He=ea(X)?oo:I5;return He(X,gi(ne,3))}var dne=j5(function(X,ne,He){ja.call(X,He)?X[He].push(ne):kh(X,He,[ne])});function rj(X,ne,He,et){X=ud(X)?X:Yy(X),He=He&&!et?Ji(He):0;var Dt=X.length;return He<0&&(He=Jc(Dt+He,0)),qS(X)?He<=Dt&&X.indexOf(ne,He)>-1:!!Dt&&O0(X,ne,He)>-1}var jS=$r(function(X,ne,He){var et=-1,Dt=typeof ne=="function",Xt=ud(X)?Nn(X.length):[];return ld(X,function(hn){Xt[++et]=Dt?Ln(ne,hn,He):$l(hn,ne,He)}),Xt}),fne=j5(function(X,ne,He){kh(X,He,ne)});function BS(X,ne){var He=ea(X)?Or:S1;return He(X,gi(ne,3))}function hne(X,ne,He,et){return X==null?[]:(ea(ne)||(ne=ne==null?[]:[ne]),He=et?n:He,ea(He)||(He=He==null?[]:[He]),k5(X,ne,He))}var ij=j5(function(X,ne,He){X[He?0:1].push(ne)},function(){return[[],[]]});function aj(X,ne,He){var et=ea(X)?Hs:g1,Dt=arguments.length<3;return et(X,gi(ne,4),He,Dt,ld)}function wI(X,ne,He){var et=ea(X)?Qu:g1,Dt=arguments.length<3;return et(X,gi(ne,4),He,Dt,I5)}function pne(X,ne){var He=ea(X)?qo:b1;return He(X,d4(gi(ne,3)))}function gne(X){var ne=ea(X)?qg:m7;return ne(X)}function vI(X,ne,He){(He?qd(X,ne,He):ne===n)?ne=1:ne=Ji(ne);var et=ea(X)?H5:Y3;return et(X,ne)}function mne(X){var ne=ea(X)?g7:e4;return ne(X)}function xI(X){if(X==null)return 0;if(ud(X))return qS(X)?Gc(X):X.length;var ne=$0(X);return ne==fe||ne==Re?X.size:Ql(X).length}function yne(X,ne,He){var et=ea(X)?Zu:O3;return He&&qd(X,ne,He)&&(ne=n),et(X,gi(ne,3))}var YS=$r(function(X,ne){if(X==null)return[];var He=ne.length;return He>1&&qd(X,ne[0],ne[1])?ne=[]:He>2&&qd(ne[0],ne[1],ne[2])&&(ne=[ne[0]]),k5(X,Mc(ne,1),[])}),C7=Ty||function(){return mn.Date.now()};function lj(X,ne){if(typeof ne!="function")throw new _0(a);return X=Ji(X),function(){if(--X<1)return ne.apply(this,arguments)}}function bI(X,ne,He){return ne=He?n:ne,ne=X&&ne==null?X.length:ne,Fn(X,x,n,n,n,n,ne)}function R7(X,ne){var He;if(typeof ne!="function")throw new _0(a);return X=Ji(X),function(){return--X>0&&(He=ne.apply(this,arguments)),X<=1&&(ne=n),He}}var H7=$r(function(X,ne,He){var et=y;if(He.length){var Dt=Dh(He,l4(H7));et|=T}return Fn(X,et,ne,He,Dt)}),sj=$r(function(X,ne,He){var et=y|S;if(He.length){var Dt=Dh(He,l4(sj));et|=T}return Fn(ne,et,X,He,Dt)});function cj(X,ne,He){ne=He?n:ne;var et=Fn(X,P,n,n,n,n,n,ne);return et.placeholder=cj.placeholder,et}function SI(X,ne,He){ne=He?n:ne;var et=Fn(X,v,n,n,n,n,n,ne);return et.placeholder=SI.placeholder,et}function OS(X,ne,He){var et,Dt,Xt,hn,xn,zn,xo=0,To=!1,Do=!1,Tr=!0;if(typeof X!="function")throw new _0(a);ne=qc(ne)||0,ws(He)&&(To=!!He.leading,Do="maxWait"in He,Xt=Do?Jc(qc(He.maxWait)||0,ne):Xt,Tr="trailing"in He?!!He.trailing:Tr);function Qr(H0){var Vy=et,Q3=Dt;return et=Dt=n,xo=H0,hn=X.apply(Q3,Vy),hn}function Ii(H0){return xo=H0,xn=v7(Ya,ne),To?Qr(H0):hn}function Ca(H0){var Vy=H0-zn,Q3=H0-xo,k6e=ne-Vy;return Do?G0(k6e,Xt-Q3):k6e}function zi(H0){var Vy=H0-zn,Q3=H0-xo;return zn===n||Vy>=ne||Vy<0||Do&&Q3>=Xt}function Ya(){var H0=C7();if(zi(H0))return al(H0);xn=v7(Ya,Ca(H0))}function al(H0){return xn=n,Tr&&et?Qr(H0):(et=Dt=n,hn)}function I1(){xn!==n&&V3(xn),xo=0,et=zn=Dt=xn=n}function Uh(){return xn===n?hn:al(C7())}function z1(){var H0=C7(),Vy=zi(H0);if(et=arguments,Dt=this,zn=H0,Vy){if(xn===n)return Ii(zn);if(Do)return V3(xn),xn=v7(Ya,ne),Qr(zn)}return xn===n&&(xn=v7(Ya,ne)),hn}return z1.cancel=I1,z1.flush=Uh,z1}var uj=$r(function(X,ne){return qA(X,1,ne)}),dj=$r(function(X,ne,He){return qA(X,qc(ne)||0,He)});function TI(X){return Fn(X,R)}function M7(X,ne){if(typeof X!="function"||ne!=null&&typeof ne!="function")throw new _0(a);var He=function(){var et=arguments,Dt=ne?ne.apply(this,et):et[0],Xt=He.cache;if(Xt.has(Dt))return Xt.get(Dt);var hn=X.apply(this,et);return He.cache=Xt.set(Dt,hn)||Xt,hn};return He.cache=new(M7.Cache||xu),He}M7.Cache=xu;function d4(X){if(typeof X!="function")throw new _0(a);return function(){var ne=arguments;switch(ne.length){case 0:return!X.call(this);case 1:return!X.call(this,ne[0]);case 2:return!X.call(this,ne[0],ne[1]);case 3:return!X.call(this,ne[0],ne[1],ne[2])}return!X.apply(this,ne)}}function VS(X){return R7(2,X)}var fj=A7(function(X,ne){ne=ne.length==1&&ea(ne[0])?Or(ne[0],Au(gi())):Or(Mc(ne,1),Au(gi()));var He=ne.length;return $r(function(et){for(var Dt=-1,Xt=G0(et.length,He);++Dt=ne}),B5=Hi(function(){return arguments}())?Hi:function(X){return Dc(X)&&ja.call(X,"callee")&&!x5.call(X,"callee")},ea=Nn.isArray,bne=Yt?Au(Yt):Ic;function ud(X){return X!=null&&GS(X.length)&&!cm(X)}function zc(X){return Dc(X)&&ud(X)}function h4(X){return X===!0||X===!1||Dc(X)&&Ms(X)==se}var sm=EA||bl,Sne=Zt?Au(Zt):rl;function _S(X){return Dc(X)&&X.nodeType===1&&!D7(X)}function MI(X){if(X==null)return!0;if(ud(X)&&(ea(X)||typeof X=="string"||typeof X.splice=="function"||sm(X)||um(X)||B5(X)))return!X.length;var ne=$0(X);if(ne==fe||ne==Re)return!X.size;if(w7(X))return!Ql(X).length;for(var He in X)if(ja.call(X,He))return!1;return!0}function Tne(X,ne){return js(X,ne)}function II(X,ne,He){He=typeof He=="function"?He:n;var et=He?He(X,ne):n;return et===n?js(X,ne,n,He):!!et}function I7(X){if(!Dc(X))return!1;var ne=Ms(X);return ne==te||ne==Z||typeof X.message=="string"&&typeof X.name=="string"&&!D7(X)}function wj(X){return typeof X=="number"&&a7(X)}function cm(X){if(!ws(X))return!1;var ne=Ms(X);return ne==ee||ne==de||ne==Q||ne==ge}function vj(X){return typeof X=="number"&&X==Ji(X)}function GS(X){return typeof X=="number"&&X>-1&&X%1==0&&X<=L}function ws(X){var ne=typeof X;return X!=null&&(ne=="object"||ne=="function")}function Dc(X){return X!=null&&typeof X=="object"}var xj=cn?Au(cn):_d;function Nh(X,ne){return X===ne||nc(X,ne,GM(ne))}function zI(X,ne,He){return He=typeof He=="function"?He:n,nc(X,ne,GM(ne),He)}function DI(X){return XS(X)&&X!=+X}function EI(X){if(Fte(X))throw new ui(i);return Rp(X)}function z7(X){return X===null}function FI(X){return X==null}function XS(X){return typeof X=="number"||Dc(X)&&Ms(X)==pe}function D7(X){if(!Dc(X)||Ms(X)!=ae)return!1;var ne=tc(X);if(ne===null)return!0;var He=ja.call(ne,"constructor")&&ne.constructor;return typeof He=="function"&&He instanceof He&&y5.call(He)==Gg}var JS=yn?Au(yn):sd;function kI(X){return vj(X)&&X>=-L&&X<=L}var KS=An?Au(An):W3;function qS(X){return typeof X=="string"||!ea(X)&&Dc(X)&&Ms(X)==De}function T0(X){return typeof X=="symbol"||Dc(X)&&Ms(X)==Ae}var um=Tn?Au(Tn):N3;function bj(X){return X===n}function Sj(X){return Dc(X)&&$0(X)==he}function LI(X){return Dc(X)&&Ms(X)==ve}var WI=Xr(U3),NI=Xr(function(X,ne){return X<=ne});function UI(X){if(!X)return[];if(ud(X))return qS(X)?ys(X):b0(X);if(Bd&&X[Bd])return vy(X[Bd]());var ne=$0(X),He=ne==fe?C3:ne==Re?R3:Yy;return He(X)}function dd(X){if(!X)return X===0?X:0;if(X=qc(X),X===D||X===-D){var ne=X<0?-1:1;return ne*j}return X===X?X:0}function Ji(X){var ne=dd(X),He=ne%1;return ne===ne?He?ne-He:ne:0}function $S(X){return X?w0(Ji(X),0,O):0}function qc(X){if(typeof X=="number")return X;if(T0(X))return B;if(ws(X)){var ne=typeof X.valueOf=="function"?X.valueOf():X;X=ws(ne)?ne+"":ne}if(typeof X!="string")return X===0?X:+X;X=T3(X);var He=ft.test(X);return He||rt.test(X)?fn(X.slice(2),He?2:8):Ve.test(X)?B:+X}function Tj(X){return Jd(X,R0(X))}function Pne(X){return X?w0(Ji(X),-L,L):X===0?X:0}function il(X){return X==null?"":x0(X)}var E7=Hp(function(X,ne){if(w7(ne)||ud(ne)){Jd(ne,C0(ne),X);return}for(var He in ne)ja.call(ne,He)&&id(X,He,ne[He])}),jI=Hp(function(X,ne){Jd(ne,R0(ne),X)}),F7=Hp(function(X,ne,He,et){Jd(ne,R0(ne),X,et)}),Pj=Hp(function(X,ne,He,et){Jd(ne,C0(ne),X,et)}),Cj=ra(M5);function P0(X,ne){var He=v1(X);return ne==null?He:XA(He,ne)}var Cne=$r(function(X,ne){X=Ti(X);var He=-1,et=ne.length,Dt=et>2?ne[2]:n;for(Dt&&qd(ne[0],ne[1],Dt)&&(et=1);++He1),Xt}),Jd(X,Pa(X),He),et&&(He=ad(He,d|f|p,xr));for(var Dt=ne.length;Dt--;)ky(He,ne[Dt]);return He});function Ene(X,ne){return Ej(X,d4(gi(ne)))}var XI=ra(function(X,ne){return X==null?{}:zy(X,ne)});function Ej(X,ne){if(X==null)return{};var He=Or(Pa(X),function(et){return[et]});return ne=gi(ne),Dy(X,He,function(et,Dt){return ne(et,Dt[0])})}function Fj(X,ne,He){ne=C1(ne,X);var et=-1,Dt=ne.length;for(Dt||(Dt=1,X=n);++etne){var et=X;X=ne,ne=et}if(He||X%1||ne%1){var Dt=z3();return G0(X+Dt*(ne-X+mu("1e-"+((Dt+"").length-1))),ne)}return Lf(X,ne)}var g4=J(function(X,ne,He){return ne=ne.toLowerCase(),X+(He?QS(ne):ne)});function QS(X){return Y5(il(X).toLowerCase())}function ZS(X){return X=il(X),X&&X.replace(Ge,Ud).replace(or,"")}function Wj(X,ne,He){X=il(X),ne=x0(ne);var et=X.length;He=He===n?et:w0(Ji(He),0,et);var Dt=He;return He-=ne.length,He>=0&&X.slice(He,Dt)==ne}function eT(X){return X=il(X),X&&Ye.test(X)?X.replace(xt,wu):X}function JI(X){return X=il(X),X&&wt.test(X)?X.replace($e,"\\$&"):X}var KI=J(function(X,ne,He){return X+(He?"-":"")+ne.toLowerCase()}),qI=J(function(X,ne,He){return X+(He?" ":"")+ne.toLowerCase()}),$I=G3("toLowerCase");function QI(X,ne,He){X=il(X),ne=Ji(ne);var et=ne?Gc(X):0;if(!ne||et>=ne)return X;var Dt=(ne-et)/2;return Oo(P5(Dt),He)+X+Oo(T5(Dt),He)}function Wne(X,ne,He){X=il(X),ne=Ji(ne);var et=ne?Gc(X):0;return ne&&et>>0,He?(X=il(X),X&&(typeof ne=="string"||ne!=null&&!JS(ne))&&(ne=x0(ne),!ne&&zh(X))?R1(ys(X),0,He):X.split(ne,He)):[]}var Une=J(function(X,ne,He){return X+(He?" ":"")+Y5(ne)});function Bj(X,ne,He){return X=il(X),He=He==null?0:w0(Ji(He),0,X.length),ne=x0(ne),X.slice(He,He+ne.length)==ne}function jne(X,ne,He){var et=Ut.templateSettings;He&&qd(X,ne,He)&&(ne=n),X=il(X),ne=F7({},ne,et,Mn);var Dt=F7({},ne.imports,et.imports,Mn),Xt=C0(Dt),hn=Ls(Dt,Xt),xn,zn,xo=0,To=ne.interpolate||yt,Do="__p += '",Tr=Xc((ne.escape||yt).source+"|"+To.source+"|"+(To===Qe?It:yt).source+"|"+(ne.evaluate||yt).source+"|$","g"),Qr="//# sourceURL="+(ja.call(ne,"sourceURL")?(ne.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zs+"]")+` `;X.replace(Tr,function(zi,Ya,al,I1,Uh,z1){return al||(al=I1),Do+=X.slice(xo,z1).replace(Pt,p5),Ya&&(xn=!0,Do+=`' + __e(`+Ya+`) + '`),Uh&&(zn=!0,Do+=`'; @@ -4802,20 +4802,20 @@ __p += '`),al&&(Do+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Do+`return __p -}`;var Ca=Vj(function(){return Oi(Xt,Qr+"return "+Do).apply(n,hn)});if(Ca.source=Do,I7(Ca))throw Ca;return Ca}function tz(X){return il(X).toLowerCase()}function tT(X){return il(X).toUpperCase()}function nz(X,ne,He){if(X=il(X),X&&(He||ne===n))return T3(X);if(!X||!(ne=x0(ne)))return X;var et=ys(X),Dt=ys(ne),Xt=xl(et,Dt),hn=Og(et,Dt)+1;return R1(et,Xt,hn).join("")}function Yj(X,ne,He){if(X=il(X),X&&(He||ne===n))return X.slice(0,xy(X)+1);if(!X||!(ne=x0(ne)))return X;var et=ys(X),Dt=Og(et,ys(ne))+1;return R1(et,0,Dt).join("")}function Oj(X,ne,He){if(X=il(X),X&&(He||ne===n))return X.replace(vt,"");if(!X||!(ne=x0(ne)))return X;var et=ys(X),Dt=xl(et,ys(ne));return R1(et,Dt).join("")}function Nr(X,ne){var He=H,et=F;if(ws(ne)){var Dt="separator"in ne?ne.separator:Dt;He="length"in ne?Ji(ne.length):He,et="omission"in ne?x0(ne.omission):et}X=il(X);var Xt=X.length;if(zh(X)){var hn=ys(X);Xt=hn.length}if(He>=Xt)return X;var xn=He-Gc(et);if(xn<1)return et;var zn=hn?R1(hn,0,xn).join(""):X.slice(0,xn);if(Dt===n)return zn+et;if(hn&&(xn+=zn.length-xn),JS(Dt)){if(X.slice(xn).search(Dt)){var xo,To=zn;for(Dt.global||(Dt=Xc(Dt.source,il(Ft.exec(Dt))+"g")),Dt.lastIndex=0;xo=Dt.exec(To);)var Do=xo.index;zn=zn.slice(0,Do===n?xn:Do)}}else if(X.indexOf(x0(Dt),xn)!=xn){var Tr=zn.lastIndexOf(Dt);Tr>-1&&(zn=zn.slice(0,Tr))}return zn+et}function oz(X){return X=il(X),X&>.test(X)?X.replace(je,by):X}var c0=J(function(X,ne,He){return X+(He?" ":"")+ne.toUpperCase()}),Y5=G3("toUpperCase");function M1(X,ne,He){return X=il(X),ne=He?n:ne,ne===n?P3(X)?Sy(X):ed(X):X.match(ne)||[]}var Vj=$r(function(X,ne){try{return Ln(X,n,ne)}catch(He){return I7(He)?He:new ui(He)}}),Bne=ra(function(X,ne){return Wn(ne,function(He){He=lm(He),kh(X,He,H7(X[He],X))}),X});function Yne(X){var ne=X==null?0:X.length,He=gi();return X=ne?Or(X,function(et){if(typeof et[1]!="function")throw new _0(a);return[He(et[0]),et[1]]}):[],$r(function(et){for(var Dt=-1;++DtL)return[];var He=O,et=G0(X,O);ne=gi(ne),X-=O;for(var Dt=Ih(et,ne);++He0||ne<0)?new di(He):(X<0?He=He.takeRight(-X):X&&(He=He.drop(X)),ne!==n&&(ne=Ji(ne),He=ne<0?He.dropRight(-ne):He.take(ne-X)),He)},di.prototype.takeRightWhile=function(X){return this.reverse().takeWhile(X).reverse()},di.prototype.toArray=function(){return this.take(O)},bu(di.prototype,function(X,ne){var He=/^(?:filter|find|map|reject)|While$/.test(ne),et=/^(?:head|last)$/.test(ne),Dt=Ut[et?"take"+(ne=="last"?"Right":""):ne],Xt=et||/^find/.test(ne);Dt&&(Ut.prototype[ne]=function(){var hn=this.__wrapped__,xn=et?[1]:arguments,zn=hn instanceof di,xo=xn[0],To=zn||ea(hn),Do=function(Ya){var al=Dt.apply(Ut,ya([Ya],xn));return et&&Tr?al[0]:al};To&&He&&typeof xo=="function"&&xo.length!=1&&(zn=To=!1);var Tr=this.__chain__,Qr=!!this.__actions__.length,Ii=Xt&&!Tr,Ca=zn&&!Qr;if(!Xt&&To){hn=Ca?hn:new di(this);var zi=X.apply(hn,xn);return zi.__actions__.push({func:By,args:[Do],thisArg:n}),new X0(zi,Tr)}return Ii&&Ca?X.apply(this,xn):(zi=this.thru(Do),Ii?et?zi.value()[0]:zi.value():zi)})}),Wn(["pop","push","shift","sort","splice","unshift"],function(X){var ne=_g[X],He=/^(?:push|sort|unshift)$/.test(X)?"tap":"thru",et=/^(?:pop|shift)$/.test(X);Ut.prototype[X]=function(){var Dt=arguments;if(et&&!this.__chain__){var Xt=this.value();return ne.apply(ea(Xt)?Xt:[],Dt)}return this[He](function(hn){return ne.apply(ea(hn)?hn:[],Dt)})}}),bu(di.prototype,function(X,ne){var He=Ut[ne];if(He){var et=He.name+"";ja.call(A1,et)||(A1[et]=[]),A1[et].push({name:ne,func:He})}}),A1[mt(n,S).name]=[{name:"wrapper",func:n}],di.prototype.clone=vS,di.prototype.reverse=xS,di.prototype.value=Yd,Ut.prototype.at=ine,Ut.prototype.chain=fI,Ut.prototype.commit=ane,Ut.prototype.next=hI,Ut.prototype.plant=sne,Ut.prototype.reverse=cne,Ut.prototype.toJSON=Ut.prototype.valueOf=Ut.prototype.value=NS,Ut.prototype.first=Ut.prototype.head,Bd&&(Ut.prototype[Bd]=lne),Ut},Sp=wS();qe?((qe.exports=Sp)._=Sp,Hn._=Sp):mn._=Sp}).call(yc)})(fX,fX.exports);var k2=fX.exports;const dZt=t=>{const{lx:e,lz:n,parentId:o,id:r,roofId:i}=t,a=M(hxt),l=M($ge);m.useEffect(()=>{i&&(a===i||l.has(i))&&M.getState().set(d=>{for(const f of d.elements)if(f.id===r&&f.type===z.Wall){const p=f;p.roofId=null,p.leftRoofHeight=void 0,p.rightRoofHeight=void 0,p.centerRoofHeight=void 0,p.centerLeftRoofHeight=void 0,p.centerRightRoofHeight=void 0;break}})},[i,a,l]);const s=d=>!(d.button===2||M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().objectTypeToAdd!==z.None||M.getState().isAddingElement()),c=d=>{s(d)&&(M.getState().set(f=>{f.contextMenuObjectType=null}),M.getState().selectMe(r,d,Xo.Select))},u=d=>{M.getState().selectMe(r,d,Xo.ContextMenu),M.getState().set(f=>{d.intersections.length>0&&d.intersections[0].object===d.eventObject&&(f.contextMenuObjectType=z.Wall)})};return h.jsx(ta,{args:[e,n],rotation:[Qt,0,0],visible:!1,onPointerDown:c,onContextMenu:u,children:h.jsx("meshBasicMaterial",{side:ti})})},fZt=be.memo(dZt),kSe=({cy:t,size:e,type:n})=>{const[o,r]=m.useState(QF),i=()=>{r(ga)},a=()=>{r(QF)};return h.jsx(Ps,{name:n,args:[e],position:[0,t,0],onPointerEnter:i,onPointerOut:a,children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},hZt=({ply:t,phz:e})=>{const n=a5(),o=r=>{r.intersections.length>0&&r.intersections[0].eventObject.parent===r.eventObject&&(M.getState().set(i=>{i.moveHandleType=r.object.name}),kn.getState().setEnableOrbitController(!1))};return h.jsxs("group",{name:"Move Handle Group",position:[0,0,-e],onPointerDown:o,children:[h.jsx(kSe,{cy:-n,size:n,type:zo.Lower}),h.jsx(kSe,{cy:t+n,size:n,type:zo.Upper})]})},pZt=be.memo(hZt),gZt="#ADD8E6",M4=be.memo(({x:t,z:e,handleType:n,highLight:o,handleSize:r,partial:i})=>{const a=M(pn),l=M(Ug),s=M(SOe),[c,u]=m.useState(!1),d=o||c||n===l||s&&(n===Mt.LowerRight||n===Mt.UpperRight)?ga:i?gZt:$a;let f=r,p=r,g=r;if(n===Mt.LowerRight||n===Mt.LowerLeft)f=r*1.7;else if(i){f*=.75,p=r/2,g=r*2.5;const A=g/4;n===Mt.WallPartialResizeLeft||n===Mt.WallPartialResizeRight?e-=A:(n===Mt.WallPartialResizeLeftTop||n===Mt.WallPartialResizeRightTop)&&(e+=A)}else p=r/2,g=r*1.7;return h.jsx(si,{name:n,args:[f,p,g],position:[t,0,e],onPointerOver:()=>{u(!0),a(A=>{A.hoveredHandle=n})},onPointerLeave:()=>{u(!1),a(A=>{A.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{color:d})})}),mZt=be.memo(({id:t,parentLz:e,roofId:n,x:o,z:r,absAngle:i,leftUnfilledHeight:a,rightUnfilledHeight:l,leftTopPartialResizeHandleHeight:s,rightTopPartialResizeHandleHeight:c,fill:u,wallLeftHeight:d,wallRightHeight:f,highLight:p,leftJoints:g,rightJoints:A})=>{const y=M(pn),S=M(Ju),C=a5(),[P,v]=m.useState(!1),[T,w]=m.useState(new ae),[x,b]=m.useState(new ln),R=m.useRef(null),H=m.useRef(!1),F=m.useRef([r*2,a,l]),E=m.useRef(new Map),N=m.useRef(null),U=m.useRef(null),W=m.useRef([]),k=m.useMemo(()=>{if(!n)return null;const Q=M.getState().elements.find(se=>se.id===n&&se.type===z.Roof);return Q?Q.roofType:null},[n]);S&&(r=-r);const D=Q=>{const se=M.getState().cameraDirection,Z=Math.atan2(se.x,se.y);w(new ae(Q,0,0)),b(new ln(Qt,0,-Z-i,"ZXY")),v(!0)},L=(Q,se,Z)=>{const[ee,te,oe,de,he]=se;y(pe=>{for(const me of pe.elements)if(me.id===Q&&me.type===z.Wall){const le=me;me.lz=ee,le.leftUnfilledHeight=te,le.rightUnfilledHeight=oe,le.leftTopPartialHeight=de,le.rightTopPartialHeight=he}else if(me.type===z.Wall&&Z.has(me.id)){const le=Z.get(me.id);le!==void 0&&(me.lz=le,me.cz=le/2)}})},j=()=>{n&&(g.length>0||A.length>0)&&(k===Go.Gable||k===Go.Gambrel?M.getState().elements.forEach(Q=>{Q.id===g[0]&&(N.current=Q.lz),Q.id===A[0]&&(U.current=Q.lz)}):(E.current.clear(),M.getState().elements.forEach(Q=>{Q.type===z.Wall&&Q.roofId===n&&E.current.set(Q.id,Q.lz)})))},B=()=>{W.current=M.getState().elements.filter(Q=>Q.parentId===t)},O=(Q,se,Z,ee,te)=>{const{lx:oe,lz:de,roofId:he,leftRoofHeight:pe,rightRoofHeight:me,centerLeftRoofHeight:le,centerRightRoofHeight:Te,centerRoofHeight:ge}=Q,Se=u===Fl.Partial,Re=Se?Math.min(d,ee):d,De=Se?Math.min(f,te):f,Ae=Se&&(!ye.isZero(d-Re)||!ye.isZero(f-De)),[ue,fe]=[oe/2,de/2],ve=[];return ve.push({x:-ue,y:-fe+se},{x:ue,y:-fe+Z}),Ae?ve.push({x:ue,y:-fe+De},{x:-ue,y:-fe+Re}):he?(me?ve.push({x:ue,y:-fe+me}):ve.push({x:ue,y:fe}),Te&&ve.push({x:Te[0]*oe,y:-fe+Te[1]}),ge&&ve.push({x:ge[0]*oe,y:-fe+ge[1]}),le&&ve.push({x:le[0]*oe,y:-fe+le[1]}),pe?ve.push({x:-ue,y:-fe+pe}):ve.push({x:-ue,y:fe})):ve.push({x:ue,y:fe},{x:-ue,y:fe}),ve},V=(Q,se,Z,ee,te)=>{const oe=O(Q,se,Z,ee,te);if(W.current.length>0)for(const de of W.current){let{cx:he,cz:pe,lx:me,ly:le,lz:Te}=de;if(he*=Q.lx,pe*=Q.lz,de.type!==z.SolarPanel?(me*=Q.lx,Te*=Q.lz):Te=le,de.type===z.Window&&de.windowType===Ci.Polygonal){const[ge,Se]=de.polygonTop??Gp,Re=he+ge*me,De=pe+Te/2+Se;if(!ye.isPointInside(Re,De,oe))return!1}if(!ye.isElementInsideWall(new ae(he,0,pe),me,Te,oe,de.type===z.Door))return!1}return!0},G=()=>{N.current=null,U.current=null},q=Q=>{var Z;if(M.getState().addedWallId||Q.object!==((Z=Q.intersections[0])==null?void 0:Z.object))return;const se=Q.object;switch(se.name){case Mt.LowerLeft:{y(ee=>{ee.resizeAnchor.copy(se.localToWorld(new ae(o*2,0,0)))});break}case Mt.LowerRight:{y(ee=>{ee.resizeAnchor.copy(se.localToWorld(new ae(-o*2,0,0)))});break}case Mt.UpperLeft:case Mt.WallPartialResizeLeft:case Mt.WallPartialResizeLeftTop:{D(-o),j(),B();break}case Mt.UpperRight:case Mt.WallPartialResizeRight:case Mt.WallPartialResizeRightTop:{D(o),j(),B();break}default:console.error("Wall resize handle unknown");return}y(ee=>{ee.resizeHandleType=se.name}),kn.getState().setEnableOrbitController(!1),H.current=!0,F.current=[r*2,a,l,s,c]},$=Q=>{if(Q.intersections.length===0||!H.current)return;const se=Q.intersections[0].point;switch(M.getState().resizeHandleType){case Mt.UpperLeft:case Mt.UpperRight:{y(Z=>{const ee=u===Fl.Partial?Math.max(a,l):0;let te=Math.max(ee+C,se.z-e);if(k===null||k===Go.Gable||k===Go.Gambrel){if(N.current||U.current){const oe=Math.abs(te-(N.current??1/0)),de=Math.abs(te-(U.current??1/0));oe{for(const ee of Z.elements)if(ee.id===t&&ee.type===z.Wall){const te=ee;let oe=ye.clamp(se.z-e,0,te.leftTopPartialHeight);if(te.leftJoints.length>0){const de=Z.elements.find(he=>he.id===te.leftJoints[0]&&he.type===z.Wall);if(de&&de.fill===Fl.Partial){const he=de.rightUnfilledHeight;Math.abs(oe-he)<.5&&(oe=he)}}V(te,oe,Z.enableFineGrid?oe:te.rightUnfilledHeight,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.leftUnfilledHeight=oe,Z.enableFineGrid&&(te.rightUnfilledHeight=oe));break}});break}case Mt.WallPartialResizeRight:{y(Z=>{for(const ee of Z.elements)if(ee.id===t&&ee.type===z.Wall){const te=ee;let oe=ye.clamp(se.z-e,0,te.rightTopPartialHeight);if(te.rightJoints.length>0){const de=Z.elements.find(he=>he.id===te.rightJoints[0]&&he.type===z.Wall);if(de&&de.fill===Fl.Partial){const he=de.leftUnfilledHeight;Math.abs(oe-he)<.5&&(oe=he)}}V(te,Z.enableFineGrid?oe:te.leftUnfilledHeight,oe,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.rightUnfilledHeight=oe,Z.enableFineGrid&&(te.leftUnfilledHeight=oe));break}});break}case Mt.WallPartialResizeLeftTop:{y(Z=>{const ee=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ee){let te=ye.clamp(se.z-e,ee.leftUnfilledHeight,ee.lz);if(ee.leftJoints.length>0){const oe=Z.elements.find(de=>de.id===ee.leftJoints[0]&&de.type===z.Wall);if(oe&&oe.fill===Fl.Partial){const de=oe.rightTopPartialHeight;Math.abs(te-de)<.5&&(te=de)}}V(ee,ee.leftUnfilledHeight,ee.rightUnfilledHeight,te,Z.enableFineGrid?te:ee.rightTopPartialHeight)&&(ee.leftTopPartialHeight=te,Z.enableFineGrid&&(ee.rightTopPartialHeight=te))}});break}case Mt.WallPartialResizeRightTop:{y(Z=>{const ee=Z.elements.find(te=>te.id===t&&te.type===z.Wall);if(ee){let te=ye.clamp(se.z-e,ee.rightUnfilledHeight,ee.lz);if(ee.rightJoints.length>0){const oe=Z.elements.find(de=>de.id===ee.rightJoints[0]&&de.type===z.Wall);if(oe&&oe.fill===Fl.Partial){const de=oe.leftTopPartialHeight;Math.abs(te-de)<.5&&(te=de)}}V(ee,ee.leftUnfilledHeight,ee.rightUnfilledHeight,Z.enableFineGrid?te:ee.leftTopPartialHeight,te)&&(ee.rightTopPartialHeight=te,Z.enableFineGrid&&(ee.leftTopPartialHeight=te))}});break}}},ie=()=>{kn.getState().setEnableOrbitController(!0),v(!1),G(),H.current=!1;const Q=new Map;n&&k!==Go.Gable&&k!==Go.Gambrel&&M.getState().elements.forEach(Z=>{Z.type===z.Wall&&Z.roofId===n&&Q.set(Z.id,Z.lz)});const se={name:"Change Wall Height",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Wall,oldHeights:[...F.current],newHeights:[r*2,a,l,s,c],oldSameBuildingWallsHeightMap:new Map(E.current),newSameBuildingWallsHeightMap:Q,undo(){L(this.resizedElementId,this.oldHeights,this.oldSameBuildingWallsHeightMap)},redo(){L(this.resizedElementId,this.newHeights,this.newSameBuildingWallsHeightMap)}};M.getState().addUndoable(se),y(Z=>{Z.actionState.wallHeight=r*2,Z.resizeHandleType=null})};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Wall Resize Handle Group",onPointerDown:q,children:[h.jsx(M4,{x:-o,z:-r,handleType:Mt.LowerLeft,highLight:p,handleSize:C}),h.jsx(M4,{x:o,z:-r,handleType:Mt.LowerRight,highLight:p,handleSize:C}),!S&&h.jsxs(h.Fragment,{children:[h.jsx(M4,{x:-o,z:r,handleType:Mt.UpperLeft,highLight:p,handleSize:C}),h.jsx(M4,{x:o,z:r,handleType:Mt.UpperRight,highLight:p,handleSize:C}),u===Fl.Partial&&h.jsxs(h.Fragment,{children:[h.jsx(M4,{x:-o,z:-r+a,handleType:Mt.WallPartialResizeLeft,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:o,z:-r+l,handleType:Mt.WallPartialResizeRight,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:-o,z:-r+s,handleType:Mt.WallPartialResizeLeftTop,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:o,z:-r+c,handleType:Mt.WallPartialResizeRightTop,highLight:p,handleSize:C,partial:!0})]})]})]}),P&&h.jsx(ta,{ref:R,position:T,rotation:x,args:[1e4,1e4],visible:!1,onPointerMove:$,onPointerUp:ie,children:h.jsx("meshBasicMaterial",{side:ti})})]})});function C$e(t){return t.type===z.Cuboid}const yZt="/aladdin/assets/building_facade_01-PU9ju7d_.png",AZt="/aladdin/assets/building_facade_02-x--kz-oN.png",wZt="/aladdin/assets/building_facade_03-BYNjzj26.png",vZt="/aladdin/assets/building_facade_04-VGO1xPmk.png",xZt="/aladdin/assets/building_facade_05-D5uzq3D-.png",bZt="/aladdin/assets/building_facade_06-ClFD4NV8.png",SZt="/aladdin/assets/building_facade_07-XvrQxWV-.png",TZt="/aladdin/assets/building_facade_08-D0kjh0Oz.png",PZt="/aladdin/assets/building_facade_09-y8kFBOu-.png",CZt="/aladdin/assets/building_facade_10-B2-exMft.png",Xz=be.memo(({handleType:t,position:e,size:n,onPointerDown:o,onPointerOver:r,onPointerOut:i})=>{const a=M(Ub),l=M(ly),s=m.useRef(null),[c,u,d]=e;let f=iw;c===0&&u===0?f=rAt:c===0?f=QF:u===0&&(f=iw);const p=l===t||a===t?ga:f;return h.jsx(Ps,{ref:s,name:t,args:[n/2,6,6,0,Math.PI],position:[c,u,d],onPointerDown:o,onPointerOver:g=>{r(g,t)},onPointerOut:i,children:h.jsx("meshBasicMaterial",{color:p})})}),gm=be.memo(({handleType:t,position:e,size:n,onPointerOver:o,onPointerOut:r})=>{const i=M(Ug),a=M(ly),l=m.useRef(null),[s,c,u]=e,d=a===t||i===t?ga:$a,f=()=>{if(l.current){const p=l.current.localToWorld(new ae(-s*2,-c*2,0));M.getState().set(g=>{g.resizeAnchor.copy(p),g.resizeHandleType=t}),kn.getState().setEnableOrbitController(!1)}};return h.jsx(si,{ref:l,name:t,args:[n,n,n],position:[s,c,u],onPointerDown:f,onPointerOver:p=>{o(p,t)},onPointerOut:r,children:h.jsx("meshBasicMaterial",{color:d})})}),RZt=({id:t,args:e})=>{const[n,o,r]=e,i=M(pn),a=M(Jn),l=M(Ju),s=M(i$),[c,u]=m.useState(null),{gl:d,raycaster:f}=ri(),p=a5(),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),C=m.useRef(null),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(null),w=m.useMemo(()=>[0,Math.min(-1.2*o,-o-.75)-p*2,sR/2-r],[o,r,p]),x=m.useMemo(()=>[0,Math.max(1.2*o,o+.75)+p*2,sR/2-r],[o,r,p]),b=c!==null,R=!l,H=!s,F=m.useCallback((Q,se)=>{dt.getState().duringCameraInteraction||Q.intersections.length>0&&(Q.intersections[0].object===Q.eventObject||Q.intersections.length>1&&Q.intersections[1].object===Q.eventObject)&&(i(ee=>{ee.hoveredHandle=se;const te=a(t);te&&(ee.selectedElementAngle=te.rotation[2],ee.selectedElementHeight=te.lz)}),ye.isMoveHandle(se)?d.domElement.style.cursor="move":se===Di.Upper||se===Di.Lower?d.domElement.style.cursor="grab":d.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"pointer")},[]),E=m.useCallback(()=>{i(Q=>{Q.hoveredHandle=null}),d.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),N=Q=>{const se=a(Q);if(!se)return 0;const Z=se.rotation[2];return se.parentId===Zo?Z:Z+N(se.parentId)},U=Q=>{switch(Q){case z.SolarPanel:case z.Human:case z.Flower:case z.Tree:return!0}return!1},W=Q=>U(Q)||Q===z.Cuboid,k=Q=>{i(se=>{const Z=se.elements.find(Re=>Re.id===t);if(!Z)return;const ee=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),oe=new ae().subVectors(ee,te).applyEuler(new ln(0,0,-(y.current??0))),de=new ae().addVectors(ee,te).multiplyScalar(.5),{pos:he,rot:pe}=ye.getWorldDataById(Z.parentId),me=new ae().subVectors(de,he).applyEuler(new ln(0,0,-pe));Z.cx=me.x,Z.cy=me.y;const le=Math.abs(oe.x),Te=Math.abs(oe.y);Z.lx=le,Z.ly=Te;const ge=new ae(me.x,me.y,Z.cz).applyEuler(new ln(0,0,pe)).add(he),Se=Z.rotation[2]+pe;if(P.current.size>0)for(const Re of se.elements){const De=P.current.get(Re.id);if(De){const Ae=De.clone().sub(ge).applyEuler(new ln(0,0,-Se));if(U(Re.type)){const ue=v.current.get(Re.id);if(ue){const[fe,ve]=ue;fe==="Top"?(Re.cx=Ae.x,Re.cy=Ae.y):fe==="NS"?(Re.cx=Ae.x,Re.cy=Math.sign(ve)*(Te/2)):fe==="EW"&&(Re.cx=Math.sign(ve)*(le/2),Re.cy=Ae.y)}}else Re.type===z.Cuboid?(Re.cx=Ae.x,Re.cy=Ae.y):(Re.cx=Ae.x/le,Re.cy=Ae.y/Te)}}})},D=Q=>{i(se=>{const Z=se.elements.find(Se=>Se.id===t);if(!Z)return;const ee=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),oe=new ae().subVectors(ee,te).applyEuler(new ln(0,0,-(y.current??0))),de=new ae().addVectors(ee,te).multiplyScalar(.5),{pos:he,rot:pe}=ye.getWorldDataById(Z.parentId),me=new ae().subVectors(de,he).applyEuler(new ln(0,0,-pe));Z.cx=me.x;const le=Math.abs(oe.x);Z.lx=le;const Te=new ae(me.x,me.y,Z.cz).applyEuler(new ln(0,0,pe)).add(he),ge=Z.rotation[2]+pe;if(P.current.size>0)for(const Se of se.elements){const Re=P.current.get(Se.id);if(Re){const De=Re.clone().sub(Te).applyEuler(new ln(0,0,-ge));if(U(Se.type)){const Ae=v.current.get(Se.id);if(Ae){const[ue,fe]=Ae;ue==="Top"||ue==="NS"?Se.cx=De.x:ue==="EW"&&(Se.cx=Math.sign(fe)*(le/2))}}else Se.type===z.Cuboid?Se.cx=De.x:Se.cx=De.x/le}}})},L=Q=>{i(se=>{const Z=se.elements.find(Se=>Se.id===t);if(!Z)return;const ee=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),oe=new ae().subVectors(ee,te).applyEuler(new ln(0,0,-(y.current??0))),de=new ae().addVectors(ee,te).multiplyScalar(.5),{pos:he,rot:pe}=ye.getWorldDataById(Z.parentId),me=new ae().subVectors(de,he).applyEuler(new ln(0,0,-pe));Z.cy=me.y;const le=Math.abs(oe.y);Z.ly=le;const Te=new ae(me.x,me.y,Z.cz).applyEuler(new ln(0,0,pe)).add(he),ge=Z.rotation[2]+pe;if(P.current.size>0)for(const Se of se.elements){const Re=P.current.get(Se.id);if(Re){const De=Re.clone().sub(Te).applyEuler(new ln(0,0,-ge));if(U(Se.type)){const Ae=v.current.get(Se.id);if(Ae){const[ue,fe]=Ae;ue==="Top"?Se.cy=De.y:ue==="NS"?Se.cy=Math.sign(fe)*(le/2):ue==="EW"&&(Se.cy=De.y)}}else Se.type===z.Cuboid?Se.cy=De.y:Se.cy=De.y/le}}})},j=Q=>{if(g.current!==null){const se=Math.max(1,Q.z-g.current);i(Z=>{for(const ee of Z.elements)if(ee.id===t&&(ee.lz=se,ee.cz=se/2,Z.selectedElementHeight=se),ee.parentId===t&&U(ee.type)){const te=v.current.get(ee.id);te&&te[0]==="Top"&&(ee.cz=se/2)}})}},B=Q=>{if(A.current){const[se,Z]=A.current;let ee=Math.atan2(se-Q.x,Q.y-Z)+(M.getState().rotateHandleType===Di.Upper?0:Math.PI);const te=Math.abs(ee)>Math.PI?-Math.sign(ee)*sa:0;S.current&&(ee-=S.current),M.getState().updateElementRotationById(t,0,0,ee+te)}},O=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name||M.getState().addedCuboidId){const se=a(t);if(se&&se.parentId!==Zo){u({position:new ae(0,0,-r),rotation:new ln});const{pos:Z,rot:ee}=ye.getWorldDataById(se.parentId);C.current=Z,S.current=ee,y.current=ee+se.rotation[2];const te=new ae(se.cx,se.cy,se.cz).applyEuler(new ln(0,0,ee)).add(Z),oe=M.getState().elements.filter(de=>de.parentId===se.id&&(W(de.type)||ye.isIdentical(de.normal,[0,0,1])));P.current.clear(),v.current.clear();for(const de of oe){const he=new ae;U(de.type)?(he.set(de.cx,de.cy,de.cz),Math.abs(de.cz-r)<.01?v.current.set(de.id,["Top",1]):Math.abs(Math.abs(de.cx)-n)<.01?v.current.set(de.id,["EW",Math.sign(de.cx)]):v.current.set(de.id,["NS",Math.sign(de.cy)])):de.type===z.Cuboid?he.set(de.cx,de.cy,de.cz):he.set(de.cx*se.lx,de.cy*se.ly,0),he.applyEuler(new ln(0,0,y.current)).add(te),P.current.set(de.id,he)}}i(Z=>{Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(t),Z.selectedElement=Z.elements.find(ee=>ee.id===t)??null})}},V=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name){const se=Q.intersections[0].object,Z=M.getState().cameraDirection,ee=Math.atan2(Z.x,Z.y)+N(t);u({position:se.position.clone(),rotation:new ln(-Qt,ee,0)});const te=se.localToWorld(new ae);g.current=te.z-r*2;const oe=M.getState().elements.filter(de=>de.parentId===t&&U(de.type));v.current.clear();for(const de of oe)new ae().set(de.cx,de.cy,de.cz),Math.abs(de.cz-r)<.01&&v.current.set(de.id,["Top",1]);i(de=>{de.selectedElementIdSet.clear(),de.selectedElementIdSet.add(t),de.selectedElement=de.elements.find(he=>he.id===t)??null})}},G=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name){u({position:new ae(0,0,-r),rotation:new ln(0,0,0)});const se=Q.eventObject;A.current=se.localToWorld(new ae).toArray();const Z=a(t);Z&&(S.current=N(Z.parentId))}},q=Q=>{if(Q.intersections.length>0){const se=Q.intersections[0].eventObject.name;switch(se){case zo.Lower:case zo.Upper:case zo.Left:case zo.Right:case zo.Top:{M.getState().set(Z=>{const ee=Z.elements.find(te=>te.id===t)??null;if(ee){if(Z.selectedElement=ee,ee.parentId===Zo)for(const te of Z.elements)Z.selectedElementIdSet.has(te.id)&&!ye.isElementAllowedMultipleMoveOnGround(te)&&Z.selectedElementIdSet.delete(te.id);else Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(ee.id);Z.moveHandleType=se}}),kn.getState().setEnableOrbitController(!1);break}}}},$=Q=>{if(T.current){const se=f.intersectObject(T.current);if(se.length){const Z=se[0].point,ee=M.getState().resizeHandleType;ee?ye.isTopResizeHandle(ee)?j(Z):ye.isXResizeHandle(ee)?D(Z):ye.isYResizeHandle(ee)?L(Z):k(Z):M.getState().rotateHandleType&&B(Z)}}},ie=()=>{u(null),g.current=null,A.current=null,y.current=null,S.current=null,C.current=null};return h.jsxs(h.Fragment,{children:[b&&h.jsx(ta,{name:"Cuboid Intersection Plane",ref:T,args:[1e4,1e4],position:c.position,rotation:c.rotation,visible:!1,onPointerMove:$,onPointerUp:ie}),h.jsxs("group",{name:"Bottom Resize Handle Group",position:[0,0,-r+p/2],onPointerDown:O,children:[h.jsx(gm,{handleType:Mt.UpperLeft,position:[-n,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperRight,position:[n,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerLeft,position:[-n,-o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerRight,position:[n,-o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Left,position:[-n,0,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Right,position:[n,0,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Upper,position:[0,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Lower,position:[0,-o,0],size:p,onPointerOver:F,onPointerOut:E})]}),R&&h.jsxs("group",{name:"Cuboid Top Resize Handle Group",onPointerDown:V,children:[h.jsx(gm,{handleType:Mt.LowerLeftTop,position:[-n,-o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperLeftTop,position:[-n,o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerRightTop,position:[n,-o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperRightTop,position:[n,o,r],size:p,onPointerOver:F,onPointerOut:E})]}),H&&h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Cuboid Move Handle Group",onPointerDown:q,children:[h.jsx(Xz,{handleType:zo.Lower,position:[0,-o-p*1.2,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Upper,position:[0,o+p*1.2,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Left,position:[-n-p*1.2,0,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Right,position:[n+p*1.2,0,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Top,position:[0,0,r],size:p,onPointerOver:F,onPointerOut:E})]}),h.jsxs("group",{name:"Cuboid Rotate Handle Group",onPointerDown:G,children:[h.jsx(dX,{id:t,handleType:Di.Lower,position:w,ratio:p*4,hoverHandle:F,noHoverHandle:E}),h.jsx(dX,{id:t,position:x,handleType:Di.Upper,ratio:p*4,hoverHandle:F,noHoverHandle:E})]})]})]})},HZt=be.memo(RZt);class Pi{static getSolarPanelUnitLength(e){const n=M.getState().getPvModule(e.pvModelName);return e.orientation===vr.landscape?[n.length,n.width]:[n.width,n.length]}static getRotationFromNormal(e){const[n,o,r]=e;return r===1?new ln(0,0,0):n!==0?new ln(Qt,0,n*Qt,"ZXY"):o!==0?new ln(-o*Qt,0,0):new ln}static isNewPositionOk(e){const n=M.getState().elements.find(o=>o.id===e.parentId);if(!n)return!1;switch(n.type){case z.Foundation:{if(!ye.isSolarCollectorWithinHorizontalSurface(e,n))return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(M.getState().overlapWithSibling(e))return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Cuboid:{if(e.type===z.SolarWaterHeater)break;const o=ye.checkElementOnCuboidState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Wall:{const o=ye.checkElementOnWallState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Roof:{const o=ye.checkElementOnRoofState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}}return!0}static getRackCount(e,n,o,r,i){if(e===vr.portrait){const a=Math.max(1,Math.round(n/i)),l=Math.max(1,Math.round(o/r));return a*l}else{const a=Math.max(1,Math.round(n/r)),l=Math.max(1,Math.round(o/i));return a*l}}static setSelected(e,n){M.getState().set(o=>{var r;o.multiSelectionsMode?n?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):o.selectedElementIdSet.delete(e):n?(o.selectedElement=o.elements.find(i=>i.id===e)??null,o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e)):(((r=o.selectedElement)==null?void 0:r.id)===e&&(o.selectedElement=null),o.selectedElementIdSet.has(e)&&o.selectedElementIdSet.delete(e))})}static getSurfaceType(e,n){return!n||!e||e===z.Foundation?nh.Horizontal:e===z.Wall?nh.Vertical:ye.isEqual(n.z,1)?nh.Horizontal:e===z.Cuboid?nh.Vertical:nh.Inclined}static findParentGroup(e,n){const o=e.parent;if(!o)return null;for(const r of n)if(o.name.includes(r))return o;return Pi.findParentGroup(o,n)}static getRoofId(e){if(!e)return null;const n=e.userData.roofId;return n||Pi.getRoofId(e.parent)}static getRoofSegmentData(e){if(!e)return null;const{roofId:n,foundation:o,centroid:r,roofSegments:i}=e.userData;return!n||!o||!r||!i?Pi.getRoofSegmentData(e.parent):{roofId:n,foundation:o,centroid:r,roofSegments:i}}static getRelativeAzimuth(e){return e>Math.PI?e-Math.PI*2:e<-Math.PI?e+Math.PI*2:e}static isTrackerEnabled(e,n){return e===nh.Horizontal&&n!==Ll.NO_TRACKER}static getUnitSize(e,n,o){return e===vr.landscape?{length:n,width:o}:{length:o,width:n}}static getRotationOnCuboid(e){const{x:n,y:o,z:r}=e;return ye.isEqual(r,1)?[0,0,0]:ye.isEqual(n,0)&&ye.isEqual(o,1)?[Qt,0,Math.PI]:ye.isEqual(n,0)&&ye.isEqual(o,-1)?[Qt,0,0]:ye.isEqual(n,-1)&&ye.isEqual(o,0)?[Qt,0,-Qt]:ye.isEqual(n,1)&&ye.isEqual(o,0)?[Qt,0,Qt]:[0,0,0]}static getPVModel(e){let n=M.getState().supportedPvModules[e];return n||(n=M.getState().customPvModules[e],n)?n:(console.warn("pvModel undefined. Using default model: SPR-X21-335-BLK"),{name:"SPR-X21-335-BLK",brand:"SunPower",cellType:"Monocrystalline",efficiency:.21,length:1.558,nominalLength:1.56,width:1.046,nominalWidth:1.05,thickness:.046,m:12,n:8,pmax:335,vmpp:57.3,impp:5.85,voc:67.9,isc:6.23,pmaxTC:-.0029,noct:41.5,weight:18.6,color:"Black",shadeTolerance:"High",bifacialityFactor:0})}static addUndoable(e,n){if(e)switch(n){case Aa.Move:{Pi.addUndoableMove(e);break}case Aa.ResizeX:case Aa.ResizeY:{Pi.addUndoableResize(e);break}case Aa.RotateLower:case Aa.RotateUpper:{Pi.addUndoableRotate(e);break}case Aa.Tilt:{Pi.addUndoableTilt(e);break}}}static addUndoableMove(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ae().fromArray(e.normal),newNormal:new ae().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};M.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{M.getState().set(f=>{const p=f.elements.find(g=>g.id===i);!p||p.type!==z.SolarPanel||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e){const n=M.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarPanel);if(!n)return;const o={name:"Resize Solar Panel",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],newRot:[...n.rotation],newNor:[...n.normal],undo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.oldPos],[i.lx,i.ly,i.lz]=[...o.oldDms],i.normal=[...o.oldNor],i.rotation=[...o.oldRot];break}})},redo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.newPos],[i.lx,i.ly,i.lz]=[...o.newDms],i.normal=[...o.newNor],i.rotation=[...o.newRot];break}})}};M.getState().addUndoable(o)}static addUndoableRotate(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Relative Azimuth",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.relativeAzimuth=i)})}}static addUndoableTilt(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Tilt",timestamp:Date.now(),changedElementId:n.id,oldValue:e.tiltAngle,newValue:n.tiltAngle,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.tiltAngle=i)})}}}const MZt=t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=1,color:l="silver",lineColor:s="black",lineWidth:c=.1,locked:u=!1,showLabel:d=!1,textureTypes:f=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],stackable:p,transparency:g}=t,A=Tc(e),y=M(pn),S=M(m0),C=M(Ju),P=M(Jn),v=M(Db),T=M(_ge),w=M(Ap),x=M(d3),b=M(Fw),R=M(u3),H=M(Uge),F=M(Bwt),E=M(pu),N=M(Qq),U=M(t5),W=M(Cs),k=M(En),D=M(qge),L=M(kw),j=M(hYe),B=M(Nge),O=dt(hs),V=M(Pf),G=Cn(c1),q=M(mA),{camera:$,gl:{domElement:ie},raycaster:Q,mouse:se}=ri(),[Z,ee]=m.useState(null),[te,oe]=m.useState(null),[de,he]=m.useState(null),[pe,me]=m.useState(null),[le,Te]=m.useState(null),[ge,Se]=m.useState(!1),[Re,De]=m.useState(!1),Ae=m.useRef(null),ue=m.useRef(null),fe=m.useRef(null),ve=m.useRef(ko),[we,Pe]=m.useState(new ae(0,0,0)),Ie=m.useRef(new ln(0,0,0)),Me=m.useRef(new ae(1,1,1)),ze=m.useRef(new ae),Ne=m.useRef(new ae),Je=m.useRef(new ae),Ue=m.useRef(new ae),nt=m.useRef(new ae(1,1,1)),We=m.useRef(new ae(1,1,1)),Ee=m.useRef(0),ke=m.useRef(0),Oe=m.useRef([]),st=m.useRef([]),je=m.useRef(null),xt=m.useRef(new ae),gt=m.useRef(0),Ye=m.useMemo(()=>({lng:S}),[S]),it=r/2,ut=i/2,Qe=a/2,lt=m.useMemo(()=>new ae,[]),Ze=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.CuboidElement",Ye))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Ye)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",Ye)+": ("+n.toFixed(1)+", "+o.toFixed(1)+", "+(a/2).toFixed(1)+") "+Y.t("word.MeterAbbreviation",Ye)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ye,n,o,a]);m.useEffect(()=>{const wn=()=>{fe.current=null,De(!1),kn.getState().setEnableOrbitController(!0)};return window.addEventListener("pointerup",wn),()=>{window.removeEventListener("pointerup",wn)}},[]),m.useEffect(()=>{M.getState().tempHumanPlant.length>0&&y(wn=>{wn.elements.push(...wn.tempHumanPlant),wn.tempHumanPlant=[]})},[]),m.useEffect(()=>{if(t&&O){const wn=V??5,In=G(t.id+"-top");In&&ee(ye.fetchHeatmapTexture(In,wn));const ar=G(t.id+"-south");ar&&oe(ye.fetchHeatmapTexture(ar,wn));const Wo=G(t.id+"-north");Wo&&he(ye.fetchHeatmapTexture(Wo,wn));const to=G(t.id+"-west");to&&me(ye.fetchHeatmapTexture(to,wn));const Bn=G(t.id+"-east");Bn&&Te(ye.fetchHeatmapTexture(Bn,wn,!0))}},[O,V]);const Be=wn=>{switch(wn){case Ro.Facade01:return yZt;case Ro.Facade02:return AZt;case Ro.Facade03:return wZt;case Ro.Facade04:return vZt;case Ro.Facade05:return xZt;case Ro.Facade06:return bZt;case Ro.Facade07:return SZt;case Ro.Facade08:return TZt;case Ro.Facade09:return PZt;case Ro.Facade10:return CZt;default:return og}},$e=wn=>{switch(wn){case Ro.Facade01:return{x:14,y:6.5};case Ro.Facade02:return{x:14,y:6.5};case Ro.Facade03:return{x:10,y:12};case Ro.Facade04:return{x:20,y:11};case Ro.Facade05:return{x:15,y:10};case Ro.Facade06:return{x:11,y:3.5};case Ro.Facade07:return{x:11,y:10};case Ro.Facade08:return{x:16,y:9};case Ro.Facade09:return{x:10,y:9};case Ro.Facade10:return{x:12,y:9};default:return{x:1,y:1}}},wt=m.useMemo(()=>new cf().load(f?Be(f[0]):og,wn=>{const In=$e(f[0]);wn.repeat.set(i/In.x,a/In.y),wn.rotation=Qt,wn.center.x=1,wn.center.y=0,wn.wrapS=wn.wrapT=bs,Rt(wn)}),[f[0],i,a]),[vt,Rt]=m.useState(wt),Gt=m.useMemo(()=>new cf().load(f?Be(f[1]):og,wn=>{const In=$e(f[1]);wn.repeat.set(i/In.x,a/In.y),wn.rotation=-Qt,wn.wrapS=wn.wrapT=bs,pt(wn)}),[f[1],i,a]),[At,pt]=m.useState(Gt),Wt=m.useMemo(()=>new cf().load(f?Be(f[2]):og,wn=>{const In=$e(f[2]);wn.repeat.set(r/In.x,a/In.y),wn.rotation=Math.PI,wn.center.x=0,wn.center.y=1,wn.wrapS=wn.wrapT=bs,ct(wn)}),[f[2],r,a]),[ht,ct]=m.useState(Wt),It=m.useMemo(()=>new cf().load(f?Be(f[3]):og,wn=>{const In=$e(f[3]);wn.repeat.set(r/In.x,a/In.y),wn.wrapS=wn.wrapT=bs,Ve(wn)}),[f[3],r,a]),[Ft,Ve]=m.useState(It),ft=m.useMemo(()=>new cf().load(f?Be(f[4]):og,wn=>{const In=$e(f[4]);wn.repeat.set(r/In.x,i/In.y),wn.wrapS=wn.wrapT=bs,rt(wn)}),[f[4],r,i]),[kt,rt]=m.useState(ft);m.useEffect(()=>{op()},[f]);const at=wn=>{switch(wn){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:return!0}return!1},Ge=wn=>{switch(wn){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.Human:case z.Tree:case z.Flower:return!0}return!1},yt=wn=>{ve.current=wn;const In=.01;ye.isSame(ve.current,ko)?(Pe(new ae(0,0,Qe+In)),Ie.current=new ln(0,0,0),Me.current.set(it,ut,Qe)):ye.isSame(ve.current,Op)?(Pe(new ae(it+In,0,0)),Ie.current=new ln(0,Qt,0),Me.current.set(Qe,ut,it)):ye.isSame(ve.current,Vp)?(Pe(new ae(-it-In,0,0)),Ie.current=new ln(0,-Qt,0),Me.current.set(Qe,ut,it)):ye.isSame(ve.current,_p)?(Pe(new ae(0,-ut-In,0)),Ie.current=new ln(Qt,0,0),Me.current.set(it,Qe,ut)):ye.isSame(ve.current,Yc)&&(Pe(new ae(0,ut+In,0)),Ie.current=new ln(-Qt,0,0),Me.current.set(it,Qe,ut))},Pt=Math.max(1,Math.max(r,i)/8),ot=Wg*Pt,bt=wn=>{var Wo,to;const In=wn.intersections[0];if(M.getState().objectTypeToAdd===z.SolarPanel){const Bn=In.point,{pos:Ko,rot:So}=ye.getWorldDataById(e),Qo=new ae().subVectors(Bn,Ko).applyEuler(new ln(0,0,-So)),Yo=((Wo=In.face)==null?void 0:Wo.normal)??new ae(0,0,1);let lr=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);lr||(lr=M.getState().getPvModule(R9));const fr=Va.makeSolarPanel(t,lr,Qo.x,Qo.y,Qo.z,M.getState().actionState.solarPanelOrientation??vr.landscape,M.getState().actionState.solarPanelPoleHeight??1,M.getState().actionState.solarPanelPoleSpacing??3,M.getState().actionState.solarPanelTiltAngle??0,M.getState().actionState.solarPanelRelativeAzimuth??0,Yo,Pi.getRotationOnCuboid(Yo),M.getState().actionState.solarPanelFrameColor??"white");return y(ei=>{ei.elements.push(fr)}),fr}else return T(t,In.point,(to=In.face)==null?void 0:to.normal)},zt=wn=>{if(wn.button===2)return;D()||E(e,wn,Xo.Select);const In=v();let ar=!1;if(wn.intersections[0].object.name===z.Polygon&&M.getState().objectTypeToAdd!==z.None&&(ar=!0),(In==null?void 0:In.id)===e||ar)if(Ge(M.getState().objectTypeToAdd)&&t){De(!0);const Wo=bt(wn);if(Wo){const to={name:"Add",timestamp:Date.now(),addedElement:Wo,undo:()=>{w(to.addedElement.id,!1)},redo:()=>{y(Bn=>{Bn.elements.push(to.addedElement),Bn.selectedElement=to.addedElement})}};k(to),y(Bn=>{Bn.selectedElementIdSet.clear(),Bn.selectedElementIdSet.add(Wo.id),Bn.selectedElement=Wo,Bn.objectTypeToAdd=z.None})}}else kn.getState().selectNone(),kn.setState({cuboidRef:Ae});else if(In&&In.parentId===e&&at(In.type)){De(!0);const{rot:Wo,pos:to}=ye.getWorldDataById(e);xt.current.copy(to),gt.current=Wo,fe.current=In;let Bn;for(const Ko of wn.intersections)if(Ko.object===ue.current){Bn=Ko.face;break}switch(Bn&&yt(Bn.normal),kn.getState().setEnableOrbitController(!1),ze.current.x=In.cx,ze.current.y=In.cy,ze.current.z=In.cz,Je.current.fromArray(In.normal),nt.current.x=In.lx,nt.current.y=In.ly,nt.current.z=In.lz,In.type){case z.SolarPanel:Ee.current=In.relativeAzimuth,dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e);break;case z.Polygon:Oe.current=In.vertices.map(Ko=>({...Ko}));break}}},Bt=wn=>{var So,Qo;if(!ue.current)return;const In=Q.intersectObjects([ue.current]);if(In.length===0)return;const ar=In[0].face;if(!ar)return;const Wo=Eu.getIntersectionObjects(wn);if(Wo.length===0||Wo[0].eventObject.userData.id!==e){jo(!1),fe.current=null;return}const to=M.getState().selectedElement;if(!!(to&&!to.locked&&to.type===z.SolarPanel&&M.getState().moveHandleType)&&(fe.current=to),ar.normal.z===1&&((So=fe.current)==null?void 0:So.type)!==z.Polygon){const Yo=!!(((Qo=fe.current)==null?void 0:Qo.type)===z.SolarPanel&&(M.getState().moveHandleType||M.getState().rotateHandleType||M.getState().resizeHandleType)&&!fe.current.locked);jo(Yo),Yo&&(lt.set(0,0,fe.current.poleHeight+a/2),yt(new ae(0,0,1)),De(!0));return}else if(jo(!1),fe.current&&t&&!fe.current.locked){const Yo=new Kt(wn.offsetX/ie.clientWidth*2-1,1-wn.offsetY/ie.clientHeight*2);Q.setFromCamera(Yo,$);let lr=In[0].point;if(M.getState().moveHandleType){const fr=ar.normal;if(yt(fr),lr=ye.relativeCoordinates(lr.x,lr.y,lr.z,t),fe.current.type===z.Polygon){const ei=fe.current;if(M.getState().moveHandleType===zo.Default){const hr=ye.calculatePolygonCentroid(Oe.current),tr=new ae().fromArray(ei.normal);let bi,Fo;ye.isSame(tr,Op)?(bi=-(hr.x+lr.z),Fo=lr.y-hr.y):ye.isSame(tr,Vp)?(bi=lr.z-hr.x,Fo=lr.y-hr.y):ye.isSame(tr,Yc)?(bi=lr.x-hr.x,Fo=-(hr.y+lr.z)):ye.isSame(tr,_p)?(bi=lr.x-hr.x,Fo=lr.z-hr.y):(bi=lr.x-hr.x,Fo=lr.y-hr.y);const Si=Oe.current.map(hl=>({...hl}));Si.forEach(hl=>{hl.x+=bi,hl.y+=Fo}),L(ei.id,Si)}}else R(fe.current.id,lr.x,lr.y,lr.z),F(fe.current.id,fr.x,fr.y,fr.z),fe.current.parentId!==e&&M.getState().set(ei=>{const hr=ei.elements.find(tr=>{var bi;return tr.id===((bi=fe.current)==null?void 0:bi.id)&&tr.type===z.SolarPanel});hr&&(hr.parentId!==e||hr.foundationId!==e)&&(hr.parentId=e,hr.foundationId=e,hr.parentType=z.Cuboid,ei.selectedElement&&(ei.selectedElement.parentId=e,hr.color=ei.selectedElement.color))})}else if(M.getState().resizeHandleType)switch(fe.current.type){case z.SolarPanel:{const fr=fe.current;if(fr.normal[2]===1)break;const[ei,hr]=Pi.getSolarPanelUnitLength(fr),tr=M.getState().resizeAnchor,bi=M.getState().resizeHandleType;if(bi===Mt.Lower||bi===Mt.Upper){const Si=Math.max(1,Math.round(Math.abs(lr.z-tr.z)/hr))*hr,hl=new ae(0,0,lr.z-tr.z).normalize().multiplyScalar(Si),nr=new ae().addVectors(tr,hl.clone().divideScalar(2));y(or=>{const Ai=or.elements.find(Fa=>Fa.id===fr.id);Ai&&(Ai.cz=(nr.z-xt.current.z)/a,Ai.ly=Math.abs(hl.z))})}else if(bi===Mt.Left||bi===Mt.Right){const Fo=new ae().subVectors(lr,tr).setZ(0),hl=Math.max(1,Math.round(Fo.length()/ei))*ei,nr=Fo.clone().normalize().multiplyScalar(hl),or=new ae().addVectors(tr,nr.clone().divideScalar(2)),Ai=new ae().subVectors(or,xt.current).applyEuler(new ln(0,0,-gt.current));y(Fa=>{const wi=Fa.elements.find(Fs=>Fs.id===fr.id);wi&&(Math.abs(Math.abs(wi.normal[1])-1)<.01?wi.cx=Ai.x/r:wi.cy=Ai.y/i,wi.lx=nr.length())})}break}case z.Polygon:{if(M.getState().resizeHandleType===Mt.Default){let fr=new ae(lr.x-xt.current.x,lr.y-xt.current.y,0).applyEuler(new ln(0,0,-gt.current,"ZXY"));const ei=fe.current,hr=new ae().fromArray(ei.normal);let tr,bi;ye.isSame(hr,Op)?(tr=t.lz,bi=t.ly,fr.x=-lr.z+xt.current.z):ye.isSame(hr,Vp)?(tr=t.lz,bi=t.ly,fr.x=lr.z-xt.current.z):ye.isSame(hr,Yc)?(tr=t.lx,bi=t.lz,fr.y=-lr.z+xt.current.z):ye.isSame(hr,_p)?(tr=t.lx,bi=t.lz,fr.y=lr.z-xt.current.z):(tr=t.lx,bi=t.ly),fr=M.getState().enableFineGrid?ye.snapToFineGrid(fr):ye.snapToNormalGrid(fr),fr.x/=tr,fr.y/=bi,j(ei.id,ei.selectedIndex,fr.x,fr.y)}break}}De(!0)}},tt=wn=>{if(je.current&&fe.current&&t){if(fe.current.type!==z.SolarPanel)return;const In=fe.current;if(In.locked)return;Q.setFromCamera(se,$);const ar=Q.intersectObjects([je.current]);if(ar.length>0){let Wo=ar[0].point.clone();if(M.getState().moveHandleType)Wo=ye.relativeCoordinates(Wo.x,Wo.y,Wo.z-In.poleHeight,t),R(In.id,Wo.x,Wo.y,Wo.z),F(fe.current.id,0,0,1),fe.current.parentId!==e&&M.getState().set(to=>{const Bn=to.elements.find(Ko=>{var So;return Ko.id===((So=fe.current)==null?void 0:So.id)&&Ko.type===z.SolarPanel});Bn&&(Bn.parentId!==e||Bn.foundationId!==e)&&(Bn.parentId=e,Bn.foundationId=e,Bn.parentType=z.Cuboid,to.selectedElement&&(to.selectedElement.parentId=e,Bn.color=to.selectedElement.color))});else if(M.getState().rotateHandleType&&M.getState().rotateHandleType!==Di.Tilt){const to=gt.current,Bn=new Kt(xt.current.x,xt.current.y),Ko=new Kt(t.lx*In.cx,t.ly*In.cy).rotateAround(ai,to),So=new Kt().addVectors(Ko,Bn),Qo=-to+Math.atan2(-Wo.x+So.x,Wo.y-So.y)+(M.getState().rotateHandleType===Di.Lower?0:Math.PI),Yo=Math.abs(Qo)>Math.PI?-Math.sign(Qo)*sa:0,lr=Qo+Yo;N(In.id,lr),ke.current=lr}else if(M.getState().resizeHandleType){const to=M.getState().resizeAnchor,Bn=U(In.pvModelName),Ko=new Kt(Wo.x,Wo.y),So=new Kt(to.x,to.y),Qo=Ko.distanceTo(So),Yo=In.relativeAzimuth+gt.current,lr=new Kt().subVectors(Ko,So);switch(M.getState().resizeHandleType){case Mt.Lower:case Mt.Upper:{const fr=M.getState().resizeHandleType===Mt.Lower?1:-1,ei=lr.angle()-Yo+fr*Qt;let hr=Qo*Math.cos(ei);In.orientation===vr.portrait?hr=Math.max(1,Math.ceil((hr-Bn.length/2)/Bn.length))*Bn.length:hr=Math.max(1,Math.ceil((hr-Bn.width/2)/Bn.width))*Bn.width;const tr=to.x+fr*(hr*Math.sin(Yo))/2,bi=to.y-fr*(hr*Math.cos(Yo))/2,Fo=new Kt(tr,bi),Si=new Kt(xt.current.x,xt.current.y),hl=new Kt().subVectors(Fo,Si).rotateAround(ai,-gt.current),nr=hl.x/r,or=hl.y/i;qt(In,nr,or,In.lx,hr)&&(b(In.id,hr),R(In.id,nr,or));break}case Mt.Left:case Mt.Right:{const fr=M.getState().resizeHandleType===Mt.Left?-1:1,ei=lr.angle()-Yo+(M.getState().resizeHandleType===Mt.Left?Math.PI:0);let hr=Qo*Math.cos(ei);In.orientation===vr.portrait?hr=Math.max(1,Math.ceil((hr-Bn.width/2)/Bn.width))*Bn.width:hr=Math.max(1,Math.ceil((hr-Bn.length/2)/Bn.length))*Bn.length;const tr=to.x+fr*(hr*Math.cos(Yo))/2,bi=to.y+fr*(hr*Math.sin(Yo))/2,Fo=new Kt(tr,bi),Si=new Kt(xt.current.x,xt.current.y),hl=new Kt().subVectors(Fo,Si).rotateAround(ai,-gt.current),nr=hl.x/r,or=hl.y/i;qt(In,nr,or,hr,In.ly)&&(x(In.id,hr),R(In.id,nr,or));break}}}}}},Ht=(wn,In,ar)=>{const Wo=JSON.parse(JSON.stringify(wn));return Wo.cx=In,Wo.cy=ar,B(Wo)?(co(Y.t("message.MoveCancelledBecauseOfOverlap",Ye)),!1):ye.isIdentical(wn.normal,as)&&!ye.isSolarCollectorWithinHorizontalSurface(Wo,t)?(co(Y.t("message.MoveOutsideBoundaryCancelled",Ye)),!1):!0},_t=(wn,In)=>{const ar=JSON.parse(JSON.stringify(wn));return ar.relativeAzimuth=In,B(ar)?(co(Y.t("message.RotationCancelledBecauseOfOverlap",Ye)),!1):ye.isSolarCollectorWithinHorizontalSurface(ar,t)?!0:(co(Y.t("message.RotationOutsideBoundaryCancelled",Ye)),!1)},qt=(wn,In,ar,Wo,to)=>{if(wn.tiltAngle!==0&&.5*to*Math.abs(Math.sin(wn.tiltAngle))>wn.poleHeight)return!1;const Bn=JSON.parse(JSON.stringify(wn));return Bn.cx=In,Bn.cy=ar,Bn.lx=Wo,Bn.ly=to,!!ye.isSolarCollectorWithinHorizontalSurface(Bn,t)},un=()=>{if(!fe.current)return;const wn=P(fe.current.id);if(wn){if(wn.type===z.Polygon){if(M.getState().moveHandleType||M.getState().resizeHandleType){st.current=wn.vertices.map(ar=>({...ar}));const In={name:M.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Oe.current,newValue:st.current,changedElementId:wn.id,changedElementType:wn.type,undo:()=>{L(In.changedElementId,In.oldValue)},redo:()=>{L(In.changedElementId,In.newValue)}};k(In)}}else if(M.getState().resizeHandleType){if(Ne.current.x=wn.cx,Ne.current.y=wn.cy,Ne.current.z=wn.cz,We.current.x=wn.lx,We.current.y=wn.ly,We.current.z=wn.lz,Ne.current.distanceToSquared(ze.current)>Et&&We.current.distanceToSquared(nt.current)>Et){const In={name:"Resize",timestamp:Date.now(),resizedElementId:fe.current.id,resizedElementType:fe.current.type,oldCx:ze.current.x,oldCy:ze.current.y,oldCz:ze.current.z,newCx:Ne.current.x,newCy:Ne.current.y,newCz:Ne.current.z,oldLx:nt.current.x,oldLy:nt.current.y,oldLz:nt.current.z,newLx:We.current.x,newLy:We.current.y,newLz:We.current.z,undo:()=>{R(In.resizedElementId,In.oldCx,In.oldCy,In.oldCz),H(In.resizedElementId,In.oldLx,In.oldLy,In.oldLz)},redo:()=>{R(In.resizedElementId,In.newCx,In.newCy,In.newCz),H(In.resizedElementId,In.newLx,In.newLy,In.newLz)}};k(In)}}else if(M.getState().rotateHandleType){if(fe.current.type===z.SolarPanel){const In=fe.current;if(Math.abs(ke.current-Ee.current)>Et)if(_t(In,ke.current)){y(Wo=>{Wo.selectedElementAngle=ke.current});const ar={name:"Rotate",timestamp:Date.now(),oldValue:Ee.current,newValue:ke.current,changedElementId:In.id,changedElementType:In.type,undo:()=>{N(ar.changedElementId,ar.oldValue)},redo:()=>{N(ar.changedElementId,ar.newValue)}};k(ar)}else N(In.id,Ee.current)}}else if(Ne.current.x=wn.cx,Ne.current.y=wn.cy,Ne.current.z=wn.cz,Ue.current.fromArray(wn.normal),Ne.current.distanceToSquared(ze.current)>Et){let In=!0;wn.type===z.SolarPanel&&(In=Ht(wn,wn.cx,wn.cy)),In?Eu.addUndoableMove():y(ar=>{const Wo=ar.elements.find(So=>So.id===wn.id);if(!Wo||!ar.selectedElement)return;const to=ar.selectedElement;Wo.cx=to.cx,Wo.cy=to.cy,Wo.cz=to.cz,Wo.rotation=[...to.rotation],Wo.normal=[...to.normal];const Bn=dt.getState().oldParentId,Ko=dt.getState().oldFoundationId;Bn&&(Wo.parentId=Bn),Ko&&(Wo.foundationId=Ko)})}fe.current=null}},Rn=wn=>{wn.intersections.length>0&&wn.intersections[0].object===ue.current&&Se(!0)},yo=wn=>{fe.current&&ye.isPlantOrHuman(fe.current)&&wn.intersections[0].object===ue.current&&De(!0)},Ao=()=>{Se(!1),De(!1)},wo=wn=>{E(e,wn,Xo.ContextMenu),y(In=>{In.pastePoint.copy(wn.intersections[0].point);const ar=wn.intersections[0].face;ar&&(In.pasteNormal=ar.normal.clone(),ye.isSame(ar.normal,Op)?In.selectedSideIndex=0:ye.isSame(ar.normal,Vp)?In.selectedSideIndex=1:ye.isSame(ar.normal,Yc)?In.selectedSideIndex=2:ye.isSame(ar.normal,_p)?In.selectedSideIndex=3:ye.isSame(ar.normal,ko)&&(In.selectedSideIndex=4)),In.clickObjectType=z.Cuboid,wn.intersections.length>0&&wn.intersections[0].object===ue.current&&(In.contextMenuObjectType=z.Cuboid)})},{transparent:Io,opacity:po}=tM(g!==void 0&&g>0,1-(g??0));m.useEffect(()=>{if(ue.current)for(let wn=0;wn<6;wn++)ue.current.material[wn].needsUpdate=!0},[Io]);const On=[0,1,2,3,4,5],fo=[O&&le?le:vt,O&&pe?pe:At,O&&de?de:ht,O&&te?te:Ft,O&&Z?Z:kt,null],ir=t&&t.faceColors?On.map(wn=>f&&f[wn]!==Ro.NoTexture?O?h.jsx("meshBasicMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):h.jsx("meshStandardMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):O?h.jsx("meshBasicMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):h.jsx("meshStandardMaterial",{side:Da,attach:`material-${wn}`,color:t.faceColors?t.faceColors[wn]:l,map:fo[wn],transparent:Io,opacity:po},wn)):h.jsx("meshStandardMaterial",{side:Da,color:l,transparent:Io,opacity:po}),Rr=m.useMemo(()=>[it,ut,Qe],[it,ut,Qe]),br=A&&!u,[_r,jo]=m.useState(!1);return h.jsxs("group",{ref:Ae,name:"Cuboid Group "+e,children:[h.jsx(si,{castShadow:W,receiveShadow:W,userData:{simulation:!0,stand:!0,stackable:p,id:e,aabb:!0},uuid:e,ref:ue,args:[r,i,a],name:"Cuboid "+e,onContextMenu:wo,onPointerDown:zt,onPointerMove:Bt,onPointerUp:un,onPointerOver:Rn,onPointerOut:Ao,onPointerEnter:yo,children:ir}),_r&&h.jsx(ta,{ref:je,name:"Intersection Plane",position:lt,args:[r,i],visible:!1,onPointerMove:tt}),Re&&h.jsxs(h.Fragment,{children:[(M.getState().moveHandleType||M.getState().resizeHandleType)&&h.jsx(eme,{hx:Me.current.x,hy:Me.current.y,hz:Me.current.z,position:we,rotation:Ie.current}),M.getState().rotateHandleType&&fe.current&&fe.current.type===z.SolarPanel&&h.jsx(_ye,{element:fe.current,height:fe.current.poleHeight+Qe})]}),A&&h.jsx(Gye,{element:t,verticalLift:ot}),(g||!A||q)&&h.jsx(mw,{hx:it,hy:ut,hz:Qe,lineColor:g||q&&C?"white":s,lineWidth:g?c*15:q&&C?c*5:c}),A&&u&&h.jsx(mw,{hx:it,hy:ut,hz:Qe,lineColor:B0,lineWidth:c*5}),br&&h.jsx(HZt,{id:e,args:Rr}),(ge||d)&&!A&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:Ze,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,Qe+((t==null?void 0:t.labelHeight)??.2)]})]})},IZt=be.memo(MZt),R$e=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="white",lineColor:d="black",lineWidth:f=.1,locked:p=!1,label:g,showLabel:A=!1,parentId:y,foundationId:S,light:C=!0,heatFlux:P=!1}=t,v=M(pn),T=M(Cs),w=M(pu),x=Tc(e),{gl:{domElement:b}}=ri(),[R,H]=m.useState(!1),F=m.useRef(null),E=m.useRef(null),N=$t(),U=M(V=>{for(const G of V.elements)if(G.id===y)return G}),W=M(V=>{for(const G of V.elements)if(G.id===S)return G});let k=n,D=o,L=r;if(y&&U)switch(U.type){case z.Foundation:{if(L=U.cz+U.lz/2,ye.isZero(s[2]))k=U.cx+n*U.lx,D=U.cy+o*U.ly;else{const V=new ae(n*U.lx,o*U.ly,0);V.applyAxisAngle(ko,s[2]),k=U.cx+V.x,D=U.cy+V.y}break}case z.Wall:{if((W==null?void 0:W.type)===z.Foundation){const V=ye.absoluteCoordinates(n,o,r,U,W);k=V.x,D=V.y,L=V.z}break}case z.Roof:{if((W==null?void 0:W.type)===z.Foundation){const V=ye.absoluteCoordinates(n,o,r,U,W);k=V.x,D=V.y,L=V.z}break}}const j=l/2,B=m.useMemo(()=>{if((U==null?void 0:U.type)===z.Wall){const G=U,q=W?W.rotation[2]+G.relativeAngle:G.relativeAngle;return new ln(Qt,0,q,"ZXY")}if((U==null?void 0:U.type)===z.Roof)return new ln(s[0],s[1],W?W.rotation[2]+s[2]:s[2],"ZXY");if((U==null?void 0:U.type)===z.Cuboid)return Pi.getRotationFromNormal(c);const V=new ae().fromArray(c);return ye.isSame(V,Op)?new ln(0,Qt,s[2],"ZXY"):ye.isSame(V,Vp)?new ln(0,-Qt,s[2],"ZXY"):ye.isSame(V,Yc)?new ln(-Qt,0,s[2],"ZXY"):ye.isSame(V,_p)?new ln(Qt,0,s[2],"ZXY"):new ln(0,0,s[2])},[c,s,W==null?void 0:W.rotation]),O=m.useMemo(()=>(g||Y.t("shared.SensorElement",N))+(p?" ("+Y.t("shared.ElementLocked",N)+")":"")+` -`+Y.t("word.Coordinates",N)+": ("+k.toFixed(1)+", "+D.toFixed(1)+", "+L.toFixed(1)+") "+Y.t("word.MeterAbbreviation",N),[g,p,N,k,D,L]);return h.jsxs("group",{name:"Sensor Group "+e,rotation:B,position:[k,D,L+j],children:[h.jsx(si,{receiveShadow:T,uuid:e,ref:F,args:[i,a,l],name:"Sensor",onPointerDown:V=>{V.button!==2&&(w(e,V,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=y,G.oldParentId=y,G.oldFoundationId=S}),v(G=>{G.moveHandleType=zo.Default}))},onContextMenu:V=>{w(e,V,Xo.ContextMenu),v(G=>{V.intersections.length>0&&V.intersections[0].object===F.current&&(G.contextMenuObjectType=z.Sensor)})},onPointerOver:V=>{V.intersections.length>0&&V.intersections[0].object===F.current&&(H(!0),b.style.cursor="move")},onPointerOut:()=>{H(!1),b.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:t!=null&&t.lit?ga:u})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Meter",castShadow:!1,receiveShadow:!1,args:[i*.3,a*.3,j,8,1],position:new ae(0,0,j),rotation:[Qt,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:"black"})}),!x&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:d,lineWidth:f}),x&&p&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:B0,lineWidth:f*10}),x&&!p&&h.jsx(Ps,{ref:E,position:new ae(0,0,0),args:[Wg,6,6,0,Math.PI],name:zo.Default,onPointerDown:V=>{V.button===2?(w(e,V,Xo.ContextMenu),v(G=>{V.intersections.length>0&&V.intersections[0].object===E.current&&(G.contextMenuObjectType=z.Sensor)})):w(e,V,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=y,G.oldParentId=y,G.oldFoundationId=S}),v(G=>{G.moveHandleType=zo.Default})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(R||A)&&!x&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l+((t==null?void 0:t.labelHeight)??.2)]})]})}),H$e=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="#ffff99",lineWidth:d=.1,locked:f=!1,label:p,showLabel:g=!1,parentId:A,foundationId:y,decay:S=2,distance:C=5,intensity:P=3,inside:v=!1}=t,T=M(pn),w=M(Cs),x=M(pu),R=M(Lw).z<=0,H=Tc(e),{gl:{domElement:F}}=ri(),[E,N]=m.useState(!1),U=m.useRef(null),W=m.useRef(null),k=$t(),D=M(ie=>{for(const Q of ie.elements)if(Q.id===A)return Q}),L=M(ie=>{for(const Q of ie.elements)if(Q.id===y)return Q});let j=.1,B=n,O=o,V=r;if(A&&D)switch(D.type){case z.Foundation:if(V=D.cz+D.lz/2,ye.isZero(s[2]))B=D.cx+n*D.lx,O=D.cy+o*D.ly;else{const ie=new ae(n*D.lx,o*D.ly,0);ie.applyAxisAngle(ko,s[2]),B=D.cx+ie.x,O=D.cy+ie.y}break;case z.Wall:if((L==null?void 0:L.type)===z.Foundation){const ie=ye.absoluteCoordinates(n,o,r,D,L);B=ie.x,O=ie.y,V=ie.z}j=D.ly;break;case z.Roof:if((L==null?void 0:L.type)===z.Foundation){const ie=ye.absoluteCoordinates(n,o,r,D,L);B=ie.x,O=ie.y,V=ie.z}j=D.thickness;break}const G=l/2,q=m.useMemo(()=>{if((D==null?void 0:D.type)===z.Wall){const Q=D,se=L?L.rotation[2]+Q.relativeAngle:Q.relativeAngle;return new ln(Qt,0,se,"ZXY")}if((D==null?void 0:D.type)===z.Roof)return new ln(s[0],s[1],L?L.rotation[2]+s[2]:s[2],"ZXY");if((D==null?void 0:D.type)===z.Cuboid)return Pi.getRotationFromNormal(c);const ie=new ae().fromArray(c);return ye.isSame(ie,Op)?new ln(0,Qt,s[2],"ZXY"):ye.isSame(ie,Vp)?new ln(0,-Qt,s[2],"ZXY"):ye.isSame(ie,Yc)?new ln(-Qt,0,s[2],"ZXY"):ye.isSame(ie,_p)?new ln(Qt,0,s[2],"ZXY"):new ln(0,0,s[2])},[c,s,L,D]),$=m.useMemo(()=>(p||Y.t("shared.LightElement",k))+(f?" ("+Y.t("shared.ElementLocked",k)+")":"")+` -`+Y.t("word.Coordinates",k)+": ("+B.toFixed(1)+", "+O.toFixed(1)+", "+V.toFixed(1)+") "+Y.t("word.MeterAbbreviation",k),[p,f,k,B,O,V]);return h.jsxs("group",{name:"Light Group "+e,rotation:q,position:[B,O,V],children:[R&&h.jsx("pointLight",{color:u,name:"Point Light "+e,position:[0,0,v?-j-G:G],decay:S*.2,distance:C,intensity:P,castShadow:!0}),h.jsx(ma,{receiveShadow:w,userData:{unintersectable:!0},uuid:e,ref:U,position:[0,0,v?-j:0],rotation:[Qt,0,0],args:[i*.5,a*.5,G,16,1],name:"Light Base",onPointerDown:ie=>{ie.button!==2&&(x(e,ie,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(Q=>{Q.showWallIntersectionPlaneId=A,Q.oldParentId=A,Q.oldFoundationId=y}))},onContextMenu:ie=>{x(e,ie,Xo.ContextMenu),T(Q=>{ie.intersections.length>0&&ie.intersections[0].object===U.current&&(Q.contextMenuObjectType=z.Light)})},onPointerOver:ie=>{ie.intersections.length>0&&ie.intersections[0].object===U.current&&(N(!0),F.style.cursor="move")},onPointerOut:()=>{N(!1),F.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:"lightgray"})}),h.jsx(Ps,{userData:{unintersectable:!0},name:"Light Bulb",castShadow:!1,receiveShadow:w,args:[i*.3,8,8,0,sa,0,Math.PI],position:new ae(0,0,v?-j-G:G),rotation:[Qt,0,0],children:R?h.jsx("meshBasicMaterial",{attach:"material",color:"white"}):h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),H&&f&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:B0,lineWidth:d*10}),H&&!f&&h.jsx(Ps,{ref:W,position:new ae(0,0,v?-j-G:G),args:[Wg,6,6,v?Math.PI:0,Math.PI],name:zo.Default,onPointerDown:ie=>{ie.button===2?(x(e,ie,Xo.ContextMenu),T(Q=>{ie.intersections.length>0&&ie.intersections[0].object===W.current&&(Q.contextMenuObjectType=z.Light)})):x(e,ie,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(Q=>{Q.showWallIntersectionPlaneId=A,Q.oldParentId=A,Q.oldFoundationId=y})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(E||g)&&!H&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:$,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(v?-j:0)+l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Xv="Cuboid Wrapper",M$e="Cuboid Stackable Child",I$e=({elements:t,cuboidModel:e})=>{const{id:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s}=e,c=l/2,u=d=>C$e(d)&&d.parentId===n;return h.jsxs("group",{name:Xv,position:[o,r,c],rotation:[0,0,s[2]],userData:{id:n,fId:n},children:[h.jsx(IZt,{...e}),h.jsx(Kye,{parentId:n,foundationId:n,wrapperType:z.Cuboid,plx:i,ply:a,plz:l}),t.map(d=>{if(u(d))return h.jsx("group",{name:M$e,position:[0,0,c],children:h.jsx(I$e,{elements:t,cuboidModel:d})},d.id);if(d.parentId===n){const{lx:f,ly:p,lz:g}=e;switch(d.type){case z.Sensor:return h.jsx(R$e,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*g},d.id);case z.Light:return h.jsx(H$e,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*g},d.id);default:return null}}else return null})]})},aC=t=>{const[e,n]=m.useState(t);return m.useEffect(()=>{t!==e&&n(t)},[t]),[e,n]},kQ=(t,e)=>{const{gl:n}=ri(),[o,r]=m.useState(t),i=m.useRef(!1),a=m.useRef(!1);return m.useEffect(()=>{const u=()=>{i.current&&(i.current=!1,a.current||(r(t),n.domElement.style.cursor="default"))};return window.addEventListener("pointerup",u),()=>window.removeEventListener("pointerup",u)},[]),{_color:o,_onPointerDown:()=>{i.current=!0,setTimeout(()=>{n.domElement.style.cursor=e},10)},_onPointerMove:u=>{u.intersections.length==0||u.intersections[0].object!==u.object?(a.current=!1,r(t),n.domElement.style.cursor="default"):(a.current=!0,r(ga),n.domElement.style.cursor=e)},_onPointerLeave:()=>{a.current=!1,i.current||(r(t),n.domElement.style.cursor="default")}}},z$e=(t,e)=>{const[n,o]=m.useState(t),[r,i]=m.useState(e);return m.useEffect(()=>{o(t),i(e)},[t,e]),{materialLx:n,materialLy:r,setMaterialSize:(l,s)=>{l===Aa.ResizeX?s!==n&&o(Math.abs(s)):s!==r&&i(Math.abs(s))}}},D$e=t=>{const e=dt(hs),n=M(Pf),[o,r]=m.useState(null);return m.useEffect(()=>{if(e){const i=Cn.getState().getHeatmap(t);i&&r(ye.fetchHeatmapTexture(i,n??5))}},[e,n]),o},zZt=(t,e,n,o,r,i)=>{const a=r??((n==null?void 0:n.color)==="Black"&&(n==null?void 0:n.cellType)==="Monocrystalline"?"silver":"white"),l=i??"gray",s=m.useMemo(()=>{if(!n)return null;const{cellType:d,length:f,width:p,m:g,n:A,color:y}=n;return o===vr.portrait?LSe(d,p,f,A,g,y,a,l):LSe(d,f,p,g,A,y,a,l)},[n,o,a,l]),[c,u]=m.useState(s);return m.useEffect(()=>{if(s&&n){const{length:d,width:f}=n,p=Math.max(1,Math.round(t/(o===vr.landscape?d:f))),g=Math.max(1,Math.round(e/(o===vr.landscape?f:d)));s.repeat.set(p,g),s.wrapS=s.wrapT=bs,u(s.clone())}},[s,t,e]),c},LSe=(t,e,n,o,r,i,a,l)=>{e*=cwe,n*=cwe;const s=document.createElement("canvas");[s.width,s.height]=[e,n];const c=s.getContext("2d");if(c){c.fillStyle=a,c.fillRect(0,0,e,n);const u=Math.max(e,n)*iAt;if(c.fillStyle=l,c.fillRect(u,u,e-2*u,n-2*u),c.fillStyle=i==="Black"?lAt:sAt,t==="Thin Film"){const d=u*.6;c.fillRect(d,d,e-d*2,n-d*2)}else{const d=Math.max(e,n)*aAt,f=u+d,p=(e-f*2-d*(o-1))/o,g=(n-f*2-d*(r-1))/r,A=p*.1,y=g*.1;if(t==="Monocrystalline")for(let S=0;S{const o=a5(),{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=kQ($a,"grab"),s=c=>{n(c),i()};return h.jsxs("group",{name:e,position:[0,t,0],rotation:[Qt,0,0],scale:o*3,onPointerDown:s,onPointerMove:a,onPointerLeave:l,children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(ta,{args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1})]})}),DZt=be.memo(m.forwardRef(({tiltAngle:t,positionZ:e,isOnVerticalSurface:n,onPointerDown:o,onPointerMove:r},i)=>{const a=a5()*3,l=Math.PI/12,s=m.useMemo(()=>n?Qt:Math.PI,[n]),c=m.useMemo(()=>n?new Array(7).fill(0):new Array(13).fill(0),[n]),u=m.useMemo(()=>n?e:0,[n,e]),[d,f]=m.useState(!1),p=m.useRef(null),g=m.useRef(null),A=m.useRef(null),{_color:y,_onPointerDown:S,_onPointerMove:C,_onPointerLeave:P}=kQ($a,"grab");m.useImperativeHandle(i,()=>({setVisiable(x){p.current&&(p.current.visible=x)},update(x,b){g.current&&g.current.rotation.set(x,0,0),A.current&&(A.current.text=v(x)),p.current&&(p.current.position.z=b)}}),[]);const v=x=>{const b=n?-x:x;return`${Math.floor(b/Math.PI*180)}°`},T=x=>{f(!0),o(x),S()},w=x=>{r(x)};return m.useEffect(()=>{const x=()=>{f(!1)};return window.addEventListener("pointerup",x),()=>window.addEventListener("pointerup",x)},[]),h.jsxs("group",{name:"Tilt_Handle_Group",ref:p,position:[0,0,u],children:[h.jsx(wG,{name:Di.Tilt,args:[a,1.125*a,18,2,0,s],rotation:[Qt,0,Qt,"ZXY"],onPointerDown:T,onPointerMove:C,onPointerLeave:P,children:h.jsx("meshBasicMaterial",{side:ti,color:y})}),d&&h.jsxs(h.Fragment,{children:[h.jsx(wG,{name:"Tilt_Handle_Intersection_Plane",args:[a,2*a,18,2,0,s],rotation:[Qt,0,Qt,"ZXY"],onPointerMove:w,children:h.jsx("meshBasicMaterial",{transparent:!0,depthTest:!1,opacity:.5,side:ti})}),h.jsx("group",{rotation:[-Qt,0,0],children:c.map((x,b)=>{const R=n?`${90-b*15}°`:`${b*15-90}°`;return h.jsxs("group",{rotation:[l*b,0,0,"ZXY"],children:[h.jsx(Gn,{points:[[0,0,1.8*a],[0,0,2*a]],color:"white",transparent:!0,opacity:.5}),h.jsx("textSprite",{userData:{unintersectable:!0},text:R,fontSize:20*a,fontFace:"Times Roman",textHeight:.15*a,position:[0,0,1.6*a]})]},b)})}),h.jsxs("group",{ref:g,rotation:[t,0,0],children:[h.jsx(Gn,{points:[[0,0,a],[0,0,1.75*a]]}),h.jsx("textSprite",{ref:A,userData:{unintersectable:!0},text:v(t),fontSize:20*a,fontFace:"Times Roman",textHeight:.2*a,position:[0,0,.75*a]})]})]})]})})),EZt=be.memo(()=>h.jsxs("group",{name:"Normal Pointer Group",children:[h.jsx(Gn,{points:[[0,0,0],[0,0,1]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),h.jsx(xf,{position:[0,0,1],rotation:[Qt,0,0],userData:{unintersectable:!0},args:[.04,.2,4,2],children:h.jsx("meshBasicMaterial",{color:"white"})})]})),FZt=be.memo(be.forwardRef(({positionZ:t,rotationX:e,topTiltGroupRef:n},o)=>{const r=M(ay),i=M(Al),a=M(s0),l=m.useMemo(()=>Math.max(100,10*r),[r]),s=m.useMemo(()=>ki(new Date(i),a),[i,a]),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),[f,p]=m.useState(null),[g,A]=m.useState(null),[y,S]=m.useState(new ae),[C,P]=m.useState(!1),v=H=>{H?C||P(!0):C&&P(!1)},T=H=>!(s.z<0||H<0||H>90),w=()=>n.current?n.current.getWorldDirection(sl).angleTo(s)/Math.PI*180:-1,x=H=>H.toFixed(1)+"°",b=()=>{if(!n.current||!c.current)return null;const H=Hu.setFromQuaternion(c.current.getWorldQuaternion(yd)).z;Hu.set(0,0,-H);const F=c.current.getWorldPosition(ade),E=n.current.localToWorld(sl.set(0,0,.5)).sub(F).applyEuler(Hu),N=u.current.localToWorld(i9.set(0,0,.5)).sub(F).applyEuler(Hu);return[E.clone(),N.clone()]},R=H=>{if(!f||f.length!==2||!H||H.length!==2)return!1;const[F,E]=H,[N,U]=f;return ye.isSame(F,N)&&ye.isSame(E,U)};return m.useImperativeHandle(o,()=>({setPositionZ(H){c.current&&(c.current.position.z=H)},setRotationX(H){c.current&&(c.current.rotation.x=H)}}),[]),m.useEffect(()=>{if(!n.current)return;const H=w();if(T(H))v(!0);else{v(!1);return}A(x(H));const E=b();if(p(E),E&&E.length===2){const[N,U]=E,W=new ae().addVectors(N,U).divideScalar(2).multiplyScalar(1.5);S(W)}},[]),Z2(()=>{if(!n.current)return;const H=w();if(T(H))v(!0);else{v(!1);return}u.current&&u.current.lookAt(u.current.getWorldPosition(sl).add(s));const E=b();if(R(E)||p(E),d.current&&(E==null?void 0:E.length)===2){const[N,U]=E;d.current.position.addVectors(N,U).divideScalar(2).multiplyScalar(1.5),d.current.text=x(H)}}),C?h.jsxs("group",{ref:c,position:[0,0,t],rotation:[e,0,0],children:[h.jsx(Gn,{name:"Sun Beam",ref:u,points:[[0,0,0],[0,0,l]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),f&&y&&g&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{name:"Angle Line",points:f,userData:{unintersectable:!0},lineWidth:1,color:"white"}),h.jsx("textSprite",{ref:d,position:y,text:g,userData:{unintersectable:!0},fontSize:20,fontFace:"Times Roman",textHeight:.1})]})]}):null})),kZt=be.memo(m.forwardRef(({tiltAngle:t,trackerType:e,surfaceType:n,children:o},r)=>{const i=m.useRef(null),a=M(Al),l=M(s0),s=m.useRef(new ae),c=m.useMemo(()=>{const f=ki(new Date(a),l);return s.current.copy(f),f},[a,l]),u=()=>{i.current&&i.current.rotation.set(0,0,0)},d=(f,p)=>{if(i.current)switch(f){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{i.current.rotation.set(Math.atan2(Math.hypot(s.current.x,s.current.y),s.current.z),0,Math.atan2(s.current.y,s.current.x)+Qt-p,"ZXY");break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{i.current.rotation.set(t,0,Math.atan2(s.current.y,s.current.x)+Qt-p,"ZXY");break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const g=new ae().copy(s.current).applyEuler(Hu.set(0,0,-p));i.current.rotation.set(0,Math.atan2(g.x,g.z),0,"ZXY");break}}};return m.useImperativeHandle(r,()=>({reset(){u()},update(f,p){d(f,p)}}),[]),m.useEffect(()=>{if(!i.current)return;if(e===Ll.NO_TRACKER||n!==nh.Horizontal){u();return}const f=Pi.findParentGroup(i.current,[Fm,Xv]);f&&d(e,Hu.setFromQuaternion(f.getWorldQuaternion(yd)).z)},[c,e,n]),h.jsx("group",{ref:i,children:o})})),LZt=({solarPanel:t,lx:e,ly:n})=>{const{id:o,tiltAngle:r,pvModelName:i,orientation:a,color:l}=t,s=dt(hs),c=M(Ju)??!1,u=M(vge),d=M(DH),f=M(EH),g=m.useMemo(()=>({...f,...d}),[d,f])[i],A=zZt(e,n,g,a,t.frameColor,t.backsheetColor),y=D$e(o),S=()=>s&&y?h.jsx("meshBasicMaterial",{attach:"material-4",map:y}):A?c||u===0?h.jsx("meshStandardMaterial",{attach:"material-4",map:A,color:l}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr((g==null?void 0:g.color)==="Blue"?lwe:yG),shininess:u??rw,side:Da,map:A,color:l}):null,C=()=>(g==null?void 0:g.bifacialityFactor)===0||c?h.jsx("meshStandardMaterial",{attach:"material-5",color:l}):A?h.jsx("meshPhongMaterial",{attach:"material-5",specular:new rr((g==null?void 0:g.color)==="Blue"?lwe:yG),shininess:u??rw,side:Da,map:A,color:l}):null;return h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:l}),h.jsx("meshStandardMaterial",{attach:"material-1",color:l}),h.jsx("meshStandardMaterial",{attach:"material-2",color:l}),h.jsx("meshStandardMaterial",{attach:"material-3",color:l}),S(),C()]})},WZt=be.memo(m.forwardRef(({lx:t,ly:e,poleRadius:n,poleHeight:o,poleSpacing:r,tiltAngle:i,color:a,visiable:l},s)=>{const c=M(v=>v.elements.length>100?2:4),[u,d]=aC(t),[f,p]=aC(e),[g,A]=aC(i),[y,S]=aC(l),C=m.useRef(null);m.useImperativeHandle(s,()=>({update({lx:v,ly:T,tilt:w}){v!==void 0&&d(v),T!==void 0&&p(T),w!==void 0&&A(w)},setVisiable(v){S(v)}}),[]);const P=m.useMemo(()=>{const v=[],T=Math.floor(.5*u/r),w=Math.floor(.5*f*Math.abs(Math.cos(g))/r),x=Math.tan(g);for(let b=-T;b<=T;b++)for(let R=-w;R<=w;R++){const H=b*r,F=R*r,E=x*F+o,N=(E-o)/2;v.push(new qa(H,F,N,E))}return v},[u,f,g,r,o]);return y?h.jsx("group",{name:"Poles group",ref:C,position:[0,0,-o/2],children:P.map((v,T)=>v.w<0?null:h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+T,args:[n,n,v.w,c,1],position:[v.x,v.y,v.z],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{color:a})},T))}):null})),NZt=be.memo(({hlx:t,hly:e})=>h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-t,-e,0],[-t,e,0],[t,e,0],[t,-e,0],[-t,-e,0]],lineWidth:3,color:B0})),UZt=be.memo(({solarPanel:t,boxRef:e})=>{const{ly:n,tiltAngle:o,label:r,locked:i,labelColor:a="white",labelFontSize:l=20,labelSize:s=.2,labelHeight:c}=t,u=n/2,d=$t(),[f,p]=m.useState("");m.useEffect(()=>{if(!e.current)return;const{x:A,y,z:S}=e.current.getWorldPosition(sl);p((r??Y.t("shared.SolarPanelElement",d))+(i?" ("+Y.t("shared.ElementLocked",d)+")":"")+(r?"":` -`+Y.t("word.Coordinates",d)+": ("+A.toFixed(1)+", "+y.toFixed(1)+", "+S.toFixed(1)+") "+Y.t("word.MeterAbbreviation",d)))},[r,i,d]);const g=c??Math.max(u*Math.abs(Math.sin(o))+.1,.2);return h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:f,color:a,fontSize:l,textHeight:s,position:[0,0,g]})}),E$e=be.memo(({onPointerDown:t})=>{const{_color:e,_onPointerDown:n,_onPointerMove:o,_onPointerLeave:r}=kQ(iw,"move"),i=a5()*.75,{gl:a}=ri();return h.jsx(Ps,{name:"Move_Handle",args:[i],onPointerDown:l=>{t(l),n(),a.domElement.style.cursor="move"},onPointerMove:o,onPointerLeave:r,children:h.jsx("meshBasicMaterial",{color:e})})}),Jv=be.memo(({cx:t,cy:e,size:n,type:o})=>{const{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=kQ($a,"pointer");return h.jsx(si,{name:o,position:[t,e,.1],args:[n,n,.1],onPointerDown:i,onPointerMove:a,onPointerLeave:l,children:h.jsx("meshBasicMaterial",{color:r})})}),jZt=be.memo(m.forwardRef(({hlx:t,hly:e,onPointerDown:n},o)=>{const r=a5();return h.jsxs("group",{name:"Resize_Handles_Group",ref:o,onPointerDown:n,children:[h.jsx(Jv,{type:Mt.Left,cx:-t,cy:0,size:r}),h.jsx(Jv,{type:Mt.Right,cx:t,cy:0,size:r}),h.jsx(Jv,{type:Mt.Lower,cx:0,cy:-e,size:r}),h.jsx(Jv,{type:Mt.Upper,cx:0,cy:e,size:r})]})})),BZt=be.memo(({children:t,onPointerOut:e,onPointerOver:n})=>{const o=M(Cs);return h.jsx(si,{name:"Box_Mesh",receiveShadow:o,castShadow:o,onPointerOver:n,onPointerOut:e,children:t})}),YZt=({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>{const a=[],[l,s,c]=[t/2,e/2,n/2];let u,d;o===vr.portrait?(u=Math.max(1,Math.round(t/i)),d=Math.max(1,Math.round(e/r))):(u=Math.max(1,Math.round(t/r)),d=Math.max(1,Math.round(e/i)));const f=t/u,p=e/d;for(let g=0;g<=u;g++)a.push({points:[new ae(-l+g*f,-s,c),new ae(-l+g*f,s,c)]});for(let g=0;g<=d;g++)a.push({points:[new ae(-l,-s+g*p,c),new ae(l,-s+g*p,c)]});return h.jsx("group",{name:"Solar Panel Heatmap Lines Group",position:[0,0,.005],children:a.map((g,A)=>h.jsx(Gn,{name:"Solar Panel Lines",userData:{unintersectable:!0},points:g.points,lineWidth:.2},A))})},OZt=be.memo(({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>dt(hs)?h.jsx(YZt,{lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i}):null),F$e=be.memo(m.forwardRef(({lx:t,ly:e,relativeAzimuth:n},o)=>{const r=Math.max(5,Math.hypot(t,e)*.75),i=m.useMemo(()=>new Array(25).fill(0),[]),a=r3(hW,mN),l=r*.05,s={font:a,height:0,size:l},c=f=>f===0?-l*.3:f>0&&f<7?-l*.8:-l*1.2,[u,d]=m.useState(n);return m.useImperativeHandle(o,()=>({setAzimuth:f=>{f<-Math.PI?d(f+Math.PI*2):f>Math.PI?d(f-Math.PI*2):d(f)}})),h.jsxs("group",{rotation:[Qt,0,0],position:[0,0,.1],name:"Solar Panel Polar Grid Group",children:[h.jsx("polarGridHelper",{args:[r,24,6,120,"white","white"],userData:{unintersectable:!0}}),h.jsx(wG,{args:[r*.98,r,24,1,Qt,u],userData:{unintersectable:!0},rotation:[-Qt,0,0],children:h.jsx("meshBasicMaterial",{side:ti,color:"yellow"})}),h.jsx("group",{rotation:[0,u,0],children:h.jsx("mesh",{position:[-.5,0,-r*.9],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-ye.toDegrees(u).toFixed(1)}°`,s]})})}),i.map((f,p)=>{let g=Math.ceil(p/2)*(p%2===0?1:-1);g===-12&&(g=12);const A=c(Math.abs(g));return h.jsx("group",{rotation:[0,g*Math.PI/12,0],children:h.jsxs("mesh",{position:[A,0,-r*1.05],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*g}°`,s]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},p)})]})})),VZt=be.memo(m.forwardRef(({lx:t,ly:e,tiltAngle:n,modelLength:o,visiable:r},i)=>{const a=M(Cs),l=.75,s=(v,T)=>{const w=T*l,x=Math.cos(v),b=v/2,R=w*Math.sin(b)*2,H=b;return{cz:(w-T/2)*x+R*Math.sin(H),mountAngle:H,length:R}},{cz:c,mountAngle:u,length:d}=m.useMemo(()=>s(n,e),[n,e]),[f,p]=aC(t),[g,A]=aC(r),y=m.useMemo(()=>{const v=[];let w=Math.round(f/o)%2===0?o/2:0;for(;w({update(v,T){if(S.current&&C.current&&P.current){const{cz:w,mountAngle:x,length:b}=s(-v,T);S.current.position.y=-w,C.current.rotation.x=-x,P.current.position.z=b/2,P.current.scale.z=b-.025}},resizeX(v){p(v)},setVisiable(v){A(v)}}));const S=m.useRef(null),C=m.useRef(null),P=m.useRef(null);return g?h.jsx("group",{ref:S,position:[0,-c,0],castShadow:a,receiveShadow:a,children:h.jsx("group",{ref:C,rotation:[-u,0,0],children:h.jsx("group",{ref:P,position:[0,0,d/2],scale:[1,1,d-.025],children:y.map((v,T)=>h.jsx(si,{position:[v,0,0],args:[.05,.05,1],children:h.jsx("meshStandardMaterial",{color:"#BFBFBF"})},T))})})}):null}));var Aa=(t=>(t.Move="Move",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeHeight="ResizeHeight",t.Tilt="Tilt",t.None="None",t))(Aa||{}),nh=(t=>(t.Vertical="Vertical",t.Horizontal="Horizontal",t.Inclined="Inclined",t))(nh||{});const _Zt="Intersection Plane XY",AO=1,WSe=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,rotation:l,normal:s,relativeAzimuth:c,tiltAngle:u,parentType:d,drawSunBeam:f,trackerType:p=Ll.NO_TRACKER,pvModelName:g="SPR-X21-335-BLK",orientation:A=vr.landscape,poleHeight:y,poleRadius:S,poleSpacing:C,color:P="white",locked:v}=t,T=m.useMemo(()=>Pi.getPVModel(g),[g]),w=Math.max(T.thickness,.02),[x,b,R]=[i/2,a/2,w/2],H=Tc(e),{materialLx:F,materialLy:E,setMaterialSize:N}=z$e(i,a),{set:U,get:W,raycaster:k}=ri(),D=M(pn),[L,j]=m.useState(!1),[B,O]=m.useState(!1),[V,G]=m.useState(!1),q=m.useRef(null),$=m.useRef(null),ie=m.useRef(null),Q=m.useRef(null),se=m.useRef(null),Z=m.useRef(null),ee=m.useRef(null),te=m.useRef(null),oe=m.useRef(null),de=m.useRef(null),he=m.useRef(null),pe=m.useRef(null),me=m.useRef(null),le=m.useRef(null),Te=m.useRef(new ae),ge=m.useRef(new ae),Se=m.useRef(null),Re=m.useRef(null),De=m.useRef(null),Ae=m.useRef(null),ue=m.useRef(null),fe=m.useMemo(()=>Pi.getSurfaceType(d,new ae().fromArray(s)),[d,s]),ve=m.useMemo(()=>Pi.isTrackerEnabled(fe,p),[fe,p]),we=m.useMemo(()=>-b*Math.sin(Math.min(0,u)),[u,b]),Pe=m.useMemo(()=>{switch(fe){case"Horizontal":return R+y;case"Vertical":return R+we;case"Inclined":return R}},[y,R,fe,we]),Ie=m.useMemo(()=>H&&!v,[H,v]),Me=m.useMemo(()=>H&&fe==="Horizontal"&&!ve&&!v,[H,fe,p,ve,v]),ze=m.useMemo(()=>!H||ve||v?!1:fe==="Vertical"||fe==="Horizontal"&&y>0,[H,fe,y,ve,v]),Ne=m.useMemo(()=>y>0&&fe==="Horizontal",[y,fe]),Je=m.useMemo(()=>fe==="Vertical",[fe]),Ue=pt=>{U({frameloop:pt})},nt=()=>{if(!se.current)return;const[pt,Wt]=se.current.scale.toArray().map(ht=>ht/2);if(Z.current)for(const ht of Z.current.children)switch(ht.name){case Mt.Left:{ht.position.x=-pt;break}case Mt.Right:{ht.position.x=pt;break}case Mt.Upper:{ht.position.y=Wt;break}case Mt.Lower:{ht.position.y=-Wt;break}}if(ee.current)for(const ht of ee.current.children)switch(ht.name){case Di.Lower:{ht.position.y=-Wt-AO;break}case Di.Upper:{ht.position.y=Wt+AO;break}}},We=pt=>{if(!pt)return;const[Wt,ht,ct]=Pi.getRotationOnCuboid(pt);Ee(Wt,ht,ct),ye.isEqual(pt.z,1)?le.current!==null?ie.current.rotation.z=le.current-Hu.z:ie.current.rotation.z=c:ie.current.rotation.set(0,0,0)},Ee=(pt,Wt,ht)=>{q.current&&q.current.rotation.set(pt,Wt,ht,"ZXY"),oe.current&&oe.current.setRotationX(-pt)},ke=pt=>{ie.current&&(ie.current.position.z=pt),oe.current&&oe.current.setPositionZ(pt)},Oe=(pt,Wt)=>{Q.current&&(Q.current.rotation.x=pt),te.current&&te.current.update(pt,Wt),de.current&&de.current.update({tilt:pt}),me.current&&me.current.update(pt,a)},st=(pt,Wt)=>{const ht=kn.getState().solarPanelCountRef;ht&&ht.current&&(ht.current.textContent=`${Pi.getRackCount(A,pt,Wt,T.length,T.width)}`)},je=pt=>{pe.current&&pe.current.setAzimuth(pt)},xt=pt=>{me.current&&me.current.resizeX(Math.abs(pt))},gt=pt=>{me.current&&me.current.update(u,Math.abs(pt))},Ye=(pt,Wt,ht)=>{switch(ht){case"Move":{const ct=pt.intersectObjects(Wt.children);for(const It of ct){if(It.object.name===pX){const Ft=It.object.parent;return Ft?{intersection:It,parentGroup:Ft,parentType:z.Foundation}:null}if(It.object.name.includes(Eu.WALL_OUTSIDE_SURFACE_MESH_NAME)){const Ft=It.object.parent;return Ft?{intersection:It,parentGroup:Ft,parentType:z.Wall}:null}if(It.object.name.includes("Roof")){const Ft=Pi.findParentGroup(It.object,[pX]);return Ft?{intersection:It,parentGroup:Ft,parentType:z.Roof}:null}if(It.object.name.includes("Cuboid")){const Ft=Pi.findParentGroup(It.object,[Xv]);return Ft?{intersection:It,parentGroup:Ft,parentType:z.Cuboid}:null}}break}case"ResizeX":case"ResizeY":case"RotateLower":case"RotateUpper":{if(!B||!he.current||!ue.current)return null;const ct=pt.intersectObjects([he.current]),It=ct[0];return!It||ye.isEqual(It.point.z,0)?null:{intersection:ct[0],parentGroup:ue.current,parentType:d}}}return null},it=(pt,Wt)=>{const{length:ht,width:ct}=Pi.getUnitSize(A,T.length,T.width);return pt==="ResizeX"?(Wt-ht&&(Wt=ht),Math.round(Wt/ht)*ht):pt==="ResizeY"?(Wt-ct&&(Wt=ct),Math.round(Wt/ct)*ct):Wt},ut=(pt,Wt)=>{if(Wt==="ResizeX")return pt;{const ht=Math.abs(2*y/Math.sin(u));return ye.clamp(pt,-ht,ht)}},Qe=(pt,Wt,ht,ct)=>{var Ft;const It=Wt.children.find(Ve=>Ve.name===sde);if(It&&pt&&It!==pt){pt.children=pt.children.filter(ft=>ft!==q.current),It.children.push(q.current),q.current.parent=It;const Ve=(Ft=It.parent)==null?void 0:Ft.userData;if(Ve&&Ve.id&&Ve.fId&&(Se.current=Ve.id,Re.current=Ve.fId),ht===z.Roof){const ft=Pi.getRoofId(ct);ft&&(Se.current=ft)}}De.current=ht},lt=pt=>{pt.intersections.length==0||pt.intersections[0].object!==pt.object||(pt.stopPropagation(),pt.button===2?(M.getState().selectedElementIdSet.has(e)||Pi.setSelected(e,!0),D(Wt=>{Wt.contextMenuObjectType=z.SolarPanel})):Pi.setSelected(e,!0))},Ze=pt=>{if(!H||!q.current||!ie.current||pt.intersections.length==0||pt.intersections[0].object!==pt.object)return;Ue("always"),kn.getState().setEnableOrbitController(!1),Ae.current="Move";const Wt=Pi.findParentGroup(q.current,[Fm,Xv]);Wt&&(le.current=Hu.setFromQuaternion(Wt.getWorldQuaternion(yd.set(0,0,0,0))).z+c)},Be=pt=>{if(!(!H||!q.current||!ie.current)&&!(pt.intersections.length==0||pt.intersections[0].object!==pt.object)){switch(Ue("always"),kn.getState().setEnableOrbitController(!1),pt.object.name){case Mt.Left:case Mt.Right:{Ae.current="ResizeX";break}case Mt.Upper:case Mt.Lower:{Ae.current="ResizeY";break}}fe==="Horizontal"?(ie.current.localToWorld(Te.current.set(-pt.object.position.x,-pt.object.position.y*Math.abs(Math.cos(u)),-R-y)),q.current.getWorldPosition(ge.current).sub(Te.current).normalize()):(ie.current.localToWorld(Te.current.set(-pt.object.position.x,-pt.object.position.y,0)),ie.current.getWorldPosition(ge.current).sub(Te.current).normalize()),O(!0),ue.current=Pi.findParentGroup(q.current,[k$e,Fm,Xv])}},$e=pt=>{if(!(!ie.current||!ee.current)&&!(pt.intersections.length==0||pt.intersections[0].object!==pt.object)){switch(Ue("always"),kn.getState().setEnableOrbitController(!1),pt.eventObject.name){case Di.Upper:{Ae.current="RotateUpper";break}case Di.Lower:{Ae.current="RotateLower";break}}ie.current.getWorldPosition(Te.current),Te.current.z=0,O(!0),G(!0),ue.current=Pi.findParentGroup(q.current,[Fm,Xv])}},wt=pt=>{pt.intersections.length==0||pt.intersections[0].object!==pt.object||(Ae.current="Tilt",Ue("always"),kn.getState().setEnableOrbitController(!1),fe==="Vertical"?q.current.getWorldPosition(Te.current):ie.current.getWorldPosition(Te.current))},vt=pt=>{if(!ie.current||!Q.current||!te.current)return;const Wt=sl.subVectors(pt.point,Te.current),ht=ie.current.localToWorld(i9.set(0,-1,0)).sub(Te.current),ct=Wt.angleTo(ht),Ft=Math.sign(Qt-ct)*Wt.angleTo(ie.current.getWorldDirection(ade));if(fe==="Vertical"){const Ve=Ft>0?-Ft:Ft,ft=R-b*Math.sin(Ve);ke(ft),Oe(Ve,-ft)}else{const Ve=y>=b?Qt:Math.asin(y/b);Oe(ye.clamp(Ft,-Ve,Ve),0)}},Rt=m.useCallback(()=>{if(!Ae.current)return;const pt=M.getState().elements.find(ht=>ht.id===e);switch(Ae.current){case"Move":{D(ht=>{if(!q.current||!Ae.current)return;const ct=kn.getState().pointer;k.setFromCamera(ct,W().camera);const It=Ye(k,W().scene,Ae.current),Ft=ht.elements.find(Ve=>Ve.id===e);if(Ft)if(Ft.parentId!==Se.current&&Se.current&&Re.current&&(Ft.parentId=Se.current,Ft.foundationId=Re.current),De.current&&De.current!==Ft.parentType&&(Ft.parentType=De.current),Ft.parentType===z.Wall){const Ve=ht.elements.find(ft=>ft.id===Ft.parentId);Ve&&(Ft.cx=q.current.position.x/Ve.lx,Ft.cy=0,Ft.cz=q.current.position.z/Ve.lz,Ft.rotation=[Qt,0,0],Ft.normal=[0,-1,0])}else if(Ft.cx=q.current.position.x,Ft.cy=q.current.position.y,Ft.cz=q.current.position.z,le.current!==null&&(It!=null&&It.parentGroup)&&(Ft.relativeAzimuth=le.current-Hu.setFromQuaternion(It.parentGroup.getWorldQuaternion(yd.set(0,0,0,0))).z),It!=null&&It.intersection)if(Pi.getSurfaceType(It.parentType,It.intersection.normal)==="Horizontal")Ft.rotation=[0,0,0],Ft.normal=[0,0,1];else{const{x:ft,y:kt,z:rt}=q.current.rotation,at=sl.set(0,0,1).applyEuler(q.current.rotation);Ft.rotation=[ft,kt,rt],Ft.normal=[at.x,at.y,at.z]}else{const{x:Ve,y:ft,z:kt}=q.current.rotation,rt=sl.set(0,0,1).applyEuler(q.current.rotation);Ft.rotation=[Ve,ft,kt],Ft.normal=[rt.x,rt.y,rt.z]}});break}case"ResizeX":case"ResizeY":{D(ht=>{if(!se.current||!q.current)return;const ct=ht.elements.find(It=>It.id===e);if(ct)if(ct.lx=se.current.scale.x,ct.ly=se.current.scale.y,ct.parentType===z.Wall){const It=ht.elements.find(Ft=>Ft.id===ct.parentId);It&&(ct.cx=q.current.position.x/It.lx,ct.cy=0,ct.cz=q.current.position.z/It.lz)}else ct.parentType===z.Roof&&(ht.updateElementOnRoofFlag=!ht.updateElementOnRoofFlag),[ct.cx,ct.cy,ct.cz]=q.current.position});break}case"RotateLower":case"RotateUpper":{D(ht=>{if(!ie.current)return;const ct=ht.elements.find(Ft=>Ft.id===e);if(!ct)return;const It=Pi.getRelativeAzimuth(ie.current.rotation.z);ct.relativeAzimuth=It});break}case"Tilt":{D(ht=>{if(!Q.current)return;const ct=ht.elements.find(It=>It.id===e);ct&&(ct.tiltAngle=Q.current.rotation.x)});break}}const Wt=M.getState().elements.find(ht=>ht.id===e);pt&&Wt&&(Pi.isNewPositionOk(Wt)?Pi.addUndoable(pt,Ae.current):setTimeout(()=>{D(ht=>{const ct=ht.elements.findIndex(It=>It.id===e);ct!==-1&&(ht.elements[ct]=pt)})},10)),W().frameloop!=="demand"&&Ue("demand"),kn.getState().setEnableOrbitController(!0),Ae.current=null,le.current=null,Se.current=null,Re.current=null,De.current=null,ue.current=null,O(!1),G(!1)},[]);m.useEffect(()=>(window.addEventListener("pointerup",Rt),()=>window.removeEventListener("pointerup",Rt)),[Rt]),Z2(({camera:pt,scene:Wt,raycaster:ht})=>{if(!q.current||!ie.current||!H||!Ae.current||Ae.current==="Tilt")return;const ct=kn.getState().pointer;ht.setFromCamera(ct,pt);const It=Ye(ht,Wt,Ae.current);if(!It)return;const{intersection:Ft,parentGroup:Ve,parentType:ft}=It,kt=Ft.point;switch(Ae.current){case"Move":{if(!ft)break;switch(Qe(q.current.parent,Ve,ft,Ft.object),ft){case z.Foundation:{q.current.position.x=kt.x-Ve.position.x,q.current.position.y=kt.y-Ve.position.y,q.current.position.z=kt.z-Ve.position.z,q.current.position.applyEuler(Hu.set(0,0,-Ve.rotation.z)),Ee(0,0,0),le.current!==null?ie.current.rotation.z=le.current-Ve.rotation.z:ie.current.rotation.z=c;break}case z.Wall:{const at=Pi.findParentGroup(Ve,[Fm]);at&&(Ve.localToWorld(sl.set(0,0,0)),i9.set(0,0,0).subVectors(kt,sl).applyEuler(Hu.set(0,0,-at.rotation.z-Ve.rotation.z)),q.current.position.x=i9.x,q.current.position.y=0,q.current.position.z=i9.z,Ee(Qt,0,0),ie.current.rotation.set(0,0,0));break}case z.Roof:{const at=Pi.getRoofSegmentData(Ft.object);if(at){const{roofId:Ge,foundation:yt,centroid:Pt,roofSegments:ot}=at;if(yt&&Pt&&ot&&Ge){const bt=new ae().subVectors(kt,new ae(yt.cx,yt.cy,yt.cz)).applyEuler(new ln(0,0,-yt.rotation[2])),zt=bt.clone().sub(Pt),{normal:Bt,rotation:tt}=bn.computeState(ot,zt);q.current.position.x=bt.x,q.current.position.y=bt.y,q.current.position.z=bt.z,ye.isEqual(tt[0],0)?(Ee(0,0,0),le.current!==null?ie.current.rotation.set(0,0,le.current-Ve.rotation.z):ie.current.rotation.set(0,0,c)):(Ee(tt[0],tt[1],tt[2]),ie.current.rotation.set(0,0,0))}}break}case z.Cuboid:Ve.getWorldPosition(sl),Ve.getWorldQuaternion(yd),Hu.setFromQuaternion(yd),q.current.position.subVectors(kt,sl).applyQuaternion(yd.invert()),We(Ft.normal)}const rt=Pi.getSurfaceType(ft,Ft.normal);switch(rt==="Horizontal"?(de.current&&de.current.setVisiable(!0),me.current&&me.current.setVisiable(!1),ke(y+R)):(de.current&&de.current.setVisiable(!1),me.current&&me.current.setVisiable(!0),ke(R)),rt){case"Horizontal":{Oe(u,0);break}case"Vertical":{const at=Math.min(0,u),Ge=R-b*Math.sin(at);ke(Ge),Oe(at,-Ge);break}case"Inclined":{Oe(0,0);break}}Pi.isTrackerEnabled(rt,p)?(ie.current.rotation.set(0,0,0),Q.current.rotation.set(0,0,0),$.current.update(p,Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z)):$.current.reset();break}case"ResizeX":case"ResizeY":{const rt=Te.current,at=sl.subVectors(kt,rt),Ge=ge.current,yt=at.angleTo(Ge),Pt=at.length()*Math.cos(yt),ot=it(Ae.current,Pt);if(fe==="Vertical"){const bt=q.current.getWorldPosition(sl).sub(ie.current.getWorldPosition(i9)),zt=ade.copy(Ge).multiplyScalar(ot/2).add(rt).add(bt).sub(Ve.getWorldPosition(cX)).applyQuaternion(Ve.getWorldQuaternion(yd).invert());q.current.position.x=zt.x,q.current.position.z=zt.z,ft===z.Cuboid&&(q.current.position.y=zt.y),Ae.current==="ResizeX"?(se.current.scale.x=Math.abs(ot),xt(ot)):Ae.current==="ResizeY"&&(se.current.scale.y=Math.abs(ot),gt(ot),ft===z.Wall&&ke(Math.abs(ot/2*Math.sin(Math.min(0,u))))),N(Ae.current,ot)}else{const bt=ut(ot,Ae.current),zt=sl.copy(Ge).multiplyScalar(bt/2).add(rt).sub(Ve.getWorldPosition(cX)).applyQuaternion(Ve.getWorldQuaternion(yd).invert()),Bt=Math.abs(bt);Ae.current==="ResizeX"?(se.current.scale.x=Bt,de.current&&de.current.update({lx:Bt})):Ae.current==="ResizeY"&&(se.current.scale.y=Bt,de.current&&de.current.update({ly:Bt})),q.current.position.x=zt.x,q.current.position.y=zt.y,q.current.position.z=zt.z,N(Ae.current,bt)}nt(),st(se.current.scale.x,se.current.scale.y);break}case"RotateUpper":{sl.subVectors(kt,Te.current).setZ(0);let rt=sl.angleTo(i9.set(0,1,0));sl.x>0&&(rt=-rt),ie.current.rotation.z=rt-Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z,je(ie.current.rotation.z);break}case"RotateLower":{sl.subVectors(kt,Te.current).setZ(0);let rt=sl.angleTo(i9.set(0,-1,0));sl.x<0&&(rt=-rt),ie.current.rotation.z=rt-Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z,je(ie.current.rotation.z);break}}});const Gt=m.useMemo(()=>fe==="Horizontal"&&!ve?new ln(0,0,c,"ZXY"):new ln(0,0,0,"ZXY"),[fe,c,ve]),At=m.useMemo(()=>ve?new ln(0,0,0,"ZXY"):fe==="Horizontal"&&y>0?new ln(u,0,0,"ZXY"):fe==="Vertical"?new ln(Math.min(0,u),0,0,"ZXY"):new ln(0,0,0,"ZXY"),[y,fe,u,ve]);return h.jsxs("group",{name:`Ref_Solar_Panel_Group ${e}`,ref:q,position:[n,o,r],rotation:[l[0],l[1],l[2],"ZXY"],onPointerDown:lt,children:[h.jsxs("group",{name:"Top_Azimuth_Group",ref:ie,position:[0,0,Pe],rotation:Gt,children:[h.jsx(kZt,{ref:$,tiltAngle:u,trackerType:p,surfaceType:fe,children:h.jsxs("group",{name:"Top_Tilt_Group",ref:Q,rotation:At,children:[h.jsxs("group",{ref:se,scale:[i,a,w],children:[h.jsx(BZt,{onPointerOver:()=>j(!0),onPointerOut:()=>j(!1),children:h.jsx(LZt,{solarPanel:t,lx:F,ly:E})}),h.jsx(ta,{name:"Solar Panel Simulation Plane",uuid:e,userData:{simulation:!0},visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})})]}),H&&v&&h.jsx(NZt,{hlx:x,hly:b}),h.jsx(OZt,{lx:F,ly:E,lz:w,orientation:A,modelLength:T.length,modelWidth:T.width}),Ie&&h.jsxs(h.Fragment,{children:[h.jsx(E$e,{onPointerDown:Ze}),h.jsx(jZt,{ref:Z,hlx:x,hly:b,onPointerDown:Be})]}),f&&h.jsx(EZt,{})]})}),B&&h.jsx(ta,{name:_Zt,ref:he,args:[1e4,1e4],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Me&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:ee,children:[h.jsx(hX,{name:Di.Upper,positionY:b+AO,onPointerDown:$e}),h.jsx(hX,{name:Di.Lower,positionY:-b-AO,onPointerDown:$e})]}),ze&&h.jsx(DZt,{ref:te,tiltAngle:u,positionZ:-we,isOnVerticalSurface:fe==="Vertical",onPointerDown:wt,onPointerMove:vt}),h.jsx(WZt,{ref:de,lx:i,ly:a,tiltAngle:u,poleHeight:y,poleRadius:S,poleSpacing:C,color:P,visiable:Ne}),(L||t.showLabel)&&!H&&h.jsx(UZt,{solarPanel:t,boxRef:se})]}),f&&h.jsx(FZt,{ref:oe,topTiltGroupRef:Q,positionZ:Pe,rotationX:-l[0]}),h.jsx(VZt,{ref:me,tiltAngle:-u,lx:i,ly:a,modelLength:T.length,visiable:Je}),V&&h.jsx(F$e,{ref:pe,lx:i,ly:a,relativeAzimuth:c})]})}),sde="Solar_Panels_Wrapper_Group",Kye=be.memo(({parentId:t,foundationId:e,wrapperType:n,plx:o,ply:r,plz:i})=>{const a=m.useCallback(s=>{if(s.type!==z.SolarPanel)return!1;const c=s;switch(n){case z.Foundation:return c.foundationId===e&&(c.parentType===z.Foundation||c.parentType===z.Roof);case z.Cuboid:return c.foundationId===e&&c.parentType===z.Cuboid;case z.Wall:return s.parentId===t&&c.parentType===z.Wall}return!1},[t,e,n]),l=M(s=>s.elements.filter(a),cy);switch(n){case z.Foundation:case z.Cuboid:return h.jsx("group",{name:sde,children:l.map(s=>h.jsx(WSe,{...s},s.id))});case z.Wall:return h.jsx("group",{name:sde,children:l.map(s=>h.jsx(WSe,{...s,cx:s.cx*o,cz:s.cz*i},s.id))});default:return null}}),GZt=be.memo(({parentId:t,foundationId:e,parentLx:n,parentLz:o})=>{const r=a=>a.type!==z.BatteryStorage?!1:a.parentId===t;return M(a=>a.elements.filter(r),cy).map(a=>h.jsx(XZt,{...a,cx:a.cx*n,cz:a.cz*o},a.id))}),XZt=t=>{const{id:e,cx:n,cz:o,lx:r,ly:i,lz:a,color:l}=t,s=i/2,c=M(pn),u=Tc(e),d=f=>{f.intersections.length==0||f.intersections[0].object!==f.object||(f.stopPropagation(),Pi.setSelected(e,!0),f.button===2&&c(p=>{p.contextMenuObjectType=z.SolarPanel}))};return h.jsxs("group",{name:`Battery_Storag_Group ${e}`,position:[n,0,o],onPointerDown:d,children:[h.jsx(si,{args:[r,i,a],position:[0,-s,0],children:h.jsx("meshStandardMaterial",{color:l})}),u&&h.jsx(Ps,{args:[.2],position:[0,-i,0]})]})},k$e="Wall_Group",JZt=({wallModel:t,foundationModel:e})=>{const{id:n,roofId:o,cx:r,cy:i,lx:a,ly:l,lz:s,relativeAngle:c,fill:u,locked:d,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialHeight:g,rightTopPartialHeight:A,leftJoints:y,rightJoints:S,parentId:C}=t,P=Tc(n),[v,T]=[a/2,s/2],w=u===Fl.Partial,x=y.length>0?t.leftRoofHeight:s,b=S.length>0?t.rightRoofHeight:s,R=x??s,H=b??s,F=w?Math.min(R,g):R,E=w?Math.min(H,A):H,N=a===0,U=()=>u===Fl.Empty?h.jsx(fZt,{...t}):h.jsx(_en,{wallModel:t,foundationModel:e});return h.jsxs("group",{name:`${k$e} ${n}`,position:[r,i,T],rotation:[0,0,c],userData:{aabb:!0,id:n,fId:C},children:[h.jsx(Kye,{parentId:n,foundationId:C,wrapperType:z.Wall,plx:a,ply:l,plz:s}),h.jsx(GZt,{parentId:n,foundationId:C,parentLx:a,parentLz:s}),U(),P&&!d&&h.jsxs(h.Fragment,{children:[a>.5&&h.jsx(pZt,{ply:l,phz:T}),h.jsx(mZt,{id:n,parentLz:e.lz,roofId:o,absAngle:c+e.rotation[2],x:v,z:T,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialResizeHandleHeight:F,rightTopPartialResizeHandleHeight:E,fill:u,wallLeftHeight:R,wallRightHeight:H,highLight:N,leftJoints:y,rightJoints:S})]})]})},KZt=(t,e)=>t.wallModel===e.wallModel,qZt=be.memo(JZt,KZt),L$e="Building Group",$Zt=t=>{const{id:e,lx:n,ly:o,lz:r}=t,i=l=>l.foundationId!==e?!1:l.type===z.Wall||l.type===z.Roof||l.type===z.SolarPanel&&l.parentType===z.Roof||l.type===z.Window&&l.parentType===z.Roof,a=M(l=>l.elements.filter(i),cy);return a.length===0?null:h.jsx("group",{name:L$e,position:[0,0,r/2],children:a.map(l=>{switch(l.type){case z.Wall:return h.jsx(qZt,{wallModel:l,foundationModel:t},l.id);case z.Roof:return h.jsx(ZQt,{roofModel:l,foundationModel:t},l.id);case z.Window:return h.jsx(B$e,{...l,cz:l.cz},l.id);default:return null}})})},QZt=(t,e)=>t.lx===e.lx&&t.ly===e.ly&&t.lz===e.lz&&t.rotation===e.rotation,ZZt=be.memo($Zt,QZt),NSe=be.memo(({hx:t,hy:e,position:n,direction:o,color:r})=>{if(n===null)return null;const[i,a]=n,l=[];if(o==="x")l.push([-t,a,0]),l.push([t,a,0]);else if(o==="y")l.push([i,-e,0]),l.push([i,e,0]);else return o==="xy"?h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[[-t,a,0],[t,a,0]],color:r}),h.jsx(Gn,{points:[[i,-e,0],[i,e,0]],color:r})]}):null;return h.jsx(Gn,{points:l,color:r})});class Rv{static addUndoable(e,n){if(e)switch(n){case Aa.Move:{Rv.addUndoableMove(e);break}case Aa.ResizeX:{Rv.addUndoableResize(e,"X");break}case Aa.ResizeY:{Rv.addUndoableResize(e,"Y");break}case Aa.ResizeHeight:{Rv.addUndoablResizeHeight(e);break}case Aa.RotateLower:case Aa.RotateUpper:{Rv.addUndoableRotate(e);break}}}static addUndoableMove(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Move Water Heater",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new ae().fromArray(e.normal),newNormal:new ae().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};M.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{M.getState().set(f=>{const p=f.elements.find(g=>g.id===i);!p||p.type!==z.SolarWaterHeater||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e,n){const o=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!o)return;const r={name:`Resize Water Heater ${n}`,timestamp:Date.now(),id:o.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[o.cx,o.cy,o.cz],newDms:[o.lx,o.ly,o.lz],newRot:[...o.rotation],newNor:[...o.normal],undo(){M.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.oldPos],[a.lx,a.ly,a.lz]=[...r.oldDms],a.normal=[...r.oldNor],a.rotation=[...r.oldRot];break}})},redo(){M.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.newPos],[a.lx,a.ly,a.lz]=[...r.newDms],a.normal=[...r.newNor],a.rotation=[...r.newRot];break}})}};M.getState().addUndoable(r)}static addUndoablResizeHeight(e){const n=M.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarWaterHeater);if(!n)return;const o={name:"Resize Solar Water Heater Height",timestamp:Date.now(),changedElementId:n.id,oldValue:e.lz,newValue:n.lz,undo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.oldValue;break}})},redo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.newValue;break}})}};M.getState().addUndoable(o)}static addUndoableRotate(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Rotate Water Heater",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarWaterHeater,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarWaterHeater);l&&(l.relativeAzimuth=i)})}}}const een=be.memo(({waterTankLength:t,waterTankRadius:e,panelWidth:n})=>{const o=t/2,r=n/2,i=r+e;return h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-o,-r,0],[-o,i,0],[o,i,0],[o,-r,0],[-o,-r,0]],lineWidth:3,color:B0})}),ten=(t,e)=>{const[n,o]=m.useState(Jz),r=m.useMemo(()=>Math.max(1,Math.round(t/.15)),[t]);return m.useEffect(()=>{Jz&&(Jz.repeat.set(r,1),Jz.wrapS=bs,o(Jz.clone()))},[r]),n},nen=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,100];const e=t.getContext("2d");if(e){e.fillStyle="#A3A3A3",e.fillRect(0,0,100,15);const n=e.createLinearGradient(0,15,0,35);n.addColorStop(0,"#C0C0C0"),n.addColorStop(1,"#E0E0E0"),e.fillStyle=n,e.fillRect(0,15,100,20);const o=e.createLinearGradient(0,35,0,100);o.addColorStop(0,"#949494"),o.addColorStop(.6,"#464646"),o.addColorStop(.85,"#616161"),o.addColorStop(1,"#4B4B4B"),e.fillStyle=o,e.fillRect(0,35,100,65)}return new g8(t)},oen=()=>{const t=document.createElement("canvas");[t.width,t.height]=[130,100];const e=t.getContext("2d");if(e){e.fillStyle="#768ca6",e.fillRect(10,0,15,100);const n=e.createLinearGradient(25,0,45,0);n.addColorStop(0,"#7ea4cf"),n.addColorStop(1,"#9ab7d9"),e.fillStyle=n,e.fillRect(25,0,20,100);const o=e.createLinearGradient(45,0,110,0);o.addColorStop(0,"#6F87A1"),o.addColorStop(.6,"#30455B"),o.addColorStop(.85,"#496279"),o.addColorStop(1,"#3E536B"),e.fillStyle=o,e.fillRect(45,0,65,100)}return new g8(t)},Jz=oen(),eae=nen(),USe=be.memo(m.forwardRef(({id:t,lx:e,ly:n,side:o},r)=>{const{materialLx:i,materialLy:a,setMaterialSize:l}=z$e(e,n),s=dt(hs),c=M(Ju)??!1,u=M(vge),d=ten(i),f=D$e(t),p=()=>s&&f?h.jsx("meshBasicMaterial",{map:f,side:o}):d?c||u===0?h.jsx("meshStandardMaterial",{map:d,side:o,transparent:!0}):h.jsx("meshPhongMaterial",{specular:new rr(yG),shininess:u??rw,side:o,map:d,transparent:!0}):null;return m.useImperativeHandle(r,()=>({update(g,A){g!==void 0&&l(Aa.ResizeX,g),A!==void 0&&l(Aa.ResizeY,A)}})),h.jsx(h.Fragment,{children:p()})})),ren=()=>{const t=M(Ju)??!1,e=M(vge),n=()=>eae?t||e===0?h.jsx("meshStandardMaterial",{map:eae}):h.jsx("meshPhongMaterial",{specular:new rr(yG),shininess:e??rw,map:eae}):null;return h.jsx(h.Fragment,{children:n()})},ien=be.memo(({solarWaterHeater:t,groupRef:e})=>{const{label:n,locked:o,labelColor:r="white",labelFontSize:i=20,labelSize:a=.2,labelHeight:l=2}=t,s=$t(),[c,u]=m.useState("");return m.useEffect(()=>{if(!e.current)return;const{x:d,y:f,z:p}=e.current.getWorldPosition(sl);u((n??Y.t("shared.SolarWaterHeaterElement",s))+(o?" ("+Y.t("shared.ElementLocked",s)+")":"")+(n?"":` -`+Y.t("word.Coordinates",s)+": ("+d.toFixed(1)+", "+f.toFixed(1)+", "+p.toFixed(1)+") "+Y.t("word.MeterAbbreviation",s)))},[n,o,s]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:c,color:r,fontSize:i,textHeight:a,position:[0,0,l]})}),jSe="Mount Left",BSe="Mount Right",W$e=.3,aen=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l,waterTankRadius:s=W$e,rotation:c,normal:u,relativeAzimuth:d,parentType:f,locked:p,color:g="grey"}=t,A=Math.hypot(l-s,a),y=i+.25,S=l-s*2,C=Math.atan2(l-s,a),P=.5,v=m.useRef(null),T=m.useRef(null),w=m.useRef(null),x=m.useRef(null),b=m.useRef(new ae),R=m.useRef(new ae),H=m.useRef(null),F=m.useRef(null),E=m.useRef(null),N=m.useRef(null),U=m.useRef(null),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(null),j=m.useRef(null),B=m.useRef(null),O=m.useRef(null),V=m.useRef(null),G=m.useRef(null),q=m.useRef(null),$=m.useRef(null),ie=m.useRef(null),Q=m.useRef(null),se=m.useRef(null),Z=m.useRef(null),ee=M(Cs),te=dt(hs),[oe,de]=m.useState(!1),[he,pe]=m.useState(!1),[me,le]=m.useState(null),[Te,ge]=m.useState(!1),[Se,Re]=m.useState(!1),De=Tc(e),Ae=a5(),{set:ue,get:fe,raycaster:ve}=ri(),we=m.useMemo(()=>Pi.getSurfaceType(f,new ae().fromArray(u)),[f,u]),Pe=m.useMemo(()=>we===nh.Horizontal?new ln(0,0,d,"ZXY"):new ln(0,0,0,"ZXY"),[we,d]),Ie=m.useMemo(()=>De&&we===nh.Horizontal&&!p,[De,we,p]),Me=M(pn),ze=Ye=>{ue({frameloop:Ye})},Ne=(Ye,it,ut)=>{switch(ut){case Aa.Move:{const Qe=Ye.intersectObjects(it.children);for(const lt of Qe)if(lt.object.name.includes("Roof")){const Ze=Pi.findParentGroup(lt.object,[pX]);return Ze?{intersection:lt,parentGroup:Ze,parentType:z.Roof}:null}break}case Aa.ResizeX:case Aa.ResizeY:case Aa.RotateLower:case Aa.RotateUpper:{if(!oe||!V.current||!H.current)return null;const Qe=Ye.intersectObjects([V.current]),lt=Qe[0];return!lt||ye.isEqual(lt.point.z,0)?null:{intersection:Qe[0],parentGroup:H.current,parentType:f}}case Aa.ResizeHeight:{if(!he||!G.current||!H.current)return null;const Qe=Ye.intersectObjects([G.current]),lt=Qe[0];return!lt||ye.isEqual(lt.point.z,0)?null:{intersection:Qe[0],parentGroup:H.current,parentType:f}}}return null},Je=(Ye,it,ut)=>{F.current&&F.current.rotation.set(Ye,it,ut,"ZXY")},Ue=(Ye,it,ut,Qe)=>{var Ze;const lt=it.children.find(Be=>Be.name===N$e);if(lt&&Ye&<!==Ye){Ye.children=Ye.children.filter($e=>$e!==F.current),lt.children.push(F.current),F.current.parent=lt;const Be=(Ze=lt.parent)==null?void 0:Ze.userData;if(Be&&Be.id&&Be.fId&&(w.current=Be.id,x.current=Be.fId),ut===z.Roof){const $e=Pi.getRoofId(Qe);$e&&(w.current=$e)}}},nt=(Ye,it)=>{if(j.current&&Ye!==null){const ut=Ye/2;for(const Qe of j.current.children)switch(Qe.name){case Mt.Left:{Qe.position.x=-ut;break}case Mt.Right:{Qe.position.x=ut;break}}}if(B.current&&it!==null&&(B.current.position.y=-it/2),O.current&&it!==null)for(const ut of O.current.children)switch(ut.name){case Di.Lower:{ut.position.y=-it/2-P;break}case Di.Upper:{ut.position.y=it/2+s+P;break}}if(N.current&&it!==null&&(N.current.position.y=it/2),L.current&&Ye!==null&&(L.current.scale.y=Ye+.25),q.current&&Ye!==null)for(const ut of q.current.children)switch(ut.name){case jSe:{ut.position.x=-Ye*.4;break}case BSe:{ut.position.x=Ye*.4;break}}},We=Ye=>{$.current&&$.current.setAzimuth(Ye)},Ee=Ye=>{Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(Ye.stopPropagation(),Ye.button===2?(M.getState().selectedElementIdSet.has(e)||Pi.setSelected(e,!0),Me(it=>{it.contextMenuObjectType=z.SolarWaterHeater})):Pi.setSelected(e,!0))},ke=Ye=>{if(!De||!F.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)return;ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.Move;const it=Pi.findParentGroup(F.current,[Fm]);it&&(T.current=Hu.setFromQuaternion(it.getWorldQuaternion(yd.set(0,0,0,0))).z+d)},Oe=Ye=>{if(!(!De||!F.current||!E.current)&&!(Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)){switch(ze("always"),kn.getState().setEnableOrbitController(!1),Ye.object.name){case Mt.Left:case Mt.Right:{v.current=Aa.ResizeX;break}case Mt.Upper:case Mt.Lower:{v.current=Aa.ResizeY;break}}we===nh.Horizontal?(E.current.localToWorld(b.current.set(-Ye.object.position.x,-Ye.object.position.y,0)),F.current.getWorldPosition(R.current).sub(b.current).normalize()):(E.current.localToWorld(b.current.set(-Ye.object.position.x,-Ye.object.position.y,0)),E.current.getWorldPosition(R.current).sub(b.current).normalize()),de(!0),le(S/2),H.current=Pi.findParentGroup(F.current,[Fm])}},st=Ye=>{!De||!F.current||!N.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.ResizeY,we===nh.Horizontal?(N.current.localToWorld(b.current.set(0,0,0)),F.current.getWorldPosition(R.current).sub(b.current).normalize()):(E.current.localToWorld(b.current.set(0,0,0)),E.current.getWorldPosition(R.current).sub(b.current).normalize()),de(!0),le(0),H.current=Pi.findParentGroup(F.current,[Fm]))},je=Ye=>{!De||!F.current||!E.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.ResizeHeight,H.current=Pi.findParentGroup(F.current,[Fm]),pe(!0),setTimeout(()=>{if(G.current){const it=fe().camera.position;Ye.intersections[0].object.localToWorld(sl.set(0,0,-l)),G.current.lookAt(it.x,it.y,sl.z),Ye.intersections[0].object.localToWorld(b.current.set(0,0,-l)),setTimeout(()=>{G.current.userData.state=!0},10)}},0))},xt=Ye=>{if(!(!E.current||!O.current)&&!(Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)){switch(ze("always"),kn.getState().setEnableOrbitController(!1),Ye.eventObject.name){case Di.Upper:{v.current=Aa.RotateUpper;break}case Di.Lower:{v.current=Aa.RotateLower;break}}E.current.getWorldPosition(b.current),b.current.z=0,de(!0),le(S/2),Re(!0),H.current=Pi.findParentGroup(F.current,[Fm])}},gt=m.useCallback(()=>{if(!v.current)return;const Ye=M.getState().elements.find(ut=>ut.id===e);switch(v.current){case Aa.Move:{Me(ut=>{if(!F.current||!v.current)return;const Qe=kn.getState().pointer;ve.setFromCamera(Qe,fe().camera);const lt=Ne(ve,fe().scene,v.current),Ze=ut.elements.find(Be=>Be.id===e);if(Ze)if(Ze.parentId!==w.current&&w.current&&x.current&&(Ze.parentId=w.current,Ze.foundationId=x.current),Ze.cx=F.current.position.x,Ze.cy=F.current.position.y,Ze.cz=F.current.position.z,T.current!==null&&(lt!=null&<.parentGroup)&&(Ze.relativeAzimuth=T.current-Hu.setFromQuaternion(lt.parentGroup.getWorldQuaternion(yd.set(0,0,0,0))).z),lt!=null&<.intersection)if(Pi.getSurfaceType(lt.parentType,lt.intersection.normal)===nh.Horizontal)Ze.rotation=[0,0,0],Ze.normal=[0,0,1];else{const{x:$e,y:wt,z:vt}=F.current.rotation,Rt=sl.set(0,0,1).applyEuler(F.current.rotation);Ze.rotation=[$e,wt,vt],Ze.normal=[Rt.x,Rt.y,Rt.z]}else{const{x:Be,y:$e,z:wt}=F.current.rotation,vt=sl.set(0,0,1).applyEuler(F.current.rotation);Ze.rotation=[Be,$e,wt],Ze.normal=[vt.x,vt.y,vt.z]}});break}case Aa.ResizeX:{Me(ut=>{if(!D.current||!F.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.lx=D.current.scale.x,Qe.parentType===z.Roof&&(ut.updateElementOnRoofFlag=!ut.updateElementOnRoofFlag),[Qe.cx,Qe.cy,Qe.cz]=F.current.position)});break}case Aa.ResizeY:{Me(ut=>{if(!D.current||!N.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.ly=N.current.position.y*2,Qe.parentType===z.Roof&&(ut.updateElementOnRoofFlag=!ut.updateElementOnRoofFlag),[Qe.cx,Qe.cy,Qe.cz]=F.current.position)});break}case Aa.ResizeHeight:{Me(ut=>{if(!U.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.lz=U.current.position.z+s)});break}case Aa.RotateLower:case Aa.RotateUpper:{Me(ut=>{if(!E.current)return;const Qe=ut.elements.find(Ze=>Ze.id===e);if(!Qe)return;const lt=Pi.getRelativeAzimuth(E.current.rotation.z);Qe.relativeAzimuth=lt});break}}const it=M.getState().elements.find(ut=>ut.id===e);Ye&&it&&(Pi.isNewPositionOk(it)?Rv.addUndoable(Ye,v.current):setTimeout(()=>{Me(ut=>{const Qe=ut.elements.findIndex(lt=>lt.id===e);Qe!==-1&&(ut.elements[Qe]=Ye)})},10)),fe().frameloop!=="demand"&&ze("demand"),kn.getState().setEnableOrbitController(!0),v.current=null,T.current=null,w.current=null,x.current=null,H.current=null,de(!1),le(null),pe(!1),Re(!1)},[]);return m.useEffect(()=>(window.addEventListener("pointerup",gt),()=>window.removeEventListener("pointerup",gt)),[gt]),Z2(({camera:Ye,scene:it,raycaster:ut})=>{if(!F.current||!E.current||!De||!v.current)return;const Qe=kn.getState().pointer;ut.setFromCamera(Qe,Ye);const lt=Ne(ut,it,v.current);if(!lt)return;const{intersection:Ze,parentGroup:Be,parentType:$e}=lt,wt=Ze.point;switch(v.current){case Aa.Move:{if(!$e)break;switch(Ue(F.current.parent,Be,$e,Ze.object),$e){case z.Roof:{const vt=Pi.getRoofSegmentData(Ze.object);if(vt){const{roofId:Rt,foundation:Gt,centroid:At,roofSegments:pt}=vt;if(Gt&&At&&pt&&Rt){const Wt=new ae().subVectors(wt,new ae(Gt.cx,Gt.cy,Gt.cz)).applyEuler(new ln(0,0,-Gt.rotation[2])),ht=Wt.clone().sub(At),{normal:ct,rotation:It}=bn.computeState(pt,ht);F.current.position.x=Wt.x,F.current.position.y=Wt.y,F.current.position.z=Wt.z,ye.isEqual(It[0],0)?(Je(0,0,0),T.current!==null?E.current.rotation.set(0,0,T.current-Be.rotation.z):E.current.rotation.set(0,0,d)):(Je(It[0],It[1],It[2]),E.current.rotation.set(0,0,0))}}break}}break}case Aa.ResizeX:{const vt=b.current,Rt=sl.subVectors(wt,vt),Gt=R.current,At=Rt.angleTo(Gt),pt=Rt.length()*Math.cos(At);if(we!==nh.Vertical){const Wt=sl.copy(Gt).multiplyScalar(pt/2).add(vt).sub(Be.getWorldPosition(cX)).applyQuaternion(Be.getWorldQuaternion(yd).invert()),ht=Math.abs(pt);D.current.scale.x=ht,F.current.position.x=Wt.x,F.current.position.y=Wt.y,F.current.position.z=Wt.z,se.current&&se.current.update(D.current.scale.x),nt(ht,null)}break}case Aa.ResizeY:{const vt=b.current,Rt=sl.subVectors(wt,vt),Gt=R.current,At=Rt.angleTo(Gt),pt=Math.cos(At)>0?Rt.length()*Math.cos(At):.1;if(we!==nh.Vertical){const Wt=l-s,ht=Math.hypot(pt,Wt),ct=Math.asin(Wt/ht),It=sl.copy(Gt).multiplyScalar(pt/2).add(vt).sub(Be.getWorldPosition(cX)).applyQuaternion(Be.getWorldQuaternion(yd).invert());F.current.position.x=It.x,F.current.position.y=It.y,W.current.rotation.x=ct,k.current.position.y=-ht/2,D.current.scale.y=ht,nt(null,pt)}break}case Aa.RotateUpper:{sl.subVectors(wt,b.current).setZ(0);let vt=sl.angleTo(i9.set(0,1,0));sl.x>0&&(vt=-vt),E.current.rotation.z=vt-Hu.setFromQuaternion(Be.getWorldQuaternion(yd)).z,We(E.current.rotation.z);break}case Aa.RotateLower:{sl.subVectors(wt,b.current).setZ(0);let vt=sl.angleTo(i9.set(0,-1,0));sl.x<0&&(vt=-vt),E.current.rotation.z=vt-Hu.setFromQuaternion(Be.getWorldQuaternion(yd)).z,We(E.current.rotation.z);break}case Aa.ResizeHeight:{if(G.current.userData.state&&U.current){const vt=Math.max(wt.z-b.current.z,s*2),Rt=vt-s,Gt=vt-s*2,At=Math.hypot(Rt,a);U.current.position.z=Rt,W.current&&q.current&&(q.current.scale.y=Gt,q.current.position.z=Gt/2,W.current.rotation.x=Math.asin(Rt/At),k.current.position.y=-At/2,D.current.scale.y=At,O.current&&(O.current.position.z=Gt/2))}break}}}),h.jsxs("group",{ref:F,position:[n,o,r],rotation:[c[0],c[1],c[2],"ZXY"],onPointerDown:Ee,onPointerOver:()=>ge(!0),onPointerOut:()=>ge(!1),children:[h.jsxs("group",{ref:E,rotation:Pe,children:[h.jsxs("group",{ref:N,position:[0,a/2,0],children:[h.jsxs("group",{ref:U,position:[0,0,s+S],children:[h.jsxs("group",{ref:Q,children:[h.jsx(ma,{ref:L,args:[s,s,1],castShadow:ee&&!te,receiveShadow:ee&&!te,rotation:[0,0,Qt],scale:[1,y,1],children:h.jsx("meshStandardMaterial",{color:g,roughness:.2})}),De&&h.jsx(si,{ref:ie,args:[Ae,.1,Ae],position:[0,0,s],onPointerDown:je,children:h.jsx("meshBasicMaterial",{color:"white"})})]}),h.jsx("group",{ref:W,rotation:[C,0,0],children:h.jsxs("group",{ref:k,position:[0,-A/2,0],children:[h.jsxs("group",{ref:D,scale:[i,A,1],children:[h.jsx(ta,{castShadow:!1,receiveShadow:ee,children:h.jsx(USe,{ref:se,id:e,lx:i,ly:a,side:Da})}),!te&&h.jsx(ta,{receiveShadow:ee,position:[0,-.475,.001],args:[1,.05],children:h.jsx(ren,{})}),ee&&h.jsx(ta,{castShadow:ee,receiveShadow:!1,position:[0,0,-.05],children:h.jsx(USe,{ref:Z,id:e,lx:i,ly:a,side:r0})}),h.jsx(ta,{name:"Water Heater Simulation Plane",uuid:e,userData:{simulation:!0},position:[0,0,.001],visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})})]}),De&&!p&&h.jsxs(h.Fragment,{children:[h.jsx(E$e,{onPointerDown:ke}),h.jsxs("group",{name:"X_Resize_Handles_Group",ref:j,onPointerDown:Oe,children:[h.jsx(Jv,{cx:i/2,cy:0,type:Mt.Right,size:Ae}),h.jsx(Jv,{cx:-i/2,cy:0,type:Mt.Left,size:Ae})]})]}),De&&p&&h.jsx(een,{waterTankLength:y,waterTankRadius:s,panelWidth:A})]})})]}),h.jsxs("group",{ref:q,position:[0,0,S/2],rotation:[Qt,0,0],scale:[1,S+.1,1],children:[h.jsx(ma,{name:jSe,args:[.05,.05,1],position:[-i*.4,0,0],castShadow:ee,children:h.jsx("meshStandardMaterial",{color:"grey"})}),h.jsx(ma,{name:BSe,args:[.05,.05,1],position:[i*.4,0,0],castShadow:ee,children:h.jsx("meshStandardMaterial",{color:"grey"})})]}),he&&h.jsx(ta,{ref:G,args:[1e4,1e4],rotation:[Qt,0,0,"ZXY"],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})})]}),De&&!p&&h.jsx("group",{name:"Y_Resize_Handles_Group",ref:B,position:[0,-a/2,0],onPointerDown:st,children:h.jsx(Jv,{cx:0,cy:0,type:Mt.Lower,size:Ae})}),Ie&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:O,position:[0,0,S/2],children:[h.jsx(hX,{name:Di.Upper,positionY:a/2+s+P,onPointerDown:xt}),h.jsx(hX,{name:Di.Lower,positionY:-a/2-P,onPointerDown:xt})]}),(Te||t.showLabel)&&!De&&h.jsx(ien,{solarWaterHeater:t,groupRef:F})]}),oe&&me!==null&&h.jsx(ta,{ref:V,args:[1e4,1e4],position:[0,0,me],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Se&&h.jsx(F$e,{ref:$,lx:i,ly:a,relativeAzimuth:d})]})}),N$e="Water_Heater_Wrapper_Group",len=be.memo(({foundationId:t,wrapperType:e})=>{const n=m.useCallback(r=>{if(r.type!==z.SolarWaterHeater)return!1;const i=r;switch(e){case z.Foundation:return i.foundationId===t&&i.parentType===z.Roof;case z.Cuboid:case z.Wall:}return!1},[t,e]),o=M(r=>r.elements.filter(n),cy);switch(e){case z.Foundation:return h.jsx("group",{name:N$e,children:o.map(r=>h.jsx(aen,{...r},r.id))});default:return null}}),Fm="Foundation_Group",pX="Foundation",sen=be.memo(t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=.1,rotation:l=[0,0,0],color:s="gray",lineColor:c="black",lineWidth:u=.2,locked:d=!1,showLabel:f=!1,textureType:p=_i.NoTexture,solarStructure:g}=t,A=Tc(e),y=M(m0),S=M(Ju),C=M(Jn),P=M(Db),v=M(pn),T=M(u3),w=M(Uge),x=M(d3),b=M(Fw),R=M(Qge),H=M(Zge),F=M(wxt),E=M(Qq),N=M(hYe),U=M(kw),W=M(YYe),k=M(OYe),D=M(Ap),L=M(pu),j=M(_ge),B=M(t5),O=M(fxt),V=M(Axt),G=M(Cs),q=M(mA),$=M(r$),ie=M(En),Q=M(qge),se=M(Nge),Z=M(ly),ee=dt(hs),te=M(Pf),oe=M(xge),de=Cn(c1),{camera:he,gl:{domElement:pe}}=ri(),[me,le]=m.useState(!1),[Te,ge]=m.useState(null),[Se,Re]=m.useState(!1),[De,Ae]=m.useState({show:!1,direction:null,position:null}),[ue,fe]=m.useState([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]),ve=m.useRef(null),we=m.useRef(!1),Pe=m.useRef(!1),Ie=m.useRef(null),Me=m.useRef(Jr.null),ze=m.useRef(new Map),Ne=m.useRef(null),Je=m.useRef(null),Ue=m.useRef(null),nt=m.useRef(null),We=m.useRef(null),Ee=m.useRef(null),ke=m.useRef(null),Oe=m.useRef(null),st=m.useRef(null),je=m.useRef(null),xt=m.useRef(null),gt=m.useRef(null),Ye=m.useRef(new ae),it=m.useRef(new ae),ut=m.useRef(new ae(1,1,1)),Qe=m.useRef(new ae(1,1,1)),lt=m.useRef(0),Ze=m.useRef(0),Be=m.useRef([]),$e=m.useRef([]),wt=m.useRef([]),vt=m.useRef([]),Rt=m.useRef([]),Gt=m.useRef([]),At=m.useMemo(()=>({lng:y}),[y]),pt=m.useMemo(()=>new Kt,[]),Wt=m.useMemo(()=>new l0,[]),ht=r/2,ct=i/2,It=a/2,Ft=m.useMemo(()=>new ae(-ht,-ct,It),[ht,ct,It]),Ve=m.useMemo(()=>new ae(-ht,ct,It),[ht,ct,It]),ft=m.useMemo(()=>new ae(ht,-ct,It),[ht,ct,It]),kt=m.useMemo(()=>new ae(ht,ct,It),[ht,ct,It]),rt=a5(),at=rt,Ge=rt,yt=rt*4,Pt=ct+yt,ot=m.useRef(!1),bt=m.useRef(null),zt=M(pxt),Bt=M(POe),tt=m.useMemo(()=>new ae,[]);if(Ue.current){let fn=-1;switch(Ue.current.type){case z.SolarPanel:{fn=Ue.current.poleHeight;break}case z.ParabolicTrough:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2;break}case z.ParabolicDish:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2+tn.lx*tn.lx/(4*tn.latusRectum);break}case z.FresnelReflector:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2;break}}fn>=0&&tt.set(0,0,(t==null?void 0:t.lz)/2+fn)}m.useEffect(()=>{ze.current.clear();for(const fn of M.getState().elements)fn.type===z.Wall&&fn.parentId===e&&ze.current.set(fn.id,fn)},[e,V]),m.useEffect(()=>{O&&O===ve.current&&(ze.current.delete(O),we.current=!1,Pe.current=!1,ve.current=null,v(fn=>{fn.addedWallId===fn.deletedWallId&&(fn.addedWallId=null),fn.deletedWallId=null}),kn.getState().setEnableOrbitController(!0),Ae({show:!1,direction:null,position:null}),fe([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]))},[O]),m.useEffect(()=>{if(t&&ee){const fn=de(t.id);ge(fn?ye.fetchHeatmapTexture(fn,te??5):null)}},[ee,te,oe]),m.useEffect(()=>{!ot.current||!M.getState().getAutoDeletedElements()||Ht()},[zt,Bt]);const Ht=k2.debounce(()=>{if(!bt.current)return;const fn=M.getState().getAutoDeletedElements();if(!fn)return;const{wall:tn,newAngle:Ot,newJoints:mn}=bt.current,Hn={name:"Move Wall",timestamp:Date.now(),id:tn.id,oldPoints:[[...Rt.current[0]],[...Rt.current[1]]],newPoints:[[...tn.leftPoint],[...tn.rightPoint]],oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...mn[0]],[...mn[1]]],oldAngle:lt.current,newAngle:Ot,flippedWallSide:Me.current,autoDeletedElements:[...fn],undo(){switch(this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Yt=C(this.newJoints[0][0]);Yt&&ir(Yt);break}case Jr.right:{const Yt=C(this.newJoints[1][0]);Yt&&Rr(Yt);break}}const[qe,Ct]=this.oldJoints,[Nt,Tt]=this.newJoints;v(Yt=>{for(const Zt of Yt.elements)if(Zt.id===this.id){const[cn,yn]=this.oldPoints;Zt.cx=(cn[0]+yn[0])/2,Zt.cy=(cn[1]+yn[1])/2,Zt.lx=Math.hypot(cn[0]-yn[0],cn[1]-yn[1]);const An=Zt;An.relativeAngle=this.oldAngle,An.leftPoint=[...cn],An.rightPoint=[...yn],An.leftJoints=[...qe],An.rightJoints=[...Ct];break}Yt.resizeHandleType=null,Yt.elements.push(...this.autoDeletedElements),Yt.deletedRoofId=null,Yt.autoDeletedChild=null,Yt.autoDeletedRoofs=null,Yt.autoDeletedRoofIdSet.clear()}),qe[0]!==Nt[0]&&v(Yt=>{for(const Zt of Yt.elements)Zt.type===z.Wall&&(Zt.id===qe[0]&&(Zt.rightJoints=[this.id]),Zt.id===Nt[0]&&(this.flippedWallSide!==Jr.left?Zt.rightJoints=[]:Zt.leftJoints=[]))}),Ct[0]!==Tt[0]&&v(Yt=>{for(const Zt of Yt.elements)Zt.type===z.Wall&&(Zt.id===Ct[0]&&(Zt.leftJoints=[this.id]),Zt.id===Tt[0]&&(this.flippedWallSide!==Jr.right?Zt.leftJoints=[]:Zt.rightJoints=[]))}),Me.current=Jr.null},redo(){const[qe,Ct]=this.oldJoints,[Nt,Tt]=this.newJoints;switch(v(Zt=>{for(const cn of Zt.elements)if(cn.id===this.id&&cn.type===z.Wall){const[yn,An]=this.newPoints;cn.cx=(yn[0]+An[0])/2,cn.cy=(yn[1]+An[1])/2,cn.lx=Math.hypot(yn[0]-An[0],yn[1]-An[1]);const Tn=cn;Tn.relativeAngle=this.newAngle,Tn.leftPoint=[...yn],Tn.rightPoint=[...An],Tn.leftJoints=[...Nt],Tn.rightJoints=[...Tt];break}}),qe[0]!==Nt[0]&&v(Zt=>{for(const cn of Zt.elements)cn.type===z.Wall&&(cn.id===qe[0]&&(cn.rightJoints=[]),cn.id===Nt[0]&&(this.flippedWallSide===Jr.right?cn.leftJoints=[this.id]:cn.rightJoints=[this.id]))}),Ct[0]!==Tt[0]&&v(Zt=>{for(const cn of Zt.elements)cn.type===z.Wall&&(cn.id===Ct[0]&&(cn.leftJoints=[]),cn.id===Tt[0]&&(this.flippedWallSide===Jr.right?cn.rightJoints=[this.id]:cn.leftJoints=[this.id]))}),this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Zt=C(this.newJoints[0][0]);Zt&&Rr(Zt);break}case Jr.right:{const Zt=C(this.newJoints[1][0]);Zt&&ir(Zt);break}}const Yt=new Set(this.autoDeletedElements.map(Zt=>Zt.id));v(Zt=>{Zt.resizeHandleType=null,Zt.elements=Zt.elements.filter(yn=>!Yt.has(yn.id));const cn=this.autoDeletedElements.find(yn=>yn.type===z.Roof);cn&&(Zt.deletedRoofId=cn.id)}),Me.current=Jr.null}};ie(Hn),ot.current=!1,v(qe=>{qe.autoDeletedRoofs=null,qe.autoDeletedRoofIdSet.clear(),qe.autoDeletedChild=null})},100),_t=fn=>{pt.x=fn.offsetX/pe.clientWidth*2-1,pt.y=-(fn.offsetY/pe.clientHeight)*2+1,Wt.setFromCamera(pt,he)},qt=fn=>{switch(fn){case _i.Texture01:return{x:1,y:1};case _i.Texture02:return{x:2,y:2};case _i.Texture03:return{x:.4,y:.4};case _i.Texture04:return{x:.25,y:.25};case _i.Texture05:return{x:5,y:5};case _i.Texture06:return{x:1,y:1};case _i.Texture07:return{x:1,y:1};default:return{x:1,y:1}}},un=m.useMemo(()=>{let fn;switch(p){case _i.Texture01:fn=w$e;break;case _i.Texture02:fn=v$e;break;case _i.Texture03:fn=x$e;break;case _i.Texture04:fn=b$e;break;case _i.Texture05:fn=S$e;break;case _i.Texture06:fn=T$e;break;case _i.Texture07:fn=P$e;break;default:fn=og}return new cf().load(fn,tn=>{tn.wrapS=tn.wrapT=bs;const Ot=qt(p);tn.repeat.set(r/Ot.x,i/Ot.y),yo(tn)})},[p,r,i]),[Rn,yo]=m.useState(un),Ao=m.useCallback((fn,tn)=>{dt.getState().duringCameraInteraction||fn.intersections.length>0&&(fn.intersections[0].object===fn.eventObject||fn.intersections.length>1&&fn.intersections[1].object===fn.eventObject)&&(v(mn=>{mn.hoveredHandle=tn}),ye.isMoveHandle(tn)?pe.style.cursor="move":tn===Di.Lower||tn===Di.Upper?pe.style.cursor="grab":pe.style.cursor=M.getState().addedFoundationId?"crosshair":"pointer")},[]),wo=m.useCallback(()=>{v(fn=>{fn.hoveredHandle=null}),pe.style.cursor=M.getState().addedFoundationId?"crosshair":"default"},[]),Io=fn=>{switch(fn){case z.Human:case z.Tree:case z.Flower:case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Wall:return!0;default:return!1}},po=(fn,tn)=>{let Ot=tn,mn=null,Hn=null,qe=null,Ct;if(!M.getState().enableFineGrid)for(const[Nt,Tt]of ze.current){if(Nt===ve.current||Ue.current&&Nt===Ue.current.id)continue;const Yt=new ae(Tt.leftPoint[0],Tt.leftPoint[1],0),Zt=new ae(Tt.rightPoint[0],Tt.rightPoint[1],0),cn=(Yt==null?void 0:Yt.distanceTo(fn))??Number.MAX_VALUE,yn=(Zt==null?void 0:Zt.distanceTo(fn))??Number.MAX_VALUE,An=cn<=yn,Tn=An?cn:yn,Ln=An?Yt:Zt;Tn<=Ot+.01&&(Ot=Tn,mn=Ln,Ct=An?Tt.leftJoints[0]:Tt.rightJoints[0],Hn=Nt,qe=An?V1.Left:V1.Right)}return{id:Hn,point:mn,side:qe,jointId:Ct}},On=(fn,tn)=>(M.getState().enableFineGrid?(fn=ye.snapToFineGrid(fn),tn=null):tn?fn=tn:fn=ye.snapToNormalGrid(fn),fn),fo=fn=>{ze.current.clear();for(const Ot of M.getState().elements)Ot.type===z.Wall&&Ot.parentId===e&&ze.current.set(Ot.id,Ot);let tn=ze.current.get(fn);for(;tn&&tn.leftJoints.length>0;){const Ot=ze.current.get(tn.id);if(!Ot||(v(mn=>{for(const Hn of mn.elements)if(Hn.id===Ot.id){const qe=Hn;qe.relativeAngle=(Ot.relativeAngle+Math.PI)%sa,qe.leftPoint=[...Ot.rightPoint],qe.rightPoint=[...Ot.leftPoint],qe.leftJoints=[Ot.rightJoints[0]],qe.rightJoints=[Ot.leftJoints[0]];break}}),tn=ze.current.get(tn.leftJoints[0]),tn&&tn.id===fn))break}v(Ot=>{Ot.updateWallMapOnFoundationFlag=!Ot.updateWallMapOnFoundationFlag,M.getState().resizeHandleType&&(Ot.resizeHandleType=M.getState().resizeHandleType===Mt.LowerLeft?Mt.LowerRight:Mt.LowerLeft)}),Me.current=Me.current===Jr.null?Jr.loop:Jr.null},ir=(fn,tn)=>{ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);const Ot=fn;let mn=fn;for(;mn;){const Hn=ze.current.get(mn.id);if(!Hn)break;v(Ct=>{for(const Nt of Ct.elements)if(Hn&&Nt.id===Hn.id){const Tt=Nt;Tt.relativeAngle=(Hn.relativeAngle+Math.PI)%sa,Tt.leftPoint=[...Hn.rightPoint],Tt.rightPoint=[...Hn.leftPoint],Tt.leftJoints=Hn.rightJoints.length>0?[Hn.rightJoints[0]]:[],Tt.rightJoints=Hn.leftJoints.length>0?[Hn.leftJoints[0]]:[];break}});let qe;if(Hn.leftJoints.length>0&&(qe=ze.current.get(Hn.leftJoints[0])),qe&&qe.id!==Ot.id)mn=qe;else break}v(Hn=>{if(tn)for(const qe of Hn.elements)qe.type===z.Wall&&(qe.id===Ot.id&&(qe.leftJoints=[tn.id]),qe.id===tn.id&&(qe.rightJoints=[Ot.id]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag,Hn.resizeHandleType=Mt.LowerLeft}),Me.current=Me.current===Jr.null?Jr.right:Jr.null},Rr=(fn,tn)=>{ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);const Ot=fn;let mn=fn;for(;mn;){const Hn=ze.current.get(mn.id);if(!Hn)break;v(Ct=>{for(const Nt of Ct.elements)if(Hn&&Nt.id===Hn.id){const Tt=Nt;Tt.relativeAngle=(Hn.relativeAngle+Math.PI)%sa,Tt.leftPoint=[...Hn.rightPoint],Tt.rightPoint=[...Hn.leftPoint],Tt.leftJoints=Hn.rightJoints.length>0?[Hn.rightJoints[0]]:[],Tt.rightJoints=Hn.leftJoints.length>0?[Hn.leftJoints[0]]:[];break}});let qe;if(Hn.rightJoints.length>0&&(qe=ze.current.get(Hn.rightJoints[0])),qe&&qe.id!==Ot.id)mn=qe;else break}v(Hn=>{if(tn)for(const qe of Hn.elements)qe.type===z.Wall&&(qe.id===Ot.id&&(qe.rightJoints=[tn.id]),qe.id===tn.id&&(qe.leftJoints=[Ot.id]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag,Hn.resizeHandleType=Mt.LowerRight}),Me.current=Me.current===Jr.null?Jr.left:Jr.null},br=fn=>{let tn;ze.current.clear();for(const mn of M.getState().elements)mn.id===fn&&(tn=mn),mn.type===z.Wall&&mn.parentId===e&&ze.current.set(mn.id,mn);let Ot=!1;for(;tn&&tn.leftJoints.length>0;)if(tn=ze.current.get(tn.leftJoints[0]),(tn==null?void 0:tn.id)===fn){Ot=!0;break}if(Ot){let mn=0,Hn=0;for(;tn&&tn.leftJoints.length>0;){const qe=ze.current.get(tn.leftJoints[0]),Ct=(Math.PI*3-(tn.relativeAngle-qe.relativeAngle))%sa;if(mn+=Ct,Hn+=1,tn=qe,tn.id===fn)break}mn>(Hn-2)*Math.PI+.1?fo(fn):Me.current!==Jr.null&&(Me.current=Jr.loop)}return Ot},_r=fn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:fn,undo:()=>{D(tn.addedElement.id,!1)},redo:()=>{v(Ot=>{Ot.elements.push(tn.addedElement),Ot.selectedElement=tn.addedElement})}};ie(tn)},jo=fn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:fn,flippedWallSide:Me.current,undo:()=>{const Ot=tn.addedElement;if(D(Ot.id,!1),(tn.flippedWallSide===Jr.right||tn.flippedWallSide===Jr.loop)&&Ot.rightJoints.length>0){const mn=C(Ot.rightJoints[0]);mn&&Rr(mn)}else if(tn.flippedWallSide===Jr.left&&Ot.leftJoints.length>0){const mn=C(Ot.leftJoints[0]);mn&&ir(mn)}},redo:()=>{const Ot=tn.addedElement;if(tn.flippedWallSide===Jr.right||tn.flippedWallSide===Jr.loop&&Ot.rightJoints.length>0){const mn=C(Ot.rightJoints[0]);mn&&ir(mn)}else if(tn.flippedWallSide===Jr.left&&Ot.leftJoints.length>0){const mn=C(Ot.leftJoints[0]);mn&&Rr(mn)}Ot.rightJoints.length>0&&R(Ot.rightJoints[0],[Ot.id]),Ot.leftJoints.length>0&&H(Ot.leftJoints[0],[Ot.id]),v(mn=>{mn.elements.push(Ot),mn.selectedElement=Ot,mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag})}};ie(tn)},wn=fn=>{const tn=M.getState().getAutoDeletedElements(),Ot={name:"Resize Wall",timestamp:Date.now(),resizedElementId:fn.id,resizedElementType:fn.type,oldPosition:Ye.current.clone(),newPosition:it.current.clone(),oldDimension:ut.current.clone(),newDimension:Qe.current.clone(),oldAngle:lt.current,newAngle:Ze.current,oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...vt.current[0]],[...vt.current[1]]],oldPoint:[[...Rt.current[0]],[...Rt.current[1]]],newPoint:[[...Gt.current[0]],[...Gt.current[1]]],flippedWallSide:Me.current,autoDeletedElement:tn?[...tn]:[],undo:()=>{switch(Ot.flippedWallSide){case Jr.right:if(Ot.newJoints[1]){const mn=C(Ot.newJoints[1][0]);mn&&Rr(mn)}break;case Jr.left:if(Ot.newJoints[0]){const mn=C(Ot.newJoints[0][0]);mn&&ir(mn)}break;case Jr.loop:if(Ot.newJoints[0]&&Ot.newJoints[1])fo(Ot.resizedElementId);else if(Ot.newJoints[1]){const mn=C(Ot.newJoints[1][0]);mn&&Rr(mn)}else if(Ot.newJoints[0]){const mn=C(Ot.newJoints[0][0]);mn&&ir(mn)}break}v(mn=>{for(const Hn of mn.elements)if(Hn.id===Ot.resizedElementId){const qe=Hn;switch(qe.cx=Ot.oldPosition.x,qe.cy=Ot.oldPosition.y,qe.cz=Ot.oldPosition.z,qe.lx=Ot.oldDimension.x,qe.ly=Ot.oldDimension.y,qe.lz=Ot.oldDimension.z,qe.relativeAngle=Ot.oldAngle,qe.leftJoints=[...Ot.oldJoints[0]],qe.rightJoints=[...Ot.oldJoints[1]],qe.leftPoint=[...Ot.oldPoint[0]],qe.rightPoint=[...Ot.oldPoint[1]],Ot.flippedWallSide){case Jr.loop:{if(Ot.oldJoints[0]!==Ot.newJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[Ot.resizedElementId]));else if(Ot.oldJoints[1]!==Ot.newJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[Ot.resizedElementId]));break}case Jr.left:case Jr.right:{if(!Ot.oldJoints[0]&&Ot.newJoints[1]){for(const Ct of mn.elements)if(Ct.type===z.Wall&&Ct.id===Ot.newJoints[1][0]){Ct.leftJoints=[];break}}else if(!Ot.oldJoints[1]&&Ot.newJoints[0]){for(const Ct of mn.elements)if(Ct.type===z.Wall&&Ct.id===Ot.newJoints[0][0]){Ct.rightJoints=[];break}}else if(Ot.flippedWallSide===Jr.left&&Ot.oldJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[qe.id]));else if(Ot.flippedWallSide===Jr.right&&Ot.oldJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[qe.id]));break}case Jr.null:{if(Ot.oldJoints[0]!==Ot.newJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[qe.id]));if(Ot.oldJoints[1]!==Ot.newJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[qe.id]));mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag;break}}break}mn.elements.push(...Ot.autoDeletedElement),mn.resizeHandleType=null,mn.deletedRoofId=null,mn.autoDeletedRoofs=null,mn.autoDeletedRoofIdSet.clear(),mn.autoDeletedChild=null}),Me.current=Jr.null},redo:()=>{Ot.autoDeletedElement.length>0&&D(Ot.autoDeletedElement[0].id,!1,!1,!0);const mn=new Set(Ot.autoDeletedElement.map(Hn=>Hn.id));switch(v(Hn=>{Hn.elements=Hn.elements.filter(qe=>!mn.has(qe.id));for(const qe of Hn.elements)if(qe.id===Ot.resizedElementId){const Ct=qe;switch(Ct.cx=Ot.newPosition.x,Ct.cy=Ot.newPosition.y,Ct.cz=Ot.newPosition.z,Ct.lx=Ot.newDimension.x,Ct.ly=Ot.newDimension.y,Ct.lz=Ot.newDimension.z,Ot.flippedWallSide){case Jr.left:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa;for(const Nt of Hn.elements)if(Nt.type===z.Wall&&Nt.id===Ot.oldJoints[0][0]){Nt.rightJoints=[];break}break;case Jr.right:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa;for(const Nt of Hn.elements)if(Nt.type===z.Wall&&Nt.id===Ot.oldJoints[1][0]){Nt.leftJoints=[];break}break;case Jr.loop:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa,Ct.leftJoints=[...Ot.newJoints[1]],Ct.rightJoints=[...Ot.newJoints[0]],Ct.leftPoint=[...Ot.newPoint[1]],Ct.rightPoint=[...Ot.newPoint[0]];for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[0][0]&&(Nt.leftJoints=[Ct.id]),Nt.id===Ot.newJoints[1][0]&&(Nt.rightJoints=[Ct.id]));break;case Jr.null:if(Ct.relativeAngle=Ot.newAngle,Ct.leftJoints=[...Ot.newJoints[0]],Ct.rightJoints=[...Ot.newJoints[1]],Ct.leftPoint=[...Ot.newPoint[0]],Ct.rightPoint=[...Ot.newPoint[1]],Ot.oldJoints[0][0]!==Ot.newJoints[0][0])for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[0][0]&&(Nt.rightJoints=[Ct.id]),Nt.id===Ot.oldJoints[0][0]&&(Nt.rightJoints=[]));if(Ot.oldJoints[1][0]!==Ot.newJoints[1][0])for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[1][0]&&(Nt.leftJoints=[Ct.id]),Nt.id===Ot.oldJoints[1][0]&&(Nt.leftJoints=[]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag;break}break}Hn.resizeHandleType=null}),setTimeout(()=>{v(Hn=>{Hn.deletedRoofId=null,Hn.autoDeletedRoofs=null,Hn.autoDeletedRoofIdSet.clear()})}),Ot.flippedWallSide){case Jr.left:{const Hn=C(Ot.resizedElementId),qe=C(Ot.newJoints[1][0]);Rr(Hn,qe);break}case Jr.right:{const Hn=C(Ot.resizedElementId),qe=C(Ot.newJoints[0][0]);ir(Hn,qe);break}case Jr.loop:ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);fo(Ot.resizedElementId);break}Me.current=Jr.null}};ie(Ot),v(mn=>{mn.actionState.wallHeight=fn.lz,mn.deletedRoofId=null,mn.autoDeletedRoofs=null,mn.autoDeletedRoofIdSet.clear(),mn.autoDeletedChild=[]})},In=(fn,tn,Ot)=>{if(fn.roofId)ot.current=!0,bt.current={wall:fn,newAngle:tn,newJoints:[[...Ot[0]],[...Ot[1]]]};else{const mn={name:"Move Wall",timestamp:Date.now(),id:fn.id,oldPoints:[[...Rt.current[0]],[...Rt.current[1]]],newPoints:[[...fn.leftPoint],[...fn.rightPoint]],oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...Ot[0]],[...Ot[1]]],oldAngle:lt.current,newAngle:tn,flippedWallSide:Me.current,undo(){switch(this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Tt=C(this.newJoints[0][0]);Tt&&ir(Tt);break}case Jr.right:{const Tt=C(this.newJoints[1][0]);Tt&&Rr(Tt);break}}const[Hn,qe]=this.oldJoints,[Ct,Nt]=this.newJoints;v(Tt=>{for(const Yt of Tt.elements)if(Yt.id===this.id){const[Zt,cn]=this.oldPoints;Yt.cx=(Zt[0]+cn[0])/2,Yt.cy=(Zt[1]+cn[1])/2,Yt.lx=Math.hypot(Zt[0]-cn[0],Zt[1]-cn[1]);const yn=Yt;yn.relativeAngle=this.oldAngle,yn.leftPoint=[...Zt],yn.rightPoint=[...cn],yn.leftJoints=[...Hn],yn.rightJoints=[...qe];break}Tt.resizeHandleType=null}),Hn[0]!==Ct[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===Hn[0]&&(Yt.rightJoints=[this.id]),Yt.id===Ct[0]&&(this.flippedWallSide!==Jr.left?Yt.rightJoints=[]:Yt.leftJoints=[]))}),qe[0]!==Nt[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===qe[0]&&(Yt.leftJoints=[this.id]),Yt.id===Nt[0]&&(this.flippedWallSide!==Jr.right?Yt.leftJoints=[]:Yt.rightJoints=[]))}),Me.current=Jr.null},redo(){const[Hn,qe]=this.oldJoints,[Ct,Nt]=this.newJoints;switch(v(Tt=>{for(const Yt of Tt.elements)if(Yt.id===this.id&&Yt.type===z.Wall){const[Zt,cn]=this.newPoints;Yt.cx=(Zt[0]+cn[0])/2,Yt.cy=(Zt[1]+cn[1])/2,Yt.lx=Math.hypot(Zt[0]-cn[0],Zt[1]-cn[1]);const yn=Yt;yn.relativeAngle=this.newAngle,yn.leftPoint=[...Zt],yn.rightPoint=[...cn],yn.leftJoints=[...Ct],yn.rightJoints=[...Nt];break}}),Hn[0]!==Ct[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===Hn[0]&&(Yt.rightJoints=[]),Yt.id===Ct[0]&&(this.flippedWallSide===Jr.right?Yt.leftJoints=[this.id]:Yt.rightJoints=[this.id]))}),qe[0]!==Nt[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===qe[0]&&(Yt.leftJoints=[]),Yt.id===Nt[0]&&(this.flippedWallSide===Jr.right?Yt.rightJoints=[this.id]:Yt.leftJoints=[this.id]))}),this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Tt=C(this.newJoints[0][0]);Tt&&Rr(Tt);break}case Jr.right:{const Tt=C(this.newJoints[1][0]);Tt&&ir(Tt);break}}v(Tt=>{Tt.resizeHandleType=null}),Me.current=Jr.null}};ie(mn)}},ar=fn=>{if(fn.button===2){fn.altKey&&L(e,fn,Xo.Select);return}v(mn=>{mn.contextMenuObjectType=null}),M.getState().objectTypeToAdd!==z.Window&&!Q()&&L(e,fn,Xo.Select);const tn=P();let Ot=!1;if(fn.intersections[0].object.name===z.Polygon&&M.getState().objectTypeToAdd!==z.None&&(Ot=!0),(tn==null?void 0:tn.id)===e||Ot)if(Io(M.getState().objectTypeToAdd)){if(t){Re(!0);const mn=fn.intersections.filter(qe=>!qe.eventObject.name.startsWith("Wall Intersection Plane"))[0].point,Hn=j(t,mn);Hn&&_r(Hn),v(qe=>{qe.actionModeLock||(qe.objectTypeToAdd=z.None)})}}else kn.getState().selectNone(),kn.setState({foundationRef:Ne});else if(tn&&tn.parentId===e&&Io(tn.type))switch(Ue.current=tn,tn.type===z.Wall&&!we.current&&(Ie.current=[...M.getState().elements]),Re(!0),Ye.current.set(tn.cx,tn.cy,tn.cz),ut.current.set(tn.lx,tn.ly,tn.lz),dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e),tn.type){case z.SolarPanel:case z.ParabolicTrough:case z.FresnelReflector:{lt.current=tn.relativeAzimuth;break}case z.Polygon:{Be.current=tn.vertices.map(mn=>({...mn}));break}case z.Wall:{const mn=tn;lt.current=mn.relativeAngle,wt.current=[[...mn.leftJoints],[...mn.rightJoints]],Rt.current=[[...mn.leftPoint],[...mn.rightPoint]],to.current=mn.leftJoints[0],Bn.current=mn.rightJoints[0],ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);break}}if(we.current&&ve.current&&Je.current){const mn=Wt.intersectObjects([Je.current]);if(mn.length===0)return;let Hn=ye.wallRelativePosition(mn[0].point,t);ue[0].position&&(Hn.setX(ue[0].position[0]),Hn.setY(ue[0].position[1]));const{id:qe,point:Ct,side:Nt,jointId:Tt}=po(Hn,1.5);Hn=On(Hn,Ct);let Yt=Mt.LowerRight;if(qe){const Zt=C(qe);Nt===V1.Right?v(cn=>{for(const yn of cn.elements)if(yn.type===z.Wall){if(yn.id===ve.current){const An=yn;An.cx=Hn.x,An.cy=Hn.y,Zt.rightJoints.length===0&&(An.leftJoints=[Zt.id])}yn.id===qe&&Zt.rightJoints.length===0&&(yn.rightJoints=ve.current?[ve.current]:[])}}):Nt===V1.Left&&!Tt&&(v(cn=>{for(const yn of cn.elements)if(yn.type===z.Wall){if(yn.id===ve.current){const An=yn;An.cx=Hn.x,An.cy=Hn.y,Zt.leftJoints.length===0&&(An.rightJoints=[Zt.id])}yn.id===qe&&Zt.leftJoints.length===0&&(yn.leftJoints=ve.current?[ve.current]:[])}}),Yt=Mt.LowerLeft)}else T(ve.current,Hn.x,Hn.y);we.current=!1,Pe.current=!0,F(ve.current,[Hn.x,Hn.y,Hn.z]),v(Zt=>{Zt.resizeHandleType=Yt,Zt.resizeAnchor=ye.wallAbsolutePosition(Hn,t)}),kn.getState().setEnableOrbitController(!1),Ue.current=tn}},Wo=fn=>{if(Vl&&Cc(!1),fn.altKey&&fn.button===2&&k&&k.length>0){v(mn=>{mn.pastePoint.copy(fn.intersections[0].point),mn.clickObjectType=z.Foundation,mn.pasteNormal=ko});const Ot=W();if(Ot.length>0){const mn={name:"Paste to Point",timestamp:Date.now(),pastedElements:Ot.map(Hn=>({...Hn})),undo:()=>{for(const Hn of mn.pastedElements)D(Hn.id,!1)},redo:()=>{v(Hn=>{Hn.elements.push(...mn.pastedElements),Hn.selectedElement=mn.pastedElements[0]})}};ie(mn)}}if(!Ue.current||Ue.current.type===z.Tree||Ue.current.type===z.Flower||Ue.current.type===z.Human)return;const tn=C(Ue.current.id);if(tn){switch(tn.type){case z.Wall:{const Ot=tn;if(we.current)v(mn=>{mn.elements.pop(),mn.addedWallId=null,mn.actionModeLock&&(mn.objectTypeToAdd=z.Wall,Px.selectNone(mn))}),ve.current&&ze.current.delete(ve.current),ve.current=null,we.current=!1,Pe.current=!1;else if(Pe.current&&ve.current&&Je.current)kn.getState().setEnableOrbitController(!0),v(mn=>{mn.actionModeLock&&(mn.objectTypeToAdd=z.Wall,Px.selectNone(mn)),mn.addedWallId=null,Ot.lx===0&&Ie.current?(mn.elements=[...Ie.current],ve.current&&ze.current.delete(ve.current)):(jo(Ot),ze.current.set(Ot.id,Ot))}),ve.current=null,Pe.current=!1;else if(M.getState().resizeHandleType)Ot.lx>.45?(ze.current.set(Ot.id,Ot),it.current.set(Ot.cx,Ot.cy,Ot.cz),Qe.current.set(Ot.lx,Ot.ly,Ot.lz),Ze.current=Ot.relativeAngle,vt.current=[[...Ot.leftJoints],[...Ot.rightJoints]],Gt.current=[[...Ot.leftPoint],[...Ot.rightPoint]],wn(Ot)):v(mn=>{Ie.current&&(mn.elements=[...Ie.current],Ie.current=null)});else if(M.getState().moveHandleType){let mn=Ot.relativeAngle,Hn=[],qe=[];if(to.current)if(Ot.leftJoints.length>0&&(to.current!==Ot.leftJoints[0]||to.current===Ot.leftJoints[0]&&Ko.current)&&H(Ot.leftJoints[0],[]),Ko.current)R(to.current,[Ot.id]),qe=[to.current];else if(Hn=[to.current],Qo.current){R(to.current,[Ot.id]);const Ct=C(to.current);Ct&&Rr(Ct)}else H(to.current,[Ot.id]);else Ot.leftJoints.length>0&&Ot.leftJoints[0]!==Bn.current&&(Hn=[],H(Ot.leftJoints[0],[]));if(Bn.current)if(Ot.rightJoints.length>0&&(Bn.current!==Ot.rightJoints[0]||Bn.current===Ot.rightJoints[0]&&Ko.current)&&Ot.rightJoints[0]!==to.current&&R(Ot.rightJoints[0],[]),Ko.current)H(Bn.current,[Ot.id]),Hn=[Bn.current];else if(qe=[Bn.current],So.current){H(Bn.current,[Ot.id]);const Ct=C(Bn.current);Ct&&ir(Ct)}else R(Bn.current,[Ot.id]);else Ot.rightJoints.length>0&&Ot.rightJoints[0]!==to.current&&(qe=[],R(Ot.rightJoints[0],[]));v(Ct=>{for(const Nt of Ct.elements)if(Nt.id===Ot.id&&Nt.type===z.Wall){const Tt=Nt;if(Ko.current&&(mn=(Tt.relativeAngle+Math.PI)%sa,Tt.relativeAngle=mn,[Tt.leftPoint,Tt.rightPoint]=[[...Tt.rightPoint],[...Tt.leftPoint]]),Hn.length===0&&qe.length===0)Tt.roofId=null;else if(Hn.length>0){const Yt=Ct.elements.find(Zt=>Zt.id===Hn[0]);Yt&&(Tt.roofId=Yt.roofId)}else if(qe.length>0){const Yt=Ct.elements.find(Zt=>Zt.id===qe[0]);Yt&&(Tt.roofId=Yt.roofId)}Tt.leftJoints=[...Hn],Tt.rightJoints=[...qe];break}Ct.updateWallMapOnFoundationFlag=!Ct.updateWallMapOnFoundationFlag}),br(Ot.id),In(Ot,mn,[[...Hn],[...qe]]),Ko.current=!1,Qo.current=!1,So.current=!1,to.current=null,Bn.current=null}Me.current=Jr.null,v(mn=>{mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag}),Ae({show:!1,direction:null,position:null}),fe([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]);break}case z.Polygon:{if(M.getState().moveHandleType||M.getState().resizeHandleType){$e.current=tn.vertices.map(mn=>({...mn}));const Ot={name:M.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Be.current,newValue:$e.current,changedElementId:tn.id,changedElementType:tn.type,undo:()=>{U(Ot.changedElementId,Ot.oldValue)},redo:()=>{U(Ot.changedElementId,Ot.newValue)}};ie(Ot)}break}default:if(M.getState().resizeHandleType){if(it.current.set(tn.cx,tn.cy,tn.cz),Qe.current.set(tn.lx,tn.ly,tn.lz),it.current.distanceToSquared(Ye.current)>Et||Qe.current.distanceToSquared(ut.current)>Et){const Ot={name:"Resize",timestamp:Date.now(),resizedElementId:Ue.current.id,resizedElementType:Ue.current.type,oldCx:Ye.current.x,oldCy:Ye.current.y,oldCz:Ye.current.z,newCx:it.current.x,newCy:it.current.y,newCz:it.current.z,oldLx:ut.current.x,oldLy:ut.current.y,oldLz:ut.current.z,newLx:Qe.current.x,newLy:Qe.current.y,newLz:Qe.current.z,undo:()=>{T(Ot.resizedElementId,Ot.oldCx,Ot.oldCy,Ot.oldCz),w(Ot.resizedElementId,Ot.oldLx,Ot.oldLy,Ot.oldLz)},redo:()=>{T(Ot.resizedElementId,Ot.newCx,Ot.newCy,Ot.newCz),w(Ot.resizedElementId,Ot.newLx,Ot.newLy,Ot.newLz)}};ie(Ot)}}else if(M.getState().rotateHandleType){if(ye.isSolarCollector(Ue.current)){const Ot=Ue.current;if(Math.abs(Ze.current-lt.current)>Et)if(Fs(Ot,Ze.current)){v(Hn=>{Hn.selectedElementAngle=Ze.current});const mn={name:"Rotate",timestamp:Date.now(),oldValue:lt.current,newValue:Ze.current,changedElementId:Ot.id,changedElementType:Ot.type,undo:()=>{E(mn.changedElementId,mn.oldValue)},redo:()=>{E(mn.changedElementId,mn.newValue)}};ie(mn)}else E(Ot.id,lt.current)}}else if(it.current.set(tn.cx,tn.cy,tn.cz),it.current.distanceToSquared(Ye.current)>Et){let Ot=!0;ye.isSolarCollector(tn)&&(Ot=wi(tn,tn.cx,tn.cy)),Ot?Eu.addUndoableMove():v(mn=>{const Hn=mn.elements.find(Tt=>Tt.id===tn.id);if(!Hn||!mn.selectedElement)return;const qe=mn.selectedElement;Hn.cx=qe.cx,Hn.cy=qe.cy,Hn.cz=qe.cz,Hn.rotation=[...qe.rotation],Hn.normal=[...qe.normal];const Ct=dt.getState().oldParentId,Nt=dt.getState().oldFoundationId;Ct&&(Hn.parentId=Ct),Nt&&(Hn.foundationId=Nt)})}}Re(!1),Ue.current=null,v(Ot=>{Ot.resizeHandleType=null,Ot.moveHandleType=null})}},to=m.useRef(null),Bn=m.useRef(null),Ko=m.useRef(!1),So=m.useRef(!1),Qo=m.useRef(!1),Yo=(fn,tn,Ot)=>{let mn=Math.atan2(tn.y-fn.y,tn.x-fn.x)-(Ot===Mt.LowerLeft?Math.PI:0);return mn=mn>=0?mn:(sa+mn)%sa,mn},lr=(fn,tn)=>{let mn=null,Hn=null,qe=1/0,Ct=1/0;for(const[Nt,Tt]of ze.current)if(Ue.current!==null&&Tt.id!==Ue.current.id&&Tt.id!==tn){const Yt=Math.abs(fn.x-Tt.leftPoint[0]),Zt=Math.abs(fn.x-Tt.rightPoint[0]),cn=Math.abs(fn.y-Tt.leftPoint[1]),yn=Math.abs(fn.y-Tt.rightPoint[1]);Yt<1&&Yt{const qe=Yo(fn,tn,Ot);let Ct=null,Nt=null;return qe<.05||qe>sa-.05||Math.abs(qe-Math.PI)<.05||Math.abs(tn.y-fn.y)<1?Nt=fn.y:(Math.abs(qe-Math.PI/2)<.05||Math.abs(qe-3*Math.PI/2)<.05||Math.abs(tn.x-fn.x)<1)&&(Ct=fn.x),[Ct,Nt]},ei=(fn,tn,Ot,mn)=>{const[Hn,qe]=lr(tn),[Ct,Nt]=fr(fn,tn,Ot),Tt=hr(tn.x,Hn,Ct),Yt=hr(tn.y,qe,Nt);return new ae(Tt,Yt,tn.z)},hr=(fn,tn,Ot)=>tn!==null&&Ot!==null?Math.abs(tn-fn){let[mn,Hn]=[1/0,1/0],qe=null,Ct=null;for(const[Nt,Tt]of ze.current)if(Ue.current!==null&&Tt.id!==Ue.current.id&&Tt.id!==Ot){const Yt=Math.abs(fn.x-Tt.leftPoint[0]),Zt=Math.abs(fn.x-Tt.rightPoint[0]);Yt<.01&&Yt{qe!==null&&Ct!==null?(Nt[tn].direction="xy",Nt[tn].position=[qe,Ct]):qe!==null?(Nt[tn].direction="y",Nt[tn].position=[qe,fn.y]):Ct!==null?(Nt[tn].direction="x",Nt[tn].position=[fn.x,Ct]):(Nt[tn].direction=null,Nt[tn].position=null)})),[qe!==null,Ct!==null]},bi=(fn,tn)=>Math.abs(tn)<.01||Math.abs(tn-Math.PI)<.01?(Ae(Ot=>({...Ot,direction:"x",position:[fn.x,fn.y]})),[!0,!1]):Math.abs(tn-Math.PI/2)<.01||Math.abs(tn-3*Math.PI/2)<.01?(Ae(Ot=>({...Ot,direction:"y",position:[fn.x,fn.y]})),[!1,!0]):(Ae(Ot=>({...Ot,direction:null,position:null})),[!1,!1]),Fo=(fn,tn)=>{fe(JP(Ot=>{Ot[0].show=fn})),Ae(Ot=>({...Ot,show:tn}))},Si=(fn,tn)=>{const[Ot,mn]=tr(fn),[Hn,qe]=bi(fn,tn);Ot&&mn?Fo(!0,!1):Ot?Fo(!0,!qe&&Hn):mn?Fo(!0,!Hn&&qe):Fo(!1,Hn||qe)},hl=fn=>{var qe,Ct;if(!t||($u(fn),Ue.current&&ye.isSolarCollector(Ue.current)))return;const tn=M.getState().objectTypeToAdd;if(!Ue.current&&!ve.current&&tn!==z.Wall||((qe=Ue.current)==null?void 0:qe.parentId)!==e&&tn===z.None)return;const Ot=M.getState().moveHandleType,mn=M.getState().resizeHandleType,Hn=M.getState().resizeAnchor;if(_t(fn),Je.current){const Nt=Wt.intersectObjects([Je.current]);if(Nt.length===0)return;let Tt=Nt[0].point;if(Ue.current&&Ue.current.type&&!Ue.current.locked&&Nt.length>0)switch(Re(!0),Ue.current.type){case z.Sensor:case z.Light:case z.WindTurbine:{Tt=ye.relativeCoordinates(Tt.x,Tt.y,Tt.z,t),T(Ue.current.id,Tt.x,Tt.y);break}case z.Polygon:{const Yt=Ue.current;if(Ot===zo.Default){Tt=ye.relativeCoordinates(Tt.x,Tt.y,Tt.z,t);const Zt=ye.calculatePolygonCentroid(Yt.vertices),cn=Tt.x-Zt.x,yn=Tt.y-Zt.y,An=Yt.vertices.map(Tn=>({...Tn}));An.forEach(Tn=>{Tn.x+=cn,Tn.y+=yn}),U(Yt.id,An)}else mn===Mt.Default&&(Tt.x-=t.cx,Tt.y-=t.cy,Tt.applyEuler(new ln().fromArray(t.rotation.map(Zt=>-Zt))),Tt=M.getState().enableFineGrid?ye.snapToFineGrid(Tt):ye.snapToNormalGrid(Tt),Tt.x/=t.lx,Tt.y/=t.ly,N(Yt.id,Yt.selectedIndex,Tt.x,Tt.y));break}case z.Wall:{if(((Ct=M.getState().selectedElement)==null?void 0:Ct.type)!==z.Wall)break;if(mn&&(mn===Mt.LowerLeft||mn===Mt.LowerRight)){const Yt=ye.wallRelativePosition(Hn,t);Tt=ye.wallRelativePosition(Tt,t);let Zt=null;M.getState().enableFineGrid?Tt=ye.snapToFineGrid(Tt):(Zt=po(Tt,1.5),Zt!=null&&Zt.point?Tt=Zt.point:(Tt=ye.snapToNormalGrid(Tt),Tt=ei(Yt,Tt,mn),Zt=po(Tt,1.5),Zt!=null&&Zt.point&&(Tt=Zt.point)));const cn=Yo(Yt,Tt,mn);Si(Tt,cn);const yn=Tt.distanceTo(Yt),An=new ae().addVectors(Tt,Yt).divideScalar(2),Tn=mn===Mt.LowerLeft?Tt:Yt,Ln=mn===Mt.LowerLeft?Yt:Tt;v(Wn=>{for(const oo of Wn.elements)if(oo.id===Ue.current.id&&oo.type===z.Wall){const qn=oo;qn.cx=An.x,qn.cy=An.y,qn.lx=yn,qn.relativeAngle=cn,qn.leftPoint=[Tn.x,Tn.y,0],qn.rightPoint=[Ln.x,Ln.y,0];break}});const Yn=C(Ue.current.id);if(Yn){if(Zt&&Zt.point){if(Zt.id&&Zt.side&&!Zt.jointId){const Wn=C(Zt.id);if(Wn){if(mn===Mt.LowerLeft&&Wn.leftJoints.length===0&&Zt.side===V1.Left){if(Yn.leftJoints.length>0&&Yn.leftJoints[0]!==Zt.id){const oo=Yn.leftJoints[0];v(qn=>{for(const qo of qn.elements)if(qo.id===oo&&qo.type===z.Wall){qo.rightJoints=[];break}})}Rr(Yn,Wn)}else if(mn===Mt.LowerRight&&Wn.rightJoints.length===0&&Zt.side===V1.Right){if(Yn.rightJoints.length>0&&Yn.rightJoints[0]!==Zt.id){const oo=Yn.rightJoints[0];v(qn=>{for(const qo of qn.elements)if(qo.id===oo&&qo.type===z.Wall){qo.leftJoints=[];break}})}ir(Yn,Wn)}else mn===Mt.LowerRight&&Zt.side===V1.Left&&Wn.leftJoints.length===0&&Wn.rightJoints[0]!==Yn.id?v(oo=>{let qn=null;Yn.rightJoints.length>0&&Yn.rightJoints[0]!==(Zt==null?void 0:Zt.id)&&(qn=Yn.rightJoints[0]);for(const qo of oo.elements)qo.type===z.Wall&&(qo.id===Yn.id&&(qo.rightJoints=[Wn.id]),qo.id===Wn.id&&(qo.leftJoints=[Yn.id]),qo.id===qn&&(qo.leftJoints=[]))}):mn===Mt.LowerLeft&&Zt.side===V1.Right&&Wn.rightJoints.length===0&&Wn.leftJoints[0]!==Yn.id&&v(oo=>{let qn=null;Yn.leftJoints.length>0&&Yn.leftJoints[0]!==(Zt==null?void 0:Zt.id)&&(qn=Yn.leftJoints[0]);for(const qo of oo.elements)qo.type===z.Wall&&(qo.id===Yn.id&&(qo.leftJoints=[Wn.id]),qo.id===Wn.id&&(qo.rightJoints=[Yn.id]),qo.id===qn&&(qo.rightJoints=[]))});br(Yn.id)}}}else if(mn===Mt.LowerRight&&Yn.rightJoints.length>0){const Wn=Yn.rightJoints[0];v(oo=>{for(const qn of oo.elements)qn.type===z.Wall&&(qn.id===Yn.id&&(qn.rightJoints=[]),qn.id===Wn&&(qn.leftJoints=[]));oo.updateWallMapOnFoundationFlag=!oo.updateWallMapOnFoundationFlag})}else if(mn===Mt.LowerLeft&&Yn.leftJoints.length>0){const Wn=Yn.leftJoints[0];v(oo=>{for(const qn of oo.elements)qn.type===z.Wall&&(qn.id===Yn.id&&(qn.leftJoints=[]),qn.id===Wn&&(qn.rightJoints=[]));oo.updateWallMapOnFoundationFlag=!oo.updateWallMapOnFoundationFlag})}}}else if(Ot){const Yt=C(Ue.current.id);if(Yt){Tt=ye.wallRelativePosition(Tt,t);const Zt=new ae,cn=new ln(0,0,Yt.relativeAngle);Ot===zo.Lower?Zt.setY(rt):Ot===zo.Upper&&Zt.setY(-rt-Yt.ly),Tt.add(Zt.applyEuler(cn));const yn=new ae().addVectors(Tt,new ae(-Yt.lx/2,0,0).applyEuler(cn)),An=new ae().addVectors(Tt,new ae(Yt.lx/2,0,0).applyEuler(cn));let Tn=null,Ln=null,Yn=!1;Ko.current=!1,Qo.current=!1,So.current=!1,to.current=null,Bn.current=null;const Wn=(oo,qn)=>{const qo=qn==="left"?yn:An,ii=new ae().subVectors(oo,qo);Tt.add(ii),yn.add(ii),An.add(ii)};if(!M.getState().enableFineGrid){let oo=po(yn,1);oo.point?(Wn(oo.point,"left"),oo.id&&(!oo.jointId||oo.jointId===Yt.id)&&(to.current=oo.id,Tn=oo.side===V1.Left)):to.current=null;let qn=po(An,1);if(qn.point?(oo.id||Wn(qn.point,"right"),qn.id&&(!qn.jointId||qn.jointId===Yt.id)&&(oo.id!==qn.id||oo.side!==qn.side)&&(Bn.current=qn.id,Ln=qn.side===V1.Right)):Bn.current=null,!oo.point&&!qn.point){const[ya,Hs]=lr(yn),[Qu,Zu]=lr(An);if(ya!==null||Qu!==null){const Hh=(ya??1/0)-yn.x,If=(Qu??1/0)-An.x,ed=Math.min(Hh,If);yn.setX(yn.x+ed),An.setX(An.x+ed),Tt.setX(Tt.x+ed),oo=po(yn,1),oo.point?(Wn(oo.point,"left"),oo.id&&(!oo.jointId||oo.jointId===Yt.id)&&(to.current=oo.id,Tn=oo.side===V1.Left)):to.current=null}if(Hs!==null||Zu!==null){const Hh=(Hs??1/0)-yn.y,If=(Zu??1/0)-An.y,ed=Math.min(Hh,If);yn.setY(yn.y+ed),An.setY(An.y+ed),Tt.setY(Tt.y+ed),qn=po(An,1),qn.point?(oo.id||Wn(qn.point,"right"),qn.id&&(!qn.jointId||qn.jointId===Yt.id)&&(oo.id!==qn.id||oo.side!==qn.side)&&(Bn.current=qn.id,Ln=qn.side===V1.Right)):Bn.current=null}}const[qo,ii]=tr(yn,0),[Qi,Or]=tr(An,1);fe(JP(ya=>{ya[0].show=qo||ii,ya[1].show=Qi||Or})),Tn&&Ln===null||Ln&&Tn===null||Tn&&Ln?Ko.current=!0:(Tn&&Ln===!1||Ln&&Tn===!1)&&(Qo.current=Tn,So.current=Ln),oo.point&&qn.point&&(oo.id!==qn.id||oo.side!==qn.side)&&(yn.copy(oo.point),An.copy(qn.point),Yn=!0)}v(oo=>{var qn;for(const qo of oo.elements)if(qo.id===((qn=Ue.current)==null?void 0:qn.id)&&qo.type===z.Wall){const ii=qo;if(Yn){ii.cx=(yn.x+An.x)/2,ii.cy=(yn.y+An.y)/2,ii.lx=yn.distanceTo(An);let Qi=Math.atan2(An.y-yn.y,An.x-yn.x);Qi=Qi>=0?Qi:(sa+Qi)%sa,ii.relativeAngle=Qi}else ii.cx=Tt.x,ii.cy=Tt.y;ii.leftPoint=yn.toArray(),ii.rightPoint=An.toArray();break}})}}break}}if(tn===z.Wall&&!we.current){Ie.current=[...M.getState().elements];const Yt=j(t,Tt);Ue.current=Yt,ve.current=Yt.id,we.current=!0,Re(!0),kn.getState().setEnableOrbitController(!1),v(Zt=>{Zt.addedWallId=Yt.id,Zt.objectTypeToAdd=z.None})}if(ve.current&&we.current){Tt=ye.wallRelativePosition(Nt[0].point,t);let Yt=null;if(M.getState().enableFineGrid)Tt=ye.snapToFineGrid(Tt);else if(Yt=po(Tt,1.5),Yt!=null&&Yt.point)Tt=Yt.point;else{Tt=ye.snapToNormalGrid(Tt);const[yn,An]=lr(Tt);yn!==null&&Tt.setX(yn),An!==null&&Tt.setY(An),Yt=po(Tt,1.5),Yt!=null&&Yt.point&&(Tt=Yt.point)}const[Zt,cn]=tr(Tt);fe(JP(yn=>{yn[0].show=Zt||cn})),T(ve.current,Tt.x,Tt.y)}}},nr=fn=>{fn.intersections.length>0&&fn.intersections[0].object===Je.current&&le(!0)},or=fn=>{v(tn=>{Px.selectMe(tn,e,fn,Xo.ContextMenu),tn.pastePoint.copy(fn.intersections[0].point),tn.clickObjectType=z.Foundation,tn.pasteNormal=ko,fn.altKey?tn.contextMenuObjectType=null:fn.intersections.length>0&&fn.intersections[0].object===Je.current&&(tn.contextMenuObjectType=z.Foundation),tn.pasteNormal=ko})},Ai=()=>{Vl&&(Cc(!1),Ue.current=null),le(!1),Re(!1),Ue.current&&we.current&&(D(Ue.current.id,!1),we.current=!1,v(fn=>{fn.addedWallId=null,fn.objectTypeToAdd=z.Wall}),Ue.current=null),Ae({show:!1,direction:null,position:null}),fe([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}])},Fa=fn=>{Ue.current&&ye.isPlantOrHuman(Ue.current)&&fn.intersections[0].object===Je.current&&Re(!0)},wi=(fn,tn,Ot)=>{const mn=JSON.parse(JSON.stringify(fn));return mn.cx=tn,mn.cy=Ot,se(mn)?(co(Y.t("message.MoveCancelledBecauseOfOverlap",At)),!1):ye.isSolarCollectorWithinHorizontalSurface(mn,t)?!0:(co(Y.t("message.MoveOutsideBoundaryCancelled",At)),!1)},Fs=(fn,tn)=>{const Ot=JSON.parse(JSON.stringify(fn));return Ot.relativeAzimuth=tn,se(Ot)?(co(Y.t("message.RotationCancelledBecauseOfOverlap",At)),!1):ye.isSolarCollectorWithinHorizontalSurface(Ot,t)?!0:(co(Y.t("message.RotationOutsideBoundaryCancelled",At)),!1)},ks=(fn,tn,Ot,mn,Hn)=>{if(fn.type===z.SolarPanel&&fn.tiltAngle!==0&&.5*Hn*Math.abs(Math.sin(fn.tiltAngle))>fn.poleHeight)return!1;const qe=JSON.parse(JSON.stringify(fn));return qe.cx=tn,qe.cy=Ot,qe.lx=mn,qe.ly=Hn,ye.isSolarCollectorWithinHorizontalSurface(qe,t)},Zs=fn=>{if(nt.current&&t&&Ue.current&&t){if(!ye.isSolarCollector(Ue.current))return;const tn=Ue.current;_t(fn);const Ot=Wt.intersectObjects([nt.current]);if(Ot.length>0){let mn=Ot[0].point;const Hn=M.getState().moveHandleType,qe=M.getState().rotateHandleType,Ct=M.getState().resizeHandleType;if(Hn&&t)mn=ye.relativeCoordinates(mn.x,mn.y,mn.z,t),T(tn.id,mn.x,mn.y),tn.parentId!==e&&M.getState().set(Nt=>{const Tt=Nt.elements.find(Yt=>Yt.id===tn.id&&Yt.type===z.SolarPanel);Tt&&(Tt.parentId!==e||Tt.foundationId!==e)&&(Tt.parentId=e,Tt.foundationId=e,Tt.parentType=z.Foundation,Nt.selectedElement&&(Nt.selectedElement.parentId=e,Tt.color=Nt.selectedElement.color))});else if(qe){if(qe===Di.Upper||qe===Di.Lower){const Nt=t.rotation[2],Tt=new Kt(t.cx,t.cy),Yt=new Kt(t.lx*tn.cx,t.ly*tn.cy).rotateAround(ai,Nt),Zt=new Kt().addVectors(Yt,Tt),cn=Math.atan2(-mn.x+Zt.x,mn.y-Zt.y)-Nt+(qe===Di.Lower?0:Math.PI),yn=Math.abs(cn)>Math.PI?-Math.sign(cn)*sa:0,An=cn+yn;E(tn.id,An),Ze.current=An}}else if(Ct){const Nt=M.getState().resizeAnchor,Tt=new Kt(mn.x,mn.y),Yt=new Kt(Nt.x,Nt.y),Zt=Tt.distanceTo(Yt),cn=tn.relativeAzimuth+l[2],yn=new Kt().subVectors(Tt,Yt),An=new Kt(n,o);if(tn.type===z.SolarPanel){const Tn=tn,Ln=B(Tn.pvModelName);switch(Ct){case Mt.Lower:case Mt.Upper:{const Yn=Ct===Mt.Lower?1:-1,Wn=yn.angle()-cn+Yn*Qt;let oo=Zt*Math.cos(Wn);Tn.orientation===vr.portrait?oo=Math.max(1,Math.ceil((oo-Ln.length/2)/Ln.length))*Ln.length:oo=Math.max(1,Math.ceil((oo-Ln.width/2)/Ln.width))*Ln.width;const qn=Nt.x+Yn*(oo*Math.sin(cn))/2,qo=Nt.y-Yn*(oo*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,oo)&&(b(tn.id,oo),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Yn=Ct===Mt.Left?-1:1,Wn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0);let oo=Zt*Math.cos(Wn);Tn.orientation===vr.portrait?oo=Math.max(1,Math.ceil((oo-Ln.width/2)/Ln.width))*Ln.width:oo=Math.max(1,Math.ceil((oo-Ln.length/2)/Ln.length))*Ln.length;const qn=Nt.x+Yn*(oo*Math.cos(cn))/2,qo=Nt.y+Yn*(oo*Math.sin(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,oo,tn.ly)&&(x(tn.id,oo),T(tn.id,Or,ya))}break}}else if(tn.type===z.ParabolicTrough){const Tn=tn;switch(Ct){case Mt.Lower:case Mt.Upper:{const Ln=Ct===Mt.Lower?1:-1,Yn=yn.angle()-cn+Ln*Qt;let Wn=Zt*Math.cos(Yn);Wn=Math.max(1,Math.ceil((Wn-Tn.moduleLength/2)/Tn.moduleLength))*Tn.moduleLength;const qn=Nt.x+Ln*(Wn*Math.sin(cn))/2,qo=Nt.y-Ln*(Wn*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,Wn)&&(b(tn.id,Wn),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Ln=Ct===Mt.Left?-1:1,Yn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0),Wn=Zt*Math.cos(Yn),oo=Nt.x+Ln*(Wn*Math.cos(cn))/2,qn=Nt.y+Ln*(Wn*Math.sin(cn))/2,qo=new Kt(oo,qn),ii=new Kt().subVectors(qo,An).rotateAround(ai,-l[2]),Qi=ii.x/r,Or=ii.y/i;ks(tn,Qi,Or,Wn,tn.ly)&&(x(tn.id,Wn),T(tn.id,Qi,Or),v(ya=>{ya.actionState.parabolicTroughWidth=Wn}))}break}}else if(tn.type===z.FresnelReflector){const Tn=tn;switch(Ct){case Mt.Lower:case Mt.Upper:{const Ln=Ct===Mt.Lower?1:-1,Yn=yn.angle()-cn+Ln*Qt;let Wn=Zt*Math.cos(Yn);Wn=Math.max(1,Math.ceil((Wn-Tn.moduleLength/2)/Tn.moduleLength))*Tn.moduleLength;const qn=Nt.x+Ln*(Wn*Math.sin(cn))/2,qo=Nt.y-Ln*(Wn*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,Wn)&&(b(tn.id,Wn),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Ln=Ct===Mt.Left?-1:1,Yn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0),Wn=Zt*Math.cos(Yn),oo=Nt.x+Ln*(Wn*Math.cos(cn))/2,qn=Nt.y+Ln*(Wn*Math.sin(cn))/2,qo=new Kt(oo,qn),ii=new Kt().subVectors(qo,An).rotateAround(ai,-l[2]),Qi=ii.x/r,Or=ii.y/i;ks(tn,Qi,Or,Wn,tn.ly)&&(x(tn.id,Wn),T(tn.id,Qi,Or),v(ya=>{ya.actionState.fresnelReflectorWidth=Wn}))}break}}else if(tn.type===z.ParabolicDish){const Tn=tn;switch(Ct){case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Ln=Math.min(10,Zt);ks(tn,Tn.cx,Tn.cy,tn.lx,Ln)&&(x(tn.id,Ln),b(tn.id,Ln),v(Yn=>{Yn.actionState.parabolicDishRimDiameter=Ln}));break}}}}}}},{transparent:Yi,opacity:ua}=tM();m.useEffect(()=>{Je.current&&(Je.current.material[4].needsUpdate=!0)},[Yi]);const[Vl,Jl]=m.useState(!1),$u=fn=>{const tn=Eu.getIntersectionObjects(fn);if(tn.length==0||tn[0].eventObject.userData.id!==e){Vl&&(Cc(!1),Ue.current=null,Re(!1));return}const Ot=M.getState().selectedElement;!Vl&&Ot&&!Ot.locked&&Ot.type===z.SolarPanel&&M.getState().moveHandleType&&(Cc(!0,Ot.poleHeight),Ue.current=Ot,Re(!0))},Cc=(fn,tn)=>{fn&&tn!==void 0?(Jl(!0),tt.setZ(tn)):(Jl(!1),tt.setZ(0))},mu=()=>Vl?!0:Ue.current&&ye.isSolarCollector(Ue.current)&&!Ue.current.locked;return m.useEffect(()=>{const fn=()=>{Ue.current&&we.current&&D(Ue.current.id,!1)};return window.addEventListener("beforeunload",fn),()=>{window.removeEventListener("beforeunload",fn)}},[]),h.jsx(h.Fragment,{children:h.jsxs("group",{ref:Ne,name:`${Fm} ${e}`,position:[n,o,It],rotation:[0,0,l[2]],userData:{id:e,fId:e},children:[h.jsx(Kye,{parentId:e,foundationId:e,wrapperType:z.Foundation,plx:r,ply:i,plz:a}),h.jsx(len,{foundationId:e,wrapperType:z.Foundation}),h.jsxs(si,{castShadow:G,receiveShadow:G,uuid:e,userData:{simulation:!0,stand:!0,id:e,aabb:!0},ref:Je,name:pX,args:[r,i,a],onContextMenu:or,onPointerOver:nr,onPointerDown:ar,onPointerUp:Wo,onPointerMove:k2.throttle(hl,qF,{trailing:!1}),onPointerOut:Ai,onPointerEnter:Fa,children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:s}),h.jsx("meshStandardMaterial",{attach:"material-1",color:s}),h.jsx("meshStandardMaterial",{attach:"material-2",color:s}),h.jsx("meshStandardMaterial",{attach:"material-3",color:s}),ee&&Te?h.jsx("meshBasicMaterial",{attach:"material-4",color:"white",map:Te,transparent:Yi,opacity:ua}):h.jsx("meshStandardMaterial",{attach:"material-4",color:p===_i.NoTexture?s:"white",map:Rn,transparent:Yi,opacity:ua}),h.jsx("meshStandardMaterial",{attach:"material-5",color:s})]}),mu()&&h.jsx(ta,{ref:nt,name:"Foundation Intersection Plane",position:tt,args:[r,i],visible:!1,onPointerMove:k2.throttle(Zs,qF)}),Se&&h.jsxs(h.Fragment,{children:[M.getState().rotateHandleType&&Ue.current&&ye.isSolarCollector(Ue.current)&&h.jsx(_ye,{element:Ue.current,height:Ue.current.poleHeight+It}),(M.getState().moveHandleType||M.getState().resizeHandleType||ve.current)&&h.jsx(eme,{hx:ht,hy:ct,hz:It})]}),A&&h.jsx(Gye,{element:t,verticalLift:at}),(!A||q)&&h.jsx(mw,{hx:ht,hy:ct,hz:It,lineColor:q&&S?"white":c,lineWidth:q&&S?u*3:u}),A&&d&&h.jsx(mw,{hx:ht,hy:ct,hz:It,lineColor:B0,lineWidth:u*5}),De.show&&h.jsx("group",{position:[0,0,It+.01],children:h.jsx(NSe,{hx:ht,hy:ct,position:De.position,direction:De.direction,color:"black"})}),h.jsx("group",{position:[0,0,It+.01],children:ue.map((fn,tn)=>fn.show?h.jsx(NSe,{hx:ht,hy:ct,position:fn.position,direction:fn.direction,color:"yellow"},tn):null)}),A&&!d&&h.jsxs(h.Fragment,{children:[h.jsx(si,{ref:We,position:[Ft.x,Ft.y,0],args:[Ge,Ge,a*1.2],name:Mt.LowerLeft,onPointerDown:fn=>{L(e,fn,Xo.Resize),We.current&&v(tn=>{const Ot=We.current.localToWorld(new ae(r,i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.LowerLeft)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Mt.LowerLeft||M.getState().resizeHandleType===Mt.LowerLeft?ga:$a})}),h.jsx(si,{ref:Ee,position:[Ve.x,Ve.y,0],args:[Ge,Ge,a*1.2],name:Mt.UpperLeft,onPointerDown:fn=>{L(e,fn,Xo.Resize),Ee.current&&v(tn=>{const Ot=Ee.current.localToWorld(new ae(r,-i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.UpperLeft)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Mt.UpperLeft||M.getState().resizeHandleType===Mt.UpperLeft?ga:$a})}),h.jsx(si,{ref:ke,position:[ft.x,ft.y,0],args:[Ge,Ge,a*1.2],name:Mt.LowerRight,onPointerDown:fn=>{L(e,fn,Xo.Resize),ke.current&&v(tn=>{const Ot=ke.current.localToWorld(new ae(-r,i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.LowerRight)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Mt.LowerRight||M.getState().resizeHandleType===Mt.LowerRight?ga:$a})}),h.jsx(si,{ref:Oe,position:[kt.x,kt.y,0],args:[Ge,Ge,a*1.2],name:Mt.UpperRight,onPointerDown:fn=>{L(e,fn,Xo.Resize),Oe.current&&v(tn=>{const Ot=Oe.current.localToWorld(new ae(-r,-i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.UpperRight)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===Mt.UpperRight||M.getState().resizeHandleType===Mt.UpperRight?ga:$a})}),!$&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:st,args:[at,6,6,0,Math.PI],position:[0,-ct-at,0],name:zo.Lower,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Lower,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Lower)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===zo.Lower||M.getState().moveHandleType===zo.Lower?ga:QF})}),h.jsx(Ps,{ref:je,args:[at,6,6,0,Math.PI],position:[0,ct+at,0],name:zo.Upper,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Upper,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Upper)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===zo.Upper||M.getState().moveHandleType===zo.Upper?ga:QF})}),h.jsx(Ps,{ref:xt,args:[at,6,6,0,Math.PI],position:[-ht-at,0,0],name:zo.Left,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Left,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Left)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===zo.Left||M.getState().moveHandleType===zo.Left?ga:iw})}),h.jsx(Ps,{ref:gt,args:[at,6,6,0,Math.PI],position:[ht+at,0,0],name:zo.Right,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Right,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!ye.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Right)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:Z===zo.Right||M.getState().moveHandleType===zo.Right?ga:iw})}),h.jsx(dX,{id:e,position:[0,-Pt,0],color:Z===Di.Lower||M.getState().rotateHandleType===Di.Lower?ga:$a,ratio:yt,handleType:Di.Lower,hoverHandle:Ao,noHoverHandle:wo}),h.jsx(dX,{id:e,position:[0,Pt,0],color:Z===Di.Upper||M.getState().rotateHandleType===Di.Upper?ga:$a,ratio:yt,handleType:Di.Upper,hoverHandle:Ao,noHoverHandle:wo})]})]}),!$&&h.jsxs(h.Fragment,{children:[(me||f)&&!A&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(t!=null&&t.label?t.label:Y.t("shared.FoundationElement",At))+(d?" ("+Y.t("shared.ElementLocked",At)+")":""),color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??It+.2]}),!d&&Z===Mt.LowerLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LL",text:"LL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-ht,-ct,It+.2]}),!d&&Z===Mt.UpperLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UL",text:"UL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-ht,ct,It+.2]}),!d&&Z===Mt.LowerRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LR",text:"LR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[ht,-ct,It+.2]}),!d&&Z===Mt.UpperRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UR",text:"UR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[ht,ct,It+.2]})]}),g===Dn.FocusPipe&&h.jsx(uZt,{foundation:t}),g===Dn.FocusTower&&h.jsx(cZt,{foundation:t}),g===Dn.UpdraftTower&&h.jsx(sZt,{foundation:t}),h.jsx(ZZt,{...t})]})})}),qye="Handles Intersection Plane",Kz=t=>{if(t.intersections.length>0){for(const e of t.intersections)if(e.eventObject.name===qye)return e.point.z<0?null:e.point}return null},Q7=(t,e)=>new ae().subVectors(t,new ae(e.cx,e.cy,e.lz)).applyEuler(new ln(0,0,-e.rotation[2])),U$e=(t,e,n,o,r)=>{const[i,a]=[e/2,n/2],[l,s,c]=o,u=new ln().fromArray([l-Qt,s,c,"ZXY"]),d=r.map(f=>({x:f.x,y:f.y}));for(let f=-1;f<=1;f+=2)for(let p=-1;p<=1;p+=2){const g=new ae(i*f,0,a*p).applyEuler(u),A=new ae().addVectors(t,g);if(!ye.isPointInside(A.x,A.y,d))return!1}return!0},cen=(t,e,n,o,r,i,a)=>{const l=n/2,[s,c,u]=i,d=new ln().fromArray([s-Qt,c,u,"ZXY"]),f=a.map(g=>({x:g.x,y:g.y})),p=new ae().addVectors(t,new ae(o*e,0,l+r).applyEuler(d));return!(!ye.isPointInside(p.x,p.y,f)||!U$e(t,e,n,i,a))},uen=(t,e,n)=>{if(t.intersections.length>0)for(const o of t.intersections){const r=o.eventObject.name;if(r.includes("Window")&&r.includes(e)&&o.object.name!==qye)return null;if(r.includes("Roof")&&r.includes(n)){const i=o.point.clone(),a=Number.parseInt(o.object.name.split(" ").pop()??"-1");return{pointer:i,segmentIdx:a}}}return null},YSe=t=>{switch(t){case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:return!0}return!1},den=(t,e,n)=>{const o=new ae().subVectors(e,t).applyEuler(new ln(0,0,-n)),r=Math.abs(o.x),i=Math.hypot(o.y,o.z),a=new ae().addVectors(t,e).divideScalar(2);return{newLx:r,newLz:i,newCenter:a}},fen=(t,e,n)=>n===Go.Gambrel?Vye(t).map(o=>o.add(e)):t.map(o=>o.points[0].clone().add(e)),OSe=(t,e,n)=>{M.getState().set(o=>{const r=o.elements.find(i=>i.id===t&&i.type===z.Window);r&&([r.cx,r.cy,r.cz]=e,r.rotation=[...n])})},VSe=(t,e,n,o)=>{M.getState().set(r=>{const i=r.elements.find(a=>a.id===t&&a.type===z.Window);i&&([i.cx,i.cy,i.cz]=e,[i.lx,i.ly,i.lz]=n,o!=null&&(i.archHeight=o))})},_Se=(t,e)=>{M.getState().set(n=>{const o=n.elements.find(r=>r.id===t&&r.type===z.Window);o&&(o.polygonTop=[...e])})},hen=(t,e,n=.01)=>{if(t.type!==z.SolarPanel&&t.type!==z.Window)return null;const o=new ln().fromArray([t.rotation[0],t.rotation[1],t.rotation[2],"ZXY"]),r=new ae,i=t.lx/2+n;let a=n;t.type===z.SolarPanel?(a+=t.ly/2,r.set(t.cx*e.lx,t.cy*e.ly,0)):(a+=t.lz/2,r.set(t.cx,t.cy,0));const l=[];for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=new ae(s*i,s*c*a).applyEuler(o).add(r);l.push(u)}if(t.type===z.Window&&t.windowType===Ci.Polygonal){const[s,c]=t.polygonTop??Gp,u=new ae(s*i,c+a).applyEuler(o).add(r);l.push(u)}return l},tae=t=>{if(t.windowType===Ci.Polygonal)return t.polygonTop??Gp},j$e=({z:t})=>{const e=m.useRef(null),[n,o]=m.useState("white");return h.jsx(si,{ref:e,name:Mt.Arch,args:[.2,.2,.2],position:[0,0,t],onPointerEnter:()=>{o("red")},onPointerLeave:()=>{o("white")},children:h.jsx("meshBasicMaterial",{color:n})})},pen=({id:t,parentId:e,foundationId:n,lx:o,lz:r,polygonTop:i,rotation:a,windowType:l,parentType:s})=>{const c=M(te=>te.addedWindowId),u=M(En),d=c===t,f=s===z.Roof,p=m.useRef(null),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),C=m.useRef(null),P=m.useRef(null),v=m.useRef(null),T=m.useRef([]),w=m.useRef(null),x=m.useRef(null),b=m.useRef(null),R=m.useRef(null),H=m.useRef(null),[F,E]=m.useState(!1),[N,U]=[o/2,r/2],[W,k]=i,D=m.useMemo(()=>o*W,[o,W]),L=M(pn),j=(te,oe,de)=>{if(!n)return null;const he=M.getState().elements.find(Re=>Re.id===n&&Re.type===z.Foundation);if(!he)return null;const pe=te.object.localToWorld(new ae),[me,le,Te]=a,ge=new ln().fromArray([me-Qt,le,Te+he.rotation[2],"ZXY"]),Se=new ae(oe,0,de).applyEuler(ge);return new ae().addVectors(pe,Se)},B=te=>{let oe,de,he;for(const fe of M.getState().elements)fe.id===t&&fe.type===z.Window?oe=fe:fe.id===n&&fe.type===z.Foundation?de=fe:fe.id===e&&fe.type===z.Roof&&(he=fe);const pe=kn.getState().contentRef;if(!oe||!de||!he||!pe||!pe.current)return;const me=de.id,le=pe.current.children.find(fe=>fe.name===`${Fm} ${me}`);if(!le)return;const Te=le.children.find(fe=>fe.name===L$e);if(!Te)return;const ge=Te.children.find(fe=>fe.name.includes("Roof")&&fe.name.includes(e));if(!ge)return;const Se=ge.children[0];if(!Se)return;for(const fe of M.getState().elements)if(fe.parentId===e&&fe.id!==t){const ve=hen(fe,de);ve&&T.current.push(ve)}const{centroid:Re,roofSegments:De}=Se.userData,ue=new ae(oe.cx,oe.cy,oe.cz+de.lz).clone().sub(Re);p.current=te,g.current=de,A.current=he,C.current=bn.getSegmentIdx(De,ue),S.current=Re,y.current=De,v.current=fen(y.current,S.current,he.roofType),w.current=[oe.cx,oe.cy,oe.cz],b.current=[oe.lx,oe.ly,oe.lz],x.current=[...oe.rotation],R.current=oe.archHeight,H.current=oe.polygonTop??null},O=()=>{if(!w.current||!x.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const oe={name:"Move skylight",timestamp:Date.now(),id:te.id,oldPosition:[...w.current],newPosition:[te.cx,te.cy,te.cz],oldRotation:[...x.current],newRotation:[...te.rotation],undo(){OSe(oe.id,oe.oldPosition,oe.oldRotation)},redo(){OSe(oe.id,oe.newPosition,oe.newRotation)}};u(oe)},V=()=>{if(!b.current||!w.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const oe={name:"Resize skylight",timestamp:Date.now(),id:te.id,oldPosition:[...w.current],newPosition:[te.cx,te.cy,te.cz],oldDimension:[...b.current],newDimension:[te.lx,te.ly,te.lz],oldArchHeight:R.current,newArchHeight:te.archHeight,undo(){VSe(this.id,this.oldPosition,this.oldDimension,this.oldArchHeight)},redo(){VSe(this.id,this.newPosition,this.newDimension,this.newArchHeight)}};u(oe)},G=()=>{if(!H.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const oe={name:"Resize skylight top vertex",timestamp:Date.now(),id:te.id,oldPolygonTop:[...H.current],newPolygonTop:te.polygonTop??Gp,undo(){_Se(this.id,this.oldPolygonTop)},redo(){_Se(this.id,this.newPolygonTop)}};u(oe)},q=te=>te.roofType===Go.Gable?!1:Math.abs(te.rise)<.001,$=te=>{if(A.current&&q(A.current))return v.current;if(te!=null){const de=Cn.getState().getRoofSegmentVertices(e);if(!de)return;const he=te===-1?de.length-1:te;return de[he]}},ie=(te,oe,de,he,pe)=>{const[me,le]=[oe/2,de/2],Te=new ln().fromArray([he[0],he[1],he[2],"ZXY"]),ge=[];for(let Se=-1;Se<=1;Se+=2)for(let Re=-1;Re<=1;Re+=2){const De=new ae(Se*me,Se*Re*le).applyEuler(Te).add(te);ge.push(De)}if(pe){const[Se,Re]=pe,De=new ae(Se*me*2,Re+le).applyEuler(Te).add(te);ge.push(De)}for(const Se of T.current){for(const Re of ge)if(ye.isPointInside(Re.x,Re.y,Se))return!1;for(const Re of Se)if(ye.isPointInside(Re.x,Re.y,ge))return!1}return!0},Q=(te,oe,de,he,pe,me)=>{if(me){const[le,Te]=me;return cen(oe,de,he,le,Te,pe,te)}else return U$e(oe,de,he,pe,te)},se=te=>{if(!f||d)return;const oe=te.object.name;switch(oe){case zo.Mid:break;case Mt.LowerLeft:{P.current=j(te,o,r);break}case Mt.LowerRight:{P.current=j(te,-o,r);break}case Mt.UpperLeft:{P.current=j(te,o,-r);break}case Mt.UpperRight:{P.current=j(te,-o,-r);break}case Mt.Arch:{P.current=j(te,0,-r);break}case Mt.Upper:break;default:return}B(oe),E(!0),kn.getState().setEnableOrbitController(!1)},Z=te=>{if(p.current===null||!g.current||!A.current||!y.current||!S.current||!v.current)return;const oe=g.current;if(p.current===zo.Mid){const de=A.current,he=uen(te,t,e),pe=new ae;if(q(de)){const me=Kz(te);if(!me)return;pe.copy(me);const le=Q7(pe,oe);L(Te=>{if(!v.current)return;const ge=Te.elements.find(we=>we.id===t&&we.type===z.Window);if(!ge)return;const{lx:Se,lz:Re,rotation:De}=ge,Ae=v.current,ue=tae(ge),fe=Q(Ae,le,Se,Re,De,ue),ve=ie(le,Se,Re,De,ue);fe&&ve&&(ge.cx=le.x,ge.cy=le.y,ge.cz=le.z)})}else{if(he&&he.segmentIdx!==C.current){const Re=he.pointer;pe.copy(Re)}else{const Re=Kz(te);if(!Re)return;pe.copy(Re)}const me=Q7(pe,oe),le=me.clone().sub(S.current),{rotation:Te,segmentVertices:ge,segmentIdx:Se}=bn.computeState(y.current,le);ge?me.setZ(bn.getRooftopElementZ(ge,le,S.current.z+de.thickness)):me.setZ(S.current.z+de.thickness),L(Re=>{const De=Cn.getState().getRoofSegmentVertices(e);if(!De)return;const Ae=Se===-1?De.length-1:Se,ue=De[Ae];if(!ue)return;const fe=Re.elements.find(ze=>ze.id===t&&ze.type===z.Window);if(!fe)return;const{lx:ve,lz:we}=fe,Pe=tae(fe),Ie=Q(ue,me,ve,we,Te,Pe),Me=ie(me,ve,we,Te,Pe);Ie&&Me&&(fe.cx=me.x,fe.cy=me.y,fe.cz=me.z,fe.rotation=[...Te],he&&he.segmentIdx!==C.current&&(C.current=he.segmentIdx))})}}else if(YSe(p.current)){const de=$(C.current),he=Kz(te),pe=P.current;if(!he||!pe||!de)return;const me=Q7(he,oe),le=Q7(pe,oe),{newLx:Te,newLz:ge,newCenter:Se}=den(le,me,a[2]);M.getState().set(Re=>{const De=Re.elements.find(ve=>ve.id===t&&ve.type===z.Window);if(!De)return;const Ae=tae(De),ue=Q(de,Se,Te,ge,a,Ae),fe=ie(Se,Te,ge,a,Ae);ue&&fe&&(De.cx=Se.x,De.cy=Se.y,De.cz=Se.z,De.lx=Te,De.lz=Math.max(.001,ge))})}else if(p.current===Mt.Upper){const de=$(C.current),he=Kz(te);if(!he||!de)return;const pe=Q7(he,oe);L(me=>{const le=me.elements.find(Ee=>Ee.id===t);if(!le)return;const[Te,ge]=[le.lx/2,le.lz/2],Se=new ae(le.cx,le.cy,le.cz),Re=new ln().fromArray([le.rotation[0],le.rotation[1],le.rotation[2],"ZXY"]),De=new ae(-Te,-ge,0).applyEuler(Re).add(Se),Ae=new ae(Te,-ge,0).applyEuler(Re).add(Se),ue=new ae().subVectors(pe,De),fe=new ae().subVectors(Ae,De).normalize(),ve=ue.clone().projectOnVector(fe).applyEuler(new ln(0,0,-le.rotation[2])),we=ye.clamp((ve.x-Te)/le.lx,-.5,.5),Pe=bn.getDistance(De,Ae,pe),Ie=Math.hypot(Pe,pe.z-De.z),Me=Math.max(0,Ie-le.lz),ze=[we,Me],Ne=new ae(le.cx,le.cy,le.cz),{lx:Je,lz:Ue}=le,nt=Q(de,Ne,Je,Ue,a,ze),We=ie(Ne,Je,Ue,a,ze);nt&&We&&(le.polygonTop=[...ze])})}else if(p.current===Mt.Arch){const de=Kz(te),he=P.current,pe=$(C.current);if(!de||!he||!pe)return;const me=Q7(de,oe),le=Q7(he,oe);L(Te=>{const ge=Te.elements.find(Me=>Me.id===t&&Me.type===z.Window);if(!ge)return;const[Se,Re]=[ge.lx/2,ge.lz/2],De=new ae(ge.cx,ge.cy,ge.cz),Ae=new ln().fromArray([ge.rotation[0],ge.rotation[1],ge.rotation[2],"ZXY"]),ue=new ae(-Se,-Re,0).applyEuler(Ae).add(De),fe=new ae(Se,-Re,0).applyEuler(Ae).add(De),ve=bn.getDistance(ue,fe,me);let we=Math.hypot(ve,me.z-ue.z);const Pe=Math.min(ge.archHeight,ge.lz,ge.lx/2),Ie=ge.lz-Pe;if(we>Ie&&we{p.current===zo.Mid?O():YSe(p.current)?V():p.current===Mt.Upper?G():p.current===Mt.Arch&&V(),w.current=null,b.current=null,x.current=null,R.current=null,H.current=null,p.current=null,g.current=null,A.current=null,y.current=null,S.current=null,C.current=null,P.current=null,v.current=null,T.current=[],E(!1),kn.getState().setEnableOrbitController(!0)};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Handle Wrapper",onPointerDown:se,children:[!d&&h.jsxs(h.Fragment,{children:[l===Ci.Polygonal&&h.jsx(Sv,{x:D,z:U+k,handleType:Mt.Upper,scale:[.5,1,1.5]}),h.jsx(Sv,{x:-N,z:U,handleType:Mt.UpperLeft}),h.jsx(Sv,{x:N,z:U,handleType:Mt.UpperRight}),h.jsx(Sv,{x:-N,z:-U,handleType:Mt.LowerLeft}),h.jsx(Sv,{x:N,z:-U,handleType:Mt.LowerRight}),l===Ci.Arched&&h.jsx(j$e,{z:U})]}),h.jsx(Cxt,{handleType:zo.Mid})]}),f&&F&&h.jsx(ta,{name:qye,args:[1e3,1e3],rotation:[Qt,0,0],onPointerMove:Z,onPointerUp:ee,visible:!1,children:h.jsx("meshBasicMaterial",{color:"red",side:ti,transparent:!0,opacity:.5})})]})},gen=be.memo(pen),men=new pf({color:"white",side:ti}),yen=be.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i]=t,{width:a,horizontalMullionSpacing:l,verticalMullionSpacing:s,color:c}=e,u=3,d=1,f=a/2,p=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),g=m.useMemo(()=>{const y=[],S=Math.round(o/s)-1;if(S<=0||a===0)return y;const C=o/(S+1);let P=C/2;S%2!==0&&(y.push(0),P=C);for(let v=0;v{const y=[],S=Math.round(i/l)-1;if(S<=0||a===0)return y;const C=i/(S+1);let P=C/2;S%2!==0&&(y.push(0),P=C);for(let v=0;vh.jsx(ma,{position:[y,25e-5,0],args:[f,f,i,u,d],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:p},S)),e.horizontalMullion&&A.map((y,S)=>h.jsx(ma,{position:[0,5e-4,y],args:[f,f,o,u,d],rotation:[0,0,Qt],receiveShadow:n,castShadow:n,children:p},S))]})}),Aen=be.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i]=t,{color:a,width:l,sillWidth:s}=e,c=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]),u=l/2,d=u/2,f=o+l*3,p=l;return h.jsxs("group",{name:"Window Frame Group",position:[0,-d/2,0],children:[h.jsx(si,{position:[0,0,i/2],args:[o+2*l,d,l],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[-o/2-u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[o/2+u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[0,0,-i/2-(s===0?0:p/2)],args:s===0?[o+2*l,d,l]:[f,s??l,p],castShadow:n,receiveShadow:n,children:c})]})}),wen=be.memo(({cy:t,dimension:e,wireframeData:n})=>{const[o,r,i]=e,{lineWidth:a,lineColor:l,selected:s,locked:c,opacity:u}=n,d=o/2,f=i/2,p=3,g=1,A=m.useMemo(()=>new pf({color:l}),[l]),y=m.useMemo(()=>new pf({color:B0}),[]),S=(C,P)=>{const v=C/2;return h.jsxs(h.Fragment,{children:[h.jsx(ma,{args:[C,C,o,p,g],rotation:[0,0,Qt],position:[0,0,f-v],material:P}),h.jsx(ma,{args:[C,C,o,p,g],rotation:[0,0,Qt],position:[0,0,-f+v],material:P}),h.jsx(ma,{args:[C,C,i,p,g],rotation:[Qt,Qt,0],position:[d-v,0,0],material:P}),h.jsx(ma,{args:[C,C,i,p,g],rotation:[Qt,Qt,0],position:[-d+v,0,0],material:P})]})};return h.jsxs("group",{name:"Window Wireframe Group",children:[u>0&&h.jsx("group",{position:[0,t,0],children:S(a/20,A)}),c&&s&&S(a/5,y)]})}),ven=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=M(Cs),T=Cn(Ib),w=m.useRef(0),x=m.useRef(),[b,R,H]=e,[F,E,N]=n,U=m.useMemo(()=>{if(!d||g||A&&A.notBuilding)return;const L=T.get(t);if(!L)return;const j=L.reduce((Q,se)=>Q+se,0);if(f===0)return;const B=i3*(y.solarRadiationHeatmapGridCellSize??.5),O=Math.max(2,Math.round(b/B)),V=Math.max(2,Math.round(H/B)),G=b/O,q=H/V,$=j/f*(S??Qm);w.current=$<0?1:0,x.current=ye.getEuler(ko,Yc,"YXZ",Math.sign($)*Qt);const ie=[];if($<0)for(let Q=0;Qc*b,[b,c]),k=m.useMemo(()=>(W+r.width+b)/2*1.025,[b,W,r.width]),D=(L,j,B)=>h.jsx(ta,{name:"Window Seal Plane",args:L,position:j,rotation:B,material:men,receiveShadow:v,castShadow:v});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Rectangle Window Plane Group",position:[0,E,0],children:[h.jsx(ta,{name:"Window Glass Plane",args:[b,H],rotation:[Qt,0,0],children:u}),(o.horizontalMullion||o.verticalMullion)&&h.jsx(yen,{dimension:e,mullionData:o,shadowEnabled:v})]}),r.showFrame&&h.jsx(Aen,{dimension:e,frameData:r,shadowEnabled:v}),h.jsx(Qye,{cx:k,lx:W,lz:H,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),h.jsx(wen,{cy:E,dimension:e,wireframeData:i}),D([R,H],[-b/2+.001,R/2,0],[Qt,Qt,0]),D([R,H],[b/2-1e-4,R/2,0],[Qt,-Qt,0]),D([b,R],[0,R/2,H/2-.001],[Math.PI,0,0]),D([b,R],[0,R/2,-H/2+.001]),U&&U.map((L,j)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:L,name:"Heat Flux "+j,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:L[w.current].clone().add(new ae(0,w.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},j))]})},xen=be.memo(ven),$ye=({element:t})=>{const e=M(m0),n=M(Ug),o=M(ly),r=t.lx/2,i=t.lz/2,a=.05,l=1,s=.5,c=t.lineColor??"white",u="darkorchid",d=Math.max(.25,(r+i)/32),f=.25,p=30,g=-.1,A=m.useMemo(()=>({lng:e}),[e]),y=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[-r-f,g,0]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f,0,-i],[-r-f,0,i]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f+a,0,-i+3*a],[-r-f,0,-i],[-r-f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f+a,0,i-3*a],[-r-f,0,i],[-r-f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r-f*2,0,-i]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i],[-r-f*2,0,i]],color:c,linewidth:s})]}),[r,i,A]),S=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[r+f,g,0]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f,0,-i],[r+f,0,i]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f+a,0,-i+3*a],[r+f,0,-i],[r+f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f+a,0,i-3*a],[r+f,0,i],[r+f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,-i],[r+f*2,0,-i]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,i],[r+f*2,0,i]],color:c,linewidth:s})]}),[r,i,A]),C=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,g,-i-f]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i-f],[r,0,-i-f]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r+3*a,0,-i-f-a],[-r,0,-i-f],[-r+3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r-3*a,0,-i-f-a],[r,0,-i-f],[r-3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r,0,-i-f*2]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,-i],[r,0,-i-f*2]],color:c,linewidth:s})]}),[r,i,A]),P=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,g,i+f]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i+f],[r,0,i+f]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r+3*a,0,i+f-a],[-r,0,i+f],[-r+3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r-3*a,0,i+f-a],[r,0,i+f],[r-3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i],[-r,0,i+f*2]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,i],[r,0,i+f*2]],color:c,linewidth:s})]}),[r,i,A]);if(n)switch(n){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[y,C]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[S,C]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[y,P]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[S,P]})}if(o)switch(o){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[y,C]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[S,C]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[y,P]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[S,P]})}return h.jsx(h.Fragment,{})};be.memo($ye);const Qye=({cx:t,cz:e=0,lx:n,lz:o,color:r,showLeft:i,showRight:a,spacing:l})=>{const s=M(Cs),c=dt(hs),u=dt(p3);return c||u?null:h.jsxs("group",{name:"Shutter Group",children:[a&&h.jsx(si,{args:[n,.1,o],position:[t+l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})}),i&&h.jsx(si,{args:[n,.1,o],position:[-t-l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})})]})},cde="Window Group",Gp=[0,.5],ben=t=>{const{id:e,parentId:n,foundationId:o,cx:r,cy:i,cz:a,lx:l,ly:s,lz:c,rotation:u,locked:d,lineWidth:f=.2,lineColor:p="black",horizontalMullion:g=!0,verticalMullion:A=!0,mullionWidth:y=.06,horizontalMullionSpacing:S=.5,verticalMullionSpacing:C=.5,tint:P="#73D8FF",opacity:v=.5,leftShutter:T=!1,rightShutter:w=!1,shutterColor:x="gray",shutterWidth:b=.5,mullionColor:R="white",frame:H=!1,color:F="white",frameWidth:E=.1,sillWidth:N=.1,windowType:U=Ci.Default,archHeight:W,parentType:k=z.Wall,polygonTop:D=Gp}=t,L=`${cde} ${e}`,j=M(pn),B=M(yA),O=dt(bh),V=M(vBe),G=Tc(e),q=(Se=!1)=>{j(Re=>{if(Re.contextMenuObjectType=null,Re.groupActionMode)Re.multiSelectionsMode||Re.selectedElementIdSet.clear(),t.foundationId&&(Re.selectedElementIdSet.has(n)?Re.selectedElementIdSet.delete(n):Re.selectedElementIdSet.add(t.foundationId));else for(const De of Re.elements)if(De.id===e)if(De.selected=!0,Re.selectedElement=De,Se)if(Re.selectedElementIdSet.has(e))for(const Ae of Re.elements)Re.selectedElementIdSet.has(Ae.id)&&Ae.type!==Re.selectedElement.type&&Re.selectedElementIdSet.delete(Ae.id);else if(Re.multiSelectionsMode){Re.selectedElementIdSet.add(e);for(const Ae of Re.elements)Re.selectedElementIdSet.has(Ae.id)&&Ae.type!==Re.selectedElement.type&&Re.selectedElementIdSet.delete(Ae.id)}else Re.selectedElementIdSet.clear(),Re.selectedElementIdSet.add(e);else Re.multiSelectionsMode?Re.selectedElementIdSet.has(e)?Re.selectedElementIdSet.delete(e):Re.selectedElementIdSet.add(e):(Re.selectedElementIdSet.clear(),Re.selectedElementIdSet.add(e));else De.selected=!1})},$=Se=>Se.intersections.length>0&&Se.intersections[0].eventObject.name===L&&!M.getState().moveHandleType&&!M.getState().resizeHandleType&&!M.getState().isAddingElement()&&M.getState().objectTypeToAdd===z.None,ie=Se=>{if(Se.eventObject.name===L&&Se.intersections.length>0)switch(Se.object.name){case zo.Mid:case Mt.UpperLeft:case Mt.UpperRight:case Mt.LowerLeft:case Mt.LowerRight:case Mt.Arch:case Mt.Upper:return!0}return!1},Q=(Se,Re)=>{kn.getState().setEnableOrbitController(!1),O("showWallIntersectionPlaneId",n),j(De=>{De.resizeHandleType=Se,De.resizeAnchor.copy(new ae(r,0,a).add(Re))})},se=Se=>{if(!(Se.button===2||M.getState().addedWallId)&&($(Se)&&q(),ie(Se))){const Re=Se.intersections[0].eventObject.name;switch(Re){case zo.Mid:{kn.getState().setEnableOrbitController(!1),dt.getState().set(De=>{De.showWallIntersectionPlaneId=n,De.oldParentId=n,De.oldFoundationId=o}),j(De=>{De.moveHandleType=Re,De.selectedElement=De.elements.find(Ae=>{var ue;return Ae.id===((ue=De.selectedElement)==null?void 0:ue.id)})});break}case Mt.UpperLeft:{Q(Re,new ae(l/2,0,-c/2));break}case Mt.UpperRight:{Q(Re,new ae(-l/2,0,-c/2));break}case Mt.LowerLeft:{Q(Re,new ae(l/2,0,c/2));break}case Mt.LowerRight:{Q(Re,new ae(-l/2,0,c/2));break}case Mt.Arch:{Q(Re,new ae(0,0,0));break}case Mt.Upper:{Q(Re,new ae(0,0,c/2));break}}}},Z=Se=>{M.getState().addedWallId||$(Se)&&(q(!0),j(Re=>{Re.contextMenuObjectType=z.Window}))},ee=m.useMemo(()=>{if(k===z.Roof){const[Se,Re,De]=u;return new ln().fromArray([Se-Qt,Re,De,"ZXY"])}else return new ln},[k,u]),te=m.useMemo(()=>h.jsx("meshPhongMaterial",{specular:new rr("white"),shininess:V??mG,color:P,side:ti,opacity:v,transparent:!0}),[V,P,v]),oe=m.useMemo(()=>W!==void 0?[l,s,c,W]:[l,s,c],[l,s,c,W]),de=m.useMemo(()=>k===z.Roof?[r,.05,a]:[r,i,a],[r,i,a,k]),he=m.useMemo(()=>({horizontalMullion:g,verticalMullion:A,width:y,horizontalMullionSpacing:S,verticalMullionSpacing:C,color:R}),[g,A,y,S,C,R]),pe=m.useMemo(()=>({showFrame:H,width:E,color:F,sillWidth:N}),[H,E,F,N]),me=m.useMemo(()=>({lineColor:p,lineWidth:f,selected:G,locked:d,opacity:v}),[p,f,G,d,v]),le=dt(p3),Te=()=>{switch(U){case Ci.Default:return h.jsx(xen,{id:t.id,dimension:oe,position:de,mullionData:he,frameData:pe,wireframeData:me,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,glassMaterial:te,showHeatFluxes:le,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:B(t)});case Ci.Arched:return h.jsx(jxt,{id:t.id,dimension:oe,position:de,mullionData:he,frameData:pe,wireframeData:me,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,glassMaterial:te,showHeatFluxes:le,area:ye.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:B(t)});case Ci.Polygonal:return h.jsx(Xxt,{id:t.id,dimension:oe,polygonTop:D,position:de,glassMaterial:te,empty:!!t.empty,interior:!!t.interior,wireframeData:me,frameData:pe,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,showHeatFluxes:le,area:ye.getWindowArea(t),foundation:B(t)})}},ge=k===z.Roof?i:0;return h.jsxs("group",{name:L,position:[r,ge,a],rotation:ee,onPointerDown:se,onContextMenu:Z,onPointerMove:()=>{},children:[Te(),G&&h.jsx($ye,{element:t}),G&&!d&&h.jsx(gen,{id:e,parentId:n,foundationId:o,lx:l,lz:c,polygonTop:D,rotation:u,windowType:U,parentType:k})]},e)},B$e=be.memo(ben),Sen=be.memo(({lineColor:t="black",lineWidth:e=.2,hx:n,hz:o,fill:r,isTopPartial:i,leftUnfilledHeight:a,rightUnfilledHeight:l,showParapet:s=!1,leftHeight:c=2*o,rightHeight:u=2*o,center:d,centerLeft:f,centerRight:p})=>{const g=M(T=>T.viewState.orthographic),A=[-n,-o+.001+(r===Fl.Partial?a:0),.001],y=[n,-o+.001+(r===Fl.Partial?l:0),.001],S=[-n,c-o-.001,.001],C=[n,u-o-.001,.001],P=n*2,v=[];if(g)e=2,v.push(S,C);else if(s)v.push(S,A,y,C);else if(i)v.push(A,S,C,y,A);else{if(v.push(A,S),f){const T=[f[0]*P,f[1]-o,.001];v.push(T)}if(d){const T=[d[0]*P,d[1]-o,.001];v.push(T)}if(p){const T=[p[0]*P,p[1]-o,.001];v.push(T)}v.push(C,y)}return h.jsx(be.Fragment,{children:h.jsx(Gn,{rotation:[Qt,0,0],points:v,color:t,lineWidth:e})})});var Rd=(t=>(t.Default="Default",t.Arched="Arched",t))(Rd||{});const Ten=be.memo(({dimension:t,lineColor:e,lineWidth:n})=>{const[o,r,i]=t.map(u=>u/2),a=[-o,0,i+.05],l=[o,0,i+.05],s=[-o,0,-i],c=[o,0,-i];return h.jsx(Gn,{points:[s,a,l,c],lineWidth:n,color:e})}),Pen=be.memo(({dimension:t,color:e})=>{const[n,o,r]=t,i=M(Cs),a=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:e}),[e]),l=.1,s=l/2;return h.jsxs("group",{name:"Door frame group",children:[h.jsx(si,{position:[0,0,r/2],args:[n,l,l],castShadow:i,receiveShadow:i,children:a}),h.jsx(si,{position:[-n/2+s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a}),h.jsx(si,{position:[n/2-s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a})]})}),Cen=be.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,area:s,showHeatFluxes:c,foundation:u})=>{const d=M.getState().world,f=M(e5),p=M(a3),g=M(l3),A=M(Cs),y=Cn(Ib),S=m.useRef(0),C=m.useRef(),[P,v,T]=e,w=m.useMemo(()=>{if(!c||u&&u.notBuilding)return;const b=y.get(t);if(!b)return;const R=b.reduce((D,L)=>D+L,0);if(s===0)return;const H=i3*(d.solarRadiationHeatmapGridCellSize??.5),F=Math.max(2,Math.round(P/H)),E=Math.max(2,Math.round(T/H)),N=P/F,U=T/E,W=R/s*(f??Qm);S.current=W<0?1:0,C.current=ye.getEuler(ko,Yc,"YXZ",Math.sign(W)*Qt);const k=[];if(W<0)for(let D=0;D{const b=new kl,[R,H]=[P/2,T/2],F=Math.max(R,H)*.2;return b.moveTo(-R,-H),b.lineTo(-R,H),b.lineTo(R,H),b.lineTo(R,-H),l||(b.lineTo(R-F,-H),b.lineTo(R-F,H-F),b.lineTo(-R+F,H-F),b.lineTo(-R+F,-H)),b.closePath(),b},[P,T,l]);return h.jsxs("group",{name:"Rectangle door group",position:[0,-.01,0],children:[h.jsx("mesh",{name:"Rectangular Door Mesh",rotation:[Qt,0,0],material:a,castShadow:A&&l,receiveShadow:A&&l,children:h.jsx("shapeGeometry",{args:[x]})}),l&&h.jsxs("mesh",{name:"Rectangular Door Simulation Mesh",rotation:[Qt,0,0],uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[x]}),h.jsx("meshBasicMaterial",{side:ti})]}),l&&h.jsx("mesh",{name:"Door plane inside",position:[0,.1,0],rotation:[-Qt,0,Math.PI],material:a,castShadow:A&&l,receiveShadow:A&&l,children:h.jsx("shapeGeometry",{args:[x]})}),h.jsx(Ten,{dimension:e,lineColor:r&&i?B0:"black",lineWidth:r&&i?2:.2}),h.jsx(Pen,{dimension:e,color:o}),w&&w.map((b,R)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:b,name:"Heat Flux "+R,lineWidth:g??Zm,color:p??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:b[S.current].clone().add(new ae(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:p??p0})})]},R))]})}),Ren=be.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,showHeatFluxes:s,area:c,foundation:u})=>{const d=M.getState().world,f=M(Cs),p=M(e5),g=M(a3),A=M(l3),y=Cn(Ib),S=m.useRef(0),C=m.useRef(),[P,v,T,w]=e,x=(F,E)=>{if(w>0){const N=.5*P,U=.5*T,W=Math.min(w,T,N),k=.5*(W+N*N/W);if(Math.abs(F)-U)return!0;const D=E-(T-k-U);return F*F+D*D{if(!s||u&&u.notBuilding)return;const F=y.get(t);if(!F)return;const E=F.reduce((B,O)=>B+O,0);if(c===0)return;const N=i3*(d.solarRadiationHeatmapGridCellSize??.5),U=Math.max(2,Math.round(P/N)),W=Math.max(2,Math.round(T/N)),k=P/U,D=T/W,L=E/c*(p??Qm);S.current=L<0?1:0,C.current=ye.getEuler(ko,Yc,"YXZ",Math.sign(L)*Qt);const j=[];if(L<0)for(let B=0;B{const F=new kl,E=P/2,N=T/2,U=Math.min(w,T,E);if(F.moveTo(E,-N),F.lineTo(E,N-U),U>.1){const W=U/2+P**2/(8*U),[k,D]=[0,N-W],L=Math.acos(Math.min(E/W,1)),j=Math.PI-L;F.absarc(k,D,W,L,j,!1)}else F.lineTo(-E,N);if(F.lineTo(-E,-N),!l){const W=P*.4,k=T*.4,D=Math.min(w*.8,T*.8,E*.8);if(F.lineTo(-W,-N),D>.1){F.lineTo(-W,N-D);const L=D/2+(P*.8)**2/(8*D),[j,B]=[0,k-L],O=Math.acos(Math.min(W/L,1)),V=Math.PI-O;F.absarc(j,B,L,V,O,!0)}else F.lineTo(-W,k),F.lineTo(W,k);F.lineTo(W,-N)}return F.closePath(),F},[P,T,w,l]),H=m.useMemo(()=>({lineColor:"black",lineWidth:i&&r?.2:.1,opacity:1,selected:r,locked:i}),[r,i]);return h.jsxs("group",{name:"Arched door group",children:[h.jsx("mesh",{name:"Arched Door Mesh",rotation:[Qt,0,0],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),l&&h.jsxs("mesh",{name:"Arched Door Simulation Mesh",rotation:[Qt,0,0],material:a,uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[R]}),h.jsx("meshBasicMaterial",{side:ti})]}),l&&h.jsx("mesh",{name:"Door plane mesh inside",position:[0,.1,0],rotation:[-Qt,0,Math.PI],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),h.jsx(Zce,{cy:0,dimension:e,wireframeData:H}),h.jsx(Zce,{cy:v,dimension:e,wireframeData:H}),b&&b.map((F,E)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:F,name:"Heat Flux "+E,lineWidth:A??Zm,color:g??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:F[S.current].clone().add(new ae(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:g??p0})})]},E))]})}),Y$e="/aladdin/assets/door_edge-Dxz9LnYZ.png",O$e="/aladdin/assets/door_01-Bl1yYWKp.png",ude="/aladdin/assets/door_02-eLAy3erM.png",V$e="/aladdin/assets/door_03-CX-eEQtv.png",_$e="/aladdin/assets/door_04-Bk3Xe_KE.png",G$e="/aladdin/assets/door_05-15BnnbHK.png",X$e="/aladdin/assets/door_06-B08sjms-.png",J$e="/aladdin/assets/door_07-BVyEwygm.png",K$e="/aladdin/assets/door_08-Cd1Vc7FQ.png",q$e="/aladdin/assets/door_09-DQcA4jCn.png",$$e="/aladdin/assets/door_10-DVLJsY3W.png",Q$e="/aladdin/assets/door_11-dOCMnkGG.png",Z$e="/aladdin/assets/door_12-7f2iD2B7.png",eQe="/aladdin/assets/door_13-IsPl-xmI.png",tQe="/aladdin/assets/door_14-CljRO-fX.png",nQe="/aladdin/assets/door_15-CoUc1lfF.png",oQe="/aladdin/assets/door_16-Dlbc5tIF.png",rQe="/aladdin/assets/door_17-CHob_UgA.png",Hen=(t,e,n,o)=>{const r=m.useMemo(()=>{let s;switch(t){case sr.Default:s=Y$e;break;case sr.NoTexture:s=og;break;case sr.Texture01:s=O$e;break;case sr.Texture02:s=ude;break;case sr.Texture03:s=V$e;break;case sr.Texture04:s=_$e;break;case sr.Texture05:s=G$e;break;case sr.Texture06:s=X$e;break;case sr.Texture07:s=J$e;break;case sr.Texture08:s=K$e;break;case sr.Texture09:s=q$e;break;case sr.Texture10:s=$$e;break;case sr.Texture11:s=Q$e;break;case sr.Texture12:s=Z$e;break;case sr.Texture13:s=eQe;break;case sr.Texture14:s=tQe;break;case sr.Texture15:s=nQe;break;case sr.Texture16:s=oQe;break;case sr.Texture17:s=rQe;break;default:s=ude}return new cf().load(s,c=>{n!==void 0&&o!==void 0&&(c.offset.set(.5,.5),c.repeat.set(1/n,1/o)),a(c),l()})},[t,e,n,o]),[i,a]=m.useState(r),{invalidate:l}=ri();return i},Men=new pf({color:"white",side:Da}),Ien=be.memo(({dimension:t,doorType:e})=>{const[n,o,r]=t.map(a=>a/2);return n===0&&r===0?null:h.jsxs("group",{name:"Door handle wrapper",children:[h.jsx(Sv,{x:-n,z:r,handleType:Mt.UpperLeft}),h.jsx(Sv,{x:n,z:r,handleType:Mt.UpperRight}),e===Rd.Arched&&h.jsx(j$e,{z:r})]})}),zen=be.memo(({dimension:t})=>{const e=M(Cs),[n,o,r]=t,[i,a,l]=t.map(c=>c/2),s=(c,u,d)=>h.jsx(ta,{name:"Door seal plane",args:c,position:u,rotation:d,material:Men,receiveShadow:e});return h.jsxs("group",{name:"Door seal planes group",children:[s([o,r],[-i,a,0],[Qt,Qt,0]),s([o,r],[i,a,0],[Qt,-Qt,0]),s([n,o],[0,a,l],[Math.PI,0,0])]})}),Den=t=>{const{id:e,parentId:n,cx:o,cy:r,cz:i,lx:a,ly:l,lz:s,textureType:c,locked:u=!1,color:d="white",doorType:f=Rd.Default,archHeight:p=1,filled:g=!0,opacity:A=1,frameColor:y="white"}=t,S=`Door Group ${e}`,C=M(pn),P=dt(bh),v=M(vBe),T=Tc(e),w=m.useRef(!1);m.useEffect(()=>{const q=()=>{w.current=!1};return window.addEventListener("pointerup",q),()=>window.removeEventListener("pointerup",q)},[]);const x=(q=!1)=>{C($=>{if($.groupActionMode)$.multiSelectionsMode||$.selectedElementIdSet.clear(),t.foundationId&&($.selectedElementIdSet.has(n)?$.selectedElementIdSet.delete(n):$.selectedElementIdSet.add(t.foundationId));else for(const ie of $.elements)if(ie.id===e)if(ie.selected=!0,$.selectedElement=ie,q)if($.selectedElementIdSet.has(e))for(const Q of $.elements)$.selectedElementIdSet.has(Q.id)&&Q.type!==$.selectedElement.type&&$.selectedElementIdSet.delete(Q.id);else if($.multiSelectionsMode){$.selectedElementIdSet.add(e);for(const Q of $.elements)$.selectedElementIdSet.has(Q.id)&&Q.type!==$.selectedElement.type&&$.selectedElementIdSet.delete(Q.id)}else $.selectedElementIdSet.clear(),$.selectedElementIdSet.add(e);else $.multiSelectionsMode?$.selectedElementIdSet.has(e)?$.selectedElementIdSet.delete(e):$.selectedElementIdSet.add(e):($.selectedElementIdSet.clear(),$.selectedElementIdSet.add(e));else ie.selected=!1})},b=q=>q.intersections.length>0&&q.intersections[0].eventObject.name===S&&!M.getState().moveHandleType&&!M.getState().resizeHandleType&&!M.getState().isAddingElement()&&M.getState().objectTypeToAdd===z.None,R=q=>{if(q.eventObject.name===S&&q.intersections.length>0)switch(q.object.name){case Mt.UpperLeft:case Mt.UpperRight:case Mt.Arch:return!0}return!1},H=(q,$)=>{kn.getState().setEnableOrbitController(!1),P("showWallIntersectionPlaneId",n),C(ie=>{ie.resizeHandleType=q,ie.resizeAnchor.copy(new ae(o,0,i).add($))})},F=q=>{M.getState().addedWallId||b(q)&&(x(!0),C($=>{$.contextMenuObjectType=z.Door}))},E=q=>{if(!(w.current||q.button===2||M.getState().addedWallId)&&(w.current=!0,b(q)&&x(),R(q))){const $=q.intersections[0].eventObject.name;switch($){case Mt.UpperLeft:{H($,new ae(a/2,0,-s/2));break}case Mt.UpperRight:{H($,new ae(-a/2,0,-s/2));break}case Mt.Arch:{H($,new ae(0,0,0));break}}}},N=M(yA),U=dt(hs),W=dt(p3),k=M(Pf),D=Cn(c1),[L,j]=m.useState(null),B=()=>{switch(f){case Rd.Default:return h.jsx(Cen,{id:e,dimension:V,color:d,frameColor:y,selected:T,locked:u,material:G,filled:g,showHeatFluxes:W,area:ye.getDoorArea(t),foundation:N(t)});case Rd.Arched:return h.jsx(Ren,{id:e,dimension:V,color:d,frameColor:y,selected:T,locked:u,material:G,filled:g,showHeatFluxes:W,area:ye.getDoorArea(t),foundation:N(t)})}};m.useEffect(()=>{if(t&&U){const q=D(t.id);if(q){const $=ye.fetchHeatmapTexture(q,k??5);$&&($.wrapS=bs,$.wrapT=bs,$.offset.set(-a/2,-s/2),$.center.set(a/2,s/2),$.repeat.set(1/a,1/s),j($))}}},[U,k]);const O=Hen(c,f,a,s),V=m.useMemo(()=>[a,l,s,p],[a,l,s,p]),G=m.useMemo(()=>U&&L&&t.filled?new t3({color:d,map:L,side:Da}):g?c===sr.Default||c===sr.NoTexture?A<1?new Z1e({specular:"white",shininess:v??mG,color:d,side:Da,opacity:A,transparent:!0}):new pf({map:O,color:d,side:Da}):new pf({map:O,side:Da}):new pf({opacity:d===jce?.5:0,color:d,transparent:!0,side:ti}),[U,L,d,c,O,g,A]);return h.jsxs("group",{name:S,position:[o,0,i],onPointerDown:E,onContextMenu:F,children:[B(),T&&h.jsx($ye,{element:t}),T&&!u&&h.jsx(Ien,{dimension:V,doorType:f}),h.jsx(zen,{dimension:V})]})},Een=be.memo(Den),Fen="/aladdin/assets/polygon_08-BBFzZjDj.png",ken="/aladdin/assets/polygon_09-B_8KpAt3.png",Len="/aladdin/assets/polygon_10-CKqrpQre.png",iQe=({id:t,lz:e=.1,filled:n=!1,rotation:o=[0,0,0],normal:r=[0,0,1],color:i="yellow",label:a,text:l,fontSize:s=1,fontColor:c="black",fontOutlineWidth:u=0,fontOutlineColor:d="white",fontStrokeWidth:f=0,fontStrokeColor:p="black",lineStyle:g=Xh.Solid,lineColor:A="black",lineWidth:y=1,locked:S=!1,showLabel:C=!1,parentId:P,foundationId:v,vertices:T,opacity:w=1,noOutline:x=!1,shininess:b=0,selectedIndex:R=-1,textureType:H=Kr.NoTexture})=>{const F=M(pn),E=M(pu),N=M(n$),U=M(Cs),W=Tc(t),{gl:{domElement:k}}=ri(),[D,L]=m.useState(!1),[j,B]=m.useState(0),[O,V]=m.useState(0),[G,q]=m.useState(null),$=m.useRef(null),ie=m.useRef(null),Q=M(Me=>{for(const ze of Me.elements)if(ze.id===P)return ze}),se=new ae,Z=new ln;if((Q==null?void 0:Q.type)===z.Cuboid){const{pos:Me,rot:ze}=ye.getWorldDataById(Q.id);se.copy(Me),Z.set(0,0,ze)}const ee=Q?Math.max(1,Math.max(Q.lx,Q.ly)/24):1,te=sR*ee,oe=Wg*ee,de=$t(),he=(Me,ze)=>{F(Ne=>{for(const Je of Ne.elements)if(Je.type===z.Polygon&&Je.id===Me){Je.selectedIndex=ze;break}})},pe=m.useMemo(()=>{const Me=new Array;if(Q){switch(Q.type){case z.Foundation:{for(const Ne of T)Me.push({x:Ne.x*Q.lx,y:Ne.y*Q.ly});break}case z.Wall:{for(const Ne of T)Me.push({x:Ne.x*Q.lx,y:Ne.y*Q.lz});break}case z.Cuboid:{const Ne=new ae().fromArray(r);let Je,Ue;ye.isUnitVectorX(Ne)?(Je=Q.lz,Ue=Q.ly):ye.isUnitVectorY(Ne)?(Je=Q.lx,Ue=Q.lz):(Je=Q.lx,Ue=Q.ly);for(const nt of T)Me.push({x:nt.x*Je,y:nt.y*Ue});break}}const ze=ye.calculatePolygonCentroid(Me);B(ze.x),V(ze.y)}return Me},[T,Q,r]),le=(()=>{if((Q==null?void 0:Q.type)===z.Cuboid){const Me=ye.isIdentical(r,as);return se.z+(Q.lz+(Me?0:e))/2+.01}return(Q==null?void 0:Q.type)===z.Foundation?Q.lz+.01:e/2+.01})(),ge=(()=>{if((Q==null?void 0:Q.type)===z.Wall)return new ln(-Qt,0,Math.PI,"ZXY");const Me=new ae().fromArray(r);let ze=o[2];return(Q==null?void 0:Q.type)===z.Cuboid&&(ze=Z.z),ye.isSame(Me,Op)?new ln(0,Qt,ze,"ZXY"):ye.isSame(Me,Vp)?new ln(0,-Qt,ze,"ZXY"):ye.isSame(Me,Yc)?new ln(-Qt,0,ze,"ZXY"):ye.isSame(Me,_p)?new ln(Qt,0,ze,"ZXY"):new ln(0,0,ze,"ZXY")})(),Re=(()=>{if(Q){if(Q.type===z.Cuboid){const Me=new ae(se.x,se.y,le),ze=new ae().fromArray(r);let Ne=!1;const Je=new ae;return ye.isSame(ze,Op)?(Ne=!0,Je.x=Q.lx/2+.01):ye.isSame(ze,Vp)?(Ne=!0,Je.x=-Q.lx/2-.01):ye.isSame(ze,Yc)?(Ne=!0,Je.y=Q.ly/2+.01):ye.isSame(ze,_p)&&(Ne=!0,Je.y=-Q.ly/2-.01),Ne&&(Je.applyEuler(Z),Me.x=se.x+Je.x,Me.y=se.y+Je.y,Me.z=se.z+Je.z),Me}else if(Q.type===z.Wall)return new ae(0,-.01,0)}return new ae((Q==null?void 0:Q.cx)??0,(Q==null?void 0:Q.cy)??0,le)})(),De=m.useMemo(()=>{const Me=new Array;for(const ze of pe)Me.push(new ae(ze.x,ze.y,0));return Me.push(new ae(pe[0].x,pe[0].y,0)),Me},[pe]),Ae=m.useMemo(()=>{const Me=new kl;Me.moveTo(pe[0].x,pe[0].y);for(let ze=1;ze{Me.intersections.length>0&&Me.intersections[0].object===Me.eventObject&&(q(ze),ze===zo.Default?k.style.cursor="move":k.style.cursor="pointer")},[]),fe=m.useCallback(()=>{q(null),k.style.cursor="default"},[]),ve=Me=>{switch(Me){case Kr.Texture01:return{x:1,y:1};case Kr.Texture02:return{x:2,y:2};case Kr.Texture03:return{x:.4,y:.4};case Kr.Texture04:return{x:.25,y:.25};case Kr.Texture05:return{x:5,y:5};case Kr.Texture06:return{x:1,y:1};case Kr.Texture07:return{x:1,y:1};case Kr.Texture08:return{x:2,y:2};case Kr.Texture09:return{x:2,y:2};case Kr.Texture10:return{x:4,y:4};default:return{x:1,y:1}}},we=m.useMemo(()=>{let Me;switch(H){case Kr.Texture01:Me=w$e;break;case Kr.Texture02:Me=v$e;break;case Kr.Texture03:Me=x$e;break;case Kr.Texture04:Me=b$e;break;case Kr.Texture05:Me=S$e;break;case Kr.Texture06:Me=T$e;break;case Kr.Texture07:Me=P$e;break;case Kr.Texture08:Me=Fen;break;case Kr.Texture09:Me=ken;break;case Kr.Texture10:Me=Len;break;default:Me=og}return new cf().load(Me,ze=>{const Ne=ve(H);ze.wrapT=ze.wrapS=bs,ze.repeat.set(1/Ne.x,1/Ne.y);const Je=new ae().fromArray(r);ye.isSame(Je,Op)?ze.rotation=Qt:ye.isSame(Je,Vp)?ze.rotation=-Qt:ye.isSame(Je,_p)&&(ze.rotation=Math.PI),Ie(ze)})},[H,r]),[Pe,Ie]=m.useState(we);return h.jsxs("group",{name:"Polygon Group "+t,rotation:ge,position:Re,children:[n&&h.jsxs("mesh",{uuid:t,ref:$,receiveShadow:U,castShadow:!1,name:z.Polygon,onPointerDown:Me=>{Me.button!==2&&N===z.None&&E(t,Me)},onContextMenu:Me=>{E(t,Me,Xo.ContextMenu),F(ze=>{Me.intersections.length>0&&Me.intersections[0].object===$.current&&(Me.intersections.length>1&&ze.pastePoint.copy(Me.intersections[1].point),ze.contextMenuObjectType=z.Polygon)})},onPointerOver:Me=>{Me.intersections.length>0&&Me.intersections[0].object===$.current&&L(!0)},onPointerOut:()=>{L(!1),k.style.cursor="default"},children:[h.jsx("shapeGeometry",{attach:"geometry",args:[Ae]}),b===void 0||b===0?h.jsx("meshStandardMaterial",{attach:"material",color:H===Kr.NoTexture?i:"white",map:Pe,side:ti,transparent:w<1,opacity:w}):h.jsx("meshPhongMaterial",{attach:"material",color:H===Kr.NoTexture?i:"white",map:Pe,side:Da,specular:new rr("white"),shininess:b,transparent:w<1,opacity:w})]}),l&&h.jsx(s4t,{fontSize:s,scale:[1,1,1],color:c,position:[j,O,.01],rotation:[0,0,(Q==null?void 0:Q.type)===z.Wall?Math.PI:0],anchorX:"center",anchorY:"middle",outlineWidth:u,outlineColor:d,strokeWidth:f,strokeColor:p,children:l}),(!x||S&&W)&&h.jsx(Gn,{points:De,color:S&&W?B0:A,lineWidth:y,dashed:g&&g!==Xh.Solid,dashSize:g===Xh.Dashed?.3:.1,gapSize:.1,uuid:t,receiveShadow:!1,castShadow:!1,name:"Polygon Wireframe",onPointerDown:Me=>{Me.button!==2&&E(t,Me)},onContextMenu:Me=>{N===z.None&&(E(t,Me,Xo.ContextMenu),F(ze=>{if(Me.intersections.length>0){const Ne=Me.intersections[0].object;Ne.name==="Polygon Wireframe"&&Ne.uuid===t&&(ze.contextMenuObjectType=z.Polygon)}}))}}),!n&&h.jsx(Gn,{position:[0,0,.1],points:De,visible:!1,lineWidth:Math.min(y*10,10),receiveShadow:!1,castShadow:!1,uuid:t,name:"Polygon Enlarged Line",onPointerDown:Me=>{Me.button!==2&&E(t,Me)},onContextMenu:Me=>{N===z.None&&(E(t,Me,Xo.ContextMenu),F(ze=>{if(Me.intersections.length>0){const Ne=Me.intersections[0].object;Ne.name==="Polygon Enlarged Line"&&Ne.uuid===t&&(ze.contextMenuObjectType=z.Polygon)}}))}}),W&&!S&&h.jsx(Ps,{ref:ie,position:[j,O,0],args:[oe,6,6],name:zo.Default,onPointerDown:Me=>{Me.button!==2&&(E(t,Me,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(ze=>{ze.showWallIntersectionPlaneId=P,ze.oldParentId=P,ze.oldFoundationId=v}),F(ze=>{ze.moveHandleType=zo.Default}))},onPointerOver:Me=>{ue(Me,zo.Default)},onPointerOut:fe,children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),W&&!S&&pe.map((Me,ze)=>h.jsxs(be.Fragment,{children:[h.jsx(si,{userData:{vertexIndex:ze},position:[Me.x,Me.y,0],name:Mt.Default,args:[te,te,e/2+(n?0:.1)],onPointerDown:Ne=>{Ne.button!==2&&(E(t,Ne,Xo.Resize),he(t,ze),kn.getState().setEnableOrbitController(!1),dt.getState().set(Je=>{Je.showWallIntersectionPlaneId=P,Je.oldParentId=P,Je.oldFoundationId=v}),F(Je=>{Je.resizeHandleType=Mt.Default}))},onPointerOver:Ne=>{ue(Ne,Mt.Default),he(t,ze)},onPointerOut:fe,onContextMenu:Ne=>{F(Je=>{if(Ne.intersections.length>0){const Ue=Ne.intersections[0].object.userData.vertexIndex;Ue!==void 0&&(Je.contextMenuObjectType=z.PolygonVertex,he(t,Ue))}})},children:h.jsx("meshBasicMaterial",{attach:"material",color:(G===Mt.Default||M.getState().resizeHandleType===Mt.Default)&&R===ze?ga:$a})}),h.jsx("textSprite",{name:"Label "+ze,text:""+ze,fontSize:20*ee,fontFace:"Times Roman",textHeight:.2*ee,position:[Me.x,Me.y,.2*ee]})]},"resize-handle-"+ze)),(D||C)&&!W&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(a??Y.t("shared.PolygonElement",de))+(S?" ("+Y.t("shared.ElementLocked",de)+")":""),fontSize:20*ee,fontFace:"Times Roman",textHeight:.2*ee,position:[0,0,e+.2]})]})},Zye={display:!1,color:"white",textureType:Bo.NoTexture,parapetHeight:1,copingsWidth:.5,copingsHeight:.1},Wen=({args:t,wallData:e,parapetZ:n,currWallPointData:o,leftWallPointData:r,rightWallPointData:i})=>{const{display:a,color:l,textureType:s,parapetHeight:c,copingsWidth:u,copingsHeight:d}=t,{id:f,cx:p,cy:g,hx:A,hy:y,angle:S}=e,C=c-d,P=f$e(s),v=m.useMemo(()=>{const W=new ae(-A,y-u/2),k=new ae(A,y-u/2),D=new ae(A,y+u/2),L=new ae(-A,y+u/2),j=[W,k,D,L];if(i||r){const B=GSe(o);if(i&&wO(o.rightPoint,i.leftPoint)){const O=H(B,i);O&&(k.copy(O.outerIntersection),D.copy(O.innerIntersection))}if(r&&wO(o.leftPoint,r.rightPoint)){const O=H(B,r);O&&(W.copy(O.outerIntersection),L.copy(O.innerIntersection))}}return j},[A,y,u,o,r,i]),T=m.useMemo(()=>{const W=new kl,k=new ae(-A,y*2),D=new ae(A,y*2);if(i||r){const L=gX(o,o.ly);if(i&&wO(o.rightPoint,i.leftPoint)){const j=F(L,i);j&&D.copy(j)}if(r&&wO(o.leftPoint,r.rightPoint)){const j=F(L,r);j&&k.copy(j)}}return W.moveTo(-A,0),W.lineTo(A,0),W.lineTo(D.x,D.y),W.lineTo(k.x,k.y),W.closePath(),W},[A,y,o,r,i]),w=m.useMemo(()=>{const W=new kl;if(u===0)return W;const[k,D,L,j]=v;return W.moveTo(k.x,k.y),W.lineTo(D.x,D.y),W.lineTo(L.x,L.y),W.lineTo(j.x,j.y),W.closePath(),W},[u,v]),x=m.useMemo(()=>v.map(W=>W.toArray()),[v]),b=m.useMemo(()=>[new ae(-A,0,0),new ae(A,0,0)],[A]),R=m.useMemo(()=>[new ae,new ae(0,0,C)],[C]);function H(W,k){const D=GSe(k),L=nae(W.outerPoints.leftPoint,W.outerPoints.rightPoint,D.outerPoints.leftPoint,D.outerPoints.rightPoint);if(!L)return null;const j=nae(W.innerPoints.leftPoint,W.innerPoints.rightPoint,D.innerPoints.leftPoint,D.innerPoints.rightPoint);return j?{innerIntersection:new ae().subVectors(j,new ae(p,g)).applyEuler(new ln(0,0,-S)),outerIntersection:new ae().subVectors(L,new ae(p,g)).applyEuler(new ln(0,0,-S))}:null}function F(W,k){const D=gX(k,k.ly),L=nae(W.leftPoint,W.rightPoint,D.leftPoint,D.rightPoint);return L?new ae().subVectors(L,new ae(p,g)).applyEuler(new ln(0,0,-S)):null}function E(){return!(M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().isAddingElement())}function N(W){W.button!==2&&W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&E()&&M.getState().selectMe(f,W,Xo.Select,!0)}function U(W){M.getState().selectMe(f,W,Xo.ContextMenu,!0),M.getState().set(k=>{W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&(k.contextMenuObjectType=z.Wall)})}return a?h.jsxs("group",{name:"Wall Parapet Group",position:[0,0,n],onContextMenu:U,onPointerDown:N,children:[h.jsx(aw,{name:"Body Extrude Mesh",args:[T,{steps:1,depth:C,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l,map:P})}),h.jsx(Gn,{position:[A,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[-A,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[0,0,C],points:b,color:"black",lineWidth:.2}),h.jsx(aw,{name:"Copings Extrude Mesh",position:[0,0,C],args:[w,{steps:1,depth:d,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l})}),h.jsx(Gn,{position:[0,0,C+d],points:x,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[0,0,C],points:x,color:"black",lineWidth:.2})]}):null};function GSe(t){const e=(t.ly+t.copingsWidth)/2,n=(t.ly-t.copingsWidth)/2;return{innerPoints:gX(t,e),outerPoints:gX(t,n)}}function gX(t,e){const{leftPoint:n,rightPoint:o}=t,r=new ae().fromArray(n),i=new ae().fromArray(o),l=new ae().subVectors(i,r).applyEuler(new ln(0,0,Qt)).normalize().clone().multiplyScalar(e);return{leftPoint:r.clone().add(l),rightPoint:i.clone().add(l)}}function wO(t,e){return Math.abs(t[0]-e[0]){const{id:n,lx:o,lz:r}=t,i=M(s3),a=M(e5),l=M(a3),s=M(l3),c=Cn(Ib),u=dt(p3),d=m.useRef(0),f=m.useRef(),p=m.useMemo(()=>{if(!u||e)return;const g=c.get(n);if(!g)return;const A=g.reduce((j,B)=>j+B,0),y=t.fill===Fl.Partial&&!ye.isPartialWallFull(t),S=ye.getWallVertices(t,0),C=y?ye.getPartialWallVertices(t,0):S,P=ye.getPolygonArea(S);let v=y?ye.getPolygonArea(C):P;if(v===0)return;const T=i(z.Window,n),w=i(z.Door,n);if(T&&T.length>0)for(const j of T)v-=ye.getWindowArea(j,t);if(w&&w.length>0)for(const j of w)v-=j.lx*j.lz*t.lx*t.lz;const x=M.getState().world,b=i3*(x.solarRadiationHeatmapGridCellSize??.5),R=ye.getHighestPointOfWall(t),H=Math.max(2,Math.round(o/b)),F=Math.max(2,Math.round(R/b)),E=o/H,N=R/F,U=(R-t.lz)/2,W=A/v*(a??Qm);d.current=W<0?1:0,f.current=ye.getEuler(ko,Yc,"YXZ",Math.sign(W)*Qt);const k=[],D=y?ye.getPartialWallVertices(t,0):ye.getWallVertices(t,0);let L;for(let j=0;j0)for(const q of T){if(q.type!==z.Window)continue;const $=q.cx*t.lx,ie=q.cz*t.lz,Q=q.lx*t.lx/2,se=q.lz*t.lz/2;if(q.windowType===Ci.Arched){if(V>=$-Q&&V<$+Q&&G>=ie-se&&G=$-Q&&V<$+Q&&G>=ie-se&&G0)for(const q of w){const $=q.cx*o,ie=q.cz*R,Q=q.lx*o/2,se=q.lz*R/2;if(V>=$-Q&&V<$+Q&&G>=ie-se&&Gh.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:g,name:"Heat Flux "+A,lineWidth:s??Zm,color:l??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:g[d.current].clone().add(new ae(0,d.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:f.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:l??p0})})]},A))}):null},jen=be.memo(Uen),oae="Wall Block Plane",Ben="Wall Intersection Plane",hP=.1,Yen=be.memo(({transparent:t,color:e,opacity:n})=>{const r=M(Lw).z<=0;return h.jsx("meshStandardMaterial",{color:t?e:"white",transparent:t,opacity:n,side:r?r0:ti})}),Oen=({wallModel:t,foundationModel:e})=>{var mu,fn,tn,Ot,mn,Hn;let{id:n,cx:o,cy:r,lx:i=1,ly:a=.5,lz:l=5,relativeAngle:s,leftJoints:c,rightJoints:u,textureType:d,color:f="white",lineColor:p="black",lineWidth:g=.2,parentId:A,locked:y=!1,roofId:S,leftRoofHeight:C,rightRoofHeight:P,centerRoofHeight:v,centerLeftRoofHeight:T,centerRightRoofHeight:w,wallStructure:x=gc.Default,structureSpacing:b=2,structureWidth:R=.1,structureColor:H="white",opacity:F=.5,fill:E=Fl.Full,leftUnfilledHeight:N=.5,rightUnfilledHeight:U=.5,leftTopPartialHeight:W=l,rightTopPartialHeight:k=l,parapet:D=Zye,leftPoint:L,rightPoint:j}=t;C=c.length>0?C:l,P=u.length>0?P:l;const B=f$e(d),O=Tc(n),V=M(pn),G=M(Db),q=M(pu),$=M(En),ie=M(qge),Q=Cn(c1),se=M(kw),Z=M(Cs),ee=M($ge),te=M(TOe),oe=M(Pf),de=dt(bh),he=dt(hs),pe=dt(qe=>qe.elementBeingCanceledId),me=dt(qe=>qe.showWallIntersectionPlaneId),[le,Te]=m.useState(!1),[ge,Se]=m.useState(null),{camera:Re,gl:De}=ri(),{elementsOnWall:Ae,leftWall:ue,rightWall:fe}=KQt(n,c[0],u[0]),ve=h$e(e),we=m.useRef(null),Pe=m.useRef(null),Ie=m.useRef(null),Me=m.useRef(null),ze=m.useRef(null),Ne=m.useRef(null),Je=m.useRef(null),Ue=m.useRef(null),nt=i/2,We=a/2,Ee=l/2,ke=ve?ve.rotation[2]+s:s,Oe=ye.getInnerWallOffset(ue,i,a,s,"left"),st=ye.getInnerWallOffset(fe,i,a,s,"right"),je=x===gc.Stud||x===gc.Pillar,xt=C??l,gt=P??l,Ye=E===Fl.Partial,it=Ye?N:0,ut=Ye?U:0,Qe=Ye?Math.min(xt,W):xt,lt=Ye?Math.min(gt,k):gt,Ze=Ye&&(!ye.isZero(xt-Qe)||!ye.isZero(gt-lt)),Be=Z&&!je,$e=D.display,wt=Math.max(Qe,lt)-Ee,vt=m.useMemo(()=>new Kt,[]),Rt=m.useMemo(()=>new l0,[]),Gt=m.useMemo(()=>new pf({color:"white",side:ti,transparent:je,opacity:F}),[je,F]),At=m.useMemo(()=>ye.getHighestPointOfWall(t),[t.lz,t.leftRoofHeight,t.rightRoofHeight,t.centerRoofHeight,t.centerLeftRoofHeight,t.centerRightRoofHeight]),pt=m.useMemo(()=>{const qe=new kl;return Ge(qe,i,l,0,0,0,0),Ae.forEach(Ct=>{if(Ct.type===z.Window&&Ct.id!==Je.current&&Ct.lx>0&&Ct.lz>0){const Nt=Ct,Tt=new kl,[Yt,Zt,cn,yn]=[Ct.lx*i,Ct.lz*l,Ct.cx*i,Ct.cz*l];if(Nt.windowType)switch(Nt.windowType){case Ci.Arched:un(Tt,Yt,Zt,cn,yn,Nt.archHeight);break;case Ci.Polygonal:{const[An,Tn]=Nt.polygonTop??Gp;Rn(Tt,Yt,Zt,cn,yn,An*Yt,Tn);break}case Ci.Default:default:qt(Tt,Yt,Zt,cn,yn)}else qt(Tt,Yt,Zt,cn,yn);qe.holes.push(Tt)}}),qe},[i,l,E,N,U,Qe,lt,Ae,C,P,v,T,w]),Wt=m.useMemo(()=>{const qe=new kl,Ct=l,Nt=l/2;if(Ye)qe.moveTo(-nt+Oe,-Nt+N),qe.lineTo(nt-st,-Nt+U);else{qe.moveTo(-nt+Oe,-Nt);const Tt=Ae.filter(Yt=>Yt.type===z.Door).sort((Yt,Zt)=>Yt.cx-Zt.cx);for(const Yt of Tt)if(Yt.id!==Je.current){const[Zt,cn,yn,An]=[Yt.cx*i,Yt.cz*Ct,Yt.lx*i,Yt.lz*Ct];if(Yt.doorType===Rd.Default)qe.lineTo(Zt-yn/2,-Nt),qe.lineTo(Zt-yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt);else{const Tn=Math.min(Yt.archHeight,An,yn/2);if(qe.lineTo(Zt-yn/2,-Nt),Tn>.1){qe.lineTo(Zt-yn/2,-Nt+An/2-Tn);const Ln=Tn/2+yn**2/(8*Tn),[Yn,Wn]=[Zt,cn+An/2-Ln],oo=Math.acos(Math.min(yn/2/Ln,1)),qn=Math.PI-oo;qe.absarc(Yn,Wn,Ln,qn,oo,!0)}else qe.lineTo(Zt-yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt+An);qe.lineTo(Zt+yn/2,-Nt)}}qe.lineTo(nt-st,-Nt)}if(Ze){const Tt=lt-Qe,Yt=(i-st)*Tt/i,Zt=Oe*Tt/i;qe.lineTo(nt-st,-Nt+Qe+Yt),qe.lineTo(-nt+Oe,-Nt+Qe+Zt)}else S?(P?qe.lineTo(nt-st,P-Nt):qe.lineTo(nt-st,Nt),w&&qe.lineTo(w[0]*i,w[1]-Nt),v&&qe.lineTo(v[0]*i,v[1]-Nt),T&&qe.lineTo(T[0]*i,T[1]-Nt),C?qe.lineTo(-nt+Oe,C-Nt):qe.lineTo(-nt+Oe,Nt)):(qe.lineTo(nt-st,Nt),qe.lineTo(-nt+Oe,Nt));return qe.closePath(),Ae.forEach(Tt=>{if(Tt.type===z.Window&&Tt.id!==Je.current&&Tt.lx>0&&Tt.lz>0){const Yt=Tt,Zt=new kl,[cn,yn,An,Tn]=[Tt.lx*i,Tt.lz*l,Tt.cx*i,Tt.cz*l];if(Yt.windowType)switch(Yt.windowType){case Ci.Arched:un(Zt,cn,yn,An,Tn,Yt.archHeight);break;case Ci.Polygonal:{const[Ln,Yn]=Yt.polygonTop??Gp;Rn(Zt,cn,yn,An,Tn,Ln*cn,Yn);break}case Ci.Default:default:qt(Zt,cn,yn,An,Tn);break}else qt(Zt,cn,yn,An,Tn);qe.holes.push(Zt)}}),qe},[i,l,E,N,U,Qe,lt,Oe,st,Ae,S,C,P,v,T,w]),ht=m.useMemo(()=>Ye?(Qe+lt)/2-Ee:Ee,[Ee,Ye,Qe,lt]),ct=m.useMemo(()=>{const qe=lt-Qe;return!Ye||Math.abs(qe)<.01?0:Math.atan2(qe,i)},[i,Ye,Qe,lt]),It=m.useMemo(()=>{const qe=new kl;if(!Ye||Math.abs(ct)<1e-4)return _t(qe,i,a,Oe,st),qe;{const Ct=i/2,Nt=a/2,Tt=Math.cos(ct),Yt=Ct/Tt,Zt=(Ct-Oe)/Tt,cn=(Ct-st)/Tt;return qe.moveTo(-Yt,-Nt),qe.lineTo(Yt,-Nt),qe.lineTo(cn,Nt),qe.lineTo(-Zt,Nt),qe.closePath(),qe}},[i,a,Oe,st,Ye,ct]),Ft=m.useMemo(()=>{const qe=[],Ct=i/2,Nt=l/2;return Ye?(qe.push({x:-Ct+Oe,y:-Nt+it}),qe.push({x:Ct-st,y:-Nt+ut})):(qe.push({x:-Ct,y:-Nt}),qe.push({x:Ct,y:-Nt})),Ze?(qe.push({x:Ct-st,y:-Nt+lt}),qe.push({x:-Ct+Oe,y:-Nt+Qe})):(P?qe.push({x:Ct,y:P-Nt}):qe.push({x:Ct,y:Nt}),w&&qe.push({x:w[0]*i,y:w[1]-Nt}),v&&qe.push({x:v[0]*i,y:v[1]-Nt}),T&&qe.push({x:T[0]*i,y:T[1]-Nt}),C?qe.push({x:-Ct,y:C-Nt}):qe.push({x:-Ct,y:Nt})),qe},[i,l,E,it,ut,Qe,lt,C,P,v,T,w]),Ve=m.useMemo(()=>{const qe=[];let Ct=0,Nt=0;if(E===Fl.Partial&&(Ct=(U-N)/i,Nt=N+nt*Ct),x===gc.Stud){let Tt=-nt+R/2;for(;Tt<=nt;)qe.push([Tt,Ct*Tt+Nt]),Tt+=b;Tt=nt-R/2,qe.push([Tt,Ct*Tt+Nt])}else if(x===gc.Pillar){let Tt=-nt;for(;Tt<=nt;)qe.push([Tt,Ct*Tt+Nt]),Tt+=b;qe.push([nt,Ct*nt+Nt])}return qe},[x,R,b,i,a,l,N,U]),ft=m.useMemo(()=>({id:n,parentId:A,cx:o,cy:r,hx:nt,hy:We,angle:s,selected:O}),[n,A,o,r,nt,We,s,O]),kt=m.useMemo(()=>({leftPoint:L,rightPoint:j,ly:a,copingsWidth:D.copingsWidth}),[L,j,a,D.copingsWidth]),rt=m.useMemo(()=>!ue||!ue.parapet||!ue.parapet.display?null:{leftPoint:ue.leftPoint,rightPoint:ue.rightPoint,ly:ue.ly,copingsWidth:ue.parapet.copingsWidth},[ue==null?void 0:ue.leftPoint,ue==null?void 0:ue.rightPoint,ue==null?void 0:ue.ly,(mu=ue==null?void 0:ue.parapet)==null?void 0:mu.copingsWidth,(fn=ue==null?void 0:ue.parapet)==null?void 0:fn.display]),at=m.useMemo(()=>!fe||!fe.parapet||!fe.parapet.display?null:{leftPoint:fe.leftPoint,rightPoint:fe.rightPoint,ly:fe.ly,copingsWidth:fe.parapet.copingsWidth},[fe==null?void 0:fe.leftPoint,fe==null?void 0:fe.rightPoint,fe==null?void 0:fe.ly,(tn=fe==null?void 0:fe.parapet)==null?void 0:tn.copingsWidth,(Ot=fe==null?void 0:fe.parapet)==null?void 0:Ot.display]);m.useEffect(()=>{Ue.current&&Ue.current.id===pe&&(Ue.current=null,ir())},[pe]),m.useEffect(()=>{if(t&&he){const qe=Q(t.id);if(qe){const Ct=ye.fetchHeatmapTexture(qe,oe??5);if(Ct){Ct.wrapS=bs,Ct.wrapT=bs;const Nt=l===At?0:(1-l/At)/2;Ct.offset.set(-i/2,-At/2-Nt),Ct.center.set(i/2,At/2),Ct.repeat.set(1/i,1/At),Se(Ct)}}}},[he,oe]),m.useEffect(()=>{S&&(ee.has(S)||te.has(S))&&M.getState().set(qe=>{const Ct=new Set;for(const Nt of qe.elements)if(Nt.id===n&&Nt.type===z.Wall){const Tt=Nt;if(Tt.roofId=null,Tt.leftRoofHeight=void 0,Tt.rightRoofHeight=void 0,Tt.centerRoofHeight=void 0,Tt.centerLeftRoofHeight=void 0,Tt.centerRightRoofHeight=void 0,Ae.length>0){const Yt=bn.getWallPoints2D(Tt);Ae.forEach(Zt=>{if(Zt.type===z.Polygon)return;const cn=Zt.type===z.Door,yn=Zt.type===z.SolarPanel,An=yn?Zt.lx-.01:Zt.lx*i,Tn=yn?Zt.ly-.01:Zt.lz*l,Ln=new ae(Zt.cx*i,0,Zt.cz*l);ye.isElementInsideWall(Ln,An,Tn,Yt,cn)||(Ct.add(Zt.id),qe.autoDeletedChild?qe.autoDeletedChild.push(Zt):qe.autoDeletedChild=[Zt])})}break}Ct.size>0?qe.elements=qe.elements.filter(Nt=>!Ct.has(Nt.id)):qe.autoDeletedChild===null&&(qe.autoDeletedChild=[])})},[S,ee,te]);function Ge(qe,Ct,Nt,Tt=0,Yt=0,Zt=0,cn=0,yn=!0){const An=Ct/2,Tn=Nt/2;if(Ye?qe.moveTo(Tt-An+Zt,Yt-Tn+N):qe.moveTo(Tt-An+Zt,Yt-Tn),yn){const Ln=Ae.filter(Yn=>Yn.type===z.Door).sort((Yn,Wn)=>Yn.cx-Wn.cx);for(const Yn of Ln)if(Yn.id!==Je.current){const[Wn,oo,qn,qo]=[Yn.cx*Ct,Yn.cz*Nt,Yn.lx*Ct,Yn.lz*l];if(Yn.doorType===Rd.Default)qe.lineTo(Tt+Wn-qn/2,Yt-Tn),qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn);else{const ii=Math.min(Yn.archHeight,qo,qn/2);if(qe.lineTo(Tt+Wn-qn/2,Yt-Tn),ii>.1){qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo/2-ii);const Qi=ii/2+qn**2/(8*ii),[Or,ya]=[Wn,Yt+oo+qo/2-Qi],Hs=Math.acos(Math.min(qn/2/Qi,1)),Qu=Math.PI-Hs;qe.absarc(Or,ya,Qi,Qu,Hs,!0)}else qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn+qo);qe.lineTo(Tt+Wn+qn/2,Yt-Tn)}}}Ye?qe.lineTo(Tt+An-cn,Yt-Tn+U):qe.lineTo(Tt+An-cn,Yt-Tn),Ze?(qe.lineTo(Tt+An-cn,Yt-Tn+lt),qe.lineTo(Tt-An+Zt,Yt-Tn+Qe)):S?(P?qe.lineTo(Tt+An-cn,P-Tn):qe.lineTo(Tt+An-cn,Yt+Tn),w&&qe.lineTo(w[0]*Ct,w[1]-Tn),v&&qe.lineTo(v[0]*Ct,v[1]-Tn),T&&qe.lineTo(T[0]*Ct,T[1]-Tn),C?qe.lineTo(Tt-An+Zt,C-Tn):qe.lineTo(Tt-An+Zt,Yt+Tn)):(qe.lineTo(Tt+An-cn,Yt+Tn),qe.lineTo(Tt-An+Zt,Yt+Tn)),qe.closePath()}function yt(qe,Ct){const{cx:Nt,cy:Tt,cz:Yt}=Ct;if(ve&&ke!==void 0){const Zt=ye.wallAbsolutePosition(new ae(Nt,Tt,Yt),ve).setZ(l/2+ve.lz);return new ae().subVectors(qe,Zt).applyEuler(new ln(0,0,-ke))}return new ae}function Pt(qe){const Ct=[];for(let Nt=-1;Nt<=1;Nt+=2)for(let Tt=-1;Tt<=1;Tt+=2){const[Yt,Zt]=[Nt,Nt*Tt];switch(qe.type){case z.Window:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx*i/2,qe.lz*l/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn});break}case z.Door:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx*i/2,qe.lz*l/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn});break}case z.SolarPanel:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx/2,qe.ly/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn})}}}if(qe.type===z.Window&&qe.windowType===Ci.Polygonal){const Nt=qe,[Tt,Yt]=Nt.polygonTop??[0,0];Ct.push({x:qe.cx*i+Tt*qe.lx*i,y:qe.cz*l+qe.lz*l/2+Yt})}return Ct}function ot(qe,Ct=0){if(!Ye)return ye.getWallVertices(qe,Ct);const Nt=qe.lx/2,Tt=qe.lz/2,Yt={x:-Nt-Ct,y:qe.leftUnfilledHeight-Tt-Ct},Zt={x:Nt+Ct,y:qe.rightUnfilledHeight-Tt-Ct},cn={x:-Nt-Ct,y:qe.leftTopPartialHeight-Tt+Ct},yn={x:Nt+Ct,y:qe.rightTopPartialHeight-Tt+Ct},An=[];return An.push(cn,Yt,Zt,yn),Ze||(qe.centerRightRoofHeight&&An.push({x:qe.centerRightRoofHeight[0]*qe.lx,y:qe.centerRightRoofHeight[1]-Tt+Ct}),qe.centerRoofHeight&&An.push({x:qe.centerRoofHeight[0]*qe.lx,y:qe.centerRoofHeight[1]-Tt+Ct}),qe.centerLeftRoofHeight&&An.push({x:qe.centerLeftRoofHeight[0]*qe.lx,y:qe.centerLeftRoofHeight[1]-Tt+Ct})),An}function bt(qe,Ct,Nt,Tt,Yt){if(Nt<.1||Tt<.1||Nt>i||!S&&Tt>l)return Je.current=qe,!1;const Zt=.1;Nt+=Zt,Tt+=Zt;for(const cn of Ae){if(cn.id===qe||cn.type===z.Polygon)continue;const yn=Pt(cn),An=[];for(let Tn=-1;Tn<=1;Tn+=2)for(let Ln=-1;Ln<=1;Ln+=2){const Yn=Ct.x+Tn*Nt/2,Wn=Ct.z+Tn*Ln*Tt/2;if(An.push({x:Yn,y:Wn}),ye.isPointInside(Yn,Wn,yn))return Je.current=qe,!1}if(Yt){const[Tn,Ln]=Yt,Yn=Ct.x+Tn*Nt,Wn=Ct.z+Tt/2+Ln;if(An.push({x:Yn,y:Wn}),ye.isPointInside(Yn,Wn,yn))return Je.current=qe,!1}for(const Tn of yn)if(ye.isPointInside(Tn.x,Tn.y,An))return Je.current=qe,!1}return Je.current=null,!0}function zt(qe,Ct,Nt,Tt,Yt){return ye.isElementInsideWall(Ct,Nt,Tt,Ft,Yt)?!0:(Je.current=qe,!1)}function Bt(qe,Ct,Nt,Tt){const[Yt,Zt]=Tt,cn=qe.x+Ct*Yt,yn=qe.z+Nt/2+Zt;return!!ye.isPointInside(cn,yn,ot(t,0))}function tt(qe){vt.x=qe.offsetX/De.domElement.clientWidth*2-1,vt.y=-(qe.offsetY/De.domElement.clientHeight)*2+1,Rt.setFromCamera(vt,Re)}function Ht(qe){return!(qe.button===2||M.getState().addedWallId||Ne.current||M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().objectTypeToAdd!==z.None||O||ie())}function _t(qe,Ct,Nt,Tt,Yt){const Zt=Ct/2,cn=Nt/2;qe.moveTo(-Zt,-cn),qe.lineTo(Zt,-cn),qe.lineTo(Zt-Yt,cn),qe.lineTo(-Zt+Tt,cn),qe.closePath()}function qt(qe,Ct,Nt,Tt=0,Yt=0){const Zt=Ct/2,cn=Nt/2;qe.moveTo(Tt-Zt,Yt-cn),qe.lineTo(Tt+Zt,Yt-cn),qe.lineTo(Tt+Zt,Yt+cn),qe.lineTo(Tt-Zt,Yt+cn),qe.closePath()}function un(qe,Ct,Nt,Tt,Yt,Zt=0){const cn=Ct/2,yn=Nt/2,An=Math.min(Zt,Nt,cn);if(qe.moveTo(Tt-cn,Yt-yn),qe.lineTo(Tt+cn,Yt-yn),qe.lineTo(Tt+cn,Yt+yn-An),An>0){const Tn=An/2+Ct**2/(8*An),[Ln,Yn]=[Tt,Yt+yn-Tn],Wn=Math.acos(Math.min(1,cn/Tn)),oo=Math.PI-Wn;qe.absarc(Ln,Yn,Tn,Wn,oo,!1)}else qe.lineTo(Tt-cn,Yt+yn);qe.closePath()}function Rn(qe,Ct,Nt,Tt,Yt,Zt,cn){const[yn,An]=[Ct/2,Nt/2];qe.moveTo(Tt-yn,Yt-An),qe.lineTo(Tt+yn,Yt-An),qe.lineTo(Tt+yn,Yt+An),qe.lineTo(Tt+Zt,Yt+An+cn),qe.lineTo(Tt-yn,Yt+An),qe.closePath()}function yo(qe){const Ct=parseFloat((Math.round(qe.x/P6)*P6).toFixed(1)),Nt=parseFloat((Math.round(qe.z/P6)*P6).toFixed(1));return new ae(Ct,qe.y,Nt)}function Ao(qe){const Ct=parseFloat((Math.round(qe.x/m9)*m9).toFixed(1)),Nt=parseFloat((Math.round(qe.z/m9)*m9).toFixed(1));return new ae(Ct,qe.y,Nt)}function wo(qe){return M.getState().enableFineGrid?qe=Ao(qe):qe=yo(qe),qe}function Io(qe,Ct,Nt,Tt,Yt){M.getState().set(Zt=>{for(const cn of Zt.elements)if(cn.id===qe){if([cn.cx,cn.cy,cn.cz]=Ct,[cn.lx,cn.ly,cn.lz]=Nt,Tt!==void 0&&(cn.type===z.Window||cn.type===z.Door)&&(cn.archHeight=Tt),Yt!==void 0&&cn.type===z.Window){const yn=cn;yn.windowType===Ci.Polygonal&&(yn.polygonTop=[...Yt])}break}})}function po(qe){return qe.type===z.Window&&qe.windowType===Ci.Polygonal&&qe.polygonTop}function On(qe){const Ct={name:"Add",timestamp:Date.now(),addedElement:qe,undo:()=>{M.getState().removeElementById(qe.id,!1)},redo:()=>{M.getState().set(Nt=>{Nt.elements.push(Ct.addedElement),Nt.selectedElement=Ct.addedElement,Nt.deletedRoofId=null})}};$(Ct)}function fo(){const qe=M.getState().selectedElement;if(!qe)return;const Ct=M.getState().getElementById(qe.id);if(Ct)switch(Ct.type){case z.Door:case z.Window:case z.SolarPanel:const Nt={name:`Resize ${Ct.type}`,timestamp:Date.now(),resizedElementId:Ct.id,resizedElementType:Ct.type,oldPosition:[qe.cx,qe.cy,qe.cz],oldDimension:[qe.lx,qe.ly,qe.lz],newPosition:[Ct.cx,Ct.cy,Ct.cz],newDimension:[Ct.lx,Ct.ly,Ct.lz],oldArchHeight:qe.type===z.Window||qe.type===z.Door?qe.archHeight:void 0,newArchHeight:Ct.type===z.Window||Ct.type===z.Door?Ct.archHeight:void 0,oldPolygonTop:po(qe)?[...qe.polygonTop]:void 0,newPolygonTop:po(Ct)?[...Ct.polygonTop]:void 0,undo(){Io(this.resizedElementId,this.oldPosition,this.oldDimension,this.oldArchHeight,this.oldPolygonTop)},redo(){Io(this.resizedElementId,this.newPosition,this.newDimension,this.newArchHeight,this.newPolygonTop)}};$(Nt);break;case z.Polygon:const Tt=qe,Yt=Ct,Zt={name:"Edit Polygon",timestamp:Date.now(),oldValue:[...Tt.vertices],newValue:[...Yt.vertices],changedElementId:Yt.id,changedElementType:Yt.type,undo(){se(this.changedElementId,this.oldValue)},redo(){se(this.changedElementId,this.newValue)}};$(Zt);break}}function ir(){M.getState().set(qe=>{qe.addedWindowId=null,qe.addedDoorId=null})}function Rr(qe){return qe===z.Window||qe===z.Door}function br(qe,Ct){const Nt=Eu.getIntersectionObjects(qe);return Nt.length>0&&Nt[0].object.name===`${Eu.WALL_OUTSIDE_SURFACE_MESH_NAME} ${Ct}`}function _r(qe){return qe.intersections.length>0&&qe.intersections[0].object===qe.eventObject}function jo(qe,Ct,Nt){if(M.getState().moveHandleType&&Ct&&wn(Ct)&&Ct.parentId!==qe){const Tt=Nt.intersections.filter(Zt=>Zt.eventObject.name.includes(Eu.WALL_OUTSIDE_SURFACE_MESH_NAME)||Zt.eventObject.name.includes(cde)||Zt.eventObject.name===oae);if(!(Tt.length>0&&(Tt[0].eventObject.name===oae||Tt[0].eventObject.name.includes(cde))))return!0}return!1}function wn(qe){if(!qe)return!1;switch(qe.type){case z.Window:case z.Door:case z.SolarPanel:case z.Light:case z.Sensor:return!0}return!1}function In(qe){if(M.getState().resizeHandleType!==Mt.Arch)return!1;if(qe.type===z.Window){const Ct=qe;return Ct.windowType===Ci.Arched&&Ct.archHeight!==void 0}if(qe.type===z.Door){const Ct=qe;return Ct.doorType===Rd.Arched&&Ct.archHeight!==void 0}}function ar(qe,Ct){const Nt=qe.getPoints().map(Tt=>({x:Tt.x,y:Tt.y}));return!ye.isPointInside(Ct.x,Ct.y,Nt)}function Wo(qe,Ct,Nt,Tt,Yt,Zt=!1){const cn=new ae().subVectors(Ct,qe).normalize(),[yn,An]=Zt?[Ct.y,qe.y]:[qe.y,Ct.y];let Tn;if(yn(Tn.type===z.Wall&&Tn.parentId===A&&An.set(Tn.id,Tn),An),new Map);let Tt=!1,Yt=0;const Zt={lng:M.getState().language},cn=t;let yn=cn;for(;yn&&yn.rightJoints.length>0;){Yt++;const An=Nt.get(yn.rightJoints[0]);if(!An)break;if(Ct&&An.lz!==cn.lz)return co(Y.t("message.WallsAreNotAtSameHeight",Zt)),!1;if(An.id===cn.id){Tt=!0;break}if(yn=An,Yt>100)break}return Tt?!0:(co(Y.t("message.WallsAreNotConnected",Zt)),!1)}function So(){return Ue.current&&Ue.current.status===0&&M.getState().moveHandleType===zo.Mid}function Qo(){return!(M.getState().moveHandleType||M.getState().resizeHandleType||ie())}function Yo(){return Ze||N!==U||W!==k?!1:S?!(C!==P||v!==void 0||T!==void 0||w!==void 0):!0}function lr(qe,Ct,Nt){var yn;tt(qe);const Yt=((yn=(Ct?Rt.intersectObjects([Ct]):qe.intersections)[0])==null?void 0:yn.point)??qe.point,Zt=yt(Yt,t),cn=Nt?wo(Zt.clone().add(Nt)).sub(Nt):wo(Zt);return{relativePointer:Zt,pointerOnGrid:cn}}function fr(qe,Ct){if(!we.current)return null;const{pointerOnGrid:Nt}=lr(qe,we.current),Tt=Nt.x/t.lx,Yt=Nt.z/t.lz;return Ct===z.Window?Va.makeWindow(t,Tt,0,Yt,z.Wall):Ct===z.Door?Va.makeDoor(t):null}function ei(qe){qe&&(Ue.current={id:qe.id,type:qe.type,status:0}),V(Ct=>{qe&&(Ct.elements.push(qe),Ct.selectedElement=qe,Ct.selectedElementIdSet.clear(),Ct.selectedElementIdSet.add(qe.id),qe.type===z.Window?Ct.addedWindowId=qe.id:qe.type===z.Door&&(Ct.addedDoorId=qe.id)),Ct.moveHandleType=zo.Mid,Ct.objectTypeToAdd=z.None})}function hr(qe){if(!qe)return;const{id:Ct,type:Nt}=qe;V(Tt=>{Tt.elements=Tt.elements.filter(Yt=>Yt.id!==Ct),Tt.selectedElement=null,Tt.moveHandleType=null,Tt.objectTypeToAdd=Nt,Tt.addedWindowId=null,Tt.addedDoorId=null}),Ue.current=null}function tr(qe){if(!qe)return[0,0];switch(qe.type){case z.Window:{const Ct=dt.getState().oldParentId;if(qe.parentId!==Ct){const Nt=M.getState().elements.find(Tt=>Tt.id===Ct);return Nt?[qe.lx*Nt.lx/2,qe.lz*Nt.lz/2]:[0,0]}else return[qe.lx*i/2,qe.lz*l/2]}case z.Door:return[qe.lx*i/2,qe.lz*l/2];case z.SolarPanel:return[qe.lx/2,qe.ly/2]}return[hP,hP]}function bi(){const qe=[];if(v){const Ct=v[0];if(Ct===.5&&C!==void 0)return qe.push(new ae(nt,v[1]-Ee),new ae(-nt,C-Ee)),qe;if(Ct===-.5&&P!==void 0)return qe.push(new ae(nt,P-Ee),new ae(-nt,v[1]-Ee)),qe}return P!==void 0?qe.push(new ae(nt,P-Ee)):qe.push(new ae(nt,Ee)),w!==void 0&&qe.push(new ae(w[0]*i,w[1]-Ee)),v!==void 0&&qe.push(new ae(v[0]*i,v[1]-Ee)),T!==void 0&&qe.push(new ae(T[0]*i,T[1]-Ee)),C!==void 0?qe.push(new ae(-nt,C-Ee)):qe.push(new ae(-nt,Ee)),qe}function Fo(qe,Ct){const Nt=Ct==null?void 0:Ct.ignorePadding,Tt=Ct!=null&&Ct.elementHalfSize?[...Ct.elementHalfSize]:[0,0],Yt=Nt?0:hP,Zt=Nt?0:hP+Oe,cn=Nt?0:hP+st,[yn,An]=Tt,[Tn,Ln,Yn,Wn]=[-nt+yn+Zt,nt-yn-cn,-Ee+An+Yt,Ee-An-Yt],oo=qe.clone();if(Yo()){const qn=Ye?N:0,qo=l-(Ye?Qe:l);return oo.setX(ye.clamp(qe.x,Tn,Ln)),oo.setZ(ye.clamp(qe.z,Yn+qn,Wn-qo)),oo}else{const qn=hl(yn,An,Tn,Ln,Yt),qo=new Kt(qe.x,qe.z);let ii=1/0,Qi=-1/0;if(Ct!=null&&Ct.resizeAnchor){const Hs=Ct.resizeAnchor.x,Qu=[];if(Ze)Qu.push(new ae(-nt,-Ee+Qe),new ae(nt,-Ee+lt));else{const zf=bi().reverse();Qu.push(...zf)}for(let zf=1;zf=Kl.x&&Hs<=O0.x){const Mh=(O0.y-Kl.y)/(O0.x-Kl.x),bp=-Mh*Kl.x+Kl.y;ii=Mh*Hs+bp;break}}const Zu=new ae(-nt,-Ee+it),Hh=new ae(nt,-Ee+ut),If=(Hh.y-Zu.y)/(Hh.x-Zu.x),ed=-If*Zu.x+Zu.y;Qi=If*Hs+ed}const Or=qo.y>ii;if(ar(qn,qo)){const Hs=to(qn,qo);oo.setX(Hs.x),oo.setZ(ye.clamp(Hs.y,Qi+Yt,ii-Yt))}else Or&&oo.setZ(ii-Yt)}return oo.setZ(Math.max(Yn,oo.z)),oo}function Si(qe,Ct){V(Nt=>{const Tt=Nt.elements.find(Yt=>Yt.id===qe);if(Tt)switch(Tt.type){case z.Window:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l,Tt.cy=Tt.id===Je.current?-.01:.3,Tt.tint=Tt.id===Je.current?"red":Nt.selectedElement.tint;break}case z.Door:{const Yt=l/2;Tt.cx=Ct.x/i,Tt.cz=(Ct.z-Yt)/2/l,Tt.lz=(Ct.z+Yt)/l;break}case z.SolarPanel:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l,Tt.color=Tt.id===Je.current?"red":"#fff";break}case z.Sensor:case z.Light:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l;break}case z.Polygon:{const Yt=Tt;if(Yt.vertices.length>0){const Zt=ye.calculatePolygonCentroid(Yt.vertices),cn=-Ct.x/i-Zt.x,yn=-Ct.z/l-Zt.y,An=Yt.vertices.map(Tn=>({x:Tn.x+cn,y:Tn.y+yn}));Tt.vertices=An}break}}})}function hl(qe,Ct,Nt,Tt,Yt){const Zt=[],cn=new ae(-nt,-Ee+it),yn=new ae(nt,-Ee+ut);if(Wo(cn,yn,qe,Ct,Yt,!0),Zt.push({start:new ae(Nt,Ee),end:new ae(Nt,cn.y)}),Zt.push({start:cn.clone(),end:yn.clone()}),Zt.push({start:new ae(Tt,yn.y),end:new ae(Tt,Ee)}),Ze){const Tn=new ae(nt,-Ee+lt),Ln=new ae(-nt,-Ee+Qe);Wo(Tn,Ln,qe,Ct,Yt),Zt.push({start:Tn.clone(),end:Ln.clone()})}else{const Tn=bi();for(let Ln=1;Ln{const Yt=Tt.elements.find(An=>An.id===(Nt==null?void 0:Nt.id));if(!Yt||Yt.type===z.SolarPanel&&Yt.parentType===void 0)return;if(Yt.type===z.Window){const An=Tt.elements.find(Tn=>Tn.id===Yt.parentId);if(An){const Tn=Yt.lx*An.lx,Ln=Yt.lz*An.lz;Yt.lx=Tn/i,Yt.lz=Ln/l}}const{pointerOnGrid:Zt}=lr(qe,we.current),cn=tr(Yt),yn=Fo(Zt,{elementHalfSize:cn,ignorePadding:Yt.type===z.SolarPanel});bt(Yt.id,yn,cn[0]*2,cn[1]*2),Yt.cx=yn.x/i,Yt.cz=yn.z/l,Yt.parentId=n,Yt.foundationId=A,Tt.selectedElement&&(Tt.selectedElement.parentId=n,Tt.selectedElement.foundationId=A),Yt.type===z.Window?(Yt.cy=Yt.id===Je.current?-.01:0,Yt.tint=Yt.id===Je.current?"red":Tt.selectedElement.tint):Yt.type===z.SolarPanel&&(Yt.color=Yt.id===Je.current?"red":"#fff",Yt.parentType=z.Wall)}),de("showWallIntersectionPlaneId",n))}else So()&&hr(Ue.current)}function Ai(qe){if(qe.button!==2){if(So()){kn.getState().setEnableOrbitController(!1),Te(!0);const{pointerOnGrid:Ct}=lr(qe,we.current),Nt=Fo(Ct);V(Tt=>{var Yt,Zt;Tt.moveHandleType=null,((Yt=Ue.current)==null?void 0:Yt.type)===z.Window?(Tt.resizeHandleType=Mt.LowerRight,Tt.resizeAnchor.copy(Nt)):((Zt=Ue.current)==null?void 0:Zt.type)===z.Door&&(Tt.resizeHandleType=Mt.UpperRight,Tt.resizeAnchor.copy(Nt).setZ(-l/2))}),Ue.current.status=1}else if(_r(qe))if(M.getState().objectTypeToAdd!==z.None){const Nt=qe.point;Zs(Nt,!0)}else M.getState().groupActionMode?(V(Nt=>{for(const Tt of Nt.elements)Tt.selected=Tt.id===A;Nt.multiSelectionsMode||Nt.selectedElementIdSet.clear(),Nt.selectedElementIdSet.has(A)?Nt.selectedElementIdSet.delete(A):Nt.selectedElementIdSet.add(A)}),qe.stopPropagation()):Qo()&&M.getState().selectMe(n,qe,Xo.Select)}}function Fa(){Ue.current&&Ue.current.status===0&&(V(qe=>{qe.elements.pop(),qe.addedDoorId=null,qe.addedWindowId=null,qe.moveHandleType=null,qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null)}function wi(){So()&&hr(Ue.current),Je.current=null}function Fs(qe){const Ct=M.getState().selectedElement??G();if((Ct==null?void 0:Ct.parentId)===t.id){if(M.getState().moveHandleType){const Nt=Ct.type!==z.Polygon?new ae(-Ct.lx/2*i,0,Ct.lz/2*l):void 0,{relativePointer:Tt,pointerOnGrid:Yt}=lr(qe,Me.current,Nt),Zt=tr(Ct),cn=Fo(Yt,{elementHalfSize:Zt,ignorePadding:Ct.type===z.SolarPanel}),[yn,An]=[Zt[0]*2,Zt[1]*2];if(Ct.type!==z.SolarPanel&&zt(Ct.id,cn,yn,An),Ct.type!==z.Polygon){let Tn=!0,Ln;Ct.type===z.Window&&Ct.windowType===Ci.Polygonal&&(Ln=Ct.polygonTop??Gp,Tn=Bt(cn,yn,An,Ln));const Yn=bt(Ct.id,cn,yn,An,Ln);Tn&&Yn?Je.current=null:Je.current=Ct.id}Si(Ct.id,cn)}else if(M.getState().resizeHandleType){const{relativePointer:Nt,pointerOnGrid:Tt}=lr(qe,Me.current),Yt=M.getState().resizeHandleType,Zt=M.getState().resizeAnchor;switch(Ct.type){case z.Window:{const cn=Ct,yn=Fo(Tt,{resizeAnchor:Zt});if(In(cn)){const{newLz:An,newCz:Tn,newArchHeight:Ln}=nr(cn,yn,Zt),Yn=new ae(cn.cx*i,0,Tn);bt(cn.id,Yn,cn.lx*i,An),zt(cn.id,Yn,cn.lx*i,An),V(Wn=>{const oo=Wn.elements.find(qn=>qn.id===cn.id);oo&&(oo.lz=An/l,oo.cz=Tn/l,oo.archHeight=Ln,oo.cy=oo.id===Je.current?-.01:.3,oo.tint=oo.id===Je.current?"red":cn.tint)})}else if(Yt===Mt.Upper){const An=new ae(cn.cx*i,0,cn.cz*l),[Tn,Ln]=[cn.lx*i,cn.lz*l],Yn=ye.clamp((Tt.x-Zt.x)/Tn,-.5,.5),Wn=Math.max(0,Tt.z-Zt.z),oo=[Yn,Wn];(!bt(cn.id,An,Tn,Ln,oo)||!Bt(An,Tn,Ln,oo))&&(Je.current=cn.id),V(qn=>{const qo=qn.elements.find(ii=>ii.id===cn.id);qo&&(qo.polygonTop=[...oo],qo.cy=qo.id===Je.current?-.01:.3,qo.tint=qo.id===Je.current?"red":cn.tint)})}else{const{dimensionXZ:An,positionXZ:Tn}=Bn(qe,yn,Zt),Ln=new ae(Tn.x,0,Tn.z);let Yn=!0,Wn;cn.windowType===Ci.Polygonal&&(Wn=cn.polygonTop??Gp,Yn=Bt(Ln,An.x,An.z,Wn)),(!bt(cn.id,Ln,An.x,An.z,Wn)||!Yn||!zt(cn.id,Ln,An.x,An.z))&&(Je.current=cn.id),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.lx=An.x/i,qn.lz=An.z/l,qn.cx=Tn.x/i,qn.cz=Tn.z/l,qn.cy=qn.id===Je.current?-.01:.3,qn.tint=qn.id===Je.current?"red":cn.tint)})}break}case z.Door:{const cn=Ct,yn=Fo(Tt,{resizeAnchor:Zt});if(In(cn)){const{newLz:An,newCz:Tn,newArchHeight:Ln}=nr(cn,yn,Zt),Yn=new ae(cn.cx*i,0,Tn);bt(cn.id,Yn,cn.lx*i,An),zt(cn.id,Yn,cn.lx*i,An,!0),V(Wn=>{const oo=Wn.elements.find(qn=>qn.id===cn.id);oo&&(oo.lz=An/l,oo.cz=Tn/l,oo.archHeight=Ln,oo.color=oo.id===Je.current?jce:Ct.color)})}else{const{dimensionXZ:An,positionXZ:Tn}=Bn(qe,yn,Zt),Ln=new ae(Tn.x,0,Tn.z);bt(cn.id,Ln,An.x,An.z),zt(cn.id,Ln,An.x,An.z,!0),V(Yn=>{const Wn=Yn.elements.find(oo=>oo.id===cn.id);Wn&&(Wn.cx=Tn.x/i,Wn.lx=An.x/i,Wn.cz=(yn.z-l/2)/2/l,Wn.lz=(yn.z+l/2)/l,Wn.color=Wn.id===Je.current?jce:Ct.color)})}break}case z.SolarPanel:{const cn=Ct,[yn,An]=Pi.getSolarPanelUnitLength(cn);if(Yt===Mt.Lower||Yt===Mt.Upper){const Ln=Math.max(1,Math.round(Math.abs(Nt.z-Zt.z)/An))*An,Yn=new ae(0,0,Nt.z-Zt.z).normalize().multiplyScalar(Ln),Wn=new ae().addVectors(Zt,Yn.clone().divideScalar(2));if(!ye.isElementInsideWall(Wn,cn.lx-.01,Ln-.01,Ft))return;bt(cn.id,Wn,cn.lx,Math.abs(Yn.z)),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.cz=Wn.z/l,qn.ly=Math.abs(Yn.z),qn.color=qn.id===Je.current?"red":"#fff")})}else if(Yt===Mt.Left||Yt===Mt.Right){const Ln=Math.max(1,Math.round(Math.abs(Nt.x-Zt.x)/yn))*yn,Yn=new ae(Nt.x-Zt.x,0,0).normalize().multiplyScalar(Ln),Wn=new ae().addVectors(Zt,Yn.clone().divideScalar(2));if(!ye.isElementInsideWall(Wn,Ln-.01,cn.ly-.01,Ft))return;bt(cn.id,Wn,Math.abs(Yn.x),cn.ly),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.cx=Wn.x/i,qn.lx=Math.abs(Yn.x),qn.color=qn.id===Je.current?"red":"#fff")})}break}case z.Polygon:{V(cn=>{const yn=cn.elements.find(An=>An.id===Ct.id);(yn==null?void 0:yn.selectedIndex)>=0&&(yn.vertices[yn.selectedIndex].x=-Tt.x/i,yn.vertices[yn.selectedIndex].y=-Tt.z/l)});break}}}}}function ks(){if(Je.current)Ue.current&&Ue.current.status===1?(V(qe=>{qe.elements.pop(),qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null):(M.getState().moveHandleType||M.getState().resizeHandleType)&&Eu.undoInvalidOperation();else if(Ue.current){if(Ue.current.status===0)V(qe=>{qe.elements.pop(),qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null;else if(Ue.current.status===1){const qe=M.getState().elements,Ct=qe[qe.length-1];Ct.lx*i<.1||Ct.lz*l<.1?V(Nt=>{Nt.elements.pop(),Nt.actionModeLock&&Ue.current&&(Nt.objectTypeToAdd=Ue.current.type)}):(V(Nt=>{Nt.actionModeLock&&Ue.current&&(Nt.objectTypeToAdd=Ue.current.type,Px.selectNone(Nt))}),On(Ct)),Ue.current=null}}else M.getState().moveHandleType?Eu.addUndoableMove():M.getState().resizeHandleType&&fo();kn.getState().setEnableOrbitController(!0),Te(!1),V(qe=>{qe.moveHandleType=null,qe.resizeHandleType=null,qe.selectedElement=qe.elements.find(Ct=>{var Nt;return Ct.id===((Nt=qe.selectedElement)==null?void 0:Nt.id)})}),de("showWallIntersectionPlaneId",null),Je.current=null,ir()}function Zs(qe,Ct){if(ve&&M.getState().objectTypeToAdd){let Nt=null;switch(M.getState().objectTypeToAdd){case z.PyramidRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makePyramidRoof([t.id],ve));break}case z.GableRoof:{!S&&Ko(!1,!1)&&(Nt=Va.makeGableRoof([t.id],ve));break}case z.HipRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makeHipRoof([t.id],ve,i/2));break}case z.GambrelRoof:{!S&&Ko(!1,!1)&&(Nt=Va.makeGambrelRoof([t.id],ve));break}case z.MansardRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makeMansardRoof([t.id],ve));break}case z.SolarPanel:{if(qe&&Ct){const Tt=yt(qe,t),Yt=M.getState().actionState;let Zt=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);Zt||(Zt=M.getState().getPvModule(R9)),Nt=Va.makeSolarPanel(t,Zt,Tt.x/i,0,Tt.z/l,Yt.solarPanelOrientation??vr.landscape,Yt.solarPanelPoleHeight??1,Yt.solarPanelPoleSpacing??3,0,0,new ae(0,-1,0),[Qt,0,0],Yt.solarPanelFrameColor)}break}case z.Sensor:{if(qe&&Ct){const Tt=yt(qe,t),Yt=t.relativeAngle-Qt;Nt=Va.makeSensor(t,(Tt.x-.05)/i,0,(Tt.z-.05)/l,new ae(Math.cos(Yt),Math.sin(Yt),0),[0,0,0])}break}case z.Light:{if(qe&&Ct){const Tt=yt(qe,t),Yt=t.relativeAngle-Qt,Zt=M.getState().actionState;Nt=Va.makeLight(t,2,Zt.lightDistance,Zt.lightIntensity,Zt.lightColor,(Tt.x-.05)/i,0,(Tt.z-.05)/l,new ae(Math.cos(Yt),Math.sin(Yt),0),[0,0,0])}break}case z.BatteryStorage:{if(qe&&Ct){const Tt=yt(qe,t);M.getState().actionState,Nt=Va.makeBatteryStorage(t,Tt.x/i,0,Tt.z/l)}break}}Nt&&(On(Nt),V(Tt=>{Tt.elements.push(Nt),Tt.selectedElementIdSet.clear(),Tt.selectedElementIdSet.add(Nt.id),Tt.selectedElement=Nt,Nt&&Nt.type===z.Roof&&Tt.addedRoofIdSet.add(Nt.id),Tt.actionModeLock||(Tt.objectTypeToAdd=z.None)}))}}function Yi(qe,Ct,Nt){ze.current||(q(n,qe,Xo.ContextMenu),V(Tt=>{qe.intersections.length>0&&qe.intersections[0].object===Ct&&(Tt.contextMenuObjectType=z.Wall,Nt&&Tt.pastePoint.copy(qe.intersections[0].point))}),qe.stopPropagation())}function ua(qe){if(qe.button===2)return;const Ct=M.getState().objectTypeToAdd;!So()&&!ie()&&_r(qe)&&Ct===z.None?M.getState().groupActionMode?(V(Nt=>{for(const Tt of Nt.elements)Tt.id===A?Tt.selected=!0:Tt.selected=!1}),qe.stopPropagation()):Qo()&&M.getState().selectMe(n,qe,Xo.Select):bn.isTypeRoof(Ct)&&Ai(qe)}function Vl(qe){qe.button===2||qe.intersections.length===0||qe.intersections[0].object!==qe.eventObject||(M.getState().groupActionMode?V(Ct=>{for(const Nt of Ct.elements)Nt.selected=Nt.id===A;Ct.selectedElementIdSet.clear(),Ct.selectedElementIdSet.add(A)}):(Ht(qe)&&(V(Ct=>{Ct.contextMenuObjectType=null}),q(n,qe,Xo.Select)),Zs(),qe.stopPropagation()))}function Jl(qe){qe.intersections.length>0&&qe.intersections[0].object===qe.eventObject&&(q(n,qe,Xo.ContextMenu),V(Ct=>{Ct.contextMenuObjectType=z.Wall}),qe.stopPropagation())}function $u(){let[qe,Ct]=v??[0,(Qe+lt)/2];qe=qe*i;const Nt=qe+nt,Tt=Math.hypot(Nt,Ct-Qe),Yt=-Math.atan2(Ct-Qe,Nt),Zt=nt-qe,cn=Math.hypot(Zt,lt-Ct),yn=-Math.atan2(lt-Ct,Zt);return h.jsxs("group",{name:`wall stud group ${n}`,children:[Ve.map(([An,Tn],Ln)=>{let Yn;return An{let Wn;return Tn0||x===gc.Default)&&h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{name:"Wall Simulation Mesh",uuid:n,userData:{simulation:!0},rotation:[Qt,0,0],castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[pt]}),h.jsx("meshBasicMaterial",{side:ti})]}),h.jsxs("mesh",{name:`${Eu.WALL_OUTSIDE_SURFACE_MESH_NAME} ${n}`,ref:we,rotation:[Qt,0,0],castShadow:Be,receiveShadow:Z,onContextMenu:qe=>{Yi(qe,we.current,!0)},onPointerMove:or,onPointerDown:Ai,onPointerUp:Fa,onPointerOut:wi,children:[h.jsx("shapeGeometry",{args:[pt]}),he&&ge?h.jsx("meshBasicMaterial",{attach:"material",map:ge,color:"white",opacity:F,transparent:je}):h.jsx("meshStandardMaterial",{attach:"material",color:d===Bo.Default||d===Bo.NoTexture?f:"white",map:B,transparent:je,opacity:F})]}),h.jsxs("mesh",{rotation:[Qt,0,0],position:[0,.05,0],castShadow:Be,children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx("meshStandardMaterial",{color:"white",side:r0,transparent:je,opacity:F})]}),h.jsxs("mesh",{name:"Inside Wall",ref:Pe,position:[0,a,0],rotation:[Qt,0,0],castShadow:Be,receiveShadow:Z,onPointerDown:ua,onContextMenu:qe=>{Yi(qe,Pe.current)},children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx(Yen,{transparent:je,color:f,opacity:F})]}),h.jsxs("mesh",{rotation:[Qt,0,0],position:[0,a-.01,0],receiveShadow:!0,children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx("meshStandardMaterial",{color:"white",side:Da,transparent:je,opacity:F})]}),(!S||Ze)&&!$e&&h.jsx("mesh",{name:"Top Wall",ref:Ie,material:Gt,position:[0,We,ht],rotation:[0,-ct,0],castShadow:Be,receiveShadow:Z,onPointerDown:ua,onContextMenu:qe=>{Yi(qe,Ie.current)},children:h.jsx("shapeGeometry",{args:[It]})}),Oe===0&&h.jsx(ta,{args:[Qe-it,a],material:Gt,position:[-nt+.01,We,-Ee+it+(Qe-it)/2],rotation:[0,Qt,0],castShadow:Be,receiveShadow:Z,onPointerDown:ua}),st===0&&h.jsx(ta,{args:[lt-ut,a],material:Gt,position:[nt-.01,We,-Ee+ut+(lt-ut)/2],rotation:[0,Qt,0],castShadow:Be,receiveShadow:Z,onPointerDown:ua}),(le||me===n)&&((mn=M.getState().selectedElement)==null?void 0:mn.parentId)===n&&h.jsxs(h.Fragment,{children:[h.jsx(ta,{ref:Me,name:Ben,args:[1e4,1e4],position:[0,a/3,0],rotation:[Qt,0,0],onPointerMove:Fs,onPointerUp:ks,visible:!1,children:h.jsx("meshBasicMaterial",{color:"blue",side:ti})}),h.jsx(ta,{name:oae,args:[i,l],rotation:[Qt,0,0],position:[0,a,0],onPointerMove:()=>{},visible:!1})]}),Ae.map(qe=>{switch(qe.type){case z.Window:return h.jsx(B$e,{...qe,cx:qe.cx*i,cy:qe.cy*a,cz:qe.cz*l,lx:qe.lx*i,ly:a,lz:qe.lz*l},qe.id);case z.Door:return E!==Fl.Full?null:h.jsx(Een,{...qe,cx:qe.cx*i,cy:0,cz:qe.cz*l,lx:qe.lx*i,ly:a,lz:qe.lz*l},qe.id);default:return null}})]}),Ae.map(qe=>qe.type===z.Polygon&&E!==Fl.Empty?h.jsx(iQe,{...qe},qe.id):null),x===gc.Stud&&$u(),x===gc.Pillar&&Cc(),$e&&h.jsx(Nen,{args:D,wallData:ft,parapetZ:wt,currWallPointData:kt,leftWallPointData:rt,rightWallPointData:at}),(x===gc.Default||y&&O)&&h.jsx(Sen,{lineColor:O&&y?B0:p,lineWidth:O&&y?2:g,hx:nt,hz:Ee,fill:E,isTopPartial:Ze,leftUnfilledHeight:N,rightUnfilledHeight:U,showParapet:$e,leftHeight:Qe,rightHeight:lt,center:v,centerLeft:T,centerRight:w}),O&&h.jsx(Gye,{element:t,verticalLift:0}),(le||me===n)&&((Hn=M.getState().selectedElement)==null?void 0:Hn.parentId)===n&&h.jsx("group",{position:[0,-.001,0],rotation:[Qt,0,0],children:h.jsx(eme,{hx:nt,hy:Ee,hz:0})}),h.jsx(jen,{wallModel:t,notBuilding:ve.notBuilding})]})},Ven=(t,e)=>t.wallModel===e.wallModel,_en=be.memo(Oen,Ven);class bn{static getWireframetStyle(e,n,o,r){return[o&&r?B0:e,o&&r?1:n]}static getComposedWallNormal(e){return new ae().subVectors(e.leftPoint,e.rightPoint).applyEuler(AG).normalize()}static getWallNormal(e){return new ae().subVectors(new ae(e.leftPoint[0],e.leftPoint[1]),new ae(e.rightPoint[0],e.rightPoint[1])).applyEuler(AG).normalize()}static isTypeRoof(e){return e===z.Roof||e===z.PyramidRoof||e===z.HipRoof||e===z.GableRoof||e===z.GambrelRoof||e===z.MansardRoof}static getIntersectionPoint(e,n,o,r){if(Math.abs(e.x-n.x)<.001&&Math.abs(o.x-r.x)<.001)return n.clone();const i=(n.y-e.y)/(n.x-e.x),a=(r.y-o.y)/(r.x-o.x);if(Math.abs(i-a)<.001)return n.clone();const l=[e.x,n.x,o.x,r.x],s=[e.y,n.y,o.y,r.y],c=((l[2]-l[3])*(l[1]*s[0]-l[0]*s[1])-(l[0]-l[1])*(l[3]*s[2]-l[2]*s[3]))/((l[2]-l[3])*(s[0]-s[1])-(l[0]-l[1])*(s[2]-s[3])),u=((s[2]-s[3])*(s[1]*l[0]-s[0]*l[1])-(s[0]-s[1])*(s[3]*l[2]-s[2]*l[3]))/((s[2]-s[3])*(l[0]-l[1])-(s[0]-s[1])*(l[2]-l[3]));return!Number.isFinite(c)||!Number.isFinite(u)?n.clone():new ae(c,u)}static getDistance(e,n,o){const r=n.y-e.y;if(r===0)return Math.abs(e.y-o.y);const i=e.x-n.x;if(i===0)return Math.abs(e.x-o.x);const a=n.x*e.y-e.x*n.y,l=Math.abs((r*o.x+i*o.y+a)/Math.sqrt(r*r+i*i));return l===0?1/0:l}static getWallPoints2D(e,n,o,r){const{lx:i,lz:a,rightRoofHeight:l,leftRoofHeight:s}=e,c=o??e.centerLeftRoofHeight,u=n??e.centerRoofHeight,d=r??e.centerRightRoofHeight,f=[],p=i/2,g=a/2;return f.push({x:-p,y:-g}),f.push({x:p,y:-g}),l?f.push({x:p,y:l-g}):f.push({x:p,y:g}),d&&f.push({x:d[0]*i,y:d[1]-g}),u&&f.push({x:u[0]*i,y:u[1]-g}),c&&f.push({x:c[0]*i,y:c[1]-g}),s?f.push({x:-p,y:s-g}):f.push({x:-p,y:g}),f}static isPointInside(e,n,o){let r=!1;for(let i=0,a=e.length-1;io!=u>o&&n<(c-l)*(o-s)/(u-s)+l&&(r=!r)}return r}static isRoofValid(e,n,o,r,i,a){for(const l of M.getState().elements)if(l.type===z.Wall&&l.roofId===e){const s=l;let c=[];if(s.id===n)c=bn.getWallPoints2D(s,r,i,a);else if(s.id===o){let u,d,f;r&&(u=[-r[0],r[1]]),a&&(d=[-a[0],a[1]]),i&&(f=[-i[0],i[1]]),c=bn.getWallPoints2D(s,u,d,f)}if(s.id===n||s.id===o){for(const u of M.getState().elements)if(u.parentId===s.id){let d=u.lx/2,f=u.lz/2,p=hP;u.type===z.SolarPanel&&(d=(d-.01)/s.lx,f=(u.ly/2-.01)/s.lz,p=0);const g=u.cx*s.lx-d*s.lx,A=u.cx*s.lx+d*s.lx,y=u.cz*s.lz+f*s.lz+p;if(!bn.isPointInside(c,g,y)||!bn.isPointInside(c,A,y))return!1}}}return!0}static getSegmentIdx(e,n){for(let o=0;oi.z){const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}else{const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else if(s<=c){const u=[l,a,i];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else{const u=[l,a,r];return ye.isPointInside(o.x,o.y,u.map(ye.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}}static getSegmentNormal(e){const[n,o,r]=e;return new ae().crossVectors(new ae().subVectors(n,o),new ae().subVectors(n,r)).normalize()}static getRotationFromNormal(e){return ye.isSame(e.normalize(),ko)?[0,0,0]:[Math.PI/2-Math.atan2(e.z,Math.hypot(e.x,e.y)),0,Math.atan2(e.y,e.x)+Math.PI/2]}static getRooftopElementZ(e,n,o){const[r,i,a]=e,l=(i.y-r.y)*(a.z-r.z)-(i.z-r.z)*(a.y-r.y),s=(i.z-r.z)*(a.x-r.x)-(i.x-r.x)*(a.z-r.z),c=(i.x-r.x)*(a.y-r.y)-(i.y-r.y)*(a.x-r.x);return-(-(l*r.x+s*r.y+c*r.z)+l*n.x+s*n.y)/c+o}static computeState(e,n,o){const r=bn.getSegmentIdx(e,n);if(o)return{segmentIdx:-1,segmentVertices:null,normal:new ae(0,0,1),rotation:[0,0,0]};if(r!==-1){const i=bn.getSegmentVertices(e,r,n),a=bn.getSegmentNormal(i),l=bn.getRotationFromNormal(a);return{segmentIdx:r,segmentVertices:i,normal:a,rotation:l}}else return{segmentIdx:-1,segmentVertices:null,normal:new ae(0,0,1),rotation:[0,0,0]}}static getOrderedWallArrayOfRoof(e){const n=new Map;for(const a of M.getState().elements)a.type===z.Wall&&a.roofId===e&&n.set(a.id,a);if(n.size===0)return{orderedWallArray:[],isLoop:!1};const o=n.entries().next().value[1],r=[o];let i=o.rightJoints[0];for(;i&&i!==o.id;){const a=n.get(i);if(a)r.push(a),i=a.rightJoints[0];else break}if(i===o.id)return{orderedWallArray:r,isLoop:!0};for(i=o.leftJoints[0];i;){const a=n.get(i);if(a)r.unshift(a),i=a.leftJoints[0];else break}return{orderedWallArray:r,isLoop:!1}}static getRoofBoundaryVertices(e){const n=Cn.getState().roofSegmentVerticesMap.get(e.id);if(!n)throw new Error;if(e.roofType!==Go.Gable&&e.rise<.01)return n[0].map(o=>({x:o.x,y:o.y}));switch(e.roofType){case Go.Gable:return n.length===1?n[0].map(o=>({x:o.x,y:o.y})):n.reduce((o,r)=>(o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Go.Gambrel:return n.reduce((o,r,i)=>((i===0||i===3)&&o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Go.Mansard:return n.reduce((o,r,i)=>(i!==n.length-1&&o.push({x:r[0].x,y:r[0].y}),o),[]);default:return n.reduce((o,r,i)=>(o.push({x:r[0].x,y:r[0].y}),o),[])}}static getAbsoluteWindowVerticesOnRoof(e,n){const o=[],r=new ae(e.cx,e.cy,e.cz),i=new ae(n.cx,n.cy,n.lz);if(e.windowType===Ci.Arched){const a=Math.min(e.archHeight,e.lx/2,e.lz);for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=s*c>0?new ae(e.lx/2*s,(e.lz/2-a)*c*s,0):new ae(e.lx/2*s,e.lz/2*c*s,0);u.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),u.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(u)}const l=new ae(0,e.lz/2,0);l.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),l.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(l)}else{for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ae(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}if(e.windowType===Ci.Polygonal&&e.polygonTop){const a=new ae(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);a.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),a.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(a)}}return o}static getRelativeWindowVerticesOnRoof(e){const n=[],o=new ae(e.cx,e.cy,e.cz);if(e.windowType===Ci.Arched){const r=Math.min(e.archHeight,e.lx/2,e.lz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=a*l>0?new ae(e.lx/2*a,(e.lz/2-r)*l*a,0):new ae(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(s)}const i=new ae(0,e.lz/2,0);i.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(i)}else{for(let r=-1;r<=1;r+=2)for(let i=-1;i<=1;i+=2){const a=new ae(e.lx/2*r,e.lz/2*i*r,0);a.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(a)}if(e.windowType===Ci.Polygonal&&e.polygonTop){const r=new ae(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);r.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(r)}}return n}static getAbsoluteSolarPanelVerticesOnRoof(e,n){const o=[],r=new ae(e.cx,e.cy,e.cz),i=new ae(n.cx,n.cy,n.cz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new ae(e.lx/2*a,e.ly/2*l*a,0);e.rotation[0]===0?s.applyEuler(new ln(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}return o}static getElementVerticesOnRoof(e,n){return e.type===z.SolarPanel?bn.getSolarPanelVerticesOnRoof(e,n):e.type===z.SolarWaterHeater?bn.getSolarWaterHeaterVerticesOnRoof(e,n):[]}static getSolarPanelVerticesOnRoof(e,n){const o=[],r=new ae(e.cx,e.cy,e.cz+n.cz);for(let i=-1;i<=1;i+=2)for(let a=-1;a<=1;a+=2){const l=new ae(e.lx/2*i,e.ly/2*a*i,0);e.rotation[0]===0?l.applyEuler(new ln(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):l.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),o.push(l)}return o}static getSolarWaterHeaterVerticesOnRoof(e,n){const o=[],{lx:r,ly:i,lz:a,waterTankRadius:l,relativeAzimuth:s}=e,c=a-l*2,u=Math.asin(Math.min(1,(c+l)/i)),d=i*Math.cos(u),f=i/2+l,p=new ae(e.cx,e.cy,e.cz+n.cz),g=new ln(0,0,s,"ZXY");return o.push(new ae(-r/2,f).applyEuler(g).add(p)),o.push(new ae(-r/2,f-d).applyEuler(g).add(p)),o.push(new ae(r/2,f-d).applyEuler(g).add(p)),o.push(new ae(r/2,f).applyEuler(g).add(p)),o}static getWindowVerticesOnRoof(e,n=0){const o=[],r=new ae(e.cx,e.cy,e.cz),[i,a]=[e.lx/2+n,e.lz/2+n];for(let l=-1;l<=1;l+=2)for(let s=-1;s<=1;s+=2){const c=new ae(l*i,l*s*a);c.applyEuler(new ln().fromArray([e.rotation[0],e.rotation[1],e.rotation[2],"ZXY"])).add(r),o.push(c)}if(e.windowType===Ci.Polygonal){const[l,s]=e.polygonTop??Gp,c=new ae(l*e.lx,e.lz+s).add(r);o.push(c)}return o}static rooftopElementBoundaryCheck(e,n){for(const o of e)if(!ye.isPointInside(o.x,o.y,n))return!1;return!0}static rooftopWindowCollisionCheck(e,n,o){const r=[];for(const i of M.getState().elements)if(i.parentId===o&&i.id!==e){const a=bn.getWindowVerticesOnRoof(i);r.push(a)}for(const i of r){for(const a of n)if(ye.isPointInside(a.x,a.y,i))return!1;for(const a of i)if(ye.isPointInside(a.x,a.y,n))return!1}return!0}static rooftopElementCollisionCheck(e,n,o){for(const r of M.getState().elements)if((r.type===z.SolarPanel||r.type===z.SolarWaterHeater)&&r.parentId===e.parentId&&r.id!==e.id){const i=bn.getElementVerticesOnRoof(r,n);for(const s of o)if(ye.isPointInside(s.x,s.y,i))return!1;for(const s of i)if(ye.isPointInside(s.x,s.y,o))return!1;const a=o.map(ye.mapVector3ToPoint2),l=i.map(ye.mapVector3ToPoint2);a.push(a[0]),l.push(l[0]);for(let s=0;s0){for(const i of r)if(!i.leftJoints||i.leftJoints.length===0||!i.rightJoints||i.rightJoints.length===0)return Uc.WALL_DISJOINED}return Uc.COMPLETE}static calculateBuildingArea(e){const n=Eo.getWallPointsOfRoof(e);return Eo.getPolygonArea(n)}static toUValueInUS(e){return e/5.67826}static toUValueInSI(e){return e*5.67826}static toRValueInUS(e){return e*5.67826}static toRValueInSI(e){return e/5.67826}static fetchWaterTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");if(r){const i=r.createRadialGradient(e/2,n/2,0,e/2,n/2,Math.max(e,n)/2);i.addColorStop(0,"#45AAEA"),i.addColorStop(.04,"#2B65EC"),i.addColorStop(.2,"#0000FF"),r.fillStyle=i,r.fillRect(0,0,e,n)}return new g8(o)}static fetchWhiteTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");return r&&(r.fillStyle="white",r.fillRect(0,0,e,n)),new g8(o)}static fetchIntersectables(e){const n=[];return e.traverse(o=>{o.userData.unintersectable||n.push(o)}),n}static fetchSimulationElements(e,n){if(e.userData.simulation&&n.push(e),e.children.length>0)for(const o of e.children)Eo.fetchSimulationElements(o,n)}static getSimulationElements(e,n,o){if(e.userData.simulation&&e.uuid!==o&&n.push(e),e.children.length>0)for(const r of e.children)Eo.getSimulationElements(r,n,o)}static hasMovingParts(e){for(const n of e)switch(n.type){case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:return!0;case z.SolarPanel:if(n.trackerType!==Ll.NO_TRACKER)return!0}return!1}static onBuildingEnvelope(e){return e.type===z.Foundation||e.type===z.Window||e.type===z.Door||e.type===z.Wall||e.type===z.Roof}static getWindowArea(e,n){if(n){if(e.windowType===Ci.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ci.Polygonal&&e.polygonTop){let o=e.lx*e.lz*n.lx*n.lz;return o+=e.lx*n.lx*e.polygonTop[1]/2,o}return e.lx*e.lz*n.lx*n.lz}else{if(e.windowType===Ci.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ci.Polygonal&&e.polygonTop){let o=e.lx*e.lz;return o+=e.lx*e.polygonTop[1]/2,o}return e.lx*e.lz}}static getDoorArea(e,n){if(n){if(e.doorType===Rd.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz*n.lx*n.lz}else{if(e.doorType===Rd.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz}}static hasHeliostatOrFresnelReflectors(e){for(const n of e)if(n.type===z.FresnelReflector||n.type===z.Heliostat)return!0;return!1}static lineIntersection(e,n,o,r){const i=n.x-e.x,a=n.y-e.y,l=i*(r.y-o.y)-(r.x-o.x)*a;if(l===0)return;const s=((r.y-o.y)*(r.x-e.x)+(o.x-r.x)*(r.y-e.y))/l,c=((e.y-n.y)*(r.x-e.x)+i*(r.y-e.y))/l;if(!(!(0<=s&&s<=1)||!(0<=c&&c<=1)))return{x:e.x+s*i,y:e.y+s*a}}static calculateSolarRadiationColor(e,n){const o=n/(Iz.length-1);let r=Math.max(0,Math.floor(e/o));r>Iz.length-2&&(r=Iz.length-2);const i=Math.min(1,(e-o*r)/o);return new rr(Iz[r]).lerp(Iz[r+1],i)}static transpose(e){return e[0].map((n,o)=>e.map(r=>r[o]))}static clone2DArray(e){return e.map(n=>[...n])}static fetchHeatmapTexture(e,n,o){if(!e)return null;const r=document.createElement("canvas"),i=e.length,a=e[0].length;r.width=i,r.height=a;const l=r.getContext("2d");if(l){l.clearRect(0,0,i,a);const s=l.getImageData(0,0,i,a),c=s.data;for(let u=0;un!=u>n&&e<(c-l)*(n-s)/(u-s)+l&&(r=!r)}return r}static getPoints(e){const n=[];for(const o of e)n.push({x:o.x,y:o.y});return n}static polygonIntersections(e,n,o){const r=new Array;let i,a,l;for(let s=0;s0&&(n>l.x&&(n=l.x),r>l.y&&(r=l.y),o=o||Math.abs(a)>=r)return!1;const l=e.rightPoint[0],s=e.rightPoint[1];return!(Math.abs(l)>=o||Math.abs(s)>=r)}static isSensorWithin(e,n){return Math.abs(e.cx)<.5-e.lx/n.lx&&Math.abs(e.cy)<.5-e.ly/n.ly}static isSolarCollectorWithinHorizontalSurface(e,n){const o=e.cx,r=e.cy,i=Math.cos(e.relativeAzimuth),a=Math.sin(e.relativeAzimuth),l=n.lx*.5,s=n.ly*.5,c=e.lx*.5,u=e.ly*.5*Math.cos(e.tiltAngle);let d=o+c*i-u*a,f=r+c*a+u*i;return!(Math.abs(d)>l||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWindTurbineWithinHorizontalSurface(e,n){return Math.abs(e.cx)<=.5&&Math.abs(e.cy)<=.5}static isUnitVectorX(e){return Eo.isSame(e,Op)||Eo.isSame(e,Vp)}static isUnitVectorY(e){return Eo.isSame(e,Yc)||Eo.isSame(e,_p)}static isSame(e,n){return Math.abs(e.x-n.x)Et)return!1;return!0}static isEqual(e,n){return Math.abs(e-n)-1&&e.splice(o,1)}static fixElements(e){const n=[];for(const o of e)o.type||n.push(o);if(n.length>0)for(const o of n)Eo.deleteElement(e,o)}static fixViewStateLight(e){e.ambientLightIntensity&&(e.ambientLightIntensity*=2),e.directLightIntensity&&(e.directLightIntensity*=3.5)}static isResizingVertical(e){switch(e){case Mt.LowerLeftTop:case Mt.UpperLeftTop:case Mt.LowerRightTop:case Mt.UpperRightTop:return!0;default:return!1}}static isTopResizeHandle(e){return e===Mt.LowerLeftTop||e===Mt.LowerRightTop||e===Mt.UpperLeftTop||e===Mt.UpperRightTop||e===Mt.Top}static isXResizeHandle(e){return e===Mt.Left||e===Mt.Right}static isYResizeHandle(e){return e===Mt.Upper||e===Mt.Lower}static isTopResizeHandleOfWall(e){return e===Mt.UpperLeft||e===Mt.UpperRight}static isRiseHandleOfRoof(e){return e===Lr.Top||e===Lr.Mid||e===Lr.TopMid}static isMoveHandle(e){return e===zo.Default||e===zo.Top||e===zo.Upper||e===zo.Lower||e===zo.Left||e===zo.Right}static snapToNormalGrid(e){const n=Math.round(e.x/P6)*P6,o=Math.round(e.y/P6)*P6;return new ae(n,o,e.z)}static snapToFineGrid(e){const n=Math.round(e.x/m9)*m9,o=Math.round(e.y/m9)*m9;return new ae(n,o,e.z)}static isPositionRelative(e){return e===z.SolarPanel||e===z.ParabolicTrough||e===z.ParabolicDish||e===z.FresnelReflector||e===z.Heliostat||e===z.WindTurbine||e===z.SolarWaterHeater||e===z.Sensor||e===z.Light||e===z.Polygon||e===z.Window||e===z.Door||e===z.Roof||e===z.Wall}static isPlantOrHuman(e){return e.type===z.Tree||e.type===z.Flower||e.type===z.Human}static isFoundationOrCuboid(e){return e.type===z.Foundation||e.type===z.Cuboid}static isSolarCollector(e){return Eo.isSolarCollectorType(e.type)}static isSolarCollectorType(e){return e===z.SolarPanel||e===z.SolarWaterHeater||Eo.isCspCollectorType(e)}static isCspCollector(e){return Eo.isCspCollectorType(e.type)}static isCspCollectorType(e){return e===z.ParabolicDish||e===z.ParabolicTrough||e===z.FresnelReflector||e===z.Heliostat}static isParabolicCollector(e){return Eo.isParabolaType(e.type)}static isParabolaType(e){return e===z.ParabolicDish||e===z.ParabolicTrough}static isParabolicTroughOrFresnelReflector(e){return e===z.FresnelReflector||e===z.ParabolicTrough}static isHeliostatOrFresnelReflector(e){return e===z.FresnelReflector||e===z.Heliostat}static isLegalOnWall(e){switch(e){case z.Window:case z.Door:case z.Sensor:case z.Light:case z.SolarPanel:case z.Polygon:return!0}return!1}static isDescendantOf(e,n){const o=e.parentId;if(!o||o===Zo)return!1;const r=M.getState().getElementById(o);return r?r.id===n?!0:Eo.isDescendantOf(r,n):!1}static isElementInsideWall(e,n,o,r,i){const a=n/2,l=o/2;for(let c=-1;c<=1;c+=2)for(let u=-1;u<=1;u+=2){if(i&&u===-1)continue;const d=e.x+a*c,f=e.z+l*u;if(!Eo.isPointInside(d,f,r))return!1}const s=[{x:e.x-a,y:e.z-l},{x:e.x-a,y:e.z+l},{x:e.x+a,y:e.z+l},{x:e.x+a,y:e.z-l}];for(const c of r)if(Eo.isPointInside(c.x,c.y,s))return!1;return!0}static isRectOutsideBoundary(e,n,o,r,i,a){return e+o>i||e-o<-i||n+r>a||n-r<-a}static getSolarPanelVerticesOnCuboidVerticalFace(e){const n=[],[o,r]=[e.lx/2,e.ly/2];return Eo.isIdentical(e.normal,[-1,0,0])||Eo.isIdentical(e.normal,[1,0,0])?(n.push({x:e.cy-o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz+r}),n.push({x:e.cy-o,y:e.cz+r})):(Eo.isIdentical(e.normal,[0,1,0])||Eo.isIdentical(e.normal,[0,-1,0]))&&(n.push({x:e.cx-o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz+r}),n.push({x:e.cx-o,y:e.cz+r})),n}static checkCollisionOnCuboidSameVerticalFace(e){for(const n of M.getState().elements)if(n.type===z.SolarPanel&&n.id!==e.id&&n.parentId===e.parentId&&Eo.isIdentical(n.normal,e.normal)){const o=Eo.getSolarPanelVerticesOnCuboidVerticalFace(n),r=Eo.getSolarPanelVerticesOnCuboidVerticalFace(e);for(const i of o)if(Eo.isPointInside(i.x,i.y,r))return!0;for(const i of r)if(Eo.isPointInside(i.x,i.y,o))return!0}return!1}static checkElementOnCuboidState(e,n){if(Eo.isIdentical(e.normal,[0,0,1])){if(!Eo.isSolarCollectorWithinHorizontalSurface(e,n))return pa.OutsideBoundary;if(M.getState().overlapWithSibling(e))return pa.OverLap}else{const[o,r]=[e.lx/2,e.ly/2],[i,a,l]=[n.lx/2,n.ly/2,n.lz/2];if(Eo.isIdentical(e.normal,[-1,0,0])||Eo.isIdentical(e.normal,[1,0,0])){if(Eo.isRectOutsideBoundary(e.cy,e.cz,o,r,a,l))return pa.OutsideBoundary}else if((Eo.isIdentical(e.normal,[0,1,0])||Eo.isIdentical(e.normal,[0,-1,0]))&&Eo.isRectOutsideBoundary(e.cx,e.cz,o,r,i,l))return pa.OutsideBoundary;if(Eo.checkCollisionOnCuboidSameVerticalFace(e))return pa.OverLap}return pa.Valid}static checkElementOnWallState(e,n){let r=e.lx/2+1e-5,i=e.lz/2+1e-5;n&&e.type===z.SolarPanel&&(r=r/n.lx+1e-5,i=e.ly/2/n.lz+1e-5);const a=e.cx-r,l=e.cx+r,s=e.cz-i,c=e.cz+i;if(n&&n.type===z.Wall&&!Eo.isElementInsideWall(new ae(e.cx*n.lx,e.cy,e.cz*n.lz),n.lx*r*2,n.lz*i*2,Eo.getWallInnerSideShapePoints(n),e.type===z.Door))return pa.OutsideBoundary;for(const u of M.getState().elements)if(Eo.isLegalOnWall(u.type)&&u.type!==z.Polygon&&u.parentId===e.parentId&&u.id!==e.id){let d=u.lx/2,f=u.lz/2;n&&u.type===z.SolarPanel&&(d=d/n.lx,f=u.ly/2/n.lz);const p=u.cx-d,g=u.cx+d,A=u.cz-f,y=u.cz+f;if((a>=p&&a<=g||l>=p&&l<=g||p>=a&&p<=l||g>=a&&g<=l)&&(s>=A&&s<=y||c>=A&&c<=y||A>=s&&A<=c||y>=s&&y<=c))return pa.OverLap}return pa.Valid}static checkElementOnRoofState(e,n){if(e.foundationId){const o=M.getState().getElementById(e.foundationId);if(o){const r=bn.getElementVerticesOnRoof(e,o),i=bn.getRoofBoundaryVertices(n);return bn.rooftopElementBoundaryCheck(r,i)?bn.rooftopElementCollisionCheck(e,o,r)?pa.Valid:pa.OverLap:pa.OutsideBoundary}}return pa.Invalid}static relativeCoordinates(e,n,o,r,i){const a=new ae(e,n,o);if(r.type===z.Wall){const l=new ae(r.cx,r.cy),s=M.getState().getParent(r);if(s){const c=new ae(s.cx,s.cy);l.applyEuler(new ln(0,0,s.rotation[2])).add(c).setZ(s.lz+r.lz/2),a.sub(l).applyEuler(new ln(0,0,-r.relativeAngle-s.rotation[2]))}}else{const{pos:l,rot:s}=Eo.getWorldDataById(r.id);a.set(e-l.x,n-l.y,o-l.z),a.applyEuler(new ln(0,0,-s))}return i||(a.x/=r.lx,a.y/=r.ly,a.z/=r.lz),a}static absoluteCoordinates(e,n,o,r,i,a,l){if(r.type===z.Wall&&i){const c=r,u=i?i.rotation[2]+c.relativeAngle:c.relativeAngle;if(u!==void 0){const d=Eo.wallAbsolutePosition(new ae(c.cx,c.cy,c.cz),i).setZ(c.lz/2+i.lz),f=new ae(e*c.lx,n*c.ly,o*c.lz);if(f.applyAxisAngle(ko,u),a){const p=a*Math.cos(u-Qt),g=a*Math.sin(u-Qt);return new ae(d.x+f.x+p,d.y+f.y+g,d.z+f.z)}return new ae(d.x+f.x,d.y+f.y,d.z+f.z)}}if(r.type===z.Roof&&i){const c=new ae(e,n,o+i.cz);return c.applyEuler(new ln().fromArray(i.rotation)),c.x+=i.cx,c.y+=i.cy,c}const s=new ae;return l?s.set(e,n,o):s.set(e*r.lx,n*r.ly,o*r.lz),s.applyEuler(new ln().fromArray(r.rotation)),s.x+=r.cx,s.y+=r.cy,s.z+=r.cz,s}static absoluteHumanOrTreeCoordinates(e,n,o,r){const i=new ae(e,n,o);return i.applyEuler(new ln().fromArray(r.rotation)),i.x+=r.cx,i.y+=r.cy,i.z+=r.cz,i}static relativePoint(e,n){const o=new ae(e.x-n.cx,e.y-n.cy,e.z-n.cz);return o.applyEuler(new ln().fromArray(n.rotation.map(r=>-r))),o}static wallAbsolutePosition(e,n){const o=new ae(n.cx,n.cy);return new ae().addVectors(o,new ae(e.x,e.y).applyAxisAngle(ko,n.rotation[2]))}static wallRelativePosition(e,n){const o=new ae(n.cx,n.cy);return new ae().subVectors(new ae(e.x,e.y),o).applyAxisAngle(ko,-n.rotation[2])}static getObjectChildById(e,n){if(e){for(const o of e.children)if(o.name===Xv){const r=Eo.getStackCuboidObjectById(o,n);if(r)return r}else if(o.name.includes(n))return o}return null}static getStackCuboidObjectById(e,n){if(e)for(const o of e.children){if(o.name.includes(n))return o;if(o.name===M$e){const r=Eo.getStackCuboidObjectById(o.children[0],n);if(r)return r}}return null}static toRadians(e){return e*(Math.PI/180)}static toDegrees(e){return e*(180/Math.PI)}static getArrayMax(e){return e.reduce((n,o)=>Math.max(n,o))}static getArrayMin(e){return e.reduce((n,o)=>Math.min(n,o))}static getArrayMax2D(e){return Eo.getArrayMax(e.map(Eo.getArrayMax))}static getArrayMin2D(e){return Eo.getArrayMin(e.map(Eo.getArrayMin))}static sphericalToCartesianZ(e){const n=e.x*Math.cos(e.z),o=n*Math.cos(e.y),r=n*Math.sin(e.y),i=e.x*Math.sin(e.z);return e.set(o,r,i),e}static getDistance(e,n,o,r){return e=Eo.toRadians(e),n=Eo.toRadians(n),o=Eo.toRadians(o),r=Eo.toRadians(r),Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(Math.abs(e-o)))}static minutesIntoDay(e){return e.getHours()*60+e.getMinutes()}static dayOfYear(e){return(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(e.getFullYear(),0,0))/864e5}static daysInYear(e){const n=e.getFullYear();return n%4===0&&n%100>0||n%400===0?366:365}static daysOfMonth(e,n){return new Date(n,e+1,0).getDate()}static fahrenheitToCelsius(e){return(e-32)*5/9}static celsiusToFahrenheit(e){return e*(9/5)+32}static getOS(){var e;return(e=rje.os)==null?void 0:e.family}static isMac(){const e=Eo.getOS();return e?e.includes("Mac")||e.includes("OS X"):!1}static isChrome(){const e=Eo.getOS();return e?e.includes("Chrome"):!1}static detectWebGLContext(){try{const e=document.createElement("canvas");return!!window.WebGLRenderingContext&&(!!e.getContext("webgl")||!!e.getContext("experimental-webgl"))}catch{return!1}}static clamp(e,n,o){return n>o?(n+o)/2:Math.min(Math.max(e,n),o)}static distanceFromPointToLine2D(e,n,o){const[r,i]=[e.x,e.y],[a,l]=[n.x,n.y],[s,c]=[o.x,o.y],u=r-a,d=i-l,f=s-a,p=c-l,g=u*f+d*p,A=f*f+p*p;let y=-1;A!==0&&(y=g/A);let S,C;y<0?(S=a,C=l):y>1?(S=s,C=c):(S=a+y*f,C=l+y*p);const P=r-S,v=i-C;return Math.sqrt(P*P+v*v)}static mapVector3ToPoint2(e){return{x:e.x,y:e.y}}static getWallVertices(e,n){const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:-r-n},a={x:o+n,y:-r-n},l={x:-o-n,y:(e.leftRoofHeight??e.lz)-r+n},s={x:o+n,y:(e.rightRoofHeight??e.lz)-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static isPartialWallFull(e){return Eo.isZero((e.leftRoofHeight??e.lz)-e.leftTopPartialHeight)&&Eo.isZero((e.rightRoofHeight??e.lz)-e.rightTopPartialHeight)&&Eo.isZero(e.leftUnfilledHeight)&&Eo.isZero(e.rightUnfilledHeight)}static getPartialWallVertices(e,n){if(Eo.isPartialWallFull(e))return Eo.getWallVertices(e,n);const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:e.leftUnfilledHeight-r-n},a={x:o+n,y:e.rightUnfilledHeight-r-n},l={x:-o-n,y:e.leftTopPartialHeight-r+n},s={x:o+n,y:e.rightTopPartialHeight-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static getHighestPointOfWall(e){let n=e.lz;return e.leftRoofHeight&&(n=Math.max(n,e.leftRoofHeight)),e.rightRoofHeight&&(n=Math.max(n,e.rightRoofHeight)),e.centerRightRoofHeight&&(n=Math.max(n,e.centerRightRoofHeight[1])),e.centerRoofHeight&&(n=Math.max(n,e.centerRoofHeight[1])),e.centerLeftRoofHeight&&(n=Math.max(n,e.centerLeftRoofHeight[1])),n}static getWallPointsOfRoof(e,n){let o=n??M.getState().getElementById(e.wallsId[0]);if(!o)return[];const r=o,i=[];for(;o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.leftJoints[0]);)if(o.leftJoints[0]!==r.id)o=M.getState().getElementById(o.leftJoints[0]);else return i.reverse(),i;for(i.reverse(),o=M.getState().getElementById(r==null?void 0:r.rightJoints[0]);o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.rightJoints[0]&&o.rightJoints[0]!==r.id);)o=M.getState().getElementById(o.rightJoints[0]);return i}static getWallInnerSideShapePoints(e){const{lx:n,ly:o,lz:r,relativeAngle:i,fill:a,leftUnfilledHeight:l,rightUnfilledHeight:s,leftRoofHeight:c,centerLeftRoofHeight:u,centerRoofHeight:d,centerRightRoofHeight:f,rightRoofHeight:p,leftJoints:g,rightJoints:A}=e,y=g.length>0?M.getState().getElementById(g[0]):null,S=A.length>0?M.getState().getElementById(A[0]):null,C=y&&y.type===z.Wall?Eo.getInnerWallOffset(y,n,o,i,"left"):0,P=S&&S.type===z.Wall?Eo.getInnerWallOffset(S,n,o,i,"right"):0,v=[],T=n/2,w=r/2;return a===Fl.Partial?(v.push({x:-T+C,y:-w+l}),v.push({x:T-P,y:-w+s})):(v.push({x:-T+C,y:-w}),v.push({x:T-P,y:-w})),p?v.push({x:T-P,y:p-w}):v.push({x:T-P,y:w}),f&&v.push({x:f[0]*n,y:f[1]-w}),d&&v.push({x:d[0]*n,y:d[1]-w}),u&&v.push({x:u[0]*n,y:u[1]-w}),c?v.push({x:-T+C,y:c-w}):v.push({x:-T+C,y:w}),v}static getInnerWallOffset(e,n,o,r,i){let a=0;if(e&&e.fill!==Fl.Empty){const l=i==="left"?-1:1,s=(Math.PI*3+l*(r-e.relativeAngle))%sa;s<=Qt+.01&&s>0&&(a=Math.min(o/Math.tan(s)+e.ly,n))}return a}static isElementAllowedMultipleMoveOnGround(e){return e.type===z.Foundation||e.type===z.Cuboid&&e.parentId===Zo}static areBasesOverlapped(e,n,o){const r=o.get(e),i=o.get(n);if(!r||!i)return!1;for(const a of r)if(Eo.isPointInside(a.x,a.y,i))return!0;for(const a of i)if(Eo.isPointInside(a.x,a.y,r))return!0;r.push(r[0]),i.push(i[0]);for(let a=0;aNumber(c)),[a,l,s]=n.split(".").map(c=>Number(c));return oa?!1:rl?!1:i{const n=M.getState().getElementById,o=[],r=e;for(;e&&(o.push(e),e.leftJoints[0]);)if(e.leftJoints[0]!==r.id){const a=n(e.leftJoints[0]);a&&a.type===z.Wall&&(e=a)}else return o;const i=n(r.rightJoints[0]);for(i&&i.type===z.Wall&&(e=i);e&&(o.push(e),e.rightJoints[0]&&e.rightJoints[0]!==r.id);){const a=n(e.rightJoints[0]);a&&(e=a)}return o},Eo.getWorldDataById=e=>{const n=M.getState().getElementById(e);if(!n)return{pos:new ae,rot:0,topZ:0};const o=new ae(n.cx,n.cy,n.cz),r=n.rotation[2],i=n.lz;if(n.parentId===Zo)return{pos:o,rot:r,topZ:i};const{pos:a,rot:l,topZ:s}=Eo.getWorldDataById(n.parentId),c=new ln(0,0,l);return{pos:new ae().addVectors(o.applyEuler(c),a.clone().setZ(s)),rot:r+l,topZ:i+s}},Eo.isChild=(e,n,o=!1)=>{const r=M.getState().getElementById(n);return!r||o&&r.locked?!1:r.parentId===e?!0:Eo.isChild(e,r.parentId,o)},Eo.getBaseId=e=>{const n=M.getState().getElementById(e);return n?n.parentId===Zo?n.id:Eo.getBaseId(n.parentId):null},Eo.isElementTriggerAutoDeletion=e=>{if(e.type===z.Roof){const r=e;if(r.roofType===Go.Gable||r.roofType===Go.Gambrel)return!0}if(e.type!==z.Wall)return!1;const n=e;if(!n.roofId)return!1;const o=M.getState().getElementById(n.roofId);if(!o)return!1;switch(o.roofType){case Go.Hip:case Go.Gable:case Go.Gambrel:return!0;case Go.Pyramid:case Go.Mansard:return o.wallsId.length===0?!1:o.wallsId[0]===n.id;default:return!1}};let ye=Eo;var XSe;class JSe{constructor(){this[XSe]=!0,this.latitude=42.2844063,this.longitude=-71.3488548,this.address=pG,this.countryCode="US",this.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),this.name="default",this.ground={albedo:.3,thermalDiffusivity:.05,snowReflectionFactors:new Array(12).fill(0)},this.leafDayOfYear1=Nq,this.leafDayOfYear2=Uq,this.airAttenuationCoefficient=.01,this.airConvectiveCoefficient=5,this.timesPerHour=1,this.daysPerYear=12,this.monthlyIrradianceLosses=new Array(12).fill(.05),this.pvGridCellSize=.5,this.discretization=Em.APPROXIMATE,this.diurnalTemperatureModel=y2.Sinusoidal,this.highestTemperatureTimeInMinutes=900,this.solarPanelVisibilityGridCellSize=.2,this.solarRadiationHeatmapGridCellSize=.5,this.cspTimesPerHour=1,this.cspDaysPerYear=4,this.cspGridCellSize=.5,this.sutTimesPerHour=1,this.sutDaysPerYear=4,this.sutGridCellSize=1,this.noAnimationForHeatmapSimulation=!1,this.noAnimationForThermalSimulation=!1,this.noAnimationForSensorDataCollection=!1,this.noAnimationForSolarPanelSimulation=!1,this.noAnimationForSolarUpdraftTowerSimulation=!1}static resetWorldModel(e){e.latitude=42.2844063,e.longitude=-71.3488548,e.address=pG,e.countryCode="US",e.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),e.name="default",e.ground.albedo=.3,e.ground.thermalDiffusivity=.05,e.ground.snowReflectionFactors.fill(0),e.airAttenuationCoefficient=.01,e.airConvectiveCoefficient=5,e.timesPerHour=1,e.daysPerYear=12,e.monthlyIrradianceLosses=new Array(12).fill(.05),e.pvGridCellSize=.5,e.discretization=Em.APPROXIMATE,e.diurnalTemperatureModel=y2.Sinusoidal,e.highestTemperatureTimeInMinutes=900,e.solarPanelVisibilityGridCellSize=.2,e.solarRadiationHeatmapGridCellSize=.5,e.cspTimesPerHour=1,e.cspDaysPerYear=4,e.cspGridCellSize=.5,e.sutTimesPerHour=1,e.sutDaysPerYear=4,e.sutGridCellSize=1,e.noAnimationForHeatmapSimulation=!1,e.noAnimationForThermalSimulation=!1,e.noAnimationForSensorDataCollection=!1,e.noAnimationForSolarPanelSimulation=!1,e.noAnimationForSolarUpdraftTowerSimulation=!1}getElements(){const e=[],n={type:z.Foundation,cx:0,cy:0,cz:.05,lx:10,ly:10,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,textureType:_i.NoTexture,id:Gi.generate()};e.push(n);const o={type:z.Sensor,cx:-.1,cy:0,cz:.105,lx:.1,ly:.1,lz:.01,parentId:n.id,foundationId:n.id,normal:[0,0,1],rotation:[0,0,0],id:Gi.generate(),showLabel:!0,light:!0,heatFlux:!1};e.push(o);const r={type:z.Human,name:Vt.Judd,cx:1,cy:-1,cz:0,lx:kp.fetchWidth(Vt.Jiya),lz:kp.fetchHeight(Vt.Jiya),normal:[1,0,0],rotation:[0,0,0],parentId:Zo,id:Gi.generate()};return e.push(r),e}}XSe=qm;class Dl{static clone(e,n,o,r,i,a,l,s){let c=null;switch(n.type){case z.Polygon:e&&(c=Dl.clonePolygon(e,n,o,r,i,a,l));break;case z.Sensor:e&&(c=Dl.cloneSensor(e,n,o,r,i));break;case z.Light:e&&(c=Dl.cloneLight(e,n,o,r,i));break;case z.SolarPanel:e&&(c=Dl.cloneSolarPanel(e,n,o,r,i));break;case z.SolarWaterHeater:e&&(c=Dl.cloneSolarWaterHeater(e,n,o,r,i));break;case z.ParabolicTrough:e&&(c=Dl.cloneParabolicTrough(e,n,o,r,i));break;case z.ParabolicDish:e&&(c=Dl.cloneParabolicDish(e,n,o,r,i));break;case z.FresnelReflector:e&&(c=Dl.cloneFresnelReflector(e,n,o,r,i));break;case z.Heliostat:e&&(c=Dl.cloneHeliostat(e,n,o,r,i));break;case z.WindTurbine:e&&(c=Dl.cloneWindTurbine(e,n,o,r,i));break;case z.Wall:e&&(c=Dl.cloneWall(e,n,o,r,i));break;case z.Window:e&&(c=Dl.cloneWindow(e,n,o,r,i,s));break;case z.Door:e&&(c=Dl.cloneDoor(e,n,o,r,i));break;case z.Roof:e&&(c=Dl.cloneRoof(e,n,o,r,i));break;case z.Human:c=Dl.cloneHuman(n,o,r,i,e);break;case z.Tree:c=Dl.cloneTree(n,o,r,i,e);break;case z.Flower:c=Dl.cloneFlower(n,o,r,i,e);break;case z.Foundation:c=Dl.cloneFoundation(n,o,r);break;case z.Cuboid:{const u=e?e.id:Zo;c=Dl.cloneCuboid(u,n,o,r);break}}return c}static cloneHuman(e,n,o,r,i){return{type:z.Human,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static cloneTree(e,n,o,r,i){return{type:z.Tree,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static cloneFlower(e,n,o,r,i){return{type:z.Flower,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static clonePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=n.vertices.map(d=>({...d})),u={type:z.Polygon,cx:o,cy:r,cz:i,lx:n.lx,ly:n.ly,lz:n.lz,filled:n.filled,noOutline:n.noOutline,color:n.color,lineColor:n.lineColor,lineWidth:n.lineWidth,opacity:n.opacity,textureType:n.textureType,text:n.text,fontSize:n.fontSize,fontColor:n.fontColor,normal:[...n.normal],rotation:n.parentId?[...e.rotation]:[0,0,0],vertices:c,parentId:e.id,parentType:e.type,foundationId:s,id:Gi.generate()};if(!a){let d=o,f=r;if(e.type===z.Cuboid&&l){ye.isSame(l,Vp)?d=i??0:ye.isSame(l,Op)?d=-(i??0):ye.isSame(l,_p)?f=i??0:ye.isSame(l,Yc)&&(f=-(i??0));const p=l.dot(new ae().fromArray(n.normal));if(Math.abs(p)0&&this.commands.length>this.limit&&this.commands.splice(0,this.commands.length-this.limit),this.index=this.commands.length-1)}undo(){const e=this.commands[this.index];if(e)return this.isExecuting=!0,e.undo(),this.isExecuting=!1,this.index--,e.name}redo(){const e=this.commands[this.index+1];if(e)return this.isExecuting=!0,e.redo(),this.isExecuting=!1,this.index++,e.name}clear(){this.commands=[],this.index=-1}hasUndo(){return this.index!==-1}hasRedo(){return this.index0||this.cuboidCount>0||this.wallCount>0||this.windowCount>0||this.doorCount>0||this.humanCount>0||this.treeCount>0||this.flowerCount>0||this.polygonCount>0||this.sensorCount>0||this.insideLightCount>0||this.outsideLightCount>0||this.solarPanelCount>0||this.parabolicTroughCount>0||this.parabolicDishCount>0||this.fresnelReflectorCount>0||this.heliostatCount>0||this.solarUpdraftTowerCount>0||this.windTurbineCount>0}}var eTe;class Xen{constructor(e){this[eTe]=!0,this.problem=e,this.objectiveFunctionType=Po.DAILY_TOTAL_OUTPUT,this.selectionMethod=Wm.ROULETTE_WHEEL,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.populationSize=20,this.maximumGenerations=5,this.selectionRate=.5,this.crossoverRate=.5,this.mutationRate=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}eTe=qm;var tTe;class Jen{constructor(e){this[tTe]=!0,this.problem=e,this.objectiveFunctionType=Po.DAILY_TOTAL_OUTPUT,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.swarmSize=20,this.maximumSteps=5,this.vmax=.01,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}tTe=qm;var nTe;class oTe{constructor(){this[nTe]=!0,this.geneticAlgorithmParams=new Xen(Ri.SOLAR_PANEL_TILT_ANGLE),this.particleSwarmOptimizationParams=new Jen(Ri.SOLAR_PANEL_TILT_ANGLE)}}nTe=qm;var rTe;class mX{constructor(){this[rTe]=!0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.poleHeight=1,this.poleSpacing=5,this.orientation=vr.landscape,this.pvModelName="CS6X-355P-FG",this.rowAxis=El.leftRight}}rTe=qm;var iTe;class aTe{constructor(){this[iTe]=!0,this.projectLifeSpan=25,this.electricitySellingPrice=.25,this.operationalCostPerUnit=.15}}iTe=qm;var lTe;class sTe{constructor(){this[lTe]=!0,this.humanName=Vt.Jack,this.flowerType=ro.YellowFlower,this.treeType=pr.Dogwood,this.treeSpread=3,this.treeHeight=4,this.foundationHeight=.1,this.foundationColor="#808080",this.foundationTexture=_i.NoTexture,this.groundFloorRValue=i8,this.cuboidHeight=4,this.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"],this.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],this.cuboidStackable=!1,this.cuboidTransparency=0,this.wallHeight=5,this.wallThickness=.3,this.wallColor="#ffffff",this.wallTexture=Bo.Default,this.wallStructure=gc.Default,this.wallStructureSpacing=2,this.wallStructureWidth=.1,this.wallStructureColor="#ffffff",this.wallOpacity=.5,this.wallRValue=p6,this.wallVolumetricHeatCapacity=.5,this.wallEavesLength=.3,this.wallParapet=Zye,this.roofColor="#454769",this.roofSideColor="#ffffff",this.roofTexture=Ur.Default,this.roofThickness=.2,this.roofStructure=Ac.Default,this.roofGlassOpacity=.5,this.roofGlassTint="#73D8FF",this.roofRafterWidth=.1,this.roofRafterSpacing=1,this.roofRafterColor="#ffffff",this.roofRValue=a8,this.roofVolumetricHeatCapacity=.5,this.roofRise=2,this.roofCeiling=!1,this.ceilingRValue=w6,this.doorColor="#ffffff",this.doorFrameColor="#ffffff",this.doorTexture=sr.Default,this.doorType=Rd.Default,this.doorArchHeight=1,this.doorFilled=!0,this.doorInterior=!1,this.doorUValue=J4,this.doorOpacity=1,this.doorVolumetricHeatCapacity=.5,this.windowWidth=1,this.windowHeight=1,this.windowColor="#ffffff",this.windowTint="#73D8FF",this.windowOpacity=.5,this.windowUValue=X4,this.windowHorizontalMullion=!0,this.windowVerticalMullion=!0,this.windowMullionWidth=.06,this.windowHorizontalMullionSpacing=.5,this.windowVerticalMullionSpacing=.5,this.windowMullionColor="#ffffff",this.windowFrame=!1,this.windowFrameWidth=.1,this.windowSillWidth=.1,this.windowType=Ci.Default,this.windowArchHeight=1,this.windowShutterLeft=!1,this.windowShutterRight=!1,this.windowShutterColor="gray",this.windowShutterWidth=.5,this.windowEmpty=!1,this.windowInterior=!1,this.windTurbineBirdSafeDesign=uc.None,this.windTurbineBladeColor=t9,this.windTurbineStripeColor=n9,this.windTurbineNumberOfBlades=3,this.windTurbinePitchAngle=Math.PI/18,this.windTurbineRelativeYawAngle=0,this.windTurbineInitialRotorAngle=0,this.windTurbineTowerHeight=20,this.windTurbineTowerRadius=.5,this.windTurbineBladeRadius=10,this.windTurbineBladeMaximumChordLength=1,this.windTurbineBladeMaximumChordRadius=3,this.windTurbineBladeRootRadius=.3,this.windTurbineHubRadius=.75,this.windTurbineHubLength=1.5,this.solarPanelModelName=R9,this.solarPanelOrientation=vr.landscape,this.solarPanelPoleHeight=1,this.solarPanelPoleSpacing=3,this.solarPanelTiltAngle=0,this.solarPanelRelativeAzimuth=0,this.solarPanelFrameColor="#ffffff",this.solarPanelCx=0,this.solarPanelCy=0,this.solarWaterHeaterColor="grey",this.solarWaterHeaterRelativeAzimuth=0,this.solarWaterHeaterTankRadius=W$e,this.solarWaterHeaterHeight=1,this.parabolicDishReflectance=.9,this.parabolicDishAbsorptance=.95,this.parabolicDishOpticalEfficiency=.7,this.parabolicDishThermalEfficiency=.3,this.parabolicDishRimDiameter=4,this.parabolicDishLatusRectum=8,this.parabolicDishPoleHeight=.2,this.parabolicDishPoleRadius=.1,this.parabolicDishReceiverStructure=sf.CentralPole,this.parabolicTroughReflectance=.9,this.parabolicTroughAbsorptance=.95,this.parabolicTroughOpticalEfficiency=.7,this.parabolicTroughThermalEfficiency=.3,this.parabolicTroughLatusRectum=2,this.parabolicTroughPoleHeight=.2,this.parabolicTroughWidth=2,this.parabolicTroughModuleLength=3,this.fresnelReflectorReceiver="None",this.fresnelReflectorReflectance=.9,this.fresnelReflectorPoleHeight=.2,this.fresnelReflectorWidth=2,this.fresnelReflectorModuleLength=3,this.heliostatTower="None",this.heliostatReflectance=.9,this.heliostatPoleHeight=.2,this.heliostatPoleRadius=.1,this.heliostatWidth=4,this.heliostatLength=2,this.lightColor="#ffff99",this.lightIntensity=3,this.lightDistance=5}}lTe=qm;var cTe;class uTe{constructor(){this[cTe]=!0,this.dailyPvIndividualOutputs=!1,this.yearlyPvIndividualOutputs=!1,this.dailyParabolicDishIndividualOutputs=!1,this.yearlyParabolicDishIndividualOutputs=!1,this.dailyParabolicTroughIndividualOutputs=!1,this.yearlyParabolicTroughIndividualOutputs=!1,this.dailyFresnelReflectorIndividualOutputs=!1,this.yearlyFresnelReflectorIndividualOutputs=!1,this.dailyHeliostatIndividualOutputs=!1,this.yearlyHeliostatIndividualOutputs=!1,this.dailyUpdraftTowerIndividualOutputs=!1,this.yearlyUpdraftTowerIndividualOutputs=!1}}cTe=qm;class gd{static getDefaultHiddenParameters(e){return e===Ri.SOLAR_PANEL_ARRAY?["latitude","orientation","poleHeight"]:[]}static getVariables(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("rowWidth"),n.includes("tiltAngle")||o.push("tiltAngle"),n.includes("interRowSpacing")||o.push("interRowSpacing"),n.includes("latitude")||o.push("latitude"),n.includes("orientation")||o.push("orientation"),n.includes("poleHeight")||o.push("poleHeight"),n.includes("unitCost")||o.push("unitCost"),n.includes("sellingPrice")||o.push("sellingPrice"),n.includes("totalYearlyCost")||o.push("totalYearlyCost"),n.includes("totalYearlyYield")||o.push("totalYearlyYield"),n.includes("meanYearlyYield")||o.push("meanYearlyYield"),n.includes("yearlyProfit")||o.push("yearlyProfit"),o}return[]}static getTitles(e,n,o){if(e===Ri.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(Y.t("polygonMenu.SolarPanelArrayRowWidth",n)),o.includes("tiltAngle")||r.push(Y.t("polygonMenu.SolarPanelArrayTiltAngle",n)),o.includes("interRowSpacing")||r.push(Y.t("polygonMenu.SolarPanelArrayRowSpacing",n)),o.includes("latitude")||r.push(Y.t("word.Latitude",n)),o.includes("orientation")||r.push(Y.t("polygonMenu.SolarPanelArrayOrientation",n)),o.includes("poleHeight")||r.push(Y.t("polygonMenu.SolarPanelArrayPoleHeight",n)),o.includes("unitCost")||r.push(Y.t("economicsPanel.UnitCost",n)),o.includes("sellingPrice")||r.push(Y.t("economicsPanel.SellingPrice",n)),o.includes("totalYearlyCost")||r.push(Y.t("polygonMenu.SolarPanelArrayTotalYearlyCost",n)),o.includes("totalYearlyYield")||r.push(Y.t("polygonMenu.SolarPanelArrayTotalYearlyYield",n)),o.includes("meanYearlyYield")||r.push(Y.t("polygonMenu.SolarPanelArrayMeanYearlyYield",n)),o.includes("yearlyProfit")||r.push(Y.t("polygonMenu.SolarPanelArrayYearlyProfit",n)),r}return[]}static getTypes(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("number"),n.includes("tiltAngle")||o.push("number"),n.includes("interRowSpacing")||o.push("number"),n.includes("latitude")||o.push("number"),n.includes("orientation")||o.push("boolean"),n.includes("poleHeight")||o.push("number"),n.includes("unitCost")||o.push("number"),n.includes("sellingPrice")||o.push("number"),n.includes("totalYearlyCost")||o.push("number"),n.includes("totalYearlyYield")||o.push("number"),n.includes("meanYearlyYield")||o.push("number"),n.includes("yearlyProfit")||o.push("number"),o}return[]}static getDigits(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(0),n.includes("tiltAngle")||o.push(1),n.includes("interRowSpacing")||o.push(1),n.includes("latitude")||o.push(1),n.includes("orientation")||o.push(0),n.includes("poleHeight")||o.push(1),n.includes("unitCost")||o.push(2),n.includes("sellingPrice")||o.push(2),n.includes("totalYearlyCost")||o.push(1),n.includes("totalYearlyYield")||o.push(1),n.includes("meanYearlyYield")||o.push(1),n.includes("yearlyProfit")||o.push(3),o}return[]}static getTickIntegers(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(!0),n.includes("tiltAngle")||o.push(!1),n.includes("interRowSpacing")||o.push(!1),n.includes("latitude")||o.push(!1),n.includes("orientation")||o.push(!0),n.includes("poleHeight")||o.push(!1),n.includes("unitCost")||o.push(!1),n.includes("sellingPrice")||o.push(!1),n.includes("totalYearlyCost")||o.push(!1),n.includes("totalYearlyYield")||o.push(!1),n.includes("meanYearlyYield")||o.push(!1),n.includes("yearlyProfit")||o.push(!1),o}return[]}static getUnits(e,n,o){if(e===Ri.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(" "+Y.t("solarPanelMenu.Panels",n)),o.includes("tiltAngle")||r.push("°"),o.includes("interRowSpacing")||r.push(" "+Y.t("word.MeterAbbreviation",n)),o.includes("latitude")||r.push("°"),o.includes("orientation")||r.push(""),o.includes("poleHeight")||r.push(" "+Y.t("word.MeterAbbreviation",n)),o.includes("unitCost")||r.push(""),o.includes("sellingPrice")||r.push(""),o.includes("totalYearlyCost")||r.push("K"),o.includes("totalYearlyYield")||r.push(" MWh"),o.includes("meanYearlyYield")||r.push(" kWh"),o.includes("yearlyProfit")||r.push("K"),r}return[]}static getUnit(e,n){return e==="tiltAngle"||e==="latitude"?"°":e==="interRowSpacing"||e==="poleHeight"?Y.t("word.MeterAbbreviation",n):e==="totalYearlyYield"?"MWh":e==="meanYearlyYield"?"kWh":e==="totalYearlyCost"||e==="yearlyProfit"?"K":""}static setScatterData(e,n,o,r){switch(e){case"rowWidth":o[n]=r.rowsPerRack;break;case"tiltAngle":o[n]=ye.toDegrees(r.tiltAngle);break;case"interRowSpacing":o[n]=r.interRowSpacing;break;case"latitude":o[n]=r.latitude;break;case"orientation":o[n]=r.orientation===vr.landscape?0:1;break;case"poleHeight":o[n]=r.poleHeight;break;case"unitCost":o[n]=r.unitCost;break;case"sellingPrice":o[n]=r.sellingPrice;break;case"totalYearlyCost":o[n]=ye.calculateCost(r);break;case"totalYearlyYield":o[n]=r.yearlyYield*.001;break;case"meanYearlyYield":o[n]=r.yearlyYield/r.panelCount;break;case"yearlyProfit":o[n]=ye.calculateProfit(r);break}}}class Ken{static updateOldFileData(){M.getState().set(e=>{ye.compareVersion(e.version,q6t)&&(e.viewState.ambientLightIntensity&&(e.viewState.ambientLightIntensity*=3),e.viewState.directLightIntensity&&(e.viewState.directLightIntensity*=3.5));const n=new Map;for(const o of e.elements)n.set(o.id,o);for(const o of e.elements)switch(o.type){case z.Foundation:{o.parentId!==Zo&&(console.error("Error: "+o.parentId+" is not ground!"),o.parentId=Zo);break}case z.Wall:{const r=o;if(r.wallStructure===void 0&&(r.wallStructure=gc.Default),r.structureSpacing===void 0&&(r.structureSpacing=2),r.structureWidth===void 0&&(r.structureWidth=.1),r.structureColor===void 0&&(r.structureColor="white"),r.opacity===void 0&&(r.opacity=.5),r.fill===void 0&&(r.fill=Fl.Full),r.unfilledHeight===void 0&&(r.unfilledHeight=.5),r.leftUnfilledHeight===void 0||r.rightUnfilledHeight===void 0){const i=r.unfilledHeight??.5;r.leftUnfilledHeight=i,r.rightUnfilledHeight=i}if((r.leftTopPartialHeight===void 0||r.rightTopPartialHeight===void 0)&&(r.leftTopPartialHeight=r.lz,r.rightTopPartialHeight=r.lz),r.eavesLength===void 0&&r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;r.eavesLength=a.overhang!==void 0?a.overhang:.3}else r.eavesLength=.3}if(r.parapet===void 0&&(r.parapet={...Zye}),r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;(a.roofType===Go.Pyramid||a.roofType===Go.Hip||a.roofType===Go.Mansard)&&(r.leftRoofHeight=void 0,r.rightRoofHeight=void 0)}}break}case z.Window:{const r=o;r.horizontalMullion===void 0&&(r.horizontalMullion=r.mullion),r.verticalMullion===void 0&&(r.verticalMullion=r.mullion),r.mullionWidth===void 0&&(r.mullionWidth=.06),r.horizontalMullionSpacing===void 0&&(r.horizontalMullionSpacing=r.mullionSpacing??.5),r.verticalMullionSpacing===void 0&&(r.verticalMullionSpacing=r.mullionSpacing??.5),r.tint===void 0&&(r.tint="#73D8FF"),r.opacity===void 0&&(r.opacity=.5),r.shutter&&(r.leftShutter=r.shutter.showLeft,r.rightShutter=r.shutter.showRight,r.shutterColor=r.shutter.color,r.shutterWidth=r.shutter.width,r.shutter=void 0),r.shutterColor===void 0&&(r.shutterColor="gray"),r.shutterWidth===void 0&&(r.shutterWidth=.5),r.mullionColor===void 0&&(r.mullionColor="white"),r.frame===void 0&&(r.frame=!1),r.color===void 0&&(r.color="white"),r.frameWidth===void 0&&(r.frameWidth=.1),r.windowType===void 0&&(r.windowType=Ci.Default),r.archHeight===void 0&&(r.archHeight=1);break}case z.Door:{const r=o;r.doorType===void 0&&(r.doorType=Rd.Default),r.archHeight===void 0&&(r.archHeight=1),r.filled===void 0&&(r.filled=!0);break}case z.Roof:{const r=o;if(r.ceiling===void 0&&(r.ceiling=!1),r.roofType===Go.Gambrel){const i=r;i.frontRidgePoint===void 0&&(i.frontRidgePoint=i.frontRidgeLeftPoint?[...i.frontRidgeLeftPoint]:[.35,.5],i.frontRidgeLeftPoint=void 0,i.frontRidgeRightPoint=void 0),i.backRidgePoint===void 0&&(i.backRidgePoint=i.backRidgeLeftPoint?[...i.backRidgeLeftPoint]:[-.35,.5],i.backRidgeLeftPoint=void 0,i.backRidgeRightPoint=void 0),i.topRidgePoint===void 0&&(i.topRidgePoint=i.topRidgeLeftPoint?[...i.topRidgeLeftPoint]:[0,1],i.topRidgeLeftPoint=void 0,i.topRidgeRightPoint=void 0)}break}case z.SolarPanel:{const r=o;if(r.version===void 0)switch(r.version=1,r.parentType){case void 0:case z.Foundation:{r.parentType=z.Foundation;const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz),r.rotation[2]!==0&&(r.rotation=[0,0,0]);break}case z.Cuboid:{const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz,r.rotation=Pi.getRotationOnCuboid(new ae().fromArray(r.normal)),ye.isEqual(0,r.rotation[0])&&r.rotation[2]!==0&&(r.rotation=[0,0,0]));break}case z.Wall:{r.normal=[0,-1,0],r.rotation=[Qt,0,0];break}case z.Roof:{if(r.foundationId){const i=n.get(r.foundationId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz+i.lz/2)}break}}}}})}}function Ad(t){return t.type===z.Foundation||t.type===z.Cuboid}Bpt();const M=$K()(V6t(J6t((t,e)=>{const n=ye.isOpenFromURL(),o=new JSe,r=n?[]:o.getElements(),i=a=>t(JP(a));return{set:a=>{try{i(a)}catch(l){console.log(l)}},version:CC,world:o,elements:r,user:{},viewState:new qSe,actionState:new sTe,graphState:new uTe,solarPanelArrayLayoutParams:new QSe,solarPanelArrayLayoutConstraints:new mX,evolutionaryAlgorithmState:new oTe,economicsParams:new aTe,geneticAlgorithmWizardSelectedTab:"1",particleSwarmOptimizationWizardSelectedTab:"1",modelType:fa.UNKNOWN,modelAuthor:null,modelLabel:null,modelDescription:null,projectView:!1,projectState:{owner:null,title:null,description:null,type:Ri.SOLAR_PANEL_ARRAY,designs:new Array,ranges:new Array,filters:new Array,hiddenParameters:gd.getDefaultHiddenParameters(Ri.SOLAR_PANEL_ARRAY),counter:0,dataColoring:d9.ALL,selectedProperty:null,sortDescending:!1,xAxisNameScatterPlot:null,yAxisNameScatterPlot:null,dotSizeScatterPlot:5,thumbnailWidth:200},projectImages:new Map,designProjectType:null,notes:[],language:"en",floatingWindowOpacity:g0,selectedFloatingWindow:null,cloudFile:void 0,latestModelSite:void 0,modelSites:new Map,allModelSites:new Map,peopleModels:new Map,allPeopleModels:new Map,modelsMapLatitude:42.2844063,modelsMapLongitude:-71.3488548,modelsMapAddress:pG,modelsMapZoom:aje,modelsMapType:"roadmap",modelsMapTilt:0,showModelsAllTime:!0,showModelsFromDate:"2021-01-01",showModelsToDate:"2025-12-31",minimumNavigationMoveSpeed:3,minimumNavigationTurnSpeed:3,tempHumanPlant:[],ray:new l0,mouse:new Kt,fileChanged:!1,setNavigationView(a){i(l=>{l.viewState.navigationView=a,l.viewState.enableRotate=!a,a&&(l.viewState.orthographic=!1)})},set2DView(a){i(l=>{l.viewState.orthographic=a,l.viewState.enableRotate=!a,a&&(l.viewState.navigationView=!1)})},applyCount:0,setApplyCount(a){i(l=>{l.applyCount=a})},revertApply(){if(e().applyCount){for(let a=0;a{s.version=a.version,s.world=a.world,s.viewState=a.view,s.graphState=a.graphState??new uTe,s.elements=a.elements,s.notes=a.notes??[],s.animate24Hours=!!a.animate24Hours,s.modelType=a.modelType??fa.UNKNOWN,s.modelAuthor=a.modelAuthor??null,s.modelLabel=a.modelLabel??null,s.modelDescription=a.modelDescription??null,s.designProjectType=a.designProjectType??null,s.cloudFile=l,s.currentUndoable=void 0,s.actionInfo=void 0,s.sceneRadius=a.sceneRadius??100,s.updateSceneRadiusFlag=!s.updateSceneRadiusFlag,s.localContentToImportAfterCloudFileUpdate=void 0,s.fileChanged=!s.fileChanged,s.evolutionMethod=a.evolutionMethod??_s.GENETIC_ALGORITHM,s.solarPanelArrayLayoutParams=a.solarPanelArrayLayoutParams??new QSe,s.solarPanelArrayLayoutConstraints=a.solarPanelArrayLayoutConstraints??new mX,s.evolutionaryAlgorithmState=a.evolutionaryAlgorithmState??new oTe,s.economicsParams=a.economicsParams??new aTe,s.minimumNavigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.minimumNavigationTurnSpeed=a.minimumNavigationTurnSpeed??3,s.fittestIndividualResults.length=0,s.undoManager.clear(),s.deletedRoofId=null,s.autoDeletedRoofs=null,s.autoDeletedRoofIdSet.clear(),s.autoDeletedChild=null,s.deletedRoofIdSet.clear(),s.addedRoofIdSet.clear(),s.actionState=new sTe,s.multiSelectionsMode=!1,s.selectedElementIdSet.clear(),s.groupActionMode=!1,s.selectedFloatingWindow=null,s.customPvModules=a.customPvModules??{}}),Ken.updateOldFileData(),dt.getState().set(s=>{s.changed=!1,s.skipChange=!0,s.animateSun=!1,s.showSolarRadiationHeatmap=!1,s.showHeatFluxes=!1,s.simulationInProgress=!1,s.simulationPaused=!1,s.clearDailySimulationResultsFlag=!s.clearDailySimulationResultsFlag,s.clearYearlySimulationResultsFlag=!s.clearYearlySimulationResultsFlag,s.navigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.navigationTurnSpeed=a.minimumNavigationTurnSpeed??3}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},exportContent(){const a=e(),l=new Date,s=JSON.parse(JSON.stringify(a.elements));return ye.fixElements(s),{docid:Gi.generate(),time:ul(l).format("MM/DD/YYYY hh:mm A"),timestamp:l.getTime(),userid:a.user.uid,owner:a.user.signFile?a.user.displayName:null,email:a.user.signFile?a.user.email:null,version:CC,world:JSON.parse(JSON.stringify(a.world)),elements:s,sceneRadius:a.sceneRadius,view:JSON.parse(JSON.stringify(a.viewState)),animate24Hours:a.animate24Hours,graphState:JSON.parse(JSON.stringify(a.graphState)),evolutionMethod:a.evolutionMethod,solarPanelArrayLayoutParams:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutParams)),solarPanelArrayLayoutConstraints:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutConstraints)),evolutionaryAlgorithmState:JSON.parse(JSON.stringify(a.evolutionaryAlgorithmState)),economicsParams:JSON.parse(JSON.stringify(a.economicsParams)),modelType:a.modelType,modelAuthor:a.modelAuthor,modelLabel:a.modelLabel,modelDescription:a.modelDescription,designProjectType:a.designProjectType,notes:a.notes,minimumNavigationMoveSpeed:a.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:a.minimumNavigationTurnSpeed,customPvModules:JSON.parse(JSON.stringify(a.customPvModules))}},clearContent(){i(a=>{a.elements=[],a.sceneRadius=100}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},createEmptyFile(){i(a=>{JSe.resetWorldModel(a.world),qSe.resetViewState(a.viewState),a.version=CC,a.elements=[],a.sceneRadius=100,a.cloudFile=void 0,a.localContentToImportAfterCloudFileUpdate=void 0,a.notes=[],a.fileChanged=!a.fileChanged,a.currentUndoable=void 0,a.actionInfo=void 0,a.undoManager.clear(),a.modelType=fa.UNKNOWN,a.modelLabel=null,a.modelDescription=null,a.designProjectType=null,a.minimumNavigationMoveSpeed=3,a.minimumNavigationTurnSpeed=3,a.multiSelectionsMode=!1,a.selectedElementIdSet.clear(),a.groupActionMode=!1,a.selectedFloatingWindow=null,a.deletedRoofId=null,a.autoDeletedRoofs=null,a.autoDeletedRoofIdSet.clear(),a.autoDeletedChild=null,a.deletedRoofIdSet.clear(),a.addedRoofIdSet.clear(),a.customPvModules={},a.actionState.solarPanelModelName=R9}),dt.getState().set(a=>{a.changed=!1,a.skipChange=!0,a.animateSun=!1,a.showSolarRadiationHeatmap=!1,a.showHeatFluxes=!1}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},undoManager:new Gen,addUndoable(a){i(l=>{l.loggable&&(l.currentUndoable=a),l.undoManager.add(a)})},fittestIndividualResults:[],setFittestIndividualResults(a){i(l=>{l.fittestIndividualResults=[...a]})},variableLabels:[],setVariableLabels(a){i(l=>{l.variableLabels=[...a]})},aabb:new vf(new ae(-10,-10,-10),new ae(10,10,10)),animate24Hours:!1,evolutionMethod:_s.GENETIC_ALGORITHM,clickObjectType:null,contextMenuObjectType:null,hoveredHandle:null,moveHandleType:null,resizeHandleType:null,rotateHandleType:null,resizeAnchor:new ae,selectedElement:null,getSelectedElement(){if(e().selectedElementIdSet.size===0)return null;const a=e().selectedElement;return a?e().elements.find(l=>l.id===a.id)??null:null},selectedElementIdSet:new Set,multiSelectionsMode:!1,findNearestSibling(a){let l=null;const s=e().getElementById(a);if(s){let c=Number.MAX_VALUE;for(const u of e().elements)if(u.type===s.type&&u.parentId===s.parentId&&u.id!==a){const d=s.cx-u.cx,f=s.cy-u.cy,p=s.cz-u.cz,g=d*d+f*f+p*p;c>g&&(c=g,l=u.id)}}return l},overlapWithSibling(a,l){let s=!1;if(l===void 0){const c=e().getParent(a);if(c){for(const u of e().elements)if(u.type===a.type&&u.parentId===a.parentId&&u.id!==a.id){if(a.type===z.SolarPanel){if(ye.doSolarPanelsOverlap(a,u,c)){s=!0;break}}else if(Math.abs(a.cx-u.cx)*c.lx<.5*(a.lx+u.lx)&&Math.abs(a.cy-u.cy)*c.ly<.5*(a.ly+u.ly)&&Math.abs(a.cz-u.cz)*c.lz<.5*(a.lz+u.lz)){s=!0;break}}}}else{const c=l*l,u=e().getParent(a);for(const d of e().elements)if(d.type===a.type&&d.parentId===a.parentId&&d.id!==a.id){const f=(a.cx-d.cx)*(u?u.lx:1),p=(a.cy-d.cy)*(u?u.ly:1),g=(a.cz-d.cz)*(u?u.lz:1);if(f*f+p*p+g*gC.id===g);if(S){const C=new ae(S.cx,S.cy,S.lz),P=new ln(0,0,S.rotation[2]),v=new ae;switch(l){case Mt.UpperLeft:{v.fromArray(y.leftPoint).setZ(0);break}case Mt.UpperRight:{v.fromArray(y.rightPoint).setZ(0);break}}A.copy(v.applyEuler(P).add(C))}break}case z.Roof:{const y=e().elements.find(S=>S.id===g);if(y){const S=new ae(y.cx,y.cy,y.lz),C=new ln(0,0,y.rotation[2]),P=new ae(e().selectedElementX,e().selectedElementY).applyEuler(C).add(S);A.set(P.x,P.y,y.lz)}break}case z.Tree:{const y=e().elements.find(S=>S.id===g);if(y){const S=new ae(y.cx,y.cy,y.cz+y.lz/2),C=new ln(0,0,y.rotation[2]);A.copy(new ae(a.cx,a.cy,y.lz).applyEuler(C).add(S))}break}}return A},getElementById(a){const l=e().elements;for(const s of l)if(s.id===a)return s;return null},getParent(a){const l=e().elements;for(const s of l)if(s.id===a.parentId)return s;return null},getFoundation(a){const l=e().elements;for(const s of l)if(s.id===a.foundationId&&s.type===z.Foundation)return s;return null},selectNone(){i(a=>{a.selectedElementIdSet.clear();for(const l of a.elements)l.selected=!1;a.selectedElement=null}),kn.getState().selectNone()},selectMe(a,l,s,c){const u=kn.getState().setEnableOrbitController;l.intersections.length>0&&(l.intersections.filter(f=>!f.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===l.eventObject||c)&&i(f=>{var p,g,A;for(const y of f.elements)if(y.id===a)if(y.selected=!0,f.selectedElement=y,f.selectedElementHeight=y.lz,f.groupActionMode){let S=y.foundationId??null;!S&&Ad(y)&&(S=ye.getBaseId(y.id)),S&&(f.multiSelectionsMode||f.selectedElementIdSet.clear(),f.selectedElementIdSet.has(S)?f.selectedElementIdSet.delete(S):f.selectedElementIdSet.add(S))}else if(s===Xo.ContextMenu)if(f.selectedElementIdSet.has(a))for(const S of f.elements)f.selectedElementIdSet.has(S.id)&&S.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(S.id);else if(f.multiSelectionsMode){f.selectedElementIdSet.add(a);for(const S of f.elements)f.selectedElementIdSet.has(S.id)&&S.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(S.id)}else f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a);else f.multiSelectionsMode?f.selectedElementIdSet.has(a)?f.selectedElementIdSet.delete(a):f.selectedElementIdSet.add(a):(f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a));else y.selected=!1;if(f.moveHandleType=null,f.resizeHandleType=null,f.rotateHandleType=null,f.contextMenuObjectType=null,s)switch(s){case Xo.Move:{((p=f.selectedElement)==null?void 0:p.type)===z.Tree||((g=f.selectedElement)==null?void 0:g.type)===z.Human?f.moveHandleType=zo.Default:f.moveHandleType=l.eventObject.name,u(!1);break}case Xo.Resize:{f.resizeHandleType=l.eventObject.name,u(!1);break}case Xo.Rotate:{f.rotateHandleType=l.eventObject.name,u(!1);break}case Xo.Select:{f.selectedElementAngle=((A=l.object.parent)==null?void 0:A.rotation.z)??0,u(!0);break}default:u(!0)}})},countHeatmapCells(){let a=0;return i(l=>{const s=l.world.solarRadiationHeatmapGridCellSize??.5,c=s*s;for(const u of l.elements)(u.type===z.Foundation||u.type===z.Cuboid)&&(a+=u.lx*u.ly/c)}),Math.round(a)},updateAllElementLocks(a){i(l=>{for(const s of l.elements)s.locked=a})},updateElementLockByFoundationId(a,l){i(s=>{for(const c of s.elements)(c.foundationId===a||c.parentId===a||c.id===a)&&(c.locked=l)})},updateElementLockByParentId(a,l,s){i(c=>{for(const u of c.elements)u.parentId===a&&l===u.type&&(u.locked=s)})},updateElementLockById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.locked=l;break}})},updateElementReferenceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.referenceId=l;break}})},updateElementLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.label=l;break}})},updateElementShowLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.showLabel=l;break}})},updateElementColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.color=l;break}})},updateElementColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.color=c)})},updateElementColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.color=s)})},updateElementColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.color=l)})},updateElementLineColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lineColor=l;break}})},updateElementLineColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineColor=c)})},updateElementLineColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineColor=s)})},updateElementLineColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineColor=l)})},updateElementLineWidthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.lineWidth=l;break}})},updateElementLineWidthOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&ye.isIdentical(d.normal,s)&&!d.locked&&(d.lineWidth=c)})},updateElementLineWidthAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineWidth=s)})},updateElementLineWidthForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineWidth=l)})},updateElementCxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cx=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cy=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cz=l;break}})},updateElementCzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cz=l)})},updateElementLxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lx=l;break}})},updateElementLxAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lx=s)})},updateElementLxOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lx=c)}})},updateElementLxForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lx=l)})},updateElementLyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.ly=l;break}})},updateElementLyAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.ly=s)})},updateElementLyOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.ly=c)}})},updateElementLyForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.ly=l)})},updateElementLzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lz=l;break}})},updateElementLzAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lz=s)})},updateElementLzOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lz=c)}})},updateElementLzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lz=l)})},updateElementRotationById(a,l,s,c){i(u=>{for(const d of u.elements)(d.id===a&&!d.locked||d.parentId===a&&!C$e(d)&&d.type!==z.SolarPanel)&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);u.selectedElementAngle=c})},updateElementRotationForAll(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a)d.locked||(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);else{const f=u.getParent(d);f&&!f.locked&&f.type===a&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c)}})},updateSolarCollectorDrawSunBeamById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.drawSunBeam=l;break}})},updateSolarCollectorDrawSunBeamAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.drawSunBeam=s)})},updateSolarCollectorDrawSunBeamForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.locked||c.type===a&&(c.drawSunBeam=l)})},updateSolarCollectorRelativeAzimuthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.relativeAzimuth=l,s.selectedElementAngle=l;break}})},updateSolarCollectorRelativeAzimuthAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&u.parentType!==z.Wall&&(u.relativeAzimuth=s)})},updateSolarCollectorRelativeAzimuthOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.relativeAzimuth=c)}})},updateSolarCollectorRelativeAzimuthForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&c.parentType!==z.Wall&&(c.relativeAzimuth=l)})},updateSolarCollectorXById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cx=l;break}})},updateSolarCollectorXAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cx=s)})},updateSolarCollectorXForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cx=l)})},updateSolarCollectorYById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.cy=l;break}})},updateSolarCollectorYAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cy=s)})},updateSolarCollectorYForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cy=l)})},updateSolarCollectorPoleHeightById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleHeight=l;break}})},updateSolarCollectorPoleHeightAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleHeight=s)})},updateSolarCollectorPoleHeightOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleHeight=c)}})},updateSolarCollectorPoleHeightForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleHeight=l)})},updateSolarCollectorPoleRadiusById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&ye.isSolarCollector(c)){c.poleRadius=l;break}})},updateSolarCollectorPoleRadiusAboveFoundation(a,l,s){ye.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleRadius=s)})},updateSolarCollectorPoleRadiusOnSurface(a,l,s,c){ye.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&ye.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleRadius=c)}})},updateSolarCollectorPoleRadiusForAll(a,l){ye.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleRadius=l)})},clearAllSolarCollectorYields(){i(a=>{for(const l of a.elements)if(ye.isSolarCollector(l)){const s=l;s.dailyYield=0,s.yearlyYield=0}})},updateSolarCollectorDailyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.dailyYield=l;break}})},updateSolarCollectorYearlyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isSolarCollector(c)){c.yearlyYield=l;break}})},updateCspReflectanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isCspCollector(c)){c.reflectance=l;break}})},updateCspReflectanceAboveFoundation(a,l,s){ye.isCspCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.reflectance=s)})},updateCspReflectanceForAll(a,l){ye.isCspCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.reflectance=l)})},updateParabolicCollectorAbsorptanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.absorptance=l;break}})},updateParabolicCollectorAbsorptanceAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.absorptance=s)})},updateParabolicCollectorAbsorptanceForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.absorptance=l)})},updateParabolicCollectorOpticalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.opticalEfficiency=l;break}})},updateParabolicCollectorOpticalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.opticalEfficiency=s)})},updateParabolicCollectorOpticalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.opticalEfficiency=l)})},updateParabolicCollectorThermalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&ye.isParabolicCollector(c)){c.thermalEfficiency=l;break}})},updateParabolicCollectorThermalEfficiencyAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.thermalEfficiency=s)})},updateParabolicCollectorThermalEfficiencyForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.thermalEfficiency=l)})},foundationActionScope:re.OnlyThisObject,setFoundationActionScope(a){i(l=>{l.foundationActionScope=a})},cuboidActionScope:re.OnlyThisObject,setCuboidActionScope(a){i(l=>{l.cuboidActionScope=a})},polygonActionScope:re.OnlyThisObject,setPolygonActionScope(a){i(l=>{l.polygonActionScope=a})},updatePolygonVertexPositionById(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===z.Polygon&&d.id===a){const f=d;l>=0&&l{for(const c of s.elements)if(c.type===z.Polygon&&c.id===a){const u=c;u.vertices=l;break}})},solarWaterHeaterActionScope:re.OnlyThisObject,setSolarWaterHeaterActionScope(a){i(l=>{l.solarWaterHeaterActionScope=a})},solarPanelActionScope:re.OnlyThisObject,setSolarPanelActionScope(a){i(l=>{l.solarPanelActionScope=a})},updateSolarPanelTiltAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.SolarPanel&&c.id===a&&!c.locked){const u=c;u.tiltAngle=l;break}})},setSolarPanelOrientation(a,l,s){if(a.orientation=s,a.orientation===vr.portrait){const c=Math.max(1,Math.round(a.lx/l.width)),u=Math.max(1,Math.round(a.ly/l.length));a.lx=c*l.width,a.ly=u*l.length}else{const c=Math.max(1,Math.round(a.lx/l.length)),u=Math.max(1,Math.round(a.ly/l.width));a.lx=c*l.length,a.ly=u*l.width}},parabolicTroughActionScope:re.OnlyThisObject,setParabolicTroughActionScope(a){i(l=>{l.parabolicTroughActionScope=a})},fresnelReflectorActionScope:re.OnlyThisObject,setFresnelReflectorActionScope(a){i(l=>{l.fresnelReflectorActionScope=a})},heliostatActionScope:re.OnlyThisObject,setHeliostatActionScope(a){i(l=>{l.heliostatActionScope=a})},updateSolarReceiverById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.Heliostat){c.towerId=l;break}else if(c.type===z.FresnelReflector){c.receiverId=l;break}}})},updateSolarReceiverAboveFoundation(a,l,s){ye.isHeliostatOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.Heliostat?u.towerId=s:u.type===z.FresnelReflector&&(u.receiverId=s))})},updateSolarReceiverForAll(a,l){ye.isHeliostatOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.Heliostat?c.towerId=l:c.type===z.FresnelReflector&&(c.receiverId=l))})},parabolicDishActionScope:re.OnlyThisObject,setParabolicDishActionScope(a){i(l=>{l.parabolicDishActionScope=a})},updateModuleLengthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.ParabolicTrough){c.moduleLength=l;break}else if(c.type===z.FresnelReflector){c.moduleLength=l;break}}})},updateModuleLengthAboveFoundation(a,l,s){ye.isParabolicTroughOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.FresnelReflector)&&(u.moduleLength=s)})},updateModuleLengthForAll(a,l){ye.isParabolicTroughOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.FresnelReflector)&&(c.moduleLength=l)})},updateParabolaLatusRectumById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l);break}})},updateParabolaLatusRectumAboveFoundation(a,l,s){ye.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.ParabolicDish)&&(u.latusRectum=s)})},updateParabolaLatusRectumForAll(a,l){ye.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l)})},windTurbineActionScope:re.OnlyThisObject,setWindTurbineActionScope(a){i(l=>{l.windTurbineActionScope=a})},wallActionScope:re.OnlyThisObject,setWallActionScope(a){i(l=>{l.wallActionScope=a})},roofActionScope:re.OnlyThisObject,setRoofActionScope(a){i(l=>{l.roofActionScope=a})},windowActionScope:re.OnlyThisObject,setWindowActionScope(a){i(l=>{l.windowActionScope=a})},doorActionScope:re.OnlyThisObject,setDoorActionScope(a){i(l=>{l.doorActionScope=a})},updateWallRelativeAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.relativeAngle=l;break}})},updateWallLeftJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.leftJoints=l;break}})},updateWallRightJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.rightJoints=l;break}})},updateWallLeftPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.leftPoint=[...l];break}})},updateWallRightPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.rightPoint=[...l];break}})},updateRoofRiseById(a,l,s){i(c=>{for(const u of c.elements)if(u.id===a&&u.type===z.Roof){u.rise=l,c.actionState.roofRise=l,s!==void 0&&(c.selectedElementHeight=s);break}})},updateRoofStructureById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&c.type===z.Roof){const u=c;u.roofStructure=l;break}})},updateInsideLightById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Light&&c.id===a){c.inside=l;break}})},updateInsideLightsByParentId(a,l){i(s=>{for(const c of s.elements)c.parentId===a&&c.type===z.Light&&(c.inside=l)})},setElementPosition(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].cx=l,u.elements[d].cy=s,c!==void 0&&(u.elements[d].cz=c);break}})},setElementNormal(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a||f.parentId===a){const p=u.elements[d];p.normal[0]=l,p.normal[1]=s,p.normal[2]=c}})},setElementSize(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].lx=l,u.elements[d].ly=s,c&&(u.elements[d].lz=c,u.selectedElementHeight=c);break}})},actionModeLock:!1,objectTypeToAdd:z.None,addElement(a,l,s){let c=null;const u="id"in a?a.id:Zo;return i(d=>{switch(d.objectTypeToAdd){case z.Human:{const f=new ae().copy(l);if(u!==Zo){const{rot:g,pos:A}=ye.getWorldDataById(u);f.sub(new ae(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeHuman(d.actionState.humanName,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Tree:{const f=new ae().copy(l);if(u!==Zo){const{rot:g,pos:A}=ye.getWorldDataById(u);f.sub(new ae(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeTree(d.actionState.treeType,d.actionState.treeSpread,d.actionState.treeHeight,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Flower:{const f=new ae().copy(l);if(u!==Zo){const{rot:g,pos:A}=ye.getWorldDataById(u);f.sub(new ae(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeFlower(d.actionState.flowerType,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Polygon:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makePolygon(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,f.type);c=g,d.elements.push(g);break}case z.Sensor:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeSensor(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=g,d.elements.push(g);break}case z.Light:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeLight(f,2,d.actionState.lightDistance,d.actionState.lightIntensity,d.actionState.lightColor,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=g,d.elements.push(g);break}case z.SolarPanel:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f,!0);let g=d.getPvModule(d.actionState.solarPanelModelName??R9);g||(g=d.getPvModule(R9));const A=Va.makeSolarPanel(f,g,p.x,p.y,p.z,d.actionState.solarPanelOrientation??vr.landscape,d.actionState.solarPanelPoleHeight??1,d.actionState.solarPanelPoleSpacing??3,d.actionState.solarPanelTiltAngle??0,d.actionState.solarPanelRelativeAzimuth??0,s,[0,0,0],d.actionState.solarPanelFrameColor??"white");c=A,d.elements.push(A);break}case z.ParabolicTrough:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeParabolicTrough(f,d.actionState.parabolicTroughReflectance,d.actionState.parabolicTroughAbsorptance,d.actionState.parabolicTroughOpticalEfficiency,d.actionState.parabolicTroughThermalEfficiency,d.actionState.parabolicTroughLatusRectum,d.actionState.parabolicTroughPoleHeight,d.actionState.parabolicTroughModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicTroughWidth);c=g,d.elements.push(g);break}case z.ParabolicDish:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeParabolicDish(f,d.actionState.parabolicDishReflectance,d.actionState.parabolicDishAbsorptance,d.actionState.parabolicDishOpticalEfficiency,d.actionState.parabolicDishThermalEfficiency,d.actionState.parabolicDishLatusRectum,d.actionState.parabolicDishPoleHeight,d.actionState.parabolicDishReceiverStructure,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicDishRimDiameter,d.actionState.parabolicDishRimDiameter);c=g,d.elements.push(g);break}case z.FresnelReflector:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeFresnelReflector(f,d.actionState.fresnelReflectorReceiver,d.actionState.fresnelReflectorReflectance,d.actionState.fresnelReflectorPoleHeight,d.actionState.fresnelReflectorModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.fresnelReflectorWidth);c=g,d.elements.push(g);break}case z.Heliostat:{const f=a,p=ye.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeHeliostat(f,d.actionState.heliostatTower,d.actionState.heliostatReflectance,d.actionState.heliostatPoleHeight,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.heliostatLength,d.actionState.heliostatWidth);c=g,d.elements.push(g);break}case z.WindTurbine:{const f=a,p=ye.relativeCoordinates(l.x,l.y,0,f),g=Va.makeWindTurbine(f,d.actionState.windTurbineBirdSafeDesign??uc.None,d.actionState.windTurbineBladeColor??t9,d.actionState.windTurbineStripeColor??n9,d.actionState.windTurbineNumberOfBlades??3,d.actionState.windTurbineInitialRotorAngle??0,d.actionState.windTurbineRelativeYawAngle??0,d.actionState.windTurbinePitchAngle??Math.PI/18,d.actionState.windTurbineBladeRadius??10,d.actionState.windTurbineBladeRootRadius??.3,d.actionState.windTurbineBladeMaximumChordLength??1,d.actionState.windTurbineBladeMaximumChordRadius??3,d.actionState.windTurbineTowerRadius??.5,d.actionState.windTurbineTowerHeight??20,d.actionState.windTurbineHubRadius??.75,d.actionState.windTurbineHubLength??1.5,p.x,p.y,0);c=g,d.elements.push(g);break}case z.Foundation:{const f=Va.makeFoundation(l.x,l.y,d.actionState.foundationHeight,d.actionState.foundationColor,d.actionState.foundationTexture);c=f,d.elements.push(f);break}case z.Cuboid:{const f=Va.makeCuboid(l.x,l.y,d.actionState.cuboidHeight,d.actionState.cuboidFaceColors,d.actionState.cuboidFaceTextures);c=f,d.elements.push(f);break}case z.Wall:{const f=a,p=ye.wallRelativePosition(new ae(l.x,l.y),f),g=Va.makeWall(f,p.x,p.y,p.z,s);d.elements.push(g),d.selectedElement=g,c=g;break}}c&&(d.selectedElementIdSet.clear(),d.selectedElementIdSet.add(c.id),d.selectedElement=c)}),c},elementsToPaste:[],deletedElements:[],clearDeletedElements(){i(a=>{a.deletedElements=[]})},pastePoint:new ae,pasteNormal:void 0,copyElementById(a){i(l=>{l.elementsToPaste=[];for(const s of l.elements)if(s.id===a){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y,l.elementsToPaste.push(s)}else l.elementsToPaste.push(s);break}for(const s of l.elements)if(ye.isChild(a,s.id)){if(s.type===z.Polygon){const c=ye.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y}l.elementsToPaste.push(s)}})},removeSelectedElements(){const a=e().selectedElementIdSet;if(a.size===0)return[];const l=Array.from(a),s=new Set,c=new Set;for(const u of e().elements)if(a.has(u.id))s.add(u),c.add(u.id);else for(const d of l)ye.isChild(d,u.id)&&(s.add(u),c.add(u.id));return i(u=>{u.autoDeletedRoofs=[],u.deletedElements=Array.from(s),u.elements=u.elements.filter(d=>{var f,p;if(c.has(d.id)){switch(d.type){case z.Wall:{const g=d;let A="",y="";g.leftJoints.length>0&&(A=((f=u.getElementById(g.leftJoints[0]))==null?void 0:f.id)??""),g.rightJoints.length>0&&(y=((p=u.getElementById(g.rightJoints[0]))==null?void 0:p.id)??"");for(const S of u.elements)S.id===A?S.rightJoints=[]:S.id===y&&(S.leftJoints=[]);u.updateWallMapOnFoundationFlag=!u.updateWallMapOnFoundationFlag;break}case z.Roof:{u.deletedRoofIdSet.add(d.id),Cn.getState().deleteRoofSegmentVertices(d.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(d.id);break}}return!1}else return!0})}),Array.from(s)},removeElementById(a,l,s=!0,c){const u=e().elements.filter(d=>d.id===a||ye.isChild(a,d.id));return i(d=>{var f,p;for(const g of d.elements)if(g.id===a){if(l)if(g.type===z.Polygon){const A=ye.calculatePolygonCentroid(g.vertices);g.cx=A.x,g.cy=A.y,d.elementsToPaste=[g]}else d.elementsToPaste=[g];else c||(d.deletedElements=[g]);switch(g.selected=!1,g.type){case z.Roof:{const A=g;d.deletedRoofId=g.id,d.deletedRoofIdSet.add(g.id),Cn.getState().deleteRoofSegmentVertices(a),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(a),c&&(d.autoDeletedRoofs?d.autoDeletedRoofs.push(A):d.autoDeletedRoofs=[A],d.autoDeletedRoofIdSet.add(A.id));break}case z.Wall:{const A=g;let y="",S="";A.leftJoints.length>0&&(y=((f=d.getElementById(A.leftJoints[0]))==null?void 0:f.id)??""),A.rightJoints.length>0&&(S=((p=d.getElementById(A.rightJoints[0]))==null?void 0:p.id)??"");for(const C of d.elements)C.id===y?C.rightJoints=[]:C.id===S&&(C.leftJoints=[]);d.elements=d.elements.filter(C=>!(C.type===z.Roof&&C.wallsId.length===0)),d.updateWallMapOnFoundationFlag=!d.updateWallMapOnFoundationFlag,d.deletedWallId=g.id;break}case z.Foundation:{d.deletedFoundationId=g.id;break}case z.Cuboid:{d.deletedCuboidId=g.id;break}}break}if(c)for(const g of d.elements)ye.isChild(a,g.id)&&(d.autoDeletedChild?d.autoDeletedChild.push(g):d.autoDeletedChild=[g]);else if(l)for(const g of d.elements)ye.isChild(a,g.id)&&d.elementsToPaste.push(g);else for(const g of d.elements)ye.isChild(a,g.id)&&d.deletedElements.push(g);d.elements=d.elements.filter(g=>g.id===a||g.parentId===a||g.foundationId===a||ye.isChild(a,g.id)?(g.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(a),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(a)),!1):!0),d.selectedElementIdSet.delete(a),s&&(d.selectedElement=null,d.selectedElementIdSet.clear())}),u},removeElementsByType(a){i(l=>{a===z.Foundation?l.elements=l.elements.filter(s=>s.locked||s.type!==z.Foundation&&!s.foundationId?!0:(s.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(s.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1)):l.elements=l.elements.filter(s=>s.locked||s.type!==a?!0:(s.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(s.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1))})},countElementsByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===a&&!c.locked&&s++;else for(const c of e().elements)c.type===a&&s++;return s},countSolarStructuresByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===z.Foundation&&!c.locked&&c.solarStructure===a&&s++;else for(const c of e().elements)c.type===z.Foundation&&c.solarStructure===a&&s++;return s},countObservers(){let a=0;for(const l of e().elements)l.type===z.Human&&l.observer&&a++;return a},removeElementsByReferenceId(a,l){i(s=>{if(l){s.deletedElements=[];for(const c of s.elements)c.referenceId===a&&s.deletedElements.push(c)}s.elements=s.elements.filter(c=>c.referenceId!==a)})},countElementsByReferenceId(a){let l=0;for(const s of e().elements)s.referenceId===a&&l++;return l},getChildren(a){const l=[];for(const s of e().elements)s.parentId===a&&l.push(s);return l},getChildrenOfType(a,l){const s=[];for(const c of e().elements)c.type===a&&c.parentId===l&&s.push(c);return s},removeAllChildElementsByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.parentId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},removeAllElementsOnFoundationByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.foundationId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},countAllElements(a){let l=0;if(a)for(const s of e().elements)s.locked||l++;else l=e().elements.length;return l},countAllElementsByType(a){const l=new ZSe;for(const s of e().elements)if(s.locked?l.lockedCount++:l.unlockedCount++,!(a&&s.locked))switch(s.type){case z.Foundation:{s.solarStructure===Dn.UpdraftTower&&l.solarUpdraftTowerCount++,l.foundationCount++;break}case z.Cuboid:{l.cuboidCount++;break}case z.Wall:{l.wallCount++;break}case z.Window:{l.windowCount++;break}case z.Door:{l.doorCount++;break}case z.Human:{l.humanCount++;break}case z.Tree:{l.treeCount++;break}case z.Flower:{l.flowerCount++;break}case z.Polygon:{l.polygonCount++;break}case z.Sensor:{l.sensorCount++;break}case z.Light:{s.inside?l.insideLightCount++:l.outsideLightCount++;break}case z.SolarPanel:{l.solarPanelCount++;const c=s,u=e().getPvModule(c.pvModelName);u&&(l.solarPanelModuleCount+=ye.countSolarPanelsOnRack(c,u));break}case z.ParabolicDish:{l.parabolicDishCount++;break}case z.ParabolicTrough:{l.parabolicTroughCount++;break}case z.FresnelReflector:{l.fresnelReflectorCount++;break}case z.Heliostat:{l.heliostatCount++;break}case z.WindTurbine:{l.windTurbineCount++;break}}return l},countAllOffspringsByTypeAtOnce(a,l){const s=new ZSe;for(const c of e().elements){const u=c.parentId===a||c.foundationId===a;if(u&&(c.locked?s.lockedCount++:s.unlockedCount++),(l||!c.locked)&&u)switch(c.type){case z.Foundation:{c.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTowerCount++,s.foundationCount++;break}case z.Cuboid:{s.cuboidCount++;break}case z.Wall:{s.wallCount++;break}case z.Window:{s.windowCount++,c.locked&&s.lockedWindowCount++;break}case z.Door:{s.doorCount++,c.locked&&s.lockedDoorCount++;break}case z.Human:{s.humanCount++;break}case z.Tree:{s.treeCount++;break}case z.Flower:{s.flowerCount++;break}case z.Polygon:{s.polygonCount++,c.locked&&s.lockedPolygonCount++;break}case z.Sensor:{s.sensorCount++,c.locked&&s.lockedSensorCount++;break}case z.Light:{c.inside?s.insideLightCount++:s.outsideLightCount++,c.locked&&s.lockedLightCount++;break}case z.SolarPanel:{s.solarPanelCount++,c.locked&&s.lockedSolarPanelCount++;const d=c,f=e().getPvModule(d.pvModelName);f&&(s.solarPanelModuleCount+=ye.countSolarPanelsOnRack(d,f));break}case z.ParabolicDish:{s.parabolicDishCount++;break}case z.ParabolicTrough:{s.parabolicTroughCount++;break}case z.FresnelReflector:{s.fresnelReflectorCount++;break}case z.Heliostat:{s.heliostatCount++;break}case z.WindTurbine:{s.windTurbineCount++,c.locked&&s.lockedWindTurbineCount++;break}}}return s},countSolarPanelsOnRack(a){let l=0;for(const s of e().elements)if(s.id===a&&s.type===z.SolarPanel){const c=s,u=e().getPvModule(c.pvModelName);if(u){l=ye.countSolarPanelsOnRack(c,u);break}}return l},copyCutElements(){const a=[],l=new Map,s=new Map,c=new Map;for(let u=0;ug.id===d.parentId);if(p){const g=l.get(p.id);g&&(e().getElementById(d.id)?(f=Dl.clone(g,d,d.cx,d.cy,d.cz,d.type===z.Polygon),((f==null?void 0:f.type)===z.SolarPanel||(f==null?void 0:f.type)===z.SolarWaterHeater)&&(f.rotation=[...d.rotation],f.normal=[...d.normal])):f=JSON.parse(JSON.stringify(d)))}}f&&(l.set(d.id,f),s.set(d.id,f.id),c.set(f.id,d.id),a.push(f))}for(const u of a){if(u.type===z.Roof){const d=c.get(u.id);if(d)for(const f of e().elementsToPaste)f.id===d&&(u.wallsId=f.wallsId.map(p=>s.get(p)))}if(u.type===z.Wall){const d=c.get(u.id);if(d){for(const f of e().elementsToPaste)if(f.id===d&&f.type===z.Wall){const p=f,g=s.get(p.leftJoints[0]);g&&(u.leftJoints=[g]);const A=s.get(p.rightJoints[0]);if(A&&(u.rightJoints=[A]),p.roofId){const y=s.get(p.roofId);y&&(u.roofId=y)}break}}}}return a},pasteElementsToPoint(){const a=[];return i(l=>{if(l.elementsToPaste.length===1){let s=l.pastePoint;const c=l.elementsToPaste[0];let u=l.selectedElement;const d=l.getParent(c);if(u){if(u.type===z.Polygon){const p=l.getParent(u);p&&(u=p,c.parentId=u.id,ye.isPositionRelative(c.type)&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u)))}else if(u.type===z.Roof){if(u.parentId){const p=l.getElementById(u.parentId);p&&(c.type===z.SolarPanel||c.type===z.SolarWaterHeater?s.sub(new ae(p.cx,p.cy,p.cz)).applyEuler(new ln(0,0,-p.rotation[2])):(s.sub(new ae(p.cx,p.cy,p.lz)).applyEuler(new ln(0,0,-p.rotation[2])),c.type!==z.Window&&(s.setX(s.x/p.lx),s.setY(s.y/p.ly))))}}else if(u.type===z.Cuboid){if(c.type===z.Cuboid){const{pos:p}=ye.getWorldDataById(u.id);s.sub(p)}else ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u));c.parentId=u.id}else u.type===z.Wall?s=ye.relativeCoordinates(s.x,s.y,s.z,u):d&&d.type&&c.type!==z.Foundation&&(c.parentId=u.id,ye.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=ye.relativeCoordinates(s.x,s.y,s.z,u,!0):s=ye.relativeCoordinates(s.x,s.y,s.z,u)));c.type===z.Wall&&s.set(s.x*u.lx,s.y*u.ly,0)}const f=Dl.clone(u,c,s.x,s.y,s.z,!1,l.pasteNormal,d);if(f){l.pasteNormal&&(u==null?void 0:u.type)===z.Cuboid&&(f.normal=l.pasteNormal.toArray(),f.rotation=bn.getRotationFromNormal(l.pasteNormal));const p={lng:l.language};let g=!1;switch(f.type){case z.Cuboid:{const A=C=>{const P=[];for(const v of e().elements)if(v.parentId===C.id)switch(P.push(v),v.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:P.push(...A(v))}return P},y=A(c),S=new Map;a.push(f),S.set(c.id,f);for(const C of y){const P=S.get(C.parentId);if(P){const v=Dl.clone(P,C,C.cx,C.cy,C.cz,C.type===z.Polygon);v&&(f.normal&&(v.normal=[...C.normal]),a.push(v),S.set(C.id,v))}}l.elements.push(...a),l.elementsToPaste=[f],g=!1;break}case z.Foundation:{const A=new Map,y=new Map;for(const S of l.elements)if(S.parentId===c.id){const C=Dl.clone(f,S,S.cx,S.cy,S.cz,S.type===z.Polygon);if(C&&(f.normal&&(C.normal=[...S.normal]),a.push(C),(C==null?void 0:C.type)===z.Wall||(C==null?void 0:C.type)===z.Roof)){A.set(C.id,S.id),y.set(S.id,C.id);for(const P of l.elements)if(P.parentId===S.id){const v=Dl.clone(C,P,P.cx,P.cy,P.cz);v&&(S.normal&&(v.normal=[...P.normal]),a.push(v))}}}l.elements.push(...a),g=!0;for(const S of l.elements){if(S.type===z.Roof){const C=A.get(S.id);if(C){const P=e().getElementById(C);P&&(S.wallsId=P.wallsId.map(v=>y.get(v)))}}if(S.type===z.Wall){const C=A.get(S.id);if(C){for(const P of l.elements)if(P.id===C&&P.type===z.Wall){const v=P,T=y.get(v.leftJoints[0]);T&&(S.leftJoints=[T]);const w=y.get(v.rightJoints[0]);if(w&&(S.rightJoints=[w]),v.roofId){const x=y.get(v.roofId);x&&(S.roofId=x)}break}}}}break}case z.SolarPanel:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case pa.Valid:{const A=u.relativeAngle-Qt;f.normal=[Math.cos(A),Math.sin(A),0],g=!0;break}case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarPanelVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(Y.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,as))&&ye.isSolarCollector(f)?(g=ye.isSolarCollectorWithinHorizontalSurface(f,u),g||co(Y.t("message.CannotPasteOutsideBoundary",p))):g=!0;break}case z.SolarWaterHeater:{if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarWaterHeaterVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}break}case z.Sensor:case z.Light:case z.WindTurbine:case z.ParabolicDish:case z.Heliostat:case z.FresnelReflector:case z.ParabolicTrough:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(ye.checkElementOnWallState(f,u)){case pa.Valid:{const A=u.relativeAngle-Qt;f.normal=[Math.cos(A),Math.sin(A),0],g=!0;break}case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarPanelVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(Y.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&ye.isIdentical(f.normal,as))&&ye.isSolarCollector(f)?(g=ye.isSolarCollectorWithinHorizontalSurface(f,u),g||co(Y.t("message.CannotPasteOutsideBoundary",p))):g=!0;break}case z.Wall:{const A=new ae(f.cx,f.cy,0),y=new ae(f.lx/2,0,0),S=new ae(-f.lx/2,0,0),C=f,P=new ln(0,0,C.relativeAngle);C.leftPoint=A.clone().add(S.applyEuler(P)).toArray(),C.rightPoint=A.clone().add(y.applyEuler(P)).toArray(),C.roofId=void 0,C.leftRoofHeight=void 0,C.rightRoofHeight=void 0,C.centerLeftRoofHeight=void 0,C.centerRightRoofHeight=void 0,C.centerRoofHeight=void 0;for(const v of l.elements)if(v.parentId===c.id){const T=Dl.clone(f,v,v.cx,v.cy,v.cz,v.type===z.Polygon);T&&(f.normal&&(T.normal=[...v.normal]),a.push(T))}l.elements.push(...a),l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,g=!0;break}case z.Door:case z.Window:{if((u==null?void 0:u.type)===z.Wall)switch(ye.checkElementOnWallState(f,u)){case pa.Valid:g=!0;break;case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}else if((u==null?void 0:u.type)===z.Roof){const A=bn.getRotationOnRoof(u.id,s);A&&(f.rotation=[...A]);const y=bn.getWindowVerticesOnRoof(f),S=bn.getRoofSegmentBoundary(u.id,s);if(!S)break;if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopWindowCollisionCheck(f.id,y,u.id)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0}break}default:if(g=!0,ye.isPlantOrHuman(f))if(u){const A=l.getParent(f);if(A){const y=ye.relativePoint(l.pastePoint,A);f.cx=y.x,f.cy=y.y,f.cz=y.z}}else f.parentId=Zo}g&&(l.elements.push(f),a.push(f))}}else if(l.elementsToPaste.length>1){let s=l.pastePoint;const c=l.copyCutElements();if(c.length>0){if(c[0].type===z.Cuboid){const u=l.selectedElement;if(u&&u.type===z.Cuboid){const{pos:d}=ye.getWorldDataById(u.id);s.sub(d),c[0].parentId=u.id}}else if(c[0].type===z.Wall){const u=l.selectedElement;u&&u.type===z.Foundation&&(s=ye.relativeCoordinates(s.x,s.y,s.z,u),s.set(s.x*u.lx,s.y*u.ly,0),c[0].parentId=u.id,c[0].foundationId=u.id)}c[0].cx=s.x,c[0].cy=s.y,c[0].cz=s.z,c[0].type===z.Foundation?c[0].cz+=c[0].lz/2:c[0].type===z.Cuboid&&(c[0].cz=c[0].lz/2),l.elements.push(...c),a.push(...c)}}a.length>0&&(l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(a[0].id),l.selectedElement=a[0])}),a},pasteElementsByKey(){const a=[];return i(l=>{if(l.elementsToPaste.length>0){const s=l.elementsToPaste[0],c=l.getParent(s),u=Dl.clone(c,s,s.cx,s.cy,s.cz);if(u){let d=!1;switch(u.type){case z.Door:case z.Window:{if(c){const f=u.lx/2;if(u.cx+=f*3,c.type===z.Wall)for(;u.cx+f<.5;)if(ye.checkElementOnWallState(u,c)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=f;else if(c.type===z.Roof){const p=bn.getRotationOnRoof(c.id,new ae(u.cx,u.cy));p&&(u.rotation=[...p]);let g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new ae(u.cx,u.cy));const y=bn.getRoofBoundaryVertices(c);for(;bn.rooftopElementBoundaryCheck(g,y);)if(A&&bn.rooftopElementBoundaryCheck(g,A)&&bn.rooftopWindowCollisionCheck(u.id,g,c.id)){l.elements.push(u),d=!0;break}else{u.cx+=f/2;const S=bn.getRotationOnRoof(c.id,new ae(u.cx,u.cy));S&&(u.rotation=[...S]),g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new ae(u.cx,u.cy))}}if(!d){u.cx=s.cx-f*3;const p=bn.getRotationOnRoof(c.id,new ae(u.cx,u.cy));if(p&&(u.rotation=[...p]),c.type===z.Wall){for(;u.cx-f>-.5;)if(c.type===z.Wall)if(ye.checkElementOnWallState(u,c)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx-=f}else if(c.type===z.Roof){let g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new ae(u.cx,u.cy));const y=bn.getRoofBoundaryVertices(c);for(;bn.rooftopElementBoundaryCheck(g,y);)if(A&&bn.rooftopElementBoundaryCheck(g,A)&&bn.rooftopWindowCollisionCheck(u.id,g,c.id)){l.elements.push(u),d=!0;break}else{u.cx-=f;const S=bn.getRotationOnRoof(c.id,new ae(u.cx,u.cy));S&&(u.rotation=[...S]),g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new ae(u.cx,u.cy))}}}if(!d){const p={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",p))}c.type===z.Roof&&d&&(l.updateElementOnRoofFlag=!0)}break}case z.Human:{u.cx+=1,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.Tree:case z.Flower:{u.cx+=u.lx,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.SolarPanel:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const A=u.lx/f.lx/2;for(u.cx+=A*3;u.cx+A<.5;)if(ye.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=A;if(!d)for(u.cx=s.cx-A*3;u.cx-A>-.5;)if(ye.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=A;if(!d){const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}break}else if(f.type===z.Roof){if(s.foundationId){const A=l.getElementById(s.foundationId);if(A){const y=bn.getRoofBoundaryVertices(f),S=u.lx*1.25;for(u.cx+=S;u.cx+u.lx/2-A.lx/2;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx-=S}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",C))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation]);const p=l.findNearestSibling(s.id);if(p){const A=l.getElementById(p);if(A){const y=u.cx,S=u.cy,C=u.cz,P=A.cx-s.cx,v=A.cy-s.cy,T=A.cz-s.cz;u.cx=A.cx+P,u.cy=A.cy+v,u.cz=A.cz+T,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-v,u.cz=s.cz-T,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*v,u.cz=s.cz-2*T,l.overlapWithSibling(u)&&(u.cx=y-P,u.cy=S-v,u.cz=C-T)))}else u.cx+=1.25*u.lx}else u.cx+=1.25*u.lx;const g={lng:l.language};l.overlapWithSibling(u)?co(Y.t("message.CannotPasteBecauseOfOverlap",g)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,as)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(Y.t("message.CannotPasteOutsideBoundary",g)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.SolarWaterHeater:{if(u.parentId){const f=l.getParent(u);if(f)if(f.type===z.Roof){if(s.foundationId){const p=l.getElementById(s.foundationId);if(p){const g=bn.getRoofBoundaryVertices(f),A=u.lx*1.25;for(u.cx+=A;u.cx+u.lx/2-p.lx/2;){const y=bn.getSolarWaterHeaterVerticesOnRoof(u,p);if(bn.rooftopElementBoundaryCheck(y,g)&&bn.rooftopElementCollisionCheck(u,p,y)){l.elements.push(u),d=!0;break}else u.cx-=A}if(d)l.updateElementOnRoofFlag=!0;else{const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation])}break}case z.FresnelReflector:case z.Heliostat:case z.ParabolicDish:case z.ParabolicTrough:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const A=u.lx/f.lx/2;for(u.cx+=A*3;u.cx+A<.5;)if(ye.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=A;if(!d)for(u.cx=s.cx-A*3;u.cx-A>-.5;)if(ye.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=A;if(!d){const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}break}else if(f.type===z.Roof){if(s.foundationId){const A=l.getElementById(s.foundationId);if(A){const y=bn.getRoofBoundaryVertices(f),S=u.lx/A.lx/2;for(u.cx+=S*1.25;u.cx+S<.5;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx+=S*1.25}if(!d)for(u.cx=s.cx-S*1.25;u.cx-S>-.5;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx-=S*1.25}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",C))}}}break}const p=l.findNearestSibling(s.id);if(p){const A=l.getElementById(p);if(A){const y=u.cx,S=u.cy,C=u.cz,P=A.cx-s.cx,v=A.cy-s.cy,T=A.cz-s.cz;u.cx=A.cx+P,u.cy=A.cy+v,u.cz=A.cz+T,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-v,u.cz=s.cz-T,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*v,u.cz=s.cz-2*T,l.overlapWithSibling(u)&&(u.cx=y-P,u.cy=S-v,u.cz=C-T)))}else u.cx+=(.01+u.lx)/f.lx}else u.cx+=(.01+u.lx)/f.lx;const g={lng:l.language};l.overlapWithSibling(u)?co(Y.t("message.CannotPasteBecauseOfOverlap",g)):f.type===z.Foundation||f.type===z.Cuboid&&ye.isIdentical(u.normal,as)?ye.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(Y.t("message.CannotPasteOutsideBoundary",g)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.Sensor:case z.Light:case z.WindTurbine:{if(u.parentId){const f=l.getParent(u);f&&(u.cx+=u.lx/f.lx),u.cx<.5&&(l.elements.push(u),l.elementsToPaste=[u],d=!0)}break}case z.Polygon:{const f=u;for(const p of f.vertices)p.x+=.1;f.cx+=.1,l.elements.push(f),l.elementsToPaste=[f],d=!0;break}case z.Cuboid:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=A=>{const y=[];for(const S of e().elements)if(S.parentId===A.id)switch(y.push(S),S.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:y.push(...f(S))}return y},p=f(s),g=new Map;a.push(u),g.set(s.id,u);for(const A of p){const y=g.get(A.parentId);if(y){const S=Dl.clone(y,A,A.cx,A.cy,A.cz,A.type===z.Polygon);S&&(u.normal&&(S.normal=[...A.normal]),a.push(S),g.set(A.id,S))}}l.elements.push(...a),l.elementsToPaste=[u],l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),l.elementsToPaste=[...f],a.push(...f),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!1;break}case z.Foundation:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=new Map,p=new Map;for(const g of l.elements)if(g.parentId===s.id&&g.parentId!==g.id){const A=Dl.clone(u,g,g.cx,g.cy,g.cz,g.type===z.Polygon);if(A&&(u.normal&&(A.normal=[...g.normal]),a.push(A),(A==null?void 0:A.type)===z.Wall||(A==null?void 0:A.type)===z.Roof)){f.set(A.id,g.id),p.set(g.id,A.id);for(const y of l.elements)if(y.parentId===g.id){const S=Dl.clone(A,y,y.cx,y.cy,y.cz);S&&(g.normal&&(S.normal=[...y.normal]),a.push(S))}}}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u];for(const g of l.elements){if(g.type===z.Roof){const A=f.get(g.id);if(A){const y=e().getElementById(A);y&&(g.wallsId=y.wallsId.map(S=>p.get(S)))}}if(g.type===z.Wall){const A=f.get(g.id);if(A){for(const y of l.elements)if(y.id===A&&y.type===z.Wall){const S=y,C=p.get(S.leftJoints[0]);C&&(g.leftJoints=[C]);const P=p.get(S.rightJoints[0]);if(P&&(g.rightJoints=[P]),S.roofId){const v=p.get(S.roofId);v&&(g.roofId=v)}break}}}}}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),a.push(...f),l.elementsToPaste=f,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!0;break}case z.Wall:{const f=u,p=new ae(1,-1,0).applyEuler(new ln(0,0,f.relativeAngle));if(u.cx+=p.x,u.cy+=p.y,l.elementsToPaste.length===1){const g=new ae(u.cx,u.cy,0),A=new ae(u.lx/2,0,0),y=new ae(-u.lx/2,0,0),S=new ln(0,0,f.relativeAngle);f.leftPoint=g.clone().add(y.applyEuler(S)).toArray(),f.rightPoint=g.clone().add(A.applyEuler(S)).toArray(),f.roofId=void 0,f.leftRoofHeight=void 0,f.rightRoofHeight=void 0,f.centerLeftRoofHeight=void 0,f.centerRightRoofHeight=void 0,f.centerRoofHeight=void 0;for(const C of l.elements)if(C.parentId===s.id){const P=Dl.clone(u,C,C.cx,C.cy,C.cz,C.type===z.Polygon);P&&(u.normal&&(P.normal=[...C.normal]),a.push(P))}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u]}else if(l.elementsToPaste.length>1){const g=l.copyCutElements();g.length>0&&(g[0].cx+=p.x,g[0].cy-=p.y,l.elements.push(...g),a.push(...g),l.elementsToPaste=g,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(g[0].id),l.selectedElement=g[0])}l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,d=!0;break}}l.elementsToPaste.length===1&&d&&(a.push(u),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u)}}}),a},supportedPvModules:{},customPvModules:{},loadSupportedPvModules(){const a=[];hB.parse(Fpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c={name:s[0].trim(),brand:s[1].trim(),cellType:s[2].trim(),efficiency:parseFloat(s[3].trim()),length:parseFloat(s[4].trim()),nominalLength:parseFloat(s[5].trim()),width:parseFloat(s[6].trim()),nominalWidth:parseFloat(s[7].trim()),thickness:parseFloat(s[8].trim()),m:parseFloat(s[9].trim()),n:parseFloat(s[10].trim()),pmax:parseFloat(s[11].trim()),vmpp:parseFloat(s[12].trim()),impp:parseFloat(s[13].trim()),voc:parseFloat(s[14].trim()),isc:parseFloat(s[15].trim()),pmaxTC:parseFloat(s[16].trim()),noct:parseFloat(s[17].trim()),weight:parseFloat(s[18].trim()),color:s[19].trim(),shadeTolerance:s[20].trim(),bifacialityFactor:parseFloat(s[21].trim())};a.push(c)}console.log(a.length+" PV models loaded"),i(s=>{for(const c of a)s.supportedPvModules[c.name]=c})}})},getPvModule(a){let l=e().supportedPvModules[a];return l||(l=e().customPvModules[a]),l},addCustomPvModule(a){i(l=>{l.customPvModules[a.name]=a})},removeCustomPvModule(a){i(l=>{let s=!1;for(const c of l.elements)if(c.type===z.SolarPanel&&c.pvModelName===a){s=!0;break}s?co(Y.t("pvModelPanel.ThisCustomSolarPanelIsUsed",{lng:l.language})):delete l.customPvModules[a]})},weatherModel:void 0,setWeatherModel(a){i(l=>{l.weatherModel=l.weatherData[a]})},weatherData:{},loadWeatherData(){if(Object.keys(e().weatherData).length>0)return;const a=[];hB.parse(zpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[],u=[],d=[];for(let p=5;p<29;p++)(p-5)%2===0?c.push(parseFloat(s[p].trim())):u.push(parseFloat(s[p].trim()));for(let p=29;p<41;p++)d.push(parseFloat(s[p].trim()));const f={city:s[0].trim(),country:s[1].trim(),longitude:parseFloat(s[2].trim()),latitude:parseFloat(s[3].trim()),elevation:parseFloat(s[4].trim()),lowestTemperatures:c,highestTemperatures:u,sunshineHours:d};a.push(f)}i(s=>{for(const c of a)s.weatherData[c.city+", "+c.country]=c;s.weatherModel=s.weatherData["Boston MA, USA"]}),console.log(a.length+" weather datasets loaded")}})},getWeather(a){const l=e().weatherModel;return l||e().weatherData[a]},horizontalSolarRadiationData:{},loadHorizontalSolarRadiationData(){const a=[];hB.parse(Dpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.horizontalSolarRadiationData[c.city+", "+c.country]=c})}})},getHorizontalSolarRadiation(a){return e().horizontalSolarRadiationData[a]},verticalSolarRadiationData:{},loadVerticalSolarRadiationData(){const a=[];hB.parse(Ept,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.verticalSolarRadiationData[c.city+", "+c.country]=c})}})},getVerticalSolarRadiation(a){return e().verticalSolarRadiationData[a]},getClosestCity(a,l){let s=Number.MAX_VALUE,c=null,u;const d=e().weatherData;for(const f in d)Object.hasOwn(d,f)&&(u=ye.getDistance(l,a,d[f].longitude,d[f].latitude),u{l.sunlightDirection=a.clone()})},cameraDirection:new ae,getCameraDirection(){return e().cameraDirection},updateSceneRadiusFlag:!1,updateSceneRadius(){i(a=>{a.updateSceneRadiusFlag=!a.updateSceneRadiusFlag})},sceneRadius:100,setSceneRadius(a){i(l=>{l.sceneRadius=a})},selectedElementAngle:0,selectedElementHeight:0,selectedElementX:0,selectedElementY:0,isAddingElement(){return!!(e().addedCuboidId||e().addedFoundationId||e().addedWallId||e().addedWindowId||e().addedDoorId)},addedFoundationId:null,deletedFoundationId:null,addedCuboidId:null,deletedCuboidId:null,addedWallId:null,deletedWallId:null,updateWallMapOnFoundationFlag:!1,updateWallMapOnFoundation(){i(a=>{a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},updateElementOnRoofFlag:!1,setUpdateElementOnRoofFlag(a){i(l=>{l.updateElementOnRoofFlag=a})},updateElementOnRoofFn(){i(a=>{a.updateElementOnRoofFlag=!0})},addedWindowId:null,addedDoorId:null,addedRoofIdSet:new Set,deletedRoofId:null,deletedRoofIdSet:new Set,autoDeletedRoofs:null,autoDeletedRoofIdSet:new Set,autoDeletedChild:null,getAutoDeletedElements(){const a=e().autoDeletedRoofs,l=e().autoDeletedChild;return!a||!l?null:[...a,...l]},deleteAddedRoofId(a){i(l=>{l.addedRoofIdSet.delete(a)})},groupActionMode:!1,setGroupActionMode(a){i(l=>{l.groupActionMode=a})},groupActionUpdateFlag:!1,locale:y1e,localFileDialogRequested:!1,loggable:!1,actionInfo:void 0,currentUndoable:void 0,showCloudFileTitleDialog:!1,showCloudFileTitleDialogFlag:!1,localContentToImportAfterCloudFileUpdate:void 0,enableFineGrid:!1,setEnableFineGrid(a){i(l=>{l.enableFineGrid=a})}}},{name:"aladdin-storage",storage:oje(()=>new URLSearchParams(window.location.search).get("viewonly")==="true"?sessionStorage:localStorage),skipHydration:ye.isOpenFromURL(),partialize:t=>({language:t.language,animate24Hours:t.animate24Hours,floatingWindowOpacity:t.floatingWindowOpacity,selectedFloatingWindow:t.selectedFloatingWindow,locale:t.locale,cloudFile:t.cloudFile,latestModelSite:t.latestModelSite,modelSites:t.modelSites,allModelSites:t.allModelSites,modelsMapLatitude:t.modelsMapLatitude,modelsMapLongitude:t.modelsMapLongitude,modelsMapAddress:t.modelsMapAddress,modelsMapZoom:t.modelsMapZoom,modelsMapType:t.modelsMapType,modelsMapTilt:t.modelsMapTilt,showModelsAllTime:t.showModelsAllTime,showModelsFromDate:t.showModelsFromDate,showModelsToDate:t.showModelsToDate,world:t.world,elements:t.elements,viewState:t.viewState,graphState:t.graphState,actionState:t.actionState,modelType:t.modelType,modelAuthor:t.modelAuthor,modelLabel:t.modelLabel,modelDescription:t.modelDescription,projectView:t.projectView,projectState:t.projectState,designProjectType:t.designProjectType,notes:t.notes,user:t.user,sceneRadius:t.sceneRadius,weatherModel:t.weatherModel,solarPanelArrayLayoutParams:t.solarPanelArrayLayoutParams,solarPanelArrayLayoutConstraints:t.solarPanelArrayLayoutConstraints,economicsParams:t.economicsParams,evolutionMethod:t.evolutionMethod,evolutionaryAlgorithmState:t.evolutionaryAlgorithmState,geneticAlgorithmWizardSelectedTab:t.geneticAlgorithmWizardSelectedTab,particleSwarmOptimizationWizardSelectedTab:t.particleSwarmOptimizationWizardSelectedTab,minimumNavigationMoveSpeed:t.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:t.minimumNavigationTurnSpeed,customPvModules:t.customPvModules})})));class qen extends be.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,n){}clearCacheAndReload(){localStorage.clear(),window.location.reload()}render(){return this.state.hasError?h.jsxs("div",{style:{marginTop:10,marginLeft:20},children:[h.jsx("h1",{children:"Error"}),h.jsx("p",{children:"Something went wrong. Please click the following button to clear the cache and reload the page."}),h.jsx("p",{children:h.jsx("button",{onClick:this.clearCacheAndReload,children:"Refresh"})})]}):this.props.children}}const $en=t=>{const e=typeof t=="function",n=m.useRef(t);m.useEffect(()=>{n.current=t}),m.useEffect(()=>{if(e){const o=r=>{const i=n.current(r);if(typeof i=="string")return r.preventDefault(),r.returnValue=i;if(r.defaultPrevented)return r.returnValue=""};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}}},[e])},Qen=({children:t=null,onBeforeunload:e})=>($en(e),t),Zen="/aladdin/assets/daysky-xGPh_lTa.jpg",etn="/aladdin/assets/desert-C1g8PGRA.jpg",ttn="/aladdin/assets/dune-BTLjQ9Lc.jpg",ntn="/aladdin/assets/forest-4yWLHFWh.jpg",otn="/aladdin/assets/grassland-CDTfZBr_.jpg",dTe="/aladdin/assets/hill-spring-BepVmTLf.jpg",fTe="/aladdin/assets/hill-summer-RoU04vrD.jpg",hTe="/aladdin/assets/hill-fall-BPbpF4zI.jpg",pTe="/aladdin/assets/hill-winter-CQjb4ZNm.jpg",rtn="/aladdin/assets/lake-Dj_bK41O.jpg",itn="/aladdin/assets/mountain-Du_Jo4ue.jpg",atn="/aladdin/assets/rural-BqG-D3I1.jpg",ltn=be.memo(({theme:t="Default"})=>{const e=M(pn),n=M(RW),o=M(Db),r=M(Wge),i=M(Kge),a=M(LH),l=M(Jn),s=M(d3),c=M(jge),u=M(Ug),d=M(s0),f=M(Al),p=M(En),g=M(u3),A=M(lYe),{scene:y,camera:S,gl:{domElement:C}}=ri(),P=m.useRef(null),v=m.useRef(null),T=m.useRef(null),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new ae),R=m.useRef(new ae),H=m.useRef(new ae(1,1,1)),F=m.useRef(0),E=m.useRef(0),N=m.useRef(new Map),U=m.useRef(new Map),W=m.useRef(new Map),k=m.useRef(new Map),D=m.useRef(null),L=$t(),j=m.useMemo(()=>new l0,[]),B=m.useMemo(()=>new ln,[]),V=new Date(f).getMonth()+1,[G,q]=m.useState(Qf.Sky),$=m.useMemo(()=>new ae,[]),ie=m.useMemo(()=>new ln,[]);if(v.current&&u){G!==Qf.Vertical&&q(Qf.Vertical);const ue=i(v.current,u),fe=r(),ve=-Math.atan2(fe.x,fe.y);$.set(ue.x,ue.y,0),ie.set(-Qt,0,ve,"ZXY")}const Q=m.useMemo(()=>{switch(t){case Os.Desert:return .5;case Os.Dune:return .25;case Os.Forest:return .25;case Os.Grassland:return .15;case Os.Hill:return .3;case Os.Lake:return .1;case Os.Mountain:return .4;case Os.Rural:return .25;default:return .2}},[t]),se=m.useMemo(()=>{switch(t){case Os.Desert:return etn;case Os.Dune:return ttn;case Os.Forest:return ntn;case Os.Grassland:return otn;case Os.Hill:return d>0?V>=12||V<=3?pTe:V>3&&V<=5?dTe:V>5&&V<=9?fTe:hTe:V>=12||V<=3?fTe:V>3&&V<=5?hTe:V>5&&V<=9?pTe:dTe;case Os.Lake:return rtn;case Os.Mountain:return itn;case Os.Rural:return atn;default:return Zen}},[t,V,d]),Z=Hb(se),ee=ue=>ue===z.Foundation||ue===z.Cuboid||ue===z.Tree||ue===z.Flower||ue===z.Human,te=ue=>{if(ue.intersections.length>0)if(ue.intersections[0].object===P.current)n(),e(ve=>{ve.clickObjectType=z.Sky});else{const ve=o();ve&&ee(ve.type)&&(v.current=ve,ye.isPlantOrHuman(v.current)&&(q(Qf.Vertical),ie.set(-Qt,0,0,"ZXY")),ve.type!==z.Foundation&&ve.type!==z.Cuboid&&kn.getState().setEnableOrbitController(!1))}},oe=ue=>{if(!ue)return"";const fe=ue.name.split(" ");return fe[2]?fe[2]:oe(ue.parent)},de=(ue,fe)=>{if(ue==null)return null;for(const ve of ue.children)if(ve.name.includes(`${fe}`))return ve;return null},he=(ue,fe)=>{var Ie,Me;const ve=kn.getState().contentRef,we=de(ve==null?void 0:ve.current,ue.id);if(we){for(const ze of we.children)if(ze.name.includes(`${fe.id}`)){(Me=(Ie=kn.getState().contentRef)==null?void 0:Ie.current)==null||Me.add(ze);break}}fe.parentId=Zo;const Pe=new ae(fe.cx,fe.cy,fe.cz).applyEuler(new ln(0,0,ue.rotation[2])).add(b.current);fe.cx=Pe.x,fe.cy=Pe.y,fe.cz=0,W.current.set(fe.id,new ae(Pe.x,Pe.y,0)),k.current.set(fe.id,Zo)},pe=(ue,fe,ve)=>{if(!ue||!fe)return;const we=kn.getState().contentRef;if(we!=null&&we.current){const Pe=ye.getObjectChildById(we.current,fe),Ie=ye.getObjectChildById(fe===Zo?we.current:Pe,ve);if(Ie){if(ue===Zo)we.current.add(Ie);else{const Me=ye.getObjectChildById(we.current,ue);Me==null||Me.add(Ie)}op()}}},me=(ue,fe)=>{ue&&e(ve=>{for(const we of ve.elements)if(we.id===fe&&!ye.isFoundationOrCuboid(we)){we.parentId=ue;break}})},le=ue=>{for(const fe of ue)if(fe.object.userData.stand)return fe;return null},Te=(ue,fe)=>{if(ue&&ue.current){const ve=le(fe.intersections);if(ve){const we=ve.object,Pe=ue.current.parent;if(we.name==="Ground"){if(Pe&&Pe.name!=="Content"){const Ie=kn.getState().contentRef;Ie&&Ie.current&&(Ie.current.add(ue.current),me(Zo,oe(ue.current)))}ue.current.position.copy(ve.point),op()}else if(we.userData.stand){const Ie=we.parent;if(Ie){Pe&&Pe.uuid!==Ie.uuid&&(Ie.add(ue.current),me(oe(Ie),oe(ue.current))),B.set(0,0,-Ie.rotation.z);const Me=new ae().subVectors(ve.point,Ie.position).applyEuler(B);ue.current.position.copy(Me),op()}}}}},ge=(ue,fe,ve)=>{e(we=>{for(const Pe of we.elements)if(Pe.id===ue){ye.isFoundationOrCuboid(Pe)||(Pe.parentId=fe),Pe.cx=ve.x,Pe.cy=ve.y,Pe.cz=ve.z;break}})},Se=()=>{if(M.getState().viewState.orthographic)return!1;if(P.current){const ue=j.intersectObjects(ye.fetchIntersectables(y),!1);if(ue.length>0){for(const fe of ue)if(fe.object.userData.stand)return!1}}return j.intersectObjects([P.current]).length>0},Re=ue=>{if(v.current&&v.current.type&&!v.current.locked){const fe=new Kt;fe.x=ue.offsetX/C.clientWidth*2-1,fe.y=-(ue.offsetY/C.clientHeight)*2+1,j.setFromCamera(fe,S);let ve;if(T.current&&G===Qf.Vertical&&(ve=j.intersectObjects([T.current]),ve&&ve.length>0)){const we=ve[0].point;switch(v.current.type){case z.Tree:{const Pe=v.current;switch(u){case Mt.Top:c(Pe.id,we.z),e(Ie=>{Ie.selectedElementHeight=Math.max(1,we.z)});break;case Mt.Left:case Mt.Right:case Mt.Upper:case Mt.Lower:s(Pe.id,2*Math.hypot(we.x-Pe.cx,we.y-Pe.cy));break}Te(kn.getState().treeRef,ue);break}case z.Human:{Te(kn.getState().humanRef,ue);break}case z.Cuboid:{if(ye.isTopResizeHandle(u)){e(Ie=>{var Me;for(const ze of Ie.elements)if(ze.id===((Me=v.current)==null?void 0:Me.id)){ze.cz=Math.max(.5,we.z/2),ze.lz=Math.max(1,we.z);break}Ie.selectedElementHeight=Math.max(1,we.z)});const Pe=kn.getState().cuboidRef;if(Pe!=null&&Pe.current){for(const Ie of Pe.current.children)if(Ie.name.includes("Human")||Ie.name.includes("Tree")){const Me=w.current.get(oe(Ie));Me&&(Math.abs(E.current-Me.z)<.01?Ie.position.setZ(Math.max(we.z/2,.5)):Ie.position.setZ(Me.z-Pe.current.position.z))}}}break}}}}},De=ue=>{if(ue.button===2)return;e(ve=>{ve.contextMenuObjectType=null}),te(ue);const fe=v.current;if(fe)switch(E.current=fe.lz,b.current.set(fe.cx,fe.cy,fe.cz),fe.type){case z.Human:D.current=fe.parentId;break;case z.Tree:D.current=fe.parentId,F.current=fe.lx;break;case z.Cuboid:{b.current.set(fe.cx,fe.cy,fe.cz),H.current.set(fe.lx,fe.ly,fe.lz),w.current.clear();const ve=new ae(fe.cx,fe.cy,fe.cz),we=a(fe.id);if(we.length>0){N.current.clear();const Pe=fe.rotation[2];for(const Ie of we)switch(Ie.type){case z.Tree:case z.Human:{const Me=new ae(Ie.cx,Ie.cy,Ie.cz).applyEuler(new ln(0,0,Pe));Me.add(ve),w.current.set(Ie.id,Me),N.current.set(Ie.id,new ae(Ie.cx,Ie.cy,Ie.cz));break}case z.SolarPanel:case z.Sensor:{if(ye.isIdentical(Ie.normal,as)){const Me=new ae(Ie.cx*fe.lx,Ie.cy*fe.ly,Ie.cz*fe.lz).applyEuler(new ln(0,0,Pe));Me.add(ve),w.current.set(Ie.id,Me)}break}case z.Polygon:{if(ye.isIdentical(Ie.normal,as)){const Me=Ie,ze=[];for(const Ne of Me.vertices){const Je=new Kt(Ne.x*fe.lx,Ne.y*fe.ly).rotateAround(ai,Pe);Je.add(new Kt(ve.x,ve.y)),ze.push(Je)}x.current.set(Me.id,ze)}break}}}break}}},Ae=()=>{var ue,fe;if(v.current){const ve=l(v.current.id);if(ve&&!ve.locked){let we=null,Pe=D.current;switch(ve.type){case z.Cuboid:switch(u){case Mt.UpperLeftTop:case Mt.UpperRightTop:case Mt.LowerLeftTop:case Mt.LowerRightTop:{U.current.clear(),e(ze=>{ze.actionState.cuboidHeight=ve.lz;for(const Ne of ze.elements)if(ye.isPlantOrHuman(Ne)&&Ne.parentId===ve.id)if(U.current.set(Ne.id,ve.id),Math.abs(H.current.z/2-Ne.cz)<.01)Ne.cz=ve.lz/2;else{const Je=Ne.cz+b.current.z-ve.cz;Math.abs(Je)>ve.lz/2?he(ve,Ne):Ne.cz=Je}});const Ie=a(ve.id);if(Ie.length>0)for(const ze of Ie)W.current.set(ze.id,new ae(ze.cx,ze.cy,ze.cz));const Me={name:"Change Cuboid Height",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:E.current,newValue:ve.lz,oldChildrenPositionsMap:new Map(N.current),newChildrenPositionsMap:new Map(W.current),oldChildrenParentIdMap:new Map(U.current),newChildrenParentIdMap:new Map(k.current),undo:()=>{var ze,Ne;if(e(Je=>{for(const Ue of Je.elements)if(Ue.id===Me.changedElementId){Ue.lz=Me.oldValue,Ue.cz=Me.oldValue/2;break}}),Me.oldChildrenPositionsMap&&Me.oldChildrenPositionsMap.size>0)for(const[Je,Ue]of Me.oldChildrenPositionsMap.entries()){const nt=l(Je);if((nt==null?void 0:nt.type)!==z.Polygon){g(Je,Ue.x,Ue.y,Ue.z);const We=(ze=Me.oldChildrenParentIdMap)==null?void 0:ze.get(Je),Ee=(Ne=Me.newChildrenParentIdMap)==null?void 0:Ne.get(Je);We&&Ee&&We!==Ee&&(pe(We,Ee,Je),me(We,Je))}}},redo:()=>{var ze,Ne;if(e(Je=>{for(const Ue of Je.elements)if(Ue.id===Me.changedElementId){Ue.lz=Me.newValue,Ue.cz=Me.newValue/2;break}}),Me.newChildrenPositionsMap&&Me.newChildrenPositionsMap.size>0)for(const[Je,Ue]of Me.newChildrenPositionsMap.entries()){g(Je,Ue.x,Ue.y,Ue.z);const nt=(ze=Me.oldChildrenParentIdMap)==null?void 0:ze.get(Je),We=(Ne=Me.newChildrenParentIdMap)==null?void 0:Ne.get(Je);nt&&We&&nt!==We&&(pe(We,nt,Je),me(We,Je))}}};p(Me);break}}break;case z.Tree:switch(u){case Mt.Top:{const Ie={name:"Change Tree Height",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:E.current,newValue:ve.lz,undo:()=>{c(Ie.changedElementId,Ie.oldValue)},redo:()=>{c(Ie.changedElementId,Ie.newValue)}};p(Ie),e(Me=>{Me.actionState.treeHeight=ve.lz});break}case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Ie={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:F.current,newValue:ve.lx,undo:()=>{s(Ie.changedElementId,Ie.oldValue)},redo:()=>{s(Ie.changedElementId,Ie.newValue)}};p(Ie),e(Me=>{Me.actionState.treeSpread=ve.lx});break}}we=(ue=kn.getState().treeRef)==null?void 0:ue.current;break;case z.Human:we=(fe=kn.getState().humanRef)==null?void 0:fe.current;break}if(we){const Ie=j.intersectObjects(ye.fetchIntersectables(y),!1),Me=le(Ie);if(Me){const ze=Me.point;if(Me.object.name==="Ground")ge(ve.id,Zo,ze),R.current.set(ze.x,ze.y,ze.z),Pe=Zo;else if(Me.object.userData.stand){const Ne=oe(Me.object),Je=Me.object.parent;if(Je){const Ue=new ae().subVectors(ze,Je.position).applyEuler(B);ge(ve.id,Ne,Ue),R.current.set(Ue.x,Ue.y,Ue.z),Pe=Ne}}}}if(M.getState().moveHandleType&&ye.isPlantOrHuman(ve)&&(R.current.distanceToSquared(b.current)>Et||j.intersectObjects([P.current]).length>0)){let Ie=!0;if(!M.getState().viewState.orthographic&&(Ie=R.current.length().02}if(!Ie||Se()){g(ve.id,b.current.x,b.current.y,b.current.z),we&&ye.isPlantOrHuman(ve)&&we.position.copy(b.current),ye.isPlantOrHuman(ve)&&me(D.current,ve.id);const Me=kn.getState().contentRef;if(Me!=null&&Me.current&&D.current&&we){if(D.current===Zo)Me.current.add(we);else{const ze=ye.getObjectChildById(Me.current,D.current);ze==null||ze.add(we)}op()}co(Y.t("message.CannotMoveObjectTooFar",L))}else{const Me={name:"Move",timestamp:Date.now(),movedElementId:ve.id,movedElementType:ve.type,oldCx:b.current.x,oldCy:b.current.y,oldCz:b.current.z,newCx:R.current.x,newCy:R.current.y,newCz:R.current.z,oldParentId:D.current,newParentId:Pe,undo:()=>{g(Me.movedElementId,Me.oldCx,Me.oldCy,Me.oldCz),me(Me.oldParentId,Me.movedElementId),pe(Me.oldParentId,Me.newParentId,Me.movedElementId)},redo:()=>{g(Me.movedElementId,Me.newCx,Me.newCy,Me.newCz),me(Me.newParentId,Me.movedElementId),pe(Me.newParentId,Me.oldParentId,Me.movedElementId)}};p(Me),A()}}}v.current=null,q(Qf.Sky),e(we=>{we.moveHandleType=null,we.resizeHandleType=null,we.rotateHandleType=null}),kn.setState({humanRef:null,treeRef:null}),kn.getState().setEnableOrbitController(!0)}};return h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{ref:P,name:"Sky",rotation:[Qt,0,0],scale:[1,Q,1],onContextMenu:ue=>{ue.intersections.length>0&&ue.intersections[0].object===P.current&&(n(),e(ve=>{ve.clickObjectType=z.Sky,ve.contextMenuObjectType=z.Sky}))},onPointerDown:De,children:[h.jsx("sphereGeometry",{args:[tAt,16,8,0,sa,0,Qt]}),h.jsx("meshToonMaterial",{map:Z,side:r0,opacity:1,color:"skyblue"})]}),v.current&&G!==Qf.Sky&&h.jsx(ta,{ref:T,visible:!1,name:"Sky Intersection Plane",rotation:ie,position:$,args:[1e3,1e3],onPointerMove:k2.throttle(Re,qF),onPointerUp:Ae,children:h.jsx("meshStandardMaterial",{side:ti})})]})}),stn=be.memo(({lineWidth:t=1,endPoint:e=1e3,showTickMarks:n=!0,showTickLabels:o=!0})=>{const r=M(zwt),i=M(ay),a=M(Ju),[l,s]=m.useState(!1),c=50,u=m.useRef(1),d=m.useRef(u.current*10),f=m.useRef(new Array(c).fill(1)),p=.1,g=.3,A="FloralWhite",y=t/2,S=r3(hW,mN),C=Math.min(1,Math.max(.5,i*.01)),P={font:S,height:0,size:C},v=a?r.max.z+.01:0;m.useEffect(()=>{i<50?u.current=1:i<100?u.current=2:u.current=5,d.current=10*u.current,f.current=new Array(c).fill(1),s(!l)},[i]);const T=w=>w%(5*u.current)===0?g:p;return h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},name:"x axis line",points:[[-e,0,v],[e,0,v]],color:"red",lineWidth:t}),a&&n&&f.current.map((w,x)=>{const b=(x+1)*u.current,R=T(b);return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[b,-R,v],[b,R,v]],color:A,lineWidth:y}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-b,-R,v],[-b,R,v]],color:A,lineWidth:y})]},b)}),a&&o&&f.current.map((w,x)=>{const b=(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[b-C,-g*2-C,v],children:[h.jsx("textGeometry",{args:[(b<10?" ":"")+b,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),a&&o&&f.current.map((w,x)=>{const b=-(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[b-C,-g*2-C,v],children:[h.jsx("textGeometry",{args:[(b>-10?" ":"")+b,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),h.jsx(Gn,{name:"y axis line",userData:{unintersectable:!0},points:[[0,-e,v],[0,e,v]],color:"blue",lineWidth:t}),a&&n&&f.current.map((w,x)=>{const b=(x+1)*u.current,R=T(b);return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[-R,b,v],[R,b,v]],color:A,lineWidth:y*1.5}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-R,-b,v],[R,-b,v]],color:A,lineWidth:y*1.5})]},b)}),a&&o&&f.current.map((w,x)=>{const b=(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-g*2-C*2,b-C/2,v],children:[h.jsx("textGeometry",{args:[b+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),a&&o&&f.current.map((w,x)=>{const b=-(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-g*2-C*2,b-C/2,v],children:[h.jsx("textGeometry",{args:[b+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),!a&&h.jsx(Gn,{userData:{unintersectable:!0},name:"z axis line",points:[[0,0,0],[0,0,e]],color:"green",lineWidth:t})]})}),ctn=be.memo(t=>{var q;const{id:e,cx:n,cy:o,cz:r,name:i=Vt.Jack,locked:a=!1,flip:l=!1,observer:s=!1,parentId:c}=t;let u=!1;M($=>{if(c===Zo)u=!0;else for(const ie of $.elements)if(ie.id===c){u=!0;break}});const d=M(Ap);m.useEffect(()=>{u||d(e,!1)},[u,e]);const f=M(pn),p=M(Ju)??!1,g=M(pu),A=M(Ub),y=M(ly),S=dt(hs),C=Tc(e),{gl:P}=ri(),[v,T]=m.useState(!1),w=kn($=>$.contentRef),x=m.useRef(null),b=m.useRef(null),R=$t(),H=m.useRef(!1),F=M(FH);F!==H.current&&(H.current=F,w!=null&&w.current&&x.current&&w.current.add(x.current)),m.useEffect(()=>{if(c!==Zo){const $=L();$&&x.current&&$.add(x.current)}},[F,c]);const E=m.useMemo(()=>new cf().load(kp.fetchTextureImage(i),$=>{l&&($.wrapS=bs,$.repeat.x=-1),U($)}),[i,l]),[N,U]=m.useState(E),W=m.useMemo(()=>kp.fetchWidth(i),[i]),k=m.useMemo(()=>kp.fetchHeight(i),[i]),D=m.useMemo(()=>kp.fetchLabel(i,R)+(a?" ("+Y.t("shared.ElementLocked",R)+")":"")+` -`+Y.t("word.Coordinates",R)+": ("+n.toFixed(1)+", "+o.toFixed(1)+") "+Y.t("word.MeterAbbreviation",R),[i,a,n,o,R]);m.useEffect(()=>{const $=L();$&&x.current&&$.add(x.current)},[w]);const L=()=>c!==Zo&&(w!=null&&w.current)?ye.getObjectChildById(w.current,c):null;Z2(({camera:$})=>{if(x.current){const{rot:ie}=ye.getWorldDataById(c);if(p)x.current.rotation.set(Qt,Math.PI-ie,0);else{const{x:Q,y:se}=$.position,{x:Z,y:ee}=x.current.localToWorld(new ae);x.current.rotation.set(0,0,-Math.atan2(Q-Z,se-ee)-ie)}}});const j=m.useCallback(($,ie)=>{dt.getState().duringCameraInteraction||$.intersections.length>0&&($.intersections[0].object===$.eventObject||$.intersections.length>1&&$.intersections[1].object===$.eventObject)&&(f(se=>{se.hoveredHandle=ie,se.selectedElementHeight=t.lz}),ye.isMoveHandle(ie)?P.domElement.style.cursor="move":P.domElement.style.cursor="pointer")},[t.lz]),B=m.useCallback(()=>{f($=>{$.hoveredHandle=null}),P.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),O=s?kp.fetchGender(t.name):Ha.Male,V=s?(t.flip?-1:1)*kp.fetchHatOffsetX(t.name):0,G=s?kp.fetchHatOffsetY(t.name):0;return u?h.jsx("group",{ref:x,name:"Human Group "+e,userData:{aabb:!0},position:[n,o,r??0],children:h.jsxs("group",{position:[0,.1,k/2],children:[h.jsx(RC,{rotation:[Qt,0,0],uuid:e,name:i,follow:!1,children:h.jsx(ta,{ref:b,renderOrder:3,receiveShadow:!S,name:`Human ${i} plane`,args:[W,k],onContextMenu:$=>{g(e,$,Xo.ContextMenu),f(ie=>{$.intersections.length>0&&$.intersections[0].object===b.current&&(ie.contextMenuObjectType=z.Human)})},onPointerDown:$=>{$.button!==2&&$.eventObject===$.intersections[0].eventObject&&(g(e,$,Xo.Move),kn.setState({humanRef:x}))},onPointerOver:$=>{$.intersections.length>0&&$.intersections[0].object===b.current&&T(!0)},onPointerOut:()=>{T(!1)},children:h.jsx("meshToonMaterial",{map:N,alphaTest:.5,side:ti})})}),C&&a&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-W/2,0,-k/2],[-W/2,0,k/2],[-W/2,0,k/2],[W/2,0,k/2],[W/2,0,-k/2],[W/2,0,k/2],[W/2,0,-k/2],[-W/2,0,-k/2]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(q=b.current)==null?void 0:q.rotation,color:B0}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{uuid:e,visible:!1,userData:{eyeball:!0},name:i+" eyeball",args:[W/5,4,4,0,sa,0,sa],position:[0,0,t.lz/2],children:h.jsx("meshBasicMaterial",{attach:"material",side:ti})}),h.jsx(ma,{name:"Observer hat 1",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.1,.1,.1,16,2],position:[V,0,t.lz/2-.05+G],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:O===Ha.Male?"gray":"hotpink"})}),h.jsx(ma,{name:"Observer hat 2",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.2,.2,.01,16,2],position:[V,0,t.lz/2-.1+G],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:O===Ha.Male?"gray":"hotpink"})})]}),C&&!a&&h.jsx(Ps,{position:[0,0,-k/2],args:[Wg*4,6,6,0,Math.PI],name:zo.Default,onPointerDown:$=>{$.button!==2&&$.eventObject===$.intersections[0].eventObject&&(g(e,$,Xo.Move),kn.setState({humanRef:x}))},onPointerEnter:$=>{j($,zo.Default)},onPointerLeave:B,children:h.jsx("meshBasicMaterial",{attach:"material",color:y===zo.Default||A===zo.Default?ga:iw})}),v&&!C&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:D,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,k/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null}),gTe="/aladdin/assets/apple_spring-Ctq5fKrS.png",dde="/aladdin/assets/apple_summer-Dr8H3cny.png",mTe="/aladdin/assets/apple_fall-Cp6pAzIj.png",yTe="/aladdin/assets/apple_winter-D03fshM0.png",ATe="/aladdin/assets/birch_spring-sKFxYorO.png",fde="/aladdin/assets/birch_summer-FaJ43Xt4.png",wTe="/aladdin/assets/birch_fall-PIQyyY4L.png",vTe="/aladdin/assets/birch_winter-C5h1hTVJ.png",aQe="/aladdin/assets/coconut-rkhxogn3.png",xTe="/aladdin/assets/dogwood_spring-9vLsm3g2.png",hde="/aladdin/assets/dogwood_summer-DgdkRZ2O.png",bTe="/aladdin/assets/dogwood_fall-Wu983FGV.png",STe="/aladdin/assets/dogwood_winter-4w2TO6RG.png",TTe="/aladdin/assets/elm_spring-DJcRoCq2.png",pde="/aladdin/assets/elm_summer-VNy_g1qe.png",PTe="/aladdin/assets/elm_fall-ChdMN8fe.png",CTe="/aladdin/assets/elm_winter-Qng-eWYe.png",lQe="/aladdin/assets/fan_palm-DbCJ1Nso.png",RTe="/aladdin/assets/linden_spring-C_zkyu46.png",gde="/aladdin/assets/linden_summer-zap94GfP.png",HTe="/aladdin/assets/linden_fall-CK-BpZ7U.png",MTe="/aladdin/assets/linden_winter-Dt7sgspu.png",ITe="/aladdin/assets/magnolia_spring-CNor1Lb8.png",mde="/aladdin/assets/magnolia_summer-C7-8T4uo.png",zTe="/aladdin/assets/magnolia_fall-D3wi6n7Y.png",DTe="/aladdin/assets/magnolia_winter-116tEre9.png",ETe="/aladdin/assets/maple_spring-26OHjb4f.png",yde="/aladdin/assets/maple_summer-BbcBLKSJ.png",FTe="/aladdin/assets/maple_fall-Bp5Vy2Jl.png",kTe="/aladdin/assets/maple_winter-BnFW631O.png",LTe="/aladdin/assets/oak_spring-CsUg07TC.png",Ade="/aladdin/assets/oak_summer-CPK7amde.png",WTe="/aladdin/assets/oak_fall-rgRz_M_t.png",NTe="/aladdin/assets/oak_winter-CD4uumS6.png",sQe="/aladdin/assets/pine-CI5zZHth.png",cQe="/aladdin/assets/spruce-CEhjo5-Q.png";class qz{static isEvergreen(e){return e===pr.Spruce||e===pr.Pine||e===pr.FanPalm||e===pr.Coconut}static isConic(e){return e===pr.Spruce}static fetchLabel(e,n){switch(e){case pr.Apple:return Y.t("tree.Apple",n);case pr.Birch:return Y.t("tree.Birch",n);case pr.Coconut:return Y.t("tree.Coconut",n);case pr.Dogwood:return Y.t("tree.Dogwood",n);case pr.Elm:return Y.t("tree.Elm",n);case pr.FanPalm:return Y.t("tree.FanPalm",n);case pr.Linden:return Y.t("tree.Linden",n);case pr.Magnolia:return Y.t("tree.Magnolia",n);case pr.Maple:return Y.t("tree.Maple",n);case pr.Oak:return Y.t("tree.Oak",n);case pr.Spruce:return Y.t("tree.Spruce",n);default:return Y.t("tree.Pine",n)}}static fetchTheta(e){switch(e){case pr.Apple:return .65*Math.PI;case pr.Birch:return .72*Math.PI;case pr.Coconut:return .5*Math.PI;case pr.Dogwood:return .65*Math.PI;case pr.Elm:return .78*Math.PI;case pr.FanPalm:return .52*Math.PI;case pr.Linden:return .75*Math.PI;case pr.Magnolia:return .68*Math.PI;case pr.Maple:return .65*Math.PI;case pr.Oak:return .75*Math.PI;case pr.Spruce:return Math.PI;default:return Math.PI*.5}}static fetchTextureImage(e,n,o,r,i){let a;const l=r+30,s=i-30,c=o>0;switch(e){case pr.Apple:n>=i||n<=r?a=c?yTe:dde:n>r&&n<=l?a=c?gTe:mTe:n>l&&n<=s?a=c?dde:yTe:a=c?mTe:gTe;break;case pr.Birch:n>=i||n<=r?a=c?vTe:fde:n>r&&n<=l?a=c?ATe:wTe:n>l&&n<=s?a=c?fde:vTe:a=c?wTe:ATe;break;case pr.Coconut:a=aQe;break;case pr.Dogwood:n>=i||n<=r?a=c?STe:hde:n>r&&n<=l?a=c?xTe:bTe:n>l&&n<=s?a=c?hde:STe:a=c?bTe:xTe;break;case pr.Elm:n>=i||n<=r?a=c?CTe:pde:n>r&&n<=l?a=c?TTe:PTe:n>l&&n<=s?a=c?pde:CTe:a=c?PTe:TTe;break;case pr.FanPalm:a=lQe;break;case pr.Linden:n>=i||n<=r?a=c?MTe:gde:n>r&&n<=l?a=c?RTe:HTe:n>l&&n<=s?a=c?gde:MTe:a=c?HTe:RTe;break;case pr.Magnolia:n>=i||n<=r?a=c?DTe:mde:n>r&&n<=l?a=c?ITe:zTe:n>l&&n<=s?a=c?mde:DTe:a=c?zTe:ITe;break;case pr.Maple:n>=i||n<=r?a=c?kTe:yde:n>r&&n<=l?a=c?ETe:FTe:n>l&&n<=s?a=c?yde:kTe:a=c?FTe:ETe;break;case pr.Oak:n>=i||n<=r?a=c?NTe:Ade:n>r&&n<=l?a=c?LTe:WTe:n>l&&n<=s?a=c?Ade:NTe:a=c?WTe:LTe;break;case pr.Spruce:a=cQe;break;default:a=sQe}return a}}const utn=be.memo(t=>{var ve;const{parentId:e,id:n,cx:o,cy:r,cz:i,lx:a,lz:l,name:s=pr.Pine,flip:c=!1,locked:u=!1,showModel:d=!1,showLabel:f=!1}=t;let p=!1;M(we=>{if(e===Zo)p=!0;else for(const Pe of we.elements)if(Pe.id===e){p=!0;break}});const g=M(Ap);m.useEffect(()=>{p||g(n,!1)},[p]);const A=M(pn),y=M(Ju)??!1,S=M(Al),C=M(s0),P=M(Pge)??Nq,v=M(Cge)??Uq,T=M(Cs),w=M(pu),x=M(Ub),b=M(Ug),R=M(ly),H=Tc(n),[F,E]=m.useState(!1),{gl:N}=ri(),U=kn(we=>we.contentRef),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(null),j=m.useRef(null),B=m.useRef(null),O=m.useRef(null),V=m.useRef(null),G=m.useRef(null),q=m.useRef(null),$=$t(),ie=m.useMemo(()=>ye.dayOfYear(new Date(S)),[S]),Q=m.useMemo(()=>!qz.isEvergreen(t?t.name:pr.Dogwood)&&(C>0?iev:ie>=P&&ie<=v),[ie,P,v,C,t==null?void 0:t.name]),se=m.useRef(!1),Z=M(FH);Z!==se.current&&(se.current=Z,U!=null&&U.current&&W.current&&U.current.add(W.current)),m.useEffect(()=>{if(e!==Zo){const we=ue();we&&W.current&&we.add(W.current)}},[Z]),m.useEffect(()=>{const we=ue();we&&W.current&&we.add(W.current)},[U]);const ee=m.useMemo(()=>new cf().load(qz.fetchTextureImage(s,ie,C,P,v),we=>{c&&(we.wrapS=bs,we.repeat.x=-1),oe(we)}),[s,ie,C,c,P,v]),[te,oe]=m.useState(ee),de=m.useMemo(()=>(t!=null&&t.label?t.label:qz.fetchLabel(s,$))+(u?" ("+Y.t("shared.ElementLocked",$)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",$)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+Y.t("word.MeterAbbreviation",$)),[t==null?void 0:t.label,s,o,r,u,$]),he=m.useMemo(()=>qz.fetchTheta(s),[s]),pe=a/2,me=l/2,le=m.useMemo(()=>new ae(0,0,me),[me]),Te=m.useMemo(()=>new ae(-pe,0,0),[pe]),ge=m.useMemo(()=>new ae(pe,0,0),[pe]),Se=m.useMemo(()=>new ae(0,-pe,0),[pe]),Re=m.useMemo(()=>new ae(0,pe,0),[pe]),De=m.useCallback((we,Pe)=>{dt.getState().duringCameraInteraction||we.intersections.length>0&&(we.intersections[0].object===we.eventObject||we.intersections.length>1&&we.intersections[1].object===we.eventObject)&&(A(Me=>{Me.hoveredHandle=Pe,Me.selectedElementHeight=t.lz}),ye.isMoveHandle(Pe)?N.domElement.style.cursor="move":N.domElement.style.cursor="pointer")},[t==null?void 0:t.lz]),Ae=m.useCallback(()=>{A(we=>{we.hoveredHandle=null}),N.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),ue=()=>e!==Zo&&(U!=null&&U.current)?ye.getObjectChildById(U.current,e):null;Z2(({camera:we})=>{if(k.current&&W.current&&D.current&&j.current){const{rot:Pe}=ye.getWorldDataById(e),{x:Ie,y:Me}=we.position,{x:ze,y:Ne}=W.current.position,{x:Je,y:Ue}=M.getState().sunlightDirection;if(ue()){const We=W.current.localToWorld(new ae),Ee=Math.atan2(Ie-We.x,Me-We.y)+Pe;k.current.rotation.set(Qt,-Ee,0),j.current.rotation.set(-Qt,Ee,0),D.current.rotation.set(Qt,-Math.atan2(Je,Ue)-Pe,0)}else{const We=Math.atan2(Ie-ze,Me-Ne);k.current.rotation.set(Qt,-We,0),j.current.rotation.set(-Qt,We,0),D.current.rotation.set(Qt,-Math.atan2(Je,Ue),0)}}});const fe=Wg*3;return h.jsx(h.Fragment,{children:p?h.jsx("group",{ref:W,name:"Tree Group "+n,userData:{aabb:!0},position:[o,r,i??0],children:h.jsxs("group",{position:[0,0,l/2],children:[h.jsx(RC,{ref:k,uuid:n,name:s,follow:!1,children:h.jsx(ta,{args:[a,l],children:h.jsx("meshToonMaterial",{map:te,side:ti,alphaTest:.5})})}),h.jsx(RC,{ref:D,name:s+" Shadow Billboard",follow:!1,children:h.jsx(ta,{args:[a,l],castShadow:T,children:h.jsx("meshBasicMaterial",{map:te,side:ti,alphaTest:.5,opacity:0})})}),qz.isConic(s)?h.jsx(xf,{visible:d||y,name:s+" Model",userData:{simulation:!0},position:[0,0,s===pr.Spruce?0:l*.06],args:[a/2,l,8,8,!0],scale:[1,1,1],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:ti,transparent:!0,opacity:.75})}):h.jsx(Ps,{visible:d||y,userData:{simulation:!Q},name:s+" Model",args:[a/2,8,8,0,sa,0,he],scale:[1,l/a,1],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:ti,transparent:!0,opacity:.75})}),h.jsx(RC,{ref:j,name:"Interaction Billboard",visible:!1,position:[0,0,-l/2+.5],children:h.jsx(ta,{ref:L,renderOrder:3,name:s+" plane",args:[a/2,l/3],rotation:[y?Qt:0,0,0],onContextMenu:we=>{w(n,we,Xo.ContextMenu),A(Pe=>{we.intersections.length>0&&we.intersections[0].object===L.current&&(Pe.contextMenuObjectType=z.Tree)})},onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(w(n,we,Xo.Move),kn.setState({treeRef:W}))},onPointerOver:we=>{we.intersections.length>0&&we.intersections[0].object===L.current&&E(!0)},onPointerOut:()=>{E(!1)}})}),H&&u&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-a/2,-l/2,0],[-a/2,l/2,0],[-a/2,l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[-a/2,-l/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ve=k.current)==null?void 0:ve.rotation,color:B0}),H&&!u&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{position:new ae(0,0,-l/2),args:[fe,6,6,0,Math.PI],name:zo.Default,renderOrder:2,onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(w(n,we,Xo.Move),kn.setState({treeRef:W}))},onPointerEnter:we=>{De(we,zo.Default)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===zo.Default||x===zo.Default?ga:iw})}),!y&&h.jsxs(h.Fragment,{children:[h.jsx(si,{ref:B,name:Mt.Top,args:[fe,fe,fe],position:le,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Top)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Top||b===Mt.Top?ga:$a})}),h.jsx(si,{ref:O,name:Mt.Left,args:[fe,fe,fe],position:Te,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Left)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Left||b===Mt.Left?ga:$a})}),h.jsx(si,{ref:V,name:Mt.Right,args:[fe,fe,fe],position:ge,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Right)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Right||b===Mt.Right?ga:$a})}),h.jsx(si,{ref:G,name:Mt.Lower,args:[fe,fe,fe],position:Se,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Lower)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Lower||b===Mt.Lower?ga:$a})}),h.jsx(si,{ref:q,name:Mt.Upper,args:[fe,fe,fe],position:Re,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Upper)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Upper||b===Mt.Upper?ga:$a})})]})]}),(F||f)&&!H&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:de,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});function uQe(t){const e=t+"Geometry";return m.forwardRef(({args:n,children:o,...r},i)=>h.jsxs("mesh",{ref:i,...r,children:[h.jsx(e,{attach:"geometry",args:n}),o]}))}const UTe=uQe("ParabolicCylinder"),jTe=uQe("Paraboloid"),dtn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,absorberTubeRadius:c=.05,latusRectum:u=2,tiltAngle:d,relativeAzimuth:f,moduleLength:p,poleHeight:g,poleRadius:A,drawSunBeam:y,rotation:S=[0,0,0],color:C="white",lineColor:P="black",lineWidth:v=.5,showLabel:T=!1,locked:w=!1,parentId:x}=t,b=M(pn),R=M(Al),H=M(s0),F=M(Kn),E=dt(hs),N=M(Pf),U=Cn(c1),W=M(Cs),k=M(Jn),D=M(pu),L=M(ay),j=M(Ug),B=M(Lw),O=Tc(e),{gl:{domElement:V}}=ri(),[G,q]=m.useState(!1),[$,ie]=m.useState(null),[Q,se]=m.useState(1),[Z,ee]=m.useState(null),te=m.useRef(null),oe=m.useRef(null),de=m.useRef(null),he=m.useRef(null),pe=m.useRef(null),me=m.useRef(null),le=m.useRef(null),Te=m.useRef(!1),ge=Math.max(100,10*L),Se=16,Re=B.z<=0,De=$t();let Ae=n,ue=o,fe=r;const ve=i/2,we=a/2,Pe=l/2,Ie=g+ve,Me=M(At=>{for(const pt of At.elements)if(pt.id===x)return pt});if(x&&Me)switch(Me.type){case z.Foundation:if(fe=Ie+Pe+Me.lz,ye.isZero(S[2]))Ae=Me.cx+n*Me.lx,ue=Me.cy+o*Me.ly;else{const At=new ae(n*Me.lx,o*Me.ly,0);At.applyAxisAngle(ko,S[2]),Ae=Me.cx+At.x,ue=Me.cy+At.y}break}const ze=ve*ve/u,Ne=.25*u,Je=new ae(-ve,-we,Pe+ze),Ue=new ae(-ve,we,Pe+ze),nt=new ae(ve,-we,Pe+ze),We=new ae(ve,we,Pe+ze);m.useEffect(()=>{if(t&&E){const At=U(t.id);At&&ee(ye.fetchHeatmapTexture(At,N??5))}},[E,N]),m.useEffect(()=>{se(Math.max(1,Math.round(a/p)))},[a,p]),m.useEffect(()=>{const At=()=>{kn.getState().setEnableOrbitController(!0),Te.current=!1};return window.addEventListener("pointerup",At),()=>{window.removeEventListener("pointerup",At)}},[]);const Ee=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.ParabolicTroughElement",De))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",De)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",De)+": ("+Ae.toFixed(1)+", "+ue.toFixed(1)+", "+fe.toFixed(1)+") "+Y.t("word.MeterAbbreviation",De)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ae,ue,fe,De]),ke=m.useMemo(()=>new ln(0,0,S[2],"ZXY"),[S]),Oe=(At,pt)=>{At.intersections.length>0&&At.intersections[0].object===At.eventObject&&(ie(pt),pt===zo.Top?V.style.cursor="move":pt===Di.Lower||pt===Di.Upper||pt===Di.Tilt?V.style.cursor="grab":V.style.cursor="pointer")},st=()=>{ie(null),V.style.cursor="default"},je=m.useMemo(()=>ki(new Date(R),H),[R,H]),xt=m.useMemo(()=>{var At;return(At=k(x))==null?void 0:At.rotation[2]},[x]),gt=xt?je.clone().applyAxisAngle(ko,-xt):je,Ye=m.useMemo(()=>je.z>0?new ln(0,Math.atan2(gt.x,gt.z),0,"ZXY"):new ln(d,0,f,"ZXY"),[je,d,f,gt.x,gt.z]),it=m.useMemo(()=>{if(je.z>0){const At=xt?Math.cos(xt):1,pt=xt?Math.sin(xt):0;return-Ne*(je.x*pt+je.y*At)/Math.hypot(je.x,je.z)}return 0},[je,xt,Ne]),ut=new ae(0,it,Ne).applyEuler(Ye),Qe=je.clone().multiplyScalar(ge).applyEuler(new ln(-ke.x,0,-ke.z)),lt=-(Ie+l)/2,Ze=m.useMemo(()=>{const At=[],pt=Math.cos(f)*p,Wt=Math.sin(f)*p,ht=Q/2-.5;for(let ct=0;ct{const At=[],pt=a/Q,Wt=-i/u,ht=-2*Wt/Se;for(let ct=0;ct<=Q;ct++){const It=[];for(let Ft=0;Ft<=Se;Ft++){const Ve=Wt+Ft*ht;It.push(new ae(u*Ve/2,-we+ct*pt,u*Ve*Ve/4))}At.push({points:It})}return At},[i,a,Q,u]),$e=Math.max(1,(i+a)/16),wt=sR*$e*1.5,vt=Wg*$e*2,Rt=F.length<50&&Be.length<10,Gt=Rt?4:2;return h.jsxs("group",{name:"Parabolic Trough Group "+e,rotation:ke,position:[Ae,ue,fe+Pe],children:[h.jsxs("group",{rotation:Ye,children:[h.jsx(UTe,{receiveShadow:W,castShadow:W,uuid:e,ref:te,args:[u/2,i,a,Se,4],name:"Parabolic Trough Front Side",onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Select)},onContextMenu:At=>{D(e,At,Xo.ContextMenu),b(pt=>{At.intersections.length>0&&At.intersections[0].object===te.current&&(pt.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:At=>{At.intersections.length>0&&At.intersections[0].object===te.current&&(q(!0),V.style.cursor="move")},onPointerOut:()=>{q(!1),V.style.cursor="default"},children:E&&Z?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:Z}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"})}),h.jsx(UTe,{receiveShadow:W,castShadow:W,uuid:e+" backside",ref:oe,args:[u/2,i,a,Se,4],name:"Parabolic Trough Back Side",position:[0,0,-Pe/2],onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Select)},onContextMenu:At=>{D(e,At,Xo.ContextMenu),b(pt=>{At.intersections.length>0&&At.intersections[0].object===oe.current&&(pt.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:At=>{At.intersections.length>0&&At.intersections[0].object===oe.current&&(q(!0),V.style.cursor="move")},onPointerOut:()=>{q(!1),V.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:r0,color:"white"})}),Be&&Be.map((At,pt)=>h.jsxs(be.Fragment,{children:[Rt&&h.jsx(Gn,{name:"Parabolic Trough Rim Lines",userData:{unintersectable:!0},points:At.points,castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),(pt===0||pt===Be.length-1||Rt)&&h.jsx(Gn,{name:"Parabolic Trough Focal Lines",userData:{unintersectable:!0},points:[At.points[Se/2].clone(),At.points[Se/2].clone().add(new ae(0,0,Ne))],castShadow:!1,receiveShadow:!1,lineWidth:v,color:Re?"dimgray":"white"})]},pt)),Rt&&h.jsx(Gn,{name:"Parabolic Trough Outline 1",userData:{unintersectable:!0},points:[[-ve,-we,ze],[-ve,we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),Rt&&h.jsx(Gn,{name:"Parabolic Trough Outline 2",userData:{unintersectable:!0},points:[[ve,-we,ze],[ve,we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),h.jsx(ma,{name:"Parabolic Trough Absorber Tube",uuid:e,args:[c,c,a,Rt?6:2,1],position:[0,0,Ne],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ta,{name:"Parabolic Trough Simulation Plane",uuid:e,args:[i,a],position:[0,0,ze],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),O&&w&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ve,-we,ze],[-ve,we,ze],[ve,we,ze],[ve,-we,ze],[-ve,-we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),O&&!w&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:de,position:new ae(0,0,0),args:[vt,6,6],name:zo.Default,onPointerOver:At=>{Oe(At,zo.Top)},onPointerOut:()=>{st()},onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:he,position:[(Je.x+nt.x)/2,Je.y,Je.z-ze],args:[wt,wt,l*1.2],name:Mt.Lower,onPointerDown:At=>{D(e,At,Xo.Resize),me.current&&b(pt=>{const Wt=he.current.localToWorld(new ae(0,a,-Je.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Lower)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Lower||j===Mt.Lower?ga:$a})}),h.jsx(si,{ref:pe,position:[(Ue.x+We.x)/2,Ue.y,Ue.z-ze],args:[wt,wt,l*1.2],name:Mt.Upper,onPointerDown:At=>{D(e,At,Xo.Resize),me.current&&b(pt=>{const Wt=pe.current.localToWorld(new ae(0,-a,-Ue.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Upper)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Upper||j===Mt.Upper?ga:$a})}),h.jsx(si,{ref:me,position:[Je.x,(Je.y+Ue.y)/2,Je.z],args:[wt,wt,l*1.2],name:Mt.Left,onPointerDown:At=>{D(e,At,Xo.Resize),me.current&&b(pt=>{const Wt=me.current.localToWorld(new ae(i,0,-Je.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Left)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Left||j===Mt.Left?ga:$a})}),h.jsx(si,{ref:le,position:[nt.x,(nt.y+We.y)/2,nt.z],args:[wt,wt,l*1.2],name:Mt.Right,onPointerDown:At=>{D(e,At,Xo.Resize),me.current&&b(pt=>{const Wt=le.current.localToWorld(new ae(-i,0,-nt.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Right)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Right||j===Mt.Right?ga:$a})})]})]})]}),Ie>0&&Ze.map((At,pt)=>pt%5!==0&&!Rt?h.jsx(be.Fragment,{},pt):h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+pt,castShadow:!1,receiveShadow:!1,args:[A,A,Ie+(At.z-lt)*2+l,Gt,1],position:At,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:C})},pt)),y&&je.z>0&&h.jsx(Gn,{userData:{unintersectable:!0},points:[ut,new ae(-.3*ve,0,.09*ze).applyEuler(Ye),Qe,new ae(-.6*ve,0,.36*ze).applyEuler(Ye),ut,new ae(-.9*ve,0,.81*ze).applyEuler(Ye),Qe,new ae(0,0,0),ut,new ae(.3*ve,0,.09*ze).applyEuler(Ye),Qe,new ae(.6*ve,0,.36*ze).applyEuler(Ye),ut,new ae(.9*ve,0,.81*ze).applyEuler(Ye),Qe],name:"Sun Beams",lineWidth:.25,color:"white"}),(G||T)&&!O&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Ee,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(we*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),ftn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,structureType:c=sf.CentralPole,receiverRadius:u=.25,receiverPoleRadius:d=.1,latusRectum:f=2,tiltAngle:p,relativeAzimuth:g,poleHeight:A,poleRadius:y=.2,drawSunBeam:S,rotation:C=[0,0,0],color:P="white",lineColor:v="black",lineWidth:T=.25,showLabel:w=!1,locked:x=!1,parentId:b}=t,R=M(pn),H=M(Al),F=M(s0),E=M(Kn),N=dt(hs),U=M(Pf),W=Cn(c1),k=M(Cs),D=M(Jn),L=M(pu),j=M(ay),B=M(Ug),O=M(Lw),V=Tc(e),{gl:{domElement:G}}=ri(),[q,$]=m.useState(!1),[ie,Q]=m.useState(null),[se,Z]=m.useState(null),ee=m.useRef(null),te=m.useRef(null),oe=m.useRef(null),de=m.useRef(null),he=m.useRef(null),pe=m.useRef(null),me=m.useRef(null),le=m.useRef(!1),Te=Math.max(100,10*j),ge=32,Se=8,Re=O.z<=0;let De=n,Ae=o,ue=r;const fe=i/2,ve=a/2,we=l/2,Pe=A+fe,Ie=$t(),Me=M(pt=>{for(const Wt of pt.elements)if(Wt.id===b)return Wt});if(b&&Me)switch(Me.type){case z.Foundation:if(ue=Pe+we+Me.lz,ye.isZero(C[2]))De=Me.cx+n*Me.lx,Ae=Me.cy+o*Me.ly;else{const pt=new ae(n*Me.lx,o*Me.ly,0);pt.applyAxisAngle(ko,C[2]),De=Me.cx+pt.x,Ae=Me.cy+pt.y}break}const ze=fe*fe/f,Ne=.25*f,Je=new ae(-fe,-ve,we+ze),Ue=new ae(-fe,ve,we+ze),nt=new ae(fe,-ve,we+ze),We=new ae(fe,ve,we+ze),Ee=Hb(Jye),ke=u+1;m.useEffect(()=>{if(t&&N){const pt=W(t.id);pt&&Z(ye.fetchHeatmapTexture(pt,U??5))}},[N,U]),m.useEffect(()=>{const pt=()=>{kn.getState().setEnableOrbitController(!0),le.current=!1};return window.addEventListener("pointerup",pt),()=>{window.removeEventListener("pointerup",pt)}},[]);const Oe=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.ParabolicDishElement",Ie))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Ie)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",Ie)+": ("+De.toFixed(1)+", "+Ae.toFixed(1)+", "+ue.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Ie)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ie,De,Ae,ue]),st=m.useMemo(()=>new ln(0,0,C[2],"ZXY"),[C]),je=(pt,Wt)=>{pt.intersections.length>0&&pt.intersections[0].object===pt.eventObject&&(Q(Wt),Wt===zo.Top?G.style.cursor="move":Wt===Di.Lower||Wt===Di.Upper||Wt===Di.Tilt?G.style.cursor="grab":G.style.cursor="pointer")},xt=()=>{Q(null),G.style.cursor="default"},gt=m.useMemo(()=>ki(new Date(H),F),[H,F]),Ye=m.useMemo(()=>{var pt;return(pt=D(b))==null?void 0:pt.rotation[2]},[b]),it=Ye?gt.clone().applyAxisAngle(ko,-Ye):gt,ut=m.useMemo(()=>{if(gt.z>0){const pt=Math.hypot(it.x,it.y);return new ln(Math.atan2(pt,it.z),0,Math.atan2(it.y,it.x)+Qt,"ZXY")}return new ln(p,0,g,"ZXY")},[gt,p,g,it.x,it.y,it.z]),Qe=-(Pe+l)/2,lt=E.length<50,Ze=m.useMemo(()=>{const pt=[];if(lt){const Wt=[],ht=[];let ct,It,Ft;const Ve=.25*ze;for(let ft=0;ft<=ge;ft++)ct=sa*ft/ge,It=Math.cos(ct),Ft=Math.sin(ct),Wt.push(new ae(fe*It,fe*Ft,ze)),ht.push(new ae(fe*It/2,fe*Ft/2,Ve));pt.push({points:Wt}),pt.push({points:ht});for(let ft=0;ft<12;ft++){ct=sa*ft/12,It=Math.cos(ct),Ft=Math.sin(ct);const kt=[];for(let rt=0;rt<=Se;rt++){const at=rt===0?0:rt/Se*fe;kt.push(new ae(at*It,at*Ft,at*at/f+.01))}pt.push({points:kt})}}return pt},[fe,f,lt]),Be=m.useMemo(()=>{if(c===sf.CentralPoleWithTripod){const pt=[];let Wt;for(let ht=0;ht<3;ht++){Wt=sa*ht/3;const ct=[];ct.push(new ae(fe*Math.cos(Wt),fe*Math.sin(Wt),ze)),ct.push(new ae(0,0,Ne)),pt.push({points:ct})}return pt}},[fe,f,c]),$e=m.useMemo(()=>{if(c===sf.Quadrupod){const pt=[];let Wt;for(let ht=0;ht<4;ht++){Wt=sa*ht/4;const ct=[];ct.push(new ae(fe*Math.cos(Wt),fe*Math.sin(Wt),ze)),ct.push(new ae(0,0,Ne)),pt.push({points:ct})}return pt}},[fe,f,c]),wt=Math.max(1,(i+a)/16),vt=sR*wt*1.5,Rt=Wg*wt*3,Gt=gt.clone().multiplyScalar(Te),At=new ae(0,0,Ne).applyEuler(ut);return h.jsxs("group",{name:"Parabolic Dish Group "+e,rotation:st,position:[De,Ae,ue+we],children:[h.jsxs("group",{rotation:ut,children:[h.jsx(jTe,{receiveShadow:k,castShadow:k,uuid:e,ref:ee,args:[f/2,fe,ge,Se],name:"Parabolic Dish Front Side",onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Select)},onContextMenu:pt=>{L(e,pt,Xo.ContextMenu),R(Wt=>{pt.intersections.length>0&&pt.intersections[0].object===ee.current&&(Wt.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:pt=>{pt.intersections.length>0&&pt.intersections[0].object===ee.current&&($(!0),G.style.cursor="move")},onPointerOut:()=>{$(!1),G.style.cursor="default"},children:N&&se?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:se}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"})}),h.jsx(jTe,{receiveShadow:k,castShadow:k,uuid:e+" backside",ref:te,args:[f/2,fe,ge,Se],name:"Parabolic Dish Back Side",position:[0,0,-we/4],onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Select)},onContextMenu:pt=>{L(e,pt,Xo.ContextMenu),R(Wt=>{pt.intersections.length>0&&pt.intersections[0].object===te.current&&(Wt.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:pt=>{pt.intersections.length>0&&pt.intersections[0].object===te.current&&($(!0),G.style.cursor="move")},onPointerOut:()=>{$(!1),G.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:r0,color:P})}),Ze&&Ze.length>0&&Ze.map((pt,Wt)=>h.jsx(be.Fragment,{children:h.jsx(Gn,{name:"Parabolic Dish Wireframe",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:T,color:v})},Wt)),h.jsx(ma,{name:"Parabolic Dish Receiver",uuid:e,args:[u,u,.5,lt?12:4,1],rotation:[Qt,0,0],position:[0,0,Ne-.1],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),gt.z>0&&h.jsx("mesh",{position:[0,0,Ne-.1],children:h.jsx("sprite",{scale:[ke,ke,ke],children:h.jsx("spriteMaterial",{map:Ee,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})}),(c===sf.CentralPole||c===sf.CentralPoleWithTripod)&&h.jsx(ma,{name:"Parabolic Dish Receiver Pole",uuid:e,args:[d,d,Ne,lt?6:2,1],rotation:[Qt,0,0],position:[0,0,Ne/2],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),c===sf.CentralPoleWithTripod&&Be&&Be.map((pt,Wt)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Parabolic Dish Tripod Lines",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:1,color:Re?"dimgray":P}),h.jsx(Ps,{position:new ae(pt.points[0].x,pt.points[0].y,pt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Tripod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Wt)),c===sf.Quadrupod&&$e&&$e.map((pt,Wt)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Parabolic Dish Quadrupod Lines",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:2,color:Re?"dimgray":P}),h.jsx(Ps,{position:new ae(pt.points[0].x,pt.points[0].y,pt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Quadrupod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Wt)),h.jsx(uR,{name:"Parabolic Dish Simulation Circle",uuid:e,args:[i/2,ge],position:[0,0,ze],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),V&&x&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-fe,-ve,ze],[-fe,ve,ze],[fe,ve,ze],[fe,-ve,ze],[-fe,-ve,ze]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),V&&!x&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:oe,position:new ae(0,0,0),args:[Rt,6,6],name:zo.Default,onPointerOver:pt=>{je(pt,zo.Top)},onPointerOut:()=>{xt()},onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:de,position:[(Je.x+nt.x)/2,Je.y,Je.z],args:[vt,vt,l*1.2],name:Mt.Lower,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=de.current.localToWorld(new ae(0,a,-Je.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Lower)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Lower||B===Mt.Lower?ga:$a})}),h.jsx(si,{ref:he,position:[(Ue.x+We.x)/2,Ue.y,Ue.z],args:[vt,vt,l*1.2],name:Mt.Upper,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=he.current.localToWorld(new ae(0,-a,-Ue.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Upper)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Upper||B===Mt.Upper?ga:$a})}),h.jsx(si,{ref:pe,position:[Je.x,(Je.y+Ue.y)/2,Je.z],args:[vt,vt,l*1.2],name:Mt.Left,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=pe.current.localToWorld(new ae(i,0,-Je.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Left)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Left||B===Mt.Left?ga:$a})}),h.jsx(si,{ref:me,position:[nt.x,(nt.y+We.y)/2,nt.z],args:[vt,vt,l*1.2],name:Mt.Right,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=me.current.localToWorld(new ae(-i,0,-nt.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Right)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Right||B===Mt.Right?ga:$a})})]})]})]}),Pe>0&&h.jsx(ma,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[y,y,Pe+l,lt?4:2,1],position:[0,0,Qe],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),S&>.z>0&&h.jsx(Gn,{rotation:[-st.x,0,-st.z],userData:{unintersectable:!0},points:[At,new ae(-.3*fe,0,.09*ze).applyEuler(ut),Gt,new ae(-.6*fe,0,.36*ze).applyEuler(ut),At,new ae(-.9*fe,0,.81*ze).applyEuler(ut),Gt,At,new ae(.3*fe,0,.09*ze).applyEuler(ut),Gt,new ae(.6*fe,0,.36*ze).applyEuler(ut),At,new ae(.9*fe,0,.81*ze).applyEuler(ut),Gt],name:"Sun Beams",lineWidth:.25,color:"white"}),(q||w)&&!V&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Oe,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(ve*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),htn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,moduleLength:d,poleHeight:f,poleRadius:p=.1,drawSunBeam:g,rotation:A=[0,0,0],color:y="white",lineColor:S="black",lineWidth:C=.5,showLabel:P=!1,locked:v=!1,parentId:T,receiverId:w}=t,x=M(pn),b=M(m0),R=M(Al),H=M(s0),F=M(Kn),E=dt(hs),N=M(Pf),U=Cn(c1),W=M(Cs),k=M(Jn),D=M(pu),L=M(ay),j=M(Ug),B=Tc(e),{gl:{domElement:O}}=ri(),[V,G]=m.useState(!1),[q,$]=m.useState(null),[ie,Q]=m.useState(1),[se,Z]=m.useState(null),ee=m.useRef(null),te=m.useRef(null),oe=m.useRef(null),de=m.useRef(null),he=m.useRef(null),pe=m.useRef(null),me=m.useRef(!1),le=Math.max(100,10*L),Te=m.useMemo(()=>({lng:b}),[b]);let ge=n,Se=o,Re=r;const De=i/2,Ae=a/2,ue=l/2,fe=f+De,ve=M(Qe=>{for(const lt of Qe.elements)if(lt.id===T)return lt});if(ve)switch(ve.type){case z.Foundation:if(Re=fe+ue+ve.lz,ye.isZero(A[2]))ge=ve.cx+n*ve.lx,Se=ve.cy+o*ve.ly;else{const Qe=new ae(n*ve.lx,o*ve.ly,0);Qe.applyAxisAngle(ko,A[2]),ge=ve.cx+Qe.x,Se=ve.cy+Qe.y}break}const we=new ae(-De,-Ae,ue),Pe=new ae(-De,Ae,ue),Ie=new ae(De,-Ae,ue),Me=new ae(De,Ae,ue);m.useEffect(()=>{if(t&&E){const Qe=U(t.id);Qe&&Z(ye.fetchHeatmapTexture(Qe,N??5))}},[E,N]),m.useEffect(()=>{Q(Math.max(1,Math.round(a/d)))},[a,d]),m.useEffect(()=>{const Qe=()=>{kn.getState().setEnableOrbitController(!0),me.current=!1};return window.addEventListener("pointerup",Qe),()=>{window.removeEventListener("pointerup",Qe)}},[]);const ze=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.FresnelReflectorElement",Te))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Te)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",Te)+": ("+ge.toFixed(1)+", "+Se.toFixed(1)+", "+Re.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Te)),[t==null?void 0:t.label,t==null?void 0:t.locked,Te,ge,Se,Re]),Ne=m.useMemo(()=>new ln(0,0,A[2],"ZXY"),[A]),Je=(Qe,lt)=>{Qe.intersections.length>0&&Qe.intersections[0].object===Qe.eventObject&&($(lt),lt===zo.Top?O.style.cursor="move":lt===Di.Lower||lt===Di.Upper||lt===Di.Tilt?O.style.cursor="grab":O.style.cursor="pointer")},Ue=()=>{$(null),O.style.cursor="default"},nt=m.useMemo(()=>ki(new Date(R),H),[R,H]),We=ve==null?void 0:ve.rotation[2],Ee=w&&w!==T?k(w):null,ke=m.useMemo(()=>{if(Ee){if(Ee.type===z.Foundation){const Qe=Ee;if(Qe.solarStructure===Dn.FocusPipe&&Qe.solarAbsorberPipe)return new ae((Qe.cx-ge)*(We?Math.cos(We):1),(Qe.cy-Se)*(We?Math.sin(We):0),Qe.cz-Re+Qe.lz/2+(Qe.solarAbsorberPipe.absorberHeight??10))}}else if(ve&&ve.type===z.Foundation){const Qe=ve;if(Qe.solarStructure===Dn.FocusPipe&&Qe.solarAbsorberPipe)return new ae((Qe.cx-ge)*(We?Math.cos(We):1),(Qe.cy-Se)*(We?Math.sin(We):0),Qe.cz-Re+Qe.lz/2+(Qe.solarAbsorberPipe.absorberHeight??10))}return null},[Ee,ve,ge,Se,Re,We]),Oe=m.useRef(new ae),st=m.useMemo(()=>{if(ke&&nt.z>0){const Qe=We?new ae(Math.sin(We),Math.cos(We),0):new ae(0,1,0);Oe.current.set(ke.x,ke.y,ke.z);const lt=nt.z{const Qe=[],lt=Math.cos(u)*d,Ze=Math.sin(u)*d,Be=ie/2-.5;for(let $e=0;$e{const Qe=[],lt=a/ie;for(let Ze=0;Ze<=ie;Ze++){const Be=[];Be.push(new ae(-De,-Ae+Ze*lt,ue)),Be.push(new ae(De,-Ae+Ze*lt,ue)),Qe.push({points:Be})}return Qe},[i,a,ue,ie]),Ye=Math.max(1,Math.min(i*5,a*5,(i+a)/16)),it=sR*Ye*1.5,ut=Wg*Ye*2;return h.jsxs("group",{name:"Fresnel Reflector Group "+e,rotation:Ne,position:[ge,Se,Re+ue],children:[h.jsxs("group",{rotation:st,children:[h.jsxs(si,{receiveShadow:W,castShadow:W,uuid:e,ref:ee,args:[i,a,l],name:"Fresnel Reflector",onPointerDown:Qe=>{Qe.button!==2&&D(e,Qe,Xo.Select)},onContextMenu:Qe=>{D(e,Qe,Xo.ContextMenu),x(lt=>{Qe.intersections.length>0&&Qe.intersections[0].object===ee.current&&(lt.contextMenuObjectType=z.FresnelReflector)})},onPointerOver:Qe=>{Qe.intersections.length>0&&Qe.intersections[0].object===ee.current&&(G(!0),O.style.cursor="move")},onPointerOut:()=>{G(!1),O.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:y}),h.jsx("meshStandardMaterial",{attach:"material-1",color:y}),h.jsx("meshStandardMaterial",{attach:"material-2",color:y}),h.jsx("meshStandardMaterial",{attach:"material-3",color:y}),E&&se?h.jsx("meshBasicMaterial",{attach:"material-4",side:Da,map:se}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:y})]}),gt&>.map((Qe,lt)=>h.jsx(Gn,{name:"Fresnel Reflector Module Line",userData:{unintersectable:!0},points:Qe.points,castShadow:!1,receiveShadow:!1,lineWidth:C,color:S},lt)),h.jsx(Gn,{name:"Fresnel Reflector Outline 1",userData:{unintersectable:!0},points:[[-De,-Ae,ue],[-De,Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:S}),h.jsx(Gn,{name:"Fresnel Reflector Outline 2",userData:{unintersectable:!0},points:[[De,-Ae,ue],[De,Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:S}),h.jsx(ta,{name:"Fresnel Reflector Simulation Plane",uuid:e,args:[i,a],position:[0,0,ue],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),B&&v&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-De,-Ae,ue],[-De,Ae,ue],[De,Ae,ue],[De,-Ae,ue],[-De,-Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),B&&!v&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:te,position:new ae(0,0,0),args:[ut,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Qe=>{Je(Qe,zo.Top)},onPointerOut:()=>{Ue()},onPointerDown:Qe=>{Qe.button!==2&&D(e,Qe,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:oe,position:[(we.x+Ie.x)/2,we.y,we.z-ue],args:[it,it,l*1.2],name:Mt.Lower,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),he.current&&x(lt=>{const Ze=oe.current.localToWorld(new ae(0,a,-we.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Lower)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Lower||j===Mt.Lower?ga:$a})}),h.jsx(si,{ref:de,position:[(Pe.x+Me.x)/2,Pe.y,Pe.z-ue],args:[it,it,l*1.2],name:Mt.Upper,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),he.current&&x(lt=>{const Ze=de.current.localToWorld(new ae(0,-a,-Pe.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Upper)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Upper||j===Mt.Upper?ga:$a})}),h.jsx(si,{ref:he,position:[we.x,(we.y+Pe.y)/2,we.z],args:[it,it,l*1.2],name:Mt.Left,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),he.current&&x(lt=>{const Ze=he.current.localToWorld(new ae(i,0,-we.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Left)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Left||j===Mt.Left?ga:$a})}),h.jsx(si,{ref:pe,position:[Ie.x,(Ie.y+Me.y)/2,Ie.z],args:[it,it,l*1.2],name:Mt.Right,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),he.current&&x(lt=>{const Ze=pe.current.localToWorld(new ae(-i,0,-Ie.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Right)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Right||j===Mt.Right?ga:$a})})]})]})]}),fe>0&&xt.map((Qe,lt)=>{const Ze=F.length<100?4:2;return h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+lt,castShadow:!1,receiveShadow:!1,args:[p,p,fe+(Qe.z-je)*2+l,Ze,1],position:Qe,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:y})},lt)}),g&&nt.z>0&&h.jsx(Gn,{rotation:[-Ne.x,0,-Ne.z],userData:{unintersectable:!0},points:ke?[Oe.current,new ae(0,0,ue),nt.clone().multiplyScalar(le)]:[new ae(0,0,ue),nt.clone().multiplyScalar(le)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(V||P)&&!B&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:ze,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Ae*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),ptn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,poleHeight:d,poleRadius:f=Math.min(i,a)/20,drawSunBeam:p,rotation:g=[0,0,0],color:A="white",lineColor:y="black",lineWidth:S=.5,showLabel:C=!1,locked:P=!1,parentId:v,towerId:T}=t,w=M(pn),x=M(Al),b=M(s0),R=M(Kn),H=dt(hs),F=M(Pf),E=Cn(c1),N=M(Cs),U=M(Jn),W=M(pu),k=M(ay),D=Tc(e),{gl:{domElement:L}}=ri(),[j,B]=m.useState(!1),[O,V]=m.useState(null),G=m.useRef(null),q=m.useRef(null),$=m.useRef(!1),ie=Math.max(100,10*k),Q=$t();let se=n,Z=o,ee=r;const te=i/2,oe=a/2,de=l/2,he=d+Math.max(te,oe),pe=M(Pe=>{for(const Ie of Pe.elements)if(Ie.id===v)return Ie});if(pe)switch(pe.type){case z.Foundation:if(ee=he+de+pe.lz,ye.isZero(g[2]))se=pe.cx+n*pe.lx,Z=pe.cy+o*pe.ly;else{const Pe=new ae(n*pe.lx,o*pe.ly,0);Pe.applyAxisAngle(ko,g[2]),se=pe.cx+Pe.x,Z=pe.cy+Pe.y}break}m.useEffect(()=>{if(t&&H){const Pe=E(t.id);Pe&&V(ye.fetchHeatmapTexture(Pe,F??5))}},[H,F]),m.useEffect(()=>{const Pe=()=>{kn.getState().setEnableOrbitController(!0),$.current=!1};return window.addEventListener("pointerup",Pe),()=>{window.removeEventListener("pointerup",Pe)}},[]);const me=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.HeliostatElement",Q))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Q)+")":"")+(t!=null&&t.label?"":` -`+Y.t("word.Coordinates",Q)+": ("+se.toFixed(1)+", "+Z.toFixed(1)+", "+ee.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Q)),[t==null?void 0:t.label,t==null?void 0:t.locked,Q,se,Z,ee]),le=m.useMemo(()=>new ln(0,0,g[2],"ZXY"),[g]),Te=(Pe,Ie)=>{Pe.intersections.length>0&&Pe.intersections[0].object===Pe.eventObject&&(L.style.cursor=Ie===zo.Default?"move":"pointer")},ge=()=>{L.style.cursor="default"},Se=m.useMemo(()=>ki(new Date(x),b),[x,b]),Re=pe==null?void 0:pe.rotation[2],De=T&&T!==v?U(T):null,Ae=m.useMemo(()=>{if(De){if(De.type===z.Foundation){const Pe=De;if(Pe.solarStructure===Dn.FocusTower&&Pe.solarPowerTower)return new ae(Pe.cx-se,Pe.cy-Z,Pe.cz-ee+Pe.lz/2+(Pe.solarPowerTower.towerHeight??20))}}else if(pe&&pe.type===z.Foundation){const Pe=pe;if(Pe.solarStructure===Dn.FocusTower&&Pe.solarPowerTower)return new ae(Pe.cx-se,Pe.cy-Z,Pe.cz-ee+Pe.lz/2+(Pe.solarPowerTower.towerHeight??20))}return null},[pe,se,Z,ee,De]),ue=m.useMemo(()=>{if(Ae&&Se.z>0){let Ie=Ae.clone().normalize().add(Se).normalize();ye.isSame(Ie,ko)&&(Ie=new ae(-.001,0,1).normalize()),Re&&Ie.applyAxisAngle(ko,-Re);const Me=Math.hypot(Ie.x,Ie.y);return new ln(Math.atan2(Me,Ie.z),0,Math.atan2(Ie.y,Ie.x)+Qt,"ZXY")}return new ln(c,0,u,"ZXY")},[Ae,Se,c,u,Re]),fe=-(he+l)/2,ve=Math.max(1,(i+a)/8),we=Wg*ve*4;return h.jsxs("group",{name:"Heliostat Group "+e,rotation:le,position:[se,Z,ee+de],children:[h.jsxs("group",{rotation:ue,children:[h.jsxs(si,{receiveShadow:N,castShadow:N,uuid:e,ref:G,args:[i,a,l],name:"Heliostat",onPointerDown:Pe=>{Pe.button!==2&&W(e,Pe,Xo.Select)},onContextMenu:Pe=>{W(e,Pe,Xo.ContextMenu),w(Ie=>{Pe.intersections.length>0&&Pe.intersections[0].object===G.current&&(Ie.contextMenuObjectType=z.Heliostat)})},onPointerOver:Pe=>{Pe.intersections.length>0&&Pe.intersections[0].object===G.current&&(B(!0),L.style.cursor="move")},onPointerOut:()=>{B(!1),L.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:A}),h.jsx("meshStandardMaterial",{attach:"material-1",color:A}),h.jsx("meshStandardMaterial",{attach:"material-2",color:A}),h.jsx("meshStandardMaterial",{attach:"material-3",color:A}),H&&O?h.jsx("meshBasicMaterial",{attach:"material-4",side:Da,map:O}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:A})]}),h.jsx(ta,{name:"Heliostat Simulation Plane",uuid:e,args:[i,a],position:[0,0,de],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),D&&P&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-te,-oe,de],[-te,oe,de],[te,oe,de],[te,-oe,de],[-te,-oe,de]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),D&&!P&&h.jsx(Ps,{ref:q,position:new ae(0,0,0),args:[we,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Pe=>{Te(Pe,zo.Default)},onPointerOut:()=>{ge()},onPointerDown:Pe=>{Pe.button!==2&&W(e,Pe,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})})]}),he>0&&h.jsx(ma,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[f,f,he+l,R.length<100?4:2,1],position:new ae(0,0,fe),rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:A})}),p&&Se.z>0&&h.jsx(Gn,{rotation:[-le.x,0,-le.z],userData:{unintersectable:!0},points:Ae?[Ae,new ae(0,0,de),Se.clone().multiplyScalar(ie)]:[new ae(0,0,de),Se.clone().multiplyScalar(ie)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(j||C)&&!D&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:me,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(oe*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),gtn=be.memo(t=>{var Z;const{parentId:e,id:n,cx:o,cy:r,cz:i,name:a=ro.WhiteFlower,flip:l=!1,locked:s=!1}=t;let c=!1;M(ee=>{if(e===Zo)c=!0;else for(const te of ee.elements)if(te.id===e){c=!0;break}});const u=M(Ap);m.useEffect(()=>{c||u(n,!1)},[c]);const d=M(pn),f=M(m0),p=M(Ju)??!1,g=M(Al),A=M(s0),y=M(Pge)??Nq,S=M(Cge)??Uq,C=M(pu),P=M(Ub),v=M(ly),T=dt(hs),[w,x]=m.useState(!1),{gl:b}=ri(),R=Tc(n),H=kn(ee=>ee.contentRef),F=m.useRef(null),E=m.useRef(null),N=m.useRef(null),U=m.useRef(null),W=m.useMemo(()=>({lng:f}),[f]),k=m.useMemo(()=>{const ee=ye.dayOfYear(new Date(g));return A>0?eeS:ee>=y&&ee<=S},[g,y,S,A]),D=m.useRef(!1),L=M(FH);L!==D.current&&(D.current=L,H!=null&&H.current&&F.current&&H.current.add(F.current)),m.useEffect(()=>{if(e!==Zo){const ee=$();ee&&F.current&&ee.add(F.current)}},[L,e]),m.useEffect(()=>{const ee=$();ee&&F.current&&ee.add(F.current)},[H]);const j=m.useMemo(()=>new cf().load(A8.fetchTextureImage(a,k),ee=>{l&&(ee.wrapS=bs,ee.repeat.x=-1),O(ee)}),[a,k,l]),[B,O]=m.useState(j),V=m.useMemo(()=>A8.fetchLabel(a,W)+(s?" ("+Y.t("shared.ElementLocked",W)+")":"")+` -`+Y.t("word.Coordinates",W)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+Y.t("word.MeterAbbreviation",W),[a,o,r,s,W]),G=m.useCallback((ee,te)=>{dt.getState().duringCameraInteraction||ee.intersections.length>0&&(ee.intersections[0].object===ee.eventObject||ee.intersections.length>1&&ee.intersections[1].object===ee.eventObject)&&(d(de=>{de.hoveredHandle=te,de.selectedElementHeight=t.lz}),ye.isMoveHandle(te)?b.domElement.style.cursor="move":b.domElement.style.cursor="pointer")},[t.lz]),q=m.useCallback(()=>{d(ee=>{ee.hoveredHandle=null}),b.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),$=()=>e!==Zo&&(H!=null&&H.current)?ye.getObjectChildById(H.current,e):null,ie=m.useMemo(()=>A8.fetchSpread(a),[a]),Q=m.useMemo(()=>A8.fetchHeight(a),[a]);Z2(({camera:ee})=>{if(F.current){const{rot:te}=ye.getWorldDataById(e);if(p)E.current&&U.current&&(E.current.rotation.set(Qt,0,0),U.current.rotation.set(0,0,0)),F.current.rotation.set(-Qt,0,0);else{if(E.current&&U.current){const{x:oe,y:de}=ee.position,{x:he,y:pe}=F.current.position;if($()){const le=F.current.localToWorld(new ae),Te=Math.atan2(oe-le.x,de-le.y)+te;E.current.rotation.set(Qt,-Te,0),U.current.rotation.set(-Qt,Te,0)}else{const le=Math.atan2(oe-he,de-pe);E.current.rotation.set(Qt,-le,0),U.current.rotation.set(-Qt,le,0)}}F.current.rotation.set(0,0,0)}}});const se=Wg*3;return h.jsx(h.Fragment,{children:c?h.jsx("group",{ref:F,name:"Flower Group "+n,userData:{aabb:!0},position:[o,r,(i??0)+(p?.25:0)],children:h.jsxs("group",{position:[0,0,Q/2],children:[h.jsx(RC,{ref:E,uuid:n,name:a,follow:!1,rotation:[Qt,0,0],children:h.jsx(ta,{args:[ie,Q],receiveShadow:!T,children:h.jsx("meshToonMaterial",{map:B,side:ti,alphaTest:.5})})}),h.jsx(RC,{ref:U,name:"Interaction Billboard",visible:!1,position:[0,0,-Q/2],children:h.jsx(ta,{ref:N,renderOrder:3,name:a+" plane",args:[ie/2,Q*2],rotation:[p?Qt:0,0,0],onContextMenu:ee=>{C(n,ee,Xo.ContextMenu),d(te=>{ee.intersections.length>0&&ee.intersections[0].object===N.current&&(te.contextMenuObjectType=z.Flower)})},onPointerDown:ee=>{ee.button!==2&&ee.eventObject===ee.intersections[0].eventObject&&(C(n,ee,Xo.Move),kn.setState({flowerRef:F}))},onPointerOver:ee=>{ee.intersections.length>0&&ee.intersections[0].object===N.current&&x(!0)},onPointerOut:()=>{x(!1)}})}),R&&s&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ie/2,-Q/2,0],[-ie/2,Q/2,0],[-ie/2,Q/2,0],[ie/2,Q/2,0],[ie/2,-Q/2,0],[ie/2,Q/2,0],[ie/2,-Q/2,0],[-ie/2,-Q/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(Z=E.current)==null?void 0:Z.rotation,color:B0}),R&&!s&&h.jsx(h.Fragment,{children:h.jsx(Ps,{position:new ae(0,0,-Q/2),args:[se,6,6,0,Math.PI],name:zo.Default,renderOrder:2,onPointerDown:ee=>{ee.button!==2&&ee.eventObject===ee.intersections[0].eventObject&&(C(n,ee,Xo.Move),kn.setState({flowerRef:F}))},onPointerEnter:ee=>{G(ee,zo.Default)},onPointerLeave:q,children:h.jsx("meshBasicMaterial",{attach:"material",color:v===zo.Default||P===zo.Default?ga:iw})})}),w&&!R&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:V,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,Q/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});var wde=function(t,e){return wde=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},wde(t,e)};function Pr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");wde(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var N0=function(){return N0=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ip(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var o=n.call(t),r,i=[],a;try{for(;(e===void 0||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(l){a={error:l}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function yl(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o0?bd(nM,--ty):0,HR--,au===10&&(HR=1,WQ--),au}function L2(){return au=ty2||xde(au)>3?"":" "}function Ptn(t,e){for(;--e&&L2()&&!(au<48||au>102||au>57&&au<65||au>70&&au<97););return UQ(t,l_()+(e<6&&Cx()==32&&L2()==32))}function bde(t){for(;L2();)switch(au){case t:return ty;case 34:case 39:t!==34&&t!==39&&bde(au);break;case 40:t===41&&bde(t);break;case 92:L2();break}return ty}function Ctn(t,e){for(;L2()&&t+au!==57;)if(t+au===84&&Cx()===47)break;return"/*"+UQ(e,ty-1)+"*"+t2e(t===47?t:L2())}function Rtn(t){for(;!xde(Cx());)L2();return UQ(t,ty)}function Htn(t){return Stn(s_("",null,null,null,[""],t=btn(t),0,[0],t))}function s_(t,e,n,o,r,i,a,l,s){for(var c=0,u=0,d=a,f=0,p=0,g=0,A=1,y=1,S=1,C=0,P="",v=r,T=i,w=o,x=P;y;)switch(g=C,C=L2()){case 40:if(g!=108&&bd(x,d-1)==58){a_(x+=Ra(rae(C),"&","&\f"),"&\f",hQe(c?l[c-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:x+=rae(C);break;case 9:case 10:case 13:case 32:x+=Ttn(g);break;case 92:x+=Ptn(l_()-1,7);continue;case 47:switch(Cx()){case 42:case 47:OD(Mtn(Ctn(L2(),l_()),e,n,s),s);break;default:x+="/"}break;case 123*A:l[c++]=c9(x)*S;case 125*A:case 59:case 0:switch(C){case 0:case 125:y=0;case 59+u:S==-1&&(x=Ra(x,/\f/g,"")),p>0&&c9(x)-d&&OD(p>32?OTe(x+";",o,n,d-1,s):OTe(Ra(x," ","")+";",o,n,d-2,s),s);break;case 59:x+=";";default:if(OD(w=YTe(x,e,n,c,u,r,l,P,v=[],T=[],d,i),i),C===123)if(u===0)s_(x,e,w,w,v,i,d,l,T);else switch(f===99&&bd(x,3)===110?100:f){case 100:case 108:case 109:case 115:s_(t,w,w,o&&OD(YTe(t,w,w,0,0,r,l,P,r,v=[],d,T),T),r,T,d,l,o?v:T);break;default:s_(x,w,w,w,[""],T,0,l,T)}}c=u=p=0,A=S=1,P=x="",d=a;break;case 58:d=1+c9(x),p=g;default:if(A<1){if(C==123)--A;else if(C==125&&A++==0&&xtn()==125)continue}switch(x+=t2e(C),C*A){case 38:S=u>0?1:(x+="\f",-1);break;case 44:l[c++]=(c9(x)-1)*S,S=1;break;case 64:Cx()===45&&(x+=rae(L2())),f=Cx(),u=d=c9(P=x+=Rtn(l_())),C++;break;case 45:g===45&&c9(x)==2&&(A=0)}}return i}function YTe(t,e,n,o,r,i,a,l,s,c,u,d){for(var f=r-1,p=r===0?i:[""],g=gQe(p),A=0,y=0,S=0;A0?p[C]+" "+P:Ra(P,/&\f/g,p[C])))&&(s[S++]=v);return NQ(t,e,n,r===0?LQ:l,s,c,u,d)}function Mtn(t,e,n,o){return NQ(t,e,n,dQe,t2e(vtn()),RR(t,2,-2),0,o)}function OTe(t,e,n,o,r){return NQ(t,e,n,e2e,RR(t,0,o),RR(t,o+1,-1),o,r)}function yQe(t,e,n){switch(Atn(t,e)){case 5103:return es+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return es+t+t;case 4789:return kE+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return es+t+kE+t+lc+t+t;case 5936:switch(bd(t,e+11)){case 114:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return es+t+lc+t+t;case 6165:return es+t+lc+"flex-"+t+t;case 5187:return es+t+Ra(t,/(\w+).+(:[^]+)/,es+"box-$1$2"+lc+"flex-$1$2")+t;case 5443:return es+t+lc+"flex-item-"+Ra(t,/flex-|-self/g,"")+(g6(t,/flex-|baseline/)?"":lc+"grid-row-"+Ra(t,/flex-|-self/g,""))+t;case 4675:return es+t+lc+"flex-line-pack"+Ra(t,/align-content|flex-|-self/g,"")+t;case 5548:return es+t+lc+Ra(t,"shrink","negative")+t;case 5292:return es+t+lc+Ra(t,"basis","preferred-size")+t;case 6060:return es+"box-"+Ra(t,"-grow","")+es+t+lc+Ra(t,"grow","positive")+t;case 4554:return es+Ra(t,/([^-])(transform)/g,"$1"+es+"$2")+t;case 6187:return Ra(Ra(Ra(t,/(zoom-|grab)/,es+"$1"),/(image-set)/,es+"$1"),t,"")+t;case 5495:case 3959:return Ra(t,/(image-set\([^]*)/,es+"$1$`$1");case 4968:return Ra(Ra(t,/(.+:)(flex-)?(.*)/,es+"box-pack:$3"+lc+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+es+t+t;case 4200:if(!g6(t,/flex-|baseline/))return lc+"grid-column-align"+RR(t,e)+t;break;case 2592:case 3360:return lc+Ra(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(o,r){return e=r,g6(o.props,/grid-\w+-end/)})?~a_(t+(n=n[e].value),"span",0)?t:lc+Ra(t,"-start","")+t+lc+"grid-row-span:"+(~a_(n,"span",0)?g6(n,/\d+/):+g6(n,/\d+/)-+g6(t,/\d+/))+";":lc+Ra(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(o){return g6(o.props,/grid-\w+-start/)})?t:lc+Ra(Ra(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return Ra(t,/(.+)-inline(.+)/,es+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(c9(t)-1-e>6)switch(bd(t,e+1)){case 109:if(bd(t,e+4)!==45)break;case 102:return Ra(t,/(.+:)(.+)-([^]+)/,"$1"+es+"$2-$3$1"+kE+(bd(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~a_(t,"stretch",0)?yQe(Ra(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return Ra(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,r,i,a,l,s,c){return lc+r+":"+i+c+(a?lc+r+"-span:"+(l?s:+s-+i)+c:"")+t});case 4949:if(bd(t,e+6)===121)return Ra(t,":",":"+es)+t;break;case 6444:switch(bd(t,bd(t,14)===45?18:11)){case 120:return Ra(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+es+(bd(t,14)===45?"inline-":"")+"box$3$1"+es+"$2$3$1"+lc+"$2box$3")+t;case 100:return Ra(t,":",":"+lc)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Ra(t,"scroll-","scroll-snap-")+t}return t}function yX(t,e){for(var n="",o=0;o-1&&!t.return)switch(t.type){case e2e:t.return=yQe(t.value,t.length,n);return;case fQe:return yX([B4(t,{value:Ra(t.value,"@","@"+es)})],o);case LQ:if(t.length)return wtn(n=t.props,function(r){switch(g6(r,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":JT(B4(t,{props:[Ra(r,/:(read-\w+)/,":"+kE+"$1")]})),JT(B4(t,{props:[r]})),vde(t,{props:BTe(n,o)});break;case"::placeholder":JT(B4(t,{props:[Ra(r,/:(plac\w+)/,":"+es+"input-$1")]})),JT(B4(t,{props:[Ra(r,/:(plac\w+)/,":"+kE+"$1")]})),JT(B4(t,{props:[Ra(r,/:(plac\w+)/,lc+"input-$1")]})),JT(B4(t,{props:[r]})),vde(t,{props:BTe(n,o)});break}return""})}}var Ftn={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},q1={},MR=typeof process<"u"&&q1!==void 0&&(q1.REACT_APP_SC_ATTR||q1.SC_ATTR)||"data-styled",AQe="active",wQe="data-styled-version",jQ="6.1.10",n2e=`/*!sc*/ -`,o2e=typeof window<"u"&&"HTMLElement"in window,ktn=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&q1!==void 0&&q1.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&q1.REACT_APP_SC_DISABLE_SPEEDY!==""?q1.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&q1.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&q1!==void 0&&q1.SC_DISABLE_SPEEDY!==void 0&&q1.SC_DISABLE_SPEEDY!==""&&q1.SC_DISABLE_SPEEDY!=="false"&&q1.SC_DISABLE_SPEEDY),BQ=Object.freeze([]),IR=Object.freeze({});function Ltn(t,e,n){return n===void 0&&(n=IR),t.theme!==n.theme&&t.theme||e||n.theme}var vQe=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Wtn=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Ntn=/(^-|-$)/g;function VTe(t){return t.replace(Wtn,"-").replace(Ntn,"")}var Utn=/(a)(d)/gi,vO=52,_Te=function(t){return String.fromCharCode(t+(t>25?39:97))};function Sde(t){var e,n="";for(e=Math.abs(t);e>vO;e=e/vO|0)n=_Te(e%vO)+n;return(_Te(e%vO)+n).replace(Utn,"$1-$2")}var iae,xQe=5381,lC=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},bQe=function(t){return lC(xQe,t)};function jtn(t){return Sde(bQe(t)>>>0)}function Btn(t){return t.displayName||t.name||"Component"}function aae(t){return typeof t=="string"&&!0}var SQe=typeof Symbol=="function"&&Symbol.for,TQe=SQe?Symbol.for("react.memo"):60115,Ytn=SQe?Symbol.for("react.forward_ref"):60112,Otn={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Vtn={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},PQe={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},_tn=((iae={})[Ytn]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},iae[TQe]=PQe,iae);function GTe(t){return("type"in(e=t)&&e.type.$$typeof)===TQe?PQe:"$$typeof"in t?_tn[t.$$typeof]:Otn;var e}var Gtn=Object.defineProperty,Xtn=Object.getOwnPropertyNames,XTe=Object.getOwnPropertySymbols,Jtn=Object.getOwnPropertyDescriptor,Ktn=Object.getPrototypeOf,JTe=Object.prototype;function CQe(t,e,n){if(typeof e!="string"){if(JTe){var o=Ktn(e);o&&o!==JTe&&CQe(t,o,n)}var r=Xtn(e);XTe&&(r=r.concat(XTe(e)));for(var i=GTe(t),a=GTe(e),l=0;l0?" Args: ".concat(e.join(", ")):""))}var qtn=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,r=o.length,i=r;e>=i;)if((i<<=1)<0)throw AN(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(o),this.length=i;for(var a=r;a=this.length||this.groupSizes[e]===0)return n;for(var o=this.groupSizes[e],r=this.indexOfGroup(e),i=r+o,a=r;a=0){var o=document.createTextNode(n);return this.element.insertBefore(o,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e0&&(y+="".concat(S,","))}),s+="".concat(g).concat(A,'{content:"').concat(y,'"}').concat(n2e)},u=0;u0?".".concat(e):f},u=s.slice();u.push(function(f){f.type===LQ&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(lnn,n).replace(o,c))}),a.prefix&&u.push(Etn),u.push(Itn);var d=function(f,p,g,A){p===void 0&&(p=""),g===void 0&&(g=""),A===void 0&&(A="&"),e=A,n=p,o=new RegExp("\\".concat(n,"\\b"),"g");var y=f.replace(snn,""),S=Htn(g||p?"".concat(g," ").concat(p," { ").concat(y," }"):y);a.namespace&&(S=MQe(S,a.namespace));var C=[];return yX(S,ztn(u.concat(Dtn(function(P){return C.push(P)})))),C};return d.hash=s.length?s.reduce(function(f,p){return p.name||AN(15),lC(f,p.name)},xQe).toString():"",d}var unn=new HQe,Pde=cnn(),IQe=be.createContext({shouldForwardProp:void 0,styleSheet:unn,stylis:Pde});IQe.Consumer;be.createContext(void 0);function $Te(){return m.useContext(IQe)}var dnn=function(){function t(e,n){var o=this;this.inject=function(r,i){i===void 0&&(i=Pde);var a=o.name+i.hash;r.hasNameForId(o.id,a)||r.insertRules(o.id,a,i(o.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,i2e(this,function(){throw AN(12,String(o.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=Pde),this.name+e.hash},t}(),fnn=function(t){return t>="A"&&t<="Z"};function QTe(t){for(var e="",n=0;n>>0);if(!n.hasNameForId(this.componentId,a)){var l=o(i,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,l)}r=Kv(r,a),this.staticRulesId=a}else{for(var s=lC(this.baseHash,o.hash),c="",u=0;u>>0);n.hasNameForId(this.componentId,p)||n.insertRules(this.componentId,p,o(c,".".concat(p),void 0,this.componentId)),r=Kv(r,p)}}return r},t}(),EQe=be.createContext(void 0);EQe.Consumer;var lae={};function mnn(t,e,n){var o=r2e(t),r=t,i=!aae(t),a=e.attrs,l=a===void 0?BQ:a,s=e.componentId,c=s===void 0?function(v,T){var w=typeof v!="string"?"sc":VTe(v);lae[w]=(lae[w]||0)+1;var x="".concat(w,"-").concat(jtn(jQ+w+lae[w]));return T?"".concat(T,"-").concat(x):x}(e.displayName,e.parentComponentId):s,u=e.displayName,d=u===void 0?function(v){return aae(v)?"styled.".concat(v):"Styled(".concat(Btn(v),")")}(t):u,f=e.displayName&&e.componentId?"".concat(VTe(e.displayName),"-").concat(e.componentId):e.componentId||c,p=o&&r.attrs?r.attrs.concat(l).filter(Boolean):l,g=e.shouldForwardProp;if(o&&r.shouldForwardProp){var A=r.shouldForwardProp;if(e.shouldForwardProp){var y=e.shouldForwardProp;g=function(v,T){return A(v,T)&&y(v,T)}}else g=A}var S=new gnn(n,f,o?r.componentStyle:void 0);function C(v,T){return function(w,x,b){var R=w.attrs,H=w.componentStyle,F=w.defaultProps,E=w.foldedComponentIds,N=w.styledComponentId,U=w.target,W=be.useContext(EQe),k=$Te(),D=w.shouldForwardProp||k.shouldForwardProp,L=Ltn(x,W,F)||IR,j=function($,ie,Q){for(var se,Z=N0(N0({},ie),{className:void 0,theme:Q}),ee=0;ee<$.length;ee+=1){var te=zR(se=$[ee])?se(Z):se;for(var oe in te)Z[oe]=oe==="className"?Kv(Z[oe],te[oe]):oe==="style"?N0(N0({},Z[oe]),te[oe]):te[oe]}return ie.className&&(Z.className=Kv(Z.className,ie.className)),Z}(R,x,L),B=j.as||U,O={};for(var V in j)j[V]===void 0||V[0]==="$"||V==="as"||V==="theme"&&j.theme===L||(V==="forwardedAs"?O.as=j.forwardedAs:D&&!D(V,B)||(O[V]=j[V]));var G=function($,ie){var Q=$Te(),se=$.generateAndInjectStyles(ie,Q.styleSheet,Q.stylis);return se}(H,j),q=Kv(E,N);return G&&(q+=" "+G),j.className&&(q+=" "+j.className),O[aae(B)&&!vQe.has(B)?"class":"className"]=q,O.ref=b,m.createElement(B,O)}(P,v,T)}C.displayName=d;var P=be.forwardRef(C);return P.attrs=p,P.componentStyle=S,P.displayName=d,P.shouldForwardProp=g,P.foldedComponentIds=o?Kv(r.foldedComponentIds,r.styledComponentId):"",P.styledComponentId=f,P.target=o?r.target:t,Object.defineProperty(P,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(v){this._foldedDefaultProps=o?function(T){for(var w=[],x=1;x=Xt)return X;var xn=He-Gc(et);if(xn<1)return et;var zn=hn?R1(hn,0,xn).join(""):X.slice(0,xn);if(Dt===n)return zn+et;if(hn&&(xn+=zn.length-xn),JS(Dt)){if(X.slice(xn).search(Dt)){var xo,To=zn;for(Dt.global||(Dt=Xc(Dt.source,il(Ft.exec(Dt))+"g")),Dt.lastIndex=0;xo=Dt.exec(To);)var Do=xo.index;zn=zn.slice(0,Do===n?xn:Do)}}else if(X.indexOf(x0(Dt),xn)!=xn){var Tr=zn.lastIndexOf(Dt);Tr>-1&&(zn=zn.slice(0,Tr))}return zn+et}function oz(X){return X=il(X),X&>.test(X)?X.replace(je,by):X}var c0=J(function(X,ne,He){return X+(He?" ":"")+ne.toUpperCase()}),Y5=G3("toUpperCase");function M1(X,ne,He){return X=il(X),ne=He?n:ne,ne===n?P3(X)?Sy(X):ed(X):X.match(ne)||[]}var Vj=$r(function(X,ne){try{return Ln(X,n,ne)}catch(He){return I7(He)?He:new ui(He)}}),Bne=ra(function(X,ne){return Wn(ne,function(He){He=lm(He),kh(X,He,H7(X[He],X))}),X});function Yne(X){var ne=X==null?0:X.length,He=gi();return X=ne?Or(X,function(et){if(typeof et[1]!="function")throw new _0(a);return[He(et[0]),et[1]]}):[],$r(function(et){for(var Dt=-1;++DtL)return[];var He=O,et=G0(X,O);ne=gi(ne),X-=O;for(var Dt=Ih(et,ne);++He0||ne<0)?new di(He):(X<0?He=He.takeRight(-X):X&&(He=He.drop(X)),ne!==n&&(ne=Ji(ne),He=ne<0?He.dropRight(-ne):He.take(ne-X)),He)},di.prototype.takeRightWhile=function(X){return this.reverse().takeWhile(X).reverse()},di.prototype.toArray=function(){return this.take(O)},bu(di.prototype,function(X,ne){var He=/^(?:filter|find|map|reject)|While$/.test(ne),et=/^(?:head|last)$/.test(ne),Dt=Ut[et?"take"+(ne=="last"?"Right":""):ne],Xt=et||/^find/.test(ne);Dt&&(Ut.prototype[ne]=function(){var hn=this.__wrapped__,xn=et?[1]:arguments,zn=hn instanceof di,xo=xn[0],To=zn||ea(hn),Do=function(Ya){var al=Dt.apply(Ut,ya([Ya],xn));return et&&Tr?al[0]:al};To&&He&&typeof xo=="function"&&xo.length!=1&&(zn=To=!1);var Tr=this.__chain__,Qr=!!this.__actions__.length,Ii=Xt&&!Tr,Ca=zn&&!Qr;if(!Xt&&To){hn=Ca?hn:new di(this);var zi=X.apply(hn,xn);return zi.__actions__.push({func:By,args:[Do],thisArg:n}),new X0(zi,Tr)}return Ii&&Ca?X.apply(this,xn):(zi=this.thru(Do),Ii?et?zi.value()[0]:zi.value():zi)})}),Wn(["pop","push","shift","sort","splice","unshift"],function(X){var ne=_g[X],He=/^(?:push|sort|unshift)$/.test(X)?"tap":"thru",et=/^(?:pop|shift)$/.test(X);Ut.prototype[X]=function(){var Dt=arguments;if(et&&!this.__chain__){var Xt=this.value();return ne.apply(ea(Xt)?Xt:[],Dt)}return this[He](function(hn){return ne.apply(ea(hn)?hn:[],Dt)})}}),bu(di.prototype,function(X,ne){var He=Ut[ne];if(He){var et=He.name+"";ja.call(A1,et)||(A1[et]=[]),A1[et].push({name:ne,func:He})}}),A1[mt(n,S).name]=[{name:"wrapper",func:n}],di.prototype.clone=vS,di.prototype.reverse=xS,di.prototype.value=Yd,Ut.prototype.at=ine,Ut.prototype.chain=fI,Ut.prototype.commit=ane,Ut.prototype.next=hI,Ut.prototype.plant=sne,Ut.prototype.reverse=cne,Ut.prototype.toJSON=Ut.prototype.valueOf=Ut.prototype.value=NS,Ut.prototype.first=Ut.prototype.head,Bd&&(Ut.prototype[Bd]=lne),Ut},Sp=wS();qe?((qe.exports=Sp)._=Sp,Hn._=Sp):mn._=Sp}).call(yc)})(fX,fX.exports);var k2=fX.exports;const dZt=t=>{const{lx:e,lz:n,parentId:o,id:r,roofId:i}=t,a=M(hxt),l=M($ge);m.useEffect(()=>{i&&(a===i||l.has(i))&&M.getState().set(d=>{for(const f of d.elements)if(f.id===r&&f.type===z.Wall){const p=f;p.roofId=null,p.leftRoofHeight=void 0,p.rightRoofHeight=void 0,p.centerRoofHeight=void 0,p.centerLeftRoofHeight=void 0,p.centerRightRoofHeight=void 0;break}})},[i,a,l]);const s=d=>!(d.button===2||M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().objectTypeToAdd!==z.None||M.getState().isAddingElement()),c=d=>{s(d)&&(M.getState().set(f=>{f.contextMenuObjectType=null}),M.getState().selectMe(r,d,Xo.Select))},u=d=>{M.getState().selectMe(r,d,Xo.ContextMenu),M.getState().set(f=>{d.intersections.length>0&&d.intersections[0].object===d.eventObject&&(f.contextMenuObjectType=z.Wall)})};return h.jsx(ta,{args:[e,n],rotation:[Qt,0,0],visible:!1,onPointerDown:c,onContextMenu:u,children:h.jsx("meshBasicMaterial",{side:ti})})},fZt=be.memo(dZt),kSe=({cy:t,size:e,type:n})=>{const[o,r]=m.useState(QF),i=()=>{r(ga)},a=()=>{r(QF)};return h.jsx(Ps,{name:n,args:[e],position:[0,t,0],onPointerEnter:i,onPointerOut:a,children:h.jsx("meshBasicMaterial",{attach:"material",color:o})})},hZt=({ply:t,phz:e})=>{const n=a5(),o=r=>{r.intersections.length>0&&r.intersections[0].eventObject.parent===r.eventObject&&(M.getState().set(i=>{i.moveHandleType=r.object.name}),kn.getState().setEnableOrbitController(!1))};return h.jsxs("group",{name:"Move Handle Group",position:[0,0,-e],onPointerDown:o,children:[h.jsx(kSe,{cy:-n,size:n,type:zo.Lower}),h.jsx(kSe,{cy:t+n,size:n,type:zo.Upper})]})},pZt=be.memo(hZt),gZt="#ADD8E6",M4=be.memo(({x:t,z:e,handleType:n,highLight:o,handleSize:r,partial:i})=>{const a=M(pn),l=M(Ug),s=M(SOe),[c,u]=m.useState(!1),d=o||c||n===l||s&&(n===Mt.LowerRight||n===Mt.UpperRight)?ga:i?gZt:$a;let f=r,p=r,g=r;if(n===Mt.LowerRight||n===Mt.LowerLeft)f=r*1.7;else if(i){f*=.75,p=r/2,g=r*2.5;const A=g/4;n===Mt.WallPartialResizeLeft||n===Mt.WallPartialResizeRight?e-=A:(n===Mt.WallPartialResizeLeftTop||n===Mt.WallPartialResizeRightTop)&&(e+=A)}else p=r/2,g=r*1.7;return h.jsx(si,{name:n,args:[f,p,g],position:[t,0,e],onPointerOver:()=>{u(!0),a(A=>{A.hoveredHandle=n})},onPointerLeave:()=>{u(!1),a(A=>{A.hoveredHandle=null})},children:h.jsx("meshBasicMaterial",{color:d})})}),mZt=be.memo(({id:t,parentLz:e,roofId:n,x:o,z:r,absAngle:i,leftUnfilledHeight:a,rightUnfilledHeight:l,leftTopPartialResizeHandleHeight:s,rightTopPartialResizeHandleHeight:c,fill:u,wallLeftHeight:d,wallRightHeight:f,highLight:p,leftJoints:g,rightJoints:A})=>{const y=M(pn),S=M(Ju),C=a5(),[P,v]=m.useState(!1),[T,w]=m.useState(new le),[x,b]=m.useState(new ln),R=m.useRef(null),H=m.useRef(!1),F=m.useRef([r*2,a,l]),E=m.useRef(new Map),N=m.useRef(null),U=m.useRef(null),W=m.useRef([]),k=m.useMemo(()=>{if(!n)return null;const Q=M.getState().elements.find(se=>se.id===n&&se.type===z.Roof);return Q?Q.roofType:null},[n]);S&&(r=-r);const D=Q=>{const se=M.getState().cameraDirection,oe=Math.atan2(se.x,se.y);w(new le(Q,0,0)),b(new ln(Qt,0,-oe-i,"ZXY")),v(!0)},L=(Q,se,oe)=>{const[Z,te,ee,de,fe]=se;y(pe=>{for(const ye of pe.elements)if(ye.id===Q&&ye.type===z.Wall){const ae=ye;ye.lz=Z,ae.leftUnfilledHeight=te,ae.rightUnfilledHeight=ee,ae.leftTopPartialHeight=de,ae.rightTopPartialHeight=fe}else if(ye.type===z.Wall&&oe.has(ye.id)){const ae=oe.get(ye.id);ae!==void 0&&(ye.lz=ae,ye.cz=ae/2)}})},j=()=>{n&&(g.length>0||A.length>0)&&(k===Go.Gable||k===Go.Gambrel?M.getState().elements.forEach(Q=>{Q.id===g[0]&&(N.current=Q.lz),Q.id===A[0]&&(U.current=Q.lz)}):(E.current.clear(),M.getState().elements.forEach(Q=>{Q.type===z.Wall&&Q.roofId===n&&E.current.set(Q.id,Q.lz)})))},B=()=>{W.current=M.getState().elements.filter(Q=>Q.parentId===t)},O=(Q,se,oe,Z,te)=>{const{lx:ee,lz:de,roofId:fe,leftRoofHeight:pe,rightRoofHeight:ye,centerLeftRoofHeight:ae,centerRightRoofHeight:Te,centerRoofHeight:ge}=Q,Se=u===Fl.Partial,Re=Se?Math.min(d,Z):d,De=Se?Math.min(f,te):f,Ae=Se&&(!me.isZero(d-Re)||!me.isZero(f-De)),[ue,he]=[ee/2,de/2],ve=[];return ve.push({x:-ue,y:-he+se},{x:ue,y:-he+oe}),Ae?ve.push({x:ue,y:-he+De},{x:-ue,y:-he+Re}):fe?(ye?ve.push({x:ue,y:-he+ye}):ve.push({x:ue,y:he}),Te&&ve.push({x:Te[0]*ee,y:-he+Te[1]}),ge&&ve.push({x:ge[0]*ee,y:-he+ge[1]}),ae&&ve.push({x:ae[0]*ee,y:-he+ae[1]}),pe?ve.push({x:-ue,y:-he+pe}):ve.push({x:-ue,y:he})):ve.push({x:ue,y:he},{x:-ue,y:he}),ve},V=(Q,se,oe,Z,te)=>{const ee=O(Q,se,oe,Z,te);if(W.current.length>0)for(const de of W.current){let{cx:fe,cz:pe,lx:ye,ly:ae,lz:Te}=de;if(fe*=Q.lx,pe*=Q.lz,de.type!==z.SolarPanel?(ye*=Q.lx,Te*=Q.lz):Te=ae,de.type===z.Window&&de.windowType===Ci.Polygonal){const[ge,Se]=de.polygonTop??Gp,Re=fe+ge*ye,De=pe+Te/2+Se;if(!me.isPointInside(Re,De,ee))return!1}if(!me.isElementInsideWall(new le(fe,0,pe),ye,Te,ee,de.type===z.Door))return!1}return!0},G=()=>{N.current=null,U.current=null},q=Q=>{var oe;if(M.getState().addedWallId||Q.object!==((oe=Q.intersections[0])==null?void 0:oe.object))return;const se=Q.object;switch(se.name){case Mt.LowerLeft:{y(Z=>{Z.resizeAnchor.copy(se.localToWorld(new le(o*2,0,0)))});break}case Mt.LowerRight:{y(Z=>{Z.resizeAnchor.copy(se.localToWorld(new le(-o*2,0,0)))});break}case Mt.UpperLeft:case Mt.WallPartialResizeLeft:case Mt.WallPartialResizeLeftTop:{D(-o),j(),B();break}case Mt.UpperRight:case Mt.WallPartialResizeRight:case Mt.WallPartialResizeRightTop:{D(o),j(),B();break}default:console.error("Wall resize handle unknown");return}y(Z=>{Z.resizeHandleType=se.name}),kn.getState().setEnableOrbitController(!1),H.current=!0,F.current=[r*2,a,l,s,c]},$=Q=>{if(Q.intersections.length===0||!H.current)return;const se=Q.intersections[0].point;switch(M.getState().resizeHandleType){case Mt.UpperLeft:case Mt.UpperRight:{y(oe=>{const Z=u===Fl.Partial?Math.max(a,l):0;let te=Math.max(Z+C,se.z-e);if(k===null||k===Go.Gable||k===Go.Gambrel){if(N.current||U.current){const ee=Math.abs(te-(N.current??1/0)),de=Math.abs(te-(U.current??1/0));ee{for(const Z of oe.elements)if(Z.id===t&&Z.type===z.Wall){const te=Z;let ee=me.clamp(se.z-e,0,te.leftTopPartialHeight);if(te.leftJoints.length>0){const de=oe.elements.find(fe=>fe.id===te.leftJoints[0]&&fe.type===z.Wall);if(de&&de.fill===Fl.Partial){const fe=de.rightUnfilledHeight;Math.abs(ee-fe)<.5&&(ee=fe)}}V(te,ee,oe.enableFineGrid?ee:te.rightUnfilledHeight,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.leftUnfilledHeight=ee,oe.enableFineGrid&&(te.rightUnfilledHeight=ee));break}});break}case Mt.WallPartialResizeRight:{y(oe=>{for(const Z of oe.elements)if(Z.id===t&&Z.type===z.Wall){const te=Z;let ee=me.clamp(se.z-e,0,te.rightTopPartialHeight);if(te.rightJoints.length>0){const de=oe.elements.find(fe=>fe.id===te.rightJoints[0]&&fe.type===z.Wall);if(de&&de.fill===Fl.Partial){const fe=de.leftUnfilledHeight;Math.abs(ee-fe)<.5&&(ee=fe)}}V(te,oe.enableFineGrid?ee:te.leftUnfilledHeight,ee,te.leftTopPartialHeight,te.rightTopPartialHeight)&&(te.rightUnfilledHeight=ee,oe.enableFineGrid&&(te.leftUnfilledHeight=ee));break}});break}case Mt.WallPartialResizeLeftTop:{y(oe=>{const Z=oe.elements.find(te=>te.id===t&&te.type===z.Wall);if(Z){let te=me.clamp(se.z-e,Z.leftUnfilledHeight,Z.lz);if(Z.leftJoints.length>0){const ee=oe.elements.find(de=>de.id===Z.leftJoints[0]&&de.type===z.Wall);if(ee&&ee.fill===Fl.Partial){const de=ee.rightTopPartialHeight;Math.abs(te-de)<.5&&(te=de)}}V(Z,Z.leftUnfilledHeight,Z.rightUnfilledHeight,te,oe.enableFineGrid?te:Z.rightTopPartialHeight)&&(Z.leftTopPartialHeight=te,oe.enableFineGrid&&(Z.rightTopPartialHeight=te))}});break}case Mt.WallPartialResizeRightTop:{y(oe=>{const Z=oe.elements.find(te=>te.id===t&&te.type===z.Wall);if(Z){let te=me.clamp(se.z-e,Z.rightUnfilledHeight,Z.lz);if(Z.rightJoints.length>0){const ee=oe.elements.find(de=>de.id===Z.rightJoints[0]&&de.type===z.Wall);if(ee&&ee.fill===Fl.Partial){const de=ee.leftTopPartialHeight;Math.abs(te-de)<.5&&(te=de)}}V(Z,Z.leftUnfilledHeight,Z.rightUnfilledHeight,oe.enableFineGrid?te:Z.leftTopPartialHeight,te)&&(Z.rightTopPartialHeight=te,oe.enableFineGrid&&(Z.leftTopPartialHeight=te))}});break}}},ie=()=>{kn.getState().setEnableOrbitController(!0),v(!1),G(),H.current=!1;const Q=new Map;n&&k!==Go.Gable&&k!==Go.Gambrel&&M.getState().elements.forEach(oe=>{oe.type===z.Wall&&oe.roofId===n&&Q.set(oe.id,oe.lz)});const se={name:"Change Wall Height",timestamp:Date.now(),resizedElementId:t,resizedElementType:z.Wall,oldHeights:[...F.current],newHeights:[r*2,a,l,s,c],oldSameBuildingWallsHeightMap:new Map(E.current),newSameBuildingWallsHeightMap:Q,undo(){L(this.resizedElementId,this.oldHeights,this.oldSameBuildingWallsHeightMap)},redo(){L(this.resizedElementId,this.newHeights,this.newSameBuildingWallsHeightMap)}};M.getState().addUndoable(se),y(oe=>{oe.actionState.wallHeight=r*2,oe.resizeHandleType=null})};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Wall Resize Handle Group",onPointerDown:q,children:[h.jsx(M4,{x:-o,z:-r,handleType:Mt.LowerLeft,highLight:p,handleSize:C}),h.jsx(M4,{x:o,z:-r,handleType:Mt.LowerRight,highLight:p,handleSize:C}),!S&&h.jsxs(h.Fragment,{children:[h.jsx(M4,{x:-o,z:r,handleType:Mt.UpperLeft,highLight:p,handleSize:C}),h.jsx(M4,{x:o,z:r,handleType:Mt.UpperRight,highLight:p,handleSize:C}),u===Fl.Partial&&h.jsxs(h.Fragment,{children:[h.jsx(M4,{x:-o,z:-r+a,handleType:Mt.WallPartialResizeLeft,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:o,z:-r+l,handleType:Mt.WallPartialResizeRight,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:-o,z:-r+s,handleType:Mt.WallPartialResizeLeftTop,highLight:p,handleSize:C,partial:!0}),h.jsx(M4,{x:o,z:-r+c,handleType:Mt.WallPartialResizeRightTop,highLight:p,handleSize:C,partial:!0})]})]})]}),P&&h.jsx(ta,{ref:R,position:T,rotation:x,args:[1e4,1e4],visible:!1,onPointerMove:$,onPointerUp:ie,children:h.jsx("meshBasicMaterial",{side:ti})})]})});function C$e(t){return t.type===z.Cuboid}const yZt="/aladdin/assets/building_facade_01-PU9ju7d_.png",AZt="/aladdin/assets/building_facade_02-x--kz-oN.png",wZt="/aladdin/assets/building_facade_03-BYNjzj26.png",vZt="/aladdin/assets/building_facade_04-VGO1xPmk.png",xZt="/aladdin/assets/building_facade_05-D5uzq3D-.png",bZt="/aladdin/assets/building_facade_06-ClFD4NV8.png",SZt="/aladdin/assets/building_facade_07-XvrQxWV-.png",TZt="/aladdin/assets/building_facade_08-D0kjh0Oz.png",PZt="/aladdin/assets/building_facade_09-y8kFBOu-.png",CZt="/aladdin/assets/building_facade_10-B2-exMft.png",Xz=be.memo(({handleType:t,position:e,size:n,onPointerDown:o,onPointerOver:r,onPointerOut:i})=>{const a=M(Ub),l=M(ly),s=m.useRef(null),[c,u,d]=e;let f=iw;c===0&&u===0?f=rAt:c===0?f=QF:u===0&&(f=iw);const p=l===t||a===t?ga:f;return h.jsx(Ps,{ref:s,name:t,args:[n/2,6,6,0,Math.PI],position:[c,u,d],onPointerDown:o,onPointerOver:g=>{r(g,t)},onPointerOut:i,children:h.jsx("meshBasicMaterial",{color:p})})}),gm=be.memo(({handleType:t,position:e,size:n,onPointerOver:o,onPointerOut:r})=>{const i=M(Ug),a=M(ly),l=m.useRef(null),[s,c,u]=e,d=a===t||i===t?ga:$a,f=()=>{if(l.current){const p=l.current.localToWorld(new le(-s*2,-c*2,0));M.getState().set(g=>{g.resizeAnchor.copy(p),g.resizeHandleType=t}),kn.getState().setEnableOrbitController(!1)}};return h.jsx(si,{ref:l,name:t,args:[n,n,n],position:[s,c,u],onPointerDown:f,onPointerOver:p=>{o(p,t)},onPointerOut:r,children:h.jsx("meshBasicMaterial",{color:d})})}),RZt=({id:t,args:e})=>{const[n,o,r]=e,i=M(pn),a=M(Jn),l=M(Ju),s=M(i$),[c,u]=m.useState(null),{gl:d,raycaster:f}=ri(),p=a5(),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),C=m.useRef(null),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(null),w=m.useMemo(()=>[0,Math.min(-1.2*o,-o-.75)-p*2,sR/2-r],[o,r,p]),x=m.useMemo(()=>[0,Math.max(1.2*o,o+.75)+p*2,sR/2-r],[o,r,p]),b=c!==null,R=!l,H=!s,F=m.useCallback((Q,se)=>{dt.getState().duringCameraInteraction||Q.intersections.length>0&&(Q.intersections[0].object===Q.eventObject||Q.intersections.length>1&&Q.intersections[1].object===Q.eventObject)&&(i(Z=>{Z.hoveredHandle=se;const te=a(t);te&&(Z.selectedElementAngle=te.rotation[2],Z.selectedElementHeight=te.lz)}),me.isMoveHandle(se)?d.domElement.style.cursor="move":se===Di.Upper||se===Di.Lower?d.domElement.style.cursor="grab":d.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"pointer")},[]),E=m.useCallback(()=>{i(Q=>{Q.hoveredHandle=null}),d.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),N=Q=>{const se=a(Q);if(!se)return 0;const oe=se.rotation[2];return se.parentId===Zo?oe:oe+N(se.parentId)},U=Q=>{switch(Q){case z.SolarPanel:case z.Human:case z.Flower:case z.Tree:return!0}return!1},W=Q=>U(Q)||Q===z.Cuboid,k=Q=>{i(se=>{const oe=se.elements.find(Re=>Re.id===t);if(!oe)return;const Z=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),ee=new le().subVectors(Z,te).applyEuler(new ln(0,0,-(y.current??0))),de=new le().addVectors(Z,te).multiplyScalar(.5),{pos:fe,rot:pe}=me.getWorldDataById(oe.parentId),ye=new le().subVectors(de,fe).applyEuler(new ln(0,0,-pe));oe.cx=ye.x,oe.cy=ye.y;const ae=Math.abs(ee.x),Te=Math.abs(ee.y);oe.lx=ae,oe.ly=Te;const ge=new le(ye.x,ye.y,oe.cz).applyEuler(new ln(0,0,pe)).add(fe),Se=oe.rotation[2]+pe;if(P.current.size>0)for(const Re of se.elements){const De=P.current.get(Re.id);if(De){const Ae=De.clone().sub(ge).applyEuler(new ln(0,0,-Se));if(U(Re.type)){const ue=v.current.get(Re.id);if(ue){const[he,ve]=ue;he==="Top"?(Re.cx=Ae.x,Re.cy=Ae.y):he==="NS"?(Re.cx=Ae.x,Re.cy=Math.sign(ve)*(Te/2)):he==="EW"&&(Re.cx=Math.sign(ve)*(ae/2),Re.cy=Ae.y)}}else Re.type===z.Cuboid?(Re.cx=Ae.x,Re.cy=Ae.y):(Re.cx=Ae.x/ae,Re.cy=Ae.y/Te)}}})},D=Q=>{i(se=>{const oe=se.elements.find(Se=>Se.id===t);if(!oe)return;const Z=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),ee=new le().subVectors(Z,te).applyEuler(new ln(0,0,-(y.current??0))),de=new le().addVectors(Z,te).multiplyScalar(.5),{pos:fe,rot:pe}=me.getWorldDataById(oe.parentId),ye=new le().subVectors(de,fe).applyEuler(new ln(0,0,-pe));oe.cx=ye.x;const ae=Math.abs(ee.x);oe.lx=ae;const Te=new le(ye.x,ye.y,oe.cz).applyEuler(new ln(0,0,pe)).add(fe),ge=oe.rotation[2]+pe;if(P.current.size>0)for(const Se of se.elements){const Re=P.current.get(Se.id);if(Re){const De=Re.clone().sub(Te).applyEuler(new ln(0,0,-ge));if(U(Se.type)){const Ae=v.current.get(Se.id);if(Ae){const[ue,he]=Ae;ue==="Top"||ue==="NS"?Se.cx=De.x:ue==="EW"&&(Se.cx=Math.sign(he)*(ae/2))}}else Se.type===z.Cuboid?Se.cx=De.x:Se.cx=De.x/ae}}})},L=Q=>{i(se=>{const oe=se.elements.find(Se=>Se.id===t);if(!oe)return;const Z=Q.clone().setZ(0),te=M.getState().resizeAnchor.clone().setZ(0),ee=new le().subVectors(Z,te).applyEuler(new ln(0,0,-(y.current??0))),de=new le().addVectors(Z,te).multiplyScalar(.5),{pos:fe,rot:pe}=me.getWorldDataById(oe.parentId),ye=new le().subVectors(de,fe).applyEuler(new ln(0,0,-pe));oe.cy=ye.y;const ae=Math.abs(ee.y);oe.ly=ae;const Te=new le(ye.x,ye.y,oe.cz).applyEuler(new ln(0,0,pe)).add(fe),ge=oe.rotation[2]+pe;if(P.current.size>0)for(const Se of se.elements){const Re=P.current.get(Se.id);if(Re){const De=Re.clone().sub(Te).applyEuler(new ln(0,0,-ge));if(U(Se.type)){const Ae=v.current.get(Se.id);if(Ae){const[ue,he]=Ae;ue==="Top"?Se.cy=De.y:ue==="NS"?Se.cy=Math.sign(he)*(ae/2):ue==="EW"&&(Se.cy=De.y)}}else Se.type===z.Cuboid?Se.cy=De.y:Se.cy=De.y/ae}}})},j=Q=>{if(g.current!==null){const se=Math.max(1,Q.z-g.current);i(oe=>{for(const Z of oe.elements)if(Z.id===t&&(Z.lz=se,Z.cz=se/2,oe.selectedElementHeight=se),Z.parentId===t&&U(Z.type)){const te=v.current.get(Z.id);te&&te[0]==="Top"&&(Z.cz=se/2)}})}},B=Q=>{if(A.current){const[se,oe]=A.current;let Z=Math.atan2(se-Q.x,Q.y-oe)+(M.getState().rotateHandleType===Di.Upper?0:Math.PI);const te=Math.abs(Z)>Math.PI?-Math.sign(Z)*sa:0;S.current&&(Z-=S.current),M.getState().updateElementRotationById(t,0,0,Z+te)}},O=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name||M.getState().addedCuboidId){const se=a(t);if(se&&se.parentId!==Zo){u({position:new le(0,0,-r),rotation:new ln});const{pos:oe,rot:Z}=me.getWorldDataById(se.parentId);C.current=oe,S.current=Z,y.current=Z+se.rotation[2];const te=new le(se.cx,se.cy,se.cz).applyEuler(new ln(0,0,Z)).add(oe),ee=M.getState().elements.filter(de=>de.parentId===se.id&&(W(de.type)||me.isIdentical(de.normal,[0,0,1])));P.current.clear(),v.current.clear();for(const de of ee){const fe=new le;U(de.type)?(fe.set(de.cx,de.cy,de.cz),Math.abs(de.cz-r)<.01?v.current.set(de.id,["Top",1]):Math.abs(Math.abs(de.cx)-n)<.01?v.current.set(de.id,["EW",Math.sign(de.cx)]):v.current.set(de.id,["NS",Math.sign(de.cy)])):de.type===z.Cuboid?fe.set(de.cx,de.cy,de.cz):fe.set(de.cx*se.lx,de.cy*se.ly,0),fe.applyEuler(new ln(0,0,y.current)).add(te),P.current.set(de.id,fe)}}i(oe=>{oe.selectedElementIdSet.clear(),oe.selectedElementIdSet.add(t),oe.selectedElement=oe.elements.find(Z=>Z.id===t)??null})}},V=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name){const se=Q.intersections[0].object,oe=M.getState().cameraDirection,Z=Math.atan2(oe.x,oe.y)+N(t);u({position:se.position.clone(),rotation:new ln(-Qt,Z,0)});const te=se.localToWorld(new le);g.current=te.z-r*2;const ee=M.getState().elements.filter(de=>de.parentId===t&&U(de.type));v.current.clear();for(const de of ee)new le().set(de.cx,de.cy,de.cz),Math.abs(de.cz-r)<.01&&v.current.set(de.id,["Top",1]);i(de=>{de.selectedElementIdSet.clear(),de.selectedElementIdSet.add(t),de.selectedElement=de.elements.find(fe=>fe.id===t)??null})}},G=Q=>{if(Q.intersections.length>0&&Q.intersections[0].object.name===Q.object.name){u({position:new le(0,0,-r),rotation:new ln(0,0,0)});const se=Q.eventObject;A.current=se.localToWorld(new le).toArray();const oe=a(t);oe&&(S.current=N(oe.parentId))}},q=Q=>{if(Q.intersections.length>0){const se=Q.intersections[0].eventObject.name;switch(se){case zo.Lower:case zo.Upper:case zo.Left:case zo.Right:case zo.Top:{M.getState().set(oe=>{const Z=oe.elements.find(te=>te.id===t)??null;if(Z){if(oe.selectedElement=Z,Z.parentId===Zo)for(const te of oe.elements)oe.selectedElementIdSet.has(te.id)&&!me.isElementAllowedMultipleMoveOnGround(te)&&oe.selectedElementIdSet.delete(te.id);else oe.selectedElementIdSet.clear(),oe.selectedElementIdSet.add(Z.id);oe.moveHandleType=se}}),kn.getState().setEnableOrbitController(!1);break}}}},$=Q=>{if(T.current){const se=f.intersectObject(T.current);if(se.length){const oe=se[0].point,Z=M.getState().resizeHandleType;Z?me.isTopResizeHandle(Z)?j(oe):me.isXResizeHandle(Z)?D(oe):me.isYResizeHandle(Z)?L(oe):k(oe):M.getState().rotateHandleType&&B(oe)}}},ie=()=>{u(null),g.current=null,A.current=null,y.current=null,S.current=null,C.current=null};return h.jsxs(h.Fragment,{children:[b&&h.jsx(ta,{name:"Cuboid Intersection Plane",ref:T,args:[1e4,1e4],position:c.position,rotation:c.rotation,visible:!1,onPointerMove:$,onPointerUp:ie}),h.jsxs("group",{name:"Bottom Resize Handle Group",position:[0,0,-r+p/2],onPointerDown:O,children:[h.jsx(gm,{handleType:Mt.UpperLeft,position:[-n,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperRight,position:[n,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerLeft,position:[-n,-o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerRight,position:[n,-o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Left,position:[-n,0,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Right,position:[n,0,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Upper,position:[0,o,0],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.Lower,position:[0,-o,0],size:p,onPointerOver:F,onPointerOut:E})]}),R&&h.jsxs("group",{name:"Cuboid Top Resize Handle Group",onPointerDown:V,children:[h.jsx(gm,{handleType:Mt.LowerLeftTop,position:[-n,-o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperLeftTop,position:[-n,o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.LowerRightTop,position:[n,-o,r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(gm,{handleType:Mt.UpperRightTop,position:[n,o,r],size:p,onPointerOver:F,onPointerOut:E})]}),H&&h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Cuboid Move Handle Group",onPointerDown:q,children:[h.jsx(Xz,{handleType:zo.Lower,position:[0,-o-p*1.2,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Upper,position:[0,o+p*1.2,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Left,position:[-n-p*1.2,0,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Right,position:[n+p*1.2,0,-r],size:p,onPointerOver:F,onPointerOut:E}),h.jsx(Xz,{handleType:zo.Top,position:[0,0,r],size:p,onPointerOver:F,onPointerOut:E})]}),h.jsxs("group",{name:"Cuboid Rotate Handle Group",onPointerDown:G,children:[h.jsx(dX,{id:t,handleType:Di.Lower,position:w,ratio:p*4,hoverHandle:F,noHoverHandle:E}),h.jsx(dX,{id:t,position:x,handleType:Di.Upper,ratio:p*4,hoverHandle:F,noHoverHandle:E})]})]})]})},HZt=be.memo(RZt);class Pi{static getSolarPanelUnitLength(e){const n=M.getState().getPvModule(e.pvModelName);return e.orientation===vr.landscape?[n.length,n.width]:[n.width,n.length]}static getRotationFromNormal(e){const[n,o,r]=e;return r===1?new ln(0,0,0):n!==0?new ln(Qt,0,n*Qt,"ZXY"):o!==0?new ln(-o*Qt,0,0):new ln}static isNewPositionOk(e){const n=M.getState().elements.find(o=>o.id===e.parentId);if(!n)return!1;switch(n.type){case z.Foundation:{if(!me.isSolarCollectorWithinHorizontalSurface(e,n))return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(M.getState().overlapWithSibling(e))return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Cuboid:{if(e.type===z.SolarWaterHeater)break;const o=me.checkElementOnCuboidState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Wall:{const o=me.checkElementOnWallState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}case z.Roof:{const o=me.checkElementOnRoofState(e,n);if(o===pa.OutsideBoundary)return co(Y.t("message.MoveOutsideBoundaryCancelled",{lng:M.getState().language})),!1;if(o===pa.OverLap)return co(Y.t("message.MoveCancelledBecauseOfOverlap",{lng:M.getState().language})),!1;break}}return!0}static getRackCount(e,n,o,r,i){if(e===vr.portrait){const a=Math.max(1,Math.round(n/i)),l=Math.max(1,Math.round(o/r));return a*l}else{const a=Math.max(1,Math.round(n/r)),l=Math.max(1,Math.round(o/i));return a*l}}static setSelected(e,n){M.getState().set(o=>{var r;o.multiSelectionsMode?n?o.selectedElementIdSet.has(e)?o.selectedElementIdSet.delete(e):o.selectedElementIdSet.add(e):o.selectedElementIdSet.delete(e):n?(o.selectedElement=o.elements.find(i=>i.id===e)??null,o.selectedElementIdSet.clear(),o.selectedElementIdSet.add(e)):(((r=o.selectedElement)==null?void 0:r.id)===e&&(o.selectedElement=null),o.selectedElementIdSet.has(e)&&o.selectedElementIdSet.delete(e))})}static getSurfaceType(e,n){return!n||!e||e===z.Foundation?oh.Horizontal:e===z.Wall?oh.Vertical:me.isEqual(n.z,1)?oh.Horizontal:e===z.Cuboid?oh.Vertical:oh.Inclined}static findParentGroup(e,n){const o=e.parent;if(!o)return null;for(const r of n)if(o.name.includes(r))return o;return Pi.findParentGroup(o,n)}static getRoofId(e){if(!e)return null;const n=e.userData.roofId;return n||Pi.getRoofId(e.parent)}static getRoofSegmentData(e){if(!e)return null;const{roofId:n,foundation:o,centroid:r,roofSegments:i}=e.userData;return!n||!o||!r||!i?Pi.getRoofSegmentData(e.parent):{roofId:n,foundation:o,centroid:r,roofSegments:i}}static getRelativeAzimuth(e){return e>Math.PI?e-Math.PI*2:e<-Math.PI?e+Math.PI*2:e}static isTrackerEnabled(e,n){return e===oh.Horizontal&&n!==Ll.NO_TRACKER}static getUnitSize(e,n,o){return e===vr.landscape?{length:n,width:o}:{length:o,width:n}}static getRotationOnCuboid(e){const{x:n,y:o,z:r}=e;return me.isEqual(r,1)?[0,0,0]:me.isEqual(n,0)&&me.isEqual(o,1)?[Qt,0,Math.PI]:me.isEqual(n,0)&&me.isEqual(o,-1)?[Qt,0,0]:me.isEqual(n,-1)&&me.isEqual(o,0)?[Qt,0,-Qt]:me.isEqual(n,1)&&me.isEqual(o,0)?[Qt,0,Qt]:[0,0,0]}static getPVModel(e){let n=M.getState().supportedPvModules[e];return n||(n=M.getState().customPvModules[e],n)?n:(console.warn("pvModel undefined. Using default model: SPR-X21-335-BLK"),{name:"SPR-X21-335-BLK",brand:"SunPower",cellType:"Monocrystalline",efficiency:.21,length:1.558,nominalLength:1.56,width:1.046,nominalWidth:1.05,thickness:.046,m:12,n:8,pmax:335,vmpp:57.3,impp:5.85,voc:67.9,isc:6.23,pmaxTC:-.0029,noct:41.5,weight:18.6,color:"Black",shadeTolerance:"High",bifacialityFactor:0})}static addUndoable(e,n){if(e)switch(n){case Aa.Move:{Pi.addUndoableMove(e);break}case Aa.ResizeX:case Aa.ResizeY:{Pi.addUndoableResize(e);break}case Aa.RotateLower:case Aa.RotateUpper:{Pi.addUndoableRotate(e);break}case Aa.Tilt:{Pi.addUndoableTilt(e);break}}}static addUndoableMove(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Move",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new le().fromArray(e.normal),newNormal:new le().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};M.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{M.getState().set(f=>{const p=f.elements.find(g=>g.id===i);!p||p.type!==z.SolarPanel||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e){const n=M.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarPanel);if(!n)return;const o={name:"Resize Solar Panel",timestamp:Date.now(),id:n.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[n.cx,n.cy,n.cz],newDms:[n.lx,n.ly,n.lz],newRot:[...n.rotation],newNor:[...n.normal],undo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.oldPos],[i.lx,i.ly,i.lz]=[...o.oldDms],i.normal=[...o.oldNor],i.rotation=[...o.oldRot];break}})},redo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.id){[i.cx,i.cy,i.cz]=[...o.newPos],[i.lx,i.ly,i.lz]=[...o.newDms],i.normal=[...o.newNor],i.rotation=[...o.newRot];break}})}};M.getState().addUndoable(o)}static addUndoableRotate(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Relative Azimuth",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.relativeAzimuth=i)})}}static addUndoableTilt(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarPanel);if(!n)return;const o={name:"Set Solar Panel Tilt",timestamp:Date.now(),changedElementId:n.id,oldValue:e.tiltAngle,newValue:n.tiltAngle,changedElementType:z.SolarPanel,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarPanel);l&&(l.tiltAngle=i)})}}}const MZt=t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=1,color:l="silver",lineColor:s="black",lineWidth:c=.1,locked:u=!1,showLabel:d=!1,textureTypes:f=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],stackable:p,transparency:g}=t,A=Tc(e),y=M(pn),S=M(m0),C=M(Ju),P=M(Jn),v=M(Db),T=M(_ge),w=M(Ap),x=M(d3),b=M(Fw),R=M(u3),H=M(Uge),F=M(Bwt),E=M(pu),N=M(Qq),U=M(t5),W=M(Cs),k=M(En),D=M(qge),L=M(kw),j=M(hYe),B=M(Nge),O=dt(hs),V=M(Pf),G=Cn(c1),q=M(mA),{camera:$,gl:{domElement:ie},raycaster:Q,mouse:se}=ri(),[oe,Z]=m.useState(null),[te,ee]=m.useState(null),[de,fe]=m.useState(null),[pe,ye]=m.useState(null),[ae,Te]=m.useState(null),[ge,Se]=m.useState(!1),[Re,De]=m.useState(!1),Ae=m.useRef(null),ue=m.useRef(null),he=m.useRef(null),ve=m.useRef(ko),[we,Pe]=m.useState(new le(0,0,0)),Ie=m.useRef(new ln(0,0,0)),Me=m.useRef(new le(1,1,1)),ze=m.useRef(new le),Ne=m.useRef(new le),Je=m.useRef(new le),Ue=m.useRef(new le),nt=m.useRef(new le(1,1,1)),We=m.useRef(new le(1,1,1)),Ee=m.useRef(0),ke=m.useRef(0),Oe=m.useRef([]),st=m.useRef([]),je=m.useRef(null),xt=m.useRef(new le),gt=m.useRef(0),Ye=m.useMemo(()=>({lng:S}),[S]),it=r/2,ut=i/2,Qe=a/2,lt=m.useMemo(()=>new le,[]),Ze=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.CuboidElement",Ye))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Ye)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",Ye)+": ("+n.toFixed(1)+", "+o.toFixed(1)+", "+(a/2).toFixed(1)+") "+Y.t("word.MeterAbbreviation",Ye)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ye,n,o,a]);m.useEffect(()=>{const wn=()=>{he.current=null,De(!1),kn.getState().setEnableOrbitController(!0)};return window.addEventListener("pointerup",wn),()=>{window.removeEventListener("pointerup",wn)}},[]),m.useEffect(()=>{M.getState().tempHumanPlant.length>0&&y(wn=>{wn.elements.push(...wn.tempHumanPlant),wn.tempHumanPlant=[]})},[]),m.useEffect(()=>{if(t&&O){const wn=V??5,In=G(t.id+"-top");In&&Z(me.fetchHeatmapTexture(In,wn));const ar=G(t.id+"-south");ar&&ee(me.fetchHeatmapTexture(ar,wn));const Wo=G(t.id+"-north");Wo&&fe(me.fetchHeatmapTexture(Wo,wn));const to=G(t.id+"-west");to&&ye(me.fetchHeatmapTexture(to,wn));const Bn=G(t.id+"-east");Bn&&Te(me.fetchHeatmapTexture(Bn,wn,!0))}},[O,V]);const Be=wn=>{switch(wn){case Ro.Facade01:return yZt;case Ro.Facade02:return AZt;case Ro.Facade03:return wZt;case Ro.Facade04:return vZt;case Ro.Facade05:return xZt;case Ro.Facade06:return bZt;case Ro.Facade07:return SZt;case Ro.Facade08:return TZt;case Ro.Facade09:return PZt;case Ro.Facade10:return CZt;default:return og}},$e=wn=>{switch(wn){case Ro.Facade01:return{x:14,y:6.5};case Ro.Facade02:return{x:14,y:6.5};case Ro.Facade03:return{x:10,y:12};case Ro.Facade04:return{x:20,y:11};case Ro.Facade05:return{x:15,y:10};case Ro.Facade06:return{x:11,y:3.5};case Ro.Facade07:return{x:11,y:10};case Ro.Facade08:return{x:16,y:9};case Ro.Facade09:return{x:10,y:9};case Ro.Facade10:return{x:12,y:9};default:return{x:1,y:1}}},wt=m.useMemo(()=>new cf().load(f?Be(f[0]):og,wn=>{const In=$e(f[0]);wn.repeat.set(i/In.x,a/In.y),wn.rotation=Qt,wn.center.x=1,wn.center.y=0,wn.wrapS=wn.wrapT=bs,Rt(wn)}),[f[0],i,a]),[vt,Rt]=m.useState(wt),Gt=m.useMemo(()=>new cf().load(f?Be(f[1]):og,wn=>{const In=$e(f[1]);wn.repeat.set(i/In.x,a/In.y),wn.rotation=-Qt,wn.wrapS=wn.wrapT=bs,pt(wn)}),[f[1],i,a]),[At,pt]=m.useState(Gt),Wt=m.useMemo(()=>new cf().load(f?Be(f[2]):og,wn=>{const In=$e(f[2]);wn.repeat.set(r/In.x,a/In.y),wn.rotation=Math.PI,wn.center.x=0,wn.center.y=1,wn.wrapS=wn.wrapT=bs,ct(wn)}),[f[2],r,a]),[ht,ct]=m.useState(Wt),It=m.useMemo(()=>new cf().load(f?Be(f[3]):og,wn=>{const In=$e(f[3]);wn.repeat.set(r/In.x,a/In.y),wn.wrapS=wn.wrapT=bs,Ve(wn)}),[f[3],r,a]),[Ft,Ve]=m.useState(It),ft=m.useMemo(()=>new cf().load(f?Be(f[4]):og,wn=>{const In=$e(f[4]);wn.repeat.set(r/In.x,i/In.y),wn.wrapS=wn.wrapT=bs,rt(wn)}),[f[4],r,i]),[kt,rt]=m.useState(ft);m.useEffect(()=>{op()},[f]);const at=wn=>{switch(wn){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:return!0}return!1},Ge=wn=>{switch(wn){case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.Human:case z.Tree:case z.Flower:return!0}return!1},yt=wn=>{ve.current=wn;const In=.01;me.isSame(ve.current,ko)?(Pe(new le(0,0,Qe+In)),Ie.current=new ln(0,0,0),Me.current.set(it,ut,Qe)):me.isSame(ve.current,Op)?(Pe(new le(it+In,0,0)),Ie.current=new ln(0,Qt,0),Me.current.set(Qe,ut,it)):me.isSame(ve.current,Vp)?(Pe(new le(-it-In,0,0)),Ie.current=new ln(0,-Qt,0),Me.current.set(Qe,ut,it)):me.isSame(ve.current,_p)?(Pe(new le(0,-ut-In,0)),Ie.current=new ln(Qt,0,0),Me.current.set(it,Qe,ut)):me.isSame(ve.current,Yc)&&(Pe(new le(0,ut+In,0)),Ie.current=new ln(-Qt,0,0),Me.current.set(it,Qe,ut))},Pt=Math.max(1,Math.max(r,i)/8),ot=Wg*Pt,bt=wn=>{var Wo,to;const In=wn.intersections[0];if(M.getState().objectTypeToAdd===z.SolarPanel){const Bn=In.point,{pos:Ko,rot:So}=me.getWorldDataById(e),Qo=new le().subVectors(Bn,Ko).applyEuler(new ln(0,0,-So)),Yo=((Wo=In.face)==null?void 0:Wo.normal)??new le(0,0,1);let lr=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);lr||(lr=M.getState().getPvModule(R9));const fr=Va.makeSolarPanel(t,lr,Qo.x,Qo.y,Qo.z,M.getState().actionState.solarPanelOrientation??vr.landscape,M.getState().actionState.solarPanelPoleHeight??1,M.getState().actionState.solarPanelPoleSpacing??3,M.getState().actionState.solarPanelTiltAngle??0,M.getState().actionState.solarPanelRelativeAzimuth??0,Yo,Pi.getRotationOnCuboid(Yo),M.getState().actionState.solarPanelFrameColor??"white");return y(ei=>{ei.elements.push(fr)}),fr}else return T(t,In.point,(to=In.face)==null?void 0:to.normal)},zt=wn=>{if(wn.button===2)return;D()||E(e,wn,Xo.Select);const In=v();let ar=!1;if(wn.intersections[0].object.name===z.Polygon&&M.getState().objectTypeToAdd!==z.None&&(ar=!0),(In==null?void 0:In.id)===e||ar)if(Ge(M.getState().objectTypeToAdd)&&t){De(!0);const Wo=bt(wn);if(Wo){const to={name:"Add",timestamp:Date.now(),addedElement:Wo,undo:()=>{w(to.addedElement.id,!1)},redo:()=>{y(Bn=>{Bn.elements.push(to.addedElement),Bn.selectedElement=to.addedElement})}};k(to),y(Bn=>{Bn.selectedElementIdSet.clear(),Bn.selectedElementIdSet.add(Wo.id),Bn.selectedElement=Wo,Bn.objectTypeToAdd=z.None})}}else kn.getState().selectNone(),kn.setState({cuboidRef:Ae});else if(In&&In.parentId===e&&at(In.type)){De(!0);const{rot:Wo,pos:to}=me.getWorldDataById(e);xt.current.copy(to),gt.current=Wo,he.current=In;let Bn;for(const Ko of wn.intersections)if(Ko.object===ue.current){Bn=Ko.face;break}switch(Bn&&yt(Bn.normal),kn.getState().setEnableOrbitController(!1),ze.current.x=In.cx,ze.current.y=In.cy,ze.current.z=In.cz,Je.current.fromArray(In.normal),nt.current.x=In.lx,nt.current.y=In.ly,nt.current.z=In.lz,In.type){case z.SolarPanel:Ee.current=In.relativeAzimuth,dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e);break;case z.Polygon:Oe.current=In.vertices.map(Ko=>({...Ko}));break}}},Bt=wn=>{var So,Qo;if(!ue.current)return;const In=Q.intersectObjects([ue.current]);if(In.length===0)return;const ar=In[0].face;if(!ar)return;const Wo=Eu.getIntersectionObjects(wn);if(Wo.length===0||Wo[0].eventObject.userData.id!==e){jo(!1),he.current=null;return}const to=M.getState().selectedElement;if(!!(to&&!to.locked&&to.type===z.SolarPanel&&M.getState().moveHandleType)&&(he.current=to),ar.normal.z===1&&((So=he.current)==null?void 0:So.type)!==z.Polygon){const Yo=!!(((Qo=he.current)==null?void 0:Qo.type)===z.SolarPanel&&(M.getState().moveHandleType||M.getState().rotateHandleType||M.getState().resizeHandleType)&&!he.current.locked);jo(Yo),Yo&&(lt.set(0,0,he.current.poleHeight+a/2),yt(new le(0,0,1)),De(!0));return}else if(jo(!1),he.current&&t&&!he.current.locked){const Yo=new Kt(wn.offsetX/ie.clientWidth*2-1,1-wn.offsetY/ie.clientHeight*2);Q.setFromCamera(Yo,$);let lr=In[0].point;if(M.getState().moveHandleType){const fr=ar.normal;if(yt(fr),lr=me.relativeCoordinates(lr.x,lr.y,lr.z,t),he.current.type===z.Polygon){const ei=he.current;if(M.getState().moveHandleType===zo.Default){const hr=me.calculatePolygonCentroid(Oe.current),tr=new le().fromArray(ei.normal);let bi,Fo;me.isSame(tr,Op)?(bi=-(hr.x+lr.z),Fo=lr.y-hr.y):me.isSame(tr,Vp)?(bi=lr.z-hr.x,Fo=lr.y-hr.y):me.isSame(tr,Yc)?(bi=lr.x-hr.x,Fo=-(hr.y+lr.z)):me.isSame(tr,_p)?(bi=lr.x-hr.x,Fo=lr.z-hr.y):(bi=lr.x-hr.x,Fo=lr.y-hr.y);const Si=Oe.current.map(hl=>({...hl}));Si.forEach(hl=>{hl.x+=bi,hl.y+=Fo}),L(ei.id,Si)}}else R(he.current.id,lr.x,lr.y,lr.z),F(he.current.id,fr.x,fr.y,fr.z),he.current.parentId!==e&&M.getState().set(ei=>{const hr=ei.elements.find(tr=>{var bi;return tr.id===((bi=he.current)==null?void 0:bi.id)&&tr.type===z.SolarPanel});hr&&(hr.parentId!==e||hr.foundationId!==e)&&(hr.parentId=e,hr.foundationId=e,hr.parentType=z.Cuboid,ei.selectedElement&&(ei.selectedElement.parentId=e,hr.color=ei.selectedElement.color))})}else if(M.getState().resizeHandleType)switch(he.current.type){case z.SolarPanel:{const fr=he.current;if(fr.normal[2]===1)break;const[ei,hr]=Pi.getSolarPanelUnitLength(fr),tr=M.getState().resizeAnchor,bi=M.getState().resizeHandleType;if(bi===Mt.Lower||bi===Mt.Upper){const Si=Math.max(1,Math.round(Math.abs(lr.z-tr.z)/hr))*hr,hl=new le(0,0,lr.z-tr.z).normalize().multiplyScalar(Si),nr=new le().addVectors(tr,hl.clone().divideScalar(2));y(or=>{const Ai=or.elements.find(Fa=>Fa.id===fr.id);Ai&&(Ai.cz=(nr.z-xt.current.z)/a,Ai.ly=Math.abs(hl.z))})}else if(bi===Mt.Left||bi===Mt.Right){const Fo=new le().subVectors(lr,tr).setZ(0),hl=Math.max(1,Math.round(Fo.length()/ei))*ei,nr=Fo.clone().normalize().multiplyScalar(hl),or=new le().addVectors(tr,nr.clone().divideScalar(2)),Ai=new le().subVectors(or,xt.current).applyEuler(new ln(0,0,-gt.current));y(Fa=>{const wi=Fa.elements.find(Fs=>Fs.id===fr.id);wi&&(Math.abs(Math.abs(wi.normal[1])-1)<.01?wi.cx=Ai.x/r:wi.cy=Ai.y/i,wi.lx=nr.length())})}break}case z.Polygon:{if(M.getState().resizeHandleType===Mt.Default){let fr=new le(lr.x-xt.current.x,lr.y-xt.current.y,0).applyEuler(new ln(0,0,-gt.current,"ZXY"));const ei=he.current,hr=new le().fromArray(ei.normal);let tr,bi;me.isSame(hr,Op)?(tr=t.lz,bi=t.ly,fr.x=-lr.z+xt.current.z):me.isSame(hr,Vp)?(tr=t.lz,bi=t.ly,fr.x=lr.z-xt.current.z):me.isSame(hr,Yc)?(tr=t.lx,bi=t.lz,fr.y=-lr.z+xt.current.z):me.isSame(hr,_p)?(tr=t.lx,bi=t.lz,fr.y=lr.z-xt.current.z):(tr=t.lx,bi=t.ly),fr=M.getState().enableFineGrid?me.snapToFineGrid(fr):me.snapToNormalGrid(fr),fr.x/=tr,fr.y/=bi,j(ei.id,ei.selectedIndex,fr.x,fr.y)}break}}De(!0)}},tt=wn=>{if(je.current&&he.current&&t){if(he.current.type!==z.SolarPanel)return;const In=he.current;if(In.locked)return;Q.setFromCamera(se,$);const ar=Q.intersectObjects([je.current]);if(ar.length>0){let Wo=ar[0].point.clone();if(M.getState().moveHandleType)Wo=me.relativeCoordinates(Wo.x,Wo.y,Wo.z-In.poleHeight,t),R(In.id,Wo.x,Wo.y,Wo.z),F(he.current.id,0,0,1),he.current.parentId!==e&&M.getState().set(to=>{const Bn=to.elements.find(Ko=>{var So;return Ko.id===((So=he.current)==null?void 0:So.id)&&Ko.type===z.SolarPanel});Bn&&(Bn.parentId!==e||Bn.foundationId!==e)&&(Bn.parentId=e,Bn.foundationId=e,Bn.parentType=z.Cuboid,to.selectedElement&&(to.selectedElement.parentId=e,Bn.color=to.selectedElement.color))});else if(M.getState().rotateHandleType&&M.getState().rotateHandleType!==Di.Tilt){const to=gt.current,Bn=new Kt(xt.current.x,xt.current.y),Ko=new Kt(t.lx*In.cx,t.ly*In.cy).rotateAround(ai,to),So=new Kt().addVectors(Ko,Bn),Qo=-to+Math.atan2(-Wo.x+So.x,Wo.y-So.y)+(M.getState().rotateHandleType===Di.Lower?0:Math.PI),Yo=Math.abs(Qo)>Math.PI?-Math.sign(Qo)*sa:0,lr=Qo+Yo;N(In.id,lr),ke.current=lr}else if(M.getState().resizeHandleType){const to=M.getState().resizeAnchor,Bn=U(In.pvModelName),Ko=new Kt(Wo.x,Wo.y),So=new Kt(to.x,to.y),Qo=Ko.distanceTo(So),Yo=In.relativeAzimuth+gt.current,lr=new Kt().subVectors(Ko,So);switch(M.getState().resizeHandleType){case Mt.Lower:case Mt.Upper:{const fr=M.getState().resizeHandleType===Mt.Lower?1:-1,ei=lr.angle()-Yo+fr*Qt;let hr=Qo*Math.cos(ei);In.orientation===vr.portrait?hr=Math.max(1,Math.ceil((hr-Bn.length/2)/Bn.length))*Bn.length:hr=Math.max(1,Math.ceil((hr-Bn.width/2)/Bn.width))*Bn.width;const tr=to.x+fr*(hr*Math.sin(Yo))/2,bi=to.y-fr*(hr*Math.cos(Yo))/2,Fo=new Kt(tr,bi),Si=new Kt(xt.current.x,xt.current.y),hl=new Kt().subVectors(Fo,Si).rotateAround(ai,-gt.current),nr=hl.x/r,or=hl.y/i;qt(In,nr,or,In.lx,hr)&&(b(In.id,hr),R(In.id,nr,or));break}case Mt.Left:case Mt.Right:{const fr=M.getState().resizeHandleType===Mt.Left?-1:1,ei=lr.angle()-Yo+(M.getState().resizeHandleType===Mt.Left?Math.PI:0);let hr=Qo*Math.cos(ei);In.orientation===vr.portrait?hr=Math.max(1,Math.ceil((hr-Bn.width/2)/Bn.width))*Bn.width:hr=Math.max(1,Math.ceil((hr-Bn.length/2)/Bn.length))*Bn.length;const tr=to.x+fr*(hr*Math.cos(Yo))/2,bi=to.y+fr*(hr*Math.sin(Yo))/2,Fo=new Kt(tr,bi),Si=new Kt(xt.current.x,xt.current.y),hl=new Kt().subVectors(Fo,Si).rotateAround(ai,-gt.current),nr=hl.x/r,or=hl.y/i;qt(In,nr,or,hr,In.ly)&&(x(In.id,hr),R(In.id,nr,or));break}}}}}},Ht=(wn,In,ar)=>{const Wo=JSON.parse(JSON.stringify(wn));return Wo.cx=In,Wo.cy=ar,B(Wo)?(co(Y.t("message.MoveCancelledBecauseOfOverlap",Ye)),!1):me.isIdentical(wn.normal,as)&&!me.isSolarCollectorWithinHorizontalSurface(Wo,t)?(co(Y.t("message.MoveOutsideBoundaryCancelled",Ye)),!1):!0},_t=(wn,In)=>{const ar=JSON.parse(JSON.stringify(wn));return ar.relativeAzimuth=In,B(ar)?(co(Y.t("message.RotationCancelledBecauseOfOverlap",Ye)),!1):me.isSolarCollectorWithinHorizontalSurface(ar,t)?!0:(co(Y.t("message.RotationOutsideBoundaryCancelled",Ye)),!1)},qt=(wn,In,ar,Wo,to)=>{if(wn.tiltAngle!==0&&.5*to*Math.abs(Math.sin(wn.tiltAngle))>wn.poleHeight)return!1;const Bn=JSON.parse(JSON.stringify(wn));return Bn.cx=In,Bn.cy=ar,Bn.lx=Wo,Bn.ly=to,!!me.isSolarCollectorWithinHorizontalSurface(Bn,t)},un=()=>{if(!he.current)return;const wn=P(he.current.id);if(wn){if(wn.type===z.Polygon){if(M.getState().moveHandleType||M.getState().resizeHandleType){st.current=wn.vertices.map(ar=>({...ar}));const In={name:M.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Oe.current,newValue:st.current,changedElementId:wn.id,changedElementType:wn.type,undo:()=>{L(In.changedElementId,In.oldValue)},redo:()=>{L(In.changedElementId,In.newValue)}};k(In)}}else if(M.getState().resizeHandleType){if(Ne.current.x=wn.cx,Ne.current.y=wn.cy,Ne.current.z=wn.cz,We.current.x=wn.lx,We.current.y=wn.ly,We.current.z=wn.lz,Ne.current.distanceToSquared(ze.current)>Et&&We.current.distanceToSquared(nt.current)>Et){const In={name:"Resize",timestamp:Date.now(),resizedElementId:he.current.id,resizedElementType:he.current.type,oldCx:ze.current.x,oldCy:ze.current.y,oldCz:ze.current.z,newCx:Ne.current.x,newCy:Ne.current.y,newCz:Ne.current.z,oldLx:nt.current.x,oldLy:nt.current.y,oldLz:nt.current.z,newLx:We.current.x,newLy:We.current.y,newLz:We.current.z,undo:()=>{R(In.resizedElementId,In.oldCx,In.oldCy,In.oldCz),H(In.resizedElementId,In.oldLx,In.oldLy,In.oldLz)},redo:()=>{R(In.resizedElementId,In.newCx,In.newCy,In.newCz),H(In.resizedElementId,In.newLx,In.newLy,In.newLz)}};k(In)}}else if(M.getState().rotateHandleType){if(he.current.type===z.SolarPanel){const In=he.current;if(Math.abs(ke.current-Ee.current)>Et)if(_t(In,ke.current)){y(Wo=>{Wo.selectedElementAngle=ke.current});const ar={name:"Rotate",timestamp:Date.now(),oldValue:Ee.current,newValue:ke.current,changedElementId:In.id,changedElementType:In.type,undo:()=>{N(ar.changedElementId,ar.oldValue)},redo:()=>{N(ar.changedElementId,ar.newValue)}};k(ar)}else N(In.id,Ee.current)}}else if(Ne.current.x=wn.cx,Ne.current.y=wn.cy,Ne.current.z=wn.cz,Ue.current.fromArray(wn.normal),Ne.current.distanceToSquared(ze.current)>Et){let In=!0;wn.type===z.SolarPanel&&(In=Ht(wn,wn.cx,wn.cy)),In?Eu.addUndoableMove():y(ar=>{const Wo=ar.elements.find(So=>So.id===wn.id);if(!Wo||!ar.selectedElement)return;const to=ar.selectedElement;Wo.cx=to.cx,Wo.cy=to.cy,Wo.cz=to.cz,Wo.rotation=[...to.rotation],Wo.normal=[...to.normal];const Bn=dt.getState().oldParentId,Ko=dt.getState().oldFoundationId;Bn&&(Wo.parentId=Bn),Ko&&(Wo.foundationId=Ko)})}he.current=null}},Rn=wn=>{wn.intersections.length>0&&wn.intersections[0].object===ue.current&&Se(!0)},yo=wn=>{he.current&&me.isPlantOrHuman(he.current)&&wn.intersections[0].object===ue.current&&De(!0)},Ao=()=>{Se(!1),De(!1)},wo=wn=>{E(e,wn,Xo.ContextMenu),y(In=>{In.pastePoint.copy(wn.intersections[0].point);const ar=wn.intersections[0].face;ar&&(In.pasteNormal=ar.normal.clone(),me.isSame(ar.normal,Op)?In.selectedSideIndex=0:me.isSame(ar.normal,Vp)?In.selectedSideIndex=1:me.isSame(ar.normal,Yc)?In.selectedSideIndex=2:me.isSame(ar.normal,_p)?In.selectedSideIndex=3:me.isSame(ar.normal,ko)&&(In.selectedSideIndex=4)),In.clickObjectType=z.Cuboid,wn.intersections.length>0&&wn.intersections[0].object===ue.current&&(In.contextMenuObjectType=z.Cuboid)})},{transparent:Io,opacity:po}=tM(g!==void 0&&g>0,1-(g??0));m.useEffect(()=>{if(ue.current)for(let wn=0;wn<6;wn++)ue.current.material[wn].needsUpdate=!0},[Io]);const On=[0,1,2,3,4,5],fo=[O&&ae?ae:vt,O&&pe?pe:At,O&&de?de:ht,O&&te?te:Ft,O&&oe?oe:kt,null],ir=t&&t.faceColors?On.map(wn=>f&&f[wn]!==Ro.NoTexture?O?h.jsx("meshBasicMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):h.jsx("meshStandardMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):O?h.jsx("meshBasicMaterial",{side:Da,attach:`material-${wn}`,color:"white",map:fo[wn],transparent:Io,opacity:po},wn):h.jsx("meshStandardMaterial",{side:Da,attach:`material-${wn}`,color:t.faceColors?t.faceColors[wn]:l,map:fo[wn],transparent:Io,opacity:po},wn)):h.jsx("meshStandardMaterial",{side:Da,color:l,transparent:Io,opacity:po}),Rr=m.useMemo(()=>[it,ut,Qe],[it,ut,Qe]),br=A&&!u,[_r,jo]=m.useState(!1);return h.jsxs("group",{ref:Ae,name:"Cuboid Group "+e,children:[h.jsx(si,{castShadow:W,receiveShadow:W,userData:{simulation:!0,stand:!0,stackable:p,id:e,aabb:!0},uuid:e,ref:ue,args:[r,i,a],name:"Cuboid "+e,onContextMenu:wo,onPointerDown:zt,onPointerMove:Bt,onPointerUp:un,onPointerOver:Rn,onPointerOut:Ao,onPointerEnter:yo,children:ir}),_r&&h.jsx(ta,{ref:je,name:"Intersection Plane",position:lt,args:[r,i],visible:!1,onPointerMove:tt}),Re&&h.jsxs(h.Fragment,{children:[(M.getState().moveHandleType||M.getState().resizeHandleType)&&h.jsx(eme,{hx:Me.current.x,hy:Me.current.y,hz:Me.current.z,position:we,rotation:Ie.current}),M.getState().rotateHandleType&&he.current&&he.current.type===z.SolarPanel&&h.jsx(_ye,{element:he.current,height:he.current.poleHeight+Qe})]}),A&&h.jsx(Gye,{element:t,verticalLift:ot}),(g||!A||q)&&h.jsx(mw,{hx:it,hy:ut,hz:Qe,lineColor:g||q&&C?"white":s,lineWidth:g?c*15:q&&C?c*5:c}),A&&u&&h.jsx(mw,{hx:it,hy:ut,hz:Qe,lineColor:B0,lineWidth:c*5}),br&&h.jsx(HZt,{id:e,args:Rr}),(ge||d)&&!A&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:Ze,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,Qe+((t==null?void 0:t.labelHeight)??.2)]})]})},IZt=be.memo(MZt),R$e=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="white",lineColor:d="black",lineWidth:f=.1,locked:p=!1,label:g,showLabel:A=!1,parentId:y,foundationId:S,light:C=!0,heatFlux:P=!1}=t,v=M(pn),T=M(Cs),w=M(pu),x=Tc(e),{gl:{domElement:b}}=ri(),[R,H]=m.useState(!1),F=m.useRef(null),E=m.useRef(null),N=$t(),U=M(V=>{for(const G of V.elements)if(G.id===y)return G}),W=M(V=>{for(const G of V.elements)if(G.id===S)return G});let k=n,D=o,L=r;if(y&&U)switch(U.type){case z.Foundation:{if(L=U.cz+U.lz/2,me.isZero(s[2]))k=U.cx+n*U.lx,D=U.cy+o*U.ly;else{const V=new le(n*U.lx,o*U.ly,0);V.applyAxisAngle(ko,s[2]),k=U.cx+V.x,D=U.cy+V.y}break}case z.Wall:{if((W==null?void 0:W.type)===z.Foundation){const V=me.absoluteCoordinates(n,o,r,U,W);k=V.x,D=V.y,L=V.z}break}case z.Roof:{if((W==null?void 0:W.type)===z.Foundation){const V=me.absoluteCoordinates(n,o,r,U,W);k=V.x,D=V.y,L=V.z}break}}const j=l/2,B=m.useMemo(()=>{if((U==null?void 0:U.type)===z.Wall){const G=U,q=W?W.rotation[2]+G.relativeAngle:G.relativeAngle;return new ln(Qt,0,q,"ZXY")}if((U==null?void 0:U.type)===z.Roof)return new ln(s[0],s[1],W?W.rotation[2]+s[2]:s[2],"ZXY");if((U==null?void 0:U.type)===z.Cuboid)return Pi.getRotationFromNormal(c);const V=new le().fromArray(c);return me.isSame(V,Op)?new ln(0,Qt,s[2],"ZXY"):me.isSame(V,Vp)?new ln(0,-Qt,s[2],"ZXY"):me.isSame(V,Yc)?new ln(-Qt,0,s[2],"ZXY"):me.isSame(V,_p)?new ln(Qt,0,s[2],"ZXY"):new ln(0,0,s[2])},[c,s,W==null?void 0:W.rotation]),O=m.useMemo(()=>(g||Y.t("shared.SensorElement",N))+(p?" ("+Y.t("shared.ElementLocked",N)+")":"")+` +`+Y.t("word.Coordinates",N)+": ("+k.toFixed(1)+", "+D.toFixed(1)+", "+L.toFixed(1)+") "+Y.t("word.MeterAbbreviation",N),[g,p,N,k,D,L]);return h.jsxs("group",{name:"Sensor Group "+e,rotation:B,position:[k,D,L+j],children:[h.jsx(si,{receiveShadow:T,uuid:e,ref:F,args:[i,a,l],name:"Sensor",onPointerDown:V=>{V.button!==2&&(w(e,V,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=y,G.oldParentId=y,G.oldFoundationId=S}),v(G=>{G.moveHandleType=zo.Default}))},onContextMenu:V=>{w(e,V,Xo.ContextMenu),v(G=>{V.intersections.length>0&&V.intersections[0].object===F.current&&(G.contextMenuObjectType=z.Sensor)})},onPointerOver:V=>{V.intersections.length>0&&V.intersections[0].object===F.current&&(H(!0),b.style.cursor="move")},onPointerOut:()=>{H(!1),b.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:t!=null&&t.lit?ga:u})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Meter",castShadow:!1,receiveShadow:!1,args:[i*.3,a*.3,j,8,1],position:new le(0,0,j),rotation:[Qt,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:"black"})}),!x&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:d,lineWidth:f}),x&&p&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:B0,lineWidth:f*10}),x&&!p&&h.jsx(Ps,{ref:E,position:new le(0,0,0),args:[Wg,6,6,0,Math.PI],name:zo.Default,onPointerDown:V=>{V.button===2?(w(e,V,Xo.ContextMenu),v(G=>{V.intersections.length>0&&V.intersections[0].object===E.current&&(G.contextMenuObjectType=z.Sensor)})):w(e,V,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(G=>{G.showWallIntersectionPlaneId=y,G.oldParentId=y,G.oldFoundationId=S}),v(G=>{G.moveHandleType=zo.Default})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(R||A)&&!x&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:O,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l+((t==null?void 0:t.labelHeight)??.2)]})]})}),H$e=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i=1,ly:a=1,lz:l=.1,rotation:s=[0,0,0],normal:c=[0,0,1],color:u="#ffff99",lineWidth:d=.1,locked:f=!1,label:p,showLabel:g=!1,parentId:A,foundationId:y,decay:S=2,distance:C=5,intensity:P=3,inside:v=!1}=t,T=M(pn),w=M(Cs),x=M(pu),R=M(Lw).z<=0,H=Tc(e),{gl:{domElement:F}}=ri(),[E,N]=m.useState(!1),U=m.useRef(null),W=m.useRef(null),k=$t(),D=M(ie=>{for(const Q of ie.elements)if(Q.id===A)return Q}),L=M(ie=>{for(const Q of ie.elements)if(Q.id===y)return Q});let j=.1,B=n,O=o,V=r;if(A&&D)switch(D.type){case z.Foundation:if(V=D.cz+D.lz/2,me.isZero(s[2]))B=D.cx+n*D.lx,O=D.cy+o*D.ly;else{const ie=new le(n*D.lx,o*D.ly,0);ie.applyAxisAngle(ko,s[2]),B=D.cx+ie.x,O=D.cy+ie.y}break;case z.Wall:if((L==null?void 0:L.type)===z.Foundation){const ie=me.absoluteCoordinates(n,o,r,D,L);B=ie.x,O=ie.y,V=ie.z}j=D.ly;break;case z.Roof:if((L==null?void 0:L.type)===z.Foundation){const ie=me.absoluteCoordinates(n,o,r,D,L);B=ie.x,O=ie.y,V=ie.z}j=D.thickness;break}const G=l/2,q=m.useMemo(()=>{if((D==null?void 0:D.type)===z.Wall){const Q=D,se=L?L.rotation[2]+Q.relativeAngle:Q.relativeAngle;return new ln(Qt,0,se,"ZXY")}if((D==null?void 0:D.type)===z.Roof)return new ln(s[0],s[1],L?L.rotation[2]+s[2]:s[2],"ZXY");if((D==null?void 0:D.type)===z.Cuboid)return Pi.getRotationFromNormal(c);const ie=new le().fromArray(c);return me.isSame(ie,Op)?new ln(0,Qt,s[2],"ZXY"):me.isSame(ie,Vp)?new ln(0,-Qt,s[2],"ZXY"):me.isSame(ie,Yc)?new ln(-Qt,0,s[2],"ZXY"):me.isSame(ie,_p)?new ln(Qt,0,s[2],"ZXY"):new ln(0,0,s[2])},[c,s,L,D]),$=m.useMemo(()=>(p||Y.t("shared.LightElement",k))+(f?" ("+Y.t("shared.ElementLocked",k)+")":"")+` +`+Y.t("word.Coordinates",k)+": ("+B.toFixed(1)+", "+O.toFixed(1)+", "+V.toFixed(1)+") "+Y.t("word.MeterAbbreviation",k),[p,f,k,B,O,V]);return h.jsxs("group",{name:"Light Group "+e,rotation:q,position:[B,O,V],children:[R&&h.jsx("pointLight",{color:u,name:"Point Light "+e,position:[0,0,v?-j-G:G],decay:S*.2,distance:C,intensity:P,castShadow:!0}),h.jsx(ma,{receiveShadow:w,userData:{unintersectable:!0},uuid:e,ref:U,position:[0,0,v?-j:0],rotation:[Qt,0,0],args:[i*.5,a*.5,G,16,1],name:"Light Base",onPointerDown:ie=>{ie.button!==2&&(x(e,ie,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(Q=>{Q.showWallIntersectionPlaneId=A,Q.oldParentId=A,Q.oldFoundationId=y}))},onContextMenu:ie=>{x(e,ie,Xo.ContextMenu),T(Q=>{ie.intersections.length>0&&ie.intersections[0].object===U.current&&(Q.contextMenuObjectType=z.Light)})},onPointerOver:ie=>{ie.intersections.length>0&&ie.intersections[0].object===U.current&&(N(!0),F.style.cursor="move")},onPointerOut:()=>{N(!1),F.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:"lightgray"})}),h.jsx(Ps,{userData:{unintersectable:!0},name:"Light Bulb",castShadow:!1,receiveShadow:w,args:[i*.3,8,8,0,sa,0,Math.PI],position:new le(0,0,v?-j-G:G),rotation:[Qt,0,0],children:R?h.jsx("meshBasicMaterial",{attach:"material",color:"white"}):h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),H&&f&&h.jsx(mw,{hx:i/2,hy:a/2,hz:l/2,lineColor:B0,lineWidth:d*10}),H&&!f&&h.jsx(Ps,{ref:W,position:new le(0,0,v?-j-G:G),args:[Wg,6,6,v?Math.PI:0,Math.PI],name:zo.Default,onPointerDown:ie=>{ie.button===2?(x(e,ie,Xo.ContextMenu),T(Q=>{ie.intersections.length>0&&ie.intersections[0].object===W.current&&(Q.contextMenuObjectType=z.Light)})):x(e,ie,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(Q=>{Q.showWallIntersectionPlaneId=A,Q.oldParentId=A,Q.oldFoundationId=y})},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),(E||g)&&!H&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:$,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(v?-j:0)+l+((t==null?void 0:t.labelHeight)??.2)]})]})}),Xv="Cuboid Wrapper",M$e="Cuboid Stackable Child",I$e=({elements:t,cuboidModel:e})=>{const{id:n,cx:o,cy:r,lx:i,ly:a,lz:l,rotation:s}=e,c=l/2,u=d=>C$e(d)&&d.parentId===n;return h.jsxs("group",{name:Xv,position:[o,r,c],rotation:[0,0,s[2]],userData:{id:n,fId:n},children:[h.jsx(IZt,{...e}),h.jsx(Kye,{parentId:n,foundationId:n,wrapperType:z.Cuboid,plx:i,ply:a,plz:l}),t.map(d=>{if(u(d))return h.jsx("group",{name:M$e,position:[0,0,c],children:h.jsx(I$e,{elements:t,cuboidModel:d})},d.id);if(d.parentId===n){const{lx:f,ly:p,lz:g}=e;switch(d.type){case z.Sensor:return h.jsx(R$e,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*g},d.id);case z.Light:return h.jsx(H$e,{...d,cx:d.cx*f,cy:d.cy*p,cz:d.cz*g},d.id);default:return null}}else return null})]})},aC=t=>{const[e,n]=m.useState(t);return m.useEffect(()=>{t!==e&&n(t)},[t]),[e,n]},kQ=(t,e)=>{const{gl:n}=ri(),[o,r]=m.useState(t),i=m.useRef(!1),a=m.useRef(!1);return m.useEffect(()=>{const u=()=>{i.current&&(i.current=!1,a.current||(r(t),n.domElement.style.cursor="default"))};return window.addEventListener("pointerup",u),()=>window.removeEventListener("pointerup",u)},[]),{_color:o,_onPointerDown:()=>{i.current=!0,setTimeout(()=>{n.domElement.style.cursor=e},10)},_onPointerMove:u=>{u.intersections.length==0||u.intersections[0].object!==u.object?(a.current=!1,r(t),n.domElement.style.cursor="default"):(a.current=!0,r(ga),n.domElement.style.cursor=e)},_onPointerLeave:()=>{a.current=!1,i.current||(r(t),n.domElement.style.cursor="default")}}},z$e=(t,e)=>{const[n,o]=m.useState(t),[r,i]=m.useState(e);return m.useEffect(()=>{o(t),i(e)},[t,e]),{materialLx:n,materialLy:r,setMaterialSize:(l,s)=>{l===Aa.ResizeX?s!==n&&o(Math.abs(s)):s!==r&&i(Math.abs(s))}}},D$e=t=>{const e=dt(hs),n=M(Pf),[o,r]=m.useState(null);return m.useEffect(()=>{if(e){const i=Cn.getState().getHeatmap(t);i&&r(me.fetchHeatmapTexture(i,n??5))}},[e,n]),o},zZt=(t,e,n,o,r,i)=>{const a=r??((n==null?void 0:n.color)==="Black"&&(n==null?void 0:n.cellType)==="Monocrystalline"?"silver":"white"),l=i??"gray",s=m.useMemo(()=>{if(!n)return null;const{cellType:d,length:f,width:p,m:g,n:A,color:y}=n;return o===vr.portrait?LSe(d,p,f,A,g,y,a,l):LSe(d,f,p,g,A,y,a,l)},[n,o,a,l]),[c,u]=m.useState(s);return m.useEffect(()=>{if(s&&n){const{length:d,width:f}=n,p=Math.max(1,Math.round(t/(o===vr.landscape?d:f))),g=Math.max(1,Math.round(e/(o===vr.landscape?f:d)));s.repeat.set(p,g),s.wrapS=s.wrapT=bs,u(s.clone())}},[s,t,e]),c},LSe=(t,e,n,o,r,i,a,l)=>{e*=cwe,n*=cwe;const s=document.createElement("canvas");[s.width,s.height]=[e,n];const c=s.getContext("2d");if(c){c.fillStyle=a,c.fillRect(0,0,e,n);const u=Math.max(e,n)*iAt;if(c.fillStyle=l,c.fillRect(u,u,e-2*u,n-2*u),c.fillStyle=i==="Black"?lAt:sAt,t==="Thin Film"){const d=u*.6;c.fillRect(d,d,e-d*2,n-d*2)}else{const d=Math.max(e,n)*aAt,f=u+d,p=(e-f*2-d*(o-1))/o,g=(n-f*2-d*(r-1))/r,A=p*.1,y=g*.1;if(t==="Monocrystalline")for(let S=0;S{const o=a5(),{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=kQ($a,"grab"),s=c=>{n(c),i()};return h.jsxs("group",{name:e,position:[0,t,0],rotation:[Qt,0,0],scale:o*3,onPointerDown:s,onPointerMove:a,onPointerLeave:l,children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:h.jsx("meshBasicMaterial",{color:r})}),h.jsx(ta,{args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1})]})}),DZt=be.memo(m.forwardRef(({tiltAngle:t,positionZ:e,isOnVerticalSurface:n,onPointerDown:o,onPointerMove:r},i)=>{const a=a5()*3,l=Math.PI/12,s=m.useMemo(()=>n?Qt:Math.PI,[n]),c=m.useMemo(()=>n?new Array(7).fill(0):new Array(13).fill(0),[n]),u=m.useMemo(()=>n?e:0,[n,e]),[d,f]=m.useState(!1),p=m.useRef(null),g=m.useRef(null),A=m.useRef(null),{_color:y,_onPointerDown:S,_onPointerMove:C,_onPointerLeave:P}=kQ($a,"grab");m.useImperativeHandle(i,()=>({setVisiable(x){p.current&&(p.current.visible=x)},update(x,b){g.current&&g.current.rotation.set(x,0,0),A.current&&(A.current.text=v(x)),p.current&&(p.current.position.z=b)}}),[]);const v=x=>{const b=n?-x:x;return`${Math.floor(b/Math.PI*180)}°`},T=x=>{f(!0),o(x),S()},w=x=>{r(x)};return m.useEffect(()=>{const x=()=>{f(!1)};return window.addEventListener("pointerup",x),()=>window.addEventListener("pointerup",x)},[]),h.jsxs("group",{name:"Tilt_Handle_Group",ref:p,position:[0,0,u],children:[h.jsx(wG,{name:Di.Tilt,args:[a,1.125*a,18,2,0,s],rotation:[Qt,0,Qt,"ZXY"],onPointerDown:T,onPointerMove:C,onPointerLeave:P,children:h.jsx("meshBasicMaterial",{side:ti,color:y})}),d&&h.jsxs(h.Fragment,{children:[h.jsx(wG,{name:"Tilt_Handle_Intersection_Plane",args:[a,2*a,18,2,0,s],rotation:[Qt,0,Qt,"ZXY"],onPointerMove:w,children:h.jsx("meshBasicMaterial",{transparent:!0,depthTest:!1,opacity:.5,side:ti})}),h.jsx("group",{rotation:[-Qt,0,0],children:c.map((x,b)=>{const R=n?`${90-b*15}°`:`${b*15-90}°`;return h.jsxs("group",{rotation:[l*b,0,0,"ZXY"],children:[h.jsx(Gn,{points:[[0,0,1.8*a],[0,0,2*a]],color:"white",transparent:!0,opacity:.5}),h.jsx("textSprite",{userData:{unintersectable:!0},text:R,fontSize:20*a,fontFace:"Times Roman",textHeight:.15*a,position:[0,0,1.6*a]})]},b)})}),h.jsxs("group",{ref:g,rotation:[t,0,0],children:[h.jsx(Gn,{points:[[0,0,a],[0,0,1.75*a]]}),h.jsx("textSprite",{ref:A,userData:{unintersectable:!0},text:v(t),fontSize:20*a,fontFace:"Times Roman",textHeight:.2*a,position:[0,0,.75*a]})]})]})]})})),EZt=be.memo(()=>h.jsxs("group",{name:"Normal Pointer Group",children:[h.jsx(Gn,{points:[[0,0,0],[0,0,1]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),h.jsx(xf,{position:[0,0,1],rotation:[Qt,0,0],userData:{unintersectable:!0},args:[.04,.2,4,2],children:h.jsx("meshBasicMaterial",{color:"white"})})]})),FZt=be.memo(be.forwardRef(({positionZ:t,rotationX:e,topTiltGroupRef:n},o)=>{const r=M(ay),i=M(Al),a=M(s0),l=m.useMemo(()=>Math.max(100,10*r),[r]),s=m.useMemo(()=>ki(new Date(i),a),[i,a]),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),[f,p]=m.useState(null),[g,A]=m.useState(null),[y,S]=m.useState(new le),[C,P]=m.useState(!1),v=H=>{H?C||P(!0):C&&P(!1)},T=H=>!(s.z<0||H<0||H>90),w=()=>n.current?n.current.getWorldDirection(sl).angleTo(s)/Math.PI*180:-1,x=H=>H.toFixed(1)+"°",b=()=>{if(!n.current||!c.current)return null;const H=Hu.setFromQuaternion(c.current.getWorldQuaternion(yd)).z;Hu.set(0,0,-H);const F=c.current.getWorldPosition(ade),E=n.current.localToWorld(sl.set(0,0,.5)).sub(F).applyEuler(Hu),N=u.current.localToWorld(i9.set(0,0,.5)).sub(F).applyEuler(Hu);return[E.clone(),N.clone()]},R=H=>{if(!f||f.length!==2||!H||H.length!==2)return!1;const[F,E]=H,[N,U]=f;return me.isSame(F,N)&&me.isSame(E,U)};return m.useImperativeHandle(o,()=>({setPositionZ(H){c.current&&(c.current.position.z=H)},setRotationX(H){c.current&&(c.current.rotation.x=H)}}),[]),m.useEffect(()=>{if(!n.current)return;const H=w();if(T(H))v(!0);else{v(!1);return}A(x(H));const E=b();if(p(E),E&&E.length===2){const[N,U]=E,W=new le().addVectors(N,U).divideScalar(2).multiplyScalar(1.5);S(W)}},[]),Z2(()=>{if(!n.current)return;const H=w();if(T(H))v(!0);else{v(!1);return}u.current&&u.current.lookAt(u.current.getWorldPosition(sl).add(s));const E=b();if(R(E)||p(E),d.current&&(E==null?void 0:E.length)===2){const[N,U]=E;d.current.position.addVectors(N,U).divideScalar(2).multiplyScalar(1.5),d.current.text=x(H)}}),C?h.jsxs("group",{ref:c,position:[0,0,t],rotation:[e,0,0],children:[h.jsx(Gn,{name:"Sun Beam",ref:u,points:[[0,0,0],[0,0,l]],userData:{unintersectable:!0},lineWidth:.5,color:"white"}),f&&y&&g&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{name:"Angle Line",points:f,userData:{unintersectable:!0},lineWidth:1,color:"white"}),h.jsx("textSprite",{ref:d,position:y,text:g,userData:{unintersectable:!0},fontSize:20,fontFace:"Times Roman",textHeight:.1})]})]}):null})),kZt=be.memo(m.forwardRef(({tiltAngle:t,trackerType:e,surfaceType:n,children:o},r)=>{const i=m.useRef(null),a=M(Al),l=M(s0),s=m.useRef(new le),c=m.useMemo(()=>{const f=ki(new Date(a),l);return s.current.copy(f),f},[a,l]),u=()=>{i.current&&i.current.rotation.set(0,0,0)},d=(f,p)=>{if(i.current)switch(f){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{i.current.rotation.set(Math.atan2(Math.hypot(s.current.x,s.current.y),s.current.z),0,Math.atan2(s.current.y,s.current.x)+Qt-p,"ZXY");break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{i.current.rotation.set(t,0,Math.atan2(s.current.y,s.current.x)+Qt-p,"ZXY");break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const g=new le().copy(s.current).applyEuler(Hu.set(0,0,-p));i.current.rotation.set(0,Math.atan2(g.x,g.z),0,"ZXY");break}}};return m.useImperativeHandle(r,()=>({reset(){u()},update(f,p){d(f,p)}}),[]),m.useEffect(()=>{if(!i.current)return;if(e===Ll.NO_TRACKER||n!==oh.Horizontal){u();return}const f=Pi.findParentGroup(i.current,[Fm,Xv]);f&&d(e,Hu.setFromQuaternion(f.getWorldQuaternion(yd)).z)},[c,e,n]),h.jsx("group",{ref:i,children:o})})),LZt=({solarPanel:t,lx:e,ly:n})=>{const{id:o,tiltAngle:r,pvModelName:i,orientation:a,color:l}=t,s=dt(hs),c=M(Ju)??!1,u=M(vge),d=M(DH),f=M(EH),g=m.useMemo(()=>({...f,...d}),[d,f])[i],A=zZt(e,n,g,a,t.frameColor,t.backsheetColor),y=D$e(o),S=()=>s&&y?h.jsx("meshBasicMaterial",{attach:"material-4",map:y}):A?c||u===0?h.jsx("meshStandardMaterial",{attach:"material-4",map:A,color:l}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr((g==null?void 0:g.color)==="Blue"?lwe:yG),shininess:u??rw,side:Da,map:A,color:l}):null,C=()=>(g==null?void 0:g.bifacialityFactor)===0||c?h.jsx("meshStandardMaterial",{attach:"material-5",color:l}):A?h.jsx("meshPhongMaterial",{attach:"material-5",specular:new rr((g==null?void 0:g.color)==="Blue"?lwe:yG),shininess:u??rw,side:Da,map:A,color:l}):null;return h.jsxs(h.Fragment,{children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:l}),h.jsx("meshStandardMaterial",{attach:"material-1",color:l}),h.jsx("meshStandardMaterial",{attach:"material-2",color:l}),h.jsx("meshStandardMaterial",{attach:"material-3",color:l}),S(),C()]})},WZt=be.memo(m.forwardRef(({lx:t,ly:e,poleRadius:n,poleHeight:o,poleSpacing:r,tiltAngle:i,color:a,visiable:l},s)=>{const c=M(v=>v.elements.length>100?2:4),[u,d]=aC(t),[f,p]=aC(e),[g,A]=aC(i),[y,S]=aC(l),C=m.useRef(null);m.useImperativeHandle(s,()=>({update({lx:v,ly:T,tilt:w}){v!==void 0&&d(v),T!==void 0&&p(T),w!==void 0&&A(w)},setVisiable(v){S(v)}}),[]);const P=m.useMemo(()=>{const v=[],T=Math.floor(.5*u/r),w=Math.floor(.5*f*Math.abs(Math.cos(g))/r),x=Math.tan(g);for(let b=-T;b<=T;b++)for(let R=-w;R<=w;R++){const H=b*r,F=R*r,E=x*F+o,N=(E-o)/2;v.push(new qa(H,F,N,E))}return v},[u,f,g,r,o]);return y?h.jsx("group",{name:"Poles group",ref:C,position:[0,0,-o/2],children:P.map((v,T)=>v.w<0?null:h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+T,args:[n,n,v.w,c,1],position:[v.x,v.y,v.z],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{color:a})},T))}):null})),NZt=be.memo(({hlx:t,hly:e})=>h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-t,-e,0],[-t,e,0],[t,e,0],[t,-e,0],[-t,-e,0]],lineWidth:3,color:B0})),UZt=be.memo(({solarPanel:t,boxRef:e})=>{const{ly:n,tiltAngle:o,label:r,locked:i,labelColor:a="white",labelFontSize:l=20,labelSize:s=.2,labelHeight:c}=t,u=n/2,d=$t(),[f,p]=m.useState("");m.useEffect(()=>{if(!e.current)return;const{x:A,y,z:S}=e.current.getWorldPosition(sl);p((r??Y.t("shared.SolarPanelElement",d))+(i?" ("+Y.t("shared.ElementLocked",d)+")":"")+(r?"":` +`+Y.t("word.Coordinates",d)+": ("+A.toFixed(1)+", "+y.toFixed(1)+", "+S.toFixed(1)+") "+Y.t("word.MeterAbbreviation",d)))},[r,i,d]);const g=c??Math.max(u*Math.abs(Math.sin(o))+.1,.2);return h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:f,color:a,fontSize:l,textHeight:s,position:[0,0,g]})}),E$e=be.memo(({onPointerDown:t})=>{const{_color:e,_onPointerDown:n,_onPointerMove:o,_onPointerLeave:r}=kQ(iw,"move"),i=a5()*.75,{gl:a}=ri();return h.jsx(Ps,{name:"Move_Handle",args:[i],onPointerDown:l=>{t(l),n(),a.domElement.style.cursor="move"},onPointerMove:o,onPointerLeave:r,children:h.jsx("meshBasicMaterial",{color:e})})}),Jv=be.memo(({cx:t,cy:e,size:n,type:o})=>{const{_color:r,_onPointerDown:i,_onPointerMove:a,_onPointerLeave:l}=kQ($a,"pointer");return h.jsx(si,{name:o,position:[t,e,.1],args:[n,n,.1],onPointerDown:i,onPointerMove:a,onPointerLeave:l,children:h.jsx("meshBasicMaterial",{color:r})})}),jZt=be.memo(m.forwardRef(({hlx:t,hly:e,onPointerDown:n},o)=>{const r=a5();return h.jsxs("group",{name:"Resize_Handles_Group",ref:o,onPointerDown:n,children:[h.jsx(Jv,{type:Mt.Left,cx:-t,cy:0,size:r}),h.jsx(Jv,{type:Mt.Right,cx:t,cy:0,size:r}),h.jsx(Jv,{type:Mt.Lower,cx:0,cy:-e,size:r}),h.jsx(Jv,{type:Mt.Upper,cx:0,cy:e,size:r})]})})),BZt=be.memo(({children:t,onPointerOut:e,onPointerOver:n})=>{const o=M(Cs);return h.jsx(si,{name:"Box_Mesh",receiveShadow:o,castShadow:o,onPointerOver:n,onPointerOut:e,children:t})}),YZt=({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>{const a=[],[l,s,c]=[t/2,e/2,n/2];let u,d;o===vr.portrait?(u=Math.max(1,Math.round(t/i)),d=Math.max(1,Math.round(e/r))):(u=Math.max(1,Math.round(t/r)),d=Math.max(1,Math.round(e/i)));const f=t/u,p=e/d;for(let g=0;g<=u;g++)a.push({points:[new le(-l+g*f,-s,c),new le(-l+g*f,s,c)]});for(let g=0;g<=d;g++)a.push({points:[new le(-l,-s+g*p,c),new le(l,-s+g*p,c)]});return h.jsx("group",{name:"Solar Panel Heatmap Lines Group",position:[0,0,.005],children:a.map((g,A)=>h.jsx(Gn,{name:"Solar Panel Lines",userData:{unintersectable:!0},points:g.points,lineWidth:.2},A))})},OZt=be.memo(({lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i})=>dt(hs)?h.jsx(YZt,{lx:t,ly:e,lz:n,orientation:o,modelLength:r,modelWidth:i}):null),F$e=be.memo(m.forwardRef(({lx:t,ly:e,relativeAzimuth:n},o)=>{const r=Math.max(5,Math.hypot(t,e)*.75),i=m.useMemo(()=>new Array(25).fill(0),[]),a=r3(hW,mN),l=r*.05,s={font:a,height:0,size:l},c=f=>f===0?-l*.3:f>0&&f<7?-l*.8:-l*1.2,[u,d]=m.useState(n);return m.useImperativeHandle(o,()=>({setAzimuth:f=>{f<-Math.PI?d(f+Math.PI*2):f>Math.PI?d(f-Math.PI*2):d(f)}})),h.jsxs("group",{rotation:[Qt,0,0],position:[0,0,.1],name:"Solar Panel Polar Grid Group",children:[h.jsx("polarGridHelper",{args:[r,24,6,120,"white","white"],userData:{unintersectable:!0}}),h.jsx(wG,{args:[r*.98,r,24,1,Qt,u],userData:{unintersectable:!0},rotation:[-Qt,0,0],children:h.jsx("meshBasicMaterial",{side:ti,color:"yellow"})}),h.jsx("group",{rotation:[0,u,0],children:h.jsx("mesh",{position:[-.5,0,-r*.9],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:h.jsx("textGeometry",{args:[`${-me.toDegrees(u).toFixed(1)}°`,s]})})}),i.map((f,p)=>{let g=Math.ceil(p/2)*(p%2===0?1:-1);g===-12&&(g=12);const A=c(Math.abs(g));return h.jsx("group",{rotation:[0,g*Math.PI/12,0],children:h.jsxs("mesh",{position:[A,0,-r*1.05],rotation:[-Qt,0,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[`${-15*g}°`,s]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},p)})]})})),VZt=be.memo(m.forwardRef(({lx:t,ly:e,tiltAngle:n,modelLength:o,visiable:r},i)=>{const a=M(Cs),l=.75,s=(v,T)=>{const w=T*l,x=Math.cos(v),b=v/2,R=w*Math.sin(b)*2,H=b;return{cz:(w-T/2)*x+R*Math.sin(H),mountAngle:H,length:R}},{cz:c,mountAngle:u,length:d}=m.useMemo(()=>s(n,e),[n,e]),[f,p]=aC(t),[g,A]=aC(r),y=m.useMemo(()=>{const v=[];let w=Math.round(f/o)%2===0?o/2:0;for(;w({update(v,T){if(S.current&&C.current&&P.current){const{cz:w,mountAngle:x,length:b}=s(-v,T);S.current.position.y=-w,C.current.rotation.x=-x,P.current.position.z=b/2,P.current.scale.z=b-.025}},resizeX(v){p(v)},setVisiable(v){A(v)}}));const S=m.useRef(null),C=m.useRef(null),P=m.useRef(null);return g?h.jsx("group",{ref:S,position:[0,-c,0],castShadow:a,receiveShadow:a,children:h.jsx("group",{ref:C,rotation:[-u,0,0],children:h.jsx("group",{ref:P,position:[0,0,d/2],scale:[1,1,d-.025],children:y.map((v,T)=>h.jsx(si,{position:[v,0,0],args:[.05,.05,1],children:h.jsx("meshStandardMaterial",{color:"#BFBFBF"})},T))})})}):null}));var Aa=(t=>(t.Move="Move",t.RotateUpper="RotateUpper",t.RotateLower="RotateLower",t.ResizeX="ResizeX",t.ResizeY="ResizeY",t.ResizeHeight="ResizeHeight",t.Tilt="Tilt",t.None="None",t))(Aa||{}),oh=(t=>(t.Vertical="Vertical",t.Horizontal="Horizontal",t.Inclined="Inclined",t))(oh||{});const _Zt="Intersection Plane XY",AO=1,WSe=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,rotation:l,normal:s,relativeAzimuth:c,tiltAngle:u,parentType:d,drawSunBeam:f,trackerType:p=Ll.NO_TRACKER,pvModelName:g="SPR-X21-335-BLK",orientation:A=vr.landscape,poleHeight:y,poleRadius:S,poleSpacing:C,color:P="white",locked:v}=t,T=m.useMemo(()=>Pi.getPVModel(g),[g]),w=Math.max(T.thickness,.02),[x,b,R]=[i/2,a/2,w/2],H=Tc(e),{materialLx:F,materialLy:E,setMaterialSize:N}=z$e(i,a),{set:U,get:W,raycaster:k}=ri(),D=M(pn),[L,j]=m.useState(!1),[B,O]=m.useState(!1),[V,G]=m.useState(!1),q=m.useRef(null),$=m.useRef(null),ie=m.useRef(null),Q=m.useRef(null),se=m.useRef(null),oe=m.useRef(null),Z=m.useRef(null),te=m.useRef(null),ee=m.useRef(null),de=m.useRef(null),fe=m.useRef(null),pe=m.useRef(null),ye=m.useRef(null),ae=m.useRef(null),Te=m.useRef(new le),ge=m.useRef(new le),Se=m.useRef(null),Re=m.useRef(null),De=m.useRef(null),Ae=m.useRef(null),ue=m.useRef(null),he=m.useMemo(()=>Pi.getSurfaceType(d,new le().fromArray(s)),[d,s]),ve=m.useMemo(()=>Pi.isTrackerEnabled(he,p),[he,p]),we=m.useMemo(()=>-b*Math.sin(Math.min(0,u)),[u,b]),Pe=m.useMemo(()=>{switch(he){case"Horizontal":return R+y;case"Vertical":return R+we;case"Inclined":return R}},[y,R,he,we]),Ie=m.useMemo(()=>H&&!v,[H,v]),Me=m.useMemo(()=>H&&he==="Horizontal"&&!ve&&!v,[H,he,p,ve,v]),ze=m.useMemo(()=>!H||ve||v?!1:he==="Vertical"||he==="Horizontal"&&y>0,[H,he,y,ve,v]),Ne=m.useMemo(()=>y>0&&he==="Horizontal",[y,he]),Je=m.useMemo(()=>he==="Vertical",[he]),Ue=pt=>{U({frameloop:pt})},nt=()=>{if(!se.current)return;const[pt,Wt]=se.current.scale.toArray().map(ht=>ht/2);if(oe.current)for(const ht of oe.current.children)switch(ht.name){case Mt.Left:{ht.position.x=-pt;break}case Mt.Right:{ht.position.x=pt;break}case Mt.Upper:{ht.position.y=Wt;break}case Mt.Lower:{ht.position.y=-Wt;break}}if(Z.current)for(const ht of Z.current.children)switch(ht.name){case Di.Lower:{ht.position.y=-Wt-AO;break}case Di.Upper:{ht.position.y=Wt+AO;break}}},We=pt=>{if(!pt)return;const[Wt,ht,ct]=Pi.getRotationOnCuboid(pt);Ee(Wt,ht,ct),me.isEqual(pt.z,1)?ae.current!==null?ie.current.rotation.z=ae.current-Hu.z:ie.current.rotation.z=c:ie.current.rotation.set(0,0,0)},Ee=(pt,Wt,ht)=>{q.current&&q.current.rotation.set(pt,Wt,ht,"ZXY"),ee.current&&ee.current.setRotationX(-pt)},ke=pt=>{ie.current&&(ie.current.position.z=pt),ee.current&&ee.current.setPositionZ(pt)},Oe=(pt,Wt)=>{Q.current&&(Q.current.rotation.x=pt),te.current&&te.current.update(pt,Wt),de.current&&de.current.update({tilt:pt}),ye.current&&ye.current.update(pt,a)},st=(pt,Wt)=>{const ht=kn.getState().solarPanelCountRef;ht&&ht.current&&(ht.current.textContent=`${Pi.getRackCount(A,pt,Wt,T.length,T.width)}`)},je=pt=>{pe.current&&pe.current.setAzimuth(pt)},xt=pt=>{ye.current&&ye.current.resizeX(Math.abs(pt))},gt=pt=>{ye.current&&ye.current.update(u,Math.abs(pt))},Ye=(pt,Wt,ht)=>{switch(ht){case"Move":{const ct=pt.intersectObjects(Wt.children);for(const It of ct){if(It.object.name===pX){const Ft=It.object.parent;return Ft?{intersection:It,parentGroup:Ft,parentType:z.Foundation}:null}if(It.object.name.includes(Eu.WALL_OUTSIDE_SURFACE_MESH_NAME)){const Ft=It.object.parent;return Ft?{intersection:It,parentGroup:Ft,parentType:z.Wall}:null}if(It.object.name.includes("Roof")){const Ft=Pi.findParentGroup(It.object,[pX]);return Ft?{intersection:It,parentGroup:Ft,parentType:z.Roof}:null}if(It.object.name.includes("Cuboid")){const Ft=Pi.findParentGroup(It.object,[Xv]);return Ft?{intersection:It,parentGroup:Ft,parentType:z.Cuboid}:null}}break}case"ResizeX":case"ResizeY":case"RotateLower":case"RotateUpper":{if(!B||!fe.current||!ue.current)return null;const ct=pt.intersectObjects([fe.current]),It=ct[0];return!It||me.isEqual(It.point.z,0)?null:{intersection:ct[0],parentGroup:ue.current,parentType:d}}}return null},it=(pt,Wt)=>{const{length:ht,width:ct}=Pi.getUnitSize(A,T.length,T.width);return pt==="ResizeX"?(Wt-ht&&(Wt=ht),Math.round(Wt/ht)*ht):pt==="ResizeY"?(Wt-ct&&(Wt=ct),Math.round(Wt/ct)*ct):Wt},ut=(pt,Wt)=>{if(Wt==="ResizeX")return pt;{const ht=Math.abs(2*y/Math.sin(u));return me.clamp(pt,-ht,ht)}},Qe=(pt,Wt,ht,ct)=>{var Ft;const It=Wt.children.find(Ve=>Ve.name===sde);if(It&&pt&&It!==pt){pt.children=pt.children.filter(ft=>ft!==q.current),It.children.push(q.current),q.current.parent=It;const Ve=(Ft=It.parent)==null?void 0:Ft.userData;if(Ve&&Ve.id&&Ve.fId&&(Se.current=Ve.id,Re.current=Ve.fId),ht===z.Roof){const ft=Pi.getRoofId(ct);ft&&(Se.current=ft)}}De.current=ht},lt=pt=>{pt.intersections.length==0||pt.intersections[0].object!==pt.object||(pt.stopPropagation(),pt.button===2?(M.getState().selectedElementIdSet.has(e)||Pi.setSelected(e,!0),D(Wt=>{Wt.contextMenuObjectType=z.SolarPanel})):Pi.setSelected(e,!0))},Ze=pt=>{if(!H||!q.current||!ie.current||pt.intersections.length==0||pt.intersections[0].object!==pt.object)return;Ue("always"),kn.getState().setEnableOrbitController(!1),Ae.current="Move";const Wt=Pi.findParentGroup(q.current,[Fm,Xv]);Wt&&(ae.current=Hu.setFromQuaternion(Wt.getWorldQuaternion(yd.set(0,0,0,0))).z+c)},Be=pt=>{if(!(!H||!q.current||!ie.current)&&!(pt.intersections.length==0||pt.intersections[0].object!==pt.object)){switch(Ue("always"),kn.getState().setEnableOrbitController(!1),pt.object.name){case Mt.Left:case Mt.Right:{Ae.current="ResizeX";break}case Mt.Upper:case Mt.Lower:{Ae.current="ResizeY";break}}he==="Horizontal"?(ie.current.localToWorld(Te.current.set(-pt.object.position.x,-pt.object.position.y*Math.abs(Math.cos(u)),-R-y)),q.current.getWorldPosition(ge.current).sub(Te.current).normalize()):(ie.current.localToWorld(Te.current.set(-pt.object.position.x,-pt.object.position.y,0)),ie.current.getWorldPosition(ge.current).sub(Te.current).normalize()),O(!0),ue.current=Pi.findParentGroup(q.current,[k$e,Fm,Xv])}},$e=pt=>{if(!(!ie.current||!Z.current)&&!(pt.intersections.length==0||pt.intersections[0].object!==pt.object)){switch(Ue("always"),kn.getState().setEnableOrbitController(!1),pt.eventObject.name){case Di.Upper:{Ae.current="RotateUpper";break}case Di.Lower:{Ae.current="RotateLower";break}}ie.current.getWorldPosition(Te.current),Te.current.z=0,O(!0),G(!0),ue.current=Pi.findParentGroup(q.current,[Fm,Xv])}},wt=pt=>{pt.intersections.length==0||pt.intersections[0].object!==pt.object||(Ae.current="Tilt",Ue("always"),kn.getState().setEnableOrbitController(!1),he==="Vertical"?q.current.getWorldPosition(Te.current):ie.current.getWorldPosition(Te.current))},vt=pt=>{if(!ie.current||!Q.current||!te.current)return;const Wt=sl.subVectors(pt.point,Te.current),ht=ie.current.localToWorld(i9.set(0,-1,0)).sub(Te.current),ct=Wt.angleTo(ht),Ft=Math.sign(Qt-ct)*Wt.angleTo(ie.current.getWorldDirection(ade));if(he==="Vertical"){const Ve=Ft>0?-Ft:Ft,ft=R-b*Math.sin(Ve);ke(ft),Oe(Ve,-ft)}else{const Ve=y>=b?Qt:Math.asin(y/b);Oe(me.clamp(Ft,-Ve,Ve),0)}},Rt=m.useCallback(()=>{if(!Ae.current)return;const pt=M.getState().elements.find(ht=>ht.id===e);switch(Ae.current){case"Move":{D(ht=>{if(!q.current||!Ae.current)return;const ct=kn.getState().pointer;k.setFromCamera(ct,W().camera);const It=Ye(k,W().scene,Ae.current),Ft=ht.elements.find(Ve=>Ve.id===e);if(Ft)if(Ft.parentId!==Se.current&&Se.current&&Re.current&&(Ft.parentId=Se.current,Ft.foundationId=Re.current),De.current&&De.current!==Ft.parentType&&(Ft.parentType=De.current),Ft.parentType===z.Wall){const Ve=ht.elements.find(ft=>ft.id===Ft.parentId);Ve&&(Ft.cx=q.current.position.x/Ve.lx,Ft.cy=0,Ft.cz=q.current.position.z/Ve.lz,Ft.rotation=[Qt,0,0],Ft.normal=[0,-1,0])}else if(Ft.cx=q.current.position.x,Ft.cy=q.current.position.y,Ft.cz=q.current.position.z,ae.current!==null&&(It!=null&&It.parentGroup)&&(Ft.relativeAzimuth=ae.current-Hu.setFromQuaternion(It.parentGroup.getWorldQuaternion(yd.set(0,0,0,0))).z),It!=null&&It.intersection)if(Pi.getSurfaceType(It.parentType,It.intersection.normal)==="Horizontal")Ft.rotation=[0,0,0],Ft.normal=[0,0,1];else{const{x:ft,y:kt,z:rt}=q.current.rotation,at=sl.set(0,0,1).applyEuler(q.current.rotation);Ft.rotation=[ft,kt,rt],Ft.normal=[at.x,at.y,at.z]}else{const{x:Ve,y:ft,z:kt}=q.current.rotation,rt=sl.set(0,0,1).applyEuler(q.current.rotation);Ft.rotation=[Ve,ft,kt],Ft.normal=[rt.x,rt.y,rt.z]}});break}case"ResizeX":case"ResizeY":{D(ht=>{if(!se.current||!q.current)return;const ct=ht.elements.find(It=>It.id===e);if(ct)if(ct.lx=se.current.scale.x,ct.ly=se.current.scale.y,ct.parentType===z.Wall){const It=ht.elements.find(Ft=>Ft.id===ct.parentId);It&&(ct.cx=q.current.position.x/It.lx,ct.cy=0,ct.cz=q.current.position.z/It.lz)}else ct.parentType===z.Roof&&(ht.updateElementOnRoofFlag=!ht.updateElementOnRoofFlag),[ct.cx,ct.cy,ct.cz]=q.current.position});break}case"RotateLower":case"RotateUpper":{D(ht=>{if(!ie.current)return;const ct=ht.elements.find(Ft=>Ft.id===e);if(!ct)return;const It=Pi.getRelativeAzimuth(ie.current.rotation.z);ct.relativeAzimuth=It});break}case"Tilt":{D(ht=>{if(!Q.current)return;const ct=ht.elements.find(It=>It.id===e);ct&&(ct.tiltAngle=Q.current.rotation.x)});break}}const Wt=M.getState().elements.find(ht=>ht.id===e);pt&&Wt&&(Pi.isNewPositionOk(Wt)?Pi.addUndoable(pt,Ae.current):setTimeout(()=>{D(ht=>{const ct=ht.elements.findIndex(It=>It.id===e);ct!==-1&&(ht.elements[ct]=pt)})},10)),W().frameloop!=="demand"&&Ue("demand"),kn.getState().setEnableOrbitController(!0),Ae.current=null,ae.current=null,Se.current=null,Re.current=null,De.current=null,ue.current=null,O(!1),G(!1)},[]);m.useEffect(()=>(window.addEventListener("pointerup",Rt),()=>window.removeEventListener("pointerup",Rt)),[Rt]),Z2(({camera:pt,scene:Wt,raycaster:ht})=>{if(!q.current||!ie.current||!H||!Ae.current||Ae.current==="Tilt")return;const ct=kn.getState().pointer;ht.setFromCamera(ct,pt);const It=Ye(ht,Wt,Ae.current);if(!It)return;const{intersection:Ft,parentGroup:Ve,parentType:ft}=It,kt=Ft.point;switch(Ae.current){case"Move":{if(!ft)break;switch(Qe(q.current.parent,Ve,ft,Ft.object),ft){case z.Foundation:{q.current.position.x=kt.x-Ve.position.x,q.current.position.y=kt.y-Ve.position.y,q.current.position.z=kt.z-Ve.position.z,q.current.position.applyEuler(Hu.set(0,0,-Ve.rotation.z)),Ee(0,0,0),ae.current!==null?ie.current.rotation.z=ae.current-Ve.rotation.z:ie.current.rotation.z=c;break}case z.Wall:{const at=Pi.findParentGroup(Ve,[Fm]);at&&(Ve.localToWorld(sl.set(0,0,0)),i9.set(0,0,0).subVectors(kt,sl).applyEuler(Hu.set(0,0,-at.rotation.z-Ve.rotation.z)),q.current.position.x=i9.x,q.current.position.y=0,q.current.position.z=i9.z,Ee(Qt,0,0),ie.current.rotation.set(0,0,0));break}case z.Roof:{const at=Pi.getRoofSegmentData(Ft.object);if(at){const{roofId:Ge,foundation:yt,centroid:Pt,roofSegments:ot}=at;if(yt&&Pt&&ot&&Ge){const bt=new le().subVectors(kt,new le(yt.cx,yt.cy,yt.cz)).applyEuler(new ln(0,0,-yt.rotation[2])),zt=bt.clone().sub(Pt),{normal:Bt,rotation:tt}=bn.computeState(ot,zt);q.current.position.x=bt.x,q.current.position.y=bt.y,q.current.position.z=bt.z,me.isEqual(tt[0],0)?(Ee(0,0,0),ae.current!==null?ie.current.rotation.set(0,0,ae.current-Ve.rotation.z):ie.current.rotation.set(0,0,c)):(Ee(tt[0],tt[1],tt[2]),ie.current.rotation.set(0,0,0))}}break}case z.Cuboid:Ve.getWorldPosition(sl),Ve.getWorldQuaternion(yd),Hu.setFromQuaternion(yd),q.current.position.subVectors(kt,sl).applyQuaternion(yd.invert()),We(Ft.normal)}const rt=Pi.getSurfaceType(ft,Ft.normal);switch(rt==="Horizontal"?(de.current&&de.current.setVisiable(!0),ye.current&&ye.current.setVisiable(!1),ke(y+R)):(de.current&&de.current.setVisiable(!1),ye.current&&ye.current.setVisiable(!0),ke(R)),rt){case"Horizontal":{Oe(u,0);break}case"Vertical":{const at=Math.min(0,u),Ge=R-b*Math.sin(at);ke(Ge),Oe(at,-Ge);break}case"Inclined":{Oe(0,0);break}}Pi.isTrackerEnabled(rt,p)?(ie.current.rotation.set(0,0,0),Q.current.rotation.set(0,0,0),$.current.update(p,Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z)):$.current.reset();break}case"ResizeX":case"ResizeY":{const rt=Te.current,at=sl.subVectors(kt,rt),Ge=ge.current,yt=at.angleTo(Ge),Pt=at.length()*Math.cos(yt),ot=it(Ae.current,Pt);if(he==="Vertical"){const bt=q.current.getWorldPosition(sl).sub(ie.current.getWorldPosition(i9)),zt=ade.copy(Ge).multiplyScalar(ot/2).add(rt).add(bt).sub(Ve.getWorldPosition(cX)).applyQuaternion(Ve.getWorldQuaternion(yd).invert());q.current.position.x=zt.x,q.current.position.z=zt.z,ft===z.Cuboid&&(q.current.position.y=zt.y),Ae.current==="ResizeX"?(se.current.scale.x=Math.abs(ot),xt(ot)):Ae.current==="ResizeY"&&(se.current.scale.y=Math.abs(ot),gt(ot),ft===z.Wall&&ke(Math.abs(ot/2*Math.sin(Math.min(0,u))))),N(Ae.current,ot)}else{const bt=ut(ot,Ae.current),zt=sl.copy(Ge).multiplyScalar(bt/2).add(rt).sub(Ve.getWorldPosition(cX)).applyQuaternion(Ve.getWorldQuaternion(yd).invert()),Bt=Math.abs(bt);Ae.current==="ResizeX"?(se.current.scale.x=Bt,de.current&&de.current.update({lx:Bt})):Ae.current==="ResizeY"&&(se.current.scale.y=Bt,de.current&&de.current.update({ly:Bt})),q.current.position.x=zt.x,q.current.position.y=zt.y,q.current.position.z=zt.z,N(Ae.current,bt)}nt(),st(se.current.scale.x,se.current.scale.y);break}case"RotateUpper":{sl.subVectors(kt,Te.current).setZ(0);let rt=sl.angleTo(i9.set(0,1,0));sl.x>0&&(rt=-rt),ie.current.rotation.z=rt-Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z,je(ie.current.rotation.z);break}case"RotateLower":{sl.subVectors(kt,Te.current).setZ(0);let rt=sl.angleTo(i9.set(0,-1,0));sl.x<0&&(rt=-rt),ie.current.rotation.z=rt-Hu.setFromQuaternion(Ve.getWorldQuaternion(yd)).z,je(ie.current.rotation.z);break}}});const Gt=m.useMemo(()=>he==="Horizontal"&&!ve?new ln(0,0,c,"ZXY"):new ln(0,0,0,"ZXY"),[he,c,ve]),At=m.useMemo(()=>ve?new ln(0,0,0,"ZXY"):he==="Horizontal"&&y>0?new ln(u,0,0,"ZXY"):he==="Vertical"?new ln(Math.min(0,u),0,0,"ZXY"):new ln(0,0,0,"ZXY"),[y,he,u,ve]);return h.jsxs("group",{name:`Ref_Solar_Panel_Group ${e}`,ref:q,position:[n,o,r],rotation:[l[0],l[1],l[2],"ZXY"],onPointerDown:lt,children:[h.jsxs("group",{name:"Top_Azimuth_Group",ref:ie,position:[0,0,Pe],rotation:Gt,children:[h.jsx(kZt,{ref:$,tiltAngle:u,trackerType:p,surfaceType:he,children:h.jsxs("group",{name:"Top_Tilt_Group",ref:Q,rotation:At,children:[h.jsxs("group",{ref:se,scale:[i,a,w],children:[h.jsx(BZt,{onPointerOver:()=>j(!0),onPointerOut:()=>j(!1),children:h.jsx(LZt,{solarPanel:t,lx:F,ly:E})}),h.jsx(ta,{name:"Solar Panel Simulation Plane",uuid:e,userData:{simulation:!0},visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})})]}),H&&v&&h.jsx(NZt,{hlx:x,hly:b}),h.jsx(OZt,{lx:F,ly:E,lz:w,orientation:A,modelLength:T.length,modelWidth:T.width}),Ie&&h.jsxs(h.Fragment,{children:[h.jsx(E$e,{onPointerDown:Ze}),h.jsx(jZt,{ref:oe,hlx:x,hly:b,onPointerDown:Be})]}),f&&h.jsx(EZt,{})]})}),B&&h.jsx(ta,{name:_Zt,ref:fe,args:[1e4,1e4],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Me&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:Z,children:[h.jsx(hX,{name:Di.Upper,positionY:b+AO,onPointerDown:$e}),h.jsx(hX,{name:Di.Lower,positionY:-b-AO,onPointerDown:$e})]}),ze&&h.jsx(DZt,{ref:te,tiltAngle:u,positionZ:-we,isOnVerticalSurface:he==="Vertical",onPointerDown:wt,onPointerMove:vt}),h.jsx(WZt,{ref:de,lx:i,ly:a,tiltAngle:u,poleHeight:y,poleRadius:S,poleSpacing:C,color:P,visiable:Ne}),(L||t.showLabel)&&!H&&h.jsx(UZt,{solarPanel:t,boxRef:se})]}),f&&h.jsx(FZt,{ref:ee,topTiltGroupRef:Q,positionZ:Pe,rotationX:-l[0]}),h.jsx(VZt,{ref:ye,tiltAngle:-u,lx:i,ly:a,modelLength:T.length,visiable:Je}),V&&h.jsx(F$e,{ref:pe,lx:i,ly:a,relativeAzimuth:c})]})}),sde="Solar_Panels_Wrapper_Group",Kye=be.memo(({parentId:t,foundationId:e,wrapperType:n,plx:o,ply:r,plz:i})=>{const a=m.useCallback(s=>{if(s.type!==z.SolarPanel)return!1;const c=s;switch(n){case z.Foundation:return c.foundationId===e&&(c.parentType===z.Foundation||c.parentType===z.Roof);case z.Cuboid:return c.foundationId===e&&c.parentType===z.Cuboid;case z.Wall:return s.parentId===t&&c.parentType===z.Wall}return!1},[t,e,n]),l=M(s=>s.elements.filter(a),cy);switch(n){case z.Foundation:case z.Cuboid:return h.jsx("group",{name:sde,children:l.map(s=>h.jsx(WSe,{...s},s.id))});case z.Wall:return h.jsx("group",{name:sde,children:l.map(s=>h.jsx(WSe,{...s,cx:s.cx*o,cz:s.cz*i},s.id))});default:return null}}),GZt=be.memo(({parentId:t,foundationId:e,parentLx:n,parentLz:o})=>{const r=a=>a.type!==z.BatteryStorage?!1:a.parentId===t;return M(a=>a.elements.filter(r),cy).map(a=>h.jsx(XZt,{...a,cx:a.cx*n,cz:a.cz*o},a.id))}),XZt=t=>{const{id:e,cx:n,cz:o,lx:r,ly:i,lz:a,color:l}=t,s=i/2,c=M(pn),u=Tc(e),d=f=>{f.intersections.length==0||f.intersections[0].object!==f.object||(f.stopPropagation(),Pi.setSelected(e,!0),f.button===2&&c(p=>{p.contextMenuObjectType=z.SolarPanel}))};return h.jsxs("group",{name:`Battery_Storag_Group ${e}`,position:[n,0,o],onPointerDown:d,children:[h.jsx(si,{args:[r,i,a],position:[0,-s,0],children:h.jsx("meshStandardMaterial",{color:l})}),u&&h.jsx(Ps,{args:[.2],position:[0,-i,0]})]})},k$e="Wall_Group",JZt=({wallModel:t,foundationModel:e})=>{const{id:n,roofId:o,cx:r,cy:i,lx:a,ly:l,lz:s,relativeAngle:c,fill:u,locked:d,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialHeight:g,rightTopPartialHeight:A,leftJoints:y,rightJoints:S,parentId:C}=t,P=Tc(n),[v,T]=[a/2,s/2],w=u===Fl.Partial,x=y.length>0?t.leftRoofHeight:s,b=S.length>0?t.rightRoofHeight:s,R=x??s,H=b??s,F=w?Math.min(R,g):R,E=w?Math.min(H,A):H,N=a===0,U=()=>u===Fl.Empty?h.jsx(fZt,{...t}):h.jsx(_en,{wallModel:t,foundationModel:e});return h.jsxs("group",{name:`${k$e} ${n}`,position:[r,i,T],rotation:[0,0,c],userData:{aabb:!0,id:n,fId:C},children:[h.jsx(Kye,{parentId:n,foundationId:C,wrapperType:z.Wall,plx:a,ply:l,plz:s}),h.jsx(GZt,{parentId:n,foundationId:C,parentLx:a,parentLz:s}),U(),P&&!d&&h.jsxs(h.Fragment,{children:[a>.5&&h.jsx(pZt,{ply:l,phz:T}),h.jsx(mZt,{id:n,parentLz:e.lz,roofId:o,absAngle:c+e.rotation[2],x:v,z:T,leftUnfilledHeight:f,rightUnfilledHeight:p,leftTopPartialResizeHandleHeight:F,rightTopPartialResizeHandleHeight:E,fill:u,wallLeftHeight:R,wallRightHeight:H,highLight:N,leftJoints:y,rightJoints:S})]})]})},KZt=(t,e)=>t.wallModel===e.wallModel,qZt=be.memo(JZt,KZt),L$e="Building Group",$Zt=t=>{const{id:e,lx:n,ly:o,lz:r}=t,i=l=>l.foundationId!==e?!1:l.type===z.Wall||l.type===z.Roof||l.type===z.SolarPanel&&l.parentType===z.Roof||l.type===z.Window&&l.parentType===z.Roof,a=M(l=>l.elements.filter(i),cy);return a.length===0?null:h.jsx("group",{name:L$e,position:[0,0,r/2],children:a.map(l=>{switch(l.type){case z.Wall:return h.jsx(qZt,{wallModel:l,foundationModel:t},l.id);case z.Roof:return h.jsx(ZQt,{roofModel:l,foundationModel:t},l.id);case z.Window:return h.jsx(B$e,{...l,cz:l.cz},l.id);default:return null}})})},QZt=(t,e)=>t.lx===e.lx&&t.ly===e.ly&&t.lz===e.lz&&t.rotation===e.rotation,ZZt=be.memo($Zt,QZt),NSe=be.memo(({hx:t,hy:e,position:n,direction:o,color:r})=>{if(n===null)return null;const[i,a]=n,l=[];if(o==="x")l.push([-t,a,0]),l.push([t,a,0]);else if(o==="y")l.push([i,-e,0]),l.push([i,e,0]);else return o==="xy"?h.jsxs(h.Fragment,{children:[h.jsx(Gn,{points:[[-t,a,0],[t,a,0]],color:r}),h.jsx(Gn,{points:[[i,-e,0],[i,e,0]],color:r})]}):null;return h.jsx(Gn,{points:l,color:r})});class Rv{static addUndoable(e,n){if(e)switch(n){case Aa.Move:{Rv.addUndoableMove(e);break}case Aa.ResizeX:{Rv.addUndoableResize(e,"X");break}case Aa.ResizeY:{Rv.addUndoableResize(e,"Y");break}case Aa.ResizeHeight:{Rv.addUndoablResizeHeight(e);break}case Aa.RotateLower:case Aa.RotateUpper:{Rv.addUndoableRotate(e);break}}}static addUndoableMove(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Move Water Heater",timestamp:Date.now(),movedElementId:n.id,movedElementType:n.type,oldCx:e.cx,oldCy:e.cy,oldCz:e.cz,newCx:n.cx,newCy:n.cy,newCz:n.cz,oldParentType:e.parentType,newParentType:n.parentType,oldParentId:e.parentId,newParentId:n.parentId,oldFoundationId:e.foundationId,newFoundationId:n.foundationId,oldNormal:new le().fromArray(e.normal),newNormal:new le().fromArray(n.normal),oldRotation:[...e.rotation],newRotation:[...n.rotation],undo(){r(this.movedElementId,[this.oldCx,this.oldCy,this.oldCz],this.oldParentId,this.oldFoundationId,this.oldParentType,this.oldRotation,this.oldNormal)},redo(){r(this.movedElementId,[this.newCx,this.newCy,this.newCz],this.newParentId,this.newFoundationId,this.newParentType,this.newRotation,this.newNormal)}};M.getState().addUndoable(o);const r=(i,a,l,s,c,u,d)=>{M.getState().set(f=>{const p=f.elements.find(g=>g.id===i);!p||p.type!==z.SolarWaterHeater||([p.cx,p.cy,p.cz]=[...a],l&&(p.parentId=l),s&&(p.foundationId=s),c&&(p.parentType=c),u&&(p.rotation=[...u]),d&&(p.normal=[d.x,d.y,d.z]))})}}static addUndoableResize(e,n){const o=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!o)return;const r={name:`Resize Water Heater ${n}`,timestamp:Date.now(),id:o.id,oldPos:[e.cx,e.cy,e.cz],oldDms:[e.lx,e.ly,e.lz],oldRot:[...e.rotation],oldNor:[...e.normal],newPos:[o.cx,o.cy,o.cz],newDms:[o.lx,o.ly,o.lz],newRot:[...o.rotation],newNor:[...o.normal],undo(){M.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.oldPos],[a.lx,a.ly,a.lz]=[...r.oldDms],a.normal=[...r.oldNor],a.rotation=[...r.oldRot];break}})},redo(){M.getState().set(i=>{for(const a of i.elements)if(a.id===r.id){[a.cx,a.cy,a.cz]=[...r.newPos],[a.lx,a.ly,a.lz]=[...r.newDms],a.normal=[...r.newNor],a.rotation=[...r.newRot];break}})}};M.getState().addUndoable(r)}static addUndoablResizeHeight(e){const n=M.getState().elements.find(r=>r.id===e.id&&r.type===z.SolarWaterHeater);if(!n)return;const o={name:"Resize Solar Water Heater Height",timestamp:Date.now(),changedElementId:n.id,oldValue:e.lz,newValue:n.lz,undo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.oldValue;break}})},redo(){M.getState().set(r=>{for(const i of r.elements)if(i.id===o.changedElementId){i.lz=o.newValue;break}})}};M.getState().addUndoable(o)}static addUndoableRotate(e){const n=M.getState().elements.find(i=>i.id===e.id&&i.type===z.SolarWaterHeater);if(!n)return;const o={name:"Rotate Water Heater",timestamp:Date.now(),changedElementId:n.id,oldValue:e.relativeAzimuth,newValue:n.relativeAzimuth,changedElementType:z.SolarWaterHeater,undo:()=>{r(o.oldValue)},redo:()=>{r(o.newValue)}};M.getState().addUndoable(o);const r=i=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===o.changedElementId&&s.type===z.SolarWaterHeater);l&&(l.relativeAzimuth=i)})}}}const een=be.memo(({waterTankLength:t,waterTankRadius:e,panelWidth:n})=>{const o=t/2,r=n/2,i=r+e;return h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-o,-r,0],[-o,i,0],[o,i,0],[o,-r,0],[-o,-r,0]],lineWidth:3,color:B0})}),ten=(t,e)=>{const[n,o]=m.useState(Jz),r=m.useMemo(()=>Math.max(1,Math.round(t/.15)),[t]);return m.useEffect(()=>{Jz&&(Jz.repeat.set(r,1),Jz.wrapS=bs,o(Jz.clone()))},[r]),n},nen=()=>{const t=document.createElement("canvas");[t.width,t.height]=[100,100];const e=t.getContext("2d");if(e){e.fillStyle="#A3A3A3",e.fillRect(0,0,100,15);const n=e.createLinearGradient(0,15,0,35);n.addColorStop(0,"#C0C0C0"),n.addColorStop(1,"#E0E0E0"),e.fillStyle=n,e.fillRect(0,15,100,20);const o=e.createLinearGradient(0,35,0,100);o.addColorStop(0,"#949494"),o.addColorStop(.6,"#464646"),o.addColorStop(.85,"#616161"),o.addColorStop(1,"#4B4B4B"),e.fillStyle=o,e.fillRect(0,35,100,65)}return new g8(t)},oen=()=>{const t=document.createElement("canvas");[t.width,t.height]=[130,100];const e=t.getContext("2d");if(e){e.fillStyle="#768ca6",e.fillRect(10,0,15,100);const n=e.createLinearGradient(25,0,45,0);n.addColorStop(0,"#7ea4cf"),n.addColorStop(1,"#9ab7d9"),e.fillStyle=n,e.fillRect(25,0,20,100);const o=e.createLinearGradient(45,0,110,0);o.addColorStop(0,"#6F87A1"),o.addColorStop(.6,"#30455B"),o.addColorStop(.85,"#496279"),o.addColorStop(1,"#3E536B"),e.fillStyle=o,e.fillRect(45,0,65,100)}return new g8(t)},Jz=oen(),eae=nen(),USe=be.memo(m.forwardRef(({id:t,lx:e,ly:n,side:o},r)=>{const{materialLx:i,materialLy:a,setMaterialSize:l}=z$e(e,n),s=dt(hs),c=M(Ju)??!1,u=M(vge),d=ten(i),f=D$e(t),p=()=>s&&f?h.jsx("meshBasicMaterial",{map:f,side:o}):d?c||u===0?h.jsx("meshStandardMaterial",{map:d,side:o,transparent:!0}):h.jsx("meshPhongMaterial",{specular:new rr(yG),shininess:u??rw,side:o,map:d,transparent:!0}):null;return m.useImperativeHandle(r,()=>({update(g,A){g!==void 0&&l(Aa.ResizeX,g),A!==void 0&&l(Aa.ResizeY,A)}})),h.jsx(h.Fragment,{children:p()})})),ren=()=>{const t=M(Ju)??!1,e=M(vge),n=()=>eae?t||e===0?h.jsx("meshStandardMaterial",{map:eae}):h.jsx("meshPhongMaterial",{specular:new rr(yG),shininess:e??rw,map:eae}):null;return h.jsx(h.Fragment,{children:n()})},ien=be.memo(({solarWaterHeater:t,groupRef:e})=>{const{label:n,locked:o,labelColor:r="white",labelFontSize:i=20,labelSize:a=.2,labelHeight:l=2}=t,s=$t(),[c,u]=m.useState("");return m.useEffect(()=>{if(!e.current)return;const{x:d,y:f,z:p}=e.current.getWorldPosition(sl);u((n??Y.t("shared.SolarWaterHeaterElement",s))+(o?" ("+Y.t("shared.ElementLocked",s)+")":"")+(n?"":` +`+Y.t("word.Coordinates",s)+": ("+d.toFixed(1)+", "+f.toFixed(1)+", "+p.toFixed(1)+") "+Y.t("word.MeterAbbreviation",s)))},[n,o,s]),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:c,color:r,fontSize:i,textHeight:a,position:[0,0,l]})}),jSe="Mount Left",BSe="Mount Right",W$e=.3,aen=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l,waterTankRadius:s=W$e,rotation:c,normal:u,relativeAzimuth:d,parentType:f,locked:p,color:g="grey"}=t,A=Math.hypot(l-s,a),y=i+.25,S=l-s*2,C=Math.atan2(l-s,a),P=.5,v=m.useRef(null),T=m.useRef(null),w=m.useRef(null),x=m.useRef(null),b=m.useRef(new le),R=m.useRef(new le),H=m.useRef(null),F=m.useRef(null),E=m.useRef(null),N=m.useRef(null),U=m.useRef(null),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(null),j=m.useRef(null),B=m.useRef(null),O=m.useRef(null),V=m.useRef(null),G=m.useRef(null),q=m.useRef(null),$=m.useRef(null),ie=m.useRef(null),Q=m.useRef(null),se=m.useRef(null),oe=m.useRef(null),Z=M(Cs),te=dt(hs),[ee,de]=m.useState(!1),[fe,pe]=m.useState(!1),[ye,ae]=m.useState(null),[Te,ge]=m.useState(!1),[Se,Re]=m.useState(!1),De=Tc(e),Ae=a5(),{set:ue,get:he,raycaster:ve}=ri(),we=m.useMemo(()=>Pi.getSurfaceType(f,new le().fromArray(u)),[f,u]),Pe=m.useMemo(()=>we===oh.Horizontal?new ln(0,0,d,"ZXY"):new ln(0,0,0,"ZXY"),[we,d]),Ie=m.useMemo(()=>De&&we===oh.Horizontal&&!p,[De,we,p]),Me=M(pn),ze=Ye=>{ue({frameloop:Ye})},Ne=(Ye,it,ut)=>{switch(ut){case Aa.Move:{const Qe=Ye.intersectObjects(it.children);for(const lt of Qe)if(lt.object.name.includes("Roof")){const Ze=Pi.findParentGroup(lt.object,[pX]);return Ze?{intersection:lt,parentGroup:Ze,parentType:z.Roof}:null}break}case Aa.ResizeX:case Aa.ResizeY:case Aa.RotateLower:case Aa.RotateUpper:{if(!ee||!V.current||!H.current)return null;const Qe=Ye.intersectObjects([V.current]),lt=Qe[0];return!lt||me.isEqual(lt.point.z,0)?null:{intersection:Qe[0],parentGroup:H.current,parentType:f}}case Aa.ResizeHeight:{if(!fe||!G.current||!H.current)return null;const Qe=Ye.intersectObjects([G.current]),lt=Qe[0];return!lt||me.isEqual(lt.point.z,0)?null:{intersection:Qe[0],parentGroup:H.current,parentType:f}}}return null},Je=(Ye,it,ut)=>{F.current&&F.current.rotation.set(Ye,it,ut,"ZXY")},Ue=(Ye,it,ut,Qe)=>{var Ze;const lt=it.children.find(Be=>Be.name===N$e);if(lt&&Ye&<!==Ye){Ye.children=Ye.children.filter($e=>$e!==F.current),lt.children.push(F.current),F.current.parent=lt;const Be=(Ze=lt.parent)==null?void 0:Ze.userData;if(Be&&Be.id&&Be.fId&&(w.current=Be.id,x.current=Be.fId),ut===z.Roof){const $e=Pi.getRoofId(Qe);$e&&(w.current=$e)}}},nt=(Ye,it)=>{if(j.current&&Ye!==null){const ut=Ye/2;for(const Qe of j.current.children)switch(Qe.name){case Mt.Left:{Qe.position.x=-ut;break}case Mt.Right:{Qe.position.x=ut;break}}}if(B.current&&it!==null&&(B.current.position.y=-it/2),O.current&&it!==null)for(const ut of O.current.children)switch(ut.name){case Di.Lower:{ut.position.y=-it/2-P;break}case Di.Upper:{ut.position.y=it/2+s+P;break}}if(N.current&&it!==null&&(N.current.position.y=it/2),L.current&&Ye!==null&&(L.current.scale.y=Ye+.25),q.current&&Ye!==null)for(const ut of q.current.children)switch(ut.name){case jSe:{ut.position.x=-Ye*.4;break}case BSe:{ut.position.x=Ye*.4;break}}},We=Ye=>{$.current&&$.current.setAzimuth(Ye)},Ee=Ye=>{Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(Ye.stopPropagation(),Ye.button===2?(M.getState().selectedElementIdSet.has(e)||Pi.setSelected(e,!0),Me(it=>{it.contextMenuObjectType=z.SolarWaterHeater})):Pi.setSelected(e,!0))},ke=Ye=>{if(!De||!F.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)return;ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.Move;const it=Pi.findParentGroup(F.current,[Fm]);it&&(T.current=Hu.setFromQuaternion(it.getWorldQuaternion(yd.set(0,0,0,0))).z+d)},Oe=Ye=>{if(!(!De||!F.current||!E.current)&&!(Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)){switch(ze("always"),kn.getState().setEnableOrbitController(!1),Ye.object.name){case Mt.Left:case Mt.Right:{v.current=Aa.ResizeX;break}case Mt.Upper:case Mt.Lower:{v.current=Aa.ResizeY;break}}we===oh.Horizontal?(E.current.localToWorld(b.current.set(-Ye.object.position.x,-Ye.object.position.y,0)),F.current.getWorldPosition(R.current).sub(b.current).normalize()):(E.current.localToWorld(b.current.set(-Ye.object.position.x,-Ye.object.position.y,0)),E.current.getWorldPosition(R.current).sub(b.current).normalize()),de(!0),ae(S/2),H.current=Pi.findParentGroup(F.current,[Fm])}},st=Ye=>{!De||!F.current||!N.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.ResizeY,we===oh.Horizontal?(N.current.localToWorld(b.current.set(0,0,0)),F.current.getWorldPosition(R.current).sub(b.current).normalize()):(E.current.localToWorld(b.current.set(0,0,0)),E.current.getWorldPosition(R.current).sub(b.current).normalize()),de(!0),ae(0),H.current=Pi.findParentGroup(F.current,[Fm]))},je=Ye=>{!De||!F.current||!E.current||Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object||(ze("always"),kn.getState().setEnableOrbitController(!1),v.current=Aa.ResizeHeight,H.current=Pi.findParentGroup(F.current,[Fm]),pe(!0),setTimeout(()=>{if(G.current){const it=he().camera.position;Ye.intersections[0].object.localToWorld(sl.set(0,0,-l)),G.current.lookAt(it.x,it.y,sl.z),Ye.intersections[0].object.localToWorld(b.current.set(0,0,-l)),setTimeout(()=>{G.current.userData.state=!0},10)}},0))},xt=Ye=>{if(!(!E.current||!O.current)&&!(Ye.intersections.length==0||Ye.intersections[0].object!==Ye.object)){switch(ze("always"),kn.getState().setEnableOrbitController(!1),Ye.eventObject.name){case Di.Upper:{v.current=Aa.RotateUpper;break}case Di.Lower:{v.current=Aa.RotateLower;break}}E.current.getWorldPosition(b.current),b.current.z=0,de(!0),ae(S/2),Re(!0),H.current=Pi.findParentGroup(F.current,[Fm])}},gt=m.useCallback(()=>{if(!v.current)return;const Ye=M.getState().elements.find(ut=>ut.id===e);switch(v.current){case Aa.Move:{Me(ut=>{if(!F.current||!v.current)return;const Qe=kn.getState().pointer;ve.setFromCamera(Qe,he().camera);const lt=Ne(ve,he().scene,v.current),Ze=ut.elements.find(Be=>Be.id===e);if(Ze)if(Ze.parentId!==w.current&&w.current&&x.current&&(Ze.parentId=w.current,Ze.foundationId=x.current),Ze.cx=F.current.position.x,Ze.cy=F.current.position.y,Ze.cz=F.current.position.z,T.current!==null&&(lt!=null&<.parentGroup)&&(Ze.relativeAzimuth=T.current-Hu.setFromQuaternion(lt.parentGroup.getWorldQuaternion(yd.set(0,0,0,0))).z),lt!=null&<.intersection)if(Pi.getSurfaceType(lt.parentType,lt.intersection.normal)===oh.Horizontal)Ze.rotation=[0,0,0],Ze.normal=[0,0,1];else{const{x:$e,y:wt,z:vt}=F.current.rotation,Rt=sl.set(0,0,1).applyEuler(F.current.rotation);Ze.rotation=[$e,wt,vt],Ze.normal=[Rt.x,Rt.y,Rt.z]}else{const{x:Be,y:$e,z:wt}=F.current.rotation,vt=sl.set(0,0,1).applyEuler(F.current.rotation);Ze.rotation=[Be,$e,wt],Ze.normal=[vt.x,vt.y,vt.z]}});break}case Aa.ResizeX:{Me(ut=>{if(!D.current||!F.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.lx=D.current.scale.x,Qe.parentType===z.Roof&&(ut.updateElementOnRoofFlag=!ut.updateElementOnRoofFlag),[Qe.cx,Qe.cy,Qe.cz]=F.current.position)});break}case Aa.ResizeY:{Me(ut=>{if(!D.current||!N.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.ly=N.current.position.y*2,Qe.parentType===z.Roof&&(ut.updateElementOnRoofFlag=!ut.updateElementOnRoofFlag),[Qe.cx,Qe.cy,Qe.cz]=F.current.position)});break}case Aa.ResizeHeight:{Me(ut=>{if(!U.current)return;const Qe=ut.elements.find(lt=>lt.id===e);Qe&&(Qe.lz=U.current.position.z+s)});break}case Aa.RotateLower:case Aa.RotateUpper:{Me(ut=>{if(!E.current)return;const Qe=ut.elements.find(Ze=>Ze.id===e);if(!Qe)return;const lt=Pi.getRelativeAzimuth(E.current.rotation.z);Qe.relativeAzimuth=lt});break}}const it=M.getState().elements.find(ut=>ut.id===e);Ye&&it&&(Pi.isNewPositionOk(it)?Rv.addUndoable(Ye,v.current):setTimeout(()=>{Me(ut=>{const Qe=ut.elements.findIndex(lt=>lt.id===e);Qe!==-1&&(ut.elements[Qe]=Ye)})},10)),he().frameloop!=="demand"&&ze("demand"),kn.getState().setEnableOrbitController(!0),v.current=null,T.current=null,w.current=null,x.current=null,H.current=null,de(!1),ae(null),pe(!1),Re(!1)},[]);return m.useEffect(()=>(window.addEventListener("pointerup",gt),()=>window.removeEventListener("pointerup",gt)),[gt]),Z2(({camera:Ye,scene:it,raycaster:ut})=>{if(!F.current||!E.current||!De||!v.current)return;const Qe=kn.getState().pointer;ut.setFromCamera(Qe,Ye);const lt=Ne(ut,it,v.current);if(!lt)return;const{intersection:Ze,parentGroup:Be,parentType:$e}=lt,wt=Ze.point;switch(v.current){case Aa.Move:{if(!$e)break;switch(Ue(F.current.parent,Be,$e,Ze.object),$e){case z.Roof:{const vt=Pi.getRoofSegmentData(Ze.object);if(vt){const{roofId:Rt,foundation:Gt,centroid:At,roofSegments:pt}=vt;if(Gt&&At&&pt&&Rt){const Wt=new le().subVectors(wt,new le(Gt.cx,Gt.cy,Gt.cz)).applyEuler(new ln(0,0,-Gt.rotation[2])),ht=Wt.clone().sub(At),{normal:ct,rotation:It}=bn.computeState(pt,ht);F.current.position.x=Wt.x,F.current.position.y=Wt.y,F.current.position.z=Wt.z,me.isEqual(It[0],0)?(Je(0,0,0),T.current!==null?E.current.rotation.set(0,0,T.current-Be.rotation.z):E.current.rotation.set(0,0,d)):(Je(It[0],It[1],It[2]),E.current.rotation.set(0,0,0))}}break}}break}case Aa.ResizeX:{const vt=b.current,Rt=sl.subVectors(wt,vt),Gt=R.current,At=Rt.angleTo(Gt),pt=Rt.length()*Math.cos(At);if(we!==oh.Vertical){const Wt=sl.copy(Gt).multiplyScalar(pt/2).add(vt).sub(Be.getWorldPosition(cX)).applyQuaternion(Be.getWorldQuaternion(yd).invert()),ht=Math.abs(pt);D.current.scale.x=ht,F.current.position.x=Wt.x,F.current.position.y=Wt.y,F.current.position.z=Wt.z,se.current&&se.current.update(D.current.scale.x),nt(ht,null)}break}case Aa.ResizeY:{const vt=b.current,Rt=sl.subVectors(wt,vt),Gt=R.current,At=Rt.angleTo(Gt),pt=Math.cos(At)>0?Rt.length()*Math.cos(At):.1;if(we!==oh.Vertical){const Wt=l-s,ht=Math.hypot(pt,Wt),ct=Math.asin(Wt/ht),It=sl.copy(Gt).multiplyScalar(pt/2).add(vt).sub(Be.getWorldPosition(cX)).applyQuaternion(Be.getWorldQuaternion(yd).invert());F.current.position.x=It.x,F.current.position.y=It.y,W.current.rotation.x=ct,k.current.position.y=-ht/2,D.current.scale.y=ht,nt(null,pt)}break}case Aa.RotateUpper:{sl.subVectors(wt,b.current).setZ(0);let vt=sl.angleTo(i9.set(0,1,0));sl.x>0&&(vt=-vt),E.current.rotation.z=vt-Hu.setFromQuaternion(Be.getWorldQuaternion(yd)).z,We(E.current.rotation.z);break}case Aa.RotateLower:{sl.subVectors(wt,b.current).setZ(0);let vt=sl.angleTo(i9.set(0,-1,0));sl.x<0&&(vt=-vt),E.current.rotation.z=vt-Hu.setFromQuaternion(Be.getWorldQuaternion(yd)).z,We(E.current.rotation.z);break}case Aa.ResizeHeight:{if(G.current.userData.state&&U.current){const vt=Math.max(wt.z-b.current.z,s*2),Rt=vt-s,Gt=vt-s*2,At=Math.hypot(Rt,a);U.current.position.z=Rt,W.current&&q.current&&(q.current.scale.y=Gt,q.current.position.z=Gt/2,W.current.rotation.x=Math.asin(Rt/At),k.current.position.y=-At/2,D.current.scale.y=At,O.current&&(O.current.position.z=Gt/2))}break}}}),h.jsxs("group",{ref:F,position:[n,o,r],rotation:[c[0],c[1],c[2],"ZXY"],onPointerDown:Ee,onPointerOver:()=>ge(!0),onPointerOut:()=>ge(!1),children:[h.jsxs("group",{ref:E,rotation:Pe,children:[h.jsxs("group",{ref:N,position:[0,a/2,0],children:[h.jsxs("group",{ref:U,position:[0,0,s+S],children:[h.jsxs("group",{ref:Q,children:[h.jsx(ma,{ref:L,args:[s,s,1],castShadow:Z&&!te,receiveShadow:Z&&!te,rotation:[0,0,Qt],scale:[1,y,1],children:h.jsx("meshStandardMaterial",{color:g,roughness:.2})}),De&&h.jsx(si,{ref:ie,args:[Ae,.1,Ae],position:[0,0,s],onPointerDown:je,children:h.jsx("meshBasicMaterial",{color:"white"})})]}),h.jsx("group",{ref:W,rotation:[C,0,0],children:h.jsxs("group",{ref:k,position:[0,-A/2,0],children:[h.jsxs("group",{ref:D,scale:[i,A,1],children:[h.jsx(ta,{castShadow:!1,receiveShadow:Z,children:h.jsx(USe,{ref:se,id:e,lx:i,ly:a,side:Da})}),!te&&h.jsx(ta,{receiveShadow:Z,position:[0,-.475,.001],args:[1,.05],children:h.jsx(ren,{})}),Z&&h.jsx(ta,{castShadow:Z,receiveShadow:!1,position:[0,0,-.05],children:h.jsx(USe,{ref:oe,id:e,lx:i,ly:a,side:r0})}),h.jsx(ta,{name:"Water Heater Simulation Plane",uuid:e,userData:{simulation:!0},position:[0,0,.001],visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})})]}),De&&!p&&h.jsxs(h.Fragment,{children:[h.jsx(E$e,{onPointerDown:ke}),h.jsxs("group",{name:"X_Resize_Handles_Group",ref:j,onPointerDown:Oe,children:[h.jsx(Jv,{cx:i/2,cy:0,type:Mt.Right,size:Ae}),h.jsx(Jv,{cx:-i/2,cy:0,type:Mt.Left,size:Ae})]})]}),De&&p&&h.jsx(een,{waterTankLength:y,waterTankRadius:s,panelWidth:A})]})})]}),h.jsxs("group",{ref:q,position:[0,0,S/2],rotation:[Qt,0,0],scale:[1,S+.1,1],children:[h.jsx(ma,{name:jSe,args:[.05,.05,1],position:[-i*.4,0,0],castShadow:Z,children:h.jsx("meshStandardMaterial",{color:"grey"})}),h.jsx(ma,{name:BSe,args:[.05,.05,1],position:[i*.4,0,0],castShadow:Z,children:h.jsx("meshStandardMaterial",{color:"grey"})})]}),fe&&h.jsx(ta,{ref:G,args:[1e4,1e4],rotation:[Qt,0,0,"ZXY"],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})})]}),De&&!p&&h.jsx("group",{name:"Y_Resize_Handles_Group",ref:B,position:[0,-a/2,0],onPointerDown:st,children:h.jsx(Jv,{cx:0,cy:0,type:Mt.Lower,size:Ae})}),Ie&&h.jsxs("group",{name:"Rotate_Handles_Group",ref:O,position:[0,0,S/2],children:[h.jsx(hX,{name:Di.Upper,positionY:a/2+s+P,onPointerDown:xt}),h.jsx(hX,{name:Di.Lower,positionY:-a/2-P,onPointerDown:xt})]}),(Te||t.showLabel)&&!De&&h.jsx(ien,{solarWaterHeater:t,groupRef:F})]}),ee&&ye!==null&&h.jsx(ta,{ref:V,args:[1e4,1e4],position:[0,0,ye],visible:!1,children:h.jsx("meshBasicMaterial",{color:"darkgrey"})}),Se&&h.jsx(F$e,{ref:$,lx:i,ly:a,relativeAzimuth:d})]})}),N$e="Water_Heater_Wrapper_Group",len=be.memo(({foundationId:t,wrapperType:e})=>{const n=m.useCallback(r=>{if(r.type!==z.SolarWaterHeater)return!1;const i=r;switch(e){case z.Foundation:return i.foundationId===t&&i.parentType===z.Roof;case z.Cuboid:case z.Wall:}return!1},[t,e]),o=M(r=>r.elements.filter(n),cy);switch(e){case z.Foundation:return h.jsx("group",{name:N$e,children:o.map(r=>h.jsx(aen,{...r},r.id))});default:return null}}),Fm="Foundation_Group",pX="Foundation",sen=be.memo(t=>{const{id:e,cx:n,cy:o,lx:r=1,ly:i=1,lz:a=.1,rotation:l=[0,0,0],color:s="gray",lineColor:c="black",lineWidth:u=.2,locked:d=!1,showLabel:f=!1,textureType:p=_i.NoTexture,solarStructure:g}=t,A=Tc(e),y=M(m0),S=M(Ju),C=M(Jn),P=M(Db),v=M(pn),T=M(u3),w=M(Uge),x=M(d3),b=M(Fw),R=M(Qge),H=M(Zge),F=M(wxt),E=M(Qq),N=M(hYe),U=M(kw),W=M(YYe),k=M(OYe),D=M(Ap),L=M(pu),j=M(_ge),B=M(t5),O=M(fxt),V=M(Axt),G=M(Cs),q=M(mA),$=M(r$),ie=M(En),Q=M(qge),se=M(Nge),oe=M(ly),Z=dt(hs),te=M(Pf),ee=M(xge),de=Cn(c1),{camera:fe,gl:{domElement:pe}}=ri(),[ye,ae]=m.useState(!1),[Te,ge]=m.useState(null),[Se,Re]=m.useState(!1),[De,Ae]=m.useState({show:!1,direction:null,position:null}),[ue,he]=m.useState([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]),ve=m.useRef(null),we=m.useRef(!1),Pe=m.useRef(!1),Ie=m.useRef(null),Me=m.useRef(Jr.null),ze=m.useRef(new Map),Ne=m.useRef(null),Je=m.useRef(null),Ue=m.useRef(null),nt=m.useRef(null),We=m.useRef(null),Ee=m.useRef(null),ke=m.useRef(null),Oe=m.useRef(null),st=m.useRef(null),je=m.useRef(null),xt=m.useRef(null),gt=m.useRef(null),Ye=m.useRef(new le),it=m.useRef(new le),ut=m.useRef(new le(1,1,1)),Qe=m.useRef(new le(1,1,1)),lt=m.useRef(0),Ze=m.useRef(0),Be=m.useRef([]),$e=m.useRef([]),wt=m.useRef([]),vt=m.useRef([]),Rt=m.useRef([]),Gt=m.useRef([]),At=m.useMemo(()=>({lng:y}),[y]),pt=m.useMemo(()=>new Kt,[]),Wt=m.useMemo(()=>new l0,[]),ht=r/2,ct=i/2,It=a/2,Ft=m.useMemo(()=>new le(-ht,-ct,It),[ht,ct,It]),Ve=m.useMemo(()=>new le(-ht,ct,It),[ht,ct,It]),ft=m.useMemo(()=>new le(ht,-ct,It),[ht,ct,It]),kt=m.useMemo(()=>new le(ht,ct,It),[ht,ct,It]),rt=a5(),at=rt,Ge=rt,yt=rt*4,Pt=ct+yt,ot=m.useRef(!1),bt=m.useRef(null),zt=M(pxt),Bt=M(POe),tt=m.useMemo(()=>new le,[]);if(Ue.current){let fn=-1;switch(Ue.current.type){case z.SolarPanel:{fn=Ue.current.poleHeight;break}case z.ParabolicTrough:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2;break}case z.ParabolicDish:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2+tn.lx*tn.lx/(4*tn.latusRectum);break}case z.FresnelReflector:{const tn=Ue.current;fn=tn.poleHeight+tn.lx/2;break}}fn>=0&&tt.set(0,0,(t==null?void 0:t.lz)/2+fn)}m.useEffect(()=>{ze.current.clear();for(const fn of M.getState().elements)fn.type===z.Wall&&fn.parentId===e&&ze.current.set(fn.id,fn)},[e,V]),m.useEffect(()=>{O&&O===ve.current&&(ze.current.delete(O),we.current=!1,Pe.current=!1,ve.current=null,v(fn=>{fn.addedWallId===fn.deletedWallId&&(fn.addedWallId=null),fn.deletedWallId=null}),kn.getState().setEnableOrbitController(!0),Ae({show:!1,direction:null,position:null}),he([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]))},[O]),m.useEffect(()=>{if(t&&Z){const fn=de(t.id);ge(fn?me.fetchHeatmapTexture(fn,te??5):null)}},[Z,te,ee]),m.useEffect(()=>{!ot.current||!M.getState().getAutoDeletedElements()||Ht()},[zt,Bt]);const Ht=k2.debounce(()=>{if(!bt.current)return;const fn=M.getState().getAutoDeletedElements();if(!fn)return;const{wall:tn,newAngle:Ot,newJoints:mn}=bt.current,Hn={name:"Move Wall",timestamp:Date.now(),id:tn.id,oldPoints:[[...Rt.current[0]],[...Rt.current[1]]],newPoints:[[...tn.leftPoint],[...tn.rightPoint]],oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...mn[0]],[...mn[1]]],oldAngle:lt.current,newAngle:Ot,flippedWallSide:Me.current,autoDeletedElements:[...fn],undo(){switch(this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Yt=C(this.newJoints[0][0]);Yt&&ir(Yt);break}case Jr.right:{const Yt=C(this.newJoints[1][0]);Yt&&Rr(Yt);break}}const[qe,Ct]=this.oldJoints,[Nt,Tt]=this.newJoints;v(Yt=>{for(const Zt of Yt.elements)if(Zt.id===this.id){const[cn,yn]=this.oldPoints;Zt.cx=(cn[0]+yn[0])/2,Zt.cy=(cn[1]+yn[1])/2,Zt.lx=Math.hypot(cn[0]-yn[0],cn[1]-yn[1]);const An=Zt;An.relativeAngle=this.oldAngle,An.leftPoint=[...cn],An.rightPoint=[...yn],An.leftJoints=[...qe],An.rightJoints=[...Ct];break}Yt.resizeHandleType=null,Yt.elements.push(...this.autoDeletedElements),Yt.deletedRoofId=null,Yt.autoDeletedChild=null,Yt.autoDeletedRoofs=null,Yt.autoDeletedRoofIdSet.clear()}),qe[0]!==Nt[0]&&v(Yt=>{for(const Zt of Yt.elements)Zt.type===z.Wall&&(Zt.id===qe[0]&&(Zt.rightJoints=[this.id]),Zt.id===Nt[0]&&(this.flippedWallSide!==Jr.left?Zt.rightJoints=[]:Zt.leftJoints=[]))}),Ct[0]!==Tt[0]&&v(Yt=>{for(const Zt of Yt.elements)Zt.type===z.Wall&&(Zt.id===Ct[0]&&(Zt.leftJoints=[this.id]),Zt.id===Tt[0]&&(this.flippedWallSide!==Jr.right?Zt.leftJoints=[]:Zt.rightJoints=[]))}),Me.current=Jr.null},redo(){const[qe,Ct]=this.oldJoints,[Nt,Tt]=this.newJoints;switch(v(Zt=>{for(const cn of Zt.elements)if(cn.id===this.id&&cn.type===z.Wall){const[yn,An]=this.newPoints;cn.cx=(yn[0]+An[0])/2,cn.cy=(yn[1]+An[1])/2,cn.lx=Math.hypot(yn[0]-An[0],yn[1]-An[1]);const Tn=cn;Tn.relativeAngle=this.newAngle,Tn.leftPoint=[...yn],Tn.rightPoint=[...An],Tn.leftJoints=[...Nt],Tn.rightJoints=[...Tt];break}}),qe[0]!==Nt[0]&&v(Zt=>{for(const cn of Zt.elements)cn.type===z.Wall&&(cn.id===qe[0]&&(cn.rightJoints=[]),cn.id===Nt[0]&&(this.flippedWallSide===Jr.right?cn.leftJoints=[this.id]:cn.rightJoints=[this.id]))}),Ct[0]!==Tt[0]&&v(Zt=>{for(const cn of Zt.elements)cn.type===z.Wall&&(cn.id===Ct[0]&&(cn.leftJoints=[]),cn.id===Tt[0]&&(this.flippedWallSide===Jr.right?cn.rightJoints=[this.id]:cn.leftJoints=[this.id]))}),this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Zt=C(this.newJoints[0][0]);Zt&&Rr(Zt);break}case Jr.right:{const Zt=C(this.newJoints[1][0]);Zt&&ir(Zt);break}}const Yt=new Set(this.autoDeletedElements.map(Zt=>Zt.id));v(Zt=>{Zt.resizeHandleType=null,Zt.elements=Zt.elements.filter(yn=>!Yt.has(yn.id));const cn=this.autoDeletedElements.find(yn=>yn.type===z.Roof);cn&&(Zt.deletedRoofId=cn.id)}),Me.current=Jr.null}};ie(Hn),ot.current=!1,v(qe=>{qe.autoDeletedRoofs=null,qe.autoDeletedRoofIdSet.clear(),qe.autoDeletedChild=null})},100),_t=fn=>{pt.x=fn.offsetX/pe.clientWidth*2-1,pt.y=-(fn.offsetY/pe.clientHeight)*2+1,Wt.setFromCamera(pt,fe)},qt=fn=>{switch(fn){case _i.Texture01:return{x:1,y:1};case _i.Texture02:return{x:2,y:2};case _i.Texture03:return{x:.4,y:.4};case _i.Texture04:return{x:.25,y:.25};case _i.Texture05:return{x:5,y:5};case _i.Texture06:return{x:1,y:1};case _i.Texture07:return{x:1,y:1};default:return{x:1,y:1}}},un=m.useMemo(()=>{let fn;switch(p){case _i.Texture01:fn=w$e;break;case _i.Texture02:fn=v$e;break;case _i.Texture03:fn=x$e;break;case _i.Texture04:fn=b$e;break;case _i.Texture05:fn=S$e;break;case _i.Texture06:fn=T$e;break;case _i.Texture07:fn=P$e;break;default:fn=og}return new cf().load(fn,tn=>{tn.wrapS=tn.wrapT=bs;const Ot=qt(p);tn.repeat.set(r/Ot.x,i/Ot.y),yo(tn)})},[p,r,i]),[Rn,yo]=m.useState(un),Ao=m.useCallback((fn,tn)=>{dt.getState().duringCameraInteraction||fn.intersections.length>0&&(fn.intersections[0].object===fn.eventObject||fn.intersections.length>1&&fn.intersections[1].object===fn.eventObject)&&(v(mn=>{mn.hoveredHandle=tn}),me.isMoveHandle(tn)?pe.style.cursor="move":tn===Di.Lower||tn===Di.Upper?pe.style.cursor="grab":pe.style.cursor=M.getState().addedFoundationId?"crosshair":"pointer")},[]),wo=m.useCallback(()=>{v(fn=>{fn.hoveredHandle=null}),pe.style.cursor=M.getState().addedFoundationId?"crosshair":"default"},[]),Io=fn=>{switch(fn){case z.Human:case z.Tree:case z.Flower:case z.Polygon:case z.Sensor:case z.Light:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Wall:return!0;default:return!1}},po=(fn,tn)=>{let Ot=tn,mn=null,Hn=null,qe=null,Ct;if(!M.getState().enableFineGrid)for(const[Nt,Tt]of ze.current){if(Nt===ve.current||Ue.current&&Nt===Ue.current.id)continue;const Yt=new le(Tt.leftPoint[0],Tt.leftPoint[1],0),Zt=new le(Tt.rightPoint[0],Tt.rightPoint[1],0),cn=(Yt==null?void 0:Yt.distanceTo(fn))??Number.MAX_VALUE,yn=(Zt==null?void 0:Zt.distanceTo(fn))??Number.MAX_VALUE,An=cn<=yn,Tn=An?cn:yn,Ln=An?Yt:Zt;Tn<=Ot+.01&&(Ot=Tn,mn=Ln,Ct=An?Tt.leftJoints[0]:Tt.rightJoints[0],Hn=Nt,qe=An?V1.Left:V1.Right)}return{id:Hn,point:mn,side:qe,jointId:Ct}},On=(fn,tn)=>(M.getState().enableFineGrid?(fn=me.snapToFineGrid(fn),tn=null):tn?fn=tn:fn=me.snapToNormalGrid(fn),fn),fo=fn=>{ze.current.clear();for(const Ot of M.getState().elements)Ot.type===z.Wall&&Ot.parentId===e&&ze.current.set(Ot.id,Ot);let tn=ze.current.get(fn);for(;tn&&tn.leftJoints.length>0;){const Ot=ze.current.get(tn.id);if(!Ot||(v(mn=>{for(const Hn of mn.elements)if(Hn.id===Ot.id){const qe=Hn;qe.relativeAngle=(Ot.relativeAngle+Math.PI)%sa,qe.leftPoint=[...Ot.rightPoint],qe.rightPoint=[...Ot.leftPoint],qe.leftJoints=[Ot.rightJoints[0]],qe.rightJoints=[Ot.leftJoints[0]];break}}),tn=ze.current.get(tn.leftJoints[0]),tn&&tn.id===fn))break}v(Ot=>{Ot.updateWallMapOnFoundationFlag=!Ot.updateWallMapOnFoundationFlag,M.getState().resizeHandleType&&(Ot.resizeHandleType=M.getState().resizeHandleType===Mt.LowerLeft?Mt.LowerRight:Mt.LowerLeft)}),Me.current=Me.current===Jr.null?Jr.loop:Jr.null},ir=(fn,tn)=>{ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);const Ot=fn;let mn=fn;for(;mn;){const Hn=ze.current.get(mn.id);if(!Hn)break;v(Ct=>{for(const Nt of Ct.elements)if(Hn&&Nt.id===Hn.id){const Tt=Nt;Tt.relativeAngle=(Hn.relativeAngle+Math.PI)%sa,Tt.leftPoint=[...Hn.rightPoint],Tt.rightPoint=[...Hn.leftPoint],Tt.leftJoints=Hn.rightJoints.length>0?[Hn.rightJoints[0]]:[],Tt.rightJoints=Hn.leftJoints.length>0?[Hn.leftJoints[0]]:[];break}});let qe;if(Hn.leftJoints.length>0&&(qe=ze.current.get(Hn.leftJoints[0])),qe&&qe.id!==Ot.id)mn=qe;else break}v(Hn=>{if(tn)for(const qe of Hn.elements)qe.type===z.Wall&&(qe.id===Ot.id&&(qe.leftJoints=[tn.id]),qe.id===tn.id&&(qe.rightJoints=[Ot.id]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag,Hn.resizeHandleType=Mt.LowerLeft}),Me.current=Me.current===Jr.null?Jr.right:Jr.null},Rr=(fn,tn)=>{ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);const Ot=fn;let mn=fn;for(;mn;){const Hn=ze.current.get(mn.id);if(!Hn)break;v(Ct=>{for(const Nt of Ct.elements)if(Hn&&Nt.id===Hn.id){const Tt=Nt;Tt.relativeAngle=(Hn.relativeAngle+Math.PI)%sa,Tt.leftPoint=[...Hn.rightPoint],Tt.rightPoint=[...Hn.leftPoint],Tt.leftJoints=Hn.rightJoints.length>0?[Hn.rightJoints[0]]:[],Tt.rightJoints=Hn.leftJoints.length>0?[Hn.leftJoints[0]]:[];break}});let qe;if(Hn.rightJoints.length>0&&(qe=ze.current.get(Hn.rightJoints[0])),qe&&qe.id!==Ot.id)mn=qe;else break}v(Hn=>{if(tn)for(const qe of Hn.elements)qe.type===z.Wall&&(qe.id===Ot.id&&(qe.rightJoints=[tn.id]),qe.id===tn.id&&(qe.leftJoints=[Ot.id]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag,Hn.resizeHandleType=Mt.LowerRight}),Me.current=Me.current===Jr.null?Jr.left:Jr.null},br=fn=>{let tn;ze.current.clear();for(const mn of M.getState().elements)mn.id===fn&&(tn=mn),mn.type===z.Wall&&mn.parentId===e&&ze.current.set(mn.id,mn);let Ot=!1;for(;tn&&tn.leftJoints.length>0;)if(tn=ze.current.get(tn.leftJoints[0]),(tn==null?void 0:tn.id)===fn){Ot=!0;break}if(Ot){let mn=0,Hn=0;for(;tn&&tn.leftJoints.length>0;){const qe=ze.current.get(tn.leftJoints[0]),Ct=(Math.PI*3-(tn.relativeAngle-qe.relativeAngle))%sa;if(mn+=Ct,Hn+=1,tn=qe,tn.id===fn)break}mn>(Hn-2)*Math.PI+.1?fo(fn):Me.current!==Jr.null&&(Me.current=Jr.loop)}return Ot},_r=fn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:fn,undo:()=>{D(tn.addedElement.id,!1)},redo:()=>{v(Ot=>{Ot.elements.push(tn.addedElement),Ot.selectedElement=tn.addedElement})}};ie(tn)},jo=fn=>{const tn={name:"Add",timestamp:Date.now(),addedElement:fn,flippedWallSide:Me.current,undo:()=>{const Ot=tn.addedElement;if(D(Ot.id,!1),(tn.flippedWallSide===Jr.right||tn.flippedWallSide===Jr.loop)&&Ot.rightJoints.length>0){const mn=C(Ot.rightJoints[0]);mn&&Rr(mn)}else if(tn.flippedWallSide===Jr.left&&Ot.leftJoints.length>0){const mn=C(Ot.leftJoints[0]);mn&&ir(mn)}},redo:()=>{const Ot=tn.addedElement;if(tn.flippedWallSide===Jr.right||tn.flippedWallSide===Jr.loop&&Ot.rightJoints.length>0){const mn=C(Ot.rightJoints[0]);mn&&ir(mn)}else if(tn.flippedWallSide===Jr.left&&Ot.leftJoints.length>0){const mn=C(Ot.leftJoints[0]);mn&&Rr(mn)}Ot.rightJoints.length>0&&R(Ot.rightJoints[0],[Ot.id]),Ot.leftJoints.length>0&&H(Ot.leftJoints[0],[Ot.id]),v(mn=>{mn.elements.push(Ot),mn.selectedElement=Ot,mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag})}};ie(tn)},wn=fn=>{const tn=M.getState().getAutoDeletedElements(),Ot={name:"Resize Wall",timestamp:Date.now(),resizedElementId:fn.id,resizedElementType:fn.type,oldPosition:Ye.current.clone(),newPosition:it.current.clone(),oldDimension:ut.current.clone(),newDimension:Qe.current.clone(),oldAngle:lt.current,newAngle:Ze.current,oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...vt.current[0]],[...vt.current[1]]],oldPoint:[[...Rt.current[0]],[...Rt.current[1]]],newPoint:[[...Gt.current[0]],[...Gt.current[1]]],flippedWallSide:Me.current,autoDeletedElement:tn?[...tn]:[],undo:()=>{switch(Ot.flippedWallSide){case Jr.right:if(Ot.newJoints[1]){const mn=C(Ot.newJoints[1][0]);mn&&Rr(mn)}break;case Jr.left:if(Ot.newJoints[0]){const mn=C(Ot.newJoints[0][0]);mn&&ir(mn)}break;case Jr.loop:if(Ot.newJoints[0]&&Ot.newJoints[1])fo(Ot.resizedElementId);else if(Ot.newJoints[1]){const mn=C(Ot.newJoints[1][0]);mn&&Rr(mn)}else if(Ot.newJoints[0]){const mn=C(Ot.newJoints[0][0]);mn&&ir(mn)}break}v(mn=>{for(const Hn of mn.elements)if(Hn.id===Ot.resizedElementId){const qe=Hn;switch(qe.cx=Ot.oldPosition.x,qe.cy=Ot.oldPosition.y,qe.cz=Ot.oldPosition.z,qe.lx=Ot.oldDimension.x,qe.ly=Ot.oldDimension.y,qe.lz=Ot.oldDimension.z,qe.relativeAngle=Ot.oldAngle,qe.leftJoints=[...Ot.oldJoints[0]],qe.rightJoints=[...Ot.oldJoints[1]],qe.leftPoint=[...Ot.oldPoint[0]],qe.rightPoint=[...Ot.oldPoint[1]],Ot.flippedWallSide){case Jr.loop:{if(Ot.oldJoints[0]!==Ot.newJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[Ot.resizedElementId]));else if(Ot.oldJoints[1]!==Ot.newJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[Ot.resizedElementId]));break}case Jr.left:case Jr.right:{if(!Ot.oldJoints[0]&&Ot.newJoints[1]){for(const Ct of mn.elements)if(Ct.type===z.Wall&&Ct.id===Ot.newJoints[1][0]){Ct.leftJoints=[];break}}else if(!Ot.oldJoints[1]&&Ot.newJoints[0]){for(const Ct of mn.elements)if(Ct.type===z.Wall&&Ct.id===Ot.newJoints[0][0]){Ct.rightJoints=[];break}}else if(Ot.flippedWallSide===Jr.left&&Ot.oldJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[qe.id]));else if(Ot.flippedWallSide===Jr.right&&Ot.oldJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[qe.id]));break}case Jr.null:{if(Ot.oldJoints[0]!==Ot.newJoints[0])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[0][0]&&(Ct.rightJoints=[]),Ct.id===Ot.oldJoints[0][0]&&(Ct.rightJoints=[qe.id]));if(Ot.oldJoints[1]!==Ot.newJoints[1])for(const Ct of mn.elements)Ct.type===z.Wall&&(Ct.id===Ot.newJoints[1][0]&&(Ct.leftJoints=[]),Ct.id===Ot.oldJoints[1][0]&&(Ct.leftJoints=[qe.id]));mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag;break}}break}mn.elements.push(...Ot.autoDeletedElement),mn.resizeHandleType=null,mn.deletedRoofId=null,mn.autoDeletedRoofs=null,mn.autoDeletedRoofIdSet.clear(),mn.autoDeletedChild=null}),Me.current=Jr.null},redo:()=>{Ot.autoDeletedElement.length>0&&D(Ot.autoDeletedElement[0].id,!1,!1,!0);const mn=new Set(Ot.autoDeletedElement.map(Hn=>Hn.id));switch(v(Hn=>{Hn.elements=Hn.elements.filter(qe=>!mn.has(qe.id));for(const qe of Hn.elements)if(qe.id===Ot.resizedElementId){const Ct=qe;switch(Ct.cx=Ot.newPosition.x,Ct.cy=Ot.newPosition.y,Ct.cz=Ot.newPosition.z,Ct.lx=Ot.newDimension.x,Ct.ly=Ot.newDimension.y,Ct.lz=Ot.newDimension.z,Ot.flippedWallSide){case Jr.left:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa;for(const Nt of Hn.elements)if(Nt.type===z.Wall&&Nt.id===Ot.oldJoints[0][0]){Nt.rightJoints=[];break}break;case Jr.right:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa;for(const Nt of Hn.elements)if(Nt.type===z.Wall&&Nt.id===Ot.oldJoints[1][0]){Nt.leftJoints=[];break}break;case Jr.loop:Ct.relativeAngle=(Ot.newAngle+Math.PI)%sa,Ct.leftJoints=[...Ot.newJoints[1]],Ct.rightJoints=[...Ot.newJoints[0]],Ct.leftPoint=[...Ot.newPoint[1]],Ct.rightPoint=[...Ot.newPoint[0]];for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[0][0]&&(Nt.leftJoints=[Ct.id]),Nt.id===Ot.newJoints[1][0]&&(Nt.rightJoints=[Ct.id]));break;case Jr.null:if(Ct.relativeAngle=Ot.newAngle,Ct.leftJoints=[...Ot.newJoints[0]],Ct.rightJoints=[...Ot.newJoints[1]],Ct.leftPoint=[...Ot.newPoint[0]],Ct.rightPoint=[...Ot.newPoint[1]],Ot.oldJoints[0][0]!==Ot.newJoints[0][0])for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[0][0]&&(Nt.rightJoints=[Ct.id]),Nt.id===Ot.oldJoints[0][0]&&(Nt.rightJoints=[]));if(Ot.oldJoints[1][0]!==Ot.newJoints[1][0])for(const Nt of Hn.elements)Nt.type===z.Wall&&(Nt.id===Ot.newJoints[1][0]&&(Nt.leftJoints=[Ct.id]),Nt.id===Ot.oldJoints[1][0]&&(Nt.leftJoints=[]));Hn.updateWallMapOnFoundationFlag=!Hn.updateWallMapOnFoundationFlag;break}break}Hn.resizeHandleType=null}),setTimeout(()=>{v(Hn=>{Hn.deletedRoofId=null,Hn.autoDeletedRoofs=null,Hn.autoDeletedRoofIdSet.clear()})}),Ot.flippedWallSide){case Jr.left:{const Hn=C(Ot.resizedElementId),qe=C(Ot.newJoints[1][0]);Rr(Hn,qe);break}case Jr.right:{const Hn=C(Ot.resizedElementId),qe=C(Ot.newJoints[0][0]);ir(Hn,qe);break}case Jr.loop:ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);fo(Ot.resizedElementId);break}Me.current=Jr.null}};ie(Ot),v(mn=>{mn.actionState.wallHeight=fn.lz,mn.deletedRoofId=null,mn.autoDeletedRoofs=null,mn.autoDeletedRoofIdSet.clear(),mn.autoDeletedChild=[]})},In=(fn,tn,Ot)=>{if(fn.roofId)ot.current=!0,bt.current={wall:fn,newAngle:tn,newJoints:[[...Ot[0]],[...Ot[1]]]};else{const mn={name:"Move Wall",timestamp:Date.now(),id:fn.id,oldPoints:[[...Rt.current[0]],[...Rt.current[1]]],newPoints:[[...fn.leftPoint],[...fn.rightPoint]],oldJoints:[[...wt.current[0]],[...wt.current[1]]],newJoints:[[...Ot[0]],[...Ot[1]]],oldAngle:lt.current,newAngle:tn,flippedWallSide:Me.current,undo(){switch(this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Tt=C(this.newJoints[0][0]);Tt&&ir(Tt);break}case Jr.right:{const Tt=C(this.newJoints[1][0]);Tt&&Rr(Tt);break}}const[Hn,qe]=this.oldJoints,[Ct,Nt]=this.newJoints;v(Tt=>{for(const Yt of Tt.elements)if(Yt.id===this.id){const[Zt,cn]=this.oldPoints;Yt.cx=(Zt[0]+cn[0])/2,Yt.cy=(Zt[1]+cn[1])/2,Yt.lx=Math.hypot(Zt[0]-cn[0],Zt[1]-cn[1]);const yn=Yt;yn.relativeAngle=this.oldAngle,yn.leftPoint=[...Zt],yn.rightPoint=[...cn],yn.leftJoints=[...Hn],yn.rightJoints=[...qe];break}Tt.resizeHandleType=null}),Hn[0]!==Ct[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===Hn[0]&&(Yt.rightJoints=[this.id]),Yt.id===Ct[0]&&(this.flippedWallSide!==Jr.left?Yt.rightJoints=[]:Yt.leftJoints=[]))}),qe[0]!==Nt[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===qe[0]&&(Yt.leftJoints=[this.id]),Yt.id===Nt[0]&&(this.flippedWallSide!==Jr.right?Yt.leftJoints=[]:Yt.rightJoints=[]))}),Me.current=Jr.null},redo(){const[Hn,qe]=this.oldJoints,[Ct,Nt]=this.newJoints;switch(v(Tt=>{for(const Yt of Tt.elements)if(Yt.id===this.id&&Yt.type===z.Wall){const[Zt,cn]=this.newPoints;Yt.cx=(Zt[0]+cn[0])/2,Yt.cy=(Zt[1]+cn[1])/2,Yt.lx=Math.hypot(Zt[0]-cn[0],Zt[1]-cn[1]);const yn=Yt;yn.relativeAngle=this.newAngle,yn.leftPoint=[...Zt],yn.rightPoint=[...cn],yn.leftJoints=[...Ct],yn.rightJoints=[...Nt];break}}),Hn[0]!==Ct[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===Hn[0]&&(Yt.rightJoints=[]),Yt.id===Ct[0]&&(this.flippedWallSide===Jr.right?Yt.leftJoints=[this.id]:Yt.rightJoints=[this.id]))}),qe[0]!==Nt[0]&&v(Tt=>{for(const Yt of Tt.elements)Yt.type===z.Wall&&(Yt.id===qe[0]&&(Yt.leftJoints=[]),Yt.id===Nt[0]&&(this.flippedWallSide===Jr.right?Yt.rightJoints=[this.id]:Yt.leftJoints=[this.id]))}),this.flippedWallSide){case Jr.loop:{fo(this.id);break}case Jr.left:{const Tt=C(this.newJoints[0][0]);Tt&&Rr(Tt);break}case Jr.right:{const Tt=C(this.newJoints[1][0]);Tt&&ir(Tt);break}}v(Tt=>{Tt.resizeHandleType=null}),Me.current=Jr.null}};ie(mn)}},ar=fn=>{if(fn.button===2){fn.altKey&&L(e,fn,Xo.Select);return}v(mn=>{mn.contextMenuObjectType=null}),M.getState().objectTypeToAdd!==z.Window&&!Q()&&L(e,fn,Xo.Select);const tn=P();let Ot=!1;if(fn.intersections[0].object.name===z.Polygon&&M.getState().objectTypeToAdd!==z.None&&(Ot=!0),(tn==null?void 0:tn.id)===e||Ot)if(Io(M.getState().objectTypeToAdd)){if(t){Re(!0);const mn=fn.intersections.filter(qe=>!qe.eventObject.name.startsWith("Wall Intersection Plane"))[0].point,Hn=j(t,mn);Hn&&_r(Hn),v(qe=>{qe.actionModeLock||(qe.objectTypeToAdd=z.None)})}}else kn.getState().selectNone(),kn.setState({foundationRef:Ne});else if(tn&&tn.parentId===e&&Io(tn.type))switch(Ue.current=tn,tn.type===z.Wall&&!we.current&&(Ie.current=[...M.getState().elements]),Re(!0),Ye.current.set(tn.cx,tn.cy,tn.cz),ut.current.set(tn.lx,tn.ly,tn.lz),dt.getState().setPrimitiveStore("oldParentId",e),dt.getState().setPrimitiveStore("oldFoundationId",e),tn.type){case z.SolarPanel:case z.ParabolicTrough:case z.FresnelReflector:{lt.current=tn.relativeAzimuth;break}case z.Polygon:{Be.current=tn.vertices.map(mn=>({...mn}));break}case z.Wall:{const mn=tn;lt.current=mn.relativeAngle,wt.current=[[...mn.leftJoints],[...mn.rightJoints]],Rt.current=[[...mn.leftPoint],[...mn.rightPoint]],to.current=mn.leftJoints[0],Bn.current=mn.rightJoints[0],ze.current.clear();for(const Hn of M.getState().elements)Hn.type===z.Wall&&Hn.parentId===e&&ze.current.set(Hn.id,Hn);break}}if(we.current&&ve.current&&Je.current){const mn=Wt.intersectObjects([Je.current]);if(mn.length===0)return;let Hn=me.wallRelativePosition(mn[0].point,t);ue[0].position&&(Hn.setX(ue[0].position[0]),Hn.setY(ue[0].position[1]));const{id:qe,point:Ct,side:Nt,jointId:Tt}=po(Hn,1.5);Hn=On(Hn,Ct);let Yt=Mt.LowerRight;if(qe){const Zt=C(qe);Nt===V1.Right?v(cn=>{for(const yn of cn.elements)if(yn.type===z.Wall){if(yn.id===ve.current){const An=yn;An.cx=Hn.x,An.cy=Hn.y,Zt.rightJoints.length===0&&(An.leftJoints=[Zt.id])}yn.id===qe&&Zt.rightJoints.length===0&&(yn.rightJoints=ve.current?[ve.current]:[])}}):Nt===V1.Left&&!Tt&&(v(cn=>{for(const yn of cn.elements)if(yn.type===z.Wall){if(yn.id===ve.current){const An=yn;An.cx=Hn.x,An.cy=Hn.y,Zt.leftJoints.length===0&&(An.rightJoints=[Zt.id])}yn.id===qe&&Zt.leftJoints.length===0&&(yn.leftJoints=ve.current?[ve.current]:[])}}),Yt=Mt.LowerLeft)}else T(ve.current,Hn.x,Hn.y);we.current=!1,Pe.current=!0,F(ve.current,[Hn.x,Hn.y,Hn.z]),v(Zt=>{Zt.resizeHandleType=Yt,Zt.resizeAnchor=me.wallAbsolutePosition(Hn,t)}),kn.getState().setEnableOrbitController(!1),Ue.current=tn}},Wo=fn=>{if(Vl&&Cc(!1),fn.altKey&&fn.button===2&&k&&k.length>0){v(mn=>{mn.pastePoint.copy(fn.intersections[0].point),mn.clickObjectType=z.Foundation,mn.pasteNormal=ko});const Ot=W();if(Ot.length>0){const mn={name:"Paste to Point",timestamp:Date.now(),pastedElements:Ot.map(Hn=>({...Hn})),undo:()=>{for(const Hn of mn.pastedElements)D(Hn.id,!1)},redo:()=>{v(Hn=>{Hn.elements.push(...mn.pastedElements),Hn.selectedElement=mn.pastedElements[0]})}};ie(mn)}}if(!Ue.current||Ue.current.type===z.Tree||Ue.current.type===z.Flower||Ue.current.type===z.Human)return;const tn=C(Ue.current.id);if(tn){switch(tn.type){case z.Wall:{const Ot=tn;if(we.current)v(mn=>{mn.elements.pop(),mn.addedWallId=null,mn.actionModeLock&&(mn.objectTypeToAdd=z.Wall,Px.selectNone(mn))}),ve.current&&ze.current.delete(ve.current),ve.current=null,we.current=!1,Pe.current=!1;else if(Pe.current&&ve.current&&Je.current)kn.getState().setEnableOrbitController(!0),v(mn=>{mn.actionModeLock&&(mn.objectTypeToAdd=z.Wall,Px.selectNone(mn)),mn.addedWallId=null,Ot.lx===0&&Ie.current?(mn.elements=[...Ie.current],ve.current&&ze.current.delete(ve.current)):(jo(Ot),ze.current.set(Ot.id,Ot))}),ve.current=null,Pe.current=!1;else if(M.getState().resizeHandleType)Ot.lx>.45?(ze.current.set(Ot.id,Ot),it.current.set(Ot.cx,Ot.cy,Ot.cz),Qe.current.set(Ot.lx,Ot.ly,Ot.lz),Ze.current=Ot.relativeAngle,vt.current=[[...Ot.leftJoints],[...Ot.rightJoints]],Gt.current=[[...Ot.leftPoint],[...Ot.rightPoint]],wn(Ot)):v(mn=>{Ie.current&&(mn.elements=[...Ie.current],Ie.current=null)});else if(M.getState().moveHandleType){let mn=Ot.relativeAngle,Hn=[],qe=[];if(to.current)if(Ot.leftJoints.length>0&&(to.current!==Ot.leftJoints[0]||to.current===Ot.leftJoints[0]&&Ko.current)&&H(Ot.leftJoints[0],[]),Ko.current)R(to.current,[Ot.id]),qe=[to.current];else if(Hn=[to.current],Qo.current){R(to.current,[Ot.id]);const Ct=C(to.current);Ct&&Rr(Ct)}else H(to.current,[Ot.id]);else Ot.leftJoints.length>0&&Ot.leftJoints[0]!==Bn.current&&(Hn=[],H(Ot.leftJoints[0],[]));if(Bn.current)if(Ot.rightJoints.length>0&&(Bn.current!==Ot.rightJoints[0]||Bn.current===Ot.rightJoints[0]&&Ko.current)&&Ot.rightJoints[0]!==to.current&&R(Ot.rightJoints[0],[]),Ko.current)H(Bn.current,[Ot.id]),Hn=[Bn.current];else if(qe=[Bn.current],So.current){H(Bn.current,[Ot.id]);const Ct=C(Bn.current);Ct&&ir(Ct)}else R(Bn.current,[Ot.id]);else Ot.rightJoints.length>0&&Ot.rightJoints[0]!==to.current&&(qe=[],R(Ot.rightJoints[0],[]));v(Ct=>{for(const Nt of Ct.elements)if(Nt.id===Ot.id&&Nt.type===z.Wall){const Tt=Nt;if(Ko.current&&(mn=(Tt.relativeAngle+Math.PI)%sa,Tt.relativeAngle=mn,[Tt.leftPoint,Tt.rightPoint]=[[...Tt.rightPoint],[...Tt.leftPoint]]),Hn.length===0&&qe.length===0)Tt.roofId=null;else if(Hn.length>0){const Yt=Ct.elements.find(Zt=>Zt.id===Hn[0]);Yt&&(Tt.roofId=Yt.roofId)}else if(qe.length>0){const Yt=Ct.elements.find(Zt=>Zt.id===qe[0]);Yt&&(Tt.roofId=Yt.roofId)}Tt.leftJoints=[...Hn],Tt.rightJoints=[...qe];break}Ct.updateWallMapOnFoundationFlag=!Ct.updateWallMapOnFoundationFlag}),br(Ot.id),In(Ot,mn,[[...Hn],[...qe]]),Ko.current=!1,Qo.current=!1,So.current=!1,to.current=null,Bn.current=null}Me.current=Jr.null,v(mn=>{mn.updateWallMapOnFoundationFlag=!mn.updateWallMapOnFoundationFlag}),Ae({show:!1,direction:null,position:null}),he([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}]);break}case z.Polygon:{if(M.getState().moveHandleType||M.getState().resizeHandleType){$e.current=tn.vertices.map(mn=>({...mn}));const Ot={name:M.getState().moveHandleType?"Move Polygon":"Resize Polygon",timestamp:Date.now(),oldValue:Be.current,newValue:$e.current,changedElementId:tn.id,changedElementType:tn.type,undo:()=>{U(Ot.changedElementId,Ot.oldValue)},redo:()=>{U(Ot.changedElementId,Ot.newValue)}};ie(Ot)}break}default:if(M.getState().resizeHandleType){if(it.current.set(tn.cx,tn.cy,tn.cz),Qe.current.set(tn.lx,tn.ly,tn.lz),it.current.distanceToSquared(Ye.current)>Et||Qe.current.distanceToSquared(ut.current)>Et){const Ot={name:"Resize",timestamp:Date.now(),resizedElementId:Ue.current.id,resizedElementType:Ue.current.type,oldCx:Ye.current.x,oldCy:Ye.current.y,oldCz:Ye.current.z,newCx:it.current.x,newCy:it.current.y,newCz:it.current.z,oldLx:ut.current.x,oldLy:ut.current.y,oldLz:ut.current.z,newLx:Qe.current.x,newLy:Qe.current.y,newLz:Qe.current.z,undo:()=>{T(Ot.resizedElementId,Ot.oldCx,Ot.oldCy,Ot.oldCz),w(Ot.resizedElementId,Ot.oldLx,Ot.oldLy,Ot.oldLz)},redo:()=>{T(Ot.resizedElementId,Ot.newCx,Ot.newCy,Ot.newCz),w(Ot.resizedElementId,Ot.newLx,Ot.newLy,Ot.newLz)}};ie(Ot)}}else if(M.getState().rotateHandleType){if(me.isSolarCollector(Ue.current)){const Ot=Ue.current;if(Math.abs(Ze.current-lt.current)>Et)if(Fs(Ot,Ze.current)){v(Hn=>{Hn.selectedElementAngle=Ze.current});const mn={name:"Rotate",timestamp:Date.now(),oldValue:lt.current,newValue:Ze.current,changedElementId:Ot.id,changedElementType:Ot.type,undo:()=>{E(mn.changedElementId,mn.oldValue)},redo:()=>{E(mn.changedElementId,mn.newValue)}};ie(mn)}else E(Ot.id,lt.current)}}else if(it.current.set(tn.cx,tn.cy,tn.cz),it.current.distanceToSquared(Ye.current)>Et){let Ot=!0;me.isSolarCollector(tn)&&(Ot=wi(tn,tn.cx,tn.cy)),Ot?Eu.addUndoableMove():v(mn=>{const Hn=mn.elements.find(Tt=>Tt.id===tn.id);if(!Hn||!mn.selectedElement)return;const qe=mn.selectedElement;Hn.cx=qe.cx,Hn.cy=qe.cy,Hn.cz=qe.cz,Hn.rotation=[...qe.rotation],Hn.normal=[...qe.normal];const Ct=dt.getState().oldParentId,Nt=dt.getState().oldFoundationId;Ct&&(Hn.parentId=Ct),Nt&&(Hn.foundationId=Nt)})}}Re(!1),Ue.current=null,v(Ot=>{Ot.resizeHandleType=null,Ot.moveHandleType=null})}},to=m.useRef(null),Bn=m.useRef(null),Ko=m.useRef(!1),So=m.useRef(!1),Qo=m.useRef(!1),Yo=(fn,tn,Ot)=>{let mn=Math.atan2(tn.y-fn.y,tn.x-fn.x)-(Ot===Mt.LowerLeft?Math.PI:0);return mn=mn>=0?mn:(sa+mn)%sa,mn},lr=(fn,tn)=>{let mn=null,Hn=null,qe=1/0,Ct=1/0;for(const[Nt,Tt]of ze.current)if(Ue.current!==null&&Tt.id!==Ue.current.id&&Tt.id!==tn){const Yt=Math.abs(fn.x-Tt.leftPoint[0]),Zt=Math.abs(fn.x-Tt.rightPoint[0]),cn=Math.abs(fn.y-Tt.leftPoint[1]),yn=Math.abs(fn.y-Tt.rightPoint[1]);Yt<1&&Yt{const qe=Yo(fn,tn,Ot);let Ct=null,Nt=null;return qe<.05||qe>sa-.05||Math.abs(qe-Math.PI)<.05||Math.abs(tn.y-fn.y)<1?Nt=fn.y:(Math.abs(qe-Math.PI/2)<.05||Math.abs(qe-3*Math.PI/2)<.05||Math.abs(tn.x-fn.x)<1)&&(Ct=fn.x),[Ct,Nt]},ei=(fn,tn,Ot,mn)=>{const[Hn,qe]=lr(tn),[Ct,Nt]=fr(fn,tn,Ot),Tt=hr(tn.x,Hn,Ct),Yt=hr(tn.y,qe,Nt);return new le(Tt,Yt,tn.z)},hr=(fn,tn,Ot)=>tn!==null&&Ot!==null?Math.abs(tn-fn){let[mn,Hn]=[1/0,1/0],qe=null,Ct=null;for(const[Nt,Tt]of ze.current)if(Ue.current!==null&&Tt.id!==Ue.current.id&&Tt.id!==Ot){const Yt=Math.abs(fn.x-Tt.leftPoint[0]),Zt=Math.abs(fn.x-Tt.rightPoint[0]);Yt<.01&&Yt{qe!==null&&Ct!==null?(Nt[tn].direction="xy",Nt[tn].position=[qe,Ct]):qe!==null?(Nt[tn].direction="y",Nt[tn].position=[qe,fn.y]):Ct!==null?(Nt[tn].direction="x",Nt[tn].position=[fn.x,Ct]):(Nt[tn].direction=null,Nt[tn].position=null)})),[qe!==null,Ct!==null]},bi=(fn,tn)=>Math.abs(tn)<.01||Math.abs(tn-Math.PI)<.01?(Ae(Ot=>({...Ot,direction:"x",position:[fn.x,fn.y]})),[!0,!1]):Math.abs(tn-Math.PI/2)<.01||Math.abs(tn-3*Math.PI/2)<.01?(Ae(Ot=>({...Ot,direction:"y",position:[fn.x,fn.y]})),[!1,!0]):(Ae(Ot=>({...Ot,direction:null,position:null})),[!1,!1]),Fo=(fn,tn)=>{he(JP(Ot=>{Ot[0].show=fn})),Ae(Ot=>({...Ot,show:tn}))},Si=(fn,tn)=>{const[Ot,mn]=tr(fn),[Hn,qe]=bi(fn,tn);Ot&&mn?Fo(!0,!1):Ot?Fo(!0,!qe&&Hn):mn?Fo(!0,!Hn&&qe):Fo(!1,Hn||qe)},hl=fn=>{var qe,Ct;if(!t||($u(fn),Ue.current&&me.isSolarCollector(Ue.current)))return;const tn=M.getState().objectTypeToAdd;if(!Ue.current&&!ve.current&&tn!==z.Wall||((qe=Ue.current)==null?void 0:qe.parentId)!==e&&tn===z.None)return;const Ot=M.getState().moveHandleType,mn=M.getState().resizeHandleType,Hn=M.getState().resizeAnchor;if(_t(fn),Je.current){const Nt=Wt.intersectObjects([Je.current]);if(Nt.length===0)return;let Tt=Nt[0].point;if(Ue.current&&Ue.current.type&&!Ue.current.locked&&Nt.length>0)switch(Re(!0),Ue.current.type){case z.Sensor:case z.Light:case z.WindTurbine:{Tt=me.relativeCoordinates(Tt.x,Tt.y,Tt.z,t),T(Ue.current.id,Tt.x,Tt.y);break}case z.Polygon:{const Yt=Ue.current;if(Ot===zo.Default){Tt=me.relativeCoordinates(Tt.x,Tt.y,Tt.z,t);const Zt=me.calculatePolygonCentroid(Yt.vertices),cn=Tt.x-Zt.x,yn=Tt.y-Zt.y,An=Yt.vertices.map(Tn=>({...Tn}));An.forEach(Tn=>{Tn.x+=cn,Tn.y+=yn}),U(Yt.id,An)}else mn===Mt.Default&&(Tt.x-=t.cx,Tt.y-=t.cy,Tt.applyEuler(new ln().fromArray(t.rotation.map(Zt=>-Zt))),Tt=M.getState().enableFineGrid?me.snapToFineGrid(Tt):me.snapToNormalGrid(Tt),Tt.x/=t.lx,Tt.y/=t.ly,N(Yt.id,Yt.selectedIndex,Tt.x,Tt.y));break}case z.Wall:{if(((Ct=M.getState().selectedElement)==null?void 0:Ct.type)!==z.Wall)break;if(mn&&(mn===Mt.LowerLeft||mn===Mt.LowerRight)){const Yt=me.wallRelativePosition(Hn,t);Tt=me.wallRelativePosition(Tt,t);let Zt=null;M.getState().enableFineGrid?Tt=me.snapToFineGrid(Tt):(Zt=po(Tt,1.5),Zt!=null&&Zt.point?Tt=Zt.point:(Tt=me.snapToNormalGrid(Tt),Tt=ei(Yt,Tt,mn),Zt=po(Tt,1.5),Zt!=null&&Zt.point&&(Tt=Zt.point)));const cn=Yo(Yt,Tt,mn);Si(Tt,cn);const yn=Tt.distanceTo(Yt),An=new le().addVectors(Tt,Yt).divideScalar(2),Tn=mn===Mt.LowerLeft?Tt:Yt,Ln=mn===Mt.LowerLeft?Yt:Tt;v(Wn=>{for(const oo of Wn.elements)if(oo.id===Ue.current.id&&oo.type===z.Wall){const qn=oo;qn.cx=An.x,qn.cy=An.y,qn.lx=yn,qn.relativeAngle=cn,qn.leftPoint=[Tn.x,Tn.y,0],qn.rightPoint=[Ln.x,Ln.y,0];break}});const Yn=C(Ue.current.id);if(Yn){if(Zt&&Zt.point){if(Zt.id&&Zt.side&&!Zt.jointId){const Wn=C(Zt.id);if(Wn){if(mn===Mt.LowerLeft&&Wn.leftJoints.length===0&&Zt.side===V1.Left){if(Yn.leftJoints.length>0&&Yn.leftJoints[0]!==Zt.id){const oo=Yn.leftJoints[0];v(qn=>{for(const qo of qn.elements)if(qo.id===oo&&qo.type===z.Wall){qo.rightJoints=[];break}})}Rr(Yn,Wn)}else if(mn===Mt.LowerRight&&Wn.rightJoints.length===0&&Zt.side===V1.Right){if(Yn.rightJoints.length>0&&Yn.rightJoints[0]!==Zt.id){const oo=Yn.rightJoints[0];v(qn=>{for(const qo of qn.elements)if(qo.id===oo&&qo.type===z.Wall){qo.leftJoints=[];break}})}ir(Yn,Wn)}else mn===Mt.LowerRight&&Zt.side===V1.Left&&Wn.leftJoints.length===0&&Wn.rightJoints[0]!==Yn.id?v(oo=>{let qn=null;Yn.rightJoints.length>0&&Yn.rightJoints[0]!==(Zt==null?void 0:Zt.id)&&(qn=Yn.rightJoints[0]);for(const qo of oo.elements)qo.type===z.Wall&&(qo.id===Yn.id&&(qo.rightJoints=[Wn.id]),qo.id===Wn.id&&(qo.leftJoints=[Yn.id]),qo.id===qn&&(qo.leftJoints=[]))}):mn===Mt.LowerLeft&&Zt.side===V1.Right&&Wn.rightJoints.length===0&&Wn.leftJoints[0]!==Yn.id&&v(oo=>{let qn=null;Yn.leftJoints.length>0&&Yn.leftJoints[0]!==(Zt==null?void 0:Zt.id)&&(qn=Yn.leftJoints[0]);for(const qo of oo.elements)qo.type===z.Wall&&(qo.id===Yn.id&&(qo.leftJoints=[Wn.id]),qo.id===Wn.id&&(qo.rightJoints=[Yn.id]),qo.id===qn&&(qo.rightJoints=[]))});br(Yn.id)}}}else if(mn===Mt.LowerRight&&Yn.rightJoints.length>0){const Wn=Yn.rightJoints[0];v(oo=>{for(const qn of oo.elements)qn.type===z.Wall&&(qn.id===Yn.id&&(qn.rightJoints=[]),qn.id===Wn&&(qn.leftJoints=[]));oo.updateWallMapOnFoundationFlag=!oo.updateWallMapOnFoundationFlag})}else if(mn===Mt.LowerLeft&&Yn.leftJoints.length>0){const Wn=Yn.leftJoints[0];v(oo=>{for(const qn of oo.elements)qn.type===z.Wall&&(qn.id===Yn.id&&(qn.leftJoints=[]),qn.id===Wn&&(qn.rightJoints=[]));oo.updateWallMapOnFoundationFlag=!oo.updateWallMapOnFoundationFlag})}}}else if(Ot){const Yt=C(Ue.current.id);if(Yt){Tt=me.wallRelativePosition(Tt,t);const Zt=new le,cn=new ln(0,0,Yt.relativeAngle);Ot===zo.Lower?Zt.setY(rt):Ot===zo.Upper&&Zt.setY(-rt-Yt.ly),Tt.add(Zt.applyEuler(cn));const yn=new le().addVectors(Tt,new le(-Yt.lx/2,0,0).applyEuler(cn)),An=new le().addVectors(Tt,new le(Yt.lx/2,0,0).applyEuler(cn));let Tn=null,Ln=null,Yn=!1;Ko.current=!1,Qo.current=!1,So.current=!1,to.current=null,Bn.current=null;const Wn=(oo,qn)=>{const qo=qn==="left"?yn:An,ii=new le().subVectors(oo,qo);Tt.add(ii),yn.add(ii),An.add(ii)};if(!M.getState().enableFineGrid){let oo=po(yn,1);oo.point?(Wn(oo.point,"left"),oo.id&&(!oo.jointId||oo.jointId===Yt.id)&&(to.current=oo.id,Tn=oo.side===V1.Left)):to.current=null;let qn=po(An,1);if(qn.point?(oo.id||Wn(qn.point,"right"),qn.id&&(!qn.jointId||qn.jointId===Yt.id)&&(oo.id!==qn.id||oo.side!==qn.side)&&(Bn.current=qn.id,Ln=qn.side===V1.Right)):Bn.current=null,!oo.point&&!qn.point){const[ya,Hs]=lr(yn),[Qu,Zu]=lr(An);if(ya!==null||Qu!==null){const Hh=(ya??1/0)-yn.x,zf=(Qu??1/0)-An.x,ed=Math.min(Hh,zf);yn.setX(yn.x+ed),An.setX(An.x+ed),Tt.setX(Tt.x+ed),oo=po(yn,1),oo.point?(Wn(oo.point,"left"),oo.id&&(!oo.jointId||oo.jointId===Yt.id)&&(to.current=oo.id,Tn=oo.side===V1.Left)):to.current=null}if(Hs!==null||Zu!==null){const Hh=(Hs??1/0)-yn.y,zf=(Zu??1/0)-An.y,ed=Math.min(Hh,zf);yn.setY(yn.y+ed),An.setY(An.y+ed),Tt.setY(Tt.y+ed),qn=po(An,1),qn.point?(oo.id||Wn(qn.point,"right"),qn.id&&(!qn.jointId||qn.jointId===Yt.id)&&(oo.id!==qn.id||oo.side!==qn.side)&&(Bn.current=qn.id,Ln=qn.side===V1.Right)):Bn.current=null}}const[qo,ii]=tr(yn,0),[Qi,Or]=tr(An,1);he(JP(ya=>{ya[0].show=qo||ii,ya[1].show=Qi||Or})),Tn&&Ln===null||Ln&&Tn===null||Tn&&Ln?Ko.current=!0:(Tn&&Ln===!1||Ln&&Tn===!1)&&(Qo.current=Tn,So.current=Ln),oo.point&&qn.point&&(oo.id!==qn.id||oo.side!==qn.side)&&(yn.copy(oo.point),An.copy(qn.point),Yn=!0)}v(oo=>{var qn;for(const qo of oo.elements)if(qo.id===((qn=Ue.current)==null?void 0:qn.id)&&qo.type===z.Wall){const ii=qo;if(Yn){ii.cx=(yn.x+An.x)/2,ii.cy=(yn.y+An.y)/2,ii.lx=yn.distanceTo(An);let Qi=Math.atan2(An.y-yn.y,An.x-yn.x);Qi=Qi>=0?Qi:(sa+Qi)%sa,ii.relativeAngle=Qi}else ii.cx=Tt.x,ii.cy=Tt.y;ii.leftPoint=yn.toArray(),ii.rightPoint=An.toArray();break}})}}break}}if(tn===z.Wall&&!we.current){Ie.current=[...M.getState().elements];const Yt=j(t,Tt);Ue.current=Yt,ve.current=Yt.id,we.current=!0,Re(!0),kn.getState().setEnableOrbitController(!1),v(Zt=>{Zt.addedWallId=Yt.id,Zt.objectTypeToAdd=z.None})}if(ve.current&&we.current){Tt=me.wallRelativePosition(Nt[0].point,t);let Yt=null;if(M.getState().enableFineGrid)Tt=me.snapToFineGrid(Tt);else if(Yt=po(Tt,1.5),Yt!=null&&Yt.point)Tt=Yt.point;else{Tt=me.snapToNormalGrid(Tt);const[yn,An]=lr(Tt);yn!==null&&Tt.setX(yn),An!==null&&Tt.setY(An),Yt=po(Tt,1.5),Yt!=null&&Yt.point&&(Tt=Yt.point)}const[Zt,cn]=tr(Tt);he(JP(yn=>{yn[0].show=Zt||cn})),T(ve.current,Tt.x,Tt.y)}}},nr=fn=>{fn.intersections.length>0&&fn.intersections[0].object===Je.current&&ae(!0)},or=fn=>{v(tn=>{Px.selectMe(tn,e,fn,Xo.ContextMenu),tn.pastePoint.copy(fn.intersections[0].point),tn.clickObjectType=z.Foundation,tn.pasteNormal=ko,fn.altKey?tn.contextMenuObjectType=null:fn.intersections.length>0&&fn.intersections[0].object===Je.current&&(tn.contextMenuObjectType=z.Foundation),tn.pasteNormal=ko})},Ai=()=>{Vl&&(Cc(!1),Ue.current=null),ae(!1),Re(!1),Ue.current&&we.current&&(D(Ue.current.id,!1),we.current=!1,v(fn=>{fn.addedWallId=null,fn.objectTypeToAdd=z.Wall}),Ue.current=null),Ae({show:!1,direction:null,position:null}),he([{show:!1,direction:null,position:null},{show:!1,direction:null,position:null}])},Fa=fn=>{Ue.current&&me.isPlantOrHuman(Ue.current)&&fn.intersections[0].object===Je.current&&Re(!0)},wi=(fn,tn,Ot)=>{const mn=JSON.parse(JSON.stringify(fn));return mn.cx=tn,mn.cy=Ot,se(mn)?(co(Y.t("message.MoveCancelledBecauseOfOverlap",At)),!1):me.isSolarCollectorWithinHorizontalSurface(mn,t)?!0:(co(Y.t("message.MoveOutsideBoundaryCancelled",At)),!1)},Fs=(fn,tn)=>{const Ot=JSON.parse(JSON.stringify(fn));return Ot.relativeAzimuth=tn,se(Ot)?(co(Y.t("message.RotationCancelledBecauseOfOverlap",At)),!1):me.isSolarCollectorWithinHorizontalSurface(Ot,t)?!0:(co(Y.t("message.RotationOutsideBoundaryCancelled",At)),!1)},ks=(fn,tn,Ot,mn,Hn)=>{if(fn.type===z.SolarPanel&&fn.tiltAngle!==0&&.5*Hn*Math.abs(Math.sin(fn.tiltAngle))>fn.poleHeight)return!1;const qe=JSON.parse(JSON.stringify(fn));return qe.cx=tn,qe.cy=Ot,qe.lx=mn,qe.ly=Hn,me.isSolarCollectorWithinHorizontalSurface(qe,t)},Zs=fn=>{if(nt.current&&t&&Ue.current&&t){if(!me.isSolarCollector(Ue.current))return;const tn=Ue.current;_t(fn);const Ot=Wt.intersectObjects([nt.current]);if(Ot.length>0){let mn=Ot[0].point;const Hn=M.getState().moveHandleType,qe=M.getState().rotateHandleType,Ct=M.getState().resizeHandleType;if(Hn&&t)mn=me.relativeCoordinates(mn.x,mn.y,mn.z,t),T(tn.id,mn.x,mn.y),tn.parentId!==e&&M.getState().set(Nt=>{const Tt=Nt.elements.find(Yt=>Yt.id===tn.id&&Yt.type===z.SolarPanel);Tt&&(Tt.parentId!==e||Tt.foundationId!==e)&&(Tt.parentId=e,Tt.foundationId=e,Tt.parentType=z.Foundation,Nt.selectedElement&&(Nt.selectedElement.parentId=e,Tt.color=Nt.selectedElement.color))});else if(qe){if(qe===Di.Upper||qe===Di.Lower){const Nt=t.rotation[2],Tt=new Kt(t.cx,t.cy),Yt=new Kt(t.lx*tn.cx,t.ly*tn.cy).rotateAround(ai,Nt),Zt=new Kt().addVectors(Yt,Tt),cn=Math.atan2(-mn.x+Zt.x,mn.y-Zt.y)-Nt+(qe===Di.Lower?0:Math.PI),yn=Math.abs(cn)>Math.PI?-Math.sign(cn)*sa:0,An=cn+yn;E(tn.id,An),Ze.current=An}}else if(Ct){const Nt=M.getState().resizeAnchor,Tt=new Kt(mn.x,mn.y),Yt=new Kt(Nt.x,Nt.y),Zt=Tt.distanceTo(Yt),cn=tn.relativeAzimuth+l[2],yn=new Kt().subVectors(Tt,Yt),An=new Kt(n,o);if(tn.type===z.SolarPanel){const Tn=tn,Ln=B(Tn.pvModelName);switch(Ct){case Mt.Lower:case Mt.Upper:{const Yn=Ct===Mt.Lower?1:-1,Wn=yn.angle()-cn+Yn*Qt;let oo=Zt*Math.cos(Wn);Tn.orientation===vr.portrait?oo=Math.max(1,Math.ceil((oo-Ln.length/2)/Ln.length))*Ln.length:oo=Math.max(1,Math.ceil((oo-Ln.width/2)/Ln.width))*Ln.width;const qn=Nt.x+Yn*(oo*Math.sin(cn))/2,qo=Nt.y-Yn*(oo*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,oo)&&(b(tn.id,oo),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Yn=Ct===Mt.Left?-1:1,Wn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0);let oo=Zt*Math.cos(Wn);Tn.orientation===vr.portrait?oo=Math.max(1,Math.ceil((oo-Ln.width/2)/Ln.width))*Ln.width:oo=Math.max(1,Math.ceil((oo-Ln.length/2)/Ln.length))*Ln.length;const qn=Nt.x+Yn*(oo*Math.cos(cn))/2,qo=Nt.y+Yn*(oo*Math.sin(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,oo,tn.ly)&&(x(tn.id,oo),T(tn.id,Or,ya))}break}}else if(tn.type===z.ParabolicTrough){const Tn=tn;switch(Ct){case Mt.Lower:case Mt.Upper:{const Ln=Ct===Mt.Lower?1:-1,Yn=yn.angle()-cn+Ln*Qt;let Wn=Zt*Math.cos(Yn);Wn=Math.max(1,Math.ceil((Wn-Tn.moduleLength/2)/Tn.moduleLength))*Tn.moduleLength;const qn=Nt.x+Ln*(Wn*Math.sin(cn))/2,qo=Nt.y-Ln*(Wn*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,Wn)&&(b(tn.id,Wn),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Ln=Ct===Mt.Left?-1:1,Yn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0),Wn=Zt*Math.cos(Yn),oo=Nt.x+Ln*(Wn*Math.cos(cn))/2,qn=Nt.y+Ln*(Wn*Math.sin(cn))/2,qo=new Kt(oo,qn),ii=new Kt().subVectors(qo,An).rotateAround(ai,-l[2]),Qi=ii.x/r,Or=ii.y/i;ks(tn,Qi,Or,Wn,tn.ly)&&(x(tn.id,Wn),T(tn.id,Qi,Or),v(ya=>{ya.actionState.parabolicTroughWidth=Wn}))}break}}else if(tn.type===z.FresnelReflector){const Tn=tn;switch(Ct){case Mt.Lower:case Mt.Upper:{const Ln=Ct===Mt.Lower?1:-1,Yn=yn.angle()-cn+Ln*Qt;let Wn=Zt*Math.cos(Yn);Wn=Math.max(1,Math.ceil((Wn-Tn.moduleLength/2)/Tn.moduleLength))*Tn.moduleLength;const qn=Nt.x+Ln*(Wn*Math.sin(cn))/2,qo=Nt.y-Ln*(Wn*Math.cos(cn))/2,ii=new Kt(qn,qo),Qi=new Kt().subVectors(ii,An).rotateAround(ai,-l[2]),Or=Qi.x/r,ya=Qi.y/i;ks(tn,Or,ya,tn.lx,Wn)&&(b(tn.id,Wn),T(tn.id,Or,ya))}break;case Mt.Left:case Mt.Right:{const Ln=Ct===Mt.Left?-1:1,Yn=yn.angle()-cn+(Ct===Mt.Left?Math.PI:0),Wn=Zt*Math.cos(Yn),oo=Nt.x+Ln*(Wn*Math.cos(cn))/2,qn=Nt.y+Ln*(Wn*Math.sin(cn))/2,qo=new Kt(oo,qn),ii=new Kt().subVectors(qo,An).rotateAround(ai,-l[2]),Qi=ii.x/r,Or=ii.y/i;ks(tn,Qi,Or,Wn,tn.ly)&&(x(tn.id,Wn),T(tn.id,Qi,Or),v(ya=>{ya.actionState.fresnelReflectorWidth=Wn}))}break}}else if(tn.type===z.ParabolicDish){const Tn=tn;switch(Ct){case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Ln=Math.min(10,Zt);ks(tn,Tn.cx,Tn.cy,tn.lx,Ln)&&(x(tn.id,Ln),b(tn.id,Ln),v(Yn=>{Yn.actionState.parabolicDishRimDiameter=Ln}));break}}}}}}},{transparent:Yi,opacity:ua}=tM();m.useEffect(()=>{Je.current&&(Je.current.material[4].needsUpdate=!0)},[Yi]);const[Vl,Jl]=m.useState(!1),$u=fn=>{const tn=Eu.getIntersectionObjects(fn);if(tn.length==0||tn[0].eventObject.userData.id!==e){Vl&&(Cc(!1),Ue.current=null,Re(!1));return}const Ot=M.getState().selectedElement;!Vl&&Ot&&!Ot.locked&&Ot.type===z.SolarPanel&&M.getState().moveHandleType&&(Cc(!0,Ot.poleHeight),Ue.current=Ot,Re(!0))},Cc=(fn,tn)=>{fn&&tn!==void 0?(Jl(!0),tt.setZ(tn)):(Jl(!1),tt.setZ(0))},mu=()=>Vl?!0:Ue.current&&me.isSolarCollector(Ue.current)&&!Ue.current.locked;return m.useEffect(()=>{const fn=()=>{Ue.current&&we.current&&D(Ue.current.id,!1)};return window.addEventListener("beforeunload",fn),()=>{window.removeEventListener("beforeunload",fn)}},[]),h.jsx(h.Fragment,{children:h.jsxs("group",{ref:Ne,name:`${Fm} ${e}`,position:[n,o,It],rotation:[0,0,l[2]],userData:{id:e,fId:e},children:[h.jsx(Kye,{parentId:e,foundationId:e,wrapperType:z.Foundation,plx:r,ply:i,plz:a}),h.jsx(len,{foundationId:e,wrapperType:z.Foundation}),h.jsxs(si,{castShadow:G,receiveShadow:G,uuid:e,userData:{simulation:!0,stand:!0,id:e,aabb:!0},ref:Je,name:pX,args:[r,i,a],onContextMenu:or,onPointerOver:nr,onPointerDown:ar,onPointerUp:Wo,onPointerMove:k2.throttle(hl,qF,{trailing:!1}),onPointerOut:Ai,onPointerEnter:Fa,children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:s}),h.jsx("meshStandardMaterial",{attach:"material-1",color:s}),h.jsx("meshStandardMaterial",{attach:"material-2",color:s}),h.jsx("meshStandardMaterial",{attach:"material-3",color:s}),Z&&Te?h.jsx("meshBasicMaterial",{attach:"material-4",color:"white",map:Te,transparent:Yi,opacity:ua}):h.jsx("meshStandardMaterial",{attach:"material-4",color:p===_i.NoTexture?s:"white",map:Rn,transparent:Yi,opacity:ua}),h.jsx("meshStandardMaterial",{attach:"material-5",color:s})]}),mu()&&h.jsx(ta,{ref:nt,name:"Foundation Intersection Plane",position:tt,args:[r,i],visible:!1,onPointerMove:k2.throttle(Zs,qF)}),Se&&h.jsxs(h.Fragment,{children:[M.getState().rotateHandleType&&Ue.current&&me.isSolarCollector(Ue.current)&&h.jsx(_ye,{element:Ue.current,height:Ue.current.poleHeight+It}),(M.getState().moveHandleType||M.getState().resizeHandleType||ve.current)&&h.jsx(eme,{hx:ht,hy:ct,hz:It})]}),A&&h.jsx(Gye,{element:t,verticalLift:at}),(!A||q)&&h.jsx(mw,{hx:ht,hy:ct,hz:It,lineColor:q&&S?"white":c,lineWidth:q&&S?u*3:u}),A&&d&&h.jsx(mw,{hx:ht,hy:ct,hz:It,lineColor:B0,lineWidth:u*5}),De.show&&h.jsx("group",{position:[0,0,It+.01],children:h.jsx(NSe,{hx:ht,hy:ct,position:De.position,direction:De.direction,color:"black"})}),h.jsx("group",{position:[0,0,It+.01],children:ue.map((fn,tn)=>fn.show?h.jsx(NSe,{hx:ht,hy:ct,position:fn.position,direction:fn.direction,color:"yellow"},tn):null)}),A&&!d&&h.jsxs(h.Fragment,{children:[h.jsx(si,{ref:We,position:[Ft.x,Ft.y,0],args:[Ge,Ge,a*1.2],name:Mt.LowerLeft,onPointerDown:fn=>{L(e,fn,Xo.Resize),We.current&&v(tn=>{const Ot=We.current.localToWorld(new le(r,i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.LowerLeft)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===Mt.LowerLeft||M.getState().resizeHandleType===Mt.LowerLeft?ga:$a})}),h.jsx(si,{ref:Ee,position:[Ve.x,Ve.y,0],args:[Ge,Ge,a*1.2],name:Mt.UpperLeft,onPointerDown:fn=>{L(e,fn,Xo.Resize),Ee.current&&v(tn=>{const Ot=Ee.current.localToWorld(new le(r,-i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.UpperLeft)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===Mt.UpperLeft||M.getState().resizeHandleType===Mt.UpperLeft?ga:$a})}),h.jsx(si,{ref:ke,position:[ft.x,ft.y,0],args:[Ge,Ge,a*1.2],name:Mt.LowerRight,onPointerDown:fn=>{L(e,fn,Xo.Resize),ke.current&&v(tn=>{const Ot=ke.current.localToWorld(new le(-r,i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.LowerRight)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===Mt.LowerRight||M.getState().resizeHandleType===Mt.LowerRight?ga:$a})}),h.jsx(si,{ref:Oe,position:[kt.x,kt.y,0],args:[Ge,Ge,a*1.2],name:Mt.UpperRight,onPointerDown:fn=>{L(e,fn,Xo.Resize),Oe.current&&v(tn=>{const Ot=Oe.current.localToWorld(new le(-r,-i,0));tn.resizeAnchor.copy(Ot)})},onPointerOver:fn=>{Ao(fn,Mt.UpperRight)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===Mt.UpperRight||M.getState().resizeHandleType===Mt.UpperRight?ga:$a})}),!$&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:st,args:[at,6,6,0,Math.PI],position:[0,-ct-at,0],name:zo.Lower,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Lower,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!me.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Lower)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===zo.Lower||M.getState().moveHandleType===zo.Lower?ga:QF})}),h.jsx(Ps,{ref:je,args:[at,6,6,0,Math.PI],position:[0,ct+at,0],name:zo.Upper,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Upper,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!me.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Upper)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===zo.Upper||M.getState().moveHandleType===zo.Upper?ga:QF})}),h.jsx(Ps,{ref:xt,args:[at,6,6,0,Math.PI],position:[-ht-at,0,0],name:zo.Left,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Left,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!me.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Left)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===zo.Left||M.getState().moveHandleType===zo.Left?ga:iw})}),h.jsx(Ps,{ref:gt,args:[at,6,6,0,Math.PI],position:[ht+at,0,0],name:zo.Right,onPointerDown:()=>{v(fn=>{fn.moveHandleType=zo.Right,fn.selectedElement=fn.elements.find(tn=>tn.id===e)??null;for(const tn of fn.elements)fn.selectedElementIdSet.has(tn.id)&&!me.isElementAllowedMultipleMoveOnGround(tn)&&fn.selectedElementIdSet.delete(tn.id)}),kn.getState().setEnableOrbitController(!1)},onPointerOver:fn=>{Ao(fn,zo.Right)},onPointerOut:wo,children:h.jsx("meshBasicMaterial",{attach:"material",color:oe===zo.Right||M.getState().moveHandleType===zo.Right?ga:iw})}),h.jsx(dX,{id:e,position:[0,-Pt,0],color:oe===Di.Lower||M.getState().rotateHandleType===Di.Lower?ga:$a,ratio:yt,handleType:Di.Lower,hoverHandle:Ao,noHoverHandle:wo}),h.jsx(dX,{id:e,position:[0,Pt,0],color:oe===Di.Upper||M.getState().rotateHandleType===Di.Upper?ga:$a,ratio:yt,handleType:Di.Upper,hoverHandle:Ao,noHoverHandle:wo})]})]}),!$&&h.jsxs(h.Fragment,{children:[(ye||f)&&!A&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(t!=null&&t.label?t.label:Y.t("shared.FoundationElement",At))+(d?" ("+Y.t("shared.ElementLocked",At)+")":""),color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,fontFace:"Roboto",textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??It+.2]}),!d&&oe===Mt.LowerLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LL",text:"LL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-ht,-ct,It+.2]}),!d&&oe===Mt.UpperLeft&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UL",text:"UL",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[-ht,ct,It+.2]}),!d&&oe===Mt.LowerRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-LR",text:"LR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[ht,-ct,It+.2]}),!d&&oe===Mt.UpperRight&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label-UR",text:"UR",fontSize:20,fontFace:"Times Roman",textHeight:.2,position:[ht,ct,It+.2]})]}),g===Dn.FocusPipe&&h.jsx(uZt,{foundation:t}),g===Dn.FocusTower&&h.jsx(cZt,{foundation:t}),g===Dn.UpdraftTower&&h.jsx(sZt,{foundation:t}),h.jsx(ZZt,{...t})]})})}),qye="Handles Intersection Plane",Kz=t=>{if(t.intersections.length>0){for(const e of t.intersections)if(e.eventObject.name===qye)return e.point.z<0?null:e.point}return null},Q7=(t,e)=>new le().subVectors(t,new le(e.cx,e.cy,e.lz)).applyEuler(new ln(0,0,-e.rotation[2])),U$e=(t,e,n,o,r)=>{const[i,a]=[e/2,n/2],[l,s,c]=o,u=new ln().fromArray([l-Qt,s,c,"ZXY"]),d=r.map(f=>({x:f.x,y:f.y}));for(let f=-1;f<=1;f+=2)for(let p=-1;p<=1;p+=2){const g=new le(i*f,0,a*p).applyEuler(u),A=new le().addVectors(t,g);if(!me.isPointInside(A.x,A.y,d))return!1}return!0},cen=(t,e,n,o,r,i,a)=>{const l=n/2,[s,c,u]=i,d=new ln().fromArray([s-Qt,c,u,"ZXY"]),f=a.map(g=>({x:g.x,y:g.y})),p=new le().addVectors(t,new le(o*e,0,l+r).applyEuler(d));return!(!me.isPointInside(p.x,p.y,f)||!U$e(t,e,n,i,a))},uen=(t,e,n)=>{if(t.intersections.length>0)for(const o of t.intersections){const r=o.eventObject.name;if(r.includes("Window")&&r.includes(e)&&o.object.name!==qye)return null;if(r.includes("Roof")&&r.includes(n)){const i=o.point.clone(),a=Number.parseInt(o.object.name.split(" ").pop()??"-1");return{pointer:i,segmentIdx:a}}}return null},YSe=t=>{switch(t){case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:return!0}return!1},den=(t,e,n)=>{const o=new le().subVectors(e,t).applyEuler(new ln(0,0,-n)),r=Math.abs(o.x),i=Math.hypot(o.y,o.z),a=new le().addVectors(t,e).divideScalar(2);return{newLx:r,newLz:i,newCenter:a}},fen=(t,e,n)=>n===Go.Gambrel?Vye(t).map(o=>o.add(e)):t.map(o=>o.points[0].clone().add(e)),OSe=(t,e,n)=>{M.getState().set(o=>{const r=o.elements.find(i=>i.id===t&&i.type===z.Window);r&&([r.cx,r.cy,r.cz]=e,r.rotation=[...n])})},VSe=(t,e,n,o)=>{M.getState().set(r=>{const i=r.elements.find(a=>a.id===t&&a.type===z.Window);i&&([i.cx,i.cy,i.cz]=e,[i.lx,i.ly,i.lz]=n,o!=null&&(i.archHeight=o))})},_Se=(t,e)=>{M.getState().set(n=>{const o=n.elements.find(r=>r.id===t&&r.type===z.Window);o&&(o.polygonTop=[...e])})},hen=(t,e,n=.01)=>{if(t.type!==z.SolarPanel&&t.type!==z.Window)return null;const o=new ln().fromArray([t.rotation[0],t.rotation[1],t.rotation[2],"ZXY"]),r=new le,i=t.lx/2+n;let a=n;t.type===z.SolarPanel?(a+=t.ly/2,r.set(t.cx*e.lx,t.cy*e.ly,0)):(a+=t.lz/2,r.set(t.cx,t.cy,0));const l=[];for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=new le(s*i,s*c*a).applyEuler(o).add(r);l.push(u)}if(t.type===z.Window&&t.windowType===Ci.Polygonal){const[s,c]=t.polygonTop??Gp,u=new le(s*i,c+a).applyEuler(o).add(r);l.push(u)}return l},tae=t=>{if(t.windowType===Ci.Polygonal)return t.polygonTop??Gp},j$e=({z:t})=>{const e=m.useRef(null),[n,o]=m.useState("white");return h.jsx(si,{ref:e,name:Mt.Arch,args:[.2,.2,.2],position:[0,0,t],onPointerEnter:()=>{o("red")},onPointerLeave:()=>{o("white")},children:h.jsx("meshBasicMaterial",{color:n})})},pen=({id:t,parentId:e,foundationId:n,lx:o,lz:r,polygonTop:i,rotation:a,windowType:l,parentType:s})=>{const c=M(te=>te.addedWindowId),u=M(En),d=c===t,f=s===z.Roof,p=m.useRef(null),g=m.useRef(null),A=m.useRef(null),y=m.useRef(null),S=m.useRef(null),C=m.useRef(null),P=m.useRef(null),v=m.useRef(null),T=m.useRef([]),w=m.useRef(null),x=m.useRef(null),b=m.useRef(null),R=m.useRef(null),H=m.useRef(null),[F,E]=m.useState(!1),[N,U]=[o/2,r/2],[W,k]=i,D=m.useMemo(()=>o*W,[o,W]),L=M(pn),j=(te,ee,de)=>{if(!n)return null;const fe=M.getState().elements.find(Re=>Re.id===n&&Re.type===z.Foundation);if(!fe)return null;const pe=te.object.localToWorld(new le),[ye,ae,Te]=a,ge=new ln().fromArray([ye-Qt,ae,Te+fe.rotation[2],"ZXY"]),Se=new le(ee,0,de).applyEuler(ge);return new le().addVectors(pe,Se)},B=te=>{let ee,de,fe;for(const he of M.getState().elements)he.id===t&&he.type===z.Window?ee=he:he.id===n&&he.type===z.Foundation?de=he:he.id===e&&he.type===z.Roof&&(fe=he);const pe=kn.getState().contentRef;if(!ee||!de||!fe||!pe||!pe.current)return;const ye=de.id,ae=pe.current.children.find(he=>he.name===`${Fm} ${ye}`);if(!ae)return;const Te=ae.children.find(he=>he.name===L$e);if(!Te)return;const ge=Te.children.find(he=>he.name.includes("Roof")&&he.name.includes(e));if(!ge)return;const Se=ge.children[0];if(!Se)return;for(const he of M.getState().elements)if(he.parentId===e&&he.id!==t){const ve=hen(he,de);ve&&T.current.push(ve)}const{centroid:Re,roofSegments:De}=Se.userData,ue=new le(ee.cx,ee.cy,ee.cz+de.lz).clone().sub(Re);p.current=te,g.current=de,A.current=fe,C.current=bn.getSegmentIdx(De,ue),S.current=Re,y.current=De,v.current=fen(y.current,S.current,fe.roofType),w.current=[ee.cx,ee.cy,ee.cz],b.current=[ee.lx,ee.ly,ee.lz],x.current=[...ee.rotation],R.current=ee.archHeight,H.current=ee.polygonTop??null},O=()=>{if(!w.current||!x.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const ee={name:"Move skylight",timestamp:Date.now(),id:te.id,oldPosition:[...w.current],newPosition:[te.cx,te.cy,te.cz],oldRotation:[...x.current],newRotation:[...te.rotation],undo(){OSe(ee.id,ee.oldPosition,ee.oldRotation)},redo(){OSe(ee.id,ee.newPosition,ee.newRotation)}};u(ee)},V=()=>{if(!b.current||!w.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const ee={name:"Resize skylight",timestamp:Date.now(),id:te.id,oldPosition:[...w.current],newPosition:[te.cx,te.cy,te.cz],oldDimension:[...b.current],newDimension:[te.lx,te.ly,te.lz],oldArchHeight:R.current,newArchHeight:te.archHeight,undo(){VSe(this.id,this.oldPosition,this.oldDimension,this.oldArchHeight)},redo(){VSe(this.id,this.newPosition,this.newDimension,this.newArchHeight)}};u(ee)},G=()=>{if(!H.current)return;const te=M.getState().elements.find(de=>de.id===t&&de.type===z.Window);if(!te)return;const ee={name:"Resize skylight top vertex",timestamp:Date.now(),id:te.id,oldPolygonTop:[...H.current],newPolygonTop:te.polygonTop??Gp,undo(){_Se(this.id,this.oldPolygonTop)},redo(){_Se(this.id,this.newPolygonTop)}};u(ee)},q=te=>te.roofType===Go.Gable?!1:Math.abs(te.rise)<.001,$=te=>{if(A.current&&q(A.current))return v.current;if(te!=null){const de=Cn.getState().getRoofSegmentVertices(e);if(!de)return;const fe=te===-1?de.length-1:te;return de[fe]}},ie=(te,ee,de,fe,pe)=>{const[ye,ae]=[ee/2,de/2],Te=new ln().fromArray([fe[0],fe[1],fe[2],"ZXY"]),ge=[];for(let Se=-1;Se<=1;Se+=2)for(let Re=-1;Re<=1;Re+=2){const De=new le(Se*ye,Se*Re*ae).applyEuler(Te).add(te);ge.push(De)}if(pe){const[Se,Re]=pe,De=new le(Se*ye*2,Re+ae).applyEuler(Te).add(te);ge.push(De)}for(const Se of T.current){for(const Re of ge)if(me.isPointInside(Re.x,Re.y,Se))return!1;for(const Re of Se)if(me.isPointInside(Re.x,Re.y,ge))return!1}return!0},Q=(te,ee,de,fe,pe,ye)=>{if(ye){const[ae,Te]=ye;return cen(ee,de,fe,ae,Te,pe,te)}else return U$e(ee,de,fe,pe,te)},se=te=>{if(!f||d)return;const ee=te.object.name;switch(ee){case zo.Mid:break;case Mt.LowerLeft:{P.current=j(te,o,r);break}case Mt.LowerRight:{P.current=j(te,-o,r);break}case Mt.UpperLeft:{P.current=j(te,o,-r);break}case Mt.UpperRight:{P.current=j(te,-o,-r);break}case Mt.Arch:{P.current=j(te,0,-r);break}case Mt.Upper:break;default:return}B(ee),E(!0),kn.getState().setEnableOrbitController(!1)},oe=te=>{if(p.current===null||!g.current||!A.current||!y.current||!S.current||!v.current)return;const ee=g.current;if(p.current===zo.Mid){const de=A.current,fe=uen(te,t,e),pe=new le;if(q(de)){const ye=Kz(te);if(!ye)return;pe.copy(ye);const ae=Q7(pe,ee);L(Te=>{if(!v.current)return;const ge=Te.elements.find(we=>we.id===t&&we.type===z.Window);if(!ge)return;const{lx:Se,lz:Re,rotation:De}=ge,Ae=v.current,ue=tae(ge),he=Q(Ae,ae,Se,Re,De,ue),ve=ie(ae,Se,Re,De,ue);he&&ve&&(ge.cx=ae.x,ge.cy=ae.y,ge.cz=ae.z)})}else{if(fe&&fe.segmentIdx!==C.current){const Re=fe.pointer;pe.copy(Re)}else{const Re=Kz(te);if(!Re)return;pe.copy(Re)}const ye=Q7(pe,ee),ae=ye.clone().sub(S.current),{rotation:Te,segmentVertices:ge,segmentIdx:Se}=bn.computeState(y.current,ae);ge?ye.setZ(bn.getRooftopElementZ(ge,ae,S.current.z+de.thickness)):ye.setZ(S.current.z+de.thickness),L(Re=>{const De=Cn.getState().getRoofSegmentVertices(e);if(!De)return;const Ae=Se===-1?De.length-1:Se,ue=De[Ae];if(!ue)return;const he=Re.elements.find(ze=>ze.id===t&&ze.type===z.Window);if(!he)return;const{lx:ve,lz:we}=he,Pe=tae(he),Ie=Q(ue,ye,ve,we,Te,Pe),Me=ie(ye,ve,we,Te,Pe);Ie&&Me&&(he.cx=ye.x,he.cy=ye.y,he.cz=ye.z,he.rotation=[...Te],fe&&fe.segmentIdx!==C.current&&(C.current=fe.segmentIdx))})}}else if(YSe(p.current)){const de=$(C.current),fe=Kz(te),pe=P.current;if(!fe||!pe||!de)return;const ye=Q7(fe,ee),ae=Q7(pe,ee),{newLx:Te,newLz:ge,newCenter:Se}=den(ae,ye,a[2]);M.getState().set(Re=>{const De=Re.elements.find(ve=>ve.id===t&&ve.type===z.Window);if(!De)return;const Ae=tae(De),ue=Q(de,Se,Te,ge,a,Ae),he=ie(Se,Te,ge,a,Ae);ue&&he&&(De.cx=Se.x,De.cy=Se.y,De.cz=Se.z,De.lx=Te,De.lz=Math.max(.001,ge))})}else if(p.current===Mt.Upper){const de=$(C.current),fe=Kz(te);if(!fe||!de)return;const pe=Q7(fe,ee);L(ye=>{const ae=ye.elements.find(Ee=>Ee.id===t);if(!ae)return;const[Te,ge]=[ae.lx/2,ae.lz/2],Se=new le(ae.cx,ae.cy,ae.cz),Re=new ln().fromArray([ae.rotation[0],ae.rotation[1],ae.rotation[2],"ZXY"]),De=new le(-Te,-ge,0).applyEuler(Re).add(Se),Ae=new le(Te,-ge,0).applyEuler(Re).add(Se),ue=new le().subVectors(pe,De),he=new le().subVectors(Ae,De).normalize(),ve=ue.clone().projectOnVector(he).applyEuler(new ln(0,0,-ae.rotation[2])),we=me.clamp((ve.x-Te)/ae.lx,-.5,.5),Pe=bn.getDistance(De,Ae,pe),Ie=Math.hypot(Pe,pe.z-De.z),Me=Math.max(0,Ie-ae.lz),ze=[we,Me],Ne=new le(ae.cx,ae.cy,ae.cz),{lx:Je,lz:Ue}=ae,nt=Q(de,Ne,Je,Ue,a,ze),We=ie(Ne,Je,Ue,a,ze);nt&&We&&(ae.polygonTop=[...ze])})}else if(p.current===Mt.Arch){const de=Kz(te),fe=P.current,pe=$(C.current);if(!de||!fe||!pe)return;const ye=Q7(de,ee),ae=Q7(fe,ee);L(Te=>{const ge=Te.elements.find(Me=>Me.id===t&&Me.type===z.Window);if(!ge)return;const[Se,Re]=[ge.lx/2,ge.lz/2],De=new le(ge.cx,ge.cy,ge.cz),Ae=new ln().fromArray([ge.rotation[0],ge.rotation[1],ge.rotation[2],"ZXY"]),ue=new le(-Se,-Re,0).applyEuler(Ae).add(De),he=new le(Se,-Re,0).applyEuler(Ae).add(De),ve=bn.getDistance(ue,he,ye);let we=Math.hypot(ve,ye.z-ue.z);const Pe=Math.min(ge.archHeight,ge.lz,ge.lx/2),Ie=ge.lz-Pe;if(we>Ie&&we{p.current===zo.Mid?O():YSe(p.current)?V():p.current===Mt.Upper?G():p.current===Mt.Arch&&V(),w.current=null,b.current=null,x.current=null,R.current=null,H.current=null,p.current=null,g.current=null,A.current=null,y.current=null,S.current=null,C.current=null,P.current=null,v.current=null,T.current=[],E(!1),kn.getState().setEnableOrbitController(!0)};return h.jsxs(h.Fragment,{children:[h.jsxs("group",{name:"Handle Wrapper",onPointerDown:se,children:[!d&&h.jsxs(h.Fragment,{children:[l===Ci.Polygonal&&h.jsx(Sv,{x:D,z:U+k,handleType:Mt.Upper,scale:[.5,1,1.5]}),h.jsx(Sv,{x:-N,z:U,handleType:Mt.UpperLeft}),h.jsx(Sv,{x:N,z:U,handleType:Mt.UpperRight}),h.jsx(Sv,{x:-N,z:-U,handleType:Mt.LowerLeft}),h.jsx(Sv,{x:N,z:-U,handleType:Mt.LowerRight}),l===Ci.Arched&&h.jsx(j$e,{z:U})]}),h.jsx(Cxt,{handleType:zo.Mid})]}),f&&F&&h.jsx(ta,{name:qye,args:[1e3,1e3],rotation:[Qt,0,0],onPointerMove:oe,onPointerUp:Z,visible:!1,children:h.jsx("meshBasicMaterial",{color:"red",side:ti,transparent:!0,opacity:.5})})]})},gen=be.memo(pen),men=new pf({color:"white",side:ti}),yen=be.memo(({dimension:t,mullionData:e,shadowEnabled:n})=>{const[o,r,i]=t,{width:a,horizontalMullionSpacing:l,verticalMullionSpacing:s,color:c}=e,u=3,d=1,f=a/2,p=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:c}),[c]),g=m.useMemo(()=>{const y=[],S=Math.round(o/s)-1;if(S<=0||a===0)return y;const C=o/(S+1);let P=C/2;S%2!==0&&(y.push(0),P=C);for(let v=0;v{const y=[],S=Math.round(i/l)-1;if(S<=0||a===0)return y;const C=i/(S+1);let P=C/2;S%2!==0&&(y.push(0),P=C);for(let v=0;vh.jsx(ma,{position:[y,25e-5,0],args:[f,f,i,u,d],rotation:[Qt,Qt,0],receiveShadow:n,castShadow:n,children:p},S)),e.horizontalMullion&&A.map((y,S)=>h.jsx(ma,{position:[0,5e-4,y],args:[f,f,o,u,d],rotation:[0,0,Qt],receiveShadow:n,castShadow:n,children:p},S))]})}),Aen=be.memo(({dimension:t,frameData:e,shadowEnabled:n})=>{const[o,r,i]=t,{color:a,width:l,sillWidth:s}=e,c=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]),u=l/2,d=u/2,f=o+l*3,p=l;return h.jsxs("group",{name:"Window Frame Group",position:[0,-d/2,0],children:[h.jsx(si,{position:[0,0,i/2],args:[o+2*l,d,l],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[-o/2-u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[o/2+u,0,0],args:[l,d,i],castShadow:n,receiveShadow:n,children:c}),h.jsx(si,{position:[0,0,-i/2-(s===0?0:p/2)],args:s===0?[o+2*l,d,l]:[f,s??l,p],castShadow:n,receiveShadow:n,children:c})]})}),wen=be.memo(({cy:t,dimension:e,wireframeData:n})=>{const[o,r,i]=e,{lineWidth:a,lineColor:l,selected:s,locked:c,opacity:u}=n,d=o/2,f=i/2,p=3,g=1,A=m.useMemo(()=>new pf({color:l}),[l]),y=m.useMemo(()=>new pf({color:B0}),[]),S=(C,P)=>{const v=C/2;return h.jsxs(h.Fragment,{children:[h.jsx(ma,{args:[C,C,o,p,g],rotation:[0,0,Qt],position:[0,0,f-v],material:P}),h.jsx(ma,{args:[C,C,o,p,g],rotation:[0,0,Qt],position:[0,0,-f+v],material:P}),h.jsx(ma,{args:[C,C,i,p,g],rotation:[Qt,Qt,0],position:[d-v,0,0],material:P}),h.jsx(ma,{args:[C,C,i,p,g],rotation:[Qt,Qt,0],position:[-d+v,0,0],material:P})]})};return h.jsxs("group",{name:"Window Wireframe Group",children:[u>0&&h.jsx("group",{position:[0,t,0],children:S(a/20,A)}),c&&s&&S(a/5,y)]})}),ven=({id:t,dimension:e,position:n,mullionData:o,frameData:r,wireframeData:i,leftShutter:a,rightShutter:l,shutterColor:s,shutterWidth:c,glassMaterial:u,showHeatFluxes:d,area:f,empty:p,interior:g,foundation:A})=>{const y=M.getState().world,S=M(e5),C=M(a3),P=M(l3),v=M(Cs),T=Cn(Ib),w=m.useRef(0),x=m.useRef(),[b,R,H]=e,[F,E,N]=n,U=m.useMemo(()=>{if(!d||g||A&&A.notBuilding)return;const L=T.get(t);if(!L)return;const j=L.reduce((Q,se)=>Q+se,0);if(f===0)return;const B=i3*(y.solarRadiationHeatmapGridCellSize??.5),O=Math.max(2,Math.round(b/B)),V=Math.max(2,Math.round(H/B)),G=b/O,q=H/V,$=j/f*(S??Qm);w.current=$<0?1:0,x.current=me.getEuler(ko,Yc,"YXZ",Math.sign($)*Qt);const ie=[];if($<0)for(let Q=0;Qc*b,[b,c]),k=m.useMemo(()=>(W+r.width+b)/2*1.025,[b,W,r.width]),D=(L,j,B)=>h.jsx(ta,{name:"Window Seal Plane",args:L,position:j,rotation:B,material:men,receiveShadow:v,castShadow:v});return h.jsxs(h.Fragment,{children:[!p&&h.jsxs("group",{name:"Rectangle Window Plane Group",position:[0,E,0],children:[h.jsx(ta,{name:"Window Glass Plane",args:[b,H],rotation:[Qt,0,0],children:u}),(o.horizontalMullion||o.verticalMullion)&&h.jsx(yen,{dimension:e,mullionData:o,shadowEnabled:v})]}),r.showFrame&&h.jsx(Aen,{dimension:e,frameData:r,shadowEnabled:v}),h.jsx(Qye,{cx:k,lx:W,lz:H,color:s,showLeft:a,showRight:l,spacing:r.showFrame?r.width/2:0}),h.jsx(wen,{cy:E,dimension:e,wireframeData:i}),D([R,H],[-b/2+.001,R/2,0],[Qt,Qt,0]),D([R,H],[b/2-1e-4,R/2,0],[Qt,-Qt,0]),D([b,R],[0,R/2,H/2-.001],[Math.PI,0,0]),D([b,R],[0,R/2,-H/2+.001]),U&&U.map((L,j)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:L,name:"Heat Flux "+j,lineWidth:P??Zm,color:C??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:L[w.current].clone().add(new le(0,w.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:x.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:C??p0})})]},j))]})},xen=be.memo(ven),$ye=({element:t})=>{const e=M(m0),n=M(Ug),o=M(ly),r=t.lx/2,i=t.lz/2,a=.05,l=1,s=.5,c=t.lineColor??"white",u="darkorchid",d=Math.max(.25,(r+i)/32),f=.25,p=30,g=-.1,A=m.useMemo(()=>({lng:e}),[e]),y=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[-r-f,g,0]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f,0,-i],[-r-f,0,i]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f+a,0,-i+3*a],[-r-f,0,-i],[-r-f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r-f+a,0,i-3*a],[-r-f,0,i],[-r-f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r-f*2,0,-i]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i],[-r-f*2,0,i]],color:c,linewidth:s})]}),[r,i,A]),S=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lz.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[r+f,g,0]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f,0,-i],[r+f,0,i]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f+a,0,-i+3*a],[r+f,0,-i],[r+f-a,0,-i+3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r+f+a,0,i-3*a],[r+f,0,i],[r+f-a,0,i-3*a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,-i],[r+f*2,0,-i]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,i],[r+f*2,0,i]],color:c,linewidth:s})]}),[r,i,A]),C=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,g,-i-f]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i-f],[r,0,-i-f]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r+3*a,0,-i-f-a],[-r,0,-i-f],[-r+3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r-3*a,0,-i-f-a],[r,0,-i-f],[r-3*a,0,-i-f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,-i],[-r,0,-i-f*2]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,-i],[r,0,-i-f*2]],color:c,linewidth:s})]}),[r,i,A]),P=m.useMemo(()=>h.jsxs(h.Fragment,{children:[h.jsx("textSprite",{userData:{unintersectable:!0},backgroundColor:u,text:t.lx.toFixed(1)+Y.t("word.MeterAbbreviation",A),fontSize:p,fontFace:"Times Roman",textHeight:d,position:[0,g,i+f]}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i+f],[r,0,i+f]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r+3*a,0,i+f-a],[-r,0,i+f],[-r+3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r-3*a,0,i+f-a],[r,0,i+f],[r-3*a,0,i+f+a]],color:c,linewidth:l}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-r,0,i],[-r,0,i+f*2]],color:c,linewidth:s}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[r,0,i],[r,0,i+f*2]],color:c,linewidth:s})]}),[r,i,A]);if(n)switch(n){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[y,C]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[S,C]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[y,P]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[S,P]})}if(o)switch(o){case Mt.LowerLeft:return h.jsxs(h.Fragment,{children:[y,C]});case Mt.LowerRight:return h.jsxs(h.Fragment,{children:[S,C]});case Mt.UpperLeft:return h.jsxs(h.Fragment,{children:[y,P]});case Mt.UpperRight:return h.jsxs(h.Fragment,{children:[S,P]})}return h.jsx(h.Fragment,{})};be.memo($ye);const Qye=({cx:t,cz:e=0,lx:n,lz:o,color:r,showLeft:i,showRight:a,spacing:l})=>{const s=M(Cs),c=dt(hs),u=dt(p3);return c||u?null:h.jsxs("group",{name:"Shutter Group",children:[a&&h.jsx(si,{args:[n,.1,o],position:[t+l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})}),i&&h.jsx(si,{args:[n,.1,o],position:[-t-l,0,e],castShadow:s,receiveShadow:s,children:h.jsx("meshStandardMaterial",{color:r})})]})},cde="Window Group",Gp=[0,.5],ben=t=>{const{id:e,parentId:n,foundationId:o,cx:r,cy:i,cz:a,lx:l,ly:s,lz:c,rotation:u,locked:d,lineWidth:f=.2,lineColor:p="black",horizontalMullion:g=!0,verticalMullion:A=!0,mullionWidth:y=.06,horizontalMullionSpacing:S=.5,verticalMullionSpacing:C=.5,tint:P="#73D8FF",opacity:v=.5,leftShutter:T=!1,rightShutter:w=!1,shutterColor:x="gray",shutterWidth:b=.5,mullionColor:R="white",frame:H=!1,color:F="white",frameWidth:E=.1,sillWidth:N=.1,windowType:U=Ci.Default,archHeight:W,parentType:k=z.Wall,polygonTop:D=Gp}=t,L=`${cde} ${e}`,j=M(pn),B=M(yA),O=dt(Rf),V=M(vBe),G=Tc(e),q=(Se=!1)=>{j(Re=>{if(Re.contextMenuObjectType=null,Re.groupActionMode)Re.multiSelectionsMode||Re.selectedElementIdSet.clear(),t.foundationId&&(Re.selectedElementIdSet.has(n)?Re.selectedElementIdSet.delete(n):Re.selectedElementIdSet.add(t.foundationId));else for(const De of Re.elements)if(De.id===e)if(De.selected=!0,Re.selectedElement=De,Se)if(Re.selectedElementIdSet.has(e))for(const Ae of Re.elements)Re.selectedElementIdSet.has(Ae.id)&&Ae.type!==Re.selectedElement.type&&Re.selectedElementIdSet.delete(Ae.id);else if(Re.multiSelectionsMode){Re.selectedElementIdSet.add(e);for(const Ae of Re.elements)Re.selectedElementIdSet.has(Ae.id)&&Ae.type!==Re.selectedElement.type&&Re.selectedElementIdSet.delete(Ae.id)}else Re.selectedElementIdSet.clear(),Re.selectedElementIdSet.add(e);else Re.multiSelectionsMode?Re.selectedElementIdSet.has(e)?Re.selectedElementIdSet.delete(e):Re.selectedElementIdSet.add(e):(Re.selectedElementIdSet.clear(),Re.selectedElementIdSet.add(e));else De.selected=!1})},$=Se=>Se.intersections.length>0&&Se.intersections[0].eventObject.name===L&&!M.getState().moveHandleType&&!M.getState().resizeHandleType&&!M.getState().isAddingElement()&&M.getState().objectTypeToAdd===z.None,ie=Se=>{if(Se.eventObject.name===L&&Se.intersections.length>0)switch(Se.object.name){case zo.Mid:case Mt.UpperLeft:case Mt.UpperRight:case Mt.LowerLeft:case Mt.LowerRight:case Mt.Arch:case Mt.Upper:return!0}return!1},Q=(Se,Re)=>{kn.getState().setEnableOrbitController(!1),O("showWallIntersectionPlaneId",n),j(De=>{De.resizeHandleType=Se,De.resizeAnchor.copy(new le(r,0,a).add(Re))})},se=Se=>{if(!(Se.button===2||M.getState().addedWallId)&&($(Se)&&q(),ie(Se))){const Re=Se.intersections[0].eventObject.name;switch(Re){case zo.Mid:{kn.getState().setEnableOrbitController(!1),dt.getState().set(De=>{De.showWallIntersectionPlaneId=n,De.oldParentId=n,De.oldFoundationId=o}),j(De=>{De.moveHandleType=Re,De.selectedElement=De.elements.find(Ae=>{var ue;return Ae.id===((ue=De.selectedElement)==null?void 0:ue.id)})});break}case Mt.UpperLeft:{Q(Re,new le(l/2,0,-c/2));break}case Mt.UpperRight:{Q(Re,new le(-l/2,0,-c/2));break}case Mt.LowerLeft:{Q(Re,new le(l/2,0,c/2));break}case Mt.LowerRight:{Q(Re,new le(-l/2,0,c/2));break}case Mt.Arch:{Q(Re,new le(0,0,0));break}case Mt.Upper:{Q(Re,new le(0,0,c/2));break}}}},oe=Se=>{M.getState().addedWallId||$(Se)&&(q(!0),j(Re=>{Re.contextMenuObjectType=z.Window}))},Z=m.useMemo(()=>{if(k===z.Roof){const[Se,Re,De]=u;return new ln().fromArray([Se-Qt,Re,De,"ZXY"])}else return new ln},[k,u]),te=m.useMemo(()=>h.jsx("meshPhongMaterial",{specular:new rr("white"),shininess:V??mG,color:P,side:ti,opacity:v,transparent:!0}),[V,P,v]),ee=m.useMemo(()=>W!==void 0?[l,s,c,W]:[l,s,c],[l,s,c,W]),de=m.useMemo(()=>k===z.Roof?[r,.05,a]:[r,i,a],[r,i,a,k]),fe=m.useMemo(()=>({horizontalMullion:g,verticalMullion:A,width:y,horizontalMullionSpacing:S,verticalMullionSpacing:C,color:R}),[g,A,y,S,C,R]),pe=m.useMemo(()=>({showFrame:H,width:E,color:F,sillWidth:N}),[H,E,F,N]),ye=m.useMemo(()=>({lineColor:p,lineWidth:f,selected:G,locked:d,opacity:v}),[p,f,G,d,v]),ae=dt(p3),Te=()=>{switch(U){case Ci.Default:return h.jsx(xen,{id:t.id,dimension:ee,position:de,mullionData:fe,frameData:pe,wireframeData:ye,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,glassMaterial:te,showHeatFluxes:ae,area:me.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:B(t)});case Ci.Arched:return h.jsx(jxt,{id:t.id,dimension:ee,position:de,mullionData:fe,frameData:pe,wireframeData:ye,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,glassMaterial:te,showHeatFluxes:ae,area:me.getWindowArea(t),empty:!!t.empty,interior:!!t.interior,foundation:B(t)});case Ci.Polygonal:return h.jsx(Xxt,{id:t.id,dimension:ee,polygonTop:D,position:de,glassMaterial:te,empty:!!t.empty,interior:!!t.interior,wireframeData:ye,frameData:pe,leftShutter:T,rightShutter:w,shutterColor:x,shutterWidth:b,showHeatFluxes:ae,area:me.getWindowArea(t),foundation:B(t)})}},ge=k===z.Roof?i:0;return h.jsxs("group",{name:L,position:[r,ge,a],rotation:Z,onPointerDown:se,onContextMenu:oe,onPointerMove:()=>{},children:[Te(),G&&h.jsx($ye,{element:t}),G&&!d&&h.jsx(gen,{id:e,parentId:n,foundationId:o,lx:l,lz:c,polygonTop:D,rotation:u,windowType:U,parentType:k})]},e)},B$e=be.memo(ben),Sen=be.memo(({lineColor:t="black",lineWidth:e=.2,hx:n,hz:o,fill:r,isTopPartial:i,leftUnfilledHeight:a,rightUnfilledHeight:l,showParapet:s=!1,leftHeight:c=2*o,rightHeight:u=2*o,center:d,centerLeft:f,centerRight:p})=>{const g=M(T=>T.viewState.orthographic),A=[-n,-o+.001+(r===Fl.Partial?a:0),.001],y=[n,-o+.001+(r===Fl.Partial?l:0),.001],S=[-n,c-o-.001,.001],C=[n,u-o-.001,.001],P=n*2,v=[];if(g)e=2,v.push(S,C);else if(s)v.push(S,A,y,C);else if(i)v.push(A,S,C,y,A);else{if(v.push(A,S),f){const T=[f[0]*P,f[1]-o,.001];v.push(T)}if(d){const T=[d[0]*P,d[1]-o,.001];v.push(T)}if(p){const T=[p[0]*P,p[1]-o,.001];v.push(T)}v.push(C,y)}return h.jsx(be.Fragment,{children:h.jsx(Gn,{rotation:[Qt,0,0],points:v,color:t,lineWidth:e})})});var Rd=(t=>(t.Default="Default",t.Arched="Arched",t))(Rd||{});const Ten=be.memo(({dimension:t,lineColor:e,lineWidth:n})=>{const[o,r,i]=t.map(u=>u/2),a=[-o,0,i+.05],l=[o,0,i+.05],s=[-o,0,-i],c=[o,0,-i];return h.jsx(Gn,{points:[s,a,l,c],lineWidth:n,color:e})}),Pen=be.memo(({dimension:t,color:e})=>{const[n,o,r]=t,i=M(Cs),a=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:e}),[e]),l=.1,s=l/2;return h.jsxs("group",{name:"Door frame group",children:[h.jsx(si,{position:[0,0,r/2],args:[n,l,l],castShadow:i,receiveShadow:i,children:a}),h.jsx(si,{position:[-n/2+s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a}),h.jsx(si,{position:[n/2-s,0,0],args:[l,l,r],castShadow:i,receiveShadow:i,children:a})]})}),Cen=be.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,area:s,showHeatFluxes:c,foundation:u})=>{const d=M.getState().world,f=M(e5),p=M(a3),g=M(l3),A=M(Cs),y=Cn(Ib),S=m.useRef(0),C=m.useRef(),[P,v,T]=e,w=m.useMemo(()=>{if(!c||u&&u.notBuilding)return;const b=y.get(t);if(!b)return;const R=b.reduce((D,L)=>D+L,0);if(s===0)return;const H=i3*(d.solarRadiationHeatmapGridCellSize??.5),F=Math.max(2,Math.round(P/H)),E=Math.max(2,Math.round(T/H)),N=P/F,U=T/E,W=R/s*(f??Qm);S.current=W<0?1:0,C.current=me.getEuler(ko,Yc,"YXZ",Math.sign(W)*Qt);const k=[];if(W<0)for(let D=0;D{const b=new kl,[R,H]=[P/2,T/2],F=Math.max(R,H)*.2;return b.moveTo(-R,-H),b.lineTo(-R,H),b.lineTo(R,H),b.lineTo(R,-H),l||(b.lineTo(R-F,-H),b.lineTo(R-F,H-F),b.lineTo(-R+F,H-F),b.lineTo(-R+F,-H)),b.closePath(),b},[P,T,l]);return h.jsxs("group",{name:"Rectangle door group",position:[0,-.01,0],children:[h.jsx("mesh",{name:"Rectangular Door Mesh",rotation:[Qt,0,0],material:a,castShadow:A&&l,receiveShadow:A&&l,children:h.jsx("shapeGeometry",{args:[x]})}),l&&h.jsxs("mesh",{name:"Rectangular Door Simulation Mesh",rotation:[Qt,0,0],uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[x]}),h.jsx("meshBasicMaterial",{side:ti})]}),l&&h.jsx("mesh",{name:"Door plane inside",position:[0,.1,0],rotation:[-Qt,0,Math.PI],material:a,castShadow:A&&l,receiveShadow:A&&l,children:h.jsx("shapeGeometry",{args:[x]})}),h.jsx(Ten,{dimension:e,lineColor:r&&i?B0:"black",lineWidth:r&&i?2:.2}),h.jsx(Pen,{dimension:e,color:o}),w&&w.map((b,R)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:b,name:"Heat Flux "+R,lineWidth:g??Zm,color:p??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:b[S.current].clone().add(new le(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:p??p0})})]},R))]})}),Ren=be.memo(({id:t,dimension:e,color:n,frameColor:o,selected:r,locked:i,material:a,filled:l,showHeatFluxes:s,area:c,foundation:u})=>{const d=M.getState().world,f=M(Cs),p=M(e5),g=M(a3),A=M(l3),y=Cn(Ib),S=m.useRef(0),C=m.useRef(),[P,v,T,w]=e,x=(F,E)=>{if(w>0){const N=.5*P,U=.5*T,W=Math.min(w,T,N),k=.5*(W+N*N/W);if(Math.abs(F)-U)return!0;const D=E-(T-k-U);return F*F+D*D{if(!s||u&&u.notBuilding)return;const F=y.get(t);if(!F)return;const E=F.reduce((B,O)=>B+O,0);if(c===0)return;const N=i3*(d.solarRadiationHeatmapGridCellSize??.5),U=Math.max(2,Math.round(P/N)),W=Math.max(2,Math.round(T/N)),k=P/U,D=T/W,L=E/c*(p??Qm);S.current=L<0?1:0,C.current=me.getEuler(ko,Yc,"YXZ",Math.sign(L)*Qt);const j=[];if(L<0)for(let B=0;B{const F=new kl,E=P/2,N=T/2,U=Math.min(w,T,E);if(F.moveTo(E,-N),F.lineTo(E,N-U),U>.1){const W=U/2+P**2/(8*U),[k,D]=[0,N-W],L=Math.acos(Math.min(E/W,1)),j=Math.PI-L;F.absarc(k,D,W,L,j,!1)}else F.lineTo(-E,N);if(F.lineTo(-E,-N),!l){const W=P*.4,k=T*.4,D=Math.min(w*.8,T*.8,E*.8);if(F.lineTo(-W,-N),D>.1){F.lineTo(-W,N-D);const L=D/2+(P*.8)**2/(8*D),[j,B]=[0,k-L],O=Math.acos(Math.min(W/L,1)),V=Math.PI-O;F.absarc(j,B,L,V,O,!0)}else F.lineTo(-W,k),F.lineTo(W,k);F.lineTo(W,-N)}return F.closePath(),F},[P,T,w,l]),H=m.useMemo(()=>({lineColor:"black",lineWidth:i&&r?.2:.1,opacity:1,selected:r,locked:i}),[r,i]);return h.jsxs("group",{name:"Arched door group",children:[h.jsx("mesh",{name:"Arched Door Mesh",rotation:[Qt,0,0],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),l&&h.jsxs("mesh",{name:"Arched Door Simulation Mesh",rotation:[Qt,0,0],material:a,uuid:t,userData:{simulation:!0},castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[R]}),h.jsx("meshBasicMaterial",{side:ti})]}),l&&h.jsx("mesh",{name:"Door plane mesh inside",position:[0,.1,0],rotation:[-Qt,0,Math.PI],material:a,castShadow:f&&l,receiveShadow:f&&l,children:h.jsx("shapeGeometry",{args:[R]})}),h.jsx(Zce,{cy:0,dimension:e,wireframeData:H}),h.jsx(Zce,{cy:v,dimension:e,wireframeData:H}),b&&b.map((F,E)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:F,name:"Heat Flux "+E,lineWidth:A??Zm,color:g??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:F[S.current].clone().add(new le(0,S.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:C.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:g??p0})})]},E))]})}),Y$e="/aladdin/assets/door_edge-Dxz9LnYZ.png",O$e="/aladdin/assets/door_01-Bl1yYWKp.png",ude="/aladdin/assets/door_02-eLAy3erM.png",V$e="/aladdin/assets/door_03-CX-eEQtv.png",_$e="/aladdin/assets/door_04-Bk3Xe_KE.png",G$e="/aladdin/assets/door_05-15BnnbHK.png",X$e="/aladdin/assets/door_06-B08sjms-.png",J$e="/aladdin/assets/door_07-BVyEwygm.png",K$e="/aladdin/assets/door_08-Cd1Vc7FQ.png",q$e="/aladdin/assets/door_09-DQcA4jCn.png",$$e="/aladdin/assets/door_10-DVLJsY3W.png",Q$e="/aladdin/assets/door_11-dOCMnkGG.png",Z$e="/aladdin/assets/door_12-7f2iD2B7.png",eQe="/aladdin/assets/door_13-IsPl-xmI.png",tQe="/aladdin/assets/door_14-CljRO-fX.png",nQe="/aladdin/assets/door_15-CoUc1lfF.png",oQe="/aladdin/assets/door_16-Dlbc5tIF.png",rQe="/aladdin/assets/door_17-CHob_UgA.png",Hen=(t,e,n,o)=>{const r=m.useMemo(()=>{let s;switch(t){case sr.Default:s=Y$e;break;case sr.NoTexture:s=og;break;case sr.Texture01:s=O$e;break;case sr.Texture02:s=ude;break;case sr.Texture03:s=V$e;break;case sr.Texture04:s=_$e;break;case sr.Texture05:s=G$e;break;case sr.Texture06:s=X$e;break;case sr.Texture07:s=J$e;break;case sr.Texture08:s=K$e;break;case sr.Texture09:s=q$e;break;case sr.Texture10:s=$$e;break;case sr.Texture11:s=Q$e;break;case sr.Texture12:s=Z$e;break;case sr.Texture13:s=eQe;break;case sr.Texture14:s=tQe;break;case sr.Texture15:s=nQe;break;case sr.Texture16:s=oQe;break;case sr.Texture17:s=rQe;break;default:s=ude}return new cf().load(s,c=>{n!==void 0&&o!==void 0&&(c.offset.set(.5,.5),c.repeat.set(1/n,1/o)),a(c),l()})},[t,e,n,o]),[i,a]=m.useState(r),{invalidate:l}=ri();return i},Men=new pf({color:"white",side:Da}),Ien=be.memo(({dimension:t,doorType:e})=>{const[n,o,r]=t.map(a=>a/2);return n===0&&r===0?null:h.jsxs("group",{name:"Door handle wrapper",children:[h.jsx(Sv,{x:-n,z:r,handleType:Mt.UpperLeft}),h.jsx(Sv,{x:n,z:r,handleType:Mt.UpperRight}),e===Rd.Arched&&h.jsx(j$e,{z:r})]})}),zen=be.memo(({dimension:t})=>{const e=M(Cs),[n,o,r]=t,[i,a,l]=t.map(c=>c/2),s=(c,u,d)=>h.jsx(ta,{name:"Door seal plane",args:c,position:u,rotation:d,material:Men,receiveShadow:e});return h.jsxs("group",{name:"Door seal planes group",children:[s([o,r],[-i,a,0],[Qt,Qt,0]),s([o,r],[i,a,0],[Qt,-Qt,0]),s([n,o],[0,a,l],[Math.PI,0,0])]})}),Den=t=>{const{id:e,parentId:n,cx:o,cy:r,cz:i,lx:a,ly:l,lz:s,textureType:c,locked:u=!1,color:d="white",doorType:f=Rd.Default,archHeight:p=1,filled:g=!0,opacity:A=1,frameColor:y="white"}=t,S=`Door Group ${e}`,C=M(pn),P=dt(Rf),v=M(vBe),T=Tc(e),w=m.useRef(!1);m.useEffect(()=>{const q=()=>{w.current=!1};return window.addEventListener("pointerup",q),()=>window.removeEventListener("pointerup",q)},[]);const x=(q=!1)=>{C($=>{if($.groupActionMode)$.multiSelectionsMode||$.selectedElementIdSet.clear(),t.foundationId&&($.selectedElementIdSet.has(n)?$.selectedElementIdSet.delete(n):$.selectedElementIdSet.add(t.foundationId));else for(const ie of $.elements)if(ie.id===e)if(ie.selected=!0,$.selectedElement=ie,q)if($.selectedElementIdSet.has(e))for(const Q of $.elements)$.selectedElementIdSet.has(Q.id)&&Q.type!==$.selectedElement.type&&$.selectedElementIdSet.delete(Q.id);else if($.multiSelectionsMode){$.selectedElementIdSet.add(e);for(const Q of $.elements)$.selectedElementIdSet.has(Q.id)&&Q.type!==$.selectedElement.type&&$.selectedElementIdSet.delete(Q.id)}else $.selectedElementIdSet.clear(),$.selectedElementIdSet.add(e);else $.multiSelectionsMode?$.selectedElementIdSet.has(e)?$.selectedElementIdSet.delete(e):$.selectedElementIdSet.add(e):($.selectedElementIdSet.clear(),$.selectedElementIdSet.add(e));else ie.selected=!1})},b=q=>q.intersections.length>0&&q.intersections[0].eventObject.name===S&&!M.getState().moveHandleType&&!M.getState().resizeHandleType&&!M.getState().isAddingElement()&&M.getState().objectTypeToAdd===z.None,R=q=>{if(q.eventObject.name===S&&q.intersections.length>0)switch(q.object.name){case Mt.UpperLeft:case Mt.UpperRight:case Mt.Arch:return!0}return!1},H=(q,$)=>{kn.getState().setEnableOrbitController(!1),P("showWallIntersectionPlaneId",n),C(ie=>{ie.resizeHandleType=q,ie.resizeAnchor.copy(new le(o,0,i).add($))})},F=q=>{M.getState().addedWallId||b(q)&&(x(!0),C($=>{$.contextMenuObjectType=z.Door}))},E=q=>{if(!(w.current||q.button===2||M.getState().addedWallId)&&(w.current=!0,b(q)&&x(),R(q))){const $=q.intersections[0].eventObject.name;switch($){case Mt.UpperLeft:{H($,new le(a/2,0,-s/2));break}case Mt.UpperRight:{H($,new le(-a/2,0,-s/2));break}case Mt.Arch:{H($,new le(0,0,0));break}}}},N=M(yA),U=dt(hs),W=dt(p3),k=M(Pf),D=Cn(c1),[L,j]=m.useState(null),B=()=>{switch(f){case Rd.Default:return h.jsx(Cen,{id:e,dimension:V,color:d,frameColor:y,selected:T,locked:u,material:G,filled:g,showHeatFluxes:W,area:me.getDoorArea(t),foundation:N(t)});case Rd.Arched:return h.jsx(Ren,{id:e,dimension:V,color:d,frameColor:y,selected:T,locked:u,material:G,filled:g,showHeatFluxes:W,area:me.getDoorArea(t),foundation:N(t)})}};m.useEffect(()=>{if(t&&U){const q=D(t.id);if(q){const $=me.fetchHeatmapTexture(q,k??5);$&&($.wrapS=bs,$.wrapT=bs,$.offset.set(-a/2,-s/2),$.center.set(a/2,s/2),$.repeat.set(1/a,1/s),j($))}}},[U,k]);const O=Hen(c,f,a,s),V=m.useMemo(()=>[a,l,s,p],[a,l,s,p]),G=m.useMemo(()=>U&&L&&t.filled?new t3({color:d,map:L,side:Da}):g?c===sr.Default||c===sr.NoTexture?A<1?new Z1e({specular:"white",shininess:v??mG,color:d,side:Da,opacity:A,transparent:!0}):new pf({map:O,color:d,side:Da}):new pf({map:O,side:Da}):new pf({opacity:d===jce?.5:0,color:d,transparent:!0,side:ti}),[U,L,d,c,O,g,A]);return h.jsxs("group",{name:S,position:[o,0,i],onPointerDown:E,onContextMenu:F,children:[B(),T&&h.jsx($ye,{element:t}),T&&!u&&h.jsx(Ien,{dimension:V,doorType:f}),h.jsx(zen,{dimension:V})]})},Een=be.memo(Den),Fen="/aladdin/assets/polygon_08-BBFzZjDj.png",ken="/aladdin/assets/polygon_09-B_8KpAt3.png",Len="/aladdin/assets/polygon_10-CKqrpQre.png",iQe=({id:t,lz:e=.1,filled:n=!1,rotation:o=[0,0,0],normal:r=[0,0,1],color:i="yellow",label:a,text:l,fontSize:s=1,fontColor:c="black",fontOutlineWidth:u=0,fontOutlineColor:d="white",fontStrokeWidth:f=0,fontStrokeColor:p="black",lineStyle:g=Xh.Solid,lineColor:A="black",lineWidth:y=1,locked:S=!1,showLabel:C=!1,parentId:P,foundationId:v,vertices:T,opacity:w=1,noOutline:x=!1,shininess:b=0,selectedIndex:R=-1,textureType:H=Kr.NoTexture})=>{const F=M(pn),E=M(pu),N=M(n$),U=M(Cs),W=Tc(t),{gl:{domElement:k}}=ri(),[D,L]=m.useState(!1),[j,B]=m.useState(0),[O,V]=m.useState(0),[G,q]=m.useState(null),$=m.useRef(null),ie=m.useRef(null),Q=M(Me=>{for(const ze of Me.elements)if(ze.id===P)return ze}),se=new le,oe=new ln;if((Q==null?void 0:Q.type)===z.Cuboid){const{pos:Me,rot:ze}=me.getWorldDataById(Q.id);se.copy(Me),oe.set(0,0,ze)}const Z=Q?Math.max(1,Math.max(Q.lx,Q.ly)/24):1,te=sR*Z,ee=Wg*Z,de=$t(),fe=(Me,ze)=>{F(Ne=>{for(const Je of Ne.elements)if(Je.type===z.Polygon&&Je.id===Me){Je.selectedIndex=ze;break}})},pe=m.useMemo(()=>{const Me=new Array;if(Q){switch(Q.type){case z.Foundation:{for(const Ne of T)Me.push({x:Ne.x*Q.lx,y:Ne.y*Q.ly});break}case z.Wall:{for(const Ne of T)Me.push({x:Ne.x*Q.lx,y:Ne.y*Q.lz});break}case z.Cuboid:{const Ne=new le().fromArray(r);let Je,Ue;me.isUnitVectorX(Ne)?(Je=Q.lz,Ue=Q.ly):me.isUnitVectorY(Ne)?(Je=Q.lx,Ue=Q.lz):(Je=Q.lx,Ue=Q.ly);for(const nt of T)Me.push({x:nt.x*Je,y:nt.y*Ue});break}}const ze=me.calculatePolygonCentroid(Me);B(ze.x),V(ze.y)}return Me},[T,Q,r]),ae=(()=>{if((Q==null?void 0:Q.type)===z.Cuboid){const Me=me.isIdentical(r,as);return se.z+(Q.lz+(Me?0:e))/2+.01}return(Q==null?void 0:Q.type)===z.Foundation?Q.lz+.01:e/2+.01})(),ge=(()=>{if((Q==null?void 0:Q.type)===z.Wall)return new ln(-Qt,0,Math.PI,"ZXY");const Me=new le().fromArray(r);let ze=o[2];return(Q==null?void 0:Q.type)===z.Cuboid&&(ze=oe.z),me.isSame(Me,Op)?new ln(0,Qt,ze,"ZXY"):me.isSame(Me,Vp)?new ln(0,-Qt,ze,"ZXY"):me.isSame(Me,Yc)?new ln(-Qt,0,ze,"ZXY"):me.isSame(Me,_p)?new ln(Qt,0,ze,"ZXY"):new ln(0,0,ze,"ZXY")})(),Re=(()=>{if(Q){if(Q.type===z.Cuboid){const Me=new le(se.x,se.y,ae),ze=new le().fromArray(r);let Ne=!1;const Je=new le;return me.isSame(ze,Op)?(Ne=!0,Je.x=Q.lx/2+.01):me.isSame(ze,Vp)?(Ne=!0,Je.x=-Q.lx/2-.01):me.isSame(ze,Yc)?(Ne=!0,Je.y=Q.ly/2+.01):me.isSame(ze,_p)&&(Ne=!0,Je.y=-Q.ly/2-.01),Ne&&(Je.applyEuler(oe),Me.x=se.x+Je.x,Me.y=se.y+Je.y,Me.z=se.z+Je.z),Me}else if(Q.type===z.Wall)return new le(0,-.01,0)}return new le((Q==null?void 0:Q.cx)??0,(Q==null?void 0:Q.cy)??0,ae)})(),De=m.useMemo(()=>{const Me=new Array;for(const ze of pe)Me.push(new le(ze.x,ze.y,0));return Me.push(new le(pe[0].x,pe[0].y,0)),Me},[pe]),Ae=m.useMemo(()=>{const Me=new kl;Me.moveTo(pe[0].x,pe[0].y);for(let ze=1;ze{Me.intersections.length>0&&Me.intersections[0].object===Me.eventObject&&(q(ze),ze===zo.Default?k.style.cursor="move":k.style.cursor="pointer")},[]),he=m.useCallback(()=>{q(null),k.style.cursor="default"},[]),ve=Me=>{switch(Me){case Kr.Texture01:return{x:1,y:1};case Kr.Texture02:return{x:2,y:2};case Kr.Texture03:return{x:.4,y:.4};case Kr.Texture04:return{x:.25,y:.25};case Kr.Texture05:return{x:5,y:5};case Kr.Texture06:return{x:1,y:1};case Kr.Texture07:return{x:1,y:1};case Kr.Texture08:return{x:2,y:2};case Kr.Texture09:return{x:2,y:2};case Kr.Texture10:return{x:4,y:4};default:return{x:1,y:1}}},we=m.useMemo(()=>{let Me;switch(H){case Kr.Texture01:Me=w$e;break;case Kr.Texture02:Me=v$e;break;case Kr.Texture03:Me=x$e;break;case Kr.Texture04:Me=b$e;break;case Kr.Texture05:Me=S$e;break;case Kr.Texture06:Me=T$e;break;case Kr.Texture07:Me=P$e;break;case Kr.Texture08:Me=Fen;break;case Kr.Texture09:Me=ken;break;case Kr.Texture10:Me=Len;break;default:Me=og}return new cf().load(Me,ze=>{const Ne=ve(H);ze.wrapT=ze.wrapS=bs,ze.repeat.set(1/Ne.x,1/Ne.y);const Je=new le().fromArray(r);me.isSame(Je,Op)?ze.rotation=Qt:me.isSame(Je,Vp)?ze.rotation=-Qt:me.isSame(Je,_p)&&(ze.rotation=Math.PI),Ie(ze)})},[H,r]),[Pe,Ie]=m.useState(we);return h.jsxs("group",{name:"Polygon Group "+t,rotation:ge,position:Re,children:[n&&h.jsxs("mesh",{uuid:t,ref:$,receiveShadow:U,castShadow:!1,name:z.Polygon,onPointerDown:Me=>{Me.button!==2&&N===z.None&&E(t,Me)},onContextMenu:Me=>{E(t,Me,Xo.ContextMenu),F(ze=>{Me.intersections.length>0&&Me.intersections[0].object===$.current&&(Me.intersections.length>1&&ze.pastePoint.copy(Me.intersections[1].point),ze.contextMenuObjectType=z.Polygon)})},onPointerOver:Me=>{Me.intersections.length>0&&Me.intersections[0].object===$.current&&L(!0)},onPointerOut:()=>{L(!1),k.style.cursor="default"},children:[h.jsx("shapeGeometry",{attach:"geometry",args:[Ae]}),b===void 0||b===0?h.jsx("meshStandardMaterial",{attach:"material",color:H===Kr.NoTexture?i:"white",map:Pe,side:ti,transparent:w<1,opacity:w}):h.jsx("meshPhongMaterial",{attach:"material",color:H===Kr.NoTexture?i:"white",map:Pe,side:Da,specular:new rr("white"),shininess:b,transparent:w<1,opacity:w})]}),l&&h.jsx(s4t,{fontSize:s,scale:[1,1,1],color:c,position:[j,O,.01],rotation:[0,0,(Q==null?void 0:Q.type)===z.Wall?Math.PI:0],anchorX:"center",anchorY:"middle",outlineWidth:u,outlineColor:d,strokeWidth:f,strokeColor:p,children:l}),(!x||S&&W)&&h.jsx(Gn,{points:De,color:S&&W?B0:A,lineWidth:y,dashed:g&&g!==Xh.Solid,dashSize:g===Xh.Dashed?.3:.1,gapSize:.1,uuid:t,receiveShadow:!1,castShadow:!1,name:"Polygon Wireframe",onPointerDown:Me=>{Me.button!==2&&E(t,Me)},onContextMenu:Me=>{N===z.None&&(E(t,Me,Xo.ContextMenu),F(ze=>{if(Me.intersections.length>0){const Ne=Me.intersections[0].object;Ne.name==="Polygon Wireframe"&&Ne.uuid===t&&(ze.contextMenuObjectType=z.Polygon)}}))}}),!n&&h.jsx(Gn,{position:[0,0,.1],points:De,visible:!1,lineWidth:Math.min(y*10,10),receiveShadow:!1,castShadow:!1,uuid:t,name:"Polygon Enlarged Line",onPointerDown:Me=>{Me.button!==2&&E(t,Me)},onContextMenu:Me=>{N===z.None&&(E(t,Me,Xo.ContextMenu),F(ze=>{if(Me.intersections.length>0){const Ne=Me.intersections[0].object;Ne.name==="Polygon Enlarged Line"&&Ne.uuid===t&&(ze.contextMenuObjectType=z.Polygon)}}))}}),W&&!S&&h.jsx(Ps,{ref:ie,position:[j,O,0],args:[ee,6,6],name:zo.Default,onPointerDown:Me=>{Me.button!==2&&(E(t,Me,Xo.Move),kn.getState().setEnableOrbitController(!1),dt.getState().set(ze=>{ze.showWallIntersectionPlaneId=P,ze.oldParentId=P,ze.oldFoundationId=v}),F(ze=>{ze.moveHandleType=zo.Default}))},onPointerOver:Me=>{ue(Me,zo.Default)},onPointerOut:he,children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),W&&!S&&pe.map((Me,ze)=>h.jsxs(be.Fragment,{children:[h.jsx(si,{userData:{vertexIndex:ze},position:[Me.x,Me.y,0],name:Mt.Default,args:[te,te,e/2+(n?0:.1)],onPointerDown:Ne=>{Ne.button!==2&&(E(t,Ne,Xo.Resize),fe(t,ze),kn.getState().setEnableOrbitController(!1),dt.getState().set(Je=>{Je.showWallIntersectionPlaneId=P,Je.oldParentId=P,Je.oldFoundationId=v}),F(Je=>{Je.resizeHandleType=Mt.Default}))},onPointerOver:Ne=>{ue(Ne,Mt.Default),fe(t,ze)},onPointerOut:he,onContextMenu:Ne=>{F(Je=>{if(Ne.intersections.length>0){const Ue=Ne.intersections[0].object.userData.vertexIndex;Ue!==void 0&&(Je.contextMenuObjectType=z.PolygonVertex,fe(t,Ue))}})},children:h.jsx("meshBasicMaterial",{attach:"material",color:(G===Mt.Default||M.getState().resizeHandleType===Mt.Default)&&R===ze?ga:$a})}),h.jsx("textSprite",{name:"Label "+ze,text:""+ze,fontSize:20*Z,fontFace:"Times Roman",textHeight:.2*Z,position:[Me.x,Me.y,.2*Z]})]},"resize-handle-"+ze)),(D||C)&&!W&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",text:(a??Y.t("shared.PolygonElement",de))+(S?" ("+Y.t("shared.ElementLocked",de)+")":""),fontSize:20*Z,fontFace:"Times Roman",textHeight:.2*Z,position:[0,0,e+.2]})]})},Zye={display:!1,color:"white",textureType:Bo.NoTexture,parapetHeight:1,copingsWidth:.5,copingsHeight:.1},Wen=({args:t,wallData:e,parapetZ:n,currWallPointData:o,leftWallPointData:r,rightWallPointData:i})=>{const{display:a,color:l,textureType:s,parapetHeight:c,copingsWidth:u,copingsHeight:d}=t,{id:f,cx:p,cy:g,hx:A,hy:y,angle:S}=e,C=c-d,P=f$e(s),v=m.useMemo(()=>{const W=new le(-A,y-u/2),k=new le(A,y-u/2),D=new le(A,y+u/2),L=new le(-A,y+u/2),j=[W,k,D,L];if(i||r){const B=GSe(o);if(i&&wO(o.rightPoint,i.leftPoint)){const O=H(B,i);O&&(k.copy(O.outerIntersection),D.copy(O.innerIntersection))}if(r&&wO(o.leftPoint,r.rightPoint)){const O=H(B,r);O&&(W.copy(O.outerIntersection),L.copy(O.innerIntersection))}}return j},[A,y,u,o,r,i]),T=m.useMemo(()=>{const W=new kl,k=new le(-A,y*2),D=new le(A,y*2);if(i||r){const L=gX(o,o.ly);if(i&&wO(o.rightPoint,i.leftPoint)){const j=F(L,i);j&&D.copy(j)}if(r&&wO(o.leftPoint,r.rightPoint)){const j=F(L,r);j&&k.copy(j)}}return W.moveTo(-A,0),W.lineTo(A,0),W.lineTo(D.x,D.y),W.lineTo(k.x,k.y),W.closePath(),W},[A,y,o,r,i]),w=m.useMemo(()=>{const W=new kl;if(u===0)return W;const[k,D,L,j]=v;return W.moveTo(k.x,k.y),W.lineTo(D.x,D.y),W.lineTo(L.x,L.y),W.lineTo(j.x,j.y),W.closePath(),W},[u,v]),x=m.useMemo(()=>v.map(W=>W.toArray()),[v]),b=m.useMemo(()=>[new le(-A,0,0),new le(A,0,0)],[A]),R=m.useMemo(()=>[new le,new le(0,0,C)],[C]);function H(W,k){const D=GSe(k),L=nae(W.outerPoints.leftPoint,W.outerPoints.rightPoint,D.outerPoints.leftPoint,D.outerPoints.rightPoint);if(!L)return null;const j=nae(W.innerPoints.leftPoint,W.innerPoints.rightPoint,D.innerPoints.leftPoint,D.innerPoints.rightPoint);return j?{innerIntersection:new le().subVectors(j,new le(p,g)).applyEuler(new ln(0,0,-S)),outerIntersection:new le().subVectors(L,new le(p,g)).applyEuler(new ln(0,0,-S))}:null}function F(W,k){const D=gX(k,k.ly),L=nae(W.leftPoint,W.rightPoint,D.leftPoint,D.rightPoint);return L?new le().subVectors(L,new le(p,g)).applyEuler(new ln(0,0,-S)):null}function E(){return!(M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().isAddingElement())}function N(W){W.button!==2&&W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&E()&&M.getState().selectMe(f,W,Xo.Select,!0)}function U(W){M.getState().selectMe(f,W,Xo.ContextMenu,!0),M.getState().set(k=>{W.intersections.length>0&&W.intersections[0].eventObject===W.eventObject&&(k.contextMenuObjectType=z.Wall)})}return a?h.jsxs("group",{name:"Wall Parapet Group",position:[0,0,n],onContextMenu:U,onPointerDown:N,children:[h.jsx(aw,{name:"Body Extrude Mesh",args:[T,{steps:1,depth:C,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l,map:P})}),h.jsx(Gn,{position:[A,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[-A,0,0],points:R,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[0,0,C],points:b,color:"black",lineWidth:.2}),h.jsx(aw,{name:"Copings Extrude Mesh",position:[0,0,C],args:[w,{steps:1,depth:d,bevelEnabled:!1}],children:h.jsx("meshStandardMaterial",{color:l})}),h.jsx(Gn,{position:[0,0,C+d],points:x,color:"black",lineWidth:.2}),h.jsx(Gn,{position:[0,0,C],points:x,color:"black",lineWidth:.2})]}):null};function GSe(t){const e=(t.ly+t.copingsWidth)/2,n=(t.ly-t.copingsWidth)/2;return{innerPoints:gX(t,e),outerPoints:gX(t,n)}}function gX(t,e){const{leftPoint:n,rightPoint:o}=t,r=new le().fromArray(n),i=new le().fromArray(o),l=new le().subVectors(i,r).applyEuler(new ln(0,0,Qt)).normalize().clone().multiplyScalar(e);return{leftPoint:r.clone().add(l),rightPoint:i.clone().add(l)}}function wO(t,e){return Math.abs(t[0]-e[0]){const{id:n,lx:o,lz:r}=t,i=M(s3),a=M(e5),l=M(a3),s=M(l3),c=Cn(Ib),u=dt(p3),d=m.useRef(0),f=m.useRef(),p=m.useMemo(()=>{if(!u||e)return;const g=c.get(n);if(!g)return;const A=g.reduce((j,B)=>j+B,0),y=t.fill===Fl.Partial&&!me.isPartialWallFull(t),S=me.getWallVertices(t,0),C=y?me.getPartialWallVertices(t,0):S,P=me.getPolygonArea(S);let v=y?me.getPolygonArea(C):P;if(v===0)return;const T=i(z.Window,n),w=i(z.Door,n);if(T&&T.length>0)for(const j of T)v-=me.getWindowArea(j,t);if(w&&w.length>0)for(const j of w)v-=j.lx*j.lz*t.lx*t.lz;const x=M.getState().world,b=i3*(x.solarRadiationHeatmapGridCellSize??.5),R=me.getHighestPointOfWall(t),H=Math.max(2,Math.round(o/b)),F=Math.max(2,Math.round(R/b)),E=o/H,N=R/F,U=(R-t.lz)/2,W=A/v*(a??Qm);d.current=W<0?1:0,f.current=me.getEuler(ko,Yc,"YXZ",Math.sign(W)*Qt);const k=[],D=y?me.getPartialWallVertices(t,0):me.getWallVertices(t,0);let L;for(let j=0;j0)for(const q of T){if(q.type!==z.Window)continue;const $=q.cx*t.lx,ie=q.cz*t.lz,Q=q.lx*t.lx/2,se=q.lz*t.lz/2;if(q.windowType===Ci.Arched){if(V>=$-Q&&V<$+Q&&G>=ie-se&&G=$-Q&&V<$+Q&&G>=ie-se&&G0)for(const q of w){const $=q.cx*o,ie=q.cz*R,Q=q.lx*o/2,se=q.lz*R/2;if(V>=$-Q&&V<$+Q&&G>=ie-se&&Gh.jsxs(be.Fragment,{children:[h.jsx(Gn,{points:g,name:"Heat Flux "+A,lineWidth:s??Zm,color:l??p0}),h.jsx(xf,{userData:{unintersectable:!0},position:g[d.current].clone().add(new le(0,d.current===0?-.1:.1,0)),args:[.06,.2,4,1],name:"Normal Vector Arrow Head",rotation:f.current??[0,0,0],children:h.jsx("meshBasicMaterial",{attach:"material",color:l??p0})})]},A))}):null},jen=be.memo(Uen),oae="Wall Block Plane",Ben="Wall Intersection Plane",hP=.1,Yen=be.memo(({transparent:t,color:e,opacity:n})=>{const r=M(Lw).z<=0;return h.jsx("meshStandardMaterial",{color:t?e:"white",transparent:t,opacity:n,side:r?r0:ti})}),Oen=({wallModel:t,foundationModel:e})=>{var mu,fn,tn,Ot,mn,Hn;let{id:n,cx:o,cy:r,lx:i=1,ly:a=.5,lz:l=5,relativeAngle:s,leftJoints:c,rightJoints:u,textureType:d,color:f="white",lineColor:p="black",lineWidth:g=.2,parentId:A,locked:y=!1,roofId:S,leftRoofHeight:C,rightRoofHeight:P,centerRoofHeight:v,centerLeftRoofHeight:T,centerRightRoofHeight:w,wallStructure:x=gc.Default,structureSpacing:b=2,structureWidth:R=.1,structureColor:H="white",opacity:F=.5,fill:E=Fl.Full,leftUnfilledHeight:N=.5,rightUnfilledHeight:U=.5,leftTopPartialHeight:W=l,rightTopPartialHeight:k=l,parapet:D=Zye,leftPoint:L,rightPoint:j}=t;C=c.length>0?C:l,P=u.length>0?P:l;const B=f$e(d),O=Tc(n),V=M(pn),G=M(Db),q=M(pu),$=M(En),ie=M(qge),Q=Cn(c1),se=M(kw),oe=M(Cs),Z=M($ge),te=M(TOe),ee=M(Pf),de=dt(Rf),fe=dt(hs),pe=dt(qe=>qe.elementBeingCanceledId),ye=dt(qe=>qe.showWallIntersectionPlaneId),[ae,Te]=m.useState(!1),[ge,Se]=m.useState(null),{camera:Re,gl:De}=ri(),{elementsOnWall:Ae,leftWall:ue,rightWall:he}=KQt(n,c[0],u[0]),ve=h$e(e),we=m.useRef(null),Pe=m.useRef(null),Ie=m.useRef(null),Me=m.useRef(null),ze=m.useRef(null),Ne=m.useRef(null),Je=m.useRef(null),Ue=m.useRef(null),nt=i/2,We=a/2,Ee=l/2,ke=ve?ve.rotation[2]+s:s,Oe=me.getInnerWallOffset(ue,i,a,s,"left"),st=me.getInnerWallOffset(he,i,a,s,"right"),je=x===gc.Stud||x===gc.Pillar,xt=C??l,gt=P??l,Ye=E===Fl.Partial,it=Ye?N:0,ut=Ye?U:0,Qe=Ye?Math.min(xt,W):xt,lt=Ye?Math.min(gt,k):gt,Ze=Ye&&(!me.isZero(xt-Qe)||!me.isZero(gt-lt)),Be=oe&&!je,$e=D.display,wt=Math.max(Qe,lt)-Ee,vt=m.useMemo(()=>new Kt,[]),Rt=m.useMemo(()=>new l0,[]),Gt=m.useMemo(()=>new pf({color:"white",side:ti,transparent:je,opacity:F}),[je,F]),At=m.useMemo(()=>me.getHighestPointOfWall(t),[t.lz,t.leftRoofHeight,t.rightRoofHeight,t.centerRoofHeight,t.centerLeftRoofHeight,t.centerRightRoofHeight]),pt=m.useMemo(()=>{const qe=new kl;return Ge(qe,i,l,0,0,0,0),Ae.forEach(Ct=>{if(Ct.type===z.Window&&Ct.id!==Je.current&&Ct.lx>0&&Ct.lz>0){const Nt=Ct,Tt=new kl,[Yt,Zt,cn,yn]=[Ct.lx*i,Ct.lz*l,Ct.cx*i,Ct.cz*l];if(Nt.windowType)switch(Nt.windowType){case Ci.Arched:un(Tt,Yt,Zt,cn,yn,Nt.archHeight);break;case Ci.Polygonal:{const[An,Tn]=Nt.polygonTop??Gp;Rn(Tt,Yt,Zt,cn,yn,An*Yt,Tn);break}case Ci.Default:default:qt(Tt,Yt,Zt,cn,yn)}else qt(Tt,Yt,Zt,cn,yn);qe.holes.push(Tt)}}),qe},[i,l,E,N,U,Qe,lt,Ae,C,P,v,T,w]),Wt=m.useMemo(()=>{const qe=new kl,Ct=l,Nt=l/2;if(Ye)qe.moveTo(-nt+Oe,-Nt+N),qe.lineTo(nt-st,-Nt+U);else{qe.moveTo(-nt+Oe,-Nt);const Tt=Ae.filter(Yt=>Yt.type===z.Door).sort((Yt,Zt)=>Yt.cx-Zt.cx);for(const Yt of Tt)if(Yt.id!==Je.current){const[Zt,cn,yn,An]=[Yt.cx*i,Yt.cz*Ct,Yt.lx*i,Yt.lz*Ct];if(Yt.doorType===Rd.Default)qe.lineTo(Zt-yn/2,-Nt),qe.lineTo(Zt-yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt);else{const Tn=Math.min(Yt.archHeight,An,yn/2);if(qe.lineTo(Zt-yn/2,-Nt),Tn>.1){qe.lineTo(Zt-yn/2,-Nt+An/2-Tn);const Ln=Tn/2+yn**2/(8*Tn),[Yn,Wn]=[Zt,cn+An/2-Ln],oo=Math.acos(Math.min(yn/2/Ln,1)),qn=Math.PI-oo;qe.absarc(Yn,Wn,Ln,qn,oo,!0)}else qe.lineTo(Zt-yn/2,-Nt+An),qe.lineTo(Zt+yn/2,-Nt+An);qe.lineTo(Zt+yn/2,-Nt)}}qe.lineTo(nt-st,-Nt)}if(Ze){const Tt=lt-Qe,Yt=(i-st)*Tt/i,Zt=Oe*Tt/i;qe.lineTo(nt-st,-Nt+Qe+Yt),qe.lineTo(-nt+Oe,-Nt+Qe+Zt)}else S?(P?qe.lineTo(nt-st,P-Nt):qe.lineTo(nt-st,Nt),w&&qe.lineTo(w[0]*i,w[1]-Nt),v&&qe.lineTo(v[0]*i,v[1]-Nt),T&&qe.lineTo(T[0]*i,T[1]-Nt),C?qe.lineTo(-nt+Oe,C-Nt):qe.lineTo(-nt+Oe,Nt)):(qe.lineTo(nt-st,Nt),qe.lineTo(-nt+Oe,Nt));return qe.closePath(),Ae.forEach(Tt=>{if(Tt.type===z.Window&&Tt.id!==Je.current&&Tt.lx>0&&Tt.lz>0){const Yt=Tt,Zt=new kl,[cn,yn,An,Tn]=[Tt.lx*i,Tt.lz*l,Tt.cx*i,Tt.cz*l];if(Yt.windowType)switch(Yt.windowType){case Ci.Arched:un(Zt,cn,yn,An,Tn,Yt.archHeight);break;case Ci.Polygonal:{const[Ln,Yn]=Yt.polygonTop??Gp;Rn(Zt,cn,yn,An,Tn,Ln*cn,Yn);break}case Ci.Default:default:qt(Zt,cn,yn,An,Tn);break}else qt(Zt,cn,yn,An,Tn);qe.holes.push(Zt)}}),qe},[i,l,E,N,U,Qe,lt,Oe,st,Ae,S,C,P,v,T,w]),ht=m.useMemo(()=>Ye?(Qe+lt)/2-Ee:Ee,[Ee,Ye,Qe,lt]),ct=m.useMemo(()=>{const qe=lt-Qe;return!Ye||Math.abs(qe)<.01?0:Math.atan2(qe,i)},[i,Ye,Qe,lt]),It=m.useMemo(()=>{const qe=new kl;if(!Ye||Math.abs(ct)<1e-4)return _t(qe,i,a,Oe,st),qe;{const Ct=i/2,Nt=a/2,Tt=Math.cos(ct),Yt=Ct/Tt,Zt=(Ct-Oe)/Tt,cn=(Ct-st)/Tt;return qe.moveTo(-Yt,-Nt),qe.lineTo(Yt,-Nt),qe.lineTo(cn,Nt),qe.lineTo(-Zt,Nt),qe.closePath(),qe}},[i,a,Oe,st,Ye,ct]),Ft=m.useMemo(()=>{const qe=[],Ct=i/2,Nt=l/2;return Ye?(qe.push({x:-Ct+Oe,y:-Nt+it}),qe.push({x:Ct-st,y:-Nt+ut})):(qe.push({x:-Ct,y:-Nt}),qe.push({x:Ct,y:-Nt})),Ze?(qe.push({x:Ct-st,y:-Nt+lt}),qe.push({x:-Ct+Oe,y:-Nt+Qe})):(P?qe.push({x:Ct,y:P-Nt}):qe.push({x:Ct,y:Nt}),w&&qe.push({x:w[0]*i,y:w[1]-Nt}),v&&qe.push({x:v[0]*i,y:v[1]-Nt}),T&&qe.push({x:T[0]*i,y:T[1]-Nt}),C?qe.push({x:-Ct,y:C-Nt}):qe.push({x:-Ct,y:Nt})),qe},[i,l,E,it,ut,Qe,lt,C,P,v,T,w]),Ve=m.useMemo(()=>{const qe=[];let Ct=0,Nt=0;if(E===Fl.Partial&&(Ct=(U-N)/i,Nt=N+nt*Ct),x===gc.Stud){let Tt=-nt+R/2;for(;Tt<=nt;)qe.push([Tt,Ct*Tt+Nt]),Tt+=b;Tt=nt-R/2,qe.push([Tt,Ct*Tt+Nt])}else if(x===gc.Pillar){let Tt=-nt;for(;Tt<=nt;)qe.push([Tt,Ct*Tt+Nt]),Tt+=b;qe.push([nt,Ct*nt+Nt])}return qe},[x,R,b,i,a,l,N,U]),ft=m.useMemo(()=>({id:n,parentId:A,cx:o,cy:r,hx:nt,hy:We,angle:s,selected:O}),[n,A,o,r,nt,We,s,O]),kt=m.useMemo(()=>({leftPoint:L,rightPoint:j,ly:a,copingsWidth:D.copingsWidth}),[L,j,a,D.copingsWidth]),rt=m.useMemo(()=>!ue||!ue.parapet||!ue.parapet.display?null:{leftPoint:ue.leftPoint,rightPoint:ue.rightPoint,ly:ue.ly,copingsWidth:ue.parapet.copingsWidth},[ue==null?void 0:ue.leftPoint,ue==null?void 0:ue.rightPoint,ue==null?void 0:ue.ly,(mu=ue==null?void 0:ue.parapet)==null?void 0:mu.copingsWidth,(fn=ue==null?void 0:ue.parapet)==null?void 0:fn.display]),at=m.useMemo(()=>!he||!he.parapet||!he.parapet.display?null:{leftPoint:he.leftPoint,rightPoint:he.rightPoint,ly:he.ly,copingsWidth:he.parapet.copingsWidth},[he==null?void 0:he.leftPoint,he==null?void 0:he.rightPoint,he==null?void 0:he.ly,(tn=he==null?void 0:he.parapet)==null?void 0:tn.copingsWidth,(Ot=he==null?void 0:he.parapet)==null?void 0:Ot.display]);m.useEffect(()=>{Ue.current&&Ue.current.id===pe&&(Ue.current=null,ir())},[pe]),m.useEffect(()=>{if(t&&fe){const qe=Q(t.id);if(qe){const Ct=me.fetchHeatmapTexture(qe,ee??5);if(Ct){Ct.wrapS=bs,Ct.wrapT=bs;const Nt=l===At?0:(1-l/At)/2;Ct.offset.set(-i/2,-At/2-Nt),Ct.center.set(i/2,At/2),Ct.repeat.set(1/i,1/At),Se(Ct)}}}},[fe,ee]),m.useEffect(()=>{S&&(Z.has(S)||te.has(S))&&M.getState().set(qe=>{const Ct=new Set;for(const Nt of qe.elements)if(Nt.id===n&&Nt.type===z.Wall){const Tt=Nt;if(Tt.roofId=null,Tt.leftRoofHeight=void 0,Tt.rightRoofHeight=void 0,Tt.centerRoofHeight=void 0,Tt.centerLeftRoofHeight=void 0,Tt.centerRightRoofHeight=void 0,Ae.length>0){const Yt=bn.getWallPoints2D(Tt);Ae.forEach(Zt=>{if(Zt.type===z.Polygon)return;const cn=Zt.type===z.Door,yn=Zt.type===z.SolarPanel,An=yn?Zt.lx-.01:Zt.lx*i,Tn=yn?Zt.ly-.01:Zt.lz*l,Ln=new le(Zt.cx*i,0,Zt.cz*l);me.isElementInsideWall(Ln,An,Tn,Yt,cn)||(Ct.add(Zt.id),qe.autoDeletedChild?qe.autoDeletedChild.push(Zt):qe.autoDeletedChild=[Zt])})}break}Ct.size>0?qe.elements=qe.elements.filter(Nt=>!Ct.has(Nt.id)):qe.autoDeletedChild===null&&(qe.autoDeletedChild=[])})},[S,Z,te]);function Ge(qe,Ct,Nt,Tt=0,Yt=0,Zt=0,cn=0,yn=!0){const An=Ct/2,Tn=Nt/2;if(Ye?qe.moveTo(Tt-An+Zt,Yt-Tn+N):qe.moveTo(Tt-An+Zt,Yt-Tn),yn){const Ln=Ae.filter(Yn=>Yn.type===z.Door).sort((Yn,Wn)=>Yn.cx-Wn.cx);for(const Yn of Ln)if(Yn.id!==Je.current){const[Wn,oo,qn,qo]=[Yn.cx*Ct,Yn.cz*Nt,Yn.lx*Ct,Yn.lz*l];if(Yn.doorType===Rd.Default)qe.lineTo(Tt+Wn-qn/2,Yt-Tn),qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn);else{const ii=Math.min(Yn.archHeight,qo,qn/2);if(qe.lineTo(Tt+Wn-qn/2,Yt-Tn),ii>.1){qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo/2-ii);const Qi=ii/2+qn**2/(8*ii),[Or,ya]=[Wn,Yt+oo+qo/2-Qi],Hs=Math.acos(Math.min(qn/2/Qi,1)),Qu=Math.PI-Hs;qe.absarc(Or,ya,Qi,Qu,Hs,!0)}else qe.lineTo(Tt+Wn-qn/2,Yt-Tn+qo),qe.lineTo(Tt+Wn+qn/2,Yt-Tn+qo);qe.lineTo(Tt+Wn+qn/2,Yt-Tn)}}}Ye?qe.lineTo(Tt+An-cn,Yt-Tn+U):qe.lineTo(Tt+An-cn,Yt-Tn),Ze?(qe.lineTo(Tt+An-cn,Yt-Tn+lt),qe.lineTo(Tt-An+Zt,Yt-Tn+Qe)):S?(P?qe.lineTo(Tt+An-cn,P-Tn):qe.lineTo(Tt+An-cn,Yt+Tn),w&&qe.lineTo(w[0]*Ct,w[1]-Tn),v&&qe.lineTo(v[0]*Ct,v[1]-Tn),T&&qe.lineTo(T[0]*Ct,T[1]-Tn),C?qe.lineTo(Tt-An+Zt,C-Tn):qe.lineTo(Tt-An+Zt,Yt+Tn)):(qe.lineTo(Tt+An-cn,Yt+Tn),qe.lineTo(Tt-An+Zt,Yt+Tn)),qe.closePath()}function yt(qe,Ct){const{cx:Nt,cy:Tt,cz:Yt}=Ct;if(ve&&ke!==void 0){const Zt=me.wallAbsolutePosition(new le(Nt,Tt,Yt),ve).setZ(l/2+ve.lz);return new le().subVectors(qe,Zt).applyEuler(new ln(0,0,-ke))}return new le}function Pt(qe){const Ct=[];for(let Nt=-1;Nt<=1;Nt+=2)for(let Tt=-1;Tt<=1;Tt+=2){const[Yt,Zt]=[Nt,Nt*Tt];switch(qe.type){case z.Window:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx*i/2,qe.lz*l/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn});break}case z.Door:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx*i/2,qe.lz*l/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn});break}case z.SolarPanel:{const[cn,yn]=[qe.cx*i,qe.cz*l],[An,Tn]=[qe.lx/2,qe.ly/2],Ln=cn+Yt*An,Yn=yn+Zt*Tn;Ct.push({x:Ln,y:Yn})}}}if(qe.type===z.Window&&qe.windowType===Ci.Polygonal){const Nt=qe,[Tt,Yt]=Nt.polygonTop??[0,0];Ct.push({x:qe.cx*i+Tt*qe.lx*i,y:qe.cz*l+qe.lz*l/2+Yt})}return Ct}function ot(qe,Ct=0){if(!Ye)return me.getWallVertices(qe,Ct);const Nt=qe.lx/2,Tt=qe.lz/2,Yt={x:-Nt-Ct,y:qe.leftUnfilledHeight-Tt-Ct},Zt={x:Nt+Ct,y:qe.rightUnfilledHeight-Tt-Ct},cn={x:-Nt-Ct,y:qe.leftTopPartialHeight-Tt+Ct},yn={x:Nt+Ct,y:qe.rightTopPartialHeight-Tt+Ct},An=[];return An.push(cn,Yt,Zt,yn),Ze||(qe.centerRightRoofHeight&&An.push({x:qe.centerRightRoofHeight[0]*qe.lx,y:qe.centerRightRoofHeight[1]-Tt+Ct}),qe.centerRoofHeight&&An.push({x:qe.centerRoofHeight[0]*qe.lx,y:qe.centerRoofHeight[1]-Tt+Ct}),qe.centerLeftRoofHeight&&An.push({x:qe.centerLeftRoofHeight[0]*qe.lx,y:qe.centerLeftRoofHeight[1]-Tt+Ct})),An}function bt(qe,Ct,Nt,Tt,Yt){if(Nt<.1||Tt<.1||Nt>i||!S&&Tt>l)return Je.current=qe,!1;const Zt=.1;Nt+=Zt,Tt+=Zt;for(const cn of Ae){if(cn.id===qe||cn.type===z.Polygon)continue;const yn=Pt(cn),An=[];for(let Tn=-1;Tn<=1;Tn+=2)for(let Ln=-1;Ln<=1;Ln+=2){const Yn=Ct.x+Tn*Nt/2,Wn=Ct.z+Tn*Ln*Tt/2;if(An.push({x:Yn,y:Wn}),me.isPointInside(Yn,Wn,yn))return Je.current=qe,!1}if(Yt){const[Tn,Ln]=Yt,Yn=Ct.x+Tn*Nt,Wn=Ct.z+Tt/2+Ln;if(An.push({x:Yn,y:Wn}),me.isPointInside(Yn,Wn,yn))return Je.current=qe,!1}for(const Tn of yn)if(me.isPointInside(Tn.x,Tn.y,An))return Je.current=qe,!1}return Je.current=null,!0}function zt(qe,Ct,Nt,Tt,Yt){return me.isElementInsideWall(Ct,Nt,Tt,Ft,Yt)?!0:(Je.current=qe,!1)}function Bt(qe,Ct,Nt,Tt){const[Yt,Zt]=Tt,cn=qe.x+Ct*Yt,yn=qe.z+Nt/2+Zt;return!!me.isPointInside(cn,yn,ot(t,0))}function tt(qe){vt.x=qe.offsetX/De.domElement.clientWidth*2-1,vt.y=-(qe.offsetY/De.domElement.clientHeight)*2+1,Rt.setFromCamera(vt,Re)}function Ht(qe){return!(qe.button===2||M.getState().addedWallId||Ne.current||M.getState().moveHandleType||M.getState().resizeHandleType||M.getState().objectTypeToAdd!==z.None||O||ie())}function _t(qe,Ct,Nt,Tt,Yt){const Zt=Ct/2,cn=Nt/2;qe.moveTo(-Zt,-cn),qe.lineTo(Zt,-cn),qe.lineTo(Zt-Yt,cn),qe.lineTo(-Zt+Tt,cn),qe.closePath()}function qt(qe,Ct,Nt,Tt=0,Yt=0){const Zt=Ct/2,cn=Nt/2;qe.moveTo(Tt-Zt,Yt-cn),qe.lineTo(Tt+Zt,Yt-cn),qe.lineTo(Tt+Zt,Yt+cn),qe.lineTo(Tt-Zt,Yt+cn),qe.closePath()}function un(qe,Ct,Nt,Tt,Yt,Zt=0){const cn=Ct/2,yn=Nt/2,An=Math.min(Zt,Nt,cn);if(qe.moveTo(Tt-cn,Yt-yn),qe.lineTo(Tt+cn,Yt-yn),qe.lineTo(Tt+cn,Yt+yn-An),An>0){const Tn=An/2+Ct**2/(8*An),[Ln,Yn]=[Tt,Yt+yn-Tn],Wn=Math.acos(Math.min(1,cn/Tn)),oo=Math.PI-Wn;qe.absarc(Ln,Yn,Tn,Wn,oo,!1)}else qe.lineTo(Tt-cn,Yt+yn);qe.closePath()}function Rn(qe,Ct,Nt,Tt,Yt,Zt,cn){const[yn,An]=[Ct/2,Nt/2];qe.moveTo(Tt-yn,Yt-An),qe.lineTo(Tt+yn,Yt-An),qe.lineTo(Tt+yn,Yt+An),qe.lineTo(Tt+Zt,Yt+An+cn),qe.lineTo(Tt-yn,Yt+An),qe.closePath()}function yo(qe){const Ct=parseFloat((Math.round(qe.x/P6)*P6).toFixed(1)),Nt=parseFloat((Math.round(qe.z/P6)*P6).toFixed(1));return new le(Ct,qe.y,Nt)}function Ao(qe){const Ct=parseFloat((Math.round(qe.x/m9)*m9).toFixed(1)),Nt=parseFloat((Math.round(qe.z/m9)*m9).toFixed(1));return new le(Ct,qe.y,Nt)}function wo(qe){return M.getState().enableFineGrid?qe=Ao(qe):qe=yo(qe),qe}function Io(qe,Ct,Nt,Tt,Yt){M.getState().set(Zt=>{for(const cn of Zt.elements)if(cn.id===qe){if([cn.cx,cn.cy,cn.cz]=Ct,[cn.lx,cn.ly,cn.lz]=Nt,Tt!==void 0&&(cn.type===z.Window||cn.type===z.Door)&&(cn.archHeight=Tt),Yt!==void 0&&cn.type===z.Window){const yn=cn;yn.windowType===Ci.Polygonal&&(yn.polygonTop=[...Yt])}break}})}function po(qe){return qe.type===z.Window&&qe.windowType===Ci.Polygonal&&qe.polygonTop}function On(qe){const Ct={name:"Add",timestamp:Date.now(),addedElement:qe,undo:()=>{M.getState().removeElementById(qe.id,!1)},redo:()=>{M.getState().set(Nt=>{Nt.elements.push(Ct.addedElement),Nt.selectedElement=Ct.addedElement,Nt.deletedRoofId=null})}};$(Ct)}function fo(){const qe=M.getState().selectedElement;if(!qe)return;const Ct=M.getState().getElementById(qe.id);if(Ct)switch(Ct.type){case z.Door:case z.Window:case z.SolarPanel:const Nt={name:`Resize ${Ct.type}`,timestamp:Date.now(),resizedElementId:Ct.id,resizedElementType:Ct.type,oldPosition:[qe.cx,qe.cy,qe.cz],oldDimension:[qe.lx,qe.ly,qe.lz],newPosition:[Ct.cx,Ct.cy,Ct.cz],newDimension:[Ct.lx,Ct.ly,Ct.lz],oldArchHeight:qe.type===z.Window||qe.type===z.Door?qe.archHeight:void 0,newArchHeight:Ct.type===z.Window||Ct.type===z.Door?Ct.archHeight:void 0,oldPolygonTop:po(qe)?[...qe.polygonTop]:void 0,newPolygonTop:po(Ct)?[...Ct.polygonTop]:void 0,undo(){Io(this.resizedElementId,this.oldPosition,this.oldDimension,this.oldArchHeight,this.oldPolygonTop)},redo(){Io(this.resizedElementId,this.newPosition,this.newDimension,this.newArchHeight,this.newPolygonTop)}};$(Nt);break;case z.Polygon:const Tt=qe,Yt=Ct,Zt={name:"Edit Polygon",timestamp:Date.now(),oldValue:[...Tt.vertices],newValue:[...Yt.vertices],changedElementId:Yt.id,changedElementType:Yt.type,undo(){se(this.changedElementId,this.oldValue)},redo(){se(this.changedElementId,this.newValue)}};$(Zt);break}}function ir(){M.getState().set(qe=>{qe.addedWindowId=null,qe.addedDoorId=null})}function Rr(qe){return qe===z.Window||qe===z.Door}function br(qe,Ct){const Nt=Eu.getIntersectionObjects(qe);return Nt.length>0&&Nt[0].object.name===`${Eu.WALL_OUTSIDE_SURFACE_MESH_NAME} ${Ct}`}function _r(qe){return qe.intersections.length>0&&qe.intersections[0].object===qe.eventObject}function jo(qe,Ct,Nt){if(M.getState().moveHandleType&&Ct&&wn(Ct)&&Ct.parentId!==qe){const Tt=Nt.intersections.filter(Zt=>Zt.eventObject.name.includes(Eu.WALL_OUTSIDE_SURFACE_MESH_NAME)||Zt.eventObject.name.includes(cde)||Zt.eventObject.name===oae);if(!(Tt.length>0&&(Tt[0].eventObject.name===oae||Tt[0].eventObject.name.includes(cde))))return!0}return!1}function wn(qe){if(!qe)return!1;switch(qe.type){case z.Window:case z.Door:case z.SolarPanel:case z.Light:case z.Sensor:return!0}return!1}function In(qe){if(M.getState().resizeHandleType!==Mt.Arch)return!1;if(qe.type===z.Window){const Ct=qe;return Ct.windowType===Ci.Arched&&Ct.archHeight!==void 0}if(qe.type===z.Door){const Ct=qe;return Ct.doorType===Rd.Arched&&Ct.archHeight!==void 0}}function ar(qe,Ct){const Nt=qe.getPoints().map(Tt=>({x:Tt.x,y:Tt.y}));return!me.isPointInside(Ct.x,Ct.y,Nt)}function Wo(qe,Ct,Nt,Tt,Yt,Zt=!1){const cn=new le().subVectors(Ct,qe).normalize(),[yn,An]=Zt?[Ct.y,qe.y]:[qe.y,Ct.y];let Tn;if(yn(Tn.type===z.Wall&&Tn.parentId===A&&An.set(Tn.id,Tn),An),new Map);let Tt=!1,Yt=0;const Zt={lng:M.getState().language},cn=t;let yn=cn;for(;yn&&yn.rightJoints.length>0;){Yt++;const An=Nt.get(yn.rightJoints[0]);if(!An)break;if(Ct&&An.lz!==cn.lz)return co(Y.t("message.WallsAreNotAtSameHeight",Zt)),!1;if(An.id===cn.id){Tt=!0;break}if(yn=An,Yt>100)break}return Tt?!0:(co(Y.t("message.WallsAreNotConnected",Zt)),!1)}function So(){return Ue.current&&Ue.current.status===0&&M.getState().moveHandleType===zo.Mid}function Qo(){return!(M.getState().moveHandleType||M.getState().resizeHandleType||ie())}function Yo(){return Ze||N!==U||W!==k?!1:S?!(C!==P||v!==void 0||T!==void 0||w!==void 0):!0}function lr(qe,Ct,Nt){var yn;tt(qe);const Yt=((yn=(Ct?Rt.intersectObjects([Ct]):qe.intersections)[0])==null?void 0:yn.point)??qe.point,Zt=yt(Yt,t),cn=Nt?wo(Zt.clone().add(Nt)).sub(Nt):wo(Zt);return{relativePointer:Zt,pointerOnGrid:cn}}function fr(qe,Ct){if(!we.current)return null;const{pointerOnGrid:Nt}=lr(qe,we.current),Tt=Nt.x/t.lx,Yt=Nt.z/t.lz;return Ct===z.Window?Va.makeWindow(t,Tt,0,Yt,z.Wall):Ct===z.Door?Va.makeDoor(t):null}function ei(qe){qe&&(Ue.current={id:qe.id,type:qe.type,status:0}),V(Ct=>{qe&&(Ct.elements.push(qe),Ct.selectedElement=qe,Ct.selectedElementIdSet.clear(),Ct.selectedElementIdSet.add(qe.id),qe.type===z.Window?Ct.addedWindowId=qe.id:qe.type===z.Door&&(Ct.addedDoorId=qe.id)),Ct.moveHandleType=zo.Mid,Ct.objectTypeToAdd=z.None})}function hr(qe){if(!qe)return;const{id:Ct,type:Nt}=qe;V(Tt=>{Tt.elements=Tt.elements.filter(Yt=>Yt.id!==Ct),Tt.selectedElement=null,Tt.moveHandleType=null,Tt.objectTypeToAdd=Nt,Tt.addedWindowId=null,Tt.addedDoorId=null}),Ue.current=null}function tr(qe){if(!qe)return[0,0];switch(qe.type){case z.Window:{const Ct=dt.getState().oldParentId;if(qe.parentId!==Ct){const Nt=M.getState().elements.find(Tt=>Tt.id===Ct);return Nt?[qe.lx*Nt.lx/2,qe.lz*Nt.lz/2]:[0,0]}else return[qe.lx*i/2,qe.lz*l/2]}case z.Door:return[qe.lx*i/2,qe.lz*l/2];case z.SolarPanel:return[qe.lx/2,qe.ly/2]}return[hP,hP]}function bi(){const qe=[];if(v){const Ct=v[0];if(Ct===.5&&C!==void 0)return qe.push(new le(nt,v[1]-Ee),new le(-nt,C-Ee)),qe;if(Ct===-.5&&P!==void 0)return qe.push(new le(nt,P-Ee),new le(-nt,v[1]-Ee)),qe}return P!==void 0?qe.push(new le(nt,P-Ee)):qe.push(new le(nt,Ee)),w!==void 0&&qe.push(new le(w[0]*i,w[1]-Ee)),v!==void 0&&qe.push(new le(v[0]*i,v[1]-Ee)),T!==void 0&&qe.push(new le(T[0]*i,T[1]-Ee)),C!==void 0?qe.push(new le(-nt,C-Ee)):qe.push(new le(-nt,Ee)),qe}function Fo(qe,Ct){const Nt=Ct==null?void 0:Ct.ignorePadding,Tt=Ct!=null&&Ct.elementHalfSize?[...Ct.elementHalfSize]:[0,0],Yt=Nt?0:hP,Zt=Nt?0:hP+Oe,cn=Nt?0:hP+st,[yn,An]=Tt,[Tn,Ln,Yn,Wn]=[-nt+yn+Zt,nt-yn-cn,-Ee+An+Yt,Ee-An-Yt],oo=qe.clone();if(Yo()){const qn=Ye?N:0,qo=l-(Ye?Qe:l);return oo.setX(me.clamp(qe.x,Tn,Ln)),oo.setZ(me.clamp(qe.z,Yn+qn,Wn-qo)),oo}else{const qn=hl(yn,An,Tn,Ln,Yt),qo=new Kt(qe.x,qe.z);let ii=1/0,Qi=-1/0;if(Ct!=null&&Ct.resizeAnchor){const Hs=Ct.resizeAnchor.x,Qu=[];if(Ze)Qu.push(new le(-nt,-Ee+Qe),new le(nt,-Ee+lt));else{const Df=bi().reverse();Qu.push(...Df)}for(let Df=1;Df=Kl.x&&Hs<=O0.x){const Mh=(O0.y-Kl.y)/(O0.x-Kl.x),bp=-Mh*Kl.x+Kl.y;ii=Mh*Hs+bp;break}}const Zu=new le(-nt,-Ee+it),Hh=new le(nt,-Ee+ut),zf=(Hh.y-Zu.y)/(Hh.x-Zu.x),ed=-zf*Zu.x+Zu.y;Qi=zf*Hs+ed}const Or=qo.y>ii;if(ar(qn,qo)){const Hs=to(qn,qo);oo.setX(Hs.x),oo.setZ(me.clamp(Hs.y,Qi+Yt,ii-Yt))}else Or&&oo.setZ(ii-Yt)}return oo.setZ(Math.max(Yn,oo.z)),oo}function Si(qe,Ct){V(Nt=>{const Tt=Nt.elements.find(Yt=>Yt.id===qe);if(Tt)switch(Tt.type){case z.Window:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l,Tt.cy=Tt.id===Je.current?-.01:.3,Tt.tint=Tt.id===Je.current?"red":Nt.selectedElement.tint;break}case z.Door:{const Yt=l/2;Tt.cx=Ct.x/i,Tt.cz=(Ct.z-Yt)/2/l,Tt.lz=(Ct.z+Yt)/l;break}case z.SolarPanel:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l,Tt.color=Tt.id===Je.current?"red":"#fff";break}case z.Sensor:case z.Light:{Tt.cx=Ct.x/i,Tt.cz=Ct.z/l;break}case z.Polygon:{const Yt=Tt;if(Yt.vertices.length>0){const Zt=me.calculatePolygonCentroid(Yt.vertices),cn=-Ct.x/i-Zt.x,yn=-Ct.z/l-Zt.y,An=Yt.vertices.map(Tn=>({x:Tn.x+cn,y:Tn.y+yn}));Tt.vertices=An}break}}})}function hl(qe,Ct,Nt,Tt,Yt){const Zt=[],cn=new le(-nt,-Ee+it),yn=new le(nt,-Ee+ut);if(Wo(cn,yn,qe,Ct,Yt,!0),Zt.push({start:new le(Nt,Ee),end:new le(Nt,cn.y)}),Zt.push({start:cn.clone(),end:yn.clone()}),Zt.push({start:new le(Tt,yn.y),end:new le(Tt,Ee)}),Ze){const Tn=new le(nt,-Ee+lt),Ln=new le(-nt,-Ee+Qe);Wo(Tn,Ln,qe,Ct,Yt),Zt.push({start:Tn.clone(),end:Ln.clone()})}else{const Tn=bi();for(let Ln=1;Ln{const Yt=Tt.elements.find(An=>An.id===(Nt==null?void 0:Nt.id));if(!Yt||Yt.type===z.SolarPanel&&Yt.parentType===void 0)return;if(Yt.type===z.Window){const An=Tt.elements.find(Tn=>Tn.id===Yt.parentId);if(An){const Tn=Yt.lx*An.lx,Ln=Yt.lz*An.lz;Yt.lx=Tn/i,Yt.lz=Ln/l}}const{pointerOnGrid:Zt}=lr(qe,we.current),cn=tr(Yt),yn=Fo(Zt,{elementHalfSize:cn,ignorePadding:Yt.type===z.SolarPanel});bt(Yt.id,yn,cn[0]*2,cn[1]*2),Yt.cx=yn.x/i,Yt.cz=yn.z/l,Yt.parentId=n,Yt.foundationId=A,Tt.selectedElement&&(Tt.selectedElement.parentId=n,Tt.selectedElement.foundationId=A),Yt.type===z.Window?(Yt.cy=Yt.id===Je.current?-.01:0,Yt.tint=Yt.id===Je.current?"red":Tt.selectedElement.tint):Yt.type===z.SolarPanel&&(Yt.color=Yt.id===Je.current?"red":"#fff",Yt.parentType=z.Wall)}),de("showWallIntersectionPlaneId",n))}else So()&&hr(Ue.current)}function Ai(qe){if(qe.button!==2){if(So()){kn.getState().setEnableOrbitController(!1),Te(!0);const{pointerOnGrid:Ct}=lr(qe,we.current),Nt=Fo(Ct);V(Tt=>{var Yt,Zt;Tt.moveHandleType=null,((Yt=Ue.current)==null?void 0:Yt.type)===z.Window?(Tt.resizeHandleType=Mt.LowerRight,Tt.resizeAnchor.copy(Nt)):((Zt=Ue.current)==null?void 0:Zt.type)===z.Door&&(Tt.resizeHandleType=Mt.UpperRight,Tt.resizeAnchor.copy(Nt).setZ(-l/2))}),Ue.current.status=1}else if(_r(qe))if(M.getState().objectTypeToAdd!==z.None){const Nt=qe.point;Zs(Nt,!0)}else M.getState().groupActionMode?(V(Nt=>{for(const Tt of Nt.elements)Tt.selected=Tt.id===A;Nt.multiSelectionsMode||Nt.selectedElementIdSet.clear(),Nt.selectedElementIdSet.has(A)?Nt.selectedElementIdSet.delete(A):Nt.selectedElementIdSet.add(A)}),qe.stopPropagation()):Qo()&&M.getState().selectMe(n,qe,Xo.Select)}}function Fa(){Ue.current&&Ue.current.status===0&&(V(qe=>{qe.elements.pop(),qe.addedDoorId=null,qe.addedWindowId=null,qe.moveHandleType=null,qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null)}function wi(){So()&&hr(Ue.current),Je.current=null}function Fs(qe){const Ct=M.getState().selectedElement??G();if((Ct==null?void 0:Ct.parentId)===t.id){if(M.getState().moveHandleType){const Nt=Ct.type!==z.Polygon?new le(-Ct.lx/2*i,0,Ct.lz/2*l):void 0,{relativePointer:Tt,pointerOnGrid:Yt}=lr(qe,Me.current,Nt),Zt=tr(Ct),cn=Fo(Yt,{elementHalfSize:Zt,ignorePadding:Ct.type===z.SolarPanel}),[yn,An]=[Zt[0]*2,Zt[1]*2];if(Ct.type!==z.SolarPanel&&zt(Ct.id,cn,yn,An),Ct.type!==z.Polygon){let Tn=!0,Ln;Ct.type===z.Window&&Ct.windowType===Ci.Polygonal&&(Ln=Ct.polygonTop??Gp,Tn=Bt(cn,yn,An,Ln));const Yn=bt(Ct.id,cn,yn,An,Ln);Tn&&Yn?Je.current=null:Je.current=Ct.id}Si(Ct.id,cn)}else if(M.getState().resizeHandleType){const{relativePointer:Nt,pointerOnGrid:Tt}=lr(qe,Me.current),Yt=M.getState().resizeHandleType,Zt=M.getState().resizeAnchor;switch(Ct.type){case z.Window:{const cn=Ct,yn=Fo(Tt,{resizeAnchor:Zt});if(In(cn)){const{newLz:An,newCz:Tn,newArchHeight:Ln}=nr(cn,yn,Zt),Yn=new le(cn.cx*i,0,Tn);bt(cn.id,Yn,cn.lx*i,An),zt(cn.id,Yn,cn.lx*i,An),V(Wn=>{const oo=Wn.elements.find(qn=>qn.id===cn.id);oo&&(oo.lz=An/l,oo.cz=Tn/l,oo.archHeight=Ln,oo.cy=oo.id===Je.current?-.01:.3,oo.tint=oo.id===Je.current?"red":cn.tint)})}else if(Yt===Mt.Upper){const An=new le(cn.cx*i,0,cn.cz*l),[Tn,Ln]=[cn.lx*i,cn.lz*l],Yn=me.clamp((Tt.x-Zt.x)/Tn,-.5,.5),Wn=Math.max(0,Tt.z-Zt.z),oo=[Yn,Wn];(!bt(cn.id,An,Tn,Ln,oo)||!Bt(An,Tn,Ln,oo))&&(Je.current=cn.id),V(qn=>{const qo=qn.elements.find(ii=>ii.id===cn.id);qo&&(qo.polygonTop=[...oo],qo.cy=qo.id===Je.current?-.01:.3,qo.tint=qo.id===Je.current?"red":cn.tint)})}else{const{dimensionXZ:An,positionXZ:Tn}=Bn(qe,yn,Zt),Ln=new le(Tn.x,0,Tn.z);let Yn=!0,Wn;cn.windowType===Ci.Polygonal&&(Wn=cn.polygonTop??Gp,Yn=Bt(Ln,An.x,An.z,Wn)),(!bt(cn.id,Ln,An.x,An.z,Wn)||!Yn||!zt(cn.id,Ln,An.x,An.z))&&(Je.current=cn.id),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.lx=An.x/i,qn.lz=An.z/l,qn.cx=Tn.x/i,qn.cz=Tn.z/l,qn.cy=qn.id===Je.current?-.01:.3,qn.tint=qn.id===Je.current?"red":cn.tint)})}break}case z.Door:{const cn=Ct,yn=Fo(Tt,{resizeAnchor:Zt});if(In(cn)){const{newLz:An,newCz:Tn,newArchHeight:Ln}=nr(cn,yn,Zt),Yn=new le(cn.cx*i,0,Tn);bt(cn.id,Yn,cn.lx*i,An),zt(cn.id,Yn,cn.lx*i,An,!0),V(Wn=>{const oo=Wn.elements.find(qn=>qn.id===cn.id);oo&&(oo.lz=An/l,oo.cz=Tn/l,oo.archHeight=Ln,oo.color=oo.id===Je.current?jce:Ct.color)})}else{const{dimensionXZ:An,positionXZ:Tn}=Bn(qe,yn,Zt),Ln=new le(Tn.x,0,Tn.z);bt(cn.id,Ln,An.x,An.z),zt(cn.id,Ln,An.x,An.z,!0),V(Yn=>{const Wn=Yn.elements.find(oo=>oo.id===cn.id);Wn&&(Wn.cx=Tn.x/i,Wn.lx=An.x/i,Wn.cz=(yn.z-l/2)/2/l,Wn.lz=(yn.z+l/2)/l,Wn.color=Wn.id===Je.current?jce:Ct.color)})}break}case z.SolarPanel:{const cn=Ct,[yn,An]=Pi.getSolarPanelUnitLength(cn);if(Yt===Mt.Lower||Yt===Mt.Upper){const Ln=Math.max(1,Math.round(Math.abs(Nt.z-Zt.z)/An))*An,Yn=new le(0,0,Nt.z-Zt.z).normalize().multiplyScalar(Ln),Wn=new le().addVectors(Zt,Yn.clone().divideScalar(2));if(!me.isElementInsideWall(Wn,cn.lx-.01,Ln-.01,Ft))return;bt(cn.id,Wn,cn.lx,Math.abs(Yn.z)),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.cz=Wn.z/l,qn.ly=Math.abs(Yn.z),qn.color=qn.id===Je.current?"red":"#fff")})}else if(Yt===Mt.Left||Yt===Mt.Right){const Ln=Math.max(1,Math.round(Math.abs(Nt.x-Zt.x)/yn))*yn,Yn=new le(Nt.x-Zt.x,0,0).normalize().multiplyScalar(Ln),Wn=new le().addVectors(Zt,Yn.clone().divideScalar(2));if(!me.isElementInsideWall(Wn,Ln-.01,cn.ly-.01,Ft))return;bt(cn.id,Wn,Math.abs(Yn.x),cn.ly),V(oo=>{const qn=oo.elements.find(qo=>qo.id===cn.id);qn&&(qn.cx=Wn.x/i,qn.lx=Math.abs(Yn.x),qn.color=qn.id===Je.current?"red":"#fff")})}break}case z.Polygon:{V(cn=>{const yn=cn.elements.find(An=>An.id===Ct.id);(yn==null?void 0:yn.selectedIndex)>=0&&(yn.vertices[yn.selectedIndex].x=-Tt.x/i,yn.vertices[yn.selectedIndex].y=-Tt.z/l)});break}}}}}function ks(){if(Je.current)Ue.current&&Ue.current.status===1?(V(qe=>{qe.elements.pop(),qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null):(M.getState().moveHandleType||M.getState().resizeHandleType)&&Eu.undoInvalidOperation();else if(Ue.current){if(Ue.current.status===0)V(qe=>{qe.elements.pop(),qe.actionModeLock&&Ue.current&&(qe.objectTypeToAdd=Ue.current.type)}),Ue.current=null;else if(Ue.current.status===1){const qe=M.getState().elements,Ct=qe[qe.length-1];Ct.lx*i<.1||Ct.lz*l<.1?V(Nt=>{Nt.elements.pop(),Nt.actionModeLock&&Ue.current&&(Nt.objectTypeToAdd=Ue.current.type)}):(V(Nt=>{Nt.actionModeLock&&Ue.current&&(Nt.objectTypeToAdd=Ue.current.type,Px.selectNone(Nt))}),On(Ct)),Ue.current=null}}else M.getState().moveHandleType?Eu.addUndoableMove():M.getState().resizeHandleType&&fo();kn.getState().setEnableOrbitController(!0),Te(!1),V(qe=>{qe.moveHandleType=null,qe.resizeHandleType=null,qe.selectedElement=qe.elements.find(Ct=>{var Nt;return Ct.id===((Nt=qe.selectedElement)==null?void 0:Nt.id)})}),de("showWallIntersectionPlaneId",null),Je.current=null,ir()}function Zs(qe,Ct){if(ve&&M.getState().objectTypeToAdd){let Nt=null;switch(M.getState().objectTypeToAdd){case z.PyramidRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makePyramidRoof([t.id],ve));break}case z.GableRoof:{!S&&Ko(!1,!1)&&(Nt=Va.makeGableRoof([t.id],ve));break}case z.HipRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makeHipRoof([t.id],ve,i/2));break}case z.GambrelRoof:{!S&&Ko(!1,!1)&&(Nt=Va.makeGambrelRoof([t.id],ve));break}case z.MansardRoof:{!S&&Ko(!1,!0)&&(Nt=Va.makeMansardRoof([t.id],ve));break}case z.SolarPanel:{if(qe&&Ct){const Tt=yt(qe,t),Yt=M.getState().actionState;let Zt=M.getState().getPvModule(M.getState().actionState.solarPanelModelName??R9);Zt||(Zt=M.getState().getPvModule(R9)),Nt=Va.makeSolarPanel(t,Zt,Tt.x/i,0,Tt.z/l,Yt.solarPanelOrientation??vr.landscape,Yt.solarPanelPoleHeight??1,Yt.solarPanelPoleSpacing??3,0,0,new le(0,-1,0),[Qt,0,0],Yt.solarPanelFrameColor)}break}case z.Sensor:{if(qe&&Ct){const Tt=yt(qe,t),Yt=t.relativeAngle-Qt;Nt=Va.makeSensor(t,(Tt.x-.05)/i,0,(Tt.z-.05)/l,new le(Math.cos(Yt),Math.sin(Yt),0),[0,0,0])}break}case z.Light:{if(qe&&Ct){const Tt=yt(qe,t),Yt=t.relativeAngle-Qt,Zt=M.getState().actionState;Nt=Va.makeLight(t,2,Zt.lightDistance,Zt.lightIntensity,Zt.lightColor,(Tt.x-.05)/i,0,(Tt.z-.05)/l,new le(Math.cos(Yt),Math.sin(Yt),0),[0,0,0])}break}case z.BatteryStorage:{if(qe&&Ct){const Tt=yt(qe,t);M.getState().actionState,Nt=Va.makeBatteryStorage(t,Tt.x/i,0,Tt.z/l)}break}}Nt&&(On(Nt),V(Tt=>{Tt.elements.push(Nt),Tt.selectedElementIdSet.clear(),Tt.selectedElementIdSet.add(Nt.id),Tt.selectedElement=Nt,Nt&&Nt.type===z.Roof&&Tt.addedRoofIdSet.add(Nt.id),Tt.actionModeLock||(Tt.objectTypeToAdd=z.None)}))}}function Yi(qe,Ct,Nt){ze.current||(q(n,qe,Xo.ContextMenu),V(Tt=>{qe.intersections.length>0&&qe.intersections[0].object===Ct&&(Tt.contextMenuObjectType=z.Wall,Nt&&Tt.pastePoint.copy(qe.intersections[0].point))}),qe.stopPropagation())}function ua(qe){if(qe.button===2)return;const Ct=M.getState().objectTypeToAdd;!So()&&!ie()&&_r(qe)&&Ct===z.None?M.getState().groupActionMode?(V(Nt=>{for(const Tt of Nt.elements)Tt.id===A?Tt.selected=!0:Tt.selected=!1}),qe.stopPropagation()):Qo()&&M.getState().selectMe(n,qe,Xo.Select):bn.isTypeRoof(Ct)&&Ai(qe)}function Vl(qe){qe.button===2||qe.intersections.length===0||qe.intersections[0].object!==qe.eventObject||(M.getState().groupActionMode?V(Ct=>{for(const Nt of Ct.elements)Nt.selected=Nt.id===A;Ct.selectedElementIdSet.clear(),Ct.selectedElementIdSet.add(A)}):(Ht(qe)&&(V(Ct=>{Ct.contextMenuObjectType=null}),q(n,qe,Xo.Select)),Zs(),qe.stopPropagation()))}function Jl(qe){qe.intersections.length>0&&qe.intersections[0].object===qe.eventObject&&(q(n,qe,Xo.ContextMenu),V(Ct=>{Ct.contextMenuObjectType=z.Wall}),qe.stopPropagation())}function $u(){let[qe,Ct]=v??[0,(Qe+lt)/2];qe=qe*i;const Nt=qe+nt,Tt=Math.hypot(Nt,Ct-Qe),Yt=-Math.atan2(Ct-Qe,Nt),Zt=nt-qe,cn=Math.hypot(Zt,lt-Ct),yn=-Math.atan2(lt-Ct,Zt);return h.jsxs("group",{name:`wall stud group ${n}`,children:[Ve.map(([An,Tn],Ln)=>{let Yn;return An{let Wn;return Tn0||x===gc.Default)&&h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{name:"Wall Simulation Mesh",uuid:n,userData:{simulation:!0},rotation:[Qt,0,0],castShadow:!1,receiveShadow:!1,visible:!1,children:[h.jsx("shapeGeometry",{args:[pt]}),h.jsx("meshBasicMaterial",{side:ti})]}),h.jsxs("mesh",{name:`${Eu.WALL_OUTSIDE_SURFACE_MESH_NAME} ${n}`,ref:we,rotation:[Qt,0,0],castShadow:Be,receiveShadow:oe,onContextMenu:qe=>{Yi(qe,we.current,!0)},onPointerMove:or,onPointerDown:Ai,onPointerUp:Fa,onPointerOut:wi,children:[h.jsx("shapeGeometry",{args:[pt]}),fe&&ge?h.jsx("meshBasicMaterial",{attach:"material",map:ge,color:"white",opacity:F,transparent:je}):h.jsx("meshStandardMaterial",{attach:"material",color:d===Bo.Default||d===Bo.NoTexture?f:"white",map:B,transparent:je,opacity:F})]}),h.jsxs("mesh",{rotation:[Qt,0,0],position:[0,.05,0],castShadow:Be,children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx("meshStandardMaterial",{color:"white",side:r0,transparent:je,opacity:F})]}),h.jsxs("mesh",{name:"Inside Wall",ref:Pe,position:[0,a,0],rotation:[Qt,0,0],castShadow:Be,receiveShadow:oe,onPointerDown:ua,onContextMenu:qe=>{Yi(qe,Pe.current)},children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx(Yen,{transparent:je,color:f,opacity:F})]}),h.jsxs("mesh",{rotation:[Qt,0,0],position:[0,a-.01,0],receiveShadow:!0,children:[h.jsx("shapeGeometry",{args:[Wt]}),h.jsx("meshStandardMaterial",{color:"white",side:Da,transparent:je,opacity:F})]}),(!S||Ze)&&!$e&&h.jsx("mesh",{name:"Top Wall",ref:Ie,material:Gt,position:[0,We,ht],rotation:[0,-ct,0],castShadow:Be,receiveShadow:oe,onPointerDown:ua,onContextMenu:qe=>{Yi(qe,Ie.current)},children:h.jsx("shapeGeometry",{args:[It]})}),Oe===0&&h.jsx(ta,{args:[Qe-it,a],material:Gt,position:[-nt+.01,We,-Ee+it+(Qe-it)/2],rotation:[0,Qt,0],castShadow:Be,receiveShadow:oe,onPointerDown:ua}),st===0&&h.jsx(ta,{args:[lt-ut,a],material:Gt,position:[nt-.01,We,-Ee+ut+(lt-ut)/2],rotation:[0,Qt,0],castShadow:Be,receiveShadow:oe,onPointerDown:ua}),(ae||ye===n)&&((mn=M.getState().selectedElement)==null?void 0:mn.parentId)===n&&h.jsxs(h.Fragment,{children:[h.jsx(ta,{ref:Me,name:Ben,args:[1e4,1e4],position:[0,a/3,0],rotation:[Qt,0,0],onPointerMove:Fs,onPointerUp:ks,visible:!1,children:h.jsx("meshBasicMaterial",{color:"blue",side:ti})}),h.jsx(ta,{name:oae,args:[i,l],rotation:[Qt,0,0],position:[0,a,0],onPointerMove:()=>{},visible:!1})]}),Ae.map(qe=>{switch(qe.type){case z.Window:return h.jsx(B$e,{...qe,cx:qe.cx*i,cy:qe.cy*a,cz:qe.cz*l,lx:qe.lx*i,ly:a,lz:qe.lz*l},qe.id);case z.Door:return E!==Fl.Full?null:h.jsx(Een,{...qe,cx:qe.cx*i,cy:0,cz:qe.cz*l,lx:qe.lx*i,ly:a,lz:qe.lz*l},qe.id);default:return null}})]}),Ae.map(qe=>qe.type===z.Polygon&&E!==Fl.Empty?h.jsx(iQe,{...qe},qe.id):null),x===gc.Stud&&$u(),x===gc.Pillar&&Cc(),$e&&h.jsx(Nen,{args:D,wallData:ft,parapetZ:wt,currWallPointData:kt,leftWallPointData:rt,rightWallPointData:at}),(x===gc.Default||y&&O)&&h.jsx(Sen,{lineColor:O&&y?B0:p,lineWidth:O&&y?2:g,hx:nt,hz:Ee,fill:E,isTopPartial:Ze,leftUnfilledHeight:N,rightUnfilledHeight:U,showParapet:$e,leftHeight:Qe,rightHeight:lt,center:v,centerLeft:T,centerRight:w}),O&&h.jsx(Gye,{element:t,verticalLift:0}),(ae||ye===n)&&((Hn=M.getState().selectedElement)==null?void 0:Hn.parentId)===n&&h.jsx("group",{position:[0,-.001,0],rotation:[Qt,0,0],children:h.jsx(eme,{hx:nt,hy:Ee,hz:0})}),h.jsx(jen,{wallModel:t,notBuilding:ve.notBuilding})]})},Ven=(t,e)=>t.wallModel===e.wallModel,_en=be.memo(Oen,Ven);class bn{static getWireframetStyle(e,n,o,r){return[o&&r?B0:e,o&&r?1:n]}static getComposedWallNormal(e){return new le().subVectors(e.leftPoint,e.rightPoint).applyEuler(AG).normalize()}static getWallNormal(e){return new le().subVectors(new le(e.leftPoint[0],e.leftPoint[1]),new le(e.rightPoint[0],e.rightPoint[1])).applyEuler(AG).normalize()}static isTypeRoof(e){return e===z.Roof||e===z.PyramidRoof||e===z.HipRoof||e===z.GableRoof||e===z.GambrelRoof||e===z.MansardRoof}static getIntersectionPoint(e,n,o,r){if(Math.abs(e.x-n.x)<.001&&Math.abs(o.x-r.x)<.001)return n.clone();const i=(n.y-e.y)/(n.x-e.x),a=(r.y-o.y)/(r.x-o.x);if(Math.abs(i-a)<.001)return n.clone();const l=[e.x,n.x,o.x,r.x],s=[e.y,n.y,o.y,r.y],c=((l[2]-l[3])*(l[1]*s[0]-l[0]*s[1])-(l[0]-l[1])*(l[3]*s[2]-l[2]*s[3]))/((l[2]-l[3])*(s[0]-s[1])-(l[0]-l[1])*(s[2]-s[3])),u=((s[2]-s[3])*(s[1]*l[0]-s[0]*l[1])-(s[0]-s[1])*(s[3]*l[2]-s[2]*l[3]))/((s[2]-s[3])*(l[0]-l[1])-(s[0]-s[1])*(l[2]-l[3]));return!Number.isFinite(c)||!Number.isFinite(u)?n.clone():new le(c,u)}static getDistance(e,n,o){const r=n.y-e.y;if(r===0)return Math.abs(e.y-o.y);const i=e.x-n.x;if(i===0)return Math.abs(e.x-o.x);const a=n.x*e.y-e.x*n.y,l=Math.abs((r*o.x+i*o.y+a)/Math.sqrt(r*r+i*i));return l===0?1/0:l}static getWallPoints2D(e,n,o,r){const{lx:i,lz:a,rightRoofHeight:l,leftRoofHeight:s}=e,c=o??e.centerLeftRoofHeight,u=n??e.centerRoofHeight,d=r??e.centerRightRoofHeight,f=[],p=i/2,g=a/2;return f.push({x:-p,y:-g}),f.push({x:p,y:-g}),l?f.push({x:p,y:l-g}):f.push({x:p,y:g}),d&&f.push({x:d[0]*i,y:d[1]-g}),u&&f.push({x:u[0]*i,y:u[1]-g}),c&&f.push({x:c[0]*i,y:c[1]-g}),s?f.push({x:-p,y:s-g}):f.push({x:-p,y:g}),f}static isPointInside(e,n,o){let r=!1;for(let i=0,a=e.length-1;io!=u>o&&n<(c-l)*(o-s)/(u-s)+l&&(r=!r)}return r}static isRoofValid(e,n,o,r,i,a){for(const l of M.getState().elements)if(l.type===z.Wall&&l.roofId===e){const s=l;let c=[];if(s.id===n)c=bn.getWallPoints2D(s,r,i,a);else if(s.id===o){let u,d,f;r&&(u=[-r[0],r[1]]),a&&(d=[-a[0],a[1]]),i&&(f=[-i[0],i[1]]),c=bn.getWallPoints2D(s,u,d,f)}if(s.id===n||s.id===o){for(const u of M.getState().elements)if(u.parentId===s.id){let d=u.lx/2,f=u.lz/2,p=hP;u.type===z.SolarPanel&&(d=(d-.01)/s.lx,f=(u.ly/2-.01)/s.lz,p=0);const g=u.cx*s.lx-d*s.lx,A=u.cx*s.lx+d*s.lx,y=u.cz*s.lz+f*s.lz+p;if(!bn.isPointInside(c,g,y)||!bn.isPointInside(c,A,y))return!1}}}return!0}static getSegmentIdx(e,n){for(let o=0;oi.z){const u=[l,a,r];return me.isPointInside(o.x,o.y,u.map(me.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}else{const u=[l,a,i];return me.isPointInside(o.x,o.y,u.map(me.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else if(s<=c){const u=[l,a,i];return me.isPointInside(o.x,o.y,u.map(me.mapVector3ToPoint2))?[i,a,l]:[i,l,r]}else{const u=[l,a,r];return me.isPointInside(o.x,o.y,u.map(me.mapVector3ToPoint2))?[r,a,l]:[r,i,a]}}static getSegmentNormal(e){const[n,o,r]=e;return new le().crossVectors(new le().subVectors(n,o),new le().subVectors(n,r)).normalize()}static getRotationFromNormal(e){return me.isSame(e.normalize(),ko)?[0,0,0]:[Math.PI/2-Math.atan2(e.z,Math.hypot(e.x,e.y)),0,Math.atan2(e.y,e.x)+Math.PI/2]}static getRooftopElementZ(e,n,o){const[r,i,a]=e,l=(i.y-r.y)*(a.z-r.z)-(i.z-r.z)*(a.y-r.y),s=(i.z-r.z)*(a.x-r.x)-(i.x-r.x)*(a.z-r.z),c=(i.x-r.x)*(a.y-r.y)-(i.y-r.y)*(a.x-r.x);return-(-(l*r.x+s*r.y+c*r.z)+l*n.x+s*n.y)/c+o}static computeState(e,n,o){const r=bn.getSegmentIdx(e,n);if(o)return{segmentIdx:-1,segmentVertices:null,normal:new le(0,0,1),rotation:[0,0,0]};if(r!==-1){const i=bn.getSegmentVertices(e,r,n),a=bn.getSegmentNormal(i),l=bn.getRotationFromNormal(a);return{segmentIdx:r,segmentVertices:i,normal:a,rotation:l}}else return{segmentIdx:-1,segmentVertices:null,normal:new le(0,0,1),rotation:[0,0,0]}}static getOrderedWallArrayOfRoof(e){const n=new Map;for(const a of M.getState().elements)a.type===z.Wall&&a.roofId===e&&n.set(a.id,a);if(n.size===0)return{orderedWallArray:[],isLoop:!1};const o=n.entries().next().value[1],r=[o];let i=o.rightJoints[0];for(;i&&i!==o.id;){const a=n.get(i);if(a)r.push(a),i=a.rightJoints[0];else break}if(i===o.id)return{orderedWallArray:r,isLoop:!0};for(i=o.leftJoints[0];i;){const a=n.get(i);if(a)r.unshift(a),i=a.leftJoints[0];else break}return{orderedWallArray:r,isLoop:!1}}static getRoofBoundaryVertices(e){const n=Cn.getState().roofSegmentVerticesMap.get(e.id);if(!n)throw new Error;if(e.roofType!==Go.Gable&&e.rise<.01)return n[0].map(o=>({x:o.x,y:o.y}));switch(e.roofType){case Go.Gable:return n.length===1?n[0].map(o=>({x:o.x,y:o.y})):n.reduce((o,r)=>(o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Go.Gambrel:return n.reduce((o,r,i)=>((i===0||i===3)&&o.push({x:r[0].x,y:r[0].y},{x:r[1].x,y:r[1].y}),o),[]);case Go.Mansard:return n.reduce((o,r,i)=>(i!==n.length-1&&o.push({x:r[0].x,y:r[0].y}),o),[]);default:return n.reduce((o,r,i)=>(o.push({x:r[0].x,y:r[0].y}),o),[])}}static getAbsoluteWindowVerticesOnRoof(e,n){const o=[],r=new le(e.cx,e.cy,e.cz),i=new le(n.cx,n.cy,n.lz);if(e.windowType===Ci.Arched){const a=Math.min(e.archHeight,e.lx/2,e.lz);for(let s=-1;s<=1;s+=2)for(let c=-1;c<=1;c+=2){const u=s*c>0?new le(e.lx/2*s,(e.lz/2-a)*c*s,0):new le(e.lx/2*s,e.lz/2*c*s,0);u.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),u.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(u)}const l=new le(0,e.lz/2,0);l.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),l.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(l)}else{for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new le(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}if(e.windowType===Ci.Polygonal&&e.polygonTop){const a=new le(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);a.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),a.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(a)}}return o}static getRelativeWindowVerticesOnRoof(e){const n=[],o=new le(e.cx,e.cy,e.cz);if(e.windowType===Ci.Arched){const r=Math.min(e.archHeight,e.lx/2,e.lz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=a*l>0?new le(e.lx/2*a,(e.lz/2-r)*l*a,0):new le(e.lx/2*a,e.lz/2*l*a,0);s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(s)}const i=new le(0,e.lz/2,0);i.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(i)}else{for(let r=-1;r<=1;r+=2)for(let i=-1;i<=1;i+=2){const a=new le(e.lx/2*r,e.lz/2*i*r,0);a.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(a)}if(e.windowType===Ci.Polygonal&&e.polygonTop){const r=new le(e.lx*e.polygonTop[0],e.lz/2+e.polygonTop[1],0);r.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(o),n.push(r)}}return n}static getAbsoluteSolarPanelVerticesOnRoof(e,n){const o=[],r=new le(e.cx,e.cy,e.cz),i=new le(n.cx,n.cy,n.cz);for(let a=-1;a<=1;a+=2)for(let l=-1;l<=1;l+=2){const s=new le(e.lx/2*a,e.ly/2*l*a,0);e.rotation[0]===0?s.applyEuler(new ln(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):s.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),s.applyEuler(new ln(0,0,n.rotation[2],"ZXY")).add(i),o.push(s)}return o}static getElementVerticesOnRoof(e,n){return e.type===z.SolarPanel?bn.getSolarPanelVerticesOnRoof(e,n):e.type===z.SolarWaterHeater?bn.getSolarWaterHeaterVerticesOnRoof(e,n):[]}static getSolarPanelVerticesOnRoof(e,n){const o=[],r=new le(e.cx,e.cy,e.cz+n.cz);for(let i=-1;i<=1;i+=2)for(let a=-1;a<=1;a+=2){const l=new le(e.lx/2*i,e.ly/2*a*i,0);e.rotation[0]===0?l.applyEuler(new ln(e.tiltAngle,0,e.relativeAzimuth,"ZXY")).add(r):l.applyEuler(new ln(e.rotation[0],e.rotation[1],e.rotation[2],"ZXY")).add(r),o.push(l)}return o}static getSolarWaterHeaterVerticesOnRoof(e,n){const o=[],{lx:r,ly:i,lz:a,waterTankRadius:l,relativeAzimuth:s}=e,c=a-l*2,u=Math.asin(Math.min(1,(c+l)/i)),d=i*Math.cos(u),f=i/2+l,p=new le(e.cx,e.cy,e.cz+n.cz),g=new ln(0,0,s,"ZXY");return o.push(new le(-r/2,f).applyEuler(g).add(p)),o.push(new le(-r/2,f-d).applyEuler(g).add(p)),o.push(new le(r/2,f-d).applyEuler(g).add(p)),o.push(new le(r/2,f).applyEuler(g).add(p)),o}static getWindowVerticesOnRoof(e,n=0){const o=[],r=new le(e.cx,e.cy,e.cz),[i,a]=[e.lx/2+n,e.lz/2+n];for(let l=-1;l<=1;l+=2)for(let s=-1;s<=1;s+=2){const c=new le(l*i,l*s*a);c.applyEuler(new ln().fromArray([e.rotation[0],e.rotation[1],e.rotation[2],"ZXY"])).add(r),o.push(c)}if(e.windowType===Ci.Polygonal){const[l,s]=e.polygonTop??Gp,c=new le(l*e.lx,e.lz+s).add(r);o.push(c)}return o}static rooftopElementBoundaryCheck(e,n){for(const o of e)if(!me.isPointInside(o.x,o.y,n))return!1;return!0}static rooftopWindowCollisionCheck(e,n,o){const r=[];for(const i of M.getState().elements)if(i.parentId===o&&i.id!==e){const a=bn.getWindowVerticesOnRoof(i);r.push(a)}for(const i of r){for(const a of n)if(me.isPointInside(a.x,a.y,i))return!1;for(const a of i)if(me.isPointInside(a.x,a.y,n))return!1}return!0}static rooftopElementCollisionCheck(e,n,o){for(const r of M.getState().elements)if((r.type===z.SolarPanel||r.type===z.SolarWaterHeater)&&r.parentId===e.parentId&&r.id!==e.id){const i=bn.getElementVerticesOnRoof(r,n);for(const s of o)if(me.isPointInside(s.x,s.y,i))return!1;for(const s of i)if(me.isPointInside(s.x,s.y,o))return!1;const a=o.map(me.mapVector3ToPoint2),l=i.map(me.mapVector3ToPoint2);a.push(a[0]),l.push(l[0]);for(let s=0;s0){for(const i of r)if(!i.leftJoints||i.leftJoints.length===0||!i.rightJoints||i.rightJoints.length===0)return Uc.WALL_DISJOINED}return Uc.COMPLETE}static calculateBuildingArea(e){const n=Eo.getWallPointsOfRoof(e);return Eo.getPolygonArea(n)}static toUValueInUS(e){return e/5.67826}static toUValueInSI(e){return e*5.67826}static toRValueInUS(e){return e*5.67826}static toRValueInSI(e){return e/5.67826}static fetchWaterTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");if(r){const i=r.createRadialGradient(e/2,n/2,0,e/2,n/2,Math.max(e,n)/2);i.addColorStop(0,"#45AAEA"),i.addColorStop(.04,"#2B65EC"),i.addColorStop(.2,"#0000FF"),r.fillStyle=i,r.fillRect(0,0,e,n)}return new g8(o)}static fetchWhiteTexture(e,n){const o=document.createElement("canvas");o.width=e,o.height=n;const r=o.getContext("2d");return r&&(r.fillStyle="white",r.fillRect(0,0,e,n)),new g8(o)}static fetchIntersectables(e){const n=[];return e.traverse(o=>{o.userData.unintersectable||n.push(o)}),n}static fetchSimulationElements(e,n){if(e.userData.simulation&&n.push(e),e.children.length>0)for(const o of e.children)Eo.fetchSimulationElements(o,n)}static getSimulationElements(e,n,o){if(e.userData.simulation&&e.uuid!==o&&n.push(e),e.children.length>0)for(const r of e.children)Eo.getSimulationElements(r,n,o)}static hasMovingParts(e){for(const n of e)switch(n.type){case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:return!0;case z.SolarPanel:if(n.trackerType!==Ll.NO_TRACKER)return!0}return!1}static onBuildingEnvelope(e){return e.type===z.Foundation||e.type===z.Window||e.type===z.Door||e.type===z.Wall||e.type===z.Roof}static getWindowArea(e,n){if(n){if(e.windowType===Ci.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ci.Polygonal&&e.polygonTop){let o=e.lx*e.lz*n.lx*n.lz;return o+=e.lx*n.lx*e.polygonTop[1]/2,o}return e.lx*e.lz*n.lx*n.lz}else{if(e.windowType===Ci.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}else if(e.windowType===Ci.Polygonal&&e.polygonTop){let o=e.lx*e.lz;return o+=e.lx*e.polygonTop[1]/2,o}return e.lx*e.lz}}static getDoorArea(e,n){if(n){if(e.doorType===Rd.Arched&&e.archHeight>0){const o=.5*e.lx*n.lx,r=e.lz*n.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz*n.lx*n.lz}else{if(e.doorType===Rd.Arched&&e.archHeight>0){const o=.5*e.lx,r=e.lz,i=Math.min(e.archHeight,r,o),a=.5*(i+o*o/i),l=Math.acos(Math.min(o/a,1));return .5*(Math.PI-l*2)*a*a-o*(a-i)+(r-i)*o*2}return e.lx*e.lz}}static hasHeliostatOrFresnelReflectors(e){for(const n of e)if(n.type===z.FresnelReflector||n.type===z.Heliostat)return!0;return!1}static lineIntersection(e,n,o,r){const i=n.x-e.x,a=n.y-e.y,l=i*(r.y-o.y)-(r.x-o.x)*a;if(l===0)return;const s=((r.y-o.y)*(r.x-e.x)+(o.x-r.x)*(r.y-e.y))/l,c=((e.y-n.y)*(r.x-e.x)+i*(r.y-e.y))/l;if(!(!(0<=s&&s<=1)||!(0<=c&&c<=1)))return{x:e.x+s*i,y:e.y+s*a}}static calculateSolarRadiationColor(e,n){const o=n/(Iz.length-1);let r=Math.max(0,Math.floor(e/o));r>Iz.length-2&&(r=Iz.length-2);const i=Math.min(1,(e-o*r)/o);return new rr(Iz[r]).lerp(Iz[r+1],i)}static transpose(e){return e[0].map((n,o)=>e.map(r=>r[o]))}static clone2DArray(e){return e.map(n=>[...n])}static fetchHeatmapTexture(e,n,o){if(!e)return null;const r=document.createElement("canvas"),i=e.length,a=e[0].length;r.width=i,r.height=a;const l=r.getContext("2d");if(l){l.clearRect(0,0,i,a);const s=l.getImageData(0,0,i,a),c=s.data;for(let u=0;un!=u>n&&e<(c-l)*(n-s)/(u-s)+l&&(r=!r)}return r}static getPoints(e){const n=[];for(const o of e)n.push({x:o.x,y:o.y});return n}static polygonIntersections(e,n,o){const r=new Array;let i,a,l;for(let s=0;s0&&(n>l.x&&(n=l.x),r>l.y&&(r=l.y),o=o||Math.abs(a)>=r)return!1;const l=e.rightPoint[0],s=e.rightPoint[1];return!(Math.abs(l)>=o||Math.abs(s)>=r)}static isSensorWithin(e,n){return Math.abs(e.cx)<.5-e.lx/n.lx&&Math.abs(e.cy)<.5-e.ly/n.ly}static isSolarCollectorWithinHorizontalSurface(e,n){const o=e.cx,r=e.cy,i=Math.cos(e.relativeAzimuth),a=Math.sin(e.relativeAzimuth),l=n.lx*.5,s=n.ly*.5,c=e.lx*.5,u=e.ly*.5*Math.cos(e.tiltAngle);let d=o+c*i-u*a,f=r+c*a+u*i;return!(Math.abs(d)>l||Math.abs(f)>s||(d=o+c*i+u*a,f=r+c*a-u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i-u*a,f=r-c*a+u*i,Math.abs(d)>l||Math.abs(f)>s)||(d=o-c*i+u*a,f=r-c*a-u*i,Math.abs(d)>l||Math.abs(f)>s))}static isWindTurbineWithinHorizontalSurface(e,n){return Math.abs(e.cx)<=.5&&Math.abs(e.cy)<=.5}static isUnitVectorX(e){return Eo.isSame(e,Op)||Eo.isSame(e,Vp)}static isUnitVectorY(e){return Eo.isSame(e,Yc)||Eo.isSame(e,_p)}static isSame(e,n){return Math.abs(e.x-n.x)Et)return!1;return!0}static isEqual(e,n){return Math.abs(e-n)-1&&e.splice(o,1)}static fixElements(e){const n=[];for(const o of e)o.type||n.push(o);if(n.length>0)for(const o of n)Eo.deleteElement(e,o)}static fixViewStateLight(e){e.ambientLightIntensity&&(e.ambientLightIntensity*=2),e.directLightIntensity&&(e.directLightIntensity*=3.5)}static isResizingVertical(e){switch(e){case Mt.LowerLeftTop:case Mt.UpperLeftTop:case Mt.LowerRightTop:case Mt.UpperRightTop:return!0;default:return!1}}static isTopResizeHandle(e){return e===Mt.LowerLeftTop||e===Mt.LowerRightTop||e===Mt.UpperLeftTop||e===Mt.UpperRightTop||e===Mt.Top}static isXResizeHandle(e){return e===Mt.Left||e===Mt.Right}static isYResizeHandle(e){return e===Mt.Upper||e===Mt.Lower}static isTopResizeHandleOfWall(e){return e===Mt.UpperLeft||e===Mt.UpperRight}static isRiseHandleOfRoof(e){return e===Lr.Top||e===Lr.Mid||e===Lr.TopMid}static isMoveHandle(e){return e===zo.Default||e===zo.Top||e===zo.Upper||e===zo.Lower||e===zo.Left||e===zo.Right}static snapToNormalGrid(e){const n=Math.round(e.x/P6)*P6,o=Math.round(e.y/P6)*P6;return new le(n,o,e.z)}static snapToFineGrid(e){const n=Math.round(e.x/m9)*m9,o=Math.round(e.y/m9)*m9;return new le(n,o,e.z)}static isPositionRelative(e){return e===z.SolarPanel||e===z.ParabolicTrough||e===z.ParabolicDish||e===z.FresnelReflector||e===z.Heliostat||e===z.WindTurbine||e===z.SolarWaterHeater||e===z.Sensor||e===z.Light||e===z.Polygon||e===z.Window||e===z.Door||e===z.Roof||e===z.Wall}static isPlantOrHuman(e){return e.type===z.Tree||e.type===z.Flower||e.type===z.Human}static isFoundationOrCuboid(e){return e.type===z.Foundation||e.type===z.Cuboid}static isSolarCollector(e){return Eo.isSolarCollectorType(e.type)}static isSolarCollectorType(e){return e===z.SolarPanel||e===z.SolarWaterHeater||Eo.isCspCollectorType(e)}static isCspCollector(e){return Eo.isCspCollectorType(e.type)}static isCspCollectorType(e){return e===z.ParabolicDish||e===z.ParabolicTrough||e===z.FresnelReflector||e===z.Heliostat}static isParabolicCollector(e){return Eo.isParabolaType(e.type)}static isParabolaType(e){return e===z.ParabolicDish||e===z.ParabolicTrough}static isParabolicTroughOrFresnelReflector(e){return e===z.FresnelReflector||e===z.ParabolicTrough}static isHeliostatOrFresnelReflector(e){return e===z.FresnelReflector||e===z.Heliostat}static isLegalOnWall(e){switch(e){case z.Window:case z.Door:case z.Sensor:case z.Light:case z.SolarPanel:case z.Polygon:return!0}return!1}static isDescendantOf(e,n){const o=e.parentId;if(!o||o===Zo)return!1;const r=M.getState().getElementById(o);return r?r.id===n?!0:Eo.isDescendantOf(r,n):!1}static isElementInsideWall(e,n,o,r,i){const a=n/2,l=o/2;for(let c=-1;c<=1;c+=2)for(let u=-1;u<=1;u+=2){if(i&&u===-1)continue;const d=e.x+a*c,f=e.z+l*u;if(!Eo.isPointInside(d,f,r))return!1}const s=[{x:e.x-a,y:e.z-l},{x:e.x-a,y:e.z+l},{x:e.x+a,y:e.z+l},{x:e.x+a,y:e.z-l}];for(const c of r)if(Eo.isPointInside(c.x,c.y,s))return!1;return!0}static isRectOutsideBoundary(e,n,o,r,i,a){return e+o>i||e-o<-i||n+r>a||n-r<-a}static getSolarPanelVerticesOnCuboidVerticalFace(e){const n=[],[o,r]=[e.lx/2,e.ly/2];return Eo.isIdentical(e.normal,[-1,0,0])||Eo.isIdentical(e.normal,[1,0,0])?(n.push({x:e.cy-o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz-r}),n.push({x:e.cy+o,y:e.cz+r}),n.push({x:e.cy-o,y:e.cz+r})):(Eo.isIdentical(e.normal,[0,1,0])||Eo.isIdentical(e.normal,[0,-1,0]))&&(n.push({x:e.cx-o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz-r}),n.push({x:e.cx+o,y:e.cz+r}),n.push({x:e.cx-o,y:e.cz+r})),n}static checkCollisionOnCuboidSameVerticalFace(e){for(const n of M.getState().elements)if(n.type===z.SolarPanel&&n.id!==e.id&&n.parentId===e.parentId&&Eo.isIdentical(n.normal,e.normal)){const o=Eo.getSolarPanelVerticesOnCuboidVerticalFace(n),r=Eo.getSolarPanelVerticesOnCuboidVerticalFace(e);for(const i of o)if(Eo.isPointInside(i.x,i.y,r))return!0;for(const i of r)if(Eo.isPointInside(i.x,i.y,o))return!0}return!1}static checkElementOnCuboidState(e,n){if(Eo.isIdentical(e.normal,[0,0,1])){if(!Eo.isSolarCollectorWithinHorizontalSurface(e,n))return pa.OutsideBoundary;if(M.getState().overlapWithSibling(e))return pa.OverLap}else{const[o,r]=[e.lx/2,e.ly/2],[i,a,l]=[n.lx/2,n.ly/2,n.lz/2];if(Eo.isIdentical(e.normal,[-1,0,0])||Eo.isIdentical(e.normal,[1,0,0])){if(Eo.isRectOutsideBoundary(e.cy,e.cz,o,r,a,l))return pa.OutsideBoundary}else if((Eo.isIdentical(e.normal,[0,1,0])||Eo.isIdentical(e.normal,[0,-1,0]))&&Eo.isRectOutsideBoundary(e.cx,e.cz,o,r,i,l))return pa.OutsideBoundary;if(Eo.checkCollisionOnCuboidSameVerticalFace(e))return pa.OverLap}return pa.Valid}static checkElementOnWallState(e,n){let r=e.lx/2+1e-5,i=e.lz/2+1e-5;n&&e.type===z.SolarPanel&&(r=r/n.lx+1e-5,i=e.ly/2/n.lz+1e-5);const a=e.cx-r,l=e.cx+r,s=e.cz-i,c=e.cz+i;if(n&&n.type===z.Wall&&!Eo.isElementInsideWall(new le(e.cx*n.lx,e.cy,e.cz*n.lz),n.lx*r*2,n.lz*i*2,Eo.getWallInnerSideShapePoints(n),e.type===z.Door))return pa.OutsideBoundary;for(const u of M.getState().elements)if(Eo.isLegalOnWall(u.type)&&u.type!==z.Polygon&&u.parentId===e.parentId&&u.id!==e.id){let d=u.lx/2,f=u.lz/2;n&&u.type===z.SolarPanel&&(d=d/n.lx,f=u.ly/2/n.lz);const p=u.cx-d,g=u.cx+d,A=u.cz-f,y=u.cz+f;if((a>=p&&a<=g||l>=p&&l<=g||p>=a&&p<=l||g>=a&&g<=l)&&(s>=A&&s<=y||c>=A&&c<=y||A>=s&&A<=c||y>=s&&y<=c))return pa.OverLap}return pa.Valid}static checkElementOnRoofState(e,n){if(e.foundationId){const o=M.getState().getElementById(e.foundationId);if(o){const r=bn.getElementVerticesOnRoof(e,o),i=bn.getRoofBoundaryVertices(n);return bn.rooftopElementBoundaryCheck(r,i)?bn.rooftopElementCollisionCheck(e,o,r)?pa.Valid:pa.OverLap:pa.OutsideBoundary}}return pa.Invalid}static relativeCoordinates(e,n,o,r,i){const a=new le(e,n,o);if(r.type===z.Wall){const l=new le(r.cx,r.cy),s=M.getState().getParent(r);if(s){const c=new le(s.cx,s.cy);l.applyEuler(new ln(0,0,s.rotation[2])).add(c).setZ(s.lz+r.lz/2),a.sub(l).applyEuler(new ln(0,0,-r.relativeAngle-s.rotation[2]))}}else{const{pos:l,rot:s}=Eo.getWorldDataById(r.id);a.set(e-l.x,n-l.y,o-l.z),a.applyEuler(new ln(0,0,-s))}return i||(a.x/=r.lx,a.y/=r.ly,a.z/=r.lz),a}static absoluteCoordinates(e,n,o,r,i,a,l){if(r.type===z.Wall&&i){const c=r,u=i?i.rotation[2]+c.relativeAngle:c.relativeAngle;if(u!==void 0){const d=Eo.wallAbsolutePosition(new le(c.cx,c.cy,c.cz),i).setZ(c.lz/2+i.lz),f=new le(e*c.lx,n*c.ly,o*c.lz);if(f.applyAxisAngle(ko,u),a){const p=a*Math.cos(u-Qt),g=a*Math.sin(u-Qt);return new le(d.x+f.x+p,d.y+f.y+g,d.z+f.z)}return new le(d.x+f.x,d.y+f.y,d.z+f.z)}}if(r.type===z.Roof&&i){const c=new le(e,n,o+i.cz);return c.applyEuler(new ln().fromArray(i.rotation)),c.x+=i.cx,c.y+=i.cy,c}const s=new le;return l?s.set(e,n,o):s.set(e*r.lx,n*r.ly,o*r.lz),s.applyEuler(new ln().fromArray(r.rotation)),s.x+=r.cx,s.y+=r.cy,s.z+=r.cz,s}static absoluteHumanOrTreeCoordinates(e,n,o,r){const i=new le(e,n,o);return i.applyEuler(new ln().fromArray(r.rotation)),i.x+=r.cx,i.y+=r.cy,i.z+=r.cz,i}static relativePoint(e,n){const o=new le(e.x-n.cx,e.y-n.cy,e.z-n.cz);return o.applyEuler(new ln().fromArray(n.rotation.map(r=>-r))),o}static wallAbsolutePosition(e,n){const o=new le(n.cx,n.cy);return new le().addVectors(o,new le(e.x,e.y).applyAxisAngle(ko,n.rotation[2]))}static wallRelativePosition(e,n){const o=new le(n.cx,n.cy);return new le().subVectors(new le(e.x,e.y),o).applyAxisAngle(ko,-n.rotation[2])}static getObjectChildById(e,n){if(e){for(const o of e.children)if(o.name===Xv){const r=Eo.getStackCuboidObjectById(o,n);if(r)return r}else if(o.name.includes(n))return o}return null}static getStackCuboidObjectById(e,n){if(e)for(const o of e.children){if(o.name.includes(n))return o;if(o.name===M$e){const r=Eo.getStackCuboidObjectById(o.children[0],n);if(r)return r}}return null}static toRadians(e){return e*(Math.PI/180)}static toDegrees(e){return e*(180/Math.PI)}static getArrayMax(e){return e.reduce((n,o)=>Math.max(n,o))}static getArrayMin(e){return e.reduce((n,o)=>Math.min(n,o))}static getArrayMax2D(e){return Eo.getArrayMax(e.map(Eo.getArrayMax))}static getArrayMin2D(e){return Eo.getArrayMin(e.map(Eo.getArrayMin))}static sphericalToCartesianZ(e){const n=e.x*Math.cos(e.z),o=n*Math.cos(e.y),r=n*Math.sin(e.y),i=e.x*Math.sin(e.z);return e.set(o,r,i),e}static getDistance(e,n,o,r){return e=Eo.toRadians(e),n=Eo.toRadians(n),o=Eo.toRadians(o),r=Eo.toRadians(r),Math.acos(Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos(Math.abs(e-o)))}static minutesIntoDay(e){return e.getHours()*60+e.getMinutes()}static dayOfYear(e){return(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())-Date.UTC(e.getFullYear(),0,0))/864e5}static daysInYear(e){const n=e.getFullYear();return n%4===0&&n%100>0||n%400===0?366:365}static daysOfMonth(e,n){return new Date(n,e+1,0).getDate()}static fahrenheitToCelsius(e){return(e-32)*5/9}static celsiusToFahrenheit(e){return e*(9/5)+32}static getOS(){var e;return(e=rje.os)==null?void 0:e.family}static isMac(){const e=Eo.getOS();return e?e.includes("Mac")||e.includes("OS X"):!1}static isChrome(){const e=Eo.getOS();return e?e.includes("Chrome"):!1}static detectWebGLContext(){try{const e=document.createElement("canvas");return!!window.WebGLRenderingContext&&(!!e.getContext("webgl")||!!e.getContext("experimental-webgl"))}catch{return!1}}static clamp(e,n,o){return n>o?(n+o)/2:Math.min(Math.max(e,n),o)}static distanceFromPointToLine2D(e,n,o){const[r,i]=[e.x,e.y],[a,l]=[n.x,n.y],[s,c]=[o.x,o.y],u=r-a,d=i-l,f=s-a,p=c-l,g=u*f+d*p,A=f*f+p*p;let y=-1;A!==0&&(y=g/A);let S,C;y<0?(S=a,C=l):y>1?(S=s,C=c):(S=a+y*f,C=l+y*p);const P=r-S,v=i-C;return Math.sqrt(P*P+v*v)}static mapVector3ToPoint2(e){return{x:e.x,y:e.y}}static getWallVertices(e,n){const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:-r-n},a={x:o+n,y:-r-n},l={x:-o-n,y:(e.leftRoofHeight??e.lz)-r+n},s={x:o+n,y:(e.rightRoofHeight??e.lz)-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static isPartialWallFull(e){return Eo.isZero((e.leftRoofHeight??e.lz)-e.leftTopPartialHeight)&&Eo.isZero((e.rightRoofHeight??e.lz)-e.rightTopPartialHeight)&&Eo.isZero(e.leftUnfilledHeight)&&Eo.isZero(e.rightUnfilledHeight)}static getPartialWallVertices(e,n){if(Eo.isPartialWallFull(e))return Eo.getWallVertices(e,n);const o=e.lx/2,r=e.lz/2,i={x:-o-n,y:e.leftUnfilledHeight-r-n},a={x:o+n,y:e.rightUnfilledHeight-r-n},l={x:-o-n,y:e.leftTopPartialHeight-r+n},s={x:o+n,y:e.rightTopPartialHeight-r+n},c=[];return c.push(l,i,a,s),e.centerRightRoofHeight&&c.push({x:e.centerRightRoofHeight[0]*e.lx,y:e.centerRightRoofHeight[1]-r+n}),e.centerRoofHeight&&c.push({x:e.centerRoofHeight[0]*e.lx,y:e.centerRoofHeight[1]-r+n}),e.centerLeftRoofHeight&&c.push({x:e.centerLeftRoofHeight[0]*e.lx,y:e.centerLeftRoofHeight[1]-r+n}),c}static getHighestPointOfWall(e){let n=e.lz;return e.leftRoofHeight&&(n=Math.max(n,e.leftRoofHeight)),e.rightRoofHeight&&(n=Math.max(n,e.rightRoofHeight)),e.centerRightRoofHeight&&(n=Math.max(n,e.centerRightRoofHeight[1])),e.centerRoofHeight&&(n=Math.max(n,e.centerRoofHeight[1])),e.centerLeftRoofHeight&&(n=Math.max(n,e.centerLeftRoofHeight[1])),n}static getWallPointsOfRoof(e,n){let o=n??M.getState().getElementById(e.wallsId[0]);if(!o)return[];const r=o,i=[];for(;o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.leftJoints[0]);)if(o.leftJoints[0]!==r.id)o=M.getState().getElementById(o.leftJoints[0]);else return i.reverse(),i;for(i.reverse(),o=M.getState().getElementById(r==null?void 0:r.rightJoints[0]);o&&(!o.roofId||o.roofId===e.id)&&(i.push({x:o.leftPoint[0],y:o.leftPoint[1],eave:o.eavesLength??0}),o.rightJoints[0]&&o.rightJoints[0]!==r.id);)o=M.getState().getElementById(o.rightJoints[0]);return i}static getWallInnerSideShapePoints(e){const{lx:n,ly:o,lz:r,relativeAngle:i,fill:a,leftUnfilledHeight:l,rightUnfilledHeight:s,leftRoofHeight:c,centerLeftRoofHeight:u,centerRoofHeight:d,centerRightRoofHeight:f,rightRoofHeight:p,leftJoints:g,rightJoints:A}=e,y=g.length>0?M.getState().getElementById(g[0]):null,S=A.length>0?M.getState().getElementById(A[0]):null,C=y&&y.type===z.Wall?Eo.getInnerWallOffset(y,n,o,i,"left"):0,P=S&&S.type===z.Wall?Eo.getInnerWallOffset(S,n,o,i,"right"):0,v=[],T=n/2,w=r/2;return a===Fl.Partial?(v.push({x:-T+C,y:-w+l}),v.push({x:T-P,y:-w+s})):(v.push({x:-T+C,y:-w}),v.push({x:T-P,y:-w})),p?v.push({x:T-P,y:p-w}):v.push({x:T-P,y:w}),f&&v.push({x:f[0]*n,y:f[1]-w}),d&&v.push({x:d[0]*n,y:d[1]-w}),u&&v.push({x:u[0]*n,y:u[1]-w}),c?v.push({x:-T+C,y:c-w}):v.push({x:-T+C,y:w}),v}static getInnerWallOffset(e,n,o,r,i){let a=0;if(e&&e.fill!==Fl.Empty){const l=i==="left"?-1:1,s=(Math.PI*3+l*(r-e.relativeAngle))%sa;s<=Qt+.01&&s>0&&(a=Math.min(o/Math.tan(s)+e.ly,n))}return a}static isElementAllowedMultipleMoveOnGround(e){return e.type===z.Foundation||e.type===z.Cuboid&&e.parentId===Zo}static areBasesOverlapped(e,n,o){const r=o.get(e),i=o.get(n);if(!r||!i)return!1;for(const a of r)if(Eo.isPointInside(a.x,a.y,i))return!0;for(const a of i)if(Eo.isPointInside(a.x,a.y,r))return!0;r.push(r[0]),i.push(i[0]);for(let a=0;aNumber(c)),[a,l,s]=n.split(".").map(c=>Number(c));return oa?!1:rl?!1:i{const n=M.getState().getElementById,o=[],r=e;for(;e&&(o.push(e),e.leftJoints[0]);)if(e.leftJoints[0]!==r.id){const a=n(e.leftJoints[0]);a&&a.type===z.Wall&&(e=a)}else return o;const i=n(r.rightJoints[0]);for(i&&i.type===z.Wall&&(e=i);e&&(o.push(e),e.rightJoints[0]&&e.rightJoints[0]!==r.id);){const a=n(e.rightJoints[0]);a&&(e=a)}return o},Eo.getWorldDataById=e=>{const n=M.getState().getElementById(e);if(!n)return{pos:new le,rot:0,topZ:0};const o=new le(n.cx,n.cy,n.cz),r=n.rotation[2],i=n.lz;if(n.parentId===Zo)return{pos:o,rot:r,topZ:i};const{pos:a,rot:l,topZ:s}=Eo.getWorldDataById(n.parentId),c=new ln(0,0,l);return{pos:new le().addVectors(o.applyEuler(c),a.clone().setZ(s)),rot:r+l,topZ:i+s}},Eo.isChild=(e,n,o=!1)=>{const r=M.getState().getElementById(n);return!r||o&&r.locked?!1:r.parentId===e?!0:Eo.isChild(e,r.parentId,o)},Eo.getBaseId=e=>{const n=M.getState().getElementById(e);return n?n.parentId===Zo?n.id:Eo.getBaseId(n.parentId):null},Eo.isElementTriggerAutoDeletion=e=>{if(e.type===z.Roof){const r=e;if(r.roofType===Go.Gable||r.roofType===Go.Gambrel)return!0}if(e.type!==z.Wall)return!1;const n=e;if(!n.roofId)return!1;const o=M.getState().getElementById(n.roofId);if(!o)return!1;switch(o.roofType){case Go.Hip:case Go.Gable:case Go.Gambrel:return!0;case Go.Pyramid:case Go.Mansard:return o.wallsId.length===0?!1:o.wallsId[0]===n.id;default:return!1}};let me=Eo;var XSe;class JSe{constructor(){this[XSe]=!0,this.latitude=42.2844063,this.longitude=-71.3488548,this.address=pG,this.countryCode="US",this.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),this.name="default",this.ground={albedo:.3,thermalDiffusivity:.05,snowReflectionFactors:new Array(12).fill(0)},this.leafDayOfYear1=Nq,this.leafDayOfYear2=Uq,this.airAttenuationCoefficient=.01,this.airConvectiveCoefficient=5,this.timesPerHour=1,this.daysPerYear=12,this.monthlyIrradianceLosses=new Array(12).fill(.05),this.pvGridCellSize=.5,this.discretization=Em.APPROXIMATE,this.diurnalTemperatureModel=y2.Sinusoidal,this.highestTemperatureTimeInMinutes=900,this.solarPanelVisibilityGridCellSize=.2,this.solarRadiationHeatmapGridCellSize=.5,this.cspTimesPerHour=1,this.cspDaysPerYear=4,this.cspGridCellSize=.5,this.sutTimesPerHour=1,this.sutDaysPerYear=4,this.sutGridCellSize=1,this.noAnimationForHeatmapSimulation=!1,this.noAnimationForThermalSimulation=!1,this.noAnimationForSensorDataCollection=!1,this.noAnimationForSolarPanelSimulation=!1,this.noAnimationForSolarUpdraftTowerSimulation=!1}static resetWorldModel(e){e.latitude=42.2844063,e.longitude=-71.3488548,e.address=pG,e.countryCode="US",e.date=new Date(new Date().getFullYear(),5,22,12).toLocaleString("en-US"),e.name="default",e.ground.albedo=.3,e.ground.thermalDiffusivity=.05,e.ground.snowReflectionFactors.fill(0),e.airAttenuationCoefficient=.01,e.airConvectiveCoefficient=5,e.timesPerHour=1,e.daysPerYear=12,e.monthlyIrradianceLosses=new Array(12).fill(.05),e.pvGridCellSize=.5,e.discretization=Em.APPROXIMATE,e.diurnalTemperatureModel=y2.Sinusoidal,e.highestTemperatureTimeInMinutes=900,e.solarPanelVisibilityGridCellSize=.2,e.solarRadiationHeatmapGridCellSize=.5,e.cspTimesPerHour=1,e.cspDaysPerYear=4,e.cspGridCellSize=.5,e.sutTimesPerHour=1,e.sutDaysPerYear=4,e.sutGridCellSize=1,e.noAnimationForHeatmapSimulation=!1,e.noAnimationForThermalSimulation=!1,e.noAnimationForSensorDataCollection=!1,e.noAnimationForSolarPanelSimulation=!1,e.noAnimationForSolarUpdraftTowerSimulation=!1}getElements(){const e=[],n={type:z.Foundation,cx:0,cy:0,cz:.05,lx:10,ly:10,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:Zo,textureType:_i.NoTexture,id:Gi.generate()};e.push(n);const o={type:z.Sensor,cx:-.1,cy:0,cz:.105,lx:.1,ly:.1,lz:.01,parentId:n.id,foundationId:n.id,normal:[0,0,1],rotation:[0,0,0],id:Gi.generate(),showLabel:!0,light:!0,heatFlux:!1};e.push(o);const r={type:z.Human,name:Vt.Judd,cx:1,cy:-1,cz:0,lx:kp.fetchWidth(Vt.Jiya),lz:kp.fetchHeight(Vt.Jiya),normal:[1,0,0],rotation:[0,0,0],parentId:Zo,id:Gi.generate()};return e.push(r),e}}XSe=qm;class Dl{static clone(e,n,o,r,i,a,l,s){let c=null;switch(n.type){case z.Polygon:e&&(c=Dl.clonePolygon(e,n,o,r,i,a,l));break;case z.Sensor:e&&(c=Dl.cloneSensor(e,n,o,r,i));break;case z.Light:e&&(c=Dl.cloneLight(e,n,o,r,i));break;case z.SolarPanel:e&&(c=Dl.cloneSolarPanel(e,n,o,r,i));break;case z.SolarWaterHeater:e&&(c=Dl.cloneSolarWaterHeater(e,n,o,r,i));break;case z.ParabolicTrough:e&&(c=Dl.cloneParabolicTrough(e,n,o,r,i));break;case z.ParabolicDish:e&&(c=Dl.cloneParabolicDish(e,n,o,r,i));break;case z.FresnelReflector:e&&(c=Dl.cloneFresnelReflector(e,n,o,r,i));break;case z.Heliostat:e&&(c=Dl.cloneHeliostat(e,n,o,r,i));break;case z.WindTurbine:e&&(c=Dl.cloneWindTurbine(e,n,o,r,i));break;case z.Wall:e&&(c=Dl.cloneWall(e,n,o,r,i));break;case z.Window:e&&(c=Dl.cloneWindow(e,n,o,r,i,s));break;case z.Door:e&&(c=Dl.cloneDoor(e,n,o,r,i));break;case z.Roof:e&&(c=Dl.cloneRoof(e,n,o,r,i));break;case z.Human:c=Dl.cloneHuman(n,o,r,i,e);break;case z.Tree:c=Dl.cloneTree(n,o,r,i,e);break;case z.Flower:c=Dl.cloneFlower(n,o,r,i,e);break;case z.Foundation:c=Dl.cloneFoundation(n,o,r);break;case z.Cuboid:{const u=e?e.id:Zo;c=Dl.cloneCuboid(u,n,o,r);break}}return c}static cloneHuman(e,n,o,r,i){return{type:z.Human,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static cloneTree(e,n,o,r,i){return{type:z.Tree,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static cloneFlower(e,n,o,r,i){return{type:z.Flower,name:e.name,flip:e.flip,cx:n,cy:o,cz:r,lx:e.lx,ly:e.ly,lz:e.lz,normal:[...e.normal],rotation:[...e.rotation],parentId:(i==null?void 0:i.id)??e.parentId,id:Gi.generate()}}static clonePolygon(e,n,o,r,i,a,l){let s;switch(e.type){case z.Foundation:case z.Cuboid:s=e.id;break;case z.Wall:case z.Roof:s=e.parentId;break}const c=n.vertices.map(d=>({...d})),u={type:z.Polygon,cx:o,cy:r,cz:i,lx:n.lx,ly:n.ly,lz:n.lz,filled:n.filled,noOutline:n.noOutline,color:n.color,lineColor:n.lineColor,lineWidth:n.lineWidth,opacity:n.opacity,textureType:n.textureType,text:n.text,fontSize:n.fontSize,fontColor:n.fontColor,normal:[...n.normal],rotation:n.parentId?[...e.rotation]:[0,0,0],vertices:c,parentId:e.id,parentType:e.type,foundationId:s,id:Gi.generate()};if(!a){let d=o,f=r;if(e.type===z.Cuboid&&l){me.isSame(l,Vp)?d=i??0:me.isSame(l,Op)?d=-(i??0):me.isSame(l,_p)?f=i??0:me.isSame(l,Yc)&&(f=-(i??0));const p=l.dot(new le().fromArray(n.normal));if(Math.abs(p)0&&this.commands.length>this.limit&&this.commands.splice(0,this.commands.length-this.limit),this.index=this.commands.length-1)}undo(){const e=this.commands[this.index];if(e)return this.isExecuting=!0,e.undo(),this.isExecuting=!1,this.index--,e.name}redo(){const e=this.commands[this.index+1];if(e)return this.isExecuting=!0,e.redo(),this.isExecuting=!1,this.index++,e.name}clear(){this.commands=[],this.index=-1}hasUndo(){return this.index!==-1}hasRedo(){return this.index0||this.cuboidCount>0||this.wallCount>0||this.windowCount>0||this.doorCount>0||this.humanCount>0||this.treeCount>0||this.flowerCount>0||this.polygonCount>0||this.sensorCount>0||this.insideLightCount>0||this.outsideLightCount>0||this.solarPanelCount>0||this.parabolicTroughCount>0||this.parabolicDishCount>0||this.fresnelReflectorCount>0||this.heliostatCount>0||this.solarUpdraftTowerCount>0||this.windTurbineCount>0}}var eTe;class Xen{constructor(e){this[eTe]=!0,this.problem=e,this.objectiveFunctionType=Po.DAILY_TOTAL_OUTPUT,this.selectionMethod=Wm.ROULETTE_WHEEL,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.populationSize=20,this.maximumGenerations=5,this.selectionRate=.5,this.crossoverRate=.5,this.mutationRate=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}eTe=qm;var tTe;class Jen{constructor(e){this[tTe]=!0,this.problem=e,this.objectiveFunctionType=Po.DAILY_TOTAL_OUTPUT,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.swarmSize=20,this.maximumSteps=5,this.vmax=.01,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.convergenceThreshold=.01,this.localSearchRadius=.1}}tTe=qm;var nTe;class oTe{constructor(){this[nTe]=!0,this.geneticAlgorithmParams=new Xen(Ri.SOLAR_PANEL_TILT_ANGLE),this.particleSwarmOptimizationParams=new Jen(Ri.SOLAR_PANEL_TILT_ANGLE)}}nTe=qm;var rTe;class mX{constructor(){this[rTe]=!0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.poleHeight=1,this.poleSpacing=5,this.orientation=vr.landscape,this.pvModelName="CS6X-355P-FG",this.rowAxis=El.leftRight}}rTe=qm;var iTe;class aTe{constructor(){this[iTe]=!0,this.projectLifeSpan=25,this.electricitySellingPrice=.25,this.operationalCostPerUnit=.15}}iTe=qm;var lTe;class sTe{constructor(){this[lTe]=!0,this.humanName=Vt.Jack,this.flowerType=ro.YellowFlower,this.treeType=pr.Dogwood,this.treeSpread=3,this.treeHeight=4,this.foundationHeight=.1,this.foundationColor="#808080",this.foundationTexture=_i.NoTexture,this.groundFloorRValue=i8,this.cuboidHeight=4,this.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"],this.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture],this.cuboidStackable=!1,this.cuboidTransparency=0,this.wallHeight=5,this.wallThickness=.3,this.wallColor="#ffffff",this.wallTexture=Bo.Default,this.wallStructure=gc.Default,this.wallStructureSpacing=2,this.wallStructureWidth=.1,this.wallStructureColor="#ffffff",this.wallOpacity=.5,this.wallRValue=p6,this.wallVolumetricHeatCapacity=.5,this.wallEavesLength=.3,this.wallParapet=Zye,this.roofColor="#454769",this.roofSideColor="#ffffff",this.roofTexture=Ur.Default,this.roofThickness=.2,this.roofStructure=Ac.Default,this.roofGlassOpacity=.5,this.roofGlassTint="#73D8FF",this.roofRafterWidth=.1,this.roofRafterSpacing=1,this.roofRafterColor="#ffffff",this.roofRValue=a8,this.roofVolumetricHeatCapacity=.5,this.roofRise=2,this.roofCeiling=!1,this.ceilingRValue=w6,this.doorColor="#ffffff",this.doorFrameColor="#ffffff",this.doorTexture=sr.Default,this.doorType=Rd.Default,this.doorArchHeight=1,this.doorFilled=!0,this.doorInterior=!1,this.doorUValue=J4,this.doorOpacity=1,this.doorVolumetricHeatCapacity=.5,this.windowWidth=1,this.windowHeight=1,this.windowColor="#ffffff",this.windowTint="#73D8FF",this.windowOpacity=.5,this.windowUValue=X4,this.windowHorizontalMullion=!0,this.windowVerticalMullion=!0,this.windowMullionWidth=.06,this.windowHorizontalMullionSpacing=.5,this.windowVerticalMullionSpacing=.5,this.windowMullionColor="#ffffff",this.windowFrame=!1,this.windowFrameWidth=.1,this.windowSillWidth=.1,this.windowType=Ci.Default,this.windowArchHeight=1,this.windowShutterLeft=!1,this.windowShutterRight=!1,this.windowShutterColor="gray",this.windowShutterWidth=.5,this.windowEmpty=!1,this.windowInterior=!1,this.windTurbineBirdSafeDesign=uc.None,this.windTurbineBladeColor=t9,this.windTurbineStripeColor=n9,this.windTurbineNumberOfBlades=3,this.windTurbinePitchAngle=Math.PI/18,this.windTurbineRelativeYawAngle=0,this.windTurbineInitialRotorAngle=0,this.windTurbineTowerHeight=20,this.windTurbineTowerRadius=.5,this.windTurbineBladeRadius=10,this.windTurbineBladeMaximumChordLength=1,this.windTurbineBladeMaximumChordRadius=3,this.windTurbineBladeRootRadius=.3,this.windTurbineHubRadius=.75,this.windTurbineHubLength=1.5,this.solarPanelModelName=R9,this.solarPanelOrientation=vr.landscape,this.solarPanelPoleHeight=1,this.solarPanelPoleSpacing=3,this.solarPanelTiltAngle=0,this.solarPanelRelativeAzimuth=0,this.solarPanelFrameColor="#ffffff",this.solarPanelCx=0,this.solarPanelCy=0,this.solarWaterHeaterColor="grey",this.solarWaterHeaterRelativeAzimuth=0,this.solarWaterHeaterTankRadius=W$e,this.solarWaterHeaterHeight=1,this.parabolicDishReflectance=.9,this.parabolicDishAbsorptance=.95,this.parabolicDishOpticalEfficiency=.7,this.parabolicDishThermalEfficiency=.3,this.parabolicDishRimDiameter=4,this.parabolicDishLatusRectum=8,this.parabolicDishPoleHeight=.2,this.parabolicDishPoleRadius=.1,this.parabolicDishReceiverStructure=sf.CentralPole,this.parabolicTroughReflectance=.9,this.parabolicTroughAbsorptance=.95,this.parabolicTroughOpticalEfficiency=.7,this.parabolicTroughThermalEfficiency=.3,this.parabolicTroughLatusRectum=2,this.parabolicTroughPoleHeight=.2,this.parabolicTroughWidth=2,this.parabolicTroughModuleLength=3,this.fresnelReflectorReceiver="None",this.fresnelReflectorReflectance=.9,this.fresnelReflectorPoleHeight=.2,this.fresnelReflectorWidth=2,this.fresnelReflectorModuleLength=3,this.heliostatTower="None",this.heliostatReflectance=.9,this.heliostatPoleHeight=.2,this.heliostatPoleRadius=.1,this.heliostatWidth=4,this.heliostatLength=2,this.lightColor="#ffff99",this.lightIntensity=3,this.lightDistance=5}}lTe=qm;var cTe;class uTe{constructor(){this[cTe]=!0,this.dailyPvIndividualOutputs=!1,this.yearlyPvIndividualOutputs=!1,this.dailyParabolicDishIndividualOutputs=!1,this.yearlyParabolicDishIndividualOutputs=!1,this.dailyParabolicTroughIndividualOutputs=!1,this.yearlyParabolicTroughIndividualOutputs=!1,this.dailyFresnelReflectorIndividualOutputs=!1,this.yearlyFresnelReflectorIndividualOutputs=!1,this.dailyHeliostatIndividualOutputs=!1,this.yearlyHeliostatIndividualOutputs=!1,this.dailyUpdraftTowerIndividualOutputs=!1,this.yearlyUpdraftTowerIndividualOutputs=!1}}cTe=qm;class gd{static getDefaultHiddenParameters(e){return e===Ri.SOLAR_PANEL_ARRAY?["latitude","orientation","poleHeight"]:[]}static getVariables(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("rowWidth"),n.includes("tiltAngle")||o.push("tiltAngle"),n.includes("interRowSpacing")||o.push("interRowSpacing"),n.includes("latitude")||o.push("latitude"),n.includes("orientation")||o.push("orientation"),n.includes("poleHeight")||o.push("poleHeight"),n.includes("unitCost")||o.push("unitCost"),n.includes("sellingPrice")||o.push("sellingPrice"),n.includes("totalYearlyCost")||o.push("totalYearlyCost"),n.includes("totalYearlyYield")||o.push("totalYearlyYield"),n.includes("meanYearlyYield")||o.push("meanYearlyYield"),n.includes("yearlyProfit")||o.push("yearlyProfit"),o}return[]}static getTitles(e,n,o){if(e===Ri.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(Y.t("polygonMenu.SolarPanelArrayRowWidth",n)),o.includes("tiltAngle")||r.push(Y.t("polygonMenu.SolarPanelArrayTiltAngle",n)),o.includes("interRowSpacing")||r.push(Y.t("polygonMenu.SolarPanelArrayRowSpacing",n)),o.includes("latitude")||r.push(Y.t("word.Latitude",n)),o.includes("orientation")||r.push(Y.t("polygonMenu.SolarPanelArrayOrientation",n)),o.includes("poleHeight")||r.push(Y.t("polygonMenu.SolarPanelArrayPoleHeight",n)),o.includes("unitCost")||r.push(Y.t("economicsPanel.UnitCost",n)),o.includes("sellingPrice")||r.push(Y.t("economicsPanel.SellingPrice",n)),o.includes("totalYearlyCost")||r.push(Y.t("polygonMenu.SolarPanelArrayTotalYearlyCost",n)),o.includes("totalYearlyYield")||r.push(Y.t("polygonMenu.SolarPanelArrayTotalYearlyYield",n)),o.includes("meanYearlyYield")||r.push(Y.t("polygonMenu.SolarPanelArrayMeanYearlyYield",n)),o.includes("yearlyProfit")||r.push(Y.t("polygonMenu.SolarPanelArrayYearlyProfit",n)),r}return[]}static getTypes(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push("number"),n.includes("tiltAngle")||o.push("number"),n.includes("interRowSpacing")||o.push("number"),n.includes("latitude")||o.push("number"),n.includes("orientation")||o.push("boolean"),n.includes("poleHeight")||o.push("number"),n.includes("unitCost")||o.push("number"),n.includes("sellingPrice")||o.push("number"),n.includes("totalYearlyCost")||o.push("number"),n.includes("totalYearlyYield")||o.push("number"),n.includes("meanYearlyYield")||o.push("number"),n.includes("yearlyProfit")||o.push("number"),o}return[]}static getDigits(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(0),n.includes("tiltAngle")||o.push(1),n.includes("interRowSpacing")||o.push(1),n.includes("latitude")||o.push(1),n.includes("orientation")||o.push(0),n.includes("poleHeight")||o.push(1),n.includes("unitCost")||o.push(2),n.includes("sellingPrice")||o.push(2),n.includes("totalYearlyCost")||o.push(1),n.includes("totalYearlyYield")||o.push(1),n.includes("meanYearlyYield")||o.push(1),n.includes("yearlyProfit")||o.push(3),o}return[]}static getTickIntegers(e,n){if(e===Ri.SOLAR_PANEL_ARRAY){const o=[];return n.includes("rowWidth")||o.push(!0),n.includes("tiltAngle")||o.push(!1),n.includes("interRowSpacing")||o.push(!1),n.includes("latitude")||o.push(!1),n.includes("orientation")||o.push(!0),n.includes("poleHeight")||o.push(!1),n.includes("unitCost")||o.push(!1),n.includes("sellingPrice")||o.push(!1),n.includes("totalYearlyCost")||o.push(!1),n.includes("totalYearlyYield")||o.push(!1),n.includes("meanYearlyYield")||o.push(!1),n.includes("yearlyProfit")||o.push(!1),o}return[]}static getUnits(e,n,o){if(e===Ri.SOLAR_PANEL_ARRAY){const r=[];return o.includes("rowWidth")||r.push(" "+Y.t("solarPanelMenu.Panels",n)),o.includes("tiltAngle")||r.push("°"),o.includes("interRowSpacing")||r.push(" "+Y.t("word.MeterAbbreviation",n)),o.includes("latitude")||r.push("°"),o.includes("orientation")||r.push(""),o.includes("poleHeight")||r.push(" "+Y.t("word.MeterAbbreviation",n)),o.includes("unitCost")||r.push(""),o.includes("sellingPrice")||r.push(""),o.includes("totalYearlyCost")||r.push("K"),o.includes("totalYearlyYield")||r.push(" MWh"),o.includes("meanYearlyYield")||r.push(" kWh"),o.includes("yearlyProfit")||r.push("K"),r}return[]}static getUnit(e,n){return e==="tiltAngle"||e==="latitude"?"°":e==="interRowSpacing"||e==="poleHeight"?Y.t("word.MeterAbbreviation",n):e==="totalYearlyYield"?"MWh":e==="meanYearlyYield"?"kWh":e==="totalYearlyCost"||e==="yearlyProfit"?"K":""}static setScatterData(e,n,o,r){switch(e){case"rowWidth":o[n]=r.rowsPerRack;break;case"tiltAngle":o[n]=me.toDegrees(r.tiltAngle);break;case"interRowSpacing":o[n]=r.interRowSpacing;break;case"latitude":o[n]=r.latitude;break;case"orientation":o[n]=r.orientation===vr.landscape?0:1;break;case"poleHeight":o[n]=r.poleHeight;break;case"unitCost":o[n]=r.unitCost;break;case"sellingPrice":o[n]=r.sellingPrice;break;case"totalYearlyCost":o[n]=me.calculateCost(r);break;case"totalYearlyYield":o[n]=r.yearlyYield*.001;break;case"meanYearlyYield":o[n]=r.yearlyYield/r.panelCount;break;case"yearlyProfit":o[n]=me.calculateProfit(r);break}}}class Ken{static updateOldFileData(){M.getState().set(e=>{me.compareVersion(e.version,q6t)&&(e.viewState.ambientLightIntensity&&(e.viewState.ambientLightIntensity*=3),e.viewState.directLightIntensity&&(e.viewState.directLightIntensity*=3.5));const n=new Map;for(const o of e.elements)n.set(o.id,o);for(const o of e.elements)switch(o.type){case z.Foundation:{o.parentId!==Zo&&(console.error("Error: "+o.parentId+" is not ground!"),o.parentId=Zo);break}case z.Wall:{const r=o;if(r.wallStructure===void 0&&(r.wallStructure=gc.Default),r.structureSpacing===void 0&&(r.structureSpacing=2),r.structureWidth===void 0&&(r.structureWidth=.1),r.structureColor===void 0&&(r.structureColor="white"),r.opacity===void 0&&(r.opacity=.5),r.fill===void 0&&(r.fill=Fl.Full),r.unfilledHeight===void 0&&(r.unfilledHeight=.5),r.leftUnfilledHeight===void 0||r.rightUnfilledHeight===void 0){const i=r.unfilledHeight??.5;r.leftUnfilledHeight=i,r.rightUnfilledHeight=i}if((r.leftTopPartialHeight===void 0||r.rightTopPartialHeight===void 0)&&(r.leftTopPartialHeight=r.lz,r.rightTopPartialHeight=r.lz),r.eavesLength===void 0&&r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;r.eavesLength=a.overhang!==void 0?a.overhang:.3}else r.eavesLength=.3}if(r.parapet===void 0&&(r.parapet={...Zye}),r.roofId){const i=n.get(r.roofId);if(i&&i.type===z.Roof){const a=i;(a.roofType===Go.Pyramid||a.roofType===Go.Hip||a.roofType===Go.Mansard)&&(r.leftRoofHeight=void 0,r.rightRoofHeight=void 0)}}break}case z.Window:{const r=o;r.horizontalMullion===void 0&&(r.horizontalMullion=r.mullion),r.verticalMullion===void 0&&(r.verticalMullion=r.mullion),r.mullionWidth===void 0&&(r.mullionWidth=.06),r.horizontalMullionSpacing===void 0&&(r.horizontalMullionSpacing=r.mullionSpacing??.5),r.verticalMullionSpacing===void 0&&(r.verticalMullionSpacing=r.mullionSpacing??.5),r.tint===void 0&&(r.tint="#73D8FF"),r.opacity===void 0&&(r.opacity=.5),r.shutter&&(r.leftShutter=r.shutter.showLeft,r.rightShutter=r.shutter.showRight,r.shutterColor=r.shutter.color,r.shutterWidth=r.shutter.width,r.shutter=void 0),r.shutterColor===void 0&&(r.shutterColor="gray"),r.shutterWidth===void 0&&(r.shutterWidth=.5),r.mullionColor===void 0&&(r.mullionColor="white"),r.frame===void 0&&(r.frame=!1),r.color===void 0&&(r.color="white"),r.frameWidth===void 0&&(r.frameWidth=.1),r.windowType===void 0&&(r.windowType=Ci.Default),r.archHeight===void 0&&(r.archHeight=1);break}case z.Door:{const r=o;r.doorType===void 0&&(r.doorType=Rd.Default),r.archHeight===void 0&&(r.archHeight=1),r.filled===void 0&&(r.filled=!0);break}case z.Roof:{const r=o;if(r.ceiling===void 0&&(r.ceiling=!1),r.roofType===Go.Gambrel){const i=r;i.frontRidgePoint===void 0&&(i.frontRidgePoint=i.frontRidgeLeftPoint?[...i.frontRidgeLeftPoint]:[.35,.5],i.frontRidgeLeftPoint=void 0,i.frontRidgeRightPoint=void 0),i.backRidgePoint===void 0&&(i.backRidgePoint=i.backRidgeLeftPoint?[...i.backRidgeLeftPoint]:[-.35,.5],i.backRidgeLeftPoint=void 0,i.backRidgeRightPoint=void 0),i.topRidgePoint===void 0&&(i.topRidgePoint=i.topRidgeLeftPoint?[...i.topRidgeLeftPoint]:[0,1],i.topRidgeLeftPoint=void 0,i.topRidgeRightPoint=void 0)}break}case z.SolarPanel:{const r=o;if(r.version===void 0)switch(r.version=1,r.parentType){case void 0:case z.Foundation:{r.parentType=z.Foundation;const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz),r.rotation[2]!==0&&(r.rotation=[0,0,0]);break}case z.Cuboid:{const i=n.get(r.parentId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz*i.lz,r.rotation=Pi.getRotationOnCuboid(new le().fromArray(r.normal)),me.isEqual(0,r.rotation[0])&&r.rotation[2]!==0&&(r.rotation=[0,0,0]));break}case z.Wall:{r.normal=[0,-1,0],r.rotation=[Qt,0,0];break}case z.Roof:{if(r.foundationId){const i=n.get(r.foundationId);i&&(r.cx=r.cx*i.lx,r.cy=r.cy*i.ly,r.cz=r.cz+i.lz/2)}break}}}}})}}function Ad(t){return t.type===z.Foundation||t.type===z.Cuboid}Bpt();const M=$K()(V6t(J6t((t,e)=>{const n=me.isOpenFromURL(),o=new JSe,r=n?[]:o.getElements(),i=a=>t(JP(a));return{set:a=>{try{i(a)}catch(l){console.log(l)}},version:CC,world:o,elements:r,user:{},viewState:new qSe,actionState:new sTe,graphState:new uTe,solarPanelArrayLayoutParams:new QSe,solarPanelArrayLayoutConstraints:new mX,evolutionaryAlgorithmState:new oTe,economicsParams:new aTe,geneticAlgorithmWizardSelectedTab:"1",particleSwarmOptimizationWizardSelectedTab:"1",modelType:fa.UNKNOWN,modelAuthor:null,modelLabel:null,modelDescription:null,projectView:!1,projectState:{owner:null,title:null,description:null,type:Ri.SOLAR_PANEL_ARRAY,designs:new Array,ranges:new Array,filters:new Array,hiddenParameters:gd.getDefaultHiddenParameters(Ri.SOLAR_PANEL_ARRAY),counter:0,dataColoring:d9.ALL,selectedProperty:null,sortDescending:!1,xAxisNameScatterPlot:null,yAxisNameScatterPlot:null,dotSizeScatterPlot:5,thumbnailWidth:200},projectImages:new Map,designProjectType:null,notes:[],language:"en",floatingWindowOpacity:g0,selectedFloatingWindow:null,cloudFile:void 0,latestModelSite:void 0,modelSites:new Map,allModelSites:new Map,peopleModels:new Map,allPeopleModels:new Map,modelsMapLatitude:42.2844063,modelsMapLongitude:-71.3488548,modelsMapAddress:pG,modelsMapZoom:aje,modelsMapType:"roadmap",modelsMapTilt:0,showModelsAllTime:!0,showModelsFromDate:"2021-01-01",showModelsToDate:"2025-12-31",minimumNavigationMoveSpeed:3,minimumNavigationTurnSpeed:3,tempHumanPlant:[],ray:new l0,mouse:new Kt,fileChanged:!1,setNavigationView(a){i(l=>{l.viewState.navigationView=a,l.viewState.enableRotate=!a,a&&(l.viewState.orthographic=!1)})},set2DView(a){i(l=>{l.viewState.orthographic=a,l.viewState.enableRotate=!a,a&&(l.viewState.navigationView=!1)})},applyCount:0,setApplyCount(a){i(l=>{l.applyCount=a})},revertApply(){if(e().applyCount){for(let a=0;a{s.version=a.version,s.world=a.world,s.viewState=a.view,s.graphState=a.graphState??new uTe,s.elements=a.elements,s.notes=a.notes??[],s.animate24Hours=!!a.animate24Hours,s.modelType=a.modelType??fa.UNKNOWN,s.modelAuthor=a.modelAuthor??null,s.modelLabel=a.modelLabel??null,s.modelDescription=a.modelDescription??null,s.designProjectType=a.designProjectType??null,s.cloudFile=l,s.currentUndoable=void 0,s.actionInfo=void 0,s.sceneRadius=a.sceneRadius??100,s.updateSceneRadiusFlag=!s.updateSceneRadiusFlag,s.localContentToImportAfterCloudFileUpdate=void 0,s.fileChanged=!s.fileChanged,s.evolutionMethod=a.evolutionMethod??_s.GENETIC_ALGORITHM,s.solarPanelArrayLayoutParams=a.solarPanelArrayLayoutParams??new QSe,s.solarPanelArrayLayoutConstraints=a.solarPanelArrayLayoutConstraints??new mX,s.evolutionaryAlgorithmState=a.evolutionaryAlgorithmState??new oTe,s.economicsParams=a.economicsParams??new aTe,s.minimumNavigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.minimumNavigationTurnSpeed=a.minimumNavigationTurnSpeed??3,s.fittestIndividualResults.length=0,s.undoManager.clear(),s.deletedRoofId=null,s.autoDeletedRoofs=null,s.autoDeletedRoofIdSet.clear(),s.autoDeletedChild=null,s.deletedRoofIdSet.clear(),s.addedRoofIdSet.clear(),s.actionState=new sTe,s.multiSelectionsMode=!1,s.selectedElementIdSet.clear(),s.groupActionMode=!1,s.selectedFloatingWindow=null,s.customPvModules=a.customPvModules??{}}),Ken.updateOldFileData(),dt.getState().set(s=>{s.changed=!1,s.skipChange=!0,s.animateSun=!1,s.showSolarRadiationHeatmap=!1,s.showHeatFluxes=!1,s.simulationInProgress=!1,s.simulationPaused=!1,s.clearDailySimulationResultsFlag=!s.clearDailySimulationResultsFlag,s.clearYearlySimulationResultsFlag=!s.clearYearlySimulationResultsFlag,s.navigationMoveSpeed=a.minimumNavigationMoveSpeed??3,s.navigationTurnSpeed=a.minimumNavigationTurnSpeed??3}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},exportContent(){const a=e(),l=new Date,s=JSON.parse(JSON.stringify(a.elements));return me.fixElements(s),{docid:Gi.generate(),time:ul(l).format("MM/DD/YYYY hh:mm A"),timestamp:l.getTime(),userid:a.user.uid,owner:a.user.signFile?a.user.displayName:null,email:a.user.signFile?a.user.email:null,version:CC,world:JSON.parse(JSON.stringify(a.world)),elements:s,sceneRadius:a.sceneRadius,view:JSON.parse(JSON.stringify(a.viewState)),animate24Hours:a.animate24Hours,graphState:JSON.parse(JSON.stringify(a.graphState)),evolutionMethod:a.evolutionMethod,solarPanelArrayLayoutParams:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutParams)),solarPanelArrayLayoutConstraints:JSON.parse(JSON.stringify(a.solarPanelArrayLayoutConstraints)),evolutionaryAlgorithmState:JSON.parse(JSON.stringify(a.evolutionaryAlgorithmState)),economicsParams:JSON.parse(JSON.stringify(a.economicsParams)),modelType:a.modelType,modelAuthor:a.modelAuthor,modelLabel:a.modelLabel,modelDescription:a.modelDescription,designProjectType:a.designProjectType,notes:a.notes,minimumNavigationMoveSpeed:a.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:a.minimumNavigationTurnSpeed,customPvModules:JSON.parse(JSON.stringify(a.customPvModules))}},clearContent(){i(a=>{a.elements=[],a.sceneRadius=100}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},createEmptyFile(){i(a=>{JSe.resetWorldModel(a.world),qSe.resetViewState(a.viewState),a.version=CC,a.elements=[],a.sceneRadius=100,a.cloudFile=void 0,a.localContentToImportAfterCloudFileUpdate=void 0,a.notes=[],a.fileChanged=!a.fileChanged,a.currentUndoable=void 0,a.actionInfo=void 0,a.undoManager.clear(),a.modelType=fa.UNKNOWN,a.modelLabel=null,a.modelDescription=null,a.designProjectType=null,a.minimumNavigationMoveSpeed=3,a.minimumNavigationTurnSpeed=3,a.multiSelectionsMode=!1,a.selectedElementIdSet.clear(),a.groupActionMode=!1,a.selectedFloatingWindow=null,a.deletedRoofId=null,a.autoDeletedRoofs=null,a.autoDeletedRoofIdSet.clear(),a.autoDeletedChild=null,a.deletedRoofIdSet.clear(),a.addedRoofIdSet.clear(),a.customPvModules={},a.actionState.solarPanelModelName=R9}),dt.getState().set(a=>{a.changed=!1,a.skipChange=!0,a.animateSun=!1,a.showSolarRadiationHeatmap=!1,a.showHeatFluxes=!1}),Cn.getState().clearDataStore(),Cn.getState().clearRoofVerticesMap()},undoManager:new Gen,addUndoable(a){i(l=>{l.loggable&&(l.currentUndoable=a),l.undoManager.add(a)})},fittestIndividualResults:[],setFittestIndividualResults(a){i(l=>{l.fittestIndividualResults=[...a]})},variableLabels:[],setVariableLabels(a){i(l=>{l.variableLabels=[...a]})},aabb:new vf(new le(-10,-10,-10),new le(10,10,10)),animate24Hours:!1,evolutionMethod:_s.GENETIC_ALGORITHM,clickObjectType:null,contextMenuObjectType:null,hoveredHandle:null,moveHandleType:null,resizeHandleType:null,rotateHandleType:null,resizeAnchor:new le,selectedElement:null,getSelectedElement(){if(e().selectedElementIdSet.size===0)return null;const a=e().selectedElement;return a?e().elements.find(l=>l.id===a.id)??null:null},selectedElementIdSet:new Set,multiSelectionsMode:!1,findNearestSibling(a){let l=null;const s=e().getElementById(a);if(s){let c=Number.MAX_VALUE;for(const u of e().elements)if(u.type===s.type&&u.parentId===s.parentId&&u.id!==a){const d=s.cx-u.cx,f=s.cy-u.cy,p=s.cz-u.cz,g=d*d+f*f+p*p;c>g&&(c=g,l=u.id)}}return l},overlapWithSibling(a,l){let s=!1;if(l===void 0){const c=e().getParent(a);if(c){for(const u of e().elements)if(u.type===a.type&&u.parentId===a.parentId&&u.id!==a.id){if(a.type===z.SolarPanel){if(me.doSolarPanelsOverlap(a,u,c)){s=!0;break}}else if(Math.abs(a.cx-u.cx)*c.lx<.5*(a.lx+u.lx)&&Math.abs(a.cy-u.cy)*c.ly<.5*(a.ly+u.ly)&&Math.abs(a.cz-u.cz)*c.lz<.5*(a.lz+u.lz)){s=!0;break}}}}else{const c=l*l,u=e().getParent(a);for(const d of e().elements)if(d.type===a.type&&d.parentId===a.parentId&&d.id!==a.id){const f=(a.cx-d.cx)*(u?u.lx:1),p=(a.cy-d.cy)*(u?u.ly:1),g=(a.cz-d.cz)*(u?u.lz:1);if(f*f+p*p+g*gC.id===g);if(S){const C=new le(S.cx,S.cy,S.lz),P=new ln(0,0,S.rotation[2]),v=new le;switch(l){case Mt.UpperLeft:{v.fromArray(y.leftPoint).setZ(0);break}case Mt.UpperRight:{v.fromArray(y.rightPoint).setZ(0);break}}A.copy(v.applyEuler(P).add(C))}break}case z.Roof:{const y=e().elements.find(S=>S.id===g);if(y){const S=new le(y.cx,y.cy,y.lz),C=new ln(0,0,y.rotation[2]),P=new le(e().selectedElementX,e().selectedElementY).applyEuler(C).add(S);A.set(P.x,P.y,y.lz)}break}case z.Tree:{const y=e().elements.find(S=>S.id===g);if(y){const S=new le(y.cx,y.cy,y.cz+y.lz/2),C=new ln(0,0,y.rotation[2]);A.copy(new le(a.cx,a.cy,y.lz).applyEuler(C).add(S))}break}}return A},getElementById(a){const l=e().elements;for(const s of l)if(s.id===a)return s;return null},getParent(a){const l=e().elements;for(const s of l)if(s.id===a.parentId)return s;return null},getFoundation(a){const l=e().elements;for(const s of l)if(s.id===a.foundationId&&s.type===z.Foundation)return s;return null},selectNone(){i(a=>{a.selectedElementIdSet.clear();for(const l of a.elements)l.selected=!1;a.selectedElement=null}),kn.getState().selectNone()},selectMe(a,l,s,c){const u=kn.getState().setEnableOrbitController;l.intersections.length>0&&(l.intersections.filter(f=>!f.eventObject.name.startsWith("Wall Intersection Plane"))[0].object===l.eventObject||c)&&i(f=>{var p,g,A;for(const y of f.elements)if(y.id===a)if(y.selected=!0,f.selectedElement=y,f.selectedElementHeight=y.lz,f.groupActionMode){let S=y.foundationId??null;!S&&Ad(y)&&(S=me.getBaseId(y.id)),S&&(f.multiSelectionsMode||f.selectedElementIdSet.clear(),f.selectedElementIdSet.has(S)?f.selectedElementIdSet.delete(S):f.selectedElementIdSet.add(S))}else if(s===Xo.ContextMenu)if(f.selectedElementIdSet.has(a))for(const S of f.elements)f.selectedElementIdSet.has(S.id)&&S.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(S.id);else if(f.multiSelectionsMode){f.selectedElementIdSet.add(a);for(const S of f.elements)f.selectedElementIdSet.has(S.id)&&S.type!==f.selectedElement.type&&f.selectedElementIdSet.delete(S.id)}else f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a);else f.multiSelectionsMode?f.selectedElementIdSet.has(a)?f.selectedElementIdSet.delete(a):f.selectedElementIdSet.add(a):(f.selectedElementIdSet.clear(),f.selectedElementIdSet.add(a));else y.selected=!1;if(f.moveHandleType=null,f.resizeHandleType=null,f.rotateHandleType=null,f.contextMenuObjectType=null,s)switch(s){case Xo.Move:{((p=f.selectedElement)==null?void 0:p.type)===z.Tree||((g=f.selectedElement)==null?void 0:g.type)===z.Human?f.moveHandleType=zo.Default:f.moveHandleType=l.eventObject.name,u(!1);break}case Xo.Resize:{f.resizeHandleType=l.eventObject.name,u(!1);break}case Xo.Rotate:{f.rotateHandleType=l.eventObject.name,u(!1);break}case Xo.Select:{f.selectedElementAngle=((A=l.object.parent)==null?void 0:A.rotation.z)??0,u(!0);break}default:u(!0)}})},countHeatmapCells(){let a=0;return i(l=>{const s=l.world.solarRadiationHeatmapGridCellSize??.5,c=s*s;for(const u of l.elements)(u.type===z.Foundation||u.type===z.Cuboid)&&(a+=u.lx*u.ly/c)}),Math.round(a)},updateAllElementLocks(a){i(l=>{for(const s of l.elements)s.locked=a})},updateElementLockByFoundationId(a,l){i(s=>{for(const c of s.elements)(c.foundationId===a||c.parentId===a||c.id===a)&&(c.locked=l)})},updateElementLockByParentId(a,l,s){i(c=>{for(const u of c.elements)u.parentId===a&&l===u.type&&(u.locked=s)})},updateElementLockById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.locked=l;break}})},updateElementReferenceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.referenceId=l;break}})},updateElementLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.label=l;break}})},updateElementShowLabelById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.showLabel=l;break}})},updateElementColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.color=l;break}})},updateElementColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&me.isIdentical(d.normal,s)&&!d.locked&&(d.color=c)})},updateElementColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.color=s)})},updateElementColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.color=l)})},updateElementLineColorById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lineColor=l;break}})},updateElementLineColorOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&me.isIdentical(d.normal,s)&&!d.locked&&(d.lineColor=c)})},updateElementLineColorAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineColor=s)})},updateElementLineColorForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineColor=l)})},updateElementLineWidthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a){c.lineWidth=l;break}})},updateElementLineWidthOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)d.type===a&&d.parentId===l&&me.isIdentical(d.normal,s)&&!d.locked&&(d.lineWidth=c)})},updateElementLineWidthAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lineWidth=s)})},updateElementLineWidthForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lineWidth=l)})},updateElementCxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cx=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cy=l,c.type===z.SolarPanel&&c.parentType===z.Roof&&(s.updateElementOnRoofFlag=!0);break}})},updateElementCzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.cz=l;break}})},updateElementCzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cz=l)})},updateElementLxById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lx=l;break}})},updateElementLxAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lx=s)})},updateElementLxOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lx=c)}})},updateElementLxForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lx=l)})},updateElementLyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.ly=l;break}})},updateElementLyAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.ly=s)})},updateElementLyOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.ly=c)}})},updateElementLyForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.ly=l)})},updateElementLzById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){c.lz=l;break}})},updateElementLzAboveFoundation(a,l,s){i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&(u.lz=s)})},updateElementLzOnSurface(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.lz=c)}})},updateElementLzForAll(a,l){i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.lz=l)})},updateElementRotationById(a,l,s,c){i(u=>{for(const d of u.elements)(d.id===a&&!d.locked||d.parentId===a&&!C$e(d)&&d.type!==z.SolarPanel)&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);u.selectedElementAngle=c})},updateElementRotationForAll(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===a)d.locked||(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c);else{const f=u.getParent(d);f&&!f.locked&&f.type===a&&(d.rotation[0]=l,d.rotation[1]=s,d.rotation[2]=c)}})},updateSolarCollectorDrawSunBeamById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.drawSunBeam=l;break}})},updateSolarCollectorDrawSunBeamAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.drawSunBeam=s)})},updateSolarCollectorDrawSunBeamForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.locked||c.type===a&&(c.drawSunBeam=l)})},updateSolarCollectorRelativeAzimuthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.relativeAzimuth=l,s.selectedElementAngle=l;break}})},updateSolarCollectorRelativeAzimuthAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&!u.locked&&u.parentType!==z.Wall&&(u.relativeAzimuth=s)})},updateSolarCollectorRelativeAzimuthOnSurface(a,l,s,c){me.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(d.type===a&&!d.locked){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.relativeAzimuth=c)}})},updateSolarCollectorRelativeAzimuthForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&c.parentType!==z.Wall&&(c.relativeAzimuth=l)})},updateSolarCollectorXById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.cx=l;break}})},updateSolarCollectorXAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cx=s)})},updateSolarCollectorXForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cx=l)})},updateSolarCollectorYById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.cy=l;break}})},updateSolarCollectorYAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.cy=s)})},updateSolarCollectorYForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.cy=l)})},updateSolarCollectorPoleHeightById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.poleHeight=l;break}})},updateSolarCollectorPoleHeightAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleHeight=s)})},updateSolarCollectorPoleHeightOnSurface(a,l,s,c){me.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleHeight=c)}})},updateSolarCollectorPoleHeightForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleHeight=l)})},updateSolarCollectorPoleRadiusById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked&&me.isSolarCollector(c)){c.poleRadius=l;break}})},updateSolarCollectorPoleRadiusAboveFoundation(a,l,s){me.isSolarCollectorType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&u.type===a&&(u.poleRadius=s)})},updateSolarCollectorPoleRadiusOnSurface(a,l,s,c){me.isSolarCollectorType(a)&&i(u=>{for(const d of u.elements)if(!d.locked&&d.type===a){let f;s?f=d.parentId===l&&me.isIdentical(d.normal,s):f=d.parentId===l,f&&(d.poleRadius=c)}})},updateSolarCollectorPoleRadiusForAll(a,l){me.isSolarCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&!c.locked&&(c.poleRadius=l)})},clearAllSolarCollectorYields(){i(a=>{for(const l of a.elements)if(me.isSolarCollector(l)){const s=l;s.dailyYield=0,s.yearlyYield=0}})},updateSolarCollectorDailyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isSolarCollector(c)){c.dailyYield=l;break}})},updateSolarCollectorYearlyYieldById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isSolarCollector(c)){c.yearlyYield=l;break}})},updateCspReflectanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isCspCollector(c)){c.reflectance=l;break}})},updateCspReflectanceAboveFoundation(a,l,s){me.isCspCollectorType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.reflectance=s)})},updateCspReflectanceForAll(a,l){me.isCspCollectorType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.reflectance=l)})},updateParabolicCollectorAbsorptanceById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isParabolicCollector(c)){c.absorptance=l;break}})},updateParabolicCollectorAbsorptanceAboveFoundation(a,l,s){me.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.absorptance=s)})},updateParabolicCollectorAbsorptanceForAll(a,l){me.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.absorptance=l)})},updateParabolicCollectorOpticalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isParabolicCollector(c)){c.opticalEfficiency=l;break}})},updateParabolicCollectorOpticalEfficiencyAboveFoundation(a,l,s){me.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.opticalEfficiency=s)})},updateParabolicCollectorOpticalEfficiencyForAll(a,l){me.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.opticalEfficiency=l)})},updateParabolicCollectorThermalEfficiencyById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&me.isParabolicCollector(c)){c.thermalEfficiency=l;break}})},updateParabolicCollectorThermalEfficiencyAboveFoundation(a,l,s){me.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.type===a&&u.foundationId===l&&(u.thermalEfficiency=s)})},updateParabolicCollectorThermalEfficiencyForAll(a,l){me.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.type===a&&(c.thermalEfficiency=l)})},foundationActionScope:re.OnlyThisObject,setFoundationActionScope(a){i(l=>{l.foundationActionScope=a})},cuboidActionScope:re.OnlyThisObject,setCuboidActionScope(a){i(l=>{l.cuboidActionScope=a})},polygonActionScope:re.OnlyThisObject,setPolygonActionScope(a){i(l=>{l.polygonActionScope=a})},updatePolygonVertexPositionById(a,l,s,c){i(u=>{for(const d of u.elements)if(d.type===z.Polygon&&d.id===a){const f=d;l>=0&&l{for(const c of s.elements)if(c.type===z.Polygon&&c.id===a){const u=c;u.vertices=l;break}})},solarWaterHeaterActionScope:re.OnlyThisObject,setSolarWaterHeaterActionScope(a){i(l=>{l.solarWaterHeaterActionScope=a})},solarPanelActionScope:re.OnlyThisObject,setSolarPanelActionScope(a){i(l=>{l.solarPanelActionScope=a})},updateSolarPanelTiltAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.SolarPanel&&c.id===a&&!c.locked){const u=c;u.tiltAngle=l;break}})},setSolarPanelOrientation(a,l,s){if(a.orientation=s,a.orientation===vr.portrait){const c=Math.max(1,Math.round(a.lx/l.width)),u=Math.max(1,Math.round(a.ly/l.length));a.lx=c*l.width,a.ly=u*l.length}else{const c=Math.max(1,Math.round(a.lx/l.length)),u=Math.max(1,Math.round(a.ly/l.width));a.lx=c*l.length,a.ly=u*l.width}},parabolicTroughActionScope:re.OnlyThisObject,setParabolicTroughActionScope(a){i(l=>{l.parabolicTroughActionScope=a})},fresnelReflectorActionScope:re.OnlyThisObject,setFresnelReflectorActionScope(a){i(l=>{l.fresnelReflectorActionScope=a})},heliostatActionScope:re.OnlyThisObject,setHeliostatActionScope(a){i(l=>{l.heliostatActionScope=a})},updateSolarReceiverById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.Heliostat){c.towerId=l;break}else if(c.type===z.FresnelReflector){c.receiverId=l;break}}})},updateSolarReceiverAboveFoundation(a,l,s){me.isHeliostatOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.Heliostat?u.towerId=s:u.type===z.FresnelReflector&&(u.receiverId=s))})},updateSolarReceiverForAll(a,l){me.isHeliostatOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.Heliostat?c.towerId=l:c.type===z.FresnelReflector&&(c.receiverId=l))})},parabolicDishActionScope:re.OnlyThisObject,setParabolicDishActionScope(a){i(l=>{l.parabolicDishActionScope=a})},updateModuleLengthById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){if(c.type===z.ParabolicTrough){c.moduleLength=l;break}else if(c.type===z.FresnelReflector){c.moduleLength=l;break}}})},updateModuleLengthAboveFoundation(a,l,s){me.isParabolicTroughOrFresnelReflector(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.FresnelReflector)&&(u.moduleLength=s)})},updateModuleLengthForAll(a,l){me.isParabolicTroughOrFresnelReflector(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.FresnelReflector)&&(c.moduleLength=l)})},updateParabolaLatusRectumById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&!c.locked){(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l);break}})},updateParabolaLatusRectumAboveFoundation(a,l,s){me.isParabolaType(a)&&i(c=>{for(const u of c.elements)u.foundationId===l&&!u.locked&&(u.type===z.ParabolicTrough||u.type===z.ParabolicDish)&&(u.latusRectum=s)})},updateParabolaLatusRectumForAll(a,l){me.isParabolaType(a)&&i(s=>{for(const c of s.elements)c.locked||(c.type===z.ParabolicTrough||c.type===z.ParabolicDish)&&(c.latusRectum=l)})},windTurbineActionScope:re.OnlyThisObject,setWindTurbineActionScope(a){i(l=>{l.windTurbineActionScope=a})},wallActionScope:re.OnlyThisObject,setWallActionScope(a){i(l=>{l.wallActionScope=a})},roofActionScope:re.OnlyThisObject,setRoofActionScope(a){i(l=>{l.roofActionScope=a})},windowActionScope:re.OnlyThisObject,setWindowActionScope(a){i(l=>{l.windowActionScope=a})},doorActionScope:re.OnlyThisObject,setDoorActionScope(a){i(l=>{l.doorActionScope=a})},updateWallRelativeAngleById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.relativeAngle=l;break}})},updateWallLeftJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.leftJoints=l;break}})},updateWallRightJointsById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a){c.rightJoints=l;break}})},updateWallLeftPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.leftPoint=[...l];break}})},updateWallRightPointById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Wall&&c.id===a&&!c.locked){c.rightPoint=[...l];break}})},updateRoofRiseById(a,l,s){i(c=>{for(const u of c.elements)if(u.id===a&&u.type===z.Roof){u.rise=l,c.actionState.roofRise=l,s!==void 0&&(c.selectedElementHeight=s);break}})},updateRoofStructureById(a,l){i(s=>{for(const c of s.elements)if(c.id===a&&c.type===z.Roof){const u=c;u.roofStructure=l;break}})},updateInsideLightById(a,l){i(s=>{for(const c of s.elements)if(c.type===z.Light&&c.id===a){c.inside=l;break}})},updateInsideLightsByParentId(a,l){i(s=>{for(const c of s.elements)c.parentId===a&&c.type===z.Light&&(c.inside=l)})},setElementPosition(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].cx=l,u.elements[d].cy=s,c!==void 0&&(u.elements[d].cz=c);break}})},setElementNormal(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a||f.parentId===a){const p=u.elements[d];p.normal[0]=l,p.normal[1]=s,p.normal[2]=c}})},setElementSize(a,l,s,c){i(u=>{for(const[d,f]of u.elements.entries())if(f.id===a){u.elements[d].lx=l,u.elements[d].ly=s,c&&(u.elements[d].lz=c,u.selectedElementHeight=c);break}})},actionModeLock:!1,objectTypeToAdd:z.None,addElement(a,l,s){let c=null;const u="id"in a?a.id:Zo;return i(d=>{switch(d.objectTypeToAdd){case z.Human:{const f=new le().copy(l);if(u!==Zo){const{rot:g,pos:A}=me.getWorldDataById(u);f.sub(new le(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeHuman(d.actionState.humanName,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Tree:{const f=new le().copy(l);if(u!==Zo){const{rot:g,pos:A}=me.getWorldDataById(u);f.sub(new le(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeTree(d.actionState.treeType,d.actionState.treeSpread,d.actionState.treeHeight,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Flower:{const f=new le().copy(l);if(u!==Zo){const{rot:g,pos:A}=me.getWorldDataById(u);f.sub(new le(A.x,A.y,A.z)).applyEuler(new ln(0,0,-g))}const p=Va.makeFlower(d.actionState.flowerType,u,f.x,f.y,f.z);c=p,d.elements.push(p);break}case z.Polygon:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makePolygon(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,f.type);c=g,d.elements.push(g);break}case z.Sensor:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeSensor(f,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=g,d.elements.push(g);break}case z.Light:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeLight(f,2,d.actionState.lightDistance,d.actionState.lightIntensity,d.actionState.lightColor,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0);c=g,d.elements.push(g);break}case z.SolarPanel:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f,!0);let g=d.getPvModule(d.actionState.solarPanelModelName??R9);g||(g=d.getPvModule(R9));const A=Va.makeSolarPanel(f,g,p.x,p.y,p.z,d.actionState.solarPanelOrientation??vr.landscape,d.actionState.solarPanelPoleHeight??1,d.actionState.solarPanelPoleSpacing??3,d.actionState.solarPanelTiltAngle??0,d.actionState.solarPanelRelativeAzimuth??0,s,[0,0,0],d.actionState.solarPanelFrameColor??"white");c=A,d.elements.push(A);break}case z.ParabolicTrough:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeParabolicTrough(f,d.actionState.parabolicTroughReflectance,d.actionState.parabolicTroughAbsorptance,d.actionState.parabolicTroughOpticalEfficiency,d.actionState.parabolicTroughThermalEfficiency,d.actionState.parabolicTroughLatusRectum,d.actionState.parabolicTroughPoleHeight,d.actionState.parabolicTroughModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicTroughWidth);c=g,d.elements.push(g);break}case z.ParabolicDish:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeParabolicDish(f,d.actionState.parabolicDishReflectance,d.actionState.parabolicDishAbsorptance,d.actionState.parabolicDishOpticalEfficiency,d.actionState.parabolicDishThermalEfficiency,d.actionState.parabolicDishLatusRectum,d.actionState.parabolicDishPoleHeight,d.actionState.parabolicDishReceiverStructure,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.parabolicDishRimDiameter,d.actionState.parabolicDishRimDiameter);c=g,d.elements.push(g);break}case z.FresnelReflector:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeFresnelReflector(f,d.actionState.fresnelReflectorReceiver,d.actionState.fresnelReflectorReflectance,d.actionState.fresnelReflectorPoleHeight,d.actionState.fresnelReflectorModuleLength,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.fresnelReflectorWidth);c=g,d.elements.push(g);break}case z.Heliostat:{const f=a,p=me.relativeCoordinates(l.x,l.y,l.z,f),g=Va.makeHeliostat(f,d.actionState.heliostatTower,d.actionState.heliostatReflectance,d.actionState.heliostatPoleHeight,p.x,p.y,p.z,s,"rotation"in a?a.rotation:void 0,d.actionState.heliostatLength,d.actionState.heliostatWidth);c=g,d.elements.push(g);break}case z.WindTurbine:{const f=a,p=me.relativeCoordinates(l.x,l.y,0,f),g=Va.makeWindTurbine(f,d.actionState.windTurbineBirdSafeDesign??uc.None,d.actionState.windTurbineBladeColor??t9,d.actionState.windTurbineStripeColor??n9,d.actionState.windTurbineNumberOfBlades??3,d.actionState.windTurbineInitialRotorAngle??0,d.actionState.windTurbineRelativeYawAngle??0,d.actionState.windTurbinePitchAngle??Math.PI/18,d.actionState.windTurbineBladeRadius??10,d.actionState.windTurbineBladeRootRadius??.3,d.actionState.windTurbineBladeMaximumChordLength??1,d.actionState.windTurbineBladeMaximumChordRadius??3,d.actionState.windTurbineTowerRadius??.5,d.actionState.windTurbineTowerHeight??20,d.actionState.windTurbineHubRadius??.75,d.actionState.windTurbineHubLength??1.5,p.x,p.y,0);c=g,d.elements.push(g);break}case z.Foundation:{const f=Va.makeFoundation(l.x,l.y,d.actionState.foundationHeight,d.actionState.foundationColor,d.actionState.foundationTexture);c=f,d.elements.push(f);break}case z.Cuboid:{const f=Va.makeCuboid(l.x,l.y,d.actionState.cuboidHeight,d.actionState.cuboidFaceColors,d.actionState.cuboidFaceTextures);c=f,d.elements.push(f);break}case z.Wall:{const f=a,p=me.wallRelativePosition(new le(l.x,l.y),f),g=Va.makeWall(f,p.x,p.y,p.z,s);d.elements.push(g),d.selectedElement=g,c=g;break}}c&&(d.selectedElementIdSet.clear(),d.selectedElementIdSet.add(c.id),d.selectedElement=c)}),c},elementsToPaste:[],deletedElements:[],clearDeletedElements(){i(a=>{a.deletedElements=[]})},pastePoint:new le,pasteNormal:void 0,copyElementById(a){i(l=>{l.elementsToPaste=[];for(const s of l.elements)if(s.id===a){if(s.type===z.Polygon){const c=me.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y,l.elementsToPaste.push(s)}else l.elementsToPaste.push(s);break}for(const s of l.elements)if(me.isChild(a,s.id)){if(s.type===z.Polygon){const c=me.calculatePolygonCentroid(s.vertices);s.cx=c.x,s.cy=c.y}l.elementsToPaste.push(s)}})},removeSelectedElements(){const a=e().selectedElementIdSet;if(a.size===0)return[];const l=Array.from(a),s=new Set,c=new Set;for(const u of e().elements)if(a.has(u.id))s.add(u),c.add(u.id);else for(const d of l)me.isChild(d,u.id)&&(s.add(u),c.add(u.id));return i(u=>{u.autoDeletedRoofs=[],u.deletedElements=Array.from(s),u.elements=u.elements.filter(d=>{var f,p;if(c.has(d.id)){switch(d.type){case z.Wall:{const g=d;let A="",y="";g.leftJoints.length>0&&(A=((f=u.getElementById(g.leftJoints[0]))==null?void 0:f.id)??""),g.rightJoints.length>0&&(y=((p=u.getElementById(g.rightJoints[0]))==null?void 0:p.id)??"");for(const S of u.elements)S.id===A?S.rightJoints=[]:S.id===y&&(S.leftJoints=[]);u.updateWallMapOnFoundationFlag=!u.updateWallMapOnFoundationFlag;break}case z.Roof:{u.deletedRoofIdSet.add(d.id),Cn.getState().deleteRoofSegmentVertices(d.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(d.id);break}}return!1}else return!0})}),Array.from(s)},removeElementById(a,l,s=!0,c){const u=e().elements.filter(d=>d.id===a||me.isChild(a,d.id));return i(d=>{var f,p;for(const g of d.elements)if(g.id===a){if(l)if(g.type===z.Polygon){const A=me.calculatePolygonCentroid(g.vertices);g.cx=A.x,g.cy=A.y,d.elementsToPaste=[g]}else d.elementsToPaste=[g];else c||(d.deletedElements=[g]);switch(g.selected=!1,g.type){case z.Roof:{const A=g;d.deletedRoofId=g.id,d.deletedRoofIdSet.add(g.id),Cn.getState().deleteRoofSegmentVertices(a),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(a),c&&(d.autoDeletedRoofs?d.autoDeletedRoofs.push(A):d.autoDeletedRoofs=[A],d.autoDeletedRoofIdSet.add(A.id));break}case z.Wall:{const A=g;let y="",S="";A.leftJoints.length>0&&(y=((f=d.getElementById(A.leftJoints[0]))==null?void 0:f.id)??""),A.rightJoints.length>0&&(S=((p=d.getElementById(A.rightJoints[0]))==null?void 0:p.id)??"");for(const C of d.elements)C.id===y?C.rightJoints=[]:C.id===S&&(C.leftJoints=[]);d.elements=d.elements.filter(C=>!(C.type===z.Roof&&C.wallsId.length===0)),d.updateWallMapOnFoundationFlag=!d.updateWallMapOnFoundationFlag,d.deletedWallId=g.id;break}case z.Foundation:{d.deletedFoundationId=g.id;break}case z.Cuboid:{d.deletedCuboidId=g.id;break}}break}if(c)for(const g of d.elements)me.isChild(a,g.id)&&(d.autoDeletedChild?d.autoDeletedChild.push(g):d.autoDeletedChild=[g]);else if(l)for(const g of d.elements)me.isChild(a,g.id)&&d.elementsToPaste.push(g);else for(const g of d.elements)me.isChild(a,g.id)&&d.deletedElements.push(g);d.elements=d.elements.filter(g=>g.id===a||g.parentId===a||g.foundationId===a||me.isChild(a,g.id)?(g.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(a),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(a)),!1):!0),d.selectedElementIdSet.delete(a),s&&(d.selectedElement=null,d.selectedElementIdSet.clear())}),u},removeElementsByType(a){i(l=>{a===z.Foundation?l.elements=l.elements.filter(s=>s.locked||s.type!==z.Foundation&&!s.foundationId?!0:(s.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(s.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1)):l.elements=l.elements.filter(s=>s.locked||s.type!==a?!0:(s.type===z.Roof&&(Cn.getState().deleteRoofSegmentVertices(s.id),Cn.getState().deleteRoofSegmentVerticesWithoutOverhang(s.id)),!1))})},countElementsByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===a&&!c.locked&&s++;else for(const c of e().elements)c.type===a&&s++;return s},countSolarStructuresByType(a,l){let s=0;if(l)for(const c of e().elements)c.type===z.Foundation&&!c.locked&&c.solarStructure===a&&s++;else for(const c of e().elements)c.type===z.Foundation&&c.solarStructure===a&&s++;return s},countObservers(){let a=0;for(const l of e().elements)l.type===z.Human&&l.observer&&a++;return a},removeElementsByReferenceId(a,l){i(s=>{if(l){s.deletedElements=[];for(const c of s.elements)c.referenceId===a&&s.deletedElements.push(c)}s.elements=s.elements.filter(c=>c.referenceId!==a)})},countElementsByReferenceId(a){let l=0;for(const s of e().elements)s.referenceId===a&&l++;return l},getChildren(a){const l=[];for(const s of e().elements)s.parentId===a&&l.push(s);return l},getChildrenOfType(a,l){const s=[];for(const c of e().elements)c.type===a&&c.parentId===l&&s.push(c);return s},removeAllChildElementsByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.parentId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},removeAllElementsOnFoundationByType(a,l){i(s=>{s.elements=s.elements.filter(c=>c.locked||c.type!==l||c.foundationId!==a),l===z.Wall&&(s.updateWallMapOnFoundationFlag=!s.updateWallMapOnFoundationFlag)})},countAllElements(a){let l=0;if(a)for(const s of e().elements)s.locked||l++;else l=e().elements.length;return l},countAllElementsByType(a){const l=new ZSe;for(const s of e().elements)if(s.locked?l.lockedCount++:l.unlockedCount++,!(a&&s.locked))switch(s.type){case z.Foundation:{s.solarStructure===Dn.UpdraftTower&&l.solarUpdraftTowerCount++,l.foundationCount++;break}case z.Cuboid:{l.cuboidCount++;break}case z.Wall:{l.wallCount++;break}case z.Window:{l.windowCount++;break}case z.Door:{l.doorCount++;break}case z.Human:{l.humanCount++;break}case z.Tree:{l.treeCount++;break}case z.Flower:{l.flowerCount++;break}case z.Polygon:{l.polygonCount++;break}case z.Sensor:{l.sensorCount++;break}case z.Light:{s.inside?l.insideLightCount++:l.outsideLightCount++;break}case z.SolarPanel:{l.solarPanelCount++;const c=s,u=e().getPvModule(c.pvModelName);u&&(l.solarPanelModuleCount+=me.countSolarPanelsOnRack(c,u));break}case z.ParabolicDish:{l.parabolicDishCount++;break}case z.ParabolicTrough:{l.parabolicTroughCount++;break}case z.FresnelReflector:{l.fresnelReflectorCount++;break}case z.Heliostat:{l.heliostatCount++;break}case z.WindTurbine:{l.windTurbineCount++;break}}return l},countAllOffspringsByTypeAtOnce(a,l){const s=new ZSe;for(const c of e().elements){const u=c.parentId===a||c.foundationId===a;if(u&&(c.locked?s.lockedCount++:s.unlockedCount++),(l||!c.locked)&&u)switch(c.type){case z.Foundation:{c.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTowerCount++,s.foundationCount++;break}case z.Cuboid:{s.cuboidCount++;break}case z.Wall:{s.wallCount++;break}case z.Window:{s.windowCount++,c.locked&&s.lockedWindowCount++;break}case z.Door:{s.doorCount++,c.locked&&s.lockedDoorCount++;break}case z.Human:{s.humanCount++;break}case z.Tree:{s.treeCount++;break}case z.Flower:{s.flowerCount++;break}case z.Polygon:{s.polygonCount++,c.locked&&s.lockedPolygonCount++;break}case z.Sensor:{s.sensorCount++,c.locked&&s.lockedSensorCount++;break}case z.Light:{c.inside?s.insideLightCount++:s.outsideLightCount++,c.locked&&s.lockedLightCount++;break}case z.SolarPanel:{s.solarPanelCount++,c.locked&&s.lockedSolarPanelCount++;const d=c,f=e().getPvModule(d.pvModelName);f&&(s.solarPanelModuleCount+=me.countSolarPanelsOnRack(d,f));break}case z.ParabolicDish:{s.parabolicDishCount++;break}case z.ParabolicTrough:{s.parabolicTroughCount++;break}case z.FresnelReflector:{s.fresnelReflectorCount++;break}case z.Heliostat:{s.heliostatCount++;break}case z.WindTurbine:{s.windTurbineCount++,c.locked&&s.lockedWindTurbineCount++;break}}}return s},countSolarPanelsOnRack(a){let l=0;for(const s of e().elements)if(s.id===a&&s.type===z.SolarPanel){const c=s,u=e().getPvModule(c.pvModelName);if(u){l=me.countSolarPanelsOnRack(c,u);break}}return l},copyCutElements(){const a=[],l=new Map,s=new Map,c=new Map;for(let u=0;ug.id===d.parentId);if(p){const g=l.get(p.id);g&&(e().getElementById(d.id)?(f=Dl.clone(g,d,d.cx,d.cy,d.cz,d.type===z.Polygon),((f==null?void 0:f.type)===z.SolarPanel||(f==null?void 0:f.type)===z.SolarWaterHeater)&&(f.rotation=[...d.rotation],f.normal=[...d.normal])):f=JSON.parse(JSON.stringify(d)))}}f&&(l.set(d.id,f),s.set(d.id,f.id),c.set(f.id,d.id),a.push(f))}for(const u of a){if(u.type===z.Roof){const d=c.get(u.id);if(d)for(const f of e().elementsToPaste)f.id===d&&(u.wallsId=f.wallsId.map(p=>s.get(p)))}if(u.type===z.Wall){const d=c.get(u.id);if(d){for(const f of e().elementsToPaste)if(f.id===d&&f.type===z.Wall){const p=f,g=s.get(p.leftJoints[0]);g&&(u.leftJoints=[g]);const A=s.get(p.rightJoints[0]);if(A&&(u.rightJoints=[A]),p.roofId){const y=s.get(p.roofId);y&&(u.roofId=y)}break}}}}return a},pasteElementsToPoint(){const a=[];return i(l=>{if(l.elementsToPaste.length===1){let s=l.pastePoint;const c=l.elementsToPaste[0];let u=l.selectedElement;const d=l.getParent(c);if(u){if(u.type===z.Polygon){const p=l.getParent(u);p&&(u=p,c.parentId=u.id,me.isPositionRelative(c.type)&&(s=me.relativeCoordinates(s.x,s.y,s.z,u)))}else if(u.type===z.Roof){if(u.parentId){const p=l.getElementById(u.parentId);p&&(c.type===z.SolarPanel||c.type===z.SolarWaterHeater?s.sub(new le(p.cx,p.cy,p.cz)).applyEuler(new ln(0,0,-p.rotation[2])):(s.sub(new le(p.cx,p.cy,p.lz)).applyEuler(new ln(0,0,-p.rotation[2])),c.type!==z.Window&&(s.setX(s.x/p.lx),s.setY(s.y/p.ly))))}}else if(u.type===z.Cuboid){if(c.type===z.Cuboid){const{pos:p}=me.getWorldDataById(u.id);s.sub(p)}else me.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=me.relativeCoordinates(s.x,s.y,s.z,u,!0):s=me.relativeCoordinates(s.x,s.y,s.z,u));c.parentId=u.id}else u.type===z.Wall?s=me.relativeCoordinates(s.x,s.y,s.z,u):d&&d.type&&c.type!==z.Foundation&&(c.parentId=u.id,me.isPositionRelative(c.type)&&(c.type===z.SolarPanel?s=me.relativeCoordinates(s.x,s.y,s.z,u,!0):s=me.relativeCoordinates(s.x,s.y,s.z,u)));c.type===z.Wall&&s.set(s.x*u.lx,s.y*u.ly,0)}const f=Dl.clone(u,c,s.x,s.y,s.z,!1,l.pasteNormal,d);if(f){l.pasteNormal&&(u==null?void 0:u.type)===z.Cuboid&&(f.normal=l.pasteNormal.toArray(),f.rotation=bn.getRotationFromNormal(l.pasteNormal));const p={lng:l.language};let g=!1;switch(f.type){case z.Cuboid:{const A=C=>{const P=[];for(const v of e().elements)if(v.parentId===C.id)switch(P.push(v),v.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:P.push(...A(v))}return P},y=A(c),S=new Map;a.push(f),S.set(c.id,f);for(const C of y){const P=S.get(C.parentId);if(P){const v=Dl.clone(P,C,C.cx,C.cy,C.cz,C.type===z.Polygon);v&&(f.normal&&(v.normal=[...C.normal]),a.push(v),S.set(C.id,v))}}l.elements.push(...a),l.elementsToPaste=[f],g=!1;break}case z.Foundation:{const A=new Map,y=new Map;for(const S of l.elements)if(S.parentId===c.id){const C=Dl.clone(f,S,S.cx,S.cy,S.cz,S.type===z.Polygon);if(C&&(f.normal&&(C.normal=[...S.normal]),a.push(C),(C==null?void 0:C.type)===z.Wall||(C==null?void 0:C.type)===z.Roof)){A.set(C.id,S.id),y.set(S.id,C.id);for(const P of l.elements)if(P.parentId===S.id){const v=Dl.clone(C,P,P.cx,P.cy,P.cz);v&&(S.normal&&(v.normal=[...P.normal]),a.push(v))}}}l.elements.push(...a),g=!0;for(const S of l.elements){if(S.type===z.Roof){const C=A.get(S.id);if(C){const P=e().getElementById(C);P&&(S.wallsId=P.wallsId.map(v=>y.get(v)))}}if(S.type===z.Wall){const C=A.get(S.id);if(C){for(const P of l.elements)if(P.id===C&&P.type===z.Wall){const v=P,T=y.get(v.leftJoints[0]);T&&(S.leftJoints=[T]);const w=y.get(v.rightJoints[0]);if(w&&(S.rightJoints=[w]),v.roofId){const x=y.get(v.roofId);x&&(S.roofId=x)}break}}}}break}case z.SolarPanel:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(me.checkElementOnWallState(f,u)){case pa.Valid:{const A=u.relativeAngle-Qt;f.normal=[Math.cos(A),Math.sin(A),0],g=!0;break}case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarPanelVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(Y.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&me.isIdentical(f.normal,as))&&me.isSolarCollector(f)?(g=me.isSolarCollectorWithinHorizontalSurface(f,u),g||co(Y.t("message.CannotPasteOutsideBoundary",p))):g=!0;break}case z.SolarWaterHeater:{if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarWaterHeaterVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}break}case z.Sensor:case z.Light:case z.WindTurbine:case z.ParabolicDish:case z.Heliostat:case z.FresnelReflector:case z.ParabolicTrough:{if((u==null?void 0:u.type)===z.Wall){if(u)switch(me.checkElementOnWallState(f,u)){case pa.Valid:{const A=u.relativeAngle-Qt;f.normal=[Math.cos(A),Math.sin(A),0],g=!0;break}case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}break}if(u&&u.type===z.Roof){if(f.foundationId){const A=l.getElementById(f.foundationId);if(A){const y=bn.getSolarPanelVerticesOnRoof(f,A),S=bn.getRoofBoundaryVertices(u);if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopElementCollisionCheck(f,A,y)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0,l.updateElementOnRoofFlag=!0}}break}l.overlapWithSibling(f)?co(Y.t("message.CannotPasteBecauseOfOverlap",p)):u&&(u.type===z.Foundation||u.type===z.Cuboid&&me.isIdentical(f.normal,as))&&me.isSolarCollector(f)?(g=me.isSolarCollectorWithinHorizontalSurface(f,u),g||co(Y.t("message.CannotPasteOutsideBoundary",p))):g=!0;break}case z.Wall:{const A=new le(f.cx,f.cy,0),y=new le(f.lx/2,0,0),S=new le(-f.lx/2,0,0),C=f,P=new ln(0,0,C.relativeAngle);C.leftPoint=A.clone().add(S.applyEuler(P)).toArray(),C.rightPoint=A.clone().add(y.applyEuler(P)).toArray(),C.roofId=void 0,C.leftRoofHeight=void 0,C.rightRoofHeight=void 0,C.centerLeftRoofHeight=void 0,C.centerRightRoofHeight=void 0,C.centerRoofHeight=void 0;for(const v of l.elements)if(v.parentId===c.id){const T=Dl.clone(f,v,v.cx,v.cy,v.cz,v.type===z.Polygon);T&&(f.normal&&(T.normal=[...v.normal]),a.push(T))}l.elements.push(...a),l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,g=!0;break}case z.Door:case z.Window:{if((u==null?void 0:u.type)===z.Wall)switch(me.checkElementOnWallState(f,u)){case pa.Valid:g=!0;break;case pa.OverLap:co(Y.t("message.CannotPasteBecauseOfOverlap",p));break;case pa.OutsideBoundary:co(Y.t("message.CannotPasteOutsideBoundary",p));break}else if((u==null?void 0:u.type)===z.Roof){const A=bn.getRotationOnRoof(u.id,s);A&&(f.rotation=[...A]);const y=bn.getWindowVerticesOnRoof(f),S=bn.getRoofSegmentBoundary(u.id,s);if(!S)break;if(!bn.rooftopElementBoundaryCheck(y,S)){co(Y.t("message.CannotPasteOutsideBoundary",p));break}if(!bn.rooftopWindowCollisionCheck(f.id,y,u.id)){co(Y.t("message.CannotPasteBecauseOfOverlap",p));break}g=!0}break}default:if(g=!0,me.isPlantOrHuman(f))if(u){const A=l.getParent(f);if(A){const y=me.relativePoint(l.pastePoint,A);f.cx=y.x,f.cy=y.y,f.cz=y.z}}else f.parentId=Zo}g&&(l.elements.push(f),a.push(f))}}else if(l.elementsToPaste.length>1){let s=l.pastePoint;const c=l.copyCutElements();if(c.length>0){if(c[0].type===z.Cuboid){const u=l.selectedElement;if(u&&u.type===z.Cuboid){const{pos:d}=me.getWorldDataById(u.id);s.sub(d),c[0].parentId=u.id}}else if(c[0].type===z.Wall){const u=l.selectedElement;u&&u.type===z.Foundation&&(s=me.relativeCoordinates(s.x,s.y,s.z,u),s.set(s.x*u.lx,s.y*u.ly,0),c[0].parentId=u.id,c[0].foundationId=u.id)}c[0].cx=s.x,c[0].cy=s.y,c[0].cz=s.z,c[0].type===z.Foundation?c[0].cz+=c[0].lz/2:c[0].type===z.Cuboid&&(c[0].cz=c[0].lz/2),l.elements.push(...c),a.push(...c)}}a.length>0&&(l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(a[0].id),l.selectedElement=a[0])}),a},pasteElementsByKey(){const a=[];return i(l=>{if(l.elementsToPaste.length>0){const s=l.elementsToPaste[0],c=l.getParent(s),u=Dl.clone(c,s,s.cx,s.cy,s.cz);if(u){let d=!1;switch(u.type){case z.Door:case z.Window:{if(c){const f=u.lx/2;if(u.cx+=f*3,c.type===z.Wall)for(;u.cx+f<.5;)if(me.checkElementOnWallState(u,c)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=f;else if(c.type===z.Roof){const p=bn.getRotationOnRoof(c.id,new le(u.cx,u.cy));p&&(u.rotation=[...p]);let g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new le(u.cx,u.cy));const y=bn.getRoofBoundaryVertices(c);for(;bn.rooftopElementBoundaryCheck(g,y);)if(A&&bn.rooftopElementBoundaryCheck(g,A)&&bn.rooftopWindowCollisionCheck(u.id,g,c.id)){l.elements.push(u),d=!0;break}else{u.cx+=f/2;const S=bn.getRotationOnRoof(c.id,new le(u.cx,u.cy));S&&(u.rotation=[...S]),g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new le(u.cx,u.cy))}}if(!d){u.cx=s.cx-f*3;const p=bn.getRotationOnRoof(c.id,new le(u.cx,u.cy));if(p&&(u.rotation=[...p]),c.type===z.Wall){for(;u.cx-f>-.5;)if(c.type===z.Wall)if(me.checkElementOnWallState(u,c)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx-=f}else if(c.type===z.Roof){let g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new le(u.cx,u.cy));const y=bn.getRoofBoundaryVertices(c);for(;bn.rooftopElementBoundaryCheck(g,y);)if(A&&bn.rooftopElementBoundaryCheck(g,A)&&bn.rooftopWindowCollisionCheck(u.id,g,c.id)){l.elements.push(u),d=!0;break}else{u.cx-=f;const S=bn.getRotationOnRoof(c.id,new le(u.cx,u.cy));S&&(u.rotation=[...S]),g=bn.getWindowVerticesOnRoof(u),A=bn.getRoofSegmentBoundary(c.id,new le(u.cx,u.cy))}}}if(!d){const p={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",p))}c.type===z.Roof&&d&&(l.updateElementOnRoofFlag=!0)}break}case z.Human:{u.cx+=1,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.Tree:case z.Flower:{u.cx+=u.lx,l.elements.push(u),l.elementsToPaste=[u],d=!0;break}case z.SolarPanel:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const A=u.lx/f.lx/2;for(u.cx+=A*3;u.cx+A<.5;)if(me.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=A;if(!d)for(u.cx=s.cx-A*3;u.cx-A>-.5;)if(me.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=A;if(!d){const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}break}else if(f.type===z.Roof){if(s.foundationId){const A=l.getElementById(s.foundationId);if(A){const y=bn.getRoofBoundaryVertices(f),S=u.lx*1.25;for(u.cx+=S;u.cx+u.lx/2-A.lx/2;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx-=S}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",C))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation]);const p=l.findNearestSibling(s.id);if(p){const A=l.getElementById(p);if(A){const y=u.cx,S=u.cy,C=u.cz,P=A.cx-s.cx,v=A.cy-s.cy,T=A.cz-s.cz;u.cx=A.cx+P,u.cy=A.cy+v,u.cz=A.cz+T,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-v,u.cz=s.cz-T,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*v,u.cz=s.cz-2*T,l.overlapWithSibling(u)&&(u.cx=y-P,u.cy=S-v,u.cz=C-T)))}else u.cx+=1.25*u.lx}else u.cx+=1.25*u.lx;const g={lng:l.language};l.overlapWithSibling(u)?co(Y.t("message.CannotPasteBecauseOfOverlap",g)):f.type===z.Foundation||f.type===z.Cuboid&&me.isIdentical(u.normal,as)?me.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(Y.t("message.CannotPasteOutsideBoundary",g)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.SolarWaterHeater:{if(u.parentId){const f=l.getParent(u);if(f)if(f.type===z.Roof){if(s.foundationId){const p=l.getElementById(s.foundationId);if(p){const g=bn.getRoofBoundaryVertices(f),A=u.lx*1.25;for(u.cx+=A;u.cx+u.lx/2-p.lx/2;){const y=bn.getSolarWaterHeaterVerticesOnRoof(u,p);if(bn.rooftopElementBoundaryCheck(y,g)&&bn.rooftopElementCollisionCheck(u,p,y)){l.elements.push(u),d=!0;break}else u.cx-=A}if(d)l.updateElementOnRoofFlag=!0;else{const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}}}break}else f.type===z.Cuboid&&(u.normal=[...s.normal],u.rotation=[...s.rotation])}break}case z.FresnelReflector:case z.Heliostat:case z.ParabolicDish:case z.ParabolicTrough:{if(u.parentId){const f=l.getParent(u);if(f){if(f.type===z.Wall){const A=u.lx/f.lx/2;for(u.cx+=A*3;u.cx+A<.5;)if(me.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),d=!0;break}else u.cx+=A;if(!d)for(u.cx=s.cx-A*3;u.cx-A>-.5;)if(me.checkElementOnWallState(u,f)===pa.Valid){l.elements.push(u),l.elementsToPaste=[u],d=!0;break}else u.cx-=A;if(!d){const y={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",y))}break}else if(f.type===z.Roof){if(s.foundationId){const A=l.getElementById(s.foundationId);if(A){const y=bn.getRoofBoundaryVertices(f),S=u.lx/A.lx/2;for(u.cx+=S*1.25;u.cx+S<.5;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx+=S*1.25}if(!d)for(u.cx=s.cx-S*1.25;u.cx-S>-.5;){const C=bn.getSolarPanelVerticesOnRoof(u,A);if(bn.rooftopElementBoundaryCheck(C,y)&&bn.rooftopElementCollisionCheck(u,A,C)){l.elements.push(u),d=!0;break}else u.cx-=S*1.25}if(d)l.updateElementOnRoofFlag=!0;else{const C={lng:l.language};co(Y.t("message.CannotPasteOutsideBoundary",C))}}}break}const p=l.findNearestSibling(s.id);if(p){const A=l.getElementById(p);if(A){const y=u.cx,S=u.cy,C=u.cz,P=A.cx-s.cx,v=A.cy-s.cy,T=A.cz-s.cz;u.cx=A.cx+P,u.cy=A.cy+v,u.cz=A.cz+T,l.overlapWithSibling(u)&&(u.cx=s.cx-P,u.cy=s.cy-v,u.cz=s.cz-T,l.overlapWithSibling(u)&&(u.cx=s.cx-2*P,u.cy=s.cy-2*v,u.cz=s.cz-2*T,l.overlapWithSibling(u)&&(u.cx=y-P,u.cy=S-v,u.cz=C-T)))}else u.cx+=(.01+u.lx)/f.lx}else u.cx+=(.01+u.lx)/f.lx;const g={lng:l.language};l.overlapWithSibling(u)?co(Y.t("message.CannotPasteBecauseOfOverlap",g)):f.type===z.Foundation||f.type===z.Cuboid&&me.isIdentical(u.normal,as)?me.isSolarCollectorWithinHorizontalSurface(u,f)?(l.elements.push(u),l.elementsToPaste=[u],d=!0):co(Y.t("message.CannotPasteOutsideBoundary",g)):(l.elements.push(u),l.elementsToPaste=[u],d=!0)}}break}case z.Sensor:case z.Light:case z.WindTurbine:{if(u.parentId){const f=l.getParent(u);f&&(u.cx+=u.lx/f.lx),u.cx<.5&&(l.elements.push(u),l.elementsToPaste=[u],d=!0)}break}case z.Polygon:{const f=u;for(const p of f.vertices)p.x+=.1;f.cx+=.1,l.elements.push(f),l.elementsToPaste=[f],d=!0;break}case z.Cuboid:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=A=>{const y=[];for(const S of e().elements)if(S.parentId===A.id)switch(y.push(S),S.type){case z.Cuboid:case z.Foundation:case z.Wall:case z.Roof:y.push(...f(S))}return y},p=f(s),g=new Map;a.push(u),g.set(s.id,u);for(const A of p){const y=g.get(A.parentId);if(y){const S=Dl.clone(y,A,A.cx,A.cy,A.cz,A.type===z.Polygon);S&&(u.normal&&(S.normal=[...A.normal]),a.push(S),g.set(A.id,S))}}l.elements.push(...a),l.elementsToPaste=[u],l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),l.elementsToPaste=[...f],a.push(...f),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!1;break}case z.Foundation:{if(u.cx+=u.lx,l.elementsToPaste.length===1){const f=new Map,p=new Map;for(const g of l.elements)if(g.parentId===s.id&&g.parentId!==g.id){const A=Dl.clone(u,g,g.cx,g.cy,g.cz,g.type===z.Polygon);if(A&&(u.normal&&(A.normal=[...g.normal]),a.push(A),(A==null?void 0:A.type)===z.Wall||(A==null?void 0:A.type)===z.Roof)){f.set(A.id,g.id),p.set(g.id,A.id);for(const y of l.elements)if(y.parentId===g.id){const S=Dl.clone(A,y,y.cx,y.cy,y.cz);S&&(g.normal&&(S.normal=[...y.normal]),a.push(S))}}}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u];for(const g of l.elements){if(g.type===z.Roof){const A=f.get(g.id);if(A){const y=e().getElementById(A);y&&(g.wallsId=y.wallsId.map(S=>p.get(S)))}}if(g.type===z.Wall){const A=f.get(g.id);if(A){for(const y of l.elements)if(y.id===A&&y.type===z.Wall){const S=y,C=p.get(S.leftJoints[0]);C&&(g.leftJoints=[C]);const P=p.get(S.rightJoints[0]);if(P&&(g.rightJoints=[P]),S.roofId){const v=p.get(S.roofId);v&&(g.roofId=v)}break}}}}}else if(l.elementsToPaste.length>1){const f=l.copyCutElements();f.length>0&&(f[0].cx+=f[0].lx,l.elements.push(...f),a.push(...f),l.elementsToPaste=f,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(f[0].id),l.selectedElement=f[0])}d=!0;break}case z.Wall:{const f=u,p=new le(1,-1,0).applyEuler(new ln(0,0,f.relativeAngle));if(u.cx+=p.x,u.cy+=p.y,l.elementsToPaste.length===1){const g=new le(u.cx,u.cy,0),A=new le(u.lx/2,0,0),y=new le(-u.lx/2,0,0),S=new ln(0,0,f.relativeAngle);f.leftPoint=g.clone().add(y.applyEuler(S)).toArray(),f.rightPoint=g.clone().add(A.applyEuler(S)).toArray(),f.roofId=void 0,f.leftRoofHeight=void 0,f.rightRoofHeight=void 0,f.centerLeftRoofHeight=void 0,f.centerRightRoofHeight=void 0,f.centerRoofHeight=void 0;for(const C of l.elements)if(C.parentId===s.id){const P=Dl.clone(u,C,C.cx,C.cy,C.cz,C.type===z.Polygon);P&&(u.normal&&(P.normal=[...C.normal]),a.push(P))}l.elements.push(...a),l.elements.push(u),l.elementsToPaste=[u]}else if(l.elementsToPaste.length>1){const g=l.copyCutElements();g.length>0&&(g[0].cx+=p.x,g[0].cy-=p.y,l.elements.push(...g),a.push(...g),l.elementsToPaste=g,l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(g[0].id),l.selectedElement=g[0])}l.updateWallMapOnFoundationFlag=!l.updateWallMapOnFoundationFlag,d=!0;break}}l.elementsToPaste.length===1&&d&&(a.push(u),l.selectedElementIdSet.clear(),l.selectedElementIdSet.add(u.id),l.selectedElement=u)}}}),a},supportedPvModules:{},customPvModules:{},loadSupportedPvModules(){const a=[];hB.parse(Fpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c={name:s[0].trim(),brand:s[1].trim(),cellType:s[2].trim(),efficiency:parseFloat(s[3].trim()),length:parseFloat(s[4].trim()),nominalLength:parseFloat(s[5].trim()),width:parseFloat(s[6].trim()),nominalWidth:parseFloat(s[7].trim()),thickness:parseFloat(s[8].trim()),m:parseFloat(s[9].trim()),n:parseFloat(s[10].trim()),pmax:parseFloat(s[11].trim()),vmpp:parseFloat(s[12].trim()),impp:parseFloat(s[13].trim()),voc:parseFloat(s[14].trim()),isc:parseFloat(s[15].trim()),pmaxTC:parseFloat(s[16].trim()),noct:parseFloat(s[17].trim()),weight:parseFloat(s[18].trim()),color:s[19].trim(),shadeTolerance:s[20].trim(),bifacialityFactor:parseFloat(s[21].trim())};a.push(c)}console.log(a.length+" PV models loaded"),i(s=>{for(const c of a)s.supportedPvModules[c.name]=c})}})},getPvModule(a){let l=e().supportedPvModules[a];return l||(l=e().customPvModules[a]),l},addCustomPvModule(a){i(l=>{l.customPvModules[a.name]=a})},removeCustomPvModule(a){i(l=>{let s=!1;for(const c of l.elements)if(c.type===z.SolarPanel&&c.pvModelName===a){s=!0;break}s?co(Y.t("pvModelPanel.ThisCustomSolarPanelIsUsed",{lng:l.language})):delete l.customPvModules[a]})},weatherModel:void 0,setWeatherModel(a){i(l=>{l.weatherModel=l.weatherData[a]})},weatherData:{},loadWeatherData(){if(Object.keys(e().weatherData).length>0)return;const a=[];hB.parse(zpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[],u=[],d=[];for(let p=5;p<29;p++)(p-5)%2===0?c.push(parseFloat(s[p].trim())):u.push(parseFloat(s[p].trim()));for(let p=29;p<41;p++)d.push(parseFloat(s[p].trim()));const f={city:s[0].trim(),country:s[1].trim(),longitude:parseFloat(s[2].trim()),latitude:parseFloat(s[3].trim()),elevation:parseFloat(s[4].trim()),lowestTemperatures:c,highestTemperatures:u,sunshineHours:d};a.push(f)}i(s=>{for(const c of a)s.weatherData[c.city+", "+c.country]=c;s.weatherModel=s.weatherData["Boston MA, USA"]}),console.log(a.length+" weather datasets loaded")}})},getWeather(a){const l=e().weatherModel;return l||e().weatherData[a]},horizontalSolarRadiationData:{},loadHorizontalSolarRadiationData(){const a=[];hB.parse(Dpt,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.horizontalSolarRadiationData[c.city+", "+c.country]=c})}})},getHorizontalSolarRadiation(a){return e().horizontalSolarRadiationData[a]},verticalSolarRadiationData:{},loadVerticalSolarRadiationData(){const a=[];hB.parse(Ept,{download:!0,complete:function(l){for(const s of l.data)if(Array.isArray(s)&&s.length>1){const c=[];for(let d=2;d<14;d++)c.push(parseFloat(s[d].trim()));const u={city:s[0].trim(),country:s[1].trim(),data:c};a.push(u)}i(s=>{for(const c of a)s.verticalSolarRadiationData[c.city+", "+c.country]=c})}})},getVerticalSolarRadiation(a){return e().verticalSolarRadiationData[a]},getClosestCity(a,l){let s=Number.MAX_VALUE,c=null,u;const d=e().weatherData;for(const f in d)Object.hasOwn(d,f)&&(u=me.getDistance(l,a,d[f].longitude,d[f].latitude),u{l.sunlightDirection=a.clone()})},cameraDirection:new le,getCameraDirection(){return e().cameraDirection},updateSceneRadiusFlag:!1,updateSceneRadius(){i(a=>{a.updateSceneRadiusFlag=!a.updateSceneRadiusFlag})},sceneRadius:100,setSceneRadius(a){i(l=>{l.sceneRadius=a})},selectedElementAngle:0,selectedElementHeight:0,selectedElementX:0,selectedElementY:0,isAddingElement(){return!!(e().addedCuboidId||e().addedFoundationId||e().addedWallId||e().addedWindowId||e().addedDoorId)},addedFoundationId:null,deletedFoundationId:null,addedCuboidId:null,deletedCuboidId:null,addedWallId:null,deletedWallId:null,updateWallMapOnFoundationFlag:!1,updateWallMapOnFoundation(){i(a=>{a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},updateElementOnRoofFlag:!1,setUpdateElementOnRoofFlag(a){i(l=>{l.updateElementOnRoofFlag=a})},updateElementOnRoofFn(){i(a=>{a.updateElementOnRoofFlag=!0})},addedWindowId:null,addedDoorId:null,addedRoofIdSet:new Set,deletedRoofId:null,deletedRoofIdSet:new Set,autoDeletedRoofs:null,autoDeletedRoofIdSet:new Set,autoDeletedChild:null,getAutoDeletedElements(){const a=e().autoDeletedRoofs,l=e().autoDeletedChild;return!a||!l?null:[...a,...l]},deleteAddedRoofId(a){i(l=>{l.addedRoofIdSet.delete(a)})},groupActionMode:!1,setGroupActionMode(a){i(l=>{l.groupActionMode=a})},groupActionUpdateFlag:!1,locale:y1e,localFileDialogRequested:!1,loggable:!1,actionInfo:void 0,currentUndoable:void 0,showCloudFileTitleDialog:!1,showCloudFileTitleDialogFlag:!1,localContentToImportAfterCloudFileUpdate:void 0,enableFineGrid:!1,setEnableFineGrid(a){i(l=>{l.enableFineGrid=a})}}},{name:"aladdin-storage",storage:oje(()=>new URLSearchParams(window.location.search).get("viewonly")==="true"?sessionStorage:localStorage),skipHydration:me.isOpenFromURL(),partialize:t=>({language:t.language,animate24Hours:t.animate24Hours,floatingWindowOpacity:t.floatingWindowOpacity,selectedFloatingWindow:t.selectedFloatingWindow,locale:t.locale,cloudFile:t.cloudFile,latestModelSite:t.latestModelSite,modelSites:t.modelSites,allModelSites:t.allModelSites,modelsMapLatitude:t.modelsMapLatitude,modelsMapLongitude:t.modelsMapLongitude,modelsMapAddress:t.modelsMapAddress,modelsMapZoom:t.modelsMapZoom,modelsMapType:t.modelsMapType,modelsMapTilt:t.modelsMapTilt,showModelsAllTime:t.showModelsAllTime,showModelsFromDate:t.showModelsFromDate,showModelsToDate:t.showModelsToDate,world:t.world,elements:t.elements,viewState:t.viewState,graphState:t.graphState,actionState:t.actionState,modelType:t.modelType,modelAuthor:t.modelAuthor,modelLabel:t.modelLabel,modelDescription:t.modelDescription,projectView:t.projectView,projectState:t.projectState,designProjectType:t.designProjectType,notes:t.notes,user:t.user,sceneRadius:t.sceneRadius,weatherModel:t.weatherModel,solarPanelArrayLayoutParams:t.solarPanelArrayLayoutParams,solarPanelArrayLayoutConstraints:t.solarPanelArrayLayoutConstraints,economicsParams:t.economicsParams,evolutionMethod:t.evolutionMethod,evolutionaryAlgorithmState:t.evolutionaryAlgorithmState,geneticAlgorithmWizardSelectedTab:t.geneticAlgorithmWizardSelectedTab,particleSwarmOptimizationWizardSelectedTab:t.particleSwarmOptimizationWizardSelectedTab,minimumNavigationMoveSpeed:t.minimumNavigationMoveSpeed,minimumNavigationTurnSpeed:t.minimumNavigationTurnSpeed,customPvModules:t.customPvModules})})));class qen extends be.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,n){}clearCacheAndReload(){localStorage.clear(),window.location.reload()}render(){return this.state.hasError?h.jsxs("div",{style:{marginTop:10,marginLeft:20},children:[h.jsx("h1",{children:"Error"}),h.jsx("p",{children:"Something went wrong. Please click the following button to clear the cache and reload the page."}),h.jsx("p",{children:h.jsx("button",{onClick:this.clearCacheAndReload,children:"Refresh"})})]}):this.props.children}}const $en=t=>{const e=typeof t=="function",n=m.useRef(t);m.useEffect(()=>{n.current=t}),m.useEffect(()=>{if(e){const o=r=>{const i=n.current(r);if(typeof i=="string")return r.preventDefault(),r.returnValue=i;if(r.defaultPrevented)return r.returnValue=""};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}}},[e])},Qen=({children:t=null,onBeforeunload:e})=>($en(e),t),Zen="/aladdin/assets/daysky-xGPh_lTa.jpg",etn="/aladdin/assets/desert-C1g8PGRA.jpg",ttn="/aladdin/assets/dune-BTLjQ9Lc.jpg",ntn="/aladdin/assets/forest-4yWLHFWh.jpg",otn="/aladdin/assets/grassland-CDTfZBr_.jpg",dTe="/aladdin/assets/hill-spring-BepVmTLf.jpg",fTe="/aladdin/assets/hill-summer-RoU04vrD.jpg",hTe="/aladdin/assets/hill-fall-BPbpF4zI.jpg",pTe="/aladdin/assets/hill-winter-CQjb4ZNm.jpg",rtn="/aladdin/assets/lake-Dj_bK41O.jpg",itn="/aladdin/assets/mountain-Du_Jo4ue.jpg",atn="/aladdin/assets/rural-BqG-D3I1.jpg",ltn=be.memo(({theme:t="Default"})=>{const e=M(pn),n=M(RW),o=M(Db),r=M(Wge),i=M(Kge),a=M(LH),l=M(Jn),s=M(d3),c=M(jge),u=M(Ug),d=M(s0),f=M(Al),p=M(En),g=M(u3),A=M(lYe),{scene:y,camera:S,gl:{domElement:C}}=ri(),P=m.useRef(null),v=m.useRef(null),T=m.useRef(null),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new le),R=m.useRef(new le),H=m.useRef(new le(1,1,1)),F=m.useRef(0),E=m.useRef(0),N=m.useRef(new Map),U=m.useRef(new Map),W=m.useRef(new Map),k=m.useRef(new Map),D=m.useRef(null),L=$t(),j=m.useMemo(()=>new l0,[]),B=m.useMemo(()=>new ln,[]),V=new Date(f).getMonth()+1,[G,q]=m.useState(Zf.Sky),$=m.useMemo(()=>new le,[]),ie=m.useMemo(()=>new ln,[]);if(v.current&&u){G!==Zf.Vertical&&q(Zf.Vertical);const ue=i(v.current,u),he=r(),ve=-Math.atan2(he.x,he.y);$.set(ue.x,ue.y,0),ie.set(-Qt,0,ve,"ZXY")}const Q=m.useMemo(()=>{switch(t){case Os.Desert:return .5;case Os.Dune:return .25;case Os.Forest:return .25;case Os.Grassland:return .15;case Os.Hill:return .3;case Os.Lake:return .1;case Os.Mountain:return .4;case Os.Rural:return .25;default:return .2}},[t]),se=m.useMemo(()=>{switch(t){case Os.Desert:return etn;case Os.Dune:return ttn;case Os.Forest:return ntn;case Os.Grassland:return otn;case Os.Hill:return d>0?V>=12||V<=3?pTe:V>3&&V<=5?dTe:V>5&&V<=9?fTe:hTe:V>=12||V<=3?fTe:V>3&&V<=5?hTe:V>5&&V<=9?pTe:dTe;case Os.Lake:return rtn;case Os.Mountain:return itn;case Os.Rural:return atn;default:return Zen}},[t,V,d]),oe=Hb(se),Z=ue=>ue===z.Foundation||ue===z.Cuboid||ue===z.Tree||ue===z.Flower||ue===z.Human,te=ue=>{if(ue.intersections.length>0)if(ue.intersections[0].object===P.current)n(),e(ve=>{ve.clickObjectType=z.Sky});else{const ve=o();ve&&Z(ve.type)&&(v.current=ve,me.isPlantOrHuman(v.current)&&(q(Zf.Vertical),ie.set(-Qt,0,0,"ZXY")),ve.type!==z.Foundation&&ve.type!==z.Cuboid&&kn.getState().setEnableOrbitController(!1))}},ee=ue=>{if(!ue)return"";const he=ue.name.split(" ");return he[2]?he[2]:ee(ue.parent)},de=(ue,he)=>{if(ue==null)return null;for(const ve of ue.children)if(ve.name.includes(`${he}`))return ve;return null},fe=(ue,he)=>{var Ie,Me;const ve=kn.getState().contentRef,we=de(ve==null?void 0:ve.current,ue.id);if(we){for(const ze of we.children)if(ze.name.includes(`${he.id}`)){(Me=(Ie=kn.getState().contentRef)==null?void 0:Ie.current)==null||Me.add(ze);break}}he.parentId=Zo;const Pe=new le(he.cx,he.cy,he.cz).applyEuler(new ln(0,0,ue.rotation[2])).add(b.current);he.cx=Pe.x,he.cy=Pe.y,he.cz=0,W.current.set(he.id,new le(Pe.x,Pe.y,0)),k.current.set(he.id,Zo)},pe=(ue,he,ve)=>{if(!ue||!he)return;const we=kn.getState().contentRef;if(we!=null&&we.current){const Pe=me.getObjectChildById(we.current,he),Ie=me.getObjectChildById(he===Zo?we.current:Pe,ve);if(Ie){if(ue===Zo)we.current.add(Ie);else{const Me=me.getObjectChildById(we.current,ue);Me==null||Me.add(Ie)}op()}}},ye=(ue,he)=>{ue&&e(ve=>{for(const we of ve.elements)if(we.id===he&&!me.isFoundationOrCuboid(we)){we.parentId=ue;break}})},ae=ue=>{for(const he of ue)if(he.object.userData.stand)return he;return null},Te=(ue,he)=>{if(ue&&ue.current){const ve=ae(he.intersections);if(ve){const we=ve.object,Pe=ue.current.parent;if(we.name==="Ground"){if(Pe&&Pe.name!=="Content"){const Ie=kn.getState().contentRef;Ie&&Ie.current&&(Ie.current.add(ue.current),ye(Zo,ee(ue.current)))}ue.current.position.copy(ve.point),op()}else if(we.userData.stand){const Ie=we.parent;if(Ie){Pe&&Pe.uuid!==Ie.uuid&&(Ie.add(ue.current),ye(ee(Ie),ee(ue.current))),B.set(0,0,-Ie.rotation.z);const Me=new le().subVectors(ve.point,Ie.position).applyEuler(B);ue.current.position.copy(Me),op()}}}}},ge=(ue,he,ve)=>{e(we=>{for(const Pe of we.elements)if(Pe.id===ue){me.isFoundationOrCuboid(Pe)||(Pe.parentId=he),Pe.cx=ve.x,Pe.cy=ve.y,Pe.cz=ve.z;break}})},Se=()=>{if(M.getState().viewState.orthographic)return!1;if(P.current){const ue=j.intersectObjects(me.fetchIntersectables(y),!1);if(ue.length>0){for(const he of ue)if(he.object.userData.stand)return!1}}return j.intersectObjects([P.current]).length>0},Re=ue=>{if(v.current&&v.current.type&&!v.current.locked){const he=new Kt;he.x=ue.offsetX/C.clientWidth*2-1,he.y=-(ue.offsetY/C.clientHeight)*2+1,j.setFromCamera(he,S);let ve;if(T.current&&G===Zf.Vertical&&(ve=j.intersectObjects([T.current]),ve&&ve.length>0)){const we=ve[0].point;switch(v.current.type){case z.Tree:{const Pe=v.current;switch(u){case Mt.Top:c(Pe.id,we.z),e(Ie=>{Ie.selectedElementHeight=Math.max(1,we.z)});break;case Mt.Left:case Mt.Right:case Mt.Upper:case Mt.Lower:s(Pe.id,2*Math.hypot(we.x-Pe.cx,we.y-Pe.cy));break}Te(kn.getState().treeRef,ue);break}case z.Human:{Te(kn.getState().humanRef,ue);break}case z.Cuboid:{if(me.isTopResizeHandle(u)){e(Ie=>{var Me;for(const ze of Ie.elements)if(ze.id===((Me=v.current)==null?void 0:Me.id)){ze.cz=Math.max(.5,we.z/2),ze.lz=Math.max(1,we.z);break}Ie.selectedElementHeight=Math.max(1,we.z)});const Pe=kn.getState().cuboidRef;if(Pe!=null&&Pe.current){for(const Ie of Pe.current.children)if(Ie.name.includes("Human")||Ie.name.includes("Tree")){const Me=w.current.get(ee(Ie));Me&&(Math.abs(E.current-Me.z)<.01?Ie.position.setZ(Math.max(we.z/2,.5)):Ie.position.setZ(Me.z-Pe.current.position.z))}}}break}}}}},De=ue=>{if(ue.button===2)return;e(ve=>{ve.contextMenuObjectType=null}),te(ue);const he=v.current;if(he)switch(E.current=he.lz,b.current.set(he.cx,he.cy,he.cz),he.type){case z.Human:D.current=he.parentId;break;case z.Tree:D.current=he.parentId,F.current=he.lx;break;case z.Cuboid:{b.current.set(he.cx,he.cy,he.cz),H.current.set(he.lx,he.ly,he.lz),w.current.clear();const ve=new le(he.cx,he.cy,he.cz),we=a(he.id);if(we.length>0){N.current.clear();const Pe=he.rotation[2];for(const Ie of we)switch(Ie.type){case z.Tree:case z.Human:{const Me=new le(Ie.cx,Ie.cy,Ie.cz).applyEuler(new ln(0,0,Pe));Me.add(ve),w.current.set(Ie.id,Me),N.current.set(Ie.id,new le(Ie.cx,Ie.cy,Ie.cz));break}case z.SolarPanel:case z.Sensor:{if(me.isIdentical(Ie.normal,as)){const Me=new le(Ie.cx*he.lx,Ie.cy*he.ly,Ie.cz*he.lz).applyEuler(new ln(0,0,Pe));Me.add(ve),w.current.set(Ie.id,Me)}break}case z.Polygon:{if(me.isIdentical(Ie.normal,as)){const Me=Ie,ze=[];for(const Ne of Me.vertices){const Je=new Kt(Ne.x*he.lx,Ne.y*he.ly).rotateAround(ai,Pe);Je.add(new Kt(ve.x,ve.y)),ze.push(Je)}x.current.set(Me.id,ze)}break}}}break}}},Ae=()=>{var ue,he;if(v.current){const ve=l(v.current.id);if(ve&&!ve.locked){let we=null,Pe=D.current;switch(ve.type){case z.Cuboid:switch(u){case Mt.UpperLeftTop:case Mt.UpperRightTop:case Mt.LowerLeftTop:case Mt.LowerRightTop:{U.current.clear(),e(ze=>{ze.actionState.cuboidHeight=ve.lz;for(const Ne of ze.elements)if(me.isPlantOrHuman(Ne)&&Ne.parentId===ve.id)if(U.current.set(Ne.id,ve.id),Math.abs(H.current.z/2-Ne.cz)<.01)Ne.cz=ve.lz/2;else{const Je=Ne.cz+b.current.z-ve.cz;Math.abs(Je)>ve.lz/2?fe(ve,Ne):Ne.cz=Je}});const Ie=a(ve.id);if(Ie.length>0)for(const ze of Ie)W.current.set(ze.id,new le(ze.cx,ze.cy,ze.cz));const Me={name:"Change Cuboid Height",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:E.current,newValue:ve.lz,oldChildrenPositionsMap:new Map(N.current),newChildrenPositionsMap:new Map(W.current),oldChildrenParentIdMap:new Map(U.current),newChildrenParentIdMap:new Map(k.current),undo:()=>{var ze,Ne;if(e(Je=>{for(const Ue of Je.elements)if(Ue.id===Me.changedElementId){Ue.lz=Me.oldValue,Ue.cz=Me.oldValue/2;break}}),Me.oldChildrenPositionsMap&&Me.oldChildrenPositionsMap.size>0)for(const[Je,Ue]of Me.oldChildrenPositionsMap.entries()){const nt=l(Je);if((nt==null?void 0:nt.type)!==z.Polygon){g(Je,Ue.x,Ue.y,Ue.z);const We=(ze=Me.oldChildrenParentIdMap)==null?void 0:ze.get(Je),Ee=(Ne=Me.newChildrenParentIdMap)==null?void 0:Ne.get(Je);We&&Ee&&We!==Ee&&(pe(We,Ee,Je),ye(We,Je))}}},redo:()=>{var ze,Ne;if(e(Je=>{for(const Ue of Je.elements)if(Ue.id===Me.changedElementId){Ue.lz=Me.newValue,Ue.cz=Me.newValue/2;break}}),Me.newChildrenPositionsMap&&Me.newChildrenPositionsMap.size>0)for(const[Je,Ue]of Me.newChildrenPositionsMap.entries()){g(Je,Ue.x,Ue.y,Ue.z);const nt=(ze=Me.oldChildrenParentIdMap)==null?void 0:ze.get(Je),We=(Ne=Me.newChildrenParentIdMap)==null?void 0:Ne.get(Je);nt&&We&&nt!==We&&(pe(We,nt,Je),ye(We,Je))}}};p(Me);break}}break;case z.Tree:switch(u){case Mt.Top:{const Ie={name:"Change Tree Height",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:E.current,newValue:ve.lz,undo:()=>{c(Ie.changedElementId,Ie.oldValue)},redo:()=>{c(Ie.changedElementId,Ie.newValue)}};p(Ie),e(Me=>{Me.actionState.treeHeight=ve.lz});break}case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Ie={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:ve.id,changedElementType:ve.type,oldValue:F.current,newValue:ve.lx,undo:()=>{s(Ie.changedElementId,Ie.oldValue)},redo:()=>{s(Ie.changedElementId,Ie.newValue)}};p(Ie),e(Me=>{Me.actionState.treeSpread=ve.lx});break}}we=(ue=kn.getState().treeRef)==null?void 0:ue.current;break;case z.Human:we=(he=kn.getState().humanRef)==null?void 0:he.current;break}if(we){const Ie=j.intersectObjects(me.fetchIntersectables(y),!1),Me=ae(Ie);if(Me){const ze=Me.point;if(Me.object.name==="Ground")ge(ve.id,Zo,ze),R.current.set(ze.x,ze.y,ze.z),Pe=Zo;else if(Me.object.userData.stand){const Ne=ee(Me.object),Je=Me.object.parent;if(Je){const Ue=new le().subVectors(ze,Je.position).applyEuler(B);ge(ve.id,Ne,Ue),R.current.set(Ue.x,Ue.y,Ue.z),Pe=Ne}}}}if(M.getState().moveHandleType&&me.isPlantOrHuman(ve)&&(R.current.distanceToSquared(b.current)>Et||j.intersectObjects([P.current]).length>0)){let Ie=!0;if(!M.getState().viewState.orthographic&&(Ie=R.current.length().02}if(!Ie||Se()){g(ve.id,b.current.x,b.current.y,b.current.z),we&&me.isPlantOrHuman(ve)&&we.position.copy(b.current),me.isPlantOrHuman(ve)&&ye(D.current,ve.id);const Me=kn.getState().contentRef;if(Me!=null&&Me.current&&D.current&&we){if(D.current===Zo)Me.current.add(we);else{const ze=me.getObjectChildById(Me.current,D.current);ze==null||ze.add(we)}op()}co(Y.t("message.CannotMoveObjectTooFar",L))}else{const Me={name:"Move",timestamp:Date.now(),movedElementId:ve.id,movedElementType:ve.type,oldCx:b.current.x,oldCy:b.current.y,oldCz:b.current.z,newCx:R.current.x,newCy:R.current.y,newCz:R.current.z,oldParentId:D.current,newParentId:Pe,undo:()=>{g(Me.movedElementId,Me.oldCx,Me.oldCy,Me.oldCz),ye(Me.oldParentId,Me.movedElementId),pe(Me.oldParentId,Me.newParentId,Me.movedElementId)},redo:()=>{g(Me.movedElementId,Me.newCx,Me.newCy,Me.newCz),ye(Me.newParentId,Me.movedElementId),pe(Me.newParentId,Me.oldParentId,Me.movedElementId)}};p(Me),A()}}}v.current=null,q(Zf.Sky),e(we=>{we.moveHandleType=null,we.resizeHandleType=null,we.rotateHandleType=null}),kn.setState({humanRef:null,treeRef:null}),kn.getState().setEnableOrbitController(!0)}};return h.jsxs(h.Fragment,{children:[h.jsxs("mesh",{ref:P,name:"Sky",rotation:[Qt,0,0],scale:[1,Q,1],onContextMenu:ue=>{ue.intersections.length>0&&ue.intersections[0].object===P.current&&(n(),e(ve=>{ve.clickObjectType=z.Sky,ve.contextMenuObjectType=z.Sky}))},onPointerDown:De,children:[h.jsx("sphereGeometry",{args:[tAt,16,8,0,sa,0,Qt]}),h.jsx("meshToonMaterial",{map:oe,side:r0,opacity:1,color:"skyblue"})]}),v.current&&G!==Zf.Sky&&h.jsx(ta,{ref:T,visible:!1,name:"Sky Intersection Plane",rotation:ie,position:$,args:[1e3,1e3],onPointerMove:k2.throttle(Re,qF),onPointerUp:Ae,children:h.jsx("meshStandardMaterial",{side:ti})})]})}),stn=be.memo(({lineWidth:t=1,endPoint:e=1e3,showTickMarks:n=!0,showTickLabels:o=!0})=>{const r=M(zwt),i=M(ay),a=M(Ju),[l,s]=m.useState(!1),c=50,u=m.useRef(1),d=m.useRef(u.current*10),f=m.useRef(new Array(c).fill(1)),p=.1,g=.3,A="FloralWhite",y=t/2,S=r3(hW,mN),C=Math.min(1,Math.max(.5,i*.01)),P={font:S,height:0,size:C},v=a?r.max.z+.01:0;m.useEffect(()=>{i<50?u.current=1:i<100?u.current=2:u.current=5,d.current=10*u.current,f.current=new Array(c).fill(1),s(!l)},[i]);const T=w=>w%(5*u.current)===0?g:p;return h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},name:"x axis line",points:[[-e,0,v],[e,0,v]],color:"red",lineWidth:t}),a&&n&&f.current.map((w,x)=>{const b=(x+1)*u.current,R=T(b);return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[b,-R,v],[b,R,v]],color:A,lineWidth:y}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-b,-R,v],[-b,R,v]],color:A,lineWidth:y})]},b)}),a&&o&&f.current.map((w,x)=>{const b=(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[b-C,-g*2-C,v],children:[h.jsx("textGeometry",{args:[(b<10?" ":"")+b,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),a&&o&&f.current.map((w,x)=>{const b=-(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[b-C,-g*2-C,v],children:[h.jsx("textGeometry",{args:[(b>-10?" ":"")+b,P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),h.jsx(Gn,{name:"y axis line",userData:{unintersectable:!0},points:[[0,-e,v],[0,e,v]],color:"blue",lineWidth:t}),a&&n&&f.current.map((w,x)=>{const b=(x+1)*u.current,R=T(b);return h.jsxs(be.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[-R,b,v],[R,b,v]],color:A,lineWidth:y*1.5}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[-R,-b,v],[R,-b,v]],color:A,lineWidth:y*1.5})]},b)}),a&&o&&f.current.map((w,x)=>{const b=(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-g*2-C*2,b-C/2,v],children:[h.jsx("textGeometry",{args:[b+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),a&&o&&f.current.map((w,x)=>{const b=-(x+1)*u.current;return b%d.current===0?h.jsxs("mesh",{userData:{unintersectable:!0},position:[-g*2-C*2,b-C/2,v],children:[h.jsx("textGeometry",{args:[b+"",P]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]},b):h.jsx(be.Fragment,{},b)}),!a&&h.jsx(Gn,{userData:{unintersectable:!0},name:"z axis line",points:[[0,0,0],[0,0,e]],color:"green",lineWidth:t})]})}),ctn=be.memo(t=>{var q;const{id:e,cx:n,cy:o,cz:r,name:i=Vt.Jack,locked:a=!1,flip:l=!1,observer:s=!1,parentId:c}=t;let u=!1;M($=>{if(c===Zo)u=!0;else for(const ie of $.elements)if(ie.id===c){u=!0;break}});const d=M(Ap);m.useEffect(()=>{u||d(e,!1)},[u,e]);const f=M(pn),p=M(Ju)??!1,g=M(pu),A=M(Ub),y=M(ly),S=dt(hs),C=Tc(e),{gl:P}=ri(),[v,T]=m.useState(!1),w=kn($=>$.contentRef),x=m.useRef(null),b=m.useRef(null),R=$t(),H=m.useRef(!1),F=M(FH);F!==H.current&&(H.current=F,w!=null&&w.current&&x.current&&w.current.add(x.current)),m.useEffect(()=>{if(c!==Zo){const $=L();$&&x.current&&$.add(x.current)}},[F,c]);const E=m.useMemo(()=>new cf().load(kp.fetchTextureImage(i),$=>{l&&($.wrapS=bs,$.repeat.x=-1),U($)}),[i,l]),[N,U]=m.useState(E),W=m.useMemo(()=>kp.fetchWidth(i),[i]),k=m.useMemo(()=>kp.fetchHeight(i),[i]),D=m.useMemo(()=>kp.fetchLabel(i,R)+(a?" ("+Y.t("shared.ElementLocked",R)+")":"")+` +`+Y.t("word.Coordinates",R)+": ("+n.toFixed(1)+", "+o.toFixed(1)+") "+Y.t("word.MeterAbbreviation",R),[i,a,n,o,R]);m.useEffect(()=>{const $=L();$&&x.current&&$.add(x.current)},[w]);const L=()=>c!==Zo&&(w!=null&&w.current)?me.getObjectChildById(w.current,c):null;Z2(({camera:$})=>{if(x.current){const{rot:ie}=me.getWorldDataById(c);if(p)x.current.rotation.set(Qt,Math.PI-ie,0);else{const{x:Q,y:se}=$.position,{x:oe,y:Z}=x.current.localToWorld(new le);x.current.rotation.set(0,0,-Math.atan2(Q-oe,se-Z)-ie)}}});const j=m.useCallback(($,ie)=>{dt.getState().duringCameraInteraction||$.intersections.length>0&&($.intersections[0].object===$.eventObject||$.intersections.length>1&&$.intersections[1].object===$.eventObject)&&(f(se=>{se.hoveredHandle=ie,se.selectedElementHeight=t.lz}),me.isMoveHandle(ie)?P.domElement.style.cursor="move":P.domElement.style.cursor="pointer")},[t.lz]),B=m.useCallback(()=>{f($=>{$.hoveredHandle=null}),P.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),O=s?kp.fetchGender(t.name):Ha.Male,V=s?(t.flip?-1:1)*kp.fetchHatOffsetX(t.name):0,G=s?kp.fetchHatOffsetY(t.name):0;return u?h.jsx("group",{ref:x,name:"Human Group "+e,userData:{aabb:!0},position:[n,o,r??0],children:h.jsxs("group",{position:[0,.1,k/2],children:[h.jsx(RC,{rotation:[Qt,0,0],uuid:e,name:i,follow:!1,children:h.jsx(ta,{ref:b,renderOrder:3,receiveShadow:!S,name:`Human ${i} plane`,args:[W,k],onContextMenu:$=>{g(e,$,Xo.ContextMenu),f(ie=>{$.intersections.length>0&&$.intersections[0].object===b.current&&(ie.contextMenuObjectType=z.Human)})},onPointerDown:$=>{$.button!==2&&$.eventObject===$.intersections[0].eventObject&&(g(e,$,Xo.Move),kn.setState({humanRef:x}))},onPointerOver:$=>{$.intersections.length>0&&$.intersections[0].object===b.current&&T(!0)},onPointerOut:()=>{T(!1)},children:h.jsx("meshToonMaterial",{map:N,alphaTest:.5,side:ti})})}),C&&a&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-W/2,0,-k/2],[-W/2,0,k/2],[-W/2,0,k/2],[W/2,0,k/2],[W/2,0,-k/2],[W/2,0,k/2],[W/2,0,-k/2],[-W/2,0,-k/2]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(q=b.current)==null?void 0:q.rotation,color:B0}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{uuid:e,visible:!1,userData:{eyeball:!0},name:i+" eyeball",args:[W/5,4,4,0,sa,0,sa],position:[0,0,t.lz/2],children:h.jsx("meshBasicMaterial",{attach:"material",side:ti})}),h.jsx(ma,{name:"Observer hat 1",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.1,.1,.1,16,2],position:[V,0,t.lz/2-.05+G],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:O===Ha.Male?"gray":"hotpink"})}),h.jsx(ma,{name:"Observer hat 2",userData:{unintersectable:!0},castShadow:!1,receiveShadow:!1,args:[.2,.2,.01,16,2],position:[V,0,t.lz/2-.1+G],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:O===Ha.Male?"gray":"hotpink"})})]}),C&&!a&&h.jsx(Ps,{position:[0,0,-k/2],args:[Wg*4,6,6,0,Math.PI],name:zo.Default,onPointerDown:$=>{$.button!==2&&$.eventObject===$.intersections[0].eventObject&&(g(e,$,Xo.Move),kn.setState({humanRef:x}))},onPointerEnter:$=>{j($,zo.Default)},onPointerLeave:B,children:h.jsx("meshBasicMaterial",{attach:"material",color:y===zo.Default||A===zo.Default?ga:iw})}),v&&!C&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:D,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,k/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null}),gTe="/aladdin/assets/apple_spring-Ctq5fKrS.png",dde="/aladdin/assets/apple_summer-Dr8H3cny.png",mTe="/aladdin/assets/apple_fall-Cp6pAzIj.png",yTe="/aladdin/assets/apple_winter-D03fshM0.png",ATe="/aladdin/assets/birch_spring-sKFxYorO.png",fde="/aladdin/assets/birch_summer-FaJ43Xt4.png",wTe="/aladdin/assets/birch_fall-PIQyyY4L.png",vTe="/aladdin/assets/birch_winter-C5h1hTVJ.png",aQe="/aladdin/assets/coconut-rkhxogn3.png",xTe="/aladdin/assets/dogwood_spring-9vLsm3g2.png",hde="/aladdin/assets/dogwood_summer-DgdkRZ2O.png",bTe="/aladdin/assets/dogwood_fall-Wu983FGV.png",STe="/aladdin/assets/dogwood_winter-4w2TO6RG.png",TTe="/aladdin/assets/elm_spring-DJcRoCq2.png",pde="/aladdin/assets/elm_summer-VNy_g1qe.png",PTe="/aladdin/assets/elm_fall-ChdMN8fe.png",CTe="/aladdin/assets/elm_winter-Qng-eWYe.png",lQe="/aladdin/assets/fan_palm-DbCJ1Nso.png",RTe="/aladdin/assets/linden_spring-C_zkyu46.png",gde="/aladdin/assets/linden_summer-zap94GfP.png",HTe="/aladdin/assets/linden_fall-CK-BpZ7U.png",MTe="/aladdin/assets/linden_winter-Dt7sgspu.png",ITe="/aladdin/assets/magnolia_spring-CNor1Lb8.png",mde="/aladdin/assets/magnolia_summer-C7-8T4uo.png",zTe="/aladdin/assets/magnolia_fall-D3wi6n7Y.png",DTe="/aladdin/assets/magnolia_winter-116tEre9.png",ETe="/aladdin/assets/maple_spring-26OHjb4f.png",yde="/aladdin/assets/maple_summer-BbcBLKSJ.png",FTe="/aladdin/assets/maple_fall-Bp5Vy2Jl.png",kTe="/aladdin/assets/maple_winter-BnFW631O.png",LTe="/aladdin/assets/oak_spring-CsUg07TC.png",Ade="/aladdin/assets/oak_summer-CPK7amde.png",WTe="/aladdin/assets/oak_fall-rgRz_M_t.png",NTe="/aladdin/assets/oak_winter-CD4uumS6.png",sQe="/aladdin/assets/pine-CI5zZHth.png",cQe="/aladdin/assets/spruce-CEhjo5-Q.png";class qz{static isEvergreen(e){return e===pr.Spruce||e===pr.Pine||e===pr.FanPalm||e===pr.Coconut}static isConic(e){return e===pr.Spruce}static fetchLabel(e,n){switch(e){case pr.Apple:return Y.t("tree.Apple",n);case pr.Birch:return Y.t("tree.Birch",n);case pr.Coconut:return Y.t("tree.Coconut",n);case pr.Dogwood:return Y.t("tree.Dogwood",n);case pr.Elm:return Y.t("tree.Elm",n);case pr.FanPalm:return Y.t("tree.FanPalm",n);case pr.Linden:return Y.t("tree.Linden",n);case pr.Magnolia:return Y.t("tree.Magnolia",n);case pr.Maple:return Y.t("tree.Maple",n);case pr.Oak:return Y.t("tree.Oak",n);case pr.Spruce:return Y.t("tree.Spruce",n);default:return Y.t("tree.Pine",n)}}static fetchTheta(e){switch(e){case pr.Apple:return .65*Math.PI;case pr.Birch:return .72*Math.PI;case pr.Coconut:return .5*Math.PI;case pr.Dogwood:return .65*Math.PI;case pr.Elm:return .78*Math.PI;case pr.FanPalm:return .52*Math.PI;case pr.Linden:return .75*Math.PI;case pr.Magnolia:return .68*Math.PI;case pr.Maple:return .65*Math.PI;case pr.Oak:return .75*Math.PI;case pr.Spruce:return Math.PI;default:return Math.PI*.5}}static fetchTextureImage(e,n,o,r,i){let a;const l=r+30,s=i-30,c=o>0;switch(e){case pr.Apple:n>=i||n<=r?a=c?yTe:dde:n>r&&n<=l?a=c?gTe:mTe:n>l&&n<=s?a=c?dde:yTe:a=c?mTe:gTe;break;case pr.Birch:n>=i||n<=r?a=c?vTe:fde:n>r&&n<=l?a=c?ATe:wTe:n>l&&n<=s?a=c?fde:vTe:a=c?wTe:ATe;break;case pr.Coconut:a=aQe;break;case pr.Dogwood:n>=i||n<=r?a=c?STe:hde:n>r&&n<=l?a=c?xTe:bTe:n>l&&n<=s?a=c?hde:STe:a=c?bTe:xTe;break;case pr.Elm:n>=i||n<=r?a=c?CTe:pde:n>r&&n<=l?a=c?TTe:PTe:n>l&&n<=s?a=c?pde:CTe:a=c?PTe:TTe;break;case pr.FanPalm:a=lQe;break;case pr.Linden:n>=i||n<=r?a=c?MTe:gde:n>r&&n<=l?a=c?RTe:HTe:n>l&&n<=s?a=c?gde:MTe:a=c?HTe:RTe;break;case pr.Magnolia:n>=i||n<=r?a=c?DTe:mde:n>r&&n<=l?a=c?ITe:zTe:n>l&&n<=s?a=c?mde:DTe:a=c?zTe:ITe;break;case pr.Maple:n>=i||n<=r?a=c?kTe:yde:n>r&&n<=l?a=c?ETe:FTe:n>l&&n<=s?a=c?yde:kTe:a=c?FTe:ETe;break;case pr.Oak:n>=i||n<=r?a=c?NTe:Ade:n>r&&n<=l?a=c?LTe:WTe:n>l&&n<=s?a=c?Ade:NTe:a=c?WTe:LTe;break;case pr.Spruce:a=cQe;break;default:a=sQe}return a}}const utn=be.memo(t=>{var ve;const{parentId:e,id:n,cx:o,cy:r,cz:i,lx:a,lz:l,name:s=pr.Pine,flip:c=!1,locked:u=!1,showModel:d=!1,showLabel:f=!1}=t;let p=!1;M(we=>{if(e===Zo)p=!0;else for(const Pe of we.elements)if(Pe.id===e){p=!0;break}});const g=M(Ap);m.useEffect(()=>{p||g(n,!1)},[p]);const A=M(pn),y=M(Ju)??!1,S=M(Al),C=M(s0),P=M(Pge)??Nq,v=M(Cge)??Uq,T=M(Cs),w=M(pu),x=M(Ub),b=M(Ug),R=M(ly),H=Tc(n),[F,E]=m.useState(!1),{gl:N}=ri(),U=kn(we=>we.contentRef),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(null),j=m.useRef(null),B=m.useRef(null),O=m.useRef(null),V=m.useRef(null),G=m.useRef(null),q=m.useRef(null),$=$t(),ie=m.useMemo(()=>me.dayOfYear(new Date(S)),[S]),Q=m.useMemo(()=>!qz.isEvergreen(t?t.name:pr.Dogwood)&&(C>0?iev:ie>=P&&ie<=v),[ie,P,v,C,t==null?void 0:t.name]),se=m.useRef(!1),oe=M(FH);oe!==se.current&&(se.current=oe,U!=null&&U.current&&W.current&&U.current.add(W.current)),m.useEffect(()=>{if(e!==Zo){const we=ue();we&&W.current&&we.add(W.current)}},[oe]),m.useEffect(()=>{const we=ue();we&&W.current&&we.add(W.current)},[U]);const Z=m.useMemo(()=>new cf().load(qz.fetchTextureImage(s,ie,C,P,v),we=>{c&&(we.wrapS=bs,we.repeat.x=-1),ee(we)}),[s,ie,C,c,P,v]),[te,ee]=m.useState(Z),de=m.useMemo(()=>(t!=null&&t.label?t.label:qz.fetchLabel(s,$))+(u?" ("+Y.t("shared.ElementLocked",$)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",$)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+Y.t("word.MeterAbbreviation",$)),[t==null?void 0:t.label,s,o,r,u,$]),fe=m.useMemo(()=>qz.fetchTheta(s),[s]),pe=a/2,ye=l/2,ae=m.useMemo(()=>new le(0,0,ye),[ye]),Te=m.useMemo(()=>new le(-pe,0,0),[pe]),ge=m.useMemo(()=>new le(pe,0,0),[pe]),Se=m.useMemo(()=>new le(0,-pe,0),[pe]),Re=m.useMemo(()=>new le(0,pe,0),[pe]),De=m.useCallback((we,Pe)=>{dt.getState().duringCameraInteraction||we.intersections.length>0&&(we.intersections[0].object===we.eventObject||we.intersections.length>1&&we.intersections[1].object===we.eventObject)&&(A(Me=>{Me.hoveredHandle=Pe,Me.selectedElementHeight=t.lz}),me.isMoveHandle(Pe)?N.domElement.style.cursor="move":N.domElement.style.cursor="pointer")},[t==null?void 0:t.lz]),Ae=m.useCallback(()=>{A(we=>{we.hoveredHandle=null}),N.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),ue=()=>e!==Zo&&(U!=null&&U.current)?me.getObjectChildById(U.current,e):null;Z2(({camera:we})=>{if(k.current&&W.current&&D.current&&j.current){const{rot:Pe}=me.getWorldDataById(e),{x:Ie,y:Me}=we.position,{x:ze,y:Ne}=W.current.position,{x:Je,y:Ue}=M.getState().sunlightDirection;if(ue()){const We=W.current.localToWorld(new le),Ee=Math.atan2(Ie-We.x,Me-We.y)+Pe;k.current.rotation.set(Qt,-Ee,0),j.current.rotation.set(-Qt,Ee,0),D.current.rotation.set(Qt,-Math.atan2(Je,Ue)-Pe,0)}else{const We=Math.atan2(Ie-ze,Me-Ne);k.current.rotation.set(Qt,-We,0),j.current.rotation.set(-Qt,We,0),D.current.rotation.set(Qt,-Math.atan2(Je,Ue),0)}}});const he=Wg*3;return h.jsx(h.Fragment,{children:p?h.jsx("group",{ref:W,name:"Tree Group "+n,userData:{aabb:!0},position:[o,r,i??0],children:h.jsxs("group",{position:[0,0,l/2],children:[h.jsx(RC,{ref:k,uuid:n,name:s,follow:!1,children:h.jsx(ta,{args:[a,l],children:h.jsx("meshToonMaterial",{map:te,side:ti,alphaTest:.5})})}),h.jsx(RC,{ref:D,name:s+" Shadow Billboard",follow:!1,children:h.jsx(ta,{args:[a,l],castShadow:T,children:h.jsx("meshBasicMaterial",{map:te,side:ti,alphaTest:.5,opacity:0})})}),qz.isConic(s)?h.jsx(xf,{visible:d||y,name:s+" Model",userData:{simulation:!0},position:[0,0,s===pr.Spruce?0:l*.06],args:[a/2,l,8,8,!0],scale:[1,1,1],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:ti,transparent:!0,opacity:.75})}):h.jsx(Ps,{visible:d||y,userData:{simulation:!Q},name:s+" Model",args:[a/2,8,8,0,sa,0,fe],scale:[1,l/a,1],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",side:ti,transparent:!0,opacity:.75})}),h.jsx(RC,{ref:j,name:"Interaction Billboard",visible:!1,position:[0,0,-l/2+.5],children:h.jsx(ta,{ref:L,renderOrder:3,name:s+" plane",args:[a/2,l/3],rotation:[y?Qt:0,0,0],onContextMenu:we=>{w(n,we,Xo.ContextMenu),A(Pe=>{we.intersections.length>0&&we.intersections[0].object===L.current&&(Pe.contextMenuObjectType=z.Tree)})},onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(w(n,we,Xo.Move),kn.setState({treeRef:W}))},onPointerOver:we=>{we.intersections.length>0&&we.intersections[0].object===L.current&&E(!0)},onPointerOut:()=>{E(!1)}})}),H&&u&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-a/2,-l/2,0],[-a/2,l/2,0],[-a/2,l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[a/2,l/2,0],[a/2,-l/2,0],[-a/2,-l/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(ve=k.current)==null?void 0:ve.rotation,color:B0}),H&&!u&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{position:new le(0,0,-l/2),args:[he,6,6,0,Math.PI],name:zo.Default,renderOrder:2,onPointerDown:we=>{we.button!==2&&we.eventObject===we.intersections[0].eventObject&&(w(n,we,Xo.Move),kn.setState({treeRef:W}))},onPointerEnter:we=>{De(we,zo.Default)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===zo.Default||x===zo.Default?ga:iw})}),!y&&h.jsxs(h.Fragment,{children:[h.jsx(si,{ref:B,name:Mt.Top,args:[he,he,he],position:ae,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Top)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Top||b===Mt.Top?ga:$a})}),h.jsx(si,{ref:O,name:Mt.Left,args:[he,he,he],position:Te,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Left)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Left||b===Mt.Left?ga:$a})}),h.jsx(si,{ref:V,name:Mt.Right,args:[he,he,he],position:ge,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Right)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Right||b===Mt.Right?ga:$a})}),h.jsx(si,{ref:G,name:Mt.Lower,args:[he,he,he],position:Se,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Lower)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Lower||b===Mt.Lower?ga:$a})}),h.jsx(si,{ref:q,name:Mt.Upper,args:[he,he,he],position:Re,onPointerDown:we=>{w(n,we,Xo.Resize)},onPointerEnter:we=>{De(we,Mt.Upper)},onPointerLeave:Ae,children:h.jsx("meshBasicMaterial",{attach:"material",color:R===Mt.Upper||b===Mt.Upper?ga:$a})})]})]}),(F||f)&&!H&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:de,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,l/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});function uQe(t){const e=t+"Geometry";return m.forwardRef(({args:n,children:o,...r},i)=>h.jsxs("mesh",{ref:i,...r,children:[h.jsx(e,{attach:"geometry",args:n}),o]}))}const UTe=uQe("ParabolicCylinder"),jTe=uQe("Paraboloid"),dtn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,absorberTubeRadius:c=.05,latusRectum:u=2,tiltAngle:d,relativeAzimuth:f,moduleLength:p,poleHeight:g,poleRadius:A,drawSunBeam:y,rotation:S=[0,0,0],color:C="white",lineColor:P="black",lineWidth:v=.5,showLabel:T=!1,locked:w=!1,parentId:x}=t,b=M(pn),R=M(Al),H=M(s0),F=M(Kn),E=dt(hs),N=M(Pf),U=Cn(c1),W=M(Cs),k=M(Jn),D=M(pu),L=M(ay),j=M(Ug),B=M(Lw),O=Tc(e),{gl:{domElement:V}}=ri(),[G,q]=m.useState(!1),[$,ie]=m.useState(null),[Q,se]=m.useState(1),[oe,Z]=m.useState(null),te=m.useRef(null),ee=m.useRef(null),de=m.useRef(null),fe=m.useRef(null),pe=m.useRef(null),ye=m.useRef(null),ae=m.useRef(null),Te=m.useRef(!1),ge=Math.max(100,10*L),Se=16,Re=B.z<=0,De=$t();let Ae=n,ue=o,he=r;const ve=i/2,we=a/2,Pe=l/2,Ie=g+ve,Me=M(At=>{for(const pt of At.elements)if(pt.id===x)return pt});if(x&&Me)switch(Me.type){case z.Foundation:if(he=Ie+Pe+Me.lz,me.isZero(S[2]))Ae=Me.cx+n*Me.lx,ue=Me.cy+o*Me.ly;else{const At=new le(n*Me.lx,o*Me.ly,0);At.applyAxisAngle(ko,S[2]),Ae=Me.cx+At.x,ue=Me.cy+At.y}break}const ze=ve*ve/u,Ne=.25*u,Je=new le(-ve,-we,Pe+ze),Ue=new le(-ve,we,Pe+ze),nt=new le(ve,-we,Pe+ze),We=new le(ve,we,Pe+ze);m.useEffect(()=>{if(t&&E){const At=U(t.id);At&&Z(me.fetchHeatmapTexture(At,N??5))}},[E,N]),m.useEffect(()=>{se(Math.max(1,Math.round(a/p)))},[a,p]),m.useEffect(()=>{const At=()=>{kn.getState().setEnableOrbitController(!0),Te.current=!1};return window.addEventListener("pointerup",At),()=>{window.removeEventListener("pointerup",At)}},[]);const Ee=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.ParabolicTroughElement",De))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",De)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",De)+": ("+Ae.toFixed(1)+", "+ue.toFixed(1)+", "+he.toFixed(1)+") "+Y.t("word.MeterAbbreviation",De)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ae,ue,he,De]),ke=m.useMemo(()=>new ln(0,0,S[2],"ZXY"),[S]),Oe=(At,pt)=>{At.intersections.length>0&&At.intersections[0].object===At.eventObject&&(ie(pt),pt===zo.Top?V.style.cursor="move":pt===Di.Lower||pt===Di.Upper||pt===Di.Tilt?V.style.cursor="grab":V.style.cursor="pointer")},st=()=>{ie(null),V.style.cursor="default"},je=m.useMemo(()=>ki(new Date(R),H),[R,H]),xt=m.useMemo(()=>{var At;return(At=k(x))==null?void 0:At.rotation[2]},[x]),gt=xt?je.clone().applyAxisAngle(ko,-xt):je,Ye=m.useMemo(()=>je.z>0?new ln(0,Math.atan2(gt.x,gt.z),0,"ZXY"):new ln(d,0,f,"ZXY"),[je,d,f,gt.x,gt.z]),it=m.useMemo(()=>{if(je.z>0){const At=xt?Math.cos(xt):1,pt=xt?Math.sin(xt):0;return-Ne*(je.x*pt+je.y*At)/Math.hypot(je.x,je.z)}return 0},[je,xt,Ne]),ut=new le(0,it,Ne).applyEuler(Ye),Qe=je.clone().multiplyScalar(ge).applyEuler(new ln(-ke.x,0,-ke.z)),lt=-(Ie+l)/2,Ze=m.useMemo(()=>{const At=[],pt=Math.cos(f)*p,Wt=Math.sin(f)*p,ht=Q/2-.5;for(let ct=0;ct{const At=[],pt=a/Q,Wt=-i/u,ht=-2*Wt/Se;for(let ct=0;ct<=Q;ct++){const It=[];for(let Ft=0;Ft<=Se;Ft++){const Ve=Wt+Ft*ht;It.push(new le(u*Ve/2,-we+ct*pt,u*Ve*Ve/4))}At.push({points:It})}return At},[i,a,Q,u]),$e=Math.max(1,(i+a)/16),wt=sR*$e*1.5,vt=Wg*$e*2,Rt=F.length<50&&Be.length<10,Gt=Rt?4:2;return h.jsxs("group",{name:"Parabolic Trough Group "+e,rotation:ke,position:[Ae,ue,he+Pe],children:[h.jsxs("group",{rotation:Ye,children:[h.jsx(UTe,{receiveShadow:W,castShadow:W,uuid:e,ref:te,args:[u/2,i,a,Se,4],name:"Parabolic Trough Front Side",onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Select)},onContextMenu:At=>{D(e,At,Xo.ContextMenu),b(pt=>{At.intersections.length>0&&At.intersections[0].object===te.current&&(pt.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:At=>{At.intersections.length>0&&At.intersections[0].object===te.current&&(q(!0),V.style.cursor="move")},onPointerOut:()=>{q(!1),V.style.cursor="default"},children:E&&oe?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:oe}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"})}),h.jsx(UTe,{receiveShadow:W,castShadow:W,uuid:e+" backside",ref:ee,args:[u/2,i,a,Se,4],name:"Parabolic Trough Back Side",position:[0,0,-Pe/2],onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Select)},onContextMenu:At=>{D(e,At,Xo.ContextMenu),b(pt=>{At.intersections.length>0&&At.intersections[0].object===ee.current&&(pt.contextMenuObjectType=z.ParabolicTrough)})},onPointerOver:At=>{At.intersections.length>0&&At.intersections[0].object===ee.current&&(q(!0),V.style.cursor="move")},onPointerOut:()=>{q(!1),V.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:r0,color:"white"})}),Be&&Be.map((At,pt)=>h.jsxs(be.Fragment,{children:[Rt&&h.jsx(Gn,{name:"Parabolic Trough Rim Lines",userData:{unintersectable:!0},points:At.points,castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),(pt===0||pt===Be.length-1||Rt)&&h.jsx(Gn,{name:"Parabolic Trough Focal Lines",userData:{unintersectable:!0},points:[At.points[Se/2].clone(),At.points[Se/2].clone().add(new le(0,0,Ne))],castShadow:!1,receiveShadow:!1,lineWidth:v,color:Re?"dimgray":"white"})]},pt)),Rt&&h.jsx(Gn,{name:"Parabolic Trough Outline 1",userData:{unintersectable:!0},points:[[-ve,-we,ze],[-ve,we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),Rt&&h.jsx(Gn,{name:"Parabolic Trough Outline 2",userData:{unintersectable:!0},points:[[ve,-we,ze],[ve,we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:v,color:P}),h.jsx(ma,{name:"Parabolic Trough Absorber Tube",uuid:e,args:[c,c,a,Rt?6:2,1],position:[0,0,Ne],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:"white"})}),h.jsx(ta,{name:"Parabolic Trough Simulation Plane",uuid:e,args:[i,a],position:[0,0,ze],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),O&&w&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ve,-we,ze],[-ve,we,ze],[ve,we,ze],[ve,-we,ze],[-ve,-we,ze]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),O&&!w&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:de,position:new le(0,0,0),args:[vt,6,6],name:zo.Default,onPointerOver:At=>{Oe(At,zo.Top)},onPointerOut:()=>{st()},onPointerDown:At=>{At.button!==2&&D(e,At,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:fe,position:[(Je.x+nt.x)/2,Je.y,Je.z-ze],args:[wt,wt,l*1.2],name:Mt.Lower,onPointerDown:At=>{D(e,At,Xo.Resize),ye.current&&b(pt=>{const Wt=fe.current.localToWorld(new le(0,a,-Je.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Lower)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Lower||j===Mt.Lower?ga:$a})}),h.jsx(si,{ref:pe,position:[(Ue.x+We.x)/2,Ue.y,Ue.z-ze],args:[wt,wt,l*1.2],name:Mt.Upper,onPointerDown:At=>{D(e,At,Xo.Resize),ye.current&&b(pt=>{const Wt=pe.current.localToWorld(new le(0,-a,-Ue.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Upper)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Upper||j===Mt.Upper?ga:$a})}),h.jsx(si,{ref:ye,position:[Je.x,(Je.y+Ue.y)/2,Je.z],args:[wt,wt,l*1.2],name:Mt.Left,onPointerDown:At=>{D(e,At,Xo.Resize),ye.current&&b(pt=>{const Wt=ye.current.localToWorld(new le(i,0,-Je.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Left)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Left||j===Mt.Left?ga:$a})}),h.jsx(si,{ref:ae,position:[nt.x,(nt.y+We.y)/2,nt.z],args:[wt,wt,l*1.2],name:Mt.Right,onPointerDown:At=>{D(e,At,Xo.Resize),ye.current&&b(pt=>{const Wt=ae.current.localToWorld(new le(-i,0,-nt.z));pt.resizeAnchor.copy(Wt)})},onPointerOver:At=>{Oe(At,Mt.Right)},onPointerOut:()=>{st()},children:h.jsx("meshBasicMaterial",{attach:"material",color:$===Mt.Right||j===Mt.Right?ga:$a})})]})]})]}),Ie>0&&Ze.map((At,pt)=>pt%5!==0&&!Rt?h.jsx(be.Fragment,{},pt):h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+pt,castShadow:!1,receiveShadow:!1,args:[A,A,Ie+(At.z-lt)*2+l,Gt,1],position:At,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:C})},pt)),y&&je.z>0&&h.jsx(Gn,{userData:{unintersectable:!0},points:[ut,new le(-.3*ve,0,.09*ze).applyEuler(Ye),Qe,new le(-.6*ve,0,.36*ze).applyEuler(Ye),ut,new le(-.9*ve,0,.81*ze).applyEuler(Ye),Qe,new le(0,0,0),ut,new le(.3*ve,0,.09*ze).applyEuler(Ye),Qe,new le(.6*ve,0,.36*ze).applyEuler(Ye),ut,new le(.9*ve,0,.81*ze).applyEuler(Ye),Qe],name:"Sun Beams",lineWidth:.25,color:"white"}),(G||T)&&!O&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Ee,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(we*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),ftn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,structureType:c=sf.CentralPole,receiverRadius:u=.25,receiverPoleRadius:d=.1,latusRectum:f=2,tiltAngle:p,relativeAzimuth:g,poleHeight:A,poleRadius:y=.2,drawSunBeam:S,rotation:C=[0,0,0],color:P="white",lineColor:v="black",lineWidth:T=.25,showLabel:w=!1,locked:x=!1,parentId:b}=t,R=M(pn),H=M(Al),F=M(s0),E=M(Kn),N=dt(hs),U=M(Pf),W=Cn(c1),k=M(Cs),D=M(Jn),L=M(pu),j=M(ay),B=M(Ug),O=M(Lw),V=Tc(e),{gl:{domElement:G}}=ri(),[q,$]=m.useState(!1),[ie,Q]=m.useState(null),[se,oe]=m.useState(null),Z=m.useRef(null),te=m.useRef(null),ee=m.useRef(null),de=m.useRef(null),fe=m.useRef(null),pe=m.useRef(null),ye=m.useRef(null),ae=m.useRef(!1),Te=Math.max(100,10*j),ge=32,Se=8,Re=O.z<=0;let De=n,Ae=o,ue=r;const he=i/2,ve=a/2,we=l/2,Pe=A+he,Ie=$t(),Me=M(pt=>{for(const Wt of pt.elements)if(Wt.id===b)return Wt});if(b&&Me)switch(Me.type){case z.Foundation:if(ue=Pe+we+Me.lz,me.isZero(C[2]))De=Me.cx+n*Me.lx,Ae=Me.cy+o*Me.ly;else{const pt=new le(n*Me.lx,o*Me.ly,0);pt.applyAxisAngle(ko,C[2]),De=Me.cx+pt.x,Ae=Me.cy+pt.y}break}const ze=he*he/f,Ne=.25*f,Je=new le(-he,-ve,we+ze),Ue=new le(-he,ve,we+ze),nt=new le(he,-ve,we+ze),We=new le(he,ve,we+ze),Ee=Hb(Jye),ke=u+1;m.useEffect(()=>{if(t&&N){const pt=W(t.id);pt&&oe(me.fetchHeatmapTexture(pt,U??5))}},[N,U]),m.useEffect(()=>{const pt=()=>{kn.getState().setEnableOrbitController(!0),ae.current=!1};return window.addEventListener("pointerup",pt),()=>{window.removeEventListener("pointerup",pt)}},[]);const Oe=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.ParabolicDishElement",Ie))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Ie)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",Ie)+": ("+De.toFixed(1)+", "+Ae.toFixed(1)+", "+ue.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Ie)),[t==null?void 0:t.label,t==null?void 0:t.locked,Ie,De,Ae,ue]),st=m.useMemo(()=>new ln(0,0,C[2],"ZXY"),[C]),je=(pt,Wt)=>{pt.intersections.length>0&&pt.intersections[0].object===pt.eventObject&&(Q(Wt),Wt===zo.Top?G.style.cursor="move":Wt===Di.Lower||Wt===Di.Upper||Wt===Di.Tilt?G.style.cursor="grab":G.style.cursor="pointer")},xt=()=>{Q(null),G.style.cursor="default"},gt=m.useMemo(()=>ki(new Date(H),F),[H,F]),Ye=m.useMemo(()=>{var pt;return(pt=D(b))==null?void 0:pt.rotation[2]},[b]),it=Ye?gt.clone().applyAxisAngle(ko,-Ye):gt,ut=m.useMemo(()=>{if(gt.z>0){const pt=Math.hypot(it.x,it.y);return new ln(Math.atan2(pt,it.z),0,Math.atan2(it.y,it.x)+Qt,"ZXY")}return new ln(p,0,g,"ZXY")},[gt,p,g,it.x,it.y,it.z]),Qe=-(Pe+l)/2,lt=E.length<50,Ze=m.useMemo(()=>{const pt=[];if(lt){const Wt=[],ht=[];let ct,It,Ft;const Ve=.25*ze;for(let ft=0;ft<=ge;ft++)ct=sa*ft/ge,It=Math.cos(ct),Ft=Math.sin(ct),Wt.push(new le(he*It,he*Ft,ze)),ht.push(new le(he*It/2,he*Ft/2,Ve));pt.push({points:Wt}),pt.push({points:ht});for(let ft=0;ft<12;ft++){ct=sa*ft/12,It=Math.cos(ct),Ft=Math.sin(ct);const kt=[];for(let rt=0;rt<=Se;rt++){const at=rt===0?0:rt/Se*he;kt.push(new le(at*It,at*Ft,at*at/f+.01))}pt.push({points:kt})}}return pt},[he,f,lt]),Be=m.useMemo(()=>{if(c===sf.CentralPoleWithTripod){const pt=[];let Wt;for(let ht=0;ht<3;ht++){Wt=sa*ht/3;const ct=[];ct.push(new le(he*Math.cos(Wt),he*Math.sin(Wt),ze)),ct.push(new le(0,0,Ne)),pt.push({points:ct})}return pt}},[he,f,c]),$e=m.useMemo(()=>{if(c===sf.Quadrupod){const pt=[];let Wt;for(let ht=0;ht<4;ht++){Wt=sa*ht/4;const ct=[];ct.push(new le(he*Math.cos(Wt),he*Math.sin(Wt),ze)),ct.push(new le(0,0,Ne)),pt.push({points:ct})}return pt}},[he,f,c]),wt=Math.max(1,(i+a)/16),vt=sR*wt*1.5,Rt=Wg*wt*3,Gt=gt.clone().multiplyScalar(Te),At=new le(0,0,Ne).applyEuler(ut);return h.jsxs("group",{name:"Parabolic Dish Group "+e,rotation:st,position:[De,Ae,ue+we],children:[h.jsxs("group",{rotation:ut,children:[h.jsx(jTe,{receiveShadow:k,castShadow:k,uuid:e,ref:Z,args:[f/2,he,ge,Se],name:"Parabolic Dish Front Side",onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Select)},onContextMenu:pt=>{L(e,pt,Xo.ContextMenu),R(Wt=>{pt.intersections.length>0&&pt.intersections[0].object===Z.current&&(Wt.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:pt=>{pt.intersections.length>0&&pt.intersections[0].object===Z.current&&($(!0),G.style.cursor="move")},onPointerOut:()=>{$(!1),G.style.cursor="default"},children:N&&se?h.jsx("meshBasicMaterial",{attach:"material",side:Da,map:se}):h.jsx("meshPhongMaterial",{attach:"material",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"})}),h.jsx(jTe,{receiveShadow:k,castShadow:k,uuid:e+" backside",ref:te,args:[f/2,he,ge,Se],name:"Parabolic Dish Back Side",position:[0,0,-we/4],onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Select)},onContextMenu:pt=>{L(e,pt,Xo.ContextMenu),R(Wt=>{pt.intersections.length>0&&pt.intersections[0].object===te.current&&(Wt.contextMenuObjectType=z.ParabolicDish)})},onPointerOver:pt=>{pt.intersections.length>0&&pt.intersections[0].object===te.current&&($(!0),G.style.cursor="move")},onPointerOut:()=>{$(!1),G.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",side:r0,color:P})}),Ze&&Ze.length>0&&Ze.map((pt,Wt)=>h.jsx(be.Fragment,{children:h.jsx(Gn,{name:"Parabolic Dish Wireframe",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:T,color:v})},Wt)),h.jsx(ma,{name:"Parabolic Dish Receiver",uuid:e,args:[u,u,.5,lt?12:4,1],rotation:[Qt,0,0],position:[0,0,Ne-.1],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),gt.z>0&&h.jsx("mesh",{position:[0,0,Ne-.1],children:h.jsx("sprite",{scale:[ke,ke,ke],children:h.jsx("spriteMaterial",{map:Ee,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})}),(c===sf.CentralPole||c===sf.CentralPoleWithTripod)&&h.jsx(ma,{name:"Parabolic Dish Receiver Pole",uuid:e,args:[d,d,Ne,lt?6:2,1],rotation:[Qt,0,0],position:[0,0,Ne/2],receiveShadow:!1,castShadow:!0,children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),c===sf.CentralPoleWithTripod&&Be&&Be.map((pt,Wt)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Parabolic Dish Tripod Lines",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:1,color:Re?"dimgray":P}),h.jsx(Ps,{position:new le(pt.points[0].x,pt.points[0].y,pt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Tripod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Wt)),c===sf.Quadrupod&&$e&&$e.map((pt,Wt)=>h.jsxs(be.Fragment,{children:[h.jsx(Gn,{name:"Parabolic Dish Quadrupod Lines",userData:{unintersectable:!0},points:pt.points,castShadow:!1,receiveShadow:!1,lineWidth:2,color:Re?"dimgray":P}),h.jsx(Ps,{position:new le(pt.points[0].x,pt.points[0].y,pt.points[0].z),args:[d/2,4,4],name:"Parabolic Dish Quadrupod Joint",children:h.jsx("meshStandardMaterial",{attach:"material",color:P})})]},Wt)),h.jsx(uR,{name:"Parabolic Dish Simulation Circle",uuid:e,args:[i/2,ge],position:[0,0,ze],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),V&&x&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-he,-ve,ze],[-he,ve,ze],[he,ve,ze],[he,-ve,ze],[-he,-ve,ze]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),V&&!x&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:ee,position:new le(0,0,0),args:[Rt,6,6],name:zo.Default,onPointerOver:pt=>{je(pt,zo.Top)},onPointerOut:()=>{xt()},onPointerDown:pt=>{pt.button!==2&&L(e,pt,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:de,position:[(Je.x+nt.x)/2,Je.y,Je.z],args:[vt,vt,l*1.2],name:Mt.Lower,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=de.current.localToWorld(new le(0,a,-Je.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Lower)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Lower||B===Mt.Lower?ga:$a})}),h.jsx(si,{ref:fe,position:[(Ue.x+We.x)/2,Ue.y,Ue.z],args:[vt,vt,l*1.2],name:Mt.Upper,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=fe.current.localToWorld(new le(0,-a,-Ue.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Upper)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Upper||B===Mt.Upper?ga:$a})}),h.jsx(si,{ref:pe,position:[Je.x,(Je.y+Ue.y)/2,Je.z],args:[vt,vt,l*1.2],name:Mt.Left,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=pe.current.localToWorld(new le(i,0,-Je.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Left)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Left||B===Mt.Left?ga:$a})}),h.jsx(si,{ref:ye,position:[nt.x,(nt.y+We.y)/2,nt.z],args:[vt,vt,l*1.2],name:Mt.Right,onPointerDown:pt=>{L(e,pt,Xo.Resize),pe.current&&R(Wt=>{const ht=ye.current.localToWorld(new le(-i,0,-nt.z));Wt.resizeAnchor.copy(ht)})},onPointerOver:pt=>{je(pt,Mt.Right)},onPointerOut:()=>{xt()},children:h.jsx("meshBasicMaterial",{attach:"material",color:ie===Mt.Right||B===Mt.Right?ga:$a})})]})]})]}),Pe>0&&h.jsx(ma,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[y,y,Pe+l,lt?4:2,1],position:[0,0,Qe],rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:P})}),S&>.z>0&&h.jsx(Gn,{rotation:[-st.x,0,-st.z],userData:{unintersectable:!0},points:[At,new le(-.3*he,0,.09*ze).applyEuler(ut),Gt,new le(-.6*he,0,.36*ze).applyEuler(ut),At,new le(-.9*he,0,.81*ze).applyEuler(ut),Gt,At,new le(.3*he,0,.09*ze).applyEuler(ut),Gt,new le(.6*he,0,.36*ze).applyEuler(ut),At,new le(.9*he,0,.81*ze).applyEuler(ut),Gt],name:"Sun Beams",lineWidth:.25,color:"white"}),(q||w)&&!V&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:Oe,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(ve*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),htn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,moduleLength:d,poleHeight:f,poleRadius:p=.1,drawSunBeam:g,rotation:A=[0,0,0],color:y="white",lineColor:S="black",lineWidth:C=.5,showLabel:P=!1,locked:v=!1,parentId:T,receiverId:w}=t,x=M(pn),b=M(m0),R=M(Al),H=M(s0),F=M(Kn),E=dt(hs),N=M(Pf),U=Cn(c1),W=M(Cs),k=M(Jn),D=M(pu),L=M(ay),j=M(Ug),B=Tc(e),{gl:{domElement:O}}=ri(),[V,G]=m.useState(!1),[q,$]=m.useState(null),[ie,Q]=m.useState(1),[se,oe]=m.useState(null),Z=m.useRef(null),te=m.useRef(null),ee=m.useRef(null),de=m.useRef(null),fe=m.useRef(null),pe=m.useRef(null),ye=m.useRef(!1),ae=Math.max(100,10*L),Te=m.useMemo(()=>({lng:b}),[b]);let ge=n,Se=o,Re=r;const De=i/2,Ae=a/2,ue=l/2,he=f+De,ve=M(Qe=>{for(const lt of Qe.elements)if(lt.id===T)return lt});if(ve)switch(ve.type){case z.Foundation:if(Re=he+ue+ve.lz,me.isZero(A[2]))ge=ve.cx+n*ve.lx,Se=ve.cy+o*ve.ly;else{const Qe=new le(n*ve.lx,o*ve.ly,0);Qe.applyAxisAngle(ko,A[2]),ge=ve.cx+Qe.x,Se=ve.cy+Qe.y}break}const we=new le(-De,-Ae,ue),Pe=new le(-De,Ae,ue),Ie=new le(De,-Ae,ue),Me=new le(De,Ae,ue);m.useEffect(()=>{if(t&&E){const Qe=U(t.id);Qe&&oe(me.fetchHeatmapTexture(Qe,N??5))}},[E,N]),m.useEffect(()=>{Q(Math.max(1,Math.round(a/d)))},[a,d]),m.useEffect(()=>{const Qe=()=>{kn.getState().setEnableOrbitController(!0),ye.current=!1};return window.addEventListener("pointerup",Qe),()=>{window.removeEventListener("pointerup",Qe)}},[]);const ze=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.FresnelReflectorElement",Te))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Te)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",Te)+": ("+ge.toFixed(1)+", "+Se.toFixed(1)+", "+Re.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Te)),[t==null?void 0:t.label,t==null?void 0:t.locked,Te,ge,Se,Re]),Ne=m.useMemo(()=>new ln(0,0,A[2],"ZXY"),[A]),Je=(Qe,lt)=>{Qe.intersections.length>0&&Qe.intersections[0].object===Qe.eventObject&&($(lt),lt===zo.Top?O.style.cursor="move":lt===Di.Lower||lt===Di.Upper||lt===Di.Tilt?O.style.cursor="grab":O.style.cursor="pointer")},Ue=()=>{$(null),O.style.cursor="default"},nt=m.useMemo(()=>ki(new Date(R),H),[R,H]),We=ve==null?void 0:ve.rotation[2],Ee=w&&w!==T?k(w):null,ke=m.useMemo(()=>{if(Ee){if(Ee.type===z.Foundation){const Qe=Ee;if(Qe.solarStructure===Dn.FocusPipe&&Qe.solarAbsorberPipe)return new le((Qe.cx-ge)*(We?Math.cos(We):1),(Qe.cy-Se)*(We?Math.sin(We):0),Qe.cz-Re+Qe.lz/2+(Qe.solarAbsorberPipe.absorberHeight??10))}}else if(ve&&ve.type===z.Foundation){const Qe=ve;if(Qe.solarStructure===Dn.FocusPipe&&Qe.solarAbsorberPipe)return new le((Qe.cx-ge)*(We?Math.cos(We):1),(Qe.cy-Se)*(We?Math.sin(We):0),Qe.cz-Re+Qe.lz/2+(Qe.solarAbsorberPipe.absorberHeight??10))}return null},[Ee,ve,ge,Se,Re,We]),Oe=m.useRef(new le),st=m.useMemo(()=>{if(ke&&nt.z>0){const Qe=We?new le(Math.sin(We),Math.cos(We),0):new le(0,1,0);Oe.current.set(ke.x,ke.y,ke.z);const lt=nt.z{const Qe=[],lt=Math.cos(u)*d,Ze=Math.sin(u)*d,Be=ie/2-.5;for(let $e=0;$e{const Qe=[],lt=a/ie;for(let Ze=0;Ze<=ie;Ze++){const Be=[];Be.push(new le(-De,-Ae+Ze*lt,ue)),Be.push(new le(De,-Ae+Ze*lt,ue)),Qe.push({points:Be})}return Qe},[i,a,ue,ie]),Ye=Math.max(1,Math.min(i*5,a*5,(i+a)/16)),it=sR*Ye*1.5,ut=Wg*Ye*2;return h.jsxs("group",{name:"Fresnel Reflector Group "+e,rotation:Ne,position:[ge,Se,Re+ue],children:[h.jsxs("group",{rotation:st,children:[h.jsxs(si,{receiveShadow:W,castShadow:W,uuid:e,ref:Z,args:[i,a,l],name:"Fresnel Reflector",onPointerDown:Qe=>{Qe.button!==2&&D(e,Qe,Xo.Select)},onContextMenu:Qe=>{D(e,Qe,Xo.ContextMenu),x(lt=>{Qe.intersections.length>0&&Qe.intersections[0].object===Z.current&&(lt.contextMenuObjectType=z.FresnelReflector)})},onPointerOver:Qe=>{Qe.intersections.length>0&&Qe.intersections[0].object===Z.current&&(G(!0),O.style.cursor="move")},onPointerOut:()=>{G(!1),O.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:y}),h.jsx("meshStandardMaterial",{attach:"material-1",color:y}),h.jsx("meshStandardMaterial",{attach:"material-2",color:y}),h.jsx("meshStandardMaterial",{attach:"material-3",color:y}),E&&se?h.jsx("meshBasicMaterial",{attach:"material-4",side:Da,map:se}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:y})]}),gt&>.map((Qe,lt)=>h.jsx(Gn,{name:"Fresnel Reflector Module Line",userData:{unintersectable:!0},points:Qe.points,castShadow:!1,receiveShadow:!1,lineWidth:C,color:S},lt)),h.jsx(Gn,{name:"Fresnel Reflector Outline 1",userData:{unintersectable:!0},points:[[-De,-Ae,ue],[-De,Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:S}),h.jsx(Gn,{name:"Fresnel Reflector Outline 2",userData:{unintersectable:!0},points:[[De,-Ae,ue],[De,Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:C,color:S}),h.jsx(ta,{name:"Fresnel Reflector Simulation Plane",uuid:e,args:[i,a],position:[0,0,ue],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),B&&v&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-De,-Ae,ue],[-De,Ae,ue],[De,Ae,ue],[De,-Ae,ue],[-De,-Ae,ue]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),B&&!v&&h.jsxs(h.Fragment,{children:[h.jsx(Ps,{ref:te,position:new le(0,0,0),args:[ut,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Qe=>{Je(Qe,zo.Top)},onPointerOut:()=>{Ue()},onPointerDown:Qe=>{Qe.button!==2&&D(e,Qe,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})}),h.jsxs("group",{children:[h.jsx(si,{ref:ee,position:[(we.x+Ie.x)/2,we.y,we.z-ue],args:[it,it,l*1.2],name:Mt.Lower,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),fe.current&&x(lt=>{const Ze=ee.current.localToWorld(new le(0,a,-we.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Lower)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Lower||j===Mt.Lower?ga:$a})}),h.jsx(si,{ref:de,position:[(Pe.x+Me.x)/2,Pe.y,Pe.z-ue],args:[it,it,l*1.2],name:Mt.Upper,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),fe.current&&x(lt=>{const Ze=de.current.localToWorld(new le(0,-a,-Pe.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Upper)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Upper||j===Mt.Upper?ga:$a})}),h.jsx(si,{ref:fe,position:[we.x,(we.y+Pe.y)/2,we.z],args:[it,it,l*1.2],name:Mt.Left,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),fe.current&&x(lt=>{const Ze=fe.current.localToWorld(new le(i,0,-we.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Left)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Left||j===Mt.Left?ga:$a})}),h.jsx(si,{ref:pe,position:[Ie.x,(Ie.y+Me.y)/2,Ie.z],args:[it,it,l*1.2],name:Mt.Right,castShadow:!1,receiveShadow:!1,onPointerDown:Qe=>{D(e,Qe,Xo.Resize),fe.current&&x(lt=>{const Ze=pe.current.localToWorld(new le(-i,0,-Ie.z));lt.resizeAnchor.copy(Ze)})},onPointerOver:Qe=>{Je(Qe,Mt.Right)},onPointerOut:()=>{Ue()},children:h.jsx("meshBasicMaterial",{attach:"material",color:q===Mt.Right||j===Mt.Right?ga:$a})})]})]})]}),he>0&&xt.map((Qe,lt)=>{const Ze=F.length<100?4:2;return h.jsx(ma,{userData:{unintersectable:!0},name:"Pole "+lt,castShadow:!1,receiveShadow:!1,args:[p,p,he+(Qe.z-je)*2+l,Ze,1],position:Qe,rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:y})},lt)}),g&&nt.z>0&&h.jsx(Gn,{rotation:[-Ne.x,0,-Ne.z],userData:{unintersectable:!0},points:ke?[Oe.current,new le(0,0,ue),nt.clone().multiplyScalar(ae)]:[new le(0,0,ue),nt.clone().multiplyScalar(ae)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(V||P)&&!B&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:ze,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(Ae*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),ptn=be.memo(t=>{const{id:e,cx:n,cy:o,cz:r,lx:i,ly:a,lz:l=.1,reflectance:s=.9,tiltAngle:c,relativeAzimuth:u,poleHeight:d,poleRadius:f=Math.min(i,a)/20,drawSunBeam:p,rotation:g=[0,0,0],color:A="white",lineColor:y="black",lineWidth:S=.5,showLabel:C=!1,locked:P=!1,parentId:v,towerId:T}=t,w=M(pn),x=M(Al),b=M(s0),R=M(Kn),H=dt(hs),F=M(Pf),E=Cn(c1),N=M(Cs),U=M(Jn),W=M(pu),k=M(ay),D=Tc(e),{gl:{domElement:L}}=ri(),[j,B]=m.useState(!1),[O,V]=m.useState(null),G=m.useRef(null),q=m.useRef(null),$=m.useRef(!1),ie=Math.max(100,10*k),Q=$t();let se=n,oe=o,Z=r;const te=i/2,ee=a/2,de=l/2,fe=d+Math.max(te,ee),pe=M(Pe=>{for(const Ie of Pe.elements)if(Ie.id===v)return Ie});if(pe)switch(pe.type){case z.Foundation:if(Z=fe+de+pe.lz,me.isZero(g[2]))se=pe.cx+n*pe.lx,oe=pe.cy+o*pe.ly;else{const Pe=new le(n*pe.lx,o*pe.ly,0);Pe.applyAxisAngle(ko,g[2]),se=pe.cx+Pe.x,oe=pe.cy+Pe.y}break}m.useEffect(()=>{if(t&&H){const Pe=E(t.id);Pe&&V(me.fetchHeatmapTexture(Pe,F??5))}},[H,F]),m.useEffect(()=>{const Pe=()=>{kn.getState().setEnableOrbitController(!0),$.current=!1};return window.addEventListener("pointerup",Pe),()=>{window.removeEventListener("pointerup",Pe)}},[]);const ye=m.useMemo(()=>(t!=null&&t.label?t.label:Y.t("shared.HeliostatElement",Q))+(t!=null&&t.locked?" ("+Y.t("shared.ElementLocked",Q)+")":"")+(t!=null&&t.label?"":` +`+Y.t("word.Coordinates",Q)+": ("+se.toFixed(1)+", "+oe.toFixed(1)+", "+Z.toFixed(1)+") "+Y.t("word.MeterAbbreviation",Q)),[t==null?void 0:t.label,t==null?void 0:t.locked,Q,se,oe,Z]),ae=m.useMemo(()=>new ln(0,0,g[2],"ZXY"),[g]),Te=(Pe,Ie)=>{Pe.intersections.length>0&&Pe.intersections[0].object===Pe.eventObject&&(L.style.cursor=Ie===zo.Default?"move":"pointer")},ge=()=>{L.style.cursor="default"},Se=m.useMemo(()=>ki(new Date(x),b),[x,b]),Re=pe==null?void 0:pe.rotation[2],De=T&&T!==v?U(T):null,Ae=m.useMemo(()=>{if(De){if(De.type===z.Foundation){const Pe=De;if(Pe.solarStructure===Dn.FocusTower&&Pe.solarPowerTower)return new le(Pe.cx-se,Pe.cy-oe,Pe.cz-Z+Pe.lz/2+(Pe.solarPowerTower.towerHeight??20))}}else if(pe&&pe.type===z.Foundation){const Pe=pe;if(Pe.solarStructure===Dn.FocusTower&&Pe.solarPowerTower)return new le(Pe.cx-se,Pe.cy-oe,Pe.cz-Z+Pe.lz/2+(Pe.solarPowerTower.towerHeight??20))}return null},[pe,se,oe,Z,De]),ue=m.useMemo(()=>{if(Ae&&Se.z>0){let Ie=Ae.clone().normalize().add(Se).normalize();me.isSame(Ie,ko)&&(Ie=new le(-.001,0,1).normalize()),Re&&Ie.applyAxisAngle(ko,-Re);const Me=Math.hypot(Ie.x,Ie.y);return new ln(Math.atan2(Me,Ie.z),0,Math.atan2(Ie.y,Ie.x)+Qt,"ZXY")}return new ln(c,0,u,"ZXY")},[Ae,Se,c,u,Re]),he=-(fe+l)/2,ve=Math.max(1,(i+a)/8),we=Wg*ve*4;return h.jsxs("group",{name:"Heliostat Group "+e,rotation:ae,position:[se,oe,Z+de],children:[h.jsxs("group",{rotation:ue,children:[h.jsxs(si,{receiveShadow:N,castShadow:N,uuid:e,ref:G,args:[i,a,l],name:"Heliostat",onPointerDown:Pe=>{Pe.button!==2&&W(e,Pe,Xo.Select)},onContextMenu:Pe=>{W(e,Pe,Xo.ContextMenu),w(Ie=>{Pe.intersections.length>0&&Pe.intersections[0].object===G.current&&(Ie.contextMenuObjectType=z.Heliostat)})},onPointerOver:Pe=>{Pe.intersections.length>0&&Pe.intersections[0].object===G.current&&(B(!0),L.style.cursor="move")},onPointerOut:()=>{B(!1),L.style.cursor="default"},children:[h.jsx("meshStandardMaterial",{attach:"material-0",color:A}),h.jsx("meshStandardMaterial",{attach:"material-1",color:A}),h.jsx("meshStandardMaterial",{attach:"material-2",color:A}),h.jsx("meshStandardMaterial",{attach:"material-3",color:A}),H&&O?h.jsx("meshBasicMaterial",{attach:"material-4",side:Da,map:O}):h.jsx("meshPhongMaterial",{attach:"material-4",specular:new rr("white"),shininess:100*s,side:Da,color:"lightskyblue"}),h.jsx("meshStandardMaterial",{attach:"material-5",color:A})]}),h.jsx(ta,{name:"Heliostat Simulation Plane",uuid:e,args:[i,a],position:[0,0,de],userData:{simulation:!0},receiveShadow:!1,castShadow:!1,visible:!1,children:h.jsx("meshBasicMaterial",{side:ti})}),D&&P&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-te,-ee,de],[-te,ee,de],[te,ee,de],[te,-ee,de],[-te,-ee,de]],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),D&&!P&&h.jsx(Ps,{ref:q,position:new le(0,0,0),args:[we,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:Pe=>{Te(Pe,zo.Default)},onPointerOut:()=>{ge()},onPointerDown:Pe=>{Pe.button!==2&&W(e,Pe,Xo.Move)},children:h.jsx("meshBasicMaterial",{attach:"material",color:"orange"})})]}),fe>0&&h.jsx(ma,{userData:{unintersectable:!0},name:"Pole",castShadow:!1,receiveShadow:!1,args:[f,f,fe+l,R.length<100?4:2,1],position:new le(0,0,he),rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:A})}),p&&Se.z>0&&h.jsx(Gn,{rotation:[-ae.x,0,-ae.z],userData:{unintersectable:!0},points:Ae?[Ae,new le(0,0,de),Se.clone().multiplyScalar(ie)]:[new le(0,0,de),Se.clone().multiplyScalar(ie)],name:"Sun Beam",lineWidth:.25,color:"white",castShadow:!1,receiveShadow:!1}),(j||C)&&!D&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:ye,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,castShadow:!1,receiveShadow:!1,position:[0,0,(t==null?void 0:t.labelHeight)??Math.max(ee*Math.abs(Math.sin(t.tiltAngle))+.1,.2)]})]})}),gtn=be.memo(t=>{var oe;const{parentId:e,id:n,cx:o,cy:r,cz:i,name:a=ro.WhiteFlower,flip:l=!1,locked:s=!1}=t;let c=!1;M(Z=>{if(e===Zo)c=!0;else for(const te of Z.elements)if(te.id===e){c=!0;break}});const u=M(Ap);m.useEffect(()=>{c||u(n,!1)},[c]);const d=M(pn),f=M(m0),p=M(Ju)??!1,g=M(Al),A=M(s0),y=M(Pge)??Nq,S=M(Cge)??Uq,C=M(pu),P=M(Ub),v=M(ly),T=dt(hs),[w,x]=m.useState(!1),{gl:b}=ri(),R=Tc(n),H=kn(Z=>Z.contentRef),F=m.useRef(null),E=m.useRef(null),N=m.useRef(null),U=m.useRef(null),W=m.useMemo(()=>({lng:f}),[f]),k=m.useMemo(()=>{const Z=me.dayOfYear(new Date(g));return A>0?ZS:Z>=y&&Z<=S},[g,y,S,A]),D=m.useRef(!1),L=M(FH);L!==D.current&&(D.current=L,H!=null&&H.current&&F.current&&H.current.add(F.current)),m.useEffect(()=>{if(e!==Zo){const Z=$();Z&&F.current&&Z.add(F.current)}},[L,e]),m.useEffect(()=>{const Z=$();Z&&F.current&&Z.add(F.current)},[H]);const j=m.useMemo(()=>new cf().load(A8.fetchTextureImage(a,k),Z=>{l&&(Z.wrapS=bs,Z.repeat.x=-1),O(Z)}),[a,k,l]),[B,O]=m.useState(j),V=m.useMemo(()=>A8.fetchLabel(a,W)+(s?" ("+Y.t("shared.ElementLocked",W)+")":"")+` +`+Y.t("word.Coordinates",W)+": ("+o.toFixed(1)+", "+r.toFixed(1)+") "+Y.t("word.MeterAbbreviation",W),[a,o,r,s,W]),G=m.useCallback((Z,te)=>{dt.getState().duringCameraInteraction||Z.intersections.length>0&&(Z.intersections[0].object===Z.eventObject||Z.intersections.length>1&&Z.intersections[1].object===Z.eventObject)&&(d(de=>{de.hoveredHandle=te,de.selectedElementHeight=t.lz}),me.isMoveHandle(te)?b.domElement.style.cursor="move":b.domElement.style.cursor="pointer")},[t.lz]),q=m.useCallback(()=>{d(Z=>{Z.hoveredHandle=null}),b.domElement.style.cursor=M.getState().addedCuboidId?"crosshair":"default"},[]),$=()=>e!==Zo&&(H!=null&&H.current)?me.getObjectChildById(H.current,e):null,ie=m.useMemo(()=>A8.fetchSpread(a),[a]),Q=m.useMemo(()=>A8.fetchHeight(a),[a]);Z2(({camera:Z})=>{if(F.current){const{rot:te}=me.getWorldDataById(e);if(p)E.current&&U.current&&(E.current.rotation.set(Qt,0,0),U.current.rotation.set(0,0,0)),F.current.rotation.set(-Qt,0,0);else{if(E.current&&U.current){const{x:ee,y:de}=Z.position,{x:fe,y:pe}=F.current.position;if($()){const ae=F.current.localToWorld(new le),Te=Math.atan2(ee-ae.x,de-ae.y)+te;E.current.rotation.set(Qt,-Te,0),U.current.rotation.set(-Qt,Te,0)}else{const ae=Math.atan2(ee-fe,de-pe);E.current.rotation.set(Qt,-ae,0),U.current.rotation.set(-Qt,ae,0)}}F.current.rotation.set(0,0,0)}}});const se=Wg*3;return h.jsx(h.Fragment,{children:c?h.jsx("group",{ref:F,name:"Flower Group "+n,userData:{aabb:!0},position:[o,r,(i??0)+(p?.25:0)],children:h.jsxs("group",{position:[0,0,Q/2],children:[h.jsx(RC,{ref:E,uuid:n,name:a,follow:!1,rotation:[Qt,0,0],children:h.jsx(ta,{args:[ie,Q],receiveShadow:!T,children:h.jsx("meshToonMaterial",{map:B,side:ti,alphaTest:.5})})}),h.jsx(RC,{ref:U,name:"Interaction Billboard",visible:!1,position:[0,0,-Q/2],children:h.jsx(ta,{ref:N,renderOrder:3,name:a+" plane",args:[ie/2,Q*2],rotation:[p?Qt:0,0,0],onContextMenu:Z=>{C(n,Z,Xo.ContextMenu),d(te=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&(te.contextMenuObjectType=z.Flower)})},onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,Xo.Move),kn.setState({flowerRef:F}))},onPointerOver:Z=>{Z.intersections.length>0&&Z.intersections[0].object===N.current&&x(!0)},onPointerOut:()=>{x(!1)}})}),R&&s&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-ie/2,-Q/2,0],[-ie/2,Q/2,0],[-ie/2,Q/2,0],[ie/2,Q/2,0],[ie/2,-Q/2,0],[ie/2,Q/2,0],[ie/2,-Q/2,0],[-ie/2,-Q/2,0]],castShadow:!1,receiveShadow:!1,lineWidth:.5,rotation:(oe=E.current)==null?void 0:oe.rotation,color:B0}),R&&!s&&h.jsx(h.Fragment,{children:h.jsx(Ps,{position:new le(0,0,-Q/2),args:[se,6,6,0,Math.PI],name:zo.Default,renderOrder:2,onPointerDown:Z=>{Z.button!==2&&Z.eventObject===Z.intersections[0].eventObject&&(C(n,Z,Xo.Move),kn.setState({flowerRef:F}))},onPointerEnter:Z=>{G(Z,zo.Default)},onPointerLeave:q,children:h.jsx("meshBasicMaterial",{attach:"material",color:v===zo.Default||P===zo.Default?ga:iw})})}),w&&!R&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:V,color:(t==null?void 0:t.labelColor)??"white",fontSize:(t==null?void 0:t.labelFontSize)??20,textHeight:(t==null?void 0:t.labelSize)??.2,position:[0,0,Q/2+((t==null?void 0:t.labelHeight)??.4)]})]})}):null})});var wde=function(t,e){return wde=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},wde(t,e)};function Pr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");wde(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var N0=function(){return N0=Object.assign||function(e){for(var n,o=1,r=arguments.length;o0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ip(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var o=n.call(t),r,i=[],a;try{for(;(e===void 0||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(l){a={error:l}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function yl(t,e,n){if(n||arguments.length===2)for(var o=0,r=e.length,i;o0?bd(nM,--ty):0,HR--,au===10&&(HR=1,WQ--),au}function L2(){return au=ty2||xde(au)>3?"":" "}function Ptn(t,e){for(;--e&&L2()&&!(au<48||au>102||au>57&&au<65||au>70&&au<97););return UQ(t,l_()+(e<6&&Cx()==32&&L2()==32))}function bde(t){for(;L2();)switch(au){case t:return ty;case 34:case 39:t!==34&&t!==39&&bde(au);break;case 40:t===41&&bde(t);break;case 92:L2();break}return ty}function Ctn(t,e){for(;L2()&&t+au!==57;)if(t+au===84&&Cx()===47)break;return"/*"+UQ(e,ty-1)+"*"+t2e(t===47?t:L2())}function Rtn(t){for(;!xde(Cx());)L2();return UQ(t,ty)}function Htn(t){return Stn(s_("",null,null,null,[""],t=btn(t),0,[0],t))}function s_(t,e,n,o,r,i,a,l,s){for(var c=0,u=0,d=a,f=0,p=0,g=0,A=1,y=1,S=1,C=0,P="",v=r,T=i,w=o,x=P;y;)switch(g=C,C=L2()){case 40:if(g!=108&&bd(x,d-1)==58){a_(x+=Ra(rae(C),"&","&\f"),"&\f",hQe(c?l[c-1]:0))!=-1&&(S=-1);break}case 34:case 39:case 91:x+=rae(C);break;case 9:case 10:case 13:case 32:x+=Ttn(g);break;case 92:x+=Ptn(l_()-1,7);continue;case 47:switch(Cx()){case 42:case 47:OD(Mtn(Ctn(L2(),l_()),e,n,s),s);break;default:x+="/"}break;case 123*A:l[c++]=c9(x)*S;case 125*A:case 59:case 0:switch(C){case 0:case 125:y=0;case 59+u:S==-1&&(x=Ra(x,/\f/g,"")),p>0&&c9(x)-d&&OD(p>32?OTe(x+";",o,n,d-1,s):OTe(Ra(x," ","")+";",o,n,d-2,s),s);break;case 59:x+=";";default:if(OD(w=YTe(x,e,n,c,u,r,l,P,v=[],T=[],d,i),i),C===123)if(u===0)s_(x,e,w,w,v,i,d,l,T);else switch(f===99&&bd(x,3)===110?100:f){case 100:case 108:case 109:case 115:s_(t,w,w,o&&OD(YTe(t,w,w,0,0,r,l,P,r,v=[],d,T),T),r,T,d,l,o?v:T);break;default:s_(x,w,w,w,[""],T,0,l,T)}}c=u=p=0,A=S=1,P=x="",d=a;break;case 58:d=1+c9(x),p=g;default:if(A<1){if(C==123)--A;else if(C==125&&A++==0&&xtn()==125)continue}switch(x+=t2e(C),C*A){case 38:S=u>0?1:(x+="\f",-1);break;case 44:l[c++]=(c9(x)-1)*S,S=1;break;case 64:Cx()===45&&(x+=rae(L2())),f=Cx(),u=d=c9(P=x+=Rtn(l_())),C++;break;case 45:g===45&&c9(x)==2&&(A=0)}}return i}function YTe(t,e,n,o,r,i,a,l,s,c,u,d){for(var f=r-1,p=r===0?i:[""],g=gQe(p),A=0,y=0,S=0;A0?p[C]+" "+P:Ra(P,/&\f/g,p[C])))&&(s[S++]=v);return NQ(t,e,n,r===0?LQ:l,s,c,u,d)}function Mtn(t,e,n,o){return NQ(t,e,n,dQe,t2e(vtn()),RR(t,2,-2),0,o)}function OTe(t,e,n,o,r){return NQ(t,e,n,e2e,RR(t,0,o),RR(t,o+1,-1),o,r)}function yQe(t,e,n){switch(Atn(t,e)){case 5103:return es+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return es+t+t;case 4789:return kE+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return es+t+kE+t+lc+t+t;case 5936:switch(bd(t,e+11)){case 114:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return es+t+lc+Ra(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return es+t+lc+t+t;case 6165:return es+t+lc+"flex-"+t+t;case 5187:return es+t+Ra(t,/(\w+).+(:[^]+)/,es+"box-$1$2"+lc+"flex-$1$2")+t;case 5443:return es+t+lc+"flex-item-"+Ra(t,/flex-|-self/g,"")+(g6(t,/flex-|baseline/)?"":lc+"grid-row-"+Ra(t,/flex-|-self/g,""))+t;case 4675:return es+t+lc+"flex-line-pack"+Ra(t,/align-content|flex-|-self/g,"")+t;case 5548:return es+t+lc+Ra(t,"shrink","negative")+t;case 5292:return es+t+lc+Ra(t,"basis","preferred-size")+t;case 6060:return es+"box-"+Ra(t,"-grow","")+es+t+lc+Ra(t,"grow","positive")+t;case 4554:return es+Ra(t,/([^-])(transform)/g,"$1"+es+"$2")+t;case 6187:return Ra(Ra(Ra(t,/(zoom-|grab)/,es+"$1"),/(image-set)/,es+"$1"),t,"")+t;case 5495:case 3959:return Ra(t,/(image-set\([^]*)/,es+"$1$`$1");case 4968:return Ra(Ra(t,/(.+:)(flex-)?(.*)/,es+"box-pack:$3"+lc+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+es+t+t;case 4200:if(!g6(t,/flex-|baseline/))return lc+"grid-column-align"+RR(t,e)+t;break;case 2592:case 3360:return lc+Ra(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(o,r){return e=r,g6(o.props,/grid-\w+-end/)})?~a_(t+(n=n[e].value),"span",0)?t:lc+Ra(t,"-start","")+t+lc+"grid-row-span:"+(~a_(n,"span",0)?g6(n,/\d+/):+g6(n,/\d+/)-+g6(t,/\d+/))+";":lc+Ra(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(o){return g6(o.props,/grid-\w+-start/)})?t:lc+Ra(Ra(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return Ra(t,/(.+)-inline(.+)/,es+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(c9(t)-1-e>6)switch(bd(t,e+1)){case 109:if(bd(t,e+4)!==45)break;case 102:return Ra(t,/(.+:)(.+)-([^]+)/,"$1"+es+"$2-$3$1"+kE+(bd(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~a_(t,"stretch",0)?yQe(Ra(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return Ra(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,r,i,a,l,s,c){return lc+r+":"+i+c+(a?lc+r+"-span:"+(l?s:+s-+i)+c:"")+t});case 4949:if(bd(t,e+6)===121)return Ra(t,":",":"+es)+t;break;case 6444:switch(bd(t,bd(t,14)===45?18:11)){case 120:return Ra(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+es+(bd(t,14)===45?"inline-":"")+"box$3$1"+es+"$2$3$1"+lc+"$2box$3")+t;case 100:return Ra(t,":",":"+lc)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Ra(t,"scroll-","scroll-snap-")+t}return t}function yX(t,e){for(var n="",o=0;o-1&&!t.return)switch(t.type){case e2e:t.return=yQe(t.value,t.length,n);return;case fQe:return yX([B4(t,{value:Ra(t.value,"@","@"+es)})],o);case LQ:if(t.length)return wtn(n=t.props,function(r){switch(g6(r,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":JT(B4(t,{props:[Ra(r,/:(read-\w+)/,":"+kE+"$1")]})),JT(B4(t,{props:[r]})),vde(t,{props:BTe(n,o)});break;case"::placeholder":JT(B4(t,{props:[Ra(r,/:(plac\w+)/,":"+es+"input-$1")]})),JT(B4(t,{props:[Ra(r,/:(plac\w+)/,":"+kE+"$1")]})),JT(B4(t,{props:[Ra(r,/:(plac\w+)/,lc+"input-$1")]})),JT(B4(t,{props:[r]})),vde(t,{props:BTe(n,o)});break}return""})}}var Ftn={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},q1={},MR=typeof process<"u"&&q1!==void 0&&(q1.REACT_APP_SC_ATTR||q1.SC_ATTR)||"data-styled",AQe="active",wQe="data-styled-version",jQ="6.1.10",n2e=`/*!sc*/ +`,o2e=typeof window<"u"&&"HTMLElement"in window,ktn=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&q1!==void 0&&q1.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&q1.REACT_APP_SC_DISABLE_SPEEDY!==""?q1.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&q1.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&q1!==void 0&&q1.SC_DISABLE_SPEEDY!==void 0&&q1.SC_DISABLE_SPEEDY!==""&&q1.SC_DISABLE_SPEEDY!=="false"&&q1.SC_DISABLE_SPEEDY),BQ=Object.freeze([]),IR=Object.freeze({});function Ltn(t,e,n){return n===void 0&&(n=IR),t.theme!==n.theme&&t.theme||e||n.theme}var vQe=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Wtn=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Ntn=/(^-|-$)/g;function VTe(t){return t.replace(Wtn,"-").replace(Ntn,"")}var Utn=/(a)(d)/gi,vO=52,_Te=function(t){return String.fromCharCode(t+(t>25?39:97))};function Sde(t){var e,n="";for(e=Math.abs(t);e>vO;e=e/vO|0)n=_Te(e%vO)+n;return(_Te(e%vO)+n).replace(Utn,"$1-$2")}var iae,xQe=5381,lC=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},bQe=function(t){return lC(xQe,t)};function jtn(t){return Sde(bQe(t)>>>0)}function Btn(t){return t.displayName||t.name||"Component"}function aae(t){return typeof t=="string"&&!0}var SQe=typeof Symbol=="function"&&Symbol.for,TQe=SQe?Symbol.for("react.memo"):60115,Ytn=SQe?Symbol.for("react.forward_ref"):60112,Otn={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},Vtn={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},PQe={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},_tn=((iae={})[Ytn]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},iae[TQe]=PQe,iae);function GTe(t){return("type"in(e=t)&&e.type.$$typeof)===TQe?PQe:"$$typeof"in t?_tn[t.$$typeof]:Otn;var e}var Gtn=Object.defineProperty,Xtn=Object.getOwnPropertyNames,XTe=Object.getOwnPropertySymbols,Jtn=Object.getOwnPropertyDescriptor,Ktn=Object.getPrototypeOf,JTe=Object.prototype;function CQe(t,e,n){if(typeof e!="string"){if(JTe){var o=Ktn(e);o&&o!==JTe&&CQe(t,o,n)}var r=Xtn(e);XTe&&(r=r.concat(XTe(e)));for(var i=GTe(t),a=GTe(e),l=0;l0?" Args: ".concat(e.join(", ")):""))}var qtn=function(){function t(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return t.prototype.indexOfGroup=function(e){for(var n=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,r=o.length,i=r;e>=i;)if((i<<=1)<0)throw AN(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(o),this.length=i;for(var a=r;a=this.length||this.groupSizes[e]===0)return n;for(var o=this.groupSizes[e],r=this.indexOfGroup(e),i=r+o,a=r;a=0){var o=document.createTextNode(n);return this.element.insertBefore(o,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e0&&(y+="".concat(S,","))}),s+="".concat(g).concat(A,'{content:"').concat(y,'"}').concat(n2e)},u=0;u0?".".concat(e):f},u=s.slice();u.push(function(f){f.type===LQ&&f.value.includes("&")&&(f.props[0]=f.props[0].replace(lnn,n).replace(o,c))}),a.prefix&&u.push(Etn),u.push(Itn);var d=function(f,p,g,A){p===void 0&&(p=""),g===void 0&&(g=""),A===void 0&&(A="&"),e=A,n=p,o=new RegExp("\\".concat(n,"\\b"),"g");var y=f.replace(snn,""),S=Htn(g||p?"".concat(g," ").concat(p," { ").concat(y," }"):y);a.namespace&&(S=MQe(S,a.namespace));var C=[];return yX(S,ztn(u.concat(Dtn(function(P){return C.push(P)})))),C};return d.hash=s.length?s.reduce(function(f,p){return p.name||AN(15),lC(f,p.name)},xQe).toString():"",d}var unn=new HQe,Pde=cnn(),IQe=be.createContext({shouldForwardProp:void 0,styleSheet:unn,stylis:Pde});IQe.Consumer;be.createContext(void 0);function $Te(){return m.useContext(IQe)}var dnn=function(){function t(e,n){var o=this;this.inject=function(r,i){i===void 0&&(i=Pde);var a=o.name+i.hash;r.hasNameForId(o.id,a)||r.insertRules(o.id,a,i(o.rules,a,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=n,i2e(this,function(){throw AN(12,String(o.name))})}return t.prototype.getName=function(e){return e===void 0&&(e=Pde),this.name+e.hash},t}(),fnn=function(t){return t>="A"&&t<="Z"};function QTe(t){for(var e="",n=0;n>>0);if(!n.hasNameForId(this.componentId,a)){var l=o(i,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,l)}r=Kv(r,a),this.staticRulesId=a}else{for(var s=lC(this.baseHash,o.hash),c="",u=0;u>>0);n.hasNameForId(this.componentId,p)||n.insertRules(this.componentId,p,o(c,".".concat(p),void 0,this.componentId)),r=Kv(r,p)}}return r},t}(),EQe=be.createContext(void 0);EQe.Consumer;var lae={};function mnn(t,e,n){var o=r2e(t),r=t,i=!aae(t),a=e.attrs,l=a===void 0?BQ:a,s=e.componentId,c=s===void 0?function(v,T){var w=typeof v!="string"?"sc":VTe(v);lae[w]=(lae[w]||0)+1;var x="".concat(w,"-").concat(jtn(jQ+w+lae[w]));return T?"".concat(T,"-").concat(x):x}(e.displayName,e.parentComponentId):s,u=e.displayName,d=u===void 0?function(v){return aae(v)?"styled.".concat(v):"Styled(".concat(Btn(v),")")}(t):u,f=e.displayName&&e.componentId?"".concat(VTe(e.displayName),"-").concat(e.componentId):e.componentId||c,p=o&&r.attrs?r.attrs.concat(l).filter(Boolean):l,g=e.shouldForwardProp;if(o&&r.shouldForwardProp){var A=r.shouldForwardProp;if(e.shouldForwardProp){var y=e.shouldForwardProp;g=function(v,T){return A(v,T)&&y(v,T)}}else g=A}var S=new gnn(n,f,o?r.componentStyle:void 0);function C(v,T){return function(w,x,b){var R=w.attrs,H=w.componentStyle,F=w.defaultProps,E=w.foldedComponentIds,N=w.styledComponentId,U=w.target,W=be.useContext(EQe),k=$Te(),D=w.shouldForwardProp||k.shouldForwardProp,L=Ltn(x,W,F)||IR,j=function($,ie,Q){for(var se,oe=N0(N0({},ie),{className:void 0,theme:Q}),Z=0;Z<$.length;Z+=1){var te=zR(se=$[Z])?se(oe):se;for(var ee in te)oe[ee]=ee==="className"?Kv(oe[ee],te[ee]):ee==="style"?N0(N0({},oe[ee]),te[ee]):te[ee]}return ie.className&&(oe.className=Kv(oe.className,ie.className)),oe}(R,x,L),B=j.as||U,O={};for(var V in j)j[V]===void 0||V[0]==="$"||V==="as"||V==="theme"&&j.theme===L||(V==="forwardedAs"?O.as=j.forwardedAs:D&&!D(V,B)||(O[V]=j[V]));var G=function($,ie){var Q=$Te(),se=$.generateAndInjectStyles(ie,Q.styleSheet,Q.stylis);return se}(H,j),q=Kv(E,N);return G&&(q+=" "+G),j.className&&(q+=" "+j.className),O[aae(B)&&!vQe.has(B)?"class":"className"]=q,O.ref=b,m.createElement(B,O)}(P,v,T)}C.displayName=d;var P=be.forwardRef(C);return P.attrs=p,P.componentStyle=S,P.displayName=d,P.shouldForwardProp=g,P.foldedComponentIds=o?Kv(r.foldedComponentIds,r.styledComponentId):"",P.styledComponentId=f,P.target=o?r.target:t,Object.defineProperty(P,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(v){this._foldedDefaultProps=o?function(T){for(var w=[],x=1;x{if(M(FH),!dt.getState().waiting)return null;const e=()=>(m.useEffect(()=>(dt.getState().set(n=>{n.waiting=!1}),()=>{dt.getState().set(n=>{n.waiting=!1})})),null);return h.jsx(e,{})},Tnn=be.memo(({id:t,cx:e,cy:n,cz:o,lx:r,lz:i,birdSafe:a=uc.None,numberOfBlades:l=3,speed:s=10,hubRadius:c=.75,hubLength:u=1.5,maximumChordRadius:d=3,maximumChordLength:f=1,towerHeight:p,towerRadius:g,bladeRadius:A,bladeTipWidth:y=.2,bladeRootRadius:S=.3,rotation:C=[0,0,0],relativeYawAngle:P=0,initialRotorAngle:v=0,pitchAngle:T=ye.toRadians(10),color:w="white",bladeColor:x=t9,stripeColor:b=n9,lineColor:R="black",lineWidth:H=.5,showLabel:F=!1,locked:E=!1,parentId:N})=>{const U=M(pn),W=M(Jn),k=M(pu),D=Tc(t),L=M(Cs),j=M(Al),{gl:{domElement:B}}=ri(),[O,V]=m.useState(!1),G=m.useRef(null),q=m.useRef(null),$=m.useRef(!1),ie=$t(),Q=m.useMemo(()=>ye.fetchBladeTexture(A,S*2,100,a,x,b),[S,A,a,x,b]),se=M(De=>{for(const Ae of De.elements)if(Ae.id===N)return Ae});if(se)switch(se.type){case z.Foundation:if(o=se.lz,ye.isZero(C[2]))e=se.cx+e*se.lx,n=se.cy+n*se.ly;else{const De=new ae(e*se.lx,n*se.ly,0);De.applyAxisAngle(ko,C[2]),e=se.cx+De.x,n=se.cy+De.y}break}const Z=W(t),ee=c*1.25,te=u*2.5,oe=A-d/3,de=m.useMemo(()=>{const De=f-S,Ae=new kl,ue=[];return ue.push(new Kt(-S,0)),ue.push(new Kt(-De/2,A-oe)),ue.push(new Kt(-De,d)),ue.push(new Kt(S-y,A)),Ae.moveTo(-S,0),Ae.splineThru(ue),Ae.lineTo(S,A),Ae.lineTo(S,0),Ae.closePath(),Ae},[A,oe,f,d,S,y]),he=m.useMemo(()=>{const De=new Date(j);return v+s*(De.getHours()*60+De.getMinutes())*Math.PI/72},[j,s,v]);m.useEffect(()=>{const De=()=>{kn.getState().setEnableOrbitController(!0),$.current=!1};return window.addEventListener("pointerup",De),()=>{window.removeEventListener("pointerup",De)}},[]);const pe=m.useMemo(()=>(Z!=null&&Z.label?Z.label:Y.t("shared.WindTurbineElement",ie))+(Z!=null&&Z.locked?" ("+Y.t("shared.ElementLocked",ie)+")":"")+(Z!=null&&Z.label?"":` -`+Y.t("word.Coordinates",ie)+": ("+e.toFixed(1)+", "+n.toFixed(1)+", "+o.toFixed(1)+") "+Y.t("word.MeterAbbreviation",ie)),[Z==null?void 0:Z.label,Z==null?void 0:Z.locked,ie,e,n,o]),me=m.useMemo(()=>new ln(0,0,C[2]+P,"ZXY"),[C,P]),le=(De,Ae)=>{De.intersections.length>0&&De.intersections[0].object===De.eventObject&&(B.style.cursor=Ae===zo.Default?"move":"pointer")},Te=()=>{B.style.cursor="default"},ge=Wg*4,Se=m.useMemo(()=>{const De=Math.PI*2/l,Ae=new Array;for(let ue=0;ueh.jsxs("group",{position:new ae(0,-u*.85,p),rotation:[Qt,T,Ae,"XZY"],children:[h.jsxs("mesh",{name:"Blade "+De+" Font Side",receiveShadow:L,castShadow:L,children:[h.jsx("shapeGeometry",{attach:"geometry",args:[de]}),h.jsx("meshStandardMaterial",{attach:"material",color:x,side:Da,map:ue})]}),h.jsxs("mesh",{name:"Blade "+De+" Back Side",receiveShadow:L,castShadow:L,position:new ae(0,-.05,0),children:[h.jsx("shapeGeometry",{attach:"geometry",args:[de]}),h.jsx("meshStandardMaterial",{attach:"material",color:x,side:r0,map:ue})]}),h.jsx(ma,{name:"Blade root",castShadow:!1,receiveShadow:!1,args:[S*1.1,S*1.1,.24,12,1],position:new ae(0,c-.14,0),children:h.jsx("meshStandardMaterial",{attach:"material",color:w})})]},De);return h.jsxs("group",{name:"Wind Turbine Group "+t,rotation:me,position:[e,n,o],children:[h.jsx("group",{children:D&&!E&&h.jsx(Ps,{ref:q,position:new ae(0,0,0),args:[ge+g,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:De=>{le(De,zo.Default)},onPointerOut:()=>{Te()},onPointerDown:De=>{De.button!==2&&k(t,De,Xo.Move)},children:h.jsx("meshStandardMaterial",{attach:"material",color:"orange"})})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Tower",ref:G,castShadow:L,receiveShadow:L,args:[g*.8,g*1.2,p,4,1],position:new ae(0,0,p*.5),rotation:[Qt,0,0],onPointerDown:De=>{De.button!==2&&(k(t,De,Xo.Select),kn.getState().setEnableOrbitController(!1))},onContextMenu:De=>{k(t,De,Xo.ContextMenu),U(Ae=>{De.intersections.length>0&&De.intersections[0].object===G.current&&(Ae.contextMenuObjectType=z.WindTurbine)})},onPointerOver:De=>{De.intersections.length>0&&De.intersections[0].object===G.current&&(V(!0),B.style.cursor="move")},onPointerOut:()=>{V(!1),B.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(Ps,{userData:{unintersectable:!0},name:"Hub",castShadow:L,receiveShadow:L,args:[c,8,8,Qt,Math.PI,0,Math.PI],position:new ae(0,-u*.5,p),rotation:[Math.PI,0,Qt],scale:[u/c,1,1],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Hub Cap",castShadow:L,receiveShadow:L,args:[c,c,.01,16,1],position:new ae(0,-u*.5,p),rotation:[Math.PI,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(p4t,{userData:{unintersectable:!0},name:"Nacelle",castShadow:L,receiveShadow:L,radius:.1,smoothness:4,args:[ee,ee,te],position:new ae(0,(te-u)*.5-.1,p),rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),a!==uc.None&&Se.map((De,Ae)=>Re(Ae,De,Q)),a===uc.None&&Se.map((De,Ae)=>Re(Ae,De,null)),D&&E&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-r/2,0,0],[-r/2,i,0],[-r/2,i,0],[r/2,i,0],[r/2,0,0],[r/2,i,0],[r/2,0,0],[-r/2,0,0]],rotation:[Qt,0,0],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),(O||F)&&!D&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:pe,color:(Z==null?void 0:Z.labelColor)??"white",fontSize:(Z==null?void 0:Z.labelFontSize)??20,textHeight:(Z==null?void 0:Z.labelSize)??1,castShadow:!1,receiveShadow:!1,position:[0,0,1+p+c]})]})}),Pnn=be.memo(()=>{const t=M(Kn),e=m.useRef(null);return m.useEffect(()=>{e&&kn.setState({contentRef:e})},[]),console.debug(t),h.jsxs("group",{ref:e,name:"Content",children:[t.map(n=>{switch(n.type){case z.Foundation:return h.jsx(sen,{...n},n.id);case z.Sensor:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(R$e,{...o},n.id)}case z.Light:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(H$e,{...o},n.id)}case z.Cuboid:return n.parentId!==Zo?null:h.jsx(I$e,{elements:t,cuboidModel:n},n.id);case z.Human:return h.jsx(ctn,{...n},n.id);case z.Tree:return h.jsx(utn,{...n},n.id);case z.Flower:return h.jsx(gtn,{...n},n.id);case z.ParabolicDish:return h.jsx(ftn,{...n},n.id);case z.ParabolicTrough:return h.jsx(dtn,{...n},n.id);case z.FresnelReflector:return h.jsx(htn,{...n},n.id);case z.Heliostat:return h.jsx(ptn,{...n},n.id);case z.WindTurbine:return h.jsx(Tnn,{...n},n.id);case z.Polygon:switch(n.parentType){case z.Wall:return null;default:return h.jsx(iQe,{...n},n.id)}default:if(n.id)return h.jsx(be.Fragment,{},n.id)}return null}),h.jsx(Snn,{}),h.jsx(Cnn,{})]})}),Cnn=()=>{const t=M($ge);return m.useEffect(()=>{M.getState().set(e=>{e.deletedRoofIdSet.clear()})},[t]),null},Rnn=be.memo(()=>{const t=M(pn),e=M(Db),n=M(LH),o=M(u3),r=M(Bge),i=M(_ge),a=M(Jn),l=M(d3),s=M(jge),c=M(Ap),u=M(Wge),d=M(Kge),f=M(En),p=M(kw),g=M(lYe),A=M(n$),y=M(Ub),S=M(Ug),C=M(o$),P=M(cxt),v=M(Cs),T=M(MBe),w=M(IBe),x=M(Ge=>Ge.world.ground),b=M(uxt),R=M(dxt),H=dt(hs),F=dt($7t),{get:E,scene:N,invalidate:U}=ri(),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(new ae),j=m.useRef(new ae),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(new Map),G=m.useRef(new Map),q=m.useRef(new Map),$=m.useRef(new Map),ie=m.useRef(new Map),Q=m.useRef(new Map),se=m.useRef(new ae(1,1,1)),Z=m.useRef(new ae(1,1,1)),ee=m.useRef([0,0,1]),te=m.useRef([0,0,1]),oe=m.useRef(null),de=m.useRef(null),he=m.useRef(new Map),pe=m.useRef(new Map),me=m.useRef(new Map),le=m.useRef(!1),Te=m.useRef(!1),ge=m.useRef(!1),Se=m.useRef(!1),Re=m.useRef(!1),De=m.useRef(new Map),Ae=m.useRef(new Map),ue=m.useRef(new Map),fe=m.useRef(new ae),ve=$t();m.useEffect(()=>(window.addEventListener("pointerup",$e),()=>{window.removeEventListener("pointerup",$e)}),[]),m.useEffect(()=>{b&&(t(Ge=>{Ge.addedFoundationId=null,Ge.deletedFoundationId=null}),le.current=!1,Te.current=!1)},[b]),m.useEffect(()=>{R&&(t(Ge=>{Ge.addedCuboidId=null,Ge.deletedCuboidId=null}),ge.current=!1,Se.current=!1)},[R]);const{camera:we}=ri(),Pe=m.useMemo(()=>new l0,[]),Ie=m.useMemo(()=>new Kt,[]),Me=D.current?Math.cos(D.current.rotation[2]):1,ze=D.current?Math.sin(D.current.rotation[2]):0;let Ne=Qf.Ground;const Je=m.useMemo(()=>new ae,[]),Ue=m.useMemo(()=>new ln,[]),nt=m.useMemo(()=>new ln,[]);if(D.current){if(ye.isPlantOrHuman(D.current)){Ne=Qf.Vertical;const Ge=M.getState().viewState.orthographic?0:-Qt,{x:yt,y:Pt}=we.position,ot=-Math.atan2(yt,Pt);Ue.set(Ge,0,ot,"ZXY"),Je.set(D.current.cx,D.current.cy,0)}else if(y===zo.Top)Ne=Qf.Horizontal,Je.set(D.current.cx,D.current.cy,D.current.lz),Ue.set(0,0,0);else if(ye.isMoveHandle(y)||S===Mt.Left||S===Mt.Right||S===Mt.Lower||S===Mt.Upper||S===Mt.LowerLeft||S===Mt.UpperLeft&&D.current.type!==z.Wall||S===Mt.LowerRight||S===Mt.UpperRight&&D.current.type!==z.Wall||C===Di.Lower||C===Di.Upper)Ne=Qf.Horizontal,Je.set(D.current.cx,D.current.cy,Wg),Ue.set(0,0,0);else if(S){Ne=Qf.Vertical;const Ge=d(D.current,S),yt=u(),Pt=-Math.atan2(yt.x,yt.y);Je.set(Ge.x,Ge.y,0),Ue.set(-Qt,0,Pt,"ZXY")}}const We=Ge=>{Ie.x=Ge.offsetX/E().gl.domElement.clientWidth*2-1,Ie.y=-(Ge.offsetY/E().gl.domElement.clientHeight)*2+1,Pe.setFromCamera(Ie,E().camera)},Ee=Ge=>{for(const yt of Ge)if(yt.object.userData.stand)return yt;return null},ke=(Ge,yt)=>{Ge&&t(Pt=>{for(const ot of Pt.elements)if(ot.id===yt&&ot.type!==z.Foundation){ot.parentId=Ge;break}})},Oe=Ge=>{if(!Ge)return"";if(Ge.userData.id)return Ge.userData.id;const yt=Ge.name.split(" ");return yt[2]&&yt[2].length>0?yt[2]:Oe(Ge.parent)},st=(Ge,yt,Pt)=>{if(!Ge||!yt)return;const ot=kn.getState().contentRef;if(ot!=null&&ot.current){const bt=ye.getObjectChildById(ot.current,yt),zt=ye.getObjectChildById(yt===Zo?ot.current:bt,Pt);if(zt){if(Ge===Zo)ot.current.add(zt);else{const Bt=ye.getObjectChildById(ot.current,Ge);Bt==null||Bt.add(zt)}U()}}},je=(Ge,yt)=>{if(Ge&&Ge.current){const Pt=Ee(yt.intersections);if(Pt){const ot=Pt.object,bt=Ge.current.parent;if(ot.name==="Ground"){if(bt&&bt.name!=="Content"){const zt=kn.getState().contentRef;zt&&zt.current&&(zt.current.add(Ge.current),ke(Zo,Oe(Ge.current)))}Ge.current.position.copy(Pt.point),U()}else if(ot.userData.stand){const zt=ot.parent;if(zt){bt&&bt.uuid!==zt.uuid&&(zt.add(Ge.current),ke(Oe(zt),Oe(Ge.current)));const{rot:Bt}=ye.getWorldDataById(Oe(zt));nt.set(0,0,-Bt);const tt=new ae().subVectors(Pt.point,zt.localToWorld(new ae)).applyEuler(nt);Ge.current.position.copy(tt),U()}}Re.current||(Re.current=!0)}}},xt=(Ge,yt,Pt)=>{t(ot=>{for(const bt of ot.elements)if(bt.id===Ge){ye.isFoundationOrCuboid(bt)||(bt.parentId=yt),bt.cx=Pt.x,bt.cy=Pt.y,bt.cz=Pt.z;break}})},gt=()=>{if(!D.current)return;const Ge={name:"Resize",timestamp:Date.now(),resizedElementId:D.current.id,resizedElementType:D.current.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldLx:se.current.x,oldLy:se.current.y,oldLz:se.current.z,newLx:Z.current.x,newLy:Z.current.y,newLz:Z.current.z,oldChildrenPositionsMap:new Map(B.current),newChildrenPositionsMap:new Map(O.current),oldPolygonVerticesMap:new Map(V.current),newPolygonVerticesMap:new Map(G.current),oldChildrenParentIdMap:new Map(ie.current),newChildrenParentIdMap:new Map(Q.current),oldWallPointsMap:new Map(q.current),newWallPointsMap:new Map($.current),undo:()=>{var yt,Pt;if(t(ot=>{for(const bt of ot.elements)if(bt.id===Ge.resizedElementId){bt.cx=Ge.oldCx,bt.cy=Ge.oldCy,bt.cz=Ge.oldCz,bt.lx=Ge.oldLx,bt.ly=Ge.oldLy,bt.lz=Ge.oldLz;break}}),Ge.oldChildrenPositionsMap.size>0)for(const[ot,bt]of Ge.oldChildrenPositionsMap.entries()){const zt=a(ot);if((zt==null?void 0:zt.type)!==z.Polygon){t(Ht=>{for(const _t of Ht.elements)if(_t.id===ot){if(_t.cx=bt.x,_t.cy=bt.y,Gt(_t)||(_t.cz=bt.z),_t.type===z.Wall){const qt=_t,un=Ge.oldWallPointsMap.get(qt.id);un&&(qt.leftPoint=[un[0].x,un[0].y,0],qt.rightPoint=[un[1].x,un[1].y,0])}break}Ge.oldWallPointsMap.size>0&&(Ht.updateWallMapOnFoundationFlag=!Ht.updateWallMapOnFoundationFlag)});const Bt=(yt=Ge.oldChildrenParentIdMap)==null?void 0:yt.get(ot),tt=(Pt=Ge.newChildrenParentIdMap)==null?void 0:Pt.get(ot);Bt&&tt&&Bt!==tt&&(st(Bt,tt,ot),ke(Bt,ot))}}if(Ge.oldPolygonVerticesMap.size>0)for(const[ot,bt]of Ge.oldPolygonVerticesMap.entries()){const zt=a(ot);(zt==null?void 0:zt.type)===z.Polygon&&p(ot,bt)}},redo:()=>{var yt,Pt;if(t(ot=>{for(const bt of ot.elements)if(bt.id===Ge.resizedElementId){bt.cx=Ge.newCx,bt.cy=Ge.newCy,bt.cz=Ge.newCz,bt.lx=Ge.newLx,bt.ly=Ge.newLy,bt.lz=Ge.newLz;break}}),Ge.newChildrenPositionsMap.size>0)for(const[ot,bt]of Ge.newChildrenPositionsMap.entries()){t(tt=>{for(const Ht of tt.elements)if(Ht.id===ot){if(Ht.cx=bt.x,Ht.cy=bt.y,(Ht.type!==z.SolarPanel||Ht.parentType!==z.Roof)&&(Ht.cz=bt.z),Ht.type===z.Wall){const _t=Ht,qt=Ge.newWallPointsMap.get(_t.id);qt&&(_t.leftPoint=[qt[0].x,qt[0].y,0],_t.rightPoint=[qt[1].x,qt[1].y,0])}break}Ge.newWallPointsMap.size>0&&(tt.updateWallMapOnFoundationFlag=!tt.updateWallMapOnFoundationFlag)});const zt=(yt=Ge.oldChildrenParentIdMap)==null?void 0:yt.get(ot),Bt=(Pt=Ge.newChildrenParentIdMap)==null?void 0:Pt.get(ot);zt&&Bt&&zt!==Bt&&(st(Bt,zt,ot),ke(Bt,ot))}if(Ge.newPolygonVerticesMap.size>0)for(const[ot,bt]of Ge.newPolygonVerticesMap.entries()){const zt=a(ot);(zt==null?void 0:zt.type)===z.Polygon&&p(ot,bt)}}};return Ge},Ye=(Ge,yt)=>{var zt,Bt;const Pt=kn.getState().contentRef,ot=ye.getObjectChildById(Pt==null?void 0:Pt.current,Ge.id);if(ot){for(const tt of ot.children)if(tt.name.includes(`${yt.id}`)){(Bt=(zt=kn.getState().contentRef)==null?void 0:zt.current)==null||Bt.add(tt);break}}yt.parentId=Zo;const bt=new ae(yt.cx,yt.cy,yt.cz).applyEuler(new ln(0,0,Ge.rotation[2])).add(L.current);yt.cx=bt.x,yt.cy=bt.y,yt.cz=0,O.current.set(yt.id,new ae(bt.x,bt.y,0)),Q.current.set(yt.id,Zo)},it=Ge=>{Ge.intersections.length>0&&Ge.intersections[0].object===W.current&&t(Pt=>{Px.selectNone(Pt),Pt.pastePoint.copy(Ge.intersections[0].point),Pt.clickObjectType=z.Ground,Pt.contextMenuObjectType=z.Ground,Pt.pasteNormal=ko})},ut=Ge=>{const yt=M.getState().resizeHandleType;switch(Ge.type){case z.Tree:switch(yt){case Mt.Top:{const Pt={name:"Change Tree Height",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.z,newValue:Ge.lz,undo:()=>{s(Pt.changedElementId,Pt.oldValue)},redo:()=>{s(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.treeHeight=Ge.lz});return}case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Pt={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.x,newValue:Ge.lx,undo:()=>{l(Pt.changedElementId,Pt.oldValue)},redo:()=>{l(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.treeSpread=Ge.lx});return}}break;case z.Wall:{const Pt={name:"Change Wall Height",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.z,newValue:Ge.lz,undo:()=>{s(Pt.changedElementId,Pt.oldValue)},redo:()=>{s(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.wallHeight=Ge.lz});return}}if(j.current.set(Ge.cx,Ge.cy,Ge.cz),Z.current.set(Ge.lx,Ge.ly,Ge.lz),ie.current.clear(),Q.current.clear(),O.current.clear(),G.current.clear(),$.current.clear(),t(Pt=>{if(Ge.type===z.Cuboid&&(Pt.actionState.cuboidHeight=Ge.lz),Pt.updateSceneRadius(),Pt.updateWallMapOnFoundationFlag=!Pt.updateWallMapOnFoundationFlag,Ge.parentId===Zo){for(const ot of Pt.elements)if(ye.isPlantOrHuman(ot)&&ot.parentId===Ge.id&&(ie.current.set(ot.id,Ge.id),!ye.isResizingVertical(M.getState().resizeHandleType)))if(Math.abs(se.current.z/2-ot.cz)<.01){const bt=new ae(ot.cx,ot.cy,ot.cz).applyEuler(new ln(0,0,Ge.rotation[2])).add(L.current).sub(j.current).applyEuler(new ln(0,0,-Ge.rotation[2]));Math.abs(bt.x)>Math.abs(Z.current.x/2)+.01||Math.abs(bt.y)>Math.abs(Z.current.y/2)+.01?Ye(Ge,ot):(ot.cx=bt.x,ot.cy=bt.y)}else{const bt=new ae(ot.cx,ot.cy,ot.cz),zt=new ae().subVectors(j.current,L.current),Bt=new ae().subVectors(bt,zt);Math.abs(bt.x/se.current.x)>.49?Math.abs(Bt.y)>Ge.ly/2+.5?Ye(Ge,ot):(ot.cx=(bt.x>0?Ge.lx:-Ge.lx)/2,ot.cy=Bt.y):Math.abs(bt.y/se.current.y)>.49&&(Math.abs(Bt.x)>Ge.lx/2+.5?Ye(Ge,ot):(ot.cx=Bt.x,ot.cy=(bt.y>0?Ge.ly:-Ge.ly)/2))}}}),j.current.distanceToSquared(L.current)>Et&&Z.current.distanceToSquared(se.current)>Et){if(Ge.type===z.Foundation||Ge.type===z.Cuboid){const ot=n(Ge.id);if(ot.length>0)for(const bt of ot)if(bt.type===z.Polygon)G.current.set(bt.id,bt.vertices.map(zt=>({...zt})));else{if(bt.type===z.Wall){const zt=bt,Bt=new Kt(zt.leftPoint[0],zt.leftPoint[1]),tt=new Kt(zt.rightPoint[0],zt.rightPoint[1]);$.current.set(bt.id,[Bt,tt])}O.current.set(bt.id,new ae(bt.cx,bt.cy,bt.cz))}if(Ge.type===z.Foundation){const bt=At(Ge.id);if(bt.length>0)for(const zt of bt){const Bt=new ae(zt.cx,zt.cy);O.current.set(zt.id,Bt)}}}const Pt=gt();Pt&&f(Pt)}},Qe=()=>{if(M.getState().viewState.orthographic)return!1;if(W.current){const Ge=Pe.intersectObjects(E().scene.children,!0);if(Ge.length>0){for(const yt of Ge)if(yt.object.userData.stand)return!1}}return Pe.intersectObjects([W.current]).length===0},lt=Ge=>{t(yt=>{for(const Pt of yt.elements)if(Ge.has(Pt.id)){const ot=Ge.get(Pt.id);ot&&(Pt.cx=ot[0],Pt.cy=ot[1],Pt.cz=ot[2])}})},Ze=(Ge,yt)=>{var bt,zt,Bt;if(Ge.locked)return;j.current.set(Ge.cx,Ge.cy,Ge.cz);let Pt=oe.current,ot=null;switch(We(yt),Ge.type){case z.Tree:ot=(bt=kn.getState().treeRef)==null?void 0:bt.current;break;case z.Flower:ot=(zt=kn.getState().flowerRef)==null?void 0:zt.current;break;case z.Human:ot=(Bt=kn.getState().humanRef)==null?void 0:Bt.current;break}if(ot&&Re.current){const tt=Pe.intersectObjects(ye.fetchIntersectables(N),!1),Ht=Ee(tt);if(Ht){const _t=Ht.point;if(Ht.object.name==="Ground")xt(Ge.id,Zo,_t),j.current.set(_t.x,_t.y,_t.z),Pt=Zo;else if(Ht.object.userData.stand){const qt=Oe(Ht.object),un=Ht.object.parent;if(un){const Rn=new ae().subVectors(_t,un.localToWorld(new ae)).applyEuler(nt);xt(Ge.id,qt,Rn),j.current.set(Rn.x,Rn.y,Rn.z),Pt=qt}}}Re.current=!1}if(j.current.distanceToSquared(L.current)>Et||Pe.intersectObjects([W.current]).length===0){let tt=!0;if(!M.getState().viewState.orthographic&&(tt=j.current.length().02}if(!tt||Qe()){o(Ge.id,L.current.x,L.current.y,L.current.z),ot&&ye.isPlantOrHuman(Ge)&&ot.position.copy(L.current),ye.isPlantOrHuman(Ge)&&ke(oe.current,Ge.id);const Ht=kn.getState().contentRef;if(Ht!=null&&Ht.current&&oe.current&&ot){if(oe.current===Zo)Ht.current.add(ot);else{const _t=ye.getObjectChildById(Ht.current,oe.current);_t==null||_t.add(ot)}U()}co(Y.t("message.CannotMoveObjectTooFar",ve))}else{if(De.current.size>1){ue.current.clear();for(const _t of M.getState().elements)Ae.current.has(_t.id)&&ue.current.set(_t.id,[_t.cx,_t.cy,_t.cz]);const Ht={name:"Move Foundation Group",timestamp:Date.now(),oldPositionMap:new Map(Ae.current),newPositionMap:new Map(ue.current),undo:()=>{lt(Ht.oldPositionMap)},redo:()=>{lt(Ht.newPositionMap)}};f(Ht)}else{const Ht=Ge.type===z.Cuboid,_t=Ht?de.current:oe.current,qt=Ht?Ge.parentId:Pt,un={name:"Move",timestamp:Date.now(),movedElementId:Ge.id,movedElementType:Ge.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldRotation:[...ee.current],newRotation:[...Ge.rotation],oldParentId:_t,newParentId:qt,undo:()=>{o(un.movedElementId,un.oldCx,un.oldCy,un.oldCz),t(Rn=>{const yo=Rn.elements.find(Ao=>Ao.id===un.movedElementId);yo&&un.oldRotation&&(yo.rotation=[...un.oldRotation])}),ke(un.oldParentId,un.movedElementId),un.movedElementType&&Wt(un.movedElementType)&&st(un.oldParentId,un.newParentId,un.movedElementId)},redo:()=>{o(un.movedElementId,un.newCx,un.newCy,un.newCz),t(Rn=>{const yo=Rn.elements.find(Ao=>Ao.id===un.movedElementId);yo&&un.newRotation&&(yo.rotation=[...un.newRotation])}),ke(un.newParentId,un.movedElementId),un.movedElementType&&Wt(un.movedElementType)&&st(un.newParentId,un.oldParentId,un.movedElementId)}};f(un)}De.current.clear(),g()}}},Be=Ge=>{te.current=[...Ge.rotation];const yt=new ae().fromArray(ee.current);if(new ae().fromArray(te.current).distanceToSquared(yt)>Et){const ot={name:"Rotate",timestamp:Date.now(),rotatedElementId:Ge.id,rotatedElementType:Ge.type,oldRotation:ee.current,newRotation:te.current,undo:()=>{r(ot.rotatedElementId,ot.oldRotation[0],ot.oldRotation[1],ot.oldRotation[2])},redo:()=>{r(ot.rotatedElementId,ot.newRotation[0],ot.newRotation[1],ot.newRotation[2])}};f(ot)}},$e=Ge=>{if(Ge.button!==2){if(kn.getState().setEnableOrbitController(!0),D.current){const yt=a(D.current.id);if(yt)if(Te.current)if(le.current=!1,Te.current=!1,t(Pt=>{Pt.addedFoundationId=null,Pt.updateSceneRadius()}),yt.lx<=.1||yt.ly<=.1)c(yt.id,!1);else{const Pt={name:"Add",timestamp:Date.now(),addedElement:yt,undo:()=>{c(Pt.addedElement.id,!1),g()},redo:()=>{t(ot=>{ot.elements.push(Pt.addedElement),ot.selectedElement=Pt.addedElement,ot.updateSceneRadius()})}};f(Pt)}else if(Se.current)if(ge.current=!1,Se.current=!1,t(Pt=>{Pt.addedCuboidId=null,Pt.updateSceneRadius()}),yt.lx<=.1||yt.ly<=.1)c(yt.id,!1);else{const Pt={name:"Add",timestamp:Date.now(),addedElement:yt,undo:()=>{c(Pt.addedElement.id,!1),g()},redo:()=>{t(ot=>{ot.elements.push(Pt.addedElement),ot.selectedElement=Pt.addedElement,ot.updateSceneRadius()})}};f(Pt)}else M.getState().resizeHandleType?ut(yt):M.getState().rotateHandleType?Be(yt):M.getState().moveHandleType&&Ze(yt,Ge),yt.type===z.Foundation&&dt.getState().updateFoundationMovedFlag();D.current=null}t(yt=>{yt.moveHandleType=null,yt.resizeHandleType=null,yt.rotateHandleType=null}),kn.setState({humanRef:null,treeRef:null,flowerRef:null}),dt.getState().set(yt=>{yt.showWallIntersectionPlaneId=null,yt.oldParentId=null,yt.oldFoundationId=null})}},wt=(Ge,yt)=>{const{pos:Pt}=ye.getWorldDataById(Ge.id),ot=new ae(Pt.x,Pt.y),bt=new ae().subVectors(ot,yt);De.current.set(Ge.id,bt),Ae.current.set(Ge.id,[Ge.cx,Ge.cy,Ge.cz])},vt=(Ge,yt)=>{const Pt=Ge.intersections[0].point.clone().setZ(0);for(const ot of M.getState().elements)Ad(ot)&&ot.parentId===Zo&&!ot.locked&&ot.id!==yt.id&&!De.current.has(ot.id)&&!ye.isChild(yt.id,ot.id)&&!ye.isChild(ot.id,yt.id)&&ye.areTwoBasesOverlapped(ot,yt)&&(wt(ot,Pt),ot.enableGroupMaster&&vt(Ge,ot)),ot.id===yt.id&&wt(ot,Pt)},Rt=(Ge,yt)=>{De.current.clear(),Ae.current.clear(),yt.enableGroupMaster&&M.getState().moveHandleType&&vt(Ge,yt)},Gt=Ge=>{if(Ge.type===z.SolarPanel&&Ge.parentType===z.Roof||Ge.type===z.Window&&Ge.parentType===z.Roof)return!0},At=Ge=>M.getState().elements.filter(yt=>yt.foundationId!==Ge?!1:yt.type===z.SolarPanel&&yt.parentType===z.Roof||yt.type===z.SolarWaterHeater&&yt.parentType===z.Roof||yt.type===z.Window&&yt.parentType===z.Roof||yt.type===z.Sensor||yt.type===z.Light),pt=Ge=>{if(Ge.button===2||Ge.intersections.length===0||!W.current)return;if(le.current){We(Ge);const Pt=Pe.intersectObjects([W.current]);Pt.length>0&&(kn.getState().setEnableOrbitController(!1),t(ot=>{ot.moveHandleType=null,ot.resizeHandleType=Mt.LowerRight,ot.resizeAnchor.copy(Pt[0].point)}),le.current=!1,Te.current=!0);return}if(ge.current){We(Ge);const Pt=Pe.intersectObjects([W.current]);Pt.length>0&&(kn.getState().setEnableOrbitController(!1),t(ot=>{var bt;if(ot.moveHandleType=null,ot.resizeHandleType=Mt.LowerRight,ot.resizeAnchor.copy(Pt[0].point),D.current){const zt=ct(Ge,(bt=D.current)==null?void 0:bt.id);if(zt){const Bt=Pe.intersectObjects([zt.eventObject]);Bt.length>0&&ot.resizeAnchor.copy(Bt[0].point)}}}),ge.current=!1,Se.current=!0);return}if(Ge.intersections[0].object===W.current){if(M.getState().multiSelectionsMode||t(Pt=>{Pt.clickObjectType=z.Ground,Pt.selectedElement=null,Px.selectNone(Pt),Pt.contextMenuObjectType=null}),Ve(A)){const Pt=Ge.intersections[0].point,ot=i(x,Pt),bt={name:"Add",timestamp:Date.now(),addedElement:ot,undo:()=>{c(bt.addedElement.id,!1),g()},redo:()=>{t(zt=>{zt.elements.push(bt.addedElement),zt.selectedElement=bt.addedElement,zt.updateSceneRadius()})}};f(bt),t(zt=>{zt.actionModeLock||(zt.objectTypeToAdd=z.None),zt.updateSceneRadius()})}D.current=null}else{const Pt=M.getState().selectedElementIdSet;if(Pt.size>1){const ot=M.getState().selectedElement;if(ot){D.current=ot,De.current.clear();for(const bt of M.getState().elements)if(ye.isElementAllowedMultipleMoveOnGround(bt)&&Pt.has(bt.id))if(bt.enableGroupMaster)vt(Ge,bt);else{const Bt=Ge.intersections[0].point.clone().setZ(0);wt(bt,Bt)}}}else{const ot=e();if(ot&&Ve(ot.type)){if(D.current=ot,L.current.set(ot.cx,ot.cy,ot.cz),se.current.set(ot.lx,ot.ly,ot.lz),ee.current=[...ot.rotation],ot.type===z.Foundation||ot.type===z.Cuboid){const bt=n(ot.id);if(B.current.clear(),V.current.clear(),q.current.clear(),bt.length>0)for(const zt of bt)if(zt.type===z.Polygon)V.current.set(zt.id,zt.vertices.map(Bt=>({...Bt})));else{if(zt.type===z.Wall){const Bt=zt,tt=new Kt(Bt.leftPoint[0],Bt.leftPoint[1]),Ht=new Kt(Bt.rightPoint[0],Bt.rightPoint[1]);q.current.set(zt.id,[tt,Ht])}B.current.set(zt.id,new ae(zt.cx,zt.cy,zt.cz))}if(ot.type===z.Foundation){const zt=At(ot.id);if(zt.length>0)for(const Bt of zt){const tt=new ae(Bt.cx,Bt.cy);B.current.set(Bt.id,tt)}}}switch(ot.type){case z.Tree:oe.current=ot.parentId,se.current.set(ot.lx,ot.ly,ot.lz);break;case z.Flower:oe.current=ot.parentId;break;case z.Human:oe.current=ot.parentId;break;case z.Cuboid:{if(Ad(ot)&&ot.parentId===Zo?Rt(Ge,ot):De.current.clear(),de.current=ot.parentId,M.getState().moveHandleType){const{rot:_t}=ye.getWorldDataById(ot.id),qt=new ln(0,0,_t);switch(M.getState().moveHandleType){case zo.Right:{fe.current.set(-ot.lx/2,0,0).applyEuler(qt);break}case zo.Left:{fe.current.set(ot.lx/2,0,0).applyEuler(qt);break}case zo.Lower:{fe.current.set(0,ot.ly/2,0).applyEuler(qt);break}case zo.Upper:{fe.current.set(0,-ot.ly/2,0).applyEuler(qt);break}default:{fe.current.set(0,0,0);break}}}he.current.clear();const{pos:zt,rot:Bt}=ye.getWorldDataById(ot.id),tt=new ae(zt.x,zt.y,zt.z),Ht=n(ot.id);if(Ht.length>0)for(const _t of Ht)switch(_t.type){case z.Cuboid:{const qt=new ae(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt));qt.add(tt),he.current.set(_t.id,qt);break}case z.Tree:case z.Flower:case z.Human:{const qt=new ae(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt));qt.add(tt),he.current.set(_t.id,qt);break}case z.SolarPanel:{const qt=new ae(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt)).add(tt);he.current.set(_t.id,qt);break}case z.Light:case z.Sensor:if(ye.isIdentical(_t.normal,as)){const qt=new ae(_t.cx*ot.lx,_t.cy*ot.ly,_t.cz*ot.lz).applyEuler(new ln(0,0,Bt));qt.add(tt),he.current.set(_t.id,qt)}break;case z.Polygon:if(ye.isIdentical(_t.normal,as)){const qt=_t,un=[];for(const Rn of qt.vertices){const yo=new Kt(Rn.x*ot.lx,Rn.y*ot.ly).rotateAround(ai,Bt);yo.add(new Kt(tt.x,tt.y)),un.push(yo)}pe.current.set(qt.id,un)}break}break}case z.Foundation:{Ad(ot)&&Rt(Ge,ot),he.current.clear(),pe.current.clear(),me.current.clear();const bt=new Kt(ot.cx,ot.cy),zt=new ae(ot.cx,ot.cy,ot.cz),Bt=n(ot.id);if(Bt.length>0){const Ht=ot.rotation[2];for(const _t of Bt)switch(_t.type){case z.Wall:{const qt=_t,un=new Kt(qt.cx,qt.cy).rotateAround(ai,Ht);un.add(bt);const Rn=new Kt(qt.leftPoint[0],qt.leftPoint[1]).rotateAround(ai,Ht);Rn.add(bt);const yo=new Kt(qt.rightPoint[0],qt.rightPoint[1]).rotateAround(ai,Ht);yo.add(bt),me.current.set(qt.id,{centerPointAbsPos:un,leftPointAbsPos:Rn,rightPointAbsPos:yo});break}case z.Tree:case z.Flower:case z.Human:{const qt=new ae(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Ht));qt.add(zt),he.current.set(_t.id,qt);break}case z.SolarPanel:{const qt=new ae(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Ht)).add(zt);he.current.set(_t.id,qt);break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:{const qt=new ae(_t.cx*ot.lx,_t.cy*ot.ly,_t.cz*ot.lz).applyEuler(new ln(0,0,Ht));qt.add(zt),he.current.set(_t.id,qt);break}case z.Polygon:{const qt=_t,un=[];for(const Rn of qt.vertices){const yo=new Kt(Rn.x*ot.lx,Rn.y*ot.ly).rotateAround(ai,Ht);yo.add(bt),un.push(yo)}pe.current.set(qt.id,un);break}}}const tt=At(ot.id);if(tt.length>0){const Ht=new ln(0,0,ot.rotation[2]);for(const _t of tt)if(_t.type===z.Window||_t.type===z.SolarPanel||_t.type===z.SolarWaterHeater){const qt=new ae(_t.cx,_t.cy).applyEuler(Ht);qt.add(zt),he.current.set(_t.id,qt)}else{const qt=new ae(_t.cx*ot.lx,_t.cy*ot.ly).applyEuler(Ht);qt.add(zt),he.current.set(_t.id,qt)}}break}}}else D.current=null}}},Wt=Ge=>Ge===z.Human||Ge===z.Tree||Ge===z.Flower,ht=(Ge,yt)=>{if(Ge.tempHumanPlant.length===0){const Pt=Ge.elements.filter(bt=>Wt(bt.type)&&ye.isDescendantOf(bt,yt));Ge.tempHumanPlant=Pt;const ot=new Set(Pt.map(bt=>bt.id));Ge.elements=Ge.elements.filter(bt=>!ot.has(bt.id))}},ct=(Ge,yt)=>{const Pt=Ge.intersections.find(bt=>{const zt=bt.eventObject;if(!zt.name.includes("Cuboid"))return!1;const Bt=zt.name.split(" ");return Bt.length!==2?!1:Bt[1]!==yt&&zt.userData.stackable});if(!Pt)return;const ot=Pt.eventObject.name.split(" ")[1];if(!De.current.has(ot))return ye.isChild(yt,ot)?void 0:Pt};m.useEffect(()=>{D.current&&(F||A!==z.None)&&(le.current&&A!==z.Foundation?(le.current=!1,Te.current=!1,t(Ge=>{Ge.addedFoundationId=null,Ge.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(D.current.id,!1),D.current=null):ge.current&&A!==z.Cuboid&&(ge.current=!1,Se.current=!1,t(Ge=>{Ge.addedCuboidId=null,Ge.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(D.current.id,!1),D.current=null))},[A,F]);const It=Ge=>{if(D.current&&D.current.type&&!D.current.locked){We(Ge);let yt;switch(D.current.type){case z.Foundation:k.current&&(yt=Pe.intersectObjects([k.current]),yt.length>0&&(y?at(yt[0].point):S?kt(yt[0].point):C&&rt(yt[0].point)));break;case z.Cuboid:if(k.current&&Ne===Qf.Horizontal&&(yt=Pe.intersectObjects([k.current]),yt.length>0)){const Pt=yt[0].point.clone(),ot=ct(Ge,D.current.id);if(y)if(De.current.size>1)at(Pt);else if(ot){if(yt=Pe.intersectObjects([ot.eventObject]),yt.length===0)return;Pt.copy(yt[0].point).add(fe.current);const bt=ot.eventObject.name.split(" ")[1];t(zt=>{const Bt=zt.elements.find(Ht=>{var _t;return Ht.id===((_t=zt.selectedElement)==null?void 0:_t.id)}),tt=zt.selectedElement;if(Bt&&tt){const{pos:Ht,rot:_t}=ye.getWorldDataById(bt),qt=new ae().subVectors(Pt,Ht);if(qt.applyEuler(new ln(0,0,-_t)),Bt.cx=qt.x,Bt.cy=qt.y,tt.parentId!==bt){Bt.parentId!==bt&&ht(zt,Bt.id);const{rot:un}=ye.getWorldDataById(tt.id);Bt.rotation[2]=un-_t,Bt.parentId=bt}else Bt.parentId!==bt&&(Bt.parentId!==tt.parentId&&ht(zt,Bt.id),Bt.parentId=tt.parentId,Bt.rotation[2]=tt.rotation[2])}})}else t(bt=>{const zt=bt.elements.find(Bt=>Bt.id===D.current.id);if(zt&&zt.parentId!==Zo){zt.parentId!==Zo&&ht(bt,zt.id);const{rot:Bt}=ye.getWorldDataById(zt.parentId);zt.rotation[2]+=Bt,zt.parentId=Zo}}),at(Pt);else if(S){const bt=a(D.current.id);bt&&bt.parentId===Zo&&kt(Pt)}}break}}if(W.current){if(A!==z.None){We(Ge);const yt=Pe.intersectObjects([W.current]);if(yt.length>0){const Pt=yt[0].point;switch(A){case z.Foundation:{const ot=i(x,Pt);ot&&(t(bt=>{bt.addedFoundationId=ot.id,bt.objectTypeToAdd=z.None}),D.current=ot,le.current=!0);break}case z.Cuboid:{const ot=i(x,Pt);ot&&(t(bt=>{bt.addedCuboidId=ot.id,bt.objectTypeToAdd=z.None}),D.current=ot,ge.current=!0);break}}}}if(D.current&&(le.current||ge.current)){We(Ge);let yt=Pe.intersectObjects([W.current]);if(yt.length===0)return;const Pt=yt[0].point;if(D.current.type===z.Foundation)o(D.current.id,Pt.x,Pt.y);else if(D.current.type===z.Cuboid){const ot=ct(Ge,D.current.id);if(ot){if(yt=Pe.intersectObjects([ot.eventObject]),yt.length===0)return;Pt.copy(yt[0].point);const bt=ot.eventObject.name.split(" ")[1];t(zt=>{const Bt=zt.elements.find(tt=>{var Ht;return tt.id===((Ht=D.current)==null?void 0:Ht.id)});if(Bt){const{pos:tt,rot:Ht}=ye.getWorldDataById(bt),_t=new ae().subVectors(Pt,tt);_t.applyEuler(new ln(0,0,-Ht)),Bt.cx=_t.x,Bt.cy=_t.y,Bt.parentId=bt,Bt.rotation[2]=-Ht}})}else t(bt=>{const zt=bt.elements.find(Bt=>{var tt;return Bt.id===((tt=D.current)==null?void 0:tt.id)});if(zt&&zt.parentId!==Zo){const{rot:Bt}=ye.getWorldDataById(zt.parentId);zt.rotation[2]+=Bt,zt.parentId=Zo}}),o(D.current.id,Pt.x,Pt.y)}}}},Ft=Ge=>{if(D.current&&D.current.type&&!D.current.locked){We(Ge);let yt;if(k.current&&Ne===Qf.Vertical&&(yt=Pe.intersectObjects([k.current]),yt&&yt.length>0)){const Pt=yt[0].point;switch(D.current.type){case z.Tree:{const ot=D.current;switch(S){case Mt.Top:s(ot.id,Pt.z),t(bt=>{bt.selectedElementHeight=Math.max(1,Pt.z)});break;case Mt.Left:case Mt.Right:case Mt.Upper:case Mt.Lower:l(ot.id,2*Math.hypot(Pt.x-ot.cx,Pt.y-ot.cy));break}je(kn.getState().treeRef,Ge);break}case z.Flower:{je(kn.getState().flowerRef,Ge);break}case z.Human:{je(kn.getState().humanRef,Ge);break}}}}},Ve=Ge=>Ge===z.Foundation||Ge===z.Cuboid||Ge===z.Tree||Ge===z.Flower||Ge===z.Human,ft=(Ge,yt,Pt,ot,bt)=>{if(Ge){for(const zt of Ge.children)if(zt.name.includes("Human")||zt.name.includes("Tree")||zt.name.includes("Flower")){const Bt=Oe(zt),tt=he.current.get(Bt);if(tt)if(Math.abs(se.current.z/2-zt.position.z)<.01){const Ht=new ae().subVectors(tt,ot).applyEuler(new ln(0,0,-bt));zt.position.setX(Ht.x),zt.position.setY(Ht.y)}else{const Ht=new ae().subVectors(tt,L.current).applyEuler(new ln(0,0,-bt)),_t=new ae().subVectors(ot,L.current),qt=new ae().subVectors(Ht,_t);Math.abs(Ht.x/se.current.x)>.49?(zt.position.setX((Ht.x>0?yt:-yt)/2),zt.position.setY(qt.y)):Math.abs(Ht.y/se.current.y)>.49&&(zt.position.setX(qt.x),zt.position.setY((Ht.y>0?Pt:-Pt)/2))}}}},kt=Ge=>{if(!D.current)return;const yt=new Kt(Ge.x,Ge.y),Pt=new Kt(P.x,P.y),ot=Pt.distanceTo(yt),bt=Math.atan2(yt.x-P.x,yt.y-P.y)+D.current.rotation[2];let zt=Math.abs(ot*Math.sin(bt)),Bt=Math.abs(ot*Math.cos(bt));const tt=new Kt().addVectors(yt,Pt).multiplyScalar(.5);if(D.current.type===z.Cuboid&&(S===Mt.Lower||S===Mt.Upper||S===Mt.Left||S===Mt.Right)){const Ht=new ae(P.x,P.y),_t=D.current.rotation[2],qt=new ae(Ge.x,Ge.y).sub(Ht).applyEuler(new ln(0,0,-_t)),un=new ae(1,0,0);(S===Mt.Upper||S===Mt.Lower)&&un.set(0,1,0),un.applyEuler(new ln(0,0,_t));const Rn=Ht.clone().add(un.clone().multiplyScalar(qt.x/2));S===Mt.Left||S===Mt.Right?(zt=Math.abs(qt.x),Bt=D.current.ly):(S===Mt.Upper||S===Mt.Lower)&&(zt=D.current.lx,Bt=Math.abs(qt.y),Rn.copy(Ht.add(un.clone().multiplyScalar(qt.y/2)))),tt.x=Rn.x,tt.y=Rn.y}switch(t(Ht=>{if(!D.current)return;let _t=!1;for(const qt of Ht.elements)if(qt.id===D.current.id){switch(qt.type){case z.Cuboid:case z.Foundation:{const un=n(qt.id);if(un.length>0){const Rn=[];for(const Ao of un){if(ye.isPlantOrHuman(Ao))continue;const wo=JSON.parse(JSON.stringify(Ao));if(Rn.push(wo),ye.isIdentical(wo.normal,as))if(Ao.type===z.Wall){const Io=me.current.get(Ao.id);if(Io){const po=-qt.rotation[2],{centerPointAbsPos:On,leftPointAbsPos:fo,rightPointAbsPos:ir}=Io,Rr=new Kt().subVectors(On,tt).rotateAround(ai,po),br=new Kt().subVectors(fo,tt).rotateAround(ai,po),_r=new Kt().subVectors(ir,tt).rotateAround(ai,po);switch(S){case Mt.Lower:case Mt.Upper:wo.cy=Rr.y;break;case Mt.Left:case Mt.Right:wo.cx=Rr.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:wo.cx=Rr.x,wo.cy=Rr.y;break}wo.leftPoint=[br.x,br.y,0],wo.rightPoint=[_r.x,_r.y,0]}}else{const Io=he.current.get(Ao.id);if(Io){const po=-qt.rotation[2],On=new Kt().subVectors(new Kt(Io.x,Io.y),tt).rotateAround(ai,po);switch(S){case Mt.Lower:case Mt.Upper:wo.type===z.SolarPanel?wo.cy=On.y:wo.cy=On.y/Bt;break;case Mt.Left:case Mt.Right:wo.type===z.SolarPanel||wo.type===z.SolarWaterHeater?wo.cx=On.x:wo.cx=On.x/zt;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:wo.type===z.SolarPanel?(wo.cx=On.x,wo.cy=On.y):(wo.cx=On.x/zt,wo.cy=On.y/Bt);break}}}else if((wo.type===z.SolarPanel||wo.type===z.SolarWaterHeater)&&wo.parentType===z.Roof){const Io=he.current.get(Ao.id);if(Io){const po=new Kt().subVectors(new Kt(Io.x,Io.y),tt).rotateAround(ai,-qt.rotation[2]);wo.cx=po.x,wo.cy=po.y}}}const yo=JSON.parse(JSON.stringify(qt));switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:yo.lx=zt,yo.ly=Bt,yo.cx=tt.x,yo.cy=tt.y;break}if(ye.doesParentContainAllChildren(yo,Rn)){switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.lx=zt,qt.ly=Bt,qt.cx=tt.x,qt.cy=tt.y;break}_t=!0}}else if(zt>.49&&Bt>.49){switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.lx=zt,qt.ly=Bt,qt.cx=tt.x,qt.cy=tt.y;break}_t=!0}break}}break}if(_t)for(const qt of Ht.elements){if(qt.parentId===D.current.id)switch(qt.type){case z.Wall:{const un=qt,Rn=me.current.get(qt.id);if(Rn){const yo=-D.current.rotation[2],{centerPointAbsPos:Ao,leftPointAbsPos:wo,rightPointAbsPos:Io}=Rn,po=new Kt().subVectors(Ao,tt).rotateAround(ai,yo),On=new Kt().subVectors(wo,tt).rotateAround(ai,yo),fo=new Kt().subVectors(Io,tt).rotateAround(ai,yo);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=po.y;break;case Mt.Left:case Mt.Right:qt.cx=po.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=po.x,qt.cy=po.y;break}un.leftPoint=[On.x,On.y,0],un.rightPoint=[fo.x,fo.y,0]}break}case z.SolarPanel:{const un=he.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]),[yo,Ao,wo]=qt.normal;ye.isEqual(wo,1)&&(qt.cx=Rn.x,qt.cy=Rn.y),ye.isEqual(yo,0)&&ye.isEqual(Ao,1)?qt.cy=Bt/2:ye.isEqual(yo,0)&&ye.isEqual(Ao,-1)?qt.cy=-Bt/2:ye.isEqual(yo,-1)&&ye.isEqual(Ao,0)?qt.cx=-zt/2:ye.isEqual(yo,1)&&ye.isEqual(Ao,0)&&(qt.cx=zt/2)}break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:if(ye.isIdentical(qt.normal,as)){const un=he.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=Rn.y/Bt;break;case Mt.Left:case Mt.Right:qt.cx=Rn.x/zt;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=Rn.x/zt,qt.cy=Rn.y/Bt;break}}}break;case z.Cuboid:{const un=he.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=Rn.y;break;case Mt.Left:case Mt.Right:qt.cx=Rn.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=Rn.x,qt.cy=Rn.y;break}}break}case z.Polygon:if(ye.isIdentical(qt.normal,as)){const un=qt,Rn=pe.current.get(un.id);if(Rn){const yo=[];Rn.forEach(Ao=>{const wo=new Kt().subVectors(Ao,tt).rotateAround(ai,-D.current.rotation[2]);yo.push({x:wo.x/zt,y:wo.y/Bt})}),un.vertices=yo}}break}if(qt.foundationId===D.current.id&&(qt.type===z.SolarPanel||qt.type===z.SolarWaterHeater||qt.type===z.Window)&&qt.parentType===z.Roof){const un=he.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);qt.cx=Rn.x,qt.cy=Rn.y}}if(qt.foundationId===D.current.id&&(qt.type===z.Sensor||qt.type===z.Light)&&qt.parentType===z.Roof){const un=he.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);qt.cx=Rn.x/zt,qt.cy=Rn.y/Bt}}}}),D.current.type){case z.Foundation:{const Ht=kn.getState().foundationRef;Ht!=null&&Ht.current&&ft(Ht==null?void 0:Ht.current,zt,Bt,Ht.current.position,D.current.rotation[2]);break}case z.Cuboid:{const Ht=kn.getState().cuboidRef;Ht!=null&&Ht.current&&Ht.current.parent&&ft(Ht==null?void 0:Ht.current,zt,Bt,Ht.current.parent.position,D.current.rotation[2]);break}}},rt=Ge=>{const{cx:yt,cy:Pt}=D.current,ot=Math.atan2(yt-Ge.x,Ge.y-Pt)+(C===Di.Upper?0:Math.PI),bt=Math.abs(ot)>Math.PI?-Math.sign(ot)*sa:0;r(D.current.id,0,0,ot+bt)},at=Ge=>{const yt=De.current.size>1;if(yt){t(Bt=>{for(const tt of Bt.elements)if(Ad(tt)&&De.current.has(tt.id)){const Ht=De.current.get(tt.id);Ht&&(tt.cx=Ge.x+Ht.x,tt.cy=Ge.y+Ht.y)}});return}let Pt,ot;const bt=D.current.lx/2,zt=D.current.ly/2;switch(y){case zo.Top:{if(yt){const Bt=new ae(Ge.x,Ge.y);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new ae().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Ge.x,Ge.y);break}case zo.Upper:if(Pt=Ge.x+ze*zt,ot=Ge.y-Me*zt,yt){const Bt=new ae(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new ae().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Lower:if(Pt=Ge.x-ze*zt,ot=Ge.y+Me*zt,yt){const Bt=new ae(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new ae().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Left:if(Pt=Ge.x+Me*bt,ot=Ge.y+ze*bt,yt){const Bt=new ae(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new ae().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Right:if(Pt=Ge.x-Me*bt,ot=Ge.y-ze*bt,yt){const Bt=new ae(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new ae().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break}};return m.useEffect(()=>{const Ge=()=>{const yt=M.getState().addedFoundationId,Pt=M.getState().addedCuboidId;yt&&(c(yt,!1),t(ot=>{ot.objectTypeToAdd=z.Foundation,ot.addedFoundationId=null}),kn.getState().setEnableOrbitController(!0),D.current=null,le.current=!1,Te.current=!1),Pt&&(c(Pt,!1),t(ot=>{ot.objectTypeToAdd=z.Cuboid,ot.addedCuboidId=null}),kn.getState().setEnableOrbitController(!0),D.current=null,ge.current=!1,Se.current=!1)};return window.addEventListener("beforeunload",Ge),()=>{window.removeEventListener("beforeunload",Ge)}},[]),h.jsxs(h.Fragment,{children:[D.current&&Ne!==Qf.Ground&&h.jsx(ta,{ref:k,visible:!1,name:"Ground Intersection Plane",rotation:Ue,position:Je,args:[1e5,1e5],onPointerMove:k2.throttle(Ft,qF,{trailing:!1}),children:h.jsx("meshStandardMaterial",{side:ti,opacity:.5,transparent:!0})}),h.jsx(ta,{receiveShadow:v,ref:W,name:"Ground",userData:{stand:!0},rotation:[0,0,0],position:[0,0,0],args:[1e4,1e4],renderOrder:-2,onContextMenu:it,onPointerDown:pt,onPointerMove:k2.throttle(It,qF,{trailing:!1}),children:H&&!w?h.jsx("meshBasicMaterial",{color:T}):h.jsx("meshStandardMaterial",{depthTest:!1,color:w?"white":T,map:w?ye.WATER_TEXTURE:ye.WHITE_TEXTURE,needsUpdate:!0})})]})}),sae=48,Hnn=72,Mnn=12,Inn=be.memo(({date:t,hourAngle:e,declinationAngle:n,worldLatitude:o})=>{const r=M(ay),i=M(DBe),a=M(TBe)??!0,l=M(PBe)??!0,s=M(CBe)??!0,[c,u]=m.useState(ye.toRadians(42)),d=Hb(Jye),f=Math.max(2,r*.2),p=Math.max(.4,r*.025),g=r3(hW,mN),A=r*.05,y={font:g,height:0,size:A},S=6,C=new Array(2*S+1).fill(0),P=V=>V===0?-A*.3:V>0&&V<7?-A*.8:-A*1.2;m.useEffect(()=>{u(ye.toRadians(o))},[o]);const v=6,[T,w]=m.useMemo(()=>{const V=new ji,G=new ji,q=[],$=[],ie=sa/Hnn;let Q=0;for(let oe=0;oeEt&&(he=.05*r+(Q%3===0?.2:0),pe=new ae(r,de,0),pe.z=.002,$.push(ye.sphericalToCartesianZ(pe)),pe=new ae(r+he,de,0),pe.z=.002,$.push(ye.sphericalToCartesianZ(pe))),Q++}const se=q.length*3,Z=new Float32Array(se),ee=new Float32Array(se),te=new Float32Array(se);for(let oe=0;oe{const V=[],G=dl(t,ye.toDegrees(c)),q=yO(G.sunrise),$=yO(G.sunset),ie=($-q)/sae;for(let Q=q;Q<$+ie/2;Q+=ie){const se=a9(r,Q,n,c);se.z>-.01&&V.push(se)}return V},[t,c,r,n]),b=V=>{const G=yN(V),q=[],$=dl(V,ye.toDegrees(c)),ie=yO($.sunrise),Q=yO($.sunset),se=(Q-ie)/sae;for(let Z=ie;Z-.01&&q.push(ee)}return q},R=m.useMemo(()=>{const V=[];for(let G=0;G<=v;G++){const q=new Date(2021,G===0?11:G-1,22);V.push(b(q))}return V},[c,r]),H=m.useMemo(()=>a9(r,e,n,c),[c,n,e,r]),F=m.useMemo(()=>H.clone().normalize(),[H]),E=m.useMemo(()=>new ae(H.x,H.y,0).normalize(),[H]),N=m.useMemo(()=>Math.asin(H.z/H.length()),[H]),U=m.useMemo(()=>{const G=new z2(0,0,f,f,0,N,!1,0).getPoints(25),q=new Array;for(const $ of G)q.push(new ae($.x,$.y,0));return q},[N,H,f]),W=m.useMemo(()=>Math.acos(H.z/H.length()),[H]),k=m.useMemo(()=>{const G=new z2(0,0,f*.8,f*.8,N,Qt,!1,0).getPoints(25),q=new Array;for(const $ of G)q.push(new ae($.x,$.y,0));return q},[W,H,f,N]),D=m.useMemo(()=>{const V=Math.acos(H.y/Math.hypot(H.x,H.y));return H.x>0?-V:V},[H]),L=m.useMemo(()=>{const G=new z2(0,0,f*1.2,f*1.2,Qt,Qt+D,H.x>0,0).getPoints(50),q=new Array;for(const $ of G)q.push(new ae($.x,$.y,0));return q},[D,H,f]),j=m.useMemo(()=>{const V=2*fP/Mnn,G=sa/sae,q=new ji;let $=0;const ie=[],Q=[];for(let se=-fP;seMath.PI&&(ee=Math.PI),te>fP&&(te=fP);const oe=a9(r,Z,se,c),de=a9(r,ee,se,c),he=a9(r,ee,te,c),pe=a9(r,Z,te,c);(oe.z>=0||de.z>=0||he.z>=0||pe.z>=0)&&(ie.push(oe,de,he,pe),Q.push($),Q.push($+1),Q.push($+2),Q.push($),Q.push($+2),Q.push($+3),$+=4)}return q.setFromPoints(ie),q.setIndex(new tl(new Uint16Array(Q),1)),q},[c,r]),B=.05*r,O=2+5*B;return h.jsxs("group",{children:[C.map((V,G)=>{let q=Math.ceil(G/2)*(G%2===0?1:-1);q===-S&&(q=S);const $=P(Math.abs(q));return h.jsx("group",{rotation:[Qt,q*Math.PI/S,0],children:h.jsxs("mesh",{position:[$,0,-r*1.1],rotation:[-Qt,0,0],children:[h.jsx("textGeometry",{args:[`${-(180/S)*q}°`,y]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},G)}),h.jsxs("mesh",{rotation:new ln(0,0,0),name:"Heliodon",children:[h.jsxs("mesh",{children:[h.jsx("bufferGeometry",{...T}),h.jsx("meshBasicMaterial",{side:ti,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-.7,polygonOffsetUnits:-2})]}),h.jsxs("lineSegments",{children:[h.jsx("bufferGeometry",{...w}),h.jsx("meshBasicMaterial",{color:0})]}),h.jsxs("mesh",{children:[x.length>3&&h.jsx(Gn,{lineWidth:2,points:x,color:"yellow"}),R.filter(V=>V.length>3).map((V,G)=>h.jsx(Gn,{opacity:G===0||G===v?1:.5,lineWidth:G===0||G===v?1:.5,points:V,color:"#999"},G)),h.jsx("mesh",{args:[j],children:h.jsx("meshBasicMaterial",{side:ti,color:[1,1,0],transparent:!0,opacity:.5,depthWrite:!1,clippingPlanes:[new l9(Yc,0)]})}),h.jsx("mesh",{position:H,children:h.jsx("sprite",{scale:[O,O,O],children:h.jsx("spriteMaterial",{map:d,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})}),h.jsxs("mesh",{position:H,children:[h.jsx("sphereGeometry",{args:[B,10,10]}),h.jsx("meshBasicMaterial",{color:"white"})]})]})]}),h.jsx(ta,{args:[1e4,1e4],renderOrder:-1,userData:{unintersectable:!0},children:h.jsx("meshBasicMaterial",{transparent:!0,opacity:0})}),i&&H.z>0&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[H.x,H.y,H.z]],name:"Line from origin to sun",lineWidth:.5,color:"white"}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[H.x,H.y,0]],name:"Line from origin to sun projection on ground",lineWidth:.5,color:"white"}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[H.x,H.y,0],[H.x,H.y,H.z]],name:"Line from sun projection on ground to sun",lineWidth:.5,color:"white"}),l&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:U,position:[0,0,0],rotation:new ln(Qt,0,Qt+D,"ZXY"),color:"white",name:"Elevation Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Elevation Angle",backgroundColor:"indigo",text:ye.toDegrees(N).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:F.clone().multiplyScalar(f).add(E.clone().multiplyScalar(f)).multiplyScalar(.65)})]}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:k,position:[0,0,0],rotation:new ln(Qt,0,Qt+D,"ZXY"),color:"white",name:"Zenith Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Zenith Angle",backgroundColor:"navy",text:ye.toDegrees(W).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:F.clone().multiplyScalar(f).add(ko.clone().multiplyScalar(f)).multiplyScalar(.57)})]}),a&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:L,position:[0,0,0],color:"white",name:"Azimuth Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Azimuth Angle",backgroundColor:"firebrick",text:ye.toDegrees(Math.abs(D-Math.PI)<1e-6?D:-D).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:E.clone().multiplyScalar(f).add(Yc.clone().multiplyScalar(f)).multiplyScalar(1.1).add(new ae(0,0,p/2))})]})]})]})}),znn=be.memo(()=>{const t=M(zBe),e=M(ay),n=M(s0),o=M(Al),r=M(q7t),i=m.useMemo(()=>new Date(o),[o]),[a,l]=m.useMemo(()=>[Xye(i),yN(i)],[i]);return m.useEffect(()=>{r(a9(e,a,l,ye.toRadians(n)))},[n,a,l,e]),h.jsx(h.Fragment,{children:t&&h.jsx(Inn,{date:new Date(o),hourAngle:a,declinationAngle:l,worldLatitude:n})})}),tPe="/aladdin/assets/ifi-logo-CwxGDl7t.png",Dnn="/aladdin/assets/magic-lamp-XxXOV1dq.png",Enn=be.memo(({top:t,height:e,color:n})=>{const o=M(m0),r=m.useMemo(()=>({lng:o}),[o]);return h.jsx("div",{children:h.jsxs("div",{style:{position:"absolute",borderRadius:"20px",border:"thin",textAlign:"center",left:"5%",right:"5%",top:t+"px",height:(e??300)+"px"},children:[h.jsx("h2",{style:{marginTop:"20px",color:n},children:Y.t("aboutUs.ProductBroughtToYouBy",r)}),h.jsx("p",{style:{fontSize:"16px",color:n},children:"Charles Xie and Xiaotong Ding"}),h.jsxs("div",{style:{position:"absolute",marginTop:"20px",fontSize:"12px",textAlign:"justify",color:n},children:[Y.t("aboutUs.Translators",r),": ",s9.Ukrainian," (Andriy Kashyrskyy), ",s9.Spanish," (Alex Barco), ",s9.Turkish," (Hasan Bircan)",h.jsx("br",{}),h.jsx("br",{}),Y.t("aboutUs.Acknowledgment",r),": ",Y.t("aboutUs.FundingInformation",r)," ",Y.t("aboutUs.Contact",r),h.jsx("hr",{style:{width:"100%",marginTop:"20px",color:n}}),h.jsxs("p",{style:{textAlign:"center",paddingTop:"6px",fontSize:"12px",color:n},children:[h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-terms.html",style:{color:n,textDecoration:"none"},children:Y.t("aboutUs.TermsOfService",r)}),"   |   ",h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-privacy.html",style:{color:n,textDecoration:"none"},children:Y.t("aboutUs.PrivacyPolicy",r)})]})]})]})})}),Fnn=Ho.div` +`,bnn=be.memo(function({initializing:e}){const n=dt(b7t),o=dt(Cf),r=dt(_Ye),i=dt(Gge),a=dt(GYe),l=M(Hge),s=M(Mge),c=M(Rge),u=M(XBe),d=M(F8t),f=dt($Ye),p=dt(QYe),g=dt(vOe),A=dt(xOe),y=dt(pOe),S=dt(gOe),C=dt(wW),P=dt(AW),v=dt(Xq),T=M.getState().elements;return h.jsx(h.Fragment,{children:(e||n||o||r)&&h.jsxs(h.Fragment,{children:[o&&(!c&&C||!d&&(P||v)||!l&&(g||A)||!u&&(y||S)||!s&&(f||p)||me.hasMovingParts(T))&&h.jsx(wnn,{}),r&&h.jsx(xnn,{}),h.jsx(YQ,{spinning:!i||!a})]})})}),Snn=()=>{if(M(FH),!dt.getState().waiting)return null;const e=()=>(m.useEffect(()=>(dt.getState().set(n=>{n.waiting=!1}),()=>{dt.getState().set(n=>{n.waiting=!1})})),null);return h.jsx(e,{})},Tnn=be.memo(({id:t,cx:e,cy:n,cz:o,lx:r,lz:i,birdSafe:a=uc.None,numberOfBlades:l=3,speed:s=10,hubRadius:c=.75,hubLength:u=1.5,maximumChordRadius:d=3,maximumChordLength:f=1,towerHeight:p,towerRadius:g,bladeRadius:A,bladeTipWidth:y=.2,bladeRootRadius:S=.3,rotation:C=[0,0,0],relativeYawAngle:P=0,initialRotorAngle:v=0,pitchAngle:T=me.toRadians(10),color:w="white",bladeColor:x=t9,stripeColor:b=n9,lineColor:R="black",lineWidth:H=.5,showLabel:F=!1,locked:E=!1,parentId:N})=>{const U=M(pn),W=M(Jn),k=M(pu),D=Tc(t),L=M(Cs),j=M(Al),{gl:{domElement:B}}=ri(),[O,V]=m.useState(!1),G=m.useRef(null),q=m.useRef(null),$=m.useRef(!1),ie=$t(),Q=m.useMemo(()=>me.fetchBladeTexture(A,S*2,100,a,x,b),[S,A,a,x,b]),se=M(De=>{for(const Ae of De.elements)if(Ae.id===N)return Ae});if(se)switch(se.type){case z.Foundation:if(o=se.lz,me.isZero(C[2]))e=se.cx+e*se.lx,n=se.cy+n*se.ly;else{const De=new le(e*se.lx,n*se.ly,0);De.applyAxisAngle(ko,C[2]),e=se.cx+De.x,n=se.cy+De.y}break}const oe=W(t),Z=c*1.25,te=u*2.5,ee=A-d/3,de=m.useMemo(()=>{const De=f-S,Ae=new kl,ue=[];return ue.push(new Kt(-S,0)),ue.push(new Kt(-De/2,A-ee)),ue.push(new Kt(-De,d)),ue.push(new Kt(S-y,A)),Ae.moveTo(-S,0),Ae.splineThru(ue),Ae.lineTo(S,A),Ae.lineTo(S,0),Ae.closePath(),Ae},[A,ee,f,d,S,y]),fe=m.useMemo(()=>{const De=new Date(j);return v+s*(De.getHours()*60+De.getMinutes())*Math.PI/72},[j,s,v]);m.useEffect(()=>{const De=()=>{kn.getState().setEnableOrbitController(!0),$.current=!1};return window.addEventListener("pointerup",De),()=>{window.removeEventListener("pointerup",De)}},[]);const pe=m.useMemo(()=>(oe!=null&&oe.label?oe.label:Y.t("shared.WindTurbineElement",ie))+(oe!=null&&oe.locked?" ("+Y.t("shared.ElementLocked",ie)+")":"")+(oe!=null&&oe.label?"":` +`+Y.t("word.Coordinates",ie)+": ("+e.toFixed(1)+", "+n.toFixed(1)+", "+o.toFixed(1)+") "+Y.t("word.MeterAbbreviation",ie)),[oe==null?void 0:oe.label,oe==null?void 0:oe.locked,ie,e,n,o]),ye=m.useMemo(()=>new ln(0,0,C[2]+P,"ZXY"),[C,P]),ae=(De,Ae)=>{De.intersections.length>0&&De.intersections[0].object===De.eventObject&&(B.style.cursor=Ae===zo.Default?"move":"pointer")},Te=()=>{B.style.cursor="default"},ge=Wg*4,Se=m.useMemo(()=>{const De=Math.PI*2/l,Ae=new Array;for(let ue=0;ueh.jsxs("group",{position:new le(0,-u*.85,p),rotation:[Qt,T,Ae,"XZY"],children:[h.jsxs("mesh",{name:"Blade "+De+" Font Side",receiveShadow:L,castShadow:L,children:[h.jsx("shapeGeometry",{attach:"geometry",args:[de]}),h.jsx("meshStandardMaterial",{attach:"material",color:x,side:Da,map:ue})]}),h.jsxs("mesh",{name:"Blade "+De+" Back Side",receiveShadow:L,castShadow:L,position:new le(0,-.05,0),children:[h.jsx("shapeGeometry",{attach:"geometry",args:[de]}),h.jsx("meshStandardMaterial",{attach:"material",color:x,side:r0,map:ue})]}),h.jsx(ma,{name:"Blade root",castShadow:!1,receiveShadow:!1,args:[S*1.1,S*1.1,.24,12,1],position:new le(0,c-.14,0),children:h.jsx("meshStandardMaterial",{attach:"material",color:w})})]},De);return h.jsxs("group",{name:"Wind Turbine Group "+t,rotation:ye,position:[e,n,o],children:[h.jsx("group",{children:D&&!E&&h.jsx(Ps,{ref:q,position:new le(0,0,0),args:[ge+g,6,6],name:zo.Default,castShadow:!1,receiveShadow:!1,onPointerOver:De=>{ae(De,zo.Default)},onPointerOut:()=>{Te()},onPointerDown:De=>{De.button!==2&&k(t,De,Xo.Move)},children:h.jsx("meshStandardMaterial",{attach:"material",color:"orange"})})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Tower",ref:G,castShadow:L,receiveShadow:L,args:[g*.8,g*1.2,p,4,1],position:new le(0,0,p*.5),rotation:[Qt,0,0],onPointerDown:De=>{De.button!==2&&(k(t,De,Xo.Select),kn.getState().setEnableOrbitController(!1))},onContextMenu:De=>{k(t,De,Xo.ContextMenu),U(Ae=>{De.intersections.length>0&&De.intersections[0].object===G.current&&(Ae.contextMenuObjectType=z.WindTurbine)})},onPointerOver:De=>{De.intersections.length>0&&De.intersections[0].object===G.current&&(V(!0),B.style.cursor="move")},onPointerOut:()=>{V(!1),B.style.cursor="default"},children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(Ps,{userData:{unintersectable:!0},name:"Hub",castShadow:L,receiveShadow:L,args:[c,8,8,Qt,Math.PI,0,Math.PI],position:new le(0,-u*.5,p),rotation:[Math.PI,0,Qt],scale:[u/c,1,1],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(ma,{userData:{unintersectable:!0},name:"Hub Cap",castShadow:L,receiveShadow:L,args:[c,c,.01,16,1],position:new le(0,-u*.5,p),rotation:[Math.PI,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),h.jsx(p4t,{userData:{unintersectable:!0},name:"Nacelle",castShadow:L,receiveShadow:L,radius:.1,smoothness:4,args:[Z,Z,te],position:new le(0,(te-u)*.5-.1,p),rotation:[Qt,0,0],children:h.jsx("meshStandardMaterial",{attach:"material",color:w})}),a!==uc.None&&Se.map((De,Ae)=>Re(Ae,De,Q)),a===uc.None&&Se.map((De,Ae)=>Re(Ae,De,null)),D&&E&&h.jsx(Gn,{name:"Selection highlight lines",userData:{unintersectable:!0},points:[[-r/2,0,0],[-r/2,i,0],[-r/2,i,0],[r/2,i,0],[r/2,0,0],[r/2,i,0],[r/2,0,0],[-r/2,0,0]],rotation:[Qt,0,0],castShadow:!1,receiveShadow:!1,lineWidth:1,color:B0}),(O||F)&&!D&&h.jsx("textSprite",{userData:{unintersectable:!0},name:"Label",fontFace:"Roboto",text:pe,color:(oe==null?void 0:oe.labelColor)??"white",fontSize:(oe==null?void 0:oe.labelFontSize)??20,textHeight:(oe==null?void 0:oe.labelSize)??1,castShadow:!1,receiveShadow:!1,position:[0,0,1+p+c]})]})}),Pnn=be.memo(()=>{const t=M(Kn),e=m.useRef(null);return m.useEffect(()=>{e&&kn.setState({contentRef:e})},[]),console.debug(t),h.jsxs("group",{ref:e,name:"Content",children:[t.map(n=>{switch(n.type){case z.Foundation:return h.jsx(sen,{...n},n.id);case z.Sensor:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(R$e,{...o},n.id)}case z.Light:{const o=n;return o.parentType===z.Cuboid?null:h.jsx(H$e,{...o},n.id)}case z.Cuboid:return n.parentId!==Zo?null:h.jsx(I$e,{elements:t,cuboidModel:n},n.id);case z.Human:return h.jsx(ctn,{...n},n.id);case z.Tree:return h.jsx(utn,{...n},n.id);case z.Flower:return h.jsx(gtn,{...n},n.id);case z.ParabolicDish:return h.jsx(ftn,{...n},n.id);case z.ParabolicTrough:return h.jsx(dtn,{...n},n.id);case z.FresnelReflector:return h.jsx(htn,{...n},n.id);case z.Heliostat:return h.jsx(ptn,{...n},n.id);case z.WindTurbine:return h.jsx(Tnn,{...n},n.id);case z.Polygon:switch(n.parentType){case z.Wall:return null;default:return h.jsx(iQe,{...n},n.id)}default:if(n.id)return h.jsx(be.Fragment,{},n.id)}return null}),h.jsx(Snn,{}),h.jsx(Cnn,{})]})}),Cnn=()=>{const t=M($ge);return m.useEffect(()=>{M.getState().set(e=>{e.deletedRoofIdSet.clear()})},[t]),null},Rnn=be.memo(()=>{const t=M(pn),e=M(Db),n=M(LH),o=M(u3),r=M(Bge),i=M(_ge),a=M(Jn),l=M(d3),s=M(jge),c=M(Ap),u=M(Wge),d=M(Kge),f=M(En),p=M(kw),g=M(lYe),A=M(n$),y=M(Ub),S=M(Ug),C=M(o$),P=M(cxt),v=M(Cs),T=M(MBe),w=M(IBe),x=M(Ge=>Ge.world.ground),b=M(uxt),R=M(dxt),H=dt(hs),F=dt($7t),{get:E,scene:N,invalidate:U}=ri(),W=m.useRef(null),k=m.useRef(null),D=m.useRef(null),L=m.useRef(new le),j=m.useRef(new le),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(new Map),G=m.useRef(new Map),q=m.useRef(new Map),$=m.useRef(new Map),ie=m.useRef(new Map),Q=m.useRef(new Map),se=m.useRef(new le(1,1,1)),oe=m.useRef(new le(1,1,1)),Z=m.useRef([0,0,1]),te=m.useRef([0,0,1]),ee=m.useRef(null),de=m.useRef(null),fe=m.useRef(new Map),pe=m.useRef(new Map),ye=m.useRef(new Map),ae=m.useRef(!1),Te=m.useRef(!1),ge=m.useRef(!1),Se=m.useRef(!1),Re=m.useRef(!1),De=m.useRef(new Map),Ae=m.useRef(new Map),ue=m.useRef(new Map),he=m.useRef(new le),ve=$t();m.useEffect(()=>(window.addEventListener("pointerup",$e),()=>{window.removeEventListener("pointerup",$e)}),[]),m.useEffect(()=>{b&&(t(Ge=>{Ge.addedFoundationId=null,Ge.deletedFoundationId=null}),ae.current=!1,Te.current=!1)},[b]),m.useEffect(()=>{R&&(t(Ge=>{Ge.addedCuboidId=null,Ge.deletedCuboidId=null}),ge.current=!1,Se.current=!1)},[R]);const{camera:we}=ri(),Pe=m.useMemo(()=>new l0,[]),Ie=m.useMemo(()=>new Kt,[]),Me=D.current?Math.cos(D.current.rotation[2]):1,ze=D.current?Math.sin(D.current.rotation[2]):0;let Ne=Zf.Ground;const Je=m.useMemo(()=>new le,[]),Ue=m.useMemo(()=>new ln,[]),nt=m.useMemo(()=>new ln,[]);if(D.current){if(me.isPlantOrHuman(D.current)){Ne=Zf.Vertical;const Ge=M.getState().viewState.orthographic?0:-Qt,{x:yt,y:Pt}=we.position,ot=-Math.atan2(yt,Pt);Ue.set(Ge,0,ot,"ZXY"),Je.set(D.current.cx,D.current.cy,0)}else if(y===zo.Top)Ne=Zf.Horizontal,Je.set(D.current.cx,D.current.cy,D.current.lz),Ue.set(0,0,0);else if(me.isMoveHandle(y)||S===Mt.Left||S===Mt.Right||S===Mt.Lower||S===Mt.Upper||S===Mt.LowerLeft||S===Mt.UpperLeft&&D.current.type!==z.Wall||S===Mt.LowerRight||S===Mt.UpperRight&&D.current.type!==z.Wall||C===Di.Lower||C===Di.Upper)Ne=Zf.Horizontal,Je.set(D.current.cx,D.current.cy,Wg),Ue.set(0,0,0);else if(S){Ne=Zf.Vertical;const Ge=d(D.current,S),yt=u(),Pt=-Math.atan2(yt.x,yt.y);Je.set(Ge.x,Ge.y,0),Ue.set(-Qt,0,Pt,"ZXY")}}const We=Ge=>{Ie.x=Ge.offsetX/E().gl.domElement.clientWidth*2-1,Ie.y=-(Ge.offsetY/E().gl.domElement.clientHeight)*2+1,Pe.setFromCamera(Ie,E().camera)},Ee=Ge=>{for(const yt of Ge)if(yt.object.userData.stand)return yt;return null},ke=(Ge,yt)=>{Ge&&t(Pt=>{for(const ot of Pt.elements)if(ot.id===yt&&ot.type!==z.Foundation){ot.parentId=Ge;break}})},Oe=Ge=>{if(!Ge)return"";if(Ge.userData.id)return Ge.userData.id;const yt=Ge.name.split(" ");return yt[2]&&yt[2].length>0?yt[2]:Oe(Ge.parent)},st=(Ge,yt,Pt)=>{if(!Ge||!yt)return;const ot=kn.getState().contentRef;if(ot!=null&&ot.current){const bt=me.getObjectChildById(ot.current,yt),zt=me.getObjectChildById(yt===Zo?ot.current:bt,Pt);if(zt){if(Ge===Zo)ot.current.add(zt);else{const Bt=me.getObjectChildById(ot.current,Ge);Bt==null||Bt.add(zt)}U()}}},je=(Ge,yt)=>{if(Ge&&Ge.current){const Pt=Ee(yt.intersections);if(Pt){const ot=Pt.object,bt=Ge.current.parent;if(ot.name==="Ground"){if(bt&&bt.name!=="Content"){const zt=kn.getState().contentRef;zt&&zt.current&&(zt.current.add(Ge.current),ke(Zo,Oe(Ge.current)))}Ge.current.position.copy(Pt.point),U()}else if(ot.userData.stand){const zt=ot.parent;if(zt){bt&&bt.uuid!==zt.uuid&&(zt.add(Ge.current),ke(Oe(zt),Oe(Ge.current)));const{rot:Bt}=me.getWorldDataById(Oe(zt));nt.set(0,0,-Bt);const tt=new le().subVectors(Pt.point,zt.localToWorld(new le)).applyEuler(nt);Ge.current.position.copy(tt),U()}}Re.current||(Re.current=!0)}}},xt=(Ge,yt,Pt)=>{t(ot=>{for(const bt of ot.elements)if(bt.id===Ge){me.isFoundationOrCuboid(bt)||(bt.parentId=yt),bt.cx=Pt.x,bt.cy=Pt.y,bt.cz=Pt.z;break}})},gt=()=>{if(!D.current)return;const Ge={name:"Resize",timestamp:Date.now(),resizedElementId:D.current.id,resizedElementType:D.current.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldLx:se.current.x,oldLy:se.current.y,oldLz:se.current.z,newLx:oe.current.x,newLy:oe.current.y,newLz:oe.current.z,oldChildrenPositionsMap:new Map(B.current),newChildrenPositionsMap:new Map(O.current),oldPolygonVerticesMap:new Map(V.current),newPolygonVerticesMap:new Map(G.current),oldChildrenParentIdMap:new Map(ie.current),newChildrenParentIdMap:new Map(Q.current),oldWallPointsMap:new Map(q.current),newWallPointsMap:new Map($.current),undo:()=>{var yt,Pt;if(t(ot=>{for(const bt of ot.elements)if(bt.id===Ge.resizedElementId){bt.cx=Ge.oldCx,bt.cy=Ge.oldCy,bt.cz=Ge.oldCz,bt.lx=Ge.oldLx,bt.ly=Ge.oldLy,bt.lz=Ge.oldLz;break}}),Ge.oldChildrenPositionsMap.size>0)for(const[ot,bt]of Ge.oldChildrenPositionsMap.entries()){const zt=a(ot);if((zt==null?void 0:zt.type)!==z.Polygon){t(Ht=>{for(const _t of Ht.elements)if(_t.id===ot){if(_t.cx=bt.x,_t.cy=bt.y,Gt(_t)||(_t.cz=bt.z),_t.type===z.Wall){const qt=_t,un=Ge.oldWallPointsMap.get(qt.id);un&&(qt.leftPoint=[un[0].x,un[0].y,0],qt.rightPoint=[un[1].x,un[1].y,0])}break}Ge.oldWallPointsMap.size>0&&(Ht.updateWallMapOnFoundationFlag=!Ht.updateWallMapOnFoundationFlag)});const Bt=(yt=Ge.oldChildrenParentIdMap)==null?void 0:yt.get(ot),tt=(Pt=Ge.newChildrenParentIdMap)==null?void 0:Pt.get(ot);Bt&&tt&&Bt!==tt&&(st(Bt,tt,ot),ke(Bt,ot))}}if(Ge.oldPolygonVerticesMap.size>0)for(const[ot,bt]of Ge.oldPolygonVerticesMap.entries()){const zt=a(ot);(zt==null?void 0:zt.type)===z.Polygon&&p(ot,bt)}},redo:()=>{var yt,Pt;if(t(ot=>{for(const bt of ot.elements)if(bt.id===Ge.resizedElementId){bt.cx=Ge.newCx,bt.cy=Ge.newCy,bt.cz=Ge.newCz,bt.lx=Ge.newLx,bt.ly=Ge.newLy,bt.lz=Ge.newLz;break}}),Ge.newChildrenPositionsMap.size>0)for(const[ot,bt]of Ge.newChildrenPositionsMap.entries()){t(tt=>{for(const Ht of tt.elements)if(Ht.id===ot){if(Ht.cx=bt.x,Ht.cy=bt.y,(Ht.type!==z.SolarPanel||Ht.parentType!==z.Roof)&&(Ht.cz=bt.z),Ht.type===z.Wall){const _t=Ht,qt=Ge.newWallPointsMap.get(_t.id);qt&&(_t.leftPoint=[qt[0].x,qt[0].y,0],_t.rightPoint=[qt[1].x,qt[1].y,0])}break}Ge.newWallPointsMap.size>0&&(tt.updateWallMapOnFoundationFlag=!tt.updateWallMapOnFoundationFlag)});const zt=(yt=Ge.oldChildrenParentIdMap)==null?void 0:yt.get(ot),Bt=(Pt=Ge.newChildrenParentIdMap)==null?void 0:Pt.get(ot);zt&&Bt&&zt!==Bt&&(st(Bt,zt,ot),ke(Bt,ot))}if(Ge.newPolygonVerticesMap.size>0)for(const[ot,bt]of Ge.newPolygonVerticesMap.entries()){const zt=a(ot);(zt==null?void 0:zt.type)===z.Polygon&&p(ot,bt)}}};return Ge},Ye=(Ge,yt)=>{var zt,Bt;const Pt=kn.getState().contentRef,ot=me.getObjectChildById(Pt==null?void 0:Pt.current,Ge.id);if(ot){for(const tt of ot.children)if(tt.name.includes(`${yt.id}`)){(Bt=(zt=kn.getState().contentRef)==null?void 0:zt.current)==null||Bt.add(tt);break}}yt.parentId=Zo;const bt=new le(yt.cx,yt.cy,yt.cz).applyEuler(new ln(0,0,Ge.rotation[2])).add(L.current);yt.cx=bt.x,yt.cy=bt.y,yt.cz=0,O.current.set(yt.id,new le(bt.x,bt.y,0)),Q.current.set(yt.id,Zo)},it=Ge=>{Ge.intersections.length>0&&Ge.intersections[0].object===W.current&&t(Pt=>{Px.selectNone(Pt),Pt.pastePoint.copy(Ge.intersections[0].point),Pt.clickObjectType=z.Ground,Pt.contextMenuObjectType=z.Ground,Pt.pasteNormal=ko})},ut=Ge=>{const yt=M.getState().resizeHandleType;switch(Ge.type){case z.Tree:switch(yt){case Mt.Top:{const Pt={name:"Change Tree Height",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.z,newValue:Ge.lz,undo:()=>{s(Pt.changedElementId,Pt.oldValue)},redo:()=>{s(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.treeHeight=Ge.lz});return}case Mt.Left:case Mt.Right:case Mt.Lower:case Mt.Upper:{const Pt={name:"Change Tree Spread",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.x,newValue:Ge.lx,undo:()=>{l(Pt.changedElementId,Pt.oldValue)},redo:()=>{l(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.treeSpread=Ge.lx});return}}break;case z.Wall:{const Pt={name:"Change Wall Height",timestamp:Date.now(),changedElementId:Ge.id,changedElementType:Ge.type,oldValue:se.current.z,newValue:Ge.lz,undo:()=>{s(Pt.changedElementId,Pt.oldValue)},redo:()=>{s(Pt.changedElementId,Pt.newValue)}};f(Pt),t(ot=>{ot.actionState.wallHeight=Ge.lz});return}}if(j.current.set(Ge.cx,Ge.cy,Ge.cz),oe.current.set(Ge.lx,Ge.ly,Ge.lz),ie.current.clear(),Q.current.clear(),O.current.clear(),G.current.clear(),$.current.clear(),t(Pt=>{if(Ge.type===z.Cuboid&&(Pt.actionState.cuboidHeight=Ge.lz),Pt.updateSceneRadius(),Pt.updateWallMapOnFoundationFlag=!Pt.updateWallMapOnFoundationFlag,Ge.parentId===Zo){for(const ot of Pt.elements)if(me.isPlantOrHuman(ot)&&ot.parentId===Ge.id&&(ie.current.set(ot.id,Ge.id),!me.isResizingVertical(M.getState().resizeHandleType)))if(Math.abs(se.current.z/2-ot.cz)<.01){const bt=new le(ot.cx,ot.cy,ot.cz).applyEuler(new ln(0,0,Ge.rotation[2])).add(L.current).sub(j.current).applyEuler(new ln(0,0,-Ge.rotation[2]));Math.abs(bt.x)>Math.abs(oe.current.x/2)+.01||Math.abs(bt.y)>Math.abs(oe.current.y/2)+.01?Ye(Ge,ot):(ot.cx=bt.x,ot.cy=bt.y)}else{const bt=new le(ot.cx,ot.cy,ot.cz),zt=new le().subVectors(j.current,L.current),Bt=new le().subVectors(bt,zt);Math.abs(bt.x/se.current.x)>.49?Math.abs(Bt.y)>Ge.ly/2+.5?Ye(Ge,ot):(ot.cx=(bt.x>0?Ge.lx:-Ge.lx)/2,ot.cy=Bt.y):Math.abs(bt.y/se.current.y)>.49&&(Math.abs(Bt.x)>Ge.lx/2+.5?Ye(Ge,ot):(ot.cx=Bt.x,ot.cy=(bt.y>0?Ge.ly:-Ge.ly)/2))}}}),j.current.distanceToSquared(L.current)>Et&&oe.current.distanceToSquared(se.current)>Et){if(Ge.type===z.Foundation||Ge.type===z.Cuboid){const ot=n(Ge.id);if(ot.length>0)for(const bt of ot)if(bt.type===z.Polygon)G.current.set(bt.id,bt.vertices.map(zt=>({...zt})));else{if(bt.type===z.Wall){const zt=bt,Bt=new Kt(zt.leftPoint[0],zt.leftPoint[1]),tt=new Kt(zt.rightPoint[0],zt.rightPoint[1]);$.current.set(bt.id,[Bt,tt])}O.current.set(bt.id,new le(bt.cx,bt.cy,bt.cz))}if(Ge.type===z.Foundation){const bt=At(Ge.id);if(bt.length>0)for(const zt of bt){const Bt=new le(zt.cx,zt.cy);O.current.set(zt.id,Bt)}}}const Pt=gt();Pt&&f(Pt)}},Qe=()=>{if(M.getState().viewState.orthographic)return!1;if(W.current){const Ge=Pe.intersectObjects(E().scene.children,!0);if(Ge.length>0){for(const yt of Ge)if(yt.object.userData.stand)return!1}}return Pe.intersectObjects([W.current]).length===0},lt=Ge=>{t(yt=>{for(const Pt of yt.elements)if(Ge.has(Pt.id)){const ot=Ge.get(Pt.id);ot&&(Pt.cx=ot[0],Pt.cy=ot[1],Pt.cz=ot[2])}})},Ze=(Ge,yt)=>{var bt,zt,Bt;if(Ge.locked)return;j.current.set(Ge.cx,Ge.cy,Ge.cz);let Pt=ee.current,ot=null;switch(We(yt),Ge.type){case z.Tree:ot=(bt=kn.getState().treeRef)==null?void 0:bt.current;break;case z.Flower:ot=(zt=kn.getState().flowerRef)==null?void 0:zt.current;break;case z.Human:ot=(Bt=kn.getState().humanRef)==null?void 0:Bt.current;break}if(ot&&Re.current){const tt=Pe.intersectObjects(me.fetchIntersectables(N),!1),Ht=Ee(tt);if(Ht){const _t=Ht.point;if(Ht.object.name==="Ground")xt(Ge.id,Zo,_t),j.current.set(_t.x,_t.y,_t.z),Pt=Zo;else if(Ht.object.userData.stand){const qt=Oe(Ht.object),un=Ht.object.parent;if(un){const Rn=new le().subVectors(_t,un.localToWorld(new le)).applyEuler(nt);xt(Ge.id,qt,Rn),j.current.set(Rn.x,Rn.y,Rn.z),Pt=qt}}}Re.current=!1}if(j.current.distanceToSquared(L.current)>Et||Pe.intersectObjects([W.current]).length===0){let tt=!0;if(!M.getState().viewState.orthographic&&(tt=j.current.length().02}if(!tt||Qe()){o(Ge.id,L.current.x,L.current.y,L.current.z),ot&&me.isPlantOrHuman(Ge)&&ot.position.copy(L.current),me.isPlantOrHuman(Ge)&&ke(ee.current,Ge.id);const Ht=kn.getState().contentRef;if(Ht!=null&&Ht.current&&ee.current&&ot){if(ee.current===Zo)Ht.current.add(ot);else{const _t=me.getObjectChildById(Ht.current,ee.current);_t==null||_t.add(ot)}U()}co(Y.t("message.CannotMoveObjectTooFar",ve))}else{if(De.current.size>1){ue.current.clear();for(const _t of M.getState().elements)Ae.current.has(_t.id)&&ue.current.set(_t.id,[_t.cx,_t.cy,_t.cz]);const Ht={name:"Move Foundation Group",timestamp:Date.now(),oldPositionMap:new Map(Ae.current),newPositionMap:new Map(ue.current),undo:()=>{lt(Ht.oldPositionMap)},redo:()=>{lt(Ht.newPositionMap)}};f(Ht)}else{const Ht=Ge.type===z.Cuboid,_t=Ht?de.current:ee.current,qt=Ht?Ge.parentId:Pt,un={name:"Move",timestamp:Date.now(),movedElementId:Ge.id,movedElementType:Ge.type,oldCx:L.current.x,oldCy:L.current.y,oldCz:L.current.z,newCx:j.current.x,newCy:j.current.y,newCz:j.current.z,oldRotation:[...Z.current],newRotation:[...Ge.rotation],oldParentId:_t,newParentId:qt,undo:()=>{o(un.movedElementId,un.oldCx,un.oldCy,un.oldCz),t(Rn=>{const yo=Rn.elements.find(Ao=>Ao.id===un.movedElementId);yo&&un.oldRotation&&(yo.rotation=[...un.oldRotation])}),ke(un.oldParentId,un.movedElementId),un.movedElementType&&Wt(un.movedElementType)&&st(un.oldParentId,un.newParentId,un.movedElementId)},redo:()=>{o(un.movedElementId,un.newCx,un.newCy,un.newCz),t(Rn=>{const yo=Rn.elements.find(Ao=>Ao.id===un.movedElementId);yo&&un.newRotation&&(yo.rotation=[...un.newRotation])}),ke(un.newParentId,un.movedElementId),un.movedElementType&&Wt(un.movedElementType)&&st(un.newParentId,un.oldParentId,un.movedElementId)}};f(un)}De.current.clear(),g()}}},Be=Ge=>{te.current=[...Ge.rotation];const yt=new le().fromArray(Z.current);if(new le().fromArray(te.current).distanceToSquared(yt)>Et){const ot={name:"Rotate",timestamp:Date.now(),rotatedElementId:Ge.id,rotatedElementType:Ge.type,oldRotation:Z.current,newRotation:te.current,undo:()=>{r(ot.rotatedElementId,ot.oldRotation[0],ot.oldRotation[1],ot.oldRotation[2])},redo:()=>{r(ot.rotatedElementId,ot.newRotation[0],ot.newRotation[1],ot.newRotation[2])}};f(ot)}},$e=Ge=>{if(Ge.button!==2){if(kn.getState().setEnableOrbitController(!0),D.current){const yt=a(D.current.id);if(yt)if(Te.current)if(ae.current=!1,Te.current=!1,t(Pt=>{Pt.addedFoundationId=null,Pt.updateSceneRadius()}),yt.lx<=.1||yt.ly<=.1)c(yt.id,!1);else{const Pt={name:"Add",timestamp:Date.now(),addedElement:yt,undo:()=>{c(Pt.addedElement.id,!1),g()},redo:()=>{t(ot=>{ot.elements.push(Pt.addedElement),ot.selectedElement=Pt.addedElement,ot.updateSceneRadius()})}};f(Pt)}else if(Se.current)if(ge.current=!1,Se.current=!1,t(Pt=>{Pt.addedCuboidId=null,Pt.updateSceneRadius()}),yt.lx<=.1||yt.ly<=.1)c(yt.id,!1);else{const Pt={name:"Add",timestamp:Date.now(),addedElement:yt,undo:()=>{c(Pt.addedElement.id,!1),g()},redo:()=>{t(ot=>{ot.elements.push(Pt.addedElement),ot.selectedElement=Pt.addedElement,ot.updateSceneRadius()})}};f(Pt)}else M.getState().resizeHandleType?ut(yt):M.getState().rotateHandleType?Be(yt):M.getState().moveHandleType&&Ze(yt,Ge),yt.type===z.Foundation&&dt.getState().updateFoundationMovedFlag();D.current=null}t(yt=>{yt.moveHandleType=null,yt.resizeHandleType=null,yt.rotateHandleType=null}),kn.setState({humanRef:null,treeRef:null,flowerRef:null}),dt.getState().set(yt=>{yt.showWallIntersectionPlaneId=null,yt.oldParentId=null,yt.oldFoundationId=null})}},wt=(Ge,yt)=>{const{pos:Pt}=me.getWorldDataById(Ge.id),ot=new le(Pt.x,Pt.y),bt=new le().subVectors(ot,yt);De.current.set(Ge.id,bt),Ae.current.set(Ge.id,[Ge.cx,Ge.cy,Ge.cz])},vt=(Ge,yt)=>{const Pt=Ge.intersections[0].point.clone().setZ(0);for(const ot of M.getState().elements)Ad(ot)&&ot.parentId===Zo&&!ot.locked&&ot.id!==yt.id&&!De.current.has(ot.id)&&!me.isChild(yt.id,ot.id)&&!me.isChild(ot.id,yt.id)&&me.areTwoBasesOverlapped(ot,yt)&&(wt(ot,Pt),ot.enableGroupMaster&&vt(Ge,ot)),ot.id===yt.id&&wt(ot,Pt)},Rt=(Ge,yt)=>{De.current.clear(),Ae.current.clear(),yt.enableGroupMaster&&M.getState().moveHandleType&&vt(Ge,yt)},Gt=Ge=>{if(Ge.type===z.SolarPanel&&Ge.parentType===z.Roof||Ge.type===z.Window&&Ge.parentType===z.Roof)return!0},At=Ge=>M.getState().elements.filter(yt=>yt.foundationId!==Ge?!1:yt.type===z.SolarPanel&&yt.parentType===z.Roof||yt.type===z.SolarWaterHeater&&yt.parentType===z.Roof||yt.type===z.Window&&yt.parentType===z.Roof||yt.type===z.Sensor||yt.type===z.Light),pt=Ge=>{if(Ge.button===2||Ge.intersections.length===0||!W.current)return;if(ae.current){We(Ge);const Pt=Pe.intersectObjects([W.current]);Pt.length>0&&(kn.getState().setEnableOrbitController(!1),t(ot=>{ot.moveHandleType=null,ot.resizeHandleType=Mt.LowerRight,ot.resizeAnchor.copy(Pt[0].point)}),ae.current=!1,Te.current=!0);return}if(ge.current){We(Ge);const Pt=Pe.intersectObjects([W.current]);Pt.length>0&&(kn.getState().setEnableOrbitController(!1),t(ot=>{var bt;if(ot.moveHandleType=null,ot.resizeHandleType=Mt.LowerRight,ot.resizeAnchor.copy(Pt[0].point),D.current){const zt=ct(Ge,(bt=D.current)==null?void 0:bt.id);if(zt){const Bt=Pe.intersectObjects([zt.eventObject]);Bt.length>0&&ot.resizeAnchor.copy(Bt[0].point)}}}),ge.current=!1,Se.current=!0);return}if(Ge.intersections[0].object===W.current){if(M.getState().multiSelectionsMode||t(Pt=>{Pt.clickObjectType=z.Ground,Pt.selectedElement=null,Px.selectNone(Pt),Pt.contextMenuObjectType=null}),Ve(A)){const Pt=Ge.intersections[0].point,ot=i(x,Pt),bt={name:"Add",timestamp:Date.now(),addedElement:ot,undo:()=>{c(bt.addedElement.id,!1),g()},redo:()=>{t(zt=>{zt.elements.push(bt.addedElement),zt.selectedElement=bt.addedElement,zt.updateSceneRadius()})}};f(bt),t(zt=>{zt.actionModeLock||(zt.objectTypeToAdd=z.None),zt.updateSceneRadius()})}D.current=null}else{const Pt=M.getState().selectedElementIdSet;if(Pt.size>1){const ot=M.getState().selectedElement;if(ot){D.current=ot,De.current.clear();for(const bt of M.getState().elements)if(me.isElementAllowedMultipleMoveOnGround(bt)&&Pt.has(bt.id))if(bt.enableGroupMaster)vt(Ge,bt);else{const Bt=Ge.intersections[0].point.clone().setZ(0);wt(bt,Bt)}}}else{const ot=e();if(ot&&Ve(ot.type)){if(D.current=ot,L.current.set(ot.cx,ot.cy,ot.cz),se.current.set(ot.lx,ot.ly,ot.lz),Z.current=[...ot.rotation],ot.type===z.Foundation||ot.type===z.Cuboid){const bt=n(ot.id);if(B.current.clear(),V.current.clear(),q.current.clear(),bt.length>0)for(const zt of bt)if(zt.type===z.Polygon)V.current.set(zt.id,zt.vertices.map(Bt=>({...Bt})));else{if(zt.type===z.Wall){const Bt=zt,tt=new Kt(Bt.leftPoint[0],Bt.leftPoint[1]),Ht=new Kt(Bt.rightPoint[0],Bt.rightPoint[1]);q.current.set(zt.id,[tt,Ht])}B.current.set(zt.id,new le(zt.cx,zt.cy,zt.cz))}if(ot.type===z.Foundation){const zt=At(ot.id);if(zt.length>0)for(const Bt of zt){const tt=new le(Bt.cx,Bt.cy);B.current.set(Bt.id,tt)}}}switch(ot.type){case z.Tree:ee.current=ot.parentId,se.current.set(ot.lx,ot.ly,ot.lz);break;case z.Flower:ee.current=ot.parentId;break;case z.Human:ee.current=ot.parentId;break;case z.Cuboid:{if(Ad(ot)&&ot.parentId===Zo?Rt(Ge,ot):De.current.clear(),de.current=ot.parentId,M.getState().moveHandleType){const{rot:_t}=me.getWorldDataById(ot.id),qt=new ln(0,0,_t);switch(M.getState().moveHandleType){case zo.Right:{he.current.set(-ot.lx/2,0,0).applyEuler(qt);break}case zo.Left:{he.current.set(ot.lx/2,0,0).applyEuler(qt);break}case zo.Lower:{he.current.set(0,ot.ly/2,0).applyEuler(qt);break}case zo.Upper:{he.current.set(0,-ot.ly/2,0).applyEuler(qt);break}default:{he.current.set(0,0,0);break}}}fe.current.clear();const{pos:zt,rot:Bt}=me.getWorldDataById(ot.id),tt=new le(zt.x,zt.y,zt.z),Ht=n(ot.id);if(Ht.length>0)for(const _t of Ht)switch(_t.type){case z.Cuboid:{const qt=new le(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt));qt.add(tt),fe.current.set(_t.id,qt);break}case z.Tree:case z.Flower:case z.Human:{const qt=new le(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt));qt.add(tt),fe.current.set(_t.id,qt);break}case z.SolarPanel:{const qt=new le(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Bt)).add(tt);fe.current.set(_t.id,qt);break}case z.Light:case z.Sensor:if(me.isIdentical(_t.normal,as)){const qt=new le(_t.cx*ot.lx,_t.cy*ot.ly,_t.cz*ot.lz).applyEuler(new ln(0,0,Bt));qt.add(tt),fe.current.set(_t.id,qt)}break;case z.Polygon:if(me.isIdentical(_t.normal,as)){const qt=_t,un=[];for(const Rn of qt.vertices){const yo=new Kt(Rn.x*ot.lx,Rn.y*ot.ly).rotateAround(ai,Bt);yo.add(new Kt(tt.x,tt.y)),un.push(yo)}pe.current.set(qt.id,un)}break}break}case z.Foundation:{Ad(ot)&&Rt(Ge,ot),fe.current.clear(),pe.current.clear(),ye.current.clear();const bt=new Kt(ot.cx,ot.cy),zt=new le(ot.cx,ot.cy,ot.cz),Bt=n(ot.id);if(Bt.length>0){const Ht=ot.rotation[2];for(const _t of Bt)switch(_t.type){case z.Wall:{const qt=_t,un=new Kt(qt.cx,qt.cy).rotateAround(ai,Ht);un.add(bt);const Rn=new Kt(qt.leftPoint[0],qt.leftPoint[1]).rotateAround(ai,Ht);Rn.add(bt);const yo=new Kt(qt.rightPoint[0],qt.rightPoint[1]).rotateAround(ai,Ht);yo.add(bt),ye.current.set(qt.id,{centerPointAbsPos:un,leftPointAbsPos:Rn,rightPointAbsPos:yo});break}case z.Tree:case z.Flower:case z.Human:{const qt=new le(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Ht));qt.add(zt),fe.current.set(_t.id,qt);break}case z.SolarPanel:{const qt=new le(_t.cx,_t.cy,_t.cz).applyEuler(new ln(0,0,Ht)).add(zt);fe.current.set(_t.id,qt);break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:{const qt=new le(_t.cx*ot.lx,_t.cy*ot.ly,_t.cz*ot.lz).applyEuler(new ln(0,0,Ht));qt.add(zt),fe.current.set(_t.id,qt);break}case z.Polygon:{const qt=_t,un=[];for(const Rn of qt.vertices){const yo=new Kt(Rn.x*ot.lx,Rn.y*ot.ly).rotateAround(ai,Ht);yo.add(bt),un.push(yo)}pe.current.set(qt.id,un);break}}}const tt=At(ot.id);if(tt.length>0){const Ht=new ln(0,0,ot.rotation[2]);for(const _t of tt)if(_t.type===z.Window||_t.type===z.SolarPanel||_t.type===z.SolarWaterHeater){const qt=new le(_t.cx,_t.cy).applyEuler(Ht);qt.add(zt),fe.current.set(_t.id,qt)}else{const qt=new le(_t.cx*ot.lx,_t.cy*ot.ly).applyEuler(Ht);qt.add(zt),fe.current.set(_t.id,qt)}}break}}}else D.current=null}}},Wt=Ge=>Ge===z.Human||Ge===z.Tree||Ge===z.Flower,ht=(Ge,yt)=>{if(Ge.tempHumanPlant.length===0){const Pt=Ge.elements.filter(bt=>Wt(bt.type)&&me.isDescendantOf(bt,yt));Ge.tempHumanPlant=Pt;const ot=new Set(Pt.map(bt=>bt.id));Ge.elements=Ge.elements.filter(bt=>!ot.has(bt.id))}},ct=(Ge,yt)=>{const Pt=Ge.intersections.find(bt=>{const zt=bt.eventObject;if(!zt.name.includes("Cuboid"))return!1;const Bt=zt.name.split(" ");return Bt.length!==2?!1:Bt[1]!==yt&&zt.userData.stackable});if(!Pt)return;const ot=Pt.eventObject.name.split(" ")[1];if(!De.current.has(ot))return me.isChild(yt,ot)?void 0:Pt};m.useEffect(()=>{D.current&&(F||A!==z.None)&&(ae.current&&A!==z.Foundation?(ae.current=!1,Te.current=!1,t(Ge=>{Ge.addedFoundationId=null,Ge.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(D.current.id,!1),D.current=null):ge.current&&A!==z.Cuboid&&(ge.current=!1,Se.current=!1,t(Ge=>{Ge.addedCuboidId=null,Ge.updateSceneRadius()}),dt.getState().setSelectButtonClicked(!1),c(D.current.id,!1),D.current=null))},[A,F]);const It=Ge=>{if(D.current&&D.current.type&&!D.current.locked){We(Ge);let yt;switch(D.current.type){case z.Foundation:k.current&&(yt=Pe.intersectObjects([k.current]),yt.length>0&&(y?at(yt[0].point):S?kt(yt[0].point):C&&rt(yt[0].point)));break;case z.Cuboid:if(k.current&&Ne===Zf.Horizontal&&(yt=Pe.intersectObjects([k.current]),yt.length>0)){const Pt=yt[0].point.clone(),ot=ct(Ge,D.current.id);if(y)if(De.current.size>1)at(Pt);else if(ot){if(yt=Pe.intersectObjects([ot.eventObject]),yt.length===0)return;Pt.copy(yt[0].point).add(he.current);const bt=ot.eventObject.name.split(" ")[1];t(zt=>{const Bt=zt.elements.find(Ht=>{var _t;return Ht.id===((_t=zt.selectedElement)==null?void 0:_t.id)}),tt=zt.selectedElement;if(Bt&&tt){const{pos:Ht,rot:_t}=me.getWorldDataById(bt),qt=new le().subVectors(Pt,Ht);if(qt.applyEuler(new ln(0,0,-_t)),Bt.cx=qt.x,Bt.cy=qt.y,tt.parentId!==bt){Bt.parentId!==bt&&ht(zt,Bt.id);const{rot:un}=me.getWorldDataById(tt.id);Bt.rotation[2]=un-_t,Bt.parentId=bt}else Bt.parentId!==bt&&(Bt.parentId!==tt.parentId&&ht(zt,Bt.id),Bt.parentId=tt.parentId,Bt.rotation[2]=tt.rotation[2])}})}else t(bt=>{const zt=bt.elements.find(Bt=>Bt.id===D.current.id);if(zt&&zt.parentId!==Zo){zt.parentId!==Zo&&ht(bt,zt.id);const{rot:Bt}=me.getWorldDataById(zt.parentId);zt.rotation[2]+=Bt,zt.parentId=Zo}}),at(Pt);else if(S){const bt=a(D.current.id);bt&&bt.parentId===Zo&&kt(Pt)}}break}}if(W.current){if(A!==z.None){We(Ge);const yt=Pe.intersectObjects([W.current]);if(yt.length>0){const Pt=yt[0].point;switch(A){case z.Foundation:{const ot=i(x,Pt);ot&&(t(bt=>{bt.addedFoundationId=ot.id,bt.objectTypeToAdd=z.None}),D.current=ot,ae.current=!0);break}case z.Cuboid:{const ot=i(x,Pt);ot&&(t(bt=>{bt.addedCuboidId=ot.id,bt.objectTypeToAdd=z.None}),D.current=ot,ge.current=!0);break}}}}if(D.current&&(ae.current||ge.current)){We(Ge);let yt=Pe.intersectObjects([W.current]);if(yt.length===0)return;const Pt=yt[0].point;if(D.current.type===z.Foundation)o(D.current.id,Pt.x,Pt.y);else if(D.current.type===z.Cuboid){const ot=ct(Ge,D.current.id);if(ot){if(yt=Pe.intersectObjects([ot.eventObject]),yt.length===0)return;Pt.copy(yt[0].point);const bt=ot.eventObject.name.split(" ")[1];t(zt=>{const Bt=zt.elements.find(tt=>{var Ht;return tt.id===((Ht=D.current)==null?void 0:Ht.id)});if(Bt){const{pos:tt,rot:Ht}=me.getWorldDataById(bt),_t=new le().subVectors(Pt,tt);_t.applyEuler(new ln(0,0,-Ht)),Bt.cx=_t.x,Bt.cy=_t.y,Bt.parentId=bt,Bt.rotation[2]=-Ht}})}else t(bt=>{const zt=bt.elements.find(Bt=>{var tt;return Bt.id===((tt=D.current)==null?void 0:tt.id)});if(zt&&zt.parentId!==Zo){const{rot:Bt}=me.getWorldDataById(zt.parentId);zt.rotation[2]+=Bt,zt.parentId=Zo}}),o(D.current.id,Pt.x,Pt.y)}}}},Ft=Ge=>{if(D.current&&D.current.type&&!D.current.locked){We(Ge);let yt;if(k.current&&Ne===Zf.Vertical&&(yt=Pe.intersectObjects([k.current]),yt&&yt.length>0)){const Pt=yt[0].point;switch(D.current.type){case z.Tree:{const ot=D.current;switch(S){case Mt.Top:s(ot.id,Pt.z),t(bt=>{bt.selectedElementHeight=Math.max(1,Pt.z)});break;case Mt.Left:case Mt.Right:case Mt.Upper:case Mt.Lower:l(ot.id,2*Math.hypot(Pt.x-ot.cx,Pt.y-ot.cy));break}je(kn.getState().treeRef,Ge);break}case z.Flower:{je(kn.getState().flowerRef,Ge);break}case z.Human:{je(kn.getState().humanRef,Ge);break}}}}},Ve=Ge=>Ge===z.Foundation||Ge===z.Cuboid||Ge===z.Tree||Ge===z.Flower||Ge===z.Human,ft=(Ge,yt,Pt,ot,bt)=>{if(Ge){for(const zt of Ge.children)if(zt.name.includes("Human")||zt.name.includes("Tree")||zt.name.includes("Flower")){const Bt=Oe(zt),tt=fe.current.get(Bt);if(tt)if(Math.abs(se.current.z/2-zt.position.z)<.01){const Ht=new le().subVectors(tt,ot).applyEuler(new ln(0,0,-bt));zt.position.setX(Ht.x),zt.position.setY(Ht.y)}else{const Ht=new le().subVectors(tt,L.current).applyEuler(new ln(0,0,-bt)),_t=new le().subVectors(ot,L.current),qt=new le().subVectors(Ht,_t);Math.abs(Ht.x/se.current.x)>.49?(zt.position.setX((Ht.x>0?yt:-yt)/2),zt.position.setY(qt.y)):Math.abs(Ht.y/se.current.y)>.49&&(zt.position.setX(qt.x),zt.position.setY((Ht.y>0?Pt:-Pt)/2))}}}},kt=Ge=>{if(!D.current)return;const yt=new Kt(Ge.x,Ge.y),Pt=new Kt(P.x,P.y),ot=Pt.distanceTo(yt),bt=Math.atan2(yt.x-P.x,yt.y-P.y)+D.current.rotation[2];let zt=Math.abs(ot*Math.sin(bt)),Bt=Math.abs(ot*Math.cos(bt));const tt=new Kt().addVectors(yt,Pt).multiplyScalar(.5);if(D.current.type===z.Cuboid&&(S===Mt.Lower||S===Mt.Upper||S===Mt.Left||S===Mt.Right)){const Ht=new le(P.x,P.y),_t=D.current.rotation[2],qt=new le(Ge.x,Ge.y).sub(Ht).applyEuler(new ln(0,0,-_t)),un=new le(1,0,0);(S===Mt.Upper||S===Mt.Lower)&&un.set(0,1,0),un.applyEuler(new ln(0,0,_t));const Rn=Ht.clone().add(un.clone().multiplyScalar(qt.x/2));S===Mt.Left||S===Mt.Right?(zt=Math.abs(qt.x),Bt=D.current.ly):(S===Mt.Upper||S===Mt.Lower)&&(zt=D.current.lx,Bt=Math.abs(qt.y),Rn.copy(Ht.add(un.clone().multiplyScalar(qt.y/2)))),tt.x=Rn.x,tt.y=Rn.y}switch(t(Ht=>{if(!D.current)return;let _t=!1;for(const qt of Ht.elements)if(qt.id===D.current.id){switch(qt.type){case z.Cuboid:case z.Foundation:{const un=n(qt.id);if(un.length>0){const Rn=[];for(const Ao of un){if(me.isPlantOrHuman(Ao))continue;const wo=JSON.parse(JSON.stringify(Ao));if(Rn.push(wo),me.isIdentical(wo.normal,as))if(Ao.type===z.Wall){const Io=ye.current.get(Ao.id);if(Io){const po=-qt.rotation[2],{centerPointAbsPos:On,leftPointAbsPos:fo,rightPointAbsPos:ir}=Io,Rr=new Kt().subVectors(On,tt).rotateAround(ai,po),br=new Kt().subVectors(fo,tt).rotateAround(ai,po),_r=new Kt().subVectors(ir,tt).rotateAround(ai,po);switch(S){case Mt.Lower:case Mt.Upper:wo.cy=Rr.y;break;case Mt.Left:case Mt.Right:wo.cx=Rr.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:wo.cx=Rr.x,wo.cy=Rr.y;break}wo.leftPoint=[br.x,br.y,0],wo.rightPoint=[_r.x,_r.y,0]}}else{const Io=fe.current.get(Ao.id);if(Io){const po=-qt.rotation[2],On=new Kt().subVectors(new Kt(Io.x,Io.y),tt).rotateAround(ai,po);switch(S){case Mt.Lower:case Mt.Upper:wo.type===z.SolarPanel?wo.cy=On.y:wo.cy=On.y/Bt;break;case Mt.Left:case Mt.Right:wo.type===z.SolarPanel||wo.type===z.SolarWaterHeater?wo.cx=On.x:wo.cx=On.x/zt;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:wo.type===z.SolarPanel?(wo.cx=On.x,wo.cy=On.y):(wo.cx=On.x/zt,wo.cy=On.y/Bt);break}}}else if((wo.type===z.SolarPanel||wo.type===z.SolarWaterHeater)&&wo.parentType===z.Roof){const Io=fe.current.get(Ao.id);if(Io){const po=new Kt().subVectors(new Kt(Io.x,Io.y),tt).rotateAround(ai,-qt.rotation[2]);wo.cx=po.x,wo.cy=po.y}}}const yo=JSON.parse(JSON.stringify(qt));switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:yo.lx=zt,yo.ly=Bt,yo.cx=tt.x,yo.cy=tt.y;break}if(me.doesParentContainAllChildren(yo,Rn)){switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.lx=zt,qt.ly=Bt,qt.cx=tt.x,qt.cy=tt.y;break}_t=!0}}else if(zt>.49&&Bt>.49){switch(S){case Mt.Lower:case Mt.Upper:case Mt.Left:case Mt.Right:case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.lx=zt,qt.ly=Bt,qt.cx=tt.x,qt.cy=tt.y;break}_t=!0}break}}break}if(_t)for(const qt of Ht.elements){if(qt.parentId===D.current.id)switch(qt.type){case z.Wall:{const un=qt,Rn=ye.current.get(qt.id);if(Rn){const yo=-D.current.rotation[2],{centerPointAbsPos:Ao,leftPointAbsPos:wo,rightPointAbsPos:Io}=Rn,po=new Kt().subVectors(Ao,tt).rotateAround(ai,yo),On=new Kt().subVectors(wo,tt).rotateAround(ai,yo),fo=new Kt().subVectors(Io,tt).rotateAround(ai,yo);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=po.y;break;case Mt.Left:case Mt.Right:qt.cx=po.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=po.x,qt.cy=po.y;break}un.leftPoint=[On.x,On.y,0],un.rightPoint=[fo.x,fo.y,0]}break}case z.SolarPanel:{const un=fe.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]),[yo,Ao,wo]=qt.normal;me.isEqual(wo,1)&&(qt.cx=Rn.x,qt.cy=Rn.y),me.isEqual(yo,0)&&me.isEqual(Ao,1)?qt.cy=Bt/2:me.isEqual(yo,0)&&me.isEqual(Ao,-1)?qt.cy=-Bt/2:me.isEqual(yo,-1)&&me.isEqual(Ao,0)?qt.cx=-zt/2:me.isEqual(yo,1)&&me.isEqual(Ao,0)&&(qt.cx=zt/2)}break}case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.Sensor:if(me.isIdentical(qt.normal,as)){const un=fe.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=Rn.y/Bt;break;case Mt.Left:case Mt.Right:qt.cx=Rn.x/zt;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=Rn.x/zt,qt.cy=Rn.y/Bt;break}}}break;case z.Cuboid:{const un=fe.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);switch(S){case Mt.Lower:case Mt.Upper:qt.cy=Rn.y;break;case Mt.Left:case Mt.Right:qt.cx=Rn.x;break;case Mt.LowerLeft:case Mt.LowerRight:case Mt.UpperLeft:case Mt.UpperRight:qt.cx=Rn.x,qt.cy=Rn.y;break}}break}case z.Polygon:if(me.isIdentical(qt.normal,as)){const un=qt,Rn=pe.current.get(un.id);if(Rn){const yo=[];Rn.forEach(Ao=>{const wo=new Kt().subVectors(Ao,tt).rotateAround(ai,-D.current.rotation[2]);yo.push({x:wo.x/zt,y:wo.y/Bt})}),un.vertices=yo}}break}if(qt.foundationId===D.current.id&&(qt.type===z.SolarPanel||qt.type===z.SolarWaterHeater||qt.type===z.Window)&&qt.parentType===z.Roof){const un=fe.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);qt.cx=Rn.x,qt.cy=Rn.y}}if(qt.foundationId===D.current.id&&(qt.type===z.Sensor||qt.type===z.Light)&&qt.parentType===z.Roof){const un=fe.current.get(qt.id);if(un){const Rn=new Kt().subVectors(new Kt(un.x,un.y),tt).rotateAround(ai,-D.current.rotation[2]);qt.cx=Rn.x/zt,qt.cy=Rn.y/Bt}}}}),D.current.type){case z.Foundation:{const Ht=kn.getState().foundationRef;Ht!=null&&Ht.current&&ft(Ht==null?void 0:Ht.current,zt,Bt,Ht.current.position,D.current.rotation[2]);break}case z.Cuboid:{const Ht=kn.getState().cuboidRef;Ht!=null&&Ht.current&&Ht.current.parent&&ft(Ht==null?void 0:Ht.current,zt,Bt,Ht.current.parent.position,D.current.rotation[2]);break}}},rt=Ge=>{const{cx:yt,cy:Pt}=D.current,ot=Math.atan2(yt-Ge.x,Ge.y-Pt)+(C===Di.Upper?0:Math.PI),bt=Math.abs(ot)>Math.PI?-Math.sign(ot)*sa:0;r(D.current.id,0,0,ot+bt)},at=Ge=>{const yt=De.current.size>1;if(yt){t(Bt=>{for(const tt of Bt.elements)if(Ad(tt)&&De.current.has(tt.id)){const Ht=De.current.get(tt.id);Ht&&(tt.cx=Ge.x+Ht.x,tt.cy=Ge.y+Ht.y)}});return}let Pt,ot;const bt=D.current.lx/2,zt=D.current.ly/2;switch(y){case zo.Top:{if(yt){const Bt=new le(Ge.x,Ge.y);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new le().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Ge.x,Ge.y);break}case zo.Upper:if(Pt=Ge.x+ze*zt,ot=Ge.y-Me*zt,yt){const Bt=new le(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new le().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Lower:if(Pt=Ge.x-ze*zt,ot=Ge.y+Me*zt,yt){const Bt=new le(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new le().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Left:if(Pt=Ge.x+Me*bt,ot=Ge.y+ze*bt,yt){const Bt=new le(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new le().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break;case zo.Right:if(Pt=Ge.x-Me*bt,ot=Ge.y-ze*bt,yt){const Bt=new le(Pt,ot);t(tt=>{for(const Ht of tt.elements)if(Ht.id===D.current.id)Ht.cx=Bt.x,Ht.cy=Bt.y;else if(De.current.has(Ht.id)){const _t=De.current.get(Ht.id);if(_t){const qt=new le().addVectors(Bt,_t);Ht.cx=qt.x,Ht.cy=qt.y}}})}else o(D.current.id,Pt,ot);break}};return m.useEffect(()=>{const Ge=()=>{const yt=M.getState().addedFoundationId,Pt=M.getState().addedCuboidId;yt&&(c(yt,!1),t(ot=>{ot.objectTypeToAdd=z.Foundation,ot.addedFoundationId=null}),kn.getState().setEnableOrbitController(!0),D.current=null,ae.current=!1,Te.current=!1),Pt&&(c(Pt,!1),t(ot=>{ot.objectTypeToAdd=z.Cuboid,ot.addedCuboidId=null}),kn.getState().setEnableOrbitController(!0),D.current=null,ge.current=!1,Se.current=!1)};return window.addEventListener("beforeunload",Ge),()=>{window.removeEventListener("beforeunload",Ge)}},[]),h.jsxs(h.Fragment,{children:[D.current&&Ne!==Zf.Ground&&h.jsx(ta,{ref:k,visible:!1,name:"Ground Intersection Plane",rotation:Ue,position:Je,args:[1e5,1e5],onPointerMove:k2.throttle(Ft,qF,{trailing:!1}),children:h.jsx("meshStandardMaterial",{side:ti,opacity:.5,transparent:!0})}),h.jsx(ta,{receiveShadow:v,ref:W,name:"Ground",userData:{stand:!0},rotation:[0,0,0],position:[0,0,0],args:[1e4,1e4],renderOrder:-2,onContextMenu:it,onPointerDown:pt,onPointerMove:k2.throttle(It,qF,{trailing:!1}),children:H&&!w?h.jsx("meshBasicMaterial",{color:T}):h.jsx("meshStandardMaterial",{depthTest:!1,color:w?"white":T,map:w?me.WATER_TEXTURE:me.WHITE_TEXTURE,needsUpdate:!0})})]})}),sae=48,Hnn=72,Mnn=12,Inn=be.memo(({date:t,hourAngle:e,declinationAngle:n,worldLatitude:o})=>{const r=M(ay),i=M(DBe),a=M(TBe)??!0,l=M(PBe)??!0,s=M(CBe)??!0,[c,u]=m.useState(me.toRadians(42)),d=Hb(Jye),f=Math.max(2,r*.2),p=Math.max(.4,r*.025),g=r3(hW,mN),A=r*.05,y={font:g,height:0,size:A},S=6,C=new Array(2*S+1).fill(0),P=V=>V===0?-A*.3:V>0&&V<7?-A*.8:-A*1.2;m.useEffect(()=>{u(me.toRadians(o))},[o]);const v=6,[T,w]=m.useMemo(()=>{const V=new ji,G=new ji,q=[],$=[],ie=sa/Hnn;let Q=0;for(let ee=0;eeEt&&(fe=.05*r+(Q%3===0?.2:0),pe=new le(r,de,0),pe.z=.002,$.push(me.sphericalToCartesianZ(pe)),pe=new le(r+fe,de,0),pe.z=.002,$.push(me.sphericalToCartesianZ(pe))),Q++}const se=q.length*3,oe=new Float32Array(se),Z=new Float32Array(se),te=new Float32Array(se);for(let ee=0;ee{const V=[],G=dl(t,me.toDegrees(c)),q=yO(G.sunrise),$=yO(G.sunset),ie=($-q)/sae;for(let Q=q;Q<$+ie/2;Q+=ie){const se=a9(r,Q,n,c);se.z>-.01&&V.push(se)}return V},[t,c,r,n]),b=V=>{const G=yN(V),q=[],$=dl(V,me.toDegrees(c)),ie=yO($.sunrise),Q=yO($.sunset),se=(Q-ie)/sae;for(let oe=ie;oe-.01&&q.push(Z)}return q},R=m.useMemo(()=>{const V=[];for(let G=0;G<=v;G++){const q=new Date(2021,G===0?11:G-1,22);V.push(b(q))}return V},[c,r]),H=m.useMemo(()=>a9(r,e,n,c),[c,n,e,r]),F=m.useMemo(()=>H.clone().normalize(),[H]),E=m.useMemo(()=>new le(H.x,H.y,0).normalize(),[H]),N=m.useMemo(()=>Math.asin(H.z/H.length()),[H]),U=m.useMemo(()=>{const G=new z2(0,0,f,f,0,N,!1,0).getPoints(25),q=new Array;for(const $ of G)q.push(new le($.x,$.y,0));return q},[N,H,f]),W=m.useMemo(()=>Math.acos(H.z/H.length()),[H]),k=m.useMemo(()=>{const G=new z2(0,0,f*.8,f*.8,N,Qt,!1,0).getPoints(25),q=new Array;for(const $ of G)q.push(new le($.x,$.y,0));return q},[W,H,f,N]),D=m.useMemo(()=>{const V=Math.acos(H.y/Math.hypot(H.x,H.y));return H.x>0?-V:V},[H]),L=m.useMemo(()=>{const G=new z2(0,0,f*1.2,f*1.2,Qt,Qt+D,H.x>0,0).getPoints(50),q=new Array;for(const $ of G)q.push(new le($.x,$.y,0));return q},[D,H,f]),j=m.useMemo(()=>{const V=2*fP/Mnn,G=sa/sae,q=new ji;let $=0;const ie=[],Q=[];for(let se=-fP;seMath.PI&&(Z=Math.PI),te>fP&&(te=fP);const ee=a9(r,oe,se,c),de=a9(r,Z,se,c),fe=a9(r,Z,te,c),pe=a9(r,oe,te,c);(ee.z>=0||de.z>=0||fe.z>=0||pe.z>=0)&&(ie.push(ee,de,fe,pe),Q.push($),Q.push($+1),Q.push($+2),Q.push($),Q.push($+2),Q.push($+3),$+=4)}return q.setFromPoints(ie),q.setIndex(new tl(new Uint16Array(Q),1)),q},[c,r]),B=.05*r,O=2+5*B;return h.jsxs("group",{children:[C.map((V,G)=>{let q=Math.ceil(G/2)*(G%2===0?1:-1);q===-S&&(q=S);const $=P(Math.abs(q));return h.jsx("group",{rotation:[Qt,q*Math.PI/S,0],children:h.jsxs("mesh",{position:[$,0,-r*1.1],rotation:[-Qt,0,0],children:[h.jsx("textGeometry",{args:[`${-(180/S)*q}°`,y]}),h.jsx("meshStandardMaterial",{attach:"material",color:"lightGray"})]})},G)}),h.jsxs("mesh",{rotation:new ln(0,0,0),name:"Heliodon",children:[h.jsxs("mesh",{children:[h.jsx("bufferGeometry",{...T}),h.jsx("meshBasicMaterial",{side:ti,vertexColors:!0,polygonOffset:!0,polygonOffsetFactor:-.7,polygonOffsetUnits:-2})]}),h.jsxs("lineSegments",{children:[h.jsx("bufferGeometry",{...w}),h.jsx("meshBasicMaterial",{color:0})]}),h.jsxs("mesh",{children:[x.length>3&&h.jsx(Gn,{lineWidth:2,points:x,color:"yellow"}),R.filter(V=>V.length>3).map((V,G)=>h.jsx(Gn,{opacity:G===0||G===v?1:.5,lineWidth:G===0||G===v?1:.5,points:V,color:"#999"},G)),h.jsx("mesh",{args:[j],children:h.jsx("meshBasicMaterial",{side:ti,color:[1,1,0],transparent:!0,opacity:.5,depthWrite:!1,clippingPlanes:[new l9(Yc,0)]})}),h.jsx("mesh",{position:H,children:h.jsx("sprite",{scale:[O,O,O],children:h.jsx("spriteMaterial",{map:d,transparent:!1,color:16777215,blending:rR,depthWrite:!1})})}),h.jsxs("mesh",{position:H,children:[h.jsx("sphereGeometry",{args:[B,10,10]}),h.jsx("meshBasicMaterial",{color:"white"})]})]})]}),h.jsx(ta,{args:[1e4,1e4],renderOrder:-1,userData:{unintersectable:!0},children:h.jsx("meshBasicMaterial",{transparent:!0,opacity:0})}),i&&H.z>0&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[H.x,H.y,H.z]],name:"Line from origin to sun",lineWidth:.5,color:"white"}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[H.x,H.y,0]],name:"Line from origin to sun projection on ground",lineWidth:.5,color:"white"}),h.jsx(Gn,{userData:{unintersectable:!0},points:[[H.x,H.y,0],[H.x,H.y,H.z]],name:"Line from sun projection on ground to sun",lineWidth:.5,color:"white"}),l&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:U,position:[0,0,0],rotation:new ln(Qt,0,Qt+D,"ZXY"),color:"white",name:"Elevation Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Elevation Angle",backgroundColor:"indigo",text:me.toDegrees(N).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:F.clone().multiplyScalar(f).add(E.clone().multiplyScalar(f)).multiplyScalar(.65)})]}),s&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:k,position:[0,0,0],rotation:new ln(Qt,0,Qt+D,"ZXY"),color:"white",name:"Zenith Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Zenith Angle",backgroundColor:"navy",text:me.toDegrees(W).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:F.clone().multiplyScalar(f).add(ko.clone().multiplyScalar(f)).multiplyScalar(.57)})]}),a&&h.jsxs(h.Fragment,{children:[h.jsx(Gn,{userData:{unintersectable:!0},linewidth:.5,points:L,position:[0,0,0],color:"white",name:"Azimuth Angle Arc"}),h.jsx("textSprite",{userData:{unintersectable:!0},name:"Azimuth Angle",backgroundColor:"firebrick",text:me.toDegrees(Math.abs(D-Math.PI)<1e-6?D:-D).toFixed(0)+"°",fontSize:80,fontFace:"Times Roman",textHeight:p,position:E.clone().multiplyScalar(f).add(Yc.clone().multiplyScalar(f)).multiplyScalar(1.1).add(new le(0,0,p/2))})]})]})]})}),znn=be.memo(()=>{const t=M(zBe),e=M(ay),n=M(s0),o=M(Al),r=M(q7t),i=m.useMemo(()=>new Date(o),[o]),[a,l]=m.useMemo(()=>[Xye(i),yN(i)],[i]);return m.useEffect(()=>{r(a9(e,a,l,me.toRadians(n)))},[n,a,l,e]),h.jsx(h.Fragment,{children:t&&h.jsx(Inn,{date:new Date(o),hourAngle:a,declinationAngle:l,worldLatitude:n})})}),tPe="/aladdin/assets/ifi-logo-CwxGDl7t.png",Dnn="/aladdin/assets/magic-lamp-XxXOV1dq.png",Enn=be.memo(({top:t,height:e,color:n})=>{const o=M(m0),r=m.useMemo(()=>({lng:o}),[o]);return h.jsx("div",{children:h.jsxs("div",{style:{position:"absolute",borderRadius:"20px",border:"thin",textAlign:"center",left:"5%",right:"5%",top:t+"px",height:(e??300)+"px"},children:[h.jsx("h2",{style:{marginTop:"20px",color:n},children:Y.t("aboutUs.ProductBroughtToYouBy",r)}),h.jsx("p",{style:{fontSize:"16px",color:n},children:"Charles Xie and Xiaotong Ding"}),h.jsxs("div",{style:{position:"absolute",marginTop:"20px",fontSize:"12px",textAlign:"justify",color:n},children:[Y.t("aboutUs.Translators",r),": ",s9.Ukrainian," (Andriy Kashyrskyy), ",s9.Spanish," (Alex Barco), ",s9.Turkish," (Hasan Bircan)",h.jsx("br",{}),h.jsx("br",{}),Y.t("aboutUs.Acknowledgment",r),": ",Y.t("aboutUs.FundingInformation",r)," ",Y.t("aboutUs.Contact",r),h.jsx("hr",{style:{width:"100%",marginTop:"20px",color:n}}),h.jsxs("p",{style:{textAlign:"center",paddingTop:"6px",fontSize:"12px",color:n},children:[h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-terms.html",style:{color:n,textDecoration:"none"},children:Y.t("aboutUs.TermsOfService",r)}),"   |   ",h.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:"https://intofuture.org/aladdin-privacy.html",style:{color:n,textDecoration:"none"},children:Y.t("aboutUs.PrivacyPolicy",r)})]})]})]})})}),Fnn=Ho.div` position: absolute; top: 80px; left: 10px; @@ -4871,7 +4871,7 @@ function print() { __p += __j.call(arguments, '') } border-radius: 10px; background: dimgray; box-shadow: 3px 3px 3px 3px black; -`,knn=be.memo(({close:t})=>{const e=M(m0);return h.jsxs(Fnn,{children:[h.jsx(Enn,{top:10,color:"antiquewhite"}),h.jsx("div",{style:{position:"absolute",fontSize:"small",color:"antiquewhite",cursor:"pointer",bottom:"10px"},onMouseDown:()=>{t()},children:Y.t("word.Close",{lng:e})})]})});var Lnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 244c176.18 0 319 142.82 319 319v233a32 32 0 01-32 32H225a32 32 0 01-32-32V563c0-176.18 142.82-319 319-319zM484 68h56a8 8 0 018 8v96a8 8 0 01-8 8h-56a8 8 0 01-8-8V76a8 8 0 018-8zM177.25 191.66a8 8 0 0111.32 0l67.88 67.88a8 8 0 010 11.31l-39.6 39.6a8 8 0 01-11.31 0l-67.88-67.88a8 8 0 010-11.31l39.6-39.6zm669.6 0l39.6 39.6a8 8 0 010 11.3l-67.88 67.9a8 8 0 01-11.32 0l-39.6-39.6a8 8 0 010-11.32l67.89-67.88a8 8 0 0111.31 0zM192 892h640a32 32 0 0132 32v24a8 8 0 01-8 8H168a8 8 0 01-8-8v-24a32 32 0 0132-32zm148-317v253h64V575h-64z"}}]},name:"alert",theme:"filled"},Wnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Lnn}))},Nnn=m.forwardRef(Wnn),Unn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"},jnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Unn}))},Bnn=m.forwardRef(jnn),Ynn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},Onn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ynn}))},Vnn=m.forwardRef(Onn),_nn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},Gnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:_nn}))},Xnn=m.forwardRef(Gnn),Jnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z"}}]},name:"camera",theme:"outlined"},Knn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Jnn}))},_u=m.forwardRef(Knn),qnn={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"},$nn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:qnn}))},Th=m.forwardRef($nn),Qnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0026 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z"}}]},name:"carry-out",theme:"outlined"},Znn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Qnn}))},eon=m.forwardRef(Znn),ton={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},non=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:ton}))},oon=m.forwardRef(non),ron={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-upload",theme:"outlined"},ion=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:ron}))},aon=m.forwardRef(ion),lon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"down-circle",theme:"outlined"},son=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:lon}))},con=m.forwardRef(son),uon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9z"}}]},name:"edit",theme:"filled"},don=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:uon}))},fon=m.forwardRef(don),hon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},pon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hon}))},ny=m.forwardRef(pon),gon={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},mon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gon}))},yon=m.forwardRef(mon),Aon={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},won=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Aon}))},von=m.forwardRef(won),xon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"},bon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:xon}))},Son=m.forwardRef(bon),Ton={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},Pon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ton}))},Con=m.forwardRef(Pon),Ron={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"},Hon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ron}))},Mon=m.forwardRef(Hon),Ion={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z"}}]},name:"pushpin",theme:"filled"},zon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ion}))},Don=m.forwardRef(zon),Eon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z"}}]},name:"pushpin",theme:"outlined"},Fon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Eon}))},nPe=m.forwardRef(Fon),kon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"},Lon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:kon}))},kQe=m.forwardRef(Lon),Won={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},Non=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Won}))},Hf=m.forwardRef(Non),Uon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},jon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Uon}))},Bon=m.forwardRef(jon),Yon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},Oon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Yon}))},Von=m.forwardRef(Oon),_on={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},Gon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:_on}))},Xon=m.forwardRef(Gon),Jon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"unordered-list",theme:"outlined"},Kon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Jon}))},du=m.forwardRef(Kon),qon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.5 360.3a7.95 7.95 0 00-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7H381c10.2 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"up-circle",theme:"outlined"},$on=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:qon}))},Qon=m.forwardRef($on),Zon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},ern=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Zon}))},trn=m.forwardRef(ern),nrn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z"}}]},name:"vertical-align-bottom",theme:"outlined"},orn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:nrn}))},rrn=m.forwardRef(orn),irn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},arn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:irn}))},nb=m.forwardRef(arn);const lrn="pSdH5rJWovu8hchgLSnsqT",srn="02/02/2023 12:24 pm",crn=1675358675337,urn="QWecNcxhyvP6j6sBN11hBsfZDau1",drn=null,frn=null,hrn={latitude:42.2844063,timesPerHour:20,date:"1/22/2022 10:15:00 AM",longitude:-71.3488548,name:"default",address:"Natick, MA",ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],albedo:.3,thermalDiffusivity:.05},orthographic:!1,cameraZoom:28.63945562104857},prn=[{cy:1.9385448115528998,name:"June",type:"Human",cz:11465644746167777e-31,normal:[0,1,0],cx:-2.72710574788732,selected:!1,id:"8si9AKQwGf4sYiD91xfFr6",rotation:[0,0,0],parentId:"Ground"}],grn={mapWeatherStations:!1,showGroundPanel:!1,showSiteInfoPanel:!0,mapTilt:0,groundPanelY:0,yearlyLightSensorPanelY:0,axes:!0,showHeliodonPanel:!0,showWeatherPanel:!1,dailyLightSensorPanelY:0,mapType:"roadmap",groundImage:!1,autoRotate:!1,dailyLightSensorPanelX:0,showYearlyLightSensorPanel:!1,weatherPanelY:0,heliodonPanelX:-6,showStickyNotePanel:!0,groundColor:"#16cda5",weatherPanelX:0,heliodonPanelY:9,groundPanelX:0,shadowEnabled:!0,theme:"Default",heliodon:!0,stickyNotePanelY:0,yearlyLightSensorPanelX:0,showDailyLightSensorPanel:!1,mapZoom:16,stickyNotePanelX:0,cameraPosition:[-2.2645315712935465,-19.016408185270922,3.0537676736998205],panCenter:[1.9284721678646957,1.0746189678250615,2.420128405670479],orthographic:!1,enableRotate:!0,cameraZoom:24.55475326309651,showInstructionPanel:!1,cameraPosition2D:[0,-4000177797536253e-20,39.9999999999799],panCenter2D:[0,0,0],showSunAngles:!0,stickyNotePanelRect:{x:-5,y:-2,width:309,height:64}},mrn=1,yrn={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},Arn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},wrn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},vrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},xrn=["Sun angles relative to the ground"],brn={docid:lrn,time:srn,timestamp:crn,userid:urn,owner:drn,email:frn,world:hrn,elements:prn,view:grn,evolutionMethod:mrn,solarPanelArrayLayoutParams:yrn,solarPanelArrayLayoutConstraints:Arn,evolutionaryAlgorithmState:wrn,economicsParams:vrn,notes:xrn},Srn="aLZxDeCyLDDueFWdBcXne3",Trn="02/02/2023 12:27 pm",Prn=1675358863088,Crn="QWecNcxhyvP6j6sBN11hBsfZDau1",Rrn=null,Hrn=null,Mrn={latitude:0,timesPerHour:6,date:"9/22/2022, 3:00:00 PM",longitude:-71.3488548,name:"default",address:"",ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],albedo:.3,thermalDiffusivity:.05},orthographic:!1,cameraZoom:28.63945562104857,noAnimationForSensorDataCollection:!0},Irn=[{cy:-3.793749931074972,name:"Jeanette",type:"Human",cz:0,normal:[0,1,0],cx:-1.8371287635005462,selected:!1,id:"8si9AKQwGf4sYiD91xfFr6",rotation:[0,0,0],parentId:"Ground",lx:.4,ly:.6,lz:1.62},{type:"Foundation",cx:-.02034256309656146,cy:-.0945631153454527,cz:.05,lx:4.039349774896637,ly:4.009416382499952,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",selected:!1,id:"vtjS16tFJ2nQYaRPqaTXtD",textureType:"Foundation Texture #2"},{type:"Sensor",cx:.24583065540477922,cy:-.24570551313996075,cz:.5000000074505806,lx:.1,ly:.1,lz:.01,showLabel:!0,normal:[0,0,1],rotation:[0,0,0],parentId:"vtjS16tFJ2nQYaRPqaTXtD",foundationId:"vtjS16tFJ2nQYaRPqaTXtD",id:"1RgbN67ETfax1aEC4UN1sd",selected:!1}],zrn={mapWeatherStations:!1,showGroundPanel:!1,showSiteInfoPanel:!0,mapTilt:0,groundPanelY:0,yearlyLightSensorPanelY:5,axes:!0,showHeliodonPanel:!0,showWeatherPanel:!1,dailyLightSensorPanelY:203,mapType:"roadmap",groundImage:!1,autoRotate:!1,dailyLightSensorPanelX:-31,showYearlyLightSensorPanel:!0,weatherPanelY:0,heliodonPanelX:-5,showStickyNotePanel:!0,groundColor:"#16cda5",weatherPanelX:0,heliodonPanelY:4,groundPanelX:0,shadowEnabled:!0,theme:"Default",heliodon:!0,stickyNotePanelY:0,yearlyLightSensorPanelX:-1,showDailyLightSensorPanel:!1,mapZoom:16,stickyNotePanelX:0,cameraPosition:[14.252594110627898,-20.834202556609767,6.804345920821559],panCenter:[0,0,0],orthographic:!1,enableRotate:!0,cameraZoom:58.72652247402654,showInstructionPanel:!1,cameraPosition2D:[0,-4000177797536253e-20,39.9999999999795],panCenter2D:[0,0,0],showSunAngles:!0,stickyNotePanelRect:{x:1204,y:154,width:595,height:199},yearlyLightSensorPanelRect:{x:-1284,y:2,width:600,height:500},yearlyLightSensorPanelShowDaylight:!1},Drn=1,Ern={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},Frn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},krn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},Lrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},Wrn=["The solar radiation at different locations of the Earth in different seasons is largely responsible for local climate. Overall, every place on the Earth has about the same hours of daylight in total (ideally 12×365=4,380 hours), regardless of where it is. However, the distribution throughout the year is vastly different, resulting in large temperature variations across the globe. You can change the latitude to investigate these relationships. Make sure to refresh the graph after changing any variables."],Nrn={docid:Srn,time:Trn,timestamp:Prn,userid:Crn,owner:Rrn,email:Hrn,world:Mrn,elements:Irn,view:zrn,evolutionMethod:Drn,solarPanelArrayLayoutParams:Ern,solarPanelArrayLayoutConstraints:Frn,evolutionaryAlgorithmState:krn,economicsParams:Lrn,notes:Wrn},Urn="3DwyXjJjUExjZ1f5APPdnu",jrn="11/13/2022 04:59 pm",Brn=1668376781695,Yrn="QWecNcxhyvP6j6sBN11hBsfZDau1",Orn=null,Vrn=null,_rn={date:"6/22/2022 1:00:00 PM",timesPerHour:6,address:"Natick, MA",latitude:42.2844063,longitude:-71.3488548,name:"default",orthographic:!1,cameraZoom:35,ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],thermalDiffusivity:.05,albedo:.3},noAnimationForSensorDataCollection:!0,noAnimationForHeatmapSimulation:!0},Grn=[{selected:!1,cz:-.00999999999999913,cx:-.2955982837076121,type:"Human",id:"3NsNQgPftGsbYSoSRa2zV4",normal:[0,1,0],cy:3.9255960830681698,name:"Jack",rotation:[0,0,0],parentId:"Ground",lx:.42,ly:.42,lz:1.8},{selected:!1,cy:4.081504375344256,name:"Jacqueline",rotation:[0,0,0],normal:[0,1,0],id:"xaNFgEDtpNwZNyUWnndg4x",cz:-.009999999999999095,type:"Human",cx:2.399220108700476,parentId:"Ground",lx:.43,ly:.6,lz:1.78},{cx:.20566332108722207,color:"gray",cz:2,type:"Cuboid",lz:4,normal:[0,0,1],faceColors:["gray","gray","gray","gray","gray","gray"],textureTypes:["No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture"],ly:3.646712311386908,cy:.10935014088128625,rotation:[0,0,0],lx:2.2290047878920136,id:"2QtCNEmEF6Mcs3vbbR96ZT",selected:!1,parentId:"Ground"},{ly:.1,selected:!1,type:"Sensor",showLabel:!0,normal:[0,0,1],lz:.01,rotation:[0,0,0],lx:.1,cz:.5,cx:.03109721392634064,cy:.16878784903489202,id:"iqgmPt2Nm3r4bW8A7g6DJy",label:"Top",parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{label:"North",rotation:[0,0,0],ly:.1,normal:[0,1,0],cy:.4999999988722325,type:"Sensor",showLabel:!0,selected:!1,id:"soQWet6PH9YYEVPLyKPtZ1",cz:-.036155842645941405,lx:.1,lz:.01,cx:-.0014535790327764226,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{normal:[1,0,0],cz:.012842850721372034,cy:-.02894757303561696,ly:.1,lz:.01,label:"East",id:"g3pxtSA3CsXPiogBgtEeYs",lx:.1,showLabel:!0,rotation:[0,0,0],type:"Sensor",cx:.5000000161579515,selected:!1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{lz:.01,showLabel:!0,rotation:[0,0,0],cy:-.4999999988722335,selected:!1,id:"1GCXGRbm6nuTH23uA8Yngz",cx:.028086152131634783,normal:[0,-1,0],cz:-.16060425332465766,ly:.1,type:"Sensor",label:"South",lx:.1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{selected:!1,ly:.1,normal:[-1,0,0],rotation:[0,0,0],id:"9Aqk7YM1qj7eBSDfhRzr51",cy:-.0010171489984738787,label:"West",cz:.04694614030299604,cx:-.5000000161579532,type:"Sensor",showLabel:!0,lz:.01,lx:.1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"}],Xrn={showDailyLightSensorPanel:!0,showYearlyLightSensorPanel:!1,autoRotate:!1,showGroundPanel:!1,yearlyLightSensorPanelY:70,stickyNotePanelX:6,mapType:"roadmap",weatherPanelY:0,shadowEnabled:!0,theme:"Default",stickyNotePanelY:0,mapWeatherStations:!1,groundColor:"#16cda5",heliodon:!0,dailyLightSensorPanelX:-19,axes:!0,showWeatherPanel:!1,dailyLightSensorPanelY:15,mapTilt:0,heliodonPanelX:-1235,groundPanelY:0,heliodonPanelY:7,groundImage:!1,mapZoom:16,showStickyNotePanel:!0,groundPanelX:0,weatherPanelX:0,yearlyLightSensorPanelX:-905,showHeliodonPanel:!1,cameraPosition:[11.69562560736218,15.284097405092108,4.526997191755329],panCenter:[-2.432389491951708,.8034413072625061,1.0138875329134873],orthographic:!1,enableRotate:!0,cameraZoom:28.63945562104857,cameraPosition2D:[0,-4000177797536253e-20,39.99999999997991],panCenter2D:[0,0,0],stickyNotePanelRect:{x:0,y:0,width:400,height:300},dailyLightSensorPanelRect:{x:0,y:0,width:600,height:360}},Jrn=1,Krn={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},qrn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},$rn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},Qrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},Zrn=[`Solar radiation to a box +`,knn=be.memo(({close:t})=>{const e=M(m0);return h.jsxs(Fnn,{children:[h.jsx(Enn,{top:10,color:"antiquewhite"}),h.jsx("div",{style:{position:"absolute",fontSize:"small",color:"antiquewhite",cursor:"pointer",bottom:"10px"},onMouseDown:()=>{t()},children:Y.t("word.Close",{lng:e})})]})});var Lnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 244c176.18 0 319 142.82 319 319v233a32 32 0 01-32 32H225a32 32 0 01-32-32V563c0-176.18 142.82-319 319-319zM484 68h56a8 8 0 018 8v96a8 8 0 01-8 8h-56a8 8 0 01-8-8V76a8 8 0 018-8zM177.25 191.66a8 8 0 0111.32 0l67.88 67.88a8 8 0 010 11.31l-39.6 39.6a8 8 0 01-11.31 0l-67.88-67.88a8 8 0 010-11.31l39.6-39.6zm669.6 0l39.6 39.6a8 8 0 010 11.3l-67.88 67.9a8 8 0 01-11.32 0l-39.6-39.6a8 8 0 010-11.32l67.89-67.88a8 8 0 0111.31 0zM192 892h640a32 32 0 0132 32v24a8 8 0 01-8 8H168a8 8 0 01-8-8v-24a32 32 0 0132-32zm148-317v253h64V575h-64z"}}]},name:"alert",theme:"filled"},Wnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Lnn}))},Nnn=m.forwardRef(Wnn),Unn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"},jnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Unn}))},Bnn=m.forwardRef(jnn),Ynn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z"}}]},name:"arrow-right",theme:"outlined"},Onn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ynn}))},Vnn=m.forwardRef(Onn),_nn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},Gnn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:_nn}))},Xnn=m.forwardRef(Gnn),Jnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 248H728l-32.4-90.8a32.07 32.07 0 00-30.2-21.2H358.6c-13.5 0-25.6 8.5-30.1 21.2L296 248H160c-44.2 0-80 35.8-80 80v456c0 44.2 35.8 80 80 80h704c44.2 0 80-35.8 80-80V328c0-44.2-35.8-80-80-80zm8 536c0 4.4-3.6 8-8 8H160c-4.4 0-8-3.6-8-8V328c0-4.4 3.6-8 8-8h186.7l17.1-47.8 22.9-64.2h250.5l22.9 64.2 17.1 47.8H864c4.4 0 8 3.6 8 8v456zM512 384c-88.4 0-160 71.6-160 160s71.6 160 160 160 160-71.6 160-160-71.6-160-160-160zm0 256c-53 0-96-43-96-96s43-96 96-96 96 43 96 96-43 96-96 96z"}}]},name:"camera",theme:"outlined"},Knn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Jnn}))},_u=m.forwardRef(Knn),qnn={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z"}}]},name:"caret-right",theme:"outlined"},$nn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:qnn}))},Th=m.forwardRef($nn),Qnn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v584zM688 420h-55.2c-5.1 0-10 2.5-13 6.6L468.9 634.4l-64.7-89c-3-4.1-7.8-6.6-13-6.6H336c-6.5 0-10.3 7.4-6.5 12.7l126.4 174a16.1 16.1 0 0026 0l212.6-292.7c3.8-5.4 0-12.8-6.5-12.8z"}}]},name:"carry-out",theme:"outlined"},Znn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Qnn}))},eon=m.forwardRef(Znn),ton={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"check-circle",theme:"outlined"},non=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:ton}))},oon=m.forwardRef(non),ron={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-upload",theme:"outlined"},ion=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:ron}))},aon=m.forwardRef(ion),lon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M690 405h-46.9c-10.2 0-19.9 4.9-25.9 13.2L512 563.6 406.8 418.2c-6-8.3-15.6-13.2-25.9-13.2H334c-6.5 0-10.3 7.4-6.5 12.7l178 246c3.2 4.4 9.7 4.4 12.9 0l178-246c3.9-5.3.1-12.7-6.4-12.7z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"down-circle",theme:"outlined"},son=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:lon}))},con=m.forwardRef(son),uon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32zm-622.3-84c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9z"}}]},name:"edit",theme:"filled"},don=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:uon}))},fon=m.forwardRef(don),hon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},pon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:hon}))},ny=m.forwardRef(pon),gon={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},mon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:gon}))},yon=m.forwardRef(mon),Aon={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},won=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Aon}))},von=m.forwardRef(won),xon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M603.3 327.5l-246 178a7.95 7.95 0 000 12.9l246 178c5.3 3.8 12.7 0 12.7-6.5V643c0-10.2-4.9-19.9-13.2-25.9L457.4 512l145.4-105.2c8.3-6 13.2-15.6 13.2-25.9V334c0-6.5-7.4-10.3-12.7-6.5z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"left-circle",theme:"outlined"},bon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:xon}))},Son=m.forwardRef(bon),Ton={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"}}]},name:"link",theme:"outlined"},Pon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ton}))},Con=m.forwardRef(Pon),Ron={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"more",theme:"outlined"},Hon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ron}))},Mon=m.forwardRef(Hon),Ion={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3-15.4 12.3-16.6 35.4-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8z"}}]},name:"pushpin",theme:"filled"},zon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Ion}))},Don=m.forwardRef(zon),Eon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z"}}]},name:"pushpin",theme:"outlined"},Fon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Eon}))},nPe=m.forwardRef(Fon),kon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M666.7 505.5l-246-178A8 8 0 00408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"right-circle",theme:"outlined"},Lon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:kon}))},kQe=m.forwardRef(Lon),Won={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},Non=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Won}))},Mf=m.forwardRef(Non),Uon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},jon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Uon}))},Bon=m.forwardRef(jon),Yon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z"}}]},name:"sort-ascending",theme:"outlined"},Oon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Yon}))},Von=m.forwardRef(Oon),_on={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM310.3 167.1a8 8 0 00-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z"}}]},name:"sort-descending",theme:"outlined"},Gon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:_on}))},Xon=m.forwardRef(Gon),Jon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"unordered-list",theme:"outlined"},Kon=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Jon}))},du=m.forwardRef(Kon),qon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.5 360.3a7.95 7.95 0 00-12.9 0l-178 246c-3.8 5.3 0 12.7 6.5 12.7H381c10.2 0 19.9-4.9 25.9-13.2L512 460.4l105.2 145.4c6 8.3 15.6 13.2 25.9 13.2H690c6.5 0 10.3-7.4 6.5-12.7l-178-246z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"up-circle",theme:"outlined"},$on=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:qon}))},Qon=m.forwardRef($on),Zon={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},ern=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:Zon}))},trn=m.forwardRef(ern),nrn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z"}}]},name:"vertical-align-bottom",theme:"outlined"},orn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:nrn}))},rrn=m.forwardRef(orn),irn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},arn=function(e,n){return m.createElement(zr,Ir({},e,{ref:n,icon:irn}))},nb=m.forwardRef(arn);const lrn="pSdH5rJWovu8hchgLSnsqT",srn="02/02/2023 12:24 pm",crn=1675358675337,urn="QWecNcxhyvP6j6sBN11hBsfZDau1",drn=null,frn=null,hrn={latitude:42.2844063,timesPerHour:20,date:"1/22/2022 10:15:00 AM",longitude:-71.3488548,name:"default",address:"Natick, MA",ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],albedo:.3,thermalDiffusivity:.05},orthographic:!1,cameraZoom:28.63945562104857},prn=[{cy:1.9385448115528998,name:"June",type:"Human",cz:11465644746167777e-31,normal:[0,1,0],cx:-2.72710574788732,selected:!1,id:"8si9AKQwGf4sYiD91xfFr6",rotation:[0,0,0],parentId:"Ground"}],grn={mapWeatherStations:!1,showGroundPanel:!1,showSiteInfoPanel:!0,mapTilt:0,groundPanelY:0,yearlyLightSensorPanelY:0,axes:!0,showHeliodonPanel:!0,showWeatherPanel:!1,dailyLightSensorPanelY:0,mapType:"roadmap",groundImage:!1,autoRotate:!1,dailyLightSensorPanelX:0,showYearlyLightSensorPanel:!1,weatherPanelY:0,heliodonPanelX:-6,showStickyNotePanel:!0,groundColor:"#16cda5",weatherPanelX:0,heliodonPanelY:9,groundPanelX:0,shadowEnabled:!0,theme:"Default",heliodon:!0,stickyNotePanelY:0,yearlyLightSensorPanelX:0,showDailyLightSensorPanel:!1,mapZoom:16,stickyNotePanelX:0,cameraPosition:[-2.2645315712935465,-19.016408185270922,3.0537676736998205],panCenter:[1.9284721678646957,1.0746189678250615,2.420128405670479],orthographic:!1,enableRotate:!0,cameraZoom:24.55475326309651,showInstructionPanel:!1,cameraPosition2D:[0,-4000177797536253e-20,39.9999999999799],panCenter2D:[0,0,0],showSunAngles:!0,stickyNotePanelRect:{x:-5,y:-2,width:309,height:64}},mrn=1,yrn={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},Arn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},wrn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},vrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},xrn=["Sun angles relative to the ground"],brn={docid:lrn,time:srn,timestamp:crn,userid:urn,owner:drn,email:frn,world:hrn,elements:prn,view:grn,evolutionMethod:mrn,solarPanelArrayLayoutParams:yrn,solarPanelArrayLayoutConstraints:Arn,evolutionaryAlgorithmState:wrn,economicsParams:vrn,notes:xrn},Srn="aLZxDeCyLDDueFWdBcXne3",Trn="02/02/2023 12:27 pm",Prn=1675358863088,Crn="QWecNcxhyvP6j6sBN11hBsfZDau1",Rrn=null,Hrn=null,Mrn={latitude:0,timesPerHour:6,date:"9/22/2022, 3:00:00 PM",longitude:-71.3488548,name:"default",address:"",ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],albedo:.3,thermalDiffusivity:.05},orthographic:!1,cameraZoom:28.63945562104857,noAnimationForSensorDataCollection:!0},Irn=[{cy:-3.793749931074972,name:"Jeanette",type:"Human",cz:0,normal:[0,1,0],cx:-1.8371287635005462,selected:!1,id:"8si9AKQwGf4sYiD91xfFr6",rotation:[0,0,0],parentId:"Ground",lx:.4,ly:.6,lz:1.62},{type:"Foundation",cx:-.02034256309656146,cy:-.0945631153454527,cz:.05,lx:4.039349774896637,ly:4.009416382499952,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",selected:!1,id:"vtjS16tFJ2nQYaRPqaTXtD",textureType:"Foundation Texture #2"},{type:"Sensor",cx:.24583065540477922,cy:-.24570551313996075,cz:.5000000074505806,lx:.1,ly:.1,lz:.01,showLabel:!0,normal:[0,0,1],rotation:[0,0,0],parentId:"vtjS16tFJ2nQYaRPqaTXtD",foundationId:"vtjS16tFJ2nQYaRPqaTXtD",id:"1RgbN67ETfax1aEC4UN1sd",selected:!1}],zrn={mapWeatherStations:!1,showGroundPanel:!1,showSiteInfoPanel:!0,mapTilt:0,groundPanelY:0,yearlyLightSensorPanelY:5,axes:!0,showHeliodonPanel:!0,showWeatherPanel:!1,dailyLightSensorPanelY:203,mapType:"roadmap",groundImage:!1,autoRotate:!1,dailyLightSensorPanelX:-31,showYearlyLightSensorPanel:!0,weatherPanelY:0,heliodonPanelX:-5,showStickyNotePanel:!0,groundColor:"#16cda5",weatherPanelX:0,heliodonPanelY:4,groundPanelX:0,shadowEnabled:!0,theme:"Default",heliodon:!0,stickyNotePanelY:0,yearlyLightSensorPanelX:-1,showDailyLightSensorPanel:!1,mapZoom:16,stickyNotePanelX:0,cameraPosition:[14.252594110627898,-20.834202556609767,6.804345920821559],panCenter:[0,0,0],orthographic:!1,enableRotate:!0,cameraZoom:58.72652247402654,showInstructionPanel:!1,cameraPosition2D:[0,-4000177797536253e-20,39.9999999999795],panCenter2D:[0,0,0],showSunAngles:!0,stickyNotePanelRect:{x:1204,y:154,width:595,height:199},yearlyLightSensorPanelRect:{x:-1284,y:2,width:600,height:500},yearlyLightSensorPanelShowDaylight:!1},Drn=1,Ern={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},Frn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},krn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},Lrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},Wrn=["The solar radiation at different locations of the Earth in different seasons is largely responsible for local climate. Overall, every place on the Earth has about the same hours of daylight in total (ideally 12×365=4,380 hours), regardless of where it is. However, the distribution throughout the year is vastly different, resulting in large temperature variations across the globe. You can change the latitude to investigate these relationships. Make sure to refresh the graph after changing any variables."],Nrn={docid:Srn,time:Trn,timestamp:Prn,userid:Crn,owner:Rrn,email:Hrn,world:Mrn,elements:Irn,view:zrn,evolutionMethod:Drn,solarPanelArrayLayoutParams:Ern,solarPanelArrayLayoutConstraints:Frn,evolutionaryAlgorithmState:krn,economicsParams:Lrn,notes:Wrn},Urn="3DwyXjJjUExjZ1f5APPdnu",jrn="11/13/2022 04:59 pm",Brn=1668376781695,Yrn="QWecNcxhyvP6j6sBN11hBsfZDau1",Orn=null,Vrn=null,_rn={date:"6/22/2022 1:00:00 PM",timesPerHour:6,address:"Natick, MA",latitude:42.2844063,longitude:-71.3488548,name:"default",orthographic:!1,cameraZoom:35,ground:{snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0],thermalDiffusivity:.05,albedo:.3},noAnimationForSensorDataCollection:!0,noAnimationForHeatmapSimulation:!0},Grn=[{selected:!1,cz:-.00999999999999913,cx:-.2955982837076121,type:"Human",id:"3NsNQgPftGsbYSoSRa2zV4",normal:[0,1,0],cy:3.9255960830681698,name:"Jack",rotation:[0,0,0],parentId:"Ground",lx:.42,ly:.42,lz:1.8},{selected:!1,cy:4.081504375344256,name:"Jacqueline",rotation:[0,0,0],normal:[0,1,0],id:"xaNFgEDtpNwZNyUWnndg4x",cz:-.009999999999999095,type:"Human",cx:2.399220108700476,parentId:"Ground",lx:.43,ly:.6,lz:1.78},{cx:.20566332108722207,color:"gray",cz:2,type:"Cuboid",lz:4,normal:[0,0,1],faceColors:["gray","gray","gray","gray","gray","gray"],textureTypes:["No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture","No Facade Texture"],ly:3.646712311386908,cy:.10935014088128625,rotation:[0,0,0],lx:2.2290047878920136,id:"2QtCNEmEF6Mcs3vbbR96ZT",selected:!1,parentId:"Ground"},{ly:.1,selected:!1,type:"Sensor",showLabel:!0,normal:[0,0,1],lz:.01,rotation:[0,0,0],lx:.1,cz:.5,cx:.03109721392634064,cy:.16878784903489202,id:"iqgmPt2Nm3r4bW8A7g6DJy",label:"Top",parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{label:"North",rotation:[0,0,0],ly:.1,normal:[0,1,0],cy:.4999999988722325,type:"Sensor",showLabel:!0,selected:!1,id:"soQWet6PH9YYEVPLyKPtZ1",cz:-.036155842645941405,lx:.1,lz:.01,cx:-.0014535790327764226,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{normal:[1,0,0],cz:.012842850721372034,cy:-.02894757303561696,ly:.1,lz:.01,label:"East",id:"g3pxtSA3CsXPiogBgtEeYs",lx:.1,showLabel:!0,rotation:[0,0,0],type:"Sensor",cx:.5000000161579515,selected:!1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{lz:.01,showLabel:!0,rotation:[0,0,0],cy:-.4999999988722335,selected:!1,id:"1GCXGRbm6nuTH23uA8Yngz",cx:.028086152131634783,normal:[0,-1,0],cz:-.16060425332465766,ly:.1,type:"Sensor",label:"South",lx:.1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"},{selected:!1,ly:.1,normal:[-1,0,0],rotation:[0,0,0],id:"9Aqk7YM1qj7eBSDfhRzr51",cy:-.0010171489984738787,label:"West",cz:.04694614030299604,cx:-.5000000161579532,type:"Sensor",showLabel:!0,lz:.01,lx:.1,parentId:"2QtCNEmEF6Mcs3vbbR96ZT",foundationId:"2QtCNEmEF6Mcs3vbbR96ZT"}],Xrn={showDailyLightSensorPanel:!0,showYearlyLightSensorPanel:!1,autoRotate:!1,showGroundPanel:!1,yearlyLightSensorPanelY:70,stickyNotePanelX:6,mapType:"roadmap",weatherPanelY:0,shadowEnabled:!0,theme:"Default",stickyNotePanelY:0,mapWeatherStations:!1,groundColor:"#16cda5",heliodon:!0,dailyLightSensorPanelX:-19,axes:!0,showWeatherPanel:!1,dailyLightSensorPanelY:15,mapTilt:0,heliodonPanelX:-1235,groundPanelY:0,heliodonPanelY:7,groundImage:!1,mapZoom:16,showStickyNotePanel:!0,groundPanelX:0,weatherPanelX:0,yearlyLightSensorPanelX:-905,showHeliodonPanel:!1,cameraPosition:[11.69562560736218,15.284097405092108,4.526997191755329],panCenter:[-2.432389491951708,.8034413072625061,1.0138875329134873],orthographic:!1,enableRotate:!0,cameraZoom:28.63945562104857,cameraPosition2D:[0,-4000177797536253e-20,39.99999999997991],panCenter2D:[0,0,0],stickyNotePanelRect:{x:0,y:0,width:400,height:300},dailyLightSensorPanelRect:{x:0,y:0,width:600,height:360}},Jrn=1,Krn={pvModelName:"CS6X-355P-FG",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},qrn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},$rn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},Qrn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},Zrn=[`Solar radiation to a box This model shows the solar radiation the five sides (top, west, east, south, and north sides) of a box receives. There is a sensor on each side. Analyze the daily and annual sensor data to compare the solar radiation the five sides receive. @@ -4897,10 +4897,10 @@ in an arbitrary shape with a nearby structure`],REn={docid:dEn,time:fEn,timestam 房屋朝向的影響`],MFn={docid:sFn,time:cFn,timestamp:uFn,userid:dFn,owner:fFn,email:hFn,world:pFn,elements:gFn,sceneRadius:mFn,view:yFn,graphState:AFn,evolutionMethod:wFn,solarPanelArrayLayoutParams:vFn,solarPanelArrayLayoutConstraints:xFn,evolutionaryAlgorithmState:bFn,economicsParams:SFn,modelType:TFn,modelAuthor:PFn,modelLabel:CFn,modelDescription:RFn,notes:HFn},IFn="gRqNfJd8beo5ietdqmmTM2",zFn="05/22/2023 10:35 am",DFn=1684766140952,EFn="QWecNcxhyvP6j6sBN11hBsfZDau1",FFn=null,kFn=null,LFn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},WFn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"👎",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#333333",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"#009ce0",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"#cccccc",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"#cccccc",tint:"#73D8FF",opacity:.5,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"#cccccc",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"#009ce0",width:.5},selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:3.5222057461264544,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:3.5222057461264544,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:3.5222057461264544,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:3.5222057461264544,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"#cccccc",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"#009ce0",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"#cccccc",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"#009ce0",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#333333",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:3.5222057461264544,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"👍",showLabel:!0,color:"#808080"},{type:"Door",cx:-.020833333333333332,cy:0,cz:-.125,lx:.125,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"vNVpqbsNF7tYjDx7E7kMLR"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"xpWZ6k69MtomLyhCbBynNa"}],NFn=24,UFn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-18.39191326488849,-28.88082266775545,4.500680104409036],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[9.06975830834568,5.812472797471483,4.500680104409029],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-2,y:-1,width:243,height:90}},jFn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},BFn=1,YFn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},OFn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},VFn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},_Fn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},GFn="Unknown",XFn=null,JFn=null,KFn=null,qFn=[`Effect of insulation 房屋隔熱性的影響`],$Fn={docid:IFn,time:zFn,timestamp:DFn,userid:EFn,owner:FFn,email:kFn,world:LFn,elements:WFn,sceneRadius:NFn,view:UFn,graphState:jFn,evolutionMethod:BFn,solarPanelArrayLayoutParams:YFn,solarPanelArrayLayoutConstraints:OFn,evolutionaryAlgorithmState:VFn,economicsParams:_Fn,modelType:GFn,modelAuthor:XFn,modelLabel:JFn,modelDescription:KFn,notes:qFn},QFn="2b6To2exbyQMzsnyC5zQ4h",ZFn="05/22/2023 10:37 am",ekn=1684766230048,tkn="QWecNcxhyvP6j6sBN11hBsfZDau1",nkn=null,okn=null,rkn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},ikn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:9.345387499999994,cy:.10743784147400248,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"B",showLabel:!0,labelHeight:6.5,labelSize:.8,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,color:"#333333",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Foundation",cx:-9.302518749999996,cy:.06403695851719249,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},id:"fbqvzYqiEy79jeL8wsadib",selected:!1,hvacSystem:{thermostatSetpoint:20},label:"A",labelHeight:6.5,showLabel:!0,labelSize:.8,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,leftJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],rightJoints:["2RETAxyRMzZBEQkBGms56R"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"giYTP9Qg6uJ3yfkS1RoDqG",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,leftJoints:["beHqET5NN8aNdsuBncMpY7"],rightJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"pPpJHGJ2bGVqLdA1FpXi4V",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,leftJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],rightJoints:["beHqET5NN8aNdsuBncMpY7"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2RETAxyRMzZBEQkBGms56R",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,leftJoints:["2RETAxyRMzZBEQkBGms56R"],rightJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"beHqET5NN8aNdsuBncMpY7",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,thickness:.2,roofType:"Gable",roofStructure:"Default",wallsId:["beHqET5NN8aNdsuBncMpY7"],textureType:"No Roof Texture",color:"#cccccc",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"wqKadTHiLAV8a3mAejBhVp",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"2bkzpWVFhyLy2B93eQe6LC"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2qrmNqnNqMrnaf9yVKwntp",parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"fPNsZAwsuY65jcgPGD7JxY"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"pMhyfs2o4fEnaE7UjB8PVu"}],akn=22,lkn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-12.301199186500163,-22.5861615760567,3.4543056235043506],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[6.0653741729769015,2.261846946588245,3.4543056235043506],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-3,y:-4,width:278,height:87}},skn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},ckn=1,ukn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},dkn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},fkn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},hkn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},pkn="Unknown",gkn=null,mkn=null,ykn=null,Akn=[`Effect of roof color 屋頂顔色的影響`],wkn={docid:QFn,time:ZFn,timestamp:ekn,userid:tkn,owner:nkn,email:okn,world:rkn,elements:ikn,sceneRadius:akn,view:lkn,graphState:skn,evolutionMethod:ckn,solarPanelArrayLayoutParams:ukn,solarPanelArrayLayoutConstraints:dkn,evolutionaryAlgorithmState:fkn,economicsParams:hkn,modelType:pkn,modelAuthor:gkn,modelLabel:mkn,modelDescription:ykn,notes:Akn},vkn="gyoLQ5RfiYexA7q1ehdofm",xkn="05/22/2023 10:45 am",bkn=1684766701791,Skn="QWecNcxhyvP6j6sBN11hBsfZDau1",Tkn=null,Pkn=null,Ckn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},Rkn=[{type:"Human",name:"Jacqueline",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.43,lz:1.78,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:9.345387499999994,cy:.10743784147400248,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"B",showLabel:!0,labelHeight:7,labelSize:.8,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,color:"#808080",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Foundation",cx:-9.302518749999996,cy:.06403695851719249,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},id:"fbqvzYqiEy79jeL8wsadib",selected:!1,hvacSystem:{thermostatSetpoint:20},label:"A",labelHeight:7,showLabel:!0,labelSize:.8,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,leftJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],rightJoints:["2RETAxyRMzZBEQkBGms56R"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"giYTP9Qg6uJ3yfkS1RoDqG",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,leftJoints:["beHqET5NN8aNdsuBncMpY7"],rightJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"pPpJHGJ2bGVqLdA1FpXi4V",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,leftJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],rightJoints:["beHqET5NN8aNdsuBncMpY7"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2RETAxyRMzZBEQkBGms56R",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.1,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,leftJoints:["2RETAxyRMzZBEQkBGms56R"],rightJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"beHqET5NN8aNdsuBncMpY7",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.8,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,thickness:.2,roofType:"Gable",roofStructure:"Default",wallsId:["beHqET5NN8aNdsuBncMpY7"],textureType:"No Roof Texture",color:"#808080",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"wqKadTHiLAV8a3mAejBhVp",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"2bkzpWVFhyLy2B93eQe6LC"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2qrmNqnNqMrnaf9yVKwntp",parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"uPY2H1vbzdvDNNQKsQzM2R"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"qj1uppbZ68e6DUdrkgfzdA"}],Hkn=22,Mkn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-11.365944827281202,-27.884282052116806,4.909032289220344],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[8.512452835588759,2.1768673048896354,4.909032289220344],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-1,y:0,width:284,height:88}},Ikn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},zkn=1,Dkn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},Ekn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},Fkn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},kkn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},Lkn="Unknown",Wkn=null,Nkn=null,Ukn=null,jkn=[`Effect of eaves overhang -屋簷延申長度的影響`],Bkn={docid:vkn,time:xkn,timestamp:bkn,userid:Skn,owner:Tkn,email:Pkn,world:Ckn,elements:Rkn,sceneRadius:Hkn,view:Mkn,graphState:Ikn,evolutionMethod:zkn,solarPanelArrayLayoutParams:Dkn,solarPanelArrayLayoutConstraints:Ekn,evolutionaryAlgorithmState:Fkn,economicsParams:kkn,modelType:Lkn,modelAuthor:Wkn,modelLabel:Nkn,modelDescription:Ukn,notes:jkn},Ykn="iJM88uQ7kfN8BTPGSVD3jV",Okn="05/22/2023 10:47 am",Vkn=1684766839823,_kn="QWecNcxhyvP6j6sBN11hBsfZDau1",Gkn=null,Xkn=null,Jkn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},Kkn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#009ce0",opacity:.65,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#009ce0",opacity:.65,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#009ce0",opacity:.35,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#009ce0",opacity:.35,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"B",showLabel:!0,color:"#666666"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"rRMpmcwQNzvRYmkTWpEhiw"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"jyiupxyxWNzhU4yRrTPHU1"}],qkn=24,$kn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-16.77287507225449,-24.274336266873924,5.320155603217975],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[10.498836843888402,4.793969537181787,2.890808814152251],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-5,y:-1,width:421,height:65}},Qkn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},Zkn=1,eLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},tLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},nLn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},oLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},rLn="Unknown",iLn=null,aLn=null,lLn=null,sLn=["Effect of solar heat gain coefficients (SHGC) of windows"],cLn={docid:Ykn,time:Okn,timestamp:Vkn,userid:_kn,owner:Gkn,email:Xkn,world:Jkn,elements:Kkn,sceneRadius:qkn,view:$kn,graphState:Qkn,evolutionMethod:Zkn,solarPanelArrayLayoutParams:eLn,solarPanelArrayLayoutConstraints:tLn,evolutionaryAlgorithmState:nLn,economicsParams:oLn,modelType:rLn,modelAuthor:iLn,modelLabel:aLn,modelDescription:lLn,notes:sLn},uLn="6nLDNj8vM4d4LSQKVT9SXo",dLn="05/22/2023 10:49 am",fLn=1684766960725,hLn="QWecNcxhyvP6j6sBN11hBsfZDau1",pLn=null,gLn=null,mLn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},yLn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"20℃",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#999999"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.5,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:25},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"25℃",showLabel:!0,color:"#999999"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"1TYVF9JTXJtxWba41xgetC"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"afEtgeFVMoeDZdyxJU1psm"}],ALn=24,wLn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-21.828926822512322,-33.873528421784314,4.788669771967834],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[11.438181824994281,-4.700464851624883,4.788669771967831],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-1,y:0,width:277,height:63}},vLn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},xLn=1,bLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},SLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},TLn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},PLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},CLn="Unknown",RLn=null,HLn=null,MLn=null,ILn=["Effect of thermostat setpoint"],zLn={docid:uLn,time:dLn,timestamp:fLn,userid:hLn,owner:pLn,email:gLn,world:mLn,elements:yLn,sceneRadius:ALn,view:wLn,graphState:vLn,evolutionMethod:xLn,solarPanelArrayLayoutParams:bLn,solarPanelArrayLayoutConstraints:SLn,evolutionaryAlgorithmState:TLn,economicsParams:PLn,modelType:CLn,modelAuthor:RLn,modelLabel:HLn,modelDescription:MLn,notes:ILn},DLn="uQrNcHUUR7GCUfUbuFogjq",ELn="02/04/2023 01:39 pm",FLn=1675535990373,kLn="QWecNcxhyvP6j6sBN11hBsfZDau1",LLn=null,WLn=null,NLn={solarRadiationHeatmapGridCellSize:.5,date:"7/22/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:12,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},ULn=[{type:"Human",name:"Jamelia",cx:-4.3683434199366005,cy:-14.38651482103353,cz:0,lx:.65,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.65},{type:"Foundation",cx:-13.228758971915111,cy:.10702186833261693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:9,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:6.0818182264215075,cy:-.11406220740522244,cz:2.2301039869226305,lx:9.999999999999998,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.0818182264215075,-5.1140622074052215,.1],rightPoint:[6.081818226421507,4.885937792594777,.1],relativeAngle:1.5707963267948968,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.6,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H",uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:.2916666666666667,lx:.08333333333333337,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:0,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #6",color:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"gLG7BoTZHSewPba87UV4Za",uValue:1.135652},{type:"Window",cx:-.16666666666666666,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"vLVbxQBoEhW71qxT8m1C96",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"26QzSovJr2WkHKUiErU1ER",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"dZ11kEn33ciPLMqva4wYhW",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.16666666666666666,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"oEPM7Qer3dagcgAZgTd83X",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"nJe6q1fYHpVb61zzuXMiiq",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"atbMWVsRWU1gP4pFd8UmqE",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"4Xcrc4Qc969xumwjdaTpEv",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"9r471ngxUS5HfZPQXAbspz",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"nuMh9HUjsyggQDkK4K4z9r",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"5TzjYq921EthYvgGjhkd95",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"i86kfMa5D3a95EHYr74Cik",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fes2JVoykppGjYbeBaK1t6",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"hRvyn5tFnyKbZGmExP8ZBN",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fHUqZ9dwKm5QsdBz4rQhkH",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"hVPD3ovUCMHizYi7hHMynX",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"92r9RVUcqNvqTSSqzXVWe8",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"88LWhfUeptGcLDGkhffTYu",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"jJyncTarX8t32trtWmHYJ8",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"tbGfuWPSK8hFimiixh3gnq",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.0463748368250254,thickness:.2,rValue:2.8177645969011635,roofType:"Gable",roofStructure:"Default",wallsId:["s4gNJy8vD8tdJGQTaw6DQj"],textureType:"Roof Texture Default",color:"#333333",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"6YiUmdowinEDGE2jXwEcty",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],volumetricHeatCapacity:.2,ceiling:!1},{type:"Window",cx:.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"uPf27SYtJ3oEqK8uLnnYC4",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:0,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"41qtH3jyhy6TAYrTpcQ22r",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"c15PoZLmaL9G5281NC3Bky",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"e8J6XhFvtnTfamsfk7MdQo",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:-4625929269271485e-33,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1.135652,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1Z9wCTEw4evBfgBWBx239G"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["iUbSPuuaLHTe92zf2RbbzH"],rightJoints:["b2z6LAysW1ypLiK23VhMbQ"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"t5aKJuTWqFhNtovV6QcVDQ",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"6XAyQ1Y5un66zE9fws5TBK",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"5Fr8WLjKhMXxtEUSo3U3cz",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:0,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bFA3kdwdbv23kgNuvqrBLu",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2peuf57tgQn8h8KDddojmU",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"pRLjDR4NSZstZSY2CyZhG6",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:-4625929269271485e-33,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,color:"#ffffff",textureType:"Door Texture #1",filled:!0,doorType:"Default",archHeight:1,normal:[0,1,0],rotation:[0,0,0],id:"fRfZQadrT6sohNBtnZQnjD",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",selected:!1,uValue:1.135652},{type:"Wall",cx:6.0818182264215075,cy:-.11406220740522244,cz:2.2301039869226305,lx:9.999999999999998,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["t1vsyYVv6oASAroVbtBJh8"],rightJoints:["t5aKJuTWqFhNtovV6QcVDQ"],leftPoint:[6.0818182264215075,-5.1140622074052215,.1],rightPoint:[6.081818226421507,4.885937792594777,.1],relativeAngle:1.5707963267948968,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"iUbSPuuaLHTe92zf2RbbzH",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.35833333333333334,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"twjCCVvcJUWUtdX8G6XaEz",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fJ9ef8TPTGwzuoD998nCxH",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"75FMXmZGkavm2QX1w7Rd2n",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"digHAxUKfqtzZ8Hf1JBrDE",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"pUavBYiArb55RaZvTqEZ7s",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bMNcD6i8MyPWUstcj4RLAn",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["t5aKJuTWqFhNtovV6QcVDQ"],rightJoints:["t1vsyYVv6oASAroVbtBJh8"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"b2z6LAysW1ypLiK23VhMbQ",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:.3416666666666667,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"7af2qg5wEnfy5x3dVwJDa9",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8pzbRVzHdUJ21tt86EiuYq",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"9Rqpx9csAi6gzvsKmMevD7",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"sRtEGAvWiVdZjNF7cbimyK",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"cYa823h2xpVhLafAMFJLLp",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"eCrrhs7nC8ZLgf3kozqASz",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["b2z6LAysW1ypLiK23VhMbQ"],rightJoints:["iUbSPuuaLHTe92zf2RbbzH"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"t1vsyYVv6oASAroVbtBJh8",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"xoY2sZ3zu3yaqNq4svSL83",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:.2916666666666667,lx:.08333333333333337,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"shVdFBTLP3GUxKo2h9rQPd",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:0,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,color:"#ffffff",textureType:"Door Texture #6",filled:!0,doorType:"Default",archHeight:1,normal:[0,1,0],rotation:[0,0,0],id:"miHyMDSBYSuj5NSFDxZf2d",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",selected:!1,uValue:1.135652},{type:"Window",cx:-.16666666666666666,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"izobe4AEhigpZU6WX5N4k5",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"o5YP1zidq8SX6PcUxxaAjL",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"4GhJEysBwSqkSWJpqyaJ48",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.16666666666666666,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"aAGJp2q5U3FuWTdYaSVjDf",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"twPsG5mQU2qWwH6PZR3MFv",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"1Gwnr8y8qnWjyqse356de2",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{id:"5ujWfCT94pVpZ6u8JCHaJM",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.0463748368250254,color:"#333333",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",roofType:"Gable",roofStructure:"Default",textureType:"Roof Texture Default",thickness:.2,wallsId:["t5aKJuTWqFhNtovV6QcVDQ"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,volumetricHeatCapacity:.2,ceiling:!1},{type:"Foundation",cx:13.117837499999993,cy:-.021318315185384407,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},labelHeight:9,labelSize:.8,showLabel:!0,id:"9Lzok59gfWu44BJHP6NeDv",selected:!1,label:"B",color:"#666666"},{type:"Solar Panel",pvModelName:"SPR-X21-335-BLK",trackerType:"None",relativeAzimuth:0,tiltAngle:.5235987755982988,orientation:"Landscape",drawSunBeam:!0,poleHeight:10,poleRadius:.05,poleSpacing:3,cx:.017473997824250177,cy:-.1848238594563359,cz:7.203451961471109,lx:10.906,ly:4.184,lz:.046,showLabel:!1,normal:[-25496209749856465e-33,-.3787787636615868,.9254872490742375],rotation:[.38847637916043065,0,-2220446049250313e-31],color:"#fff",frameColor:"white",parentType:"Roof",parentId:"5ujWfCT94pVpZ6u8JCHaJM",foundationId:"9Lzok59gfWu44BJHP6NeDv",id:"m7muU5PcHHSqA6qooFMWMX",selected:!1}],jLn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-21.205706148898816,-34.501280243521734,7.541149435690317],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[7.9613043217859705,4.9057140700953275,7.541149435690313],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:675,height:408},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:-1091,y:218,width:775,height:342},stickyNotePanelRect:{x:-3,y:-2,width:275,height:63}},BLn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},YLn=1,OLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},VLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},_Ln={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},GLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},XLn=["Effect of rooftop solar panels"],JLn={docid:DLn,time:ELn,timestamp:FLn,userid:kLn,owner:LLn,email:WLn,world:NLn,elements:ULn,view:jLn,graphState:BLn,evolutionMethod:YLn,solarPanelArrayLayoutParams:OLn,solarPanelArrayLayoutConstraints:VLn,evolutionaryAlgorithmState:_Ln,economicsParams:GLn,notes:XLn},KLn="4VyiQ32UEi5Uhg2actsJ7k",qLn="05/22/2023 10:52 am",$Ln=1684767120478,QLn="QWecNcxhyvP6j6sBN11hBsfZDau1",ZLn=null,eWn=null,tWn={solarRadiationHeatmapGridCellSize:.5,date:"7/1/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},nWn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:9.345387499999994,cy:.10743784147400248,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"Uninsulated floor",showLabel:!0,labelHeight:7,labelSize:.5,color:"#808080",rValue:1.7611028730632272},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,color:"#808080",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Foundation",cx:-9.302518749999996,cy:.06403695851719249,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},id:"fbqvzYqiEy79jeL8wsadib",selected:!1,hvacSystem:{thermostatSetpoint:20},label:"Insulated floor",labelHeight:7,showLabel:!0,labelSize:.5,color:"#808080",rValue:3.5222057461264544},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,leftJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],rightJoints:["2RETAxyRMzZBEQkBGms56R"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"giYTP9Qg6uJ3yfkS1RoDqG",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,leftJoints:["beHqET5NN8aNdsuBncMpY7"],rightJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"pPpJHGJ2bGVqLdA1FpXi4V",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,leftJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],rightJoints:["beHqET5NN8aNdsuBncMpY7"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2RETAxyRMzZBEQkBGms56R",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,leftJoints:["2RETAxyRMzZBEQkBGms56R"],rightJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"beHqET5NN8aNdsuBncMpY7",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,thickness:.2,roofType:"Gable",roofStructure:"Default",wallsId:["beHqET5NN8aNdsuBncMpY7"],textureType:"No Roof Texture",color:"#808080",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"wqKadTHiLAV8a3mAejBhVp",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"2bkzpWVFhyLy2B93eQe6LC"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2qrmNqnNqMrnaf9yVKwntp",parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"3uhARcmLhJJ7AF4oGmRXFJ"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"rJ589nLaG9XWmTRZhwLvTz"}],oWn=22,rWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-17.829241192466892,-21.107034059971184,4.718921354569243],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[4.327600264578368,2.7041849125647666,4.718921354569243],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!0,diurnalTemperaturePanelRect:{x:-1,y:1,width:517,height:333},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},heatFluxScaleFactor:10,stickyNotePanelRect:{x:-2,y:344,width:517,height:60}},iWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},aWn=1,lWn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},sWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},cWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},uWn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},dWn="Unknown",fWn=null,hWn=null,pWn=null,gWn=["Effect of ground temperature and floor insulation"],mWn={docid:KLn,time:qLn,timestamp:$Ln,userid:QLn,owner:ZLn,email:eWn,world:tWn,elements:nWn,sceneRadius:oWn,view:rWn,graphState:iWn,evolutionMethod:aWn,solarPanelArrayLayoutParams:lWn,solarPanelArrayLayoutConstraints:sWn,evolutionaryAlgorithmState:cWn,economicsParams:uWn,modelType:dWn,modelAuthor:fWn,modelLabel:hWn,modelDescription:pWn,notes:gWn},yWn="gTE5M2QuRpvxtj7gFjQvBp",AWn="05/22/2023 10:53 am",wWn=1684767216212,vWn="QWecNcxhyvP6j6sBN11hBsfZDau1",xWn=null,bWn=null,SWn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},TWn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.5,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Tree",name:"Maple",cx:11.597557786217195,cy:-9.10270743636709,cz:0,lx:11.852806241793175,lz:12.934464914753796,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"o3k54VQM47Q54nSJAwrmEn",selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"B",showLabel:!0,color:"#666666"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #14",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"p8R6iYpCmdMa5Cs4zuS1P6"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #14",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"56LE4zBekLnvJc9jFEm7Yu"}],PWn=24,CWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-25.541858353538785,-23.926978121750373,5.679305436989464],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[13.47063227815913,1.5150691532035274,5.679305436989461],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-3,y:-2,width:203,height:64}},RWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},HWn=1,MWn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},IWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},zWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},DWn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},EWn="Unknown",FWn=null,kWn=null,LWn=null,WWn=["Effect of trees"],NWn={docid:yWn,time:AWn,timestamp:wWn,userid:vWn,owner:xWn,email:bWn,world:SWn,elements:TWn,sceneRadius:PWn,view:CWn,graphState:RWn,evolutionMethod:HWn,solarPanelArrayLayoutParams:MWn,solarPanelArrayLayoutConstraints:IWn,evolutionaryAlgorithmState:zWn,economicsParams:DWn,modelType:EWn,modelAuthor:FWn,modelLabel:kWn,modelDescription:LWn,notes:WWn},UWn="21TNkEaRQtmkMpHquDpRhe",jWn="03/21/2023 12:30 pm",BWn=1679416202848,YWn="QWecNcxhyvP6j6sBN11hBsfZDau1",OWn=null,VWn=null,_Wn={solarRadiationHeatmapGridCellSize:.25,date:"1/22/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:12,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},GWn=[{type:"Human",name:"Judd",cx:2.5001103094985826,cy:-6.058721988130646,cz:.030962420627473897,lx:.544,lz:1.68,normal:[0,1,0],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:-10.117024999999996,cy:.27838070851727714,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"No Ceiling",showLabel:!0,labelHeight:6,labelSize:.5,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.068830689450057,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.1,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:-.029166666666666664,cy:0,cz:-.08333333333333333,lx:.10833333333333334,ly:0,lz:.8333333333333334,color:"white",uValue:1.7034779999999998,textureType:"Door Texture #17",filled:!0,doorType:"Arched",archHeight:1,normal:[0,0,1],rotation:[0,0,0],id:"9j89u3pSufVm3Q5kpF4NcM",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",selected:!1},{type:"Human",name:"Jena",cx:2.5001103094985826,cy:-6.058721988130646,cz:.030962420627473897,lx:.695,ly:.42,lz:1.6,normal:[0,1,0],rotation:[0,0,0],parentId:"cfvC81ormzBEgA9Ah4eP3v",id:"34EHkp2Lb8b2vnEKfniznR",selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["rHyZXvwyEPAa7dU7nYmXpR"],rightJoints:["jvSvdwWqKHJqgaZtgavr3X"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"8NQNpFkXNGAXtcTwXhtHNW",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["sb7GHiMmhgNyZJdQ71BL5y"],rightJoints:["8NQNpFkXNGAXtcTwXhtHNW"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"rHyZXvwyEPAa7dU7nYmXpR",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["8NQNpFkXNGAXtcTwXhtHNW"],rightJoints:["sb7GHiMmhgNyZJdQ71BL5y"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"jvSvdwWqKHJqgaZtgavr3X",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["jvSvdwWqKHJqgaZtgavr3X"],rightJoints:["rHyZXvwyEPAa7dU7nYmXpR"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"sb7GHiMmhgNyZJdQ71BL5y",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Window",cx:-.3125,cy:.1,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,uValue:2,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"q6p3CCHJFvsqrEsXwbRh1R",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.3125,cy:.1,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"j1XnXywfGpFArNKZPbAhkm",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:4625929269271485e-33,cy:0,cz:-.08333333333333333,lx:.10833333333333334,ly:0,lz:.8333333333333334,color:"white",uValue:1.7034779999999998,textureType:"Door Texture #17",filled:!0,doorType:"Arched",archHeight:1,normal:[0,0,1],rotation:[0,0,0],id:"6uoZg4uoFLaTiYnPcJZ3V9",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",selected:!1},{id:"gCFHHnVKnRgFUFksjrmZCm",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:!0,rise:2.068830689450057,color:"#4d4d4d",rValue:1.7611028730632272,sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.1,wallsId:["sb7GHiMmhgNyZJdQ71BL5y"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,ceilingRValue:3.5222057461264544},{type:"Foundation",cx:10.177578528084874,cy:.23562811833261754,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",color:"#808080",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},labelHeight:6,labelSize:.5,showLabel:!0,id:"cfvC81ormzBEgA9Ah4eP3v",selected:!1,label:"Insulated Ceiling"}],XWn=23,JWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,.08573749999997851,4287065548240426e-23],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,.08558749333259577,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-19.73331041183491,-15.606053038152623,2.569638957524864],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[3.388120187568702,1.9907625161279443,1.1720990830439746],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:3,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-2,y:3,width:510,height:354},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},heatFluxScaleFactor:2,stickyNotePanelRect:{x:-4,y:2,width:397,height:65}},KWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},qWn=1,$Wn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},QWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},ZWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},eNn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},tNn="Unknown",nNn=null,oNn=null,rNn=null,iNn=["Thermal envelope vs. building envelope"],aNn={docid:UWn,time:jWn,timestamp:BWn,userid:YWn,owner:OWn,email:VWn,world:_Wn,elements:GWn,sceneRadius:XWn,view:JWn,graphState:KWn,evolutionMethod:qWn,solarPanelArrayLayoutParams:$Wn,solarPanelArrayLayoutConstraints:QWn,evolutionaryAlgorithmState:ZWn,economicsParams:eNn,modelType:tNn,modelAuthor:nNn,modelLabel:oNn,modelDescription:rNn,notes:iNn},lNn=t=>{let e;switch(t){case"sun_angles":e=brn;break;case"insolation_and_climate":e=Nrn;break;case"solar_radiation_to_box":e=ein;break;case"sun_beam_at_center":e=min;break;case"thermal_vs_building_envelope":e=aNn;break;case"effect_house_size":e=lFn;break;case"effect_house_orientation":e=MFn;break;case"effect_wall_roof_insulation":e=$Fn;break;case"effect_roof_color":e=wkn;break;case"effect_eaves_overhang_length":e=Bkn;break;case"effect_window_shgc":e=cLn;break;case"effect_thermostat_setpoint":e=zLn;break;case"effect_solar_panels":e=JLn;break;case"effect_ground_temperature":e=mWn;break;case"effect_trees":e=NWn;break;case"office_building_01":e=T9n;break;case"hotel_01":e=j9n;break;case"spanish_style_hotel":e=s3n;break;case"apartment_building_01":e=I3n;break;case"white_house":e=h5n;break;case"harold_washington_college":e=j5n;break;case"bilim_mersin_turkiye":e=s9n;break;case"south_burlington_high_school":e=X3n;break;case"mescalero_apache_school":e=u6n;break;case"city_block_heatmap":e=v6n;break;case"chicago_skyline":e=X6n;break;case"vegetative_buffer_01":e=uwn;break;case"solar_canopy_form_factors":e=Bvn;break;case"solar_canopy_over_bleachers":e=rxn;break;case"solar_bus_stop":e=Cxn;break;case"solar_facade_tesla":e=Hbn;break;case"solar_canopy_over_garage":e=dbn;break;case"bipv_01":e=Oxn;break;case"floatovoltaics":e=_bn;break;case"agriculture_solar_wind_colocation":e=ASn;break;case"effect_tilt_angle_solar_panel":e=Rwn;break;case"effect_azimuth_solar_panel":e=Vwn;break;case"effect_azimuth_parabolic_trough":e=l7n;break;case"effect_latus_rectum_parabolic_trough":e=S7n;break;case"parabolic_dish_focus_sunlight":e=MTn;break;case"effect_orientation_solar_panel":e=j7n;break;case"solar_panel_types":e=Din;break;case"custom_solar_panels":e=aan;break;case"vertical_bifacial_solar_panels":e=zan;break;case"compare_monofacial_bifacial_solar_panels":e=nln;break;case"why_solar_array":e=nvn;break;case"solar_panel_array_auto_layout":e=Tvn;break;case"inter_row_spacing":e=kSn;break;case"rooftop_solar_panels":e=wln;break;case"solar_panels_over_canal":e=dcn;break;case"solar_noise_barrier":e=Jsn;break;case"rainbow_swash_solar_farm":e=Lln;break;case"mickey_mouse_solar_farm":e=Zln;break;case"solar_farm_hsat_array":e=gsn;break;case"solar_farm_aadat_array":e=zsn;break;case"solar_trackers":e=Hcn;break;case"nevada_solar_one_parabolic_troughs":e=hTn;break;case"tooele_parabolic_dish_array":e=_Tn;break;case"ps10_solar_power_tower":e=$Sn;break;case"linear_fresnel_reflectors":e=sPn;break;case"linear_fresnel_reflectors_two_absorbers":e=PPn;break;case"effect_absorber_pipe_height":e=YPn;break;case"effect_azimuth_fresnel_reflector":e=iCn;break;case"cosine_efficiency_heliostats":e=RCn;break;case"shadowing_blocking_heliostats":e=KCn;break;case"effect_solar_power_tower_height":e=yRn;break;case"solar_power_tower":e=FRn;break;case"solar_water_heaters":e=WMn;break;case"solar_updraft_tower":e=XMn;break;case"solar_updraft_tower_city":e=oIn;break;case"effect_blade_number":e=IIn;break;case"effect_pitch_angle":e=ozn;break;case"bird_safe_blade_design":e=Izn;break;case"offshore_wind_farm":e=oDn;break;case"cape_cod_with_shed_dormer":e=m0n;break;case"mansard_roof_with_dormers":e=N0n;break;case"t_shaped_house":e=aun;break;case"all_roof_types":e=_cn;break;case"a_frame_house":e=ugn;break;case"half_timbered_house":e=Dgn;break;case"dutch_gable_roof":e=Y1n;break;case"combination_roof_vs_bonnet_roof":e=Zgn;break;case"butterfly_roof_house":e=xmn;break;case"gable_roof_vs_hip_roof":e=Ymn;break;case"gable_and_valley_roof":e=cyn;break;case"clerestory_roof":e=Iyn;break;case"monitor_roof":e=Qyn;break;case"colonial_vs_saltbox":e=w2n;break;case"gambrel_roof_vs_mansard_roof":e=j2n;break;case"colonial_house":e=Gpn;break;case"dutch_colonial_house":e=y1n;break;case"cape_cod_with_garage":e=Hun;break;case"greenhouse":e=gAn;break;case"solarium":e=ahn;break;case"pavilion":e=YAn;break;case"octagonal_pagoda":e=i4n;break;case"ocean_front":e=b4n;break;case"mosque_01":e=Shn;break;case"church_01":e=jhn;break;case"cathedral_01":e=opn;break;case"cathedral_02":e=Ppn;break;case"adobe_taos_house":e=_un;break;case"egyptian_pyramids":e=U4n;break;case"mayan_pyramid":e=s8n;break;case"si_o_se_pol":e=P8n;break;case"stacked_cuboids":e=X8n;break;case"barn_house":e=mfn;break;case"ranch_house":e=Adn;break;case"bonnet_house":e=Odn;break;case"modern_house_01":e=Nfn;break;case"solar_radiation_predicted_vs_measured":e=qRn;break;case"bestest_case_600":e=hHn;break;case"bestest_case_610":e=IHn;break;case"bestest_case_620":e=XHn;break;case"bestest_case_630":e=uMn;break;case"tucson_sundt_station":e=hDn;break;case"ai_tilt_angle_one_row":e=IDn;break;case"ai_tilt_angles_multiple_rows":e=XDn;break;case"ai_solar_farm_design":e=uEn;break;case"ai_solar_farm_design_block":e=REn;break;case"ai_fitchburg_solar_farm":e=VEn;break}return e},oM=()=>{const t=M(pn),e=M(YYe),n=M(OYe),o=M(Ap),r=$t(),i=ye.isMac(),a=()=>{if(n&&n.length>0){const l=e();if(l.length>0){const s={name:"Paste to Point",timestamp:Date.now(),pastedElements:l.map(c=>({...c})),undo:()=>{for(const c of s.pastedElements)o(c.id,!1)},redo:()=>{t(c=>{c.elements.push(...s.pastedElements),c.selectedElement=s.pastedElements[0],c.updateElementOnRoofFlag=!0})}};M.getState().addUndoable(s)}}};return h.jsxs(an,{onClick:a,children:[Y.t("word.Paste",r),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",i?"⌘":"Ctrl","+V)"]})]})},Fd=()=>{const t=M(pn),e=M(BYe),n=M(oa),o=$t(),r=ye.isMac(),i=()=>{const a=M.getState().selectedElement;a&&(e(a.id),n&&t(l=>{l.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:a.id,elementType:a.type}}))};return h.jsxs(an,{onClick:i,children:[Y.t("word.Copy",o),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",r?"⌘":"Ctrl","+C)"]})]})},kd=()=>{const t=M(pn),e=M(Ap),n=ye.isMac(),o=$t(),r=()=>{const i=M.getState().selectedElement;if(!(!i||i.type===z.Roof))if(i.locked)gn(Y.t("message.ThisElementIsLocked",o));else{const a=e(i.id,!0);if(a.length===0)return;if(ye.isElementTriggerAutoDeletion(a[0]))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",i.id);else{const l={name:"Cut",timestamp:Date.now(),deletedElements:a,selectedElementId:i.id,undo:()=>{const s=l.deletedElements;if(s.length===0)return;const c=s.find(u=>u.id===l.selectedElementId);c&&t(u=>{for(const d of s)u.elements.push(d);if(c.type===z.Wall){const d=c;let f=null,p=null;if(d.leftJoints.length>0&&(f=d.leftJoints[0]),d.rightJoints.length>0&&(p=d.rightJoints[0]),f||p)for(const g of u.elements)g.id===f&&g.type===z.Wall&&(g.rightJoints[0]=d.id),g.id===p&&g.type===z.Wall&&(g.leftJoints[0]=d.id)}})},redo:()=>{l.deletedElements&&l.deletedElements.length>0&&e(l.deletedElements[0].id,!0)}};M.getState().addUndoable(l)}}};return h.jsxs(an,{onClick:r,children:[Y.t("word.Cut",o),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",n?"⌘":"Ctrl","+X)"]})]})},Ku=({selectedElement:t})=>{const e=$t(),n=M(Ywt),o=M(En),r=a=>{t&&n(t.id,a)},i=a=>{const l=a.target.checked,s={name:"Lock",timestamp:Date.now(),checked:l,selectedElementId:t==null?void 0:t.id,selectedElementType:t==null?void 0:t.type,undo:()=>{r(!s.checked)},redo:()=>{r(s.checked)}};o(s),r(l)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.locked,onChange:i,children:Y.t("word.Lock",e)})})},an=({stayAfterClick:t,noPadding:e,fontWeight:n,textSelectable:o=!0,update:r,onClick:i,children:a})=>{const l=s=>{i&&i(s),t&&s.stopPropagation(),r&&dt.getState().updateContextMenu()};return h.jsx("span",{onClick:l,style:{userSelect:o?"auto":"none",display:"inline-block",fontWeight:n,width:"100%",paddingLeft:e?"0px":"24px"},children:a})},eo=({Dialog:t,noPadding:e,children:n})=>{const[o,r]=m.useState(!1),i=()=>{M.getState().setApplyCount(0),r(!0)};return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:e,onClick:i,children:n}),o&&h.jsx(t,{setDialogVisible:r})]})},LQe=({groupableElement:t})=>{const e=$t(),n=()=>{M.getState().set(r=>{for(const i of r.elements)if(i.id===t.id&&Ad(i)){i.enableGroupMaster=!i.enableGroupMaster;break}r.groupActionUpdateFlag=!r.groupActionUpdateFlag})},o=r=>{const i={name:"Group Master",timestamp:Date.now(),checked:r.target.checked,selectedElementId:t.id,selectedElementType:t.type,undo:()=>n(),redo:()=>n()};M.getState().addUndoable(i),n()};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.enableGroupMaster,onChange:o,children:Y.t("foundationMenu.GroupMaster",e)})})},wX=({element:t,inside:e,children:n})=>{const o=M.getState().updateInsideLightsByParentId,r=()=>{const i=new Map;for(const l of M.getState().elements)l.parentId===t.id&&l.type===z.Light&&i.set(l.id,l.inside);o(t.id,e);const a={name:e?`Set All Lights on ${t.type} Inside`:`Set All Lights on ${t.type} Outside`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[l,s]of a.oldValues.entries())M.getState().updateInsideLightById(l,s)},redo:()=>{o(t.id,e)}};M.getState().addUndoable(a)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:r,children:n})},a2e=({solarCollector:t})=>{const e=M.getState().updateSolarCollectorDrawSunBeamById,n=$t(),o=r=>{const i={name:"Show Sun Beam",timestamp:Date.now(),checked:!t.drawSunBeam,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{e(t.id,!i.checked)},redo:()=>{e(t.id,i.checked)}};M.getState().addUndoable(i),e(t.id,r)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.drawSunBeam,onChange:r=>o(r.target.checked),children:Y.t("solarCollectorMenu.DrawSunBeam",n)})})},yw=({checked:t,onClick:e,children:n})=>h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onClick:e,children:n})}),kC=({min:t,max:e,value:n,onChange:o,children:r})=>h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[r,h.jsx(Iu,{min:t,max:e,tooltip:{open:!1},defaultValue:n,onChange:o})]}),ah=({children:t})=>h.jsx("span",{style:{paddingLeft:"2px",fontSize:9},children:t}),f2=({selector:t,onChange:e,children:n})=>{const o=M(t);return h.jsx(an,{noPadding:!0,stayAfterClick:!0,children:h.jsx(Li,{style:{width:"100%"},checked:o,onChange:e,children:n})})},cae=({selector:t,onChange:e,children:n})=>{const o=M(t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:n}),h.jsx(vc,{checked:o,onChange:e})]})},WQe="/aladdin/assets/map_residential_building-BlM-FtN4.png",NQe="/aladdin/assets/map_commercial_building-DgYY52Jp.png",UQe="/aladdin/assets/map_school_building-B4f7IMQ-.png",jQe="/aladdin/assets/map_tourist_attraction-qR1MEaG5.png",BQe="/aladdin/assets/map_solar_panel-DyfTsHia.png",YQe="/aladdin/assets/map_parabolic_dish-C1NBHVgm.png",OQe="/aladdin/assets/map_parabolic_trough-CCcc-zs6.png",VQe="/aladdin/assets/map_fresnel_reflector-Bzw0EMA6.png",_Qe="/aladdin/assets/map_heliostat-BXje3i1H.png",GQe="/aladdin/assets/map_under_construction-fpLVLcIy.png",XQe="/aladdin/assets/map_marker-C9GhGDY6.png",JQe="/aladdin/assets/map_wind_turbine-Bw5iob8S.png",KQe="/aladdin/assets/map_colocation_projects-PrxUC05F.png";var OQ={exports:{}},qQe={};function $Qe(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!n||e in n)return"";for(let o=0;oe===n.identifier)||t.changedTouches&&(0,Tg.findInArray)(t.changedTouches,n=>e===n.identifier)}function MNn(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function INn(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} +屋簷延申長度的影響`],Bkn={docid:vkn,time:xkn,timestamp:bkn,userid:Skn,owner:Tkn,email:Pkn,world:Ckn,elements:Rkn,sceneRadius:Hkn,view:Mkn,graphState:Ikn,evolutionMethod:zkn,solarPanelArrayLayoutParams:Dkn,solarPanelArrayLayoutConstraints:Ekn,evolutionaryAlgorithmState:Fkn,economicsParams:kkn,modelType:Lkn,modelAuthor:Wkn,modelLabel:Nkn,modelDescription:Ukn,notes:jkn},Ykn="iJM88uQ7kfN8BTPGSVD3jV",Okn="05/22/2023 10:47 am",Vkn=1684766839823,_kn="QWecNcxhyvP6j6sBN11hBsfZDau1",Gkn=null,Xkn=null,Jkn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},Kkn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#009ce0",opacity:.65,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#009ce0",opacity:.65,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#009ce0",opacity:.35,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#009ce0",opacity:.35,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"B",showLabel:!0,color:"#666666"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"rRMpmcwQNzvRYmkTWpEhiw"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"jyiupxyxWNzhU4yRrTPHU1"}],qkn=24,$kn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-16.77287507225449,-24.274336266873924,5.320155603217975],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[10.498836843888402,4.793969537181787,2.890808814152251],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-5,y:-1,width:421,height:65}},Qkn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},Zkn=1,eLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},tLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},nLn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},oLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},rLn="Unknown",iLn=null,aLn=null,lLn=null,sLn=["Effect of solar heat gain coefficients (SHGC) of windows"],cLn={docid:Ykn,time:Okn,timestamp:Vkn,userid:_kn,owner:Gkn,email:Xkn,world:Jkn,elements:Kkn,sceneRadius:qkn,view:$kn,graphState:Qkn,evolutionMethod:Zkn,solarPanelArrayLayoutParams:eLn,solarPanelArrayLayoutConstraints:tLn,evolutionaryAlgorithmState:nLn,economicsParams:oLn,modelType:rLn,modelAuthor:iLn,modelLabel:aLn,modelDescription:lLn,notes:sLn},uLn="6nLDNj8vM4d4LSQKVT9SXo",dLn="05/22/2023 10:49 am",fLn=1684766960725,hLn="QWecNcxhyvP6j6sBN11hBsfZDau1",pLn=null,gLn=null,mLn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},yLn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"20℃",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#999999"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.5,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:25},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"25℃",showLabel:!0,color:"#999999"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"1TYVF9JTXJtxWba41xgetC"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"afEtgeFVMoeDZdyxJU1psm"}],ALn=24,wLn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-21.828926822512322,-33.873528421784314,4.788669771967834],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[11.438181824994281,-4.700464851624883,4.788669771967831],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-1,y:0,width:277,height:63}},vLn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},xLn=1,bLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},SLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},TLn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},PLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},CLn="Unknown",RLn=null,HLn=null,MLn=null,ILn=["Effect of thermostat setpoint"],zLn={docid:uLn,time:dLn,timestamp:fLn,userid:hLn,owner:pLn,email:gLn,world:mLn,elements:yLn,sceneRadius:ALn,view:wLn,graphState:vLn,evolutionMethod:xLn,solarPanelArrayLayoutParams:bLn,solarPanelArrayLayoutConstraints:SLn,evolutionaryAlgorithmState:TLn,economicsParams:PLn,modelType:CLn,modelAuthor:RLn,modelLabel:HLn,modelDescription:MLn,notes:ILn},DLn="uQrNcHUUR7GCUfUbuFogjq",ELn="02/04/2023 01:39 pm",FLn=1675535990373,kLn="QWecNcxhyvP6j6sBN11hBsfZDau1",LLn=null,WLn=null,NLn={solarRadiationHeatmapGridCellSize:.5,date:"7/22/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:12,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},ULn=[{type:"Human",name:"Jamelia",cx:-4.3683434199366005,cy:-14.38651482103353,cz:0,lx:.65,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.65},{type:"Foundation",cx:-13.228758971915111,cy:.10702186833261693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:9,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:6.0818182264215075,cy:-.11406220740522244,cz:2.2301039869226305,lx:9.999999999999998,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.0818182264215075,-5.1140622074052215,.1],rightPoint:[6.081818226421507,4.885937792594777,.1],relativeAngle:1.5707963267948968,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"6YiUmdowinEDGE2jXwEcty",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.6,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H",uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:.2916666666666667,lx:.08333333333333337,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:0,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #6",color:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"gLG7BoTZHSewPba87UV4Za",uValue:1.135652},{type:"Window",cx:-.16666666666666666,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"vLVbxQBoEhW71qxT8m1C96",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"26QzSovJr2WkHKUiErU1ER",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"dZ11kEn33ciPLMqva4wYhW",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.16666666666666666,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"oEPM7Qer3dagcgAZgTd83X",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"nJe6q1fYHpVb61zzuXMiiq",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"atbMWVsRWU1gP4pFd8UmqE",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"4Xcrc4Qc969xumwjdaTpEv",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"9r471ngxUS5HfZPQXAbspz",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"nuMh9HUjsyggQDkK4K4z9r",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"5TzjYq921EthYvgGjhkd95",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"i86kfMa5D3a95EHYr74Cik",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fes2JVoykppGjYbeBaK1t6",parentId:"wugyuZMsPdNUQJ1PdoxEGD",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"hRvyn5tFnyKbZGmExP8ZBN",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fHUqZ9dwKm5QsdBz4rQhkH",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"hVPD3ovUCMHizYi7hHMynX",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"92r9RVUcqNvqTSSqzXVWe8",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"88LWhfUeptGcLDGkhffTYu",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"jJyncTarX8t32trtWmHYJ8",parentId:"xi9Zz1pobWAhkAdtkZFZBZ",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"tbGfuWPSK8hFimiixh3gnq",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.0463748368250254,thickness:.2,rValue:2.8177645969011635,roofType:"Gable",roofStructure:"Default",wallsId:["s4gNJy8vD8tdJGQTaw6DQj"],textureType:"Roof Texture Default",color:"#333333",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"6YiUmdowinEDGE2jXwEcty",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],volumetricHeatCapacity:.2,ceiling:!1},{type:"Window",cx:.375,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"uPf27SYtJ3oEqK8uLnnYC4",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:0,cy:.3,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"41qtH3jyhy6TAYrTpcQ22r",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"c15PoZLmaL9G5281NC3Bky",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.3,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"e8J6XhFvtnTfamsfk7MdQo",parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:-4625929269271485e-33,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1.135652,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"s4gNJy8vD8tdJGQTaw6DQj",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1Z9wCTEw4evBfgBWBx239G"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["iUbSPuuaLHTe92zf2RbbzH"],rightJoints:["b2z6LAysW1ypLiK23VhMbQ"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"t5aKJuTWqFhNtovV6QcVDQ",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"6XAyQ1Y5un66zE9fws5TBK",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"5Fr8WLjKhMXxtEUSo3U3cz",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:0,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bFA3kdwdbv23kgNuvqrBLu",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2peuf57tgQn8h8KDddojmU",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"pRLjDR4NSZstZSY2CyZhG6",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:-4625929269271485e-33,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,color:"#ffffff",textureType:"Door Texture #1",filled:!0,doorType:"Default",archHeight:1,normal:[0,1,0],rotation:[0,0,0],id:"fRfZQadrT6sohNBtnZQnjD",parentId:"t5aKJuTWqFhNtovV6QcVDQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",selected:!1,uValue:1.135652},{type:"Wall",cx:6.0818182264215075,cy:-.11406220740522244,cz:2.2301039869226305,lx:9.999999999999998,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["t1vsyYVv6oASAroVbtBJh8"],rightJoints:["t5aKJuTWqFhNtovV6QcVDQ"],leftPoint:[6.0818182264215075,-5.1140622074052215,.1],rightPoint:[6.081818226421507,4.885937792594777,.1],relativeAngle:1.5707963267948968,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"iUbSPuuaLHTe92zf2RbbzH",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.35833333333333334,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"twjCCVvcJUWUtdX8G6XaEz",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.35833333333333334,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"fJ9ef8TPTGwzuoD998nCxH",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"75FMXmZGkavm2QX1w7Rd2n",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"digHAxUKfqtzZ8Hf1JBrDE",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"pUavBYiArb55RaZvTqEZ7s",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bMNcD6i8MyPWUstcj4RLAn",parentId:"iUbSPuuaLHTe92zf2RbbzH",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["t5aKJuTWqFhNtovV6QcVDQ"],rightJoints:["t1vsyYVv6oASAroVbtBJh8"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"b2z6LAysW1ypLiK23VhMbQ",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,centerRoofHeight:[0,8.046374836825025],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:.3416666666666667,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"7af2qg5wEnfy5x3dVwJDa9",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8pzbRVzHdUJ21tt86EiuYq",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"9Rqpx9csAi6gzvsKmMevD7",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.3416666666666667,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"sRtEGAvWiVdZjNF7cbimyK",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.008333333333333337,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"cYa823h2xpVhLafAMFJLLp",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.30833333333333335,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"eCrrhs7nC8ZLgf3kozqASz",parentId:"b2z6LAysW1ypLiK23VhMbQ",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:6,rValue:2.1133234476758727,volumetricHeatCapacity:.25,fill:"Full",leftJoints:["b2z6LAysW1ypLiK23VhMbQ"],rightJoints:["iUbSPuuaLHTe92zf2RbbzH"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"Wall Texture Default",color:"#ffffe0",normal:[0,0,1],rotation:[0,0,0],id:"t1vsyYVv6oASAroVbtBJh8",parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"5ujWfCT94pVpZ6u8JCHaJM",leftRoofHeight:6,rightRoofHeight:6,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:6,rightTopPartialHeight:6},{type:"Window",cx:-.375,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"xoY2sZ3zu3yaqNq4svSL83",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:.2916666666666667,lx:.08333333333333337,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"shVdFBTLP3GUxKo2h9rQPd",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Door",cx:0,cy:0,cz:-.2916666666666667,lx:.16666666666666666,ly:0,lz:.4166666666666667,color:"#ffffff",textureType:"Door Texture #6",filled:!0,doorType:"Default",archHeight:1,normal:[0,1,0],rotation:[0,0,0],id:"miHyMDSBYSuj5NSFDxZf2d",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",selected:!1,uValue:1.135652},{type:"Window",cx:-.16666666666666666,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"izobe4AEhigpZU6WX5N4k5",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.1,cz:.2916666666666667,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"o5YP1zidq8SX6PcUxxaAjL",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"4GhJEysBwSqkSWJpqyaJ48",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:-.16666666666666666,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"aAGJp2q5U3FuWTdYaSVjDf",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.16666666666666666,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"twPsG5mQU2qWwH6PZR3MFv",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{type:"Window",cx:.375,cy:.1,cz:-.2083333333333333,lx:.08333333333333333,ly:.2,lz:.24999999999999992,mullion:!0,mullionWidth:.06,mullionSpacing:.6,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"1Gwnr8y8qnWjyqse356de2",parentId:"t1vsyYVv6oASAroVbtBJh8",foundationId:"9Lzok59gfWu44BJHP6NeDv",tint:"#73D8FF",opacity:.6,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1,uValue:1.7034779999999998},{id:"5ujWfCT94pVpZ6u8JCHaJM",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.0463748368250254,color:"#333333",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"9Lzok59gfWu44BJHP6NeDv",foundationId:"9Lzok59gfWu44BJHP6NeDv",roofType:"Gable",roofStructure:"Default",textureType:"Roof Texture Default",thickness:.2,wallsId:["t5aKJuTWqFhNtovV6QcVDQ"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.8177645969011635,volumetricHeatCapacity:.2,ceiling:!1},{type:"Foundation",cx:13.117837499999993,cy:-.021318315185384407,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},labelHeight:9,labelSize:.8,showLabel:!0,id:"9Lzok59gfWu44BJHP6NeDv",selected:!1,label:"B",color:"#666666"},{type:"Solar Panel",pvModelName:"SPR-X21-335-BLK",trackerType:"None",relativeAzimuth:0,tiltAngle:.5235987755982988,orientation:"Landscape",drawSunBeam:!0,poleHeight:10,poleRadius:.05,poleSpacing:3,cx:.017473997824250177,cy:-.1848238594563359,cz:7.203451961471109,lx:10.906,ly:4.184,lz:.046,showLabel:!1,normal:[-25496209749856465e-33,-.3787787636615868,.9254872490742375],rotation:[.38847637916043065,0,-2220446049250313e-31],color:"#fff",frameColor:"white",parentType:"Roof",parentId:"5ujWfCT94pVpZ6u8JCHaJM",foundationId:"9Lzok59gfWu44BJHP6NeDv",id:"m7muU5PcHHSqA6qooFMWMX",selected:!1}],jLn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-21.205706148898816,-34.501280243521734,7.541149435690317],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[7.9613043217859705,4.9057140700953275,7.541149435690313],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:675,height:408},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:-1091,y:218,width:775,height:342},stickyNotePanelRect:{x:-3,y:-2,width:275,height:63}},BLn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},YLn=1,OLn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},VLn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},_Ln={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},GLn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},XLn=["Effect of rooftop solar panels"],JLn={docid:DLn,time:ELn,timestamp:FLn,userid:kLn,owner:LLn,email:WLn,world:NLn,elements:ULn,view:jLn,graphState:BLn,evolutionMethod:YLn,solarPanelArrayLayoutParams:OLn,solarPanelArrayLayoutConstraints:VLn,evolutionaryAlgorithmState:_Ln,economicsParams:GLn,notes:XLn},KLn="4VyiQ32UEi5Uhg2actsJ7k",qLn="05/22/2023 10:52 am",$Ln=1684767120478,QLn="QWecNcxhyvP6j6sBN11hBsfZDau1",ZLn=null,eWn=null,tWn={solarRadiationHeatmapGridCellSize:.5,date:"7/1/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},nWn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:9.345387499999994,cy:.10743784147400248,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"Uninsulated floor",showLabel:!0,labelHeight:7,labelSize:.5,color:"#808080",rValue:1.7611028730632272},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,color:"#808080",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Foundation",cx:-9.302518749999996,cy:.06403695851719249,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},id:"fbqvzYqiEy79jeL8wsadib",selected:!1,hvacSystem:{thermostatSetpoint:20},label:"Insulated floor",labelHeight:7,showLabel:!0,labelSize:.5,color:"#808080",rValue:3.5222057461264544},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,leftJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],rightJoints:["2RETAxyRMzZBEQkBGms56R"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"giYTP9Qg6uJ3yfkS1RoDqG",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,leftJoints:["beHqET5NN8aNdsuBncMpY7"],rightJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"pPpJHGJ2bGVqLdA1FpXi4V",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,leftJoints:["giYTP9Qg6uJ3yfkS1RoDqG"],rightJoints:["beHqET5NN8aNdsuBncMpY7"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"2RETAxyRMzZBEQkBGms56R",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,5.99872672326696],eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,leftJoints:["2RETAxyRMzZBEQkBGms56R"],rightJoints:["pPpJHGJ2bGVqLdA1FpXi4V"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"beHqET5NN8aNdsuBncMpY7",parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",selected:!1,roofId:"wqKadTHiLAV8a3mAejBhVp",wallStructure:"Default",structureSpacing:2,structureWidth:.1,structureColor:"white",opacity:.5,fill:"Full",rValue:2.1133234476758727,volumetricHeatCapacity:.1,leftRoofHeight:4,rightRoofHeight:4,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:1.9987267232669597,thickness:.2,roofType:"Gable",roofStructure:"Default",wallsId:["beHqET5NN8aNdsuBncMpY7"],textureType:"No Roof Texture",color:"#808080",sideColor:"#ffffff",selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,normal:[0,0,1],rotation:[0,0,0],parentId:"fbqvzYqiEy79jeL8wsadib",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"wqKadTHiLAV8a3mAejBhVp",ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"2bkzpWVFhyLy2B93eQe6LC"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"2qrmNqnNqMrnaf9yVKwntp",parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:-.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:0,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"beHqET5NN8aNdsuBncMpY7",foundationId:"fbqvzYqiEy79jeL8wsadib",id:"3uhARcmLhJJ7AF4oGmRXFJ"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #1",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"rJ589nLaG9XWmTRZhwLvTz"}],oWn=22,rWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-17.829241192466892,-21.107034059971184,4.718921354569243],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[4.327600264578368,2.7041849125647666,4.718921354569243],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!0,diurnalTemperaturePanelRect:{x:-1,y:1,width:517,height:333},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},heatFluxScaleFactor:10,stickyNotePanelRect:{x:-2,y:344,width:517,height:60}},iWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},aWn=1,lWn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},sWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},cWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},uWn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},dWn="Unknown",fWn=null,hWn=null,pWn=null,gWn=["Effect of ground temperature and floor insulation"],mWn={docid:KLn,time:qLn,timestamp:$Ln,userid:QLn,owner:ZLn,email:eWn,world:tWn,elements:nWn,sceneRadius:oWn,view:rWn,graphState:iWn,evolutionMethod:aWn,solarPanelArrayLayoutParams:lWn,solarPanelArrayLayoutConstraints:sWn,evolutionaryAlgorithmState:cWn,economicsParams:uWn,modelType:dWn,modelAuthor:fWn,modelLabel:hWn,modelDescription:pWn,notes:gWn},yWn="gTE5M2QuRpvxtj7gFjQvBp",AWn="05/22/2023 10:53 am",wWn=1684767216212,vWn="QWecNcxhyvP6j6sBN11hBsfZDau1",xWn=null,bWn=null,SWn={solarRadiationHeatmapGridCellSize:.5,date:"6/10/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:4,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},TWn=[{type:"Human",name:"Jack",cx:-6.628211467880927,cy:-10.2119938102408,cz:4440892098500626e-31,lx:.42,lz:1.8,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:11.171058971915114,cy:.06430302499558693,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"A",showLabel:!0,labelHeight:8.5,labelSize:.8,color:"#666666"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Window",cx:-.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.5,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"1KMGfKAaAbRXUc5v152G7H"},{type:"Window",cx:.2916666666666667,cy:.3,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"8WmW65wXvFqVAFHZJFWsjr",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Tree",name:"Maple",cx:11.597557786217195,cy:-9.10270743636709,cz:0,lx:11.852806241793175,lz:12.934464914753796,normal:[0,1,0],rotation:[0,0,0],parentId:"Ground",id:"o3k54VQM47Q54nSJAwrmEn",selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi1N2ddsqnGWnubKQgsZki"],rightJoints:["2mKkmtjixue6mVK8C5qdJT"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"adSAr7Jscp2bREMCNnKie9",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["14k9EDHAzKUWAkBFT1miXA"],rightJoints:["adSAr7Jscp2bREMCNnKie9"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"xi1N2ddsqnGWnubKQgsZki",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["adSAr7Jscp2bREMCNnKie9"],rightJoints:["14k9EDHAzKUWAkBFT1miXA"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"2mKkmtjixue6mVK8C5qdJT",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,centerRoofHeight:[0,7.4648066919643785],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:4,rValue:1.7611028730632272,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["2mKkmtjixue6mVK8C5qdJT"],rightJoints:["xi1N2ddsqnGWnubKQgsZki"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#cccccc",normal:[0,0,1],rotation:[0,0,0],id:"14k9EDHAzKUWAkBFT1miXA",parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"w7eDFcjLuyPhMChKfhs6jB",leftRoofHeight:4,rightRoofHeight:4,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:4,rightTopPartialHeight:4},{type:"Window",cx:-.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"szq2y8vnCqxebu1Sp5dC5N",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.2916666666666667,cy:.1,cz:0,lx:.16666666666666666,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"bm2Jq3Yh33GneBgsKAvMp7",parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",tint:"#73D8FF",opacity:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{id:"w7eDFcjLuyPhMChKfhs6jB",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:3.4648066919643785,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"4TcV7zx5NzstoQTaTqoAzt",foundationId:"4TcV7zx5NzstoQTaTqoAzt",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.2,wallsId:["14k9EDHAzKUWAkBFT1miXA"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:2.641654309594841,ceiling:!1},{type:"Foundation",cx:-11.120691028084872,cy:-.06445313166738242,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20},labelHeight:8.5,labelSize:.8,id:"4TcV7zx5NzstoQTaTqoAzt",selected:!1,label:"B",showLabel:!0,color:"#666666"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #14",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"14k9EDHAzKUWAkBFT1miXA",foundationId:"4TcV7zx5NzstoQTaTqoAzt",id:"p8R6iYpCmdMa5Cs4zuS1P6"},{type:"Door",cx:0,cy:0,cz:-.125,lx:.16666666666666666,ly:0,lz:.75,doorType:"Default",filled:!0,archHeight:1,textureType:"Door Texture #14",color:"#ffffff",uValue:1,selected:!1,lineWidth:.2,lineColor:"#000000",showLabel:!1,normal:[0,1,0],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"56LE4zBekLnvJc9jFEm7Yu"}],PWn=24,CWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[-.042868749999999976,0,0],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[-.042868749999999976,-.0001500066673827405,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-25.541858353538785,-23.926978121750373,5.679305436989464],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[13.47063227815913,1.5150691532035274,5.679305436989461],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:5.5,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-5,y:7,width:600,height:360},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},stickyNotePanelRect:{x:-3,y:-2,width:203,height:64}},RWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},HWn=1,MWn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},IWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},zWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},DWn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},EWn="Unknown",FWn=null,kWn=null,LWn=null,WWn=["Effect of trees"],NWn={docid:yWn,time:AWn,timestamp:wWn,userid:vWn,owner:xWn,email:bWn,world:SWn,elements:TWn,sceneRadius:PWn,view:CWn,graphState:RWn,evolutionMethod:HWn,solarPanelArrayLayoutParams:MWn,solarPanelArrayLayoutConstraints:IWn,evolutionaryAlgorithmState:zWn,economicsParams:DWn,modelType:EWn,modelAuthor:FWn,modelLabel:kWn,modelDescription:LWn,notes:WWn},UWn="21TNkEaRQtmkMpHquDpRhe",jWn="03/21/2023 12:30 pm",BWn=1679416202848,YWn="QWecNcxhyvP6j6sBN11hBsfZDau1",OWn=null,VWn=null,_Wn={solarRadiationHeatmapGridCellSize:.25,date:"1/22/2022, 12:00:00 PM",cspTimesPerHour:4,noAnimationForHeatmapSimulation:!1,cspGridCellSize:.5,dustLoss:.05,address:"Natick, MA",cspDaysPerYear:4,ground:{thermalDiffusivity:.05,albedo:.3,snowReflectionFactors:[0,0,0,0,0,0,0,0,0,0,0,0]},daysPerYear:12,latitude:42.2844063,noAnimationForSensorDataCollection:!1,timesPerHour:1,discretization:"Approximate",airAttenuationCoefficient:.01,noAnimationForSolarPanelSimulation:!1,solarPanelVisibilityGridCellSize:.2,pvGridCellSize:.5,name:"default",longitude:-71.3488548,diurnalTemperatureModel:2},GWn=[{type:"Human",name:"Judd",cx:2.5001103094985826,cy:-6.058721988130646,cz:.030962420627473897,lx:.544,lz:1.68,normal:[0,1,0],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",id:"3LYQCPYTZ6WYqLSGF4X7Lr",selected:!1,ly:.42},{type:"Foundation",cx:-10.117024999999996,cy:.27838070851727714,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},id:"iFATUUjMA7c8wHKwioiCvi",selected:!1,label:"No Ceiling",showLabel:!0,labelHeight:6,labelSize:.5,color:"#808080"},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],rightJoints:["wugyuZMsPdNUQJ1PdoxEGD"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"s4gNJy8vD8tdJGQTaw6DQj",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["py4fscALBHuoNNVWKoXS9c"],rightJoints:["s4gNJy8vD8tdJGQTaw6DQj"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"xi9Zz1pobWAhkAdtkZFZBZ",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["s4gNJy8vD8tdJGQTaw6DQj"],rightJoints:["py4fscALBHuoNNVWKoXS9c"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"wugyuZMsPdNUQJ1PdoxEGD",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["wugyuZMsPdNUQJ1PdoxEGD"],rightJoints:["xi9Zz1pobWAhkAdtkZFZBZ"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"py4fscALBHuoNNVWKoXS9c",parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"45EQZzpZDmcCPwStDm4gUQ",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{id:"45EQZzpZDmcCPwStDm4gUQ",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,rise:2.068830689450057,color:"#4d4d4d",sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"iFATUUjMA7c8wHKwioiCvi",foundationId:"iFATUUjMA7c8wHKwioiCvi",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.1,wallsId:["py4fscALBHuoNNVWKoXS9c"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,rValue:1.7611028730632272,ceiling:!1},{type:"Window",cx:-.3125,cy:.3,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,selected:!1,lineWidth:.2,lineColor:"black",showLabel:!1,color:"white",tint:"#73D8FF",opacity:.55,uValue:2,normal:[0,0,1],rotation:[0,0,0],parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",id:"hQgFUEAKKCuxnfg7DfAtUD"},{type:"Window",cx:.3125,cy:.3,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"3F32WEzwgnaEKesshW1B9d",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:-.029166666666666664,cy:0,cz:-.08333333333333333,lx:.10833333333333334,ly:0,lz:.8333333333333334,color:"white",uValue:1.7034779999999998,textureType:"Door Texture #17",filled:!0,doorType:"Arched",archHeight:1,normal:[0,0,1],rotation:[0,0,0],id:"9j89u3pSufVm3Q5kpF4NcM",parentId:"py4fscALBHuoNNVWKoXS9c",foundationId:"iFATUUjMA7c8wHKwioiCvi",selected:!1},{type:"Human",name:"Jena",cx:2.5001103094985826,cy:-6.058721988130646,cz:.030962420627473897,lx:.695,ly:.42,lz:1.6,normal:[0,1,0],rotation:[0,0,0],parentId:"cfvC81ormzBEgA9Ah4eP3v",id:"34EHkp2Lb8b2vnEKfniznR",selected:!1},{type:"Wall",cx:.08181822642150738,cy:4.8859377925947785,cz:2.2408122612280286,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["rHyZXvwyEPAa7dU7nYmXpR"],rightJoints:["jvSvdwWqKHJqgaZtgavr3X"],leftPoint:[6.081818226421507,4.885937792594777,.1],rightPoint:[-5.9181817735784925,4.8859377925947785,.1],relativeAngle:3.141592653589793,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"8NQNpFkXNGAXtcTwXhtHNW",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:6.081818226421506,cy:-.114062207405222,cz:2.2301039869226305,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["sb7GHiMmhgNyZJdQ71BL5y"],rightJoints:["8NQNpFkXNGAXtcTwXhtHNW"],leftPoint:[6.081818226421504,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,4.8859377925947785,.1],relativeAngle:1.5707963267948963,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"rHyZXvwyEPAa7dU7nYmXpR",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:-5.9181817735784925,cy:-.114062207405222,cz:2.228839888904333,lx:10,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["8NQNpFkXNGAXtcTwXhtHNW"],rightJoints:["sb7GHiMmhgNyZJdQ71BL5y"],leftPoint:[-5.918181773578492,4.8859377925947785,.1],rightPoint:[-5.9181817735784925,-5.1140622074052215,.1],relativeAngle:4.71238898038469,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"jvSvdwWqKHJqgaZtgavr3X",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,centerRoofHeight:[0,5.068830689450057],selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Wall",cx:.08181822642150782,cy:-5.1140622074052215,cz:2.268765007024547,lx:12,ly:.2,lz:3,rValue:2.1133234476758727,volumetricHeatCapacity:.1,fill:"Full",leftJoints:["jvSvdwWqKHJqgaZtgavr3X"],rightJoints:["rHyZXvwyEPAa7dU7nYmXpR"],leftPoint:[-5.9181817735784925,-5.1140622074052215,.1],rightPoint:[6.0818182264215075,-5.1140622074052215,.1],relativeAngle:0,textureType:"No Wall Texture",color:"#ffffff",normal:[0,0,1],rotation:[0,0,0],id:"sb7GHiMmhgNyZJdQ71BL5y",parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",wallStructure:"Default",structureSpacing:2,structureColor:"white",structureWidth:.1,opacity:.5,roofId:"gCFHHnVKnRgFUFksjrmZCm",leftRoofHeight:3,rightRoofHeight:3,selected:!1,eavesLength:.2,parapet:{display:!1,color:"white",textureType:"No Wall Texture",parapetHeight:1,copingsWidth:.5,copingsHeight:.1},leftUnfilledHeight:.5,rightUnfilledHeight:.5,leftTopPartialHeight:3,rightTopPartialHeight:3},{type:"Window",cx:-.3125,cy:.1,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,uValue:2,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"q6p3CCHJFvsqrEsXwbRh1R",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Window",cx:.3125,cy:.1,cz:.08333333333333333,lx:.125,ly:.2,lz:.5,mullion:!0,mullionWidth:.06,mullionSpacing:1,mullionColor:"white",frame:!0,frameWidth:.1,windowType:"Default",archHeight:1,color:"white",normal:[0,0,1],rotation:[0,0,0],id:"j1XnXywfGpFArNKZPbAhkm",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",tint:"#73D8FF",opacity:.55,shutter:{showLeft:!1,showRight:!1,color:"grey",width:.5},selected:!1},{type:"Door",cx:4625929269271485e-33,cy:0,cz:-.08333333333333333,lx:.10833333333333334,ly:0,lz:.8333333333333334,color:"white",uValue:1.7034779999999998,textureType:"Door Texture #17",filled:!0,doorType:"Arched",archHeight:1,normal:[0,0,1],rotation:[0,0,0],id:"6uoZg4uoFLaTiYnPcJZ3V9",parentId:"sb7GHiMmhgNyZJdQ71BL5y",foundationId:"cfvC81ormzBEgA9Ah4eP3v",selected:!1},{id:"gCFHHnVKnRgFUFksjrmZCm",type:"Roof",cx:0,cy:0,cz:0,lx:0,ly:0,lz:0,ceiling:!0,rise:2.068830689450057,color:"#4d4d4d",rValue:1.7611028730632272,sideColor:"#ffffff",normal:[0,0,1],rotation:[0,0,0],parentId:"cfvC81ormzBEgA9Ah4eP3v",foundationId:"cfvC81ormzBEgA9Ah4eP3v",roofType:"Gable",roofStructure:"Default",textureType:"No Roof Texture",thickness:.1,wallsId:["sb7GHiMmhgNyZJdQ71BL5y"],ridgeLeftPoint:[0,1],ridgeRightPoint:[0,1],selected:!1,ceilingRValue:3.5222057461264544},{type:"Foundation",cx:10.177578528084874,cy:.23562811833261754,cz:.05,lx:16.34049294383023,ly:14.404432132963985,lz:.1,normal:[0,0,1],rotation:[0,0,0],parentId:"Ground",color:"#808080",solarUpdraftTower:{},solarAbsorberPipe:{},solarPowerTower:{},hvacSystem:{thermostatSetpoint:20,temperatureThreshold:5},labelHeight:6,labelSize:.5,showLabel:!0,id:"cfvC81ormzBEgA9Ah4eP3v",selected:!1,label:"Insulated Ceiling"}],XWn=23,JWn={dailyPvYieldPanelX:0,mapPanelY:0,dailyFresnelReflectorYieldPanelX:0,panCenter2D:[0,.08573749999997851,4287065548240426e-23],yearlyHeliostatYieldPanelY:0,mapPanelX:0,yearlyHeliostatYieldPanelX:0,cameraPosition2D:[0,.08558749333259577,150],theme:"Default",showDesignInfoPanel:!1,weatherPanelX:0,dailyParabolicTroughYieldPanelX:0,mapWeatherStations:!1,stickyNotePanelX:0,showDailyHeliostatYieldPanel:!1,mapZoom:18,showYearlyParabolicTroughYieldPanel:!1,dailyHeliostatYieldPanelX:0,showDailyParabolicDishYieldPanel:!1,cameraPosition:[-19.73331041183491,-15.606053038152623,2.569638957524864],showYearlyHeliostatYieldPanel:!1,orthographic:!1,dailyHeliostatYieldPanelY:0,dailyParabolicTroughYieldPanelY:0,heliodonPanelY:439,yearlyParabolicTroughYieldPanelY:0,showWeatherPanel:!1,groundImage:!1,yearlyLightSensorPanelX:0,ambientLightIntensity:.1,yearlyFresnelReflectorYieldPanelX:0,enableRotate:!0,dailyLightSensorPanelX:0,heliodon:!1,solarRadiationHeatMapReflectionOnly:!1,cameraZoom:23.327015599941696,mapType:"roadmap",showMapPanel:!1,yearlyParabolicDishYieldPanelY:0,showSiteInfoPanel:!0,showDailyParabolicTroughYieldPanel:!1,showDailyFresnelReflectorYieldPanel:!1,showYearlyLightSensorPanel:!1,autoRotate:!1,heliodonPanelX:-14,showStickyNotePanel:!0,showDailyLightSensorPanel:!1,visibilityResultsPanelX:0,yearlyPvYieldPanelY:0,showDailyPvYieldPanel:!1,visibilityResultsPanelY:0,showSunAngles:!1,dailyFresnelReflectorYieldPanelY:0,weatherPanelY:0,dailyLightSensorPanelY:0,groundColor:"#16a5a5",mapTilt:0,showYearlyPvYieldPanel:!1,dailyParabolicDishYieldPanelY:0,yearlyLightSensorPanelY:0,yearlyParabolicTroughYieldPanelX:0,dailyPvYieldPanelY:0,yearlyPvYieldPanelX:0,yearlyParabolicDishYieldPanelX:0,shadowEnabled:!0,showInstructionPanel:!1,panCenter:[3.388120187568702,1.9907625161279443,1.1720990830439746],yearlyFresnelReflectorYieldPanelY:0,showHeliodonPanel:!1,axes:!0,solarRadiationHeatMapMaxValue:3,dailyParabolicDishYieldPanelX:0,showSolarPanelVisibilityResultsPanel:!1,stickyNotePanelY:0,showYearlyParabolicDishYieldPanel:!1,showYearlyFresnelReflectorYieldPanel:!1,showDailyBuildingEnergyPanel:!0,directLightIntensity:1,dailyBuildingEnergyPanelRect:{x:-2,y:3,width:510,height:354},showDiurnalTemperaturePanel:!1,diurnalTemperaturePanelRect:{x:0,y:0,width:600,height:400},showYearlyBuildingEnergyPanel:!1,yearlyBuildingEnergyPanelRect:{x:0,y:0,width:600,height:400},heatFluxScaleFactor:2,stickyNotePanelRect:{x:-4,y:2,width:397,height:65}},KWn={dailyPvIndividualOutputs:!1,yearlyPvIndividualOutputs:!1,dailyParabolicDishIndividualOutputs:!1,yearlyParabolicDishIndividualOutputs:!1,dailyParabolicTroughIndividualOutputs:!1,yearlyParabolicTroughIndividualOutputs:!1,dailyFresnelReflectorIndividualOutputs:!1,yearlyFresnelReflectorIndividualOutputs:!1,dailyHeliostatIndividualOutputs:!1,yearlyHeliostatIndividualOutputs:!1,dailyUpdraftTowerIndividualOutputs:!1,yearlyUpdraftTowerIndividualOutputs:!1},qWn=1,$Wn={pvModelName:"SPR-X21-335-BLK",rowAxis:"Zonal",orientation:"Landscape",tiltAngle:0,rowsPerRack:1,interRowSpacing:2,poleHeight:1,poleSpacing:3},QWn={minimumInterRowSpacing:2,maximumInterRowSpacing:10,minimumRowsPerRack:1,maximumRowsPerRack:6,minimumTiltAngle:-1.5707963267948966,maximumTiltAngle:1.5707963267948966,poleHeight:1,poleSpacing:5,orientation:"Landscape",pvModelName:"CS6X-355P-FG",rowAxis:"Zonal"},ZWn={geneticAlgorithmParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,selectionMethod:1,searchMethod:1,populationSize:20,maximumGenerations:5,selectionRate:.5,crossoverRate:.5,mutationRate:.1,convergenceThreshold:.01,localSearchRadius:.1},particleSwarmOptimizationParams:{problem:"Solar Panel Tilt Angle",objectiveFunctionType:1,searchMethod:1,swarmSize:20,maximumSteps:5,vmax:.01,inertia:.8,cognitiveCoefficient:.1,socialCoefficient:.1,convergenceThreshold:.01,localSearchRadius:.1}},eNn={projectLifeSpan:25,electricitySellingPrice:.25,operationalCostPerUnit:.15},tNn="Unknown",nNn=null,oNn=null,rNn=null,iNn=["Thermal envelope vs. building envelope"],aNn={docid:UWn,time:jWn,timestamp:BWn,userid:YWn,owner:OWn,email:VWn,world:_Wn,elements:GWn,sceneRadius:XWn,view:JWn,graphState:KWn,evolutionMethod:qWn,solarPanelArrayLayoutParams:$Wn,solarPanelArrayLayoutConstraints:QWn,evolutionaryAlgorithmState:ZWn,economicsParams:eNn,modelType:tNn,modelAuthor:nNn,modelLabel:oNn,modelDescription:rNn,notes:iNn},lNn=t=>{let e;switch(t){case"sun_angles":e=brn;break;case"insolation_and_climate":e=Nrn;break;case"solar_radiation_to_box":e=ein;break;case"sun_beam_at_center":e=min;break;case"thermal_vs_building_envelope":e=aNn;break;case"effect_house_size":e=lFn;break;case"effect_house_orientation":e=MFn;break;case"effect_wall_roof_insulation":e=$Fn;break;case"effect_roof_color":e=wkn;break;case"effect_eaves_overhang_length":e=Bkn;break;case"effect_window_shgc":e=cLn;break;case"effect_thermostat_setpoint":e=zLn;break;case"effect_solar_panels":e=JLn;break;case"effect_ground_temperature":e=mWn;break;case"effect_trees":e=NWn;break;case"office_building_01":e=T9n;break;case"hotel_01":e=j9n;break;case"spanish_style_hotel":e=s3n;break;case"apartment_building_01":e=I3n;break;case"white_house":e=h5n;break;case"harold_washington_college":e=j5n;break;case"bilim_mersin_turkiye":e=s9n;break;case"south_burlington_high_school":e=X3n;break;case"mescalero_apache_school":e=u6n;break;case"city_block_heatmap":e=v6n;break;case"chicago_skyline":e=X6n;break;case"vegetative_buffer_01":e=uwn;break;case"solar_canopy_form_factors":e=Bvn;break;case"solar_canopy_over_bleachers":e=rxn;break;case"solar_bus_stop":e=Cxn;break;case"solar_facade_tesla":e=Hbn;break;case"solar_canopy_over_garage":e=dbn;break;case"bipv_01":e=Oxn;break;case"floatovoltaics":e=_bn;break;case"agriculture_solar_wind_colocation":e=ASn;break;case"effect_tilt_angle_solar_panel":e=Rwn;break;case"effect_azimuth_solar_panel":e=Vwn;break;case"effect_azimuth_parabolic_trough":e=l7n;break;case"effect_latus_rectum_parabolic_trough":e=S7n;break;case"parabolic_dish_focus_sunlight":e=MTn;break;case"effect_orientation_solar_panel":e=j7n;break;case"solar_panel_types":e=Din;break;case"custom_solar_panels":e=aan;break;case"vertical_bifacial_solar_panels":e=zan;break;case"compare_monofacial_bifacial_solar_panels":e=nln;break;case"why_solar_array":e=nvn;break;case"solar_panel_array_auto_layout":e=Tvn;break;case"inter_row_spacing":e=kSn;break;case"rooftop_solar_panels":e=wln;break;case"solar_panels_over_canal":e=dcn;break;case"solar_noise_barrier":e=Jsn;break;case"rainbow_swash_solar_farm":e=Lln;break;case"mickey_mouse_solar_farm":e=Zln;break;case"solar_farm_hsat_array":e=gsn;break;case"solar_farm_aadat_array":e=zsn;break;case"solar_trackers":e=Hcn;break;case"nevada_solar_one_parabolic_troughs":e=hTn;break;case"tooele_parabolic_dish_array":e=_Tn;break;case"ps10_solar_power_tower":e=$Sn;break;case"linear_fresnel_reflectors":e=sPn;break;case"linear_fresnel_reflectors_two_absorbers":e=PPn;break;case"effect_absorber_pipe_height":e=YPn;break;case"effect_azimuth_fresnel_reflector":e=iCn;break;case"cosine_efficiency_heliostats":e=RCn;break;case"shadowing_blocking_heliostats":e=KCn;break;case"effect_solar_power_tower_height":e=yRn;break;case"solar_power_tower":e=FRn;break;case"solar_water_heaters":e=WMn;break;case"solar_updraft_tower":e=XMn;break;case"solar_updraft_tower_city":e=oIn;break;case"effect_blade_number":e=IIn;break;case"effect_pitch_angle":e=ozn;break;case"bird_safe_blade_design":e=Izn;break;case"offshore_wind_farm":e=oDn;break;case"cape_cod_with_shed_dormer":e=m0n;break;case"mansard_roof_with_dormers":e=N0n;break;case"t_shaped_house":e=aun;break;case"all_roof_types":e=_cn;break;case"a_frame_house":e=ugn;break;case"half_timbered_house":e=Dgn;break;case"dutch_gable_roof":e=Y1n;break;case"combination_roof_vs_bonnet_roof":e=Zgn;break;case"butterfly_roof_house":e=xmn;break;case"gable_roof_vs_hip_roof":e=Ymn;break;case"gable_and_valley_roof":e=cyn;break;case"clerestory_roof":e=Iyn;break;case"monitor_roof":e=Qyn;break;case"colonial_vs_saltbox":e=w2n;break;case"gambrel_roof_vs_mansard_roof":e=j2n;break;case"colonial_house":e=Gpn;break;case"dutch_colonial_house":e=y1n;break;case"cape_cod_with_garage":e=Hun;break;case"greenhouse":e=gAn;break;case"solarium":e=ahn;break;case"pavilion":e=YAn;break;case"octagonal_pagoda":e=i4n;break;case"ocean_front":e=b4n;break;case"mosque_01":e=Shn;break;case"church_01":e=jhn;break;case"cathedral_01":e=opn;break;case"cathedral_02":e=Ppn;break;case"adobe_taos_house":e=_un;break;case"egyptian_pyramids":e=U4n;break;case"mayan_pyramid":e=s8n;break;case"si_o_se_pol":e=P8n;break;case"stacked_cuboids":e=X8n;break;case"barn_house":e=mfn;break;case"ranch_house":e=Adn;break;case"bonnet_house":e=Odn;break;case"modern_house_01":e=Nfn;break;case"solar_radiation_predicted_vs_measured":e=qRn;break;case"bestest_case_600":e=hHn;break;case"bestest_case_610":e=IHn;break;case"bestest_case_620":e=XHn;break;case"bestest_case_630":e=uMn;break;case"tucson_sundt_station":e=hDn;break;case"ai_tilt_angle_one_row":e=IDn;break;case"ai_tilt_angles_multiple_rows":e=XDn;break;case"ai_solar_farm_design":e=uEn;break;case"ai_solar_farm_design_block":e=REn;break;case"ai_fitchburg_solar_farm":e=VEn;break}return e},oM=()=>{const t=M(pn),e=M(YYe),n=M(OYe),o=M(Ap),r=$t(),i=me.isMac(),a=()=>{if(n&&n.length>0){const l=e();if(l.length>0){const s={name:"Paste to Point",timestamp:Date.now(),pastedElements:l.map(c=>({...c})),undo:()=>{for(const c of s.pastedElements)o(c.id,!1)},redo:()=>{t(c=>{c.elements.push(...s.pastedElements),c.selectedElement=s.pastedElements[0],c.updateElementOnRoofFlag=!0})}};M.getState().addUndoable(s)}}};return h.jsxs(an,{onClick:a,children:[Y.t("word.Paste",r),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",i?"⌘":"Ctrl","+V)"]})]})},Fd=()=>{const t=M(pn),e=M(BYe),n=M(oa),o=$t(),r=me.isMac(),i=()=>{const a=M.getState().selectedElement;a&&(e(a.id),n&&t(l=>{l.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:a.id,elementType:a.type}}))};return h.jsxs(an,{onClick:i,children:[Y.t("word.Copy",o),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",r?"⌘":"Ctrl","+C)"]})]})},kd=()=>{const t=M(pn),e=M(Ap),n=me.isMac(),o=$t(),r=()=>{const i=M.getState().selectedElement;if(!(!i||i.type===z.Roof))if(i.locked)gn(Y.t("message.ThisElementIsLocked",o));else{const a=e(i.id,!0);if(a.length===0)return;if(me.isElementTriggerAutoDeletion(a[0]))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",i.id);else{const l={name:"Cut",timestamp:Date.now(),deletedElements:a,selectedElementId:i.id,undo:()=>{const s=l.deletedElements;if(s.length===0)return;const c=s.find(u=>u.id===l.selectedElementId);c&&t(u=>{for(const d of s)u.elements.push(d);if(c.type===z.Wall){const d=c;let f=null,p=null;if(d.leftJoints.length>0&&(f=d.leftJoints[0]),d.rightJoints.length>0&&(p=d.rightJoints[0]),f||p)for(const g of u.elements)g.id===f&&g.type===z.Wall&&(g.rightJoints[0]=d.id),g.id===p&&g.type===z.Wall&&(g.leftJoints[0]=d.id)}})},redo:()=>{l.deletedElements&&l.deletedElements.length>0&&e(l.deletedElements[0].id,!0)}};M.getState().addUndoable(l)}}};return h.jsxs(an,{onClick:r,children:[Y.t("word.Cut",o),h.jsxs("span",{style:{paddingLeft:"4px",fontSize:9},children:["(",n?"⌘":"Ctrl","+X)"]})]})},Ku=({selectedElement:t})=>{const e=$t(),n=M(Ywt),o=M(En),r=a=>{t&&n(t.id,a)},i=a=>{const l=a.target.checked,s={name:"Lock",timestamp:Date.now(),checked:l,selectedElementId:t==null?void 0:t.id,selectedElementType:t==null?void 0:t.type,undo:()=>{r(!s.checked)},redo:()=>{r(s.checked)}};o(s),r(l)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.locked,onChange:i,children:Y.t("word.Lock",e)})})},an=({stayAfterClick:t,noPadding:e,fontWeight:n,textSelectable:o=!0,update:r,onClick:i,children:a})=>{const l=s=>{i&&i(s),t&&s.stopPropagation(),r&&dt.getState().updateContextMenu()};return h.jsx("span",{onClick:l,style:{userSelect:o?"auto":"none",display:"inline-block",fontWeight:n,width:"100%",paddingLeft:e?"0px":"24px"},children:a})},eo=({Dialog:t,noPadding:e,children:n})=>{const[o,r]=m.useState(!1),i=()=>{M.getState().setApplyCount(0),r(!0)};return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:e,onClick:i,children:n}),o&&h.jsx(t,{setDialogVisible:r})]})},LQe=({groupableElement:t})=>{const e=$t(),n=()=>{M.getState().set(r=>{for(const i of r.elements)if(i.id===t.id&&Ad(i)){i.enableGroupMaster=!i.enableGroupMaster;break}r.groupActionUpdateFlag=!r.groupActionUpdateFlag})},o=r=>{const i={name:"Group Master",timestamp:Date.now(),checked:r.target.checked,selectedElementId:t.id,selectedElementType:t.type,undo:()=>n(),redo:()=>n()};M.getState().addUndoable(i),n()};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.enableGroupMaster,onChange:o,children:Y.t("foundationMenu.GroupMaster",e)})})},wX=({element:t,inside:e,children:n})=>{const o=M.getState().updateInsideLightsByParentId,r=()=>{const i=new Map;for(const l of M.getState().elements)l.parentId===t.id&&l.type===z.Light&&i.set(l.id,l.inside);o(t.id,e);const a={name:e?`Set All Lights on ${t.type} Inside`:`Set All Lights on ${t.type} Outside`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[l,s]of a.oldValues.entries())M.getState().updateInsideLightById(l,s)},redo:()=>{o(t.id,e)}};M.getState().addUndoable(a)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:r,children:n})},a2e=({solarCollector:t})=>{const e=M.getState().updateSolarCollectorDrawSunBeamById,n=$t(),o=r=>{const i={name:"Show Sun Beam",timestamp:Date.now(),checked:!t.drawSunBeam,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{e(t.id,!i.checked)},redo:()=>{e(t.id,i.checked)}};M.getState().addUndoable(i),e(t.id,r)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.drawSunBeam,onChange:r=>o(r.target.checked),children:Y.t("solarCollectorMenu.DrawSunBeam",n)})})},yw=({checked:t,onClick:e,children:n})=>h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onClick:e,children:n})}),kC=({min:t,max:e,value:n,onChange:o,children:r})=>h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[r,h.jsx(Iu,{min:t,max:e,tooltip:{open:!1},defaultValue:n,onChange:o})]}),lh=({children:t})=>h.jsx("span",{style:{paddingLeft:"2px",fontSize:9},children:t}),f2=({selector:t,onChange:e,children:n})=>{const o=M(t);return h.jsx(an,{noPadding:!0,stayAfterClick:!0,children:h.jsx(Li,{style:{width:"100%"},checked:o,onChange:e,children:n})})},cae=({selector:t,onChange:e,children:n})=>{const o=M(t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:n}),h.jsx(vc,{checked:o,onChange:e})]})},WQe="/aladdin/assets/map_residential_building-BlM-FtN4.png",NQe="/aladdin/assets/map_commercial_building-DgYY52Jp.png",UQe="/aladdin/assets/map_school_building-B4f7IMQ-.png",jQe="/aladdin/assets/map_tourist_attraction-qR1MEaG5.png",BQe="/aladdin/assets/map_solar_panel-DyfTsHia.png",YQe="/aladdin/assets/map_parabolic_dish-C1NBHVgm.png",OQe="/aladdin/assets/map_parabolic_trough-CCcc-zs6.png",VQe="/aladdin/assets/map_fresnel_reflector-Bzw0EMA6.png",_Qe="/aladdin/assets/map_heliostat-BXje3i1H.png",GQe="/aladdin/assets/map_under_construction-fpLVLcIy.png",XQe="/aladdin/assets/map_marker-C9GhGDY6.png",JQe="/aladdin/assets/map_wind_turbine-Bw5iob8S.png",KQe="/aladdin/assets/map_colocation_projects-PrxUC05F.png";var OQ={exports:{}},qQe={};function $Qe(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const n=(t=window.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.style;if(!n||e in n)return"";for(let o=0;oe===n.identifier)||t.changedTouches&&(0,Tg.findInArray)(t.changedTouches,n=>e===n.identifier)}function MNn(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}function INn(t){if(!t)return;let e=t.getElementById("react-draggable-style-el");e||(e=t.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&nZe(t.body,"react-draggable-transparent-selection")}function zNn(t){if(t)try{if(t.body&&oZe(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function nZe(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function oZe(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var w3={};Object.defineProperty(w3,"__esModule",{value:!0});w3.canDragX=FNn;w3.canDragY=kNn;w3.createCoreData=WNn;w3.createDraggableData=NNn;w3.getBoundPosition=DNn;w3.getControlPosition=LNn;w3.snapToGrid=ENn;var X1=A3,sC=y0;function DNn(t,e,n){if(!t.props.bounds)return[e,n];let{bounds:o}=t.props;o=typeof o=="string"?o:UNn(o);const r=s2e(t);if(typeof o=="string"){const{ownerDocument:i}=r,a=i.defaultView;let l;if(o==="parent"?l=r.parentNode:l=i.querySelector(o),!(l instanceof a.HTMLElement))throw new Error('Bounds selector "'+o+'" could not find an element.');const s=l,c=a.getComputedStyle(r),u=a.getComputedStyle(s);o={left:-r.offsetLeft+(0,X1.int)(u.paddingLeft)+(0,X1.int)(c.marginLeft),top:-r.offsetTop+(0,X1.int)(u.paddingTop)+(0,X1.int)(c.marginTop),right:(0,sC.innerWidth)(s)-(0,sC.outerWidth)(r)-r.offsetLeft+(0,X1.int)(u.paddingRight)-(0,X1.int)(c.marginRight),bottom:(0,sC.innerHeight)(s)-(0,sC.outerHeight)(r)-r.offsetTop+(0,X1.int)(u.paddingBottom)-(0,X1.int)(c.marginBottom)}}return(0,X1.isNum)(o.right)&&(e=Math.min(e,o.right)),(0,X1.isNum)(o.bottom)&&(n=Math.min(n,o.bottom)),(0,X1.isNum)(o.left)&&(e=Math.max(e,o.left)),(0,X1.isNum)(o.top)&&(n=Math.max(n,o.top)),[e,n]}function ENn(t,e,n){const o=Math.round(e/t[0])*t[0],r=Math.round(n/t[1])*t[1];return[o,r]}function FNn(t){return t.props.axis==="both"||t.props.axis==="x"}function kNn(t){return t.props.axis==="both"||t.props.axis==="y"}function LNn(t,e,n){const o=typeof e=="number"?(0,sC.getTouch)(t,e):null;if(typeof e=="number"&&!o)return null;const r=s2e(n),i=n.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,sC.offsetXYFromParent)(o||t,i,n.props.scale)}function WNn(t,e,n){const o=!(0,X1.isNum)(t.lastX),r=s2e(t);return o?{node:r,deltaX:0,deltaY:0,lastX:e,lastY:n,x:e,y:n}:{node:r,deltaX:e-t.lastX,deltaY:n-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:n}}function NNn(t,e){const n=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/n,y:t.state.y+e.deltaY/n,deltaX:e.deltaX/n,deltaY:e.deltaY/n,lastX:t.state.x,lastY:t.state.y}}function UNn(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function s2e(t){const e=t.findDOMNode();if(!e)throw new Error(": Unmounted during event!");return e}var VQ={},_Q={};Object.defineProperty(_Q,"__esModule",{value:!0});_Q.default=jNn;function jNn(){}Object.defineProperty(VQ,"__esModule",{value:!0});VQ.default=void 0;var dae=YNn(m),Dp=c2e(Bq),BNn=c2e(Hd),Gf=y0,I4=w3,fae=A3,$z=c2e(_Q);function c2e(t){return t&&t.__esModule?t:{default:t}}function rZe(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(rZe=function(o){return o?n:e})(t)}function YNn(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=rZe(e);if(n&&n.has(t))return n.get(t);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=r?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=t[i]}return o.default=t,n&&n.set(t,o),o}function Gh(t,e,n){return e=ONn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ONn(t){var e=VNn(t,"string");return typeof e=="symbol"?e:String(e)}function VNn(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const e2={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let z4=e2.mouse,GQ=class extends dae.Component{constructor(){super(...arguments),Gh(this,"dragging",!1),Gh(this,"lastX",NaN),Gh(this,"lastY",NaN),Gh(this,"touchIdentifier",null),Gh(this,"mounted",!1),Gh(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error(" not mounted on DragStart!");const{ownerDocument:o}=n;if(this.props.disabled||!(e.target instanceof o.defaultView.Node)||this.props.handle&&!(0,Gf.matchesSelectorAndParentsTo)(e.target,this.props.handle,n)||this.props.cancel&&(0,Gf.matchesSelectorAndParentsTo)(e.target,this.props.cancel,n))return;e.type==="touchstart"&&e.preventDefault();const r=(0,Gf.getTouchIdentifier)(e);this.touchIdentifier=r;const i=(0,I4.getControlPosition)(e,r,this);if(i==null)return;const{x:a,y:l}=i,s=(0,I4.createCoreData)(this,a,l);(0,$z.default)("DraggableCore: handleDragStart: %j",s),(0,$z.default)("calling",this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Gf.addUserSelectStyles)(o),this.dragging=!0,this.lastX=a,this.lastY=l,(0,Gf.addEvent)(o,z4.move,this.handleDrag),(0,Gf.addEvent)(o,z4.stop,this.handleDragStop))}),Gh(this,"handleDrag",e=>{const n=(0,I4.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:o,y:r}=n;if(Array.isArray(this.props.grid)){let l=o-this.lastX,s=r-this.lastY;if([l,s]=(0,I4.snapToGrid)(this.props.grid,l,s),!l&&!s)return;o=this.lastX+l,r=this.lastY+s}const i=(0,I4.createCoreData)(this,o,r);if((0,$z.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const s=document.createEvent("MouseEvents");s.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(s)}return}this.lastX=o,this.lastY=r}),Gh(this,"handleDragStop",e=>{if(!this.dragging)return;const n=(0,I4.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:o,y:r}=n;if(Array.isArray(this.props.grid)){let s=o-this.lastX||0,c=r-this.lastY||0;[s,c]=(0,I4.snapToGrid)(this.props.grid,s,c),o=this.lastX+s,r=this.lastY+c}const i=(0,I4.createCoreData)(this,o,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Gf.removeUserSelectStyles)(l.ownerDocument),(0,$z.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,$z.default)("DraggableCore: Removing handlers"),(0,Gf.removeEvent)(l.ownerDocument,z4.move,this.handleDrag),(0,Gf.removeEvent)(l.ownerDocument,z4.stop,this.handleDragStop))}),Gh(this,"onMouseDown",e=>(z4=e2.mouse,this.handleDragStart(e))),Gh(this,"onMouseUp",e=>(z4=e2.mouse,this.handleDragStop(e))),Gh(this,"onTouchStart",e=>(z4=e2.touch,this.handleDragStart(e))),Gh(this,"onTouchEnd",e=>(z4=e2.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,Gf.addEvent)(e,e2.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:n}=e;(0,Gf.removeEvent)(n,e2.mouse.move,this.handleDrag),(0,Gf.removeEvent)(n,e2.touch.move,this.handleDrag),(0,Gf.removeEvent)(n,e2.mouse.stop,this.handleDragStop),(0,Gf.removeEvent)(n,e2.touch.stop,this.handleDragStop),(0,Gf.removeEvent)(e,e2.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Gf.removeUserSelectStyles)(n)}}findDOMNode(){var e,n;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:BNn.default.findDOMNode(this)}render(){return dae.cloneElement(dae.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};VQ.default=GQ;Gh(GQ,"displayName","DraggableCore");Gh(GQ,"propTypes",{allowAnyClick:Dp.default.bool,children:Dp.default.node.isRequired,disabled:Dp.default.bool,enableUserSelectHack:Dp.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Dp.default.arrayOf(Dp.default.number),handle:Dp.default.string,cancel:Dp.default.string,nodeRef:Dp.default.object,onStart:Dp.default.func,onDrag:Dp.default.func,onStop:Dp.default.func,onMouseDown:Dp.default.func,scale:Dp.default.number,className:fae.dontSetMe,style:fae.dontSetMe,transform:fae.dontSetMe});Gh(GQ,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return s.default}}),t.default=void 0;var e=f(m),n=u(Bq),o=u(Hd),r=u(cNn),i=y0,a=w3,l=A3,s=u(VQ),c=u(_Q);function u(C){return C&&C.__esModule?C:{default:C}}function d(C){if(typeof WeakMap!="function")return null;var P=new WeakMap,v=new WeakMap;return(d=function(T){return T?v:P})(C)}function f(C,P){if(C&&C.__esModule)return C;if(C===null||typeof C!="object"&&typeof C!="function")return{default:C};var v=d(P);if(v&&v.has(C))return v.get(C);var T={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in C)if(x!=="default"&&Object.prototype.hasOwnProperty.call(C,x)){var b=w?Object.getOwnPropertyDescriptor(C,x):null;b&&(b.get||b.set)?Object.defineProperty(T,x,b):T[x]=C[x]}return T.default=C,v&&v.set(C,T),T}function p(){return p=Object.assign?Object.assign.bind():function(C){for(var P=1;P{if((0,c.default)("Draggable: onDragStart: %j",T),this.props.onStart(v,(0,a.createDraggableData)(this,T))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(v,T)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",T);const w=(0,a.createDraggableData)(this,T),x={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:R,y:H}=x;x.x+=this.state.slackX,x.y+=this.state.slackY;const[F,E]=(0,a.getBoundPosition)(this,x.x,x.y);x.x=F,x.y=E,x.slackX=this.state.slackX+(R-x.x),x.slackY=this.state.slackY+(H-x.y),w.x=x.x,w.y=x.y,w.deltaX=x.x-this.state.x,w.deltaY=x.y-this.state.y}if(this.props.onDrag(v,w)===!1)return!1;this.setState(x)}),g(this,"onDragStop",(v,T)=>{if(!this.state.dragging||this.props.onStop(v,(0,a.createDraggableData)(this,T))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",T);const x={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:R,y:H}=this.props.position;x.x=R,x.y=H}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:P.position?P.position.x:P.defaultPosition.x,y:P.position?P.position.y:P.defaultPosition.y,prevPropsPosition:{...P.position},slackX:0,slackY:0,isElementSVG:!1},P.position&&!(P.onDrag||P.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var P,v;return(P=(v=this.props)===null||v===void 0||(v=v.nodeRef)===null||v===void 0?void 0:v.current)!==null&&P!==void 0?P:o.default.findDOMNode(this)}render(){const{axis:P,bounds:v,children:T,defaultPosition:w,defaultClassName:x,defaultClassNameDragging:b,defaultClassNameDragged:R,position:H,positionOffset:F,scale:E,...N}=this.props;let U={},W=null;const D=!!!H||this.state.dragging,L=H||w,j={x:(0,a.canDragX)(this)&&D?this.state.x:L.x,y:(0,a.canDragY)(this)&&D?this.state.y:L.y};this.state.isElementSVG?W=(0,i.createSVGTransform)(j,F):U=(0,i.createCSSTransform)(j,F);const B=(0,r.default)(T.props.className||"",x,{[b]:this.state.dragging,[R]:this.state.dragged});return e.createElement(s.default,p({},N,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(T),{className:B,style:{...T.props.style,...U},transform:W}))}}t.default=S,g(S,"displayName","Draggable"),g(S,"propTypes",{...s.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),g(S,"defaultProps",{...s.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(qQe);const{default:iZe,DraggableCore:_Nn}=qQe;OQ.exports=iZe;OQ.exports.default=iZe;OQ.exports.DraggableCore=_Nn;var GNn=OQ.exports;const Bi=Wi(GNn),iPe=t=>{t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296};let XNn=class{constructor(e){this.dictionaries=void 0,this.length=void 0,this.separator=void 0,this.style=void 0,this.seed=void 0;const{length:n,separator:o,dictionaries:r,style:i,seed:a}=e;this.dictionaries=r,this.separator=o,this.length=n,this.style=i,this.seed=a}generate(){if(!this.dictionaries)throw new Error('Cannot find any dictionary. Please provide at least one, or leave the "dictionary" field empty in the config object');if(this.length<=0)throw new Error("Invalid length provided");if(this.length>this.dictionaries.length)throw new Error(`The length cannot be bigger than the number of dictionaries. -Length provided: ${this.length}. Number of dictionaries provided: ${this.dictionaries.length}`);let e=this.seed;return this.dictionaries.slice(0,this.length).reduce((n,o)=>{let r;e?(r=(a=>{if(typeof a=="string"){const l=a.split("").map(c=>c.charCodeAt(0)).reduce((c,u)=>c+u,1),s=Math.floor(Number(l));return iPe(s)}return iPe(a)})(e),e=4294967296*r):r=Math.random();let i=o[Math.floor(r*o.length)]||"";if(this.style==="lowerCase")i=i.toLowerCase();else if(this.style==="capital"){const[a,...l]=i.split("");i=a.toUpperCase()+l.join("")}else this.style==="upperCase"&&(i=i.toUpperCase());return n?`${n}${this.separator}${i}`:`${i}`},"")}};const aPe={separator:"_",dictionaries:[]},JNn=t=>{const e=[...t&&t.dictionaries||aPe.dictionaries],n={...aPe,...t,length:t&&t.length||e.length,dictionaries:e};if(!t||!t.dictionaries||!t.dictionaries.length)throw new Error('A "dictionaries" array must be provided. This is a breaking change introduced starting from Unique Name Generator v4. Read more about the breaking change here: https://github.com/andreasonny83/unique-names-generator#migration-guide');return new XNn(n).generate()};var KNn=["aardvark","aardwolf","albatross","alligator","alpaca","amphibian","anaconda","angelfish","anglerfish","ant","anteater","antelope","antlion","ape","aphid","armadillo","asp","baboon","badger","bandicoot","barnacle","barracuda","basilisk","bass","bat","bear","beaver","bedbug","bee","beetle","bird","bison","blackbird","boa","boar","bobcat","bobolink","bonobo","booby","bovid","bug","butterfly","buzzard","camel","canid","canidae","capybara","cardinal","caribou","carp","cat","caterpillar","catfish","catshark","cattle","centipede","cephalopod","chameleon","cheetah","chickadee","chicken","chimpanzee","chinchilla","chipmunk","cicada","clam","clownfish","cobra","cockroach","cod","condor","constrictor","coral","cougar","cow","coyote","crab","crane","crawdad","crayfish","cricket","crocodile","crow","cuckoo","damselfly","deer","dingo","dinosaur","dog","dolphin","donkey","dormouse","dove","dragon","dragonfly","duck","eagle","earthworm","earwig","echidna","eel","egret","elephant","elk","emu","ermine","falcon","felidae","ferret","finch","firefly","fish","flamingo","flea","fly","flyingfish","fowl","fox","frog","galliform","gamefowl","gayal","gazelle","gecko","gerbil","gibbon","giraffe","goat","goldfish","goose","gopher","gorilla","grasshopper","grouse","guan","guanaco","guineafowl","gull","guppy","haddock","halibut","hamster","hare","harrier","hawk","hedgehog","heron","herring","hippopotamus","hookworm","hornet","horse","hoverfly","hummingbird","hyena","iguana","impala","jackal","jaguar","jay","jellyfish","junglefowl","kangaroo","kingfisher","kite","kiwi","koala","koi","krill","ladybug","lamprey","landfowl","lark","leech","lemming","lemur","leopard","leopon","limpet","lion","lizard","llama","lobster","locust","loon","louse","lungfish","lynx","macaw","mackerel","magpie","mammal","manatee","mandrill","marlin","marmoset","marmot","marsupial","marten","mastodon","meadowlark","meerkat","mink","minnow","mite","mockingbird","mole","mollusk","mongoose","monkey","moose","mosquito","moth","mouse","mule","muskox","narwhal","newt","nightingale","ocelot","octopus","opossum","orangutan","orca","ostrich","otter","owl","ox","panda","panther","parakeet","parrot","parrotfish","partridge","peacock","peafowl","pelican","penguin","perch","pheasant","pig","pigeon","pike","pinniped","piranha","planarian","platypus","pony","porcupine","porpoise","possum","prawn","primate","ptarmigan","puffin","puma","python","quail","quelea","quokka","rabbit","raccoon","rat","rattlesnake","raven","reindeer","reptile","rhinoceros","roadrunner","rodent","rook","rooster","roundworm","sailfish","salamander","salmon","sawfish","scallop","scorpion","seahorse","shark","sheep","shrew","shrimp","silkworm","silverfish","skink","skunk","sloth","slug","smelt","snail","snake","snipe","sole","sparrow","spider","spoonbill","squid","squirrel","starfish","stingray","stoat","stork","sturgeon","swallow","swan","swift","swordfish","swordtail","tahr","takin","tapir","tarantula","tarsier","termite","tern","thrush","tick","tiger","tiglon","toad","tortoise","toucan","trout","tuna","turkey","turtle","tyrannosaurus","unicorn","urial","vicuna","viper","vole","vulture","wallaby","walrus","warbler","wasp","weasel","whale","whippet","whitefish","wildcat","wildebeest","wildfowl","wolf","wolverine","wombat","woodpecker","worm","wren","xerinae","yak","zebra"],qNn=["amaranth","amber","amethyst","apricot","aqua","aquamarine","azure","beige","black","blue","blush","bronze","brown","chocolate","coffee","copper","coral","crimson","cyan","emerald","fuchsia","gold","gray","green","harlequin","indigo","ivory","jade","lavender","lime","magenta","maroon","moccasin","olive","orange","peach","pink","plum","purple","red","rose","salmon","sapphire","scarlet","silver","tan","teal","tomato","turquoise","violet","white","yellow"];const{Option:W1}=Uo,$Nn=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),[r,i]=m.useState(M.getState().modelType),[a,l]=m.useState(M.getState().modelAuthor??JNn({dictionaries:[qNn,KNn],separator:" ",style:"capital"})),[s,c]=m.useState(M.getState().modelLabel??M.getState().cloudFile??null),[u,d]=m.useState(M.getState().modelDescription),[f,p]=m.useState(!1),[g,A]=m.useState({left:0,top:0,bottom:0,right:0}),y=m.useRef(null),S=m.useRef(null),{TextArea:C}=jl,P={lng:o};m.useEffect(()=>{var b;(b=S.current)==null||b.focus()},[]);const v=(b,R)=>{if(y.current){const{clientWidth:H,clientHeight:F}=window.document.documentElement,E=y.current.getBoundingClientRect();A({left:-E.left+R.x,right:H-(E.right-R.x),top:-E.top+R.y,bottom:F-((E==null?void 0:E.bottom)-R.y)})}},T=()=>{t(!1)},w=()=>{dt.getState().set(b=>{b.publishOnModelsMapFlag=!0}),e(b=>{b.modelType=r,b.modelAuthor=a,b.modelLabel=s,b.modelDescription=u}),dt.getState().setChanged(!0),n&&e(b=>{b.actionInfo={name:"Publish on Map of Models",timestamp:new Date().getTime()}}),t(!1)},{t:x}=Xl();return h.jsxs(yi,{width:560,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:x("menu.file.PublishOnModelsMap",P)}),footer:[h.jsx(io,{onClick:T,children:x("word.Cancel",P)},"Cancel"),h.jsx(io,{type:"primary",ref:S,onClick:w,disabled:!a||!s,children:x("word.OK",P)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:b=>h.jsx(Bi,{disabled:!f,bounds:g,onStart:(R,H)=>v(R,H),children:h.jsx("div",{ref:y,children:b})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,children:x("shared.ModelType",P)+":"}),h.jsx(Ke,{span:16,children:h.jsxs(Uo,{style:{width:"100%"},value:r,onChange:b=>{i(b)},children:[h.jsxs(W1,{value:fa.UNKNOWN,children:[h.jsx("img",{alt:"Building",width:24,src:XQe,style:{marginRight:"8px"}}),x("word.Unknown",P)]},fa.UNKNOWN),h.jsxs(W1,{value:fa.UNDER_CONSTRUCTION,children:[h.jsx("img",{alt:"Building",width:24,src:GQe,style:{marginRight:"8px"}}),x("word.UnderConstruction",P)]},fa.UNDER_CONSTRUCTION),h.jsxs(W1,{value:fa.RESIDENTIAL_BUILDING,children:[h.jsx("img",{alt:"Residential Building",width:24,src:WQe,style:{marginRight:"8px"}}),x("word.ResidentialBuilding",P)]},fa.RESIDENTIAL_BUILDING),h.jsxs(W1,{value:fa.COMMERCIAL_BUILDING,children:[h.jsx("img",{alt:"Commercial Building",width:24,src:NQe,style:{marginRight:"8px"}}),x("word.CommercialBuilding",P)]},fa.COMMERCIAL_BUILDING),h.jsxs(W1,{value:fa.SCHOOL_BUILDING,children:[h.jsx("img",{alt:"School Building",width:24,src:UQe,style:{marginRight:"8px"}}),x("word.SchoolBuilding",P)]},fa.SCHOOL_BUILDING),h.jsxs(W1,{value:fa.TOURIST_ATTRACTION,children:[h.jsx("img",{alt:"Tourist Attraction",width:24,src:jQe,style:{marginRight:"8px"}}),x("word.TouristAttraction",P)]},fa.TOURIST_ATTRACTION),h.jsxs(W1,{value:fa.PHOTOVOLTAIC,children:[h.jsx("img",{alt:"Photovoltaic",width:24,src:BQe,style:{marginRight:"8px"}}),x("word.Photovoltaic",P)]},fa.PHOTOVOLTAIC),h.jsxs(W1,{value:fa.PARABOLIC_DISH,children:[h.jsx("img",{alt:"Parabolic Dish",width:24,src:YQe,style:{marginRight:"8px"}}),x("shared.ParabolicDishElement",P)]},fa.PARABOLIC_DISH),h.jsxs(W1,{value:fa.PARABOLIC_TROUGH,children:[h.jsx("img",{alt:"Parabolic Trough",width:24,src:OQe,style:{marginRight:"8px"}}),x("shared.ParabolicTroughElement",P)]},fa.PARABOLIC_TROUGH),h.jsxs(W1,{value:fa.FRESNEL_REFLECTOR,children:[h.jsx("img",{alt:"Fresnel Reflector",width:24,src:VQe,style:{marginRight:"8px"}}),x("shared.FresnelReflectorElement",P)]},fa.FRESNEL_REFLECTOR),h.jsxs(W1,{value:fa.SOLAR_POWER_TOWER,children:[h.jsx("img",{alt:"Heliostat",width:24,src:_Qe,style:{marginRight:"8px"}}),x("shared.HeliostatElement",P)]},fa.SOLAR_POWER_TOWER),h.jsxs(W1,{value:fa.WIND_TURBINE,children:[h.jsx("img",{alt:"Wind Turbine",width:24,src:JQe,style:{marginRight:"8px"}}),Y.t("word.WindPower",P)]},fa.WIND_TURBINE),h.jsxs(W1,{value:fa.COLOCATION_PROJECTS,children:[h.jsx("img",{alt:"Colocation Projects",width:24,src:KQe,style:{marginRight:"8px"}}),Y.t("word.ColocationProjects",P)]},fa.COLOCATION_PROJECTS)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Publisher",P),":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:30,style:{width:"100%"},value:a??"",onKeyDown:b=>{if(!cR.test(b.key))return b.preventDefault(),!1},onChange:b=>{l(b.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Label",P),":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:50,style:{width:"100%"},value:s??"",onKeyDown:b=>{if(!cR.test(b.key))return b.preventDefault(),!1},onChange:b=>{c(b.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Description",P),":",h.jsx("br",{}),h.jsxs("span",{style:{fontSize:"10px"},children:["(",x("word.MaximumCharacters",P),": 200)"]})]}),h.jsx(Ke,{span:16,children:h.jsx(C,{rows:5,maxLength:200,style:{width:"100%"},value:u??"",onChange:b=>{d(b.target.value)}})})]})]})},QNn=be.memo(()=>{const t=$t(),e=M(yp),n=M(zb),[o,r]=m.useState(!1),i=()=>{const a=new URLSearchParams(window.location.search).get("userid"),l=a===e.uid;e.uid&&n&&l?r(!0):e.uid?gn(a&&!l?Y.t("menu.file.YouCannotPublishAModelThatYouDoNotOwn",t)+".":Y.t("menu.file.YouMustSaveModelOnCloudBeforePublishingIt",t)+"."):gn(Y.t("menu.file.YouMustLogInToPublishYourModel",t)+".")};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t("menu.file.PublishOnModelsMap",t),"..."]}),o&&h.jsx($Nn,{setDialogVisible:r})]})}),ZNn=(t,e,n)=>{const o={lng:M.getState().language},r=M.getState().user,i=M.getState().cloudFile,a=M.getState().undoManager,l=M.getState().loggable,s=M.getState().set,c=()=>{a.clear(),dt.getState().set(S=>{S.createNewFileFlag=!0,S.openModelsMap=!1}),s(S=>{S.objectTypeToAdd=z.None,S.groupActionMode=!1,window.history.pushState({},document.title,t1),l&&(S.actionInfo={name:"Create New File",timestamp:new Date().getTime()})})},u=()=>{a.clear(),dt.getState().set(S=>{S.openLocalFileFlag=!0,S.openModelsMap=!1}),s(S=>{S.objectTypeToAdd=z.None,S.groupActionMode=!1,S.cloudFile=void 0,window.history.pushState({},document.title,t1),l&&(S.actionInfo={name:"Open Local File",timestamp:new Date().getTime()})})},d=()=>{dt.getState().set(S=>{S.saveLocalFileDialogVisible=!0}),l&&s(S=>{S.actionInfo={name:"Save as Local File",timestamp:new Date().getTime()}})},f=()=>{dt.getState().set(S=>{S.listCloudFilesFlag=!0,S.openModelsMap=!1}),s(S=>{S.selectedFloatingWindow="cloudFilePanel"}),l&&s(S=>{S.actionInfo={name:"List Cloud Files",timestamp:new Date().getTime()}})},p=()=>{dt.getState().setSaveCloudFileFlag(!0),l&&s(S=>{S.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}})},g=()=>{s(S=>{S.showCloudFileTitleDialogFlag=!S.showCloudFileTitleDialogFlag,S.showCloudFileTitleDialog=!0,l&&(S.actionInfo={name:"Save as Cloud File",timestamp:new Date().getTime()})})},A=()=>{n&&(NQt("screenshot.png",n.toDataURL("image/png")),l&&s(S=>{S.actionInfo={name:"Take Screenshot",timestamp:new Date().getTime()}}),dt.getState().set(S=>{S.openModelsMap=!1}))},y=[];return t||y.push({key:"create-new-file",label:h.jsxs(an,{noPadding:!0,onClick:c,children:[Y.t("menu.file.CreateNewFile",o),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+F)"]})]})}),t||y.push({key:"open-local-file",label:h.jsxs(an,{noPadding:!0,onClick:u,children:[Y.t("menu.file.OpenLocalFile",o),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+O)"]}),"..."]})}),y.push({key:"save-local-file",label:h.jsxs(an,{noPadding:!0,onClick:d,children:[Y.t("menu.file.SaveAsLocalFile",o),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+S)"]}),"..."]})}),r.uid&&!t&&y.push({key:"open-cloud-file",label:h.jsxs(an,{noPadding:!0,onClick:f,children:[Y.t("menu.file.OpenCloudFile",o),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+Shift+O)"]}),"..."]})}),r.uid&&i&&!t&&y.push({key:"save-cloud-file",label:h.jsxs(an,{noPadding:!0,onClick:p,children:[Y.t("menu.file.SaveCloudFile",o),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+Shift+S)"]}),"..."]})}),r.uid&&!t&&y.push({key:"save-as-cloud-file",label:h.jsx(an,{noPadding:!0,onClick:g,children:Y.t("menu.file.SaveAsCloudFile",o)})}),t||y.push({key:"publish-on-model-map",label:h.jsx(QNn,{})}),y.push({key:"take-screen-shot",label:h.jsx(an,{noPadding:!0,onClick:A,children:Y.t("menu.file.TakeScreenshot",o)})}),y},{Option:eUn}=Uo,aZe=be.memo(({saveAs:t,setDialogVisible:e})=>{const n=M(pn),o=M(oa),[r,i]=m.useState(M.getState().projectState.type??Ri.SOLAR_PANEL_ARRAY),[a,l]=m.useState(M.getState().projectState.title),[s,c]=m.useState(M.getState().projectState.description),[u,d]=m.useState(!1),[f,p]=m.useState({left:0,top:0,bottom:0,right:0}),g=m.useRef(null),{TextArea:A}=jl,y=$t(),S=(v,T)=>{if(g.current){const{clientWidth:w,clientHeight:x}=window.document.documentElement,b=g.current.getBoundingClientRect();p({left:-b.left+T.x,right:w-(b.right-T.x),top:-b.top+T.y,bottom:x-((b==null?void 0:b.bottom)-T.y)})}},C=()=>{e(!1)},P=()=>{dt.getState().set(v=>{t?v.saveProjectAsFlag=!0:v.createProjectFlag=!0}),dt.getState().set(v=>{v.projectType=r,v.projectTitle=a,v.projectDescription=s}),o&&n(v=>{v.actionInfo={name:t?"Save Project as":"Create New Project",timestamp:new Date().getTime(),details:{type:r,title:a,description:s}}}),e(!1)};return h.jsxs(yi,{width:560,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>d(!0),onMouseOut:()=>d(!1),children:`${Y.t(t?"menu.project.SaveProjectAs":"menu.project.CreateNewProject",y)}`}),footer:[h.jsx(io,{onClick:C,children:`${Y.t("word.Cancel",y)}`},"Cancel"),h.jsx(io,{type:"primary",onClick:P,disabled:!a,children:`${Y.t("word.OK",y)}`},"OK")],onCancel:()=>{e(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:v=>h.jsx(Bi,{disabled:!u,bounds:f,onStart:(T,w)=>S(T,w),children:h.jsx("div",{ref:g,children:v})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,children:Y.t("projectPanel.ProjectType",y)+":"}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{disabled:t,style:{width:"100%"},value:r,onChange:v=>{i(v)},children:h.jsx(eUn,{value:Ri.SOLAR_PANEL_ARRAY,children:`${Y.t("projectPanel.SolarPanelArray",y)}`},Ri.SOLAR_PANEL_ARRAY)})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[`${Y.t("word.Title",y)}`,":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:50,style:{width:"100%"},value:a??"",onKeyDown:v=>{if(!cR.test(v.key))return v.preventDefault(),!1},onChange:v=>{l(v.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[`${Y.t("word.Description",y)}`,":",h.jsx("br",{}),h.jsxs("span",{style:{fontSize:"10px"},children:["(",`${Y.t("word.MaximumCharacters",y)}`,": 200)"]})]}),h.jsx(Ke,{span:16,children:h.jsx(A,{rows:5,maxLength:200,style:{width:"100%"},value:s??"",onChange:v=>{c(v.target.value)}})})]})]})}),tUn=()=>{const[t,e]=m.useState(!1),n=$t(),o=()=>{if(!M.getState().user.uid){gn(Y.t("menu.project.YouMustLogInToCreateProject",n)+".");return}e(!0),dt.getState().set(r=>{r.openModelsMap=!1})};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:o,children:[Y.t("menu.project.CreateNewProject",n),"..."]}),t&&h.jsx(aZe,{saveAs:!1,setDialogVisible:e})]})},nUn=()=>{const[t,e]=m.useState(!1),n=$t(),o=()=>{e(!0),dt.getState().set(r=>{r.openModelsMap=!1})};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:o,children:[Y.t("menu.project.SaveProjectAs",n),"..."]}),t&&h.jsx(aZe,{saveAs:!0,setDialogVisible:e})]})},oUn=()=>{const t={lng:M.getState().language},e=M.getState().user,n=M.getState().loggable,o=M.getState().projectState,r=M.getState().projectView,i=M.getState().set,a=()=>{if(!e.uid){gn(Y.t("menu.project.YouMustLogInToOpenProject",t)+".");return}dt.getState().set(s=>{s.showProjectsFlag=!0,s.openModelsMap=!1}),i(s=>{s.selectedFloatingWindow="projectListPanel"}),n&&i(s=>{s.actionInfo={name:"Open Project List",timestamp:new Date().getTime()}})},l=[];return l.push({key:"create-new-project",label:h.jsx(tUn,{})}),l.push({key:"list-project",label:h.jsxs(an,{noPadding:!0,onClick:a,children:[Y.t("menu.project.OpenProject",t),"..."]})}),r&&o.title&&e.uid&&l.push({key:"save-project-as",label:h.jsx(nUn,{})}),l},rUn=(t,e,n,o)=>{const r={lng:M.getState().language},i=M.getState().loggable,a=M.getState().set,l=()=>{t&&(M.getState().copyElementById(t.id),i&&a(p=>{p.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:t.id,elementType:t.type}}))},s=()=>{if(!(!t||t.type===z.Roof))if(t.locked)gn(Y.t("message.ThisElementIsLocked",r));else{const p=M.getState().removeElementById(t.id,!0);if(p.length===0)return;if(ye.isElementTriggerAutoDeletion(p[0]))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",t.id);else{const g={name:"Cut",timestamp:Date.now(),deletedElements:p,selectedElementId:t.id,undo:()=>{const A=g.deletedElements;if(A.length===0)return;const y=A.find(S=>S.id===g.selectedElementId);y&&a(S=>{for(const C of A)S.elements.push(C);if(y.type===z.Wall){const C=y;let P=null,v=null;if(C.leftJoints.length>0&&(P=C.leftJoints[0]),C.rightJoints.length>0&&(v=C.rightJoints[0]),P||v)for(const T of S.elements)T.id===P&&T.type===z.Wall&&(T.rightJoints[0]=C.id),T.id===v&&T.type===z.Wall&&(T.leftJoints[0]=C.id)}})},redo:()=>{g.deletedElements&&g.deletedElements.length>0&&M.getState().removeElementById(g.deletedElements[0].id,!0)}};M.getState().addUndoable(g)}}},c=()=>{const p=M.getState().elementsToPaste;if(p&&p.length>0){const g=M.getState().pasteElementsByKey();if(g.length>0){const A={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify(g)),undo:()=>{for(const y of A.pastedElements)M.getState().removeElementById(y.id,!1)},redo:()=>{a(y=>{y.elements.push(...A.pastedElements),y.selectedElement=A.pastedElements[0]})}};M.getState().addUndoable(A)}}},u=()=>{if(n.hasUndo()){const p=n.undo();p&&gn(Y.t("menu.edit.Undo",r)+": "+p,gG),i&&a(g=>{g.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}},d=()=>{if(n.hasRedo()){const p=n.redo();p&&gn(Y.t("menu.edit.Redo",r)+": "+p,gG),i&&a(g=>{g.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}},f=[];return t&&f.push({key:"cut",label:h.jsxs(an,{noPadding:!0,onClick:s,children:[Y.t("word.Cut",r),h.jsxs(ah,{children:["(",o?"⌘":"Ctrl","+X)"]})]})}),t&&f.push({key:"copy",label:h.jsxs(an,{noPadding:!0,onClick:l,children:[Y.t("word.Copy",r),h.jsxs(ah,{children:["(",o?"⌘":"Ctrl","+C)"]})]})}),e&&f.push({key:"paste",label:h.jsxs(an,{noPadding:!0,onClick:c,children:[Y.t("word.Paste",r),h.jsxs(ah,{children:["(",o?"⌘":"Ctrl","+V)"]})]})}),n.hasUndo()&&f.push({key:"undo",label:h.jsxs(an,{noPadding:!0,onClick:u,children:[Y.t("menu.edit.Undo",r)+": "+n.getLastUndoName(),h.jsxs(ah,{children:["(",o?"⌘":"Ctrl","+Z)"]})]})}),n.hasRedo()&&f.push({key:"redo",label:h.jsxs(an,{noPadding:!0,onClick:d,children:[Y.t("menu.edit.Redo",r)+": "+n.getLastRedoName(),h.jsxs(ah,{children:["(",o?"⌘":"Ctrl","+Y)"]})]})}),f};var u2e={},XQ={};Object.defineProperty(XQ,"__esModule",{value:!0});XQ.default=void 0;var iUn={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};XQ.default=iUn;var JQ={},wN={},KQ={};Object.defineProperty(KQ,"__esModule",{value:!0});KQ.default=void 0;var aUn={locale:"zh_CN",yearFormat:"YYYY年",cellDateFormat:"D",cellMeridiemFormat:"A",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"};KQ.default=aUn;var vN={};Object.defineProperty(vN,"__esModule",{value:!0});vN.default=void 0;const lUn={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};vN.default=lUn;var lZe=Id.default;Object.defineProperty(wN,"__esModule",{value:!0});wN.default=void 0;var sUn=lZe(KQ),cUn=lZe(vN);const sZe={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},sUn.default),timePickerLocale:Object.assign({},cUn.default)};sZe.lang.ok="确定";wN.default=sZe;var uUn=Id.default;Object.defineProperty(JQ,"__esModule",{value:!0});JQ.default=void 0;var dUn=uUn(wN);JQ.default=dUn.default;var qQ=Id.default;Object.defineProperty(u2e,"__esModule",{value:!0});var cZe=u2e.default=void 0,fUn=qQ(XQ),hUn=qQ(JQ),pUn=qQ(wN),gUn=qQ(vN);const N1="${label}不是一个有效的${type}",mUn={locale:"zh-cn",Pagination:fUn.default,DatePicker:pUn.default,TimePicker:gUn.default,Calendar:hUn.default,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckall:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:N1,method:N1,array:N1,object:N1,number:N1,date:N1,boolean:N1,integer:N1,float:N1,regexp:N1,email:N1,url:N1,hex:N1},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无"}};cZe=u2e.default=mUn;var d2e={},$Q={};Object.defineProperty($Q,"__esModule",{value:!0});$Q.default=void 0;var yUn={items_per_page:"條/頁",jump_to:"跳至",jump_to_confirm:"確定",page:"頁",prev_page:"上一頁",next_page:"下一頁",prev_5:"向前 5 頁",next_5:"向後 5 頁",prev_3:"向前 3 頁",next_3:"向後 3 頁",page_size:"頁碼"};$Q.default=yUn;var QQ={},xN={},ZQ={};Object.defineProperty(ZQ,"__esModule",{value:!0});ZQ.default=void 0;var AUn={locale:"zh_TW",today:"今天",now:"此刻",backToToday:"返回今天",ok:"確定",timeSelect:"選擇時間",dateSelect:"選擇日期",weekSelect:"選擇周",clear:"清除",month:"月",year:"年",previousMonth:"上個月 (翻頁上鍵)",nextMonth:"下個月 (翻頁下鍵)",monthSelect:"選擇月份",yearSelect:"選擇年份",decadeSelect:"選擇年代",yearFormat:"YYYY年",dayFormat:"D",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"上一年 (Control鍵加左方向鍵)",nextYear:"下一年 (Control鍵加右方向鍵)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世紀",nextCentury:"下一世紀"};ZQ.default=AUn;var bN={};Object.defineProperty(bN,"__esModule",{value:!0});bN.default=void 0;const wUn={placeholder:"請選擇時間"};bN.default=wUn;var uZe=Id.default;Object.defineProperty(xN,"__esModule",{value:!0});xN.default=void 0;var vUn=uZe(ZQ),xUn=uZe(bN);const dZe={lang:Object.assign({placeholder:"請選擇日期",yearPlaceholder:"請選擇年份",quarterPlaceholder:"請選擇季度",monthPlaceholder:"請選擇月份",weekPlaceholder:"請選擇周",rangePlaceholder:["開始日期","結束日期"],rangeYearPlaceholder:["開始年份","結束年份"],rangeMonthPlaceholder:["開始月份","結束月份"],rangeQuarterPlaceholder:["開始季度","結束季度"],rangeWeekPlaceholder:["開始周","結束周"]},vUn.default),timePickerLocale:Object.assign({},xUn.default)};dZe.lang.ok="確 定";xN.default=dZe;var bUn=Id.default;Object.defineProperty(QQ,"__esModule",{value:!0});QQ.default=void 0;var SUn=bUn(xN);QQ.default=SUn.default;var eZ=Id.default;Object.defineProperty(d2e,"__esModule",{value:!0});var fZe=d2e.default=void 0,TUn=eZ($Q),PUn=eZ(QQ),CUn=eZ(xN),RUn=eZ(bN);const U1="${label}不是一個有效的${type}",HUn={locale:"zh-tw",Pagination:TUn.default,DatePicker:CUn.default,TimePicker:RUn.default,Calendar:PUn.default,global:{placeholder:"請選擇"},Table:{filterTitle:"篩選器",filterConfirm:"確定",filterReset:"重置",filterEmptyText:"無篩選項",filterCheckall:"全選",filterSearchPlaceholder:"在篩選項中搜尋",emptyText:"暫無數據",selectAll:"全部選取",selectInvert:"反向選取",selectNone:"清空所有",selectionAll:"全選所有",sortTitle:"排序",expand:"展開行",collapse:"關閉行",triggerDesc:"點擊降序",triggerAsc:"點擊升序",cancelSort:"取消排序"},Modal:{okText:"確定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"結束導覽"},Popconfirm:{okText:"確定",cancelText:"取消"},Transfer:{titles:["",""],searchPlaceholder:"搜尋資料",itemUnit:"項目",itemsUnit:"項目",remove:"删除",selectCurrent:"全選當頁",removeCurrent:"删除當頁",selectAll:"全選所有",removeAll:"删除全部",selectInvert:"反選當頁"},Upload:{uploading:"正在上傳...",removeFile:"刪除檔案",uploadError:"上傳失敗",previewFile:"檔案預覽",downloadFile:"下载文件"},Empty:{description:"無此資料"},Icon:{icon:"圖標"},Text:{edit:"編輯",copy:"複製",copied:"複製成功",expand:"展開"},Form:{optional:"(可選)",defaultValidateMessages:{default:"字段驗證錯誤${label}",required:"請輸入${label}",enum:"${label}必須是其中一個[${enum}]",whitespace:"${label}不能為空字符",date:{format:"${label}日期格式無效",parse:"${label}不能轉換為日期",invalid:"${label}是一個無效日期"},types:{string:U1,method:U1,array:U1,object:U1,number:U1,date:U1,boolean:U1,integer:U1,float:U1,regexp:U1,email:U1,url:U1,hex:U1},string:{len:"${label}須為${len}個字符",min:"${label}最少${min}個字符",max:"${label}最多${max}個字符",range:"${label}須在${min}-${max}字符之間"},number:{len:"${label}必須等於${len}",min:"${label}最小值為${min}",max:"${label}最大值為${max}",range:"${label}須在${min}-${max}之間"},array:{len:"須為${len}個${label}",min:"最少${min}個${label}",max:"最多${max}個${label}",range:"${label}數量須在${min}-${max}之間"},pattern:{mismatch:"${label}與模式不匹配${pattern}"}}},Image:{preview:"預覽"},QRCode:{expired:"二維碼過期",refresh:"點擊刷新",scanned:"已掃描"}};fZe=d2e.default=HUn;var f2e={},tZ={};Object.defineProperty(tZ,"__esModule",{value:!0});tZ.default=void 0;var MUn={items_per_page:"/ página",jump_to:"Ir a",jump_to_confirm:"confirmar",page:"Página",prev_page:"Página anterior",next_page:"Página siguiente",prev_5:"5 páginas previas",next_5:"5 páginas siguientes",prev_3:"3 páginas previas",next_3:"3 páginas siguientes",page_size:"tamaño de página"};tZ.default=MUn;var nZ={},SN={},oZ={};Object.defineProperty(oZ,"__esModule",{value:!0});oZ.default=void 0;var IUn={locale:"es_ES",today:"Hoy",now:"Ahora",backToToday:"Volver a hoy",ok:"Aceptar",clear:"Limpiar",month:"Mes",year:"Año",timeSelect:"Seleccionar hora",dateSelect:"Seleccionar fecha",monthSelect:"Elegir un mes",yearSelect:"Elegir un año",decadeSelect:"Elegir una década",yearFormat:"YYYY",dateFormat:"D/M/YYYY",dayFormat:"D",dateTimeFormat:"D/M/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Mes anterior (PageUp)",nextMonth:"Mes siguiente (PageDown)",previousYear:"Año anterior (Control + left)",nextYear:"Año siguiente (Control + right)",previousDecade:"Década anterior",nextDecade:"Década siguiente",previousCentury:"Siglo anterior",nextCentury:"Siglo siguiente"};oZ.default=IUn;var TN={};Object.defineProperty(TN,"__esModule",{value:!0});TN.default=void 0;const zUn={placeholder:"Seleccionar hora"};TN.default=zUn;var hZe=Id.default;Object.defineProperty(SN,"__esModule",{value:!0});SN.default=void 0;var DUn=hZe(oZ),EUn=hZe(TN);const FUn={lang:Object.assign({placeholder:"Seleccionar fecha",rangePlaceholder:["Fecha inicial","Fecha final"],shortWeekDays:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],shortMonths:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"]},DUn.default),timePickerLocale:Object.assign({},EUn.default)};SN.default=FUn;var kUn=Id.default;Object.defineProperty(nZ,"__esModule",{value:!0});nZ.default=void 0;var LUn=kUn(SN);nZ.default=LUn.default;var rZ=Id.default;Object.defineProperty(f2e,"__esModule",{value:!0});var pZe=f2e.default=void 0,WUn=rZ(tZ),NUn=rZ(nZ),UUn=rZ(SN),jUn=rZ(TN);const j1="${label} no es un ${type} válido",BUn={locale:"es",Pagination:WUn.default,DatePicker:UUn.default,TimePicker:jUn.default,Calendar:NUn.default,global:{placeholder:"Seleccione"},Table:{filterTitle:"Filtrar menú",filterConfirm:"Aceptar",filterReset:"Reiniciar",filterEmptyText:"Sin filtros",filterCheckall:"Seleccionar todo",filterSearchPlaceholder:"Buscar en filtros",emptyText:"Sin datos",selectAll:"Seleccionar todo",selectInvert:"Invertir selección",selectNone:"Vacíe todo",selectionAll:"Seleccionar todos los datos",sortTitle:"Ordenar",expand:"Expandir fila",collapse:"Colapsar fila",triggerDesc:"Click para ordenar en orden descendente",triggerAsc:"Click para ordenar en orden ascendente",cancelSort:"Click para cancelar ordenamiento"},Modal:{okText:"Aceptar",cancelText:"Cancelar",justOkText:"Aceptar"},Popconfirm:{okText:"Aceptar",cancelText:"Cancelar"},Transfer:{titles:["",""],searchPlaceholder:"Buscar aquí",itemUnit:"elemento",itemsUnit:"elementos",remove:"Eliminar",selectCurrent:"Seleccionar página actual",removeCurrent:"Remover página actual",selectAll:"Seleccionar todos los datos",removeAll:"Eliminar todos los datos",selectInvert:"Invertir página actual"},Upload:{uploading:"Subiendo...",removeFile:"Eliminar archivo",uploadError:"Error al subir el archivo",previewFile:"Vista previa",downloadFile:"Descargar archivo"},Empty:{description:"No hay datos"},Icon:{icon:"ícono"},Text:{edit:"Editar",copy:"Copiar",copied:"Copiado",expand:"Expandir"},Form:{optional:"(opcional)",defaultValidateMessages:{default:"Error de validación del campo ${label}",required:"Por favor ingresar ${label}",enum:"${label} debe ser uno de [${enum}]",whitespace:"${label} no puede ser un carácter en blanco",date:{format:"El formato de fecha de ${label} es inválido",parse:"${label} no se puede convertir a una fecha",invalid:"${label} es una fecha inválida"},types:{string:j1,method:j1,array:j1,object:j1,number:j1,date:j1,boolean:j1,integer:j1,float:j1,regexp:j1,email:j1,url:j1,hex:j1},string:{len:"${label} debe tener ${len} caracteres",min:"${label} debe tener al menos ${min} caracteres",max:"${label} debe tener hasta ${max} caracteres",range:"${label} debe tener entre ${min}-${max} caracteres"},number:{len:"${label} debe ser igual a ${len}",min:"${label} valor mínimo es ${min}",max:"${label} valor máximo es ${max}",range:"${label} debe estar entre ${min}-${max}"},array:{len:"Debe ser ${len} ${label}",min:"Al menos ${min} ${label}",max:"A lo mucho ${max} ${label}",range:"El monto de ${label} debe estar entre ${min}-${max}"},pattern:{mismatch:"${label} no coincide con el patrón ${pattern}"}}},Image:{preview:"Previsualización"}};pZe=f2e.default=BUn;var h2e={},iZ={};Object.defineProperty(iZ,"__esModule",{value:!0});iZ.default=void 0;var YUn={items_per_page:"/ sayfa",jump_to:"Git",jump_to_confirm:"onayla",page:"Sayfa",prev_page:"Önceki Sayfa",next_page:"Sonraki Sayfa",prev_5:"Önceki 5 Sayfa",next_5:"Sonraki 5 Sayfa",prev_3:"Önceki 3 Sayfa",next_3:"Sonraki 3 Sayfa",page_size:"sayfa boyutu"};iZ.default=YUn;var aZ={},PN={},lZ={};Object.defineProperty(lZ,"__esModule",{value:!0});lZ.default=void 0;var OUn={locale:"tr_TR",today:"Bugün",now:"Şimdi",backToToday:"Bugüne Geri Dön",ok:"Tamam",clear:"Temizle",month:"Ay",year:"Yıl",timeSelect:"Zaman Seç",dateSelect:"Tarih Seç",monthSelect:"Ay Seç",yearSelect:"Yıl Seç",decadeSelect:"On Yıl Seç",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Önceki Ay (PageUp)",nextMonth:"Sonraki Ay (PageDown)",previousYear:"Önceki Yıl (Control + Sol)",nextYear:"Sonraki Yıl (Control + Sağ)",previousDecade:"Önceki On Yıl",nextDecade:"Sonraki On Yıl",previousCentury:"Önceki Yüzyıl",nextCentury:"Sonraki Yüzyıl"};lZ.default=OUn;var CN={};Object.defineProperty(CN,"__esModule",{value:!0});CN.default=void 0;const VUn={placeholder:"Zaman seç",rangePlaceholder:["Başlangıç zamanı","Bitiş zamanı"]};CN.default=VUn;var gZe=Id.default;Object.defineProperty(PN,"__esModule",{value:!0});PN.default=void 0;var _Un=gZe(lZ),GUn=gZe(CN);const XUn={lang:Object.assign({placeholder:"Tarih seç",yearPlaceholder:"Yıl seç",quarterPlaceholder:"Çeyrek seç",monthPlaceholder:"Ay seç",weekPlaceholder:"Hafta seç",rangePlaceholder:["Başlangıç tarihi","Bitiş tarihi"],rangeYearPlaceholder:["Başlangıç yılı","Bitiş yılı"],rangeMonthPlaceholder:["Başlangıç ayı","Bitiş ayı"],rangeWeekPlaceholder:["Başlangıç haftası","Bitiş haftası"]},_Un.default),timePickerLocale:Object.assign({},GUn.default)};PN.default=XUn;var JUn=Id.default;Object.defineProperty(aZ,"__esModule",{value:!0});aZ.default=void 0;var KUn=JUn(PN);aZ.default=KUn.default;var sZ=Id.default;Object.defineProperty(h2e,"__esModule",{value:!0});var mZe=h2e.default=void 0,qUn=sZ(iZ),$Un=sZ(aZ),QUn=sZ(PN),ZUn=sZ(CN);const B1="${label} geçerli bir ${type} değil",ejn={locale:"tr",Pagination:qUn.default,DatePicker:QUn.default,TimePicker:ZUn.default,Calendar:$Un.default,global:{placeholder:"Lütfen seçiniz"},Table:{filterTitle:"Filtre menüsü",filterConfirm:"Tamam",filterReset:"Sıfırla",filterEmptyText:"Filtre yok",selectAll:"Tüm sayfayı seç",selectInvert:"Tersini seç",selectionAll:"Tümünü seç",sortTitle:"Sırala",expand:"Satırı genişlet",collapse:"Satırı daralt",triggerDesc:"Azalan düzende sırala",triggerAsc:"Artan düzende sırala",cancelSort:"Sıralamayı kaldır"},Modal:{okText:"Tamam",cancelText:"İptal",justOkText:"Tamam"},Popconfirm:{okText:"Tamam",cancelText:"İptal"},Transfer:{titles:["",""],searchPlaceholder:"Arama",itemUnit:"Öğe",itemsUnit:"Öğeler",remove:"Kaldır",selectCurrent:"Tüm sayfayı seç",removeCurrent:"Sayfayı kaldır",selectAll:"Tümünü seç",removeAll:"Tümünü kaldır",selectInvert:"Tersini seç"},Upload:{uploading:"Yükleniyor...",removeFile:"Dosyayı kaldır",uploadError:"Yükleme hatası",previewFile:"Dosyayı önizle",downloadFile:"Dosyayı indir"},Empty:{description:"Veri Yok"},Icon:{icon:"ikon"},Text:{edit:"Düzenle",copy:"Kopyala",copied:"Kopyalandı",expand:"Genişlet"},Form:{optional:"(opsiyonel)",defaultValidateMessages:{default:"Alan doğrulama hatası ${label}",required:"${label} gerekli bir alan",enum:"${label} şunlardan biri olmalı: [${enum}]",whitespace:"${label} sadece boşluk olamaz",date:{format:"${label} tarih biçimi geçersiz",parse:"${label} bir tarihe dönüştürülemedi",invalid:"${label} geçersiz bir tarih"},types:{string:B1,method:B1,array:B1,object:B1,number:B1,date:B1,boolean:B1,integer:B1,float:B1,regexp:B1,email:B1,url:B1,hex:B1},string:{len:"${label} ${len} karakter olmalı",min:"${label} en az ${min} karakter olmalı",max:"${label} en çok ${max} karakter olmalı",range:"${label} ${min}-${max} karakter arası olmalı"},number:{len:"${label} ${len} olmalı",min:"${label} en az ${min} olmalı",max:"${label} en çok ${max} olmalı",range:"${label} ${min}-${max} arası olmalı"},array:{len:"${label} sayısı ${len} olmalı",min:"${label} sayısı en az ${min} olmalı",max:"${label} sayısı en çok ${max} olmalı",range:"${label} sayısı ${min}-${max} arası olmalı"},pattern:{mismatch:"${label} şu kalıpla eşleşmeli: ${pattern}"}}},Image:{preview:"Önizleme"}};mZe=h2e.default=ejn;var p2e={},cZ={};Object.defineProperty(cZ,"__esModule",{value:!0});cZ.default=void 0;var tjn={items_per_page:"/ сторінці",jump_to:"Перейти",jump_to_confirm:"підтвердити",page:"",prev_page:"Попередня сторінка",next_page:"Наступна сторінка",prev_5:"Попередні 5 сторінок",next_5:"Наступні 5 сторінок",prev_3:"Попередні 3 сторінки",next_3:"Наступні 3 сторінки",page_size:"Page Size"};cZ.default=tjn;var uZ={},RN={},dZ={};Object.defineProperty(dZ,"__esModule",{value:!0});dZ.default=void 0;var njn={locale:"uk_UA",today:"Сьогодні",now:"Зараз",backToToday:"Поточна дата",ok:"OK",clear:"Очистити",month:"Місяць",year:"Рік",timeSelect:"Обрати час",dateSelect:"Обрати дату",monthSelect:"Обрати місяць",yearSelect:"Обрати рік",decadeSelect:"Обрати десятиріччя",yearFormat:"YYYY",dateFormat:"D-M-YYYY",dayFormat:"D",dateTimeFormat:"D-M-YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Попередній місяць (PageUp)",nextMonth:"Наступний місяць (PageDown)",previousYear:"Попередній рік (Control + left)",nextYear:"Наступний рік (Control + right)",previousDecade:"Попереднє десятиріччя",nextDecade:"Наступне десятиріччя",previousCentury:"Попереднє століття",nextCentury:"Наступне століття"};dZ.default=njn;var HN={};Object.defineProperty(HN,"__esModule",{value:!0});HN.default=void 0;const ojn={placeholder:"Оберіть час"};HN.default=ojn;var yZe=Id.default;Object.defineProperty(RN,"__esModule",{value:!0});RN.default=void 0;var rjn=yZe(dZ),ijn=yZe(HN);const ajn={lang:Object.assign({placeholder:"Оберіть дату",rangePlaceholder:["Початкова дата","Кінцева дата"]},rjn.default),timePickerLocale:Object.assign({},ijn.default)};RN.default=ajn;var ljn=Id.default;Object.defineProperty(uZ,"__esModule",{value:!0});uZ.default=void 0;var sjn=ljn(RN);uZ.default=sjn.default;var fZ=Id.default;Object.defineProperty(p2e,"__esModule",{value:!0});var AZe=p2e.default=void 0,cjn=fZ(cZ),ujn=fZ(uZ),djn=fZ(RN),fjn=fZ(HN);const Y1="${label} не є типом ${type}",hjn={locale:"uk",Pagination:cjn.default,DatePicker:djn.default,TimePicker:fjn.default,Calendar:ujn.default,global:{placeholder:"Будь ласка, оберіть"},Table:{filterTitle:"Фільтрувати",filterConfirm:"OK",filterReset:"Скинути",filterEmptyText:"Фільтри відсутні",filterCheckall:"Обрати всі",filterSearchPlaceholder:"Пошук у фільтрах",emptyText:"Даних немає",selectAll:"Обрати всі на сторінці",selectInvert:"Інвертувати вибір",selectNone:"Очистити вибір",selectionAll:"Обрати всі",sortTitle:"Сортувати",expand:"Розгорнути рядок",collapse:"Згорнути рядок",triggerDesc:"Сортувати за спаданням",triggerAsc:"Сортувати за зростанням",cancelSort:"Відмінити сортування"},Tour:{Next:"Далі",Previous:"Назад",Finish:"Завершити"},Modal:{okText:"Гаразд",cancelText:"Скасувати",justOkText:"Гаразд"},Popconfirm:{okText:"Гаразд",cancelText:"Скасувати"},Transfer:{titles:["",""],searchPlaceholder:"Введіть текст для пошуку",itemUnit:"елем.",itemsUnit:"елем.",remove:"Видалити",selectCurrent:"Вибрати поточну сторінку",removeCurrent:"Скасувати вибір на сторінці",selectAll:"Вибрати всі дані",removeAll:"Скасувати вибір",selectInvert:"Інвертувати поточну сторінку"},Upload:{uploading:"Завантаження ...",removeFile:"Видалити файл",uploadError:"Помилка завантаження",previewFile:"Попередній перегляд файлу",downloadFile:"Завантажити файл"},Empty:{description:"Даних немає"},Icon:{icon:"іконка"},Text:{edit:"Редагувати",copy:"Скопіювати",copied:"Скопійовано",expand:"Розширити"},Form:{optional:"(опціонально)",defaultValidateMessages:{default:"Помилка валідації для поля ${label}",required:"Будь ласка, заповніть ${label}",enum:"Лише одне зі значень [${enum}] доступне для ${label}",whitespace:"Значення у полі ${label} не може бути пробілом",date:{format:"Не валідний формат дати у ${label}",parse:"Значення ${label} не може бути приведене до дати",invalid:"Не валідна дата у ${label}"},types:{string:Y1,method:Y1,array:Y1,object:Y1,number:Y1,date:Y1,boolean:Y1,integer:Y1,float:Y1,regexp:Y1,email:Y1,url:Y1,hex:Y1},string:{len:"${label} має містити ${len} символів",min:"${label} має містити не менш, ніж ${min} символів",max:"${label} має містити не більш, ніж ${max} символів",range:"${label} має містити ${min}-${max} символів"},number:{len:"${label} має дорівнювати ${len}",min:"${label} має бути не менш, ніж ${min}",max:"${label} має бути не більш, ніж ${max}",range:"${label} має бути в межах ${min}-${max}"},array:{len:"${label} має містити ${len} елементи",min:"${label} має містити не менш, ніж ${min} елементи",max:"${label} має містити не більш, ніж ${max} елементи",range:"Кількість елементів в ${label} має бути в межах ${min}-${max}"},pattern:{mismatch:"${label} не відповідає шаблону ${pattern}"}}},Image:{preview:"Попередній перегляд"},QRCode:{expired:"QR-код закінчився",refresh:"Оновити"}};AZe=p2e.default=hjn;const pjn=be.memo(()=>{const t=M(m0),e=n=>{M.getState().set(o=>{switch(o.language=n.target.value,o.language){case"zh_cn":o.locale=cZe;break;case"zh_tw":o.locale=fZe;break;case"es":o.locale=pZe;break;case"tr":o.locale=mZe;break;case"ua":o.locale=AZe;break;default:o.locale=y1e}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Le.Group,{value:t,style:{height:"170px"},onChange:e,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:"en",children:s9.English}),h.jsx(Le,{style:{width:"100%"},value:"es",children:s9.Spanish}),h.jsx(Le,{style:{width:"100%"},value:"zh_cn",children:s9.ChineseSimplified}),h.jsx(Le,{style:{width:"100%"},value:"zh_tw",children:s9.ChineseTraditional}),h.jsx(Le,{style:{width:"100%"},value:"tr",children:s9.Turkish}),h.jsx(Le,{style:{width:"100%"},value:"ua",children:s9.Ukrainian})]})})})}),gjn=(t,e,n)=>{const o={lng:M.getState().language},r=()=>{dt.getState().set(l=>{l.showModelsGallery=!0,l.leaderboardFlag=!0,l.openModelsMap=!1})},i=()=>{dt.getState().set(l=>{l.modelsMapFlag=!0,l.modelsMapWeatherStations=!1,l.openModelsMap=!0,l.showModelsGallery=!1}),M.getState().loggable&&M.getState().set(l=>{l.actionInfo={name:"Open Models Map",timestamp:new Date().getTime()}})},a=[];return t&&!e&&a.push({key:"my-models",label:h.jsxs(an,{noPadding:!0,onClick:r,children:[Y.t("menu.ModelsGallery",o),"..."]})}),n||a.push({key:"models-map",label:h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t("menu.ModelsMap",o),"..."]})}),a},vX=()=>{const t=kn.getState().orbitControlsRef;if(t!=null&&t.current){const e=Math.min(50,M.getState().sceneRadius*4);t.current.object.position.set(e,e,e),t.current.target.set(0,0,0),t.current.update(),M.getState().set(n=>{const o=n.viewState;o.cameraPosition=[e,e,e],o.panCenter=[0,0,0]})}},xX=t=>{if(M.getState().viewState.orthographic){const e=M.getState().viewState.cameraZoom??20,n=e,o=e/t,r={name:"Zoom",timestamp:Date.now(),oldValue:n,newValue:o,undo:()=>{M.getState().set(i=>{i.viewState.cameraZoom=r.oldValue})},redo:()=>{M.getState().set(i=>{i.viewState.cameraZoom=r.newValue})}};M.getState().addUndoable(r),M.getState().set(i=>{i.viewState.cameraZoom=o})}else{const e=kn.getState().orbitControlsRef;if(e!=null&&e.current){const n=e.current.object.position,o=n.x*t,r=n.y*t,i=n.z*t,a={name:"Zoom",timestamp:Date.now(),oldCameraPosition:[n.x,n.y,n.z],newCameraPosition:[o,r,i],undo:()=>{var u,d;const l=a.oldCameraPosition[0],s=a.oldCameraPosition[1],c=a.oldCameraPosition[2];(u=e.current)==null||u.object.position.set(l,s,c),(d=e.current)==null||d.update(),M.getState().set(f=>{f.viewState.cameraPosition=[l,s,c]})},redo:()=>{var u,d;const l=a.newCameraPosition[0],s=a.newCameraPosition[1],c=a.newCameraPosition[2];(u=e.current)==null||u.object.position.set(l,s,c),(d=e.current)==null||d.update(),M.getState().set(f=>{f.viewState.cameraPosition=[l,s,c]})}};M.getState().addUndoable(a),e.current.object.position.set(o,r,i),e.current.update(),M.getState().set(l=>{l.viewState.cameraPosition=[o,r,i]})}}},mjn=(t,e)=>{const n={lng:M.getState().language},o=M.getState().viewState.orthographic,r=M.getState().viewState.cameraPosition,i=M.getState().viewState.panCenter,a=r[0]===r[1]&&r[1]===r[2]&&i[0]===0&&i[1]===0&&i[2]===0,l=()=>{const C={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...r],oldPanCenter:[...i],undo:()=>{const P=kn.getState().orbitControlsRef;P!=null&&P.current&&(P.current.object.position.set(C.oldCameraPosition[0],C.oldCameraPosition[1],C.oldCameraPosition[2]),P.current.target.set(C.oldPanCenter[0],C.oldPanCenter[1],C.oldPanCenter[2]),P.current.update(),M.getState().set(v=>{const T=v.viewState;T.cameraPosition=[...C.oldCameraPosition],T.panCenter=[...C.oldPanCenter]}))},redo:()=>{vX()}};M.getState().addUndoable(C),vX(),M.getState().set(P=>{P.objectTypeToAdd=z.None,P.groupActionMode=!1,P.viewState.orthographic=!1})},s=()=>{xX(1.1)},c=()=>{xX(.9)},u=C=>{const P=M.getState().setNavigationView,v={name:"Toggle Navigation View",timestamp:Date.now(),checked:C.target.checked,undo:()=>{P(!v.checked)},redo:()=>{P(v.checked)}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.autoRotate=!1}),P(C.target.checked)},d=C=>{const P=M.getState().set2DView,v={name:"Toggle 2D View",timestamp:Date.now(),checked:C.target.checked,undo:()=>{P(!v.checked)},redo:()=>{P(v.checked)}};M.getState().addUndoable(v),P(C.target.checked),M.getState().set(T=>{T.viewState.autoRotate=!1})},f=C=>{if(!M.getState().viewState.orthographic){const P={name:"Auto Rotate",timestamp:Date.now(),checked:C.target.checked,undo:()=>{M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=!P.checked})},redo:()=>{M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=P.checked})}};M.getState().addUndoable(P),M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=!v.viewState.autoRotate})}},p=C=>{const P=C.target.checked,v={name:"Show Axes",timestamp:Date.now(),checked:P,undo:()=>{M.getState().set(T=>{T.viewState.axes=!v.checked})},redo:()=>{M.getState().set(T=>{T.viewState.axes=v.checked})}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.axes=P})},g=C=>{const P={name:"Show Shadow",timestamp:Date.now(),checked:C.target.checked,undo:()=>{M.getState().set(v=>{v.viewState.shadowEnabled=!P.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})},redo:()=>{M.getState().set(v=>{v.viewState.shadowEnabled=P.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})}};M.getState().addUndoable(P),M.getState().set(v=>{v.viewState.shadowEnabled=C.target.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})},A=C=>{const P=C.target.checked?rw:0,v={name:"Set Surface Shininess",timestamp:Date.now(),oldValue:M.getState().viewState.solarPanelShininess??rw,newValue:P,undo:()=>{M.getState().set(T=>{T.viewState.solarPanelShininess=v.oldValue})},redo:()=>{M.getState().set(T=>{T.viewState.solarPanelShininess=v.newValue})}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.solarPanelShininess=P})},y=C=>{const P=M.getState().floatingWindowOpacity,v=C.target.checked?g0:1,T={name:"Floating Window Opacity",timestamp:Date.now(),oldValue:P,newValue:v,undo:()=>{M.getState().set(w=>{w.floatingWindowOpacity=T.oldValue})},redo:()=>{M.getState().set(w=>{w.floatingWindowOpacity=T.newValue})}};M.getState().addUndoable(T),M.getState().set(w=>{w.floatingWindowOpacity=v})},S=[];return!o&&!a&&S.push({key:"reset-view",label:h.jsxs(an,{onClick:l,children:[Y.t("menu.view.ResetView",n),h.jsxs(ah,{children:["(",t,")"]})]})}),S.push({key:"zoom-out-view",label:h.jsxs(an,{onClick:s,children:[Y.t("menu.view.ZoomOut",n),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+])"]})]})}),S.push({key:"zoom-in-view",label:h.jsxs(an,{onClick:c,children:[Y.t("menu.view.ZoomIn",n),h.jsxs(ah,{children:["(",e?"⌘":"Ctrl","+[)"]})]})}),S.push({key:"navigation-view-check-box",label:h.jsxs(f2,{selector:Yq,onChange:u,children:[Y.t("menu.view.NavigationView",n),h.jsxs(ah,{children:["(",bre,"+Q)"]})]})}),S.push({key:"orthographic-check-box",label:h.jsxs(f2,{selector:Ju,onChange:d,children:[Y.t("menu.view.TwoDimensionalView",n),h.jsxs(ah,{children:["(",bre,"+B)"]})]})}),o||S.push({key:"auto-rotate-check-box",label:h.jsxs(f2,{selector:RBe,onChange:f,children:[Y.t("menu.view.AutoRotate",n),h.jsxs(ah,{children:["(",bre,"+M)"]})]})}),S.push({key:"axes-check-box",label:h.jsx(f2,{selector:bge,onChange:p,children:Y.t("skyMenu.Axes",n)})}),S.push({key:"shadow-check-box",label:h.jsx(f2,{selector:Cs,onChange:g,children:Y.t("menu.view.ShowShadow",n)})}),S.push({key:"shininess-check-box",label:h.jsx(f2,{selector:C=>C.viewState.solarPanelShininess===void 0||C.viewState.solarPanelShininess>0,onChange:A,children:Y.t("menu.view.ShowSurfaceShininess",n)})}),S.push({key:"translucency-check-box",label:h.jsx(f2,{selector:C=>C.floatingWindowOpacity<1,onChange:y,children:Y.t("menu.view.TranslucentFloatingWindows",n)})}),S},yjn=()=>{const t={lng:M.getState().language},e=M.getState().set,n=M.getState().addUndoable,o=M.getState().viewState.showHeliodonPanel,r=M.getState().viewState.showMapPanel,i=M.getState().viewState.showWeatherPanel,a=M.getState().viewState.showDiurnalTemperaturePanel,l=dt.getState().showSolarPanelCustomizationPanel,s=dt.getState().showEconomicsPanel,c=dt.getState().showNavigationPanel,u=dt.getState().showShadowSettings,d=M.getState().loggable,f=()=>{const T={name:"Open Sun and Time Settings Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showHeliodonPanel=!1})},redo:()=>{e(w=>{w.viewState.showHeliodonPanel=!0})}};n(T),e(w=>{w.viewState.showHeliodonPanel=!0,w.selectedFloatingWindow="heliodonPanel"})},p=()=>{const T={name:"Open Maps",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showMapPanel=!1})},redo:()=>{e(w=>{w.viewState.showMapPanel=!0})}};n(T),e(w=>{w.viewState.showMapPanel=!0,w.selectedFloatingWindow="mapPanel"})},g=()=>{const T={name:"Open Weather Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showWeatherPanel=!1})},redo:()=>{e(w=>{w.viewState.showWeatherPanel=!0})}};n(T),e(w=>{w.viewState.showWeatherPanel=!0,w.selectedFloatingWindow="weatherPanel"})},A=()=>{const T={name:"Open Diurnal Temperature Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showDiurnalTemperaturePanel=!1})},redo:()=>{e(w=>{w.viewState.showDiurnalTemperaturePanel=!0})}};n(T),e(w=>{w.viewState.showDiurnalTemperaturePanel=!0,w.selectedFloatingWindow="diurnalTemperaturePanel"})},y=()=>{dt.getState().set(T=>{T.showSolarPanelCustomizationPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Solar Panel Customization Panel",timestamp:new Date().getTime()}})},S=()=>{dt.getState().set(T=>{T.showEconomicsPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Economics Panel",timestamp:new Date().getTime()}})},C=()=>{dt.getState().set(T=>{T.showNavigationPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Navigation Panel",timestamp:new Date().getTime()}})},P=()=>{dt.getState().set(T=>{T.showShadowSettings=!0}),d&&e(T=>{T.actionInfo={name:"Open Shadow Settings",timestamp:new Date().getTime()}})},v=[];return o||v.push({key:"sun-time",label:h.jsxs(an,{noPadding:!0,onClick:f,children:[Y.t("menu.settings.SunAndTime",t),"..."]})}),r||v.push({key:"show-map-panel",label:h.jsxs(an,{noPadding:!0,onClick:p,children:[Y.t("word.Location",t),"..."]})}),i||v.push({key:"weather-panel",label:h.jsxs(an,{noPadding:!0,onClick:g,children:[Y.t("menu.settings.WeatherData",t),"..."]})}),a||v.push({key:"diurnal-temperature-panel",label:h.jsxs(an,{noPadding:!0,onClick:A,children:[Y.t("menu.settings.DiurnalTemperature",t),"..."]})}),l||v.push({key:"solar-panel-customization",label:h.jsxs(an,{noPadding:!0,onClick:y,children:[Y.t("menu.settings.CustomSolarPanels",t),"..."]})}),s||v.push({key:"economics-panel",label:h.jsxs(an,{noPadding:!0,onClick:S,children:[Y.t("economicsPanel.EconomicsParameters",t),"..."]})}),c||v.push({key:"navigation-panel",label:h.jsxs(an,{noPadding:!0,onClick:C,children:[Y.t("navigationPanel.NavigationParameters",t),"..."]})}),u||v.push({key:"shadow-settings",label:h.jsxs(an,{noPadding:!0,onClick:P,children:[Y.t("shadowSettingsPanel.ShadowSettings",t),"..."]})}),v},Ajn=()=>{const t={lng:M.getState().language},e=M.getState().set,n=M.getState().addUndoable,o=s=>{const c=s.target.checked,u={name:"Show Site Information",timestamp:Date.now(),checked:c,undo:()=>{e(d=>{d.viewState.showSiteInfoPanel=!u.checked})},redo:()=>{e(d=>{d.viewState.showSiteInfoPanel=u.checked})}};n(u),e(d=>{d.viewState.showSiteInfoPanel=c})},r=s=>{const c=s.target.checked,u={name:"Show Design Information",timestamp:Date.now(),checked:c,undo:()=>{e(d=>{d.viewState.showDesignInfoPanel=!u.checked})},redo:()=>{e(d=>{d.viewState.showDesignInfoPanel=u.checked})}};n(u),e(d=>{d.viewState.showDesignInfoPanel=!d.viewState.showDesignInfoPanel})},i=s=>{const c={name:"Show Instruction Panel",timestamp:Date.now(),checked:s.target.checked,undo:()=>{e(u=>{u.viewState.showInstructionPanel=!c.checked})},redo:()=>{e(u=>{u.viewState.showInstructionPanel=c.checked})}};n(c),e(u=>{u.viewState.showInstructionPanel=!u.viewState.showInstructionPanel})},a=s=>{const c={name:"Show Sticky Note",timestamp:Date.now(),checked:s.target.value,undo:()=>{e(u=>{u.viewState.showStickyNotePanel=!c.checked})},redo:()=>{e(u=>{u.viewState.showStickyNotePanel=c.checked})}};n(c),e(u=>{u.viewState.showStickyNotePanel=!u.viewState.showStickyNotePanel})};return[{key:"site-info-panel-check-box",label:h.jsx(f2,{selector:Tge,onChange:o,children:Y.t("menu.view.accessories.SiteInformation",t)})},{key:"design-info-panel-check-box",label:h.jsx(f2,{selector:Vq,onChange:r,children:Y.t("menu.view.accessories.DesignInformation",t)})},{key:"instruction-panel-check-box",label:h.jsx(f2,{selector:FBe,onChange:i,children:Y.t("menu.view.accessories.Instruction",t)})},{key:"sticky-note-panel-check-box",label:h.jsx(f2,{selector:LBe,onChange:a,children:Y.t("menu.view.accessories.StickyNote",t)})}]};var rg=(t=>(t[t.NO_BUILDING=3]="NO_BUILDING",t[t.AT_LEAST_ONE_BAD_NO_GOOD=2]="AT_LEAST_ONE_BAD_NO_GOOD",t[t.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD=1]="AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD",t[t.OK=0]="OK",t))(rg||{});const SO=50,bX=(t,e,n)=>{if(e(z.Foundation)===0)return{status:3};let r=!1,i=!1,a;for(const l of t)if(l.type===z.Foundation){const s=l;if(s.notBuilding)continue;if(n(z.Wall,s.id).length>0){const u=ye.getBuildingCompletionStatus(s,t);u===Uc.COMPLETE?r=!0:(i=!0,a=u)}else i=!0}return i&&!r?{status:2,buildingCompletion:a}:i&&r?{status:1}:{status:0}},Z7=t=>{if(!t.color)return .5;const e=t.color.toLowerCase();if(e==="white")return .05;if(e==="black")return .95;const n=parseInt(t.color.substring(1),16),o=n>>16&255,r=n>>8&255,i=n&255;let a=Math.min(o,r);a=Math.min(a,i);let l=Math.max(o,r);return l=Math.max(l,i),Math.min(.95,Math.max(.05,1-(a+l)/510))},TO=(t,e,n,o)=>e<0&&t.low>=n-o||e>0&&t.high<=n+o?0:e,ob=(t,e,n,o,r,i)=>{if(n===y2.Sinusoidal)return .5*(t+e)-.5*(t-e)*Math.cos(lde*(i-(o-720)));const a=.5*(t+e),l=.5*(t-e),s=r.daylight();if(i>r.sunrise&&ir.sunset){const p=i-r.sunset;return e+(u-e)*Math.exp(-d*p/c)}const f=i+23*60-r.sunset;return e+(u-e)*Math.exp(-d*f/c)},rb=(t,e,n)=>{const o=t.getFullYear(),r=t.getMonth(),i=t.getDate(),l=ye.daysOfMonth(r,o)/2;let s,c,u;if(i11&&(c=0);const p=ye.daysOfMonth(c,o)/2,g=l+p;u=(i-l)/g}const d=e[s]+(e[c]-e[s])*u,f=n[s]+(n[c]-n[s])*u;return{low:d,high:f}},wjn=(t,e,n,o,r,i)=>{const a=n.length;let l=0,s=-1e3,c=1e3,u=-1e3,d=1e3;for(let g=0;go[g]&&(c=o[g]),d>n[g]&&(d=n[g]);l/=2*a;const f=.25*(s-c+u-d),p=i*Math.sqrt(Zie/(2*r));return t>0?l-f*Math.exp(-p)*Math.cos(Zie*(e-ESe)-p):l-f*Math.exp(-p)*Math.cos(Math.PI+Zie*(e-ESe)-p)},wZe=(t,e,n,o,r,i,a,l,s)=>wjn(t,e,o,r,l,s)-Math.exp(-s*Math.sqrt(lde/(2*l)))*a*Math.cos(lde*(n-(i-720)-rZt)),{Option:ev}=Uo,hZ=be.memo(({type:t})=>{const e=M(VBe),n=M(I8t),o=M(D8t),r=$t(),i=m.useMemo(()=>{switch(t){case rs.CSP:return n;case rs.SUT:return o;default:return e}},[t,e,n,o]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.SamplingFrequency",r)+":"}),h.jsxs(Uo,{style:{width:"72px"},value:i??4,onChange:a=>{M.getState().set(l=>{switch(t){case rs.CSP:l.world.cspTimesPerHour=a;break;case rs.SUT:l.world.sutTimesPerHour=a;break;default:l.world.timesPerHour=a;break}})},children:[h.jsx(ev,{value:1,children:"1"},1),h.jsx(ev,{value:2,children:"2"},2),h.jsx(ev,{value:3,children:"3"},3),h.jsx(ev,{value:4,children:"4"},4),h.jsx(ev,{value:6,children:"6"},6),h.jsx(ev,{value:12,children:"12"},12),h.jsx(ev,{value:30,children:"30"},30)]}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.TimesPerHour",r)})]})}),{Option:hae}=Uo,pZ=be.memo(({type:t})=>{const e=M(zH),n=M(mW),o=M(GBe),r=$t(),i=m.useMemo(()=>{switch(t){case rs.CSP:return n;case rs.SUT:return o;default:return e}},[t,e,n,o]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsxs(Uo,{style:{marginLeft:"150px",width:"72px"},value:i??6,onChange:a=>{switch(t){case rs.BUILDING:M.getState().set(l=>{l.world.daysPerYear=a});break;case rs.PV:M.getState().set(l=>{l.world.daysPerYear=a}),Cn.setState({yearlyPvYield:[]});break;case rs.CSP:M.getState().set(l=>{l.world.cspDaysPerYear=a}),Cn.setState({yearlyParabolicTroughYield:[],yearlyParabolicDishYield:[],yearlyFresnelReflectorYield:[],yearlyHeliostatYield:[]});break;case rs.SUT:M.getState().set(l=>{l.world.sutDaysPerYear=a}),Cn.setState({yearlyUpdraftTowerYield:[]});break}},children:[h.jsx(hae,{value:4,children:"4"},4),h.jsx(hae,{value:6,children:"6"},6),h.jsx(hae,{value:12,children:"12"},12)]}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.DaysPerYear",r)})]})}),MN=be.memo(({type:t})=>{const e=M(R8t),n=M(H8t),o=M(z8t),r=M(E8t),i=$t(),a=m.useMemo(()=>{switch(t){case rs.PV:return n;case rs.CSP:return o;case rs.SUT:return r;default:return e}},[t,n,o,r,e]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.GridCellSize",i)+":"}),h.jsx(Sn,{min:.1,max:5,step:.05,style:{width:72},precision:2,value:a??.5,onChange:l=>{l!==null&&M.getState().set(s=>{switch(t){case rs.PV:s.world.pvGridCellSize=l;break;case rs.CSP:s.world.cspGridCellSize=l;break;case rs.SUT:s.world.sutGridCellSize=l;break;default:s.world.solarRadiationHeatmapGridCellSize=l;break}})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("word.MeterAbbreviation",i)})]})}),vjn=()=>[{key:"building-energy-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.BUILDING})},{key:"building-energy-simulation-sampling-days",label:h.jsx(pZ,{type:rs.BUILDING})},{key:"building-energy-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.BUILDING})}],{Option:lPe}=Uo,xjn=be.memo(()=>{const t=$t(),e=M(C8t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.solarPanel.PanelDiscretization",t)+":"}),h.jsxs(Uo,{style:{width:"165px"},value:e??Em.APPROXIMATE,onChange:n=>{M.getState().set(o=>{o.world.discretization=n})},children:[h.jsx(lPe,{value:Em.EXACT,children:Y.t("menu.solarPanel.Exact",t)},Em.EXACT),h.jsx(lPe,{value:Em.APPROXIMATE,children:Y.t("menu.solarPanel.Approximate",t)},Em.APPROXIMATE)]})]})}),bjn=be.memo(()=>{const t=$t(),e=M(Mge);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:Y.t("menu.solarPanel.SolarPanelSimulationNoAnimation",t)+":"}),h.jsx(vc,{checked:e,onChange:n=>{M.getState().set(o=>{o.world.noAnimationForSolarPanelSimulation=n})}})]})}),Sjn=t=>{const e=M.getState().world.discretization,n=[{key:"solar-panel-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.PV})},{key:"solar-panel-simulation-sampling-days",label:h.jsx(pZ,{type:rs.PV})},{key:"solar-panel-discretization",label:h.jsx(xjn,{})}];return(!e||e===Em.APPROXIMATE)&&n.push({key:"solar-panel-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.PV})}),t||n.push({key:"solar-panel-simulation-no-animation",label:h.jsx(bjn,{})}),n},PO=t=>[{key:`${t}-simulation-sampling-frequency`,label:h.jsx(hZ,{type:rs.CSP})},{key:`${t}-simulation-sampling-days`,label:h.jsx(pZ,{type:rs.CSP})},{key:`${t}-simulation-grid-cell-size`,label:h.jsx(MN,{type:rs.CSP})}],Tjn=be.memo(()=>{const t=$t(),e=M(Pf);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:Y.t("menu.physics.SolarRadiationHeatmapMaxValue",t)+":"}),h.jsx(Sn,{min:.5,max:50,step:.5,style:{width:60},precision:1,value:e??5,onChange:n=>{M.getState().set(o=>{n!==null&&(o.viewState.solarRadiationHeatMapMaxValue=n)})}})]})}),Pjn=be.memo(()=>{const t=$t(),e=M(VBe);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.SamplingFrequency",t)+":"}),h.jsx(Sn,{min:1,max:60,step:1,style:{width:60},precision:0,value:e,formatter:n=>Number(n).toFixed(0),onChange:n=>{n!==null&&M.getState().set(o=>{o.world.timesPerHour=n})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.TimesPerHour",t)})]})}),Cjn=be.memo(()=>{const t=$t(),e=M(M8t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{paddingRight:"10px"},children:Y.t("menu.solarPanel.VisibilityGridCellSize",t)+":"}),h.jsx(Sn,{min:.1,max:5,step:.1,style:{width:60},precision:1,value:e??.2,onChange:n=>{n!==null&&M.getState().set(o=>{o.world.solarPanelVisibilityGridCellSize=n})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("word.MeterAbbreviation",t)})]})}),Rjn=()=>[{key:"sut-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.SUT})},{key:"sut-simulation-sampling-days",label:h.jsx(pZ,{type:rs.SUT})},{key:"sut-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.SUT})}],Hjn=t=>{const e={lng:M.getState().language},n=dt.getState().setPrimitiveStore,o=M.getState().set,r=M.getState().selectNone,i=M.getState().countElementsByType,a=M.getState().countHeatmapCells,l=dt.getState().runDynamicSimulation,s=dt.getState().runStaticSimulation,c=M.getState().world.noAnimationForHeatmapSimulation,u=M.getState().elements,d=M.getState().loggable,f=ye.hasMovingParts(u),p=[],g=()=>{s||gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),n("runStaticSimulation",!s),d&&o(O=>{O.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Static)",timestamp:new Date().getTime()}})},100)},A=()=>{l||gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),n("runDynamicSimulation",!l),d&&o(O=>{O.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Dynamic)",timestamp:new Date().getTime()}})},100)},y=()=>{a()>sje?yi.confirm({title:Y.t("message.CalculationMayBeSlowDoYouWantToContinue",e)+" ("+Y.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",e)+")",icon:h.jsx(Zx,{}),onOk:()=>{S()},onCancel:()=>{},okText:`${Y.t("word.Yes",e)}`,cancelText:`${Y.t("word.No",e)}`}):S()},S=()=>{!c||f?A():g()},C=()=>{if(i(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{d&&o(V=>{V.actionInfo={name:"Collect Daily Data for Sensors",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailyLightSensor=!0})},100)},P=()=>{if(i(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{d&&o(V=>{V.actionInfo={name:"Collect Yearly Data for Sensors",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlyLightSensor=!0})},100)},v=()=>{const O=bX(u,M.getState().countElementsByType,M.getState().getChildrenOfType);if(O.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",e));return}if(O.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let V;switch(O.buildingCompletion){case Uc.WALL_DISJOINED:V=Y.t("message.WallsAreNotConnected",e);break;case Uc.WALL_EMPTY:V=Y.t("message.BuildingContainsEmptyWall",e);break;case Uc.ROOF_MISSING:V=Y.t("message.BuildingRoofMissing",e);break;default:V=Y.t("message.UnknownErrors",e)}co(Y.t("message.SimulationWillNotStartDueToErrors",e)+": "+V);return}O.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",e)),gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),d&&o(V=>{V.actionInfo={name:"Analyze Daily Building Energy",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.runDailyThermalSimulation=!0,V.simulationInProgress=!0})},100)},T=()=>{const O=bX(u,M.getState().countElementsByType,M.getState().getChildrenOfType);if(O.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",e));return}if(O.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let V;switch(O.buildingCompletion){case Uc.WALL_DISJOINED:V=Y.t("message.WallsAreNotConnected",e);break;case Uc.WALL_EMPTY:V=Y.t("message.BuildingContainsEmptyWall",e);break;case Uc.ROOF_MISSING:V=Y.t("message.BuildingRoofMissing",e);break;default:V=Y.t("message.UnknownErrors",e)}co(Y.t("message.SimulationWillNotStartDueToErrors",e)+": "+V);return}O.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",e)),gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),dt.getState().set(V=>{V.runYearlyThermalSimulation=!0,V.simulationInProgress=!0}),d&&o(V=>{V.actionInfo={name:"Analyze Yearly Building Energy",timestamp:new Date().getTime()}})},100)},w=()=>{if(i(z.SolarPanel)===0){gn(Y.t("analysisManager.NoSolarPanelForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyPvIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForSolarPanels=!0})},100)},x=()=>{if(i(z.SolarPanel)===0){gn(Y.t("analysisManager.NoSolarPanelForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyPvIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForSolarPanels=!0})},100)},b=()=>{if(M.getState().countObservers()===0){gn(Y.t("analysisManager.NoObserverForVisibilityAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{dt.getState().set(V=>{V.runSolarPanelVisibilityAnalysis=!V.runSolarPanelVisibilityAnalysis,V.simulationInProgress=!0}),d&&o(V=>{V.actionInfo={name:"Run Visibility Analysis For Solar Panels",timestamp:new Date().getTime()}})},100)},R=()=>{if(i(z.ParabolicTrough)===0){gn(Y.t("analysisManager.NoParabolicTroughForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyParabolicTroughIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForParabolicTroughs=!0})},100)},H=()=>{if(i(z.ParabolicTrough)===0){gn(Y.t("analysisManager.NoParabolicTroughForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyParabolicTroughIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForParabolicTroughs=!0})},100)},F=()=>{if(i(z.ParabolicDish)===0){gn(Y.t("analysisManager.NoParabolicDishForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyParabolicDishIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForParabolicDishes=!0})},100)},E=()=>{if(i(z.ParabolicDish)===0){gn(Y.t("analysisManager.NoParabolicDishForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyParabolicDishIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForParabolicDishes=!0})},100)},N=()=>{if(i(z.FresnelReflector)===0){gn(Y.t("analysisManager.NoFresnelReflectorForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyFresnelReflectorIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForFresnelReflectors=!0})},100)},U=()=>{if(i(z.FresnelReflector)===0){gn(Y.t("analysisManager.NoFresnelReflectorForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyFresnelReflectorIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForFresnelReflectors=!0})},100)},W=()=>{if(i(z.Heliostat)===0){gn(Y.t("analysisManager.NoHeliostatForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyHeliostatIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForHeliostats=!0})},100)},k=()=>{if(i(z.Heliostat)===0){gn(Y.t("analysisManager.NoHeliostatForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyHeliostatIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForHeliostats=!0})},100)},D=()=>{if(M.getState().countSolarStructuresByType(Dn.UpdraftTower)===0){gn(Y.t("analysisManager.NoSolarUpdraftTowerForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyUpdraftTowerIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForUpdraftTower=!0})},100)},L=()=>{if(M.getState().countSolarStructuresByType(Dn.UpdraftTower)===0){gn(Y.t("analysisManager.NoSolarUpdraftTowerForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyUpdraftTowerIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForUpdraftTower=!0})},100)},j=[];j.push({key:"solar-radiation-heatmap-grid-cell-size",label:h.jsx(MN,{type:rs.BUILDING})}),j.push({key:"solar-radiation-heatmap-max-value",label:h.jsx(Tjn,{})}),ye.hasHeliostatOrFresnelReflectors(u)&&j.push({key:"solar-radiation-heatmap-reflection-only",label:h.jsx(cae,{selector:xge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForHeatmapSimulation=O})},children:Y.t("menu.physics.ReflectionHeatmap",e)+":"})}),f||j.push({key:"solar-radiation-heatmap-no-animation",label:h.jsx(cae,{selector:Rge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForHeatmapSimulation=O})},children:Y.t("menu.physics.SolarRadiationHeatmapNoAnimation",e)+":"})}),p.push({key:"physics-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.physicsSubMenu",e)}),children:[{key:"daily-solar-radiation-heatmap",label:h.jsx(an,{noPadding:!0,onClick:y,children:Y.t("menu.physics.DailySolarRadiationHeatmap",e)})},{key:"solar-radiation-heatmap-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.physics.SolarRadiationHeatmapOptions",e)}),children:j}]});const B=[];return B.push({key:"sensor-simulation-sampling-frequency",label:h.jsx(Pjn,{})}),f||B.push({key:"sensor-simulation-no-animation",label:h.jsx(cae,{selector:Hge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForSensorDataCollection=O})},children:Y.t("menu.sensor.SensorSimulationNoAnimation",e)+":"})}),t.sensorCount>0&&p.push({key:"sensor-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.sensorSubMenu",e)}),children:[{key:"sensor-collect-daily-data",label:h.jsx(an,{noPadding:!0,onClick:C,children:Y.t("menu.sensor.CollectDailyData",e)})},{key:"sensor-collect-yearly-data",label:h.jsx(an,{noPadding:!0,onClick:P,children:Y.t("menu.sensor.CollectYearlyData",e)})},{key:"sensor-simulation-options-submenu-2",label:h.jsx(an,{noPadding:!0,children:Y.t("word.Options",e)}),children:B}]}),t.wallCount>0&&p.push({key:"buildings-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingSubMenu",e)}),children:[{key:"building-energy-daily-data",label:h.jsx(an,{noPadding:!0,onClick:v,children:Y.t("menu.building.AnalyzeDailyBuildingEnergy",e)})},{key:"building-energy-yearly-data",label:h.jsx(an,{noPadding:!0,onClick:T,children:Y.t("menu.building.AnalyzeYearlyBuildingEnergy",e)})},{key:"building-energy-analysis-options-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.building.EnergyAnalysisOptions",e)}),children:vjn()}]}),t.solarPanelCount>0&&p.push({key:"solar-panels-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanelSubMenu",e)}),children:[{key:"solar-panel-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:w,children:Y.t("menu.solarPanel.AnalyzeDailyYield",e)})},{key:"solar-panel-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:x,children:Y.t("menu.solarPanel.AnalyzeYearlyYield",e)})},{key:"solar-panel-energy-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanel.EnergyAnalysisOptions",e)}),children:Sjn(f)},{key:"solar-panel-visibility",label:h.jsx(an,{noPadding:!0,onClick:b,children:Y.t("menu.solarPanel.AnalyzeVisibility",e)})},{key:"solar-panel-visibility-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanel.VisibilityAnalysisOptions",e)}),children:[{key:"solar-panel-visibility-grid-cell-size",label:h.jsx(Cjn,{})}]}]}),t.parabolicTroughCount>0&&p.push({key:"parabolic-troughs-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.parabolicTroughSubMenu",e)}),children:[{key:"parabolic-trough-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:R,children:Y.t("menu.parabolicTrough.AnalyzeDailyYield",e)})},{key:"parabolic-trough-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:H,children:Y.t("menu.parabolicTrough.AnalyzeYearlyYield",e)})},{key:"parabolic-trough-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("parabolic-trough")}]}),t.parabolicDishCount>0&&p.push({key:"parabolic-dishes-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.parabolicDishSubMenu",e)}),children:[{key:"parabolic-dish-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:F,children:Y.t("menu.parabolicDish.AnalyzeDailyYield",e)})},{key:"parabolic-dish-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:E,children:Y.t("menu.parabolicDish.AnalyzeYearlyYield",e)})},{key:"parabolic-dish-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("parabolic-dish")}]}),t.fresnelReflectorCount>0&&p.push({key:"fresnel-reflector-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.fresnelReflectorSubMenu",e)}),children:[{key:"fresnel-reflector-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:N,children:Y.t("menu.fresnelReflector.AnalyzeDailyYield",e)})},{key:"fresnel-reflector-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:U,children:Y.t("menu.fresnelReflector.AnalyzeYearlyYield",e)})},{key:"fresnel-reflector-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("fresnel-reflector")}]}),t.heliostatCount>0&&p.push({key:"heliostat-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.heliostatSubMenu",e)}),children:[{key:"heliostat-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:W,children:Y.t("menu.heliostat.AnalyzeDailyYield",e)})},{key:"heliostat-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:k,children:Y.t("menu.heliostat.AnalyzeYearlyYield",e)})},{key:"heliostat-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("heliostat-analysis")}]}),t.solarUpdraftTowerCount>0&&p.push({key:"solar-updraft-tower-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarUpdraftTowerSubMenu",e)}),children:[{key:"solar-updraft-tower-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:D,children:Y.t("menu.solarUpdraftTower.AnalyzeDailyYield",e)})},{key:"solar-updraft-tower-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:L,children:Y.t("menu.solarUpdraftTower.AnalyzeYearlyYield",e)})},{key:"solar-updraft-tower-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:Rjn()}]}),p};/** +`,t.getElementsByTagName("head")[0].appendChild(e)),t.body&&nZe(t.body,"react-draggable-transparent-selection")}function zNn(t){if(t)try{if(t.body&&oZe(t.body,"react-draggable-transparent-selection"),t.selection)t.selection.empty();else{const e=(t.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function nZe(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(t.className+=" ".concat(e))}function oZe(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var w3={};Object.defineProperty(w3,"__esModule",{value:!0});w3.canDragX=FNn;w3.canDragY=kNn;w3.createCoreData=WNn;w3.createDraggableData=NNn;w3.getBoundPosition=DNn;w3.getControlPosition=LNn;w3.snapToGrid=ENn;var X1=A3,sC=y0;function DNn(t,e,n){if(!t.props.bounds)return[e,n];let{bounds:o}=t.props;o=typeof o=="string"?o:UNn(o);const r=s2e(t);if(typeof o=="string"){const{ownerDocument:i}=r,a=i.defaultView;let l;if(o==="parent"?l=r.parentNode:l=i.querySelector(o),!(l instanceof a.HTMLElement))throw new Error('Bounds selector "'+o+'" could not find an element.');const s=l,c=a.getComputedStyle(r),u=a.getComputedStyle(s);o={left:-r.offsetLeft+(0,X1.int)(u.paddingLeft)+(0,X1.int)(c.marginLeft),top:-r.offsetTop+(0,X1.int)(u.paddingTop)+(0,X1.int)(c.marginTop),right:(0,sC.innerWidth)(s)-(0,sC.outerWidth)(r)-r.offsetLeft+(0,X1.int)(u.paddingRight)-(0,X1.int)(c.marginRight),bottom:(0,sC.innerHeight)(s)-(0,sC.outerHeight)(r)-r.offsetTop+(0,X1.int)(u.paddingBottom)-(0,X1.int)(c.marginBottom)}}return(0,X1.isNum)(o.right)&&(e=Math.min(e,o.right)),(0,X1.isNum)(o.bottom)&&(n=Math.min(n,o.bottom)),(0,X1.isNum)(o.left)&&(e=Math.max(e,o.left)),(0,X1.isNum)(o.top)&&(n=Math.max(n,o.top)),[e,n]}function ENn(t,e,n){const o=Math.round(e/t[0])*t[0],r=Math.round(n/t[1])*t[1];return[o,r]}function FNn(t){return t.props.axis==="both"||t.props.axis==="x"}function kNn(t){return t.props.axis==="both"||t.props.axis==="y"}function LNn(t,e,n){const o=typeof e=="number"?(0,sC.getTouch)(t,e):null;if(typeof e=="number"&&!o)return null;const r=s2e(n),i=n.props.offsetParent||r.offsetParent||r.ownerDocument.body;return(0,sC.offsetXYFromParent)(o||t,i,n.props.scale)}function WNn(t,e,n){const o=!(0,X1.isNum)(t.lastX),r=s2e(t);return o?{node:r,deltaX:0,deltaY:0,lastX:e,lastY:n,x:e,y:n}:{node:r,deltaX:e-t.lastX,deltaY:n-t.lastY,lastX:t.lastX,lastY:t.lastY,x:e,y:n}}function NNn(t,e){const n=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/n,y:t.state.y+e.deltaY/n,deltaX:e.deltaX/n,deltaY:e.deltaY/n,lastX:t.state.x,lastY:t.state.y}}function UNn(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}function s2e(t){const e=t.findDOMNode();if(!e)throw new Error(": Unmounted during event!");return e}var VQ={},_Q={};Object.defineProperty(_Q,"__esModule",{value:!0});_Q.default=jNn;function jNn(){}Object.defineProperty(VQ,"__esModule",{value:!0});VQ.default=void 0;var dae=YNn(m),Dp=c2e(Bq),BNn=c2e(Hd),Xf=y0,I4=w3,fae=A3,$z=c2e(_Q);function c2e(t){return t&&t.__esModule?t:{default:t}}function rZe(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,n=new WeakMap;return(rZe=function(o){return o?n:e})(t)}function YNn(t,e){if(t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var n=rZe(e);if(n&&n.has(t))return n.get(t);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var a=r?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(o,i,a):o[i]=t[i]}return o.default=t,n&&n.set(t,o),o}function Gh(t,e,n){return e=ONn(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ONn(t){var e=VNn(t,"string");return typeof e=="symbol"?e:String(e)}function VNn(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const e2={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let z4=e2.mouse,GQ=class extends dae.Component{constructor(){super(...arguments),Gh(this,"dragging",!1),Gh(this,"lastX",NaN),Gh(this,"lastY",NaN),Gh(this,"touchIdentifier",null),Gh(this,"mounted",!1),Gh(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const n=this.findDOMNode();if(!n||!n.ownerDocument||!n.ownerDocument.body)throw new Error(" not mounted on DragStart!");const{ownerDocument:o}=n;if(this.props.disabled||!(e.target instanceof o.defaultView.Node)||this.props.handle&&!(0,Xf.matchesSelectorAndParentsTo)(e.target,this.props.handle,n)||this.props.cancel&&(0,Xf.matchesSelectorAndParentsTo)(e.target,this.props.cancel,n))return;e.type==="touchstart"&&e.preventDefault();const r=(0,Xf.getTouchIdentifier)(e);this.touchIdentifier=r;const i=(0,I4.getControlPosition)(e,r,this);if(i==null)return;const{x:a,y:l}=i,s=(0,I4.createCoreData)(this,a,l);(0,$z.default)("DraggableCore: handleDragStart: %j",s),(0,$z.default)("calling",this.props.onStart),!(this.props.onStart(e,s)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Xf.addUserSelectStyles)(o),this.dragging=!0,this.lastX=a,this.lastY=l,(0,Xf.addEvent)(o,z4.move,this.handleDrag),(0,Xf.addEvent)(o,z4.stop,this.handleDragStop))}),Gh(this,"handleDrag",e=>{const n=(0,I4.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:o,y:r}=n;if(Array.isArray(this.props.grid)){let l=o-this.lastX,s=r-this.lastY;if([l,s]=(0,I4.snapToGrid)(this.props.grid,l,s),!l&&!s)return;o=this.lastX+l,r=this.lastY+s}const i=(0,I4.createCoreData)(this,o,r);if((0,$z.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const s=document.createEvent("MouseEvents");s.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(s)}return}this.lastX=o,this.lastY=r}),Gh(this,"handleDragStop",e=>{if(!this.dragging)return;const n=(0,I4.getControlPosition)(e,this.touchIdentifier,this);if(n==null)return;let{x:o,y:r}=n;if(Array.isArray(this.props.grid)){let s=o-this.lastX||0,c=r-this.lastY||0;[s,c]=(0,I4.snapToGrid)(this.props.grid,s,c),o=this.lastX+s,r=this.lastY+c}const i=(0,I4.createCoreData)(this,o,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Xf.removeUserSelectStyles)(l.ownerDocument),(0,$z.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,$z.default)("DraggableCore: Removing handlers"),(0,Xf.removeEvent)(l.ownerDocument,z4.move,this.handleDrag),(0,Xf.removeEvent)(l.ownerDocument,z4.stop,this.handleDragStop))}),Gh(this,"onMouseDown",e=>(z4=e2.mouse,this.handleDragStart(e))),Gh(this,"onMouseUp",e=>(z4=e2.mouse,this.handleDragStop(e))),Gh(this,"onTouchStart",e=>(z4=e2.touch,this.handleDragStart(e))),Gh(this,"onTouchEnd",e=>(z4=e2.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,Xf.addEvent)(e,e2.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:n}=e;(0,Xf.removeEvent)(n,e2.mouse.move,this.handleDrag),(0,Xf.removeEvent)(n,e2.touch.move,this.handleDrag),(0,Xf.removeEvent)(n,e2.mouse.stop,this.handleDragStop),(0,Xf.removeEvent)(n,e2.touch.stop,this.handleDragStop),(0,Xf.removeEvent)(e,e2.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Xf.removeUserSelectStyles)(n)}}findDOMNode(){var e,n;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(n=this.props)===null||n===void 0||(n=n.nodeRef)===null||n===void 0?void 0:n.current:BNn.default.findDOMNode(this)}render(){return dae.cloneElement(dae.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};VQ.default=GQ;Gh(GQ,"displayName","DraggableCore");Gh(GQ,"propTypes",{allowAnyClick:Dp.default.bool,children:Dp.default.node.isRequired,disabled:Dp.default.bool,enableUserSelectHack:Dp.default.bool,offsetParent:function(t,e){if(t[e]&&t[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Dp.default.arrayOf(Dp.default.number),handle:Dp.default.string,cancel:Dp.default.string,nodeRef:Dp.default.object,onStart:Dp.default.func,onDrag:Dp.default.func,onStop:Dp.default.func,onMouseDown:Dp.default.func,scale:Dp.default.number,className:fae.dontSetMe,style:fae.dontSetMe,transform:fae.dontSetMe});Gh(GQ,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return s.default}}),t.default=void 0;var e=f(m),n=u(Bq),o=u(Hd),r=u(cNn),i=y0,a=w3,l=A3,s=u(VQ),c=u(_Q);function u(C){return C&&C.__esModule?C:{default:C}}function d(C){if(typeof WeakMap!="function")return null;var P=new WeakMap,v=new WeakMap;return(d=function(T){return T?v:P})(C)}function f(C,P){if(C&&C.__esModule)return C;if(C===null||typeof C!="object"&&typeof C!="function")return{default:C};var v=d(P);if(v&&v.has(C))return v.get(C);var T={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var x in C)if(x!=="default"&&Object.prototype.hasOwnProperty.call(C,x)){var b=w?Object.getOwnPropertyDescriptor(C,x):null;b&&(b.get||b.set)?Object.defineProperty(T,x,b):T[x]=C[x]}return T.default=C,v&&v.set(C,T),T}function p(){return p=Object.assign?Object.assign.bind():function(C){for(var P=1;P{if((0,c.default)("Draggable: onDragStart: %j",T),this.props.onStart(v,(0,a.createDraggableData)(this,T))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),g(this,"onDrag",(v,T)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",T);const w=(0,a.createDraggableData)(this,T),x={x:w.x,y:w.y,slackX:0,slackY:0};if(this.props.bounds){const{x:R,y:H}=x;x.x+=this.state.slackX,x.y+=this.state.slackY;const[F,E]=(0,a.getBoundPosition)(this,x.x,x.y);x.x=F,x.y=E,x.slackX=this.state.slackX+(R-x.x),x.slackY=this.state.slackY+(H-x.y),w.x=x.x,w.y=x.y,w.deltaX=x.x-this.state.x,w.deltaY=x.y-this.state.y}if(this.props.onDrag(v,w)===!1)return!1;this.setState(x)}),g(this,"onDragStop",(v,T)=>{if(!this.state.dragging||this.props.onStop(v,(0,a.createDraggableData)(this,T))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",T);const x={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:R,y:H}=this.props.position;x.x=R,x.y=H}this.setState(x)}),this.state={dragging:!1,dragged:!1,x:P.position?P.position.x:P.defaultPosition.x,y:P.position?P.position.y:P.defaultPosition.y,prevPropsPosition:{...P.position},slackX:0,slackY:0,isElementSVG:!1},P.position&&!(P.onDrag||P.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var P,v;return(P=(v=this.props)===null||v===void 0||(v=v.nodeRef)===null||v===void 0?void 0:v.current)!==null&&P!==void 0?P:o.default.findDOMNode(this)}render(){const{axis:P,bounds:v,children:T,defaultPosition:w,defaultClassName:x,defaultClassNameDragging:b,defaultClassNameDragged:R,position:H,positionOffset:F,scale:E,...N}=this.props;let U={},W=null;const D=!!!H||this.state.dragging,L=H||w,j={x:(0,a.canDragX)(this)&&D?this.state.x:L.x,y:(0,a.canDragY)(this)&&D?this.state.y:L.y};this.state.isElementSVG?W=(0,i.createSVGTransform)(j,F):U=(0,i.createCSSTransform)(j,F);const B=(0,r.default)(T.props.className||"",x,{[b]:this.state.dragging,[R]:this.state.dragged});return e.createElement(s.default,p({},N,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(T),{className:B,style:{...T.props.style,...U},transform:W}))}}t.default=S,g(S,"displayName","Draggable"),g(S,"propTypes",{...s.default.propTypes,axis:n.default.oneOf(["both","x","y","none"]),bounds:n.default.oneOfType([n.default.shape({left:n.default.number,right:n.default.number,top:n.default.number,bottom:n.default.number}),n.default.string,n.default.oneOf([!1])]),defaultClassName:n.default.string,defaultClassNameDragging:n.default.string,defaultClassNameDragged:n.default.string,defaultPosition:n.default.shape({x:n.default.number,y:n.default.number}),positionOffset:n.default.shape({x:n.default.oneOfType([n.default.number,n.default.string]),y:n.default.oneOfType([n.default.number,n.default.string])}),position:n.default.shape({x:n.default.number,y:n.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),g(S,"defaultProps",{...s.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(qQe);const{default:iZe,DraggableCore:_Nn}=qQe;OQ.exports=iZe;OQ.exports.default=iZe;OQ.exports.DraggableCore=_Nn;var GNn=OQ.exports;const Bi=Wi(GNn),iPe=t=>{t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296};let XNn=class{constructor(e){this.dictionaries=void 0,this.length=void 0,this.separator=void 0,this.style=void 0,this.seed=void 0;const{length:n,separator:o,dictionaries:r,style:i,seed:a}=e;this.dictionaries=r,this.separator=o,this.length=n,this.style=i,this.seed=a}generate(){if(!this.dictionaries)throw new Error('Cannot find any dictionary. Please provide at least one, or leave the "dictionary" field empty in the config object');if(this.length<=0)throw new Error("Invalid length provided");if(this.length>this.dictionaries.length)throw new Error(`The length cannot be bigger than the number of dictionaries. +Length provided: ${this.length}. Number of dictionaries provided: ${this.dictionaries.length}`);let e=this.seed;return this.dictionaries.slice(0,this.length).reduce((n,o)=>{let r;e?(r=(a=>{if(typeof a=="string"){const l=a.split("").map(c=>c.charCodeAt(0)).reduce((c,u)=>c+u,1),s=Math.floor(Number(l));return iPe(s)}return iPe(a)})(e),e=4294967296*r):r=Math.random();let i=o[Math.floor(r*o.length)]||"";if(this.style==="lowerCase")i=i.toLowerCase();else if(this.style==="capital"){const[a,...l]=i.split("");i=a.toUpperCase()+l.join("")}else this.style==="upperCase"&&(i=i.toUpperCase());return n?`${n}${this.separator}${i}`:`${i}`},"")}};const aPe={separator:"_",dictionaries:[]},JNn=t=>{const e=[...t&&t.dictionaries||aPe.dictionaries],n={...aPe,...t,length:t&&t.length||e.length,dictionaries:e};if(!t||!t.dictionaries||!t.dictionaries.length)throw new Error('A "dictionaries" array must be provided. This is a breaking change introduced starting from Unique Name Generator v4. Read more about the breaking change here: https://github.com/andreasonny83/unique-names-generator#migration-guide');return new XNn(n).generate()};var KNn=["aardvark","aardwolf","albatross","alligator","alpaca","amphibian","anaconda","angelfish","anglerfish","ant","anteater","antelope","antlion","ape","aphid","armadillo","asp","baboon","badger","bandicoot","barnacle","barracuda","basilisk","bass","bat","bear","beaver","bedbug","bee","beetle","bird","bison","blackbird","boa","boar","bobcat","bobolink","bonobo","booby","bovid","bug","butterfly","buzzard","camel","canid","canidae","capybara","cardinal","caribou","carp","cat","caterpillar","catfish","catshark","cattle","centipede","cephalopod","chameleon","cheetah","chickadee","chicken","chimpanzee","chinchilla","chipmunk","cicada","clam","clownfish","cobra","cockroach","cod","condor","constrictor","coral","cougar","cow","coyote","crab","crane","crawdad","crayfish","cricket","crocodile","crow","cuckoo","damselfly","deer","dingo","dinosaur","dog","dolphin","donkey","dormouse","dove","dragon","dragonfly","duck","eagle","earthworm","earwig","echidna","eel","egret","elephant","elk","emu","ermine","falcon","felidae","ferret","finch","firefly","fish","flamingo","flea","fly","flyingfish","fowl","fox","frog","galliform","gamefowl","gayal","gazelle","gecko","gerbil","gibbon","giraffe","goat","goldfish","goose","gopher","gorilla","grasshopper","grouse","guan","guanaco","guineafowl","gull","guppy","haddock","halibut","hamster","hare","harrier","hawk","hedgehog","heron","herring","hippopotamus","hookworm","hornet","horse","hoverfly","hummingbird","hyena","iguana","impala","jackal","jaguar","jay","jellyfish","junglefowl","kangaroo","kingfisher","kite","kiwi","koala","koi","krill","ladybug","lamprey","landfowl","lark","leech","lemming","lemur","leopard","leopon","limpet","lion","lizard","llama","lobster","locust","loon","louse","lungfish","lynx","macaw","mackerel","magpie","mammal","manatee","mandrill","marlin","marmoset","marmot","marsupial","marten","mastodon","meadowlark","meerkat","mink","minnow","mite","mockingbird","mole","mollusk","mongoose","monkey","moose","mosquito","moth","mouse","mule","muskox","narwhal","newt","nightingale","ocelot","octopus","opossum","orangutan","orca","ostrich","otter","owl","ox","panda","panther","parakeet","parrot","parrotfish","partridge","peacock","peafowl","pelican","penguin","perch","pheasant","pig","pigeon","pike","pinniped","piranha","planarian","platypus","pony","porcupine","porpoise","possum","prawn","primate","ptarmigan","puffin","puma","python","quail","quelea","quokka","rabbit","raccoon","rat","rattlesnake","raven","reindeer","reptile","rhinoceros","roadrunner","rodent","rook","rooster","roundworm","sailfish","salamander","salmon","sawfish","scallop","scorpion","seahorse","shark","sheep","shrew","shrimp","silkworm","silverfish","skink","skunk","sloth","slug","smelt","snail","snake","snipe","sole","sparrow","spider","spoonbill","squid","squirrel","starfish","stingray","stoat","stork","sturgeon","swallow","swan","swift","swordfish","swordtail","tahr","takin","tapir","tarantula","tarsier","termite","tern","thrush","tick","tiger","tiglon","toad","tortoise","toucan","trout","tuna","turkey","turtle","tyrannosaurus","unicorn","urial","vicuna","viper","vole","vulture","wallaby","walrus","warbler","wasp","weasel","whale","whippet","whitefish","wildcat","wildebeest","wildfowl","wolf","wolverine","wombat","woodpecker","worm","wren","xerinae","yak","zebra"],qNn=["amaranth","amber","amethyst","apricot","aqua","aquamarine","azure","beige","black","blue","blush","bronze","brown","chocolate","coffee","copper","coral","crimson","cyan","emerald","fuchsia","gold","gray","green","harlequin","indigo","ivory","jade","lavender","lime","magenta","maroon","moccasin","olive","orange","peach","pink","plum","purple","red","rose","salmon","sapphire","scarlet","silver","tan","teal","tomato","turquoise","violet","white","yellow"];const{Option:W1}=Uo,$Nn=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),[r,i]=m.useState(M.getState().modelType),[a,l]=m.useState(M.getState().modelAuthor??JNn({dictionaries:[qNn,KNn],separator:" ",style:"capital"})),[s,c]=m.useState(M.getState().modelLabel??M.getState().cloudFile??null),[u,d]=m.useState(M.getState().modelDescription),[f,p]=m.useState(!1),[g,A]=m.useState({left:0,top:0,bottom:0,right:0}),y=m.useRef(null),S=m.useRef(null),{TextArea:C}=jl,P={lng:o};m.useEffect(()=>{var b;(b=S.current)==null||b.focus()},[]);const v=(b,R)=>{if(y.current){const{clientWidth:H,clientHeight:F}=window.document.documentElement,E=y.current.getBoundingClientRect();A({left:-E.left+R.x,right:H-(E.right-R.x),top:-E.top+R.y,bottom:F-((E==null?void 0:E.bottom)-R.y)})}},T=()=>{t(!1)},w=()=>{dt.getState().set(b=>{b.publishOnModelsMapFlag=!0}),e(b=>{b.modelType=r,b.modelAuthor=a,b.modelLabel=s,b.modelDescription=u}),dt.getState().setChanged(!0),n&&e(b=>{b.actionInfo={name:"Publish on Map of Models",timestamp:new Date().getTime()}}),t(!1)},{t:x}=Xl();return h.jsxs(yi,{width:560,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:x("menu.file.PublishOnModelsMap",P)}),footer:[h.jsx(io,{onClick:T,children:x("word.Cancel",P)},"Cancel"),h.jsx(io,{type:"primary",ref:S,onClick:w,disabled:!a||!s,children:x("word.OK",P)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:b=>h.jsx(Bi,{disabled:!f,bounds:g,onStart:(R,H)=>v(R,H),children:h.jsx("div",{ref:y,children:b})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,children:x("shared.ModelType",P)+":"}),h.jsx(Ke,{span:16,children:h.jsxs(Uo,{style:{width:"100%"},value:r,onChange:b=>{i(b)},children:[h.jsxs(W1,{value:fa.UNKNOWN,children:[h.jsx("img",{alt:"Building",width:24,src:XQe,style:{marginRight:"8px"}}),x("word.Unknown",P)]},fa.UNKNOWN),h.jsxs(W1,{value:fa.UNDER_CONSTRUCTION,children:[h.jsx("img",{alt:"Building",width:24,src:GQe,style:{marginRight:"8px"}}),x("word.UnderConstruction",P)]},fa.UNDER_CONSTRUCTION),h.jsxs(W1,{value:fa.RESIDENTIAL_BUILDING,children:[h.jsx("img",{alt:"Residential Building",width:24,src:WQe,style:{marginRight:"8px"}}),x("word.ResidentialBuilding",P)]},fa.RESIDENTIAL_BUILDING),h.jsxs(W1,{value:fa.COMMERCIAL_BUILDING,children:[h.jsx("img",{alt:"Commercial Building",width:24,src:NQe,style:{marginRight:"8px"}}),x("word.CommercialBuilding",P)]},fa.COMMERCIAL_BUILDING),h.jsxs(W1,{value:fa.SCHOOL_BUILDING,children:[h.jsx("img",{alt:"School Building",width:24,src:UQe,style:{marginRight:"8px"}}),x("word.SchoolBuilding",P)]},fa.SCHOOL_BUILDING),h.jsxs(W1,{value:fa.TOURIST_ATTRACTION,children:[h.jsx("img",{alt:"Tourist Attraction",width:24,src:jQe,style:{marginRight:"8px"}}),x("word.TouristAttraction",P)]},fa.TOURIST_ATTRACTION),h.jsxs(W1,{value:fa.PHOTOVOLTAIC,children:[h.jsx("img",{alt:"Photovoltaic",width:24,src:BQe,style:{marginRight:"8px"}}),x("word.Photovoltaic",P)]},fa.PHOTOVOLTAIC),h.jsxs(W1,{value:fa.PARABOLIC_DISH,children:[h.jsx("img",{alt:"Parabolic Dish",width:24,src:YQe,style:{marginRight:"8px"}}),x("shared.ParabolicDishElement",P)]},fa.PARABOLIC_DISH),h.jsxs(W1,{value:fa.PARABOLIC_TROUGH,children:[h.jsx("img",{alt:"Parabolic Trough",width:24,src:OQe,style:{marginRight:"8px"}}),x("shared.ParabolicTroughElement",P)]},fa.PARABOLIC_TROUGH),h.jsxs(W1,{value:fa.FRESNEL_REFLECTOR,children:[h.jsx("img",{alt:"Fresnel Reflector",width:24,src:VQe,style:{marginRight:"8px"}}),x("shared.FresnelReflectorElement",P)]},fa.FRESNEL_REFLECTOR),h.jsxs(W1,{value:fa.SOLAR_POWER_TOWER,children:[h.jsx("img",{alt:"Heliostat",width:24,src:_Qe,style:{marginRight:"8px"}}),x("shared.HeliostatElement",P)]},fa.SOLAR_POWER_TOWER),h.jsxs(W1,{value:fa.WIND_TURBINE,children:[h.jsx("img",{alt:"Wind Turbine",width:24,src:JQe,style:{marginRight:"8px"}}),Y.t("word.WindPower",P)]},fa.WIND_TURBINE),h.jsxs(W1,{value:fa.COLOCATION_PROJECTS,children:[h.jsx("img",{alt:"Colocation Projects",width:24,src:KQe,style:{marginRight:"8px"}}),Y.t("word.ColocationProjects",P)]},fa.COLOCATION_PROJECTS)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Publisher",P),":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:30,style:{width:"100%"},value:a??"",onKeyDown:b=>{if(!cR.test(b.key))return b.preventDefault(),!1},onChange:b=>{l(b.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Label",P),":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:50,style:{width:"100%"},value:s??"",onKeyDown:b=>{if(!cR.test(b.key))return b.preventDefault(),!1},onChange:b=>{c(b.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[x("word.Description",P),":",h.jsx("br",{}),h.jsxs("span",{style:{fontSize:"10px"},children:["(",x("word.MaximumCharacters",P),": 200)"]})]}),h.jsx(Ke,{span:16,children:h.jsx(C,{rows:5,maxLength:200,style:{width:"100%"},value:u??"",onChange:b=>{d(b.target.value)}})})]})]})},QNn=be.memo(()=>{const t=$t(),e=M(yp),n=M(zb),[o,r]=m.useState(!1),i=()=>{const a=new URLSearchParams(window.location.search).get("userid"),l=a===e.uid;e.uid&&n&&l?r(!0):e.uid?gn(a&&!l?Y.t("menu.file.YouCannotPublishAModelThatYouDoNotOwn",t)+".":Y.t("menu.file.YouMustSaveModelOnCloudBeforePublishingIt",t)+"."):gn(Y.t("menu.file.YouMustLogInToPublishYourModel",t)+".")};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t("menu.file.PublishOnModelsMap",t),"..."]}),o&&h.jsx($Nn,{setDialogVisible:r})]})}),ZNn=(t,e,n)=>{const o={lng:M.getState().language},r=M.getState().user,i=M.getState().cloudFile,a=M.getState().undoManager,l=M.getState().loggable,s=M.getState().set,c=()=>{a.clear(),dt.getState().set(S=>{S.createNewFileFlag=!0,S.openModelsMap=!1}),s(S=>{S.objectTypeToAdd=z.None,S.groupActionMode=!1,window.history.pushState({},document.title,t1),l&&(S.actionInfo={name:"Create New File",timestamp:new Date().getTime()})})},u=()=>{a.clear(),dt.getState().set(S=>{S.openLocalFileFlag=!0,S.openModelsMap=!1}),s(S=>{S.objectTypeToAdd=z.None,S.groupActionMode=!1,S.cloudFile=void 0,window.history.pushState({},document.title,t1),l&&(S.actionInfo={name:"Open Local File",timestamp:new Date().getTime()})})},d=()=>{dt.getState().set(S=>{S.saveLocalFileDialogVisible=!0}),l&&s(S=>{S.actionInfo={name:"Save as Local File",timestamp:new Date().getTime()}})},f=()=>{dt.getState().set(S=>{S.listCloudFilesFlag=!0,S.openModelsMap=!1}),s(S=>{S.selectedFloatingWindow="cloudFilePanel"}),l&&s(S=>{S.actionInfo={name:"List Cloud Files",timestamp:new Date().getTime()}})},p=()=>{dt.getState().setSaveCloudFileFlag(!0),l&&s(S=>{S.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}})},g=()=>{s(S=>{S.showCloudFileTitleDialogFlag=!S.showCloudFileTitleDialogFlag,S.showCloudFileTitleDialog=!0,l&&(S.actionInfo={name:"Save as Cloud File",timestamp:new Date().getTime()})})},A=()=>{n&&(NQt("screenshot.png",n.toDataURL("image/png")),l&&s(S=>{S.actionInfo={name:"Take Screenshot",timestamp:new Date().getTime()}}),dt.getState().set(S=>{S.openModelsMap=!1}))},y=[];return t||y.push({key:"create-new-file",label:h.jsxs(an,{noPadding:!0,onClick:c,children:[Y.t("menu.file.CreateNewFile",o),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+F)"]})]})}),t||y.push({key:"open-local-file",label:h.jsxs(an,{noPadding:!0,onClick:u,children:[Y.t("menu.file.OpenLocalFile",o),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+O)"]}),"..."]})}),y.push({key:"save-local-file",label:h.jsxs(an,{noPadding:!0,onClick:d,children:[Y.t("menu.file.SaveAsLocalFile",o),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+S)"]}),"..."]})}),r.uid&&!t&&y.push({key:"open-cloud-file",label:h.jsxs(an,{noPadding:!0,onClick:f,children:[Y.t("menu.file.OpenCloudFile",o),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+Shift+O)"]}),"..."]})}),r.uid&&i&&!t&&y.push({key:"save-cloud-file",label:h.jsxs(an,{noPadding:!0,onClick:p,children:[Y.t("menu.file.SaveCloudFile",o),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+Shift+S)"]}),"..."]})}),r.uid&&!t&&y.push({key:"save-as-cloud-file",label:h.jsx(an,{noPadding:!0,onClick:g,children:Y.t("menu.file.SaveAsCloudFile",o)})}),t||y.push({key:"publish-on-model-map",label:h.jsx(QNn,{})}),y.push({key:"take-screen-shot",label:h.jsx(an,{noPadding:!0,onClick:A,children:Y.t("menu.file.TakeScreenshot",o)})}),y},{Option:eUn}=Uo,aZe=be.memo(({saveAs:t,setDialogVisible:e})=>{const n=M(pn),o=M(oa),[r,i]=m.useState(M.getState().projectState.type??Ri.SOLAR_PANEL_ARRAY),[a,l]=m.useState(M.getState().projectState.title),[s,c]=m.useState(M.getState().projectState.description),[u,d]=m.useState(!1),[f,p]=m.useState({left:0,top:0,bottom:0,right:0}),g=m.useRef(null),{TextArea:A}=jl,y=$t(),S=(v,T)=>{if(g.current){const{clientWidth:w,clientHeight:x}=window.document.documentElement,b=g.current.getBoundingClientRect();p({left:-b.left+T.x,right:w-(b.right-T.x),top:-b.top+T.y,bottom:x-((b==null?void 0:b.bottom)-T.y)})}},C=()=>{e(!1)},P=()=>{dt.getState().set(v=>{t?v.saveProjectAsFlag=!0:v.createProjectFlag=!0}),dt.getState().set(v=>{v.projectType=r,v.projectTitle=a,v.projectDescription=s}),o&&n(v=>{v.actionInfo={name:t?"Save Project as":"Create New Project",timestamp:new Date().getTime(),details:{type:r,title:a,description:s}}}),e(!1)};return h.jsxs(yi,{width:560,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>d(!0),onMouseOut:()=>d(!1),children:`${Y.t(t?"menu.project.SaveProjectAs":"menu.project.CreateNewProject",y)}`}),footer:[h.jsx(io,{onClick:C,children:`${Y.t("word.Cancel",y)}`},"Cancel"),h.jsx(io,{type:"primary",onClick:P,disabled:!a,children:`${Y.t("word.OK",y)}`},"OK")],onCancel:()=>{e(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:v=>h.jsx(Bi,{disabled:!u,bounds:f,onStart:(T,w)=>S(T,w),children:h.jsx("div",{ref:g,children:v})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,children:Y.t("projectPanel.ProjectType",y)+":"}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{disabled:t,style:{width:"100%"},value:r,onChange:v=>{i(v)},children:h.jsx(eUn,{value:Ri.SOLAR_PANEL_ARRAY,children:`${Y.t("projectPanel.SolarPanelArray",y)}`},Ri.SOLAR_PANEL_ARRAY)})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[`${Y.t("word.Title",y)}`,":"]}),h.jsx(Ke,{span:16,children:h.jsx(jl,{maxLength:50,style:{width:"100%"},value:a??"",onKeyDown:v=>{if(!cR.test(v.key))return v.preventDefault(),!1},onChange:v=>{l(v.target.value)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsxs(Ke,{span:8,children:[`${Y.t("word.Description",y)}`,":",h.jsx("br",{}),h.jsxs("span",{style:{fontSize:"10px"},children:["(",`${Y.t("word.MaximumCharacters",y)}`,": 200)"]})]}),h.jsx(Ke,{span:16,children:h.jsx(A,{rows:5,maxLength:200,style:{width:"100%"},value:s??"",onChange:v=>{c(v.target.value)}})})]})]})}),tUn=()=>{const[t,e]=m.useState(!1),n=$t(),o=()=>{if(!M.getState().user.uid){gn(Y.t("menu.project.YouMustLogInToCreateProject",n)+".");return}e(!0),dt.getState().set(r=>{r.openModelsMap=!1})};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:o,children:[Y.t("menu.project.CreateNewProject",n),"..."]}),t&&h.jsx(aZe,{saveAs:!1,setDialogVisible:e})]})},nUn=()=>{const[t,e]=m.useState(!1),n=$t(),o=()=>{e(!0),dt.getState().set(r=>{r.openModelsMap=!1})};return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:!0,onClick:o,children:[Y.t("menu.project.SaveProjectAs",n),"..."]}),t&&h.jsx(aZe,{saveAs:!0,setDialogVisible:e})]})},oUn=()=>{const t={lng:M.getState().language},e=M.getState().user,n=M.getState().loggable,o=M.getState().projectState,r=M.getState().projectView,i=M.getState().set,a=()=>{if(!e.uid){gn(Y.t("menu.project.YouMustLogInToOpenProject",t)+".");return}dt.getState().set(s=>{s.showProjectsFlag=!0,s.openModelsMap=!1}),i(s=>{s.selectedFloatingWindow="projectListPanel"}),n&&i(s=>{s.actionInfo={name:"Open Project List",timestamp:new Date().getTime()}})},l=[];return l.push({key:"create-new-project",label:h.jsx(tUn,{})}),l.push({key:"list-project",label:h.jsxs(an,{noPadding:!0,onClick:a,children:[Y.t("menu.project.OpenProject",t),"..."]})}),r&&o.title&&e.uid&&l.push({key:"save-project-as",label:h.jsx(nUn,{})}),l},rUn=(t,e,n,o)=>{const r={lng:M.getState().language},i=M.getState().loggable,a=M.getState().set,l=()=>{t&&(M.getState().copyElementById(t.id),i&&a(p=>{p.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:t.id,elementType:t.type}}))},s=()=>{if(!(!t||t.type===z.Roof))if(t.locked)gn(Y.t("message.ThisElementIsLocked",r));else{const p=M.getState().removeElementById(t.id,!0);if(p.length===0)return;if(me.isElementTriggerAutoDeletion(p[0]))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",t.id);else{const g={name:"Cut",timestamp:Date.now(),deletedElements:p,selectedElementId:t.id,undo:()=>{const A=g.deletedElements;if(A.length===0)return;const y=A.find(S=>S.id===g.selectedElementId);y&&a(S=>{for(const C of A)S.elements.push(C);if(y.type===z.Wall){const C=y;let P=null,v=null;if(C.leftJoints.length>0&&(P=C.leftJoints[0]),C.rightJoints.length>0&&(v=C.rightJoints[0]),P||v)for(const T of S.elements)T.id===P&&T.type===z.Wall&&(T.rightJoints[0]=C.id),T.id===v&&T.type===z.Wall&&(T.leftJoints[0]=C.id)}})},redo:()=>{g.deletedElements&&g.deletedElements.length>0&&M.getState().removeElementById(g.deletedElements[0].id,!0)}};M.getState().addUndoable(g)}}},c=()=>{const p=M.getState().elementsToPaste;if(p&&p.length>0){const g=M.getState().pasteElementsByKey();if(g.length>0){const A={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify(g)),undo:()=>{for(const y of A.pastedElements)M.getState().removeElementById(y.id,!1)},redo:()=>{a(y=>{y.elements.push(...A.pastedElements),y.selectedElement=A.pastedElements[0]})}};M.getState().addUndoable(A)}}},u=()=>{if(n.hasUndo()){const p=n.undo();p&&gn(Y.t("menu.edit.Undo",r)+": "+p,gG),i&&a(g=>{g.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}},d=()=>{if(n.hasRedo()){const p=n.redo();p&&gn(Y.t("menu.edit.Redo",r)+": "+p,gG),i&&a(g=>{g.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}},f=[];return t&&f.push({key:"cut",label:h.jsxs(an,{noPadding:!0,onClick:s,children:[Y.t("word.Cut",r),h.jsxs(lh,{children:["(",o?"⌘":"Ctrl","+X)"]})]})}),t&&f.push({key:"copy",label:h.jsxs(an,{noPadding:!0,onClick:l,children:[Y.t("word.Copy",r),h.jsxs(lh,{children:["(",o?"⌘":"Ctrl","+C)"]})]})}),e&&f.push({key:"paste",label:h.jsxs(an,{noPadding:!0,onClick:c,children:[Y.t("word.Paste",r),h.jsxs(lh,{children:["(",o?"⌘":"Ctrl","+V)"]})]})}),n.hasUndo()&&f.push({key:"undo",label:h.jsxs(an,{noPadding:!0,onClick:u,children:[Y.t("menu.edit.Undo",r)+": "+n.getLastUndoName(),h.jsxs(lh,{children:["(",o?"⌘":"Ctrl","+Z)"]})]})}),n.hasRedo()&&f.push({key:"redo",label:h.jsxs(an,{noPadding:!0,onClick:d,children:[Y.t("menu.edit.Redo",r)+": "+n.getLastRedoName(),h.jsxs(lh,{children:["(",o?"⌘":"Ctrl","+Y)"]})]})}),f};var u2e={},XQ={};Object.defineProperty(XQ,"__esModule",{value:!0});XQ.default=void 0;var iUn={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};XQ.default=iUn;var JQ={},wN={},KQ={};Object.defineProperty(KQ,"__esModule",{value:!0});KQ.default=void 0;var aUn={locale:"zh_CN",yearFormat:"YYYY年",cellDateFormat:"D",cellMeridiemFormat:"A",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"};KQ.default=aUn;var vN={};Object.defineProperty(vN,"__esModule",{value:!0});vN.default=void 0;const lUn={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};vN.default=lUn;var lZe=Id.default;Object.defineProperty(wN,"__esModule",{value:!0});wN.default=void 0;var sUn=lZe(KQ),cUn=lZe(vN);const sZe={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},sUn.default),timePickerLocale:Object.assign({},cUn.default)};sZe.lang.ok="确定";wN.default=sZe;var uUn=Id.default;Object.defineProperty(JQ,"__esModule",{value:!0});JQ.default=void 0;var dUn=uUn(wN);JQ.default=dUn.default;var qQ=Id.default;Object.defineProperty(u2e,"__esModule",{value:!0});var cZe=u2e.default=void 0,fUn=qQ(XQ),hUn=qQ(JQ),pUn=qQ(wN),gUn=qQ(vN);const N1="${label}不是一个有效的${type}",mUn={locale:"zh-cn",Pagination:fUn.default,DatePicker:pUn.default,TimePicker:gUn.default,Calendar:hUn.default,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckall:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:N1,method:N1,array:N1,object:N1,number:N1,date:N1,boolean:N1,integer:N1,float:N1,regexp:N1,email:N1,url:N1,hex:N1},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无"}};cZe=u2e.default=mUn;var d2e={},$Q={};Object.defineProperty($Q,"__esModule",{value:!0});$Q.default=void 0;var yUn={items_per_page:"條/頁",jump_to:"跳至",jump_to_confirm:"確定",page:"頁",prev_page:"上一頁",next_page:"下一頁",prev_5:"向前 5 頁",next_5:"向後 5 頁",prev_3:"向前 3 頁",next_3:"向後 3 頁",page_size:"頁碼"};$Q.default=yUn;var QQ={},xN={},ZQ={};Object.defineProperty(ZQ,"__esModule",{value:!0});ZQ.default=void 0;var AUn={locale:"zh_TW",today:"今天",now:"此刻",backToToday:"返回今天",ok:"確定",timeSelect:"選擇時間",dateSelect:"選擇日期",weekSelect:"選擇周",clear:"清除",month:"月",year:"年",previousMonth:"上個月 (翻頁上鍵)",nextMonth:"下個月 (翻頁下鍵)",monthSelect:"選擇月份",yearSelect:"選擇年份",decadeSelect:"選擇年代",yearFormat:"YYYY年",dayFormat:"D",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH時mm分ss秒",previousYear:"上一年 (Control鍵加左方向鍵)",nextYear:"下一年 (Control鍵加右方向鍵)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世紀",nextCentury:"下一世紀"};ZQ.default=AUn;var bN={};Object.defineProperty(bN,"__esModule",{value:!0});bN.default=void 0;const wUn={placeholder:"請選擇時間"};bN.default=wUn;var uZe=Id.default;Object.defineProperty(xN,"__esModule",{value:!0});xN.default=void 0;var vUn=uZe(ZQ),xUn=uZe(bN);const dZe={lang:Object.assign({placeholder:"請選擇日期",yearPlaceholder:"請選擇年份",quarterPlaceholder:"請選擇季度",monthPlaceholder:"請選擇月份",weekPlaceholder:"請選擇周",rangePlaceholder:["開始日期","結束日期"],rangeYearPlaceholder:["開始年份","結束年份"],rangeMonthPlaceholder:["開始月份","結束月份"],rangeQuarterPlaceholder:["開始季度","結束季度"],rangeWeekPlaceholder:["開始周","結束周"]},vUn.default),timePickerLocale:Object.assign({},xUn.default)};dZe.lang.ok="確 定";xN.default=dZe;var bUn=Id.default;Object.defineProperty(QQ,"__esModule",{value:!0});QQ.default=void 0;var SUn=bUn(xN);QQ.default=SUn.default;var eZ=Id.default;Object.defineProperty(d2e,"__esModule",{value:!0});var fZe=d2e.default=void 0,TUn=eZ($Q),PUn=eZ(QQ),CUn=eZ(xN),RUn=eZ(bN);const U1="${label}不是一個有效的${type}",HUn={locale:"zh-tw",Pagination:TUn.default,DatePicker:CUn.default,TimePicker:RUn.default,Calendar:PUn.default,global:{placeholder:"請選擇"},Table:{filterTitle:"篩選器",filterConfirm:"確定",filterReset:"重置",filterEmptyText:"無篩選項",filterCheckall:"全選",filterSearchPlaceholder:"在篩選項中搜尋",emptyText:"暫無數據",selectAll:"全部選取",selectInvert:"反向選取",selectNone:"清空所有",selectionAll:"全選所有",sortTitle:"排序",expand:"展開行",collapse:"關閉行",triggerDesc:"點擊降序",triggerAsc:"點擊升序",cancelSort:"取消排序"},Modal:{okText:"確定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"結束導覽"},Popconfirm:{okText:"確定",cancelText:"取消"},Transfer:{titles:["",""],searchPlaceholder:"搜尋資料",itemUnit:"項目",itemsUnit:"項目",remove:"删除",selectCurrent:"全選當頁",removeCurrent:"删除當頁",selectAll:"全選所有",removeAll:"删除全部",selectInvert:"反選當頁"},Upload:{uploading:"正在上傳...",removeFile:"刪除檔案",uploadError:"上傳失敗",previewFile:"檔案預覽",downloadFile:"下载文件"},Empty:{description:"無此資料"},Icon:{icon:"圖標"},Text:{edit:"編輯",copy:"複製",copied:"複製成功",expand:"展開"},Form:{optional:"(可選)",defaultValidateMessages:{default:"字段驗證錯誤${label}",required:"請輸入${label}",enum:"${label}必須是其中一個[${enum}]",whitespace:"${label}不能為空字符",date:{format:"${label}日期格式無效",parse:"${label}不能轉換為日期",invalid:"${label}是一個無效日期"},types:{string:U1,method:U1,array:U1,object:U1,number:U1,date:U1,boolean:U1,integer:U1,float:U1,regexp:U1,email:U1,url:U1,hex:U1},string:{len:"${label}須為${len}個字符",min:"${label}最少${min}個字符",max:"${label}最多${max}個字符",range:"${label}須在${min}-${max}字符之間"},number:{len:"${label}必須等於${len}",min:"${label}最小值為${min}",max:"${label}最大值為${max}",range:"${label}須在${min}-${max}之間"},array:{len:"須為${len}個${label}",min:"最少${min}個${label}",max:"最多${max}個${label}",range:"${label}數量須在${min}-${max}之間"},pattern:{mismatch:"${label}與模式不匹配${pattern}"}}},Image:{preview:"預覽"},QRCode:{expired:"二維碼過期",refresh:"點擊刷新",scanned:"已掃描"}};fZe=d2e.default=HUn;var f2e={},tZ={};Object.defineProperty(tZ,"__esModule",{value:!0});tZ.default=void 0;var MUn={items_per_page:"/ página",jump_to:"Ir a",jump_to_confirm:"confirmar",page:"Página",prev_page:"Página anterior",next_page:"Página siguiente",prev_5:"5 páginas previas",next_5:"5 páginas siguientes",prev_3:"3 páginas previas",next_3:"3 páginas siguientes",page_size:"tamaño de página"};tZ.default=MUn;var nZ={},SN={},oZ={};Object.defineProperty(oZ,"__esModule",{value:!0});oZ.default=void 0;var IUn={locale:"es_ES",today:"Hoy",now:"Ahora",backToToday:"Volver a hoy",ok:"Aceptar",clear:"Limpiar",month:"Mes",year:"Año",timeSelect:"Seleccionar hora",dateSelect:"Seleccionar fecha",monthSelect:"Elegir un mes",yearSelect:"Elegir un año",decadeSelect:"Elegir una década",yearFormat:"YYYY",dateFormat:"D/M/YYYY",dayFormat:"D",dateTimeFormat:"D/M/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Mes anterior (PageUp)",nextMonth:"Mes siguiente (PageDown)",previousYear:"Año anterior (Control + left)",nextYear:"Año siguiente (Control + right)",previousDecade:"Década anterior",nextDecade:"Década siguiente",previousCentury:"Siglo anterior",nextCentury:"Siglo siguiente"};oZ.default=IUn;var TN={};Object.defineProperty(TN,"__esModule",{value:!0});TN.default=void 0;const zUn={placeholder:"Seleccionar hora"};TN.default=zUn;var hZe=Id.default;Object.defineProperty(SN,"__esModule",{value:!0});SN.default=void 0;var DUn=hZe(oZ),EUn=hZe(TN);const FUn={lang:Object.assign({placeholder:"Seleccionar fecha",rangePlaceholder:["Fecha inicial","Fecha final"],shortWeekDays:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],shortMonths:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"]},DUn.default),timePickerLocale:Object.assign({},EUn.default)};SN.default=FUn;var kUn=Id.default;Object.defineProperty(nZ,"__esModule",{value:!0});nZ.default=void 0;var LUn=kUn(SN);nZ.default=LUn.default;var rZ=Id.default;Object.defineProperty(f2e,"__esModule",{value:!0});var pZe=f2e.default=void 0,WUn=rZ(tZ),NUn=rZ(nZ),UUn=rZ(SN),jUn=rZ(TN);const j1="${label} no es un ${type} válido",BUn={locale:"es",Pagination:WUn.default,DatePicker:UUn.default,TimePicker:jUn.default,Calendar:NUn.default,global:{placeholder:"Seleccione"},Table:{filterTitle:"Filtrar menú",filterConfirm:"Aceptar",filterReset:"Reiniciar",filterEmptyText:"Sin filtros",filterCheckall:"Seleccionar todo",filterSearchPlaceholder:"Buscar en filtros",emptyText:"Sin datos",selectAll:"Seleccionar todo",selectInvert:"Invertir selección",selectNone:"Vacíe todo",selectionAll:"Seleccionar todos los datos",sortTitle:"Ordenar",expand:"Expandir fila",collapse:"Colapsar fila",triggerDesc:"Click para ordenar en orden descendente",triggerAsc:"Click para ordenar en orden ascendente",cancelSort:"Click para cancelar ordenamiento"},Modal:{okText:"Aceptar",cancelText:"Cancelar",justOkText:"Aceptar"},Popconfirm:{okText:"Aceptar",cancelText:"Cancelar"},Transfer:{titles:["",""],searchPlaceholder:"Buscar aquí",itemUnit:"elemento",itemsUnit:"elementos",remove:"Eliminar",selectCurrent:"Seleccionar página actual",removeCurrent:"Remover página actual",selectAll:"Seleccionar todos los datos",removeAll:"Eliminar todos los datos",selectInvert:"Invertir página actual"},Upload:{uploading:"Subiendo...",removeFile:"Eliminar archivo",uploadError:"Error al subir el archivo",previewFile:"Vista previa",downloadFile:"Descargar archivo"},Empty:{description:"No hay datos"},Icon:{icon:"ícono"},Text:{edit:"Editar",copy:"Copiar",copied:"Copiado",expand:"Expandir"},Form:{optional:"(opcional)",defaultValidateMessages:{default:"Error de validación del campo ${label}",required:"Por favor ingresar ${label}",enum:"${label} debe ser uno de [${enum}]",whitespace:"${label} no puede ser un carácter en blanco",date:{format:"El formato de fecha de ${label} es inválido",parse:"${label} no se puede convertir a una fecha",invalid:"${label} es una fecha inválida"},types:{string:j1,method:j1,array:j1,object:j1,number:j1,date:j1,boolean:j1,integer:j1,float:j1,regexp:j1,email:j1,url:j1,hex:j1},string:{len:"${label} debe tener ${len} caracteres",min:"${label} debe tener al menos ${min} caracteres",max:"${label} debe tener hasta ${max} caracteres",range:"${label} debe tener entre ${min}-${max} caracteres"},number:{len:"${label} debe ser igual a ${len}",min:"${label} valor mínimo es ${min}",max:"${label} valor máximo es ${max}",range:"${label} debe estar entre ${min}-${max}"},array:{len:"Debe ser ${len} ${label}",min:"Al menos ${min} ${label}",max:"A lo mucho ${max} ${label}",range:"El monto de ${label} debe estar entre ${min}-${max}"},pattern:{mismatch:"${label} no coincide con el patrón ${pattern}"}}},Image:{preview:"Previsualización"}};pZe=f2e.default=BUn;var h2e={},iZ={};Object.defineProperty(iZ,"__esModule",{value:!0});iZ.default=void 0;var YUn={items_per_page:"/ sayfa",jump_to:"Git",jump_to_confirm:"onayla",page:"Sayfa",prev_page:"Önceki Sayfa",next_page:"Sonraki Sayfa",prev_5:"Önceki 5 Sayfa",next_5:"Sonraki 5 Sayfa",prev_3:"Önceki 3 Sayfa",next_3:"Sonraki 3 Sayfa",page_size:"sayfa boyutu"};iZ.default=YUn;var aZ={},PN={},lZ={};Object.defineProperty(lZ,"__esModule",{value:!0});lZ.default=void 0;var OUn={locale:"tr_TR",today:"Bugün",now:"Şimdi",backToToday:"Bugüne Geri Dön",ok:"Tamam",clear:"Temizle",month:"Ay",year:"Yıl",timeSelect:"Zaman Seç",dateSelect:"Tarih Seç",monthSelect:"Ay Seç",yearSelect:"Yıl Seç",decadeSelect:"On Yıl Seç",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Önceki Ay (PageUp)",nextMonth:"Sonraki Ay (PageDown)",previousYear:"Önceki Yıl (Control + Sol)",nextYear:"Sonraki Yıl (Control + Sağ)",previousDecade:"Önceki On Yıl",nextDecade:"Sonraki On Yıl",previousCentury:"Önceki Yüzyıl",nextCentury:"Sonraki Yüzyıl"};lZ.default=OUn;var CN={};Object.defineProperty(CN,"__esModule",{value:!0});CN.default=void 0;const VUn={placeholder:"Zaman seç",rangePlaceholder:["Başlangıç zamanı","Bitiş zamanı"]};CN.default=VUn;var gZe=Id.default;Object.defineProperty(PN,"__esModule",{value:!0});PN.default=void 0;var _Un=gZe(lZ),GUn=gZe(CN);const XUn={lang:Object.assign({placeholder:"Tarih seç",yearPlaceholder:"Yıl seç",quarterPlaceholder:"Çeyrek seç",monthPlaceholder:"Ay seç",weekPlaceholder:"Hafta seç",rangePlaceholder:["Başlangıç tarihi","Bitiş tarihi"],rangeYearPlaceholder:["Başlangıç yılı","Bitiş yılı"],rangeMonthPlaceholder:["Başlangıç ayı","Bitiş ayı"],rangeWeekPlaceholder:["Başlangıç haftası","Bitiş haftası"]},_Un.default),timePickerLocale:Object.assign({},GUn.default)};PN.default=XUn;var JUn=Id.default;Object.defineProperty(aZ,"__esModule",{value:!0});aZ.default=void 0;var KUn=JUn(PN);aZ.default=KUn.default;var sZ=Id.default;Object.defineProperty(h2e,"__esModule",{value:!0});var mZe=h2e.default=void 0,qUn=sZ(iZ),$Un=sZ(aZ),QUn=sZ(PN),ZUn=sZ(CN);const B1="${label} geçerli bir ${type} değil",ejn={locale:"tr",Pagination:qUn.default,DatePicker:QUn.default,TimePicker:ZUn.default,Calendar:$Un.default,global:{placeholder:"Lütfen seçiniz"},Table:{filterTitle:"Filtre menüsü",filterConfirm:"Tamam",filterReset:"Sıfırla",filterEmptyText:"Filtre yok",selectAll:"Tüm sayfayı seç",selectInvert:"Tersini seç",selectionAll:"Tümünü seç",sortTitle:"Sırala",expand:"Satırı genişlet",collapse:"Satırı daralt",triggerDesc:"Azalan düzende sırala",triggerAsc:"Artan düzende sırala",cancelSort:"Sıralamayı kaldır"},Modal:{okText:"Tamam",cancelText:"İptal",justOkText:"Tamam"},Popconfirm:{okText:"Tamam",cancelText:"İptal"},Transfer:{titles:["",""],searchPlaceholder:"Arama",itemUnit:"Öğe",itemsUnit:"Öğeler",remove:"Kaldır",selectCurrent:"Tüm sayfayı seç",removeCurrent:"Sayfayı kaldır",selectAll:"Tümünü seç",removeAll:"Tümünü kaldır",selectInvert:"Tersini seç"},Upload:{uploading:"Yükleniyor...",removeFile:"Dosyayı kaldır",uploadError:"Yükleme hatası",previewFile:"Dosyayı önizle",downloadFile:"Dosyayı indir"},Empty:{description:"Veri Yok"},Icon:{icon:"ikon"},Text:{edit:"Düzenle",copy:"Kopyala",copied:"Kopyalandı",expand:"Genişlet"},Form:{optional:"(opsiyonel)",defaultValidateMessages:{default:"Alan doğrulama hatası ${label}",required:"${label} gerekli bir alan",enum:"${label} şunlardan biri olmalı: [${enum}]",whitespace:"${label} sadece boşluk olamaz",date:{format:"${label} tarih biçimi geçersiz",parse:"${label} bir tarihe dönüştürülemedi",invalid:"${label} geçersiz bir tarih"},types:{string:B1,method:B1,array:B1,object:B1,number:B1,date:B1,boolean:B1,integer:B1,float:B1,regexp:B1,email:B1,url:B1,hex:B1},string:{len:"${label} ${len} karakter olmalı",min:"${label} en az ${min} karakter olmalı",max:"${label} en çok ${max} karakter olmalı",range:"${label} ${min}-${max} karakter arası olmalı"},number:{len:"${label} ${len} olmalı",min:"${label} en az ${min} olmalı",max:"${label} en çok ${max} olmalı",range:"${label} ${min}-${max} arası olmalı"},array:{len:"${label} sayısı ${len} olmalı",min:"${label} sayısı en az ${min} olmalı",max:"${label} sayısı en çok ${max} olmalı",range:"${label} sayısı ${min}-${max} arası olmalı"},pattern:{mismatch:"${label} şu kalıpla eşleşmeli: ${pattern}"}}},Image:{preview:"Önizleme"}};mZe=h2e.default=ejn;var p2e={},cZ={};Object.defineProperty(cZ,"__esModule",{value:!0});cZ.default=void 0;var tjn={items_per_page:"/ сторінці",jump_to:"Перейти",jump_to_confirm:"підтвердити",page:"",prev_page:"Попередня сторінка",next_page:"Наступна сторінка",prev_5:"Попередні 5 сторінок",next_5:"Наступні 5 сторінок",prev_3:"Попередні 3 сторінки",next_3:"Наступні 3 сторінки",page_size:"Page Size"};cZ.default=tjn;var uZ={},RN={},dZ={};Object.defineProperty(dZ,"__esModule",{value:!0});dZ.default=void 0;var njn={locale:"uk_UA",today:"Сьогодні",now:"Зараз",backToToday:"Поточна дата",ok:"OK",clear:"Очистити",month:"Місяць",year:"Рік",timeSelect:"Обрати час",dateSelect:"Обрати дату",monthSelect:"Обрати місяць",yearSelect:"Обрати рік",decadeSelect:"Обрати десятиріччя",yearFormat:"YYYY",dateFormat:"D-M-YYYY",dayFormat:"D",dateTimeFormat:"D-M-YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Попередній місяць (PageUp)",nextMonth:"Наступний місяць (PageDown)",previousYear:"Попередній рік (Control + left)",nextYear:"Наступний рік (Control + right)",previousDecade:"Попереднє десятиріччя",nextDecade:"Наступне десятиріччя",previousCentury:"Попереднє століття",nextCentury:"Наступне століття"};dZ.default=njn;var HN={};Object.defineProperty(HN,"__esModule",{value:!0});HN.default=void 0;const ojn={placeholder:"Оберіть час"};HN.default=ojn;var yZe=Id.default;Object.defineProperty(RN,"__esModule",{value:!0});RN.default=void 0;var rjn=yZe(dZ),ijn=yZe(HN);const ajn={lang:Object.assign({placeholder:"Оберіть дату",rangePlaceholder:["Початкова дата","Кінцева дата"]},rjn.default),timePickerLocale:Object.assign({},ijn.default)};RN.default=ajn;var ljn=Id.default;Object.defineProperty(uZ,"__esModule",{value:!0});uZ.default=void 0;var sjn=ljn(RN);uZ.default=sjn.default;var fZ=Id.default;Object.defineProperty(p2e,"__esModule",{value:!0});var AZe=p2e.default=void 0,cjn=fZ(cZ),ujn=fZ(uZ),djn=fZ(RN),fjn=fZ(HN);const Y1="${label} не є типом ${type}",hjn={locale:"uk",Pagination:cjn.default,DatePicker:djn.default,TimePicker:fjn.default,Calendar:ujn.default,global:{placeholder:"Будь ласка, оберіть"},Table:{filterTitle:"Фільтрувати",filterConfirm:"OK",filterReset:"Скинути",filterEmptyText:"Фільтри відсутні",filterCheckall:"Обрати всі",filterSearchPlaceholder:"Пошук у фільтрах",emptyText:"Даних немає",selectAll:"Обрати всі на сторінці",selectInvert:"Інвертувати вибір",selectNone:"Очистити вибір",selectionAll:"Обрати всі",sortTitle:"Сортувати",expand:"Розгорнути рядок",collapse:"Згорнути рядок",triggerDesc:"Сортувати за спаданням",triggerAsc:"Сортувати за зростанням",cancelSort:"Відмінити сортування"},Tour:{Next:"Далі",Previous:"Назад",Finish:"Завершити"},Modal:{okText:"Гаразд",cancelText:"Скасувати",justOkText:"Гаразд"},Popconfirm:{okText:"Гаразд",cancelText:"Скасувати"},Transfer:{titles:["",""],searchPlaceholder:"Введіть текст для пошуку",itemUnit:"елем.",itemsUnit:"елем.",remove:"Видалити",selectCurrent:"Вибрати поточну сторінку",removeCurrent:"Скасувати вибір на сторінці",selectAll:"Вибрати всі дані",removeAll:"Скасувати вибір",selectInvert:"Інвертувати поточну сторінку"},Upload:{uploading:"Завантаження ...",removeFile:"Видалити файл",uploadError:"Помилка завантаження",previewFile:"Попередній перегляд файлу",downloadFile:"Завантажити файл"},Empty:{description:"Даних немає"},Icon:{icon:"іконка"},Text:{edit:"Редагувати",copy:"Скопіювати",copied:"Скопійовано",expand:"Розширити"},Form:{optional:"(опціонально)",defaultValidateMessages:{default:"Помилка валідації для поля ${label}",required:"Будь ласка, заповніть ${label}",enum:"Лише одне зі значень [${enum}] доступне для ${label}",whitespace:"Значення у полі ${label} не може бути пробілом",date:{format:"Не валідний формат дати у ${label}",parse:"Значення ${label} не може бути приведене до дати",invalid:"Не валідна дата у ${label}"},types:{string:Y1,method:Y1,array:Y1,object:Y1,number:Y1,date:Y1,boolean:Y1,integer:Y1,float:Y1,regexp:Y1,email:Y1,url:Y1,hex:Y1},string:{len:"${label} має містити ${len} символів",min:"${label} має містити не менш, ніж ${min} символів",max:"${label} має містити не більш, ніж ${max} символів",range:"${label} має містити ${min}-${max} символів"},number:{len:"${label} має дорівнювати ${len}",min:"${label} має бути не менш, ніж ${min}",max:"${label} має бути не більш, ніж ${max}",range:"${label} має бути в межах ${min}-${max}"},array:{len:"${label} має містити ${len} елементи",min:"${label} має містити не менш, ніж ${min} елементи",max:"${label} має містити не більш, ніж ${max} елементи",range:"Кількість елементів в ${label} має бути в межах ${min}-${max}"},pattern:{mismatch:"${label} не відповідає шаблону ${pattern}"}}},Image:{preview:"Попередній перегляд"},QRCode:{expired:"QR-код закінчився",refresh:"Оновити"}};AZe=p2e.default=hjn;const pjn=be.memo(()=>{const t=M(m0),e=n=>{M.getState().set(o=>{switch(o.language=n.target.value,o.language){case"zh_cn":o.locale=cZe;break;case"zh_tw":o.locale=fZe;break;case"es":o.locale=pZe;break;case"tr":o.locale=mZe;break;case"ua":o.locale=AZe;break;default:o.locale=y1e}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Le.Group,{value:t,style:{height:"170px"},onChange:e,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:"en",children:s9.English}),h.jsx(Le,{style:{width:"100%"},value:"es",children:s9.Spanish}),h.jsx(Le,{style:{width:"100%"},value:"zh_cn",children:s9.ChineseSimplified}),h.jsx(Le,{style:{width:"100%"},value:"zh_tw",children:s9.ChineseTraditional}),h.jsx(Le,{style:{width:"100%"},value:"tr",children:s9.Turkish}),h.jsx(Le,{style:{width:"100%"},value:"ua",children:s9.Ukrainian})]})})})}),gjn=(t,e,n)=>{const o={lng:M.getState().language},r=()=>{dt.getState().set(l=>{l.showModelsGallery=!0,l.leaderboardFlag=!0,l.openModelsMap=!1})},i=()=>{dt.getState().set(l=>{l.modelsMapFlag=!0,l.modelsMapWeatherStations=!1,l.openModelsMap=!0,l.showModelsGallery=!1}),M.getState().loggable&&M.getState().set(l=>{l.actionInfo={name:"Open Models Map",timestamp:new Date().getTime()}})},a=[];return t&&!e&&a.push({key:"my-models",label:h.jsxs(an,{noPadding:!0,onClick:r,children:[Y.t("menu.ModelsGallery",o),"..."]})}),n||a.push({key:"models-map",label:h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t("menu.ModelsMap",o),"..."]})}),a},vX=()=>{const t=kn.getState().orbitControlsRef;if(t!=null&&t.current){const e=Math.min(50,M.getState().sceneRadius*4);t.current.object.position.set(e,e,e),t.current.target.set(0,0,0),t.current.update(),M.getState().set(n=>{const o=n.viewState;o.cameraPosition=[e,e,e],o.panCenter=[0,0,0]})}},xX=t=>{if(M.getState().viewState.orthographic){const e=M.getState().viewState.cameraZoom??20,n=e,o=e/t,r={name:"Zoom",timestamp:Date.now(),oldValue:n,newValue:o,undo:()=>{M.getState().set(i=>{i.viewState.cameraZoom=r.oldValue})},redo:()=>{M.getState().set(i=>{i.viewState.cameraZoom=r.newValue})}};M.getState().addUndoable(r),M.getState().set(i=>{i.viewState.cameraZoom=o})}else{const e=kn.getState().orbitControlsRef;if(e!=null&&e.current){const n=e.current.object.position,o=n.x*t,r=n.y*t,i=n.z*t,a={name:"Zoom",timestamp:Date.now(),oldCameraPosition:[n.x,n.y,n.z],newCameraPosition:[o,r,i],undo:()=>{var u,d;const l=a.oldCameraPosition[0],s=a.oldCameraPosition[1],c=a.oldCameraPosition[2];(u=e.current)==null||u.object.position.set(l,s,c),(d=e.current)==null||d.update(),M.getState().set(f=>{f.viewState.cameraPosition=[l,s,c]})},redo:()=>{var u,d;const l=a.newCameraPosition[0],s=a.newCameraPosition[1],c=a.newCameraPosition[2];(u=e.current)==null||u.object.position.set(l,s,c),(d=e.current)==null||d.update(),M.getState().set(f=>{f.viewState.cameraPosition=[l,s,c]})}};M.getState().addUndoable(a),e.current.object.position.set(o,r,i),e.current.update(),M.getState().set(l=>{l.viewState.cameraPosition=[o,r,i]})}}},mjn=(t,e)=>{const n={lng:M.getState().language},o=M.getState().viewState.orthographic,r=M.getState().viewState.cameraPosition,i=M.getState().viewState.panCenter,a=r[0]===r[1]&&r[1]===r[2]&&i[0]===0&&i[1]===0&&i[2]===0,l=()=>{const C={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...r],oldPanCenter:[...i],undo:()=>{const P=kn.getState().orbitControlsRef;P!=null&&P.current&&(P.current.object.position.set(C.oldCameraPosition[0],C.oldCameraPosition[1],C.oldCameraPosition[2]),P.current.target.set(C.oldPanCenter[0],C.oldPanCenter[1],C.oldPanCenter[2]),P.current.update(),M.getState().set(v=>{const T=v.viewState;T.cameraPosition=[...C.oldCameraPosition],T.panCenter=[...C.oldPanCenter]}))},redo:()=>{vX()}};M.getState().addUndoable(C),vX(),M.getState().set(P=>{P.objectTypeToAdd=z.None,P.groupActionMode=!1,P.viewState.orthographic=!1})},s=()=>{xX(1.1)},c=()=>{xX(.9)},u=C=>{const P=M.getState().setNavigationView,v={name:"Toggle Navigation View",timestamp:Date.now(),checked:C.target.checked,undo:()=>{P(!v.checked)},redo:()=>{P(v.checked)}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.autoRotate=!1}),P(C.target.checked)},d=C=>{const P=M.getState().set2DView,v={name:"Toggle 2D View",timestamp:Date.now(),checked:C.target.checked,undo:()=>{P(!v.checked)},redo:()=>{P(v.checked)}};M.getState().addUndoable(v),P(C.target.checked),M.getState().set(T=>{T.viewState.autoRotate=!1})},f=C=>{if(!M.getState().viewState.orthographic){const P={name:"Auto Rotate",timestamp:Date.now(),checked:C.target.checked,undo:()=>{M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=!P.checked})},redo:()=>{M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=P.checked})}};M.getState().addUndoable(P),M.getState().set(v=>{v.objectTypeToAdd=z.None,v.groupActionMode=!1,v.viewState.autoRotate=!v.viewState.autoRotate})}},p=C=>{const P=C.target.checked,v={name:"Show Axes",timestamp:Date.now(),checked:P,undo:()=>{M.getState().set(T=>{T.viewState.axes=!v.checked})},redo:()=>{M.getState().set(T=>{T.viewState.axes=v.checked})}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.axes=P})},g=C=>{const P={name:"Show Shadow",timestamp:Date.now(),checked:C.target.checked,undo:()=>{M.getState().set(v=>{v.viewState.shadowEnabled=!P.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})},redo:()=>{M.getState().set(v=>{v.viewState.shadowEnabled=P.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})}};M.getState().addUndoable(P),M.getState().set(v=>{v.viewState.shadowEnabled=C.target.checked,v.viewState.shadowEnabled&&v.updateSceneRadius()})},A=C=>{const P=C.target.checked?rw:0,v={name:"Set Surface Shininess",timestamp:Date.now(),oldValue:M.getState().viewState.solarPanelShininess??rw,newValue:P,undo:()=>{M.getState().set(T=>{T.viewState.solarPanelShininess=v.oldValue})},redo:()=>{M.getState().set(T=>{T.viewState.solarPanelShininess=v.newValue})}};M.getState().addUndoable(v),M.getState().set(T=>{T.viewState.solarPanelShininess=P})},y=C=>{const P=M.getState().floatingWindowOpacity,v=C.target.checked?g0:1,T={name:"Floating Window Opacity",timestamp:Date.now(),oldValue:P,newValue:v,undo:()=>{M.getState().set(w=>{w.floatingWindowOpacity=T.oldValue})},redo:()=>{M.getState().set(w=>{w.floatingWindowOpacity=T.newValue})}};M.getState().addUndoable(T),M.getState().set(w=>{w.floatingWindowOpacity=v})},S=[];return!o&&!a&&S.push({key:"reset-view",label:h.jsxs(an,{onClick:l,children:[Y.t("menu.view.ResetView",n),h.jsxs(lh,{children:["(",t,")"]})]})}),S.push({key:"zoom-out-view",label:h.jsxs(an,{onClick:s,children:[Y.t("menu.view.ZoomOut",n),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+])"]})]})}),S.push({key:"zoom-in-view",label:h.jsxs(an,{onClick:c,children:[Y.t("menu.view.ZoomIn",n),h.jsxs(lh,{children:["(",e?"⌘":"Ctrl","+[)"]})]})}),S.push({key:"navigation-view-check-box",label:h.jsxs(f2,{selector:Yq,onChange:u,children:[Y.t("menu.view.NavigationView",n),h.jsxs(lh,{children:["(",bre,"+Q)"]})]})}),S.push({key:"orthographic-check-box",label:h.jsxs(f2,{selector:Ju,onChange:d,children:[Y.t("menu.view.TwoDimensionalView",n),h.jsxs(lh,{children:["(",bre,"+B)"]})]})}),o||S.push({key:"auto-rotate-check-box",label:h.jsxs(f2,{selector:RBe,onChange:f,children:[Y.t("menu.view.AutoRotate",n),h.jsxs(lh,{children:["(",bre,"+M)"]})]})}),S.push({key:"axes-check-box",label:h.jsx(f2,{selector:bge,onChange:p,children:Y.t("skyMenu.Axes",n)})}),S.push({key:"shadow-check-box",label:h.jsx(f2,{selector:Cs,onChange:g,children:Y.t("menu.view.ShowShadow",n)})}),S.push({key:"shininess-check-box",label:h.jsx(f2,{selector:C=>C.viewState.solarPanelShininess===void 0||C.viewState.solarPanelShininess>0,onChange:A,children:Y.t("menu.view.ShowSurfaceShininess",n)})}),S.push({key:"translucency-check-box",label:h.jsx(f2,{selector:C=>C.floatingWindowOpacity<1,onChange:y,children:Y.t("menu.view.TranslucentFloatingWindows",n)})}),S},yjn=()=>{const t={lng:M.getState().language},e=M.getState().set,n=M.getState().addUndoable,o=M.getState().viewState.showHeliodonPanel,r=M.getState().viewState.showMapPanel,i=M.getState().viewState.showWeatherPanel,a=M.getState().viewState.showDiurnalTemperaturePanel,l=dt.getState().showSolarPanelCustomizationPanel,s=dt.getState().showEconomicsPanel,c=dt.getState().showNavigationPanel,u=dt.getState().showShadowSettings,d=M.getState().loggable,f=()=>{const T={name:"Open Sun and Time Settings Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showHeliodonPanel=!1})},redo:()=>{e(w=>{w.viewState.showHeliodonPanel=!0})}};n(T),e(w=>{w.viewState.showHeliodonPanel=!0,w.selectedFloatingWindow="heliodonPanel"})},p=()=>{const T={name:"Open Maps",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showMapPanel=!1})},redo:()=>{e(w=>{w.viewState.showMapPanel=!0})}};n(T),e(w=>{w.viewState.showMapPanel=!0,w.selectedFloatingWindow="mapPanel"})},g=()=>{const T={name:"Open Weather Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showWeatherPanel=!1})},redo:()=>{e(w=>{w.viewState.showWeatherPanel=!0})}};n(T),e(w=>{w.viewState.showWeatherPanel=!0,w.selectedFloatingWindow="weatherPanel"})},A=()=>{const T={name:"Open Diurnal Temperature Panel",timestamp:Date.now(),undo:()=>{e(w=>{w.viewState.showDiurnalTemperaturePanel=!1})},redo:()=>{e(w=>{w.viewState.showDiurnalTemperaturePanel=!0})}};n(T),e(w=>{w.viewState.showDiurnalTemperaturePanel=!0,w.selectedFloatingWindow="diurnalTemperaturePanel"})},y=()=>{dt.getState().set(T=>{T.showSolarPanelCustomizationPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Solar Panel Customization Panel",timestamp:new Date().getTime()}})},S=()=>{dt.getState().set(T=>{T.showEconomicsPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Economics Panel",timestamp:new Date().getTime()}})},C=()=>{dt.getState().set(T=>{T.showNavigationPanel=!0}),d&&e(T=>{T.actionInfo={name:"Open Navigation Panel",timestamp:new Date().getTime()}})},P=()=>{dt.getState().set(T=>{T.showShadowSettings=!0}),d&&e(T=>{T.actionInfo={name:"Open Shadow Settings",timestamp:new Date().getTime()}})},v=[];return o||v.push({key:"sun-time",label:h.jsxs(an,{noPadding:!0,onClick:f,children:[Y.t("menu.settings.SunAndTime",t),"..."]})}),r||v.push({key:"show-map-panel",label:h.jsxs(an,{noPadding:!0,onClick:p,children:[Y.t("word.Location",t),"..."]})}),i||v.push({key:"weather-panel",label:h.jsxs(an,{noPadding:!0,onClick:g,children:[Y.t("menu.settings.WeatherData",t),"..."]})}),a||v.push({key:"diurnal-temperature-panel",label:h.jsxs(an,{noPadding:!0,onClick:A,children:[Y.t("menu.settings.DiurnalTemperature",t),"..."]})}),l||v.push({key:"solar-panel-customization",label:h.jsxs(an,{noPadding:!0,onClick:y,children:[Y.t("menu.settings.CustomSolarPanels",t),"..."]})}),s||v.push({key:"economics-panel",label:h.jsxs(an,{noPadding:!0,onClick:S,children:[Y.t("economicsPanel.EconomicsParameters",t),"..."]})}),c||v.push({key:"navigation-panel",label:h.jsxs(an,{noPadding:!0,onClick:C,children:[Y.t("navigationPanel.NavigationParameters",t),"..."]})}),u||v.push({key:"shadow-settings",label:h.jsxs(an,{noPadding:!0,onClick:P,children:[Y.t("shadowSettingsPanel.ShadowSettings",t),"..."]})}),v},Ajn=()=>{const t={lng:M.getState().language},e=M.getState().set,n=M.getState().addUndoable,o=s=>{const c=s.target.checked,u={name:"Show Site Information",timestamp:Date.now(),checked:c,undo:()=>{e(d=>{d.viewState.showSiteInfoPanel=!u.checked})},redo:()=>{e(d=>{d.viewState.showSiteInfoPanel=u.checked})}};n(u),e(d=>{d.viewState.showSiteInfoPanel=c})},r=s=>{const c=s.target.checked,u={name:"Show Design Information",timestamp:Date.now(),checked:c,undo:()=>{e(d=>{d.viewState.showDesignInfoPanel=!u.checked})},redo:()=>{e(d=>{d.viewState.showDesignInfoPanel=u.checked})}};n(u),e(d=>{d.viewState.showDesignInfoPanel=!d.viewState.showDesignInfoPanel})},i=s=>{const c={name:"Show Instruction Panel",timestamp:Date.now(),checked:s.target.checked,undo:()=>{e(u=>{u.viewState.showInstructionPanel=!c.checked})},redo:()=>{e(u=>{u.viewState.showInstructionPanel=c.checked})}};n(c),e(u=>{u.viewState.showInstructionPanel=!u.viewState.showInstructionPanel})},a=s=>{const c={name:"Show Sticky Note",timestamp:Date.now(),checked:s.target.value,undo:()=>{e(u=>{u.viewState.showStickyNotePanel=!c.checked})},redo:()=>{e(u=>{u.viewState.showStickyNotePanel=c.checked})}};n(c),e(u=>{u.viewState.showStickyNotePanel=!u.viewState.showStickyNotePanel})};return[{key:"site-info-panel-check-box",label:h.jsx(f2,{selector:Tge,onChange:o,children:Y.t("menu.view.accessories.SiteInformation",t)})},{key:"design-info-panel-check-box",label:h.jsx(f2,{selector:Vq,onChange:r,children:Y.t("menu.view.accessories.DesignInformation",t)})},{key:"instruction-panel-check-box",label:h.jsx(f2,{selector:FBe,onChange:i,children:Y.t("menu.view.accessories.Instruction",t)})},{key:"sticky-note-panel-check-box",label:h.jsx(f2,{selector:LBe,onChange:a,children:Y.t("menu.view.accessories.StickyNote",t)})}]};var rg=(t=>(t[t.NO_BUILDING=3]="NO_BUILDING",t[t.AT_LEAST_ONE_BAD_NO_GOOD=2]="AT_LEAST_ONE_BAD_NO_GOOD",t[t.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD=1]="AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD",t[t.OK=0]="OK",t))(rg||{});const SO=50,bX=(t,e,n)=>{if(e(z.Foundation)===0)return{status:3};let r=!1,i=!1,a;for(const l of t)if(l.type===z.Foundation){const s=l;if(s.notBuilding)continue;if(n(z.Wall,s.id).length>0){const u=me.getBuildingCompletionStatus(s,t);u===Uc.COMPLETE?r=!0:(i=!0,a=u)}else i=!0}return i&&!r?{status:2,buildingCompletion:a}:i&&r?{status:1}:{status:0}},Z7=t=>{if(!t.color)return .5;const e=t.color.toLowerCase();if(e==="white")return .05;if(e==="black")return .95;const n=parseInt(t.color.substring(1),16),o=n>>16&255,r=n>>8&255,i=n&255;let a=Math.min(o,r);a=Math.min(a,i);let l=Math.max(o,r);return l=Math.max(l,i),Math.min(.95,Math.max(.05,1-(a+l)/510))},TO=(t,e,n,o)=>e<0&&t.low>=n-o||e>0&&t.high<=n+o?0:e,ob=(t,e,n,o,r,i)=>{if(n===y2.Sinusoidal)return .5*(t+e)-.5*(t-e)*Math.cos(lde*(i-(o-720)));const a=.5*(t+e),l=.5*(t-e),s=r.daylight();if(i>r.sunrise&&ir.sunset){const p=i-r.sunset;return e+(u-e)*Math.exp(-d*p/c)}const f=i+23*60-r.sunset;return e+(u-e)*Math.exp(-d*f/c)},rb=(t,e,n)=>{const o=t.getFullYear(),r=t.getMonth(),i=t.getDate(),l=me.daysOfMonth(r,o)/2;let s,c,u;if(i11&&(c=0);const p=me.daysOfMonth(c,o)/2,g=l+p;u=(i-l)/g}const d=e[s]+(e[c]-e[s])*u,f=n[s]+(n[c]-n[s])*u;return{low:d,high:f}},wjn=(t,e,n,o,r,i)=>{const a=n.length;let l=0,s=-1e3,c=1e3,u=-1e3,d=1e3;for(let g=0;go[g]&&(c=o[g]),d>n[g]&&(d=n[g]);l/=2*a;const f=.25*(s-c+u-d),p=i*Math.sqrt(Zie/(2*r));return t>0?l-f*Math.exp(-p)*Math.cos(Zie*(e-ESe)-p):l-f*Math.exp(-p)*Math.cos(Math.PI+Zie*(e-ESe)-p)},wZe=(t,e,n,o,r,i,a,l,s)=>wjn(t,e,o,r,l,s)-Math.exp(-s*Math.sqrt(lde/(2*l)))*a*Math.cos(lde*(n-(i-720)-rZt)),{Option:ev}=Uo,hZ=be.memo(({type:t})=>{const e=M(VBe),n=M(I8t),o=M(D8t),r=$t(),i=m.useMemo(()=>{switch(t){case rs.CSP:return n;case rs.SUT:return o;default:return e}},[t,e,n,o]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.SamplingFrequency",r)+":"}),h.jsxs(Uo,{style:{width:"72px"},value:i??4,onChange:a=>{M.getState().set(l=>{switch(t){case rs.CSP:l.world.cspTimesPerHour=a;break;case rs.SUT:l.world.sutTimesPerHour=a;break;default:l.world.timesPerHour=a;break}})},children:[h.jsx(ev,{value:1,children:"1"},1),h.jsx(ev,{value:2,children:"2"},2),h.jsx(ev,{value:3,children:"3"},3),h.jsx(ev,{value:4,children:"4"},4),h.jsx(ev,{value:6,children:"6"},6),h.jsx(ev,{value:12,children:"12"},12),h.jsx(ev,{value:30,children:"30"},30)]}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.TimesPerHour",r)})]})}),{Option:hae}=Uo,pZ=be.memo(({type:t})=>{const e=M(zH),n=M(mW),o=M(GBe),r=$t(),i=m.useMemo(()=>{switch(t){case rs.CSP:return n;case rs.SUT:return o;default:return e}},[t,e,n,o]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsxs(Uo,{style:{marginLeft:"150px",width:"72px"},value:i??6,onChange:a=>{switch(t){case rs.BUILDING:M.getState().set(l=>{l.world.daysPerYear=a});break;case rs.PV:M.getState().set(l=>{l.world.daysPerYear=a}),Cn.setState({yearlyPvYield:[]});break;case rs.CSP:M.getState().set(l=>{l.world.cspDaysPerYear=a}),Cn.setState({yearlyParabolicTroughYield:[],yearlyParabolicDishYield:[],yearlyFresnelReflectorYield:[],yearlyHeliostatYield:[]});break;case rs.SUT:M.getState().set(l=>{l.world.sutDaysPerYear=a}),Cn.setState({yearlyUpdraftTowerYield:[]});break}},children:[h.jsx(hae,{value:4,children:"4"},4),h.jsx(hae,{value:6,children:"6"},6),h.jsx(hae,{value:12,children:"12"},12)]}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.DaysPerYear",r)})]})}),MN=be.memo(({type:t})=>{const e=M(R8t),n=M(H8t),o=M(z8t),r=M(E8t),i=$t(),a=m.useMemo(()=>{switch(t){case rs.PV:return n;case rs.CSP:return o;case rs.SUT:return r;default:return e}},[t,n,o,r,e]);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.GridCellSize",i)+":"}),h.jsx(Sn,{min:.1,max:5,step:.05,style:{width:72},precision:2,value:a??.5,onChange:l=>{l!==null&&M.getState().set(s=>{switch(t){case rs.PV:s.world.pvGridCellSize=l;break;case rs.CSP:s.world.cspGridCellSize=l;break;case rs.SUT:s.world.sutGridCellSize=l;break;default:s.world.solarRadiationHeatmapGridCellSize=l;break}})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("word.MeterAbbreviation",i)})]})}),vjn=()=>[{key:"building-energy-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.BUILDING})},{key:"building-energy-simulation-sampling-days",label:h.jsx(pZ,{type:rs.BUILDING})},{key:"building-energy-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.BUILDING})}],{Option:lPe}=Uo,xjn=be.memo(()=>{const t=$t(),e=M(C8t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.solarPanel.PanelDiscretization",t)+":"}),h.jsxs(Uo,{style:{width:"165px"},value:e??Em.APPROXIMATE,onChange:n=>{M.getState().set(o=>{o.world.discretization=n})},children:[h.jsx(lPe,{value:Em.EXACT,children:Y.t("menu.solarPanel.Exact",t)},Em.EXACT),h.jsx(lPe,{value:Em.APPROXIMATE,children:Y.t("menu.solarPanel.Approximate",t)},Em.APPROXIMATE)]})]})}),bjn=be.memo(()=>{const t=$t(),e=M(Mge);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:Y.t("menu.solarPanel.SolarPanelSimulationNoAnimation",t)+":"}),h.jsx(vc,{checked:e,onChange:n=>{M.getState().set(o=>{o.world.noAnimationForSolarPanelSimulation=n})}})]})}),Sjn=t=>{const e=M.getState().world.discretization,n=[{key:"solar-panel-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.PV})},{key:"solar-panel-simulation-sampling-days",label:h.jsx(pZ,{type:rs.PV})},{key:"solar-panel-discretization",label:h.jsx(xjn,{})}];return(!e||e===Em.APPROXIMATE)&&n.push({key:"solar-panel-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.PV})}),t||n.push({key:"solar-panel-simulation-no-animation",label:h.jsx(bjn,{})}),n},PO=t=>[{key:`${t}-simulation-sampling-frequency`,label:h.jsx(hZ,{type:rs.CSP})},{key:`${t}-simulation-sampling-days`,label:h.jsx(pZ,{type:rs.CSP})},{key:`${t}-simulation-grid-cell-size`,label:h.jsx(MN,{type:rs.CSP})}],Tjn=be.memo(()=>{const t=$t(),e=M(Pf);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"280px"},children:Y.t("menu.physics.SolarRadiationHeatmapMaxValue",t)+":"}),h.jsx(Sn,{min:.5,max:50,step:.5,style:{width:60},precision:1,value:e??5,onChange:n=>{M.getState().set(o=>{n!==null&&(o.viewState.solarRadiationHeatMapMaxValue=n)})}})]})}),Pjn=be.memo(()=>{const t=$t(),e=M(VBe);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{width:"150px"},children:Y.t("menu.option.SamplingFrequency",t)+":"}),h.jsx(Sn,{min:1,max:60,step:1,style:{width:60},precision:0,value:e,formatter:n=>Number(n).toFixed(0),onChange:n=>{n!==null&&M.getState().set(o=>{o.world.timesPerHour=n})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("menu.option.TimesPerHour",t)})]})}),Cjn=be.memo(()=>{const t=$t(),e=M(M8t);return h.jsxs(an,{noPadding:!0,stayAfterClick:!0,children:[h.jsx(on,{style:{paddingRight:"10px"},children:Y.t("menu.solarPanel.VisibilityGridCellSize",t)+":"}),h.jsx(Sn,{min:.1,max:5,step:.1,style:{width:60},precision:1,value:e??.2,onChange:n=>{n!==null&&M.getState().set(o=>{o.world.solarPanelVisibilityGridCellSize=n})}}),h.jsx(on,{style:{paddingLeft:"10px"},children:Y.t("word.MeterAbbreviation",t)})]})}),Rjn=()=>[{key:"sut-simulation-sampling-frequency",label:h.jsx(hZ,{type:rs.SUT})},{key:"sut-simulation-sampling-days",label:h.jsx(pZ,{type:rs.SUT})},{key:"sut-simulation-grid-cell-size",label:h.jsx(MN,{type:rs.SUT})}],Hjn=t=>{const e={lng:M.getState().language},n=dt.getState().setPrimitiveStore,o=M.getState().set,r=M.getState().selectNone,i=M.getState().countElementsByType,a=M.getState().countHeatmapCells,l=dt.getState().runDynamicSimulation,s=dt.getState().runStaticSimulation,c=M.getState().world.noAnimationForHeatmapSimulation,u=M.getState().elements,d=M.getState().loggable,f=me.hasMovingParts(u),p=[],g=()=>{s||gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),n("runStaticSimulation",!s),d&&o(O=>{O.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Static)",timestamp:new Date().getTime()}})},100)},A=()=>{l||gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),n("runDynamicSimulation",!l),d&&o(O=>{O.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Dynamic)",timestamp:new Date().getTime()}})},100)},y=()=>{a()>sje?yi.confirm({title:Y.t("message.CalculationMayBeSlowDoYouWantToContinue",e)+" ("+Y.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",e)+")",icon:h.jsx(Zx,{}),onOk:()=>{S()},onCancel:()=>{},okText:`${Y.t("word.Yes",e)}`,cancelText:`${Y.t("word.No",e)}`}):S()},S=()=>{!c||f?A():g()},C=()=>{if(i(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{d&&o(V=>{V.actionInfo={name:"Collect Daily Data for Sensors",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailyLightSensor=!0})},100)},P=()=>{if(i(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{d&&o(V=>{V.actionInfo={name:"Collect Yearly Data for Sensors",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlyLightSensor=!0})},100)},v=()=>{const O=bX(u,M.getState().countElementsByType,M.getState().getChildrenOfType);if(O.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",e));return}if(O.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let V;switch(O.buildingCompletion){case Uc.WALL_DISJOINED:V=Y.t("message.WallsAreNotConnected",e);break;case Uc.WALL_EMPTY:V=Y.t("message.BuildingContainsEmptyWall",e);break;case Uc.ROOF_MISSING:V=Y.t("message.BuildingRoofMissing",e);break;default:V=Y.t("message.UnknownErrors",e)}co(Y.t("message.SimulationWillNotStartDueToErrors",e)+": "+V);return}O.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",e)),gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),d&&o(V=>{V.actionInfo={name:"Analyze Daily Building Energy",timestamp:new Date().getTime()}}),dt.getState().set(V=>{V.runDailyThermalSimulation=!0,V.simulationInProgress=!0})},100)},T=()=>{const O=bX(u,M.getState().countElementsByType,M.getState().getChildrenOfType);if(O.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",e));return}if(O.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let V;switch(O.buildingCompletion){case Uc.WALL_DISJOINED:V=Y.t("message.WallsAreNotConnected",e);break;case Uc.WALL_EMPTY:V=Y.t("message.BuildingContainsEmptyWall",e);break;case Uc.ROOF_MISSING:V=Y.t("message.BuildingRoofMissing",e);break;default:V=Y.t("message.UnknownErrors",e)}co(Y.t("message.SimulationWillNotStartDueToErrors",e)+": "+V);return}O.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",e)),gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{r(),dt.getState().set(V=>{V.runYearlyThermalSimulation=!0,V.simulationInProgress=!0}),d&&o(V=>{V.actionInfo={name:"Analyze Yearly Building Energy",timestamp:new Date().getTime()}})},100)},w=()=>{if(i(z.SolarPanel)===0){gn(Y.t("analysisManager.NoSolarPanelForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyPvIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForSolarPanels=!0})},100)},x=()=>{if(i(z.SolarPanel)===0){gn(Y.t("analysisManager.NoSolarPanelForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyPvIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForSolarPanels=!0})},100)},b=()=>{if(M.getState().countObservers()===0){gn(Y.t("analysisManager.NoObserverForVisibilityAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{dt.getState().set(V=>{V.runSolarPanelVisibilityAnalysis=!V.runSolarPanelVisibilityAnalysis,V.simulationInProgress=!0}),d&&o(V=>{V.actionInfo={name:"Run Visibility Analysis For Solar Panels",timestamp:new Date().getTime()}})},100)},R=()=>{if(i(z.ParabolicTrough)===0){gn(Y.t("analysisManager.NoParabolicTroughForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyParabolicTroughIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForParabolicTroughs=!0})},100)},H=()=>{if(i(z.ParabolicTrough)===0){gn(Y.t("analysisManager.NoParabolicTroughForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyParabolicTroughIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForParabolicTroughs=!0})},100)},F=()=>{if(i(z.ParabolicDish)===0){gn(Y.t("analysisManager.NoParabolicDishForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyParabolicDishIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForParabolicDishes=!0})},100)},E=()=>{if(i(z.ParabolicDish)===0){gn(Y.t("analysisManager.NoParabolicDishForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyParabolicDishIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForParabolicDishes=!0})},100)},N=()=>{if(i(z.FresnelReflector)===0){gn(Y.t("analysisManager.NoFresnelReflectorForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyFresnelReflectorIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForFresnelReflectors=!0})},100)},U=()=>{if(i(z.FresnelReflector)===0){gn(Y.t("analysisManager.NoFresnelReflectorForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyFresnelReflectorIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForFresnelReflectors=!0})},100)},W=()=>{if(i(z.Heliostat)===0){gn(Y.t("analysisManager.NoHeliostatForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyHeliostatIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForHeliostats=!0})},100)},k=()=>{if(i(z.Heliostat)===0){gn(Y.t("analysisManager.NoHeliostatForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyHeliostatIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForHeliostats=!0})},100)},D=()=>{if(M.getState().countSolarStructuresByType(Dn.UpdraftTower)===0){gn(Y.t("analysisManager.NoSolarUpdraftTowerForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.dailyUpdraftTowerIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Daily Simulation for Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runDailySimulationForUpdraftTower=!0})},100)},L=()=>{if(M.getState().countSolarStructuresByType(Dn.UpdraftTower)===0){gn(Y.t("analysisManager.NoSolarUpdraftTowerForAnalysis",e));return}gn(Y.t("message.SimulationStarted",e)),setTimeout(()=>{o(V=>{V.graphState&&(V.graphState.yearlyUpdraftTowerIndividualOutputs=!1),d&&(V.actionInfo={name:"Run Yearly Simulation for Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(V=>{V.simulationInProgress=!0,V.runYearlySimulationForUpdraftTower=!0})},100)},j=[];j.push({key:"solar-radiation-heatmap-grid-cell-size",label:h.jsx(MN,{type:rs.BUILDING})}),j.push({key:"solar-radiation-heatmap-max-value",label:h.jsx(Tjn,{})}),me.hasHeliostatOrFresnelReflectors(u)&&j.push({key:"solar-radiation-heatmap-reflection-only",label:h.jsx(cae,{selector:xge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForHeatmapSimulation=O})},children:Y.t("menu.physics.ReflectionHeatmap",e)+":"})}),f||j.push({key:"solar-radiation-heatmap-no-animation",label:h.jsx(cae,{selector:Rge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForHeatmapSimulation=O})},children:Y.t("menu.physics.SolarRadiationHeatmapNoAnimation",e)+":"})}),p.push({key:"physics-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.physicsSubMenu",e)}),children:[{key:"daily-solar-radiation-heatmap",label:h.jsx(an,{noPadding:!0,onClick:y,children:Y.t("menu.physics.DailySolarRadiationHeatmap",e)})},{key:"solar-radiation-heatmap-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.physics.SolarRadiationHeatmapOptions",e)}),children:j}]});const B=[];return B.push({key:"sensor-simulation-sampling-frequency",label:h.jsx(Pjn,{})}),f||B.push({key:"sensor-simulation-no-animation",label:h.jsx(cae,{selector:Hge,onChange:O=>{M.getState().set(V=>{V.world.noAnimationForSensorDataCollection=O})},children:Y.t("menu.sensor.SensorSimulationNoAnimation",e)+":"})}),t.sensorCount>0&&p.push({key:"sensor-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.sensorSubMenu",e)}),children:[{key:"sensor-collect-daily-data",label:h.jsx(an,{noPadding:!0,onClick:C,children:Y.t("menu.sensor.CollectDailyData",e)})},{key:"sensor-collect-yearly-data",label:h.jsx(an,{noPadding:!0,onClick:P,children:Y.t("menu.sensor.CollectYearlyData",e)})},{key:"sensor-simulation-options-submenu-2",label:h.jsx(an,{noPadding:!0,children:Y.t("word.Options",e)}),children:B}]}),t.wallCount>0&&p.push({key:"buildings-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingSubMenu",e)}),children:[{key:"building-energy-daily-data",label:h.jsx(an,{noPadding:!0,onClick:v,children:Y.t("menu.building.AnalyzeDailyBuildingEnergy",e)})},{key:"building-energy-yearly-data",label:h.jsx(an,{noPadding:!0,onClick:T,children:Y.t("menu.building.AnalyzeYearlyBuildingEnergy",e)})},{key:"building-energy-analysis-options-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.building.EnergyAnalysisOptions",e)}),children:vjn()}]}),t.solarPanelCount>0&&p.push({key:"solar-panels-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanelSubMenu",e)}),children:[{key:"solar-panel-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:w,children:Y.t("menu.solarPanel.AnalyzeDailyYield",e)})},{key:"solar-panel-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:x,children:Y.t("menu.solarPanel.AnalyzeYearlyYield",e)})},{key:"solar-panel-energy-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanel.EnergyAnalysisOptions",e)}),children:Sjn(f)},{key:"solar-panel-visibility",label:h.jsx(an,{noPadding:!0,onClick:b,children:Y.t("menu.solarPanel.AnalyzeVisibility",e)})},{key:"solar-panel-visibility-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarPanel.VisibilityAnalysisOptions",e)}),children:[{key:"solar-panel-visibility-grid-cell-size",label:h.jsx(Cjn,{})}]}]}),t.parabolicTroughCount>0&&p.push({key:"parabolic-troughs-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.parabolicTroughSubMenu",e)}),children:[{key:"parabolic-trough-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:R,children:Y.t("menu.parabolicTrough.AnalyzeDailyYield",e)})},{key:"parabolic-trough-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:H,children:Y.t("menu.parabolicTrough.AnalyzeYearlyYield",e)})},{key:"parabolic-trough-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("parabolic-trough")}]}),t.parabolicDishCount>0&&p.push({key:"parabolic-dishes-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.parabolicDishSubMenu",e)}),children:[{key:"parabolic-dish-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:F,children:Y.t("menu.parabolicDish.AnalyzeDailyYield",e)})},{key:"parabolic-dish-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:E,children:Y.t("menu.parabolicDish.AnalyzeYearlyYield",e)})},{key:"parabolic-dish-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("parabolic-dish")}]}),t.fresnelReflectorCount>0&&p.push({key:"fresnel-reflector-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.fresnelReflectorSubMenu",e)}),children:[{key:"fresnel-reflector-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:N,children:Y.t("menu.fresnelReflector.AnalyzeDailyYield",e)})},{key:"fresnel-reflector-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:U,children:Y.t("menu.fresnelReflector.AnalyzeYearlyYield",e)})},{key:"fresnel-reflector-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("fresnel-reflector")}]}),t.heliostatCount>0&&p.push({key:"heliostat-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.heliostatSubMenu",e)}),children:[{key:"heliostat-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:W,children:Y.t("menu.heliostat.AnalyzeDailyYield",e)})},{key:"heliostat-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:k,children:Y.t("menu.heliostat.AnalyzeYearlyYield",e)})},{key:"heliostat-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:PO("heliostat-analysis")}]}),t.solarUpdraftTowerCount>0&&p.push({key:"solar-updraft-tower-submenu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarUpdraftTowerSubMenu",e)}),children:[{key:"solar-updraft-tower-daily-yield",label:h.jsx(an,{noPadding:!0,onClick:D,children:Y.t("menu.solarUpdraftTower.AnalyzeDailyYield",e)})},{key:"solar-updraft-tower-yearly-yield",label:h.jsx(an,{noPadding:!0,onClick:L,children:Y.t("menu.solarUpdraftTower.AnalyzeYearlyYield",e)})},{key:"solar-updraft-tower-analysis-options",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.AnalysisOptions",e)}),children:Rjn()}]}),p};/** * @license * Copyright 2017 Google LLC * @@ -5243,7 +5243,7 @@ and limitations under the License. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var Xf,TX="[DEFAULT]",gBn=(Xf={},Xf[DZe]="fire-core",Xf[oBn]="fire-analytics",Xf[rBn]="fire-app-check",Xf[iBn]="fire-auth",Xf[aBn]="fire-rtdb",Xf[lBn]="fire-fn",Xf[sBn]="fire-iid",Xf[cBn]="fire-fcm",Xf[uBn]="fire-perf",Xf[dBn]="fire-rc",Xf[fBn]="fire-gcs",Xf[hBn]="fire-fst",Xf["fire-js"]="fire-js",Xf[pBn]="fire-js-all",Xf);/** + */var Jf,TX="[DEFAULT]",gBn=(Jf={},Jf[DZe]="fire-core",Jf[oBn]="fire-analytics",Jf[rBn]="fire-app-check",Jf[iBn]="fire-auth",Jf[aBn]="fire-rtdb",Jf[lBn]="fire-fn",Jf[sBn]="fire-iid",Jf[cBn]="fire-fcm",Jf[uBn]="fire-perf",Jf[dBn]="fire-rc",Jf[fBn]="fire-gcs",Jf[hBn]="fire-fst",Jf["fire-js"]="fire-js",Jf[pBn]="fire-js-all",Jf);/** * @license * Copyright 2019 Google LLC * @@ -5394,14 +5394,14 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Hde=function(t,e){return Hde=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},Hde(t,e)};function SBn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Hde(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function kZe(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var TBn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yr,b2e=b2e||{},na=TBn||self;function PX(){}function Mde(t){var e=typeof t;return e=e!="object"?e:t?Array.isArray(t)?"array":e:"null",e=="array"||e=="object"&&typeof t.length=="number"}function mZ(t){var e=typeof t;return e=="object"&&t!=null||e=="function"}function PBn(t){return Object.prototype.hasOwnProperty.call(t,gae)&&t[gae]||(t[gae]=++CBn)}var gae="closure_uid_"+(1e9*Math.random()>>>0),CBn=0;function RBn(t,e,n){return t.call.apply(t.bind,arguments)}function HBn(t,e,n){if(!t)throw Error();if(2e?null:typeof t=="string"?t.charAt(e):t[e]}function fPe(t){return Array.prototype.concat.apply([],arguments)}function S2e(t){var e=t.length;if(0e?1:0}var ep;e:{var pPe=na.navigator;if(pPe){var gPe=pPe.userAgent;if(gPe){ep=gPe;break e}}ep=""}function T2e(t,e,n){for(var o in t)e.call(n,t[o],o,t)}function NZe(t){var e={};for(var n in t)e[n]=t[n];return e}var mPe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function UZe(t,e){for(var n,o,r=1;rparseFloat(yae)){RX=String(wae);break e}}RX=yae}var FBn={};function kBn(){return zBn(function(){for(var t=0,e=hPe(String(RX)).split("."),n=hPe("9").split("."),o=Math.max(e.length,n.length),r=0;t==0&&r>>0);function GZe(t){return typeof t=="function"?t:(t[xae]||(t[xae]=function(e){return t.handleEvent(e)}),t[xae])}function Md(){_w.call(this),this.i=new wZ(this),this.P=this,this.I=null}Mf(Md,_w);Md.prototype[yZ]=!0;Md.prototype.removeEventListener=function(t,e,n,o){VZe(this,t,e,n,o)};function yf(t,e){var n,o=t.I;if(o)for(n=[];o;o=o.I)n.push(o);if(t=t.P,o=e.type||e,typeof e=="string")e=new ph(e,t);else if(e instanceof ph)e.target=e.target||t;else{var r=e;e=new ph(o,t),UZe(e,r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var a=e.g=n[i];r=RO(a,o,!0,e)&&r}if(a=e.g=t,r=RO(a,o,!0,e)&&r,r=RO(a,o,!1,e)&&r,n)for(i=0;ie.h&&(e.h++,t.next=e.g,e.g=t)}kde=!1}function vZ(t,e){Md.call(this),this.h=t||1,this.g=e||na,this.j=mf(this.kb,this),this.l=Date.now()}Mf(vZ,Md);Yr=vZ.prototype;Yr.da=!1;Yr.S=null;Yr.kb=function(){if(this.da){var t=Date.now()-this.l;0=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var TBn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yr,b2e=b2e||{},na=TBn||self;function PX(){}function Mde(t){var e=typeof t;return e=e!="object"?e:t?Array.isArray(t)?"array":e:"null",e=="array"||e=="object"&&typeof t.length=="number"}function mZ(t){var e=typeof t;return e=="object"&&t!=null||e=="function"}function PBn(t){return Object.prototype.hasOwnProperty.call(t,gae)&&t[gae]||(t[gae]=++CBn)}var gae="closure_uid_"+(1e9*Math.random()>>>0),CBn=0;function RBn(t,e,n){return t.call.apply(t.bind,arguments)}function HBn(t,e,n){if(!t)throw Error();if(2e?null:typeof t=="string"?t.charAt(e):t[e]}function fPe(t){return Array.prototype.concat.apply([],arguments)}function S2e(t){var e=t.length;if(0e?1:0}var ep;e:{var pPe=na.navigator;if(pPe){var gPe=pPe.userAgent;if(gPe){ep=gPe;break e}}ep=""}function T2e(t,e,n){for(var o in t)e.call(n,t[o],o,t)}function NZe(t){var e={};for(var n in t)e[n]=t[n];return e}var mPe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function UZe(t,e){for(var n,o,r=1;rparseFloat(yae)){RX=String(wae);break e}}RX=yae}var FBn={};function kBn(){return zBn(function(){for(var t=0,e=hPe(String(RX)).split("."),n=hPe("9").split("."),o=Math.max(e.length,n.length),r=0;t==0&&r>>0);function GZe(t){return typeof t=="function"?t:(t[xae]||(t[xae]=function(e){return t.handleEvent(e)}),t[xae])}function Md(){_w.call(this),this.i=new wZ(this),this.P=this,this.I=null}If(Md,_w);Md.prototype[yZ]=!0;Md.prototype.removeEventListener=function(t,e,n,o){VZe(this,t,e,n,o)};function yf(t,e){var n,o=t.I;if(o)for(n=[];o;o=o.I)n.push(o);if(t=t.P,o=e.type||e,typeof e=="string")e=new gh(e,t);else if(e instanceof gh)e.target=e.target||t;else{var r=e;e=new gh(o,t),UZe(e,r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var a=e.g=n[i];r=RO(a,o,!0,e)&&r}if(a=e.g=t,r=RO(a,o,!0,e)&&r,r=RO(a,o,!1,e)&&r,n)for(i=0;ie.h&&(e.h++,t.next=e.g,e.g=t)}kde=!1}function vZ(t,e){Md.call(this),this.h=t||1,this.g=e||na,this.j=mf(this.kb,this),this.l=Date.now()}If(vZ,Md);Yr=vZ.prototype;Yr.da=!1;Yr.S=null;Yr.kb=function(){if(this.da){var t=Date.now()-this.l;0o.length)){var r=o[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if(i!="noop"&&i!="stop"&&i!="close")for(var a=1;ae)&&(e!=3||Ide||this.g&&(this.h.h||this.g.ga()||TPe(this.g)))){this.I||e!=4||n==7||(n==8||0>=o?Ck(3):Ck(2)),PZ(this);var r=this.g.ba();this.N=r;t:if(iet(this)){var i=TPe(this.g);t="";var a=i.length,l=C6(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){qv(this),LE(this);var s="";break t}this.h.i=new na.TextDecoder}for(n=0;ne.length?HX:(e=e.substr(o,n),t.C=o+n,e)))}Yr.cancel=function(){this.I=!0,qv(this)};function EN(t){t.Y=Date.now()+t.P,set(t,t.P)}function set(t,e){if(t.B!=null)throw Error("WatchDog timer not null");t.B=IN(mf(t.eb,t),e)}function PZ(t){t.B&&(na.clearTimeout(t.B),t.B=null)}Yr.eb=function(){this.B=null;var t=Date.now();0<=t-this.Y?(ZBn(this.j,this.A),this.K!=2&&(Ck(),ap(17)),qv(this),this.o=2,LE(this)):set(this,this.Y-t)};function LE(t){t.l.G==0||t.I||Met(t.l,t)}function qv(t){PZ(t);var e=t.L;e&&typeof e.na=="function"&&e.na(),t.L=null,z2e(t.W),$Ze(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ude(t,e){try{var n=t.l;if(n.G!=0&&(n.g==t||jde(n.i,t))){if(n.I=t.N,!t.J&&jde(n.i,t)&&n.G==3){try{var o=n.Ca.g.parse(e)}catch{o=null}if(Array.isArray(o)&&o.length==3){var r=o;if(r[0]==0){e:if(!n.u){if(n.g)if(n.g.F+3e3r[2]&&n.N&&n.A==0&&!n.v&&(n.v=IN(mf(n.ab,n),6e3));if(1>=get(n.i)&&n.ka){try{n.ka()}catch{}n.ka=void 0}}else $v(n,11)}else if((t.J||n.g==t)&&DX(n),!CX(e))for(r=n.Ca.g.parse(e),e=0;ee)throw Error("Bad port number "+e);t.m=e}else t.m=null}function xPe(t,e,n){e instanceof Rk?(t.h=e,fYn(t.h,t.g)):(n||(e=VD(e,uYn)),t.h=new Rk(e,t.g))}function jc(t,e,n){t.h.set(e,n)}function CZ(t){return jc(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function iYn(t){return t instanceof sb?sA(t):new sb(t,void 0)}function aYn(t,e,n,o){var r=new sb(null,void 0);return t&&MX(r,t),e&&IX(r,e),n&&zX(r,n),o&&(r.l=o),r}function WE(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function VD(t,e,n){return typeof t=="string"?(t=encodeURI(t).replace(e,lYn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function lYn(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var bPe=/[#\/\?@]/g,sYn=/[#\?:]/g,cYn=/[#\?]/g,uYn=/[#\?@]/g,dYn=/#/g;function Rk(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Gw(t){t.g||(t.g=new iM,t.h=0,t.i&&rYn(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}Yr=Rk.prototype;Yr.add=function(t,e){Gw(this),this.i=null,t=aM(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this};function uet(t,e){Gw(t),e=aM(t,e),lb(t.g.h,e)&&(t.i=null,t.h-=t.g.get(e).length,t=t.g,lb(t.h,e)&&(delete t.h[e],t.i--,t.g.length>2*t.i&&W2e(t)))}function det(t,e){return Gw(t),e=aM(t,e),lb(t.g.h,e)}Yr.forEach=function(t,e){Gw(this),this.g.forEach(function(n,o){WZe(n,function(r){t.call(e,r,o,this)},this)},this)};Yr.T=function(){Gw(this);for(var t=this.g.R(),e=this.g.T(),n=[],o=0;o=t.j:!1}function get(t){return t.h?1:t.g?t.g.size:0}function jde(t,e){return t.h?t.h==e:t.g?t.g.has(e):!1}function N2e(t,e){t.g?t.g.add(e):t.h=e}function met(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}het.prototype.cancel=function(){var t,e;if(this.i=yet(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){try{for(var n=kZe(this.g.values()),o=n.next();!o.done;o=n.next()){var r=o.value;r.cancel()}}catch(i){t={error:i}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}};function yet(t){var e,n;if(t.h!=null)return t.i.concat(t.h.D);if(t.g!=null&&t.g.size!==0){var o=t.i;try{for(var r=kZe(t.g.values()),i=r.next();!i.done;i=r.next()){var a=i.value;o=o.concat(a.D)}}catch(l){e={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return o}return S2e(t.i)}function U2e(){}U2e.prototype.stringify=function(t){return na.JSON.stringify(t,void 0)};U2e.prototype.parse=function(t){return na.JSON.parse(t,void 0)};function gYn(){this.g=new U2e}function mYn(t,e,n){var o=n||"";try{L2e(t,function(r,i){var a=r;mZ(r)&&(a=M2e(r)),e.push(o+i+"="+encodeURIComponent(a))})}catch(r){throw e.push(o+"type="+encodeURIComponent("_badmap")),r}}function yYn(t,e){var n=new xZ;if(na.Image){var o=new Image;o.onload=CO(HO,n,o,"TestLoadImage: loaded",!0,e),o.onerror=CO(HO,n,o,"TestLoadImage: error",!1,e),o.onabort=CO(HO,n,o,"TestLoadImage: abort",!1,e),o.ontimeout=CO(HO,n,o,"TestLoadImage: timeout",!1,e),na.setTimeout(function(){o.ontimeout&&o.ontimeout()},1e4),o.src=t}else e(!1)}function HO(t,e,n,o,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(o)}catch{}}function FN(t){this.l=t.$b||null,this.j=t.ib||!1}Mf(FN,E2e);FN.prototype.g=function(){return new RZ(this.l,this.j)};FN.prototype.i=function(t){return function(){return t}}({});function RZ(t,e){Md.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=j2e,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Mf(RZ,Md);var j2e=0;Yr=RZ.prototype;Yr.open=function(t,e){if(this.readyState!=j2e)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Hk(this)};Yr.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||na).fetch(new Request(this.B,e)).then(this.Va.bind(this),this.ha.bind(this))};Yr.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,kN(this)),this.readyState=j2e};Yr.Va=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Hk(this)),this.g&&(this.readyState=3,Hk(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if(typeof na.ReadableStream<"u"&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Aet(this)}else t.text().then(this.Ua.bind(this),this.ha.bind(this))};function Aet(t){t.j.read().then(t.Sa.bind(t)).catch(t.ha.bind(t))}Yr.Sa=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?kN(this):Hk(this),this.readyState==3&&Aet(this)}};Yr.Ua=function(t){this.g&&(this.response=this.responseText=t,kN(this))};Yr.Ta=function(t){this.g&&(this.response=t,kN(this))};Yr.ha=function(){this.g&&kN(this)};function kN(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Hk(t)}Yr.setRequestHeader=function(t,e){this.v.append(t,e)};Yr.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""};Yr.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join(`\r -`)};function Hk(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(RZ.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});var AYn=na.JSON.parse;function fu(t){Md.call(this),this.headers=new iM,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=wet,this.K=this.L=!1}Mf(fu,Md);var wet="",wYn=/^https?$/i,vYn=["POST","PUT"];Yr=fu.prototype;Yr.ea=function(t,e,n,o){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():Lde.g(),this.C=this.u?vPe(this.u):vPe(Lde),this.g.onreadystatechange=mf(this.Fa,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(i){SPe(this,i);return}t=n||"";var r=new iM(this.headers);o&&L2e(o,function(i,a){r.set(a,i)}),o=IBn(r.T()),n=na.FormData&&t instanceof na.FormData,!(0<=LZe(vYn,e))||o||n||r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),r.forEach(function(i,a){this.g.setRequestHeader(a,i)},this),this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{bet(this),0=t.i.j-(t.m?1:0)?!1:t.m?(t.l=e.D.concat(t.l),!0):t.G==1||t.G==2||t.C>=(t.Xa?0:t.Ya)?!1:(t.m=IN(mf(t.Ha,t,e),Iet(t,t.C)),t.C++,!0)}Yr.Ha=function(t){if(this.m)if(this.m=null,this.G==1){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var e=new DN(this,this.h,t,void 0),n=this.s;if(this.P&&(n?(n=NZe(n),UZe(n,this.P)):n=this.P),this.o===null&&(e.H=n),this.ja)e:{for(var o=0,r=0;rc)i=Math.max(0,r[s].h-100),l=!1;else try{mYn(u,a,"req"+c+"_")}catch{o&&o(u)}}if(l){o=a.join("&");break e}}return t=t.l.splice(0,n),e.D=t,o}function Ret(t){t.g||t.u||(t.Y=1,I2e(t.Ga,t),t.A=0)}function O2e(t){return t.g||t.u||3<=t.A?!1:(t.Y++,t.u=IN(mf(t.Ga,t),Iet(t,t.A)),t.A++,!0)}Yr.Ga=function(){if(this.u=null,Het(this),this.$&&!(this.L||this.g==null||0>=this.O)){var t=2*this.O;this.h.info("BP detection timer enabled: "+t),this.B=IN(mf(this.bb,this),t)}};Yr.bb=function(){this.B&&(this.B=null,this.h.info("BP detection timeout reached."),this.h.info("Buffering proxy detected and switch to long-polling!"),this.N=!1,this.L=!0,ap(10),MZ(this),Het(this))};function V2e(t){t.B!=null&&(na.clearTimeout(t.B),t.B=null)}function Het(t){t.g=new DN(t,t.h,"rpc",t.Y),t.o===null&&(t.g.H=t.s),t.g.O=0;var e=sA(t.oa);jc(e,"RID","rpc"),jc(e,"SID",t.J),jc(e,"CI",t.N?"0":"1"),jc(e,"AID",t.U),LN(t,e),jc(e,"TYPE","xmlhttp"),t.o&&t.s&&B2e(e,t.o,t.s),t.K&&t.g.setTimeout(t.K);var n=t.g;t=t.la,n.K=1,n.v=CZ(sA(e)),n.s=null,n.U=!0,ret(n,t)}Yr.ab=function(){this.v!=null&&(this.v=null,MZ(this),O2e(this),ap(19))};function DX(t){t.v!=null&&(na.clearTimeout(t.v),t.v=null)}function Met(t,e){var n=null;if(t.g==e){DX(t),V2e(t),t.g=null;var o=2}else if(jde(t.i,e))n=e.D,met(t.i,e),o=1;else return;if(t.I=e.N,t.G!=0){if(e.i)if(o==1){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;o=bZ(),yf(o,new eet(o,n)),IZ(t)}else Ret(t);else if(r=e.o,r==3||r==0&&0o.length)){var r=o[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if(i!="noop"&&i!="stop"&&i!="close")for(var a=1;ae)&&(e!=3||Ide||this.g&&(this.h.h||this.g.ga()||TPe(this.g)))){this.I||e!=4||n==7||(n==8||0>=o?Ck(3):Ck(2)),PZ(this);var r=this.g.ba();this.N=r;t:if(iet(this)){var i=TPe(this.g);t="";var a=i.length,l=C6(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){qv(this),LE(this);var s="";break t}this.h.i=new na.TextDecoder}for(n=0;ne.length?HX:(e=e.substr(o,n),t.C=o+n,e)))}Yr.cancel=function(){this.I=!0,qv(this)};function EN(t){t.Y=Date.now()+t.P,set(t,t.P)}function set(t,e){if(t.B!=null)throw Error("WatchDog timer not null");t.B=IN(mf(t.eb,t),e)}function PZ(t){t.B&&(na.clearTimeout(t.B),t.B=null)}Yr.eb=function(){this.B=null;var t=Date.now();0<=t-this.Y?(ZBn(this.j,this.A),this.K!=2&&(Ck(),ap(17)),qv(this),this.o=2,LE(this)):set(this,this.Y-t)};function LE(t){t.l.G==0||t.I||Met(t.l,t)}function qv(t){PZ(t);var e=t.L;e&&typeof e.na=="function"&&e.na(),t.L=null,z2e(t.W),$Ze(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ude(t,e){try{var n=t.l;if(n.G!=0&&(n.g==t||jde(n.i,t))){if(n.I=t.N,!t.J&&jde(n.i,t)&&n.G==3){try{var o=n.Ca.g.parse(e)}catch{o=null}if(Array.isArray(o)&&o.length==3){var r=o;if(r[0]==0){e:if(!n.u){if(n.g)if(n.g.F+3e3r[2]&&n.N&&n.A==0&&!n.v&&(n.v=IN(mf(n.ab,n),6e3));if(1>=get(n.i)&&n.ka){try{n.ka()}catch{}n.ka=void 0}}else $v(n,11)}else if((t.J||n.g==t)&&DX(n),!CX(e))for(r=n.Ca.g.parse(e),e=0;ee)throw Error("Bad port number "+e);t.m=e}else t.m=null}function xPe(t,e,n){e instanceof Rk?(t.h=e,fYn(t.h,t.g)):(n||(e=VD(e,uYn)),t.h=new Rk(e,t.g))}function jc(t,e,n){t.h.set(e,n)}function CZ(t){return jc(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function iYn(t){return t instanceof sb?sA(t):new sb(t,void 0)}function aYn(t,e,n,o){var r=new sb(null,void 0);return t&&MX(r,t),e&&IX(r,e),n&&zX(r,n),o&&(r.l=o),r}function WE(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function VD(t,e,n){return typeof t=="string"?(t=encodeURI(t).replace(e,lYn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function lYn(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var bPe=/[#\/\?@]/g,sYn=/[#\?:]/g,cYn=/[#\?]/g,uYn=/[#\?@]/g,dYn=/#/g;function Rk(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Gw(t){t.g||(t.g=new iM,t.h=0,t.i&&rYn(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}Yr=Rk.prototype;Yr.add=function(t,e){Gw(this),this.i=null,t=aM(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this};function uet(t,e){Gw(t),e=aM(t,e),lb(t.g.h,e)&&(t.i=null,t.h-=t.g.get(e).length,t=t.g,lb(t.h,e)&&(delete t.h[e],t.i--,t.g.length>2*t.i&&W2e(t)))}function det(t,e){return Gw(t),e=aM(t,e),lb(t.g.h,e)}Yr.forEach=function(t,e){Gw(this),this.g.forEach(function(n,o){WZe(n,function(r){t.call(e,r,o,this)},this)},this)};Yr.T=function(){Gw(this);for(var t=this.g.R(),e=this.g.T(),n=[],o=0;o=t.j:!1}function get(t){return t.h?1:t.g?t.g.size:0}function jde(t,e){return t.h?t.h==e:t.g?t.g.has(e):!1}function N2e(t,e){t.g?t.g.add(e):t.h=e}function met(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}het.prototype.cancel=function(){var t,e;if(this.i=yet(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){try{for(var n=kZe(this.g.values()),o=n.next();!o.done;o=n.next()){var r=o.value;r.cancel()}}catch(i){t={error:i}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}};function yet(t){var e,n;if(t.h!=null)return t.i.concat(t.h.D);if(t.g!=null&&t.g.size!==0){var o=t.i;try{for(var r=kZe(t.g.values()),i=r.next();!i.done;i=r.next()){var a=i.value;o=o.concat(a.D)}}catch(l){e={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return o}return S2e(t.i)}function U2e(){}U2e.prototype.stringify=function(t){return na.JSON.stringify(t,void 0)};U2e.prototype.parse=function(t){return na.JSON.parse(t,void 0)};function gYn(){this.g=new U2e}function mYn(t,e,n){var o=n||"";try{L2e(t,function(r,i){var a=r;mZ(r)&&(a=M2e(r)),e.push(o+i+"="+encodeURIComponent(a))})}catch(r){throw e.push(o+"type="+encodeURIComponent("_badmap")),r}}function yYn(t,e){var n=new xZ;if(na.Image){var o=new Image;o.onload=CO(HO,n,o,"TestLoadImage: loaded",!0,e),o.onerror=CO(HO,n,o,"TestLoadImage: error",!1,e),o.onabort=CO(HO,n,o,"TestLoadImage: abort",!1,e),o.ontimeout=CO(HO,n,o,"TestLoadImage: timeout",!1,e),na.setTimeout(function(){o.ontimeout&&o.ontimeout()},1e4),o.src=t}else e(!1)}function HO(t,e,n,o,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(o)}catch{}}function FN(t){this.l=t.$b||null,this.j=t.ib||!1}If(FN,E2e);FN.prototype.g=function(){return new RZ(this.l,this.j)};FN.prototype.i=function(t){return function(){return t}}({});function RZ(t,e){Md.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=j2e,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}If(RZ,Md);var j2e=0;Yr=RZ.prototype;Yr.open=function(t,e){if(this.readyState!=j2e)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Hk(this)};Yr.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||na).fetch(new Request(this.B,e)).then(this.Va.bind(this),this.ha.bind(this))};Yr.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,kN(this)),this.readyState=j2e};Yr.Va=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Hk(this)),this.g&&(this.readyState=3,Hk(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if(typeof na.ReadableStream<"u"&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Aet(this)}else t.text().then(this.Ua.bind(this),this.ha.bind(this))};function Aet(t){t.j.read().then(t.Sa.bind(t)).catch(t.ha.bind(t))}Yr.Sa=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?kN(this):Hk(this),this.readyState==3&&Aet(this)}};Yr.Ua=function(t){this.g&&(this.response=this.responseText=t,kN(this))};Yr.Ta=function(t){this.g&&(this.response=t,kN(this))};Yr.ha=function(){this.g&&kN(this)};function kN(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Hk(t)}Yr.setRequestHeader=function(t,e){this.v.append(t,e)};Yr.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""};Yr.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join(`\r +`)};function Hk(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(RZ.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});var AYn=na.JSON.parse;function fu(t){Md.call(this),this.headers=new iM,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=wet,this.K=this.L=!1}If(fu,Md);var wet="",wYn=/^https?$/i,vYn=["POST","PUT"];Yr=fu.prototype;Yr.ea=function(t,e,n,o){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():Lde.g(),this.C=this.u?vPe(this.u):vPe(Lde),this.g.onreadystatechange=mf(this.Fa,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(i){SPe(this,i);return}t=n||"";var r=new iM(this.headers);o&&L2e(o,function(i,a){r.set(a,i)}),o=IBn(r.T()),n=na.FormData&&t instanceof na.FormData,!(0<=LZe(vYn,e))||o||n||r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),r.forEach(function(i,a){this.g.setRequestHeader(a,i)},this),this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{bet(this),0=t.i.j-(t.m?1:0)?!1:t.m?(t.l=e.D.concat(t.l),!0):t.G==1||t.G==2||t.C>=(t.Xa?0:t.Ya)?!1:(t.m=IN(mf(t.Ha,t,e),Iet(t,t.C)),t.C++,!0)}Yr.Ha=function(t){if(this.m)if(this.m=null,this.G==1){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var e=new DN(this,this.h,t,void 0),n=this.s;if(this.P&&(n?(n=NZe(n),UZe(n,this.P)):n=this.P),this.o===null&&(e.H=n),this.ja)e:{for(var o=0,r=0;rc)i=Math.max(0,r[s].h-100),l=!1;else try{mYn(u,a,"req"+c+"_")}catch{o&&o(u)}}if(l){o=a.join("&");break e}}return t=t.l.splice(0,n),e.D=t,o}function Ret(t){t.g||t.u||(t.Y=1,I2e(t.Ga,t),t.A=0)}function O2e(t){return t.g||t.u||3<=t.A?!1:(t.Y++,t.u=IN(mf(t.Ga,t),Iet(t,t.A)),t.A++,!0)}Yr.Ga=function(){if(this.u=null,Het(this),this.$&&!(this.L||this.g==null||0>=this.O)){var t=2*this.O;this.h.info("BP detection timer enabled: "+t),this.B=IN(mf(this.bb,this),t)}};Yr.bb=function(){this.B&&(this.B=null,this.h.info("BP detection timeout reached."),this.h.info("Buffering proxy detected and switch to long-polling!"),this.N=!1,this.L=!0,ap(10),MZ(this),Het(this))};function V2e(t){t.B!=null&&(na.clearTimeout(t.B),t.B=null)}function Het(t){t.g=new DN(t,t.h,"rpc",t.Y),t.o===null&&(t.g.H=t.s),t.g.O=0;var e=sA(t.oa);jc(e,"RID","rpc"),jc(e,"SID",t.J),jc(e,"CI",t.N?"0":"1"),jc(e,"AID",t.U),LN(t,e),jc(e,"TYPE","xmlhttp"),t.o&&t.s&&B2e(e,t.o,t.s),t.K&&t.g.setTimeout(t.K);var n=t.g;t=t.la,n.K=1,n.v=CZ(sA(e)),n.s=null,n.U=!0,ret(n,t)}Yr.ab=function(){this.v!=null&&(this.v=null,MZ(this),O2e(this),ap(19))};function DX(t){t.v!=null&&(na.clearTimeout(t.v),t.v=null)}function Met(t,e){var n=null;if(t.g==e){DX(t),V2e(t),t.g=null;var o=2}else if(jde(t.i,e))n=e.D,met(t.i,e),o=1;else return;if(t.I=e.N,t.G!=0){if(e.i)if(o==1){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;o=bZ(),yf(o,new eet(o,n)),IZ(t)}else Ret(t);else if(r=e.o,r==3||r==0&&00&&(this.k=!0,this.C=e)},t.prototype.M=function(){var e=Ks(),n=Ks(),o=Ks();return this.D.forEach(function(r,i){switch(i){case 0:e=e.add(r);break;case 2:n=n.add(r);break;case 1:o=o.add(r);break;default:ni()}}),new e5e(this.C,this.N,e,n,o)},t.prototype.L=function(){this.k=!1,this.D=YPe()},t.prototype.B=function(e,n){this.k=!0,this.D=this.D.insert(e,n)},t.prototype.q=function(e){this.k=!0,this.D=this.D.remove(e)},t.prototype.U=function(){this.S+=1},t.prototype.K=function(){this.S-=1},t.prototype.j=function(){this.k=!0,this.N=!0},t}(),oOn=function(){function t(e){this.W=e,this.G=new Map,this.H=N2(),this.J=BPe(),this.Y=new ju(Ka)}return t.prototype.X=function(e){for(var n=0,o=e.v;n0?e.targetIds.forEach(n):this.G.forEach(function(r,i){o.st(i)&&n(i)})},t.prototype.rt=function(e){var n=e.targetId,o=e.V.count,r=this.ot(n);if(r){var i=r.target;if(WX(i))if(o===0){var a=new ci(i.path);this.tt(n,a,Ah.newNoDocument(a,La.min()))}else Ui(o===1);else this.ct(n)!==o&&(this.it(n),this.Y=this.Y.add(n))}},t.prototype.ut=function(e){var n=this,o=new Map;this.G.forEach(function(a,l){var s=n.ot(l);if(s){if(a.current&&WX(s.target)){var c=new ci(s.target.path);n.H.get(c)!==null||n.at(l,c)||n.tt(l,c,Ah.newNoDocument(c,e))}a.$&&(o.set(l,a.M()),a.L())}});var r=Ks();this.J.forEach(function(a,l){var s=!0;l.forEachWhile(function(c){var u=n.ot(c);return!u||u.purpose===2||(s=!1,!1)}),s&&(r=r.add(a))});var i=new Z2e(e,o,this.Y,this.H,r);return this.H=N2(),this.J=BPe(),this.Y=new ju(Ka),i},t.prototype.Z=function(e,n){if(this.st(e)){var o=this.at(e,n.key)?2:0;this.nt(e).B(n.key,o),this.H=this.H.insert(n.key,n),this.J=this.J.insert(n.key,this.ht(n.key).add(e))}},t.prototype.tt=function(e,n,o){if(this.st(e)){var r=this.nt(e);this.at(e,n)?r.B(n,1):r.q(n),this.J=this.J.insert(n,this.ht(n).delete(e)),o&&(this.H=this.H.insert(n,o))}},t.prototype.removeTarget=function(e){this.G.delete(e)},t.prototype.ct=function(e){var n=this.nt(e).M();return this.W.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size},t.prototype.U=function(e){this.nt(e).U()},t.prototype.nt=function(e){var n=this.G.get(e);return n||(n=new jPe,this.G.set(e,n)),n},t.prototype.ht=function(e){var n=this.J.get(e);return n||(n=new ju(Ka),this.J=this.J.insert(e,n)),n},t.prototype.st=function(e){var n=this.ot(e)!==null;return n||ur("WatchChangeAggregator","Detected inactive target",e),n},t.prototype.ot=function(e){var n=this.G.get(e);return n&&n.F?null:this.W.lt(e)},t.prototype.it=function(e){var n=this;this.G.set(e,new jPe),this.W.getRemoteKeysForTarget(e).forEach(function(o){n.tt(e,o,null)})},t.prototype.at=function(e,n){return this.W.getRemoteKeysForTarget(e).has(n)},t}();function BPe(){return new Ph(ci.comparator)}function YPe(){return new Ph(ci.comparator)}/** + */var Z2e=function(){function t(e,n,o,r,i){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=o,this.documentUpdates=r,this.resolvedLimboDocuments=i}return t.createSynthesizedRemoteEventForCurrentChange=function(e,n){var o=new Map;return o.set(e,e5e.createSynthesizedTargetChangeForCurrentChange(e,n)),new t(La.min(),o,FZ(),N2(),Ks())},t}(),e5e=function(){function t(e,n,o,r,i){this.resumeToken=e,this.current=n,this.addedDocuments=o,this.modifiedDocuments=r,this.removedDocuments=i}return t.createSynthesizedTargetChangeForCurrentChange=function(e,n){return new t(i1.EMPTY_BYTE_STRING,n,Ks(),Ks(),Ks())},t}(),g_=function(t,e,n,o){this.v=t,this.removedTargetIds=e,this.key=n,this.P=o},itt=function(t,e){this.targetId=t,this.V=e},att=function(t,e,n,o){n===void 0&&(n=i1.EMPTY_BYTE_STRING),o===void 0&&(o=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=o},jPe=function(){function t(){this.S=0,this.D=YPe(),this.C=i1.EMPTY_BYTE_STRING,this.N=!1,this.k=!0}return Object.defineProperty(t.prototype,"current",{get:function(){return this.N},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resumeToken",{get:function(){return this.C},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"F",{get:function(){return this.S!==0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"$",{get:function(){return this.k},enumerable:!1,configurable:!0}),t.prototype.O=function(e){e.approximateByteSize()>0&&(this.k=!0,this.C=e)},t.prototype.M=function(){var e=Ks(),n=Ks(),o=Ks();return this.D.forEach(function(r,i){switch(i){case 0:e=e.add(r);break;case 2:n=n.add(r);break;case 1:o=o.add(r);break;default:ni()}}),new e5e(this.C,this.N,e,n,o)},t.prototype.L=function(){this.k=!1,this.D=YPe()},t.prototype.B=function(e,n){this.k=!0,this.D=this.D.insert(e,n)},t.prototype.q=function(e){this.k=!0,this.D=this.D.remove(e)},t.prototype.U=function(){this.S+=1},t.prototype.K=function(){this.S-=1},t.prototype.j=function(){this.k=!0,this.N=!0},t}(),oOn=function(){function t(e){this.W=e,this.G=new Map,this.H=N2(),this.J=BPe(),this.Y=new ju(Ka)}return t.prototype.X=function(e){for(var n=0,o=e.v;n0?e.targetIds.forEach(n):this.G.forEach(function(r,i){o.st(i)&&n(i)})},t.prototype.rt=function(e){var n=e.targetId,o=e.V.count,r=this.ot(n);if(r){var i=r.target;if(WX(i))if(o===0){var a=new ci(i.path);this.tt(n,a,wh.newNoDocument(a,La.min()))}else Ui(o===1);else this.ct(n)!==o&&(this.it(n),this.Y=this.Y.add(n))}},t.prototype.ut=function(e){var n=this,o=new Map;this.G.forEach(function(a,l){var s=n.ot(l);if(s){if(a.current&&WX(s.target)){var c=new ci(s.target.path);n.H.get(c)!==null||n.at(l,c)||n.tt(l,c,wh.newNoDocument(c,e))}a.$&&(o.set(l,a.M()),a.L())}});var r=Ks();this.J.forEach(function(a,l){var s=!0;l.forEachWhile(function(c){var u=n.ot(c);return!u||u.purpose===2||(s=!1,!1)}),s&&(r=r.add(a))});var i=new Z2e(e,o,this.Y,this.H,r);return this.H=N2(),this.J=BPe(),this.Y=new ju(Ka),i},t.prototype.Z=function(e,n){if(this.st(e)){var o=this.at(e,n.key)?2:0;this.nt(e).B(n.key,o),this.H=this.H.insert(n.key,n),this.J=this.J.insert(n.key,this.ht(n.key).add(e))}},t.prototype.tt=function(e,n,o){if(this.st(e)){var r=this.nt(e);this.at(e,n)?r.B(n,1):r.q(n),this.J=this.J.insert(n,this.ht(n).delete(e)),o&&(this.H=this.H.insert(n,o))}},t.prototype.removeTarget=function(e){this.G.delete(e)},t.prototype.ct=function(e){var n=this.nt(e).M();return this.W.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size},t.prototype.U=function(e){this.nt(e).U()},t.prototype.nt=function(e){var n=this.G.get(e);return n||(n=new jPe,this.G.set(e,n)),n},t.prototype.ht=function(e){var n=this.J.get(e);return n||(n=new ju(Ka),this.J=this.J.insert(e,n)),n},t.prototype.st=function(e){var n=this.ot(e)!==null;return n||ur("WatchChangeAggregator","Detected inactive target",e),n},t.prototype.ot=function(e){var n=this.G.get(e);return n&&n.F?null:this.W.lt(e)},t.prototype.it=function(e){var n=this;this.G.set(e,new jPe),this.W.getRemoteKeysForTarget(e).forEach(function(o){n.tt(e,o,null)})},t.prototype.at=function(e,n){return this.W.getRemoteKeysForTarget(e).has(n)},t}();function BPe(){return new Ph(ci.comparator)}function YPe(){return new Ph(ci.comparator)}/** * @license * Copyright 2017 Google LLC * @@ -5746,7 +5746,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var rOn={asc:"ASCENDING",desc:"DESCENDING"},iOn={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},aOn=function(t,e){this.databaseId=t,this.I=e};function Dk(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function ltt(t,e){return t.I?e.toBase64():e.toUint8Array()}function lOn(t,e){return Dk(t,e.toTimestamp())}function lp(t){return Ui(!!t),La.fromTimestamp(function(e){var n=Aw(e);return new Zp(n.seconds,n.nanos)}(t))}function t5e(t,e){return function(n){return new _l(["projects",n.projectId,"databases",n.database])}(t).child("documents").child(e).canonicalString()}function stt(t){var e=_l.fromString(t);return Ui(gtt(e)),e}function Ek(t,e){return t5e(t.databaseId,e.path)}function N6(t,e){var n=stt(e);if(n.get(1)!==t.databaseId.projectId)throw new Lo(Vn.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Lo(Vn.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ci(utt(n))}function Xde(t,e){return t5e(t.databaseId,e)}function ctt(t){var e=stt(t);return e.length===4?_l.emptyPath():utt(e)}function Fk(t){return new _l(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function utt(t){return Ui(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function OPe(t,e,n){return{name:Ek(t,e),fields:n.value.mapValue.fields}}function sOn(t,e,n){var o=N6(t,e.name),r=lp(e.updateTime),i=new dg({mapValue:{fields:e.fields}}),a=Ah.newFoundDocument(o,r,i);return n&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}function jX(t,e){var n;if(e instanceof YN)n={update:OPe(t,e.key,e.value)};else if(e instanceof ON)n={delete:Ek(t,e.key)};else if(e instanceof Xw)n={update:OPe(t,e.key,e.data),updateMask:hOn(e.fieldMask)};else{if(!(e instanceof Q2e))return ni();n={verify:Ek(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(function(o){return function(r,i){var a=i.transform;if(a instanceof UR)return{fieldPath:i.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof ub)return{fieldPath:i.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof db)return{fieldPath:i.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof jR)return{fieldPath:i.field.canonicalString(),increment:a.A};throw ni()}(0,o)})),e.precondition.isNone||(n.currentDocument=function(o,r){return r.updateTime!==void 0?{updateTime:lOn(o,r.updateTime)}:r.exists!==void 0?{exists:r.exists}:ni()}(t,e.precondition)),n}function VPe(t,e){var n=e.currentDocument?function(c){return c.updateTime!==void 0?fh.updateTime(lp(c.updateTime)):c.exists!==void 0?fh.exists(c.exists):fh.none()}(e.currentDocument):fh.none(),o=e.updateTransforms?e.updateTransforms.map(function(c){return function(u,d){var f=null;if("setToServerValue"in d)Ui(d.setToServerValue==="REQUEST_TIME"),f=new UR;else if("appendMissingElements"in d){var p=d.appendMissingElements.values||[];f=new ub(p)}else if("removeAllFromArray"in d){var g=d.removeAllFromArray.values||[];f=new db(g)}else"increment"in d?f=new jR(u,d.increment):ni();var A=G2.fromServerFormat(d.fieldPath);return new BN(A,f)}(t,c)}):[];if(e.update){e.update.name;var r=N6(t,e.update.name),i=new dg({mapValue:{fields:e.update.fields}});if(e.updateMask){var a=function(c){var u=c.fieldPaths||[];return new kR(u.map(function(d){return G2.fromServerFormat(d)}))}(e.updateMask);return new Xw(r,i,a,n,o)}return new YN(r,i,n,o)}if(e.delete){var l=N6(t,e.delete);return new ON(l,n)}if(e.verify){var s=N6(t,e.verify);return new Q2e(s,n)}return ni()}function dtt(t,e){return{documents:[Xde(t,e.path)]}}function ftt(t,e){var n={structuredQuery:{}},o=e.path;e.collectionGroup!==null?(n.parent=Xde(t,o),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xde(t,o.popLast()),n.structuredQuery.from=[{collectionId:o.lastSegment()}]);var r=function(l){if(l.length!==0){var s=l.map(function(c){return function(u){if(u.op==="=="){if(IPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NAN"}};if(MPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NULL"}}}else if(u.op==="!="){if(IPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NOT_NAN"}};if(MPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:KT(u.field),op:uOn(u.op),value:u.value}}}(c)});return s.length===1?s[0]:{compositeFilter:{op:"AND",filters:s}}}}(e.filters);r&&(n.structuredQuery.where=r);var i=function(l){if(l.length!==0)return l.map(function(s){return function(c){return{field:KT(c.field),direction:cOn(c.dir)}}(s)})}(e.orderBy);i&&(n.structuredQuery.orderBy=i);var a=function(l,s){return l.I||$b(s)?s:{value:s}}(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=_Pe(e.startAt)),e.endAt&&(n.structuredQuery.endAt=_Pe(e.endAt)),n}function htt(t){var e=ctt(t.parent),n=t.structuredQuery,o=n.from?n.from.length:0,r=null;if(o>0){Ui(o===1);var i=n.from[0];i.allDescendants?r=i.collectionId:e=e.child(i.collectionId)}var a=[];n.where&&(a=ptt(n.where));var l=[];n.orderBy&&(l=n.orderBy.map(function(d){return function(f){return new LC(uC(f.field),function(p){switch(p){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(f.direction))}(d)}));var s=null;n.limit&&(s=function(d){var f;return $b(f=typeof d=="object"?d.value:d)?null:f}(n.limit));var c=null;n.startAt&&(c=GPe(n.startAt));var u=null;return n.endAt&&(u=GPe(n.endAt)),_et(e,r,l,a,s,"F",c,u)}function ptt(t){return t?t.unaryFilter!==void 0?[fOn(t)]:t.fieldFilter!==void 0?[dOn(t)]:t.compositeFilter!==void 0?t.compositeFilter.filters.map(function(e){return ptt(e)}).reduce(function(e,n){return e.concat(n)}):ni():[]}function _Pe(t){return{before:t.before,values:t.position}}function GPe(t){var e=!!t.before,n=t.values||[];return new zk(n,e)}function cOn(t){return rOn[t]}function uOn(t){return iOn[t]}function KT(t){return{fieldPath:t.canonicalString()}}function uC(t){return G2.fromServerFormat(t.fieldPath)}function dOn(t){return Ag.create(uC(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return ni()}}(t.fieldFilter.op),t.fieldFilter.value)}function fOn(t){switch(t.unaryFilter.op){case"IS_NAN":var e=uC(t.unaryFilter.field);return Ag.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=uC(t.unaryFilter.field);return Ag.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var o=uC(t.unaryFilter.field);return Ag.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var r=uC(t.unaryFilter.field);return Ag.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return ni()}}function hOn(t){var e=[];return t.fields.forEach(function(n){return e.push(n.canonicalString())}),{fieldPaths:e}}function gtt(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** + */var rOn={asc:"ASCENDING",desc:"DESCENDING"},iOn={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},aOn=function(t,e){this.databaseId=t,this.I=e};function Dk(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function ltt(t,e){return t.I?e.toBase64():e.toUint8Array()}function lOn(t,e){return Dk(t,e.toTimestamp())}function lp(t){return Ui(!!t),La.fromTimestamp(function(e){var n=Aw(e);return new Zp(n.seconds,n.nanos)}(t))}function t5e(t,e){return function(n){return new _l(["projects",n.projectId,"databases",n.database])}(t).child("documents").child(e).canonicalString()}function stt(t){var e=_l.fromString(t);return Ui(gtt(e)),e}function Ek(t,e){return t5e(t.databaseId,e.path)}function N6(t,e){var n=stt(e);if(n.get(1)!==t.databaseId.projectId)throw new Lo(Vn.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Lo(Vn.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ci(utt(n))}function Xde(t,e){return t5e(t.databaseId,e)}function ctt(t){var e=stt(t);return e.length===4?_l.emptyPath():utt(e)}function Fk(t){return new _l(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function utt(t){return Ui(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function OPe(t,e,n){return{name:Ek(t,e),fields:n.value.mapValue.fields}}function sOn(t,e,n){var o=N6(t,e.name),r=lp(e.updateTime),i=new dg({mapValue:{fields:e.fields}}),a=wh.newFoundDocument(o,r,i);return n&&a.setHasCommittedMutations(),n?a.setHasCommittedMutations():a}function jX(t,e){var n;if(e instanceof YN)n={update:OPe(t,e.key,e.value)};else if(e instanceof ON)n={delete:Ek(t,e.key)};else if(e instanceof Xw)n={update:OPe(t,e.key,e.data),updateMask:hOn(e.fieldMask)};else{if(!(e instanceof Q2e))return ni();n={verify:Ek(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(function(o){return function(r,i){var a=i.transform;if(a instanceof UR)return{fieldPath:i.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof ub)return{fieldPath:i.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof db)return{fieldPath:i.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof jR)return{fieldPath:i.field.canonicalString(),increment:a.A};throw ni()}(0,o)})),e.precondition.isNone||(n.currentDocument=function(o,r){return r.updateTime!==void 0?{updateTime:lOn(o,r.updateTime)}:r.exists!==void 0?{exists:r.exists}:ni()}(t,e.precondition)),n}function VPe(t,e){var n=e.currentDocument?function(c){return c.updateTime!==void 0?hh.updateTime(lp(c.updateTime)):c.exists!==void 0?hh.exists(c.exists):hh.none()}(e.currentDocument):hh.none(),o=e.updateTransforms?e.updateTransforms.map(function(c){return function(u,d){var f=null;if("setToServerValue"in d)Ui(d.setToServerValue==="REQUEST_TIME"),f=new UR;else if("appendMissingElements"in d){var p=d.appendMissingElements.values||[];f=new ub(p)}else if("removeAllFromArray"in d){var g=d.removeAllFromArray.values||[];f=new db(g)}else"increment"in d?f=new jR(u,d.increment):ni();var A=G2.fromServerFormat(d.fieldPath);return new BN(A,f)}(t,c)}):[];if(e.update){e.update.name;var r=N6(t,e.update.name),i=new dg({mapValue:{fields:e.update.fields}});if(e.updateMask){var a=function(c){var u=c.fieldPaths||[];return new kR(u.map(function(d){return G2.fromServerFormat(d)}))}(e.updateMask);return new Xw(r,i,a,n,o)}return new YN(r,i,n,o)}if(e.delete){var l=N6(t,e.delete);return new ON(l,n)}if(e.verify){var s=N6(t,e.verify);return new Q2e(s,n)}return ni()}function dtt(t,e){return{documents:[Xde(t,e.path)]}}function ftt(t,e){var n={structuredQuery:{}},o=e.path;e.collectionGroup!==null?(n.parent=Xde(t,o),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xde(t,o.popLast()),n.structuredQuery.from=[{collectionId:o.lastSegment()}]);var r=function(l){if(l.length!==0){var s=l.map(function(c){return function(u){if(u.op==="=="){if(IPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NAN"}};if(MPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NULL"}}}else if(u.op==="!="){if(IPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NOT_NAN"}};if(MPe(u.value))return{unaryFilter:{field:KT(u.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:KT(u.field),op:uOn(u.op),value:u.value}}}(c)});return s.length===1?s[0]:{compositeFilter:{op:"AND",filters:s}}}}(e.filters);r&&(n.structuredQuery.where=r);var i=function(l){if(l.length!==0)return l.map(function(s){return function(c){return{field:KT(c.field),direction:cOn(c.dir)}}(s)})}(e.orderBy);i&&(n.structuredQuery.orderBy=i);var a=function(l,s){return l.I||$b(s)?s:{value:s}}(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=_Pe(e.startAt)),e.endAt&&(n.structuredQuery.endAt=_Pe(e.endAt)),n}function htt(t){var e=ctt(t.parent),n=t.structuredQuery,o=n.from?n.from.length:0,r=null;if(o>0){Ui(o===1);var i=n.from[0];i.allDescendants?r=i.collectionId:e=e.child(i.collectionId)}var a=[];n.where&&(a=ptt(n.where));var l=[];n.orderBy&&(l=n.orderBy.map(function(d){return function(f){return new LC(uC(f.field),function(p){switch(p){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(f.direction))}(d)}));var s=null;n.limit&&(s=function(d){var f;return $b(f=typeof d=="object"?d.value:d)?null:f}(n.limit));var c=null;n.startAt&&(c=GPe(n.startAt));var u=null;return n.endAt&&(u=GPe(n.endAt)),_et(e,r,l,a,s,"F",c,u)}function ptt(t){return t?t.unaryFilter!==void 0?[fOn(t)]:t.fieldFilter!==void 0?[dOn(t)]:t.compositeFilter!==void 0?t.compositeFilter.filters.map(function(e){return ptt(e)}).reduce(function(e,n){return e.concat(n)}):ni():[]}function _Pe(t){return{before:t.before,values:t.position}}function GPe(t){var e=!!t.before,n=t.values||[];return new zk(n,e)}function cOn(t){return rOn[t]}function uOn(t){return iOn[t]}function KT(t){return{fieldPath:t.canonicalString()}}function uC(t){return G2.fromServerFormat(t.fieldPath)}function dOn(t){return Ag.create(uC(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return ni()}}(t.fieldFilter.op),t.fieldFilter.value)}function fOn(t){switch(t.unaryFilter.op){case"IS_NAN":var e=uC(t.unaryFilter.field);return Ag.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=uC(t.unaryFilter.field);return Ag.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var o=uC(t.unaryFilter.field);return Ag.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var r=uC(t.unaryFilter.field);return Ag.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return ni()}}function hOn(t){var e=[];return t.fields.forEach(function(n){return e.push(n.canonicalString())}),{fieldPaths:e}}function gtt(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** * @license * Copyright 2017 Google LLC * @@ -5776,7 +5776,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var gOn=function(t,e){this.seconds=t,this.nanoseconds=e},Z1=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Z1.store="owner",Z1.key="owner";var X8=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};X8.store="mutationQueues",X8.keyPath="userId";var hc=function(t,e,n,o,r){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=o,this.mutations=r};hc.store="mutations",hc.keyPath="batchId",hc.userMutationsIndex="userMutationsIndex",hc.userMutationsKeyPath=["userId","batchId"];var lh=function(){function t(){}return t.prefixForUser=function(e){return[e]},t.prefixForPath=function(e,n){return[e,U2(n)]},t.key=function(e,n,o){return[e,U2(n),o]},t}();lh.store="documentMutations",lh.PLACEHOLDER=new lh;var mOn=function(t,e){this.path=t,this.readTime=e},yOn=function(t,e){this.path=t,this.version=e},f0=function(t,e,n,o,r,i){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=o,this.readTime=r,this.parentPath=i};f0.store="remoteDocuments",f0.readTimeIndex="readTimeIndex",f0.readTimeIndexPath="readTime",f0.collectionReadTimeIndex="collectionReadTimeIndex",f0.collectionReadTimeIndexPath=["parentPath","readTime"];var y9=function(t){this.byteSize=t};y9.store="remoteDocumentGlobal",y9.key="remoteDocumentGlobalKey";var Xp=function(t,e,n,o,r,i,a){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=o,this.lastListenSequenceNumber=r,this.lastLimboFreeSnapshotVersion=i,this.query=a};Xp.store="targets",Xp.keyPath="targetId",Xp.queryTargetsIndexName="queryTargetsIndex",Xp.queryTargetsKeyPath=["canonicalId","targetId"];var df=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};df.store="targetDocuments",df.keyPath=["targetId","path"],df.documentTargetsIndex="documentTargetsIndex",df.documentTargetsKeyPath=["path","targetId"];var ig=function(t,e,n,o){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=o};ig.key="targetGlobalKey",ig.store="targetGlobal";var Hx=function(t,e){this.collectionId=t,this.parent=e};Hx.store="collectionParents",Hx.keyPath=["collectionId","parent"];var U6=function(t,e,n,o){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=o};U6.store="clientMetadata",U6.keyPath="clientId";var BR=function(t,e,n){this.bundleId=t,this.createTime=e,this.version=n};BR.store="bundles",BR.keyPath="bundleId";var YR=function(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n};YR.store="namedQueries",YR.keyPath="name";var AOn=yl(yl([],yl(yl([],yl(yl([],yl(yl([],[X8.store,hc.store,lh.store,f0.store,Xp.store,Z1.store,ig.store,df.store]),[U6.store])),[y9.store])),[Hx.store])),[BR.store,YR.store]),mtt="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",ytt=function(){function t(){this.onCommittedListeners=[]}return t.prototype.addOnCommittedListener=function(e){this.onCommittedListeners.push(e)},t.prototype.raiseOnCommittedEvent=function(){this.onCommittedListeners.forEach(function(e){return e()})},t}(),a1=function(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})},_o=function(){function t(e){var n=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(function(o){n.isDone=!0,n.result=o,n.nextCallback&&n.nextCallback(o)},function(o){n.isDone=!0,n.error=o,n.catchCallback&&n.catchCallback(o)})}return t.prototype.catch=function(e){return this.next(void 0,e)},t.prototype.next=function(e,n){var o=this;return this.callbackAttached&&ni(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new t(function(r,i){o.nextCallback=function(a){o.wrapSuccess(e,a).next(r,i)},o.catchCallback=function(a){o.wrapFailure(n,a).next(r,i)}})},t.prototype.toPromise=function(){var e=this;return new Promise(function(n,o){e.next(n,o)})},t.prototype.wrapUserFunction=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(o){return t.reject(o)}},t.prototype.wrapSuccess=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.resolve(n)},t.prototype.wrapFailure=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.reject(n)},t.resolve=function(e){return new t(function(n,o){n(e)})},t.reject=function(e){return new t(function(n,o){o(e)})},t.waitFor=function(e){return new t(function(n,o){var r=0,i=0,a=!1;e.forEach(function(l){++r,l.next(function(){++i,a&&i===r&&n()},function(s){return o(s)})}),a=!0,i===r&&n()})},t.or=function(e){for(var n=t.resolve(!1),o=function(a){n=n.next(function(l){return l?t.resolve(l):a()})},r=0,i=e;r"u")return!1;if(t.gt())return!0;var e=ib(),n=t._t(e),o=00||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||o||i)},t.gt=function(){var e;return typeof process<"u"&&((e=zYn)===null||e===void 0?void 0:e.Tt)==="YES"},t.It=function(e,n){return e.store(n)},t._t=function(e){var n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),o=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(o)},t.Et=function(e){var n=e.match(/Android ([\d.]+)/i),o=n?n[1].split(".").slice(0,2).join("."):"-1";return Number(o)},t.prototype.At=function(e){return bo(this,void 0,void 0,function(){var n,o=this;return vo(this,function(r){switch(r.label){case 0:return this.db?[3,2]:(ur("SimpleDb","Opening database:",this.name),n=this,[4,new Promise(function(i,a){var l=indexedDB.open(o.name,o.version);l.onsuccess=function(s){var c=s.target.result;i(c)},l.onblocked=function(){a(new UE(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},l.onerror=function(s){var c=s.target.error;c.name==="VersionError"?a(new Lo(Vn.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):a(new UE(e,c))},l.onupgradeneeded=function(s){ur("SimpleDb",'Database "'+o.name+'" requires upgrade from version:',s.oldVersion);var c=s.target.result;o.wt.Rt(c,l.transaction,s.oldVersion,o.version).next(function(){ur("SimpleDb","Database upgrade to version "+o.version+" complete")})}})]);case 1:n.db=r.sent(),r.label=2;case 2:return[2,(this.bt&&(this.db.onversionchange=function(i){return o.bt(i)}),this.db)]}})})},t.prototype.vt=function(e){this.bt=e,this.db&&(this.db.onversionchange=function(n){return e(n)})},t.prototype.runTransaction=function(e,n,o,r){return bo(this,void 0,void 0,function(){var i,a,l,s,c;return vo(this,function(u){switch(u.label){case 0:i=n==="readonly",a=0,l=function(){var d,f,p,g,A;return vo(this,function(y){switch(y.label){case 0:++a,y.label=1;case 1:return y.trys.push([1,4,,5]),[4,s.At(e)];case 2:return s.db=y.sent(),d=Att.open(s.db,e,i?"readonly":"readwrite",o),f=r(d).catch(function(S){return d.abort(S),_o.reject(S)}).toPromise(),p={},f.catch(function(){}),[4,d.dt];case 3:return[2,(p.value=(y.sent(),f),p)];case 4:return g=y.sent(),A=g.name!=="FirebaseError"&&a<3,ur("SimpleDb","Transaction failed with error:",g.message,"Retrying:",A),s.close(),A?[3,5]:[2,{value:Promise.reject(g)}];case 5:return[2]}})},s=this,u.label=1;case 1:return[5,l()];case 2:if(typeof(c=u.sent())=="object")return[2,c.value];u.label=3;case 3:return[3,1];case 4:return[2]}})})},t.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},t}(),wOn=function(){function t(e){this.Pt=e,this.Vt=!1,this.St=null}return Object.defineProperty(t.prototype,"isDone",{get:function(){return this.Vt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Dt",{get:function(){return this.St},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(e){this.Pt=e},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.Vt=!0},t.prototype.Ct=function(e){this.St=e},t.prototype.delete=function(){return Hv(this.Pt.delete())},t}(),UE=function(t){function e(n,o){var r=this;return(r=t.call(this,Vn.UNAVAILABLE,"IndexedDB transaction '"+n+"' failed: "+o)||this).name="IndexedDbTransactionError",r}return Pr(e,t),e}(Lo);function Qb(t){return t.name==="IndexedDbTransactionError"}var vOn=function(){function t(e){this.store=e}return t.prototype.put=function(e,n){var o;return n!==void 0?(ur("SimpleDb","PUT",this.store.name,e,n),o=this.store.put(n,e)):(ur("SimpleDb","PUT",this.store.name,"",e),o=this.store.put(e)),Hv(o)},t.prototype.add=function(e){return ur("SimpleDb","ADD",this.store.name,e,e),Hv(this.store.add(e))},t.prototype.get=function(e){var n=this;return Hv(this.store.get(e)).next(function(o){return o===void 0&&(o=null),ur("SimpleDb","GET",n.store.name,e,o),o})},t.prototype.delete=function(e){return ur("SimpleDb","DELETE",this.store.name,e),Hv(this.store.delete(e))},t.prototype.count=function(){return ur("SimpleDb","COUNT",this.store.name),Hv(this.store.count())},t.prototype.Nt=function(e,n){var o=this.cursor(this.options(e,n)),r=[];return this.xt(o,function(i,a){r.push(a)}).next(function(){return r})},t.prototype.kt=function(e,n){ur("SimpleDb","DELETE ALL",this.store.name);var o=this.options(e,n);o.Ft=!1;var r=this.cursor(o);return this.xt(r,function(i,a,l){return l.delete()})},t.prototype.$t=function(e,n){var o;n?o=e:(o={},n=e);var r=this.cursor(o);return this.xt(r,n)},t.prototype.Ot=function(e){var n=this.cursor({});return new _o(function(o,r){n.onerror=function(i){var a=n5e(i.target.error);r(a)},n.onsuccess=function(i){var a=i.target.result;a?e(a.primaryKey,a.value).next(function(l){l?a.continue():o()}):o()}})},t.prototype.xt=function(e,n){var o=[];return new _o(function(r,i){e.onerror=function(a){i(a.target.error)},e.onsuccess=function(a){var l=a.target.result;if(l){var s=new wOn(l),c=n(l.primaryKey,l.value,s);if(c instanceof _o){var u=c.catch(function(d){return s.done(),_o.reject(d)});o.push(u)}s.isDone?r():s.Dt===null?l.continue():l.continue(s.Dt)}else r()}}).next(function(){return _o.waitFor(o)})},t.prototype.options=function(e,n){var o;return e!==void 0&&(typeof e=="string"?o=e:n=e),{index:o,range:n}},t.prototype.cursor=function(e){var n="next";if(e.reverse&&(n="prev"),e.index){var o=this.store.index(e.index);return e.Ft?o.openKeyCursor(e.range,n):o.openCursor(e.range,n)}return this.store.openCursor(e.range,n)},t}();function Hv(t){return new _o(function(e,n){t.onsuccess=function(o){var r=o.target.result;e(r)},t.onerror=function(o){var r=n5e(o.target.error);n(r)}})}var JPe=!1;function n5e(t){var e=OR._t(ib());if(e>=12.2&&e<13){var n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){var o=new Lo("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return JPe||(JPe=!0,setTimeout(function(){throw o},0)),o}}return t}/** + */var gOn=function(t,e){this.seconds=t,this.nanoseconds=e},Z1=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Z1.store="owner",Z1.key="owner";var X8=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};X8.store="mutationQueues",X8.keyPath="userId";var hc=function(t,e,n,o,r){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=o,this.mutations=r};hc.store="mutations",hc.keyPath="batchId",hc.userMutationsIndex="userMutationsIndex",hc.userMutationsKeyPath=["userId","batchId"];var sh=function(){function t(){}return t.prefixForUser=function(e){return[e]},t.prefixForPath=function(e,n){return[e,U2(n)]},t.key=function(e,n,o){return[e,U2(n),o]},t}();sh.store="documentMutations",sh.PLACEHOLDER=new sh;var mOn=function(t,e){this.path=t,this.readTime=e},yOn=function(t,e){this.path=t,this.version=e},f0=function(t,e,n,o,r,i){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=o,this.readTime=r,this.parentPath=i};f0.store="remoteDocuments",f0.readTimeIndex="readTimeIndex",f0.readTimeIndexPath="readTime",f0.collectionReadTimeIndex="collectionReadTimeIndex",f0.collectionReadTimeIndexPath=["parentPath","readTime"];var y9=function(t){this.byteSize=t};y9.store="remoteDocumentGlobal",y9.key="remoteDocumentGlobalKey";var Xp=function(t,e,n,o,r,i,a){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=o,this.lastListenSequenceNumber=r,this.lastLimboFreeSnapshotVersion=i,this.query=a};Xp.store="targets",Xp.keyPath="targetId",Xp.queryTargetsIndexName="queryTargetsIndex",Xp.queryTargetsKeyPath=["canonicalId","targetId"];var df=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};df.store="targetDocuments",df.keyPath=["targetId","path"],df.documentTargetsIndex="documentTargetsIndex",df.documentTargetsKeyPath=["path","targetId"];var ig=function(t,e,n,o){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=o};ig.key="targetGlobalKey",ig.store="targetGlobal";var Hx=function(t,e){this.collectionId=t,this.parent=e};Hx.store="collectionParents",Hx.keyPath=["collectionId","parent"];var U6=function(t,e,n,o){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=o};U6.store="clientMetadata",U6.keyPath="clientId";var BR=function(t,e,n){this.bundleId=t,this.createTime=e,this.version=n};BR.store="bundles",BR.keyPath="bundleId";var YR=function(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n};YR.store="namedQueries",YR.keyPath="name";var AOn=yl(yl([],yl(yl([],yl(yl([],yl(yl([],[X8.store,hc.store,sh.store,f0.store,Xp.store,Z1.store,ig.store,df.store]),[U6.store])),[y9.store])),[Hx.store])),[BR.store,YR.store]),mtt="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",ytt=function(){function t(){this.onCommittedListeners=[]}return t.prototype.addOnCommittedListener=function(e){this.onCommittedListeners.push(e)},t.prototype.raiseOnCommittedEvent=function(){this.onCommittedListeners.forEach(function(e){return e()})},t}(),a1=function(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})},_o=function(){function t(e){var n=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(function(o){n.isDone=!0,n.result=o,n.nextCallback&&n.nextCallback(o)},function(o){n.isDone=!0,n.error=o,n.catchCallback&&n.catchCallback(o)})}return t.prototype.catch=function(e){return this.next(void 0,e)},t.prototype.next=function(e,n){var o=this;return this.callbackAttached&&ni(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new t(function(r,i){o.nextCallback=function(a){o.wrapSuccess(e,a).next(r,i)},o.catchCallback=function(a){o.wrapFailure(n,a).next(r,i)}})},t.prototype.toPromise=function(){var e=this;return new Promise(function(n,o){e.next(n,o)})},t.prototype.wrapUserFunction=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(o){return t.reject(o)}},t.prototype.wrapSuccess=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.resolve(n)},t.prototype.wrapFailure=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.reject(n)},t.resolve=function(e){return new t(function(n,o){n(e)})},t.reject=function(e){return new t(function(n,o){o(e)})},t.waitFor=function(e){return new t(function(n,o){var r=0,i=0,a=!1;e.forEach(function(l){++r,l.next(function(){++i,a&&i===r&&n()},function(s){return o(s)})}),a=!0,i===r&&n()})},t.or=function(e){for(var n=t.resolve(!1),o=function(a){n=n.next(function(l){return l?t.resolve(l):a()})},r=0,i=e;r"u")return!1;if(t.gt())return!0;var e=ib(),n=t._t(e),o=00||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||o||i)},t.gt=function(){var e;return typeof process<"u"&&((e=zYn)===null||e===void 0?void 0:e.Tt)==="YES"},t.It=function(e,n){return e.store(n)},t._t=function(e){var n=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),o=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(o)},t.Et=function(e){var n=e.match(/Android ([\d.]+)/i),o=n?n[1].split(".").slice(0,2).join("."):"-1";return Number(o)},t.prototype.At=function(e){return bo(this,void 0,void 0,function(){var n,o=this;return vo(this,function(r){switch(r.label){case 0:return this.db?[3,2]:(ur("SimpleDb","Opening database:",this.name),n=this,[4,new Promise(function(i,a){var l=indexedDB.open(o.name,o.version);l.onsuccess=function(s){var c=s.target.result;i(c)},l.onblocked=function(){a(new UE(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},l.onerror=function(s){var c=s.target.error;c.name==="VersionError"?a(new Lo(Vn.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):a(new UE(e,c))},l.onupgradeneeded=function(s){ur("SimpleDb",'Database "'+o.name+'" requires upgrade from version:',s.oldVersion);var c=s.target.result;o.wt.Rt(c,l.transaction,s.oldVersion,o.version).next(function(){ur("SimpleDb","Database upgrade to version "+o.version+" complete")})}})]);case 1:n.db=r.sent(),r.label=2;case 2:return[2,(this.bt&&(this.db.onversionchange=function(i){return o.bt(i)}),this.db)]}})})},t.prototype.vt=function(e){this.bt=e,this.db&&(this.db.onversionchange=function(n){return e(n)})},t.prototype.runTransaction=function(e,n,o,r){return bo(this,void 0,void 0,function(){var i,a,l,s,c;return vo(this,function(u){switch(u.label){case 0:i=n==="readonly",a=0,l=function(){var d,f,p,g,A;return vo(this,function(y){switch(y.label){case 0:++a,y.label=1;case 1:return y.trys.push([1,4,,5]),[4,s.At(e)];case 2:return s.db=y.sent(),d=Att.open(s.db,e,i?"readonly":"readwrite",o),f=r(d).catch(function(S){return d.abort(S),_o.reject(S)}).toPromise(),p={},f.catch(function(){}),[4,d.dt];case 3:return[2,(p.value=(y.sent(),f),p)];case 4:return g=y.sent(),A=g.name!=="FirebaseError"&&a<3,ur("SimpleDb","Transaction failed with error:",g.message,"Retrying:",A),s.close(),A?[3,5]:[2,{value:Promise.reject(g)}];case 5:return[2]}})},s=this,u.label=1;case 1:return[5,l()];case 2:if(typeof(c=u.sent())=="object")return[2,c.value];u.label=3;case 3:return[3,1];case 4:return[2]}})})},t.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},t}(),wOn=function(){function t(e){this.Pt=e,this.Vt=!1,this.St=null}return Object.defineProperty(t.prototype,"isDone",{get:function(){return this.Vt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Dt",{get:function(){return this.St},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(e){this.Pt=e},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.Vt=!0},t.prototype.Ct=function(e){this.St=e},t.prototype.delete=function(){return Hv(this.Pt.delete())},t}(),UE=function(t){function e(n,o){var r=this;return(r=t.call(this,Vn.UNAVAILABLE,"IndexedDB transaction '"+n+"' failed: "+o)||this).name="IndexedDbTransactionError",r}return Pr(e,t),e}(Lo);function Qb(t){return t.name==="IndexedDbTransactionError"}var vOn=function(){function t(e){this.store=e}return t.prototype.put=function(e,n){var o;return n!==void 0?(ur("SimpleDb","PUT",this.store.name,e,n),o=this.store.put(n,e)):(ur("SimpleDb","PUT",this.store.name,"",e),o=this.store.put(e)),Hv(o)},t.prototype.add=function(e){return ur("SimpleDb","ADD",this.store.name,e,e),Hv(this.store.add(e))},t.prototype.get=function(e){var n=this;return Hv(this.store.get(e)).next(function(o){return o===void 0&&(o=null),ur("SimpleDb","GET",n.store.name,e,o),o})},t.prototype.delete=function(e){return ur("SimpleDb","DELETE",this.store.name,e),Hv(this.store.delete(e))},t.prototype.count=function(){return ur("SimpleDb","COUNT",this.store.name),Hv(this.store.count())},t.prototype.Nt=function(e,n){var o=this.cursor(this.options(e,n)),r=[];return this.xt(o,function(i,a){r.push(a)}).next(function(){return r})},t.prototype.kt=function(e,n){ur("SimpleDb","DELETE ALL",this.store.name);var o=this.options(e,n);o.Ft=!1;var r=this.cursor(o);return this.xt(r,function(i,a,l){return l.delete()})},t.prototype.$t=function(e,n){var o;n?o=e:(o={},n=e);var r=this.cursor(o);return this.xt(r,n)},t.prototype.Ot=function(e){var n=this.cursor({});return new _o(function(o,r){n.onerror=function(i){var a=n5e(i.target.error);r(a)},n.onsuccess=function(i){var a=i.target.result;a?e(a.primaryKey,a.value).next(function(l){l?a.continue():o()}):o()}})},t.prototype.xt=function(e,n){var o=[];return new _o(function(r,i){e.onerror=function(a){i(a.target.error)},e.onsuccess=function(a){var l=a.target.result;if(l){var s=new wOn(l),c=n(l.primaryKey,l.value,s);if(c instanceof _o){var u=c.catch(function(d){return s.done(),_o.reject(d)});o.push(u)}s.isDone?r():s.Dt===null?l.continue():l.continue(s.Dt)}else r()}}).next(function(){return _o.waitFor(o)})},t.prototype.options=function(e,n){var o;return e!==void 0&&(typeof e=="string"?o=e:n=e),{index:o,range:n}},t.prototype.cursor=function(e){var n="next";if(e.reverse&&(n="prev"),e.index){var o=this.store.index(e.index);return e.Ft?o.openKeyCursor(e.range,n):o.openCursor(e.range,n)}return this.store.openCursor(e.range,n)},t}();function Hv(t){return new _o(function(e,n){t.onsuccess=function(o){var r=o.target.result;e(r)},t.onerror=function(o){var r=n5e(o.target.error);n(r)}})}var JPe=!1;function n5e(t){var e=OR._t(ib());if(e>=12.2&&e<13){var n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){var o=new Lo("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return JPe||(JPe=!0,setTimeout(function(){throw o},0)),o}}return t}/** * @license * Copyright 2020 Google LLC * @@ -5806,7 +5806,7 @@ PERFORMANCE OF THIS SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var o5e=function(){function t(e,n,o,r){this.batchId=e,this.localWriteTime=n,this.baseMutations=o,this.mutations=r}return t.prototype.applyToRemoteDocument=function(e,n){for(var o=n.mutationResults,r=0;r=r),a=gP(o.R,s)),c.done()}).next(function(){return a})},t.prototype.getHighestUnacknowledgedBatchId=function(e){var n=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),o=-1;return E4(e).$t({index:hc.userMutationsIndex,range:n,reverse:!0},function(r,i,a){o=i.batchId,a.done()}).next(function(){return o})},t.prototype.getAllMutationBatches=function(e){var n=this,o=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return E4(e).Nt(hc.userMutationsIndex,o).next(function(r){return r.map(function(i){return gP(n.R,i)})})},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,n){var o=this,r=lh.prefixForPath(this.userId,n.path),i=IDBKeyRange.lowerBound(r),a=[];return mP(e).$t({range:i},function(l,s,c){var u=l[0],d=l[1],f=l[2],p=R6(d);if(u===o.userId&&n.path.isEqual(p))return E4(e).get(f).next(function(g){if(!g)throw ni();Ui(g.userId===o.userId),a.push(gP(o.R,g))});c.done()}).next(function(){return a})},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,n){var o=this,r=new ju(Ka),i=[];return n.forEach(function(a){var l=lh.prefixForPath(o.userId,a.path),s=IDBKeyRange.lowerBound(l),c=mP(e).$t({range:s},function(u,d,f){var p=u[0],g=u[1],A=u[2],y=R6(g);p===o.userId&&a.path.isEqual(y)?r=r.add(A):f.done()});i.push(c)}),_o.waitFor(i).next(function(){return o.Wt(e,r)})},t.prototype.getAllMutationBatchesAffectingQuery=function(e,n){var o=this,r=n.path,i=r.length+1,a=lh.prefixForPath(this.userId,r),l=IDBKeyRange.lowerBound(a),s=new ju(Ka);return mP(e).$t({range:l},function(c,u,d){var f=c[0],p=c[1],g=c[2],A=R6(p);f===o.userId&&r.isPrefixOf(A)?A.length===i&&(s=s.add(g)):d.done()}).next(function(){return o.Wt(e,s)})},t.prototype.Wt=function(e,n){var o=this,r=[],i=[];return n.forEach(function(a){i.push(E4(e).get(a).next(function(l){if(l===null)throw ni();Ui(l.userId===o.userId),r.push(gP(o.R,l))}))}),_o.waitFor(i).next(function(){return r})},t.prototype.removeMutationBatch=function(e,n){var o=this;return Stt(e.Mt,this.userId,n).next(function(r){return e.addOnCommittedListener(function(){o.Gt(n.batchId)}),_o.forEach(r,function(i){return o.referenceDelegate.markPotentiallyOrphaned(e,i)})})},t.prototype.Gt=function(e){delete this.Kt[e]},t.prototype.performConsistencyCheck=function(e){var n=this;return this.checkEmpty(e).next(function(o){if(!o)return _o.resolve();var r=IDBKeyRange.lowerBound(lh.prefixForUser(n.userId)),i=[];return mP(e).$t({range:r},function(a,l,s){if(a[0]===n.userId){var c=R6(a[1]);i.push(c)}else s.done()}).next(function(){Ui(i.length===0)})})},t.prototype.containsKey=function(e,n){return Ttt(e,this.userId,n)},t.prototype.zt=function(e){var n=this;return Ptt(e).get(this.userId).next(function(o){return o||new X8(n.userId,-1,"")})},t}();function Ttt(t,e,n){var o=lh.prefixForPath(e,n.path),r=o[1],i=IDBKeyRange.lowerBound(o),a=!1;return mP(t).$t({range:i,Ft:!0},function(l,s,c){var u=l[0],d=l[1];l[2],u===e&&d===r&&(a=!0),c.done()}).next(function(){return a})}function E4(t){return f1(t,hc.store)}function mP(t){return f1(t,lh.store)}function Ptt(t){return f1(t,X8.store)}/** + */e9.DEFAULT_COLLECTION_PERCENTILE=10,e9.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,e9.DEFAULT=new e9(41943040,e9.DEFAULT_COLLECTION_PERCENTILE,e9.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),e9.DISABLED=new e9(-1,0,0);var POn=function(){function t(e,n,o,r){this.userId=e,this.R=n,this.Ut=o,this.referenceDelegate=r,this.Kt={}}return t.Qt=function(e,n,o,r){return Ui(e.uid!==""),new t(e.isAuthenticated()?e.uid:"",n,o,r)},t.prototype.checkEmpty=function(e){var n=!0,o=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return E4(e).$t({index:hc.userMutationsIndex,range:o},function(r,i,a){n=!1,a.done()}).next(function(){return n})},t.prototype.addMutationBatch=function(e,n,o,r){var i=this,a=mP(e),l=E4(e);return l.add({}).next(function(s){Ui(typeof s=="number");for(var c=new o5e(s,n,o,r),u=function(S,C,P){var v=P.baseMutations.map(function(w){return jX(S.Lt,w)}),T=P.mutations.map(function(w){return jX(S.Lt,w)});return new hc(C,P.batchId,P.localWriteTime.toMillis(),v,T)}(i.R,i.userId,c),d=[],f=new ju(function(S,C){return Ka(S.canonicalString(),C.canonicalString())}),p=0,g=r;p=r),a=gP(o.R,s)),c.done()}).next(function(){return a})},t.prototype.getHighestUnacknowledgedBatchId=function(e){var n=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),o=-1;return E4(e).$t({index:hc.userMutationsIndex,range:n,reverse:!0},function(r,i,a){o=i.batchId,a.done()}).next(function(){return o})},t.prototype.getAllMutationBatches=function(e){var n=this,o=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return E4(e).Nt(hc.userMutationsIndex,o).next(function(r){return r.map(function(i){return gP(n.R,i)})})},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,n){var o=this,r=sh.prefixForPath(this.userId,n.path),i=IDBKeyRange.lowerBound(r),a=[];return mP(e).$t({range:i},function(l,s,c){var u=l[0],d=l[1],f=l[2],p=R6(d);if(u===o.userId&&n.path.isEqual(p))return E4(e).get(f).next(function(g){if(!g)throw ni();Ui(g.userId===o.userId),a.push(gP(o.R,g))});c.done()}).next(function(){return a})},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,n){var o=this,r=new ju(Ka),i=[];return n.forEach(function(a){var l=sh.prefixForPath(o.userId,a.path),s=IDBKeyRange.lowerBound(l),c=mP(e).$t({range:s},function(u,d,f){var p=u[0],g=u[1],A=u[2],y=R6(g);p===o.userId&&a.path.isEqual(y)?r=r.add(A):f.done()});i.push(c)}),_o.waitFor(i).next(function(){return o.Wt(e,r)})},t.prototype.getAllMutationBatchesAffectingQuery=function(e,n){var o=this,r=n.path,i=r.length+1,a=sh.prefixForPath(this.userId,r),l=IDBKeyRange.lowerBound(a),s=new ju(Ka);return mP(e).$t({range:l},function(c,u,d){var f=c[0],p=c[1],g=c[2],A=R6(p);f===o.userId&&r.isPrefixOf(A)?A.length===i&&(s=s.add(g)):d.done()}).next(function(){return o.Wt(e,s)})},t.prototype.Wt=function(e,n){var o=this,r=[],i=[];return n.forEach(function(a){i.push(E4(e).get(a).next(function(l){if(l===null)throw ni();Ui(l.userId===o.userId),r.push(gP(o.R,l))}))}),_o.waitFor(i).next(function(){return r})},t.prototype.removeMutationBatch=function(e,n){var o=this;return Stt(e.Mt,this.userId,n).next(function(r){return e.addOnCommittedListener(function(){o.Gt(n.batchId)}),_o.forEach(r,function(i){return o.referenceDelegate.markPotentiallyOrphaned(e,i)})})},t.prototype.Gt=function(e){delete this.Kt[e]},t.prototype.performConsistencyCheck=function(e){var n=this;return this.checkEmpty(e).next(function(o){if(!o)return _o.resolve();var r=IDBKeyRange.lowerBound(sh.prefixForUser(n.userId)),i=[];return mP(e).$t({range:r},function(a,l,s){if(a[0]===n.userId){var c=R6(a[1]);i.push(c)}else s.done()}).next(function(){Ui(i.length===0)})})},t.prototype.containsKey=function(e,n){return Ttt(e,this.userId,n)},t.prototype.zt=function(e){var n=this;return Ptt(e).get(this.userId).next(function(o){return o||new X8(n.userId,-1,"")})},t}();function Ttt(t,e,n){var o=sh.prefixForPath(e,n.path),r=o[1],i=IDBKeyRange.lowerBound(o),a=!1;return mP(t).$t({range:i,Ft:!0},function(l,s,c){var u=l[0],d=l[1];l[2],u===e&&d===r&&(a=!0),c.done()}).next(function(){return a})}function E4(t){return f1(t,hc.store)}function mP(t){return f1(t,sh.store)}function Ptt(t){return f1(t,X8.store)}/** * @license * Copyright 2017 Google LLC * @@ -5961,7 +5961,7 @@ Total Duration: `+(c-d)+"ms"),_o.resolve({didRun:!0,sequenceNumbersCollected:r,t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var sM=function(){function t(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={}}return t.prototype.get=function(e){var n=this.mapKeyFn(e),o=this.inner[n];if(o!==void 0)for(var r=0,i=o;r=0&&r<=11);var a=new Att("createOrUpgrade",n);o<1&&r>=1&&(function(s){s.createObjectStore(Z1.store)}(e),function(s){s.createObjectStore(X8.store,{keyPath:X8.keyPath}),s.createObjectStore(hc.store,{keyPath:hc.keyPath,autoIncrement:!0}).createIndex(hc.userMutationsIndex,hc.userMutationsKeyPath,{unique:!0}),s.createObjectStore(lh.store)}(e),rCe(e),function(s){s.createObjectStore(f0.store)}(e));var l=_o.resolve();return o<3&&r>=3&&(o!==0&&(function(s){s.deleteObjectStore(df.store),s.deleteObjectStore(Xp.store),s.deleteObjectStore(ig.store)}(e),rCe(e)),l=l.next(function(){return function(s){var c=s.store(ig.store),u=new ig(0,0,La.min().toTimestamp(),0);return c.put(ig.key,u)}(a)})),o<4&&r>=4&&(o!==0&&(l=l.next(function(){return function(s,c){return c.store(hc.store).Nt().next(function(u){s.deleteObjectStore(hc.store),s.createObjectStore(hc.store,{keyPath:hc.keyPath,autoIncrement:!0}).createIndex(hc.userMutationsIndex,hc.userMutationsKeyPath,{unique:!0});var d=c.store(hc.store),f=u.map(function(p){return d.put(p)});return _o.waitFor(f)})}(e,a)})),l=l.next(function(){(function(s){s.createObjectStore(U6.store,{keyPath:U6.keyPath})})(e)})),o<5&&r>=5&&(l=l.next(function(){return i.Re(a)})),o<6&&r>=6&&(l=l.next(function(){return function(s){s.createObjectStore(y9.store)}(e),i.be(a)})),o<7&&r>=7&&(l=l.next(function(){return i.ve(a)})),o<8&&r>=8&&(l=l.next(function(){return i.Pe(e,a)})),o<9&&r>=9&&(l=l.next(function(){(function(s){s.objectStoreNames.contains("remoteDocumentChanges")&&s.deleteObjectStore("remoteDocumentChanges")})(e),function(s){var c=s.objectStore(f0.store);c.createIndex(f0.readTimeIndex,f0.readTimeIndexPath,{unique:!1}),c.createIndex(f0.collectionReadTimeIndex,f0.collectionReadTimeIndexPath,{unique:!1})}(n)})),o<10&&r>=10&&(l=l.next(function(){return i.Ve(a)})),o<11&&r>=11&&(l=l.next(function(){(function(s){s.createObjectStore(BR.store,{keyPath:BR.keyPath})})(e),function(s){s.createObjectStore(YR.store,{keyPath:YR.keyPath})}(e)})),l},t.prototype.be=function(e){var n=0;return e.store(f0.store).$t(function(o,r){n+=BX(r)}).next(function(){var o=new y9(n);return e.store(y9.store).put(y9.key,o)})},t.prototype.Re=function(e){var n=this,o=e.store(X8.store),r=e.store(hc.store);return o.Nt().next(function(i){return _o.forEach(i,function(a){var l=IDBKeyRange.bound([a.userId,-1],[a.userId,a.lastAcknowledgedBatchId]);return r.Nt(hc.userMutationsIndex,l).next(function(s){return _o.forEach(s,function(c){Ui(c.userId===a.userId);var u=gP(n.R,c);return Stt(e,a.userId,u).next(function(){})})})})})},t.prototype.ve=function(e){var n=e.store(df.store),o=e.store(f0.store);return e.store(ig.store).get(ig.key).next(function(r){var i=[];return o.$t(function(a,l){var s=new _l(a),c=function(u){return[0,U2(u)]}(s);i.push(n.get(c).next(function(u){return u?_o.resolve():function(d){return n.put(new df(0,U2(d),r.highestListenSequenceNumber))}(s)}))}).next(function(){return _o.waitFor(i)})})},t.prototype.Pe=function(e,n){e.createObjectStore(Hx.store,{keyPath:Hx.keyPath});var o=n.store(Hx.store),r=new i5e,i=function(a){if(r.add(a)){var l=a.lastSegment(),s=a.popLast();return o.put({collectionId:l,parent:U2(s)})}};return n.store(f0.store).$t({Ft:!0},function(a,l){var s=new _l(a);return i(s.popLast())}).next(function(){return n.store(lh.store).$t({Ft:!0},function(a,l){a[0];var s=a[1];a[2];var c=R6(s);return i(c.popLast())})})},t.prototype.Ve=function(e){var n=this,o=e.store(Xp.store);return o.$t(function(r,i){var a=_D(i),l=xtt(n.R,a);return o.put(l)})},t}();function rCe(t){t.createObjectStore(df.store,{keyPath:df.keyPath}).createIndex(df.documentTargetsIndex,df.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Xp.store,{keyPath:Xp.keyPath}).createIndex(Xp.queryTargetsIndexName,Xp.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(ig.store)}var Tae="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",FOn=function(){function t(e,n,o,r,i,a,l,s,c,u){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=o,this.Se=i,this.window=a,this.document=l,this.De=c,this.Ce=u,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ke=null,this.inForeground=!1,this.Fe=null,this.$e=null,this.Oe=Number.NEGATIVE_INFINITY,this.Me=function(d){return Promise.resolve()},!t.yt())throw new Lo(Vn.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new IOn(this,r),this.Le=n+"main",this.R=new wtt(s),this.Be=new OR(this.Le,11,new EOn(this.R)),this.qe=new COn(this.referenceDelegate,this.R),this.Ut=new TOn,this.Ue=function(d,f){return new zOn(d,f)}(this.R,this.Ut),this.Ke=new bOn,this.window&&this.window.localStorage?this.Qe=this.window.localStorage:(this.Qe=null,u===!1&&su("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.prototype.start=function(){var e=this;return this.je().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Lo(Vn.FAILED_PRECONDITION,Tae);return e.We(),e.Ge(),e.ze(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(n){return e.qe.getHighestSequenceNumber(n)})}).then(function(n){e.Ne=new yg(n,e.De)}).then(function(){e.xe=!0}).catch(function(n){return e.Be&&e.Be.close(),Promise.reject(n)})},t.prototype.He=function(e){var n=this;return this.Me=function(o){return bo(n,void 0,void 0,function(){return vo(this,function(r){return this.started?[2,e(o)]:[2]})})},e(this.isPrimary)},t.prototype.setDatabaseDeletedListener=function(e){var n=this;this.Be.vt(function(o){return bo(n,void 0,void 0,function(){return vo(this,function(r){switch(r.label){case 0:return o.newVersion===null?[4,e()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})})},t.prototype.setNetworkEnabled=function(e){var n=this;this.networkEnabled!==e&&(this.networkEnabled=e,this.Se.enqueueAndForget(function(){return bo(n,void 0,void 0,function(){return vo(this,function(o){switch(o.label){case 0:return this.started?[4,this.je()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})}))},t.prototype.je=function(){var e=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(n){return EO(n).put(new U6(e.clientId,Date.now(),e.networkEnabled,e.inForeground)).next(function(){if(e.isPrimary)return e.Je(n).next(function(o){o||(e.isPrimary=!1,e.Se.enqueueRetryable(function(){return e.Me(!1)}))})}).next(function(){return e.Ye(n)}).next(function(o){return e.isPrimary&&!o?e.Xe(n).next(function(){return!1}):!!o&&e.Ze(n).next(function(){return!0})})}).catch(function(n){if(Qb(n))return ur("IndexedDbPersistence","Failed to extend owner lease: ",n),e.isPrimary;if(!e.allowTabSynchronization)throw n;return ur("IndexedDbPersistence","Releasing owner lease after error during lease refresh",n),!1}).then(function(n){e.isPrimary!==n&&e.Se.enqueueRetryable(function(){return e.Me(n)}),e.isPrimary=n})},t.prototype.Je=function(e){var n=this;return Zz(e).get(Z1.key).next(function(o){return _o.resolve(n.tn(o))})},t.prototype.en=function(e){return EO(e).delete(this.clientId)},t.prototype.nn=function(){return bo(this,void 0,void 0,function(){var e,n,o,r,i=this;return vo(this,function(a){switch(a.label){case 0:return!this.isPrimary||this.sn(this.Oe,18e5)?[3,2]:(this.Oe=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(l){var s=f1(l,U6.store);return s.Nt().next(function(c){var u=i.rn(c,18e5),d=c.filter(function(f){return u.indexOf(f)===-1});return _o.forEach(d,function(f){return s.delete(f.clientId)}).next(function(){return d})})}).catch(function(){return[]})]);case 1:if(e=a.sent(),this.Qe)for(n=0,o=e;no&&(su("Detected an update time that is in the future: "+e+" > "+o),1))},t.prototype.We=function(){var e=this;this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Fe=function(){e.Se.enqueueAndForget(function(){return e.inForeground=e.document.visibilityState==="visible",e.je()})},this.document.addEventListener("visibilitychange",this.Fe),this.inForeground=this.document.visibilityState==="visible")},t.prototype.an=function(){this.Fe&&(this.document.removeEventListener("visibilitychange",this.Fe),this.Fe=null)},t.prototype.Ge=function(){var e,n=this;typeof((e=this.window)===null||e===void 0?void 0:e.addEventListener)=="function"&&(this.ke=function(){n.un(),Ljn()&&navigator.appVersion.match("Version/14")&&n.Se.enterRestrictedMode(!0),n.Se.enqueueAndForget(function(){return n.shutdown()})},this.window.addEventListener("pagehide",this.ke))},t.prototype.hn=function(){this.ke&&(this.window.removeEventListener("pagehide",this.ke),this.ke=null)},t.prototype.cn=function(e){var n;try{var o=((n=this.Qe)===null||n===void 0?void 0:n.getItem(this.on(e)))!==null;return ur("IndexedDbPersistence","Client '"+e+"' "+(o?"is":"is not")+" zombied in LocalStorage"),o}catch(r){return su("IndexedDbPersistence","Failed to get zombied client id.",r),!1}},t.prototype.un=function(){if(this.Qe)try{this.Qe.setItem(this.on(this.clientId),String(Date.now()))}catch(e){su("Failed to set zombie client id.",e)}},t.prototype.ln=function(){if(this.Qe)try{this.Qe.removeItem(this.on(this.clientId))}catch{}},t.prototype.on=function(e){return"firestore_zombie_"+this.persistenceKey+"_"+e},t}();function Zz(t){return f1(t,Z1.store)}function EO(t){return f1(t,U6.store)}function a5e(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var Rtt=function(){function t(e,n,o){this.Ue=e,this._n=n,this.Ut=o}return t.prototype.mn=function(e,n){var o=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(r){return o.yn(e,n,r)})},t.prototype.yn=function(e,n,o){return this.Ue.getEntry(e,n).next(function(r){for(var i=0,a=o;i0)},t.prototype.Dn=function(e,n){return Bde()<=Rl.DEBUG&&ur("QueryEngine","Using full collection scan to execute query:",Vde(n)),this.Sn.getDocumentsMatchingQuery(e,n,La.min())},t}(),LOn=function(){function t(e,n,o,r){this.persistence=e,this.xn=n,this.R=r,this.kn=new Ph(Ka),this.Fn=new sM(function(i){return WN(i)},zZ),this.$n=La.min(),this._n=e.getMutationQueue(o),this.On=e.getRemoteDocumentCache(),this.qe=e.getTargetCache(),this.Mn=new Rtt(this.On,this._n,this.persistence.getIndexManager()),this.Ke=e.getBundleCache(),this.xn.Vn(this.Mn)}return t.prototype.collectGarbage=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(o){return e.collect(o,n.kn)})},t}();/** + */var EOn=function(){function t(e){this.R=e}return t.prototype.Rt=function(e,n,o,r){var i=this;Ui(o=0&&r<=11);var a=new Att("createOrUpgrade",n);o<1&&r>=1&&(function(s){s.createObjectStore(Z1.store)}(e),function(s){s.createObjectStore(X8.store,{keyPath:X8.keyPath}),s.createObjectStore(hc.store,{keyPath:hc.keyPath,autoIncrement:!0}).createIndex(hc.userMutationsIndex,hc.userMutationsKeyPath,{unique:!0}),s.createObjectStore(sh.store)}(e),rCe(e),function(s){s.createObjectStore(f0.store)}(e));var l=_o.resolve();return o<3&&r>=3&&(o!==0&&(function(s){s.deleteObjectStore(df.store),s.deleteObjectStore(Xp.store),s.deleteObjectStore(ig.store)}(e),rCe(e)),l=l.next(function(){return function(s){var c=s.store(ig.store),u=new ig(0,0,La.min().toTimestamp(),0);return c.put(ig.key,u)}(a)})),o<4&&r>=4&&(o!==0&&(l=l.next(function(){return function(s,c){return c.store(hc.store).Nt().next(function(u){s.deleteObjectStore(hc.store),s.createObjectStore(hc.store,{keyPath:hc.keyPath,autoIncrement:!0}).createIndex(hc.userMutationsIndex,hc.userMutationsKeyPath,{unique:!0});var d=c.store(hc.store),f=u.map(function(p){return d.put(p)});return _o.waitFor(f)})}(e,a)})),l=l.next(function(){(function(s){s.createObjectStore(U6.store,{keyPath:U6.keyPath})})(e)})),o<5&&r>=5&&(l=l.next(function(){return i.Re(a)})),o<6&&r>=6&&(l=l.next(function(){return function(s){s.createObjectStore(y9.store)}(e),i.be(a)})),o<7&&r>=7&&(l=l.next(function(){return i.ve(a)})),o<8&&r>=8&&(l=l.next(function(){return i.Pe(e,a)})),o<9&&r>=9&&(l=l.next(function(){(function(s){s.objectStoreNames.contains("remoteDocumentChanges")&&s.deleteObjectStore("remoteDocumentChanges")})(e),function(s){var c=s.objectStore(f0.store);c.createIndex(f0.readTimeIndex,f0.readTimeIndexPath,{unique:!1}),c.createIndex(f0.collectionReadTimeIndex,f0.collectionReadTimeIndexPath,{unique:!1})}(n)})),o<10&&r>=10&&(l=l.next(function(){return i.Ve(a)})),o<11&&r>=11&&(l=l.next(function(){(function(s){s.createObjectStore(BR.store,{keyPath:BR.keyPath})})(e),function(s){s.createObjectStore(YR.store,{keyPath:YR.keyPath})}(e)})),l},t.prototype.be=function(e){var n=0;return e.store(f0.store).$t(function(o,r){n+=BX(r)}).next(function(){var o=new y9(n);return e.store(y9.store).put(y9.key,o)})},t.prototype.Re=function(e){var n=this,o=e.store(X8.store),r=e.store(hc.store);return o.Nt().next(function(i){return _o.forEach(i,function(a){var l=IDBKeyRange.bound([a.userId,-1],[a.userId,a.lastAcknowledgedBatchId]);return r.Nt(hc.userMutationsIndex,l).next(function(s){return _o.forEach(s,function(c){Ui(c.userId===a.userId);var u=gP(n.R,c);return Stt(e,a.userId,u).next(function(){})})})})})},t.prototype.ve=function(e){var n=e.store(df.store),o=e.store(f0.store);return e.store(ig.store).get(ig.key).next(function(r){var i=[];return o.$t(function(a,l){var s=new _l(a),c=function(u){return[0,U2(u)]}(s);i.push(n.get(c).next(function(u){return u?_o.resolve():function(d){return n.put(new df(0,U2(d),r.highestListenSequenceNumber))}(s)}))}).next(function(){return _o.waitFor(i)})})},t.prototype.Pe=function(e,n){e.createObjectStore(Hx.store,{keyPath:Hx.keyPath});var o=n.store(Hx.store),r=new i5e,i=function(a){if(r.add(a)){var l=a.lastSegment(),s=a.popLast();return o.put({collectionId:l,parent:U2(s)})}};return n.store(f0.store).$t({Ft:!0},function(a,l){var s=new _l(a);return i(s.popLast())}).next(function(){return n.store(sh.store).$t({Ft:!0},function(a,l){a[0];var s=a[1];a[2];var c=R6(s);return i(c.popLast())})})},t.prototype.Ve=function(e){var n=this,o=e.store(Xp.store);return o.$t(function(r,i){var a=_D(i),l=xtt(n.R,a);return o.put(l)})},t}();function rCe(t){t.createObjectStore(df.store,{keyPath:df.keyPath}).createIndex(df.documentTargetsIndex,df.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Xp.store,{keyPath:Xp.keyPath}).createIndex(Xp.queryTargetsIndexName,Xp.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(ig.store)}var Tae="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",FOn=function(){function t(e,n,o,r,i,a,l,s,c,u){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=o,this.Se=i,this.window=a,this.document=l,this.De=c,this.Ce=u,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ke=null,this.inForeground=!1,this.Fe=null,this.$e=null,this.Oe=Number.NEGATIVE_INFINITY,this.Me=function(d){return Promise.resolve()},!t.yt())throw new Lo(Vn.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new IOn(this,r),this.Le=n+"main",this.R=new wtt(s),this.Be=new OR(this.Le,11,new EOn(this.R)),this.qe=new COn(this.referenceDelegate,this.R),this.Ut=new TOn,this.Ue=function(d,f){return new zOn(d,f)}(this.R,this.Ut),this.Ke=new bOn,this.window&&this.window.localStorage?this.Qe=this.window.localStorage:(this.Qe=null,u===!1&&su("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.prototype.start=function(){var e=this;return this.je().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Lo(Vn.FAILED_PRECONDITION,Tae);return e.We(),e.Ge(),e.ze(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(n){return e.qe.getHighestSequenceNumber(n)})}).then(function(n){e.Ne=new yg(n,e.De)}).then(function(){e.xe=!0}).catch(function(n){return e.Be&&e.Be.close(),Promise.reject(n)})},t.prototype.He=function(e){var n=this;return this.Me=function(o){return bo(n,void 0,void 0,function(){return vo(this,function(r){return this.started?[2,e(o)]:[2]})})},e(this.isPrimary)},t.prototype.setDatabaseDeletedListener=function(e){var n=this;this.Be.vt(function(o){return bo(n,void 0,void 0,function(){return vo(this,function(r){switch(r.label){case 0:return o.newVersion===null?[4,e()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})})},t.prototype.setNetworkEnabled=function(e){var n=this;this.networkEnabled!==e&&(this.networkEnabled=e,this.Se.enqueueAndForget(function(){return bo(n,void 0,void 0,function(){return vo(this,function(o){switch(o.label){case 0:return this.started?[4,this.je()]:[3,2];case 1:o.sent(),o.label=2;case 2:return[2]}})})}))},t.prototype.je=function(){var e=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(n){return EO(n).put(new U6(e.clientId,Date.now(),e.networkEnabled,e.inForeground)).next(function(){if(e.isPrimary)return e.Je(n).next(function(o){o||(e.isPrimary=!1,e.Se.enqueueRetryable(function(){return e.Me(!1)}))})}).next(function(){return e.Ye(n)}).next(function(o){return e.isPrimary&&!o?e.Xe(n).next(function(){return!1}):!!o&&e.Ze(n).next(function(){return!0})})}).catch(function(n){if(Qb(n))return ur("IndexedDbPersistence","Failed to extend owner lease: ",n),e.isPrimary;if(!e.allowTabSynchronization)throw n;return ur("IndexedDbPersistence","Releasing owner lease after error during lease refresh",n),!1}).then(function(n){e.isPrimary!==n&&e.Se.enqueueRetryable(function(){return e.Me(n)}),e.isPrimary=n})},t.prototype.Je=function(e){var n=this;return Zz(e).get(Z1.key).next(function(o){return _o.resolve(n.tn(o))})},t.prototype.en=function(e){return EO(e).delete(this.clientId)},t.prototype.nn=function(){return bo(this,void 0,void 0,function(){var e,n,o,r,i=this;return vo(this,function(a){switch(a.label){case 0:return!this.isPrimary||this.sn(this.Oe,18e5)?[3,2]:(this.Oe=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(l){var s=f1(l,U6.store);return s.Nt().next(function(c){var u=i.rn(c,18e5),d=c.filter(function(f){return u.indexOf(f)===-1});return _o.forEach(d,function(f){return s.delete(f.clientId)}).next(function(){return d})})}).catch(function(){return[]})]);case 1:if(e=a.sent(),this.Qe)for(n=0,o=e;no&&(su("Detected an update time that is in the future: "+e+" > "+o),1))},t.prototype.We=function(){var e=this;this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Fe=function(){e.Se.enqueueAndForget(function(){return e.inForeground=e.document.visibilityState==="visible",e.je()})},this.document.addEventListener("visibilitychange",this.Fe),this.inForeground=this.document.visibilityState==="visible")},t.prototype.an=function(){this.Fe&&(this.document.removeEventListener("visibilitychange",this.Fe),this.Fe=null)},t.prototype.Ge=function(){var e,n=this;typeof((e=this.window)===null||e===void 0?void 0:e.addEventListener)=="function"&&(this.ke=function(){n.un(),Ljn()&&navigator.appVersion.match("Version/14")&&n.Se.enterRestrictedMode(!0),n.Se.enqueueAndForget(function(){return n.shutdown()})},this.window.addEventListener("pagehide",this.ke))},t.prototype.hn=function(){this.ke&&(this.window.removeEventListener("pagehide",this.ke),this.ke=null)},t.prototype.cn=function(e){var n;try{var o=((n=this.Qe)===null||n===void 0?void 0:n.getItem(this.on(e)))!==null;return ur("IndexedDbPersistence","Client '"+e+"' "+(o?"is":"is not")+" zombied in LocalStorage"),o}catch(r){return su("IndexedDbPersistence","Failed to get zombied client id.",r),!1}},t.prototype.un=function(){if(this.Qe)try{this.Qe.setItem(this.on(this.clientId),String(Date.now()))}catch(e){su("Failed to set zombie client id.",e)}},t.prototype.ln=function(){if(this.Qe)try{this.Qe.removeItem(this.on(this.clientId))}catch{}},t.prototype.on=function(e){return"firestore_zombie_"+this.persistenceKey+"_"+e},t}();function Zz(t){return f1(t,Z1.store)}function EO(t){return f1(t,U6.store)}function a5e(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var Rtt=function(){function t(e,n,o){this.Ue=e,this._n=n,this.Ut=o}return t.prototype.mn=function(e,n){var o=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(r){return o.yn(e,n,r)})},t.prototype.yn=function(e,n,o){return this.Ue.getEntry(e,n).next(function(r){for(var i=0,a=o;i0)},t.prototype.Dn=function(e,n){return Bde()<=Rl.DEBUG&&ur("QueryEngine","Using full collection scan to execute query:",Vde(n)),this.Sn.getDocumentsMatchingQuery(e,n,La.min())},t}(),LOn=function(){function t(e,n,o,r){this.persistence=e,this.xn=n,this.R=r,this.kn=new Ph(Ka),this.Fn=new sM(function(i){return WN(i)},zZ),this.$n=La.min(),this._n=e.getMutationQueue(o),this.On=e.getRemoteDocumentCache(),this.qe=e.getTargetCache(),this.Mn=new Rtt(this.On,this._n,this.persistence.getIndexManager()),this.Ke=e.getBundleCache(),this.xn.Vn(this.Mn)}return t.prototype.collectGarbage=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(o){return e.collect(o,n.kn)})},t}();/** * @license * Copyright 2017 Google LLC * @@ -6021,7 +6021,7 @@ Total Duration: `+(c-d)+"ms"),_o.resolve({didRun:!0,sequenceNumbersCollected:r,t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var YOn=function(){function t(e){this.R=e,this.Qn=new Map,this.jn=new Map}return t.prototype.getBundleMetadata=function(e,n){return _o.resolve(this.Qn.get(n))},t.prototype.saveBundleMetadata=function(e,n){var o;return this.Qn.set(n.id,{id:(o=n).id,version:o.version,createTime:lp(o.createTime)}),_o.resolve()},t.prototype.getNamedQuery=function(e,n){return _o.resolve(this.jn.get(n))},t.prototype.saveNamedQuery=function(e,n){return this.jn.set(n.name,function(o){return{name:o.name,query:btt(o.bundledQuery),readTime:lp(o.readTime)}}(n)),_o.resolve()},t}(),l5e=function(){function t(){this.Wn=new ju(wd.Gn),this.zn=new ju(wd.Hn)}return t.prototype.isEmpty=function(){return this.Wn.isEmpty()},t.prototype.addReference=function(e,n){var o=new wd(e,n);this.Wn=this.Wn.add(o),this.zn=this.zn.add(o)},t.prototype.Jn=function(e,n){var o=this;e.forEach(function(r){return o.addReference(r,n)})},t.prototype.removeReference=function(e,n){this.Yn(new wd(e,n))},t.prototype.Xn=function(e,n){var o=this;e.forEach(function(r){return o.removeReference(r,n)})},t.prototype.Zn=function(e){var n=this,o=new ci(new _l([])),r=new wd(o,e),i=new wd(o,e+1),a=[];return this.zn.forEachInRange([r,i],function(l){n.Yn(l),a.push(l.key)}),a},t.prototype.ts=function(){var e=this;this.Wn.forEach(function(n){return e.Yn(n)})},t.prototype.Yn=function(e){this.Wn=this.Wn.delete(e),this.zn=this.zn.delete(e)},t.prototype.es=function(e){var n=new ci(new _l([])),o=new wd(n,e),r=new wd(n,e+1),i=Ks();return this.zn.forEachInRange([o,r],function(a){i=i.add(a.key)}),i},t.prototype.containsKey=function(e){var n=new wd(e,0),o=this.Wn.firstAfterOrEqual(n);return o!==null&&e.isEqual(o.key)},t}(),wd=function(){function t(e,n){this.key=e,this.ns=n}return t.Gn=function(e,n){return ci.comparator(e.key,n.key)||Ka(e.ns,n.ns)},t.Hn=function(e,n){return Ka(e.ns,n.ns)||ci.comparator(e.key,n.key)},t}(),OOn=function(){function t(e,n){this.Ut=e,this.referenceDelegate=n,this._n=[],this.ss=1,this.rs=new ju(wd.Gn)}return t.prototype.checkEmpty=function(e){return _o.resolve(this._n.length===0)},t.prototype.addMutationBatch=function(e,n,o,r){var i=this.ss;this.ss++,this._n.length>0&&this._n[this._n.length-1];var a=new o5e(i,n,o,r);this._n.push(a);for(var l=0,s=r;li?this._n[i]:null)},t.prototype.getHighestUnacknowledgedBatchId=function(){return _o.resolve(this._n.length===0?-1:this.ss-1)},t.prototype.getAllMutationBatches=function(e){return _o.resolve(this._n.slice())},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,n){var o=this,r=new wd(n,0),i=new wd(n,Number.POSITIVE_INFINITY),a=[];return this.rs.forEachInRange([r,i],function(l){var s=o.os(l.ns);a.push(s)}),_o.resolve(a)},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,n){var o=this,r=new ju(Ka);return n.forEach(function(i){var a=new wd(i,0),l=new wd(i,Number.POSITIVE_INFINITY);o.rs.forEachInRange([a,l],function(s){r=r.add(s.ns)})}),_o.resolve(this.us(r))},t.prototype.getAllMutationBatchesAffectingQuery=function(e,n){var o=n.path,r=o.length+1,i=o;ci.isDocumentKey(i)||(i=i.child(""));var a=new wd(new ci(i),0),l=new ju(Ka);return this.rs.forEachWhile(function(s){var c=s.key.path;return!!o.isPrefixOf(c)&&(c.length===r&&(l=l.add(s.ns)),!0)},a),_o.resolve(this.us(l))},t.prototype.us=function(e){var n=this,o=[];return e.forEach(function(r){var i=n.os(r);i!==null&&o.push(i)}),o},t.prototype.removeMutationBatch=function(e,n){var o=this;Ui(this.hs(n.batchId,"removed")===0),this._n.shift();var r=this.rs;return _o.forEach(n.mutations,function(i){var a=new wd(i.key,n.batchId);return r=r.delete(a),o.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(function(){o.rs=r})},t.prototype.Gt=function(e){},t.prototype.containsKey=function(e,n){var o=new wd(n,0),r=this.rs.firstAfterOrEqual(o);return _o.resolve(n.isEqual(r&&r.key))},t.prototype.performConsistencyCheck=function(e){return this._n.length,_o.resolve()},t.prototype.hs=function(e,n){return this.cs(e)},t.prototype.cs=function(e){return this._n.length===0?0:e-this._n[0].batchId},t.prototype.os=function(e){var n=this.cs(e);return n<0||n>=this._n.length?null:this._n[n]},t}(),VOn=function(){function t(e,n){this.Ut=e,this.ls=n,this.docs=new Ph(ci.comparator),this.size=0}return t.prototype.addEntry=function(e,n,o){var r=n.key,i=this.docs.get(r),a=i?i.size:0,l=this.ls(n);return this.docs=this.docs.insert(r,{document:n.clone(),size:l,readTime:o}),this.size+=l-a,this.Ut.addToCollectionParentIndex(e,r.path.popLast())},t.prototype.removeEntry=function(e){var n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)},t.prototype.getEntry=function(e,n){var o=this.docs.get(n);return _o.resolve(o?o.document.clone():Ah.newInvalidDocument(n))},t.prototype.getEntries=function(e,n){var o=this,r=N2();return n.forEach(function(i){var a=o.docs.get(i);r=r.insert(i,a?a.document.clone():Ah.newInvalidDocument(i))}),_o.resolve(r)},t.prototype.getDocumentsMatchingQuery=function(e,n,o){for(var r=N2(),i=new ci(n.path.child("")),a=this.docs.getIteratorFrom(i);a.hasNext();){var l=a.getNext(),s=l.key,c=l.value,u=c.document,d=c.readTime;if(!n.path.isPrefixOf(s.path))break;d.compareTo(o)<=0||jN(n,u)&&(r=r.insert(u.key,u.clone()))}return _o.resolve(r)},t.prototype.fs=function(e,n){return _o.forEach(this.docs,function(o){return n(o)})},t.prototype.newChangeBuffer=function(e){return new _On(this)},t.prototype.getSize=function(e){return _o.resolve(this.size)},t}(),_On=function(t){function e(n){var o=this;return(o=t.call(this)||this).Ie=n,o}return Pr(e,t),e.prototype.applyChanges=function(n){var o=this,r=[];return this.changes.forEach(function(i,a){a.document.isValidDocument()?r.push(o.Ie.addEntry(n,a.document,o.getReadTime(i))):o.Ie.removeEntry(i)}),_o.waitFor(r)},e.prototype.getFromCache=function(n,o){return this.Ie.getEntry(n,o)},e.prototype.getAllFromCache=function(n,o){return this.Ie.getEntries(n,o)},e}(Ctt),GOn=function(){function t(e){this.persistence=e,this.ds=new sM(function(n){return WN(n)},zZ),this.lastRemoteSnapshotVersion=La.min(),this.highestTargetId=0,this.ws=0,this._s=new l5e,this.targetCount=0,this.ys=YX.Jt()}return t.prototype.forEachTarget=function(e,n){return this.ds.forEach(function(o,r){return n(r)}),_o.resolve()},t.prototype.getLastRemoteSnapshotVersion=function(e){return _o.resolve(this.lastRemoteSnapshotVersion)},t.prototype.getHighestSequenceNumber=function(e){return _o.resolve(this.ws)},t.prototype.allocateTargetId=function(e){return this.highestTargetId=this.ys.next(),_o.resolve(this.highestTargetId)},t.prototype.setTargetsMetadata=function(e,n,o){return o&&(this.lastRemoteSnapshotVersion=o),n>this.ws&&(this.ws=n),_o.resolve()},t.prototype.te=function(e){this.ds.set(e.target,e);var n=e.targetId;n>this.highestTargetId&&(this.ys=new YX(n),this.highestTargetId=n),e.sequenceNumber>this.ws&&(this.ws=e.sequenceNumber)},t.prototype.addTargetData=function(e,n){return this.te(n),this.targetCount+=1,_o.resolve()},t.prototype.updateTargetData=function(e,n){return this.te(n),_o.resolve()},t.prototype.removeTargetData=function(e,n){return this.ds.delete(n.target),this._s.Zn(n.targetId),this.targetCount-=1,_o.resolve()},t.prototype.removeTargets=function(e,n,o){var r=this,i=0,a=[];return this.ds.forEach(function(l,s){s.sequenceNumber<=n&&o.get(s.targetId)===null&&(r.ds.delete(l),a.push(r.removeMatchingKeysForTargetId(e,s.targetId)),i++)}),_o.waitFor(a).next(function(){return i})},t.prototype.getTargetCount=function(e){return _o.resolve(this.targetCount)},t.prototype.getTargetData=function(e,n){var o=this.ds.get(n)||null;return _o.resolve(o)},t.prototype.addMatchingKeys=function(e,n,o){return this._s.Jn(n,o),_o.resolve()},t.prototype.removeMatchingKeys=function(e,n,o){this._s.Xn(n,o);var r=this.persistence.referenceDelegate,i=[];return r&&n.forEach(function(a){i.push(r.markPotentiallyOrphaned(e,a))}),_o.waitFor(i)},t.prototype.removeMatchingKeysForTargetId=function(e,n){return this._s.Zn(n),_o.resolve()},t.prototype.getMatchingKeysForTargetId=function(e,n){var o=this._s.es(n);return _o.resolve(o)},t.prototype.containsKey=function(e,n){return _o.resolve(this._s.containsKey(n))},t}(),XOn=function(){function t(e,n){var o=this;this.gs={},this.Ne=new yg(0),this.xe=!1,this.xe=!0,this.referenceDelegate=e(this),this.qe=new GOn(this),this.Ut=new SOn,this.Ue=function(r,i){return new VOn(r,function(a){return o.referenceDelegate.ps(a)})}(this.Ut),this.R=new wtt(n),this.Ke=new YOn(this.R)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(t.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),t.prototype.setDatabaseDeletedListener=function(){},t.prototype.setNetworkEnabled=function(){},t.prototype.getIndexManager=function(){return this.Ut},t.prototype.getMutationQueue=function(e){var n=this.gs[e.toKey()];return n||(n=new OOn(this.Ut,this.referenceDelegate),this.gs[e.toKey()]=n),n},t.prototype.getTargetCache=function(){return this.qe},t.prototype.getRemoteDocumentCache=function(){return this.Ue},t.prototype.getBundleCache=function(){return this.Ke},t.prototype.runTransaction=function(e,n,o){var r=this;ur("MemoryPersistence","Starting transaction:",e);var i=new JOn(this.Ne.next());return this.referenceDelegate.Es(),o(i).next(function(a){return r.referenceDelegate.Ts(i).next(function(){return a})}).toPromise().then(function(a){return i.raiseOnCommittedEvent(),a})},t.prototype.Is=function(e,n){return _o.or(Object.values(this.gs).map(function(o){return function(){return o.containsKey(e,n)}}))},t}(),JOn=function(t){function e(n){var o=this;return(o=t.call(this)||this).currentSequenceNumber=n,o}return Pr(e,t),e}(ytt),KOn=function(){function t(e){this.persistence=e,this.As=new l5e,this.Rs=null}return t.bs=function(e){return new t(e)},Object.defineProperty(t.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw ni()},enumerable:!1,configurable:!0}),t.prototype.addReference=function(e,n,o){return this.As.addReference(o,n),this.vs.delete(o.toString()),_o.resolve()},t.prototype.removeReference=function(e,n,o){return this.As.removeReference(o,n),this.vs.add(o.toString()),_o.resolve()},t.prototype.markPotentiallyOrphaned=function(e,n){return this.vs.add(n.toString()),_o.resolve()},t.prototype.removeTarget=function(e,n){var o=this;this.As.Zn(n.targetId).forEach(function(i){return o.vs.add(i.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(function(i){i.forEach(function(a){return o.vs.add(a.toString())})}).next(function(){return r.removeTargetData(e,n)})},t.prototype.Es=function(){this.Rs=new Set},t.prototype.Ts=function(e){var n=this,o=this.persistence.getRemoteDocumentCache().newChangeBuffer();return _o.forEach(this.vs,function(r){var i=ci.fromPath(r);return n.Ps(e,i).next(function(a){a||o.removeEntry(i)})}).next(function(){return n.Rs=null,o.apply(e)})},t.prototype.updateLimboDocument=function(e,n){var o=this;return this.Ps(e,n).next(function(r){r?o.vs.delete(n.toString()):o.vs.add(n.toString())})},t.prototype.ps=function(e){return 0},t.prototype.Ps=function(e,n){var o=this;return _o.or([function(){return _o.resolve(o.As.containsKey(n))},function(){return o.persistence.getTargetCache().containsKey(e,n)},function(){return o.persistence.Is(e,n)}])},t}(),lf=function(){function t(e){this.uid=e}return t.prototype.isAuthenticated=function(){return this.uid!=null},t.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(e){return e.uid===this.uid},t}();/** + */var YOn=function(){function t(e){this.R=e,this.Qn=new Map,this.jn=new Map}return t.prototype.getBundleMetadata=function(e,n){return _o.resolve(this.Qn.get(n))},t.prototype.saveBundleMetadata=function(e,n){var o;return this.Qn.set(n.id,{id:(o=n).id,version:o.version,createTime:lp(o.createTime)}),_o.resolve()},t.prototype.getNamedQuery=function(e,n){return _o.resolve(this.jn.get(n))},t.prototype.saveNamedQuery=function(e,n){return this.jn.set(n.name,function(o){return{name:o.name,query:btt(o.bundledQuery),readTime:lp(o.readTime)}}(n)),_o.resolve()},t}(),l5e=function(){function t(){this.Wn=new ju(wd.Gn),this.zn=new ju(wd.Hn)}return t.prototype.isEmpty=function(){return this.Wn.isEmpty()},t.prototype.addReference=function(e,n){var o=new wd(e,n);this.Wn=this.Wn.add(o),this.zn=this.zn.add(o)},t.prototype.Jn=function(e,n){var o=this;e.forEach(function(r){return o.addReference(r,n)})},t.prototype.removeReference=function(e,n){this.Yn(new wd(e,n))},t.prototype.Xn=function(e,n){var o=this;e.forEach(function(r){return o.removeReference(r,n)})},t.prototype.Zn=function(e){var n=this,o=new ci(new _l([])),r=new wd(o,e),i=new wd(o,e+1),a=[];return this.zn.forEachInRange([r,i],function(l){n.Yn(l),a.push(l.key)}),a},t.prototype.ts=function(){var e=this;this.Wn.forEach(function(n){return e.Yn(n)})},t.prototype.Yn=function(e){this.Wn=this.Wn.delete(e),this.zn=this.zn.delete(e)},t.prototype.es=function(e){var n=new ci(new _l([])),o=new wd(n,e),r=new wd(n,e+1),i=Ks();return this.zn.forEachInRange([o,r],function(a){i=i.add(a.key)}),i},t.prototype.containsKey=function(e){var n=new wd(e,0),o=this.Wn.firstAfterOrEqual(n);return o!==null&&e.isEqual(o.key)},t}(),wd=function(){function t(e,n){this.key=e,this.ns=n}return t.Gn=function(e,n){return ci.comparator(e.key,n.key)||Ka(e.ns,n.ns)},t.Hn=function(e,n){return Ka(e.ns,n.ns)||ci.comparator(e.key,n.key)},t}(),OOn=function(){function t(e,n){this.Ut=e,this.referenceDelegate=n,this._n=[],this.ss=1,this.rs=new ju(wd.Gn)}return t.prototype.checkEmpty=function(e){return _o.resolve(this._n.length===0)},t.prototype.addMutationBatch=function(e,n,o,r){var i=this.ss;this.ss++,this._n.length>0&&this._n[this._n.length-1];var a=new o5e(i,n,o,r);this._n.push(a);for(var l=0,s=r;li?this._n[i]:null)},t.prototype.getHighestUnacknowledgedBatchId=function(){return _o.resolve(this._n.length===0?-1:this.ss-1)},t.prototype.getAllMutationBatches=function(e){return _o.resolve(this._n.slice())},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,n){var o=this,r=new wd(n,0),i=new wd(n,Number.POSITIVE_INFINITY),a=[];return this.rs.forEachInRange([r,i],function(l){var s=o.os(l.ns);a.push(s)}),_o.resolve(a)},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,n){var o=this,r=new ju(Ka);return n.forEach(function(i){var a=new wd(i,0),l=new wd(i,Number.POSITIVE_INFINITY);o.rs.forEachInRange([a,l],function(s){r=r.add(s.ns)})}),_o.resolve(this.us(r))},t.prototype.getAllMutationBatchesAffectingQuery=function(e,n){var o=n.path,r=o.length+1,i=o;ci.isDocumentKey(i)||(i=i.child(""));var a=new wd(new ci(i),0),l=new ju(Ka);return this.rs.forEachWhile(function(s){var c=s.key.path;return!!o.isPrefixOf(c)&&(c.length===r&&(l=l.add(s.ns)),!0)},a),_o.resolve(this.us(l))},t.prototype.us=function(e){var n=this,o=[];return e.forEach(function(r){var i=n.os(r);i!==null&&o.push(i)}),o},t.prototype.removeMutationBatch=function(e,n){var o=this;Ui(this.hs(n.batchId,"removed")===0),this._n.shift();var r=this.rs;return _o.forEach(n.mutations,function(i){var a=new wd(i.key,n.batchId);return r=r.delete(a),o.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(function(){o.rs=r})},t.prototype.Gt=function(e){},t.prototype.containsKey=function(e,n){var o=new wd(n,0),r=this.rs.firstAfterOrEqual(o);return _o.resolve(n.isEqual(r&&r.key))},t.prototype.performConsistencyCheck=function(e){return this._n.length,_o.resolve()},t.prototype.hs=function(e,n){return this.cs(e)},t.prototype.cs=function(e){return this._n.length===0?0:e-this._n[0].batchId},t.prototype.os=function(e){var n=this.cs(e);return n<0||n>=this._n.length?null:this._n[n]},t}(),VOn=function(){function t(e,n){this.Ut=e,this.ls=n,this.docs=new Ph(ci.comparator),this.size=0}return t.prototype.addEntry=function(e,n,o){var r=n.key,i=this.docs.get(r),a=i?i.size:0,l=this.ls(n);return this.docs=this.docs.insert(r,{document:n.clone(),size:l,readTime:o}),this.size+=l-a,this.Ut.addToCollectionParentIndex(e,r.path.popLast())},t.prototype.removeEntry=function(e){var n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)},t.prototype.getEntry=function(e,n){var o=this.docs.get(n);return _o.resolve(o?o.document.clone():wh.newInvalidDocument(n))},t.prototype.getEntries=function(e,n){var o=this,r=N2();return n.forEach(function(i){var a=o.docs.get(i);r=r.insert(i,a?a.document.clone():wh.newInvalidDocument(i))}),_o.resolve(r)},t.prototype.getDocumentsMatchingQuery=function(e,n,o){for(var r=N2(),i=new ci(n.path.child("")),a=this.docs.getIteratorFrom(i);a.hasNext();){var l=a.getNext(),s=l.key,c=l.value,u=c.document,d=c.readTime;if(!n.path.isPrefixOf(s.path))break;d.compareTo(o)<=0||jN(n,u)&&(r=r.insert(u.key,u.clone()))}return _o.resolve(r)},t.prototype.fs=function(e,n){return _o.forEach(this.docs,function(o){return n(o)})},t.prototype.newChangeBuffer=function(e){return new _On(this)},t.prototype.getSize=function(e){return _o.resolve(this.size)},t}(),_On=function(t){function e(n){var o=this;return(o=t.call(this)||this).Ie=n,o}return Pr(e,t),e.prototype.applyChanges=function(n){var o=this,r=[];return this.changes.forEach(function(i,a){a.document.isValidDocument()?r.push(o.Ie.addEntry(n,a.document,o.getReadTime(i))):o.Ie.removeEntry(i)}),_o.waitFor(r)},e.prototype.getFromCache=function(n,o){return this.Ie.getEntry(n,o)},e.prototype.getAllFromCache=function(n,o){return this.Ie.getEntries(n,o)},e}(Ctt),GOn=function(){function t(e){this.persistence=e,this.ds=new sM(function(n){return WN(n)},zZ),this.lastRemoteSnapshotVersion=La.min(),this.highestTargetId=0,this.ws=0,this._s=new l5e,this.targetCount=0,this.ys=YX.Jt()}return t.prototype.forEachTarget=function(e,n){return this.ds.forEach(function(o,r){return n(r)}),_o.resolve()},t.prototype.getLastRemoteSnapshotVersion=function(e){return _o.resolve(this.lastRemoteSnapshotVersion)},t.prototype.getHighestSequenceNumber=function(e){return _o.resolve(this.ws)},t.prototype.allocateTargetId=function(e){return this.highestTargetId=this.ys.next(),_o.resolve(this.highestTargetId)},t.prototype.setTargetsMetadata=function(e,n,o){return o&&(this.lastRemoteSnapshotVersion=o),n>this.ws&&(this.ws=n),_o.resolve()},t.prototype.te=function(e){this.ds.set(e.target,e);var n=e.targetId;n>this.highestTargetId&&(this.ys=new YX(n),this.highestTargetId=n),e.sequenceNumber>this.ws&&(this.ws=e.sequenceNumber)},t.prototype.addTargetData=function(e,n){return this.te(n),this.targetCount+=1,_o.resolve()},t.prototype.updateTargetData=function(e,n){return this.te(n),_o.resolve()},t.prototype.removeTargetData=function(e,n){return this.ds.delete(n.target),this._s.Zn(n.targetId),this.targetCount-=1,_o.resolve()},t.prototype.removeTargets=function(e,n,o){var r=this,i=0,a=[];return this.ds.forEach(function(l,s){s.sequenceNumber<=n&&o.get(s.targetId)===null&&(r.ds.delete(l),a.push(r.removeMatchingKeysForTargetId(e,s.targetId)),i++)}),_o.waitFor(a).next(function(){return i})},t.prototype.getTargetCount=function(e){return _o.resolve(this.targetCount)},t.prototype.getTargetData=function(e,n){var o=this.ds.get(n)||null;return _o.resolve(o)},t.prototype.addMatchingKeys=function(e,n,o){return this._s.Jn(n,o),_o.resolve()},t.prototype.removeMatchingKeys=function(e,n,o){this._s.Xn(n,o);var r=this.persistence.referenceDelegate,i=[];return r&&n.forEach(function(a){i.push(r.markPotentiallyOrphaned(e,a))}),_o.waitFor(i)},t.prototype.removeMatchingKeysForTargetId=function(e,n){return this._s.Zn(n),_o.resolve()},t.prototype.getMatchingKeysForTargetId=function(e,n){var o=this._s.es(n);return _o.resolve(o)},t.prototype.containsKey=function(e,n){return _o.resolve(this._s.containsKey(n))},t}(),XOn=function(){function t(e,n){var o=this;this.gs={},this.Ne=new yg(0),this.xe=!1,this.xe=!0,this.referenceDelegate=e(this),this.qe=new GOn(this),this.Ut=new SOn,this.Ue=function(r,i){return new VOn(r,function(a){return o.referenceDelegate.ps(a)})}(this.Ut),this.R=new wtt(n),this.Ke=new YOn(this.R)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(t.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),t.prototype.setDatabaseDeletedListener=function(){},t.prototype.setNetworkEnabled=function(){},t.prototype.getIndexManager=function(){return this.Ut},t.prototype.getMutationQueue=function(e){var n=this.gs[e.toKey()];return n||(n=new OOn(this.Ut,this.referenceDelegate),this.gs[e.toKey()]=n),n},t.prototype.getTargetCache=function(){return this.qe},t.prototype.getRemoteDocumentCache=function(){return this.Ue},t.prototype.getBundleCache=function(){return this.Ke},t.prototype.runTransaction=function(e,n,o){var r=this;ur("MemoryPersistence","Starting transaction:",e);var i=new JOn(this.Ne.next());return this.referenceDelegate.Es(),o(i).next(function(a){return r.referenceDelegate.Ts(i).next(function(){return a})}).toPromise().then(function(a){return i.raiseOnCommittedEvent(),a})},t.prototype.Is=function(e,n){return _o.or(Object.values(this.gs).map(function(o){return function(){return o.containsKey(e,n)}}))},t}(),JOn=function(t){function e(n){var o=this;return(o=t.call(this)||this).currentSequenceNumber=n,o}return Pr(e,t),e}(ytt),KOn=function(){function t(e){this.persistence=e,this.As=new l5e,this.Rs=null}return t.bs=function(e){return new t(e)},Object.defineProperty(t.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw ni()},enumerable:!1,configurable:!0}),t.prototype.addReference=function(e,n,o){return this.As.addReference(o,n),this.vs.delete(o.toString()),_o.resolve()},t.prototype.removeReference=function(e,n,o){return this.As.removeReference(o,n),this.vs.add(o.toString()),_o.resolve()},t.prototype.markPotentiallyOrphaned=function(e,n){return this.vs.add(n.toString()),_o.resolve()},t.prototype.removeTarget=function(e,n){var o=this;this.As.Zn(n.targetId).forEach(function(i){return o.vs.add(i.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(function(i){i.forEach(function(a){return o.vs.add(a.toString())})}).next(function(){return r.removeTargetData(e,n)})},t.prototype.Es=function(){this.Rs=new Set},t.prototype.Ts=function(e){var n=this,o=this.persistence.getRemoteDocumentCache().newChangeBuffer();return _o.forEach(this.vs,function(r){var i=ci.fromPath(r);return n.Ps(e,i).next(function(a){a||o.removeEntry(i)})}).next(function(){return n.Rs=null,o.apply(e)})},t.prototype.updateLimboDocument=function(e,n){var o=this;return this.Ps(e,n).next(function(r){r?o.vs.delete(n.toString()):o.vs.add(n.toString())})},t.prototype.ps=function(e){return 0},t.prototype.Ps=function(e,n){var o=this;return _o.or([function(){return _o.resolve(o.As.containsKey(n))},function(){return o.persistence.getTargetCache().containsKey(e,n)},function(){return o.persistence.Is(e,n)}])},t}(),lf=function(){function t(e){this.uid=e}return t.prototype.isAuthenticated=function(){return this.uid!=null},t.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(e){return e.uid===this.uid},t}();/** * @license * Copyright 2017 Google LLC * @@ -6081,7 +6081,7 @@ Total Duration: `+(c-d)+"ms"),_o.resolve({didRun:!0,sequenceNumbersCollected:r,t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function LZ(t){return new aOn(t,!0)}var s5e=function(){function t(e,n,o,r,i){o===void 0&&(o=1e3),r===void 0&&(r=1.5),i===void 0&&(i=6e4),this.Se=e,this.timerId=n,this.Mi=o,this.Li=r,this.Bi=i,this.qi=0,this.Ui=null,this.Ki=Date.now(),this.reset()}return t.prototype.reset=function(){this.qi=0},t.prototype.Qi=function(){this.qi=this.Bi},t.prototype.ji=function(e){var n=this;this.cancel();var o=Math.floor(this.qi+this.Wi()),r=Math.max(0,Date.now()-this.Ki),i=Math.max(0,o-r);i>0&&ur("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.qi+" ms, delay with jitter: "+o+" ms, last attempt: "+r+" ms ago)"),this.Ui=this.Se.enqueueAfterDelay(this.timerId,i,function(){return n.Ki=Date.now(),e()}),this.qi*=this.Li,this.qithis.Bi&&(this.qi=this.Bi)},t.prototype.Gi=function(){this.Ui!==null&&(this.Ui.skipDelay(),this.Ui=null)},t.prototype.cancel=function(){this.Ui!==null&&(this.Ui.cancel(),this.Ui=null)},t.prototype.Wi=function(){return(Math.random()-.5)*this.qi},t}(),Ltt=function(){function t(e,n,o,r,i,a){this.Se=e,this.zi=o,this.Hi=r,this.Ji=i,this.listener=a,this.state=0,this.Yi=0,this.Xi=null,this.stream=null,this.Zi=new s5e(e,n)}return t.prototype.tr=function(){return this.state===1||this.state===2||this.state===4},t.prototype.er=function(){return this.state===2},t.prototype.start=function(){this.state!==3?this.auth():this.nr()},t.prototype.stop=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){switch(e.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},t.prototype.sr=function(){this.state=0,this.Zi.reset()},t.prototype.ir=function(){var e=this;this.er()&&this.Xi===null&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return e.rr()}))},t.prototype.cr=function(e){this.ur(),this.stream.send(e)},t.prototype.rr=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){return this.er()?[2,this.close(0)]:[2]})})},t.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},t.prototype.close=function(e,n){return bo(this,void 0,void 0,function(){return vo(this,function(o){switch(o.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,e!==3?this.Zi.reset():n&&n.code===Vn.RESOURCE_EXHAUSTED?(su(n.toString()),su("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Qi()):n&&n.code===Vn.UNAUTHENTICATED&&this.Ji.invalidateToken(),this.stream!==null&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return o.sent(),[2]}})})},t.prototype.ar=function(){},t.prototype.auth=function(){var e=this;this.state=1;var n=this.hr(this.Yi),o=this.Yi;this.Ji.getToken().then(function(r){e.Yi===o&&e.lr(r)},function(r){n(function(){var i=new Lo(Vn.UNKNOWN,"Fetching auth token failed: "+r.message);return e.dr(i)})})},t.prototype.lr=function(e){var n=this,o=this.hr(this.Yi);this.stream=this.wr(e),this.stream.Ii(function(){o(function(){return n.state=2,n.listener.Ii()})}),this.stream.Ri(function(r){o(function(){return n.dr(r)})}),this.stream.onMessage(function(r){o(function(){return n.onMessage(r)})})},t.prototype.nr=function(){var e=this;this.state=4,this.Zi.ji(function(){return bo(e,void 0,void 0,function(){return vo(this,function(n){return this.state=0,this.start(),[2]})})})},t.prototype.dr=function(e){return ur("PersistentStream","close with error: "+e),this.stream=null,this.close(3,e)},t.prototype.hr=function(e){var n=this;return function(o){n.Se.enqueueAndForget(function(){return n.Yi===e?o():(ur("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},t}(),tVn=function(t){function e(n,o,r,i,a){var l=this;return(l=t.call(this,n,"listen_stream_connection_backoff","listen_stream_idle",o,r,a)||this).R=i,l}return Pr(e,t),e.prototype.wr=function(n){return this.Hi.Oi("Listen",n)},e.prototype.onMessage=function(n){this.Zi.reset();var o=function(i,a){var l;if("targetChange"in a){a.targetChange;var s=function(y){return y==="NO_CHANGE"?0:y==="ADD"?1:y==="REMOVE"?2:y==="CURRENT"?3:y==="RESET"?4:ni()}(a.targetChange.targetChangeType||"NO_CHANGE"),c=a.targetChange.targetIds||[],u=function(y,S){return y.I?(Ui(S===void 0||typeof S=="string"),i1.fromBase64String(S||"")):(Ui(S===void 0||S instanceof Uint8Array),i1.fromUint8Array(S||new Uint8Array))}(i,a.targetChange.resumeToken),d=(f=a.targetChange.cause)&&function(y){var S=y.code===void 0?Vn.UNKNOWN:rtt(y.code);return new Lo(S,y.message||"")}(f);l=new att(s,c,u,d||null)}else if("documentChange"in a){a.documentChange,(s=a.documentChange).document,s.document.name,s.document.updateTime,c=N6(i,s.document.name),u=lp(s.document.updateTime);var f=new dg({mapValue:{fields:s.document.fields}}),p=(d=Ah.newFoundDocument(c,u,f),s.targetIds||[]),g=s.removedTargetIds||[];l=new g_(p,g,d.key,d)}else if("documentDelete"in a)a.documentDelete,(s=a.documentDelete).document,c=N6(i,s.document),u=s.readTime?lp(s.readTime):La.min(),f=Ah.newNoDocument(c,u),d=s.removedTargetIds||[],l=new g_([],d,f.key,f);else if("documentRemove"in a)a.documentRemove,(s=a.documentRemove).document,c=N6(i,s.document),u=s.removedTargetIds||[],l=new g_([],u,c,null);else{if(!("filter"in a))return ni();a.filter;var A=a.filter;A.targetId,s=A.count||0,c=new qYn(s),u=A.targetId,l=new itt(u,c)}return l}(this.R,n),r=function(i){if(!("targetChange"in i))return La.min();var a=i.targetChange;return a.targetIds&&a.targetIds.length?La.min():a.readTime?lp(a.readTime):La.min()}(n);return this.listener._r(o,r)},e.prototype.mr=function(n){var o={};o.database=Fk(this.R),o.addTarget=function(i,a){var l,s=a.target;return(l=WX(s)?{documents:dtt(i,s)}:{query:ftt(i,s)}).targetId=a.targetId,a.resumeToken.approximateByteSize()>0?l.resumeToken=ltt(i,a.resumeToken):a.snapshotVersion.compareTo(La.min())>0&&(l.readTime=Dk(i,a.snapshotVersion.toTimestamp())),l}(this.R,n);var r=function(i,a){var l=function(s,c){switch(c){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return ni()}}(0,a.purpose);return l==null?null:{"goog-listen-tags":l}}(this.R,n);r&&(o.labels=r),this.cr(o)},e.prototype.yr=function(n){var o={};o.database=Fk(this.R),o.removeTarget=n,this.cr(o)},e}(Ltt),nVn=function(t){function e(n,o,r,i,a){var l=this;return(l=t.call(this,n,"write_stream_connection_backoff","write_stream_idle",o,r,a)||this).R=i,l.gr=!1,l}return Pr(e,t),Object.defineProperty(e.prototype,"pr",{get:function(){return this.gr},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.gr=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.ar=function(){this.gr&&this.Er([])},e.prototype.wr=function(n){return this.Hi.Oi("Write",n)},e.prototype.onMessage=function(n){if(Ui(!!n.streamToken),this.lastStreamToken=n.streamToken,this.gr){this.Zi.reset();var o=function(i,a){return i&&i.length>0?(Ui(a!==void 0),i.map(function(l){return function(s,c){var u=s.updateTime?lp(s.updateTime):lp(c);return u.isEqual(La.min())&&(u=lp(c)),new XYn(u,s.transformResults||[])}(l,a)})):[]}(n.writeResults,n.commitTime),r=lp(n.commitTime);return this.listener.Tr(r,o)}return Ui(!n.writeResults||n.writeResults.length===0),this.gr=!0,this.listener.Ir()},e.prototype.Ar=function(){var n={};n.database=Fk(this.R),this.cr(n)},e.prototype.Er=function(n){var o=this,r={streamToken:this.lastStreamToken,writes:n.map(function(i){return jX(o.R,i)})};this.cr(r)},e}(Ltt),oVn=function(t){function e(n,o,r){var i=this;return(i=t.call(this)||this).credentials=n,i.Hi=o,i.R=r,i.Rr=!1,i}return Pr(e,t),e.prototype.br=function(){if(this.Rr)throw new Lo(Vn.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.Ni=function(n,o,r){var i=this;return this.br(),this.credentials.getToken().then(function(a){return i.Hi.Ni(n,o,r,a)}).catch(function(a){throw a.name==="FirebaseError"?(a.code===Vn.UNAUTHENTICATED&&i.credentials.invalidateToken(),a):new Lo(Vn.UNKNOWN,a.toString())})},e.prototype.$i=function(n,o,r){var i=this;return this.br(),this.credentials.getToken().then(function(a){return i.Hi.$i(n,o,r,a)}).catch(function(a){throw a.name==="FirebaseError"?(a.code===Vn.UNAUTHENTICATED&&i.credentials.invalidateToken(),a):new Lo(Vn.UNKNOWN,a.toString())})},e.prototype.terminate=function(){this.Rr=!0},e}(function(){}),rVn=function(){function t(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.vr=0,this.Pr=null,this.Vr=!0}return t.prototype.Sr=function(){var e=this;this.vr===0&&(this.Dr("Unknown"),this.Pr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return e.Pr=null,e.Cr("Backend didn't respond within 10 seconds."),e.Dr("Offline"),Promise.resolve()}))},t.prototype.Nr=function(e){this.state==="Online"?this.Dr("Unknown"):(this.vr++,this.vr>=1&&(this.kr(),this.Cr("Connection failed 1 times. Most recent error: "+e.toString()),this.Dr("Offline")))},t.prototype.set=function(e){this.kr(),this.vr=0,e==="Online"&&(this.Vr=!1),this.Dr(e)},t.prototype.Dr=function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))},t.prototype.Cr=function(e){var n="Could not reach Cloud Firestore backend. "+e+` + */function LZ(t){return new aOn(t,!0)}var s5e=function(){function t(e,n,o,r,i){o===void 0&&(o=1e3),r===void 0&&(r=1.5),i===void 0&&(i=6e4),this.Se=e,this.timerId=n,this.Mi=o,this.Li=r,this.Bi=i,this.qi=0,this.Ui=null,this.Ki=Date.now(),this.reset()}return t.prototype.reset=function(){this.qi=0},t.prototype.Qi=function(){this.qi=this.Bi},t.prototype.ji=function(e){var n=this;this.cancel();var o=Math.floor(this.qi+this.Wi()),r=Math.max(0,Date.now()-this.Ki),i=Math.max(0,o-r);i>0&&ur("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.qi+" ms, delay with jitter: "+o+" ms, last attempt: "+r+" ms ago)"),this.Ui=this.Se.enqueueAfterDelay(this.timerId,i,function(){return n.Ki=Date.now(),e()}),this.qi*=this.Li,this.qithis.Bi&&(this.qi=this.Bi)},t.prototype.Gi=function(){this.Ui!==null&&(this.Ui.skipDelay(),this.Ui=null)},t.prototype.cancel=function(){this.Ui!==null&&(this.Ui.cancel(),this.Ui=null)},t.prototype.Wi=function(){return(Math.random()-.5)*this.qi},t}(),Ltt=function(){function t(e,n,o,r,i,a){this.Se=e,this.zi=o,this.Hi=r,this.Ji=i,this.listener=a,this.state=0,this.Yi=0,this.Xi=null,this.stream=null,this.Zi=new s5e(e,n)}return t.prototype.tr=function(){return this.state===1||this.state===2||this.state===4},t.prototype.er=function(){return this.state===2},t.prototype.start=function(){this.state!==3?this.auth():this.nr()},t.prototype.stop=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){switch(e.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},t.prototype.sr=function(){this.state=0,this.Zi.reset()},t.prototype.ir=function(){var e=this;this.er()&&this.Xi===null&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return e.rr()}))},t.prototype.cr=function(e){this.ur(),this.stream.send(e)},t.prototype.rr=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){return this.er()?[2,this.close(0)]:[2]})})},t.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},t.prototype.close=function(e,n){return bo(this,void 0,void 0,function(){return vo(this,function(o){switch(o.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,e!==3?this.Zi.reset():n&&n.code===Vn.RESOURCE_EXHAUSTED?(su(n.toString()),su("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Qi()):n&&n.code===Vn.UNAUTHENTICATED&&this.Ji.invalidateToken(),this.stream!==null&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return o.sent(),[2]}})})},t.prototype.ar=function(){},t.prototype.auth=function(){var e=this;this.state=1;var n=this.hr(this.Yi),o=this.Yi;this.Ji.getToken().then(function(r){e.Yi===o&&e.lr(r)},function(r){n(function(){var i=new Lo(Vn.UNKNOWN,"Fetching auth token failed: "+r.message);return e.dr(i)})})},t.prototype.lr=function(e){var n=this,o=this.hr(this.Yi);this.stream=this.wr(e),this.stream.Ii(function(){o(function(){return n.state=2,n.listener.Ii()})}),this.stream.Ri(function(r){o(function(){return n.dr(r)})}),this.stream.onMessage(function(r){o(function(){return n.onMessage(r)})})},t.prototype.nr=function(){var e=this;this.state=4,this.Zi.ji(function(){return bo(e,void 0,void 0,function(){return vo(this,function(n){return this.state=0,this.start(),[2]})})})},t.prototype.dr=function(e){return ur("PersistentStream","close with error: "+e),this.stream=null,this.close(3,e)},t.prototype.hr=function(e){var n=this;return function(o){n.Se.enqueueAndForget(function(){return n.Yi===e?o():(ur("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},t}(),tVn=function(t){function e(n,o,r,i,a){var l=this;return(l=t.call(this,n,"listen_stream_connection_backoff","listen_stream_idle",o,r,a)||this).R=i,l}return Pr(e,t),e.prototype.wr=function(n){return this.Hi.Oi("Listen",n)},e.prototype.onMessage=function(n){this.Zi.reset();var o=function(i,a){var l;if("targetChange"in a){a.targetChange;var s=function(y){return y==="NO_CHANGE"?0:y==="ADD"?1:y==="REMOVE"?2:y==="CURRENT"?3:y==="RESET"?4:ni()}(a.targetChange.targetChangeType||"NO_CHANGE"),c=a.targetChange.targetIds||[],u=function(y,S){return y.I?(Ui(S===void 0||typeof S=="string"),i1.fromBase64String(S||"")):(Ui(S===void 0||S instanceof Uint8Array),i1.fromUint8Array(S||new Uint8Array))}(i,a.targetChange.resumeToken),d=(f=a.targetChange.cause)&&function(y){var S=y.code===void 0?Vn.UNKNOWN:rtt(y.code);return new Lo(S,y.message||"")}(f);l=new att(s,c,u,d||null)}else if("documentChange"in a){a.documentChange,(s=a.documentChange).document,s.document.name,s.document.updateTime,c=N6(i,s.document.name),u=lp(s.document.updateTime);var f=new dg({mapValue:{fields:s.document.fields}}),p=(d=wh.newFoundDocument(c,u,f),s.targetIds||[]),g=s.removedTargetIds||[];l=new g_(p,g,d.key,d)}else if("documentDelete"in a)a.documentDelete,(s=a.documentDelete).document,c=N6(i,s.document),u=s.readTime?lp(s.readTime):La.min(),f=wh.newNoDocument(c,u),d=s.removedTargetIds||[],l=new g_([],d,f.key,f);else if("documentRemove"in a)a.documentRemove,(s=a.documentRemove).document,c=N6(i,s.document),u=s.removedTargetIds||[],l=new g_([],u,c,null);else{if(!("filter"in a))return ni();a.filter;var A=a.filter;A.targetId,s=A.count||0,c=new qYn(s),u=A.targetId,l=new itt(u,c)}return l}(this.R,n),r=function(i){if(!("targetChange"in i))return La.min();var a=i.targetChange;return a.targetIds&&a.targetIds.length?La.min():a.readTime?lp(a.readTime):La.min()}(n);return this.listener._r(o,r)},e.prototype.mr=function(n){var o={};o.database=Fk(this.R),o.addTarget=function(i,a){var l,s=a.target;return(l=WX(s)?{documents:dtt(i,s)}:{query:ftt(i,s)}).targetId=a.targetId,a.resumeToken.approximateByteSize()>0?l.resumeToken=ltt(i,a.resumeToken):a.snapshotVersion.compareTo(La.min())>0&&(l.readTime=Dk(i,a.snapshotVersion.toTimestamp())),l}(this.R,n);var r=function(i,a){var l=function(s,c){switch(c){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return ni()}}(0,a.purpose);return l==null?null:{"goog-listen-tags":l}}(this.R,n);r&&(o.labels=r),this.cr(o)},e.prototype.yr=function(n){var o={};o.database=Fk(this.R),o.removeTarget=n,this.cr(o)},e}(Ltt),nVn=function(t){function e(n,o,r,i,a){var l=this;return(l=t.call(this,n,"write_stream_connection_backoff","write_stream_idle",o,r,a)||this).R=i,l.gr=!1,l}return Pr(e,t),Object.defineProperty(e.prototype,"pr",{get:function(){return this.gr},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.gr=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.ar=function(){this.gr&&this.Er([])},e.prototype.wr=function(n){return this.Hi.Oi("Write",n)},e.prototype.onMessage=function(n){if(Ui(!!n.streamToken),this.lastStreamToken=n.streamToken,this.gr){this.Zi.reset();var o=function(i,a){return i&&i.length>0?(Ui(a!==void 0),i.map(function(l){return function(s,c){var u=s.updateTime?lp(s.updateTime):lp(c);return u.isEqual(La.min())&&(u=lp(c)),new XYn(u,s.transformResults||[])}(l,a)})):[]}(n.writeResults,n.commitTime),r=lp(n.commitTime);return this.listener.Tr(r,o)}return Ui(!n.writeResults||n.writeResults.length===0),this.gr=!0,this.listener.Ir()},e.prototype.Ar=function(){var n={};n.database=Fk(this.R),this.cr(n)},e.prototype.Er=function(n){var o=this,r={streamToken:this.lastStreamToken,writes:n.map(function(i){return jX(o.R,i)})};this.cr(r)},e}(Ltt),oVn=function(t){function e(n,o,r){var i=this;return(i=t.call(this)||this).credentials=n,i.Hi=o,i.R=r,i.Rr=!1,i}return Pr(e,t),e.prototype.br=function(){if(this.Rr)throw new Lo(Vn.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.Ni=function(n,o,r){var i=this;return this.br(),this.credentials.getToken().then(function(a){return i.Hi.Ni(n,o,r,a)}).catch(function(a){throw a.name==="FirebaseError"?(a.code===Vn.UNAUTHENTICATED&&i.credentials.invalidateToken(),a):new Lo(Vn.UNKNOWN,a.toString())})},e.prototype.$i=function(n,o,r){var i=this;return this.br(),this.credentials.getToken().then(function(a){return i.Hi.$i(n,o,r,a)}).catch(function(a){throw a.name==="FirebaseError"?(a.code===Vn.UNAUTHENTICATED&&i.credentials.invalidateToken(),a):new Lo(Vn.UNKNOWN,a.toString())})},e.prototype.terminate=function(){this.Rr=!0},e}(function(){}),rVn=function(){function t(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.vr=0,this.Pr=null,this.Vr=!0}return t.prototype.Sr=function(){var e=this;this.vr===0&&(this.Dr("Unknown"),this.Pr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return e.Pr=null,e.Cr("Backend didn't respond within 10 seconds."),e.Dr("Offline"),Promise.resolve()}))},t.prototype.Nr=function(e){this.state==="Online"?this.Dr("Unknown"):(this.vr++,this.vr>=1&&(this.kr(),this.Cr("Connection failed 1 times. Most recent error: "+e.toString()),this.Dr("Offline")))},t.prototype.set=function(e){this.kr(),this.vr=0,e==="Online"&&(this.Vr=!1),this.Dr(e)},t.prototype.Dr=function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))},t.prototype.Cr=function(e){var n="Could not reach Cloud Firestore backend. "+e+` This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Vr?(su(n),this.Vr=!1):ur("OnlineStateTracker",n)},t.prototype.kr=function(){this.Pr!==null&&(this.Pr.cancel(),this.Pr=null)},t}(),iVn=function(t,e,n,o,r){var i=this;this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.Fr=[],this.$r=new Map,this.Or=new Set,this.Mr=[],this.Lr=r,this.Lr.di(function(a){n.enqueueAndForget(function(){return bo(i,void 0,void 0,function(){return vo(this,function(l){switch(l.label){case 0:return Jw(this)?(ur("RemoteStore","Restarting streams for network reachability change."),[4,function(s){return bo(this,void 0,void 0,function(){var c;return vo(this,function(u){switch(u.label){case 0:return(c=Dr(s)).Or.add(4),[4,cM(c)];case 1:return u.sent(),c.Br.set("Unknown"),c.Or.delete(4),[4,VN(c)];case 2:return u.sent(),[2]}})})}(this)]):[3,2];case 1:l.sent(),l.label=2;case 2:return[2]}})})})}),this.Br=new rVn(n,o)};/** * @license * Copyright 2017 Google LLC @@ -6145,7 +6145,7 @@ This typically indicates that your device does not have a healthy Internet conne * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var Ott=function(t){this.key=t},Vtt=function(t){this.key=t},_tt=function(){function t(e,n){this.query=e,this.uo=n,this.ao=null,this.current=!1,this.ho=Ks(),this.mutatedKeys=Ks(),this.lo=Jet(e),this.fo=new Ytt(this.lo)}return Object.defineProperty(t.prototype,"wo",{get:function(){return this.uo},enumerable:!1,configurable:!0}),t.prototype._o=function(e,n){var o=this,r=n?n.mo:new uCe,i=n?n.fo:this.fo,a=n?n.mutatedKeys:this.mutatedKeys,l=i,s=!1,c=h_(this.query)&&i.size===this.query.limit?i.last():null,u=UX(this.query)&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal(function(f,p){var g=i.get(f),A=jN(o.query,p)?p:null,y=!!g&&o.mutatedKeys.has(g.key),S=!!A&&(A.hasLocalMutations||o.mutatedKeys.has(A.key)&&A.hasCommittedMutations),C=!1;g&&A?g.data.isEqual(A.data)?y!==S&&(r.track({type:3,doc:A}),C=!0):o.yo(g,A)||(r.track({type:2,doc:A}),C=!0,(c&&o.lo(A,c)>0||u&&o.lo(A,u)<0)&&(s=!0)):!g&&A?(r.track({type:0,doc:A}),C=!0):g&&!A&&(r.track({type:1,doc:g}),C=!0,(c||u)&&(s=!0)),C&&(A?(l=l.add(A),a=S?a.add(f):a.delete(f)):(l=l.delete(f),a=a.delete(f)))}),h_(this.query)||UX(this.query))for(;l.size>this.query.limit;){var d=h_(this.query)?l.last():l.first();l=l.delete(d.key),a=a.delete(d.key),r.track({type:1,doc:d})}return{fo:l,mo:r,Nn:s,mutatedKeys:a}},t.prototype.yo=function(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations},t.prototype.applyChanges=function(e,n,o){var r=this,i=this.fo;this.fo=e.fo,this.mutatedKeys=e.mutatedKeys;var a=e.mo.jr();a.sort(function(u,d){return function(f,p){var g=function(A){switch(A){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ni()}};return g(f)-g(p)}(u.type,d.type)||r.lo(u.doc,d.doc)}),this.po(o);var l=n?this.Eo():[],s=this.ho.size===0&&this.current?1:0,c=s!==this.ao;return this.ao=s,a.length!==0||c?{snapshot:new GX(this.query,e.fo,i,a,e.mutatedKeys,s===0,c,!1),To:l}:{To:l}},t.prototype.zr=function(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({fo:this.fo,mo:new uCe,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},t.prototype.Io=function(e){return!this.uo.has(e)&&!!this.fo.has(e)&&!this.fo.get(e).hasLocalMutations},t.prototype.po=function(e){var n=this;e&&(e.addedDocuments.forEach(function(o){return n.uo=n.uo.add(o)}),e.modifiedDocuments.forEach(function(o){}),e.removedDocuments.forEach(function(o){return n.uo=n.uo.delete(o)}),this.current=e.current)},t.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=Ks(),this.fo.forEach(function(r){e.Io(r.key)&&(e.ho=e.ho.add(r.key))});var o=[];return n.forEach(function(r){e.ho.has(r)||o.push(new Vtt(r))}),this.ho.forEach(function(r){n.has(r)||o.push(new Ott(r))}),o},t.prototype.Ao=function(e){this.uo=e.Bn,this.ho=Ks();var n=this._o(e.documents);return this.applyChanges(n,!0)},t.prototype.Ro=function(){return GX.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,this.ao===0)},t}(),AVn=function(t,e,n){this.query=t,this.targetId=e,this.view=n},wVn=function(t){this.key=t,this.bo=!1},vVn=function(){function t(e,n,o,r,i,a){this.localStore=e,this.remoteStore=n,this.eventManager=o,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.vo={},this.Po=new sM(function(l){return Xet(l)},UN),this.Vo=new Map,this.So=new Set,this.Do=new Ph(ci.comparator),this.Co=new Map,this.No=new l5e,this.xo={},this.ko=new Map,this.Fo=YX.Yt(),this.onlineState="Unknown",this.$o=void 0}return Object.defineProperty(t.prototype,"isPrimaryClient",{get:function(){return this.$o===!0},enumerable:!1,configurable:!0}),t}();function xVn(t,e){return bo(this,void 0,void 0,function(){var n,o,r,i,a,l;return vo(this,function(s){switch(s.label){case 0:return n=v5e(t),(i=n.Po.get(e))?(o=i.targetId,n.sharedClientState.addLocalQueryTarget(o),r=i.view.Ro(),[3,4]):[3,1];case 1:return[4,OX(n.localStore,G9(e))];case 2:return a=s.sent(),l=n.sharedClientState.addLocalQueryTarget(a.targetId),o=a.targetId,[4,m5e(n,e,o,l==="current")];case 3:r=s.sent(),n.isPrimaryClient&&WZ(n.remoteStore,a),s.label=4;case 4:return[2,r]}})})}function m5e(t,e,n,o){return bo(this,void 0,void 0,function(){var r,i,a,l,s,c;return vo(this,function(u){switch(u.label){case 0:return t.Oo=function(d,f,p){return function(g,A,y,S){return bo(this,void 0,void 0,function(){var C,P,v;return vo(this,function(T){switch(T.label){case 0:return C=A.view._o(y),C.Nn?[4,VX(g.localStore,A.query,!1).then(function(w){var x=w.documents;return A.view._o(x,C)})]:[3,2];case 1:C=T.sent(),T.label=2;case 2:return P=S&&S.targetChanges.get(A.targetId),v=A.view.applyChanges(C,g.isPrimaryClient,P),[2,($de(g,A.targetId,v.To),v.snapshot)]}})})}(t,d,f,p)},[4,VX(t.localStore,e,!0)];case 1:return r=u.sent(),i=new _tt(e,r.Bn),a=i._o(r.documents),l=e5e.createSynthesizedTargetChangeForCurrentChange(n,o&&t.onlineState!=="Offline"),s=i.applyChanges(a,t.isPrimaryClient,l),$de(t,n,s.To),c=new AVn(e,n,i),[2,(t.Po.set(e,c),t.Vo.has(n)?t.Vo.get(n).push(e):t.Vo.set(n,[e]),s.snapshot)]}})})}function bVn(t,e){return bo(this,void 0,void 0,function(){var n,o,r;return vo(this,function(i){switch(i.label){case 0:return n=Dr(t),o=n.Po.get(e),(r=n.Vo.get(o.targetId)).length>1?[2,(n.Vo.set(o.targetId,r.filter(function(a){return!UN(a,e)})),void n.Po.delete(e))]:n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(o.targetId),n.sharedClientState.isActiveQueryTarget(o.targetId)?[3,2]:[4,GR(n.localStore,o.targetId,!1).then(function(){n.sharedClientState.clearQueryState(o.targetId),kk(n.remoteStore,o.targetId),XR(n,o.targetId)}).catch(Zb)]):[3,3];case 1:i.sent(),i.label=2;case 2:return[3,5];case 3:return XR(n,o.targetId),[4,GR(n.localStore,o.targetId,!0)];case 4:i.sent(),i.label=5;case 5:return[2]}})})}function SVn(t,e,n){return bo(this,void 0,void 0,function(){var o,r,i,a;return vo(this,function(l){switch(l.label){case 0:o=x5e(t),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,function(s,c){var u,d=Dr(s),f=Zp.now(),p=c.reduce(function(g,A){return g.add(A.key)},Ks());return d.persistence.runTransaction("Locally write mutations","readwrite",function(g){return d.Mn.pn(g,p).next(function(A){u=A;for(var y=[],S=0,C=c;S0?l.bo=!0:i.modifiedDocuments.size>0?Ui(l.bo):i.removedDocuments.size>0&&(Ui(l.bo),l.bo=!1))}),[4,Kw(n,o,e)];case 3:return r.sent(),[3,6];case 4:return[4,Zb(r.sent())];case 5:return r.sent(),[3,6];case 6:return[2]}})})}function dCe(t,e,n){var o=Dr(t);if(o.isPrimaryClient&&n===0||!o.isPrimaryClient&&n===1){var r=[];o.Po.forEach(function(i,a){var l=a.view.zr(e);l.snapshot&&r.push(l.snapshot)}),function(i,a){var l=Dr(i);l.onlineState=a;var s=!1;l.queries.forEach(function(c,u){for(var d=0,f=u.listeners;d0&&t.Do.size0||u&&o.lo(A,u)<0)&&(s=!0)):!g&&A?(r.track({type:0,doc:A}),C=!0):g&&!A&&(r.track({type:1,doc:g}),C=!0,(c||u)&&(s=!0)),C&&(A?(l=l.add(A),a=S?a.add(f):a.delete(f)):(l=l.delete(f),a=a.delete(f)))}),h_(this.query)||UX(this.query))for(;l.size>this.query.limit;){var d=h_(this.query)?l.last():l.first();l=l.delete(d.key),a=a.delete(d.key),r.track({type:1,doc:d})}return{fo:l,mo:r,Nn:s,mutatedKeys:a}},t.prototype.yo=function(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations},t.prototype.applyChanges=function(e,n,o){var r=this,i=this.fo;this.fo=e.fo,this.mutatedKeys=e.mutatedKeys;var a=e.mo.jr();a.sort(function(u,d){return function(f,p){var g=function(A){switch(A){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ni()}};return g(f)-g(p)}(u.type,d.type)||r.lo(u.doc,d.doc)}),this.po(o);var l=n?this.Eo():[],s=this.ho.size===0&&this.current?1:0,c=s!==this.ao;return this.ao=s,a.length!==0||c?{snapshot:new GX(this.query,e.fo,i,a,e.mutatedKeys,s===0,c,!1),To:l}:{To:l}},t.prototype.zr=function(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({fo:this.fo,mo:new uCe,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},t.prototype.Io=function(e){return!this.uo.has(e)&&!!this.fo.has(e)&&!this.fo.get(e).hasLocalMutations},t.prototype.po=function(e){var n=this;e&&(e.addedDocuments.forEach(function(o){return n.uo=n.uo.add(o)}),e.modifiedDocuments.forEach(function(o){}),e.removedDocuments.forEach(function(o){return n.uo=n.uo.delete(o)}),this.current=e.current)},t.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=Ks(),this.fo.forEach(function(r){e.Io(r.key)&&(e.ho=e.ho.add(r.key))});var o=[];return n.forEach(function(r){e.ho.has(r)||o.push(new Vtt(r))}),this.ho.forEach(function(r){n.has(r)||o.push(new Ott(r))}),o},t.prototype.Ao=function(e){this.uo=e.Bn,this.ho=Ks();var n=this._o(e.documents);return this.applyChanges(n,!0)},t.prototype.Ro=function(){return GX.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,this.ao===0)},t}(),AVn=function(t,e,n){this.query=t,this.targetId=e,this.view=n},wVn=function(t){this.key=t,this.bo=!1},vVn=function(){function t(e,n,o,r,i,a){this.localStore=e,this.remoteStore=n,this.eventManager=o,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.vo={},this.Po=new sM(function(l){return Xet(l)},UN),this.Vo=new Map,this.So=new Set,this.Do=new Ph(ci.comparator),this.Co=new Map,this.No=new l5e,this.xo={},this.ko=new Map,this.Fo=YX.Yt(),this.onlineState="Unknown",this.$o=void 0}return Object.defineProperty(t.prototype,"isPrimaryClient",{get:function(){return this.$o===!0},enumerable:!1,configurable:!0}),t}();function xVn(t,e){return bo(this,void 0,void 0,function(){var n,o,r,i,a,l;return vo(this,function(s){switch(s.label){case 0:return n=v5e(t),(i=n.Po.get(e))?(o=i.targetId,n.sharedClientState.addLocalQueryTarget(o),r=i.view.Ro(),[3,4]):[3,1];case 1:return[4,OX(n.localStore,G9(e))];case 2:return a=s.sent(),l=n.sharedClientState.addLocalQueryTarget(a.targetId),o=a.targetId,[4,m5e(n,e,o,l==="current")];case 3:r=s.sent(),n.isPrimaryClient&&WZ(n.remoteStore,a),s.label=4;case 4:return[2,r]}})})}function m5e(t,e,n,o){return bo(this,void 0,void 0,function(){var r,i,a,l,s,c;return vo(this,function(u){switch(u.label){case 0:return t.Oo=function(d,f,p){return function(g,A,y,S){return bo(this,void 0,void 0,function(){var C,P,v;return vo(this,function(T){switch(T.label){case 0:return C=A.view._o(y),C.Nn?[4,VX(g.localStore,A.query,!1).then(function(w){var x=w.documents;return A.view._o(x,C)})]:[3,2];case 1:C=T.sent(),T.label=2;case 2:return P=S&&S.targetChanges.get(A.targetId),v=A.view.applyChanges(C,g.isPrimaryClient,P),[2,($de(g,A.targetId,v.To),v.snapshot)]}})})}(t,d,f,p)},[4,VX(t.localStore,e,!0)];case 1:return r=u.sent(),i=new _tt(e,r.Bn),a=i._o(r.documents),l=e5e.createSynthesizedTargetChangeForCurrentChange(n,o&&t.onlineState!=="Offline"),s=i.applyChanges(a,t.isPrimaryClient,l),$de(t,n,s.To),c=new AVn(e,n,i),[2,(t.Po.set(e,c),t.Vo.has(n)?t.Vo.get(n).push(e):t.Vo.set(n,[e]),s.snapshot)]}})})}function bVn(t,e){return bo(this,void 0,void 0,function(){var n,o,r;return vo(this,function(i){switch(i.label){case 0:return n=Dr(t),o=n.Po.get(e),(r=n.Vo.get(o.targetId)).length>1?[2,(n.Vo.set(o.targetId,r.filter(function(a){return!UN(a,e)})),void n.Po.delete(e))]:n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(o.targetId),n.sharedClientState.isActiveQueryTarget(o.targetId)?[3,2]:[4,GR(n.localStore,o.targetId,!1).then(function(){n.sharedClientState.clearQueryState(o.targetId),kk(n.remoteStore,o.targetId),XR(n,o.targetId)}).catch(Zb)]):[3,3];case 1:i.sent(),i.label=2;case 2:return[3,5];case 3:return XR(n,o.targetId),[4,GR(n.localStore,o.targetId,!0)];case 4:i.sent(),i.label=5;case 5:return[2]}})})}function SVn(t,e,n){return bo(this,void 0,void 0,function(){var o,r,i,a;return vo(this,function(l){switch(l.label){case 0:o=x5e(t),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,function(s,c){var u,d=Dr(s),f=Zp.now(),p=c.reduce(function(g,A){return g.add(A.key)},Ks());return d.persistence.runTransaction("Locally write mutations","readwrite",function(g){return d.Mn.pn(g,p).next(function(A){u=A;for(var y=[],S=0,C=c;S0?l.bo=!0:i.modifiedDocuments.size>0?Ui(l.bo):i.removedDocuments.size>0&&(Ui(l.bo),l.bo=!1))}),[4,Kw(n,o,e)];case 3:return r.sent(),[3,6];case 4:return[4,Zb(r.sent())];case 5:return r.sent(),[3,6];case 6:return[2]}})})}function dCe(t,e,n){var o=Dr(t);if(o.isPrimaryClient&&n===0||!o.isPrimaryClient&&n===1){var r=[];o.Po.forEach(function(i,a){var l=a.view.zr(e);l.snapshot&&r.push(l.snapshot)}),function(i,a){var l=Dr(i);l.onlineState=a;var s=!1;l.queries.forEach(function(c,u){for(var d=0,f=u.listeners;d0&&t.Do.size0)throw new Lo(Vn.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(i,a){return bo(this,void 0,void 0,function(){var l,s,c,u,d,f;return vo(this,function(p){switch(p.label){case 0:return l=Dr(i),s=Fk(l.R)+"/documents",c={documents:a.map(function(g){return Ek(l.R,g)})},[4,l.$i("BatchGetDocuments",s,c)];case 1:return u=p.sent(),d=new Map,u.forEach(function(g){var A=function(y,S){return"found"in S?function(C,P){Ui(!!P.found),P.found.name,P.found.updateTime;var v=N6(C,P.found.name),T=lp(P.found.updateTime),w=new dg({mapValue:{fields:P.found.fields}});return Ah.newFoundDocument(v,T,w)}(y,S):"missing"in S?function(C,P){Ui(!!P.missing),Ui(!!P.readTime);var v=N6(C,P.missing),T=lp(P.readTime);return Ah.newNoDocument(v,T)}(y,S):ni()}(l.R,g);d.set(A.key.toString(),A)}),f=[],[2,(a.forEach(function(g){var A=d.get(g.toString());Ui(!!A),f.push(A)}),f)]}})})}(this.datastore,e)];case 1:return[2,((n=r.sent()).forEach(function(i){return o.recordVersion(i)}),n)]}})})},t.prototype.set=function(e,n){this.write(n.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())},t.prototype.update=function(e,n){try{this.write(n.toMutation(e,this.preconditionForUpdate(e)))}catch(o){this.lastWriteError=o}this.writtenDocs.add(e.toString())},t.prototype.delete=function(e){this.write(new ON(e,this.precondition(e))),this.writtenDocs.add(e.toString())},t.prototype.commit=function(){return bo(this,void 0,void 0,function(){var e,n=this;return vo(this,function(o){switch(o.label){case 0:if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;return e=this.readVersions,this.mutations.forEach(function(r){e.delete(r.key.toString())}),e.forEach(function(r,i){var a=ci.fromPath(i);n.mutations.push(new Q2e(a,n.precondition(a)))}),[4,function(r,i){return bo(this,void 0,void 0,function(){var a,l,s;return vo(this,function(c){switch(c.label){case 0:return a=Dr(r),l=Fk(a.R)+"/documents",s={writes:i.map(function(u){return jX(a.R,u)})},[4,a.Ni("Commit",l,s)];case 1:return c.sent(),[2]}})})}(this.datastore,this.mutations)];case 1:return o.sent(),this.committed=!0,[2]}})})},t.prototype.recordVersion=function(e){var n;if(e.isFoundDocument())n=e.version;else{if(!e.isNoDocument())throw ni();n=La.min()}var o=this.readVersions.get(e.key.toString());if(o){if(!n.isEqual(o))throw new Lo(Vn.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),n)},t.prototype.precondition=function(e){var n=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&n?fh.updateTime(n):fh.none()},t.prototype.preconditionForUpdate=function(e){var n=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&n){if(n.isEqual(La.min()))throw new Lo(Vn.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return fh.updateTime(n)}return fh.exists(!0)},t.prototype.write=function(e){this.ensureCommitNotCalled(),this.mutations.push(e)},t.prototype.ensureCommitNotCalled=function(){},t}(),jVn=function(){function t(e,n,o,r){this.asyncQueue=e,this.datastore=n,this.updateFunction=o,this.deferred=r,this.ec=5,this.Zi=new s5e(this.asyncQueue,"transaction_retry")}return t.prototype.run=function(){this.ec-=1,this.nc()},t.prototype.nc=function(){var e=this;this.Zi.ji(function(){return bo(e,void 0,void 0,function(){var n,o,r=this;return vo(this,function(i){return n=new UVn(this.datastore),(o=this.sc(n))&&o.then(function(a){r.asyncQueue.enqueueAndForget(function(){return n.commit().then(function(){r.deferred.resolve(a)}).catch(function(l){r.ic(l)})})}).catch(function(a){r.ic(a)}),[2]})})})},t.prototype.sc=function(e){try{var n=this.updateFunction(e);return!$b(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(o){return this.deferred.reject(o),null}},t.prototype.ic=function(e){var n=this;this.ec>0&&this.rc(e)?(this.ec-=1,this.asyncQueue.enqueueAndForget(function(){return n.nc(),Promise.resolve()})):this.deferred.reject(e)},t.prototype.rc=function(e){if(e.name==="FirebaseError"){var n=e.code;return n==="aborted"||n==="failed-precondition"||!ott(n)}return!1},t}(),BVn=function(){function t(e,n,o){var r=this;this.credentials=e,this.asyncQueue=n,this.databaseInfo=o,this.user=lf.UNAUTHENTICATED,this.clientId=Wet.u(),this.credentialListener=function(){return Promise.resolve()},this.credentials.setChangeListener(n,function(i){return bo(r,void 0,void 0,function(){return vo(this,function(a){switch(a.label){case 0:return ur("FirestoreClient","Received user=",i.uid),[4,this.credentialListener(i)];case 1:return a.sent(),this.user=i,[2]}})})})}return t.prototype.getConfiguration=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){return[2,{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100}]})})},t.prototype.setCredentialChangeListener=function(e){this.credentialListener=e},t.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new Lo(Vn.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.terminate=function(){var e=this;this.asyncQueue.enterRestrictedMode();var n=new a1;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function(){return bo(e,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,6]),this.onlineComponents?[4,this.onlineComponents.terminate()]:[3,2];case 1:i.sent(),i.label=2;case 2:return this.offlineComponents?[4,this.offlineComponents.terminate()]:[3,4];case 3:i.sent(),i.label=4;case 4:return this.credentials.removeChangeListener(),n.resolve(),[3,6];case 5:return o=i.sent(),r=fM(o,"Failed to shutdown persistence"),n.reject(r),[3,6];case 6:return[2]}})})}),n.promise},t}();/** + */var NZ=function(){function t(e){this.observer=e,this.muted=!1}return t.prototype.next=function(e){this.observer.next&&this.jo(this.observer.next,e)},t.prototype.error=function(e){this.observer.error?this.jo(this.observer.error,e):console.error("Uncaught Error in snapshot listener:",e)},t.prototype.Wo=function(){this.muted=!0},t.prototype.jo=function(e,n){var o=this;this.muted||setTimeout(function(){o.muted||e(n)},0)},t}(),UVn=function(){function t(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}return t.prototype.lookup=function(e){return bo(this,void 0,void 0,function(){var n,o=this;return vo(this,function(r){switch(r.label){case 0:if(this.ensureCommitNotCalled(),this.mutations.length>0)throw new Lo(Vn.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(i,a){return bo(this,void 0,void 0,function(){var l,s,c,u,d,f;return vo(this,function(p){switch(p.label){case 0:return l=Dr(i),s=Fk(l.R)+"/documents",c={documents:a.map(function(g){return Ek(l.R,g)})},[4,l.$i("BatchGetDocuments",s,c)];case 1:return u=p.sent(),d=new Map,u.forEach(function(g){var A=function(y,S){return"found"in S?function(C,P){Ui(!!P.found),P.found.name,P.found.updateTime;var v=N6(C,P.found.name),T=lp(P.found.updateTime),w=new dg({mapValue:{fields:P.found.fields}});return wh.newFoundDocument(v,T,w)}(y,S):"missing"in S?function(C,P){Ui(!!P.missing),Ui(!!P.readTime);var v=N6(C,P.missing),T=lp(P.readTime);return wh.newNoDocument(v,T)}(y,S):ni()}(l.R,g);d.set(A.key.toString(),A)}),f=[],[2,(a.forEach(function(g){var A=d.get(g.toString());Ui(!!A),f.push(A)}),f)]}})})}(this.datastore,e)];case 1:return[2,((n=r.sent()).forEach(function(i){return o.recordVersion(i)}),n)]}})})},t.prototype.set=function(e,n){this.write(n.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())},t.prototype.update=function(e,n){try{this.write(n.toMutation(e,this.preconditionForUpdate(e)))}catch(o){this.lastWriteError=o}this.writtenDocs.add(e.toString())},t.prototype.delete=function(e){this.write(new ON(e,this.precondition(e))),this.writtenDocs.add(e.toString())},t.prototype.commit=function(){return bo(this,void 0,void 0,function(){var e,n=this;return vo(this,function(o){switch(o.label){case 0:if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;return e=this.readVersions,this.mutations.forEach(function(r){e.delete(r.key.toString())}),e.forEach(function(r,i){var a=ci.fromPath(i);n.mutations.push(new Q2e(a,n.precondition(a)))}),[4,function(r,i){return bo(this,void 0,void 0,function(){var a,l,s;return vo(this,function(c){switch(c.label){case 0:return a=Dr(r),l=Fk(a.R)+"/documents",s={writes:i.map(function(u){return jX(a.R,u)})},[4,a.Ni("Commit",l,s)];case 1:return c.sent(),[2]}})})}(this.datastore,this.mutations)];case 1:return o.sent(),this.committed=!0,[2]}})})},t.prototype.recordVersion=function(e){var n;if(e.isFoundDocument())n=e.version;else{if(!e.isNoDocument())throw ni();n=La.min()}var o=this.readVersions.get(e.key.toString());if(o){if(!n.isEqual(o))throw new Lo(Vn.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),n)},t.prototype.precondition=function(e){var n=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&n?hh.updateTime(n):hh.none()},t.prototype.preconditionForUpdate=function(e){var n=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&n){if(n.isEqual(La.min()))throw new Lo(Vn.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return hh.updateTime(n)}return hh.exists(!0)},t.prototype.write=function(e){this.ensureCommitNotCalled(),this.mutations.push(e)},t.prototype.ensureCommitNotCalled=function(){},t}(),jVn=function(){function t(e,n,o,r){this.asyncQueue=e,this.datastore=n,this.updateFunction=o,this.deferred=r,this.ec=5,this.Zi=new s5e(this.asyncQueue,"transaction_retry")}return t.prototype.run=function(){this.ec-=1,this.nc()},t.prototype.nc=function(){var e=this;this.Zi.ji(function(){return bo(e,void 0,void 0,function(){var n,o,r=this;return vo(this,function(i){return n=new UVn(this.datastore),(o=this.sc(n))&&o.then(function(a){r.asyncQueue.enqueueAndForget(function(){return n.commit().then(function(){r.deferred.resolve(a)}).catch(function(l){r.ic(l)})})}).catch(function(a){r.ic(a)}),[2]})})})},t.prototype.sc=function(e){try{var n=this.updateFunction(e);return!$b(n)&&n.catch&&n.then?n:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(o){return this.deferred.reject(o),null}},t.prototype.ic=function(e){var n=this;this.ec>0&&this.rc(e)?(this.ec-=1,this.asyncQueue.enqueueAndForget(function(){return n.nc(),Promise.resolve()})):this.deferred.reject(e)},t.prototype.rc=function(e){if(e.name==="FirebaseError"){var n=e.code;return n==="aborted"||n==="failed-precondition"||!ott(n)}return!1},t}(),BVn=function(){function t(e,n,o){var r=this;this.credentials=e,this.asyncQueue=n,this.databaseInfo=o,this.user=lf.UNAUTHENTICATED,this.clientId=Wet.u(),this.credentialListener=function(){return Promise.resolve()},this.credentials.setChangeListener(n,function(i){return bo(r,void 0,void 0,function(){return vo(this,function(a){switch(a.label){case 0:return ur("FirestoreClient","Received user=",i.uid),[4,this.credentialListener(i)];case 1:return a.sent(),this.user=i,[2]}})})})}return t.prototype.getConfiguration=function(){return bo(this,void 0,void 0,function(){return vo(this,function(e){return[2,{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100}]})})},t.prototype.setCredentialChangeListener=function(e){this.credentialListener=e},t.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new Lo(Vn.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.terminate=function(){var e=this;this.asyncQueue.enterRestrictedMode();var n=new a1;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function(){return bo(e,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return i.trys.push([0,5,,6]),this.onlineComponents?[4,this.onlineComponents.terminate()]:[3,2];case 1:i.sent(),i.label=2;case 2:return this.offlineComponents?[4,this.offlineComponents.terminate()]:[3,4];case 3:i.sent(),i.label=4;case 4:return this.credentials.removeChangeListener(),n.resolve(),[3,6];case 5:return o=i.sent(),r=fM(o,"Failed to shutdown persistence"),n.reject(r),[3,6];case 6:return[2]}})})}),n.promise},t}();/** * @license * Copyright 2020 Google LLC * @@ -6251,7 +6251,7 @@ This typically indicates that your device does not have a healthy Internet conne * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function sh(t){return t._firestoreClient||ant(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function ant(t){var e,n=t._freezeSettings(),o=function(r,i,a,l){return new YVn(r,i,a,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,l.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new BVn(t._credentials,t._queue,o)}function SCe(t,e,n){var o=this,r=new a1;return t.asyncQueue.enqueue(function(){return bo(o,void 0,void 0,function(){var i;return vo(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,$tt(t,n)];case 1:return a.sent(),[4,Qtt(t,e)];case 2:return a.sent(),r.resolve(),[3,4];case 3:if(!function(l){return l.name==="FirebaseError"?l.code===Vn.FAILED_PRECONDITION||l.code===Vn.UNIMPLEMENTED:!(typeof DOMException<"u"&&l instanceof DOMException)||l.code===22||l.code===20||l.code===11}(i=a.sent()))throw i;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+i),r.reject(i),[3,4];case 4:return[2]}})})}).then(function(){return r.promise})}function TCe(t){if(t._initialized||t._terminated)throw new Lo(Vn.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}/** + */function ch(t){return t._firestoreClient||ant(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function ant(t){var e,n=t._freezeSettings(),o=function(r,i,a,l){return new YVn(r,i,a,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,l.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new BVn(t._credentials,t._queue,o)}function SCe(t,e,n){var o=this,r=new a1;return t.asyncQueue.enqueue(function(){return bo(o,void 0,void 0,function(){var i;return vo(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,$tt(t,n)];case 1:return a.sent(),[4,Qtt(t,e)];case 2:return a.sent(),r.resolve(),[3,4];case 3:if(!function(l){return l.name==="FirebaseError"?l.code===Vn.FAILED_PRECONDITION||l.code===Vn.UNIMPLEMENTED:!(typeof DOMException<"u"&&l instanceof DOMException)||l.code===22||l.code===20||l.code===11}(i=a.sent()))throw i;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+i),r.reject(i),[3,4];case 4:return[2]}})})}).then(function(){return r.promise})}function TCe(t){if(t._initialized||t._terminated)throw new Lo(Vn.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}/** * @license * Copyright 2020 Google LLC * @@ -6356,7 +6356,7 @@ This typically indicates that your device does not have a healthy Internet conne * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */function OZ(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var l_n=function(t){function e(n){var o=this;return(o=t.call(this)||this).firestore=n,o}return Pr(e,t),e.prototype.convertBytes=function(n){return new fb(n)},e.prototype.convertReference=function(n){var o=this.convertDocumentKey(n,this.firestore._databaseId);return new e0(this.firestore,null,o)},e}(I5e),s_n=function(){function t(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=tS(e)}return t.prototype.set=function(e,n,o){this._verifyNotCommitted();var r=u8(e,this._firestore),i=OZ(r.converter,n,o),a=YZ(this._dataReader,"WriteBatch.set",r._key,i,r.converter!==null,o);return this._mutations.push(a.toMutation(r._key,fh.none())),this},t.prototype.update=function(e,n,o){for(var r=[],i=3;i0?this._commitHandler(this._mutations):Promise.resolve()},t.prototype._verifyNotCommitted=function(){if(this._committed)throw new Lo(Vn.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}();/** + */function OZ(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var l_n=function(t){function e(n){var o=this;return(o=t.call(this)||this).firestore=n,o}return Pr(e,t),e.prototype.convertBytes=function(n){return new fb(n)},e.prototype.convertReference=function(n){var o=this.convertDocumentKey(n,this.firestore._databaseId);return new e0(this.firestore,null,o)},e}(I5e),s_n=function(){function t(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=tS(e)}return t.prototype.set=function(e,n,o){this._verifyNotCommitted();var r=u8(e,this._firestore),i=OZ(r.converter,n,o),a=YZ(this._dataReader,"WriteBatch.set",r._key,i,r.converter!==null,o);return this._mutations.push(a.toMutation(r._key,hh.none())),this},t.prototype.update=function(e,n,o){for(var r=[],i=3;i0?this._commitHandler(this._mutations):Promise.resolve()},t.prototype._verifyNotCommitted=function(){if(this._committed)throw new Lo(Vn.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}();/** * @license * Copyright 2020 Google LLC * @@ -6386,7 +6386,7 @@ This typically indicates that your device does not have a healthy Internet conne * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var Mx=function(t){function e(n){var o=this;return(o=t.call(this)||this).firestore=n,o}return Pr(e,t),e.prototype.convertBytes=function(n){return new fb(n)},e.prototype.convertReference=function(n){var o=this.convertDocumentKey(n,this.firestore._databaseId);return new e0(this.firestore,null,o)},e}(I5e);function ICe(t,e,n){t=os(t,e0);var o=os(t.firestore,Wu),r=OZ(t.converter,e,n);return GN(o,[YZ(tS(o),"setDoc",t._key,r,t.converter!==null,n).toMutation(t._key,fh.none())])}function zCe(t,e,n){for(var o=[],r=3;r"u")throw new Lo(Vn.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function ECe(){if(typeof atob>"u")throw new Lo(Vn.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var vnt=function(){function t(e){this._delegate=e}return t.fromBase64String=function(e){return ECe(),new t(fb.fromBase64String(e))},t.fromUint8Array=function(e){return DCe(),new t(fb.fromUint8Array(e))},t.prototype.toBase64=function(){return ECe(),this._delegate.toBase64()},t.prototype.toUint8Array=function(){return DCe(),this._delegate.toUint8Array()},t.prototype.isEqual=function(e){return this._delegate.isEqual(e._delegate)},t.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},t}(),u_n=function(){function t(){}return t.prototype.enableIndexedDbPersistence=function(e,n){return function(o,r){TCe(o=os(o,Wu));var i=sh(o),a=o._freezeSettings(),l=new Qde;return SCe(i,l,new qtt(l,a.cacheSizeBytes,r==null?void 0:r.forceOwnership))}(e._delegate,{forceOwnership:n})},t.prototype.enableMultiTabIndexedDbPersistence=function(e){return function(n){TCe(n=os(n,Wu));var o=sh(n),r=n._freezeSettings(),i=new Qde;return SCe(o,i,new NVn(i,r.cacheSizeBytes))}(e._delegate)},t.prototype.clearIndexedDbPersistence=function(e){return function(n){var o=this;if(n._initialized&&!n._terminated)throw new Lo(Vn.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var r=new a1;return n._queue.enqueueAndForgetEvenWhileRestricted(function(){return bo(o,void 0,void 0,function(){var i;return vo(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,function(l){return bo(this,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return OR.yt()?(s=l+"main",[4,OR.delete(s)]):[2,Promise.resolve()];case 1:return c.sent(),[2]}})})}(a5e(n._databaseId,n._persistenceKey))];case 1:return a.sent(),r.resolve(),[3,3];case 2:return i=a.sent(),r.reject(i),[3,3];case 3:return[2]}})})}),r.promise}(e._delegate)},t}(),xnt=function(){function t(e,n,o){var r=this;this._delegate=n,this.Zc=o,this.INTERNAL={delete:function(){return r.terminate()}},e instanceof XX||(this.tu=e)}return Object.defineProperty(t.prototype,"_databaseId",{get:function(){return this._delegate._databaseId},enumerable:!1,configurable:!0}),t.prototype.settings=function(e){var n=this._delegate._getSettings();e.merge||n.host===e.host||FX("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),e.merge&&delete(e=Object.assign(Object.assign({},n),e)).merge,this._delegate._setSettings(e)},t.prototype.useEmulator=function(e,n,o){o===void 0&&(o={}),function(r,i,a,l){var s;l===void 0&&(l={});var c=(r=os(r,Lk))._getSettings();if(c.host!=="firestore.googleapis.com"&&c.host!==i&&FX("Host has been set in both settings() and useEmulator(), emulator host will be used"),r._setSettings(Object.assign(Object.assign({},c),{host:i+":"+a,ssl:!1})),l.mockUserToken){var u,d;if(typeof l.mockUserToken=="string")u=l.mockUserToken,d=lf.MOCK_USER;else{u=m2e(l.mockUserToken,(s=r._app)===null||s===void 0?void 0:s.options.projectId);var f=l.mockUserToken.sub||l.mockUserToken.user_id;if(!f)throw new Lo(Vn.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new lf(f)}r._credentials=new OVn(new tnt(u,d))}}(this._delegate,e,n,o)},t.prototype.enableNetwork=function(){return function(e){var n=this;return e.asyncQueue.enqueue(function(){return bo(n,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return[4,hCe(e)];case 1:return o=i.sent(),[4,pCe(e)];case 2:return r=i.sent(),[2,(o.setNetworkEnabled(!0),function(a){var l=Dr(a);return l.Or.delete(0),VN(l)}(r))]}})})})}(sh(os(this._delegate,Wu)))},t.prototype.disableNetwork=function(){return function(e){var n=this;return e.asyncQueue.enqueue(function(){return bo(n,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return[4,hCe(e)];case 1:return o=i.sent(),[4,pCe(e)];case 2:return r=i.sent(),[2,(o.setNetworkEnabled(!1),function(a){return bo(this,void 0,void 0,function(){var l;return vo(this,function(s){switch(s.label){case 0:return(l=Dr(a)).Or.add(0),[4,cM(l)];case 1:return s.sent(),l.Br.set("Offline"),[2]}})})}(r))]}})})})}(sh(os(this._delegate,Wu)))},t.prototype.enablePersistence=function(e){var n=!1,o=!1;return e&&nnt("synchronizeTabs",n=!!e.synchronizeTabs,"experimentalForceOwningTab",o=!!e.experimentalForceOwningTab),n?this.Zc.enableMultiTabIndexedDbPersistence(this):this.Zc.enableIndexedDbPersistence(this,o)},t.prototype.clearPersistence=function(){return this.Zc.clearIndexedDbPersistence(this)},t.prototype.terminate=function(){return this.tu&&(this.tu._removeServiceInstance("firestore"),this.tu._removeServiceInstance("firestore-exp")),this._delegate._delete()},t.prototype.waitForPendingWrites=function(){return function(e){var n=this,o=new a1;return e.asyncQueue.enqueueAndForget(function(){return bo(n,void 0,void 0,function(){var r;return vo(this,function(i){switch(i.label){case 0:return r=RVn,[4,ent(e)];case 1:return[2,r.apply(void 0,[i.sent(),o])]}})})}),o.promise}(sh(os(this._delegate,Wu)))},t.prototype.onSnapshotsInSync=function(e){return function(n,o){return function(r,i){var a=this,l=new NZ(i);return r.asyncQueue.enqueueAndForget(function(){return bo(a,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return s=function(u,d){Dr(u).Gr.add(d),d.next()},[4,JR(r)];case 1:return[2,s.apply(void 0,[c.sent(),l])]}})})}),function(){l.Wo(),r.asyncQueue.enqueueAndForget(function(){return bo(a,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return s=function(u,d){Dr(u).Gr.delete(d)},[4,JR(r)];case 1:return[2,s.apply(void 0,[c.sent(),l])]}})})})}}(sh(n=os(n,Wu)),KR(o)?o:{next:o})}(this._delegate,e)},Object.defineProperty(t.prototype,"app",{get:function(){if(!this.tu)throw new Lo(Vn.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.tu},enumerable:!1,configurable:!0}),t.prototype.collection=function(e){try{return new qX(this,ont(this._delegate,e))}catch(n){throw qh(n,"collection()","Firestore.collection()")}},t.prototype.doc=function(e){try{return new Ix(this,y_(this._delegate,e))}catch(n){throw qh(n,"doc()","Firestore.doc()")}},t.prototype.collectionGroup=function(e){try{return new GZ(this,function(n,o){if(n=os(n,Lk),S5e("collectionGroup","collection id",o),o.indexOf("/")>=0)throw new Lo(Vn.INVALID_ARGUMENT,"Invalid collection ID '"+o+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new Pg(n,null,function(r){return new SA(_l.emptyPath(),r)}(o))}(this._delegate,e))}catch(n){throw qh(n,"collectionGroup()","Firestore.collectionGroup()")}},t.prototype.runTransaction=function(e){var n=this;return function(o,r){return function(i,a){var l=this,s=new a1;return i.asyncQueue.enqueueAndForget(function(){return bo(l,void 0,void 0,function(){var c;return vo(this,function(u){switch(u.label){case 0:return[4,function(d){return UZ(d).then(function(f){return f.datastore})}(i)];case 1:return c=u.sent(),new jVn(i.asyncQueue,c,a,s).run(),[2]}})})}),s.promise}(sh(o),function(i){return r(new c_n(o,i))})}(this._delegate,function(o){return e(new bnt(n,o))})},t.prototype.batch=function(){var e=this;return sh(this._delegate),new Snt(new s_n(this._delegate,function(n){return GN(e._delegate,n)}))},t.prototype.loadBundle=function(e){throw new Lo(Vn.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},t.prototype.namedQuery=function(e){throw new Lo(Vn.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},t}(),VZ=function(t){function e(n){var o=this;return(o=t.call(this)||this).firestore=n,o}return Pr(e,t),e.prototype.convertBytes=function(n){return new vnt(new fb(n))},e.prototype.convertReference=function(n){var o=this.convertDocumentKey(n,this.firestore._databaseId);return Ix.eu(o,this.firestore,null)},e}(I5e);function d_n(t){var e;e=t,W2.setLogLevel(e)}var bnt=function(){function t(e,n){this._firestore=e,this._delegate=n,this._userDataWriter=new VZ(e)}return t.prototype.get=function(e){var n=this,o=Zv(e);return this._delegate.get(o).then(function(r){return new Nk(n._firestore,new j6(n._firestore._delegate,n._userDataWriter,r._key,r._document,r.metadata,o.converter))})},t.prototype.set=function(e,n,o){var r=Zv(e);return o?(T5e("Transaction.set",o),this._delegate.set(r,n,o)):this._delegate.set(r,n),this},t.prototype.update=function(e,n,o){for(var r,i=[],a=3;a"u")throw new Lo(Vn.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function ECe(){if(typeof atob>"u")throw new Lo(Vn.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var vnt=function(){function t(e){this._delegate=e}return t.fromBase64String=function(e){return ECe(),new t(fb.fromBase64String(e))},t.fromUint8Array=function(e){return DCe(),new t(fb.fromUint8Array(e))},t.prototype.toBase64=function(){return ECe(),this._delegate.toBase64()},t.prototype.toUint8Array=function(){return DCe(),this._delegate.toUint8Array()},t.prototype.isEqual=function(e){return this._delegate.isEqual(e._delegate)},t.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},t}(),u_n=function(){function t(){}return t.prototype.enableIndexedDbPersistence=function(e,n){return function(o,r){TCe(o=os(o,Wu));var i=ch(o),a=o._freezeSettings(),l=new Qde;return SCe(i,l,new qtt(l,a.cacheSizeBytes,r==null?void 0:r.forceOwnership))}(e._delegate,{forceOwnership:n})},t.prototype.enableMultiTabIndexedDbPersistence=function(e){return function(n){TCe(n=os(n,Wu));var o=ch(n),r=n._freezeSettings(),i=new Qde;return SCe(o,i,new NVn(i,r.cacheSizeBytes))}(e._delegate)},t.prototype.clearIndexedDbPersistence=function(e){return function(n){var o=this;if(n._initialized&&!n._terminated)throw new Lo(Vn.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var r=new a1;return n._queue.enqueueAndForgetEvenWhileRestricted(function(){return bo(o,void 0,void 0,function(){var i;return vo(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,function(l){return bo(this,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return OR.yt()?(s=l+"main",[4,OR.delete(s)]):[2,Promise.resolve()];case 1:return c.sent(),[2]}})})}(a5e(n._databaseId,n._persistenceKey))];case 1:return a.sent(),r.resolve(),[3,3];case 2:return i=a.sent(),r.reject(i),[3,3];case 3:return[2]}})})}),r.promise}(e._delegate)},t}(),xnt=function(){function t(e,n,o){var r=this;this._delegate=n,this.Zc=o,this.INTERNAL={delete:function(){return r.terminate()}},e instanceof XX||(this.tu=e)}return Object.defineProperty(t.prototype,"_databaseId",{get:function(){return this._delegate._databaseId},enumerable:!1,configurable:!0}),t.prototype.settings=function(e){var n=this._delegate._getSettings();e.merge||n.host===e.host||FX("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),e.merge&&delete(e=Object.assign(Object.assign({},n),e)).merge,this._delegate._setSettings(e)},t.prototype.useEmulator=function(e,n,o){o===void 0&&(o={}),function(r,i,a,l){var s;l===void 0&&(l={});var c=(r=os(r,Lk))._getSettings();if(c.host!=="firestore.googleapis.com"&&c.host!==i&&FX("Host has been set in both settings() and useEmulator(), emulator host will be used"),r._setSettings(Object.assign(Object.assign({},c),{host:i+":"+a,ssl:!1})),l.mockUserToken){var u,d;if(typeof l.mockUserToken=="string")u=l.mockUserToken,d=lf.MOCK_USER;else{u=m2e(l.mockUserToken,(s=r._app)===null||s===void 0?void 0:s.options.projectId);var f=l.mockUserToken.sub||l.mockUserToken.user_id;if(!f)throw new Lo(Vn.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new lf(f)}r._credentials=new OVn(new tnt(u,d))}}(this._delegate,e,n,o)},t.prototype.enableNetwork=function(){return function(e){var n=this;return e.asyncQueue.enqueue(function(){return bo(n,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return[4,hCe(e)];case 1:return o=i.sent(),[4,pCe(e)];case 2:return r=i.sent(),[2,(o.setNetworkEnabled(!0),function(a){var l=Dr(a);return l.Or.delete(0),VN(l)}(r))]}})})})}(ch(os(this._delegate,Wu)))},t.prototype.disableNetwork=function(){return function(e){var n=this;return e.asyncQueue.enqueue(function(){return bo(n,void 0,void 0,function(){var o,r;return vo(this,function(i){switch(i.label){case 0:return[4,hCe(e)];case 1:return o=i.sent(),[4,pCe(e)];case 2:return r=i.sent(),[2,(o.setNetworkEnabled(!1),function(a){return bo(this,void 0,void 0,function(){var l;return vo(this,function(s){switch(s.label){case 0:return(l=Dr(a)).Or.add(0),[4,cM(l)];case 1:return s.sent(),l.Br.set("Offline"),[2]}})})}(r))]}})})})}(ch(os(this._delegate,Wu)))},t.prototype.enablePersistence=function(e){var n=!1,o=!1;return e&&nnt("synchronizeTabs",n=!!e.synchronizeTabs,"experimentalForceOwningTab",o=!!e.experimentalForceOwningTab),n?this.Zc.enableMultiTabIndexedDbPersistence(this):this.Zc.enableIndexedDbPersistence(this,o)},t.prototype.clearPersistence=function(){return this.Zc.clearIndexedDbPersistence(this)},t.prototype.terminate=function(){return this.tu&&(this.tu._removeServiceInstance("firestore"),this.tu._removeServiceInstance("firestore-exp")),this._delegate._delete()},t.prototype.waitForPendingWrites=function(){return function(e){var n=this,o=new a1;return e.asyncQueue.enqueueAndForget(function(){return bo(n,void 0,void 0,function(){var r;return vo(this,function(i){switch(i.label){case 0:return r=RVn,[4,ent(e)];case 1:return[2,r.apply(void 0,[i.sent(),o])]}})})}),o.promise}(ch(os(this._delegate,Wu)))},t.prototype.onSnapshotsInSync=function(e){return function(n,o){return function(r,i){var a=this,l=new NZ(i);return r.asyncQueue.enqueueAndForget(function(){return bo(a,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return s=function(u,d){Dr(u).Gr.add(d),d.next()},[4,JR(r)];case 1:return[2,s.apply(void 0,[c.sent(),l])]}})})}),function(){l.Wo(),r.asyncQueue.enqueueAndForget(function(){return bo(a,void 0,void 0,function(){var s;return vo(this,function(c){switch(c.label){case 0:return s=function(u,d){Dr(u).Gr.delete(d)},[4,JR(r)];case 1:return[2,s.apply(void 0,[c.sent(),l])]}})})})}}(ch(n=os(n,Wu)),KR(o)?o:{next:o})}(this._delegate,e)},Object.defineProperty(t.prototype,"app",{get:function(){if(!this.tu)throw new Lo(Vn.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.tu},enumerable:!1,configurable:!0}),t.prototype.collection=function(e){try{return new qX(this,ont(this._delegate,e))}catch(n){throw qh(n,"collection()","Firestore.collection()")}},t.prototype.doc=function(e){try{return new Ix(this,y_(this._delegate,e))}catch(n){throw qh(n,"doc()","Firestore.doc()")}},t.prototype.collectionGroup=function(e){try{return new GZ(this,function(n,o){if(n=os(n,Lk),S5e("collectionGroup","collection id",o),o.indexOf("/")>=0)throw new Lo(Vn.INVALID_ARGUMENT,"Invalid collection ID '"+o+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new Pg(n,null,function(r){return new SA(_l.emptyPath(),r)}(o))}(this._delegate,e))}catch(n){throw qh(n,"collectionGroup()","Firestore.collectionGroup()")}},t.prototype.runTransaction=function(e){var n=this;return function(o,r){return function(i,a){var l=this,s=new a1;return i.asyncQueue.enqueueAndForget(function(){return bo(l,void 0,void 0,function(){var c;return vo(this,function(u){switch(u.label){case 0:return[4,function(d){return UZ(d).then(function(f){return f.datastore})}(i)];case 1:return c=u.sent(),new jVn(i.asyncQueue,c,a,s).run(),[2]}})})}),s.promise}(ch(o),function(i){return r(new c_n(o,i))})}(this._delegate,function(o){return e(new bnt(n,o))})},t.prototype.batch=function(){var e=this;return ch(this._delegate),new Snt(new s_n(this._delegate,function(n){return GN(e._delegate,n)}))},t.prototype.loadBundle=function(e){throw new Lo(Vn.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},t.prototype.namedQuery=function(e){throw new Lo(Vn.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},t}(),VZ=function(t){function e(n){var o=this;return(o=t.call(this)||this).firestore=n,o}return Pr(e,t),e.prototype.convertBytes=function(n){return new vnt(new fb(n))},e.prototype.convertReference=function(n){var o=this.convertDocumentKey(n,this.firestore._databaseId);return Ix.eu(o,this.firestore,null)},e}(I5e);function d_n(t){var e;e=t,W2.setLogLevel(e)}var bnt=function(){function t(e,n){this._firestore=e,this._delegate=n,this._userDataWriter=new VZ(e)}return t.prototype.get=function(e){var n=this,o=Zv(e);return this._delegate.get(o).then(function(r){return new Nk(n._firestore,new j6(n._firestore._delegate,n._userDataWriter,r._key,r._document,r.metadata,o.converter))})},t.prototype.set=function(e,n,o){var r=Zv(e);return o?(T5e("Transaction.set",o),this._delegate.set(r,n,o)):this._delegate.set(r,n),this},t.prototype.update=function(e,n,o){for(var r,i=[],a=3;a{try{return(await $n.firestore().collection("users").doc(t).collection("projects").doc(e).get()).exists}catch(o){n(o)}},Gnt=async(t,e,n)=>{const o={lng:M.getState().language};await $n.firestore().collection("users").doc(t).collection("projects").doc(e).get().then(r=>{const i=r.data();i?n({owner:t,title:r.id,timestamp:i.timestamp,description:i.description,dataColoring:i.dataColoring??d9.ALL,type:i.type,designs:i.designs,ranges:i.ranges??[],filters:i.filters??[],hiddenParameters:i.hiddenParameters,counter:i.counter??0,selectedProperty:i.selectedProperty,sortDescending:i.sortDescending,xAxisNameScatterPlot:i.xAxisNameScatterPlot,yAxisNameScatterPlot:i.yAxisNameScatterPlot,dotSizeScatterPlot:i.dotSizeScatterPlot,thumbnailWidth:i.thumbnailWidth}):co(Y.t("message.CannotOpenProject",o)+": "+e)}).catch(r=>{co(Y.t("message.CannotOpenProject",o)+": "+r)})},_Gn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({designs:$n.firestore.FieldValue.arrayRemove(n)}).then(()=>{dt.getState().set(r=>{r.updateProjectsFlag=!0}),$n.firestore().collection("users").doc(t).collection("designs").doc(n.title).delete().then(()=>{M.getState().set(r=>{n.title===r.cloudFile&&(r.cloudFile=void 0)}),gn(Y.t("message.DesignRemovedFromProject",o)+".")}).catch(r=>{co(Y.t("message.CannotDeleteCloudFile",o)+": "+r)})})}catch(r){co(Y.t("message.CannotRemoveDesignFromProject",o)+": "+r)}},GGn=async(t,e,n,o)=>{const r={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({hiddenParameters:o?$n.firestore.FieldValue.arrayUnion(n):$n.firestore.FieldValue.arrayRemove(n)})}catch(i){co(Y.t("message.CannotUpdateProject",r)+": "+i)}},NO=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({ranges:$n.firestore.FieldValue.arrayUnion(n)})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},YCe=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({ranges:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},XGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({description:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},JGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({dataColoring:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},KGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({selectedProperty:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},qGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({xAxisNameScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},$Gn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({yAxisNameScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},QGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({dotSizeScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},ZGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({thumbnailWidth:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},Xnt=(t,e,n)=>{let o={timestamp:Date.now(),title:e,thumbnail:n,excluded:!1};switch(t){case Ri.SOLAR_PANEL_ARRAY:{const r=M.getState().world.latitude,i=ye.countAllSolarPanels(),a=ye.countAllSolarPanelDailyYields(),l=ye.countAllSolarPanelYearlyYields(),s=M.getState().economicsParams,c=s.operationalCostPerUnit,u=s.electricitySellingPrice;o={latitude:r,unitCost:c,sellingPrice:u,panelCount:i,dailyYield:a,yearlyYield:l,...o,...M.getState().solarPanelArrayLayoutParams};break}case Ri.SOLAR_PANEL_TILT_ANGLE:break}return o},OCe=(t,e)=>{if(!e)return null;const n=[];for(const o of e){const r={...o};r.title=eXn(t,o.title),r.timestamp=Date.now(),n.push(r)}return n},eXn=(t,e)=>{const n=e.lastIndexOf(" ");return t+e.substring(n)},tXn=t=>{const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");return n&&n.drawImage(t,1,1),e.toDataURL()},VCe=(t,e,n,o)=>{const r={lng:M.getState().language};$n.firestore().collection("users").doc(n??o).collection("designs").doc(t).get().then(i=>{if(i.exists){const a=i.data();a&&$n.firestore().collection("users").doc(o).collection("designs").doc(e).set(a).then(()=>{gn(Y.t("message.CloudFileCopied",r)+": "+e)}).catch(l=>{co(Y.t("message.CannotWriteCloudFile",r)+": "+l)})}else co(Y.t("message.CannotReadCloudFile",r))}).catch(i=>{co(Y.t("message.CannotReadCloudFile",r)+": "+i)})},nXn=async(t,e,n)=>{const o={lng:M.getState().language};$n.firestore().collection("users").doc(t).collection("projects").doc(e).get().then(r=>{if(r.exists){const i=r.data();if(i){const a=[];a.push(...i.designs);let l=-1;for(const[s,c]of a.entries())if(c.title===n.title){l=s;break}l>=0&&(a[l].invisible=!n.invisible,$n.firestore().collection("users").doc(t).collection("projects").doc(e).update({designs:a}).then(()=>{}).catch(s=>{co(Y.t("message.CannotUpdateProject",o)+": "+s)}))}}}).catch(r=>{co(Y.t("message.CannotFetchProjectData",o)+": "+r)}).finally(()=>{})},oXn=async(t,e,n,o,r,i)=>{const a={lng:M.getState().language};if(dt.getState().set(l=>{l.waiting=!0}),await $n.firestore().collection("users").doc(t).collection("designs").doc(r).set(M.getState().exportContent()),dt.getState().setChanged(!1),i){const l=ye.resizeCanvas(i,o).toDataURL();$n.firestore().collection("users").doc(t).collection("projects").doc(n).get().then(s=>{if(s.exists){const c=s.data();if(c){const u=[];u.push(...c.designs);let d=-1;for(const[f,p]of u.entries())if(p.title===r){d=f;break}d>=0&&(u[d]=Xnt(e,r,l),$n.firestore().collection("users").doc(t).collection("projects").doc(n).update({designs:u}).then(()=>{}).catch(f=>{co(Y.t("message.CannotUpdateProject",a)+": "+f)}).finally(()=>{M.getState().set(f=>{f.projectState.designs=u}),dt.getState().set(f=>{f.updateProjectsFlag=!0,f.waiting=!1})}))}}}).catch(s=>{co(Y.t("message.CannotFetchProjectData",a)+": "+s)}).finally(()=>{})}},_Ce=async(t,e,n)=>{try{return(await $n.firestore().collection("users").doc(t).collection("files").doc(e).get()).exists}catch(o){n(o)}},rXn=async(t,e)=>{await $n.firestore().collection("users").doc(t).get().then(n=>{const o=n.data();return o?(o.fileList&&e.push(...o.fileList),!0):!1})},GCe=async(t,e)=>{await $n.firestore().collection("users").doc(t).update({fileList:$n.firestore.FieldValue.arrayUnion(e)}).then(()=>{}).catch(n=>{console.log(n)})},XCe=async(t,e)=>{await $n.firestore().collection("users").doc(t).update({fileList:$n.firestore.FieldValue.arrayRemove(e)}).then(()=>{}).catch(n=>{console.log(n)})},QX=async(t,e,n,o,r)=>{const i={lng:M.getState().language};M.getState().undoManager.clear(),dt.getState().set(a=>{a.waiting=!0});try{const l=(await $n.firestore().collection("users").doc(t).collection(n?"designs":"files").doc(e).get()).data();if(l?M.getState().importContent(l,e):(gn(Y.t("message.CloudFileNotFound",i)+": "+e),M.getState().set(s=>{s.cloudFile=void 0}),dt.getState().set(s=>{s.waiting=!1})),!o&&!r){const s=t1+"?client=web&userid="+t+"&title="+encodeURIComponent(e);window.history.pushState({},document.title,s)}}catch(a){co(Y.t("message.CannotOpenCloudFile",i)+": "+a),dt.getState().set(l=>{l.waiting=!1})}},k4=({key:t,label:e})=>({key:t,label:h.jsx(an,{noPadding:!0,children:Y.t(e,{lng:M.getState().language})})}),iXn=t=>{const e={lng:M.getState().language},n=M.getState().set,o=a=>{n(l=>{l.projectState={...a},l.projectImages.clear(),l.projectView=!0}),dt.getState().set(l=>{l.projectImagesUpdateFlag=!l.projectImagesUpdateFlag,l.updateProjectsFlag=!0})},r=(a,l)=>{const s="QWecNcxhyvP6j6sBN11hBsfZDau1";a&&s&&(Gnt(s,a,o).then(()=>{QX(s,a+" "+l,!0,!0,t).then(()=>{})}),dt.getState().set(c=>{c.openModelsMap=!1}),M.getState().loggable&&n(c=>{c.actionInfo={name:"Open Example: "+a,timestamp:new Date().getTime()}}),t||window.history.pushState({},document.title,t1))};return[{key:"solar-energy-science",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarEnergyScienceSubMenu",e)}),children:[{key:"sun_angles",label:"menu.solarEnergyScienceTutorials.SunAngles"},{key:"insolation_and_climate",label:"menu.solarEnergyScienceTutorials.InsolationAndClimate"},{key:"solar_radiation_to_box",label:"menu.solarEnergyScienceTutorials.SolarRadiationToBox"},{key:"sun_beam_at_center",label:"menu.solarEnergyExamples.SunBeamAndHeliodon"}].map(k4)},{key:"building-science",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingScienceSubMenu",e)}),children:[{key:"thermal_vs_building_envelope",label:"menu.buildingScienceTutorials.ThermalEnvelopeVsBuildingEnvelope"},{key:"effect_house_size",label:"menu.buildingScienceTutorials.EffectOfSizeOnBuildingEnergy"},{key:"effect_house_orientation",label:"menu.buildingScienceTutorials.EffectOfOrientationOnBuildingEnergy"},{key:"effect_wall_roof_insulation",label:"menu.buildingScienceTutorials.EffectOfInsulationOnBuildingEnergy"},{key:"effect_roof_color",label:"menu.buildingScienceTutorials.EffectOfRoofColorOnBuildingEnergy"},{key:"effect_eaves_overhang_length",label:"menu.buildingScienceTutorials.EffectOfEavesOverhangLengthOnBuildingEnergy"},{key:"effect_window_shgc",label:"menu.buildingScienceTutorials.EffectOfWindowSHGCOnBuildingEnergy"},{key:"effect_thermostat_setpoint",label:"menu.buildingScienceTutorials.EffectOfThermostatSetpointOnBuildingEnergy"},{key:"effect_solar_panels",label:"menu.buildingScienceTutorials.EffectOfSolarPanelsOnBuildingEnergy"},{key:"effect_ground_temperature",label:"menu.buildingScienceTutorials.EffectOfGroundTemperatureOnBuildingEnergy"},{key:"effect_trees",label:"menu.buildingScienceTutorials.EffectOfTreesOnBuildingEnergy"}].map(k4)},{key:"building-design",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingDesignSubMenu",e)}),children:[{key:"cape_cod_with_shed_dormer",label:"menu.buildingDesignTutorials.CapeCodStyleHouseWithShedDormer"},{key:"mansard_roof_with_dormers",label:"menu.buildingDesignTutorials.MansardRoofWithDormers"},{key:"gable_roof_vs_hip_roof",label:"menu.buildingDesignTutorials.GableRoofVsHipRoof"},{key:"colonial_vs_saltbox",label:"menu.buildingDesignTutorials.ColonialVsSaltbox"},{key:"gambrel_roof_vs_mansard_roof",label:"menu.buildingDesignTutorials.GambrelRoofVsMansardRoof"},{key:"combination_roof_vs_bonnet_roof",label:"menu.buildingDesignTutorials.CombinationRoofVsBonnetRoof"},{key:"dutch_gable_roof",label:"menu.buildingDesignTutorials.DutchGableRoof"},{key:"gable_and_valley_roof",label:"menu.buildingDesignTutorials.GableAndValleyRoof"},{key:"clerestory_roof",label:"menu.buildingDesignTutorials.ClerestoryRoof"},{key:"monitor_roof",label:"menu.buildingDesignTutorials.MonitorRoof"},{key:"a_frame_house",label:"menu.buildingDesignTutorials.AFrameHouse"},{key:"half_timbered_house",label:"menu.buildingDesignTutorials.HalfTimberedHouse"},{key:"all_roof_types",label:"menu.buildingDesignTutorials.AllBasicRoofTypes"}].map(k4)},{key:"photovoltaic-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.photovoltaicSolarPowerSubMenu",e)}),children:[{key:"effect_tilt_angle_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfTiltAngleOfSolarPanel"},{key:"effect_azimuth_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfAzimuthOfSolarPanel"},{key:"solar_panel_types",label:"menu.photovoltaicSolarPowerTutorials.SolarPanelTypes"},{key:"custom_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.DefineYourOwnSolarPanels"},{key:"vertical_bifacial_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.VerticalBifacialSolarPanels"},{key:"compare_monofacial_bifacial_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.CompareMonofacialAndBifacialSolarPanels"},{key:"solar_trackers",label:"menu.photovoltaicSolarPowerTutorials.SolarTrackers"},{key:"why_solar_array",label:"menu.photovoltaicSolarPowerTutorials.CoveringGroundWithSolarPanels"},{key:"inter_row_spacing",label:"menu.photovoltaicSolarPowerTutorials.InterRowSpacingOfSolarPanelArray"},{key:"effect_orientation_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfOrientationOfSolarPanels"},{key:"solar_panel_array_auto_layout",label:"menu.photovoltaicSolarPowerTutorials.SolarPanelArrayAutomaticLayout"},{key:"rooftop_solar_panels",label:"menu.solarEnergyExamples.RooftopSolarPanels"},{key:"solar_canopy_form_factors",label:"menu.solarEnergyExamples.SolarCanopyFormFactors"},{key:"bipv_01",label:"menu.solarEnergyExamples.BuildingIntegratedPhotovoltaics"}].map(k4)},{key:"concentrated-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.concentratedSolarPowerSubMenu",e)}),children:[{key:"parabolic_dish_focus_sunlight",label:"menu.concentratedSolarPowerTutorials.FocusSunlightWithParabolicDish"},{key:"effect_azimuth_parabolic_trough",label:"menu.concentratedSolarPowerTutorials.EffectOfAzimuthOfParabolicTrough"},{key:"effect_latus_rectum_parabolic_trough",label:"menu.concentratedSolarPowerTutorials.EffectOfLatusRectumOfParabolicTrough"},{key:"linear_fresnel_reflectors",label:"menu.concentratedSolarPowerTutorials.LinearFresnelReflectors"},{key:"effect_absorber_pipe_height",label:"menu.concentratedSolarPowerTutorials.EffectOfAbsorberPipeHeightForLinearFresnelReflectors"},{key:"effect_azimuth_fresnel_reflector",label:"menu.concentratedSolarPowerTutorials.EffectOfAzimuthOfLinearFresnelReflectors"},{key:"linear_fresnel_reflectors_two_absorbers",label:"menu.concentratedSolarPowerTutorials.LinearFresnelReflectorsWithTwoAbsorbers"},{key:"solar_power_tower",label:"menu.concentratedSolarPowerTutorials.SolarPowerTower"},{key:"cosine_efficiency_heliostats",label:"menu.concentratedSolarPowerTutorials.CosineEfficiencyOfHeliostats"},{key:"shadowing_blocking_heliostats",label:"menu.concentratedSolarPowerTutorials.ShadowingAndBlockingOfHeliostats"},{key:"effect_solar_power_tower_height",label:"menu.concentratedSolarPowerTutorials.EffectSolarPowerTowerHeight"}].map(k4)},{key:"other-types-of-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherTypesOfSolarPowerSubMenu",e)}),children:[{key:"solar_water_heaters",label:"menu.otherTypesOfSolarPowerTutorials.SolarWaterHeaters"},{key:"solar_updraft_tower",label:"menu.otherTypesOfSolarPowerTutorials.SolarUpdraftTower"}].map(k4)},{key:"wind-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.windPowerSubMenu",e)}),children:[{key:"effect_blade_number",label:"menu.windPowerTutorials.EffectOfBladeNumberOfWindTurbine"},{key:"effect_pitch_angle",label:"menu.windPowerTutorials.EffectOfPitchAngleOfWindTurbineBlades"},{key:"bird_safe_blade_design",label:"menu.windPowerTutorials.BirdSafeBladeDesign"},{key:"offshore_wind_farm",label:"menu.windPowerTutorials.OffshoreWindFarm"}].map(k4)},{key:"colocation",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.colocationSubMenu",e)}),children:[{key:"agriculture_solar_wind_colocation",label:"menu.colocationTutorials.AgricultureSolarWindColocation"}].map(k4)},{key:"generative-design",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.generativeDesignSubMenu",e)}),children:[{key:"Tilt Angle",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Tilt Angle",48),children:Y.t("menu.generativeDesignTutorials.MonofacialSolarPanelArrayTiltAngle",e)})},{key:"Bifacial Tilt Angle",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Bifacial Tilt Angle",50),children:Y.t("menu.generativeDesignTutorials.BifacialSolarPanelArrayTiltAngle",e)})},{key:"Latitude",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Latitude",0),children:Y.t("menu.generativeDesignTutorials.OutputOfSolarPanelArrayInDifferentPlaces",e)})},{key:"Pareto Front",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Pareto Front",0),children:Y.t("menu.generativeDesignTutorials.SimpleSolarFarmParetoFront",e)})}]}]},J5=({key:t,label:e})=>({key:t,label:h.jsx(an,{noPadding:!0,children:Y.t(e,{lng:M.getState().language})})}),aXn=()=>{const t={lng:M.getState().language};return[{key:"solar-energy",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarEnergySubMenu",t)}),children:[{key:"photovoltaic-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.photovoltaicSolarPowerSubMenu",t)}),children:[{key:"vegetative_buffer_01",label:"menu.solarEnergyExamples.VegetativeBuffer"},{key:"solar_canopy_over_bleachers",label:"menu.solarEnergyExamples.SolarCanopyOverBleachers"},{key:"solar_canopy_over_garage",label:"menu.solarEnergyExamples.SolarCanopyOverGarage"},{key:"solar_bus_stop",label:"menu.solarEnergyExamples.SolarBusStop"},{key:"solar_facade_tesla",label:"menu.solarEnergyExamples.SolarFacadeTesla"},{key:"floatovoltaics",label:"menu.solarEnergyExamples.Floatovoltaics"},{key:"rainbow_swash_solar_farm",label:"menu.solarEnergyExamples.RainbowSwashSolarFarmBostonMA"},{key:"mickey_mouse_solar_farm",label:"menu.solarEnergyExamples.MickeyMouseSolarFarmOrlandoFL"},{key:"solar_panels_over_canal",label:"menu.solarEnergyExamples.SolarPanelsOverCanalBakersfieldCA"},{key:"solar_noise_barrier",label:"menu.solarEnergyExamples.SolarNoiseBarrierLexingtonMA"},{key:"solar_farm_hsat_array",label:"menu.solarEnergyExamples.HSATSolarTrackersRaleighNC"},{key:"solar_farm_aadat_array",label:"menu.solarEnergyExamples.AADATSolarTrackersLancasterCA"}].map(J5)},{key:"concentrated-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.concentratedSolarPowerSubMenu",t)}),children:[{key:"nevada_solar_one_parabolic_troughs",label:"menu.solarEnergyExamples.NevadaSolarOneParabolicTroughArray"},{key:"tooele_parabolic_dish_array",label:"menu.solarEnergyExamples.TooeleParabolicDishArray"},{key:"tucson_sundt_station",label:"menu.solarEnergyExamples.TucsonLinearFresnelReflectors"},{key:"ps10_solar_power_tower",label:"menu.solarEnergyExamples.PS10SolarPowerTower"}].map(J5)},{key:"other-types-of-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherTypesOfSolarPowerSubMenu",t)}),children:[{key:"solar_updraft_tower_city",label:"menu.solarEnergyExamples.SolarUpdraftTowerInCity"}].map(J5)}]},{key:"built-environment",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.builtEnvironmentSubMenu",t)}),children:[{key:"residential_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.residentialBuildingsSubMenu",t)}),children:[{key:"colonial_house",label:"menu.residentialBuildingExamples.ColonialHouse"},{key:"dutch_colonial_house",label:"menu.residentialBuildingExamples.DutchColonialHouse"},{key:"t_shaped_house",label:"menu.residentialBuildingExamples.TShapedHouse"},{key:"cape_cod_with_garage",label:"menu.residentialBuildingExamples.CapeCodHouseWithGarage"},{key:"solarium",label:"menu.residentialBuildingExamples.Solarium"},{key:"butterfly_roof_house",label:"menu.residentialBuildingExamples.ButterflyRoofHouse"},{key:"adobe_taos_house",label:"menu.residentialBuildingExamples.AdobeTaosHouse"},{key:"ranch_house",label:"menu.residentialBuildingExamples.RanchHouse"},{key:"bonnet_house",label:"menu.residentialBuildingExamples.BonnetHouse"},{key:"barn_house",label:"menu.residentialBuildingExamples.BarnStyleHouse"},{key:"modern_house_01",label:"menu.residentialBuildingExamples.ModernHouse"}].map(J5)},{key:"commercial_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.commercialBuildingsSubMenu",t)}),children:[{key:"white_house",label:"menu.commercialBuildingExamples.WhiteHouse"},{key:"harold_washington_college",label:"menu.commercialBuildingExamples.HaroldWashingtonCollege"},{key:"bilim_mersin_turkiye",label:"menu.commercialBuildingExamples.BilimMersinTurkiye"},{key:"spanish_style_hotel",label:"menu.commercialBuildingExamples.SpanishStyleHotel"},{key:"apartment_building_01",label:"menu.commercialBuildingExamples.ApartmentBuilding"},{key:"office_building_01",label:"menu.commercialBuildingExamples.OfficeBuilding"},{key:"hotel_01",label:"menu.commercialBuildingExamples.Hotel"}].map(J5)},{key:"other_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherBuildingsSubMenu",t)}),children:[{key:"greenhouse",label:"menu.otherBuildingExamples.Greenhouse"},{key:"church_01",label:"menu.residentialBuildingExamples.Church1"},{key:"cathedral_01",label:"menu.residentialBuildingExamples.Cathedral1"},{key:"cathedral_02",label:"menu.residentialBuildingExamples.Cathedral2"},{key:"mosque_01",label:"menu.residentialBuildingExamples.Mosque1"},{key:"pavilion",label:"menu.otherBuildingExamples.Pavilion"},{key:"octagonal_pagoda",label:"menu.otherBuildingExamples.OctagonalPagoda"},{key:"ocean_front",label:"menu.otherBuildingExamples.OceanFront"},{key:"egyptian_pyramids",label:"menu.otherBuildingExamples.EgyptianPyramids"},{key:"mayan_pyramid",label:"menu.otherBuildingExamples.MayanPyramid"},{key:"si_o_se_pol",label:"menu.otherBuildingExamples.SiOSePol"},{key:"stacked_cuboids",label:"menu.otherBuildingExamples.StackedCuboids"}].map(J5)},{key:"building_complexes",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingComplexesSubMenu",t)}),children:[{key:"south_burlington_high_school",label:"menu.buildingComplexExamples.SouthBurlingtonHighSchoolVermont"},{key:"mescalero_apache_school",label:"menu.buildingComplexExamples.MescaleroApacheSchoolNewMexico"}].map(J5)},{key:"urban_planning",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.urbanPlanningSubMenu",t)}),children:[{key:"city_block_heatmap",label:"menu.urbanPlanningExamples.CityBlockHeatmap"},{key:"chicago_skyline",label:"menu.urbanPlanningExamples.ChicagoSkyline"}].map(J5)}]},{key:"artificial-intelligence",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.artificialIntelligenceSubMenu",t)}),children:[{key:"ai_tilt_angle_one_row",label:"menu.artificialIntelligenceExamples.OptimizingTiltAngleOfOneSolarPanelRow"},{key:"ai_tilt_angles_multiple_rows",label:"menu.artificialIntelligenceExamples.OptimizingTiltAnglesOfMultipleSolarPanelRows"},{key:"ai_solar_farm_design",label:"menu.artificialIntelligenceExamples.SolarFarmGenerativeDesign"},{key:"ai_solar_farm_design_block",label:"menu.artificialIntelligenceExamples.SolarFarmGenerativeDesignWithBlock"},{key:"ai_fitchburg_solar_farm",label:"menu.artificialIntelligenceExamples.FitchburgSolarFarmGenerativeDesign"}].map(J5)},{key:"benchmarks",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.benchmarksSubMenu",t)}),children:[{key:"solar_radiation_predicted_vs_measured",label:"menu.benchmarks.SolarRadiationPredictionVsMeasurement"},{key:"bestest_case_600",label:"menu.benchmarks.BESTESTCase600"},{key:"bestest_case_610",label:"menu.benchmarks.BESTESTCase610"},{key:"bestest_case_620",label:"menu.benchmarks.BESTESTCase620"},{key:"bestest_case_630",label:"menu.benchmarks.BESTESTCase630"}].map(J5)}]},lXn=Ho.div` + */var YGn="storage";function OGn(t,e){var n=e.instanceIdentifier,o=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal"),a=new UGn(o,new QZ(o,r,i,new N_n,n,$n.SDK_VERSION));return a}function VGn(t){var e={TaskState:$h,TaskEvent:k_n,StringFormat:Bm,Storage:QZ,Reference:jk};t.INTERNAL.registerComponent(new Jb(YGn,OGn,"PUBLIC").setServiceProps(e).setMultipleInstances(!0)),t.registerVersion(jGn,BGn)}VGn($n);const zae=async(t,e,n)=>{try{return(await $n.firestore().collection("users").doc(t).collection("projects").doc(e).get()).exists}catch(o){n(o)}},Gnt=async(t,e,n)=>{const o={lng:M.getState().language};await $n.firestore().collection("users").doc(t).collection("projects").doc(e).get().then(r=>{const i=r.data();i?n({owner:t,title:r.id,timestamp:i.timestamp,description:i.description,dataColoring:i.dataColoring??d9.ALL,type:i.type,designs:i.designs,ranges:i.ranges??[],filters:i.filters??[],hiddenParameters:i.hiddenParameters,counter:i.counter??0,selectedProperty:i.selectedProperty,sortDescending:i.sortDescending,xAxisNameScatterPlot:i.xAxisNameScatterPlot,yAxisNameScatterPlot:i.yAxisNameScatterPlot,dotSizeScatterPlot:i.dotSizeScatterPlot,thumbnailWidth:i.thumbnailWidth}):co(Y.t("message.CannotOpenProject",o)+": "+e)}).catch(r=>{co(Y.t("message.CannotOpenProject",o)+": "+r)})},_Gn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({designs:$n.firestore.FieldValue.arrayRemove(n)}).then(()=>{dt.getState().set(r=>{r.updateProjectsFlag=!0}),$n.firestore().collection("users").doc(t).collection("designs").doc(n.title).delete().then(()=>{M.getState().set(r=>{n.title===r.cloudFile&&(r.cloudFile=void 0)}),gn(Y.t("message.DesignRemovedFromProject",o)+".")}).catch(r=>{co(Y.t("message.CannotDeleteCloudFile",o)+": "+r)})})}catch(r){co(Y.t("message.CannotRemoveDesignFromProject",o)+": "+r)}},GGn=async(t,e,n,o)=>{const r={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({hiddenParameters:o?$n.firestore.FieldValue.arrayUnion(n):$n.firestore.FieldValue.arrayRemove(n)})}catch(i){co(Y.t("message.CannotUpdateProject",r)+": "+i)}},NO=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({ranges:$n.firestore.FieldValue.arrayUnion(n)})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},YCe=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({ranges:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},XGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({description:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},JGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({dataColoring:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},KGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({selectedProperty:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},qGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({xAxisNameScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},$Gn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({yAxisNameScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},QGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({dotSizeScatterPlot:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},ZGn=async(t,e,n)=>{const o={lng:M.getState().language};try{await $n.firestore().collection("users").doc(t).collection("projects").doc(e).update({thumbnailWidth:n})}catch(r){co(Y.t("message.CannotUpdateProject",o)+": "+r)}},Xnt=(t,e,n)=>{let o={timestamp:Date.now(),title:e,thumbnail:n,excluded:!1};switch(t){case Ri.SOLAR_PANEL_ARRAY:{const r=M.getState().world.latitude,i=me.countAllSolarPanels(),a=me.countAllSolarPanelDailyYields(),l=me.countAllSolarPanelYearlyYields(),s=M.getState().economicsParams,c=s.operationalCostPerUnit,u=s.electricitySellingPrice;o={latitude:r,unitCost:c,sellingPrice:u,panelCount:i,dailyYield:a,yearlyYield:l,...o,...M.getState().solarPanelArrayLayoutParams};break}case Ri.SOLAR_PANEL_TILT_ANGLE:break}return o},OCe=(t,e)=>{if(!e)return null;const n=[];for(const o of e){const r={...o};r.title=eXn(t,o.title),r.timestamp=Date.now(),n.push(r)}return n},eXn=(t,e)=>{const n=e.lastIndexOf(" ");return t+e.substring(n)},tXn=t=>{const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");return n&&n.drawImage(t,1,1),e.toDataURL()},VCe=(t,e,n,o)=>{const r={lng:M.getState().language};$n.firestore().collection("users").doc(n??o).collection("designs").doc(t).get().then(i=>{if(i.exists){const a=i.data();a&&$n.firestore().collection("users").doc(o).collection("designs").doc(e).set(a).then(()=>{gn(Y.t("message.CloudFileCopied",r)+": "+e)}).catch(l=>{co(Y.t("message.CannotWriteCloudFile",r)+": "+l)})}else co(Y.t("message.CannotReadCloudFile",r))}).catch(i=>{co(Y.t("message.CannotReadCloudFile",r)+": "+i)})},nXn=async(t,e,n)=>{const o={lng:M.getState().language};$n.firestore().collection("users").doc(t).collection("projects").doc(e).get().then(r=>{if(r.exists){const i=r.data();if(i){const a=[];a.push(...i.designs);let l=-1;for(const[s,c]of a.entries())if(c.title===n.title){l=s;break}l>=0&&(a[l].invisible=!n.invisible,$n.firestore().collection("users").doc(t).collection("projects").doc(e).update({designs:a}).then(()=>{}).catch(s=>{co(Y.t("message.CannotUpdateProject",o)+": "+s)}))}}}).catch(r=>{co(Y.t("message.CannotFetchProjectData",o)+": "+r)}).finally(()=>{})},oXn=async(t,e,n,o,r,i)=>{const a={lng:M.getState().language};if(dt.getState().set(l=>{l.waiting=!0}),await $n.firestore().collection("users").doc(t).collection("designs").doc(r).set(M.getState().exportContent()),dt.getState().setChanged(!1),i){const l=me.resizeCanvas(i,o).toDataURL();$n.firestore().collection("users").doc(t).collection("projects").doc(n).get().then(s=>{if(s.exists){const c=s.data();if(c){const u=[];u.push(...c.designs);let d=-1;for(const[f,p]of u.entries())if(p.title===r){d=f;break}d>=0&&(u[d]=Xnt(e,r,l),$n.firestore().collection("users").doc(t).collection("projects").doc(n).update({designs:u}).then(()=>{}).catch(f=>{co(Y.t("message.CannotUpdateProject",a)+": "+f)}).finally(()=>{M.getState().set(f=>{f.projectState.designs=u}),dt.getState().set(f=>{f.updateProjectsFlag=!0,f.waiting=!1})}))}}}).catch(s=>{co(Y.t("message.CannotFetchProjectData",a)+": "+s)}).finally(()=>{})}},_Ce=async(t,e,n)=>{try{return(await $n.firestore().collection("users").doc(t).collection("files").doc(e).get()).exists}catch(o){n(o)}},rXn=async(t,e)=>{await $n.firestore().collection("users").doc(t).get().then(n=>{const o=n.data();return o?(o.fileList&&e.push(...o.fileList),!0):!1})},GCe=async(t,e)=>{await $n.firestore().collection("users").doc(t).update({fileList:$n.firestore.FieldValue.arrayUnion(e)}).then(()=>{}).catch(n=>{console.log(n)})},XCe=async(t,e)=>{await $n.firestore().collection("users").doc(t).update({fileList:$n.firestore.FieldValue.arrayRemove(e)}).then(()=>{}).catch(n=>{console.log(n)})},QX=async(t,e,n,o,r)=>{const i={lng:M.getState().language};M.getState().undoManager.clear(),dt.getState().set(a=>{a.waiting=!0});try{const l=(await $n.firestore().collection("users").doc(t).collection(n?"designs":"files").doc(e).get()).data();if(l?M.getState().importContent(l,e):(gn(Y.t("message.CloudFileNotFound",i)+": "+e),M.getState().set(s=>{s.cloudFile=void 0}),dt.getState().set(s=>{s.waiting=!1})),!o&&!r){const s=t1+"?client=web&userid="+t+"&title="+encodeURIComponent(e);window.history.pushState({},document.title,s)}}catch(a){co(Y.t("message.CannotOpenCloudFile",i)+": "+a),dt.getState().set(l=>{l.waiting=!1})}},k4=({key:t,label:e})=>({key:t,label:h.jsx(an,{noPadding:!0,children:Y.t(e,{lng:M.getState().language})})}),iXn=t=>{const e={lng:M.getState().language},n=M.getState().set,o=a=>{n(l=>{l.projectState={...a},l.projectImages.clear(),l.projectView=!0}),dt.getState().set(l=>{l.projectImagesUpdateFlag=!l.projectImagesUpdateFlag,l.updateProjectsFlag=!0})},r=(a,l)=>{const s="QWecNcxhyvP6j6sBN11hBsfZDau1";a&&s&&(Gnt(s,a,o).then(()=>{QX(s,a+" "+l,!0,!0,t).then(()=>{})}),dt.getState().set(c=>{c.openModelsMap=!1}),M.getState().loggable&&n(c=>{c.actionInfo={name:"Open Example: "+a,timestamp:new Date().getTime()}}),t||window.history.pushState({},document.title,t1))};return[{key:"solar-energy-science",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarEnergyScienceSubMenu",e)}),children:[{key:"sun_angles",label:"menu.solarEnergyScienceTutorials.SunAngles"},{key:"insolation_and_climate",label:"menu.solarEnergyScienceTutorials.InsolationAndClimate"},{key:"solar_radiation_to_box",label:"menu.solarEnergyScienceTutorials.SolarRadiationToBox"},{key:"sun_beam_at_center",label:"menu.solarEnergyExamples.SunBeamAndHeliodon"}].map(k4)},{key:"building-science",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingScienceSubMenu",e)}),children:[{key:"thermal_vs_building_envelope",label:"menu.buildingScienceTutorials.ThermalEnvelopeVsBuildingEnvelope"},{key:"effect_house_size",label:"menu.buildingScienceTutorials.EffectOfSizeOnBuildingEnergy"},{key:"effect_house_orientation",label:"menu.buildingScienceTutorials.EffectOfOrientationOnBuildingEnergy"},{key:"effect_wall_roof_insulation",label:"menu.buildingScienceTutorials.EffectOfInsulationOnBuildingEnergy"},{key:"effect_roof_color",label:"menu.buildingScienceTutorials.EffectOfRoofColorOnBuildingEnergy"},{key:"effect_eaves_overhang_length",label:"menu.buildingScienceTutorials.EffectOfEavesOverhangLengthOnBuildingEnergy"},{key:"effect_window_shgc",label:"menu.buildingScienceTutorials.EffectOfWindowSHGCOnBuildingEnergy"},{key:"effect_thermostat_setpoint",label:"menu.buildingScienceTutorials.EffectOfThermostatSetpointOnBuildingEnergy"},{key:"effect_solar_panels",label:"menu.buildingScienceTutorials.EffectOfSolarPanelsOnBuildingEnergy"},{key:"effect_ground_temperature",label:"menu.buildingScienceTutorials.EffectOfGroundTemperatureOnBuildingEnergy"},{key:"effect_trees",label:"menu.buildingScienceTutorials.EffectOfTreesOnBuildingEnergy"}].map(k4)},{key:"building-design",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingDesignSubMenu",e)}),children:[{key:"cape_cod_with_shed_dormer",label:"menu.buildingDesignTutorials.CapeCodStyleHouseWithShedDormer"},{key:"mansard_roof_with_dormers",label:"menu.buildingDesignTutorials.MansardRoofWithDormers"},{key:"gable_roof_vs_hip_roof",label:"menu.buildingDesignTutorials.GableRoofVsHipRoof"},{key:"colonial_vs_saltbox",label:"menu.buildingDesignTutorials.ColonialVsSaltbox"},{key:"gambrel_roof_vs_mansard_roof",label:"menu.buildingDesignTutorials.GambrelRoofVsMansardRoof"},{key:"combination_roof_vs_bonnet_roof",label:"menu.buildingDesignTutorials.CombinationRoofVsBonnetRoof"},{key:"dutch_gable_roof",label:"menu.buildingDesignTutorials.DutchGableRoof"},{key:"gable_and_valley_roof",label:"menu.buildingDesignTutorials.GableAndValleyRoof"},{key:"clerestory_roof",label:"menu.buildingDesignTutorials.ClerestoryRoof"},{key:"monitor_roof",label:"menu.buildingDesignTutorials.MonitorRoof"},{key:"a_frame_house",label:"menu.buildingDesignTutorials.AFrameHouse"},{key:"half_timbered_house",label:"menu.buildingDesignTutorials.HalfTimberedHouse"},{key:"all_roof_types",label:"menu.buildingDesignTutorials.AllBasicRoofTypes"}].map(k4)},{key:"photovoltaic-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.photovoltaicSolarPowerSubMenu",e)}),children:[{key:"effect_tilt_angle_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfTiltAngleOfSolarPanel"},{key:"effect_azimuth_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfAzimuthOfSolarPanel"},{key:"solar_panel_types",label:"menu.photovoltaicSolarPowerTutorials.SolarPanelTypes"},{key:"custom_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.DefineYourOwnSolarPanels"},{key:"vertical_bifacial_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.VerticalBifacialSolarPanels"},{key:"compare_monofacial_bifacial_solar_panels",label:"menu.photovoltaicSolarPowerTutorials.CompareMonofacialAndBifacialSolarPanels"},{key:"solar_trackers",label:"menu.photovoltaicSolarPowerTutorials.SolarTrackers"},{key:"why_solar_array",label:"menu.photovoltaicSolarPowerTutorials.CoveringGroundWithSolarPanels"},{key:"inter_row_spacing",label:"menu.photovoltaicSolarPowerTutorials.InterRowSpacingOfSolarPanelArray"},{key:"effect_orientation_solar_panel",label:"menu.photovoltaicSolarPowerTutorials.EffectOfOrientationOfSolarPanels"},{key:"solar_panel_array_auto_layout",label:"menu.photovoltaicSolarPowerTutorials.SolarPanelArrayAutomaticLayout"},{key:"rooftop_solar_panels",label:"menu.solarEnergyExamples.RooftopSolarPanels"},{key:"solar_canopy_form_factors",label:"menu.solarEnergyExamples.SolarCanopyFormFactors"},{key:"bipv_01",label:"menu.solarEnergyExamples.BuildingIntegratedPhotovoltaics"}].map(k4)},{key:"concentrated-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.concentratedSolarPowerSubMenu",e)}),children:[{key:"parabolic_dish_focus_sunlight",label:"menu.concentratedSolarPowerTutorials.FocusSunlightWithParabolicDish"},{key:"effect_azimuth_parabolic_trough",label:"menu.concentratedSolarPowerTutorials.EffectOfAzimuthOfParabolicTrough"},{key:"effect_latus_rectum_parabolic_trough",label:"menu.concentratedSolarPowerTutorials.EffectOfLatusRectumOfParabolicTrough"},{key:"linear_fresnel_reflectors",label:"menu.concentratedSolarPowerTutorials.LinearFresnelReflectors"},{key:"effect_absorber_pipe_height",label:"menu.concentratedSolarPowerTutorials.EffectOfAbsorberPipeHeightForLinearFresnelReflectors"},{key:"effect_azimuth_fresnel_reflector",label:"menu.concentratedSolarPowerTutorials.EffectOfAzimuthOfLinearFresnelReflectors"},{key:"linear_fresnel_reflectors_two_absorbers",label:"menu.concentratedSolarPowerTutorials.LinearFresnelReflectorsWithTwoAbsorbers"},{key:"solar_power_tower",label:"menu.concentratedSolarPowerTutorials.SolarPowerTower"},{key:"cosine_efficiency_heliostats",label:"menu.concentratedSolarPowerTutorials.CosineEfficiencyOfHeliostats"},{key:"shadowing_blocking_heliostats",label:"menu.concentratedSolarPowerTutorials.ShadowingAndBlockingOfHeliostats"},{key:"effect_solar_power_tower_height",label:"menu.concentratedSolarPowerTutorials.EffectSolarPowerTowerHeight"}].map(k4)},{key:"other-types-of-solar-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherTypesOfSolarPowerSubMenu",e)}),children:[{key:"solar_water_heaters",label:"menu.otherTypesOfSolarPowerTutorials.SolarWaterHeaters"},{key:"solar_updraft_tower",label:"menu.otherTypesOfSolarPowerTutorials.SolarUpdraftTower"}].map(k4)},{key:"wind-power",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.windPowerSubMenu",e)}),children:[{key:"effect_blade_number",label:"menu.windPowerTutorials.EffectOfBladeNumberOfWindTurbine"},{key:"effect_pitch_angle",label:"menu.windPowerTutorials.EffectOfPitchAngleOfWindTurbineBlades"},{key:"bird_safe_blade_design",label:"menu.windPowerTutorials.BirdSafeBladeDesign"},{key:"offshore_wind_farm",label:"menu.windPowerTutorials.OffshoreWindFarm"}].map(k4)},{key:"colocation",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.colocationSubMenu",e)}),children:[{key:"agriculture_solar_wind_colocation",label:"menu.colocationTutorials.AgricultureSolarWindColocation"}].map(k4)},{key:"generative-design",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.generativeDesignSubMenu",e)}),children:[{key:"Tilt Angle",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Tilt Angle",48),children:Y.t("menu.generativeDesignTutorials.MonofacialSolarPanelArrayTiltAngle",e)})},{key:"Bifacial Tilt Angle",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Bifacial Tilt Angle",50),children:Y.t("menu.generativeDesignTutorials.BifacialSolarPanelArrayTiltAngle",e)})},{key:"Latitude",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Latitude",0),children:Y.t("menu.generativeDesignTutorials.OutputOfSolarPanelArrayInDifferentPlaces",e)})},{key:"Pareto Front",label:h.jsx(an,{noPadding:!0,onClick:()=>r("Pareto Front",0),children:Y.t("menu.generativeDesignTutorials.SimpleSolarFarmParetoFront",e)})}]}]},J5=({key:t,label:e})=>({key:t,label:h.jsx(an,{noPadding:!0,children:Y.t(e,{lng:M.getState().language})})}),aXn=()=>{const t={lng:M.getState().language};return[{key:"solar-energy",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.solarEnergySubMenu",t)}),children:[{key:"photovoltaic-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.photovoltaicSolarPowerSubMenu",t)}),children:[{key:"vegetative_buffer_01",label:"menu.solarEnergyExamples.VegetativeBuffer"},{key:"solar_canopy_over_bleachers",label:"menu.solarEnergyExamples.SolarCanopyOverBleachers"},{key:"solar_canopy_over_garage",label:"menu.solarEnergyExamples.SolarCanopyOverGarage"},{key:"solar_bus_stop",label:"menu.solarEnergyExamples.SolarBusStop"},{key:"solar_facade_tesla",label:"menu.solarEnergyExamples.SolarFacadeTesla"},{key:"floatovoltaics",label:"menu.solarEnergyExamples.Floatovoltaics"},{key:"rainbow_swash_solar_farm",label:"menu.solarEnergyExamples.RainbowSwashSolarFarmBostonMA"},{key:"mickey_mouse_solar_farm",label:"menu.solarEnergyExamples.MickeyMouseSolarFarmOrlandoFL"},{key:"solar_panels_over_canal",label:"menu.solarEnergyExamples.SolarPanelsOverCanalBakersfieldCA"},{key:"solar_noise_barrier",label:"menu.solarEnergyExamples.SolarNoiseBarrierLexingtonMA"},{key:"solar_farm_hsat_array",label:"menu.solarEnergyExamples.HSATSolarTrackersRaleighNC"},{key:"solar_farm_aadat_array",label:"menu.solarEnergyExamples.AADATSolarTrackersLancasterCA"}].map(J5)},{key:"concentrated-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.concentratedSolarPowerSubMenu",t)}),children:[{key:"nevada_solar_one_parabolic_troughs",label:"menu.solarEnergyExamples.NevadaSolarOneParabolicTroughArray"},{key:"tooele_parabolic_dish_array",label:"menu.solarEnergyExamples.TooeleParabolicDishArray"},{key:"tucson_sundt_station",label:"menu.solarEnergyExamples.TucsonLinearFresnelReflectors"},{key:"ps10_solar_power_tower",label:"menu.solarEnergyExamples.PS10SolarPowerTower"}].map(J5)},{key:"other-types-of-solar-power-examples",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherTypesOfSolarPowerSubMenu",t)}),children:[{key:"solar_updraft_tower_city",label:"menu.solarEnergyExamples.SolarUpdraftTowerInCity"}].map(J5)}]},{key:"built-environment",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.builtEnvironmentSubMenu",t)}),children:[{key:"residential_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.residentialBuildingsSubMenu",t)}),children:[{key:"colonial_house",label:"menu.residentialBuildingExamples.ColonialHouse"},{key:"dutch_colonial_house",label:"menu.residentialBuildingExamples.DutchColonialHouse"},{key:"t_shaped_house",label:"menu.residentialBuildingExamples.TShapedHouse"},{key:"cape_cod_with_garage",label:"menu.residentialBuildingExamples.CapeCodHouseWithGarage"},{key:"solarium",label:"menu.residentialBuildingExamples.Solarium"},{key:"butterfly_roof_house",label:"menu.residentialBuildingExamples.ButterflyRoofHouse"},{key:"adobe_taos_house",label:"menu.residentialBuildingExamples.AdobeTaosHouse"},{key:"ranch_house",label:"menu.residentialBuildingExamples.RanchHouse"},{key:"bonnet_house",label:"menu.residentialBuildingExamples.BonnetHouse"},{key:"barn_house",label:"menu.residentialBuildingExamples.BarnStyleHouse"},{key:"modern_house_01",label:"menu.residentialBuildingExamples.ModernHouse"}].map(J5)},{key:"commercial_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.commercialBuildingsSubMenu",t)}),children:[{key:"white_house",label:"menu.commercialBuildingExamples.WhiteHouse"},{key:"harold_washington_college",label:"menu.commercialBuildingExamples.HaroldWashingtonCollege"},{key:"bilim_mersin_turkiye",label:"menu.commercialBuildingExamples.BilimMersinTurkiye"},{key:"spanish_style_hotel",label:"menu.commercialBuildingExamples.SpanishStyleHotel"},{key:"apartment_building_01",label:"menu.commercialBuildingExamples.ApartmentBuilding"},{key:"office_building_01",label:"menu.commercialBuildingExamples.OfficeBuilding"},{key:"hotel_01",label:"menu.commercialBuildingExamples.Hotel"}].map(J5)},{key:"other_buildings",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.otherBuildingsSubMenu",t)}),children:[{key:"greenhouse",label:"menu.otherBuildingExamples.Greenhouse"},{key:"church_01",label:"menu.residentialBuildingExamples.Church1"},{key:"cathedral_01",label:"menu.residentialBuildingExamples.Cathedral1"},{key:"cathedral_02",label:"menu.residentialBuildingExamples.Cathedral2"},{key:"mosque_01",label:"menu.residentialBuildingExamples.Mosque1"},{key:"pavilion",label:"menu.otherBuildingExamples.Pavilion"},{key:"octagonal_pagoda",label:"menu.otherBuildingExamples.OctagonalPagoda"},{key:"ocean_front",label:"menu.otherBuildingExamples.OceanFront"},{key:"egyptian_pyramids",label:"menu.otherBuildingExamples.EgyptianPyramids"},{key:"mayan_pyramid",label:"menu.otherBuildingExamples.MayanPyramid"},{key:"si_o_se_pol",label:"menu.otherBuildingExamples.SiOSePol"},{key:"stacked_cuboids",label:"menu.otherBuildingExamples.StackedCuboids"}].map(J5)},{key:"building_complexes",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.buildingComplexesSubMenu",t)}),children:[{key:"south_burlington_high_school",label:"menu.buildingComplexExamples.SouthBurlingtonHighSchoolVermont"},{key:"mescalero_apache_school",label:"menu.buildingComplexExamples.MescaleroApacheSchoolNewMexico"}].map(J5)},{key:"urban_planning",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.urbanPlanningSubMenu",t)}),children:[{key:"city_block_heatmap",label:"menu.urbanPlanningExamples.CityBlockHeatmap"},{key:"chicago_skyline",label:"menu.urbanPlanningExamples.ChicagoSkyline"}].map(J5)}]},{key:"artificial-intelligence",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.artificialIntelligenceSubMenu",t)}),children:[{key:"ai_tilt_angle_one_row",label:"menu.artificialIntelligenceExamples.OptimizingTiltAngleOfOneSolarPanelRow"},{key:"ai_tilt_angles_multiple_rows",label:"menu.artificialIntelligenceExamples.OptimizingTiltAnglesOfMultipleSolarPanelRows"},{key:"ai_solar_farm_design",label:"menu.artificialIntelligenceExamples.SolarFarmGenerativeDesign"},{key:"ai_solar_farm_design_block",label:"menu.artificialIntelligenceExamples.SolarFarmGenerativeDesignWithBlock"},{key:"ai_fitchburg_solar_farm",label:"menu.artificialIntelligenceExamples.FitchburgSolarFarmGenerativeDesign"}].map(J5)},{key:"benchmarks",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.benchmarksSubMenu",t)}),children:[{key:"solar_radiation_predicted_vs_measured",label:"menu.benchmarks.SolarRadiationPredictionVsMeasurement"},{key:"bestest_case_600",label:"menu.benchmarks.BESTESTCase600"},{key:"bestest_case_610",label:"menu.benchmarks.BESTESTCase610"},{key:"bestest_case_620",label:"menu.benchmarks.BESTESTCase620"},{key:"bestest_case_630",label:"menu.benchmarks.BESTESTCase630"}].map(J5)}]},lXn=Ho.div` width: 100px; `,sXn=Ho.img` position: absolute; @@ -6930,13 +6930,13 @@ Content-Type: `+c.contentType+`\r align-items: center; user-select: none; z-index: 9; -`,JCe="tutorials-submenu",KCe="examples-submenu",uXn=be.memo(({viewOnly:t,canvas:e})=>{const n=M(pn),o=M(kge),r=dt(Gq),i=M.getState().loggable,a=M.getState().language,l=M.getState().undoManager,s=dt.getState().changed,c=M.getState().cloudFile,u=M.getState().user,d=M.getState().elementsToPaste,f=M.getState().selectedElement;dt(U=>U.contextMenuFlag);const[p,g]=m.useState(!1),[A,y]=m.useState(!1),S=U=>{U&&y(!A)},{t:C}=Xl(),P=m.useMemo(()=>({lng:a}),[a]),v=m.useMemo(()=>ye.isMac(),[]),T=m.useMemo(()=>{const U=ye.getOS();return U&&(U.includes("OS X")||U.includes("Chrome"))?"Ctrl+Alt+H":"Ctrl+Home"},[]),w=U=>{U.keyPath.find(W=>W===JCe||W===KCe)&&x(U.key)},x=U=>{const W=lNn(U);W&&(dt.getState().set(k=>{k.openModelsMap=!1}),!t&&s?yi.confirm({title:C("message.DoYouWantToSaveChanges",P),icon:h.jsx(ny,{}),onOk:()=>b(W),onCancel:()=>{dt.getState().set(k=>{k.waiting=!0}),setTimeout(()=>{o(W)},10)},okText:C("word.Yes",P),cancelText:C("word.No",P)}):(dt.getState().set(k=>{k.waiting=!0}),setTimeout(()=>{o(W)},10)),i&&n(k=>{k.actionInfo={name:"Open Example: "+U,timestamp:new Date().getTime()}}),t||window.history.pushState({},document.title,t1))},b=U=>{c?(n(W=>{W.localContentToImportAfterCloudFileUpdate=U}),dt.getState().setSaveCloudFileFlag(!0)):u.uid?n(W=>{W.localContentToImportAfterCloudFileUpdate=U,W.showCloudFileTitleDialogFlag=!W.showCloudFileTitleDialogFlag,W.showCloudFileTitleDialog=!0}):gn(C("menu.file.ToSaveYourWorkPleaseSignIn",P))},R=()=>{g(!0)},H=()=>{g(!1)},F=d&&d.length>0,E=M.getState().countAllElementsByType(),N=[];return r||N.push({key:"file-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.fileSubMenu",P)}),children:ZNn(t,v,e)}),!r&&!t&&u.uid&&N.push({key:"project-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.projectSubMenu",P)}),children:oUn()}),(f||F||l.hasUndo()||l.hasRedo())&&!r&&N.push({key:"edit-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.editSubMenu",P)}),children:rUn(f,F,l,v)}),r||N.push({key:"view-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.viewSubMenu",P)}),children:mjn(T,v)}),r||N.push({key:"settings-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.settingsSubMenu",P)}),children:yjn()}),r||N.push({key:"accessories-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.view.accessoriesSubMenu",P)}),children:Ajn()}),!r&&E.gotSome()&&N.push({key:"analysis-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.analysisSubMenu",P)}),children:Hjn(E)}),N.push({key:JCe,label:h.jsx(an,{noPadding:!0,children:Y.t("menu.tutorialsSubMenu",P)}),children:iXn(t)}),N.push({key:KCe,label:h.jsx(an,{noPadding:!0,children:Y.t("menu.examplesSubMenu",P)}),children:aXn()}),N.push({key:"public-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.publicSubMenu",P)}),children:gjn(u.uid,t,r)}),N.push({key:"language-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.languageSubMenu",P)}),children:[{key:"language-radio-group",label:h.jsx(pjn,{}),style:{backgroundColor:"white"}}]}),N.push({key:"about-us-window",label:h.jsxs(an,{noPadding:!0,onClick:R,children:[Y.t("menu.AboutUs",P),"..."]})}),h.jsxs(h.Fragment,{children:[h.jsx(rA,{menu:{items:N,onClick:w},trigger:["click"],onOpenChange:S,children:h.jsxs(lXn,{children:[h.jsx(sXn,{src:Dnn,title:C("tooltip.clickToOpenMenu",P)}),h.jsx(cXn,{children:h.jsx("span",{style:{fontSize:"10px",alignContent:"center",cursor:"pointer"},children:C("menu.mainMenu",P)})})]})}),p&&h.jsx(knn,{close:H})]})});var Jnt={exports:{}};/*! +`,JCe="tutorials-submenu",KCe="examples-submenu",uXn=be.memo(({viewOnly:t,canvas:e})=>{const n=M(pn),o=M(kge),r=dt(Gq),i=M.getState().loggable,a=M.getState().language,l=M.getState().undoManager,s=dt.getState().changed,c=M.getState().cloudFile,u=M.getState().user,d=M.getState().elementsToPaste,f=M.getState().selectedElement;dt(U=>U.contextMenuFlag);const[p,g]=m.useState(!1),[A,y]=m.useState(!1),S=U=>{U&&y(!A)},{t:C}=Xl(),P=m.useMemo(()=>({lng:a}),[a]),v=m.useMemo(()=>me.isMac(),[]),T=m.useMemo(()=>{const U=me.getOS();return U&&(U.includes("OS X")||U.includes("Chrome"))?"Ctrl+Alt+H":"Ctrl+Home"},[]),w=U=>{U.keyPath.find(W=>W===JCe||W===KCe)&&x(U.key)},x=U=>{const W=lNn(U);W&&(dt.getState().set(k=>{k.openModelsMap=!1}),!t&&s?yi.confirm({title:C("message.DoYouWantToSaveChanges",P),icon:h.jsx(ny,{}),onOk:()=>b(W),onCancel:()=>{dt.getState().set(k=>{k.waiting=!0}),setTimeout(()=>{o(W)},10)},okText:C("word.Yes",P),cancelText:C("word.No",P)}):(dt.getState().set(k=>{k.waiting=!0}),setTimeout(()=>{o(W)},10)),i&&n(k=>{k.actionInfo={name:"Open Example: "+U,timestamp:new Date().getTime()}}),t||window.history.pushState({},document.title,t1))},b=U=>{c?(n(W=>{W.localContentToImportAfterCloudFileUpdate=U}),dt.getState().setSaveCloudFileFlag(!0)):u.uid?n(W=>{W.localContentToImportAfterCloudFileUpdate=U,W.showCloudFileTitleDialogFlag=!W.showCloudFileTitleDialogFlag,W.showCloudFileTitleDialog=!0}):gn(C("menu.file.ToSaveYourWorkPleaseSignIn",P))},R=()=>{g(!0)},H=()=>{g(!1)},F=d&&d.length>0,E=M.getState().countAllElementsByType(),N=[];return r||N.push({key:"file-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.fileSubMenu",P)}),children:ZNn(t,v,e)}),!r&&!t&&u.uid&&N.push({key:"project-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.projectSubMenu",P)}),children:oUn()}),(f||F||l.hasUndo()||l.hasRedo())&&!r&&N.push({key:"edit-sub-menu",label:h.jsx(an,{noPadding:!0,children:C("menu.editSubMenu",P)}),children:rUn(f,F,l,v)}),r||N.push({key:"view-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.viewSubMenu",P)}),children:mjn(T,v)}),r||N.push({key:"settings-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.settingsSubMenu",P)}),children:yjn()}),r||N.push({key:"accessories-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.view.accessoriesSubMenu",P)}),children:Ajn()}),!r&&E.gotSome()&&N.push({key:"analysis-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.analysisSubMenu",P)}),children:Hjn(E)}),N.push({key:JCe,label:h.jsx(an,{noPadding:!0,children:Y.t("menu.tutorialsSubMenu",P)}),children:iXn(t)}),N.push({key:KCe,label:h.jsx(an,{noPadding:!0,children:Y.t("menu.examplesSubMenu",P)}),children:aXn()}),N.push({key:"public-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.publicSubMenu",P)}),children:gjn(u.uid,t,r)}),N.push({key:"language-sub-menu",label:h.jsx(an,{noPadding:!0,children:Y.t("menu.languageSubMenu",P)}),children:[{key:"language-radio-group",label:h.jsx(pjn,{}),style:{backgroundColor:"white"}}]}),N.push({key:"about-us-window",label:h.jsxs(an,{noPadding:!0,onClick:R,children:[Y.t("menu.AboutUs",P),"..."]})}),h.jsxs(h.Fragment,{children:[h.jsx(rA,{menu:{items:N,onClick:w},trigger:["click"],onOpenChange:S,children:h.jsxs(lXn,{children:[h.jsx(sXn,{src:Dnn,title:C("tooltip.clickToOpenMenu",P)}),h.jsx(cXn,{children:h.jsx("span",{style:{fontSize:"10px",alignContent:"center",cursor:"pointer"},children:C("menu.mainMenu",P)})})]})}),p&&h.jsx(knn,{close:H})]})});var Jnt={exports:{}};/*! * JavaScript Cookie v2.2.1 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license - */(function(t,e){(function(n){var o;if(t.exports=n(),o=!0,!o){var r=window.Cookies,i=window.Cookies=n();i.noConflict=function(){return window.Cookies=r,i}}})(function(){function n(){for(var i=0,a={};i"u")){d=n({path:"/"},a.defaults,d),typeof d.expires=="number"&&(d.expires=new Date(new Date*1+d.expires*864e5)),d.expires=d.expires?d.expires.toUTCString():"";try{var f=JSON.stringify(u);/^[\{\[]/.test(f)&&(u=f)}catch{}u=i.write?i.write(u,c):encodeURIComponent(String(u)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),c=encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var p="";for(var g in d)d[g]&&(p+="; "+g,d[g]!==!0&&(p+="="+d[g].split(";")[0]));return document.cookie=c+"="+u+p}}function s(c,u){if(!(typeof document>"u")){for(var d={},f=document.cookie?document.cookie.split("; "):[],p=0;p=0)&&(n[r]=t[r]);return n}var ife={TOP:"top",BOTTOM:"bottom",NONE:"none"},eJ;(function(t){t.STRICT="strict",t.LAX="lax",t.NONE="none"})(eJ||(eJ={}));var afe={HIDDEN:"hidden",SHOW:"show",BY_COOKIE_VALUE:"byCookieValue"},Knt="CookieConsent",gXn=["children"],mXn=function(e){var n=e.children,o=pXn(e,gXn);return be.createElement("button",Object.assign({},o),n)},GD={disableStyles:!1,hideOnAccept:!0,hideOnDecline:!0,location:ife.BOTTOM,visible:afe.BY_COOKIE_VALUE,onAccept:function(e){},onDecline:function(){},cookieName:Knt,cookieValue:"true",declineCookieValue:"false",setDeclineCookie:!0,buttonText:"I understand",declineButtonText:"I decline",debug:!1,expires:365,containerClasses:"CookieConsent",contentClasses:"",buttonClasses:"",buttonWrapperClasses:"",declineButtonClasses:"",buttonId:"rcc-confirm-button",declineButtonId:"rcc-decline-button",extraCookieOptions:{},disableButtonStyles:!1,enableDeclineButton:!1,flipButtons:!1,sameSite:eJ.LAX,ButtonComponent:mXn,overlay:!1,overlayClasses:"",onOverlayClick:function(){},acceptOnOverlayClick:!1,ariaAcceptLabel:"Accept cookies",ariaDeclineLabel:"Decline cookies",acceptOnScroll:!1,acceptOnScrollPercentage:25,customContentAttributes:{},customContainerAttributes:{},customButtonProps:{},customDeclineButtonProps:{},customButtonWrapperAttributes:{},style:{},buttonStyle:{},declineButtonStyle:{},contentStyle:{},overlayStyle:{}},yXn={visible:!1,style:{alignItems:"baseline",background:"#353535",color:"white",display:"flex",flexWrap:"wrap",justifyContent:"space-between",left:"0",position:"fixed",width:"100%",zIndex:"999"},buttonStyle:{background:"#ffd42d",border:"0",borderRadius:"0px",boxShadow:"none",color:"black",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},declineButtonStyle:{background:"#c12a2a",border:"0",borderRadius:"0px",boxShadow:"none",color:"#e5e5e5",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},contentStyle:{flex:"1 0 300px",margin:"15px"},overlayStyle:{position:"fixed",left:0,top:0,width:"100%",height:"100%",zIndex:"999",backgroundColor:"rgba(0,0,0,0.3)"}},AXn=function(e){e===void 0&&(e=Knt);var n=ZX.get(e);return n===void 0?ZX.get(qnt(e)):n},qnt=function(e){return e+"-legacy"},$nt=function(t){hXn(e,t);function e(){var o;return o=t.apply(this,arguments)||this,o.state=yXn,o.handleScroll=function(){var r=xm({},GD,o.props),i=r.acceptOnScrollPercentage,a=document.documentElement,l=document.body,s="scrollTop",c="scrollHeight",u=(a[s]||l[s])/((a[c]||l[c])-a.clientHeight)*100;u>i&&o.accept(!0)},o.removeScrollListener=function(){var r=o.props.acceptOnScroll;r&&window.removeEventListener("scroll",o.handleScroll)},o}var n=e.prototype;return n.componentDidMount=function(){var r=this.props.debug;(this.getCookieValue()===void 0||r)&&(this.setState({visible:!0}),this.props.acceptOnScroll&&window.addEventListener("scroll",this.handleScroll,{passive:!0}))},n.componentWillUnmount=function(){this.removeScrollListener()},n.accept=function(r){var i;r===void 0&&(r=!1);var a=xm({},GD,this.props),l=a.cookieName,s=a.cookieValue,c=a.hideOnAccept,u=a.onAccept;this.setCookie(l,s),u((i=r)!=null?i:!1),c&&(this.setState({visible:!1}),this.removeScrollListener())},n.overlayClick=function(){var r=xm({},GD,this.props),i=r.acceptOnOverlayClick,a=r.onOverlayClick;i&&this.accept(),a()},n.decline=function(){var r=xm({},GD,this.props),i=r.cookieName,a=r.declineCookieValue,l=r.hideOnDecline,s=r.onDecline,c=r.setDeclineCookie;c&&this.setCookie(i,a),s(),l&&this.setState({visible:!1})},n.setCookie=function(r,i){var a=this.props,l=a.extraCookieOptions,s=a.expires,c=a.sameSite,u=this.props.cookieSecurity;u===void 0&&(u=window.location?window.location.protocol==="https:":!0);var d=xm({expires:s},l,{sameSite:c,secure:u});c===eJ.NONE&&ZX.set(qnt(r),i,d),ZX.set(r,i,d)},n.getCookieValue=function(){var r=this.props.cookieName;return AXn(r)},n.render=function(){var r=this;switch(this.props.visible){case afe.HIDDEN:return null;case afe.BY_COOKIE_VALUE:if(!this.state.visible)return null;break}var i=this.props,a=i.location,l=i.style,s=i.buttonStyle,c=i.declineButtonStyle,u=i.contentStyle,d=i.disableStyles,f=i.buttonText,p=i.declineButtonText,g=i.containerClasses,A=i.contentClasses,y=i.buttonClasses,S=i.buttonWrapperClasses,C=i.declineButtonClasses,P=i.buttonId,v=i.declineButtonId,T=i.disableButtonStyles,w=i.enableDeclineButton,x=i.flipButtons,b=i.ButtonComponent,R=i.overlay,H=i.overlayClasses,F=i.overlayStyle,E=i.ariaAcceptLabel,N=i.ariaDeclineLabel,U=i.customContainerAttributes,W=i.customContentAttributes,k=i.customButtonProps,D=i.customDeclineButtonProps,L=i.customButtonWrapperAttributes,j={},B={},O={},V={},G={};switch(d?(j=Object.assign({},l),B=Object.assign({},s),O=Object.assign({},c),V=Object.assign({},u),G=Object.assign({},F)):(j=Object.assign({},xm({},this.state.style,l)),V=Object.assign({},xm({},this.state.contentStyle,u)),G=Object.assign({},xm({},this.state.overlayStyle,F)),T?(B=Object.assign({},s),O=Object.assign({},c)):(B=Object.assign({},xm({},this.state.buttonStyle,s)),O=Object.assign({},xm({},this.state.declineButtonStyle,c)))),a){case ife.TOP:j.top="0";break;case ife.BOTTOM:j.bottom="0";break}var q=[];return w&&q.push(be.createElement(b,Object.assign({key:"declineButton",style:O,className:C,id:v,"aria-label":N,onClick:function(){r.decline()}},D),p)),q.push(be.createElement(b,Object.assign({key:"acceptButton",style:B,className:y,id:P,"aria-label":E,onClick:function(){r.accept()}},k),f)),x&&q.reverse(),be.createElement(fXn,{condition:R,wrapper:function(ie){return be.createElement("div",{style:G,className:H,onClick:function(){r.overlayClick()}},ie)}},be.createElement("div",Object.assign({className:""+g,style:j},U),be.createElement("div",Object.assign({style:V,className:A},W),this.props.children),be.createElement("div",Object.assign({className:""+S},L),q.map(function($){return $}))))},e}(m.Component);$nt.defaultProps=GD;const wXn=be.memo(()=>{const t=$t();return h.jsx($nt,{location:"bottom",buttonText:Y.t("cookie.Accept",t),cookieName:"AladdinCookieName",style:{background:"#2B373B",textAlign:"center",zIndex:99999},buttonStyle:{color:"#4e503b",fontSize:"12px"},expires:150,children:Y.t("cookie.Statement",t)})}),vXn=.7,xXn=42.2845513,bXn=vXn/Math.cos(ye.toRadians(xXn)),SXn=be.memo(()=>{const t=M(pn),e=M(s0),n=M(Mb),o=M(Sge),r=M(EBe),i=m.useRef(null),a=Hb(r==="satellite"||r==="hybrid"?LQt(640,e,n,o):WQt(640,e,n,o));let l;o===21?l=.5:o===20?l=1:l=Math.pow(2,20-o);const s=bXn*Math.cos(ye.toRadians(e))*l,c=u=>{u.intersections.length>0&&u.intersections[0].object===i.current&&t(f=>{Px.selectNone(f),f.pastePoint.copy(u.intersections[0].point),f.clickObjectType=z.Ground,f.contextMenuObjectType=z.Ground,f.pasteNormal=ko})};return a?h.jsxs("mesh",{rotation:[0,0,0],position:[0,0,0],renderOrder:-1,scale:[s,s,1],receiveShadow:!0,ref:i,onContextMenu:c,children:[h.jsx("planeGeometry",{args:[100,100]}),h.jsx("meshStandardMaterial",{attach:"material",depthTest:!1,side:ti,map:a,opacity:1})]}):h.jsx(h.Fragment,{})}),TXn=({foundation:t})=>{const e=$t(),n=()=>{M.getState().set(r=>{for(const i of r.elements)if(i.id===t.id){i.notBuilding=!i.notBuilding;break}})},o=r=>{const i={name:"Building",timestamp:Date.now(),checked:r.target.checked,selectedElementId:t.id,selectedElementType:t.type,undo:()=>n(),redo:()=>n()};M.getState().addUndoable(i),n()};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!t.notBuilding,onChange:o,children:Y.t("word.Building",e)})})},qCe=({foundation:t,lock:e,count:n})=>{const o=$t(),r=e?"foundationMenu.LockAllUnlockedElementsOnThisFoundation":"foundationMenu.UnlockAllLockedElementsOnThisFoundation",i=()=>{const a=new Map;for(const c of M.getState().elements)(c.foundationId===t.id||c.id===t.id)&&a.set(c.id,!!c.locked);const s={name:e?"Lock All Unlocked Offsprings":"Unlock All Locked Offsprings",timestamp:Date.now(),oldValues:a,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())M.getState().updateElementLockById(c,u)},redo:()=>{M.getState().updateElementLockByFoundationId(t.id,e)}};M.getState().addUndoable(s),M.getState().updateElementLockByFoundationId(t.id,e)};return h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t(r,o)," (",n,")"]})},Dae=({foundation:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllElementsOnFoundationByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.foundationId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Foundation`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{noPadding:!0,onClick:l,children:r})},PXn=({foundation:t})=>{const e=M.getState().set,n=$t(),o=()=>{e(a=>{a.objectTypeToAdd=z.Polygon});const r=M.getState().addElement(t,new ae(t.cx,t.cy,t.lz),ko),i={name:"Add",timestamp:Date.now(),addedElement:r,undo:()=>{M.getState().removeElementById(i.addedElement.id,!1)},redo:()=>{e(a=>{a.elements.push(i.addedElement),a.selectedElement=i.addedElement})}};M.getState().addUndoable(i),e(a=>{a.objectTypeToAdd=z.None})};return h.jsx(an,{onClick:o,children:Y.t("foundationMenu.AddPolygon",n)})},CXn=({foundation:t})=>{var a;const[e,n]=m.useState((a=t==null?void 0:t.hvacSystem)==null?void 0:a.id),o=l=>{let s=l.target.value;s.trim().length===0&&(s=void 0),n(s)},r=(l,s)=>{M.getState().set(c=>{for(const u of c.elements)if(u.type===z.Foundation&&u.id===l){const d=u;d.hvacSystem?d.hvacSystem.id=s:d.hvacSystem={thermostatSetpoint:20,temperatureThreshold:3,id:s};break}})},i=l=>{var d;const s=(d=t.hvacSystem)==null?void 0:d.id,c=l&&l.trim().length>0?l:void 0,u={name:"Change HVAC ID",timestamp:Date.now(),oldValue:s,newValue:c,undo:()=>{r(t.id,u.oldValue)},redo:()=>{r(t.id,u.newValue)}};M.getState().addUndoable(u),r(t.id,c)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{style:{width:"40px",paddingLeft:"0px",textAlign:"left"},children:"ID:"}),h.jsx(jl,{style:{width:"180px"},value:e,onChange:o,onPressEnter:()=>i(e),onBlur:()=>i(e)})]})},RXn=({foundation:t})=>{var r;const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i){const c=s;c.hvacSystem?c.hvacSystem.thermostatSetpoint=a:c.hvacSystem={thermostatSetpoint:a,temperatureThreshold:3};break}})},o=i=>{var c;if(i===null)return;const a=((c=t.hvacSystem)==null?void 0:c.thermostatSetpoint)??20,l=i,s={name:"Change Thermostat Setpoint",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(t.id,s.oldValue)},redo:()=>{n(t.id,s.newValue)}};M.getState().addUndoable(s),n(t.id,l)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{style:{width:"160px"},children:Y.t("word.ThermostatSetpoint",e)+":"}),h.jsx(Sn,{min:0,max:30,step:1,style:{width:60},precision:1,value:((r=t.hvacSystem)==null?void 0:r.thermostatSetpoint)??20,onChange:o})]})},HXn=({foundation:t})=>{var r;const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i){const c=s;c.hvacSystem?c.hvacSystem.temperatureThreshold=a:c.hvacSystem={thermostatSetpoint:20,temperatureThreshold:a};break}})},o=i=>{var c;if(i===null)return;const a=((c=t.hvacSystem)==null?void 0:c.temperatureThreshold)??3,l=i,s={name:"Change Temperature Tolerance Threshold",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(t.id,s.oldValue)},redo:()=>{n(t.id,s.newValue)}};M.getState().addUndoable(s),n(t.id,l)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{title:Y.t("word.TemperatureToleranceThresholdExplanation",e),style:{width:"160px"},children:Y.t("word.TemperatureToleranceThreshold",e)+":"}),h.jsx(Sn,{min:0,max:30,step:1,style:{width:60},precision:1,value:((r=t.hvacSystem)==null?void 0:r.temperatureThreshold)??3,onChange:o}),h.jsx(on,{style:{paddingLeft:"10px"},children:"°C"})]})},MXn=({foundation:t})=>{const e=$t(),n=(t==null?void 0:t.solarStructure)??Dn.None,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i&&!s.locked){s.solarStructure=a;break}})},r=i=>{const a=t.solarStructure,l=i.target.value,s={name:"Select Solar Structure for Selected Foundation",timestamp:Date.now(),oldValue:a,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{o(s.changedElementId,s.oldValue)},redo:()=>{o(s.changedElementId,s.newValue)}};M.getState().addUndoable(s),o(t.id,l)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:n,onChange:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Dn.None,children:Y.t("word.None",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.FocusPipe,children:Y.t("solarAbsorberPipeMenu.AbsorberPipeForFresnelReflectors",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.FocusTower,children:Y.t("solarPowerTowerMenu.ReceiverTowerForHeliostats",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.UpdraftTower,children:Y.t("solarUpdraftTowerMenu.SolarUpdraftTower",e)})]})})})},Qnt="/aladdin/assets/foundation_01_menu-DJ2ZRFYJ.png",Znt="/aladdin/assets/foundation_02_menu-D6HXceyz.png",eot="/aladdin/assets/foundation_03_menu-BFLw0RU7.png",tot="/aladdin/assets/foundation_04_menu-DtGEusM9.png",not="/aladdin/assets/foundation_05_menu-BGUU1Wal.png",oot="/aladdin/assets/foundation_06_menu-hg_Rf0EG.png",rot="/aladdin/assets/foundation_07_menu-BM9bFpzu.png",iot=t=>{const[e,n]=m.useState((t==null?void 0:t.label)??"");return m.useEffect(()=>{t!=null&&t.label&&n(t.label)},[t==null?void 0:t.id]),{labelText:e,setLabelText:n}},aot=t=>{const e=M(En),n=M(_wt);return()=>{if(t){const o={name:"Show Label for "+t.type,timestamp:Date.now(),checked:!t.showLabel,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!o.checked)},redo:()=>{n(t.id,o.checked)}};e(o),n(t.id,!t.showLabel)}}},lot=(t,e)=>{const n=M(Vwt),o=M(En);return()=>{if(t){const r=t.label,i={name:"Set Label for "+t.type,timestamp:Date.now(),oldValue:r,newValue:e,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};o(i),n(t.id,e)}}},IXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelFontSize=r;break}})};return r=>{if(t){const i=t.labelFontSize??20,a=r,l={name:"Set Label Font Size for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},zXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelSize=r;break}})};return r=>{if(t){const i=t.labelSize??.2,a=r,l={name:"Set Label Size for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},DXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelColor=r;break}})};return r=>{if(t){const i=t.labelColor??"white",a=r,l={name:"Set Label Color for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},EXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelHeight=r;break}})};return r=>{if(t){const i=t.labelHeight??t.lz/2+.2,a=r,l={name:"Set Label Height for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},uo=t=>M(e=>{if(!e.selectedElement)return;const n=e.elements.find(o=>{var r;return o.id===((r=e.selectedElement)==null?void 0:r.id)});if(!n||!t||n.type===t)return n}),ZZ=t=>{const[e,n]=m.useState(t);return[e,r=>{n(r.hex)}]},so=({width:t,title:e,rejectedMessage:n,onApply:o,onClose:r,onClickOk:i,onClickCancel:a,children:l})=>{const s=M(Qn),c=M(Xi),{t:u}=Xl(),d=$t(),[f,p]=m.useState({left:0,top:0,bottom:0,right:0}),[g,A]=m.useState(!1),y=m.useRef(null),S=(T,w)=>{if(y.current){const{clientWidth:x,clientHeight:b}=window.document.documentElement,R=y.current.getBoundingClientRect();p({left:-R.left+w.x,right:x-(R.right-w.x),top:-R.top+w.y,bottom:b-((R==null?void 0:R.bottom)-w.y)})}},C=m.useCallback(()=>{i?i():(o(),r(),s(0))},[o,i,r,s]),P=()=>{a?a():(r(),c())};m.useEffect(()=>{const T=w=>{w.key==="Enter"&&C()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[C]);const v=!!n&&n.length>0;return h.jsxs(yi,{width:t,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>A(!0),onMouseOut:()=>A(!1),children:[e,v&&h.jsx("span",{style:{color:"red",fontWeight:"bold"},children:n})]}),footer:[h.jsx(io,{onClick:o,children:u("word.Apply",d)},"Apply"),h.jsx(io,{onClick:P,children:u("word.Cancel",d)},"Cancel"),h.jsx(io,{type:"primary",onClick:C,children:u("word.OK",d)},"OK")],onCancel:r,maskClosable:!1,destroyOnClose:!1,modalRender:T=>h.jsx(Bi,{disabled:!g,bounds:f,onStart:(w,x)=>S(w,x),children:h.jsx("div",{ref:y,children:T})}),children:[h.jsx(mue,{style:{marginTop:0,marginBottom:"4px",border:"none"}}),l,h.jsx(mue,{style:{marginTop:0,marginBottom:"4px",border:"none"}})]})},FXn=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState((s==null?void 0:s.textureType)??_i.NoTexture),d=$t(),{Option:f}=Uo,p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){x.textureType=T;break}})},g=v=>{e(T=>{for(const w of T.elements)w.type===z.Foundation&&!w.locked&&(w.textureType=v)})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)&&v!==T.textureType)return!0;break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&v!==T.textureType)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0}return!1},y=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&v.has(x.id))if(T!==void 0)x.textureType=T;else{const b=v.get(x.id);b!==void 0&&(x.textureType=b)}})},S=v=>{if(s&&A(v)){switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??_i.NoTexture);const w={name:"Set Texture for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,w.newValue)}};r(w),y(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)x.type===z.Foundation&&T.set(x.id,x.textureType??_i.NoTexture);const w={name:"Set Texture for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),p(s.id,v),l(a+1);break}}e(T=>{T.actionState.foundationTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:500,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:_i.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},_i.NoTexture),h.jsxs(f,{value:_i.Texture01,children:[h.jsx("img",{alt:_i.Texture01,src:Qnt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture01",d)]},_i.Texture01),h.jsxs(f,{value:_i.Texture02,children:[h.jsx("img",{alt:_i.Texture02,src:Znt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture02",d)]},_i.Texture02),h.jsxs(f,{value:_i.Texture03,children:[h.jsx("img",{alt:_i.Texture03,src:eot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture03",d)]},_i.Texture03),h.jsxs(f,{value:_i.Texture04,children:[h.jsx("img",{alt:_i.Texture04,src:tot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture04",d)]},_i.Texture04),h.jsxs(f,{value:_i.Texture05,children:[h.jsx("img",{alt:_i.Texture05,src:not,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture05",d)]},_i.Texture05),h.jsxs(f,{value:_i.Texture06,children:[h.jsx("img",{alt:_i.Texture06,src:oot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture06",d)]},_i.Texture06),h.jsxs(f,{value:_i.Texture07,children:[h.jsx("img",{alt:_i.Texture07,src:rot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture07",d)]},_i.Texture07)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})};var km={},XN={},kXn=typeof yc=="object"&&yc&&yc.Object===Object&&yc,sot=kXn,LXn=sot,WXn=typeof self=="object"&&self&&self.Object===Object&&self,NXn=LXn||WXn||Function("return this")(),l5=NXn,UXn=l5,jXn=UXn.Symbol,pM=jXn,$Ce=pM,cot=Object.prototype,BXn=cot.hasOwnProperty,YXn=cot.toString,eD=$Ce?$Ce.toStringTag:void 0;function OXn(t){var e=BXn.call(t,eD),n=t[eD];try{t[eD]=void 0;var o=!0}catch{}var r=YXn.call(t);return o&&(e?t[eD]=n:delete t[eD]),r}var VXn=OXn,_Xn=Object.prototype,GXn=_Xn.toString;function XXn(t){return GXn.call(t)}var JXn=XXn,QCe=pM,KXn=VXn,qXn=JXn,$Xn="[object Null]",QXn="[object Undefined]",ZCe=QCe?QCe.toStringTag:void 0;function ZXn(t){return t==null?t===void 0?QXn:$Xn:ZCe&&ZCe in Object(t)?KXn(t):qXn(t)}var PA=ZXn,eJn=Array.isArray,xp=eJn;function tJn(t){return t!=null&&typeof t=="object"}var s5=tJn,nJn=PA,oJn=xp,rJn=s5,iJn="[object String]";function aJn(t){return typeof t=="string"||!oJn(t)&&rJn(t)&&nJn(t)==iJn}var uot=aJn;const JN=Wi(uot);function lJn(t){return function(e,n,o){for(var r=-1,i=Object(e),a=o(e),l=a.length;l--;){var s=a[t?l:++r];if(n(i[s],s,i)===!1)break}return e}}var sJn=lJn,cJn=sJn,uJn=cJn(),dJn=uJn;function fJn(t,e){for(var n=-1,o=Array(t);++n-1&&t%1==0&&t-1&&t%1==0&&t<=HJn}var j5e=MJn,IJn=PA,zJn=j5e,DJn=s5,EJn="[object Arguments]",FJn="[object Array]",kJn="[object Boolean]",LJn="[object Date]",WJn="[object Error]",NJn="[object Function]",UJn="[object Map]",jJn="[object Number]",BJn="[object Object]",YJn="[object RegExp]",OJn="[object Set]",VJn="[object String]",_Jn="[object WeakMap]",GJn="[object ArrayBuffer]",XJn="[object DataView]",JJn="[object Float32Array]",KJn="[object Float64Array]",qJn="[object Int8Array]",$Jn="[object Int16Array]",QJn="[object Int32Array]",ZJn="[object Uint8Array]",eKn="[object Uint8ClampedArray]",tKn="[object Uint16Array]",nKn="[object Uint32Array]",dc={};dc[JJn]=dc[KJn]=dc[qJn]=dc[$Jn]=dc[QJn]=dc[ZJn]=dc[eKn]=dc[tKn]=dc[nKn]=!0;dc[EJn]=dc[FJn]=dc[GJn]=dc[kJn]=dc[XJn]=dc[LJn]=dc[WJn]=dc[NJn]=dc[UJn]=dc[jJn]=dc[BJn]=dc[YJn]=dc[OJn]=dc[VJn]=dc[_Jn]=!1;function oKn(t){return DJn(t)&&zJn(t.length)&&!!dc[IJn(t)]}var rKn=oKn;function iKn(t){return function(e){return t(e)}}var eee=iKn,nJ={exports:{}};nJ.exports;(function(t,e){var n=sot,o=e&&!e.nodeType&&e,r=o&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===o,a=i&&n.process,l=function(){try{var s=r&&r.require&&r.require("util").types;return s||a&&a.binding&&a.binding("util")}catch{}}();t.exports=l})(nJ,nJ.exports);var B5e=nJ.exports,aKn=rKn,lKn=eee,tRe=B5e,nRe=tRe&&tRe.isTypedArray,sKn=nRe?lKn(nRe):aKn,fot=sKn,cKn=hJn,uKn=W5e,dKn=xp,fKn=N5e,hKn=U5e,pKn=fot,gKn=Object.prototype,mKn=gKn.hasOwnProperty;function yKn(t,e){var n=dKn(t),o=!n&&uKn(t),r=!n&&!o&&fKn(t),i=!n&&!o&&!r&&pKn(t),a=n||o||r||i,l=a?cKn(t.length,String):[],s=l.length;for(var c in t)(e||mKn.call(t,c))&&!(a&&(c=="length"||r&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||hKn(c,s)))&&l.push(c);return l}var hot=yKn,AKn=Object.prototype;function wKn(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||AKn;return t===n}var Y5e=wKn;function vKn(t,e){return function(n){return t(e(n))}}var pot=vKn,xKn=pot,bKn=xKn(Object.keys,Object),SKn=bKn,TKn=Y5e,PKn=SKn,CKn=Object.prototype,RKn=CKn.hasOwnProperty;function HKn(t){if(!TKn(t))return PKn(t);var e=[];for(var n in Object(t))RKn.call(t,n)&&n!="constructor"&&e.push(n);return e}var MKn=HKn;function IKn(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var c5=IKn;const gM=Wi(c5);var zKn=PA,DKn=c5,EKn="[object AsyncFunction]",FKn="[object Function]",kKn="[object GeneratorFunction]",LKn="[object Proxy]";function WKn(t){if(!DKn(t))return!1;var e=zKn(t);return e==FKn||e==kKn||e==EKn||e==LKn}var O5e=WKn;const xa=Wi(O5e);var NKn=O5e,UKn=j5e;function jKn(t){return t!=null&&UKn(t.length)&&!NKn(t)}var mM=jKn,BKn=hot,YKn=MKn,OKn=mM;function VKn(t){return OKn(t)?BKn(t):YKn(t)}var yM=VKn,_Kn=dJn,GKn=yM;function XKn(t,e){return t&&_Kn(t,e,GKn)}var V5e=XKn;function JKn(t){return t}var oS=JKn,KKn=oS;function qKn(t){return typeof t=="function"?t:KKn}var $Kn=qKn,QKn=V5e,ZKn=$Kn;function eqn(t,e){return t&&QKn(t,ZKn(e))}var _5e=eqn,tqn=pot,nqn=tqn(Object.getPrototypeOf,Object),G5e=nqn,oqn=PA,rqn=G5e,iqn=s5,aqn="[object Object]",lqn=Function.prototype,sqn=Object.prototype,got=lqn.toString,cqn=sqn.hasOwnProperty,uqn=got.call(Object);function dqn(t){if(!iqn(t)||oqn(t)!=aqn)return!1;var e=rqn(t);if(e===null)return!0;var n=cqn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&got.call(n)==uqn}var mot=dqn;const fqn=Wi(mot);function hqn(t,e){for(var n=-1,o=t==null?0:t.length,r=Array(o);++n-1}var Mqn=Hqn,Iqn=nee;function zqn(t,e){var n=this.__data__,o=Iqn(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}var Dqn=zqn,Eqn=gqn,Fqn=Sqn,kqn=Cqn,Lqn=Mqn,Wqn=Dqn;function AM(t){var e=-1,n=t==null?0:t.length;for(this.clear();++el))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&GQn?new YQn:void 0;for(i.set(t,e),i.set(e,t);++d0&&arguments[0]!==void 0?arguments[0]:[],n=[];return(0,Hno.default)(e,function(o){Array.isArray(o)?t(o).map(function(r){return n.push(r)}):(0,Cno.default)(o)?(0,Tno.default)(o,function(r,i){r===!0&&n.push(i),n.push(i+"-"+r)}):(0,bno.default)(o)&&n.push(o)}),n};XN.default=Mno;var KN={};function Ino(t,e){for(var n=-1,o=t==null?0:t.length;++n1&&arguments[1]!==void 0?arguments[1]:[],o=e.default&&(0,Kio.default)(e.default)||{};return n.map(function(r){var i=e[r];return i&&(0,Xio.default)(i,function(a,l){o[l]||(o[l]={}),o[l]=qio({},o[l],i[l])}),r}),o};KN.default=$io;var qN={};Object.defineProperty(qN,"__esModule",{value:!0});qN.autoprefix=void 0;var Qio=_5e,LRe=eao(Qio),Zio=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){lao(r,o);function r(){var i,a,l,s;aao(this,r);for(var c=arguments.length,u=Array(c),d=0;d1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){hao(r,o);function r(){var i,a,l,s;fao(this,r);for(var c=arguments.length,u=Array(c),d=0;d1&&arguments[1]!==void 0?arguments[1]:!0;o[a]=l};return e===0&&r("first-child"),e===n-1&&r("last-child"),(e===0||e%2===0)&&r("even"),Math.abs(e%2)===1&&r("odd"),r("nth-child",e),o};s9e.default=gao;Object.defineProperty(km,"__esModule",{value:!0});km.ReactCSS=km.loop=km.handleActive=c9e=km.handleHover=km.hover=void 0;var mao=XN,yao=TM(mao),Aao=KN,wao=TM(Aao),vao=qN,xao=TM(vao),bao=$N,Got=TM(bao),Sao=QN,Tao=TM(Sao),Pao=s9e,Cao=TM(Pao);function TM(t){return t&&t.__esModule?t:{default:t}}km.hover=Got.default;var c9e=km.handleHover=Got.default;km.handleActive=Tao.default;km.loop=Cao.default;var Rao=km.ReactCSS=function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),r=1;rl?f=1:f=Math.round(d*100/l)/100,n.a!==f)return{h:n.h,s:n.s,l:n.l,a:f,source:"rgb"}}else{var p=void 0;if(u<0?p=0:u>a?p=1:p=Math.round(u*100/a)/100,r!==p)return{h:n.h,s:n.s,l:n.l,a:p,source:"rgb"}}return null},Nae={},Mao=function(e,n,o,r){if(typeof document>"u"&&!r)return null;var i=r?new r:document.createElement("canvas");i.width=o*2,i.height=o*2;var a=i.getContext("2d");return a?(a.fillStyle=e,a.fillRect(0,0,i.width,i.height),a.fillStyle=n,a.fillRect(0,0,o,o),a.translate(o,o),a.fillRect(0,0,o,o),i.toDataURL()):null},Iao=function(e,n,o,r){var i=e+"-"+n+"-"+o+(r?"-server":"");if(Nae[i])return Nae[i];var a=Mao(e,n,o,r);return Nae[i]=a,a},URe=Object.assign||function(t){for(var e=1;e"u")){d=n({path:"/"},a.defaults,d),typeof d.expires=="number"&&(d.expires=new Date(new Date*1+d.expires*864e5)),d.expires=d.expires?d.expires.toUTCString():"";try{var f=JSON.stringify(u);/^[\{\[]/.test(f)&&(u=f)}catch{}u=i.write?i.write(u,c):encodeURIComponent(String(u)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),c=encodeURIComponent(String(c)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var p="";for(var g in d)d[g]&&(p+="; "+g,d[g]!==!0&&(p+="="+d[g].split(";")[0]));return document.cookie=c+"="+u+p}}function s(c,u){if(!(typeof document>"u")){for(var d={},f=document.cookie?document.cookie.split("; "):[],p=0;p=0)&&(n[r]=t[r]);return n}var ife={TOP:"top",BOTTOM:"bottom",NONE:"none"},eJ;(function(t){t.STRICT="strict",t.LAX="lax",t.NONE="none"})(eJ||(eJ={}));var afe={HIDDEN:"hidden",SHOW:"show",BY_COOKIE_VALUE:"byCookieValue"},Knt="CookieConsent",gXn=["children"],mXn=function(e){var n=e.children,o=pXn(e,gXn);return be.createElement("button",Object.assign({},o),n)},GD={disableStyles:!1,hideOnAccept:!0,hideOnDecline:!0,location:ife.BOTTOM,visible:afe.BY_COOKIE_VALUE,onAccept:function(e){},onDecline:function(){},cookieName:Knt,cookieValue:"true",declineCookieValue:"false",setDeclineCookie:!0,buttonText:"I understand",declineButtonText:"I decline",debug:!1,expires:365,containerClasses:"CookieConsent",contentClasses:"",buttonClasses:"",buttonWrapperClasses:"",declineButtonClasses:"",buttonId:"rcc-confirm-button",declineButtonId:"rcc-decline-button",extraCookieOptions:{},disableButtonStyles:!1,enableDeclineButton:!1,flipButtons:!1,sameSite:eJ.LAX,ButtonComponent:mXn,overlay:!1,overlayClasses:"",onOverlayClick:function(){},acceptOnOverlayClick:!1,ariaAcceptLabel:"Accept cookies",ariaDeclineLabel:"Decline cookies",acceptOnScroll:!1,acceptOnScrollPercentage:25,customContentAttributes:{},customContainerAttributes:{},customButtonProps:{},customDeclineButtonProps:{},customButtonWrapperAttributes:{},style:{},buttonStyle:{},declineButtonStyle:{},contentStyle:{},overlayStyle:{}},yXn={visible:!1,style:{alignItems:"baseline",background:"#353535",color:"white",display:"flex",flexWrap:"wrap",justifyContent:"space-between",left:"0",position:"fixed",width:"100%",zIndex:"999"},buttonStyle:{background:"#ffd42d",border:"0",borderRadius:"0px",boxShadow:"none",color:"black",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},declineButtonStyle:{background:"#c12a2a",border:"0",borderRadius:"0px",boxShadow:"none",color:"#e5e5e5",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},contentStyle:{flex:"1 0 300px",margin:"15px"},overlayStyle:{position:"fixed",left:0,top:0,width:"100%",height:"100%",zIndex:"999",backgroundColor:"rgba(0,0,0,0.3)"}},AXn=function(e){e===void 0&&(e=Knt);var n=ZX.get(e);return n===void 0?ZX.get(qnt(e)):n},qnt=function(e){return e+"-legacy"},$nt=function(t){hXn(e,t);function e(){var o;return o=t.apply(this,arguments)||this,o.state=yXn,o.handleScroll=function(){var r=xm({},GD,o.props),i=r.acceptOnScrollPercentage,a=document.documentElement,l=document.body,s="scrollTop",c="scrollHeight",u=(a[s]||l[s])/((a[c]||l[c])-a.clientHeight)*100;u>i&&o.accept(!0)},o.removeScrollListener=function(){var r=o.props.acceptOnScroll;r&&window.removeEventListener("scroll",o.handleScroll)},o}var n=e.prototype;return n.componentDidMount=function(){var r=this.props.debug;(this.getCookieValue()===void 0||r)&&(this.setState({visible:!0}),this.props.acceptOnScroll&&window.addEventListener("scroll",this.handleScroll,{passive:!0}))},n.componentWillUnmount=function(){this.removeScrollListener()},n.accept=function(r){var i;r===void 0&&(r=!1);var a=xm({},GD,this.props),l=a.cookieName,s=a.cookieValue,c=a.hideOnAccept,u=a.onAccept;this.setCookie(l,s),u((i=r)!=null?i:!1),c&&(this.setState({visible:!1}),this.removeScrollListener())},n.overlayClick=function(){var r=xm({},GD,this.props),i=r.acceptOnOverlayClick,a=r.onOverlayClick;i&&this.accept(),a()},n.decline=function(){var r=xm({},GD,this.props),i=r.cookieName,a=r.declineCookieValue,l=r.hideOnDecline,s=r.onDecline,c=r.setDeclineCookie;c&&this.setCookie(i,a),s(),l&&this.setState({visible:!1})},n.setCookie=function(r,i){var a=this.props,l=a.extraCookieOptions,s=a.expires,c=a.sameSite,u=this.props.cookieSecurity;u===void 0&&(u=window.location?window.location.protocol==="https:":!0);var d=xm({expires:s},l,{sameSite:c,secure:u});c===eJ.NONE&&ZX.set(qnt(r),i,d),ZX.set(r,i,d)},n.getCookieValue=function(){var r=this.props.cookieName;return AXn(r)},n.render=function(){var r=this;switch(this.props.visible){case afe.HIDDEN:return null;case afe.BY_COOKIE_VALUE:if(!this.state.visible)return null;break}var i=this.props,a=i.location,l=i.style,s=i.buttonStyle,c=i.declineButtonStyle,u=i.contentStyle,d=i.disableStyles,f=i.buttonText,p=i.declineButtonText,g=i.containerClasses,A=i.contentClasses,y=i.buttonClasses,S=i.buttonWrapperClasses,C=i.declineButtonClasses,P=i.buttonId,v=i.declineButtonId,T=i.disableButtonStyles,w=i.enableDeclineButton,x=i.flipButtons,b=i.ButtonComponent,R=i.overlay,H=i.overlayClasses,F=i.overlayStyle,E=i.ariaAcceptLabel,N=i.ariaDeclineLabel,U=i.customContainerAttributes,W=i.customContentAttributes,k=i.customButtonProps,D=i.customDeclineButtonProps,L=i.customButtonWrapperAttributes,j={},B={},O={},V={},G={};switch(d?(j=Object.assign({},l),B=Object.assign({},s),O=Object.assign({},c),V=Object.assign({},u),G=Object.assign({},F)):(j=Object.assign({},xm({},this.state.style,l)),V=Object.assign({},xm({},this.state.contentStyle,u)),G=Object.assign({},xm({},this.state.overlayStyle,F)),T?(B=Object.assign({},s),O=Object.assign({},c)):(B=Object.assign({},xm({},this.state.buttonStyle,s)),O=Object.assign({},xm({},this.state.declineButtonStyle,c)))),a){case ife.TOP:j.top="0";break;case ife.BOTTOM:j.bottom="0";break}var q=[];return w&&q.push(be.createElement(b,Object.assign({key:"declineButton",style:O,className:C,id:v,"aria-label":N,onClick:function(){r.decline()}},D),p)),q.push(be.createElement(b,Object.assign({key:"acceptButton",style:B,className:y,id:P,"aria-label":E,onClick:function(){r.accept()}},k),f)),x&&q.reverse(),be.createElement(fXn,{condition:R,wrapper:function(ie){return be.createElement("div",{style:G,className:H,onClick:function(){r.overlayClick()}},ie)}},be.createElement("div",Object.assign({className:""+g,style:j},U),be.createElement("div",Object.assign({style:V,className:A},W),this.props.children),be.createElement("div",Object.assign({className:""+S},L),q.map(function($){return $}))))},e}(m.Component);$nt.defaultProps=GD;const wXn=be.memo(()=>{const t=$t();return h.jsx($nt,{location:"bottom",buttonText:Y.t("cookie.Accept",t),cookieName:"AladdinCookieName",style:{background:"#2B373B",textAlign:"center",zIndex:99999},buttonStyle:{color:"#4e503b",fontSize:"12px"},expires:150,children:Y.t("cookie.Statement",t)})}),vXn=.7,xXn=42.2845513,bXn=vXn/Math.cos(me.toRadians(xXn)),SXn=be.memo(()=>{const t=M(pn),e=M(s0),n=M(Mb),o=M(Sge),r=M(EBe),i=m.useRef(null),a=Hb(r==="satellite"||r==="hybrid"?LQt(640,e,n,o):WQt(640,e,n,o));let l;o===21?l=.5:o===20?l=1:l=Math.pow(2,20-o);const s=bXn*Math.cos(me.toRadians(e))*l,c=u=>{u.intersections.length>0&&u.intersections[0].object===i.current&&t(f=>{Px.selectNone(f),f.pastePoint.copy(u.intersections[0].point),f.clickObjectType=z.Ground,f.contextMenuObjectType=z.Ground,f.pasteNormal=ko})};return a?h.jsxs("mesh",{rotation:[0,0,0],position:[0,0,0],renderOrder:-1,scale:[s,s,1],receiveShadow:!0,ref:i,onContextMenu:c,children:[h.jsx("planeGeometry",{args:[100,100]}),h.jsx("meshStandardMaterial",{attach:"material",depthTest:!1,side:ti,map:a,opacity:1})]}):h.jsx(h.Fragment,{})}),TXn=({foundation:t})=>{const e=$t(),n=()=>{M.getState().set(r=>{for(const i of r.elements)if(i.id===t.id){i.notBuilding=!i.notBuilding;break}})},o=r=>{const i={name:"Building",timestamp:Date.now(),checked:r.target.checked,selectedElementId:t.id,selectedElementType:t.type,undo:()=>n(),redo:()=>n()};M.getState().addUndoable(i),n()};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!t.notBuilding,onChange:o,children:Y.t("word.Building",e)})})},qCe=({foundation:t,lock:e,count:n})=>{const o=$t(),r=e?"foundationMenu.LockAllUnlockedElementsOnThisFoundation":"foundationMenu.UnlockAllLockedElementsOnThisFoundation",i=()=>{const a=new Map;for(const c of M.getState().elements)(c.foundationId===t.id||c.id===t.id)&&a.set(c.id,!!c.locked);const s={name:e?"Lock All Unlocked Offsprings":"Unlock All Locked Offsprings",timestamp:Date.now(),oldValues:a,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())M.getState().updateElementLockById(c,u)},redo:()=>{M.getState().updateElementLockByFoundationId(t.id,e)}};M.getState().addUndoable(s),M.getState().updateElementLockByFoundationId(t.id,e)};return h.jsxs(an,{noPadding:!0,onClick:i,children:[Y.t(r,o)," (",n,")"]})},Dae=({foundation:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllElementsOnFoundationByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.foundationId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Foundation`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{noPadding:!0,onClick:l,children:r})},PXn=({foundation:t})=>{const e=M.getState().set,n=$t(),o=()=>{e(a=>{a.objectTypeToAdd=z.Polygon});const r=M.getState().addElement(t,new le(t.cx,t.cy,t.lz),ko),i={name:"Add",timestamp:Date.now(),addedElement:r,undo:()=>{M.getState().removeElementById(i.addedElement.id,!1)},redo:()=>{e(a=>{a.elements.push(i.addedElement),a.selectedElement=i.addedElement})}};M.getState().addUndoable(i),e(a=>{a.objectTypeToAdd=z.None})};return h.jsx(an,{onClick:o,children:Y.t("foundationMenu.AddPolygon",n)})},CXn=({foundation:t})=>{var a;const[e,n]=m.useState((a=t==null?void 0:t.hvacSystem)==null?void 0:a.id),o=l=>{let s=l.target.value;s.trim().length===0&&(s=void 0),n(s)},r=(l,s)=>{M.getState().set(c=>{for(const u of c.elements)if(u.type===z.Foundation&&u.id===l){const d=u;d.hvacSystem?d.hvacSystem.id=s:d.hvacSystem={thermostatSetpoint:20,temperatureThreshold:3,id:s};break}})},i=l=>{var d;const s=(d=t.hvacSystem)==null?void 0:d.id,c=l&&l.trim().length>0?l:void 0,u={name:"Change HVAC ID",timestamp:Date.now(),oldValue:s,newValue:c,undo:()=>{r(t.id,u.oldValue)},redo:()=>{r(t.id,u.newValue)}};M.getState().addUndoable(u),r(t.id,c)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{style:{width:"40px",paddingLeft:"0px",textAlign:"left"},children:"ID:"}),h.jsx(jl,{style:{width:"180px"},value:e,onChange:o,onPressEnter:()=>i(e),onBlur:()=>i(e)})]})},RXn=({foundation:t})=>{var r;const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i){const c=s;c.hvacSystem?c.hvacSystem.thermostatSetpoint=a:c.hvacSystem={thermostatSetpoint:a,temperatureThreshold:3};break}})},o=i=>{var c;if(i===null)return;const a=((c=t.hvacSystem)==null?void 0:c.thermostatSetpoint)??20,l=i,s={name:"Change Thermostat Setpoint",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(t.id,s.oldValue)},redo:()=>{n(t.id,s.newValue)}};M.getState().addUndoable(s),n(t.id,l)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{style:{width:"160px"},children:Y.t("word.ThermostatSetpoint",e)+":"}),h.jsx(Sn,{min:0,max:30,step:1,style:{width:60},precision:1,value:((r=t.hvacSystem)==null?void 0:r.thermostatSetpoint)??20,onChange:o})]})},HXn=({foundation:t})=>{var r;const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i){const c=s;c.hvacSystem?c.hvacSystem.temperatureThreshold=a:c.hvacSystem={thermostatSetpoint:20,temperatureThreshold:a};break}})},o=i=>{var c;if(i===null)return;const a=((c=t.hvacSystem)==null?void 0:c.temperatureThreshold)??3,l=i,s={name:"Change Temperature Tolerance Threshold",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(t.id,s.oldValue)},redo:()=>{n(t.id,s.newValue)}};M.getState().addUndoable(s),n(t.id,l)};return h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(on,{title:Y.t("word.TemperatureToleranceThresholdExplanation",e),style:{width:"160px"},children:Y.t("word.TemperatureToleranceThreshold",e)+":"}),h.jsx(Sn,{min:0,max:30,step:1,style:{width:60},precision:1,value:((r=t.hvacSystem)==null?void 0:r.temperatureThreshold)??3,onChange:o}),h.jsx(on,{style:{paddingLeft:"10px"},children:"°C"})]})},MXn=({foundation:t})=>{const e=$t(),n=(t==null?void 0:t.solarStructure)??Dn.None,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Foundation&&s.id===i&&!s.locked){s.solarStructure=a;break}})},r=i=>{const a=t.solarStructure,l=i.target.value,s={name:"Select Solar Structure for Selected Foundation",timestamp:Date.now(),oldValue:a,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{o(s.changedElementId,s.oldValue)},redo:()=>{o(s.changedElementId,s.newValue)}};M.getState().addUndoable(s),o(t.id,l)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:n,onChange:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Dn.None,children:Y.t("word.None",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.FocusPipe,children:Y.t("solarAbsorberPipeMenu.AbsorberPipeForFresnelReflectors",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.FocusTower,children:Y.t("solarPowerTowerMenu.ReceiverTowerForHeliostats",e)}),h.jsx(Le,{style:{width:"100%"},value:Dn.UpdraftTower,children:Y.t("solarUpdraftTowerMenu.SolarUpdraftTower",e)})]})})})},Qnt="/aladdin/assets/foundation_01_menu-DJ2ZRFYJ.png",Znt="/aladdin/assets/foundation_02_menu-D6HXceyz.png",eot="/aladdin/assets/foundation_03_menu-BFLw0RU7.png",tot="/aladdin/assets/foundation_04_menu-DtGEusM9.png",not="/aladdin/assets/foundation_05_menu-BGUU1Wal.png",oot="/aladdin/assets/foundation_06_menu-hg_Rf0EG.png",rot="/aladdin/assets/foundation_07_menu-BM9bFpzu.png",iot=t=>{const[e,n]=m.useState((t==null?void 0:t.label)??"");return m.useEffect(()=>{t!=null&&t.label&&n(t.label)},[t==null?void 0:t.id]),{labelText:e,setLabelText:n}},aot=t=>{const e=M(En),n=M(_wt);return()=>{if(t){const o={name:"Show Label for "+t.type,timestamp:Date.now(),checked:!t.showLabel,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!o.checked)},redo:()=>{n(t.id,o.checked)}};e(o),n(t.id,!t.showLabel)}}},lot=(t,e)=>{const n=M(Vwt),o=M(En);return()=>{if(t){const r=t.label,i={name:"Set Label for "+t.type,timestamp:Date.now(),oldValue:r,newValue:e,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};o(i),n(t.id,e)}}},IXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelFontSize=r;break}})};return r=>{if(t){const i=t.labelFontSize??20,a=r,l={name:"Set Label Font Size for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},zXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelSize=r;break}})};return r=>{if(t){const i=t.labelSize??.2,a=r,l={name:"Set Label Size for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},DXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelColor=r;break}})};return r=>{if(t){const i=t.labelColor??"white",a=r,l={name:"Set Label Color for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},EXn=t=>{const e=M(pn),n=M(En),o=r=>{e(i=>{for(const a of i.elements)if(a.id===(t==null?void 0:t.id)){a.labelHeight=r;break}})};return r=>{if(t){const i=t.labelHeight??t.lz/2+.2,a=r,l={name:"Set Label Height for "+t.type,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{o(l.oldValue)},redo:()=>{o(l.newValue)}};n(l),o(a)}}},uo=t=>M(e=>{if(!e.selectedElement)return;const n=e.elements.find(o=>{var r;return o.id===((r=e.selectedElement)==null?void 0:r.id)});if(!n||!t||n.type===t)return n}),ZZ=t=>{const[e,n]=m.useState(t);return[e,r=>{n(r.hex)}]},so=({width:t,title:e,rejectedMessage:n,onApply:o,onClose:r,onClickOk:i,onClickCancel:a,children:l})=>{const s=M(Qn),c=M(Xi),{t:u}=Xl(),d=$t(),[f,p]=m.useState({left:0,top:0,bottom:0,right:0}),[g,A]=m.useState(!1),y=m.useRef(null),S=(T,w)=>{if(y.current){const{clientWidth:x,clientHeight:b}=window.document.documentElement,R=y.current.getBoundingClientRect();p({left:-R.left+w.x,right:x-(R.right-w.x),top:-R.top+w.y,bottom:b-((R==null?void 0:R.bottom)-w.y)})}},C=m.useCallback(()=>{i?i():(o(),r(),s(0))},[o,i,r,s]),P=()=>{a?a():(r(),c())};m.useEffect(()=>{const T=w=>{w.key==="Enter"&&C()};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[C]);const v=!!n&&n.length>0;return h.jsxs(yi,{width:t,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>A(!0),onMouseOut:()=>A(!1),children:[e,v&&h.jsx("span",{style:{color:"red",fontWeight:"bold"},children:n})]}),footer:[h.jsx(io,{onClick:o,children:u("word.Apply",d)},"Apply"),h.jsx(io,{onClick:P,children:u("word.Cancel",d)},"Cancel"),h.jsx(io,{type:"primary",onClick:C,children:u("word.OK",d)},"OK")],onCancel:r,maskClosable:!1,destroyOnClose:!1,modalRender:T=>h.jsx(Bi,{disabled:!g,bounds:f,onStart:(w,x)=>S(w,x),children:h.jsx("div",{ref:y,children:T})}),children:[h.jsx(mue,{style:{marginTop:0,marginBottom:"4px",border:"none"}}),l,h.jsx(mue,{style:{marginTop:0,marginBottom:"4px",border:"none"}})]})},FXn=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState((s==null?void 0:s.textureType)??_i.NoTexture),d=$t(),{Option:f}=Uo,p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){x.textureType=T;break}})},g=v=>{e(T=>{for(const w of T.elements)w.type===z.Foundation&&!w.locked&&(w.textureType=v)})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)&&v!==T.textureType)return!0;break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&v!==T.textureType)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0}return!1},y=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&v.has(x.id))if(T!==void 0)x.textureType=T;else{const b=v.get(x.id);b!==void 0&&(x.textureType=b)}})},S=v=>{if(s&&A(v)){switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??_i.NoTexture);const w={name:"Set Texture for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,w.newValue)}};r(w),y(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)x.type===z.Foundation&&T.set(x.id,x.textureType??_i.NoTexture);const w={name:"Set Texture for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),p(s.id,v),l(a+1);break}}e(T=>{T.actionState.foundationTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:500,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:_i.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},_i.NoTexture),h.jsxs(f,{value:_i.Texture01,children:[h.jsx("img",{alt:_i.Texture01,src:Qnt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture01",d)]},_i.Texture01),h.jsxs(f,{value:_i.Texture02,children:[h.jsx("img",{alt:_i.Texture02,src:Znt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture02",d)]},_i.Texture02),h.jsxs(f,{value:_i.Texture03,children:[h.jsx("img",{alt:_i.Texture03,src:eot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture03",d)]},_i.Texture03),h.jsxs(f,{value:_i.Texture04,children:[h.jsx("img",{alt:_i.Texture04,src:tot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture04",d)]},_i.Texture04),h.jsxs(f,{value:_i.Texture05,children:[h.jsx("img",{alt:_i.Texture05,src:not,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture05",d)]},_i.Texture05),h.jsxs(f,{value:_i.Texture06,children:[h.jsx("img",{alt:_i.Texture06,src:oot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture06",d)]},_i.Texture06),h.jsxs(f,{value:_i.Texture07,children:[h.jsx("img",{alt:_i.Texture07,src:rot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("foundationMenu.Texture07",d)]},_i.Texture07)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})};var km={},XN={},kXn=typeof yc=="object"&&yc&&yc.Object===Object&&yc,sot=kXn,LXn=sot,WXn=typeof self=="object"&&self&&self.Object===Object&&self,NXn=LXn||WXn||Function("return this")(),l5=NXn,UXn=l5,jXn=UXn.Symbol,pM=jXn,$Ce=pM,cot=Object.prototype,BXn=cot.hasOwnProperty,YXn=cot.toString,eD=$Ce?$Ce.toStringTag:void 0;function OXn(t){var e=BXn.call(t,eD),n=t[eD];try{t[eD]=void 0;var o=!0}catch{}var r=YXn.call(t);return o&&(e?t[eD]=n:delete t[eD]),r}var VXn=OXn,_Xn=Object.prototype,GXn=_Xn.toString;function XXn(t){return GXn.call(t)}var JXn=XXn,QCe=pM,KXn=VXn,qXn=JXn,$Xn="[object Null]",QXn="[object Undefined]",ZCe=QCe?QCe.toStringTag:void 0;function ZXn(t){return t==null?t===void 0?QXn:$Xn:ZCe&&ZCe in Object(t)?KXn(t):qXn(t)}var PA=ZXn,eJn=Array.isArray,xp=eJn;function tJn(t){return t!=null&&typeof t=="object"}var s5=tJn,nJn=PA,oJn=xp,rJn=s5,iJn="[object String]";function aJn(t){return typeof t=="string"||!oJn(t)&&rJn(t)&&nJn(t)==iJn}var uot=aJn;const JN=Wi(uot);function lJn(t){return function(e,n,o){for(var r=-1,i=Object(e),a=o(e),l=a.length;l--;){var s=a[t?l:++r];if(n(i[s],s,i)===!1)break}return e}}var sJn=lJn,cJn=sJn,uJn=cJn(),dJn=uJn;function fJn(t,e){for(var n=-1,o=Array(t);++n-1&&t%1==0&&t-1&&t%1==0&&t<=HJn}var j5e=MJn,IJn=PA,zJn=j5e,DJn=s5,EJn="[object Arguments]",FJn="[object Array]",kJn="[object Boolean]",LJn="[object Date]",WJn="[object Error]",NJn="[object Function]",UJn="[object Map]",jJn="[object Number]",BJn="[object Object]",YJn="[object RegExp]",OJn="[object Set]",VJn="[object String]",_Jn="[object WeakMap]",GJn="[object ArrayBuffer]",XJn="[object DataView]",JJn="[object Float32Array]",KJn="[object Float64Array]",qJn="[object Int8Array]",$Jn="[object Int16Array]",QJn="[object Int32Array]",ZJn="[object Uint8Array]",eKn="[object Uint8ClampedArray]",tKn="[object Uint16Array]",nKn="[object Uint32Array]",dc={};dc[JJn]=dc[KJn]=dc[qJn]=dc[$Jn]=dc[QJn]=dc[ZJn]=dc[eKn]=dc[tKn]=dc[nKn]=!0;dc[EJn]=dc[FJn]=dc[GJn]=dc[kJn]=dc[XJn]=dc[LJn]=dc[WJn]=dc[NJn]=dc[UJn]=dc[jJn]=dc[BJn]=dc[YJn]=dc[OJn]=dc[VJn]=dc[_Jn]=!1;function oKn(t){return DJn(t)&&zJn(t.length)&&!!dc[IJn(t)]}var rKn=oKn;function iKn(t){return function(e){return t(e)}}var eee=iKn,nJ={exports:{}};nJ.exports;(function(t,e){var n=sot,o=e&&!e.nodeType&&e,r=o&&!0&&t&&!t.nodeType&&t,i=r&&r.exports===o,a=i&&n.process,l=function(){try{var s=r&&r.require&&r.require("util").types;return s||a&&a.binding&&a.binding("util")}catch{}}();t.exports=l})(nJ,nJ.exports);var B5e=nJ.exports,aKn=rKn,lKn=eee,tRe=B5e,nRe=tRe&&tRe.isTypedArray,sKn=nRe?lKn(nRe):aKn,fot=sKn,cKn=hJn,uKn=W5e,dKn=xp,fKn=N5e,hKn=U5e,pKn=fot,gKn=Object.prototype,mKn=gKn.hasOwnProperty;function yKn(t,e){var n=dKn(t),o=!n&&uKn(t),r=!n&&!o&&fKn(t),i=!n&&!o&&!r&&pKn(t),a=n||o||r||i,l=a?cKn(t.length,String):[],s=l.length;for(var c in t)(e||mKn.call(t,c))&&!(a&&(c=="length"||r&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||hKn(c,s)))&&l.push(c);return l}var hot=yKn,AKn=Object.prototype;function wKn(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||AKn;return t===n}var Y5e=wKn;function vKn(t,e){return function(n){return t(e(n))}}var pot=vKn,xKn=pot,bKn=xKn(Object.keys,Object),SKn=bKn,TKn=Y5e,PKn=SKn,CKn=Object.prototype,RKn=CKn.hasOwnProperty;function HKn(t){if(!TKn(t))return PKn(t);var e=[];for(var n in Object(t))RKn.call(t,n)&&n!="constructor"&&e.push(n);return e}var MKn=HKn;function IKn(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var c5=IKn;const gM=Wi(c5);var zKn=PA,DKn=c5,EKn="[object AsyncFunction]",FKn="[object Function]",kKn="[object GeneratorFunction]",LKn="[object Proxy]";function WKn(t){if(!DKn(t))return!1;var e=zKn(t);return e==FKn||e==kKn||e==EKn||e==LKn}var O5e=WKn;const xa=Wi(O5e);var NKn=O5e,UKn=j5e;function jKn(t){return t!=null&&UKn(t.length)&&!NKn(t)}var mM=jKn,BKn=hot,YKn=MKn,OKn=mM;function VKn(t){return OKn(t)?BKn(t):YKn(t)}var yM=VKn,_Kn=dJn,GKn=yM;function XKn(t,e){return t&&_Kn(t,e,GKn)}var V5e=XKn;function JKn(t){return t}var oS=JKn,KKn=oS;function qKn(t){return typeof t=="function"?t:KKn}var $Kn=qKn,QKn=V5e,ZKn=$Kn;function eqn(t,e){return t&&QKn(t,ZKn(e))}var _5e=eqn,tqn=pot,nqn=tqn(Object.getPrototypeOf,Object),G5e=nqn,oqn=PA,rqn=G5e,iqn=s5,aqn="[object Object]",lqn=Function.prototype,sqn=Object.prototype,got=lqn.toString,cqn=sqn.hasOwnProperty,uqn=got.call(Object);function dqn(t){if(!iqn(t)||oqn(t)!=aqn)return!1;var e=rqn(t);if(e===null)return!0;var n=cqn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&got.call(n)==uqn}var mot=dqn;const fqn=Wi(mot);function hqn(t,e){for(var n=-1,o=t==null?0:t.length,r=Array(o);++n-1}var Mqn=Hqn,Iqn=nee;function zqn(t,e){var n=this.__data__,o=Iqn(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}var Dqn=zqn,Eqn=gqn,Fqn=Sqn,kqn=Cqn,Lqn=Mqn,Wqn=Dqn;function AM(t){var e=-1,n=t==null?0:t.length;for(this.clear();++el))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&GQn?new YQn:void 0;for(i.set(t,e),i.set(e,t);++d0&&arguments[0]!==void 0?arguments[0]:[],n=[];return(0,Hno.default)(e,function(o){Array.isArray(o)?t(o).map(function(r){return n.push(r)}):(0,Cno.default)(o)?(0,Tno.default)(o,function(r,i){r===!0&&n.push(i),n.push(i+"-"+r)}):(0,bno.default)(o)&&n.push(o)}),n};XN.default=Mno;var KN={};function Ino(t,e){for(var n=-1,o=t==null?0:t.length;++n1&&arguments[1]!==void 0?arguments[1]:[],o=e.default&&(0,Kio.default)(e.default)||{};return n.map(function(r){var i=e[r];return i&&(0,Xio.default)(i,function(a,l){o[l]||(o[l]={}),o[l]=qio({},o[l],i[l])}),r}),o};KN.default=$io;var qN={};Object.defineProperty(qN,"__esModule",{value:!0});qN.autoprefix=void 0;var Qio=_5e,LRe=eao(Qio),Zio=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){lao(r,o);function r(){var i,a,l,s;aao(this,r);for(var c=arguments.length,u=Array(c),d=0;d1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){hao(r,o);function r(){var i,a,l,s;fao(this,r);for(var c=arguments.length,u=Array(c),d=0;d1&&arguments[1]!==void 0?arguments[1]:!0;o[a]=l};return e===0&&r("first-child"),e===n-1&&r("last-child"),(e===0||e%2===0)&&r("even"),Math.abs(e%2)===1&&r("odd"),r("nth-child",e),o};s9e.default=gao;Object.defineProperty(km,"__esModule",{value:!0});km.ReactCSS=km.loop=km.handleActive=c9e=km.handleHover=km.hover=void 0;var mao=XN,yao=TM(mao),Aao=KN,wao=TM(Aao),vao=qN,xao=TM(vao),bao=$N,Got=TM(bao),Sao=QN,Tao=TM(Sao),Pao=s9e,Cao=TM(Pao);function TM(t){return t&&t.__esModule?t:{default:t}}km.hover=Got.default;var c9e=km.handleHover=Got.default;km.handleActive=Tao.default;km.loop=Cao.default;var Rao=km.ReactCSS=function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),r=1;rl?f=1:f=Math.round(d*100/l)/100,n.a!==f)return{h:n.h,s:n.s,l:n.l,a:f,source:"rgb"}}else{var p=void 0;if(u<0?p=0:u>a?p=1:p=Math.round(u*100/a)/100,r!==p)return{h:n.h,s:n.s,l:n.l,a:p,source:"rgb"}}return null},Nae={},Mao=function(e,n,o,r){if(typeof document>"u"&&!r)return null;var i=r?new r:document.createElement("canvas");i.width=o*2,i.height=o*2;var a=i.getContext("2d");return a?(a.fillStyle=e,a.fillRect(0,0,i.width,i.height),a.fillStyle=n,a.fillRect(0,0,o,o),a.translate(o,o),a.fillRect(0,0,o,o),i.toDataURL()):null},Iao=function(e,n,o,r){var i=e+"-"+n+"-"+o+(r?"-server":"");if(Nae[i])return Nae[i];var a=Mao(e,n,o,r);return Nae[i]=a,a},URe=Object.assign||function(t){for(var e=1;e-1},Vao=function(e){return Number(String(e).replace(/%/g,""))},_ao=1,cl=function(t){Uao(e,t);function e(n){Wao(this,e);var o=Nao(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return o.handleBlur=function(){o.state.blurValue&&o.setState({value:o.state.blurValue,blurValue:null})},o.handleChange=function(r){o.setUpdatedValue(r.target.value,r)},o.handleKeyDown=function(r){var i=Vao(r.target.value);if(!isNaN(i)&&Oao(r.keyCode)){var a=o.getArrowOffset(),l=r.keyCode===Xot?i+a:i-a;o.setUpdatedValue(l,r)}},o.handleDrag=function(r){if(o.props.dragLabel){var i=Math.round(o.props.value+r.movementX);i>=0&&i<=o.props.dragMax&&o.props.onChange&&o.props.onChange(o.getValueObjectWithLabel(i),r)}},o.handleMouseDown=function(r){o.props.dragLabel&&(r.preventDefault(),o.handleDrag(r),window.addEventListener("mousemove",o.handleDrag),window.addEventListener("mouseup",o.handleMouseUp))},o.handleMouseUp=function(){o.unbindEventListeners()},o.unbindEventListeners=function(){window.removeEventListener("mousemove",o.handleDrag),window.removeEventListener("mouseup",o.handleMouseUp)},o.state={value:String(n.value).toUpperCase(),blurValue:String(n.value).toUpperCase()},o.inputId="rc-editable-input-"+_ao++,o}return kao(e,[{key:"componentDidUpdate",value:function(o,r){this.props.value!==this.state.value&&(o.value!==this.props.value||r.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(o){return Lao({},this.props.label,o)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||jao}},{key:"setUpdatedValue",value:function(o,r){var i=this.props.label?this.getValueObjectWithLabel(o):o;this.props.onChange&&this.props.onChange(i,r),this.setState({value:o})}},{key:"render",value:function(){var o=this,r=$i({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return be.createElement("div",{style:r.wrap},be.createElement("input",{id:this.inputId,style:r.input,ref:function(a){return o.input=a},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?be.createElement("label",{htmlFor:this.inputId,style:r.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(m.PureComponent||m.Component),Gao=function(e,n,o,r){var i=r.clientWidth,a=r.clientHeight,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,s=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(r.getBoundingClientRect().left+window.pageXOffset),u=s-(r.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var d=void 0;if(u<0)d=359;else if(u>a)d=0;else{var f=-(u*100/a)+100;d=360*f/100}if(o.h!==d)return{h:d,s:o.s,l:o.l,a:o.a,source:"hsl"}}else{var p=void 0;if(c<0)p=0;else if(c>i)p=359;else{var g=c*100/i;p=360*g/100}if(o.h!==p)return{h:p,s:o.s,l:o.l,a:o.a,source:"hsl"}}return null},Xao=function(){function t(e,n){for(var o=0;o-1}function nlo(t,e){var n=this.__data__,o=uee(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}function CA(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=cso}function RM(t){return t!=null&&p9e(t.length)&&!d9e(t)}function uso(t){return xw(t)&&RM(t)}function dso(){return!1}var trt=typeof vg=="object"&&vg&&!vg.nodeType&&vg,JRe=trt&&typeof hh=="object"&&hh&&!hh.nodeType&&hh,fso=JRe&&JRe.exports===trt,KRe=fso?u5.Buffer:void 0,hso=KRe?KRe.isBuffer:void 0,sJ=hso||dso,pso="[object Object]",gso=Function.prototype,mso=Object.prototype,nrt=gso.toString,yso=mso.hasOwnProperty,Aso=nrt.call(Object);function wso(t){if(!xw(t)||iS(t)!=pso)return!1;var e=Zot(t);if(e===null)return!0;var n=yso.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&nrt.call(n)==Aso}var vso="[object Arguments]",xso="[object Array]",bso="[object Boolean]",Sso="[object Date]",Tso="[object Error]",Pso="[object Function]",Cso="[object Map]",Rso="[object Number]",Hso="[object Object]",Mso="[object RegExp]",Iso="[object Set]",zso="[object String]",Dso="[object WeakMap]",Eso="[object ArrayBuffer]",Fso="[object DataView]",kso="[object Float32Array]",Lso="[object Float64Array]",Wso="[object Int8Array]",Nso="[object Int16Array]",Uso="[object Int32Array]",jso="[object Uint8Array]",Bso="[object Uint8ClampedArray]",Yso="[object Uint16Array]",Oso="[object Uint32Array]",fc={};fc[kso]=fc[Lso]=fc[Wso]=fc[Nso]=fc[Uso]=fc[jso]=fc[Bso]=fc[Yso]=fc[Oso]=!0;fc[vso]=fc[xso]=fc[Eso]=fc[bso]=fc[Fso]=fc[Sso]=fc[Tso]=fc[Pso]=fc[Cso]=fc[Rso]=fc[Hso]=fc[Mso]=fc[Iso]=fc[zso]=fc[Dso]=!1;function Vso(t){return xw(t)&&p9e(t.length)&&!!fc[iS(t)]}function _so(t){return function(e){return t(e)}}var ort=typeof vg=="object"&&vg&&!vg.nodeType&&vg,YE=ort&&typeof hh=="object"&&hh&&!hh.nodeType&&hh,Gso=YE&&YE.exports===ort,jae=Gso&&Jot.process,qRe=function(){try{var t=YE&&YE.require&&YE.require("util").types;return t||jae&&jae.binding&&jae.binding("util")}catch{}}(),$Re=qRe&&qRe.isTypedArray,g9e=$Re?_so($Re):Vso;function hfe(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var Xso=Object.prototype,Jso=Xso.hasOwnProperty;function Kso(t,e,n){var o=t[e];(!(Jso.call(t,e)&&ZN(o,n))||n===void 0&&!(e in t))&&f9e(t,e,n)}function qso(t,e,n,o){var r=!n;n||(n={});for(var i=-1,a=e.length;++i-1&&t%1==0&&t0){if(++e>=fco)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var mco=gco(dco);function yco(t,e){return mco(cco(t,e,fee),t+"")}function Aco(t,e,n){if(!oy(n))return!1;var o=typeof e;return(o=="number"?RM(n)&&m9e(e,n.length):o=="string"&&e in n)?ZN(n[e],t):!1}function wco(t){return yco(function(e,n){var o=-1,r=n.length,i=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(r--,i):void 0,a&&Aco(n[0],n[1],a)&&(i=r<3?void 0:i,r=1),e=Object(e);++o=e||x<0||d&&b>=i}function S(){var w=Bae();if(y(w))return C(w);l=setTimeout(S,A(w))}function C(w){return l=void 0,f&&o?p(w):(o=r=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,o=s=r=l=void 0}function v(){return l===void 0?a:C(Bae())}function T(){var w=Bae(),x=y(w);if(o=arguments,r=this,s=w,x){if(l===void 0)return g(s);if(d)return clearTimeout(l),l=setTimeout(S,e),p(s)}return l===void 0&&(l=setTimeout(S,e)),a}return T.cancel=P,T.flush=v,T}var Dco="Expected a function";function Eco(t,e,n){var o=!0,r=!0;if(typeof t!="function")throw new TypeError(Dco);return oy(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),lrt(t,e,{leading:o,maxWait:e,trailing:r})}var Fco=function(e,n,o){var r=o.getBoundingClientRect(),i=r.width,a=r.height,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,s=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(o.getBoundingClientRect().left+window.pageXOffset),u=s-(o.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>i&&(c=i),u<0?u=0:u>a&&(u=a);var d=c/i,f=1-u/a;return{h:n.h,s:d,v:f,a:n.a,source:"hsv"}},kco=function(){function t(e,n){for(var o=0;o-1}function nlo(t,e){var n=this.__data__,o=uee(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}function CA(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t<=cso}function RM(t){return t!=null&&p9e(t.length)&&!d9e(t)}function uso(t){return xw(t)&&RM(t)}function dso(){return!1}var trt=typeof vg=="object"&&vg&&!vg.nodeType&&vg,JRe=trt&&typeof ph=="object"&&ph&&!ph.nodeType&&ph,fso=JRe&&JRe.exports===trt,KRe=fso?u5.Buffer:void 0,hso=KRe?KRe.isBuffer:void 0,sJ=hso||dso,pso="[object Object]",gso=Function.prototype,mso=Object.prototype,nrt=gso.toString,yso=mso.hasOwnProperty,Aso=nrt.call(Object);function wso(t){if(!xw(t)||iS(t)!=pso)return!1;var e=Zot(t);if(e===null)return!0;var n=yso.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&nrt.call(n)==Aso}var vso="[object Arguments]",xso="[object Array]",bso="[object Boolean]",Sso="[object Date]",Tso="[object Error]",Pso="[object Function]",Cso="[object Map]",Rso="[object Number]",Hso="[object Object]",Mso="[object RegExp]",Iso="[object Set]",zso="[object String]",Dso="[object WeakMap]",Eso="[object ArrayBuffer]",Fso="[object DataView]",kso="[object Float32Array]",Lso="[object Float64Array]",Wso="[object Int8Array]",Nso="[object Int16Array]",Uso="[object Int32Array]",jso="[object Uint8Array]",Bso="[object Uint8ClampedArray]",Yso="[object Uint16Array]",Oso="[object Uint32Array]",fc={};fc[kso]=fc[Lso]=fc[Wso]=fc[Nso]=fc[Uso]=fc[jso]=fc[Bso]=fc[Yso]=fc[Oso]=!0;fc[vso]=fc[xso]=fc[Eso]=fc[bso]=fc[Fso]=fc[Sso]=fc[Tso]=fc[Pso]=fc[Cso]=fc[Rso]=fc[Hso]=fc[Mso]=fc[Iso]=fc[zso]=fc[Dso]=!1;function Vso(t){return xw(t)&&p9e(t.length)&&!!fc[iS(t)]}function _so(t){return function(e){return t(e)}}var ort=typeof vg=="object"&&vg&&!vg.nodeType&&vg,YE=ort&&typeof ph=="object"&&ph&&!ph.nodeType&&ph,Gso=YE&&YE.exports===ort,jae=Gso&&Jot.process,qRe=function(){try{var t=YE&&YE.require&&YE.require("util").types;return t||jae&&jae.binding&&jae.binding("util")}catch{}}(),$Re=qRe&&qRe.isTypedArray,g9e=$Re?_so($Re):Vso;function hfe(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var Xso=Object.prototype,Jso=Xso.hasOwnProperty;function Kso(t,e,n){var o=t[e];(!(Jso.call(t,e)&&ZN(o,n))||n===void 0&&!(e in t))&&f9e(t,e,n)}function qso(t,e,n,o){var r=!n;n||(n={});for(var i=-1,a=e.length;++i-1&&t%1==0&&t0){if(++e>=fco)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var mco=gco(dco);function yco(t,e){return mco(cco(t,e,fee),t+"")}function Aco(t,e,n){if(!oy(n))return!1;var o=typeof e;return(o=="number"?RM(n)&&m9e(e,n.length):o=="string"&&e in n)?ZN(n[e],t):!1}function wco(t){return yco(function(e,n){var o=-1,r=n.length,i=r>1?n[r-1]:void 0,a=r>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(r--,i):void 0,a&&Aco(n[0],n[1],a)&&(i=r<3?void 0:i,r=1),e=Object(e);++o=e||x<0||d&&b>=i}function S(){var w=Bae();if(y(w))return C(w);l=setTimeout(S,A(w))}function C(w){return l=void 0,f&&o?p(w):(o=r=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,o=s=r=l=void 0}function v(){return l===void 0?a:C(Bae())}function T(){var w=Bae(),x=y(w);if(o=arguments,r=this,s=w,x){if(l===void 0)return g(s);if(d)return clearTimeout(l),l=setTimeout(S,e),p(s)}return l===void 0&&(l=setTimeout(S,e)),a}return T.cancel=P,T.flush=v,T}var Dco="Expected a function";function Eco(t,e,n){var o=!0,r=!0;if(typeof t!="function")throw new TypeError(Dco);return oy(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),lrt(t,e,{leading:o,maxWait:e,trailing:r})}var Fco=function(e,n,o){var r=o.getBoundingClientRect(),i=r.width,a=r.height,l=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,s=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=l-(o.getBoundingClientRect().left+window.pageXOffset),u=s-(o.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>i&&(c=i),u<0?u=0:u>a&&(u=a);var d=c/i,f=1-u/a;return{h:n.h,s:d,v:f,a:n.a,source:"hsv"}},kco=function(){function t(e,n){for(var o=0;o=0,i=!n&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(o=this.toRgbString()),e==="prgb"&&(o=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(o=this.toHexString()),e==="hex3"&&(o=this.toHexString(!0)),e==="hex4"&&(o=this.toHex8String(!0)),e==="hex8"&&(o=this.toHex8String()),e==="name"&&(o=this.toName()),e==="hsl"&&(o=this.toHslString()),e==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return Zr(this.toString())},_applyModification:function(e,n){var o=e.apply(null,[this].concat([].slice.call(n)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(r0o,arguments)},brighten:function(){return this._applyModification(i0o,arguments)},darken:function(){return this._applyModification(a0o,arguments)},desaturate:function(){return this._applyModification(t0o,arguments)},saturate:function(){return this._applyModification(n0o,arguments)},greyscale:function(){return this._applyModification(o0o,arguments)},spin:function(){return this._applyModification(l0o,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(u0o,arguments)},complement:function(){return this._applyCombination(s0o,arguments)},monochromatic:function(){return this._applyCombination(d0o,arguments)},splitcomplement:function(){return this._applyCombination(c0o,arguments)},triad:function(){return this._applyCombination(iHe,[3])},tetrad:function(){return this._applyCombination(iHe,[4])}};Zr.fromRatio=function(t,e){if(cJ(t)=="object"){var n={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?n[o]=t[o]:n[o]=XD(t[o]));t=n}return Zr(t,e)};function qco(t){var e={r:0,g:0,b:0},n=1,o=null,r=null,i=null,a=!1,l=!1;return typeof t=="string"&&(t=m0o(t)),cJ(t)=="object"&&(u6(t.r)&&u6(t.g)&&u6(t.b)?(e=$co(t.r,t.g,t.b),a=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):u6(t.h)&&u6(t.s)&&u6(t.v)?(o=XD(t.s),r=XD(t.v),e=Zco(t.h,o,r),a=!0,l="hsv"):u6(t.h)&&u6(t.s)&&u6(t.l)&&(o=XD(t.s),i=XD(t.l),e=Qco(t.h,o,i),a=!0,l="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=crt(n),{ok:a,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function $co(t,e,n){return{r:Wc(t,255)*255,g:Wc(e,255)*255,b:Wc(n,255)*255}}function tHe(t,e,n){t=Wc(t,255),e=Wc(e,255),n=Wc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=(o+r)/2;if(o==r)i=a=0;else{var s=o-r;switch(a=l>.5?s/(2-o-r):s/(o+r),o){case t:i=(e-n)/s+(e1&&(d-=1),d<1/6?c+(u-c)*6*d:d<1/2?u:d<2/3?c+(u-c)*(2/3-d)*6:c}if(e===0)o=r=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;o=a(s,l,t+1/3),r=a(s,l,t),i=a(s,l,t-1/3)}return{r:o*255,g:r*255,b:i*255}}function nHe(t,e,n){t=Wc(t,255),e=Wc(e,255),n=Wc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=o,s=o-r;if(a=o===0?0:s/o,o==r)i=0;else{switch(o){case t:i=(e-n)/s+(e>1)+720)%360;--e;)o.h=(o.h+r)%360,i.push(Zr(o));return i}function d0o(t,e){e=e||6;for(var n=Zr(t).toHsv(),o=n.h,r=n.s,i=n.v,a=[],l=1/e;e--;)a.push(Zr({h:o,s:r,v:i})),i=(i+l)%1;return a}Zr.mix=function(t,e,n){n=n===0?0:n||50;var o=Zr(t).toRgb(),r=Zr(e).toRgb(),i=n/100,a={r:(r.r-o.r)*i+o.r,g:(r.g-o.g)*i+o.g,b:(r.b-o.b)*i+o.b,a:(r.a-o.a)*i+o.a};return Zr(a)};Zr.readability=function(t,e){var n=Zr(t),o=Zr(e);return(Math.max(n.getLuminance(),o.getLuminance())+.05)/(Math.min(n.getLuminance(),o.getLuminance())+.05)};Zr.isReadable=function(t,e,n){var o=Zr.readability(t,e),r,i;switch(i=!1,r=y0o(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7;break}return i};Zr.mostReadable=function(t,e,n){var o=null,r=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var c=0;cr&&(r=i,o=Zr(e[c]));return Zr.isReadable(t,o,{level:l,size:s})||!a?o:(n.includeFallbackColors=!1,Zr.mostReadable(t,["#fff","#000"],n))};var pfe=Zr.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},f0o=Zr.hexNames=h0o(pfe);function h0o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function crt(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Wc(t,e){p0o(t)&&(t="100%");var n=g0o(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function gee(t){return Math.min(1,Math.max(0,t))}function J1(t){return parseInt(t,16)}function p0o(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function g0o(t){return typeof t=="string"&&t.indexOf("%")!=-1}function P2(t){return t.length==1?"0"+t:""+t}function XD(t){return t<=1&&(t=t*100+"%"),t}function urt(t){return Math.round(parseFloat(t)*255).toString(16)}function aHe(t){return J1(t)/255}var n2=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function u6(t){return!!n2.CSS_UNIT.exec(t)}function m0o(t){t=t.replace(Jco,"").replace(Kco,"").toLowerCase();var e=!1;if(pfe[t])t=pfe[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=n2.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=n2.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=n2.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=n2.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=n2.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=n2.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=n2.hex8.exec(t))?{r:J1(n[1]),g:J1(n[2]),b:J1(n[3]),a:aHe(n[4]),format:e?"name":"hex8"}:(n=n2.hex6.exec(t))?{r:J1(n[1]),g:J1(n[2]),b:J1(n[3]),format:e?"name":"hex"}:(n=n2.hex4.exec(t))?{r:J1(n[1]+""+n[1]),g:J1(n[2]+""+n[2]),b:J1(n[3]+""+n[3]),a:aHe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=n2.hex3.exec(t))?{r:J1(n[1]+""+n[1]),g:J1(n[2]+""+n[2]),b:J1(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function y0o(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var lHe=function(e){var n=["r","g","b","a","h","s","l","v"],o=0,r=0;return Xco(n,function(i){if(e[i]&&(o+=1,isNaN(e[i])||(r+=1),i==="s"||i==="l")){var a=/^\d+%$/;a.test(e[i])&&(r+=1)}}),o===r?e:!1},JD=function(e,n){var o=e.hex?Zr(e.hex):Zr(e),r=o.toHsl(),i=o.toHsv(),a=o.toRgb(),l=o.toHex();r.s===0&&(r.h=n||0,i.h=n||0);var s=l==="000000"&&a.a===0;return{hsl:r,hex:s?"transparent":"#"+l,rgb:a,hsv:i,oldHue:e.h||n||r.h,source:e.source}},Qw=function(e){if(e==="transparent")return!0;var n=String(e).charAt(0)==="#"?1:0;return e.length!==4+n&&e.length<7+n&&Zr(e).isValid()},A9e=function(e){if(!e)return"#fff";var n=JD(e);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var o=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return o>=128?"#000":"#fff"},Yae=function(e,n){var o=e.replace("°","");return Zr(n+" ("+o+")")._ok},nD=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){P0o(r,o);function r(){var i,a,l,s;T0o(this,r);for(var c=arguments.length,u=Array(c),d=0;dl))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&W0o?new uJ:void 0;for(i.set(t,e),i.set(e,t);++d=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var BO=24,Zuo=vrt.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?BO:o,i=t.height,a=i===void 0?BO:i,l=t.style,s=l===void 0?{}:l,c=Quo(t,["fill","width","height","style"]);return PHe.default.createElement("svg",THe({viewBox:"0 0 "+BO+" "+BO,style:THe({fill:n,width:r,height:a},s)},c),PHe.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},edo=function(){function t(e,n){for(var o=0;o1&&(r.a=1),o.props.onChange({h:o.props.hsl.h,s:o.props.hsl.s,l:o.props.hsl.l,a:Math.round(r.a*100)/100,source:"rgb"},i)):(r.h||r.s||r.l)&&(typeof r.s=="string"&&r.s.includes("%")&&(r.s=r.s.replace("%","")),typeof r.l=="string"&&r.l.includes("%")&&(r.l=r.l.replace("%","")),r.s==1?r.s=.01:r.l==1&&(r.l=.01),o.props.onChange({h:r.h||o.props.hsl.h,s:Number(SHe(r.s)?o.props.hsl.s:r.s),l:Number(SHe(r.l)?o.props.hsl.l:r.l),source:"hsl"},i))},o.showHighlight=function(r){r.currentTarget.style.background="#eee"},o.hideHighlight=function(r){r.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?o.state={view:"rgb"}:o.state={view:n.view},o}return edo(e,[{key:"render",value:function(){var o=this,r=$i({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),i=void 0;return this.state.view==="hex"?i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),be.createElement("div",{style:r.alpha},be.createElement(cl,{style:{input:r.input,label:r.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),be.createElement("div",{style:r.alpha},be.createElement(cl,{style:{input:r.input,label:r.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),be.createElement("div",{style:r.wrap,className:"flexbox-fix"},i,be.createElement("div",{style:r.toggle},be.createElement("div",{style:r.icon,onClick:this.toggleViews,ref:function(l){return o.icon=l}},be.createElement(Zuo,{style:r.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.hsl.a!==1&&r.view==="hex"?{view:"rgb"}:null}}]),e}(be.Component);xrt.defaultProps={view:"hex"};var CHe=function(){var e=$i({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return be.createElement("div",{style:e.picker})},rdo=function(){var e=$i({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return be.createElement("div",{style:e.picker})},T9e=function(e){var n=e.width,o=e.onChange,r=e.disableAlpha,i=e.rgb,a=e.hsl,l=e.hsv,s=e.hex,c=e.renderers,u=e.styles,d=u===void 0?{}:u,f=e.className,p=f===void 0?"":f,g=e.defaultView,A=$i(h1({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+i.r+", "+i.g+", "+i.b+", "+i.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:r});return be.createElement("div",{style:A.picker,className:"chrome-picker "+p},be.createElement("div",{style:A.saturation},be.createElement(pee,{style:A.Saturation,hsl:a,hsv:l,pointer:rdo,onChange:o})),be.createElement("div",{style:A.body},be.createElement("div",{style:A.controls,className:"flexbox-fix"},be.createElement("div",{style:A.color},be.createElement("div",{style:A.swatch},be.createElement("div",{style:A.active}),be.createElement(PM,{renderers:c}))),be.createElement("div",{style:A.toggles},be.createElement("div",{style:A.hue},be.createElement(CM,{style:A.Hue,hsl:a,pointer:CHe,onChange:o})),be.createElement("div",{style:A.alpha},be.createElement(u9e,{style:A.Alpha,rgb:i,hsl:a,pointer:CHe,renderers:c,onChange:o})))),be.createElement(xrt,{rgb:i,hsl:a,hex:s,view:g,onChange:o,disableAlpha:r})))};T9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),disableAlpha:mo.bool,styles:mo.object,defaultView:mo.oneOf(["hex","rgb","hsl"])};T9e.defaultProps={width:225,disableAlpha:!1,styles:{}};p1(T9e);var ido=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.active,l=$i({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:A9e(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:a,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return be.createElement(sS,{style:l.color,color:n,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},be.createElement("div",{style:l.dot}))},ado=function(e){var n=e.hex,o=e.rgb,r=e.onChange,i=$i({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),a=function(s,c){s.r||s.g||s.b?r({r:s.r||o.r,g:s.g||o.g,b:s.b||o.b,source:"rgb"},c):r({hex:s.hex,source:"hex"},c)};return be.createElement("div",{style:i.fields,className:"flexbox-fix"},be.createElement("div",{style:i.active}),be.createElement(cl,{style:{wrap:i.HEXwrap,input:i.HEXinput,label:i.HEXlabel},label:"hex",value:n,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"r",value:o.r,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"g",value:o.g,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"b",value:o.b,onChange:a}))},P9e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.colors,i=e.hex,a=e.rgb,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=$i(h1({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},s)),f=function(g,A){g.hex?Qw(g.hex)&&n({hex:g.hex,source:"hex"},A):n(g,A)};return be.createElement(eU,{style:d.Compact,styles:s},be.createElement("div",{style:d.compact,className:"compact-picker "+u},be.createElement("div",null,cS(r,function(p){return be.createElement(ido,{key:p,color:p,active:p.toLowerCase()===i,onClick:f,onSwatchHover:o})}),be.createElement("div",{style:d.clear})),be.createElement(ado,{hex:i,rgb:a,onChange:f})))};P9e.propTypes={colors:mo.arrayOf(mo.string),styles:mo.object};P9e.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};const Ld=p1(P9e);var ldo=function(e){var n=e.hover,o=e.color,r=e.onClick,i=e.onSwatchHover,a={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},l=$i({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:a}},{hover:n});return be.createElement("div",{style:l.swatch},be.createElement(sS,{color:o,onClick:r,onHover:i,focusStyle:a}))};const sdo=c9e(ldo);var C9e=function(e){var n=e.width,o=e.colors,r=e.onChange,i=e.onSwatchHover,a=e.triangle,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=$i(h1({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},s),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right","bottom-left-triangle":a==="bottom-left","bottom-right-triangle":a==="bottom-right"}),f=function(g,A){return r({hex:g,source:"hex"},A)};return be.createElement("div",{style:d.card,className:"github-picker "+u},be.createElement("div",{style:d.triangleShadow}),be.createElement("div",{style:d.triangle}),cS(o,function(p){return be.createElement(sdo,{color:p,key:p,onClick:f,onSwatchHover:i})}))};C9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),colors:mo.arrayOf(mo.string),triangle:mo.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:mo.object};C9e.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};p1(C9e);var cdo=function(e){var n=e.direction,o=$i({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return be.createElement("div",{style:o.picker})},udo=Object.assign||function(t){for(var e=1;e.5});return be.createElement("div",{style:o.picker})},pdo=function(){var e=$i({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return be.createElement("div",{style:e.pointer},be.createElement("div",{style:e.left},be.createElement("div",{style:e.leftInside})),be.createElement("div",{style:e.right},be.createElement("div",{style:e.rightInside})))},RHe=function(e){var n=e.onClick,o=e.label,r=e.children,i=e.active,a=$i({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:i});return be.createElement("div",{style:a.button,onClick:n},o||r)},gdo=function(e){var n=e.rgb,o=e.currentColor,r=$i({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:o,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return be.createElement("div",null,be.createElement("div",{style:r.label},"new"),be.createElement("div",{style:r.swatches},be.createElement("div",{style:r.new}),be.createElement("div",{style:r.current})),be.createElement("div",{style:r.label},"current"))},mdo=function(){function t(e,n){for(var o=0;o100&&(u.a=100),u.a/=100,n({h:r.h,s:r.s,l:r.l,a:u.a,source:"rgb"},d))};return be.createElement("div",{style:l.fields,className:"flexbox-fix"},be.createElement("div",{style:l.double},be.createElement(cl,{style:{input:l.input,label:l.label},label:"hex",value:i.replace("#",""),onChange:s})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"r",value:o.r,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"g",value:o.g,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"b",value:o.b,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.alpha},be.createElement(cl,{style:{input:l.input,label:l.label},label:"a",value:Math.round(o.a*100),onChange:s,dragLabel:"true",dragMax:"100"})))},xdo=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var YO=24,Hdo=Srt.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?YO:o,i=t.height,a=i===void 0?YO:i,l=t.style,s=l===void 0?{}:l,c=Rdo(t,["fill","width","height","style"]);return MHe.default.createElement("svg",HHe({viewBox:"0 0 "+YO+" "+YO,style:HHe({fill:n,width:r,height:a},s)},c),MHe.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Mdo=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.first,l=e.last,s=e.active,c=$i({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:A9e(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:a,last:l,active:s,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return be.createElement(sS,{color:n,style:c.color,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},be.createElement("div",{style:c.check},be.createElement(Hdo,null)))},Ido=function(e){var n=e.onClick,o=e.onSwatchHover,r=e.group,i=e.active,a=$i({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return be.createElement("div",{style:a.group},cS(r,function(l,s){return be.createElement(Mdo,{key:l,color:l,active:l.toLowerCase()===i,first:s===0,last:s===r.length-1,onClick:n,onSwatchHover:o})}))},z9e=function(e){var n=e.width,o=e.height,r=e.onChange,i=e.onSwatchHover,a=e.colors,l=e.hex,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=$i(h1({default:{picker:{width:n,height:o},overflow:{height:o,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),p=function(A,y){return r({hex:A,source:"hex"},y)};return be.createElement("div",{style:f.picker,className:"swatches-picker "+d},be.createElement(eU,null,be.createElement("div",{style:f.overflow},be.createElement("div",{style:f.body},cS(a,function(g){return be.createElement(Ido,{key:g.toString(),group:g,active:l,onClick:p,onSwatchHover:i})}),be.createElement("div",{style:f.clear})))))};z9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),height:mo.oneOfType([mo.string,mo.number]),colors:mo.arrayOf(mo.arrayOf(mo.string)),styles:mo.object};z9e.defaultProps={width:320,height:240,colors:[[yP[900],yP[700],yP[500],yP[300],yP[100]],[AP[900],AP[700],AP[500],AP[300],AP[100]],[wP[900],wP[700],wP[500],wP[300],wP[100]],[vP[900],vP[700],vP[500],vP[300],vP[100]],[xP[900],xP[700],xP[500],xP[300],xP[100]],[bP[900],bP[700],bP[500],bP[300],bP[100]],[SP[900],SP[700],SP[500],SP[300],SP[100]],[TP[900],TP[700],TP[500],TP[300],TP[100]],[PP[900],PP[700],PP[500],PP[300],PP[100]],["#194D33",KD[700],KD[500],KD[300],KD[100]],[CP[900],CP[700],CP[500],CP[300],CP[100]],[RP[900],RP[700],RP[500],RP[300],RP[100]],[HP[900],HP[700],HP[500],HP[300],HP[100]],[MP[900],MP[700],MP[500],MP[300],MP[100]],[IP[900],IP[700],IP[500],IP[300],IP[100]],[zP[900],zP[700],zP[500],zP[300],zP[100]],[DP[900],DP[700],DP[500],DP[300],DP[100]],[EP[900],EP[700],EP[500],EP[300],EP[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};p1(z9e);var D9e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.hex,i=e.colors,a=e.width,l=e.triangle,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=$i(h1({default:{card:{width:a,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":l==="hide","top-left-triangle":l==="top-left","top-right-triangle":l==="top-right"}),p=function(A,y){Qw(A)&&n({hex:A,source:"hex"},y)};return be.createElement("div",{style:f.card,className:"twitter-picker "+d},be.createElement("div",{style:f.triangleShadow}),be.createElement("div",{style:f.triangle}),be.createElement("div",{style:f.body},cS(i,function(g,A){return be.createElement(sS,{key:A,color:g,hex:g,style:f.swatch,onClick:p,onHover:o,focusStyle:{boxShadow:"0 0 4px "+g}})}),be.createElement("div",{style:f.hash},"#"),be.createElement(cl,{label:null,style:{input:f.input},value:r.replace("#",""),onChange:p}),be.createElement("div",{style:f.clear})))};D9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),triangle:mo.oneOf(["hide","top-left","top-right"]),colors:mo.arrayOf(mo.string),styles:mo.object};D9e.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};p1(D9e);var E9e=function(e){var n=$i({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return be.createElement("div",{style:n.picker})};E9e.propTypes={hsl:mo.shape({h:mo.number,s:mo.number,l:mo.number,a:mo.number})};E9e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var F9e=function(e){var n=$i({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return be.createElement("div",{style:n.picker})};F9e.propTypes={hsl:mo.shape({h:mo.number,s:mo.number,l:mo.number,a:mo.number})};F9e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var zdo=function(e){var n=e.onChange,o=e.rgb,r=e.hsl,i=e.hex,a=e.hsv,l=function(p,g){if(p.hex)Qw(p.hex)&&n({hex:p.hex,source:"hex"},g);else if(p.rgb){var A=p.rgb.split(",");Yae(p.rgb,"rgb")&&n({r:A[0],g:A[1],b:A[2],a:1,source:"rgb"},g)}else if(p.hsv){var y=p.hsv.split(",");Yae(p.hsv,"hsv")&&(y[2]=y[2].replace("%",""),y[1]=y[1].replace("%",""),y[0]=y[0].replace("°",""),y[1]==1?y[1]=.01:y[2]==1&&(y[2]=.01),n({h:Number(y[0]),s:Number(y[1]),v:Number(y[2]),source:"hsv"},g))}else if(p.hsl){var S=p.hsl.split(",");Yae(p.hsl,"hsl")&&(S[2]=S[2].replace("%",""),S[1]=S[1].replace("%",""),S[0]=S[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),n({h:Number(S[0]),s:Number(S[1]),v:Number(S[2]),source:"hsl"},g))}},s=$i({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=o.r+", "+o.g+", "+o.b,u=Math.round(r.h)+"°, "+Math.round(r.s*100)+"%, "+Math.round(r.l*100)+"%",d=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.v*100)+"%";return be.createElement("div",{style:s.wrap,className:"flexbox-fix"},be.createElement("div",{style:s.fields},be.createElement("div",{style:s.double},be.createElement(cl,{style:{input:s.input,label:s.label},label:"hex",value:i,onChange:l})),be.createElement("div",{style:s.column},be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"rgb",value:c,onChange:l})),be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"hsv",value:d,onChange:l})),be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"hsl",value:u,onChange:l})))))},k9e=function(e){var n=e.width,o=e.onChange,r=e.rgb,i=e.hsl,a=e.hsv,l=e.hex,s=e.header,c=e.styles,u=c===void 0?{}:c,d=e.className,f=d===void 0?"":d,p=$i(h1({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+r.r+", "+r.g+", "+r.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},u));return be.createElement("div",{style:p.picker,className:"google-picker "+f},be.createElement("div",{style:p.head},s),be.createElement("div",{style:p.swatch}),be.createElement("div",{style:p.saturation},be.createElement(pee,{hsl:i,hsv:a,pointer:E9e,onChange:o})),be.createElement("div",{style:p.body},be.createElement("div",{style:p.controls,className:"flexbox-fix"},be.createElement("div",{style:p.hue},be.createElement(CM,{style:p.Hue,hsl:i,radius:"4px",pointer:F9e,onChange:o}))),be.createElement(zdo,{rgb:r,hsl:i,hex:l,hsv:a,onChange:o})))};k9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),styles:mo.object,header:mo.string};k9e.defaultProps={width:652,styles:{},header:"Color picker"};p1(k9e);const Ddo=({setDialogVisible:t})=>{const e=M(pn),n=M(dYe),o=M(Jn),r=M(fYe),i=M(En),a=M($s),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState((s==null?void 0:s.color)??"#808080"),d=$t(),f=S=>{switch(a){case re.AllSelectedObjectsOfThisType:{for(const C of M.getState().elements)if(C.type===z.Foundation&&!C.locked&&M.getState().selectedElementIdSet.has(C.id)&&S!==C.color)return!0;break}case re.AllObjectsOfThisType:for(const C of M.getState().elements)if(C.type===z.Foundation&&!C.locked&&S!==C.color)return!0;break;default:if(S!==(s==null?void 0:s.color))return!0}return!1},p=(S,C)=>{M.getState().set(P=>{for(const v of P.elements)if(v.type===z.Foundation&&S.has(v.id))if(C!==void 0)v.color=C;else{const T=S.get(v.id);T!==void 0&&(v.color=T)}})},g=S=>{if(s&&f(S)){switch(a){case re.AllSelectedObjectsOfThisType:{const C=new Map;for(const v of M.getState().elements)v.type===z.Foundation&&M.getState().selectedElementIdSet.has(v.id)&&C.set(v.id,v.color??"#808080");const P={name:"Set Color for Selected Foundations",timestamp:Date.now(),oldValues:C,newValue:S,undo:()=>{p(P.oldValues)},redo:()=>{p(P.oldValues,P.newValue)}};i(P),p(C,S),l(M.getState().applyCount+1);break}case re.AllObjectsOfThisType:{const C=new Map;for(const v of M.getState().elements)v.type===z.Foundation&&C.set(v.id,v.color??"#808080");const P={name:"Set Color for All Foundations",timestamp:Date.now(),oldValues:C,newValue:S,undo:()=>{for(const[v,T]of P.oldValues.entries())n(v,T)},redo:()=>{r(z.Foundation,P.newValue)}};i(P),r(z.Foundation,S),l(M.getState().applyCount+1);break}default:{const C=o(s.id),P=C?C.color:s.color,v={name:"Set Color of Selected Foundation",timestamp:Date.now(),oldValue:P,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(v.changedElementId,v.oldValue)},redo:()=>{n(v.changedElementId,v.newValue)}};i(v),n(s.id,S),l(M.getState().applyCount+1);break}}e(C=>{C.actionState.foundationColor=S})}},A=()=>{g(c)},y=()=>{t(!1)};return h.jsx(so,{width:600,title:Y.t("word.Color",d),onApply:A,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:c,onChangeComplete:S=>{u(S.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S=>M.getState().setFoundationActionScope(S.target.value),value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},Edo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(cYe),r=M(d3),i=M(vW),a=M(kw),l=M(LH),s=M(u3),c=M(En),u=M($s),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Foundation),[y,S]=m.useState((A==null?void 0:A.lx)??.1),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=se=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation&&M.getState().selectedElementIdSet.has(Z.id)){const ee=Z,te=l(ee.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ee,te,se,ee.ly))return!1}break}case re.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Foundation){const ee=Z,te=l(ee.id);if(te.length>0&&!ye.doesNewSizeContainAllChildren(ee,te,se,ee.ly))return!1}break}default:{const Z=l(A.id);if(Z.length>0)return ye.doesNewSizeContainAllChildren(A,Z,se,A.ly);break}}return!0}},U=se=>!N(se),W=se=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&M.getState().selectedElementIdSet.has(Z.id)&&Math.abs(Z.lx-se)>Et)return!0;break;case re.AllObjectsOfThisType:for(const Z of e)if(Z.type===z.Foundation&&!Z.locked&&Math.abs(Z.lx-se)>Et)return!0;break;default:if(Math.abs((A==null?void 0:A.lx)-se)>Et)return!0}return!1}},k=(se,Z)=>{if(se==null)return null;for(const ee of se.children)if(ee.name.includes(`${Z}`))return ee;return null},D=(se,Z,ee)=>{var te,oe;if(se){for(const de of se.children)if(de.name.includes(`${ee.id}`)){(oe=(te=kn.getState().contentRef)==null?void 0:te.current)==null||oe.add(de);break}d(de=>{for(const he of de.elements)if(he.id===ee.id){he.parentId=Zo;const pe=new Kt(he.cx,he.cy).rotateAround(ai,Z.rotation[2]).add(new Kt(Z.cx,Z.cy));he.cx=pe.x,he.cy=pe.y,he.cz=0,T.current.set(he.id,new ae(pe.x,pe.y,0)),P.current.set(he.id,Zo);break}})}},L=(se,Z)=>{const ee=l(se.id),te=se.rotation[2];if(w.current.clear(),R.current.clear(),ee.length>0)for(const oe of ee)switch(oe.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const de=new Kt(oe.cx*se.lx,oe.cy*se.ly).rotateAround(ai,te);w.current.set(oe.id,de),v.current.set(oe.id,new ae(oe.cx,oe.cy));break}case z.Polygon:{const de=oe,he=[];for(const pe of de.vertices)he.push(new Kt(pe.x*se.lx,pe.y*se.ly).rotateAround(ai,te));R.current.set(oe.id,he),x.current.set(oe.id,de.vertices.map(pe=>({...pe})));break}case z.Human:case z.Tree:{v.current.set(oe.id,new ae(oe.cx,oe.cy,oe.cz));break}}if(r(se.id,Z),ee.length>0)for(const oe of ee)switch(oe.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const de=w.current.get(oe.id);if(de){const pe=new Kt(de.x,de.y).rotateAround(ai,-te).x/Z;o(oe.id,pe),T.current.set(oe.id,new ae(pe,oe.cy))}break}case z.Polygon:{const de=R.current.get(oe.id);if(de){const he=[];for(const pe of de){const me=pe.rotateAround(ai,-te),le=me.x/Z,Te=me.y/se.ly;he.push({x:le,y:Te})}a(oe.id,he),b.current.set(oe.id,he.map(pe=>({...pe})))}break}case z.Human:case z.Tree:{if(T.current.set(oe.id,new ae(oe.cx,oe.cy,oe.cz)),C.current.set(oe.id,se.id),Math.abs(oe.cz-se.lz/2)0){const de=kn.getState().contentRef,he=k(de==null?void 0:de.current,se.id);D(he,se,oe)}}else if(Math.abs(Math.abs(oe.cx)-se.lx/2)0?Z:-Z)/2;o(oe.id,de),T.current.set(oe.id,new ae(de,oe.cy,oe.cz))}break}}},j=(se,Z,ee)=>{if(!se||!Z)return;const te=kn.getState().contentRef,oe=k(te==null?void 0:te.current,Z),de=k(Z===Zo?te==null?void 0:te.current:oe,ee);if(de&&(te!=null&&te.current)){if(se===Zo)te.current.add(de);else{const he=k(te.current,se);he==null||he.add(de)}op()}},B=(se,Z)=>{se&&d(ee=>{for(const te of ee.elements)if(te.id===Z){te.parentId=se;break}})},O=(se,Z)=>{M.getState().set(ee=>{for(const te of ee.elements)if(se.has(te.id))if(Z!==void 0)te.lx=Z;else{const oe=se.get(te.id);oe!==void 0&&(te.lx=oe)}})},V=se=>{if(!A||!W(se))return;const Z=n(A.id),ee=Z?Z.lx:A.lx;if(F.current=void 0,H.current=U(se),H.current)F.current=se,S(ee);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),u){case re.AllSelectedObjectsOfThisType:{const te=new Map;for(const de of e)de.type===z.Foundation&&M.getState().selectedElementIdSet.has(de.id)&&te.set(de.id,de.lx);for(const de of e)de.type===z.Foundation&&M.getState().selectedElementIdSet.has(de.id)&&L(de,se);const oe={name:"Set Length for Selected Foundations",timestamp:Date.now(),oldSizes:te,newSize:se,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;if(O(oe.oldSizes),oe.oldChildrenPositionsMap&&oe.oldChildrenPositionsMap.size>0)for(const[pe,me]of oe.oldChildrenPositionsMap.entries()){s(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(j(le,Te,pe),B(le,pe))}if(oe.oldChildrenVerticesMap&&oe.oldChildrenVerticesMap.size>0)for(const[pe,me]of oe.oldChildrenVerticesMap.entries())a(pe,me)},redo:()=>{var de,he;if(O(oe.oldSizes,oe.newSize),oe.newChildrenPositionsMap&&oe.newChildrenPositionsMap.size>0)for(const[pe,me]of oe.newChildrenPositionsMap.entries()){s(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(j(Te,le,pe),B(Te,pe))}if(oe.newChildrenVerticesMap&&oe.newChildrenVerticesMap.size>0)for(const[pe,me]of oe.newChildrenVerticesMap.entries())a(pe,me)}};c(oe),p(f+1);break}case re.AllObjectsOfThisType:{const te=new Map;for(const de of e)de.type===z.Foundation&&te.set(de.id,de.lx);for(const de of e)de.type===z.Foundation&&L(de,se);const oe={name:"Set Length for All Foundations",timestamp:Date.now(),oldSizes:te,newSize:se,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;for(const[pe,me]of oe.oldSizes.entries())r(pe,me);if(oe.oldChildrenPositionsMap&&oe.oldChildrenPositionsMap.size>0)for(const[pe,me]of oe.oldChildrenPositionsMap.entries()){s(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(j(le,Te,pe),B(le,pe))}if(oe.oldChildrenVerticesMap&&oe.oldChildrenVerticesMap.size>0)for(const[pe,me]of oe.oldChildrenVerticesMap.entries())a(pe,me)},redo:()=>{var de,he;if(i(z.Foundation,oe.newSize),oe.newChildrenPositionsMap&&oe.newChildrenPositionsMap.size>0)for(const[pe,me]of oe.newChildrenPositionsMap.entries()){s(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(j(Te,le,pe),B(Te,pe))}if(oe.newChildrenVerticesMap&&oe.newChildrenVerticesMap.size>0)for(const[pe,me]of oe.newChildrenVerticesMap.entries())a(pe,me)}};c(oe),p(f+1);break}default:{L(A,se);const te={name:"Set Foundation Length",timestamp:Date.now(),oldSize:ee,newSize:se,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var oe,de;if(r(A.id,te.oldSize),te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[he,pe]of te.oldChildrenPositionsMap.entries()){s(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(me,le,he),B(me,he))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[he,pe]of te.oldChildrenVerticesMap.entries())a(he,pe)},redo:()=>{var oe,de;if(r(A.id,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[he,pe]of te.newChildrenPositionsMap.entries()){s(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(le,me,he),B(le,he))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[he,pe]of te.newChildrenVerticesMap.entries())a(he,pe)}};c(te),p(f+1);break}}},G=()=>{t(!1)},q=()=>{G(),g()},$=()=>{V(y),H.current||(t(!1),p(0))},ie=()=>{V(y)},Q=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",E),rejectedMessage:Q,onApply:ie,onClose:G,onClickCancel:q,onClickOk:$,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:se=>{se!==null&&S(se)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:se=>M.getState().setFoundationActionScope(se.target.value),value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",E)})]})})})]})})},Fdo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(u3),r=M(uYe),i=M(Fw),a=M(xW),l=M(kw),s=M(LH),c=M(En),u=M($s),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Foundation),[y,S]=m.useState((A==null?void 0:A.ly)??.1),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=Q=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const se of e)if(se.type===z.Foundation&&M.getState().selectedElementIdSet.has(se.id)){const Z=se,ee=s(Z.id);if(ee.length>0&&!ye.doesNewSizeContainAllChildren(Z,ee,Z.lx,Q))return!1}break}case re.AllObjectsOfThisType:{for(const se of e)if(se.type===z.Foundation){const Z=se,ee=s(Z.id);if(ee.length>0&&!ye.doesNewSizeContainAllChildren(Z,ee,Z.lx,Q))return!1}break}default:{const se=s(A.id);if(se.length>0)return ye.doesNewSizeContainAllChildren(A,se,A.lx,Q);break}}return!0}},U=Q=>!N(Q),W=Q=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const se of e)if(se.type===z.Foundation&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.ly-Q)>Et)return!0;break;case re.AllObjectsOfThisType:for(const se of e)if(se.type===z.Foundation&&!se.locked&&Math.abs(se.ly-Q)>Et)return!0;break;default:if(Math.abs((A==null?void 0:A.ly)-Q)>Et)return!0}return!1}},k=(Q,se)=>{if(Q==null)return null;for(const Z of Q.children)if(Z.name.includes(`${se}`))return Z;return null},D=(Q,se,Z)=>{var ee,te;if(Q){for(const oe of Q.children)if(oe.name.includes(`${Z.id}`)){(te=(ee=kn.getState().contentRef)==null?void 0:ee.current)==null||te.add(oe);break}d(oe=>{for(const de of oe.elements)if(de.id===Z.id){de.parentId=Zo;const he=new Kt(de.cx,de.cy).rotateAround(ai,se.rotation[2]).add(new Kt(se.cx,se.cy));de.cx=he.x,de.cy=he.y,de.cz=0,T.current.set(de.id,new ae(he.x,he.y,0)),P.current.set(de.id,Zo);break}})}},L=(Q,se)=>{const Z=s(Q.id),ee=Q.rotation[2];if(w.current.clear(),R.current.clear(),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const oe=new Kt(te.cx*Q.lx,te.cy*Q.ly).rotateAround(ai,ee);w.current.set(te.id,oe),v.current.set(te.id,new ae(te.cx,te.cy));break}case z.Polygon:{const oe=te,de=[];for(const he of oe.vertices)de.push(new Kt(he.x*Q.lx,he.y*Q.ly).rotateAround(ai,ee));R.current.set(te.id,de),x.current.set(te.id,oe.vertices.map(he=>({...he})));break}case z.Human:case z.Tree:{v.current.set(te.id,new ae(te.cx,te.cy,te.cz));break}}if(i(Q.id,se),Z.length>0)for(const te of Z)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const oe=w.current.get(te.id);if(oe){const he=new Kt(oe.x,oe.y).rotateAround(ai,-ee).y/se;r(te.id,he),T.current.set(te.id,new ae(te.cx,he))}break}case z.Polygon:{const oe=R.current.get(te.id);if(oe){const de=[];for(const he of oe){const pe=he.rotateAround(ai,-ee),me=pe.x/Q.lx,le=pe.y/se;de.push({x:me,y:le})}l(te.id,de),b.current.set(te.id,de.map(he=>({...he})))}break}case z.Human:case z.Tree:{if(T.current.set(te.id,new ae(te.cx,te.cy,te.cz)),C.current.set(te.id,Q.id),Math.abs(te.cz-Q.lz/2)0){const oe=kn.getState().contentRef,de=k(oe==null?void 0:oe.current,Q.id);D(de,Q,te)}}else if(Math.abs(Math.abs(te.cy)-Q.ly/2)0?se:-se)/2;r(te.id,oe),T.current.set(te.id,new ae(te.cz,oe,te.cz))}break}}},j=(Q,se,Z)=>{if(!Q||!se)return;const ee=kn.getState().contentRef,te=k(ee==null?void 0:ee.current,se),oe=k(se===Zo?ee==null?void 0:ee.current:te,Z);if(oe&&(ee!=null&&ee.current)){if(Q===Zo)ee.current.add(oe);else{const de=k(ee.current,Q);de==null||de.add(oe)}op()}},B=(Q,se)=>{Q&&d(Z=>{for(const ee of Z.elements)if(ee.id===se){ee.parentId=Q;break}})},O=Q=>{if(!A||!W(Q))return;const se=n(A.id),Z=se?se.ly:A.ly;if(F.current=void 0,H.current=U(Q),H.current)F.current=Q,S(Z);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),u){case re.AllSelectedObjectsOfThisType:{const ee=new Map;for(const oe of e)oe.type===z.Foundation&&M.getState().selectedElementIdSet.has(oe.id)&&ee.set(oe.id,oe.ly);for(const oe of e)oe.type===z.Foundation&&M.getState().selectedElementIdSet.has(oe.id)&&L(oe,Q);const te={name:"Set Width for Selected Foundations",timestamp:Date.now(),oldSizes:ee,newSize:Q,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var oe,de;for(const[he,pe]of te.oldSizes.entries())i(he,pe);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[he,pe]of te.oldChildrenPositionsMap.entries()){o(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(me,le,he),B(me,he))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[he,pe]of te.oldChildrenVerticesMap.entries())l(he,pe)},redo:()=>{var oe,de;for(const[he,pe]of te.oldSizes.entries())i(he,te.newSize);if(te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[he,pe]of te.newChildrenPositionsMap.entries()){o(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(le,me,he),B(le,he))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[he,pe]of te.newChildrenVerticesMap.entries())l(he,pe)}};c(te),p(f+1);break}case re.AllObjectsOfThisType:{const ee=new Map;for(const oe of e)oe.type===z.Foundation&&ee.set(oe.id,oe.ly);for(const oe of e)oe.type===z.Foundation&&L(oe,Q);const te={name:"Set Width for All Foundations",timestamp:Date.now(),oldSizes:ee,newSize:Q,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var oe,de;for(const[he,pe]of te.oldSizes.entries())i(he,pe);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[he,pe]of te.oldChildrenPositionsMap.entries()){o(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(me,le,he),B(me,he))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[he,pe]of te.oldChildrenVerticesMap.entries())l(he,pe)},redo:()=>{var oe,de;if(a(z.Foundation,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[he,pe]of te.newChildrenPositionsMap.entries()){o(he,pe.x,pe.y,pe.z);const me=(oe=te.oldChildrenParentIdMap)==null?void 0:oe.get(he),le=(de=te.newChildrenParentIdMap)==null?void 0:de.get(he);me&&le&&me!==le&&(j(le,me,he),B(le,he))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[he,pe]of te.newChildrenVerticesMap.entries())l(he,pe)}};c(te),p(f+1);break}default:{L(A,Q);const ee={name:"Set Foundation Width",timestamp:Date.now(),oldSize:Z,newSize:Q,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var te,oe;if(i(A.id,ee.oldSize),ee.oldChildrenPositionsMap&&ee.oldChildrenPositionsMap.size>0)for(const[de,he]of ee.oldChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const pe=(te=ee.oldChildrenParentIdMap)==null?void 0:te.get(de),me=(oe=ee.newChildrenParentIdMap)==null?void 0:oe.get(de);pe&&me&&pe!==me&&(j(pe,me,de),B(pe,de))}if(ee.oldChildrenVerticesMap&&ee.oldChildrenVerticesMap.size>0)for(const[de,he]of ee.oldChildrenVerticesMap.entries())l(de,he)},redo:()=>{var te,oe;if(i(A.id,ee.newSize),ee.newChildrenPositionsMap&&ee.newChildrenPositionsMap.size>0)for(const[de,he]of ee.newChildrenPositionsMap.entries()){o(de,he.x,he.y,he.z);const pe=(te=ee.oldChildrenParentIdMap)==null?void 0:te.get(de),me=(oe=ee.newChildrenParentIdMap)==null?void 0:oe.get(de);pe&&me&&pe!==me&&(j(me,pe,de),B(me,de))}if(ee.newChildrenVerticesMap&&ee.newChildrenVerticesMap.size>0)for(const[de,he]of ee.newChildrenVerticesMap.entries())l(de,he)}};c(ee),p(f+1);break}}},V=()=>{t(!1)},G=()=>{V(),g()},q=()=>{O(y),H.current||(t(!1),p(0))},$=()=>{O(y)},ie=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",E),rejectedMessage:ie,onApply:$,onClickCancel:G,onClickOk:q,onClose:V,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:Q=>{Q!==null&&S(Q)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:Q=>M.getState().setFoundationActionScope(Q.target.value),value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",E)})]})})})]})})},kdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(u3),l=M(no),s=M(Qn),c=uo(z.Foundation),[u,d]=m.useState((c==null?void 0:c.lz)??.1),f=m.useRef(new Map),p=m.useRef(new Map),g=m.useRef(new Map),A=m.useRef(new Map),y=$t(),S=(N,U)=>{e(W=>{const k=W.elements.find(D=>D.id===N);k&&(k.lz=U,k.cz=U/2)})},C=(N,U)=>{e(W=>{for(const k of W.elements)k.type===N&&!k.locked&&(k.lz=U,k.cz=U/2)})},P=N=>{if(c){switch(i){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Foundation&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.lz-N)>Et)return!0;break}case re.AllObjectsOfThisType:for(const U of n)if(U.type===z.Foundation&&!U.locked&&Math.abs(U.lz-N)>Et)return!0;break;default:if(Math.abs((c==null?void 0:c.lz)-N)>Et)return!0}return!1}},v=(N,U)=>{if(N==null)return null;for(const W of N.children)if(W.name.includes(`${U}`))return W;return null},T=(N,U,W)=>{var k,D;if(N){for(const j of N.children)if(j.name.includes(`${W.id}`)){(D=(k=kn.getState().contentRef)==null?void 0:k.current)==null||D.add(j);break}W.parentId=Zo;const L=new Kt(W.cx,W.cy).rotateAround(ai,-U.rotation[2]).add(new Kt(U.cx,U.cy));W.cx=L.x,W.cy=L.y,W.cz=0,A.current.set(W.id,new ae(L.x,L.y,0)),p.current.set(W.id,Zo)}},w=(N,U,W)=>{e(k=>{for(const D of k.elements)if(D.parentId===N.id)if(f.current.set(D.id,N.id),g.current.set(D.id,new ae(D.cx,D.cy,D.cz)),ye.isPlantOrHuman(D))if(Math.abs(D.cz-N.lz/2)U/2){const j=kn.getState().contentRef,B=v(j==null?void 0:j.current,N.id);T(B,N,D)}else D.cz=L,A.current.set(D.id,new ae(D.cx,D.cy,L))}else D.type===z.SolarPanel&&(D.cz=U/2,A.current.set(D.id,new ae(D.cx,D.cy,U/2)));else D.foundationId===N.id&&D.type===z.SolarPanel&&D.parentType==z.Roof&&W!==void 0&&(g.current.set(D.id,new ae(D.cx,D.cy,D.cz)),D.cz=D.cz-W/2+U/2,A.current.set(D.id,new ae(D.cx,D.cy,D.cz)))})},x=(N,U,W)=>{if(!N||!U)return;const k=kn.getState().contentRef,D=v(k==null?void 0:k.current,U),L=v(U===Zo?k==null?void 0:k.current:D,W);if(L&&(k!=null&&k.current)){if(N===Zo)k.current.add(L);else{const j=v(k.current,N);j==null||j.add(L)}op()}},b=(N,U)=>{N&&e(W=>{for(const k of W.elements)if(k.id===U){k.parentId=N;break}})},R=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)if(N.has(k.id))if(U!==void 0)k.lz=U,k.cz=U/2;else{const D=N.get(k.id);D!==void 0&&(k.lz=D,k.cz=D/2)}})},H=N=>{if(c&&P(N)){switch(i){case re.AllSelectedObjectsOfThisType:{const U=new Map;for(const k of n)k.type===z.Foundation&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.lz);for(const k of n)k.type===z.Foundation&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&w(k,N,U.get(k.id));const W={name:"Set Height for Selected Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var k,D;if(R(W.oldValues),W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const B=(k=W.oldChildrenParentIdMap)==null?void 0:k.get(L),O=(D=W.newChildrenParentIdMap)==null?void 0:D.get(L);B&&O&&B!==O&&(x(B,O,L),b(B,L))}},redo:()=>{var D,L;const k=W.newValue;if(R(W.oldValues,k),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,B]of W.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=W.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(W),R(U,N),s(l+1);break}case re.AllObjectsOfThisType:{const U=new Map;for(const k of n)k.type===z.Foundation&&U.set(k.id,k.lz);for(const k of n)k.type===z.Foundation&&w(k,N,U.get(k.id));const W={name:"Set Height for All Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var k,D;for(const[L,j]of W.oldValues.entries())S(L,j);if(W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const B=(k=W.oldChildrenParentIdMap)==null?void 0:k.get(L),O=(D=W.newChildrenParentIdMap)==null?void 0:D.get(L);B&&O&&B!==O&&(x(B,O,L),b(B,L))}},redo:()=>{var D,L;const k=W.newValue;if(C(z.Foundation,k),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,B]of W.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=W.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(W),C(z.Foundation,N),s(l+1);break}default:{const U=o(c.id),W=U?U.lz:c.lz;w(c,N,W),S(c.id,N);const k={name:"Set Foundation Height",timestamp:Date.now(),oldValue:W,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),changedElementId:c.id,changedElementType:c.type,undo:()=>{var D,L;if(S(k.changedElementId,k.oldValue),k.oldChildrenPositionsMap&&k.oldChildrenPositionsMap.size>0)for(const[j,B]of k.oldChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=k.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=k.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(O,V,j),b(O,j))}},redo:()=>{var D,L;if(S(k.changedElementId,k.newValue),k.newChildrenPositionsMap&&k.newChildrenPositionsMap.size>0)for(const[j,B]of k.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=k.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=k.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(k),s(l+1);break}}e(U=>{U.actionState.foundationHeight=N})}},F=()=>{t(!1)},E=()=>{H(u)};return h.jsx(so,{width:550,title:Y.t("word.Height",y),onApply:E,onClose:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:10,style:{width:120},step:.1,precision:2,value:u,onChange:N=>{N!==null&&d(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 10] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N=>M.getState().setFoundationActionScope(N.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",y)})]})})})]})})},Ldo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Bge),r=M(i7t),i=M(En),a=M($s),l=M(no),s=M(Qn),c=uo(z.Foundation),[u,d]=m.useState(c?-(c==null?void 0:c.rotation[2]):0),f=$t(),p=C=>{if(c){switch(a){case re.AllSelectedObjectsOfThisType:{for(const P of e)if(P.type===z.Foundation&&!P.locked&&M.getState().selectedElementIdSet.has(P.id)&&Math.abs(-P.rotation[2]-C)>Et)return!0;break}case re.AllObjectsOfThisType:for(const P of e)if(P.type===z.Foundation&&!P.locked&&Math.abs(-P.rotation[2]-C)>Et)return!0;break;default:if(Math.abs(-(c==null?void 0:c.rotation[2])-C)>Et)return!0}return!1}},g=(C,P)=>{M.getState().set(v=>{for(const T of v.elements)if(C.has(T.id))if(P!==void 0)T.rotation[2]=P;else{const w=C.get(T.id);w!==void 0&&(T.rotation[2]=-w)}})},A=C=>{if(c&&p(C))switch(a){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Foundation&&M.getState().selectedElementIdSet.has(T.id)&&P.set(T.id,-T.rotation[2]);const v={name:"Set Azimuth for All Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{g(v.oldValues)},redo:()=>{g(v.oldValues,-v.newValue)}};i(v),g(P,-C),s(l+1);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Foundation&&P.set(T.id,-T.rotation[2]);const v={name:"Set Azimuth for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())o(T,0,0,-w)},redo:()=>{r(z.Foundation,0,0,-v.newValue)}};i(v),r(z.Foundation,0,0,-C),s(l+1);break}default:{const P=n(c.id),v=P?-P.rotation[2]:-c.rotation[2],T={name:"Set Foundation Azimuth",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(T.changedElementId,0,0,-T.oldValue)},redo:()=>{o(T.changedElementId,0,0,-T.newValue)}};i(T),o(c.id,0,0,-C),s(l+1);break}}},y=()=>{t(!1)},S=()=>{A(u)};return h.jsx(so,{width:500,title:Y.t("word.Azimuth",f),onApply:S,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:C=>`${C}°`,onChange:C=>{C!==null&&d(ye.toRadians(C))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:C=>M.getState().setFoundationActionScope(C.target.value),value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Wdo=({setDialogVisible:t})=>{const e=M(Kn),n=M(c3),o=M(En),r=M($s),i=M(a7t),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),u=M(pn),d=M(k=>{if(n){for(const D of k.elements)if(D.id===n.id)return D}return null}),[f,p]=m.useState((d==null?void 0:d.rValue)??i8),[g,A]=m.useState(ye.toRValueInUS(f)),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=$t();m.useEffect(()=>{d&&p((d==null?void 0:d.rValue)??i8)},[d==null?void 0:d.rValue]);const w=k=>{switch(r){case re.AllObjectsOfThisType:for(const D of e)if(D.type===z.Foundation&&!D.locked){const L=D;if(L.rValue===void 0||Math.abs(L.rValue-k)>Et)return!0}break;default:if((d==null?void 0:d.rValue)===void 0||Math.abs((d==null?void 0:d.rValue)-k)>Et)return!0}return!1},x=(k,D)=>{u(L=>{for(const j of L.elements)if(j.id===k){j.rValue=D;break}})},b=k=>{for(const[D,L]of k.entries())x(D,L)},R=(k,D)=>{for(const L of k.keys())x(L,D)},H=k=>{if(d&&w(k)){switch(r){case re.AllObjectsOfThisType:{const D=new Map;u(j=>{for(const B of j.elements)if(B.type===z.Foundation&&!B.locked){const O=B;D.set(B.id,O.rValue??i8),O.rValue=k}});const L={name:"Set R-Value for All Ground Floors",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{b(L.oldValues)},redo:()=>{R(L.oldValues,L.newValue)}};o(L),l(a+1);break}default:{if(d){const L=c(d.id).rValue??d.rValue??i8,j={name:"Set Ground Floor R-Value",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};o(j),x(d.id,k),l(a+1)}break}}u(D=>{D.actionState.groundFloorRValue=k})}},F=(k,D)=>{if(v.current){const{clientWidth:L,clientHeight:j}=window.document.documentElement,B=v.current.getBoundingClientRect();P({left:-B.left+D.x,right:L-(B.right-D.x),top:-B.top+D.y,bottom:j-((B==null?void 0:B.bottom)-D.y)})}},E=()=>{p((d==null?void 0:d.rValue)??i8),t(!1)},N=()=>{E(),s()},U=()=>{H(f),t(!1),l(0)},W=()=>{H(f)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:[Y.t("word.RValue",T)+" ","(",Y.t("word.ThermalResistance",T),")"]}),footer:[h.jsx(io,{onClick:W,children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:N,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:U,children:Y.t("word.OK",T)},"OK")],onCancel:E,maskClosable:!1,destroyOnClose:!1,modalRender:k=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(D,L)=>F(D,L),children:h.jsx("div",{ref:v,children:k})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:k=>Number(k).toFixed(2),onChange:k=>{k!==null&&(p(k),A(ye.toRValueInUS(k)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",T),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:g,formatter:k=>Number(k).toFixed(2),onChange:k=>{k!==null&&(A(k),p(ye.toRValueInSI(k)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",T),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:k=>i(k.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisGroundFloor",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllGroundFloors",T)})]})})})]})})})},Ndo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberHeight)??10),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberHeight=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberHeight===void 0||Math.abs(w.solarAbsorberPipe.absorberHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberHeight===void 0||Math.abs(w.solarAbsorberPipe.absorberHeight-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberHeight)===void 0||Math.abs((c==null?void 0:c.absorberHeight)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberHeight??10)}const w={name:"Set Absorber Height for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberHeight??10)}const w={name:"Set Absorber Height for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberHeight??10:c.absorberHeight??10;p(s.id,v);const x={name:"Set Absorber Height on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberHeight",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:50,style:{width:120},step:.5,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [1, 50] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Udo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.apertureWidth)??.6),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.apertureWidth=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.apertureWidth===void 0||Math.abs(w.solarAbsorberPipe.apertureWidth-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.apertureWidth===void 0||Math.abs(w.solarAbsorberPipe.apertureWidth-v)>Et))return!0}break;default:if((c==null?void 0:c.apertureWidth)===void 0||Math.abs((c==null?void 0:c.apertureWidth)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.apertureWidth??.6)}const w={name:"Set Absorber Aperture Width for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.apertureWidth??.6)}const w={name:"Set Absorber Aperture Width for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.apertureWidth??.6:c.apertureWidth??.6;p(s.id,v);const x={name:"Set Absorber Aperture Width on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberApertureWidth",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0.1, 2] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},jdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.poleNumber)??5),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.poleNumber=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.poleNumber===void 0||w.solarAbsorberPipe.poleNumber!==v))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.poleNumber===void 0||w.solarAbsorberPipe.poleNumber!==v))return!0}break;default:if((c==null?void 0:c.poleNumber)===void 0||(c==null?void 0:c.poleNumber)!==v)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.poleNumber??5)}const w={name:"Set Absorber Pipe Pole Number for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.poleNumber??5)}const w={name:"Set Absorber Pipe Pole Number for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.poleNumber??5:c.poleNumber??5;p(s.id,v);const x={name:"Set Absorber Pipe Pole Number on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:1,precision:0,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [1, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Bdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberAbsorptance)??.95),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberAbsorptance=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(w.solarAbsorberPipe.absorberAbsorptance-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(w.solarAbsorberPipe.absorberAbsorptance-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberAbsorptance)===void 0||Math.abs((c==null?void 0:c.absorberAbsorptance)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberAbsorptance??.95)}const w={name:"Set Absorber Pipe Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberAbsorptance??.95)}const w={name:"Set Absorber Pipe Absorptance for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberAbsorptance??.95:c.absorberAbsorptance??.95;p(s.id,v);const x={name:"Set Absorber Pipe Absorptance on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Ydo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberOpticalEfficiency)??.7),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberOpticalEfficiency=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberOpticalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberOpticalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberOpticalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const w={name:"Set Absorber Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const w={name:"Set Absorber Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberOpticalEfficiency??.7:c.absorberOpticalEfficiency??.7;p(s.id,v);const x={name:"Set Absorber Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Odo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberThermalEfficiency)??.3),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberThermalEfficiency=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberThermalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberThermalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberThermalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberThermalEfficiency??.3)}const w={name:"Set Absorber Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberThermalEfficiency??.3)}const w={name:"Set Absorber Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberThermalEfficiency??.3:c.absorberThermalEfficiency??.3;p(s.id,v);const x={name:"Set Absorber Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Vdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.towerHeight)??20),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.towerHeight=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerHeight===void 0||Math.abs(w.solarPowerTower.towerHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerHeight===void 0||Math.abs(w.solarPowerTower.towerHeight-v)>Et))return!0}break;default:if((c==null?void 0:c.towerHeight)===void 0||Math.abs((c==null?void 0:c.towerHeight)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerHeight??20)}const w={name:"Set Tower Height for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerHeight??20)}const w={name:"Set Tower Height for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.towerHeight??20:c.towerHeight??20;p(s.id,v);const x={name:"Set Tower Height on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverTowerHeight",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:10,max:500,style:{width:120},step:1,precision:1,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [10, 500] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},_do=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.towerRadius)??1),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.towerRadius=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerRadius===void 0||Math.abs(w.solarPowerTower.towerRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerRadius===void 0||Math.abs(w.solarPowerTower.towerRadius-v)>Et))return!0}break;default:if((c==null?void 0:c.towerRadius)===void 0||Math.abs((c==null?void 0:c.towerRadius)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerRadius??1)}const w={name:"Set Tower Radius for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerRadius??1)}const w={name:"Set Tower Radius for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.towerRadius??1:c.towerRadius??1;p(s.id,v);const x={name:"Set Tower Radius on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverTowerRadius",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.5,max:10,style:{width:120},step:.5,precision:1,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0.5, 10] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Gdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverAbsorptance)??.95),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverAbsorptance=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverAbsorptance===void 0||Math.abs(w.solarPowerTower.receiverAbsorptance-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverAbsorptance===void 0||Math.abs(w.solarPowerTower.receiverAbsorptance-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverAbsorptance)===void 0||Math.abs((c==null?void 0:c.receiverAbsorptance)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverAbsorptance??.95)}const w={name:"Set Receiver Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverAbsorptance??.95)}const w={name:"Set Receiver Absorptance for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverAbsorptance??.95:c.receiverAbsorptance??.95;p(s.id,v);const x={name:"Set Receiver Absorptance on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarPowerTowerMenu.ReceiverAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Xdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverThermalEfficiency)??.3),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverThermalEfficiency=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverThermalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverThermalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverThermalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverThermalEfficiency??.3)}const w={name:"Set Receiver Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverThermalEfficiency??.3)}const w={name:"Set Receiver Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverThermalEfficiency??.3:c.receiverThermalEfficiency??.3;p(s.id,v);const x={name:"Set Receiver Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Jdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverOpticalEfficiency)??.7),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverOpticalEfficiency=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverOpticalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverOpticalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverOpticalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverOpticalEfficiency??.7)}const w={name:"Set Receiver Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverOpticalEfficiency??.7)}const w={name:"Set Receiver Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverOpticalEfficiency??.7:c.receiverOpticalEfficiency??.7;p(s.id,v);const x={name:"Set Receiver Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Kdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyHeight)??Math.max((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0)),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.chimneyHeight=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyHeight===void 0||Math.abs(w.solarUpdraftTower.chimneyHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyHeight===void 0||Math.abs(w.solarUpdraftTower.chimneyHeight-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyHeight===void 0||Math.abs(s.solarUpdraftTower.chimneyHeight-v)>Et))return!0}return!1},y=v=>{var T,w;if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation&&M.getState().selectedElementIdSet.has(R.id)){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((T=H.solarUpdraftTower)==null?void 0:T.chimneyHeight)??Math.max(H.lx,H.ly))}const b={name:"Set Solar Chimney Height for Selected Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{g(b.oldValues,b.newValue)}};r(b),g(x,v),l(a+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((w=H.solarUpdraftTower)==null?void 0:w.chimneyHeight)??Math.max(H.lx,H.ly))}const b={name:"Set Solar Chimney Height for All Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};r(b),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const x=o(s.id),b=x&&x.solarUpdraftTower?x.solarUpdraftTower.chimneyHeight??Math.max(x.lx,x.ly):s.solarUpdraftTower.chimneyHeight??Math.max(s.lx,s.ly);f(s.id,v);const R={name:"Set Solar Chimney Height on Foundation",timestamp:Date.now(),oldValue:b,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [1, 1000] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},qdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyRadius)??Math.max(1,.025*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.chimneyRadius=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyRadius===void 0||Math.abs(w.solarUpdraftTower.chimneyRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyRadius===void 0||Math.abs(w.solarUpdraftTower.chimneyRadius-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyRadius===void 0||Math.abs(s.solarUpdraftTower.chimneyRadius-v)>Et))return!0}return!1},y=v=>{var T,w;if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation&&M.getState().selectedElementIdSet.has(R.id)){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((T=H.solarUpdraftTower)==null?void 0:T.chimneyRadius)??Math.max(1,.025*Math.min(H.lx,H.ly)))}const b={name:"Set Solar Chimney Radius for Selected Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{g(b.oldValues,b.newValue)}};r(b),g(x,v),l(a+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((w=H.solarUpdraftTower)==null?void 0:w.chimneyRadius)??Math.max(1,.025*Math.min(H.lx,H.ly)))}const b={name:"Set Solar Chimney Radius for All Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};r(b),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const x=o(s.id),b=x&&x.solarUpdraftTower?x.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(x.lx,x.ly)):s.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(s.lx,s.ly));f(s.id,v);const R={name:"Set Solar Chimney Radius on Foundation",timestamp:Date.now(),oldValue:b,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:10,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.1, 10] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},$do=({setDialogVisible:t})=>{var S;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=uo(z.Foundation),[l,s]=m.useState(((S=a==null?void 0:a.solarUpdraftTower)==null?void 0:S.collectorHeight)??Math.max(3,10*((a==null?void 0:a.lz)??0))),c=$t(),u=(C,P)=>{e(v=>{for(const T of v.elements)if(T.type===z.Foundation&&T.id===C&&!T.locked){const w=T;w.solarStructure===Dn.UpdraftTower&&(w.solarUpdraftTower||(w.solarUpdraftTower={}),w.solarUpdraftTower.collectorHeight=P);break}})},d=C=>{e(P=>{for(const v of P.elements)if(v.type===z.Foundation&&!v.locked){const T=v;T.solarStructure===Dn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorHeight=C)}})},f=(C,P)=>{e(v=>{for(const T of v.elements)if(T.type===z.Foundation&&!T.locked&&C.has(T.id)){const w=T;w.solarStructure===Dn.UpdraftTower&&(w.solarUpdraftTower||(w.solarUpdraftTower={}),w.solarUpdraftTower.collectorHeight=P)}})},p=C=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked&&M.getState().selectedElementIdSet.has(P.id)){const v=P;if(v.solarStructure===Dn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorHeight===void 0||Math.abs(v.solarUpdraftTower.collectorHeight-C)>Et))return!0}break;case re.AllObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked){const v=P;if(v.solarStructure===Dn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorHeight===void 0||Math.abs(v.solarUpdraftTower.collectorHeight-C)>Et))return!0}break;default:if(a&&a.solarStructure===Dn.UpdraftTower&&a.solarUpdraftTower&&(a.solarUpdraftTower.collectorHeight===void 0||Math.abs(a.solarUpdraftTower.collectorHeight-C)>Et))return!0}return!1},g=C=>{if(a&&p(C))switch(i){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of n)if(T.type===z.Foundation&&M.getState().selectedElementIdSet.has(T.id)){const w=T;w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&P.set(T.id,w.solarUpdraftTower.collectorHeight??Math.max(3,10*w.lz))}const v={name:"Set Solar Collector Height for Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())u(T,w)},redo:()=>{f(v.oldValues,v.newValue)}};r(v),f(P,C);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of n)if(T.type===z.Foundation){const w=T;w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&P.set(T.id,w.solarUpdraftTower.collectorHeight??Math.max(3,10*w.lz))}const v={name:"Set Solar Collector Height for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())u(T,w)},redo:()=>{d(v.newValue)}};r(v),d(C);break}default:{if(a.solarStructure===Dn.UpdraftTower&&a.solarUpdraftTower){const P=o(a.id),v=P&&P.solarUpdraftTower?P.solarUpdraftTower.collectorHeight??Math.max(3,10*P.lz):a.solarUpdraftTower.collectorHeight??Math.max(3,10*a.lz);u(a.id,C);const T={name:"Set Solar Collector Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{u(T.changedElementId,T.oldValue)},redo:()=>{u(T.changedElementId,T.newValue)}};r(T)}break}}},A=()=>{t(!1)},y=()=>{g(l)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",c),onApply:y,onClose:A,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:20,style:{width:120},step:1,precision:1,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",c),": [0.1, 20] ",Y.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",c)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:C=>M.getState().setFoundationActionScope(C.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",c)})]})})})]})})},Qdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorRadius)??Math.max(10,.5*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorRadius=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorRadius===void 0||Math.abs(w.solarUpdraftTower.collectorRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorRadius===void 0||Math.abs(w.solarUpdraftTower.collectorRadius-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorRadius===void 0||Math.abs(s.solarUpdraftTower.collectorRadius-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(b.lx,b.ly)))}const w={name:"Set Solar Collector Radius for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(b.lx,b.ly)))}const w={name:"Set Solar Collector Radius for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)):s.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(s.lx,s.ly));f(s.id,v);const x={name:"Set Solar Collector Radius on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [1, 1000] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},Zdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorTransmissivity)??.9),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorTransmissivity=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorTransmissivity??.9)}const w={name:"Set Solar Collector Transmissivity for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorTransmissivity??.9)}const w={name:"Set Solar Collector Transmissivity for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorTransmissivity??.9:s.solarUpdraftTower.collectorTransmissivity??.9;f(s.id,v);const x={name:"Set Solar Collector Transmissivity on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},efo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorEmissivity)??.95),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorEmissivity=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorEmissivity??.95)}const w={name:"Set Solar Collector Emissivity for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorEmissivity??.95)}const w={name:"Set Solar Collector Emissivity for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorEmissivity??.95:s.solarUpdraftTower.collectorEmissivity??.95;f(s.id,v);const x={name:"Set Solar Collector Emissivity on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},tfo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.dischargeCoefficient)??.65),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.dischargeCoefficient=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(w.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(w.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(s.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.dischargeCoefficient??.65)}const w={name:"Set Solar Chimney Discharge Coefficient for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.dischargeCoefficient??.65)}const w={name:"Set Solar Chimney Discharge Coefficient for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.dischargeCoefficient??.65:s.solarUpdraftTower.dischargeCoefficient??.65;f(s.id,v);const x={name:"Set Solar Chimney Discharge Coefficient on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.65,max:.7,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.65, 0.70]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},nfo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.turbineEfficiency)??.3),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.turbineEfficiency=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(w.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(w.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(s.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.turbineEfficiency??.3)}const w={name:"Set Solar Updraft Tower Turbine Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.turbineEfficiency??.3)}const w={name:"Set Solar Updraft Tower Turbine Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.turbineEfficiency??.3:s.solarUpdraftTower.turbineEfficiency??.3;f(s.id,v);const x={name:"Set Solar Updraft Tower Turbine Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.2,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.2, 1.0]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},{Option:QT}=Uo,ofo=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=M(bA).geneticAlgorithmParams,p=m.useRef(f.selectionMethod),g=m.useRef(f.searchMethod),A=m.useRef(Math.min(f.objectiveFunctionType,Po.YEARLY_TOTAL_OUTPUT)),y=m.useRef(f.populationSize),S=m.useRef(f.maximumGenerations),C=m.useRef(f.mutationRate),P=m.useRef(f.selectionRate??.5),v=m.useRef(f.crossoverRate??.5),T=m.useRef(f.convergenceThreshold),w=m.useRef(f.localSearchRadius),x=m.useRef(null);m.useEffect(()=>{var N;(N=x.current)==null||N.focus()},[]);const b={lng:o},R=(N,U)=>{if(d.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=d.current.getBoundingClientRect();u({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{e(N=>{N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=A.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=p.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=g.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=y.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=S.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=P.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=v.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=C.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=T.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=w.current})},F=()=>{r||gn(E("message.EvolutionStarted",b)),H(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=_s.GENETIC_ALGORITHM,N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Genetic Algorithm for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:E}=Xl();return h.jsx(h.Fragment,{children:h.jsxs(yi,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:[E("optimizationMenu.SolarPanelTiltAngleOptimization",b)+": ",E("optimizationMenu.GeneticAlgorithmSettings",b)]}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:E("word.Cancel",b)},"Cancel"),h.jsx(io,{type:"primary",ref:x,onClick:()=>{F(),t(!1)},children:E("word.Run",b)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:d,children:N})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.Objective",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:A.current,style:{width:"100%"},value:A.current,onChange:N=>{A.current=N,a(!i)},children:[h.jsx(QT,{value:Po.DAILY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionDailyTotalYield",b)},Po.DAILY_TOTAL_OUTPUT),h.jsx(QT,{value:Po.YEARLY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionYearlyTotalYield",b)},Po.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.GeneticAlgorithmSelectionMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,a(!i)},children:[h.jsx(QT,{value:Wm.ROULETTE_WHEEL,children:E("optimizationMenu.RouletteWheel",b)},Wm.ROULETTE_WHEEL),h.jsx(QT,{value:Wm.TOURNAMENT,children:E("optimizationMenu.Tournament",b)},Wm.TOURNAMENT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.PopulationSize",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:y.current,step:1,onChange:N=>{N!==null&&(y.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumGenerations",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:S.current,onChange:N=>{N!==null&&(S.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SelectionRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{N!==null&&(P.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.CrossoverRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{N!==null&&(v.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MutationRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{N!==null&&(C.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.ConvergenceThreshold",b)+" [0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:T.current,step:.001,onChange:N=>{N!==null&&(T.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SearchMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:g.current,style:{width:"100%"},value:g.current,onChange:N=>{g.current=Number(N),a(!i)},children:[h.jsx(QT,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:E("optimizationMenu.GlobalSearchUniformSelection",b)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(QT,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:E("optimizationMenu.LocalSearchRandomOptimization",b)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),g.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.LocalSearchRadius",b)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:w.current,step:.01,onChange:N=>{N!==null&&(w.current=Number(N),a(!i))}})})]})]})})},{Option:OO}=Uo,rfo=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(bA).particleSwarmOptimizationParams,[a,l]=m.useState(!1),[s,c]=m.useState(!1),[u,d]=m.useState({left:0,top:0,bottom:0,right:0}),f=m.useRef(null),p=m.useRef(Math.min(i.objectiveFunctionType,Po.YEARLY_TOTAL_OUTPUT)),g=m.useRef(i.searchMethod),A=m.useRef(i.swarmSize),y=m.useRef(i.maximumSteps),S=m.useRef(i.vmax??.01),C=m.useRef(i.inertia??.8),P=m.useRef(i.cognitiveCoefficient??.1),v=m.useRef(i.socialCoefficient??.1),T=m.useRef(i.convergenceThreshold),w=m.useRef(i.localSearchRadius),x=m.useRef(null);m.useEffect(()=>{var N;(N=x.current)==null||N.focus()},[]);const b={lng:o},R=(N,U)=>{if(f.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=f.current.getBoundingClientRect();d({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{e(N=>{N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=p.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=g.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=A.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=y.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=P.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=v.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=S.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=C.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=T.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=w.current})},F=()=>{r||gn(E("message.EvolutionStarted",b)),H(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=_s.PARTICLE_SWARM_OPTIMIZATION,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:E}=Xl();return h.jsx(h.Fragment,{children:h.jsxs(yi,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),children:[E("optimizationMenu.SolarPanelTiltAngleOptimization",b)+": ",E("optimizationMenu.ParticleSwarmOptimizationSettings",b)]}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:E("word.Cancel",b)},"Cancel"),h.jsx(io,{type:"primary",ref:x,onClick:()=>{F(),t(!1)},children:E("word.Run",b)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Bi,{disabled:!s,bounds:u,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:f,children:N})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.Objective",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,l(!a)},children:[h.jsx(OO,{value:Po.DAILY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionDailyTotalYield",b)},Po.DAILY_TOTAL_OUTPUT),h.jsx(OO,{value:Po.YEARLY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionYearlyTotalYield",b)},Po.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SwarmSize",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:A.current,step:1,formatter:N=>Number(N).toFixed(0),onChange:N=>{A.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumSteps",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:y.current,formatter:N=>Number(N).toFixed(0),onChange:N=>{y.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.CognitiveCoefficient",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{P.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SocialCoefficient",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{v.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.InertiaWeight",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{C.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumVelocity",b)+" [0.001, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{S.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.ConvergenceThreshold",b)+" [0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:T.current,step:.001,onChange:N=>{T.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SearchMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:g.current,style:{width:"100%"},value:g.current,onChange:N=>{g.current=Number(N),l(!a)},children:[h.jsx(OO,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:E("optimizationMenu.GlobalSearchUniformSelection",b)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(OO,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:E("optimizationMenu.LocalSearchRandomOptimization",b)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),g.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.LocalSearchRadius",b)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:w.current,step:.01,onChange:N=>{w.current=Number(N),l(!a)}})})]})]})})},hy=({children:t,width:e="90px"})=>h.jsx("div",{style:{width:e},children:t}),ifo=({element:t})=>{const e=aot(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!(t!=null&&t.showLabel),onChange:e,children:Y.t("labelSubMenu.KeepShowingLabel",n)})})},afo=({element:t})=>{const{labelText:e,setLabelText:n}=iot(t),o=lot(t,e),r=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelText",r)+":"}),value:e,onChange:i=>n(i.target.value),onPressEnter:o,onBlur:o})})},lfo=({element:t})=>{const e=EXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelHeight",n)+":"}),min:t.lz/2+.2,max:100,step:1,precision:1,value:t.labelHeight??t.lz/2+.2,onChange:o=>e(o)})})},sfo=({element:t})=>{const e=IXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelFontSize",n)+":"}),min:10,max:100,step:1,precision:0,value:t.labelFontSize??20,onChange:o=>e(o)})})},cfo=({element:t})=>{const e=zXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelSize",n)+":"}),min:.2,max:5,step:.1,precision:1,value:t.labelSize??.2,onChange:o=>e(o)})})},ufo=({element:t})=>{const e=DXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelColor",n)+":"}),value:t.labelColor??"#ffffff",onChange:o=>e(o.target.value)})})},v3=t=>[{key:`${t.type}-show-label`,label:h.jsx(ifo,{element:t})},{key:`${t.type}-label-text`,label:h.jsx(afo,{element:t})},{key:`${t.type}-label-height`,label:h.jsx(lfo,{element:t})},{key:`${t.type}-label-font-size`,label:h.jsx(sfo,{element:t})},{key:`${t.type}-label-size`,label:h.jsx(cfo,{element:t})},{key:`${t.type}-label-color`,label:h.jsx(ufo,{element:t})}],dfo=[{key:"windowCount",objectType:z.Window},{key:"doorCount",objectType:z.Door},{key:"sensorCount",objectType:z.Sensor},{key:"outsideLightCount",objectType:z.Light},{key:"parabolicTroughCount",objectType:z.ParabolicTrough},{key:"parabolicDishCount",objectType:z.ParabolicDish},{key:"fresnelReflectorCount",objectType:z.FresnelReflector},{key:"heliostatCount",objectType:z.Heliostat},{key:"windTurbineCount",objectType:z.WindTurbine},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower}],IHe=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.Wall:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWalls",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWallsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Walls",n)})`;break}case z.Window:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWindowsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Windows",n)})`;break}case z.Door:{o=`${Y.t("foundationMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllDoorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Doors",n)})`;break}case z.Sensor:{o=`${Y.t("foundationMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllSensorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("foundationMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllLightsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Lights",n)})`;break}case z.ParabolicTrough:{o=`${Y.t("foundationMenu.RemoveAllUnlockedParabolicTroughs",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation",n)} (${e} ${Y.t("foundationMenu.ParabolicTroughs",n)})`;break}case z.ParabolicDish:{o=`${Y.t("foundationMenu.RemoveAllUnlockedParabolicDishes",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicDishesOnFoundation",n)} (${e} ${Y.t("foundationMenu.ParabolicDishes",n)})`;break}case z.FresnelReflector:{o=`${Y.t("foundationMenu.RemoveAllUnlockedFresnelReflectors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.FresnelReflectors",n)})`;break}case z.Heliostat:{o=`${Y.t("foundationMenu.RemoveAllUnlockedHeliostats",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllHeliostatsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Heliostats",n)})`;break}case z.WindTurbine:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWindTurbines",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWindTurbinesOnFoundation",n)} (${e} ${Y.t("foundationMenu.WindTurbines",n)})`;break}case z.Polygon:{o=`${Y.t("foundationMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllPolygonsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Polygons",n)})`;break}case z.Human:{o=`${Y.t("foundationMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllHumansOnFoundation",n)} (${e} ${Y.t("foundationMenu.Humans",n)})`;break}case z.Tree:{o=`${Y.t("foundationMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllTreesOnFoundation",n)} (${e} ${Y.t("foundationMenu.Trees",n)})`;break}case z.Flower:{o=`${Y.t("foundationMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllFlowersOnFoundation",n)} (${e} ${Y.t("foundationMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},ffo=(t,e,n)=>n===z.Light?t.insideLightCount+t.outsideLightCount:t[e],hfo=t=>{const e=M.getState().set,n=new Set;M.getState().elements.forEach(a=>{!a.locked&&a.type===z.Wall&&(a.parentId===t.id||a.foundationId===t.id)&&n.add(a.id)});const o=M.getState().elements.filter(a=>n.has(a.id)||n.has(a.parentId));e(a=>{a.elements=a.elements.filter(l=>!n.has(l.id)&&!n.has(l.parentId))});const r=JSON.parse(JSON.stringify(o)),i={name:"Remove All Walls on Foundation",timestamp:Date.now(),parentId:t.id,removedElements:r,undo:()=>{e(a=>{a.elements.push(...i.removedElements),a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},redo:()=>{const a=new Set;M.getState().elements.forEach(l=>{!l.locked&&l.type===z.Wall&&l.parentId===i.parentId&&a.add(l.id)}),e(l=>{l.elements=l.elements.filter(s=>!a.has(s.id)&&!a.has(s.parentId))})}};M.getState().addUndoable(i)},pfo=(t,e,n)=>{const o=[],r={lng:M.getState().language};if(e.unlockedCount>0&&o.push({key:"lock-all-offsprings",label:h.jsx(qCe,{foundation:t,lock:!0,count:e.unlockedCount})}),e.lockedCount>0&&o.push({key:"unlock-all-offsprings",label:h.jsx(qCe,{foundation:t,lock:!1,count:e.lockedCount})}),n.wallCount>0){const{itemLabel:i,modalTitle:a}=IHe(z.Wall,n.wallCount);o.push({key:"remove-all-walls-on-foundation",label:h.jsx(Dae,{foundation:t,objectType:z.Wall,modalTitle:a,onClickOk:()=>hfo(t),children:i})})}if(n.solarPanelCount>0){const i=Y.t("foundationMenu.DoYouReallyWantToRemoveAllSolarPanelsOnFoundation",r)+" ("+n.solarPanelModuleCount+" "+Y.t("foundationMenu.SolarPanels",r)+", "+n.solarPanelCount+" "+Y.t("foundationMenu.Racks",r)+")?";o.push({key:"remove-all-solar-panels-on-foundation",label:h.jsxs(Dae,{foundation:t,objectType:z.SolarPanel,modalTitle:i,children:[Y.t("foundationMenu.RemoveAllUnlockedSolarPanels",r),"  (",n.solarPanelModuleCount," ",Y.t("foundationMenu.SolarPanels",r),", ",n.solarPanelCount," ",Y.t("foundationMenu.Racks",r),")"]})})}return dfo.forEach(({key:i,objectType:a})=>{const l=ffo(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=IHe(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-foundation`,label:h.jsx(Dae,{foundation:t,objectType:a,modalTitle:c,children:s})})}}),o},gfo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.Light||e.type===z.SolarPanel||e.type===z.SolarWaterHeater||e.type===z.ParabolicDish||e.type===z.Heliostat||e.type===z.FresnelReflector||e.type===z.ParabolicTrough||e.type===z.WindTurbine||e.type===z.Wall)return!0}return!1},mfo=t=>{const e=[];if(t.type!==z.Foundation)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked,i=!n.notBuilding&&ye.getBuildingCompletionStatus(n,M.getState().elements)===Uc.COMPLETE,a=M.getState().countAllOffspringsByTypeAtOnce(n.id,!0),l=M.getState().countAllOffspringsByTypeAtOnce(n.id,!1);return gfo()&&e.push({key:"foundation-paste",label:h.jsx(oM,{})}),e.push({key:"foundation-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"foundation-cut",label:h.jsx(kd,{})}),e.push({key:"foundation-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"foundation-group-master",label:h.jsx(LQe,{groupableElement:n})}),e.push({key:"building",label:h.jsx(TXn,{foundation:n})}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-foundation",label:h.jsx(an,{children:Y.t("word.Elements",o)}),children:pfo(n,a,l)}),r&&((!n.textureType||n.textureType===_i.NoTexture)&&e.push({key:"foundation-color",label:h.jsxs(eo,{Dialog:Ddo,children:[Y.t("word.Color",o)," ..."]})}),e.push({key:"foundation-texture",label:h.jsxs(eo,{Dialog:FXn,children:[Y.t("word.Texture",o)," ..."]})}),e.push({key:"foundation-length",label:h.jsxs(eo,{Dialog:Edo,children:[Y.t("word.Length",o)," ..."]})}),e.push({key:"foundation-width",label:h.jsxs(eo,{Dialog:Fdo,children:[Y.t("word.Width",o)," ..."]})}),e.push({key:"foundation-height",label:h.jsxs(eo,{Dialog:kdo,children:[Y.t("word.Height",o)," ..."]})}),e.push({key:"foundation-azimuth",label:h.jsxs(eo,{Dialog:Ldo,children:[Y.t("word.Azimuth",o)," ..."]})}),i&&e.push({key:"ground-floor-r-value",label:h.jsxs(eo,{Dialog:Wdo,children:[Y.t("foundationMenu.GroundFloorRValue",o)," ..."]})})),e.push({key:"add-polygon-on-foundation",label:h.jsx(PXn,{foundation:n})}),!n.notBuilding&&a.wallCount>0&&e.push({key:"building-hvac-system",label:h.jsx(an,{children:Y.t("word.BuildingHVACSystem",o)}),children:[{key:"hvac-system-id",label:h.jsx(CXn,{foundation:n})},{key:"thermostat-temperature",label:h.jsx(RXn,{foundation:n})},{key:"tolerance-threshold",label:h.jsx(HXn,{foundation:n})}]}),r&&(e.push({key:"select-solar-structure",label:h.jsx(an,{children:Y.t("foundationMenu.SolarStructure",o)}),children:[{key:"select-solar-structure-submenu",label:h.jsx(MXn,{foundation:n}),style:{backgroundColor:"white"}}]}),n.solarStructure===Dn.FocusPipe&&e.push({key:"solar-absorber-pipe-physical-properties",label:h.jsx(an,{children:Y.t("solarAbsorberPipeMenu.AbsorberPipePhysicalProperties",o)}),children:[{key:"solar-absorber-pipe-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Ndo,children:[Y.t("solarAbsorberPipeMenu.AbsorberHeight",o)," ..."]})},{key:"solar-absorber-pipe-aperture-width",label:h.jsxs(eo,{noPadding:!0,Dialog:Udo,children:[Y.t("solarAbsorberPipeMenu.AbsorberApertureWidth",o)," ..."]})},{key:"foundation-solar-receiver-pipe-pole-number",label:h.jsxs(eo,{noPadding:!0,Dialog:jdo,children:[Y.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",o)," ..."]})},{key:"solar-absorber-pipe-absorptance",label:h.jsxs(eo,{noPadding:!0,Dialog:Bdo,children:[Y.t("solarAbsorberPipeMenu.AbsorberAbsorptance",o)," ..."]})},{key:"solar-absorber-optical-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Ydo,children:[Y.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",o)," ..."]})},{key:"solar-absorber-thermal-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Odo,children:[Y.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Dn.FocusTower&&e.push({key:"solar-power-tower-physical-properties",label:h.jsx(an,{children:Y.t("solarPowerTowerMenu.ReceiverTowerPhysicalProperties",o)}),children:[{key:"solar-power-tower-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Vdo,children:[Y.t("solarPowerTowerMenu.ReceiverTowerHeight",o)," ..."]})},{key:"solar-power-tower-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:_do,children:[Y.t("solarPowerTowerMenu.ReceiverTowerRadius",o)," ..."]})},{key:"solar-power-tower-receiver-absorptance",label:h.jsxs(eo,{noPadding:!0,Dialog:Gdo,children:[Y.t("solarPowerTowerMenu.ReceiverAbsorptance",o)," ..."]})},{key:"solar-power-tower-receiver-optical-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Jdo,children:[Y.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",o)," ..."]})},{key:"solar-power-tower-receiver-thermal-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Xdo,children:[Y.t("solarPowerTowerMenu.ReceiverThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Dn.UpdraftTower&&e.push({key:"solar-updraft-tower-physical-properties",label:h.jsx(an,{children:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerPhysicalProperties",o)}),children:[{key:"solar-updraft-tower-chimney-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Kdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",o)," ..."]})},{key:"solar-updraft-tower-chimney-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:qdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-height",label:h.jsxs(eo,{noPadding:!0,Dialog:$do,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",o)," ..."]})},{key:"solar-updraft-tower-collector-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:Qdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-transmissivity",label:h.jsxs(eo,{noPadding:!0,Dialog:Zdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",o)," ..."]})},{key:"solar-updraft-tower-collector-emissivity",label:h.jsxs(eo,{noPadding:!0,Dialog:efo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",o)," ..."]})},{key:"solar-updraft-tower-discharge-coefficient",label:h.jsxs(eo,{noPadding:!0,Dialog:tfo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",o)," ..."]})},{key:"solar-updraft-tower-turbine-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:nfo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",o)," ..."]})}]})),e.push({key:"optimization",label:h.jsx(an,{children:Y.t("optimizationMenu.Optimization",o)}),children:[{key:"genetic-algorithms",label:h.jsx(an,{noPadding:!0,children:Y.t("optimizationMenu.GeneticAlgorithm",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-ga-optimizer",label:h.jsxs(eo,{noPadding:!0,Dialog:ofo,children:[Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]},{key:"particle-swarm-optimization",label:h.jsx(an,{noPadding:!0,children:Y.t("optimizationMenu.ParticleSwarmOptimization",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-pso-optimizer",label:h.jsxs(eo,{noPadding:!0,Dialog:rfo,children:[Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]}]}),r&&e.push({key:"foundation-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},yfo=be.memo(({cuboid:t})=>{const e=$t(),n=()=>{M.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Cuboid){const i=r,a=!i.stackable;i.stackable=a,o.actionState.cuboidStackable=a;break}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.stackable,onChange:n,children:Y.t("cuboidMenu.Stackable",e)})})}),Afo=be.memo(({cuboid:t,selectedSideIndex:e})=>{const n=$t(),o=M.getState().set,r=()=>{o(c=>{c.objectTypeToAdd=z.Polygon});const{pos:i}=ye.getWorldDataById(t.id);let a;switch(e){case 0:a=Op;break;case 1:a=Vp;break;case 2:a=Yc;break;case 3:a=_p;break;default:a=ko,i.z=t.lz}const l=M.getState().addElement(t,i,a),s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{M.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{o(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};M.getState().addUndoable(s),o(c=>{c.objectTypeToAdd=z.None})};return h.jsx(an,{onClick:r,children:Y.t("cuboidMenu.AddPolygon",n)})}),zHe=be.memo(({cuboid:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Cuboid`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{noPadding:!0,onClick:l,children:r})}),wfo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Eb),i=M(Fb),a=M(sYe),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState((c==null?void 0:c.color)??"#808080"),[f,p]=m.useState(!1),g=$t();m.useEffect(()=>{P()},[c,a]);const A=(R,H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.Cuboid&&N.id===H&&!N.locked){const U=N;U.faceColors||(U.faceColors=new Array(6),U.faceColors.fill(U.color??F)),U.faceColors[R]=F;break}})},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.Cuboid&&E.id===R&&!E.locked){E.color=H;const N=E;N.faceColors||(N.faceColors=new Array(6));for(let U=0;U<4;U++)N.faceColors[U]=H;break}})},S=R=>{e(H=>{for(const F of H.elements)if(F.type===z.Cuboid&&!F.locked){F.color=R;const E=F;E.faceColors||(E.faceColors=new Array(6));for(let N=0;N<4;N++)E.faceColors[N]=R}})},C=R=>{i(R.target.value),p(!f)},P=()=>{c&&(a>=0&&c.faceColors?d(c.faceColors[a]):d(c.color??"#808080"))},v=R=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Cuboid&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)){const F=H;if(F.faceColors){for(let E=0;E<4;E++)if(R!==F.faceColors[E])return!0}else if(R!==F.color)return!0}break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Cuboid&&!H.locked){const F=H;if(F.faceColors){for(let E=0;E<4;E++)if(R!==F.faceColors[E])return!0}else if(R!==F.color)return!0}break;case re.OnlyThisObject:if(c.faceColors){for(let H=0;H<4;H++)if(R!==c.faceColors[H])return!0}else if(R!==(c==null?void 0:c.color))return!0;break;default:if(a>=0){const H=c!=null&&c.faceColors?c==null?void 0:c.faceColors[a]:c==null?void 0:c.color;if(R!==H)return!0}else if(R!==(c==null?void 0:c.color))return!0}return!1}},T=R=>{if(c&&v(R)){switch(r){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)if(E.type===z.Cuboid&&M.getState().selectedElementIdSet.has(E.id)){const N=E;if(N.faceColors)H.set(E.id,[...N.faceColors]);else{const U=N.color??"#808080";H.set(E.id,[U,U,U,U,U,U])}}const F={name:"Set Color for Selected Cuboids",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)if(E.type===z.Cuboid){const N=E;if(N.faceColors)H.set(E.id,[...N.faceColors]);else{const U=N.color??"#808080";H.set(E.id,[U,U,U,U,U,U])}}const F={name:"Set Color for All Cuboids",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{S(F.newValue)}};o(F),S(R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}case re.OnlyThisObject:{let H;if(c.faceColors)H=[...c.faceColors];else{const E=c.color??"#808080";H=[E,E,E,E,E,E]}const F={name:"Set Color for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(F.oldValue&&Array.isArray(F.oldValue))for(let E=0;E{y(F.changedElementId,F.newValue)}};o(F),y(c.id,R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}default:{if(a>=0){const H=c.faceColors?c.faceColors[a]:c.color,F={name:"Set Color for Selected Side of Cuboid",timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{F.changedSideIndex!==void 0&&A(F.changedSideIndex,F.changedElementId,F.oldValue)},redo:()=>{F.changedSideIndex!==void 0&&A(F.changedSideIndex,F.changedElementId,F.newValue)}};o(F),A(a,c.id,R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]),E.actionState.cuboidFaceColors[a]=R})}break}}p(!f)}},w=()=>{P(),t(!1)},x=()=>{T(u),t(!1),s(0)},b=a>=0&&(c!=null&&c.faceColors)?c.faceColors[a]:(c==null?void 0:c.color)??"#808080";return h.jsx(so,{width:600,title:Y.t("word.Color",g),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:u??b,onChangeComplete:R=>{d(R.hex),p(!f)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:C,value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("cuboidMenu.OnlyThisSide",g)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.AllSidesOfThisCuboid",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfSelectedCuboids",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfAllCuboids",g)})]})})})]})})},vfo="/aladdin/assets/building_facade_01_menu-BAm4EVGn.png",xfo="/aladdin/assets/building_facade_02_menu-BylQ9E0j.png",bfo="/aladdin/assets/building_facade_03_menu-DfU_cdlP.png",Sfo="/aladdin/assets/building_facade_04_menu-Bz2bcbq0.png",Tfo="/aladdin/assets/building_facade_05_menu-hF6OsAF0.png",Pfo="/aladdin/assets/building_facade_06_menu-CUmtyI19.png",Cfo="/aladdin/assets/building_facade_07_menu-B8_DYqYz.png",Rfo="/aladdin/assets/building_facade_08_menu-CTA_rxim.png",Hfo="/aladdin/assets/building_facade_09_menu-BpQDoLbY.png",Mfo="/aladdin/assets/building_facade_10_menu-z_jZrQMT.png",Ifo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Eb),i=M(Fb),a=M(sYe),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState(c&&c.textureTypes&&a>=0?c.textureTypes[a]:Ro.NoTexture),f=$t(),{Option:p}=Uo;m.useEffect(()=>{c&&d(c.textureTypes&&a>=0?c.textureTypes[a]:Ro.NoTexture)},[c,a]);const g=(x,b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.Cuboid&&F.id===b&&!F.locked){const E=F;E.textureTypes||(E.textureTypes=new Array(6),E.textureTypes.fill(Ro.NoTexture)),E.textureTypes[x]=R;break}})},A=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.Cuboid&&H.id===x&&!H.locked){const F=H;F.textureTypes||(F.textureTypes=new Array(6),F.textureTypes.fill(Ro.NoTexture));for(let E=0;E<4;E++)F.textureTypes[E]=b;break}})},y=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.Cuboid&&!H.locked&&x.has(H.id)){const F=H;if(F.textureTypes||(F.textureTypes=new Array(6),F.textureTypes.fill(Ro.NoTexture)),b!==void 0)for(let E=0;E<4;E++)F.textureTypes[E]=b;else{const E=x.get(H.id);if(E&&E.length>=4)for(let N=0;N<4;N++)F.textureTypes[N]=E[N]}}})},S=x=>{e(b=>{for(const R of b.elements)if(R.type===z.Cuboid&&!R.locked){const H=R;H.textureTypes||(H.textureTypes=new Array(6),H.textureTypes.fill(Ro.NoTexture));for(let F=0;F<4;F++)H.textureTypes[F]=x}})},C=x=>{i(x.target.value)},P=x=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Cuboid&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;if(R.textureTypes){for(let H=0;H<4;H++)if(x!==R.textureTypes[H])return!0}}break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.Cuboid&&!b.locked){const R=b;if(R.textureTypes){for(let H=0;H<4;H++)if(x!==R.textureTypes[H])return!0}}break;case re.OnlyThisObject:if(c.textureTypes){for(let b=0;b<4;b++)if(x!==c.textureTypes[b])return!0}break;default:if(a>=0&&c.textureTypes&&x!==c.textureTypes[a])return!0}return!1}},v=x=>{if(c&&P(x))switch(r){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)if(H.type===z.Cuboid&&M.getState().selectedElementIdSet.has(H.id)){const F=H;b.set(H.id,F.textureTypes?[...F.textureTypes]:void 0)}const R={name:"Set Texture for Selected Cuboids",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())if(F&&Array.isArray(F))for(let E=0;E{y(R.oldValues,R.newValue)}};o(R),y(b,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)if(H.type===z.Cuboid){const F=H;b.set(H.id,F.textureTypes?[...F.textureTypes]:void 0)}const R={name:"Set Texture for All Cuboids",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())if(F&&Array.isArray(F))for(let E=0;E{S(R.newValue)}};o(R),S(x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}case re.OnlyThisObject:{const b=c.textureTypes?[...c.textureTypes]:void 0,R={name:"Set Texture for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(R.oldValue&&Array.isArray(R.oldValue))for(let H=0;H{A(R.changedElementId,R.newValue)}};o(R),A(c.id,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}default:{if(a>=0){const b=c.textureTypes?c.textureTypes[a]:Ro.NoTexture,R={name:"Set Texture for Selected Side of Cuboid",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{R.changedSideIndex!==void 0&&g(R.changedSideIndex,R.changedElementId,R.oldValue)},redo:()=>{R.changedSideIndex!==void 0&&g(R.changedSideIndex,R.changedElementId,R.newValue)}};o(R),g(a,c.id,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]),H.actionState.cuboidFaceTextures[a]=x})}break}}},T=()=>{c!=null&&c.textureTypes&&a>=0&&d(c.textureTypes[a]),t(!1)},w=()=>{v(u)};return h.jsx(so,{width:600,title:Y.t("word.Texture",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(p,{value:Ro.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",f)]},Ro.NoTexture),h.jsxs(p,{value:Ro.Facade01,children:[h.jsx("img",{alt:Ro.Facade01,src:vfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture01",f)]},Ro.Facade01),h.jsxs(p,{value:Ro.Facade02,children:[h.jsx("img",{alt:Ro.Facade02,src:xfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture02",f)]},Ro.Facade02),h.jsxs(p,{value:Ro.Facade03,children:[h.jsx("img",{alt:Ro.Facade03,src:bfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture03",f)]},Ro.Facade03),h.jsxs(p,{value:Ro.Facade04,children:[h.jsx("img",{alt:Ro.Facade04,src:Sfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture04",f)]},Ro.Facade04),h.jsxs(p,{value:Ro.Facade05,children:[h.jsx("img",{alt:Ro.Facade05,src:Tfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture05",f)]},Ro.Facade05),h.jsxs(p,{value:Ro.Facade06,children:[h.jsx("img",{alt:Ro.Facade06,src:Pfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture06",f)]},Ro.Facade06),h.jsxs(p,{value:Ro.Facade07,children:[h.jsx("img",{alt:Ro.Facade07,src:Cfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture07",f)]},Ro.Facade07),h.jsxs(p,{value:Ro.Facade08,children:[h.jsx("img",{alt:Ro.Facade08,src:Rfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture08",f)]},Ro.Facade08),h.jsxs(p,{value:Ro.Facade09,children:[h.jsx("img",{alt:Ro.Facade09,src:Hfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture09",f)]},Ro.Facade09),h.jsxs(p,{value:Ro.Facade10,children:[h.jsx("img",{alt:Ro.Facade10,src:Mfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture10",f)]},Ro.Facade10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:C,value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("cuboidMenu.OnlyThisSide",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.AllSidesOfThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfAllCuboids",f)})]})})})]})})},zfo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(LH),r=M(cYe),i=M(d3),a=M(kw),l=M(u3),s=M(En),c=M(Eb),u=M(Fb),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.lx)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=Z=>{u(Z.target.value)},U=Z=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:{for(const ee of e)if(ee.type===z.Cuboid&&M.getState().selectedElementIdSet.has(ee.id)){const te=ee,oe=o(te.id);if(oe.length>0&&!ye.doesNewSizeContainAllChildren(te,oe,Z,te.ly))return!1}break}case re.AllObjectsOfThisType:{for(const ee of e)if(ee.type===z.Cuboid){const te=ee,oe=o(te.id);if(oe.length>0&&!ye.doesNewSizeContainAllChildren(te,oe,Z,te.ly))return!1}break}default:{const ee=o(A.id);if(ee.length>0)return ye.doesNewSizeContainAllChildren(A,ee,Z,A.ly);break}}return!0}},W=Z=>!U(Z),k=Z=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:for(const ee of e)if(ee.type===z.Cuboid&&!ee.locked&&M.getState().selectedElementIdSet.has(ee.id)&&Math.abs(ee.lx-Z)>Et)return!0;break;case re.AllObjectsOfThisType:for(const ee of e)if(ee.type===z.Cuboid&&!ee.locked&&Math.abs(ee.lx-Z)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const ee of e)if(ee.type===z.Cuboid&&ee.parentId===(A==null?void 0:A.parentId)&&!ee.locked&&Math.abs(ee.lx-Z)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((A==null?void 0:A.lx)-Z)>Et)return!0}return!1}},D=(Z,ee)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ee}`))return te;return null},L=(Z,ee,te)=>{var oe,de;if(Z){for(const he of Z.children)if(he.name.includes(`${te.id}`)){(de=(oe=kn.getState().contentRef)==null?void 0:oe.current)==null||de.add(he);break}d(he=>{for(const pe of he.elements)if(pe.id===te.id){pe.parentId=Zo;const me=new Kt(pe.cx,pe.cy).rotateAround(ai,ee.rotation[2]).add(new Kt(ee.cx,ee.cy));pe.cx=me.x,pe.cy=me.y,pe.cz=0,T.current.set(pe.id,new ae(me.x,me.y,0)),P.current.set(pe.id,Zo);break}})}},j=Z=>{for(const ee of e)ee.type===z.Cuboid&&!ee.locked&&ee.parentId===(A==null?void 0:A.parentId)&&B(ee,Z)},B=(Z,ee)=>{const te=o(Z.id),oe=Z.rotation[2];if(w.current.clear(),R.current.clear(),te.length>0)for(const de of te){if(ye.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const he=new Kt(de.cx*Z.lx,de.cy*Z.ly).rotateAround(ai,oe);w.current.set(de.id,he),v.current.set(de.id,new ae(de.cx,de.cy));break}case z.Polygon:{const he=de,pe=[];for(const me of he.vertices)pe.push(new Kt(me.x*Z.lx,me.y*Z.ly).rotateAround(ai,oe));R.current.set(de.id,pe),x.current.set(de.id,he.vertices.map(me=>({...me})));break}}else de.type===z.SolarPanel&&(ye.isEqual(de.normal[0],-1)||ye.isEqual(de.normal[0],1))&&v.current.set(de.id,new ae(de.cx,de.cy,de.cz));ye.isPlantOrHuman(de)&&v.current.set(de.id,new ae(de.cx,de.cy,de.cz))}if(i(Z.id,ee),te.length>0)for(const de of te){if(ye.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const he=w.current.get(de.id);if(he){const me=new Kt(he.x,he.y).rotateAround(ai,-oe).x/ee;r(de.id,me),T.current.set(de.id,new ae(me,de.cy))}break}case z.Polygon:{const he=R.current.get(de.id);if(he){const pe=[];for(const me of he){const le=me.rotateAround(ai,-oe),Te=le.x/ee,ge=le.y/Z.ly;pe.push({x:Te,y:ge})}a(de.id,pe),b.current.set(de.id,pe.map(me=>({...me})))}break}}else de.type===z.SolarPanel&&(ye.isEqual(de.normal[0],-1)&&(r(de.id,-ee/2),T.current.set(de.id,new ae(-ee/2,de.cy,de.cz))),ye.isEqual(de.normal[0],1)&&(r(de.id,ee/2),T.current.set(de.id,new ae(ee/2,de.cy,de.cz))));if(ye.isPlantOrHuman(de)){if(T.current.set(de.id,new ae(de.cx,de.cy,de.cz)),C.current.set(de.id,Z.id),Math.abs(de.cz-Z.lz/2)0){const he=kn.getState().contentRef,pe=D(he==null?void 0:he.current,Z.id);L(pe,Z,de)}}else if(Math.abs(Math.abs(de.cx)-Z.lx/2)0?ee:-ee)/2;r(de.id,he),T.current.set(de.id,new ae(he,de.cy,de.cz))}}}},O=(Z,ee,te)=>{if(!Z||!ee)return;const oe=kn.getState().contentRef,de=D(oe==null?void 0:oe.current,ee),he=D(ee===Zo?oe==null?void 0:oe.current:de,te);if(he&&(oe!=null&&oe.current)){if(Z===Zo)oe.current.add(he);else{const pe=D(oe.current,Z);pe==null||pe.add(he)}op()}},V=(Z,ee)=>{Z&&d(te=>{for(const oe of te.elements)if(oe.id===ee){oe.parentId=Z;break}})},G=Z=>{if(!A||!k(Z))return;const ee=n(A.id),te=ee?ee.lx:A.lx;if(F.current=void 0,H.current=W(Z),H.current)F.current=Z,S(te);else switch(c){case re.AllSelectedObjectsOfThisType:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&!he.locked&&M.getState().selectedElementIdSet.has(he.id)&&(oe.set(he.id,he.lx),B(he,Z));const de={name:"Set Length for Selected Cuboids",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())i(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())a(me,le)},redo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())i(me,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())a(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeOnSurface:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&he.parentId===A.parentId&&!he.locked&&(oe.set(he.id,he.lx),B(he,Z));const de={name:"Set Length for All Cuboids on Surface",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())i(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())a(me,le)},redo:()=>{var he,pe;if(j(de.newSize),de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())a(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisType:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&!he.locked&&(oe.set(he.id,he.lx),B(he,Z));const de={name:"Set Length for All Cuboids",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())i(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())a(me,le)},redo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())i(me,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){l(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())a(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{B(A,Z);const oe={name:"Set Cuboid Length",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;if(i(A.id,oe.oldSize),oe.oldChildrenPositionsMap&&oe.oldChildrenPositionsMap.size>0)for(const[pe,me]of oe.oldChildrenPositionsMap.entries()){l(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(O(le,Te,pe),V(le,pe))}if(oe.oldChildrenVerticesMap&&oe.oldChildrenVerticesMap.size>0)for(const[pe,me]of oe.oldChildrenVerticesMap.entries())a(pe,me)},redo:()=>{var de,he;if(i(A.id,oe.newSize),oe.newChildrenPositionsMap&&oe.newChildrenPositionsMap.size>0)for(const[pe,me]of oe.newChildrenPositionsMap.entries()){l(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(O(Te,le,pe),V(Te,pe))}if(oe.newChildrenVerticesMap&&oe.newChildrenVerticesMap.size>0)for(const[pe,me]of oe.newChildrenVerticesMap.entries())a(pe,me)}};s(oe),p(f+1);break}}},q=()=>{t(!1)},$=()=>{q(),g()},ie=()=>{G(y),H.current||(t(!1),p(0))},Q=()=>{G(y)},se=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",E),rejectedMessage:se,onApply:Q,onClose:q,onClickCancel:$,onClickOk:ie,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:y,onChange:Z=>{Z!==null&&S(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 500] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",E)})]})})})]})})},Dfo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(LH),r=M(u3),i=M(uYe),a=M(Fw),l=M(kw),s=M(En),c=M(Eb),u=M(Fb),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.ly)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=Z=>{u(Z.target.value)},U=Z=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:{for(const ee of e)if(ee.type===z.Cuboid&&M.getState().selectedElementIdSet.has(ee.id)){const te=ee,oe=o(te.id);if(oe.length>0&&!ye.doesNewSizeContainAllChildren(te,oe,te.lx,Z))return!1}break}case re.AllObjectsOfThisType:{for(const ee of e)if(ee.type===z.Cuboid){const te=ee,oe=o(te.id);if(oe.length>0&&!ye.doesNewSizeContainAllChildren(te,oe,te.lx,Z))return!1}break}default:{const ee=o(A.id);if(ee.length>0)return ye.doesNewSizeContainAllChildren(A,ee,A.lx,Z);break}}return!0}},W=Z=>!U(Z),k=Z=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:for(const ee of e)if(ee.type===z.Cuboid&&!ee.locked&&M.getState().selectedElementIdSet.has(ee.id)&&Math.abs(ee.ly-Z)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const ee of e)if(ee.type===z.Cuboid&&ee.parentId===(A==null?void 0:A.parentId)&&!ee.locked&&Math.abs(ee.ly-Z)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const ee of e)if(ee.type===z.Cuboid&&!ee.locked&&Math.abs(ee.ly-Z)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((A==null?void 0:A.ly)-Z)>Et)return!0}return!1}},D=(Z,ee)=>{if(Z==null)return null;for(const te of Z.children)if(te.name.includes(`${ee}`))return te;return null},L=(Z,ee,te)=>{var oe,de;if(Z){for(const he of Z.children)if(he.name.includes(`${te.id}`)){(de=(oe=kn.getState().contentRef)==null?void 0:oe.current)==null||de.add(he);break}d(he=>{for(const pe of he.elements)if(pe.id===te.id){pe.parentId=Zo;const me=new Kt(pe.cx,pe.cy).rotateAround(ai,ee.rotation[2]).add(new Kt(ee.cx,ee.cy));pe.cx=me.x,pe.cy=me.y,pe.cz=0,T.current.set(pe.id,new ae(me.x,me.y,0)),P.current.set(pe.id,Zo);break}})}},j=Z=>{for(const ee of e)ee.type===z.Cuboid&&!ee.locked&&ee.parentId===(A==null?void 0:A.parentId)&&B(ee,Z)},B=(Z,ee)=>{const te=o(Z.id),oe=Z.rotation[2];if(w.current.clear(),R.current.clear(),te.length>0)for(const de of te){if(ye.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const he=new Kt(de.cx*Z.lx,de.cy*Z.ly).rotateAround(ai,oe);w.current.set(de.id,he),v.current.set(de.id,new ae(de.cx,de.cy));break}case z.Polygon:{const he=de,pe=[];for(const me of he.vertices)pe.push(new Kt(me.x*Z.lx,me.y*Z.ly).rotateAround(ai,oe));R.current.set(de.id,pe),x.current.set(de.id,he.vertices.map(me=>({...me})));break}}else de.type===z.SolarPanel&&(ye.isEqual(de.normal[1],-1)||ye.isEqual(de.normal[1],1))&&v.current.set(de.id,new ae(de.cx,de.cy,de.cz));ye.isPlantOrHuman(de)&&v.current.set(de.id,new ae(de.cx,de.cy,de.cz))}if(a(Z.id,ee),te.length>0)for(const de of te){if(ye.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const he=w.current.get(de.id);if(he){const me=new Kt(he.x,he.y).rotateAround(ai,-oe).y/ee;i(de.id,me),T.current.set(de.id,new ae(de.cx,me))}break}case z.Polygon:{const he=R.current.get(de.id);if(he){const pe=[];for(const me of he){const le=me.rotateAround(ai,-oe),Te=le.x/Z.lx,ge=le.y/ee;pe.push({x:Te,y:ge})}l(de.id,pe),b.current.set(de.id,pe.map(me=>({...me})))}break}}else de.type===z.SolarPanel&&(ye.isEqual(de.normal[1],-1)&&(i(de.id,-ee/2),T.current.set(de.id,new ae(de.cx,-ee/2,de.cz))),ye.isEqual(de.normal[1],1)&&(i(de.id,ee/2),T.current.set(de.id,new ae(de.cx,ee/2,de.cz))));if(ye.isPlantOrHuman(de)){if(T.current.set(de.id,new ae(de.cx,de.cy,de.cz)),C.current.set(de.id,Z.id),Math.abs(de.cz-Z.lz/2)0){const he=kn.getState().contentRef,pe=D(he==null?void 0:he.current,Z.id);L(pe,Z,de)}}else if(Math.abs(Math.abs(de.cy)-Z.ly/2)0?ee:-ee)/2;i(de.id,he),T.current.set(de.id,new ae(de.cz,he,de.cz))}}}},O=(Z,ee,te)=>{if(!Z||!ee)return;const oe=kn.getState().contentRef,de=D(oe==null?void 0:oe.current,ee),he=D(ee===Zo?oe==null?void 0:oe.current:de,te);if(he&&(oe!=null&&oe.current)){if(Z===Zo)oe.current.add(he);else{const pe=D(oe.current,Z);pe==null||pe.add(he)}op()}},V=(Z,ee)=>{Z&&d(te=>{for(const oe of te.elements)if(oe.id===ee){oe.parentId=Z;break}})},G=Z=>{if(!A||!k(Z))return;const ee=n(A.id),te=ee?ee.ly:A.ly;if(F.current=void 0,H.current=W(Z),H.current)F.current=Z,S(te);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),c){case re.AllSelectedObjectsOfThisType:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&!he.locked&&M.getState().selectedElementIdSet.has(he.id)&&(oe.set(he.id,he.ly),B(he,Z));const de={name:"Set Width for Selected Cuboids on Surface",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())a(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())l(me,le)},redo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())a(me,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())l(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeOnSurface:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&he.parentId===A.parentId&&!he.locked&&(oe.set(he.id,he.ly),B(he,Z));const de={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())a(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())l(me,le)},redo:()=>{var he,pe;if(j(de.newSize),de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())l(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisType:{const oe=new Map;for(const he of e)he.type===z.Cuboid&&!he.locked&&(oe.set(he.id,he.ly),B(he,Z));const de={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:oe,newSize:Z,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())a(me,le);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[me,le]of de.oldChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(Te,ge,me),V(Te,me))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[me,le]of de.oldChildrenVerticesMap.entries())l(me,le)},redo:()=>{var he,pe;for(const[me,le]of de.oldSizes.entries())a(me,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[me,le]of de.newChildrenPositionsMap.entries()){r(me,le.x,le.y,le.z);const Te=(he=de.oldChildrenParentIdMap)==null?void 0:he.get(me),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(me);Te&&ge&&Te!==ge&&(O(ge,Te,me),V(ge,me))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[me,le]of de.newChildrenVerticesMap.entries())l(me,le)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{B(A,Z);const oe={name:"Set Cuboid Width",timestamp:Date.now(),oldSize:te,newSize:Z,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,he;if(a(A.id,oe.oldSize),oe.oldChildrenPositionsMap&&oe.oldChildrenPositionsMap.size>0)for(const[pe,me]of oe.oldChildrenPositionsMap.entries()){r(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(O(le,Te,pe),V(le,pe))}if(oe.oldChildrenVerticesMap&&oe.oldChildrenVerticesMap.size>0)for(const[pe,me]of oe.oldChildrenVerticesMap.entries())l(pe,me)},redo:()=>{var de,he;if(a(A.id,oe.newSize),oe.newChildrenPositionsMap&&oe.newChildrenPositionsMap.size>0)for(const[pe,me]of oe.newChildrenPositionsMap.entries()){r(pe,me.x,me.y,me.z);const le=(de=oe.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(he=oe.newChildrenParentIdMap)==null?void 0:he.get(pe);le&&Te&&le!==Te&&(O(Te,le,pe),V(Te,pe))}if(oe.newChildrenVerticesMap&&oe.newChildrenVerticesMap.size>0)for(const[pe,me]of oe.newChildrenVerticesMap.entries())l(pe,me)}};s(oe),p(f+1);break}}},q=()=>{t(!1)},$=()=>{q(),g()},ie=()=>{G(y),H.current||(t(!1),p(0))},Q=()=>{G(y)},se=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",E),rejectedMessage:se,onApply:Q,onClose:q,onClickCancel:$,onClickOk:ie,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:y,onChange:Z=>{Z!==null&&S(Z)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 500] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",E)})]})})})]})})},Efo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(jge),a=M(Gwt),l=M(Jwt),s=M(Xwt),c=M(En),u=M(Eb),d=M(Fb),f=M(u3),p=M(no),g=M(Qn),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.lz)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=$t(),x=O=>{d(O.target.value)},b=(O,V)=>{i(O,V),a(O,V/2)},R=O=>{if(!A)return;const V=o(A);if(V)for(const G of n)G.type===z.Cuboid&&!G.locked&&G.parentId===V.id&&(i(G.id,O),a(G.id,O/2))},H=O=>{if(!A)return;const V=ye.getBaseId(A.id);if(V)for(const G of n)G.type===z.Cuboid&&!G.locked&&ye.getBaseId(G.id)===V&&(i(G.id,O),a(G.id,O/2))},F=O=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const V of n)if(V.type===z.Cuboid&&!V.locked&&M.getState().selectedElementIdSet.has(V.id)&&Math.abs(V.lz-O)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const V of n)if(V.type===z.Cuboid&&!V.locked&&Math.abs(V.lz-O)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{const V=ye.getBaseId(A==null?void 0:A.id);if(V&&V!==Zo){for(const G of n)if(G.type===z.Cuboid&&G.parentId&&G.parentId!==Zo&&!G.locked){const q=G;if(V===ye.getBaseId(q.id)&&Math.abs(q.lz-O)>Et)return!0}}break}case re.AllObjectsOfThisTypeOnSurface:{for(const V of n)if(V.type===z.Cuboid&&V.parentId!==Zo&&V.parentId===(A==null?void 0:A.parentId)&&!V.locked&&Math.abs(V.lz-O)>Et)return!0;break}default:{if(Math.abs((A==null?void 0:A.lz)-O)>Et)return!0;break}}return!1}},E=(O,V)=>{if(O==null)return null;for(const G of O.children)if(G.name.includes(`${V}`))return G;return null},N=(O,V,G)=>{var q,$;if(O){for(const Q of O.children)if(Q.name.includes(`${G.id}`)){($=(q=kn.getState().contentRef)==null?void 0:q.current)==null||$.add(Q);break}G.parentId=Zo;const ie=new Kt(G.cx,G.cy).rotateAround(ai,-V.rotation[2]).add(new Kt(V.cx,V.cy));G.cx=ie.x,G.cy=ie.y,G.cz=0,T.current.set(G.id,new ae(ie.x,ie.y,0)),P.current.set(G.id,Zo)}},U=(O,V)=>{e(G=>{for(const q of G.elements)if(q.parentId===O.id)if(C.current.set(q.id,O.id),v.current.set(q.id,new ae(q.cx,q.cy,q.cz)),ye.isPlantOrHuman(q))if(Math.abs(q.cz-O.lz/2)V/2){const ie=kn.getState().contentRef,Q=E(ie==null?void 0:ie.current,O.id);N(Q,O,q)}else q.cz=$,T.current.set(q.id,new ae(q.cx,q.cy,$))}else q.type===z.SolarPanel&&ye.isEqual(q.normal[2],1)&&(q.cz=V/2,T.current.set(q.id,new ae(q.cx,q.cy,V/2)))})},W=(O,V,G)=>{if(!O||!V)return;const q=kn.getState().contentRef,$=E(q==null?void 0:q.current,V),ie=E(V===Zo?q==null?void 0:q.current:$,G);if(ie&&(q!=null&&q.current)){if(O===Zo)q.current.add(ie);else{const Q=E(q.current,O);Q==null||Q.add(ie)}op()}},k=(O,V)=>{O&&e(G=>{for(const q of G.elements)if(q.id===V){q.parentId=O;break}})},D=(O,V)=>{M.getState().set(G=>{for(const q of G.elements)if(O.has(q.id))if(V!==void 0)q.lz=V,q.cz=V/2;else{const $=O.get(q.id);$!==void 0&&(q.lz=$,q.cz=$/2)}})},L=O=>{if(A&&F(O)){switch(u){case re.AllSelectedObjectsOfThisType:{const V=new Map;for(const q of n)q.type===z.Cuboid&&M.getState().selectedElementIdSet.has(q.id)&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for Selected Cuboids",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;if(D(G.oldValues),G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),Z=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&Z&&se!==Z&&(W(se,Z,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(D(G.oldValues,q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(ee,Z,Q),k(ee,Q))}}};c(G),D(V,O),g(p+1);break}case re.AllObjectsOfThisType:{const V=new Map;for(const q of n)q.type===z.Cuboid&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for All Cuboids",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;for(const[ie,Q]of G.oldValues.entries())b(ie,Q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),Z=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&Z&&se!==Z&&(W(se,Z,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(l(z.Cuboid,q),s(z.Cuboid,q/2),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(ee,Z,Q),k(ee,Q))}}};c(G),l(z.Cuboid,O),s(z.Cuboid,O/2),g(p+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{const V=new Map,G=ye.getBaseId(A.id);for(const $ of n)$.type===z.Cuboid&&ye.getBaseId($.id)===G&&(V.set($.id,$.lz),U($,O));const q={name:"Set Height for All Cuboids Above Same Base",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var $,ie;for(const[Q,se]of q.oldValues.entries())b(Q,se);if(q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[Q,se]of q.oldChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(Z,ee,Q),k(Z,Q))}},redo:()=>{var ie,Q;const $=q.newValue;if(H($),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[se,Z]of q.newChildrenPositionsMap.entries()){f(se,Z.x,Z.y,Z.z);const ee=(ie=q.oldChildrenParentIdMap)==null?void 0:ie.get(se),te=(Q=q.newChildrenParentIdMap)==null?void 0:Q.get(se);ee&&te&&ee!==te&&(W(te,ee,se),k(te,se))}}};c(q),H(O),g(p+1);break}case re.AllObjectsOfThisTypeOnSurface:{const V=new Map;for(const q of n)q.type===z.Cuboid&&q.parentId===A.parentId&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for All Cuboids on Same Surface",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;for(const[ie,Q]of G.oldValues.entries())b(ie,Q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),Z=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&Z&&se!==Z&&(W(se,Z,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(R(q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(ee,Z,Q),k(ee,Q))}}};c(G),R(O),g(p+1);break}default:{const V=r(A.id),G=V?V.lz:A.lz;U(A,O),b(A.id,O);const q={name:"Set Cuboid Width",timestamp:Date.now(),oldValue:G,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),changedElementId:A.id,changedElementType:A.type,undo:()=>{var $,ie;if(b(q.changedElementId,q.oldValue),q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[Q,se]of q.oldChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(Z,ee,Q),k(Z,Q))}},redo:()=>{var $,ie;if(b(q.changedElementId,q.newValue),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[Q,se]of q.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const Z=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),ee=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);Z&&ee&&Z!==ee&&(W(ee,Z,Q),k(ee,Q))}}};c(q),g(p+1);break}}e(V=>{V.actionState.cuboidHeight=O})}},j=()=>{t(!1)},B=()=>{L(y)};return h.jsx(so,{width:550,title:Y.t("word.Height",w),onApply:B,onClose:j,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:O=>{O!==null&&S(O)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",w),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",w)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",w)}),(A==null?void 0:A.parentId)!==Zo&&h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("cuboidMenu.AllCuboidsAboveSameBase",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",w)})]})})})]})})},Ffo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Bge),r=M(En),i=M(Eb),a=M(Fb),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState(c?-c.rotation[2]:0),f=$t(),p=v=>{a(v.target.value)},g=v=>{for(const T of e)T.type===z.Cuboid&&!T.locked&&T.parentId===(c==null?void 0:c.parentId)&&o(T.id,0,0,-v)},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Cuboid&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)&&Math.abs(-T.rotation[2]-v)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Cuboid&&T.parentId===(c==null?void 0:c.parentId)&&!T.locked&&Math.abs(-T.rotation[2]-v)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Cuboid&&!T.locked&&Math.abs(-T.rotation[2]-v)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((c?-c.rotation[2]:0)-v)>Et)return!0}return!1},y=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(v.has(x.id))if(T!==void 0)x.rotation[2]=T;else{const b=v.get(x.id);b!==void 0&&(x.rotation[2]=-b)}})},S=v=>{if(c&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Cuboid&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for Selected Cuboids",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,-w.newValue)}};r(w),y(T,-v),s(l+1);break}case re.AllObjectsOfThisTypeOnSurface:{const T=new Map;for(const x of e)x.type===z.Cuboid&&x.parentId===c.parentId&&!x.locked&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for All Cuboids on Surface",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())o(x,0,0,-b)},redo:()=>{g(w.newValue)}};r(w),g(v),s(l+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Cuboid&&!x.locked&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for All Cuboids",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,-w.newValue)}};r(w),y(T,-v),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{const T=n(c.id),w=T?-T.rotation[2]:-c.rotation[2],x={name:"Set Cuboid Azimuth",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(x.changedElementId,0,0,-x.oldValue)},redo:()=>{o(x.changedElementId,0,0,-x.newValue)}};r(x),o(c.id,0,0,-v),s(l+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("word.Azimuth",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(ye.toDegrees(u).toFixed(2)),formatter:v=>`${v}°`,onChange:v=>{v!==null&&d(ye.toRadians(v))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:p,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",f)})]})})})]})})},kfo=[{key:"sensorCount",objectType:z.Sensor},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower},{key:"outsideLightCount",objectType:z.Light}],Lfo=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.Light:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllLightsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Lights",n)})`;break}case z.Sensor:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllSensorsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Sensors",n)})`;break}case z.Polygon:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllPolygonsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Polygons",n)})`;break}case z.Human:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllHumansOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Humans",n)})`;break}case z.Tree:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllTreesOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Trees",n)})`;break}case z.Flower:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllFlowersOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},Wfo=(t,e)=>{const n=[],o={lng:M.getState().language};if(e.solarPanelCount>0){const r=Y.t("cuboidMenu.DoYouReallyWantToRemoveAllSolarPanelsOnCuboid",o)+" ("+e.solarPanelModuleCount+" "+Y.t("cuboidMenu.SolarPanels",o)+", "+e.solarPanelCount+" "+Y.t("cuboidMenu.Racks",o)+")?";n.push({key:"remove-all-solar-panels-on-cuboid",label:h.jsxs(zHe,{cuboid:t,objectType:z.SolarPanel,modalTitle:r,children:[Y.t("cuboidMenu.RemoveAllUnlockedSolarPanels",o),"  (",e.solarPanelModuleCount," ",Y.t("cuboidMenu.SolarPanels",o),",",e.solarPanelCount," ",Y.t("cuboidMenu.Racks",o),")"]})})}return kfo.forEach(({key:r,objectType:i})=>{const a=e[r];if(typeof a=="number"&&a>0){const{itemLabel:l,modalTitle:s}=Lfo(i,a),c=i.replaceAll(" ","");n.push({key:`remove-all-${c}s-on-cuboid`,label:h.jsx(zHe,{cuboid:t,objectType:i,modalTitle:s,children:l})})}}),n},Nfo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(Eb),a=M(Fb),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState((c==null?void 0:c.transparency)??0),f=$t(),p=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Cuboid&&b.id===T&&!b.locked){b.transparency=w;break}})},g=T=>{for(const w of n)w.type===z.Cuboid&&!w.locked&&w.parentId===(c==null?void 0:c.parentId)&&p(w.id,T)},A=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Cuboid&&T.has(b.id))if(w!==void 0)b.transparency=w;else{const R=T.get(b.id);R!==void 0&&(b.transparency=R)}})},y=T=>{a(T.target.value)},S=T=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const w of n)if(w.type===z.Cuboid&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&Math.abs((w.transparency??0)-T)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const w of n)if(w.type===z.Cuboid&&w.parentId===(c==null?void 0:c.parentId)&&!w.locked&&Math.abs((w.transparency??0)-T)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Cuboid&&!w.locked&&Math.abs((w.transparency??0)-T)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs(((c==null?void 0:c.transparency)??0)-T)>Et)return!0}return!1},C=T=>{if(c&&S(T))switch(i){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Cuboid&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for Selected Cuboids",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{A(x.oldValues,-x.newValue)}};r(x),A(w,T),s(l+1);break}case re.AllObjectsOfThisTypeOnSurface:{const w=new Map;for(const b of n)b.type===z.Cuboid&&b.parentId===c.parentId&&!b.locked&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for All Cuboids on Surface",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())p(b,R)},redo:()=>{g(x.newValue)}};r(x),g(T),s(l+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Cuboid&&!b.locked&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for All Cuboids",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{A(x.oldValues,-x.newValue)}};r(x),A(w,T),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{const w=o(c.id),x=w?w.transparency:c.transparency,b={name:"Set Cuboid Transparency",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),p(c.id,T),s(l+1);break}}},P=()=>{t(!1)},v=()=>{C(u)};return h.jsx(so,{width:550,title:Y.t("word.Transparency",f),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.1,precision:2,value:u,onChange:T=>{T!==null&&d(T)}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",f)})]})})})]})})},Ufo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.SolarPanel||e.type===z.Cuboid)return!0}return!1},jfo=t=>{const e=[];if(t.type!==z.Cuboid)return{items:e};const n=t,o=M.getState().selectedSideIndex,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce(n.id,!1),a=!(n!=null&&n.locked),l=!n.textureTypes||o>=0&&n.textureTypes[o]===Ro.NoTexture;return Ufo()&&e.push({key:"cuboid-paste",label:h.jsx(oM,{})}),e.push({key:"cuboid-copy",label:h.jsx(Fd,{})}),a&&e.push({key:"cuboid-cut",label:h.jsx(kd,{})}),e.push({key:"cuboid-lock",label:h.jsx(Ku,{selectedElement:n})}),e.push({key:"cuboid-group-master",label:h.jsx(LQe,{groupableElement:n})}),e.push({key:"cuboid-stackable",label:h.jsx(yfo,{cuboid:n})}),i.gotSome()&&e.push({key:"cuboid-clear",label:h.jsx(an,{children:Y.t("word.Clear",r)}),children:Wfo(n,i)}),a&&(l&&e.push({key:"cuboid-color",label:h.jsxs(eo,{Dialog:wfo,children:[Y.t("word.Color",r)," ..."]})}),e.push({key:"cuboid-texture",label:h.jsxs(eo,{Dialog:Ifo,children:[Y.t("word.Texture",r)," ..."]})}),e.push({key:"cuboid-length",label:h.jsxs(eo,{Dialog:zfo,children:[Y.t("word.Length",r)," ..."]})}),e.push({key:"cuboid-width",label:h.jsxs(eo,{Dialog:Dfo,children:[Y.t("word.Width",r)," ..."]})}),e.push({key:"cuboid-height",label:h.jsxs(eo,{Dialog:Efo,children:[Y.t("word.Height",r)," ..."]})}),e.push({key:"cuboid-azimuth",label:h.jsxs(eo,{Dialog:Ffo,children:[Y.t("word.Azimuth",r)," ..."]})}),e.push({key:"cuboid-transparency",label:h.jsxs(eo,{Dialog:Nfo,children:[Y.t("word.Transparency",r)," ..."]})})),e.push({key:"add-polygon-on-cuboid",label:h.jsx(Afo,{cuboid:n,selectedSideIndex:o})}),a&&e.push({key:"cuboid-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)}),{items:e}},Bfo=()=>{const t=M(mA),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.groundImage=r,i.viewState.groundImageType=i.viewState.mapType})},o=r=>{const i=r.target.checked,a={name:"Show Ground Image",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("groundMenu.ImageOnGround",e)})})},Yfo=()=>{const t=M(IBe),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.waterSurface=r})},o=r=>{const i=r.target.checked,a={name:"Water Surface",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("groundMenu.WaterSurface",e)})})},Ofo=()=>{const t=M(MBe),e=o=>{M.getState().set(r=>{r.viewState.groundColor=o})},n=o=>{const r=t,i=o.hex,a={name:"Set Ground Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{e(a.oldValue)},redo:()=>{e(a.newValue)}};M.getState().addUndoable(a),e(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Ld,{color:t,onChangeComplete:n})})},Vfo=()=>{const t=M(Pge)??Nq,n=M(s0)>0,o=$t(),r=s=>{M.getState().set(c=>{c.world.leafDayOfYear1=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 1",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};M.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"80px"},children:Y.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(1-150)"});return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:1,max:150,step:1,precision:0,value:t,onChange:i})})},_fo=()=>{const t=M(Cge)??Uq,n=M(s0)>0,o=$t(),r=s=>{M.getState().set(c=>{c.world.leafDayOfYear2=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 2",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};M.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"80px"},children:Y.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(215-365)"});return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:215,max:365,step:1,precision:0,value:t,onChange:i})})},DHe=({monthIndex:t})=>{const e=M(i=>i.world.monthlyIrradianceLosses?i.world.monthlyIrradianceLosses[t]:.05)??.05,n=$t(),o=i=>{M.getState().set(a=>{a.world.monthlyIrradianceLosses||(a.world.monthlyIrradianceLosses=new Array(12).fill(.05)),a.world.monthlyIrradianceLosses[t]=i})},r=i=>{if(i===null)return;const a=e,l=i,s={name:"Set Irradiance Loss in "+swe[t],timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{o(s.oldValue)},redo:()=>{o(s.newValue)}};M.getState().addUndoable(s),o(l)};return h.jsx(Sn,{addonBefore:h.jsx("span",{style:{fontFamily:"monospace"},children:Y.t(`month.${swe[t]}`,n)}),style:{width:"120px"},min:0,max:1,step:.01,precision:2,value:e,onChange:r})},Gfo=()=>{const t=M(r=>r.world.ground.albedo),e=$t(),n=r=>{M.getState().set(i=>{i.world.ground.albedo=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ground Albedo",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"60px"},children:[Y.t("groundMenu.Albedo",e),":"]}),h.jsx(Sn,{min:.05,max:1,step:.01,precision:2,value:t,onChange:o})]})},Xfo=({itemLabel:t,modalTitle:e,objectType:n})=>{const o=M.getState().removeElementsByType,r=()=>{const a=M.getState().elements.filter(c=>!c.locked&&c.type===n);o(n);const l=JSON.parse(JSON.stringify(a)),s={name:"Remove All "+n+"s",timestamp:Date.now(),removedElements:l,undo:()=>{M.getState().set(c=>{c.elements.push(...s.removedElements)})},redo:()=>{o(n)}};M.getState().addUndoable(s),dt.getState().updateContextMenu()},i=()=>{yi.confirm({title:e,onOk:r,icon:h.jsx(ny,{})})};return h.jsx(an,{onClick:i,children:t})},EHe=({lock:t,count:e,label:n})=>{const o=M.getState().updateAllElementLocks,r=()=>{const i=new Map;for(const c of M.getState().elements)i.set(c.id,!!c.locked);const s={name:`${t?"Lock":"Unlock"} All ${t?"Unlocked":"Locked"} Elements`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())M.getState().updateElementLockById(c,u)},redo:()=>{o(t)}};M.getState().addUndoable(s),o(t)};return h.jsxs(an,{update:!0,onClick:r,children:[n," (",e,")"]})},Jfo=[{key:"humanCount",type:z.Human,itemLabel:"groundMenu.RemoveAllUnlockedPeople",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllPeople"},{key:"treeCount",type:z.Tree,itemLabel:"groundMenu.RemoveAllUnlockedTrees",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllTrees"},{key:"flowerCount",type:z.Flower,itemLabel:"groundMenu.RemoveAllUnlockedFlowers",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFlowers"},{key:"solarPanelCount",type:z.SolarPanel,itemLabel:"groundMenu.RemoveAllUnlockedSolarPanels",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllSolarPanels"},{key:"foundationCount",type:z.Foundation,itemLabel:"groundMenu.RemoveAllUnlockedFoundations",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFoundations"},{key:"cuboidCount",type:z.Cuboid,itemLabel:"groundMenu.RemoveAllUnlockedCuboids",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllCuboids"}],Kfo=()=>{const t=M.getState().elementsToPaste;if(!t||t.length===0)return!1;const e=t[0];return e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Cuboid||e.type===z.Foundation},qfo=()=>zs.slice().reduce((t,e,n,o)=>(t&&n%2!==0&&t.push({key:`${o[n-1]}-${o[n]}`,label:h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(DHe,{monthIndex:n-1}),h.jsx(DHe,{monthIndex:n})]})}),t),[]),$fo=()=>{const t={lng:M.getState().language},e=M.getState().countAllElementsByType(!0),n=[];return Kfo()&&n.push({key:"ground-paste",label:h.jsx(oM,{})}),Jfo.forEach(({key:o,type:r,itemLabel:i,modalTitle:a})=>{const l=e[o];typeof l=="number"&&l>0&&n.push({key:`ground-remove-all-${r}s`,label:h.jsx(Xfo,{objectType:r,itemLabel:`${Y.t(i,t)} (${l})`,modalTitle:`${Y.t(a,t)} (${l})?`})})}),e.unlockedCount>0&&n.push({key:"lock-all-elements",label:h.jsx(EHe,{lock:!0,count:e.unlockedCount,label:Y.t("groundMenu.LockAllUnlockedElements",t)})}),e.lockedCount>0&&M.getState().elements.length>0&&n.push({key:"unlock-all-elements",label:h.jsx(EHe,{lock:!1,count:e.lockedCount,label:Y.t("groundMenu.UnlockAllLockedElements",t)})}),n.push({key:"image-on-ground",label:h.jsx(Bfo,{})}),n.push({key:"water-surface",label:h.jsx(Yfo,{})}),M.getState().viewState.waterSurface||n.push({key:"ground-color-submenu",label:h.jsx(an,{children:Y.t("word.Color",t)}),children:[{key:"ground-color-picker",label:h.jsx(Ofo,{}),style:{backgroundColor:"white"}}]}),n.push({key:"vegetation-submenu",label:h.jsx(an,{children:Y.t("groundMenu.Vegetation",t)}),children:[{key:"leaf-out-day",label:h.jsx(Vfo,{})},{key:"leaf-shed-day",label:h.jsx(_fo,{})}]}),n.push({key:"monthly-irradiance-loss-submenu",label:h.jsx(an,{children:Y.t("groundMenu.MonthlyIrradianceLoss",t)}),children:qfo()}),n.push({key:"ground-albedo",label:h.jsx(Gfo,{})}),{items:n}};var OE={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-OE.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?OE.Bounce.In(t*2)*.5:OE.Bounce.Out(t*2-1)*.5+.5}}},qD;typeof self>"u"&&typeof process<"u"&&process.hrtime?qD=function(){var t=process.hrtime();return t[0]*1e3+t[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?qD=self.performance.now.bind(self.performance):Date.now!==void 0?qD=Date.now:qD=function(){return new Date().getTime()};var FP=qD,Qfo=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},t.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},t.prototype.update=function(e,n){e===void 0&&(e=FP()),n===void 0&&(n=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?i(t[n],t[n-1],n-o):i(t[r],t[r+1>n?n:r+1],o-r)},Bezier:function(t,e){for(var n=0,o=t.length-1,r=Math.pow,i=$D.Utils.Bernstein,a=0;a<=o;a++)n+=r(1-e,o-a)*r(e,a)*t[a]*i(o,a);return n},CatmullRom:function(t,e){var n=t.length-1,o=n*e,r=Math.floor(o),i=$D.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(o=n*(1+e))),i(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],o-r)):e<0?t[0]-(i(t[0],t[0],t[1],t[1],-o)-t[0]):e>1?t[n]-(i(t[n],t[n],t[n-1],t[n-1],o-n)-t[n]):i(t[r?r-1:0],t[r],t[n1;o--)n*=o;return t[e]=n,n}}(),CatmullRom:function(t,e,n,o,r){var i=(n-t)*.5,a=(o-e)*.5,l=r*r,s=r*l;return(2*e-2*n+i+a)*s+(-3*e+3*n-2*i-a)*l+i*r+e}}},Zfo=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Trt=new Qfo,eho=function(){function t(e,n){n===void 0&&(n=Trt),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=OE.Linear.None,this._interpolationFunction=$D.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Zfo.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(e,n){return this._valuesEnd=Object.create(e),n!==void 0&&(this._duration=n),this},t.prototype.duration=function(e){return this._duration=e,this},t.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?FP()+parseFloat(e):e:FP(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(e,n,o,r){for(var i in o){var a=e[i],l=Array.isArray(a),s=l?"array":typeof a,c=!l&&Array.isArray(o[i]);if(!(s==="undefined"||s==="function")){if(c){var u=o[i];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,a)),o[i]=[a].concat(u)}if((s==="object"||l)&&a&&!c){n[i]=l?[]:{};for(var d in a)n[i][d]=a[d];r[i]=l?[]:{},this._setupProperties(a,n[i],o[i],r[i])}else typeof n[i]>"u"&&(n[i]=a),l||(n[i]*=1),c?r[i]=o[i].slice().reverse():r[i]=n[i]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(e){return e===void 0&&(e=FP()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},t.prototype.resume=function(e){return e===void 0&&(e=FP()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},t.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;ei)return!1;n&&this.start(e)}if(this._goToEnd=!1,e1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,s=this._chainedTweens.length;l{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&(l.type===z.Human||l.type===z.Tree||l.type===z.Flower)){const s=l;s.flip=i;break}})},o=r=>{const i=r.target.checked,a={name:`Flip ${t.type}`,timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.flip,onChange:o,children:Y.t("peopleMenu.Flip",e)})})}),nho=be.memo(({human:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Human&&l.id===r){l.observer=i;break}})},o=r=>{const i=r.target.checked,a={name:"Set Observer",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.observer,onChange:o,children:Y.t("peopleMenu.Observer",e)})})}),oho=be.memo(({human:t})=>{const e=$t(),[n,o]=m.useState(!1),r=m.useRef(0),i=m.useRef(-1),a=m.useRef(!0),l=m.useRef(!1);m.useEffect(()=>{if(l.current){if(a.current)return r.current=requestAnimationFrame(c),u(),()=>{cancelAnimationFrame(r.current)};a.current=!0}},[n]);const s=(f,p,g)=>{const A=kn.getState().orbitControlsRef;A!=null&&A.current&&(A.current.object.position.set(f,p,g),A.current.update(),M.getState().set(y=>{const S=y.viewState;S.cameraPosition=[f,p,g]}))},c=()=>{requestAnimationFrame(c);const f=Date.now();f-i.current>100&&(tho(),i.current=f)},u=()=>{if(!t)return;let f=t.cx,p=t.cy,g=t.cz+t.lz;const A=M.getState().getParent(t);if(A){const C=ye.absoluteHumanOrTreeCoordinates(f,p,g,A);f=C.x,p=C.y,g=C.z}const y=M.getState().cameraDirection.clone().normalize().multiplyScalar(.5);f+=y.x,p+=y.y;const S=[...M.getState().viewState.cameraPosition];new eho(S).to([f,p,g],1e3).easing(OE.Quadratic.In).onUpdate(C=>{s(C[0],C[1],C[2])}).onComplete(()=>{M.getState().selectNone()}).start()},d=()=>{o(!n),l.current=!0};return h.jsx(an,{onClick:d,children:Y.t("peopleMenu.ViewFromThisPerson",e)})}),rho=be.memo(({tree:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Tree&&l.id===r){l.showModel=i;break}})},o=r=>{const i={name:"Show Tree Model",timestamp:Date.now(),checked:r,selectedElementId:t.id,selectedElementType:z.Tree,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:(t==null?void 0:t.showModel)&&(t==null?void 0:t.type)===z.Tree,onChange:r=>o(r.target.checked),children:Y.t("treeMenu.ShowModel",e)})})}),iho=be.memo(({tree:t})=>{const e=M.getState().updateElementLxById,n=$t(),o=t.lx??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Spread",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),e(t.id,i),M.getState().set(l=>{l.actionState.treeSpread=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("treeMenu.Spread",n)+" ("+Y.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(Sn,{style:{width:"160px"},min:1,max:50,step:1,precision:1,value:o,onChange:r})]})}),aho=be.memo(({tree:t})=>{const e=M.getState().updateElementLzById,n=$t(),o=t.lz??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Height",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),e(t.id,i),M.getState().set(l=>{l.actionState.treeHeight=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("word.Height",n)+" ("+Y.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(Sn,{style:{width:"160px"},min:1,max:30,step:1,precision:1,value:o,onChange:r})]})}),{Option:Xa}=Uo,lho=be.memo(({human:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Human&&u.id===l){const d=u;d.name=s,d.lx=kp.fetchWidth(s),d.lz=kp.fetchHeight(s);break}})};return h.jsxs(Uo,{style:{width:"140px"},value:(t==null?void 0:t.name)??Vt.Jack,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change People",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.humanName=l}),r(!o)}}},children:[h.jsxs(Xa,{value:Vt.Jack,children:[h.jsx("img",{alt:Vt.Jack,src:Hje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jack",i)]},Vt.Jack),h.jsxs(Xa,{value:Vt.Jacob,children:[h.jsx("img",{alt:Vt.Jacob,src:Mje,height:20,style:{paddingRight:"16px"}})," ",Y.t("people.Jacob",i)]},Vt.Jacob),h.jsxs(Xa,{value:Vt.Jacqueline,children:[h.jsx("img",{alt:Vt.Jacqueline,src:Ije,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jacqueline",i)]},Vt.Jacqueline),h.jsxs(Xa,{value:Vt.Jaah,children:[h.jsx("img",{alt:Vt.Jaah,src:Rje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jaah",i)]},Vt.Jaah),h.jsxs(Xa,{value:Vt.Jade,children:[h.jsx("img",{alt:Vt.Jade,src:zje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jade",i)]},Vt.Jade),h.jsxs(Xa,{value:Vt.Jamelia,children:[h.jsx("img",{alt:Vt.Jamelia,src:Dje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jamelia",i)]},Vt.Jamelia),h.jsxs(Xa,{value:Vt.James,children:[h.jsx("img",{alt:Vt.James,src:Eje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.James",i)]},Vt.James),h.jsxs(Xa,{value:Vt.Jane,children:[h.jsx("img",{alt:Vt.Jane,src:Fje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jane",i)]},Vt.Jane),h.jsxs(Xa,{value:Vt.Jaya,children:[h.jsx("img",{alt:Vt.Jaya,src:kje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jaya",i)]},Vt.Jaya),h.jsxs(Xa,{value:Vt.Jaye,children:[h.jsx("img",{alt:Vt.Jaye,src:Lje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jaye",i)]},Vt.Jaye),h.jsxs(Xa,{value:Vt.Jeanette,children:[h.jsx("img",{alt:Vt.Jeanette,src:Wje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jeanette",i)]},Vt.Jeanette),h.jsxs(Xa,{value:Vt.Jedi,children:[h.jsx("img",{alt:Vt.Jedi,src:Nje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jedi",i)]},Vt.Jedi),h.jsxs(Xa,{value:Vt.Jeff,children:[h.jsx("img",{alt:Vt.Jeff,src:Uje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jeff",i)]},Vt.Jeff),h.jsxs(Xa,{value:Vt.Jena,children:[h.jsx("img",{alt:Vt.Jena,src:jje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jena",i)]},Vt.Jena),h.jsxs(Xa,{value:Vt.Jennifer,children:[h.jsx("img",{alt:Vt.Jennifer,src:Bje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jennifer",i)]},Vt.Jennifer),h.jsxs(Xa,{value:Vt.Jess,children:[h.jsx("img",{alt:Vt.Jess,src:Yje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jess",i)]},Vt.Jess),h.jsxs(Xa,{value:Vt.Jett,children:[h.jsx("img",{alt:Vt.Jett,src:Oje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jett",i)]},Vt.Jett),h.jsxs(Xa,{value:Vt.Jill,children:[h.jsx("img",{alt:Vt.Jill,src:Vje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jill",i)]},Vt.Jill),h.jsxs(Xa,{value:Vt.Jiya,children:[h.jsx("img",{alt:Vt.Jiya,src:_je,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jiya",i)]},Vt.Jiya),h.jsxs(Xa,{value:Vt.Joan,children:[h.jsx("img",{alt:Vt.Joan,src:Gje,height:20,style:{paddingRight:"8px"}})," ",Y.t("people.Joan",i)]},Vt.Joan),h.jsxs(Xa,{value:Vt.Jocelyn,children:[h.jsx("img",{alt:Vt.Jocelyn,src:Xje,height:20,style:{paddingRight:"23px"}})," ",Y.t("people.Jocelyn",i)]},Vt.Jocelyn),h.jsxs(Xa,{value:Vt.Joel,children:[h.jsx("img",{alt:Vt.Joel,src:Jje,height:20,style:{paddingRight:"7px"}})," ",Y.t("people.Joel",i)]},Vt.Joel),h.jsxs(Xa,{value:Vt.Joey,children:[h.jsx("img",{alt:Vt.Joey,src:Kje,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joey",i)]},Vt.Joey),h.jsxs(Xa,{value:Vt.John,children:[h.jsx("img",{alt:Vt.John,src:qje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.John",i)]},Vt.John),h.jsxs(Xa,{value:Vt.Jonathon,children:[h.jsx("img",{alt:Vt.Jonathon,src:$je,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jonathon",i)]},Vt.Jonathon),h.jsxs(Xa,{value:Vt.Jose,children:[h.jsx("img",{alt:Vt.Jose,src:Qje,height:20,style:{paddingRight:"5px"}})," ",Y.t("people.Jose",i)]},Vt.Jose),h.jsxs(Xa,{value:Vt.Joseph,children:[h.jsx("img",{alt:Vt.Joseph,src:Zje,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joseph",i)]},Vt.Joseph),h.jsxs(Xa,{value:Vt.Joshua,children:[h.jsx("img",{alt:Vt.Joshua,src:eBe,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joshua",i)]},Vt.Joshua),h.jsxs(Xa,{value:Vt.Judd,children:[h.jsx("img",{alt:Vt.Judd,src:tBe,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Judd",i)]},Vt.Judd),h.jsxs(Xa,{value:Vt.Judy,children:[h.jsx("img",{alt:Vt.Judy,src:nBe,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Judy",i)]},Vt.Judy),h.jsxs(Xa,{value:Vt.Julia,children:[h.jsx("img",{alt:Vt.Julia,src:oBe,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Julia",i)]},Vt.Julia),h.jsxs(Xa,{value:Vt.Julio,children:[h.jsx("img",{alt:Vt.Julio,src:rBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Julio",i)]},Vt.Julio),h.jsxs(Xa,{value:Vt.Jumapili,children:[h.jsx("img",{alt:Vt.Jumapili,src:iBe,height:20,style:{paddingRight:"16px"}})," ",Y.t("people.Jumapili",i)]},Vt.Jumapili),h.jsxs(Xa,{value:Vt.June,children:[h.jsx("img",{alt:Vt.June,src:aBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.June",i)]},Vt.June),h.jsxs(Xa,{value:Vt.Juro,children:[h.jsx("img",{alt:Vt.Juro,src:lBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Juro",i)]},Vt.Juro),h.jsxs(Xa,{value:Vt.Justin,children:[h.jsx("img",{alt:Vt.Justin,src:sBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Justin",i)]},Vt.Justin)]})}),sho=t=>{const e=[];if(t.type!==z.Human)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().viewState.orthographic??!1;return e.push({key:"human-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"human-cut",label:h.jsx(kd,{})}),e.push({key:"human-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"human-flip",label:h.jsx(L9e,{billboardModel:n})}),i||e.push({key:"human-move-view",label:h.jsx(oho,{human:n})}),o&&(e.push({key:"human-obserber",label:h.jsx(nho,{human:n})}),e.push({key:"human-selection",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"120px"},children:[Y.t("peopleMenu.ChangePerson",r),": "]}),h.jsx(lho,{human:n})]})})),{items:e}},{Option:Zd}=Uo,cho=be.memo(({flower:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Flower&&u.id===l){const d=u;d.name=s,d.lx=A8.fetchSpread(s),d.lz=A8.fetchHeight(s);break}})};return h.jsxs(Uo,{style:{width:"200px"},value:(t==null?void 0:t.name)??ro.WhiteFlower,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Flower",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.flowerType=l}),r(!o)}}},children:[h.jsxs(Zd,{value:ro.WhiteFlower,children:[h.jsx("img",{alt:ro.WhiteFlower,src:ABe,height:20,style:{paddingRight:"17px"}})," ",Y.t("flower.WhiteFlower",i)]},ro.WhiteFlower),h.jsxs(Zd,{value:ro.YellowFlower,children:[h.jsx("img",{alt:ro.YellowFlower,src:wBe,height:20,style:{paddingRight:"16px"}})," ",Y.t("flower.YellowFlower",i)]},ro.YellowFlower),h.jsxs(Zd,{value:ro.Hibiscus,children:[h.jsx("img",{alt:ro.Hibiscus,src:uBe,height:20,style:{paddingRight:"19px"}})," ",Y.t("flower.Hibiscus",i)]},ro.Hibiscus),h.jsxs(Zd,{value:ro.Hydrangea,children:[h.jsx("img",{alt:ro.Hydrangea,src:dBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Hydrangea",i)]},ro.Hydrangea),h.jsxs(Zd,{value:ro.Spirea,children:[h.jsx("img",{alt:ro.Spirea,src:gBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Spirea",i)]},ro.Spirea),h.jsxs(Zd,{value:ro.Hosta,children:[h.jsx("img",{alt:ro.Hosta,src:fBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Hosta",i)]},ro.Hosta),h.jsxs(Zd,{value:ro.Peony,children:[h.jsx("img",{alt:ro.Peony,src:hBe,height:20,style:{paddingRight:"17px"}})," ",Y.t("flower.Peony",i)]},ro.Peony),h.jsxs(Zd,{value:ro.Boxwood,children:[h.jsx("img",{alt:ro.Boxwood,src:Gce,height:20,style:{paddingRight:"23px"}})," ",Y.t("flower.Boxwood",i)]},ro.Boxwood),h.jsxs(Zd,{value:ro.TallBush,children:[h.jsx("img",{alt:ro.TallBush,src:$ce,height:20,style:{paddingRight:"32px"}})," ",Y.t("flower.TallBush",i)]},ro.TallBush),h.jsxs(Zd,{value:ro.CactusCombo1,children:[h.jsx("img",{alt:ro.CactusCombo1,src:Xce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo1",i)]},ro.CactusCombo1),h.jsxs(Zd,{value:ro.CactusCombo2,children:[h.jsx("img",{alt:ro.CactusCombo2,src:Jce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo2",i)]},ro.CactusCombo2),h.jsxs(Zd,{value:ro.CactusCombo3,children:[h.jsx("img",{alt:ro.CactusCombo3,src:Kce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo3",i)]},ro.CactusCombo3),h.jsxs(Zd,{value:ro.CactusCombo4,children:[h.jsx("img",{alt:ro.CactusCombo4,src:qce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo4",i)]},ro.CactusCombo4),h.jsxs(Zd,{value:ro.RedRose,children:[h.jsx("img",{alt:ro.RedRose,src:pBe,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.RedRose",i)]},ro.RedRose),h.jsxs(Zd,{value:ro.Bellflower,children:[h.jsx("img",{alt:ro.Bellflower,src:cBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("flower.Bellflower",i)]},ro.Bellflower),h.jsxs(Zd,{value:ro.Sunflower,children:[h.jsx("img",{alt:ro.Sunflower,src:mBe,height:20,style:{paddingRight:"32px"}})," ",Y.t("flower.Sunflower",i)]},ro.Sunflower),h.jsxs(Zd,{value:ro.Tulip,children:[h.jsx("img",{alt:ro.Tulip,src:yBe,height:20,style:{paddingRight:"24px"}})," ",Y.t("flower.Tulip",i)]},ro.Tulip)]})}),uho=t=>{const e=[];if(t.type!==z.Flower)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"flower-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"flower-cut",label:h.jsx(kd,{})}),e.push({key:"flower-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"flower-flip",label:h.jsx(L9e,{billboardModel:n})}),o&&e.push({key:"flower-change-type",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"60px"},children:[Y.t("flowerMenu.Type",r),": "]}),h.jsx(cho,{flower:n})]})}),{items:e}},dho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.filled=i;break}})},o=r=>{const i={name:"Fill Polygon",timestamp:Date.now(),checked:!t.filled,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:Y.t("polygonMenu.Filled",e)})})},fho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.shininess=i;break}})},o=r=>{const a={name:"Shiny Polygon",timestamp:Date.now(),checked:((t==null?void 0:t.shininess)??0)>0,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,a.checked?0:100)},redo:()=>{n(t.id,a.checked?100:0)}};M.getState().addUndoable(a),n(t.id,r.target.checked?100:0)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.shininess,onChange:o,children:Y.t("polygonMenu.Shiny",e)})})},hho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.noOutline=i;break}})},o=r=>{const i={name:"No Outline for Polygon",timestamp:Date.now(),checked:!t.noOutline,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.noOutline,onChange:o,children:Y.t("polygonMenu.NoOutline",e)})})},pho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.text)??""),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.text=l);break}})},i=()=>{const a={name:"Set Text for Polygon",timestamp:Date.now(),oldValue:t.text??"",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.Text",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},gho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontSize)??1),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontSize=l);break}})},i=()=>{const a={name:"Set Font Size for Polygon",timestamp:Date.now(),oldValue:t.fontSize??1,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.FontSize",e),":"]}),min:.1,max:5,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},mho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontColor)??"black"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontColor=l);break}})},i=()=>{const a={name:"Set Font Color for Polygon",timestamp:Date.now(),oldValue:t.fontColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.FontColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},yho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontOutlineColor)??"white"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineColor=l);break}})},i=()=>{const a={name:"Set Font Outline Color for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineColor??"white",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontOutlineColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},Aho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontOutlineWidth)??0),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineWidth=l);break}})},i=()=>{const a={name:"Set Font Outline Width for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontOutlineWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},who=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontStrokeColor)??"black"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeColor=l);break}})},i=()=>{const a={name:"Set Font Stroke Color for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontStrokeColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},vho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontStrokeWidth)??0),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeWidth=l);break}})},i=()=>{const a={name:"Set Font Stroke Width for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontStrokeWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},xho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M($wt),i=M(Qwt),a=M(Zwt),l=M(e7t),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.lineColor)??"black"),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&x!==b.lineColor)return!0;break;case re.AllObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&x!==b.lineColor)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const b of e)if(b.type===z.Polygon&&b.parentId===p.parentId&&ye.isIdentical(b.normal,p.normal)&&!b.locked&&b.lineColor!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of e)if(b.type===z.Polygon&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&b.lineColor!==x)return!0;break;default:if(x!==(p==null?void 0:p.lineColor))return!0}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Polygon&&!H.locked&&x.has(H.id)&&(H.lineColor=b)})},v=x=>{if(p&&C(x))switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for Selected Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for All Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,x),f(d+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const F of e)F.type===z.Polygon&&F.parentId===p.parentId&&ye.isIdentical(F.normal,p.normal)&&R.set(F.id,F.lineColor??"gray");const H={name:"Set Line Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&i(z.Polygon,H.groupId,H.normal,H.newValue)}};s(H),i(z.Polygon,p.parentId,p.normal,x),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of e)H.type===z.Polygon&&H.foundationId===p.foundationId&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,x),f(d+1)}break}default:{const b=n(p.id),R=b?b.lineColor:p.lineColor,H={name:"Set Line Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}},T=()=>{t(!1)},w=()=>{v(g)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.LineColor",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:g??(p==null?void 0:p.lineColor)??"black",onChangeComplete:x=>{A(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},bho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(WH),l=M(NH),s=M(no),c=M(Qn),u=uo(z.Polygon),[d,f]=m.useState((u==null?void 0:u.lineStyle)??Xh.Solid),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.Polygon&&E.id===R){E.lineStyle=H;break}})},y=(R,H,F)=>{e(E=>{for(const N of E.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,H)&&!N.locked&&(N.lineStyle=F)})},S=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.Polygon&&E.foundationId===R&&!E.locked&&(E.lineStyle=H)})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&(F.lineStyle=R)})},P=R=>{l(R.target.value)},v=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const H of n)if(H.type===z.Polygon&&H.parentId===u.parentId&&ye.isIdentical(H.normal,u.normal)&&!H.locked&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.Polygon&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&R!==H.lineStyle)return!0;break;default:if(R!==(u==null?void 0:u.lineStyle))return!0}return!1}},T=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.Polygon&&!E.locked&&R.has(E.id)&&(E.lineStyle=H)})},w=R=>{if(u&&v(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for Selected Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{T(F.oldValues,F.newValue)}};i(F),T(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for All Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(r(u)){const F=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&F.set(N.id,N.lineStyle??Xh.Solid);const E={name:"Set Line Style for All Polygons on Same Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of E.oldValues.entries())A(N,U)},redo:()=>{E.groupId&&y(E.groupId,E.normal,E.newValue)}};i(E),y(u.parentId,u.normal,R),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.Polygon&&E.foundationId===u.foundationId&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for All Polygons Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};i(F),S(u.foundationId,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.lineStyle:u.lineStyle,E={name:"Set Line Style of Selected Polygon",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.LineStyle",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"200px"},value:d,onChange:R=>f(R),children:[h.jsxs(g,{value:Xh.Solid,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px solid dimGray"},children:" "}),Y.t("polygonMenu.SolidLine",p)]},Xh.Solid),h.jsxs(g,{value:Xh.Dashed,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dashed dimGray"},children:" "}),Y.t("polygonMenu.DashedLine",p)]},Xh.Dashed),h.jsxs(g,{value:Xh.Dotted,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dotted dimGray"},children:" "}),Y.t("polygonMenu.DottedLine",p)]},Xh.Dotted)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",p)})]})})})]})})},Sho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M(t7t),i=M(n7t),a=M(o7t),l=M(r7t),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.lineWidth)??1),y=$t(),{Option:S}=Uo,C=b=>{u(b.target.value)},P=b=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&b!==R.lineWidth)return!0;break;case re.AllObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&b!==R.lineWidth)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const R of e)if(R.type===z.Polygon&&R.parentId===p.parentId&&ye.isIdentical(R.normal,p.normal)&&!R.locked&&R.lineWidth!==b)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const R of e)if(R.type===z.Polygon&&R.foundationId===(p==null?void 0:p.foundationId)&&!R.locked&&R.lineWidth!==b)return!0;break;default:if(b!==(p==null?void 0:p.lineWidth))return!0}return!1}},v=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&b.has(F.id)&&(F.lineWidth=R)})},T=b=>{if(p&&P(b))switch(c){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of e)F.type===z.Polygon&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for Selected Polygons",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{v(H.oldValues,H.newValue)}};s(H),v(R,b),f(d+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of e)F.type===z.Polygon&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for All Polygons",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{l(z.Polygon,H.newValue)}};s(H),l(z.Polygon,b),f(d+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const H=new Map;for(const E of e)E.type===z.Polygon&&E.parentId===p.parentId&&ye.isIdentical(E.normal,p.normal)&&H.set(E.id,E.lineWidth??1);const F={name:"Set Line Width for All Polygons on Same Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[E,N]of F.oldValues.entries())r(E,N)},redo:()=>{F.groupId&&i(z.Polygon,F.groupId,F.normal,F.newValue)}};s(F),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const R=new Map;for(const F of e)F.type===z.Polygon&&F.foundationId===p.foundationId&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for All Polygons Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&a(z.Polygon,H.groupId,H.newValue)}};s(H),a(z.Polygon,p.foundationId,b),f(d+1)}break}default:{const R=n(p.id),H=R?R.lineWidth:p.lineWidth,F={name:"Set Line Width of Selected Polygon",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(p.id,b),f(d+1);break}}},w=()=>{t(!1)},x=()=>{T(g),t(!1),f(0)};return h.jsx(so,{width:560,title:Y.t("polygonMenu.LineWidth",y),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"200px"},value:g,onChange:b=>A(b),children:[h.jsx(S,{value:$y.One,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"1px solid dimGray"}})},$y.One),h.jsx(S,{value:$y.Two,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"2px solid dimGray"}})},$y.Two),h.jsx(S,{value:$y.Three,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"3px solid dimGray"}})},$y.Three),h.jsx(S,{value:$y.Four,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"4px solid dimGray"}})},$y.Four),h.jsx(S,{value:$y.Five,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"5px solid dimGray"}})},$y.Five)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:C,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},Tho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M(dYe),i=M(Kwt),a=M(qwt),l=M(fYe),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.color)??"gray"),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&x!==b.color)return!0;break;case re.AllObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&x!==b.color)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of e)if(b.type===z.Polygon&&b.foundationId===p.foundationId&&!b.locked&&b.color!==x)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const b of e)if(b.type===z.Polygon&&b.parentId===p.parentId&&ye.isIdentical(b.normal,p.normal)&&!b.locked&&b.color!==x)return!0;break;default:if(x!==p.color)return!0}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Polygon&&!H.locked&&x.has(H.id)&&(H.color=b)})},v=x=>{if(p&&C(x))switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for Selected Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for All Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of e)H.type===z.Polygon&&H.foundationId===p.foundationId&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,x),f(d+1)}break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const F of e)F.type===z.Polygon&&F.parentId===p.parentId&&ye.isIdentical(F.normal,p.normal)&&R.set(F.id,F.color??"gray");const H={name:"Set Fill Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&i(z.Polygon,H.groupId,H.normal,H.newValue)}};s(H),i(z.Polygon,p.parentId,p.normal,x),f(d+1)}break}default:{const b=n(p.id),R=b?b.color:p.color,H={name:"Set Fill Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}},T=()=>{t(!1)},w=()=>{v(g)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.FillColor",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:g??(p==null?void 0:p.color)??"gray",onChangeComplete:x=>{A(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},Pho="/aladdin/assets/polygon_08_menu-RpvWW3pg.png",Cho="/aladdin/assets/polygon_09_menu-CCH8lYni.png",Rho="/aladdin/assets/polygon_10_menu-BYFeRpsw.png",Hho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(WH),l=M(NH),s=M(no),c=M(Qn),u=uo(z.Polygon),[d,f]=m.useState((u==null?void 0:u.textureType)??Kr.NoTexture),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Polygon&&!E.locked){E.textureType=H;break}})},y=(R,H,F)=>{e(E=>{for(const N of E.elements)N.type===z.Polygon&&N.parentId===R&&ye.isIdentical(N.normal,H)&&!N.locked&&(N.textureType=F)})},S=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.Polygon&&E.foundationId===R&&!E.locked&&(E.textureType=H)})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&(F.textureType=R)})},P=R=>{l(R.target.value)},v=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&R!==H.textureType)return!0;break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&R!==H.textureType)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const H of n)if(H.type===z.Polygon&&H.parentId===u.parentId&&ye.isIdentical(H.normal,u.normal)&&!H.locked&&H.textureType!==R)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.Polygon&&H.foundationId===u.foundationId&&!H.locked&&H.textureType!==R)return!0;break;default:if(R!==(u==null?void 0:u.textureType))return!0}return!1}},T=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.Polygon&&!E.locked&&R.has(E.id)&&(E.textureType=H)})},w=R=>{if(u&&v(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for Selected Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{T(F.oldValues,F.newValue)}};i(F),T(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for All Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(r(u)){const F=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&ye.isIdentical(N.normal,u.normal)&&F.set(N.id,N.textureType??Kr.NoTexture);const E={name:"Set Texture for All Polygons on Same Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of E.oldValues.entries())A(N,U)},redo:()=>{E.groupId&&y(E.groupId,E.normal,E.newValue)}};i(E),y(u.parentId,u.normal,R),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.Polygon&&E.foundationId===u.foundationId&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for All Polygons Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};i(F),S(u.foundationId,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.textureType:u.textureType,E={name:"Set Texture of Selected Polygon",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:500,title:Y.t("polygonMenu.FillTexture",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"150px"},value:d,onChange:R=>f(R),children:[h.jsxs(g,{value:Kr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",p)]},Kr.NoTexture),h.jsxs(g,{value:Kr.Texture01,children:[h.jsx("img",{alt:Kr.Texture01,src:Qnt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture01",p)]},Kr.Texture01),h.jsxs(g,{value:Kr.Texture02,children:[h.jsx("img",{alt:Kr.Texture02,src:Znt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture02",p)]},Kr.Texture02),h.jsxs(g,{value:Kr.Texture03,children:[h.jsx("img",{alt:Kr.Texture03,src:eot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture03",p)]},Kr.Texture03),h.jsxs(g,{value:Kr.Texture04,children:[h.jsx("img",{alt:Kr.Texture04,src:tot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture04",p)]},Kr.Texture04),h.jsxs(g,{value:Kr.Texture05,children:[h.jsx("img",{alt:Kr.Texture05,src:not,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture05",p)]},Kr.Texture05),h.jsxs(g,{value:Kr.Texture06,children:[h.jsx("img",{alt:Kr.Texture06,src:oot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture06",p)]},Kr.Texture06),h.jsxs(g,{value:Kr.Texture07,children:[h.jsx("img",{alt:Kr.Texture07,src:rot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture07",p)]},Kr.Texture07),h.jsxs(g,{value:Kr.Texture08,children:[h.jsx("img",{alt:Kr.Texture08,src:Pho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture08",p)]},Kr.Texture08),h.jsxs(g,{value:Kr.Texture09,children:[h.jsx("img",{alt:Kr.Texture09,src:Cho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture09",p)]},Kr.Texture09),h.jsxs(g,{value:Kr.Texture10,children:[h.jsx("img",{alt:Kr.Texture10,src:Rho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture10",p)]},Kr.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",p)})]})})})]})})},Mho=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(WH),r=M(NH),i=M(no),a=M(Qn),l=M(Jn),s=M(pn),c=uo(z.Polygon),[u,d]=m.useState((c==null?void 0:c.opacity)!==void 0?c.opacity:1),f=$t(),p=(v,T)=>{s(w=>{for(const x of w.elements)if(x.id===v){x.opacity=T;break}})},g=v=>{for(const[T,w]of v.entries())p(T,w)},A=(v,T)=>{for(const w of v.keys())p(w,T)},y=v=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&v!==T.opacity&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&v!==T.opacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===c.foundationId&&v!==T.opacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===c.parentId&&ye.isIdentical(T.normal,c.normal)&&v!==T.opacity&&!T.locked)return!0;break;default:if(v!==(c==null?void 0:c.opacity))return!0;break}return!1}},S=v=>{if(c&&y(v))switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)if(x.type===z.Polygon&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)if(x.type===z.Polygon&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const x of e)if(x.type===z.Polygon&&x.foundationId===c.foundationId&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:c.foundationId,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1)}break}case re.AllObjectsOfThisTypeOnSurface:{if(c.parentId){const T=new Map;for(const x of e)if(x.type===z.Polygon&&x.parentId===c.parentId&&ye.isIdentical(x.normal,c.normal)&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:c.foundationId,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1)}break}default:if(c){const T=l(c.id),w=T.opacity!==void 0?T.opacity:c.opacity!==void 0?c.opacity:1,x={name:"Set Polygon Opacity",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(c.id,v),a(i+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("polygonMenu.Opacity",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.1,precision:1,value:u,formatter:v=>Number(v).toFixed(1),onChange:v=>d(v)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>r(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",f)})]})})})]})})};class qR{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=ye.calculatePolygonBounds(e.vertices),g=(r===vr.portrait?o.length:o.width)*a;if(s===El.upDown){const A=Math.floor(((p.maxX()-p.minX())*n.lx-g)/l),y=p.minX()+g/(2*n.lx)+d/n.lx,S=l/n.lx,C=.5*Math.abs(Math.cos(i))*g/n.lx,P={x:0,y:-.5},v={x:0,y:.5},T=void 0;for(let w=0;w<=A;w++){const x=y+w*S;P.x=v.x=x-C;const b=ye.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.y-E.y);P.x=v.x=x+C;const R=ye.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.y-E.y),H=Math.max(b.length,R.length)/2;if(H>0)for(let F=0;FF.x-E.x);P.y=v.y=x+C;const R=ye.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.x-E.x),H=Math.max(b.length,R.length)/2;if(H>0)for(let F=0;F0)return Va.makeSolarPanel(s,c,a*s.lx,(A+y)/2*s.ly,s.cz,vr.portrait,d,f,u,Qt,ko,i,void 0,S*s.ly,l)}static makeLeftRightSegment(e,n,o,r,i,a,l,s,c,u,d,f,p){const g=Math.abs(e.x-n.x)0)return Va.makeSolarPanel(s,c,(A+y)/2*s.lx,a*s.ly,s.cz,vr.portrait,d,f,u,0,ko,i,void 0,S*s.lx,l)}}class Iho{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=!ye.isZero(n.rotation[2]),g=[];for(const P of e.vertices)g.push({x:P.x*n.lx+n.cx,y:P.y*n.ly+n.cy});const A=p?ye.rotatePolygon(g,n.cx,n.cy,n.rotation[2]):g,y=ye.calculatePolygonBounds(A),S=(r===vr.portrait?o.length:o.width)*a,C=.5*Math.abs(Math.cos(i))*S;if(s===El.eastWest){const P=y.maxY()-y.minY(),v=Math.floor((P-2*d-S)/l),T=y.minY()+S/2+d,w={x:y.minX(),y:0},x={x:y.maxX(),y:0};for(let b=0;b<=v;b++){const R=T+b*l;w.y=x.y=R-C;const H=ye.polygonIntersections(w,x,A).sort((N,U)=>N.x-U.x);w.y=x.y=R+C;const F=ye.polygonIntersections(w,x,A).sort((N,U)=>N.x-U.x),E=Math.max(H.length,F.length)/2;if(E>0)for(let N=0;N0){const $=ye.relativeCoordinates((B+O)/2,R,0,n),ie=Va.makeSolarPanel(n,o,$.x*n.lx,$.y*n.ly,n.cz,vr.portrait,c,u,i,-n.rotation[2],ko,[0,0,0],void 0,q,S);ie.referenceId=e.id,ye.changeOrientation(ie,o,r),f.push(ie)}}}}else if(s===El.northSouth){const P=y.maxX()-y.minX(),v=Math.floor((P-2*d-S)/l),T=y.minX()+S/2+d,w={x:0,y:y.minY()},x={x:0,y:y.maxY()};for(let b=0;b<=v;b++){const R=T+b*l;w.x=x.x=R-C;const H=ye.polygonIntersections(w,x,A).sort((N,U)=>N.y-U.y);w.x=x.x=R+C;const F=ye.polygonIntersections(w,x,A).sort((N,U)=>N.y-U.y),E=Math.max(H.length,F.length)/2;if(E>0)for(let N=0;N0){const $=ye.relativeCoordinates(R,(V+G)/2,0,n),ie=Va.makeSolarPanel(n,o,$.x*n.lx,$.y*n.ly,n.cz,vr.portrait,c,u,i,-n.rotation[2]+Qt,ko,[0,0,0],void 0,q,S);ie.referenceId=e.id,ye.changeOrientation(ie,o,r),f.push(ie)}}}}return f}}const{Option:nv}=Uo,zho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M.getState().solarPanelArrayLayoutParams,r=M(Db),i=M(Gr),a=M(DH),l=M(EH),s=M(t5),c=M(Owt),u=M(m7t),d=M(Vge),f=M(g7t),p=M(En),g=M(no),A=M(Qn),y=M(Xi),[S,C]=m.useState(!1),[P,v]=m.useState(!1),[T,w]=m.useState(!1),[x,b]=m.useState({left:0,top:0,bottom:0,right:0}),R=m.useRef(null),H=m.useRef(!0),F=m.useRef(null),E=m.useRef(null),N=m.useRef(!1),U=m.useRef(M(x4t)),W=m.useRef(M(b4t)),k=m.useRef(M(M4t)),D=m.useRef(M(H4t)),L=m.useRef(M(S4t)),j=m.useRef(M(T4t)),B=m.useRef(M(P4t)??0),O=m.useRef(M(C4t)),V=m.useRef(M(R4t)),G=$t(),q=s(U.current),$=r(),ie=m.useMemo(()=>({...l,...a}),[a,l]);m.useEffect(()=>{var ge;(ge=F.current)==null||ge.focus()},[]),m.useEffect(()=>{var ge;P&&((ge=E.current)==null||ge.focus())},[P]);const Q=(ge,Se)=>{if(R.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=R.current.getBoundingClientRect();b({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},se=()=>{const ge=(k.current===vr.portrait?q.length:q.width)*L.current;return .5*(ge*Math.abs(Math.sin(D.current)))>O.current?(co(Y.t("message.SolarPanelsCannotIntersectWithGround",G)),!1):ge>j.current?(co(Y.t("message.SolarPanelsCannotOverlapWithOneAnother",G)),!1):!0},Z=ge=>{const Se=n.filter(Re=>Re.type===z.SolarPanel&&Re.parentId===ge.parentId);if(Se.length>0)for(const Re of Se)Re.referenceId!==ge.id&&ye.isPointInside(Re.cx,Re.cy,ge.vertices)&&c(Re.id,ge.id)},ee=()=>{if(($==null?void 0:$.type)===z.Polygon){const ge=i($);if(ge){const Se=[],De=W.current===El.eastWest||W.current===El.northSouth?Iho.create($,ge,q,k.current,D.current,L.current,j.current,W.current,O.current,V.current,B.current):qR.create($,ge,q,k.current,D.current,L.current,j.current,W.current,O.current,V.current,B.current);if(De.length>0){for(const ue of De)Se.push(JSON.parse(JSON.stringify(ue))),e(fe=>{fe.elements.push(ue)});const Ae={name:"Solar Panel Array Layout",timestamp:Date.now(),oldElements:M.getState().deletedElements,newElements:Se,oldParams:{pvModelName:o.pvModelName,rowAxis:o.rowAxis,orientation:o.orientation,tiltAngle:o.tiltAngle,rowsPerRack:o.rowsPerRack,interRowSpacing:o.interRowSpacing,poleHeight:o.poleHeight,poleSpacing:o.poleSpacing,margin:o.margin},newParams:{pvModelName:U.current,rowAxis:W.current,orientation:k.current,tiltAngle:D.current,rowsPerRack:L.current,interRowSpacing:j.current,poleHeight:O.current,poleSpacing:V.current,margin:B.current},referenceId:$.id,undo:()=>{d(Ae.referenceId,!1),Ae.oldElements.length>0&&e(ue=>{for(const fe of Ae.oldElements)ue.elements.push(fe)}),te(Ae.oldParams),oe()},redo:()=>{d(Ae.referenceId,!1),Ae.newElements.length>0&&e(ue=>{for(const fe of Ae.newElements)ue.elements.push(fe)}),te(Ae.newParams),oe()}};p(Ae),A(g+1)}}H.current=!1,oe()}},te=ge=>{U.current=ge.pvModelName,W.current=ge.rowAxis,k.current=ge.orientation,D.current=ge.tiltAngle,L.current=ge.rowsPerRack,j.current=ge.interRowSpacing,O.current=ge.poleHeight,V.current=ge.poleSpacing,B.current=ge.margin??0},oe=()=>{e(ge=>{ge.solarPanelArrayLayoutParams.pvModelName=U.current,ge.solarPanelArrayLayoutParams.rowAxis=W.current,ge.solarPanelArrayLayoutParams.orientation=k.current,ge.solarPanelArrayLayoutParams.tiltAngle=D.current,ge.solarPanelArrayLayoutParams.rowsPerRack=L.current,ge.solarPanelArrayLayoutParams.interRowSpacing=j.current,ge.solarPanelArrayLayoutParams.poleHeight=O.current,ge.solarPanelArrayLayoutParams.poleSpacing=V.current,ge.solarPanelArrayLayoutParams.margin=B.current})},de=()=>{H.current&&(se()?$&&(Z($),u($.id)>0?v(!0):(f(),ee())):co(Y.t("polygonMenu.LayoutNotAcceptedCheckYourParameters",G)))},he=()=>{de(),N.current=!1},pe=()=>{t(!1),y(),H.current=!0,N.current=!1},me=()=>{H.current?(de(),N.current=!0):t(!1)},le=()=>{v(!1)},Te=()=>{$&&(d($.id,!0),ee(),N.current&&(t(!1),A(0))),v(!1)};return h.jsxs(h.Fragment,{children:[P&&h.jsx(yi,{width:400,open:P,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:Y.t("word.Reminder",G)}),footer:[h.jsx(io,{onClick:le,children:Y.t("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:E,onClick:Te,children:Y.t("word.OK",G)},"OK")],children:Y.t("message.ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout",G)+" "+Y.t("message.DoYouWantToContinue",G)}),h.jsxs(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:Y.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",G)}),footer:[h.jsx(io,{disabled:!H.current,onClick:he,children:Y.t("word.Apply",G)},"Apply"),h.jsx(io,{onClick:pe,children:Y.t("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:F,onClick:me,children:Y.t("word.OK",G)},"OK")],onCancel:()=>{t(!1),H.current=!0},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!T,bounds:x,onStart:(Se,Re)=>Q(Se,Re),children:h.jsx("div",{ref:R,children:ge})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px",paddingTop:"10px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(ie).length+" "+Y.t("word.Options",G)+"):"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:U.current,onChange:ge=>{ge!==null&&(U.current=ge,H.current=!0,C(!S))},children:Object.keys(ie).map(ge=>h.jsx(nv,{value:ge,children:ge+(ie[ge].bifacialityFactor>0?" ("+Y.t("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{style:{width:"100%"},value:W.current,onChange:ge=>{ge!==null&&(W.current=ge,H.current=!0,C(!S))},children:[h.jsx(nv,{value:El.leftRight,children:Y.t("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(nv,{value:El.upDown,children:Y.t("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown),h.jsx(nv,{value:El.eastWest,children:Y.t("polygonMenu.SolarPanelArrayEastWestRowAxis",G)},El.eastWest),h.jsx(nv,{value:El.northSouth,children:Y.t("polygonMenu.SolarPanelArrayNorthSouthRowAxis",G)},El.northSouth)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{style:{width:"100%"},value:k.current,onChange:ge=>{ge!==null&&(k.current=ge,H.current=!0,C(!S))},children:[h.jsx(nv,{value:vr.portrait,children:Y.t("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(nv,{value:vr.landscape,children:Y.t("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayTiltAngle",G)+" ([-90°, 90°]): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:-90,max:90,style:{width:"100%"},precision:2,value:parseFloat(ye.toDegrees(D.current).toFixed(2)),step:1,formatter:ge=>`${ge}°`,onChange:ge=>{ge!==null&&(D.current=ye.toRadians(ge),H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayRowWidth",G)+" ([1-100] "+Y.t("solarPanelMenu.Panels",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:1,max:100,step:1,style:{width:"100%"},precision:0,formatter:ge=>Number(ge).toFixed(0),value:L.current,onChange:ge=>{ge!==null&&(L.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayInterRowSpacing",G)+" ([1, 20] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:1,max:20,style:{width:"100%"},precision:2,value:j.current,step:.5,onChange:ge=>{ge!==null&&(j.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayMargin",G)+" ([0, 5] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:0,max:5,style:{width:"100%"},precision:1,value:B.current,step:.1,onChange:ge=>{ge!==null&&(B.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayPoleHeight",G)+" ([0, 10] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:0,max:10,style:{width:"100%"},precision:2,value:O.current,step:.1,onChange:ge=>{ge!==null&&(O.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayPoleSpacing",G)+" ([2, 50] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:2,max:50,style:{width:"100%"},precision:2,value:V.current,step:.5,onChange:ge=>{ge!==null&&(V.current=ge,H.current=!0,C(!S))}})})]})]})]})},{Option:Yh}=Uo,Dho=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(DH),a=M(EH),l=M(c3),s=M(Gr),c=M(s3),u=M(bA).geneticAlgorithmParams,d=M(c$),f=M(xxt),p=M(a$),[g,A]=m.useState(!1),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=m.useRef(u.objectiveFunctionType),w=m.useRef(u.selectionMethod),x=m.useRef(u.searchMethod),b=m.useRef(u.populationSize),R=m.useRef(u.maximumGenerations),H=m.useRef(u.mutationRate),F=m.useRef(u.selectionRate??.5),E=m.useRef(u.crossoverRate??.5),N=m.useRef(u.convergenceThreshold),U=m.useRef(u.localSearchRadius),W=m.useRef(d.minimumTiltAngle??-Qt),k=m.useRef(d.maximumTiltAngle??Qt),D=m.useRef(d.minimumRowsPerRack),L=m.useRef(d.maximumRowsPerRack),j=m.useRef(d.minimumInterRowSpacing),B=m.useRef(d.maximumInterRowSpacing),O=m.useRef(null),V=m.useMemo(()=>({...a,...i}),[i,a]);m.useEffect(()=>{var ge;(ge=O.current)==null||ge.focus()},[]);const G={lng:o},q=m.useRef(d.rowAxis??El.leftRight),$=l?s(l):void 0,ie=$?c(z.SolarPanel,$.id):void 0,Q=m.useRef(ie&&ie.length>0?ie[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),se=m.useRef(ie&&ie.length>0?ie[0].orientation:d.orientation??vr.landscape),Z=m.useRef(ie&&ie.length>0?ie[0].poleHeight:d.poleHeight??1),ee=m.useRef(ie&&ie.length>0?ie[0].poleSpacing:d.poleSpacing??3),te=m.useRef(d.margin??0),oe=m.useRef(p.electricitySellingPrice),de=m.useRef(p.operationalCostPerUnit);m.useEffect(()=>{oe.current=p.electricitySellingPrice},[p.electricitySellingPrice]),m.useEffect(()=>{de.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const he=(ge,Se)=>{if(v.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=v.current.getBoundingClientRect();P({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},pe=()=>{e(ge=>{ge.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_ARRAY,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=T.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=w.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=x.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=b.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=R.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=F.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=E.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=H.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=N.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=U.current,ge.solarPanelArrayLayoutConstraints||(ge.solarPanelArrayLayoutConstraints=new mX),ge.solarPanelArrayLayoutConstraints.minimumRowsPerRack=D.current,ge.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,ge.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,ge.solarPanelArrayLayoutConstraints.maximumTiltAngle=k.current,ge.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,ge.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=B.current,ge.solarPanelArrayLayoutConstraints.poleHeight=Z.current,ge.solarPanelArrayLayoutConstraints.poleSpacing=ee.current,ge.solarPanelArrayLayoutConstraints.pvModelName=Q.current,ge.solarPanelArrayLayoutConstraints.rowAxis=q.current,ge.solarPanelArrayLayoutConstraints.orientation=se.current,ge.solarPanelArrayLayoutConstraints.margin=te.current,ge.economicsParams.operationalCostPerUnit=de.current,ge.economicsParams.electricitySellingPrice=oe.current})},me=()=>{r||gn(le("message.EvolutionStarted",G)),pe(),setTimeout(()=>{dt.getState().set(ge=>{ge.runEvolution=!ge.runEvolution}),e(ge=>{ge.evolutionMethod=_s.GENETIC_ALGORITHM,n&&(ge.actionInfo={name:"Run Genetic Algorithm for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...M.getState().evolutionaryAlgorithmState.geneticAlgorithmParams,...M.getState().solarPanelArrayLayoutConstraints,...M.getState().economicsParams}})})},100)},{t:le}=Xl(),Te=[{key:"1",label:le("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.Objective",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:T.current,style:{width:"100%"},value:T.current,onChange:ge=>{T.current=ge,A(!g)},children:[h.jsx(Yh,{value:Po.DAILY_TOTAL_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Po.DAILY_TOTAL_OUTPUT),h.jsx(Yh,{value:Po.YEARLY_TOTAL_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Po.YEARLY_TOTAL_OUTPUT),h.jsx(Yh,{value:Po.DAILY_AVERAGE_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Po.DAILY_AVERAGE_OUTPUT),h.jsx(Yh,{value:Po.YEARLY_AVERAGE_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Po.YEARLY_AVERAGE_OUTPUT),h.jsx(Yh,{value:Po.DAILY_PROFIT,children:le("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Po.DAILY_PROFIT),h.jsx(Yh,{value:Po.YEARLY_PROFIT,children:le("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Po.YEARLY_PROFIT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.GeneticAlgorithmSelectionMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:w.current,style:{width:"100%"},value:w.current,onChange:ge=>{w.current=ge,A(!g)},children:[h.jsx(Yh,{value:Wm.ROULETTE_WHEEL,children:le("optimizationMenu.RouletteWheel",G)},Wm.ROULETTE_WHEEL),h.jsx(Yh,{value:Wm.TOURNAMENT,children:le("optimizationMenu.Tournament",G)},Wm.TOURNAMENT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.PopulationSize",G)+" [10, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:b.current,step:1,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{ge!==null&&(b.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.MaximumGenerations",G)+" [5, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:R.current,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{ge!==null&&(R.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.SelectionRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:F.current,step:.01,onChange:ge=>{ge!==null&&(F.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.CrossoverRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:E.current,step:.01,onChange:ge=>{ge!==null&&(E.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.MutationRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:H.current,step:.01,onChange:ge=>{ge!==null&&(H.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:ge=>{ge!==null&&(N.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:x.current,style:{width:"100%"},value:x.current,onChange:ge=>{x.current=Number(ge),A(!g)},children:[h.jsx(Yh,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:le("optimizationMenu.GlobalSearchUniformSelection",G)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(Yh,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:le("optimizationMenu.LocalSearchRandomOptimization",G)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),x.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:ge=>{ge!==null&&(U.current=Number(ge),A(!g))}})})]})]})},{key:"2",label:le("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{W.current=ye.toRadians(ge[0]),k.current=ye.toRadians(ge[1]),A(!g)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(k.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{D.current=ge[0],L.current=ge[1],A(!g)},min:1,max:9,defaultValue:[D.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{j.current=ge[0],B.current=ge[1],A(!g)},min:1,max:10,defaultValue:[j.current,B.current],marks:{1:{style:{fontSize:"10px"},label:"1m"},3:{style:{fontSize:"10px"},label:"3m"},5:{style:{fontSize:"10px"},label:"5m"},7:{style:{fontSize:"10px"},label:"7m"},9:{style:{fontSize:"10px"},label:"9m"}}})})]})]})},{key:"3",label:le("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(V).length+" "+le("word.Options",G)+"):"}),h.jsx(Ke,{span:12,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:Q.current,onChange:ge=>{Q.current=ge,A(!g)},children:Object.keys(V).map(ge=>h.jsx(Yh,{value:ge,children:ge+(V[ge].bifacialityFactor>0?" ("+le("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:ge=>{q.current=ge,A(!g)},children:[h.jsx(Yh,{value:El.leftRight,children:le("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(Yh,{value:El.upDown,children:le("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:se.current,onChange:ge=>{se.current=ge,A(!g)},children:[h.jsx(Yh,{value:vr.portrait,children:le("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(Yh,{value:vr.landscape,children:le("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{te.current=ge,A(!g)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{Z.current=ge,A(!g)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{ee.current=ge,A(!g)},min:2,max:10,step:.1,defaultValue:ee.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{de.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:de.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{oe.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:oe.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:le("optimizationMenu.SolarPanelArrayLayout",G)+": "+le("optimizationMenu.GeneticAlgorithmSettings",G)}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:le("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:le("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(Se,Re)=>he(Se,Re),children:h.jsx("div",{ref:v,children:ge})}),children:h.jsx(hQ,{defaultActiveKey:f,items:Te,type:"card",onChange:ge=>{e(Se=>{Se.geneticAlgorithmWizardSelectedTab=ge})}})})})},{Option:O1}=Uo,Eho=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(DH),a=M(EH),l=M(c3),s=M(Gr),c=M(s3),u=M(bA).particleSwarmOptimizationParams,d=M(c$),f=M(bxt),p=M(a$),[g,A]=m.useState(!1),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=m.useRef(u.objectiveFunctionType),w=m.useRef(u.searchMethod),x=m.useRef(u.swarmSize),b=m.useRef(u.maximumSteps),R=m.useRef(u.vmax??.01),H=m.useRef(u.inertia??.8),F=m.useRef(u.cognitiveCoefficient??.1),E=m.useRef(u.socialCoefficient??.1),N=m.useRef(u.convergenceThreshold),U=m.useRef(u.localSearchRadius),W=m.useRef(d.minimumTiltAngle??-Qt),k=m.useRef(d.maximumTiltAngle??Qt),D=m.useRef(d.minimumRowsPerRack),L=m.useRef(d.maximumRowsPerRack),j=m.useRef(d.minimumInterRowSpacing),B=m.useRef(d.maximumInterRowSpacing),O=m.useRef(null),V=m.useMemo(()=>({...a,...i}),[i,a]);m.useEffect(()=>{var ge;(ge=O.current)==null||ge.focus()},[]);const G={lng:o},q=m.useRef(d.rowAxis??El.leftRight),$=l?s(l):void 0,ie=$?c(z.SolarPanel,$.id):void 0,Q=m.useRef(ie&&ie.length>0?ie[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),se=m.useRef(ie&&ie.length>0?ie[0].orientation:d.orientation??vr.landscape),Z=m.useRef(ie&&ie.length>0?ie[0].poleHeight:d.poleHeight??1),ee=m.useRef(ie&&ie.length>0?ie[0].poleSpacing:d.poleSpacing??3),te=m.useRef(d.margin??0),oe=m.useRef(p.electricitySellingPrice),de=m.useRef(p.operationalCostPerUnit);m.useEffect(()=>{oe.current=p.electricitySellingPrice},[p.electricitySellingPrice]),m.useEffect(()=>{de.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const he=(ge,Se)=>{if(v.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=v.current.getBoundingClientRect();P({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},pe=()=>{e(ge=>{ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_ARRAY,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=T.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=w.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=x.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=b.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=F.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=E.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=R.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=H.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=N.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=U.current,ge.solarPanelArrayLayoutConstraints||(ge.solarPanelArrayLayoutConstraints=new mX),ge.solarPanelArrayLayoutConstraints.minimumRowsPerRack=D.current,ge.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,ge.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,ge.solarPanelArrayLayoutConstraints.maximumTiltAngle=k.current,ge.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,ge.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=B.current,ge.solarPanelArrayLayoutConstraints.poleHeight=Z.current,ge.solarPanelArrayLayoutConstraints.poleSpacing=ee.current,ge.solarPanelArrayLayoutConstraints.pvModelName=Q.current,ge.solarPanelArrayLayoutConstraints.rowAxis=q.current,ge.solarPanelArrayLayoutConstraints.orientation=se.current,ge.solarPanelArrayLayoutConstraints.margin=te.current,ge.economicsParams.operationalCostPerUnit=de.current,ge.economicsParams.electricitySellingPrice=oe.current})},me=()=>{r||gn(le("message.EvolutionStarted",G)),pe(),setTimeout(()=>{dt.getState().set(ge=>{ge.runEvolution=!ge.runEvolution}),e(ge=>{ge.evolutionMethod=_s.PARTICLE_SWARM_OPTIMIZATION,n&&(ge.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...M.getState().evolutionaryAlgorithmState.particleSwarmOptimizationParams,...M.getState().solarPanelArrayLayoutConstraints,...M.getState().economicsParams}})})},100)},{t:le}=Xl(),Te=[{key:"1",label:le("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.Objective",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:T.current,style:{width:"100%"},value:T.current,onChange:ge=>{T.current=ge,A(!g)},children:[h.jsx(O1,{value:Po.DAILY_TOTAL_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Po.DAILY_TOTAL_OUTPUT),h.jsx(O1,{value:Po.YEARLY_TOTAL_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Po.YEARLY_TOTAL_OUTPUT),h.jsx(O1,{value:Po.DAILY_AVERAGE_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Po.DAILY_AVERAGE_OUTPUT),h.jsx(O1,{value:Po.YEARLY_AVERAGE_OUTPUT,children:le("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Po.YEARLY_AVERAGE_OUTPUT),h.jsx(O1,{value:Po.DAILY_PROFIT,children:le("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Po.DAILY_PROFIT),h.jsx(O1,{value:Po.YEARLY_PROFIT,children:le("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Po.YEARLY_PROFIT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.SwarmSize",G)+" [10, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:x.current,step:1,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{x.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.MaximumSteps",G)+" [5, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:b.current,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{b.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.CognitiveCoefficient",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:F.current,step:.01,onChange:ge=>{F.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.SocialCoefficient",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:E.current,step:.01,onChange:ge=>{E.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.InertiaWeight",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:H.current,step:.01,onChange:ge=>{H.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.MaximumVelocity",G)+" [0.001, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:R.current,step:.001,onChange:ge=>{R.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:ge=>{N.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:w.current,style:{width:"100%"},value:w.current,onChange:ge=>{w.current=Number(ge),A(!g)},children:[h.jsx(O1,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:le("optimizationMenu.GlobalSearchUniformSelection",G)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(O1,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:le("optimizationMenu.LocalSearchRandomOptimization",G)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),w.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:ge=>{U.current=Number(ge),A(!g)}})})]})]})},{key:"2",label:le("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{W.current=ye.toRadians(ge[0]),k.current=ye.toRadians(ge[1]),A(!g)},min:-90,max:90,defaultValue:[ye.toDegrees(W.current),ye.toDegrees(k.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{D.current=ge[0],L.current=ge[1],A(!g)},min:1,max:9,defaultValue:[D.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:le("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{j.current=ge[0],B.current=ge[1],A(!g)},min:2,max:10,defaultValue:[j.current,B.current],marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]})]})},{key:"3",label:le("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(V).length+" "+le("word.Options",G)+"):"}),h.jsx(Ke,{span:12,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:Q.current,onChange:ge=>{Q.current=ge,A(!g)},children:Object.keys(V).map(ge=>h.jsx(O1,{value:ge,children:ge+(V[ge].bifacialityFactor>0?" ("+le("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:ge=>{q.current=ge,A(!g)},children:[h.jsx(O1,{value:El.leftRight,children:le("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(O1,{value:El.upDown,children:le("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:se.current,onChange:ge=>{se.current=ge,A(!g)},children:[h.jsx(O1,{value:vr.portrait,children:le("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(O1,{value:vr.landscape,children:le("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{te.current=ge,A(!g)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{Z.current=ge,A(!g)},min:0,max:10,step:.1,defaultValue:Z.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{ee.current=ge,A(!g)},min:2,max:10,step:.1,defaultValue:ee.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{de.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:de.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:le("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{oe.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:oe.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:le("optimizationMenu.SolarPanelArrayLayout",G)+": "+le("optimizationMenu.ParticleSwarmOptimizationSettings",G)}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:le("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:O,onClick:()=>{me(),t(!1)},children:le("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(Se,Re)=>he(Se,Re),children:h.jsx("div",{ref:v,children:ge})}),children:h.jsx(hQ,{defaultActiveKey:f,items:Te,type:"card",onChange:ge=>{e(Se=>{Se.particleSwarmOptimizationWizardSelectedTab=ge})}})})})},Fho=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o=M.getState().getParent(n),r={lng:M.getState().language},i=!n.locked;return e.push({key:"polygon-paste",label:h.jsx(oM,{})}),e.push({key:"polygon-copy",label:h.jsx(Fd,{})}),i&&e.push({key:"polygon-cut",label:h.jsx(kd,{})}),o&&(o.type===z.Foundation||o.type===z.Cuboid)&&e.push({key:"polygon-layout-submenu",label:h.jsx(an,{children:Y.t("polygonMenu.Layout",r)}),children:[{key:"solar-panel-layout-wizard",label:h.jsxs(eo,{noPadding:!0,Dialog:zho,children:[Y.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",r)," ..."]})},{key:"solar-panel-layout-ai",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.SolarPanelArrayLayoutGenerativeDesign",r)}),children:[{key:"solar-panel-layout-ga",label:h.jsxs(eo,{noPadding:!0,Dialog:Dho,children:[Y.t("optimizationMenu.GeneticAlgorithm",r)," ..."]})},{key:"solar-panel-layout-pso",label:h.jsxs(eo,{noPadding:!0,Dialog:Eho,children:[Y.t("optimizationMenu.ParticleSwarmOptimization",r)," ..."]})}]}]}),e.push({key:"polygon-lock",label:h.jsx(Ku,{selectedElement:n})}),i&&(e.push({key:"polygon-filled",label:h.jsx(dho,{polygon:n})}),n.filled&&e.push({key:"polygon-shiny",label:h.jsx(fho,{polygon:n})}),e.push({key:"polygon-no-outline",label:h.jsx(hho,{polygon:n})})),i&&(e.push({key:"polygon-line-color",label:h.jsxs(eo,{Dialog:xho,children:[Y.t("polygonMenu.LineColor",r)," ..."]})},{key:"polygon-line-style",label:h.jsxs(eo,{Dialog:bho,children:[Y.t("polygonMenu.LineStyle",r)," ..."]})},{key:"polygon-line-width",label:h.jsxs(eo,{Dialog:Sho,children:[Y.t("polygonMenu.LineWidth",r)," ..."]})}),n.filled&&((!n.textureType||n.textureType===Kr.NoTexture)&&e.push({key:"polygon-fill-color",label:h.jsxs(eo,{Dialog:Tho,children:[Y.t("polygonMenu.FillColor",r)," ..."]})}),e.push({key:"polygon-texture",label:h.jsxs(eo,{Dialog:Hho,children:[Y.t("polygonMenu.FillTexture",r)," ..."]})},{key:"polygon-opacity",label:h.jsxs(eo,{Dialog:Mho,children:[Y.t("polygonMenu.Opacity",r)," ..."]})})),e.push({key:"polygon-text-box",label:h.jsx(an,{children:Y.t("polygonMenu.TextBox",r)}),children:[{key:"polygon-text",label:h.jsx(pho,{polygon:n})},{key:"polygon-font-size",label:h.jsx(gho,{polygon:n})},{key:"polygon-font-color",label:h.jsx(mho,{polygon:n})},{key:"polygon-font-outline-color",label:h.jsx(yho,{polygon:n})},{key:"polygon-font-outline-width",label:h.jsx(Aho,{polygon:n})},{key:"polygon-font-stroke-color",label:h.jsx(who,{polygon:n})},{key:"polygon-font-stroke-width",label:h.jsx(vho,{polygon:n})}]})),{items:e}},kho=(t,e)=>{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){o.vertices.splice(e,1);break}})},Lho=(t,e)=>{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>0&&e{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>=0&&e{if(t.selectedIndex>=0){const n=t.vertices.map(i=>({...i}));switch(e){case hx.Delete:kho(t.id,t.selectedIndex);break;case hx.InsertBeforeIndex:Lho(t.id,t.selectedIndex);break;case hx.InsertAfterIndex:Who(t.id,t.selectedIndex);break}const o=M.getState().getElementById(t.id).vertices.map(i=>({...i})),r={name:e,timestamp:Date.now(),changedElementId:t.id,changedElementType:t.type,oldValue:n,newValue:o,undo:()=>{r.oldValue&&Array.isArray(r.oldValue)&&M.getState().updatePolygonVerticesById(r.changedElementId,n)},redo:()=>{M.getState().updatePolygonVerticesById(r.changedElementId,o)}};M.getState().addUndoable(r)}},Nho=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o={lng:M.getState().language};return e.push({key:"polygon-vertex-insert-before-index",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.InsertVertexBeforeIndex",o)})},{key:"polygon-vertex-insert-after-index",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.InsertVertexAfterIndex",o)})}),n.vertices.length>3&&e.push({key:"polygon-vertex-delete",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.DeleteVertex",o)})}),{items:e,onClick:({key:i})=>{switch(i){case"polygon-vertex-insert-before-index":Vae(n,hx.InsertBeforeIndex);break;case"polygon-vertex-insert-after-index":Vae(n,hx.InsertAfterIndex);break;case"polygon-vertex-delete":Vae(n,hx.Delete);break}}}},Uho=({sensor:t})=>{const e=$t(),n=aot(t);return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.showLabel,onChange:n,children:Y.t("labelSubMenu.KeepShowingLabel",e)})})},jho=({sensor:t})=>{const e=$t(),{labelText:n,setLabelText:o}=iot(t),r=lot(t,n);return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"80px"},children:Y.t("labelSubMenu.LabelText",e)+":"}),h.jsx(jl,{style:{width:"150px"},value:n,onChange:i=>o(i.target.value),onPressEnter:r,onBlur:r})]})},Bho=t=>{const e=[];if(t.type!==z.Sensor)return{items:e};const n=t,o=!n.locked;return e.push({key:"sensor-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"sensor-cut",label:h.jsx(kd,{})}),e.push({key:"sensor-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"sensor-show-label",label:h.jsx(Uho,{sensor:n})}),e.push({key:"sensor-label-text",label:h.jsx(jho,{sensor:n})})),{items:e}},Yho=({light:t})=>{const e=$t(),n=M.getState().updateInsideLightById,o=r=>{const i=r.target.checked,a={name:"Inside Light",timestamp:Date.now(),checked:i,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.inside,onChange:o,children:Y.t("lightMenu.Inside",e)})})},Oho=({light:t})=>{const e=$t(),n=t.intensity??3,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.intensity=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Intensity",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),o(t.id,i),M.getState().set(l=>{l.actionState.lightIntensity=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"80px"},children:[Y.t("lightMenu.Intensity",e),":"]}),h.jsx(Sn,{min:.1,max:10,step:.1,precision:1,value:n,onChange:r})]})},Vho=({light:t})=>{const e=$t(),n=t.distance??5,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.distance=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Distance",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),o(t.id,i),M.getState().set(l=>{l.actionState.lightDistance=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"80px"},children:[Y.t("lightMenu.MaximumDistance",e),":"]}),h.jsx(Sn,{min:1,max:10,step:1,precision:1,value:n,onChange:r})]})},_ho=({light:t})=>{const e=t.color??"#ffff99",n=(o,r)=>{M.getState().set(i=>{for(const a of i.elements)if(a.type===z.Light&&a.id===o){a.color=r;break}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Ld,{color:e,onChangeComplete:o=>{const r=t.color,i=o.hex,a={name:"Set Light Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{n(t.id,a.oldValue)},redo:()=>{n(t.id,a.newValue)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.lightColor=i})}})})},Gho=t=>{const e=[];if(t.type!==z.Light)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=n.parentId?M.getState().getParent(n):void 0;return e.push({key:"light-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"light-cut",label:h.jsx(kd,{})}),e.push({key:"light-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&i&&(i.type===z.Roof||i.type===z.Wall)&&e.push({key:"light-inside",label:h.jsx(Yho,{light:n})}),o&&e.push({key:"light-intensity",label:h.jsx(Oho,{light:n})},{key:"light-distance",label:h.jsx(Vho,{light:n})},{key:"light-color",label:h.jsx(an,{children:Y.t("word.Color",r)}),children:[{key:"light-color-picker",label:h.jsx(_ho,{light:n}),style:{backgroundColor:"white"}}]}),{items:e}},Xho=()=>{const t=M(bge),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.axes=r})},o=r=>{const i=r.target.checked,a={name:"Show Axes",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.Axes",e)})})},Jho=()=>{const t=M(SBe),e=$t(),n=i=>{M.getState().set(a=>{a.viewState.theme=i})},o=i=>{const a=t,l=i.target.value,s={name:"Select Theme",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(s.oldValue)},redo:()=>{n(s.newValue)}};M.getState().addUndoable(s),n(l)},r=[{value:Os.Default,label:"skyMenu.ThemeDefault"},{value:Os.Desert,label:"skyMenu.ThemeDesert"},{value:Os.Dune,label:"skyMenu.ThemeDune"},{value:Os.Forest,label:"skyMenu.ThemeForest"},{value:Os.Grassland,label:"skyMenu.ThemeGrassland"},{value:Os.Hill,label:"skyMenu.ThemeHill"},{value:Os.Lake,label:"skyMenu.ThemeLake"},{value:Os.Mountain,label:"skyMenu.ThemeMountain"},{value:Os.Rural,label:"skyMenu.ThemeRural"}];return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t,onChange:o,children:h.jsx(on,{direction:"vertical",children:r.map((i,a)=>h.jsx(Le,{style:{width:"100%"},value:i.value,children:Y.t(i.label,e)},`${a}-${i.value}`))})})})},Kho=()=>{const t=M(TBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showAzimuthAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Azimuth Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowAzimuthAngle",e)})})},qho=()=>{const t=M(PBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showElevationAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Elevation Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowElevationAngle",e)})})},$ho=()=>{const t=M(CBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showZenithAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Zenith Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowZenithAngle",e)})})},Qho=()=>{const t=M(bBe)??3.5,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.directLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Direct Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.DirectLightBrightnessAtNoon",e)+" [0.1-10]:"}),h.jsx(Sn,{min:.1,max:10,step:.1,precision:2,value:t,onChange:o})]})},Zho=()=>{const t=M(xBe)??.2,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.ambientLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ambient Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.AmbientLightBrightnessAtNoon",e)+" [0.01-1]:"}),h.jsx(Sn,{min:.01,max:1,step:.01,precision:2,value:t,onChange:o})]})},epo=()=>{const t=M(T8t)??.01,e=$t(),n=r=>{M.getState().set(i=>{i.world.airAttenuationCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Sunlight Attenuation Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.SunlightAttenuationCoefficientInAir",e)+":"}),h.jsx(Sn,{min:0,max:.1,step:.001,precision:3,value:t,onChange:o})]})},tpo=()=>{const t=M(P8t)??5,e=$t(),n=r=>{M.getState().set(i=>{i.world.airConvectiveCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Convective Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.ConvectiveCoefficientOfAir",e)+" [W/(m²×K)]:"}),h.jsx(Sn,{min:2.5,max:20,step:.1,precision:2,value:t,onChange:o})]})},npo=()=>{const t=M(gW)??900,e=M.getState().world,n=$t(),o=m.useMemo(()=>dl(new Date(e.date),e.latitude),[e.date,e.latitude]),r=a=>{M.getState().set(l=>{l.world.highestTemperatureTimeInMinutes=a})},i=a=>{if(a===null)return;const l=t,s=a,c={name:"Set Time of Highest Temperature in Minutes",timestamp:Date.now(),oldValue:l,newValue:s,undo:()=>{r(c.oldValue)},redo:()=>{r(c.newValue)}};M.getState().addUndoable(c),r(s)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.HighestTemperatureTimeInMinutes",n)+":"}),h.jsx(Sn,{min:720,max:o.sunset,step:5,precision:0,value:t,onChange:i})]})},opo=()=>{const t={lng:M.getState().language},e=[];return e.push({key:"axes",label:h.jsx(Xho,{})}),e.push({key:"theme-submenu",label:h.jsx(an,{children:Y.t("skyMenu.Theme",t)}),children:[{key:"theme-radio-group",label:h.jsx(Jho,{}),style:{backgroundColor:"white"}}]}),e.push({key:"sun-angles-submenu",label:h.jsx(an,{children:Y.t("skyMenu.SelectSunAnglesToShow",t)}),children:[{key:"show-azimuth-angle",label:h.jsx(Kho,{})},{key:"ShowElevationAngle",label:h.jsx(qho,{})},{key:"ShowZenithAngle",label:h.jsx($ho,{})}]}),e.push({key:"direct-light-intensity",label:h.jsx(Qho,{})}),e.push({key:"ambient-light-intensity",label:h.jsx(Zho,{})}),e.push({key:"air-attenuation-coefficient",label:h.jsx(epo,{})}),e.push({key:"air-convective-coefficient",label:h.jsx(tpo,{})}),e.push({key:"highest-temperature-time-in-minutes",label:h.jsx(npo,{})}),{items:e}},DK=class DK{constructor(){this.n=14,this.nominalStrings=new Array(this.n),this.nominalWidths=new Array(this.n),this.nominalHeights=new Array(this.n),this.cellNx=new Array(this.n),this.cellNy=new Array(this.n),this.nominalWidths[0]=.99,this.nominalHeights[0]=1.65,this.cellNx[0]=6,this.cellNy[0]=10,this.nominalWidths[1]=.99,this.nominalHeights[1]=1.96,this.cellNx[1]=6,this.cellNy[1]=12,this.nominalWidths[2]=1.05,this.nominalHeights[2]=1.56,this.cellNx[2]=8,this.cellNy[2]=12,this.nominalWidths[3]=1.31,this.nominalHeights[3]=1.96,this.cellNx[3]=8,this.cellNy[3]=12,this.nominalWidths[4]=1.07,this.nominalHeights[4]=2.07,this.cellNx[4]=8,this.cellNy[4]=16,this.nominalWidths[5]=.6,this.nominalHeights[5]=1.2,this.cellNx[5]=10,this.cellNy[5]=20,this.nominalWidths[6]=1.2,this.nominalHeights[6]=2,this.cellNx[6]=10,this.cellNy[6]=20,this.nominalWidths[7]=1,this.nominalHeights[7]=2.07,this.cellNx[7]=6,this.cellNy[7]=12,this.nominalWidths[8]=.8,this.nominalHeights[8]=1.56,this.cellNx[8]=6,this.cellNy[8]=12,this.nominalWidths[9]=.83,this.nominalHeights[9]=1.58,this.cellNx[9]=6,this.cellNy[9]=12,this.nominalWidths[10]=.99,this.nominalHeights[10]=1.31,this.cellNx[10]=6,this.cellNy[10]=8,this.nominalWidths[11]=.99,this.nominalHeights[11]=1.5,this.cellNx[11]=6,this.cellNy[11]=9,this.nominalWidths[12]=1.05,this.nominalHeights[12]=1.81,this.cellNx[12]=8,this.cellNy[12]=14,this.nominalWidths[13]=1.05,this.nominalHeights[13]=1.69,this.cellNx[13]=8,this.cellNy[13]=13;for(let e=0;e{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(DH),a=M(EH),l=M(t5),s=M(En),c=M(vh),u=M(xh),d=M(no),f=M(Qn),p=uo(),[g,A]=m.useState((p==null?void 0:p.pvModelName)??"SPR-X21-335-BLK"),[y,S]=m.useState(),C=$t(),P=m.useMemo(()=>({...a,...i}),[i,a]),v=l(g??"SPR-X21-335-BLK");m.useEffect(()=>{S(v.nominalWidth.toFixed(2)+"m×"+v.nominalLength.toFixed(2)+"m ("+v.n+"×"+v.m+" "+Y.t("pvModelPanel.Cells",C)+")")},[v]);const T=(W,k)=>{e(D=>{for(const L of D.elements)if(L.type===z.SolarPanel&&L.id===W&&!L.locked){const j=L;j.pvModelName=k;let B=D.supportedPvModules[k];if(B||(B=D.customPvModules[k]),j.orientation===vr.portrait){const O=Math.max(1,Math.round(j.lx/B.width)),V=Math.max(1,Math.round(j.ly/B.length));j.lx=O*B.width,j.ly=V*B.length}else{const O=Math.max(1,Math.round(j.lx/B.length)),V=Math.max(1,Math.round(j.ly/B.width));j.lx=O*B.length,j.ly=V*B.width}break}})},w=(W,k)=>{e(D=>{let L=D.supportedPvModules[k];L||(L=D.customPvModules[k]);for(const j of D.elements)if(j.type===z.SolarPanel&&j.foundationId===W&&!j.locked){const B=j;if(B.pvModelName=k,B.orientation===vr.portrait){const O=Math.max(1,Math.round(B.lx/L.width)),V=Math.max(1,Math.round(B.ly/L.length));B.lx=O*L.width,B.ly=V*L.length}else{const O=Math.max(1,Math.round(B.lx/L.length)),V=Math.max(1,Math.round(B.ly/L.width));B.lx=O*L.length,B.ly=V*L.width}}})},x=(W,k,D)=>{e(L=>{let j=L.supportedPvModules[D];j||(j=L.customPvModules[D]);for(const B of L.elements)if(B.type===z.SolarPanel&&!B.locked){let O;if(k?O=B.parentId===W&&ye.isIdentical(B.normal,k):O=B.parentId===W,O){const V=B;if(V.pvModelName=D,V.orientation===vr.portrait){const G=Math.max(1,Math.round(V.lx/j.width)),q=Math.max(1,Math.round(V.ly/j.length));V.lx=G*j.width,V.ly=q*j.length}else{const G=Math.max(1,Math.round(V.lx/j.length)),q=Math.max(1,Math.round(V.ly/j.width));V.lx=G*j.length,V.ly=q*j.width}}}})},b=W=>{e(k=>{let D=k.supportedPvModules[W];D||(D=k.customPvModules[W]);for(const L of k.elements)if(L.type===z.SolarPanel&&!L.locked){const j=L;if(j.pvModelName=W,j.orientation===vr.portrait){const B=Math.max(1,Math.round(j.lx/D.width)),O=Math.max(1,Math.round(j.ly/D.length));j.lx=B*D.width,j.ly=O*D.length}else{const B=Math.max(1,Math.round(j.lx/D.length)),O=Math.max(1,Math.round(j.ly/D.width));j.lx=B*D.length,j.ly=O*D.width}}})},R=(W,k)=>{M.getState().set(D=>{let L=D.supportedPvModules[k];L||(L=D.customPvModules[k]);for(const j of D.elements)if(j.type===z.SolarPanel&&!j.locked&&W.has(j.id)){const B=j;if(B.pvModelName=k,B.orientation===vr.portrait){const O=Math.max(1,Math.round(B.lx/L.width)),V=Math.max(1,Math.round(B.ly/L.length));B.lx=O*L.width,B.ly=V*L.length}else{const O=Math.max(1,Math.round(B.lx/L.length)),V=Math.max(1,Math.round(B.ly/L.width));B.lx=O*L.length,B.ly=V*L.width}}})},H=W=>{u(W.target.value)},F=W=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const k of n)if(k.type===z.SolarPanel&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisType:{for(const k of n)if(k.type===z.SolarPanel&&!k.locked&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const k=r(p);if(k){if(k.type===z.Cuboid){for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&ye.isIdentical(L.normal,p.normal)&&!L.locked&&L.pvModelName!==W)return!0}else for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&!L.locked&&L.pvModelName!==W)return!0}break}default:{if((p==null?void 0:p.pvModelName)!==W)return!0;break}}return!1}},E=W=>{if(p&&F(W)){switch(c){case re.AllSelectedObjectsOfThisType:{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.pvModelName);const D={name:"Set Model for Selected Solar Panels",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{R(D.oldValues,D.newValue)}};s(D),R(k,W),f(d+1);break}case re.AllObjectsOfThisType:{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.pvModelName);const D={name:"Set Model for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{b(D.newValue)}};s(D),b(W),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===p.foundationId&&k.set(L.id,L.pvModelName);const D={name:"Set Model for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{D.groupId&&w(D.groupId,D.newValue)}};s(D),w(p.foundationId,W),f(d+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const k=r(p);if(k){const D=new Map,L=k.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&ye.isIdentical(O.normal,p.normal)&&D.set(O.id,O.pvModelName);else for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&D.set(O.id,O.pvModelName);const j=L?p.normal:void 0,B={name:"Set Model for All Solar Panels on Surface",timestamp:Date.now(),oldValues:D,newValue:W,groupId:p.parentId,normal:j,undo:()=>{for(const[O,V]of B.oldValues.entries())T(O,V)},redo:()=>{B.groupId&&x(B.groupId,B.normal,B.newValue)}};s(B),x(p.parentId,j,W),f(d+1)}break}default:{const k=o(p.id),D=k?k.pvModelName:p.pvModelName,L={name:"Set Model for Selected Solar Panel",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{T(L.changedElementId,L.oldValue)},redo:()=>{T(L.changedElementId,L.newValue)}};s(L),T(p.id,W),f(d+1);break}}e(k=>{k.actionState.solarPanelModelName=W})}},N=()=>{t(!1)},U=()=>{E(g)};return h.jsxs(so,{width:640,title:Y.t("pvModelPanel.SolarPanelSpecs",C),onApply:U,onClose:N,children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.Model",C)+" ("+Object.keys(P).length+" "+Y.t("word.Options",C)+"):"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:g,onChange:A,children:Object.keys(P).map(W=>h.jsx(ov,{value:W,children:W+(P[W].bifacialityFactor>0?" ("+Y.t("pvModelPanel.Bifacial",C)+")":"")},W))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.PanelSize",C)+":"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{disabled:!0,style:{width:"100%"},value:y,onChange:W=>{},children:wfe.instance.nominalStrings.map(W=>h.jsx(ov,{value:W,children:W},W))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.CellType",C)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{disabled:!0,style:{width:"100%"},value:v.cellType,onChange:W=>{},children:[h.jsx(ov,{value:"Monocrystalline",children:Y.t("pvModelPanel.Monocrystalline",C)},"Monocrystalline"),h.jsx(ov,{value:"Polycrystalline",children:Y.t("pvModelPanel.Polycrystalline",C)},"Polycrystalline"),h.jsx(ov,{value:"Thin Film",children:Y.t("pvModelPanel.ThinFilm",C)},"Thin Film")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.PowerBifaciality",C)+":"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:2,value:v.bifacialityFactor,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("word.Color",C)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{disabled:!0,style:{width:"100%"},value:v.color,onChange:W=>{},children:[h.jsx(ov,{value:"Black",children:Y.t("pvModelPanel.Black",C)},"Black"),h.jsx(ov,{value:"Blue",children:Y.t("pvModelPanel.Blue",C)},"Blue")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.SolarCellEfficiency",C)+" (%):"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:2,value:100*v.efficiency,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.NominalOperatingCellTemperature",C)+" (°C):"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:1,value:v.noct,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.TemperatureCoefficientOfPmax",C)+" (%/°C):"}),h.jsx(Ke,{span:11,children:h.jsx(jl,{disabled:!0,style:{width:"100%"},value:v.pmaxTC,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{border:"2px dashed #ccc",marginTop:"6px",marginLeft:"0",marginRight:"0",paddingLeft:"8px",paddingTop:"8px",paddingBottom:"8px"},children:[h.jsx(Ke,{span:3,children:Y.t("word.ApplyTo",C)+":"}),h.jsx(Ke,{span:21,children:h.jsx(Le.Group,{onChange:H,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})]})},{Option:FHe}=Uo,ipo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(Uge),l=M(En),s=M(vh),c=M(xh),u=M(no),d=M(Qn),f=M(Xi),p=uo(),[g,A]=m.useState((p==null?void 0:p.orientation)??vr.portrait),y=m.useRef(!1),S=m.useRef(),C=$t(),P=(j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&V.id===j&&!V.locked){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B);break}})},v=(j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&V.foundationId===j&&!V.locked){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B)}})},T=(j,B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked){let q;if(B?q=G.parentId===j&&ye.isIdentical(G.normal,B):q=G.parentId===j,q){const $=G;let ie=V.supportedPvModules[$.pvModelName];ie||(ie=V.customPvModules[$.pvModelName]),V.setSolarPanelOrientation($,ie,O)}}})},w=j=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarPanel&&!O.locked){const V=O;let G=B.supportedPvModules[V.pvModelName];G||(G=B.customPvModules[V.pvModelName]),B.setSolarPanelOrientation(V,G,j)}})},x=(j,B)=>{M.getState().set(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked&&j.has(V.id)){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B)}})},b=j=>{c(j.target.value)},R=j=>{if(p){const B=r(p.pvModelName);if(j===vr.portrait){const O=Math.max(1,Math.round(p.lx/B.width)),V=Math.max(1,Math.round(p.ly/B.length));a(p.id,O*B.width,V*B.length)}else{const O=Math.max(1,Math.round(p.lx/B.length)),V=Math.max(1,Math.round(p.ly/B.width));a(p.id,O*B.length,V*B.width)}P(p.id,j)}},H=(j,B)=>{const O=i(j);if(O){if(O.type===z.Cuboid&&!ye.isIdentical(j.normal,as))return!0;const V=JSON.parse(JSON.stringify(j));V.orientation=B;const G=r(V.pvModelName);if(B===vr.portrait){const q=Math.max(1,Math.round(V.lx/G.width)),$=Math.max(1,Math.round(V.ly/G.length));V.lx=q*G.width,V.ly=$*G.length}else{const q=Math.max(1,Math.round(V.lx/G.length)),$=Math.max(1,Math.round(V.ly/G.width));V.lx=q*G.length,V.ly=$*G.width}return O.type===z.Wall?ye.checkElementOnWallState(V,O)===pa.Valid:O.type===z.Roof?ye.checkElementOnRoofState(V,O)===pa.Valid:ye.isSolarCollectorWithinHorizontalSurface(V,O)}return!1},F=(j,B)=>!H(j,B),E=j=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:{for(const B of n)if(B.type===z.SolarPanel&&!B.locked&&M.getState().selectedElementIdSet.has(B.id)&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisType:{for(const B of n)if(B.type===z.SolarPanel&&!B.locked&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const B of n)if(B.type===z.SolarPanel&&B.foundationId===(p==null?void 0:p.foundationId)&&!B.locked&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const B=i(p);if(B){if(B.type===z.Cuboid){for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&ye.isIdentical(V.normal,p.normal)&&!V.locked&&V.orientation!==j)return!0}else for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&!V.locked&&V.orientation!==j)return!0}break}default:{if((p==null?void 0:p.orientation)!==j)return!0;break}}return!1}},N=j=>{if(p&&E(j)){switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(B.id)&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(V.id)&&B.set(V.id,V.orientation);const O={name:"Set Orientation for Selected Solar Panels",timestamp:Date.now(),oldValues:B,newValue:j,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{x(O.oldValues,O.newValue)}};l(O),x(B,j),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&B.set(V.id,V.orientation);const O={name:"Set Orientation for All Solar Panels",timestamp:Date.now(),oldValues:B,newValue:j,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{w(O.newValue)}};l(O),w(j),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&B.foundationId===p.foundationId&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&V.foundationId===p.foundationId&&B.set(V.id,V.orientation);const O={name:"Set Orientation for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:B,newValue:j,groupId:p.foundationId,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{O.groupId&&v(O.groupId,O.newValue)}};l(O),v(p.foundationId,j),d(u+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const B=i(p);if(B){if(y.current=!1,B.type===z.Cuboid){for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&ye.isIdentical(V.normal,p.normal)&&F(V,j)){y.current=!0;break}}else for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&F(V,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const V=new Map,G=B.type===z.Cuboid;if(G)for(const ie of n)ie.type===z.SolarPanel&&ie.parentId===p.parentId&&ye.isIdentical(ie.normal,p.normal)&&V.set(ie.id,ie.orientation);else for(const ie of n)ie.type===z.SolarPanel&&ie.parentId===p.parentId&&V.set(ie.id,ie.orientation);const q=G?p.normal:void 0,$={name:"Set Orientation for All Solar Panels on Surface",timestamp:Date.now(),oldValues:V,newValue:j,groupId:p.parentId,normal:q,undo:()=>{for(const[ie,Q]of $.oldValues.entries())P(ie,Q)},redo:()=>{$.groupId&&T($.groupId,$.normal,$.newValue)}};l($),T(p.parentId,q,j),d(u+1)}}break}default:{const B=o(p.id),O=B?B.orientation:p.orientation;if(y.current=!1,y.current)S.current=j,A(O);else{const V={name:"Set Orientation of Selected Solar Panel",timestamp:Date.now(),oldValue:O,newValue:j,changedElementId:p.id,changedElementType:p.type,undo:()=>{R(V.oldValue)},redo:()=>{R(V.newValue)}};l(V),R(j),d(u+1)}break}}e(B=>{B.actionState.solarPanelOrientation=j})}},U=()=>{p&&(A(p.orientation),y.current=!1,t(!1))},W=()=>{U(),f()},k=()=>{N(g),y.current||(t(!1),d(0))},D=()=>{N(g)},L=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current?" ("+(S.current===vr.portrait?Y.t("solarPanelMenu.Portrait",C):Y.t("solarPanelMenu.Landscape",C))+")":""):"";return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.Orientation",C),rejectedMessage:L,onApply:D,onClose:U,onClickCancel:W,onClickOk:k,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsxs(Uo,{style:{width:"150px"},value:g,onChange:j=>A(j),children:[h.jsx(FHe,{value:vr.portrait,children:Y.t("solarPanelMenu.Portrait",C)},vr.portrait),h.jsx(FHe,{value:vr.landscape,children:Y.t("solarPanelMenu.Landscape",C)},vr.landscape)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:b,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})})},apo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(En),l=M(vh),s=M(xh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),[p,g]=m.useState((f==null?void 0:f.lx)??1),[A,y]=m.useState(0),S=m.useRef(!1),C=m.useRef(),P=$t();m.useEffect(()=>{if(f){const B=r(f.pvModelName)??r("SPR-X21-335-BLK");y(f.orientation===vr.portrait?B.width:B.length)}},[f]);const v=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.id===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.lx=ye.panelizeLx(q,$,O);break}})},T=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.foundationId===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.lx=ye.panelizeLx(q,$,O)}})},w=(B,O,V)=>{e(G=>{for(const q of G.elements)if(q.type===z.SolarPanel&&!q.locked){let $;if(O?$=q.parentId===B&&ye.isIdentical(q.normal,O):$=q.parentId===B,$){const ie=q,Q=G.getPvModule(ie.pvModelName);q.lx=ye.panelizeLx(ie,Q,V)}}})},x=B=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){const G=V,q=O.getPvModule(G.pvModelName);V.lx=ye.panelizeLx(G,q,B)}})},b=(B,O)=>{M.getState().set(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked&&B.has(G.id)){const q=G,$=V.getPvModule(q.pvModelName);G.lx=ye.panelizeLx(q,$,O)}})},R=B=>{s(B.target.value)},H=(B,O)=>{const V=i(B);if(V){if(V.type===z.Cuboid&&!ye.isIdentical(B.normal,as))return!0;const G=JSON.parse(JSON.stringify(B));return G.lx=O,V.type===z.Wall?ye.checkElementOnWallState(G,V)===pa.Valid:V.type===z.Roof?ye.checkElementOnRoofState(G,V)===pa.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,V)}return!1},F=(B,O)=>!H(B,O),E=B=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.lx-B)>Et)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.lx-B)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.lx)-B)>Et)return!0;break}}return!1}},N=B=>{if(f&&E(B))switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const V={name:"Set Length for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{b(V.oldValues,V.newValue)}};a(V),b(O,B),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const V={name:"Set Length for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{x(V.newValue)}};a(V),x(B),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.lx);const V={name:"Set Length for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:B,groupId:f.foundationId,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{V.groupId&&T(V.groupId,V.newValue)}};a(V),T(f.foundationId,B),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(S.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&F(G,B)){S.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&F(G,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const G=new Map,q=O.type===z.Cuboid;if(q)for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&ye.isIdentical(Q.normal,f.normal)&&G.set(Q.id,Q.lx);else for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&G.set(Q.id,Q.lx);const $=q?f.normal:void 0,ie={name:"Set Length for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:B,groupId:f.parentId,normal:$,undo:()=>{for(const[Q,se]of ie.oldValues.entries())v(Q,se)},redo:()=>{ie.groupId&&w(ie.groupId,ie.normal,ie.newValue)}};a(ie),w(f.parentId,$,B),u(c+1)}}break}default:{const O=o(f.id),V=O?O.lx:f.lx;if(S.current=F(f,B),S.current)C.current=B,g(V);else{const G={name:"Set Solar Panel Array Length",timestamp:Date.now(),oldValue:V,newValue:B,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(G.changedElementId,G.oldValue)},redo:()=>{v(G.changedElementId,G.newValue)}};a(G),v(f.id,B),u(c+1)}break}}},U=B=>{let O=B??1;return O=Math.max(1,Math.ceil((O-A/2)/A))*A,O},W=()=>{S.current=!1,t(!1)},k=()=>{W(),d()},D=()=>{N(p),S.current||(t(!1),u(0))},L=()=>{N(p)},j=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",P),rejectedMessage:j,onApply:L,onClose:W,onClickCancel:k,onClickOk:D,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:A,max:100*A,step:A,style:{width:120},precision:2,value:p,onChange:B=>{B!==null&&g(U(B))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/A)+" "+Y.t("solarPanelMenu.PanelsWide",P),h.jsx("br",{}),Y.t("word.MaximumNumber",P),": 100 ",Y.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},lpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(En),l=M(vh),s=M(xh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),[p,g]=m.useState((f==null?void 0:f.ly)??2),[A,y]=m.useState(0),S=m.useRef(!1),C=m.useRef(),P=$t();m.useEffect(()=>{if(f){const B=r(f.pvModelName)??r("SPR-X21-335-BLK");y(f.orientation===vr.portrait?B.length:B.width),g(f.ly)}},[f]);const v=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.id===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.ly=ye.panelizeLy(q,$,O);break}})},T=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.foundationId===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.ly=ye.panelizeLy(q,$,O)}})},w=(B,O,V)=>{e(G=>{for(const q of G.elements)if(q.type===z.SolarPanel&&!q.locked){let $;if(O?$=q.parentId===B&&ye.isIdentical(q.normal,O):$=q.parentId===B,$){const ie=q,Q=G.getPvModule(ie.pvModelName);q.ly=ye.panelizeLy(ie,Q,V)}}})},x=B=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){const G=V,q=O.getPvModule(G.pvModelName);V.ly=ye.panelizeLy(G,q,B)}})},b=(B,O)=>{M.getState().set(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked&&B.has(G.id)){const q=G,$=V.getPvModule(q.pvModelName);G.ly=ye.panelizeLy(q,$,O)}})},R=B=>{s(B.target.value)},H=(B,O)=>{const V=i(B);if(V){if(V.type===z.Cuboid&&!ye.isIdentical(B.normal,as))return!0;const G=JSON.parse(JSON.stringify(B));return G.ly=O,V.type===z.Wall?ye.checkElementOnWallState(G,V)===pa.Valid:V.type===z.Roof?ye.checkElementOnRoofState(G,V)===pa.Valid:ye.isSolarCollectorWithinHorizontalSurface(G,V)}return!1},F=(B,O)=>B.tiltAngle!==0&&.5*O*Math.abs(Math.sin(B.tiltAngle))>B.poleHeight||!H(B,O),E=B=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.ly-B)>Et)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.ly-B)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.ly)-B)>Et)return!0;break}}return!1}},N=B=>{if(f&&E(B))switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.ly);const V={name:"Set Width for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{b(V.oldValues,V.newValue)}};a(V),b(O,B),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&O.set(G.id,G.ly);const V={name:"Set Width for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{x(V.newValue)}};a(V),x(B),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.ly);const V={name:"Set Width for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:B,groupId:f.foundationId,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{V.groupId&&T(V.groupId,V.newValue)}};a(V),T(f.foundationId,B),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(S.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&ye.isIdentical(G.normal,f.normal)&&F(G,B)){S.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&F(G,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const G=new Map,q=O.type===z.Cuboid;if(q)for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&ye.isIdentical(Q.normal,f.normal)&&G.set(Q.id,Q.ly);else for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&G.set(Q.id,Q.ly);const $=q?f.normal:void 0,ie={name:"Set Width for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:B,groupId:f.parentId,normal:$,undo:()=>{for(const[Q,se]of ie.oldValues.entries())v(Q,se)},redo:()=>{ie.groupId&&w(ie.groupId,ie.normal,ie.newValue)}};a(ie),w(f.parentId,$,B),u(c+1)}}break}default:{const O=o(f.id),V=O?O.ly:f.ly;if(S.current=F(f,B),S.current)C.current=B,g(V);else{const G={name:"Set Solar Panel Array Width",timestamp:Date.now(),oldValue:V,newValue:B,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(G.changedElementId,G.oldValue)},redo:()=>{v(G.changedElementId,G.newValue)}};a(G),v(f.id,B),u(c+1)}break}}},U=()=>{S.current=!1,t(!1)},W=()=>{U(),d()},k=()=>{N(p),S.current||(t(!1),u(0))},D=B=>{let O=B??1;return O=Math.max(1,Math.ceil((O-A/2)/A))*A,O},L=()=>{N(p)},j=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",P),rejectedMessage:j,onApply:L,onClose:U,onClickCancel:W,onClickOk:k,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:A,max:100*A,step:A,style:{width:120},precision:2,value:p,onChange:B=>{B!==null&&g(D(B))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/A)+" "+Y.t("solarPanelMenu.PanelsLong",P),h.jsx("br",{}),Y.t("word.MaximumNumber",P),": 100 ",Y.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:R,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},spo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(vh),l=M(xh),s=M(no),c=M(Qn),u=M(b=>b.elements.find(R=>R.selected&&R.type===z.SolarPanel)),[d,f]=m.useState((u==null?void 0:u.inverterEfficiency)??.95),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){F.inverterEfficiency=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&F.foundationId===b&&!F.locked&&(F.inverterEfficiency=R)})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;R?N=E.parentId===b&&ye.isIdentical(E.normal,R):N=E.parentId===b,N&&(E.inverterEfficiency=H)}})},S=b=>{e(R=>{for(const H of R.elements)H.type===z.SolarPanel&&!H.locked&&(H.inverterEfficiency=b)})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&b.has(F.id)&&(F.inverterEfficiency=R)})},P=b=>{l(b.target.value)},v=b=>{switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&ye.isIdentical(F.normal,u.normal)&&!F.locked&&Math.abs((F.inverterEfficiency??.95)-b)>Et)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&Math.abs((F.inverterEfficiency??.95)-b)>Et)return!0}break}default:{if(Math.abs(((u==null?void 0:u.inverterEfficiency)??.95)-b)>Et)return!0;break}}return!1},T=b=>{if(u&&v(b))switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&H.set(U.id,U.inverterEfficiency??.95);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.inverterEfficiency??.95);const E=F?u.normal:void 0,N={name:"Set Inverter Efficiency for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.inverterEfficiency??.95:u.inverterEfficiency??.95,F={name:"Set Solar Panel Array Inverter Efficiency",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}},w=()=>{t(!1)},x=()=>{T(d)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.InverterEfficiency",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.5,max:1,step:.01,style:{width:120},precision:2,value:d,onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[0.5, 1.0]",h.jsx("br",{}),Y.t("solarPanelMenu.InverterEfficiencyExplained",p)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},cpo=({setDialogVisible:t})=>{const e=M(pn),n=M(m0),o=M(Kn),r=M(Jn),i=M(Gr),a=M(En),l=M(vh),s=M(xh),c=M(no),u=M(Qn),d=M(Xi),f=M(L=>L.elements.find(j=>j.selected&&j.type===z.SolarPanel)),[p,g]=m.useState(!1),[A,y]=m.useState(!1),[S,C]=m.useState({left:0,top:0,bottom:0,right:0}),P=m.useRef(null),v=m.useRef((f==null?void 0:f.dcToAcRatio)??1),T={lng:n};m.useEffect(()=>{f&&(v.current=f.dcToAcRatio??1)},[f.dcToAcRatio]);const w=(L,j)=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarPanel&&O.id===L&&!O.locked){O.dcToAcRatio=j;break}})},x=(L,j)=>{e(B=>{for(const O of B.elements)O.type===z.SolarPanel&&O.foundationId===L&&!O.locked&&(O.dcToAcRatio=j)})},b=(L,j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){let G;j?G=V.parentId===L&&ye.isIdentical(V.normal,j):G=V.parentId===L,G&&(V.dcToAcRatio=B)}})},R=L=>{e(j=>{for(const B of j.elements)B.type===z.SolarPanel&&!B.locked&&(B.dcToAcRatio=L)})},H=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.SolarPanel&&!O.locked&&L.has(O.id)&&(O.dcToAcRatio=j)})},F=L=>{s(L.target.value),g(!p)},E=L=>{switch(l){case re.AllSelectedObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const j of o)if(j.type===z.SolarPanel&&j.foundationId===(f==null?void 0:f.foundationId)&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){if(j.type===z.Cuboid){for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&ye.isIdentical(O.normal,f.normal)&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Et)return!0}else for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Et)return!0}break}default:{if(Math.abs(((f==null?void 0:f.dcToAcRatio)??1)-L)>Et)return!0;break}}return!1},N=L=>{if(f&&E(L)){switch(l){case re.AllSelectedObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{H(B.oldValues,B.newValue)}};a(B),H(j,L),u(c+1);break}case re.AllObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for All Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{R(B.newValue)}};a(B),R(L),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const j=new Map;for(const O of o)O.type===z.SolarPanel&&O.foundationId===f.foundationId&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:f.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{B.groupId&&x(B.groupId,B.newValue)}};a(B),x(f.foundationId,L),u(c+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){const B=new Map,O=j.type===z.Cuboid;if(O)for(const q of o)q.type===z.SolarPanel&&q.parentId===f.parentId&&ye.isIdentical(q.normal,f.normal)&&B.set(q.id,q.dcToAcRatio??1);else for(const q of o)q.type===z.SolarPanel&&q.parentId===f.parentId&&B.set(q.id,q.dcToAcRatio??1);const V=O?f.normal:void 0,G={name:"Set DC-AC Ratio for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:B,newValue:L,groupId:f.parentId,normal:V,undo:()=>{for(const[q,$]of G.oldValues.entries())w(q,$)},redo:()=>{G.groupId&&b(G.groupId,G.normal,G.newValue)}};a(G),b(f.parentId,V,L),u(c+1)}break}default:{const j=r(f.id),B=j?j.dcToAcRatio??1:f.dcToAcRatio??1,O={name:"Set Solar Panel Array DC-AC Ratio",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:f.id,changedElementType:f.type,undo:()=>{w(O.changedElementId,O.oldValue)},redo:()=>{w(O.changedElementId,O.newValue)}};a(O),w(f.id,L),u(c+1);break}}g(!p)}},U=(L,j)=>{if(P.current){const{clientWidth:B,clientHeight:O}=window.document.documentElement,V=P.current.getBoundingClientRect();C({left:-V.left+j.x,right:B-(V.right-j.x),top:-V.top+j.y,bottom:O-((V==null?void 0:V.bottom)-j.y)})}},W=()=>{v.current=f.dcToAcRatio??1,t(!1)},k=()=>{W(),d()},D=()=>{N(v.current),t(!1),u(0)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>y(!0),onMouseOut:()=>y(!1),children:Y.t("solarPanelMenu.DcToAcSizeRatio",T)}),footer:[h.jsx(io,{onClick:()=>{N(v.current)},children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:k,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:D,children:Y.t("word.OK",T)},"OK")],onCancel:W,maskClosable:!1,destroyOnClose:!1,modalRender:L=>h.jsx(Bi,{disabled:!A,bounds:S,onStart:(j,B)=>U(j,B),children:h.jsx("div",{ref:P,children:L})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:2,step:.01,style:{width:120},precision:2,value:v.current,onChange:L=>{L!==null&&(v.current=L,g(!p))},onPressEnter:D}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[1.0, 2.0]",h.jsx("br",{}),Y.t("solarPanelMenu.DcToAcSizeRatioExplained",T)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:F,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",T)})]})})})]})})})},kHe=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(l7t),i=M(Gr),a=M(En),l=M(vh),s=M(xh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),p=(f==null?void 0:f.tiltAngle)??0,g=(f==null?void 0:f.parentType)===z.Wall,[A,y]=m.useState(g?-p:p),S=m.useRef(!1),C=m.useRef(),P=$t(),v=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&B.foundationId===k&&!B.locked){const O=B;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-D:D):O.tiltAngle=D}})},T=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&!B.locked){let O;if(D?O=B.parentId===k&&ye.isIdentical(B.normal,D):O=B.parentId===k,O){const V=B;V.tiltAngle=L}}})},w=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked){const B=j;B.parentType===z.Wall?B.tiltAngle=Math.min(0,D?-k:k):B.tiltAngle=k}})},x=(k,D,L)=>{M.getState().set(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&!B.locked&&k.has(B.id)){const O=B;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-D:D):O.tiltAngle=D}})},b=k=>{s(k.target.value)},R=k=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===(f==null?void 0:f.foundationId)&&!D.locked&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=i(f);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&!j.locked&&Math.abs(j.tiltAngle-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&!j.locked&&Math.abs(j.tiltAngle-k)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.tiltAngle)-k)>Et)return!0;break}}return!1}},H=k=>{if(g&&(k=-k),!!f&&R(k)){switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{x(L.oldValues,L.newValue,!g)}};a(L),x(D,k,!g),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{w(L.newValue,!g)}};a(L),w(k,!g),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===f.foundationId&&D.parentType!==z.Wall&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===f.foundationId&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:f.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{L.groupId&&v(L.groupId,L.newValue,!g)}};a(L),v(f.foundationId,k,!g),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=i(f);if(D){S.current=!1;const L=D.type===z.Cuboid;if(L){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&ye.isIdentical(j.normal,f.normal)&&.5*j.ly*Math.abs(Math.sin(k))>j.poleHeight){S.current=!0;break}}else if(f.parentType===z.Wall)S.current=!1;else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&.5*j.ly*Math.abs(Math.sin(k))>j.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const j=new Map;if(L)for(const V of n)V.type===z.SolarPanel&&V.parentId===f.parentId&&ye.isIdentical(V.normal,f.normal)&&j.set(V.id,V.tiltAngle);else for(const V of n)V.type===z.SolarPanel&&V.parentId===f.parentId&&j.set(V.id,V.tiltAngle);const B=L?f.normal:void 0,O={name:"Set Tilt Angle for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:f.parentId,normal:B,undo:()=>{for(const[V,G]of O.oldValues.entries())r(V,G)},redo:()=>{O.groupId&&T(O.groupId,O.normal,O.newValue)}};a(O),T(f.parentId,B,k),u(c+1)}}break}default:{const D=o(f.id),L=D?D.tiltAngle:f.tiltAngle;if(S.current=.5*f.ly*Math.abs(Math.sin(k))>f.poleHeight,f.parentType===z.Wall&&(S.current=!1),S.current)C.current=k,y(L);else{const j={name:"Set Solar Panel Array Tilt Angle",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(j.changedElementId,j.oldValue)},redo:()=>{r(j.changedElementId,j.newValue)}};a(j),r(f.id,k),u(c+1)}break}}e(D=>{D.actionState.solarPanelTiltAngle=k})}},F=()=>{S.current=!1,t(!1)},E=()=>{F(),d()},N=()=>{H(A),S.current||(t(!1),u(0))},U=()=>{H(A)},W=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+ye.toDegrees(C.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.TiltAngle",P),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:g?0:-90,max:90,style:{width:120},precision:2,value:parseFloat(ye.toDegrees(A).toFixed(2)),step:1,formatter:k=>`${k}°`,onChange:k=>{k!==null&&y(ye.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [",g?"0°":"-90°",", 90°]",h.jsx("br",{}),Y.t("solarPanelMenu.SouthFacingIsPositive",P)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:b,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},upo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Qq),i=M(yYe),a=M(AYe),l=M(wYe),s=M(Gr),c=M(En),u=M(vh),d=M(xh),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarPanel),y=m.useRef(!1),S=m.useRef(),[C,P]=m.useState(A?-A.relativeAzimuth:0),v=$t(),T=k=>{d(k.target.value)},w=(k,D)=>{const L=s(k);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.relativeAzimuth=-D,L.type===z.Roof?ye.checkElementOnRoofState(j,L)===pa.Valid:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},x=(k,D)=>!w(k,D),b=k=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&D.parentType!==z.Wall&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===(A==null?void 0:A.foundationId)&&!D.locked&&D.parentType!==z.Wall&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:if(A!=null&&A.parentId){const D=s(A);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&ye.isIdentical(j.normal,A.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}}break;default:if(Math.abs(-(A==null?void 0:A.relativeAzimuth)-k)>Et)return!0}return!1}},R=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked&&k.has(j.id)){const B=j;B.relativeAzimuth=D}})},H=k=>{if(A&&b(k)){switch(S.current=void 0,u){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(D,-k),p(f+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{l(z.SolarPanel,-L.newValue)}};c(L),l(z.SolarPanel,-k),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===A.foundationId&&D.parentType!==z.Wall&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===A.foundationId&&j.parentType!==z.Wall&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:A.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{L.groupId&&a(z.SolarPanel,L.groupId,-L.newValue)}};c(L),a(z.SolarPanel,A.foundationId,-k),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{if(A.parentId){const D=s(A);if(D){if(y.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&ye.isIdentical(j.normal,A.normal)&&x(j,k)){y.current=!0;break}}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&x(j,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarPanel&&G.parentId===A.parentId&&ye.isIdentical(G.normal,A.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarPanel&&G.parentId===A.parentId&&j.set(G.id,-G.relativeAzimuth);const O=B?A.normal:void 0,V={name:"Set Relative Azimuth for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:A.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())r(G,-q)},redo:()=>{V.groupId&&i(z.SolarPanel,V.groupId,V.normal,-V.newValue)}};c(V),i(z.SolarPanel,A.parentId,O,-k),p(f+1)}}}break}default:{const D=o(A.id),L=D?-D.relativeAzimuth:-A.relativeAzimuth;if(y.current=x(A,k),y.current)S.current=k,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(A.id,-k),p(f+1)}break}}e(D=>{D.actionState.solarPanelRelativeAzimuth=-k})}},F=()=>{y.current=!1,t(!1)},E=()=>{F(),g()},N=()=>{H(C),y.current||(t(!1),p(0))},U=()=>{H(C)},W=y.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+ye.toDegrees(S.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeAzimuth",v),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:k=>`${k}°`,onChange:k=>{k!==null&&P(ye.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",v),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",v)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",v)})]})})})]})})},dpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(vh),l=M(xh),s=M(no),c=M(Qn),u=uo(),[d,f]=m.useState((u==null?void 0:u.trackerType)??Ll.NO_TRACKER),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&E.id===R&&!E.locked){E.trackerType=H;break}})},y=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.SolarPanel&&E.foundationId===R&&!E.locked&&(E.trackerType=H)})},S=(R,H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.SolarPanel&&!N.locked){let U;H?U=N.parentId===R&&ye.isIdentical(N.normal,H):U=N.parentId===R,U&&(N.trackerType=F)}})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&(F.trackerType=R)})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.SolarPanel&&!E.locked&&R.has(E.id)&&(E.trackerType=H)})},v=R=>{l(R.target.value)},T=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const H of n)if(H.type===z.SolarPanel&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisType:{for(const H of n)if(H.type===z.SolarPanel&&!H.locked&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of n)if(H.type===z.SolarPanel&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const H=r(u);if(H){if(H.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===u.parentId&&ye.isIdentical(E.normal,u.normal)&&!E.locked&&E.trackerType!==R)return!0}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===u.parentId&&!E.locked&&E.trackerType!==R)return!0}break}default:{if((u==null?void 0:u.trackerType)!==R)return!0;break}}return!1}},w=R=>{if(u&&T(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};i(F),P(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.SolarPanel&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for All Solar Panel Arrays",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.SolarPanel&&E.foundationId===u.foundationId&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&y(F.groupId,F.newValue)}};i(F),y(u.foundationId,R),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const H=r(u);if(H){const F=new Map,E=H.type===z.Cuboid;if(E)for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&ye.isIdentical(W.normal,u.normal)&&F.set(W.id,W.trackerType);else for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&F.set(W.id,W.trackerType);const N=E?u.normal:void 0,U={name:"Set Tracker Type for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:N,undo:()=>{for(const[W,k]of U.oldValues.entries())A(W,k)},redo:()=>{U.groupId&&S(U.groupId,U.normal,U.newValue)}};i(U),S(u.parentId,N,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.trackerType:u.trackerType,E={name:"Set Solar Panel Array Tracker Type",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.Tracker",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsxs(Uo,{style:{width:"120px"},value:d,onChange:R=>f(R),children:[h.jsx(g,{value:Ll.NO_TRACKER,title:Y.t("solarPanelMenu.NoTracker",p),children:Y.t("word.None",p)},"NONE"),h.jsx(g,{value:Ll.HORIZONTAL_SINGLE_AXIS_TRACKER,title:Y.t("solarPanelMenu.HorizontalSingleAxisTracker",p),children:"HSAT"},"HSAT"),h.jsx(g,{value:Ll.VERTICAL_SINGLE_AXIS_TRACKER,title:Y.t("solarPanelMenu.VerticalSingleAxisTracker",p),children:"VSAT"},"VSAT"),h.jsx(g,{value:Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER,title:Y.t("solarPanelMenu.AltazimuthDualAxisTracker",p),children:"AADAT"},"AADAT")]}),h.jsx("div",{style:{paddingTop:"20px",paddingRight:"10px",textAlign:"left",fontSize:"11px"},children:Y.t("solarPanelMenu.SolarTrackerFollowsSun",p)})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},fpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(vh),l=M(xh),s=M(no),c=M(Qn),u=uo(z.SolarPanel),[d,f]=m.useState((u==null?void 0:u.frameColor)??"white"),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){F.frameColor=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&F.foundationId===b&&!F.locked&&(F.frameColor=R)})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;R?N=E.parentId===b&&ye.isIdentical(E.normal,R):N=E.parentId===b,N&&(E.frameColor=H)}})},S=b=>{e(R=>{for(const H of R.elements)H.type===z.SolarPanel&&!H.locked&&(H.frameColor=b)})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&b.has(F.id)&&(F.frameColor=R)})},P=b=>{l(b.target.value)},v=b=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&ye.isIdentical(F.normal,u.normal)&&!F.locked&&F.frameColor!==b)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&F.frameColor!==b)return!0}break}default:{if((u==null?void 0:u.frameColor)!==b)return!0;break}}return!1}},T=b=>{if(u&&v(b)){switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for Selected Solar Panels",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for All Solar Panels",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&H.set(U.id,U.frameColor??"white");else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.frameColor??"white");const E=F?u.normal:void 0,N={name:"Set Frame Color for All Solar Panels on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.frameColor:u.frameColor,F={name:"Set Frame Color of Selected Solar Panel",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(u.id,F.oldValue)},redo:()=>{g(u.id,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}e(R=>{R.actionState.solarPanelFrameColor=b})}},w=()=>{t(!1)},x=()=>{T(d)};return h.jsx(so,{width:680,title:Y.t("solarPanelMenu.FrameColor",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsx(Ld,{color:d??(u==null?void 0:u.color)??"white",onChangeComplete:b=>{f(b.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},hpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(p7t),a=M(PW),l=M(CW),s=M(Gr),c=M(En),u=M(vh),d=M(xh),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarPanel),[y,S]=m.useState((A==null?void 0:A.poleHeight)??0),C=m.useRef(!1),P=m.useRef(),v=$t(),T=U=>{d(U.target.value)},w=U=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(A==null?void 0:A.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const W=s(A);if(W){if(W.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&ye.isIdentical(D.normal,A.normal)&&!D.locked&&Math.abs(D.poleHeight-U)>Et)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&!D.locked&&Math.abs(D.poleHeight-U)>Et)return!0}break}default:{if(Math.abs((A==null?void 0:A.poleHeight)-U)>Et)return!0;break}}return!1}},x=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.poleHeight=W}})},b=U=>{if(A&&w(U)){switch(P.current=void 0,u){case re.AllSelectedObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(D.id)&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{x(k.oldValues,k.newValue)}};c(k),x(W,U),p(f+1)}break}case re.AllObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{l(z.SolarPanel,k.newValue)}};c(k),l(z.SolarPanel,U),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===A.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===A.foundationId&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:A.foundationId,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{k.groupId&&a(z.SolarPanel,k.groupId,k.newValue)}};c(k),a(z.SolarPanel,A.foundationId,U),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const W=s(A);if(W){if(C.current=!1,W.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&ye.isIdentical(D.normal,A.normal)&&.5*D.ly*Math.abs(Math.sin(D.tiltAngle))>U){C.current=!0;break}}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&.5*D.ly*Math.abs(Math.sin(D.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const D=new Map,L=W.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===A.parentId&&ye.isIdentical(O.normal,A.normal)&&D.set(O.id,O.poleHeight);else for(const O of n)O.type===z.SolarPanel&&O.parentId===A.parentId&&D.set(O.id,O.poleHeight);const j=L?A.normal:void 0,B={name:"Set Pole Height for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:D,newValue:U,groupId:A.parentId,normal:j,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V)},redo:()=>{B.groupId&&i(z.SolarPanel,B.groupId,B.normal,B.newValue)}};c(B),i(z.SolarPanel,A.parentId,j,U),p(f+1)}}break}default:{const W=o(A.id),k=W?W.poleHeight:A.poleHeight;if(C.current=.5*A.ly*Math.abs(Math.sin(A.tiltAngle))>U,C.current)P.current=U,S(k);else{const D={name:"Set Solar Panel Array Pole Height",timestamp:Date.now(),oldValue:k,newValue:U,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};c(D),r(A.id,U),p(f+1)}break}}e(W=>{W.actionState.solarPanelPoleHeight=U})}},R=()=>{C.current=!1,t(!1)},H=()=>{R(),g()},F=()=>{b(y),C.current||(t(!1),p(0))},E=()=>{b(y)},N=C.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(P.current!==void 0?" ("+P.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.PoleHeight",v),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:10,style:{width:120},step:.1,precision:2,value:y,onChange:U=>{U!==null&&S(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [0, 10] ",Y.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",v)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",v)})]})})})]})})},ppo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(vh),l=M(xh),s=M(no),c=M(Qn),u=uo(z.SolarPanel),[d,f]=m.useState((u==null?void 0:u.poleSpacing)??0),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){const E=F;E.poleSpacing=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.foundationId===b&&!F.locked){const E=F;E.poleSpacing=R}})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;if(R?N=E.parentId===b&&ye.isIdentical(E.normal,R):N=E.parentId===b,N){const U=E;U.poleSpacing=H}}})},S=b=>{e(R=>{for(const H of R.elements)if(H.type===z.SolarPanel&&!H.locked){const F=H;F.poleSpacing=b}})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&!F.locked&&b.has(F.id)){const E=F;E.poleSpacing=R}})},P=b=>{l(b.target.value)},v=b=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&ye.isIdentical(F.normal,u.normal)&&!F.locked&&Math.abs(F.poleSpacing-b)>Et)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&Math.abs(F.poleSpacing-b)>Et)return!0}break}default:{if(Math.abs((u==null?void 0:u.poleSpacing)-b)>Et)return!0;break}}return!1}},T=b=>{if(u&&v(b)){switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&ye.isIdentical(U.normal,u.normal)&&H.set(U.id,U.poleSpacing);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.poleSpacing);const E=F?u.normal:void 0,N={name:"Set Pole Spacing for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.poleSpacing:u.poleSpacing,F={name:"Set Solar Panel Array Pole Spacing",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}e(R=>{R.actionState.solarPanelPoleSpacing=b})}},w=()=>{t(!1)},x=()=>{T(d),t(!1),c(0)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.PoleSpacing",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:1,style:{width:120},precision:2,value:d,onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [1, 10] ",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},gpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(s7t),a=M(c7t),l=M(u7t),s=M(En),c=M(vh),u=M(xh),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.SolarPanel),[A,y]=m.useState((g==null?void 0:g.cx)??0),S=m.useRef(!1),C=m.useRef(),P=$t(),v=U=>{u(U.target.value)},T=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cx-U)>Et)return!0;break;case re.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cx-U)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.cx-U)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.cx)-U)>Et)return!0}return!1}},w=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.cx=W}})},x=(U,W,k)=>U+.5*W/k<.5&&U-.5*W/k>-.5,b=U=>{if(!g||!T(U))return;C.current=void 0;const W=o(g);if(W){switch(c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(k.id)&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.cx);const D={name:"Set Center X for Selected Solar Panel",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{w(D.oldValues,D.newValue)}};s(D),w(k,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.cx);const D={name:"Set Center X for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,D.newValue)}};s(D),l(z.SolarPanel,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===g.foundationId&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===g.foundationId&&k.set(L.id,L.cx);const D={name:"Set Center X for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:U,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{D.groupId&&a(z.SolarPanel,D.groupId,D.newValue)}};s(D),a(z.SolarPanel,g.foundationId,U),f(d+1)}}break}default:{const k=r(g.id),D=k?k.cx:g.cx;if(S.current=!x(U,g.lx,W.lx),S.current)C.current=U,y(D);else{const L={name:"Set Solar Panel Center X",timestamp:Date.now(),oldValue:D,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(g.id,U),f(d+1)}break}}e(k=>{k.actionState.solarPanelCx=U})}},R=()=>{S.current=!1,t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)},N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeXCoordinateOfCenter",P),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},mpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(d7t),a=M(f7t),l=M(h7t),s=M(En),c=M(vh),u=M(xh),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.SolarPanel),[A,y]=m.useState((g==null?void 0:g.cy)??0),S=m.useRef(!1),C=m.useRef(),P=$t(),v=U=>{u(U.target.value)},T=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cy-U)>Et)return!0;break;case re.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cy-U)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.cy-U)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.cy)-U)>Et)return!0}return!1}},w=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.cy=W}})},x=(U,W,k)=>U+.5*W/k<.5&&U-.5*W/k>-.5,b=U=>{if(!g||!T(U))return;C.current=void 0;const W=o(g);if(W){switch(c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(k.id)&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.cy);const D={name:"Set Center Y for Selected Solar Panel",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{w(D.oldValues,D.newValue)}};s(D),w(k,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.cy);const D={name:"Set Center Y for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,D.newValue)}};s(D),l(z.SolarPanel,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===g.foundationId&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===g.foundationId&&k.set(L.id,L.cy);const D={name:"Set Center Y for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:U,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{D.groupId&&a(z.SolarPanel,D.groupId,D.newValue)}};s(D),a(z.SolarPanel,g.foundationId,U),f(d+1)}}break}default:{const k=r(g.id),D=k?k.cy:g.cy;if(S.current=!x(U,g.ly,W.ly),S.current)C.current=U,y(D);else{const L={name:"Set Solar Panel Center Y",timestamp:Date.now(),oldValue:D,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(g.id,U),f(d+1)}break}}e(k=>{k.actionState.solarPanelCy=U})}},R=()=>{S.current=!1,t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)},N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeYCoordinateOfCenter",P),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},ypo=t=>{const e=[];if(t.type!==z.SolarPanel)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=t.type===z.SolarPanel&&ye.isIdentical(n.normal,as);return e.push({key:"solar-panel-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"solar-panel-cut",label:h.jsx(kd,{})}),e.push({key:"solar-panel-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"solar-panel-model-change",label:h.jsxs(eo,{Dialog:rpo,children:[Y.t("solarPanelMenu.ChangePvModel",r)," (",n.pvModelName,") ..."]})},{key:"solar-panel-orientation",label:h.jsxs(eo,{Dialog:ipo,children:[Y.t("solarPanelMenu.Orientation",r)," ..."]})},{key:"solar-panel-length",label:h.jsxs(eo,{Dialog:apo,children:[Y.t("word.Length",r)," ..."]})},{key:"solar-panel-width",label:h.jsxs(eo,{Dialog:lpo,children:[Y.t("word.Width",r)," ..."]})}),e.push({key:"solar-panel-coordinates-submenu",label:h.jsx(an,{children:Y.t("solarCollectorMenu.Coordinates",r)}),children:[{key:"solar-panel-center-x",label:h.jsxs(eo,{Dialog:gpo,children:[Y.t("solarCollectorMenu.RelativeXCoordinateOfCenter",r)," ..."]})},{key:"solar-panel-center-y",label:h.jsxs(eo,{Dialog:mpo,children:[Y.t("solarCollectorMenu.RelativeYCoordinateOfCenter",r)," ..."]})}]}),n.parentType===z.Wall&&e.push({key:"solar-panel-tilt-angle-on-wall",label:h.jsxs(eo,{Dialog:kHe,children:[Y.t("solarPanelMenu.TiltAngle",r)," ..."]})}),i&&(n.trackerType===Ll.NO_TRACKER&&e.push({key:"solar-panel-tilt-angle",label:h.jsxs(eo,{Dialog:kHe,children:[Y.t("solarPanelMenu.TiltAngle",r)," ..."]})}),e.push({key:"solar-panel-relative-azimuth",label:h.jsxs(eo,{Dialog:upo,children:[Y.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),n.parentType!==z.Roof&&e.push({key:"solar-panel-tracker",label:h.jsxs(eo,{Dialog:dpo,children:[Y.t("solarPanelMenu.Tracker",r)," ..."]})})),e.push({key:"solar-panel-frame-color",label:h.jsxs(eo,{Dialog:fpo,children:[Y.t("solarPanelMenu.FrameColor",r)," ..."]})}),e.push({key:"solar-panel-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})}),e.push({key:"solar-panel-electrical-submenu",label:h.jsx(an,{children:Y.t("solarPanelMenu.ElectricalProperties",r)}),children:[{key:"solar-panel-inverter-efficiency",label:h.jsxs(eo,{Dialog:spo,children:[Y.t("solarPanelMenu.InverterEfficiency",r)," ..."]})},{key:"solar-panel-dc-ac-ratio",label:h.jsxs(eo,{Dialog:cpo,children:[Y.t("solarPanelMenu.DcToAcSizeRatio",r)," ..."]})}]}),e.push({key:"solar-panel-pole-submenu",label:h.jsx(an,{children:Y.t("solarCollectorMenu.Pole",r)}),children:[{key:"solar-panel-pole-height",label:h.jsxs(eo,{noPadding:!0,Dialog:hpo,children:[Y.t("solarCollectorMenu.PoleHeight",r)," ..."]})},{key:"solar-panel-pole-spacing",label:h.jsxs(eo,{noPadding:!0,Dialog:ppo,children:[Y.t("solarPanelMenu.PoleSpacing",r)," ..."]})}]}),e.push({key:"solar-panel-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},Apo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Fw),r=M($q),i=M(xW),a=M(Gr),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=M(Xi),p=uo(z.ParabolicTrough),[g,A]=m.useState((p==null?void 0:p.ly)??9),y=m.useRef(!1),S=m.useRef(),C=$t(),P=W=>{c(W.target.value)},v=(W,k)=>{const D=a(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},T=(W,k)=>!v(W,k),w=W=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:for(const k of e)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of e)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of e)if(k.type===z.ParabolicTrough&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Et)return!0}return!1}},x=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.ly=k)})},b=W=>{if(p&&w(W))switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{x(D.oldValues,D.newValue)}};l(D),x(k,W),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&k.set(L.id,L.ly);const D={name:"Set Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{i(z.ParabolicTrough,D.newValue)}};l(D),i(z.ParabolicTrough,W),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&k.foundationId===p.foundationId&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&L.foundationId===p.foundationId&&k.set(L.id,L.ly);const D={name:"Set Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{D.groupId&&r(z.ParabolicTrough,D.groupId,D.newValue)}};l(D),r(z.ParabolicTrough,p.foundationId,W),d(u+1)}}break}default:{const k=n(p.id),D=k?k.ly:p.ly;if(y.current=T(p,W),y.current)S.current=W,A(D);else{const L={name:"Set Parabolic Trough Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{y.current=!1,t(!1)},H=()=>{R(),f()},F=()=>{b(g),y.current||(t(!1),d(0))},E=W=>{if(!p)return 1;let k=W??1;return k=Math.max(1,Math.ceil((k-p.moduleLength/2)/p.moduleLength))*p.moduleLength,k},N=()=>{b(g)};if((p==null?void 0:p.type)!==z.ParabolicTrough)return null;const U=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:p.moduleLength,max:100*p.moduleLength,step:p.moduleLength,precision:2,style:{width:120},value:g,onChange:W=>{A(E(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("parabolicTroughMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+Y.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(g/p.moduleLength)+" "+Y.t("parabolicTroughMenu.ModulesLong",C),h.jsx("br",{}),Y.t("word.Maximum",C),": 100 ",Y.t("parabolicTroughMenu.Modules",C)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",C)})]})})})]})})},wpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Width for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.lx);const D={name:"Set Width for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Width for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},vpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(NYe),i=M(UYe),a=M(jYe),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.moduleLength)??3),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.moduleLength)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.moduleLength=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.moduleLength:g.moduleLength;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Module Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughModuleLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},xpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(kYe),i=M(LYe),a=M(WYe),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.latusRectum)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.latusRectum)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.latusRectum=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.latusRectum:g.latusRectum;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Latus Rectum",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughLatusRectum=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},bpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.ParabolicTrough&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.ParabolicTrough&&!k.locked&&N.has(k.id)&&(k.tiltAngle=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.ParabolicTrough,W.newValue)}};s(W),a(z.ParabolicTrough,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===g.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.ParabolicTrough,W.groupId,W.newValue)}};s(W),i(z.ParabolicTrough,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Parabolic Trough Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicTroughPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},Spo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Parabolic Trough Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Tpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(SYe),i=M(TYe),a=M(PYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.absorptance)??.95),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.absorptance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.absorptance:f.absorptance,R={name:"Set Parabolic Trough Absorptance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughAbsorptance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Ppo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(CYe),i=M(RYe),a=M(HYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.opticalEfficiency)??.7),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.opticalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Trough Optical Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughOpticalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Cpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(MYe),i=M(IYe),a=M(zYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.thermalEfficiency)??.3),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.thermalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Trough Thermal Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughThermalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Rpo=t=>{const e=[];if(t.type!==z.ParabolicTrough)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"parabolic-trough-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"parabolic-trough-cut",label:h.jsx(kd,{})}),e.push({key:"parabolic-trough-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"parabolic-trough-length",label:h.jsxs(eo,{Dialog:Apo,children:[Y.t("word.Length",o)," ..."]})},{key:"parabolic-trough-width",label:h.jsxs(eo,{Dialog:wpo,children:[Y.t("word.Width",o)," ..."]})},{key:"parabolic-trough-module-length",label:h.jsxs(eo,{Dialog:vpo,children:[Y.t("parabolicTroughMenu.ModuleLength",o)," ..."]})},{key:"parabolic-trough-latus-rectum",label:h.jsxs(eo,{Dialog:xpo,children:[Y.t("parabolicTroughMenu.LatusRectum",o)," ..."]})},{key:"parabolic-trough-pole-height",label:h.jsxs(eo,{Dialog:bpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-trough-reflectance",label:h.jsxs(eo,{Dialog:Spo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-trough-absorptance",label:h.jsxs(eo,{Dialog:Tpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-trough-optical-efficiency",label:h.jsxs(eo,{Dialog:Ppo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-trough-thermal-efficiency",label:h.jsxs(eo,{Dialog:Cpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})},{key:"parabolic-trough-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Hpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(Fw),a=M(qq),l=M($q),s=M(vW),c=M(xW),u=M(Gr),d=M(En),f=M(vA),p=M(xA),g=M(no),A=M(Qn),y=M(Xi),S=uo(z.ParabolicDish),[C,P]=m.useState((S==null?void 0:S.lx)??2),v=m.useRef(!1),T=m.useRef(),w=$t(),x=L=>{p(L.target.value)},b=(L,j)=>{const B=u(L);if(B){const O=JSON.parse(JSON.stringify(L));return O.lx=j,ye.isSolarCollectorWithinHorizontalSurface(O,B)}return!1},R=(L,j)=>!b(L,j),H=L=>{if(S){switch(f){case re.AllSelectedObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.lx-L)>Et)return!0;break;case re.AllObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&Math.abs(j.lx-L)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===(S==null?void 0:S.foundationId)&&!j.locked&&Math.abs(j.lx-L)>Et)return!0;break;default:if(Math.abs((S==null?void 0:S.lx)-L)>Et)return!0}return!1}},F=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.ParabolicDish&&!O.locked&&L.has(O.id)&&(O.lx=j,O.ly=j)})},E=L=>{if(S&&H(L)){switch(T.current=void 0,f){case re.AllSelectedObjectsOfThisType:{v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(j.id)&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.lx);const B={name:"Set Diameter for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{F(B.oldValues,B.newValue)}};d(B),F(j,L),A(g+1)}break}case re.AllObjectsOfThisType:{v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&j.set(O.id,O.lx);const B={name:"Set Diameter for All Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{s(z.ParabolicDish,B.newValue),c(z.ParabolicDish,B.newValue)}};d(B),s(z.ParabolicDish,L),c(z.ParabolicDish,L),A(g+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(S.foundationId){v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===S.foundationId&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&O.foundationId===S.foundationId&&j.set(O.id,O.lx);const B={name:"Set Diameter for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:S.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{B.groupId&&(a(z.ParabolicDish,B.groupId,B.newValue),l(z.ParabolicDish,B.groupId,B.newValue))}};d(B),a(z.ParabolicDish,S.foundationId,L),l(z.ParabolicDish,S.foundationId,L),A(g+1)}}break}default:{const j=o(S.id),B=j?j.lx:S.lx;if(v.current=R(S,L),v.current)T.current=L,P(B);else{const O={name:"Set Parabolic Dish Diameter",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:S.id,changedElementType:S.type,undo:()=>{r(O.changedElementId,O.oldValue),i(O.changedElementId,O.oldValue)},redo:()=>{r(O.changedElementId,O.newValue),i(O.changedElementId,O.newValue)}};d(O),r(S.id,L),i(S.id,L),A(g+1)}break}}e(j=>{j.actionState.parabolicDishRimDiameter=L})}},N=()=>{v.current=!1,t(!1)},U=()=>{N(),y()},W=()=>{E(C),v.current||(t(!1),A(0))},k=()=>{E(C)};if((S==null?void 0:S.type)!==z.ParabolicDish)return null;const D=v.current?": "+Y.t("message.NotApplicableToSelectedAction",w)+(T.current!==void 0?" ("+T.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.RimDiameter",w),rejectedMessage:D,onApply:k,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:C,onChange:L=>{L!==null&&P(L)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",w),": 1 ",Y.t("word.MeterAbbreviation",w),h.jsx("br",{}),Y.t("word.MaximumValue",w),": 10 ",Y.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",w)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x,value:f,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",w)})]})})})]})})},Mpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(kYe),i=M(LYe),a=M(WYe),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicDish),[A,y]=m.useState((g==null?void 0:g.latusRectum)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicDish&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicDish&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicDish&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.latusRectum)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicDish&&!L.locked&&W.has(L.id)&&(L.latusRectum=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Dishes",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicDish,D.newValue)}};s(D),a(z.ParabolicDish,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&L.foundationId===g.foundationId&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicDish,D.groupId,D.newValue)}};s(D),i(z.ParabolicDish,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.latusRectum:g.latusRectum;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Dish Latus Rectum",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicDishLatusRectum=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicDish)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},Ipo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(vA),a=M(xA),l=M(no),s=M(Qn),c=uo(z.ParabolicDish),[u,d]=m.useState((c==null?void 0:c.structureType)??sf.CentralPole),f=$t(),{Option:p}=Uo,g=(x,b)=>{e(R=>{for(const H of R.elements)if(H.id===x&&!H.locked&&H.type===z.ParabolicDish){H.structureType=b;break}})},A=(x,b)=>{e(R=>{for(const H of R.elements)H.foundationId===x&&!H.locked&&H.type===z.ParabolicDish&&(H.structureType=b)})},y=x=>{e(b=>{for(const R of b.elements)R.locked||R.type===z.ParabolicDish&&(R.structureType=x)})},S=x=>{a(x.target.value)},C=x=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.structureType!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&b.structureType!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(c==null?void 0:c.foundationId)&&!b.locked&&b.structureType!==x)return!0;break;default:if((c==null?void 0:c.structureType)!==x)return!0}return!1},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.ParabolicDish&&!H.locked&&x.has(H.id)&&(H.structureType=b)})},v=x=>{if(c&&C(x)){switch(i){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};r(R),P(b,x),s(l+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{y(R.newValue)}};r(R),y(x),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const b=new Map;for(const H of n)H.type===z.ParabolicDish&&H.foundationId===c.foundationId&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{R.groupId&&A(R.groupId,R.newValue)}};r(R),A(c.foundationId,x),s(l+1)}break}default:{const b=o(c.id),R=b?b.structureType:c.structureType,H={name:"Set Parabolic Dish Structure Type",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(H.changedElementId,H.oldValue)},redo:()=>{g(H.changedElementId,H.newValue)}};r(H),g(c.id,x),s(l+1);break}}e(b=>{b.actionState.parabolicDishReceiverStructure=x})}},T=()=>{t(!1)},w=()=>{v(u)};return(c==null?void 0:c.type)!==z.ParabolicDish?null:h.jsx(so,{width:640,title:Y.t("parabolicDishMenu.ReceiverStructure",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsxs(Uo,{value:u,onChange:x=>d(x),children:[h.jsx(p,{value:sf.CentralPole,children:Y.t("parabolicDishMenu.CentralPole",f)},sf.CentralPole),h.jsx(p,{value:sf.CentralPoleWithTripod,children:Y.t("parabolicDishMenu.CentralPoleWithTripod",f)},sf.CentralPoleWithTripod),h.jsx(p,{value:sf.Quadrupod,children:Y.t("parabolicDishMenu.Quadrupod",f)},sf.Quadrupod)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:S,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",f)})]})})})]})})},zpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicDish),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.ParabolicDish&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.ParabolicDish&&!k.locked&&N.has(k.id)&&(k.tiltAngle=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.ParabolicDish,W.newValue)}};s(W),a(z.ParabolicDish,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===g.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.ParabolicDish,W.groupId,W.newValue)}};s(W),i(z.ParabolicDish,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Parabolic Dish Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicDishPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.ParabolicDish)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.ExtraPoleHeightInAdditionToRadius",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},Dpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(vYe),i=M(xYe),a=M(bYe),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=uo(z.ParabolicDish),[g,A]=m.useState((p==null?void 0:p.poleRadius)??.1),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.ParabolicDish&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-x)>Et)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-x)>Et)return!0;break}}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.ParabolicDish&&!H.locked&&x.has(H.id)&&(H.poleRadius=b)})},v=x=>{if(p&&C(x)){switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.ParabolicDish,R.newValue)}};s(R),a(z.ParabolicDish,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of n)H.type===z.ParabolicDish&&H.foundationId===p.foundationId&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.ParabolicDish,R.groupId,R.newValue)}};s(R),i(z.ParabolicDish,p.foundationId,x),f(d+1)}break}default:{const b=o(p.id),R=b?b.poleRadius:p.poleRadius,H={name:"Set Parabolic Dish Pole Radius",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}e(b=>{b.actionState.parabolicDishPoleRadius=x})}},T=()=>{t(!1)},w=()=>{v(g)};return(p==null?void 0:p.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.PoleRadius",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:g,onChange:x=>{x!==null&&A(x)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 0.5] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},Epo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Parabolic Dish Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Fpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(SYe),i=M(TYe),a=M(PYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.absorptance)??.95),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.absorptance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.absorptance:f.absorptance,R={name:"Set Parabolic Dish Absorptance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishAbsorptance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},kpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(CYe),i=M(RYe),a=M(HYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.opticalEfficiency)??.7),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.opticalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Dish Optical Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishOpticalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Lpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(MYe),i=M(IYe),a=M(zYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.thermalEfficiency)??.3),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.thermalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Dish Thermal Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishThermalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Wpo=t=>{const e=[];if(t.type!==z.ParabolicDish)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"parabolic-dish-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"parabolic-dish-cut",label:h.jsx(kd,{})}),e.push({key:"parabolic-dish-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"parabolic-dish-radius",label:h.jsxs(eo,{Dialog:Hpo,children:[Y.t("parabolicDishMenu.RimDiameter",o)," ..."]})},{key:"parabolic-dish-latus-rectum",label:h.jsxs(eo,{Dialog:Mpo,children:[Y.t("parabolicDishMenu.LatusRectum",o)," ..."]})},{key:"parabolic-dish-structure-type",label:h.jsxs(eo,{Dialog:Ipo,children:[Y.t("parabolicDishMenu.ReceiverStructure",o)," ..."]})},{key:"parabolic-dish-pole-height",label:h.jsxs(eo,{Dialog:zpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-dish-pole-radius",label:h.jsxs(eo,{Dialog:Dpo,children:[Y.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"parabolic-dish-reflectance",label:h.jsxs(eo,{Dialog:Epo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-dish-absorptance",label:h.jsxs(eo,{Dialog:Fpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-dish-optical-efficiency",label:h.jsxs(eo,{Dialog:kpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-dish-thermal-efficiency",label:h.jsxs(eo,{Dialog:Lpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})},{key:"parabolic-dish-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Npo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(pYe),r=M(gYe),i=M(mYe),a=M(En),l=M(kb),s=M(Lb),c=M(no),u=M(Qn),d=uo(z.FresnelReflector),[f,p]=m.useState(!!(d!=null&&d.drawSunBeam)),g=$t(),A=T=>{s(T.target.value)},y=T=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.FresnelReflector&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.FresnelReflector&&!w.locked&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.FresnelReflector&&w.foundationId===(d==null?void 0:d.foundationId)&&!w.locked&&w.drawSunBeam!==T)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==T)return!0}return!1},S=(T,w)=>{M.getState().set(x=>{for(const b of x.elements)ye.isSolarCollectorType(b.type)&&!b.locked&&b.type===z.FresnelReflector&&T.has(b.id)&&(b.drawSunBeam=w)})},C=T=>{if(d&&y(T))switch(l){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{S(x.oldValues,x.newValue)}};a(x),S(w,T),u(c+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.FresnelReflector&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Fresnel Reflectors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{i(z.FresnelReflector,x.newValue)}};a(x),i(z.FresnelReflector,T),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const w=new Map;for(const b of e)b.type===z.FresnelReflector&&b.foundationId===d.foundationId&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:d.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{x.groupId&&r(z.FresnelReflector,x.groupId,x.newValue)}};a(x),r(z.FresnelReflector,d.foundationId,T),u(c+1)}break}default:{const w=n(d.id),x=w?w.drawSunBeam:d.drawSunBeam,b={name:"Draw Sun Beam for Fresnel Reflector",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(b.changedElementId,b.oldValue)},redo:()=>{o(b.changedElementId,b.newValue)}};a(b),o(d.id,T),u(c+1);break}}},P=()=>{t(!1)},v=()=>{C(f)};return(d==null?void 0:d.type)!==z.FresnelReflector?null:h.jsx(so,{width:500,title:Y.t("solarCollectorMenu.DrawSunBeam",g),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:f,onChange:T=>{p(T)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",g)})]})})})]})})},{Option:Upo}=Uo,jpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(DYe),i=M(EYe),a=M(FYe),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=uo(z.FresnelReflector),[p,g]=m.useState((f==null?void 0:f.receiverId)??"None"),A=$t(),y=m.useMemo(()=>{const x=[];for(const b of n)if(b.type===z.Foundation){const R=b;R.solarStructure===Dn.FocusPipe&&x.push(R.id)}return x},[n]);m.useEffect(()=>{if(g("None"),f)if(f.receiverId)g(f.receiverId);else{const x=o(f.parentId);x&&x.type===z.Foundation&&x.solarStructure===Dn.FocusPipe&&g(x.id)}},[f]);const S=x=>{c(x.target.value)},C=x=>{switch(s){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.receiverId!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&b.receiverId!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.FresnelReflector&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&b.receiverId!==x)return!0;break;default:if((f==null?void 0:f.receiverId)!==x)return!0}return!1},P=(x,b)=>{e(R=>{for(const H of R.elements)ye.isHeliostatOrFresnelReflector(H.type)&&!H.locked&&x.has(H.id)&&(H.type===z.Heliostat?H.towerId=b:H.type===z.FresnelReflector&&(H.receiverId=b))})},v=x=>{if(f&&C(x)){switch(s){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(b,x),d(u+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.FresnelReflector&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.FresnelReflector,R.newValue)}};l(R),a(z.FresnelReflector,x),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const H of n)H.type===z.FresnelReflector&&H.foundationId===f.foundationId&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:f.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.FresnelReflector,R.groupId,R.newValue)}};l(R),i(z.FresnelReflector,f.foundationId,x),d(u+1)}break}default:{const b=o(f.id),R=b?b.receiverId:f.receiverId,H={name:"Set Receiver for Fresnel Reflector",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};l(H),r(f.id,x),d(u+1);break}}e(b=>{b.actionState.fresnelReflectorReceiver=x})}},T=()=>{t(!1)},w=()=>{p&&v(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(so,{width:640,title:Y.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",A),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsx(Uo,{style:{width:"160px"},value:p,onChange:x=>{g(x)},children:y.map((x,b)=>h.jsx(Upo,{value:x,children:Y.t("fresnelReflectorMenu.AbsorberPipe",A)+" "+(b+1)},b))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:S,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},Bpo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Fw),r=M($q),i=M(xW),a=M(Gr),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=M(Xi),p=uo(z.FresnelReflector),[g,A]=m.useState((p==null?void 0:p.ly)??9),y=m.useRef(!1),S=m.useRef(),C=$t(),P=W=>{c(W.target.value)},v=(W,k)=>{const D=a(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},T=(W,k)=>!v(W,k),w=W=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:for(const k of e)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of e)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of e)if(k.type===z.FresnelReflector&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Et)return!0}return!1}},x=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.ly=k)})},b=W=>{if(p&&w(W))switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{x(D.oldValues,D.newValue)}};l(D),x(k,W),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&k.set(L.id,L.ly);const D={name:"Set Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{i(z.FresnelReflector,D.newValue)}};l(D),i(z.FresnelReflector,W),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&k.foundationId===p.foundationId&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&L.foundationId===p.foundationId&&k.set(L.id,L.ly);const D={name:"Set Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{D.groupId&&r(z.FresnelReflector,D.groupId,D.newValue)}};l(D),r(z.FresnelReflector,p.foundationId,W),d(u+1)}}break}default:{const k=n(p.id),D=k?k.ly:p.ly;if(y.current=T(p,W),y.current)S.current=W,A(D);else{const L={name:"Set Fresnel Reflector Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{y.current=!1,t(!1)},H=()=>{R(),f()},F=()=>{b(g),y.current||(t(!1),d(0))},E=W=>{if(!p)return 1;let k=W??1;return k=Math.max(1,Math.ceil((k-p.moduleLength/2)/p.moduleLength))*p.moduleLength,k},N=()=>{b(g)};if((p==null?void 0:p.type)!==z.FresnelReflector)return null;const U=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:p.moduleLength,max:200*p.moduleLength,step:p.moduleLength,style:{width:120},precision:2,value:g,onChange:W=>{W!==null&&A(E(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("fresnelReflectorMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+Y.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(g/p.moduleLength)+" "+Y.t("fresnelReflectorMenu.ModulesLong",C),h.jsx("br",{}),Y.t("word.Maximum",C),": 200 ",Y.t("fresnelReflectorMenu.Modules",C)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",C)})]})})})]})})},Ypo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Width for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&k.set(L.id,L.lx);const D={name:"Set Width for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,D.newValue)}};s(D),a(z.FresnelReflector,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Width for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.FresnelReflector,D.groupId,D.newValue)}};s(D),i(z.FresnelReflector,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Fresnel Reflector Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.fresnelReflectorWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},Opo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(NYe),i=M(UYe),a=M(jYe),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.moduleLength)??3),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.moduleLength)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.moduleLength=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,D.newValue)}};s(D),a(z.FresnelReflector,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===g.foundationId&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.FresnelReflector,D.groupId,D.newValue)}};s(D),i(z.FresnelReflector,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.moduleLength:g.moduleLength;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Fresnel Reflector Module Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.fresnelReflectorModuleLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("fresnelReflectorMenu.ModuleLength",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},Vpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=m.useRef((g==null?void 0:g.poleHeight)??1),v=$t(),T=U=>{u(U.target.value)},w=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const k of n)if(k.type===z.FresnelReflector&&k.parentId===g.parentId&&!k.locked&&Math.abs(k.poleHeight-U)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-U)>Et)return!0;break}}return!1}},x=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)D.type===z.FresnelReflector&&!D.locked&&U.has(D.id)&&(D.poleHeight=W)})},b=U=>{if(g&&w(U)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(D.id)&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{x(k.oldValues,k.newValue)}};s(k),x(W,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{a(z.FresnelReflector,k.newValue)}};s(k),a(z.FresnelReflector,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===g.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&D.foundationId===g.foundationId&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:g.foundationId,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{k.groupId&&i(z.FresnelReflector,k.groupId,k.newValue)}};s(k),i(z.FresnelReflector,g.foundationId,U),f(d+1)}}break}default:{const W=o(g.id),k=W?W.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>U,S.current)C.current=U,P.current=k;else{const D={name:"Set Fresnel Reflector Pole Height",timestamp:Date.now(),oldValue:k,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};s(D),r(g.id,U),f(d+1)}break}}e(W=>{W.actionState.fresnelReflectorPoleHeight=U})}},R=()=>{t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",v),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [0, 5] ",Y.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",v)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",v)})]})})})]})})},_po=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=uo(z.FresnelReflector),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.FresnelReflector&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.FresnelReflector&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.FresnelReflector&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.FresnelReflector&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.FresnelReflector&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Fresnel Reflectors",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.FresnelReflector,b.newValue)}};l(b),a(z.FresnelReflector,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.FresnelReflector&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.FresnelReflector,b.groupId,b.newValue)}};l(b),i(z.FresnelReflector,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Fresnel Reflector Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.fresnelReflectorReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,value:p,step:.01,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},Gpo=t=>{const e=[];if(t.type!==z.FresnelReflector)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"fresnel-reflector-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"fresnel-reflector-cut",label:h.jsx(kd,{})}),e.push({key:"fresnel-reflector-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"fresnel-reflector-receiver",label:h.jsxs(eo,{Dialog:jpo,children:[Y.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",o)," ..."]})},{key:"fresnel-reflector-length",label:h.jsxs(eo,{Dialog:Bpo,children:[Y.t("word.Length",o)," ..."]})},{key:"fresnel-reflector-width",label:h.jsxs(eo,{Dialog:Ypo,children:[Y.t("word.Width",o)," ..."]})},{key:"fresnel-reflector-module-length",label:h.jsxs(eo,{Dialog:Opo,children:[Y.t("fresnelReflectorMenu.ModuleLength",o)," ..."]})},{key:"fresnel-reflector-pole-height",label:h.jsxs(eo,{Dialog:Vpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"fresnel-reflector-reflectance",label:h.jsxs(eo,{Dialog:_po,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"fresnel-reflector-draw-sun-beam",label:h.jsxs(eo,{Dialog:Npo,children:[Y.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"fresnel-reflector-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Xpo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(pYe),r=M(gYe),i=M(mYe),a=M(En),l=M(Wb),s=M(Nb),c=M(no),u=M(Qn),d=uo(z.Heliostat),[f,p]=m.useState(!!(d!=null&&d.drawSunBeam)),g=$t(),A=T=>{s(T.target.value)},y=T=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Heliostat&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Heliostat&&!w.locked&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Heliostat&&w.foundationId===(d==null?void 0:d.foundationId)&&!w.locked&&w.drawSunBeam!==T)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==T)return!0}return!1},S=(T,w)=>{M.getState().set(x=>{for(const b of x.elements)b.type===z.Heliostat&&!b.locked&&T.has(b.id)&&(b.drawSunBeam=w)})},C=T=>{if(d&&y(T))switch(l){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.Heliostat&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for Selected Heliostats",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{S(x.oldValues,x.newValue)}};a(x),S(w,T),u(c+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.Heliostat&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Heliostats",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{i(z.Heliostat,x.newValue)}};a(x),i(z.Heliostat,T),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const w=new Map;for(const b of e)b.type===z.Heliostat&&b.foundationId===d.foundationId&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:d.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{x.groupId&&r(z.Heliostat,x.groupId,x.newValue)}};a(x),r(z.Heliostat,d.foundationId,T),u(c+1)}break}default:{const w=n(d.id),x=w?w.drawSunBeam:d.drawSunBeam,b={name:"Draw Sun Beam for Heliostat",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(b.changedElementId,b.oldValue)},redo:()=>{o(b.changedElementId,b.newValue)}};a(b),o(d.id,T),u(c+1);break}}},P=()=>{t(!1)},v=()=>{C(f)};return(d==null?void 0:d.type)!==z.Heliostat?null:h.jsx(so,{width:500,title:Y.t("solarCollectorMenu.DrawSunBeam",g),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:f,onChange:p})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",g)})]})})})]})})},{Option:Jpo}=Uo,Kpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(DYe),i=M(EYe),a=M(FYe),l=M(En),s=M(Wb),c=M(Nb),u=M(no),d=M(Qn),f=uo(z.Heliostat),[p,g]=m.useState((f==null?void 0:f.towerId)??"None"),A=$t(),y=m.useMemo(()=>{const x=[];for(const b of n)if(b.type===z.Foundation){const R=b;R.solarStructure===Dn.FocusTower&&x.push(R.id)}return x},[n]);m.useEffect(()=>{if(g("None"),f)if(f.towerId)g(f.towerId);else{const x=o(f.parentId);x&&x.type===z.Foundation&&x.solarStructure===Dn.FocusTower&&g(x.id)}},[f]);const S=x=>{c(x.target.value)},C=x=>{switch(s){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.towerId!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&b.towerId!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&b.towerId!==x)return!0;break;default:if((f==null?void 0:f.towerId)!==x)return!0}return!1},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Heliostat&&!H.locked&&x.has(H.id)&&(H.towerId=b)})},v=x=>{if(f&&C(x)){switch(s){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.towerId);const R={name:"Set Tower for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(b,x),d(u+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&b.set(H.id,H.towerId);const R={name:"Set Tower for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.Heliostat,R.newValue)}};l(R),a(z.Heliostat,x),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const H of n)H.type===z.Heliostat&&H.foundationId===f.foundationId&&b.set(H.id,H.towerId);const R={name:"Set Tower for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:f.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};l(R),i(z.Heliostat,f.foundationId,x),d(u+1)}break}default:{const b=o(f.id),R=b?b.towerId:f.towerId,H={name:"Set Tower for Heliostat",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};l(H),r(f.id,x),d(u+1);break}}e(b=>{b.actionState.heliostatTower=x})}},T=()=>{t(!1)},w=()=>{p&&v(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("heliostatMenu.SelectTowerToReflectSunlightTo",A),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsx(Uo,{style:{width:"120px"},value:p,onChange:g,children:y.map((x,b)=>h.jsx(Jpo,{value:x,children:Y.t("heliostatMenu.Tower",A)+" "+(b+1)},b))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:S,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",A)})]})})})]})})},qpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.Heliostat&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Length for Selected Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&k.set(L.id,L.lx);const D={name:"Set Length for All Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,D.newValue)}};s(D),a(z.Heliostat,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.Heliostat&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Length for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.Heliostat,D.groupId,D.newValue)}};s(D),i(z.Heliostat,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Heliostat Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.heliostatLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},$po=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Fw),i=M($q),a=M(xW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.ly)??4),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,ye.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.Heliostat&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.ly)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.ly=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Width for Selected Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&k.set(L.id,L.ly);const D={name:"Set Width for All Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,D.newValue)}};s(D),a(z.Heliostat,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.Heliostat&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===g.foundationId&&k.set(L.id,L.ly);const D={name:"Set Width for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.Heliostat,D.groupId,D.newValue)}};s(D),i(z.Heliostat,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.ly:g.ly;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Heliostat Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.heliostatWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Qpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.Heliostat&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.Heliostat&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.Heliostat&&!k.locked&&N.has(k.id)&&(k.poleHeight=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.Heliostat&&M.getState().selectedElementIdSet.has(U.id)&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.Heliostat&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.Heliostat,W.newValue)}};s(W),a(z.Heliostat,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.Heliostat&&U.foundationId===g.foundationId&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.Heliostat,W.groupId,W.newValue)}};s(W),i(z.Heliostat,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*Math.max(g.lx,g.ly)*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Heliostat Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.heliostatPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Zpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(vYe),i=M(xYe),a=M(bYe),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=uo(z.Heliostat),[g,A]=m.useState((p==null?void 0:p.poleRadius)??.1),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Heliostat&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Heliostat&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.Heliostat&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-x)>Et)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-x)>Et)return!0;break}}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Heliostat&&!H.locked&&x.has(H.id)&&(H.poleRadius=b)})},v=x=>{if(p&&C(x)){switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.Heliostat,R.newValue)}};s(R),a(z.Heliostat,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of n)H.type===z.Heliostat&&H.foundationId===p.foundationId&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};s(R),i(z.Heliostat,p.foundationId,x),f(d+1)}break}default:{const b=o(p.id),R=b?b.poleRadius:p.poleRadius,H={name:"Set Heliostat Pole Radius",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}e(b=>{b.actionState.heliostatPoleRadius=x})}},T=()=>{t(!1)},w=()=>{v(g)};return(p==null?void 0:p.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.PoleRadius",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:g,onChange:x=>{x!==null&&A(x)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 0.5] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},e1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(Wb),c=M(Nb),u=M(no),d=M(Qn),f=uo(z.Heliostat),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.Heliostat&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.Heliostat&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.Heliostat&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.Heliostat&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Heliostat&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Heliostats",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Heliostat&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Heliostats",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.Heliostat,b.newValue)}};l(b),a(z.Heliostat,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.Heliostat&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.Heliostat,b.groupId,b.newValue)}};l(b),i(z.Heliostat,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Heliostat Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.heliostatReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",A)})]})})})]})})},t1o=t=>{const e=[];if(t.type!==z.Heliostat)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"heliostat-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"heliostat-cut",label:h.jsx(kd,{})}),e.push({key:"heliostat-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"heliostat-tower",label:h.jsxs(eo,{Dialog:Kpo,children:[Y.t("heliostatMenu.SelectTowerToReflectSunlightTo",o)," ..."]})},{key:"heliostat-length",label:h.jsxs(eo,{Dialog:qpo,children:[Y.t("word.Length",o)," ..."]})},{key:"heliostat-width",label:h.jsxs(eo,{Dialog:$po,children:[Y.t("word.Width",o)," ..."]})},{key:"heliostat-pole-height",label:h.jsxs(eo,{Dialog:Qpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"heliostat-pole-radius",label:h.jsxs(eo,{Dialog:Zpo,children:[Y.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"heliostat-reflectance",label:h.jsxs(eo,{Dialog:e1o,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"heliostat-draw-sun-beam",label:h.jsxs(eo,{Dialog:Xpo,children:[Y.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"heliostat-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},{Option:mm}=Uo,n1o=be.memo(({tree:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Tree&&u.id===l){u.name=s;break}})};return h.jsxs(Uo,{style:{width:"160px"},value:(t==null?void 0:t.name)??pr.Pine,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Tree",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.treeType=l}),r(!o)}}},children:[h.jsxs(mm,{value:pr.Apple,children:[h.jsx("img",{alt:pr.Apple,src:dde,height:20,style:{paddingRight:"8px"}})," ",Y.t("tree.Apple",i)]},pr.Apple),h.jsxs(mm,{value:pr.Birch,children:[h.jsx("img",{alt:pr.Birch,src:fde,height:20,style:{paddingRight:"20px"}})," ",Y.t("tree.Birch",i)]},pr.Birch),h.jsxs(mm,{value:pr.Coconut,children:[h.jsx("img",{alt:pr.Coconut,src:aQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.Coconut",i)]},pr.Coconut),h.jsxs(mm,{value:pr.Dogwood,children:[h.jsx("img",{alt:pr.Dogwood,src:hde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Dogwood",i)]},pr.Dogwood),h.jsxs(mm,{value:pr.Elm,children:[h.jsx("img",{alt:pr.Elm,src:pde,height:20,style:{paddingRight:"20px"}}),Y.t("tree.Elm",i)]},pr.Elm),h.jsxs(mm,{value:pr.FanPalm,children:[h.jsx("img",{alt:pr.FanPalm,src:lQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.FanPalm",i)]},pr.FanPalm),h.jsxs(mm,{value:pr.Linden,children:[h.jsx("img",{alt:pr.Linden,src:gde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Linden",i)]},pr.Linden),h.jsxs(mm,{value:pr.Magnolia,children:[h.jsx("img",{alt:pr.Magnolia,src:mde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Magnolia",i)]},pr.Magnolia),h.jsxs(mm,{value:pr.Maple,children:[h.jsx("img",{alt:pr.Maple,src:yde,height:20,style:{paddingRight:"12px"}})," ",Y.t("tree.Maple",i)]},pr.Maple),h.jsxs(mm,{value:pr.Oak,children:[h.jsx("img",{alt:pr.Oak,src:Ade,height:20,style:{paddingRight:"17px"}}),Y.t("tree.Oak",i)]},pr.Oak),h.jsxs(mm,{value:pr.Pine,children:[h.jsx("img",{alt:pr.Pine,src:sQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.Pine",i)]},pr.Pine),h.jsxs(mm,{value:pr.Spruce,children:[h.jsx("img",{alt:pr.Spruce,src:cQe,height:20,style:{paddingRight:"20px"}})," ",Y.t("tree.Spruce",i)]},pr.Spruce)]})}),o1o=t=>{const e=[];if(t.type!==z.Tree)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"tree-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"tree-cut",label:h.jsx(kd,{})}),e.push({key:"tree-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"tree-show-model",label:h.jsx(rho,{tree:n})},{key:"tree-flip",label:h.jsx(L9e,{billboardModel:n})}),e.push({key:"tree-change-type",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("treeMenu.Type",r),": "]}),h.jsx(n1o,{tree:n})]})},{key:"tree-spread",label:h.jsx(iho,{tree:n})},{key:"tree-height",label:h.jsx(aho,{tree:n})},{key:"tree-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},r1o=({wall:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Wall`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{update:!0,noPadding:!0,onClick:l,children:r})},LHe=({wall:t,objectType:e,lock:n,children:o})=>{const r=M.getState().updateElementLockById,i=M.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of M.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Wall`:`Unlock All Locked ${l} on Wall`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};M.getState().addUndoable(u)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},i1o=({wall:t})=>{const e=$t(),n=M.getState().set,o=(i,a)=>{n(l=>{const s=l.elements.find(c=>c.id===i&&c.type===z.Wall);s&&(s.parapet.display=a)})},r=i=>{const a=i.target.checked,l={name:"Parapet",timestamp:Date.now(),checked:a,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{o(t.id,!l.checked)},redo:()=>{o(t.id,l.checked)}};M.getState().addUndoable(l),o(t.id,a),n(s=>{s.actionState.wallParapet.display=a})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.parapet.display,onChange:r,children:Y.t("wallMenu.Parapet",e)})})},a1o=({wall:t})=>{const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.id===i&&s.type===z.Wall){const c=s;c.wallStructure=a,(a===gc.Stud||a===gc.Pillar)&&(c.opacity=0);break}})},o=i=>{const a={name:"Select Wall Structure",timestamp:Date.now(),oldValue:t.wallStructure,newValue:i.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(a.changedElementId,a.oldValue)},redo:()=>{n(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),n(t.id,i.target.value),M.getState().set(l=>{l.actionState.wallStructure=i.target.value,(l.actionState.wallStructure===gc.Stud||l.actionState.wallStructure===gc.Pillar)&&(l.actionState.wallOpacity=0)})},r=t.wallStructure??gc.Default;return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:r,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:gc.Default,children:Y.t("wallMenu.DefaultStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:gc.Stud,children:Y.t("wallMenu.StudStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:gc.Pillar,children:Y.t("wallMenu.PillarStructure",e)})]})})})},l1o=({wall:t})=>{const e=M.getState().set,n=$t(),o=(i,a,l)=>{const{cx:s,cy:c,cz:u}=a,d=l?l.rotation[2]+a.relativeAngle:a.relativeAngle;if(l&&d!==void 0){const f=ye.wallAbsolutePosition(new ae(s,c,u),l).setZ(a.lz/2+l.lz);return new ae().subVectors(i,f).applyEuler(new ln(0,0,-d))}return new ae},r=()=>{const i=M.getState().getFoundation(t);if(!i)return;const a=o(M.getState().pastePoint,t,i),l=Va.makePolygon(t,-a.x/t.lx,0,-a.z/t.lz,new ae(0,0,1),[0,0,0],z.Wall);e(c=>{c.elements.push(l),c.objectTypeToAdd=z.None});const s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{M.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{e(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};M.getState().addUndoable(s)};return h.jsx(an,{onClick:r,children:Y.t("foundationMenu.AddPolygon",n)})},s1o=({wall:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.fill=i;break}})},o=r=>{const i={name:"Select Wall Fill",timestamp:Date.now(),oldValue:t.fill,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.fill,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Fl.Full,children:Y.t("wallMenu.Full",e)}),h.jsx(Le,{style:{width:"100%"},value:Fl.Partial,children:Y.t("wallMenu.Partial",e)}),h.jsx(Le,{style:{width:"100%"},value:Fl.Empty,children:Y.t("wallMenu.Empty",e)})]})})})},c1o=({wall:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.openToOutside=i;break}})},o=r=>{const i={name:"Set Open to Outside",timestamp:Date.now(),oldValue:!!t.openToOutside,newValue:r.target.checked,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.openToOutside,onChange:o,children:Y.t("wallMenu.OpenToOutside",e)})})},_ae=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"doorCount",lockedKey:"lockedDoorCount",objectType:z.Door},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"polygonCount",lockedKey:"lockedPolygonCount",objectType:z.Polygon},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],u1o=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${Y.t("wallMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisWall",n)} (${e} ${Y.t("wallMenu.SolarPanels",n)})`;break}case z.Window:{o=`${Y.t("wallMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllWindowsOnThisWall",n)} (${e} ${Y.t("wallMenu.Windows",n)})`;break}case z.Door:{o=`${Y.t("wallMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllDoorsOnThisWall",n)} (${e} ${Y.t("wallMenu.Doors",n)})`;break}case z.Sensor:{o=`${Y.t("wallMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllSensorsOnThisWall",n)} (${e} ${Y.t("wallMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("wallMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllLightsOnThisWall",n)} (${e} ${Y.t("wallMenu.Lights",n)})`;break}case z.Polygon:{o=`${Y.t("wallMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllPolygonsOnThisWall",n)} (${e} ${Y.t("wallMenu.Polygons",n)})`;break}}return{itemLabel:o,modalTitle:r}},Gae=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],d1o=(t,e,n)=>{const o=[],r={lng:M.getState().language};return _ae.forEach(({key:i,objectType:a})=>{const l=Gae(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=u1o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-wall`,label:h.jsx(r1o,{wall:t,objectType:a,modalTitle:c,children:s})})}}),_ae.forEach(({key:i,objectType:a})=>{const l=Gae(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-wall`,label:h.jsxs(LHe,{wall:t,objectType:a,lock:!0,children:[Y.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),_ae.forEach(({lockedKey:i,objectType:a})=>{const l=Gae(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(LHe,{wall:t,objectType:a,lock:!1,children:[Y.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!0,children:[Y.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!1,children:[Y.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},f1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),c=$t(),[u,d]=ZZ((s==null?void 0:s.parapet.color)??"#ffffff"),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.id===T&&b.type===z.Wall&&!b.locked){b.parapet.color=w;break}})},p=T=>{if(!s)return;const w=ye.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.parapet.color=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.parentId===T&&b.type===z.Wall&&!b.locked&&(b.parapet.color=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.parapet.color=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.parapet.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.parapet.color&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.parapet.color&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.parapet.color&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=ye.getAllConnectedWalls(s);for(const x of w)if(T!==x.parapet.color&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.parapet.color))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break;case re.AllConnectedObjects:if(s){const w=ye.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Parapet Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1)}break;default:if(s){const w=l(s.id),x=(w==null?void 0:w.parapet.color)??s.parapet.color??"#ffffff",b={name:"Set Parapet Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}}e(w=>{w.actionState.wallParapet.color=T})}},P=()=>{C(u)},v=()=>{t(!1)};return h.jsx(so,{width:640,title:Y.t("wallMenu.ParapetColor",c),onApply:P,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u,onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",c)})]})})})]})})},Prt="/aladdin/assets/wall_01_menu-BlJdKfby.png",Crt="/aladdin/assets/wall_02_menu-DfsmvvWJ.png",Rrt="/aladdin/assets/wall_03_menu-B95_FEuA.png",Hrt="/aladdin/assets/wall_04_menu-D-Kn25E7.png",Mrt="/aladdin/assets/wall_05_menu-DGgjaMY9.png",Irt="/aladdin/assets/wall_06_menu-EOIch2eu.png",zrt="/aladdin/assets/wall_07_menu-DvXS_qn2.png",Drt="/aladdin/assets/wall_08_menu-CfftE2pF.png",Ert="/aladdin/assets/wall_09_menu-_O8A0WOE.png",Frt="/aladdin/assets/wall_10_menu-B5QfhD3g.png",h1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.parapet.textureType)??Bo.Default),d=$t(),{Option:f}=Uo,p=(w,x)=>{e(b=>{for(const R of b.elements)if(R.type===z.Wall&&R.id===w&&!R.locked){R.parapet.textureType=x;break}})},g=w=>{if(!s)return;const x=ye.getAllConnectedWalls(s);x.length!==0&&e(b=>{for(const R of x)if(!R.locked)for(const H of b.elements)H.id===R.id&&H.type===z.Wall&&(H.parapet.textureType=w)})},A=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&R.foundationId===w&&!R.locked&&(R.parapet.textureType=x)})},y=w=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&(b.parapet.textureType=w)})},S=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&!R.locked&&w.has(R.id)&&(R.parapet.textureType=x)})},C=w=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.parapet.textureType&&!x.locked&&M.getState().selectedElementIdSet.has(x.id))return!0;break}case re.AllObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.parapet.textureType&&!x.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const x of n)if(x.type===z.Wall&&x.foundationId===s.foundationId&&w!==x.parapet.textureType&&!x.locked)return!0;break}case re.AllConnectedObjects:{const x=ye.getAllConnectedWalls(s);for(const b of x)if(w!==b.parapet.textureType&&!b.locked)return!0;break}default:{if(w!==(s==null?void 0:s.parapet.textureType))return!0;break}}return!1}},P=w=>{if(s&&C(w)){switch(r){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.parapet.textureType??Bo.Default);const b={name:"Set Parapet Texture for Selected Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{S(b.oldValues,b.newValue)}};o(b),S(x,w),a(i+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&x.set(R.id,R.parapet.textureType??Bo.Default);const b={name:"Set Parapet Texture for All Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{y(b.newValue)}};o(b),y(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const x=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===s.foundationId&&!R.locked&&x.set(R.id,R.parapet.textureType);const b={name:"Set Parapet Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:s.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{b.groupId&&A(b.groupId,b.newValue)}};o(b),A(s.foundationId,w),a(i+1)}break;case re.AllConnectedObjects:if(s){const x=ye.getAllConnectedWalls(s),b=new Map;for(const H of x)b.set(H.id,H.parapet.textureType);const R={name:"Set Parapet Texture for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:w,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{g(R.newValue)}};o(R),g(w),a(i+1)}break;default:if(s){const x=l(s.id),b=(x==null?void 0:x.parapet.textureType)??s.parapet.textureType,R={name:"Set Parapet Texture of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(s.id,w),a(i+1)}}e(x=>{x.actionState.wallParapet.textureType=w})}},v=()=>{t(!1)},T=()=>{P(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:Bo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},Bo.NoTexture),h.jsxs(f,{value:Bo.Default,children:[h.jsx("img",{alt:Bo.Default,src:Uye,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.TextureDefault",d)]},Bo.Default),h.jsxs(f,{value:Bo.Texture01,children:[h.jsx("img",{alt:Bo.Texture01,src:Prt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture01",d)]},Bo.Texture01),h.jsxs(f,{value:Bo.Texture02,children:[h.jsx("img",{alt:Bo.Texture02,src:Crt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture02",d)]},Bo.Texture02),h.jsxs(f,{value:Bo.Texture03,children:[h.jsx("img",{alt:Bo.Texture03,src:Rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture03",d)]},Bo.Texture03),h.jsxs(f,{value:Bo.Texture04,children:[h.jsx("img",{alt:Bo.Texture04,src:Hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture04",d)]},Bo.Texture04),h.jsxs(f,{value:Bo.Texture05,children:[h.jsx("img",{alt:Bo.Texture05,src:Mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture05",d)]},Bo.Texture05),h.jsxs(f,{value:Bo.Texture06,children:[h.jsx("img",{alt:Bo.Texture06,src:Irt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture06",d)]},Bo.Texture06),h.jsxs(f,{value:Bo.Texture07,children:[h.jsx("img",{alt:Bo.Texture07,src:zrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture07",d)]},Bo.Texture07),h.jsxs(f,{value:Bo.Texture08,children:[h.jsx("img",{alt:Bo.Texture08,src:Drt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture08",d)]},Bo.Texture08),h.jsxs(f,{value:Bo.Texture09,children:[h.jsx("img",{alt:Bo.Texture09,src:Ert,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture09",d)]},Bo.Texture09),h.jsxs(f,{value:Bo.Texture10,children:[h.jsx("img",{alt:Bo.Texture10,src:Frt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture10",d)]},Bo.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:w=>M.getState().setWallActionScope(w.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})},Xae=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=M(Kn),s=M(En),c=M(g3),u=M(no),d=M(Qn),f=M(pn),p=m.useRef(t.parapet[n]),g=$t(),A=R=>{f(H=>{switch(n){case"copingsHeight":H.actionState.wallParapet.copingsHeight=R;break;case"copingsWidth":H.actionState.wallParapet.copingsWidth=R;break;case"parapetHeight":H.actionState.wallParapet.parapetHeight=R;break}})},y=(R,H)=>{f(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Wall&&!E.locked){E.parapet[n]=H;break}}),A(H)},S=R=>{const H=ye.getAllConnectedWalls(t);H.length!==0&&(f(F=>{for(const E of H)if(!E.locked)for(const N of F.elements)N.id===E.id&&N.type===z.Wall&&(N.parapet[n]=R)}),A(R))},C=(R,H)=>{f(F=>{for(const E of F.elements)E.parentId===R&&E.type===z.Wall&&!E.locked&&(E.parapet[n]=H)}),A(H)},P=R=>{f(H=>{for(const F of H.elements)F.type===z.Wall&&!F.locked&&(F.parapet[n]=R)}),A(R)},v=(R,H)=>{f(F=>{for(const E of F.elements)E.type===z.Wall&&!E.locked&&R.has(E.id)&&(E.parapet[n]=H)}),A(H)},T=R=>{switch(c){case re.AllSelectedObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H.parapet[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break}case re.AllObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H.parapet[n]&&!H.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of l)if(H.type===z.Wall&&H.foundationId===t.foundationId&&R!==H.parapet[n]&&!H.locked)return!0;break}case re.AllConnectedObjects:{const H=ye.getAllConnectedWalls(t);for(const F of H)if(R!==F.parapet[n]&&!F.locked)return!0;break}default:{if(R!==t.parapet[n])return!0;break}}return!1},w=R=>{if(t&&T(R))switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{v(F.oldValues,F.newValue)}};s(F),v(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.newValue)}};s(F),P(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const H=new Map;for(const E of l)E.type===z.Wall&&E.foundationId===t.foundationId&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&C(F.groupId,F.newValue)}};s(F),C(t.foundationId,R),d(u+1)}break;case re.AllConnectedObjects:if(t){const H=ye.getAllConnectedWalls(t),F=new Map;for(const N of H)F.set(N.id,N.parapet[n]);const E={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:F,newValue:R,undo:()=>{for(const[N,U]of E.oldValues.entries())y(N,U)},redo:()=>{S(E.newValue)}};s(E),S(R),d(u+1)}break;default:if(t){const H=t.parapet[n],F={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(F.changedElementId,F.oldValue)},redo:()=>{y(F.changedElementId,F.newValue)}};s(F),y(t.id,R),d(u+1)}}},x=()=>{a(!1)},b=()=>{w(p.current)};return h.jsx(so,{width:550,title:Y.t(`wallMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t.parapet[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [",o.toString(),"] ",i]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",g)})]})})})]})})};var w_=(t=>(t.ParapetHeight="ParapetHeight",t.CopingsHeight="CopingsHeight",t.CopingsWidth="CopingsWidth",t))(w_||{});const p1o={ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},Jae=({Dialog:t,wall:e,dataType:n,children:o})=>{const r=$t(),[i,a]=m.useState(!1),l=()=>{M.getState().setApplyCount(0),a(!0)},s=p1o[n];return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:!0,onClick:l,children:o}),i&&h.jsx(t,{wall:e,dataType:n,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?Y.t(s.unit,r):void 0,setDialogVisible:a})]})},g1o=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"parapet-checkbox",label:h.jsx(i1o,{wall:t})}),t.parapet.display&&n.push({type:"divider"},{key:"parapet-color",label:h.jsxs(eo,{noPadding:!0,Dialog:f1o,children:[Y.t("wallMenu.ParapetColor",e)," ..."]})},{key:"parapet-texture",label:h.jsxs(eo,{noPadding:!0,Dialog:h1o,children:[Y.t("wallMenu.ParapetTexture",e)," ..."]})},{key:"parapet-height",label:h.jsxs(Jae,{wall:t,dataType:w_.ParapetHeight,Dialog:Xae,children:[Y.t("wallMenu.ParapetHeight",e)," ..."]})},{key:"copings-height",label:h.jsxs(Jae,{wall:t,dataType:w_.CopingsHeight,Dialog:Xae,children:[Y.t("wallMenu.CopingsHeight",e)," ..."]})},{key:"copings-width",label:h.jsxs(Jae,{wall:t,dataType:w_.CopingsWidth,Dialog:Xae,children:[Y.t("wallMenu.CopingsWidth",e)," ..."]})}),n},dC=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=M(Kn),s=M(En),c=M(g3),u=M(no),d=M(Qn),f=M(pn),p=m.useRef(t[n]),g=$t(),A=R=>{f(H=>{switch(n){case"ly":H.actionState.wallThickness=R;break;case"lz":H.actionState.wallHeight=R;break;case"opacity":H.actionState.wallOpacity=R;break;case"structureSpacing":H.actionState.wallStructureSpacing=R;break;case"structureWidth":H.actionState.wallStructureWidth=R;break;case"eavesLength":H.actionState.wallEavesLength=R;break}})},y=(R,H)=>{f(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Wall&&!E.locked){E[n]=H;break}}),A(H)},S=R=>{const H=ye.getAllConnectedWalls(t);H.length!==0&&(f(F=>{for(const E of H)if(!E.locked)for(const N of F.elements)N.id===E.id&&N.type===z.Wall&&(N[n]=R)}),A(R))},C=(R,H)=>{f(F=>{for(const E of F.elements)E.parentId===R&&E.type===z.Wall&&!E.locked&&(E[n]=H)}),A(H)},P=R=>{f(H=>{for(const F of H.elements)F.type===z.Wall&&!F.locked&&(F[n]=R)}),A(R)},v=(R,H)=>{f(F=>{for(const E of F.elements)E.type===z.Wall&&!E.locked&&R.has(E.id)&&(E[n]=H)}),A(H)},T=R=>{switch(c){case re.AllSelectedObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break}case re.AllObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H[n]&&!H.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of l)if(H.type===z.Wall&&H.foundationId===t.foundationId&&R!==H[n]&&!H.locked)return!0;break}case re.AllConnectedObjects:{const H=ye.getAllConnectedWalls(t);for(const F of H)if(R!==F[n]&&!F.locked)return!0;break}default:{if(R!==t[n])return!0;break}}return!1},w=R=>{if(t&&T(R))switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E[n]);const F={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{v(F.oldValues,F.newValue)}};s(F),v(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.newValue)}};s(F),P(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const H=new Map;for(const E of l)E.type===z.Wall&&E.foundationId===t.foundationId&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&C(F.groupId,F.newValue)}};s(F),C(t.foundationId,R),d(u+1)}break;case re.AllConnectedObjects:if(t){const H=ye.getAllConnectedWalls(t),F=new Map;for(const N of H)F.set(N.id,N[n]);const E={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:F,newValue:R,undo:()=>{for(const[N,U]of E.oldValues.entries())y(N,U)},redo:()=>{S(E.newValue)}};s(E),S(R),d(u+1)}break;default:if(t){const H=t[n],F={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(F.changedElementId,F.oldValue)},redo:()=>{y(F.changedElementId,F.newValue)}};s(F),y(t.id,R),d(u+1)}}},x=()=>{p.current=t[n],a(!1)},b=()=>{w(p.current)};return h.jsx(so,{width:550,title:Y.t(`wallMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [",o.toString(),"] ",i]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",g)})]})})})]})})},fC=({Dialog:t,noPadding:e,dataType:n,children:o})=>{const r=$t(),[i,a]=m.useState(!1),l=uo(z.Wall),s=()=>{M.getState().setApplyCount(0),a(!0)},c=S1o[n];return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:e,onClick:s,children:o}),i&&l&&h.jsx(t,{wall:l,dataType:n,attributeKey:c.attributeKey,range:c.range,step:c.step,unit:c.unit?Y.t(c.unit,r):void 0,setDialogVisible:a})]})},m1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),[c,u]=ZZ((s==null?void 0:s.structureColor)??"#ffffff"),d=$t(),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.id===T&&b.type===z.Wall&&!b.locked){b.structureColor=w;break}})},p=T=>{if(!s)return;const w=ye.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.structureColor=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.parentId===T&&b.type===z.Wall&&!b.locked&&(b.structureColor=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.structureColor=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.structureColor&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.structureColor&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.structureColor&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=ye.getAllConnectedWalls(s);for(const x of w)if(T!==x.structureColor&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.structureColor))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break;case re.AllConnectedObjects:if(s){const w=ye.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Structure Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1)}break;default:if(s){const w=l(s.id),x=(w==null?void 0:w.structureColor)??s.structureColor??"#ffffff",b={name:"Set Structure Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}}e(w=>{w.actionState.wallStructureColor=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:640,title:Y.t("wallMenu.StructureColor",d),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:u})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})};var eg=(t=>(t.Height="Height",t.Opacity="Opacity",t.StructureSpacing="StructureSpacing",t.StructureWidth="StructureWidth",t.Thickness="Thickness",t.EavesLength="EavesLength",t))(eg||{});const y1o=t=>{const e=[],n={lng:M.getState().language};return e.push({key:"wall-structure-submenu-radio-group",label:h.jsx(a1o,{wall:t}),style:{backgroundColor:"white"}}),t.wallStructure!==gc.Default&&e.push({type:"divider"},{key:"wall-structure-spacing",label:h.jsxs(fC,{noPadding:!0,dataType:eg.StructureSpacing,Dialog:dC,children:[Y.t(`wallMenu.${eg.StructureSpacing}`,n)," ..."]})},{key:"wall-structure-width",label:h.jsxs(fC,{noPadding:!0,dataType:eg.StructureWidth,Dialog:dC,children:[Y.t(`wallMenu.${eg.StructureWidth}`,n)," ..."]})},{key:"wall-structure-color",label:h.jsxs(eo,{noPadding:!0,Dialog:m1o,children:[Y.t("wallMenu.StructureColor",n)," ..."]})}),e},A1o=t=>{const e=[];return e.push({key:"wall-fill-radio-group",label:h.jsx(s1o,{wall:t}),style:{backgroundColor:"white"}}),t.fill!==Fl.Full&&e.push({type:"divider"},{key:"wall-open-to-outside-checkbox",label:h.jsx(c1o,{wall:t})}),e},w1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.rValue)??p6),[d,f]=m.useState(ye.toRValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.rValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:{for(const w of e)if(w.type===z.Wall&&T!==w.rValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of e)if(w.type===z.Wall&&T!==w.rValue&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of e)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.rValue&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=ye.getAllConnectedWalls(s);for(const x of w)if(T!==x.rValue&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.rValue))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Wall&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Wall&&!b.locked){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s!=null&&s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Wall&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;case re.AllConnectedObjects:if(s){const w=ye.getAllConnectedWalls(s),x=new Map;for(const R of w)if(!R.locked){const H=R;x.set(R.id,H.rValue??p6),g(H.id,T)}const b={name:"Set R-Value for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{A(b.oldValues)},redo:()=>{y(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const x=a(s.id).rValue??s.rValue??p6,b={name:"Set Wall R-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.wallRValue=T})}},P=()=>{u((s==null?void 0:s.rValue)??p6),t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.RValue",p)+" "}(${Y.t("word.ThermalResistance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(ye.toRValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(ye.toRValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",p)})]})})})]})})},v1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Wall&&P!==T.volumetricHeatCapacity&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Wall&&P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Wall&&T.foundationId===s.foundationId&&P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;case re.AllConnectedObjects:const v=ye.getAllConnectedWalls(s);for(const T of v)if(P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Wall&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Wall&&!w.locked){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for All Walls",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s!=null&&s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Wall&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break}case re.AllConnectedObjects:{if(s){const v=ye.getAllConnectedWalls(s),T=new Map;for(const x of v)if(!x.locked){const b=x;T.set(x.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const w={name:"Set Volumetric Heat Capacity for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:P,undo:()=>{p(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),i(r+1)}break}default:{if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Wall",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}break}}l(v=>{v.actionState.wallVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setWallActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})},x1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=$t(),c=uo(z.Wall),[u,d]=m.useState((c==null?void 0:c.textureType)??Bo.Default),{Option:f}=Uo,p=(w,x)=>{e(b=>{for(const R of b.elements)if(R.type===z.Wall&&R.id===w&&!R.locked){R.textureType=x;break}})},g=w=>{if(!c)return;const x=ye.getAllConnectedWalls(c);x.length!==0&&e(b=>{for(const R of x)if(!R.locked)for(const H of b.elements)H.id===R.id&&H.type===z.Wall&&(H.textureType=w)})},A=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&R.foundationId===w&&!R.locked&&(R.textureType=x)})},y=w=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&(b.textureType=w)})},S=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&!R.locked&&w.has(R.id)&&(R.textureType=x)})},C=w=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.textureType&&!x.locked&&M.getState().selectedElementIdSet.has(x.id))return!0;break}case re.AllObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.textureType&&!x.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const x of n)if(x.type===z.Wall&&x.foundationId===c.foundationId&&w!==x.textureType&&!x.locked)return!0;break}case re.AllConnectedObjects:{const x=ye.getAllConnectedWalls(c);for(const b of x)if(w!==b.textureType&&!b.locked)return!0;break}default:{if(w!==(c==null?void 0:c.textureType))return!0;break}}return!1}},P=w=>{if(c&&C(w)){switch(r){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.textureType??Bo.Default);const b={name:"Set Texture for Selected Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{S(b.oldValues,b.newValue)}};o(b),S(x,w),a(i+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&x.set(R.id,R.textureType??Bo.Default);const b={name:"Set Texture for All Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{y(b.newValue)}};o(b),y(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const x=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===c.foundationId&&!R.locked&&x.set(R.id,R.textureType);const b={name:"Set Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:c.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{b.groupId&&A(b.groupId,b.newValue)}};o(b),A(c.foundationId,w),a(i+1)}break;case re.AllConnectedObjects:if(c){const x=ye.getAllConnectedWalls(c),b=new Map;for(const H of x)b.set(H.id,H.textureType);const R={name:"Set Texture for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:w,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{g(R.newValue)}};o(R),g(w),a(i+1)}break;default:if(c){const x=l(c.id),b=(x==null?void 0:x.textureType)??c.textureType,R={name:"Set Texture of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(c.id,w),a(i+1)}}e(x=>{x.actionState.wallTexture=w})}},v=()=>{t(!1)},T=()=>{P(u)};return h.jsx(so,{width:550,title:Y.t("word.Texture",s),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(f,{value:Bo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",s)]},Bo.NoTexture),h.jsxs(f,{value:Bo.Default,children:[h.jsx("img",{alt:Bo.Default,src:Uye,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.TextureDefault",s)]},Bo.Default),h.jsxs(f,{value:Bo.Texture01,children:[h.jsx("img",{alt:Bo.Texture01,src:Prt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture01",s)]},Bo.Texture01),h.jsxs(f,{value:Bo.Texture02,children:[h.jsx("img",{alt:Bo.Texture02,src:Crt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture02",s)]},Bo.Texture02),h.jsxs(f,{value:Bo.Texture03,children:[h.jsx("img",{alt:Bo.Texture03,src:Rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture03",s)]},Bo.Texture03),h.jsxs(f,{value:Bo.Texture04,children:[h.jsx("img",{alt:Bo.Texture04,src:Hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture04",s)]},Bo.Texture04),h.jsxs(f,{value:Bo.Texture05,children:[h.jsx("img",{alt:Bo.Texture05,src:Mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture05",s)]},Bo.Texture05),h.jsxs(f,{value:Bo.Texture06,children:[h.jsx("img",{alt:Bo.Texture06,src:Irt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture06",s)]},Bo.Texture06),h.jsxs(f,{value:Bo.Texture07,children:[h.jsx("img",{alt:Bo.Texture07,src:zrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture07",s)]},Bo.Texture07),h.jsxs(f,{value:Bo.Texture08,children:[h.jsx("img",{alt:Bo.Texture08,src:Drt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture08",s)]},Bo.Texture08),h.jsxs(f,{value:Bo.Texture09,children:[h.jsx("img",{alt:Bo.Texture09,src:Ert,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture09",s)]},Bo.Texture09),h.jsxs(f,{value:Bo.Texture10,children:[h.jsx("img",{alt:Bo.Texture10,src:Frt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture10",s)]},Bo.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:w=>M.getState().setWallActionScope(w.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",s)})]})})})]})})},b1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),c=$t(),[u,d]=ZZ((s==null?void 0:s.color)??"#ffffff"),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Wall&&b.id===T&&!b.locked){b.color=w;break}})},p=T=>{if(!s)return;const w=ye.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.color=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&b.foundationId===T&&!b.locked&&(b.color=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.color=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.color&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.color&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.color&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=ye.getAllConnectedWalls(s);for(const x of w)if(T!==x.color&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.color))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break}case re.AllConnectedObjects:{const w=ye.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1);break}default:{if(s){const w=l(s.id),x=(w==null?void 0:w.color)??s.color??"#ffffff",b={name:"Set Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}break}}e(w=>{w.actionState.wallColor=T})}},P=()=>{t(!1)},v=()=>{C(u)};return h.jsx(so,{width:640,title:Y.t("wallMenu.Color",c),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u,onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",c)})]})})})]})})},S1o={Height:{attributeKey:"lz",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},Opacity:{attributeKey:"opacity",range:[0,1],step:.01},StructureSpacing:{attributeKey:"structureSpacing",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},StructureWidth:{attributeKey:"structureWidth",range:[.01,1],step:.1,unit:"word.MeterAbbreviation"},Thickness:{attributeKey:"ly",range:[.1,1],step:.01,unit:"word.MeterAbbreviation"},EavesLength:{attributeKey:"eavesLength",range:[-.1,5],step:.01,unit:"word.MeterAbbreviation"},ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},T1o=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(ye.isLegalOnWall(e.type))return!0}return!1},P1o=t=>{const e=[];if(t.type!==z.Wall)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1);return T1o()&&e.push({key:"wall-paste",label:h.jsx(oM,{})}),e.push({key:"wall-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"wall-cut",label:h.jsx(kd,{})}),e.push({key:"wall-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(a.gotSome()&&e.push({key:"lock-unlock-clear-on-wall",label:h.jsx(an,{children:Y.t("word.Elements",r)}),children:d1o(n,a,l)}),e.push({key:"wall-parapet",label:h.jsx(an,{children:Y.t("wallMenu.Parapet",r)}),children:g1o(n)}),e.push({key:"wall-structure",label:h.jsx(an,{children:Y.t("wallMenu.WallStructure",r)}),children:y1o(n)}),n.wallStructure!==gc.Default&&e.push({key:"wall-opacity",label:h.jsxs(fC,{dataType:eg.Opacity,Dialog:dC,children:[Y.t(`wallMenu.${eg.Opacity}`,r)," ..."]})}),e.push({key:"wall-fill",label:h.jsx(an,{children:Y.t("wallMenu.Fill",r)}),children:A1o(n)},{key:"add-polygon-on-wall",label:h.jsx(l1o,{wall:n})},{key:"wall-thickness",label:h.jsxs(fC,{dataType:eg.Thickness,Dialog:dC,children:[Y.t(`wallMenu.${eg.Thickness}`,r)," ..."]})},{key:"wall-height",label:h.jsxs(fC,{dataType:eg.Height,Dialog:dC,children:[Y.t(`wallMenu.${eg.Height}`,r)," ..."]})},{key:"wall-eaves-length",label:h.jsxs(fC,{dataType:eg.EavesLength,Dialog:dC,children:[Y.t(`wallMenu.${eg.EavesLength}`,r)," ..."]})},{key:"wall-r-value",label:h.jsxs(eo,{Dialog:w1o,children:[Y.t("word.RValue",r)," ..."]})},{key:"wall-heat-capacity",label:h.jsxs(eo,{Dialog:v1o,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"wall-texture",label:h.jsxs(eo,{Dialog:x1o,children:[Y.t("wallMenu.Texture",r)," ..."]})},{key:"wall-color",label:h.jsxs(eo,{Dialog:b1o,children:[Y.t("wallMenu.Color",r)," ..."]})})),{items:e}},C1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.filled=i;break}})},o=r=>{const i=r.target.checked,a={name:"Filled Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.doorFilled=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:Y.t("doorMenu.Filled",e)})})}),R1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.doorInterior=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.interior,onChange:o,children:Y.t("doorMenu.Interior",e)})})}),H1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.doorType=i;break}})},o=r=>{const i={name:"Select Door Type",timestamp:Date.now(),oldValue:t.doorType,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value),M.getState().set(a=>{a.actionState.doorType=r.target.value})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.doorType,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Rd.Default,children:Y.t("doorMenu.Default",e)}),h.jsx(Le,{style:{width:"100%"},value:Rd.Arched,children:Y.t("doorMenu.Arched",e)})]})})})}),M1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=M(Gr),c=uo(z.Door),u=m.useMemo(()=>{const x=c?c.lx:1,b=c?s(c):null;return b?x*b.lx:x},[c==null?void 0:c.lx]),[d,f]=m.useState(u),p=$t(),g=(x,b)=>{l(R=>{for(const H of R.elements)if(H.id===x&&H.type===z.Door){const F=H,E=s(F);F.lx=E?b/E.lx:b;break}})},A=x=>{for(const[b,R]of x.entries())g(b,R)},y=(x,b)=>{for(const R of x.keys())g(R,b)},S=x=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.AllObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of e)if(b.type===z.Door&&b.foundationId===c.foundationId&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.OnlyThisSide:{for(const b of e)if(b.type===z.Door&&b.parentId===c.parentId&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}default:{const b=s(c);if(b&&x!==c.lx*b.lx)return!0;break}}return!1}},C=x=>{if(c&&S(x))switch(o){case re.AllSelectedObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for Selected Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.foundationId===c.foundationId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case re.OnlyThisSide:if(c.parentId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.parentId===c.parentId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors On the Same Wall",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.parentId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const b=a(c.id),R=c?s(b):null,H=(b.lx??c.lx??.1)*(R?R.lx:1),F={name:"Set Door Width",timestamp:Date.now(),oldValue:H,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};n(F),g(c.id,x),i(r+1)}}},P=()=>{t(!1)},v=()=>{C(d)},T=c?s(c):null,w=T&&c?2*T.lx*Math.min(Math.abs(.5-c.cx),Math.abs(-.5-c.cx)):100;return h.jsx(so,{width:550,title:Y.t("word.Width",p),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:w,style:{width:120},step:.1,precision:2,value:d,formatter:x=>Number(x).toFixed(2),onChange:x=>f(x)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, ",w.toFixed(1),"]",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x=>M.getState().setDoorActionScope(x.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},I1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=M(Gr),c=uo(z.Door),u=m.useMemo(()=>{const x=c?c.lz:1,b=c?s(c):null;return b?x*b.lz:x},[c==null?void 0:c.lz]),[d,f]=m.useState(u),p=$t(),g=(x,b)=>{l(R=>{for(const H of R.elements)if(H.id===x&&H.type===z.Door){const F=H,E=s(F);F.lz=E?b/E.lz:b,E&&(F.cz=-(E.lz-b)/(2*E.lz));break}})},A=x=>{for(const[b,R]of x.entries())g(b,R)},y=(x,b)=>{for(const R of x.keys())g(R,b)},S=x=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.AllObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of e)if(b.type===z.Door&&b.foundationId===c.foundationId&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.OnlyThisSide:{for(const b of e)if(b.type===z.Door&&b.parentId===c.parentId&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}default:{const b=s(c);if(b&&x!==c.lz*b.lz)return!0;break}}return!1}},C=x=>{if(c&&S(x))switch(o){case re.AllSelectedObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for Selected Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.foundationId===c.foundationId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case re.OnlyThisSide:if(c.parentId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.parentId===c.parentId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors On the Same Wall",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.parentId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const b=a(c.id),R=c?s(b):null,H=(b.lz??c.lz??.2)*(R?R.lz:1),F={name:"Set Door Height",timestamp:Date.now(),oldValue:H,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};n(F),g(c.id,x),i(r+1)}}},P=()=>{f(u),t(!1)},v=()=>{C(d)},T=c?s(c):null,w=(T==null?void 0:T.lz)??20;return h.jsx(so,{width:550,title:Y.t("word.Height",p),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:w,style:{width:120},step:.1,precision:2,value:d,formatter:x=>Number(x).toFixed(2),onChange:x=>{x!==null&&f(x)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, ",w.toFixed(1),"]",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x=>M.getState().setDoorActionScope(x.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},z1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.opacity)??1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.opacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.opacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.opacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===s.foundationId&&P!==v.opacity&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===s.parentId&&P!==v.opacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.parentId===s.parentId&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).opacity??s.opacity??1,w={name:"Set Opacity of Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.doorOpacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("wallMenu.Opacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},D1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.uValue)??J4),[d,f]=m.useState(ye.toUValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.uValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Door&&T!==w.uValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Door&&T!==w.uValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Door&&w.foundationId===s.foundationId&&T!==w.uValue&&!w.locked)return!0;break;case re.OnlyThisSide:for(const w of e)if(w.type===z.Door&&w.parentId===s.parentId&&T!==w.uValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for Selected Doors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&R.foundationId===s.foundationId&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&R.parentId===s.parentId&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors On the Same Wall",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.parentId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;default:if(s){const x=a(s.id).uValue??s.uValue??J4,b={name:"Set Door U-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.doorUValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.UValue",p)+" "}(${Y.t("word.ThermalTransmittance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(ye.toUValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(ye.toUValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setDoorActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},E1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.volumetricHeatCapacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.parentId===s.parentId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.doorVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},F1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(pn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.textureType)??sr.Default),d=$t(),{Option:f}=Uo,p=(v,T)=>{a(w=>{for(const x of w.elements)if(x.id===v){x.locked||(x.textureType=T);break}})},g=(v,T)=>{for(const w of v.keys())p(w,T)},A=v=>{for(const[T,w]of v.entries())p(T,w)},y=v=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Door&&v!==T.textureType&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Door&&v!==T.textureType&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Door&&T.foundationId===s.foundationId&&v!==T.textureType&&!T.locked)return!0;break;case re.OnlyThisSide:for(const T of e)if(T.type===z.Door&&T.parentId===s.parentId&&v!==T.textureType&&!T.locked)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0;break}return!1}},S=v=>{if(s&&y(v)){switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??sr.Default);const w={name:"Set Texture for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&!x.locked&&T.set(x.id,x.textureType??sr.Default);const w={name:"Set Texture for All Doors",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.foundationId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&x.parentId===s.parentId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.parentId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;default:if(s){const T=l(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Door",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(s.id,v),i(r+1)}}a(T=>{T.actionState.doorTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:v=>u(v),children:[h.jsxs(f,{value:sr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},sr.NoTexture),h.jsxs(f,{value:sr.Default,children:[h.jsx("img",{alt:sr.Default,src:Y$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.TextureDefault",d)]},sr.Default),h.jsxs(f,{value:sr.Texture01,children:[h.jsx("img",{alt:sr.Texture01,src:O$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture01",d)]},sr.Texture01),h.jsxs(f,{value:sr.Texture02,children:[h.jsx("img",{alt:sr.Texture02,src:ude,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture02",d)]},sr.Texture02),h.jsxs(f,{value:sr.Texture03,children:[h.jsx("img",{alt:sr.Texture03,src:V$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture03",d)]},sr.Texture03),h.jsxs(f,{value:sr.Texture04,children:[h.jsx("img",{alt:sr.Texture04,src:_$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture04",d)]},sr.Texture04),h.jsxs(f,{value:sr.Texture05,children:[h.jsx("img",{alt:sr.Texture05,src:G$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture05",d)]},sr.Texture05),h.jsxs(f,{value:sr.Texture06,children:[h.jsx("img",{alt:sr.Texture06,src:X$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture06",d)]},sr.Texture06),h.jsxs(f,{value:sr.Texture07,children:[h.jsx("img",{alt:sr.Texture07,src:J$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture07",d)]},sr.Texture07),h.jsxs(f,{value:sr.Texture08,children:[h.jsx("img",{alt:sr.Texture08,src:K$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture08",d)]},sr.Texture08),h.jsxs(f,{value:sr.Texture09,children:[h.jsx("img",{alt:sr.Texture09,src:q$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture09",d)]},sr.Texture09),h.jsxs(f,{value:sr.Texture10,children:[h.jsx("img",{alt:sr.Texture10,src:$$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture10",d)]},sr.Texture10),h.jsxs(f,{value:sr.Texture11,children:[h.jsx("img",{alt:sr.Texture11,src:Q$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture11",d)]},sr.Texture11),h.jsxs(f,{value:sr.Texture12,children:[h.jsx("img",{alt:sr.Texture12,src:Z$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture12",d)]},sr.Texture12),h.jsxs(f,{value:sr.Texture13,children:[h.jsx("img",{alt:sr.Texture13,src:eQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture13",d)]},sr.Texture13),h.jsxs(f,{value:sr.Texture14,children:[h.jsx("img",{alt:sr.Texture14,src:tQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture14",d)]},sr.Texture14),h.jsxs(f,{value:sr.Texture15,children:[h.jsx("img",{alt:sr.Texture15,src:nQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture15",d)]},sr.Texture15),h.jsxs(f,{value:sr.Texture16,children:[h.jsx("img",{alt:sr.Texture16,src:oQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture16",d)]},sr.Texture16),h.jsxs(f,{value:sr.Texture17,children:[h.jsx("img",{alt:sr.Texture17,src:rQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture17",d)]},sr.Texture17)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:v=>M.getState().setDoorActionScope(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},k1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Ww),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.color)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.color=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Door&&P!==v.color&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Door&&P!==v.color&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&P!==v.color&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of n)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&P!==v.color&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.parentId===s.parentId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.color:s.color)??"#ffffff",w={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.doorColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("word.Color",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},L1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Ww),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.frameColor)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){!w.locked&&w.type===z.Door&&(w.frameColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Door&&!v.locked&&M.getState().selectedElementIdSet.has(v.id)&&P!==v.frameColor)return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Door&&!v.locked&&P!==v.frameColor)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&!v.locked&&P!==v.frameColor)return!0;break;case re.OnlyThisSide:for(const v of n)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&!v.locked&&P!==v.frameColor)return!0;break;default:if(P!==(s==null?void 0:s.frameColor))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.parentId===s.parentId&&!s.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.frameColor:s.frameColor)??"#ffffff",w={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.doorColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("doorMenu.FrameColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c??(s==null?void 0:s.frameColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},W1o=t=>{const e=[];if(t.type!==z.Door)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"door-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"door-cut",label:h.jsx(kd,{})}),e.push({key:"door-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"door-filled",label:h.jsx(C1o,{door:n})},{key:"door-interior",label:h.jsx(R1o,{door:n})}),e.push({key:"door-type-submenu",label:h.jsx(an,{children:Y.t("doorMenu.DoorType",r)}),children:[{key:"door-type-radio-group",label:h.jsx(H1o,{door:n}),style:{backgroundColor:"white"}}]},{key:"door-width",label:h.jsxs(eo,{Dialog:M1o,children:[Y.t("word.Width",r)," ..."]})},{key:"door-height",label:h.jsxs(eo,{Dialog:I1o,children:[Y.t("word.Height",r)," ..."]})}),n.filled&&(e.push({key:"door-u-value",label:h.jsxs(eo,{Dialog:D1o,children:[Y.t("word.UValue",r)," ..."]})},{key:"door-heat-capacity",label:h.jsxs(eo,{Dialog:E1o,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"door-texture",label:h.jsxs(eo,{Dialog:F1o,children:[Y.t("word.Texture",r)," ..."]})},{key:"door-color",label:h.jsxs(eo,{Dialog:k1o,children:[Y.t("word.Color",r)," ..."]})},{key:"door-frame-color",label:h.jsxs(eo,{Dialog:L1o,children:[Y.t("doorMenu.FrameColor",r)," ..."]})}),(n.textureType===sr.Default||n.textureType===sr.NoTexture)&&e.push({key:"door-opacity",label:h.jsxs(eo,{Dialog:z1o,children:[Y.t("wallMenu.Opacity",r)," ..."]})}))),{items:e}},N1o=({windowModel:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,note:a,digit:l,setDialogVisible:s})=>{const c=M(Kn),u=M(En),d=M(MW),f=M(no),p=M(Qn),g=M(pn),A=M(Gr),y=m.useMemo(()=>{const W=t[n],k=A(t);if(k&&t.parentType!==z.Roof){if(n==="lx")return W*k.lx;if(n==="lz")return W*k.lz}return n==="sillWidth"&&W===void 0?.2:W},[n,t]),[S,C]=m.useState(y),P=$t(),v=(W,k,D)=>{const L=A(W);L&&(k==="lx"||k==="lz")?W.parentType===z.Roof?W[k]=D:W[k]=D/L[k]:W[k]=D},T=(W,k)=>{g(D=>{for(const L of D.elements)if(L.id===W){!L.locked&&L.type===z.Window&&v(L,n,k);break}})},w=(W,k)=>{W&&g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&L.parentId===W&&v(L,n,k)})},x=(W,k)=>{W&&g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&L.foundationId===W&&v(L,n,k)})},b=W=>{g(k=>{for(const D of k.elements)!D.locked&&D.type===z.Window&&v(D,n,W)})},R=(W,k)=>{g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&W.has(L.id)&&v(L,n,k)})},H=W=>{for(const[k,D]of W.entries())T(k,D)},F=W=>{switch(d){case re.AllSelectedObjectsOfThisType:{for(const k of c)if(k.type===z.Window&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.AllObjectsOfThisType:{for(const k of c)if(k.type===z.Window&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const k of c)if(k.type===z.Window&&k.foundationId===t.foundationId&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.OnlyThisSide:{for(const k of c)if(k.type===z.Window&&k.parentId===t.parentId&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}default:{const k=A(t);if(k&&t.parentType!==z.Roof){if(n==="lx"){if(W!==t[n]*k.lx)return!0}else if(n==="lz"){if(W!==t[n]*k.lz)return!0}else if(W!==t[n])return!0}else if(W!==t[n])return!0;break}}return!1},E=W=>{if(t&&F(W)){switch(d){case re.AllSelectedObjectsOfThisType:{const k=new Map;for(const L of c)if(L.type===z.Window&&!L.locked&&M.getState().selectedElementIdSet.has(L.id)){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{H(D.oldValues)},redo:()=>{R(D.oldValues,D.newValue)}};u(D),R(k,W),p(f+1);break}case re.AllObjectsOfThisType:{const k=new Map;for(const L of c)if(L.type===z.Window&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{H(D.oldValues)},redo:()=>{b(D.newValue)}};u(D),b(W),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const k=new Map;for(const L of c)if(L.type===z.Window&&L.foundationId===t.foundationId&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:k,newValue:W,groupId:t.foundationId,undo:()=>{H(D.oldValues)},redo:()=>{x(t.foundationId,D.newValue)}};u(D),x(t.foundationId,W),p(f+1)}break;case re.OnlyThisSide:if(t.parentId){const k=new Map;for(const L of c)if(L.type===z.Window&&L.parentId===t.parentId&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows On the Same Parent`,timestamp:Date.now(),oldValues:k,newValue:W,groupId:t.parentId,undo:()=>{H(D.oldValues)},redo:()=>{w(t.parentId,D.newValue)}};u(D),w(t.parentId,W),p(f+1)}break;default:if(t){let k=t[n];const D=A(t);D&&t.parentType!==z.Roof&&(n==="lx"?k*=D.lx:n==="lz"&&(k*=D.lz));const L={name:`Set Window ${e}`,timestamp:Date.now(),oldValue:k,newValue:W,changedElementId:t.id,changedElementType:t.type,undo:()=>{T(L.changedElementId,L.oldValue)},redo:()=>{T(L.changedElementId,L.newValue)}};u(L),T(t.id,W),p(f+1)}}g(k=>{switch(e){case Qh.Width:k.actionState.windowWidth=W;break;case Qh.Height:k.actionState.windowHeight=W;break;case Qh.Opacity:k.actionState.windowOpacity=W;break;case Qh.FrameWidth:k.actionState.windowFrameWidth=W;break;case Qh.SillWidth:k.actionState.windowSillWidth=W;break;case Qh.HorizontalMullionSpacing:k.actionState.windowHorizontalMullionSpacing=W;break;case Qh.VerticalMullionSpacing:k.actionState.windowVerticalMullionSpacing=W;break;case Qh.MullionWidth:k.actionState.windowMullionWidth=W;break}})}},N=()=>{s(!1)},U=()=>{E(S)};return h.jsx(so,{width:550,title:Y.t(`windowMenu.${e}`,P),onApply:U,onClose:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,value:S,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&C(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [",o[0].toFixed(o[0]===0?0:l??0),","," ",o[1].toFixed(l??0),"] ",i," ",h.jsx("br",{}),h.jsx("br",{})," ",a]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:W=>M.getState().setWindowActionScope(W.target.value),value:d,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",P)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",P)})]})})})]})})},U1o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=M(Kn),i=M(pn),a=M(En),l=M(MW),s=M(no),c=M(Qn),[u,d]=ZZ(t[n]??"#ffffff"),f=$t(),p=(x,b)=>{i(R=>{for(const H of R.elements)if(H.id===x){!H.locked&&H.type===z.Window&&(H[n]=b);break}})},g=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.parentId===x&&(H[n]=b)})},A=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.foundationId===x&&(H[n]=b)})},y=x=>{i(b=>{for(const R of b.elements)!R.locked&&R.type===z.Window&&(R[n]=x)})},S=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&x.has(H.id)&&(H[n]=b)})},C=x=>{for(const[b,R]of x.entries())p(b,R)},P=x=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const b of r)if(b.type===z.Window&&x!==b[n]&&!b.locked&&M.getState().selectedElementIdSet.has(b.id))return!0;break;case re.AllObjectsOfThisType:for(const b of r)if(b.type===z.Window&&x!==b[n]&&!b.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of r)if(b.type===z.Window&&b.foundationId===t.foundationId&&x!==b[n]&&!b.locked)return!0;break;case re.OnlyThisSide:for(const b of r)if(b.type===z.Window&&b.parentId===t.parentId&&x!==b[n]&&!b.locked)return!0;break;default:if(x!==t[n])return!0;break}return!1},v=x=>{if(t&&P(x)){switch(l){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{S(R.oldValues,R.newValue)}};a(R),S(b,x),c(s+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{y(R.newValue)}};a(R),y(x),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const b=new Map;for(const H of r)H.type===z.Window&&H.foundationId===t.foundationId&&!t.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{A(R.groupId,R.newValue)}};a(R),A(t.foundationId,x),c(s+1)}break}case re.OnlyThisSide:{if(t.parentId){const b=new Map;for(const H of r)H.type===z.Window&&H.parentId===t.parentId&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{g(t.parentId,R.newValue)}};a(R),g(t.parentId,x),c(s+1)}break}default:{if(t){const b=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,x),c(s+1)}break}}i(b=>{switch(e){case Qh.Tint:b.actionState.windowTint=x;break;case Qh.MullionColor:b.actionState.windowMullionColor=x;break;case Qh.Color:b.actionState.windowColor=x;break}})}},T=()=>{o()},w=()=>{t[n]!==u&&v(u)};return h.jsx(so,{width:640,title:Y.t(`windowMenu.${e}`,f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u??"#73D8FF",onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:x=>M.getState().setWindowActionScope(x.target.value),value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",f)})]})})})]})})},j1o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=M(Kn),i=M(pn),a=M(En),l=M(MW),s=M(no),c=M(Qn),[u,d]=m.useState(t[n]),f=$t(),p=(x,b)=>{i(R=>{for(const H of R.elements)if(H.id===x&&!H.locked&&H.type===z.Window){H[n]=b;break}})},g=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.parentId===x&&(H[n]=b)})},A=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.foundationId===x&&(H[n]=b)})},y=x=>{i(b=>{for(const R of b.elements)!R.locked&&R.type===z.Window&&(R[n]=x)})},S=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&x.has(H.id)&&(H[n]=b)})},C=x=>{for(const[b,R]of x.entries())p(b,R)},P=x=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const b of r)if(b.type===z.Window&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b[n]!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of r)if(b.type===z.Window&&!b.locked&&b[n]!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of r)if(b.type===z.Window&&b.foundationId===t.foundationId&&!b.locked&&b[n]!==x)return!0;break;case re.OnlyThisSide:for(const b of r)if(b.type===z.Window&&b.parentId===t.parentId&&!b.locked&&b[n]!==x)return!0;break;default:if(t[n]!==x)return!0;break}return!1},v=x=>{if(t&&P(x))switch(l){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{S(R.oldValues,R.newValue)}};a(R),S(b,x),c(s+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{y(R.newValue)}};a(R),y(x),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const b=new Map;for(const H of r)H.type===z.Window&&H.foundationId===t.foundationId&&!t.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{A(R.groupId,R.newValue)}};a(R),A(t.foundationId,x),c(s+1)}break}case re.OnlyThisSide:{if(t.parentId){const b=new Map;for(const H of r)H.type===z.Window&&H.parentId===t.parentId&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{g(t.parentId,R.newValue)}};a(R),g(t.parentId,x),c(s+1)}break}default:{if(t){const b=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,x),c(s+1)}break}}},T=()=>{o()},w=()=>{t[n]!==u&&v(u)};return h.jsx(so,{width:500,title:Y.t(`windowMenu.${e}`,f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:u,onChange:x=>{d(x)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:x=>M.getState().setWindowActionScope(x.target.value),value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",f)})]})})})]})})},{Option:B1o}=Uo,Y1o=({window:t,dataType:e,attributeKey:n,options:o,optionsText:r,setDialogVisible:i})=>{const a=M(Kn),l=M(pn),s=M(En),c=M(MW),u=M(no),d=M(Qn),[f,p]=m.useState(t[n]),g=$t(),A=(R,H)=>{l(F=>{for(const E of F.elements)if(E.id===R){!E.locked&&E.type===z.Window&&(E[n]=H);break}})},y=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&E.parentId===R&&(E[n]=H)})},S=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&E.foundationId===R&&(E[n]=H)})},C=R=>{l(H=>{for(const F of H.elements)!F.locked&&F.type===z.Window&&(F[n]=R)})},P=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&R.has(E.id)&&(E[n]=H)})},v=R=>{for(const[H,F]of R.entries())A(H,F)},T=R=>{if(t){switch(c){case re.AllSelectedObjectsOfThisType:for(const H of a)if(H.type===z.Window&&R!==H[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break;case re.AllObjectsOfThisType:for(const H of a)if(H.type===z.Window&&R!==H[n]&&!H.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of a)if(H.type===z.Window&&H.foundationId===t.foundationId&&R!==H[n]&&!H.locked)return!0;break;case re.OnlyThisSide:for(const H of a)if(H.type===z.Window&&H.parentId===t.parentId&&R!==H[n]&&!H.locked)return!0;break;default:if(R!==t[n])return!0;break}return!1}},w=R=>{if(t&&T(R)){switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of a)E.type===z.Window&&!E.locked&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E[n]);const F={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{v(F.oldValues)},redo:()=>{P(F.oldValues,F.newValue)}};s(F),P(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of a)E.type===z.Window&&!E.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{v(F.oldValues)},redo:()=>{C(F.newValue)}};s(F),C(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const H=new Map;for(const E of a)E.type===z.Window&&E.foundationId===t.foundationId&&!t.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{v(F.oldValues)},redo:()=>{S(F.groupId,F.newValue)}};s(F),S(t.foundationId,R),d(u+1)}break}case re.OnlyThisSide:{if(t.parentId){const H=new Map;for(const E of a)E.type===z.Window&&E.parentId===t.parentId&&!E.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.parentId,undo:()=>{v(F.oldValues)},redo:()=>{y(t.parentId,F.newValue)}};s(F),y(t.parentId,R),d(u+1)}break}default:{if(t){const H=t[n],F={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{A(F.changedElementId,F.oldValue)},redo:()=>{A(F.changedElementId,F.newValue)}};s(F),A(t.id,R),d(u+1)}break}}l(H=>{switch(e){case Qh.Tint:H.actionState.windowTint=R;break;case Qh.MullionColor:H.actionState.windowMullionColor=R;break;case Qh.Color:H.actionState.windowColor=R;break}})}},x=()=>{i()},b=()=>{w(f)};return h.jsx(so,{width:560,title:Y.t(`windowMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsx(Uo,{style:{width:"150px"},value:f,onChange:R=>p(R),children:o.map((R,H)=>h.jsx(B1o,{value:R,children:r[H]},R))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWindowActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",g)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",g)})]})})})]})})};var wg=(t=>(t.Opacity="Opacity",t.Width="Width",t.Height="Height",t.Setback="Setback",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionWidth="MullionWidth",t.SillWidth="SillWidth",t.FrameWidth="FrameWidth",t.ShutterWidth="ShutterWidth",t))(wg||{}),tU=(t=>(t.ShutterColor="ShutterColor",t.Color="Color",t.MullionColor="MullionColor",t.Tint="Tint",t))(tU||{}),$R=(t=>(t.Frame="Frame",t.LeftShutter="LeftShutter",t.RightShutter="RightShutter",t.HorizontalMullion="HorizontalMullion",t.VerticalMullion="VerticalMullion",t))($R||{}),krt=(t=>(t.WindowType="WindowType",t))(krt||{});const A9=({dataType:t,noPadding:e})=>{const n=$t(),[o,r]=m.useState(!1),i=uo(z.Window),a=i?M.getState().getParent(i):null,l=()=>{M.getState().setApplyCount(0),r(!0)},s=Z1o[t];return t===wg.Width?s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lx*Math.min(Math.abs(.5-i.cx),Math.abs(-.5-i.cx)):100:t===wg.Height&&(s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lz*Math.min(Math.abs(.5-i.cz),Math.abs(-.5-i.cz)):100),h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:l,children:[Y.t(`windowMenu.${t}`,n)," ..."]}),o&&s&&i&&h.jsx(N1o,{windowModel:i,dataType:t,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?Y.t(s.unit,n):void 0,note:s.note?Y.t(s.note,n):void 0,digit:s.digit??0,setDialogVisible:r})]})},yee=({dataType:t,noPadding:e})=>{const[n,o]=m.useState(!1),r=$t(),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),o(!0)},l=q1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(U1o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},Ok=({dataType:t,noPadding:e})=>{const[n,o]=m.useState(!1),r=$t(),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),o(!0)},l=$1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(j1o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},O1o=({dataType:t,noPadding:e})=>{const n=$t(),[o,r]=m.useState(!1),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),r(!0)},l=Q1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,n)," ..."]}),o&&l&&i&&h.jsx(Y1o,{window:i,dataType:t,attributeKey:l.attributeKey,options:[Ci.Default,Ci.Arched,Ci.Polygonal],optionsText:[Y.t("windowMenu.Default",n),Y.t("windowMenu.Arched",n),Y.t("windowMenu.Polygonal",n)],setDialogVisible:()=>r(!1)})]})},V1o=({window:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.empty=i;break}})},o=r=>{const i=r.target.checked,a={name:"Empty Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.windowEmpty=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.empty,onChange:o,children:Y.t("windowMenu.Empty",e)})})},_1o=({window:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.windowInterior=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.interior,onChange:o,children:Y.t("windowMenu.Interior",e)})})},G1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(MW),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Window),[c,u]=m.useState((s==null?void 0:s.uValue)??X4),[d,f]=m.useState(ye.toUValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.uValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Window&&T!==w.uValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Window&&T!==w.uValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Window&&w.foundationId===s.foundationId&&T!==w.uValue&&!w.locked)return!0;break;case re.OnlyThisSide:for(const w of e)if(w.type===z.Window&&w.parentId===s.parentId&&T!==w.uValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Window&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for Selected Windows",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Window&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Window&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break}case re.OnlyThisSide:{if(s.parentId){const w=new Map;for(const b of e)if(b.type===z.Window&&b.parentId===s.parentId&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows On the Same Wall",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.parentId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break}default:{if(s){const x=a(s.id).uValue??s.uValue??X4,b={name:"Set Window U-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}break}}l(w=>{w.actionState.windowUValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.UValue",p)+" "}(${Y.t("word.ThermalTransmittance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(ye.toUValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toUValueInUS(.01),max:ye.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(ye.toUValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",ye.toUValueInUS(.01).toFixed(3),", ",ye.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWindowActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",p)})]})})})]})})},X1o=t=>{const e=[];return e.push({key:"window-frame-boolean",label:h.jsx(Ok,{noPadding:!0,dataType:$R.Frame})}),t.frame&&e.push({type:"divider"},{key:"window-frame-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.FrameWidth})},{key:"window-sill-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.SillWidth})},{key:"window-frame-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.Color})}),e},J1o=t=>{const e=[];return e.push({key:"window-horizontal-mullion",label:h.jsx(Ok,{noPadding:!0,dataType:$R.HorizontalMullion})},{key:"window-vertical-mullion",label:h.jsx(Ok,{noPadding:!0,dataType:$R.VerticalMullion})}),(t.horizontalMullion||t.verticalMullion)&&(e.push({type:"divider"},{key:"window-mullion-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.MullionWidth})},{key:"window-mullion-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.MullionColor})}),t.horizontalMullion&&e.push({key:"window-horizontal-mullion-spacing",label:h.jsx(A9,{noPadding:!0,dataType:wg.HorizontalMullionSpacing})}),t.verticalMullion&&e.push({key:"window-vertical-mullion-spacing",label:h.jsx(A9,{noPadding:!0,dataType:wg.VerticalMullionSpacing})})),e},K1o=t=>{const e=[];return e.push({key:"window-left-shutter",label:h.jsx(Ok,{noPadding:!0,dataType:$R.LeftShutter})},{key:"window-right-shutter",label:h.jsx(Ok,{noPadding:!0,dataType:$R.RightShutter})}),(t.leftShutter||t.rightShutter)&&e.push({type:"divider"},{key:"window-shutter-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.ShutterColor})},{key:"window-shutter-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.ShutterWidth})}),e};var Qh=(t=>(t.Color="Color",t.Tint="Tint",t.Opacity="Opacity",t.WindowType="WindowType",t.MullionWidth="MullionWidth",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionColor="MullionColor",t.Frame="Frame",t.FrameWidth="FrameWidth",t.SillWidth="SillWidth",t.Width="Width",t.Height="Height",t))(Qh||{});const q1o={Tint:{attributeKey:"tint"},Color:{attributeKey:"color"},MullionColor:{attributeKey:"mullionColor"},ShutterColor:{attributeKey:"shutterColor"}},$1o={HorizontalMullion:{attributeKey:"horizontalMullion"},VerticalMullion:{attributeKey:"verticalMullion"},Frame:{attributeKey:"frame"},LeftShutter:{attributeKey:"leftShutter"},RightShutter:{attributeKey:"rightShutter"}},Q1o={WindowType:{attributeKey:"windowType",options:[Ci.Default,Ci.Arched,Ci.Polygonal]}},Z1o={Opacity:{attributeKey:"opacity",range:[0,.9],step:.1,note:"windowMenu.SolarHeatGainCoefficient",digit:1},Width:{attributeKey:"lx",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Height:{attributeKey:"lz",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Setback:{attributeKey:"cy",range:[0,1],step:.01,unit:"",digit:0,note:"windowMenu.RelativeToWallThickness"},MullionWidth:{attributeKey:"mullionWidth",range:[0,.5],step:.1,unit:"word.MeterAbbreviation",digit:1},ShutterWidth:{attributeKey:"shutterWidth",range:[0,.5],step:.01,unit:"",digit:1},HorizontalMullionSpacing:{attributeKey:"horizontalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},VerticalMullionSpacing:{attributeKey:"verticalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},FrameWidth:{attributeKey:"frameWidth",range:[.05,.2],step:.01,unit:"word.MeterAbbreviation",digit:2},SillWidth:{attributeKey:"sillWidth",range:[0,.5],step:.01,unit:"word.MeterAbbreviation",digit:2}},ego=t=>{const e=[];if(t.type!==z.Window)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"window-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"window-cut",label:h.jsx(kd,{})}),e.push({key:"window-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"window-empty",label:h.jsx(V1o,{window:n})},{key:"window-interior",label:h.jsx(_1o,{window:n})}),o&&e.push({key:"window-type",label:h.jsx(O1o,{dataType:krt.WindowType})},{key:"window-width",label:h.jsx(A9,{dataType:wg.Width})},{key:"window-height",label:h.jsx(A9,{dataType:wg.Height})},{key:"window-setback",label:h.jsx(A9,{dataType:wg.Setback})},{key:"window-opacity",label:h.jsx(A9,{dataType:wg.Opacity})},{key:"window-tint",label:h.jsx(yee,{dataType:tU.Tint})},{key:"window-u-value",label:h.jsxs(eo,{Dialog:G1o,children:[Y.t("word.UValue",r)," ..."]})},{key:"window-mullion-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Mullion",r)}),children:J1o(n)},{key:"window-frame-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Frame",r)}),children:X1o(n)},{key:"window-shutter-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Shutter",r)}),children:K1o(n)}),{items:e}},tgo=({roof:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===r&&s.type===z.Roof);l&&(l.ceiling=i,a.actionState.roofCeiling=i)})},o=r=>{const i=r.target.checked,a={name:"Roof Ceiling",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.ceiling,onChange:o,children:Y.t("roofMenu.Ceiling",e)})})},ngo=({roof:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Roof`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{update:!0,noPadding:!0,onClick:l,children:r})},WHe=({roof:t,objectType:e,lock:n,children:o})=>{const r=M.getState().updateElementLockById,i=M.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of M.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Roof`:`Unlock All Locked ${l} on Roof`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};M.getState().addUndoable(u)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},ogo=({roof:t})=>{const e=$t(),n=M.getState().updateRoofStructureById,o=r=>{const i={name:"Select Roof Structure",timestamp:Date.now(),oldValue:t.roofStructure??Ac.Default,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value),M.getState().set(a=>{a.actionState.roofStructure=r.target.value})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.roofStructure??Ac.Default,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Ac.Default,children:Y.t("roofMenu.DefaultStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:Ac.Rafter,children:Y.t("roofMenu.RafterStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:Ac.Glass,children:Y.t("roofMenu.GlassStructure",e)})]})})})},Kae=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],rgo=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${Y.t("roofMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof",n)} (${e} ${Y.t("roofMenu.SolarPanels",n)})`;break}case z.Window:{o=`${Y.t("roofMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllWindowsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Windows",n)})`;break}case z.Sensor:{o=`${Y.t("roofMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllSensorsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("roofMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllLightsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Lights",n)})`;break}}return{itemLabel:o,modalTitle:r}},qae=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],igo=(t,e,n)=>{const o=[],r={lng:M.getState().language};return Kae.forEach(({key:i,objectType:a})=>{const l=qae(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=rgo(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-roof`,label:h.jsx(ngo,{roof:t,objectType:a,modalTitle:c,children:s})})}}),Kae.forEach(({key:i,objectType:a})=>{const l=qae(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-roof`,label:h.jsxs(WHe,{roof:t,objectType:a,lock:!0,children:[Y.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Kae.forEach(({lockedKey:i,objectType:a})=>{const l=qae(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(WHe,{roof:t,objectType:a,lock:!1,children:[Y.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!0,children:[Y.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!1,children:[Y.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},ago=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.thickness)??.4),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)w.id===P&&(w.thickness=v,T.updateElementOnRoofFlag=!0),w.parentId===P&&w.type===z.Window&&(w.ly=v)})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.thickness&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.thickness&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.thickness&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.thickness))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).thickness??s.thickness??.4,w={name:"Set Roof Thickness",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofThickness=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.Thickness",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.05,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.05, 1] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},lgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=uo(z.Roof),[s,c]=m.useState((l==null?void 0:l.rise)??0),u=$t(),d=(C,P)=>{M.getState().updateRoofRiseById(C,P),M.getState().set(v=>{v.updateElementOnRoofFlag=!0})},f=C=>{for(const[P,v]of C.entries())d(P,v)},p=(C,P)=>{for(const v of C.keys())d(v,P)},g=C=>{if(l){switch(o){case re.AllSelectedObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked&&M.getState().selectedElementIdSet.has(P.id))return!0;break;case re.AllObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const P of e)if(P.type===z.Roof&&P.foundationId===l.foundationId&&C!==P.rise&&!P.locked)return!0;break;default:if(C!==(l==null?void 0:l.rise))return!0;break}return!1}},A=C=>{if(l&&g(C))switch(M.getState().roofActionScope){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Roof&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for Selected Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Roof&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for All Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(l.foundationId){const P=new Map;for(const T of e)T.type===z.Roof&&T.foundationId===l.foundationId&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for All Roofs Above Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:l.foundationId,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1)}break;default:if(l){const P=a(l.id),v=(P==null?void 0:P.rise)??(l==null?void 0:l.rise)??0,T={name:"Set Roof Rise",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:l.id,changedElementType:l.type,undo:()=>{d(T.changedElementId,T.oldValue)},redo:()=>{d(T.changedElementId,T.newValue)}};n(T),d(l.id,C),i(r+1)}}},y=()=>{t(!1)},S=()=>{A(s)};return h.jsx(so,{width:550,title:Y.t("roofMenu.Rise",u),onApply:S,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:200,style:{width:120},step:.1,precision:2,value:s,formatter:C=>Number(C).toFixed(2),onChange:C=>c(C)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",u),": [0, 200] ",Y.t("word.MeterAbbreviation",u)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",u)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:C=>M.getState().setRoofActionScope(C.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",u)})]})})})]})})},sgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rValue)??a8),[d,f]=m.useState(ye.toRValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.rValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Roof&&T!==w.rValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Roof&&T!==w.rValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&T!==w.rValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.rValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Roof&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for Selected Roofs",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Roof&&!b.locked){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for All Roofs",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for All Roofs Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;default:if(s){const x=a(s.id).rValue??s.rValue??a8,b={name:"Set Roof R-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.roofRValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("roofMenu.RoofRValue",p)+" "}(${Y.t("word.ThermalResistance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(ye.toRValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(ye.toRValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setRoofActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",p)})]})})})]})})},cgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.volumetricHeatCapacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},ugo="/aladdin/assets/roof_edge-DBy_1Q5D.png",dgo="/aladdin/assets/roof_01-BwuyLpwq.png",fgo="/aladdin/assets/roof_02-DAbYjnV7.png",hgo="/aladdin/assets/roof_03-haZGIixv.png",pgo="/aladdin/assets/roof_04-DDuwUcDr.png",ggo="/aladdin/assets/roof_05-CtBb5xIW.png",mgo="/aladdin/assets/roof_06-DuyyebV8.png",ygo="/aladdin/assets/roof_07-DXWGQN8a.png",Ago=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(pn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.textureType)??Ur.Default),d=$t(),{Option:f}=Uo,p=(v,T)=>{a(w=>{for(const x of w.elements)if(x.id===v){x.locked||(x.textureType=T);break}})},g=(v,T)=>{for(const w of v.keys())p(w,T)},A=v=>{for(const[T,w]of v.entries())p(T,w)},y=v=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Roof&&v!==T.textureType&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Roof&&v!==T.textureType&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Roof&&T.foundationId===s.foundationId&&v!==T.textureType&&!T.locked)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0;break}return!1}},S=v=>{if(s&&y(v)){switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Roof&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??Ur.Default);const w={name:"Set Texture for Selected Roofs",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Roof&&!x.locked&&T.set(x.id,x.textureType??Ur.Default);const w={name:"Set Texture for All Roofs",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const T=new Map;for(const x of e)x.type===z.Roof&&x.foundationId===s.foundationId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Roofs Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.foundationId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;default:if(s){const T=l(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Roof",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(s.id,v),i(r+1)}}a(T=>{T.actionState.roofTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:v=>u(v),children:[h.jsxs(f,{value:Ur.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},Ur.NoTexture),h.jsxs(f,{value:Ur.Default,children:[h.jsx("img",{alt:Ur.Default,src:ugo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.TextureDefault",d)]},Ur.Default),h.jsxs(f,{value:Ur.Texture01,children:[h.jsx("img",{alt:Ur.Texture01,src:dgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture01",d)]},Ur.Texture01),h.jsxs(f,{value:Ur.Texture02,children:[h.jsx("img",{alt:Ur.Texture02,src:fgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture02",d)]},Ur.Texture02),h.jsxs(f,{value:Ur.Texture03,children:[h.jsx("img",{alt:Ur.Texture03,src:hgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture03",d)]},Ur.Texture03),h.jsxs(f,{value:Ur.Texture04,children:[h.jsx("img",{alt:Ur.Texture04,src:pgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture04",d)]},Ur.Texture04),h.jsxs(f,{value:Ur.Texture05,children:[h.jsx("img",{alt:Ur.Texture05,src:ggo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture05",d)]},Ur.Texture05),h.jsxs(f,{value:Ur.Texture06,children:[h.jsx("img",{alt:Ur.Texture06,src:mgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture06",d)]},Ur.Texture06),h.jsxs(f,{value:Ur.Texture07,children:[h.jsx("img",{alt:Ur.Texture07,src:ygo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture07",d)]},Ur.Texture07)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:v=>M.getState().setRoofActionScope(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},wgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.color)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.color=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.color&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.color&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.color&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of n)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.color:s.color)??"#ffffff",w={name:"Set Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.roofColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},vgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(pn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.sideColor)??"#ffffff"),d=$t(),f=(P,v)=>{n(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.sideColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.sideColor&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.sideColor&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.sideColor&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.sideColor))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.sideColor:s.sideColor)??"#ffffff",w={name:"Set Side Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}n(v=>{v.actionState.roofSideColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofSideColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c??(s==null?void 0:s.sideColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},xgo=({setDialogVisible:t})=>{const e=M(m0),n=M(c3),o=M(En),r=M(sy),i=M(ROe),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),u=M(pn),d=M(W=>{if(n){for(const k of W.elements)if(k.id===n.id)return k}return null}),[f,p]=m.useState((d==null?void 0:d.ceilingRValue)??w6),[g,A]=m.useState(ye.toRValueInUS(f)),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T={lng:e};m.useEffect(()=>{d&&p((d==null?void 0:d.ceilingRValue)??w6)},[d==null?void 0:d.ceilingRValue]);const w=(W,k)=>{u(D=>{for(const L of D.elements)if(L.id===W){L.ceilingRValue=k;break}})},x=W=>{for(const[k,D]of W.entries())w(k,D)},b=(W,k)=>{for(const D of W.keys())w(D,k)},R=W=>{if(d){switch(r){case re.AllObjectsOfThisType:{const k=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&!j.locked){const B=j;k.set(j.id,B.ceilingRValue??w6),B.ceilingRValue=W}});const D={name:"Set R-Value for All Ceilings",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{x(D.oldValues)},redo:()=>{b(D.oldValues,D.newValue)}};o(D),l(a+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const k=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&j.foundationId===d.foundationId&&!j.locked){const B=j;k.set(j.id,B.ceilingRValue??w6),B.ceilingRValue=W}});const D={name:"Set R-Value for All Ceilings Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:d.foundationId,undo:()=>{x(D.oldValues)},redo:()=>{b(D.oldValues,D.newValue)}};o(D),l(a+1)}break}default:{if(d){const D=c(d.id).ceilingRValue??d.ceilingRValue??w6,L={name:"Set Ceiling R-Value",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:d.id,changedElementType:d.type,undo:()=>{w(L.changedElementId,L.oldValue)},redo:()=>{w(L.changedElementId,L.newValue)}};o(L),w(d.id,W),l(a+1)}break}}u(k=>{k.actionState.roofRValue=W})}},H=(W,k)=>{if(v.current){const{clientWidth:D,clientHeight:L}=window.document.documentElement,j=v.current.getBoundingClientRect();P({left:-j.left+k.x,right:D-(j.right-k.x),top:-j.top+k.y,bottom:L-((j==null?void 0:j.bottom)-k.y)})}},F=()=>{p((d==null?void 0:d.ceilingRValue)??w6),t(!1)},E=()=>{F(),s()},N=()=>{R(f),t(!1),l(0)},U=()=>{R(f)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:[Y.t("roofMenu.CeilingRValue",T)+" ","(",Y.t("word.ThermalResistance",T),")"]}),footer:[h.jsx(io,{onClick:U,children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:E,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:N,children:Y.t("word.OK",T)},"OK")],onCancel:F,maskClosable:!1,destroyOnClose:!1,modalRender:W=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(k,D)=>H(k,D),children:h.jsx("div",{ref:v,children:W})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(p(W),A(ye.toRValueInUS(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",T),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:ye.toRValueInUS(.01),max:ye.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:g,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(A(W),p(ye.toRValueInSI(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [",ye.toRValueInUS(.01).toFixed(3),", ",ye.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",T),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:W=>i(W.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisCeiling",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllCeilingsAboveFoundation",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllCeilings",T)})]})})})]})})})},bgo=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"roof-ceiling",label:h.jsx(tgo,{roof:t})}),t.ceiling&&n.push({type:"divider"},{key:"ceiling-r-value",label:h.jsxs(eo,{noPadding:!0,Dialog:xgo,children:[Y.t("roofMenu.CeilingRValue",e)," ..."]})}),n},Sgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterColor)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.rafterColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.rafterColor&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.rafterColor&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterColor&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterColor))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of n)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.rafterColor:s.rafterColor)??"#ffffff",w={name:"Set Rafter Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Tgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterSpacing)??1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.rafterSpacing=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterSpacing&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterSpacing&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterSpacing&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterSpacing))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).rafterSpacing??s.rafterSpacing??1,w={name:"Set Roof Rafter Spacing",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.RafterSpacing",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:100,style:{width:120},step:.1,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.1, 100] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Pgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterWidth)??.1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.rafterWidth=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterWidth&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterWidth&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterWidth&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterWidth))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).rafterWidth??s.rafterWidth??.1,w={name:"Set Roof Rafter Width",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.RafterWidth",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.01, 1] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Cgo=({setDialogVisible:t})=>{const e=M(pn),n=M(c3),o=M(En),r=M(sy),i=M(ROe),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),[u,d]=m.useState((n==null?void 0:n.glassTint)??"#73D8FF"),[f,p]=m.useState(!1),[g,A]=m.useState({left:0,top:0,bottom:0,right:0}),y=m.useRef(null),S=m.useRef(null);m.useEffect(()=>{var E;(E=S.current)==null||E.focus()});const C=$t();m.useEffect(()=>{n&&d((n==null?void 0:n.glassTint)??"#73D8FF")},[n]);const P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.id===E){W.locked||(W.glassTint=N);break}})},v=(E,N)=>{for(const U of E.keys())P(U,N)},T=E=>{for(const[N,U]of E.entries())P(N,U)},w=E=>{if(n)switch(r){case re.AllObjectsOfThisType:{const N=new Map;for(const W of M.getState().elements)W.type===z.Roof&&!W.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{T(U.oldValues)},redo:()=>{v(U.oldValues,U.newValue)}};o(U),v(N,E),l(a+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(n.foundationId){const N=new Map;for(const W of M.getState().elements)W.type===z.Roof&&W.foundationId===n.foundationId&&!n.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs Above Foundation",timestamp:Date.now(),oldValues:N,newValue:E,groupId:n.foundationId,undo:()=>{T(U.oldValues)},redo:()=>{U.groupId&&v(U.oldValues,U.newValue)}};o(U),v(N,E),l(a+1)}break}default:{if(n){const N=c(n.id),U=(N?N.glassTint:n.glassTint)??"#73D8FF",W={name:"Set Glass Tint of Selected Roof",timestamp:Date.now(),oldValue:U,newValue:E,changedElementId:n.id,changedElementType:n.type,undo:()=>{P(W.changedElementId,W.oldValue)},redo:()=>{P(W.changedElementId,W.newValue)}};o(W),P(n.id,E),l(a+1)}break}}},x=(E,N)=>{if(y.current){const{clientWidth:U,clientHeight:W}=window.document.documentElement,k=y.current.getBoundingClientRect();A({left:-k.left+N.x,right:U-(k.right-N.x),top:-k.top+N.y,bottom:W-((k==null?void 0:k.bottom)-N.y)})}},b=()=>{n!=null&&n.glassTint&&d(n.glassTint),t(!1)},R=()=>{b(),s()},H=()=>{const E=c(n.id);E&&E.glassTint!==u&&w(u),t(!1),l(0)},F=()=>{w(u)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:Y.t("roofMenu.GlassTint",C)}),footer:[h.jsx(io,{onClick:F,children:Y.t("word.Apply",C)},"Apply"),h.jsx(io,{onClick:R,children:Y.t("word.Cancel",C)},"Cancel"),h.jsx(io,{type:"primary",ref:S,onClick:H,children:Y.t("word.OK",C)},"OK")],onCancel:b,maskClosable:!1,destroyOnClose:!1,modalRender:E=>h.jsx(Bi,{disabled:!f,bounds:g,onStart:(N,U)=>x(N,U),children:h.jsx("div",{ref:y,children:E})}),children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u??(n==null?void 0:n.glassTint)??"#73D8FF",onChangeComplete:E=>{d(E.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:E=>i(E.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",C)})]})})})]})})})},Rgo=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"roof-structure-radio-group",label:h.jsx(ogo,{roof:t}),style:{backgroundColor:"white"}}),t.roofStructure===Ac.Rafter&&n.push({type:"divider"},{key:"roof-rafter-spacing",label:h.jsxs(eo,{noPadding:!0,Dialog:Tgo,children:[Y.t("roofMenu.RafterSpacing",e)," ..."]})},{key:"roof-rafter-width",label:h.jsxs(eo,{noPadding:!0,Dialog:Pgo,children:[Y.t("roofMenu.RafterWidth",e)," ..."]})},{key:"roof-rafter-color",label:h.jsxs(eo,{noPadding:!0,Dialog:Sgo,children:[Y.t("roofMenu.RafterColor",e)," ..."]})}),t.roofStructure===Ac.Glass&&n.push({type:"divider"},{key:"roof-glass-tint-selection",label:h.jsxs(eo,{noPadding:!0,Dialog:Cgo,children:[Y.t("roofMenu.GlassTint",e)," ..."]})}),n},Hgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.opacity)!==void 0?s.opacity:.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.opacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.opacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.opacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.opacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const v=a(s.id),T=v.opacity!==void 0?v.opacity:s.opacity!==void 0?s.opacity:.5,w={name:"Set Roof Opacity",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofGlassOpacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.Opacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Mgo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0)switch(t[0].type){case z.Window:case z.SolarPanel:case z.SolarWaterHeater:case z.Sensor:case z.Light:return!0}return!1},Igo=t=>{const e=[];if(t.type!==z.Roof)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1),s=n.roofStructure!==Ac.Rafter||n.opacity===void 0||n.opacity>0;return Mgo()&&e.push({key:"roof-paste",label:h.jsx(oM,{})}),e.push({key:"roof-lock",label:h.jsx(Ku,{selectedElement:n})}),n.rise>0&&e.push({key:"roof-ceiling-submenu",label:h.jsx(an,{children:Y.t("roofMenu.Ceiling",r)}),children:bgo(n)}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-roof",label:h.jsx(an,{children:Y.t("word.Elements",r)}),children:igo(n,a,l)}),o&&(n.roofType===Go.Gable&&(e.push({key:"roof-structure-submenu",label:h.jsx(an,{children:Y.t("roofMenu.RoofStructure",r)}),children:Rgo(n)}),(n.roofStructure===Ac.Rafter||n.roofStructure===Ac.Glass)&&e.push({key:"opacity",label:h.jsxs(eo,{Dialog:Hgo,children:[Y.t("roofMenu.Opacity",r)," ..."]})})),e.push({key:"roof-thickness",label:h.jsxs(eo,{Dialog:ago,children:[Y.t(n.roofStructure===Ac.Rafter?"roofMenu.RafterThickness":"word.Thickness",r)," ","..."]})}),e.push({key:"roof-rise",label:h.jsxs(eo,{Dialog:lgo,children:[Y.t("roofMenu.Rise",r)," ..."]})}),s&&(e.push({key:"roof-r-value",label:h.jsxs(eo,{Dialog:sgo,children:[Y.t("roofMenu.RoofRValue",r)," ..."]})},{key:"roof-heat-capacity",label:h.jsxs(eo,{Dialog:cgo,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"roof-texture",label:h.jsxs(eo,{Dialog:Ago,children:[Y.t("word.Texture",r)," ..."]})}),(n.textureType===Ur.NoTexture||n.textureType===Ur.Default)&&e.push({key:"roof-color",label:h.jsxs(eo,{Dialog:wgo,children:[Y.t("roofMenu.RoofColor",r)," ..."]})}),e.push({key:"roof-side-color",label:h.jsxs(eo,{Dialog:vgo,children:[Y.t("roofMenu.RoofSideColor",r)," ..."]})}))),{items:e}},zgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.relativeYawAngle)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.relativeYawAngle)??0)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.relativeYawAngle=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.relativeYawAngle=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.relativeYawAngle=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.relativeYawAngle=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.relativeYawAngle:u.relativeYawAngle,E={name:"Set Wind Turbine Relative Yaw Angle",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineRelativeYawAngle=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RelativeYawAngle",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.SouthFacingIsZero",p),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",p)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Dgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.numberOfBlades)??3),p=$t(),{Option:g}=Uo,A=H=>{a(H.target.value)},y=H=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.WindTurbine&&F.foundationId===(u==null?void 0:u.foundationId)&&!F.locked&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.numberOfBlades)??0)-H)>Et)return!0}return!1}},S=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.id===H&&!N.locked){const U=N;U.numberOfBlades=F;break}})},C=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.foundationId===H&&!N.locked){const U=N;U.numberOfBlades=F}})},P=H=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked){const N=E;N.numberOfBlades=H}})},v=(H,F)=>{M.getState().set(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked&&H.has(N.id)){const U=N;U.numberOfBlades=F}})},T=H=>{if(u&&y(H)){switch(i){case re.AllSelectedObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for Selected Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{v(E.oldValues,E.newValue)}};r(E),v(F,H),s(l+1);break}case re.AllObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for All Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{P(E.newValue)}};r(E),P(H),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const F=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===u.foundationId&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:F,newValue:H,groupId:u.foundationId,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{E.groupId&&C(E.groupId,E.newValue)}};r(E),C(u.foundationId,H),s(l+1)}break}default:{const F=o(u.id),E=F?F.numberOfBlades??3:u.numberOfBlades??3,N={name:"Select Wind Turbine Blade Number",timestamp:Date.now(),oldValue:E,newValue:H,changedElementId:u.id,changedElementType:u.type,undo:()=>{S(N.changedElementId,N.oldValue)},redo:()=>{S(N.changedElementId,N.newValue)}};r(N),S(u.id,H),s(l+1);break}}e(F=>{F.actionState.windTurbineNumberOfBlades=H})}},w=()=>{t(!1)},x=()=>{w(),c()},b=()=>{T(d),t(!1),s(0)},R=()=>{T(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.BladeNumber",p),onApply:R,onClose:w,onClickCancel:x,onClickOk:b,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsxs(Uo,{style:{width:"60px"},value:d,onChange:H=>{H!==null&&f(H)},children:[h.jsx(g,{value:1,children:"1"},1),h.jsx(g,{value:2,children:"2"},2),h.jsx(g,{value:3,children:"3"},3),h.jsx(g,{value:4,children:"4"},4),h.jsx(g,{value:8,children:"8"},8)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Ego=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.initialRotorAngle)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.initialRotorAngle)??0)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.initialRotorAngle=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.initialRotorAngle=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.initialRotorAngle=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.initialRotorAngle=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.initialRotorAngle:u.initialRotorAngle,E={name:"Set Wind Turbine Rotor Initial Angle",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineInitialRotorAngle=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorInitialAngle",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:360,style:{width:120},precision:1,step:1,value:parseFloat(ye.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(ye.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0°, 360°]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Fgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=ye.toRadians(10),d=uo(z.WindTurbine),[f,p]=m.useState((d==null?void 0:d.pitchAngle)??u),g=$t(),A=H=>{a(H.target.value)},y=H=>{if(d){switch(i){case re.AllObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.WindTurbine&&F.foundationId===(d==null?void 0:d.foundationId)&&!F.locked&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;default:if(Math.abs(((d==null?void 0:d.pitchAngle)??u)-H)>Et)return!0}return!1}},S=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.id===H&&!N.locked){const U=N;U.pitchAngle=F;break}})},C=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.foundationId===H&&!N.locked){const U=N;U.pitchAngle=F}})},P=H=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked){const N=E;N.pitchAngle=H}})},v=(H,F)=>{M.getState().set(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked&&H.has(N.id)){const U=N;U.pitchAngle=F}})},T=H=>{if(d&&y(H)){switch(i){case re.AllSelectedObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{v(E.oldValues,E.newValue)}};r(E),v(F,H),s(l+1);break}case re.AllObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for All Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{P(E.newValue)}};r(E),P(H),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const F=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===d.foundationId&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:F,newValue:H,groupId:d.foundationId,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{E.groupId&&C(E.groupId,E.newValue)}};r(E),C(d.foundationId,H),s(l+1)}break}default:{const F=o(d.id),E=F?F.pitchAngle:d.pitchAngle,N={name:"Set Wind Turbine Pitch Angle",timestamp:Date.now(),oldValue:E,newValue:H,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(N.changedElementId,N.oldValue)},redo:()=>{S(N.changedElementId,N.newValue)}};r(N),S(d.id,H),s(l+1);break}}e(F=>{F.actionState.windTurbinePitchAngle=H})}},w=()=>{t(!1)},x=()=>{w(),c()},b=()=>{T(f),t(!1),s(0)},R=()=>{T(f)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorBladePitchAngle",g),onApply:R,onClose:w,onClickCancel:x,onClickOk:b,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(f).toFixed(2)),formatter:H=>`${H}°`,onChange:H=>{H!==null&&p(ye.toRadians(H))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [-180°, 180°]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:A,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",g)})]})})})]})})},kgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.bladeRadius)??0),p=m.useRef(!1),g=m.useRef(),A=$t(),y=E=>{a(E.target.value)},S=E=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-E)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.bladeRadius-E)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-E)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.bladeRadius)-E)>Et)return!0}return!1}},C=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===E&&!W.locked){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N;break}})},P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===E&&!W.locked){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N}})},v=E=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.bladeRadius=E,W.lx=W.ly=E*2,W.lz=W.towerHeight+E}})},T=(E,N)=>{M.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&E.has(W.id)){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N}})},w=E=>{if(u&&S(E)){switch(g.current=void 0,i){case re.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{T(U.oldValues,U.newValue)}};r(U),T(N,E),s(l+1)}break}case re.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{v(U.newValue)}};r(U),v(E),s(l+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,E),s(l+1)}}break}default:{const N=o(u.id),U=N?N.bladeRadius:u.bladeRadius;if(p.current=u.towerHeight{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,E),s(l+1)}break}}e(N=>{N.actionState.windTurbineBladeRadius=E})}},x=()=>{p.current=!1,t(!1)},b=()=>{x(),c()},R=()=>{w(d),p.current||(t(!1),s(0))},H=()=>{w(d)},F=p.current?": "+Y.t("message.NotApplicableToSelectedAction",A)+(g.current!==void 0?" ("+g.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorBladeRadius",A),rejectedMessage:F,onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:E=>{E!==null&&f(E)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 100] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",A)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},Lgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.bladeRootRadius)??.3),[p,g]=m.useState((u==null?void 0:u.maximumChordLength)??1),[A,y]=m.useState((u==null?void 0:u.maximumChordRadius)??3),S=m.useRef(null),C=$t(),P=555;m.useEffect(()=>{if(!S.current||!u)return;const Q=S.current.getContext("2d");if(!Q)return;const se=S.current.width,Z=S.current.height,ee=20,te=Z*.7;Q.clearRect(0,0,se,Z),Q.setLineDash([]),Q.strokeStyle="gray",Q.lineWidth=1,Q.rect(0,0,se,Z),Q.stroke();const oe=(se-ee*2)/u.bladeRadius,de=oe*u.bladeTipWidth,he=oe*A,pe=oe*p,me=oe*u.bladeRadius,le=oe*d,Te=pe-le,ge=me-he/3,Se=[];Se.push(new Kt(ee,te-le)),Se.push(new Kt(ee+me-ge,te-Te/2)),Se.push(new Kt(ee+he,te-Te)),Se.push(new Kt(ee+me,te+le-de));const De=new Sq(Se).getPoints(50);Q.beginPath(),Q.moveTo(De[0].x,De[0].y);for(let Ae=1;Ae{a(Q.target.value)},T=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.bladeRootRadius)??.3)-Q)>Et)return!0}return!1}},w=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.id===Q&&!ee.locked){const te=ee;te.bladeRootRadius=se;break}})},x=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.foundationId===Q&&!ee.locked){const te=ee;te.bladeRootRadius=se}})},b=Q=>{e(se=>{for(const Z of se.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ee=Z;ee.bladeRootRadius=Q}})},R=(Q,se)=>{M.getState().set(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&!ee.locked&&Q.has(ee.id)){const te=ee;te.bladeRootRadius=se}})},H=Q=>{if(u&&T(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(ee.id)&&se.set(ee.id,ee.bladeRootRadius);const Z={name:"Set Root Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())w(ee,te)},redo:()=>{R(Z.oldValues,Z.newValue)}};r(Z),R(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&se.set(ee.id,ee.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())w(ee,te)},redo:()=>{b(Z.newValue)}};r(Z),b(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&ee.foundationId===u.foundationId&&se.set(ee.id,ee.bladeRootRadius);const Z={name:"Set Root Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[ee,te]of Z.oldValues.entries())w(ee,te)},redo:()=>{Z.groupId&&x(Z.groupId,Z.newValue)}};r(Z),x(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),Z=se?se.bladeRootRadius:u.bladeRootRadius,ee={name:"Set Wind Turbine Root Radius",timestamp:Date.now(),oldValue:Z,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(ee.changedElementId,ee.oldValue)},redo:()=>{w(ee.changedElementId,ee.newValue)}};r(ee),w(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeRootRadius=Q})}},F=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordLength)-Q)>Et)return!0}return!1}},E=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.id===Q&&!ee.locked){const te=ee;te.maximumChordLength=se;break}})},N=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.foundationId===Q&&!ee.locked){const te=ee;te.maximumChordLength=se}})},U=Q=>{e(se=>{for(const Z of se.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ee=Z;ee.maximumChordLength=Q}})},W=(Q,se)=>{M.getState().set(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&!ee.locked&&Q.has(ee.id)){const te=ee;te.maximumChordLength=se}})},k=Q=>{if(u&&F(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(ee.id)&&se.set(ee.id,ee.maximumChordLength);const Z={name:"Set Chord Length for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())E(ee,te)},redo:()=>{W(Z.oldValues,Z.newValue)}};r(Z),W(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&se.set(ee.id,ee.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())E(ee,te)},redo:()=>{U(Z.newValue)}};r(Z),U(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&ee.foundationId===u.foundationId&&se.set(ee.id,ee.maximumChordLength);const Z={name:"Set Chord Length for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[ee,te]of Z.oldValues.entries())E(ee,te)},redo:()=>{Z.groupId&&N(Z.groupId,Z.newValue)}};r(Z),N(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),Z=se?se.maximumChordLength:u.maximumChordLength,ee={name:"Set Wind Turbine Chord Length",timestamp:Date.now(),oldValue:Z,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{E(ee.changedElementId,ee.oldValue)},redo:()=>{E(ee.changedElementId,ee.newValue)}};r(ee),E(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeMaximumChordLength=Q})}},D=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordRadius)-Q)>Et)return!0}return!1}},L=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.id===Q&&!ee.locked){const te=ee;te.maximumChordRadius=se;break}})},j=(Q,se)=>{e(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&ee.foundationId===Q&&!ee.locked){const te=ee;te.maximumChordRadius=se}})},B=Q=>{e(se=>{for(const Z of se.elements)if(Z.type===z.WindTurbine&&!Z.locked){const ee=Z;ee.maximumChordRadius=Q}})},O=(Q,se)=>{M.getState().set(Z=>{for(const ee of Z.elements)if(ee.type===z.WindTurbine&&!ee.locked&&Q.has(ee.id)){const te=ee;te.maximumChordRadius=se}})},V=Q=>{if(u&&D(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(ee.id)&&se.set(ee.id,ee.maximumChordRadius);const Z={name:"Set Chord Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())L(ee,te)},redo:()=>{O(Z.oldValues,Z.newValue)}};r(Z),O(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&se.set(ee.id,ee.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[ee,te]of Z.oldValues.entries())L(ee,te)},redo:()=>{B(Z.newValue)}};r(Z),B(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const ee of n)ee.type===z.WindTurbine&&ee.foundationId===u.foundationId&&se.set(ee.id,ee.maximumChordRadius);const Z={name:"Set Chord Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[ee,te]of Z.oldValues.entries())L(ee,te)},redo:()=>{Z.groupId&&j(Z.groupId,Z.newValue)}};r(Z),j(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),Z=se?se.maximumChordRadius:u.maximumChordRadius,ee={name:"Set Wind Turbine Chord Radius",timestamp:Date.now(),oldValue:Z,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{L(ee.changedElementId,ee.oldValue)},redo:()=>{L(ee.changedElementId,ee.newValue)}};r(ee),L(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeMaximumChordRadius=Q})}},G=()=>{t(!1)},q=()=>{G(),c()},$=()=>{k(p),V(A),H(d),t(!1),s(0)},ie=()=>{k(p),V(A),H(d)};return h.jsxs(so,{width:600,title:Y.t("windTurbineMenu.RotorBladeDesign",C),onApply:ie,onClose:G,onClickCancel:q,onClickOk:$,children:[h.jsx(nn,{children:h.jsx(Ke,{span:24,children:h.jsx("canvas",{ref:S,id:"blade-design-canvas",width:P,height:P*.25,style:{paddingBottom:"12px"}})})}),h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"A: "}),h.jsx(Ke,{children:h.jsx(Sn,{min:.1,max:1,style:{width:"70px"},step:.01,precision:2,value:d,onChange:Q=>{Q&&f(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.1, 1] ",Y.t("word.MeterAbbreviation",C)]})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"C: "}),h.jsx(Ke,{children:h.jsx(Sn,{min:.5,max:2,style:{width:"70px"},step:.01,precision:2,value:p,onChange:Q=>{Q&&g(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.5, 2] ",Y.t("word.MeterAbbreviation",C)]})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"D:"}),h.jsx(Ke,{children:h.jsx(Sn,{min:2,max:((u==null?void 0:u.bladeRadius)??10)/2,style:{width:70},step:.01,precision:2,value:A,onChange:Q=>{Q&&y(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[2, ",((u==null?void 0:u.bladeRadius)??10)/2,"] ",Y.t("word.MeterAbbreviation",C)]})]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",C)})]})})})]})]})},Wgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.hubRadius)??0),[p,g]=m.useState((u==null?void 0:u.hubLength)??0),A=$t(),y=F=>{a(F.target.value)},S=(F,E)=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;default:if(Math.abs((u==null?void 0:u.hubRadius)-F)>Et||Math.abs((u==null?void 0:u.hubLength)-E)>Et)return!0}return!1}},C=(F,E)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.id===F&&!U.locked){const W=U;W.hubRadius=E[0],W.hubLength=E[1];break}})},P=(F,E)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.foundationId===F&&!U.locked){const W=U;W.hubRadius=E[0],W.hubLength=E[1]}})},v=F=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked){const U=N;U.hubRadius=F[0],U.hubLength=F[1]}})},T=(F,E)=>{M.getState().set(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked&&F.has(U.id)){const W=U;W.hubRadius=E[0],W.hubLength=E[1]}})},w=F=>{if(u&&S(F[0],F[1])){switch(i){case re.AllSelectedObjectsOfThisType:{const E=new Map;for(const U of n)if(U.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(U.id)){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for Selected Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{T(N.oldValues,N.newValue)}};r(N),T(E,F),s(l+1);break}case re.AllObjectsOfThisType:{const E=new Map;for(const U of n)if(U.type===z.WindTurbine){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{v(N.newValue)}};r(N),v(F),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const E=new Map;for(const U of n)if(U.type===z.WindTurbine&&U.foundationId===u.foundationId){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:u.foundationId,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{N.groupId&&P(N.groupId,N.newValue)}};r(N),P(u.foundationId,F),s(l+1)}break}default:{const E=o(u.id),N=E?E.hubRadius:u.hubRadius,U=E?E.hubLength:u.hubLength,W={name:"Set Wind Turbine Hub Parameters",timestamp:Date.now(),oldValue:[N,U],newValue:F,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,F),s(l+1);break}}e(E=>{E.actionState.windTurbineHubRadius=F[0],E.actionState.windTurbineHubLength=F[1]})}},x=()=>{t(!1)},b=()=>{x(),c()},R=()=>{w([d,p]),t(!1),s(0)},H=()=>{w([d,p])};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.HubDesign",A),onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx("div",{style:{marginTop:"-20px",textAlign:"left",fontSize:"12px"},children:Y.t("windTurbineMenu.HubRadius",A)}),h.jsx(Sn,{min:.5,max:5,style:{width:120},step:.01,precision:2,value:d,onChange:F=>{F!==null&&f(F)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0.5, 5] ",Y.t("word.MeterAbbreviation",A)]}),h.jsx("div",{style:{paddingTop:"10px",textAlign:"left",fontSize:"12px"},children:Y.t("windTurbineMenu.HubLength",A)}),h.jsx(Sn,{min:1,max:10,style:{width:120},step:.01,precision:2,value:p,onChange:F=>{F!==null&&g(F)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 10] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},Ngo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.birdSafe)??uc.None),[p,g]=m.useState((u==null?void 0:u.bladeColor)??t9),[A,y]=m.useState((u==null?void 0:u.stripeColor)??n9),S=$t(),{Option:C}=Uo,P=U=>{a(U.target.value)},v=(U,W,k)=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(u==null?void 0:u.foundationId)&&!D.locked){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;default:if((u.birdSafe??uc.None)!==U||(u.bladeColor??t9)!==W||(u.stripeColor??n9)!==k)return!0}return!1}},T=(U,W,k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.id===U&&!j.locked){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D;break}})},w=(U,W,k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.foundationId===U&&!j.locked){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D}})},x=(U,W,k)=>{e(D=>{for(const L of D.elements)if(L.type===z.WindTurbine&&!L.locked){const j=L;j.birdSafe=U,j.bladeColor=W,j.stripeColor=k}})},b=(U,W,k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&!j.locked&&U.has(j.id)){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D}})},R=(U,W,k)=>{if(u&&v(U,W,k)){switch(i){case re.AllSelectedObjectsOfThisType:{const D=new Map;for(const j of n)if(j.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(j.id)){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;b(L.oldValues,Number(j[0]),j[1],j[2])}};r(L),b(D,U,W,k),s(l+1);break}case re.AllObjectsOfThisType:{const D=new Map;for(const j of n)if(j.type===z.WindTurbine){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;x(Number(j[0]),j[1],j[2])}};r(L),x(U,W,k),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const D=new Map;for(const j of n)if(j.type===z.WindTurbine&&j.foundationId===u.foundationId){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],groupId:u.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{if(L.groupId){const j=L.newValue;w(L.groupId,Number(j[0]),j[1],j[2])}}};r(L),w(u.foundationId,U,W,k),s(l+1)}break}default:{const D=o(u.id),L=D?D.birdSafe??uc.None:u.birdSafe??uc.None,j=D?D.bladeColor??t9:u.bladeColor??t9,B=D?D.stripeColor??n9:u.stripeColor??n9,O=[L.toString(),j,B],V={name:"Select Bird-Safe Design for Wind Turbine",timestamp:Date.now(),oldValue:O,newValue:[U.toString(),W,k],changedElementId:u.id,changedElementType:u.type,undo:()=>{const G=V.oldValue;T(V.changedElementId,Number(G[0]),G[1],G[2])},redo:()=>{T(V.changedElementId,U,W,k)}};r(V),T(u.id,U,W,k),s(l+1);break}}e(D=>{D.actionState.windTurbineBirdSafeDesign=U,D.actionState.windTurbineBladeColor=W,D.actionState.windTurbineStripeColor=k})}},H=()=>{t(!1)},F=()=>{H(),c()},E=()=>{R(d,p,A),t(!1),s(0)},N=()=>{R(d,p,A)};return h.jsx(so,{width:600,title:Y.t("windTurbineMenu.BirdSafeDesign",S),onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsxs("span",{children:[Y.t("word.Pattern",S),": "]}),h.jsxs(Uo,{style:{width:"116px"},value:d,onChange:U=>{U!==null&&f(U)},children:[h.jsx(C,{value:uc.None,children:Y.t("windTurbineMenu.BirdSafeNone",S)},uc.None),h.jsx(C,{value:uc.Bicolor,children:Y.t("windTurbineMenu.BirdSafeBicolor",S)},uc.Bicolor),h.jsx(C,{value:uc.Striped,children:Y.t("windTurbineMenu.BirdSafeStriped",S)},uc.Striped)]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[Y.t("word.Color",S)," 1: "]}),h.jsx("input",{type:"color",value:p,onChange:U=>{g(U.target.value)}})]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[Y.t("word.Color",S)," 2: "]}),h.jsx("input",{type:"color",value:A,onChange:U=>{y(U.target.value)}})]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:P,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",S)})]})})})]})})},Ugo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.towerHeight)??0),p=m.useRef(!1),g=m.useRef(),A=$t(),y=E=>{a(E.target.value)},S=E=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-E)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.towerHeight-E)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-E)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.towerHeight)-E)>Et)return!0}return!1}},C=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===E&&!W.locked){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius;break}})},P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===E&&!W.locked){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius}})},v=E=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.towerHeight=E,W.lz=E+W.bladeRadius}})},T=(E,N)=>{M.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&E.has(W.id)){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius}})},w=E=>{if(u&&S(E)){switch(g.current=void 0,i){case re.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(W.id)&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for Selected Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{T(U.oldValues,U.newValue)}};r(U),T(N,E),s(l+1)}break}case re.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{v(U.newValue)}};r(U),v(E),s(l+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&W.foundationId===u.foundationId&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:N,newValue:E,groupId:u.foundationId,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,E),s(l+1)}}break}default:{const N=o(u.id),U=N?N.towerHeight:u.towerHeight;if(p.current=u.bladeRadius>E,p.current)g.current=E,f(U);else{const W={name:"Set Wind Turbine Tower Height",timestamp:Date.now(),oldValue:U,newValue:E,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,E),s(l+1)}break}}e(N=>{N.actionState.windTurbineTowerHeight=E})}},x=()=>{p.current=!1,t(!1)},b=()=>{x(),c()},R=()=>{w(d),p.current||(t(!1),s(0))},H=()=>{w(d)},F=p.current?": "+Y.t("message.NotApplicableToSelectedAction",A)+(g.current!==void 0?" ("+g.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.TowerHeight",A),rejectedMessage:F,onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:E=>{E!==null&&f(E)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 100] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",A)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},jgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.towerRadius)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs(H.towerRadius-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs(H.towerRadius-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs(H.towerRadius-R)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.towerRadius)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.towerRadius=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.towerRadius=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.towerRadius=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.towerRadius=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.towerRadius:u.towerRadius,E={name:"Set Wind Turbine Tower Radius",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineTowerRadius=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.TowerRadius",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:d,onChange:R=>{R!==null&&f(R)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, 2] ",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Bgo=t=>{const e=[];if(t.type!==z.WindTurbine)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"wind-turbine-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"wind-turbine-cut",label:h.jsx(kd,{})}),e.push({key:"wind-turbine-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"wind-turbine-relative-yaw-angle",label:h.jsxs(eo,{Dialog:zgo,children:[Y.t("windTurbineMenu.RelativeYawAngle",o)," ..."]})},{key:"wind-turbine-rotor-submenu",label:h.jsx(an,{children:Y.t("windTurbineMenu.Rotor",o)}),children:[{key:"wind-turbine-rotor-blade-number",label:h.jsxs(eo,{noPadding:!0,Dialog:Dgo,children:[Y.t("windTurbineMenu.BladeNumber",o)," ..."]})},{key:"wind-turbine-rotor-initial-angle",label:h.jsxs(eo,{noPadding:!0,Dialog:Ego,children:[Y.t("windTurbineMenu.RotorInitialAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-pitch-angle",label:h.jsxs(eo,{noPadding:!0,Dialog:Fgo,children:[Y.t("windTurbineMenu.RotorBladePitchAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:kgo,children:[Y.t("windTurbineMenu.RotorBladeRadius",o)," ..."]})},{key:"wind-turbine-rotor-blade-design",label:h.jsxs(eo,{noPadding:!0,Dialog:Lgo,children:[Y.t("windTurbineMenu.RotorBladeDesign",o)," ..."]})},{key:"wind-turbine-hub-design",label:h.jsxs(eo,{noPadding:!0,Dialog:Wgo,children:[Y.t("windTurbineMenu.HubDesign",o)," ..."]})},{key:"wind-turbine-bird-safe-blade",label:h.jsxs(eo,{noPadding:!0,Dialog:Ngo,children:[Y.t("windTurbineMenu.BirdSafeDesign",o)," ..."]})}]},{key:"wind-turbine-tower-submenu",label:h.jsx(an,{children:Y.t("windTurbineMenu.Tower",o)}),children:[{key:"wind-turbine-tower-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Ugo,children:[Y.t("windTurbineMenu.TowerHeight",o)," ..."]})},{key:"wind-turbine-tower-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:jgo,children:[Y.t("windTurbineMenu.TowerRadius",o)," ..."]})}]},{key:"wind-turbine-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Ygo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(Yge),l=M(Oge),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState((d==null?void 0:d.lx)??1),g=m.useRef(!1),A=m.useRef(),y=$t(),S=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===k&&!j.locked){j.lx=D;break}})},C=(k,D)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===k&&!j.locked&&(j.lx=D)})},P=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarWaterHeater&&!B.locked){let O;D?O=B.parentId===k&&ye.isIdentical(B.normal,D):O=B.parentId===k,O&&(B.lx=L)}})},v=k=>{e(D=>{for(const L of D.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lx=k)})},T=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)&&(j.lx=D)})},w=k=>{l(k.target.value)},x=(k,D)=>{const L=r(k);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.lx=D,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(k,D)=>!x(k,D),R=k=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lx-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lx-k)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.lx)-k)>Et)return!0;break}}return!1}},H=k=>{if(d&&R(k))switch(A.current=void 0,a){case re.AllSelectedObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lx);const L={name:"Set Length for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{T(L.oldValues,L.newValue)}};i(L),T(D,k),c(s+1)}break}case re.AllObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lx);const L={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{v(L.newValue)}};i(L),v(k),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===d.foundationId&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&D.set(j.id,j.lx);const L={name:"Set Length for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:d.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,k),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(g.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&b(j,k)){g.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&b(j,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lx);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lx);const O=B?d.normal:void 0,V={name:"Set Length for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:d.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())S(G,q)},redo:()=>{V.groupId&&P(V.groupId,V.normal,V.newValue)}};i(V),P(d.parentId,O,k),c(s+1)}}break}default:{const D=o(d.id),L=D?D.lx:d.lx;if(g.current=b(d,k),g.current)A.current=k,p(L);else{const j={name:"Set Water Heater Length",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(j.changedElementId,j.oldValue)},redo:()=>{S(j.changedElementId,j.newValue)}};i(j),S(d.id,k),c(s+1)}break}}},F=()=>{g.current=!1,t(!1)},E=()=>{F(),u()},N=()=>{H(f),g.current||(t(!1),c(0))},U=()=>{H(f)},W=g.current?": "+Y.t("message.NotApplicableToSelectedAction",y)+(A.current!==void 0?" ("+A.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",y),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:0,max:100,step:.1,style:{width:120},precision:2,value:f,onChange:k=>{k!==null&&p(k)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:w,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",y)})]})})})]})})},Ogo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(vh),l=M(xh),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState(0),[g,A]=m.useState((d==null?void 0:d.ly)??1),y=m.useRef(!1),S=m.useRef(),C=$t();m.useEffect(()=>{d&&p(Number((d.lz-.3).toFixed(2)))},[d]);const P=(L,j)=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarWaterHeater&&O.id===L&&!O.locked){O.ly=j;break}})},v=(L,j)=>{e(B=>{for(const O of B.elements)O.type===z.SolarWaterHeater&&O.foundationId===L&&!O.locked&&(O.ly=j)})},T=(L,j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarWaterHeater&&!V.locked){let G;j?G=V.parentId===L&&ye.isIdentical(V.normal,j):G=V.parentId===L,G&&(V.ly=B)}})},w=L=>{e(j=>{for(const B of j.elements)B.type===z.SolarWaterHeater&&!B.locked&&(B.ly=L)})},x=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.SolarWaterHeater&&!O.locked&&L.has(O.id)&&(O.ly=j)})},b=L=>{l(L.target.value)},R=(L,j)=>{const B=r(L);if(B){if(B.type===z.Cuboid&&!ye.isIdentical(L.normal,as))return!0;const O=JSON.parse(JSON.stringify(L));return O.ly=j,B.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(O,B)}return!1},H=(L,j)=>!R(L,j),F=L=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const j of n)if(j.type===z.SolarWaterHeater&&j.foundationId===(d==null?void 0:d.foundationId)&&!j.locked&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&Math.abs(O.ly-L)>Et)return!0}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&Math.abs(O.ly-L)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.ly)-L)>Et)return!0;break}}return!1}},E=L=>{if(d&&F(L))switch(S.current=void 0,a){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.ly);const B={name:"Set Width for Selected Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{x(B.oldValues,B.newValue)}};i(B),x(j,L),c(s+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&j.set(O.id,O.ly);const B={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{w(B.newValue)}};i(B),w(L),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.foundationId===d.foundationId&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&O.foundationId===d.foundationId&&j.set(O.id,O.ly);const B={name:"Set Width for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:d.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{B.groupId&&v(B.groupId,B.newValue)}};i(B),v(d.foundationId,L),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(y.current=!1,j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&ye.isIdentical(O.normal,d.normal)&&!O.locked&&H(O,L)){y.current=!0;break}}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&H(O,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const O=new Map,V=j.type===z.Cuboid;if(V)for(const $ of n)$.type===z.SolarWaterHeater&&$.parentId===d.parentId&&ye.isIdentical($.normal,d.normal)&&!$.locked&&O.set($.id,$.ly);else for(const $ of n)$.type===z.SolarWaterHeater&&$.parentId===d.parentId&&!$.locked&&O.set($.id,$.ly);const G=V?d.normal:void 0,q={name:"Set Width for All Water Heater on Surface",timestamp:Date.now(),oldValues:O,newValue:L,groupId:d.parentId,normal:G,undo:()=>{for(const[$,ie]of q.oldValues.entries())P($,ie)},redo:()=>{q.groupId&&T(q.groupId,q.normal,q.newValue)}};i(q),T(d.parentId,G,L),c(s+1)}}break}default:{const j=o(d.id),B=j?j.ly:d.ly;if(y.current=H(d,L),y.current)S.current=L,A(B);else{const O={name:"Set Water Heater Width",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:d.id,changedElementType:d.type,undo:()=>{P(O.changedElementId,O.oldValue)},redo:()=>{P(O.changedElementId,O.newValue)}};i(O),P(d.id,L),c(s+1)}break}}},N=()=>{y.current=!1,t(!1)},U=()=>{N(),u()},W=()=>{E(g),y.current||(t(!1),c(0))},k=()=>{E(g)},D=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return console.log("min",f),h.jsx(so,{width:550,title:Y.t("word.Width",C),rejectedMessage:D,onApply:k,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:f,max:100,step:.1,style:{width:120},precision:2,value:g,onChange:L=>{L!==null&&A(L)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:b,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",C)})]})})})]})})},Vgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Qq),i=M(yYe),a=M(AYe),l=M(wYe),s=M(Gr),c=M(En),u=M(Yge),d=M(Oge),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarWaterHeater),y=m.useRef(!1),S=m.useRef(),[C,P]=m.useState(A?-A.relativeAzimuth:0),v=$t(),T=k=>{d(k.target.value)},w=(k,D)=>{const L=s(k);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.relativeAzimuth=-D,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},x=(k,D)=>!w(k,D),b=k=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(A==null?void 0:A.foundationId)&&!D.locked&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:if(A!=null&&A.parentId){const D=s(A);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===A.parentId&&ye.isIdentical(j.normal,A.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===A.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}}break;default:if(Math.abs(-(A==null?void 0:A.relativeAzimuth)-k)>Et)return!0}return!1}},R=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)){const B=j;B.relativeAzimuth=D}})},H=k=>{if(A&&b(k)){switch(S.current=void 0,u){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(D,-k),p(f+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{l(z.SolarWaterHeater,-L.newValue)}};c(L),l(z.SolarWaterHeater,-k),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===A.foundationId&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===A.foundationId&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:A.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{L.groupId&&a(z.SolarWaterHeater,L.groupId,-L.newValue)}};c(L),a(z.SolarWaterHeater,A.foundationId,-k),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{if(A.parentId){const D=s(A);if(D){if(y.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===A.parentId&&ye.isIdentical(j.normal,A.normal)&&x(j,k)){y.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===A.parentId&&x(j,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===A.parentId&&ye.isIdentical(G.normal,A.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===A.parentId&&j.set(G.id,-G.relativeAzimuth);const O=B?A.normal:void 0,V={name:"Set Relative Azimuth for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:A.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())r(G,-q)},redo:()=>{V.groupId&&i(z.SolarWaterHeater,V.groupId,V.normal,-V.newValue)}};c(V),i(z.SolarWaterHeater,A.parentId,O,-k),p(f+1)}}}break}default:{const D=o(A.id),L=D?-D.relativeAzimuth:-A.relativeAzimuth;if(y.current=x(A,k),y.current)S.current=k,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(A.id,-k),p(f+1)}break}}e(D=>{D.actionState.solarWaterHeaterRelativeAzimuth=-k})}},F=()=>{y.current=!1,t(!1)},E=()=>{F(),g()},N=()=>{H(C),y.current||(t(!1),p(0))},U=()=>{H(C)},W=y.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+ye.toDegrees(S.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeAzimuth",v),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(ye.toDegrees(C).toFixed(2)),formatter:k=>`${k}°`,onChange:k=>{k!==null&&P(ye.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",v),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",v)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",v)})]})})})]})})},_go=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(Yge),l=M(Oge),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState((d==null?void 0:d.lz)??1),g=m.useRef(!1),A=m.useRef(),y=$t(),S=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===k&&!j.locked){j.lz=D;break}})},C=(k,D)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===k&&!j.locked&&(j.lz=D)})},P=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarWaterHeater&&!B.locked){let O;D?O=B.parentId===k&&ye.isIdentical(B.normal,D):O=B.parentId===k,O&&(B.lz=L)}})},v=k=>{e(D=>{for(const L of D.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lz=k)})},T=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)&&(j.lz=D)})},w=k=>{l(k.target.value)},x=(k,D)=>{const L=r(k);if(L){if(L.type===z.Cuboid&&!ye.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.lz=D,L.type===z.Roof?!0:ye.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(k,D)=>!x(k,D),R=k=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lz-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lz-k)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.lz)-k)>Et)return!0;break}}return!1}},H=k=>{if(d&&R(k)){switch(A.current=void 0,a){case re.AllSelectedObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lz);const L={name:"Set Height for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{T(L.oldValues,L.newValue)}};i(L),T(D,k),c(s+1)}break}case re.AllObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&D.set(j.id,j.lz);const L={name:"Set Height for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{v(L.newValue)}};i(L),v(k),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===d.foundationId&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&D.set(j.id,j.lz);const L={name:"Set Height for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:d.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,k),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(g.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&ye.isIdentical(j.normal,d.normal)&&b(j,k)){g.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&b(j,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&ye.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lz);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lz);const O=B?d.normal:void 0,V={name:"Set Height for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:d.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())S(G,q)},redo:()=>{V.groupId&&P(V.groupId,V.normal,V.newValue)}};i(V),P(d.parentId,O,k),c(s+1)}}break}default:{const D=o(d.id),L=D?D.lz:d.lz;if(g.current=b(d,k),g.current)A.current=k,p(L);else{const j={name:"Set Water Heater Height",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(j.changedElementId,j.oldValue)},redo:()=>{S(j.changedElementId,j.newValue)}};i(j),S(d.id,k),c(s+1)}break}}e(D=>{D.actionState.solarWaterHeaterHeight=k})}},F=()=>{g.current=!1,t(!1)},E=()=>{F(),u()},N=()=>{H(f),g.current||(t(!1),c(0))},U=()=>{H(f)},W=g.current?": "+Y.t("message.NotApplicableToSelectedAction",y)+(A.current!==void 0?" ("+A.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Height",y),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:.6,max:10,step:.1,style:{width:120},precision:2,value:f,onChange:k=>{k!==null&&p(k)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:w,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",y)})]})})})]})})},Ggo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(En),i=M(vh),a=M(xh),l=M(no),s=M(Qn),c=uo(z.SolarWaterHeater),[u,d]=m.useState((c==null?void 0:c.color)??"grey"),f=$t(),p=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.SolarWaterHeater&&H.id===x&&!H.locked){H.color=b;break}})},g=(x,b)=>{e(R=>{for(const H of R.elements)H.type===z.SolarWaterHeater&&H.foundationId===x&&!H.locked&&(H.color=b)})},A=(x,b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarWaterHeater&&!F.locked){let E;b?E=F.parentId===x&&ye.isIdentical(F.normal,b):E=F.parentId===x,E&&(F.color=R)}})},y=x=>{e(b=>{for(const R of b.elements)R.type===z.SolarWaterHeater&&!R.locked&&(R.color=x)})},S=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.SolarWaterHeater&&!H.locked&&x.has(H.id)&&(H.color=b)})},C=x=>{a(x.target.value)},P=x=>{if(c){switch(i){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.SolarWaterHeater&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.color!==x)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.SolarWaterHeater&&!b.locked&&b.color!==x)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.SolarWaterHeater&&b.foundationId===(c==null?void 0:c.foundationId)&&!b.locked&&b.color!==x)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const b=o(c);if(b){if(b.type===z.Cuboid){for(const H of n)if(H.type===z.SolarWaterHeater&&H.parentId===c.parentId&&ye.isIdentical(H.normal,c.normal)&&!H.locked&&H.color!==x)return!0}else for(const H of n)if(H.type===z.SolarWaterHeater&&H.parentId===c.parentId&&!H.locked&&H.color!==x)return!0}break}default:{if((c==null?void 0:c.color)!==x)return!0;break}}return!1}},v=x=>{if(c&&P(x)){switch(i){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(H.id)&&!H.locked&&b.set(H.id,H.color??"grey");const R={name:"Set Color for Selected Solar Water Heaters",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{S(R.oldValues,R.newValue)}};r(R),S(b,x),s(l+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&!H.locked&&b.set(H.id,H.color??"grey");const R={name:"Set Color for All Solar Water Heaters",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{y(R.newValue)}};r(R),y(x),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&!H.locked&&H.foundationId===c.foundationId&&b.set(H.id,H.color??"grey");const R={name:"Set Color for All Water Heaters Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{R.groupId&&g(R.groupId,R.newValue)}};r(R),g(c.foundationId,x),s(l+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const b=o(c);if(b){const R=new Map,H=b.type===z.Cuboid;if(H)for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&ye.isIdentical(N.normal,c.normal)&&R.set(N.id,N.color??"grey");else for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&R.set(N.id,N.color??"grey");const F=H?c.normal:void 0,E={name:"Set Color for All Water Heaters on Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:c.parentId,normal:F,undo:()=>{for(const[N,U]of E.oldValues.entries())p(N,U)},redo:()=>{E.groupId&&A(E.groupId,E.normal,E.newValue)}};r(E),A(c.parentId,F,x),s(l+1)}break}default:{const b=c?c.color:"grey",R={name:"Set Color of Selected Water Heater",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(c.id,R.oldValue)},redo:()=>{p(c.id,R.newValue)}};r(R),p(c.id,x),s(l+1);break}}e(b=>{b.actionState.solarWaterHeaterColor=x})}},T=()=>{t(!1)},w=()=>{v(u)};return h.jsx(so,{width:680,title:Y.t("word.Color",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsx(Ld,{color:u??(c==null?void 0:c.color)??"grey",onChangeComplete:x=>{d(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:C,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",f)})]})})})]})})},Xgo=t=>{const e=[];if(t.type!==z.SolarWaterHeater)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=t.type===z.SolarWaterHeater&&ye.isIdentical(n.normal,as);return e.push({key:"water-heater-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"water-heater-cut",label:h.jsx(kd,{})}),e.push({key:"water-heater-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"water-heater-length",label:h.jsxs(eo,{Dialog:Ygo,children:[Y.t("word.Length",r)," ..."]})},{key:"water-heater-width",label:h.jsxs(eo,{Dialog:Ogo,children:[Y.t("word.Width",r)," ..."]})},{key:"water-heater-height",label:h.jsxs(eo,{Dialog:_go,children:[Y.t("word.Height",r)," ..."]})}),i&&e.push({key:"water-heater-relative-azimuth",label:h.jsxs(eo,{Dialog:Vgo,children:[Y.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),e.push({key:"water-heater-frame-color",label:h.jsxs(eo,{Dialog:Ggo,children:[Y.t("word.Color",r)," ..."]})}),e.push({key:"solar-water-heater-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},Jgo=()=>{const t=M(S7t),e=uo(),n=m.useRef(t),o=m.useRef(e);return t!==null?(n.current=t,o.current=e):setTimeout(()=>{n.current=t,o.current=t===null?void 0:e},200),[n.current,o.current]},Kgo=({children:t})=>{dt(r=>r.contextMenuFlag);const[e,n]=Jgo(),o=()=>{if(!n)return e===z.Ground?$fo():e===z.Sky?opo():{items:[]};switch(e){case z.Foundation:return mfo(n);case z.Cuboid:return jfo(n);case z.Wall:return P1o(n);case z.Roof:return Igo(n);case z.SolarPanel:return ypo(n);case z.Window:return ego(n);case z.Door:return W1o(n);case z.Sensor:return Bho(n);case z.Light:return Gho(n);case z.Human:return sho(n);case z.Tree:return o1o(n);case z.Flower:return uho(n);case z.ParabolicTrough:return Rpo(n);case z.ParabolicDish:return Wpo(n);case z.FresnelReflector:return Gpo(n);case z.Heliostat:return t1o(n);case z.Polygon:return Fho(n);case z.PolygonVertex:return Nho(n);case z.WindTurbine:return Bgo(n);case z.SolarWaterHeater:return Xgo(n);default:return{items:[]}}};return h.jsx(rA,{trigger:["contextMenu"],menu:o(),overlayClassName:"my-overlay",children:t})},qgo=be.memo(Kgo);(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,_,ce){I!=Array.prototype&&I!=Object.prototype&&(I[_]=ce.value)};function n(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof global=="object"&&global,I];for(var _=0;_>>0),P=0;function v(I,_,ce){return I.call.apply(I.bind,arguments)}function T(I,_,ce){if(!I)throw Error();if(2I.b&&(I.b++,_.next=I.a,I.a=_)}function G(){this.b=this.a=null}var q=new O(function(){return new ie},function(I){I.reset()});G.prototype.add=function(I,_){var ce=q.get();ce.set(I,_),this.b?this.b.next=ce:this.a=ce,this.b=ce};function $(){var I=So,_=null;return I.a&&(_=I.a,I.a=I.a.next,I.a||(I.b=null),_.next=null),_}function ie(){this.next=this.b=this.a=null}ie.prototype.set=function(I,_){this.a=I,this.b=_,this.next=null},ie.prototype.reset=function(){this.next=this.b=this.a=null};var Q=Array.prototype.indexOf?function(I,_){return Array.prototype.indexOf.call(I,_,void 0)}:function(I,_){if(typeof I=="string")return typeof _!="string"||_.length!=1?-1:I.indexOf(_,0);for(var ce=0;ce_?null:typeof I=="string"?I.charAt(_):I[_]}function he(I,_){return 0<=Q(I,_)}function pe(I,_){_=Q(I,_);var ce;return(ce=0<=_)&&Array.prototype.splice.call(I,_,1),ce}function me(I,_){var ce=0;Z(I,function(Ce,_e){_.call(void 0,Ce,_e,I)&&Array.prototype.splice.call(I,_e,1).length==1&&ce++})}function le(I){return Array.prototype.concat.apply([],arguments)}function Te(I){var _=I.length;if(0<_){for(var ce=Array(_),Ce=0;Ce<_;Ce++)ce[Ce]=I[Ce];return ce}return[]}var ge=String.prototype.trim?function(I){return I.trim()}:function(I){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(I)[1]},Se=/&/g,Re=//g,Ae=/"/g,ue=/'/g,fe=/\x00/g,ve=/[\x00&<>"']/;function we(I,_){return I.indexOf(_)!=-1}function Pe(I,_){return I<_?-1:I>_?1:0}var Ie;e:{var Me=s.navigator;if(Me){var ze=Me.userAgent;if(ze){Ie=ze;break e}}Ie=""}function Ne(I){return we(Ie,I)}function Je(I,_){for(var ce in I)_.call(void 0,I[ce],ce,I)}function Ue(I){for(var _ in I)return!1;return!0}function nt(I){var _={},ce;for(ce in I)_[ce]=I[ce];return _}var We="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(I,_){for(var ce,Ce,_e=1;_e"}else St=I===void 0?"undefined":I===null?"null":typeof I;B("Argument is not a %s (or a non-Element, non-Location mock); got: %s",_,St)}}function Oe(I,_){this.a=I===xt&&_||"",this.b=je}Oe.prototype.ta=!0,Oe.prototype.sa=function(){return this.a},Oe.prototype.toString=function(){return"Const{"+this.a+"}"};function st(I){return I instanceof Oe&&I.constructor===Oe&&I.b===je?I.a:(B("expected object of type Const, got '"+I+"'"),"type_error:Const")}var je={},xt={},gt;function Ye(){if(gt===void 0){var I=null,_=s.trustedTypes;if(_&&_.createPolicy){try{I=_.createPolicy("goog#html",{createHTML:R,createScript:R,createScriptURL:R})}catch(ce){s.console&&s.console.error(ce.message)}gt=I}else gt=I}return gt}function it(I,_){this.a=_===Be?I:""}it.prototype.ta=!0,it.prototype.sa=function(){return this.a.toString()},it.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};function ut(I){return I instanceof it&&I.constructor===it?I.a:(B("expected object of type TrustedResourceUrl, got '"+I+"' of type "+p(I)),"type_error:TrustedResourceUrl")}function Qe(I,_){var ce=st(I);if(!Ze.test(ce))throw Error("Invalid TrustedResourceUrl format: "+ce);return I=ce.replace(lt,function(Ce,_e){if(!Object.prototype.hasOwnProperty.call(_,_e))throw Error('Found marker, "'+_e+'", in format string, "'+ce+'", but no valid label mapping found in args: '+JSON.stringify(_));return Ce=_[_e],Ce instanceof Oe?st(Ce):encodeURIComponent(String(Ce))}),$e(I)}var lt=/%{(\w+)}/g,Ze=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Be={};function $e(I){var _=Ye();return I=_?_.createScriptURL(I):I,new it(I,Be)}function wt(I,_){this.a=_===ht?I:""}wt.prototype.ta=!0,wt.prototype.sa=function(){return this.a.toString()},wt.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function vt(I){return I instanceof wt&&I.constructor===wt?I.a:(B("expected object of type SafeUrl, got '"+I+"' of type "+p(I)),"type_error:SafeUrl")}var Rt=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,Gt=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,At=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function pt(I){if(I instanceof wt)return I;if(I=typeof I=="object"&&I.ta?I.sa():String(I),At.test(I))I=new wt(I,ht);else{I=String(I),I=I.replace(/(%0A|%0D)/g,"");var _=I.match(Gt);I=_&&Rt.test(_[1])?new wt(I,ht):null}return I}function Wt(I){return I instanceof wt?I:(I=typeof I=="object"&&I.ta?I.sa():String(I),At.test(I)||(I="about:invalid#zClosurez"),new wt(I,ht))}var ht={},ct=new wt("about:invalid#zClosurez",ht);function It(I,_,ce){this.a=ce===Ve?I:""}It.prototype.ta=!0,It.prototype.sa=function(){return this.a.toString()},It.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function Ft(I){return I instanceof It&&I.constructor===It?I.a:(B("expected object of type SafeHtml, got '"+I+"' of type "+p(I)),"type_error:SafeHtml")}var Ve={};function ft(I,_){ke(I,"HTMLScriptElement"),I.src=ut(_),(_=I.ownerDocument&&I.ownerDocument.defaultView)&&_!=s?_=d(_.document):(u===null&&(u=d(s.document)),_=u),_&&I.setAttribute("nonce",_)}function kt(I,_,ce,Ce){return I=I instanceof wt?I:Wt(I),_=_||s,ce=ce instanceof Oe?st(ce):ce||"",_.open(vt(I),ce,Ce,void 0)}function rt(I,_){for(var ce=I.split("%s"),Ce="",_e=Array.prototype.slice.call(arguments,1);_e.length&&1")!=-1&&(I=I.replace(De,">")),I.indexOf('"')!=-1&&(I=I.replace(Ae,""")),I.indexOf("'")!=-1&&(I=I.replace(ue,"'")),I.indexOf("\0")!=-1&&(I=I.replace(fe,"�"))),I}function Ge(I){return Ge[" "](I),I}Ge[" "]=f;function yt(I,_){var ce=yo;return Object.prototype.hasOwnProperty.call(ce,I)?ce[I]:ce[I]=_(I)}var Pt=Ne("Opera"),ot=Ne("Trident")||Ne("MSIE"),bt=Ne("Edge"),zt=bt||ot,Bt=Ne("Gecko")&&!(we(Ie.toLowerCase(),"webkit")&&!Ne("Edge"))&&!(Ne("Trident")||Ne("MSIE"))&&!Ne("Edge"),tt=we(Ie.toLowerCase(),"webkit")&&!Ne("Edge");function Ht(){var I=s.document;return I?I.documentMode:void 0}var _t;e:{var qt="",un=function(){var I=Ie;if(Bt)return/rv:([^\);]+)(\)|;)/.exec(I);if(bt)return/Edge\/([\d\.]+)/.exec(I);if(ot)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(I);if(tt)return/WebKit\/(\S+)/.exec(I);if(Pt)return/(?:Version)[ \/]?(\S+)/.exec(I)}();if(un&&(qt=un?un[1]:""),ot){var Rn=Ht();if(Rn!=null&&Rn>parseFloat(qt)){_t=String(Rn);break e}}_t=qt}var yo={};function Ao(I){return yt(I,function(){for(var _=0,ce=ge(String(_t)).split("."),Ce=ge(String(I)).split("."),_e=Math.max(ce.length,Ce.length),St=0;_==0&&St<_e;St++){var Lt=ce[St]||"",dn=Ce[St]||"";do{if(Lt=/(\d*)(\D*)(.*)/.exec(Lt)||["","","",""],dn=/(\d*)(\D*)(.*)/.exec(dn)||["","","",""],Lt[0].length==0&&dn[0].length==0)break;_=Pe(Lt[1].length==0?0:parseInt(Lt[1],10),dn[1].length==0?0:parseInt(dn[1],10))||Pe(Lt[2].length==0,dn[2].length==0)||Pe(Lt[2],dn[2]),Lt=Lt[3],dn=dn[3]}while(_==0)}return 0<=_})}var wo;if(s.document&&ot){var Io=Ht();wo=Io||parseInt(_t,10)||void 0}else wo=void 0;var po=wo;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch{}var On=!ot||9<=Number(po);function fo(I){var _=document;return typeof I=="string"?_.getElementById(I):I}function ir(I,_){Je(_,function(ce,Ce){ce&&typeof ce=="object"&&ce.ta&&(ce=ce.sa()),Ce=="style"?I.style.cssText=ce:Ce=="class"?I.className=ce:Ce=="for"?I.htmlFor=ce:Rr.hasOwnProperty(Ce)?I.setAttribute(Rr[Ce],ce):Ce.lastIndexOf("aria-",0)==0||Ce.lastIndexOf("data-",0)==0?I.setAttribute(Ce,ce):I[Ce]=ce})}var Rr={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function br(I,_,ce){var Ce=arguments,_e=document,St=String(Ce[0]),Lt=Ce[1];if(!On&&Lt&&(Lt.name||Lt.type)){if(St=["<",St],Lt.name&&St.push(' name="',at(Lt.name),'"'),Lt.type){St.push(' type="',at(Lt.type),'"');var dn={};Ee(dn,Lt),delete dn.type,Lt=dn}St.push(">"),St=St.join("")}return St=jo(_e,St),Lt&&(typeof Lt=="string"?St.className=Lt:Array.isArray(Lt)?St.className=Lt.join(" "):ir(St,Lt)),2"u"&&typeof window<"u"&&window.postMessage&&window.addEventListener&&!Ne("Presto")&&(I=function(){var _e=jo(document,"IFRAME");_e.style.display="none",document.documentElement.appendChild(_e);var St=_e.contentWindow;_e=St.document,_e.open(),_e.close();var Lt="callImmediate"+Math.random(),dn=St.location.protocol=="file:"?"*":St.location.protocol+"//"+St.location.host;_e=w(function(lo){(dn=="*"||lo.origin==dn)&&lo.data==Lt&&this.port1.onmessage()},this),St.addEventListener("message",_e,!1),this.port1={},this.port2={postMessage:function(){St.postMessage(Lt,dn)}}}),typeof I<"u"&&!Ne("Trident")&&!Ne("MSIE")){var _=new I,ce={},Ce=ce;return _.port1.onmessage=function(){if(ce.next!==void 0){ce=ce.next;var _e=ce.Hb;ce.Hb=null,_e()}},function(_e){Ce.next={Hb:_e},Ce=Ce.next,_.port2.postMessage(0)}}return function(_e){s.setTimeout(_e,0)}}function Wo(I,_){to||Bn(),Ko||(to(),Ko=!0),So.add(I,_)}var to;function Bn(){if(s.Promise&&s.Promise.resolve){var I=s.Promise.resolve(void 0);to=function(){I.then(Qo)}}else to=function(){var _=Qo;!A(s.setImmediate)||s.Window&&s.Window.prototype&&!Ne("Edge")&&s.Window.prototype.setImmediate==s.setImmediate?(In||(In=ar()),In(_)):s.setImmediate(_)}}var Ko=!1,So=new G;function Qo(){for(var I;I=$();){try{I.a.call(I.b)}catch(_){wn(_)}V(q,I)}Ko=!1}function Yo(I,_){if(this.a=lr,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,I!=f)try{var ce=this;I.call(_,function(Ce){Fs(ce,fr,Ce)},function(Ce){if(!(Ce instanceof mu))try{throw Ce instanceof Error?Ce:Error("Promise rejected.")}catch{}Fs(ce,ei,Ce)})}catch(Ce){Fs(this,ei,Ce)}}var lr=0,fr=2,ei=3;function hr(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}hr.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var tr=new O(function(){return new hr},function(I){I.reset()});function bi(I,_,ce){var Ce=tr.get();return Ce.g=I,Ce.b=_,Ce.f=ce,Ce}function Fo(I){if(I instanceof Yo)return I;var _=new Yo(f);return Fs(_,fr,I),_}function Si(I){return new Yo(function(_,ce){ce(I)})}function hl(I,_,ce){ks(I,_,ce,null)||Wo(x(_,I))}function nr(I){return new Yo(function(_,ce){var Ce=I.length,_e=[];if(Ce)for(var St=function(Mo,Mi){Ce--,_e[Mo]=Mi,Ce==0&&_(_e)},Lt=function(Mo){ce(Mo)},dn=0,lo;dn=I.keyCode)&&(I.keyCode=-1)}catch{}},Tt.prototype.g=function(){return this.a};var Zt="closure_listenable_"+(1e6*Math.random()|0),cn=0;function yn(I,_,ce,Ce,_e){this.listener=I,this.proxy=null,this.src=_,this.type=ce,this.capture=!!Ce,this.Wa=_e,this.key=++cn,this.wa=this.Qa=!1}function An(I){I.wa=!0,I.listener=null,I.proxy=null,I.src=null,I.Wa=null}function Tn(I){this.src=I,this.a={},this.b=0}Tn.prototype.add=function(I,_,ce,Ce,_e){var St=I.toString();I=this.a[St],I||(I=this.a[St]=[],this.b++);var Lt=Yn(I,_,Ce,_e);return-1Ce.keyCode||Ce.returnValue!=null)){e:{var _e=!1;if(Ce.keyCode==0)try{Ce.keyCode=-1;break e}catch{_e=!0}(_e||Ce.returnValue==null)&&(Ce.returnValue=!0)}for(Ce=[],_e=_.b;_e;_e=_e.parentNode)Ce.push(_e);for(I=I.type,_e=Ce.length-1;0<=_e;_e--){_.b=Ce[_e];var St=Qu(Ce[_e],I,!0,_);ce=ce&&St}for(_e=0;_e>>0);function zf(I){return A(I)?I:(I[ed]||(I[ed]=function(_){return I.handleEvent(_)}),I[ed])}function Kl(){fn.call(this),this.v=new Tn(this),this.bc=this,this.hb=null}b(Kl,fn),Kl.prototype[Zt]=!0,Kl.prototype.addEventListener=function(I,_,ce,Ce){qn(this,I,_,ce,Ce)},Kl.prototype.removeEventListener=function(I,_,ce,Ce){Or(this,I,_,ce,Ce)},Kl.prototype.dispatchEvent=function(I){var _,ce=this.hb;if(ce)for(_=[];ce;ce=ce.hb)_.push(ce);ce=this.bc;var Ce=I.type||I;if(typeof I=="string")I=new Nt(I,ce);else if(I instanceof Nt)I.target=I.target||ce;else{var _e=I;I=new Nt(Ce,ce),Ee(I,_e)}if(_e=!0,_)for(var St=_.length-1;0<=St;St--){var Lt=I.b=_[St];_e=bp(Lt,Ce,!0,I)&&_e}if(Lt=I.b=ce,_e=bp(Lt,Ce,!0,I)&&_e,_e=bp(Lt,Ce,!1,I)&&_e,_)for(St=0;St<_.length;St++)Lt=I.b=_[St],_e=bp(Lt,Ce,!1,I)&&_e;return _e},Kl.prototype.Da=function(){if(Kl.bb.Da.call(this),this.v){var I=this.v,_;for(_ in I.a){for(var ce=I.a[_],Ce=0;Ce_)throw Error("Bad port number "+_);I.g=_}else I.g=null}function Og(I,_,ce){_ instanceof Vg?(I.b=_,i7(I.b,I.i)):(ce||(_=zh(_,Dh)),I.b=new Vg(_,I.i))}function ol(I,_,ce){I.b.set(_,ce)}function Ud(I,_){return I.b.get(_)}function wu(I){return I instanceof Ls?new Ls(I):new Ls(I,void 0)}function p5(I,_,ce,Ce){var _e=new Ls(null,void 0);return I&&ec(_e,I),_&&(_e.a=_),ce&&xl(_e,ce),Ce&&(_e.f=Ce),_e}function wy(I,_){return I?_?decodeURI(I.replace(/%25/g,"%2525")):decodeURIComponent(I):""}function zh(I,_,ce){return typeof I=="string"?(I=encodeURI(I).replace(_,P3),ce&&(I=I.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),I):null}function P3(I){return I=I.charCodeAt(0),"%"+(I>>4&15).toString(16)+(I&15).toString(16)}var vy=/[#\/\?@]/g,C3=/[#\?:]/g,g5=/[#\?]/g,Dh=/[#\?@]/g,R3=/#/g;function Vg(I,_){this.b=this.a=null,this.c=I||null,this.f=!!_}function jd(I){I.a||(I.a=new V0,I.b=0,I.c&&Au(I.c,function(_,ce){I.add(decodeURIComponent(_.replace(/\+/g," ")),ce)}))}function r7(I){var _=g1(I);if(typeof _>"u")throw Error("Keys are undefined");var ce=new Vg(null,void 0);I=yu(I);for(var Ce=0;Ce<_.length;Ce++){var _e=_[Ce],St=I[Ce];Array.isArray(St)?xy(ce,_e,St):ce.add(_e,St)}return ce}t=Vg.prototype,t.add=function(I,_){jd(this),this.c=null,I=vu(this,I);var ce=this.a.get(I);return ce||this.a.set(I,ce=[]),ce.push(_),this.b+=1,this};function Gc(I,_){jd(I),_=vu(I,_),Yg(I.a.b,_)&&(I.c=null,I.b-=I.a.get(_).length,I=I.a,Yg(I.b,_)&&(delete I.b[_],I.c--,I.a.length>2*I.c&&Ih(I)))}t.clear=function(){this.a=this.c=null,this.b=0};function ys(I,_){return jd(I),_=vu(I,_),Yg(I.a.b,_)}t.forEach=function(I,_){jd(this),this.a.forEach(function(ce,Ce){se(ce,function(_e){I.call(_,_e,Ce,this)},this)},this)},t.Y=function(){jd(this);for(var I=this.a.X(),_=this.a.Y(),ce=[],Ce=0;Ce<_.length;Ce++)for(var _e=I[Ce],St=0;St<_e.length;St++)ce.push(_[Ce]);return ce},t.X=function(I){jd(this);var _=[];if(typeof I=="string")ys(this,I)&&(_=le(_,this.a.get(vu(this,I))));else{I=this.a.X();for(var ce=0;ceI?!1:!ot||!po||9',I=(Ce=Ye())?Ce.createHTML(I):I,I=new It(I,null,Ve),Ce=Lt.document)&&(Ce.write(Ft(I)),Ce.close())):(Lt=kt(_,Ce,ce,Lt))&&I.noopener&&(Lt.opener=null),Lt)try{Lt.focus()}catch{}return Lt}function _g(I){return new Yo(function(_){function ce(){_c(2e3).then(function(){if(!I||I.closed)_();else return ce()})}return ce()})}var H3=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,m5=/^[^@]+@[^@]+$/;function Ws(){var I=null;return new Yo(function(_){s.document.readyState=="complete"?_():(I=function(){_()},Qi(window,"load",I))}).o(function(_){throw Or(window,"load",I),_})}function y5(){return ja(void 0)?Ws().then(function(){return new Yo(function(I,_){var ce=s.document,Ce=setTimeout(function(){_(Error("Cordova framework is not ready."))},1e3);ce.addEventListener("deviceready",function(){clearTimeout(Ce),I()},!1)})}):Si(Error("Cordova must run in an Android or iOS file scheme."))}function ja(I){return I=I||tc(),!(Bd()!=="file:"&&Bd()!=="ionic:"||!I.toLowerCase().match(/iphone|ipad|ipod|android/))}function M3(){var I=s.window;try{return!(!I||I==I.top)}catch{return!1}}function Rc(){return typeof s.WorkerGlobalScope<"u"&&typeof s.importScripts=="function"}function Ns(){return $n.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":$n.INTERNAL.hasOwnProperty("node")?"Node":Rc()?"Worker":"Browser"}function Gg(){var I=Ns();return I==="ReactNative"||I==="Node"}function DA(){for(var I=50,_=[];0"u"?null:Sy(I)}function S5(I){var _={},ce;for(ce in I)I.hasOwnProperty(ce)&&I[ce]!==null&&I[ce]!==void 0&&(_[ce]=I[ce]);return _}function Ty(I){if(I!==null)return JSON.parse(I)}function Jg(I){return I||Math.floor(1e9*Math.random()).toString()}function T5(I){return I=I||tc(),!(td(I)=="Safari"||I.toLowerCase().match(/iphone|ipad|ipod/))}function P5(){var I=s.___jsl;if(I&&I.H){for(var _ in I.H)if(I.H[_].r=I.H[_].r||[],I.H[_].L=I.H[_].L||[],I.H[_].r=I.H[_].L.concat(),I.CP)for(var ce=0;ce_)throw Error("Short delay should be less than long delay!");this.a=I,this.c=_,I=tc(),_=Ns(),this.b=Xc(I)||_==="ReactNative"}Df.prototype.get=function(){var I=s.navigator;return!(I&&typeof I.onLine=="boolean"&&(b5()||Bd()==="chrome-extension:"||typeof I.connection<"u"))||I.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};function EA(){var I=s.document;return I&&typeof I.visibilityState<"u"?I.visibilityState=="visible":!0}function a7(){var I=s.document,_=null;return EA()||!I?Fo():new Yo(function(ce){_=function(){EA()&&(I.removeEventListener("visibilitychange",_,!1),ce())},I.addEventListener("visibilitychange",_,!1)}).o(function(ce){throw I.removeEventListener("visibilitychange",_,!1),ce})}function I3(I){try{var _=new Date(parseInt(I,10));if(!isNaN(_.getTime())&&!/[^0-9]/.test(I))return _.toUTCString()}catch{}return null}function l7(){return!(!ql("fireauth.oauthhelper",s)&&!ql("fireauth.iframe",s))}function Jc(){var I=s.navigator;return I&&I.serviceWorker&&I.serviceWorker.controller||null}function G0(){var I=s.navigator;return I&&I.serviceWorker?Fo().then(function(){return I.serviceWorker.ready}).then(function(_){return _.active||null}).o(function(){return null}):Fo(null)}var s7={};function FA(I){s7[I]||(s7[I]=!0,typeof console<"u"&&typeof console.warn=="function"&&console.warn(I))}var z3;try{var kA={};Object.defineProperty(kA,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(kA,"abcd",{configurable:!0,enumerable:!0,value:2}),z3=kA.abcd==2}catch{z3=!1}function Hr(I,_,ce){z3?Object.defineProperty(I,_,{configurable:!0,enumerable:!0,value:ce}):I[_]=ce}function Kc(I,_){if(_)for(var ce in _)_.hasOwnProperty(ce)&&Hr(I,ce,_[ce])}function Ef(I){var _={};return Kc(_,I),_}function C5(I){var _={},ce;for(ce in I)I.hasOwnProperty(ce)&&(_[ce]=I[ce]);return _}function Py(I,_){if(!_||!_.length)return!0;if(!I)return!1;for(var ce=0;ce<_.length;ce++){var Ce=I[_[ce]];if(Ce==null||Ce==="")return!1}return!0}function y1(I){var _=I;if(typeof I=="object"&&I!=null){_="length"in I?[]:{};for(var ce in I)Hr(_,ce,y1(I[ce]))}return _}function R5(I){var _=I&&(I[NA]?"phone":null);if(_&&I&&I[WA]){Hr(this,"uid",I[WA]),Hr(this,"displayName",I[c7]||null);var ce=null;I[LA]&&(ce=new Date(I[LA]).toUTCString()),Hr(this,"enrollmentTime",ce),Hr(this,"factorId",_)}else throw new H("internal-error","Internal assert: invalid MultiFactorInfo object")}R5.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};function A1(I){try{var _=new rd(I)}catch{_=null}return _}var c7="displayName",LA="enrolledAt",WA="mfaEnrollmentId",NA="phoneInfo";function rd(I){R5.call(this,I),Hr(this,"phoneNumber",I[NA])}b(rd,R5),rd.prototype.w=function(){var I=rd.bb.w.call(this);return I.phoneNumber=this.phoneNumber,I};function D3(I){var _={},ce=I[v1],Ce=I[X0],_e=I[di];if(I=A1(I[E3]),!_e||_e!=w1&&_e!=Ut&&!ce||_e==Ut&&!Ce||_e==Eh&&!I)throw Error("Invalid checkActionCode response!");_e==Ut?(_[xS]=ce||null,_[Us]=ce||null,_[vS]=Ce):(_[xS]=Ce||null,_[Us]=Ce||null,_[vS]=ce||null),_[Yd]=I||null,Hr(this,SS,_e),Hr(this,bS,y1(_))}var Eh="REVERT_SECOND_FACTOR_ADDITION",w1="EMAIL_SIGNIN",Ut="VERIFY_AND_CHANGE_EMAIL",v1="email",E3="mfaInfo",X0="newEmail",di="requestType",vS="email",xS="fromEmail",Yd="multiFactorInfo",Us="previousEmail",bS="data",SS="operation";function UA(I){I=wu(I);var _=Ud(I,u7)||null,ce=Ud(I,d7)||null,Ce=Ud(I,jA)||null;if(Ce=Ce&&CS[Ce]||null,!_||!ce||!Ce)throw new H("argument-error",u7+", "+d7+"and "+jA+" are required in a valid action code URL.");Kc(this,{apiKey:_,operation:Ce,code:ce,continueUrl:Ud(I,Fh)||null,languageCode:Ud(I,TS)||null,tenantId:Ud(I,PS)||null})}var u7="apiKey",d7="oobCode",Fh="continueUrl",TS="languageCode",jA="mode",PS="tenantId",CS={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Eh,signIn:w1,verifyAndChangeEmail:Ut,verifyEmail:"VERIFY_EMAIL"};function F3(I){try{return new UA(I)}catch{return null}}function xu(I){var _=I[OA];if(typeof _>"u")throw new H("missing-continue-uri");if(typeof _!="string"||typeof _=="string"&&!_.length)throw new H("invalid-continue-uri");this.h=_,this.b=this.a=null,this.g=!1;var ce=I[f7];if(ce&&typeof ce=="object"){_=ce[p7];var Ce=ce[x1];if(ce=ce[VA],typeof _=="string"&&_.length){if(this.a=_,typeof Ce<"u"&&typeof Ce!="boolean")throw new H("argument-error",x1+" property must be a boolean when specified.");if(this.g=!!Ce,typeof ce<"u"&&(typeof ce!="string"||typeof ce=="string"&&!ce.length))throw new H("argument-error",VA+" property must be a non empty string when specified.");this.b=ce||null}else{if(typeof _<"u")throw new H("argument-error",p7+" property must be a non empty string when specified.");if(typeof Ce<"u"||typeof ce<"u")throw new H("missing-android-pkg-name")}}else if(typeof ce<"u")throw new H("argument-error",f7+" property must be a non null object when specified.");if(this.f=null,(_=I[h7])&&typeof _=="object"){if(_=_[Hc],typeof _=="string"&&_.length)this.f=_;else if(typeof _<"u")throw new H("argument-error",Hc+" property must be a non empty string when specified.")}else if(typeof _<"u")throw new H("argument-error",h7+" property must be a non null object when specified.");if(_=I[YA],typeof _<"u"&&typeof _!="boolean")throw new H("argument-error",YA+" property must be a boolean when specified.");if(this.c=!!_,I=I[BA],typeof I<"u"&&(typeof I!="string"||typeof I=="string"&&!I.length))throw new H("argument-error",BA+" property must be a non empty string when specified.");this.i=I||null}var f7="android",BA="dynamicLinkDomain",YA="handleCodeInApp",h7="iOS",OA="url",x1="installApp",VA="minimumVersion",p7="packageName",Hc="bundleId";function _A(I){var _={};_.continueUrl=I.h,_.canHandleCodeInApp=I.c,(_.androidPackageName=I.a)&&(_.androidMinimumVersion=I.b,_.androidInstallApp=I.g),_.iOSBundleId=I.f,_.dynamicLinkDomain=I.i;for(var ce in _)_[ce]===null&&delete _[ce];return _}function OM(I){return te(I,function(_){return _=_.toString(16),1<_.length?_:"0"+_}).join("")}var Kg=null;function Cy(I){var _=[];return VM(I,function(ce){_.push(ce)}),_}function VM(I,_){function ce(lo){for(;Ce>4),Lt!=64&&(_(St<<4&240|Lt>>2),dn!=64&&_(Lt<<6&192|dn))}}function Ar(){if(!Kg){Kg={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),_=["+/=","+/","-_=","-_.","-_"],ce=0;5>ce;ce++)for(var Ce=I.concat(_[ce].split("")),_e=0;_ethis.a?this.a:I),this.b=_.provider_id||_.firebase&&_.firebase.sign_in_provider||null,this.f=_.firebase&&_.firebase.tenant||null,this.c=!!_.is_anonymous||this.b=="anonymous"}qg.prototype.T=function(){return this.f},qg.prototype.l=function(){return this.c},qg.prototype.toString=function(){return this.h};function H5(I){try{return new qg(I)}catch{return null}}function g7(I){if(!I||(I=I.split("."),I.length!=3))return null;I=I[1];for(var _=(4-I.length%4)%4,ce=0;ce<_;ce++)I+=".";try{var Ce=Cy(I);for(I=[],ce=_=0;__e)I[ce++]=String.fromCharCode(_e);else if(191<_e&&224>_e){var St=Ce[_++];I[ce++]=String.fromCharCode((_e&31)<<6|St&63)}else if(239<_e&&365>_e){St=Ce[_++];var Lt=Ce[_++],dn=Ce[_++],lo=((_e&7)<<18|(St&63)<<12|(Lt&63)<<6|dn&63)-65536;I[ce++]=String.fromCharCode(55296+(lo>>10)),I[ce++]=String.fromCharCode(56320+(lo&1023))}else St=Ce[_++],Lt=Ce[_++],I[ce++]=String.fromCharCode((_e&15)<<12|(St&63)<<6|Lt&63)}return JSON.parse(I.join(""))}catch{}return null}var GA="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),id=["client_id","response_type","scope","redirect_uri","state"],Pp={nd:{Ja:"locale",va:700,ua:600,fa:"facebook.com",Ya:id},pd:{Ja:null,va:500,ua:750,fa:"github.com",Ya:id},qd:{Ja:"hl",va:515,ua:680,fa:"google.com",Ya:id},wd:{Ja:"lang",va:485,ua:705,fa:"twitter.com",Ya:GA},kd:{Ja:"locale",va:640,ua:600,fa:"apple.com",Ya:[]}};function k3(I){for(var _ in Pp)if(Pp[_].fa==I)return Pp[_];return null}function XA(I){var _={};_["facebook.com"]=ad,_["google.com"]=L3,_["github.com"]=KA,_["twitter.com"]=qA;var ce=I&&I[kh];try{if(ce)return _[ce]?new _[ce](I):new w0(I);if(typeof I[JA]<"u")return new M5(I)}catch{}return null}var JA="idToken",kh="providerId";function M5(I){var _=I[kh];if(!_&&I[JA]){var ce=H5(I[JA]);ce&&ce.b&&(_=ce.b)}if(!_)throw Error("Invalid additional user info!");(_=="anonymous"||_=="custom")&&(_=null),ce=!1,typeof I.isNewUser<"u"?ce=!!I.isNewUser:I.kind==="identitytoolkit#SignupNewUserResponse"&&(ce=!0),Hr(this,"providerId",_),Hr(this,"isNewUser",ce)}function w0(I){M5.call(this,I),I=Ty(I.rawUserInfo||"{}"),Hr(this,"profile",y1(I||{}))}b(w0,M5);function ad(I){if(w0.call(this,I),this.providerId!="facebook.com")throw Error("Invalid provider ID!")}b(ad,w0);function KA(I){if(w0.call(this,I),this.providerId!="github.com")throw Error("Invalid provider ID!");Hr(this,"username",this.profile&&this.profile.login||null)}b(KA,w0);function L3(I){if(w0.call(this,I),this.providerId!="google.com")throw Error("Invalid provider ID!")}b(L3,w0);function qA(I){if(w0.call(this,I),this.providerId!="twitter.com")throw Error("Invalid provider ID!");Hr(this,"username",I.screenName||null)}b(qA,w0);function $g(I){var _=wu(I),ce=Ud(_,"link"),Ce=Ud(wu(ce),"link");return _=Ud(_,"deep_link_id"),Ud(wu(_),"link")||_||Ce||ce||I}function ld(I,_){if(!I&&!_)throw new H("internal-error","Internal assert: no raw session string available");if(I&&_)throw new H("internal-error","Internal assert: unable to determine the session type");this.a=I||null,this.b=_||null,this.type=this.a?I5:$A}var I5="enroll",$A="signin";ld.prototype.Ha=function(){return this.a?Fo(this.a):Fo(this.b)},ld.prototype.w=function(){return this.type==I5?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}};function Cp(){}Cp.prototype.ka=function(){},Cp.prototype.b=function(){},Cp.prototype.c=function(){},Cp.prototype.w=function(){};function Ry(I,_){return I.then(function(ce){if(ce[rn]){var Ce=H5(ce[rn]);if(!Ce||_!=Ce.i)throw new H("user-mismatch");return ce}throw new H("user-mismatch")}).o(function(ce){throw ce&&ce.code&&ce.code==E+"user-not-found"?new H("user-mismatch"):ce})}function b1(I,_){if(_)this.a=_;else throw new H("internal-error","failed to construct a credential");Hr(this,"providerId",I),Hr(this,"signInMethod",I)}b1.prototype.ka=function(I){return IS(I,Mc(this))},b1.prototype.b=function(I,_){var ce=Mc(this);return ce.idToken=_,$0(I,ce)},b1.prototype.c=function(I,_){return Ry(JM(I,Mc(this)),_)};function Mc(I){return{pendingToken:I.a,requestUri:"http://localhost"}}b1.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}};function z5(I){if(I&&I.providerId&&I.signInMethod&&I.providerId.indexOf("saml.")==0&&I.pendingToken)try{return new b1(I.providerId,I.pendingToken)}catch{}return null}function Od(I,_,ce){if(this.a=null,_.idToken||_.accessToken)_.idToken&&Hr(this,"idToken",_.idToken),_.accessToken&&Hr(this,"accessToken",_.accessToken),_.nonce&&!_.pendingToken&&Hr(this,"nonce",_.nonce),_.pendingToken&&(this.a=_.pendingToken);else if(_.oauthToken&&_.oauthTokenSecret)Hr(this,"accessToken",_.oauthToken),Hr(this,"secret",_.oauthTokenSecret);else throw new H("internal-error","failed to construct a credential");Hr(this,"providerId",I),Hr(this,"signInMethod",ce)}Od.prototype.ka=function(I){return IS(I,bu(this))},Od.prototype.b=function(I,_){var ce=bu(this);return ce.idToken=_,$0(I,ce)},Od.prototype.c=function(I,_){var ce=bu(this);return Ry(JM(I,ce),_)};function bu(I){var _={};return I.idToken&&(_.id_token=I.idToken),I.accessToken&&(_.access_token=I.accessToken),I.secret&&(_.oauth_token_secret=I.secret),_.providerId=I.providerId,I.nonce&&!I.a&&(_.nonce=I.nonce),_={postBody:r7(_).toString(),requestUri:"http://localhost"},I.a&&(delete _.postBody,_.pendingToken=I.a),_}Od.prototype.w=function(){var I={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(I.oauthIdToken=this.idToken),this.accessToken&&(I.oauthAccessToken=this.accessToken),this.secret&&(I.oauthTokenSecret=this.secret),this.nonce&&(I.nonce=this.nonce),this.a&&(I.pendingToken=this.a),I};function D5(I){if(I&&I.providerId&&I.signInMethod){var _={idToken:I.oauthIdToken,accessToken:I.oauthTokenSecret?null:I.oauthAccessToken,oauthTokenSecret:I.oauthTokenSecret,oauthToken:I.oauthTokenSecret&&I.oauthAccessToken,nonce:I.nonce,pendingToken:I.pendingToken};try{return new Od(I.providerId,_,I.signInMethod)}catch{}}return null}function Vd(I,_){this.Qc=_||[],Kc(this,{providerId:I,isOAuthProvider:!0}),this.Jb={},this.qb=(k3(I)||{}).Ja||null,this.pb=null}Vd.prototype.Ka=function(I){return this.Jb=nt(I),this};function Ff(I){if(typeof I!="string"||I.indexOf("saml.")!=0)throw new H("argument-error",'SAML provider IDs must be prefixed with "saml."');Vd.call(this,I,[])}b(Ff,Vd);function J0(I){Vd.call(this,I,id),this.a=[]}b(J0,Vd),J0.prototype.Ca=function(I){return he(this.a,I)||this.a.push(I),this},J0.prototype.Rb=function(){return Te(this.a)},J0.prototype.credential=function(I,_){var ce;if(y(I)?ce={idToken:I.idToken||null,accessToken:I.accessToken||null,nonce:I.rawNonce||null}:ce={idToken:I||null,accessToken:_||null},!ce.idToken&&!ce.accessToken)throw new H("argument-error","credential failed: must provide the ID token and/or the access token.");return new Od(this.providerId,ce,this.providerId)};function Ms(){J0.call(this,"facebook.com")}b(Ms,J0),Hr(Ms,"PROVIDER_ID","facebook.com"),Hr(Ms,"FACEBOOK_SIGN_IN_METHOD","facebook.com");function E5(I){if(!I)throw new H("argument-error","credential failed: expected 1 argument (the OAuth access token).");var _=I;return y(I)&&(_=I.accessToken),new Ms().credential({accessToken:_})}function Qg(){J0.call(this,"github.com")}b(Qg,J0),Hr(Qg,"PROVIDER_ID","github.com"),Hr(Qg,"GITHUB_SIGN_IN_METHOD","github.com");function QA(I){if(!I)throw new H("argument-error","credential failed: expected 1 argument (the OAuth access token).");var _=I;return y(I)&&(_=I.accessToken),new Qg().credential({accessToken:_})}function Hy(){J0.call(this,"google.com"),this.Ca("profile")}b(Hy,J0),Hr(Hy,"PROVIDER_ID","google.com"),Hr(Hy,"GOOGLE_SIGN_IN_METHOD","google.com");function My(I,_){var ce=I;return y(I)&&(ce=I.idToken,_=I.accessToken),new Hy().credential({idToken:ce,accessToken:_})}function Zg(){Vd.call(this,"twitter.com",GA)}b(Zg,Vd),Hr(Zg,"PROVIDER_ID","twitter.com"),Hr(Zg,"TWITTER_SIGN_IN_METHOD","twitter.com");function $l(I,_){var ce=I;if(y(ce)||(ce={oauthToken:I,oauthTokenSecret:_}),!ce.oauthToken||!ce.oauthTokenSecret)throw new H("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new Od("twitter.com",ce,"twitter.com")}function Hi(I,_,ce){this.a=I,this.f=_,Hr(this,"providerId","password"),Hr(this,"signInMethod",ce===rl.EMAIL_LINK_SIGN_IN_METHOD?rl.EMAIL_LINK_SIGN_IN_METHOD:rl.EMAIL_PASSWORD_SIGN_IN_METHOD)}Hi.prototype.ka=function(I){return this.signInMethod==rl.EMAIL_LINK_SIGN_IN_METHOD?ka(I,jy,{email:this.a,oobCode:this.f}):ka(I,tI,{email:this.a,password:this.f})},Hi.prototype.b=function(I,_){return this.signInMethod==rl.EMAIL_LINK_SIGN_IN_METHOD?ka(I,qd,{idToken:_,email:this.a,oobCode:this.f}):ka(I,QM,{idToken:_,email:this.a,password:this.f})},Hi.prototype.c=function(I,_){return Ry(this.ka(I),_)},Hi.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}};function Ic(I){return I&&I.email&&I.password?new Hi(I.email,I.password,I.signInMethod):null}function rl(){Kc(this,{providerId:"password",isOAuthProvider:!1})}function js(I,_){if(_=Su(_),!_)throw new H("argument-error","Invalid email link!");return new Hi(I,_.code,rl.EMAIL_LINK_SIGN_IN_METHOD)}function Su(I){return I=$g(I),(I=F3(I))&&I.operation===w1?I:null}Kc(rl,{PROVIDER_ID:"password"}),Kc(rl,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Kc(rl,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"});function _d(I){if(!(I.fb&&I.eb||I.La&&I.ea))throw new H("internal-error");this.a=I,Hr(this,"providerId","phone"),this.fa="phone",Hr(this,"signInMethod","phone")}_d.prototype.ka=function(I){return I.gb(Rp(this))},_d.prototype.b=function(I,_){var ce=Rp(this);return ce.idToken=_,ka(I,FU,ce)},_d.prototype.c=function(I,_){var ce=Rp(this);return ce.operation="REAUTH",I=ka(I,lm,ce),Ry(I,_)},_d.prototype.w=function(){var I={providerId:"phone"};return this.a.fb&&(I.verificationId=this.a.fb),this.a.eb&&(I.verificationCode=this.a.eb),this.a.La&&(I.temporaryProof=this.a.La),this.a.ea&&(I.phoneNumber=this.a.ea),I};function nc(I){if(I&&I.providerId==="phone"&&(I.verificationId&&I.verificationCode||I.temporaryProof&&I.phoneNumber)){var _={};return se(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(ce){I[ce]&&(_[ce]=I[ce])}),new _d(_)}return null}function Rp(I){return I.a.La&&I.a.ea?{temporaryProof:I.a.La,phoneNumber:I.a.ea}:{sessionInfo:I.a.fb,code:I.a.eb}}function sd(I){try{this.a=I||$n.auth()}catch{throw new H("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Kc(this,{providerId:"phone",isOAuthProvider:!1})}sd.prototype.gb=function(I,_){var ce=this.a.a;return Fo(_.verify()).then(function(Ce){if(typeof Ce!="string")throw new H("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(_.type){case"recaptcha":var _e=y(I)?I.session:null,St=y(I)?I.phoneNumber:I,Lt;return _e&&_e.type==I5?Lt=_e.Ha().then(function(dn){return l4(ce,{idToken:dn,phoneEnrollmentInfo:{phoneNumber:St,recaptchaToken:Ce}})}):_e&&_e.type==$A?Lt=_e.Ha().then(function(dn){return HS(ce,{mfaPendingCredential:dn,mfaEnrollmentId:I.multiFactorHint&&I.multiFactorHint.uid||I.multiFactorUid,phoneSignInInfo:{recaptchaToken:Ce}})}):Lt=a4(ce,{phoneNumber:St,recaptchaToken:Ce}),Lt.then(function(dn){return typeof _.reset=="function"&&_.reset(),dn},function(dn){throw typeof _.reset=="function"&&_.reset(),dn});default:throw new H("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})};function W3(I,_){if(!I)throw new H("missing-verification-id");if(!_)throw new H("missing-verification-code");return new _d({fb:I,eb:_})}Kc(sd,{PROVIDER_ID:"phone"}),Kc(sd,{PHONE_SIGN_IN_METHOD:"phone"});function N3(I){if(I.temporaryProof&&I.phoneNumber)return new _d({La:I.temporaryProof,ea:I.phoneNumber});var _=I&&I.providerId;if(!_||_==="password")return null;var ce=I&&I.oauthAccessToken,Ce=I&&I.oauthTokenSecret,_e=I&&I.nonce,St=I&&I.oauthIdToken,Lt=I&&I.pendingToken;try{switch(_){case"google.com":return My(St,ce);case"facebook.com":return E5(ce);case"github.com":return QA(ce);case"twitter.com":return $l(ce,Ce);default:return ce||Ce||St||Lt?Lt?_.indexOf("saml.")==0?new b1(_,Lt):new Od(_,{pendingToken:Lt,idToken:I.oauthIdToken,accessToken:I.oauthAccessToken},_):new J0(_).credential({idToken:St,accessToken:ce,rawNonce:_e}):null}}catch{return null}}function em(I){if(!I.isOAuthProvider)throw new H("invalid-oauth-provider")}function Ql(I,_,ce,Ce,_e,St,Lt){if(this.c=I,this.b=_||null,this.g=ce||null,this.f=Ce||null,this.i=St||null,this.h=Lt||null,this.a=_e||null,this.g||this.a){if(this.g&&this.a)throw new H("invalid-auth-event");if(this.g&&!this.f)throw new H("invalid-auth-event")}else throw new H("invalid-auth-event")}Ql.prototype.getUid=function(){var I=[];return I.push(this.c),this.b&&I.push(this.b),this.f&&I.push(this.f),this.h&&I.push(this.h),I.join("-")},Ql.prototype.T=function(){return this.h},Ql.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};function ZA(I){return I=I||{},I.type?new Ql(I.type,I.eventId,I.urlResponse,I.sessionId,I.error&&F(I.error),I.postBody,I.tenantId):null}function U3(){this.b=null,this.a=[]}var S1=null;function j3(I){var _=S1;_.a.push(I),_.b||(_.b=function(ce){for(var Ce=0;Ce<_.a.length;Ce++)_.a[Ce](ce)},I=ql("universalLinks.subscribe",s),typeof I=="function"&&I(null,_.b))}function F5(I){var _="unauthorized-domain",ce=void 0,Ce=wu(I);I=Ce.a,Ce=Ce.c,Ce=="chrome-extension"?ce=rt("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):Ce=="http"||Ce=="https"?ce=rt("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):_="operation-not-supported-in-this-environment",H.call(this,_,ce)}b(F5,H);function Tu(I,_,ce){H.call(this,I,ce),I=_||{},I.Kb&&Hr(this,"email",I.Kb),I.ea&&Hr(this,"phoneNumber",I.ea),I.credential&&Hr(this,"credential",I.credential),I.$b&&Hr(this,"tenantId",I.$b)}b(Tu,H),Tu.prototype.w=function(){var I={code:this.code,message:this.message};this.email&&(I.email=this.email),this.phoneNumber&&(I.phoneNumber=this.phoneNumber),this.tenantId&&(I.tenantId=this.tenantId);var _=this.credential&&this.credential.w();return _&&Ee(I,_),I},Tu.prototype.toJSON=function(){return this.w()};function Iy(I){if(I.code){var _=I.code||"";_.indexOf(E)==0&&(_=_.substring(E.length));var ce={credential:N3(I),$b:I.tenantId};if(I.email)ce.Kb=I.email;else if(I.phoneNumber)ce.ea=I.phoneNumber;else if(!ce.credential)return new H(_,I.message||void 0);return new Tu(_,ce,I.message)}return null}function Gd(){}Gd.prototype.c=null;function k5(I){return I.c||(I.c=I.b())}var zy;function Dy(){}b(Dy,Gd),Dy.prototype.a=function(){var I=B3(this);return I?new ActiveXObject(I):new XMLHttpRequest},Dy.prototype.b=function(){var I={};return B3(this)&&(I[0]=!0,I[1]=!0),I};function B3(I){if(!I.f&&typeof XMLHttpRequest>"u"&&typeof ActiveXObject<"u"){for(var _=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],ce=0;ce<_.length;ce++){var Ce=_[ce];try{return new ActiveXObject(Ce),I.f=Ce}catch{}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return I.f}zy=new Dy;function T1(){}b(T1,Gd),T1.prototype.a=function(){var I=new XMLHttpRequest;if("withCredentials"in I)return I;if(typeof XDomainRequest<"u")return new v0;throw Error("Unsupported browser")},T1.prototype.b=function(){return{}};function v0(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=w(this.qc,this),this.a.onerror=w(this.Tb,this),this.a.onprogress=w(this.rc,this),this.a.ontimeout=w(this.vc,this)}t=v0.prototype,t.open=function(I,_,ce){if(ce!=null&&!ce)throw Error("Only async requests are supported.");this.a.open(I,_)},t.send=function(I){if(I)if(typeof I=="string")this.a.send(I);else throw Error("Only string data is supported");else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(I){return I.toLowerCase()=="content-type"?this.a.contentType:""},t.qc=function(){this.status=200,this.response=this.responseText=this.a.responseText,kf(this,4)},t.Tb=function(){this.status=500,this.response=this.responseText="",kf(this,4)},t.vc=function(){this.Tb()},t.rc=function(){this.status=200,kf(this,1)};function kf(I,_){I.readyState=_,I.onreadystatechange&&I.onreadystatechange()}t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType};function cd(I,_,ce){this.reset(I,_,ce,void 0,void 0)}cd.prototype.a=null,cd.prototype.reset=function(I,_,ce,Ce,_e){delete this.a};function tm(I){this.f=I,this.b=this.c=this.a=null}function $r(I,_){this.name=I,this.value=_}$r.prototype.toString=function(){return this.name};var m7=new $r("SEVERE",1e3),Y3=new $r("WARNING",900),Ey=new $r("CONFIG",700),RS=new $r("FINE",500);function P1(I){return I.c?I.c:I.a?P1(I.a):(B("Root logger has no level set."),null)}tm.prototype.log=function(I,_,ce){if(I.value>=P1(this).value)for(A(_)&&(_=_()),I=new cd(I,String(_),this.f),ce&&(I.a=ce),ce=this;ce;)ce=ce.a};var e4={},K0=null;function O3(I){K0||(K0=new tm(""),e4[""]=K0,K0.c=Ey);var _;if(!(_=e4[I])){_=new tm(I);var ce=I.lastIndexOf("."),Ce=I.substr(ce+1);ce=O3(I.substr(0,ce)),ce.b||(ce.b={}),ce.b[Ce]=_,_.a=ce,e4[I]=_}return _}function oc(I,_){I&&I.log(RS,_,void 0)}function Fy(I){this.f=I}b(Fy,Gd),Fy.prototype.a=function(){return new L5(this.f)},Fy.prototype.b=function(I){return function(){return I}}({});function L5(I){Kl.call(this),this.u=I,this.h=void 0,this.readyState=W5,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=O3("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}b(L5,Kl);var W5=0;t=L5.prototype,t.open=function(I,_){if(this.readyState!=W5)throw this.abort(),Error("Error reopening a connection");this.s=I,this.f=_,this.readyState=1,ky(this)},t.send=function(I){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.a=!0;var _={headers:this.l,method:this.s,credentials:this.h,cache:void 0};I&&(_.body=I),this.u.fetch(new Request(this.f,_)).then(this.uc.bind(this),this.Va.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&this.readyState!=4&&(this.a=!1,Lf(this)),this.readyState=W5},t.uc=function(I){this.a&&(this.g=I,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=I.headers,this.readyState=2,ky(this)),this.a&&(this.readyState=3,ky(this),this.a&&(this.responseType==="arraybuffer"?I.arrayBuffer().then(this.sc.bind(this),this.Va.bind(this)):typeof s.ReadableStream<"u"&&"body"in I?(this.response=this.responseText="",this.c=I.body.getReader(),this.m=new TextDecoder,x0(this)):I.text().then(this.tc.bind(this),this.Va.bind(this)))))};function x0(I){I.c.read().then(I.pc.bind(I)).catch(I.Va.bind(I))}t.pc=function(I){if(this.a){var _=this.m.decode(I.value?I.value:new Uint8Array(0),{stream:!I.done});_&&(this.response=this.responseText+=_),I.done?Lf(this):ky(this),this.readyState==3&&x0(this)}},t.tc=function(I){this.a&&(this.response=this.responseText=I,Lf(this))},t.sc=function(I){this.a&&(this.response=I,Lf(this))},t.Va=function(I){var _=this.i;_&&_.log(Y3,"Failed to fetch url "+this.f,I instanceof Error?I:Error(I)),this.a&&Lf(this)};function Lf(I){I.readyState=4,I.g=null,I.c=null,I.m=null,ky(I)}t.setRequestHeader=function(I,_){this.l.append(I,_)},t.getResponseHeader=function(I){return this.b?this.b.get(I.toLowerCase())||"":((I=this.i)&&I.log(Y3,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var I=this.i;return I&&I.log(Y3,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}I=[];for(var _=this.b.entries(),ce=_.next();!ce.done;)ce=ce.value,I.push(ce[0]+": "+ce[1]),ce=_.next();return I.join(`\r -`)};function ky(I){I.onreadystatechange&&I.onreadystatechange.call(I)}Object.defineProperty(L5.prototype,"withCredentials",{get:function(){return this.h==="include"},set:function(I){this.h=I?"include":"same-origin"}});function Ly(I){Kl.call(this),this.headers=new V0,this.D=I||null,this.c=!1,this.C=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.J=!1,this.g=0,this.s=null,this.m=N5,this.u=this.S=!1}b(Ly,Kl);var N5="";Ly.prototype.b=O3("goog.net.XhrIo");var nm=/^https?$/i,y7=["POST","PUT"];function om(I,_,ce,Ce,_e){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.l+"; newUri="+_);ce=ce?ce.toUpperCase():"GET",I.l=_,I.h="",I.P=ce,I.J=!1,I.c=!0,I.a=I.D?I.D.a():zy.a(),I.C=I.D?k5(I.D):k5(zy),I.a.onreadystatechange=w(I.Wb,I);try{oc(I.b,Lh(I,"Opening Xhr")),I.N=!0,I.a.open(ce,String(_),!0),I.N=!1}catch(Lt){oc(I.b,Lh(I,"Error opening Xhr: "+Lt.message)),C1(I,Lt);return}_=Ce||"";var St=new V0(I.headers);_e&&m1(_e,function(Lt,dn){St.set(dn,Lt)}),_e=de(St.Y()),Ce=s.FormData&&_ instanceof s.FormData,!he(y7,ce)||_e||Ce||St.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),St.forEach(function(Lt,dn){this.a.setRequestHeader(dn,Lt)},I),I.m&&(I.a.responseType=I.m),"withCredentials"in I.a&&I.a.withCredentials!==I.S&&(I.a.withCredentials=I.S);try{n4(I),0=_.l&&_.cancel())}this.u?this.u.call(this.s,this):this.v=!0,this.a||(I=new U5,Wy(this),Xd(this,!1,I))}},im.prototype.m=function(I,_){this.i=!1,Xd(this,I,_)};function Xd(I,_,ce){I.a=!0,I.c=ce,I.f=!_,Jd(I)}function Wy(I){if(I.a){if(!I.v)throw new r4;I.v=!1}}function am(I,_){Ny(I,null,_,void 0)}function Ny(I,_,ce,Ce){I.g.push([_,ce,Ce]),I.a&&Jd(I)}im.prototype.then=function(I,_,ce){var Ce,_e,St=new Yo(function(Lt,dn){Ce=Lt,_e=dn});return Ny(this,Ce,function(Lt){Lt instanceof U5?St.cancel():_e(Lt)}),St.then(I,_,ce)},im.prototype.$goog_Thenable=!0;function b0(I){return oe(I.g,function(_){return A(_[1])})}function Jd(I){if(I.h&&I.a&&b0(I)){var _=I.h,ce=Hp[_];ce&&(s.clearTimeout(ce.a),delete Hp[_]),I.h=0}I.b&&(I.b.l--,delete I.b),_=I.c;for(var Ce=ce=!1;I.g.length&&!I.i;){var _e=I.g.shift(),St=_e[0],Lt=_e[1];if(_e=_e[2],St=I.f?Lt:St)try{var dn=St.call(_e||I.s,_);dn!==void 0&&(I.f=I.f&&(dn==_||dn instanceof Error),I.c=_=dn),(D(_)||typeof s.Promise=="function"&&_ instanceof s.Promise)&&(Ce=!0,I.i=!0)}catch(lo){_=lo,I.f=!0,b0(I)||(ce=!0)}}I.c=_,Ce&&(dn=w(I.m,I,!0),Ce=w(I.m,I,!1),_ instanceof im?(Ny(_,dn,Ce),_.C=!0):_.then(dn,Ce)),ce&&(_=new j5(_),Hp[_.a]=_,I.h=_.a)}function r4(){L.call(this)}b(r4,L),r4.prototype.message="Deferred has already fired",r4.prototype.name="AlreadyCalledError";function U5(){L.call(this)}b(U5,L),U5.prototype.message="Deferred was canceled",U5.prototype.name="CanceledError";function j5(I){this.a=s.setTimeout(w(this.c,this),0),this.b=I}j5.prototype.c=function(){throw delete Hp[this.a],this.b};var Hp={};function _3(I){var _={},ce=_.document||document,Ce=ut(I).toString(),_e=jo(document,"SCRIPT"),St={Xb:_e,Ma:void 0},Lt=new im(St),dn=null,lo=_.timeout!=null?_.timeout:5e3;return 0"u"||typeof s.Headers>"u"||typeof s.Request>"u"))throw new H("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var Lt=new Ly(this.f);if(St){Lt.g=Math.max(0,St);var dn=setTimeout(function(){Lt.dispatchEvent("timeout")},St)}O0(Lt,"complete",function(){dn&&clearTimeout(dn);var lo=null;try{lo=JSON.parse(Wf(this))||null}catch{lo=null}_&&_(lo)}),Mh(Lt,"ready",function(){dn&&clearTimeout(dn),Ot(this)}),Mh(Lt,"timeout",function(){dn&&clearTimeout(dn),Ot(this),_&&_(null)}),om(Lt,I,ce,Ce,_e)};var Kd=new Oe(xt,"https://apis.google.com/js/client.js?onload=%{onload}"),Fn="__fcb"+Math.floor(1e6*Math.random()).toString();function Mn(I,_){if(((window.gapi||{}).client||{}).request)I();else{s[Fn]=function(){((window.gapi||{}).client||{}).request?I():_(Error("CORS_UNSUPPORTED"))};var ce=Qe(Kd,{onload:Fn});am(_3(ce),function(){_(Error("CORS_UNSUPPORTED"))})}}Xe.prototype.s=function(I,_,ce,Ce,_e){var St=this;mt.then(function(){window.gapi.client.setApiKey(St.c);var Lt=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:I,method:ce,body:Ce,headers:_e,authType:"none",callback:function(dn){window.gapi.auth.setToken(Lt),_&&_(dn)}})}).o(function(Lt){_&&_({error:{message:Lt&&Lt.message||"CORS_UNSUPPORTED"}})})};function _n(I,_){return new Yo(function(ce,Ce){_.grant_type=="refresh_token"&&_.refresh_token||_.grant_type=="authorization_code"&&_.code?S0(I,I.l+"?key="+encodeURIComponent(I.c),function(_e){_e?_e.error?Ce(oI(_e)):_e.access_token&&_e.refresh_token?ce(_e):Ce(new H("internal-error")):Ce(new H("network-request-failed"))},"POST",r7(_).toString(),I.g,I.m.get()):Ce(new H("internal-error"))})}function xr(I,_,ce,Ce,_e,St,Lt){var dn=wu(_+ce);ol(dn,"key",I.c),Lt&&ol(dn,"cb",Date.now().toString());var lo=Ce=="GET";if(lo)for(var Mo in _e)_e.hasOwnProperty(Mo)&&ol(dn,Mo,_e[Mo]);return new Yo(function(Mi,bl){S0(I,dn.toString(),function(gl){gl?gl.error?bl(oI(gl,St||{})):Mi(gl):bl(new H("network-request-failed"))},Ce,lo?void 0:Sy(S5(_e)),I.a,I.v.get())})}function Fr(I){if(I=I.email,typeof I!="string"||!m5.test(I))throw new H("invalid-email")}function Zi(I){"email"in I&&Fr(I)}function Vi(I,_){return ka(I,Mte,{identifier:_,continueUri:b5()?ui():"http://localhost"}).then(function(ce){return ce.signinMethods||[]})}function ra(I){return ka(I,MU,{}).then(function(_){return _.authorizedDomains||[]})}function Ba(I){if(!I[rn])throw I.mfaPendingCredential?new H("multi-factor-auth-required",null,nt(I)):new H("internal-error")}function Pa(I){if(I.phoneNumber||I.temporaryProof){if(!I.phoneNumber||!I.temporaryProof)throw new H("internal-error")}else{if(!I.sessionInfo)throw new H("missing-verification-id");if(!I.code)throw new H("missing-verification-code")}}Xe.prototype.Ab=function(){return ka(this,zU,{})},Xe.prototype.Cb=function(I,_){return ka(this,IU,{idToken:I,email:_})},Xe.prototype.Db=function(I,_){return ka(this,QM,{idToken:I,password:_})};var Mp={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};t=Xe.prototype,t.Eb=function(I,_){var ce={idToken:I},Ce=[];return Je(Mp,function(_e,St){var Lt=_[St];Lt===null?Ce.push(_e):St in _&&(ce[St]=Lt)}),Ce.length&&(ce.deleteAttribute=Ce),ka(this,IU,ce)},t.wb=function(I,_){return I={requestType:"PASSWORD_RESET",email:I},Ee(I,_),ka(this,HU,I)},t.xb=function(I,_){return I={requestType:"EMAIL_SIGNIN",email:I},Ee(I,_),ka(this,Ete,I)},t.vb=function(I,_){return I={requestType:"VERIFY_EMAIL",idToken:I},Ee(I,_),ka(this,Fte,I)},t.Fb=function(I,_,ce){return I={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:I,newEmail:_},Ee(I,ce),ka(this,w7,I)};function a4(I,_){return ka(I,Wte,_)}t.gb=function(I){return ka(this,zS,I)};function l4(I,_){return ka(I,Nte,_).then(function(ce){return ce.phoneSessionInfo.sessionInfo})}function gi(I){if(!I.phoneVerificationInfo)throw new H("internal-error");if(!I.phoneVerificationInfo.sessionInfo)throw new H("missing-verification-id");if(!I.phoneVerificationInfo.code)throw new H("missing-verification-code")}function HS(I,_){return ka(I,ZM,_).then(function(ce){return ce.phoneResponseInfo.sessionInfo})}function GM(I,_,ce){return ka(I,zte,{idToken:_,deleteProvider:ce})}function Uy(I){if(!I.requestUri||!I.sessionId&&!I.postBody&&!I.pendingToken)throw new H("internal-error")}function XM(I,_){return _.oauthIdToken&&_.providerId&&_.providerId.indexOf("oidc.")==0&&!_.pendingToken&&(I.sessionId?_.nonce=I.sessionId:I.postBody&&(I=new Vg(I.postBody),ys(I,"nonce")&&(_.nonce=I.get("nonce")))),_}function MS(I){var _=null;if(I.needConfirmation?(I.code="account-exists-with-different-credential",_=Iy(I)):I.errorMessage=="FEDERATED_USER_ID_ALREADY_LINKED"?(I.code="credential-already-in-use",_=Iy(I)):I.errorMessage=="EMAIL_EXISTS"?(I.code="email-already-in-use",_=Iy(I)):I.errorMessage&&(_=nI(I.errorMessage)),_)throw _;Ba(I)}function IS(I,_){return _.returnIdpCredential=!0,ka(I,DU,_)}function $0(I,_){return _.returnIdpCredential=!0,ka(I,eI,_)}function JM(I,_){return _.returnIdpCredential=!0,_.autoCreate=!1,ka(I,v7,_)}function KM(I){if(!I.oobCode)throw new H("invalid-action-code")}t.ob=function(I,_){return ka(this,Lte,{oobCode:I,newPassword:_})},t.Sa=function(I){return ka(this,Hte,{oobCode:I})},t.kb=function(I){return ka(this,CU,{oobCode:I})};var CU={endpoint:"setAccountInfo",A:KM,Z:"email",B:!0},Hte={endpoint:"resetPassword",A:KM,G:function(I){var _=I.requestType;if(!_||!I.email&&_!="EMAIL_SIGNIN"&&_!="VERIFY_AND_CHANGE_EMAIL")throw new H("internal-error")},B:!0},RU={endpoint:"signupNewUser",A:function(I){if(Fr(I),!I.password)throw new H("weak-password")},G:Ba,V:!0,B:!0},Mte={endpoint:"createAuthUri",B:!0},Ite={endpoint:"deleteAccount",O:["idToken"]},zte={endpoint:"setAccountInfo",O:["idToken","deleteProvider"],A:function(I){if(!Array.isArray(I.deleteProvider))throw new H("internal-error")}},jy={endpoint:"emailLinkSignin",O:["email","oobCode"],A:Fr,G:Ba,V:!0,B:!0},qd={endpoint:"emailLinkSignin",O:["idToken","email","oobCode"],A:Fr,G:Ba,V:!0},qM={endpoint:"accounts/mfaEnrollment:finalize",O:["idToken","phoneVerificationInfo"],A:gi,G:Ba,B:!0,Na:!0},Dte={endpoint:"accounts/mfaSignIn:finalize",O:["mfaPendingCredential","phoneVerificationInfo"],A:gi,G:Ba,B:!0,Na:!0},$M={endpoint:"getAccountInfo"},Ete={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="EMAIL_SIGNIN")throw new H("internal-error");Fr(I)},Z:"email",B:!0},Fte={endpoint:"getOobConfirmationCode",O:["idToken","requestType"],A:function(I){if(I.requestType!="VERIFY_EMAIL")throw new H("internal-error")},Z:"email",B:!0},w7={endpoint:"getOobConfirmationCode",O:["idToken","newEmail","requestType"],A:function(I){if(I.requestType!="VERIFY_AND_CHANGE_EMAIL")throw new H("internal-error")},Z:"email",B:!0},HU={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="PASSWORD_RESET")throw new H("internal-error");Fr(I)},Z:"email",B:!0},MU={mb:!0,endpoint:"getProjectConfig",Vb:"GET"},kte={mb:!0,endpoint:"getRecaptchaParam",Vb:"GET",G:function(I){if(!I.recaptchaSiteKey)throw new H("internal-error")}},Lte={endpoint:"resetPassword",A:KM,Z:"email",B:!0},Wte={endpoint:"sendVerificationCode",O:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},IU={endpoint:"setAccountInfo",O:["idToken"],A:Zi,V:!0},QM={endpoint:"setAccountInfo",O:["idToken"],A:function(I){if(Zi(I),!I.password)throw new H("weak-password")},G:Ba,V:!0},zU={endpoint:"signupNewUser",G:Ba,V:!0,B:!0},Nte={endpoint:"accounts/mfaEnrollment:start",O:["idToken","phoneEnrollmentInfo"],A:function(I){if(!I.phoneEnrollmentInfo)throw new H("internal-error");if(!I.phoneEnrollmentInfo.phoneNumber)throw new H("missing-phone-number");if(!I.phoneEnrollmentInfo.recaptchaToken)throw new H("missing-app-credential")},G:function(I){if(!I.phoneSessionInfo||!I.phoneSessionInfo.sessionInfo)throw new H("internal-error")},B:!0,Na:!0},ZM={endpoint:"accounts/mfaSignIn:start",O:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(I){if(!I.phoneSignInInfo||!I.phoneSignInInfo.recaptchaToken)throw new H("missing-app-credential")},G:function(I){if(!I.phoneResponseInfo||!I.phoneResponseInfo.sessionInfo)throw new H("internal-error")},B:!0,Na:!0},DU={endpoint:"verifyAssertion",A:Uy,Za:XM,G:MS,V:!0,B:!0},v7={endpoint:"verifyAssertion",A:Uy,Za:XM,G:function(I){if(I.errorMessage&&I.errorMessage=="USER_NOT_FOUND")throw new H("user-not-found");if(I.errorMessage)throw nI(I.errorMessage);Ba(I)},V:!0,B:!0},eI={endpoint:"verifyAssertion",A:function(I){if(Uy(I),!I.idToken)throw new H("internal-error")},Za:XM,G:MS,V:!0},EU={endpoint:"verifyCustomToken",A:function(I){if(!I.token)throw new H("invalid-custom-token")},G:Ba,V:!0,B:!0},tI={endpoint:"verifyPassword",A:function(I){if(Fr(I),!I.password)throw new H("wrong-password")},G:Ba,V:!0,B:!0},zS={endpoint:"verifyPhoneNumber",A:Pa,G:Ba,B:!0},FU={endpoint:"verifyPhoneNumber",A:function(I){if(!I.idToken)throw new H("internal-error");Pa(I)},G:function(I){if(I.temporaryProof)throw I.code="credential-already-in-use",Iy(I);Ba(I)}},lm={Ib:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:Pa,G:Ba,B:!0},X3={endpoint:"accounts/mfaEnrollment:withdraw",O:["idToken","mfaEnrollmentId"],G:function(I){if(!!I[rn]^!!I.refreshToken)throw new H("internal-error")},B:!0,Na:!0};function ka(I,_,ce){if(!Py(ce,_.O))return Si(new H("internal-error"));var Ce=!!_.Na,_e=_.Vb||"POST",St;return Fo(ce).then(_.A).then(function(){return _.V&&(ce.returnSecureToken=!0),_.B&&I.b&&typeof ce.tenantId>"u"&&(ce.tenantId=I.b),Ce?xr(I,I.i,_.endpoint,_e,ce,_.Ib,_.mb||!1):xr(I,I.h,_.endpoint,_e,ce,_.Ib,_.mb||!1)}).then(function(Lt){return St=Lt,_.Za?_.Za(ce,St):St}).then(_.G).then(function(){if(!_.Z)return St;if(!(_.Z in St))throw new H("internal-error");return St[_.Z]})}function nI(I){return oI({error:{errors:[{message:I}],code:400,message:I}})}function oI(I,_){var ce=(I.error&&I.error.errors&&I.error.errors[0]||{}).reason||"",Ce={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(ce=Ce[ce]?new H(Ce[ce]):null)return ce;ce=I.error&&I.error.message||"",Ce={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},Ee(Ce,_||{}),_=(_=ce.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<_.length?_[1]:void 0;for(var _e in Ce)if(ce.indexOf(_e)===0)return new H(Ce[_e],_);return!_&&I&&(_=Tp(I)),new H("internal-error",_)}function Ute(I){this.b=I,this.a=null,this.sb=jte(this)}function jte(I){return Gte().then(function(){return new Yo(function(_,ce){ql("gapi.iframes.getContext")().open({where:document.body,url:I.b,messageHandlersFilter:ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(Ce){function _e(){clearTimeout(St),_()}I.a=Ce,I.a.restyle({setHideOnLeave:!1});var St=setTimeout(function(){ce(Error("Network Error"))},_te.get());Ce.ping(_e).then(_e,function(){ce(Error("Network Error"))})})})})}function Bte(I,_){return I.sb.then(function(){return new Yo(function(ce){I.a.send(_.type,_,ce,ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}function Yte(I,_){I.sb.then(function(){I.a.register("authEvent",_,ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}var Ote=new Oe(xt,"https://apis.google.com/js/api.js?onload=%{onload}"),Vte=new Df(3e4,6e4),_te=new Df(5e3,15e3),DS=null;function Gte(){return DS||(DS=new Yo(function(I,_){function ce(){P5(),ql("gapi.load")("gapi.iframes",{callback:I,ontimeout:function(){P5(),_(Error("Network Error"))},timeout:Vte.get()})}if(ql("gapi.iframes.Iframe"))I();else if(ql("gapi.load"))ce();else{var Ce="__iframefcb"+Math.floor(1e6*Math.random()).toString();s[Ce]=function(){ql("gapi.load")?ce():_(Error("Network Error"))},Ce=Qe(Ote,{onload:Ce}),Fo(_3(Ce)).o(function(){_(Error("Network Error"))})}}).o(function(I){throw DS=null,I}))}function kU(I,_,ce,Ce){this.l=I,this.h=_,this.i=ce,this.g=Ce,this.f=null,this.g?(I=wu(this.g.url),I=p5(I.c,I.a,I.g,"/emulator/auth/iframe")):I=p5("https",this.l,null,"/__/auth/iframe"),this.a=I,ol(this.a,"apiKey",this.h),ol(this.a,"appName",this.i),this.b=null,this.c=[]}kU.prototype.toString=function(){return this.f?ol(this.a,"v",this.f):Gc(this.a.b,"v"),this.b?ol(this.a,"eid",this.b):Gc(this.a.b,"eid"),this.c.length?ol(this.a,"fw",this.c.join(",")):Gc(this.a.b,"fw"),this.a.toString()};function ES(I,_,ce,Ce,_e,St){this.u=I,this.s=_,this.c=ce,this.m=Ce,this.v=St,this.i=this.g=this.l=null,this.a=_e,this.h=this.f=null}ES.prototype.zb=function(I){return this.h=I,this},ES.prototype.toString=function(){if(this.v){var I=wu(this.v.url);I=p5(I.c,I.a,I.g,"/emulator/auth/handler")}else I=p5("https",this.u,null,"/__/auth/handler");if(ol(I,"apiKey",this.s),ol(I,"appName",this.c),ol(I,"authType",this.m),this.a.isOAuthProvider){var _=this.a;try{var ce=$n.app(this.c).auth().la()}catch{ce=null}_.pb=ce,ol(I,"providerId",this.a.providerId),ce=this.a,_=S5(ce.Jb);for(var Ce in _)_[Ce]=_[Ce].toString();Ce=ce.Qc,_=nt(_);for(var _e=0;_e"u"&&delete dn[lo]}),I.ports[0].postMessage({status:"done",eventId:ce,eventType:_,response:Lt})})}};function Wh(I,_,ce){Ue(I.a)&&I.b.addEventListener("message",I.f),typeof I.a[_]>"u"&&(I.a[_]=[]),I.a[_].push(ce)}function YU(I){this.a=I}YU.prototype.postMessage=function(I,_){this.a.postMessage(I,_)};function OU(I){this.c=I,this.b=!1,this.a=[]}function VU(I,_,ce,Ce){var _e,St=ce||{},Lt,dn,lo,Mo=null;if(I.b)return Si(Error("connection_unavailable"));var Mi=Ce?800:50,bl=typeof MessageChannel<"u"?new MessageChannel:null;return new Yo(function(gl,Q0){bl?(_e=Math.floor(Math.random()*Math.pow(10,20)).toString(),bl.port1.start(),dn=setTimeout(function(){Q0(Error("unsupported_event"))},Mi),Lt=function(Oy){Oy.data.eventId===_e&&(Oy.data.status==="ack"?(clearTimeout(dn),lo=setTimeout(function(){Q0(Error("timeout"))},3e3)):Oy.data.status==="done"?(clearTimeout(lo),typeof Oy.data.response<"u"?gl(Oy.data.response):Q0(Error("unknown_error"))):(clearTimeout(dn),clearTimeout(lo),Q0(Error("invalid_response"))))},Mo={messageChannel:bl,onMessage:Lt},I.a.push(Mo),bl.port1.addEventListener("message",Lt),I.c.postMessage({eventType:_,eventId:_e,data:St},[bl.port2])):Q0(Error("connection_unavailable"))}).then(function(gl){return kS(I,Mo),gl}).o(function(gl){throw kS(I,Mo),gl})}function kS(I,_){if(_){var ce=_.messageChannel,Ce=_.onMessage;ce&&(ce.port1.removeEventListener("message",Ce),ce.port1.close()),me(I.a,function(_e){return _e==_})}}OU.prototype.close=function(){for(;0"u"&&(Ce=null);var _e=s.localStorage.getItem(ce);_e!==Ce&&(this.b[ce]=_e,this.nb(ce))}else if(_.indexOf("firebase:")==0&&this.a[_]){if(typeof I.a.a<"u"?J3(this,"local").ia(this.f):fI(this),this.m){if(ce=s.localStorage.getItem(_),Ce=I.a.newValue,Ce!==ce)Ce!==null?s.localStorage.setItem(_,Ce):s.localStorage.removeItem(_);else if(this.b[_]===Ce&&typeof I.a.a>"u")return}var St=this;ce=function(){(typeof I.a.a<"u"||St.b[_]!==s.localStorage.getItem(_))&&(St.b[_]=s.localStorage.getItem(_),St.nb(_))},ot&&po&&po==10&&s.localStorage.getItem(_)!==I.a.newValue&&I.a.newValue!==I.a.oldValue?setTimeout(ce,10):ce()}}else se(I,w(this.nb,this))},t.nb=function(I){this.a[I]&&se(this.a[I],function(_){_()})};function ane(I){this.a=I,this.b=P7()}var hI={name:"authEvent",F:"local"};function lne(I){return I.b.get(hI,I.a).then(function(_){return ZA(_)})}function sne(){this.a=P7()}function cne(){this.b=-1}function NS(I,_){this.b=tj,this.f=s.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=I,this.h=_,this.l=s.Int32Array?new Int32Array(64):Array(64),US===void 0&&(s.Int32Array?US=new Int32Array(yI):US=yI),this.reset()}var US;b(NS,cne);for(var tj=64,une=tj-1,nj=[],pI=0;pI_;_++){_e=ce[_-15]|0,Ce=ce[_-2]|0;var St=(ce[_-16]|0)+((_e>>>7|_e<<25)^(_e>>>18|_e<<14)^_e>>>3)|0,Lt=(ce[_-7]|0)+((Ce>>>17|Ce<<15)^(Ce>>>19|Ce<<13)^Ce>>>10)|0;ce[_]=St+Lt|0}Ce=I.a[0]|0,_e=I.a[1]|0;var dn=I.a[2]|0,lo=I.a[3]|0,Mo=I.a[4]|0,Mi=I.a[5]|0,bl=I.a[6]|0;for(St=I.a[7]|0,_=0;64>_;_++){var gl=((Ce>>>2|Ce<<30)^(Ce>>>13|Ce<<19)^(Ce>>>22|Ce<<10))+(Ce&_e^Ce&dn^_e&dn)|0;Lt=Mo&Mi^~Mo&bl,St=St+((Mo>>>6|Mo<<26)^(Mo>>>11|Mo<<21)^(Mo>>>25|Mo<<7))|0,Lt=Lt+(US[_]|0)|0,Lt=St+(Lt+(ce[_]|0)|0)|0,St=bl,bl=Mi,Mi=Mo,Mo=lo+Lt|0,lo=dn,dn=_e,_e=Ce,Ce=Lt+gl|0}I.a[0]=I.a[0]+Ce|0,I.a[1]=I.a[1]+_e|0,I.a[2]=I.a[2]+dn|0,I.a[3]=I.a[3]+lo|0,I.a[4]=I.a[4]+Mo|0,I.a[5]=I.a[5]+Mi|0,I.a[6]=I.a[6]+bl|0,I.a[7]=I.a[7]+St|0}function mI(I,_,ce){ce===void 0&&(ce=_.length);var Ce=0,_e=I.c;if(typeof _=="string")for(;Ce=St&&St==(St|0)))throw Error("message must be a byte array");I.f[_e++]=St,_e==I.b&&(gI(I),_e=0)}else throw Error("message must be string or array");I.c=_e,I.g+=ce}var yI=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function AI(){NS.call(this,8,dne)}b(AI,NS);var dne=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function rj(I,_,ce,Ce,_e,St){this.v=I,this.i=_,this.l=ce,this.m=Ce||null,this.u=_e||null,this.s=St,this.h=_+":"+ce,this.C=new sne,this.g=new ane(this.h),this.f=null,this.b=[],this.a=this.c=null}function jS(I){return new H("invalid-cordova-configuration",I)}t=rj.prototype,t.ma=function(){return this.Ia?this.Ia:this.Ia=y5().then(function(){if(typeof ql("universalLinks.subscribe",s)!="function")throw jS("cordova-universal-links-plugin-fix is not installed");if(typeof ql("BuildInfo.packageName",s)>"u")throw jS("cordova-plugin-buildinfo is not installed");if(typeof ql("cordova.plugins.browsertab.openUrl",s)!="function")throw jS("cordova-plugin-browsertab is not installed");if(typeof ql("cordova.InAppBrowser.open",s)!="function")throw jS("cordova-plugin-inappbrowser is not installed")},function(){throw new H("cordova-not-ready")})};function fne(){for(var I=20,_=[];0_.c?mI(_,oj,56-_.c):mI(_,oj,_.b-(_.c-56));for(var Ce=63;56<=Ce;Ce--)_.f[Ce]=ce&255,ce/=256;for(gI(_),Ce=ce=0;Ce<_.i;Ce++)for(var _e=24;0<=_e;_e-=8)I[ce++]=_.a[Ce]>>_e&255;return OM(I)}t.Pb=function(I,_){return _(new H("operation-not-supported-in-this-environment")),Fo()},t.Nb=function(){return Si(new H("operation-not-supported-in-this-environment"))},t.ac=function(){return!1},t.Yb=function(){return!0},t.Ub=function(){return!0},t.Ob=function(I,_,ce,Ce){if(this.c)return Si(new H("redirect-operation-pending"));var _e=this,St=s.document,Lt=null,dn=null,lo=null,Mo=null;return this.c=Fo().then(function(){return em(_),aj(_e)}).then(function(){return hne(_e,I,_,ce,Ce)}).then(function(){return new Yo(function(Mi,bl){dn=function(){var gl=ql("cordova.plugins.browsertab.close",s);return Mi(),typeof gl=="function"&&gl(),_e.a&&typeof _e.a.close=="function"&&(_e.a.close(),_e.a=null),!1},_e.Ea(dn),lo=function(){Lt||(Lt=_c(2e3).then(function(){bl(new H("redirect-cancelled-by-user"))}))},Mo=function(){EA()&&lo()},St.addEventListener("resume",lo,!1),tc().toLowerCase().match(/android/)||St.addEventListener("visibilitychange",Mo,!1)}).o(function(Mi){return wI(_e).then(function(){throw Mi})})}).oa(function(){lo&&St.removeEventListener("resume",lo,!1),Mo&&St.removeEventListener("visibilitychange",Mo,!1),Lt&&Lt.cancel(),dn&&_e.Ta(dn),_e.c=null})};function hne(I,_,ce,Ce,_e){var St=fne(),Lt=new Ql(_,Ce,null,St,new H("no-auth-event"),null,_e),dn=ql("BuildInfo.packageName",s);if(typeof dn!="string")throw new H("invalid-cordova-configuration");var lo=ql("BuildInfo.displayName",s),Mo={};if(tc().toLowerCase().match(/iphone|ipad|ipod/))Mo.ibi=dn;else if(tc().toLowerCase().match(/android/))Mo.apn=dn;else return Si(new H("operation-not-supported-in-this-environment"));lo&&(Mo.appDisplayName=lo),St=BS(St),Mo.sessionId=St;var Mi=s4(I.v,I.i,I.l,_,ce,null,Ce,I.m,Mo,I.u,_e,I.s);return I.ma().then(function(){var bl=I.h;return I.C.a.set(hI,Lt.w(),bl)}).then(function(){var bl=ql("cordova.plugins.browsertab.isAvailable",s);if(typeof bl!="function")throw new H("invalid-cordova-configuration");var gl=null;bl(function(Q0){if(Q0){if(gl=ql("cordova.plugins.browsertab.openUrl",s),typeof gl!="function")throw new H("invalid-cordova-configuration");gl(Mi)}else{if(gl=ql("cordova.InAppBrowser.open",s),typeof gl!="function")throw new H("invalid-cordova-configuration");Q0=tc(),I.a=gl(Mi,Q0.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||Q0.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}function ij(I,_){for(var ce=0;ceI.f&&(I.a=I.f),_)}function II(I,_){I.stop(),I.b=_c(Tne(I,_)).then(function(){return a7()}).then(function(){return I.h()}).then(function(){II(I,!0)}).o(function(ce){I.i(ce)&&II(I,!1)})}MI.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function I7(I){this.f=I,this.b=this.a=null,this.c=Date.now()}I7.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}};function wj(I,_){typeof _>"u"&&(I.b?(_=I.b,_=_.a-_.g):_=0),I.c=Date.now()+1e3*_}function cm(I,_){I.b=H5(_[rn]||""),I.a=_.refreshToken,_=_.expiresIn,wj(I,typeof _<"u"?Number(_):void 0)}function vj(I,_){I.b=_.b,I.a=_.a,I.c=_.c}function GS(I,_){return _n(I.f,_).then(function(ce){return I.b=H5(ce.access_token),I.a=ce.refresh_token,wj(I,ce.expires_in),{accessToken:I.b.toString(),refreshToken:I.a}}).o(function(ce){throw ce.code=="auth/user-token-expired"&&(I.a=null),ce})}I7.prototype.getToken=function(I){return I=!!I,this.b&&!this.a?Si(new H("user-token-expired")):I||!this.b||Date.now()>this.c-3e4?this.a?GS(this,{grant_type:"refresh_token",refresh_token:this.a}):Fo(null):Fo({accessToken:this.b.toString(),refreshToken:this.a})};function ws(I,_){this.a=I||null,this.b=_||null,Kc(this,{lastSignInTime:I3(_||null),creationTime:I3(I||null)})}function Dc(I){return new ws(I.a,I.b)}ws.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}};function xj(I,_,ce,Ce,_e,St){Kc(this,{uid:I,displayName:Ce||null,photoURL:_e||null,email:ce||null,phoneNumber:St||null,providerId:_})}function Nh(I,_,ce){this.N=[],this.l=I.apiKey,this.m=I.appName,this.s=I.authDomain||null;var Ce=$n.SDK_VERSION?Xg($n.SDK_VERSION):null;this.a=new Xe(this.l,W(k),Ce),(this.u=I.emulatorConfig||null)&&Xr(this.a,this.u),this.h=new I7(this.a),KS(this,_[rn]),cm(this.h,_),Hr(this,"refreshToken",this.h.a),bj(this,ce||{}),Kl.call(this),this.P=!1,this.s&&nd()&&(this.b=d4(this.s,this.l,this.m,this.u)),this.W=[],this.i=null,this.D=D7(this),this.ba=w(this.ib,this);var _e=this;this.za=null,this.Pa=function(St){_e.xa(St.h)},this.qa=null,this.Ba=function(St){zI(_e,St.c)},this.$=null,this.aa=[],this.Oa=function(St){z7(_e,St.f)},this.ja=null,this.S=new sm(this,ce),Hr(this,"multiFactor",this.S)}b(Nh,Kl),Nh.prototype.xa=function(I){this.za=I,Ei(this.a,I)};function zI(I,_){I.u=_,Xr(I.a,_),I.b&&(_=I.b,I.b=d4(I.s,I.l,I.m,I.u),I.P&&(H7(_,I),R7(I.b,I)))}Nh.prototype.la=function(){return this.za};function DI(I,_){I.qa&&Or(I.qa,"languageCodeChanged",I.Pa),(I.qa=_)&&qn(_,"languageCodeChanged",I.Pa)}function EI(I,_){I.$&&Or(I.$,"emulatorConfigChanged",I.Ba),(I.$=_)&&qn(_,"emulatorConfigChanged",I.Ba)}function z7(I,_){I.aa=_,Vr(I.a,$n.SDK_VERSION?Xg($n.SDK_VERSION,I.aa):null)}Nh.prototype.Ga=function(){return Te(this.aa)};function FI(I,_){I.ja&&Or(I.ja,"frameworkChanged",I.Oa),(I.ja=_)&&qn(_,"frameworkChanged",I.Oa)}Nh.prototype.ib=function(){this.D.b&&(this.D.stop(),this.D.start())};function XS(I){try{return $n.app(I.m).auth()}catch{throw new H("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+I.m+"'!")}}function D7(I){return new MI(function(){return I.I(!0)},function(_){return!!(_&&_.code=="auth/network-request-failed")},function(){var _=I.h.c-Date.now()-3e5;return 0<_?_:0})}function JS(I){I.J||I.D.b||(I.D.start(),Or(I,"tokenChanged",I.ba),qn(I,"tokenChanged",I.ba))}function kI(I){Or(I,"tokenChanged",I.ba),I.D.stop()}function KS(I,_){I.Aa=_,Hr(I,"_lat",_)}function qS(I,_){me(I.W,function(ce){return ce==_})}function T0(I){for(var _=[],ce=0;ce"u"||Ue(I)?{}:_A(new xu(I))}).then(function(Ce){return _.a.vb(ce,Ce)}).then(function(Ce){if(_.email!=Ce)return _.reload()}).then(function(){}))},t.Fb=function(I,_){var ce=this,Ce=null;return P0(this,this.I().then(function(_e){return Ce=_e,typeof _>"u"||Ue(_)?{}:_A(new xu(_))}).then(function(_e){return ce.a.Fb(Ce,I,_e)}).then(function(_e){if(ce.email!=_e)return ce.reload()}).then(function(){}))};function P0(I,_,ce){var Ce=Cne(I,_,ce);return I.N.push(Ce),Ce.oa(function(){pe(I.N,Ce)}),Ce.o(function(_e){var St=null;throw _e&&_e.code==="auth/multi-factor-auth-required"&&(St=Aj(_e.w(),XS(I),w(I.jc,I))),St||_e})}t.jc=function(I){var _=null,ce=this;return I=Ry(Fo(I),ce.uid).then(function(Ce){return _=E7(ce,Ce,"reauthenticate"),qc(ce,Ce),ce.i=null,ce.reload()}).then(function(){return _}),P0(this,I,!0)};function Cne(I,_,ce){return I.i&&!ce?(_.cancel(),Si(I.i)):_.o(function(Ce){throw!Ce||Ce.code!="auth/user-disabled"&&Ce.code!="auth/user-token-expired"||(I.i||I.dispatchEvent(new h4("userInvalidated")),I.i=Ce),Ce})}t.toJSON=function(){return this.w()},t.w=function(){var I={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.h.w(),redirectEventId:this.ga||null};return this.metadata&&Ee(I,this.metadata.w()),se(this.providerData,function(_){I.providerData.push(C5(_))}),Ee(I,this.S.w()),I};function Rj(I){if(!I.apiKey)return null;var _={apiKey:I.apiKey,authDomain:I.authDomain,appName:I.appName,emulatorConfig:I.emulatorConfig},ce={};if(I.stsTokenManager&&I.stsTokenManager.accessToken){ce[rn]=I.stsTokenManager.accessToken,ce.refreshToken=I.stsTokenManager.refreshToken||null;var Ce=I.stsTokenManager.expirationTime;Ce&&(ce.expiresIn=(Ce-Date.now())/1e3)}else return null;var _e=new Nh(_,ce,I);return I.providerData&&se(I.providerData,function(St){St&&NI(_e,Ef(St))}),I.redirectEventId&&(_e.ga=I.redirectEventId),_e}function Rne(I,_,ce,Ce){var _e=new Nh(I,_);return ce&&(_e.ha=ce),Ce&&z7(_e,Ce),_e.reload().then(function(){return _e})}function Hne(I,_,ce,Ce){var _e=I.h,St={};return St[rn]=_e.b&&_e.b.toString(),St.refreshToken=_e.a,_=new Nh(_||{apiKey:I.l,authDomain:I.s,appName:I.m},St),ce&&(_.ha=ce),Ce&&z7(_,Ce),Ji(_,I),_}function Mne(I){this.a=I,this.b=P7()}var BI={name:"redirectUser",F:"session"};function Hj(I){return By(I.b,BI,I.a)}function Ine(I,_){return I.b.get(BI,I.a).then(function(ce){return ce&&_&&(ce.authDomain=_),Rj(ce||{})})}function YI(I){this.a=I,this.b=P7(),this.c=null,this.f=VI(this),this.b.addListener(zp("local"),this.a,w(this.g,this))}YI.prototype.g=function(){var I=this,_=zp("local");R0(this,function(){return Fo().then(function(){return I.c&&I.c.F!="local"?I.b.get(_,I.a):null}).then(function(ce){if(ce)return OI(I,"local").then(function(){I.c=_})})})};function OI(I,_){var ce=[],Ce;for(Ce in u4)u4[Ce]!==_&&ce.push(By(I.b,zp(u4[Ce]),I.a));return ce.push(By(I.b,_I,I.a)),nr(ce)}function VI(I){var _=zp("local"),ce=zp("session"),Ce=zp("none");return rne(I.b,_,I.a).then(function(){return I.b.get(ce,I.a)}).then(function(_e){return _e?ce:I.b.get(Ce,I.a).then(function(St){return St?Ce:I.b.get(_,I.a).then(function(Lt){return Lt?_:I.b.get(_I,I.a).then(function(dn){return dn?zp(dn):_})})})}).then(function(_e){return I.c=_e,OI(I,_e.F)}).o(function(){I.c||(I.c=_)})}var _I={name:"persistence",F:"session"};function zp(I){return{name:"authUser",F:I}}YI.prototype.yb=function(I){var _=null,ce=this;return one(I),R0(this,function(){return I!=ce.c.F?ce.b.get(ce.c,ce.a).then(function(Ce){return _=Ce,OI(ce,I)}).then(function(){if(ce.c=zp(I),_)return ce.b.set(ce.c,_,ce.a)}):Fo()})};function zne(I){return R0(I,function(){return I.b.set(_I,I.c.F,I.a)})}function Mj(I,_){return R0(I,function(){return I.b.set(I.c,_.w(),I.a)})}function Ij(I){return R0(I,function(){return By(I.b,I.c,I.a)})}function C0(I,_,ce){return R0(I,function(){return I.b.get(I.c,I.a).then(function(Ce){return Ce&&_&&(Ce.authDomain=_),Ce&&ce&&(Ce.emulatorConfig=ce),Rj(Ce||{})})})}function R0(I,_){return I.f=I.f.then(_,_),I.f}function H1(I){if(this.l=!1,Hr(this,"settings",new mj),Hr(this,"app",I),Zl(this).options&&Zl(this).options.apiKey)I=$n.SDK_VERSION?Xg($n.SDK_VERSION):null,this.a=new Xe(Zl(this).options&&Zl(this).options.apiKey,W(k),I);else throw new H("invalid-api-key");this.P=[],this.s=[],this.N=[],this.Pa=$n.INTERNAL.createSubscribe(w(this.zc,this)),this.W=void 0,this.ib=$n.INTERNAL.createSubscribe(w(this.Ac,this)),p4(this,null),this.i=new YI(Zl(this).options.apiKey+":"+Zl(this).name),this.D=new Mne(Zl(this).options.apiKey+":"+Zl(this).name),this.$=Ec(this,Lj(this)),this.h=Ec(this,kne(this)),this.ba=!1,this.ja=w(this.Zc,this),this.Ba=w(this.da,this),this.qa=w(this.mc,this),this.za=w(this.wc,this),this.Aa=w(this.xc,this),this.b=null,Ej(this),this.INTERNAL={},this.INTERNAL.delete=w(this.delete,this),this.INTERNAL.logFramework=w(this.Gc,this),this.u=0,Kl.call(this),Ene(this),this.J=[],this.R=null}b(H1,Kl);function zj(I){Nt.call(this,"languageCodeChanged"),this.h=I}b(zj,Nt);function Dj(I){Nt.call(this,"emulatorConfigChanged"),this.c=I}b(Dj,Nt);function GI(I){Nt.call(this,"frameworkChanged"),this.f=I}b(GI,Nt),t=H1.prototype,t.yb=function(I){return I=this.i.yb(I),Ec(this,I)},t.xa=function(I){this.aa===I||this.l||(this.aa=I,Ei(this.a,this.aa),this.dispatchEvent(new zj(this.la())))},t.la=function(){return this.aa},t.fd=function(){var I=s.navigator;this.xa(I&&(I.languages&&I.languages[0]||I.language||I.userLanguage)||null)},t.gd=function(I,_){if(!this.R){if(!/^https?:\/\//.test(I))throw new H("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");_=_?!!_.disableWarnings:!1,Dne(_),this.R={url:I,ec:_},this.settings.jb=!0,Xr(this.a,this.R),this.dispatchEvent(new Dj(this.R))}};function Dne(I){typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),s.document&&!I&&Ws().then(function(){var _=s.document.createElement("div");_.innerText="Running in emulator mode. Do not use with production credentials.",_.style.position="fixed",_.style.width="100%",_.style.backgroundColor="#ffffff",_.style.border=".1em solid #000000",_.style.color="#b50000",_.style.bottom="0px",_.style.left="0px",_.style.margin="0px",_.style.zIndex=1e4,_.style.textAlign="center",_.classList.add("firebase-emulator-warning"),s.document.body.appendChild(_)})}t.Gc=function(I){this.J.push(I),Vr(this.a,$n.SDK_VERSION?Xg($n.SDK_VERSION,this.J):null),this.dispatchEvent(new GI(this.J))},t.Ga=function(){return Te(this.J)},t.zb=function(I){this.S===I||this.l||(this.S=I,this.a.b=this.S)},t.T=function(){return this.S};function Ene(I){Object.defineProperty(I,"lc",{get:function(){return this.la()},set:function(_){this.xa(_)},enumerable:!1}),I.aa=null,Object.defineProperty(I,"ti",{get:function(){return this.T()},set:function(_){this.zb(_)},enumerable:!1}),I.S=null,Object.defineProperty(I,"emulatorConfig",{get:function(){if(this.R){var _=wu(this.R.url);_=Ef({protocol:_.c,host:_.a,port:_.g,options:Ef({disableWarnings:this.R.ec})})}else _=null;return _},enumerable:!1})}t.toJSON=function(){return{apiKey:Zl(this).options.apiKey,authDomain:Zl(this).options.authDomain,appName:Zl(this).name,currentUser:la(this)&&la(this).w()}};function XI(I){return I.Oa||Si(new H("auth-domain-config-required"))}function Ej(I){var _=Zl(I).options.authDomain,ce=Zl(I).options.apiKey;_&&nd()&&(I.Oa=I.$.then(function(){if(!I.l){if(I.b=d4(_,ce,Zl(I).name,I.R),R7(I.b,I),la(I)&&um(la(I)),I.m){um(I.m);var Ce=I.m;Ce.xa(I.la()),DI(Ce,I),Ce=I.m,z7(Ce,I.J),FI(Ce,I),Ce=I.m,zI(Ce,I.R),EI(Ce,I),I.m=null}return I.b}}))}t.Gb=function(I,_){switch(I){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==_&&!!this.f;default:return!1}},t.na=function(I,_,ce,Ce){I=="signInViaPopup"&&this.g==Ce&&(ce&&this.C?this.C(ce):_&&!ce&&this.f&&this.f(_),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(I,_){return I=="signInViaRedirect"||I=="signInViaPopup"&&this.g==_&&this.f?w(this.ic,this):null},t.ic=function(I,_,ce,Ce){var _e=this,St={requestUri:I,postBody:Ce,sessionId:_,tenantId:ce};return this.c&&(this.c.cancel(),this.c=null),_e.$.then(function(){return $3(_e,IS(_e.a,St))})},t.Xc=function(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=this,ce=k3(I.providerId),Ce=Jg(),_e=null;(!od()||M3())&&Zl(this).options.authDomain&&I.isOAuthProvider&&(_e=s4(Zl(this).options.authDomain,Zl(this).options.apiKey,Zl(this).name,"signInViaPopup",I,null,Ce,$n.SDK_VERSION||null,null,null,this.T(),this.R));var St=_0(_e,ce&&ce.va,ce&&ce.ua);return ce=XI(this).then(function(Lt){return SI(Lt,St,"signInViaPopup",I,Ce,!!_e,_.T())}).then(function(){return new Yo(function(Lt,dn){_.na("signInViaPopup",null,new H("cancelled-popup-request"),_.g),_.f=Lt,_.C=dn,_.g=Ce,_.c=dj(_.b,_,"signInViaPopup",St,Ce)})}).then(function(Lt){return St&&As(St),Lt?Ef(Lt):null}).o(function(Lt){throw St&&As(St),Lt}),Ec(this,ce)},t.Yc=function(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=this,ce=XI(this).then(function(){return zne(_.i)}).then(function(){return uj(_.b,"signInViaRedirect",I,void 0,_.T())});return Ec(this,ce)};function Fj(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=XI(I).then(function(){return I.b.ra()}).then(function(ce){return ce?Ef(ce):null});return Ec(I,_)}t.ra=function(){var I=this;return Fj(this).then(function(_){return I.b&&f4(I.b.b),_}).o(function(_){throw I.b&&f4(I.b.b),_})},t.dd=function(I){if(!I)return Si(new H("null-user"));if(this.S!=I.tenantId)return Si(new H("tenant-id-mismatch"));var _=this,ce={};ce.apiKey=Zl(this).options.apiKey,ce.authDomain=Zl(this).options.authDomain,ce.appName=Zl(this).name;var Ce=Hne(I,ce,_.D,_.Ga());return Ec(this,this.h.then(function(){if(Zl(_).options.apiKey!=I.l)return Ce.reload()}).then(function(){return la(_)&&I.uid==la(_).uid?(Ji(la(_),I),_.da(I)):(p4(_,Ce),um(Ce),_.da(Ce))}).then(function(){k7(_)}))};function Fne(I,_){var ce={};return ce.apiKey=Zl(I).options.apiKey,ce.authDomain=Zl(I).options.authDomain,ce.appName=Zl(I).name,I.R&&(ce.emulatorConfig=I.R),I.$.then(function(){return Rne(ce,_,I.D,I.Ga())}).then(function(Ce){return la(I)&&Ce.uid==la(I).uid?(Ji(la(I),Ce),I.da(Ce)):(p4(I,Ce),um(Ce),I.da(Ce))}).then(function(){k7(I)})}function p4(I,_){la(I)&&(qS(la(I),I.Ba),Or(la(I),"tokenChanged",I.qa),Or(la(I),"userDeleted",I.za),Or(la(I),"userInvalidated",I.Aa),kI(la(I))),_&&(_.W.push(I.Ba),qn(_,"tokenChanged",I.qa),qn(_,"userDeleted",I.za),qn(_,"userInvalidated",I.Aa),0this.u&&(this.u=0),this.u==0&&la(this)&&kI(la(this)),this.removeAuthTokenListener(I)},t.addAuthTokenListener=function(I){var _=this;this.s.push(I),Ec(this,this.h.then(function(){_.l||he(_.s,I)&&I(Yy(_))}))},t.removeAuthTokenListener=function(I){me(this.s,function(_){return _==I})};function Lne(I,_){I.N.push(_),Ec(I,I.h.then(function(){!I.l&&he(I.N,_)&&I.W!==I.getUid()&&(I.W=I.getUid(),_(Yy(I)))}))}t.delete=function(){this.l=!0;for(var I=0;I"u"||Ue(_)?{}:_A(new xu(_))}).then(function(Ce){return ce.a.wb(I,Ce)}).then(function(){}))},t.Wc=function(I,_){return Ec(this,CI(this,I,_,w(this.ab,this)))},t.Vc=function(I,_){var ce=this;return Ec(this,Fo().then(function(){var Ce=_||ui(),_e=js(I,Ce);if(Ce=Su(Ce),!Ce)throw new H("argument-error","Invalid email link!");if(Ce.tenantId!==ce.T())throw new H("tenant-id-mismatch");return ce.ab(_e)}))};function L7(){}L7.prototype.render=function(){},L7.prototype.reset=function(){},L7.prototype.getResponse=function(){},L7.prototype.execute=function(){};function g4(){this.a={},this.b=1e12}var QS=null;g4.prototype.render=function(I,_){return this.a[this.b.toString()]=new eT(I,_),this.b++},g4.prototype.reset=function(I){var _=ZS(this,I);I=Wj(I),_&&I&&(_.delete(),delete this.a[I])},g4.prototype.getResponse=function(I){return(I=ZS(this,I))?I.getResponse():null},g4.prototype.execute=function(I){(I=ZS(this,I))&&I.execute()};function ZS(I,_){return(_=Wj(_))&&I.a[_]||null}function Wj(I){return(I=typeof I>"u"?1e12:I)?I.toString():null}function eT(I,_){this.g=!1,this.c=_,this.a=this.b=null,this.h=this.c.size!=="invisible",this.f=fo(I);var ce=this;this.i=function(){ce.execute()},this.h?this.execute():qn(this.f,"click",this.i)}eT.prototype.getResponse=function(){return JI(this),this.b},eT.prototype.execute=function(){JI(this);var I=this;this.a||(this.a=setTimeout(function(){I.b=DA();var _=I.c.callback,ce=I.c["expired-callback"];if(_)try{_(I.b)}catch{}I.a=setTimeout(function(){if(I.a=null,I.b=null,ce)try{ce()}catch{}I.h&&I.execute()},6e4)},500))},eT.prototype.delete=function(){JI(this),this.g=!0,clearTimeout(this.a),this.a=null,Or(this.f,"click",this.i)};function JI(I){if(I.g)throw Error("reCAPTCHA mock was already deleted!")}function KI(){}Hr(KI,"FACTOR_ID","phone");function qI(){}qI.prototype.g=function(){return QS||(QS=new g4),Fo(QS)},qI.prototype.c=function(){};var $I=null;function QI(){this.b=s.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var Wne=new Oe(xt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),Nne=new Df(3e4,6e4);QI.prototype.g=function(I){var _=this;return new Yo(function(ce,Ce){var _e=setTimeout(function(){Ce(new H("network-request-failed"))},Nne.get());if(!s.grecaptcha||I!==_.f&&!_.b){s[_.a]=function(){if(s.grecaptcha){_.f=I;var Lt=s.grecaptcha.render;s.grecaptcha.render=function(dn,lo){return dn=Lt(dn,lo),_.b++,dn},clearTimeout(_e),ce(s.grecaptcha)}else clearTimeout(_e),Ce(new H("internal-error"));delete s[_.a]};var St=Qe(Wne,{onload:_.a,hl:I||""});Fo(_3(St)).o(function(){clearTimeout(_e),Ce(new H("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(_e),ce(s.grecaptcha)})},QI.prototype.c=function(){this.b--};var ZI=null;function ez(I,_,ce,Ce,_e,St,Lt){if(Hr(this,"type","recaptcha"),this.c=this.f=null,this.J=!1,this.v=_,this.g=null,Lt?($I||($I=new qI),Lt=$I):(ZI||(ZI=new QI),Lt=ZI),this.m=Lt,this.a=ce||{theme:"light",type:"image"},this.h=[],this.a[jj])throw new H("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i=this.a[Une]==="invisible",!s.document)throw new H("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!fo(_)||!this.i&&fo(_).hasChildNodes())throw new H("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Xe(I,St||null,_e||null),this.u=Ce||function(){return null};var dn=this;this.l=[];var lo=this.a[Nj];this.a[Nj]=function(Mi){if(Bj(dn,Mi),typeof lo=="function")lo(Mi);else if(typeof lo=="string"){var bl=ql(lo,s);typeof bl=="function"&&bl(Mi)}};var Mo=this.a[Uj];this.a[Uj]=function(){if(Bj(dn,null),typeof Mo=="function")Mo();else if(typeof Mo=="string"){var Mi=ql(Mo,s);typeof Mi=="function"&&Mi()}}}var Nj="callback",Uj="expired-callback",jj="sitekey",Une="size";function Bj(I,_){for(var ce=0;ce_e||_e>=Oj.length)throw new H("internal-error","Argument validator received an unsupported number of arguments.");ce=Oj[_e],Ce=(Ce?"":ce+" argument ")+(_.name?'"'+_.name+'" ':"")+"must be "+_.K+".";break e}Ce=null}}if(Ce)throw new H("argument-error",I+" failed: "+Ce)}var Oj="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Nr(I,_){return{name:I||"",K:"a valid string",optional:!!_,M:function(ce){return typeof ce=="string"}}}function oz(I,_){return{name:I||"",K:"a boolean",optional:!!_,M:function(ce){return typeof ce=="boolean"}}}function c0(I,_){return{name:I||"",K:"a valid object",optional:!!_,M:y}}function Y5(I,_){return{name:I||"",K:"a function",optional:!!_,M:function(ce){return typeof ce=="function"}}}function M1(I,_){return{name:I||"",K:"null",optional:!!_,M:function(ce){return ce===null}}}function Vj(){return{name:"",K:"an HTML element",optional:!1,M:function(I){return!!(I&&I instanceof Element)}}}function Bne(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(I){return!!(I&&I instanceof H1)}}}function Yne(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(I){return!!(I&&I instanceof $n.app.App)}}}function O5(I){return{name:I?I+"Credential":"credential",K:I?"a valid "+I+" credential":"a valid credential",optional:!1,M:function(_){if(!_)return!1;var ce=!I||_.providerId===I;return!(!_.ka||!ce)}}}function nT(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(I){return I?!!I.tb:!1}}}function m4(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(I){return!!(I&&I.providerId&&I.hasOwnProperty&&I.hasOwnProperty("isOAuthProvider"))}}}function rz(I,_){return y(I)&&typeof I.type=="string"&&I.type===_&&typeof I.Ha=="function"}function _j(I){return y(I)&&typeof I.uid=="string"}function Pu(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(I){return!(!I||typeof I.type!="string"||typeof I.verify!="function")}}}function rc(I,_,ce,Ce){return{name:ce||"",K:I.K+" or "+_.K,optional:!!Ce,M:function(_e){return I.M(_e)||_.M(_e)}}}function ic(I,_){for(var ce in _){var Ce=_[ce].name;I[Ce]=Xj(Ce,I[ce],_[ce].j)}}function Gj(I,_){for(var ce in _){var Ce=_[ce].name;Ce!==ce&&Object.defineProperty(I,Ce,{get:x(function(_e){return this[_e]},ce),set:x(function(_e,St,Lt,dn){Yj(_e,[Lt],[dn],!0),this[St]=dn},Ce,ce,_[ce].lb),enumerable:!0})}}function $c(I,_,ce,Ce){I[_]=Xj(_,ce,Ce)}function Xj(I,_,ce){function Ce(){var Lt=Array.prototype.slice.call(arguments);return Yj(_e,ce,Lt),_.apply(this,Lt)}if(!ce)return _;var _e=iz(I),St;for(St in _)Ce[St]=_[St];for(St in _.prototype)Ce.prototype[St]=_.prototype[St];return Ce}function iz(I){return I=I.split("."),I[I.length-1]}ic(H1.prototype,{kb:{name:"applyActionCode",j:[Nr("code")]},Sa:{name:"checkActionCode",j:[Nr("code")]},ob:{name:"confirmPasswordReset",j:[Nr("code"),Nr("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[Nr("email"),Nr("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[Nr("email")]},ra:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[Nr("emailLink")]},Hc:{name:"onAuthStateChanged",j:[rc(c0(),Y5(),"nextOrObserver"),Y5("opt_error",!0),Y5("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[rc(c0(),Y5(),"nextOrObserver"),Y5("opt_error",!0),Y5("opt_completed",!0)]},wb:{name:"sendPasswordResetEmail",j:[Nr("email"),rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]},xb:{name:"sendSignInLinkToEmail",j:[Nr("email"),c0("actionCodeSettings")]},yb:{name:"setPersistence",j:[Nr("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[O5()]},Ab:{name:"signInAnonymously",j:[]},ab:{name:"signInWithCredential",j:[O5()]},Tc:{name:"signInWithCustomToken",j:[Nr("token")]},Uc:{name:"signInWithEmailAndPassword",j:[Nr("email"),Nr("password")]},Vc:{name:"signInWithEmailLink",j:[Nr("email"),Nr("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Xc:{name:"signInWithPopup",j:[m4()]},Yc:{name:"signInWithRedirect",j:[m4()]},dd:{name:"updateCurrentUser",j:[rc(function(I){return{name:"user",K:"an instance of Firebase User",optional:!!I,M:function(_){return!!(_&&_ instanceof Nh)}}}(),M1(),"user")]},Bb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Nr(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[Nr("url"),c0("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[Nr("code")]}}),Gj(H1.prototype,{lc:{name:"languageCode",lb:rc(Nr(),M1(),"languageCode")},ti:{name:"tenantId",lb:rc(Nr(),M1(),"tenantId")}}),H1.Persistence=u4,H1.Persistence.LOCAL="local",H1.Persistence.SESSION="session",H1.Persistence.NONE="none",ic(Nh.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[oz("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[oz("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[O5()]},rb:{name:"linkWithCredential",j:[O5()]},Dc:{name:"linkWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Ec:{name:"linkWithPopup",j:[m4()]},Fc:{name:"linkWithRedirect",j:[m4()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[O5()]},ub:{name:"reauthenticateWithCredential",j:[O5()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Nc:{name:"reauthenticateWithPopup",j:[m4()]},Oc:{name:"reauthenticateWithRedirect",j:[m4()]},reload:{name:"reload",j:[]},vb:{name:"sendEmailVerification",j:[rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Nr(null,!0)]},cd:{name:"unlink",j:[Nr("provider")]},Cb:{name:"updateEmail",j:[Nr("email")]},Db:{name:"updatePassword",j:[Nr("password")]},ed:{name:"updatePhoneNumber",j:[O5("phone")]},Eb:{name:"updateProfile",j:[c0("profile")]},Fb:{name:"verifyBeforeUpdateEmail",j:[Nr("email"),rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]}}),ic(g4.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),ic(L7.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),ic(Yo.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Gj(mj.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",lb:oz("appVerificationDisabledForTesting")}}),ic(PI.prototype,{confirm:{name:"confirm",j:[Nr("verificationCode")]}}),$c(Cp,"fromJSON",function(I){I=typeof I=="string"?JSON.parse(I):I;for(var _,ce=[D5,Ic,nc,z5],Ce=0;Ce=0,i=!n&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(o=this.toRgbString()),e==="prgb"&&(o=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(o=this.toHexString()),e==="hex3"&&(o=this.toHexString(!0)),e==="hex4"&&(o=this.toHex8String(!0)),e==="hex8"&&(o=this.toHex8String()),e==="name"&&(o=this.toName()),e==="hsl"&&(o=this.toHslString()),e==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return Zr(this.toString())},_applyModification:function(e,n){var o=e.apply(null,[this].concat([].slice.call(n)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(r0o,arguments)},brighten:function(){return this._applyModification(i0o,arguments)},darken:function(){return this._applyModification(a0o,arguments)},desaturate:function(){return this._applyModification(t0o,arguments)},saturate:function(){return this._applyModification(n0o,arguments)},greyscale:function(){return this._applyModification(o0o,arguments)},spin:function(){return this._applyModification(l0o,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(u0o,arguments)},complement:function(){return this._applyCombination(s0o,arguments)},monochromatic:function(){return this._applyCombination(d0o,arguments)},splitcomplement:function(){return this._applyCombination(c0o,arguments)},triad:function(){return this._applyCombination(iHe,[3])},tetrad:function(){return this._applyCombination(iHe,[4])}};Zr.fromRatio=function(t,e){if(cJ(t)=="object"){var n={};for(var o in t)t.hasOwnProperty(o)&&(o==="a"?n[o]=t[o]:n[o]=XD(t[o]));t=n}return Zr(t,e)};function qco(t){var e={r:0,g:0,b:0},n=1,o=null,r=null,i=null,a=!1,l=!1;return typeof t=="string"&&(t=m0o(t)),cJ(t)=="object"&&(u6(t.r)&&u6(t.g)&&u6(t.b)?(e=$co(t.r,t.g,t.b),a=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):u6(t.h)&&u6(t.s)&&u6(t.v)?(o=XD(t.s),r=XD(t.v),e=Zco(t.h,o,r),a=!0,l="hsv"):u6(t.h)&&u6(t.s)&&u6(t.l)&&(o=XD(t.s),i=XD(t.l),e=Qco(t.h,o,i),a=!0,l="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=crt(n),{ok:a,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function $co(t,e,n){return{r:Wc(t,255)*255,g:Wc(e,255)*255,b:Wc(n,255)*255}}function tHe(t,e,n){t=Wc(t,255),e=Wc(e,255),n=Wc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=(o+r)/2;if(o==r)i=a=0;else{var s=o-r;switch(a=l>.5?s/(2-o-r):s/(o+r),o){case t:i=(e-n)/s+(e1&&(d-=1),d<1/6?c+(u-c)*6*d:d<1/2?u:d<2/3?c+(u-c)*(2/3-d)*6:c}if(e===0)o=r=i=n;else{var l=n<.5?n*(1+e):n+e-n*e,s=2*n-l;o=a(s,l,t+1/3),r=a(s,l,t),i=a(s,l,t-1/3)}return{r:o*255,g:r*255,b:i*255}}function nHe(t,e,n){t=Wc(t,255),e=Wc(e,255),n=Wc(n,255);var o=Math.max(t,e,n),r=Math.min(t,e,n),i,a,l=o,s=o-r;if(a=o===0?0:s/o,o==r)i=0;else{switch(o){case t:i=(e-n)/s+(e>1)+720)%360;--e;)o.h=(o.h+r)%360,i.push(Zr(o));return i}function d0o(t,e){e=e||6;for(var n=Zr(t).toHsv(),o=n.h,r=n.s,i=n.v,a=[],l=1/e;e--;)a.push(Zr({h:o,s:r,v:i})),i=(i+l)%1;return a}Zr.mix=function(t,e,n){n=n===0?0:n||50;var o=Zr(t).toRgb(),r=Zr(e).toRgb(),i=n/100,a={r:(r.r-o.r)*i+o.r,g:(r.g-o.g)*i+o.g,b:(r.b-o.b)*i+o.b,a:(r.a-o.a)*i+o.a};return Zr(a)};Zr.readability=function(t,e){var n=Zr(t),o=Zr(e);return(Math.max(n.getLuminance(),o.getLuminance())+.05)/(Math.min(n.getLuminance(),o.getLuminance())+.05)};Zr.isReadable=function(t,e,n){var o=Zr.readability(t,e),r,i;switch(i=!1,r=y0o(n),r.level+r.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7;break}return i};Zr.mostReadable=function(t,e,n){var o=null,r=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var c=0;cr&&(r=i,o=Zr(e[c]));return Zr.isReadable(t,o,{level:l,size:s})||!a?o:(n.includeFallbackColors=!1,Zr.mostReadable(t,["#fff","#000"],n))};var pfe=Zr.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},f0o=Zr.hexNames=h0o(pfe);function h0o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function crt(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Wc(t,e){p0o(t)&&(t="100%");var n=g0o(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function gee(t){return Math.min(1,Math.max(0,t))}function J1(t){return parseInt(t,16)}function p0o(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function g0o(t){return typeof t=="string"&&t.indexOf("%")!=-1}function P2(t){return t.length==1?"0"+t:""+t}function XD(t){return t<=1&&(t=t*100+"%"),t}function urt(t){return Math.round(parseFloat(t)*255).toString(16)}function aHe(t){return J1(t)/255}var n2=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function u6(t){return!!n2.CSS_UNIT.exec(t)}function m0o(t){t=t.replace(Jco,"").replace(Kco,"").toLowerCase();var e=!1;if(pfe[t])t=pfe[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=n2.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=n2.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=n2.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=n2.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=n2.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=n2.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=n2.hex8.exec(t))?{r:J1(n[1]),g:J1(n[2]),b:J1(n[3]),a:aHe(n[4]),format:e?"name":"hex8"}:(n=n2.hex6.exec(t))?{r:J1(n[1]),g:J1(n[2]),b:J1(n[3]),format:e?"name":"hex"}:(n=n2.hex4.exec(t))?{r:J1(n[1]+""+n[1]),g:J1(n[2]+""+n[2]),b:J1(n[3]+""+n[3]),a:aHe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=n2.hex3.exec(t))?{r:J1(n[1]+""+n[1]),g:J1(n[2]+""+n[2]),b:J1(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function y0o(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var lHe=function(e){var n=["r","g","b","a","h","s","l","v"],o=0,r=0;return Xco(n,function(i){if(e[i]&&(o+=1,isNaN(e[i])||(r+=1),i==="s"||i==="l")){var a=/^\d+%$/;a.test(e[i])&&(r+=1)}}),o===r?e:!1},JD=function(e,n){var o=e.hex?Zr(e.hex):Zr(e),r=o.toHsl(),i=o.toHsv(),a=o.toRgb(),l=o.toHex();r.s===0&&(r.h=n||0,i.h=n||0);var s=l==="000000"&&a.a===0;return{hsl:r,hex:s?"transparent":"#"+l,rgb:a,hsv:i,oldHue:e.h||n||r.h,source:e.source}},Qw=function(e){if(e==="transparent")return!0;var n=String(e).charAt(0)==="#"?1:0;return e.length!==4+n&&e.length<7+n&&Zr(e).isValid()},A9e=function(e){if(!e)return"#fff";var n=JD(e);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var o=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return o>=128?"#000":"#fff"},Yae=function(e,n){var o=e.replace("°","");return Zr(n+" ("+o+")")._ok},nD=Object.assign||function(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(o){P0o(r,o);function r(){var i,a,l,s;T0o(this,r);for(var c=arguments.length,u=Array(c),d=0;dl))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var d=-1,f=!0,p=n&W0o?new uJ:void 0;for(i.set(t,e),i.set(e,t);++d=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var BO=24,Zuo=vrt.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?BO:o,i=t.height,a=i===void 0?BO:i,l=t.style,s=l===void 0?{}:l,c=Quo(t,["fill","width","height","style"]);return PHe.default.createElement("svg",THe({viewBox:"0 0 "+BO+" "+BO,style:THe({fill:n,width:r,height:a},s)},c),PHe.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},edo=function(){function t(e,n){for(var o=0;o1&&(r.a=1),o.props.onChange({h:o.props.hsl.h,s:o.props.hsl.s,l:o.props.hsl.l,a:Math.round(r.a*100)/100,source:"rgb"},i)):(r.h||r.s||r.l)&&(typeof r.s=="string"&&r.s.includes("%")&&(r.s=r.s.replace("%","")),typeof r.l=="string"&&r.l.includes("%")&&(r.l=r.l.replace("%","")),r.s==1?r.s=.01:r.l==1&&(r.l=.01),o.props.onChange({h:r.h||o.props.hsl.h,s:Number(SHe(r.s)?o.props.hsl.s:r.s),l:Number(SHe(r.l)?o.props.hsl.l:r.l),source:"hsl"},i))},o.showHighlight=function(r){r.currentTarget.style.background="#eee"},o.hideHighlight=function(r){r.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?o.state={view:"rgb"}:o.state={view:n.view},o}return edo(e,[{key:"render",value:function(){var o=this,r=$i({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),i=void 0;return this.state.view==="hex"?i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),be.createElement("div",{style:r.alpha},be.createElement(cl,{style:{input:r.input,label:r.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(i=be.createElement("div",{style:r.fields,className:"flexbox-fix"},be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),be.createElement("div",{style:r.field},be.createElement(cl,{style:{input:r.input,label:r.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),be.createElement("div",{style:r.alpha},be.createElement(cl,{style:{input:r.input,label:r.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),be.createElement("div",{style:r.wrap,className:"flexbox-fix"},i,be.createElement("div",{style:r.toggle},be.createElement("div",{style:r.icon,onClick:this.toggleViews,ref:function(l){return o.icon=l}},be.createElement(Zuo,{style:r.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.hsl.a!==1&&r.view==="hex"?{view:"rgb"}:null}}]),e}(be.Component);xrt.defaultProps={view:"hex"};var CHe=function(){var e=$i({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return be.createElement("div",{style:e.picker})},rdo=function(){var e=$i({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return be.createElement("div",{style:e.picker})},T9e=function(e){var n=e.width,o=e.onChange,r=e.disableAlpha,i=e.rgb,a=e.hsl,l=e.hsv,s=e.hex,c=e.renderers,u=e.styles,d=u===void 0?{}:u,f=e.className,p=f===void 0?"":f,g=e.defaultView,A=$i(h1({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+i.r+", "+i.g+", "+i.b+", "+i.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:r});return be.createElement("div",{style:A.picker,className:"chrome-picker "+p},be.createElement("div",{style:A.saturation},be.createElement(pee,{style:A.Saturation,hsl:a,hsv:l,pointer:rdo,onChange:o})),be.createElement("div",{style:A.body},be.createElement("div",{style:A.controls,className:"flexbox-fix"},be.createElement("div",{style:A.color},be.createElement("div",{style:A.swatch},be.createElement("div",{style:A.active}),be.createElement(PM,{renderers:c}))),be.createElement("div",{style:A.toggles},be.createElement("div",{style:A.hue},be.createElement(CM,{style:A.Hue,hsl:a,pointer:CHe,onChange:o})),be.createElement("div",{style:A.alpha},be.createElement(u9e,{style:A.Alpha,rgb:i,hsl:a,pointer:CHe,renderers:c,onChange:o})))),be.createElement(xrt,{rgb:i,hsl:a,hex:s,view:g,onChange:o,disableAlpha:r})))};T9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),disableAlpha:mo.bool,styles:mo.object,defaultView:mo.oneOf(["hex","rgb","hsl"])};T9e.defaultProps={width:225,disableAlpha:!1,styles:{}};p1(T9e);var ido=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.active,l=$i({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:A9e(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:a,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return be.createElement(sS,{style:l.color,color:n,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},be.createElement("div",{style:l.dot}))},ado=function(e){var n=e.hex,o=e.rgb,r=e.onChange,i=$i({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),a=function(s,c){s.r||s.g||s.b?r({r:s.r||o.r,g:s.g||o.g,b:s.b||o.b,source:"rgb"},c):r({hex:s.hex,source:"hex"},c)};return be.createElement("div",{style:i.fields,className:"flexbox-fix"},be.createElement("div",{style:i.active}),be.createElement(cl,{style:{wrap:i.HEXwrap,input:i.HEXinput,label:i.HEXlabel},label:"hex",value:n,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"r",value:o.r,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"g",value:o.g,onChange:a}),be.createElement(cl,{style:{wrap:i.RGBwrap,input:i.RGBinput,label:i.RGBlabel},label:"b",value:o.b,onChange:a}))},P9e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.colors,i=e.hex,a=e.rgb,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=$i(h1({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},s)),f=function(g,A){g.hex?Qw(g.hex)&&n({hex:g.hex,source:"hex"},A):n(g,A)};return be.createElement(eU,{style:d.Compact,styles:s},be.createElement("div",{style:d.compact,className:"compact-picker "+u},be.createElement("div",null,cS(r,function(p){return be.createElement(ido,{key:p,color:p,active:p.toLowerCase()===i,onClick:f,onSwatchHover:o})}),be.createElement("div",{style:d.clear})),be.createElement(ado,{hex:i,rgb:a,onChange:f})))};P9e.propTypes={colors:mo.arrayOf(mo.string),styles:mo.object};P9e.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};const Ld=p1(P9e);var ldo=function(e){var n=e.hover,o=e.color,r=e.onClick,i=e.onSwatchHover,a={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},l=$i({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:a}},{hover:n});return be.createElement("div",{style:l.swatch},be.createElement(sS,{color:o,onClick:r,onHover:i,focusStyle:a}))};const sdo=c9e(ldo);var C9e=function(e){var n=e.width,o=e.colors,r=e.onChange,i=e.onSwatchHover,a=e.triangle,l=e.styles,s=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,d=$i(h1({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},s),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right","bottom-left-triangle":a==="bottom-left","bottom-right-triangle":a==="bottom-right"}),f=function(g,A){return r({hex:g,source:"hex"},A)};return be.createElement("div",{style:d.card,className:"github-picker "+u},be.createElement("div",{style:d.triangleShadow}),be.createElement("div",{style:d.triangle}),cS(o,function(p){return be.createElement(sdo,{color:p,key:p,onClick:f,onSwatchHover:i})}))};C9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),colors:mo.arrayOf(mo.string),triangle:mo.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:mo.object};C9e.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};p1(C9e);var cdo=function(e){var n=e.direction,o=$i({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return be.createElement("div",{style:o.picker})},udo=Object.assign||function(t){for(var e=1;e.5});return be.createElement("div",{style:o.picker})},pdo=function(){var e=$i({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return be.createElement("div",{style:e.pointer},be.createElement("div",{style:e.left},be.createElement("div",{style:e.leftInside})),be.createElement("div",{style:e.right},be.createElement("div",{style:e.rightInside})))},RHe=function(e){var n=e.onClick,o=e.label,r=e.children,i=e.active,a=$i({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:i});return be.createElement("div",{style:a.button,onClick:n},o||r)},gdo=function(e){var n=e.rgb,o=e.currentColor,r=$i({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:o,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return be.createElement("div",null,be.createElement("div",{style:r.label},"new"),be.createElement("div",{style:r.swatches},be.createElement("div",{style:r.new}),be.createElement("div",{style:r.current})),be.createElement("div",{style:r.label},"current"))},mdo=function(){function t(e,n){for(var o=0;o100&&(u.a=100),u.a/=100,n({h:r.h,s:r.s,l:r.l,a:u.a,source:"rgb"},d))};return be.createElement("div",{style:l.fields,className:"flexbox-fix"},be.createElement("div",{style:l.double},be.createElement(cl,{style:{input:l.input,label:l.label},label:"hex",value:i.replace("#",""),onChange:s})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"r",value:o.r,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"g",value:o.g,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.single},be.createElement(cl,{style:{input:l.input,label:l.label},label:"b",value:o.b,onChange:s,dragLabel:"true",dragMax:"255"})),be.createElement("div",{style:l.alpha},be.createElement(cl,{style:{input:l.input,label:l.label},label:"a",value:Math.round(o.a*100),onChange:s,dragLabel:"true",dragMax:"100"})))},xdo=Object.assign||function(t){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}var YO=24,Hdo=Srt.default=function(t){var e=t.fill,n=e===void 0?"currentColor":e,o=t.width,r=o===void 0?YO:o,i=t.height,a=i===void 0?YO:i,l=t.style,s=l===void 0?{}:l,c=Rdo(t,["fill","width","height","style"]);return MHe.default.createElement("svg",HHe({viewBox:"0 0 "+YO+" "+YO,style:HHe({fill:n,width:r,height:a},s)},c),MHe.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Mdo=function(e){var n=e.color,o=e.onClick,r=o===void 0?function(){}:o,i=e.onSwatchHover,a=e.first,l=e.last,s=e.active,c=$i({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:A9e(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:a,last:l,active:s,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return be.createElement(sS,{color:n,style:c.color,onClick:r,onHover:i,focusStyle:{boxShadow:"0 0 4px "+n}},be.createElement("div",{style:c.check},be.createElement(Hdo,null)))},Ido=function(e){var n=e.onClick,o=e.onSwatchHover,r=e.group,i=e.active,a=$i({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return be.createElement("div",{style:a.group},cS(r,function(l,s){return be.createElement(Mdo,{key:l,color:l,active:l.toLowerCase()===i,first:s===0,last:s===r.length-1,onClick:n,onSwatchHover:o})}))},z9e=function(e){var n=e.width,o=e.height,r=e.onChange,i=e.onSwatchHover,a=e.colors,l=e.hex,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=$i(h1({default:{picker:{width:n,height:o},overflow:{height:o,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),p=function(A,y){return r({hex:A,source:"hex"},y)};return be.createElement("div",{style:f.picker,className:"swatches-picker "+d},be.createElement(eU,null,be.createElement("div",{style:f.overflow},be.createElement("div",{style:f.body},cS(a,function(g){return be.createElement(Ido,{key:g.toString(),group:g,active:l,onClick:p,onSwatchHover:i})}),be.createElement("div",{style:f.clear})))))};z9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),height:mo.oneOfType([mo.string,mo.number]),colors:mo.arrayOf(mo.arrayOf(mo.string)),styles:mo.object};z9e.defaultProps={width:320,height:240,colors:[[yP[900],yP[700],yP[500],yP[300],yP[100]],[AP[900],AP[700],AP[500],AP[300],AP[100]],[wP[900],wP[700],wP[500],wP[300],wP[100]],[vP[900],vP[700],vP[500],vP[300],vP[100]],[xP[900],xP[700],xP[500],xP[300],xP[100]],[bP[900],bP[700],bP[500],bP[300],bP[100]],[SP[900],SP[700],SP[500],SP[300],SP[100]],[TP[900],TP[700],TP[500],TP[300],TP[100]],[PP[900],PP[700],PP[500],PP[300],PP[100]],["#194D33",KD[700],KD[500],KD[300],KD[100]],[CP[900],CP[700],CP[500],CP[300],CP[100]],[RP[900],RP[700],RP[500],RP[300],RP[100]],[HP[900],HP[700],HP[500],HP[300],HP[100]],[MP[900],MP[700],MP[500],MP[300],MP[100]],[IP[900],IP[700],IP[500],IP[300],IP[100]],[zP[900],zP[700],zP[500],zP[300],zP[100]],[DP[900],DP[700],DP[500],DP[300],DP[100]],[EP[900],EP[700],EP[500],EP[300],EP[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};p1(z9e);var D9e=function(e){var n=e.onChange,o=e.onSwatchHover,r=e.hex,i=e.colors,a=e.width,l=e.triangle,s=e.styles,c=s===void 0?{}:s,u=e.className,d=u===void 0?"":u,f=$i(h1({default:{card:{width:a,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":l==="hide","top-left-triangle":l==="top-left","top-right-triangle":l==="top-right"}),p=function(A,y){Qw(A)&&n({hex:A,source:"hex"},y)};return be.createElement("div",{style:f.card,className:"twitter-picker "+d},be.createElement("div",{style:f.triangleShadow}),be.createElement("div",{style:f.triangle}),be.createElement("div",{style:f.body},cS(i,function(g,A){return be.createElement(sS,{key:A,color:g,hex:g,style:f.swatch,onClick:p,onHover:o,focusStyle:{boxShadow:"0 0 4px "+g}})}),be.createElement("div",{style:f.hash},"#"),be.createElement(cl,{label:null,style:{input:f.input},value:r.replace("#",""),onChange:p}),be.createElement("div",{style:f.clear})))};D9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),triangle:mo.oneOf(["hide","top-left","top-right"]),colors:mo.arrayOf(mo.string),styles:mo.object};D9e.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};p1(D9e);var E9e=function(e){var n=$i({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return be.createElement("div",{style:n.picker})};E9e.propTypes={hsl:mo.shape({h:mo.number,s:mo.number,l:mo.number,a:mo.number})};E9e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var F9e=function(e){var n=$i({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return be.createElement("div",{style:n.picker})};F9e.propTypes={hsl:mo.shape({h:mo.number,s:mo.number,l:mo.number,a:mo.number})};F9e.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var zdo=function(e){var n=e.onChange,o=e.rgb,r=e.hsl,i=e.hex,a=e.hsv,l=function(p,g){if(p.hex)Qw(p.hex)&&n({hex:p.hex,source:"hex"},g);else if(p.rgb){var A=p.rgb.split(",");Yae(p.rgb,"rgb")&&n({r:A[0],g:A[1],b:A[2],a:1,source:"rgb"},g)}else if(p.hsv){var y=p.hsv.split(",");Yae(p.hsv,"hsv")&&(y[2]=y[2].replace("%",""),y[1]=y[1].replace("%",""),y[0]=y[0].replace("°",""),y[1]==1?y[1]=.01:y[2]==1&&(y[2]=.01),n({h:Number(y[0]),s:Number(y[1]),v:Number(y[2]),source:"hsv"},g))}else if(p.hsl){var S=p.hsl.split(",");Yae(p.hsl,"hsl")&&(S[2]=S[2].replace("%",""),S[1]=S[1].replace("%",""),S[0]=S[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),n({h:Number(S[0]),s:Number(S[1]),v:Number(S[2]),source:"hsl"},g))}},s=$i({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=o.r+", "+o.g+", "+o.b,u=Math.round(r.h)+"°, "+Math.round(r.s*100)+"%, "+Math.round(r.l*100)+"%",d=Math.round(a.h)+"°, "+Math.round(a.s*100)+"%, "+Math.round(a.v*100)+"%";return be.createElement("div",{style:s.wrap,className:"flexbox-fix"},be.createElement("div",{style:s.fields},be.createElement("div",{style:s.double},be.createElement(cl,{style:{input:s.input,label:s.label},label:"hex",value:i,onChange:l})),be.createElement("div",{style:s.column},be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"rgb",value:c,onChange:l})),be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"hsv",value:d,onChange:l})),be.createElement("div",{style:s.single},be.createElement(cl,{style:{input:s.input2,label:s.label2},label:"hsl",value:u,onChange:l})))))},k9e=function(e){var n=e.width,o=e.onChange,r=e.rgb,i=e.hsl,a=e.hsv,l=e.hex,s=e.header,c=e.styles,u=c===void 0?{}:c,d=e.className,f=d===void 0?"":d,p=$i(h1({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+r.r+", "+r.g+", "+r.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},u));return be.createElement("div",{style:p.picker,className:"google-picker "+f},be.createElement("div",{style:p.head},s),be.createElement("div",{style:p.swatch}),be.createElement("div",{style:p.saturation},be.createElement(pee,{hsl:i,hsv:a,pointer:E9e,onChange:o})),be.createElement("div",{style:p.body},be.createElement("div",{style:p.controls,className:"flexbox-fix"},be.createElement("div",{style:p.hue},be.createElement(CM,{style:p.Hue,hsl:i,radius:"4px",pointer:F9e,onChange:o}))),be.createElement(zdo,{rgb:r,hsl:i,hex:l,hsv:a,onChange:o})))};k9e.propTypes={width:mo.oneOfType([mo.string,mo.number]),styles:mo.object,header:mo.string};k9e.defaultProps={width:652,styles:{},header:"Color picker"};p1(k9e);const Ddo=({setDialogVisible:t})=>{const e=M(pn),n=M(dYe),o=M(Jn),r=M(fYe),i=M(En),a=M($s),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState((s==null?void 0:s.color)??"#808080"),d=$t(),f=S=>{switch(a){case re.AllSelectedObjectsOfThisType:{for(const C of M.getState().elements)if(C.type===z.Foundation&&!C.locked&&M.getState().selectedElementIdSet.has(C.id)&&S!==C.color)return!0;break}case re.AllObjectsOfThisType:for(const C of M.getState().elements)if(C.type===z.Foundation&&!C.locked&&S!==C.color)return!0;break;default:if(S!==(s==null?void 0:s.color))return!0}return!1},p=(S,C)=>{M.getState().set(P=>{for(const v of P.elements)if(v.type===z.Foundation&&S.has(v.id))if(C!==void 0)v.color=C;else{const T=S.get(v.id);T!==void 0&&(v.color=T)}})},g=S=>{if(s&&f(S)){switch(a){case re.AllSelectedObjectsOfThisType:{const C=new Map;for(const v of M.getState().elements)v.type===z.Foundation&&M.getState().selectedElementIdSet.has(v.id)&&C.set(v.id,v.color??"#808080");const P={name:"Set Color for Selected Foundations",timestamp:Date.now(),oldValues:C,newValue:S,undo:()=>{p(P.oldValues)},redo:()=>{p(P.oldValues,P.newValue)}};i(P),p(C,S),l(M.getState().applyCount+1);break}case re.AllObjectsOfThisType:{const C=new Map;for(const v of M.getState().elements)v.type===z.Foundation&&C.set(v.id,v.color??"#808080");const P={name:"Set Color for All Foundations",timestamp:Date.now(),oldValues:C,newValue:S,undo:()=>{for(const[v,T]of P.oldValues.entries())n(v,T)},redo:()=>{r(z.Foundation,P.newValue)}};i(P),r(z.Foundation,S),l(M.getState().applyCount+1);break}default:{const C=o(s.id),P=C?C.color:s.color,v={name:"Set Color of Selected Foundation",timestamp:Date.now(),oldValue:P,newValue:S,changedElementId:s.id,changedElementType:s.type,undo:()=>{n(v.changedElementId,v.oldValue)},redo:()=>{n(v.changedElementId,v.newValue)}};i(v),n(s.id,S),l(M.getState().applyCount+1);break}}e(C=>{C.actionState.foundationColor=S})}},A=()=>{g(c)},y=()=>{t(!1)};return h.jsx(so,{width:600,title:Y.t("word.Color",d),onApply:A,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:c,onChangeComplete:S=>{u(S.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S=>M.getState().setFoundationActionScope(S.target.value),value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},Edo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(cYe),r=M(d3),i=M(vW),a=M(kw),l=M(LH),s=M(u3),c=M(En),u=M($s),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Foundation),[y,S]=m.useState((A==null?void 0:A.lx)??.1),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=se=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const oe of e)if(oe.type===z.Foundation&&M.getState().selectedElementIdSet.has(oe.id)){const Z=oe,te=l(Z.id);if(te.length>0&&!me.doesNewSizeContainAllChildren(Z,te,se,Z.ly))return!1}break}case re.AllObjectsOfThisType:{for(const oe of e)if(oe.type===z.Foundation){const Z=oe,te=l(Z.id);if(te.length>0&&!me.doesNewSizeContainAllChildren(Z,te,se,Z.ly))return!1}break}default:{const oe=l(A.id);if(oe.length>0)return me.doesNewSizeContainAllChildren(A,oe,se,A.ly);break}}return!0}},U=se=>!N(se),W=se=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const oe of e)if(oe.type===z.Foundation&&!oe.locked&&M.getState().selectedElementIdSet.has(oe.id)&&Math.abs(oe.lx-se)>Et)return!0;break;case re.AllObjectsOfThisType:for(const oe of e)if(oe.type===z.Foundation&&!oe.locked&&Math.abs(oe.lx-se)>Et)return!0;break;default:if(Math.abs((A==null?void 0:A.lx)-se)>Et)return!0}return!1}},k=(se,oe)=>{if(se==null)return null;for(const Z of se.children)if(Z.name.includes(`${oe}`))return Z;return null},D=(se,oe,Z)=>{var te,ee;if(se){for(const de of se.children)if(de.name.includes(`${Z.id}`)){(ee=(te=kn.getState().contentRef)==null?void 0:te.current)==null||ee.add(de);break}d(de=>{for(const fe of de.elements)if(fe.id===Z.id){fe.parentId=Zo;const pe=new Kt(fe.cx,fe.cy).rotateAround(ai,oe.rotation[2]).add(new Kt(oe.cx,oe.cy));fe.cx=pe.x,fe.cy=pe.y,fe.cz=0,T.current.set(fe.id,new le(pe.x,pe.y,0)),P.current.set(fe.id,Zo);break}})}},L=(se,oe)=>{const Z=l(se.id),te=se.rotation[2];if(w.current.clear(),R.current.clear(),Z.length>0)for(const ee of Z)switch(ee.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const de=new Kt(ee.cx*se.lx,ee.cy*se.ly).rotateAround(ai,te);w.current.set(ee.id,de),v.current.set(ee.id,new le(ee.cx,ee.cy));break}case z.Polygon:{const de=ee,fe=[];for(const pe of de.vertices)fe.push(new Kt(pe.x*se.lx,pe.y*se.ly).rotateAround(ai,te));R.current.set(ee.id,fe),x.current.set(ee.id,de.vertices.map(pe=>({...pe})));break}case z.Human:case z.Tree:{v.current.set(ee.id,new le(ee.cx,ee.cy,ee.cz));break}}if(r(se.id,oe),Z.length>0)for(const ee of Z)switch(ee.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const de=w.current.get(ee.id);if(de){const pe=new Kt(de.x,de.y).rotateAround(ai,-te).x/oe;o(ee.id,pe),T.current.set(ee.id,new le(pe,ee.cy))}break}case z.Polygon:{const de=R.current.get(ee.id);if(de){const fe=[];for(const pe of de){const ye=pe.rotateAround(ai,-te),ae=ye.x/oe,Te=ye.y/se.ly;fe.push({x:ae,y:Te})}a(ee.id,fe),b.current.set(ee.id,fe.map(pe=>({...pe})))}break}case z.Human:case z.Tree:{if(T.current.set(ee.id,new le(ee.cx,ee.cy,ee.cz)),C.current.set(ee.id,se.id),Math.abs(ee.cz-se.lz/2)0){const de=kn.getState().contentRef,fe=k(de==null?void 0:de.current,se.id);D(fe,se,ee)}}else if(Math.abs(Math.abs(ee.cx)-se.lx/2)0?oe:-oe)/2;o(ee.id,de),T.current.set(ee.id,new le(de,ee.cy,ee.cz))}break}}},j=(se,oe,Z)=>{if(!se||!oe)return;const te=kn.getState().contentRef,ee=k(te==null?void 0:te.current,oe),de=k(oe===Zo?te==null?void 0:te.current:ee,Z);if(de&&(te!=null&&te.current)){if(se===Zo)te.current.add(de);else{const fe=k(te.current,se);fe==null||fe.add(de)}op()}},B=(se,oe)=>{se&&d(Z=>{for(const te of Z.elements)if(te.id===oe){te.parentId=se;break}})},O=(se,oe)=>{M.getState().set(Z=>{for(const te of Z.elements)if(se.has(te.id))if(oe!==void 0)te.lx=oe;else{const ee=se.get(te.id);ee!==void 0&&(te.lx=ee)}})},V=se=>{if(!A||!W(se))return;const oe=n(A.id),Z=oe?oe.lx:A.lx;if(F.current=void 0,H.current=U(se),H.current)F.current=se,S(Z);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),u){case re.AllSelectedObjectsOfThisType:{const te=new Map;for(const de of e)de.type===z.Foundation&&M.getState().selectedElementIdSet.has(de.id)&&te.set(de.id,de.lx);for(const de of e)de.type===z.Foundation&&M.getState().selectedElementIdSet.has(de.id)&&L(de,se);const ee={name:"Set Length for Selected Foundations",timestamp:Date.now(),oldSizes:te,newSize:se,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,fe;if(O(ee.oldSizes),ee.oldChildrenPositionsMap&&ee.oldChildrenPositionsMap.size>0)for(const[pe,ye]of ee.oldChildrenPositionsMap.entries()){s(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(j(ae,Te,pe),B(ae,pe))}if(ee.oldChildrenVerticesMap&&ee.oldChildrenVerticesMap.size>0)for(const[pe,ye]of ee.oldChildrenVerticesMap.entries())a(pe,ye)},redo:()=>{var de,fe;if(O(ee.oldSizes,ee.newSize),ee.newChildrenPositionsMap&&ee.newChildrenPositionsMap.size>0)for(const[pe,ye]of ee.newChildrenPositionsMap.entries()){s(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(j(Te,ae,pe),B(Te,pe))}if(ee.newChildrenVerticesMap&&ee.newChildrenVerticesMap.size>0)for(const[pe,ye]of ee.newChildrenVerticesMap.entries())a(pe,ye)}};c(ee),p(f+1);break}case re.AllObjectsOfThisType:{const te=new Map;for(const de of e)de.type===z.Foundation&&te.set(de.id,de.lx);for(const de of e)de.type===z.Foundation&&L(de,se);const ee={name:"Set Length for All Foundations",timestamp:Date.now(),oldSizes:te,newSize:se,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,fe;for(const[pe,ye]of ee.oldSizes.entries())r(pe,ye);if(ee.oldChildrenPositionsMap&&ee.oldChildrenPositionsMap.size>0)for(const[pe,ye]of ee.oldChildrenPositionsMap.entries()){s(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(j(ae,Te,pe),B(ae,pe))}if(ee.oldChildrenVerticesMap&&ee.oldChildrenVerticesMap.size>0)for(const[pe,ye]of ee.oldChildrenVerticesMap.entries())a(pe,ye)},redo:()=>{var de,fe;if(i(z.Foundation,ee.newSize),ee.newChildrenPositionsMap&&ee.newChildrenPositionsMap.size>0)for(const[pe,ye]of ee.newChildrenPositionsMap.entries()){s(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(j(Te,ae,pe),B(Te,pe))}if(ee.newChildrenVerticesMap&&ee.newChildrenVerticesMap.size>0)for(const[pe,ye]of ee.newChildrenVerticesMap.entries())a(pe,ye)}};c(ee),p(f+1);break}default:{L(A,se);const te={name:"Set Foundation Length",timestamp:Date.now(),oldSize:Z,newSize:se,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var ee,de;if(r(A.id,te.oldSize),te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[fe,pe]of te.oldChildrenPositionsMap.entries()){s(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ye,ae,fe),B(ye,fe))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[fe,pe]of te.oldChildrenVerticesMap.entries())a(fe,pe)},redo:()=>{var ee,de;if(r(A.id,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[fe,pe]of te.newChildrenPositionsMap.entries()){s(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ae,ye,fe),B(ae,fe))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[fe,pe]of te.newChildrenVerticesMap.entries())a(fe,pe)}};c(te),p(f+1);break}}},G=()=>{t(!1)},q=()=>{G(),g()},$=()=>{V(y),H.current||(t(!1),p(0))},ie=()=>{V(y)},Q=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",E),rejectedMessage:Q,onApply:ie,onClose:G,onClickCancel:q,onClickOk:$,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:se=>{se!==null&&S(se)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:se=>M.getState().setFoundationActionScope(se.target.value),value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",E)})]})})})]})})},Fdo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(u3),r=M(uYe),i=M(Fw),a=M(xW),l=M(kw),s=M(LH),c=M(En),u=M($s),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Foundation),[y,S]=m.useState((A==null?void 0:A.ly)??.1),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=Q=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const se of e)if(se.type===z.Foundation&&M.getState().selectedElementIdSet.has(se.id)){const oe=se,Z=s(oe.id);if(Z.length>0&&!me.doesNewSizeContainAllChildren(oe,Z,oe.lx,Q))return!1}break}case re.AllObjectsOfThisType:{for(const se of e)if(se.type===z.Foundation){const oe=se,Z=s(oe.id);if(Z.length>0&&!me.doesNewSizeContainAllChildren(oe,Z,oe.lx,Q))return!1}break}default:{const se=s(A.id);if(se.length>0)return me.doesNewSizeContainAllChildren(A,se,A.lx,Q);break}}return!0}},U=Q=>!N(Q),W=Q=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const se of e)if(se.type===z.Foundation&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.ly-Q)>Et)return!0;break;case re.AllObjectsOfThisType:for(const se of e)if(se.type===z.Foundation&&!se.locked&&Math.abs(se.ly-Q)>Et)return!0;break;default:if(Math.abs((A==null?void 0:A.ly)-Q)>Et)return!0}return!1}},k=(Q,se)=>{if(Q==null)return null;for(const oe of Q.children)if(oe.name.includes(`${se}`))return oe;return null},D=(Q,se,oe)=>{var Z,te;if(Q){for(const ee of Q.children)if(ee.name.includes(`${oe.id}`)){(te=(Z=kn.getState().contentRef)==null?void 0:Z.current)==null||te.add(ee);break}d(ee=>{for(const de of ee.elements)if(de.id===oe.id){de.parentId=Zo;const fe=new Kt(de.cx,de.cy).rotateAround(ai,se.rotation[2]).add(new Kt(se.cx,se.cy));de.cx=fe.x,de.cy=fe.y,de.cz=0,T.current.set(de.id,new le(fe.x,fe.y,0)),P.current.set(de.id,Zo);break}})}},L=(Q,se)=>{const oe=s(Q.id),Z=Q.rotation[2];if(w.current.clear(),R.current.clear(),oe.length>0)for(const te of oe)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const ee=new Kt(te.cx*Q.lx,te.cy*Q.ly).rotateAround(ai,Z);w.current.set(te.id,ee),v.current.set(te.id,new le(te.cx,te.cy));break}case z.Polygon:{const ee=te,de=[];for(const fe of ee.vertices)de.push(new Kt(fe.x*Q.lx,fe.y*Q.ly).rotateAround(ai,Z));R.current.set(te.id,de),x.current.set(te.id,ee.vertices.map(fe=>({...fe})));break}case z.Human:case z.Tree:{v.current.set(te.id,new le(te.cx,te.cy,te.cz));break}}if(i(Q.id,se),oe.length>0)for(const te of oe)switch(te.type){case z.Wall:break;case z.SolarPanel:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:case z.Sensor:{const ee=w.current.get(te.id);if(ee){const fe=new Kt(ee.x,ee.y).rotateAround(ai,-Z).y/se;r(te.id,fe),T.current.set(te.id,new le(te.cx,fe))}break}case z.Polygon:{const ee=R.current.get(te.id);if(ee){const de=[];for(const fe of ee){const pe=fe.rotateAround(ai,-Z),ye=pe.x/Q.lx,ae=pe.y/se;de.push({x:ye,y:ae})}l(te.id,de),b.current.set(te.id,de.map(fe=>({...fe})))}break}case z.Human:case z.Tree:{if(T.current.set(te.id,new le(te.cx,te.cy,te.cz)),C.current.set(te.id,Q.id),Math.abs(te.cz-Q.lz/2)0){const ee=kn.getState().contentRef,de=k(ee==null?void 0:ee.current,Q.id);D(de,Q,te)}}else if(Math.abs(Math.abs(te.cy)-Q.ly/2)0?se:-se)/2;r(te.id,ee),T.current.set(te.id,new le(te.cz,ee,te.cz))}break}}},j=(Q,se,oe)=>{if(!Q||!se)return;const Z=kn.getState().contentRef,te=k(Z==null?void 0:Z.current,se),ee=k(se===Zo?Z==null?void 0:Z.current:te,oe);if(ee&&(Z!=null&&Z.current)){if(Q===Zo)Z.current.add(ee);else{const de=k(Z.current,Q);de==null||de.add(ee)}op()}},B=(Q,se)=>{Q&&d(oe=>{for(const Z of oe.elements)if(Z.id===se){Z.parentId=Q;break}})},O=Q=>{if(!A||!W(Q))return;const se=n(A.id),oe=se?se.ly:A.ly;if(F.current=void 0,H.current=U(Q),H.current)F.current=Q,S(oe);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),u){case re.AllSelectedObjectsOfThisType:{const Z=new Map;for(const ee of e)ee.type===z.Foundation&&M.getState().selectedElementIdSet.has(ee.id)&&Z.set(ee.id,ee.ly);for(const ee of e)ee.type===z.Foundation&&M.getState().selectedElementIdSet.has(ee.id)&&L(ee,Q);const te={name:"Set Width for Selected Foundations",timestamp:Date.now(),oldSizes:Z,newSize:Q,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var ee,de;for(const[fe,pe]of te.oldSizes.entries())i(fe,pe);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[fe,pe]of te.oldChildrenPositionsMap.entries()){o(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ye,ae,fe),B(ye,fe))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[fe,pe]of te.oldChildrenVerticesMap.entries())l(fe,pe)},redo:()=>{var ee,de;for(const[fe,pe]of te.oldSizes.entries())i(fe,te.newSize);if(te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[fe,pe]of te.newChildrenPositionsMap.entries()){o(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ae,ye,fe),B(ae,fe))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[fe,pe]of te.newChildrenVerticesMap.entries())l(fe,pe)}};c(te),p(f+1);break}case re.AllObjectsOfThisType:{const Z=new Map;for(const ee of e)ee.type===z.Foundation&&Z.set(ee.id,ee.ly);for(const ee of e)ee.type===z.Foundation&&L(ee,Q);const te={name:"Set Width for All Foundations",timestamp:Date.now(),oldSizes:Z,newSize:Q,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var ee,de;for(const[fe,pe]of te.oldSizes.entries())i(fe,pe);if(te.oldChildrenPositionsMap&&te.oldChildrenPositionsMap.size>0)for(const[fe,pe]of te.oldChildrenPositionsMap.entries()){o(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ye,ae,fe),B(ye,fe))}if(te.oldChildrenVerticesMap&&te.oldChildrenVerticesMap.size>0)for(const[fe,pe]of te.oldChildrenVerticesMap.entries())l(fe,pe)},redo:()=>{var ee,de;if(a(z.Foundation,te.newSize),te.newChildrenPositionsMap&&te.newChildrenPositionsMap.size>0)for(const[fe,pe]of te.newChildrenPositionsMap.entries()){o(fe,pe.x,pe.y,pe.z);const ye=(ee=te.oldChildrenParentIdMap)==null?void 0:ee.get(fe),ae=(de=te.newChildrenParentIdMap)==null?void 0:de.get(fe);ye&&ae&&ye!==ae&&(j(ae,ye,fe),B(ae,fe))}if(te.newChildrenVerticesMap&&te.newChildrenVerticesMap.size>0)for(const[fe,pe]of te.newChildrenVerticesMap.entries())l(fe,pe)}};c(te),p(f+1);break}default:{L(A,Q);const Z={name:"Set Foundation Width",timestamp:Date.now(),oldSize:oe,newSize:Q,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var te,ee;if(i(A.id,Z.oldSize),Z.oldChildrenPositionsMap&&Z.oldChildrenPositionsMap.size>0)for(const[de,fe]of Z.oldChildrenPositionsMap.entries()){o(de,fe.x,fe.y,fe.z);const pe=(te=Z.oldChildrenParentIdMap)==null?void 0:te.get(de),ye=(ee=Z.newChildrenParentIdMap)==null?void 0:ee.get(de);pe&&ye&&pe!==ye&&(j(pe,ye,de),B(pe,de))}if(Z.oldChildrenVerticesMap&&Z.oldChildrenVerticesMap.size>0)for(const[de,fe]of Z.oldChildrenVerticesMap.entries())l(de,fe)},redo:()=>{var te,ee;if(i(A.id,Z.newSize),Z.newChildrenPositionsMap&&Z.newChildrenPositionsMap.size>0)for(const[de,fe]of Z.newChildrenPositionsMap.entries()){o(de,fe.x,fe.y,fe.z);const pe=(te=Z.oldChildrenParentIdMap)==null?void 0:te.get(de),ye=(ee=Z.newChildrenParentIdMap)==null?void 0:ee.get(de);pe&&ye&&pe!==ye&&(j(ye,pe,de),B(ye,de))}if(Z.newChildrenVerticesMap&&Z.newChildrenVerticesMap.size>0)for(const[de,fe]of Z.newChildrenVerticesMap.entries())l(de,fe)}};c(Z),p(f+1);break}}},V=()=>{t(!1)},G=()=>{V(),g()},q=()=>{O(y),H.current||(t(!1),p(0))},$=()=>{O(y)},ie=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",E),rejectedMessage:ie,onApply:$,onClickCancel:G,onClickOk:q,onClose:V,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:Q=>{Q!==null&&S(Q)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:Q=>M.getState().setFoundationActionScope(Q.target.value),value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",E)})]})})})]})})},kdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(u3),l=M(no),s=M(Qn),c=uo(z.Foundation),[u,d]=m.useState((c==null?void 0:c.lz)??.1),f=m.useRef(new Map),p=m.useRef(new Map),g=m.useRef(new Map),A=m.useRef(new Map),y=$t(),S=(N,U)=>{e(W=>{const k=W.elements.find(D=>D.id===N);k&&(k.lz=U,k.cz=U/2)})},C=(N,U)=>{e(W=>{for(const k of W.elements)k.type===N&&!k.locked&&(k.lz=U,k.cz=U/2)})},P=N=>{if(c){switch(i){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Foundation&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.lz-N)>Et)return!0;break}case re.AllObjectsOfThisType:for(const U of n)if(U.type===z.Foundation&&!U.locked&&Math.abs(U.lz-N)>Et)return!0;break;default:if(Math.abs((c==null?void 0:c.lz)-N)>Et)return!0}return!1}},v=(N,U)=>{if(N==null)return null;for(const W of N.children)if(W.name.includes(`${U}`))return W;return null},T=(N,U,W)=>{var k,D;if(N){for(const j of N.children)if(j.name.includes(`${W.id}`)){(D=(k=kn.getState().contentRef)==null?void 0:k.current)==null||D.add(j);break}W.parentId=Zo;const L=new Kt(W.cx,W.cy).rotateAround(ai,-U.rotation[2]).add(new Kt(U.cx,U.cy));W.cx=L.x,W.cy=L.y,W.cz=0,A.current.set(W.id,new le(L.x,L.y,0)),p.current.set(W.id,Zo)}},w=(N,U,W)=>{e(k=>{for(const D of k.elements)if(D.parentId===N.id)if(f.current.set(D.id,N.id),g.current.set(D.id,new le(D.cx,D.cy,D.cz)),me.isPlantOrHuman(D))if(Math.abs(D.cz-N.lz/2)U/2){const j=kn.getState().contentRef,B=v(j==null?void 0:j.current,N.id);T(B,N,D)}else D.cz=L,A.current.set(D.id,new le(D.cx,D.cy,L))}else D.type===z.SolarPanel&&(D.cz=U/2,A.current.set(D.id,new le(D.cx,D.cy,U/2)));else D.foundationId===N.id&&D.type===z.SolarPanel&&D.parentType==z.Roof&&W!==void 0&&(g.current.set(D.id,new le(D.cx,D.cy,D.cz)),D.cz=D.cz-W/2+U/2,A.current.set(D.id,new le(D.cx,D.cy,D.cz)))})},x=(N,U,W)=>{if(!N||!U)return;const k=kn.getState().contentRef,D=v(k==null?void 0:k.current,U),L=v(U===Zo?k==null?void 0:k.current:D,W);if(L&&(k!=null&&k.current)){if(N===Zo)k.current.add(L);else{const j=v(k.current,N);j==null||j.add(L)}op()}},b=(N,U)=>{N&&e(W=>{for(const k of W.elements)if(k.id===U){k.parentId=N;break}})},R=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)if(N.has(k.id))if(U!==void 0)k.lz=U,k.cz=U/2;else{const D=N.get(k.id);D!==void 0&&(k.lz=D,k.cz=D/2)}})},H=N=>{if(c&&P(N)){switch(i){case re.AllSelectedObjectsOfThisType:{const U=new Map;for(const k of n)k.type===z.Foundation&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.lz);for(const k of n)k.type===z.Foundation&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&w(k,N,U.get(k.id));const W={name:"Set Height for Selected Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var k,D;if(R(W.oldValues),W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const B=(k=W.oldChildrenParentIdMap)==null?void 0:k.get(L),O=(D=W.newChildrenParentIdMap)==null?void 0:D.get(L);B&&O&&B!==O&&(x(B,O,L),b(B,L))}},redo:()=>{var D,L;const k=W.newValue;if(R(W.oldValues,k),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,B]of W.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=W.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(W),R(U,N),s(l+1);break}case re.AllObjectsOfThisType:{const U=new Map;for(const k of n)k.type===z.Foundation&&U.set(k.id,k.lz);for(const k of n)k.type===z.Foundation&&w(k,N,U.get(k.id));const W={name:"Set Height for All Foundations",timestamp:Date.now(),oldValues:U,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),undo:()=>{var k,D;for(const[L,j]of W.oldValues.entries())S(L,j);if(W.oldChildrenPositionsMap&&W.oldChildrenPositionsMap.size>0)for(const[L,j]of W.oldChildrenPositionsMap.entries()){a(L,j.x,j.y,j.z);const B=(k=W.oldChildrenParentIdMap)==null?void 0:k.get(L),O=(D=W.newChildrenParentIdMap)==null?void 0:D.get(L);B&&O&&B!==O&&(x(B,O,L),b(B,L))}},redo:()=>{var D,L;const k=W.newValue;if(C(z.Foundation,k),W.newChildrenPositionsMap&&W.newChildrenPositionsMap.size>0)for(const[j,B]of W.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=W.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=W.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(W),C(z.Foundation,N),s(l+1);break}default:{const U=o(c.id),W=U?U.lz:c.lz;w(c,N,W),S(c.id,N);const k={name:"Set Foundation Height",timestamp:Date.now(),oldValue:W,newValue:N,oldChildrenPositionsMap:new Map(g.current),newChildrenPositionsMap:new Map(A.current),oldChildrenParentIdMap:new Map(f.current),newChildrenParentIdMap:new Map(p.current),changedElementId:c.id,changedElementType:c.type,undo:()=>{var D,L;if(S(k.changedElementId,k.oldValue),k.oldChildrenPositionsMap&&k.oldChildrenPositionsMap.size>0)for(const[j,B]of k.oldChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=k.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=k.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(O,V,j),b(O,j))}},redo:()=>{var D,L;if(S(k.changedElementId,k.newValue),k.newChildrenPositionsMap&&k.newChildrenPositionsMap.size>0)for(const[j,B]of k.newChildrenPositionsMap.entries()){a(j,B.x,B.y,B.z);const O=(D=k.oldChildrenParentIdMap)==null?void 0:D.get(j),V=(L=k.newChildrenParentIdMap)==null?void 0:L.get(j);O&&V&&O!==V&&(x(V,O,j),b(V,j))}}};r(k),s(l+1);break}}e(U=>{U.actionState.foundationHeight=N})}},F=()=>{t(!1)},E=()=>{H(u)};return h.jsx(so,{width:550,title:Y.t("word.Height",y),onApply:E,onClose:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:10,style:{width:120},step:.1,precision:2,value:u,onChange:N=>{N!==null&&d(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 10] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N=>M.getState().setFoundationActionScope(N.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",y)})]})})})]})})},Ldo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Bge),r=M(i7t),i=M(En),a=M($s),l=M(no),s=M(Qn),c=uo(z.Foundation),[u,d]=m.useState(c?-(c==null?void 0:c.rotation[2]):0),f=$t(),p=C=>{if(c){switch(a){case re.AllSelectedObjectsOfThisType:{for(const P of e)if(P.type===z.Foundation&&!P.locked&&M.getState().selectedElementIdSet.has(P.id)&&Math.abs(-P.rotation[2]-C)>Et)return!0;break}case re.AllObjectsOfThisType:for(const P of e)if(P.type===z.Foundation&&!P.locked&&Math.abs(-P.rotation[2]-C)>Et)return!0;break;default:if(Math.abs(-(c==null?void 0:c.rotation[2])-C)>Et)return!0}return!1}},g=(C,P)=>{M.getState().set(v=>{for(const T of v.elements)if(C.has(T.id))if(P!==void 0)T.rotation[2]=P;else{const w=C.get(T.id);w!==void 0&&(T.rotation[2]=-w)}})},A=C=>{if(c&&p(C))switch(a){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Foundation&&M.getState().selectedElementIdSet.has(T.id)&&P.set(T.id,-T.rotation[2]);const v={name:"Set Azimuth for All Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{g(v.oldValues)},redo:()=>{g(v.oldValues,-v.newValue)}};i(v),g(P,-C),s(l+1);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Foundation&&P.set(T.id,-T.rotation[2]);const v={name:"Set Azimuth for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())o(T,0,0,-w)},redo:()=>{r(z.Foundation,0,0,-v.newValue)}};i(v),r(z.Foundation,0,0,-C),s(l+1);break}default:{const P=n(c.id),v=P?-P.rotation[2]:-c.rotation[2],T={name:"Set Foundation Azimuth",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(T.changedElementId,0,0,-T.oldValue)},redo:()=>{o(T.changedElementId,0,0,-T.newValue)}};i(T),o(c.id,0,0,-C),s(l+1);break}}},y=()=>{t(!1)},S=()=>{A(u)};return h.jsx(so,{width:500,title:Y.t("word.Azimuth",f),onApply:S,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(me.toDegrees(u).toFixed(2)),formatter:C=>`${C}°`,onChange:C=>{C!==null&&d(me.toRadians(C))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:C=>M.getState().setFoundationActionScope(C.target.value),value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Wdo=({setDialogVisible:t})=>{const e=M(Kn),n=M(c3),o=M(En),r=M($s),i=M(a7t),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),u=M(pn),d=M(k=>{if(n){for(const D of k.elements)if(D.id===n.id)return D}return null}),[f,p]=m.useState((d==null?void 0:d.rValue)??i8),[g,A]=m.useState(me.toRValueInUS(f)),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=$t();m.useEffect(()=>{d&&p((d==null?void 0:d.rValue)??i8)},[d==null?void 0:d.rValue]);const w=k=>{switch(r){case re.AllObjectsOfThisType:for(const D of e)if(D.type===z.Foundation&&!D.locked){const L=D;if(L.rValue===void 0||Math.abs(L.rValue-k)>Et)return!0}break;default:if((d==null?void 0:d.rValue)===void 0||Math.abs((d==null?void 0:d.rValue)-k)>Et)return!0}return!1},x=(k,D)=>{u(L=>{for(const j of L.elements)if(j.id===k){j.rValue=D;break}})},b=k=>{for(const[D,L]of k.entries())x(D,L)},R=(k,D)=>{for(const L of k.keys())x(L,D)},H=k=>{if(d&&w(k)){switch(r){case re.AllObjectsOfThisType:{const D=new Map;u(j=>{for(const B of j.elements)if(B.type===z.Foundation&&!B.locked){const O=B;D.set(B.id,O.rValue??i8),O.rValue=k}});const L={name:"Set R-Value for All Ground Floors",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{b(L.oldValues)},redo:()=>{R(L.oldValues,L.newValue)}};o(L),l(a+1);break}default:{if(d){const L=c(d.id).rValue??d.rValue??i8,j={name:"Set Ground Floor R-Value",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{x(j.changedElementId,j.oldValue)},redo:()=>{x(j.changedElementId,j.newValue)}};o(j),x(d.id,k),l(a+1)}break}}u(D=>{D.actionState.groundFloorRValue=k})}},F=(k,D)=>{if(v.current){const{clientWidth:L,clientHeight:j}=window.document.documentElement,B=v.current.getBoundingClientRect();P({left:-B.left+D.x,right:L-(B.right-D.x),top:-B.top+D.y,bottom:j-((B==null?void 0:B.bottom)-D.y)})}},E=()=>{p((d==null?void 0:d.rValue)??i8),t(!1)},N=()=>{E(),s()},U=()=>{H(f),t(!1),l(0)},W=()=>{H(f)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:[Y.t("word.RValue",T)+" ","(",Y.t("word.ThermalResistance",T),")"]}),footer:[h.jsx(io,{onClick:W,children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:N,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:U,children:Y.t("word.OK",T)},"OK")],onCancel:E,maskClosable:!1,destroyOnClose:!1,modalRender:k=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(D,L)=>F(D,L),children:h.jsx("div",{ref:v,children:k})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:k=>Number(k).toFixed(2),onChange:k=>{k!==null&&(p(k),A(me.toRValueInUS(k)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",T),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toRValueInUS(.01),max:me.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:g,formatter:k=>Number(k).toFixed(2),onChange:k=>{k!==null&&(A(k),p(me.toRValueInSI(k)))},onPressEnter:U}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [",me.toRValueInUS(.01).toFixed(3),", ",me.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",T),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:k=>i(k.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisGroundFloor",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllGroundFloors",T)})]})})})]})})})},Ndo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberHeight)??10),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberHeight=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberHeight=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberHeight===void 0||Math.abs(w.solarAbsorberPipe.absorberHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberHeight===void 0||Math.abs(w.solarAbsorberPipe.absorberHeight-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberHeight)===void 0||Math.abs((c==null?void 0:c.absorberHeight)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberHeight??10)}const w={name:"Set Absorber Height for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberHeight??10)}const w={name:"Set Absorber Height for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberHeight??10:c.absorberHeight??10;p(s.id,v);const x={name:"Set Absorber Height on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberHeight",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:50,style:{width:120},step:.5,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [1, 50] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Udo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.apertureWidth)??.6),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.apertureWidth=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.apertureWidth=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.apertureWidth===void 0||Math.abs(w.solarAbsorberPipe.apertureWidth-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.apertureWidth===void 0||Math.abs(w.solarAbsorberPipe.apertureWidth-v)>Et))return!0}break;default:if((c==null?void 0:c.apertureWidth)===void 0||Math.abs((c==null?void 0:c.apertureWidth)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.apertureWidth??.6)}const w={name:"Set Absorber Aperture Width for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.apertureWidth??.6)}const w={name:"Set Absorber Aperture Width for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.apertureWidth??.6:c.apertureWidth??.6;p(s.id,v);const x={name:"Set Absorber Aperture Width on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberApertureWidth",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0.1, 2] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},jdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.poleNumber)??5),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.poleNumber=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.poleNumber=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.poleNumber===void 0||w.solarAbsorberPipe.poleNumber!==v))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.poleNumber===void 0||w.solarAbsorberPipe.poleNumber!==v))return!0}break;default:if((c==null?void 0:c.poleNumber)===void 0||(c==null?void 0:c.poleNumber)!==v)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.poleNumber??5)}const w={name:"Set Absorber Pipe Pole Number for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.poleNumber??5)}const w={name:"Set Absorber Pipe Pole Number for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.poleNumber??5:c.poleNumber??5;p(s.id,v);const x={name:"Set Absorber Pipe Pole Number on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:1,precision:0,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [1, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Bdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberAbsorptance)??.95),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberAbsorptance=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberAbsorptance=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(w.solarAbsorberPipe.absorberAbsorptance-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberAbsorptance===void 0||Math.abs(w.solarAbsorberPipe.absorberAbsorptance-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberAbsorptance)===void 0||Math.abs((c==null?void 0:c.absorberAbsorptance)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberAbsorptance??.95)}const w={name:"Set Absorber Pipe Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberAbsorptance??.95)}const w={name:"Set Absorber Pipe Absorptance for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberAbsorptance??.95:c.absorberAbsorptance??.95;p(s.id,v);const x={name:"Set Absorber Pipe Absorptance on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Ydo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberOpticalEfficiency)??.7),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberOpticalEfficiency=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberOpticalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberOpticalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberOpticalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberOpticalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberOpticalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const w={name:"Set Absorber Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberOpticalEfficiency??.7)}const w={name:"Set Absorber Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberOpticalEfficiency??.7:c.absorberOpticalEfficiency??.7;p(s.id,v);const x={name:"Set Absorber Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Odo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarAbsorberPipe,[u,d]=m.useState((c==null?void 0:c.absorberThermalEfficiency)??.3),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusPipe&&(x.solarAbsorberPipe||(x.solarAbsorberPipe={}),x.solarAbsorberPipe.absorberThermalEfficiency=v)}})},A=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusPipe&&(b.solarAbsorberPipe||(b.solarAbsorberPipe={}),b.solarAbsorberPipe.absorberThermalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberThermalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusPipe&&w.solarAbsorberPipe&&(w.solarAbsorberPipe.absorberThermalEfficiency===void 0||Math.abs(w.solarAbsorberPipe.absorberThermalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.absorberThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.absorberThermalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberThermalEfficiency??.3)}const w={name:"Set Absorber Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarAbsorberPipe&&T.set(x.id,b.solarAbsorberPipe.absorberThermalEfficiency??.3)}const w={name:"Set Absorber Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarAbsorberPipe?T.solarAbsorberPipe.absorberThermalEfficiency??.3:c.absorberThermalEfficiency??.3;p(s.id,v);const x={name:"Set Absorber Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Vdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.towerHeight)??20),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.towerHeight=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerHeight=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerHeight===void 0||Math.abs(w.solarPowerTower.towerHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerHeight===void 0||Math.abs(w.solarPowerTower.towerHeight-v)>Et))return!0}break;default:if((c==null?void 0:c.towerHeight)===void 0||Math.abs((c==null?void 0:c.towerHeight)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerHeight??20)}const w={name:"Set Tower Height for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerHeight??20)}const w={name:"Set Tower Height for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.towerHeight??20:c.towerHeight??20;p(s.id,v);const x={name:"Set Tower Height on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverTowerHeight",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:10,max:500,style:{width:120},step:1,precision:1,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [10, 500] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},_do=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.towerRadius)??1),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.towerRadius=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.towerRadius=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerRadius===void 0||Math.abs(w.solarPowerTower.towerRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.towerRadius===void 0||Math.abs(w.solarPowerTower.towerRadius-v)>Et))return!0}break;default:if((c==null?void 0:c.towerRadius)===void 0||Math.abs((c==null?void 0:c.towerRadius)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerRadius??1)}const w={name:"Set Tower Radius for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.towerRadius??1)}const w={name:"Set Tower Radius for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.towerRadius??1:c.towerRadius??1;p(s.id,v);const x={name:"Set Tower Radius on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverTowerRadius",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.5,max:10,style:{width:120},step:.5,precision:1,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0.5, 10] ",Y.t("word.MeterAbbreviation",f)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",f)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Gdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverAbsorptance)??.95),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverAbsorptance=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverAbsorptance=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverAbsorptance===void 0||Math.abs(w.solarPowerTower.receiverAbsorptance-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverAbsorptance===void 0||Math.abs(w.solarPowerTower.receiverAbsorptance-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverAbsorptance)===void 0||Math.abs((c==null?void 0:c.receiverAbsorptance)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverAbsorptance??.95)}const w={name:"Set Receiver Absorptance for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverAbsorptance??.95)}const w={name:"Set Receiver Absorptance for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverAbsorptance??.95:c.receiverAbsorptance??.95;p(s.id,v);const x={name:"Set Receiver Absorptance on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarPowerTowerMenu.ReceiverAbsorptance",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Xdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverThermalEfficiency)??.3),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverThermalEfficiency=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverThermalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverThermalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverThermalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverThermalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverThermalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverThermalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverThermalEfficiency??.3)}const w={name:"Set Receiver Thermal Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverThermalEfficiency??.3)}const w={name:"Set Receiver Thermal Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverThermalEfficiency??.3:c.receiverThermalEfficiency??.3;p(s.id,v);const x={name:"Set Receiver Thermal Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("solarPowerTowerMenu.ReceiverThermalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Jdo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),c=s==null?void 0:s.solarPowerTower,[u,d]=m.useState((c==null?void 0:c.receiverOpticalEfficiency)??.7),f=$t(),p=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=T);break}})},g=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.FocusTower&&(x.solarPowerTower||(x.solarPowerTower={}),x.solarPowerTower.receiverOpticalEfficiency=v)}})},A=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.FocusTower&&(b.solarPowerTower||(b.solarPowerTower={}),b.solarPowerTower.receiverOpticalEfficiency=T)}})},y=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverOpticalEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.FocusTower&&w.solarPowerTower&&(w.solarPowerTower.receiverOpticalEfficiency===void 0||Math.abs(w.solarPowerTower.receiverOpticalEfficiency-v)>Et))return!0}break;default:if((c==null?void 0:c.receiverOpticalEfficiency)===void 0||Math.abs((c==null?void 0:c.receiverOpticalEfficiency)-v)>Et)return!0}return!1},S=v=>{if(!(!s||!c)&&y(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverOpticalEfficiency??.7)}const w={name:"Set Receiver Optical Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{A(w.oldValues,w.newValue)}};r(w),A(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarPowerTower&&T.set(x.id,b.solarPowerTower.receiverOpticalEfficiency??.7)}const w={name:"Set Receiver Optical Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())p(x,b)},redo:()=>{g(w.newValue)}};r(w),g(v),l(a+1);break}default:{const T=o(s.id),w=T&&T.solarPowerTower?T.solarPowerTower.receiverOpticalEfficiency??.7:c.receiverOpticalEfficiency??.7;p(s.id,v);const x={name:"Set Receiver Optical Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};r(x),l(a+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:500,title:Y.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:u,onChange:v=>{v!==null&&d(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",f)})]})})})]})})},Kdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyHeight)??Math.max((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0)),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.chimneyHeight=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyHeight=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyHeight===void 0||Math.abs(w.solarUpdraftTower.chimneyHeight-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyHeight===void 0||Math.abs(w.solarUpdraftTower.chimneyHeight-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyHeight===void 0||Math.abs(s.solarUpdraftTower.chimneyHeight-v)>Et))return!0}return!1},y=v=>{var T,w;if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation&&M.getState().selectedElementIdSet.has(R.id)){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((T=H.solarUpdraftTower)==null?void 0:T.chimneyHeight)??Math.max(H.lx,H.ly))}const b={name:"Set Solar Chimney Height for Selected Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{g(b.oldValues,b.newValue)}};r(b),g(x,v),l(a+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((w=H.solarUpdraftTower)==null?void 0:w.chimneyHeight)??Math.max(H.lx,H.ly))}const b={name:"Set Solar Chimney Height for All Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};r(b),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const x=o(s.id),b=x&&x.solarUpdraftTower?x.solarUpdraftTower.chimneyHeight??Math.max(x.lx,x.ly):s.solarUpdraftTower.chimneyHeight??Math.max(s.lx,s.ly);f(s.id,v);const R={name:"Set Solar Chimney Height on Foundation",timestamp:Date.now(),oldValue:b,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [1, 1000] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},qdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.chimneyRadius)??Math.max(1,.025*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.chimneyRadius=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.chimneyRadius=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyRadius===void 0||Math.abs(w.solarUpdraftTower.chimneyRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.chimneyRadius===void 0||Math.abs(w.solarUpdraftTower.chimneyRadius-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.chimneyRadius===void 0||Math.abs(s.solarUpdraftTower.chimneyRadius-v)>Et))return!0}return!1},y=v=>{var T,w;if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation&&M.getState().selectedElementIdSet.has(R.id)){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((T=H.solarUpdraftTower)==null?void 0:T.chimneyRadius)??Math.max(1,.025*Math.min(H.lx,H.ly)))}const b={name:"Set Solar Chimney Radius for Selected Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{g(b.oldValues,b.newValue)}};r(b),g(x,v),l(a+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)if(R.type===z.Foundation){const H=R;H.solarStructure===Dn.UpdraftTower&&H.solarUpdraftTower&&x.set(R.id,((w=H.solarUpdraftTower)==null?void 0:w.chimneyRadius)??Math.max(1,.025*Math.min(H.lx,H.ly)))}const b={name:"Set Solar Chimney Radius for All Foundations",timestamp:Date.now(),oldValues:x,newValue:v,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};r(b),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const x=o(s.id),b=x&&x.solarUpdraftTower?x.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(x.lx,x.ly)):s.solarUpdraftTower.chimneyRadius??Math.max(1,.025*Math.min(s.lx,s.ly));f(s.id,v);const R={name:"Set Solar Chimney Radius on Foundation",timestamp:Date.now(),oldValue:b,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(R.changedElementId,R.oldValue)},redo:()=>{f(R.changedElementId,R.newValue)}};r(R),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:10,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.1, 10] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},$do=({setDialogVisible:t})=>{var S;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=uo(z.Foundation),[l,s]=m.useState(((S=a==null?void 0:a.solarUpdraftTower)==null?void 0:S.collectorHeight)??Math.max(3,10*((a==null?void 0:a.lz)??0))),c=$t(),u=(C,P)=>{e(v=>{for(const T of v.elements)if(T.type===z.Foundation&&T.id===C&&!T.locked){const w=T;w.solarStructure===Dn.UpdraftTower&&(w.solarUpdraftTower||(w.solarUpdraftTower={}),w.solarUpdraftTower.collectorHeight=P);break}})},d=C=>{e(P=>{for(const v of P.elements)if(v.type===z.Foundation&&!v.locked){const T=v;T.solarStructure===Dn.UpdraftTower&&(T.solarUpdraftTower||(T.solarUpdraftTower={}),T.solarUpdraftTower.collectorHeight=C)}})},f=(C,P)=>{e(v=>{for(const T of v.elements)if(T.type===z.Foundation&&!T.locked&&C.has(T.id)){const w=T;w.solarStructure===Dn.UpdraftTower&&(w.solarUpdraftTower||(w.solarUpdraftTower={}),w.solarUpdraftTower.collectorHeight=P)}})},p=C=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked&&M.getState().selectedElementIdSet.has(P.id)){const v=P;if(v.solarStructure===Dn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorHeight===void 0||Math.abs(v.solarUpdraftTower.collectorHeight-C)>Et))return!0}break;case re.AllObjectsOfThisType:for(const P of n)if(P.type===z.Foundation&&!P.locked){const v=P;if(v.solarStructure===Dn.UpdraftTower&&v.solarUpdraftTower&&(v.solarUpdraftTower.collectorHeight===void 0||Math.abs(v.solarUpdraftTower.collectorHeight-C)>Et))return!0}break;default:if(a&&a.solarStructure===Dn.UpdraftTower&&a.solarUpdraftTower&&(a.solarUpdraftTower.collectorHeight===void 0||Math.abs(a.solarUpdraftTower.collectorHeight-C)>Et))return!0}return!1},g=C=>{if(a&&p(C))switch(i){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of n)if(T.type===z.Foundation&&M.getState().selectedElementIdSet.has(T.id)){const w=T;w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&P.set(T.id,w.solarUpdraftTower.collectorHeight??Math.max(3,10*w.lz))}const v={name:"Set Solar Collector Height for Selected Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())u(T,w)},redo:()=>{f(v.oldValues,v.newValue)}};r(v),f(P,C);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of n)if(T.type===z.Foundation){const w=T;w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&P.set(T.id,w.solarUpdraftTower.collectorHeight??Math.max(3,10*w.lz))}const v={name:"Set Solar Collector Height for All Foundations",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{for(const[T,w]of v.oldValues.entries())u(T,w)},redo:()=>{d(v.newValue)}};r(v),d(C);break}default:{if(a.solarStructure===Dn.UpdraftTower&&a.solarUpdraftTower){const P=o(a.id),v=P&&P.solarUpdraftTower?P.solarUpdraftTower.collectorHeight??Math.max(3,10*P.lz):a.solarUpdraftTower.collectorHeight??Math.max(3,10*a.lz);u(a.id,C);const T={name:"Set Solar Collector Height on Foundation",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:a.id,changedElementType:a.type,undo:()=>{u(T.changedElementId,T.oldValue)},redo:()=>{u(T.changedElementId,T.newValue)}};r(T)}break}}},A=()=>{t(!1)},y=()=>{g(l)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",c),onApply:y,onClose:A,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:20,style:{width:120},step:1,precision:1,value:l,onChange:C=>{C!==null&&s(C)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",c),": [0.1, 20] ",Y.t("word.MeterAbbreviation",c)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",c)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:C=>M.getState().setFoundationActionScope(C.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",c)})]})})})]})})},Qdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorRadius)??Math.max(10,.5*Math.min((s==null?void 0:s.lx)??0,(s==null?void 0:s.ly)??0))),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorRadius=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorRadius=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorRadius===void 0||Math.abs(w.solarUpdraftTower.collectorRadius-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorRadius===void 0||Math.abs(w.solarUpdraftTower.collectorRadius-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorRadius===void 0||Math.abs(s.solarUpdraftTower.collectorRadius-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(b.lx,b.ly)))}const w={name:"Set Solar Collector Radius for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(b.lx,b.ly)))}const w={name:"Set Solar Collector Radius for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(T.lx,T.ly)):s.solarUpdraftTower.collectorRadius??Math.max(10,.5*Math.min(s.lx,s.ly));f(s.id,v);const x={name:"Set Solar Collector Radius on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:1e3,style:{width:120},step:1,precision:1,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [1, 1000] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},Zdo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorTransmissivity)??.9),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorTransmissivity=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorTransmissivity=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorTransmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorTransmissivity-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorTransmissivity??.9)}const w={name:"Set Solar Collector Transmissivity for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorTransmissivity??.9)}const w={name:"Set Solar Collector Transmissivity for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorTransmissivity??.9:s.solarUpdraftTower.collectorTransmissivity??.9;f(s.id,v);const x={name:"Set Solar Collector Transmissivity on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},efo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.collectorEmissivity)??.95),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.collectorEmissivity=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.collectorEmissivity=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(w.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.collectorEmissivity===void 0||Math.abs(s.solarUpdraftTower.collectorEmissivity-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorEmissivity??.95)}const w={name:"Set Solar Collector Emissivity for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.collectorEmissivity??.95)}const w={name:"Set Solar Collector Emissivity for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.collectorEmissivity??.95:s.solarUpdraftTower.collectorEmissivity??.95;f(s.id,v);const x={name:"Set Solar Collector Emissivity on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},tfo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.dischargeCoefficient)??.65),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.dischargeCoefficient=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.dischargeCoefficient=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(w.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(w.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.dischargeCoefficient===void 0||Math.abs(s.solarUpdraftTower.dischargeCoefficient-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.dischargeCoefficient??.65)}const w={name:"Set Solar Chimney Discharge Coefficient for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.dischargeCoefficient??.65)}const w={name:"Set Solar Chimney Discharge Coefficient for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.dischargeCoefficient??.65:s.solarUpdraftTower.dischargeCoefficient??.65;f(s.id,v);const x={name:"Set Solar Chimney Discharge Coefficient on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.65,max:.7,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.65, 0.70]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},nfo=({setDialogVisible:t})=>{var P;const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M($s),a=M(no),l=M(Qn),s=uo(z.Foundation),[c,u]=m.useState(((P=s==null?void 0:s.solarUpdraftTower)==null?void 0:P.turbineEfficiency)??.3),d=$t(),f=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&x.id===v&&!x.locked){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=T);break}})},p=v=>{e(T=>{for(const w of T.elements)if(w.type===z.Foundation&&!w.locked){const x=w;x.solarStructure===Dn.UpdraftTower&&(x.solarUpdraftTower||(x.solarUpdraftTower={}),x.solarUpdraftTower.turbineEfficiency=v)}})},g=(v,T)=>{e(w=>{for(const x of w.elements)if(x.type===z.Foundation&&!x.locked&&v.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&(b.solarUpdraftTower||(b.solarUpdraftTower={}),b.solarUpdraftTower.turbineEfficiency=T)}})},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(w.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}break;case re.AllObjectsOfThisType:for(const T of n)if(T.type===z.Foundation&&!T.locked){const w=T;if(w.solarStructure===Dn.UpdraftTower&&w.solarUpdraftTower&&(w.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(w.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}break;default:if(s&&s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower&&(s.solarUpdraftTower.turbineEfficiency===void 0||Math.abs(s.solarUpdraftTower.turbineEfficiency-v)>Et))return!0}return!1},y=v=>{if(s&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation&&M.getState().selectedElementIdSet.has(x.id)){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.turbineEfficiency??.3)}const w={name:"Set Solar Updraft Tower Turbine Efficiency for Selected Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{g(w.oldValues,w.newValue)}};r(w),g(T,v),l(a+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of n)if(x.type===z.Foundation){const b=x;b.solarStructure===Dn.UpdraftTower&&b.solarUpdraftTower&&T.set(x.id,b.solarUpdraftTower.turbineEfficiency??.3)}const w={name:"Set Solar Updraft Tower Turbine Efficiency for All Foundations",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())f(x,b)},redo:()=>{p(w.newValue)}};r(w),p(v),l(a+1);break}default:{if(s.solarStructure===Dn.UpdraftTower&&s.solarUpdraftTower){const T=o(s.id),w=T&&T.solarUpdraftTower?T.solarUpdraftTower.turbineEfficiency??.3:s.solarUpdraftTower.turbineEfficiency??.3;f(s.id,v);const x={name:"Set Solar Updraft Tower Turbine Efficiency on Foundation",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(x.changedElementId,x.oldValue)},redo:()=>{f(x.changedElementId,x.newValue)}};r(x),l(a+1)}break}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:540,title:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.2,max:1,style:{width:120},step:.01,precision:2,value:c,onChange:v=>{v!==null&&u(v)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.2, 1.0]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",marginLeft:"16px",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>M.getState().setFoundationActionScope(v.target.value),value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("foundationMenu.OnlyThisFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("foundationMenu.AllSelectedFoundations",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("foundationMenu.AllFoundations",d)})]})})})]})})},{Option:QT}=Uo,ofo=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=M(bA).geneticAlgorithmParams,p=m.useRef(f.selectionMethod),g=m.useRef(f.searchMethod),A=m.useRef(Math.min(f.objectiveFunctionType,Po.YEARLY_TOTAL_OUTPUT)),y=m.useRef(f.populationSize),S=m.useRef(f.maximumGenerations),C=m.useRef(f.mutationRate),P=m.useRef(f.selectionRate??.5),v=m.useRef(f.crossoverRate??.5),T=m.useRef(f.convergenceThreshold),w=m.useRef(f.localSearchRadius),x=m.useRef(null);m.useEffect(()=>{var N;(N=x.current)==null||N.focus()},[]);const b={lng:o},R=(N,U)=>{if(d.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=d.current.getBoundingClientRect();u({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{e(N=>{N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=A.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=p.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=g.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=y.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=S.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=P.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=v.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=C.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=T.current,N.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=w.current})},F=()=>{r||gn(E("message.EvolutionStarted",b)),H(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=_s.GENETIC_ALGORITHM,N.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Genetic Algorithm for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:E}=Xl();return h.jsx(h.Fragment,{children:h.jsxs(yi,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:[E("optimizationMenu.SolarPanelTiltAngleOptimization",b)+": ",E("optimizationMenu.GeneticAlgorithmSettings",b)]}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:E("word.Cancel",b)},"Cancel"),h.jsx(io,{type:"primary",ref:x,onClick:()=>{F(),t(!1)},children:E("word.Run",b)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:d,children:N})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.Objective",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:A.current,style:{width:"100%"},value:A.current,onChange:N=>{A.current=N,a(!i)},children:[h.jsx(QT,{value:Po.DAILY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionDailyTotalYield",b)},Po.DAILY_TOTAL_OUTPUT),h.jsx(QT,{value:Po.YEARLY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionYearlyTotalYield",b)},Po.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.GeneticAlgorithmSelectionMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,a(!i)},children:[h.jsx(QT,{value:Wm.ROULETTE_WHEEL,children:E("optimizationMenu.RouletteWheel",b)},Wm.ROULETTE_WHEEL),h.jsx(QT,{value:Wm.TOURNAMENT,children:E("optimizationMenu.Tournament",b)},Wm.TOURNAMENT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.PopulationSize",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:y.current,step:1,onChange:N=>{N!==null&&(y.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumGenerations",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,formatter:N=>Number(N).toFixed(0),value:S.current,onChange:N=>{N!==null&&(S.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SelectionRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{N!==null&&(P.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.CrossoverRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{N!==null&&(v.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MutationRate",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{N!==null&&(C.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.ConvergenceThreshold",b)+" [0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:T.current,step:.001,onChange:N=>{N!==null&&(T.current=Number(N),a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SearchMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:g.current,style:{width:"100%"},value:g.current,onChange:N=>{g.current=Number(N),a(!i)},children:[h.jsx(QT,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:E("optimizationMenu.GlobalSearchUniformSelection",b)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(QT,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:E("optimizationMenu.LocalSearchRandomOptimization",b)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),g.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.LocalSearchRadius",b)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:w.current,step:.01,onChange:N=>{N!==null&&(w.current=Number(N),a(!i))}})})]})]})})},{Option:OO}=Uo,rfo=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(bA).particleSwarmOptimizationParams,[a,l]=m.useState(!1),[s,c]=m.useState(!1),[u,d]=m.useState({left:0,top:0,bottom:0,right:0}),f=m.useRef(null),p=m.useRef(Math.min(i.objectiveFunctionType,Po.YEARLY_TOTAL_OUTPUT)),g=m.useRef(i.searchMethod),A=m.useRef(i.swarmSize),y=m.useRef(i.maximumSteps),S=m.useRef(i.vmax??.01),C=m.useRef(i.inertia??.8),P=m.useRef(i.cognitiveCoefficient??.1),v=m.useRef(i.socialCoefficient??.1),T=m.useRef(i.convergenceThreshold),w=m.useRef(i.localSearchRadius),x=m.useRef(null);m.useEffect(()=>{var N;(N=x.current)==null||N.focus()},[]);const b={lng:o},R=(N,U)=>{if(f.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=f.current.getBoundingClientRect();d({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{e(N=>{N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=p.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=g.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=A.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=y.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=P.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=v.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=S.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=C.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=T.current,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=w.current})},F=()=>{r||gn(E("message.EvolutionStarted",b)),H(),setTimeout(()=>{dt.getState().set(N=>{N.runEvolution=!N.runEvolution}),e(N=>{N.evolutionMethod=_s.PARTICLE_SWARM_OPTIMIZATION,N.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_TILT_ANGLE,n&&(N.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Tilt Angle",timestamp:new Date().getTime()})})},100)},{t:E}=Xl();return h.jsx(h.Fragment,{children:h.jsxs(yi,{width:640,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>c(!0),onMouseOut:()=>c(!1),children:[E("optimizationMenu.SolarPanelTiltAngleOptimization",b)+": ",E("optimizationMenu.ParticleSwarmOptimizationSettings",b)]}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:E("word.Cancel",b)},"Cancel"),h.jsx(io,{type:"primary",ref:x,onClick:()=>{F(),t(!1)},children:E("word.Run",b)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:N=>h.jsx(Bi,{disabled:!s,bounds:u,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:f,children:N})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.Objective",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:p.current,style:{width:"100%"},value:p.current,onChange:N=>{p.current=N,l(!a)},children:[h.jsx(OO,{value:Po.DAILY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionDailyTotalYield",b)},Po.DAILY_TOTAL_OUTPUT),h.jsx(OO,{value:Po.YEARLY_TOTAL_OUTPUT,children:E("optimizationMenu.ObjectiveFunctionYearlyTotalYield",b)},Po.YEARLY_TOTAL_OUTPUT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SwarmSize",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:A.current,step:1,formatter:N=>Number(N).toFixed(0),onChange:N=>{A.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumSteps",b)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:y.current,formatter:N=>Number(N).toFixed(0),onChange:N=>{y.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.CognitiveCoefficient",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:P.current,step:.01,onChange:N=>{P.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SocialCoefficient",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:v.current,step:.01,onChange:N=>{v.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.InertiaWeight",b)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:C.current,step:.01,onChange:N=>{C.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.MaximumVelocity",b)+" [0.001, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:S.current,step:.001,onChange:N=>{S.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.ConvergenceThreshold",b)+" [0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:T.current,step:.001,onChange:N=>{T.current=Number(N),l(!a)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.SearchMethod",b)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:g.current,style:{width:"100%"},value:g.current,onChange:N=>{g.current=Number(N),l(!a)},children:[h.jsx(OO,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:E("optimizationMenu.GlobalSearchUniformSelection",b)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(OO,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:E("optimizationMenu.LocalSearchRandomOptimization",b)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),g.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:E("optimizationMenu.LocalSearchRadius",b)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:w.current,step:.01,onChange:N=>{w.current=Number(N),l(!a)}})})]})]})})},hy=({children:t,width:e="90px"})=>h.jsx("div",{style:{width:e},children:t}),ifo=({element:t})=>{const e=aot(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!(t!=null&&t.showLabel),onChange:e,children:Y.t("labelSubMenu.KeepShowingLabel",n)})})},afo=({element:t})=>{const{labelText:e,setLabelText:n}=iot(t),o=lot(t,e),r=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelText",r)+":"}),value:e,onChange:i=>n(i.target.value),onPressEnter:o,onBlur:o})})},lfo=({element:t})=>{const e=EXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelHeight",n)+":"}),min:t.lz/2+.2,max:100,step:1,precision:1,value:t.labelHeight??t.lz/2+.2,onChange:o=>e(o)})})},sfo=({element:t})=>{const e=IXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelFontSize",n)+":"}),min:10,max:100,step:1,precision:0,value:t.labelFontSize??20,onChange:o=>e(o)})})},cfo=({element:t})=>{const e=zXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelSize",n)+":"}),min:.2,max:5,step:.1,precision:1,value:t.labelSize??.2,onChange:o=>e(o)})})},ufo=({element:t})=>{const e=DXn(t),n=$t();return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsx(hy,{children:Y.t("labelSubMenu.LabelColor",n)+":"}),value:t.labelColor??"#ffffff",onChange:o=>e(o.target.value)})})},v3=t=>[{key:`${t.type}-show-label`,label:h.jsx(ifo,{element:t})},{key:`${t.type}-label-text`,label:h.jsx(afo,{element:t})},{key:`${t.type}-label-height`,label:h.jsx(lfo,{element:t})},{key:`${t.type}-label-font-size`,label:h.jsx(sfo,{element:t})},{key:`${t.type}-label-size`,label:h.jsx(cfo,{element:t})},{key:`${t.type}-label-color`,label:h.jsx(ufo,{element:t})}],dfo=[{key:"windowCount",objectType:z.Window},{key:"doorCount",objectType:z.Door},{key:"sensorCount",objectType:z.Sensor},{key:"outsideLightCount",objectType:z.Light},{key:"parabolicTroughCount",objectType:z.ParabolicTrough},{key:"parabolicDishCount",objectType:z.ParabolicDish},{key:"fresnelReflectorCount",objectType:z.FresnelReflector},{key:"heliostatCount",objectType:z.Heliostat},{key:"windTurbineCount",objectType:z.WindTurbine},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower}],IHe=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.Wall:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWalls",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWallsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Walls",n)})`;break}case z.Window:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWindowsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Windows",n)})`;break}case z.Door:{o=`${Y.t("foundationMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllDoorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Doors",n)})`;break}case z.Sensor:{o=`${Y.t("foundationMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllSensorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("foundationMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllLightsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Lights",n)})`;break}case z.ParabolicTrough:{o=`${Y.t("foundationMenu.RemoveAllUnlockedParabolicTroughs",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicTroughsOnFoundation",n)} (${e} ${Y.t("foundationMenu.ParabolicTroughs",n)})`;break}case z.ParabolicDish:{o=`${Y.t("foundationMenu.RemoveAllUnlockedParabolicDishes",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllParabolicDishesOnFoundation",n)} (${e} ${Y.t("foundationMenu.ParabolicDishes",n)})`;break}case z.FresnelReflector:{o=`${Y.t("foundationMenu.RemoveAllUnlockedFresnelReflectors",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllFresnelReflectorsOnFoundation",n)} (${e} ${Y.t("foundationMenu.FresnelReflectors",n)})`;break}case z.Heliostat:{o=`${Y.t("foundationMenu.RemoveAllUnlockedHeliostats",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllHeliostatsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Heliostats",n)})`;break}case z.WindTurbine:{o=`${Y.t("foundationMenu.RemoveAllUnlockedWindTurbines",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllWindTurbinesOnFoundation",n)} (${e} ${Y.t("foundationMenu.WindTurbines",n)})`;break}case z.Polygon:{o=`${Y.t("foundationMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllPolygonsOnFoundation",n)} (${e} ${Y.t("foundationMenu.Polygons",n)})`;break}case z.Human:{o=`${Y.t("foundationMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllHumansOnFoundation",n)} (${e} ${Y.t("foundationMenu.Humans",n)})`;break}case z.Tree:{o=`${Y.t("foundationMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllTreesOnFoundation",n)} (${e} ${Y.t("foundationMenu.Trees",n)})`;break}case z.Flower:{o=`${Y.t("foundationMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${Y.t("foundationMenu.DoYouReallyWantToRemoveAllFlowersOnFoundation",n)} (${e} ${Y.t("foundationMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},ffo=(t,e,n)=>n===z.Light?t.insideLightCount+t.outsideLightCount:t[e],hfo=t=>{const e=M.getState().set,n=new Set;M.getState().elements.forEach(a=>{!a.locked&&a.type===z.Wall&&(a.parentId===t.id||a.foundationId===t.id)&&n.add(a.id)});const o=M.getState().elements.filter(a=>n.has(a.id)||n.has(a.parentId));e(a=>{a.elements=a.elements.filter(l=>!n.has(l.id)&&!n.has(l.parentId))});const r=JSON.parse(JSON.stringify(o)),i={name:"Remove All Walls on Foundation",timestamp:Date.now(),parentId:t.id,removedElements:r,undo:()=>{e(a=>{a.elements.push(...i.removedElements),a.updateWallMapOnFoundationFlag=!a.updateWallMapOnFoundationFlag})},redo:()=>{const a=new Set;M.getState().elements.forEach(l=>{!l.locked&&l.type===z.Wall&&l.parentId===i.parentId&&a.add(l.id)}),e(l=>{l.elements=l.elements.filter(s=>!a.has(s.id)&&!a.has(s.parentId))})}};M.getState().addUndoable(i)},pfo=(t,e,n)=>{const o=[],r={lng:M.getState().language};if(e.unlockedCount>0&&o.push({key:"lock-all-offsprings",label:h.jsx(qCe,{foundation:t,lock:!0,count:e.unlockedCount})}),e.lockedCount>0&&o.push({key:"unlock-all-offsprings",label:h.jsx(qCe,{foundation:t,lock:!1,count:e.lockedCount})}),n.wallCount>0){const{itemLabel:i,modalTitle:a}=IHe(z.Wall,n.wallCount);o.push({key:"remove-all-walls-on-foundation",label:h.jsx(Dae,{foundation:t,objectType:z.Wall,modalTitle:a,onClickOk:()=>hfo(t),children:i})})}if(n.solarPanelCount>0){const i=Y.t("foundationMenu.DoYouReallyWantToRemoveAllSolarPanelsOnFoundation",r)+" ("+n.solarPanelModuleCount+" "+Y.t("foundationMenu.SolarPanels",r)+", "+n.solarPanelCount+" "+Y.t("foundationMenu.Racks",r)+")?";o.push({key:"remove-all-solar-panels-on-foundation",label:h.jsxs(Dae,{foundation:t,objectType:z.SolarPanel,modalTitle:i,children:[Y.t("foundationMenu.RemoveAllUnlockedSolarPanels",r),"  (",n.solarPanelModuleCount," ",Y.t("foundationMenu.SolarPanels",r),", ",n.solarPanelCount," ",Y.t("foundationMenu.Racks",r),")"]})})}return dfo.forEach(({key:i,objectType:a})=>{const l=ffo(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=IHe(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-foundation`,label:h.jsx(Dae,{foundation:t,objectType:a,modalTitle:c,children:s})})}}),o},gfo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.Light||e.type===z.SolarPanel||e.type===z.SolarWaterHeater||e.type===z.ParabolicDish||e.type===z.Heliostat||e.type===z.FresnelReflector||e.type===z.ParabolicTrough||e.type===z.WindTurbine||e.type===z.Wall)return!0}return!1},mfo=t=>{const e=[];if(t.type!==z.Foundation)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked,i=!n.notBuilding&&me.getBuildingCompletionStatus(n,M.getState().elements)===Uc.COMPLETE,a=M.getState().countAllOffspringsByTypeAtOnce(n.id,!0),l=M.getState().countAllOffspringsByTypeAtOnce(n.id,!1);return gfo()&&e.push({key:"foundation-paste",label:h.jsx(oM,{})}),e.push({key:"foundation-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"foundation-cut",label:h.jsx(kd,{})}),e.push({key:"foundation-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"foundation-group-master",label:h.jsx(LQe,{groupableElement:n})}),e.push({key:"building",label:h.jsx(TXn,{foundation:n})}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-foundation",label:h.jsx(an,{children:Y.t("word.Elements",o)}),children:pfo(n,a,l)}),r&&((!n.textureType||n.textureType===_i.NoTexture)&&e.push({key:"foundation-color",label:h.jsxs(eo,{Dialog:Ddo,children:[Y.t("word.Color",o)," ..."]})}),e.push({key:"foundation-texture",label:h.jsxs(eo,{Dialog:FXn,children:[Y.t("word.Texture",o)," ..."]})}),e.push({key:"foundation-length",label:h.jsxs(eo,{Dialog:Edo,children:[Y.t("word.Length",o)," ..."]})}),e.push({key:"foundation-width",label:h.jsxs(eo,{Dialog:Fdo,children:[Y.t("word.Width",o)," ..."]})}),e.push({key:"foundation-height",label:h.jsxs(eo,{Dialog:kdo,children:[Y.t("word.Height",o)," ..."]})}),e.push({key:"foundation-azimuth",label:h.jsxs(eo,{Dialog:Ldo,children:[Y.t("word.Azimuth",o)," ..."]})}),i&&e.push({key:"ground-floor-r-value",label:h.jsxs(eo,{Dialog:Wdo,children:[Y.t("foundationMenu.GroundFloorRValue",o)," ..."]})})),e.push({key:"add-polygon-on-foundation",label:h.jsx(PXn,{foundation:n})}),!n.notBuilding&&a.wallCount>0&&e.push({key:"building-hvac-system",label:h.jsx(an,{children:Y.t("word.BuildingHVACSystem",o)}),children:[{key:"hvac-system-id",label:h.jsx(CXn,{foundation:n})},{key:"thermostat-temperature",label:h.jsx(RXn,{foundation:n})},{key:"tolerance-threshold",label:h.jsx(HXn,{foundation:n})}]}),r&&(e.push({key:"select-solar-structure",label:h.jsx(an,{children:Y.t("foundationMenu.SolarStructure",o)}),children:[{key:"select-solar-structure-submenu",label:h.jsx(MXn,{foundation:n}),style:{backgroundColor:"white"}}]}),n.solarStructure===Dn.FocusPipe&&e.push({key:"solar-absorber-pipe-physical-properties",label:h.jsx(an,{children:Y.t("solarAbsorberPipeMenu.AbsorberPipePhysicalProperties",o)}),children:[{key:"solar-absorber-pipe-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Ndo,children:[Y.t("solarAbsorberPipeMenu.AbsorberHeight",o)," ..."]})},{key:"solar-absorber-pipe-aperture-width",label:h.jsxs(eo,{noPadding:!0,Dialog:Udo,children:[Y.t("solarAbsorberPipeMenu.AbsorberApertureWidth",o)," ..."]})},{key:"foundation-solar-receiver-pipe-pole-number",label:h.jsxs(eo,{noPadding:!0,Dialog:jdo,children:[Y.t("solarAbsorberPipeMenu.AbsorberPipePoleNumber",o)," ..."]})},{key:"solar-absorber-pipe-absorptance",label:h.jsxs(eo,{noPadding:!0,Dialog:Bdo,children:[Y.t("solarAbsorberPipeMenu.AbsorberAbsorptance",o)," ..."]})},{key:"solar-absorber-optical-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Ydo,children:[Y.t("solarAbsorberPipeMenu.AbsorberOpticalEfficiency",o)," ..."]})},{key:"solar-absorber-thermal-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Odo,children:[Y.t("solarAbsorberPipeMenu.AbsorberThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Dn.FocusTower&&e.push({key:"solar-power-tower-physical-properties",label:h.jsx(an,{children:Y.t("solarPowerTowerMenu.ReceiverTowerPhysicalProperties",o)}),children:[{key:"solar-power-tower-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Vdo,children:[Y.t("solarPowerTowerMenu.ReceiverTowerHeight",o)," ..."]})},{key:"solar-power-tower-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:_do,children:[Y.t("solarPowerTowerMenu.ReceiverTowerRadius",o)," ..."]})},{key:"solar-power-tower-receiver-absorptance",label:h.jsxs(eo,{noPadding:!0,Dialog:Gdo,children:[Y.t("solarPowerTowerMenu.ReceiverAbsorptance",o)," ..."]})},{key:"solar-power-tower-receiver-optical-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Jdo,children:[Y.t("solarPowerTowerMenu.ReceiverOpticalEfficiency",o)," ..."]})},{key:"solar-power-tower-receiver-thermal-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:Xdo,children:[Y.t("solarPowerTowerMenu.ReceiverThermalEfficiency",o)," ..."]})}]}),n.solarStructure===Dn.UpdraftTower&&e.push({key:"solar-updraft-tower-physical-properties",label:h.jsx(an,{children:Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerPhysicalProperties",o)}),children:[{key:"solar-updraft-tower-chimney-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Kdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyHeight",o)," ..."]})},{key:"solar-updraft-tower-chimney-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:qdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerChimneyRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-height",label:h.jsxs(eo,{noPadding:!0,Dialog:$do,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorHeight",o)," ..."]})},{key:"solar-updraft-tower-collector-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:Qdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorRadius",o)," ..."]})},{key:"solar-updraft-tower-collector-transmissivity",label:h.jsxs(eo,{noPadding:!0,Dialog:Zdo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorTransmissivity",o)," ..."]})},{key:"solar-updraft-tower-collector-emissivity",label:h.jsxs(eo,{noPadding:!0,Dialog:efo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerCollectorEmissivity",o)," ..."]})},{key:"solar-updraft-tower-discharge-coefficient",label:h.jsxs(eo,{noPadding:!0,Dialog:tfo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerDischargeCoefficient",o)," ..."]})},{key:"solar-updraft-tower-turbine-efficiency",label:h.jsxs(eo,{noPadding:!0,Dialog:nfo,children:[Y.t("solarUpdraftTowerMenu.SolarUpdraftTowerTurbineEfficiency",o)," ..."]})}]})),e.push({key:"optimization",label:h.jsx(an,{children:Y.t("optimizationMenu.Optimization",o)}),children:[{key:"genetic-algorithms",label:h.jsx(an,{noPadding:!0,children:Y.t("optimizationMenu.GeneticAlgorithm",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-ga-optimizer",label:h.jsxs(eo,{noPadding:!0,Dialog:ofo,children:[Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]},{key:"particle-swarm-optimization",label:h.jsx(an,{noPadding:!0,children:Y.t("optimizationMenu.ParticleSwarmOptimization",o)}),disabled:l.solarPanelCount===0,children:[{key:"solar-panel-tilt-angle-pso-optimizer",label:h.jsxs(eo,{noPadding:!0,Dialog:rfo,children:[Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",o),"..."]})}]}]}),r&&e.push({key:"foundation-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},yfo=be.memo(({cuboid:t})=>{const e=$t(),n=()=>{M.getState().set(o=>{for(const r of o.elements)if(r.id===t.id&&r.type===z.Cuboid){const i=r,a=!i.stackable;i.stackable=a,o.actionState.cuboidStackable=a;break}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.stackable,onChange:n,children:Y.t("cuboidMenu.Stackable",e)})})}),Afo=be.memo(({cuboid:t,selectedSideIndex:e})=>{const n=$t(),o=M.getState().set,r=()=>{o(c=>{c.objectTypeToAdd=z.Polygon});const{pos:i}=me.getWorldDataById(t.id);let a;switch(e){case 0:a=Op;break;case 1:a=Vp;break;case 2:a=Yc;break;case 3:a=_p;break;default:a=ko,i.z=t.lz}const l=M.getState().addElement(t,i,a),s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{M.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{o(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};M.getState().addUndoable(s),o(c=>{c.objectTypeToAdd=z.None})};return h.jsx(an,{onClick:r,children:Y.t("cuboidMenu.AddPolygon",n)})}),zHe=be.memo(({cuboid:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Cuboid`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{noPadding:!0,onClick:l,children:r})}),wfo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Eb),i=M(Fb),a=M(sYe),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState((c==null?void 0:c.color)??"#808080"),[f,p]=m.useState(!1),g=$t();m.useEffect(()=>{P()},[c,a]);const A=(R,H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.Cuboid&&N.id===H&&!N.locked){const U=N;U.faceColors||(U.faceColors=new Array(6),U.faceColors.fill(U.color??F)),U.faceColors[R]=F;break}})},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.Cuboid&&E.id===R&&!E.locked){E.color=H;const N=E;N.faceColors||(N.faceColors=new Array(6));for(let U=0;U<4;U++)N.faceColors[U]=H;break}})},S=R=>{e(H=>{for(const F of H.elements)if(F.type===z.Cuboid&&!F.locked){F.color=R;const E=F;E.faceColors||(E.faceColors=new Array(6));for(let N=0;N<4;N++)E.faceColors[N]=R}})},C=R=>{i(R.target.value),p(!f)},P=()=>{c&&(a>=0&&c.faceColors?d(c.faceColors[a]):d(c.color??"#808080"))},v=R=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Cuboid&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)){const F=H;if(F.faceColors){for(let E=0;E<4;E++)if(R!==F.faceColors[E])return!0}else if(R!==F.color)return!0}break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Cuboid&&!H.locked){const F=H;if(F.faceColors){for(let E=0;E<4;E++)if(R!==F.faceColors[E])return!0}else if(R!==F.color)return!0}break;case re.OnlyThisObject:if(c.faceColors){for(let H=0;H<4;H++)if(R!==c.faceColors[H])return!0}else if(R!==(c==null?void 0:c.color))return!0;break;default:if(a>=0){const H=c!=null&&c.faceColors?c==null?void 0:c.faceColors[a]:c==null?void 0:c.color;if(R!==H)return!0}else if(R!==(c==null?void 0:c.color))return!0}return!1}},T=R=>{if(c&&v(R)){switch(r){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)if(E.type===z.Cuboid&&M.getState().selectedElementIdSet.has(E.id)){const N=E;if(N.faceColors)H.set(E.id,[...N.faceColors]);else{const U=N.color??"#808080";H.set(E.id,[U,U,U,U,U,U])}}const F={name:"Set Color for Selected Cuboids",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)if(E.type===z.Cuboid){const N=E;if(N.faceColors)H.set(E.id,[...N.faceColors]);else{const U=N.color??"#808080";H.set(E.id,[U,U,U,U,U,U])}}const F={name:"Set Color for All Cuboids",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())if(N&&Array.isArray(N))for(let U=0;U{S(F.newValue)}};o(F),S(R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}case re.OnlyThisObject:{let H;if(c.faceColors)H=[...c.faceColors];else{const E=c.color??"#808080";H=[E,E,E,E,E,E]}const F={name:"Set Color for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(F.oldValue&&Array.isArray(F.oldValue))for(let E=0;E{y(F.changedElementId,F.newValue)}};o(F),y(c.id,R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]);for(let N=0;N<4;N++)E.actionState.cuboidFaceColors[N]=R});break}default:{if(a>=0){const H=c.faceColors?c.faceColors[a]:c.color,F={name:"Set Color for Selected Side of Cuboid",timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{F.changedSideIndex!==void 0&&A(F.changedSideIndex,F.changedElementId,F.oldValue)},redo:()=>{F.changedSideIndex!==void 0&&A(F.changedSideIndex,F.changedElementId,F.newValue)}};o(F),A(a,c.id,R),s(l+1),e(E=>{E.actionState.cuboidFaceColors||(E.actionState.cuboidFaceColors=["#808080","#808080","#808080","#808080","#808080","#808080"]),E.actionState.cuboidFaceColors[a]=R})}break}}p(!f)}},w=()=>{P(),t(!1)},x=()=>{T(u),t(!1),s(0)},b=a>=0&&(c!=null&&c.faceColors)?c.faceColors[a]:(c==null?void 0:c.color)??"#808080";return h.jsx(so,{width:600,title:Y.t("word.Color",g),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:u??b,onChangeComplete:R=>{d(R.hex),p(!f)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:C,value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("cuboidMenu.OnlyThisSide",g)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.AllSidesOfThisCuboid",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfSelectedCuboids",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfAllCuboids",g)})]})})})]})})},vfo="/aladdin/assets/building_facade_01_menu-BAm4EVGn.png",xfo="/aladdin/assets/building_facade_02_menu-BylQ9E0j.png",bfo="/aladdin/assets/building_facade_03_menu-DfU_cdlP.png",Sfo="/aladdin/assets/building_facade_04_menu-Bz2bcbq0.png",Tfo="/aladdin/assets/building_facade_05_menu-hF6OsAF0.png",Pfo="/aladdin/assets/building_facade_06_menu-CUmtyI19.png",Cfo="/aladdin/assets/building_facade_07_menu-B8_DYqYz.png",Rfo="/aladdin/assets/building_facade_08_menu-CTA_rxim.png",Hfo="/aladdin/assets/building_facade_09_menu-BpQDoLbY.png",Mfo="/aladdin/assets/building_facade_10_menu-z_jZrQMT.png",Ifo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Eb),i=M(Fb),a=M(sYe),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState(c&&c.textureTypes&&a>=0?c.textureTypes[a]:Ro.NoTexture),f=$t(),{Option:p}=Uo;m.useEffect(()=>{c&&d(c.textureTypes&&a>=0?c.textureTypes[a]:Ro.NoTexture)},[c,a]);const g=(x,b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.Cuboid&&F.id===b&&!F.locked){const E=F;E.textureTypes||(E.textureTypes=new Array(6),E.textureTypes.fill(Ro.NoTexture)),E.textureTypes[x]=R;break}})},A=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.Cuboid&&H.id===x&&!H.locked){const F=H;F.textureTypes||(F.textureTypes=new Array(6),F.textureTypes.fill(Ro.NoTexture));for(let E=0;E<4;E++)F.textureTypes[E]=b;break}})},y=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.Cuboid&&!H.locked&&x.has(H.id)){const F=H;if(F.textureTypes||(F.textureTypes=new Array(6),F.textureTypes.fill(Ro.NoTexture)),b!==void 0)for(let E=0;E<4;E++)F.textureTypes[E]=b;else{const E=x.get(H.id);if(E&&E.length>=4)for(let N=0;N<4;N++)F.textureTypes[N]=E[N]}}})},S=x=>{e(b=>{for(const R of b.elements)if(R.type===z.Cuboid&&!R.locked){const H=R;H.textureTypes||(H.textureTypes=new Array(6),H.textureTypes.fill(Ro.NoTexture));for(let F=0;F<4;F++)H.textureTypes[F]=x}})},C=x=>{i(x.target.value)},P=x=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Cuboid&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;if(R.textureTypes){for(let H=0;H<4;H++)if(x!==R.textureTypes[H])return!0}}break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.Cuboid&&!b.locked){const R=b;if(R.textureTypes){for(let H=0;H<4;H++)if(x!==R.textureTypes[H])return!0}}break;case re.OnlyThisObject:if(c.textureTypes){for(let b=0;b<4;b++)if(x!==c.textureTypes[b])return!0}break;default:if(a>=0&&c.textureTypes&&x!==c.textureTypes[a])return!0}return!1}},v=x=>{if(c&&P(x))switch(r){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)if(H.type===z.Cuboid&&M.getState().selectedElementIdSet.has(H.id)){const F=H;b.set(H.id,F.textureTypes?[...F.textureTypes]:void 0)}const R={name:"Set Texture for Selected Cuboids",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())if(F&&Array.isArray(F))for(let E=0;E{y(R.oldValues,R.newValue)}};o(R),y(b,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)if(H.type===z.Cuboid){const F=H;b.set(H.id,F.textureTypes?[...F.textureTypes]:void 0)}const R={name:"Set Texture for All Cuboids",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())if(F&&Array.isArray(F))for(let E=0;E{S(R.newValue)}};o(R),S(x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}case re.OnlyThisObject:{const b=c.textureTypes?[...c.textureTypes]:void 0,R={name:"Set Texture for All Sides of Selected Cuboid",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{if(R.oldValue&&Array.isArray(R.oldValue))for(let H=0;H{A(R.changedElementId,R.newValue)}};o(R),A(c.id,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]);for(let F=0;F<4;F++)H.actionState.cuboidFaceTextures[F]=x});break}default:{if(a>=0){const b=c.textureTypes?c.textureTypes[a]:Ro.NoTexture,R={name:"Set Texture for Selected Side of Cuboid",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,changedSideIndex:a,undo:()=>{R.changedSideIndex!==void 0&&g(R.changedSideIndex,R.changedElementId,R.oldValue)},redo:()=>{R.changedSideIndex!==void 0&&g(R.changedSideIndex,R.changedElementId,R.newValue)}};o(R),g(a,c.id,x),s(l+1),e(H=>{H.actionState.cuboidFaceTextures||(H.actionState.cuboidFaceTextures=[Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture,Ro.NoTexture]),H.actionState.cuboidFaceTextures[a]=x})}break}}},T=()=>{c!=null&&c.textureTypes&&a>=0&&d(c.textureTypes[a]),t(!1)},w=()=>{v(u)};return h.jsx(so,{width:600,title:Y.t("word.Texture",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(p,{value:Ro.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",f)]},Ro.NoTexture),h.jsxs(p,{value:Ro.Facade01,children:[h.jsx("img",{alt:Ro.Facade01,src:vfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture01",f)]},Ro.Facade01),h.jsxs(p,{value:Ro.Facade02,children:[h.jsx("img",{alt:Ro.Facade02,src:xfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture02",f)]},Ro.Facade02),h.jsxs(p,{value:Ro.Facade03,children:[h.jsx("img",{alt:Ro.Facade03,src:bfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture03",f)]},Ro.Facade03),h.jsxs(p,{value:Ro.Facade04,children:[h.jsx("img",{alt:Ro.Facade04,src:Sfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture04",f)]},Ro.Facade04),h.jsxs(p,{value:Ro.Facade05,children:[h.jsx("img",{alt:Ro.Facade05,src:Tfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture05",f)]},Ro.Facade05),h.jsxs(p,{value:Ro.Facade06,children:[h.jsx("img",{alt:Ro.Facade06,src:Pfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture06",f)]},Ro.Facade06),h.jsxs(p,{value:Ro.Facade07,children:[h.jsx("img",{alt:Ro.Facade07,src:Cfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture07",f)]},Ro.Facade07),h.jsxs(p,{value:Ro.Facade08,children:[h.jsx("img",{alt:Ro.Facade08,src:Rfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture08",f)]},Ro.Facade08),h.jsxs(p,{value:Ro.Facade09,children:[h.jsx("img",{alt:Ro.Facade09,src:Hfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture09",f)]},Ro.Facade09),h.jsxs(p,{value:Ro.Facade10,children:[h.jsx("img",{alt:Ro.Facade10,src:Mfo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("cuboidMenu.Texture10",f)]},Ro.Facade10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:C,value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("cuboidMenu.OnlyThisSide",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.AllSidesOfThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllSidesOfAllCuboids",f)})]})})})]})})},zfo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(LH),r=M(cYe),i=M(d3),a=M(kw),l=M(u3),s=M(En),c=M(Eb),u=M(Fb),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.lx)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=oe=>{u(oe.target.value)},U=oe=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:{for(const Z of e)if(Z.type===z.Cuboid&&M.getState().selectedElementIdSet.has(Z.id)){const te=Z,ee=o(te.id);if(ee.length>0&&!me.doesNewSizeContainAllChildren(te,ee,oe,te.ly))return!1}break}case re.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Cuboid){const te=Z,ee=o(te.id);if(ee.length>0&&!me.doesNewSizeContainAllChildren(te,ee,oe,te.ly))return!1}break}default:{const Z=o(A.id);if(Z.length>0)return me.doesNewSizeContainAllChildren(A,Z,oe,A.ly);break}}return!0}},W=oe=>!U(oe),k=oe=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:for(const Z of e)if(Z.type===z.Cuboid&&!Z.locked&&M.getState().selectedElementIdSet.has(Z.id)&&Math.abs(Z.lx-oe)>Et)return!0;break;case re.AllObjectsOfThisType:for(const Z of e)if(Z.type===z.Cuboid&&!Z.locked&&Math.abs(Z.lx-oe)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const Z of e)if(Z.type===z.Cuboid&&Z.parentId===(A==null?void 0:A.parentId)&&!Z.locked&&Math.abs(Z.lx-oe)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((A==null?void 0:A.lx)-oe)>Et)return!0}return!1}},D=(oe,Z)=>{if(oe==null)return null;for(const te of oe.children)if(te.name.includes(`${Z}`))return te;return null},L=(oe,Z,te)=>{var ee,de;if(oe){for(const fe of oe.children)if(fe.name.includes(`${te.id}`)){(de=(ee=kn.getState().contentRef)==null?void 0:ee.current)==null||de.add(fe);break}d(fe=>{for(const pe of fe.elements)if(pe.id===te.id){pe.parentId=Zo;const ye=new Kt(pe.cx,pe.cy).rotateAround(ai,Z.rotation[2]).add(new Kt(Z.cx,Z.cy));pe.cx=ye.x,pe.cy=ye.y,pe.cz=0,T.current.set(pe.id,new le(ye.x,ye.y,0)),P.current.set(pe.id,Zo);break}})}},j=oe=>{for(const Z of e)Z.type===z.Cuboid&&!Z.locked&&Z.parentId===(A==null?void 0:A.parentId)&&B(Z,oe)},B=(oe,Z)=>{const te=o(oe.id),ee=oe.rotation[2];if(w.current.clear(),R.current.clear(),te.length>0)for(const de of te){if(me.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const fe=new Kt(de.cx*oe.lx,de.cy*oe.ly).rotateAround(ai,ee);w.current.set(de.id,fe),v.current.set(de.id,new le(de.cx,de.cy));break}case z.Polygon:{const fe=de,pe=[];for(const ye of fe.vertices)pe.push(new Kt(ye.x*oe.lx,ye.y*oe.ly).rotateAround(ai,ee));R.current.set(de.id,pe),x.current.set(de.id,fe.vertices.map(ye=>({...ye})));break}}else de.type===z.SolarPanel&&(me.isEqual(de.normal[0],-1)||me.isEqual(de.normal[0],1))&&v.current.set(de.id,new le(de.cx,de.cy,de.cz));me.isPlantOrHuman(de)&&v.current.set(de.id,new le(de.cx,de.cy,de.cz))}if(i(oe.id,Z),te.length>0)for(const de of te){if(me.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const fe=w.current.get(de.id);if(fe){const ye=new Kt(fe.x,fe.y).rotateAround(ai,-ee).x/Z;r(de.id,ye),T.current.set(de.id,new le(ye,de.cy))}break}case z.Polygon:{const fe=R.current.get(de.id);if(fe){const pe=[];for(const ye of fe){const ae=ye.rotateAround(ai,-ee),Te=ae.x/Z,ge=ae.y/oe.ly;pe.push({x:Te,y:ge})}a(de.id,pe),b.current.set(de.id,pe.map(ye=>({...ye})))}break}}else de.type===z.SolarPanel&&(me.isEqual(de.normal[0],-1)&&(r(de.id,-Z/2),T.current.set(de.id,new le(-Z/2,de.cy,de.cz))),me.isEqual(de.normal[0],1)&&(r(de.id,Z/2),T.current.set(de.id,new le(Z/2,de.cy,de.cz))));if(me.isPlantOrHuman(de)){if(T.current.set(de.id,new le(de.cx,de.cy,de.cz)),C.current.set(de.id,oe.id),Math.abs(de.cz-oe.lz/2)0){const fe=kn.getState().contentRef,pe=D(fe==null?void 0:fe.current,oe.id);L(pe,oe,de)}}else if(Math.abs(Math.abs(de.cx)-oe.lx/2)0?Z:-Z)/2;r(de.id,fe),T.current.set(de.id,new le(fe,de.cy,de.cz))}}}},O=(oe,Z,te)=>{if(!oe||!Z)return;const ee=kn.getState().contentRef,de=D(ee==null?void 0:ee.current,Z),fe=D(Z===Zo?ee==null?void 0:ee.current:de,te);if(fe&&(ee!=null&&ee.current)){if(oe===Zo)ee.current.add(fe);else{const pe=D(ee.current,oe);pe==null||pe.add(fe)}op()}},V=(oe,Z)=>{oe&&d(te=>{for(const ee of te.elements)if(ee.id===Z){ee.parentId=oe;break}})},G=oe=>{if(!A||!k(oe))return;const Z=n(A.id),te=Z?Z.lx:A.lx;if(F.current=void 0,H.current=W(oe),H.current)F.current=oe,S(te);else switch(c){case re.AllSelectedObjectsOfThisType:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&!fe.locked&&M.getState().selectedElementIdSet.has(fe.id)&&(ee.set(fe.id,fe.lx),B(fe,oe));const de={name:"Set Length for Selected Cuboids",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())i(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())a(ye,ae)},redo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())i(ye,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())a(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeOnSurface:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&fe.parentId===A.parentId&&!fe.locked&&(ee.set(fe.id,fe.lx),B(fe,oe));const de={name:"Set Length for All Cuboids on Surface",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())i(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())a(ye,ae)},redo:()=>{var fe,pe;if(j(de.newSize),de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())a(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisType:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&!fe.locked&&(ee.set(fe.id,fe.lx),B(fe,oe));const de={name:"Set Length for All Cuboids",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())i(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())a(ye,ae)},redo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())i(ye,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){l(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())a(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{B(A,oe);const ee={name:"Set Cuboid Length",timestamp:Date.now(),oldSize:te,newSize:oe,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,fe;if(i(A.id,ee.oldSize),ee.oldChildrenPositionsMap&&ee.oldChildrenPositionsMap.size>0)for(const[pe,ye]of ee.oldChildrenPositionsMap.entries()){l(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(O(ae,Te,pe),V(ae,pe))}if(ee.oldChildrenVerticesMap&&ee.oldChildrenVerticesMap.size>0)for(const[pe,ye]of ee.oldChildrenVerticesMap.entries())a(pe,ye)},redo:()=>{var de,fe;if(i(A.id,ee.newSize),ee.newChildrenPositionsMap&&ee.newChildrenPositionsMap.size>0)for(const[pe,ye]of ee.newChildrenPositionsMap.entries()){l(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(O(Te,ae,pe),V(Te,pe))}if(ee.newChildrenVerticesMap&&ee.newChildrenVerticesMap.size>0)for(const[pe,ye]of ee.newChildrenVerticesMap.entries())a(pe,ye)}};s(ee),p(f+1);break}}},q=()=>{t(!1)},$=()=>{q(),g()},ie=()=>{G(y),H.current||(t(!1),p(0))},Q=()=>{G(y)},se=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",E),rejectedMessage:se,onApply:Q,onClose:q,onClickCancel:$,onClickOk:ie,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:y,onChange:oe=>{oe!==null&&S(oe)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 500] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",E)})]})})})]})})},Dfo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(LH),r=M(u3),i=M(uYe),a=M(Fw),l=M(kw),s=M(En),c=M(Eb),u=M(Fb),d=M(pn),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.ly)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new Map),H=m.useRef(!1),F=m.useRef(),E=$t(),N=oe=>{u(oe.target.value)},U=oe=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:{for(const Z of e)if(Z.type===z.Cuboid&&M.getState().selectedElementIdSet.has(Z.id)){const te=Z,ee=o(te.id);if(ee.length>0&&!me.doesNewSizeContainAllChildren(te,ee,te.lx,oe))return!1}break}case re.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Cuboid){const te=Z,ee=o(te.id);if(ee.length>0&&!me.doesNewSizeContainAllChildren(te,ee,te.lx,oe))return!1}break}default:{const Z=o(A.id);if(Z.length>0)return me.doesNewSizeContainAllChildren(A,Z,A.lx,oe);break}}return!0}},W=oe=>!U(oe),k=oe=>{if(A){switch(c){case re.AllSelectedObjectsOfThisType:for(const Z of e)if(Z.type===z.Cuboid&&!Z.locked&&M.getState().selectedElementIdSet.has(Z.id)&&Math.abs(Z.ly-oe)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const Z of e)if(Z.type===z.Cuboid&&Z.parentId===(A==null?void 0:A.parentId)&&!Z.locked&&Math.abs(Z.ly-oe)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const Z of e)if(Z.type===z.Cuboid&&!Z.locked&&Math.abs(Z.ly-oe)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((A==null?void 0:A.ly)-oe)>Et)return!0}return!1}},D=(oe,Z)=>{if(oe==null)return null;for(const te of oe.children)if(te.name.includes(`${Z}`))return te;return null},L=(oe,Z,te)=>{var ee,de;if(oe){for(const fe of oe.children)if(fe.name.includes(`${te.id}`)){(de=(ee=kn.getState().contentRef)==null?void 0:ee.current)==null||de.add(fe);break}d(fe=>{for(const pe of fe.elements)if(pe.id===te.id){pe.parentId=Zo;const ye=new Kt(pe.cx,pe.cy).rotateAround(ai,Z.rotation[2]).add(new Kt(Z.cx,Z.cy));pe.cx=ye.x,pe.cy=ye.y,pe.cz=0,T.current.set(pe.id,new le(ye.x,ye.y,0)),P.current.set(pe.id,Zo);break}})}},j=oe=>{for(const Z of e)Z.type===z.Cuboid&&!Z.locked&&Z.parentId===(A==null?void 0:A.parentId)&&B(Z,oe)},B=(oe,Z)=>{const te=o(oe.id),ee=oe.rotation[2];if(w.current.clear(),R.current.clear(),te.length>0)for(const de of te){if(me.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const fe=new Kt(de.cx*oe.lx,de.cy*oe.ly).rotateAround(ai,ee);w.current.set(de.id,fe),v.current.set(de.id,new le(de.cx,de.cy));break}case z.Polygon:{const fe=de,pe=[];for(const ye of fe.vertices)pe.push(new Kt(ye.x*oe.lx,ye.y*oe.ly).rotateAround(ai,ee));R.current.set(de.id,pe),x.current.set(de.id,fe.vertices.map(ye=>({...ye})));break}}else de.type===z.SolarPanel&&(me.isEqual(de.normal[1],-1)||me.isEqual(de.normal[1],1))&&v.current.set(de.id,new le(de.cx,de.cy,de.cz));me.isPlantOrHuman(de)&&v.current.set(de.id,new le(de.cx,de.cy,de.cz))}if(a(oe.id,Z),te.length>0)for(const de of te){if(me.isIdentical(de.normal,as))switch(de.type){case z.Sensor:{const fe=w.current.get(de.id);if(fe){const ye=new Kt(fe.x,fe.y).rotateAround(ai,-ee).y/Z;i(de.id,ye),T.current.set(de.id,new le(de.cx,ye))}break}case z.Polygon:{const fe=R.current.get(de.id);if(fe){const pe=[];for(const ye of fe){const ae=ye.rotateAround(ai,-ee),Te=ae.x/oe.lx,ge=ae.y/Z;pe.push({x:Te,y:ge})}l(de.id,pe),b.current.set(de.id,pe.map(ye=>({...ye})))}break}}else de.type===z.SolarPanel&&(me.isEqual(de.normal[1],-1)&&(i(de.id,-Z/2),T.current.set(de.id,new le(de.cx,-Z/2,de.cz))),me.isEqual(de.normal[1],1)&&(i(de.id,Z/2),T.current.set(de.id,new le(de.cx,Z/2,de.cz))));if(me.isPlantOrHuman(de)){if(T.current.set(de.id,new le(de.cx,de.cy,de.cz)),C.current.set(de.id,oe.id),Math.abs(de.cz-oe.lz/2)0){const fe=kn.getState().contentRef,pe=D(fe==null?void 0:fe.current,oe.id);L(pe,oe,de)}}else if(Math.abs(Math.abs(de.cy)-oe.ly/2)0?Z:-Z)/2;i(de.id,fe),T.current.set(de.id,new le(de.cz,fe,de.cz))}}}},O=(oe,Z,te)=>{if(!oe||!Z)return;const ee=kn.getState().contentRef,de=D(ee==null?void 0:ee.current,Z),fe=D(Z===Zo?ee==null?void 0:ee.current:de,te);if(fe&&(ee!=null&&ee.current)){if(oe===Zo)ee.current.add(fe);else{const pe=D(ee.current,oe);pe==null||pe.add(fe)}op()}},V=(oe,Z)=>{oe&&d(te=>{for(const ee of te.elements)if(ee.id===Z){ee.parentId=oe;break}})},G=oe=>{if(!A||!k(oe))return;const Z=n(A.id),te=Z?Z.ly:A.ly;if(F.current=void 0,H.current=W(oe),H.current)F.current=oe,S(te);else switch(v.current.clear(),T.current.clear(),x.current.clear(),b.current.clear(),c){case re.AllSelectedObjectsOfThisType:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&!fe.locked&&M.getState().selectedElementIdSet.has(fe.id)&&(ee.set(fe.id,fe.ly),B(fe,oe));const de={name:"Set Width for Selected Cuboids on Surface",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())a(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())l(ye,ae)},redo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())a(ye,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())l(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeOnSurface:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&fe.parentId===A.parentId&&!fe.locked&&(ee.set(fe.id,fe.ly),B(fe,oe));const de={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())a(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())l(ye,ae)},redo:()=>{var fe,pe;if(j(de.newSize),de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())l(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisType:{const ee=new Map;for(const fe of e)fe.type===z.Cuboid&&!fe.locked&&(ee.set(fe.id,fe.ly),B(fe,oe));const de={name:"Set Width for All Cuboids on Surface",timestamp:Date.now(),oldSizes:ee,newSize:oe,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())a(ye,ae);if(de.oldChildrenPositionsMap&&de.oldChildrenPositionsMap.size>0)for(const[ye,ae]of de.oldChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(Te,ge,ye),V(Te,ye))}if(de.oldChildrenVerticesMap&&de.oldChildrenVerticesMap.size>0)for(const[ye,ae]of de.oldChildrenVerticesMap.entries())l(ye,ae)},redo:()=>{var fe,pe;for(const[ye,ae]of de.oldSizes.entries())a(ye,de.newSize);if(de.newChildrenPositionsMap&&de.newChildrenPositionsMap.size>0)for(const[ye,ae]of de.newChildrenPositionsMap.entries()){r(ye,ae.x,ae.y,ae.z);const Te=(fe=de.oldChildrenParentIdMap)==null?void 0:fe.get(ye),ge=(pe=de.newChildrenParentIdMap)==null?void 0:pe.get(ye);Te&&ge&&Te!==ge&&(O(ge,Te,ye),V(ge,ye))}if(de.newChildrenVerticesMap&&de.newChildrenVerticesMap.size>0)for(const[ye,ae]of de.newChildrenVerticesMap.entries())l(ye,ae)}};s(de),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{B(A,oe);const ee={name:"Set Cuboid Width",timestamp:Date.now(),oldSize:te,newSize:oe,resizedElementId:A.id,resizedElementType:A.type,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenVerticesMap:new Map(x.current),newChildrenVerticesMap:new Map(b.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var de,fe;if(a(A.id,ee.oldSize),ee.oldChildrenPositionsMap&&ee.oldChildrenPositionsMap.size>0)for(const[pe,ye]of ee.oldChildrenPositionsMap.entries()){r(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(O(ae,Te,pe),V(ae,pe))}if(ee.oldChildrenVerticesMap&&ee.oldChildrenVerticesMap.size>0)for(const[pe,ye]of ee.oldChildrenVerticesMap.entries())l(pe,ye)},redo:()=>{var de,fe;if(a(A.id,ee.newSize),ee.newChildrenPositionsMap&&ee.newChildrenPositionsMap.size>0)for(const[pe,ye]of ee.newChildrenPositionsMap.entries()){r(pe,ye.x,ye.y,ye.z);const ae=(de=ee.oldChildrenParentIdMap)==null?void 0:de.get(pe),Te=(fe=ee.newChildrenParentIdMap)==null?void 0:fe.get(pe);ae&&Te&&ae!==Te&&(O(Te,ae,pe),V(Te,pe))}if(ee.newChildrenVerticesMap&&ee.newChildrenVerticesMap.size>0)for(const[pe,ye]of ee.newChildrenVerticesMap.entries())l(pe,ye)}};s(ee),p(f+1);break}}},q=()=>{t(!1)},$=()=>{q(),g()},ie=()=>{G(y),H.current||(t(!1),p(0))},Q=()=>{G(y)},se=H.current?": "+Y.t("message.NotApplicableToSelectedAction",E)+(F.current!==void 0?" ("+F.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",E),rejectedMessage:se,onApply:Q,onClose:q,onClickCancel:$,onClickOk:ie,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:500,style:{width:120},step:.5,precision:2,value:y,onChange:oe=>{oe!==null&&S(oe)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",E),": [0.1, 500] ",Y.t("word.MeterAbbreviation",E)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",E)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:N,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",E)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",E)})]})})})]})})},Efo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(jge),a=M(Gwt),l=M(Jwt),s=M(Xwt),c=M(En),u=M(Eb),d=M(Fb),f=M(u3),p=M(no),g=M(Qn),A=uo(z.Cuboid),[y,S]=m.useState((A==null?void 0:A.lz)??0),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=$t(),x=O=>{d(O.target.value)},b=(O,V)=>{i(O,V),a(O,V/2)},R=O=>{if(!A)return;const V=o(A);if(V)for(const G of n)G.type===z.Cuboid&&!G.locked&&G.parentId===V.id&&(i(G.id,O),a(G.id,O/2))},H=O=>{if(!A)return;const V=me.getBaseId(A.id);if(V)for(const G of n)G.type===z.Cuboid&&!G.locked&&me.getBaseId(G.id)===V&&(i(G.id,O),a(G.id,O/2))},F=O=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const V of n)if(V.type===z.Cuboid&&!V.locked&&M.getState().selectedElementIdSet.has(V.id)&&Math.abs(V.lz-O)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const V of n)if(V.type===z.Cuboid&&!V.locked&&Math.abs(V.lz-O)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{const V=me.getBaseId(A==null?void 0:A.id);if(V&&V!==Zo){for(const G of n)if(G.type===z.Cuboid&&G.parentId&&G.parentId!==Zo&&!G.locked){const q=G;if(V===me.getBaseId(q.id)&&Math.abs(q.lz-O)>Et)return!0}}break}case re.AllObjectsOfThisTypeOnSurface:{for(const V of n)if(V.type===z.Cuboid&&V.parentId!==Zo&&V.parentId===(A==null?void 0:A.parentId)&&!V.locked&&Math.abs(V.lz-O)>Et)return!0;break}default:{if(Math.abs((A==null?void 0:A.lz)-O)>Et)return!0;break}}return!1}},E=(O,V)=>{if(O==null)return null;for(const G of O.children)if(G.name.includes(`${V}`))return G;return null},N=(O,V,G)=>{var q,$;if(O){for(const Q of O.children)if(Q.name.includes(`${G.id}`)){($=(q=kn.getState().contentRef)==null?void 0:q.current)==null||$.add(Q);break}G.parentId=Zo;const ie=new Kt(G.cx,G.cy).rotateAround(ai,-V.rotation[2]).add(new Kt(V.cx,V.cy));G.cx=ie.x,G.cy=ie.y,G.cz=0,T.current.set(G.id,new le(ie.x,ie.y,0)),P.current.set(G.id,Zo)}},U=(O,V)=>{e(G=>{for(const q of G.elements)if(q.parentId===O.id)if(C.current.set(q.id,O.id),v.current.set(q.id,new le(q.cx,q.cy,q.cz)),me.isPlantOrHuman(q))if(Math.abs(q.cz-O.lz/2)V/2){const ie=kn.getState().contentRef,Q=E(ie==null?void 0:ie.current,O.id);N(Q,O,q)}else q.cz=$,T.current.set(q.id,new le(q.cx,q.cy,$))}else q.type===z.SolarPanel&&me.isEqual(q.normal[2],1)&&(q.cz=V/2,T.current.set(q.id,new le(q.cx,q.cy,V/2)))})},W=(O,V,G)=>{if(!O||!V)return;const q=kn.getState().contentRef,$=E(q==null?void 0:q.current,V),ie=E(V===Zo?q==null?void 0:q.current:$,G);if(ie&&(q!=null&&q.current)){if(O===Zo)q.current.add(ie);else{const Q=E(q.current,O);Q==null||Q.add(ie)}op()}},k=(O,V)=>{O&&e(G=>{for(const q of G.elements)if(q.id===V){q.parentId=O;break}})},D=(O,V)=>{M.getState().set(G=>{for(const q of G.elements)if(O.has(q.id))if(V!==void 0)q.lz=V,q.cz=V/2;else{const $=O.get(q.id);$!==void 0&&(q.lz=$,q.cz=$/2)}})},L=O=>{if(A&&F(O)){switch(u){case re.AllSelectedObjectsOfThisType:{const V=new Map;for(const q of n)q.type===z.Cuboid&&M.getState().selectedElementIdSet.has(q.id)&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for Selected Cuboids",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;if(D(G.oldValues),G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),oe=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&oe&&se!==oe&&(W(se,oe,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(D(G.oldValues,q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(Z,oe,Q),k(Z,Q))}}};c(G),D(V,O),g(p+1);break}case re.AllObjectsOfThisType:{const V=new Map;for(const q of n)q.type===z.Cuboid&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for All Cuboids",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;for(const[ie,Q]of G.oldValues.entries())b(ie,Q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),oe=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&oe&&se!==oe&&(W(se,oe,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(l(z.Cuboid,q),s(z.Cuboid,q/2),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(Z,oe,Q),k(Z,Q))}}};c(G),l(z.Cuboid,O),s(z.Cuboid,O/2),g(p+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{const V=new Map,G=me.getBaseId(A.id);for(const $ of n)$.type===z.Cuboid&&me.getBaseId($.id)===G&&(V.set($.id,$.lz),U($,O));const q={name:"Set Height for All Cuboids Above Same Base",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var $,ie;for(const[Q,se]of q.oldValues.entries())b(Q,se);if(q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[Q,se]of q.oldChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(oe,Z,Q),k(oe,Q))}},redo:()=>{var ie,Q;const $=q.newValue;if(H($),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[se,oe]of q.newChildrenPositionsMap.entries()){f(se,oe.x,oe.y,oe.z);const Z=(ie=q.oldChildrenParentIdMap)==null?void 0:ie.get(se),te=(Q=q.newChildrenParentIdMap)==null?void 0:Q.get(se);Z&&te&&Z!==te&&(W(te,Z,se),k(te,se))}}};c(q),H(O),g(p+1);break}case re.AllObjectsOfThisTypeOnSurface:{const V=new Map;for(const q of n)q.type===z.Cuboid&&q.parentId===A.parentId&&(V.set(q.id,q.lz),U(q,O));const G={name:"Set Height for All Cuboids on Same Surface",timestamp:Date.now(),oldValues:V,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),undo:()=>{var q,$;for(const[ie,Q]of G.oldValues.entries())b(ie,Q);if(G.oldChildrenPositionsMap&&G.oldChildrenPositionsMap.size>0)for(const[ie,Q]of G.oldChildrenPositionsMap.entries()){f(ie,Q.x,Q.y,Q.z);const se=(q=G.oldChildrenParentIdMap)==null?void 0:q.get(ie),oe=($=G.newChildrenParentIdMap)==null?void 0:$.get(ie);se&&oe&&se!==oe&&(W(se,oe,ie),k(se,ie))}},redo:()=>{var $,ie;const q=G.newValue;if(R(q),G.newChildrenPositionsMap&&G.newChildrenPositionsMap.size>0)for(const[Q,se]of G.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=G.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=G.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(Z,oe,Q),k(Z,Q))}}};c(G),R(O),g(p+1);break}default:{const V=r(A.id),G=V?V.lz:A.lz;U(A,O),b(A.id,O);const q={name:"Set Cuboid Width",timestamp:Date.now(),oldValue:G,newValue:O,oldChildrenPositionsMap:new Map(v.current),newChildrenPositionsMap:new Map(T.current),oldChildrenParentIdMap:new Map(C.current),newChildrenParentIdMap:new Map(P.current),changedElementId:A.id,changedElementType:A.type,undo:()=>{var $,ie;if(b(q.changedElementId,q.oldValue),q.oldChildrenPositionsMap&&q.oldChildrenPositionsMap.size>0)for(const[Q,se]of q.oldChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(oe,Z,Q),k(oe,Q))}},redo:()=>{var $,ie;if(b(q.changedElementId,q.newValue),q.newChildrenPositionsMap&&q.newChildrenPositionsMap.size>0)for(const[Q,se]of q.newChildrenPositionsMap.entries()){f(Q,se.x,se.y,se.z);const oe=($=q.oldChildrenParentIdMap)==null?void 0:$.get(Q),Z=(ie=q.newChildrenParentIdMap)==null?void 0:ie.get(Q);oe&&Z&&oe!==Z&&(W(Z,oe,Q),k(Z,Q))}}};c(q),g(p+1);break}}e(V=>{V.actionState.cuboidHeight=O})}},j=()=>{t(!1)},B=()=>{L(y)};return h.jsx(so,{width:550,title:Y.t("word.Height",w),onApply:B,onClose:j,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:1e3,style:{width:120},step:.5,precision:2,value:y,onChange:O=>{O!==null&&S(O)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",w),": [0.1, 1000] ",Y.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",w)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",w)}),(A==null?void 0:A.parentId)!==Zo&&h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("cuboidMenu.AllCuboidsAboveSameBase",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",w)})]})})})]})})},Ffo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Bge),r=M(En),i=M(Eb),a=M(Fb),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState(c?-c.rotation[2]:0),f=$t(),p=v=>{a(v.target.value)},g=v=>{for(const T of e)T.type===z.Cuboid&&!T.locked&&T.parentId===(c==null?void 0:c.parentId)&&o(T.id,0,0,-v)},A=v=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Cuboid&&!T.locked&&M.getState().selectedElementIdSet.has(T.id)&&Math.abs(-T.rotation[2]-v)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Cuboid&&T.parentId===(c==null?void 0:c.parentId)&&!T.locked&&Math.abs(-T.rotation[2]-v)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const T of e)if(T.type===z.Cuboid&&!T.locked&&Math.abs(-T.rotation[2]-v)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs((c?-c.rotation[2]:0)-v)>Et)return!0}return!1},y=(v,T)=>{M.getState().set(w=>{for(const x of w.elements)if(v.has(x.id))if(T!==void 0)x.rotation[2]=T;else{const b=v.get(x.id);b!==void 0&&(x.rotation[2]=-b)}})},S=v=>{if(c&&A(v))switch(i){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Cuboid&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for Selected Cuboids",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,-w.newValue)}};r(w),y(T,-v),s(l+1);break}case re.AllObjectsOfThisTypeOnSurface:{const T=new Map;for(const x of e)x.type===z.Cuboid&&x.parentId===c.parentId&&!x.locked&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for All Cuboids on Surface",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{for(const[x,b]of w.oldValues.entries())o(x,0,0,-b)},redo:()=>{g(w.newValue)}};r(w),g(v),s(l+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Cuboid&&!x.locked&&T.set(x.id,-x.rotation[2]);const w={name:"Set Azimuth for All Cuboids",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{y(w.oldValues)},redo:()=>{y(w.oldValues,-w.newValue)}};r(w),y(T,-v),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{const T=n(c.id),w=T?-T.rotation[2]:-c.rotation[2],x={name:"Set Cuboid Azimuth",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{o(x.changedElementId,0,0,-x.oldValue)},redo:()=>{o(x.changedElementId,0,0,-x.newValue)}};r(x),o(c.id,0,0,-v),s(l+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("word.Azimuth",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},step:.5,precision:2,value:parseFloat(me.toDegrees(u).toFixed(2)),formatter:v=>`${v}°`,onChange:v=>{v!==null&&d(me.toRadians(v))}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",f),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",f)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:p,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",f)})]})})})]})})},kfo=[{key:"sensorCount",objectType:z.Sensor},{key:"polygonCount",objectType:z.Polygon},{key:"humanCount",objectType:z.Human},{key:"treeCount",objectType:z.Tree},{key:"flowerCount",objectType:z.Flower},{key:"outsideLightCount",objectType:z.Light}],Lfo=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.Light:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllLightsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Lights",n)})`;break}case z.Sensor:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllSensorsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Sensors",n)})`;break}case z.Polygon:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllPolygonsOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Polygons",n)})`;break}case z.Human:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedHumans",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllHumansOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Humans",n)})`;break}case z.Tree:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedTrees",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllTreesOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Trees",n)})`;break}case z.Flower:{o=`${Y.t("cuboidMenu.RemoveAllUnlockedFlowers",n)} (${e})`,r=`${Y.t("cuboidMenu.DoYouReallyWantToRemoveAllFlowersOnCuboid",n)} (${e} ${Y.t("cuboidMenu.Flowers",n)})`;break}}return{itemLabel:o,modalTitle:r}},Wfo=(t,e)=>{const n=[],o={lng:M.getState().language};if(e.solarPanelCount>0){const r=Y.t("cuboidMenu.DoYouReallyWantToRemoveAllSolarPanelsOnCuboid",o)+" ("+e.solarPanelModuleCount+" "+Y.t("cuboidMenu.SolarPanels",o)+", "+e.solarPanelCount+" "+Y.t("cuboidMenu.Racks",o)+")?";n.push({key:"remove-all-solar-panels-on-cuboid",label:h.jsxs(zHe,{cuboid:t,objectType:z.SolarPanel,modalTitle:r,children:[Y.t("cuboidMenu.RemoveAllUnlockedSolarPanels",o),"  (",e.solarPanelModuleCount," ",Y.t("cuboidMenu.SolarPanels",o),",",e.solarPanelCount," ",Y.t("cuboidMenu.Racks",o),")"]})})}return kfo.forEach(({key:r,objectType:i})=>{const a=e[r];if(typeof a=="number"&&a>0){const{itemLabel:l,modalTitle:s}=Lfo(i,a),c=i.replaceAll(" ","");n.push({key:`remove-all-${c}s-on-cuboid`,label:h.jsx(zHe,{cuboid:t,objectType:i,modalTitle:s,children:l})})}}),n},Nfo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(Eb),a=M(Fb),l=M(no),s=M(Qn),c=uo(z.Cuboid),[u,d]=m.useState((c==null?void 0:c.transparency)??0),f=$t(),p=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Cuboid&&b.id===T&&!b.locked){b.transparency=w;break}})},g=T=>{for(const w of n)w.type===z.Cuboid&&!w.locked&&w.parentId===(c==null?void 0:c.parentId)&&p(w.id,T)},A=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Cuboid&&T.has(b.id))if(w!==void 0)b.transparency=w;else{const R=T.get(b.id);R!==void 0&&(b.transparency=R)}})},y=T=>{a(T.target.value)},S=T=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const w of n)if(w.type===z.Cuboid&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&Math.abs((w.transparency??0)-T)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const w of n)if(w.type===z.Cuboid&&w.parentId===(c==null?void 0:c.parentId)&&!w.locked&&Math.abs((w.transparency??0)-T)>Et)return!0;break;case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Cuboid&&!w.locked&&Math.abs((w.transparency??0)-T)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:if(Math.abs(((c==null?void 0:c.transparency)??0)-T)>Et)return!0}return!1},C=T=>{if(c&&S(T))switch(i){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Cuboid&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for Selected Cuboids",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{A(x.oldValues,-x.newValue)}};r(x),A(w,T),s(l+1);break}case re.AllObjectsOfThisTypeOnSurface:{const w=new Map;for(const b of n)b.type===z.Cuboid&&b.parentId===c.parentId&&!b.locked&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for All Cuboids on Surface",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())p(b,R)},redo:()=>{g(x.newValue)}};r(x),g(T),s(l+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Cuboid&&!b.locked&&w.set(b.id,b.transparency??0);const x={name:"Set Transparency for All Cuboids",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{A(x.oldValues,-x.newValue)}};r(x),A(w,T),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:break;default:{const w=o(c.id),x=w?w.transparency:c.transparency,b={name:"Set Cuboid Transparency",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(b.changedElementId,b.oldValue)},redo:()=>{p(b.changedElementId,b.newValue)}};r(b),p(c.id,T),s(l+1);break}}},P=()=>{t(!1)},v=()=>{C(u)};return h.jsx(so,{width:550,title:Y.t("word.Transparency",f),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.1,precision:2,value:u,onChange:T=>{T!==null&&d(T)}}),h.jsxs("div",{style:{paddingTop:"20px",paddingRight:"6px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("cuboidMenu.OnlyThisCuboid",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("cuboidMenu.AllCuboidsOnSameSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("cuboidMenu.AllSelectedCuboids",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("cuboidMenu.AllCuboids",f)})]})})})]})})},Ufo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Polygon||e.type===z.Sensor||e.type===z.SolarPanel||e.type===z.Cuboid)return!0}return!1},jfo=t=>{const e=[];if(t.type!==z.Cuboid)return{items:e};const n=t,o=M.getState().selectedSideIndex,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce(n.id,!1),a=!(n!=null&&n.locked),l=!n.textureTypes||o>=0&&n.textureTypes[o]===Ro.NoTexture;return Ufo()&&e.push({key:"cuboid-paste",label:h.jsx(oM,{})}),e.push({key:"cuboid-copy",label:h.jsx(Fd,{})}),a&&e.push({key:"cuboid-cut",label:h.jsx(kd,{})}),e.push({key:"cuboid-lock",label:h.jsx(Ku,{selectedElement:n})}),e.push({key:"cuboid-group-master",label:h.jsx(LQe,{groupableElement:n})}),e.push({key:"cuboid-stackable",label:h.jsx(yfo,{cuboid:n})}),i.gotSome()&&e.push({key:"cuboid-clear",label:h.jsx(an,{children:Y.t("word.Clear",r)}),children:Wfo(n,i)}),a&&(l&&e.push({key:"cuboid-color",label:h.jsxs(eo,{Dialog:wfo,children:[Y.t("word.Color",r)," ..."]})}),e.push({key:"cuboid-texture",label:h.jsxs(eo,{Dialog:Ifo,children:[Y.t("word.Texture",r)," ..."]})}),e.push({key:"cuboid-length",label:h.jsxs(eo,{Dialog:zfo,children:[Y.t("word.Length",r)," ..."]})}),e.push({key:"cuboid-width",label:h.jsxs(eo,{Dialog:Dfo,children:[Y.t("word.Width",r)," ..."]})}),e.push({key:"cuboid-height",label:h.jsxs(eo,{Dialog:Efo,children:[Y.t("word.Height",r)," ..."]})}),e.push({key:"cuboid-azimuth",label:h.jsxs(eo,{Dialog:Ffo,children:[Y.t("word.Azimuth",r)," ..."]})}),e.push({key:"cuboid-transparency",label:h.jsxs(eo,{Dialog:Nfo,children:[Y.t("word.Transparency",r)," ..."]})})),e.push({key:"add-polygon-on-cuboid",label:h.jsx(Afo,{cuboid:n,selectedSideIndex:o})}),a&&e.push({key:"cuboid-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)}),{items:e}},Bfo=()=>{const t=M(mA),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.groundImage=r,i.viewState.groundImageType=i.viewState.mapType})},o=r=>{const i=r.target.checked,a={name:"Show Ground Image",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("groundMenu.ImageOnGround",e)})})},Yfo=()=>{const t=M(IBe),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.waterSurface=r})},o=r=>{const i=r.target.checked,a={name:"Water Surface",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,update:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("groundMenu.WaterSurface",e)})})},Ofo=()=>{const t=M(MBe),e=o=>{M.getState().set(r=>{r.viewState.groundColor=o})},n=o=>{const r=t,i=o.hex,a={name:"Set Ground Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{e(a.oldValue)},redo:()=>{e(a.newValue)}};M.getState().addUndoable(a),e(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Ld,{color:t,onChangeComplete:n})})},Vfo=()=>{const t=M(Pge)??Nq,n=M(s0)>0,o=$t(),r=s=>{M.getState().set(c=>{c.world.leafDayOfYear1=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 1",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};M.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"80px"},children:Y.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(1-150)"});return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:1,max:150,step:1,precision:0,value:t,onChange:i})})},_fo=()=>{const t=M(Cge)??Uq,n=M(s0)>0,o=$t(),r=s=>{M.getState().set(c=>{c.world.leafDayOfYear2=s})},i=s=>{if(s===null)return;const c=t,u=s,d={name:"Set Leaf Day 2",timestamp:Date.now(),oldValue:c,newValue:u,undo:()=>{r(d.oldValue)},redo:()=>{r(d.newValue)}};M.getState().addUndoable(d),r(u)},a=()=>h.jsx("div",{style:{width:"80px"},children:Y.t(n?"groundMenu.LeafOffDay":"groundMenu.LeafOutDay",o)}),l=()=>h.jsx("div",{style:{width:"60px"},children:"(215-365)"});return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsx(a,{}),addonAfter:h.jsx(l,{}),style:{width:"300px"},min:215,max:365,step:1,precision:0,value:t,onChange:i})})},DHe=({monthIndex:t})=>{const e=M(i=>i.world.monthlyIrradianceLosses?i.world.monthlyIrradianceLosses[t]:.05)??.05,n=$t(),o=i=>{M.getState().set(a=>{a.world.monthlyIrradianceLosses||(a.world.monthlyIrradianceLosses=new Array(12).fill(.05)),a.world.monthlyIrradianceLosses[t]=i})},r=i=>{if(i===null)return;const a=e,l=i,s={name:"Set Irradiance Loss in "+swe[t],timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{o(s.oldValue)},redo:()=>{o(s.newValue)}};M.getState().addUndoable(s),o(l)};return h.jsx(Sn,{addonBefore:h.jsx("span",{style:{fontFamily:"monospace"},children:Y.t(`month.${swe[t]}`,n)}),style:{width:"120px"},min:0,max:1,step:.01,precision:2,value:e,onChange:r})},Gfo=()=>{const t=M(r=>r.world.ground.albedo),e=$t(),n=r=>{M.getState().set(i=>{i.world.ground.albedo=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ground Albedo",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"60px"},children:[Y.t("groundMenu.Albedo",e),":"]}),h.jsx(Sn,{min:.05,max:1,step:.01,precision:2,value:t,onChange:o})]})},Xfo=({itemLabel:t,modalTitle:e,objectType:n})=>{const o=M.getState().removeElementsByType,r=()=>{const a=M.getState().elements.filter(c=>!c.locked&&c.type===n);o(n);const l=JSON.parse(JSON.stringify(a)),s={name:"Remove All "+n+"s",timestamp:Date.now(),removedElements:l,undo:()=>{M.getState().set(c=>{c.elements.push(...s.removedElements)})},redo:()=>{o(n)}};M.getState().addUndoable(s),dt.getState().updateContextMenu()},i=()=>{yi.confirm({title:e,onOk:r,icon:h.jsx(ny,{})})};return h.jsx(an,{onClick:i,children:t})},EHe=({lock:t,count:e,label:n})=>{const o=M.getState().updateAllElementLocks,r=()=>{const i=new Map;for(const c of M.getState().elements)i.set(c.id,!!c.locked);const s={name:`${t?"Lock":"Unlock"} All ${t?"Unlocked":"Locked"} Elements`,timestamp:Date.now(),oldValues:i,newValue:!0,undo:()=>{for(const[c,u]of s.oldValues.entries())M.getState().updateElementLockById(c,u)},redo:()=>{o(t)}};M.getState().addUndoable(s),o(t)};return h.jsxs(an,{update:!0,onClick:r,children:[n," (",e,")"]})},Jfo=[{key:"humanCount",type:z.Human,itemLabel:"groundMenu.RemoveAllUnlockedPeople",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllPeople"},{key:"treeCount",type:z.Tree,itemLabel:"groundMenu.RemoveAllUnlockedTrees",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllTrees"},{key:"flowerCount",type:z.Flower,itemLabel:"groundMenu.RemoveAllUnlockedFlowers",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFlowers"},{key:"solarPanelCount",type:z.SolarPanel,itemLabel:"groundMenu.RemoveAllUnlockedSolarPanels",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllSolarPanels"},{key:"foundationCount",type:z.Foundation,itemLabel:"groundMenu.RemoveAllUnlockedFoundations",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllFoundations"},{key:"cuboidCount",type:z.Cuboid,itemLabel:"groundMenu.RemoveAllUnlockedCuboids",modalTitle:"groundMenu.DoYouReallyWantToRemoveAllCuboids"}],Kfo=()=>{const t=M.getState().elementsToPaste;if(!t||t.length===0)return!1;const e=t[0];return e.type===z.Human||e.type===z.Tree||e.type===z.Flower||e.type===z.Cuboid||e.type===z.Foundation},qfo=()=>zs.slice().reduce((t,e,n,o)=>(t&&n%2!==0&&t.push({key:`${o[n-1]}-${o[n]}`,label:h.jsxs(an,{stayAfterClick:!0,noPadding:!0,children:[h.jsx(DHe,{monthIndex:n-1}),h.jsx(DHe,{monthIndex:n})]})}),t),[]),$fo=()=>{const t={lng:M.getState().language},e=M.getState().countAllElementsByType(!0),n=[];return Kfo()&&n.push({key:"ground-paste",label:h.jsx(oM,{})}),Jfo.forEach(({key:o,type:r,itemLabel:i,modalTitle:a})=>{const l=e[o];typeof l=="number"&&l>0&&n.push({key:`ground-remove-all-${r}s`,label:h.jsx(Xfo,{objectType:r,itemLabel:`${Y.t(i,t)} (${l})`,modalTitle:`${Y.t(a,t)} (${l})?`})})}),e.unlockedCount>0&&n.push({key:"lock-all-elements",label:h.jsx(EHe,{lock:!0,count:e.unlockedCount,label:Y.t("groundMenu.LockAllUnlockedElements",t)})}),e.lockedCount>0&&M.getState().elements.length>0&&n.push({key:"unlock-all-elements",label:h.jsx(EHe,{lock:!1,count:e.lockedCount,label:Y.t("groundMenu.UnlockAllLockedElements",t)})}),n.push({key:"image-on-ground",label:h.jsx(Bfo,{})}),n.push({key:"water-surface",label:h.jsx(Yfo,{})}),M.getState().viewState.waterSurface||n.push({key:"ground-color-submenu",label:h.jsx(an,{children:Y.t("word.Color",t)}),children:[{key:"ground-color-picker",label:h.jsx(Ofo,{}),style:{backgroundColor:"white"}}]}),n.push({key:"vegetation-submenu",label:h.jsx(an,{children:Y.t("groundMenu.Vegetation",t)}),children:[{key:"leaf-out-day",label:h.jsx(Vfo,{})},{key:"leaf-shed-day",label:h.jsx(_fo,{})}]}),n.push({key:"monthly-irradiance-loss-submenu",label:h.jsx(an,{children:Y.t("groundMenu.MonthlyIrradianceLoss",t)}),children:qfo()}),n.push({key:"ground-albedo",label:h.jsx(Gfo,{})}),{items:n}};var OE={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return t===0?0:Math.pow(1024,t-1)},Out:function(t){return t===1?1:1-Math.pow(2,-10*t)},InOut:function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},Out:function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},InOut:function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-OE.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?OE.Bounce.In(t*2)*.5:OE.Bounce.Out(t*2-1)*.5+.5}}},qD;typeof self>"u"&&typeof process<"u"&&process.hrtime?qD=function(){var t=process.hrtime();return t[0]*1e3+t[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?qD=self.performance.now.bind(self.performance):Date.now!==void 0?qD=Date.now:qD=function(){return new Date().getTime()};var FP=qD,Qfo=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(n){return e._tweens[n]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},t.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},t.prototype.update=function(e,n){e===void 0&&(e=FP()),n===void 0&&(n=!1);var o=Object.keys(this._tweens);if(o.length===0)return!1;for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?i(t[n],t[n-1],n-o):i(t[r],t[r+1>n?n:r+1],o-r)},Bezier:function(t,e){for(var n=0,o=t.length-1,r=Math.pow,i=$D.Utils.Bernstein,a=0;a<=o;a++)n+=r(1-e,o-a)*r(e,a)*t[a]*i(o,a);return n},CatmullRom:function(t,e){var n=t.length-1,o=n*e,r=Math.floor(o),i=$D.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(o=n*(1+e))),i(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],o-r)):e<0?t[0]-(i(t[0],t[0],t[1],t[1],-o)-t[0]):e>1?t[n]-(i(t[n],t[n],t[n-1],t[n-1],o-n)-t[n]):i(t[r?r-1:0],t[r],t[n1;o--)n*=o;return t[e]=n,n}}(),CatmullRom:function(t,e,n,o,r){var i=(n-t)*.5,a=(o-e)*.5,l=r*r,s=r*l;return(2*e-2*n+i+a)*s+(-3*e+3*n-2*i-a)*l+i*r+e}}},Zfo=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Trt=new Qfo,eho=function(){function t(e,n){n===void 0&&(n=Trt),this._object=e,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=OE.Linear.None,this._interpolationFunction=$D.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Zfo.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(e,n){return this._valuesEnd=Object.create(e),n!==void 0&&(this._duration=n),this},t.prototype.duration=function(e){return this._duration=e,this},t.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?FP()+parseFloat(e):e:FP(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(e,n,o,r){for(var i in o){var a=e[i],l=Array.isArray(a),s=l?"array":typeof a,c=!l&&Array.isArray(o[i]);if(!(s==="undefined"||s==="function")){if(c){var u=o[i];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,a)),o[i]=[a].concat(u)}if((s==="object"||l)&&a&&!c){n[i]=l?[]:{};for(var d in a)n[i][d]=a[d];r[i]=l?[]:{},this._setupProperties(a,n[i],o[i],r[i])}else typeof n[i]>"u"&&(n[i]=a),l||(n[i]*=1),c?r[i]=o[i].slice().reverse():r[i]=n[i]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(e){return e===void 0&&(e=FP()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},t.prototype.resume=function(e){return e===void 0&&(e=FP()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},t.prototype.stopChainedTweens=function(){for(var e=0,n=this._chainedTweens.length;ei)return!1;n&&this.start(e)}if(this._goToEnd=!1,e1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),r===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var l=0,s=this._chainedTweens.length;l{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&(l.type===z.Human||l.type===z.Tree||l.type===z.Flower)){const s=l;s.flip=i;break}})},o=r=>{const i=r.target.checked,a={name:`Flip ${t.type}`,timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.flip,onChange:o,children:Y.t("peopleMenu.Flip",e)})})}),nho=be.memo(({human:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Human&&l.id===r){l.observer=i;break}})},o=r=>{const i=r.target.checked,a={name:"Set Observer",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:z.Human,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.observer,onChange:o,children:Y.t("peopleMenu.Observer",e)})})}),oho=be.memo(({human:t})=>{const e=$t(),[n,o]=m.useState(!1),r=m.useRef(0),i=m.useRef(-1),a=m.useRef(!0),l=m.useRef(!1);m.useEffect(()=>{if(l.current){if(a.current)return r.current=requestAnimationFrame(c),u(),()=>{cancelAnimationFrame(r.current)};a.current=!0}},[n]);const s=(f,p,g)=>{const A=kn.getState().orbitControlsRef;A!=null&&A.current&&(A.current.object.position.set(f,p,g),A.current.update(),M.getState().set(y=>{const S=y.viewState;S.cameraPosition=[f,p,g]}))},c=()=>{requestAnimationFrame(c);const f=Date.now();f-i.current>100&&(tho(),i.current=f)},u=()=>{if(!t)return;let f=t.cx,p=t.cy,g=t.cz+t.lz;const A=M.getState().getParent(t);if(A){const C=me.absoluteHumanOrTreeCoordinates(f,p,g,A);f=C.x,p=C.y,g=C.z}const y=M.getState().cameraDirection.clone().normalize().multiplyScalar(.5);f+=y.x,p+=y.y;const S=[...M.getState().viewState.cameraPosition];new eho(S).to([f,p,g],1e3).easing(OE.Quadratic.In).onUpdate(C=>{s(C[0],C[1],C[2])}).onComplete(()=>{M.getState().selectNone()}).start()},d=()=>{o(!n),l.current=!0};return h.jsx(an,{onClick:d,children:Y.t("peopleMenu.ViewFromThisPerson",e)})}),rho=be.memo(({tree:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Tree&&l.id===r){l.showModel=i;break}})},o=r=>{const i={name:"Show Tree Model",timestamp:Date.now(),checked:r,selectedElementId:t.id,selectedElementType:z.Tree,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:(t==null?void 0:t.showModel)&&(t==null?void 0:t.type)===z.Tree,onChange:r=>o(r.target.checked),children:Y.t("treeMenu.ShowModel",e)})})}),iho=be.memo(({tree:t})=>{const e=M.getState().updateElementLxById,n=$t(),o=t.lx??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Spread",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),e(t.id,i),M.getState().set(l=>{l.actionState.treeSpread=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("treeMenu.Spread",n)+" ("+Y.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(Sn,{style:{width:"160px"},min:1,max:50,step:1,precision:1,value:o,onChange:r})]})}),aho=be.memo(({tree:t})=>{const e=M.getState().updateElementLzById,n=$t(),o=t.lz??1,r=i=>{if(i===null||i===o)return;const a={name:"Set Tree Height",timestamp:Date.now(),oldValue:o,newValue:i,changedElementId:t.id,changedElementType:t.type,undo:()=>{e(a.changedElementId,a.oldValue)},redo:()=>{e(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),e(t.id,i),M.getState().set(l=>{l.actionState.treeHeight=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("word.Height",n)+" ("+Y.t("word.MeterAbbreviation",n)+")",":"]}),h.jsx(Sn,{style:{width:"160px"},min:1,max:30,step:1,precision:1,value:o,onChange:r})]})}),{Option:Xa}=Uo,lho=be.memo(({human:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Human&&u.id===l){const d=u;d.name=s,d.lx=kp.fetchWidth(s),d.lz=kp.fetchHeight(s);break}})};return h.jsxs(Uo,{style:{width:"140px"},value:(t==null?void 0:t.name)??Vt.Jack,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change People",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.humanName=l}),r(!o)}}},children:[h.jsxs(Xa,{value:Vt.Jack,children:[h.jsx("img",{alt:Vt.Jack,src:Hje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jack",i)]},Vt.Jack),h.jsxs(Xa,{value:Vt.Jacob,children:[h.jsx("img",{alt:Vt.Jacob,src:Mje,height:20,style:{paddingRight:"16px"}})," ",Y.t("people.Jacob",i)]},Vt.Jacob),h.jsxs(Xa,{value:Vt.Jacqueline,children:[h.jsx("img",{alt:Vt.Jacqueline,src:Ije,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jacqueline",i)]},Vt.Jacqueline),h.jsxs(Xa,{value:Vt.Jaah,children:[h.jsx("img",{alt:Vt.Jaah,src:Rje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jaah",i)]},Vt.Jaah),h.jsxs(Xa,{value:Vt.Jade,children:[h.jsx("img",{alt:Vt.Jade,src:zje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jade",i)]},Vt.Jade),h.jsxs(Xa,{value:Vt.Jamelia,children:[h.jsx("img",{alt:Vt.Jamelia,src:Dje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jamelia",i)]},Vt.Jamelia),h.jsxs(Xa,{value:Vt.James,children:[h.jsx("img",{alt:Vt.James,src:Eje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.James",i)]},Vt.James),h.jsxs(Xa,{value:Vt.Jane,children:[h.jsx("img",{alt:Vt.Jane,src:Fje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jane",i)]},Vt.Jane),h.jsxs(Xa,{value:Vt.Jaya,children:[h.jsx("img",{alt:Vt.Jaya,src:kje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jaya",i)]},Vt.Jaya),h.jsxs(Xa,{value:Vt.Jaye,children:[h.jsx("img",{alt:Vt.Jaye,src:Lje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jaye",i)]},Vt.Jaye),h.jsxs(Xa,{value:Vt.Jeanette,children:[h.jsx("img",{alt:Vt.Jeanette,src:Wje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jeanette",i)]},Vt.Jeanette),h.jsxs(Xa,{value:Vt.Jedi,children:[h.jsx("img",{alt:Vt.Jedi,src:Nje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jedi",i)]},Vt.Jedi),h.jsxs(Xa,{value:Vt.Jeff,children:[h.jsx("img",{alt:Vt.Jeff,src:Uje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jeff",i)]},Vt.Jeff),h.jsxs(Xa,{value:Vt.Jena,children:[h.jsx("img",{alt:Vt.Jena,src:jje,height:20,style:{paddingRight:"19px"}})," ",Y.t("people.Jena",i)]},Vt.Jena),h.jsxs(Xa,{value:Vt.Jennifer,children:[h.jsx("img",{alt:Vt.Jennifer,src:Bje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jennifer",i)]},Vt.Jennifer),h.jsxs(Xa,{value:Vt.Jess,children:[h.jsx("img",{alt:Vt.Jess,src:Yje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jess",i)]},Vt.Jess),h.jsxs(Xa,{value:Vt.Jett,children:[h.jsx("img",{alt:Vt.Jett,src:Oje,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Jett",i)]},Vt.Jett),h.jsxs(Xa,{value:Vt.Jill,children:[h.jsx("img",{alt:Vt.Jill,src:Vje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jill",i)]},Vt.Jill),h.jsxs(Xa,{value:Vt.Jiya,children:[h.jsx("img",{alt:Vt.Jiya,src:_je,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jiya",i)]},Vt.Jiya),h.jsxs(Xa,{value:Vt.Joan,children:[h.jsx("img",{alt:Vt.Joan,src:Gje,height:20,style:{paddingRight:"8px"}})," ",Y.t("people.Joan",i)]},Vt.Joan),h.jsxs(Xa,{value:Vt.Jocelyn,children:[h.jsx("img",{alt:Vt.Jocelyn,src:Xje,height:20,style:{paddingRight:"23px"}})," ",Y.t("people.Jocelyn",i)]},Vt.Jocelyn),h.jsxs(Xa,{value:Vt.Joel,children:[h.jsx("img",{alt:Vt.Joel,src:Jje,height:20,style:{paddingRight:"7px"}})," ",Y.t("people.Joel",i)]},Vt.Joel),h.jsxs(Xa,{value:Vt.Joey,children:[h.jsx("img",{alt:Vt.Joey,src:Kje,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joey",i)]},Vt.Joey),h.jsxs(Xa,{value:Vt.John,children:[h.jsx("img",{alt:Vt.John,src:qje,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.John",i)]},Vt.John),h.jsxs(Xa,{value:Vt.Jonathon,children:[h.jsx("img",{alt:Vt.Jonathon,src:$je,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Jonathon",i)]},Vt.Jonathon),h.jsxs(Xa,{value:Vt.Jose,children:[h.jsx("img",{alt:Vt.Jose,src:Qje,height:20,style:{paddingRight:"5px"}})," ",Y.t("people.Jose",i)]},Vt.Jose),h.jsxs(Xa,{value:Vt.Joseph,children:[h.jsx("img",{alt:Vt.Joseph,src:Zje,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joseph",i)]},Vt.Joseph),h.jsxs(Xa,{value:Vt.Joshua,children:[h.jsx("img",{alt:Vt.Joshua,src:eBe,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Joshua",i)]},Vt.Joshua),h.jsxs(Xa,{value:Vt.Judd,children:[h.jsx("img",{alt:Vt.Judd,src:tBe,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Judd",i)]},Vt.Judd),h.jsxs(Xa,{value:Vt.Judy,children:[h.jsx("img",{alt:Vt.Judy,src:nBe,height:20,style:{paddingRight:"21px"}})," ",Y.t("people.Judy",i)]},Vt.Judy),h.jsxs(Xa,{value:Vt.Julia,children:[h.jsx("img",{alt:Vt.Julia,src:oBe,height:20,style:{paddingRight:"22px"}})," ",Y.t("people.Julia",i)]},Vt.Julia),h.jsxs(Xa,{value:Vt.Julio,children:[h.jsx("img",{alt:Vt.Julio,src:rBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Julio",i)]},Vt.Julio),h.jsxs(Xa,{value:Vt.Jumapili,children:[h.jsx("img",{alt:Vt.Jumapili,src:iBe,height:20,style:{paddingRight:"16px"}})," ",Y.t("people.Jumapili",i)]},Vt.Jumapili),h.jsxs(Xa,{value:Vt.June,children:[h.jsx("img",{alt:Vt.June,src:aBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.June",i)]},Vt.June),h.jsxs(Xa,{value:Vt.Juro,children:[h.jsx("img",{alt:Vt.Juro,src:lBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Juro",i)]},Vt.Juro),h.jsxs(Xa,{value:Vt.Justin,children:[h.jsx("img",{alt:Vt.Justin,src:sBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("people.Justin",i)]},Vt.Justin)]})}),sho=t=>{const e=[];if(t.type!==z.Human)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().viewState.orthographic??!1;return e.push({key:"human-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"human-cut",label:h.jsx(kd,{})}),e.push({key:"human-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"human-flip",label:h.jsx(L9e,{billboardModel:n})}),i||e.push({key:"human-move-view",label:h.jsx(oho,{human:n})}),o&&(e.push({key:"human-obserber",label:h.jsx(nho,{human:n})}),e.push({key:"human-selection",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"120px"},children:[Y.t("peopleMenu.ChangePerson",r),": "]}),h.jsx(lho,{human:n})]})})),{items:e}},{Option:Zd}=Uo,cho=be.memo(({flower:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Flower&&u.id===l){const d=u;d.name=s,d.lx=A8.fetchSpread(s),d.lz=A8.fetchHeight(s);break}})};return h.jsxs(Uo,{style:{width:"200px"},value:(t==null?void 0:t.name)??ro.WhiteFlower,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Flower",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.flowerType=l}),r(!o)}}},children:[h.jsxs(Zd,{value:ro.WhiteFlower,children:[h.jsx("img",{alt:ro.WhiteFlower,src:ABe,height:20,style:{paddingRight:"17px"}})," ",Y.t("flower.WhiteFlower",i)]},ro.WhiteFlower),h.jsxs(Zd,{value:ro.YellowFlower,children:[h.jsx("img",{alt:ro.YellowFlower,src:wBe,height:20,style:{paddingRight:"16px"}})," ",Y.t("flower.YellowFlower",i)]},ro.YellowFlower),h.jsxs(Zd,{value:ro.Hibiscus,children:[h.jsx("img",{alt:ro.Hibiscus,src:uBe,height:20,style:{paddingRight:"19px"}})," ",Y.t("flower.Hibiscus",i)]},ro.Hibiscus),h.jsxs(Zd,{value:ro.Hydrangea,children:[h.jsx("img",{alt:ro.Hydrangea,src:dBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Hydrangea",i)]},ro.Hydrangea),h.jsxs(Zd,{value:ro.Spirea,children:[h.jsx("img",{alt:ro.Spirea,src:gBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Spirea",i)]},ro.Spirea),h.jsxs(Zd,{value:ro.Hosta,children:[h.jsx("img",{alt:ro.Hosta,src:fBe,height:20,style:{paddingRight:"18px"}})," ",Y.t("flower.Hosta",i)]},ro.Hosta),h.jsxs(Zd,{value:ro.Peony,children:[h.jsx("img",{alt:ro.Peony,src:hBe,height:20,style:{paddingRight:"17px"}})," ",Y.t("flower.Peony",i)]},ro.Peony),h.jsxs(Zd,{value:ro.Boxwood,children:[h.jsx("img",{alt:ro.Boxwood,src:Gce,height:20,style:{paddingRight:"23px"}})," ",Y.t("flower.Boxwood",i)]},ro.Boxwood),h.jsxs(Zd,{value:ro.TallBush,children:[h.jsx("img",{alt:ro.TallBush,src:$ce,height:20,style:{paddingRight:"32px"}})," ",Y.t("flower.TallBush",i)]},ro.TallBush),h.jsxs(Zd,{value:ro.CactusCombo1,children:[h.jsx("img",{alt:ro.CactusCombo1,src:Xce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo1",i)]},ro.CactusCombo1),h.jsxs(Zd,{value:ro.CactusCombo2,children:[h.jsx("img",{alt:ro.CactusCombo2,src:Jce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo2",i)]},ro.CactusCombo2),h.jsxs(Zd,{value:ro.CactusCombo3,children:[h.jsx("img",{alt:ro.CactusCombo3,src:Kce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo3",i)]},ro.CactusCombo3),h.jsxs(Zd,{value:ro.CactusCombo4,children:[h.jsx("img",{alt:ro.CactusCombo4,src:qce,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.CactusCombo4",i)]},ro.CactusCombo4),h.jsxs(Zd,{value:ro.RedRose,children:[h.jsx("img",{alt:ro.RedRose,src:pBe,height:20,style:{paddingRight:"26px"}})," ",Y.t("flower.RedRose",i)]},ro.RedRose),h.jsxs(Zd,{value:ro.Bellflower,children:[h.jsx("img",{alt:ro.Bellflower,src:cBe,height:20,style:{paddingRight:"20px"}})," ",Y.t("flower.Bellflower",i)]},ro.Bellflower),h.jsxs(Zd,{value:ro.Sunflower,children:[h.jsx("img",{alt:ro.Sunflower,src:mBe,height:20,style:{paddingRight:"32px"}})," ",Y.t("flower.Sunflower",i)]},ro.Sunflower),h.jsxs(Zd,{value:ro.Tulip,children:[h.jsx("img",{alt:ro.Tulip,src:yBe,height:20,style:{paddingRight:"24px"}})," ",Y.t("flower.Tulip",i)]},ro.Tulip)]})}),uho=t=>{const e=[];if(t.type!==z.Flower)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"flower-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"flower-cut",label:h.jsx(kd,{})}),e.push({key:"flower-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"flower-flip",label:h.jsx(L9e,{billboardModel:n})}),o&&e.push({key:"flower-change-type",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"60px"},children:[Y.t("flowerMenu.Type",r),": "]}),h.jsx(cho,{flower:n})]})}),{items:e}},dho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.filled=i;break}})},o=r=>{const i={name:"Fill Polygon",timestamp:Date.now(),checked:!t.filled,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:Y.t("polygonMenu.Filled",e)})})},fho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.shininess=i;break}})},o=r=>{const a={name:"Shiny Polygon",timestamp:Date.now(),checked:((t==null?void 0:t.shininess)??0)>0,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,a.checked?0:100)},redo:()=>{n(t.id,a.checked?100:0)}};M.getState().addUndoable(a),n(t.id,r.target.checked?100:0)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.shininess,onChange:o,children:Y.t("polygonMenu.Shiny",e)})})},hho=({polygon:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.type===z.Polygon&&l.id===r){l.noOutline=i;break}})},o=r=>{const i={name:"No Outline for Polygon",timestamp:Date.now(),checked:!t.noOutline,selectedElementId:t.id,selectedElementType:z.Polygon,undo:()=>{n(t.id,!i.checked)},redo:()=>{n(t.id,i.checked)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.noOutline,onChange:o,children:Y.t("polygonMenu.NoOutline",e)})})},pho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.text)??""),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.text=l);break}})},i=()=>{const a={name:"Set Text for Polygon",timestamp:Date.now(),oldValue:t.text??"",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.Text",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},gho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontSize)??1),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontSize=l);break}})},i=()=>{const a={name:"Set Font Size for Polygon",timestamp:Date.now(),oldValue:t.fontSize??1,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.FontSize",e),":"]}),min:.1,max:5,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},mho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontColor)??"black"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontColor=l);break}})},i=()=>{const a={name:"Set Font Color for Polygon",timestamp:Date.now(),oldValue:t.fontColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("word.FontColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},yho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontOutlineColor)??"white"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineColor=l);break}})},i=()=>{const a={name:"Set Font Outline Color for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineColor??"white",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontOutlineColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},Aho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontOutlineWidth)??0),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontOutlineWidth=l);break}})},i=()=>{const a={name:"Set Font Outline Width for Polygon",timestamp:Date.now(),oldValue:t.fontOutlineWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontOutlineWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},who=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontStrokeColor)??"black"),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeColor=l);break}})},i=()=>{const a={name:"Set Font Stroke Color for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeColor??"black",newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(jl,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontStrokeColor",e),":"]}),value:n,onChange:a=>o(a.target.value),onPressEnter:i,onBlur:i})})},vho=({polygon:t})=>{const e=$t(),[n,o]=m.useState((t==null?void 0:t.fontStrokeWidth)??0),r=(a,l)=>{M.getState().set(s=>{for(const c of s.elements)if(c.id===a){!c.locked&&c.type===z.Polygon&&(c.fontStrokeWidth=l);break}})},i=()=>{const a={name:"Set Font Stroke Width for Polygon",timestamp:Date.now(),oldValue:t.fontStrokeWidth??0,newValue:n,changedElementId:t.id,changedElementType:z.Polygon,undo:()=>{r(t.id,a.oldValue)},redo:()=>{r(t.id,a.newValue)}};M.getState().addUndoable(a),r(t.id,n)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Sn,{addonBefore:h.jsxs(hy,{width:"120px",children:[Y.t("polygonMenu.FontStrokeWidth",e),":"]}),min:0,max:1,step:.01,precision:2,value:n,onChange:a=>o(a),onPressEnter:i,onBlur:i})})},xho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M($wt),i=M(Qwt),a=M(Zwt),l=M(e7t),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.lineColor)??"black"),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&x!==b.lineColor)return!0;break;case re.AllObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&x!==b.lineColor)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const b of e)if(b.type===z.Polygon&&b.parentId===p.parentId&&me.isIdentical(b.normal,p.normal)&&!b.locked&&b.lineColor!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of e)if(b.type===z.Polygon&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&b.lineColor!==x)return!0;break;default:if(x!==(p==null?void 0:p.lineColor))return!0}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Polygon&&!H.locked&&x.has(H.id)&&(H.lineColor=b)})},v=x=>{if(p&&C(x))switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for Selected Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for All Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,x),f(d+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const F of e)F.type===z.Polygon&&F.parentId===p.parentId&&me.isIdentical(F.normal,p.normal)&&R.set(F.id,F.lineColor??"gray");const H={name:"Set Line Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&i(z.Polygon,H.groupId,H.normal,H.newValue)}};s(H),i(z.Polygon,p.parentId,p.normal,x),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of e)H.type===z.Polygon&&H.foundationId===p.foundationId&&b.set(H.id,H.lineColor??"black");const R={name:"Set Line Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,x),f(d+1)}break}default:{const b=n(p.id),R=b?b.lineColor:p.lineColor,H={name:"Set Line Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}},T=()=>{t(!1)},w=()=>{v(g)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.LineColor",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:g??(p==null?void 0:p.lineColor)??"black",onChangeComplete:x=>{A(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},bho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(WH),l=M(NH),s=M(no),c=M(Qn),u=uo(z.Polygon),[d,f]=m.useState((u==null?void 0:u.lineStyle)??Xh.Solid),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.Polygon&&E.id===R){E.lineStyle=H;break}})},y=(R,H,F)=>{e(E=>{for(const N of E.elements)N.type===z.Polygon&&N.parentId===R&&me.isIdentical(N.normal,H)&&!N.locked&&(N.lineStyle=F)})},S=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.Polygon&&E.foundationId===R&&!E.locked&&(E.lineStyle=H)})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&(F.lineStyle=R)})},P=R=>{l(R.target.value)},v=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const H of n)if(H.type===z.Polygon&&H.parentId===u.parentId&&me.isIdentical(H.normal,u.normal)&&!H.locked&&R!==H.lineStyle)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.Polygon&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&R!==H.lineStyle)return!0;break;default:if(R!==(u==null?void 0:u.lineStyle))return!0}return!1}},T=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.Polygon&&!E.locked&&R.has(E.id)&&(E.lineStyle=H)})},w=R=>{if(u&&v(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for Selected Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{T(F.oldValues,F.newValue)}};i(F),T(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for All Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(r(u)){const F=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&me.isIdentical(N.normal,u.normal)&&F.set(N.id,N.lineStyle??Xh.Solid);const E={name:"Set Line Style for All Polygons on Same Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of E.oldValues.entries())A(N,U)},redo:()=>{E.groupId&&y(E.groupId,E.normal,E.newValue)}};i(E),y(u.parentId,u.normal,R),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.Polygon&&E.foundationId===u.foundationId&&H.set(E.id,E.lineStyle??Xh.Solid);const F={name:"Set Line Style for All Polygons Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};i(F),S(u.foundationId,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.lineStyle:u.lineStyle,E={name:"Set Line Style of Selected Polygon",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.LineStyle",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"200px"},value:d,onChange:R=>f(R),children:[h.jsxs(g,{value:Xh.Solid,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px solid dimGray"},children:" "}),Y.t("polygonMenu.SolidLine",p)]},Xh.Solid),h.jsxs(g,{value:Xh.Dashed,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dashed dimGray"},children:" "}),Y.t("polygonMenu.DashedLine",p)]},Xh.Dashed),h.jsxs(g,{value:Xh.Dotted,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"48px",height:"1px",border:"1px dotted dimGray"},children:" "}),Y.t("polygonMenu.DottedLine",p)]},Xh.Dotted)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",p)})]})})})]})})},Sho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M(t7t),i=M(n7t),a=M(o7t),l=M(r7t),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.lineWidth)??1),y=$t(),{Option:S}=Uo,C=b=>{u(b.target.value)},P=b=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&b!==R.lineWidth)return!0;break;case re.AllObjectsOfThisType:for(const R of e)if(R.type===z.Polygon&&!R.locked&&b!==R.lineWidth)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const R of e)if(R.type===z.Polygon&&R.parentId===p.parentId&&me.isIdentical(R.normal,p.normal)&&!R.locked&&R.lineWidth!==b)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const R of e)if(R.type===z.Polygon&&R.foundationId===(p==null?void 0:p.foundationId)&&!R.locked&&R.lineWidth!==b)return!0;break;default:if(b!==(p==null?void 0:p.lineWidth))return!0}return!1}},v=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&b.has(F.id)&&(F.lineWidth=R)})},T=b=>{if(p&&P(b))switch(c){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of e)F.type===z.Polygon&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for Selected Polygons",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{v(H.oldValues,H.newValue)}};s(H),v(R,b),f(d+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of e)F.type===z.Polygon&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for All Polygons",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{l(z.Polygon,H.newValue)}};s(H),l(z.Polygon,b),f(d+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const H=new Map;for(const E of e)E.type===z.Polygon&&E.parentId===p.parentId&&me.isIdentical(E.normal,p.normal)&&H.set(E.id,E.lineWidth??1);const F={name:"Set Line Width for All Polygons on Same Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[E,N]of F.oldValues.entries())r(E,N)},redo:()=>{F.groupId&&i(z.Polygon,F.groupId,F.normal,F.newValue)}};s(F),i(z.Polygon,p.parentId,p.normal,b),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const R=new Map;for(const F of e)F.type===z.Polygon&&F.foundationId===p.foundationId&&R.set(F.id,F.lineWidth??1);const H={name:"Set Line Width for All Polygons Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:p.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&a(z.Polygon,H.groupId,H.newValue)}};s(H),a(z.Polygon,p.foundationId,b),f(d+1)}break}default:{const R=n(p.id),H=R?R.lineWidth:p.lineWidth,F={name:"Set Line Width of Selected Polygon",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(F.changedElementId,F.oldValue)},redo:()=>{r(F.changedElementId,F.newValue)}};s(F),r(p.id,b),f(d+1);break}}},w=()=>{t(!1)},x=()=>{T(g),t(!1),f(0)};return h.jsx(so,{width:560,title:Y.t("polygonMenu.LineWidth",y),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"200px"},value:g,onChange:b=>A(b),children:[h.jsx(S,{value:$y.One,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"1px solid dimGray"}})},$y.One),h.jsx(S,{value:$y.Two,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"2px solid dimGray"}})},$y.Two),h.jsx(S,{value:$y.Three,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"3px solid dimGray"}})},$y.Three),h.jsx(S,{value:$y.Four,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"4px solid dimGray"}})},$y.Four),h.jsx(S,{value:$y.Five,children:h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"24px",width:"100%",height:"1px",border:"5px solid dimGray"}})},$y.Five)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:C,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},Tho=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Gr),r=M(dYe),i=M(Kwt),a=M(qwt),l=M(fYe),s=M(En),c=M(WH),u=M(NH),d=M(no),f=M(Qn),p=uo(z.Polygon),[g,A]=m.useState((p==null?void 0:p.color)??"gray"),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&x!==b.color)return!0;break;case re.AllObjectsOfThisType:for(const b of e)if(b.type===z.Polygon&&!b.locked&&x!==b.color)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of e)if(b.type===z.Polygon&&b.foundationId===p.foundationId&&!b.locked&&b.color!==x)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const b of e)if(b.type===z.Polygon&&b.parentId===p.parentId&&me.isIdentical(b.normal,p.normal)&&!b.locked&&b.color!==x)return!0;break;default:if(x!==p.color)return!0}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Polygon&&!H.locked&&x.has(H.id)&&(H.color=b)})},v=x=>{if(p&&C(x))switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for Selected Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of e)H.type===z.Polygon&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for All Polygons",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{l(z.Polygon,R.newValue)}};s(R),l(z.Polygon,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of e)H.type===z.Polygon&&H.foundationId===p.foundationId&&b.set(H.id,H.color??"gray");const R={name:"Set Fill Color for All Polygons Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&a(z.Polygon,R.groupId,R.newValue)}};s(R),a(z.Polygon,p.foundationId,x),f(d+1)}break}case re.AllObjectsOfThisTypeOnSurface:{if(o(p)){const R=new Map;for(const F of e)F.type===z.Polygon&&F.parentId===p.parentId&&me.isIdentical(F.normal,p.normal)&&R.set(F.id,F.color??"gray");const H={name:"Set Fill Color for All Polygons on Same Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:p.parentId,normal:p.normal,undo:()=>{for(const[F,E]of H.oldValues.entries())r(F,E)},redo:()=>{H.groupId&&i(z.Polygon,H.groupId,H.normal,H.newValue)}};s(H),i(z.Polygon,p.parentId,p.normal,x),f(d+1)}break}default:{const b=n(p.id),R=b?b.color:p.color,H={name:"Set Fill Color of Selected Polygon",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}},T=()=>{t(!1)},w=()=>{v(g)};return h.jsx(so,{width:600,title:Y.t("polygonMenu.FillColor",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:h.jsx(Ld,{color:g??(p==null?void 0:p.color)??"gray",onChangeComplete:x=>{A(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:12,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",y)})]})})})]})})},Pho="/aladdin/assets/polygon_08_menu-RpvWW3pg.png",Cho="/aladdin/assets/polygon_09_menu-CCH8lYni.png",Rho="/aladdin/assets/polygon_10_menu-BYFeRpsw.png",Hho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(WH),l=M(NH),s=M(no),c=M(Qn),u=uo(z.Polygon),[d,f]=m.useState((u==null?void 0:u.textureType)??Kr.NoTexture),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Polygon&&!E.locked){E.textureType=H;break}})},y=(R,H,F)=>{e(E=>{for(const N of E.elements)N.type===z.Polygon&&N.parentId===R&&me.isIdentical(N.normal,H)&&!N.locked&&(N.textureType=F)})},S=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.Polygon&&E.foundationId===R&&!E.locked&&(E.textureType=H)})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.Polygon&&!F.locked&&(F.textureType=R)})},P=R=>{l(R.target.value)},v=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&R!==H.textureType)return!0;break;case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.Polygon&&!H.locked&&R!==H.textureType)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const H of n)if(H.type===z.Polygon&&H.parentId===u.parentId&&me.isIdentical(H.normal,u.normal)&&!H.locked&&H.textureType!==R)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.Polygon&&H.foundationId===u.foundationId&&!H.locked&&H.textureType!==R)return!0;break;default:if(R!==(u==null?void 0:u.textureType))return!0}return!1}},T=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.Polygon&&!E.locked&&R.has(E.id)&&(E.textureType=H)})},w=R=>{if(u&&v(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for Selected Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{T(F.oldValues,F.newValue)}};i(F),T(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.Polygon&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for All Polygons",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeOnSurface:{if(r(u)){const F=new Map;for(const N of n)N.type===z.Polygon&&N.parentId===u.parentId&&me.isIdentical(N.normal,u.normal)&&F.set(N.id,N.textureType??Kr.NoTexture);const E={name:"Set Texture for All Polygons on Same Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:u.normal,undo:()=>{for(const[N,U]of E.oldValues.entries())A(N,U)},redo:()=>{E.groupId&&y(E.groupId,E.normal,E.newValue)}};i(E),y(u.parentId,u.normal,R),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.Polygon&&E.foundationId===u.foundationId&&H.set(E.id,E.textureType??Kr.NoTexture);const F={name:"Set Texture for All Polygons Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};i(F),S(u.foundationId,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.textureType:u.textureType,E={name:"Set Texture of Selected Polygon",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:500,title:Y.t("polygonMenu.FillTexture",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"150px"},value:d,onChange:R=>f(R),children:[h.jsxs(g,{value:Kr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",p)]},Kr.NoTexture),h.jsxs(g,{value:Kr.Texture01,children:[h.jsx("img",{alt:Kr.Texture01,src:Qnt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture01",p)]},Kr.Texture01),h.jsxs(g,{value:Kr.Texture02,children:[h.jsx("img",{alt:Kr.Texture02,src:Znt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture02",p)]},Kr.Texture02),h.jsxs(g,{value:Kr.Texture03,children:[h.jsx("img",{alt:Kr.Texture03,src:eot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture03",p)]},Kr.Texture03),h.jsxs(g,{value:Kr.Texture04,children:[h.jsx("img",{alt:Kr.Texture04,src:tot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture04",p)]},Kr.Texture04),h.jsxs(g,{value:Kr.Texture05,children:[h.jsx("img",{alt:Kr.Texture05,src:not,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture05",p)]},Kr.Texture05),h.jsxs(g,{value:Kr.Texture06,children:[h.jsx("img",{alt:Kr.Texture06,src:oot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture06",p)]},Kr.Texture06),h.jsxs(g,{value:Kr.Texture07,children:[h.jsx("img",{alt:Kr.Texture07,src:rot,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture07",p)]},Kr.Texture07),h.jsxs(g,{value:Kr.Texture08,children:[h.jsx("img",{alt:Kr.Texture08,src:Pho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture08",p)]},Kr.Texture08),h.jsxs(g,{value:Kr.Texture09,children:[h.jsx("img",{alt:Kr.Texture09,src:Cho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture09",p)]},Kr.Texture09),h.jsxs(g,{value:Kr.Texture10,children:[h.jsx("img",{alt:Kr.Texture10,src:Rho,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("polygonMenu.Texture10",p)]},Kr.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",p)})]})})})]})})},Mho=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(WH),r=M(NH),i=M(no),a=M(Qn),l=M(Jn),s=M(pn),c=uo(z.Polygon),[u,d]=m.useState((c==null?void 0:c.opacity)!==void 0?c.opacity:1),f=$t(),p=(v,T)=>{s(w=>{for(const x of w.elements)if(x.id===v){x.opacity=T;break}})},g=v=>{for(const[T,w]of v.entries())p(T,w)},A=(v,T)=>{for(const w of v.keys())p(w,T)},y=v=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&v!==T.opacity&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Polygon&&v!==T.opacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Polygon&&T.foundationId===c.foundationId&&v!==T.opacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeOnSurface:for(const T of e)if(T.type===z.Polygon&&T.parentId===c.parentId&&me.isIdentical(T.normal,c.normal)&&v!==T.opacity&&!T.locked)return!0;break;default:if(v!==(c==null?void 0:c.opacity))return!0;break}return!1}},S=v=>{if(c&&y(v))switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)if(x.type===z.Polygon&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for Selected Polygons",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)if(x.type===z.Polygon&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const T=new Map;for(const x of e)if(x.type===z.Polygon&&x.foundationId===c.foundationId&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:c.foundationId,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1)}break}case re.AllObjectsOfThisTypeOnSurface:{if(c.parentId){const T=new Map;for(const x of e)if(x.type===z.Polygon&&x.parentId===c.parentId&&me.isIdentical(x.normal,c.normal)&&!x.locked){const b=x;T.set(x.id,b.opacity),p(b.id,v)}const w={name:"Set Opacity for All Polygons Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:c.foundationId,undo:()=>{g(w.oldValues)},redo:()=>{A(w.oldValues,w.newValue)}};n(w),a(i+1)}break}default:if(c){const T=l(c.id),w=T.opacity!==void 0?T.opacity:c.opacity!==void 0?c.opacity:1,x={name:"Set Polygon Opacity",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(c.id,v),a(i+1);break}}},C=()=>{t(!1)},P=()=>{S(u)};return h.jsx(so,{width:550,title:Y.t("polygonMenu.Opacity",f),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.1,precision:1,value:u,formatter:v=>Number(v).toFixed(1),onChange:v=>d(v)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",f),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v=>r(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("polygonMenu.OnlyThisPolygon",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("polygonMenu.AllPolygonsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("polygonMenu.AllPolygonsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("polygonMenu.AllSelectedPolygons",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("polygonMenu.AllPolygons",f)})]})})})]})})};class qR{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=me.calculatePolygonBounds(e.vertices),g=(r===vr.portrait?o.length:o.width)*a;if(s===El.upDown){const A=Math.floor(((p.maxX()-p.minX())*n.lx-g)/l),y=p.minX()+g/(2*n.lx)+d/n.lx,S=l/n.lx,C=.5*Math.abs(Math.cos(i))*g/n.lx,P={x:0,y:-.5},v={x:0,y:.5},T=void 0;for(let w=0;w<=A;w++){const x=y+w*S;P.x=v.x=x-C;const b=me.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.y-E.y);P.x=v.x=x+C;const R=me.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.y-E.y),H=Math.max(b.length,R.length)/2;if(H>0)for(let F=0;FF.x-E.x);P.y=v.y=x+C;const R=me.polygonIntersections(P,v,e.vertices).sort((F,E)=>F.x-E.x),H=Math.max(b.length,R.length)/2;if(H>0)for(let F=0;F0)return Va.makeSolarPanel(s,c,a*s.lx,(A+y)/2*s.ly,s.cz,vr.portrait,d,f,u,Qt,ko,i,void 0,S*s.ly,l)}static makeLeftRightSegment(e,n,o,r,i,a,l,s,c,u,d,f,p){const g=Math.abs(e.x-n.x)0)return Va.makeSolarPanel(s,c,(A+y)/2*s.lx,a*s.ly,s.cz,vr.portrait,d,f,u,0,ko,i,void 0,S*s.lx,l)}}class Iho{static create(e,n,o,r,i,a,l,s,c,u,d){if(n.type!==z.Foundation&&n.type!==z.Cuboid)throw new Error("base must be a foundation or cuboid");const f=[],p=!me.isZero(n.rotation[2]),g=[];for(const P of e.vertices)g.push({x:P.x*n.lx+n.cx,y:P.y*n.ly+n.cy});const A=p?me.rotatePolygon(g,n.cx,n.cy,n.rotation[2]):g,y=me.calculatePolygonBounds(A),S=(r===vr.portrait?o.length:o.width)*a,C=.5*Math.abs(Math.cos(i))*S;if(s===El.eastWest){const P=y.maxY()-y.minY(),v=Math.floor((P-2*d-S)/l),T=y.minY()+S/2+d,w={x:y.minX(),y:0},x={x:y.maxX(),y:0};for(let b=0;b<=v;b++){const R=T+b*l;w.y=x.y=R-C;const H=me.polygonIntersections(w,x,A).sort((N,U)=>N.x-U.x);w.y=x.y=R+C;const F=me.polygonIntersections(w,x,A).sort((N,U)=>N.x-U.x),E=Math.max(H.length,F.length)/2;if(E>0)for(let N=0;N0){const $=me.relativeCoordinates((B+O)/2,R,0,n),ie=Va.makeSolarPanel(n,o,$.x*n.lx,$.y*n.ly,n.cz,vr.portrait,c,u,i,-n.rotation[2],ko,[0,0,0],void 0,q,S);ie.referenceId=e.id,me.changeOrientation(ie,o,r),f.push(ie)}}}}else if(s===El.northSouth){const P=y.maxX()-y.minX(),v=Math.floor((P-2*d-S)/l),T=y.minX()+S/2+d,w={x:0,y:y.minY()},x={x:0,y:y.maxY()};for(let b=0;b<=v;b++){const R=T+b*l;w.x=x.x=R-C;const H=me.polygonIntersections(w,x,A).sort((N,U)=>N.y-U.y);w.x=x.x=R+C;const F=me.polygonIntersections(w,x,A).sort((N,U)=>N.y-U.y),E=Math.max(H.length,F.length)/2;if(E>0)for(let N=0;N0){const $=me.relativeCoordinates(R,(V+G)/2,0,n),ie=Va.makeSolarPanel(n,o,$.x*n.lx,$.y*n.ly,n.cz,vr.portrait,c,u,i,-n.rotation[2]+Qt,ko,[0,0,0],void 0,q,S);ie.referenceId=e.id,me.changeOrientation(ie,o,r),f.push(ie)}}}}return f}}const{Option:nv}=Uo,zho=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M.getState().solarPanelArrayLayoutParams,r=M(Db),i=M(Gr),a=M(DH),l=M(EH),s=M(t5),c=M(Owt),u=M(m7t),d=M(Vge),f=M(g7t),p=M(En),g=M(no),A=M(Qn),y=M(Xi),[S,C]=m.useState(!1),[P,v]=m.useState(!1),[T,w]=m.useState(!1),[x,b]=m.useState({left:0,top:0,bottom:0,right:0}),R=m.useRef(null),H=m.useRef(!0),F=m.useRef(null),E=m.useRef(null),N=m.useRef(!1),U=m.useRef(M(x4t)),W=m.useRef(M(b4t)),k=m.useRef(M(M4t)),D=m.useRef(M(H4t)),L=m.useRef(M(S4t)),j=m.useRef(M(T4t)),B=m.useRef(M(P4t)??0),O=m.useRef(M(C4t)),V=m.useRef(M(R4t)),G=$t(),q=s(U.current),$=r(),ie=m.useMemo(()=>({...l,...a}),[a,l]);m.useEffect(()=>{var ge;(ge=F.current)==null||ge.focus()},[]),m.useEffect(()=>{var ge;P&&((ge=E.current)==null||ge.focus())},[P]);const Q=(ge,Se)=>{if(R.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=R.current.getBoundingClientRect();b({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},se=()=>{const ge=(k.current===vr.portrait?q.length:q.width)*L.current;return .5*(ge*Math.abs(Math.sin(D.current)))>O.current?(co(Y.t("message.SolarPanelsCannotIntersectWithGround",G)),!1):ge>j.current?(co(Y.t("message.SolarPanelsCannotOverlapWithOneAnother",G)),!1):!0},oe=ge=>{const Se=n.filter(Re=>Re.type===z.SolarPanel&&Re.parentId===ge.parentId);if(Se.length>0)for(const Re of Se)Re.referenceId!==ge.id&&me.isPointInside(Re.cx,Re.cy,ge.vertices)&&c(Re.id,ge.id)},Z=()=>{if(($==null?void 0:$.type)===z.Polygon){const ge=i($);if(ge){const Se=[],De=W.current===El.eastWest||W.current===El.northSouth?Iho.create($,ge,q,k.current,D.current,L.current,j.current,W.current,O.current,V.current,B.current):qR.create($,ge,q,k.current,D.current,L.current,j.current,W.current,O.current,V.current,B.current);if(De.length>0){for(const ue of De)Se.push(JSON.parse(JSON.stringify(ue))),e(he=>{he.elements.push(ue)});const Ae={name:"Solar Panel Array Layout",timestamp:Date.now(),oldElements:M.getState().deletedElements,newElements:Se,oldParams:{pvModelName:o.pvModelName,rowAxis:o.rowAxis,orientation:o.orientation,tiltAngle:o.tiltAngle,rowsPerRack:o.rowsPerRack,interRowSpacing:o.interRowSpacing,poleHeight:o.poleHeight,poleSpacing:o.poleSpacing,margin:o.margin},newParams:{pvModelName:U.current,rowAxis:W.current,orientation:k.current,tiltAngle:D.current,rowsPerRack:L.current,interRowSpacing:j.current,poleHeight:O.current,poleSpacing:V.current,margin:B.current},referenceId:$.id,undo:()=>{d(Ae.referenceId,!1),Ae.oldElements.length>0&&e(ue=>{for(const he of Ae.oldElements)ue.elements.push(he)}),te(Ae.oldParams),ee()},redo:()=>{d(Ae.referenceId,!1),Ae.newElements.length>0&&e(ue=>{for(const he of Ae.newElements)ue.elements.push(he)}),te(Ae.newParams),ee()}};p(Ae),A(g+1)}}H.current=!1,ee()}},te=ge=>{U.current=ge.pvModelName,W.current=ge.rowAxis,k.current=ge.orientation,D.current=ge.tiltAngle,L.current=ge.rowsPerRack,j.current=ge.interRowSpacing,O.current=ge.poleHeight,V.current=ge.poleSpacing,B.current=ge.margin??0},ee=()=>{e(ge=>{ge.solarPanelArrayLayoutParams.pvModelName=U.current,ge.solarPanelArrayLayoutParams.rowAxis=W.current,ge.solarPanelArrayLayoutParams.orientation=k.current,ge.solarPanelArrayLayoutParams.tiltAngle=D.current,ge.solarPanelArrayLayoutParams.rowsPerRack=L.current,ge.solarPanelArrayLayoutParams.interRowSpacing=j.current,ge.solarPanelArrayLayoutParams.poleHeight=O.current,ge.solarPanelArrayLayoutParams.poleSpacing=V.current,ge.solarPanelArrayLayoutParams.margin=B.current})},de=()=>{H.current&&(se()?$&&(oe($),u($.id)>0?v(!0):(f(),Z())):co(Y.t("polygonMenu.LayoutNotAcceptedCheckYourParameters",G)))},fe=()=>{de(),N.current=!1},pe=()=>{t(!1),y(),H.current=!0,N.current=!1},ye=()=>{H.current?(de(),N.current=!0):t(!1)},ae=()=>{v(!1)},Te=()=>{$&&(d($.id,!0),Z(),N.current&&(t(!1),A(0))),v(!1)};return h.jsxs(h.Fragment,{children:[P&&h.jsx(yi,{width:400,open:P,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:Y.t("word.Reminder",G)}),footer:[h.jsx(io,{onClick:ae,children:Y.t("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:E,onClick:Te,children:Y.t("word.OK",G)},"OK")],children:Y.t("message.ExistingSolarPanelsWillBeRemovedBeforeApplyingNewLayout",G)+" "+Y.t("message.DoYouWantToContinue",G)}),h.jsxs(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),children:Y.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",G)}),footer:[h.jsx(io,{disabled:!H.current,onClick:fe,children:Y.t("word.Apply",G)},"Apply"),h.jsx(io,{onClick:pe,children:Y.t("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:F,onClick:ye,children:Y.t("word.OK",G)},"OK")],onCancel:()=>{t(!1),H.current=!0},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!T,bounds:x,onStart:(Se,Re)=>Q(Se,Re),children:h.jsx("div",{ref:R,children:ge})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px",paddingTop:"10px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(ie).length+" "+Y.t("word.Options",G)+"):"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:U.current,onChange:ge=>{ge!==null&&(U.current=ge,H.current=!0,C(!S))},children:Object.keys(ie).map(ge=>h.jsx(nv,{value:ge,children:ge+(ie[ge].bifacialityFactor>0?" ("+Y.t("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{style:{width:"100%"},value:W.current,onChange:ge=>{ge!==null&&(W.current=ge,H.current=!0,C(!S))},children:[h.jsx(nv,{value:El.leftRight,children:Y.t("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(nv,{value:El.upDown,children:Y.t("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown),h.jsx(nv,{value:El.eastWest,children:Y.t("polygonMenu.SolarPanelArrayEastWestRowAxis",G)},El.eastWest),h.jsx(nv,{value:El.northSouth,children:Y.t("polygonMenu.SolarPanelArrayNorthSouthRowAxis",G)},El.northSouth)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{style:{width:"100%"},value:k.current,onChange:ge=>{ge!==null&&(k.current=ge,H.current=!0,C(!S))},children:[h.jsx(nv,{value:vr.portrait,children:Y.t("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(nv,{value:vr.landscape,children:Y.t("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayTiltAngle",G)+" ([-90°, 90°]): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:-90,max:90,style:{width:"100%"},precision:2,value:parseFloat(me.toDegrees(D.current).toFixed(2)),step:1,formatter:ge=>`${ge}°`,onChange:ge=>{ge!==null&&(D.current=me.toRadians(ge),H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayRowWidth",G)+" ([1-100] "+Y.t("solarPanelMenu.Panels",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:1,max:100,step:1,style:{width:"100%"},precision:0,formatter:ge=>Number(ge).toFixed(0),value:L.current,onChange:ge=>{ge!==null&&(L.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayInterRowSpacing",G)+" ([1, 20] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:1,max:20,style:{width:"100%"},precision:2,value:j.current,step:.5,onChange:ge=>{ge!==null&&(j.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayMargin",G)+" ([0, 5] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:0,max:5,style:{width:"100%"},precision:1,value:B.current,step:.1,onChange:ge=>{ge!==null&&(B.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayPoleHeight",G)+" ([0, 10] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:0,max:10,style:{width:"100%"},precision:2,value:O.current,step:.1,onChange:ge=>{ge!==null&&(O.current=ge,H.current=!0,C(!S))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("polygonMenu.SolarPanelArrayPoleSpacing",G)+" ([2, 50] "+Y.t("word.MeterAbbreviation",G)+"): "}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{min:2,max:50,style:{width:"100%"},precision:2,value:V.current,step:.5,onChange:ge=>{ge!==null&&(V.current=ge,H.current=!0,C(!S))}})})]})]})]})},{Option:Yh}=Uo,Dho=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(DH),a=M(EH),l=M(c3),s=M(Gr),c=M(s3),u=M(bA).geneticAlgorithmParams,d=M(c$),f=M(xxt),p=M(a$),[g,A]=m.useState(!1),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=m.useRef(u.objectiveFunctionType),w=m.useRef(u.selectionMethod),x=m.useRef(u.searchMethod),b=m.useRef(u.populationSize),R=m.useRef(u.maximumGenerations),H=m.useRef(u.mutationRate),F=m.useRef(u.selectionRate??.5),E=m.useRef(u.crossoverRate??.5),N=m.useRef(u.convergenceThreshold),U=m.useRef(u.localSearchRadius),W=m.useRef(d.minimumTiltAngle??-Qt),k=m.useRef(d.maximumTiltAngle??Qt),D=m.useRef(d.minimumRowsPerRack),L=m.useRef(d.maximumRowsPerRack),j=m.useRef(d.minimumInterRowSpacing),B=m.useRef(d.maximumInterRowSpacing),O=m.useRef(null),V=m.useMemo(()=>({...a,...i}),[i,a]);m.useEffect(()=>{var ge;(ge=O.current)==null||ge.focus()},[]);const G={lng:o},q=m.useRef(d.rowAxis??El.leftRight),$=l?s(l):void 0,ie=$?c(z.SolarPanel,$.id):void 0,Q=m.useRef(ie&&ie.length>0?ie[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),se=m.useRef(ie&&ie.length>0?ie[0].orientation:d.orientation??vr.landscape),oe=m.useRef(ie&&ie.length>0?ie[0].poleHeight:d.poleHeight??1),Z=m.useRef(ie&&ie.length>0?ie[0].poleSpacing:d.poleSpacing??3),te=m.useRef(d.margin??0),ee=m.useRef(p.electricitySellingPrice),de=m.useRef(p.operationalCostPerUnit);m.useEffect(()=>{ee.current=p.electricitySellingPrice},[p.electricitySellingPrice]),m.useEffect(()=>{de.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const fe=(ge,Se)=>{if(v.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=v.current.getBoundingClientRect();P({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},pe=()=>{e(ge=>{ge.evolutionaryAlgorithmState.geneticAlgorithmParams.problem=Ri.SOLAR_PANEL_ARRAY,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.objectiveFunctionType=T.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionMethod=w.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.searchMethod=x.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.populationSize=b.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.maximumGenerations=R.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.selectionRate=F.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.crossoverRate=E.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.mutationRate=H.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.convergenceThreshold=N.current,ge.evolutionaryAlgorithmState.geneticAlgorithmParams.localSearchRadius=U.current,ge.solarPanelArrayLayoutConstraints||(ge.solarPanelArrayLayoutConstraints=new mX),ge.solarPanelArrayLayoutConstraints.minimumRowsPerRack=D.current,ge.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,ge.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,ge.solarPanelArrayLayoutConstraints.maximumTiltAngle=k.current,ge.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,ge.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=B.current,ge.solarPanelArrayLayoutConstraints.poleHeight=oe.current,ge.solarPanelArrayLayoutConstraints.poleSpacing=Z.current,ge.solarPanelArrayLayoutConstraints.pvModelName=Q.current,ge.solarPanelArrayLayoutConstraints.rowAxis=q.current,ge.solarPanelArrayLayoutConstraints.orientation=se.current,ge.solarPanelArrayLayoutConstraints.margin=te.current,ge.economicsParams.operationalCostPerUnit=de.current,ge.economicsParams.electricitySellingPrice=ee.current})},ye=()=>{r||gn(ae("message.EvolutionStarted",G)),pe(),setTimeout(()=>{dt.getState().set(ge=>{ge.runEvolution=!ge.runEvolution}),e(ge=>{ge.evolutionMethod=_s.GENETIC_ALGORITHM,n&&(ge.actionInfo={name:"Run Genetic Algorithm for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...M.getState().evolutionaryAlgorithmState.geneticAlgorithmParams,...M.getState().solarPanelArrayLayoutConstraints,...M.getState().economicsParams}})})},100)},{t:ae}=Xl(),Te=[{key:"1",label:ae("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.Objective",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:T.current,style:{width:"100%"},value:T.current,onChange:ge=>{T.current=ge,A(!g)},children:[h.jsx(Yh,{value:Po.DAILY_TOTAL_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Po.DAILY_TOTAL_OUTPUT),h.jsx(Yh,{value:Po.YEARLY_TOTAL_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Po.YEARLY_TOTAL_OUTPUT),h.jsx(Yh,{value:Po.DAILY_AVERAGE_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Po.DAILY_AVERAGE_OUTPUT),h.jsx(Yh,{value:Po.YEARLY_AVERAGE_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Po.YEARLY_AVERAGE_OUTPUT),h.jsx(Yh,{value:Po.DAILY_PROFIT,children:ae("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Po.DAILY_PROFIT),h.jsx(Yh,{value:Po.YEARLY_PROFIT,children:ae("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Po.YEARLY_PROFIT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.GeneticAlgorithmSelectionMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:w.current,style:{width:"100%"},value:w.current,onChange:ge=>{w.current=ge,A(!g)},children:[h.jsx(Yh,{value:Wm.ROULETTE_WHEEL,children:ae("optimizationMenu.RouletteWheel",G)},Wm.ROULETTE_WHEEL),h.jsx(Yh,{value:Wm.TOURNAMENT,children:ae("optimizationMenu.Tournament",G)},Wm.TOURNAMENT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.PopulationSize",G)+" [10, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:b.current,step:1,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{ge!==null&&(b.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.MaximumGenerations",G)+" [5, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:R.current,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{ge!==null&&(R.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.SelectionRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:F.current,step:.01,onChange:ge=>{ge!==null&&(F.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.CrossoverRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:E.current,step:.01,onChange:ge=>{ge!==null&&(E.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.MutationRate",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:H.current,step:.01,onChange:ge=>{ge!==null&&(H.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:ge=>{ge!==null&&(N.current=Number(ge),A(!g))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:x.current,style:{width:"100%"},value:x.current,onChange:ge=>{x.current=Number(ge),A(!g)},children:[h.jsx(Yh,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ae("optimizationMenu.GlobalSearchUniformSelection",G)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(Yh,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ae("optimizationMenu.LocalSearchRandomOptimization",G)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),x.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:ge=>{ge!==null&&(U.current=Number(ge),A(!g))}})})]})]})},{key:"2",label:ae("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{W.current=me.toRadians(ge[0]),k.current=me.toRadians(ge[1]),A(!g)},min:-90,max:90,defaultValue:[me.toDegrees(W.current),me.toDegrees(k.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{D.current=ge[0],L.current=ge[1],A(!g)},min:1,max:9,defaultValue:[D.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{j.current=ge[0],B.current=ge[1],A(!g)},min:1,max:10,defaultValue:[j.current,B.current],marks:{1:{style:{fontSize:"10px"},label:"1m"},3:{style:{fontSize:"10px"},label:"3m"},5:{style:{fontSize:"10px"},label:"5m"},7:{style:{fontSize:"10px"},label:"7m"},9:{style:{fontSize:"10px"},label:"9m"}}})})]})]})},{key:"3",label:ae("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(V).length+" "+ae("word.Options",G)+"):"}),h.jsx(Ke,{span:12,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:Q.current,onChange:ge=>{Q.current=ge,A(!g)},children:Object.keys(V).map(ge=>h.jsx(Yh,{value:ge,children:ge+(V[ge].bifacialityFactor>0?" ("+ae("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:ge=>{q.current=ge,A(!g)},children:[h.jsx(Yh,{value:El.leftRight,children:ae("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(Yh,{value:El.upDown,children:ae("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:se.current,onChange:ge=>{se.current=ge,A(!g)},children:[h.jsx(Yh,{value:vr.portrait,children:ae("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(Yh,{value:vr.landscape,children:ae("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{te.current=ge,A(!g)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{oe.current=ge,A(!g)},min:0,max:10,step:.1,defaultValue:oe.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{Z.current=ge,A(!g)},min:2,max:10,step:.1,defaultValue:Z.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{de.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:de.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{ee.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:ee.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:ae("optimizationMenu.SolarPanelArrayLayout",G)+": "+ae("optimizationMenu.GeneticAlgorithmSettings",G)}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:ae("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:O,onClick:()=>{ye(),t(!1)},children:ae("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(Se,Re)=>fe(Se,Re),children:h.jsx("div",{ref:v,children:ge})}),children:h.jsx(hQ,{defaultActiveKey:f,items:Te,type:"card",onChange:ge=>{e(Se=>{Se.geneticAlgorithmWizardSelectedTab=ge})}})})})},{Option:O1}=Uo,Eho=({setDialogVisible:t})=>{const e=M(pn),n=M(oa),o=M(m0),r=dt(n5),i=M(DH),a=M(EH),l=M(c3),s=M(Gr),c=M(s3),u=M(bA).particleSwarmOptimizationParams,d=M(c$),f=M(bxt),p=M(a$),[g,A]=m.useState(!1),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T=m.useRef(u.objectiveFunctionType),w=m.useRef(u.searchMethod),x=m.useRef(u.swarmSize),b=m.useRef(u.maximumSteps),R=m.useRef(u.vmax??.01),H=m.useRef(u.inertia??.8),F=m.useRef(u.cognitiveCoefficient??.1),E=m.useRef(u.socialCoefficient??.1),N=m.useRef(u.convergenceThreshold),U=m.useRef(u.localSearchRadius),W=m.useRef(d.minimumTiltAngle??-Qt),k=m.useRef(d.maximumTiltAngle??Qt),D=m.useRef(d.minimumRowsPerRack),L=m.useRef(d.maximumRowsPerRack),j=m.useRef(d.minimumInterRowSpacing),B=m.useRef(d.maximumInterRowSpacing),O=m.useRef(null),V=m.useMemo(()=>({...a,...i}),[i,a]);m.useEffect(()=>{var ge;(ge=O.current)==null||ge.focus()},[]);const G={lng:o},q=m.useRef(d.rowAxis??El.leftRight),$=l?s(l):void 0,ie=$?c(z.SolarPanel,$.id):void 0,Q=m.useRef(ie&&ie.length>0?ie[0].pvModelName:d.pvModelName??"CS6X-355P-FG"),se=m.useRef(ie&&ie.length>0?ie[0].orientation:d.orientation??vr.landscape),oe=m.useRef(ie&&ie.length>0?ie[0].poleHeight:d.poleHeight??1),Z=m.useRef(ie&&ie.length>0?ie[0].poleSpacing:d.poleSpacing??3),te=m.useRef(d.margin??0),ee=m.useRef(p.electricitySellingPrice),de=m.useRef(p.operationalCostPerUnit);m.useEffect(()=>{ee.current=p.electricitySellingPrice},[p.electricitySellingPrice]),m.useEffect(()=>{de.current=p.operationalCostPerUnit},[p.operationalCostPerUnit]);const fe=(ge,Se)=>{if(v.current){const{clientWidth:Re,clientHeight:De}=window.document.documentElement,Ae=v.current.getBoundingClientRect();P({left:-Ae.left+Se.x,right:Re-(Ae.right-Se.x),top:-Ae.top+Se.y,bottom:De-((Ae==null?void 0:Ae.bottom)-Se.y)})}},pe=()=>{e(ge=>{ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.problem=Ri.SOLAR_PANEL_ARRAY,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.objectiveFunctionType=T.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.searchMethod=w.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.swarmSize=x.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.maximumSteps=b.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.cognitiveCoefficient=F.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.socialCoefficient=E.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.vmax=R.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.inertia=H.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.convergenceThreshold=N.current,ge.evolutionaryAlgorithmState.particleSwarmOptimizationParams.localSearchRadius=U.current,ge.solarPanelArrayLayoutConstraints||(ge.solarPanelArrayLayoutConstraints=new mX),ge.solarPanelArrayLayoutConstraints.minimumRowsPerRack=D.current,ge.solarPanelArrayLayoutConstraints.maximumRowsPerRack=L.current,ge.solarPanelArrayLayoutConstraints.minimumTiltAngle=W.current,ge.solarPanelArrayLayoutConstraints.maximumTiltAngle=k.current,ge.solarPanelArrayLayoutConstraints.minimumInterRowSpacing=j.current,ge.solarPanelArrayLayoutConstraints.maximumInterRowSpacing=B.current,ge.solarPanelArrayLayoutConstraints.poleHeight=oe.current,ge.solarPanelArrayLayoutConstraints.poleSpacing=Z.current,ge.solarPanelArrayLayoutConstraints.pvModelName=Q.current,ge.solarPanelArrayLayoutConstraints.rowAxis=q.current,ge.solarPanelArrayLayoutConstraints.orientation=se.current,ge.solarPanelArrayLayoutConstraints.margin=te.current,ge.economicsParams.operationalCostPerUnit=de.current,ge.economicsParams.electricitySellingPrice=ee.current})},ye=()=>{r||gn(ae("message.EvolutionStarted",G)),pe(),setTimeout(()=>{dt.getState().set(ge=>{ge.runEvolution=!ge.runEvolution}),e(ge=>{ge.evolutionMethod=_s.PARTICLE_SWARM_OPTIMIZATION,n&&(ge.actionInfo={name:"Run Particle Swarm Optimization for Solar Panel Array Layout",timestamp:new Date().getTime(),details:{...M.getState().evolutionaryAlgorithmState.particleSwarmOptimizationParams,...M.getState().solarPanelArrayLayoutConstraints,...M.getState().economicsParams}})})},100)},{t:ae}=Xl(),Te=[{key:"1",label:ae("optimizationMenu.Parameters",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.Objective",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:T.current,style:{width:"100%"},value:T.current,onChange:ge=>{T.current=ge,A(!g)},children:[h.jsx(O1,{value:Po.DAILY_TOTAL_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionDailyTotalYield",G)},Po.DAILY_TOTAL_OUTPUT),h.jsx(O1,{value:Po.YEARLY_TOTAL_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionYearlyTotalYield",G)},Po.YEARLY_TOTAL_OUTPUT),h.jsx(O1,{value:Po.DAILY_AVERAGE_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionDailyMeanYield",G)},Po.DAILY_AVERAGE_OUTPUT),h.jsx(O1,{value:Po.YEARLY_AVERAGE_OUTPUT,children:ae("optimizationMenu.ObjectiveFunctionYearlyMeanYield",G)},Po.YEARLY_AVERAGE_OUTPUT),h.jsx(O1,{value:Po.DAILY_PROFIT,children:ae("optimizationMenu.ObjectiveFunctionDailyProfit",G)},Po.DAILY_PROFIT),h.jsx(O1,{value:Po.YEARLY_PROFIT,children:ae("optimizationMenu.ObjectiveFunctionYearlyProfit",G)},Po.YEARLY_PROFIT)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.SwarmSize",G)+" [10, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:10,max:100,style:{width:"100%"},precision:0,value:x.current,step:1,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{x.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.MaximumSteps",G)+" [5, 100]:"}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:5,max:100,step:1,style:{width:"100%"},precision:0,value:b.current,formatter:ge=>Number(ge).toFixed(0),onChange:ge=>{b.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.CognitiveCoefficient",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:F.current,step:.01,onChange:ge=>{F.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.SocialCoefficient",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:E.current,step:.01,onChange:ge=>{E.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.InertiaWeight",G)+" [0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:H.current,step:.01,onChange:ge=>{H.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.MaximumVelocity",G)+" [0.001, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:R.current,step:.001,onChange:ge=>{R.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.ConvergenceThreshold",G)+" (0, 0.1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:.001,max:.1,style:{width:"100%"},precision:3,value:N.current,step:.001,onChange:ge=>{N.current=Number(ge),A(!g)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.SearchMethod",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{defaultValue:w.current,style:{width:"100%"},value:w.current,onChange:ge=>{w.current=Number(ge),A(!g)},children:[h.jsx(O1,{value:ds.GLOBAL_SEARCH_UNIFORM_SELECTION,children:ae("optimizationMenu.GlobalSearchUniformSelection",G)},ds.GLOBAL_SEARCH_UNIFORM_SELECTION),h.jsx(O1,{value:ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION,children:ae("optimizationMenu.LocalSearchRandomOptimization",G)},ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)]})})]}),w.current===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION&&h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.LocalSearchRadius",G)+" ([0, 1]: "}),h.jsx(Ke,{span:12,children:h.jsx(Sn,{min:0,max:1,style:{width:"100%"},precision:2,value:U.current,step:.01,onChange:ge=>{U.current=Number(ge),A(!g)}})})]})]})},{key:"2",label:ae("optimizationMenu.Variables",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.TiltAngleRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{W.current=me.toRadians(ge[0]),k.current=me.toRadians(ge[1]),A(!g)},min:-90,max:90,defaultValue:[me.toDegrees(W.current),me.toDegrees(k.current)],marks:{"-90":{style:{fontSize:"10px"},label:"-90°"},"-45":{style:{fontSize:"10px"},label:"-45°"},0:{style:{fontSize:"10px"},label:"0°"},45:{style:{fontSize:"10px"},label:"45°"},90:{style:{fontSize:"10px"},label:"90°"}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.RowsPerRackRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{D.current=ge[0],L.current=ge[1],A(!g)},min:1,max:9,defaultValue:[D.current,L.current],marks:{1:{style:{fontSize:"10px"},label:1},2:{style:{fontSize:"10px"},label:2},3:{style:{fontSize:"10px"},label:3},4:{style:{fontSize:"10px"},label:4},5:{style:{fontSize:"10px"},label:5},6:{style:{fontSize:"10px"},label:6},7:{style:{fontSize:"10px"},label:7},8:{style:{fontSize:"10px"},label:8},9:{style:{fontSize:"10px"},label:9}}})})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:12,children:ae("optimizationMenu.InterRowSpacingRange",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{range:!0,onChange:ge=>{j.current=ge[0],B.current=ge[1],A(!g)},min:2,max:10,defaultValue:[j.current,B.current],marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]})]})},{key:"3",label:ae("optimizationMenu.Constants",G),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"0px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayModel",G)+" ("+Object.keys(V).length+" "+ae("word.Options",G)+"):"}),h.jsx(Ke,{span:12,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:Q.current,onChange:ge=>{Q.current=ge,A(!g)},children:Object.keys(V).map(ge=>h.jsx(O1,{value:ge,children:ge+(V[ge].bifacialityFactor>0?" ("+ae("pvModelPanel.Bifacial",G)+")":"")},ge))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayRowAxis",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:ge=>{q.current=ge,A(!g)},children:[h.jsx(O1,{value:El.leftRight,children:ae("polygonMenu.SolarPanelArrayLeftRightRowAxis",G)},El.leftRight),h.jsx(O1,{value:El.upDown,children:ae("polygonMenu.SolarPanelArrayUpDownRowAxis",G)},El.upDown)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"6px",paddingTop:"8px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayOrientation",G)+":"}),h.jsx(Ke,{span:12,children:h.jsxs(Uo,{style:{width:"100%"},value:se.current,onChange:ge=>{se.current=ge,A(!g)},children:[h.jsx(O1,{value:vr.portrait,children:ae("solarPanelMenu.Portrait",G)},vr.portrait),h.jsx(O1,{value:vr.landscape,children:ae("solarPanelMenu.Landscape",G)},vr.landscape)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("polygonMenu.SolarPanelArrayMargin",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{te.current=ge,A(!g)},min:0,max:5,step:.1,defaultValue:te.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},1:{style:{fontSize:"10px"},label:"1m"},2:{style:{fontSize:"10px"},label:"2m"},3:{style:{fontSize:"10px"},label:"3m"},4:{style:{fontSize:"10px"},label:"4m"},5:{style:{fontSize:"10px"},label:"5m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("solarCollectorMenu.PoleHeight",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{oe.current=ge,A(!g)},min:0,max:10,step:.1,defaultValue:oe.current,marks:{0:{style:{fontSize:"10px"},label:"0m"},2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("solarPanelMenu.PoleSpacing",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{Z.current=ge,A(!g)},min:2,max:10,step:.1,defaultValue:Z.current,marks:{2:{style:{fontSize:"10px"},label:"2m"},4:{style:{fontSize:"10px"},label:"4m"},6:{style:{fontSize:"10px"},label:"6m"},8:{style:{fontSize:"10px"},label:"8m"},10:{style:{fontSize:"10px"},label:"10m"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("economicsPanel.OperationalCostPerUnit",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{de.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:de.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"0px",paddingTop:"12px"},children:[h.jsx(Ke,{span:12,children:ae("economicsPanel.ElectricitySellingPrice",G)+":"}),h.jsx(Ke,{span:12,children:h.jsx(Iu,{style:{paddingBottom:0,paddingTop:0,marginTop:"16px",marginBottom:"16px"},onChange:ge=>{ee.current=ge,A(!g)},min:.1,max:1,step:.01,defaultValue:ee.current,marks:{.1:{style:{fontSize:"10px"},label:"10¢"},.3:{style:{fontSize:"10px"},label:"30¢"},.5:{style:{fontSize:"10px"},label:"50¢"},.7:{style:{fontSize:"10px"},label:"70¢"},.9:{style:{fontSize:"10px"},label:"90¢"}}})})]})]})}];return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:ae("optimizationMenu.SolarPanelArrayLayout",G)+": "+ae("optimizationMenu.ParticleSwarmOptimizationSettings",G)}),footer:[h.jsx(io,{onClick:()=>{t(!1)},children:ae("word.Cancel",G)},"Cancel"),h.jsx(io,{type:"primary",ref:O,onClick:()=>{ye(),t(!1)},children:ae("word.Run",G)},"Run")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:ge=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(Se,Re)=>fe(Se,Re),children:h.jsx("div",{ref:v,children:ge})}),children:h.jsx(hQ,{defaultActiveKey:f,items:Te,type:"card",onChange:ge=>{e(Se=>{Se.particleSwarmOptimizationWizardSelectedTab=ge})}})})})},Fho=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o=M.getState().getParent(n),r={lng:M.getState().language},i=!n.locked;return e.push({key:"polygon-paste",label:h.jsx(oM,{})}),e.push({key:"polygon-copy",label:h.jsx(Fd,{})}),i&&e.push({key:"polygon-cut",label:h.jsx(kd,{})}),o&&(o.type===z.Foundation||o.type===z.Cuboid)&&e.push({key:"polygon-layout-submenu",label:h.jsx(an,{children:Y.t("polygonMenu.Layout",r)}),children:[{key:"solar-panel-layout-wizard",label:h.jsxs(eo,{noPadding:!0,Dialog:zho,children:[Y.t("polygonMenu.SolarPanelArrayLayoutParametricDesign",r)," ..."]})},{key:"solar-panel-layout-ai",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.SolarPanelArrayLayoutGenerativeDesign",r)}),children:[{key:"solar-panel-layout-ga",label:h.jsxs(eo,{noPadding:!0,Dialog:Dho,children:[Y.t("optimizationMenu.GeneticAlgorithm",r)," ..."]})},{key:"solar-panel-layout-pso",label:h.jsxs(eo,{noPadding:!0,Dialog:Eho,children:[Y.t("optimizationMenu.ParticleSwarmOptimization",r)," ..."]})}]}]}),e.push({key:"polygon-lock",label:h.jsx(Ku,{selectedElement:n})}),i&&(e.push({key:"polygon-filled",label:h.jsx(dho,{polygon:n})}),n.filled&&e.push({key:"polygon-shiny",label:h.jsx(fho,{polygon:n})}),e.push({key:"polygon-no-outline",label:h.jsx(hho,{polygon:n})})),i&&(e.push({key:"polygon-line-color",label:h.jsxs(eo,{Dialog:xho,children:[Y.t("polygonMenu.LineColor",r)," ..."]})},{key:"polygon-line-style",label:h.jsxs(eo,{Dialog:bho,children:[Y.t("polygonMenu.LineStyle",r)," ..."]})},{key:"polygon-line-width",label:h.jsxs(eo,{Dialog:Sho,children:[Y.t("polygonMenu.LineWidth",r)," ..."]})}),n.filled&&((!n.textureType||n.textureType===Kr.NoTexture)&&e.push({key:"polygon-fill-color",label:h.jsxs(eo,{Dialog:Tho,children:[Y.t("polygonMenu.FillColor",r)," ..."]})}),e.push({key:"polygon-texture",label:h.jsxs(eo,{Dialog:Hho,children:[Y.t("polygonMenu.FillTexture",r)," ..."]})},{key:"polygon-opacity",label:h.jsxs(eo,{Dialog:Mho,children:[Y.t("polygonMenu.Opacity",r)," ..."]})})),e.push({key:"polygon-text-box",label:h.jsx(an,{children:Y.t("polygonMenu.TextBox",r)}),children:[{key:"polygon-text",label:h.jsx(pho,{polygon:n})},{key:"polygon-font-size",label:h.jsx(gho,{polygon:n})},{key:"polygon-font-color",label:h.jsx(mho,{polygon:n})},{key:"polygon-font-outline-color",label:h.jsx(yho,{polygon:n})},{key:"polygon-font-outline-width",label:h.jsx(Aho,{polygon:n})},{key:"polygon-font-stroke-color",label:h.jsx(who,{polygon:n})},{key:"polygon-font-stroke-width",label:h.jsx(vho,{polygon:n})}]})),{items:e}},kho=(t,e)=>{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){o.vertices.splice(e,1);break}})},Lho=(t,e)=>{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>0&&e{M.getState().set(n=>{for(const o of n.elements)if(o.type===z.Polygon&&o.id===t){const r=o,i=r.vertices.length;if(e>=0&&e{if(t.selectedIndex>=0){const n=t.vertices.map(i=>({...i}));switch(e){case hx.Delete:kho(t.id,t.selectedIndex);break;case hx.InsertBeforeIndex:Lho(t.id,t.selectedIndex);break;case hx.InsertAfterIndex:Who(t.id,t.selectedIndex);break}const o=M.getState().getElementById(t.id).vertices.map(i=>({...i})),r={name:e,timestamp:Date.now(),changedElementId:t.id,changedElementType:t.type,oldValue:n,newValue:o,undo:()=>{r.oldValue&&Array.isArray(r.oldValue)&&M.getState().updatePolygonVerticesById(r.changedElementId,n)},redo:()=>{M.getState().updatePolygonVerticesById(r.changedElementId,o)}};M.getState().addUndoable(r)}},Nho=t=>{const e=[];if(t.type!==z.Polygon)return{items:e};const n=t,o={lng:M.getState().language};return e.push({key:"polygon-vertex-insert-before-index",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.InsertVertexBeforeIndex",o)})},{key:"polygon-vertex-insert-after-index",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.InsertVertexAfterIndex",o)})}),n.vertices.length>3&&e.push({key:"polygon-vertex-delete",label:h.jsx(an,{noPadding:!0,children:Y.t("polygonMenu.DeleteVertex",o)})}),{items:e,onClick:({key:i})=>{switch(i){case"polygon-vertex-insert-before-index":Vae(n,hx.InsertBeforeIndex);break;case"polygon-vertex-insert-after-index":Vae(n,hx.InsertAfterIndex);break;case"polygon-vertex-delete":Vae(n,hx.Delete);break}}}},Uho=({sensor:t})=>{const e=$t(),n=aot(t);return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.showLabel,onChange:n,children:Y.t("labelSubMenu.KeepShowingLabel",e)})})},jho=({sensor:t})=>{const e=$t(),{labelText:n,setLabelText:o}=iot(t),r=lot(t,n);return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"80px"},children:Y.t("labelSubMenu.LabelText",e)+":"}),h.jsx(jl,{style:{width:"150px"},value:n,onChange:i=>o(i.target.value),onPressEnter:r,onBlur:r})]})},Bho=t=>{const e=[];if(t.type!==z.Sensor)return{items:e};const n=t,o=!n.locked;return e.push({key:"sensor-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"sensor-cut",label:h.jsx(kd,{})}),e.push({key:"sensor-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"sensor-show-label",label:h.jsx(Uho,{sensor:n})}),e.push({key:"sensor-label-text",label:h.jsx(jho,{sensor:n})})),{items:e}},Yho=({light:t})=>{const e=$t(),n=M.getState().updateInsideLightById,o=r=>{const i=r.target.checked,a={name:"Inside Light",timestamp:Date.now(),checked:i,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.inside,onChange:o,children:Y.t("lightMenu.Inside",e)})})},Oho=({light:t})=>{const e=$t(),n=t.intensity??3,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.intensity=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Intensity",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),o(t.id,i),M.getState().set(l=>{l.actionState.lightIntensity=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"80px"},children:[Y.t("lightMenu.Intensity",e),":"]}),h.jsx(Sn,{min:.1,max:10,step:.1,precision:1,value:n,onChange:r})]})},Vho=({light:t})=>{const e=$t(),n=t.distance??5,o=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.type===z.Light&&s.id===i){s.distance=a;break}})},r=i=>{if(i===null||i===n)return;const a={name:"Set Light Distance",timestamp:Date.now(),oldValue:n,newValue:i,changedElementId:t.id,undo:()=>{o(a.changedElementId,a.oldValue)},redo:()=>{o(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),o(t.id,i),M.getState().set(l=>{l.actionState.lightDistance=i})};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"80px"},children:[Y.t("lightMenu.MaximumDistance",e),":"]}),h.jsx(Sn,{min:1,max:10,step:1,precision:1,value:n,onChange:r})]})},_ho=({light:t})=>{const e=t.color??"#ffff99",n=(o,r)=>{M.getState().set(i=>{for(const a of i.elements)if(a.type===z.Light&&a.id===o){a.color=r;break}})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Ld,{color:e,onChangeComplete:o=>{const r=t.color,i=o.hex,a={name:"Set Light Color",timestamp:Date.now(),oldValue:r,newValue:i,undo:()=>{n(t.id,a.oldValue)},redo:()=>{n(t.id,a.newValue)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.lightColor=i})}})})},Gho=t=>{const e=[];if(t.type!==z.Light)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=n.parentId?M.getState().getParent(n):void 0;return e.push({key:"light-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"light-cut",label:h.jsx(kd,{})}),e.push({key:"light-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&i&&(i.type===z.Roof||i.type===z.Wall)&&e.push({key:"light-inside",label:h.jsx(Yho,{light:n})}),o&&e.push({key:"light-intensity",label:h.jsx(Oho,{light:n})},{key:"light-distance",label:h.jsx(Vho,{light:n})},{key:"light-color",label:h.jsx(an,{children:Y.t("word.Color",r)}),children:[{key:"light-color-picker",label:h.jsx(_ho,{light:n}),style:{backgroundColor:"white"}}]}),{items:e}},Xho=()=>{const t=M(bge),e=$t(),n=r=>{M.getState().set(i=>{i.viewState.axes=r})},o=r=>{const i=r.target.checked,a={name:"Show Axes",timestamp:Date.now(),checked:i,undo:()=>{n(!a.checked)},redo:()=>{n(a.checked)}};M.getState().addUndoable(a),n(i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.Axes",e)})})},Jho=()=>{const t=M(SBe),e=$t(),n=i=>{M.getState().set(a=>{a.viewState.theme=i})},o=i=>{const a=t,l=i.target.value,s={name:"Select Theme",timestamp:Date.now(),oldValue:a,newValue:l,undo:()=>{n(s.oldValue)},redo:()=>{n(s.newValue)}};M.getState().addUndoable(s),n(l)},r=[{value:Os.Default,label:"skyMenu.ThemeDefault"},{value:Os.Desert,label:"skyMenu.ThemeDesert"},{value:Os.Dune,label:"skyMenu.ThemeDune"},{value:Os.Forest,label:"skyMenu.ThemeForest"},{value:Os.Grassland,label:"skyMenu.ThemeGrassland"},{value:Os.Hill,label:"skyMenu.ThemeHill"},{value:Os.Lake,label:"skyMenu.ThemeLake"},{value:Os.Mountain,label:"skyMenu.ThemeMountain"},{value:Os.Rural,label:"skyMenu.ThemeRural"}];return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t,onChange:o,children:h.jsx(on,{direction:"vertical",children:r.map((i,a)=>h.jsx(Le,{style:{width:"100%"},value:i.value,children:Y.t(i.label,e)},`${a}-${i.value}`))})})})},Kho=()=>{const t=M(TBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showAzimuthAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Azimuth Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowAzimuthAngle",e)})})},qho=()=>{const t=M(PBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showElevationAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Elevation Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowElevationAngle",e)})})},$ho=()=>{const t=M(CBe)??!0,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.showZenithAngle=r})},o=r=>{const i=t,a=r.target.checked,l={name:"Show Zenith Angle "+a,timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t,onChange:o,children:Y.t("skyMenu.ShowZenithAngle",e)})})},Qho=()=>{const t=M(bBe)??3.5,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.directLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Direct Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.DirectLightBrightnessAtNoon",e)+" [0.1-10]:"}),h.jsx(Sn,{min:.1,max:10,step:.1,precision:2,value:t,onChange:o})]})},Zho=()=>{const t=M(xBe)??.2,e=$t(),n=r=>{M.getState().set(i=>{i.viewState.ambientLightIntensity=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Ambient Light Intensity",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.AmbientLightBrightnessAtNoon",e)+" [0.01-1]:"}),h.jsx(Sn,{min:.01,max:1,step:.01,precision:2,value:t,onChange:o})]})},epo=()=>{const t=M(T8t)??.01,e=$t(),n=r=>{M.getState().set(i=>{i.world.airAttenuationCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Sunlight Attenuation Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.SunlightAttenuationCoefficientInAir",e)+":"}),h.jsx(Sn,{min:0,max:.1,step:.001,precision:3,value:t,onChange:o})]})},tpo=()=>{const t=M(P8t)??5,e=$t(),n=r=>{M.getState().set(i=>{i.world.airConvectiveCoefficient=r})},o=r=>{if(r===null)return;const i=t,a=r,l={name:"Set Convective Coefficient of Air",timestamp:Date.now(),oldValue:i,newValue:a,undo:()=>{n(l.oldValue)},redo:()=>{n(l.newValue)}};M.getState().addUndoable(l),n(a)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.ConvectiveCoefficientOfAir",e)+" [W/(m²×K)]:"}),h.jsx(Sn,{min:2.5,max:20,step:.1,precision:2,value:t,onChange:o})]})},npo=()=>{const t=M(gW)??900,e=M.getState().world,n=$t(),o=m.useMemo(()=>dl(new Date(e.date),e.latitude),[e.date,e.latitude]),r=a=>{M.getState().set(l=>{l.world.highestTemperatureTimeInMinutes=a})},i=a=>{if(a===null)return;const l=t,s=a,c={name:"Set Time of Highest Temperature in Minutes",timestamp:Date.now(),oldValue:l,newValue:s,undo:()=>{r(c.oldValue)},redo:()=>{r(c.newValue)}};M.getState().addUndoable(c),r(s)};return h.jsxs(an,{stayAfterClick:!0,children:[h.jsx(on,{style:{width:"270px"},children:Y.t("skyMenu.HighestTemperatureTimeInMinutes",n)+":"}),h.jsx(Sn,{min:720,max:o.sunset,step:5,precision:0,value:t,onChange:i})]})},opo=()=>{const t={lng:M.getState().language},e=[];return e.push({key:"axes",label:h.jsx(Xho,{})}),e.push({key:"theme-submenu",label:h.jsx(an,{children:Y.t("skyMenu.Theme",t)}),children:[{key:"theme-radio-group",label:h.jsx(Jho,{}),style:{backgroundColor:"white"}}]}),e.push({key:"sun-angles-submenu",label:h.jsx(an,{children:Y.t("skyMenu.SelectSunAnglesToShow",t)}),children:[{key:"show-azimuth-angle",label:h.jsx(Kho,{})},{key:"ShowElevationAngle",label:h.jsx(qho,{})},{key:"ShowZenithAngle",label:h.jsx($ho,{})}]}),e.push({key:"direct-light-intensity",label:h.jsx(Qho,{})}),e.push({key:"ambient-light-intensity",label:h.jsx(Zho,{})}),e.push({key:"air-attenuation-coefficient",label:h.jsx(epo,{})}),e.push({key:"air-convective-coefficient",label:h.jsx(tpo,{})}),e.push({key:"highest-temperature-time-in-minutes",label:h.jsx(npo,{})}),{items:e}},DK=class DK{constructor(){this.n=14,this.nominalStrings=new Array(this.n),this.nominalWidths=new Array(this.n),this.nominalHeights=new Array(this.n),this.cellNx=new Array(this.n),this.cellNy=new Array(this.n),this.nominalWidths[0]=.99,this.nominalHeights[0]=1.65,this.cellNx[0]=6,this.cellNy[0]=10,this.nominalWidths[1]=.99,this.nominalHeights[1]=1.96,this.cellNx[1]=6,this.cellNy[1]=12,this.nominalWidths[2]=1.05,this.nominalHeights[2]=1.56,this.cellNx[2]=8,this.cellNy[2]=12,this.nominalWidths[3]=1.31,this.nominalHeights[3]=1.96,this.cellNx[3]=8,this.cellNy[3]=12,this.nominalWidths[4]=1.07,this.nominalHeights[4]=2.07,this.cellNx[4]=8,this.cellNy[4]=16,this.nominalWidths[5]=.6,this.nominalHeights[5]=1.2,this.cellNx[5]=10,this.cellNy[5]=20,this.nominalWidths[6]=1.2,this.nominalHeights[6]=2,this.cellNx[6]=10,this.cellNy[6]=20,this.nominalWidths[7]=1,this.nominalHeights[7]=2.07,this.cellNx[7]=6,this.cellNy[7]=12,this.nominalWidths[8]=.8,this.nominalHeights[8]=1.56,this.cellNx[8]=6,this.cellNy[8]=12,this.nominalWidths[9]=.83,this.nominalHeights[9]=1.58,this.cellNx[9]=6,this.cellNy[9]=12,this.nominalWidths[10]=.99,this.nominalHeights[10]=1.31,this.cellNx[10]=6,this.cellNy[10]=8,this.nominalWidths[11]=.99,this.nominalHeights[11]=1.5,this.cellNx[11]=6,this.cellNy[11]=9,this.nominalWidths[12]=1.05,this.nominalHeights[12]=1.81,this.cellNx[12]=8,this.cellNy[12]=14,this.nominalWidths[13]=1.05,this.nominalHeights[13]=1.69,this.cellNx[13]=8,this.cellNy[13]=13;for(let e=0;e{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(DH),a=M(EH),l=M(t5),s=M(En),c=M(xh),u=M(bh),d=M(no),f=M(Qn),p=uo(),[g,A]=m.useState((p==null?void 0:p.pvModelName)??"SPR-X21-335-BLK"),[y,S]=m.useState(),C=$t(),P=m.useMemo(()=>({...a,...i}),[i,a]),v=l(g??"SPR-X21-335-BLK");m.useEffect(()=>{S(v.nominalWidth.toFixed(2)+"m×"+v.nominalLength.toFixed(2)+"m ("+v.n+"×"+v.m+" "+Y.t("pvModelPanel.Cells",C)+")")},[v]);const T=(W,k)=>{e(D=>{for(const L of D.elements)if(L.type===z.SolarPanel&&L.id===W&&!L.locked){const j=L;j.pvModelName=k;let B=D.supportedPvModules[k];if(B||(B=D.customPvModules[k]),j.orientation===vr.portrait){const O=Math.max(1,Math.round(j.lx/B.width)),V=Math.max(1,Math.round(j.ly/B.length));j.lx=O*B.width,j.ly=V*B.length}else{const O=Math.max(1,Math.round(j.lx/B.length)),V=Math.max(1,Math.round(j.ly/B.width));j.lx=O*B.length,j.ly=V*B.width}break}})},w=(W,k)=>{e(D=>{let L=D.supportedPvModules[k];L||(L=D.customPvModules[k]);for(const j of D.elements)if(j.type===z.SolarPanel&&j.foundationId===W&&!j.locked){const B=j;if(B.pvModelName=k,B.orientation===vr.portrait){const O=Math.max(1,Math.round(B.lx/L.width)),V=Math.max(1,Math.round(B.ly/L.length));B.lx=O*L.width,B.ly=V*L.length}else{const O=Math.max(1,Math.round(B.lx/L.length)),V=Math.max(1,Math.round(B.ly/L.width));B.lx=O*L.length,B.ly=V*L.width}}})},x=(W,k,D)=>{e(L=>{let j=L.supportedPvModules[D];j||(j=L.customPvModules[D]);for(const B of L.elements)if(B.type===z.SolarPanel&&!B.locked){let O;if(k?O=B.parentId===W&&me.isIdentical(B.normal,k):O=B.parentId===W,O){const V=B;if(V.pvModelName=D,V.orientation===vr.portrait){const G=Math.max(1,Math.round(V.lx/j.width)),q=Math.max(1,Math.round(V.ly/j.length));V.lx=G*j.width,V.ly=q*j.length}else{const G=Math.max(1,Math.round(V.lx/j.length)),q=Math.max(1,Math.round(V.ly/j.width));V.lx=G*j.length,V.ly=q*j.width}}}})},b=W=>{e(k=>{let D=k.supportedPvModules[W];D||(D=k.customPvModules[W]);for(const L of k.elements)if(L.type===z.SolarPanel&&!L.locked){const j=L;if(j.pvModelName=W,j.orientation===vr.portrait){const B=Math.max(1,Math.round(j.lx/D.width)),O=Math.max(1,Math.round(j.ly/D.length));j.lx=B*D.width,j.ly=O*D.length}else{const B=Math.max(1,Math.round(j.lx/D.length)),O=Math.max(1,Math.round(j.ly/D.width));j.lx=B*D.length,j.ly=O*D.width}}})},R=(W,k)=>{M.getState().set(D=>{let L=D.supportedPvModules[k];L||(L=D.customPvModules[k]);for(const j of D.elements)if(j.type===z.SolarPanel&&!j.locked&&W.has(j.id)){const B=j;if(B.pvModelName=k,B.orientation===vr.portrait){const O=Math.max(1,Math.round(B.lx/L.width)),V=Math.max(1,Math.round(B.ly/L.length));B.lx=O*L.width,B.ly=V*L.length}else{const O=Math.max(1,Math.round(B.lx/L.length)),V=Math.max(1,Math.round(B.ly/L.width));B.lx=O*L.length,B.ly=V*L.width}}})},H=W=>{u(W.target.value)},F=W=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const k of n)if(k.type===z.SolarPanel&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisType:{for(const k of n)if(k.type===z.SolarPanel&&!k.locked&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&k.pvModelName!==W)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const k=r(p);if(k){if(k.type===z.Cuboid){for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&me.isIdentical(L.normal,p.normal)&&!L.locked&&L.pvModelName!==W)return!0}else for(const L of n)if(L.type===z.SolarPanel&&L.parentId===p.parentId&&!L.locked&&L.pvModelName!==W)return!0}break}default:{if((p==null?void 0:p.pvModelName)!==W)return!0;break}}return!1}},E=W=>{if(p&&F(W)){switch(c){case re.AllSelectedObjectsOfThisType:{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.pvModelName);const D={name:"Set Model for Selected Solar Panels",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{R(D.oldValues,D.newValue)}};s(D),R(k,W),f(d+1);break}case re.AllObjectsOfThisType:{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.pvModelName);const D={name:"Set Model for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{b(D.newValue)}};s(D),b(W),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===p.foundationId&&k.set(L.id,L.pvModelName);const D={name:"Set Model for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())T(L,j)},redo:()=>{D.groupId&&w(D.groupId,D.newValue)}};s(D),w(p.foundationId,W),f(d+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const k=r(p);if(k){const D=new Map,L=k.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&me.isIdentical(O.normal,p.normal)&&D.set(O.id,O.pvModelName);else for(const O of n)O.type===z.SolarPanel&&O.parentId===p.parentId&&D.set(O.id,O.pvModelName);const j=L?p.normal:void 0,B={name:"Set Model for All Solar Panels on Surface",timestamp:Date.now(),oldValues:D,newValue:W,groupId:p.parentId,normal:j,undo:()=>{for(const[O,V]of B.oldValues.entries())T(O,V)},redo:()=>{B.groupId&&x(B.groupId,B.normal,B.newValue)}};s(B),x(p.parentId,j,W),f(d+1)}break}default:{const k=o(p.id),D=k?k.pvModelName:p.pvModelName,L={name:"Set Model for Selected Solar Panel",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{T(L.changedElementId,L.oldValue)},redo:()=>{T(L.changedElementId,L.newValue)}};s(L),T(p.id,W),f(d+1);break}}e(k=>{k.actionState.solarPanelModelName=W})}},N=()=>{t(!1)},U=()=>{E(g)};return h.jsxs(so,{width:640,title:Y.t("pvModelPanel.SolarPanelSpecs",C),onApply:U,onClose:N,children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.Model",C)+" ("+Object.keys(P).length+" "+Y.t("word.Options",C)+"):"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{defaultValue:"Custom",style:{width:"100%"},value:g,onChange:A,children:Object.keys(P).map(W=>h.jsx(ov,{value:W,children:W+(P[W].bifacialityFactor>0?" ("+Y.t("pvModelPanel.Bifacial",C)+")":"")},W))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.PanelSize",C)+":"}),h.jsx(Ke,{span:11,children:h.jsx(Uo,{disabled:!0,style:{width:"100%"},value:y,onChange:W=>{},children:wfe.instance.nominalStrings.map(W=>h.jsx(ov,{value:W,children:W},W))})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.CellType",C)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{disabled:!0,style:{width:"100%"},value:v.cellType,onChange:W=>{},children:[h.jsx(ov,{value:"Monocrystalline",children:Y.t("pvModelPanel.Monocrystalline",C)},"Monocrystalline"),h.jsx(ov,{value:"Polycrystalline",children:Y.t("pvModelPanel.Polycrystalline",C)},"Polycrystalline"),h.jsx(ov,{value:"Thin Film",children:Y.t("pvModelPanel.ThinFilm",C)},"Thin Film")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.PowerBifaciality",C)+":"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:2,value:v.bifacialityFactor,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("word.Color",C)+":"}),h.jsx(Ke,{span:11,children:h.jsxs(Uo,{disabled:!0,style:{width:"100%"},value:v.color,onChange:W=>{},children:[h.jsx(ov,{value:"Black",children:Y.t("pvModelPanel.Black",C)},"Black"),h.jsx(ov,{value:"Blue",children:Y.t("pvModelPanel.Blue",C)},"Blue")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.SolarCellEfficiency",C)+" (%):"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:2,value:100*v.efficiency,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.NominalOperatingCellTemperature",C)+" (°C):"}),h.jsx(Ke,{span:11,children:h.jsx(Sn,{disabled:!0,style:{width:"100%"},precision:1,value:v.noct,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:13,children:Y.t("pvModelPanel.TemperatureCoefficientOfPmax",C)+" (%/°C):"}),h.jsx(Ke,{span:11,children:h.jsx(jl,{disabled:!0,style:{width:"100%"},value:v.pmaxTC,onChange:W=>{}})})]}),h.jsxs(nn,{gutter:6,style:{border:"2px dashed #ccc",marginTop:"6px",marginLeft:"0",marginRight:"0",paddingLeft:"8px",paddingTop:"8px",paddingBottom:"8px"},children:[h.jsx(Ke,{span:3,children:Y.t("word.ApplyTo",C)+":"}),h.jsx(Ke,{span:21,children:h.jsx(Le.Group,{onChange:H,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})]})},{Option:FHe}=Uo,ipo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(Uge),l=M(En),s=M(xh),c=M(bh),u=M(no),d=M(Qn),f=M(Xi),p=uo(),[g,A]=m.useState((p==null?void 0:p.orientation)??vr.portrait),y=m.useRef(!1),S=m.useRef(),C=$t(),P=(j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&V.id===j&&!V.locked){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B);break}})},v=(j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&V.foundationId===j&&!V.locked){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B)}})},T=(j,B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked){let q;if(B?q=G.parentId===j&&me.isIdentical(G.normal,B):q=G.parentId===j,q){const $=G;let ie=V.supportedPvModules[$.pvModelName];ie||(ie=V.customPvModules[$.pvModelName]),V.setSolarPanelOrientation($,ie,O)}}})},w=j=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarPanel&&!O.locked){const V=O;let G=B.supportedPvModules[V.pvModelName];G||(G=B.customPvModules[V.pvModelName]),B.setSolarPanelOrientation(V,G,j)}})},x=(j,B)=>{M.getState().set(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked&&j.has(V.id)){const G=V;let q=O.supportedPvModules[G.pvModelName];q||(q=O.customPvModules[G.pvModelName]),O.setSolarPanelOrientation(G,q,B)}})},b=j=>{c(j.target.value)},R=j=>{if(p){const B=r(p.pvModelName);if(j===vr.portrait){const O=Math.max(1,Math.round(p.lx/B.width)),V=Math.max(1,Math.round(p.ly/B.length));a(p.id,O*B.width,V*B.length)}else{const O=Math.max(1,Math.round(p.lx/B.length)),V=Math.max(1,Math.round(p.ly/B.width));a(p.id,O*B.length,V*B.width)}P(p.id,j)}},H=(j,B)=>{const O=i(j);if(O){if(O.type===z.Cuboid&&!me.isIdentical(j.normal,as))return!0;const V=JSON.parse(JSON.stringify(j));V.orientation=B;const G=r(V.pvModelName);if(B===vr.portrait){const q=Math.max(1,Math.round(V.lx/G.width)),$=Math.max(1,Math.round(V.ly/G.length));V.lx=q*G.width,V.ly=$*G.length}else{const q=Math.max(1,Math.round(V.lx/G.length)),$=Math.max(1,Math.round(V.ly/G.width));V.lx=q*G.length,V.ly=$*G.width}return O.type===z.Wall?me.checkElementOnWallState(V,O)===pa.Valid:O.type===z.Roof?me.checkElementOnRoofState(V,O)===pa.Valid:me.isSolarCollectorWithinHorizontalSurface(V,O)}return!1},F=(j,B)=>!H(j,B),E=j=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:{for(const B of n)if(B.type===z.SolarPanel&&!B.locked&&M.getState().selectedElementIdSet.has(B.id)&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisType:{for(const B of n)if(B.type===z.SolarPanel&&!B.locked&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const B of n)if(B.type===z.SolarPanel&&B.foundationId===(p==null?void 0:p.foundationId)&&!B.locked&&B.orientation!==j)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const B=i(p);if(B){if(B.type===z.Cuboid){for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&me.isIdentical(V.normal,p.normal)&&!V.locked&&V.orientation!==j)return!0}else for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&!V.locked&&V.orientation!==j)return!0}break}default:{if((p==null?void 0:p.orientation)!==j)return!0;break}}return!1}},N=j=>{if(p&&E(j)){switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(B.id)&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(V.id)&&B.set(V.id,V.orientation);const O={name:"Set Orientation for Selected Solar Panels",timestamp:Date.now(),oldValues:B,newValue:j,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{x(O.oldValues,O.newValue)}};l(O),x(B,j),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&B.set(V.id,V.orientation);const O={name:"Set Orientation for All Solar Panels",timestamp:Date.now(),oldValues:B,newValue:j,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{w(O.newValue)}};l(O),w(j),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const B of n)if(B.type===z.SolarPanel&&B.foundationId===p.foundationId&&F(B,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const B=new Map;for(const V of n)V.type===z.SolarPanel&&V.foundationId===p.foundationId&&B.set(V.id,V.orientation);const O={name:"Set Orientation for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:B,newValue:j,groupId:p.foundationId,undo:()=>{for(const[V,G]of O.oldValues.entries())P(V,G)},redo:()=>{O.groupId&&v(O.groupId,O.newValue)}};l(O),v(p.foundationId,j),d(u+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const B=i(p);if(B){if(y.current=!1,B.type===z.Cuboid){for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&me.isIdentical(V.normal,p.normal)&&F(V,j)){y.current=!0;break}}else for(const V of n)if(V.type===z.SolarPanel&&V.parentId===p.parentId&&F(V,j)){y.current=!0;break}if(y.current)S.current=j,A(p.orientation);else{const V=new Map,G=B.type===z.Cuboid;if(G)for(const ie of n)ie.type===z.SolarPanel&&ie.parentId===p.parentId&&me.isIdentical(ie.normal,p.normal)&&V.set(ie.id,ie.orientation);else for(const ie of n)ie.type===z.SolarPanel&&ie.parentId===p.parentId&&V.set(ie.id,ie.orientation);const q=G?p.normal:void 0,$={name:"Set Orientation for All Solar Panels on Surface",timestamp:Date.now(),oldValues:V,newValue:j,groupId:p.parentId,normal:q,undo:()=>{for(const[ie,Q]of $.oldValues.entries())P(ie,Q)},redo:()=>{$.groupId&&T($.groupId,$.normal,$.newValue)}};l($),T(p.parentId,q,j),d(u+1)}}break}default:{const B=o(p.id),O=B?B.orientation:p.orientation;if(y.current=!1,y.current)S.current=j,A(O);else{const V={name:"Set Orientation of Selected Solar Panel",timestamp:Date.now(),oldValue:O,newValue:j,changedElementId:p.id,changedElementType:p.type,undo:()=>{R(V.oldValue)},redo:()=>{R(V.newValue)}};l(V),R(j),d(u+1)}break}}e(B=>{B.actionState.solarPanelOrientation=j})}},U=()=>{p&&(A(p.orientation),y.current=!1,t(!1))},W=()=>{U(),f()},k=()=>{N(g),y.current||(t(!1),d(0))},D=()=>{N(g)},L=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current?" ("+(S.current===vr.portrait?Y.t("solarPanelMenu.Portrait",C):Y.t("solarPanelMenu.Landscape",C))+")":""):"";return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.Orientation",C),rejectedMessage:L,onApply:D,onClose:U,onClickCancel:W,onClickOk:k,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsxs(Uo,{style:{width:"150px"},value:g,onChange:j=>A(j),children:[h.jsx(FHe,{value:vr.portrait,children:Y.t("solarPanelMenu.Portrait",C)},vr.portrait),h.jsx(FHe,{value:vr.landscape,children:Y.t("solarPanelMenu.Landscape",C)},vr.landscape)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:b,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",C)})]})})})]})})},apo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(En),l=M(xh),s=M(bh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),[p,g]=m.useState((f==null?void 0:f.lx)??1),[A,y]=m.useState(0),S=m.useRef(!1),C=m.useRef(),P=$t();m.useEffect(()=>{if(f){const B=r(f.pvModelName)??r("SPR-X21-335-BLK");y(f.orientation===vr.portrait?B.width:B.length)}},[f]);const v=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.id===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.lx=me.panelizeLx(q,$,O);break}})},T=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.foundationId===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.lx=me.panelizeLx(q,$,O)}})},w=(B,O,V)=>{e(G=>{for(const q of G.elements)if(q.type===z.SolarPanel&&!q.locked){let $;if(O?$=q.parentId===B&&me.isIdentical(q.normal,O):$=q.parentId===B,$){const ie=q,Q=G.getPvModule(ie.pvModelName);q.lx=me.panelizeLx(ie,Q,V)}}})},x=B=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){const G=V,q=O.getPvModule(G.pvModelName);V.lx=me.panelizeLx(G,q,B)}})},b=(B,O)=>{M.getState().set(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked&&B.has(G.id)){const q=G,$=V.getPvModule(q.pvModelName);G.lx=me.panelizeLx(q,$,O)}})},R=B=>{s(B.target.value)},H=(B,O)=>{const V=i(B);if(V){if(V.type===z.Cuboid&&!me.isIdentical(B.normal,as))return!0;const G=JSON.parse(JSON.stringify(B));return G.lx=O,V.type===z.Wall?me.checkElementOnWallState(G,V)===pa.Valid:V.type===z.Roof?me.checkElementOnRoofState(G,V)===pa.Valid:me.isSolarCollectorWithinHorizontalSurface(G,V)}return!1},F=(B,O)=>!H(B,O),E=B=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.lx-B)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&me.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.lx-B)>Et)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.lx-B)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.lx)-B)>Et)return!0;break}}return!1}},N=B=>{if(f&&E(B))switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const V={name:"Set Length for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{b(V.oldValues,V.newValue)}};a(V),b(O,B),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.lx);const V={name:"Set Length for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{x(V.newValue)}};a(V),x(B),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.lx);const V={name:"Set Length for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:B,groupId:f.foundationId,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{V.groupId&&T(V.groupId,V.newValue)}};a(V),T(f.foundationId,B),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(S.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&me.isIdentical(G.normal,f.normal)&&F(G,B)){S.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&F(G,B)){S.current=!0;break}if(S.current)C.current=B,g(f.lx);else{const G=new Map,q=O.type===z.Cuboid;if(q)for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&me.isIdentical(Q.normal,f.normal)&&G.set(Q.id,Q.lx);else for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&G.set(Q.id,Q.lx);const $=q?f.normal:void 0,ie={name:"Set Length for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:B,groupId:f.parentId,normal:$,undo:()=>{for(const[Q,se]of ie.oldValues.entries())v(Q,se)},redo:()=>{ie.groupId&&w(ie.groupId,ie.normal,ie.newValue)}};a(ie),w(f.parentId,$,B),u(c+1)}}break}default:{const O=o(f.id),V=O?O.lx:f.lx;if(S.current=F(f,B),S.current)C.current=B,g(V);else{const G={name:"Set Solar Panel Array Length",timestamp:Date.now(),oldValue:V,newValue:B,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(G.changedElementId,G.oldValue)},redo:()=>{v(G.changedElementId,G.newValue)}};a(G),v(f.id,B),u(c+1)}break}}},U=B=>{let O=B??1;return O=Math.max(1,Math.ceil((O-A/2)/A))*A,O},W=()=>{S.current=!1,t(!1)},k=()=>{W(),d()},D=()=>{N(p),S.current||(t(!1),u(0))},L=()=>{N(p)},j=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",P),rejectedMessage:j,onApply:L,onClose:W,onClickCancel:k,onClickOk:D,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:A,max:100*A,step:A,style:{width:120},precision:2,value:p,onChange:B=>{B!==null&&g(U(B))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/A)+" "+Y.t("solarPanelMenu.PanelsWide",P),h.jsx("br",{}),Y.t("word.MaximumNumber",P),": 100 ",Y.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},lpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(t5),i=M(Gr),a=M(En),l=M(xh),s=M(bh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),[p,g]=m.useState((f==null?void 0:f.ly)??2),[A,y]=m.useState(0),S=m.useRef(!1),C=m.useRef(),P=$t();m.useEffect(()=>{if(f){const B=r(f.pvModelName)??r("SPR-X21-335-BLK");y(f.orientation===vr.portrait?B.length:B.width),g(f.ly)}},[f]);const v=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.id===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.ly=me.panelizeLy(q,$,O);break}})},T=(B,O)=>{e(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&G.foundationId===B&&!G.locked){const q=G,$=V.getPvModule(q.pvModelName);G.ly=me.panelizeLy(q,$,O)}})},w=(B,O,V)=>{e(G=>{for(const q of G.elements)if(q.type===z.SolarPanel&&!q.locked){let $;if(O?$=q.parentId===B&&me.isIdentical(q.normal,O):$=q.parentId===B,$){const ie=q,Q=G.getPvModule(ie.pvModelName);q.ly=me.panelizeLy(ie,Q,V)}}})},x=B=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){const G=V,q=O.getPvModule(G.pvModelName);V.ly=me.panelizeLy(G,q,B)}})},b=(B,O)=>{M.getState().set(V=>{for(const G of V.elements)if(G.type===z.SolarPanel&&!G.locked&&B.has(G.id)){const q=G,$=V.getPvModule(q.pvModelName);G.ly=me.panelizeLy(q,$,O)}})},R=B=>{s(B.target.value)},H=(B,O)=>{const V=i(B);if(V){if(V.type===z.Cuboid&&!me.isIdentical(B.normal,as))return!0;const G=JSON.parse(JSON.stringify(B));return G.ly=O,V.type===z.Wall?me.checkElementOnWallState(G,V)===pa.Valid:V.type===z.Roof?me.checkElementOnRoofState(G,V)===pa.Valid:me.isSolarCollectorWithinHorizontalSurface(G,V)}return!1},F=(B,O)=>B.tiltAngle!==0&&.5*O*Math.abs(Math.sin(B.tiltAngle))>B.poleHeight||!H(B,O),E=B=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const O of n)if(O.type===z.SolarPanel&&!O.locked&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===(f==null?void 0:f.foundationId)&&!O.locked&&Math.abs(O.ly-B)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&me.isIdentical(G.normal,f.normal)&&!G.locked&&Math.abs(G.ly-B)>Et)return!0}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&!G.locked&&Math.abs(G.ly-B)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.ly)-B)>Et)return!0;break}}return!1}},N=B=>{if(f&&E(B))switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(G.id)&&O.set(G.id,G.ly);const V={name:"Set Width for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{b(V.oldValues,V.newValue)}};a(V),b(O,B),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&O.set(G.id,G.ly);const V={name:"Set Width for All Solar Panel Arrays",timestamp:Date.now(),oldValues:O,newValue:B,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{x(V.newValue)}};a(V),x(B),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const O of n)if(O.type===z.SolarPanel&&O.foundationId===f.foundationId&&F(O,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const O=new Map;for(const G of n)G.type===z.SolarPanel&&G.foundationId===f.foundationId&&O.set(G.id,G.ly);const V={name:"Set Width for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:O,newValue:B,groupId:f.foundationId,undo:()=>{for(const[G,q]of V.oldValues.entries())v(G,q)},redo:()=>{V.groupId&&T(V.groupId,V.newValue)}};a(V),T(f.foundationId,B),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const O=i(f);if(O){if(S.current=!1,O.type===z.Cuboid){for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&me.isIdentical(G.normal,f.normal)&&F(G,B)){S.current=!0;break}}else for(const G of n)if(G.type===z.SolarPanel&&G.parentId===f.parentId&&F(G,B)){S.current=!0;break}if(S.current)C.current=B,g(f.ly);else{const G=new Map,q=O.type===z.Cuboid;if(q)for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&me.isIdentical(Q.normal,f.normal)&&G.set(Q.id,Q.ly);else for(const Q of n)Q.type===z.SolarPanel&&Q.parentId===f.parentId&&G.set(Q.id,Q.ly);const $=q?f.normal:void 0,ie={name:"Set Width for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:G,newValue:B,groupId:f.parentId,normal:$,undo:()=>{for(const[Q,se]of ie.oldValues.entries())v(Q,se)},redo:()=>{ie.groupId&&w(ie.groupId,ie.normal,ie.newValue)}};a(ie),w(f.parentId,$,B),u(c+1)}}break}default:{const O=o(f.id),V=O?O.ly:f.ly;if(S.current=F(f,B),S.current)C.current=B,g(V);else{const G={name:"Set Solar Panel Array Width",timestamp:Date.now(),oldValue:V,newValue:B,changedElementId:f.id,changedElementType:f.type,undo:()=>{v(G.changedElementId,G.oldValue)},redo:()=>{v(G.changedElementId,G.newValue)}};a(G),v(f.id,B),u(c+1)}break}}},U=()=>{S.current=!1,t(!1)},W=()=>{U(),d()},k=()=>{N(p),S.current||(t(!1),u(0))},D=B=>{let O=B??1;return O=Math.max(1,Math.ceil((O-A/2)/A))*A,O},L=()=>{N(p)},j=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Width",P),rejectedMessage:j,onApply:L,onClose:U,onClickCancel:W,onClickOk:k,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:A,max:100*A,step:A,style:{width:120},precision:2,value:p,onChange:B=>{B!==null&&g(D(B))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Math.round(p/A)+" "+Y.t("solarPanelMenu.PanelsLong",P),h.jsx("br",{}),Y.t("word.MaximumNumber",P),": 100 ",Y.t("solarPanelMenu.Panels",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:R,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},spo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(xh),l=M(bh),s=M(no),c=M(Qn),u=M(b=>b.elements.find(R=>R.selected&&R.type===z.SolarPanel)),[d,f]=m.useState((u==null?void 0:u.inverterEfficiency)??.95),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){F.inverterEfficiency=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&F.foundationId===b&&!F.locked&&(F.inverterEfficiency=R)})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;R?N=E.parentId===b&&me.isIdentical(E.normal,R):N=E.parentId===b,N&&(E.inverterEfficiency=H)}})},S=b=>{e(R=>{for(const H of R.elements)H.type===z.SolarPanel&&!H.locked&&(H.inverterEfficiency=b)})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&b.has(F.id)&&(F.inverterEfficiency=R)})},P=b=>{l(b.target.value)},v=b=>{switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs((R.inverterEfficiency??.95)-b)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&me.isIdentical(F.normal,u.normal)&&!F.locked&&Math.abs((F.inverterEfficiency??.95)-b)>Et)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&Math.abs((F.inverterEfficiency??.95)-b)>Et)return!0}break}default:{if(Math.abs(((u==null?void 0:u.inverterEfficiency)??.95)-b)>Et)return!0;break}}return!1},T=b=>{if(u&&v(b))switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.inverterEfficiency??.95);const H={name:"Set Inverter Efficiency for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&me.isIdentical(U.normal,u.normal)&&H.set(U.id,U.inverterEfficiency??.95);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.inverterEfficiency??.95);const E=F?u.normal:void 0,N={name:"Set Inverter Efficiency for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.inverterEfficiency??.95:u.inverterEfficiency??.95,F={name:"Set Solar Panel Array Inverter Efficiency",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}},w=()=>{t(!1)},x=()=>{T(d)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.InverterEfficiency",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.5,max:1,step:.01,style:{width:120},precision:2,value:d,onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[0.5, 1.0]",h.jsx("br",{}),Y.t("solarPanelMenu.InverterEfficiencyExplained",p)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},cpo=({setDialogVisible:t})=>{const e=M(pn),n=M(m0),o=M(Kn),r=M(Jn),i=M(Gr),a=M(En),l=M(xh),s=M(bh),c=M(no),u=M(Qn),d=M(Xi),f=M(L=>L.elements.find(j=>j.selected&&j.type===z.SolarPanel)),[p,g]=m.useState(!1),[A,y]=m.useState(!1),[S,C]=m.useState({left:0,top:0,bottom:0,right:0}),P=m.useRef(null),v=m.useRef((f==null?void 0:f.dcToAcRatio)??1),T={lng:n};m.useEffect(()=>{f&&(v.current=f.dcToAcRatio??1)},[f.dcToAcRatio]);const w=(L,j)=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarPanel&&O.id===L&&!O.locked){O.dcToAcRatio=j;break}})},x=(L,j)=>{e(B=>{for(const O of B.elements)O.type===z.SolarPanel&&O.foundationId===L&&!O.locked&&(O.dcToAcRatio=j)})},b=(L,j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarPanel&&!V.locked){let G;j?G=V.parentId===L&&me.isIdentical(V.normal,j):G=V.parentId===L,G&&(V.dcToAcRatio=B)}})},R=L=>{e(j=>{for(const B of j.elements)B.type===z.SolarPanel&&!B.locked&&(B.dcToAcRatio=L)})},H=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.SolarPanel&&!O.locked&&L.has(O.id)&&(O.dcToAcRatio=j)})},F=L=>{s(L.target.value),g(!p)},E=L=>{switch(l){case re.AllSelectedObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const j of o)if(j.type===z.SolarPanel&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const j of o)if(j.type===z.SolarPanel&&j.foundationId===(f==null?void 0:f.foundationId)&&!j.locked&&Math.abs((j.dcToAcRatio??1)-L)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){if(j.type===z.Cuboid){for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&me.isIdentical(O.normal,f.normal)&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Et)return!0}else for(const O of o)if(O.type===z.SolarPanel&&O.parentId===f.parentId&&!O.locked&&Math.abs((O.dcToAcRatio??1)-L)>Et)return!0}break}default:{if(Math.abs(((f==null?void 0:f.dcToAcRatio)??1)-L)>Et)return!0;break}}return!1},N=L=>{if(f&&E(L)){switch(l){case re.AllSelectedObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{H(B.oldValues,B.newValue)}};a(B),H(j,L),u(c+1);break}case re.AllObjectsOfThisType:{const j=new Map;for(const O of o)O.type===z.SolarPanel&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for All Solar Panel Arrays",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{R(B.newValue)}};a(B),R(L),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const j=new Map;for(const O of o)O.type===z.SolarPanel&&O.foundationId===f.foundationId&&j.set(O.id,O.dcToAcRatio??1);const B={name:"Set DC-AC Ratio for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:f.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())w(O,V)},redo:()=>{B.groupId&&x(B.groupId,B.newValue)}};a(B),x(f.foundationId,L),u(c+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const j=i(f);if(j){const B=new Map,O=j.type===z.Cuboid;if(O)for(const q of o)q.type===z.SolarPanel&&q.parentId===f.parentId&&me.isIdentical(q.normal,f.normal)&&B.set(q.id,q.dcToAcRatio??1);else for(const q of o)q.type===z.SolarPanel&&q.parentId===f.parentId&&B.set(q.id,q.dcToAcRatio??1);const V=O?f.normal:void 0,G={name:"Set DC-AC Ratio for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:B,newValue:L,groupId:f.parentId,normal:V,undo:()=>{for(const[q,$]of G.oldValues.entries())w(q,$)},redo:()=>{G.groupId&&b(G.groupId,G.normal,G.newValue)}};a(G),b(f.parentId,V,L),u(c+1)}break}default:{const j=r(f.id),B=j?j.dcToAcRatio??1:f.dcToAcRatio??1,O={name:"Set Solar Panel Array DC-AC Ratio",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:f.id,changedElementType:f.type,undo:()=>{w(O.changedElementId,O.oldValue)},redo:()=>{w(O.changedElementId,O.newValue)}};a(O),w(f.id,L),u(c+1);break}}g(!p)}},U=(L,j)=>{if(P.current){const{clientWidth:B,clientHeight:O}=window.document.documentElement,V=P.current.getBoundingClientRect();C({left:-V.left+j.x,right:B-(V.right-j.x),top:-V.top+j.y,bottom:O-((V==null?void 0:V.bottom)-j.y)})}},W=()=>{v.current=f.dcToAcRatio??1,t(!1)},k=()=>{W(),d()},D=()=>{N(v.current),t(!1),u(0)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>y(!0),onMouseOut:()=>y(!1),children:Y.t("solarPanelMenu.DcToAcSizeRatio",T)}),footer:[h.jsx(io,{onClick:()=>{N(v.current)},children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:k,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:D,children:Y.t("word.OK",T)},"OK")],onCancel:W,maskClosable:!1,destroyOnClose:!1,modalRender:L=>h.jsx(Bi,{disabled:!A,bounds:S,onStart:(j,B)=>U(j,B),children:h.jsx("div",{ref:P,children:L})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:2,step:.01,style:{width:120},precision:2,value:v.current,onChange:L=>{L!==null&&(v.current=L,g(!p))},onPressEnter:D}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:["[1.0, 2.0]",h.jsx("br",{}),Y.t("solarPanelMenu.DcToAcSizeRatioExplained",T)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:F,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",T)})]})})})]})})})},kHe=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(l7t),i=M(Gr),a=M(En),l=M(xh),s=M(bh),c=M(no),u=M(Qn),d=M(Xi),f=uo(z.SolarPanel),p=(f==null?void 0:f.tiltAngle)??0,g=(f==null?void 0:f.parentType)===z.Wall,[A,y]=m.useState(g?-p:p),S=m.useRef(!1),C=m.useRef(),P=$t(),v=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&B.foundationId===k&&!B.locked){const O=B;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-D:D):O.tiltAngle=D}})},T=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&!B.locked){let O;if(D?O=B.parentId===k&&me.isIdentical(B.normal,D):O=B.parentId===k,O){const V=B;V.tiltAngle=L}}})},w=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked){const B=j;B.parentType===z.Wall?B.tiltAngle=Math.min(0,D?-k:k):B.tiltAngle=k}})},x=(k,D,L)=>{M.getState().set(j=>{for(const B of j.elements)if(B.type===z.SolarPanel&&!B.locked&&k.has(B.id)){const O=B;O.parentType===z.Wall?O.tiltAngle=Math.min(0,L?-D:D):O.tiltAngle=D}})},b=k=>{s(k.target.value)},R=k=>{if(f){switch(l){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===(f==null?void 0:f.foundationId)&&!D.locked&&Math.abs(D.tiltAngle-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=i(f);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&me.isIdentical(j.normal,f.normal)&&!j.locked&&Math.abs(j.tiltAngle-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&!j.locked&&Math.abs(j.tiltAngle-k)>Et)return!0}break}default:{if(Math.abs((f==null?void 0:f.tiltAngle)-k)>Et)return!0;break}}return!1}},H=k=>{if(g&&(k=-k),!!f&&R(k)){switch(C.current=void 0,l){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{x(L.oldValues,L.newValue,!g)}};a(L),x(D,k,!g),u(c+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{w(L.newValue,!g)}};a(L),w(k,!g),u(c+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){S.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===f.foundationId&&D.parentType!==z.Wall&&.5*D.ly*Math.abs(Math.sin(k))>D.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===f.foundationId&&D.set(j.id,j.tiltAngle);const L={name:"Set Tilt Angle for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:f.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,B)},redo:()=>{L.groupId&&v(L.groupId,L.newValue,!g)}};a(L),v(f.foundationId,k,!g),u(c+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=i(f);if(D){S.current=!1;const L=D.type===z.Cuboid;if(L){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&me.isIdentical(j.normal,f.normal)&&.5*j.ly*Math.abs(Math.sin(k))>j.poleHeight){S.current=!0;break}}else if(f.parentType===z.Wall)S.current=!1;else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===f.parentId&&.5*j.ly*Math.abs(Math.sin(k))>j.poleHeight){S.current=!0;break}if(S.current)C.current=k,y(f.tiltAngle);else{const j=new Map;if(L)for(const V of n)V.type===z.SolarPanel&&V.parentId===f.parentId&&me.isIdentical(V.normal,f.normal)&&j.set(V.id,V.tiltAngle);else for(const V of n)V.type===z.SolarPanel&&V.parentId===f.parentId&&j.set(V.id,V.tiltAngle);const B=L?f.normal:void 0,O={name:"Set Tilt Angle for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:f.parentId,normal:B,undo:()=>{for(const[V,G]of O.oldValues.entries())r(V,G)},redo:()=>{O.groupId&&T(O.groupId,O.normal,O.newValue)}};a(O),T(f.parentId,B,k),u(c+1)}}break}default:{const D=o(f.id),L=D?D.tiltAngle:f.tiltAngle;if(S.current=.5*f.ly*Math.abs(Math.sin(k))>f.poleHeight,f.parentType===z.Wall&&(S.current=!1),S.current)C.current=k,y(L);else{const j={name:"Set Solar Panel Array Tilt Angle",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(j.changedElementId,j.oldValue)},redo:()=>{r(j.changedElementId,j.newValue)}};a(j),r(f.id,k),u(c+1)}break}}e(D=>{D.actionState.solarPanelTiltAngle=k})}},F=()=>{S.current=!1,t(!1)},E=()=>{F(),d()},N=()=>{H(A),S.current||(t(!1),u(0))},U=()=>{H(A)},W=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+me.toDegrees(C.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.TiltAngle",P),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:g?0:-90,max:90,style:{width:120},precision:2,value:parseFloat(me.toDegrees(A).toFixed(2)),step:1,formatter:k=>`${k}°`,onChange:k=>{k!==null&&y(me.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [",g?"0°":"-90°",", 90°]",h.jsx("br",{}),Y.t("solarPanelMenu.SouthFacingIsPositive",P)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:b,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},upo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Qq),i=M(yYe),a=M(AYe),l=M(wYe),s=M(Gr),c=M(En),u=M(xh),d=M(bh),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarPanel),y=m.useRef(!1),S=m.useRef(),[C,P]=m.useState(A?-A.relativeAzimuth:0),v=$t(),T=k=>{d(k.target.value)},w=(k,D)=>{const L=s(k);if(L){if(L.type===z.Cuboid&&!me.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.relativeAzimuth=-D,L.type===z.Roof?me.checkElementOnRoofState(j,L)===pa.Valid:me.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},x=(k,D)=>!w(k,D),b=k=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.SolarPanel&&!D.locked&&D.parentType!==z.Wall&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===(A==null?void 0:A.foundationId)&&!D.locked&&D.parentType!==z.Wall&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:if(A!=null&&A.parentId){const D=s(A);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&me.isIdentical(j.normal,A.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}}break;default:if(Math.abs(-(A==null?void 0:A.relativeAzimuth)-k)>Et)return!0}return!1}},R=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarPanel&&!j.locked&&k.has(j.id)){const B=j;B.relativeAzimuth=D}})},H=k=>{if(A&&b(k)){switch(S.current=void 0,u){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(D.id)&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(D,-k),p(f+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.parentType!==z.Wall&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.parentType!==z.Wall&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{l(z.SolarPanel,-L.newValue)}};c(L),l(z.SolarPanel,-k),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){y.current=!1;for(const D of n)if(D.type===z.SolarPanel&&D.foundationId===A.foundationId&&D.parentType!==z.Wall&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarPanel&&j.foundationId===A.foundationId&&j.parentType!==z.Wall&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:A.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{L.groupId&&a(z.SolarPanel,L.groupId,-L.newValue)}};c(L),a(z.SolarPanel,A.foundationId,-k),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{if(A.parentId){const D=s(A);if(D){if(y.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&me.isIdentical(j.normal,A.normal)&&x(j,k)){y.current=!0;break}}else for(const j of n)if(j.type===z.SolarPanel&&j.parentId===A.parentId&&x(j,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarPanel&&G.parentId===A.parentId&&me.isIdentical(G.normal,A.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarPanel&&G.parentId===A.parentId&&j.set(G.id,-G.relativeAzimuth);const O=B?A.normal:void 0,V={name:"Set Relative Azimuth for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:A.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())r(G,-q)},redo:()=>{V.groupId&&i(z.SolarPanel,V.groupId,V.normal,-V.newValue)}};c(V),i(z.SolarPanel,A.parentId,O,-k),p(f+1)}}}break}default:{const D=o(A.id),L=D?-D.relativeAzimuth:-A.relativeAzimuth;if(y.current=x(A,k),y.current)S.current=k,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(A.id,-k),p(f+1)}break}}e(D=>{D.actionState.solarPanelRelativeAzimuth=-k})}},F=()=>{y.current=!1,t(!1)},E=()=>{F(),g()},N=()=>{H(C),y.current||(t(!1),p(0))},U=()=>{H(C)},W=y.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+me.toDegrees(S.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeAzimuth",v),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(me.toDegrees(C).toFixed(2)),formatter:k=>`${k}°`,onChange:k=>{k!==null&&P(me.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",v),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",v)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",v)})]})})})]})})},dpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(xh),l=M(bh),s=M(no),c=M(Qn),u=uo(),[d,f]=m.useState((u==null?void 0:u.trackerType)??Ll.NO_TRACKER),p=$t(),{Option:g}=Uo,A=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&E.id===R&&!E.locked){E.trackerType=H;break}})},y=(R,H)=>{e(F=>{for(const E of F.elements)E.type===z.SolarPanel&&E.foundationId===R&&!E.locked&&(E.trackerType=H)})},S=(R,H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.SolarPanel&&!N.locked){let U;H?U=N.parentId===R&&me.isIdentical(N.normal,H):U=N.parentId===R,U&&(N.trackerType=F)}})},C=R=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&(F.trackerType=R)})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)E.type===z.SolarPanel&&!E.locked&&R.has(E.id)&&(E.trackerType=H)})},v=R=>{l(R.target.value)},T=R=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const H of n)if(H.type===z.SolarPanel&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisType:{for(const H of n)if(H.type===z.SolarPanel&&!H.locked&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of n)if(H.type===z.SolarPanel&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&H.trackerType!==R)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const H=r(u);if(H){if(H.type===z.Cuboid){for(const E of n)if(E.type===z.SolarPanel&&E.parentId===u.parentId&&me.isIdentical(E.normal,u.normal)&&!E.locked&&E.trackerType!==R)return!0}else for(const E of n)if(E.type===z.SolarPanel&&E.parentId===u.parentId&&!E.locked&&E.trackerType!==R)return!0}break}default:{if((u==null?void 0:u.trackerType)!==R)return!0;break}}return!1}},w=R=>{if(u&&T(R))switch(a){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};i(F),P(H,R),c(s+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.SolarPanel&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for All Solar Panel Arrays",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{C(F.newValue)}};i(F),C(R),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.SolarPanel&&E.foundationId===u.foundationId&&H.set(E.id,E.trackerType);const F={name:"Set Tracker Type for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())A(E,N)},redo:()=>{F.groupId&&y(F.groupId,F.newValue)}};i(F),y(u.foundationId,R),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const H=r(u);if(H){const F=new Map,E=H.type===z.Cuboid;if(E)for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&me.isIdentical(W.normal,u.normal)&&F.set(W.id,W.trackerType);else for(const W of n)W.type===z.SolarPanel&&W.parentId===u.parentId&&F.set(W.id,W.trackerType);const N=E?u.normal:void 0,U={name:"Set Tracker Type for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:F,newValue:R,groupId:u.parentId,normal:N,undo:()=>{for(const[W,k]of U.oldValues.entries())A(W,k)},redo:()=>{U.groupId&&S(U.groupId,U.normal,U.newValue)}};i(U),S(u.parentId,N,R),c(s+1)}break}default:{const H=o(u.id),F=H?H.trackerType:u.trackerType,E={name:"Set Solar Panel Array Tracker Type",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{A(E.changedElementId,E.oldValue)},redo:()=>{A(E.changedElementId,E.newValue)}};i(E),A(u.id,R),c(s+1);break}}},x=()=>{t(!1)},b=()=>{w(d)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.Tracker",p),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsxs(Uo,{style:{width:"120px"},value:d,onChange:R=>f(R),children:[h.jsx(g,{value:Ll.NO_TRACKER,title:Y.t("solarPanelMenu.NoTracker",p),children:Y.t("word.None",p)},"NONE"),h.jsx(g,{value:Ll.HORIZONTAL_SINGLE_AXIS_TRACKER,title:Y.t("solarPanelMenu.HorizontalSingleAxisTracker",p),children:"HSAT"},"HSAT"),h.jsx(g,{value:Ll.VERTICAL_SINGLE_AXIS_TRACKER,title:Y.t("solarPanelMenu.VerticalSingleAxisTracker",p),children:"VSAT"},"VSAT"),h.jsx(g,{value:Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER,title:Y.t("solarPanelMenu.AltazimuthDualAxisTracker",p),children:"AADAT"},"AADAT")]}),h.jsx("div",{style:{paddingTop:"20px",paddingRight:"10px",textAlign:"left",fontSize:"11px"},children:Y.t("solarPanelMenu.SolarTrackerFollowsSun",p)})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},fpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(xh),l=M(bh),s=M(no),c=M(Qn),u=uo(z.SolarPanel),[d,f]=m.useState((u==null?void 0:u.frameColor)??"white"),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){F.frameColor=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)F.type===z.SolarPanel&&F.foundationId===b&&!F.locked&&(F.frameColor=R)})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;R?N=E.parentId===b&&me.isIdentical(E.normal,R):N=E.parentId===b,N&&(E.frameColor=H)}})},S=b=>{e(R=>{for(const H of R.elements)H.type===z.SolarPanel&&!H.locked&&(H.frameColor=b)})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)F.type===z.SolarPanel&&!F.locked&&b.has(F.id)&&(F.frameColor=R)})},P=b=>{l(b.target.value)},v=b=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&R.frameColor!==b)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&me.isIdentical(F.normal,u.normal)&&!F.locked&&F.frameColor!==b)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&F.frameColor!==b)return!0}break}default:{if((u==null?void 0:u.frameColor)!==b)return!0;break}}return!1}},T=b=>{if(u&&v(b)){switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for Selected Solar Panels",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for All Solar Panels",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.frameColor??"white");const H={name:"Set Frame Color for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&me.isIdentical(U.normal,u.normal)&&H.set(U.id,U.frameColor??"white");else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.frameColor??"white");const E=F?u.normal:void 0,N={name:"Set Frame Color for All Solar Panels on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.frameColor:u.frameColor,F={name:"Set Frame Color of Selected Solar Panel",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(u.id,F.oldValue)},redo:()=>{g(u.id,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}e(R=>{R.actionState.solarPanelFrameColor=b})}},w=()=>{t(!1)},x=()=>{T(d)};return h.jsx(so,{width:680,title:Y.t("solarPanelMenu.FrameColor",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsx(Ld,{color:d??(u==null?void 0:u.color)??"white",onChangeComplete:b=>{f(b.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},hpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(p7t),a=M(PW),l=M(CW),s=M(Gr),c=M(En),u=M(xh),d=M(bh),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarPanel),[y,S]=m.useState((A==null?void 0:A.poleHeight)??0),C=m.useRef(!1),P=m.useRef(),v=$t(),T=U=>{d(U.target.value)},w=U=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(A==null?void 0:A.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const W=s(A);if(W){if(W.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&me.isIdentical(D.normal,A.normal)&&!D.locked&&Math.abs(D.poleHeight-U)>Et)return!0}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&!D.locked&&Math.abs(D.poleHeight-U)>Et)return!0}break}default:{if(Math.abs((A==null?void 0:A.poleHeight)-U)>Et)return!0;break}}return!1}},x=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.poleHeight=W}})},b=U=>{if(A&&w(U)){switch(P.current=void 0,u){case re.AllSelectedObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(D.id)&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{x(k.oldValues,k.newValue)}};c(k),x(W,U),p(f+1)}break}case re.AllObjectsOfThisType:{C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Solar Panel Arrays",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{l(z.SolarPanel,k.newValue)}};c(k),l(z.SolarPanel,U),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){C.current=!1;for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===A.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const W=new Map;for(const D of n)D.type===z.SolarPanel&&D.foundationId===A.foundationId&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:A.foundationId,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{k.groupId&&a(z.SolarPanel,k.groupId,k.newValue)}};c(k),a(z.SolarPanel,A.foundationId,U),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const W=s(A);if(W){if(C.current=!1,W.type===z.Cuboid){for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&me.isIdentical(D.normal,A.normal)&&.5*D.ly*Math.abs(Math.sin(D.tiltAngle))>U){C.current=!0;break}}else for(const D of n)if(D.type===z.SolarPanel&&D.parentId===A.parentId&&.5*D.ly*Math.abs(Math.sin(D.tiltAngle))>U){C.current=!0;break}if(C.current)P.current=U,S(A.poleHeight);else{const D=new Map,L=W.type===z.Cuboid;if(L)for(const O of n)O.type===z.SolarPanel&&O.parentId===A.parentId&&me.isIdentical(O.normal,A.normal)&&D.set(O.id,O.poleHeight);else for(const O of n)O.type===z.SolarPanel&&O.parentId===A.parentId&&D.set(O.id,O.poleHeight);const j=L?A.normal:void 0,B={name:"Set Pole Height for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:D,newValue:U,groupId:A.parentId,normal:j,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V)},redo:()=>{B.groupId&&i(z.SolarPanel,B.groupId,B.normal,B.newValue)}};c(B),i(z.SolarPanel,A.parentId,j,U),p(f+1)}}break}default:{const W=o(A.id),k=W?W.poleHeight:A.poleHeight;if(C.current=.5*A.ly*Math.abs(Math.sin(A.tiltAngle))>U,C.current)P.current=U,S(k);else{const D={name:"Set Solar Panel Array Pole Height",timestamp:Date.now(),oldValue:k,newValue:U,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};c(D),r(A.id,U),p(f+1)}break}}e(W=>{W.actionState.solarPanelPoleHeight=U})}},R=()=>{C.current=!1,t(!1)},H=()=>{R(),g()},F=()=>{b(y),C.current||(t(!1),p(0))},E=()=>{b(y)},N=C.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(P.current!==void 0?" ("+P.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.PoleHeight",v),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:10,style:{width:120},step:.1,precision:2,value:y,onChange:U=>{U!==null&&S(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [0, 10] ",Y.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",v)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",v)})]})})})]})})},ppo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(xh),l=M(bh),s=M(no),c=M(Qn),u=uo(z.SolarPanel),[d,f]=m.useState((u==null?void 0:u.poleSpacing)??0),p=$t(),g=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.id===b&&!F.locked){const E=F;E.poleSpacing=R;break}})},A=(b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&F.foundationId===b&&!F.locked){const E=F;E.poleSpacing=R}})},y=(b,R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.SolarPanel&&!E.locked){let N;if(R?N=E.parentId===b&&me.isIdentical(E.normal,R):N=E.parentId===b,N){const U=E;U.poleSpacing=H}}})},S=b=>{e(R=>{for(const H of R.elements)if(H.type===z.SolarPanel&&!H.locked){const F=H;F.poleSpacing=b}})},C=(b,R)=>{M.getState().set(H=>{for(const F of H.elements)if(F.type===z.SolarPanel&&!F.locked&&b.has(F.id)){const E=F;E.poleSpacing=R}})},P=b=>{l(b.target.value)},v=b=>{if(u){switch(a){case re.AllSelectedObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const R of n)if(R.type===z.SolarPanel&&!R.locked&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const R of n)if(R.type===z.SolarPanel&&R.foundationId===(u==null?void 0:u.foundationId)&&!R.locked&&Math.abs(R.poleSpacing-b)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){if(R.type===z.Cuboid){for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&me.isIdentical(F.normal,u.normal)&&!F.locked&&Math.abs(F.poleSpacing-b)>Et)return!0}else for(const F of n)if(F.type===z.SolarPanel&&F.parentId===u.parentId&&!F.locked&&Math.abs(F.poleSpacing-b)>Et)return!0}break}default:{if(Math.abs((u==null?void 0:u.poleSpacing)-b)>Et)return!0;break}}return!1}},T=b=>{if(u&&v(b)){switch(a){case re.AllSelectedObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(F.id)&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for Selected Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{C(H.oldValues,H.newValue)}};i(H),C(R,b),c(s+1);break}case re.AllObjectsOfThisType:{const R=new Map;for(const F of n)F.type===z.SolarPanel&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for All Solar Panel Arrays",timestamp:Date.now(),oldValues:R,newValue:b,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{S(H.newValue)}};i(H),S(b),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const R=new Map;for(const F of n)F.type===z.SolarPanel&&F.foundationId===u.foundationId&&R.set(F.id,F.poleSpacing);const H={name:"Set Pole Spacing for All Solar Panel Arrays Above Foundation",timestamp:Date.now(),oldValues:R,newValue:b,groupId:u.foundationId,undo:()=>{for(const[F,E]of H.oldValues.entries())g(F,E)},redo:()=>{H.groupId&&A(H.groupId,H.newValue)}};i(H),A(u.foundationId,b),c(s+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const R=r(u);if(R){const H=new Map,F=R.type===z.Cuboid;if(F)for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&me.isIdentical(U.normal,u.normal)&&H.set(U.id,U.poleSpacing);else for(const U of n)U.type===z.SolarPanel&&U.parentId===u.parentId&&H.set(U.id,U.poleSpacing);const E=F?u.normal:void 0,N={name:"Set Pole Spacing for All Solar Panel Arrays on Surface",timestamp:Date.now(),oldValues:H,newValue:b,groupId:u.parentId,normal:E,undo:()=>{for(const[U,W]of N.oldValues.entries())g(U,W)},redo:()=>{N.groupId&&y(N.groupId,N.normal,N.newValue)}};i(N),y(u.parentId,E,b),c(s+1)}break}default:{const R=o(u.id),H=R?R.poleSpacing:u.poleSpacing,F={name:"Set Solar Panel Array Pole Spacing",timestamp:Date.now(),oldValue:H,newValue:b,changedElementId:u.id,changedElementType:u.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};i(F),g(u.id,b),c(s+1);break}}e(R=>{R.actionState.solarPanelPoleSpacing=b})}},w=()=>{t(!1)},x=()=>{T(d),t(!1),c(0)};return h.jsx(so,{width:550,title:Y.t("solarPanelMenu.PoleSpacing",p),onApply:x,onClose:w,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:1,style:{width:120},precision:2,value:d,onChange:b=>{b!==null&&f(b)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [1, 10] ",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarPanelMenu.AllSolarPanelsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",p)})]})})})]})})},gpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(s7t),a=M(c7t),l=M(u7t),s=M(En),c=M(xh),u=M(bh),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.SolarPanel),[A,y]=m.useState((g==null?void 0:g.cx)??0),S=m.useRef(!1),C=m.useRef(),P=$t(),v=U=>{u(U.target.value)},T=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cx-U)>Et)return!0;break;case re.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cx-U)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.cx-U)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.cx)-U)>Et)return!0}return!1}},w=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.cx=W}})},x=(U,W,k)=>U+.5*W/k<.5&&U-.5*W/k>-.5,b=U=>{if(!g||!T(U))return;C.current=void 0;const W=o(g);if(W){switch(c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(k.id)&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.cx);const D={name:"Set Center X for Selected Solar Panel",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{w(D.oldValues,D.newValue)}};s(D),w(k,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.cx);const D={name:"Set Center X for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,D.newValue)}};s(D),l(z.SolarPanel,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===g.foundationId&&!x(U,g.lx,W.lx)){S.current=!0;break}if(S.current)C.current=U,y(g.cx);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===g.foundationId&&k.set(L.id,L.cx);const D={name:"Set Center X for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:U,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{D.groupId&&a(z.SolarPanel,D.groupId,D.newValue)}};s(D),a(z.SolarPanel,g.foundationId,U),f(d+1)}}break}default:{const k=r(g.id),D=k?k.cx:g.cx;if(S.current=!x(U,g.lx,W.lx),S.current)C.current=U,y(D);else{const L={name:"Set Solar Panel Center X",timestamp:Date.now(),oldValue:D,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(g.id,U),f(d+1)}break}}e(k=>{k.actionState.solarPanelCx=U})}},R=()=>{S.current=!1,t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)},N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeXCoordinateOfCenter",P),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},mpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(Jn),i=M(d7t),a=M(f7t),l=M(h7t),s=M(En),c=M(xh),u=M(bh),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.SolarPanel),[A,y]=m.useState((g==null?void 0:g.cy)??0),S=m.useRef(!1),C=m.useRef(),P=$t(),v=U=>{u(U.target.value)},T=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&Math.abs(W.cy-U)>Et)return!0;break;case re.AllObjectsOfThisType:for(const W of n)if(W.type===z.SolarPanel&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.cy-U)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const W of n)if(W.type===z.SolarPanel&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.cy-U)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.cy)-U)>Et)return!0}return!1}},w=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)if(D.type===z.SolarPanel&&!D.locked&&U.has(D.id)){const L=D;L.cy=W}})},x=(U,W,k)=>U+.5*W/k<.5&&U-.5*W/k>-.5,b=U=>{if(!g||!T(U))return;C.current=void 0;const W=o(g);if(W){switch(c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(k.id)&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.cy);const D={name:"Set Center Y for Selected Solar Panel",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{w(D.oldValues,D.newValue)}};s(D),w(k,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&k.set(L.id,L.cy);const D={name:"Set Center Y for All Solar Panels",timestamp:Date.now(),oldValues:k,newValue:U,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{l(z.SolarPanel,D.newValue)}};s(D),l(z.SolarPanel,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.SolarPanel&&k.foundationId===g.foundationId&&!x(U,g.ly,W.ly)){S.current=!0;break}if(S.current)C.current=U,y(g.cy);else{const k=new Map;for(const L of n)L.type===z.SolarPanel&&L.foundationId===g.foundationId&&k.set(L.id,L.cy);const D={name:"Set Center Y for All Solar Panels Above Foundation",timestamp:Date.now(),oldValues:k,newValue:U,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())i(L,j)},redo:()=>{D.groupId&&a(z.SolarPanel,D.groupId,D.newValue)}};s(D),a(z.SolarPanel,g.foundationId,U),f(d+1)}}break}default:{const k=r(g.id),D=k?k.cy:g.cy;if(S.current=!x(U,g.ly,W.ly),S.current)C.current=U,y(D);else{const L={name:"Set Solar Panel Center Y",timestamp:Date.now(),oldValue:D,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{i(L.changedElementId,L.oldValue)},redo:()=>{i(L.changedElementId,L.newValue)}};s(L),i(g.id,U),f(d+1)}break}}e(k=>{k.actionState.solarPanelCy=U})}},R=()=>{S.current=!1,t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)},N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeYCoordinateOfCenter",P),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-.5,max:.5,style:{width:120},step:.01,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [-0.5, 0.5]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarPanelMenu.OnlyThisSolarPanel",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarPanelMenu.AllSolarPanelsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarPanelMenu.AllSelectedSolarPanels",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarPanelMenu.AllSolarPanels",P)})]})})})]})})},ypo=t=>{const e=[];if(t.type!==z.SolarPanel)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=t.type===z.SolarPanel&&me.isIdentical(n.normal,as);return e.push({key:"solar-panel-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"solar-panel-cut",label:h.jsx(kd,{})}),e.push({key:"solar-panel-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"solar-panel-model-change",label:h.jsxs(eo,{Dialog:rpo,children:[Y.t("solarPanelMenu.ChangePvModel",r)," (",n.pvModelName,") ..."]})},{key:"solar-panel-orientation",label:h.jsxs(eo,{Dialog:ipo,children:[Y.t("solarPanelMenu.Orientation",r)," ..."]})},{key:"solar-panel-length",label:h.jsxs(eo,{Dialog:apo,children:[Y.t("word.Length",r)," ..."]})},{key:"solar-panel-width",label:h.jsxs(eo,{Dialog:lpo,children:[Y.t("word.Width",r)," ..."]})}),e.push({key:"solar-panel-coordinates-submenu",label:h.jsx(an,{children:Y.t("solarCollectorMenu.Coordinates",r)}),children:[{key:"solar-panel-center-x",label:h.jsxs(eo,{Dialog:gpo,children:[Y.t("solarCollectorMenu.RelativeXCoordinateOfCenter",r)," ..."]})},{key:"solar-panel-center-y",label:h.jsxs(eo,{Dialog:mpo,children:[Y.t("solarCollectorMenu.RelativeYCoordinateOfCenter",r)," ..."]})}]}),n.parentType===z.Wall&&e.push({key:"solar-panel-tilt-angle-on-wall",label:h.jsxs(eo,{Dialog:kHe,children:[Y.t("solarPanelMenu.TiltAngle",r)," ..."]})}),i&&(n.trackerType===Ll.NO_TRACKER&&e.push({key:"solar-panel-tilt-angle",label:h.jsxs(eo,{Dialog:kHe,children:[Y.t("solarPanelMenu.TiltAngle",r)," ..."]})}),e.push({key:"solar-panel-relative-azimuth",label:h.jsxs(eo,{Dialog:upo,children:[Y.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),n.parentType!==z.Roof&&e.push({key:"solar-panel-tracker",label:h.jsxs(eo,{Dialog:dpo,children:[Y.t("solarPanelMenu.Tracker",r)," ..."]})})),e.push({key:"solar-panel-frame-color",label:h.jsxs(eo,{Dialog:fpo,children:[Y.t("solarPanelMenu.FrameColor",r)," ..."]})}),e.push({key:"solar-panel-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})}),e.push({key:"solar-panel-electrical-submenu",label:h.jsx(an,{children:Y.t("solarPanelMenu.ElectricalProperties",r)}),children:[{key:"solar-panel-inverter-efficiency",label:h.jsxs(eo,{Dialog:spo,children:[Y.t("solarPanelMenu.InverterEfficiency",r)," ..."]})},{key:"solar-panel-dc-ac-ratio",label:h.jsxs(eo,{Dialog:cpo,children:[Y.t("solarPanelMenu.DcToAcSizeRatio",r)," ..."]})}]}),e.push({key:"solar-panel-pole-submenu",label:h.jsx(an,{children:Y.t("solarCollectorMenu.Pole",r)}),children:[{key:"solar-panel-pole-height",label:h.jsxs(eo,{noPadding:!0,Dialog:hpo,children:[Y.t("solarCollectorMenu.PoleHeight",r)," ..."]})},{key:"solar-panel-pole-spacing",label:h.jsxs(eo,{noPadding:!0,Dialog:ppo,children:[Y.t("solarPanelMenu.PoleSpacing",r)," ..."]})}]}),e.push({key:"solar-panel-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},Apo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Fw),r=M($q),i=M(xW),a=M(Gr),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=M(Xi),p=uo(z.ParabolicTrough),[g,A]=m.useState((p==null?void 0:p.ly)??9),y=m.useRef(!1),S=m.useRef(),C=$t(),P=W=>{c(W.target.value)},v=(W,k)=>{const D=a(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},T=(W,k)=>!v(W,k),w=W=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:for(const k of e)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of e)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of e)if(k.type===z.ParabolicTrough&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Et)return!0}return!1}},x=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.ly=k)})},b=W=>{if(p&&w(W))switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{x(D.oldValues,D.newValue)}};l(D),x(k,W),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&k.set(L.id,L.ly);const D={name:"Set Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{i(z.ParabolicTrough,D.newValue)}};l(D),i(z.ParabolicTrough,W),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const k of e)if(k.type===z.ParabolicTrough&&k.foundationId===p.foundationId&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.ParabolicTrough&&L.foundationId===p.foundationId&&k.set(L.id,L.ly);const D={name:"Set Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{D.groupId&&r(z.ParabolicTrough,D.groupId,D.newValue)}};l(D),r(z.ParabolicTrough,p.foundationId,W),d(u+1)}}break}default:{const k=n(p.id),D=k?k.ly:p.ly;if(y.current=T(p,W),y.current)S.current=W,A(D);else{const L={name:"Set Parabolic Trough Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{y.current=!1,t(!1)},H=()=>{R(),f()},F=()=>{b(g),y.current||(t(!1),d(0))},E=W=>{if(!p)return 1;let k=W??1;return k=Math.max(1,Math.ceil((k-p.moduleLength/2)/p.moduleLength))*p.moduleLength,k},N=()=>{b(g)};if((p==null?void 0:p.type)!==z.ParabolicTrough)return null;const U=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:p.moduleLength,max:100*p.moduleLength,step:p.moduleLength,precision:2,style:{width:120},value:g,onChange:W=>{A(E(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("parabolicTroughMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+Y.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(g/p.moduleLength)+" "+Y.t("parabolicTroughMenu.ModulesLong",C),h.jsx("br",{}),Y.t("word.Maximum",C),": 100 ",Y.t("parabolicTroughMenu.Modules",C)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",C)})]})})})]})})},wpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Width for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.lx);const D={name:"Set Width for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Width for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},vpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(NYe),i=M(UYe),a=M(jYe),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.moduleLength)??3),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.moduleLength)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.moduleLength=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.moduleLength:g.moduleLength;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Module Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughModuleLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},xpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(kYe),i=M(LYe),a=M(WYe),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.latusRectum)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicTrough&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.latusRectum)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicTrough&&!L.locked&&W.has(L.id)&&(L.latusRectum=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Troughs",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicTrough,D.newValue)}};s(D),a(z.ParabolicTrough,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicTrough&&L.foundationId===g.foundationId&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicTrough,D.groupId,D.newValue)}};s(D),i(z.ParabolicTrough,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.latusRectum:g.latusRectum;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Trough Latus Rectum",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicTroughLatusRectum=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicTroughMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},bpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(AA),u=M(wA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicTrough),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicTrough&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.ParabolicTrough&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.ParabolicTrough&&!k.locked&&N.has(k.id)&&(k.tiltAngle=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.ParabolicTrough,W.newValue)}};s(W),a(z.ParabolicTrough,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.ParabolicTrough&&U.foundationId===g.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicTrough&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.ParabolicTrough,W.groupId,W.newValue)}};s(W),i(z.ParabolicTrough,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Parabolic Trough Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicTroughPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.ParabolicTrough)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",P)})]})})})]})})},Spo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Parabolic Trough Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Tpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(SYe),i=M(TYe),a=M(PYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.absorptance)??.95),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.absorptance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.absorptance:f.absorptance,R={name:"Set Parabolic Trough Absorptance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughAbsorptance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Ppo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(CYe),i=M(RYe),a=M(HYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.opticalEfficiency)??.7),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.opticalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Trough Optical Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughOpticalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Cpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(MYe),i=M(IYe),a=M(zYe),l=M(En),s=M(AA),c=M(wA),u=M(no),d=M(Qn),f=uo(z.ParabolicTrough),[p,g]=m.useState((f==null?void 0:f.thermalEfficiency)??.3),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicTrough&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicTrough&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicTrough&&!R.locked&&w.has(R.id)&&(R.thermalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for Selected Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Troughs",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicTrough,b.newValue)}};l(b),a(z.ParabolicTrough,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicTrough&&R.foundationId===f.foundationId&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Troughs Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicTrough,b.groupId,b.newValue)}};l(b),i(z.ParabolicTrough,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Trough Thermal Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicTroughThermalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicTrough?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicTroughMenu.OnlyThisParabolicTrough",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicTroughMenu.AllParabolicTroughsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllSelectedParabolicTroughs",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicTroughMenu.AllParabolicTroughs",A)})]})})})]})})},Rpo=t=>{const e=[];if(t.type!==z.ParabolicTrough)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"parabolic-trough-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"parabolic-trough-cut",label:h.jsx(kd,{})}),e.push({key:"parabolic-trough-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"parabolic-trough-length",label:h.jsxs(eo,{Dialog:Apo,children:[Y.t("word.Length",o)," ..."]})},{key:"parabolic-trough-width",label:h.jsxs(eo,{Dialog:wpo,children:[Y.t("word.Width",o)," ..."]})},{key:"parabolic-trough-module-length",label:h.jsxs(eo,{Dialog:vpo,children:[Y.t("parabolicTroughMenu.ModuleLength",o)," ..."]})},{key:"parabolic-trough-latus-rectum",label:h.jsxs(eo,{Dialog:xpo,children:[Y.t("parabolicTroughMenu.LatusRectum",o)," ..."]})},{key:"parabolic-trough-pole-height",label:h.jsxs(eo,{Dialog:bpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-trough-reflectance",label:h.jsxs(eo,{Dialog:Spo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-trough-absorptance",label:h.jsxs(eo,{Dialog:Tpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-trough-optical-efficiency",label:h.jsxs(eo,{Dialog:Ppo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-trough-thermal-efficiency",label:h.jsxs(eo,{Dialog:Cpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})},{key:"parabolic-trough-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Hpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(Fw),a=M(qq),l=M($q),s=M(vW),c=M(xW),u=M(Gr),d=M(En),f=M(vA),p=M(xA),g=M(no),A=M(Qn),y=M(Xi),S=uo(z.ParabolicDish),[C,P]=m.useState((S==null?void 0:S.lx)??2),v=m.useRef(!1),T=m.useRef(),w=$t(),x=L=>{p(L.target.value)},b=(L,j)=>{const B=u(L);if(B){const O=JSON.parse(JSON.stringify(L));return O.lx=j,me.isSolarCollectorWithinHorizontalSurface(O,B)}return!1},R=(L,j)=>!b(L,j),H=L=>{if(S){switch(f){case re.AllSelectedObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.lx-L)>Et)return!0;break;case re.AllObjectsOfThisType:for(const j of n)if(j.type===z.ParabolicDish&&!j.locked&&Math.abs(j.lx-L)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===(S==null?void 0:S.foundationId)&&!j.locked&&Math.abs(j.lx-L)>Et)return!0;break;default:if(Math.abs((S==null?void 0:S.lx)-L)>Et)return!0}return!1}},F=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.ParabolicDish&&!O.locked&&L.has(O.id)&&(O.lx=j,O.ly=j)})},E=L=>{if(S&&H(L)){switch(T.current=void 0,f){case re.AllSelectedObjectsOfThisType:{v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(j.id)&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.lx);const B={name:"Set Diameter for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{F(B.oldValues,B.newValue)}};d(B),F(j,L),A(g+1)}break}case re.AllObjectsOfThisType:{v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&j.set(O.id,O.lx);const B={name:"Set Diameter for All Parabolic Dishes",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{s(z.ParabolicDish,B.newValue),c(z.ParabolicDish,B.newValue)}};d(B),s(z.ParabolicDish,L),c(z.ParabolicDish,L),A(g+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(S.foundationId){v.current=!1;for(const j of n)if(j.type===z.ParabolicDish&&j.foundationId===S.foundationId&&R(j,L)){v.current=!0;break}if(v.current)T.current=L,P(S.lx);else{const j=new Map;for(const O of n)O.type===z.ParabolicDish&&O.foundationId===S.foundationId&&j.set(O.id,O.lx);const B={name:"Set Diameter for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:S.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())r(O,V),i(O,V)},redo:()=>{B.groupId&&(a(z.ParabolicDish,B.groupId,B.newValue),l(z.ParabolicDish,B.groupId,B.newValue))}};d(B),a(z.ParabolicDish,S.foundationId,L),l(z.ParabolicDish,S.foundationId,L),A(g+1)}}break}default:{const j=o(S.id),B=j?j.lx:S.lx;if(v.current=R(S,L),v.current)T.current=L,P(B);else{const O={name:"Set Parabolic Dish Diameter",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:S.id,changedElementType:S.type,undo:()=>{r(O.changedElementId,O.oldValue),i(O.changedElementId,O.oldValue)},redo:()=>{r(O.changedElementId,O.newValue),i(O.changedElementId,O.newValue)}};d(O),r(S.id,L),i(S.id,L),A(g+1)}break}}e(j=>{j.actionState.parabolicDishRimDiameter=L})}},N=()=>{v.current=!1,t(!1)},U=()=>{N(),y()},W=()=>{E(C),v.current||(t(!1),A(0))},k=()=>{E(C)};if((S==null?void 0:S.type)!==z.ParabolicDish)return null;const D=v.current?": "+Y.t("message.NotApplicableToSelectedAction",w)+(T.current!==void 0?" ("+T.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.RimDiameter",w),rejectedMessage:D,onApply:k,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,precision:2,style:{width:120},value:C,onChange:L=>{L!==null&&P(L)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",w),": 1 ",Y.t("word.MeterAbbreviation",w),h.jsx("br",{}),Y.t("word.MaximumValue",w),": 10 ",Y.t("word.MeterAbbreviation",w)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",w)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x,value:f,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",w)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",w)})]})})})]})})},Mpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(kYe),i=M(LYe),a=M(WYe),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicDish),[A,y]=m.useState((g==null?void 0:g.latusRectum)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.latusRectum=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicDish&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.ParabolicDish&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.ParabolicDish&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.latusRectum-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.latusRectum)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.ParabolicDish&&!L.locked&&W.has(L.id)&&(L.latusRectum=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Dishes",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.ParabolicDish,D.newValue)}};s(D),a(z.ParabolicDish,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.ParabolicDish&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.latusRectum);else{const k=new Map;for(const L of n)L.type===z.ParabolicDish&&L.foundationId===g.foundationId&&k.set(L.id,L.latusRectum);const D={name:"Set Latus Rectum for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.ParabolicDish,D.groupId,D.newValue)}};s(D),i(z.ParabolicDish,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.latusRectum:g.latusRectum;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Parabolic Dish Latus Rectum",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.parabolicDishLatusRectum=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.ParabolicDish)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.LatusRectum",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},Ipo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(vA),a=M(xA),l=M(no),s=M(Qn),c=uo(z.ParabolicDish),[u,d]=m.useState((c==null?void 0:c.structureType)??sf.CentralPole),f=$t(),{Option:p}=Uo,g=(x,b)=>{e(R=>{for(const H of R.elements)if(H.id===x&&!H.locked&&H.type===z.ParabolicDish){H.structureType=b;break}})},A=(x,b)=>{e(R=>{for(const H of R.elements)H.foundationId===x&&!H.locked&&H.type===z.ParabolicDish&&(H.structureType=b)})},y=x=>{e(b=>{for(const R of b.elements)R.locked||R.type===z.ParabolicDish&&(R.structureType=x)})},S=x=>{a(x.target.value)},C=x=>{switch(i){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.structureType!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&b.structureType!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(c==null?void 0:c.foundationId)&&!b.locked&&b.structureType!==x)return!0;break;default:if((c==null?void 0:c.structureType)!==x)return!0}return!1},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.ParabolicDish&&!H.locked&&x.has(H.id)&&(H.structureType=b)})},v=x=>{if(c&&C(x)){switch(i){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};r(R),P(b,x),s(l+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{y(R.newValue)}};r(R),y(x),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const b=new Map;for(const H of n)H.type===z.ParabolicDish&&H.foundationId===c.foundationId&&b.set(H.id,H.structureType);const R={name:"Set Structure Type for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())g(H,F)},redo:()=>{R.groupId&&A(R.groupId,R.newValue)}};r(R),A(c.foundationId,x),s(l+1)}break}default:{const b=o(c.id),R=b?b.structureType:c.structureType,H={name:"Set Parabolic Dish Structure Type",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(H.changedElementId,H.oldValue)},redo:()=>{g(H.changedElementId,H.newValue)}};r(H),g(c.id,x),s(l+1);break}}e(b=>{b.actionState.parabolicDishReceiverStructure=x})}},T=()=>{t(!1)},w=()=>{v(u)};return(c==null?void 0:c.type)!==z.ParabolicDish?null:h.jsx(so,{width:640,title:Y.t("parabolicDishMenu.ReceiverStructure",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsxs(Uo,{value:u,onChange:x=>d(x),children:[h.jsx(p,{value:sf.CentralPole,children:Y.t("parabolicDishMenu.CentralPole",f)},sf.CentralPole),h.jsx(p,{value:sf.CentralPoleWithTripod,children:Y.t("parabolicDishMenu.CentralPoleWithTripod",f)},sf.CentralPoleWithTripod),h.jsx(p,{value:sf.Quadrupod,children:Y.t("parabolicDishMenu.Quadrupod",f)},sf.Quadrupod)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:S,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",f)})]})})})]})})},zpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.ParabolicDish),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.ParabolicDish&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.ParabolicDish&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.ParabolicDish&&!k.locked&&N.has(k.id)&&(k.tiltAngle=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(U.id)&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.ParabolicDish,W.newValue)}};s(W),a(z.ParabolicDish,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.ParabolicDish&&U.foundationId===g.foundationId&&.5*U.ly*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.ParabolicDish&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.ParabolicDish,W.groupId,W.newValue)}};s(W),i(z.ParabolicDish,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Parabolic Dish Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.parabolicDishPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.ParabolicDish)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("parabolicDishMenu.ExtraPoleHeightInAdditionToRadius",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",P)})]})})})]})})},Dpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(vYe),i=M(xYe),a=M(bYe),l=M(Gr),s=M(En),c=M(vA),u=M(xA),d=M(no),f=M(Qn),p=uo(z.ParabolicDish),[g,A]=m.useState((p==null?void 0:p.poleRadius)??.1),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.ParabolicDish&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.ParabolicDish&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.ParabolicDish&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-x)>Et)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-x)>Et)return!0;break}}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.ParabolicDish&&!H.locked&&x.has(H.id)&&(H.poleRadius=b)})},v=x=>{if(p&&C(x)){switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.ParabolicDish&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.ParabolicDish,R.newValue)}};s(R),a(z.ParabolicDish,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of n)H.type===z.ParabolicDish&&H.foundationId===p.foundationId&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.ParabolicDish,R.groupId,R.newValue)}};s(R),i(z.ParabolicDish,p.foundationId,x),f(d+1)}break}default:{const b=o(p.id),R=b?b.poleRadius:p.poleRadius,H={name:"Set Parabolic Dish Pole Radius",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}e(b=>{b.actionState.parabolicDishPoleRadius=x})}},T=()=>{t(!1)},w=()=>{v(g)};return(p==null?void 0:p.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.PoleRadius",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:g,onChange:x=>{x!==null&&A(x)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 0.5] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",y)})]})})})]})})},Epo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Parabolic Dish Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Fpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(SYe),i=M(TYe),a=M(PYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.absorptance)??.95),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.absorptance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.absorptance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.absorptance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.absorptance);const b={name:"Set Absorptance for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.absorptance:f.absorptance,R={name:"Set Parabolic Dish Absorptance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishAbsorptance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},kpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(CYe),i=M(RYe),a=M(HYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.opticalEfficiency)??.7),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.opticalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.opticalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.opticalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.opticalEfficiency);const b={name:"Set Optical Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.opticalEfficiency:f.opticalEfficiency,R={name:"Set Parabolic Dish Optical Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishOpticalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Lpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(MYe),i=M(IYe),a=M(zYe),l=M(En),s=M(vA),c=M(xA),u=M(no),d=M(Qn),f=uo(z.ParabolicDish),[p,g]=m.useState((f==null?void 0:f.thermalEfficiency)??.3),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.ParabolicDish&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.ParabolicDish&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.thermalEfficiency-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.thermalEfficiency)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.ParabolicDish&&!R.locked&&w.has(R.id)&&(R.thermalEfficiency=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for Selected Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.ParabolicDish&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Dishes",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.ParabolicDish,b.newValue)}};l(b),a(z.ParabolicDish,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.ParabolicDish&&R.foundationId===f.foundationId&&x.set(R.id,R.thermalEfficiency);const b={name:"Set Thermal Efficiency for All Parabolic Dishes Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.ParabolicDish,b.groupId,b.newValue)}};l(b),i(z.ParabolicDish,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.thermalEfficiency:f.thermalEfficiency,R={name:"Set Parabolic Dish Thermal Efficiency",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.parabolicDishThermalEfficiency=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.ParabolicDish?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("parabolicDishMenu.OnlyThisParabolicDish",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("parabolicDishMenu.AllParabolicDishesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("parabolicDishMenu.AllSelectedParabolicDishes",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("parabolicDishMenu.AllParabolicDishes",A)})]})})})]})})},Wpo=t=>{const e=[];if(t.type!==z.ParabolicDish)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"parabolic-dish-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"parabolic-dish-cut",label:h.jsx(kd,{})}),e.push({key:"parabolic-dish-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"parabolic-dish-radius",label:h.jsxs(eo,{Dialog:Hpo,children:[Y.t("parabolicDishMenu.RimDiameter",o)," ..."]})},{key:"parabolic-dish-latus-rectum",label:h.jsxs(eo,{Dialog:Mpo,children:[Y.t("parabolicDishMenu.LatusRectum",o)," ..."]})},{key:"parabolic-dish-structure-type",label:h.jsxs(eo,{Dialog:Ipo,children:[Y.t("parabolicDishMenu.ReceiverStructure",o)," ..."]})},{key:"parabolic-dish-pole-height",label:h.jsxs(eo,{Dialog:zpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"parabolic-dish-pole-radius",label:h.jsxs(eo,{Dialog:Dpo,children:[Y.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"parabolic-dish-reflectance",label:h.jsxs(eo,{Dialog:Epo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"parabolic-dish-absorptance",label:h.jsxs(eo,{Dialog:Fpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverAbsorptance",o)," ..."]})},{key:"parabolic-dish-optical-efficiency",label:h.jsxs(eo,{Dialog:kpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorOpticalEfficiency",o)," ..."]})},{key:"parabolic-dish-thermal-efficiency",label:h.jsxs(eo,{Dialog:Lpo,children:[Y.t("concentratedSolarPowerCollectorMenu.ReceiverThermalEfficiency",o)," ..."]})},{key:"parabolic-dish-draw-sun-beam",label:h.jsx(a2e,{solarCollector:n})},{key:"parabolic-dish-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Npo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(pYe),r=M(gYe),i=M(mYe),a=M(En),l=M(kb),s=M(Lb),c=M(no),u=M(Qn),d=uo(z.FresnelReflector),[f,p]=m.useState(!!(d!=null&&d.drawSunBeam)),g=$t(),A=T=>{s(T.target.value)},y=T=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.FresnelReflector&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.FresnelReflector&&!w.locked&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.FresnelReflector&&w.foundationId===(d==null?void 0:d.foundationId)&&!w.locked&&w.drawSunBeam!==T)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==T)return!0}return!1},S=(T,w)=>{M.getState().set(x=>{for(const b of x.elements)me.isSolarCollectorType(b.type)&&!b.locked&&b.type===z.FresnelReflector&&T.has(b.id)&&(b.drawSunBeam=w)})},C=T=>{if(d&&y(T))switch(l){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{S(x.oldValues,x.newValue)}};a(x),S(w,T),u(c+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.FresnelReflector&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Fresnel Reflectors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{i(z.FresnelReflector,x.newValue)}};a(x),i(z.FresnelReflector,T),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const w=new Map;for(const b of e)b.type===z.FresnelReflector&&b.foundationId===d.foundationId&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:d.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{x.groupId&&r(z.FresnelReflector,x.groupId,x.newValue)}};a(x),r(z.FresnelReflector,d.foundationId,T),u(c+1)}break}default:{const w=n(d.id),x=w?w.drawSunBeam:d.drawSunBeam,b={name:"Draw Sun Beam for Fresnel Reflector",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(b.changedElementId,b.oldValue)},redo:()=>{o(b.changedElementId,b.newValue)}};a(b),o(d.id,T),u(c+1);break}}},P=()=>{t(!1)},v=()=>{C(f)};return(d==null?void 0:d.type)!==z.FresnelReflector?null:h.jsx(so,{width:500,title:Y.t("solarCollectorMenu.DrawSunBeam",g),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:f,onChange:T=>{p(T)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",g)})]})})})]})})},{Option:Upo}=Uo,jpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(DYe),i=M(EYe),a=M(FYe),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=uo(z.FresnelReflector),[p,g]=m.useState((f==null?void 0:f.receiverId)??"None"),A=$t(),y=m.useMemo(()=>{const x=[];for(const b of n)if(b.type===z.Foundation){const R=b;R.solarStructure===Dn.FocusPipe&&x.push(R.id)}return x},[n]);m.useEffect(()=>{if(g("None"),f)if(f.receiverId)g(f.receiverId);else{const x=o(f.parentId);x&&x.type===z.Foundation&&x.solarStructure===Dn.FocusPipe&&g(x.id)}},[f]);const S=x=>{c(x.target.value)},C=x=>{switch(s){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.receiverId!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.FresnelReflector&&!b.locked&&b.receiverId!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.FresnelReflector&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&b.receiverId!==x)return!0;break;default:if((f==null?void 0:f.receiverId)!==x)return!0}return!1},P=(x,b)=>{e(R=>{for(const H of R.elements)me.isHeliostatOrFresnelReflector(H.type)&&!H.locked&&x.has(H.id)&&(H.type===z.Heliostat?H.towerId=b:H.type===z.FresnelReflector&&(H.receiverId=b))})},v=x=>{if(f&&C(x)){switch(s){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(b,x),d(u+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.FresnelReflector&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.FresnelReflector,R.newValue)}};l(R),a(z.FresnelReflector,x),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const H of n)H.type===z.FresnelReflector&&H.foundationId===f.foundationId&&b.set(H.id,H.receiverId);const R={name:"Set Receiver for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:f.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.FresnelReflector,R.groupId,R.newValue)}};l(R),i(z.FresnelReflector,f.foundationId,x),d(u+1)}break}default:{const b=o(f.id),R=b?b.receiverId:f.receiverId,H={name:"Set Receiver for Fresnel Reflector",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};l(H),r(f.id,x),d(u+1);break}}e(b=>{b.actionState.fresnelReflectorReceiver=x})}},T=()=>{t(!1)},w=()=>{p&&v(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(so,{width:640,title:Y.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",A),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsx(Uo,{style:{width:"160px"},value:p,onChange:x=>{g(x)},children:y.map((x,b)=>h.jsx(Upo,{value:x,children:Y.t("fresnelReflectorMenu.AbsorberPipe",A)+" "+(b+1)},b))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:S,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},Bpo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(Fw),r=M($q),i=M(xW),a=M(Gr),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=M(Xi),p=uo(z.FresnelReflector),[g,A]=m.useState((p==null?void 0:p.ly)??9),y=m.useRef(!1),S=m.useRef(),C=$t(),P=W=>{c(W.target.value)},v=(W,k)=>{const D=a(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},T=(W,k)=>!v(W,k),w=W=>{if(p){switch(s){case re.AllSelectedObjectsOfThisType:for(const k of e)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of e)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of e)if(k.type===z.FresnelReflector&&k.foundationId===(p==null?void 0:p.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((p==null?void 0:p.ly)-W)>Et)return!0}return!1}},x=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.ly=k)})},b=W=>{if(p&&w(W))switch(S.current=void 0,s){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{x(D.oldValues,D.newValue)}};l(D),x(k,W),d(u+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&k.set(L.id,L.ly);const D={name:"Set Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{i(z.FresnelReflector,D.newValue)}};l(D),i(z.FresnelReflector,W),d(u+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){y.current=!1;for(const k of e)if(k.type===z.FresnelReflector&&k.foundationId===p.foundationId&&T(k,W)){y.current=!0;break}if(y.current)S.current=W,A(p.ly);else{const k=new Map;for(const L of e)L.type===z.FresnelReflector&&L.foundationId===p.foundationId&&k.set(L.id,L.ly);const D={name:"Set Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:p.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())o(L,j)},redo:()=>{D.groupId&&r(z.FresnelReflector,D.groupId,D.newValue)}};l(D),r(z.FresnelReflector,p.foundationId,W),d(u+1)}}break}default:{const k=n(p.id),D=k?k.ly:p.ly;if(y.current=T(p,W),y.current)S.current=W,A(D);else{const L={name:"Set Fresnel Reflector Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:p.id,changedElementType:p.type,undo:()=>{o(L.changedElementId,L.oldValue)},redo:()=>{o(L.changedElementId,L.newValue)}};l(L),o(p.id,W),d(u+1)}break}}},R=()=>{y.current=!1,t(!1)},H=()=>{R(),f()},F=()=>{b(g),y.current||(t(!1),d(0))},E=W=>{if(!p)return 1;let k=W??1;return k=Math.max(1,Math.ceil((k-p.moduleLength/2)/p.moduleLength))*p.moduleLength,k},N=()=>{b(g)};if((p==null?void 0:p.type)!==z.FresnelReflector)return null;const U=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",C),rejectedMessage:U,onApply:N,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:p.moduleLength,max:200*p.moduleLength,step:p.moduleLength,style:{width:120},precision:2,value:g,onChange:W=>{W!==null&&A(E(W))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("fresnelReflectorMenu.ModuleLength",C)+": "+p.moduleLength.toFixed(1)+" "+Y.t("word.MeterAbbreviation",C),h.jsx("br",{}),Math.round(g/p.moduleLength)+" "+Y.t("fresnelReflectorMenu.ModulesLong",C),h.jsx("br",{}),Y.t("word.Maximum",C),": 200 ",Y.t("fresnelReflectorMenu.Modules",C)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",C)})]})})})]})})},Ypo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Width for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&k.set(L.id,L.lx);const D={name:"Set Width for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,D.newValue)}};s(D),a(z.FresnelReflector,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Width for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.FresnelReflector,D.groupId,D.newValue)}};s(D),i(z.FresnelReflector,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Fresnel Reflector Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.fresnelReflectorWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:10,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},Opo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(NYe),i=M(UYe),a=M(jYe),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.moduleLength)??3),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.moduleLength=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.FresnelReflector&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.moduleLength-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.moduleLength)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.FresnelReflector&&!L.locked&&W.has(L.id)&&(L.moduleLength=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Fresnel Reflectors",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.FresnelReflector,D.newValue)}};s(D),a(z.FresnelReflector,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.FresnelReflector&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.moduleLength);else{const k=new Map;for(const L of n)L.type===z.FresnelReflector&&L.foundationId===g.foundationId&&k.set(L.id,L.moduleLength);const D={name:"Set Module Length for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.FresnelReflector,D.groupId,D.newValue)}};s(D),i(z.FresnelReflector,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.moduleLength:g.moduleLength;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Fresnel Reflector Module Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.fresnelReflectorModuleLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("fresnelReflectorMenu.ModuleLength",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 10 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",P)})]})})})]})})},Vpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(kb),u=M(Lb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.FresnelReflector),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=m.useRef((g==null?void 0:g.poleHeight)??1),v=$t(),T=U=>{u(U.target.value)},w=U=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&M.getState().selectedElementIdSet.has(W.id)&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const W of n)if(W.type===z.FresnelReflector&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===(g==null?void 0:g.foundationId)&&!W.locked&&Math.abs(W.poleHeight-U)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const k of n)if(k.type===z.FresnelReflector&&k.parentId===g.parentId&&!k.locked&&Math.abs(k.poleHeight-U)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-U)>Et)return!0;break}}return!1}},x=(U,W)=>{M.getState().set(k=>{for(const D of k.elements)D.type===z.FresnelReflector&&!D.locked&&U.has(D.id)&&(D.poleHeight=W)})},b=U=>{if(g&&w(U)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(W.id)&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(D.id)&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{x(k.oldValues,k.newValue)}};s(k),x(W,U),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Fresnel Reflectors",timestamp:Date.now(),oldValues:W,newValue:U,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{a(z.FresnelReflector,k.newValue)}};s(k),a(z.FresnelReflector,U),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const W of n)if(W.type===z.FresnelReflector&&W.foundationId===g.foundationId&&.5*W.ly*Math.abs(Math.sin(W.tiltAngle))>U){S.current=!0;break}if(S.current)C.current=U,P.current=g.poleHeight;else{const W=new Map;for(const D of n)D.type===z.FresnelReflector&&D.foundationId===g.foundationId&&W.set(D.id,D.poleHeight);const k={name:"Set Pole Height for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:W,newValue:U,groupId:g.foundationId,undo:()=>{for(const[D,L]of k.oldValues.entries())r(D,L)},redo:()=>{k.groupId&&i(z.FresnelReflector,k.groupId,k.newValue)}};s(k),i(z.FresnelReflector,g.foundationId,U),f(d+1)}}break}default:{const W=o(g.id),k=W?W.poleHeight:g.poleHeight;if(S.current=.5*g.lx*Math.abs(Math.sin(g.tiltAngle))>U,S.current)C.current=U,P.current=k;else{const D={name:"Set Fresnel Reflector Pole Height",timestamp:Date.now(),oldValue:k,newValue:U,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(D.changedElementId,D.oldValue)},redo:()=>{r(D.changedElementId,D.newValue)}};s(D),r(g.id,U),f(d+1)}break}}e(W=>{W.actionState.fresnelReflectorPoleHeight=U})}},R=()=>{t(!1)},H=()=>{R(),p()},F=()=>{b(A),S.current||(t(!1),f(0))},E=()=>{b(A)};if((g==null?void 0:g.type)!==z.FresnelReflector)return null;const N=S.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",v),rejectedMessage:N,onApply:E,onClose:R,onClickCancel:H,onClickOk:F,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:U=>{U!==null&&y(U)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [0, 5] ",Y.t("word.MeterAbbreviation",v)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",v)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",v)})]})})})]})})},_po=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(kb),c=M(Lb),u=M(no),d=M(Qn),f=uo(z.FresnelReflector),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.FresnelReflector&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.FresnelReflector&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.FresnelReflector&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.FresnelReflector&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.FresnelReflector&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Fresnel Reflectors",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.FresnelReflector&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Fresnel Reflectors",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.FresnelReflector,b.newValue)}};l(b),a(z.FresnelReflector,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.FresnelReflector&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Fresnel Reflectors Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.FresnelReflector,b.groupId,b.newValue)}};l(b),i(z.FresnelReflector,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Fresnel Reflector Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.fresnelReflectorReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p)};return(f==null?void 0:f.type)!==z.FresnelReflector?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,value:p,step:.01,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("fresnelReflectorMenu.OnlyThisFresnelReflector",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("fresnelReflectorMenu.AllFresnelReflectorsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllSelectedFresnelReflectors",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("fresnelReflectorMenu.AllFresnelReflectors",A)})]})})})]})})},Gpo=t=>{const e=[];if(t.type!==z.FresnelReflector)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"fresnel-reflector-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"fresnel-reflector-cut",label:h.jsx(kd,{})}),e.push({key:"fresnel-reflector-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"fresnel-reflector-receiver",label:h.jsxs(eo,{Dialog:jpo,children:[Y.t("fresnelReflectorMenu.SelectAbsorberToReflectSunlightTo",o)," ..."]})},{key:"fresnel-reflector-length",label:h.jsxs(eo,{Dialog:Bpo,children:[Y.t("word.Length",o)," ..."]})},{key:"fresnel-reflector-width",label:h.jsxs(eo,{Dialog:Ypo,children:[Y.t("word.Width",o)," ..."]})},{key:"fresnel-reflector-module-length",label:h.jsxs(eo,{Dialog:Opo,children:[Y.t("fresnelReflectorMenu.ModuleLength",o)," ..."]})},{key:"fresnel-reflector-pole-height",label:h.jsxs(eo,{Dialog:Vpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"fresnel-reflector-reflectance",label:h.jsxs(eo,{Dialog:_po,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"fresnel-reflector-draw-sun-beam",label:h.jsxs(eo,{Dialog:Npo,children:[Y.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"fresnel-reflector-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Xpo=({setDialogVisible:t})=>{const e=M(Kn),n=M(Jn),o=M(pYe),r=M(gYe),i=M(mYe),a=M(En),l=M(Wb),s=M(Nb),c=M(no),u=M(Qn),d=uo(z.Heliostat),[f,p]=m.useState(!!(d!=null&&d.drawSunBeam)),g=$t(),A=T=>{s(T.target.value)},y=T=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Heliostat&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Heliostat&&!w.locked&&w.drawSunBeam!==T)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Heliostat&&w.foundationId===(d==null?void 0:d.foundationId)&&!w.locked&&w.drawSunBeam!==T)return!0;break;default:if((d==null?void 0:d.drawSunBeam)!==T)return!0}return!1},S=(T,w)=>{M.getState().set(x=>{for(const b of x.elements)b.type===z.Heliostat&&!b.locked&&T.has(b.id)&&(b.drawSunBeam=w)})},C=T=>{if(d&&y(T))switch(l){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.Heliostat&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for Selected Heliostats",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{S(x.oldValues,x.newValue)}};a(x),S(w,T),u(c+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)b.type===z.Heliostat&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Heliostats",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{i(z.Heliostat,x.newValue)}};a(x),i(z.Heliostat,T),u(c+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const w=new Map;for(const b of e)b.type===z.Heliostat&&b.foundationId===d.foundationId&&w.set(b.id,b.drawSunBeam);const x={name:"Draw Sun Beam for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:d.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())o(b,R)},redo:()=>{x.groupId&&r(z.Heliostat,x.groupId,x.newValue)}};a(x),r(z.Heliostat,d.foundationId,T),u(c+1)}break}default:{const w=n(d.id),x=w?w.drawSunBeam:d.drawSunBeam,b={name:"Draw Sun Beam for Heliostat",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:d.id,changedElementType:d.type,undo:()=>{o(b.changedElementId,b.oldValue)},redo:()=>{o(b.changedElementId,b.newValue)}};a(b),o(d.id,T),u(c+1);break}}},P=()=>{t(!1)},v=()=>{C(f)};return(d==null?void 0:d.type)!==z.Heliostat?null:h.jsx(so,{width:500,title:Y.t("solarCollectorMenu.DrawSunBeam",g),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:f,onChange:p})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",g)})]})})})]})})},{Option:Jpo}=Uo,Kpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(DYe),i=M(EYe),a=M(FYe),l=M(En),s=M(Wb),c=M(Nb),u=M(no),d=M(Qn),f=uo(z.Heliostat),[p,g]=m.useState((f==null?void 0:f.towerId)??"None"),A=$t(),y=m.useMemo(()=>{const x=[];for(const b of n)if(b.type===z.Foundation){const R=b;R.solarStructure===Dn.FocusTower&&x.push(R.id)}return x},[n]);m.useEffect(()=>{if(g("None"),f)if(f.towerId)g(f.towerId);else{const x=o(f.parentId);x&&x.type===z.Foundation&&x.solarStructure===Dn.FocusTower&&g(x.id)}},[f]);const S=x=>{c(x.target.value)},C=x=>{switch(s){case re.AllSelectedObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.towerId!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of n)if(b.type===z.Heliostat&&!b.locked&&b.towerId!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(f==null?void 0:f.foundationId)&&!b.locked&&b.towerId!==x)return!0;break;default:if((f==null?void 0:f.towerId)!==x)return!0}return!1},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Heliostat&&!H.locked&&x.has(H.id)&&(H.towerId=b)})},v=x=>{if(f&&C(x)){switch(s){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.towerId);const R={name:"Set Tower for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};l(R),P(b,x),d(u+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&b.set(H.id,H.towerId);const R={name:"Set Tower for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.Heliostat,R.newValue)}};l(R),a(z.Heliostat,x),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const b=new Map;for(const H of n)H.type===z.Heliostat&&H.foundationId===f.foundationId&&b.set(H.id,H.towerId);const R={name:"Set Tower for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:f.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};l(R),i(z.Heliostat,f.foundationId,x),d(u+1)}break}default:{const b=o(f.id),R=b?b.towerId:f.towerId,H={name:"Set Tower for Heliostat",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};l(H),r(f.id,x),d(u+1);break}}e(b=>{b.actionState.heliostatTower=x})}},T=()=>{t(!1)},w=()=>{p&&v(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("heliostatMenu.SelectTowerToReflectSunlightTo",A),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsx(Uo,{style:{width:"120px"},value:p,onChange:g,children:y.map((x,b)=>h.jsx(Jpo,{value:x,children:Y.t("heliostatMenu.Tower",A)+" "+(b+1)},b))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:S,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",A)})]})})})]})})},qpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(d3),i=M(qq),a=M(vW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.lx)??2),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.lx=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.Heliostat&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.lx-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.lx)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.lx=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.lx);const D={name:"Set Length for Selected Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&k.set(L.id,L.lx);const D={name:"Set Length for All Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,D.newValue)}};s(D),a(z.Heliostat,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.Heliostat&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.lx);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===g.foundationId&&k.set(L.id,L.lx);const D={name:"Set Length for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.Heliostat,D.groupId,D.newValue)}};s(D),i(z.Heliostat,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.lx:g.lx;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Heliostat Length",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.heliostatLength=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Length",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,style:{width:120},precision:2,value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},$po=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Fw),i=M($q),a=M(xW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.ly)??4),S=m.useRef(!1),C=m.useRef(),P=$t(),v=W=>{u(W.target.value)},T=(W,k)=>{const D=l(W);if(D){const L=JSON.parse(JSON.stringify(W));return L.ly=k,me.isSolarCollectorWithinHorizontalSurface(L,D)}return!1},w=(W,k)=>!T(W,k),x=W=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisType:for(const k of n)if(k.type===z.Heliostat&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const k of n)if(k.type===z.Heliostat&&k.foundationId===(g==null?void 0:g.foundationId)&&!k.locked&&Math.abs(k.ly-W)>Et)return!0;break;default:if(Math.abs((g==null?void 0:g.ly)-W)>Et)return!0}return!1}},b=(W,k)=>{M.getState().set(D=>{for(const L of D.elements)L.type===z.Heliostat&&!L.locked&&W.has(L.id)&&(L.ly=k)})},R=W=>{if(g&&x(W)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&M.getState().selectedElementIdSet.has(L.id)&&k.set(L.id,L.ly);const D={name:"Set Width for Selected Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{b(D.oldValues,D.newValue)}};s(D),b(k,W),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const k of n)if(k.type===z.Heliostat&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&k.set(L.id,L.ly);const D={name:"Set Width for All Heliostats",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{a(z.Heliostat,D.newValue)}};s(D),a(z.Heliostat,W),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const k of n)if(k.type===z.Heliostat&&k.foundationId===g.foundationId&&w(k,W)){S.current=!0;break}if(S.current)C.current=W,y(g.ly);else{const k=new Map;for(const L of n)L.type===z.Heliostat&&L.foundationId===g.foundationId&&k.set(L.id,L.ly);const D={name:"Set Width for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:g.foundationId,undo:()=>{for(const[L,j]of D.oldValues.entries())r(L,j)},redo:()=>{D.groupId&&i(z.Heliostat,D.groupId,D.newValue)}};s(D),i(z.Heliostat,g.foundationId,W),f(d+1)}}break}default:{const k=o(g.id),D=k?k.ly:g.ly;if(S.current=w(g,W),S.current)C.current=W,y(D);else{const L={name:"Set Heliostat Width",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(L.changedElementId,L.oldValue)},redo:()=>{r(L.changedElementId,L.newValue)}};s(L),r(g.id,W),f(d+1)}break}}e(k=>{k.actionState.heliostatWidth=W})}},H=()=>{S.current=!1,t(!1)},F=()=>{H(),p()},E=()=>{R(A),S.current||(t(!1),f(0))},N=()=>{R(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const U=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("word.Width",P),rejectedMessage:U,onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:20,step:.5,precision:2,style:{width:120},value:A,onChange:W=>{W!==null&&y(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.MinimumValue",P),": 1 ",Y.t("word.MeterAbbreviation",P),h.jsx("br",{}),Y.t("word.MaximumValue",P),": 20 ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Qpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(TW),i=M(PW),a=M(CW),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=M(Xi),g=uo(z.Heliostat),[A,y]=m.useState((g==null?void 0:g.poleHeight)??1),S=m.useRef(!1),C=m.useRef(),P=$t(),v=N=>{u(N.target.value)},T=N=>{if(g){switch(c){case re.AllSelectedObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&M.getState().selectedElementIdSet.has(U.id)&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const U of n)if(U.type===z.Heliostat&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const U of n)if(U.type===z.Heliostat&&U.foundationId===(g==null?void 0:g.foundationId)&&!U.locked&&Math.abs(U.poleHeight-N)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(g)){for(const W of n)if(W.type===z.Heliostat&&W.parentId===g.parentId&&!W.locked&&Math.abs(W.poleHeight-N)>Et)return!0}break}default:{if(Math.abs((g==null?void 0:g.poleHeight)-N)>Et)return!0;break}}return!1}},w=(N,U)=>{M.getState().set(W=>{for(const k of W.elements)k.type===z.Heliostat&&!k.locked&&N.has(k.id)&&(k.poleHeight=U)})},x=N=>{if(g&&T(N)){switch(C.current=void 0,c){case re.AllSelectedObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.Heliostat&&M.getState().selectedElementIdSet.has(U.id)&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&M.getState().selectedElementIdSet.has(k.id)&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for Selected Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{w(W.oldValues,W.newValue)}};s(W),w(U,N),f(d+1)}break}case re.AllObjectsOfThisType:{S.current=!1;for(const U of n)if(U.type===z.Heliostat&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Heliostats",timestamp:Date.now(),oldValues:U,newValue:N,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{a(z.Heliostat,W.newValue)}};s(W),a(z.Heliostat,N),f(d+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(g.foundationId){S.current=!1;for(const U of n)if(U.type===z.Heliostat&&U.foundationId===g.foundationId&&.5*Math.max(U.lx,U.ly)*Math.abs(Math.sin(U.tiltAngle))>N){S.current=!0;break}if(S.current)C.current=N,y(g.poleHeight);else{const U=new Map;for(const k of n)k.type===z.Heliostat&&k.foundationId===g.foundationId&&U.set(k.id,k.poleHeight);const W={name:"Set Pole Height for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:U,newValue:N,groupId:g.foundationId,undo:()=>{for(const[k,D]of W.oldValues.entries())r(k,D)},redo:()=>{W.groupId&&i(z.Heliostat,W.groupId,W.newValue)}};s(W),i(z.Heliostat,g.foundationId,N),f(d+1)}}break}default:{const U=o(g.id),W=U?U.poleHeight:g.poleHeight;if(S.current=.5*Math.max(g.lx,g.ly)*Math.abs(Math.sin(g.tiltAngle))>N,S.current)C.current=N,y(W);else{const k={name:"Set Heliostat Pole Height",timestamp:Date.now(),oldValue:W,newValue:N,changedElementId:g.id,changedElementType:g.type,undo:()=>{r(k.changedElementId,k.oldValue)},redo:()=>{r(k.changedElementId,k.newValue)}};s(k),r(g.id,N),f(d+1)}break}}e(U=>{U.actionState.heliostatPoleHeight=N})}},b=()=>{S.current=!1,t(!1)},R=()=>{b(),p()},H=()=>{x(A),S.current||(t(!1),f(0))},F=()=>{x(A)};if((g==null?void 0:g.type)!==z.Heliostat)return null;const E=S.current?": "+Y.t("message.NotApplicableToSelectedAction",P)+(C.current!==void 0?" ("+C.current.toFixed(2)+")":""):null;return h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.ExtraPoleHeightInAdditionToHalfWidth",P),rejectedMessage:E,onApply:F,onClose:b,onClickCancel:R,onClickOk:H,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:5,style:{width:120},step:.1,precision:2,value:A,onChange:N=>{N!==null&&y(N)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [0, 5] ",Y.t("word.MeterAbbreviation",P)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",P)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:v,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",P)})]})})})]})})},Zpo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(vYe),i=M(xYe),a=M(bYe),l=M(Gr),s=M(En),c=M(Wb),u=M(Nb),d=M(no),f=M(Qn),p=uo(z.Heliostat),[g,A]=m.useState((p==null?void 0:p.poleRadius)??.1),y=$t(),S=x=>{u(x.target.value)},C=x=>{if(p){switch(c){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.Heliostat&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.Heliostat&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.Heliostat&&b.foundationId===(p==null?void 0:p.foundationId)&&!b.locked&&Math.abs(b.poleRadius-x)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{if(l(p)){for(const R of n)if(R.type===z.Heliostat&&R.parentId===p.parentId&&!R.locked&&Math.abs(R.poleRadius-x)>Et)return!0}break}default:{if(Math.abs((p==null?void 0:p.poleRadius)-x)>Et)return!0;break}}return!1}},P=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.Heliostat&&!H.locked&&x.has(H.id)&&(H.poleRadius=b)})},v=x=>{if(p&&C(x)){switch(c){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for Selected Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{P(R.oldValues,R.newValue)}};s(R),P(b,x),f(d+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.Heliostat&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Heliostats",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{a(z.Heliostat,R.newValue)}};s(R),a(z.Heliostat,x),f(d+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(p.foundationId){const b=new Map;for(const H of n)H.type===z.Heliostat&&H.foundationId===p.foundationId&&b.set(H.id,H.poleRadius);const R={name:"Set Pole Radius for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:p.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())r(H,F)},redo:()=>{R.groupId&&i(z.Heliostat,R.groupId,R.newValue)}};s(R),i(z.Heliostat,p.foundationId,x),f(d+1)}break}default:{const b=o(p.id),R=b?b.poleRadius:p.poleRadius,H={name:"Set Heliostat Pole Radius",timestamp:Date.now(),oldValue:R,newValue:x,changedElementId:p.id,changedElementType:p.type,undo:()=>{r(H.changedElementId,H.oldValue)},redo:()=>{r(H.changedElementId,H.newValue)}};s(H),r(p.id,x),f(d+1);break}}e(b=>{b.actionState.heliostatPoleRadius=x})}},T=()=>{t(!1)},w=()=>{v(g)};return(p==null?void 0:p.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("solarCollectorMenu.PoleRadius",y),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:.5,style:{width:120},step:.01,precision:2,value:g,onChange:x=>{x!==null&&A(x)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",y),": [0.1, 0.5] ",Y.t("word.MeterAbbreviation",y)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:S,value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",y)})]})})})]})})},e1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Zq),i=M(e$),a=M(t$),l=M(En),s=M(Wb),c=M(Nb),u=M(no),d=M(Qn),f=uo(z.Heliostat),[p,g]=m.useState((f==null?void 0:f.reflectance)??.9),A=$t(),y=w=>{c(w.target.value)},S=w=>{if(f){switch(s){case re.AllSelectedObjectsOfThisType:for(const x of n)if(x.type===z.Heliostat&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisType:for(const x of n)if(x.type===z.Heliostat&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const x of n)if(x.type===z.Heliostat&&x.foundationId===(f==null?void 0:f.foundationId)&&!x.locked&&Math.abs(x.reflectance-w)>Et)return!0;break;default:if(Math.abs((f==null?void 0:f.reflectance)-w)>Et)return!0}return!1}},C=(w,x)=>{M.getState().set(b=>{for(const R of b.elements)R.type===z.Heliostat&&!R.locked&&w.has(R.id)&&(R.reflectance=x)})},P=w=>{if(f&&S(w)){switch(s){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Heliostat&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for Selected Heliostats",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{C(b.oldValues,b.newValue)}};l(b),C(x,w),d(u+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Heliostat&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Heliostats",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{a(z.Heliostat,b.newValue)}};l(b),a(z.Heliostat,w),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(f.foundationId){const x=new Map;for(const R of n)R.type===z.Heliostat&&R.foundationId===f.foundationId&&x.set(R.id,R.reflectance);const b={name:"Set Reflectance for All Heliostats Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:f.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())r(R,H)},redo:()=>{b.groupId&&i(z.Heliostat,b.groupId,b.newValue)}};l(b),i(z.Heliostat,f.foundationId,w),d(u+1)}break}default:{const x=o(f.id),b=x?x.reflectance:f.reflectance,R={name:"Set Heliostat Reflectance",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:f.id,changedElementType:f.type,undo:()=>{r(R.changedElementId,R.oldValue)},redo:()=>{r(R.changedElementId,R.newValue)}};l(R),r(f.id,w),d(u+1);break}}e(x=>{x.actionState.heliostatReflectance=w})}},v=()=>{t(!1)},T=()=>{P(p),t(!1),d(0)};return(f==null?void 0:f.type)!==z.Heliostat?null:h.jsx(so,{width:600,title:Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",A),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},precision:2,step:.01,value:p,onChange:w=>{w!==null&&g(w)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:s,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("heliostatMenu.OnlyThisHeliostat",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("heliostatMenu.AllHeliostatsAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("heliostatMenu.AllSelectedHeliostats",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("heliostatMenu.AllHeliostats",A)})]})})})]})})},t1o=t=>{const e=[];if(t.type!==z.Heliostat)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"heliostat-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"heliostat-cut",label:h.jsx(kd,{})}),e.push({key:"heliostat-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"heliostat-tower",label:h.jsxs(eo,{Dialog:Kpo,children:[Y.t("heliostatMenu.SelectTowerToReflectSunlightTo",o)," ..."]})},{key:"heliostat-length",label:h.jsxs(eo,{Dialog:qpo,children:[Y.t("word.Length",o)," ..."]})},{key:"heliostat-width",label:h.jsxs(eo,{Dialog:$po,children:[Y.t("word.Width",o)," ..."]})},{key:"heliostat-pole-height",label:h.jsxs(eo,{Dialog:Qpo,children:[Y.t("solarCollectorMenu.ExtraPoleHeight",o)," ..."]})},{key:"heliostat-pole-radius",label:h.jsxs(eo,{Dialog:Zpo,children:[Y.t("solarCollectorMenu.PoleRadius",o)," ..."]})},{key:"heliostat-reflectance",label:h.jsxs(eo,{Dialog:e1o,children:[Y.t("concentratedSolarPowerCollectorMenu.ReflectorReflectance",o)," ..."]})},{key:"heliostat-draw-sun-beam",label:h.jsxs(eo,{Dialog:Xpo,children:[Y.t("solarCollectorMenu.DrawSunBeam",o)," ..."]})},{key:"heliostat-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},{Option:mm}=Uo,n1o=be.memo(({tree:t})=>{const e=M(pn),n=M(En),[o,r]=m.useState(!1),i=$t(),a=(l,s)=>{e(c=>{for(const u of c.elements)if(u.type===z.Tree&&u.id===l){u.name=s;break}})};return h.jsxs(Uo,{style:{width:"160px"},value:(t==null?void 0:t.name)??pr.Pine,onChange:l=>{if(t){const s=t.name;if(s!==l){const c={name:"Change Tree",timestamp:Date.now(),oldValue:s,newValue:l,changedElementId:t.id,changedElementType:t.type,undo:()=>{a(c.changedElementId,c.oldValue)},redo:()=>{a(c.changedElementId,c.newValue)}};n(c),a(t.id,l),e(u=>{u.actionState.treeType=l}),r(!o)}}},children:[h.jsxs(mm,{value:pr.Apple,children:[h.jsx("img",{alt:pr.Apple,src:dde,height:20,style:{paddingRight:"8px"}})," ",Y.t("tree.Apple",i)]},pr.Apple),h.jsxs(mm,{value:pr.Birch,children:[h.jsx("img",{alt:pr.Birch,src:fde,height:20,style:{paddingRight:"20px"}})," ",Y.t("tree.Birch",i)]},pr.Birch),h.jsxs(mm,{value:pr.Coconut,children:[h.jsx("img",{alt:pr.Coconut,src:aQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.Coconut",i)]},pr.Coconut),h.jsxs(mm,{value:pr.Dogwood,children:[h.jsx("img",{alt:pr.Dogwood,src:hde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Dogwood",i)]},pr.Dogwood),h.jsxs(mm,{value:pr.Elm,children:[h.jsx("img",{alt:pr.Elm,src:pde,height:20,style:{paddingRight:"20px"}}),Y.t("tree.Elm",i)]},pr.Elm),h.jsxs(mm,{value:pr.FanPalm,children:[h.jsx("img",{alt:pr.FanPalm,src:lQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.FanPalm",i)]},pr.FanPalm),h.jsxs(mm,{value:pr.Linden,children:[h.jsx("img",{alt:pr.Linden,src:gde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Linden",i)]},pr.Linden),h.jsxs(mm,{value:pr.Magnolia,children:[h.jsx("img",{alt:pr.Magnolia,src:mde,height:20,style:{paddingRight:"10px"}})," ",Y.t("tree.Magnolia",i)]},pr.Magnolia),h.jsxs(mm,{value:pr.Maple,children:[h.jsx("img",{alt:pr.Maple,src:yde,height:20,style:{paddingRight:"12px"}})," ",Y.t("tree.Maple",i)]},pr.Maple),h.jsxs(mm,{value:pr.Oak,children:[h.jsx("img",{alt:pr.Oak,src:Ade,height:20,style:{paddingRight:"17px"}}),Y.t("tree.Oak",i)]},pr.Oak),h.jsxs(mm,{value:pr.Pine,children:[h.jsx("img",{alt:pr.Pine,src:sQe,height:20,style:{paddingRight:"18px"}})," ",Y.t("tree.Pine",i)]},pr.Pine),h.jsxs(mm,{value:pr.Spruce,children:[h.jsx("img",{alt:pr.Spruce,src:cQe,height:20,style:{paddingRight:"20px"}})," ",Y.t("tree.Spruce",i)]},pr.Spruce)]})}),o1o=t=>{const e=[];if(t.type!==z.Tree)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"tree-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"tree-cut",label:h.jsx(kd,{})}),e.push({key:"tree-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"tree-show-model",label:h.jsx(rho,{tree:n})},{key:"tree-flip",label:h.jsx(L9e,{billboardModel:n})}),e.push({key:"tree-change-type",label:h.jsxs(an,{stayAfterClick:!0,children:[h.jsxs(on,{style:{width:"100px"},children:[Y.t("treeMenu.Type",r),": "]}),h.jsx(n1o,{tree:n})]})},{key:"tree-spread",label:h.jsx(iho,{tree:n})},{key:"tree-height",label:h.jsx(aho,{tree:n})},{key:"tree-label-submenu",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},r1o=({wall:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Wall`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{update:!0,noPadding:!0,onClick:l,children:r})},LHe=({wall:t,objectType:e,lock:n,children:o})=>{const r=M.getState().updateElementLockById,i=M.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of M.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Wall`:`Unlock All Locked ${l} on Wall`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};M.getState().addUndoable(u)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},i1o=({wall:t})=>{const e=$t(),n=M.getState().set,o=(i,a)=>{n(l=>{const s=l.elements.find(c=>c.id===i&&c.type===z.Wall);s&&(s.parapet.display=a)})},r=i=>{const a=i.target.checked,l={name:"Parapet",timestamp:Date.now(),checked:a,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{o(t.id,!l.checked)},redo:()=>{o(t.id,l.checked)}};M.getState().addUndoable(l),o(t.id,a),n(s=>{s.actionState.wallParapet.display=a})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.parapet.display,onChange:r,children:Y.t("wallMenu.Parapet",e)})})},a1o=({wall:t})=>{const e=$t(),n=(i,a)=>{M.getState().set(l=>{for(const s of l.elements)if(s.id===i&&s.type===z.Wall){const c=s;c.wallStructure=a,(a===gc.Stud||a===gc.Pillar)&&(c.opacity=0);break}})},o=i=>{const a={name:"Select Wall Structure",timestamp:Date.now(),oldValue:t.wallStructure,newValue:i.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(a.changedElementId,a.oldValue)},redo:()=>{n(a.changedElementId,a.newValue)}};M.getState().addUndoable(a),n(t.id,i.target.value),M.getState().set(l=>{l.actionState.wallStructure=i.target.value,(l.actionState.wallStructure===gc.Stud||l.actionState.wallStructure===gc.Pillar)&&(l.actionState.wallOpacity=0)})},r=t.wallStructure??gc.Default;return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:r,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:gc.Default,children:Y.t("wallMenu.DefaultStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:gc.Stud,children:Y.t("wallMenu.StudStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:gc.Pillar,children:Y.t("wallMenu.PillarStructure",e)})]})})})},l1o=({wall:t})=>{const e=M.getState().set,n=$t(),o=(i,a,l)=>{const{cx:s,cy:c,cz:u}=a,d=l?l.rotation[2]+a.relativeAngle:a.relativeAngle;if(l&&d!==void 0){const f=me.wallAbsolutePosition(new le(s,c,u),l).setZ(a.lz/2+l.lz);return new le().subVectors(i,f).applyEuler(new ln(0,0,-d))}return new le},r=()=>{const i=M.getState().getFoundation(t);if(!i)return;const a=o(M.getState().pastePoint,t,i),l=Va.makePolygon(t,-a.x/t.lx,0,-a.z/t.lz,new le(0,0,1),[0,0,0],z.Wall);e(c=>{c.elements.push(l),c.objectTypeToAdd=z.None});const s={name:"Add",timestamp:Date.now(),addedElement:l,undo:()=>{M.getState().removeElementById(s.addedElement.id,!1)},redo:()=>{e(c=>{c.elements.push(s.addedElement),c.selectedElement=s.addedElement})}};M.getState().addUndoable(s)};return h.jsx(an,{onClick:r,children:Y.t("foundationMenu.AddPolygon",n)})},s1o=({wall:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.fill=i;break}})},o=r=>{const i={name:"Select Wall Fill",timestamp:Date.now(),oldValue:t.fill,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.fill,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Fl.Full,children:Y.t("wallMenu.Full",e)}),h.jsx(Le,{style:{width:"100%"},value:Fl.Partial,children:Y.t("wallMenu.Partial",e)}),h.jsx(Le,{style:{width:"100%"},value:Fl.Empty,children:Y.t("wallMenu.Empty",e)})]})})})},c1o=({wall:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Wall){l.openToOutside=i;break}})},o=r=>{const i={name:"Set Open to Outside",timestamp:Date.now(),oldValue:!!t.openToOutside,newValue:r.target.checked,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.checked)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.openToOutside,onChange:o,children:Y.t("wallMenu.OpenToOutside",e)})})},_ae=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"doorCount",lockedKey:"lockedDoorCount",objectType:z.Door},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"polygonCount",lockedKey:"lockedPolygonCount",objectType:z.Polygon},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],u1o=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${Y.t("wallMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisWall",n)} (${e} ${Y.t("wallMenu.SolarPanels",n)})`;break}case z.Window:{o=`${Y.t("wallMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllWindowsOnThisWall",n)} (${e} ${Y.t("wallMenu.Windows",n)})`;break}case z.Door:{o=`${Y.t("wallMenu.RemoveAllUnlockedDoors",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllDoorsOnThisWall",n)} (${e} ${Y.t("wallMenu.Doors",n)})`;break}case z.Sensor:{o=`${Y.t("wallMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllSensorsOnThisWall",n)} (${e} ${Y.t("wallMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("wallMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllLightsOnThisWall",n)} (${e} ${Y.t("wallMenu.Lights",n)})`;break}case z.Polygon:{o=`${Y.t("wallMenu.RemoveAllUnlockedPolygons",n)} (${e})`,r=`${Y.t("wallMenu.DoYouReallyWantToRemoveAllPolygonsOnThisWall",n)} (${e} ${Y.t("wallMenu.Polygons",n)})`;break}}return{itemLabel:o,modalTitle:r}},Gae=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],d1o=(t,e,n)=>{const o=[],r={lng:M.getState().language};return _ae.forEach(({key:i,objectType:a})=>{const l=Gae(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=u1o(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-wall`,label:h.jsx(r1o,{wall:t,objectType:a,modalTitle:c,children:s})})}}),_ae.forEach(({key:i,objectType:a})=>{const l=Gae(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-wall`,label:h.jsxs(LHe,{wall:t,objectType:a,lock:!0,children:[Y.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),_ae.forEach(({lockedKey:i,objectType:a})=>{const l=Gae(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(LHe,{wall:t,objectType:a,lock:!1,children:[Y.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!0,children:[Y.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!1,children:[Y.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},f1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),c=$t(),[u,d]=ZZ((s==null?void 0:s.parapet.color)??"#ffffff"),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.id===T&&b.type===z.Wall&&!b.locked){b.parapet.color=w;break}})},p=T=>{if(!s)return;const w=me.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.parapet.color=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.parentId===T&&b.type===z.Wall&&!b.locked&&(b.parapet.color=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.parapet.color=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.parapet.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.parapet.color&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.parapet.color&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.parapet.color&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=me.getAllConnectedWalls(s);for(const x of w)if(T!==x.parapet.color&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.parapet.color))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.parapet.color??"#ffffff");const x={name:"Set Parapet Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break;case re.AllConnectedObjects:if(s){const w=me.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Parapet Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1)}break;default:if(s){const w=l(s.id),x=(w==null?void 0:w.parapet.color)??s.parapet.color??"#ffffff",b={name:"Set Parapet Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}}e(w=>{w.actionState.wallParapet.color=T})}},P=()=>{C(u)},v=()=>{t(!1)};return h.jsx(so,{width:640,title:Y.t("wallMenu.ParapetColor",c),onApply:P,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u,onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",c)})]})})})]})})},Prt="/aladdin/assets/wall_01_menu-BlJdKfby.png",Crt="/aladdin/assets/wall_02_menu-DfsmvvWJ.png",Rrt="/aladdin/assets/wall_03_menu-B95_FEuA.png",Hrt="/aladdin/assets/wall_04_menu-D-Kn25E7.png",Mrt="/aladdin/assets/wall_05_menu-DGgjaMY9.png",Irt="/aladdin/assets/wall_06_menu-EOIch2eu.png",zrt="/aladdin/assets/wall_07_menu-DvXS_qn2.png",Drt="/aladdin/assets/wall_08_menu-CfftE2pF.png",Ert="/aladdin/assets/wall_09_menu-_O8A0WOE.png",Frt="/aladdin/assets/wall_10_menu-B5QfhD3g.png",h1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.parapet.textureType)??Bo.Default),d=$t(),{Option:f}=Uo,p=(w,x)=>{e(b=>{for(const R of b.elements)if(R.type===z.Wall&&R.id===w&&!R.locked){R.parapet.textureType=x;break}})},g=w=>{if(!s)return;const x=me.getAllConnectedWalls(s);x.length!==0&&e(b=>{for(const R of x)if(!R.locked)for(const H of b.elements)H.id===R.id&&H.type===z.Wall&&(H.parapet.textureType=w)})},A=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&R.foundationId===w&&!R.locked&&(R.parapet.textureType=x)})},y=w=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&(b.parapet.textureType=w)})},S=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&!R.locked&&w.has(R.id)&&(R.parapet.textureType=x)})},C=w=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.parapet.textureType&&!x.locked&&M.getState().selectedElementIdSet.has(x.id))return!0;break}case re.AllObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.parapet.textureType&&!x.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const x of n)if(x.type===z.Wall&&x.foundationId===s.foundationId&&w!==x.parapet.textureType&&!x.locked)return!0;break}case re.AllConnectedObjects:{const x=me.getAllConnectedWalls(s);for(const b of x)if(w!==b.parapet.textureType&&!b.locked)return!0;break}default:{if(w!==(s==null?void 0:s.parapet.textureType))return!0;break}}return!1}},P=w=>{if(s&&C(w)){switch(r){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.parapet.textureType??Bo.Default);const b={name:"Set Parapet Texture for Selected Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{S(b.oldValues,b.newValue)}};o(b),S(x,w),a(i+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&x.set(R.id,R.parapet.textureType??Bo.Default);const b={name:"Set Parapet Texture for All Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{y(b.newValue)}};o(b),y(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const x=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===s.foundationId&&!R.locked&&x.set(R.id,R.parapet.textureType);const b={name:"Set Parapet Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:s.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{b.groupId&&A(b.groupId,b.newValue)}};o(b),A(s.foundationId,w),a(i+1)}break;case re.AllConnectedObjects:if(s){const x=me.getAllConnectedWalls(s),b=new Map;for(const H of x)b.set(H.id,H.parapet.textureType);const R={name:"Set Parapet Texture for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:w,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{g(R.newValue)}};o(R),g(w),a(i+1)}break;default:if(s){const x=l(s.id),b=(x==null?void 0:x.parapet.textureType)??s.parapet.textureType,R={name:"Set Parapet Texture of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(s.id,w),a(i+1)}}e(x=>{x.actionState.wallParapet.textureType=w})}},v=()=>{t(!1)},T=()=>{P(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:u,children:[h.jsxs(f,{value:Bo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},Bo.NoTexture),h.jsxs(f,{value:Bo.Default,children:[h.jsx("img",{alt:Bo.Default,src:Uye,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.TextureDefault",d)]},Bo.Default),h.jsxs(f,{value:Bo.Texture01,children:[h.jsx("img",{alt:Bo.Texture01,src:Prt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture01",d)]},Bo.Texture01),h.jsxs(f,{value:Bo.Texture02,children:[h.jsx("img",{alt:Bo.Texture02,src:Crt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture02",d)]},Bo.Texture02),h.jsxs(f,{value:Bo.Texture03,children:[h.jsx("img",{alt:Bo.Texture03,src:Rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture03",d)]},Bo.Texture03),h.jsxs(f,{value:Bo.Texture04,children:[h.jsx("img",{alt:Bo.Texture04,src:Hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture04",d)]},Bo.Texture04),h.jsxs(f,{value:Bo.Texture05,children:[h.jsx("img",{alt:Bo.Texture05,src:Mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture05",d)]},Bo.Texture05),h.jsxs(f,{value:Bo.Texture06,children:[h.jsx("img",{alt:Bo.Texture06,src:Irt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture06",d)]},Bo.Texture06),h.jsxs(f,{value:Bo.Texture07,children:[h.jsx("img",{alt:Bo.Texture07,src:zrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture07",d)]},Bo.Texture07),h.jsxs(f,{value:Bo.Texture08,children:[h.jsx("img",{alt:Bo.Texture08,src:Drt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture08",d)]},Bo.Texture08),h.jsxs(f,{value:Bo.Texture09,children:[h.jsx("img",{alt:Bo.Texture09,src:Ert,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture09",d)]},Bo.Texture09),h.jsxs(f,{value:Bo.Texture10,children:[h.jsx("img",{alt:Bo.Texture10,src:Frt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture10",d)]},Bo.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:w=>M.getState().setWallActionScope(w.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})},Xae=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=M(Kn),s=M(En),c=M(g3),u=M(no),d=M(Qn),f=M(pn),p=m.useRef(t.parapet[n]),g=$t(),A=R=>{f(H=>{switch(n){case"copingsHeight":H.actionState.wallParapet.copingsHeight=R;break;case"copingsWidth":H.actionState.wallParapet.copingsWidth=R;break;case"parapetHeight":H.actionState.wallParapet.parapetHeight=R;break}})},y=(R,H)=>{f(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Wall&&!E.locked){E.parapet[n]=H;break}}),A(H)},S=R=>{const H=me.getAllConnectedWalls(t);H.length!==0&&(f(F=>{for(const E of H)if(!E.locked)for(const N of F.elements)N.id===E.id&&N.type===z.Wall&&(N.parapet[n]=R)}),A(R))},C=(R,H)=>{f(F=>{for(const E of F.elements)E.parentId===R&&E.type===z.Wall&&!E.locked&&(E.parapet[n]=H)}),A(H)},P=R=>{f(H=>{for(const F of H.elements)F.type===z.Wall&&!F.locked&&(F.parapet[n]=R)}),A(R)},v=(R,H)=>{f(F=>{for(const E of F.elements)E.type===z.Wall&&!E.locked&&R.has(E.id)&&(E.parapet[n]=H)}),A(H)},T=R=>{switch(c){case re.AllSelectedObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H.parapet[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break}case re.AllObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H.parapet[n]&&!H.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of l)if(H.type===z.Wall&&H.foundationId===t.foundationId&&R!==H.parapet[n]&&!H.locked)return!0;break}case re.AllConnectedObjects:{const H=me.getAllConnectedWalls(t);for(const F of H)if(R!==F.parapet[n]&&!F.locked)return!0;break}default:{if(R!==t.parapet[n])return!0;break}}return!1},w=R=>{if(t&&T(R))switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{v(F.oldValues,F.newValue)}};s(F),v(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.newValue)}};s(F),P(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const H=new Map;for(const E of l)E.type===z.Wall&&E.foundationId===t.foundationId&&H.set(E.id,E.parapet[n]);const F={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&C(F.groupId,F.newValue)}};s(F),C(t.foundationId,R),d(u+1)}break;case re.AllConnectedObjects:if(t){const H=me.getAllConnectedWalls(t),F=new Map;for(const N of H)F.set(N.id,N.parapet[n]);const E={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:F,newValue:R,undo:()=>{for(const[N,U]of E.oldValues.entries())y(N,U)},redo:()=>{S(E.newValue)}};s(E),S(R),d(u+1)}break;default:if(t){const H=t.parapet[n],F={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(F.changedElementId,F.oldValue)},redo:()=>{y(F.changedElementId,F.newValue)}};s(F),y(t.id,R),d(u+1)}}},x=()=>{a(!1)},b=()=>{w(p.current)};return h.jsx(so,{width:550,title:Y.t(`wallMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t.parapet[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [",o.toString(),"] ",i]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",g)})]})})})]})})};var w_=(t=>(t.ParapetHeight="ParapetHeight",t.CopingsHeight="CopingsHeight",t.CopingsWidth="CopingsWidth",t))(w_||{});const p1o={ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},Jae=({Dialog:t,wall:e,dataType:n,children:o})=>{const r=$t(),[i,a]=m.useState(!1),l=()=>{M.getState().setApplyCount(0),a(!0)},s=p1o[n];return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:!0,onClick:l,children:o}),i&&h.jsx(t,{wall:e,dataType:n,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?Y.t(s.unit,r):void 0,setDialogVisible:a})]})},g1o=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"parapet-checkbox",label:h.jsx(i1o,{wall:t})}),t.parapet.display&&n.push({type:"divider"},{key:"parapet-color",label:h.jsxs(eo,{noPadding:!0,Dialog:f1o,children:[Y.t("wallMenu.ParapetColor",e)," ..."]})},{key:"parapet-texture",label:h.jsxs(eo,{noPadding:!0,Dialog:h1o,children:[Y.t("wallMenu.ParapetTexture",e)," ..."]})},{key:"parapet-height",label:h.jsxs(Jae,{wall:t,dataType:w_.ParapetHeight,Dialog:Xae,children:[Y.t("wallMenu.ParapetHeight",e)," ..."]})},{key:"copings-height",label:h.jsxs(Jae,{wall:t,dataType:w_.CopingsHeight,Dialog:Xae,children:[Y.t("wallMenu.CopingsHeight",e)," ..."]})},{key:"copings-width",label:h.jsxs(Jae,{wall:t,dataType:w_.CopingsWidth,Dialog:Xae,children:[Y.t("wallMenu.CopingsWidth",e)," ..."]})}),n},dC=({wall:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,setDialogVisible:a})=>{const l=M(Kn),s=M(En),c=M(g3),u=M(no),d=M(Qn),f=M(pn),p=m.useRef(t[n]),g=$t(),A=R=>{f(H=>{switch(n){case"ly":H.actionState.wallThickness=R;break;case"lz":H.actionState.wallHeight=R;break;case"opacity":H.actionState.wallOpacity=R;break;case"structureSpacing":H.actionState.wallStructureSpacing=R;break;case"structureWidth":H.actionState.wallStructureWidth=R;break;case"eavesLength":H.actionState.wallEavesLength=R;break}})},y=(R,H)=>{f(F=>{for(const E of F.elements)if(E.id===R&&E.type===z.Wall&&!E.locked){E[n]=H;break}}),A(H)},S=R=>{const H=me.getAllConnectedWalls(t);H.length!==0&&(f(F=>{for(const E of H)if(!E.locked)for(const N of F.elements)N.id===E.id&&N.type===z.Wall&&(N[n]=R)}),A(R))},C=(R,H)=>{f(F=>{for(const E of F.elements)E.parentId===R&&E.type===z.Wall&&!E.locked&&(E[n]=H)}),A(H)},P=R=>{f(H=>{for(const F of H.elements)F.type===z.Wall&&!F.locked&&(F[n]=R)}),A(R)},v=(R,H)=>{f(F=>{for(const E of F.elements)E.type===z.Wall&&!E.locked&&R.has(E.id)&&(E[n]=H)}),A(H)},T=R=>{switch(c){case re.AllSelectedObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break}case re.AllObjectsOfThisType:{for(const H of l)if(H.type===z.Wall&&R!==H[n]&&!H.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const H of l)if(H.type===z.Wall&&H.foundationId===t.foundationId&&R!==H[n]&&!H.locked)return!0;break}case re.AllConnectedObjects:{const H=me.getAllConnectedWalls(t);for(const F of H)if(R!==F[n]&&!F.locked)return!0;break}default:{if(R!==t[n])return!0;break}}return!1},w=R=>{if(t&&T(R))switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E[n]);const F={name:`Set ${e} for Selected Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{v(F.oldValues,F.newValue)}};s(F),v(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of l)E.type===z.Wall&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Walls`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.newValue)}};s(F),P(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const H=new Map;for(const E of l)E.type===z.Wall&&E.foundationId===t.foundationId&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Walls Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&C(F.groupId,F.newValue)}};s(F),C(t.foundationId,R),d(u+1)}break;case re.AllConnectedObjects:if(t){const H=me.getAllConnectedWalls(t),F=new Map;for(const N of H)F.set(N.id,N[n]);const E={name:`Set ${e} for All Connected Walls`,timestamp:Date.now(),oldValues:F,newValue:R,undo:()=>{for(const[N,U]of E.oldValues.entries())y(N,U)},redo:()=>{S(E.newValue)}};s(E),S(R),d(u+1)}break;default:if(t){const H=t[n],F={name:`Set Wall ${e}`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{y(F.changedElementId,F.oldValue)},redo:()=>{y(F.changedElementId,F.newValue)}};s(F),y(t.id,R),d(u+1)}}},x=()=>{p.current=t[n],a(!1)},b=()=>{w(p.current)};return h.jsx(so,{width:550,title:Y.t(`wallMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,defaultValue:t[n],onChange:R=>p.current=R}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [",o.toString(),"] ",i]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i??" "}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWallActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",g)})]})})})]})})},fC=({Dialog:t,noPadding:e,dataType:n,children:o})=>{const r=$t(),[i,a]=m.useState(!1),l=uo(z.Wall),s=()=>{M.getState().setApplyCount(0),a(!0)},c=S1o[n];return h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:e,onClick:s,children:o}),i&&l&&h.jsx(t,{wall:l,dataType:n,attributeKey:c.attributeKey,range:c.range,step:c.step,unit:c.unit?Y.t(c.unit,r):void 0,setDialogVisible:a})]})},m1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),[c,u]=ZZ((s==null?void 0:s.structureColor)??"#ffffff"),d=$t(),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.id===T&&b.type===z.Wall&&!b.locked){b.structureColor=w;break}})},p=T=>{if(!s)return;const w=me.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.structureColor=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.parentId===T&&b.type===z.Wall&&!b.locked&&(b.structureColor=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.structureColor=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.structureColor&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.structureColor&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.structureColor&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=me.getAllConnectedWalls(s);for(const x of w)if(T!==x.structureColor&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.structureColor))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.structureColor??"#ffffff");const x={name:"Set Structure Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break;case re.AllConnectedObjects:if(s){const w=me.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Structure Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1)}break;default:if(s){const w=l(s.id),x=(w==null?void 0:w.structureColor)??s.structureColor??"#ffffff",b={name:"Set Structure Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}}e(w=>{w.actionState.wallStructureColor=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:640,title:Y.t("wallMenu.StructureColor",d),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:u})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})};var eg=(t=>(t.Height="Height",t.Opacity="Opacity",t.StructureSpacing="StructureSpacing",t.StructureWidth="StructureWidth",t.Thickness="Thickness",t.EavesLength="EavesLength",t))(eg||{});const y1o=t=>{const e=[],n={lng:M.getState().language};return e.push({key:"wall-structure-submenu-radio-group",label:h.jsx(a1o,{wall:t}),style:{backgroundColor:"white"}}),t.wallStructure!==gc.Default&&e.push({type:"divider"},{key:"wall-structure-spacing",label:h.jsxs(fC,{noPadding:!0,dataType:eg.StructureSpacing,Dialog:dC,children:[Y.t(`wallMenu.${eg.StructureSpacing}`,n)," ..."]})},{key:"wall-structure-width",label:h.jsxs(fC,{noPadding:!0,dataType:eg.StructureWidth,Dialog:dC,children:[Y.t(`wallMenu.${eg.StructureWidth}`,n)," ..."]})},{key:"wall-structure-color",label:h.jsxs(eo,{noPadding:!0,Dialog:m1o,children:[Y.t("wallMenu.StructureColor",n)," ..."]})}),e},A1o=t=>{const e=[];return e.push({key:"wall-fill-radio-group",label:h.jsx(s1o,{wall:t}),style:{backgroundColor:"white"}}),t.fill!==Fl.Full&&e.push({type:"divider"},{key:"wall-open-to-outside-checkbox",label:h.jsx(c1o,{wall:t})}),e},w1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.rValue)??p6),[d,f]=m.useState(me.toRValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.rValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:{for(const w of e)if(w.type===z.Wall&&T!==w.rValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of e)if(w.type===z.Wall&&T!==w.rValue&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of e)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.rValue&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=me.getAllConnectedWalls(s);for(const x of w)if(T!==x.rValue&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.rValue))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Wall&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Wall&&!b.locked){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s!=null&&s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Wall&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.rValue??p6),g(R.id,T)}const x={name:"Set R-Value for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;case re.AllConnectedObjects:if(s){const w=me.getAllConnectedWalls(s),x=new Map;for(const R of w)if(!R.locked){const H=R;x.set(R.id,H.rValue??p6),g(H.id,T)}const b={name:"Set R-Value for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{A(b.oldValues)},redo:()=>{y(b.oldValues,b.newValue)}};n(b),i(r+1)}break;default:if(s){const x=a(s.id).rValue??s.rValue??p6,b={name:"Set Wall R-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.wallRValue=T})}},P=()=>{u((s==null?void 0:s.rValue)??p6),t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.RValue",p)+" "}(${Y.t("word.ThermalResistance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(me.toRValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toRValueInUS(.01),max:me.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(me.toRValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",me.toRValueInUS(.01).toFixed(3),", ",me.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",p)})]})})})]})})},v1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Wall),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Wall&&P!==T.volumetricHeatCapacity&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Wall&&P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Wall&&T.foundationId===s.foundationId&&P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;case re.AllConnectedObjects:const v=me.getAllConnectedWalls(s);for(const T of v)if(P!==T.volumetricHeatCapacity&&!T.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Wall&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for Selected Walls",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Wall&&!w.locked){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for All Walls",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s!=null&&s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Wall&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.volumetricHeatCapacity??.5),f(x.id,P)}const T={name:"Set Volumetric Heat Capacity for All Walls Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break}case re.AllConnectedObjects:{if(s){const v=me.getAllConnectedWalls(s),T=new Map;for(const x of v)if(!x.locked){const b=x;T.set(x.id,b.volumetricHeatCapacity??.5),f(b.id,P)}const w={name:"Set Volumetric Heat Capacity for All Connected Walls",timestamp:Date.now(),oldValues:T,newValue:P,undo:()=>{p(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),i(r+1)}break}default:{if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Wall",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}break}}l(v=>{v.actionState.wallVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setWallActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",d)})]})})})]})})},x1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=$t(),c=uo(z.Wall),[u,d]=m.useState((c==null?void 0:c.textureType)??Bo.Default),{Option:f}=Uo,p=(w,x)=>{e(b=>{for(const R of b.elements)if(R.type===z.Wall&&R.id===w&&!R.locked){R.textureType=x;break}})},g=w=>{if(!c)return;const x=me.getAllConnectedWalls(c);x.length!==0&&e(b=>{for(const R of x)if(!R.locked)for(const H of b.elements)H.id===R.id&&H.type===z.Wall&&(H.textureType=w)})},A=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&R.foundationId===w&&!R.locked&&(R.textureType=x)})},y=w=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&(b.textureType=w)})},S=(w,x)=>{e(b=>{for(const R of b.elements)R.type===z.Wall&&!R.locked&&w.has(R.id)&&(R.textureType=x)})},C=w=>{if(c){switch(r){case re.AllSelectedObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.textureType&&!x.locked&&M.getState().selectedElementIdSet.has(x.id))return!0;break}case re.AllObjectsOfThisType:{for(const x of n)if(x.type===z.Wall&&w!==x.textureType&&!x.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const x of n)if(x.type===z.Wall&&x.foundationId===c.foundationId&&w!==x.textureType&&!x.locked)return!0;break}case re.AllConnectedObjects:{const x=me.getAllConnectedWalls(c);for(const b of x)if(w!==b.textureType&&!b.locked)return!0;break}default:{if(w!==(c==null?void 0:c.textureType))return!0;break}}return!1}},P=w=>{if(c&&C(w)){switch(r){case re.AllSelectedObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&M.getState().selectedElementIdSet.has(R.id)&&x.set(R.id,R.textureType??Bo.Default);const b={name:"Set Texture for Selected Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{S(b.oldValues,b.newValue)}};o(b),S(x,w),a(i+1);break}case re.AllObjectsOfThisType:{const x=new Map;for(const R of n)R.type===z.Wall&&!R.locked&&x.set(R.id,R.textureType??Bo.Default);const b={name:"Set Texture for All Walls",timestamp:Date.now(),oldValues:x,newValue:w,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{y(b.newValue)}};o(b),y(w),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const x=new Map;for(const R of n)R.type===z.Wall&&R.foundationId===c.foundationId&&!R.locked&&x.set(R.id,R.textureType);const b={name:"Set Texture for All Walls Above Foundation",timestamp:Date.now(),oldValues:x,newValue:w,groupId:c.foundationId,undo:()=>{for(const[R,H]of b.oldValues.entries())p(R,H)},redo:()=>{b.groupId&&A(b.groupId,b.newValue)}};o(b),A(c.foundationId,w),a(i+1)}break;case re.AllConnectedObjects:if(c){const x=me.getAllConnectedWalls(c),b=new Map;for(const H of x)b.set(H.id,H.textureType);const R={name:"Set Texture for All Connected Walls",timestamp:Date.now(),oldValues:b,newValue:w,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{g(R.newValue)}};o(R),g(w),a(i+1)}break;default:if(c){const x=l(c.id),b=(x==null?void 0:x.textureType)??c.textureType,R={name:"Set Texture of Selected Wall",timestamp:Date.now(),oldValue:b,newValue:w,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};o(R),p(c.id,w),a(i+1)}}e(x=>{x.actionState.wallTexture=w})}},v=()=>{t(!1)},T=()=>{P(u)};return h.jsx(so,{width:550,title:Y.t("word.Texture",s),onApply:T,onClose:v,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:u,onChange:d,children:[h.jsxs(f,{value:Bo.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",s)]},Bo.NoTexture),h.jsxs(f,{value:Bo.Default,children:[h.jsx("img",{alt:Bo.Default,src:Uye,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.TextureDefault",s)]},Bo.Default),h.jsxs(f,{value:Bo.Texture01,children:[h.jsx("img",{alt:Bo.Texture01,src:Prt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture01",s)]},Bo.Texture01),h.jsxs(f,{value:Bo.Texture02,children:[h.jsx("img",{alt:Bo.Texture02,src:Crt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture02",s)]},Bo.Texture02),h.jsxs(f,{value:Bo.Texture03,children:[h.jsx("img",{alt:Bo.Texture03,src:Rrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture03",s)]},Bo.Texture03),h.jsxs(f,{value:Bo.Texture04,children:[h.jsx("img",{alt:Bo.Texture04,src:Hrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture04",s)]},Bo.Texture04),h.jsxs(f,{value:Bo.Texture05,children:[h.jsx("img",{alt:Bo.Texture05,src:Mrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture05",s)]},Bo.Texture05),h.jsxs(f,{value:Bo.Texture06,children:[h.jsx("img",{alt:Bo.Texture06,src:Irt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture06",s)]},Bo.Texture06),h.jsxs(f,{value:Bo.Texture07,children:[h.jsx("img",{alt:Bo.Texture07,src:zrt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture07",s)]},Bo.Texture07),h.jsxs(f,{value:Bo.Texture08,children:[h.jsx("img",{alt:Bo.Texture08,src:Drt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture08",s)]},Bo.Texture08),h.jsxs(f,{value:Bo.Texture09,children:[h.jsx("img",{alt:Bo.Texture09,src:Ert,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture09",s)]},Bo.Texture09),h.jsxs(f,{value:Bo.Texture10,children:[h.jsx("img",{alt:Bo.Texture10,src:Frt,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("wallMenu.Texture10",s)]},Bo.Texture10)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:w=>M.getState().setWallActionScope(w.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",s)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",s)})]})})})]})})},b1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(g3),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Wall),c=$t(),[u,d]=ZZ((s==null?void 0:s.color)??"#ffffff"),f=(T,w)=>{e(x=>{for(const b of x.elements)if(b.type===z.Wall&&b.id===T&&!b.locked){b.color=w;break}})},p=T=>{if(!s)return;const w=me.getAllConnectedWalls(s);w.length!==0&&e(x=>{for(const b of w)if(!b.locked)for(const R of x.elements)R.id===b.id&&R.type===z.Wall&&(R.color=T)})},g=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&b.foundationId===T&&!b.locked&&(b.color=w)})},A=T=>{e(w=>{for(const x of w.elements)x.type===z.Wall&&!x.locked&&(x.color=T)})},y=(T,w)=>{e(x=>{for(const b of x.elements)b.type===z.Wall&&!b.locked&&T.has(b.id)&&(b.color=w)})},S=T=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.color&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break}case re.AllObjectsOfThisType:{for(const w of n)if(w.type===z.Wall&&T!==w.color&&!w.locked)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const w of n)if(w.type===z.Wall&&w.foundationId===s.foundationId&&T!==w.color&&!w.locked)return!0;break}case re.AllConnectedObjects:{const w=me.getAllConnectedWalls(s);for(const x of w)if(T!==x.color&&!x.locked)return!0;break}default:{if(T!==(s==null?void 0:s.color))return!0;break}}return!1}},C=T=>{if(s&&S(T)){switch(r){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&M.getState().selectedElementIdSet.has(b.id)&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for Selected Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{y(x.oldValues,x.newValue)}};o(x),y(w,T),a(i+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of n)b.type===z.Wall&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for All Walls",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{A(x.newValue)}};o(x),A(T),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const w=new Map;for(const b of n)b.type===z.Wall&&b.foundationId===s.foundationId&&w.set(b.id,b.color??"#ffffff");const x={name:"Set Color for All Walls Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{for(const[b,R]of x.oldValues.entries())f(b,R)},redo:()=>{x.groupId&&g(x.groupId,x.newValue)}};o(x),g(s.foundationId,T),a(i+1)}break}case re.AllConnectedObjects:{const w=me.getAllConnectedWalls(s),x=new Map;for(const R of w)x.set(R.id,R.color??"#ffffff");const b={name:"Set Color for All Connected Walls",timestamp:Date.now(),oldValues:x,newValue:T,undo:()=>{for(const[R,H]of b.oldValues.entries())f(R,H)},redo:()=>{p(b.newValue)}};o(b),p(T),a(i+1);break}default:{if(s){const w=l(s.id),x=(w==null?void 0:w.color)??s.color??"#ffffff",b={name:"Set Color of Selected Wall",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(b.changedElementId,b.oldValue)},redo:()=>{f(b.changedElementId,b.newValue)}};o(b),f(s.id,T),a(i+1)}break}}e(w=>{w.actionState.wallColor=T})}},P=()=>{t(!1)},v=()=>{C(u)};return h.jsx(so,{width:640,title:Y.t("wallMenu.Color",c),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u,onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWallActionScope(T.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("wallMenu.OnlyThisWall",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllConnectedObjects,children:Y.t("wallMenu.AllConnectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("wallMenu.AllWallsAboveFoundation",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("wallMenu.AllSelectedWalls",c)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("wallMenu.AllWalls",c)})]})})})]})})},S1o={Height:{attributeKey:"lz",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},Opacity:{attributeKey:"opacity",range:[0,1],step:.01},StructureSpacing:{attributeKey:"structureSpacing",range:[.1,1e3],step:.1,unit:"word.MeterAbbreviation"},StructureWidth:{attributeKey:"structureWidth",range:[.01,1],step:.1,unit:"word.MeterAbbreviation"},Thickness:{attributeKey:"ly",range:[.1,1],step:.01,unit:"word.MeterAbbreviation"},EavesLength:{attributeKey:"eavesLength",range:[-.1,5],step:.01,unit:"word.MeterAbbreviation"},ParapetHeight:{attributeKey:"parapetHeight",range:[0,5],step:.01,unit:"word.MeterAbbreviation"},CopingsHeight:{attributeKey:"copingsHeight",range:[0,1],step:.01,unit:"word.MeterAbbreviation"},CopingsWidth:{attributeKey:"copingsWidth",range:[0,3],step:.01,unit:"word.MeterAbbreviation"}},T1o=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0){const e=t[0];if(me.isLegalOnWall(e.type))return!0}return!1},P1o=t=>{const e=[];if(t.type!==z.Wall)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1);return T1o()&&e.push({key:"wall-paste",label:h.jsx(oM,{})}),e.push({key:"wall-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"wall-cut",label:h.jsx(kd,{})}),e.push({key:"wall-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(a.gotSome()&&e.push({key:"lock-unlock-clear-on-wall",label:h.jsx(an,{children:Y.t("word.Elements",r)}),children:d1o(n,a,l)}),e.push({key:"wall-parapet",label:h.jsx(an,{children:Y.t("wallMenu.Parapet",r)}),children:g1o(n)}),e.push({key:"wall-structure",label:h.jsx(an,{children:Y.t("wallMenu.WallStructure",r)}),children:y1o(n)}),n.wallStructure!==gc.Default&&e.push({key:"wall-opacity",label:h.jsxs(fC,{dataType:eg.Opacity,Dialog:dC,children:[Y.t(`wallMenu.${eg.Opacity}`,r)," ..."]})}),e.push({key:"wall-fill",label:h.jsx(an,{children:Y.t("wallMenu.Fill",r)}),children:A1o(n)},{key:"add-polygon-on-wall",label:h.jsx(l1o,{wall:n})},{key:"wall-thickness",label:h.jsxs(fC,{dataType:eg.Thickness,Dialog:dC,children:[Y.t(`wallMenu.${eg.Thickness}`,r)," ..."]})},{key:"wall-height",label:h.jsxs(fC,{dataType:eg.Height,Dialog:dC,children:[Y.t(`wallMenu.${eg.Height}`,r)," ..."]})},{key:"wall-eaves-length",label:h.jsxs(fC,{dataType:eg.EavesLength,Dialog:dC,children:[Y.t(`wallMenu.${eg.EavesLength}`,r)," ..."]})},{key:"wall-r-value",label:h.jsxs(eo,{Dialog:w1o,children:[Y.t("word.RValue",r)," ..."]})},{key:"wall-heat-capacity",label:h.jsxs(eo,{Dialog:v1o,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"wall-texture",label:h.jsxs(eo,{Dialog:x1o,children:[Y.t("wallMenu.Texture",r)," ..."]})},{key:"wall-color",label:h.jsxs(eo,{Dialog:b1o,children:[Y.t("wallMenu.Color",r)," ..."]})})),{items:e}},C1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.filled=i;break}})},o=r=>{const i=r.target.checked,a={name:"Filled Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.doorFilled=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.filled,onChange:o,children:Y.t("doorMenu.Filled",e)})})}),R1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Door",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.doorInterior=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.interior,onChange:o,children:Y.t("doorMenu.Interior",e)})})}),H1o=be.memo(({door:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Door){l.doorType=i;break}})},o=r=>{const i={name:"Select Door Type",timestamp:Date.now(),oldValue:t.doorType,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value),M.getState().set(a=>{a.actionState.doorType=r.target.value})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.doorType,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Rd.Default,children:Y.t("doorMenu.Default",e)}),h.jsx(Le,{style:{width:"100%"},value:Rd.Arched,children:Y.t("doorMenu.Arched",e)})]})})})}),M1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=M(Gr),c=uo(z.Door),u=m.useMemo(()=>{const x=c?c.lx:1,b=c?s(c):null;return b?x*b.lx:x},[c==null?void 0:c.lx]),[d,f]=m.useState(u),p=$t(),g=(x,b)=>{l(R=>{for(const H of R.elements)if(H.id===x&&H.type===z.Door){const F=H,E=s(F);F.lx=E?b/E.lx:b;break}})},A=x=>{for(const[b,R]of x.entries())g(b,R)},y=(x,b)=>{for(const R of x.keys())g(R,b)},S=x=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.AllObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of e)if(b.type===z.Door&&b.foundationId===c.foundationId&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}case re.OnlyThisSide:{for(const b of e)if(b.type===z.Door&&b.parentId===c.parentId&&!b.locked){const R=s(b);if(R&&x!==b.lx*R.lx)return!0}break}default:{const b=s(c);if(b&&x!==c.lx*b.lx)return!0;break}}return!1}},C=x=>{if(c&&S(x))switch(o){case re.AllSelectedObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for Selected Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.foundationId===c.foundationId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case re.OnlyThisSide:if(c.parentId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.parentId===c.parentId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lx*(N?N.lx:1)),E.lx=N?x/N.lx:x}});const R={name:"Set Width for All Doors On the Same Wall",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.parentId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const b=a(c.id),R=c?s(b):null,H=(b.lx??c.lx??.1)*(R?R.lx:1),F={name:"Set Door Width",timestamp:Date.now(),oldValue:H,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};n(F),g(c.id,x),i(r+1)}}},P=()=>{t(!1)},v=()=>{C(d)},T=c?s(c):null,w=T&&c?2*T.lx*Math.min(Math.abs(.5-c.cx),Math.abs(-.5-c.cx)):100;return h.jsx(so,{width:550,title:Y.t("word.Width",p),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:w,style:{width:120},step:.1,precision:2,value:d,formatter:x=>Number(x).toFixed(2),onChange:x=>f(x)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, ",w.toFixed(1),"]",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x=>M.getState().setDoorActionScope(x.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},I1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=M(Gr),c=uo(z.Door),u=m.useMemo(()=>{const x=c?c.lz:1,b=c?s(c):null;return b?x*b.lz:x},[c==null?void 0:c.lz]),[d,f]=m.useState(u),p=$t(),g=(x,b)=>{l(R=>{for(const H of R.elements)if(H.id===x&&H.type===z.Door){const F=H,E=s(F);F.lz=E?b/E.lz:b,E&&(F.cz=-(E.lz-b)/(2*E.lz));break}})},A=x=>{for(const[b,R]of x.entries())g(b,R)},y=(x,b)=>{for(const R of x.keys())g(R,b)},S=x=>{if(c){switch(o){case re.AllSelectedObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.AllObjectsOfThisType:{for(const b of e)if(b.type===z.Door&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of e)if(b.type===z.Door&&b.foundationId===c.foundationId&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}case re.OnlyThisSide:{for(const b of e)if(b.type===z.Door&&b.parentId===c.parentId&&!b.locked){const R=s(b);if(R&&x!==b.lz*R.lz)return!0}break}default:{const b=s(c);if(b&&x!==c.lz*b.lz)return!0;break}}return!1}},C=x=>{if(c&&S(x))switch(o){case re.AllSelectedObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for Selected Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisType:{const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(c.foundationId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.foundationId===c.foundationId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;case re.OnlyThisSide:if(c.parentId){const b=new Map;l(H=>{for(const F of H.elements)if(F.type===z.Door&&F.parentId===c.parentId&&!F.locked){const E=F,N=E?s(E):null;b.set(F.id,E.lz*(N?N.lz:1)),E.lz=N?x/N.lz:x,N&&(E.cz=-(N.lz-x)/(2*N.lz))}});const R={name:"Set Height for All Doors On the Same Wall",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.parentId,undo:()=>{A(R.oldValues)},redo:()=>{y(R.oldValues,R.newValue)}};n(R),i(r+1)}break;default:if(c){const b=a(c.id),R=c?s(b):null,H=(b.lz??c.lz??.2)*(R?R.lz:1),F={name:"Set Door Height",timestamp:Date.now(),oldValue:H,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{g(F.changedElementId,F.oldValue)},redo:()=>{g(F.changedElementId,F.newValue)}};n(F),g(c.id,x),i(r+1)}}},P=()=>{f(u),t(!1)},v=()=>{C(d)},T=c?s(c):null,w=(T==null?void 0:T.lz)??20;return h.jsx(so,{width:550,title:Y.t("word.Height",p),onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:w,style:{width:120},step:.1,precision:2,value:d,formatter:x=>Number(x).toFixed(2),onChange:x=>{x!==null&&f(x)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, ",w.toFixed(1),"]",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:x=>M.getState().setDoorActionScope(x.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},z1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.opacity)??1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.opacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.opacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.opacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===s.foundationId&&P!==v.opacity&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===s.parentId&&P!==v.opacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.parentId===s.parentId&&!x.locked){const b=x;v.set(x.id,b.opacity??1),b.opacity=P}});const T={name:"Set Opacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).opacity??s.opacity??1,w={name:"Set Opacity of Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.doorOpacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("wallMenu.Opacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},D1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.uValue)??J4),[d,f]=m.useState(me.toUValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.uValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Door&&T!==w.uValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Door&&T!==w.uValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Door&&w.foundationId===s.foundationId&&T!==w.uValue&&!w.locked)return!0;break;case re.OnlyThisSide:for(const w of e)if(w.type===z.Door&&w.parentId===s.parentId&&T!==w.uValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for Selected Doors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&R.foundationId===s.foundationId&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const w=new Map;l(b=>{for(const R of b.elements)if(R.type===z.Door&&R.parentId===s.parentId&&!R.locked){const H=R;w.set(R.id,H.uValue??J4),H.uValue=T}});const x={name:"Set U-Value for All Doors On the Same Wall",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.parentId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;default:if(s){const x=a(s.id).uValue??s.uValue??J4,b={name:"Set Door U-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.doorUValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.UValue",p)+" "}(${Y.t("word.ThermalTransmittance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(me.toUValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toUValueInUS(.01),max:me.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(me.toUValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",me.toUValueInUS(.01).toFixed(3),", ",me.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setDoorActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",p)})]})})})]})})},E1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.volumetricHeatCapacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Door&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of e)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Door&&x.parentId===s.parentId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.doorVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>{P!==null&&u(P)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},F1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(Ww),r=M(no),i=M(Qn),a=M(pn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.textureType)??sr.Default),d=$t(),{Option:f}=Uo,p=(v,T)=>{a(w=>{for(const x of w.elements)if(x.id===v){x.locked||(x.textureType=T);break}})},g=(v,T)=>{for(const w of v.keys())p(w,T)},A=v=>{for(const[T,w]of v.entries())p(T,w)},y=v=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Door&&v!==T.textureType&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Door&&v!==T.textureType&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Door&&T.foundationId===s.foundationId&&v!==T.textureType&&!T.locked)return!0;break;case re.OnlyThisSide:for(const T of e)if(T.type===z.Door&&T.parentId===s.parentId&&v!==T.textureType&&!T.locked)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0;break}return!1}},S=v=>{if(s&&y(v)){switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??sr.Default);const w={name:"Set Texture for Selected Doors",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&!x.locked&&T.set(x.id,x.textureType??sr.Default);const w={name:"Set Texture for All Doors",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&x.foundationId===s.foundationId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Doors Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.foundationId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;case re.OnlyThisSide:if(s.parentId){const T=new Map;for(const x of M.getState().elements)x.type===z.Door&&x.parentId===s.parentId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Doors On the Same Wall",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.parentId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;default:if(s){const T=l(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Door",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(s.id,v),i(r+1)}}a(T=>{T.actionState.doorTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:v=>u(v),children:[h.jsxs(f,{value:sr.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},sr.NoTexture),h.jsxs(f,{value:sr.Default,children:[h.jsx("img",{alt:sr.Default,src:Y$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.TextureDefault",d)]},sr.Default),h.jsxs(f,{value:sr.Texture01,children:[h.jsx("img",{alt:sr.Texture01,src:O$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture01",d)]},sr.Texture01),h.jsxs(f,{value:sr.Texture02,children:[h.jsx("img",{alt:sr.Texture02,src:ude,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture02",d)]},sr.Texture02),h.jsxs(f,{value:sr.Texture03,children:[h.jsx("img",{alt:sr.Texture03,src:V$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture03",d)]},sr.Texture03),h.jsxs(f,{value:sr.Texture04,children:[h.jsx("img",{alt:sr.Texture04,src:_$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture04",d)]},sr.Texture04),h.jsxs(f,{value:sr.Texture05,children:[h.jsx("img",{alt:sr.Texture05,src:G$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture05",d)]},sr.Texture05),h.jsxs(f,{value:sr.Texture06,children:[h.jsx("img",{alt:sr.Texture06,src:X$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture06",d)]},sr.Texture06),h.jsxs(f,{value:sr.Texture07,children:[h.jsx("img",{alt:sr.Texture07,src:J$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture07",d)]},sr.Texture07),h.jsxs(f,{value:sr.Texture08,children:[h.jsx("img",{alt:sr.Texture08,src:K$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture08",d)]},sr.Texture08),h.jsxs(f,{value:sr.Texture09,children:[h.jsx("img",{alt:sr.Texture09,src:q$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture09",d)]},sr.Texture09),h.jsxs(f,{value:sr.Texture10,children:[h.jsx("img",{alt:sr.Texture10,src:$$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture10",d)]},sr.Texture10),h.jsxs(f,{value:sr.Texture11,children:[h.jsx("img",{alt:sr.Texture11,src:Q$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture11",d)]},sr.Texture11),h.jsxs(f,{value:sr.Texture12,children:[h.jsx("img",{alt:sr.Texture12,src:Z$e,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture12",d)]},sr.Texture12),h.jsxs(f,{value:sr.Texture13,children:[h.jsx("img",{alt:sr.Texture13,src:eQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture13",d)]},sr.Texture13),h.jsxs(f,{value:sr.Texture14,children:[h.jsx("img",{alt:sr.Texture14,src:tQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture14",d)]},sr.Texture14),h.jsxs(f,{value:sr.Texture15,children:[h.jsx("img",{alt:sr.Texture15,src:nQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture15",d)]},sr.Texture15),h.jsxs(f,{value:sr.Texture16,children:[h.jsx("img",{alt:sr.Texture16,src:oQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture16",d)]},sr.Texture16),h.jsxs(f,{value:sr.Texture17,children:[h.jsx("img",{alt:sr.Texture17,src:rQe,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("doorMenu.Texture17",d)]},sr.Texture17)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:v=>M.getState().setDoorActionScope(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},k1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Ww),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.color)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.color=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Door&&P!==v.color&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Door&&P!==v.color&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&P!==v.color&&!v.locked)return!0;break;case re.OnlyThisSide:for(const v of n)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&P!==v.color&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.parentId===s.parentId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.color:s.color)??"#ffffff",w={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.doorColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("word.Color",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},L1o=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(Ww),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Door),[c,u]=m.useState((s==null?void 0:s.frameColor)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){!w.locked&&w.type===z.Door&&(w.frameColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Door&&!v.locked&&M.getState().selectedElementIdSet.has(v.id)&&P!==v.frameColor)return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Door&&!v.locked&&P!==v.frameColor)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Door&&v.foundationId===(s==null?void 0:s.foundationId)&&!v.locked&&P!==v.frameColor)return!0;break;case re.OnlyThisSide:for(const v of n)if(v.type===z.Door&&v.parentId===(s==null?void 0:s.parentId)&&!v.locked&&P!==v.frameColor)return!0;break;default:if(P!==(s==null?void 0:s.frameColor))return!0;break}return!1},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for Selected Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&!w.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;case re.OnlyThisSide:if(s.parentId){const v=new Map;for(const w of M.getState().elements)w.type===z.Door&&w.parentId===s.parentId&&!s.locked&&v.set(w.id,w.frameColor??"#ffffff");const T={name:"Set Color for All Doors On the Same Wall",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.parentId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.frameColor:s.frameColor)??"#ffffff",w={name:"Set Color of Selected Door",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.doorColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("doorMenu.FrameColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c??(s==null?void 0:s.frameColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setDoorActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("doorMenu.OnlyThisDoor",d)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("doorMenu.AllDoorsOnWall",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("doorMenu.AllDoorsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("doorMenu.AllSelectedDoors",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("doorMenu.AllDoors",d)})]})})})]})})},W1o=t=>{const e=[];if(t.type!==z.Door)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"door-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"door-cut",label:h.jsx(kd,{})}),e.push({key:"door-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"door-filled",label:h.jsx(C1o,{door:n})},{key:"door-interior",label:h.jsx(R1o,{door:n})}),e.push({key:"door-type-submenu",label:h.jsx(an,{children:Y.t("doorMenu.DoorType",r)}),children:[{key:"door-type-radio-group",label:h.jsx(H1o,{door:n}),style:{backgroundColor:"white"}}]},{key:"door-width",label:h.jsxs(eo,{Dialog:M1o,children:[Y.t("word.Width",r)," ..."]})},{key:"door-height",label:h.jsxs(eo,{Dialog:I1o,children:[Y.t("word.Height",r)," ..."]})}),n.filled&&(e.push({key:"door-u-value",label:h.jsxs(eo,{Dialog:D1o,children:[Y.t("word.UValue",r)," ..."]})},{key:"door-heat-capacity",label:h.jsxs(eo,{Dialog:E1o,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"door-texture",label:h.jsxs(eo,{Dialog:F1o,children:[Y.t("word.Texture",r)," ..."]})},{key:"door-color",label:h.jsxs(eo,{Dialog:k1o,children:[Y.t("word.Color",r)," ..."]})},{key:"door-frame-color",label:h.jsxs(eo,{Dialog:L1o,children:[Y.t("doorMenu.FrameColor",r)," ..."]})}),(n.textureType===sr.Default||n.textureType===sr.NoTexture)&&e.push({key:"door-opacity",label:h.jsxs(eo,{Dialog:z1o,children:[Y.t("wallMenu.Opacity",r)," ..."]})}))),{items:e}},N1o=({windowModel:t,dataType:e,attributeKey:n,range:o,step:r,unit:i,note:a,digit:l,setDialogVisible:s})=>{const c=M(Kn),u=M(En),d=M(MW),f=M(no),p=M(Qn),g=M(pn),A=M(Gr),y=m.useMemo(()=>{const W=t[n],k=A(t);if(k&&t.parentType!==z.Roof){if(n==="lx")return W*k.lx;if(n==="lz")return W*k.lz}return n==="sillWidth"&&W===void 0?.2:W},[n,t]),[S,C]=m.useState(y),P=$t(),v=(W,k,D)=>{const L=A(W);L&&(k==="lx"||k==="lz")?W.parentType===z.Roof?W[k]=D:W[k]=D/L[k]:W[k]=D},T=(W,k)=>{g(D=>{for(const L of D.elements)if(L.id===W){!L.locked&&L.type===z.Window&&v(L,n,k);break}})},w=(W,k)=>{W&&g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&L.parentId===W&&v(L,n,k)})},x=(W,k)=>{W&&g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&L.foundationId===W&&v(L,n,k)})},b=W=>{g(k=>{for(const D of k.elements)!D.locked&&D.type===z.Window&&v(D,n,W)})},R=(W,k)=>{g(D=>{for(const L of D.elements)!L.locked&&L.type===z.Window&&W.has(L.id)&&v(L,n,k)})},H=W=>{for(const[k,D]of W.entries())T(k,D)},F=W=>{switch(d){case re.AllSelectedObjectsOfThisType:{for(const k of c)if(k.type===z.Window&&!k.locked&&M.getState().selectedElementIdSet.has(k.id)){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.AllObjectsOfThisType:{for(const k of c)if(k.type===z.Window&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const k of c)if(k.type===z.Window&&k.foundationId===t.foundationId&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}case re.OnlyThisSide:{for(const k of c)if(k.type===z.Window&&k.parentId===t.parentId&&!k.locked){const D=k,L=A(D);if(L&&D.parentType!==z.Roof){if(n==="lx"){if(W!==D[n]*L.lx)return!0}else if(n==="lz"){if(W!==D[n]*L.lz)return!0}else if(W!==D[n])return!0}else if(W!==D[n])return!0}break}default:{const k=A(t);if(k&&t.parentType!==z.Roof){if(n==="lx"){if(W!==t[n]*k.lx)return!0}else if(n==="lz"){if(W!==t[n]*k.lz)return!0}else if(W!==t[n])return!0}else if(W!==t[n])return!0;break}}return!1},E=W=>{if(t&&F(W)){switch(d){case re.AllSelectedObjectsOfThisType:{const k=new Map;for(const L of c)if(L.type===z.Window&&!L.locked&&M.getState().selectedElementIdSet.has(L.id)){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{H(D.oldValues)},redo:()=>{R(D.oldValues,D.newValue)}};u(D),R(k,W),p(f+1);break}case re.AllObjectsOfThisType:{const k=new Map;for(const L of c)if(L.type===z.Window&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{H(D.oldValues)},redo:()=>{b(D.newValue)}};u(D),b(W),p(f+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(t.foundationId){const k=new Map;for(const L of c)if(L.type===z.Window&&L.foundationId===t.foundationId&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:k,newValue:W,groupId:t.foundationId,undo:()=>{H(D.oldValues)},redo:()=>{x(t.foundationId,D.newValue)}};u(D),x(t.foundationId,W),p(f+1)}break;case re.OnlyThisSide:if(t.parentId){const k=new Map;for(const L of c)if(L.type===z.Window&&L.parentId===t.parentId&&!L.locked){const j=L,B=A(j);let O=j[n];B&&j.parentType!==z.Roof&&(n==="lx"?O*=B.lx:n==="lz"&&(O*=B.lz)),k.set(L.id,O)}const D={name:`Set ${e} for All Windows On the Same Parent`,timestamp:Date.now(),oldValues:k,newValue:W,groupId:t.parentId,undo:()=>{H(D.oldValues)},redo:()=>{w(t.parentId,D.newValue)}};u(D),w(t.parentId,W),p(f+1)}break;default:if(t){let k=t[n];const D=A(t);D&&t.parentType!==z.Roof&&(n==="lx"?k*=D.lx:n==="lz"&&(k*=D.lz));const L={name:`Set Window ${e}`,timestamp:Date.now(),oldValue:k,newValue:W,changedElementId:t.id,changedElementType:t.type,undo:()=>{T(L.changedElementId,L.oldValue)},redo:()=>{T(L.changedElementId,L.newValue)}};u(L),T(t.id,W),p(f+1)}}g(k=>{switch(e){case Qh.Width:k.actionState.windowWidth=W;break;case Qh.Height:k.actionState.windowHeight=W;break;case Qh.Opacity:k.actionState.windowOpacity=W;break;case Qh.FrameWidth:k.actionState.windowFrameWidth=W;break;case Qh.SillWidth:k.actionState.windowSillWidth=W;break;case Qh.HorizontalMullionSpacing:k.actionState.windowHorizontalMullionSpacing=W;break;case Qh.VerticalMullionSpacing:k.actionState.windowVerticalMullionSpacing=W;break;case Qh.MullionWidth:k.actionState.windowMullionWidth=W;break}})}},N=()=>{s(!1)},U=()=>{E(S)};return h.jsx(so,{width:550,title:Y.t(`windowMenu.${e}`,P),onApply:U,onClose:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:o[0],max:o[1],style:{width:120},step:r,precision:2,value:S,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&C(W)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",P),": [",o[0].toFixed(o[0]===0?0:l??0),","," ",o[1].toFixed(l??0),"] ",i," ",h.jsx("br",{}),h.jsx("br",{})," ",a]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:i}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:W=>M.getState().setWindowActionScope(W.target.value),value:d,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",P)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",P)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",P)})]})})})]})})},U1o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=M(Kn),i=M(pn),a=M(En),l=M(MW),s=M(no),c=M(Qn),[u,d]=ZZ(t[n]??"#ffffff"),f=$t(),p=(x,b)=>{i(R=>{for(const H of R.elements)if(H.id===x){!H.locked&&H.type===z.Window&&(H[n]=b);break}})},g=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.parentId===x&&(H[n]=b)})},A=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.foundationId===x&&(H[n]=b)})},y=x=>{i(b=>{for(const R of b.elements)!R.locked&&R.type===z.Window&&(R[n]=x)})},S=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&x.has(H.id)&&(H[n]=b)})},C=x=>{for(const[b,R]of x.entries())p(b,R)},P=x=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const b of r)if(b.type===z.Window&&x!==b[n]&&!b.locked&&M.getState().selectedElementIdSet.has(b.id))return!0;break;case re.AllObjectsOfThisType:for(const b of r)if(b.type===z.Window&&x!==b[n]&&!b.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of r)if(b.type===z.Window&&b.foundationId===t.foundationId&&x!==b[n]&&!b.locked)return!0;break;case re.OnlyThisSide:for(const b of r)if(b.type===z.Window&&b.parentId===t.parentId&&x!==b[n]&&!b.locked)return!0;break;default:if(x!==t[n])return!0;break}return!1},v=x=>{if(t&&P(x)){switch(l){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{S(R.oldValues,R.newValue)}};a(R),S(b,x),c(s+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{y(R.newValue)}};a(R),y(x),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const b=new Map;for(const H of r)H.type===z.Window&&H.foundationId===t.foundationId&&!t.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{A(R.groupId,R.newValue)}};a(R),A(t.foundationId,x),c(s+1)}break}case re.OnlyThisSide:{if(t.parentId){const b=new Map;for(const H of r)H.type===z.Window&&H.parentId===t.parentId&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{g(t.parentId,R.newValue)}};a(R),g(t.parentId,x),c(s+1)}break}default:{if(t){const b=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,x),c(s+1)}break}}i(b=>{switch(e){case Qh.Tint:b.actionState.windowTint=x;break;case Qh.MullionColor:b.actionState.windowMullionColor=x;break;case Qh.Color:b.actionState.windowColor=x;break}})}},T=()=>{o()},w=()=>{t[n]!==u&&v(u)};return h.jsx(so,{width:640,title:Y.t(`windowMenu.${e}`,f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u??"#73D8FF",onChangeComplete:d})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:x=>M.getState().setWindowActionScope(x.target.value),value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",f)})]})})})]})})},j1o=({window:t,dataType:e,attributeKey:n,setDialogVisible:o})=>{const r=M(Kn),i=M(pn),a=M(En),l=M(MW),s=M(no),c=M(Qn),[u,d]=m.useState(t[n]),f=$t(),p=(x,b)=>{i(R=>{for(const H of R.elements)if(H.id===x&&!H.locked&&H.type===z.Window){H[n]=b;break}})},g=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.parentId===x&&(H[n]=b)})},A=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&H.foundationId===x&&(H[n]=b)})},y=x=>{i(b=>{for(const R of b.elements)!R.locked&&R.type===z.Window&&(R[n]=x)})},S=(x,b)=>{i(R=>{for(const H of R.elements)!H.locked&&H.type===z.Window&&x.has(H.id)&&(H[n]=b)})},C=x=>{for(const[b,R]of x.entries())p(b,R)},P=x=>{switch(l){case re.AllSelectedObjectsOfThisType:for(const b of r)if(b.type===z.Window&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b[n]!==x)return!0;break;case re.AllObjectsOfThisType:for(const b of r)if(b.type===z.Window&&!b.locked&&b[n]!==x)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const b of r)if(b.type===z.Window&&b.foundationId===t.foundationId&&!b.locked&&b[n]!==x)return!0;break;case re.OnlyThisSide:for(const b of r)if(b.type===z.Window&&b.parentId===t.parentId&&!b.locked&&b[n]!==x)return!0;break;default:if(t[n]!==x)return!0;break}return!1},v=x=>{if(t&&P(x))switch(l){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&b.set(H.id,H[n]);const R={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{S(R.oldValues,R.newValue)}};a(R),S(b,x),c(s+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of r)H.type===z.Window&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{C(R.oldValues)},redo:()=>{y(R.newValue)}};a(R),y(x),c(s+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const b=new Map;for(const H of r)H.type===z.Window&&H.foundationId===t.foundationId&&!t.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.foundationId,undo:()=>{C(R.oldValues)},redo:()=>{A(R.groupId,R.newValue)}};a(R),A(t.foundationId,x),c(s+1)}break}case re.OnlyThisSide:{if(t.parentId){const b=new Map;for(const H of r)H.type===z.Window&&H.parentId===t.parentId&&!H.locked&&b.set(H.id,H[n]);const R={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:b,newValue:x,groupId:t.parentId,undo:()=>{C(R.oldValues)},redo:()=>{g(t.parentId,R.newValue)}};a(R),g(t.parentId,x),c(s+1)}break}default:{if(t){const b=t[n],R={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:t.id,changedElementType:t.type,undo:()=>{p(R.changedElementId,R.oldValue)},redo:()=>{p(R.changedElementId,R.newValue)}};a(R),p(t.id,x),c(s+1)}break}}},T=()=>{o()},w=()=>{t[n]!==u&&v(u)};return h.jsx(so,{width:500,title:Y.t(`windowMenu.${e}`,f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsx(vc,{checked:u,onChange:x=>{d(x)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:x=>M.getState().setWindowActionScope(x.target.value),value:l,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",f)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",f)})]})})})]})})},{Option:B1o}=Uo,Y1o=({window:t,dataType:e,attributeKey:n,options:o,optionsText:r,setDialogVisible:i})=>{const a=M(Kn),l=M(pn),s=M(En),c=M(MW),u=M(no),d=M(Qn),[f,p]=m.useState(t[n]),g=$t(),A=(R,H)=>{l(F=>{for(const E of F.elements)if(E.id===R){!E.locked&&E.type===z.Window&&(E[n]=H);break}})},y=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&E.parentId===R&&(E[n]=H)})},S=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&E.foundationId===R&&(E[n]=H)})},C=R=>{l(H=>{for(const F of H.elements)!F.locked&&F.type===z.Window&&(F[n]=R)})},P=(R,H)=>{l(F=>{for(const E of F.elements)!E.locked&&E.type===z.Window&&R.has(E.id)&&(E[n]=H)})},v=R=>{for(const[H,F]of R.entries())A(H,F)},T=R=>{if(t){switch(c){case re.AllSelectedObjectsOfThisType:for(const H of a)if(H.type===z.Window&&R!==H[n]&&!H.locked&&M.getState().selectedElementIdSet.has(H.id))return!0;break;case re.AllObjectsOfThisType:for(const H of a)if(H.type===z.Window&&R!==H[n]&&!H.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of a)if(H.type===z.Window&&H.foundationId===t.foundationId&&R!==H[n]&&!H.locked)return!0;break;case re.OnlyThisSide:for(const H of a)if(H.type===z.Window&&H.parentId===t.parentId&&R!==H[n]&&!H.locked)return!0;break;default:if(R!==t[n])return!0;break}return!1}},w=R=>{if(t&&T(R)){switch(c){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of a)E.type===z.Window&&!E.locked&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E[n]);const F={name:`Set ${e} for Selected Windows`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{v(F.oldValues)},redo:()=>{P(F.oldValues,F.newValue)}};s(F),P(H,R),d(u+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of a)E.type===z.Window&&!E.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows`,timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{v(F.oldValues)},redo:()=>{C(F.newValue)}};s(F),C(R),d(u+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(t.foundationId){const H=new Map;for(const E of a)E.type===z.Window&&E.foundationId===t.foundationId&&!t.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows Above Foundation`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.foundationId,undo:()=>{v(F.oldValues)},redo:()=>{S(F.groupId,F.newValue)}};s(F),S(t.foundationId,R),d(u+1)}break}case re.OnlyThisSide:{if(t.parentId){const H=new Map;for(const E of a)E.type===z.Window&&E.parentId===t.parentId&&!E.locked&&H.set(E.id,E[n]);const F={name:`Set ${e} for All Windows On the Same Wall`,timestamp:Date.now(),oldValues:H,newValue:R,groupId:t.parentId,undo:()=>{v(F.oldValues)},redo:()=>{y(t.parentId,F.newValue)}};s(F),y(t.parentId,R),d(u+1)}break}default:{if(t){const H=t[n],F={name:`Set ${e} of Selected window`,timestamp:Date.now(),oldValue:H,newValue:R,changedElementId:t.id,changedElementType:t.type,undo:()=>{A(F.changedElementId,F.oldValue)},redo:()=>{A(F.changedElementId,F.newValue)}};s(F),A(t.id,R),d(u+1)}break}}l(H=>{switch(e){case Qh.Tint:H.actionState.windowTint=R;break;case Qh.MullionColor:H.actionState.windowMullionColor=R;break;case Qh.Color:H.actionState.windowColor=R;break}})}},x=()=>{i()},b=()=>{w(f)};return h.jsx(so,{width:560,title:Y.t(`windowMenu.${e}`,g),onApply:b,onClose:x,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:8,children:h.jsx(Uo,{style:{width:"150px"},value:f,onChange:R=>p(R),children:o.map((R,H)=>h.jsx(B1o,{value:R,children:r[H]},R))})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:R=>M.getState().setWindowActionScope(R.target.value),value:c,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",g)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",g)})]})})})]})})};var wg=(t=>(t.Opacity="Opacity",t.Width="Width",t.Height="Height",t.Setback="Setback",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionWidth="MullionWidth",t.SillWidth="SillWidth",t.FrameWidth="FrameWidth",t.ShutterWidth="ShutterWidth",t))(wg||{}),tU=(t=>(t.ShutterColor="ShutterColor",t.Color="Color",t.MullionColor="MullionColor",t.Tint="Tint",t))(tU||{}),$R=(t=>(t.Frame="Frame",t.LeftShutter="LeftShutter",t.RightShutter="RightShutter",t.HorizontalMullion="HorizontalMullion",t.VerticalMullion="VerticalMullion",t))($R||{}),krt=(t=>(t.WindowType="WindowType",t))(krt||{});const A9=({dataType:t,noPadding:e})=>{const n=$t(),[o,r]=m.useState(!1),i=uo(z.Window),a=i?M.getState().getParent(i):null,l=()=>{M.getState().setApplyCount(0),r(!0)},s=Z1o[t];return t===wg.Width?s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lx*Math.min(Math.abs(.5-i.cx),Math.abs(-.5-i.cx)):100:t===wg.Height&&(s.range[1]=a&&i&&i.parentType!==z.Roof?2*a.lz*Math.min(Math.abs(.5-i.cz),Math.abs(-.5-i.cz)):100),h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:l,children:[Y.t(`windowMenu.${t}`,n)," ..."]}),o&&s&&i&&h.jsx(N1o,{windowModel:i,dataType:t,attributeKey:s.attributeKey,range:s.range,step:s.step,unit:s.unit?Y.t(s.unit,n):void 0,note:s.note?Y.t(s.note,n):void 0,digit:s.digit??0,setDialogVisible:r})]})},yee=({dataType:t,noPadding:e})=>{const[n,o]=m.useState(!1),r=$t(),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),o(!0)},l=q1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(U1o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},Ok=({dataType:t,noPadding:e})=>{const[n,o]=m.useState(!1),r=$t(),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),o(!0)},l=$1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,r)," ..."]}),n&&l&&i&&h.jsx(j1o,{window:i,dataType:t,attributeKey:l.attributeKey,setDialogVisible:()=>o(!1)})]})},O1o=({dataType:t,noPadding:e})=>{const n=$t(),[o,r]=m.useState(!1),i=uo(z.Window),a=()=>{M.getState().setApplyCount(0),r(!0)},l=Q1o[t];return h.jsxs(h.Fragment,{children:[h.jsxs(an,{noPadding:e,onClick:a,children:[Y.t(`windowMenu.${t}`,n)," ..."]}),o&&l&&i&&h.jsx(Y1o,{window:i,dataType:t,attributeKey:l.attributeKey,options:[Ci.Default,Ci.Arched,Ci.Polygonal],optionsText:[Y.t("windowMenu.Default",n),Y.t("windowMenu.Arched",n),Y.t("windowMenu.Polygonal",n)],setDialogVisible:()=>r(!1)})]})},V1o=({window:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.empty=i;break}})},o=r=>{const i=r.target.checked,a={name:"Empty Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.windowEmpty=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.empty,onChange:o,children:Y.t("windowMenu.Empty",e)})})},_1o=({window:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{for(const l of a.elements)if(l.id===r&&l.type===z.Window){l.interior=i;break}})},o=r=>{const i=r.target.checked,a={name:"Interior Window",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i),M.getState().set(l=>{l.actionState.windowInterior=i})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:!!t.interior,onChange:o,children:Y.t("windowMenu.Interior",e)})})},G1o=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(MW),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Window),[c,u]=m.useState((s==null?void 0:s.uValue)??X4),[d,f]=m.useState(me.toUValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.uValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Window&&T!==w.uValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Window&&T!==w.uValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Window&&w.foundationId===s.foundationId&&T!==w.uValue&&!w.locked)return!0;break;case re.OnlyThisSide:for(const w of e)if(w.type===z.Window&&w.parentId===s.parentId&&T!==w.uValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.uValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Window&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for Selected Windows",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Window&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Window&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break}case re.OnlyThisSide:{if(s.parentId){const w=new Map;for(const b of e)if(b.type===z.Window&&b.parentId===s.parentId&&!b.locked){const R=b;w.set(b.id,R.uValue??X4),g(R.id,T)}const x={name:"Set U-Value for All Windows On the Same Wall",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.parentId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break}default:{if(s){const x=a(s.id).uValue??s.uValue??X4,b={name:"Set Window U-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}break}}l(w=>{w.actionState.windowUValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("word.UValue",p)+" "}(${Y.t("word.ThermalTransmittance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(me.toUValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": W/(m²·℃)"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toUValueInUS(.01),max:me.toUValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(me.toUValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",me.toUValueInUS(.01).toFixed(3),", ",me.toUValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": Btu/(h·ft²·℉)"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setWindowActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windowMenu.OnlyThisWindow",p)}),h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisSide,children:Y.t("windowMenu.AllWindowsOnSurface",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windowMenu.AllWindowsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windowMenu.AllSelectedWindows",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windowMenu.AllWindows",p)})]})})})]})})},X1o=t=>{const e=[];return e.push({key:"window-frame-boolean",label:h.jsx(Ok,{noPadding:!0,dataType:$R.Frame})}),t.frame&&e.push({type:"divider"},{key:"window-frame-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.FrameWidth})},{key:"window-sill-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.SillWidth})},{key:"window-frame-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.Color})}),e},J1o=t=>{const e=[];return e.push({key:"window-horizontal-mullion",label:h.jsx(Ok,{noPadding:!0,dataType:$R.HorizontalMullion})},{key:"window-vertical-mullion",label:h.jsx(Ok,{noPadding:!0,dataType:$R.VerticalMullion})}),(t.horizontalMullion||t.verticalMullion)&&(e.push({type:"divider"},{key:"window-mullion-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.MullionWidth})},{key:"window-mullion-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.MullionColor})}),t.horizontalMullion&&e.push({key:"window-horizontal-mullion-spacing",label:h.jsx(A9,{noPadding:!0,dataType:wg.HorizontalMullionSpacing})}),t.verticalMullion&&e.push({key:"window-vertical-mullion-spacing",label:h.jsx(A9,{noPadding:!0,dataType:wg.VerticalMullionSpacing})})),e},K1o=t=>{const e=[];return e.push({key:"window-left-shutter",label:h.jsx(Ok,{noPadding:!0,dataType:$R.LeftShutter})},{key:"window-right-shutter",label:h.jsx(Ok,{noPadding:!0,dataType:$R.RightShutter})}),(t.leftShutter||t.rightShutter)&&e.push({type:"divider"},{key:"window-shutter-color",label:h.jsx(yee,{noPadding:!0,dataType:tU.ShutterColor})},{key:"window-shutter-width",label:h.jsx(A9,{noPadding:!0,dataType:wg.ShutterWidth})}),e};var Qh=(t=>(t.Color="Color",t.Tint="Tint",t.Opacity="Opacity",t.WindowType="WindowType",t.MullionWidth="MullionWidth",t.HorizontalMullionSpacing="HorizontalMullionSpacing",t.VerticalMullionSpacing="VerticalMullionSpacing",t.MullionColor="MullionColor",t.Frame="Frame",t.FrameWidth="FrameWidth",t.SillWidth="SillWidth",t.Width="Width",t.Height="Height",t))(Qh||{});const q1o={Tint:{attributeKey:"tint"},Color:{attributeKey:"color"},MullionColor:{attributeKey:"mullionColor"},ShutterColor:{attributeKey:"shutterColor"}},$1o={HorizontalMullion:{attributeKey:"horizontalMullion"},VerticalMullion:{attributeKey:"verticalMullion"},Frame:{attributeKey:"frame"},LeftShutter:{attributeKey:"leftShutter"},RightShutter:{attributeKey:"rightShutter"}},Q1o={WindowType:{attributeKey:"windowType",options:[Ci.Default,Ci.Arched,Ci.Polygonal]}},Z1o={Opacity:{attributeKey:"opacity",range:[0,.9],step:.1,note:"windowMenu.SolarHeatGainCoefficient",digit:1},Width:{attributeKey:"lx",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Height:{attributeKey:"lz",range:[.1,100],step:.1,unit:"word.MeterAbbreviation",digit:1},Setback:{attributeKey:"cy",range:[0,1],step:.01,unit:"",digit:0,note:"windowMenu.RelativeToWallThickness"},MullionWidth:{attributeKey:"mullionWidth",range:[0,.5],step:.1,unit:"word.MeterAbbreviation",digit:1},ShutterWidth:{attributeKey:"shutterWidth",range:[0,.5],step:.01,unit:"",digit:1},HorizontalMullionSpacing:{attributeKey:"horizontalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},VerticalMullionSpacing:{attributeKey:"verticalMullionSpacing",range:[.1,10],step:.01,unit:"word.MeterAbbreviation",digit:1},FrameWidth:{attributeKey:"frameWidth",range:[.05,.2],step:.01,unit:"word.MeterAbbreviation",digit:2},SillWidth:{attributeKey:"sillWidth",range:[0,.5],step:.01,unit:"word.MeterAbbreviation",digit:2}},ego=t=>{const e=[];if(t.type!==z.Window)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language};return e.push({key:"window-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"window-cut",label:h.jsx(kd,{})}),e.push({key:"window-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&e.push({key:"window-empty",label:h.jsx(V1o,{window:n})},{key:"window-interior",label:h.jsx(_1o,{window:n})}),o&&e.push({key:"window-type",label:h.jsx(O1o,{dataType:krt.WindowType})},{key:"window-width",label:h.jsx(A9,{dataType:wg.Width})},{key:"window-height",label:h.jsx(A9,{dataType:wg.Height})},{key:"window-setback",label:h.jsx(A9,{dataType:wg.Setback})},{key:"window-opacity",label:h.jsx(A9,{dataType:wg.Opacity})},{key:"window-tint",label:h.jsx(yee,{dataType:tU.Tint})},{key:"window-u-value",label:h.jsxs(eo,{Dialog:G1o,children:[Y.t("word.UValue",r)," ..."]})},{key:"window-mullion-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Mullion",r)}),children:J1o(n)},{key:"window-frame-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Frame",r)}),children:X1o(n)},{key:"window-shutter-submenu",label:h.jsx(an,{children:Y.t("windowMenu.Shutter",r)}),children:K1o(n)}),{items:e}},tgo=({roof:t})=>{const e=$t(),n=(r,i)=>{M.getState().set(a=>{const l=a.elements.find(s=>s.id===r&&s.type===z.Roof);l&&(l.ceiling=i,a.actionState.roofCeiling=i)})},o=r=>{const i=r.target.checked,a={name:"Roof Ceiling",timestamp:Date.now(),checked:i,selectedElementId:t.id,selectedElementType:t.type,undo:()=>{n(t.id,!a.checked)},redo:()=>{n(t.id,a.checked)}};M.getState().addUndoable(a),n(t.id,i)};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Li,{style:{width:"100%"},checked:t.ceiling,onChange:o,children:Y.t("roofMenu.Ceiling",e)})})},ngo=({roof:t,objectType:e,modalTitle:n,onClickOk:o,children:r})=>{const i=M.getState().removeAllChildElementsByType,a=()=>{const s=M.getState().elements.filter(d=>!d.locked&&d.type===e&&d.parentId===t.id);i(t.id,e);const c=JSON.parse(JSON.stringify(s)),u={name:`Remove All ${e}s on Roof`,timestamp:Date.now(),parentId:t.id,removedElements:c,undo:()=>{M.getState().set(d=>{d.elements.push(...u.removedElements)})},redo:()=>{i(u.parentId,e)}};M.getState().addUndoable(u)},l=()=>{const s=o??a;yi.confirm({title:n,icon:h.jsx(ny,{}),onOk:s})};return h.jsx(an,{update:!0,noPadding:!0,onClick:l,children:r})},WHe=({roof:t,objectType:e,lock:n,children:o})=>{const r=M.getState().updateElementLockById,i=M.getState().updateElementLockByParentId,a=()=>{const l=e.replaceAll(" ",""),s=new Map;for(const d of M.getState().elements)d.parentId===t.id&&d.type===e&&s.set(d.id,!!d.locked);i(t.id,e,n);const u={name:n?`Lock All Unlocked ${l} on Roof`:`Unlock All Locked ${l} on Roof`,timestamp:Date.now(),oldValues:s,newValue:!0,undo:()=>{for(const[d,f]of u.oldValues.entries())r(d,f)},redo:()=>{i(t.id,e,n)}};M.getState().addUndoable(u)};return h.jsx(an,{stayAfterClick:!0,update:!0,noPadding:!0,onClick:a,children:o})},ogo=({roof:t})=>{const e=$t(),n=M.getState().updateRoofStructureById,o=r=>{const i={name:"Select Roof Structure",timestamp:Date.now(),oldValue:t.roofStructure??Ac.Default,newValue:r.target.value,changedElementId:t.id,changedElementType:t.type,undo:()=>{n(i.changedElementId,i.oldValue)},redo:()=>{n(i.changedElementId,i.newValue)}};M.getState().addUndoable(i),n(t.id,r.target.value),M.getState().set(a=>{a.actionState.roofStructure=r.target.value})};return h.jsx(an,{stayAfterClick:!0,noPadding:!0,children:h.jsx(Le.Group,{value:t.roofStructure??Ac.Default,onChange:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:Ac.Default,children:Y.t("roofMenu.DefaultStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:Ac.Rafter,children:Y.t("roofMenu.RafterStructure",e)}),h.jsx(Le,{style:{width:"100%"},value:Ac.Glass,children:Y.t("roofMenu.GlassStructure",e)})]})})})},Kae=[{key:"solarPanelCount",lockedKey:"lockedSolarPanelCount",objectType:z.SolarPanel},{key:"windowCount",lockedKey:"lockedWindowCount",objectType:z.Window},{key:"sensorCount",lockedKey:"lockedSensorCount",objectType:z.Sensor},{key:"outsideLightCount",lockedKey:"lockedLightCount",objectType:z.Light}],rgo=(t,e)=>{const n={lng:M.getState().language};let o="",r="";switch(t){case z.SolarPanel:{o=`${Y.t("roofMenu.RemoveAllUnlockedSolarPanels",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllSolarPanelsOnThisRoof",n)} (${e} ${Y.t("roofMenu.SolarPanels",n)})`;break}case z.Window:{o=`${Y.t("roofMenu.RemoveAllUnlockedWindows",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllWindowsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Windows",n)})`;break}case z.Sensor:{o=`${Y.t("roofMenu.RemoveAllUnlockedSensors",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllSensorsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Sensors",n)})`;break}case z.Light:{o=`${Y.t("roofMenu.RemoveAllUnlockedLights",n)} (${e})`,r=`${Y.t("roofMenu.DoYouReallyWantToRemoveAllLightsOnThisRoof",n)} (${e} ${Y.t("roofMenu.Lights",n)})`;break}}return{itemLabel:o,modalTitle:r}},qae=(t,e,n,o)=>n===z.Light?o?t.lockedLightCount:t.insideLightCount+t.outsideLightCount:t[e],igo=(t,e,n)=>{const o=[],r={lng:M.getState().language};return Kae.forEach(({key:i,objectType:a})=>{const l=qae(n,i,a);if(typeof l=="number"&&l>0){const{itemLabel:s,modalTitle:c}=rgo(a,l),u=a.replaceAll(" ","");o.push({key:`remove-all-${u}s-on-roof`,label:h.jsx(ngo,{roof:t,objectType:a,modalTitle:c,children:s})})}}),Kae.forEach(({key:i,objectType:a})=>{const l=qae(n,i,a);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`lock-all-${s}s-on-roof`,label:h.jsxs(WHe,{roof:t,objectType:a,lock:!0,children:[Y.t(`wallMenu.LockAllUnlocked${s}s`,r)," (",l,")"]})})}}),Kae.forEach(({lockedKey:i,objectType:a})=>{const l=qae(e,i,a,!0);if(typeof l=="number"&&l>0){const s=a.replaceAll(" ","");o.push({key:`unlock-all-${s}s-on-wall`,label:h.jsxs(WHe,{roof:t,objectType:a,lock:!1,children:[Y.t(`wallMenu.UnlockAllLocked${s}s`,r)," (",l,")"]})})}}),e.outsideLightCount>0&&o.push({key:"inside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!0,children:[Y.t("wallMenu.AllLightsOnWallInside",r)," (",e.outsideLightCount,")"]})}),e.insideLightCount>0&&o.push({key:"outside-lights-on-wall",label:h.jsxs(wX,{element:t,inside:!1,children:[Y.t("wallMenu.AllLightsOnWallOutside",r)," (",e.insideLightCount,")"]})}),o},ago=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.thickness)??.4),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)w.id===P&&(w.thickness=v,T.updateElementOnRoofFlag=!0),w.parentId===P&&w.type===z.Window&&(w.ly=v)})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.thickness&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.thickness&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.thickness&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.thickness))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.thickness),f(x.id,P)}const T={name:"Set Thickness for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).thickness??s.thickness??.4,w={name:"Set Roof Thickness",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofThickness=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.Thickness",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.05,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.05, 1] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},lgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=uo(z.Roof),[s,c]=m.useState((l==null?void 0:l.rise)??0),u=$t(),d=(C,P)=>{M.getState().updateRoofRiseById(C,P),M.getState().set(v=>{v.updateElementOnRoofFlag=!0})},f=C=>{for(const[P,v]of C.entries())d(P,v)},p=(C,P)=>{for(const v of C.keys())d(v,P)},g=C=>{if(l){switch(o){case re.AllSelectedObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked&&M.getState().selectedElementIdSet.has(P.id))return!0;break;case re.AllObjectsOfThisType:for(const P of e)if(P.type===z.Roof&&C!==P.rise&&!P.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const P of e)if(P.type===z.Roof&&P.foundationId===l.foundationId&&C!==P.rise&&!P.locked)return!0;break;default:if(C!==(l==null?void 0:l.rise))return!0;break}return!1}},A=C=>{if(l&&g(C))switch(M.getState().roofActionScope){case re.AllSelectedObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Roof&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for Selected Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1);break}case re.AllObjectsOfThisType:{const P=new Map;for(const T of e)T.type===z.Roof&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for All Roofs",timestamp:Date.now(),oldValues:P,newValue:C,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(l.foundationId){const P=new Map;for(const T of e)T.type===z.Roof&&T.foundationId===l.foundationId&&!T.locked&&(P.set(T.id,T.rise),d(T.id,C));const v={name:"Set Rise for All Roofs Above Foundation",timestamp:Date.now(),oldValues:P,newValue:C,groupId:l.foundationId,undo:()=>{f(v.oldValues)},redo:()=>{p(v.oldValues,v.newValue)}};n(v),i(r+1)}break;default:if(l){const P=a(l.id),v=(P==null?void 0:P.rise)??(l==null?void 0:l.rise)??0,T={name:"Set Roof Rise",timestamp:Date.now(),oldValue:v,newValue:C,changedElementId:l.id,changedElementType:l.type,undo:()=>{d(T.changedElementId,T.oldValue)},redo:()=>{d(T.changedElementId,T.newValue)}};n(T),d(l.id,C),i(r+1)}}},y=()=>{t(!1)},S=()=>{A(s)};return h.jsx(so,{width:550,title:Y.t("roofMenu.Rise",u),onApply:S,onClose:y,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:200,style:{width:120},step:.1,precision:2,value:s,formatter:C=>Number(C).toFixed(2),onChange:C=>c(C)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",u),": [0, 200] ",Y.t("word.MeterAbbreviation",u)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",u)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:C=>M.getState().setRoofActionScope(C.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",u)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",u)})]})})})]})})},sgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rValue)??a8),[d,f]=m.useState(me.toRValueInUS(c)),p=$t(),g=(T,w)=>{l(x=>{for(const b of x.elements)if(b.id===T){b.rValue=w;break}})},A=T=>{for(const[w,x]of T.entries())g(w,x)},y=(T,w)=>{for(const x of T.keys())g(x,w)},S=T=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const w of e)if(w.type===z.Roof&&T!==w.rValue&&!w.locked&&M.getState().selectedElementIdSet.has(w.id))return!0;break;case re.AllObjectsOfThisType:for(const w of e)if(w.type===z.Roof&&T!==w.rValue&&!w.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&T!==w.rValue&&!w.locked)return!0;break;default:if(T!==(s==null?void 0:s.rValue))return!0;break}return!1}},C=T=>{if(s&&S(T)){switch(o){case re.AllSelectedObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Roof&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for Selected Roofs",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisType:{const w=new Map;for(const b of e)if(b.type===z.Roof&&!b.locked){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for All Roofs",timestamp:Date.now(),oldValues:w,newValue:T,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const w=new Map;for(const b of e)if(b.type===z.Roof&&b.foundationId===s.foundationId&&!b.locked){const R=b;w.set(b.id,R.rValue??a8),g(R.id,T)}const x={name:"Set R-Value for All Roofs Above Foundation",timestamp:Date.now(),oldValues:w,newValue:T,groupId:s.foundationId,undo:()=>{A(x.oldValues)},redo:()=>{y(x.oldValues,x.newValue)}};n(x),i(r+1)}break;default:if(s){const x=a(s.id).rValue??s.rValue??a8,b={name:"Set Roof R-Value",timestamp:Date.now(),oldValue:x,newValue:T,changedElementId:s.id,changedElementType:s.type,undo:()=>{g(b.changedElementId,b.oldValue)},redo:()=>{g(b.changedElementId,b.newValue)}};n(b),g(s.id,T),i(r+1)}}l(w=>{w.actionState.roofRValue=T})}},P=()=>{t(!1)},v=()=>{C(c)};return h.jsx(so,{width:550,title:`${Y.t("roofMenu.RoofRValue",p)+" "}(${Y.t("word.ThermalResistance",p)})`,onApply:v,onClose:P,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(u(T),f(me.toRValueInUS(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",p),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toRValueInUS(.01),max:me.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:d,formatter:T=>Number(T).toFixed(2),onChange:T=>{T!==null&&(f(T),u(me.toRValueInSI(T)))}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [",me.toRValueInUS(.01).toFixed(3),", ",me.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",p),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:T=>M.getState().setRoofActionScope(T.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",p)})]})})})]})})},cgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(g3),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.volumetricHeatCapacity)??.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.volumetricHeatCapacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.volumetricHeatCapacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.volumetricHeatCapacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.volumetricHeatCapacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;l(w=>{for(const x of w.elements)if(x.type===z.Roof&&x.foundationId===s.foundationId&&!x.locked){const b=x;v.set(x.id,b.volumetricHeatCapacity??.5),b.volumetricHeatCapacity=P}});const T={name:"Set Volumetric Heat Capacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).volumetricHeatCapacity??s.volumetricHeatCapacity??.5,w={name:"Set Volumetric Heat Capacity of Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofVolumetricHeatCapacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("word.VolumetricHeatCapacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:["kWh/(m³·℃)",h.jsx("br",{}),h.jsx("br",{}),Y.t("word.Range",d),": [0.01, 100]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},ugo="/aladdin/assets/roof_edge-DBy_1Q5D.png",dgo="/aladdin/assets/roof_01-BwuyLpwq.png",fgo="/aladdin/assets/roof_02-DAbYjnV7.png",hgo="/aladdin/assets/roof_03-haZGIixv.png",pgo="/aladdin/assets/roof_04-DDuwUcDr.png",ggo="/aladdin/assets/roof_05-CtBb5xIW.png",mgo="/aladdin/assets/roof_06-DuyyebV8.png",ygo="/aladdin/assets/roof_07-DXWGQN8a.png",Ago=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(pn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.textureType)??Ur.Default),d=$t(),{Option:f}=Uo,p=(v,T)=>{a(w=>{for(const x of w.elements)if(x.id===v){x.locked||(x.textureType=T);break}})},g=(v,T)=>{for(const w of v.keys())p(w,T)},A=v=>{for(const[T,w]of v.entries())p(T,w)},y=v=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const T of e)if(T.type===z.Roof&&v!==T.textureType&&!T.locked&&M.getState().selectedElementIdSet.has(T.id))return!0;break;case re.AllObjectsOfThisType:for(const T of e)if(T.type===z.Roof&&v!==T.textureType&&!T.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const T of e)if(T.type===z.Roof&&T.foundationId===s.foundationId&&v!==T.textureType&&!T.locked)return!0;break;default:if(v!==(s==null?void 0:s.textureType))return!0;break}return!1}},S=v=>{if(s&&y(v)){switch(o){case re.AllSelectedObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Roof&&!x.locked&&M.getState().selectedElementIdSet.has(x.id)&&T.set(x.id,x.textureType??Ur.Default);const w={name:"Set Texture for Selected Roofs",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisType:{const T=new Map;for(const x of e)x.type===z.Roof&&!x.locked&&T.set(x.id,x.textureType??Ur.Default);const w={name:"Set Texture for All Roofs",timestamp:Date.now(),oldValues:T,newValue:v,undo:()=>{A(w.oldValues)},redo:()=>{g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const T=new Map;for(const x of e)x.type===z.Roof&&x.foundationId===s.foundationId&&!x.locked&&T.set(x.id,x.textureType);const w={name:"Set Texture for All Roofs Above Foundation",timestamp:Date.now(),oldValues:T,newValue:v,groupId:s.foundationId,undo:()=>{A(w.oldValues)},redo:()=>{w.groupId&&g(w.oldValues,w.newValue)}};n(w),g(T,v),i(r+1)}break;default:if(s){const T=l(s.id),w=T?T.textureType:s.textureType,x={name:"Set Texture of Selected Roof",timestamp:Date.now(),oldValue:w,newValue:v,changedElementId:s.id,changedElementType:s.type,undo:()=>{p(x.changedElementId,x.oldValue)},redo:()=>{p(x.changedElementId,x.newValue)}};n(x),p(s.id,v),i(r+1)}}a(T=>{T.actionState.roofTexture=v})}},C=()=>{t(!1)},P=()=>{S(c)};return h.jsx(so,{width:550,title:Y.t("word.Texture",d),onApply:P,onClose:C,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:9,children:h.jsxs(Uo,{style:{width:"150px"},value:c,onChange:v=>u(v),children:[h.jsxs(f,{value:Ur.NoTexture,children:[h.jsx("div",{style:{display:"inline-block",verticalAlign:"middle",marginRight:"12px",width:"32px",height:"20px",border:"1px dashed dimGray"},children:" "}),Y.t("shared.NoTexture",d)]},Ur.NoTexture),h.jsxs(f,{value:Ur.Default,children:[h.jsx("img",{alt:Ur.Default,src:ugo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.TextureDefault",d)]},Ur.Default),h.jsxs(f,{value:Ur.Texture01,children:[h.jsx("img",{alt:Ur.Texture01,src:dgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture01",d)]},Ur.Texture01),h.jsxs(f,{value:Ur.Texture02,children:[h.jsx("img",{alt:Ur.Texture02,src:fgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture02",d)]},Ur.Texture02),h.jsxs(f,{value:Ur.Texture03,children:[h.jsx("img",{alt:Ur.Texture03,src:hgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture03",d)]},Ur.Texture03),h.jsxs(f,{value:Ur.Texture04,children:[h.jsx("img",{alt:Ur.Texture04,src:pgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture04",d)]},Ur.Texture04),h.jsxs(f,{value:Ur.Texture05,children:[h.jsx("img",{alt:Ur.Texture05,src:ggo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture05",d)]},Ur.Texture05),h.jsxs(f,{value:Ur.Texture06,children:[h.jsx("img",{alt:Ur.Texture06,src:mgo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture06",d)]},Ur.Texture06),h.jsxs(f,{value:Ur.Texture07,children:[h.jsx("img",{alt:Ur.Texture07,src:ygo,height:20,width:40,style:{paddingRight:"8px"}})," ",Y.t("roofMenu.Texture07",d)]},Ur.Texture07)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:15,children:h.jsx(Le.Group,{onChange:v=>M.getState().setRoofActionScope(v.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},wgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.color)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.color=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.color&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.color&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.color&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.color))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of n)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.color??"#ffffff");const T={name:"Set Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.color:s.color)??"#ffffff",w={name:"Set Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}e(v=>{v.actionState.roofColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},vgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(pn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.sideColor)??"#ffffff"),d=$t(),f=(P,v)=>{n(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.sideColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.sideColor&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.sideColor&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.sideColor&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.sideColor))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.sideColor??"#ffffff");const T={name:"Set Side Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.sideColor:s.sideColor)??"#ffffff",w={name:"Set Side Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}n(v=>{v.actionState.roofSideColor=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofSideColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c??(s==null?void 0:s.sideColor)??"#ffffff",onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},xgo=({setDialogVisible:t})=>{const e=M(m0),n=M(c3),o=M(En),r=M(sy),i=M(ROe),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),u=M(pn),d=M(W=>{if(n){for(const k of W.elements)if(k.id===n.id)return k}return null}),[f,p]=m.useState((d==null?void 0:d.ceilingRValue)??w6),[g,A]=m.useState(me.toRValueInUS(f)),[y,S]=m.useState(!1),[C,P]=m.useState({left:0,top:0,bottom:0,right:0}),v=m.useRef(null),T={lng:e};m.useEffect(()=>{d&&p((d==null?void 0:d.ceilingRValue)??w6)},[d==null?void 0:d.ceilingRValue]);const w=(W,k)=>{u(D=>{for(const L of D.elements)if(L.id===W){L.ceilingRValue=k;break}})},x=W=>{for(const[k,D]of W.entries())w(k,D)},b=(W,k)=>{for(const D of W.keys())w(D,k)},R=W=>{if(d){switch(r){case re.AllObjectsOfThisType:{const k=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&!j.locked){const B=j;k.set(j.id,B.ceilingRValue??w6),B.ceilingRValue=W}});const D={name:"Set R-Value for All Ceilings",timestamp:Date.now(),oldValues:k,newValue:W,undo:()=>{x(D.oldValues)},redo:()=>{b(D.oldValues,D.newValue)}};o(D),l(a+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const k=new Map;u(L=>{for(const j of L.elements)if(j.type===z.Roof&&j.foundationId===d.foundationId&&!j.locked){const B=j;k.set(j.id,B.ceilingRValue??w6),B.ceilingRValue=W}});const D={name:"Set R-Value for All Ceilings Above Foundation",timestamp:Date.now(),oldValues:k,newValue:W,groupId:d.foundationId,undo:()=>{x(D.oldValues)},redo:()=>{b(D.oldValues,D.newValue)}};o(D),l(a+1)}break}default:{if(d){const D=c(d.id).ceilingRValue??d.ceilingRValue??w6,L={name:"Set Ceiling R-Value",timestamp:Date.now(),oldValue:D,newValue:W,changedElementId:d.id,changedElementType:d.type,undo:()=>{w(L.changedElementId,L.oldValue)},redo:()=>{w(L.changedElementId,L.newValue)}};o(L),w(d.id,W),l(a+1)}break}}u(k=>{k.actionState.roofRValue=W})}},H=(W,k)=>{if(v.current){const{clientWidth:D,clientHeight:L}=window.document.documentElement,j=v.current.getBoundingClientRect();P({left:-j.left+k.x,right:D-(j.right-k.x),top:-j.top+k.y,bottom:L-((j==null?void 0:j.bottom)-k.y)})}},F=()=>{p((d==null?void 0:d.ceilingRValue)??w6),t(!1)},E=()=>{F(),s()},N=()=>{R(f),t(!1),l(0)},U=()=>{R(f)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:550,open:!0,title:h.jsxs("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>S(!0),onMouseOut:()=>S(!1),children:[Y.t("roofMenu.CeilingRValue",T)+" ","(",Y.t("word.ThermalResistance",T),")"]}),footer:[h.jsx(io,{onClick:U,children:Y.t("word.Apply",T)},"Apply"),h.jsx(io,{onClick:E,children:Y.t("word.Cancel",T)},"Cancel"),h.jsx(io,{type:"primary",onClick:N,children:Y.t("word.OK",T)},"OK")],onCancel:F,maskClosable:!1,destroyOnClose:!1,modalRender:W=>h.jsx(Bi,{disabled:!y,bounds:C,onStart:(k,D)=>H(k,D),children:h.jsx("div",{ref:v,children:W})}),children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:.01,max:100,style:{width:120},step:.05,precision:2,value:f,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(p(W),A(me.toRValueInUS(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [0.01, 100]",h.jsx("br",{}),Y.t("word.SIUnit",T),": m²·℃/W"]}),h.jsx("br",{}),h.jsx(Sn,{min:me.toRValueInUS(.01),max:me.toRValueInUS(100),style:{width:120},step:.01,precision:2,value:g,formatter:W=>Number(W).toFixed(2),onChange:W=>{W!==null&&(A(W),p(me.toRValueInSI(W)))},onPressEnter:N}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",T),": [",me.toRValueInUS(.01).toFixed(3),", ",me.toRValueInUS(100).toFixed(1),"]",h.jsx("br",{}),Y.t("word.USUnit",T),": h·ft²·℉/Btu"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:W=>i(W.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisCeiling",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllCeilingsAboveFoundation",T)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllCeilings",T)})]})})})]})})})},bgo=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"roof-ceiling",label:h.jsx(tgo,{roof:t})}),t.ceiling&&n.push({type:"divider"},{key:"ceiling-r-value",label:h.jsxs(eo,{noPadding:!0,Dialog:xgo,children:[Y.t("roofMenu.CeilingRValue",e)," ..."]})}),n},Sgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(En),r=M(sy),i=M(no),a=M(Qn),l=M(Jn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterColor)??"#ffffff"),d=$t(),f=(P,v)=>{e(T=>{for(const w of T.elements)if(w.id===P){w.locked||(w.rafterColor=v);break}})},p=(P,v)=>{for(const T of P.keys())f(T,v)},g=P=>{for(const[v,T]of P.entries())f(v,T)},A=P=>{if(s){switch(r){case re.AllSelectedObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.rafterColor&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of n)if(v.type===z.Roof&&P!==v.rafterColor&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of n)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterColor&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterColor))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(r){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of n)w.type===z.Roof&&!w.locked&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{g(T.oldValues)},redo:()=>{p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of n)w.type===z.Roof&&w.foundationId===s.foundationId&&!s.locked&&v.set(w.id,w.rafterColor??"#ffffff");const T={name:"Set Rafter Color for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{g(T.oldValues)},redo:()=>{T.groupId&&p(T.oldValues,T.newValue)}};o(T),p(v,P),a(i+1)}break;default:if(s){const v=l(s.id),T=(v?v.rafterColor:s.rafterColor)??"#ffffff",w={name:"Set Rafter Color of Selected Roof",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};o(w),f(s.id,P),a(i+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:640,title:Y.t("roofMenu.RoofColor",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:c,onChangeComplete:P=>{u(P.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Tgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterSpacing)??1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.rafterSpacing=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterSpacing&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterSpacing&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterSpacing&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterSpacing))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked&&(v.set(w.id,w.rafterSpacing??1),f(w.id,P));const T={name:"Set Rafter Spacing for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).rafterSpacing??s.rafterSpacing??1,w={name:"Set Roof Rafter Spacing",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.RafterSpacing",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:100,style:{width:120},step:.1,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.1, 100] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Pgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.rafterWidth)??.1),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.rafterWidth=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterWidth&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.rafterWidth&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.rafterWidth&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.rafterWidth))return!0;break}return!1}},y=P=>{if(s&&A(P))switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&M.getState().selectedElementIdSet.has(w.id)&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)w.type===z.Roof&&!w.locked&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked&&(v.set(w.id,w.rafterWidth??.1),f(w.id,P));const T={name:"Set Rafter Width for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const T=a(s.id).rafterWidth??s.rafterWidth??.1,w={name:"Set Roof Rafter Width",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.RafterWidth",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.01,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0.01, 1] ",Y.t("word.MeterAbbreviation",d)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",d)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Cgo=({setDialogVisible:t})=>{const e=M(pn),n=M(c3),o=M(En),r=M(sy),i=M(ROe),a=M(no),l=M(Qn),s=M(Xi),c=M(Jn),[u,d]=m.useState((n==null?void 0:n.glassTint)??"#73D8FF"),[f,p]=m.useState(!1),[g,A]=m.useState({left:0,top:0,bottom:0,right:0}),y=m.useRef(null),S=m.useRef(null);m.useEffect(()=>{var E;(E=S.current)==null||E.focus()});const C=$t();m.useEffect(()=>{n&&d((n==null?void 0:n.glassTint)??"#73D8FF")},[n]);const P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.id===E){W.locked||(W.glassTint=N);break}})},v=(E,N)=>{for(const U of E.keys())P(U,N)},T=E=>{for(const[N,U]of E.entries())P(N,U)},w=E=>{if(n)switch(r){case re.AllObjectsOfThisType:{const N=new Map;for(const W of M.getState().elements)W.type===z.Roof&&!W.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{T(U.oldValues)},redo:()=>{v(U.oldValues,U.newValue)}};o(U),v(N,E),l(a+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(n.foundationId){const N=new Map;for(const W of M.getState().elements)W.type===z.Roof&&W.foundationId===n.foundationId&&!n.locked&&N.set(W.id,W.glassTint??"#73D8FF");const U={name:"Set Glass Tint for All Roofs Above Foundation",timestamp:Date.now(),oldValues:N,newValue:E,groupId:n.foundationId,undo:()=>{T(U.oldValues)},redo:()=>{U.groupId&&v(U.oldValues,U.newValue)}};o(U),v(N,E),l(a+1)}break}default:{if(n){const N=c(n.id),U=(N?N.glassTint:n.glassTint)??"#73D8FF",W={name:"Set Glass Tint of Selected Roof",timestamp:Date.now(),oldValue:U,newValue:E,changedElementId:n.id,changedElementType:n.type,undo:()=>{P(W.changedElementId,W.oldValue)},redo:()=>{P(W.changedElementId,W.newValue)}};o(W),P(n.id,E),l(a+1)}break}}},x=(E,N)=>{if(y.current){const{clientWidth:U,clientHeight:W}=window.document.documentElement,k=y.current.getBoundingClientRect();A({left:-k.left+N.x,right:U-(k.right-N.x),top:-k.top+N.y,bottom:W-((k==null?void 0:k.bottom)-N.y)})}},b=()=>{n!=null&&n.glassTint&&d(n.glassTint),t(!1)},R=()=>{b(),s()},H=()=>{const E=c(n.id);E&&E.glassTint!==u&&w(u),t(!1),l(0)},F=()=>{w(u)};return h.jsx(h.Fragment,{children:h.jsx(yi,{width:640,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>p(!0),onMouseOut:()=>p(!1),children:Y.t("roofMenu.GlassTint",C)}),footer:[h.jsx(io,{onClick:F,children:Y.t("word.Apply",C)},"Apply"),h.jsx(io,{onClick:R,children:Y.t("word.Cancel",C)},"Cancel"),h.jsx(io,{type:"primary",ref:S,onClick:H,children:Y.t("word.OK",C)},"OK")],onCancel:b,maskClosable:!1,destroyOnClose:!1,modalRender:E=>h.jsx(Bi,{disabled:!f,bounds:g,onStart:(N,U)=>x(N,U),children:h.jsx("div",{ref:y,children:E})}),children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:11,children:h.jsx(Ld,{color:u??(n==null?void 0:n.glassTint)??"#73D8FF",onChangeComplete:E=>{d(E.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:13,children:h.jsx(Le.Group,{onChange:E=>i(E.target.value),value:r,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",C)})]})})})]})})})},Rgo=t=>{const e={lng:M.getState().language},n=[];return n.push({key:"roof-structure-radio-group",label:h.jsx(ogo,{roof:t}),style:{backgroundColor:"white"}}),t.roofStructure===Ac.Rafter&&n.push({type:"divider"},{key:"roof-rafter-spacing",label:h.jsxs(eo,{noPadding:!0,Dialog:Tgo,children:[Y.t("roofMenu.RafterSpacing",e)," ..."]})},{key:"roof-rafter-width",label:h.jsxs(eo,{noPadding:!0,Dialog:Pgo,children:[Y.t("roofMenu.RafterWidth",e)," ..."]})},{key:"roof-rafter-color",label:h.jsxs(eo,{noPadding:!0,Dialog:Sgo,children:[Y.t("roofMenu.RafterColor",e)," ..."]})}),t.roofStructure===Ac.Glass&&n.push({type:"divider"},{key:"roof-glass-tint-selection",label:h.jsxs(eo,{noPadding:!0,Dialog:Cgo,children:[Y.t("roofMenu.GlassTint",e)," ..."]})}),n},Hgo=({setDialogVisible:t})=>{const e=M(Kn),n=M(En),o=M(sy),r=M(no),i=M(Qn),a=M(Jn),l=M(pn),s=uo(z.Roof),[c,u]=m.useState((s==null?void 0:s.opacity)!==void 0?s.opacity:.5),d=$t(),f=(P,v)=>{l(T=>{for(const w of T.elements)if(w.id===P){w.opacity=v;break}})},p=P=>{for(const[v,T]of P.entries())f(v,T)},g=(P,v)=>{for(const T of P.keys())f(T,v)},A=P=>{if(s){switch(o){case re.AllSelectedObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.opacity&&!v.locked&&M.getState().selectedElementIdSet.has(v.id))return!0;break;case re.AllObjectsOfThisType:for(const v of e)if(v.type===z.Roof&&P!==v.opacity&&!v.locked)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const v of e)if(v.type===z.Roof&&v.foundationId===s.foundationId&&P!==v.opacity&&!v.locked)return!0;break;default:if(P!==(s==null?void 0:s.opacity))return!0;break}return!1}},y=P=>{if(s&&A(P)){switch(o){case re.AllSelectedObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for Selected Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisType:{const v=new Map;for(const w of e)if(w.type===z.Roof&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for All Roofs",timestamp:Date.now(),oldValues:v,newValue:P,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1);break}case re.AllObjectsOfThisTypeAboveFoundation:if(s.foundationId){const v=new Map;for(const w of e)if(w.type===z.Roof&&w.foundationId===s.foundationId&&!w.locked){const x=w;v.set(w.id,x.opacity),f(x.id,P)}const T={name:"Set Opacity for All Roofs Above Foundation",timestamp:Date.now(),oldValues:v,newValue:P,groupId:s.foundationId,undo:()=>{p(T.oldValues)},redo:()=>{g(T.oldValues,T.newValue)}};n(T),i(r+1)}break;default:if(s){const v=a(s.id),T=v.opacity!==void 0?v.opacity:s.opacity!==void 0?s.opacity:.5,w={name:"Set Roof Opacity",timestamp:Date.now(),oldValue:T,newValue:P,changedElementId:s.id,changedElementType:s.type,undo:()=>{f(w.changedElementId,w.oldValue)},redo:()=>{f(w.changedElementId,w.newValue)}};n(w),f(s.id,P),i(r+1)}}l(v=>{v.actionState.roofGlassOpacity=P})}},S=()=>{t(!1)},C=()=>{y(c)};return h.jsx(so,{width:550,title:Y.t("roofMenu.Opacity",d),onApply:C,onClose:S,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx(Sn,{min:0,max:1,style:{width:120},step:.01,precision:2,value:c,formatter:P=>Number(P).toFixed(2),onChange:P=>u(P)}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",d),": [0, 1]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:P=>M.getState().setRoofActionScope(P.target.value),value:o,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("roofMenu.OnlyThisRoof",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("roofMenu.AllRoofsAboveFoundation",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("roofMenu.AllSelectedRoofs",d)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("roofMenu.AllRoofs",d)})]})})})]})})},Mgo=()=>{const t=M.getState().elementsToPaste;if(t&&t.length>0)switch(t[0].type){case z.Window:case z.SolarPanel:case z.SolarWaterHeater:case z.Sensor:case z.Light:return!0}return!1},Igo=t=>{const e=[];if(t.type!==z.Roof)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=M.getState().countAllOffspringsByTypeAtOnce,a=i(n.id,!0),l=i(n.id,!1),s=n.roofStructure!==Ac.Rafter||n.opacity===void 0||n.opacity>0;return Mgo()&&e.push({key:"roof-paste",label:h.jsx(oM,{})}),e.push({key:"roof-lock",label:h.jsx(Ku,{selectedElement:n})}),n.rise>0&&e.push({key:"roof-ceiling-submenu",label:h.jsx(an,{children:Y.t("roofMenu.Ceiling",r)}),children:bgo(n)}),a.gotSome()&&e.push({key:"lock-unlock-clear-on-roof",label:h.jsx(an,{children:Y.t("word.Elements",r)}),children:igo(n,a,l)}),o&&(n.roofType===Go.Gable&&(e.push({key:"roof-structure-submenu",label:h.jsx(an,{children:Y.t("roofMenu.RoofStructure",r)}),children:Rgo(n)}),(n.roofStructure===Ac.Rafter||n.roofStructure===Ac.Glass)&&e.push({key:"opacity",label:h.jsxs(eo,{Dialog:Hgo,children:[Y.t("roofMenu.Opacity",r)," ..."]})})),e.push({key:"roof-thickness",label:h.jsxs(eo,{Dialog:ago,children:[Y.t(n.roofStructure===Ac.Rafter?"roofMenu.RafterThickness":"word.Thickness",r)," ","..."]})}),e.push({key:"roof-rise",label:h.jsxs(eo,{Dialog:lgo,children:[Y.t("roofMenu.Rise",r)," ..."]})}),s&&(e.push({key:"roof-r-value",label:h.jsxs(eo,{Dialog:sgo,children:[Y.t("roofMenu.RoofRValue",r)," ..."]})},{key:"roof-heat-capacity",label:h.jsxs(eo,{Dialog:cgo,children:[Y.t("word.VolumetricHeatCapacity",r)," ..."]})},{key:"roof-texture",label:h.jsxs(eo,{Dialog:Ago,children:[Y.t("word.Texture",r)," ..."]})}),(n.textureType===Ur.NoTexture||n.textureType===Ur.Default)&&e.push({key:"roof-color",label:h.jsxs(eo,{Dialog:wgo,children:[Y.t("roofMenu.RoofColor",r)," ..."]})}),e.push({key:"roof-side-color",label:h.jsxs(eo,{Dialog:vgo,children:[Y.t("roofMenu.RoofSideColor",r)," ..."]})}))),{items:e}},zgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.relativeYawAngle)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.relativeYawAngle??0)-R)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.relativeYawAngle)??0)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.relativeYawAngle=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.relativeYawAngle=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.relativeYawAngle=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.relativeYawAngle=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.relativeYawAngle);const F={name:"Set Relative Yaw Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.relativeYawAngle:u.relativeYawAngle,E={name:"Set Wind Turbine Relative Yaw Angle",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineRelativeYawAngle=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RelativeYawAngle",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(me.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(me.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.SouthFacingIsZero",p),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",p)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Dgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.numberOfBlades)??3),p=$t(),{Option:g}=Uo,A=H=>{a(H.target.value)},y=H=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.WindTurbine&&F.foundationId===(u==null?void 0:u.foundationId)&&!F.locked&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.numberOfBlades??0)-H)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.numberOfBlades)??0)-H)>Et)return!0}return!1}},S=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.id===H&&!N.locked){const U=N;U.numberOfBlades=F;break}})},C=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.foundationId===H&&!N.locked){const U=N;U.numberOfBlades=F}})},P=H=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked){const N=E;N.numberOfBlades=H}})},v=(H,F)=>{M.getState().set(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked&&H.has(N.id)){const U=N;U.numberOfBlades=F}})},T=H=>{if(u&&y(H)){switch(i){case re.AllSelectedObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for Selected Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{v(E.oldValues,E.newValue)}};r(E),v(F,H),s(l+1);break}case re.AllObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for All Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{P(E.newValue)}};r(E),P(H),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const F=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===u.foundationId&&F.set(N.id,N.numberOfBlades??3);const E={name:"Select Blade Number for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:F,newValue:H,groupId:u.foundationId,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{E.groupId&&C(E.groupId,E.newValue)}};r(E),C(u.foundationId,H),s(l+1)}break}default:{const F=o(u.id),E=F?F.numberOfBlades??3:u.numberOfBlades??3,N={name:"Select Wind Turbine Blade Number",timestamp:Date.now(),oldValue:E,newValue:H,changedElementId:u.id,changedElementType:u.type,undo:()=>{S(N.changedElementId,N.oldValue)},redo:()=>{S(N.changedElementId,N.newValue)}};r(N),S(u.id,H),s(l+1);break}}e(F=>{F.actionState.windTurbineNumberOfBlades=H})}},w=()=>{t(!1)},x=()=>{w(),c()},b=()=>{T(d),t(!1),s(0)},R=()=>{T(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.BladeNumber",p),onApply:R,onClose:w,onClickCancel:x,onClickOk:b,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:4,children:h.jsxs(Uo,{style:{width:"60px"},value:d,onChange:H=>{H!==null&&f(H)},children:[h.jsx(g,{value:1,children:"1"},1),h.jsx(g,{value:2,children:"2"},2),h.jsx(g,{value:3,children:"3"},3),h.jsx(g,{value:4,children:"4"},4),h.jsx(g,{value:8,children:"8"},8)]})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:20,children:h.jsx(Le.Group,{onChange:A,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Ego=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.initialRotorAngle)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs((H.initialRotorAngle??0)-R)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.initialRotorAngle)??0)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.initialRotorAngle=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.initialRotorAngle=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.initialRotorAngle=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.initialRotorAngle=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.initialRotorAngle);const F={name:"Set Rotor Initial Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.initialRotorAngle:u.initialRotorAngle,E={name:"Set Wind Turbine Rotor Initial Angle",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineInitialRotorAngle=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorInitialAngle",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:0,max:360,style:{width:120},precision:1,step:1,value:parseFloat(me.toDegrees(d).toFixed(2)),formatter:R=>`${R}°`,onChange:R=>{R!==null&&f(me.toRadians(R))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0°, 360°]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Fgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=me.toRadians(10),d=uo(z.WindTurbine),[f,p]=m.useState((d==null?void 0:d.pitchAngle)??u),g=$t(),A=H=>{a(H.target.value)},y=H=>{if(d){switch(i){case re.AllObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const F of n)if(F.type===z.WindTurbine&&F.foundationId===(d==null?void 0:d.foundationId)&&!F.locked&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const F of n)if(F.type===z.WindTurbine&&!F.locked&&M.getState().selectedElementIdSet.has(F.id)&&Math.abs((F.pitchAngle??u)-H)>Et)return!0;break;default:if(Math.abs(((d==null?void 0:d.pitchAngle)??u)-H)>Et)return!0}return!1}},S=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.id===H&&!N.locked){const U=N;U.pitchAngle=F;break}})},C=(H,F)=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&N.foundationId===H&&!N.locked){const U=N;U.pitchAngle=F}})},P=H=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked){const N=E;N.pitchAngle=H}})},v=(H,F)=>{M.getState().set(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked&&H.has(N.id)){const U=N;U.pitchAngle=F}})},T=H=>{if(d&&y(H)){switch(i){case re.AllSelectedObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for Selected Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{v(E.oldValues,E.newValue)}};r(E),v(F,H),s(l+1);break}case re.AllObjectsOfThisType:{const F=new Map;for(const N of n)N.type===z.WindTurbine&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for All Wind Turbines",timestamp:Date.now(),oldValues:F,newValue:H,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{P(E.newValue)}};r(E),P(H),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){const F=new Map;for(const N of n)N.type===z.WindTurbine&&N.foundationId===d.foundationId&&F.set(N.id,N.pitchAngle);const E={name:"Set Pitch Angle for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:F,newValue:H,groupId:d.foundationId,undo:()=>{for(const[N,U]of E.oldValues.entries())S(N,U)},redo:()=>{E.groupId&&C(E.groupId,E.newValue)}};r(E),C(d.foundationId,H),s(l+1)}break}default:{const F=o(d.id),E=F?F.pitchAngle:d.pitchAngle,N={name:"Set Wind Turbine Pitch Angle",timestamp:Date.now(),oldValue:E,newValue:H,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(N.changedElementId,N.oldValue)},redo:()=>{S(N.changedElementId,N.newValue)}};r(N),S(d.id,H),s(l+1);break}}e(F=>{F.actionState.windTurbinePitchAngle=H})}},w=()=>{t(!1)},x=()=>{w(),c()},b=()=>{T(f),t(!1),s(0)},R=()=>{T(f)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorBladePitchAngle",g),onApply:R,onClose:w,onClickCancel:x,onClickOk:b,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(me.toDegrees(f).toFixed(2)),formatter:H=>`${H}°`,onChange:H=>{H!==null&&p(me.toRadians(H))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",g),": [-180°, 180°]"]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:A,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",g)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",g)})]})})})]})})},kgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.bladeRadius)??0),p=m.useRef(!1),g=m.useRef(),A=$t(),y=E=>{a(E.target.value)},S=E=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-E)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.bladeRadius-E)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.bladeRadius-E)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.bladeRadius)-E)>Et)return!0}return!1}},C=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===E&&!W.locked){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N;break}})},P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===E&&!W.locked){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N}})},v=E=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.bladeRadius=E,W.lx=W.ly=E*2,W.lz=W.towerHeight+E}})},T=(E,N)=>{M.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&E.has(W.id)){const k=W;k.bladeRadius=N,k.lx=k.ly=N*2,k.lz=k.towerHeight+N}})},w=E=>{if(u&&S(E)){switch(g.current=void 0,i){case re.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{T(U.oldValues,U.newValue)}};r(U),T(N,E),s(l+1)}break}case re.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{v(U.newValue)}};r(U),v(E),s(l+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.towerHeight{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,E),s(l+1)}}break}default:{const N=o(u.id),U=N?N.bladeRadius:u.bladeRadius;if(p.current=u.towerHeight{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,E),s(l+1)}break}}e(N=>{N.actionState.windTurbineBladeRadius=E})}},x=()=>{p.current=!1,t(!1)},b=()=>{x(),c()},R=()=>{w(d),p.current||(t(!1),s(0))},H=()=>{w(d)},F=p.current?": "+Y.t("message.NotApplicableToSelectedAction",A)+(g.current!==void 0?" ("+g.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.RotorBladeRadius",A),rejectedMessage:F,onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:E=>{E!==null&&f(E)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 100] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",A)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},Lgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.bladeRootRadius)??.3),[p,g]=m.useState((u==null?void 0:u.maximumChordLength)??1),[A,y]=m.useState((u==null?void 0:u.maximumChordRadius)??3),S=m.useRef(null),C=$t(),P=555;m.useEffect(()=>{if(!S.current||!u)return;const Q=S.current.getContext("2d");if(!Q)return;const se=S.current.width,oe=S.current.height,Z=20,te=oe*.7;Q.clearRect(0,0,se,oe),Q.setLineDash([]),Q.strokeStyle="gray",Q.lineWidth=1,Q.rect(0,0,se,oe),Q.stroke();const ee=(se-Z*2)/u.bladeRadius,de=ee*u.bladeTipWidth,fe=ee*A,pe=ee*p,ye=ee*u.bladeRadius,ae=ee*d,Te=pe-ae,ge=ye-fe/3,Se=[];Se.push(new Kt(Z,te-ae)),Se.push(new Kt(Z+ye-ge,te-Te/2)),Se.push(new Kt(Z+fe,te-Te)),Se.push(new Kt(Z+ye,te+ae-de));const De=new Sq(Se).getPoints(50);Q.beginPath(),Q.moveTo(De[0].x,De[0].y);for(let Ae=1;Ae{a(Q.target.value)},T=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.bladeRootRadius-Q)>Et)return!0;break;default:if(Math.abs(((u==null?void 0:u.bladeRootRadius)??.3)-Q)>Et)return!0}return!1}},w=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.id===Q&&!Z.locked){const te=Z;te.bladeRootRadius=se;break}})},x=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.foundationId===Q&&!Z.locked){const te=Z;te.bladeRootRadius=se}})},b=Q=>{e(se=>{for(const oe of se.elements)if(oe.type===z.WindTurbine&&!oe.locked){const Z=oe;Z.bladeRootRadius=Q}})},R=(Q,se)=>{M.getState().set(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&!Z.locked&&Q.has(Z.id)){const te=Z;te.bladeRootRadius=se}})},H=Q=>{if(u&&T(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(Z.id)&&se.set(Z.id,Z.bladeRootRadius);const oe={name:"Set Root Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())w(Z,te)},redo:()=>{R(oe.oldValues,oe.newValue)}};r(oe),R(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&se.set(Z.id,Z.bladeRootRadius);const oe={name:"Set Root Radius for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())w(Z,te)},redo:()=>{b(oe.newValue)}};r(oe),b(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&Z.foundationId===u.foundationId&&se.set(Z.id,Z.bladeRootRadius);const oe={name:"Set Root Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[Z,te]of oe.oldValues.entries())w(Z,te)},redo:()=>{oe.groupId&&x(oe.groupId,oe.newValue)}};r(oe),x(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),oe=se?se.bladeRootRadius:u.bladeRootRadius,Z={name:"Set Wind Turbine Root Radius",timestamp:Date.now(),oldValue:oe,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{w(Z.changedElementId,Z.oldValue)},redo:()=>{w(Z.changedElementId,Z.newValue)}};r(Z),w(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeRootRadius=Q})}},F=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordLength-Q)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordLength)-Q)>Et)return!0}return!1}},E=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.id===Q&&!Z.locked){const te=Z;te.maximumChordLength=se;break}})},N=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.foundationId===Q&&!Z.locked){const te=Z;te.maximumChordLength=se}})},U=Q=>{e(se=>{for(const oe of se.elements)if(oe.type===z.WindTurbine&&!oe.locked){const Z=oe;Z.maximumChordLength=Q}})},W=(Q,se)=>{M.getState().set(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&!Z.locked&&Q.has(Z.id)){const te=Z;te.maximumChordLength=se}})},k=Q=>{if(u&&F(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(Z.id)&&se.set(Z.id,Z.maximumChordLength);const oe={name:"Set Chord Length for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())E(Z,te)},redo:()=>{W(oe.oldValues,oe.newValue)}};r(oe),W(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&se.set(Z.id,Z.maximumChordLength);const oe={name:"Set Chord Length for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())E(Z,te)},redo:()=>{U(oe.newValue)}};r(oe),U(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&Z.foundationId===u.foundationId&&se.set(Z.id,Z.maximumChordLength);const oe={name:"Set Chord Length for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[Z,te]of oe.oldValues.entries())E(Z,te)},redo:()=>{oe.groupId&&N(oe.groupId,oe.newValue)}};r(oe),N(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),oe=se?se.maximumChordLength:u.maximumChordLength,Z={name:"Set Wind Turbine Chord Length",timestamp:Date.now(),oldValue:oe,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{E(Z.changedElementId,Z.oldValue)},redo:()=>{E(Z.changedElementId,Z.newValue)}};r(Z),E(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeMaximumChordLength=Q})}},D=Q=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const se of n)if(se.type===z.WindTurbine&&se.foundationId===(u==null?void 0:u.foundationId)&&!se.locked&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const se of n)if(se.type===z.WindTurbine&&!se.locked&&M.getState().selectedElementIdSet.has(se.id)&&Math.abs(se.maximumChordRadius-Q)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.maximumChordRadius)-Q)>Et)return!0}return!1}},L=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.id===Q&&!Z.locked){const te=Z;te.maximumChordRadius=se;break}})},j=(Q,se)=>{e(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&Z.foundationId===Q&&!Z.locked){const te=Z;te.maximumChordRadius=se}})},B=Q=>{e(se=>{for(const oe of se.elements)if(oe.type===z.WindTurbine&&!oe.locked){const Z=oe;Z.maximumChordRadius=Q}})},O=(Q,se)=>{M.getState().set(oe=>{for(const Z of oe.elements)if(Z.type===z.WindTurbine&&!Z.locked&&Q.has(Z.id)){const te=Z;te.maximumChordRadius=se}})},V=Q=>{if(u&&D(Q)){switch(i){case re.AllSelectedObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(Z.id)&&se.set(Z.id,Z.maximumChordRadius);const oe={name:"Set Chord Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())L(Z,te)},redo:()=>{O(oe.oldValues,oe.newValue)}};r(oe),O(se,Q),s(l+1);break}case re.AllObjectsOfThisType:{const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&se.set(Z.id,Z.maximumChordRadius);const oe={name:"Set Chord Radius for All Wind Turbines",timestamp:Date.now(),oldValues:se,newValue:Q,undo:()=>{for(const[Z,te]of oe.oldValues.entries())L(Z,te)},redo:()=>{B(oe.newValue)}};r(oe),B(Q),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const se=new Map;for(const Z of n)Z.type===z.WindTurbine&&Z.foundationId===u.foundationId&&se.set(Z.id,Z.maximumChordRadius);const oe={name:"Set Chord Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:se,newValue:Q,groupId:u.foundationId,undo:()=>{for(const[Z,te]of oe.oldValues.entries())L(Z,te)},redo:()=>{oe.groupId&&j(oe.groupId,oe.newValue)}};r(oe),j(u.foundationId,Q),s(l+1)}break}default:{const se=o(u.id),oe=se?se.maximumChordRadius:u.maximumChordRadius,Z={name:"Set Wind Turbine Chord Radius",timestamp:Date.now(),oldValue:oe,newValue:Q,changedElementId:u.id,changedElementType:u.type,undo:()=>{L(Z.changedElementId,Z.oldValue)},redo:()=>{L(Z.changedElementId,Z.newValue)}};r(Z),L(u.id,Q),s(l+1);break}}e(se=>{se.actionState.windTurbineBladeMaximumChordRadius=Q})}},G=()=>{t(!1)},q=()=>{G(),c()},$=()=>{k(p),V(A),H(d),t(!1),s(0)},ie=()=>{k(p),V(A),H(d)};return h.jsxs(so,{width:600,title:Y.t("windTurbineMenu.RotorBladeDesign",C),onApply:ie,onClose:G,onClickCancel:q,onClickOk:$,children:[h.jsx(nn,{children:h.jsx(Ke,{span:24,children:h.jsx("canvas",{ref:S,id:"blade-design-canvas",width:P,height:P*.25,style:{paddingBottom:"12px"}})})}),h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"A: "}),h.jsx(Ke,{children:h.jsx(Sn,{min:.1,max:1,style:{width:"70px"},step:.01,precision:2,value:d,onChange:Q=>{Q&&f(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.1, 1] ",Y.t("word.MeterAbbreviation",C)]})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"C: "}),h.jsx(Ke,{children:h.jsx(Sn,{min:.5,max:2,style:{width:"70px"},step:.01,precision:2,value:p,onChange:Q=>{Q&&g(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[0.5, 2] ",Y.t("word.MeterAbbreviation",C)]})]}),h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{style:{textAlign:"center",fontStyle:"italic"},children:"D:"}),h.jsx(Ke,{children:h.jsx(Sn,{min:2,max:((u==null?void 0:u.bladeRadius)??10)/2,style:{width:70},step:.01,precision:2,value:A,onChange:Q=>{Q&&y(Q)}})}),h.jsxs(Ke,{style:{paddingTop:"5px",textAlign:"left",fontSize:"11px"},children:["[2, ",((u==null?void 0:u.bladeRadius)??10)/2,"] ",Y.t("word.MeterAbbreviation",C)]})]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:v,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",C)})]})})})]})]})},Wgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.hubRadius)??0),[p,g]=m.useState((u==null?void 0:u.hubLength)??0),A=$t(),y=F=>{a(F.target.value)},S=(F,E)=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)){const U=N;if(Math.abs(U.hubRadius-F)>Et||Math.abs(U.hubLength-E)>Et)return!0}break;default:if(Math.abs((u==null?void 0:u.hubRadius)-F)>Et||Math.abs((u==null?void 0:u.hubLength)-E)>Et)return!0}return!1}},C=(F,E)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.id===F&&!U.locked){const W=U;W.hubRadius=E[0],W.hubLength=E[1];break}})},P=(F,E)=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&U.foundationId===F&&!U.locked){const W=U;W.hubRadius=E[0],W.hubLength=E[1]}})},v=F=>{e(E=>{for(const N of E.elements)if(N.type===z.WindTurbine&&!N.locked){const U=N;U.hubRadius=F[0],U.hubLength=F[1]}})},T=(F,E)=>{M.getState().set(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked&&F.has(U.id)){const W=U;W.hubRadius=E[0],W.hubLength=E[1]}})},w=F=>{if(u&&S(F[0],F[1])){switch(i){case re.AllSelectedObjectsOfThisType:{const E=new Map;for(const U of n)if(U.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(U.id)){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for Selected Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{T(N.oldValues,N.newValue)}};r(N),T(E,F),s(l+1);break}case re.AllObjectsOfThisType:{const E=new Map;for(const U of n)if(U.type===z.WindTurbine){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines",timestamp:Date.now(),oldValues:E,newValue:F,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{v(N.newValue)}};r(N),v(F),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const E=new Map;for(const U of n)if(U.type===z.WindTurbine&&U.foundationId===u.foundationId){const W=U;E.set(U.id,[W.hubRadius,W.hubLength])}const N={name:"Set Hub Parameters for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:E,newValue:F,groupId:u.foundationId,undo:()=>{for(const[U,W]of N.oldValues.entries())C(U,W)},redo:()=>{N.groupId&&P(N.groupId,N.newValue)}};r(N),P(u.foundationId,F),s(l+1)}break}default:{const E=o(u.id),N=E?E.hubRadius:u.hubRadius,U=E?E.hubLength:u.hubLength,W={name:"Set Wind Turbine Hub Parameters",timestamp:Date.now(),oldValue:[N,U],newValue:F,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,F),s(l+1);break}}e(E=>{E.actionState.windTurbineHubRadius=F[0],E.actionState.windTurbineHubLength=F[1]})}},x=()=>{t(!1)},b=()=>{x(),c()},R=()=>{w([d,p]),t(!1),s(0)},H=()=>{w([d,p])};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.HubDesign",A),onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:7,children:[h.jsx("div",{style:{marginTop:"-20px",textAlign:"left",fontSize:"12px"},children:Y.t("windTurbineMenu.HubRadius",A)}),h.jsx(Sn,{min:.5,max:5,style:{width:120},step:.01,precision:2,value:d,onChange:F=>{F!==null&&f(F)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [0.5, 5] ",Y.t("word.MeterAbbreviation",A)]}),h.jsx("div",{style:{paddingTop:"10px",textAlign:"left",fontSize:"12px"},children:Y.t("windTurbineMenu.HubLength",A)}),h.jsx(Sn,{min:1,max:10,style:{width:120},step:.01,precision:2,value:p,onChange:F=>{F!==null&&g(F)}}),h.jsxs("div",{style:{paddingTop:"4px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 10] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},Ngo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.birdSafe)??uc.None),[p,g]=m.useState((u==null?void 0:u.bladeColor)??t9),[A,y]=m.useState((u==null?void 0:u.stripeColor)??n9),S=$t(),{Option:C}=Uo,P=U=>{a(U.target.value)},v=(U,W,k)=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.WindTurbine&&D.foundationId===(u==null?void 0:u.foundationId)&&!D.locked){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.WindTurbine&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)){const L=D;if((L.birdSafe??uc.None)!==U||(L.bladeColor??t9)!==W||(L.stripeColor??n9)!==k)return!0}break;default:if((u.birdSafe??uc.None)!==U||(u.bladeColor??t9)!==W||(u.stripeColor??n9)!==k)return!0}return!1}},T=(U,W,k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.id===U&&!j.locked){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D;break}})},w=(U,W,k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&j.foundationId===U&&!j.locked){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D}})},x=(U,W,k)=>{e(D=>{for(const L of D.elements)if(L.type===z.WindTurbine&&!L.locked){const j=L;j.birdSafe=U,j.bladeColor=W,j.stripeColor=k}})},b=(U,W,k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.WindTurbine&&!j.locked&&U.has(j.id)){const B=j;B.birdSafe=W,B.bladeColor=k,B.stripeColor=D}})},R=(U,W,k)=>{if(u&&v(U,W,k)){switch(i){case re.AllSelectedObjectsOfThisType:{const D=new Map;for(const j of n)if(j.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(j.id)){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for Selected Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;b(L.oldValues,Number(j[0]),j[1],j[2])}};r(L),b(D,U,W,k),s(l+1);break}case re.AllObjectsOfThisType:{const D=new Map;for(const j of n)if(j.type===z.WindTurbine){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{const j=L.newValue;x(Number(j[0]),j[1],j[2])}};r(L),x(U,W,k),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const D=new Map;for(const j of n)if(j.type===z.WindTurbine&&j.foundationId===u.foundationId){const B=j;D.set(j.id,[(B.birdSafe??uc.None).toString(),B.bladeColor,B.stripeColor])}const L={name:"Select Bird-Safe Design for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:D,newValue:[U.toString(),W,k],groupId:u.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries()){const O=B;T(j,Number(O[0]),O[1],O[2])}},redo:()=>{if(L.groupId){const j=L.newValue;w(L.groupId,Number(j[0]),j[1],j[2])}}};r(L),w(u.foundationId,U,W,k),s(l+1)}break}default:{const D=o(u.id),L=D?D.birdSafe??uc.None:u.birdSafe??uc.None,j=D?D.bladeColor??t9:u.bladeColor??t9,B=D?D.stripeColor??n9:u.stripeColor??n9,O=[L.toString(),j,B],V={name:"Select Bird-Safe Design for Wind Turbine",timestamp:Date.now(),oldValue:O,newValue:[U.toString(),W,k],changedElementId:u.id,changedElementType:u.type,undo:()=>{const G=V.oldValue;T(V.changedElementId,Number(G[0]),G[1],G[2])},redo:()=>{T(V.changedElementId,U,W,k)}};r(V),T(u.id,U,W,k),s(l+1);break}}e(D=>{D.actionState.windTurbineBirdSafeDesign=U,D.actionState.windTurbineBladeColor=W,D.actionState.windTurbineStripeColor=k})}},H=()=>{t(!1)},F=()=>{H(),c()},E=()=>{R(d,p,A),t(!1),s(0)},N=()=>{R(d,p,A)};return h.jsx(so,{width:600,title:Y.t("windTurbineMenu.BirdSafeDesign",S),onApply:N,onClose:H,onClickCancel:F,onClickOk:E,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:8,children:[h.jsxs("span",{children:[Y.t("word.Pattern",S),": "]}),h.jsxs(Uo,{style:{width:"116px"},value:d,onChange:U=>{U!==null&&f(U)},children:[h.jsx(C,{value:uc.None,children:Y.t("windTurbineMenu.BirdSafeNone",S)},uc.None),h.jsx(C,{value:uc.Bicolor,children:Y.t("windTurbineMenu.BirdSafeBicolor",S)},uc.Bicolor),h.jsx(C,{value:uc.Striped,children:Y.t("windTurbineMenu.BirdSafeStriped",S)},uc.Striped)]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[Y.t("word.Color",S)," 1: "]}),h.jsx("input",{type:"color",value:p,onChange:U=>{g(U.target.value)}})]}),h.jsxs("div",{style:{marginTop:"10px"},children:[h.jsxs("span",{children:[Y.t("word.Color",S)," 2: "]}),h.jsx("input",{type:"color",value:A,onChange:U=>{y(U.target.value)}})]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:16,children:h.jsx(Le.Group,{onChange:P,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",S)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",S)})]})})})]})})},Ugo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.towerHeight)??0),p=m.useRef(!1),g=m.useRef(),A=$t(),y=E=>{a(E.target.value)},S=E=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-E)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===(u==null?void 0:u.foundationId)&&!N.locked&&Math.abs(N.towerHeight-E)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const N of n)if(N.type===z.WindTurbine&&!N.locked&&M.getState().selectedElementIdSet.has(N.id)&&Math.abs(N.towerHeight-E)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.towerHeight)-E)>Et)return!0}return!1}},C=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.id===E&&!W.locked){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius;break}})},P=(E,N)=>{e(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&W.foundationId===E&&!W.locked){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius}})},v=E=>{e(N=>{for(const U of N.elements)if(U.type===z.WindTurbine&&!U.locked){const W=U;W.towerHeight=E,W.lz=E+W.bladeRadius}})},T=(E,N)=>{M.getState().set(U=>{for(const W of U.elements)if(W.type===z.WindTurbine&&!W.locked&&E.has(W.id)){const k=W;k.towerHeight=N,k.lz=N+k.bladeRadius}})},w=E=>{if(u&&S(E)){switch(g.current=void 0,i){case re.AllSelectedObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(N.id)&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(W.id)&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for Selected Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{T(U.oldValues,U.newValue)}};r(U),T(N,E),s(l+1)}break}case re.AllObjectsOfThisType:{p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines",timestamp:Date.now(),oldValues:N,newValue:E,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{v(U.newValue)}};r(U),v(E),s(l+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){p.current=!1;for(const N of n)if(N.type===z.WindTurbine&&N.foundationId===u.foundationId&&N.bladeRadius>E){p.current=!0;break}if(p.current)g.current=E,f(u.towerHeight);else{const N=new Map;for(const W of n)W.type===z.WindTurbine&&W.foundationId===u.foundationId&&N.set(W.id,W.towerHeight);const U={name:"Set Tower Height for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:N,newValue:E,groupId:u.foundationId,undo:()=>{for(const[W,k]of U.oldValues.entries())C(W,k)},redo:()=>{U.groupId&&P(U.groupId,U.newValue)}};r(U),P(u.foundationId,E),s(l+1)}}break}default:{const N=o(u.id),U=N?N.towerHeight:u.towerHeight;if(p.current=u.bladeRadius>E,p.current)g.current=E,f(U);else{const W={name:"Set Wind Turbine Tower Height",timestamp:Date.now(),oldValue:U,newValue:E,changedElementId:u.id,changedElementType:u.type,undo:()=>{C(W.changedElementId,W.oldValue)},redo:()=>{C(W.changedElementId,W.newValue)}};r(W),C(u.id,E),s(l+1)}break}}e(N=>{N.actionState.windTurbineTowerHeight=E})}},x=()=>{p.current=!1,t(!1)},b=()=>{x(),c()},R=()=>{w(d),p.current||(t(!1),s(0))},H=()=>{w(d)},F=p.current?": "+Y.t("message.NotApplicableToSelectedAction",A)+(g.current!==void 0?" ("+g.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.TowerHeight",A),rejectedMessage:F,onApply:H,onClose:x,onClickCancel:b,onClickOk:R,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:1,max:100,style:{width:120},step:.1,precision:1,value:d,onChange:E=>{E!==null&&f(E)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",A),": [1, 100] ",Y.t("word.MeterAbbreviation",A)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",A)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:y,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",A)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",A)})]})})})]})})},jgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(En),i=M(f3),a=M(h3),l=M(no),s=M(Qn),c=M(Xi),u=uo(z.WindTurbine),[d,f]=m.useState((u==null?void 0:u.towerRadius)??0),p=$t(),g=R=>{a(R.target.value)},A=R=>{if(u){switch(i){case re.AllObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs(H.towerRadius-R)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const H of n)if(H.type===z.WindTurbine&&H.foundationId===(u==null?void 0:u.foundationId)&&!H.locked&&Math.abs(H.towerRadius-R)>Et)return!0;break;case re.AllSelectedObjectsOfThisType:for(const H of n)if(H.type===z.WindTurbine&&!H.locked&&M.getState().selectedElementIdSet.has(H.id)&&Math.abs(H.towerRadius-R)>Et)return!0;break;default:if(Math.abs((u==null?void 0:u.towerRadius)-R)>Et)return!0}return!1}},y=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.id===R&&!E.locked){const N=E;N.towerRadius=H;break}})},S=(R,H)=>{e(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&E.foundationId===R&&!E.locked){const N=E;N.towerRadius=H}})},C=R=>{e(H=>{for(const F of H.elements)if(F.type===z.WindTurbine&&!F.locked){const E=F;E.towerRadius=R}})},P=(R,H)=>{M.getState().set(F=>{for(const E of F.elements)if(E.type===z.WindTurbine&&!E.locked&&R.has(E.id)){const N=E;N.towerRadius=H}})},v=R=>{if(u&&A(R)){switch(i){case re.AllSelectedObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&M.getState().selectedElementIdSet.has(E.id)&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for Selected Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{P(F.oldValues,F.newValue)}};r(F),P(H,R),s(l+1);break}case re.AllObjectsOfThisType:{const H=new Map;for(const E of n)E.type===z.WindTurbine&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for All Wind Turbines",timestamp:Date.now(),oldValues:H,newValue:R,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{C(F.newValue)}};r(F),C(R),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(u.foundationId){const H=new Map;for(const E of n)E.type===z.WindTurbine&&E.foundationId===u.foundationId&&H.set(E.id,E.towerRadius);const F={name:"Set Tower Radius for All Wind Turbines Above Foundation",timestamp:Date.now(),oldValues:H,newValue:R,groupId:u.foundationId,undo:()=>{for(const[E,N]of F.oldValues.entries())y(E,N)},redo:()=>{F.groupId&&S(F.groupId,F.newValue)}};r(F),S(u.foundationId,R),s(l+1)}break}default:{const H=o(u.id),F=H?H.towerRadius:u.towerRadius,E={name:"Set Wind Turbine Tower Radius",timestamp:Date.now(),oldValue:F,newValue:R,changedElementId:u.id,changedElementType:u.type,undo:()=>{y(E.changedElementId,E.oldValue)},redo:()=>{y(E.changedElementId,E.newValue)}};r(E),y(u.id,R),s(l+1);break}}e(H=>{H.actionState.windTurbineTowerRadius=R})}},T=()=>{t(!1)},w=()=>{T(),c()},x=()=>{v(d),t(!1),s(0)},b=()=>{v(d)};return h.jsx(so,{width:550,title:Y.t("windTurbineMenu.TowerRadius",p),onApply:b,onClose:T,onClickCancel:w,onClickOk:x,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:.1,max:2,style:{width:120},step:.01,precision:2,value:d,onChange:R=>{R!==null&&f(R)}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",p),": [0.1, 2] ",Y.t("word.MeterAbbreviation",p)]})]}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",p)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:g,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("windTurbineMenu.OnlyThisWindTurbine",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("windTurbineMenu.AllWindTurbinesAboveFoundation",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("windTurbineMenu.AllSelectedWindTurbines",p)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("windTurbineMenu.AllWindTurbines",p)})]})})})]})})},Bgo=t=>{const e=[];if(t.type!==z.WindTurbine)return{items:e};const n=t,o={lng:M.getState().language},r=!n.locked;return e.push({key:"wind-turbine-copy",label:h.jsx(Fd,{})}),r&&e.push({key:"wind-turbine-cut",label:h.jsx(kd,{})}),e.push({key:"wind-turbine-lock",label:h.jsx(Ku,{selectedElement:n})}),r&&e.push({key:"wind-turbine-relative-yaw-angle",label:h.jsxs(eo,{Dialog:zgo,children:[Y.t("windTurbineMenu.RelativeYawAngle",o)," ..."]})},{key:"wind-turbine-rotor-submenu",label:h.jsx(an,{children:Y.t("windTurbineMenu.Rotor",o)}),children:[{key:"wind-turbine-rotor-blade-number",label:h.jsxs(eo,{noPadding:!0,Dialog:Dgo,children:[Y.t("windTurbineMenu.BladeNumber",o)," ..."]})},{key:"wind-turbine-rotor-initial-angle",label:h.jsxs(eo,{noPadding:!0,Dialog:Ego,children:[Y.t("windTurbineMenu.RotorInitialAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-pitch-angle",label:h.jsxs(eo,{noPadding:!0,Dialog:Fgo,children:[Y.t("windTurbineMenu.RotorBladePitchAngle",o)," ..."]})},{key:"wind-turbine-rotor-blade-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:kgo,children:[Y.t("windTurbineMenu.RotorBladeRadius",o)," ..."]})},{key:"wind-turbine-rotor-blade-design",label:h.jsxs(eo,{noPadding:!0,Dialog:Lgo,children:[Y.t("windTurbineMenu.RotorBladeDesign",o)," ..."]})},{key:"wind-turbine-hub-design",label:h.jsxs(eo,{noPadding:!0,Dialog:Wgo,children:[Y.t("windTurbineMenu.HubDesign",o)," ..."]})},{key:"wind-turbine-bird-safe-blade",label:h.jsxs(eo,{noPadding:!0,Dialog:Ngo,children:[Y.t("windTurbineMenu.BirdSafeDesign",o)," ..."]})}]},{key:"wind-turbine-tower-submenu",label:h.jsx(an,{children:Y.t("windTurbineMenu.Tower",o)}),children:[{key:"wind-turbine-tower-height",label:h.jsxs(eo,{noPadding:!0,Dialog:Ugo,children:[Y.t("windTurbineMenu.TowerHeight",o)," ..."]})},{key:"wind-turbine-tower-radius",label:h.jsxs(eo,{noPadding:!0,Dialog:jgo,children:[Y.t("windTurbineMenu.TowerRadius",o)," ..."]})}]},{key:"wind-turbine-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",o)}),children:v3(n)}),{items:e}},Ygo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(Yge),l=M(Oge),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState((d==null?void 0:d.lx)??1),g=m.useRef(!1),A=m.useRef(),y=$t(),S=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===k&&!j.locked){j.lx=D;break}})},C=(k,D)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===k&&!j.locked&&(j.lx=D)})},P=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarWaterHeater&&!B.locked){let O;D?O=B.parentId===k&&me.isIdentical(B.normal,D):O=B.parentId===k,O&&(B.lx=L)}})},v=k=>{e(D=>{for(const L of D.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lx=k)})},T=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)&&(j.lx=D)})},w=k=>{l(k.target.value)},x=(k,D)=>{const L=r(k);if(L){if(L.type===z.Cuboid&&!me.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.lx=D,L.type===z.Roof?!0:me.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(k,D)=>!x(k,D),R=k=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs(D.lx-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&me.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lx-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lx-k)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.lx)-k)>Et)return!0;break}}return!1}},H=k=>{if(d&&R(k))switch(A.current=void 0,a){case re.AllSelectedObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lx);const L={name:"Set Length for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{T(L.oldValues,L.newValue)}};i(L),T(D,k),c(s+1)}break}case re.AllObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lx);const L={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{v(L.newValue)}};i(L),v(k),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===d.foundationId&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&D.set(j.id,j.lx);const L={name:"Set Length for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:d.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,k),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(g.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&me.isIdentical(j.normal,d.normal)&&b(j,k)){g.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&b(j,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lx);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&me.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lx);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lx);const O=B?d.normal:void 0,V={name:"Set Length for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:d.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())S(G,q)},redo:()=>{V.groupId&&P(V.groupId,V.normal,V.newValue)}};i(V),P(d.parentId,O,k),c(s+1)}}break}default:{const D=o(d.id),L=D?D.lx:d.lx;if(g.current=b(d,k),g.current)A.current=k,p(L);else{const j={name:"Set Water Heater Length",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(j.changedElementId,j.oldValue)},redo:()=>{S(j.changedElementId,j.newValue)}};i(j),S(d.id,k),c(s+1)}break}}},F=()=>{g.current=!1,t(!1)},E=()=>{F(),u()},N=()=>{H(f),g.current||(t(!1),c(0))},U=()=>{H(f)},W=g.current?": "+Y.t("message.NotApplicableToSelectedAction",y)+(A.current!==void 0?" ("+A.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Length",y),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:0,max:100,step:.1,style:{width:120},precision:2,value:f,onChange:k=>{k!==null&&p(k)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:w,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",y)})]})})})]})})},Ogo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(xh),l=M(bh),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState(0),[g,A]=m.useState((d==null?void 0:d.ly)??1),y=m.useRef(!1),S=m.useRef(),C=$t();m.useEffect(()=>{d&&p(Number((d.lz-.3).toFixed(2)))},[d]);const P=(L,j)=>{e(B=>{for(const O of B.elements)if(O.type===z.SolarWaterHeater&&O.id===L&&!O.locked){O.ly=j;break}})},v=(L,j)=>{e(B=>{for(const O of B.elements)O.type===z.SolarWaterHeater&&O.foundationId===L&&!O.locked&&(O.ly=j)})},T=(L,j,B)=>{e(O=>{for(const V of O.elements)if(V.type===z.SolarWaterHeater&&!V.locked){let G;j?G=V.parentId===L&&me.isIdentical(V.normal,j):G=V.parentId===L,G&&(V.ly=B)}})},w=L=>{e(j=>{for(const B of j.elements)B.type===z.SolarWaterHeater&&!B.locked&&(B.ly=L)})},x=(L,j)=>{M.getState().set(B=>{for(const O of B.elements)O.type===z.SolarWaterHeater&&!O.locked&&L.has(O.id)&&(O.ly=j)})},b=L=>{l(L.target.value)},R=(L,j)=>{const B=r(L);if(B){if(B.type===z.Cuboid&&!me.isIdentical(L.normal,as))return!0;const O=JSON.parse(JSON.stringify(L));return O.ly=j,B.type===z.Roof?!0:me.isSolarCollectorWithinHorizontalSurface(O,B)}return!1},H=(L,j)=>!R(L,j),F=L=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const j of n)if(j.type===z.SolarWaterHeater&&j.foundationId===(d==null?void 0:d.foundationId)&&!j.locked&&Math.abs(j.ly-L)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&me.isIdentical(O.normal,d.normal)&&!O.locked&&Math.abs(O.ly-L)>Et)return!0}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&Math.abs(O.ly-L)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.ly)-L)>Et)return!0;break}}return!1}},E=L=>{if(d&&F(L))switch(S.current=void 0,a){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&M.getState().selectedElementIdSet.has(j.id)&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&M.getState().selectedElementIdSet.has(O.id)&&j.set(O.id,O.ly);const B={name:"Set Width for Selected Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{x(B.oldValues,B.newValue)}};i(B),x(j,L),c(s+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&j.set(O.id,O.ly);const B={name:"Set Length for All Water Heater",timestamp:Date.now(),oldValues:j,newValue:L,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{w(B.newValue)}};i(B),w(L),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){y.current=!1;for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.foundationId===d.foundationId&&H(j,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const j=new Map;for(const O of n)O.type===z.SolarWaterHeater&&!O.locked&&O.foundationId===d.foundationId&&j.set(O.id,O.ly);const B={name:"Set Width for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:j,newValue:L,groupId:d.foundationId,undo:()=>{for(const[O,V]of B.oldValues.entries())P(O,V)},redo:()=>{B.groupId&&v(B.groupId,B.newValue)}};i(B),v(d.foundationId,L),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const j=r(d);if(j){if(y.current=!1,j.type===z.Cuboid){for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&me.isIdentical(O.normal,d.normal)&&!O.locked&&H(O,L)){y.current=!0;break}}else for(const O of n)if(O.type===z.SolarWaterHeater&&O.parentId===d.parentId&&!O.locked&&H(O,L)){y.current=!0;break}if(y.current)S.current=L,A(d.ly);else{const O=new Map,V=j.type===z.Cuboid;if(V)for(const $ of n)$.type===z.SolarWaterHeater&&$.parentId===d.parentId&&me.isIdentical($.normal,d.normal)&&!$.locked&&O.set($.id,$.ly);else for(const $ of n)$.type===z.SolarWaterHeater&&$.parentId===d.parentId&&!$.locked&&O.set($.id,$.ly);const G=V?d.normal:void 0,q={name:"Set Width for All Water Heater on Surface",timestamp:Date.now(),oldValues:O,newValue:L,groupId:d.parentId,normal:G,undo:()=>{for(const[$,ie]of q.oldValues.entries())P($,ie)},redo:()=>{q.groupId&&T(q.groupId,q.normal,q.newValue)}};i(q),T(d.parentId,G,L),c(s+1)}}break}default:{const j=o(d.id),B=j?j.ly:d.ly;if(y.current=H(d,L),y.current)S.current=L,A(B);else{const O={name:"Set Water Heater Width",timestamp:Date.now(),oldValue:B,newValue:L,changedElementId:d.id,changedElementType:d.type,undo:()=>{P(O.changedElementId,O.oldValue)},redo:()=>{P(O.changedElementId,O.newValue)}};i(O),P(d.id,L),c(s+1)}break}}},N=()=>{y.current=!1,t(!1)},U=()=>{N(),u()},W=()=>{E(g),y.current||(t(!1),c(0))},k=()=>{E(g)},D=y.current?": "+Y.t("message.NotApplicableToSelectedAction",C)+(S.current!==void 0?" ("+S.current.toFixed(2)+")":""):null;return console.log("min",f),h.jsx(so,{width:550,title:Y.t("word.Width",C),rejectedMessage:D,onApply:k,onClose:N,onClickCancel:U,onClickOk:W,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:f,max:100,step:.1,style:{width:120},precision:2,value:g,onChange:L=>{L!==null&&A(L)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",C)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:b,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",C)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",C)})]})})})]})})},Vgo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Qq),i=M(yYe),a=M(AYe),l=M(wYe),s=M(Gr),c=M(En),u=M(Yge),d=M(Oge),f=M(no),p=M(Qn),g=M(Xi),A=uo(z.SolarWaterHeater),y=m.useRef(!1),S=m.useRef(),[C,P]=m.useState(A?-A.relativeAzimuth:0),v=$t(),T=k=>{d(k.target.value)},w=(k,D)=>{const L=s(k);if(L){if(L.type===z.Cuboid&&!me.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.relativeAzimuth=-D,L.type===z.Roof?!0:me.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},x=(k,D)=>!w(k,D),b=k=>{if(A){switch(u){case re.AllSelectedObjectsOfThisType:for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisType:for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeAboveFoundation:for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(A==null?void 0:A.foundationId)&&!D.locked&&Math.abs(-D.relativeAzimuth-k)>Et)return!0;break;case re.AllObjectsOfThisTypeOnSurface:if(A!=null&&A.parentId){const D=s(A);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===A.parentId&&me.isIdentical(j.normal,A.normal)&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===A.parentId&&!j.locked&&Math.abs(-j.relativeAzimuth-k)>Et)return!0}}break;default:if(Math.abs(-(A==null?void 0:A.relativeAzimuth)-k)>Et)return!0}return!1}},R=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)){const B=j;B.relativeAzimuth=D}})},H=k=>{if(A&&b(k)){switch(S.current=void 0,u){case re.AllSelectedObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{R(L.oldValues,L.newValue)}};c(L),R(D,-k),p(f+1)}break}case re.AllObjectsOfThisType:{y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{l(z.SolarWaterHeater,-L.newValue)}};c(L),l(z.SolarWaterHeater,-k),p(f+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(A.foundationId){y.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===A.foundationId&&x(D,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===A.foundationId&&D.set(j.id,-j.relativeAzimuth);const L={name:"Set Relative Azimuth for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:A.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())r(j,-B)},redo:()=>{L.groupId&&a(z.SolarWaterHeater,L.groupId,-L.newValue)}};c(L),a(z.SolarWaterHeater,A.foundationId,-k),p(f+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{if(A.parentId){const D=s(A);if(D){if(y.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===A.parentId&&me.isIdentical(j.normal,A.normal)&&x(j,k)){y.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===A.parentId&&x(j,k)){y.current=!0;break}if(y.current)S.current=k,P(-A.relativeAzimuth);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===A.parentId&&me.isIdentical(G.normal,A.normal)&&j.set(G.id,-G.relativeAzimuth);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===A.parentId&&j.set(G.id,-G.relativeAzimuth);const O=B?A.normal:void 0,V={name:"Set Relative Azimuth for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:A.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())r(G,-q)},redo:()=>{V.groupId&&i(z.SolarWaterHeater,V.groupId,V.normal,-V.newValue)}};c(V),i(z.SolarWaterHeater,A.parentId,O,-k),p(f+1)}}}break}default:{const D=o(A.id),L=D?-D.relativeAzimuth:-A.relativeAzimuth;if(y.current=x(A,k),y.current)S.current=k,P(L);else{const j={name:"Set Solar Panel Array Relative Azimuth",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:A.id,changedElementType:A.type,undo:()=>{r(j.changedElementId,-j.oldValue)},redo:()=>{r(j.changedElementId,-j.newValue)}};c(j),r(A.id,-k),p(f+1)}break}}e(D=>{D.actionState.solarWaterHeaterRelativeAzimuth=-k})}},F=()=>{y.current=!1,t(!1)},E=()=>{F(),g()},N=()=>{H(C),y.current||(t(!1),p(0))},U=()=>{H(C)},W=y.current?": "+Y.t("message.NotApplicableToSelectedAction",v)+(S.current!==void 0?" ("+me.toDegrees(S.current).toFixed(1)+"°)":null):null;return h.jsx(so,{width:550,title:Y.t("solarCollectorMenu.RelativeAzimuth",v),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsxs(Ke,{span:6,children:[h.jsx(Sn,{min:-180,max:180,style:{width:120},precision:2,step:1,value:parseFloat(me.toDegrees(C).toFixed(2)),formatter:k=>`${k}°`,onChange:k=>{k!==null&&P(me.toRadians(k))}}),h.jsxs("div",{style:{paddingTop:"20px",textAlign:"left",fontSize:"11px"},children:[Y.t("word.Range",v),": [-180°, 180°]",h.jsx("br",{}),Y.t("message.AzimuthOfNorthIsZero",v),h.jsx("br",{}),Y.t("message.CounterclockwiseAzimuthIsPositive",v)]})]}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:18,children:h.jsx(Le.Group,{onChange:T,value:u,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",v)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",v)})]})})})]})})},_go=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Jn),r=M(Gr),i=M(En),a=M(Yge),l=M(Oge),s=M(no),c=M(Qn),u=M(Xi),d=uo(z.SolarWaterHeater),[f,p]=m.useState((d==null?void 0:d.lz)??1),g=m.useRef(!1),A=m.useRef(),y=$t(),S=(k,D)=>{e(L=>{for(const j of L.elements)if(j.type===z.SolarWaterHeater&&j.id===k&&!j.locked){j.lz=D;break}})},C=(k,D)=>{e(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&j.foundationId===k&&!j.locked&&(j.lz=D)})},P=(k,D,L)=>{e(j=>{for(const B of j.elements)if(B.type===z.SolarWaterHeater&&!B.locked){let O;D?O=B.parentId===k&&me.isIdentical(B.normal,D):O=B.parentId===k,O&&(B.lz=L)}})},v=k=>{e(D=>{for(const L of D.elements)L.type===z.SolarWaterHeater&&!L.locked&&(L.lz=k)})},T=(k,D)=>{M.getState().set(L=>{for(const j of L.elements)j.type===z.SolarWaterHeater&&!j.locked&&k.has(j.id)&&(j.lz=D)})},w=k=>{l(k.target.value)},x=(k,D)=>{const L=r(k);if(L){if(L.type===z.Cuboid&&!me.isIdentical(k.normal,as))return!0;const j=JSON.parse(JSON.stringify(k));return j.lz=D,L.type===z.Roof?!0:me.isSolarCollectorWithinHorizontalSurface(j,L)}return!1},b=(k,D)=>!x(k,D),R=k=>{if(d){switch(a){case re.AllSelectedObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisType:{for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const D of n)if(D.type===z.SolarWaterHeater&&D.foundationId===(d==null?void 0:d.foundationId)&&!D.locked&&Math.abs(D.lz-k)>Et)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&me.isIdentical(j.normal,d.normal)&&!j.locked&&Math.abs(j.lz-k)>Et)return!0}else for(const j of n)if(j.type===z.SolarWaterHeater&&j.parentId===d.parentId&&!j.locked&&Math.abs(j.lz-k)>Et)return!0}break}default:{if(Math.abs((d==null?void 0:d.lz)-k)>Et)return!0;break}}return!1}},H=k=>{if(d&&R(k)){switch(A.current=void 0,a){case re.AllSelectedObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&M.getState().selectedElementIdSet.has(D.id)&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(j.id)&&D.set(j.id,j.lz);const L={name:"Set Height for Selected Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{T(L.oldValues,L.newValue)}};i(L),T(D,k),c(s+1)}break}case re.AllObjectsOfThisType:{g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&D.set(j.id,j.lz);const L={name:"Set Height for All Water Heater",timestamp:Date.now(),oldValues:D,newValue:k,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{v(L.newValue)}};i(L),v(k),c(s+1)}break}case re.AllObjectsOfThisTypeAboveFoundation:{if(d.foundationId){g.current=!1;for(const D of n)if(D.type===z.SolarWaterHeater&&!D.locked&&D.foundationId===d.foundationId&&b(D,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const D=new Map;for(const j of n)j.type===z.SolarWaterHeater&&j.foundationId===d.foundationId&&D.set(j.id,j.lz);const L={name:"Set Height for All Water Heater Above Foundation",timestamp:Date.now(),oldValues:D,newValue:k,groupId:d.foundationId,undo:()=>{for(const[j,B]of L.oldValues.entries())S(j,B)},redo:()=>{L.groupId&&C(L.groupId,L.newValue)}};i(L),C(d.foundationId,k),c(s+1)}}break}case re.AllObjectsOfThisTypeOnSurface:{const D=r(d);if(D){if(g.current=!1,D.type===z.Cuboid){for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&me.isIdentical(j.normal,d.normal)&&b(j,k)){g.current=!0;break}}else for(const j of n)if(j.type===z.SolarWaterHeater&&!j.locked&&j.parentId===d.parentId&&b(j,k)){g.current=!0;break}if(g.current)A.current=k,p(d.lz);else{const j=new Map,B=D.type===z.Cuboid;if(B)for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&me.isIdentical(G.normal,d.normal)&&j.set(G.id,G.lz);else for(const G of n)G.type===z.SolarWaterHeater&&G.parentId===d.parentId&&j.set(G.id,G.lz);const O=B?d.normal:void 0,V={name:"Set Height for All Water Heater on Surface",timestamp:Date.now(),oldValues:j,newValue:k,groupId:d.parentId,normal:O,undo:()=>{for(const[G,q]of V.oldValues.entries())S(G,q)},redo:()=>{V.groupId&&P(V.groupId,V.normal,V.newValue)}};i(V),P(d.parentId,O,k),c(s+1)}}break}default:{const D=o(d.id),L=D?D.lz:d.lz;if(g.current=b(d,k),g.current)A.current=k,p(L);else{const j={name:"Set Water Heater Height",timestamp:Date.now(),oldValue:L,newValue:k,changedElementId:d.id,changedElementType:d.type,undo:()=>{S(j.changedElementId,j.oldValue)},redo:()=>{S(j.changedElementId,j.newValue)}};i(j),S(d.id,k),c(s+1)}break}}e(D=>{D.actionState.solarWaterHeaterHeight=k})}},F=()=>{g.current=!1,t(!1)},E=()=>{F(),u()},N=()=>{H(f),g.current||(t(!1),c(0))},U=()=>{H(f)},W=g.current?": "+Y.t("message.NotApplicableToSelectedAction",y)+(A.current!==void 0?" ("+A.current.toFixed(2)+")":""):null;return h.jsx(so,{width:550,title:Y.t("word.Height",y),rejectedMessage:W,onApply:U,onClose:F,onClickCancel:E,onClickOk:N,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:.6,max:10,step:.1,style:{width:120},precision:2,value:f,onChange:k=>{k!==null&&p(k)}})}),h.jsx(Ke,{span:1,style:{verticalAlign:"middle",paddingTop:"6px"},children:Y.t("word.MeterAbbreviation",y)}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:17,children:h.jsx(Le.Group,{onChange:w,value:a,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",y)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",y)})]})})})]})})},Ggo=({setDialogVisible:t})=>{const e=M(pn),n=M(Kn),o=M(Gr),r=M(En),i=M(xh),a=M(bh),l=M(no),s=M(Qn),c=uo(z.SolarWaterHeater),[u,d]=m.useState((c==null?void 0:c.color)??"grey"),f=$t(),p=(x,b)=>{e(R=>{for(const H of R.elements)if(H.type===z.SolarWaterHeater&&H.id===x&&!H.locked){H.color=b;break}})},g=(x,b)=>{e(R=>{for(const H of R.elements)H.type===z.SolarWaterHeater&&H.foundationId===x&&!H.locked&&(H.color=b)})},A=(x,b,R)=>{e(H=>{for(const F of H.elements)if(F.type===z.SolarWaterHeater&&!F.locked){let E;b?E=F.parentId===x&&me.isIdentical(F.normal,b):E=F.parentId===x,E&&(F.color=R)}})},y=x=>{e(b=>{for(const R of b.elements)R.type===z.SolarWaterHeater&&!R.locked&&(R.color=x)})},S=(x,b)=>{M.getState().set(R=>{for(const H of R.elements)H.type===z.SolarWaterHeater&&!H.locked&&x.has(H.id)&&(H.color=b)})},C=x=>{a(x.target.value)},P=x=>{if(c){switch(i){case re.AllSelectedObjectsOfThisType:{for(const b of n)if(b.type===z.SolarWaterHeater&&!b.locked&&M.getState().selectedElementIdSet.has(b.id)&&b.color!==x)return!0;break}case re.AllObjectsOfThisType:{for(const b of n)if(b.type===z.SolarWaterHeater&&!b.locked&&b.color!==x)return!0;break}case re.AllObjectsOfThisTypeAboveFoundation:{for(const b of n)if(b.type===z.SolarWaterHeater&&b.foundationId===(c==null?void 0:c.foundationId)&&!b.locked&&b.color!==x)return!0;break}case re.AllObjectsOfThisTypeOnSurface:{const b=o(c);if(b){if(b.type===z.Cuboid){for(const H of n)if(H.type===z.SolarWaterHeater&&H.parentId===c.parentId&&me.isIdentical(H.normal,c.normal)&&!H.locked&&H.color!==x)return!0}else for(const H of n)if(H.type===z.SolarWaterHeater&&H.parentId===c.parentId&&!H.locked&&H.color!==x)return!0}break}default:{if((c==null?void 0:c.color)!==x)return!0;break}}return!1}},v=x=>{if(c&&P(x)){switch(i){case re.AllSelectedObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&M.getState().selectedElementIdSet.has(H.id)&&!H.locked&&b.set(H.id,H.color??"grey");const R={name:"Set Color for Selected Solar Water Heaters",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{S(R.oldValues,R.newValue)}};r(R),S(b,x),s(l+1);break}case re.AllObjectsOfThisType:{const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&!H.locked&&b.set(H.id,H.color??"grey");const R={name:"Set Color for All Solar Water Heaters",timestamp:Date.now(),oldValues:b,newValue:x,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{y(R.newValue)}};r(R),y(x),s(l+1);break}case re.AllObjectsOfThisTypeAboveFoundation:{if(c.foundationId){const b=new Map;for(const H of n)H.type===z.SolarWaterHeater&&!H.locked&&H.foundationId===c.foundationId&&b.set(H.id,H.color??"grey");const R={name:"Set Color for All Water Heaters Above Foundation",timestamp:Date.now(),oldValues:b,newValue:x,groupId:c.foundationId,undo:()=>{for(const[H,F]of R.oldValues.entries())p(H,F)},redo:()=>{R.groupId&&g(R.groupId,R.newValue)}};r(R),g(c.foundationId,x),s(l+1)}break}case re.AllObjectsOfThisTypeOnSurface:{const b=o(c);if(b){const R=new Map,H=b.type===z.Cuboid;if(H)for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&me.isIdentical(N.normal,c.normal)&&R.set(N.id,N.color??"grey");else for(const N of n)N.type===z.SolarWaterHeater&&!N.locked&&N.parentId===c.parentId&&R.set(N.id,N.color??"grey");const F=H?c.normal:void 0,E={name:"Set Color for All Water Heaters on Surface",timestamp:Date.now(),oldValues:R,newValue:x,groupId:c.parentId,normal:F,undo:()=>{for(const[N,U]of E.oldValues.entries())p(N,U)},redo:()=>{E.groupId&&A(E.groupId,E.normal,E.newValue)}};r(E),A(c.parentId,F,x),s(l+1)}break}default:{const b=c?c.color:"grey",R={name:"Set Color of Selected Water Heater",timestamp:Date.now(),oldValue:b,newValue:x,changedElementId:c.id,changedElementType:c.type,undo:()=>{p(c.id,R.oldValue)},redo:()=>{p(c.id,R.newValue)}};r(R),p(c.id,x),s(l+1);break}}e(b=>{b.actionState.solarWaterHeaterColor=x})}},T=()=>{t(!1)},w=()=>{v(u)};return h.jsx(so,{width:680,title:Y.t("word.Color",f),onApply:w,onClose:T,children:h.jsxs(nn,{gutter:6,children:[h.jsx(Ke,{span:10,children:h.jsx(Ld,{color:u??(c==null?void 0:c.color)??"grey",onChangeComplete:x=>{d(x.hex)}})}),h.jsx(Ke,{style:{border:"2px dashed #ccc",paddingTop:"8px",paddingLeft:"12px",paddingBottom:"8px"},span:14,children:h.jsx(Le.Group,{onChange:C,value:i,children:h.jsxs(on,{direction:"vertical",children:[h.jsx(Le,{style:{width:"100%"},value:re.OnlyThisObject,children:Y.t("solarWaterHeaterMenu.OnlyThisSolarWaterHeater",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeOnSurface,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersOnSurface",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisTypeAboveFoundation,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeatersAboveFoundation",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllSelectedObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSelectedSolarWaterHeaters",f)}),h.jsx(Le,{style:{width:"100%"},value:re.AllObjectsOfThisType,children:Y.t("solarWaterHeaterMenu.AllSolarWaterHeaters",f)})]})})})]})})},Xgo=t=>{const e=[];if(t.type!==z.SolarWaterHeater)return{items:e};const n=t,o=!n.locked,r={lng:M.getState().language},i=t.type===z.SolarWaterHeater&&me.isIdentical(n.normal,as);return e.push({key:"water-heater-copy",label:h.jsx(Fd,{})}),o&&e.push({key:"water-heater-cut",label:h.jsx(kd,{})}),e.push({key:"water-heater-lock",label:h.jsx(Ku,{selectedElement:n})}),o&&(e.push({key:"water-heater-length",label:h.jsxs(eo,{Dialog:Ygo,children:[Y.t("word.Length",r)," ..."]})},{key:"water-heater-width",label:h.jsxs(eo,{Dialog:Ogo,children:[Y.t("word.Width",r)," ..."]})},{key:"water-heater-height",label:h.jsxs(eo,{Dialog:_go,children:[Y.t("word.Height",r)," ..."]})}),i&&e.push({key:"water-heater-relative-azimuth",label:h.jsxs(eo,{Dialog:Vgo,children:[Y.t("solarCollectorMenu.RelativeAzimuth",r)," ..."]})}),e.push({key:"water-heater-frame-color",label:h.jsxs(eo,{Dialog:Ggo,children:[Y.t("word.Color",r)," ..."]})}),e.push({key:"solar-water-heater-label",label:h.jsx(an,{children:Y.t("labelSubMenu.Label",r)}),children:v3(n)})),{items:e}},Jgo=()=>{const t=M(S7t),e=uo(),n=m.useRef(t),o=m.useRef(e);return t!==null?(n.current=t,o.current=e):setTimeout(()=>{n.current=t,o.current=t===null?void 0:e},200),[n.current,o.current]},Kgo=({children:t})=>{dt(r=>r.contextMenuFlag);const[e,n]=Jgo(),o=()=>{if(!n)return e===z.Ground?$fo():e===z.Sky?opo():{items:[]};switch(e){case z.Foundation:return mfo(n);case z.Cuboid:return jfo(n);case z.Wall:return P1o(n);case z.Roof:return Igo(n);case z.SolarPanel:return ypo(n);case z.Window:return ego(n);case z.Door:return W1o(n);case z.Sensor:return Bho(n);case z.Light:return Gho(n);case z.Human:return sho(n);case z.Tree:return o1o(n);case z.Flower:return uho(n);case z.ParabolicTrough:return Rpo(n);case z.ParabolicDish:return Wpo(n);case z.FresnelReflector:return Gpo(n);case z.Heliostat:return t1o(n);case z.Polygon:return Fho(n);case z.PolygonVertex:return Nho(n);case z.WindTurbine:return Bgo(n);case z.SolarWaterHeater:return Xgo(n);default:return{items:[]}}};return h.jsx(rA,{trigger:["contextMenu"],menu:o(),overlayClassName:"my-overlay",children:t})},qgo=be.memo(Kgo);(function(){var t,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,_,ce){I!=Array.prototype&&I!=Object.prototype&&(I[_]=ce.value)};function n(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof global=="object"&&global,I];for(var _=0;_>>0),P=0;function v(I,_,ce){return I.call.apply(I.bind,arguments)}function T(I,_,ce){if(!I)throw Error();if(2I.b&&(I.b++,_.next=I.a,I.a=_)}function G(){this.b=this.a=null}var q=new O(function(){return new ie},function(I){I.reset()});G.prototype.add=function(I,_){var ce=q.get();ce.set(I,_),this.b?this.b.next=ce:this.a=ce,this.b=ce};function $(){var I=So,_=null;return I.a&&(_=I.a,I.a=I.a.next,I.a||(I.b=null),_.next=null),_}function ie(){this.next=this.b=this.a=null}ie.prototype.set=function(I,_){this.a=I,this.b=_,this.next=null},ie.prototype.reset=function(){this.next=this.b=this.a=null};var Q=Array.prototype.indexOf?function(I,_){return Array.prototype.indexOf.call(I,_,void 0)}:function(I,_){if(typeof I=="string")return typeof _!="string"||_.length!=1?-1:I.indexOf(_,0);for(var ce=0;ce_?null:typeof I=="string"?I.charAt(_):I[_]}function fe(I,_){return 0<=Q(I,_)}function pe(I,_){_=Q(I,_);var ce;return(ce=0<=_)&&Array.prototype.splice.call(I,_,1),ce}function ye(I,_){var ce=0;oe(I,function(Ce,_e){_.call(void 0,Ce,_e,I)&&Array.prototype.splice.call(I,_e,1).length==1&&ce++})}function ae(I){return Array.prototype.concat.apply([],arguments)}function Te(I){var _=I.length;if(0<_){for(var ce=Array(_),Ce=0;Ce<_;Ce++)ce[Ce]=I[Ce];return ce}return[]}var ge=String.prototype.trim?function(I){return I.trim()}:function(I){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(I)[1]},Se=/&/g,Re=//g,Ae=/"/g,ue=/'/g,he=/\x00/g,ve=/[\x00&<>"']/;function we(I,_){return I.indexOf(_)!=-1}function Pe(I,_){return I<_?-1:I>_?1:0}var Ie;e:{var Me=s.navigator;if(Me){var ze=Me.userAgent;if(ze){Ie=ze;break e}}Ie=""}function Ne(I){return we(Ie,I)}function Je(I,_){for(var ce in I)_.call(void 0,I[ce],ce,I)}function Ue(I){for(var _ in I)return!1;return!0}function nt(I){var _={},ce;for(ce in I)_[ce]=I[ce];return _}var We="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(I,_){for(var ce,Ce,_e=1;_e"}else St=I===void 0?"undefined":I===null?"null":typeof I;B("Argument is not a %s (or a non-Element, non-Location mock); got: %s",_,St)}}function Oe(I,_){this.a=I===xt&&_||"",this.b=je}Oe.prototype.ta=!0,Oe.prototype.sa=function(){return this.a},Oe.prototype.toString=function(){return"Const{"+this.a+"}"};function st(I){return I instanceof Oe&&I.constructor===Oe&&I.b===je?I.a:(B("expected object of type Const, got '"+I+"'"),"type_error:Const")}var je={},xt={},gt;function Ye(){if(gt===void 0){var I=null,_=s.trustedTypes;if(_&&_.createPolicy){try{I=_.createPolicy("goog#html",{createHTML:R,createScript:R,createScriptURL:R})}catch(ce){s.console&&s.console.error(ce.message)}gt=I}else gt=I}return gt}function it(I,_){this.a=_===Be?I:""}it.prototype.ta=!0,it.prototype.sa=function(){return this.a.toString()},it.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};function ut(I){return I instanceof it&&I.constructor===it?I.a:(B("expected object of type TrustedResourceUrl, got '"+I+"' of type "+p(I)),"type_error:TrustedResourceUrl")}function Qe(I,_){var ce=st(I);if(!Ze.test(ce))throw Error("Invalid TrustedResourceUrl format: "+ce);return I=ce.replace(lt,function(Ce,_e){if(!Object.prototype.hasOwnProperty.call(_,_e))throw Error('Found marker, "'+_e+'", in format string, "'+ce+'", but no valid label mapping found in args: '+JSON.stringify(_));return Ce=_[_e],Ce instanceof Oe?st(Ce):encodeURIComponent(String(Ce))}),$e(I)}var lt=/%{(\w+)}/g,Ze=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Be={};function $e(I){var _=Ye();return I=_?_.createScriptURL(I):I,new it(I,Be)}function wt(I,_){this.a=_===ht?I:""}wt.prototype.ta=!0,wt.prototype.sa=function(){return this.a.toString()},wt.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};function vt(I){return I instanceof wt&&I.constructor===wt?I.a:(B("expected object of type SafeUrl, got '"+I+"' of type "+p(I)),"type_error:SafeUrl")}var Rt=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,Gt=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,At=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function pt(I){if(I instanceof wt)return I;if(I=typeof I=="object"&&I.ta?I.sa():String(I),At.test(I))I=new wt(I,ht);else{I=String(I),I=I.replace(/(%0A|%0D)/g,"");var _=I.match(Gt);I=_&&Rt.test(_[1])?new wt(I,ht):null}return I}function Wt(I){return I instanceof wt?I:(I=typeof I=="object"&&I.ta?I.sa():String(I),At.test(I)||(I="about:invalid#zClosurez"),new wt(I,ht))}var ht={},ct=new wt("about:invalid#zClosurez",ht);function It(I,_,ce){this.a=ce===Ve?I:""}It.prototype.ta=!0,It.prototype.sa=function(){return this.a.toString()},It.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};function Ft(I){return I instanceof It&&I.constructor===It?I.a:(B("expected object of type SafeHtml, got '"+I+"' of type "+p(I)),"type_error:SafeHtml")}var Ve={};function ft(I,_){ke(I,"HTMLScriptElement"),I.src=ut(_),(_=I.ownerDocument&&I.ownerDocument.defaultView)&&_!=s?_=d(_.document):(u===null&&(u=d(s.document)),_=u),_&&I.setAttribute("nonce",_)}function kt(I,_,ce,Ce){return I=I instanceof wt?I:Wt(I),_=_||s,ce=ce instanceof Oe?st(ce):ce||"",_.open(vt(I),ce,Ce,void 0)}function rt(I,_){for(var ce=I.split("%s"),Ce="",_e=Array.prototype.slice.call(arguments,1);_e.length&&1")!=-1&&(I=I.replace(De,">")),I.indexOf('"')!=-1&&(I=I.replace(Ae,""")),I.indexOf("'")!=-1&&(I=I.replace(ue,"'")),I.indexOf("\0")!=-1&&(I=I.replace(he,"�"))),I}function Ge(I){return Ge[" "](I),I}Ge[" "]=f;function yt(I,_){var ce=yo;return Object.prototype.hasOwnProperty.call(ce,I)?ce[I]:ce[I]=_(I)}var Pt=Ne("Opera"),ot=Ne("Trident")||Ne("MSIE"),bt=Ne("Edge"),zt=bt||ot,Bt=Ne("Gecko")&&!(we(Ie.toLowerCase(),"webkit")&&!Ne("Edge"))&&!(Ne("Trident")||Ne("MSIE"))&&!Ne("Edge"),tt=we(Ie.toLowerCase(),"webkit")&&!Ne("Edge");function Ht(){var I=s.document;return I?I.documentMode:void 0}var _t;e:{var qt="",un=function(){var I=Ie;if(Bt)return/rv:([^\);]+)(\)|;)/.exec(I);if(bt)return/Edge\/([\d\.]+)/.exec(I);if(ot)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(I);if(tt)return/WebKit\/(\S+)/.exec(I);if(Pt)return/(?:Version)[ \/]?(\S+)/.exec(I)}();if(un&&(qt=un?un[1]:""),ot){var Rn=Ht();if(Rn!=null&&Rn>parseFloat(qt)){_t=String(Rn);break e}}_t=qt}var yo={};function Ao(I){return yt(I,function(){for(var _=0,ce=ge(String(_t)).split("."),Ce=ge(String(I)).split("."),_e=Math.max(ce.length,Ce.length),St=0;_==0&&St<_e;St++){var Lt=ce[St]||"",dn=Ce[St]||"";do{if(Lt=/(\d*)(\D*)(.*)/.exec(Lt)||["","","",""],dn=/(\d*)(\D*)(.*)/.exec(dn)||["","","",""],Lt[0].length==0&&dn[0].length==0)break;_=Pe(Lt[1].length==0?0:parseInt(Lt[1],10),dn[1].length==0?0:parseInt(dn[1],10))||Pe(Lt[2].length==0,dn[2].length==0)||Pe(Lt[2],dn[2]),Lt=Lt[3],dn=dn[3]}while(_==0)}return 0<=_})}var wo;if(s.document&&ot){var Io=Ht();wo=Io||parseInt(_t,10)||void 0}else wo=void 0;var po=wo;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch{}var On=!ot||9<=Number(po);function fo(I){var _=document;return typeof I=="string"?_.getElementById(I):I}function ir(I,_){Je(_,function(ce,Ce){ce&&typeof ce=="object"&&ce.ta&&(ce=ce.sa()),Ce=="style"?I.style.cssText=ce:Ce=="class"?I.className=ce:Ce=="for"?I.htmlFor=ce:Rr.hasOwnProperty(Ce)?I.setAttribute(Rr[Ce],ce):Ce.lastIndexOf("aria-",0)==0||Ce.lastIndexOf("data-",0)==0?I.setAttribute(Ce,ce):I[Ce]=ce})}var Rr={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function br(I,_,ce){var Ce=arguments,_e=document,St=String(Ce[0]),Lt=Ce[1];if(!On&&Lt&&(Lt.name||Lt.type)){if(St=["<",St],Lt.name&&St.push(' name="',at(Lt.name),'"'),Lt.type){St.push(' type="',at(Lt.type),'"');var dn={};Ee(dn,Lt),delete dn.type,Lt=dn}St.push(">"),St=St.join("")}return St=jo(_e,St),Lt&&(typeof Lt=="string"?St.className=Lt:Array.isArray(Lt)?St.className=Lt.join(" "):ir(St,Lt)),2"u"&&typeof window<"u"&&window.postMessage&&window.addEventListener&&!Ne("Presto")&&(I=function(){var _e=jo(document,"IFRAME");_e.style.display="none",document.documentElement.appendChild(_e);var St=_e.contentWindow;_e=St.document,_e.open(),_e.close();var Lt="callImmediate"+Math.random(),dn=St.location.protocol=="file:"?"*":St.location.protocol+"//"+St.location.host;_e=w(function(lo){(dn=="*"||lo.origin==dn)&&lo.data==Lt&&this.port1.onmessage()},this),St.addEventListener("message",_e,!1),this.port1={},this.port2={postMessage:function(){St.postMessage(Lt,dn)}}}),typeof I<"u"&&!Ne("Trident")&&!Ne("MSIE")){var _=new I,ce={},Ce=ce;return _.port1.onmessage=function(){if(ce.next!==void 0){ce=ce.next;var _e=ce.Hb;ce.Hb=null,_e()}},function(_e){Ce.next={Hb:_e},Ce=Ce.next,_.port2.postMessage(0)}}return function(_e){s.setTimeout(_e,0)}}function Wo(I,_){to||Bn(),Ko||(to(),Ko=!0),So.add(I,_)}var to;function Bn(){if(s.Promise&&s.Promise.resolve){var I=s.Promise.resolve(void 0);to=function(){I.then(Qo)}}else to=function(){var _=Qo;!A(s.setImmediate)||s.Window&&s.Window.prototype&&!Ne("Edge")&&s.Window.prototype.setImmediate==s.setImmediate?(In||(In=ar()),In(_)):s.setImmediate(_)}}var Ko=!1,So=new G;function Qo(){for(var I;I=$();){try{I.a.call(I.b)}catch(_){wn(_)}V(q,I)}Ko=!1}function Yo(I,_){if(this.a=lr,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,I!=f)try{var ce=this;I.call(_,function(Ce){Fs(ce,fr,Ce)},function(Ce){if(!(Ce instanceof mu))try{throw Ce instanceof Error?Ce:Error("Promise rejected.")}catch{}Fs(ce,ei,Ce)})}catch(Ce){Fs(this,ei,Ce)}}var lr=0,fr=2,ei=3;function hr(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}hr.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var tr=new O(function(){return new hr},function(I){I.reset()});function bi(I,_,ce){var Ce=tr.get();return Ce.g=I,Ce.b=_,Ce.f=ce,Ce}function Fo(I){if(I instanceof Yo)return I;var _=new Yo(f);return Fs(_,fr,I),_}function Si(I){return new Yo(function(_,ce){ce(I)})}function hl(I,_,ce){ks(I,_,ce,null)||Wo(x(_,I))}function nr(I){return new Yo(function(_,ce){var Ce=I.length,_e=[];if(Ce)for(var St=function(Mo,Mi){Ce--,_e[Mo]=Mi,Ce==0&&_(_e)},Lt=function(Mo){ce(Mo)},dn=0,lo;dn=I.keyCode)&&(I.keyCode=-1)}catch{}},Tt.prototype.g=function(){return this.a};var Zt="closure_listenable_"+(1e6*Math.random()|0),cn=0;function yn(I,_,ce,Ce,_e){this.listener=I,this.proxy=null,this.src=_,this.type=ce,this.capture=!!Ce,this.Wa=_e,this.key=++cn,this.wa=this.Qa=!1}function An(I){I.wa=!0,I.listener=null,I.proxy=null,I.src=null,I.Wa=null}function Tn(I){this.src=I,this.a={},this.b=0}Tn.prototype.add=function(I,_,ce,Ce,_e){var St=I.toString();I=this.a[St],I||(I=this.a[St]=[],this.b++);var Lt=Yn(I,_,Ce,_e);return-1Ce.keyCode||Ce.returnValue!=null)){e:{var _e=!1;if(Ce.keyCode==0)try{Ce.keyCode=-1;break e}catch{_e=!0}(_e||Ce.returnValue==null)&&(Ce.returnValue=!0)}for(Ce=[],_e=_.b;_e;_e=_e.parentNode)Ce.push(_e);for(I=I.type,_e=Ce.length-1;0<=_e;_e--){_.b=Ce[_e];var St=Qu(Ce[_e],I,!0,_);ce=ce&&St}for(_e=0;_e>>0);function Df(I){return A(I)?I:(I[ed]||(I[ed]=function(_){return I.handleEvent(_)}),I[ed])}function Kl(){fn.call(this),this.v=new Tn(this),this.bc=this,this.hb=null}b(Kl,fn),Kl.prototype[Zt]=!0,Kl.prototype.addEventListener=function(I,_,ce,Ce){qn(this,I,_,ce,Ce)},Kl.prototype.removeEventListener=function(I,_,ce,Ce){Or(this,I,_,ce,Ce)},Kl.prototype.dispatchEvent=function(I){var _,ce=this.hb;if(ce)for(_=[];ce;ce=ce.hb)_.push(ce);ce=this.bc;var Ce=I.type||I;if(typeof I=="string")I=new Nt(I,ce);else if(I instanceof Nt)I.target=I.target||ce;else{var _e=I;I=new Nt(Ce,ce),Ee(I,_e)}if(_e=!0,_)for(var St=_.length-1;0<=St;St--){var Lt=I.b=_[St];_e=bp(Lt,Ce,!0,I)&&_e}if(Lt=I.b=ce,_e=bp(Lt,Ce,!0,I)&&_e,_e=bp(Lt,Ce,!1,I)&&_e,_)for(St=0;St<_.length;St++)Lt=I.b=_[St],_e=bp(Lt,Ce,!1,I)&&_e;return _e},Kl.prototype.Da=function(){if(Kl.bb.Da.call(this),this.v){var I=this.v,_;for(_ in I.a){for(var ce=I.a[_],Ce=0;Ce_)throw Error("Bad port number "+_);I.g=_}else I.g=null}function Og(I,_,ce){_ instanceof Vg?(I.b=_,i7(I.b,I.i)):(ce||(_=zh(_,Dh)),I.b=new Vg(_,I.i))}function ol(I,_,ce){I.b.set(_,ce)}function Ud(I,_){return I.b.get(_)}function wu(I){return I instanceof Ls?new Ls(I):new Ls(I,void 0)}function p5(I,_,ce,Ce){var _e=new Ls(null,void 0);return I&&ec(_e,I),_&&(_e.a=_),ce&&xl(_e,ce),Ce&&(_e.f=Ce),_e}function wy(I,_){return I?_?decodeURI(I.replace(/%25/g,"%2525")):decodeURIComponent(I):""}function zh(I,_,ce){return typeof I=="string"?(I=encodeURI(I).replace(_,P3),ce&&(I=I.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),I):null}function P3(I){return I=I.charCodeAt(0),"%"+(I>>4&15).toString(16)+(I&15).toString(16)}var vy=/[#\/\?@]/g,C3=/[#\?:]/g,g5=/[#\?]/g,Dh=/[#\?@]/g,R3=/#/g;function Vg(I,_){this.b=this.a=null,this.c=I||null,this.f=!!_}function jd(I){I.a||(I.a=new V0,I.b=0,I.c&&Au(I.c,function(_,ce){I.add(decodeURIComponent(_.replace(/\+/g," ")),ce)}))}function r7(I){var _=g1(I);if(typeof _>"u")throw Error("Keys are undefined");var ce=new Vg(null,void 0);I=yu(I);for(var Ce=0;Ce<_.length;Ce++){var _e=_[Ce],St=I[Ce];Array.isArray(St)?xy(ce,_e,St):ce.add(_e,St)}return ce}t=Vg.prototype,t.add=function(I,_){jd(this),this.c=null,I=vu(this,I);var ce=this.a.get(I);return ce||this.a.set(I,ce=[]),ce.push(_),this.b+=1,this};function Gc(I,_){jd(I),_=vu(I,_),Yg(I.a.b,_)&&(I.c=null,I.b-=I.a.get(_).length,I=I.a,Yg(I.b,_)&&(delete I.b[_],I.c--,I.a.length>2*I.c&&Ih(I)))}t.clear=function(){this.a=this.c=null,this.b=0};function ys(I,_){return jd(I),_=vu(I,_),Yg(I.a.b,_)}t.forEach=function(I,_){jd(this),this.a.forEach(function(ce,Ce){se(ce,function(_e){I.call(_,_e,Ce,this)},this)},this)},t.Y=function(){jd(this);for(var I=this.a.X(),_=this.a.Y(),ce=[],Ce=0;Ce<_.length;Ce++)for(var _e=I[Ce],St=0;St<_e.length;St++)ce.push(_[Ce]);return ce},t.X=function(I){jd(this);var _=[];if(typeof I=="string")ys(this,I)&&(_=ae(_,this.a.get(vu(this,I))));else{I=this.a.X();for(var ce=0;ceI?!1:!ot||!po||9',I=(Ce=Ye())?Ce.createHTML(I):I,I=new It(I,null,Ve),Ce=Lt.document)&&(Ce.write(Ft(I)),Ce.close())):(Lt=kt(_,Ce,ce,Lt))&&I.noopener&&(Lt.opener=null),Lt)try{Lt.focus()}catch{}return Lt}function _g(I){return new Yo(function(_){function ce(){_c(2e3).then(function(){if(!I||I.closed)_();else return ce()})}return ce()})}var H3=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,m5=/^[^@]+@[^@]+$/;function Ws(){var I=null;return new Yo(function(_){s.document.readyState=="complete"?_():(I=function(){_()},Qi(window,"load",I))}).o(function(_){throw Or(window,"load",I),_})}function y5(){return ja(void 0)?Ws().then(function(){return new Yo(function(I,_){var ce=s.document,Ce=setTimeout(function(){_(Error("Cordova framework is not ready."))},1e3);ce.addEventListener("deviceready",function(){clearTimeout(Ce),I()},!1)})}):Si(Error("Cordova must run in an Android or iOS file scheme."))}function ja(I){return I=I||tc(),!(Bd()!=="file:"&&Bd()!=="ionic:"||!I.toLowerCase().match(/iphone|ipad|ipod|android/))}function M3(){var I=s.window;try{return!(!I||I==I.top)}catch{return!1}}function Rc(){return typeof s.WorkerGlobalScope<"u"&&typeof s.importScripts=="function"}function Ns(){return $n.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":$n.INTERNAL.hasOwnProperty("node")?"Node":Rc()?"Worker":"Browser"}function Gg(){var I=Ns();return I==="ReactNative"||I==="Node"}function DA(){for(var I=50,_=[];0"u"?null:Sy(I)}function S5(I){var _={},ce;for(ce in I)I.hasOwnProperty(ce)&&I[ce]!==null&&I[ce]!==void 0&&(_[ce]=I[ce]);return _}function Ty(I){if(I!==null)return JSON.parse(I)}function Jg(I){return I||Math.floor(1e9*Math.random()).toString()}function T5(I){return I=I||tc(),!(td(I)=="Safari"||I.toLowerCase().match(/iphone|ipad|ipod/))}function P5(){var I=s.___jsl;if(I&&I.H){for(var _ in I.H)if(I.H[_].r=I.H[_].r||[],I.H[_].L=I.H[_].L||[],I.H[_].r=I.H[_].L.concat(),I.CP)for(var ce=0;ce_)throw Error("Short delay should be less than long delay!");this.a=I,this.c=_,I=tc(),_=Ns(),this.b=Xc(I)||_==="ReactNative"}Ef.prototype.get=function(){var I=s.navigator;return!(I&&typeof I.onLine=="boolean"&&(b5()||Bd()==="chrome-extension:"||typeof I.connection<"u"))||I.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};function EA(){var I=s.document;return I&&typeof I.visibilityState<"u"?I.visibilityState=="visible":!0}function a7(){var I=s.document,_=null;return EA()||!I?Fo():new Yo(function(ce){_=function(){EA()&&(I.removeEventListener("visibilitychange",_,!1),ce())},I.addEventListener("visibilitychange",_,!1)}).o(function(ce){throw I.removeEventListener("visibilitychange",_,!1),ce})}function I3(I){try{var _=new Date(parseInt(I,10));if(!isNaN(_.getTime())&&!/[^0-9]/.test(I))return _.toUTCString()}catch{}return null}function l7(){return!(!ql("fireauth.oauthhelper",s)&&!ql("fireauth.iframe",s))}function Jc(){var I=s.navigator;return I&&I.serviceWorker&&I.serviceWorker.controller||null}function G0(){var I=s.navigator;return I&&I.serviceWorker?Fo().then(function(){return I.serviceWorker.ready}).then(function(_){return _.active||null}).o(function(){return null}):Fo(null)}var s7={};function FA(I){s7[I]||(s7[I]=!0,typeof console<"u"&&typeof console.warn=="function"&&console.warn(I))}var z3;try{var kA={};Object.defineProperty(kA,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(kA,"abcd",{configurable:!0,enumerable:!0,value:2}),z3=kA.abcd==2}catch{z3=!1}function Hr(I,_,ce){z3?Object.defineProperty(I,_,{configurable:!0,enumerable:!0,value:ce}):I[_]=ce}function Kc(I,_){if(_)for(var ce in _)_.hasOwnProperty(ce)&&Hr(I,ce,_[ce])}function Ff(I){var _={};return Kc(_,I),_}function C5(I){var _={},ce;for(ce in I)I.hasOwnProperty(ce)&&(_[ce]=I[ce]);return _}function Py(I,_){if(!_||!_.length)return!0;if(!I)return!1;for(var ce=0;ce<_.length;ce++){var Ce=I[_[ce]];if(Ce==null||Ce==="")return!1}return!0}function y1(I){var _=I;if(typeof I=="object"&&I!=null){_="length"in I?[]:{};for(var ce in I)Hr(_,ce,y1(I[ce]))}return _}function R5(I){var _=I&&(I[NA]?"phone":null);if(_&&I&&I[WA]){Hr(this,"uid",I[WA]),Hr(this,"displayName",I[c7]||null);var ce=null;I[LA]&&(ce=new Date(I[LA]).toUTCString()),Hr(this,"enrollmentTime",ce),Hr(this,"factorId",_)}else throw new H("internal-error","Internal assert: invalid MultiFactorInfo object")}R5.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};function A1(I){try{var _=new rd(I)}catch{_=null}return _}var c7="displayName",LA="enrolledAt",WA="mfaEnrollmentId",NA="phoneInfo";function rd(I){R5.call(this,I),Hr(this,"phoneNumber",I[NA])}b(rd,R5),rd.prototype.w=function(){var I=rd.bb.w.call(this);return I.phoneNumber=this.phoneNumber,I};function D3(I){var _={},ce=I[v1],Ce=I[X0],_e=I[di];if(I=A1(I[E3]),!_e||_e!=w1&&_e!=Ut&&!ce||_e==Ut&&!Ce||_e==Eh&&!I)throw Error("Invalid checkActionCode response!");_e==Ut?(_[xS]=ce||null,_[Us]=ce||null,_[vS]=Ce):(_[xS]=Ce||null,_[Us]=Ce||null,_[vS]=ce||null),_[Yd]=I||null,Hr(this,SS,_e),Hr(this,bS,y1(_))}var Eh="REVERT_SECOND_FACTOR_ADDITION",w1="EMAIL_SIGNIN",Ut="VERIFY_AND_CHANGE_EMAIL",v1="email",E3="mfaInfo",X0="newEmail",di="requestType",vS="email",xS="fromEmail",Yd="multiFactorInfo",Us="previousEmail",bS="data",SS="operation";function UA(I){I=wu(I);var _=Ud(I,u7)||null,ce=Ud(I,d7)||null,Ce=Ud(I,jA)||null;if(Ce=Ce&&CS[Ce]||null,!_||!ce||!Ce)throw new H("argument-error",u7+", "+d7+"and "+jA+" are required in a valid action code URL.");Kc(this,{apiKey:_,operation:Ce,code:ce,continueUrl:Ud(I,Fh)||null,languageCode:Ud(I,TS)||null,tenantId:Ud(I,PS)||null})}var u7="apiKey",d7="oobCode",Fh="continueUrl",TS="languageCode",jA="mode",PS="tenantId",CS={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Eh,signIn:w1,verifyAndChangeEmail:Ut,verifyEmail:"VERIFY_EMAIL"};function F3(I){try{return new UA(I)}catch{return null}}function xu(I){var _=I[OA];if(typeof _>"u")throw new H("missing-continue-uri");if(typeof _!="string"||typeof _=="string"&&!_.length)throw new H("invalid-continue-uri");this.h=_,this.b=this.a=null,this.g=!1;var ce=I[f7];if(ce&&typeof ce=="object"){_=ce[p7];var Ce=ce[x1];if(ce=ce[VA],typeof _=="string"&&_.length){if(this.a=_,typeof Ce<"u"&&typeof Ce!="boolean")throw new H("argument-error",x1+" property must be a boolean when specified.");if(this.g=!!Ce,typeof ce<"u"&&(typeof ce!="string"||typeof ce=="string"&&!ce.length))throw new H("argument-error",VA+" property must be a non empty string when specified.");this.b=ce||null}else{if(typeof _<"u")throw new H("argument-error",p7+" property must be a non empty string when specified.");if(typeof Ce<"u"||typeof ce<"u")throw new H("missing-android-pkg-name")}}else if(typeof ce<"u")throw new H("argument-error",f7+" property must be a non null object when specified.");if(this.f=null,(_=I[h7])&&typeof _=="object"){if(_=_[Hc],typeof _=="string"&&_.length)this.f=_;else if(typeof _<"u")throw new H("argument-error",Hc+" property must be a non empty string when specified.")}else if(typeof _<"u")throw new H("argument-error",h7+" property must be a non null object when specified.");if(_=I[YA],typeof _<"u"&&typeof _!="boolean")throw new H("argument-error",YA+" property must be a boolean when specified.");if(this.c=!!_,I=I[BA],typeof I<"u"&&(typeof I!="string"||typeof I=="string"&&!I.length))throw new H("argument-error",BA+" property must be a non empty string when specified.");this.i=I||null}var f7="android",BA="dynamicLinkDomain",YA="handleCodeInApp",h7="iOS",OA="url",x1="installApp",VA="minimumVersion",p7="packageName",Hc="bundleId";function _A(I){var _={};_.continueUrl=I.h,_.canHandleCodeInApp=I.c,(_.androidPackageName=I.a)&&(_.androidMinimumVersion=I.b,_.androidInstallApp=I.g),_.iOSBundleId=I.f,_.dynamicLinkDomain=I.i;for(var ce in _)_[ce]===null&&delete _[ce];return _}function OM(I){return te(I,function(_){return _=_.toString(16),1<_.length?_:"0"+_}).join("")}var Kg=null;function Cy(I){var _=[];return VM(I,function(ce){_.push(ce)}),_}function VM(I,_){function ce(lo){for(;Ce>4),Lt!=64&&(_(St<<4&240|Lt>>2),dn!=64&&_(Lt<<6&192|dn))}}function Ar(){if(!Kg){Kg={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),_=["+/=","+/","-_=","-_.","-_"],ce=0;5>ce;ce++)for(var Ce=I.concat(_[ce].split("")),_e=0;_ethis.a?this.a:I),this.b=_.provider_id||_.firebase&&_.firebase.sign_in_provider||null,this.f=_.firebase&&_.firebase.tenant||null,this.c=!!_.is_anonymous||this.b=="anonymous"}qg.prototype.T=function(){return this.f},qg.prototype.l=function(){return this.c},qg.prototype.toString=function(){return this.h};function H5(I){try{return new qg(I)}catch{return null}}function g7(I){if(!I||(I=I.split("."),I.length!=3))return null;I=I[1];for(var _=(4-I.length%4)%4,ce=0;ce<_;ce++)I+=".";try{var Ce=Cy(I);for(I=[],ce=_=0;__e)I[ce++]=String.fromCharCode(_e);else if(191<_e&&224>_e){var St=Ce[_++];I[ce++]=String.fromCharCode((_e&31)<<6|St&63)}else if(239<_e&&365>_e){St=Ce[_++];var Lt=Ce[_++],dn=Ce[_++],lo=((_e&7)<<18|(St&63)<<12|(Lt&63)<<6|dn&63)-65536;I[ce++]=String.fromCharCode(55296+(lo>>10)),I[ce++]=String.fromCharCode(56320+(lo&1023))}else St=Ce[_++],Lt=Ce[_++],I[ce++]=String.fromCharCode((_e&15)<<12|(St&63)<<6|Lt&63)}return JSON.parse(I.join(""))}catch{}return null}var GA="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),id=["client_id","response_type","scope","redirect_uri","state"],Pp={nd:{Ja:"locale",va:700,ua:600,fa:"facebook.com",Ya:id},pd:{Ja:null,va:500,ua:750,fa:"github.com",Ya:id},qd:{Ja:"hl",va:515,ua:680,fa:"google.com",Ya:id},wd:{Ja:"lang",va:485,ua:705,fa:"twitter.com",Ya:GA},kd:{Ja:"locale",va:640,ua:600,fa:"apple.com",Ya:[]}};function k3(I){for(var _ in Pp)if(Pp[_].fa==I)return Pp[_];return null}function XA(I){var _={};_["facebook.com"]=ad,_["google.com"]=L3,_["github.com"]=KA,_["twitter.com"]=qA;var ce=I&&I[kh];try{if(ce)return _[ce]?new _[ce](I):new w0(I);if(typeof I[JA]<"u")return new M5(I)}catch{}return null}var JA="idToken",kh="providerId";function M5(I){var _=I[kh];if(!_&&I[JA]){var ce=H5(I[JA]);ce&&ce.b&&(_=ce.b)}if(!_)throw Error("Invalid additional user info!");(_=="anonymous"||_=="custom")&&(_=null),ce=!1,typeof I.isNewUser<"u"?ce=!!I.isNewUser:I.kind==="identitytoolkit#SignupNewUserResponse"&&(ce=!0),Hr(this,"providerId",_),Hr(this,"isNewUser",ce)}function w0(I){M5.call(this,I),I=Ty(I.rawUserInfo||"{}"),Hr(this,"profile",y1(I||{}))}b(w0,M5);function ad(I){if(w0.call(this,I),this.providerId!="facebook.com")throw Error("Invalid provider ID!")}b(ad,w0);function KA(I){if(w0.call(this,I),this.providerId!="github.com")throw Error("Invalid provider ID!");Hr(this,"username",this.profile&&this.profile.login||null)}b(KA,w0);function L3(I){if(w0.call(this,I),this.providerId!="google.com")throw Error("Invalid provider ID!")}b(L3,w0);function qA(I){if(w0.call(this,I),this.providerId!="twitter.com")throw Error("Invalid provider ID!");Hr(this,"username",I.screenName||null)}b(qA,w0);function $g(I){var _=wu(I),ce=Ud(_,"link"),Ce=Ud(wu(ce),"link");return _=Ud(_,"deep_link_id"),Ud(wu(_),"link")||_||Ce||ce||I}function ld(I,_){if(!I&&!_)throw new H("internal-error","Internal assert: no raw session string available");if(I&&_)throw new H("internal-error","Internal assert: unable to determine the session type");this.a=I||null,this.b=_||null,this.type=this.a?I5:$A}var I5="enroll",$A="signin";ld.prototype.Ha=function(){return this.a?Fo(this.a):Fo(this.b)},ld.prototype.w=function(){return this.type==I5?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}};function Cp(){}Cp.prototype.ka=function(){},Cp.prototype.b=function(){},Cp.prototype.c=function(){},Cp.prototype.w=function(){};function Ry(I,_){return I.then(function(ce){if(ce[rn]){var Ce=H5(ce[rn]);if(!Ce||_!=Ce.i)throw new H("user-mismatch");return ce}throw new H("user-mismatch")}).o(function(ce){throw ce&&ce.code&&ce.code==E+"user-not-found"?new H("user-mismatch"):ce})}function b1(I,_){if(_)this.a=_;else throw new H("internal-error","failed to construct a credential");Hr(this,"providerId",I),Hr(this,"signInMethod",I)}b1.prototype.ka=function(I){return IS(I,Mc(this))},b1.prototype.b=function(I,_){var ce=Mc(this);return ce.idToken=_,$0(I,ce)},b1.prototype.c=function(I,_){return Ry(JM(I,Mc(this)),_)};function Mc(I){return{pendingToken:I.a,requestUri:"http://localhost"}}b1.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}};function z5(I){if(I&&I.providerId&&I.signInMethod&&I.providerId.indexOf("saml.")==0&&I.pendingToken)try{return new b1(I.providerId,I.pendingToken)}catch{}return null}function Od(I,_,ce){if(this.a=null,_.idToken||_.accessToken)_.idToken&&Hr(this,"idToken",_.idToken),_.accessToken&&Hr(this,"accessToken",_.accessToken),_.nonce&&!_.pendingToken&&Hr(this,"nonce",_.nonce),_.pendingToken&&(this.a=_.pendingToken);else if(_.oauthToken&&_.oauthTokenSecret)Hr(this,"accessToken",_.oauthToken),Hr(this,"secret",_.oauthTokenSecret);else throw new H("internal-error","failed to construct a credential");Hr(this,"providerId",I),Hr(this,"signInMethod",ce)}Od.prototype.ka=function(I){return IS(I,bu(this))},Od.prototype.b=function(I,_){var ce=bu(this);return ce.idToken=_,$0(I,ce)},Od.prototype.c=function(I,_){var ce=bu(this);return Ry(JM(I,ce),_)};function bu(I){var _={};return I.idToken&&(_.id_token=I.idToken),I.accessToken&&(_.access_token=I.accessToken),I.secret&&(_.oauth_token_secret=I.secret),_.providerId=I.providerId,I.nonce&&!I.a&&(_.nonce=I.nonce),_={postBody:r7(_).toString(),requestUri:"http://localhost"},I.a&&(delete _.postBody,_.pendingToken=I.a),_}Od.prototype.w=function(){var I={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(I.oauthIdToken=this.idToken),this.accessToken&&(I.oauthAccessToken=this.accessToken),this.secret&&(I.oauthTokenSecret=this.secret),this.nonce&&(I.nonce=this.nonce),this.a&&(I.pendingToken=this.a),I};function D5(I){if(I&&I.providerId&&I.signInMethod){var _={idToken:I.oauthIdToken,accessToken:I.oauthTokenSecret?null:I.oauthAccessToken,oauthTokenSecret:I.oauthTokenSecret,oauthToken:I.oauthTokenSecret&&I.oauthAccessToken,nonce:I.nonce,pendingToken:I.pendingToken};try{return new Od(I.providerId,_,I.signInMethod)}catch{}}return null}function Vd(I,_){this.Qc=_||[],Kc(this,{providerId:I,isOAuthProvider:!0}),this.Jb={},this.qb=(k3(I)||{}).Ja||null,this.pb=null}Vd.prototype.Ka=function(I){return this.Jb=nt(I),this};function kf(I){if(typeof I!="string"||I.indexOf("saml.")!=0)throw new H("argument-error",'SAML provider IDs must be prefixed with "saml."');Vd.call(this,I,[])}b(kf,Vd);function J0(I){Vd.call(this,I,id),this.a=[]}b(J0,Vd),J0.prototype.Ca=function(I){return fe(this.a,I)||this.a.push(I),this},J0.prototype.Rb=function(){return Te(this.a)},J0.prototype.credential=function(I,_){var ce;if(y(I)?ce={idToken:I.idToken||null,accessToken:I.accessToken||null,nonce:I.rawNonce||null}:ce={idToken:I||null,accessToken:_||null},!ce.idToken&&!ce.accessToken)throw new H("argument-error","credential failed: must provide the ID token and/or the access token.");return new Od(this.providerId,ce,this.providerId)};function Ms(){J0.call(this,"facebook.com")}b(Ms,J0),Hr(Ms,"PROVIDER_ID","facebook.com"),Hr(Ms,"FACEBOOK_SIGN_IN_METHOD","facebook.com");function E5(I){if(!I)throw new H("argument-error","credential failed: expected 1 argument (the OAuth access token).");var _=I;return y(I)&&(_=I.accessToken),new Ms().credential({accessToken:_})}function Qg(){J0.call(this,"github.com")}b(Qg,J0),Hr(Qg,"PROVIDER_ID","github.com"),Hr(Qg,"GITHUB_SIGN_IN_METHOD","github.com");function QA(I){if(!I)throw new H("argument-error","credential failed: expected 1 argument (the OAuth access token).");var _=I;return y(I)&&(_=I.accessToken),new Qg().credential({accessToken:_})}function Hy(){J0.call(this,"google.com"),this.Ca("profile")}b(Hy,J0),Hr(Hy,"PROVIDER_ID","google.com"),Hr(Hy,"GOOGLE_SIGN_IN_METHOD","google.com");function My(I,_){var ce=I;return y(I)&&(ce=I.idToken,_=I.accessToken),new Hy().credential({idToken:ce,accessToken:_})}function Zg(){Vd.call(this,"twitter.com",GA)}b(Zg,Vd),Hr(Zg,"PROVIDER_ID","twitter.com"),Hr(Zg,"TWITTER_SIGN_IN_METHOD","twitter.com");function $l(I,_){var ce=I;if(y(ce)||(ce={oauthToken:I,oauthTokenSecret:_}),!ce.oauthToken||!ce.oauthTokenSecret)throw new H("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new Od("twitter.com",ce,"twitter.com")}function Hi(I,_,ce){this.a=I,this.f=_,Hr(this,"providerId","password"),Hr(this,"signInMethod",ce===rl.EMAIL_LINK_SIGN_IN_METHOD?rl.EMAIL_LINK_SIGN_IN_METHOD:rl.EMAIL_PASSWORD_SIGN_IN_METHOD)}Hi.prototype.ka=function(I){return this.signInMethod==rl.EMAIL_LINK_SIGN_IN_METHOD?ka(I,jy,{email:this.a,oobCode:this.f}):ka(I,tI,{email:this.a,password:this.f})},Hi.prototype.b=function(I,_){return this.signInMethod==rl.EMAIL_LINK_SIGN_IN_METHOD?ka(I,qd,{idToken:_,email:this.a,oobCode:this.f}):ka(I,QM,{idToken:_,email:this.a,password:this.f})},Hi.prototype.c=function(I,_){return Ry(this.ka(I),_)},Hi.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}};function Ic(I){return I&&I.email&&I.password?new Hi(I.email,I.password,I.signInMethod):null}function rl(){Kc(this,{providerId:"password",isOAuthProvider:!1})}function js(I,_){if(_=Su(_),!_)throw new H("argument-error","Invalid email link!");return new Hi(I,_.code,rl.EMAIL_LINK_SIGN_IN_METHOD)}function Su(I){return I=$g(I),(I=F3(I))&&I.operation===w1?I:null}Kc(rl,{PROVIDER_ID:"password"}),Kc(rl,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Kc(rl,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"});function _d(I){if(!(I.fb&&I.eb||I.La&&I.ea))throw new H("internal-error");this.a=I,Hr(this,"providerId","phone"),this.fa="phone",Hr(this,"signInMethod","phone")}_d.prototype.ka=function(I){return I.gb(Rp(this))},_d.prototype.b=function(I,_){var ce=Rp(this);return ce.idToken=_,ka(I,FU,ce)},_d.prototype.c=function(I,_){var ce=Rp(this);return ce.operation="REAUTH",I=ka(I,lm,ce),Ry(I,_)},_d.prototype.w=function(){var I={providerId:"phone"};return this.a.fb&&(I.verificationId=this.a.fb),this.a.eb&&(I.verificationCode=this.a.eb),this.a.La&&(I.temporaryProof=this.a.La),this.a.ea&&(I.phoneNumber=this.a.ea),I};function nc(I){if(I&&I.providerId==="phone"&&(I.verificationId&&I.verificationCode||I.temporaryProof&&I.phoneNumber)){var _={};return se(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(ce){I[ce]&&(_[ce]=I[ce])}),new _d(_)}return null}function Rp(I){return I.a.La&&I.a.ea?{temporaryProof:I.a.La,phoneNumber:I.a.ea}:{sessionInfo:I.a.fb,code:I.a.eb}}function sd(I){try{this.a=I||$n.auth()}catch{throw new H("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Kc(this,{providerId:"phone",isOAuthProvider:!1})}sd.prototype.gb=function(I,_){var ce=this.a.a;return Fo(_.verify()).then(function(Ce){if(typeof Ce!="string")throw new H("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(_.type){case"recaptcha":var _e=y(I)?I.session:null,St=y(I)?I.phoneNumber:I,Lt;return _e&&_e.type==I5?Lt=_e.Ha().then(function(dn){return l4(ce,{idToken:dn,phoneEnrollmentInfo:{phoneNumber:St,recaptchaToken:Ce}})}):_e&&_e.type==$A?Lt=_e.Ha().then(function(dn){return HS(ce,{mfaPendingCredential:dn,mfaEnrollmentId:I.multiFactorHint&&I.multiFactorHint.uid||I.multiFactorUid,phoneSignInInfo:{recaptchaToken:Ce}})}):Lt=a4(ce,{phoneNumber:St,recaptchaToken:Ce}),Lt.then(function(dn){return typeof _.reset=="function"&&_.reset(),dn},function(dn){throw typeof _.reset=="function"&&_.reset(),dn});default:throw new H("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})};function W3(I,_){if(!I)throw new H("missing-verification-id");if(!_)throw new H("missing-verification-code");return new _d({fb:I,eb:_})}Kc(sd,{PROVIDER_ID:"phone"}),Kc(sd,{PHONE_SIGN_IN_METHOD:"phone"});function N3(I){if(I.temporaryProof&&I.phoneNumber)return new _d({La:I.temporaryProof,ea:I.phoneNumber});var _=I&&I.providerId;if(!_||_==="password")return null;var ce=I&&I.oauthAccessToken,Ce=I&&I.oauthTokenSecret,_e=I&&I.nonce,St=I&&I.oauthIdToken,Lt=I&&I.pendingToken;try{switch(_){case"google.com":return My(St,ce);case"facebook.com":return E5(ce);case"github.com":return QA(ce);case"twitter.com":return $l(ce,Ce);default:return ce||Ce||St||Lt?Lt?_.indexOf("saml.")==0?new b1(_,Lt):new Od(_,{pendingToken:Lt,idToken:I.oauthIdToken,accessToken:I.oauthAccessToken},_):new J0(_).credential({idToken:St,accessToken:ce,rawNonce:_e}):null}}catch{return null}}function em(I){if(!I.isOAuthProvider)throw new H("invalid-oauth-provider")}function Ql(I,_,ce,Ce,_e,St,Lt){if(this.c=I,this.b=_||null,this.g=ce||null,this.f=Ce||null,this.i=St||null,this.h=Lt||null,this.a=_e||null,this.g||this.a){if(this.g&&this.a)throw new H("invalid-auth-event");if(this.g&&!this.f)throw new H("invalid-auth-event")}else throw new H("invalid-auth-event")}Ql.prototype.getUid=function(){var I=[];return I.push(this.c),this.b&&I.push(this.b),this.f&&I.push(this.f),this.h&&I.push(this.h),I.join("-")},Ql.prototype.T=function(){return this.h},Ql.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};function ZA(I){return I=I||{},I.type?new Ql(I.type,I.eventId,I.urlResponse,I.sessionId,I.error&&F(I.error),I.postBody,I.tenantId):null}function U3(){this.b=null,this.a=[]}var S1=null;function j3(I){var _=S1;_.a.push(I),_.b||(_.b=function(ce){for(var Ce=0;Ce<_.a.length;Ce++)_.a[Ce](ce)},I=ql("universalLinks.subscribe",s),typeof I=="function"&&I(null,_.b))}function F5(I){var _="unauthorized-domain",ce=void 0,Ce=wu(I);I=Ce.a,Ce=Ce.c,Ce=="chrome-extension"?ce=rt("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):Ce=="http"||Ce=="https"?ce=rt("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",I):_="operation-not-supported-in-this-environment",H.call(this,_,ce)}b(F5,H);function Tu(I,_,ce){H.call(this,I,ce),I=_||{},I.Kb&&Hr(this,"email",I.Kb),I.ea&&Hr(this,"phoneNumber",I.ea),I.credential&&Hr(this,"credential",I.credential),I.$b&&Hr(this,"tenantId",I.$b)}b(Tu,H),Tu.prototype.w=function(){var I={code:this.code,message:this.message};this.email&&(I.email=this.email),this.phoneNumber&&(I.phoneNumber=this.phoneNumber),this.tenantId&&(I.tenantId=this.tenantId);var _=this.credential&&this.credential.w();return _&&Ee(I,_),I},Tu.prototype.toJSON=function(){return this.w()};function Iy(I){if(I.code){var _=I.code||"";_.indexOf(E)==0&&(_=_.substring(E.length));var ce={credential:N3(I),$b:I.tenantId};if(I.email)ce.Kb=I.email;else if(I.phoneNumber)ce.ea=I.phoneNumber;else if(!ce.credential)return new H(_,I.message||void 0);return new Tu(_,ce,I.message)}return null}function Gd(){}Gd.prototype.c=null;function k5(I){return I.c||(I.c=I.b())}var zy;function Dy(){}b(Dy,Gd),Dy.prototype.a=function(){var I=B3(this);return I?new ActiveXObject(I):new XMLHttpRequest},Dy.prototype.b=function(){var I={};return B3(this)&&(I[0]=!0,I[1]=!0),I};function B3(I){if(!I.f&&typeof XMLHttpRequest>"u"&&typeof ActiveXObject<"u"){for(var _=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],ce=0;ce<_.length;ce++){var Ce=_[ce];try{return new ActiveXObject(Ce),I.f=Ce}catch{}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return I.f}zy=new Dy;function T1(){}b(T1,Gd),T1.prototype.a=function(){var I=new XMLHttpRequest;if("withCredentials"in I)return I;if(typeof XDomainRequest<"u")return new v0;throw Error("Unsupported browser")},T1.prototype.b=function(){return{}};function v0(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=w(this.qc,this),this.a.onerror=w(this.Tb,this),this.a.onprogress=w(this.rc,this),this.a.ontimeout=w(this.vc,this)}t=v0.prototype,t.open=function(I,_,ce){if(ce!=null&&!ce)throw Error("Only async requests are supported.");this.a.open(I,_)},t.send=function(I){if(I)if(typeof I=="string")this.a.send(I);else throw Error("Only string data is supported");else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(I){return I.toLowerCase()=="content-type"?this.a.contentType:""},t.qc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Lf(this,4)},t.Tb=function(){this.status=500,this.response=this.responseText="",Lf(this,4)},t.vc=function(){this.Tb()},t.rc=function(){this.status=200,Lf(this,1)};function Lf(I,_){I.readyState=_,I.onreadystatechange&&I.onreadystatechange()}t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType};function cd(I,_,ce){this.reset(I,_,ce,void 0,void 0)}cd.prototype.a=null,cd.prototype.reset=function(I,_,ce,Ce,_e){delete this.a};function tm(I){this.f=I,this.b=this.c=this.a=null}function $r(I,_){this.name=I,this.value=_}$r.prototype.toString=function(){return this.name};var m7=new $r("SEVERE",1e3),Y3=new $r("WARNING",900),Ey=new $r("CONFIG",700),RS=new $r("FINE",500);function P1(I){return I.c?I.c:I.a?P1(I.a):(B("Root logger has no level set."),null)}tm.prototype.log=function(I,_,ce){if(I.value>=P1(this).value)for(A(_)&&(_=_()),I=new cd(I,String(_),this.f),ce&&(I.a=ce),ce=this;ce;)ce=ce.a};var e4={},K0=null;function O3(I){K0||(K0=new tm(""),e4[""]=K0,K0.c=Ey);var _;if(!(_=e4[I])){_=new tm(I);var ce=I.lastIndexOf("."),Ce=I.substr(ce+1);ce=O3(I.substr(0,ce)),ce.b||(ce.b={}),ce.b[Ce]=_,_.a=ce,e4[I]=_}return _}function oc(I,_){I&&I.log(RS,_,void 0)}function Fy(I){this.f=I}b(Fy,Gd),Fy.prototype.a=function(){return new L5(this.f)},Fy.prototype.b=function(I){return function(){return I}}({});function L5(I){Kl.call(this),this.u=I,this.h=void 0,this.readyState=W5,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=O3("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}b(L5,Kl);var W5=0;t=L5.prototype,t.open=function(I,_){if(this.readyState!=W5)throw this.abort(),Error("Error reopening a connection");this.s=I,this.f=_,this.readyState=1,ky(this)},t.send=function(I){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.a=!0;var _={headers:this.l,method:this.s,credentials:this.h,cache:void 0};I&&(_.body=I),this.u.fetch(new Request(this.f,_)).then(this.uc.bind(this),this.Va.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&this.readyState!=4&&(this.a=!1,Wf(this)),this.readyState=W5},t.uc=function(I){this.a&&(this.g=I,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=I.headers,this.readyState=2,ky(this)),this.a&&(this.readyState=3,ky(this),this.a&&(this.responseType==="arraybuffer"?I.arrayBuffer().then(this.sc.bind(this),this.Va.bind(this)):typeof s.ReadableStream<"u"&&"body"in I?(this.response=this.responseText="",this.c=I.body.getReader(),this.m=new TextDecoder,x0(this)):I.text().then(this.tc.bind(this),this.Va.bind(this)))))};function x0(I){I.c.read().then(I.pc.bind(I)).catch(I.Va.bind(I))}t.pc=function(I){if(this.a){var _=this.m.decode(I.value?I.value:new Uint8Array(0),{stream:!I.done});_&&(this.response=this.responseText+=_),I.done?Wf(this):ky(this),this.readyState==3&&x0(this)}},t.tc=function(I){this.a&&(this.response=this.responseText=I,Wf(this))},t.sc=function(I){this.a&&(this.response=I,Wf(this))},t.Va=function(I){var _=this.i;_&&_.log(Y3,"Failed to fetch url "+this.f,I instanceof Error?I:Error(I)),this.a&&Wf(this)};function Wf(I){I.readyState=4,I.g=null,I.c=null,I.m=null,ky(I)}t.setRequestHeader=function(I,_){this.l.append(I,_)},t.getResponseHeader=function(I){return this.b?this.b.get(I.toLowerCase())||"":((I=this.i)&&I.log(Y3,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var I=this.i;return I&&I.log(Y3,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}I=[];for(var _=this.b.entries(),ce=_.next();!ce.done;)ce=ce.value,I.push(ce[0]+": "+ce[1]),ce=_.next();return I.join(`\r +`)};function ky(I){I.onreadystatechange&&I.onreadystatechange.call(I)}Object.defineProperty(L5.prototype,"withCredentials",{get:function(){return this.h==="include"},set:function(I){this.h=I?"include":"same-origin"}});function Ly(I){Kl.call(this),this.headers=new V0,this.D=I||null,this.c=!1,this.C=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.J=!1,this.g=0,this.s=null,this.m=N5,this.u=this.S=!1}b(Ly,Kl);var N5="";Ly.prototype.b=O3("goog.net.XhrIo");var nm=/^https?$/i,y7=["POST","PUT"];function om(I,_,ce,Ce,_e){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.l+"; newUri="+_);ce=ce?ce.toUpperCase():"GET",I.l=_,I.h="",I.P=ce,I.J=!1,I.c=!0,I.a=I.D?I.D.a():zy.a(),I.C=I.D?k5(I.D):k5(zy),I.a.onreadystatechange=w(I.Wb,I);try{oc(I.b,Lh(I,"Opening Xhr")),I.N=!0,I.a.open(ce,String(_),!0),I.N=!1}catch(Lt){oc(I.b,Lh(I,"Error opening Xhr: "+Lt.message)),C1(I,Lt);return}_=Ce||"";var St=new V0(I.headers);_e&&m1(_e,function(Lt,dn){St.set(dn,Lt)}),_e=de(St.Y()),Ce=s.FormData&&_ instanceof s.FormData,!fe(y7,ce)||_e||Ce||St.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),St.forEach(function(Lt,dn){this.a.setRequestHeader(dn,Lt)},I),I.m&&(I.a.responseType=I.m),"withCredentials"in I.a&&I.a.withCredentials!==I.S&&(I.a.withCredentials=I.S);try{n4(I),0=_.l&&_.cancel())}this.u?this.u.call(this.s,this):this.v=!0,this.a||(I=new U5,Wy(this),Xd(this,!1,I))}},im.prototype.m=function(I,_){this.i=!1,Xd(this,I,_)};function Xd(I,_,ce){I.a=!0,I.c=ce,I.f=!_,Jd(I)}function Wy(I){if(I.a){if(!I.v)throw new r4;I.v=!1}}function am(I,_){Ny(I,null,_,void 0)}function Ny(I,_,ce,Ce){I.g.push([_,ce,Ce]),I.a&&Jd(I)}im.prototype.then=function(I,_,ce){var Ce,_e,St=new Yo(function(Lt,dn){Ce=Lt,_e=dn});return Ny(this,Ce,function(Lt){Lt instanceof U5?St.cancel():_e(Lt)}),St.then(I,_,ce)},im.prototype.$goog_Thenable=!0;function b0(I){return ee(I.g,function(_){return A(_[1])})}function Jd(I){if(I.h&&I.a&&b0(I)){var _=I.h,ce=Hp[_];ce&&(s.clearTimeout(ce.a),delete Hp[_]),I.h=0}I.b&&(I.b.l--,delete I.b),_=I.c;for(var Ce=ce=!1;I.g.length&&!I.i;){var _e=I.g.shift(),St=_e[0],Lt=_e[1];if(_e=_e[2],St=I.f?Lt:St)try{var dn=St.call(_e||I.s,_);dn!==void 0&&(I.f=I.f&&(dn==_||dn instanceof Error),I.c=_=dn),(D(_)||typeof s.Promise=="function"&&_ instanceof s.Promise)&&(Ce=!0,I.i=!0)}catch(lo){_=lo,I.f=!0,b0(I)||(ce=!0)}}I.c=_,Ce&&(dn=w(I.m,I,!0),Ce=w(I.m,I,!1),_ instanceof im?(Ny(_,dn,Ce),_.C=!0):_.then(dn,Ce)),ce&&(_=new j5(_),Hp[_.a]=_,I.h=_.a)}function r4(){L.call(this)}b(r4,L),r4.prototype.message="Deferred has already fired",r4.prototype.name="AlreadyCalledError";function U5(){L.call(this)}b(U5,L),U5.prototype.message="Deferred was canceled",U5.prototype.name="CanceledError";function j5(I){this.a=s.setTimeout(w(this.c,this),0),this.b=I}j5.prototype.c=function(){throw delete Hp[this.a],this.b};var Hp={};function _3(I){var _={},ce=_.document||document,Ce=ut(I).toString(),_e=jo(document,"SCRIPT"),St={Xb:_e,Ma:void 0},Lt=new im(St),dn=null,lo=_.timeout!=null?_.timeout:5e3;return 0"u"||typeof s.Headers>"u"||typeof s.Request>"u"))throw new H("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var Lt=new Ly(this.f);if(St){Lt.g=Math.max(0,St);var dn=setTimeout(function(){Lt.dispatchEvent("timeout")},St)}O0(Lt,"complete",function(){dn&&clearTimeout(dn);var lo=null;try{lo=JSON.parse(Nf(this))||null}catch{lo=null}_&&_(lo)}),Mh(Lt,"ready",function(){dn&&clearTimeout(dn),Ot(this)}),Mh(Lt,"timeout",function(){dn&&clearTimeout(dn),Ot(this),_&&_(null)}),om(Lt,I,ce,Ce,_e)};var Kd=new Oe(xt,"https://apis.google.com/js/client.js?onload=%{onload}"),Fn="__fcb"+Math.floor(1e6*Math.random()).toString();function Mn(I,_){if(((window.gapi||{}).client||{}).request)I();else{s[Fn]=function(){((window.gapi||{}).client||{}).request?I():_(Error("CORS_UNSUPPORTED"))};var ce=Qe(Kd,{onload:Fn});am(_3(ce),function(){_(Error("CORS_UNSUPPORTED"))})}}Xe.prototype.s=function(I,_,ce,Ce,_e){var St=this;mt.then(function(){window.gapi.client.setApiKey(St.c);var Lt=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:I,method:ce,body:Ce,headers:_e,authType:"none",callback:function(dn){window.gapi.auth.setToken(Lt),_&&_(dn)}})}).o(function(Lt){_&&_({error:{message:Lt&&Lt.message||"CORS_UNSUPPORTED"}})})};function _n(I,_){return new Yo(function(ce,Ce){_.grant_type=="refresh_token"&&_.refresh_token||_.grant_type=="authorization_code"&&_.code?S0(I,I.l+"?key="+encodeURIComponent(I.c),function(_e){_e?_e.error?Ce(oI(_e)):_e.access_token&&_e.refresh_token?ce(_e):Ce(new H("internal-error")):Ce(new H("network-request-failed"))},"POST",r7(_).toString(),I.g,I.m.get()):Ce(new H("internal-error"))})}function xr(I,_,ce,Ce,_e,St,Lt){var dn=wu(_+ce);ol(dn,"key",I.c),Lt&&ol(dn,"cb",Date.now().toString());var lo=Ce=="GET";if(lo)for(var Mo in _e)_e.hasOwnProperty(Mo)&&ol(dn,Mo,_e[Mo]);return new Yo(function(Mi,bl){S0(I,dn.toString(),function(gl){gl?gl.error?bl(oI(gl,St||{})):Mi(gl):bl(new H("network-request-failed"))},Ce,lo?void 0:Sy(S5(_e)),I.a,I.v.get())})}function Fr(I){if(I=I.email,typeof I!="string"||!m5.test(I))throw new H("invalid-email")}function Zi(I){"email"in I&&Fr(I)}function Vi(I,_){return ka(I,Mte,{identifier:_,continueUri:b5()?ui():"http://localhost"}).then(function(ce){return ce.signinMethods||[]})}function ra(I){return ka(I,MU,{}).then(function(_){return _.authorizedDomains||[]})}function Ba(I){if(!I[rn])throw I.mfaPendingCredential?new H("multi-factor-auth-required",null,nt(I)):new H("internal-error")}function Pa(I){if(I.phoneNumber||I.temporaryProof){if(!I.phoneNumber||!I.temporaryProof)throw new H("internal-error")}else{if(!I.sessionInfo)throw new H("missing-verification-id");if(!I.code)throw new H("missing-verification-code")}}Xe.prototype.Ab=function(){return ka(this,zU,{})},Xe.prototype.Cb=function(I,_){return ka(this,IU,{idToken:I,email:_})},Xe.prototype.Db=function(I,_){return ka(this,QM,{idToken:I,password:_})};var Mp={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};t=Xe.prototype,t.Eb=function(I,_){var ce={idToken:I},Ce=[];return Je(Mp,function(_e,St){var Lt=_[St];Lt===null?Ce.push(_e):St in _&&(ce[St]=Lt)}),Ce.length&&(ce.deleteAttribute=Ce),ka(this,IU,ce)},t.wb=function(I,_){return I={requestType:"PASSWORD_RESET",email:I},Ee(I,_),ka(this,HU,I)},t.xb=function(I,_){return I={requestType:"EMAIL_SIGNIN",email:I},Ee(I,_),ka(this,Ete,I)},t.vb=function(I,_){return I={requestType:"VERIFY_EMAIL",idToken:I},Ee(I,_),ka(this,Fte,I)},t.Fb=function(I,_,ce){return I={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:I,newEmail:_},Ee(I,ce),ka(this,w7,I)};function a4(I,_){return ka(I,Wte,_)}t.gb=function(I){return ka(this,zS,I)};function l4(I,_){return ka(I,Nte,_).then(function(ce){return ce.phoneSessionInfo.sessionInfo})}function gi(I){if(!I.phoneVerificationInfo)throw new H("internal-error");if(!I.phoneVerificationInfo.sessionInfo)throw new H("missing-verification-id");if(!I.phoneVerificationInfo.code)throw new H("missing-verification-code")}function HS(I,_){return ka(I,ZM,_).then(function(ce){return ce.phoneResponseInfo.sessionInfo})}function GM(I,_,ce){return ka(I,zte,{idToken:_,deleteProvider:ce})}function Uy(I){if(!I.requestUri||!I.sessionId&&!I.postBody&&!I.pendingToken)throw new H("internal-error")}function XM(I,_){return _.oauthIdToken&&_.providerId&&_.providerId.indexOf("oidc.")==0&&!_.pendingToken&&(I.sessionId?_.nonce=I.sessionId:I.postBody&&(I=new Vg(I.postBody),ys(I,"nonce")&&(_.nonce=I.get("nonce")))),_}function MS(I){var _=null;if(I.needConfirmation?(I.code="account-exists-with-different-credential",_=Iy(I)):I.errorMessage=="FEDERATED_USER_ID_ALREADY_LINKED"?(I.code="credential-already-in-use",_=Iy(I)):I.errorMessage=="EMAIL_EXISTS"?(I.code="email-already-in-use",_=Iy(I)):I.errorMessage&&(_=nI(I.errorMessage)),_)throw _;Ba(I)}function IS(I,_){return _.returnIdpCredential=!0,ka(I,DU,_)}function $0(I,_){return _.returnIdpCredential=!0,ka(I,eI,_)}function JM(I,_){return _.returnIdpCredential=!0,_.autoCreate=!1,ka(I,v7,_)}function KM(I){if(!I.oobCode)throw new H("invalid-action-code")}t.ob=function(I,_){return ka(this,Lte,{oobCode:I,newPassword:_})},t.Sa=function(I){return ka(this,Hte,{oobCode:I})},t.kb=function(I){return ka(this,CU,{oobCode:I})};var CU={endpoint:"setAccountInfo",A:KM,Z:"email",B:!0},Hte={endpoint:"resetPassword",A:KM,G:function(I){var _=I.requestType;if(!_||!I.email&&_!="EMAIL_SIGNIN"&&_!="VERIFY_AND_CHANGE_EMAIL")throw new H("internal-error")},B:!0},RU={endpoint:"signupNewUser",A:function(I){if(Fr(I),!I.password)throw new H("weak-password")},G:Ba,V:!0,B:!0},Mte={endpoint:"createAuthUri",B:!0},Ite={endpoint:"deleteAccount",O:["idToken"]},zte={endpoint:"setAccountInfo",O:["idToken","deleteProvider"],A:function(I){if(!Array.isArray(I.deleteProvider))throw new H("internal-error")}},jy={endpoint:"emailLinkSignin",O:["email","oobCode"],A:Fr,G:Ba,V:!0,B:!0},qd={endpoint:"emailLinkSignin",O:["idToken","email","oobCode"],A:Fr,G:Ba,V:!0},qM={endpoint:"accounts/mfaEnrollment:finalize",O:["idToken","phoneVerificationInfo"],A:gi,G:Ba,B:!0,Na:!0},Dte={endpoint:"accounts/mfaSignIn:finalize",O:["mfaPendingCredential","phoneVerificationInfo"],A:gi,G:Ba,B:!0,Na:!0},$M={endpoint:"getAccountInfo"},Ete={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="EMAIL_SIGNIN")throw new H("internal-error");Fr(I)},Z:"email",B:!0},Fte={endpoint:"getOobConfirmationCode",O:["idToken","requestType"],A:function(I){if(I.requestType!="VERIFY_EMAIL")throw new H("internal-error")},Z:"email",B:!0},w7={endpoint:"getOobConfirmationCode",O:["idToken","newEmail","requestType"],A:function(I){if(I.requestType!="VERIFY_AND_CHANGE_EMAIL")throw new H("internal-error")},Z:"email",B:!0},HU={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(I){if(I.requestType!="PASSWORD_RESET")throw new H("internal-error");Fr(I)},Z:"email",B:!0},MU={mb:!0,endpoint:"getProjectConfig",Vb:"GET"},kte={mb:!0,endpoint:"getRecaptchaParam",Vb:"GET",G:function(I){if(!I.recaptchaSiteKey)throw new H("internal-error")}},Lte={endpoint:"resetPassword",A:KM,Z:"email",B:!0},Wte={endpoint:"sendVerificationCode",O:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},IU={endpoint:"setAccountInfo",O:["idToken"],A:Zi,V:!0},QM={endpoint:"setAccountInfo",O:["idToken"],A:function(I){if(Zi(I),!I.password)throw new H("weak-password")},G:Ba,V:!0},zU={endpoint:"signupNewUser",G:Ba,V:!0,B:!0},Nte={endpoint:"accounts/mfaEnrollment:start",O:["idToken","phoneEnrollmentInfo"],A:function(I){if(!I.phoneEnrollmentInfo)throw new H("internal-error");if(!I.phoneEnrollmentInfo.phoneNumber)throw new H("missing-phone-number");if(!I.phoneEnrollmentInfo.recaptchaToken)throw new H("missing-app-credential")},G:function(I){if(!I.phoneSessionInfo||!I.phoneSessionInfo.sessionInfo)throw new H("internal-error")},B:!0,Na:!0},ZM={endpoint:"accounts/mfaSignIn:start",O:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(I){if(!I.phoneSignInInfo||!I.phoneSignInInfo.recaptchaToken)throw new H("missing-app-credential")},G:function(I){if(!I.phoneResponseInfo||!I.phoneResponseInfo.sessionInfo)throw new H("internal-error")},B:!0,Na:!0},DU={endpoint:"verifyAssertion",A:Uy,Za:XM,G:MS,V:!0,B:!0},v7={endpoint:"verifyAssertion",A:Uy,Za:XM,G:function(I){if(I.errorMessage&&I.errorMessage=="USER_NOT_FOUND")throw new H("user-not-found");if(I.errorMessage)throw nI(I.errorMessage);Ba(I)},V:!0,B:!0},eI={endpoint:"verifyAssertion",A:function(I){if(Uy(I),!I.idToken)throw new H("internal-error")},Za:XM,G:MS,V:!0},EU={endpoint:"verifyCustomToken",A:function(I){if(!I.token)throw new H("invalid-custom-token")},G:Ba,V:!0,B:!0},tI={endpoint:"verifyPassword",A:function(I){if(Fr(I),!I.password)throw new H("wrong-password")},G:Ba,V:!0,B:!0},zS={endpoint:"verifyPhoneNumber",A:Pa,G:Ba,B:!0},FU={endpoint:"verifyPhoneNumber",A:function(I){if(!I.idToken)throw new H("internal-error");Pa(I)},G:function(I){if(I.temporaryProof)throw I.code="credential-already-in-use",Iy(I);Ba(I)}},lm={Ib:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:Pa,G:Ba,B:!0},X3={endpoint:"accounts/mfaEnrollment:withdraw",O:["idToken","mfaEnrollmentId"],G:function(I){if(!!I[rn]^!!I.refreshToken)throw new H("internal-error")},B:!0,Na:!0};function ka(I,_,ce){if(!Py(ce,_.O))return Si(new H("internal-error"));var Ce=!!_.Na,_e=_.Vb||"POST",St;return Fo(ce).then(_.A).then(function(){return _.V&&(ce.returnSecureToken=!0),_.B&&I.b&&typeof ce.tenantId>"u"&&(ce.tenantId=I.b),Ce?xr(I,I.i,_.endpoint,_e,ce,_.Ib,_.mb||!1):xr(I,I.h,_.endpoint,_e,ce,_.Ib,_.mb||!1)}).then(function(Lt){return St=Lt,_.Za?_.Za(ce,St):St}).then(_.G).then(function(){if(!_.Z)return St;if(!(_.Z in St))throw new H("internal-error");return St[_.Z]})}function nI(I){return oI({error:{errors:[{message:I}],code:400,message:I}})}function oI(I,_){var ce=(I.error&&I.error.errors&&I.error.errors[0]||{}).reason||"",Ce={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(ce=Ce[ce]?new H(Ce[ce]):null)return ce;ce=I.error&&I.error.message||"",Ce={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},Ee(Ce,_||{}),_=(_=ce.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<_.length?_[1]:void 0;for(var _e in Ce)if(ce.indexOf(_e)===0)return new H(Ce[_e],_);return!_&&I&&(_=Tp(I)),new H("internal-error",_)}function Ute(I){this.b=I,this.a=null,this.sb=jte(this)}function jte(I){return Gte().then(function(){return new Yo(function(_,ce){ql("gapi.iframes.getContext")().open({where:document.body,url:I.b,messageHandlersFilter:ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(Ce){function _e(){clearTimeout(St),_()}I.a=Ce,I.a.restyle({setHideOnLeave:!1});var St=setTimeout(function(){ce(Error("Network Error"))},_te.get());Ce.ping(_e).then(_e,function(){ce(Error("Network Error"))})})})})}function Bte(I,_){return I.sb.then(function(){return new Yo(function(ce){I.a.send(_.type,_,ce,ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}function Yte(I,_){I.sb.then(function(){I.a.register("authEvent",_,ql("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}var Ote=new Oe(xt,"https://apis.google.com/js/api.js?onload=%{onload}"),Vte=new Ef(3e4,6e4),_te=new Ef(5e3,15e3),DS=null;function Gte(){return DS||(DS=new Yo(function(I,_){function ce(){P5(),ql("gapi.load")("gapi.iframes",{callback:I,ontimeout:function(){P5(),_(Error("Network Error"))},timeout:Vte.get()})}if(ql("gapi.iframes.Iframe"))I();else if(ql("gapi.load"))ce();else{var Ce="__iframefcb"+Math.floor(1e6*Math.random()).toString();s[Ce]=function(){ql("gapi.load")?ce():_(Error("Network Error"))},Ce=Qe(Ote,{onload:Ce}),Fo(_3(Ce)).o(function(){_(Error("Network Error"))})}}).o(function(I){throw DS=null,I}))}function kU(I,_,ce,Ce){this.l=I,this.h=_,this.i=ce,this.g=Ce,this.f=null,this.g?(I=wu(this.g.url),I=p5(I.c,I.a,I.g,"/emulator/auth/iframe")):I=p5("https",this.l,null,"/__/auth/iframe"),this.a=I,ol(this.a,"apiKey",this.h),ol(this.a,"appName",this.i),this.b=null,this.c=[]}kU.prototype.toString=function(){return this.f?ol(this.a,"v",this.f):Gc(this.a.b,"v"),this.b?ol(this.a,"eid",this.b):Gc(this.a.b,"eid"),this.c.length?ol(this.a,"fw",this.c.join(",")):Gc(this.a.b,"fw"),this.a.toString()};function ES(I,_,ce,Ce,_e,St){this.u=I,this.s=_,this.c=ce,this.m=Ce,this.v=St,this.i=this.g=this.l=null,this.a=_e,this.h=this.f=null}ES.prototype.zb=function(I){return this.h=I,this},ES.prototype.toString=function(){if(this.v){var I=wu(this.v.url);I=p5(I.c,I.a,I.g,"/emulator/auth/handler")}else I=p5("https",this.u,null,"/__/auth/handler");if(ol(I,"apiKey",this.s),ol(I,"appName",this.c),ol(I,"authType",this.m),this.a.isOAuthProvider){var _=this.a;try{var ce=$n.app(this.c).auth().la()}catch{ce=null}_.pb=ce,ol(I,"providerId",this.a.providerId),ce=this.a,_=S5(ce.Jb);for(var Ce in _)_[Ce]=_[Ce].toString();Ce=ce.Qc,_=nt(_);for(var _e=0;_e"u"&&delete dn[lo]}),I.ports[0].postMessage({status:"done",eventId:ce,eventType:_,response:Lt})})}};function Wh(I,_,ce){Ue(I.a)&&I.b.addEventListener("message",I.f),typeof I.a[_]>"u"&&(I.a[_]=[]),I.a[_].push(ce)}function YU(I){this.a=I}YU.prototype.postMessage=function(I,_){this.a.postMessage(I,_)};function OU(I){this.c=I,this.b=!1,this.a=[]}function VU(I,_,ce,Ce){var _e,St=ce||{},Lt,dn,lo,Mo=null;if(I.b)return Si(Error("connection_unavailable"));var Mi=Ce?800:50,bl=typeof MessageChannel<"u"?new MessageChannel:null;return new Yo(function(gl,Q0){bl?(_e=Math.floor(Math.random()*Math.pow(10,20)).toString(),bl.port1.start(),dn=setTimeout(function(){Q0(Error("unsupported_event"))},Mi),Lt=function(Oy){Oy.data.eventId===_e&&(Oy.data.status==="ack"?(clearTimeout(dn),lo=setTimeout(function(){Q0(Error("timeout"))},3e3)):Oy.data.status==="done"?(clearTimeout(lo),typeof Oy.data.response<"u"?gl(Oy.data.response):Q0(Error("unknown_error"))):(clearTimeout(dn),clearTimeout(lo),Q0(Error("invalid_response"))))},Mo={messageChannel:bl,onMessage:Lt},I.a.push(Mo),bl.port1.addEventListener("message",Lt),I.c.postMessage({eventType:_,eventId:_e,data:St},[bl.port2])):Q0(Error("connection_unavailable"))}).then(function(gl){return kS(I,Mo),gl}).o(function(gl){throw kS(I,Mo),gl})}function kS(I,_){if(_){var ce=_.messageChannel,Ce=_.onMessage;ce&&(ce.port1.removeEventListener("message",Ce),ce.port1.close()),ye(I.a,function(_e){return _e==_})}}OU.prototype.close=function(){for(;0"u"&&(Ce=null);var _e=s.localStorage.getItem(ce);_e!==Ce&&(this.b[ce]=_e,this.nb(ce))}else if(_.indexOf("firebase:")==0&&this.a[_]){if(typeof I.a.a<"u"?J3(this,"local").ia(this.f):fI(this),this.m){if(ce=s.localStorage.getItem(_),Ce=I.a.newValue,Ce!==ce)Ce!==null?s.localStorage.setItem(_,Ce):s.localStorage.removeItem(_);else if(this.b[_]===Ce&&typeof I.a.a>"u")return}var St=this;ce=function(){(typeof I.a.a<"u"||St.b[_]!==s.localStorage.getItem(_))&&(St.b[_]=s.localStorage.getItem(_),St.nb(_))},ot&&po&&po==10&&s.localStorage.getItem(_)!==I.a.newValue&&I.a.newValue!==I.a.oldValue?setTimeout(ce,10):ce()}}else se(I,w(this.nb,this))},t.nb=function(I){this.a[I]&&se(this.a[I],function(_){_()})};function ane(I){this.a=I,this.b=P7()}var hI={name:"authEvent",F:"local"};function lne(I){return I.b.get(hI,I.a).then(function(_){return ZA(_)})}function sne(){this.a=P7()}function cne(){this.b=-1}function NS(I,_){this.b=tj,this.f=s.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=I,this.h=_,this.l=s.Int32Array?new Int32Array(64):Array(64),US===void 0&&(s.Int32Array?US=new Int32Array(yI):US=yI),this.reset()}var US;b(NS,cne);for(var tj=64,une=tj-1,nj=[],pI=0;pI_;_++){_e=ce[_-15]|0,Ce=ce[_-2]|0;var St=(ce[_-16]|0)+((_e>>>7|_e<<25)^(_e>>>18|_e<<14)^_e>>>3)|0,Lt=(ce[_-7]|0)+((Ce>>>17|Ce<<15)^(Ce>>>19|Ce<<13)^Ce>>>10)|0;ce[_]=St+Lt|0}Ce=I.a[0]|0,_e=I.a[1]|0;var dn=I.a[2]|0,lo=I.a[3]|0,Mo=I.a[4]|0,Mi=I.a[5]|0,bl=I.a[6]|0;for(St=I.a[7]|0,_=0;64>_;_++){var gl=((Ce>>>2|Ce<<30)^(Ce>>>13|Ce<<19)^(Ce>>>22|Ce<<10))+(Ce&_e^Ce&dn^_e&dn)|0;Lt=Mo&Mi^~Mo&bl,St=St+((Mo>>>6|Mo<<26)^(Mo>>>11|Mo<<21)^(Mo>>>25|Mo<<7))|0,Lt=Lt+(US[_]|0)|0,Lt=St+(Lt+(ce[_]|0)|0)|0,St=bl,bl=Mi,Mi=Mo,Mo=lo+Lt|0,lo=dn,dn=_e,_e=Ce,Ce=Lt+gl|0}I.a[0]=I.a[0]+Ce|0,I.a[1]=I.a[1]+_e|0,I.a[2]=I.a[2]+dn|0,I.a[3]=I.a[3]+lo|0,I.a[4]=I.a[4]+Mo|0,I.a[5]=I.a[5]+Mi|0,I.a[6]=I.a[6]+bl|0,I.a[7]=I.a[7]+St|0}function mI(I,_,ce){ce===void 0&&(ce=_.length);var Ce=0,_e=I.c;if(typeof _=="string")for(;Ce=St&&St==(St|0)))throw Error("message must be a byte array");I.f[_e++]=St,_e==I.b&&(gI(I),_e=0)}else throw Error("message must be string or array");I.c=_e,I.g+=ce}var yI=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function AI(){NS.call(this,8,dne)}b(AI,NS);var dne=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function rj(I,_,ce,Ce,_e,St){this.v=I,this.i=_,this.l=ce,this.m=Ce||null,this.u=_e||null,this.s=St,this.h=_+":"+ce,this.C=new sne,this.g=new ane(this.h),this.f=null,this.b=[],this.a=this.c=null}function jS(I){return new H("invalid-cordova-configuration",I)}t=rj.prototype,t.ma=function(){return this.Ia?this.Ia:this.Ia=y5().then(function(){if(typeof ql("universalLinks.subscribe",s)!="function")throw jS("cordova-universal-links-plugin-fix is not installed");if(typeof ql("BuildInfo.packageName",s)>"u")throw jS("cordova-plugin-buildinfo is not installed");if(typeof ql("cordova.plugins.browsertab.openUrl",s)!="function")throw jS("cordova-plugin-browsertab is not installed");if(typeof ql("cordova.InAppBrowser.open",s)!="function")throw jS("cordova-plugin-inappbrowser is not installed")},function(){throw new H("cordova-not-ready")})};function fne(){for(var I=20,_=[];0_.c?mI(_,oj,56-_.c):mI(_,oj,_.b-(_.c-56));for(var Ce=63;56<=Ce;Ce--)_.f[Ce]=ce&255,ce/=256;for(gI(_),Ce=ce=0;Ce<_.i;Ce++)for(var _e=24;0<=_e;_e-=8)I[ce++]=_.a[Ce]>>_e&255;return OM(I)}t.Pb=function(I,_){return _(new H("operation-not-supported-in-this-environment")),Fo()},t.Nb=function(){return Si(new H("operation-not-supported-in-this-environment"))},t.ac=function(){return!1},t.Yb=function(){return!0},t.Ub=function(){return!0},t.Ob=function(I,_,ce,Ce){if(this.c)return Si(new H("redirect-operation-pending"));var _e=this,St=s.document,Lt=null,dn=null,lo=null,Mo=null;return this.c=Fo().then(function(){return em(_),aj(_e)}).then(function(){return hne(_e,I,_,ce,Ce)}).then(function(){return new Yo(function(Mi,bl){dn=function(){var gl=ql("cordova.plugins.browsertab.close",s);return Mi(),typeof gl=="function"&&gl(),_e.a&&typeof _e.a.close=="function"&&(_e.a.close(),_e.a=null),!1},_e.Ea(dn),lo=function(){Lt||(Lt=_c(2e3).then(function(){bl(new H("redirect-cancelled-by-user"))}))},Mo=function(){EA()&&lo()},St.addEventListener("resume",lo,!1),tc().toLowerCase().match(/android/)||St.addEventListener("visibilitychange",Mo,!1)}).o(function(Mi){return wI(_e).then(function(){throw Mi})})}).oa(function(){lo&&St.removeEventListener("resume",lo,!1),Mo&&St.removeEventListener("visibilitychange",Mo,!1),Lt&&Lt.cancel(),dn&&_e.Ta(dn),_e.c=null})};function hne(I,_,ce,Ce,_e){var St=fne(),Lt=new Ql(_,Ce,null,St,new H("no-auth-event"),null,_e),dn=ql("BuildInfo.packageName",s);if(typeof dn!="string")throw new H("invalid-cordova-configuration");var lo=ql("BuildInfo.displayName",s),Mo={};if(tc().toLowerCase().match(/iphone|ipad|ipod/))Mo.ibi=dn;else if(tc().toLowerCase().match(/android/))Mo.apn=dn;else return Si(new H("operation-not-supported-in-this-environment"));lo&&(Mo.appDisplayName=lo),St=BS(St),Mo.sessionId=St;var Mi=s4(I.v,I.i,I.l,_,ce,null,Ce,I.m,Mo,I.u,_e,I.s);return I.ma().then(function(){var bl=I.h;return I.C.a.set(hI,Lt.w(),bl)}).then(function(){var bl=ql("cordova.plugins.browsertab.isAvailable",s);if(typeof bl!="function")throw new H("invalid-cordova-configuration");var gl=null;bl(function(Q0){if(Q0){if(gl=ql("cordova.plugins.browsertab.openUrl",s),typeof gl!="function")throw new H("invalid-cordova-configuration");gl(Mi)}else{if(gl=ql("cordova.InAppBrowser.open",s),typeof gl!="function")throw new H("invalid-cordova-configuration");Q0=tc(),I.a=gl(Mi,Q0.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||Q0.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}function ij(I,_){for(var ce=0;ceI.f&&(I.a=I.f),_)}function II(I,_){I.stop(),I.b=_c(Tne(I,_)).then(function(){return a7()}).then(function(){return I.h()}).then(function(){II(I,!0)}).o(function(ce){I.i(ce)&&II(I,!1)})}MI.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)};function I7(I){this.f=I,this.b=this.a=null,this.c=Date.now()}I7.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}};function wj(I,_){typeof _>"u"&&(I.b?(_=I.b,_=_.a-_.g):_=0),I.c=Date.now()+1e3*_}function cm(I,_){I.b=H5(_[rn]||""),I.a=_.refreshToken,_=_.expiresIn,wj(I,typeof _<"u"?Number(_):void 0)}function vj(I,_){I.b=_.b,I.a=_.a,I.c=_.c}function GS(I,_){return _n(I.f,_).then(function(ce){return I.b=H5(ce.access_token),I.a=ce.refresh_token,wj(I,ce.expires_in),{accessToken:I.b.toString(),refreshToken:I.a}}).o(function(ce){throw ce.code=="auth/user-token-expired"&&(I.a=null),ce})}I7.prototype.getToken=function(I){return I=!!I,this.b&&!this.a?Si(new H("user-token-expired")):I||!this.b||Date.now()>this.c-3e4?this.a?GS(this,{grant_type:"refresh_token",refresh_token:this.a}):Fo(null):Fo({accessToken:this.b.toString(),refreshToken:this.a})};function ws(I,_){this.a=I||null,this.b=_||null,Kc(this,{lastSignInTime:I3(_||null),creationTime:I3(I||null)})}function Dc(I){return new ws(I.a,I.b)}ws.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}};function xj(I,_,ce,Ce,_e,St){Kc(this,{uid:I,displayName:Ce||null,photoURL:_e||null,email:ce||null,phoneNumber:St||null,providerId:_})}function Nh(I,_,ce){this.N=[],this.l=I.apiKey,this.m=I.appName,this.s=I.authDomain||null;var Ce=$n.SDK_VERSION?Xg($n.SDK_VERSION):null;this.a=new Xe(this.l,W(k),Ce),(this.u=I.emulatorConfig||null)&&Xr(this.a,this.u),this.h=new I7(this.a),KS(this,_[rn]),cm(this.h,_),Hr(this,"refreshToken",this.h.a),bj(this,ce||{}),Kl.call(this),this.P=!1,this.s&&nd()&&(this.b=d4(this.s,this.l,this.m,this.u)),this.W=[],this.i=null,this.D=D7(this),this.ba=w(this.ib,this);var _e=this;this.za=null,this.Pa=function(St){_e.xa(St.h)},this.qa=null,this.Ba=function(St){zI(_e,St.c)},this.$=null,this.aa=[],this.Oa=function(St){z7(_e,St.f)},this.ja=null,this.S=new sm(this,ce),Hr(this,"multiFactor",this.S)}b(Nh,Kl),Nh.prototype.xa=function(I){this.za=I,Ei(this.a,I)};function zI(I,_){I.u=_,Xr(I.a,_),I.b&&(_=I.b,I.b=d4(I.s,I.l,I.m,I.u),I.P&&(H7(_,I),R7(I.b,I)))}Nh.prototype.la=function(){return this.za};function DI(I,_){I.qa&&Or(I.qa,"languageCodeChanged",I.Pa),(I.qa=_)&&qn(_,"languageCodeChanged",I.Pa)}function EI(I,_){I.$&&Or(I.$,"emulatorConfigChanged",I.Ba),(I.$=_)&&qn(_,"emulatorConfigChanged",I.Ba)}function z7(I,_){I.aa=_,Vr(I.a,$n.SDK_VERSION?Xg($n.SDK_VERSION,I.aa):null)}Nh.prototype.Ga=function(){return Te(this.aa)};function FI(I,_){I.ja&&Or(I.ja,"frameworkChanged",I.Oa),(I.ja=_)&&qn(_,"frameworkChanged",I.Oa)}Nh.prototype.ib=function(){this.D.b&&(this.D.stop(),this.D.start())};function XS(I){try{return $n.app(I.m).auth()}catch{throw new H("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+I.m+"'!")}}function D7(I){return new MI(function(){return I.I(!0)},function(_){return!!(_&&_.code=="auth/network-request-failed")},function(){var _=I.h.c-Date.now()-3e5;return 0<_?_:0})}function JS(I){I.J||I.D.b||(I.D.start(),Or(I,"tokenChanged",I.ba),qn(I,"tokenChanged",I.ba))}function kI(I){Or(I,"tokenChanged",I.ba),I.D.stop()}function KS(I,_){I.Aa=_,Hr(I,"_lat",_)}function qS(I,_){ye(I.W,function(ce){return ce==_})}function T0(I){for(var _=[],ce=0;ce"u"||Ue(I)?{}:_A(new xu(I))}).then(function(Ce){return _.a.vb(ce,Ce)}).then(function(Ce){if(_.email!=Ce)return _.reload()}).then(function(){}))},t.Fb=function(I,_){var ce=this,Ce=null;return P0(this,this.I().then(function(_e){return Ce=_e,typeof _>"u"||Ue(_)?{}:_A(new xu(_))}).then(function(_e){return ce.a.Fb(Ce,I,_e)}).then(function(_e){if(ce.email!=_e)return ce.reload()}).then(function(){}))};function P0(I,_,ce){var Ce=Cne(I,_,ce);return I.N.push(Ce),Ce.oa(function(){pe(I.N,Ce)}),Ce.o(function(_e){var St=null;throw _e&&_e.code==="auth/multi-factor-auth-required"&&(St=Aj(_e.w(),XS(I),w(I.jc,I))),St||_e})}t.jc=function(I){var _=null,ce=this;return I=Ry(Fo(I),ce.uid).then(function(Ce){return _=E7(ce,Ce,"reauthenticate"),qc(ce,Ce),ce.i=null,ce.reload()}).then(function(){return _}),P0(this,I,!0)};function Cne(I,_,ce){return I.i&&!ce?(_.cancel(),Si(I.i)):_.o(function(Ce){throw!Ce||Ce.code!="auth/user-disabled"&&Ce.code!="auth/user-token-expired"||(I.i||I.dispatchEvent(new h4("userInvalidated")),I.i=Ce),Ce})}t.toJSON=function(){return this.w()},t.w=function(){var I={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.h.w(),redirectEventId:this.ga||null};return this.metadata&&Ee(I,this.metadata.w()),se(this.providerData,function(_){I.providerData.push(C5(_))}),Ee(I,this.S.w()),I};function Rj(I){if(!I.apiKey)return null;var _={apiKey:I.apiKey,authDomain:I.authDomain,appName:I.appName,emulatorConfig:I.emulatorConfig},ce={};if(I.stsTokenManager&&I.stsTokenManager.accessToken){ce[rn]=I.stsTokenManager.accessToken,ce.refreshToken=I.stsTokenManager.refreshToken||null;var Ce=I.stsTokenManager.expirationTime;Ce&&(ce.expiresIn=(Ce-Date.now())/1e3)}else return null;var _e=new Nh(_,ce,I);return I.providerData&&se(I.providerData,function(St){St&&NI(_e,Ff(St))}),I.redirectEventId&&(_e.ga=I.redirectEventId),_e}function Rne(I,_,ce,Ce){var _e=new Nh(I,_);return ce&&(_e.ha=ce),Ce&&z7(_e,Ce),_e.reload().then(function(){return _e})}function Hne(I,_,ce,Ce){var _e=I.h,St={};return St[rn]=_e.b&&_e.b.toString(),St.refreshToken=_e.a,_=new Nh(_||{apiKey:I.l,authDomain:I.s,appName:I.m},St),ce&&(_.ha=ce),Ce&&z7(_,Ce),Ji(_,I),_}function Mne(I){this.a=I,this.b=P7()}var BI={name:"redirectUser",F:"session"};function Hj(I){return By(I.b,BI,I.a)}function Ine(I,_){return I.b.get(BI,I.a).then(function(ce){return ce&&_&&(ce.authDomain=_),Rj(ce||{})})}function YI(I){this.a=I,this.b=P7(),this.c=null,this.f=VI(this),this.b.addListener(zp("local"),this.a,w(this.g,this))}YI.prototype.g=function(){var I=this,_=zp("local");R0(this,function(){return Fo().then(function(){return I.c&&I.c.F!="local"?I.b.get(_,I.a):null}).then(function(ce){if(ce)return OI(I,"local").then(function(){I.c=_})})})};function OI(I,_){var ce=[],Ce;for(Ce in u4)u4[Ce]!==_&&ce.push(By(I.b,zp(u4[Ce]),I.a));return ce.push(By(I.b,_I,I.a)),nr(ce)}function VI(I){var _=zp("local"),ce=zp("session"),Ce=zp("none");return rne(I.b,_,I.a).then(function(){return I.b.get(ce,I.a)}).then(function(_e){return _e?ce:I.b.get(Ce,I.a).then(function(St){return St?Ce:I.b.get(_,I.a).then(function(Lt){return Lt?_:I.b.get(_I,I.a).then(function(dn){return dn?zp(dn):_})})})}).then(function(_e){return I.c=_e,OI(I,_e.F)}).o(function(){I.c||(I.c=_)})}var _I={name:"persistence",F:"session"};function zp(I){return{name:"authUser",F:I}}YI.prototype.yb=function(I){var _=null,ce=this;return one(I),R0(this,function(){return I!=ce.c.F?ce.b.get(ce.c,ce.a).then(function(Ce){return _=Ce,OI(ce,I)}).then(function(){if(ce.c=zp(I),_)return ce.b.set(ce.c,_,ce.a)}):Fo()})};function zne(I){return R0(I,function(){return I.b.set(_I,I.c.F,I.a)})}function Mj(I,_){return R0(I,function(){return I.b.set(I.c,_.w(),I.a)})}function Ij(I){return R0(I,function(){return By(I.b,I.c,I.a)})}function C0(I,_,ce){return R0(I,function(){return I.b.get(I.c,I.a).then(function(Ce){return Ce&&_&&(Ce.authDomain=_),Ce&&ce&&(Ce.emulatorConfig=ce),Rj(Ce||{})})})}function R0(I,_){return I.f=I.f.then(_,_),I.f}function H1(I){if(this.l=!1,Hr(this,"settings",new mj),Hr(this,"app",I),Zl(this).options&&Zl(this).options.apiKey)I=$n.SDK_VERSION?Xg($n.SDK_VERSION):null,this.a=new Xe(Zl(this).options&&Zl(this).options.apiKey,W(k),I);else throw new H("invalid-api-key");this.P=[],this.s=[],this.N=[],this.Pa=$n.INTERNAL.createSubscribe(w(this.zc,this)),this.W=void 0,this.ib=$n.INTERNAL.createSubscribe(w(this.Ac,this)),p4(this,null),this.i=new YI(Zl(this).options.apiKey+":"+Zl(this).name),this.D=new Mne(Zl(this).options.apiKey+":"+Zl(this).name),this.$=Ec(this,Lj(this)),this.h=Ec(this,kne(this)),this.ba=!1,this.ja=w(this.Zc,this),this.Ba=w(this.da,this),this.qa=w(this.mc,this),this.za=w(this.wc,this),this.Aa=w(this.xc,this),this.b=null,Ej(this),this.INTERNAL={},this.INTERNAL.delete=w(this.delete,this),this.INTERNAL.logFramework=w(this.Gc,this),this.u=0,Kl.call(this),Ene(this),this.J=[],this.R=null}b(H1,Kl);function zj(I){Nt.call(this,"languageCodeChanged"),this.h=I}b(zj,Nt);function Dj(I){Nt.call(this,"emulatorConfigChanged"),this.c=I}b(Dj,Nt);function GI(I){Nt.call(this,"frameworkChanged"),this.f=I}b(GI,Nt),t=H1.prototype,t.yb=function(I){return I=this.i.yb(I),Ec(this,I)},t.xa=function(I){this.aa===I||this.l||(this.aa=I,Ei(this.a,this.aa),this.dispatchEvent(new zj(this.la())))},t.la=function(){return this.aa},t.fd=function(){var I=s.navigator;this.xa(I&&(I.languages&&I.languages[0]||I.language||I.userLanguage)||null)},t.gd=function(I,_){if(!this.R){if(!/^https?:\/\//.test(I))throw new H("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");_=_?!!_.disableWarnings:!1,Dne(_),this.R={url:I,ec:_},this.settings.jb=!0,Xr(this.a,this.R),this.dispatchEvent(new Dj(this.R))}};function Dne(I){typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),s.document&&!I&&Ws().then(function(){var _=s.document.createElement("div");_.innerText="Running in emulator mode. Do not use with production credentials.",_.style.position="fixed",_.style.width="100%",_.style.backgroundColor="#ffffff",_.style.border=".1em solid #000000",_.style.color="#b50000",_.style.bottom="0px",_.style.left="0px",_.style.margin="0px",_.style.zIndex=1e4,_.style.textAlign="center",_.classList.add("firebase-emulator-warning"),s.document.body.appendChild(_)})}t.Gc=function(I){this.J.push(I),Vr(this.a,$n.SDK_VERSION?Xg($n.SDK_VERSION,this.J):null),this.dispatchEvent(new GI(this.J))},t.Ga=function(){return Te(this.J)},t.zb=function(I){this.S===I||this.l||(this.S=I,this.a.b=this.S)},t.T=function(){return this.S};function Ene(I){Object.defineProperty(I,"lc",{get:function(){return this.la()},set:function(_){this.xa(_)},enumerable:!1}),I.aa=null,Object.defineProperty(I,"ti",{get:function(){return this.T()},set:function(_){this.zb(_)},enumerable:!1}),I.S=null,Object.defineProperty(I,"emulatorConfig",{get:function(){if(this.R){var _=wu(this.R.url);_=Ff({protocol:_.c,host:_.a,port:_.g,options:Ff({disableWarnings:this.R.ec})})}else _=null;return _},enumerable:!1})}t.toJSON=function(){return{apiKey:Zl(this).options.apiKey,authDomain:Zl(this).options.authDomain,appName:Zl(this).name,currentUser:la(this)&&la(this).w()}};function XI(I){return I.Oa||Si(new H("auth-domain-config-required"))}function Ej(I){var _=Zl(I).options.authDomain,ce=Zl(I).options.apiKey;_&&nd()&&(I.Oa=I.$.then(function(){if(!I.l){if(I.b=d4(_,ce,Zl(I).name,I.R),R7(I.b,I),la(I)&&um(la(I)),I.m){um(I.m);var Ce=I.m;Ce.xa(I.la()),DI(Ce,I),Ce=I.m,z7(Ce,I.J),FI(Ce,I),Ce=I.m,zI(Ce,I.R),EI(Ce,I),I.m=null}return I.b}}))}t.Gb=function(I,_){switch(I){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==_&&!!this.f;default:return!1}},t.na=function(I,_,ce,Ce){I=="signInViaPopup"&&this.g==Ce&&(ce&&this.C?this.C(ce):_&&!ce&&this.f&&this.f(_),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(I,_){return I=="signInViaRedirect"||I=="signInViaPopup"&&this.g==_&&this.f?w(this.ic,this):null},t.ic=function(I,_,ce,Ce){var _e=this,St={requestUri:I,postBody:Ce,sessionId:_,tenantId:ce};return this.c&&(this.c.cancel(),this.c=null),_e.$.then(function(){return $3(_e,IS(_e.a,St))})},t.Xc=function(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=this,ce=k3(I.providerId),Ce=Jg(),_e=null;(!od()||M3())&&Zl(this).options.authDomain&&I.isOAuthProvider&&(_e=s4(Zl(this).options.authDomain,Zl(this).options.apiKey,Zl(this).name,"signInViaPopup",I,null,Ce,$n.SDK_VERSION||null,null,null,this.T(),this.R));var St=_0(_e,ce&&ce.va,ce&&ce.ua);return ce=XI(this).then(function(Lt){return SI(Lt,St,"signInViaPopup",I,Ce,!!_e,_.T())}).then(function(){return new Yo(function(Lt,dn){_.na("signInViaPopup",null,new H("cancelled-popup-request"),_.g),_.f=Lt,_.C=dn,_.g=Ce,_.c=dj(_.b,_,"signInViaPopup",St,Ce)})}).then(function(Lt){return St&&As(St),Lt?Ff(Lt):null}).o(function(Lt){throw St&&As(St),Lt}),Ec(this,ce)},t.Yc=function(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=this,ce=XI(this).then(function(){return zne(_.i)}).then(function(){return uj(_.b,"signInViaRedirect",I,void 0,_.T())});return Ec(this,ce)};function Fj(I){if(!nd())return Si(new H("operation-not-supported-in-this-environment"));var _=XI(I).then(function(){return I.b.ra()}).then(function(ce){return ce?Ff(ce):null});return Ec(I,_)}t.ra=function(){var I=this;return Fj(this).then(function(_){return I.b&&f4(I.b.b),_}).o(function(_){throw I.b&&f4(I.b.b),_})},t.dd=function(I){if(!I)return Si(new H("null-user"));if(this.S!=I.tenantId)return Si(new H("tenant-id-mismatch"));var _=this,ce={};ce.apiKey=Zl(this).options.apiKey,ce.authDomain=Zl(this).options.authDomain,ce.appName=Zl(this).name;var Ce=Hne(I,ce,_.D,_.Ga());return Ec(this,this.h.then(function(){if(Zl(_).options.apiKey!=I.l)return Ce.reload()}).then(function(){return la(_)&&I.uid==la(_).uid?(Ji(la(_),I),_.da(I)):(p4(_,Ce),um(Ce),_.da(Ce))}).then(function(){k7(_)}))};function Fne(I,_){var ce={};return ce.apiKey=Zl(I).options.apiKey,ce.authDomain=Zl(I).options.authDomain,ce.appName=Zl(I).name,I.R&&(ce.emulatorConfig=I.R),I.$.then(function(){return Rne(ce,_,I.D,I.Ga())}).then(function(Ce){return la(I)&&Ce.uid==la(I).uid?(Ji(la(I),Ce),I.da(Ce)):(p4(I,Ce),um(Ce),I.da(Ce))}).then(function(){k7(I)})}function p4(I,_){la(I)&&(qS(la(I),I.Ba),Or(la(I),"tokenChanged",I.qa),Or(la(I),"userDeleted",I.za),Or(la(I),"userInvalidated",I.Aa),kI(la(I))),_&&(_.W.push(I.Ba),qn(_,"tokenChanged",I.qa),qn(_,"userDeleted",I.za),qn(_,"userInvalidated",I.Aa),0this.u&&(this.u=0),this.u==0&&la(this)&&kI(la(this)),this.removeAuthTokenListener(I)},t.addAuthTokenListener=function(I){var _=this;this.s.push(I),Ec(this,this.h.then(function(){_.l||fe(_.s,I)&&I(Yy(_))}))},t.removeAuthTokenListener=function(I){ye(this.s,function(_){return _==I})};function Lne(I,_){I.N.push(_),Ec(I,I.h.then(function(){!I.l&&fe(I.N,_)&&I.W!==I.getUid()&&(I.W=I.getUid(),_(Yy(I)))}))}t.delete=function(){this.l=!0;for(var I=0;I"u"||Ue(_)?{}:_A(new xu(_))}).then(function(Ce){return ce.a.wb(I,Ce)}).then(function(){}))},t.Wc=function(I,_){return Ec(this,CI(this,I,_,w(this.ab,this)))},t.Vc=function(I,_){var ce=this;return Ec(this,Fo().then(function(){var Ce=_||ui(),_e=js(I,Ce);if(Ce=Su(Ce),!Ce)throw new H("argument-error","Invalid email link!");if(Ce.tenantId!==ce.T())throw new H("tenant-id-mismatch");return ce.ab(_e)}))};function L7(){}L7.prototype.render=function(){},L7.prototype.reset=function(){},L7.prototype.getResponse=function(){},L7.prototype.execute=function(){};function g4(){this.a={},this.b=1e12}var QS=null;g4.prototype.render=function(I,_){return this.a[this.b.toString()]=new eT(I,_),this.b++},g4.prototype.reset=function(I){var _=ZS(this,I);I=Wj(I),_&&I&&(_.delete(),delete this.a[I])},g4.prototype.getResponse=function(I){return(I=ZS(this,I))?I.getResponse():null},g4.prototype.execute=function(I){(I=ZS(this,I))&&I.execute()};function ZS(I,_){return(_=Wj(_))&&I.a[_]||null}function Wj(I){return(I=typeof I>"u"?1e12:I)?I.toString():null}function eT(I,_){this.g=!1,this.c=_,this.a=this.b=null,this.h=this.c.size!=="invisible",this.f=fo(I);var ce=this;this.i=function(){ce.execute()},this.h?this.execute():qn(this.f,"click",this.i)}eT.prototype.getResponse=function(){return JI(this),this.b},eT.prototype.execute=function(){JI(this);var I=this;this.a||(this.a=setTimeout(function(){I.b=DA();var _=I.c.callback,ce=I.c["expired-callback"];if(_)try{_(I.b)}catch{}I.a=setTimeout(function(){if(I.a=null,I.b=null,ce)try{ce()}catch{}I.h&&I.execute()},6e4)},500))},eT.prototype.delete=function(){JI(this),this.g=!0,clearTimeout(this.a),this.a=null,Or(this.f,"click",this.i)};function JI(I){if(I.g)throw Error("reCAPTCHA mock was already deleted!")}function KI(){}Hr(KI,"FACTOR_ID","phone");function qI(){}qI.prototype.g=function(){return QS||(QS=new g4),Fo(QS)},qI.prototype.c=function(){};var $I=null;function QI(){this.b=s.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var Wne=new Oe(xt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),Nne=new Ef(3e4,6e4);QI.prototype.g=function(I){var _=this;return new Yo(function(ce,Ce){var _e=setTimeout(function(){Ce(new H("network-request-failed"))},Nne.get());if(!s.grecaptcha||I!==_.f&&!_.b){s[_.a]=function(){if(s.grecaptcha){_.f=I;var Lt=s.grecaptcha.render;s.grecaptcha.render=function(dn,lo){return dn=Lt(dn,lo),_.b++,dn},clearTimeout(_e),ce(s.grecaptcha)}else clearTimeout(_e),Ce(new H("internal-error"));delete s[_.a]};var St=Qe(Wne,{onload:_.a,hl:I||""});Fo(_3(St)).o(function(){clearTimeout(_e),Ce(new H("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(_e),ce(s.grecaptcha)})},QI.prototype.c=function(){this.b--};var ZI=null;function ez(I,_,ce,Ce,_e,St,Lt){if(Hr(this,"type","recaptcha"),this.c=this.f=null,this.J=!1,this.v=_,this.g=null,Lt?($I||($I=new qI),Lt=$I):(ZI||(ZI=new QI),Lt=ZI),this.m=Lt,this.a=ce||{theme:"light",type:"image"},this.h=[],this.a[jj])throw new H("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i=this.a[Une]==="invisible",!s.document)throw new H("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!fo(_)||!this.i&&fo(_).hasChildNodes())throw new H("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Xe(I,St||null,_e||null),this.u=Ce||function(){return null};var dn=this;this.l=[];var lo=this.a[Nj];this.a[Nj]=function(Mi){if(Bj(dn,Mi),typeof lo=="function")lo(Mi);else if(typeof lo=="string"){var bl=ql(lo,s);typeof bl=="function"&&bl(Mi)}};var Mo=this.a[Uj];this.a[Uj]=function(){if(Bj(dn,null),typeof Mo=="function")Mo();else if(typeof Mo=="string"){var Mi=ql(Mo,s);typeof Mi=="function"&&Mi()}}}var Nj="callback",Uj="expired-callback",jj="sitekey",Une="size";function Bj(I,_){for(var ce=0;ce_e||_e>=Oj.length)throw new H("internal-error","Argument validator received an unsupported number of arguments.");ce=Oj[_e],Ce=(Ce?"":ce+" argument ")+(_.name?'"'+_.name+'" ':"")+"must be "+_.K+".";break e}Ce=null}}if(Ce)throw new H("argument-error",I+" failed: "+Ce)}var Oj="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Nr(I,_){return{name:I||"",K:"a valid string",optional:!!_,M:function(ce){return typeof ce=="string"}}}function oz(I,_){return{name:I||"",K:"a boolean",optional:!!_,M:function(ce){return typeof ce=="boolean"}}}function c0(I,_){return{name:I||"",K:"a valid object",optional:!!_,M:y}}function Y5(I,_){return{name:I||"",K:"a function",optional:!!_,M:function(ce){return typeof ce=="function"}}}function M1(I,_){return{name:I||"",K:"null",optional:!!_,M:function(ce){return ce===null}}}function Vj(){return{name:"",K:"an HTML element",optional:!1,M:function(I){return!!(I&&I instanceof Element)}}}function Bne(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(I){return!!(I&&I instanceof H1)}}}function Yne(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(I){return!!(I&&I instanceof $n.app.App)}}}function O5(I){return{name:I?I+"Credential":"credential",K:I?"a valid "+I+" credential":"a valid credential",optional:!1,M:function(_){if(!_)return!1;var ce=!I||_.providerId===I;return!(!_.ka||!ce)}}}function nT(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(I){return I?!!I.tb:!1}}}function m4(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(I){return!!(I&&I.providerId&&I.hasOwnProperty&&I.hasOwnProperty("isOAuthProvider"))}}}function rz(I,_){return y(I)&&typeof I.type=="string"&&I.type===_&&typeof I.Ha=="function"}function _j(I){return y(I)&&typeof I.uid=="string"}function Pu(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(I){return!(!I||typeof I.type!="string"||typeof I.verify!="function")}}}function rc(I,_,ce,Ce){return{name:ce||"",K:I.K+" or "+_.K,optional:!!Ce,M:function(_e){return I.M(_e)||_.M(_e)}}}function ic(I,_){for(var ce in _){var Ce=_[ce].name;I[Ce]=Xj(Ce,I[ce],_[ce].j)}}function Gj(I,_){for(var ce in _){var Ce=_[ce].name;Ce!==ce&&Object.defineProperty(I,Ce,{get:x(function(_e){return this[_e]},ce),set:x(function(_e,St,Lt,dn){Yj(_e,[Lt],[dn],!0),this[St]=dn},Ce,ce,_[ce].lb),enumerable:!0})}}function $c(I,_,ce,Ce){I[_]=Xj(_,ce,Ce)}function Xj(I,_,ce){function Ce(){var Lt=Array.prototype.slice.call(arguments);return Yj(_e,ce,Lt),_.apply(this,Lt)}if(!ce)return _;var _e=iz(I),St;for(St in _)Ce[St]=_[St];for(St in _.prototype)Ce.prototype[St]=_.prototype[St];return Ce}function iz(I){return I=I.split("."),I[I.length-1]}ic(H1.prototype,{kb:{name:"applyActionCode",j:[Nr("code")]},Sa:{name:"checkActionCode",j:[Nr("code")]},ob:{name:"confirmPasswordReset",j:[Nr("code"),Nr("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[Nr("email"),Nr("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[Nr("email")]},ra:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[Nr("emailLink")]},Hc:{name:"onAuthStateChanged",j:[rc(c0(),Y5(),"nextOrObserver"),Y5("opt_error",!0),Y5("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[rc(c0(),Y5(),"nextOrObserver"),Y5("opt_error",!0),Y5("opt_completed",!0)]},wb:{name:"sendPasswordResetEmail",j:[Nr("email"),rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]},xb:{name:"sendSignInLinkToEmail",j:[Nr("email"),c0("actionCodeSettings")]},yb:{name:"setPersistence",j:[Nr("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[O5()]},Ab:{name:"signInAnonymously",j:[]},ab:{name:"signInWithCredential",j:[O5()]},Tc:{name:"signInWithCustomToken",j:[Nr("token")]},Uc:{name:"signInWithEmailAndPassword",j:[Nr("email"),Nr("password")]},Vc:{name:"signInWithEmailLink",j:[Nr("email"),Nr("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Xc:{name:"signInWithPopup",j:[m4()]},Yc:{name:"signInWithRedirect",j:[m4()]},dd:{name:"updateCurrentUser",j:[rc(function(I){return{name:"user",K:"an instance of Firebase User",optional:!!I,M:function(_){return!!(_&&_ instanceof Nh)}}}(),M1(),"user")]},Bb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Nr(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[Nr("url"),c0("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[Nr("code")]}}),Gj(H1.prototype,{lc:{name:"languageCode",lb:rc(Nr(),M1(),"languageCode")},ti:{name:"tenantId",lb:rc(Nr(),M1(),"tenantId")}}),H1.Persistence=u4,H1.Persistence.LOCAL="local",H1.Persistence.SESSION="session",H1.Persistence.NONE="none",ic(Nh.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[oz("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[oz("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[O5()]},rb:{name:"linkWithCredential",j:[O5()]},Dc:{name:"linkWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Ec:{name:"linkWithPopup",j:[m4()]},Fc:{name:"linkWithRedirect",j:[m4()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[O5()]},ub:{name:"reauthenticateWithCredential",j:[O5()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[Nr("phoneNumber"),Pu()]},Nc:{name:"reauthenticateWithPopup",j:[m4()]},Oc:{name:"reauthenticateWithRedirect",j:[m4()]},reload:{name:"reload",j:[]},vb:{name:"sendEmailVerification",j:[rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Nr(null,!0)]},cd:{name:"unlink",j:[Nr("provider")]},Cb:{name:"updateEmail",j:[Nr("email")]},Db:{name:"updatePassword",j:[Nr("password")]},ed:{name:"updatePhoneNumber",j:[O5("phone")]},Eb:{name:"updateProfile",j:[c0("profile")]},Fb:{name:"verifyBeforeUpdateEmail",j:[Nr("email"),rc(c0("opt_actionCodeSettings",!0),M1(null,!0),"opt_actionCodeSettings",!0)]}}),ic(g4.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),ic(L7.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),ic(Yo.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Gj(mj.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",lb:oz("appVerificationDisabledForTesting")}}),ic(PI.prototype,{confirm:{name:"confirm",j:[Nr("verificationCode")]}}),$c(Cp,"fromJSON",function(I){I=typeof I=="string"?JSON.parse(I):I;for(var _,ce=[D5,Ic,nc,z5],Ce=0;Ce{const n=M(yp),o=be.useRef(null),r=m.useRef(null),i=r.current?r.current.clientWidth+40:680,a=r.current?r.current.clientHeight+100:600,[l,s]=m.useState({x:0,y:0}),c=$t(),{t:u}=Xl();m.useEffect(()=>{const g=()=>{s({x:Math.max(0,i-window.innerWidth),y:Math.min(0,window.innerHeight-a)})};return window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[]);const d=(g,A)=>{s({x:Math.max(A.x,i-window.innerWidth),y:Math.min(A.y,window.innerHeight-a)})},f=(g,A)=>{},p=()=>{dt.getState().set(g=>{g.showPublishedModelsPanel=!1})};return h.jsx(h.Fragment,{children:h.jsx(Bi,{nodeRef:o,handle:".handle",bounds:"parent",axis:"both",position:l,onDrag:d,onStop:f,children:h.jsx(cmo,{ref:o,children:h.jsxs(umo,{ref:r,children:[h.jsxs(dmo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:u("modelsMap.MyPublishedModels",c)}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{p()},onTouchStart:()=>{p()},children:u("word.Close",c)})]}),h.jsx(Dd,{rowKey:g=>g,size:"small",style:{width:"100%",direction:"ltr"},dataSource:t,scroll:{y:300},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:h.jsx(smo,{title:`${u("word.Title",c)}`,render:(g,A)=>h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n.uid&&(dt.getState().set(y=>{y.openModelsMap=!1}),e(n.uid,A))},children:A},A)},"title")})]})})})})}),{Option:Jf}=Uo,hmo=Ho.div` +`,fmo=be.memo(({publishedModels:t,openCloudFile:e})=>{const n=M(yp),o=be.useRef(null),r=m.useRef(null),i=r.current?r.current.clientWidth+40:680,a=r.current?r.current.clientHeight+100:600,[l,s]=m.useState({x:0,y:0}),c=$t(),{t:u}=Xl();m.useEffect(()=>{const g=()=>{s({x:Math.max(0,i-window.innerWidth),y:Math.min(0,window.innerHeight-a)})};return window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[]);const d=(g,A)=>{s({x:Math.max(A.x,i-window.innerWidth),y:Math.min(A.y,window.innerHeight-a)})},f=(g,A)=>{},p=()=>{dt.getState().set(g=>{g.showPublishedModelsPanel=!1})};return h.jsx(h.Fragment,{children:h.jsx(Bi,{nodeRef:o,handle:".handle",bounds:"parent",axis:"both",position:l,onDrag:d,onStop:f,children:h.jsx(cmo,{ref:o,children:h.jsxs(umo,{ref:r,children:[h.jsxs(dmo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:u("modelsMap.MyPublishedModels",c)}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{p()},onTouchStart:()=>{p()},children:u("word.Close",c)})]}),h.jsx(Dd,{rowKey:g=>g,size:"small",style:{width:"100%",direction:"ltr"},dataSource:t,scroll:{y:300},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:h.jsx(smo,{title:`${u("word.Title",c)}`,render:(g,A)=>h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n.uid&&(dt.getState().set(y=>{y.openModelsMap=!1}),e(n.uid,A))},children:A},A)},"title")})]})})})})}),{Option:Kf}=Uo,hmo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -7124,7 +7124,7 @@ Content-Type: `+c.contentType+`\r justify-content: space-between; align-items: center; cursor: move; -`,mmo=be.memo(({openCloudFile:t})=>{var w,x,b;const e=M(pn),n=dt(bh),o=M(yp),r=dt(k8t),i=dt(Y7t),a=dt(O7t),l=be.useRef(null),s=m.useRef(null),c=m.useRef(o.schoolID??sc.UNKNOWN),u=m.useRef(o.classID??Oa.UNKNOWN),d=s.current?s.current.clientWidth+40:640,f=s.current?s.current.clientHeight+100:600,[p,g]=m.useState({x:0,y:0}),A=$t();m.useEffect(()=>{const R=()=>{g({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R)}},[]);const y=(R,H)=>{g({x:Math.max(H.x,d-window.innerWidth),y:Math.min(H.y,window.innerHeight-f)})},S=(R,H)=>{},C=()=>{dt.getState().set(R=>{R.showAccountSettingsPanel=!1})},P=o&&o.email&&o.email.endsWith("intofuture.org"),v=!1,{t:T}=Xl();return h.jsxs(h.Fragment,{children:[i&&h.jsx(lmo,{likesArray:o.likes??[],openCloudFile:t}),a&&h.jsx(fmo,{publishedModels:o.published??[],openCloudFile:t}),h.jsx(Bi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:y,onStop:S,children:h.jsx(hmo,{ref:l,children:h.jsxs(pmo,{ref:s,children:[h.jsxs(gmo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:T("accountSettingsPanel.MyAccountSettings",A)+(o.anonymous?" ("+T("word.Anonymous",A)+")":"")}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{C()},onTouchStart:()=>{C()},children:T("word.Close",A)})]}),h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,onClick:()=>{o.uid&&navigator.clipboard.writeText(o.uid).then(()=>S2(T("accountSettingsPanel.IDInClipBoard",A)))},children:h.jsx(io,{title:T("accountSettingsPanel.ClickToCopyMyID",A),style:{cursor:"copy",borderRadius:"8px"},children:T("accountSettingsPanel.MyID",A)})}),h.jsx(Ke,{style:{paddingTop:"8px"},span:18,children:o.uid})]}),v,h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{style:{paddingTop:"8px"},span:6,children:T("accountSettingsPanel.SchoolID",A)}),h.jsx(Ke,{span:18,children:h.jsxs(Uo,{style:{width:"90%"},value:c.current,onChange:R=>{c.current=R,e(H=>{H.user.schoolID=R}),dt.getState().set(H=>{H.saveAccountSettingsFlag=!0})},children:[h.jsx(Jf,{value:sc.UNKNOWN,children:sc.UNKNOWN},sc.UNKNOWN),h.jsx(Jf,{value:sc.SCHOOL1,children:sc.SCHOOL1},sc.SCHOOL1),h.jsx(Jf,{value:sc.SCHOOL2,children:sc.SCHOOL2},sc.SCHOOL2),h.jsx(Jf,{value:sc.SCHOOL3,children:sc.SCHOOL3},sc.SCHOOL3),h.jsx(Jf,{value:sc.SCHOOL4,children:sc.SCHOOL4},sc.SCHOOL4),h.jsx(Jf,{value:sc.SCHOOL5,children:sc.SCHOOL5},sc.SCHOOL5)]})})]}),h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{style:{paddingTop:"8px"},span:6,children:T("accountSettingsPanel.ClassID",A)}),h.jsx(Ke,{span:18,children:h.jsxs(Uo,{style:{width:"90%"},value:u.current,onChange:R=>{u.current=R,e(H=>{H.user.classID=R}),dt.getState().set(H=>{H.saveAccountSettingsFlag=!0})},children:[h.jsx(Jf,{value:Oa.UNKNOWN,children:Oa.UNKNOWN},Oa.UNKNOWN),h.jsx(Jf,{value:Oa.CLASS1,children:Oa.CLASS1},Oa.CLASS1),h.jsx(Jf,{value:Oa.CLASS2,children:Oa.CLASS2},Oa.CLASS2),h.jsx(Jf,{value:Oa.CLASS3,children:Oa.CLASS3},Oa.CLASS3),h.jsx(Jf,{value:Oa.CLASS4,children:Oa.CLASS4},Oa.CLASS4),h.jsx(Jf,{value:Oa.CLASS5,children:Oa.CLASS5},Oa.CLASS5),h.jsx(Jf,{value:Oa.CLASS6,children:Oa.CLASS6},Oa.CLASS6),h.jsx(Jf,{value:Oa.CLASS7,children:Oa.CLASS7},Oa.CLASS7),h.jsx(Jf,{value:Oa.CLASS8,children:Oa.CLASS8},Oa.CLASS8),h.jsx(Jf,{value:Oa.CLASS9,children:Oa.CLASS9},Oa.CLASS9)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.AllPublished",A)}),h.jsx(Ke,{span:18,children:h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n("showPublishedModelsPanel",!0)},children:((w=o.published)==null?void 0:w.length)??0})})]}),h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.PublishedUnderAliases",A)}),h.jsx(Ke,{span:18,children:h.jsx("span",{style:{fontSize:"10px"},children:(x=o.aliases)==null?void 0:x.map((R,H)=>o.aliases?R+(H{n("showLikesPanel",!0)},children:((b=o.likes)==null?void 0:b.length)??0})})]}),P&&h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.UserCount",A)}),h.jsx(Ke,{span:18,children:r})]})]})})})]})});function Vk(t){"@babel/helpers - typeof";return Vk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vk(t)}function ymo(t,e){if(Vk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(Vk(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Amo(t){var e=ymo(t,"string");return Vk(e)=="symbol"?e:e+""}function ho(t,e,n){return(e=Amo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wrt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qae,NHe;function wmo(){if(NHe)return Qae;NHe=1;var t=function(n,o,r,i,a,l,s,c){if(!n){var u;if(o===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,i,a,l,s,c],f=0;u=new Error(o.replace(/%s/g,function(){return d[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return Qae=t,Qae}var vmo=wmo(),Gu=Wrt(vmo),Ta=m.createContext(null);function xmo(){Gu(!!m.useContext,"useGoogleMap is React hook and requires React version 16.8+");var t=m.useContext(Ta);return Gu(!!t,"useGoogleMap needs a GoogleMap available up in the tree"),t}function bmo(t,e,n){return Object.keys(t).reduce(function(r,i){return e(r,t[i],i)},n)}function Smo(t,e){Object.keys(t).forEach(n=>e(t[n],n))}function Tmo(t,e,n,o){var r={},i=(a,l)=>{var s=n[l];s!==e[l]&&(r[l]=s,a(o,s))};return Smo(t,i),r}function Pmo(t,e,n){var o=bmo(n,function(i,a,l){return typeof t[l]=="function"&&i.push(google.maps.event.addListener(e,a,t[l])),i},[]);return o}function Cmo(t){google.maps.event.removeListener(t)}function Ga(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(Cmo)}function Ua(t){var{updaterMap:e,eventMap:n,prevProps:o,nextProps:r,instance:i}=t,a=Pmo(r,i,n);return Tmo(e,o,r,i),a}var UHe={onDblClick:"dblclick",onDragEnd:"dragend",onDragStart:"dragstart",onMapTypeIdChanged:"maptypeid_changed",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseDown:"mousedown",onMouseUp:"mouseup",onRightClick:"rightclick",onTilesLoaded:"tilesloaded",onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onDrag:"drag",onHeadingChanged:"heading_changed",onIdle:"idle",onProjectionChanged:"projection_changed",onResize:"resize",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed"},jHe={extraMapTypes(t,e){e.forEach(function(o,r){t.mapTypes.set(String(r),o)})},center(t,e){t.setCenter(e)},clickableIcons(t,e){t.setClickableIcons(e)},heading(t,e){t.setHeading(e)},mapTypeId(t,e){t.setMapTypeId(e)},options(t,e){t.setOptions(e)},streetView(t,e){t.setStreetView(e)},tilt(t,e){t.setTilt(e)},zoom(t,e){t.setZoom(e)}};function Rmo(t){var{children:e,options:n,id:o,mapContainerStyle:r,mapContainerClassName:i,center:a,onClick:l,onDblClick:s,onDrag:c,onDragEnd:u,onDragStart:d,onMouseMove:f,onMouseOut:p,onMouseOver:g,onMouseDown:A,onMouseUp:y,onRightClick:S,onCenterChanged:C,onLoad:P,onUnmount:v}=t,[T,w]=m.useState(null),x=m.useRef(null),[b,R]=m.useState(null),[H,F]=m.useState(null),[E,N]=m.useState(null),[U,W]=m.useState(null),[k,D]=m.useState(null),[L,j]=m.useState(null),[B,O]=m.useState(null),[V,G]=m.useState(null),[q,$]=m.useState(null),[ie,Q]=m.useState(null),[se,Z]=m.useState(null),[ee,te]=m.useState(null);return m.useEffect(()=>{n&&T!==null&&T.setOptions(n)},[T,n]),m.useEffect(()=>{T!==null&&typeof a<"u"&&T.setCenter(a)},[T,a]),m.useEffect(()=>{T&&s&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(T,"dblclick",s)))},[s]),m.useEffect(()=>{T&&u&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(T,"dragend",u)))},[u]),m.useEffect(()=>{T&&d&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(T,"dragstart",d)))},[d]),m.useEffect(()=>{T&&A&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(T,"mousedown",A)))},[A]),m.useEffect(()=>{T&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(T,"mousemove",f)))},[f]),m.useEffect(()=>{T&&p&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(T,"mouseout",p)))},[p]),m.useEffect(()=>{T&&g&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(T,"mouseover",g)))},[g]),m.useEffect(()=>{T&&y&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(T,"mouseup",y)))},[y]),m.useEffect(()=>{T&&S&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(T,"rightclick",S)))},[S]),m.useEffect(()=>{T&&l&&(se!==null&&google.maps.event.removeListener(se),Z(google.maps.event.addListener(T,"click",l)))},[l]),m.useEffect(()=>{T&&c&&(ee!==null&&google.maps.event.removeListener(ee),te(google.maps.event.addListener(T,"drag",c)))},[c]),m.useEffect(()=>{T&&C&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(T,"center_changed",C)))},[l]),m.useEffect(()=>{var oe=x.current===null?null:new google.maps.Map(x.current,n);return w(oe),oe!==null&&P&&P(oe),()=>{oe!==null&&v&&v(oe)}},[]),h.jsx("div",{id:o,ref:x,style:r,className:i,children:h.jsx(Ta.Provider,{value:T,children:T!==null?e:null})})}m.memo(Rmo);class Nrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{map:null}),ho(this,"registeredEvents",[]),ho(this,"mapRef",null),ho(this,"getInstance",()=>this.mapRef===null?null:new google.maps.Map(this.mapRef,this.props.options)),ho(this,"panTo",e=>{var n=this.getInstance();n&&n.panTo(e)}),ho(this,"setMapCallback",()=>{this.state.map!==null&&this.props.onLoad&&this.props.onLoad(this.state.map)}),ho(this,"getRef",e=>{this.mapRef=e})}componentDidMount(){var e=this.getInstance();this.registeredEvents=Ua({updaterMap:jHe,eventMap:UHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{map:e}},this.setMapCallback)}componentDidUpdate(e){this.state.map!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:jHe,eventMap:UHe,prevProps:e,nextProps:this.props,instance:this.state.map}))}componentWillUnmount(){this.state.map!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.map),Ga(this.registeredEvents))}render(){return h.jsx("div",{id:this.props.id,ref:this.getRef,style:this.props.mapContainerStyle,className:this.props.mapContainerClassName,children:h.jsx(Ta.Provider,{value:this.state.map,children:this.state.map!==null?this.props.children:null})})}}function BHe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){return void n(c)}l.done?e(s):Promise.resolve(s).then(o,r)}function Urt(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){BHe(i,o,r,a,l,"next",s)}function l(s){BHe(i,o,r,a,l,"throw",s)}a(void 0)})}}function jrt(t){var{googleMapsApiKey:e,googleMapsClientId:n,version:o="weekly",language:r,region:i,libraries:a,channel:l,mapIds:s,authReferrerPolicy:c}=t,u=[];return Gu(e&&n||!(e&&n),"You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time."),e?u.push("key=".concat(e)):n&&u.push("client=".concat(n)),o&&u.push("v=".concat(o)),r&&u.push("language=".concat(r)),i&&u.push("region=".concat(i)),a&&a.length&&u.push("libraries=".concat(a.sort().join(","))),l&&u.push("channel=".concat(l)),s&&s.length&&u.push("map_ids=".concat(s.join(","))),c&&u.push("auth_referrer_policy=".concat(c)),u.push("loading=async"),u.push("callback=initMap"),"https://maps.googleapis.com/maps/api/js?".concat(u.join("&"))}var C8=typeof document<"u";function Brt(t){var{url:e,id:n,nonce:o}=t;return C8?new Promise(function(i,a){var l=document.getElementById(n),s=window;if(l){var c=l.getAttribute("data-state");if(l.src===e&&c!=="error"){if(c==="ready")return i(n);var u=s.initMap,d=l.onerror;s.initMap=function(){u&&u(),i(n)},l.onerror=function(p){d&&d(p),a(p)};return}else l.remove()}var f=document.createElement("script");f.type="text/javascript",f.src=e,f.id=n,f.async=!0,f.nonce=o||"",f.onerror=function(g){f.setAttribute("data-state","error"),a(g)},s.initMap=function(){f.setAttribute("data-state","ready"),i(n)},document.head.appendChild(f)}).catch(r=>{throw console.error("injectScript error: ",r),r}):Promise.reject(new Error("document is undefined"))}function YHe(t){var e=t.href;return e&&(e.indexOf("https://fonts.googleapis.com/css?family=Roboto")===0||e.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text")===0)?!0:t.tagName.toLowerCase()==="style"&&t.styleSheet&&t.styleSheet.cssText&&t.styleSheet.cssText.replace(`\r +`,mmo=be.memo(({openCloudFile:t})=>{var w,x,b;const e=M(pn),n=dt(Rf),o=M(yp),r=dt(k8t),i=dt(Y7t),a=dt(O7t),l=be.useRef(null),s=m.useRef(null),c=m.useRef(o.schoolID??sc.UNKNOWN),u=m.useRef(o.classID??Oa.UNKNOWN),d=s.current?s.current.clientWidth+40:640,f=s.current?s.current.clientHeight+100:600,[p,g]=m.useState({x:0,y:0}),A=$t();m.useEffect(()=>{const R=()=>{g({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R)}},[]);const y=(R,H)=>{g({x:Math.max(H.x,d-window.innerWidth),y:Math.min(H.y,window.innerHeight-f)})},S=(R,H)=>{},C=()=>{dt.getState().set(R=>{R.showAccountSettingsPanel=!1})},P=o&&o.email&&o.email.endsWith("intofuture.org"),v=!1,{t:T}=Xl();return h.jsxs(h.Fragment,{children:[i&&h.jsx(lmo,{likesArray:o.likes??[],openCloudFile:t}),a&&h.jsx(fmo,{publishedModels:o.published??[],openCloudFile:t}),h.jsx(Bi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:y,onStop:S,children:h.jsx(hmo,{ref:l,children:h.jsxs(pmo,{ref:s,children:[h.jsxs(gmo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:T("accountSettingsPanel.MyAccountSettings",A)+(o.anonymous?" ("+T("word.Anonymous",A)+")":"")}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{C()},onTouchStart:()=>{C()},children:T("word.Close",A)})]}),h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,onClick:()=>{o.uid&&navigator.clipboard.writeText(o.uid).then(()=>S2(T("accountSettingsPanel.IDInClipBoard",A)))},children:h.jsx(io,{title:T("accountSettingsPanel.ClickToCopyMyID",A),style:{cursor:"copy",borderRadius:"8px"},children:T("accountSettingsPanel.MyID",A)})}),h.jsx(Ke,{style:{paddingTop:"8px"},span:18,children:o.uid})]}),v,h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{style:{paddingTop:"8px"},span:6,children:T("accountSettingsPanel.SchoolID",A)}),h.jsx(Ke,{span:18,children:h.jsxs(Uo,{style:{width:"90%"},value:c.current,onChange:R=>{c.current=R,e(H=>{H.user.schoolID=R}),dt.getState().set(H=>{H.saveAccountSettingsFlag=!0})},children:[h.jsx(Kf,{value:sc.UNKNOWN,children:sc.UNKNOWN},sc.UNKNOWN),h.jsx(Kf,{value:sc.SCHOOL1,children:sc.SCHOOL1},sc.SCHOOL1),h.jsx(Kf,{value:sc.SCHOOL2,children:sc.SCHOOL2},sc.SCHOOL2),h.jsx(Kf,{value:sc.SCHOOL3,children:sc.SCHOOL3},sc.SCHOOL3),h.jsx(Kf,{value:sc.SCHOOL4,children:sc.SCHOOL4},sc.SCHOOL4),h.jsx(Kf,{value:sc.SCHOOL5,children:sc.SCHOOL5},sc.SCHOOL5)]})})]}),h.jsxs(nn,{gutter:20,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{style:{paddingTop:"8px"},span:6,children:T("accountSettingsPanel.ClassID",A)}),h.jsx(Ke,{span:18,children:h.jsxs(Uo,{style:{width:"90%"},value:u.current,onChange:R=>{u.current=R,e(H=>{H.user.classID=R}),dt.getState().set(H=>{H.saveAccountSettingsFlag=!0})},children:[h.jsx(Kf,{value:Oa.UNKNOWN,children:Oa.UNKNOWN},Oa.UNKNOWN),h.jsx(Kf,{value:Oa.CLASS1,children:Oa.CLASS1},Oa.CLASS1),h.jsx(Kf,{value:Oa.CLASS2,children:Oa.CLASS2},Oa.CLASS2),h.jsx(Kf,{value:Oa.CLASS3,children:Oa.CLASS3},Oa.CLASS3),h.jsx(Kf,{value:Oa.CLASS4,children:Oa.CLASS4},Oa.CLASS4),h.jsx(Kf,{value:Oa.CLASS5,children:Oa.CLASS5},Oa.CLASS5),h.jsx(Kf,{value:Oa.CLASS6,children:Oa.CLASS6},Oa.CLASS6),h.jsx(Kf,{value:Oa.CLASS7,children:Oa.CLASS7},Oa.CLASS7),h.jsx(Kf,{value:Oa.CLASS8,children:Oa.CLASS8},Oa.CLASS8),h.jsx(Kf,{value:Oa.CLASS9,children:Oa.CLASS9},Oa.CLASS9)]})})]}),h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.AllPublished",A)}),h.jsx(Ke,{span:18,children:h.jsx("span",{style:{cursor:"pointer"},onClick:()=>{n("showPublishedModelsPanel",!0)},children:((w=o.published)==null?void 0:w.length)??0})})]}),h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.PublishedUnderAliases",A)}),h.jsx(Ke,{span:18,children:h.jsx("span",{style:{fontSize:"10px"},children:(x=o.aliases)==null?void 0:x.map((R,H)=>o.aliases?R+(H{n("showLikesPanel",!0)},children:((b=o.likes)==null?void 0:b.length)??0})})]}),P&&h.jsxs(nn,{gutter:6,style:{paddingTop:"20px",paddingLeft:"20px",direction:"ltr"},children:[h.jsx(Ke,{span:6,children:T("accountSettingsPanel.UserCount",A)}),h.jsx(Ke,{span:18,children:r})]})]})})})]})});function Vk(t){"@babel/helpers - typeof";return Vk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vk(t)}function ymo(t,e){if(Vk(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e||"default");if(Vk(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Amo(t){var e=ymo(t,"string");return Vk(e)=="symbol"?e:e+""}function ho(t,e,n){return(e=Amo(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wrt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qae,NHe;function wmo(){if(NHe)return Qae;NHe=1;var t=function(n,o,r,i,a,l,s,c){if(!n){var u;if(o===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[r,i,a,l,s,c],f=0;u=new Error(o.replace(/%s/g,function(){return d[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return Qae=t,Qae}var vmo=wmo(),Gu=Wrt(vmo),Ta=m.createContext(null);function xmo(){Gu(!!m.useContext,"useGoogleMap is React hook and requires React version 16.8+");var t=m.useContext(Ta);return Gu(!!t,"useGoogleMap needs a GoogleMap available up in the tree"),t}function bmo(t,e,n){return Object.keys(t).reduce(function(r,i){return e(r,t[i],i)},n)}function Smo(t,e){Object.keys(t).forEach(n=>e(t[n],n))}function Tmo(t,e,n,o){var r={},i=(a,l)=>{var s=n[l];s!==e[l]&&(r[l]=s,a(o,s))};return Smo(t,i),r}function Pmo(t,e,n){var o=bmo(n,function(i,a,l){return typeof t[l]=="function"&&i.push(google.maps.event.addListener(e,a,t[l])),i},[]);return o}function Cmo(t){google.maps.event.removeListener(t)}function Ga(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];t.forEach(Cmo)}function Ua(t){var{updaterMap:e,eventMap:n,prevProps:o,nextProps:r,instance:i}=t,a=Pmo(r,i,n);return Tmo(e,o,r,i),a}var UHe={onDblClick:"dblclick",onDragEnd:"dragend",onDragStart:"dragstart",onMapTypeIdChanged:"maptypeid_changed",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseDown:"mousedown",onMouseUp:"mouseup",onRightClick:"rightclick",onTilesLoaded:"tilesloaded",onBoundsChanged:"bounds_changed",onCenterChanged:"center_changed",onClick:"click",onDrag:"drag",onHeadingChanged:"heading_changed",onIdle:"idle",onProjectionChanged:"projection_changed",onResize:"resize",onTiltChanged:"tilt_changed",onZoomChanged:"zoom_changed"},jHe={extraMapTypes(t,e){e.forEach(function(o,r){t.mapTypes.set(String(r),o)})},center(t,e){t.setCenter(e)},clickableIcons(t,e){t.setClickableIcons(e)},heading(t,e){t.setHeading(e)},mapTypeId(t,e){t.setMapTypeId(e)},options(t,e){t.setOptions(e)},streetView(t,e){t.setStreetView(e)},tilt(t,e){t.setTilt(e)},zoom(t,e){t.setZoom(e)}};function Rmo(t){var{children:e,options:n,id:o,mapContainerStyle:r,mapContainerClassName:i,center:a,onClick:l,onDblClick:s,onDrag:c,onDragEnd:u,onDragStart:d,onMouseMove:f,onMouseOut:p,onMouseOver:g,onMouseDown:A,onMouseUp:y,onRightClick:S,onCenterChanged:C,onLoad:P,onUnmount:v}=t,[T,w]=m.useState(null),x=m.useRef(null),[b,R]=m.useState(null),[H,F]=m.useState(null),[E,N]=m.useState(null),[U,W]=m.useState(null),[k,D]=m.useState(null),[L,j]=m.useState(null),[B,O]=m.useState(null),[V,G]=m.useState(null),[q,$]=m.useState(null),[ie,Q]=m.useState(null),[se,oe]=m.useState(null),[Z,te]=m.useState(null);return m.useEffect(()=>{n&&T!==null&&T.setOptions(n)},[T,n]),m.useEffect(()=>{T!==null&&typeof a<"u"&&T.setCenter(a)},[T,a]),m.useEffect(()=>{T&&s&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(T,"dblclick",s)))},[s]),m.useEffect(()=>{T&&u&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(T,"dragend",u)))},[u]),m.useEffect(()=>{T&&d&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(T,"dragstart",d)))},[d]),m.useEffect(()=>{T&&A&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(T,"mousedown",A)))},[A]),m.useEffect(()=>{T&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(T,"mousemove",f)))},[f]),m.useEffect(()=>{T&&p&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(T,"mouseout",p)))},[p]),m.useEffect(()=>{T&&g&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(T,"mouseover",g)))},[g]),m.useEffect(()=>{T&&y&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(T,"mouseup",y)))},[y]),m.useEffect(()=>{T&&S&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(T,"rightclick",S)))},[S]),m.useEffect(()=>{T&&l&&(se!==null&&google.maps.event.removeListener(se),oe(google.maps.event.addListener(T,"click",l)))},[l]),m.useEffect(()=>{T&&c&&(Z!==null&&google.maps.event.removeListener(Z),te(google.maps.event.addListener(T,"drag",c)))},[c]),m.useEffect(()=>{T&&C&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(T,"center_changed",C)))},[l]),m.useEffect(()=>{var ee=x.current===null?null:new google.maps.Map(x.current,n);return w(ee),ee!==null&&P&&P(ee),()=>{ee!==null&&v&&v(ee)}},[]),h.jsx("div",{id:o,ref:x,style:r,className:i,children:h.jsx(Ta.Provider,{value:T,children:T!==null?e:null})})}m.memo(Rmo);class Nrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{map:null}),ho(this,"registeredEvents",[]),ho(this,"mapRef",null),ho(this,"getInstance",()=>this.mapRef===null?null:new google.maps.Map(this.mapRef,this.props.options)),ho(this,"panTo",e=>{var n=this.getInstance();n&&n.panTo(e)}),ho(this,"setMapCallback",()=>{this.state.map!==null&&this.props.onLoad&&this.props.onLoad(this.state.map)}),ho(this,"getRef",e=>{this.mapRef=e})}componentDidMount(){var e=this.getInstance();this.registeredEvents=Ua({updaterMap:jHe,eventMap:UHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{map:e}},this.setMapCallback)}componentDidUpdate(e){this.state.map!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:jHe,eventMap:UHe,prevProps:e,nextProps:this.props,instance:this.state.map}))}componentWillUnmount(){this.state.map!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.map),Ga(this.registeredEvents))}render(){return h.jsx("div",{id:this.props.id,ref:this.getRef,style:this.props.mapContainerStyle,className:this.props.mapContainerClassName,children:h.jsx(Ta.Provider,{value:this.state.map,children:this.state.map!==null?this.props.children:null})})}}function BHe(t,e,n,o,r,i,a){try{var l=t[i](a),s=l.value}catch(c){return void n(c)}l.done?e(s):Promise.resolve(s).then(o,r)}function Urt(t){return function(){var e=this,n=arguments;return new Promise(function(o,r){var i=t.apply(e,n);function a(s){BHe(i,o,r,a,l,"next",s)}function l(s){BHe(i,o,r,a,l,"throw",s)}a(void 0)})}}function jrt(t){var{googleMapsApiKey:e,googleMapsClientId:n,version:o="weekly",language:r,region:i,libraries:a,channel:l,mapIds:s,authReferrerPolicy:c}=t,u=[];return Gu(e&&n||!(e&&n),"You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time."),e?u.push("key=".concat(e)):n&&u.push("client=".concat(n)),o&&u.push("v=".concat(o)),r&&u.push("language=".concat(r)),i&&u.push("region=".concat(i)),a&&a.length&&u.push("libraries=".concat(a.sort().join(","))),l&&u.push("channel=".concat(l)),s&&s.length&&u.push("map_ids=".concat(s.join(","))),c&&u.push("auth_referrer_policy=".concat(c)),u.push("loading=async"),u.push("callback=initMap"),"https://maps.googleapis.com/maps/api/js?".concat(u.join("&"))}var C8=typeof document<"u";function Brt(t){var{url:e,id:n,nonce:o}=t;return C8?new Promise(function(i,a){var l=document.getElementById(n),s=window;if(l){var c=l.getAttribute("data-state");if(l.src===e&&c!=="error"){if(c==="ready")return i(n);var u=s.initMap,d=l.onerror;s.initMap=function(){u&&u(),i(n)},l.onerror=function(p){d&&d(p),a(p)};return}else l.remove()}var f=document.createElement("script");f.type="text/javascript",f.src=e,f.id=n,f.async=!0,f.nonce=o||"",f.onerror=function(g){f.setAttribute("data-state","error"),a(g)},s.initMap=function(){f.setAttribute("data-state","ready"),i(n)},document.head.appendChild(f)}).catch(r=>{throw console.error("injectScript error: ",r),r}):Promise.reject(new Error("document is undefined"))}function YHe(t){var e=t.href;return e&&(e.indexOf("https://fonts.googleapis.com/css?family=Roboto")===0||e.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text")===0)?!0:t.tagName.toLowerCase()==="style"&&t.styleSheet&&t.styleSheet.cssText&&t.styleSheet.cssText.replace(`\r `,"").indexOf(".gm-style")===0?(t.styleSheet.cssText="",!0):t.tagName.toLowerCase()==="style"&&t.innerHTML&&t.innerHTML.replace(`\r `,"").indexOf(".gm-style")===0?(t.innerHTML="",!0):t.tagName.toLowerCase()==="style"&&!t.styleSheet&&!t.innerHTML}function W9e(){var t=document.getElementsByTagName("head")[0];if(t){var e=t.insertBefore.bind(t);t.insertBefore=function(r,i){return YHe(r)||Reflect.apply(e,t,[r,i]),r};var n=t.appendChild.bind(t);t.appendChild=function(r){return YHe(r)||Reflect.apply(n,t,[r]),r}}}var rD=!1;function Yrt(){return h.jsx("div",{children:"Loading..."})}var _k={id:"script-loader",version:"weekly"};class Hmo extends m.PureComponent{constructor(){super(...arguments),ho(this,"check",m.createRef()),ho(this,"state",{loaded:!1}),ho(this,"cleanupCallback",()=>{delete window.google.maps,this.injectScript()}),ho(this,"isCleaningUp",Urt(function*(){function e(n){if(!rD)n();else if(C8)var o=window.setInterval(function(){rD||(window.clearInterval(o),n())},1)}return new Promise(e)})),ho(this,"cleanup",()=>{rD=!0;var e=document.getElementById(this.props.id);e&&e.parentNode&&e.parentNode.removeChild(e),Array.prototype.slice.call(document.getElementsByTagName("script")).filter(function(o){return typeof o.src=="string"&&o.src.includes("maps.googleapis")}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)}),Array.prototype.slice.call(document.getElementsByTagName("link")).filter(function(o){return o.href==="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans"}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)}),Array.prototype.slice.call(document.getElementsByTagName("style")).filter(function(o){return o.innerText!==void 0&&o.innerText.length>0&&o.innerText.includes(".gm-")}).forEach(function(o){o.parentNode&&o.parentNode.removeChild(o)})}),ho(this,"injectScript",()=>{this.props.preventGoogleFontsLoading&&W9e(),Gu(!!this.props.id,'LoadScript requires "id" prop to be a string: %s',this.props.id);var e={id:this.props.id,nonce:this.props.nonce,url:jrt(this.props)};Brt(e).then(()=>{this.props.onLoad&&this.props.onLoad(),this.setState(function(){return{loaded:!0}})}).catch(n=>{this.props.onError&&this.props.onError(n),console.error(` There has been an Error with loading Google Maps API script, please check that you provided correct google API key (`.concat(this.props.googleMapsApiKey||"-",") or Client ID (").concat(this.props.googleMapsClientId||"-",`) to @@ -7132,7 +7132,7 @@ Content-Type: `+c.contentType+`\r `))})})}componentDidMount(){if(C8){if(window.google&&window.google.maps&&!rD){console.error("google api is already presented");return}this.isCleaningUp().then(this.injectScript).catch(function(n){console.error("Error at injecting script after cleaning up: ",n)})}}componentDidUpdate(e){this.props.libraries!==e.libraries&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),C8&&e.language!==this.props.language&&(this.cleanup(),this.setState(function(){return{loaded:!1}},this.cleanupCallback))}componentWillUnmount(){if(C8){this.cleanup();var e=()=>{this.check.current||(delete window.google,rD=!1)};window.setTimeout(e,1),this.props.onUnmount&&this.props.onUnmount()}}render(){return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:this.check}),this.state.loaded?this.props.children:this.props.loadingElement||h.jsx(Yrt,{})]})}}ho(Hmo,"defaultProps",_k);function Mmo(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.includes(o))continue;n[o]=t[o]}return n}function N9e(t,e){if(t==null)return{};var n,o,r=Mmo(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o{p.current=!1}},[]),m.useEffect(function(){C8&&c&&W9e()},[c]),m.useEffect(function(){g&&Gu(!!window.google,"useLoadScript was marked as loaded, but window.google is not present. Something went wrong.")},[g]);var C=jrt({version:n,googleMapsApiKey:r,googleMapsClientId:i,language:a,region:l,libraries:s,channel:u,mapIds:d,authReferrerPolicy:f});m.useEffect(function(){if(!C8)return;function T(){p.current&&(A(!0),OHe=C)}if(window.google&&window.google.maps&&OHe===C){T();return}Brt({id:e,url:C,nonce:o}).then(T).catch(function(x){p.current&&S(x),console.warn(` There has been an Error with loading Google Maps API script, please check that you provided correct google API key (`.concat(r||"-",") or Client ID (").concat(i||"-",`) Otherwise it is a Network issue. - `)),console.error(x)})},[e,C,o]);var P=m.useRef();return m.useEffect(function(){P.current&&s!==P.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),P.current=s},[s]),{isLoaded:g,loadError:y,url:C}}var zmo=["loadingElement","onLoad","onError","onUnmount","children"],Dmo=h.jsx(Yrt,{});function Emo(t){var{loadingElement:e,onLoad:n,onError:o,onUnmount:r,children:i}=t,a=N9e(t,zmo),{isLoaded:l,loadError:s}=Imo(a);return m.useEffect(function(){l&&typeof n=="function"&&n()},[l,n]),m.useEffect(function(){s&&typeof o=="function"&&o(s)},[s,o]),m.useEffect(function(){return()=>{r&&r()}},[r]),l?i:e||Dmo}m.memo(Emo);function Fmo(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,[])).next())})}function kmo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lmo=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Wmo=kmo(Lmo),VHe="__googleMapsScriptId",hC;(function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"})(hC||(hC={}));class Mv{constructor(e){var{apiKey:n,authReferrerPolicy:o,channel:r,client:i,id:a=VHe,language:l,libraries:s=[],mapIds:c,nonce:u,region:d,retries:f=3,url:p="https://maps.googleapis.com/maps/api/js",version:g}=e;if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=n,this.authReferrerPolicy=o,this.channel=r,this.client=i,this.id=a||VHe,this.language=l,this.libraries=s,this.mapIds=c,this.nonce=u,this.region=d,this.retries=f,this.url=p,this.version=g,Mv.instance){if(!Wmo(this.options,Mv.instance.options))throw new Error("Loader must not be called again with different options. ".concat(JSON.stringify(this.options)," !== ").concat(JSON.stringify(Mv.instance.options)));return Mv.instance}Mv.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?hC.FAILURE:this.done?hC.SUCCESS:this.loading?hC.LOADING:hC.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){var e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+="&key=".concat(this.apiKey)),this.channel&&(e+="&channel=".concat(this.channel)),this.client&&(e+="&client=".concat(this.client)),this.libraries.length>0&&(e+="&libraries=".concat(this.libraries.join(","))),this.language&&(e+="&language=".concat(this.language)),this.region&&(e+="®ion=".concat(this.region)),this.version&&(e+="&v=".concat(this.version)),this.mapIds&&(e+="&map_ids=".concat(this.mapIds.join(","))),this.authReferrerPolicy&&(e+="&auth_referrer_policy=".concat(this.authReferrerPolicy)),e}deleteScript(){var e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,n)=>{this.loadCallback(o=>{o?n(o.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,n;if(document.getElementById(this.id)){this.callback();return}var o={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(o).forEach(i=>!o[i]&&delete o[i]),!((n=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||n===void 0)&&n.importLibrary||(i=>{var a,l,s,c="The Google Maps JavaScript API",u="google",d="importLibrary",f="__ib__",p=document,g=window;g=g[u]||(g[u]={});var A=g.maps||(g.maps={}),y=new Set,S=new URLSearchParams,C=()=>a||(a=new Promise((P,v)=>Fmo(this,void 0,void 0,function*(){var T;yield l=p.createElement("script"),l.id=this.id,S.set("libraries",[...y]+"");for(s in i)S.set(s.replace(/[A-Z]/g,w=>"_"+w[0].toLowerCase()),i[s]);S.set("callback",u+".maps."+f),l.src=this.url+"?"+S,A[f]=P,l.onerror=()=>a=v(Error(c+" could not load.")),l.nonce=this.nonce||((T=p.querySelector("script[nonce]"))===null||T===void 0?void 0:T.nonce)||"",p.head.append(l)})));A[d]?console.warn(c+" only loads once. Ignoring:",i):A[d]=function(P){for(var v=arguments.length,T=new Array(v>1?v-1:0),w=1;wA[d](P,...T))}})(o);var r=this.libraries.map(i=>this.importLibrary(i));r.length||r.push(this.importLibrary("core")),Promise.all(r).then(()=>this.callback(),i=>{var a=new ErrorEvent("error",{error:i});this.loadErrorCallback(a)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){var n=this.errors.length*Math.pow(2,this.errors.length);console.error("Failed to load Google Maps script, retrying in ".concat(n," ms.")),setTimeout(()=>{this.deleteScript(),this.setScript()},n)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}var Nmo=["maps"];function Ort(t){var{id:e=_k.id,version:n=_k.version,nonce:o,googleMapsApiKey:r,language:i,region:a,libraries:l=Nmo,preventGoogleFontsLoading:s,mapIds:c,authReferrerPolicy:u}=t,d=m.useRef(!1),[f,p]=m.useState(!1),[g,A]=m.useState(void 0);m.useEffect(function(){return d.current=!0,()=>{d.current=!1}},[]);var y=m.useMemo(()=>new Mv({id:e,apiKey:r,version:n,libraries:l,language:i||"en",region:a||"US",mapIds:c||[],nonce:o||"",authReferrerPolicy:u||"origin"}),[e,r,n,l,i,a,c,o,u]);m.useEffect(function(){f||y.load().then(()=>{d.current&&p(!0)}).catch(P=>{A(P)})},[]),m.useEffect(()=>{C8&&s&&W9e()},[s]);var S=m.useRef();return m.useEffect(()=>{S.current&&l!==S.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),S.current=l},[l]),{isLoaded:f,loadError:g}}function _He(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function dJ(t){for(var e=1;e{i!==null&&i.setMap(r)},[r]),m.useEffect(()=>{e&&i!==null&&i.setOptions(e)},[i,e]),m.useEffect(()=>{var l=new google.maps.TrafficLayer(dJ(dJ({},e),{},{map:r}));return a(l),n&&n(l),()=>{i!==null&&(o&&o(i),i.setMap(null))}},[]),null}m.memo(Umo);class jmo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{trafficLayer:null}),ho(this,"setTrafficLayerCallback",()=>{this.state.trafficLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)}),ho(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(dJ(dJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:XHe,eventMap:GHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{trafficLayer:e}},this.setTrafficLayerCallback)}componentDidUpdate(e){this.state.trafficLayer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:XHe,eventMap:GHe,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){this.state.trafficLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),Ga(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}ho(jmo,"contextType",Ta);function Bmo(t){var{onLoad:e,onUnmount:n}=t,o=m.useContext(Ta),[r,i]=m.useState(null);return m.useEffect(()=>{r!==null&&r.setMap(o)},[o]),m.useEffect(()=>{var a=new google.maps.BicyclingLayer;return i(a),a.setMap(o),e&&e(a),()=>{a!==null&&(n&&n(a),a.setMap(null))}},[]),null}m.memo(Bmo);class Ymo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{bicyclingLayer:null}),ho(this,"setBicyclingLayerCallback",()=>{this.state.bicyclingLayer!==null&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))})}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState(()=>({bicyclingLayer:e}),this.setBicyclingLayerCallback)}componentWillUnmount(){this.state.bicyclingLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}ho(Ymo,"contextType",Ta);function Omo(t){var{onLoad:e,onUnmount:n}=t,o=m.useContext(Ta),[r,i]=m.useState(null);return m.useEffect(()=>{r!==null&&r.setMap(o)},[o]),m.useEffect(()=>{var a=new google.maps.TransitLayer;return i(a),a.setMap(o),e&&e(a),()=>{r!==null&&(n&&n(r),r.setMap(null))}},[]),null}m.memo(Omo);class Vmo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{transitLayer:null}),ho(this,"setTransitLayerCallback",()=>{this.state.transitLayer!==null&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))})}componentDidMount(){var e=new google.maps.TransitLayer;this.setState(function(){return{transitLayer:e}},this.setTransitLayerCallback)}componentWillUnmount(){this.state.transitLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}ho(Vmo,"contextType",Ta);function JHe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fJ(t){for(var e=1;e{f!==null&&f.setMap(d)},[d]),m.useEffect(()=>{e&&f!==null&&f.setOptions(e)},[f,e]),m.useEffect(()=>{f!==null&&f.setDrawingMode(n??null)},[f,n]),m.useEffect(()=>{f&&o&&(g!==null&&google.maps.event.removeListener(g),A(google.maps.event.addListener(f,"circlecomplete",o)))},[f,o]),m.useEffect(()=>{f&&r&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(f,"markercomplete",r)))},[f,r]),m.useEffect(()=>{f&&i&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(f,"overlaycomplete",i)))},[f,i]),m.useEffect(()=>{f&&a&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(f,"polygoncomplete",a)))},[f,a]),m.useEffect(()=>{f&&l&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(f,"polylinecomplete",l)))},[f,l]),m.useEffect(()=>{f&&s&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(f,"rectanglecomplete",s)))},[f,s]),m.useEffect(()=>{Gu(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing);var H=new google.maps.drawing.DrawingManager(fJ(fJ({},e),{},{map:d}));return n&&H.setDrawingMode(n),o&&A(google.maps.event.addListener(H,"circlecomplete",o)),r&&S(google.maps.event.addListener(H,"markercomplete",r)),i&&P(google.maps.event.addListener(H,"overlaycomplete",i)),a&&T(google.maps.event.addListener(H,"polygoncomplete",a)),l&&x(google.maps.event.addListener(H,"polylinecomplete",l)),s&&R(google.maps.event.addListener(H,"rectanglecomplete",s)),p(H),c&&c(H),()=>{f!==null&&(g&&google.maps.event.removeListener(g),y&&google.maps.event.removeListener(y),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),u&&u(f),f.setMap(null))}},[]),null}m.memo(_mo);class Gmo extends m.PureComponent{constructor(e){super(e),ho(this,"registeredEvents",[]),ho(this,"state",{drawingManager:null}),ho(this,"setDrawingManagerCallback",()=>{this.state.drawingManager!==null&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)}),Gu(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(fJ(fJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:qHe,eventMap:KHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{drawingManager:e}},this.setDrawingManagerCallback)}componentDidUpdate(e){this.state.drawingManager!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:qHe,eventMap:KHe,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){this.state.drawingManager!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),Ga(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}ho(Gmo,"contextType",Ta);function $He(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function NC(t){for(var e=1;e{$!==null&&$.setMap(q)},[q]),m.useEffect(()=>{typeof n<"u"&&$!==null&&$.setOptions(n)},[$,n]),m.useEffect(()=>{typeof a<"u"&&$!==null&&$.setDraggable(a)},[$,a]),m.useEffect(()=>{e&&$!==null&&$.setPosition(e)},[$,e]),m.useEffect(()=>{typeof l<"u"&&$!==null&&$.setVisible(l)},[$,l]),m.useEffect(()=>{$==null||$.setAnimation(s)},[$,s]),m.useEffect(()=>{$&&c!==void 0&&$.setClickable(c)},[$,c]),m.useEffect(()=>{$&&u!==void 0&&$.setCursor(u)},[$,u]),m.useEffect(()=>{$&&d!==void 0&&$.setIcon(d)},[$,d]),m.useEffect(()=>{$&&f!==void 0&&$.setLabel(f)},[$,f]),m.useEffect(()=>{$&&p!==void 0&&$.setOpacity(p)},[$,p]),m.useEffect(()=>{$&&g!==void 0&&$.setShape(g)},[$,g]),m.useEffect(()=>{$&&A!==void 0&&$.setTitle(A)},[$,A]),m.useEffect(()=>{$&&y!==void 0&&$.setZIndex(y)},[$,y]),m.useEffect(()=>{$&&C&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener($,"dblclick",C)))},[C]),m.useEffect(()=>{$&&v&&(Z!==null&&google.maps.event.removeListener(Z),ee(google.maps.event.addListener($,"dragend",v)))},[v]),m.useEffect(()=>{$&&T&&(te!==null&&google.maps.event.removeListener(te),oe(google.maps.event.addListener($,"dragstart",T)))},[T]),m.useEffect(()=>{$&&R&&(de!==null&&google.maps.event.removeListener(de),he(google.maps.event.addListener($,"mousedown",R)))},[R]),m.useEffect(()=>{$&&w&&(pe!==null&&google.maps.event.removeListener(pe),me(google.maps.event.addListener($,"mouseout",w)))},[w]),m.useEffect(()=>{$&&x&&(le!==null&&google.maps.event.removeListener(le),Te(google.maps.event.addListener($,"mouseover",x)))},[x]),m.useEffect(()=>{$&&b&&(ge!==null&&google.maps.event.removeListener(ge),Se(google.maps.event.addListener($,"mouseup",b)))},[b]),m.useEffect(()=>{$&&H&&(Re!==null&&google.maps.event.removeListener(Re),De(google.maps.event.addListener($,"rightclick",H)))},[H]),m.useEffect(()=>{$&&S&&(Ae!==null&&google.maps.event.removeListener(Ae),ue(google.maps.event.addListener($,"click",S)))},[S]),m.useEffect(()=>{$&&P&&(fe!==null&&google.maps.event.removeListener(fe),ve(google.maps.event.addListener($,"drag",P)))},[P]),m.useEffect(()=>{$&&F&&(we!==null&&google.maps.event.removeListener(we),Pe(google.maps.event.addListener($,"clickable_changed",F)))},[F]),m.useEffect(()=>{$&&E&&(Ie!==null&&google.maps.event.removeListener(Ie),Me(google.maps.event.addListener($,"cursor_changed",E)))},[E]),m.useEffect(()=>{$&&N&&(ze!==null&&google.maps.event.removeListener(ze),Ne(google.maps.event.addListener($,"animation_changed",N)))},[N]),m.useEffect(()=>{$&&U&&(Je!==null&&google.maps.event.removeListener(Je),Ue(google.maps.event.addListener($,"draggable_changed",U)))},[U]),m.useEffect(()=>{$&&W&&(nt!==null&&google.maps.event.removeListener(nt),We(google.maps.event.addListener($,"flat_changed",W)))},[W]),m.useEffect(()=>{$&&k&&(Ee!==null&&google.maps.event.removeListener(Ee),ke(google.maps.event.addListener($,"icon_changed",k)))},[k]),m.useEffect(()=>{$&&D&&(Oe!==null&&google.maps.event.removeListener(Oe),st(google.maps.event.addListener($,"position_changed",D)))},[D]),m.useEffect(()=>{$&&L&&(je!==null&&google.maps.event.removeListener(je),xt(google.maps.event.addListener($,"shape_changed",L)))},[L]),m.useEffect(()=>{$&&j&&(gt!==null&&google.maps.event.removeListener(gt),Ye(google.maps.event.addListener($,"title_changed",j)))},[j]),m.useEffect(()=>{$&&B&&(it!==null&&google.maps.event.removeListener(it),ut(google.maps.event.addListener($,"visible_changed",B)))},[B]),m.useEffect(()=>{$&&O&&(Qe!==null&&google.maps.event.removeListener(Qe),lt(google.maps.event.addListener($,"zindex_changed",O)))},[O]),m.useEffect(()=>{var Be=NC(NC(NC({},n||hJ),o?hJ:{map:q}),{},{position:e}),$e=new google.maps.Marker(Be);return o?o.addMarker($e,!!r):$e.setMap(q),e&&$e.setPosition(e),typeof l<"u"&&$e.setVisible(l),typeof a<"u"&&$e.setDraggable(a),typeof c<"u"&&$e.setClickable(c),typeof u=="string"&&$e.setCursor(u),d&&$e.setIcon(d),typeof f<"u"&&$e.setLabel(f),typeof p<"u"&&$e.setOpacity(p),g&&$e.setShape(g),typeof A=="string"&&$e.setTitle(A),typeof y=="number"&&$e.setZIndex(y),C&&se(google.maps.event.addListener($e,"dblclick",C)),v&&ee(google.maps.event.addListener($e,"dragend",v)),T&&oe(google.maps.event.addListener($e,"dragstart",T)),R&&he(google.maps.event.addListener($e,"mousedown",R)),w&&me(google.maps.event.addListener($e,"mouseout",w)),x&&Te(google.maps.event.addListener($e,"mouseover",x)),b&&Se(google.maps.event.addListener($e,"mouseup",b)),H&&De(google.maps.event.addListener($e,"rightclick",H)),S&&ue(google.maps.event.addListener($e,"click",S)),P&&ve(google.maps.event.addListener($e,"drag",P)),F&&Pe(google.maps.event.addListener($e,"clickable_changed",F)),E&&Me(google.maps.event.addListener($e,"cursor_changed",E)),N&&Ne(google.maps.event.addListener($e,"animation_changed",N)),U&&Ue(google.maps.event.addListener($e,"draggable_changed",U)),W&&We(google.maps.event.addListener($e,"flat_changed",W)),k&&ke(google.maps.event.addListener($e,"icon_changed",k)),D&&st(google.maps.event.addListener($e,"position_changed",D)),L&&xt(google.maps.event.addListener($e,"shape_changed",L)),j&&Ye(google.maps.event.addListener($e,"title_changed",j)),B&&ut(google.maps.event.addListener($e,"visible_changed",B)),O&<(google.maps.event.addListener($e,"zindex_changed",O)),ie($e),V&&V($e),()=>{Q!==null&&google.maps.event.removeListener(Q),Z!==null&&google.maps.event.removeListener(Z),te!==null&&google.maps.event.removeListener(te),de!==null&&google.maps.event.removeListener(de),pe!==null&&google.maps.event.removeListener(pe),le!==null&&google.maps.event.removeListener(le),ge!==null&&google.maps.event.removeListener(ge),Re!==null&&google.maps.event.removeListener(Re),Ae!==null&&google.maps.event.removeListener(Ae),we!==null&&google.maps.event.removeListener(we),Ie!==null&&google.maps.event.removeListener(Ie),ze!==null&&google.maps.event.removeListener(ze),Je!==null&&google.maps.event.removeListener(Je),nt!==null&&google.maps.event.removeListener(nt),Ee!==null&&google.maps.event.removeListener(Ee),Oe!==null&&google.maps.event.removeListener(Oe),gt!==null&&google.maps.event.removeListener(gt),it!==null&&google.maps.event.removeListener(it),Qe!==null&&google.maps.event.removeListener(Qe),G&&G($e),o?o.removeMarker($e,!!r):$e&&$e.setMap(null)}},[]);var Ze=m.useMemo(()=>i?m.Children.map(i,Be=>{if(!m.isValidElement(Be))return Be;var $e=Be;return m.cloneElement($e,{anchor:$})}):null,[i,$]);return h.jsx(h.Fragment,{children:Ze})||null}m.memo(Xmo);class vfe extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[])}componentDidMount(){var e=this;return Urt(function*(){var n=NC(NC(NC({},e.props.options||hJ),e.props.clusterer?hJ:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(n),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=Ua({updaterMap:ZHe,eventMap:QHe,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)})()}componentDidUpdate(e){this.marker&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:ZHe,eventMap:QHe,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),Ga(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){var e=this.props.children?m.Children.map(this.props.children,n=>{if(!m.isValidElement(n))return n;var o=n;return m.cloneElement(o,{anchor:this.marker})}):null;return e||null}}ho(vfe,"contextType",Ta);var Jmo=function(){function t(e,n){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=n,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var n=this.cluster.getClusterer();if(google.maps.event.trigger(n,"click",this.cluster),google.maps.event.trigger(n,"clusterclick",this.cluster),n.getZoomOnClick()){var o=n.getMaxZoom(),r=this.cluster.getBounds(),i=n.getMap();i!==null&&"fitBounds"in i&&i.fitBounds(r),this.timeOut=window.setTimeout(function(){var a=n.getMap();if(a!==null){"fitBounds"in a&&a.fitBounds(r);var l=a.getZoom()||0;o!==null&&l>o&&a.setZoom(o+1)}},100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){var e;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),(e=this.getPanes())===null||e===void 0||e.overlayMouseTarget.appendChild(this.div);var n=this.getMap();n!==null&&(this.boundsChangedListener=google.maps.event.addListener(n,"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),this.boundsChangedListener!==null&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),this.timeOut!==null&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&this.div!==null&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=e!==null?"".concat(e.y,"px"):"0",this.div.style.left=e!==null?"".concat(e.x,"px"):"0"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var e,n,o,r,i,a;if(this.div&&this.center){var l=this.sums===null||typeof this.sums.title>"u"||this.sums.title===""?this.cluster.getClusterer().getTitle():this.sums.title,s=this.backgroundPosition.split(" "),c=parseInt(((e=s[0])===null||e===void 0?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),u=parseInt(((n=s[1])===null||n===void 0?void 0:n.replace(/^\s+|\s+$/g,""))||"0",10),d=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(d!==null?"".concat(d.y,"px"):"0","; left: ").concat(d!==null?"".concat(d.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var f=document.createElement("img");f.alt=l,f.src=this.url,f.width=this.width,f.height=this.height,f.setAttribute("style","position: absolute; top: ".concat(u,"px; left: ").concat(c,"px")),this.cluster.getClusterer().enableRetinaIcons||(f.style.clip="rect(-".concat(u,"px, -").concat(c+this.width,"px, -").concat(u+this.height,", -").concat(c,")"));var p=document.createElement("div");p.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),!((o=this.sums)===null||o===void 0)&&o.text&&(p.innerText="".concat((r=this.sums)===null||r===void 0?void 0:r.text)),!((i=this.sums)===null||i===void 0)&&i.html&&(p.innerHTML="".concat((a=this.sums)===null||a===void 0?void 0:a.html)),this.div.innerHTML="",this.div.appendChild(f),this.div.appendChild(p),this.div.title=l,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(e){this.sums=e;var n=this.cluster.getClusterer().getStyles(),o=n[Math.min(n.length-1,Math.max(0,e.index-1))];o&&(this.url=o.url,this.height=o.height,this.width=o.width,o.className&&(this.className="".concat(this.clusterClassName," ").concat(o.className)),this.anchorText=o.anchorText||[0,0],this.anchorIcon=o.anchorIcon||[this.height/2,this.width/2],this.textColor=o.textColor||"black",this.textSize=o.textSize||11,this.textDecoration=o.textDecoration||"none",this.fontWeight=o.fontWeight||"bold",this.fontStyle=o.fontStyle||"normal",this.fontFamily=o.fontFamily||"Arial,sans-serif",this.backgroundPosition=o.backgroundPosition||"0 0")},t.prototype.setCenter=function(e){this.center=e},t.prototype.getPosFromLatLng=function(e){var n=this.getProjection().fromLatLngToDivPixel(e);return n!==null&&(n.x-=this.anchorIcon[1],n.y-=this.anchorIcon[0]),n},t}(),Kmo=function(){function t(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new Jmo(this,this.markerClusterer.getStyles()),this.getSize=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),n=this.getMarkers(),o=0,r=n;oa)e.getMap()!==this.map&&e.setMap(this.map);else if(io){this.clusterIcon.hide();return}if(n0))for(var e=0;e3?new google.maps.LatLngBounds(r==null?void 0:r.getSouthWest(),r==null?void 0:r.getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),l=this.getExtendedBounds(a),s=Math.min(e+this.batchSize,this.markers.length),c=e;c{R&&w&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(R,bm.onMouseOut,w)))},[w]),m.useEffect(()=>{R&&T&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(R,bm.onMouseOver,T)))},[T]),m.useEffect(()=>{R&&C&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(R,bm.onClick,C)))},[C]),m.useEffect(()=>{R&&P&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(R,bm.onClusteringBegin,P)))},[P]),m.useEffect(()=>{R&&v&&(k!==null&&google.maps.event.removeListener(k),W(google.maps.event.addListener(R,bm.onClusteringEnd,v)))},[v]),m.useEffect(()=>{typeof o<"u"&&R!==null&&zl.averageCenter(R,o)},[R,o]),m.useEffect(()=>{typeof r<"u"&&R!==null&&zl.batchSizeIE(R,r)},[R,r]),m.useEffect(()=>{typeof i<"u"&&R!==null&&zl.calculator(R,i)},[R,i]),m.useEffect(()=>{typeof a<"u"&&R!==null&&zl.clusterClass(R,a)},[R,a]),m.useEffect(()=>{typeof l<"u"&&R!==null&&zl.enableRetinaIcons(R,l)},[R,l]),m.useEffect(()=>{typeof s<"u"&&R!==null&&zl.gridSize(R,s)},[R,s]),m.useEffect(()=>{typeof c<"u"&&R!==null&&zl.ignoreHidden(R,c)},[R,c]),m.useEffect(()=>{typeof u<"u"&&R!==null&&zl.imageExtension(R,u)},[R,u]),m.useEffect(()=>{typeof d<"u"&&R!==null&&zl.imagePath(R,d)},[R,d]),m.useEffect(()=>{typeof f<"u"&&R!==null&&zl.imageSizes(R,f)},[R,f]),m.useEffect(()=>{typeof p<"u"&&R!==null&&zl.maxZoom(R,p)},[R,p]),m.useEffect(()=>{typeof g<"u"&&R!==null&&zl.minimumClusterSize(R,g)},[R,g]),m.useEffect(()=>{typeof A<"u"&&R!==null&&zl.styles(R,A)},[R,A]),m.useEffect(()=>{typeof y<"u"&&R!==null&&zl.title(R,y)},[R,y]),m.useEffect(()=>{typeof S<"u"&&R!==null&&zl.zoomOnClick(R,S)},[R,S]),m.useEffect(()=>{if(F){var V=oyo({},n||ryo),G=new Vrt(F,[],V);return o&&zl.averageCenter(G,o),r&&zl.batchSizeIE(G,r),i&&zl.calculator(G,i),a&&zl.clusterClass(G,a),l&&zl.enableRetinaIcons(G,l),s&&zl.gridSize(G,s),c&&zl.ignoreHidden(G,c),u&&zl.imageExtension(G,u),d&&zl.imagePath(G,d),f&&zl.imageSizes(G,f),p&&zl.maxZoom(G,p),g&&zl.minimumClusterSize(G,g),A&&zl.styles(G,A),y&&zl.title(G,y),S&&zl.zoomOnClick(G,S),w&&j(google.maps.event.addListener(G,bm.onMouseOut,w)),T&&O(google.maps.event.addListener(G,bm.onMouseOver,T)),C&&N(google.maps.event.addListener(G,bm.onClick,C)),P&&W(google.maps.event.addListener(G,bm.onClusteringBegin,P)),v&&D(google.maps.event.addListener(G,bm.onClusteringEnd,v)),H(G),x&&x(G),()=>{L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),b&&b(G)}}},[]),R!==null&&e(R)||null}m.memo(iyo);class _rt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{markerClusterer:null}),ho(this,"setClustererCallback",()=>{this.state.markerClusterer!==null&&this.props.onLoad&&this.props.onLoad(this.state.markerClusterer)})}componentDidMount(){if(this.context){var e=new Vrt(this.context,[],this.props.options);this.registeredEvents=Ua({updaterMap:zl,eventMap:bm,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({markerClusterer:e}),this.setClustererCallback)}}componentDidUpdate(e){this.state.markerClusterer&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:zl,eventMap:bm,prevProps:e,nextProps:this.props,instance:this.state.markerClusterer}))}componentWillUnmount(){this.state.markerClusterer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.markerClusterer),Ga(this.registeredEvents),this.state.markerClusterer.setMap(null))}render(){return this.state.markerClusterer!==null?this.props.children(this.state.markerClusterer):null}}ho(_rt,"contextType",Ta);function tMe(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}var Grt=function(){function t(e){e===void 0&&(e={}),this.getCloseClickHandler=this.getCloseClickHandler.bind(this),this.closeClickHandler=this.closeClickHandler.bind(this),this.createInfoBoxDiv=this.createInfoBoxDiv.bind(this),this.addClickHandler=this.addClickHandler.bind(this),this.getCloseBoxImg=this.getCloseBoxImg.bind(this),this.getBoxWidths=this.getBoxWidths.bind(this),this.setBoxStyle=this.setBoxStyle.bind(this),this.setPosition=this.setPosition.bind(this),this.getPosition=this.getPosition.bind(this),this.setOptions=this.setOptions.bind(this),this.setContent=this.setContent.bind(this),this.setVisible=this.setVisible.bind(this),this.getContent=this.getContent.bind(this),this.getVisible=this.getVisible.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getZIndex=this.getZIndex.bind(this),this.onRemove=this.onRemove.bind(this),this.panBox=this.panBox.bind(this),this.extend=this.extend.bind(this),this.close=this.close.bind(this),this.draw=this.draw.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.open=this.open.bind(this),this.extend(t,google.maps.OverlayView),this.content=e.content||"",this.disableAutoPan=e.disableAutoPan||!1,this.maxWidth=e.maxWidth||0,this.pixelOffset=e.pixelOffset||new google.maps.Size(0,0),this.position=e.position||new google.maps.LatLng(0,0),this.zIndex=e.zIndex||null,this.boxClass=e.boxClass||"infoBox",this.boxStyle=e.boxStyle||{},this.closeBoxMargin=e.closeBoxMargin||"2px",this.closeBoxURL=e.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",e.closeBoxURL===""&&(this.closeBoxURL=""),this.infoBoxClearance=e.infoBoxClearance||new google.maps.Size(1,1),typeof e.visible>"u"&&(typeof e.isHidden>"u"?e.visible=!0:e.visible=!e.isHidden),this.isHidden=!e.visible,this.alignBottom=e.alignBottom||!1,this.pane=e.pane||"floatPane",this.enableEventPropagation=e.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var e=this,n=function(u){u.returnValue=!1,u.preventDefault&&u.preventDefault(),e.enableEventPropagation||tMe(u)};if(!this.div){this.div=document.createElement("div"),this.setBoxStyle(),typeof this.content=="string"?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content));var o=this.getPanes();if(o!==null&&o[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(this.maxWidth!==0&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var r=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-r.left-r.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var i=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],a=0,l=i;al&&(o=y.x+d+c+p-l),this.alignBottom?y.y<-u+g+f?r=y.y+u-g-f:y.y+u+g>s&&(r=y.y+u+g-s):y.y<-u+g?r=y.y+u-g:y.y+f+u+g>s&&(r=y.y+f+u+g-s)),o===0&&r===0||n.panBy(o,r)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var e=this.boxStyle;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.div.style[n]=e[n]);if(this.div.style.webkitTransform="translateZ(0)",typeof this.div.style.opacity<"u"&&this.div.style.opacity!==""){var o=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+o*100+')"',this.div.style.filter="alpha(opacity="+o*100+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",this.zIndex!==null&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var e={top:0,bottom:0,left:0,right:0};if(!this.div)return e;if(document.defaultView){var n=this.div.ownerDocument,o=n&&n.defaultView?n.defaultView.getComputedStyle(this.div,""):null;o&&(e.top=parseInt(o.borderTopWidth||"",10)||0,e.bottom=parseInt(o.borderBottomWidth||"",10)||0,e.left=parseInt(o.borderLeftWidth||"",10)||0,e.right=parseInt(o.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var r=this.div.currentStyle;r&&(e.top=parseInt(r.borderTopWidth||"",10)||0,e.bottom=parseInt(r.borderBottomWidth||"",10)||0,e.left=parseInt(r.borderLeftWidth||"",10)||0,e.right=parseInt(r.borderRightWidth||"",10)||0)}return e},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var e=this.getProjection(),n=e.fromLatLngToDivPixel(this.position);n!==null&&(this.div.style.left=n.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(n.y+this.pixelOffset.height)+"px":this.div.style.top=n.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(e){e===void 0&&(e={}),typeof e.boxClass<"u"&&(this.boxClass=e.boxClass,this.setBoxStyle()),typeof e.boxStyle<"u"&&(this.boxStyle=e.boxStyle,this.setBoxStyle()),typeof e.content<"u"&&this.setContent(e.content),typeof e.disableAutoPan<"u"&&(this.disableAutoPan=e.disableAutoPan),typeof e.maxWidth<"u"&&(this.maxWidth=e.maxWidth),typeof e.pixelOffset<"u"&&(this.pixelOffset=e.pixelOffset),typeof e.alignBottom<"u"&&(this.alignBottom=e.alignBottom),typeof e.position<"u"&&this.setPosition(e.position),typeof e.zIndex<"u"&&this.setZIndex(e.zIndex),typeof e.closeBoxMargin<"u"&&(this.closeBoxMargin=e.closeBoxMargin),typeof e.closeBoxURL<"u"&&(this.closeBoxURL=e.closeBoxURL),typeof e.infoBoxClearance<"u"&&(this.infoBoxClearance=e.infoBoxClearance),typeof e.isHidden<"u"&&(this.isHidden=e.isHidden),typeof e.visible<"u"&&(this.isHidden=!e.visible),typeof e.enableEventPropagation<"u"&&(this.enableEventPropagation=e.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(e){this.content=e,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px",typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(e){this.position=e,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(e){this.isHidden=!e,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(e){this.zIndex=e,this.div&&(this.div.style.zIndex=e+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var e=this.getMap();return typeof e>"u"||e===null?!1:!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(e,n){var o=this;n&&(this.position=n.getPosition(),this.moveListener=google.maps.event.addListener(n,"position_changed",function(){var r=n.getPosition();o.setPosition(r)}),this.mapListener=google.maps.event.addListener(n,"map_changed",function(){o.setMap(n.map)})),this.setMap(e),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var e=0,n=this.eventListeners;e{p&&g!==null&&(g.close(),n?g.open(p,n):g.getPosition()&&g.open(p))},[p,g,n]),m.useEffect(()=>{o&&g!==null&&g.setOptions(o)},[g,o]),m.useEffect(()=>{if(r&&g!==null){var F=r instanceof google.maps.LatLng?r:new google.maps.LatLng(r.lat,r.lng);g.setPosition(F)}},[r]),m.useEffect(()=>{typeof i=="number"&&g!==null&&g.setZIndex(i)},[i]),m.useEffect(()=>{g&&a&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(g,"closeclick",a)))},[a]),m.useEffect(()=>{g&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(g,"domready",l)))},[l]),m.useEffect(()=>{g&&s&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(g,"content_changed",s)))},[s]),m.useEffect(()=>{g&&c&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(g,"position_changed",c)))},[c]),m.useEffect(()=>{g&&u&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),m.useEffect(()=>{if(p){var F=o||syo,{position:E}=F,N=N9e(F,ayo),U;E&&!(E instanceof google.maps.LatLng)&&(U=new google.maps.LatLng(E.lat,E.lng));var W=new Grt(pJ(pJ({},N),U?{position:U}:{}));H.current=document.createElement("div"),A(W),a&&S(google.maps.event.addListener(W,"closeclick",a)),l&&P(google.maps.event.addListener(W,"domready",l)),s&&T(google.maps.event.addListener(W,"content_changed",s)),c&&x(google.maps.event.addListener(W,"position_changed",c)),u&&R(google.maps.event.addListener(W,"zindex_changed",u)),W.setContent(H.current),n?W.open(p,n):W.getPosition()?W.open(p):Gu(!1,"You must provide either an anchor or a position prop for ."),d&&d(W)}return()=>{g!==null&&(y&&google.maps.event.removeListener(y),v&&google.maps.event.removeListener(v),C&&google.maps.event.removeListener(C),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),f&&f(g),g.close())}},[]),H.current?Hd.createPortal(m.Children.only(e),H.current):null}m.memo(cyo);class uyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",null),ho(this,"state",{infoBox:null}),ho(this,"open",(e,n)=>{n?this.context!==null&&e.open(this.context,n):e.getPosition()?this.context!==null&&e.open(this.context):Gu(!1,"You must provide either an anchor or a position prop for .")}),ho(this,"setInfoBoxCallback",()=>{this.state.infoBox!==null&&this.containerElement!==null&&(this.state.infoBox.setContent(this.containerElement),this.open(this.state.infoBox,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoBox))})}componentDidMount(){var e=this.props.options||{},{position:n}=e,o=N9e(e,lyo),r;n&&!(n instanceof google.maps.LatLng)&&(r=new google.maps.LatLng(n.lat,n.lng));var i=new Grt(pJ(pJ({},o),r?{position:r}:{}));this.containerElement=document.createElement("div"),this.registeredEvents=Ua({updaterMap:rMe,eventMap:oMe,prevProps:{},nextProps:this.props,instance:i}),this.setState({infoBox:i},this.setInfoBoxCallback)}componentDidUpdate(e){var{infoBox:n}=this.state;n!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:rMe,eventMap:oMe,prevProps:e,nextProps:this.props,instance:n}))}componentWillUnmount(){var{onUnmount:e}=this.props,{infoBox:n}=this.state;n!==null&&(e&&e(n),Ga(this.registeredEvents),n.close())}render(){return this.containerElement?Hd.createPortal(m.Children.only(this.props.children),this.containerElement):null}}ho(uyo,"contextType",Ta);var Zae,iMe;function dyo(){return iMe||(iMe=1,Zae=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n}),Zae}var fyo=dyo(),aMe=Wrt(fyo),lMe=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ele=1,iD=8;class U9e{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var[n,o]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");var r=o>>4;if(r!==ele)throw new Error("Got v".concat(r," data when expected v").concat(ele,"."));var i=lMe[o&15];if(!i)throw new Error("Unrecognized array type.");var[a]=new Uint16Array(e,2,1),[l]=new Uint32Array(e,4,1);return new U9e(l,a,i,e)}constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:64,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float64Array,r=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;var i=lMe.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(o,"."));r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,iD,e),this.coords=new this.ArrayType(this.data,iD+l+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(iD+a+l+s),this.ids=new this.IndexArrayType(this.data,iD,e),this.coords=new this.ArrayType(this.data,iD+l+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ele<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){var o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=n,o}finish(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return xfe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,o,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:i,coords:a,nodeSize:l}=this,s=[0,i.length-1,0],c=[];s.length;){var u=s.pop()||0,d=s.pop()||0,f=s.pop()||0;if(d-f<=l){for(var p=f;p<=d;p++){var g=a[2*p],A=a[2*p+1];g>=e&&g<=o&&A>=n&&A<=r&&c.push(i[p])}continue}var y=f+d>>1,S=a[2*y],C=a[2*y+1];S>=e&&S<=o&&C>=n&&C<=r&&c.push(i[y]),(u===0?e<=S:n<=C)&&(s.push(f),s.push(y-1),s.push(1-u)),(u===0?o>=S:r>=C)&&(s.push(y+1),s.push(d),s.push(1-u))}return c}within(e,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:r,coords:i,nodeSize:a}=this,l=[0,r.length-1,0],s=[],c=o*o;l.length;){var u=l.pop()||0,d=l.pop()||0,f=l.pop()||0;if(d-f<=a){for(var p=f;p<=d;p++)sMe(i[2*p],i[2*p+1],e,n)<=c&&s.push(r[p]);continue}var g=f+d>>1,A=i[2*g],y=i[2*g+1];sMe(A,y,e,n)<=c&&s.push(r[g]),(u===0?e-o<=A:n-o<=y)&&(l.push(f),l.push(g-1),l.push(1-u)),(u===0?e+o>=A:n+o>=y)&&(l.push(g+1),l.push(d),l.push(1-u))}return s}}function xfe(t,e,n,o,r,i){if(!(r-o<=n)){var a=o+r>>1;Xrt(t,e,a,o,r,i),xfe(t,e,n,o,a-1,1-i),xfe(t,e,n,a+1,r,1-i)}}function Xrt(t,e,n,o,r,i){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,s=Math.log(a),c=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*c*(a-c)/a)*(l-a/2<0?-1:1),d=Math.max(o,Math.floor(n-l*c/a+u)),f=Math.min(r,Math.floor(n+(a-l)*c/a+u));Xrt(t,e,n,d,f,i)}var p=e[2*n+i],g=o,A=r;for(aD(t,e,o,n),e[2*r+i]>p&&aD(t,e,o,r);gp;)A--}e[2*o+i]===p?aD(t,e,o,A):(A++,aD(t,e,A,r)),A<=n&&(o=A+1),n<=A&&(r=A-1)}}function aD(t,e,n,o){tle(t,n,o),tle(e,2*n,2*o),tle(e,2*n+1,2*o+1)}function tle(t,e,n){var o=t[e];t[e]=t[n],t[n]=o}function sMe(t,e,n,o){var r=t-n,i=e-o;return r*r+i*i}var hyo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},cMe=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),rv=2,e8=3,nle=4,Y4=5,Jrt=6;class pyo{constructor(e){this.options=Object.assign(Object.create(hyo),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){var{log:n,minZoom:o,maxZoom:r}=this.options;n&&console.time("total time");var i="prepare ".concat(e.length," points");n&&console.time(i),this.points=e;for(var a=[],l=0;l=o;g--){var A=+Date.now();p=this.trees[g]=this._createTree(this._cluster(p,g)),n&&console.log("z%d: %d clusters in %dms",g,p.numItems,+Date.now()-A)}return n&&console.timeEnd("total time"),this}getClusters(e,n){var o=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,i=180;else if(o>i){var l=this.getClusters([o,r,180,a],n),s=this.getClusters([-180,r,i,a],n);return l.concat(s)}var c=this.trees[this._limitZoom(n)],u=c.range(VO(o),_O(a),VO(i),_O(r)),d=c.data,f=[];for(var p of u){var g=this.stride*p;f.push(d[g+Y4]>1?uMe(d,g,this.clusterProps):this.points[d[g+e8]])}return f}getChildren(e){var n=this._getOriginId(e),o=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[o];if(!i)throw new Error(r);var a=i.data;if(n*this.stride>=a.length)throw new Error(r);var l=this.options.radius/(this.options.extent*Math.pow(2,o-1)),s=a[n*this.stride],c=a[n*this.stride+1],u=i.within(s,c,l),d=[];for(var f of u){var p=f*this.stride;a[p+nle]===e&&d.push(a[p+Y4]>1?uMe(a,p,this.clusterProps):this.points[a[p+e8]])}if(d.length===0)throw new Error(r);return d}getLeaves(e,n,o){n=n||10,o=o||0;var r=[];return this._appendLeaves(r,e,n,o,0),r}getTile(e,n,o){var r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:a,radius:l}=this.options,s=l/a,c=(o-s)/i,u=(o+1+s)/i,d={features:[]};return this._addTileFeatures(r.range((n-s)/i,c,(n+1+s)/i,u),r.data,n,o,i,d),n===0&&this._addTileFeatures(r.range(1-s/i,c,1,u),r.data,i,o,i,d),n===i-1&&this._addTileFeatures(r.range(0,c,s/i,u),r.data,-1,o,i,d),d.features.length?d:null}getClusterExpansionZoom(e){for(var n=this._getOriginZoom(e)-1;n<=this.options.maxZoom;){var o=this.getChildren(e);if(n++,o.length!==1)break;e=o[0].properties.cluster_id}return n}_appendLeaves(e,n,o,r,i){var a=this.getChildren(n);for(var l of a){var s=l.properties;if(s&&s.cluster?i+s.point_count<=r?i+=s.point_count:i=this._appendLeaves(e,s.cluster_id,o,r,i):i1,u=void 0,d=void 0,f=void 0;if(c)u=Krt(n,s,this.clusterProps),d=n[s],f=n[s+1];else{var p=this.points[n[s+e8]];u=p.properties;var[g,A]=p.geometry.coordinates;d=VO(g),f=_O(A)}var y={type:1,geometry:[[Math.round(this.options.extent*(d*i-o)),Math.round(this.options.extent*(f*i-r))]],tags:u},S=void 0;c||this.options.generateId?S=n[s+e8]:S=this.points[n[s+e8]].id,S!==void 0&&(y.id=S),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,n){for(var{radius:o,extent:r,reduce:i,minPoints:a}=this.options,l=o/(r*Math.pow(2,n)),s=e.data,c=[],u=this.stride,d=0;dn&&(y+=s[C+Y4])}if(y>A&&y>=a){var P=f*A,v=p*A,T=void 0,w=-1,x=((d/u|0)<<5)+(n+1)+this.points.length;for(var b of g){var R=b*u;if(!(s[R+rv]<=n)){s[R+rv]=n;var H=s[R+Y4];P+=s[R]*H,v+=s[R+1]*H,s[R+nle]=x,i&&(T||(T=this._map(s,d,!0),w=this.clusterProps.length,this.clusterProps.push(T)),i(T,this._map(s,R)))}}s[d+nle]=x,c.push(P/y,v/y,1/0,x,-1,y),i&&c.push(w)}else{for(var F=0;F1)for(var E of g){var N=E*u;if(!(s[N+rv]<=n)){s[N+rv]=n;for(var U=0;U>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,n,o){if(e[n+Y4]>1){var r=this.clusterProps[e[n+Jrt]];return o?Object.assign({},r):r}var i=this.points[e[n+e8]].properties,a=this.options.map(i);return o&&a===i?Object.assign({},a):a}}function uMe(t,e,n){return{type:"Feature",id:t[e+e8],properties:Krt(t,e,n),geometry:{type:"Point",coordinates:[gyo(t[e]),myo(t[e+1])]}}}function Krt(t,e,n){var o=t[e+Y4],r=o>=1e4?"".concat(Math.round(o/1e3),"k"):o>=1e3?"".concat(Math.round(o/100)/10,"k"):o,i=t[e+Jrt],a=i===-1?{}:Object.assign({},n[i]);return Object.assign(a,{cluster:!0,cluster_id:t[e+e8],point_count:o,point_count_abbreviated:r})}function VO(t){return t/360+.5}function _O(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function gyo(t){return(t-.5)*360}function myo(t){var e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}/*! ***************************************************************************** + `)),console.error(x)})},[e,C,o]);var P=m.useRef();return m.useEffect(function(){P.current&&s!==P.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),P.current=s},[s]),{isLoaded:g,loadError:y,url:C}}var zmo=["loadingElement","onLoad","onError","onUnmount","children"],Dmo=h.jsx(Yrt,{});function Emo(t){var{loadingElement:e,onLoad:n,onError:o,onUnmount:r,children:i}=t,a=N9e(t,zmo),{isLoaded:l,loadError:s}=Imo(a);return m.useEffect(function(){l&&typeof n=="function"&&n()},[l,n]),m.useEffect(function(){s&&typeof o=="function"&&o(s)},[s,o]),m.useEffect(function(){return()=>{r&&r()}},[r]),l?i:e||Dmo}m.memo(Emo);function Fmo(t,e,n,o){function r(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function l(u){try{c(o.next(u))}catch(d){a(d)}}function s(u){try{c(o.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(l,s)}c((o=o.apply(t,[])).next())})}function kmo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lmo=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n},Wmo=kmo(Lmo),VHe="__googleMapsScriptId",hC;(function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"})(hC||(hC={}));class Mv{constructor(e){var{apiKey:n,authReferrerPolicy:o,channel:r,client:i,id:a=VHe,language:l,libraries:s=[],mapIds:c,nonce:u,region:d,retries:f=3,url:p="https://maps.googleapis.com/maps/api/js",version:g}=e;if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=n,this.authReferrerPolicy=o,this.channel=r,this.client=i,this.id=a||VHe,this.language=l,this.libraries=s,this.mapIds=c,this.nonce=u,this.region=d,this.retries=f,this.url=p,this.version=g,Mv.instance){if(!Wmo(this.options,Mv.instance.options))throw new Error("Loader must not be called again with different options. ".concat(JSON.stringify(this.options)," !== ").concat(JSON.stringify(Mv.instance.options)));return Mv.instance}Mv.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?hC.FAILURE:this.done?hC.SUCCESS:this.loading?hC.LOADING:hC.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){var e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+="&key=".concat(this.apiKey)),this.channel&&(e+="&channel=".concat(this.channel)),this.client&&(e+="&client=".concat(this.client)),this.libraries.length>0&&(e+="&libraries=".concat(this.libraries.join(","))),this.language&&(e+="&language=".concat(this.language)),this.region&&(e+="®ion=".concat(this.region)),this.version&&(e+="&v=".concat(this.version)),this.mapIds&&(e+="&map_ids=".concat(this.mapIds.join(","))),this.authReferrerPolicy&&(e+="&auth_referrer_policy=".concat(this.authReferrerPolicy)),e}deleteScript(){var e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,n)=>{this.loadCallback(o=>{o?n(o.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,n;if(document.getElementById(this.id)){this.callback();return}var o={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(o).forEach(i=>!o[i]&&delete o[i]),!((n=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||n===void 0)&&n.importLibrary||(i=>{var a,l,s,c="The Google Maps JavaScript API",u="google",d="importLibrary",f="__ib__",p=document,g=window;g=g[u]||(g[u]={});var A=g.maps||(g.maps={}),y=new Set,S=new URLSearchParams,C=()=>a||(a=new Promise((P,v)=>Fmo(this,void 0,void 0,function*(){var T;yield l=p.createElement("script"),l.id=this.id,S.set("libraries",[...y]+"");for(s in i)S.set(s.replace(/[A-Z]/g,w=>"_"+w[0].toLowerCase()),i[s]);S.set("callback",u+".maps."+f),l.src=this.url+"?"+S,A[f]=P,l.onerror=()=>a=v(Error(c+" could not load.")),l.nonce=this.nonce||((T=p.querySelector("script[nonce]"))===null||T===void 0?void 0:T.nonce)||"",p.head.append(l)})));A[d]?console.warn(c+" only loads once. Ignoring:",i):A[d]=function(P){for(var v=arguments.length,T=new Array(v>1?v-1:0),w=1;wA[d](P,...T))}})(o);var r=this.libraries.map(i=>this.importLibrary(i));r.length||r.push(this.importLibrary("core")),Promise.all(r).then(()=>this.callback(),i=>{var a=new ErrorEvent("error",{error:i});this.loadErrorCallback(a)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){var n=this.errors.length*Math.pow(2,this.errors.length);console.error("Failed to load Google Maps script, retrying in ".concat(n," ms.")),setTimeout(()=>{this.deleteScript(),this.setScript()},n)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}var Nmo=["maps"];function Ort(t){var{id:e=_k.id,version:n=_k.version,nonce:o,googleMapsApiKey:r,language:i,region:a,libraries:l=Nmo,preventGoogleFontsLoading:s,mapIds:c,authReferrerPolicy:u}=t,d=m.useRef(!1),[f,p]=m.useState(!1),[g,A]=m.useState(void 0);m.useEffect(function(){return d.current=!0,()=>{d.current=!1}},[]);var y=m.useMemo(()=>new Mv({id:e,apiKey:r,version:n,libraries:l,language:i||"en",region:a||"US",mapIds:c||[],nonce:o||"",authReferrerPolicy:u||"origin"}),[e,r,n,l,i,a,c,o,u]);m.useEffect(function(){f||y.load().then(()=>{d.current&&p(!0)}).catch(P=>{A(P)})},[]),m.useEffect(()=>{C8&&s&&W9e()},[s]);var S=m.useRef();return m.useEffect(()=>{S.current&&l!==S.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),S.current=l},[l]),{isLoaded:f,loadError:g}}function _He(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function dJ(t){for(var e=1;e{i!==null&&i.setMap(r)},[r]),m.useEffect(()=>{e&&i!==null&&i.setOptions(e)},[i,e]),m.useEffect(()=>{var l=new google.maps.TrafficLayer(dJ(dJ({},e),{},{map:r}));return a(l),n&&n(l),()=>{i!==null&&(o&&o(i),i.setMap(null))}},[]),null}m.memo(Umo);class jmo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{trafficLayer:null}),ho(this,"setTrafficLayerCallback",()=>{this.state.trafficLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)}),ho(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(dJ(dJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:XHe,eventMap:GHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{trafficLayer:e}},this.setTrafficLayerCallback)}componentDidUpdate(e){this.state.trafficLayer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:XHe,eventMap:GHe,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){this.state.trafficLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),Ga(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}ho(jmo,"contextType",Ta);function Bmo(t){var{onLoad:e,onUnmount:n}=t,o=m.useContext(Ta),[r,i]=m.useState(null);return m.useEffect(()=>{r!==null&&r.setMap(o)},[o]),m.useEffect(()=>{var a=new google.maps.BicyclingLayer;return i(a),a.setMap(o),e&&e(a),()=>{a!==null&&(n&&n(a),a.setMap(null))}},[]),null}m.memo(Bmo);class Ymo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{bicyclingLayer:null}),ho(this,"setBicyclingLayerCallback",()=>{this.state.bicyclingLayer!==null&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))})}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState(()=>({bicyclingLayer:e}),this.setBicyclingLayerCallback)}componentWillUnmount(){this.state.bicyclingLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}ho(Ymo,"contextType",Ta);function Omo(t){var{onLoad:e,onUnmount:n}=t,o=m.useContext(Ta),[r,i]=m.useState(null);return m.useEffect(()=>{r!==null&&r.setMap(o)},[o]),m.useEffect(()=>{var a=new google.maps.TransitLayer;return i(a),a.setMap(o),e&&e(a),()=>{r!==null&&(n&&n(r),r.setMap(null))}},[]),null}m.memo(Omo);class Vmo extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{transitLayer:null}),ho(this,"setTransitLayerCallback",()=>{this.state.transitLayer!==null&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))})}componentDidMount(){var e=new google.maps.TransitLayer;this.setState(function(){return{transitLayer:e}},this.setTransitLayerCallback)}componentWillUnmount(){this.state.transitLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}ho(Vmo,"contextType",Ta);function JHe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fJ(t){for(var e=1;e{f!==null&&f.setMap(d)},[d]),m.useEffect(()=>{e&&f!==null&&f.setOptions(e)},[f,e]),m.useEffect(()=>{f!==null&&f.setDrawingMode(n??null)},[f,n]),m.useEffect(()=>{f&&o&&(g!==null&&google.maps.event.removeListener(g),A(google.maps.event.addListener(f,"circlecomplete",o)))},[f,o]),m.useEffect(()=>{f&&r&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(f,"markercomplete",r)))},[f,r]),m.useEffect(()=>{f&&i&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(f,"overlaycomplete",i)))},[f,i]),m.useEffect(()=>{f&&a&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(f,"polygoncomplete",a)))},[f,a]),m.useEffect(()=>{f&&l&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(f,"polylinecomplete",l)))},[f,l]),m.useEffect(()=>{f&&s&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(f,"rectanglecomplete",s)))},[f,s]),m.useEffect(()=>{Gu(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing);var H=new google.maps.drawing.DrawingManager(fJ(fJ({},e),{},{map:d}));return n&&H.setDrawingMode(n),o&&A(google.maps.event.addListener(H,"circlecomplete",o)),r&&S(google.maps.event.addListener(H,"markercomplete",r)),i&&P(google.maps.event.addListener(H,"overlaycomplete",i)),a&&T(google.maps.event.addListener(H,"polygoncomplete",a)),l&&x(google.maps.event.addListener(H,"polylinecomplete",l)),s&&R(google.maps.event.addListener(H,"rectanglecomplete",s)),p(H),c&&c(H),()=>{f!==null&&(g&&google.maps.event.removeListener(g),y&&google.maps.event.removeListener(y),C&&google.maps.event.removeListener(C),v&&google.maps.event.removeListener(v),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),u&&u(f),f.setMap(null))}},[]),null}m.memo(_mo);class Gmo extends m.PureComponent{constructor(e){super(e),ho(this,"registeredEvents",[]),ho(this,"state",{drawingManager:null}),ho(this,"setDrawingManagerCallback",()=>{this.state.drawingManager!==null&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)}),Gu(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(fJ(fJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:qHe,eventMap:KHe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{drawingManager:e}},this.setDrawingManagerCallback)}componentDidUpdate(e){this.state.drawingManager!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:qHe,eventMap:KHe,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){this.state.drawingManager!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),Ga(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}ho(Gmo,"contextType",Ta);function $He(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function NC(t){for(var e=1;e{$!==null&&$.setMap(q)},[q]),m.useEffect(()=>{typeof n<"u"&&$!==null&&$.setOptions(n)},[$,n]),m.useEffect(()=>{typeof a<"u"&&$!==null&&$.setDraggable(a)},[$,a]),m.useEffect(()=>{e&&$!==null&&$.setPosition(e)},[$,e]),m.useEffect(()=>{typeof l<"u"&&$!==null&&$.setVisible(l)},[$,l]),m.useEffect(()=>{$==null||$.setAnimation(s)},[$,s]),m.useEffect(()=>{$&&c!==void 0&&$.setClickable(c)},[$,c]),m.useEffect(()=>{$&&u!==void 0&&$.setCursor(u)},[$,u]),m.useEffect(()=>{$&&d!==void 0&&$.setIcon(d)},[$,d]),m.useEffect(()=>{$&&f!==void 0&&$.setLabel(f)},[$,f]),m.useEffect(()=>{$&&p!==void 0&&$.setOpacity(p)},[$,p]),m.useEffect(()=>{$&&g!==void 0&&$.setShape(g)},[$,g]),m.useEffect(()=>{$&&A!==void 0&&$.setTitle(A)},[$,A]),m.useEffect(()=>{$&&y!==void 0&&$.setZIndex(y)},[$,y]),m.useEffect(()=>{$&&C&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener($,"dblclick",C)))},[C]),m.useEffect(()=>{$&&v&&(oe!==null&&google.maps.event.removeListener(oe),Z(google.maps.event.addListener($,"dragend",v)))},[v]),m.useEffect(()=>{$&&T&&(te!==null&&google.maps.event.removeListener(te),ee(google.maps.event.addListener($,"dragstart",T)))},[T]),m.useEffect(()=>{$&&R&&(de!==null&&google.maps.event.removeListener(de),fe(google.maps.event.addListener($,"mousedown",R)))},[R]),m.useEffect(()=>{$&&w&&(pe!==null&&google.maps.event.removeListener(pe),ye(google.maps.event.addListener($,"mouseout",w)))},[w]),m.useEffect(()=>{$&&x&&(ae!==null&&google.maps.event.removeListener(ae),Te(google.maps.event.addListener($,"mouseover",x)))},[x]),m.useEffect(()=>{$&&b&&(ge!==null&&google.maps.event.removeListener(ge),Se(google.maps.event.addListener($,"mouseup",b)))},[b]),m.useEffect(()=>{$&&H&&(Re!==null&&google.maps.event.removeListener(Re),De(google.maps.event.addListener($,"rightclick",H)))},[H]),m.useEffect(()=>{$&&S&&(Ae!==null&&google.maps.event.removeListener(Ae),ue(google.maps.event.addListener($,"click",S)))},[S]),m.useEffect(()=>{$&&P&&(he!==null&&google.maps.event.removeListener(he),ve(google.maps.event.addListener($,"drag",P)))},[P]),m.useEffect(()=>{$&&F&&(we!==null&&google.maps.event.removeListener(we),Pe(google.maps.event.addListener($,"clickable_changed",F)))},[F]),m.useEffect(()=>{$&&E&&(Ie!==null&&google.maps.event.removeListener(Ie),Me(google.maps.event.addListener($,"cursor_changed",E)))},[E]),m.useEffect(()=>{$&&N&&(ze!==null&&google.maps.event.removeListener(ze),Ne(google.maps.event.addListener($,"animation_changed",N)))},[N]),m.useEffect(()=>{$&&U&&(Je!==null&&google.maps.event.removeListener(Je),Ue(google.maps.event.addListener($,"draggable_changed",U)))},[U]),m.useEffect(()=>{$&&W&&(nt!==null&&google.maps.event.removeListener(nt),We(google.maps.event.addListener($,"flat_changed",W)))},[W]),m.useEffect(()=>{$&&k&&(Ee!==null&&google.maps.event.removeListener(Ee),ke(google.maps.event.addListener($,"icon_changed",k)))},[k]),m.useEffect(()=>{$&&D&&(Oe!==null&&google.maps.event.removeListener(Oe),st(google.maps.event.addListener($,"position_changed",D)))},[D]),m.useEffect(()=>{$&&L&&(je!==null&&google.maps.event.removeListener(je),xt(google.maps.event.addListener($,"shape_changed",L)))},[L]),m.useEffect(()=>{$&&j&&(gt!==null&&google.maps.event.removeListener(gt),Ye(google.maps.event.addListener($,"title_changed",j)))},[j]),m.useEffect(()=>{$&&B&&(it!==null&&google.maps.event.removeListener(it),ut(google.maps.event.addListener($,"visible_changed",B)))},[B]),m.useEffect(()=>{$&&O&&(Qe!==null&&google.maps.event.removeListener(Qe),lt(google.maps.event.addListener($,"zindex_changed",O)))},[O]),m.useEffect(()=>{var Be=NC(NC(NC({},n||hJ),o?hJ:{map:q}),{},{position:e}),$e=new google.maps.Marker(Be);return o?o.addMarker($e,!!r):$e.setMap(q),e&&$e.setPosition(e),typeof l<"u"&&$e.setVisible(l),typeof a<"u"&&$e.setDraggable(a),typeof c<"u"&&$e.setClickable(c),typeof u=="string"&&$e.setCursor(u),d&&$e.setIcon(d),typeof f<"u"&&$e.setLabel(f),typeof p<"u"&&$e.setOpacity(p),g&&$e.setShape(g),typeof A=="string"&&$e.setTitle(A),typeof y=="number"&&$e.setZIndex(y),C&&se(google.maps.event.addListener($e,"dblclick",C)),v&&Z(google.maps.event.addListener($e,"dragend",v)),T&&ee(google.maps.event.addListener($e,"dragstart",T)),R&&fe(google.maps.event.addListener($e,"mousedown",R)),w&&ye(google.maps.event.addListener($e,"mouseout",w)),x&&Te(google.maps.event.addListener($e,"mouseover",x)),b&&Se(google.maps.event.addListener($e,"mouseup",b)),H&&De(google.maps.event.addListener($e,"rightclick",H)),S&&ue(google.maps.event.addListener($e,"click",S)),P&&ve(google.maps.event.addListener($e,"drag",P)),F&&Pe(google.maps.event.addListener($e,"clickable_changed",F)),E&&Me(google.maps.event.addListener($e,"cursor_changed",E)),N&&Ne(google.maps.event.addListener($e,"animation_changed",N)),U&&Ue(google.maps.event.addListener($e,"draggable_changed",U)),W&&We(google.maps.event.addListener($e,"flat_changed",W)),k&&ke(google.maps.event.addListener($e,"icon_changed",k)),D&&st(google.maps.event.addListener($e,"position_changed",D)),L&&xt(google.maps.event.addListener($e,"shape_changed",L)),j&&Ye(google.maps.event.addListener($e,"title_changed",j)),B&&ut(google.maps.event.addListener($e,"visible_changed",B)),O&<(google.maps.event.addListener($e,"zindex_changed",O)),ie($e),V&&V($e),()=>{Q!==null&&google.maps.event.removeListener(Q),oe!==null&&google.maps.event.removeListener(oe),te!==null&&google.maps.event.removeListener(te),de!==null&&google.maps.event.removeListener(de),pe!==null&&google.maps.event.removeListener(pe),ae!==null&&google.maps.event.removeListener(ae),ge!==null&&google.maps.event.removeListener(ge),Re!==null&&google.maps.event.removeListener(Re),Ae!==null&&google.maps.event.removeListener(Ae),we!==null&&google.maps.event.removeListener(we),Ie!==null&&google.maps.event.removeListener(Ie),ze!==null&&google.maps.event.removeListener(ze),Je!==null&&google.maps.event.removeListener(Je),nt!==null&&google.maps.event.removeListener(nt),Ee!==null&&google.maps.event.removeListener(Ee),Oe!==null&&google.maps.event.removeListener(Oe),gt!==null&&google.maps.event.removeListener(gt),it!==null&&google.maps.event.removeListener(it),Qe!==null&&google.maps.event.removeListener(Qe),G&&G($e),o?o.removeMarker($e,!!r):$e&&$e.setMap(null)}},[]);var Ze=m.useMemo(()=>i?m.Children.map(i,Be=>{if(!m.isValidElement(Be))return Be;var $e=Be;return m.cloneElement($e,{anchor:$})}):null,[i,$]);return h.jsx(h.Fragment,{children:Ze})||null}m.memo(Xmo);class vfe extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[])}componentDidMount(){var e=this;return Urt(function*(){var n=NC(NC(NC({},e.props.options||hJ),e.props.clusterer?hJ:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(n),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=Ua({updaterMap:ZHe,eventMap:QHe,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)})()}componentDidUpdate(e){this.marker&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:ZHe,eventMap:QHe,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),Ga(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){var e=this.props.children?m.Children.map(this.props.children,n=>{if(!m.isValidElement(n))return n;var o=n;return m.cloneElement(o,{anchor:this.marker})}):null;return e||null}}ho(vfe,"contextType",Ta);var Jmo=function(){function t(e,n){e.getClusterer().extend(t,google.maps.OverlayView),this.cluster=e,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=n,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(e.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return t.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},t.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},t.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var n=this.cluster.getClusterer();if(google.maps.event.trigger(n,"click",this.cluster),google.maps.event.trigger(n,"clusterclick",this.cluster),n.getZoomOnClick()){var o=n.getMaxZoom(),r=this.cluster.getBounds(),i=n.getMap();i!==null&&"fitBounds"in i&&i.fitBounds(r),this.timeOut=window.setTimeout(function(){var a=n.getMap();if(a!==null){"fitBounds"in a&&a.fitBounds(r);var l=a.getZoom()||0;o!==null&&l>o&&a.setZoom(o+1)}},100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},t.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},t.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},t.prototype.onAdd=function(){var e;this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),(e=this.getPanes())===null||e===void 0||e.overlayMouseTarget.appendChild(this.div);var n=this.getMap();n!==null&&(this.boundsChangedListener=google.maps.event.addListener(n,"bounds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),this.boundsChangedListener!==null&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),this.timeOut!==null&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},t.prototype.draw=function(){if(this.visible&&this.div!==null&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=e!==null?"".concat(e.y,"px"):"0",this.div.style.left=e!==null?"".concat(e.x,"px"):"0"}},t.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},t.prototype.show=function(){var e,n,o,r,i,a;if(this.div&&this.center){var l=this.sums===null||typeof this.sums.title>"u"||this.sums.title===""?this.cluster.getClusterer().getTitle():this.sums.title,s=this.backgroundPosition.split(" "),c=parseInt(((e=s[0])===null||e===void 0?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),u=parseInt(((n=s[1])===null||n===void 0?void 0:n.replace(/^\s+|\s+$/g,""))||"0",10),d=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(d!==null?"".concat(d.y,"px"):"0","; left: ").concat(d!==null?"".concat(d.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var f=document.createElement("img");f.alt=l,f.src=this.url,f.width=this.width,f.height=this.height,f.setAttribute("style","position: absolute; top: ".concat(u,"px; left: ").concat(c,"px")),this.cluster.getClusterer().enableRetinaIcons||(f.style.clip="rect(-".concat(u,"px, -").concat(c+this.width,"px, -").concat(u+this.height,", -").concat(c,")"));var p=document.createElement("div");p.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),!((o=this.sums)===null||o===void 0)&&o.text&&(p.innerText="".concat((r=this.sums)===null||r===void 0?void 0:r.text)),!((i=this.sums)===null||i===void 0)&&i.html&&(p.innerHTML="".concat((a=this.sums)===null||a===void 0?void 0:a.html)),this.div.innerHTML="",this.div.appendChild(f),this.div.appendChild(p),this.div.title=l,this.div.style.display=""}this.visible=!0},t.prototype.useStyle=function(e){this.sums=e;var n=this.cluster.getClusterer().getStyles(),o=n[Math.min(n.length-1,Math.max(0,e.index-1))];o&&(this.url=o.url,this.height=o.height,this.width=o.width,o.className&&(this.className="".concat(this.clusterClassName," ").concat(o.className)),this.anchorText=o.anchorText||[0,0],this.anchorIcon=o.anchorIcon||[this.height/2,this.width/2],this.textColor=o.textColor||"black",this.textSize=o.textSize||11,this.textDecoration=o.textDecoration||"none",this.fontWeight=o.fontWeight||"bold",this.fontStyle=o.fontStyle||"normal",this.fontFamily=o.fontFamily||"Arial,sans-serif",this.backgroundPosition=o.backgroundPosition||"0 0")},t.prototype.setCenter=function(e){this.center=e},t.prototype.getPosFromLatLng=function(e){var n=this.getProjection().fromLatLngToDivPixel(e);return n!==null&&(n.x-=this.anchorIcon[1],n.y-=this.anchorIcon[0]),n},t}(),Kmo=function(){function t(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new Jmo(this,this.markerClusterer.getStyles()),this.getSize=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return t.prototype.getSize=function(){return this.markers.length},t.prototype.getMarkers=function(){return this.markers},t.prototype.getCenter=function(){return this.center},t.prototype.getMap=function(){return this.map},t.prototype.getClusterer=function(){return this.markerClusterer},t.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),n=this.getMarkers(),o=0,r=n;oa)e.getMap()!==this.map&&e.setMap(this.map);else if(io){this.clusterIcon.hide();return}if(n0))for(var e=0;e3?new google.maps.LatLngBounds(r==null?void 0:r.getSouthWest(),r==null?void 0:r.getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),l=this.getExtendedBounds(a),s=Math.min(e+this.batchSize,this.markers.length),c=e;c{R&&w&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(R,bm.onMouseOut,w)))},[w]),m.useEffect(()=>{R&&T&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(R,bm.onMouseOver,T)))},[T]),m.useEffect(()=>{R&&C&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(R,bm.onClick,C)))},[C]),m.useEffect(()=>{R&&P&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(R,bm.onClusteringBegin,P)))},[P]),m.useEffect(()=>{R&&v&&(k!==null&&google.maps.event.removeListener(k),W(google.maps.event.addListener(R,bm.onClusteringEnd,v)))},[v]),m.useEffect(()=>{typeof o<"u"&&R!==null&&zl.averageCenter(R,o)},[R,o]),m.useEffect(()=>{typeof r<"u"&&R!==null&&zl.batchSizeIE(R,r)},[R,r]),m.useEffect(()=>{typeof i<"u"&&R!==null&&zl.calculator(R,i)},[R,i]),m.useEffect(()=>{typeof a<"u"&&R!==null&&zl.clusterClass(R,a)},[R,a]),m.useEffect(()=>{typeof l<"u"&&R!==null&&zl.enableRetinaIcons(R,l)},[R,l]),m.useEffect(()=>{typeof s<"u"&&R!==null&&zl.gridSize(R,s)},[R,s]),m.useEffect(()=>{typeof c<"u"&&R!==null&&zl.ignoreHidden(R,c)},[R,c]),m.useEffect(()=>{typeof u<"u"&&R!==null&&zl.imageExtension(R,u)},[R,u]),m.useEffect(()=>{typeof d<"u"&&R!==null&&zl.imagePath(R,d)},[R,d]),m.useEffect(()=>{typeof f<"u"&&R!==null&&zl.imageSizes(R,f)},[R,f]),m.useEffect(()=>{typeof p<"u"&&R!==null&&zl.maxZoom(R,p)},[R,p]),m.useEffect(()=>{typeof g<"u"&&R!==null&&zl.minimumClusterSize(R,g)},[R,g]),m.useEffect(()=>{typeof A<"u"&&R!==null&&zl.styles(R,A)},[R,A]),m.useEffect(()=>{typeof y<"u"&&R!==null&&zl.title(R,y)},[R,y]),m.useEffect(()=>{typeof S<"u"&&R!==null&&zl.zoomOnClick(R,S)},[R,S]),m.useEffect(()=>{if(F){var V=oyo({},n||ryo),G=new Vrt(F,[],V);return o&&zl.averageCenter(G,o),r&&zl.batchSizeIE(G,r),i&&zl.calculator(G,i),a&&zl.clusterClass(G,a),l&&zl.enableRetinaIcons(G,l),s&&zl.gridSize(G,s),c&&zl.ignoreHidden(G,c),u&&zl.imageExtension(G,u),d&&zl.imagePath(G,d),f&&zl.imageSizes(G,f),p&&zl.maxZoom(G,p),g&&zl.minimumClusterSize(G,g),A&&zl.styles(G,A),y&&zl.title(G,y),S&&zl.zoomOnClick(G,S),w&&j(google.maps.event.addListener(G,bm.onMouseOut,w)),T&&O(google.maps.event.addListener(G,bm.onMouseOver,T)),C&&N(google.maps.event.addListener(G,bm.onClick,C)),P&&W(google.maps.event.addListener(G,bm.onClusteringBegin,P)),v&&D(google.maps.event.addListener(G,bm.onClusteringEnd,v)),H(G),x&&x(G),()=>{L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),b&&b(G)}}},[]),R!==null&&e(R)||null}m.memo(iyo);class _rt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{markerClusterer:null}),ho(this,"setClustererCallback",()=>{this.state.markerClusterer!==null&&this.props.onLoad&&this.props.onLoad(this.state.markerClusterer)})}componentDidMount(){if(this.context){var e=new Vrt(this.context,[],this.props.options);this.registeredEvents=Ua({updaterMap:zl,eventMap:bm,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({markerClusterer:e}),this.setClustererCallback)}}componentDidUpdate(e){this.state.markerClusterer&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:zl,eventMap:bm,prevProps:e,nextProps:this.props,instance:this.state.markerClusterer}))}componentWillUnmount(){this.state.markerClusterer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.markerClusterer),Ga(this.registeredEvents),this.state.markerClusterer.setMap(null))}render(){return this.state.markerClusterer!==null?this.props.children(this.state.markerClusterer):null}}ho(_rt,"contextType",Ta);function tMe(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()}var Grt=function(){function t(e){e===void 0&&(e={}),this.getCloseClickHandler=this.getCloseClickHandler.bind(this),this.closeClickHandler=this.closeClickHandler.bind(this),this.createInfoBoxDiv=this.createInfoBoxDiv.bind(this),this.addClickHandler=this.addClickHandler.bind(this),this.getCloseBoxImg=this.getCloseBoxImg.bind(this),this.getBoxWidths=this.getBoxWidths.bind(this),this.setBoxStyle=this.setBoxStyle.bind(this),this.setPosition=this.setPosition.bind(this),this.getPosition=this.getPosition.bind(this),this.setOptions=this.setOptions.bind(this),this.setContent=this.setContent.bind(this),this.setVisible=this.setVisible.bind(this),this.getContent=this.getContent.bind(this),this.getVisible=this.getVisible.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getZIndex=this.getZIndex.bind(this),this.onRemove=this.onRemove.bind(this),this.panBox=this.panBox.bind(this),this.extend=this.extend.bind(this),this.close=this.close.bind(this),this.draw=this.draw.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.open=this.open.bind(this),this.extend(t,google.maps.OverlayView),this.content=e.content||"",this.disableAutoPan=e.disableAutoPan||!1,this.maxWidth=e.maxWidth||0,this.pixelOffset=e.pixelOffset||new google.maps.Size(0,0),this.position=e.position||new google.maps.LatLng(0,0),this.zIndex=e.zIndex||null,this.boxClass=e.boxClass||"infoBox",this.boxStyle=e.boxStyle||{},this.closeBoxMargin=e.closeBoxMargin||"2px",this.closeBoxURL=e.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",e.closeBoxURL===""&&(this.closeBoxURL=""),this.infoBoxClearance=e.infoBoxClearance||new google.maps.Size(1,1),typeof e.visible>"u"&&(typeof e.isHidden>"u"?e.visible=!0:e.visible=!e.isHidden),this.isHidden=!e.visible,this.alignBottom=e.alignBottom||!1,this.pane=e.pane||"floatPane",this.enableEventPropagation=e.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return t.prototype.createInfoBoxDiv=function(){var e=this,n=function(u){u.returnValue=!1,u.preventDefault&&u.preventDefault(),e.enableEventPropagation||tMe(u)};if(!this.div){this.div=document.createElement("div"),this.setBoxStyle(),typeof this.content=="string"?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content));var o=this.getPanes();if(o!==null&&o[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(this.maxWidth!==0&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var r=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-r.left-r.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var i=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],a=0,l=i;al&&(o=y.x+d+c+p-l),this.alignBottom?y.y<-u+g+f?r=y.y+u-g-f:y.y+u+g>s&&(r=y.y+u+g-s):y.y<-u+g?r=y.y+u-g:y.y+f+u+g>s&&(r=y.y+f+u+g-s)),o===0&&r===0||n.panBy(o,r)}}},t.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var e=this.boxStyle;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this.div.style[n]=e[n]);if(this.div.style.webkitTransform="translateZ(0)",typeof this.div.style.opacity<"u"&&this.div.style.opacity!==""){var o=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+o*100+')"',this.div.style.filter="alpha(opacity="+o*100+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",this.zIndex!==null&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},t.prototype.getBoxWidths=function(){var e={top:0,bottom:0,left:0,right:0};if(!this.div)return e;if(document.defaultView){var n=this.div.ownerDocument,o=n&&n.defaultView?n.defaultView.getComputedStyle(this.div,""):null;o&&(e.top=parseInt(o.borderTopWidth||"",10)||0,e.bottom=parseInt(o.borderBottomWidth||"",10)||0,e.left=parseInt(o.borderLeftWidth||"",10)||0,e.right=parseInt(o.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var r=this.div.currentStyle;r&&(e.top=parseInt(r.borderTopWidth||"",10)||0,e.bottom=parseInt(r.borderBottomWidth||"",10)||0,e.left=parseInt(r.borderLeftWidth||"",10)||0,e.right=parseInt(r.borderRightWidth||"",10)||0)}return e},t.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},t.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var e=this.getProjection(),n=e.fromLatLngToDivPixel(this.position);n!==null&&(this.div.style.left=n.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(n.y+this.pixelOffset.height)+"px":this.div.style.top=n.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},t.prototype.setOptions=function(e){e===void 0&&(e={}),typeof e.boxClass<"u"&&(this.boxClass=e.boxClass,this.setBoxStyle()),typeof e.boxStyle<"u"&&(this.boxStyle=e.boxStyle,this.setBoxStyle()),typeof e.content<"u"&&this.setContent(e.content),typeof e.disableAutoPan<"u"&&(this.disableAutoPan=e.disableAutoPan),typeof e.maxWidth<"u"&&(this.maxWidth=e.maxWidth),typeof e.pixelOffset<"u"&&(this.pixelOffset=e.pixelOffset),typeof e.alignBottom<"u"&&(this.alignBottom=e.alignBottom),typeof e.position<"u"&&this.setPosition(e.position),typeof e.zIndex<"u"&&this.setZIndex(e.zIndex),typeof e.closeBoxMargin<"u"&&(this.closeBoxMargin=e.closeBoxMargin),typeof e.closeBoxURL<"u"&&(this.closeBoxURL=e.closeBoxURL),typeof e.infoBoxClearance<"u"&&(this.infoBoxClearance=e.infoBoxClearance),typeof e.isHidden<"u"&&(this.isHidden=e.isHidden),typeof e.visible<"u"&&(this.isHidden=!e.visible),typeof e.enableEventPropagation<"u"&&(this.enableEventPropagation=e.enableEventPropagation),this.div&&this.draw()},t.prototype.setContent=function(e){this.content=e,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px",typeof e=="string"?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},t.prototype.setPosition=function(e){this.position=e,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},t.prototype.setVisible=function(e){this.isHidden=!e,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},t.prototype.setZIndex=function(e){this.zIndex=e,this.div&&(this.div.style.zIndex=e+""),google.maps.event.trigger(this,"zindex_changed")},t.prototype.getContent=function(){return this.content},t.prototype.getPosition=function(){return this.position},t.prototype.getZIndex=function(){return this.zIndex},t.prototype.getVisible=function(){var e=this.getMap();return typeof e>"u"||e===null?!1:!this.isHidden},t.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},t.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},t.prototype.open=function(e,n){var o=this;n&&(this.position=n.getPosition(),this.moveListener=google.maps.event.addListener(n,"position_changed",function(){var r=n.getPosition();o.setPosition(r)}),this.mapListener=google.maps.event.addListener(n,"map_changed",function(){o.setMap(n.map)})),this.setMap(e),this.div&&this.panBox()},t.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var e=0,n=this.eventListeners;e{p&&g!==null&&(g.close(),n?g.open(p,n):g.getPosition()&&g.open(p))},[p,g,n]),m.useEffect(()=>{o&&g!==null&&g.setOptions(o)},[g,o]),m.useEffect(()=>{if(r&&g!==null){var F=r instanceof google.maps.LatLng?r:new google.maps.LatLng(r.lat,r.lng);g.setPosition(F)}},[r]),m.useEffect(()=>{typeof i=="number"&&g!==null&&g.setZIndex(i)},[i]),m.useEffect(()=>{g&&a&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(g,"closeclick",a)))},[a]),m.useEffect(()=>{g&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(g,"domready",l)))},[l]),m.useEffect(()=>{g&&s&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(g,"content_changed",s)))},[s]),m.useEffect(()=>{g&&c&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(g,"position_changed",c)))},[c]),m.useEffect(()=>{g&&u&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),m.useEffect(()=>{if(p){var F=o||syo,{position:E}=F,N=N9e(F,ayo),U;E&&!(E instanceof google.maps.LatLng)&&(U=new google.maps.LatLng(E.lat,E.lng));var W=new Grt(pJ(pJ({},N),U?{position:U}:{}));H.current=document.createElement("div"),A(W),a&&S(google.maps.event.addListener(W,"closeclick",a)),l&&P(google.maps.event.addListener(W,"domready",l)),s&&T(google.maps.event.addListener(W,"content_changed",s)),c&&x(google.maps.event.addListener(W,"position_changed",c)),u&&R(google.maps.event.addListener(W,"zindex_changed",u)),W.setContent(H.current),n?W.open(p,n):W.getPosition()?W.open(p):Gu(!1,"You must provide either an anchor or a position prop for ."),d&&d(W)}return()=>{g!==null&&(y&&google.maps.event.removeListener(y),v&&google.maps.event.removeListener(v),C&&google.maps.event.removeListener(C),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),f&&f(g),g.close())}},[]),H.current?Hd.createPortal(m.Children.only(e),H.current):null}m.memo(cyo);class uyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",null),ho(this,"state",{infoBox:null}),ho(this,"open",(e,n)=>{n?this.context!==null&&e.open(this.context,n):e.getPosition()?this.context!==null&&e.open(this.context):Gu(!1,"You must provide either an anchor or a position prop for .")}),ho(this,"setInfoBoxCallback",()=>{this.state.infoBox!==null&&this.containerElement!==null&&(this.state.infoBox.setContent(this.containerElement),this.open(this.state.infoBox,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoBox))})}componentDidMount(){var e=this.props.options||{},{position:n}=e,o=N9e(e,lyo),r;n&&!(n instanceof google.maps.LatLng)&&(r=new google.maps.LatLng(n.lat,n.lng));var i=new Grt(pJ(pJ({},o),r?{position:r}:{}));this.containerElement=document.createElement("div"),this.registeredEvents=Ua({updaterMap:rMe,eventMap:oMe,prevProps:{},nextProps:this.props,instance:i}),this.setState({infoBox:i},this.setInfoBoxCallback)}componentDidUpdate(e){var{infoBox:n}=this.state;n!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:rMe,eventMap:oMe,prevProps:e,nextProps:this.props,instance:n}))}componentWillUnmount(){var{onUnmount:e}=this.props,{infoBox:n}=this.state;n!==null&&(e&&e(n),Ga(this.registeredEvents),n.close())}render(){return this.containerElement?Hd.createPortal(m.Children.only(this.props.children),this.containerElement):null}}ho(uyo,"contextType",Ta);var Zae,iMe;function dyo(){return iMe||(iMe=1,Zae=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(e)){if(o=e.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n}),Zae}var fyo=dyo(),aMe=Wrt(fyo),lMe=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ele=1,iD=8;class U9e{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");var[n,o]=new Uint8Array(e,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");var r=o>>4;if(r!==ele)throw new Error("Got v".concat(r," data when expected v").concat(ele,"."));var i=lMe[o&15];if(!i)throw new Error("Unrecognized array type.");var[a]=new Uint16Array(e,2,1),[l]=new Uint32Array(e,4,1);return new U9e(l,a,i,e)}constructor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:64,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float64Array,r=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;var i=lMe.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-l%8)%8;if(i<0)throw new Error("Unexpected typed array class: ".concat(o,"."));r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,iD,e),this.coords=new this.ArrayType(this.data,iD+l+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(iD+a+l+s),this.ids=new this.IndexArrayType(this.data,iD,e),this.coords=new this.ArrayType(this.data,iD+l+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ele<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=e)}add(e,n){var o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=n,o}finish(){var e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return xfe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,n,o,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:i,coords:a,nodeSize:l}=this,s=[0,i.length-1,0],c=[];s.length;){var u=s.pop()||0,d=s.pop()||0,f=s.pop()||0;if(d-f<=l){for(var p=f;p<=d;p++){var g=a[2*p],A=a[2*p+1];g>=e&&g<=o&&A>=n&&A<=r&&c.push(i[p])}continue}var y=f+d>>1,S=a[2*y],C=a[2*y+1];S>=e&&S<=o&&C>=n&&C<=r&&c.push(i[y]),(u===0?e<=S:n<=C)&&(s.push(f),s.push(y-1),s.push(1-u)),(u===0?o>=S:r>=C)&&(s.push(y+1),s.push(d),s.push(1-u))}return c}within(e,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");for(var{ids:r,coords:i,nodeSize:a}=this,l=[0,r.length-1,0],s=[],c=o*o;l.length;){var u=l.pop()||0,d=l.pop()||0,f=l.pop()||0;if(d-f<=a){for(var p=f;p<=d;p++)sMe(i[2*p],i[2*p+1],e,n)<=c&&s.push(r[p]);continue}var g=f+d>>1,A=i[2*g],y=i[2*g+1];sMe(A,y,e,n)<=c&&s.push(r[g]),(u===0?e-o<=A:n-o<=y)&&(l.push(f),l.push(g-1),l.push(1-u)),(u===0?e+o>=A:n+o>=y)&&(l.push(g+1),l.push(d),l.push(1-u))}return s}}function xfe(t,e,n,o,r,i){if(!(r-o<=n)){var a=o+r>>1;Xrt(t,e,a,o,r,i),xfe(t,e,n,o,a-1,1-i),xfe(t,e,n,a+1,r,1-i)}}function Xrt(t,e,n,o,r,i){for(;r>o;){if(r-o>600){var a=r-o+1,l=n-o+1,s=Math.log(a),c=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*c*(a-c)/a)*(l-a/2<0?-1:1),d=Math.max(o,Math.floor(n-l*c/a+u)),f=Math.min(r,Math.floor(n+(a-l)*c/a+u));Xrt(t,e,n,d,f,i)}var p=e[2*n+i],g=o,A=r;for(aD(t,e,o,n),e[2*r+i]>p&&aD(t,e,o,r);gp;)A--}e[2*o+i]===p?aD(t,e,o,A):(A++,aD(t,e,A,r)),A<=n&&(o=A+1),n<=A&&(r=A-1)}}function aD(t,e,n,o){tle(t,n,o),tle(e,2*n,2*o),tle(e,2*n+1,2*o+1)}function tle(t,e,n){var o=t[e];t[e]=t[n],t[n]=o}function sMe(t,e,n,o){var r=t-n,i=e-o;return r*r+i*i}var hyo={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},cMe=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),rv=2,e8=3,nle=4,Y4=5,Jrt=6;class pyo{constructor(e){this.options=Object.assign(Object.create(hyo),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){var{log:n,minZoom:o,maxZoom:r}=this.options;n&&console.time("total time");var i="prepare ".concat(e.length," points");n&&console.time(i),this.points=e;for(var a=[],l=0;l=o;g--){var A=+Date.now();p=this.trees[g]=this._createTree(this._cluster(p,g)),n&&console.log("z%d: %d clusters in %dms",g,p.numItems,+Date.now()-A)}return n&&console.timeEnd("total time"),this}getClusters(e,n){var o=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,i=180;else if(o>i){var l=this.getClusters([o,r,180,a],n),s=this.getClusters([-180,r,i,a],n);return l.concat(s)}var c=this.trees[this._limitZoom(n)],u=c.range(VO(o),_O(a),VO(i),_O(r)),d=c.data,f=[];for(var p of u){var g=this.stride*p;f.push(d[g+Y4]>1?uMe(d,g,this.clusterProps):this.points[d[g+e8]])}return f}getChildren(e){var n=this._getOriginId(e),o=this._getOriginZoom(e),r="No cluster with the specified id.",i=this.trees[o];if(!i)throw new Error(r);var a=i.data;if(n*this.stride>=a.length)throw new Error(r);var l=this.options.radius/(this.options.extent*Math.pow(2,o-1)),s=a[n*this.stride],c=a[n*this.stride+1],u=i.within(s,c,l),d=[];for(var f of u){var p=f*this.stride;a[p+nle]===e&&d.push(a[p+Y4]>1?uMe(a,p,this.clusterProps):this.points[a[p+e8]])}if(d.length===0)throw new Error(r);return d}getLeaves(e,n,o){n=n||10,o=o||0;var r=[];return this._appendLeaves(r,e,n,o,0),r}getTile(e,n,o){var r=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:a,radius:l}=this.options,s=l/a,c=(o-s)/i,u=(o+1+s)/i,d={features:[]};return this._addTileFeatures(r.range((n-s)/i,c,(n+1+s)/i,u),r.data,n,o,i,d),n===0&&this._addTileFeatures(r.range(1-s/i,c,1,u),r.data,i,o,i,d),n===i-1&&this._addTileFeatures(r.range(0,c,s/i,u),r.data,-1,o,i,d),d.features.length?d:null}getClusterExpansionZoom(e){for(var n=this._getOriginZoom(e)-1;n<=this.options.maxZoom;){var o=this.getChildren(e);if(n++,o.length!==1)break;e=o[0].properties.cluster_id}return n}_appendLeaves(e,n,o,r,i){var a=this.getChildren(n);for(var l of a){var s=l.properties;if(s&&s.cluster?i+s.point_count<=r?i+=s.point_count:i=this._appendLeaves(e,s.cluster_id,o,r,i):i1,u=void 0,d=void 0,f=void 0;if(c)u=Krt(n,s,this.clusterProps),d=n[s],f=n[s+1];else{var p=this.points[n[s+e8]];u=p.properties;var[g,A]=p.geometry.coordinates;d=VO(g),f=_O(A)}var y={type:1,geometry:[[Math.round(this.options.extent*(d*i-o)),Math.round(this.options.extent*(f*i-r))]],tags:u},S=void 0;c||this.options.generateId?S=n[s+e8]:S=this.points[n[s+e8]].id,S!==void 0&&(y.id=S),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,n){for(var{radius:o,extent:r,reduce:i,minPoints:a}=this.options,l=o/(r*Math.pow(2,n)),s=e.data,c=[],u=this.stride,d=0;dn&&(y+=s[C+Y4])}if(y>A&&y>=a){var P=f*A,v=p*A,T=void 0,w=-1,x=((d/u|0)<<5)+(n+1)+this.points.length;for(var b of g){var R=b*u;if(!(s[R+rv]<=n)){s[R+rv]=n;var H=s[R+Y4];P+=s[R]*H,v+=s[R+1]*H,s[R+nle]=x,i&&(T||(T=this._map(s,d,!0),w=this.clusterProps.length,this.clusterProps.push(T)),i(T,this._map(s,R)))}}s[d+nle]=x,c.push(P/y,v/y,1/0,x,-1,y),i&&c.push(w)}else{for(var F=0;F1)for(var E of g){var N=E*u;if(!(s[N+rv]<=n)){s[N+rv]=n;for(var U=0;U>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,n,o){if(e[n+Y4]>1){var r=this.clusterProps[e[n+Jrt]];return o?Object.assign({},r):r}var i=this.points[e[n+e8]].properties,a=this.options.map(i);return o&&a===i?Object.assign({},a):a}}function uMe(t,e,n){return{type:"Feature",id:t[e+e8],properties:Krt(t,e,n),geometry:{type:"Point",coordinates:[gyo(t[e]),myo(t[e+1])]}}}function Krt(t,e,n){var o=t[e+Y4],r=o>=1e4?"".concat(Math.round(o/1e3),"k"):o>=1e3?"".concat(Math.round(o/100)/10,"k"):o,i=t[e+Jrt],a=i===-1?{}:Object.assign({},n[i]);return Object.assign(a,{cluster:!0,cluster_id:t[e+e8],point_count:o,point_count_abbreviated:r})}function VO(t){return t/360+.5}function _O(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function gyo(t){return(t-.5)*360}function myo(t){var e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -7150,7 +7150,7 @@ PERFORMANCE OF THIS SOFTWARE. `).concat(r,` -`),s="Cluster of ".concat(r," markers"),c=Number(google.maps.Marker.MAX_ZINDEX)+r;if(ag.isAdvancedMarkerAvailable(o)){var u=new DOMParser,d=u.parseFromString(l,"image/svg+xml").documentElement;d.setAttribute("transform","translate(0 25)");var f={map:o,position:i,zIndex:c,title:s,content:d};return new google.maps.marker.AdvancedMarkerElement(f)}var p={position:i,zIndex:c,title:s,icon:{url:"data:image/svg+xml;base64,".concat(btoa(l)),anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(p)}}function Syo(t,e){for(var n in e.prototype)t.prototype[n]=e.prototype[n]}class j9e{constructor(){Syo(j9e,google.maps.OverlayView)}}var VE;(function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"})(VE||(VE={}));var Tyo=(t,e,n)=>{n.fitBounds(e.bounds)};class Pyo extends j9e{constructor(e){var{map:n,markers:o=[],algorithmOptions:r={},algorithm:i=new vyo(r),renderer:a=new byo,onClusterClick:l=Tyo}=e;super(),this.markers=[...o],this.clusters=[],this.algorithm=i,this.renderer=a,this.onClusterClick=l,n&&this.setMap(n)}addMarker(e,n){this.markers.includes(e)||(this.markers.push(e),n||this.render())}addMarkers(e,n){e.forEach(o=>{this.addMarker(o,!0)}),n||this.render()}removeMarker(e,n){var o=this.markers.indexOf(e);return o===-1?!1:(ag.setMap(e,null),this.markers.splice(o,1),n||this.render(),!0)}removeMarkers(e,n){var o=!1;return e.forEach(r=>{o=this.removeMarker(r,!0)||o}),o&&!n&&this.render(),o}clearMarkers(e){this.markers.length=0,e||this.render()}render(){var e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,VE.CLUSTERING_BEGIN,this);var{clusters:n,changed:o}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(o||o==null){var r=new Set;for(var i of n)i.markers.length==1&&r.add(i.markers[0]);var a=[];for(var l of this.clusters)l.marker!=null&&(l.markers.length==1?r.has(l.marker)||ag.setMap(l.marker,null):a.push(l.marker));this.clusters=n,this.renderClusters(),requestAnimationFrame(()=>a.forEach(s=>ag.setMap(s,null)))}google.maps.event.trigger(this,VE.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>ag.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){var e=new xyo(this.markers,this.clusters),n=this.getMap();this.clusters.forEach(o=>{o.markers.length===1?o.marker=o.markers[0]:(o.marker=this.renderer.render(o,e,n),o.markers.forEach(r=>ag.setMap(r,null)),this.onClusterClick&&o.marker.addListener("click",r=>{google.maps.event.trigger(this,VE.CLUSTER_CLICK,o),this.onClusterClick(r,o,n)})),ag.setMap(o.marker,n)})}}function dMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fMe(t){for(var e=1;e{if(e&&n===null){var r=new Pyo(fMe(fMe({},t),{},{map:e}));o(r)}},[e]),n}function Ryo(t){var{children:e,options:n}=t,o=Cyo(n);return o!==null?e(o):null}m.memo(Ryo);var hMe={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},pMe={options(t,e){t.setOptions(e)},position(t,e){t.setPosition(e)},zIndex(t,e){t.setZIndex(e)}};function Hyo(t){var{children:e,anchor:n,options:o,position:r,zIndex:i,onCloseClick:a,onDomReady:l,onContentChanged:s,onPositionChanged:c,onZindexChanged:u,onLoad:d,onUnmount:f}=t,p=m.useContext(Ta),[g,A]=m.useState(null),[y,S]=m.useState(null),[C,P]=m.useState(null),[v,T]=m.useState(null),[w,x]=m.useState(null),[b,R]=m.useState(null),H=m.useRef(null);return m.useEffect(()=>{g!==null&&(g.close(),n?g.open(p,n):g.getPosition()&&g.open(p))},[p,g,n]),m.useEffect(()=>{o&&g!==null&&g.setOptions(o)},[g,o]),m.useEffect(()=>{r&&g!==null&&g.setPosition(r)},[r]),m.useEffect(()=>{typeof i=="number"&&g!==null&&g.setZIndex(i)},[i]),m.useEffect(()=>{g&&a&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(g,"closeclick",a)))},[a]),m.useEffect(()=>{g&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(g,"domready",l)))},[l]),m.useEffect(()=>{g&&s&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(g,"content_changed",s)))},[s]),m.useEffect(()=>{g&&c&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(g,"position_changed",c)))},[c]),m.useEffect(()=>{g&&u&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),m.useEffect(()=>{var F=new google.maps.InfoWindow(o);return A(F),H.current=document.createElement("div"),a&&S(google.maps.event.addListener(F,"closeclick",a)),l&&P(google.maps.event.addListener(F,"domready",l)),s&&T(google.maps.event.addListener(F,"content_changed",s)),c&&x(google.maps.event.addListener(F,"position_changed",c)),u&&R(google.maps.event.addListener(F,"zindex_changed",u)),F.setContent(H.current),r&&F.setPosition(r),i&&F.setZIndex(i),n?F.open(p,n):F.getPosition()?F.open(p):Gu(!1,"You must provide either an anchor (typically render it inside a ) or a position props for ."),d&&d(F),()=>{y&&google.maps.event.removeListener(y),v&&google.maps.event.removeListener(v),C&&google.maps.event.removeListener(C),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),f&&f(F),F.close()}},[]),H.current?Hd.createPortal(m.Children.only(e),H.current):null}m.memo(Hyo);class qrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",null),ho(this,"state",{infoWindow:null}),ho(this,"open",(e,n)=>{n?e.open(this.context,n):e.getPosition()?e.open(this.context):Gu(!1,"You must provide either an anchor (typically render it inside a ) or a position props for .")}),ho(this,"setInfoWindowCallback",()=>{this.state.infoWindow!==null&&this.containerElement!==null&&(this.state.infoWindow.setContent(this.containerElement),this.open(this.state.infoWindow,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoWindow))})}componentDidMount(){var e=new google.maps.InfoWindow(this.props.options);this.containerElement=document.createElement("div"),this.registeredEvents=Ua({updaterMap:pMe,eventMap:hMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({infoWindow:e}),this.setInfoWindowCallback)}componentDidUpdate(e){this.state.infoWindow!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:pMe,eventMap:hMe,prevProps:e,nextProps:this.props,instance:this.state.infoWindow}))}componentWillUnmount(){this.state.infoWindow!==null&&(Ga(this.registeredEvents),this.props.onUnmount&&this.props.onUnmount(this.state.infoWindow),this.state.infoWindow.close())}render(){return this.containerElement?Hd.createPortal(m.Children.only(this.props.children),this.containerElement):null}}ho(qrt,"contextType",Ta);function gMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function gJ(t){for(var e=1;e{v!==null&&v.setMap(P)},[P]),m.useEffect(()=>{typeof e<"u"&&v!==null&&v.setOptions(e)},[v,e]),m.useEffect(()=>{typeof n<"u"&&v!==null&&v.setDraggable(n)},[v,n]),m.useEffect(()=>{typeof o<"u"&&v!==null&&v.setEditable(o)},[v,o]),m.useEffect(()=>{typeof r<"u"&&v!==null&&v.setVisible(r)},[v,r]),m.useEffect(()=>{typeof i<"u"&&v!==null&&v.setPath(i)},[v,i]),m.useEffect(()=>{v&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(v,"dblclick",a)))},[a]),m.useEffect(()=>{v&&l&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(v,"dragend",l)))},[l]),m.useEffect(()=>{v&&s&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(v,"dragstart",s)))},[s]),m.useEffect(()=>{v&&c&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(v,"mousedown",c)))},[c]),m.useEffect(()=>{v&&u&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(v,"mousemove",u)))},[u]),m.useEffect(()=>{v&&d&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(v,"mouseout",d)))},[d]),m.useEffect(()=>{v&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(v,"mouseover",f)))},[f]),m.useEffect(()=>{v&&p&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(v,"mouseup",p)))},[p]),m.useEffect(()=>{v&&g&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(v,"rightclick",g)))},[g]),m.useEffect(()=>{v&&A&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(v,"click",A)))},[A]),m.useEffect(()=>{v&&y&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(v,"drag",y)))},[y]),m.useEffect(()=>{var se=new google.maps.Polyline(gJ(gJ({},e||Myo),{},{map:P}));return i&&se.setPath(i),typeof r<"u"&&se.setVisible(r),typeof o<"u"&&se.setEditable(o),typeof n<"u"&&se.setDraggable(n),a&&x(google.maps.event.addListener(se,"dblclick",a)),l&&R(google.maps.event.addListener(se,"dragend",l)),s&&F(google.maps.event.addListener(se,"dragstart",s)),c&&N(google.maps.event.addListener(se,"mousedown",c)),u&&W(google.maps.event.addListener(se,"mousemove",u)),d&&D(google.maps.event.addListener(se,"mouseout",d)),f&&j(google.maps.event.addListener(se,"mouseover",f)),p&&O(google.maps.event.addListener(se,"mouseup",p)),g&&G(google.maps.event.addListener(se,"rightclick",g)),A&&$(google.maps.event.addListener(se,"click",A)),y&&Q(google.maps.event.addListener(se,"drag",y)),T(se),S&&S(se),()=>{w!==null&&google.maps.event.removeListener(w),b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),C&&C(se),se.setMap(null)}},[]),null}m.memo(Iyo);class zyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{polyline:null}),ho(this,"setPolylineCallback",()=>{this.state.polyline!==null&&this.props.onLoad&&this.props.onLoad(this.state.polyline)})}componentDidMount(){var e=new google.maps.Polyline(gJ(gJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:yMe,eventMap:mMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{polyline:e}},this.setPolylineCallback)}componentDidUpdate(e){this.state.polyline!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:yMe,eventMap:mMe,prevProps:e,nextProps:this.props,instance:this.state.polyline}))}componentWillUnmount(){this.state.polyline!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.polyline),Ga(this.registeredEvents),this.state.polyline.setMap(null))}render(){return null}}ho(zyo,"contextType",Ta);function AMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function wMe(t){for(var e=1;e{w!==null&&w.setMap(T)},[T]),m.useEffect(()=>{typeof e<"u"&&w!==null&&w.setOptions(e)},[w,e]),m.useEffect(()=>{typeof n<"u"&&w!==null&&w.setDraggable(n)},[w,n]),m.useEffect(()=>{typeof o<"u"&&w!==null&&w.setEditable(o)},[w,o]),m.useEffect(()=>{typeof r<"u"&&w!==null&&w.setVisible(r)},[w,r]),m.useEffect(()=>{typeof i<"u"&&w!==null&&w.setPath(i)},[w,i]),m.useEffect(()=>{typeof a<"u"&&w!==null&&w.setPaths(a)},[w,a]),m.useEffect(()=>{w&&typeof l=="function"&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(w,"dblclick",l)))},[l]),m.useEffect(()=>{w&&(google.maps.event.addListener(w.getPath(),"insert_at",()=>{v==null||v(w)}),google.maps.event.addListener(w.getPath(),"set_at",()=>{v==null||v(w)}),google.maps.event.addListener(w.getPath(),"remove_at",()=>{v==null||v(w)}))},[w,v]),m.useEffect(()=>{w&&typeof s=="function"&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(w,"dragend",s)))},[s]),m.useEffect(()=>{w&&typeof c=="function"&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(w,"dragstart",c)))},[c]),m.useEffect(()=>{w&&typeof u=="function"&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(w,"mousedown",u)))},[u]),m.useEffect(()=>{w&&typeof d=="function"&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(w,"mousemove",d)))},[d]),m.useEffect(()=>{w&&typeof f=="function"&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(w,"mouseout",f)))},[f]),m.useEffect(()=>{w&&typeof p=="function"&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(w,"mouseover",p)))},[p]),m.useEffect(()=>{w&&typeof g=="function"&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(w,"mouseup",g)))},[g]),m.useEffect(()=>{w&&typeof A=="function"&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(w,"rightclick",A)))},[A]),m.useEffect(()=>{w&&typeof y=="function"&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(w,"click",y)))},[y]),m.useEffect(()=>{w&&typeof S=="function"&&(se!==null&&google.maps.event.removeListener(se),Z(google.maps.event.addListener(w,"drag",S)))},[S]),m.useEffect(()=>{var ee=new google.maps.Polygon(wMe(wMe({},e),{},{map:T}));return i&&ee.setPath(i),a&&ee.setPaths(a),typeof r<"u"&&ee.setVisible(r),typeof o<"u"&&ee.setEditable(o),typeof n<"u"&&ee.setDraggable(n),l&&R(google.maps.event.addListener(ee,"dblclick",l)),s&&F(google.maps.event.addListener(ee,"dragend",s)),c&&N(google.maps.event.addListener(ee,"dragstart",c)),u&&W(google.maps.event.addListener(ee,"mousedown",u)),d&&D(google.maps.event.addListener(ee,"mousemove",d)),f&&j(google.maps.event.addListener(ee,"mouseout",f)),p&&O(google.maps.event.addListener(ee,"mouseover",p)),g&&G(google.maps.event.addListener(ee,"mouseup",g)),A&&$(google.maps.event.addListener(ee,"rightclick",A)),y&&Q(google.maps.event.addListener(ee,"click",y)),S&&Z(google.maps.event.addListener(ee,"drag",S)),x(ee),C&&C(ee),()=>{b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),ie!==null&&google.maps.event.removeListener(ie),P&&P(ee),ee.setMap(null)}},[]),null}m.memo(Dyo);class Eyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[])}componentDidMount(){var e=this.props.options||{};this.polygon=new google.maps.Polygon(e),this.polygon.setMap(this.context),this.registeredEvents=Ua({updaterMap:xMe,eventMap:vMe,prevProps:{},nextProps:this.props,instance:this.polygon}),this.props.onLoad&&this.props.onLoad(this.polygon)}componentDidUpdate(e){this.polygon&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:xMe,eventMap:vMe,prevProps:e,nextProps:this.props,instance:this.polygon}))}componentWillUnmount(){this.polygon&&(this.props.onUnmount&&this.props.onUnmount(this.polygon),Ga(this.registeredEvents),this.polygon&&this.polygon.setMap(null))}render(){return null}}ho(Eyo,"contextType",Ta);function bMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function mJ(t){for(var e=1;e{T!==null&&T.setMap(v)},[v]),m.useEffect(()=>{typeof e<"u"&&T!==null&&T.setOptions(e)},[T,e]),m.useEffect(()=>{typeof o<"u"&&T!==null&&T.setDraggable(o)},[T,o]),m.useEffect(()=>{typeof r<"u"&&T!==null&&T.setEditable(r)},[T,r]),m.useEffect(()=>{typeof i<"u"&&T!==null&&T.setVisible(i)},[T,i]),m.useEffect(()=>{typeof n<"u"&&T!==null&&T.setBounds(n)},[T,n]),m.useEffect(()=>{T&&a&&(x!==null&&google.maps.event.removeListener(x),b(google.maps.event.addListener(T,"dblclick",a)))},[a]),m.useEffect(()=>{T&&l&&(R!==null&&google.maps.event.removeListener(R),H(google.maps.event.addListener(T,"dragend",l)))},[l]),m.useEffect(()=>{T&&s&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(T,"dragstart",s)))},[s]),m.useEffect(()=>{T&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(T,"mousedown",c)))},[c]),m.useEffect(()=>{T&&u&&(W!==null&&google.maps.event.removeListener(W),k(google.maps.event.addListener(T,"mousemove",u)))},[u]),m.useEffect(()=>{T&&d&&(D!==null&&google.maps.event.removeListener(D),L(google.maps.event.addListener(T,"mouseout",d)))},[d]),m.useEffect(()=>{T&&f&&(j!==null&&google.maps.event.removeListener(j),B(google.maps.event.addListener(T,"mouseover",f)))},[f]),m.useEffect(()=>{T&&p&&(O!==null&&google.maps.event.removeListener(O),V(google.maps.event.addListener(T,"mouseup",p)))},[p]),m.useEffect(()=>{T&&g&&(G!==null&&google.maps.event.removeListener(G),q(google.maps.event.addListener(T,"rightclick",g)))},[g]),m.useEffect(()=>{T&&A&&($!==null&&google.maps.event.removeListener($),ie(google.maps.event.addListener(T,"click",A)))},[A]),m.useEffect(()=>{T&&y&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener(T,"drag",y)))},[y]),m.useEffect(()=>{T&&S&&(Z!==null&&google.maps.event.removeListener(Z),ee(google.maps.event.addListener(T,"bounds_changed",S)))},[S]),m.useEffect(()=>{var te=new google.maps.Rectangle(mJ(mJ({},e),{},{map:v}));return typeof i<"u"&&te.setVisible(i),typeof r<"u"&&te.setEditable(r),typeof o<"u"&&te.setDraggable(o),typeof n<"u"&&te.setBounds(n),a&&b(google.maps.event.addListener(te,"dblclick",a)),l&&H(google.maps.event.addListener(te,"dragend",l)),s&&E(google.maps.event.addListener(te,"dragstart",s)),c&&U(google.maps.event.addListener(te,"mousedown",c)),u&&k(google.maps.event.addListener(te,"mousemove",u)),d&&L(google.maps.event.addListener(te,"mouseout",d)),f&&B(google.maps.event.addListener(te,"mouseover",f)),p&&V(google.maps.event.addListener(te,"mouseup",p)),g&&q(google.maps.event.addListener(te,"rightclick",g)),A&&ie(google.maps.event.addListener(te,"click",A)),y&&se(google.maps.event.addListener(te,"drag",y)),S&&ee(google.maps.event.addListener(te,"bounds_changed",S)),w(te),C&&C(te),()=>{x!==null&&google.maps.event.removeListener(x),R!==null&&google.maps.event.removeListener(R),F!==null&&google.maps.event.removeListener(F),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),D!==null&&google.maps.event.removeListener(D),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),$!==null&&google.maps.event.removeListener($),Q!==null&&google.maps.event.removeListener(Q),Z!==null&&google.maps.event.removeListener(Z),P&&P(te),te.setMap(null)}},[]),null}m.memo(Fyo);let kyo=class extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{rectangle:null}),ho(this,"setRectangleCallback",()=>{this.state.rectangle!==null&&this.props.onLoad&&this.props.onLoad(this.state.rectangle)})}componentDidMount(){var e=new google.maps.Rectangle(mJ(mJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:TMe,eventMap:SMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{rectangle:e}},this.setRectangleCallback)}componentDidUpdate(e){this.state.rectangle!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:TMe,eventMap:SMe,prevProps:e,nextProps:this.props,instance:this.state.rectangle}))}componentWillUnmount(){this.state.rectangle!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.rectangle),Ga(this.registeredEvents),this.state.rectangle.setMap(null))}render(){return null}};ho(kyo,"contextType",Ta);function PMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function yJ(t){for(var e=1;e{x!==null&&x.setMap(w)},[w]),m.useEffect(()=>{typeof e<"u"&&x!==null&&x.setOptions(e)},[x,e]),m.useEffect(()=>{typeof r<"u"&&x!==null&&x.setDraggable(r)},[x,r]),m.useEffect(()=>{typeof i<"u"&&x!==null&&x.setEditable(i)},[x,i]),m.useEffect(()=>{typeof a<"u"&&x!==null&&x.setVisible(a)},[x,a]),m.useEffect(()=>{typeof o=="number"&&x!==null&&x.setRadius(o)},[x,o]),m.useEffect(()=>{typeof n<"u"&&x!==null&&x.setCenter(n)},[x,n]),m.useEffect(()=>{x&&l&&(R!==null&&google.maps.event.removeListener(R),H(google.maps.event.addListener(x,"dblclick",l)))},[l]),m.useEffect(()=>{x&&s&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(x,"dragend",s)))},[s]),m.useEffect(()=>{x&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(x,"dragstart",c)))},[c]),m.useEffect(()=>{x&&u&&(W!==null&&google.maps.event.removeListener(W),k(google.maps.event.addListener(x,"mousedown",u)))},[u]),m.useEffect(()=>{x&&d&&(D!==null&&google.maps.event.removeListener(D),L(google.maps.event.addListener(x,"mousemove",d)))},[d]),m.useEffect(()=>{x&&f&&(j!==null&&google.maps.event.removeListener(j),B(google.maps.event.addListener(x,"mouseout",f)))},[f]),m.useEffect(()=>{x&&p&&(O!==null&&google.maps.event.removeListener(O),V(google.maps.event.addListener(x,"mouseover",p)))},[p]),m.useEffect(()=>{x&&g&&(G!==null&&google.maps.event.removeListener(G),q(google.maps.event.addListener(x,"mouseup",g)))},[g]),m.useEffect(()=>{x&&A&&($!==null&&google.maps.event.removeListener($),ie(google.maps.event.addListener(x,"rightclick",A)))},[A]),m.useEffect(()=>{x&&y&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener(x,"click",y)))},[y]),m.useEffect(()=>{x&&S&&(Z!==null&&google.maps.event.removeListener(Z),ee(google.maps.event.addListener(x,"drag",S)))},[S]),m.useEffect(()=>{x&&C&&(te!==null&&google.maps.event.removeListener(te),oe(google.maps.event.addListener(x,"center_changed",C)))},[y]),m.useEffect(()=>{x&&P&&(de!==null&&google.maps.event.removeListener(de),he(google.maps.event.addListener(x,"radius_changed",P)))},[P]),m.useEffect(()=>{var pe=new google.maps.Circle(yJ(yJ({},e||Lyo),{},{map:w}));return typeof o=="number"&&pe.setRadius(o),typeof n<"u"&&pe.setCenter(n),typeof o=="number"&&pe.setRadius(o),typeof a<"u"&&pe.setVisible(a),typeof i<"u"&&pe.setEditable(i),typeof r<"u"&&pe.setDraggable(r),l&&H(google.maps.event.addListener(pe,"dblclick",l)),s&&E(google.maps.event.addListener(pe,"dragend",s)),c&&U(google.maps.event.addListener(pe,"dragstart",c)),u&&k(google.maps.event.addListener(pe,"mousedown",u)),d&&L(google.maps.event.addListener(pe,"mousemove",d)),f&&B(google.maps.event.addListener(pe,"mouseout",f)),p&&V(google.maps.event.addListener(pe,"mouseover",p)),g&&q(google.maps.event.addListener(pe,"mouseup",g)),A&&ie(google.maps.event.addListener(pe,"rightclick",A)),y&&se(google.maps.event.addListener(pe,"click",y)),S&&ee(google.maps.event.addListener(pe,"drag",S)),C&&oe(google.maps.event.addListener(pe,"center_changed",C)),P&&he(google.maps.event.addListener(pe,"radius_changed",P)),b(pe),v&&v(pe),()=>{R!==null&&google.maps.event.removeListener(R),F!==null&&google.maps.event.removeListener(F),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),D!==null&&google.maps.event.removeListener(D),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),$!==null&&google.maps.event.removeListener($),Q!==null&&google.maps.event.removeListener(Q),te!==null&&google.maps.event.removeListener(te),de!==null&&google.maps.event.removeListener(de),T&&T(pe),pe.setMap(null)}},[]),null}m.memo(Wyo);class Nyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{circle:null}),ho(this,"setCircleCallback",()=>{this.state.circle!==null&&this.props.onLoad&&this.props.onLoad(this.state.circle)})}componentDidMount(){var e=new google.maps.Circle(yJ(yJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:RMe,eventMap:CMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{circle:e}},this.setCircleCallback)}componentDidUpdate(e){this.state.circle!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:RMe,eventMap:CMe,prevProps:e,nextProps:this.props,instance:this.state.circle}))}componentWillUnmount(){if(this.state.circle!==null){var e;this.props.onUnmount&&this.props.onUnmount(this.state.circle),Ga(this.registeredEvents),(e=this.state.circle)===null||e===void 0||e.setMap(null)}}render(){return null}}ho(Nyo,"contextType",Ta);function HMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function AJ(t){for(var e=1;e{C!==null&&C.setMap(S)},[S]),m.useEffect(()=>{C&&o&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(C,"dblclick",o)))},[o]),m.useEffect(()=>{C&&r&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(C,"mousedown",r)))},[r]),m.useEffect(()=>{C&&i&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(C,"mousemove",i)))},[i]),m.useEffect(()=>{C&&a&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(C,"mouseout",a)))},[a]),m.useEffect(()=>{C&&l&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(C,"mouseover",l)))},[l]),m.useEffect(()=>{C&&s&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(C,"mouseup",s)))},[s]),m.useEffect(()=>{C&&c&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(C,"rightclick",c)))},[c]),m.useEffect(()=>{C&&n&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(C,"click",n)))},[n]),m.useEffect(()=>{C&&u&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(C,"addfeature",u)))},[u]),m.useEffect(()=>{C&&d&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(C,"removefeature",d)))},[d]),m.useEffect(()=>{C&&f&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(C,"removeproperty",f)))},[f]),m.useEffect(()=>{C&&p&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(C,"setgeometry",p)))},[p]),m.useEffect(()=>{C&&g&&(se!==null&&google.maps.event.removeListener(se),Z(google.maps.event.addListener(C,"setproperty",g)))},[g]),m.useEffect(()=>{if(S!==null){var ee=new google.maps.Data(AJ(AJ({},e),{},{map:S}));o&&T(google.maps.event.addListener(ee,"dblclick",o)),r&&x(google.maps.event.addListener(ee,"mousedown",r)),i&&R(google.maps.event.addListener(ee,"mousemove",i)),a&&F(google.maps.event.addListener(ee,"mouseout",a)),l&&N(google.maps.event.addListener(ee,"mouseover",l)),s&&W(google.maps.event.addListener(ee,"mouseup",s)),c&&D(google.maps.event.addListener(ee,"rightclick",c)),n&&j(google.maps.event.addListener(ee,"click",n)),u&&O(google.maps.event.addListener(ee,"addfeature",u)),d&&G(google.maps.event.addListener(ee,"removefeature",d)),f&&$(google.maps.event.addListener(ee,"removeproperty",f)),p&&Q(google.maps.event.addListener(ee,"setgeometry",p)),g&&Z(google.maps.event.addListener(ee,"setproperty",g)),P(ee),A&&A(ee)}return()=>{C&&(v!==null&&google.maps.event.removeListener(v),w!==null&&google.maps.event.removeListener(w),b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),ie!==null&&google.maps.event.removeListener(ie),se!==null&&google.maps.event.removeListener(se),y&&y(C),C.setMap(null))}},[]),null}m.memo(Uyo);class jyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{data:null}),ho(this,"setDataCallback",()=>{this.state.data!==null&&this.props.onLoad&&this.props.onLoad(this.state.data)})}componentDidMount(){if(this.context!==null){var e=new google.maps.Data(AJ(AJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:IMe,eventMap:MMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({data:e}),this.setDataCallback)}}componentDidUpdate(e){this.state.data!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:IMe,eventMap:MMe,prevProps:e,nextProps:this.props,instance:this.state.data}))}componentWillUnmount(){this.state.data!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.data),Ga(this.registeredEvents),this.state.data&&this.state.data.setMap(null))}render(){return null}}ho(jyo,"contextType",Ta);function zMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function DMe(t){for(var e=1;e{this.state.kmlLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.kmlLayer)})}componentDidMount(){var e=new google.maps.KmlLayer(DMe(DMe({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:FMe,eventMap:EMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{kmlLayer:e}},this.setKmlLayerCallback)}componentDidUpdate(e){this.state.kmlLayer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:FMe,eventMap:EMe,prevProps:e,nextProps:this.props,instance:this.state.kmlLayer}))}componentWillUnmount(){this.state.kmlLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.kmlLayer),Ga(this.registeredEvents),this.state.kmlLayer.setMap(null))}render(){return null}}ho(Byo,"contextType",Ta);function $rt(t,e){return typeof e=="function"?e(t.offsetWidth,t.offsetHeight):{x:0,y:0}}function Yyo(t,e){return new e(t.lat,t.lng)}function Oyo(t,e){return new e(new google.maps.LatLng(t.ne.lat,t.ne.lng),new google.maps.LatLng(t.sw.lat,t.sw.lng))}function Vyo(t,e,n){return t instanceof e?t:n(t,e)}function _yo(t,e,n){return t instanceof e?t:n(t,e)}function Gyo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n.getNorthEast()),r=t&&t.fromLatLngToDivPixel(n.getSouthWest());return o&&r?{left:"".concat(r.x+e.x,"px"),top:"".concat(o.y+e.y,"px"),width:"".concat(o.x-r.x-e.x,"px"),height:"".concat(r.y-o.y-e.y,"px")}:{left:"-9999px",top:"-9999px"}}function Xyo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n);if(o){var{x:r,y:i}=o;return{left:"".concat(r+e.x,"px"),top:"".concat(i+e.y,"px")}}return{left:"-9999px",top:"-9999px"}}function Qrt(t,e,n,o){return n!==void 0?Gyo(t,e,_yo(n,google.maps.LatLngBounds,Oyo)):Xyo(t,e,Vyo(o,google.maps.LatLng,Yyo))}function Jyo(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.height&&t.height===e.height}function kMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Kyo(t){for(var e=1;e{var f=document.createElement("div");return f.style.position="absolute",f},[]),d=m.useMemo(()=>qyo(u,o,e,n,l),[u,o,e,n]);return m.useEffect(()=>(i==null||i(d),d==null||d.setMap(c),()=>{a==null||a(d),d==null||d.setMap(null)}),[c,d]),m.useEffect(()=>{u.style.zIndex="".concat(r)},[r,u]),Hd.createPortal(s,u)}m.memo(Qyo);class HM extends m.PureComponent{constructor(e){super(e),ho(this,"state",{paneEl:null,containerStyle:{position:"absolute"}}),ho(this,"updatePane",()=>{var o=this.props.mapPaneName,r=this.overlayView.getPanes();Gu(!!o,"OverlayView requires props.mapPaneName but got %s",o),r?this.setState({paneEl:r[o]}):this.setState({paneEl:null})}),ho(this,"onAdd",()=>{var o,r;this.updatePane(),(o=(r=this.props).onLoad)===null||o===void 0||o.call(r,this.overlayView)}),ho(this,"onPositionElement",()=>{var o=this.overlayView.getProjection(),r=$yo({x:0,y:0},this.containerRef.current?$rt(this.containerRef.current,this.props.getPixelPositionOffset):{}),i=Qrt(o,r,this.props.bounds,this.props.position);if(!Jyo(i,{left:this.state.containerStyle.left,top:this.state.containerStyle.top,width:this.state.containerStyle.width,height:this.state.containerStyle.height})){var a,l,s,c;this.setState({containerStyle:{top:(a=i.top)!==null&&a!==void 0?a:0,left:(l=i.left)!==null&&l!==void 0?l:0,width:(s=i.width)!==null&&s!==void 0?s:0,height:(c=i.height)!==null&&c!==void 0?c:0,position:"absolute"}})}}),ho(this,"draw",()=>{this.onPositionElement()}),ho(this,"onRemove",()=>{var o,r;this.setState(()=>({paneEl:null})),(o=(r=this.props).onUnmount)===null||o===void 0||o.call(r,this.overlayView)}),this.containerRef=m.createRef();var n=new google.maps.OverlayView;n.onAdd=this.onAdd,n.draw=this.draw,n.onRemove=this.onRemove,this.overlayView=n}componentDidMount(){this.overlayView.setMap(this.context)}componentDidUpdate(e){var n=WMe(e.position),o=WMe(this.props.position),r=NMe(e.bounds),i=NMe(this.props.bounds);(n!==o||r!==i)&&this.overlayView.draw(),e.mapPaneName!==this.props.mapPaneName&&this.updatePane()}componentWillUnmount(){this.overlayView.setMap(null)}render(){var e=this.state.paneEl;return e?Hd.createPortal(h.jsx("div",{ref:this.containerRef,style:this.state.containerStyle,children:m.Children.only(this.props.children)}),e):null}}ho(HM,"FLOAT_PANE","floatPane");ho(HM,"MAP_PANE","mapPane");ho(HM,"MARKER_LAYER","markerLayer");ho(HM,"OVERLAY_LAYER","overlayLayer");ho(HM,"OVERLAY_MOUSE_TARGET","overlayMouseTarget");ho(HM,"contextType",Ta);function Zyo(){}function UMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function jMe(t){for(var e=1;enew google.maps.GroundOverlay(e,a,o),[]);return m.useEffect(()=>{l!==null&&l.setMap(i)},[i]),m.useEffect(()=>{typeof e<"u"&&l!==null&&(l.set("url",e),l.setMap(i))},[l,e]),m.useEffect(()=>{typeof r<"u"&&l!==null&&l.setOpacity(r?1:0)},[l,r]),m.useEffect(()=>{var s=new google.maps.LatLngBounds(new google.maps.LatLng(n.south,n.west),new google.maps.LatLng(n.north,n.east));typeof n<"u"&&l!==null&&(l.set("bounds",s),l.setMap(i))},[l,n]),null}m.memo(e2o);class Zrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{groundOverlay:null}),ho(this,"setGroundOverlayCallback",()=>{this.state.groundOverlay!==null&&this.props.onLoad&&this.props.onLoad(this.state.groundOverlay)})}componentDidMount(){Gu(!!this.props.url||!!this.props.bounds,"For GroundOverlay, url and bounds are passed in to constructor and are immutable after instantiated. This is the behavior of Google Maps JavaScript API v3 ( See https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay) Hence, use the corresponding two props provided by `react-google-maps-api`, url and bounds. In some cases, you'll need the GroundOverlay component to reflect the changes of url and bounds. You can leverage the React's key property to remount the component. Typically, just `key={url}` would serve your need. See https://github.com/tomchentw/react-google-maps/issues/655");var e=new google.maps.GroundOverlay(this.props.url,this.props.bounds,jMe(jMe({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:YMe,eventMap:BMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{groundOverlay:e}},this.setGroundOverlayCallback)}componentDidUpdate(e){this.state.groundOverlay!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:YMe,eventMap:BMe,prevProps:e,nextProps:this.props,instance:this.state.groundOverlay}))}componentWillUnmount(){this.state.groundOverlay&&(this.props.onUnmount&&this.props.onUnmount(this.state.groundOverlay),this.state.groundOverlay.setMap(null))}render(){return null}}ho(Zrt,"defaultProps",{onLoad:Zyo});ho(Zrt,"contextType",Ta);function OMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function wJ(t){for(var e=1;e{google.maps.visualization||Gu(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} in useJsApiScript? %s',google.maps.visualization)},[]),m.useEffect(()=>{Gu(!!e,"data property is required in HeatmapLayer %s",e)},[e]),m.useEffect(()=>{a!==null&&a.setMap(i)},[i]),m.useEffect(()=>{r&&a!==null&&a.setOptions(r)},[a,r]),m.useEffect(()=>{var s=new google.maps.visualization.HeatmapLayer(wJ(wJ({},r),{},{data:e,map:i}));return l(s),n&&n(s),()=>{a!==null&&(o&&o(a),a.setMap(null))}},[]),null}m.memo(t2o);class n2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{heatmapLayer:null}),ho(this,"setHeatmapLayerCallback",()=>{this.state.heatmapLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.heatmapLayer)})}componentDidMount(){Gu(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} to ? %s',google.maps.visualization),Gu(!!this.props.data,"data property is required in HeatmapLayer %s",this.props.data);var e=new google.maps.visualization.HeatmapLayer(wJ(wJ({},this.props.options),{},{data:this.props.data,map:this.context}));this.registeredEvents=Ua({updaterMap:_Me,eventMap:VMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{heatmapLayer:e}},this.setHeatmapLayerCallback)}componentDidUpdate(e){Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:_Me,eventMap:VMe,prevProps:e,nextProps:this.props,instance:this.state.heatmapLayer})}componentWillUnmount(){this.state.heatmapLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.heatmapLayer),Ga(this.registeredEvents),this.state.heatmapLayer.setMap(null))}render(){return null}}ho(n2o,"contextType",Ta);var GMe={onCloseClick:"closeclick",onPanoChanged:"pano_changed",onPositionChanged:"position_changed",onPovChanged:"pov_changed",onResize:"resize",onStatusChanged:"status_changed",onVisibleChanged:"visible_changed",onZoomChanged:"zoom_changed"},XMe={register(t,e,n){t.registerPanoProvider(e,n)},links(t,e){t.setLinks(e)},motionTracking(t,e){t.setMotionTracking(e)},options(t,e){t.setOptions(e)},pano(t,e){t.setPano(e)},position(t,e){t.setPosition(e)},pov(t,e){t.setPov(e)},visible(t,e){t.setVisible(e)},zoom(t,e){t.setZoom(e)}};class o2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{streetViewPanorama:null}),ho(this,"setStreetViewPanoramaCallback",()=>{this.state.streetViewPanorama!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewPanorama)})}componentDidMount(){var e,n,o=(e=(n=this.context)===null||n===void 0?void 0:n.getStreetView())!==null&&e!==void 0?e:null;this.registeredEvents=Ua({updaterMap:XMe,eventMap:GMe,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({streetViewPanorama:o}),this.setStreetViewPanoramaCallback)}componentDidUpdate(e){this.state.streetViewPanorama!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:XMe,eventMap:GMe,prevProps:e,nextProps:this.props,instance:this.state.streetViewPanorama}))}componentWillUnmount(){this.state.streetViewPanorama!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.streetViewPanorama),Ga(this.registeredEvents),this.state.streetViewPanorama.setVisible(!1))}render(){return null}}ho(o2o,"contextType",Ta);class r2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{streetViewService:null}),ho(this,"setStreetViewServiceCallback",()=>{this.state.streetViewService!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewService)})}componentDidMount(){var e=new google.maps.StreetViewService;this.setState(function(){return{streetViewService:e}},this.setStreetViewServiceCallback)}componentWillUnmount(){this.state.streetViewService!==null&&this.props.onUnmount&&this.props.onUnmount(this.state.streetViewService)}render(){return null}}ho(r2o,"contextType",Ta);var JMe={onDirectionsChanged:"directions_changed"},KMe={directions(t,e){t.setDirections(e)},map(t,e){t.setMap(e)},options(t,e){t.setOptions(e)},panel(t,e){t.setPanel(e)},routeIndex(t,e){t.setRouteIndex(e)}};class i2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{directionsRenderer:null}),ho(this,"setDirectionsRendererCallback",()=>{this.state.directionsRenderer!==null&&(this.state.directionsRenderer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.directionsRenderer))})}componentDidMount(){var e=new google.maps.DirectionsRenderer(this.props.options);this.registeredEvents=Ua({updaterMap:KMe,eventMap:JMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{directionsRenderer:e}},this.setDirectionsRendererCallback)}componentDidUpdate(e){this.state.directionsRenderer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:KMe,eventMap:JMe,prevProps:e,nextProps:this.props,instance:this.state.directionsRenderer}))}componentWillUnmount(){this.state.directionsRenderer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.directionsRenderer),Ga(this.registeredEvents),this.state.directionsRenderer&&this.state.directionsRenderer.setMap(null))}render(){return null}}ho(i2o,"contextType",Ta);var qMe={onPlacesChanged:"places_changed"},$Me={bounds(t,e){t.setBounds(e)}};class B9e extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",m.createRef()),ho(this,"state",{searchBox:null}),ho(this,"setSearchBoxCallback",()=>{this.state.searchBox!==null&&this.props.onLoad&&this.props.onLoad(this.state.searchBox)})}componentDidMount(){if(Gu(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places),this.containerElement!==null&&this.containerElement.current!==null){var e=this.containerElement.current.querySelector("input");if(e!==null){var n=new google.maps.places.SearchBox(e,this.props.options);this.registeredEvents=Ua({updaterMap:$Me,eventMap:qMe,prevProps:{},nextProps:this.props,instance:n}),this.setState(function(){return{searchBox:n}},this.setSearchBoxCallback)}}}componentDidUpdate(e){this.state.searchBox!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:$Me,eventMap:qMe,prevProps:e,nextProps:this.props,instance:this.state.searchBox}))}componentWillUnmount(){this.state.searchBox!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.searchBox),Ga(this.registeredEvents))}render(){return h.jsx("div",{ref:this.containerElement,children:m.Children.only(this.props.children)})}}ho(B9e,"contextType",Ta);var QMe={onPlaceChanged:"place_changed"},ZMe={bounds(t,e){t.setBounds(e)},restrictions(t,e){t.setComponentRestrictions(e)},fields(t,e){t.setFields(e)},options(t,e){t.setOptions(e)},types(t,e){t.setTypes(e)}};class eit extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",m.createRef()),ho(this,"state",{autocomplete:null}),ho(this,"setAutocompleteCallback",()=>{this.state.autocomplete!==null&&this.props.onLoad&&this.props.onLoad(this.state.autocomplete)})}componentDidMount(){var e;Gu(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places);var n=(e=this.containerElement.current)===null||e===void 0?void 0:e.querySelector("input");if(n){var o=new google.maps.places.Autocomplete(n,this.props.options);this.registeredEvents=Ua({updaterMap:ZMe,eventMap:QMe,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({autocomplete:o}),this.setAutocompleteCallback)}}componentDidUpdate(e){Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:ZMe,eventMap:QMe,prevProps:e,nextProps:this.props,instance:this.state.autocomplete})}componentWillUnmount(){this.state.autocomplete!==null&&Ga(this.registeredEvents)}render(){return h.jsx("div",{ref:this.containerElement,className:this.props.className,children:m.Children.only(this.props.children)})}}ho(eit,"defaultProps",{className:""});ho(eit,"contextType",Ta);const eIe="/aladdin/assets/empty_heart-B57-2tMp.png",a2o="/aladdin/assets/red_heart-BaAtCixH.png",l2o="/aladdin/assets/open_file-B6scZwPU.png",s2o="/aladdin/assets/export_link-Dxa4UObV.png",c2o="/aladdin/assets/click_count-BZx6BgQJ.png";function GO(t){const e=new Date(t);if(!Number.isNaN(e.valueOf()))return e;const n=String(t).match(/\d+/g);if(n==null||n.length<=2)return e;{const[o,r,...i]=n.map(s=>parseInt(s)),a=[o,r-1,...i];return new Date(Date.UTC(...a))}}function tIe(t,e,n){const o=t!==1?e+"s":e;return t+" "+o+" "+n}function Sfe(){return Sfe=Object.assign?Object.assign.bind():function(t){for(var e=1;eDate.now();function d2o({date:t,formatter:e=tIe,component:n="time",live:o=!0,minPeriod:r=0,maxPeriod:i=XO,title:a,now:l=u2o,...s}){const[c,u]=m.useState(l());m.useEffect(()=>{if(!o)return;const T=(()=>{const w=GO(t).valueOf();if(!w)return console.warn("[react-timeago] Invalid Date provided"),0;const x=Math.round(Math.abs(c-w)/1e3),b=x{u(l())},R):0})();return()=>{T&&clearTimeout(T)}},[t,o,i,r,l,c]);const d=n,f=GO(t).valueOf();if(!f)return null;const p=Math.round(Math.abs(c-f)/1e3),g=f"u"?typeof t=="string"?t:GO(t).toISOString().substr(0,16).replace("T"," "):a,C=d==="time"?{...s,dateTime:GO(t).toISOString()}:s,P=tIe.bind(null,A,y,g);return m.createElement(d,Sfe({},C,{title:S}),e(A,y,g,f,P,l))}function vJ(){return vJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}var h2o=["cdnSuffix","cdnUrl","countryCode","style","svg"],p2o="https://cdn.jsdelivr.net/gh/lipis/flag-icons/flags/4x3/",g2o="svg",m2o=127397,tit=function(e){var n=e.cdnSuffix,o=n===void 0?g2o:n,r=e.cdnUrl,i=r===void 0?p2o:r,a=e.countryCode,l=e.style,s=e.svg,c=s===void 0?!1:s,u=f2o(e,h2o);if(typeof a!="string")return null;if(c){var d=""+i+a.toLowerCase()+"."+o;return m.createElement("img",Object.assign({},u,{src:d,style:vJ({display:"inline-block",width:"1em",height:"1em",verticalAlign:"middle"},l)}))}var f=a.toUpperCase().replace(/./g,function(p){return String.fromCodePoint(p.charCodeAt(0)+m2o)});return m.createElement("span",Object.assign({role:"img"},u,{style:vJ({display:"inline-block",fontSize:"1em",lineHeight:"1em",verticalAlign:"middle"},l)}),f)};const nit=t=>{switch(t.type){case fa.PHOTOVOLTAIC:return BQe;case fa.PARABOLIC_DISH:return YQe;case fa.PARABOLIC_TROUGH:return OQe;case fa.FRESNEL_REFLECTOR:return VQe;case fa.SOLAR_POWER_TOWER:return _Qe;case fa.WIND_TURBINE:return JQe;case fa.COLOCATION_PROJECTS:return KQe;case fa.RESIDENTIAL_BUILDING:return WQe;case fa.COMMERCIAL_BUILDING:return NQe;case fa.SCHOOL_BUILDING:return UQe;case fa.TOURIST_ATTRACTION:return jQe;case fa.UNDER_CONSTRUCTION:return GQe}return XQe},{Panel:y2o}=fye,A2o=be.memo(({latRef:t,lngRef:e,selectAuthor:n,closeMap:o,openModel:r,deleteModel:i,likeModel:a,pinModel:l})=>{var he;const s=M.getState().user,c=M(pn),u=M(En),d=M(lwt)??aje,f=M(swt)??0,p=M(Ege)??"roadmap",g=M(Jge),A=dt(qBe),y=M(QBe),[S,C]=m.useState(null),[P,v]=m.useState(null),[T,w]=m.useState(null),[x,b]=m.useState(!0),[R,H]=m.useState(!1),F=m.useRef(null),E=m.useRef([]),N=m.useRef(-1),U=m.useRef([]),W=$t(),k=14,D=(he=s.email)==null?void 0:he.endsWith("@intofuture.org"),L=()=>{U.current.length=0;for(const pe in g)if(Object.hasOwn(g,pe)){const me=g[pe],le=new google.maps.LatLng(me.latitude,me.longitude);U.current.push(le)}},j=m.useCallback(pe=>{C(pe),L(),pe.setMapTypeId(p)},[p]),B=m.useCallback(function(){C(null)},[]),O=()=>{if(S){const pe=S.getCenter();if(pe){const me=pe.lat(),le=pe.lng();if(me!==t.current||le!==e.current){const Te={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:t.current,newLatitude:me,oldLongitude:e.current,newLongitude:le,undo:()=>{t.current=Te.oldLatitude,e.current=Te.oldLongitude},redo:()=>{t.current=Te.newLatitude,e.current=Te.newLongitude}};u(Te),t.current=me,e.current=le}}}},V=()=>{if(S){const pe=S.getZoom();if(pe!==void 0&&pe!==d){const me={name:"Zoom Model Map",timestamp:Date.now(),oldValue:d,newValue:pe,undo:()=>{c(le=>{le.modelsMapZoom=me.oldValue})},redo:()=>{c(le=>{le.modelsMapZoom=me.newValue})}};u(me),c(le=>{le.modelsMapZoom=pe})}}},G=()=>{if(S){const pe=S.getTilt();if(pe!==void 0&&pe!==f){const me={name:"Tilt Model Map",timestamp:Date.now(),oldValue:f,newValue:pe,undo:()=>{c(le=>{le.modelsMapTilt=me.oldValue})},redo:()=>{c(le=>{le.modelsMapTilt=me.newValue})}};u(me),c(le=>{le.modelsMapTilt=pe})}}},q=()=>{if(S){const pe=S.getMapTypeId();if(pe!==void 0&&pe!==p){const me={name:"Change Model Map Type",timestamp:Date.now(),oldValue:p,newValue:pe,undo:()=>{c(le=>{le.modelsMapType=me.oldValue})},redo:()=>{c(le=>{le.modelsMapType=me.newValue})}};u(me),c(le=>{le.modelsMapType=pe})}}},$={styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels",stylers:[{visibility:"off"}]}]},ie=pe=>{pe.userid&&pe.title?(r(pe),o()):co(Y.t("message.ModelNotFound",W))},Q=pe=>{if(pe.userid&&pe.title){const me=t1+"?client=web&userid="+pe.userid+"&title="+encodeURIComponent(pe.title);navigator.clipboard.writeText(me).then(()=>S2(Y.t("cloudFilePanel.LinkGeneratedInClipBoard",W)+"."))}else co(Y.t("message.ModelNotFound",W))},se=pe=>{yi.confirm({title:Y.t("message.DoYouWantToDeleteModelFromMap",W),icon:h.jsx(ny,{}),onOk:()=>{i(pe,()=>{c(me=>{var le,Te;if(me.modelSites){const ge=me.modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(ge){let Se;for(const[Re,De]of ge)if(De.userid===pe.userid&&De.title===pe.title){Se=Re;break}Se&&(ge.delete(Se),ge.size===0&&((Te=(le=E.current[N.current])==null?void 0:le.marker)==null||Te.setMap(null)))}}}),v(null),w(null)})},onCancel:()=>{},okText:Y.t("word.Yes",W),cancelText:Y.t("word.No",W)})},Z=pe=>{var me;if(pe.userid&&pe.title){const le=ye.getModelKey(pe),Te=!!((me=s.likes)!=null&&me.includes(le));a(pe,!Te,()=>{c(ge=>{if(ge.user)if(ge.user.likes||(ge.user.likes=[]),ge.user.likes.includes(le)){const Se=ge.user.likes.indexOf(le);Se>=0&&ge.user.likes.splice(Se,1)}else ge.user.likes.push(le);if(ge.modelSites){const Se=ge.modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(Se){for(const Re of Se.values())if(Re.userid===pe.userid&&Re.title===pe.title){Re.likeCount===void 0&&(Re.likeCount=0),Re.likeCount+=Te?-1:1;break}}}}),H(!R)})}},ee=pe=>{const me=M.getState().modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(me){for(const le of me.values())if(le.userid===pe.userid&&le.title===pe.title)return le.likeCount??0}return 0},te=pe=>{const me=M.getState().modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(me){for(const le of me.values())if(le.userid===pe.userid&&le.title===pe.title)return le.clickCount??0}return 0},oe=pe=>{const me=M.getState().modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(me){for(const le of me.values())if(le.userid===pe.userid&&le.title===pe.title)return le.pinned}return!1},de=(pe,me)=>{pe.userid&&pe.title&&l(pe,me,()=>{c(le=>{if(le.modelSites){const Te=le.modelSites.get(ye.getLatLngKey(pe.latitude,pe.longitude));if(Te){for(const ge of Te.values())if(ge.userid===pe.userid&&ge.title===pe.title){ge.pinned=me,H(!R);break}}}})})};return h.jsx(Nrt,{mapContainerStyle:{border:"1px solid",width:"100%",height:"100%"},mapTypeId:p,options:$,center:{lat:t.current,lng:e.current},zoom:d,tilt:f,onLoad:j,onUnmount:B,onCenterChanged:O,onZoomChanged:V,onTiltChanged:G,onMapTypeIdChanged:q,children:h.jsxs(h.Fragment,{children:[A&&U.current.map((pe,me)=>{const le=.2*d;return h.jsx(vfe,{icon:{path:google.maps.SymbolPath.CIRCLE,strokeColor:"red",strokeWeight:le+2,scale:le},position:pe},me)}),P&&P.size&&T&&h.jsx(qrt,{position:{lat:T.lat(),lng:T.lng()},children:h.jsxs("div",{style:{border:"2px solid gainsboro",maxHeight:"400px",overflowY:"auto"},onMouseLeave:()=>{v(null),w(null)},children:[P.size>1?h.jsxs("div",{style:{background:"#dddddd",textAlign:"left",borderBottom:"1px solid gainsboro",paddingBottom:"4px",marginBottom:"4px"},children:[x?h.jsx(con,{title:Y.t("modelsMap.SortFromNewestToOldest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{b(!1)}}):h.jsx(Qon,{title:Y.t("modelsMap.SortFromOldestToNewest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{b(!0)}}),h.jsxs("span",{style:{fontSize:"10px"},children:[P.size," ",Y.t("modelsMap.ModelsFoundOnThisSite",W)]}),T&&h.jsxs("span",{style:{fontSize:"10px"},children:[" —"," ",Y.t("word.Coordinates",W)+": ("+T.lat().toFixed(y8)+"°, "+T.lng().toFixed(y8)+"°)"]})]}):"",[...P.keys()].sort((pe,me)=>{const le=P.get(pe),Te=P.get(me);return le!=null&&le.pinned&&!(Te!=null&&Te.pinned)?-1:Te!=null&&Te.pinned&&!(le!=null&&le.pinned)?1:(x?1:-1)*(((le==null?void 0:le.timeCreated)??0)-((Te==null?void 0:Te.timeCreated)??0))}).map((pe,me)=>{const le=P.get(pe);return le?h.jsxs("div",{style:{padding:(P==null?void 0:P.size)>1?"5px 5px 20px 5px":"5px",background:me%2===0?"white":"#eeeeee"},children:[me===0&&h.jsxs("div",{style:{fontSize:"12px",display:"block",paddingBottom:"6px"},children:[le.countryCode&&h.jsx(tit,{countryCode:le.countryCode,style:{marginRight:"6px",width:"20px"},svg:!0}),le.address??"Unknown",P.size===1&&h.jsx("span",{style:{fontSize:"10px",display:"block",paddingTop:"10px"},children:Y.t("word.Coordinates",W)+": ("+T.lat().toFixed(y8)+"°, "+T.lng().toFixed(y8)+"°)"})]}),h.jsx(fye,{style:{background:oe(le)?"#FEF9EC":me%2===0?"white":"#eeeeee",width:"400px"},bordered:!1,ghost:!0,defaultActiveKey:["0"],children:h.jsx(y2o,{header:h.jsxs(h.Fragment,{children:[le.label,oe(le)&&h.jsx(nPe,{style:{marginLeft:"8px"}})]}),style:{fontSize:"12px"},children:h.jsx("div",{style:{fontSize:"10px",display:"block",textAlign:"left"},children:h.jsxs(on,{align:"start",children:[le.thumbnailUrl&&h.jsx("img",{alt:le.label,title:Y.t("word.Open",W),src:le.thumbnailUrl,style:{border:"1px solid #222",cursor:"pointer"},onClick:()=>ie(le)}),h.jsxs("div",{children:[le.description&&le.description.trim()!==""?le.description:""," —  By"," ",h.jsx("span",{style:{cursor:"pointer"},title:Y.t("modelsMap.ShowModelsPublishedByThisAuthor",W),onClick:()=>{n(le.author)},children:!le.author||le.author===""?Y.t("word.Anonymous",W):le.author}),", ",le.timeCreated&&h.jsx(d2o,{date:new Date(le.timeCreated)})]})]})})},me)}),h.jsxs("div",{style:{marginTop:"10px",fontSize:"11px"},children:[D&&h.jsx(h.Fragment,{children:oe(le)?h.jsx(Don,{style:{cursor:"pointer"},title:Y.t("word.Unpin",W),onClick:()=>de(le,!1)}):h.jsx(nPe,{style:{cursor:"pointer"},title:Y.t("word.Pin",W),onClick:()=>de(le,!0)})}),h.jsx("img",{alt:"Open",onClick:()=>ie(le),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.Open",W),src:l2o,height:k,width:k}),h.jsx("img",{alt:"Export link",onClick:()=>Q(le),style:{marginLeft:"5px",cursor:"pointer"},title:Y.t("word.Share",W),src:s2o,height:k,width:k}),le.userid===s.uid&&h.jsx("img",{alt:"Delete",onClick:()=>se(le),style:{marginLeft:"5px",cursor:"pointer"},title:Y.t("word.Delete",W),src:Lrt,height:k,width:k}),s.uid?h.jsx(h.Fragment,{children:s.likes&&s.likes.includes(ye.getModelKey(le))?h.jsx("img",{alt:"Like",onClick:()=>Z(le),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.AlreadyLike",W),src:a2o,height:k,width:k}):h.jsx("img",{alt:"Like",onClick:()=>Z(le),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.Like",W),src:eIe,height:k,width:k})}):h.jsx(h.Fragment,{children:h.jsx("img",{alt:"Like",style:{marginLeft:"10px",opacity:.5},title:Y.t("word.MustLogInToLike",W),src:eIe,height:k,width:k})}),"   ",ee(le),h.jsx("img",{alt:"Click counter",style:{marginLeft:"10px"},title:Y.t("word.ClickCount",W),src:c2o,height:k,width:k}),"   ",te(le)]})]},me):null})]})}),!!y&&!!y.size&&h.jsx(_rt,{children:pe=>h.jsx("div",{children:[...y.keys()].map((me,le)=>{const Te=y.get(me);if(!Te||!Te.size)return null;const ge=[...Te.keys()].sort((De,Ae)=>{const ue=Te.get(De),fe=Te.get(Ae);return ue!=null&&ue.pinned&&!(fe!=null&&fe.pinned)?-1:fe!=null&&fe.pinned&&!(ue!=null&&ue.pinned)?1:(x?1:-1)*(((ue==null?void 0:ue.timeCreated)??0)-((fe==null?void 0:fe.timeCreated)??0))}),Se=Te.get(ge[0]);if(!Se)return null;const Re=nit(Se);return h.jsx(vfe,{ref:De=>E.current[le]=De,clusterer:pe,icon:Re?{url:Re}:void 0,position:{lat:Se.latitude,lng:Se.longitude},onClick:()=>ie(Se),onMouseOver:()=>{F.current=P,N.current=le,v(Te);const De=me.split(", ");w(new google.maps.LatLng(Number.parseFloat(De[0]),Number.parseFloat(De[1])))},onMouseOut:()=>{P===F.current&&(v(null),w(null))}},le)})})})]})})}),w2o="/aladdin/assets/image_load_failure-HGDkwC0S.png",oit=be.memo(({latRef:t,lngRef:e,author:n,models:o,closeCallback:r,openCloudFile:i})=>{const a=M(yp),l=M(m0),s=M(pn),c=M(Ege),u=m.useRef(o?new Map(o):new Map),[d,f]=m.useState(!1),[p,g]=m.useState(),[A,y]=m.useState(!1),{Search:S}=jl,C=m.useMemo(()=>({lng:l}),[l]);m.useEffect(()=>{o&&(u.current=new Map(o),f(!d))},[o]);const P=m.useMemo(()=>{let T=0;for(const w of u.current.values())(n||w.userid===a.uid)&&T++;return T},[u.current,n,a.uid,d]),v=n&&c!=="roadmap";return u.current.size===0?h.jsx(vue,{mask:!1,styles:{header:{height:"40px",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",background:v?"#6A6B6E":"whitesmoke"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:v?"#2A2B2E":"white"}},style:{scrollbarColor:v?"#6A6B6E":"whitesmoke"},title:(n??Y.t("modelsMap.MyPublishedModels",C))+" (0)",placement:"bottom",open:!0,height:"150px",onClose:()=>{r()},children:h.jsx(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,style:{color:v?"lightgray":"dimgray"}})}):h.jsx(vue,{extra:h.jsxs(on,{children:[A?h.jsx(Son,{title:Y.t("modelsMap.SortFromNewestToOldest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{y(!1)}}):h.jsx(kQe,{title:Y.t("modelsMap.SortFromOldestToNewest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{y(!0)}}),h.jsx(S,{title:Y.t("modelsMap.SearchByLabel",C),allowClear:!0,size:"small",enterButton:!0,onSearch:T=>{var w;if(o){u.current.clear();for(const[x,b]of o)(w=b.label)!=null&&w.toLowerCase().includes(T.toLowerCase())&&u.current.set(x,b);f(!d)}}})]}),mask:!1,styles:{header:{height:"40px",color:v?"white":"black",background:v?"#6A6B6E":"whitesmoke",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",border:"none"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:v?"#2A2B2E":"white"}},title:(n??Y.t("modelsMap.MyPublishedModels",C))+" ("+P+")",placement:"bottom",open:!0,height:"164px",onClose:()=>{g(void 0),r()},children:h.jsx("table",{children:h.jsx("tbody",{children:h.jsx("tr",{children:[...u.current.keys()].sort((T,w)=>{const x=u.current.get(T),b=u.current.get(w);return!x||!b?0:(A?-1:1)*((b.timeCreated??0)-(x.timeCreated??0))}).map((T,w)=>{const x=u.current.get(T);return!x||!n&&x.userid!==a.uid?null:h.jsx("td",{children:h.jsxs("div",{style:{display:"block",marginTop:"4px"},children:[h.jsx("img",{loading:"lazy",height:"100px",width:"auto",onError:b=>{b.target.src=w2o},alt:x.label,title:x.label,src:x.thumbnailUrl,style:{cursor:"pointer",borderRadius:p===x?"0":"10px",border:p===x?"2px solid "+(v?"goldenrod":"red"):"none",marginRight:"4px"},onClick:()=>{g(x),i?i(x.userid,x.title):s(b=>{x&&(b.modelsMapLatitude=x.latitude,b.modelsMapLongitude=x.longitude,b.modelsMapZoom=17,t&&(t.current=x.latitude),e&&(e.current=x.longitude))})}}),h.jsxs("div",{children:[h.jsx("img",{alt:x.type,src:nit(x),style:{position:"relative",left:"8px",bottom:"28px",width:"16px",height:"16px"}}),h.jsx("span",{style:{position:"relative",left:"16px",bottom:"24px",color:"white",fontSize:"8px",fontWeight:"bold"},children:x.label?x.label.length>30?x.label.substring(0,30)+"...":x.label:"Unknown"})]})]})},w)})})})})})}),v2o=["places"],{RangePicker:x2o}=Vw,b2o=Ho.div` +`),s="Cluster of ".concat(r," markers"),c=Number(google.maps.Marker.MAX_ZINDEX)+r;if(ag.isAdvancedMarkerAvailable(o)){var u=new DOMParser,d=u.parseFromString(l,"image/svg+xml").documentElement;d.setAttribute("transform","translate(0 25)");var f={map:o,position:i,zIndex:c,title:s,content:d};return new google.maps.marker.AdvancedMarkerElement(f)}var p={position:i,zIndex:c,title:s,icon:{url:"data:image/svg+xml;base64,".concat(btoa(l)),anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(p)}}function Syo(t,e){for(var n in e.prototype)t.prototype[n]=e.prototype[n]}class j9e{constructor(){Syo(j9e,google.maps.OverlayView)}}var VE;(function(t){t.CLUSTERING_BEGIN="clusteringbegin",t.CLUSTERING_END="clusteringend",t.CLUSTER_CLICK="click"})(VE||(VE={}));var Tyo=(t,e,n)=>{n.fitBounds(e.bounds)};class Pyo extends j9e{constructor(e){var{map:n,markers:o=[],algorithmOptions:r={},algorithm:i=new vyo(r),renderer:a=new byo,onClusterClick:l=Tyo}=e;super(),this.markers=[...o],this.clusters=[],this.algorithm=i,this.renderer=a,this.onClusterClick=l,n&&this.setMap(n)}addMarker(e,n){this.markers.includes(e)||(this.markers.push(e),n||this.render())}addMarkers(e,n){e.forEach(o=>{this.addMarker(o,!0)}),n||this.render()}removeMarker(e,n){var o=this.markers.indexOf(e);return o===-1?!1:(ag.setMap(e,null),this.markers.splice(o,1),n||this.render(),!0)}removeMarkers(e,n){var o=!1;return e.forEach(r=>{o=this.removeMarker(r,!0)||o}),o&&!n&&this.render(),o}clearMarkers(e){this.markers.length=0,e||this.render()}render(){var e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,VE.CLUSTERING_BEGIN,this);var{clusters:n,changed:o}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(o||o==null){var r=new Set;for(var i of n)i.markers.length==1&&r.add(i.markers[0]);var a=[];for(var l of this.clusters)l.marker!=null&&(l.markers.length==1?r.has(l.marker)||ag.setMap(l.marker,null):a.push(l.marker));this.clusters=n,this.renderClusters(),requestAnimationFrame(()=>a.forEach(s=>ag.setMap(s,null)))}google.maps.event.trigger(this,VE.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>ag.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){var e=new xyo(this.markers,this.clusters),n=this.getMap();this.clusters.forEach(o=>{o.markers.length===1?o.marker=o.markers[0]:(o.marker=this.renderer.render(o,e,n),o.markers.forEach(r=>ag.setMap(r,null)),this.onClusterClick&&o.marker.addListener("click",r=>{google.maps.event.trigger(this,VE.CLUSTER_CLICK,o),this.onClusterClick(r,o,n)})),ag.setMap(o.marker,n)})}}function dMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function fMe(t){for(var e=1;e{if(e&&n===null){var r=new Pyo(fMe(fMe({},t),{},{map:e}));o(r)}},[e]),n}function Ryo(t){var{children:e,options:n}=t,o=Cyo(n);return o!==null?e(o):null}m.memo(Ryo);var hMe={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},pMe={options(t,e){t.setOptions(e)},position(t,e){t.setPosition(e)},zIndex(t,e){t.setZIndex(e)}};function Hyo(t){var{children:e,anchor:n,options:o,position:r,zIndex:i,onCloseClick:a,onDomReady:l,onContentChanged:s,onPositionChanged:c,onZindexChanged:u,onLoad:d,onUnmount:f}=t,p=m.useContext(Ta),[g,A]=m.useState(null),[y,S]=m.useState(null),[C,P]=m.useState(null),[v,T]=m.useState(null),[w,x]=m.useState(null),[b,R]=m.useState(null),H=m.useRef(null);return m.useEffect(()=>{g!==null&&(g.close(),n?g.open(p,n):g.getPosition()&&g.open(p))},[p,g,n]),m.useEffect(()=>{o&&g!==null&&g.setOptions(o)},[g,o]),m.useEffect(()=>{r&&g!==null&&g.setPosition(r)},[r]),m.useEffect(()=>{typeof i=="number"&&g!==null&&g.setZIndex(i)},[i]),m.useEffect(()=>{g&&a&&(y!==null&&google.maps.event.removeListener(y),S(google.maps.event.addListener(g,"closeclick",a)))},[a]),m.useEffect(()=>{g&&l&&(C!==null&&google.maps.event.removeListener(C),P(google.maps.event.addListener(g,"domready",l)))},[l]),m.useEffect(()=>{g&&s&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(g,"content_changed",s)))},[s]),m.useEffect(()=>{g&&c&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(g,"position_changed",c)))},[c]),m.useEffect(()=>{g&&u&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),m.useEffect(()=>{var F=new google.maps.InfoWindow(o);return A(F),H.current=document.createElement("div"),a&&S(google.maps.event.addListener(F,"closeclick",a)),l&&P(google.maps.event.addListener(F,"domready",l)),s&&T(google.maps.event.addListener(F,"content_changed",s)),c&&x(google.maps.event.addListener(F,"position_changed",c)),u&&R(google.maps.event.addListener(F,"zindex_changed",u)),F.setContent(H.current),r&&F.setPosition(r),i&&F.setZIndex(i),n?F.open(p,n):F.getPosition()?F.open(p):Gu(!1,"You must provide either an anchor (typically render it inside a ) or a position props for ."),d&&d(F),()=>{y&&google.maps.event.removeListener(y),v&&google.maps.event.removeListener(v),C&&google.maps.event.removeListener(C),w&&google.maps.event.removeListener(w),b&&google.maps.event.removeListener(b),f&&f(F),F.close()}},[]),H.current?Hd.createPortal(m.Children.only(e),H.current):null}m.memo(Hyo);class qrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",null),ho(this,"state",{infoWindow:null}),ho(this,"open",(e,n)=>{n?e.open(this.context,n):e.getPosition()?e.open(this.context):Gu(!1,"You must provide either an anchor (typically render it inside a ) or a position props for .")}),ho(this,"setInfoWindowCallback",()=>{this.state.infoWindow!==null&&this.containerElement!==null&&(this.state.infoWindow.setContent(this.containerElement),this.open(this.state.infoWindow,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoWindow))})}componentDidMount(){var e=new google.maps.InfoWindow(this.props.options);this.containerElement=document.createElement("div"),this.registeredEvents=Ua({updaterMap:pMe,eventMap:hMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({infoWindow:e}),this.setInfoWindowCallback)}componentDidUpdate(e){this.state.infoWindow!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:pMe,eventMap:hMe,prevProps:e,nextProps:this.props,instance:this.state.infoWindow}))}componentWillUnmount(){this.state.infoWindow!==null&&(Ga(this.registeredEvents),this.props.onUnmount&&this.props.onUnmount(this.state.infoWindow),this.state.infoWindow.close())}render(){return this.containerElement?Hd.createPortal(m.Children.only(this.props.children),this.containerElement):null}}ho(qrt,"contextType",Ta);function gMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function gJ(t){for(var e=1;e{v!==null&&v.setMap(P)},[P]),m.useEffect(()=>{typeof e<"u"&&v!==null&&v.setOptions(e)},[v,e]),m.useEffect(()=>{typeof n<"u"&&v!==null&&v.setDraggable(n)},[v,n]),m.useEffect(()=>{typeof o<"u"&&v!==null&&v.setEditable(o)},[v,o]),m.useEffect(()=>{typeof r<"u"&&v!==null&&v.setVisible(r)},[v,r]),m.useEffect(()=>{typeof i<"u"&&v!==null&&v.setPath(i)},[v,i]),m.useEffect(()=>{v&&a&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(v,"dblclick",a)))},[a]),m.useEffect(()=>{v&&l&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(v,"dragend",l)))},[l]),m.useEffect(()=>{v&&s&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(v,"dragstart",s)))},[s]),m.useEffect(()=>{v&&c&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(v,"mousedown",c)))},[c]),m.useEffect(()=>{v&&u&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(v,"mousemove",u)))},[u]),m.useEffect(()=>{v&&d&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(v,"mouseout",d)))},[d]),m.useEffect(()=>{v&&f&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(v,"mouseover",f)))},[f]),m.useEffect(()=>{v&&p&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(v,"mouseup",p)))},[p]),m.useEffect(()=>{v&&g&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(v,"rightclick",g)))},[g]),m.useEffect(()=>{v&&A&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(v,"click",A)))},[A]),m.useEffect(()=>{v&&y&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(v,"drag",y)))},[y]),m.useEffect(()=>{var se=new google.maps.Polyline(gJ(gJ({},e||Myo),{},{map:P}));return i&&se.setPath(i),typeof r<"u"&&se.setVisible(r),typeof o<"u"&&se.setEditable(o),typeof n<"u"&&se.setDraggable(n),a&&x(google.maps.event.addListener(se,"dblclick",a)),l&&R(google.maps.event.addListener(se,"dragend",l)),s&&F(google.maps.event.addListener(se,"dragstart",s)),c&&N(google.maps.event.addListener(se,"mousedown",c)),u&&W(google.maps.event.addListener(se,"mousemove",u)),d&&D(google.maps.event.addListener(se,"mouseout",d)),f&&j(google.maps.event.addListener(se,"mouseover",f)),p&&O(google.maps.event.addListener(se,"mouseup",p)),g&&G(google.maps.event.addListener(se,"rightclick",g)),A&&$(google.maps.event.addListener(se,"click",A)),y&&Q(google.maps.event.addListener(se,"drag",y)),T(se),S&&S(se),()=>{w!==null&&google.maps.event.removeListener(w),b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),C&&C(se),se.setMap(null)}},[]),null}m.memo(Iyo);class zyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{polyline:null}),ho(this,"setPolylineCallback",()=>{this.state.polyline!==null&&this.props.onLoad&&this.props.onLoad(this.state.polyline)})}componentDidMount(){var e=new google.maps.Polyline(gJ(gJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:yMe,eventMap:mMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{polyline:e}},this.setPolylineCallback)}componentDidUpdate(e){this.state.polyline!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:yMe,eventMap:mMe,prevProps:e,nextProps:this.props,instance:this.state.polyline}))}componentWillUnmount(){this.state.polyline!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.polyline),Ga(this.registeredEvents),this.state.polyline.setMap(null))}render(){return null}}ho(zyo,"contextType",Ta);function AMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function wMe(t){for(var e=1;e{w!==null&&w.setMap(T)},[T]),m.useEffect(()=>{typeof e<"u"&&w!==null&&w.setOptions(e)},[w,e]),m.useEffect(()=>{typeof n<"u"&&w!==null&&w.setDraggable(n)},[w,n]),m.useEffect(()=>{typeof o<"u"&&w!==null&&w.setEditable(o)},[w,o]),m.useEffect(()=>{typeof r<"u"&&w!==null&&w.setVisible(r)},[w,r]),m.useEffect(()=>{typeof i<"u"&&w!==null&&w.setPath(i)},[w,i]),m.useEffect(()=>{typeof a<"u"&&w!==null&&w.setPaths(a)},[w,a]),m.useEffect(()=>{w&&typeof l=="function"&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(w,"dblclick",l)))},[l]),m.useEffect(()=>{w&&(google.maps.event.addListener(w.getPath(),"insert_at",()=>{v==null||v(w)}),google.maps.event.addListener(w.getPath(),"set_at",()=>{v==null||v(w)}),google.maps.event.addListener(w.getPath(),"remove_at",()=>{v==null||v(w)}))},[w,v]),m.useEffect(()=>{w&&typeof s=="function"&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(w,"dragend",s)))},[s]),m.useEffect(()=>{w&&typeof c=="function"&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(w,"dragstart",c)))},[c]),m.useEffect(()=>{w&&typeof u=="function"&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(w,"mousedown",u)))},[u]),m.useEffect(()=>{w&&typeof d=="function"&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(w,"mousemove",d)))},[d]),m.useEffect(()=>{w&&typeof f=="function"&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(w,"mouseout",f)))},[f]),m.useEffect(()=>{w&&typeof p=="function"&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(w,"mouseover",p)))},[p]),m.useEffect(()=>{w&&typeof g=="function"&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(w,"mouseup",g)))},[g]),m.useEffect(()=>{w&&typeof A=="function"&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(w,"rightclick",A)))},[A]),m.useEffect(()=>{w&&typeof y=="function"&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(w,"click",y)))},[y]),m.useEffect(()=>{w&&typeof S=="function"&&(se!==null&&google.maps.event.removeListener(se),oe(google.maps.event.addListener(w,"drag",S)))},[S]),m.useEffect(()=>{var Z=new google.maps.Polygon(wMe(wMe({},e),{},{map:T}));return i&&Z.setPath(i),a&&Z.setPaths(a),typeof r<"u"&&Z.setVisible(r),typeof o<"u"&&Z.setEditable(o),typeof n<"u"&&Z.setDraggable(n),l&&R(google.maps.event.addListener(Z,"dblclick",l)),s&&F(google.maps.event.addListener(Z,"dragend",s)),c&&N(google.maps.event.addListener(Z,"dragstart",c)),u&&W(google.maps.event.addListener(Z,"mousedown",u)),d&&D(google.maps.event.addListener(Z,"mousemove",d)),f&&j(google.maps.event.addListener(Z,"mouseout",f)),p&&O(google.maps.event.addListener(Z,"mouseover",p)),g&&G(google.maps.event.addListener(Z,"mouseup",g)),A&&$(google.maps.event.addListener(Z,"rightclick",A)),y&&Q(google.maps.event.addListener(Z,"click",y)),S&&oe(google.maps.event.addListener(Z,"drag",S)),x(Z),C&&C(Z),()=>{b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),ie!==null&&google.maps.event.removeListener(ie),P&&P(Z),Z.setMap(null)}},[]),null}m.memo(Dyo);class Eyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[])}componentDidMount(){var e=this.props.options||{};this.polygon=new google.maps.Polygon(e),this.polygon.setMap(this.context),this.registeredEvents=Ua({updaterMap:xMe,eventMap:vMe,prevProps:{},nextProps:this.props,instance:this.polygon}),this.props.onLoad&&this.props.onLoad(this.polygon)}componentDidUpdate(e){this.polygon&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:xMe,eventMap:vMe,prevProps:e,nextProps:this.props,instance:this.polygon}))}componentWillUnmount(){this.polygon&&(this.props.onUnmount&&this.props.onUnmount(this.polygon),Ga(this.registeredEvents),this.polygon&&this.polygon.setMap(null))}render(){return null}}ho(Eyo,"contextType",Ta);function bMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function mJ(t){for(var e=1;e{T!==null&&T.setMap(v)},[v]),m.useEffect(()=>{typeof e<"u"&&T!==null&&T.setOptions(e)},[T,e]),m.useEffect(()=>{typeof o<"u"&&T!==null&&T.setDraggable(o)},[T,o]),m.useEffect(()=>{typeof r<"u"&&T!==null&&T.setEditable(r)},[T,r]),m.useEffect(()=>{typeof i<"u"&&T!==null&&T.setVisible(i)},[T,i]),m.useEffect(()=>{typeof n<"u"&&T!==null&&T.setBounds(n)},[T,n]),m.useEffect(()=>{T&&a&&(x!==null&&google.maps.event.removeListener(x),b(google.maps.event.addListener(T,"dblclick",a)))},[a]),m.useEffect(()=>{T&&l&&(R!==null&&google.maps.event.removeListener(R),H(google.maps.event.addListener(T,"dragend",l)))},[l]),m.useEffect(()=>{T&&s&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(T,"dragstart",s)))},[s]),m.useEffect(()=>{T&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(T,"mousedown",c)))},[c]),m.useEffect(()=>{T&&u&&(W!==null&&google.maps.event.removeListener(W),k(google.maps.event.addListener(T,"mousemove",u)))},[u]),m.useEffect(()=>{T&&d&&(D!==null&&google.maps.event.removeListener(D),L(google.maps.event.addListener(T,"mouseout",d)))},[d]),m.useEffect(()=>{T&&f&&(j!==null&&google.maps.event.removeListener(j),B(google.maps.event.addListener(T,"mouseover",f)))},[f]),m.useEffect(()=>{T&&p&&(O!==null&&google.maps.event.removeListener(O),V(google.maps.event.addListener(T,"mouseup",p)))},[p]),m.useEffect(()=>{T&&g&&(G!==null&&google.maps.event.removeListener(G),q(google.maps.event.addListener(T,"rightclick",g)))},[g]),m.useEffect(()=>{T&&A&&($!==null&&google.maps.event.removeListener($),ie(google.maps.event.addListener(T,"click",A)))},[A]),m.useEffect(()=>{T&&y&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener(T,"drag",y)))},[y]),m.useEffect(()=>{T&&S&&(oe!==null&&google.maps.event.removeListener(oe),Z(google.maps.event.addListener(T,"bounds_changed",S)))},[S]),m.useEffect(()=>{var te=new google.maps.Rectangle(mJ(mJ({},e),{},{map:v}));return typeof i<"u"&&te.setVisible(i),typeof r<"u"&&te.setEditable(r),typeof o<"u"&&te.setDraggable(o),typeof n<"u"&&te.setBounds(n),a&&b(google.maps.event.addListener(te,"dblclick",a)),l&&H(google.maps.event.addListener(te,"dragend",l)),s&&E(google.maps.event.addListener(te,"dragstart",s)),c&&U(google.maps.event.addListener(te,"mousedown",c)),u&&k(google.maps.event.addListener(te,"mousemove",u)),d&&L(google.maps.event.addListener(te,"mouseout",d)),f&&B(google.maps.event.addListener(te,"mouseover",f)),p&&V(google.maps.event.addListener(te,"mouseup",p)),g&&q(google.maps.event.addListener(te,"rightclick",g)),A&&ie(google.maps.event.addListener(te,"click",A)),y&&se(google.maps.event.addListener(te,"drag",y)),S&&Z(google.maps.event.addListener(te,"bounds_changed",S)),w(te),C&&C(te),()=>{x!==null&&google.maps.event.removeListener(x),R!==null&&google.maps.event.removeListener(R),F!==null&&google.maps.event.removeListener(F),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),D!==null&&google.maps.event.removeListener(D),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),$!==null&&google.maps.event.removeListener($),Q!==null&&google.maps.event.removeListener(Q),oe!==null&&google.maps.event.removeListener(oe),P&&P(te),te.setMap(null)}},[]),null}m.memo(Fyo);let kyo=class extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{rectangle:null}),ho(this,"setRectangleCallback",()=>{this.state.rectangle!==null&&this.props.onLoad&&this.props.onLoad(this.state.rectangle)})}componentDidMount(){var e=new google.maps.Rectangle(mJ(mJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:TMe,eventMap:SMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{rectangle:e}},this.setRectangleCallback)}componentDidUpdate(e){this.state.rectangle!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:TMe,eventMap:SMe,prevProps:e,nextProps:this.props,instance:this.state.rectangle}))}componentWillUnmount(){this.state.rectangle!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.rectangle),Ga(this.registeredEvents),this.state.rectangle.setMap(null))}render(){return null}};ho(kyo,"contextType",Ta);function PMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function yJ(t){for(var e=1;e{x!==null&&x.setMap(w)},[w]),m.useEffect(()=>{typeof e<"u"&&x!==null&&x.setOptions(e)},[x,e]),m.useEffect(()=>{typeof r<"u"&&x!==null&&x.setDraggable(r)},[x,r]),m.useEffect(()=>{typeof i<"u"&&x!==null&&x.setEditable(i)},[x,i]),m.useEffect(()=>{typeof a<"u"&&x!==null&&x.setVisible(a)},[x,a]),m.useEffect(()=>{typeof o=="number"&&x!==null&&x.setRadius(o)},[x,o]),m.useEffect(()=>{typeof n<"u"&&x!==null&&x.setCenter(n)},[x,n]),m.useEffect(()=>{x&&l&&(R!==null&&google.maps.event.removeListener(R),H(google.maps.event.addListener(x,"dblclick",l)))},[l]),m.useEffect(()=>{x&&s&&(F!==null&&google.maps.event.removeListener(F),E(google.maps.event.addListener(x,"dragend",s)))},[s]),m.useEffect(()=>{x&&c&&(N!==null&&google.maps.event.removeListener(N),U(google.maps.event.addListener(x,"dragstart",c)))},[c]),m.useEffect(()=>{x&&u&&(W!==null&&google.maps.event.removeListener(W),k(google.maps.event.addListener(x,"mousedown",u)))},[u]),m.useEffect(()=>{x&&d&&(D!==null&&google.maps.event.removeListener(D),L(google.maps.event.addListener(x,"mousemove",d)))},[d]),m.useEffect(()=>{x&&f&&(j!==null&&google.maps.event.removeListener(j),B(google.maps.event.addListener(x,"mouseout",f)))},[f]),m.useEffect(()=>{x&&p&&(O!==null&&google.maps.event.removeListener(O),V(google.maps.event.addListener(x,"mouseover",p)))},[p]),m.useEffect(()=>{x&&g&&(G!==null&&google.maps.event.removeListener(G),q(google.maps.event.addListener(x,"mouseup",g)))},[g]),m.useEffect(()=>{x&&A&&($!==null&&google.maps.event.removeListener($),ie(google.maps.event.addListener(x,"rightclick",A)))},[A]),m.useEffect(()=>{x&&y&&(Q!==null&&google.maps.event.removeListener(Q),se(google.maps.event.addListener(x,"click",y)))},[y]),m.useEffect(()=>{x&&S&&(oe!==null&&google.maps.event.removeListener(oe),Z(google.maps.event.addListener(x,"drag",S)))},[S]),m.useEffect(()=>{x&&C&&(te!==null&&google.maps.event.removeListener(te),ee(google.maps.event.addListener(x,"center_changed",C)))},[y]),m.useEffect(()=>{x&&P&&(de!==null&&google.maps.event.removeListener(de),fe(google.maps.event.addListener(x,"radius_changed",P)))},[P]),m.useEffect(()=>{var pe=new google.maps.Circle(yJ(yJ({},e||Lyo),{},{map:w}));return typeof o=="number"&&pe.setRadius(o),typeof n<"u"&&pe.setCenter(n),typeof o=="number"&&pe.setRadius(o),typeof a<"u"&&pe.setVisible(a),typeof i<"u"&&pe.setEditable(i),typeof r<"u"&&pe.setDraggable(r),l&&H(google.maps.event.addListener(pe,"dblclick",l)),s&&E(google.maps.event.addListener(pe,"dragend",s)),c&&U(google.maps.event.addListener(pe,"dragstart",c)),u&&k(google.maps.event.addListener(pe,"mousedown",u)),d&&L(google.maps.event.addListener(pe,"mousemove",d)),f&&B(google.maps.event.addListener(pe,"mouseout",f)),p&&V(google.maps.event.addListener(pe,"mouseover",p)),g&&q(google.maps.event.addListener(pe,"mouseup",g)),A&&ie(google.maps.event.addListener(pe,"rightclick",A)),y&&se(google.maps.event.addListener(pe,"click",y)),S&&Z(google.maps.event.addListener(pe,"drag",S)),C&&ee(google.maps.event.addListener(pe,"center_changed",C)),P&&fe(google.maps.event.addListener(pe,"radius_changed",P)),b(pe),v&&v(pe),()=>{R!==null&&google.maps.event.removeListener(R),F!==null&&google.maps.event.removeListener(F),N!==null&&google.maps.event.removeListener(N),W!==null&&google.maps.event.removeListener(W),D!==null&&google.maps.event.removeListener(D),j!==null&&google.maps.event.removeListener(j),O!==null&&google.maps.event.removeListener(O),G!==null&&google.maps.event.removeListener(G),$!==null&&google.maps.event.removeListener($),Q!==null&&google.maps.event.removeListener(Q),te!==null&&google.maps.event.removeListener(te),de!==null&&google.maps.event.removeListener(de),T&&T(pe),pe.setMap(null)}},[]),null}m.memo(Wyo);class Nyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{circle:null}),ho(this,"setCircleCallback",()=>{this.state.circle!==null&&this.props.onLoad&&this.props.onLoad(this.state.circle)})}componentDidMount(){var e=new google.maps.Circle(yJ(yJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:RMe,eventMap:CMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{circle:e}},this.setCircleCallback)}componentDidUpdate(e){this.state.circle!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:RMe,eventMap:CMe,prevProps:e,nextProps:this.props,instance:this.state.circle}))}componentWillUnmount(){if(this.state.circle!==null){var e;this.props.onUnmount&&this.props.onUnmount(this.state.circle),Ga(this.registeredEvents),(e=this.state.circle)===null||e===void 0||e.setMap(null)}}render(){return null}}ho(Nyo,"contextType",Ta);function HMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function AJ(t){for(var e=1;e{C!==null&&C.setMap(S)},[S]),m.useEffect(()=>{C&&o&&(v!==null&&google.maps.event.removeListener(v),T(google.maps.event.addListener(C,"dblclick",o)))},[o]),m.useEffect(()=>{C&&r&&(w!==null&&google.maps.event.removeListener(w),x(google.maps.event.addListener(C,"mousedown",r)))},[r]),m.useEffect(()=>{C&&i&&(b!==null&&google.maps.event.removeListener(b),R(google.maps.event.addListener(C,"mousemove",i)))},[i]),m.useEffect(()=>{C&&a&&(H!==null&&google.maps.event.removeListener(H),F(google.maps.event.addListener(C,"mouseout",a)))},[a]),m.useEffect(()=>{C&&l&&(E!==null&&google.maps.event.removeListener(E),N(google.maps.event.addListener(C,"mouseover",l)))},[l]),m.useEffect(()=>{C&&s&&(U!==null&&google.maps.event.removeListener(U),W(google.maps.event.addListener(C,"mouseup",s)))},[s]),m.useEffect(()=>{C&&c&&(k!==null&&google.maps.event.removeListener(k),D(google.maps.event.addListener(C,"rightclick",c)))},[c]),m.useEffect(()=>{C&&n&&(L!==null&&google.maps.event.removeListener(L),j(google.maps.event.addListener(C,"click",n)))},[n]),m.useEffect(()=>{C&&u&&(B!==null&&google.maps.event.removeListener(B),O(google.maps.event.addListener(C,"addfeature",u)))},[u]),m.useEffect(()=>{C&&d&&(V!==null&&google.maps.event.removeListener(V),G(google.maps.event.addListener(C,"removefeature",d)))},[d]),m.useEffect(()=>{C&&f&&(q!==null&&google.maps.event.removeListener(q),$(google.maps.event.addListener(C,"removeproperty",f)))},[f]),m.useEffect(()=>{C&&p&&(ie!==null&&google.maps.event.removeListener(ie),Q(google.maps.event.addListener(C,"setgeometry",p)))},[p]),m.useEffect(()=>{C&&g&&(se!==null&&google.maps.event.removeListener(se),oe(google.maps.event.addListener(C,"setproperty",g)))},[g]),m.useEffect(()=>{if(S!==null){var Z=new google.maps.Data(AJ(AJ({},e),{},{map:S}));o&&T(google.maps.event.addListener(Z,"dblclick",o)),r&&x(google.maps.event.addListener(Z,"mousedown",r)),i&&R(google.maps.event.addListener(Z,"mousemove",i)),a&&F(google.maps.event.addListener(Z,"mouseout",a)),l&&N(google.maps.event.addListener(Z,"mouseover",l)),s&&W(google.maps.event.addListener(Z,"mouseup",s)),c&&D(google.maps.event.addListener(Z,"rightclick",c)),n&&j(google.maps.event.addListener(Z,"click",n)),u&&O(google.maps.event.addListener(Z,"addfeature",u)),d&&G(google.maps.event.addListener(Z,"removefeature",d)),f&&$(google.maps.event.addListener(Z,"removeproperty",f)),p&&Q(google.maps.event.addListener(Z,"setgeometry",p)),g&&oe(google.maps.event.addListener(Z,"setproperty",g)),P(Z),A&&A(Z)}return()=>{C&&(v!==null&&google.maps.event.removeListener(v),w!==null&&google.maps.event.removeListener(w),b!==null&&google.maps.event.removeListener(b),H!==null&&google.maps.event.removeListener(H),E!==null&&google.maps.event.removeListener(E),U!==null&&google.maps.event.removeListener(U),k!==null&&google.maps.event.removeListener(k),L!==null&&google.maps.event.removeListener(L),B!==null&&google.maps.event.removeListener(B),V!==null&&google.maps.event.removeListener(V),q!==null&&google.maps.event.removeListener(q),ie!==null&&google.maps.event.removeListener(ie),se!==null&&google.maps.event.removeListener(se),y&&y(C),C.setMap(null))}},[]),null}m.memo(Uyo);class jyo extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{data:null}),ho(this,"setDataCallback",()=>{this.state.data!==null&&this.props.onLoad&&this.props.onLoad(this.state.data)})}componentDidMount(){if(this.context!==null){var e=new google.maps.Data(AJ(AJ({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:IMe,eventMap:MMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({data:e}),this.setDataCallback)}}componentDidUpdate(e){this.state.data!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:IMe,eventMap:MMe,prevProps:e,nextProps:this.props,instance:this.state.data}))}componentWillUnmount(){this.state.data!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.data),Ga(this.registeredEvents),this.state.data&&this.state.data.setMap(null))}render(){return null}}ho(jyo,"contextType",Ta);function zMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function DMe(t){for(var e=1;e{this.state.kmlLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.kmlLayer)})}componentDidMount(){var e=new google.maps.KmlLayer(DMe(DMe({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:FMe,eventMap:EMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{kmlLayer:e}},this.setKmlLayerCallback)}componentDidUpdate(e){this.state.kmlLayer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:FMe,eventMap:EMe,prevProps:e,nextProps:this.props,instance:this.state.kmlLayer}))}componentWillUnmount(){this.state.kmlLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.kmlLayer),Ga(this.registeredEvents),this.state.kmlLayer.setMap(null))}render(){return null}}ho(Byo,"contextType",Ta);function $rt(t,e){return typeof e=="function"?e(t.offsetWidth,t.offsetHeight):{x:0,y:0}}function Yyo(t,e){return new e(t.lat,t.lng)}function Oyo(t,e){return new e(new google.maps.LatLng(t.ne.lat,t.ne.lng),new google.maps.LatLng(t.sw.lat,t.sw.lng))}function Vyo(t,e,n){return t instanceof e?t:n(t,e)}function _yo(t,e,n){return t instanceof e?t:n(t,e)}function Gyo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n.getNorthEast()),r=t&&t.fromLatLngToDivPixel(n.getSouthWest());return o&&r?{left:"".concat(r.x+e.x,"px"),top:"".concat(o.y+e.y,"px"),width:"".concat(o.x-r.x-e.x,"px"),height:"".concat(r.y-o.y-e.y,"px")}:{left:"-9999px",top:"-9999px"}}function Xyo(t,e,n){var o=t&&t.fromLatLngToDivPixel(n);if(o){var{x:r,y:i}=o;return{left:"".concat(r+e.x,"px"),top:"".concat(i+e.y,"px")}}return{left:"-9999px",top:"-9999px"}}function Qrt(t,e,n,o){return n!==void 0?Gyo(t,e,_yo(n,google.maps.LatLngBounds,Oyo)):Xyo(t,e,Vyo(o,google.maps.LatLng,Yyo))}function Jyo(t,e){return t.left===e.left&&t.top===e.top&&t.width===e.height&&t.height===e.height}function kMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Kyo(t){for(var e=1;e{var f=document.createElement("div");return f.style.position="absolute",f},[]),d=m.useMemo(()=>qyo(u,o,e,n,l),[u,o,e,n]);return m.useEffect(()=>(i==null||i(d),d==null||d.setMap(c),()=>{a==null||a(d),d==null||d.setMap(null)}),[c,d]),m.useEffect(()=>{u.style.zIndex="".concat(r)},[r,u]),Hd.createPortal(s,u)}m.memo(Qyo);class HM extends m.PureComponent{constructor(e){super(e),ho(this,"state",{paneEl:null,containerStyle:{position:"absolute"}}),ho(this,"updatePane",()=>{var o=this.props.mapPaneName,r=this.overlayView.getPanes();Gu(!!o,"OverlayView requires props.mapPaneName but got %s",o),r?this.setState({paneEl:r[o]}):this.setState({paneEl:null})}),ho(this,"onAdd",()=>{var o,r;this.updatePane(),(o=(r=this.props).onLoad)===null||o===void 0||o.call(r,this.overlayView)}),ho(this,"onPositionElement",()=>{var o=this.overlayView.getProjection(),r=$yo({x:0,y:0},this.containerRef.current?$rt(this.containerRef.current,this.props.getPixelPositionOffset):{}),i=Qrt(o,r,this.props.bounds,this.props.position);if(!Jyo(i,{left:this.state.containerStyle.left,top:this.state.containerStyle.top,width:this.state.containerStyle.width,height:this.state.containerStyle.height})){var a,l,s,c;this.setState({containerStyle:{top:(a=i.top)!==null&&a!==void 0?a:0,left:(l=i.left)!==null&&l!==void 0?l:0,width:(s=i.width)!==null&&s!==void 0?s:0,height:(c=i.height)!==null&&c!==void 0?c:0,position:"absolute"}})}}),ho(this,"draw",()=>{this.onPositionElement()}),ho(this,"onRemove",()=>{var o,r;this.setState(()=>({paneEl:null})),(o=(r=this.props).onUnmount)===null||o===void 0||o.call(r,this.overlayView)}),this.containerRef=m.createRef();var n=new google.maps.OverlayView;n.onAdd=this.onAdd,n.draw=this.draw,n.onRemove=this.onRemove,this.overlayView=n}componentDidMount(){this.overlayView.setMap(this.context)}componentDidUpdate(e){var n=WMe(e.position),o=WMe(this.props.position),r=NMe(e.bounds),i=NMe(this.props.bounds);(n!==o||r!==i)&&this.overlayView.draw(),e.mapPaneName!==this.props.mapPaneName&&this.updatePane()}componentWillUnmount(){this.overlayView.setMap(null)}render(){var e=this.state.paneEl;return e?Hd.createPortal(h.jsx("div",{ref:this.containerRef,style:this.state.containerStyle,children:m.Children.only(this.props.children)}),e):null}}ho(HM,"FLOAT_PANE","floatPane");ho(HM,"MAP_PANE","mapPane");ho(HM,"MARKER_LAYER","markerLayer");ho(HM,"OVERLAY_LAYER","overlayLayer");ho(HM,"OVERLAY_MOUSE_TARGET","overlayMouseTarget");ho(HM,"contextType",Ta);function Zyo(){}function UMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function jMe(t){for(var e=1;enew google.maps.GroundOverlay(e,a,o),[]);return m.useEffect(()=>{l!==null&&l.setMap(i)},[i]),m.useEffect(()=>{typeof e<"u"&&l!==null&&(l.set("url",e),l.setMap(i))},[l,e]),m.useEffect(()=>{typeof r<"u"&&l!==null&&l.setOpacity(r?1:0)},[l,r]),m.useEffect(()=>{var s=new google.maps.LatLngBounds(new google.maps.LatLng(n.south,n.west),new google.maps.LatLng(n.north,n.east));typeof n<"u"&&l!==null&&(l.set("bounds",s),l.setMap(i))},[l,n]),null}m.memo(e2o);class Zrt extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{groundOverlay:null}),ho(this,"setGroundOverlayCallback",()=>{this.state.groundOverlay!==null&&this.props.onLoad&&this.props.onLoad(this.state.groundOverlay)})}componentDidMount(){Gu(!!this.props.url||!!this.props.bounds,"For GroundOverlay, url and bounds are passed in to constructor and are immutable after instantiated. This is the behavior of Google Maps JavaScript API v3 ( See https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay) Hence, use the corresponding two props provided by `react-google-maps-api`, url and bounds. In some cases, you'll need the GroundOverlay component to reflect the changes of url and bounds. You can leverage the React's key property to remount the component. Typically, just `key={url}` would serve your need. See https://github.com/tomchentw/react-google-maps/issues/655");var e=new google.maps.GroundOverlay(this.props.url,this.props.bounds,jMe(jMe({},this.props.options),{},{map:this.context}));this.registeredEvents=Ua({updaterMap:YMe,eventMap:BMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{groundOverlay:e}},this.setGroundOverlayCallback)}componentDidUpdate(e){this.state.groundOverlay!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:YMe,eventMap:BMe,prevProps:e,nextProps:this.props,instance:this.state.groundOverlay}))}componentWillUnmount(){this.state.groundOverlay&&(this.props.onUnmount&&this.props.onUnmount(this.state.groundOverlay),this.state.groundOverlay.setMap(null))}render(){return null}}ho(Zrt,"defaultProps",{onLoad:Zyo});ho(Zrt,"contextType",Ta);function OMe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function wJ(t){for(var e=1;e{google.maps.visualization||Gu(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} in useJsApiScript? %s',google.maps.visualization)},[]),m.useEffect(()=>{Gu(!!e,"data property is required in HeatmapLayer %s",e)},[e]),m.useEffect(()=>{a!==null&&a.setMap(i)},[i]),m.useEffect(()=>{r&&a!==null&&a.setOptions(r)},[a,r]),m.useEffect(()=>{var s=new google.maps.visualization.HeatmapLayer(wJ(wJ({},r),{},{data:e,map:i}));return l(s),n&&n(s),()=>{a!==null&&(o&&o(a),a.setMap(null))}},[]),null}m.memo(t2o);class n2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{heatmapLayer:null}),ho(this,"setHeatmapLayerCallback",()=>{this.state.heatmapLayer!==null&&this.props.onLoad&&this.props.onLoad(this.state.heatmapLayer)})}componentDidMount(){Gu(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} to ? %s',google.maps.visualization),Gu(!!this.props.data,"data property is required in HeatmapLayer %s",this.props.data);var e=new google.maps.visualization.HeatmapLayer(wJ(wJ({},this.props.options),{},{data:this.props.data,map:this.context}));this.registeredEvents=Ua({updaterMap:_Me,eventMap:VMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{heatmapLayer:e}},this.setHeatmapLayerCallback)}componentDidUpdate(e){Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:_Me,eventMap:VMe,prevProps:e,nextProps:this.props,instance:this.state.heatmapLayer})}componentWillUnmount(){this.state.heatmapLayer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.heatmapLayer),Ga(this.registeredEvents),this.state.heatmapLayer.setMap(null))}render(){return null}}ho(n2o,"contextType",Ta);var GMe={onCloseClick:"closeclick",onPanoChanged:"pano_changed",onPositionChanged:"position_changed",onPovChanged:"pov_changed",onResize:"resize",onStatusChanged:"status_changed",onVisibleChanged:"visible_changed",onZoomChanged:"zoom_changed"},XMe={register(t,e,n){t.registerPanoProvider(e,n)},links(t,e){t.setLinks(e)},motionTracking(t,e){t.setMotionTracking(e)},options(t,e){t.setOptions(e)},pano(t,e){t.setPano(e)},position(t,e){t.setPosition(e)},pov(t,e){t.setPov(e)},visible(t,e){t.setVisible(e)},zoom(t,e){t.setZoom(e)}};class o2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{streetViewPanorama:null}),ho(this,"setStreetViewPanoramaCallback",()=>{this.state.streetViewPanorama!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewPanorama)})}componentDidMount(){var e,n,o=(e=(n=this.context)===null||n===void 0?void 0:n.getStreetView())!==null&&e!==void 0?e:null;this.registeredEvents=Ua({updaterMap:XMe,eventMap:GMe,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({streetViewPanorama:o}),this.setStreetViewPanoramaCallback)}componentDidUpdate(e){this.state.streetViewPanorama!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:XMe,eventMap:GMe,prevProps:e,nextProps:this.props,instance:this.state.streetViewPanorama}))}componentWillUnmount(){this.state.streetViewPanorama!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.streetViewPanorama),Ga(this.registeredEvents),this.state.streetViewPanorama.setVisible(!1))}render(){return null}}ho(o2o,"contextType",Ta);class r2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"state",{streetViewService:null}),ho(this,"setStreetViewServiceCallback",()=>{this.state.streetViewService!==null&&this.props.onLoad&&this.props.onLoad(this.state.streetViewService)})}componentDidMount(){var e=new google.maps.StreetViewService;this.setState(function(){return{streetViewService:e}},this.setStreetViewServiceCallback)}componentWillUnmount(){this.state.streetViewService!==null&&this.props.onUnmount&&this.props.onUnmount(this.state.streetViewService)}render(){return null}}ho(r2o,"contextType",Ta);var JMe={onDirectionsChanged:"directions_changed"},KMe={directions(t,e){t.setDirections(e)},map(t,e){t.setMap(e)},options(t,e){t.setOptions(e)},panel(t,e){t.setPanel(e)},routeIndex(t,e){t.setRouteIndex(e)}};class i2o extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"state",{directionsRenderer:null}),ho(this,"setDirectionsRendererCallback",()=>{this.state.directionsRenderer!==null&&(this.state.directionsRenderer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.directionsRenderer))})}componentDidMount(){var e=new google.maps.DirectionsRenderer(this.props.options);this.registeredEvents=Ua({updaterMap:KMe,eventMap:JMe,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{directionsRenderer:e}},this.setDirectionsRendererCallback)}componentDidUpdate(e){this.state.directionsRenderer!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:KMe,eventMap:JMe,prevProps:e,nextProps:this.props,instance:this.state.directionsRenderer}))}componentWillUnmount(){this.state.directionsRenderer!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.directionsRenderer),Ga(this.registeredEvents),this.state.directionsRenderer&&this.state.directionsRenderer.setMap(null))}render(){return null}}ho(i2o,"contextType",Ta);var qMe={onPlacesChanged:"places_changed"},$Me={bounds(t,e){t.setBounds(e)}};class B9e extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",m.createRef()),ho(this,"state",{searchBox:null}),ho(this,"setSearchBoxCallback",()=>{this.state.searchBox!==null&&this.props.onLoad&&this.props.onLoad(this.state.searchBox)})}componentDidMount(){if(Gu(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places),this.containerElement!==null&&this.containerElement.current!==null){var e=this.containerElement.current.querySelector("input");if(e!==null){var n=new google.maps.places.SearchBox(e,this.props.options);this.registeredEvents=Ua({updaterMap:$Me,eventMap:qMe,prevProps:{},nextProps:this.props,instance:n}),this.setState(function(){return{searchBox:n}},this.setSearchBoxCallback)}}}componentDidUpdate(e){this.state.searchBox!==null&&(Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:$Me,eventMap:qMe,prevProps:e,nextProps:this.props,instance:this.state.searchBox}))}componentWillUnmount(){this.state.searchBox!==null&&(this.props.onUnmount&&this.props.onUnmount(this.state.searchBox),Ga(this.registeredEvents))}render(){return h.jsx("div",{ref:this.containerElement,children:m.Children.only(this.props.children)})}}ho(B9e,"contextType",Ta);var QMe={onPlaceChanged:"place_changed"},ZMe={bounds(t,e){t.setBounds(e)},restrictions(t,e){t.setComponentRestrictions(e)},fields(t,e){t.setFields(e)},options(t,e){t.setOptions(e)},types(t,e){t.setTypes(e)}};class eit extends m.PureComponent{constructor(){super(...arguments),ho(this,"registeredEvents",[]),ho(this,"containerElement",m.createRef()),ho(this,"state",{autocomplete:null}),ho(this,"setAutocompleteCallback",()=>{this.state.autocomplete!==null&&this.props.onLoad&&this.props.onLoad(this.state.autocomplete)})}componentDidMount(){var e;Gu(!!google.maps.places,'You need to provide libraries={["places"]} prop to component %s',google.maps.places);var n=(e=this.containerElement.current)===null||e===void 0?void 0:e.querySelector("input");if(n){var o=new google.maps.places.Autocomplete(n,this.props.options);this.registeredEvents=Ua({updaterMap:ZMe,eventMap:QMe,prevProps:{},nextProps:this.props,instance:o}),this.setState(()=>({autocomplete:o}),this.setAutocompleteCallback)}}componentDidUpdate(e){Ga(this.registeredEvents),this.registeredEvents=Ua({updaterMap:ZMe,eventMap:QMe,prevProps:e,nextProps:this.props,instance:this.state.autocomplete})}componentWillUnmount(){this.state.autocomplete!==null&&Ga(this.registeredEvents)}render(){return h.jsx("div",{ref:this.containerElement,className:this.props.className,children:m.Children.only(this.props.children)})}}ho(eit,"defaultProps",{className:""});ho(eit,"contextType",Ta);const eIe="/aladdin/assets/empty_heart-B57-2tMp.png",a2o="/aladdin/assets/red_heart-BaAtCixH.png",l2o="/aladdin/assets/open_file-B6scZwPU.png",s2o="/aladdin/assets/export_link-Dxa4UObV.png",c2o="/aladdin/assets/click_count-BZx6BgQJ.png";function GO(t){const e=new Date(t);if(!Number.isNaN(e.valueOf()))return e;const n=String(t).match(/\d+/g);if(n==null||n.length<=2)return e;{const[o,r,...i]=n.map(s=>parseInt(s)),a=[o,r-1,...i];return new Date(Date.UTC(...a))}}function tIe(t,e,n){const o=t!==1?e+"s":e;return t+" "+o+" "+n}function Sfe(){return Sfe=Object.assign?Object.assign.bind():function(t){for(var e=1;eDate.now();function d2o({date:t,formatter:e=tIe,component:n="time",live:o=!0,minPeriod:r=0,maxPeriod:i=XO,title:a,now:l=u2o,...s}){const[c,u]=m.useState(l());m.useEffect(()=>{if(!o)return;const T=(()=>{const w=GO(t).valueOf();if(!w)return console.warn("[react-timeago] Invalid Date provided"),0;const x=Math.round(Math.abs(c-w)/1e3),b=x{u(l())},R):0})();return()=>{T&&clearTimeout(T)}},[t,o,i,r,l,c]);const d=n,f=GO(t).valueOf();if(!f)return null;const p=Math.round(Math.abs(c-f)/1e3),g=f"u"?typeof t=="string"?t:GO(t).toISOString().substr(0,16).replace("T"," "):a,C=d==="time"?{...s,dateTime:GO(t).toISOString()}:s,P=tIe.bind(null,A,y,g);return m.createElement(d,Sfe({},C,{title:S}),e(A,y,g,f,P,l))}function vJ(){return vJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[r]=t[r]);return n}var h2o=["cdnSuffix","cdnUrl","countryCode","style","svg"],p2o="https://cdn.jsdelivr.net/gh/lipis/flag-icons/flags/4x3/",g2o="svg",m2o=127397,tit=function(e){var n=e.cdnSuffix,o=n===void 0?g2o:n,r=e.cdnUrl,i=r===void 0?p2o:r,a=e.countryCode,l=e.style,s=e.svg,c=s===void 0?!1:s,u=f2o(e,h2o);if(typeof a!="string")return null;if(c){var d=""+i+a.toLowerCase()+"."+o;return m.createElement("img",Object.assign({},u,{src:d,style:vJ({display:"inline-block",width:"1em",height:"1em",verticalAlign:"middle"},l)}))}var f=a.toUpperCase().replace(/./g,function(p){return String.fromCodePoint(p.charCodeAt(0)+m2o)});return m.createElement("span",Object.assign({role:"img"},u,{style:vJ({display:"inline-block",fontSize:"1em",lineHeight:"1em",verticalAlign:"middle"},l)}),f)};const nit=t=>{switch(t.type){case fa.PHOTOVOLTAIC:return BQe;case fa.PARABOLIC_DISH:return YQe;case fa.PARABOLIC_TROUGH:return OQe;case fa.FRESNEL_REFLECTOR:return VQe;case fa.SOLAR_POWER_TOWER:return _Qe;case fa.WIND_TURBINE:return JQe;case fa.COLOCATION_PROJECTS:return KQe;case fa.RESIDENTIAL_BUILDING:return WQe;case fa.COMMERCIAL_BUILDING:return NQe;case fa.SCHOOL_BUILDING:return UQe;case fa.TOURIST_ATTRACTION:return jQe;case fa.UNDER_CONSTRUCTION:return GQe}return XQe},{Panel:y2o}=fye,A2o=be.memo(({latRef:t,lngRef:e,selectAuthor:n,closeMap:o,openModel:r,deleteModel:i,likeModel:a,pinModel:l})=>{var fe;const s=M.getState().user,c=M(pn),u=M(En),d=M(lwt)??aje,f=M(swt)??0,p=M(Ege)??"roadmap",g=M(Jge),A=dt(qBe),y=M(QBe),[S,C]=m.useState(null),[P,v]=m.useState(null),[T,w]=m.useState(null),[x,b]=m.useState(!0),[R,H]=m.useState(!1),F=m.useRef(null),E=m.useRef([]),N=m.useRef(-1),U=m.useRef([]),W=$t(),k=14,D=(fe=s.email)==null?void 0:fe.endsWith("@intofuture.org"),L=()=>{U.current.length=0;for(const pe in g)if(Object.hasOwn(g,pe)){const ye=g[pe],ae=new google.maps.LatLng(ye.latitude,ye.longitude);U.current.push(ae)}},j=m.useCallback(pe=>{C(pe),L(),pe.setMapTypeId(p)},[p]),B=m.useCallback(function(){C(null)},[]),O=()=>{if(S){const pe=S.getCenter();if(pe){const ye=pe.lat(),ae=pe.lng();if(ye!==t.current||ae!==e.current){const Te={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:t.current,newLatitude:ye,oldLongitude:e.current,newLongitude:ae,undo:()=>{t.current=Te.oldLatitude,e.current=Te.oldLongitude},redo:()=>{t.current=Te.newLatitude,e.current=Te.newLongitude}};u(Te),t.current=ye,e.current=ae}}}},V=()=>{if(S){const pe=S.getZoom();if(pe!==void 0&&pe!==d){const ye={name:"Zoom Model Map",timestamp:Date.now(),oldValue:d,newValue:pe,undo:()=>{c(ae=>{ae.modelsMapZoom=ye.oldValue})},redo:()=>{c(ae=>{ae.modelsMapZoom=ye.newValue})}};u(ye),c(ae=>{ae.modelsMapZoom=pe})}}},G=()=>{if(S){const pe=S.getTilt();if(pe!==void 0&&pe!==f){const ye={name:"Tilt Model Map",timestamp:Date.now(),oldValue:f,newValue:pe,undo:()=>{c(ae=>{ae.modelsMapTilt=ye.oldValue})},redo:()=>{c(ae=>{ae.modelsMapTilt=ye.newValue})}};u(ye),c(ae=>{ae.modelsMapTilt=pe})}}},q=()=>{if(S){const pe=S.getMapTypeId();if(pe!==void 0&&pe!==p){const ye={name:"Change Model Map Type",timestamp:Date.now(),oldValue:p,newValue:pe,undo:()=>{c(ae=>{ae.modelsMapType=ye.oldValue})},redo:()=>{c(ae=>{ae.modelsMapType=ye.newValue})}};u(ye),c(ae=>{ae.modelsMapType=pe})}}},$={styles:[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"labels",stylers:[{visibility:"off"}]}]},ie=pe=>{pe.userid&&pe.title?(r(pe),o()):co(Y.t("message.ModelNotFound",W))},Q=pe=>{if(pe.userid&&pe.title){const ye=t1+"?client=web&userid="+pe.userid+"&title="+encodeURIComponent(pe.title);navigator.clipboard.writeText(ye).then(()=>S2(Y.t("cloudFilePanel.LinkGeneratedInClipBoard",W)+"."))}else co(Y.t("message.ModelNotFound",W))},se=pe=>{yi.confirm({title:Y.t("message.DoYouWantToDeleteModelFromMap",W),icon:h.jsx(ny,{}),onOk:()=>{i(pe,()=>{c(ye=>{var ae,Te;if(ye.modelSites){const ge=ye.modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(ge){let Se;for(const[Re,De]of ge)if(De.userid===pe.userid&&De.title===pe.title){Se=Re;break}Se&&(ge.delete(Se),ge.size===0&&((Te=(ae=E.current[N.current])==null?void 0:ae.marker)==null||Te.setMap(null)))}}}),v(null),w(null)})},onCancel:()=>{},okText:Y.t("word.Yes",W),cancelText:Y.t("word.No",W)})},oe=pe=>{var ye;if(pe.userid&&pe.title){const ae=me.getModelKey(pe),Te=!!((ye=s.likes)!=null&&ye.includes(ae));a(pe,!Te,()=>{c(ge=>{if(ge.user)if(ge.user.likes||(ge.user.likes=[]),ge.user.likes.includes(ae)){const Se=ge.user.likes.indexOf(ae);Se>=0&&ge.user.likes.splice(Se,1)}else ge.user.likes.push(ae);if(ge.modelSites){const Se=ge.modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(Se){for(const Re of Se.values())if(Re.userid===pe.userid&&Re.title===pe.title){Re.likeCount===void 0&&(Re.likeCount=0),Re.likeCount+=Te?-1:1;break}}}}),H(!R)})}},Z=pe=>{const ye=M.getState().modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(ye){for(const ae of ye.values())if(ae.userid===pe.userid&&ae.title===pe.title)return ae.likeCount??0}return 0},te=pe=>{const ye=M.getState().modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(ye){for(const ae of ye.values())if(ae.userid===pe.userid&&ae.title===pe.title)return ae.clickCount??0}return 0},ee=pe=>{const ye=M.getState().modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(ye){for(const ae of ye.values())if(ae.userid===pe.userid&&ae.title===pe.title)return ae.pinned}return!1},de=(pe,ye)=>{pe.userid&&pe.title&&l(pe,ye,()=>{c(ae=>{if(ae.modelSites){const Te=ae.modelSites.get(me.getLatLngKey(pe.latitude,pe.longitude));if(Te){for(const ge of Te.values())if(ge.userid===pe.userid&&ge.title===pe.title){ge.pinned=ye,H(!R);break}}}})})};return h.jsx(Nrt,{mapContainerStyle:{border:"1px solid",width:"100%",height:"100%"},mapTypeId:p,options:$,center:{lat:t.current,lng:e.current},zoom:d,tilt:f,onLoad:j,onUnmount:B,onCenterChanged:O,onZoomChanged:V,onTiltChanged:G,onMapTypeIdChanged:q,children:h.jsxs(h.Fragment,{children:[A&&U.current.map((pe,ye)=>{const ae=.2*d;return h.jsx(vfe,{icon:{path:google.maps.SymbolPath.CIRCLE,strokeColor:"red",strokeWeight:ae+2,scale:ae},position:pe},ye)}),P&&P.size&&T&&h.jsx(qrt,{position:{lat:T.lat(),lng:T.lng()},children:h.jsxs("div",{style:{border:"2px solid gainsboro",maxHeight:"400px",overflowY:"auto"},onMouseLeave:()=>{v(null),w(null)},children:[P.size>1?h.jsxs("div",{style:{background:"#dddddd",textAlign:"left",borderBottom:"1px solid gainsboro",paddingBottom:"4px",marginBottom:"4px"},children:[x?h.jsx(con,{title:Y.t("modelsMap.SortFromNewestToOldest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{b(!1)}}):h.jsx(Qon,{title:Y.t("modelsMap.SortFromOldestToNewest",W),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{b(!0)}}),h.jsxs("span",{style:{fontSize:"10px"},children:[P.size," ",Y.t("modelsMap.ModelsFoundOnThisSite",W)]}),T&&h.jsxs("span",{style:{fontSize:"10px"},children:[" —"," ",Y.t("word.Coordinates",W)+": ("+T.lat().toFixed(y8)+"°, "+T.lng().toFixed(y8)+"°)"]})]}):"",[...P.keys()].sort((pe,ye)=>{const ae=P.get(pe),Te=P.get(ye);return ae!=null&&ae.pinned&&!(Te!=null&&Te.pinned)?-1:Te!=null&&Te.pinned&&!(ae!=null&&ae.pinned)?1:(x?1:-1)*(((ae==null?void 0:ae.timeCreated)??0)-((Te==null?void 0:Te.timeCreated)??0))}).map((pe,ye)=>{const ae=P.get(pe);return ae?h.jsxs("div",{style:{padding:(P==null?void 0:P.size)>1?"5px 5px 20px 5px":"5px",background:ye%2===0?"white":"#eeeeee"},children:[ye===0&&h.jsxs("div",{style:{fontSize:"12px",display:"block",paddingBottom:"6px"},children:[ae.countryCode&&h.jsx(tit,{countryCode:ae.countryCode,style:{marginRight:"6px",width:"20px"},svg:!0}),ae.address??"Unknown",P.size===1&&h.jsx("span",{style:{fontSize:"10px",display:"block",paddingTop:"10px"},children:Y.t("word.Coordinates",W)+": ("+T.lat().toFixed(y8)+"°, "+T.lng().toFixed(y8)+"°)"})]}),h.jsx(fye,{style:{background:ee(ae)?"#FEF9EC":ye%2===0?"white":"#eeeeee",width:"400px"},bordered:!1,ghost:!0,defaultActiveKey:["0"],children:h.jsx(y2o,{header:h.jsxs(h.Fragment,{children:[ae.label,ee(ae)&&h.jsx(nPe,{style:{marginLeft:"8px"}})]}),style:{fontSize:"12px"},children:h.jsx("div",{style:{fontSize:"10px",display:"block",textAlign:"left"},children:h.jsxs(on,{align:"start",children:[ae.thumbnailUrl&&h.jsx("img",{alt:ae.label,title:Y.t("word.Open",W),src:ae.thumbnailUrl,style:{border:"1px solid #222",cursor:"pointer"},onClick:()=>ie(ae)}),h.jsxs("div",{children:[ae.description&&ae.description.trim()!==""?ae.description:""," —  By"," ",h.jsx("span",{style:{cursor:"pointer"},title:Y.t("modelsMap.ShowModelsPublishedByThisAuthor",W),onClick:()=>{n(ae.author)},children:!ae.author||ae.author===""?Y.t("word.Anonymous",W):ae.author}),", ",ae.timeCreated&&h.jsx(d2o,{date:new Date(ae.timeCreated)})]})]})})},ye)}),h.jsxs("div",{style:{marginTop:"10px",fontSize:"11px"},children:[D&&h.jsx(h.Fragment,{children:ee(ae)?h.jsx(Don,{style:{cursor:"pointer"},title:Y.t("word.Unpin",W),onClick:()=>de(ae,!1)}):h.jsx(nPe,{style:{cursor:"pointer"},title:Y.t("word.Pin",W),onClick:()=>de(ae,!0)})}),h.jsx("img",{alt:"Open",onClick:()=>ie(ae),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.Open",W),src:l2o,height:k,width:k}),h.jsx("img",{alt:"Export link",onClick:()=>Q(ae),style:{marginLeft:"5px",cursor:"pointer"},title:Y.t("word.Share",W),src:s2o,height:k,width:k}),ae.userid===s.uid&&h.jsx("img",{alt:"Delete",onClick:()=>se(ae),style:{marginLeft:"5px",cursor:"pointer"},title:Y.t("word.Delete",W),src:Lrt,height:k,width:k}),s.uid?h.jsx(h.Fragment,{children:s.likes&&s.likes.includes(me.getModelKey(ae))?h.jsx("img",{alt:"Like",onClick:()=>oe(ae),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.AlreadyLike",W),src:a2o,height:k,width:k}):h.jsx("img",{alt:"Like",onClick:()=>oe(ae),style:{marginLeft:"10px",cursor:"pointer"},title:Y.t("word.Like",W),src:eIe,height:k,width:k})}):h.jsx(h.Fragment,{children:h.jsx("img",{alt:"Like",style:{marginLeft:"10px",opacity:.5},title:Y.t("word.MustLogInToLike",W),src:eIe,height:k,width:k})}),"   ",Z(ae),h.jsx("img",{alt:"Click counter",style:{marginLeft:"10px"},title:Y.t("word.ClickCount",W),src:c2o,height:k,width:k}),"   ",te(ae)]})]},ye):null})]})}),!!y&&!!y.size&&h.jsx(_rt,{children:pe=>h.jsx("div",{children:[...y.keys()].map((ye,ae)=>{const Te=y.get(ye);if(!Te||!Te.size)return null;const ge=[...Te.keys()].sort((ue,he)=>{const ve=Te.get(ue),we=Te.get(he);return ve!=null&&ve.pinned&&!(we!=null&&we.pinned)?-1:we!=null&&we.pinned&&!(ve!=null&&ve.pinned)?1:(x?1:-1)*(((ve==null?void 0:ve.timeCreated)??0)-((we==null?void 0:we.timeCreated)??0))}),Se=Te.get(ge[0]);if(!Se)return null;const Re=nit(Se),De=dt.getState().modelsMapSelectedSite;let Ae=!1;for(const[ue,he]of Te)if(he.title===(De==null?void 0:De.title)){Ae=!0;break}return h.jsx(vfe,{label:Ae?{text:"⇧",color:"red",fontSize:"24px",fontWeight:"bold"}:void 0,ref:ue=>E.current[ae]=ue,clusterer:pe,icon:Re?{url:Re,labelOrigin:{x:15,y:42}}:void 0,position:{lat:Se.latitude,lng:Se.longitude},onClick:()=>ie(Se),onMouseOver:()=>{F.current=P,N.current=ae,v(Te);const ue=ye.split(", ");w(new google.maps.LatLng(Number.parseFloat(ue[0]),Number.parseFloat(ue[1])))},onMouseOut:()=>{P===F.current&&(v(null),w(null))}},ae)})})})]})})}),w2o="/aladdin/assets/image_load_failure-HGDkwC0S.png",oit=be.memo(({latRef:t,lngRef:e,author:n,models:o,closeCallback:r,openCloudFile:i})=>{const a=M(yp),l=M(m0),s=M(pn),c=M(Ege),u=m.useRef(o?new Map(o):new Map),[d,f]=m.useState(!1),[p,g]=m.useState(),[A,y]=m.useState(!1),{Search:S}=jl,C=m.useMemo(()=>({lng:l}),[l]);m.useEffect(()=>{o&&(u.current=new Map(o),f(!d))},[o]);const P=m.useMemo(()=>{let T=0;for(const w of u.current.values())(n||w.userid===a.uid)&&T++;return T},[u.current,n,a.uid,d]),v=n&&c!=="roadmap";return u.current.size===0?h.jsx(vue,{mask:!1,styles:{header:{height:"40px",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",background:v?"#6A6B6E":"whitesmoke"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:v?"#2A2B2E":"white"}},style:{scrollbarColor:v?"#6A6B6E":"whitesmoke"},title:(n??Y.t("modelsMap.MyPublishedModels",C))+" (0)",placement:"bottom",open:!0,height:"150px",onClose:()=>{r()},children:h.jsx(ug,{image:ug.PRESENTED_IMAGE_SIMPLE,style:{color:v?"lightgray":"dimgray"}})}):h.jsx(vue,{extra:h.jsxs(on,{children:[A?h.jsx(Son,{title:Y.t("modelsMap.SortFromNewestToOldest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{y(!1)}}):h.jsx(kQe,{title:Y.t("modelsMap.SortFromOldestToNewest",C),style:{cursor:"pointer",marginLeft:"2px",marginRight:"6px"},onClick:()=>{y(!0)}}),h.jsx(S,{title:Y.t("modelsMap.SearchByLabel",C),allowClear:!0,size:"small",enterButton:!0,onSearch:T=>{var w;if(o){u.current.clear();for(const[x,b]of o)(w=b.label)!=null&&w.toLowerCase().includes(T.toLowerCase())&&u.current.set(x,b);f(!d)}}})]}),mask:!1,styles:{header:{height:"40px",color:v?"white":"black",background:v?"#6A6B6E":"whitesmoke",paddingLeft:"1px",paddingRight:"1px",paddingTop:"16px",paddingBottom:"12px",border:"none"},body:{padding:"0px 4px 0px 4px",overflowY:"hidden",background:v?"#2A2B2E":"white"}},title:(n??Y.t("modelsMap.MyPublishedModels",C))+" ("+P+")",placement:"bottom",open:!0,height:"164px",onClose:()=>{g(void 0),r()},children:h.jsx("table",{children:h.jsx("tbody",{children:h.jsx("tr",{children:[...u.current.keys()].sort((T,w)=>{const x=u.current.get(T),b=u.current.get(w);return!x||!b?0:(A?-1:1)*((b.timeCreated??0)-(x.timeCreated??0))}).map((T,w)=>{const x=u.current.get(T);return!x||!n&&x.userid!==a.uid?null:h.jsx("td",{children:h.jsxs("div",{style:{display:"block",marginTop:"4px"},children:[h.jsx("img",{loading:"lazy",height:"100px",width:"auto",onError:b=>{b.target.src=w2o},alt:x.label,title:x.label,src:x.thumbnailUrl,style:{cursor:"pointer",borderRadius:p===x?"0":"10px",border:p===x?"4px solid "+(v?"goldenrod":"red"):"none",marginRight:"4px"},onClick:()=>{g(x),i?i(x.userid,x.title):(s(b=>{x&&(b.modelsMapLatitude=x.latitude,b.modelsMapLongitude=x.longitude,b.modelsMapZoom=17,t&&(t.current=x.latitude),e&&(e.current=x.longitude))}),dt.getState().set(b=>{b.modelsMapSelectedSite=x}))}}),h.jsxs("div",{children:[h.jsx("img",{alt:x.type,src:nit(x),style:{position:"relative",left:"8px",bottom:"28px",width:"16px",height:"16px"}}),h.jsx("span",{style:{position:"relative",left:"16px",bottom:"24px",color:"white",fontSize:"8px",fontWeight:"bold"},children:x.label?x.label.length>30?x.label.substring(0,30)+"...":x.label:"Unknown"})]})]})},w)})})})})})}),v2o=["places"],{RangePicker:x2o}=Vw,b2o=Ho.div` position: absolute; top: 70px; left: 0; @@ -7162,9 +7162,9 @@ PERFORMANCE OF THIS SOFTWARE. z-index: 999; tab-index: 0; background: white; -`,rIe=be.memo(({openCloudFile:t,deleteModelFromMap:e,likeModelFromMap:n,pinModelFromMap:o})=>{var se;const r=M(yp),i=M(pn),a=M(En),l=M(Ege),s=M(iwt),c=s!==void 0?s:42.2844063,u=M(awt),d=u!==void 0?u:-71.3488548,f=M.getState().modelsMapAddress??pG,p=dt(qBe),g=M(eYe),A=M(tYe),y=M(nYe),S=dt(bwt),C=M(uwt),P=M(QBe),v=M(dwt),T=M(ZBe),w=M(fwt),x=m.useRef(T?new Map(T):new Map),[b,R]=m.useState(),[H,F]=m.useState(!1),E=m.useRef(),N=m.useRef(),U=m.useRef(c),W=m.useRef(d),k=$t(),{Search:D}=jl;m.useEffect(()=>{x.current=T?new Map(T):new Map,b&&(E.current=T.get(b)),F(!H)},[T,b]);const L=Z=>{R(Z),dt.getState().set(ee=>{ee.showLeaderboard||(ee.leaderboardFlag=!0),Z&&(E.current=x.current.get(Z))})},{isLoaded:j,loadError:B}=Ort({id:"google-map-script",googleMapsApiKey:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",libraries:v2o}),O=()=>{dt.getState().set(Z=>{Z.openModelsMap=!1}),i(Z=>{Z.modelsMapLatitude=U.current,Z.modelsMapLongitude=W.current})},V=Z=>{N.current=Z},G=()=>{var ee;const Z=(ee=N.current)==null?void 0:ee.getPlaces();if(Z&&Z.length>0){const te=Z[0].geometry;if(te&&te.location){const oe={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:c,newLatitude:te.location.lat(),oldLongitude:d,newLongitude:te.location.lng(),oldAddress:f,newAddress:Z[0].formatted_address,undo:()=>{i(de=>{de.modelsMapLatitude=oe.oldLatitude,de.modelsMapLongitude=oe.oldLongitude,de.modelsMapAddress=oe.oldAddress,U.current=de.modelsMapLatitude,W.current=de.modelsMapLongitude})},redo:()=>{i(de=>{de.modelsMapLatitude=oe.newLatitude,de.modelsMapLongitude=oe.newLongitude,de.modelsMapAddress=oe.newAddress,U.current=de.modelsMapLatitude,W.current=de.modelsMapLongitude})}};a(oe),i(de=>{te.location&&(de.modelsMapLatitude=te.location.lat(),de.modelsMapLongitude=te.location.lng(),U.current=de.modelsMapLatitude,W.current=de.modelsMapLongitude),de.modelsMapAddress=Z[0].formatted_address})}}},q=(se=r.email)==null?void 0:se.endsWith("@intofuture.org"),$=m.useMemo(()=>{if(!v||!v.size)return 0;let Z=0;for(const ee of v.values())Z+=ee.size??0;return Z},[v]),ie=m.useMemo(()=>{if(!P||!P.size)return 0;let Z=0;for(const ee of P.values())Z+=ee.size??0;return Z},[P]),Q=(Z,ee)=>{const te=new Map;for(const[oe,de]of w){const he=new Map;for(const[pe,me]of de)me.timeCreated&&me.timeCreated>=Z&&me.timeCreated<=ee&&he.set(pe,me);he.size>0&&te.set(oe,he)}i(oe=>{oe.peopleModels=te})};return h.jsxs(b2o,{onKeyDown:Z=>{Z.key==="Escape"&&O()},children:[j&&h.jsxs(on,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"240px",width:"300px",height:"28px",background:"white",borderRadius:"5px",boxShadow:"1px 1px 1px 1px gray"},children:[h.jsx(B9e,{onLoad:V,onPlacesChanged:G,children:h.jsx("input",{type:"text",placeholder:f,style:{boxSizing:"border-box",border:"1px solid transparent",width:"100%",height:"100%",fontSize:"12px",paddingLeft:"8px",paddingRight:"8px",outline:"none",textOverflow:"ellipses",position:"relative"}})}),h.jsx($$,{style:{marginLeft:"100px"}})]}),j&&h.jsxs(on,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"540px",width:"400px",height:"28px",paddingLeft:"12px"},children:[h.jsx(Li,{checked:g,onChange:Z=>{const ee=Z.target.checked;if(i(te=>{te.showModelsAllTime=ee}),ee)i(te=>{te.peopleModels=new Map(te.allPeopleModels)});else{const te=ul(A).toDate().getTime(),oe=ul(y).toDate().getTime();Q(te,oe)}dt.getState().set(te=>{te.modelsMapFlag=!0})},children:Y.t("modelsMap.AllTime",k)}),!g&&h.jsx(x2o,{format:"YYYY-MM-DD",size:"small",allowClear:!1,needConfirm:!0,value:[ul(A),ul(y)],onOk:Z=>{if(!Z)return;const ee=["2021-01-01","2025-12-31"];Z[0]&&(ee[0]=Z[0].toISOString()),Z[1]&&(ee[1]=Z[1].toISOString());const te=ul(ee[0]).toDate().getTime(),oe=ul(ee[1]).toDate().getTime(),de=new Map;for(const[he,pe]of v){const me=new Map;for(const[le,Te]of pe)Te.timeCreated&&Te.timeCreated>=te&&Te.timeCreated<=oe&&me.set(le,Te);me.size>0&&de.set(he,me)}i(he=>{he.showModelsFromDate=ee[0],he.showModelsToDate=ee[1],he.modelSites=de}),S&&Q(te,oe)}})]}),j?h.jsx(A2o,{latRef:U,lngRef:W,selectAuthor:L,closeMap:O,openModel:t,deleteModel:e,likeModel:n,pinModel:o}):h.jsx(YQ,{}),B&&h.jsx(on,{children:h.jsx("div",{children:"Map cannot be loaded right now, sorry."})}),h.jsxs(h.Fragment,{children:[b&&h.jsx(oit,{latRef:U,lngRef:W,author:b,models:E.current,closeCallback:()=>{R(void 0),E.current=void 0}}),S&&!b&&h.jsx("div",{style:{position:"absolute",fontSize:"10px",color:"black",bottom:"33px",left:"5px",width:"180px",height:"360px",overflowY:"auto",padding:"6px 6px 6px 6px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",textAlign:"left"},children:h.jsxs(on,{direction:"vertical",children:[h.jsx(D,{title:Y.t("modelsMap.SearchByPublisher",k),allowClear:!0,size:"small",enterButton:!0,onSearch:Z=>{if(T){x.current.clear();for(const[ee,te]of T)ee.toLowerCase().includes(Z.toLowerCase())&&x.current.set(ee,te);F(!H)}}}),x.current.size===0?h.jsx(ug,{image:ug.PRESENTED_IMAGE_SIMPLE}):h.jsx("table",{children:h.jsx("tbody",{children:[...x.current.keys()].sort((Z,ee)=>{const te=x.current.get(Z),oe=x.current.get(ee);return(oe?oe.size:0)-(te?te.size:0)}).map((Z,ee)=>{if(ee>50)return null;const te=x.current.get(Z);return(te==null?void 0:te.size)===void 0||(te==null?void 0:te.size)===0?null:h.jsxs("tr",{style:{width:"180px"},children:[h.jsx("td",{style:{width:"150px"},children:h.jsx(QKe,{icon:h.jsx(trn,{}),color:(te==null?void 0:te.size)>10?"gold":(te==null?void 0:te.size)>5?"lime":(te==null?void 0:te.size)>1?"blue":"magenta",style:{cursor:"pointer",fontSize:"10px",fontWeight:"bold",width:"130px"},onClick:()=>R(Z),title:Z,children:Z.length>16?Z.substring(0,15)+"...":Z})}),h.jsx("td",{children:te==null?void 0:te.size})]},ee)})})})]})}),h.jsx(on,{children:h.jsxs("div",{title:Y.t("modelsMap.TotalNumberOfUserPublishedModelsInSelectedPeriod",k)+": "+ie+` -`+Y.t("modelsMap.AllTimeTotal",k)+": "+$,style:{position:"absolute",fontSize:"14px",color:"black",bottom:"6px",left:"5px",width:"180px",height:"25px",paddingTop:"4px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",cursor:"pointer",userSelect:"none"},onClick:()=>{dt.getState().set(Z=>{Z.showLeaderboard||(Z.leaderboardFlag=!0),Z.showLeaderboard=!Z.showLeaderboard})},children:[S?h.jsx(rrn,{title:Y.t("word.Close",k),style:{marginRight:"8px"}}):h.jsx(aFt,{title:Y.t("word.Open",k),style:{marginRight:"8px"}}),Y.t("word.Leaderboard",k)]})}),C&&h.jsx(on,{children:h.jsxs("div",{style:{position:"absolute",fontSize:"10px",color:l==="roadmap"?"black":"white",bottom:"6px",left:"188px",height:"25x",padding:"6px 6px 2px 6px",cursor:"pointer"},onClick:()=>{i(Z=>{C&&(Z.modelsMapLatitude=C.latitude,Z.modelsMapLongitude=C.longitude,Z.modelsMapZoom=20,U.current=Z.modelsMapLatitude,W.current=Z.modelsMapLongitude)})},children:[Y.t("word.Latest",k)+": ",C.countryCode&&h.jsx(tit,{countryCode:C.countryCode,style:{marginLeft:"2px",marginRight:"4px",width:"20px"},svg:!0}),C.title+", by "+C.author]})}),h.jsx(on,{children:h.jsx("div",{style:{position:"absolute",fontSize:"12px",color:l==="roadmap"?"black":"white",top:"6px",height:"25x",padding:"6px 6px 2px 6px"},children:P.size+" "+Y.t("modelsMap.SitesFound",k)})}),h.jsx(on,{children:h.jsx("div",{style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:r.uid?"60px":"100px",width:"64px",height:"28px",background:"orange",boxShadow:"1px 1px 1px 1px gray",paddingTop:"4px"},onMouseDown:()=>{O()},children:Y.t("word.Close",k)})}),q&&h.jsx(on,{children:h.jsx(Li,{checked:p,style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:"130px",width:"160px",height:"28px",background:"white",boxShadow:"1px 1px 1px 1px gray",paddingLeft:"4px"},onChange:()=>{dt.getState().set(Z=>{Z.modelsMapWeatherStations=!Z.modelsMapWeatherStations})},children:p?h.jsx("span",{title:Y.t("mapPanel.WeatherStationsNote",k),children:Y.t("mapPanel.WeatherStations",k)}):h.jsx("span",{children:Y.t("mapPanel.WeatherStations",k)})})})]})]})}),S2o="/aladdin/assets/tiny_lock-DSfuZD8Y.png",T2o="/aladdin/assets/select-C-gZZ0yB.png",iIe="/aladdin/assets/foundation-Bf2d60AT.png",aIe="/aladdin/assets/cuboid-C70KMDTq.png",lIe="/aladdin/assets/sensor-BZ9UhBbW.png",Tfe="/aladdin/assets/solar-panel-BLllvFhu.png",sIe="/aladdin/assets/wall-Dcb0OCnD.png",cIe="/aladdin/assets/window-uls1fTpz.png",uIe="/aladdin/assets/door-DmvdjDKR.png",dIe="/aladdin/assets/pyramid_roof-CRzRVezC.png",fIe="/aladdin/assets/hip_roof-gO3gEx_s.png",hIe="/aladdin/assets/gambrel_roof-BKCAWDsb.png",pIe="/aladdin/assets/mansard_roof-DRTaI5DY.png",gIe="/aladdin/assets/gable_roof-9fruWngj.png",mIe="/aladdin/assets/tree-BUu2qyTB.png",yIe="/aladdin/assets/flower-DErmZ90Q.png",AIe="/aladdin/assets/human-EToF5YZi.png",wIe="/aladdin/assets/parabolic_trough-CSR3V81L.png",vIe="/aladdin/assets/parabolic_dish-BYGRlVcr.png",xIe="/aladdin/assets/fresnel_reflector-CBKiWWxR.png",Pfe="/aladdin/assets/heliostat-Kq0JVQG1.png",bIe="/aladdin/assets/wind_turbine-D02sl9A9.png",P2o="/aladdin/assets/vertical_axis_wind_turbine-C-KZaZtD.png",SIe="/aladdin/assets/led_light-D7hmM4q6.png",C2o="/aladdin/assets/group-BuZ9lmWH.png",R2o="/aladdin/assets/clear-BZ83yweM.png",H2o="/aladdin/assets/heliodon-CPHdpxt2.png",M2o="/aladdin/assets/analyze-CgmQCUK0.png",TIe="/aladdin/assets/battery_storage-BvqpVv99.png",PIe="/aladdin/assets/solar_water_heater-ifX6Xha6.png",L4=({...t})=>h.jsx("div",{style:{verticalAlign:"top",display:"inline-block",marginTop:"4px",marginRight:"8px"},children:t.children}),Av="invert(41%) sepia(0%) saturate(0%) hue-rotate(224deg) brightness(93%) contrast(81%)",ZT="invert(93%) sepia(3%) saturate(1955%) hue-rotate(26deg) brightness(113%) contrast(96%)",Qc=({objectType:t,srcImg:e,setFlag:n,replacingText:o})=>{const r=a=>{M.getState().set(l=>{l.objectTypeToAdd=a,l.groupActionMode=!1,l.actionModeLock=!1}),kn.getState().setEnableOrbitController(!1),M.getState().selectNone()},i=$t();return h.jsxs(an,{noPadding:!0,textSelectable:!1,onClick:()=>{n(t),r(t)},children:[h.jsx("img",{alt:t,src:e,height:36,width:36,style:{filter:Av,verticalAlign:"middle",marginRight:"10px"}}),Y.t(`toolbar.Add${o??t.replaceAll(" ","")}`,i)]})},I2o=be.memo(()=>{const t=M(pn),e=dt(bh),n=M(oa),o=M(Kn),r=M(m0),i=M(RW),a=M(A7t),l=M(kBe),s=M(Rge),c=dt(hs),u=M(Iwt),d=M(n$),f=M(r$),p=M(i$),g=M(SOe),A=M(mxt),y=M(yxt),S=M(En),C=dt(wW),P=dt(Lge),v=M(COe),T=M(Sxt),[w,x]=m.useState(z.Foundation),[b,R]=m.useState(z.Wall),[H,F]=m.useState(z.SolarPanel),E=m.useMemo(()=>({lng:r}),[r]),N=()=>{t(te=>{te.objectTypeToAdd=z.None,te.groupActionMode=!1,te.actionModeLock=!1}),dt.getState().setSelectButtonClicked(!0)},U=()=>{t(te=>{te.groupActionMode||(te.objectTypeToAdd=z.None),te.groupActionMode=!te.groupActionMode})},W=()=>{yi.confirm({title:Y.t("toolbar.DoYouReallyWantToClearContent",E)+"?",icon:h.jsx(ny,{}),onOk:()=>{const te=JSON.parse(JSON.stringify(M.getState().elements));u();const oe={name:"Clear Scene",timestamp:Date.now(),removedElements:te,undo:()=>{t(de=>{de.elements.push(...oe.removedElements)})},redo:()=>{u()}};S(oe)}}),N()},k=()=>{const te={name:"Show Sun and Time Settings Panel",timestamp:Date.now(),checked:!l,undo:()=>{t(oe=>{oe.viewState.showHeliodonPanel=!te.checked})},redo:()=>{t(oe=>{oe.viewState.showHeliodonPanel=te.checked})}};S(te),t(oe=>{oe.viewState.showHeliodonPanel=!oe.viewState.showHeliodonPanel,oe.viewState.showHeliodonPanel&&(oe.selectedFloatingWindow="heliodonPanel")})},D=()=>{P||gn(Y.t("message.SimulationStarted",E)),setTimeout(()=>{i(),e("runStaticSimulation",!P),t(te=>{n&&(te.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Static)",timestamp:new Date().getTime()})})},100)},L=()=>{C||gn(Y.t("message.SimulationStarted",E)),setTimeout(()=>{i(),e("runDynamicSimulation",!C),t(te=>{n&&(te.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Dynamic)",timestamp:new Date().getTime()})})},100)},j=te=>{t(oe=>{oe.objectTypeToAdd=te,oe.groupActionMode=!1,oe.actionModeLock=!1}),kn.getState().setEnableOrbitController(!1),dt.getState().setSelectButtonClicked(!1),i()},B=te=>{switch(te){case z.Human:case z.Tree:case z.Flower:case z.Sensor:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.VerticalAxisWindTurbine:case z.Light:case z.Wall:case z.Window:return!0;default:return!1}},O=(te,oe,de,he)=>{const pe=B(te),me=()=>Y.t(`toolbar.Add${he??te.replaceAll(" ","")}`,E)+(pe?` -`+(a?Y.t("toolbar.ClickToUnlockThisModeForNextAction",E):Y.t("toolbar.DoubleClickToLockThisModeForNextAction",E)):"");return h.jsxs(h.Fragment,{children:[h.jsx("img",{title:me(),alt:te,src:oe,height:36,width:36,style:{filter:d===te||de?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{j(te)},onDoubleClick:()=>{pe&&t(le=>{le.actionModeLock=!0})}}),(d===te||de)&&pe&&a&&h.jsx("img",{alt:"Tiny lock",src:S2o,style:{marginLeft:"-2px",filter:d===te||de?ZT:Av,verticalAlign:"top"}})]})},V=te=>h.jsx(rA,{menu:te,trigger:["click"],children:h.jsx("span",{title:Y.t("toolbar.ClickForMoreButtons",E),style:{cursor:"pointer",verticalAlign:"middle",fontSize:"10px",marginLeft:"4px",width:"10px",height:"36px",color:"#666666",fontWeight:"bold"},children:"▼"})}),G=[{key:"add-foundation",label:h.jsx(Qc,{objectType:z.Foundation,srcImg:iIe,setFlag:x})},{key:"add-cuboid",label:h.jsx(Qc,{objectType:z.Cuboid,srcImg:aIe,setFlag:x})},{key:"add-tree",label:h.jsx(Qc,{objectType:z.Tree,srcImg:mIe,setFlag:x})},{key:"add-flower",label:h.jsx(Qc,{objectType:z.Flower,srcImg:yIe,setFlag:x})},{key:"add-human",label:h.jsx(Qc,{objectType:z.Human,srcImg:AIe,setFlag:x,replacingText:"People"})}],q=[{key:"add-wall",label:h.jsx(Qc,{objectType:z.Wall,srcImg:sIe,setFlag:R})},{key:"add-window",label:h.jsx(Qc,{objectType:z.Window,srcImg:cIe,setFlag:R})},{key:"add-door",label:h.jsx(Qc,{objectType:z.Door,srcImg:uIe,setFlag:R})},{key:"add-pyramid-roof",label:h.jsx(Qc,{objectType:z.PyramidRoof,srcImg:dIe,setFlag:R})},{key:"add-hip-roof",label:h.jsx(Qc,{objectType:z.HipRoof,srcImg:fIe,setFlag:R})},{key:"add-gable-roof",label:h.jsx(Qc,{objectType:z.GableRoof,srcImg:gIe,setFlag:R})},{key:"add-gambrel-roof",label:h.jsx(Qc,{objectType:z.GambrelRoof,srcImg:hIe,setFlag:R})},{key:"add-mansard-roof",label:h.jsx(Qc,{objectType:z.MansardRoof,srcImg:pIe,setFlag:R})}],$=[{key:"add-solar-panel",label:h.jsx(Qc,{objectType:z.SolarPanel,srcImg:Tfe,setFlag:F})},{key:"add-parabolic-trough",label:h.jsx(Qc,{objectType:z.ParabolicTrough,srcImg:wIe,setFlag:F})},{key:"add-parabolic-dish",label:h.jsx(Qc,{objectType:z.ParabolicDish,srcImg:vIe,setFlag:F})},{key:"add-fresnel-reflector",label:h.jsx(Qc,{objectType:z.FresnelReflector,srcImg:xIe,setFlag:F})},{key:"add-heliostat",label:h.jsx(Qc,{objectType:z.Heliostat,srcImg:Pfe,setFlag:F})},{key:"add-wind-turbine",label:h.jsx(Qc,{objectType:z.WindTurbine,srcImg:bIe,setFlag:F})},{key:"add-sensor",label:h.jsx(Qc,{objectType:z.Sensor,srcImg:lIe,setFlag:F})},{key:"add-light",label:h.jsx(Qc,{objectType:z.Light,srcImg:SIe,setFlag:F})},{key:"add-water-heater",label:h.jsx(Qc,{objectType:z.SolarWaterHeater,srcImg:PIe,setFlag:F})},{key:"add-battery-storage",label:h.jsx(Qc,{objectType:z.BatteryStorage,srcImg:TIe,setFlag:F})}],ie=te=>{switch(te){case z.Foundation:return O(te,iIe,M.getState().addedFoundationId);case z.Cuboid:return O(te,aIe,M.getState().addedCuboidId);case z.Tree:return O(te,mIe);case z.Flower:return O(te,yIe);case z.Human:return O(te,AIe,void 0,"People")}},Q=te=>{switch(te){case z.Wall:return O(te,sIe,M.getState().addedWallId);case z.Window:return O(te,cIe,M.getState().addedWindowId);case z.Door:return O(te,uIe,M.getState().addedDoorId);case z.PyramidRoof:return O(z.PyramidRoof,dIe);case z.HipRoof:return O(z.HipRoof,fIe);case z.GableRoof:return O(z.GableRoof,gIe);case z.GambrelRoof:return O(z.GambrelRoof,hIe);case z.MansardRoof:return O(z.MansardRoof,pIe)}},se=te=>{switch(te){case z.SolarPanel:return O(te,Tfe);case z.ParabolicTrough:return O(te,wIe);case z.ParabolicDish:return O(te,vIe);case z.FresnelReflector:return O(te,xIe);case z.Heliostat:return O(te,Pfe);case z.Sensor:return O(te,lIe);case z.WindTurbine:return O(te,bIe);case z.VerticalAxisWindTurbine:return O(te,P2o);case z.Light:return O(te,SIe);case z.SolarWaterHeater:return O(te,PIe);case z.BatteryStorage:return O(te,TIe)}},Z=()=>d===z.None&&!f&&!p&&!g&&!A&&!y&&!v,ee=()=>{!s||ye.hasMovingParts(o)?L():D()};return h.jsxs("div",{children:[h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.Select",E),alt:"Select",src:T2o,height:36,width:36,style:{filter:Z()?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:N})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ManipulateGroup",E),alt:"Group",src:C2o,height:36,width:36,style:{filter:v?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:U})}),h.jsxs(L4,{children:[ie(w),V({items:G})]}),h.jsxs(L4,{children:[Q(b),V({items:q})]}),h.jsxs(L4,{children:[se(H),V({items:$})]}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ClearScene",E),alt:"Clear",src:R2o,height:36,width:36,color:"#666666",style:{cursor:"pointer"},onClick:W})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.SpatialAnalysisOfEnergy",E),alt:"Spatial analysis",src:M2o,height:36,width:36,color:"#666666",style:{filter:c?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{c?dt.getState().set(te=>{te.showSolarRadiationHeatmap=!1,te.showHeatFluxes=!1}):T()>sje?yi.confirm({title:Y.t("message.CalculationMayBeSlowDoYouWantToContinue",E)+" ("+Y.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",E)+")",icon:h.jsx(Zx,{}),onOk:()=>{ee()},onCancel:()=>{},okText:`${Y.t("word.Yes",E)}`,cancelText:`${Y.t("word.No",E)}`}):ee()}})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ShowSunAndTimeSettings",E),alt:"Heliodon",src:H2o,height:36,width:36,color:"#666666",style:{filter:l?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:k})})]})}),z2o=Ho.div` +`,rIe=be.memo(({openCloudFile:t,deleteModelFromMap:e,likeModelFromMap:n,pinModelFromMap:o})=>{var oe;const r=M(yp),i=M(pn),a=dt(Rf),l=M(En),s=M(Ege),c=M(iwt),u=c!==void 0?c:42.2844063,d=M(awt),f=d!==void 0?d:-71.3488548,p=M.getState().modelsMapAddress??pG,g=dt(qBe),A=M(eYe),y=M(tYe),S=M(nYe),C=dt(bwt),P=M(uwt),v=M(QBe),T=M(dwt),w=M(ZBe),x=M(fwt),b=m.useRef(w?new Map(w):new Map),[R,H]=m.useState(),[F,E]=m.useState(!1),N=m.useRef(),U=m.useRef(),W=m.useRef(u),k=m.useRef(f),D=$t(),{Search:L}=jl;m.useEffect(()=>{b.current=w?new Map(w):new Map,R&&(N.current=w.get(R)),E(!F)},[w,R]);const j=Z=>{H(Z),dt.getState().set(te=>{te.showLeaderboard||(te.leaderboardFlag=!0),Z&&(N.current=b.current.get(Z))})},{isLoaded:B,loadError:O}=Ort({id:"google-map-script",googleMapsApiKey:"AIzaSyCX6AmhM9d6R1ne9E7redd86YEahX_2Scs",libraries:v2o}),V=()=>{dt.getState().set(Z=>{Z.openModelsMap=!1}),i(Z=>{Z.modelsMapLatitude=W.current,Z.modelsMapLongitude=k.current})},G=Z=>{U.current=Z},q=()=>{var te;const Z=(te=U.current)==null?void 0:te.getPlaces();if(Z&&Z.length>0){const ee=Z[0].geometry;if(ee&&ee.location){const de={name:"Set Model Map Location",timestamp:Date.now(),oldLatitude:u,newLatitude:ee.location.lat(),oldLongitude:f,newLongitude:ee.location.lng(),oldAddress:p,newAddress:Z[0].formatted_address,undo:()=>{i(fe=>{fe.modelsMapLatitude=de.oldLatitude,fe.modelsMapLongitude=de.oldLongitude,fe.modelsMapAddress=de.oldAddress,W.current=fe.modelsMapLatitude,k.current=fe.modelsMapLongitude})},redo:()=>{i(fe=>{fe.modelsMapLatitude=de.newLatitude,fe.modelsMapLongitude=de.newLongitude,fe.modelsMapAddress=de.newAddress,W.current=fe.modelsMapLatitude,k.current=fe.modelsMapLongitude})}};l(de),i(fe=>{ee.location&&(fe.modelsMapLatitude=ee.location.lat(),fe.modelsMapLongitude=ee.location.lng(),W.current=fe.modelsMapLatitude,k.current=fe.modelsMapLongitude),fe.modelsMapAddress=Z[0].formatted_address})}}},$=(oe=r.email)==null?void 0:oe.endsWith("@intofuture.org"),ie=m.useMemo(()=>{if(!T||!T.size)return 0;let Z=0;for(const te of T.values())Z+=te.size??0;return Z},[T]),Q=m.useMemo(()=>{if(!v||!v.size)return 0;let Z=0;for(const te of v.values())Z+=te.size??0;return Z},[v]),se=(Z,te)=>{const ee=new Map;for(const[de,fe]of x){const pe=new Map;for(const[ye,ae]of fe)ae.timeCreated&&ae.timeCreated>=Z&&ae.timeCreated<=te&&pe.set(ye,ae);pe.size>0&&ee.set(de,pe)}i(de=>{de.peopleModels=ee})};return h.jsxs(b2o,{onKeyDown:Z=>{Z.key==="Escape"&&V()},children:[B&&h.jsxs(on,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"240px",width:"300px",height:"28px",background:"white",borderRadius:"5px",boxShadow:"1px 1px 1px 1px gray"},children:[h.jsx(B9e,{onLoad:G,onPlacesChanged:q,children:h.jsx("input",{type:"text",placeholder:p,style:{boxSizing:"border-box",border:"1px solid transparent",width:"100%",height:"100%",fontSize:"12px",paddingLeft:"8px",paddingRight:"8px",outline:"none",textOverflow:"ellipses",position:"relative"}})}),h.jsx($$,{style:{marginLeft:"100px"}})]}),B&&h.jsxs(on,{style:{position:"absolute",fontSize:"medium",color:"black",top:"-40px",left:"540px",width:"400px",height:"28px",paddingLeft:"12px"},children:[h.jsx(Li,{checked:A,onChange:Z=>{const te=Z.target.checked;if(i(ee=>{ee.showModelsAllTime=te}),te)i(ee=>{ee.peopleModels=new Map(ee.allPeopleModels)});else{const ee=ul(y).toDate().getTime(),de=ul(S).toDate().getTime();se(ee,de)}dt.getState().set(ee=>{ee.modelsMapFlag=!0})},children:Y.t("modelsMap.AllTime",D)}),!A&&h.jsx(x2o,{format:"YYYY-MM-DD",size:"small",allowClear:!1,needConfirm:!0,value:[ul(y),ul(S)],onOk:Z=>{if(!Z)return;const te=["2021-01-01","2025-12-31"];Z[0]&&(te[0]=Z[0].toISOString()),Z[1]&&(te[1]=Z[1].toISOString());const ee=ul(te[0]).toDate().getTime(),de=ul(te[1]).toDate().getTime(),fe=new Map;for(const[pe,ye]of T){const ae=new Map;for(const[Te,ge]of ye)ge.timeCreated&&ge.timeCreated>=ee&&ge.timeCreated<=de&&ae.set(Te,ge);ae.size>0&&fe.set(pe,ae)}i(pe=>{pe.showModelsFromDate=te[0],pe.showModelsToDate=te[1],pe.modelSites=fe}),C&&se(ee,de)}})]}),B?h.jsx(A2o,{latRef:W,lngRef:k,selectAuthor:j,closeMap:V,openModel:t,deleteModel:e,likeModel:n,pinModel:o}):h.jsx(YQ,{}),O&&h.jsx(on,{children:h.jsx("div",{children:"Map cannot be loaded right now, sorry."})}),h.jsxs(h.Fragment,{children:[R&&h.jsx(oit,{latRef:W,lngRef:k,author:R,models:N.current,closeCallback:()=>{H(void 0),a("modelsMapSelectedSite",void 0),N.current=void 0}}),C&&!R&&h.jsx("div",{style:{position:"absolute",fontSize:"10px",color:"black",bottom:"33px",left:"5px",width:"180px",height:"360px",overflowY:"auto",padding:"6px 6px 6px 6px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",textAlign:"left"},children:h.jsxs(on,{direction:"vertical",children:[h.jsx(L,{title:Y.t("modelsMap.SearchByPublisher",D),allowClear:!0,size:"small",enterButton:!0,onSearch:Z=>{if(w){b.current.clear();for(const[te,ee]of w)te.toLowerCase().includes(Z.toLowerCase())&&b.current.set(te,ee);E(!F)}}}),b.current.size===0?h.jsx(ug,{image:ug.PRESENTED_IMAGE_SIMPLE}):h.jsx("table",{children:h.jsx("tbody",{children:[...b.current.keys()].sort((Z,te)=>{const ee=b.current.get(Z),de=b.current.get(te);return(de?de.size:0)-(ee?ee.size:0)}).map((Z,te)=>{if(te>50)return null;const ee=b.current.get(Z);return(ee==null?void 0:ee.size)===void 0||(ee==null?void 0:ee.size)===0?null:h.jsxs("tr",{style:{width:"180px"},children:[h.jsx("td",{style:{width:"150px"},children:h.jsx(QKe,{icon:h.jsx(trn,{}),color:(ee==null?void 0:ee.size)>10?"gold":(ee==null?void 0:ee.size)>5?"lime":(ee==null?void 0:ee.size)>1?"blue":"magenta",style:{cursor:"pointer",fontSize:"10px",fontWeight:"bold",width:"130px"},onClick:()=>H(Z),title:Z,children:Z.length>16?Z.substring(0,15)+"...":Z})}),h.jsx("td",{children:ee==null?void 0:ee.size})]},te)})})})]})}),h.jsx(on,{children:h.jsxs("div",{title:Y.t("modelsMap.TotalNumberOfUserPublishedModelsInSelectedPeriod",D)+": "+Q+` +`+Y.t("modelsMap.AllTimeTotal",D)+": "+ie,style:{position:"absolute",fontSize:"14px",color:"black",bottom:"6px",left:"5px",width:"180px",height:"25px",paddingTop:"4px",background:"whitesmoke",boxShadow:"1px 1px 1px 1px gray",cursor:"pointer",userSelect:"none"},onClick:()=>{dt.getState().set(Z=>{Z.showLeaderboard||(Z.leaderboardFlag=!0),Z.showLeaderboard=!Z.showLeaderboard})},children:[C?h.jsx(rrn,{title:Y.t("word.Close",D),style:{marginRight:"8px"}}):h.jsx(aFt,{title:Y.t("word.Open",D),style:{marginRight:"8px"}}),Y.t("word.Leaderboard",D)]})}),P&&h.jsx(on,{children:h.jsxs("div",{style:{position:"absolute",fontSize:"10px",color:s==="roadmap"?"black":"white",bottom:"6px",left:"188px",height:"25x",padding:"6px 6px 2px 6px",cursor:"pointer"},onClick:()=>{i(Z=>{P&&(Z.modelsMapLatitude=P.latitude,Z.modelsMapLongitude=P.longitude,Z.modelsMapZoom=20,W.current=Z.modelsMapLatitude,k.current=Z.modelsMapLongitude)})},children:[Y.t("word.Latest",D)+": ",P.countryCode&&h.jsx(tit,{countryCode:P.countryCode,style:{marginLeft:"2px",marginRight:"4px",width:"20px"},svg:!0}),P.title+", by "+P.author]})}),h.jsx(on,{children:h.jsx("div",{style:{position:"absolute",fontSize:"12px",color:s==="roadmap"?"black":"white",top:"6px",height:"25x",padding:"6px 6px 2px 6px"},children:v.size+" "+Y.t("modelsMap.SitesFound",D)})}),h.jsx(on,{children:h.jsx("div",{style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:r.uid?"60px":"100px",width:"64px",height:"28px",background:"orange",boxShadow:"1px 1px 1px 1px gray",paddingTop:"4px"},onMouseDown:()=>{V()},children:Y.t("word.Close",D)})}),$&&h.jsx(on,{children:h.jsx(Li,{checked:g,style:{position:"absolute",fontSize:"medium",color:"black",cursor:"pointer",top:"-52px",right:"130px",width:"160px",height:"28px",background:"white",boxShadow:"1px 1px 1px 1px gray",paddingLeft:"4px"},onChange:()=>{dt.getState().set(Z=>{Z.modelsMapWeatherStations=!Z.modelsMapWeatherStations})},children:g?h.jsx("span",{title:Y.t("mapPanel.WeatherStationsNote",D),children:Y.t("mapPanel.WeatherStations",D)}):h.jsx("span",{children:Y.t("mapPanel.WeatherStations",D)})})})]})]})}),S2o="/aladdin/assets/tiny_lock-DSfuZD8Y.png",T2o="/aladdin/assets/select-C-gZZ0yB.png",iIe="/aladdin/assets/foundation-Bf2d60AT.png",aIe="/aladdin/assets/cuboid-C70KMDTq.png",lIe="/aladdin/assets/sensor-BZ9UhBbW.png",Tfe="/aladdin/assets/solar-panel-BLllvFhu.png",sIe="/aladdin/assets/wall-Dcb0OCnD.png",cIe="/aladdin/assets/window-uls1fTpz.png",uIe="/aladdin/assets/door-DmvdjDKR.png",dIe="/aladdin/assets/pyramid_roof-CRzRVezC.png",fIe="/aladdin/assets/hip_roof-gO3gEx_s.png",hIe="/aladdin/assets/gambrel_roof-BKCAWDsb.png",pIe="/aladdin/assets/mansard_roof-DRTaI5DY.png",gIe="/aladdin/assets/gable_roof-9fruWngj.png",mIe="/aladdin/assets/tree-BUu2qyTB.png",yIe="/aladdin/assets/flower-DErmZ90Q.png",AIe="/aladdin/assets/human-EToF5YZi.png",wIe="/aladdin/assets/parabolic_trough-CSR3V81L.png",vIe="/aladdin/assets/parabolic_dish-BYGRlVcr.png",xIe="/aladdin/assets/fresnel_reflector-CBKiWWxR.png",Pfe="/aladdin/assets/heliostat-Kq0JVQG1.png",bIe="/aladdin/assets/wind_turbine-D02sl9A9.png",P2o="/aladdin/assets/vertical_axis_wind_turbine-C-KZaZtD.png",SIe="/aladdin/assets/led_light-D7hmM4q6.png",C2o="/aladdin/assets/group-BuZ9lmWH.png",R2o="/aladdin/assets/clear-BZ83yweM.png",H2o="/aladdin/assets/heliodon-CPHdpxt2.png",M2o="/aladdin/assets/analyze-CgmQCUK0.png",TIe="/aladdin/assets/battery_storage-BvqpVv99.png",PIe="/aladdin/assets/solar_water_heater-ifX6Xha6.png",L4=({...t})=>h.jsx("div",{style:{verticalAlign:"top",display:"inline-block",marginTop:"4px",marginRight:"8px"},children:t.children}),Av="invert(41%) sepia(0%) saturate(0%) hue-rotate(224deg) brightness(93%) contrast(81%)",ZT="invert(93%) sepia(3%) saturate(1955%) hue-rotate(26deg) brightness(113%) contrast(96%)",Qc=({objectType:t,srcImg:e,setFlag:n,replacingText:o})=>{const r=a=>{M.getState().set(l=>{l.objectTypeToAdd=a,l.groupActionMode=!1,l.actionModeLock=!1}),kn.getState().setEnableOrbitController(!1),M.getState().selectNone()},i=$t();return h.jsxs(an,{noPadding:!0,textSelectable:!1,onClick:()=>{n(t),r(t)},children:[h.jsx("img",{alt:t,src:e,height:36,width:36,style:{filter:Av,verticalAlign:"middle",marginRight:"10px"}}),Y.t(`toolbar.Add${o??t.replaceAll(" ","")}`,i)]})},I2o=be.memo(()=>{const t=M(pn),e=dt(Rf),n=M(oa),o=M(Kn),r=M(m0),i=M(RW),a=M(A7t),l=M(kBe),s=M(Rge),c=dt(hs),u=M(Iwt),d=M(n$),f=M(r$),p=M(i$),g=M(SOe),A=M(mxt),y=M(yxt),S=M(En),C=dt(wW),P=dt(Lge),v=M(COe),T=M(Sxt),[w,x]=m.useState(z.Foundation),[b,R]=m.useState(z.Wall),[H,F]=m.useState(z.SolarPanel),E=m.useMemo(()=>({lng:r}),[r]),N=()=>{t(te=>{te.objectTypeToAdd=z.None,te.groupActionMode=!1,te.actionModeLock=!1}),dt.getState().setSelectButtonClicked(!0)},U=()=>{t(te=>{te.groupActionMode||(te.objectTypeToAdd=z.None),te.groupActionMode=!te.groupActionMode})},W=()=>{yi.confirm({title:Y.t("toolbar.DoYouReallyWantToClearContent",E)+"?",icon:h.jsx(ny,{}),onOk:()=>{const te=JSON.parse(JSON.stringify(M.getState().elements));u();const ee={name:"Clear Scene",timestamp:Date.now(),removedElements:te,undo:()=>{t(de=>{de.elements.push(...ee.removedElements)})},redo:()=>{u()}};S(ee)}}),N()},k=()=>{const te={name:"Show Sun and Time Settings Panel",timestamp:Date.now(),checked:!l,undo:()=>{t(ee=>{ee.viewState.showHeliodonPanel=!te.checked})},redo:()=>{t(ee=>{ee.viewState.showHeliodonPanel=te.checked})}};S(te),t(ee=>{ee.viewState.showHeliodonPanel=!ee.viewState.showHeliodonPanel,ee.viewState.showHeliodonPanel&&(ee.selectedFloatingWindow="heliodonPanel")})},D=()=>{P||gn(Y.t("message.SimulationStarted",E)),setTimeout(()=>{i(),e("runStaticSimulation",!P),t(te=>{n&&(te.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Static)",timestamp:new Date().getTime()})})},100)},L=()=>{C||gn(Y.t("message.SimulationStarted",E)),setTimeout(()=>{i(),e("runDynamicSimulation",!C),t(te=>{n&&(te.actionInfo={name:"Generate Daily Solar Radiation Heatmap (Dynamic)",timestamp:new Date().getTime()})})},100)},j=te=>{t(ee=>{ee.objectTypeToAdd=te,ee.groupActionMode=!1,ee.actionModeLock=!1}),kn.getState().setEnableOrbitController(!1),dt.getState().setSelectButtonClicked(!1),i()},B=te=>{switch(te){case z.Human:case z.Tree:case z.Flower:case z.Sensor:case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:case z.WindTurbine:case z.VerticalAxisWindTurbine:case z.Light:case z.Wall:case z.Window:return!0;default:return!1}},O=(te,ee,de,fe)=>{const pe=B(te),ye=()=>Y.t(`toolbar.Add${fe??te.replaceAll(" ","")}`,E)+(pe?` +`+(a?Y.t("toolbar.ClickToUnlockThisModeForNextAction",E):Y.t("toolbar.DoubleClickToLockThisModeForNextAction",E)):"");return h.jsxs(h.Fragment,{children:[h.jsx("img",{title:ye(),alt:te,src:ee,height:36,width:36,style:{filter:d===te||de?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{j(te)},onDoubleClick:()=>{pe&&t(ae=>{ae.actionModeLock=!0})}}),(d===te||de)&&pe&&a&&h.jsx("img",{alt:"Tiny lock",src:S2o,style:{marginLeft:"-2px",filter:d===te||de?ZT:Av,verticalAlign:"top"}})]})},V=te=>h.jsx(rA,{menu:te,trigger:["click"],children:h.jsx("span",{title:Y.t("toolbar.ClickForMoreButtons",E),style:{cursor:"pointer",verticalAlign:"middle",fontSize:"10px",marginLeft:"4px",width:"10px",height:"36px",color:"#666666",fontWeight:"bold"},children:"▼"})}),G=[{key:"add-foundation",label:h.jsx(Qc,{objectType:z.Foundation,srcImg:iIe,setFlag:x})},{key:"add-cuboid",label:h.jsx(Qc,{objectType:z.Cuboid,srcImg:aIe,setFlag:x})},{key:"add-tree",label:h.jsx(Qc,{objectType:z.Tree,srcImg:mIe,setFlag:x})},{key:"add-flower",label:h.jsx(Qc,{objectType:z.Flower,srcImg:yIe,setFlag:x})},{key:"add-human",label:h.jsx(Qc,{objectType:z.Human,srcImg:AIe,setFlag:x,replacingText:"People"})}],q=[{key:"add-wall",label:h.jsx(Qc,{objectType:z.Wall,srcImg:sIe,setFlag:R})},{key:"add-window",label:h.jsx(Qc,{objectType:z.Window,srcImg:cIe,setFlag:R})},{key:"add-door",label:h.jsx(Qc,{objectType:z.Door,srcImg:uIe,setFlag:R})},{key:"add-pyramid-roof",label:h.jsx(Qc,{objectType:z.PyramidRoof,srcImg:dIe,setFlag:R})},{key:"add-hip-roof",label:h.jsx(Qc,{objectType:z.HipRoof,srcImg:fIe,setFlag:R})},{key:"add-gable-roof",label:h.jsx(Qc,{objectType:z.GableRoof,srcImg:gIe,setFlag:R})},{key:"add-gambrel-roof",label:h.jsx(Qc,{objectType:z.GambrelRoof,srcImg:hIe,setFlag:R})},{key:"add-mansard-roof",label:h.jsx(Qc,{objectType:z.MansardRoof,srcImg:pIe,setFlag:R})}],$=[{key:"add-solar-panel",label:h.jsx(Qc,{objectType:z.SolarPanel,srcImg:Tfe,setFlag:F})},{key:"add-parabolic-trough",label:h.jsx(Qc,{objectType:z.ParabolicTrough,srcImg:wIe,setFlag:F})},{key:"add-parabolic-dish",label:h.jsx(Qc,{objectType:z.ParabolicDish,srcImg:vIe,setFlag:F})},{key:"add-fresnel-reflector",label:h.jsx(Qc,{objectType:z.FresnelReflector,srcImg:xIe,setFlag:F})},{key:"add-heliostat",label:h.jsx(Qc,{objectType:z.Heliostat,srcImg:Pfe,setFlag:F})},{key:"add-wind-turbine",label:h.jsx(Qc,{objectType:z.WindTurbine,srcImg:bIe,setFlag:F})},{key:"add-sensor",label:h.jsx(Qc,{objectType:z.Sensor,srcImg:lIe,setFlag:F})},{key:"add-light",label:h.jsx(Qc,{objectType:z.Light,srcImg:SIe,setFlag:F})},{key:"add-water-heater",label:h.jsx(Qc,{objectType:z.SolarWaterHeater,srcImg:PIe,setFlag:F})},{key:"add-battery-storage",label:h.jsx(Qc,{objectType:z.BatteryStorage,srcImg:TIe,setFlag:F})}],ie=te=>{switch(te){case z.Foundation:return O(te,iIe,M.getState().addedFoundationId);case z.Cuboid:return O(te,aIe,M.getState().addedCuboidId);case z.Tree:return O(te,mIe);case z.Flower:return O(te,yIe);case z.Human:return O(te,AIe,void 0,"People")}},Q=te=>{switch(te){case z.Wall:return O(te,sIe,M.getState().addedWallId);case z.Window:return O(te,cIe,M.getState().addedWindowId);case z.Door:return O(te,uIe,M.getState().addedDoorId);case z.PyramidRoof:return O(z.PyramidRoof,dIe);case z.HipRoof:return O(z.HipRoof,fIe);case z.GableRoof:return O(z.GableRoof,gIe);case z.GambrelRoof:return O(z.GambrelRoof,hIe);case z.MansardRoof:return O(z.MansardRoof,pIe)}},se=te=>{switch(te){case z.SolarPanel:return O(te,Tfe);case z.ParabolicTrough:return O(te,wIe);case z.ParabolicDish:return O(te,vIe);case z.FresnelReflector:return O(te,xIe);case z.Heliostat:return O(te,Pfe);case z.Sensor:return O(te,lIe);case z.WindTurbine:return O(te,bIe);case z.VerticalAxisWindTurbine:return O(te,P2o);case z.Light:return O(te,SIe);case z.SolarWaterHeater:return O(te,PIe);case z.BatteryStorage:return O(te,TIe)}},oe=()=>d===z.None&&!f&&!p&&!g&&!A&&!y&&!v,Z=()=>{!s||me.hasMovingParts(o)?L():D()};return h.jsxs("div",{children:[h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.Select",E),alt:"Select",src:T2o,height:36,width:36,style:{filter:oe()?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:N})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ManipulateGroup",E),alt:"Group",src:C2o,height:36,width:36,style:{filter:v?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:U})}),h.jsxs(L4,{children:[ie(w),V({items:G})]}),h.jsxs(L4,{children:[Q(b),V({items:q})]}),h.jsxs(L4,{children:[se(H),V({items:$})]}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ClearScene",E),alt:"Clear",src:R2o,height:36,width:36,color:"#666666",style:{cursor:"pointer"},onClick:W})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.SpatialAnalysisOfEnergy",E),alt:"Spatial analysis",src:M2o,height:36,width:36,color:"#666666",style:{filter:c?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:()=>{c?dt.getState().set(te=>{te.showSolarRadiationHeatmap=!1,te.showHeatFluxes=!1}):T()>sje?yi.confirm({title:Y.t("message.CalculationMayBeSlowDoYouWantToContinue",E)+" ("+Y.t("message.IncreaseSolarRadiationHeatmapGridCellSizeToSpeedUp",E)+")",icon:h.jsx(Zx,{}),onOk:()=>{Z()},onCancel:()=>{},okText:`${Y.t("word.Yes",E)}`,cancelText:`${Y.t("word.No",E)}`}):Z()}})}),h.jsx(L4,{children:h.jsx("img",{title:Y.t("toolbar.ShowSunAndTimeSettings",E),alt:"Heliodon",src:H2o,height:36,width:36,color:"#666666",style:{filter:l?ZT:Av,cursor:"pointer",verticalAlign:"middle"},onClick:k})})]})}),z2o=Ho.div` position: absolute; top: 0; right: 10px; @@ -7216,7 +7216,7 @@ PERFORMANCE OF THIS SOFTWARE. justify-content: space-between; align-items: center; cursor: move; -`,W2o=be.memo(({projects:t,setProjectState:e,deleteProject:n,renameProject:o})=>{const r=M(yp),i=M(oa),a=M(Fge),l=M(pn),s=M(Sc),c=be.useRef(null),u=m.useRef(null),d=u.current?u.current.clientWidth+40:680,f=u.current?u.current.clientHeight+100:600,[p,g]=m.useState({x:0,y:0}),[A,y]=m.useState(!1),[S,C]=m.useState(!1),[P,v]=m.useState({left:0,top:0,bottom:0,right:0}),[T,w]=m.useState(),[x,b]=m.useState(),R=m.useRef(null),H=m.useRef([...t]),[F,E]=m.useState(!1),[N,U]=m.useState(-1),{Search:W}=jl,{t:k}=Xl(),D=$t();m.useEffect(()=>{const $=()=>{g({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",$),()=>{window.removeEventListener("resize",$)}},[]),m.useEffect(()=>{t&&(H.current=[...t],E(!F))},[t]);const L=($,ie)=>{g({x:Math.max(ie.x,d-window.innerWidth),y:Math.min(ie.y,window.innerHeight-f)})},j=($,ie)=>{},B=()=>{dt.getState().set($=>{$.showProjectListPanel=!1}),i&&l($=>{$.actionInfo={name:"Close Project List",timestamp:new Date().getTime()}})},O=$=>{yi.confirm({title:k("projectListPanel.DoYouReallyWantToDeleteProject",D)+' "'+$+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),k("word.Warning",D)+": "+k("message.ThisCannotBeUndone",D)]}),icon:h.jsx(Zx,{}),onOk:()=>{n($),i&&l(ie=>{ie.actionInfo={name:"Delete Project",timestamp:new Date().getTime(),details:$}})}})},V=()=>{T&&x&&(o(T,x),b(void 0),E(!F),i&&l($=>{$.actionInfo={name:"Rename Project",timestamp:new Date().getTime(),details:{oldTitle:T,newTitle:x}}})),y(!1)},G=$=>{e($),a.clear(),i&&l(ie=>{ie.actionInfo={name:"Open Project",timestamp:new Date().getTime(),details:$.title}})},q=($,ie)=>{if(R.current){const{clientWidth:Q,clientHeight:se}=window.document.documentElement,Z=R.current.getBoundingClientRect();v({left:-Z.left+ie.x,right:Q-(Z.right-ie.x),top:-Z.top+ie.y,bottom:se-((Z==null?void 0:Z.bottom)-ie.y)})}};return h.jsxs(h.Fragment,{children:[h.jsx(yi,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>C(!0),onMouseOut:()=>C(!1),children:k("word.Rename",D)}),open:A,onOk:V,onCancel:()=>{y(!1),b(void 0)},modalRender:$=>h.jsx(Bi,{disabled:!S,bounds:P,onStart:(ie,Q)=>q(ie,Q),children:h.jsx("div",{ref:R,children:$})}),children:h.jsxs(on,{direction:"vertical",style:{width:"100%"},children:[h.jsx(jl,{placeholder:"Title",value:x||T,onPressEnter:V,onKeyDown:$=>{if(!cR.test($.key))return $.preventDefault(),!1},onChange:$=>{b($.target.value)}}),h.jsxs("span",{style:{fontSize:"11px",color:"red"},children:[h.jsx(nb,{style:{marginRight:"4px"}}),k("word.Caution",D)+": "+k("projectListPanel.IfSharedOrPublishedRenamingProjectBreaksExistingLinks",D),"."]})]})}),h.jsx(Bi,{nodeRef:c,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:L,onStop:j,onMouseDown:()=>{l($=>{$.selectedFloatingWindow="projectListPanel"})},children:h.jsx(F2o,{ref:c,style:{zIndex:s==="projectListPanel"?bc:14},children:h.jsxs(k2o,{ref:u,children:[h.jsxs(L2o,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:k("projectListPanel.MyProjects",D)+" ("+H.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{B()},onTouchStart:()=>{B()},children:k("word.Close",D)})]}),h.jsx("span",{style:{direction:"ltr"},children:h.jsx(W,{style:{width:"50%",paddingTop:"8px",paddingBottom:"8px"},title:k("projectListPanel.SearchByTitle",D),allowClear:!0,size:"small",enterButton:!0,onSearch:$=>{var ie;if(t){H.current=[];for(const Q of t)(ie=Q.title)!=null&&ie.toLowerCase().includes($.toLowerCase())&&H.current.push(Q);E(!F)}}})}),h.jsxs(Dd,{size:"small",style:{width:"100%",direction:"ltr",verticalAlign:"top"},dataSource:H.current,scroll:{y:360},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:[h.jsx(ole,{title:`${k("word.Title",D)}`,dataIndex:"title",width:"50%",sortDirections:["ascend","descend","ascend"],sorter:($,ie)=>$.title.localeCompare(ie.title),render:($,ie,Q)=>{const se=[{key:"project-title",label:h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:!0,fontWeight:"bold",children:$}),h.jsx("hr",{})]})},{key:"open-project",label:h.jsx(an,{noPadding:!0,onClick:()=>G(ie),children:k("word.Open",D)})},{key:"copy-title-to-clip-board",label:h.jsx(an,{noPadding:!0,onClick:()=>{navigator.clipboard.writeText($).then(()=>{S2(k("projectListPanel.TitleCopiedToClipBoard",D)+"."),i&&l(Z=>{Z.actionInfo={name:"Copy Project Title",timestamp:new Date().getTime(),details:$}})})},children:k("projectListPanel.CopyTitle",D)})},{key:"rename-project",label:h.jsx(an,{noPadding:!0,onClick:()=>{w($),y(!0)},children:k("word.Rename",D)})},{key:"delete-project",label:h.jsx(an,{noPadding:!0,onClick:()=>O($),children:k("word.Delete",D)})},{key:"generate-project-link",label:h.jsx(an,{noPadding:!0,onClick:()=>{const Z=t1+"?client=web&userid="+r.uid+"&project="+encodeURIComponent($);navigator.clipboard.writeText(Z).then(()=>{S2(k("projectListPanel.ProjectLinkGeneratedInClipBoard",D)+"."),i&&l(ee=>{ee.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:Z}})})},children:k("projectListPanel.GenerateProjectLink",D)})}];return h.jsxs(on,{style:{width:"100%"},children:[h.jsx(rA,{menu:{items:se},trigger:["hover"],children:h.jsx(JKe,{style:{fontSize:"12px",cursor:"pointer"},onMouseEnter:()=>{Q!==void 0&&U(Q)},onMouseLeave:()=>{U(-1)}})}),h.jsx(L6.Text,{title:k("word.Open",D),style:{fontSize:"12px",cursor:"pointer",verticalAlign:"top"},onClick:()=>{const Z=window.getSelection();Z&&Z.toString().length>0||G(ie)},children:$})]})},onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"title"),h.jsx(ole,{title:`${k("word.Type",D)}`,dataIndex:"type",width:"25%",render:$=>h.jsx(L6.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:$}),onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"type"),h.jsx(ole,{title:`${k("word.Time",D)}`,dataIndex:"time",width:"25%",defaultSortOrder:"descend",sortDirections:["ascend","descend","ascend"],sorter:($,ie)=>$.timestamp-ie.timestamp,render:$=>h.jsx(L6.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:$}),onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"time")]})]})})})]})}),N2o="/aladdin/assets/anonymous-DoSV0M20.png",ym=(t,e,n)=>{m.useEffect(()=>{t&&(e(),n())},[t])},U2o=be.memo(({viewOnly:t=!1,canvas:e})=>{const n=M(pn),o=dt(bh),r=M(yp),i=M(s0),a=M(Mb),l=M(_q),s=M(S8t),c=M(rYe),u=dt(C7t),d=dt(U7t),f=dt(j7t),p=dt(B7t),g=dt(Gq),A=M(zb),y=dt(hwt),S=dt(pwt),C=dt(vwt),P=dt(xwt),v=dt(Swt),T=dt(Twt),w=dt(Pwt),x=M(cwt),b=M($Be),R=M(kge),H=M(iYe),F=dt(KBe),E=M(Cwt),N=M(ZBe),U=dt(gwt),W=dt(mwt),k=dt(ywt),D=dt(Awt),L=dt(wwt),j=M(tYe),B=M(nYe),O=M(eYe),[V,G]=m.useState(!1),[q,$]=m.useState(!1),[ie,Q]=m.useState(A??"My Aladdin File"),[se,Z]=m.useState(!1),ee=m.useRef(),te=m.useRef([]),[oe,de]=m.useState([]),[he,pe]=m.useState(!1),me=m.useRef(),[le,Te]=m.useState([]),[ge,Se]=m.useState(!1),Re=$t();ym(y,Me,()=>o("saveAccountSettingsFlag",!1)),ym(S,Gt,()=>o("saveCloudFileFlag",!1)),ym(C,At,()=>o("modelsMapFlag",!1)),ym(P,pt,()=>o("leaderboardFlag",!1)),ym(v,Wt,()=>o("publishOnModelsMapFlag",!1)),ym(U,ht,()=>o("createProjectFlag",!1)),ym(W,ct,()=>o("saveProjectAsFlag",!1)),ym(D,ft,()=>o("showProjectsFlag",!1)),ym(L,kt,()=>o("updateProjectsFlag",!1)),ym(T,Ft,()=>o("listCloudFilesFlag",!1)),ym(w,Ve,()=>o("refreshCloudFilesFlag",!1)),ym(k,It,()=>o("curateDesignToProjectFlag",!1)),m.useEffect(()=>{const rt={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-316017.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let at=$n.apps.length===0;return $n.apps.length===1&&$n.apps[0].name===fG.LOG_DATA&&(at=!0),at?$n.initializeApp(rt):$n.app(),$n.auth().onAuthStateChanged(Ge=>{const Pt=new URLSearchParams(window.location.search).get("title");n(Ge?ot=>{ot.user&&(ot.user.uid=Ge.uid,ot.user.displayName=Ge.displayName??"Anonymous",ot.user.email=Ge.email,ot.user.photoURL=Ge.photoURL??N2o,Pe({...ot.user}).then(()=>{})),ot.cloudFile=Pt??void 0}:ot=>{ot.cloudFile=Pt??void 0})}),Ae(),window.addEventListener("popstate",De),()=>{window.removeEventListener("popstate",De)}},[]);const De=()=>{if(t)return;const rt=new URLSearchParams(window.location.search),at=rt.get("userid"),Ge=rt.get("title");at&&Ge&&$e(at,Ge,!0)};m.useEffect(()=>{r.uid&&te.current.length===0&&rXn(r.uid,te.current).then(()=>{})},[r.uid]),m.useEffect(()=>{if(he){if(te.current.length>0&&r.uid){const rt=[];te.current.forEach((at,Ge)=>{rt.push({title:at.title,timestamp:at.timestamp})}),rt.sort((at,Ge)=>Ge.timestamp-at.timestamp),de(rt)}pe(!1)}},[he]),m.useEffect(()=>{if(ge){if(me.current){const rt=[];me.current.forEach((at,Ge)=>{rt.push({key:Ge.toString(),owner:at.owner,title:at.title,time:ul(new Date(at.timestamp)).format("MM/DD/YYYY hh:mm A"),timestamp:at.timestamp,description:at.description,dataColoring:at.dataColoring,selectedProperty:at.selectedProperty,sortDescending:at.sortDescending,xAxisNameScatterPlot:at.xAxisNameScatterPlot,yAxisNameScatterPlot:at.yAxisNameScatterPlot,dotSizeScatterPlot:at.dotSizeScatterPlot,thumbnailWidth:at.thumbnailWidth,type:at.type,designs:at.designs,ranges:at.ranges??[],filters:at.filters??[],hiddenParameters:at.hiddenParameters??gd.getDefaultHiddenParameters(at.type),counter:at.counter,action:""})}),rt.sort((at,Ge)=>Ge.timestamp-at.timestamp),Te(rt)}Se(!1)}},[ge]),m.useEffect(()=>{if(ee.current=new Map,r.aliases&&r.aliases.length>0){for(const rt of r.aliases)if(rt!==r.displayName){const at=N.get(rt);at&&(ee.current=new Map([...ee.current,...at]))}}if(r.displayName){const rt=N.get(r.displayName);rt&&(ee.current=new Map([...ee.current,...rt]))}},[N,r.displayName,r.aliases]),m.useEffect(()=>{Z(x)},[b]),m.useEffect(()=>{Q(A??"My Aladdin File")},[A]);const Ae=()=>{const rt=new URLSearchParams(window.location.search),at=rt.get("userid");if(at){const Ge=rt.get("title"),yt=rt.get("project");yt?(G(!0),Gnt(at,yt,xt).finally(()=>{G(!1)}),Ge&>(at,Ge)):Ge&&$e(at,Ge)}else n(Ge=>{Ge.cloudFile=void 0});fe().then(()=>{})},ue=()=>{n(rt=>{rt.objectTypeToAdd=z.None,rt.groupActionMode=!1})},fe=async()=>{await $n.firestore().collection("app").doc("info").get().then(rt=>{if(rt.exists){const at=rt.data();at&&at.latestVersion&&dt.getState().set(Ge=>{Ge.latestVersion=at.latestVersion})}}).catch(rt=>{console.log(rt)})},ve=()=>{$n.auth().signInAnonymously().then(rt=>{n(at=>{rt.user&&(at.user.uid=rt.user.uid,at.user.anonymous=!0,at.user.displayName="Anonymous",Pe({...at.user}).then(()=>{}))})}).catch(rt=>{rt.code!=="auth/popup-closed-by-user"&&rt.code!=="auth/cancelled-popup-request"&&co(Y.t("message.CannotSignIn",Re)+": "+rt)}),ue()},we=()=>{const rt=new $n.auth.GoogleAuthProvider;$n.auth().signInWithPopup(rt).then(at=>{n(Ge=>{at.user&&(Ge.user.uid=at.user.uid,Ge.user.email=at.user.email,Ge.user.displayName=at.user.displayName,Ge.user.photoURL=at.user.photoURL,Pe({...Ge.user}).then(()=>{}))})}).catch(at=>{at.code!=="auth/popup-closed-by-user"&&at.code!=="auth/cancelled-popup-request"&&co(Y.t("message.CannotSignIn",Re)+": "+at)}),ue()},Pe=async rt=>{const at=$n.firestore();let Ge=!1,yt=!1,Pt=!1,ot=sc.UNKNOWN,bt=Oa.UNKNOWN,zt=[],Bt=[],tt=[],Ht=[],_t=!1,qt=0;rt.uid!==null&&(rt&&rt.email==="charles@intofuture.org"&&await at.collection("users").get().then(Rn=>{qt=Rn.size}),_t=await at.collection("users").doc(rt.uid).get().then(Rn=>{const yo=Rn.data();return yo?(Ge=!!yo.signFile,yt=!!yo.noLogging,Pt=!!yo.anonymous,ot=yo.schoolID?yo.schoolID:sc.UNKNOWN,bt=yo.classID?yo.classID:Oa.UNKNOWN,yo.fileList&&(zt=yo.fileList),yo.likes&&(Bt=yo.likes),yo.published&&(tt=yo.published),yo.aliases&&(Ht=yo.aliases),!0):!1})),_t?(n(un=>{un.user.signFile=Ge,un.user.noLogging=yt,un.user.anonymous=Pt,un.user.schoolID=ot,un.user.classID=bt,un.user.fileList=zt,un.user.likes=Bt,un.user.published=tt,un.user.aliases=Ht}),dt.getState().set(un=>{un.userCount=qt}),rt.signFile=Ge,rt.noLogging=yt,rt.anonymous=Pt,rt.schoolID=ot,rt.classID=bt,rt.fileList=zt,rt.likes=Bt,rt.published=tt,rt.aliases=Ht):rt.uid&&at.collection("users").doc(rt.uid).set({uid:rt.uid,anonymous:!!rt.anonymous,signFile:!!rt.signFile,noLogging:!!rt.noLogging,schoolID:rt.schoolID??sc.UNKNOWN,classID:rt.classID??Oa.UNKNOWN,since:ul(new Date).format("MM/DD/YYYY hh:mm A"),os:ye.getOS()}).then(()=>{gn(Y.t("message.YourAccountWasCreated",Re))}).catch(un=>{co(Y.t("message.CannotCreateAccount",Re)+": "+un)})},Ie=()=>{$n.auth().signOut().then(()=>{n(rt=>{rt.user.uid=null,rt.user.email=null,rt.user.displayName=null,rt.user.photoURL=null,rt.user.signFile=!1,rt.user.fileList=[],rt.user.likes=[],rt.user.published=[],rt.user.aliases=[],rt.cloudFile=void 0}),dt.getState().set(rt=>{rt.showCloudFilePanel=!1,rt.showAccountSettingsPanel=!1,rt.showModelsGallery=!1,rt.showProjectListPanel=!1})}).catch(rt=>{co(Y.t("message.CannotSignOut",Re)+": "+rt)})};function Me(){r.uid&&$n.firestore().collection("users").doc(r.uid).update({signFile:!!r.signFile,schoolID:r.schoolID??sc.UNKNOWN,classID:r.classID??Oa.UNKNOWN}).then(()=>{gn(Y.t("message.YourAccountSettingsWereSaved",Re))}).catch(at=>{co(Y.t("message.CannotSaveYourAccountSettings",Re)+": "+at)})}const ze=async()=>{G(!0);const rt=ul(j).toDate().getTime(),at=ul(B).toDate().getTime();await $n.firestore().collection("models").get().then(Ge=>{const yt=new Map,Pt=new Map;return Ge.forEach(ot=>{var zt;const bt=ot.data();if(bt){const Bt=new Map,tt=new Map;for(const Ht in bt){if(bt[Ht].countryCode||(zt=bt[Ht].address)!=null&&zt.endsWith("USA")&&(bt[Ht].countryCode="US"),O)Bt.set(Ht,bt[Ht]);else{const _t=bt[Ht].timeCreated;(_t===void 0||_t>=rt&&_t<=at)&&Bt.set(Ht,bt[Ht])}tt.set(Ht,bt[Ht])}Bt.size>0&&yt.set(ot.id,Bt),tt.size>0&&Pt.set(ot.id,tt)}}),n(ot=>{ot.modelSites=yt,ot.allModelSites=Pt}),yt}).catch(Ge=>{co(Y.t("message.CannotLoadModelsOnMap",Re)+": "+Ge)}).finally(()=>{G(!1)})},Ne=async()=>{await $n.firestore().collection("board").doc("info").get().then(rt=>{if(rt.exists){const at=rt.data();at&&at.latestModel&&n(Ge=>{var ot;let yt=!1;const Pt=at.latestModel;Pt.author&&(yt=!!((ot=Ge.peopleModels.get(Pt.author))!=null&&ot.get(ye.getModelKey(Pt)))),Ge.latestModelSite=yt?Pt:void 0})}}).catch(rt=>{console.log(rt)})},Je=async()=>{G(!0);const rt=ul(j).toDate().getTime(),at=ul(B).toDate().getTime();await $n.firestore().collection("board").doc("people").get().then(Ge=>{const yt=Ge.data();if(yt){const Pt=new Map,ot=new Map;for(const bt in yt){if(O)Pt.set(bt,new Map(Object.entries(yt[bt])));else{const zt=new Map;for(const Bt of Object.entries(yt[bt])){const tt=Bt[1].timeCreated;(tt===void 0||tt>=rt&&tt<=at)&&zt.set(Bt[0],Bt[1])}zt.size>0&&Pt.set(bt,zt)}ot.set(bt,new Map(Object.entries(yt[bt])))}n(bt=>{bt.peopleModels=Pt,bt.allPeopleModels=ot})}}).catch(Ge=>{co(Y.t("message.CannotLoadLeaderboard",Re)+": "+Ge)}).finally(()=>{G(!1)})},Ue=(rt,at)=>{r&&r.uid&&($n.firestore().collection("models").doc(ye.getLatLngKey(rt.latitude,rt.longitude)).update({[ye.getModelKey(rt)]:$n.firestore.FieldValue.delete()}).then(()=>{S2(Y.t("message.ModelDeletedFromMap",Re)),at&&at()}).catch(Ge=>{co(Y.t("message.CannotDeleteModelFromMap",Re)+": "+Ge)}),$n.firestore().collection("board").doc("people").update({[(rt.author??"Anonymous")+"."+ye.getModelKey(rt)]:$n.firestore.FieldValue.delete()}).then(()=>{n(Ge=>{Ge.peopleModels&&(Ge.peopleModels.delete(ye.getModelKey(rt)),dt.getState().set(yt=>{yt.leaderboardFlag=!0}))})}),$n.firestore().collection("users").doc(r.uid).update({published:$n.firestore.FieldValue.arrayRemove(rt.title)}).then(()=>{n(Ge=>{if(Ge.user&&Ge.user.published&&Ge.user.published.includes(rt.title)){const yt=Ge.user.published.indexOf(rt.title);yt>=0&&Ge.user.published.splice(yt,1)}})}))},nt=(rt,at,Ge)=>{if(r&&r.uid){const yt=ye.getModelKey(rt);$n.firestore().collection("users").doc(r.uid).update(at?{likes:$n.firestore.FieldValue.arrayUnion(yt)}:{likes:$n.firestore.FieldValue.arrayRemove(yt)}).then(()=>{}).catch(ot=>{co(Y.t("message.CannotLikeModelFromMap",Re)+": "+ot)});const Pt=yt+".likeCount";$n.firestore().collection("models").doc(ye.getLatLngKey(rt.latitude,rt.longitude)).update(at?{[Pt]:$n.firestore.FieldValue.increment(1)}:{[Pt]:$n.firestore.FieldValue.increment(-1)}).then(()=>{Ge&&Ge()}).catch(ot=>{co(Y.t("message.CannotLikeModelFromMap",Re)+": "+ot)})}},We=(rt,at,Ge)=>{r&&r.uid&&$n.firestore().collection("models").doc(ye.getLatLngKey(rt.latitude,rt.longitude)).update({[ye.getModelKey(rt)+".pinned"]:at}).then(()=>{Ge&&Ge()}).catch(()=>{})},Ee=rt=>{r&&r.uid&&$n.firestore().collection("models").doc(ye.getLatLngKey(rt.latitude,rt.longitude)).update({[ye.getModelKey(rt)+".clickCount"]:$n.firestore.FieldValue.increment(1)}).then(()=>{}).catch(()=>{})},ke=async rt=>{r.uid&&(rt||G(!0),me.current=await $n.firestore().collection("users").doc(r.uid).collection("projects").get().then(at=>{const Ge=[];return at.forEach(yt=>{const Pt=yt.data();Ge.push({owner:r.uid,title:yt.id,timestamp:Pt.timestamp,description:Pt.description,dataColoring:Pt.dataColoring,selectedProperty:Pt.selectedProperty,sortDescending:Pt.sortDescending,xAxisNameScatterPlot:Pt.xAxisNameScatterPlot,yAxisNameScatterPlot:Pt.yAxisNameScatterPlot,dotSizeScatterPlot:Pt.dotSizeScatterPlot,thumbnailWidth:Pt.thumbnailWidth,type:Pt.type,designs:Pt.designs??[],ranges:Pt.ranges??[],filters:Pt.filters??[],hiddenParameters:Pt.hiddenParameters??gd.getDefaultHiddenParameters(Pt.type),counter:Pt.counter??0})}),Ge}).catch(at=>{co(Y.t("message.CannotOpenYourProjects",Re)+": "+at)}).finally(()=>{rt||G(!1),Se(!0)}))},Oe=rt=>{r.uid&&ke(!rt).then(()=>{rt&&dt.getState().set(at=>{at.showProjectListPanel=!0})})},st=rt=>{r.uid&&$n.firestore().collection("users").doc(r.uid).collection("projects").doc(rt).delete().then(()=>{if(me.current&&r.uid){for(const at of me.current)if(at.title===rt&&at.designs){for(const Ge of at.designs)n(yt=>{Ge.title===yt.cloudFile&&(yt.cloudFile=void 0)}),$n.firestore().collection("users").doc(r.uid).collection("designs").doc(Ge.title).delete().then(()=>{}).catch(yt=>{co(Y.t("message.CannotDeleteCloudFile",Re)+": "+yt)});Se(!0);break}me.current=me.current.filter(at=>at.title!==rt),$(!q)}n(at=>{rt===at.projectState.title&&(at.projectState.title=null,at.projectState.description=null,at.projectState.dataColoring=d9.ALL,at.projectState.selectedProperty=null,at.projectState.sortDescending=!1,at.projectState.xAxisNameScatterPlot=null,at.projectState.yAxisNameScatterPlot=null,at.projectState.dotSizeScatterPlot=5,at.projectState.thumbnailWidth=200,at.projectState.counter=0,at.projectState.designs=[],at.projectState.ranges=[],at.projectState.filters=[],at.projectState.hiddenParameters=gd.getDefaultHiddenParameters(at.projectState.type),at.designProjectType=null,at.projectView=!1)})}).catch(at=>{co(Y.t("message.CannotDeleteProject",Re)+": "+at)})},je=(rt,at)=>{const Ge=r.uid;Ge&&zae(Ge,at,yt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+yt)}).then(yt=>{if(yt)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else{const Pt=$n.firestore().collection("users").doc(Ge).collection("projects");Pt.doc(rt).get().then(ot=>{if(ot.exists){const bt=ot.data();if(bt){const zt={...bt};if(bt.designs&&bt.designs.length>0){const Bt=OCe(at,bt.designs)??[];for(const[tt,Ht]of bt.designs.entries())VCe(Ht.title,Bt[tt].title,bt.owner,Ge);zt.designs=Bt,n(tt=>{tt.projectState.designs=Bt})}Pt.doc(at).set(zt).then(()=>{if(Pt.doc(rt).delete().then(()=>{}),me.current){const Bt=[];for(const tt of me.current)tt.title===rt?Bt.push({owner:tt.owner,timestamp:tt.timestamp,title:at,description:tt.description,type:tt.type,designs:tt.designs,ranges:tt.ranges??null,filters:tt.filters??null,hiddenParameters:tt.hiddenParameters,counter:tt.counter}):Bt.push(tt);me.current=Bt,$(!q),Se(!0)}n(Bt=>{Bt.projectState.title===rt&&(Bt.projectState.title=at)})})}}}).catch(ot=>{co(Y.t("message.CannotRenameProject",Re)+": "+ot)})}})},xt=rt=>{n(at=>{at.projectState={...rt},at.projectImages.clear(),at.projectView=!0}),dt.getState().set(at=>{at.projectImagesUpdateFlag=!at.projectImagesUpdateFlag,at.updateProjectsFlag=!0})},gt=(rt,at)=>{rt&&at&&(G(!0),QX(rt,at,!0,!0,t).finally(()=>{G(!1)}))},Ye=(rt,at,Ge,yt)=>{if(!r.uid||!e)return;const Pt=ye.resizeCanvas(e,yt).toDataURL(),ot=Xnt(rt,Ge,Pt);$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).update({designs:$n.firestore.FieldValue.arrayUnion(ot),counter:$n.firestore.FieldValue.increment(1)}).then(()=>{n(bt=>{var zt;(zt=bt.projectState.designs)==null||zt.push(ot),bt.projectState.counter++,bt.designProjectType=bt.projectState.type,bt.cloudFile=ot.title}),lt(Ge,!0,!0)}).catch(bt=>{co(Y.t("message.CannotAddDesignToProject",Re)+": "+bt)}).finally(()=>{G(!1)})},it=(rt,at,Ge)=>{if(!r.uid)return;const yt=rt.trim();if(yt.length===0){co(Y.t("menu.file.SavingAbortedMustHaveValidTitle",Re)+".");return}G(!0),Ge?_Ce(r.uid,rt,Pt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Pt)}).then(Pt=>{Pt?(G(!1),yi.confirm({title:`${Y.t("message.CloudFileWithTitleExistsDoYouWantToOverwrite",Re)}`,icon:h.jsx(Zx,{}),onOk:()=>{lt(yt,at)},onCancel:()=>{n(ot=>{ot.showCloudFileTitleDialogFlag=!ot.showCloudFileTitleDialogFlag,ot.showCloudFileTitleDialog=!0})},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`})):lt(yt,at)}):lt(yt,at),Z(!1)},ut=(rt,at)=>{if(te.current.length>0){let Ge=-1;for(const[yt,Pt]of te.current.entries())if(Pt.title===at){Ge=yt,XCe(rt,Pt).then(()=>{});break}Ge!==-1&&te.current.splice(Ge,1)}},Qe=(rt,at,Ge)=>{if(te.current.length>0){let yt=-1,Pt=null,ot=null;for(const[bt,zt]of te.current.entries())if(zt.title===at){yt=bt,Pt={title:at,timestamp:zt.timestamp},ot={title:Ge,timestamp:zt.timestamp};break}if(yt!==-1&&ot&&Pt){te.current.splice(yt,1),te.current.push(ot);const bt=ot;XCe(rt,Pt).then(()=>{GCe(rt,bt).then(()=>{})})}}},lt=(rt,at,Ge)=>{const yt=r.uid;if(yt)try{const Pt=$n.firestore().collection("users").doc(yt);if(Pt){E&&dt.getState().set(bt=>{bt.waiting=!0});const ot=Pt.collection(Ge?"designs":"files").doc(rt);ot.set(c()).then(()=>{if(at||(n(bt=>{bt.cloudFile=rt}),dt.getState().setChanged(!1)),E)E==="CREATE_NEW_FILE"?H():R(E);else if(!Ge){const bt=t1+"?client=web&userid="+yt+"&title="+encodeURIComponent(rt);window.history.pushState({},document.title,bt)}ot.get().then(bt=>{const zt=bt.data();if(zt&&te.current.length>0){ut(yt,rt);const Bt={timestamp:zt.timestamp,title:rt};te.current.push(Bt),GCe(yt,Bt).then(()=>{}),pe(!0)}})}).catch(bt=>{co(Y.t("message.CannotSaveYourFileToCloud",Re)+": "+bt)}).finally(()=>{G(!1)})}}catch(Pt){co(Y.t("message.CannotSaveYourFileToCloud",Re)+": "+Pt),G(!1)}},Ze=(rt,at)=>{F?yi.confirm({title:`${Y.t("message.DoYouWantToSaveChanges",Re)}`,icon:h.jsx(ny,{}),onOk:()=>{A?(it(A,!0,!1),$e(rt,at)):n(Ge=>{Ge.showCloudFileTitleDialogFlag=!Ge.showCloudFileTitleDialogFlag,Ge.showCloudFileTitleDialog=!0})},onCancel:()=>{$e(rt,at)},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`}):$e(rt,at)},Be=rt=>{F?yi.confirm({title:`${Y.t("message.DoYouWantToSaveChanges",Re)}`,icon:h.jsx(ny,{}),onOk:()=>{A?(it(A,!0,!1),$e(rt.userid,rt.title),Ee(rt)):n(at=>{at.showCloudFileTitleDialogFlag=!at.showCloudFileTitleDialogFlag,at.showCloudFileTitleDialog=!0})},onCancel:()=>{$e(rt.userid,rt.title),Ee(rt)},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`}):($e(rt.userid,rt.title),Ee(rt))},$e=(rt,at,Ge)=>{rt&&at&&(G(!0),QX(rt,at,!1,Ge,t).finally(()=>{G(!1)}))},wt=async rt=>{const at=r.uid;at&&(G(!0),te.current=[],await $n.firestore().collection("users").doc(at).get().then(async Ge=>{var Pt,ot;const yt=(Pt=Ge.data())==null?void 0:Pt.fileList;!rt&&yt&&yt.length>0?(ot=te.current)==null||ot.push(...yt):await $n.firestore().collection("users").doc(at).collection("files").get().then(bt=>{bt.forEach(zt=>{var tt;const Bt=zt.data();(tt=te.current)==null||tt.push({timestamp:Bt.timestamp,title:zt.id})})}).catch(bt=>{co(Y.t("message.CannotOpenCloudFolder",Re)+": "+bt)}).finally(()=>{$n.firestore().collection("users").doc(at).update({fileList:te.current}).then(()=>{}).catch(bt=>{console.log(bt)})})}).finally(()=>{G(!1),pe(!0)}))},vt=(rt,at)=>{$n.firestore().collection("users").doc(rt).collection("files").doc(at).delete().then(()=>{ut(rt,at),de(oe.filter(Ge=>Ge.title!==at)),n(Ge=>{at===Ge.cloudFile&&(Ge.cloudFile=void 0)})}).catch(Ge=>{co(Y.t("message.CannotDeleteCloudFile",Re)+": "+Ge)})},Rt=(rt,at,Ge)=>{_Ce(rt,Ge,yt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+yt)}).then(yt=>{if(yt)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+Ge);else{const Pt=$n.firestore().collection("users").doc(rt).collection("files");Pt.doc(at).get().then(ot=>{if(ot.exists){const bt=ot.data();bt&&Pt.doc(Ge).set(bt).then(()=>{Pt.doc(at).delete().then(()=>{}).catch(Bt=>{co(Y.t("message.CannotDeleteCloudFile",Re)+" "+at+": "+Bt)});for(const Bt of oe)if(Bt.title===at){Bt.title=Ge;break}de([...oe]),Qe(rt,at,Ge),n(Bt=>{Bt.cloudFile===at&&(Bt.cloudFile=Ge)});const zt=new URLSearchParams(window.location.search);if(zt.get("title")===at&&zt.get("userid")===r.uid){const Bt=t1+"?client=web&userid="+r.uid+"&title="+encodeURIComponent(Ge);window.history.pushState({},document.title,Bt)}})}}).catch(ot=>{co(Y.t("message.CannotRenameCloudFile",Re)+": "+ot)})}})};function Gt(){A&&(it(A,!1,!1),Q(A))}function At(){ze().then(()=>{Ne().then(()=>{})})}function pt(){Je().then(()=>{Ne().then(()=>{})})}function Wt(){if(r&&r.uid&&ie){const rt=new URLSearchParams(window.location.search);if(rt.get("userid")===r.uid&&rt.get("title")===ie){const at={latitude:i,longitude:a,address:l??null,countryCode:s??null,type:M.getState().modelType,author:M.getState().modelAuthor??r.displayName,userid:r.uid,title:ie,label:M.getState().modelLabel,description:M.getState().modelDescription,timeCreated:Date.now()},Ge=ye.getModelKey(at),yt=$n.firestore().collection("models");if(yt){const Pt=$n.storage().ref();e&&ye.resizeCanvas(e,200).toBlob(bt=>{if(bt){const zt={contentType:"image/png"},Bt=Pt.child("images/"+Ge+".png").put(bt,zt);Bt.on($n.storage.TaskEvent.STATE_CHANGED,tt=>{const Ht=tt.bytesTransferred/tt.totalBytes*100;Ht>0&&gn(Y.t("word.Upload",Re)+": "+Ht+"%")},tt=>{co("Storage: "+tt)},()=>{Bt.snapshot.ref.getDownloadURL().then(tt=>{const Ht={...at,thumbnailUrl:tt},_t=yt.doc(ye.getLatLngKey(i,a));_t.get().then(qt=>{if(qt.exists){const un=qt.data();un&&un[Ge]?_t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.UpdatedOnModelsMap",Re)+".")}):_t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.PublishedOnModelsMap",Re)+".")})}else _t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.PublishedOnModelsMap",Re)+".")})}).catch(qt=>{co(Y.t("message.CannotPublishModelOnMap",Re)+": "+qt)}),$n.firestore().collection("board").doc("people").update({[(Ht.author??"Anonymous")+"."+ye.getModelKey(Ht)]:Ht}).then(()=>{n(qt=>{if(qt.peopleModels){const un=qt.peopleModels.get(Ht.author??"Anonymous");un&&un.set(ye.getModelKey(Ht),Ht)}})}),$n.firestore().collection("board").doc("info").set({latestModel:Ht},{merge:!0}).then(()=>{})})})}})}$n.firestore().collection("users").doc(r.uid).update(M.getState().modelAuthor===r.displayName?{published:$n.firestore.FieldValue.arrayUnion(ie)}:{published:$n.firestore.FieldValue.arrayUnion(ie),aliases:$n.firestore.FieldValue.arrayUnion(M.getState().modelAuthor)}).then(()=>{n(Pt=>{Pt.user&&(Pt.user.published||(Pt.user.published=[]),Pt.user.published.includes(ie)||Pt.user.published.push(ie),Pt.user.aliases||(Pt.user.aliases=[]),Pt.modelAuthor&&!Pt.user.aliases.includes(Pt.modelAuthor)&&Pt.modelAuthor!==r.displayName&&Pt.user.aliases.push(Pt.modelAuthor))})})}}}function ht(){if(!r||!r.uid)return;const rt=dt.getState().projectTitle;if(!rt){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}const at=rt.trim();if(at.length===0){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}zae(r.uid,at,Ge=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Ge)}).then(Ge=>{if(Ge)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else if(r&&r.uid){const yt=dt.getState().projectType??Ri.SOLAR_PANEL_ARRAY,Pt=dt.getState().projectDescription??null,ot=new Date().getTime();$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).set({owner:r.uid,timestamp:ot,type:yt,description:Pt,counter:0,designs:[],hiddenParameters:gd.getDefaultHiddenParameters(yt)}).then(()=>{n(zt=>{zt.projectView=!0,zt.projectState.owner=r.uid,zt.projectState.type=yt,zt.projectState.title=rt,zt.projectState.description=Pt,zt.projectState.counter=0,zt.projectState.dataColoring=d9.ALL,zt.projectState.selectedProperty=null,zt.projectState.sortDescending=!1,zt.projectState.xAxisNameScatterPlot=null,zt.projectState.yAxisNameScatterPlot=null,zt.projectState.dotSizeScatterPlot=5,zt.projectState.thumbnailWidth=200,zt.projectState.designs=[],zt.projectState.ranges=[],zt.projectState.filters=[],zt.projectState.hiddenParameters=gd.getDefaultHiddenParameters(zt.projectState.type)})}).catch(zt=>{co(Y.t("message.CannotCreateNewProject",Re)+": "+zt)}).finally(()=>{d&&ke(!1).then(()=>{$(!q)}),G(!1)})}}).finally(()=>{G(!1)})}function ct(){if(!r||!r.uid)return;const rt=dt.getState().projectTitle;if(!rt){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}const at=rt.trim();if(at.length===0){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}zae(r.uid,at,Ge=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Ge)}).then(Ge=>{if(Ge)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else if(r&&r.uid){const yt=M.getState().projectState.designs;if(yt){const Pt=dt.getState().projectType,ot=dt.getState().projectDescription,bt=M.getState().projectState.owner,zt=new Date().getTime(),Bt=M.getState().projectState.counter,tt=M.getState().projectState.dataColoring??null,Ht=M.getState().projectState.selectedProperty??null,_t=!!M.getState().projectState.sortDescending,qt=M.getState().projectState.xAxisNameScatterPlot??"rowWidth",un=M.getState().projectState.yAxisNameScatterPlot??"rowWidth",Rn=M.getState().projectState.dotSizeScatterPlot??5,yo=M.getState().projectState.thumbnailWidth??200,Ao=OCe(at,yt)??[];for(const[Io,po]of yt.entries())VCe(po.title,Ao[Io].title,bt,r.uid);const wo=M.getState().projectImages;if(wo&&wo.size>0){for(const[Io,po]of yt.entries()){const On=wo.get(po.title);On&&(Ao[Io].thumbnail=tXn(On))}$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).set({owner:r.uid,timestamp:zt,type:Pt,description:ot,counter:Bt,dataColoring:tt,selectedProperty:Ht,sortDescending:_t,xAxisNameScatterPlot:qt,yAxisNameScatterPlot:un,dotSizeScatterPlot:Rn,thumbnailWidth:yo,designs:Ao,ranges:M.getState().projectState.ranges??null,filters:M.getState().projectState.filters??null,hiddenParameters:M.getState().projectState.hiddenParameters}).then(()=>{n(Io=>{Io.projectView=!0,Io.projectState.owner=r.uid,Io.projectState.type=Pt,Io.projectState.title=rt,Io.projectState.description=ot,Io.projectState.designs=Ao})}).catch(Io=>{co(Y.t("message.CannotCreateNewProject",Re)+": "+Io)}).finally(()=>{d&&ke(!1).then(()=>{$(!q)}),G(!1)})}}}})}function It(){const rt=M.getState().projectState.owner;if(r.uid!==rt)gn(Y.t("message.CannotAddDesignToProjectOwnedByOthers",Re));else{const at=M.getState().projectState.title;if(at){G(!0);const Ge=M.getState().projectState.type??Ri.SOLAR_PANEL_ARRAY,yt=M.getState().projectState.thumbnailWidth??200,Pt=M.getState().projectState.counter??0;Ye(Ge,at,at+" "+Pt,yt)}}}function Ft(){r.uid&&wt(!1).then(()=>{dt.getState().set(rt=>{rt.showCloudFilePanel=!0})})}function Ve(){r.uid&&wt(!0).then(()=>{})}function ft(){Oe(!0)}function kt(){Oe(!1),$(!q)}return t?h.jsx(h.Fragment,{children:g&&h.jsx(rIe,{openCloudFile:Be,deleteModelFromMap:Ue,likeModelFromMap:nt,pinModelFromMap:We})}):h.jsxs(h.Fragment,{children:[V&&h.jsx(YQ,{}),h.jsx(E2o,{saveToCloud:it,isLoading:()=>V,setTitle:Q,getTitle:()=>ie,setTitleDialogVisible:Z,isTitleDialogVisible:()=>se}),h.jsx(D2o,{signIn:we,signInAnonymously:ve,signOut:Ie}),u&&h.jsx(nmo,{cloudFileArray:oe,openCloudFile:rt=>{r.uid&&Ze(r.uid,rt)},deleteCloudFile:rt=>{r.uid&&vt(r.uid,rt)},renameCloudFile:(rt,at)=>{r.uid&&Rt(r.uid,rt,at)}}),d&&me.current&&h.jsx(W2o,{projects:le,setProjectState:xt,deleteProject:st,renameProject:je}),f&&h.jsx(oit,{author:void 0,models:ee.current,openCloudFile:Ze,closeCallback:()=>{o("showModelsGallery",!1),ee.current=void 0}}),p&&h.jsx(mmo,{openCloudFile:$e}),g&&h.jsx(rIe,{openCloudFile:Be,deleteModelFromMap:Ue,likeModelFromMap:nt,pinModelFromMap:We})]})});var j2o={},B2o="@firebase/database",Y2o="0.11.0";/** +`,W2o=be.memo(({projects:t,setProjectState:e,deleteProject:n,renameProject:o})=>{const r=M(yp),i=M(oa),a=M(Fge),l=M(pn),s=M(Sc),c=be.useRef(null),u=m.useRef(null),d=u.current?u.current.clientWidth+40:680,f=u.current?u.current.clientHeight+100:600,[p,g]=m.useState({x:0,y:0}),[A,y]=m.useState(!1),[S,C]=m.useState(!1),[P,v]=m.useState({left:0,top:0,bottom:0,right:0}),[T,w]=m.useState(),[x,b]=m.useState(),R=m.useRef(null),H=m.useRef([...t]),[F,E]=m.useState(!1),[N,U]=m.useState(-1),{Search:W}=jl,{t:k}=Xl(),D=$t();m.useEffect(()=>{const $=()=>{g({x:Math.max(0,d-window.innerWidth),y:Math.min(0,window.innerHeight-f)})};return window.addEventListener("resize",$),()=>{window.removeEventListener("resize",$)}},[]),m.useEffect(()=>{t&&(H.current=[...t],E(!F))},[t]);const L=($,ie)=>{g({x:Math.max(ie.x,d-window.innerWidth),y:Math.min(ie.y,window.innerHeight-f)})},j=($,ie)=>{},B=()=>{dt.getState().set($=>{$.showProjectListPanel=!1}),i&&l($=>{$.actionInfo={name:"Close Project List",timestamp:new Date().getTime()}})},O=$=>{yi.confirm({title:k("projectListPanel.DoYouReallyWantToDeleteProject",D)+' "'+$+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),k("word.Warning",D)+": "+k("message.ThisCannotBeUndone",D)]}),icon:h.jsx(Zx,{}),onOk:()=>{n($),i&&l(ie=>{ie.actionInfo={name:"Delete Project",timestamp:new Date().getTime(),details:$}})}})},V=()=>{T&&x&&(o(T,x),b(void 0),E(!F),i&&l($=>{$.actionInfo={name:"Rename Project",timestamp:new Date().getTime(),details:{oldTitle:T,newTitle:x}}})),y(!1)},G=$=>{e($),a.clear(),i&&l(ie=>{ie.actionInfo={name:"Open Project",timestamp:new Date().getTime(),details:$.title}})},q=($,ie)=>{if(R.current){const{clientWidth:Q,clientHeight:se}=window.document.documentElement,oe=R.current.getBoundingClientRect();v({left:-oe.left+ie.x,right:Q-(oe.right-ie.x),top:-oe.top+ie.y,bottom:se-((oe==null?void 0:oe.bottom)-ie.y)})}};return h.jsxs(h.Fragment,{children:[h.jsx(yi,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>C(!0),onMouseOut:()=>C(!1),children:k("word.Rename",D)}),open:A,onOk:V,onCancel:()=>{y(!1),b(void 0)},modalRender:$=>h.jsx(Bi,{disabled:!S,bounds:P,onStart:(ie,Q)=>q(ie,Q),children:h.jsx("div",{ref:R,children:$})}),children:h.jsxs(on,{direction:"vertical",style:{width:"100%"},children:[h.jsx(jl,{placeholder:"Title",value:x||T,onPressEnter:V,onKeyDown:$=>{if(!cR.test($.key))return $.preventDefault(),!1},onChange:$=>{b($.target.value)}}),h.jsxs("span",{style:{fontSize:"11px",color:"red"},children:[h.jsx(nb,{style:{marginRight:"4px"}}),k("word.Caution",D)+": "+k("projectListPanel.IfSharedOrPublishedRenamingProjectBreaksExistingLinks",D),"."]})]})}),h.jsx(Bi,{nodeRef:c,handle:".handle",bounds:"parent",axis:"both",position:p,onDrag:L,onStop:j,onMouseDown:()=>{l($=>{$.selectedFloatingWindow="projectListPanel"})},children:h.jsx(F2o,{ref:c,style:{zIndex:s==="projectListPanel"?bc:14},children:h.jsxs(k2o,{ref:u,children:[h.jsxs(L2o,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:k("projectListPanel.MyProjects",D)+" ("+H.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{B()},onTouchStart:()=>{B()},children:k("word.Close",D)})]}),h.jsx("span",{style:{direction:"ltr"},children:h.jsx(W,{style:{width:"50%",paddingTop:"8px",paddingBottom:"8px"},title:k("projectListPanel.SearchByTitle",D),allowClear:!0,size:"small",enterButton:!0,onSearch:$=>{var ie;if(t){H.current=[];for(const Q of t)(ie=Q.title)!=null&&ie.toLowerCase().includes($.toLowerCase())&&H.current.push(Q);E(!F)}}})}),h.jsxs(Dd,{size:"small",style:{width:"100%",direction:"ltr",verticalAlign:"top"},dataSource:H.current,scroll:{y:360},pagination:{defaultPageSize:10,showSizeChanger:!0,position:["bottomCenter"],pageSizeOptions:["10","20","50"]},children:[h.jsx(ole,{title:`${k("word.Title",D)}`,dataIndex:"title",width:"50%",sortDirections:["ascend","descend","ascend"],sorter:($,ie)=>$.title.localeCompare(ie.title),render:($,ie,Q)=>{const se=[{key:"project-title",label:h.jsxs(h.Fragment,{children:[h.jsx(an,{noPadding:!0,fontWeight:"bold",children:$}),h.jsx("hr",{})]})},{key:"open-project",label:h.jsx(an,{noPadding:!0,onClick:()=>G(ie),children:k("word.Open",D)})},{key:"copy-title-to-clip-board",label:h.jsx(an,{noPadding:!0,onClick:()=>{navigator.clipboard.writeText($).then(()=>{S2(k("projectListPanel.TitleCopiedToClipBoard",D)+"."),i&&l(oe=>{oe.actionInfo={name:"Copy Project Title",timestamp:new Date().getTime(),details:$}})})},children:k("projectListPanel.CopyTitle",D)})},{key:"rename-project",label:h.jsx(an,{noPadding:!0,onClick:()=>{w($),y(!0)},children:k("word.Rename",D)})},{key:"delete-project",label:h.jsx(an,{noPadding:!0,onClick:()=>O($),children:k("word.Delete",D)})},{key:"generate-project-link",label:h.jsx(an,{noPadding:!0,onClick:()=>{const oe=t1+"?client=web&userid="+r.uid+"&project="+encodeURIComponent($);navigator.clipboard.writeText(oe).then(()=>{S2(k("projectListPanel.ProjectLinkGeneratedInClipBoard",D)+"."),i&&l(Z=>{Z.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:oe}})})},children:k("projectListPanel.GenerateProjectLink",D)})}];return h.jsxs(on,{style:{width:"100%"},children:[h.jsx(rA,{menu:{items:se},trigger:["hover"],children:h.jsx(JKe,{style:{fontSize:"12px",cursor:"pointer"},onMouseEnter:()=>{Q!==void 0&&U(Q)},onMouseLeave:()=>{U(-1)}})}),h.jsx(L6.Text,{title:k("word.Open",D),style:{fontSize:"12px",cursor:"pointer",verticalAlign:"top"},onClick:()=>{const oe=window.getSelection();oe&&oe.toString().length>0||G(ie)},children:$})]})},onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"title"),h.jsx(ole,{title:`${k("word.Type",D)}`,dataIndex:"type",width:"25%",render:$=>h.jsx(L6.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:$}),onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"type"),h.jsx(ole,{title:`${k("word.Time",D)}`,dataIndex:"time",width:"25%",defaultSortOrder:"descend",sortDirections:["ascend","descend","ascend"],sorter:($,ie)=>$.timestamp-ie.timestamp,render:$=>h.jsx(L6.Text,{style:{fontSize:"12px",verticalAlign:"top"},children:$}),onCell:($,ie)=>({style:{background:N===ie?"lightskyblue":ie!==void 0&&ie%2===0?"beige":"gainsboro"}})},"time")]})]})})})]})}),N2o="/aladdin/assets/anonymous-DoSV0M20.png",ym=(t,e,n)=>{m.useEffect(()=>{t&&(e(),n())},[t])},U2o=be.memo(({viewOnly:t=!1,canvas:e})=>{const n=M(pn),o=dt(Rf),r=M(yp),i=M(s0),a=M(Mb),l=M(_q),s=M(S8t),c=M(rYe),u=dt(C7t),d=dt(U7t),f=dt(j7t),p=dt(B7t),g=dt(Gq),A=M(zb),y=dt(hwt),S=dt(pwt),C=dt(vwt),P=dt(xwt),v=dt(Swt),T=dt(Twt),w=dt(Pwt),x=M(cwt),b=M($Be),R=M(kge),H=M(iYe),F=dt(KBe),E=M(Cwt),N=M(ZBe),U=dt(gwt),W=dt(mwt),k=dt(ywt),D=dt(Awt),L=dt(wwt),j=M(tYe),B=M(nYe),O=M(eYe),[V,G]=m.useState(!1),[q,$]=m.useState(!1),[ie,Q]=m.useState(A??"My Aladdin File"),[se,oe]=m.useState(!1),Z=m.useRef(),te=m.useRef([]),[ee,de]=m.useState([]),[fe,pe]=m.useState(!1),ye=m.useRef(),[ae,Te]=m.useState([]),[ge,Se]=m.useState(!1),Re=$t();ym(y,Me,()=>o("saveAccountSettingsFlag",!1)),ym(S,Gt,()=>o("saveCloudFileFlag",!1)),ym(C,At,()=>o("modelsMapFlag",!1)),ym(P,pt,()=>o("leaderboardFlag",!1)),ym(v,Wt,()=>o("publishOnModelsMapFlag",!1)),ym(U,ht,()=>o("createProjectFlag",!1)),ym(W,ct,()=>o("saveProjectAsFlag",!1)),ym(D,ft,()=>o("showProjectsFlag",!1)),ym(L,kt,()=>o("updateProjectsFlag",!1)),ym(T,Ft,()=>o("listCloudFilesFlag",!1)),ym(w,Ve,()=>o("refreshCloudFilesFlag",!1)),ym(k,It,()=>o("curateDesignToProjectFlag",!1)),m.useEffect(()=>{const rt={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-316017.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let at=$n.apps.length===0;return $n.apps.length===1&&$n.apps[0].name===fG.LOG_DATA&&(at=!0),at?$n.initializeApp(rt):$n.app(),$n.auth().onAuthStateChanged(Ge=>{const Pt=new URLSearchParams(window.location.search).get("title");n(Ge?ot=>{ot.user&&(ot.user.uid=Ge.uid,ot.user.displayName=Ge.displayName??"Anonymous",ot.user.email=Ge.email,ot.user.photoURL=Ge.photoURL??N2o,Pe({...ot.user}).then(()=>{})),ot.cloudFile=Pt??void 0}:ot=>{ot.cloudFile=Pt??void 0})}),Ae(),window.addEventListener("popstate",De),()=>{window.removeEventListener("popstate",De)}},[]);const De=()=>{if(t)return;const rt=new URLSearchParams(window.location.search),at=rt.get("userid"),Ge=rt.get("title");at&&Ge&&$e(at,Ge,!0)};m.useEffect(()=>{r.uid&&te.current.length===0&&rXn(r.uid,te.current).then(()=>{})},[r.uid]),m.useEffect(()=>{if(fe){if(te.current.length>0&&r.uid){const rt=[];te.current.forEach((at,Ge)=>{rt.push({title:at.title,timestamp:at.timestamp})}),rt.sort((at,Ge)=>Ge.timestamp-at.timestamp),de(rt)}pe(!1)}},[fe]),m.useEffect(()=>{if(ge){if(ye.current){const rt=[];ye.current.forEach((at,Ge)=>{rt.push({key:Ge.toString(),owner:at.owner,title:at.title,time:ul(new Date(at.timestamp)).format("MM/DD/YYYY hh:mm A"),timestamp:at.timestamp,description:at.description,dataColoring:at.dataColoring,selectedProperty:at.selectedProperty,sortDescending:at.sortDescending,xAxisNameScatterPlot:at.xAxisNameScatterPlot,yAxisNameScatterPlot:at.yAxisNameScatterPlot,dotSizeScatterPlot:at.dotSizeScatterPlot,thumbnailWidth:at.thumbnailWidth,type:at.type,designs:at.designs,ranges:at.ranges??[],filters:at.filters??[],hiddenParameters:at.hiddenParameters??gd.getDefaultHiddenParameters(at.type),counter:at.counter,action:""})}),rt.sort((at,Ge)=>Ge.timestamp-at.timestamp),Te(rt)}Se(!1)}},[ge]),m.useEffect(()=>{if(Z.current=new Map,r.aliases&&r.aliases.length>0){for(const rt of r.aliases)if(rt!==r.displayName){const at=N.get(rt);at&&(Z.current=new Map([...Z.current,...at]))}}if(r.displayName){const rt=N.get(r.displayName);rt&&(Z.current=new Map([...Z.current,...rt]))}},[N,r.displayName,r.aliases]),m.useEffect(()=>{oe(x)},[b]),m.useEffect(()=>{Q(A??"My Aladdin File")},[A]);const Ae=()=>{const rt=new URLSearchParams(window.location.search),at=rt.get("userid");if(at){const Ge=rt.get("title"),yt=rt.get("project");yt?(G(!0),Gnt(at,yt,xt).finally(()=>{G(!1)}),Ge&>(at,Ge)):Ge&&$e(at,Ge)}else n(Ge=>{Ge.cloudFile=void 0});he().then(()=>{})},ue=()=>{n(rt=>{rt.objectTypeToAdd=z.None,rt.groupActionMode=!1})},he=async()=>{await $n.firestore().collection("app").doc("info").get().then(rt=>{if(rt.exists){const at=rt.data();at&&at.latestVersion&&dt.getState().set(Ge=>{Ge.latestVersion=at.latestVersion})}}).catch(rt=>{console.log(rt)})},ve=()=>{$n.auth().signInAnonymously().then(rt=>{n(at=>{rt.user&&(at.user.uid=rt.user.uid,at.user.anonymous=!0,at.user.displayName="Anonymous",Pe({...at.user}).then(()=>{}))})}).catch(rt=>{rt.code!=="auth/popup-closed-by-user"&&rt.code!=="auth/cancelled-popup-request"&&co(Y.t("message.CannotSignIn",Re)+": "+rt)}),ue()},we=()=>{const rt=new $n.auth.GoogleAuthProvider;$n.auth().signInWithPopup(rt).then(at=>{n(Ge=>{at.user&&(Ge.user.uid=at.user.uid,Ge.user.email=at.user.email,Ge.user.displayName=at.user.displayName,Ge.user.photoURL=at.user.photoURL,Pe({...Ge.user}).then(()=>{}))})}).catch(at=>{at.code!=="auth/popup-closed-by-user"&&at.code!=="auth/cancelled-popup-request"&&co(Y.t("message.CannotSignIn",Re)+": "+at)}),ue()},Pe=async rt=>{const at=$n.firestore();let Ge=!1,yt=!1,Pt=!1,ot=sc.UNKNOWN,bt=Oa.UNKNOWN,zt=[],Bt=[],tt=[],Ht=[],_t=!1,qt=0;rt.uid!==null&&(rt&&rt.email==="charles@intofuture.org"&&await at.collection("users").get().then(Rn=>{qt=Rn.size}),_t=await at.collection("users").doc(rt.uid).get().then(Rn=>{const yo=Rn.data();return yo?(Ge=!!yo.signFile,yt=!!yo.noLogging,Pt=!!yo.anonymous,ot=yo.schoolID?yo.schoolID:sc.UNKNOWN,bt=yo.classID?yo.classID:Oa.UNKNOWN,yo.fileList&&(zt=yo.fileList),yo.likes&&(Bt=yo.likes),yo.published&&(tt=yo.published),yo.aliases&&(Ht=yo.aliases),!0):!1})),_t?(n(un=>{un.user.signFile=Ge,un.user.noLogging=yt,un.user.anonymous=Pt,un.user.schoolID=ot,un.user.classID=bt,un.user.fileList=zt,un.user.likes=Bt,un.user.published=tt,un.user.aliases=Ht}),dt.getState().set(un=>{un.userCount=qt}),rt.signFile=Ge,rt.noLogging=yt,rt.anonymous=Pt,rt.schoolID=ot,rt.classID=bt,rt.fileList=zt,rt.likes=Bt,rt.published=tt,rt.aliases=Ht):rt.uid&&at.collection("users").doc(rt.uid).set({uid:rt.uid,anonymous:!!rt.anonymous,signFile:!!rt.signFile,noLogging:!!rt.noLogging,schoolID:rt.schoolID??sc.UNKNOWN,classID:rt.classID??Oa.UNKNOWN,since:ul(new Date).format("MM/DD/YYYY hh:mm A"),os:me.getOS()}).then(()=>{gn(Y.t("message.YourAccountWasCreated",Re))}).catch(un=>{co(Y.t("message.CannotCreateAccount",Re)+": "+un)})},Ie=()=>{$n.auth().signOut().then(()=>{n(rt=>{rt.user.uid=null,rt.user.email=null,rt.user.displayName=null,rt.user.photoURL=null,rt.user.signFile=!1,rt.user.fileList=[],rt.user.likes=[],rt.user.published=[],rt.user.aliases=[],rt.cloudFile=void 0}),dt.getState().set(rt=>{rt.showCloudFilePanel=!1,rt.showAccountSettingsPanel=!1,rt.showModelsGallery=!1,rt.showProjectListPanel=!1})}).catch(rt=>{co(Y.t("message.CannotSignOut",Re)+": "+rt)})};function Me(){r.uid&&$n.firestore().collection("users").doc(r.uid).update({signFile:!!r.signFile,schoolID:r.schoolID??sc.UNKNOWN,classID:r.classID??Oa.UNKNOWN}).then(()=>{gn(Y.t("message.YourAccountSettingsWereSaved",Re))}).catch(at=>{co(Y.t("message.CannotSaveYourAccountSettings",Re)+": "+at)})}const ze=async()=>{G(!0);const rt=ul(j).toDate().getTime(),at=ul(B).toDate().getTime();await $n.firestore().collection("models").get().then(Ge=>{const yt=new Map,Pt=new Map;return Ge.forEach(ot=>{var zt;const bt=ot.data();if(bt){const Bt=new Map,tt=new Map;for(const Ht in bt){if(bt[Ht].countryCode||(zt=bt[Ht].address)!=null&&zt.endsWith("USA")&&(bt[Ht].countryCode="US"),O)Bt.set(Ht,bt[Ht]);else{const _t=bt[Ht].timeCreated;(_t===void 0||_t>=rt&&_t<=at)&&Bt.set(Ht,bt[Ht])}tt.set(Ht,bt[Ht])}Bt.size>0&&yt.set(ot.id,Bt),tt.size>0&&Pt.set(ot.id,tt)}}),n(ot=>{ot.modelSites=yt,ot.allModelSites=Pt}),yt}).catch(Ge=>{co(Y.t("message.CannotLoadModelsOnMap",Re)+": "+Ge)}).finally(()=>{G(!1)})},Ne=async()=>{await $n.firestore().collection("board").doc("info").get().then(rt=>{if(rt.exists){const at=rt.data();at&&at.latestModel&&n(Ge=>{var ot;let yt=!1;const Pt=at.latestModel;Pt.author&&(yt=!!((ot=Ge.peopleModels.get(Pt.author))!=null&&ot.get(me.getModelKey(Pt)))),Ge.latestModelSite=yt?Pt:void 0})}}).catch(rt=>{console.log(rt)})},Je=async()=>{G(!0);const rt=ul(j).toDate().getTime(),at=ul(B).toDate().getTime();await $n.firestore().collection("board").doc("people").get().then(Ge=>{const yt=Ge.data();if(yt){const Pt=new Map,ot=new Map;for(const bt in yt){if(O)Pt.set(bt,new Map(Object.entries(yt[bt])));else{const zt=new Map;for(const Bt of Object.entries(yt[bt])){const tt=Bt[1].timeCreated;(tt===void 0||tt>=rt&&tt<=at)&&zt.set(Bt[0],Bt[1])}zt.size>0&&Pt.set(bt,zt)}ot.set(bt,new Map(Object.entries(yt[bt])))}n(bt=>{bt.peopleModels=Pt,bt.allPeopleModels=ot})}}).catch(Ge=>{co(Y.t("message.CannotLoadLeaderboard",Re)+": "+Ge)}).finally(()=>{G(!1)})},Ue=(rt,at)=>{r&&r.uid&&($n.firestore().collection("models").doc(me.getLatLngKey(rt.latitude,rt.longitude)).update({[me.getModelKey(rt)]:$n.firestore.FieldValue.delete()}).then(()=>{S2(Y.t("message.ModelDeletedFromMap",Re)),at&&at()}).catch(Ge=>{co(Y.t("message.CannotDeleteModelFromMap",Re)+": "+Ge)}),$n.firestore().collection("board").doc("people").update({[(rt.author??"Anonymous")+"."+me.getModelKey(rt)]:$n.firestore.FieldValue.delete()}).then(()=>{n(Ge=>{Ge.peopleModels&&(Ge.peopleModels.delete(me.getModelKey(rt)),dt.getState().set(yt=>{yt.leaderboardFlag=!0}))})}),$n.firestore().collection("users").doc(r.uid).update({published:$n.firestore.FieldValue.arrayRemove(rt.title)}).then(()=>{n(Ge=>{if(Ge.user&&Ge.user.published&&Ge.user.published.includes(rt.title)){const yt=Ge.user.published.indexOf(rt.title);yt>=0&&Ge.user.published.splice(yt,1)}})}))},nt=(rt,at,Ge)=>{if(r&&r.uid){const yt=me.getModelKey(rt);$n.firestore().collection("users").doc(r.uid).update(at?{likes:$n.firestore.FieldValue.arrayUnion(yt)}:{likes:$n.firestore.FieldValue.arrayRemove(yt)}).then(()=>{}).catch(ot=>{co(Y.t("message.CannotLikeModelFromMap",Re)+": "+ot)});const Pt=yt+".likeCount";$n.firestore().collection("models").doc(me.getLatLngKey(rt.latitude,rt.longitude)).update(at?{[Pt]:$n.firestore.FieldValue.increment(1)}:{[Pt]:$n.firestore.FieldValue.increment(-1)}).then(()=>{Ge&&Ge()}).catch(ot=>{co(Y.t("message.CannotLikeModelFromMap",Re)+": "+ot)})}},We=(rt,at,Ge)=>{r&&r.uid&&$n.firestore().collection("models").doc(me.getLatLngKey(rt.latitude,rt.longitude)).update({[me.getModelKey(rt)+".pinned"]:at}).then(()=>{Ge&&Ge()}).catch(()=>{})},Ee=rt=>{r&&r.uid&&$n.firestore().collection("models").doc(me.getLatLngKey(rt.latitude,rt.longitude)).update({[me.getModelKey(rt)+".clickCount"]:$n.firestore.FieldValue.increment(1)}).then(()=>{}).catch(()=>{})},ke=async rt=>{r.uid&&(rt||G(!0),ye.current=await $n.firestore().collection("users").doc(r.uid).collection("projects").get().then(at=>{const Ge=[];return at.forEach(yt=>{const Pt=yt.data();Ge.push({owner:r.uid,title:yt.id,timestamp:Pt.timestamp,description:Pt.description,dataColoring:Pt.dataColoring,selectedProperty:Pt.selectedProperty,sortDescending:Pt.sortDescending,xAxisNameScatterPlot:Pt.xAxisNameScatterPlot,yAxisNameScatterPlot:Pt.yAxisNameScatterPlot,dotSizeScatterPlot:Pt.dotSizeScatterPlot,thumbnailWidth:Pt.thumbnailWidth,type:Pt.type,designs:Pt.designs??[],ranges:Pt.ranges??[],filters:Pt.filters??[],hiddenParameters:Pt.hiddenParameters??gd.getDefaultHiddenParameters(Pt.type),counter:Pt.counter??0})}),Ge}).catch(at=>{co(Y.t("message.CannotOpenYourProjects",Re)+": "+at)}).finally(()=>{rt||G(!1),Se(!0)}))},Oe=rt=>{r.uid&&ke(!rt).then(()=>{rt&&dt.getState().set(at=>{at.showProjectListPanel=!0})})},st=rt=>{r.uid&&$n.firestore().collection("users").doc(r.uid).collection("projects").doc(rt).delete().then(()=>{if(ye.current&&r.uid){for(const at of ye.current)if(at.title===rt&&at.designs){for(const Ge of at.designs)n(yt=>{Ge.title===yt.cloudFile&&(yt.cloudFile=void 0)}),$n.firestore().collection("users").doc(r.uid).collection("designs").doc(Ge.title).delete().then(()=>{}).catch(yt=>{co(Y.t("message.CannotDeleteCloudFile",Re)+": "+yt)});Se(!0);break}ye.current=ye.current.filter(at=>at.title!==rt),$(!q)}n(at=>{rt===at.projectState.title&&(at.projectState.title=null,at.projectState.description=null,at.projectState.dataColoring=d9.ALL,at.projectState.selectedProperty=null,at.projectState.sortDescending=!1,at.projectState.xAxisNameScatterPlot=null,at.projectState.yAxisNameScatterPlot=null,at.projectState.dotSizeScatterPlot=5,at.projectState.thumbnailWidth=200,at.projectState.counter=0,at.projectState.designs=[],at.projectState.ranges=[],at.projectState.filters=[],at.projectState.hiddenParameters=gd.getDefaultHiddenParameters(at.projectState.type),at.designProjectType=null,at.projectView=!1)})}).catch(at=>{co(Y.t("message.CannotDeleteProject",Re)+": "+at)})},je=(rt,at)=>{const Ge=r.uid;Ge&&zae(Ge,at,yt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+yt)}).then(yt=>{if(yt)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else{const Pt=$n.firestore().collection("users").doc(Ge).collection("projects");Pt.doc(rt).get().then(ot=>{if(ot.exists){const bt=ot.data();if(bt){const zt={...bt};if(bt.designs&&bt.designs.length>0){const Bt=OCe(at,bt.designs)??[];for(const[tt,Ht]of bt.designs.entries())VCe(Ht.title,Bt[tt].title,bt.owner,Ge);zt.designs=Bt,n(tt=>{tt.projectState.designs=Bt})}Pt.doc(at).set(zt).then(()=>{if(Pt.doc(rt).delete().then(()=>{}),ye.current){const Bt=[];for(const tt of ye.current)tt.title===rt?Bt.push({owner:tt.owner,timestamp:tt.timestamp,title:at,description:tt.description,type:tt.type,designs:tt.designs,ranges:tt.ranges??null,filters:tt.filters??null,hiddenParameters:tt.hiddenParameters,counter:tt.counter}):Bt.push(tt);ye.current=Bt,$(!q),Se(!0)}n(Bt=>{Bt.projectState.title===rt&&(Bt.projectState.title=at)})})}}}).catch(ot=>{co(Y.t("message.CannotRenameProject",Re)+": "+ot)})}})},xt=rt=>{n(at=>{at.projectState={...rt},at.projectImages.clear(),at.projectView=!0}),dt.getState().set(at=>{at.projectImagesUpdateFlag=!at.projectImagesUpdateFlag,at.updateProjectsFlag=!0})},gt=(rt,at)=>{rt&&at&&(G(!0),QX(rt,at,!0,!0,t).finally(()=>{G(!1)}))},Ye=(rt,at,Ge,yt)=>{if(!r.uid||!e)return;const Pt=me.resizeCanvas(e,yt).toDataURL(),ot=Xnt(rt,Ge,Pt);$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).update({designs:$n.firestore.FieldValue.arrayUnion(ot),counter:$n.firestore.FieldValue.increment(1)}).then(()=>{n(bt=>{var zt;(zt=bt.projectState.designs)==null||zt.push(ot),bt.projectState.counter++,bt.designProjectType=bt.projectState.type,bt.cloudFile=ot.title}),lt(Ge,!0,!0)}).catch(bt=>{co(Y.t("message.CannotAddDesignToProject",Re)+": "+bt)}).finally(()=>{G(!1)})},it=(rt,at,Ge)=>{if(!r.uid)return;const yt=rt.trim();if(yt.length===0){co(Y.t("menu.file.SavingAbortedMustHaveValidTitle",Re)+".");return}G(!0),Ge?_Ce(r.uid,rt,Pt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Pt)}).then(Pt=>{Pt?(G(!1),yi.confirm({title:`${Y.t("message.CloudFileWithTitleExistsDoYouWantToOverwrite",Re)}`,icon:h.jsx(Zx,{}),onOk:()=>{lt(yt,at)},onCancel:()=>{n(ot=>{ot.showCloudFileTitleDialogFlag=!ot.showCloudFileTitleDialogFlag,ot.showCloudFileTitleDialog=!0})},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`})):lt(yt,at)}):lt(yt,at),oe(!1)},ut=(rt,at)=>{if(te.current.length>0){let Ge=-1;for(const[yt,Pt]of te.current.entries())if(Pt.title===at){Ge=yt,XCe(rt,Pt).then(()=>{});break}Ge!==-1&&te.current.splice(Ge,1)}},Qe=(rt,at,Ge)=>{if(te.current.length>0){let yt=-1,Pt=null,ot=null;for(const[bt,zt]of te.current.entries())if(zt.title===at){yt=bt,Pt={title:at,timestamp:zt.timestamp},ot={title:Ge,timestamp:zt.timestamp};break}if(yt!==-1&&ot&&Pt){te.current.splice(yt,1),te.current.push(ot);const bt=ot;XCe(rt,Pt).then(()=>{GCe(rt,bt).then(()=>{})})}}},lt=(rt,at,Ge)=>{const yt=r.uid;if(yt)try{const Pt=$n.firestore().collection("users").doc(yt);if(Pt){E&&dt.getState().set(bt=>{bt.waiting=!0});const ot=Pt.collection(Ge?"designs":"files").doc(rt);ot.set(c()).then(()=>{if(at||(n(bt=>{bt.cloudFile=rt}),dt.getState().setChanged(!1)),E)E==="CREATE_NEW_FILE"?H():R(E);else if(!Ge){const bt=t1+"?client=web&userid="+yt+"&title="+encodeURIComponent(rt);window.history.pushState({},document.title,bt)}ot.get().then(bt=>{const zt=bt.data();if(zt&&te.current.length>0){ut(yt,rt);const Bt={timestamp:zt.timestamp,title:rt};te.current.push(Bt),GCe(yt,Bt).then(()=>{}),pe(!0)}})}).catch(bt=>{co(Y.t("message.CannotSaveYourFileToCloud",Re)+": "+bt)}).finally(()=>{G(!1)})}}catch(Pt){co(Y.t("message.CannotSaveYourFileToCloud",Re)+": "+Pt),G(!1)}},Ze=(rt,at)=>{F?yi.confirm({title:`${Y.t("message.DoYouWantToSaveChanges",Re)}`,icon:h.jsx(ny,{}),onOk:()=>{A?(it(A,!0,!1),$e(rt,at)):n(Ge=>{Ge.showCloudFileTitleDialogFlag=!Ge.showCloudFileTitleDialogFlag,Ge.showCloudFileTitleDialog=!0})},onCancel:()=>{$e(rt,at)},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`}):$e(rt,at)},Be=rt=>{F?yi.confirm({title:`${Y.t("message.DoYouWantToSaveChanges",Re)}`,icon:h.jsx(ny,{}),onOk:()=>{A?(it(A,!0,!1),$e(rt.userid,rt.title),Ee(rt)):n(at=>{at.showCloudFileTitleDialogFlag=!at.showCloudFileTitleDialogFlag,at.showCloudFileTitleDialog=!0})},onCancel:()=>{$e(rt.userid,rt.title),Ee(rt)},okText:`${Y.t("word.Yes",Re)}`,cancelText:`${Y.t("word.No",Re)}`}):($e(rt.userid,rt.title),Ee(rt))},$e=(rt,at,Ge)=>{rt&&at&&(G(!0),QX(rt,at,!1,Ge,t).finally(()=>{G(!1)}))},wt=async rt=>{const at=r.uid;at&&(G(!0),te.current=[],await $n.firestore().collection("users").doc(at).get().then(async Ge=>{var Pt,ot;const yt=(Pt=Ge.data())==null?void 0:Pt.fileList;!rt&&yt&&yt.length>0?(ot=te.current)==null||ot.push(...yt):await $n.firestore().collection("users").doc(at).collection("files").get().then(bt=>{bt.forEach(zt=>{var tt;const Bt=zt.data();(tt=te.current)==null||tt.push({timestamp:Bt.timestamp,title:zt.id})})}).catch(bt=>{co(Y.t("message.CannotOpenCloudFolder",Re)+": "+bt)}).finally(()=>{$n.firestore().collection("users").doc(at).update({fileList:te.current}).then(()=>{}).catch(bt=>{console.log(bt)})})}).finally(()=>{G(!1),pe(!0)}))},vt=(rt,at)=>{$n.firestore().collection("users").doc(rt).collection("files").doc(at).delete().then(()=>{ut(rt,at),de(ee.filter(Ge=>Ge.title!==at)),n(Ge=>{at===Ge.cloudFile&&(Ge.cloudFile=void 0)})}).catch(Ge=>{co(Y.t("message.CannotDeleteCloudFile",Re)+": "+Ge)})},Rt=(rt,at,Ge)=>{_Ce(rt,Ge,yt=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+yt)}).then(yt=>{if(yt)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+Ge);else{const Pt=$n.firestore().collection("users").doc(rt).collection("files");Pt.doc(at).get().then(ot=>{if(ot.exists){const bt=ot.data();bt&&Pt.doc(Ge).set(bt).then(()=>{Pt.doc(at).delete().then(()=>{}).catch(Bt=>{co(Y.t("message.CannotDeleteCloudFile",Re)+" "+at+": "+Bt)});for(const Bt of ee)if(Bt.title===at){Bt.title=Ge;break}de([...ee]),Qe(rt,at,Ge),n(Bt=>{Bt.cloudFile===at&&(Bt.cloudFile=Ge)});const zt=new URLSearchParams(window.location.search);if(zt.get("title")===at&&zt.get("userid")===r.uid){const Bt=t1+"?client=web&userid="+r.uid+"&title="+encodeURIComponent(Ge);window.history.pushState({},document.title,Bt)}})}}).catch(ot=>{co(Y.t("message.CannotRenameCloudFile",Re)+": "+ot)})}})};function Gt(){A&&(it(A,!1,!1),Q(A))}function At(){ze().then(()=>{Ne().then(()=>{})})}function pt(){Je().then(()=>{Ne().then(()=>{})})}function Wt(){if(r&&r.uid&&ie){const rt=new URLSearchParams(window.location.search);if(rt.get("userid")===r.uid&&rt.get("title")===ie){const at={latitude:i,longitude:a,address:l??null,countryCode:s??null,type:M.getState().modelType,author:M.getState().modelAuthor??r.displayName,userid:r.uid,title:ie,label:M.getState().modelLabel,description:M.getState().modelDescription,timeCreated:Date.now()},Ge=me.getModelKey(at),yt=$n.firestore().collection("models");if(yt){const Pt=$n.storage().ref();e&&me.resizeCanvas(e,200).toBlob(bt=>{if(bt){const zt={contentType:"image/png"},Bt=Pt.child("images/"+Ge+".png").put(bt,zt);Bt.on($n.storage.TaskEvent.STATE_CHANGED,tt=>{const Ht=tt.bytesTransferred/tt.totalBytes*100;Ht>0&&gn(Y.t("word.Upload",Re)+": "+Ht+"%")},tt=>{co("Storage: "+tt)},()=>{Bt.snapshot.ref.getDownloadURL().then(tt=>{const Ht={...at,thumbnailUrl:tt},_t=yt.doc(me.getLatLngKey(i,a));_t.get().then(qt=>{if(qt.exists){const un=qt.data();un&&un[Ge]?_t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.UpdatedOnModelsMap",Re)+".")}):_t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.PublishedOnModelsMap",Re)+".")})}else _t.set({[Ge]:Ht},{merge:!0}).then(()=>{S2(Y.t("menu.file.PublishedOnModelsMap",Re)+".")})}).catch(qt=>{co(Y.t("message.CannotPublishModelOnMap",Re)+": "+qt)}),$n.firestore().collection("board").doc("people").update({[(Ht.author??"Anonymous")+"."+me.getModelKey(Ht)]:Ht}).then(()=>{n(qt=>{if(qt.peopleModels){const un=qt.peopleModels.get(Ht.author??"Anonymous");un&&un.set(me.getModelKey(Ht),Ht)}})}),$n.firestore().collection("board").doc("info").set({latestModel:Ht},{merge:!0}).then(()=>{})})})}})}$n.firestore().collection("users").doc(r.uid).update(M.getState().modelAuthor===r.displayName?{published:$n.firestore.FieldValue.arrayUnion(ie)}:{published:$n.firestore.FieldValue.arrayUnion(ie),aliases:$n.firestore.FieldValue.arrayUnion(M.getState().modelAuthor)}).then(()=>{n(Pt=>{Pt.user&&(Pt.user.published||(Pt.user.published=[]),Pt.user.published.includes(ie)||Pt.user.published.push(ie),Pt.user.aliases||(Pt.user.aliases=[]),Pt.modelAuthor&&!Pt.user.aliases.includes(Pt.modelAuthor)&&Pt.modelAuthor!==r.displayName&&Pt.user.aliases.push(Pt.modelAuthor))})})}}}function ht(){if(!r||!r.uid)return;const rt=dt.getState().projectTitle;if(!rt){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}const at=rt.trim();if(at.length===0){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}zae(r.uid,at,Ge=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Ge)}).then(Ge=>{if(Ge)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else if(r&&r.uid){const yt=dt.getState().projectType??Ri.SOLAR_PANEL_ARRAY,Pt=dt.getState().projectDescription??null,ot=new Date().getTime();$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).set({owner:r.uid,timestamp:ot,type:yt,description:Pt,counter:0,designs:[],hiddenParameters:gd.getDefaultHiddenParameters(yt)}).then(()=>{n(zt=>{zt.projectView=!0,zt.projectState.owner=r.uid,zt.projectState.type=yt,zt.projectState.title=rt,zt.projectState.description=Pt,zt.projectState.counter=0,zt.projectState.dataColoring=d9.ALL,zt.projectState.selectedProperty=null,zt.projectState.sortDescending=!1,zt.projectState.xAxisNameScatterPlot=null,zt.projectState.yAxisNameScatterPlot=null,zt.projectState.dotSizeScatterPlot=5,zt.projectState.thumbnailWidth=200,zt.projectState.designs=[],zt.projectState.ranges=[],zt.projectState.filters=[],zt.projectState.hiddenParameters=gd.getDefaultHiddenParameters(zt.projectState.type)})}).catch(zt=>{co(Y.t("message.CannotCreateNewProject",Re)+": "+zt)}).finally(()=>{d&&ke(!1).then(()=>{$(!q)}),G(!1)})}}).finally(()=>{G(!1)})}function ct(){if(!r||!r.uid)return;const rt=dt.getState().projectTitle;if(!rt){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}const at=rt.trim();if(at.length===0){co(Y.t("message.CannotCreateNewProjectWithoutTitle",Re)+".");return}zae(r.uid,at,Ge=>{co(Y.t("message.CannotOpenCloudFile",Re)+": "+Ge)}).then(Ge=>{if(Ge)gn(Y.t("message.TitleUsedChooseDifferentOne",Re)+": "+at);else if(r&&r.uid){const yt=M.getState().projectState.designs;if(yt){const Pt=dt.getState().projectType,ot=dt.getState().projectDescription,bt=M.getState().projectState.owner,zt=new Date().getTime(),Bt=M.getState().projectState.counter,tt=M.getState().projectState.dataColoring??null,Ht=M.getState().projectState.selectedProperty??null,_t=!!M.getState().projectState.sortDescending,qt=M.getState().projectState.xAxisNameScatterPlot??"rowWidth",un=M.getState().projectState.yAxisNameScatterPlot??"rowWidth",Rn=M.getState().projectState.dotSizeScatterPlot??5,yo=M.getState().projectState.thumbnailWidth??200,Ao=OCe(at,yt)??[];for(const[Io,po]of yt.entries())VCe(po.title,Ao[Io].title,bt,r.uid);const wo=M.getState().projectImages;if(wo&&wo.size>0){for(const[Io,po]of yt.entries()){const On=wo.get(po.title);On&&(Ao[Io].thumbnail=tXn(On))}$n.firestore().collection("users").doc(r.uid).collection("projects").doc(at).set({owner:r.uid,timestamp:zt,type:Pt,description:ot,counter:Bt,dataColoring:tt,selectedProperty:Ht,sortDescending:_t,xAxisNameScatterPlot:qt,yAxisNameScatterPlot:un,dotSizeScatterPlot:Rn,thumbnailWidth:yo,designs:Ao,ranges:M.getState().projectState.ranges??null,filters:M.getState().projectState.filters??null,hiddenParameters:M.getState().projectState.hiddenParameters}).then(()=>{n(Io=>{Io.projectView=!0,Io.projectState.owner=r.uid,Io.projectState.type=Pt,Io.projectState.title=rt,Io.projectState.description=ot,Io.projectState.designs=Ao})}).catch(Io=>{co(Y.t("message.CannotCreateNewProject",Re)+": "+Io)}).finally(()=>{d&&ke(!1).then(()=>{$(!q)}),G(!1)})}}}})}function It(){const rt=M.getState().projectState.owner;if(r.uid!==rt)gn(Y.t("message.CannotAddDesignToProjectOwnedByOthers",Re));else{const at=M.getState().projectState.title;if(at){G(!0);const Ge=M.getState().projectState.type??Ri.SOLAR_PANEL_ARRAY,yt=M.getState().projectState.thumbnailWidth??200,Pt=M.getState().projectState.counter??0;Ye(Ge,at,at+" "+Pt,yt)}}}function Ft(){r.uid&&wt(!1).then(()=>{dt.getState().set(rt=>{rt.showCloudFilePanel=!0})})}function Ve(){r.uid&&wt(!0).then(()=>{})}function ft(){Oe(!0)}function kt(){Oe(!1),$(!q)}return t?h.jsx(h.Fragment,{children:g&&h.jsx(rIe,{openCloudFile:Be,deleteModelFromMap:Ue,likeModelFromMap:nt,pinModelFromMap:We})}):h.jsxs(h.Fragment,{children:[V&&h.jsx(YQ,{}),h.jsx(E2o,{saveToCloud:it,isLoading:()=>V,setTitle:Q,getTitle:()=>ie,setTitleDialogVisible:oe,isTitleDialogVisible:()=>se}),h.jsx(D2o,{signIn:we,signInAnonymously:ve,signOut:Ie}),u&&h.jsx(nmo,{cloudFileArray:ee,openCloudFile:rt=>{r.uid&&Ze(r.uid,rt)},deleteCloudFile:rt=>{r.uid&&vt(r.uid,rt)},renameCloudFile:(rt,at)=>{r.uid&&Rt(r.uid,rt,at)}}),d&&ye.current&&h.jsx(W2o,{projects:ae,setProjectState:xt,deleteProject:st,renameProject:je}),f&&h.jsx(oit,{author:void 0,models:Z.current,openCloudFile:Ze,closeCallback:()=>{o("showModelsGallery",!1),o("modelsMapSelectedSite",void 0),Z.current=void 0}}),p&&h.jsx(mmo,{openCloudFile:$e}),g&&h.jsx(rIe,{openCloudFile:Be,deleteModelFromMap:Ue,likeModelFromMap:nt,pinModelFromMap:We})]})});var j2o={},B2o="@firebase/database",Y2o="0.11.0";/** * @license * Copyright 2019 Google LLC * @@ -8479,14 +8479,14 @@ FIREBASE: `))},e.prototype.restoreState_=function(){var n,o,r,i;this.tryAuth(),t * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var nAo=EJ.ServerValue;function oAo(t){iit(t.SDK_VERSION),t.INTERNAL.registerComponent(new Jb("database",function(e,n){var o=n.instanceIdentifier,r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),a=e.getProvider("app-check-internal");return new EJ(Mat(r,i,a,o),r)},"PUBLIC").setServiceProps({Reference:tx,Query:Iat,Database:EJ,DataSnapshot:qE,enableLogging:cit,INTERNAL:J6o,ServerValue:nAo,TEST_ACCESS:tAo}).setMultipleInstances(!0)),t.registerVersion(B2o,Y2o)}oAo($n);const rAo=be.memo(()=>{const t=M(owt),e=M(rwt),n=M(yp),o=M(zb),r=M(HW),i=M(Xge),a=m.useRef(),l=n.schoolID??sc.UNKNOWN,s=n.classID??Oa.UNKNOWN;return m.useEffect(()=>{const c={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-2024.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let u;for(const d of $n.apps)if(d.name===fG.LOG_DATA){u=d;break}u||(u=$n.initializeApp(c,fG.LOG_DATA)),u&&(a.current=$n.database(u))},[]),m.useEffect(()=>{e&&n.uid&&(async()=>{if(a.current){const u=e.timestamp+" ("+ul(new Date(e.timestamp)).format("MM-DD-YYYY hh:mm A")+")";await a.current.ref(l+"/"+s+"/"+n.uid+"/"+u).set(r?{project:i??"Untitled",action:JSON.stringify(e)}:{file:o??"Untitled",action:JSON.stringify(e)})}})().catch(u=>{PR("Data logger error: "+e+" - "+u)})},[e]),m.useEffect(()=>{t&&(async()=>{if(a.current){const u=t.timestamp+" ("+ul(new Date(t.timestamp)).format("MM-DD-YYYY hh:mm A")+")";await a.current.ref(l+"/"+s+"/"+n.uid+"/"+u).set(r?{project:i??"Untitled",action:JSON.stringify(t)}:{file:o??"Untitled",action:JSON.stringify(t)})}})().catch(u=>{PR("Data logger error: "+t+" - "+u)})},[t]),h.jsx(h.Fragment,{})}),iAo=be.memo(()=>{const t=M(bBe)??3.5,e=M(xBe)??.2,n=M(Oq)??$F,o=ye.getShadowMapSize(),r=M(Lw),i=M(ay),a=2*i,l=i+100,s=M(Cs),c=m.useRef(null);c.current&&(c.current.shadow.camera.left=-l,c.current.shadow.camera.bottom=-l,c.current.shadow.camera.right=l,c.current.shadow.camera.top=l,c.current.shadow.camera.updateProjectionMatrix());const u=r.z>0,d=u?r.normalize().dot(ko):0;return h.jsxs(h.Fragment,{children:[h.jsx("ambientLight",{intensity:oAt+(u?e*d:0),name:"Ambient Light"}),h.jsx("directionalLight",{ref:c,name:"Directional Light",color:"white",position:r.normalize().multiplyScalar(a),intensity:u?t*d:0,castShadow:s,"shadow-bias":0,"shadow-mapSize-height":o,"shadow-mapSize-width":o,"shadow-camera-near":1,"shadow-camera-far":n})]})}),aAo=be.memo(({element:t})=>{const e=M(Uwt),n=M(Ug),o=M(ly),r=M(Kge),i=t.type===z.Roof,a="lightGray",l=r3(hW,mN),s={font:l,height:0,size:.2},c={font:l,height:0,size:.35},u=m.useMemo(()=>r(t,n??o),[n,o]),d=m.useMemo(()=>{const P=-Math.atan2(e.x,e.y)+Math.PI;return new ln(Qt,0,P,"ZXY")},[e.x,e.y]),f=()=>{let P=t.lz;return i&&(P=M.getState().selectedElementHeight),Math.ceil(P)+1},p=()=>{let P=t.lz;return i&&(P=t.rise),P.toFixed(1)+" m"},g=()=>i?M.getState().selectedElementHeight+1:t.lz-.175;if(!n&&!o)return null;const A=f(),y=p(),S=g(),C=new Array(A+1).fill(0);return h.jsxs("group",{position:u,rotation:d,name:"Vertical Ruler",children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[0,A,0]],color:a}),h.jsxs("mesh",{position:[-1.5,S,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[y,c]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),C.map((P,v)=>{const T=.2+(v%5===0?.05:0),w=h.jsx("textGeometry",{args:[`${v}`,s]});return h.jsxs("group",{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[-T,v,0],[T,v,0]],lineWidth:.5,color:a}),!i&&h.jsxs("mesh",{position:[.4,v-.125,0],userData:{unintersectable:!0},children:[w,h.jsx("meshBasicMaterial",{attach:"material",color:a})]})]},v)})]})}),lAo=be.memo(()=>{const t=M(Ub),e=M(o$),n=M(Ug),o=M(ly),r=M(mA),i=M(ay),a=M(i$),l=M(r$),s=M(v=>{if(v.selectedElement){const T=v.selectedElement.id;return v.elements.find(w=>w.id===T)}}),[c,u]=m.useState(!1),[d,f]=m.useState(2*i),[p,g]=m.useState(2*i);m.useEffect(()=>{const v=Math.floor(i/50)+1,T=Math.round(i/v)*2;f(T*v),g(T)},[i]),m.useEffect(()=>{if(n){const v=ye.isTopResizeHandle(n)||n===Mt.UpperLeft&&(s==null?void 0:s.type)===z.Wall||n===Mt.UpperRight&&(s==null?void 0:s.type)===z.Wall;u(!v)}else u(!1)},[n,s==null?void 0:s.type]);const A=()=>{if(!s)return!1;const v=s.type;return v===z.Foundation||v===z.Cuboid||v===z.Tree&&s.parentId===z.Ground||v===z.Human&&s.parentId===z.Ground},y=o===Di.Lower||o===Di.Upper,P=(v=>ye.isTopResizeHandle(v)||(s==null?void 0:s.type)===z.Wall&&ye.isTopResizeHandleOfWall(v)||(s==null?void 0:s.type)===z.Roof&&ye.isRiseHandleOfRoof(v))(n??o);return s?h.jsxs(h.Fragment,{children:[((c||t||ye.isMoveHandle(o))&&!r&&A()||a||l)&&h.jsx("gridHelper",{rotation:[Qt,0,0],name:"Grid",args:[d,p,"gray","#444444"]}),(e||y)&&s&&A()&&h.jsx(_ye,{element:s}),P&&h.jsx(aAo,{element:s})]}):null}),dle=120,iv="DarkSlateGray",dD="white",sAo=be.memo(({visible:t=!0})=>{const e=m.useRef(null),n=$t(),o=window.devicePixelRatio,r=dle*o,i=r/150,l=20*i+"px serif";return m.useEffect(()=>{e.current&&kn.setState({compassRef:e})},[]),m.useEffect(()=>{if(!e.current||!t)return;const s=e.current.getContext("2d");if(!s)return;const c=55*i,u=10*i,d=40*i,f=5*i,p=30*i,g=i,A=i,y=15*i,S=r/2;s.clearRect(0,0,r,r),s.beginPath(),s.arc(S,S,d,0,Math.PI*2),s.lineWidth=f,s.strokeStyle=iv,s.stroke(),s.beginPath(),s.arc(S,S,p,0,Math.PI*2),s.lineWidth=g,s.strokeStyle=iv,s.stroke(),s.lineWidth=A,s.beginPath(),s.moveTo(S,S-c),s.lineTo(S-u,S-u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S-c),s.lineTo(S+u,S-u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S+c),s.lineTo(S-u,S+u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S+c),s.lineTo(S+u,S+u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S-c,S),s.lineTo(S-u,S-u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S-c,S),s.lineTo(S-u,S+u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S+c,S),s.lineTo(S+u,S-u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S+c,S),s.lineTo(S+u,S+u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.font=l,s.fillStyle=dD,s.textAlign="center",s.fillText(`${Y.t("compass.N",n)}`,S,y),s.save(),s.translate(r,r),s.rotate(Math.PI),s.fillText(`${Y.t("compass.S",n)}`,S,y),s.restore(),s.fillStyle=iv,s.save(),s.translate(0,r),s.rotate(-Math.PI/2),s.fillText(`${Y.t("compass.W",n)}`,S,y),s.restore(),s.save(),s.translate(r,0),s.rotate(Math.PI/2),s.fillText(`${Y.t("compass.E",n)}`,S,y),s.restore()},[n,t]),t?h.jsx("canvas",{ref:e,id:"compassCanvas",width:r,height:r,style:{position:"absolute",bottom:"0",right:"0",height:`${dle}px`,width:`${dle}px`,margin:"5px",pointerEvents:"none"}}):null});var zat={exports:{}};(function(t,e){(function(n,o){t.exports=o(m,Bq)})(window,function(n,o){return function(r){var i={};function a(l){if(i[l])return i[l].exports;var s=i[l]={i:l,l:!1,exports:{}};return r[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=r,a.c=i,a.d=function(l,s,c){a.o(l,s)||Object.defineProperty(l,s,{enumerable:!0,get:c})},a.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},a.t=function(l,s){if(1&s&&(l=a(l)),8&s||4&s&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),2&s&&typeof l!="string")for(var u in l)a.d(c,u,(function(d){return l[d]}).bind(null,u));return c},a.n=function(l){var s=l&&l.__esModule?function(){return l.default}:function(){return l};return a.d(s,"a",s),s},a.o=function(l,s){return Object.prototype.hasOwnProperty.call(l,s)},a.p="",a(a.s=0)}([function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=a(1);Object.defineProperty(i,"default",{enumerable:!0,get:function(){return function(s){return s&&s.__esModule?s:{default:s}}(l).default}}),r.exports=i.default},function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=Object.assign||function(A){for(var y=1;y0&&p[0]!==this)return!1;var R=S.target===document.body||b,H=this.childrenContainer&&this.childrenContainer.contains(S.target);if(!(x?H:R))return!1;var F=(0,d.findMatchedKey)(S,v);return!!F&&(T(F,S),!0)}},{key:"render",value:function(){var S=this,C=this.props.children,P=Object.assign({},this.props),v=!0,T=!1,w=void 0;try{for(var x,b=Object.keys(y.propTypes)[Symbol.iterator]();!(v=(x=b.next()).done);v=!0)delete P[x.value]}catch(R){T=!0,w=R}finally{try{!v&&b.return&&b.return()}finally{if(T)throw w}}return C?c.default.createElement("span",l({ref:function(R){S.childrenContainer=R}},P),C):null}}]),y}();i.default=g,g.propTypes={handleKeys:u.default.array,handleEventType:u.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:u.default.bool,onKeyEvent:u.default.func,isDisabled:u.default.bool,isExclusive:u.default.bool,children:u.default.any},g.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},r.exports=i.default},function(r,i){r.exports=n},function(r,i){r.exports=o},function(r,i,a){function l(C,P,v){return P in C?Object.defineProperty(C,P,{value:v,enumerable:!0,configurable:!0,writable:!0}):C[P]=v,C}Object.defineProperty(i,"__esModule",{value:!0}),i.matchKeyEvent=S,i.findMatchedKey=function(C,P){var v=P.map(function(T){var w=T.toLowerCase(),x=y[w];return x||[T]}).reduce(function(T,w){return T.concat(w)},[]).find(function(T){return S(C,T)});return!v&&P.includes("all")&&(v="other"),v};var s={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},c=Object.keys(s).reduce(function(C,P){return Object.assign(C,l({},P.toUpperCase(),s[P]))},{}),u="0123456789".split("").reduce(function(C,P,v){return Object.assign(C,l({},P,[v+48,v+96]))},{}),d="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(C,P,v){return Object.assign(C,l({},P.toLowerCase(),[v+65]),l({},P,[v+65]))},{}),f="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(C,P,v){return Object.assign(C,l({},"f"+P,[v+112]))},{}),p={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},g=i.AllKeys=Object.assign({},s,c,u,d,f),A=Object.assign({},u,d),y={all:Object.keys(g),alphanumeric:Object.keys(A),numeric:Object.keys(u),alphabetic:Object.keys(d),function:Object.keys(f)};function S(C,P){var v=C.which||C.keyCode,T=C.type,w=Object.keys(p).filter(function(U){return C[U+"Key"]}).sort(),x=P.toLowerCase().trim(),b=x==="+"?["+"]:x.split(/\s?\+\s?/),R=b.pop(),H=g[R],F=b;if(T==="keypress")return P==String.fromCharCode(v).toLowerCase();if(F.length===0&&w.length===0)return H.indexOf(v)>=0;if(F.length>0&&w.length>0){var E=F.map(function(U){return p[U]}).sort(),N=E.length===w.length&&E.every(function(U,W){return w[W]===U});return H.indexOf(v)>=0&&N}return F.length==0&&w.length===1&&R===w[0]}}])})})(zat);var cAo=zat.exports;const dze=Wi(cAo),uAo=be.memo(()=>{var s,c;const t=M(pn),e=M(Zge),n=M(Qge),o=M(En),r=m.useRef(!1),i=m.useRef(!1);M(TOe),M(POe),dt(u=>u.selectedElementId),m.useEffect(()=>{kn.setState({listenToAutoDeletionByDeleteRef:r,listenToAutoDeletionByCutRef:i})},[]);const a=k2.debounce(()=>{var v,T;const u=dt.getState().selectedElementId,d=M.getState().selectedElementIdSet;if(!u||d.size===0)return;const f=M.getState().getAutoDeletedElements();if(!f)return;const p=M.getState().deletedElements,g=M.getState().elementsToPaste,A=(v=kn.getState().listenToAutoDeletionByCutRef)==null?void 0:v.current,y=(T=kn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:T.current;let S=[],C="";A?(kn.getState().setListenToAutoDeletionByCut(!1),S=[...g,...f],C="Cut"):y&&(kn.getState().setListenToAutoDeletionByDelete(!1),S=[...p,...f],C="Delete");const P={name:C,timestamp:Date.now(),deletedElements:[...S],selectedElementId:u,selectedElementIdSet:new Set(d),undo(){const w=P.deletedElements;if(!w||w.length===0)return;for(const b of this.deletedElements)if(b.type===z.Wall){const R=b;R.leftJoints.length>0&&e(R.leftJoints[0],[R.id]),R.rightJoints.length>0&&n(R.rightJoints[0],[R.id])}else b.type===z.Roof&&t(R=>{R.addedRoofIdSet.add(b.id)});const x=w.find(b=>b.id===this.selectedElementId)??null;t(b=>{b.elements.push(...w),b.selectedElement=x,b.selectedElementIdSet=new Set(this.selectedElementIdSet),b.updateWallMapOnFoundationFlag=!b.updateWallMapOnFoundationFlag,b.deletedRoofId=null,b.autoDeletedRoofs=null,b.deletedRoofIdSet.clear(),b.autoDeletedRoofIdSet.clear(),b.autoDeletedChild=null})},redo(){P.deletedElements.length!==0&&(t(w=>{w.selectedElement=w.elements.find(x=>x.id===this.selectedElementId)??null,w.selectedElementIdSet=new Set(this.selectedElementIdSet)}),M.getState().removeSelectedElements())}};o(P),t(w=>{w.selectedElement=null,w.selectedElementIdSet.clear(),w.deletedRoofId=null,w.deletedRoofIdSet.clear(),w.autoDeletedRoofs=null,w.autoDeletedRoofIdSet.clear(),w.autoDeletedChild=null}),dt.getState().setPrimitiveStore("selectedElementId",null)},50);return(((s=kn.getState().listenToAutoDeletionByCutRef)==null?void 0:s.current)||((c=kn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:c.current))&&M.getState().getAutoDeletedElements()&&a(),null}),fze=["left","up","right","down","shift+left","shift+up","shift+right","shift+down","ctrl+shift+left","ctrl+shift+up","ctrl+shift+right","ctrl+shift+down","meta+shift+left","meta+shift+up","meta+shift+right","meta+shift+down","ctrl+f","meta+f","ctrl+o","meta+o","ctrl+s","meta+s","ctrl+c","meta+c","ctrl+x","meta+x","ctrl+v","meta+v","ctrl+[","meta+[","ctrl+]","meta+]","ctrl+z","meta+z","ctrl+y","meta+y","ctrl+m","meta+m","ctrl+u","meta+u","ctrl+b","meta+b","shift","esc","ctrl+home","ctrl+alt+h","ctrl+shift+o","meta+shift+o","ctrl+shift+s","meta+shift+s","delete","backspace","alt+backspace","f2","f4","ctrl"],dAo=be.memo(({canvas:t})=>{const e=M(pn),n=M(oa),o=M(RW),r=M(m0),i=M(Fge),a=M(En),l=M(Ju)??!1,s=M(Db),c=M(Jn),u=M(BYe),d=M(Ap),f=M(y7t),p=M(Gr),g=M(Qge),A=M(Zge),y=M(P7t),S=M(Nge),C=.1,P=m.useMemo(()=>({lng:r}),[r]),v=(V,G)=>(t&&(t.style.cursor="default"),d(V,G)),T=()=>{if(M.getState().viewState.navigationView)return;const V=M.getState().set2DView,G={name:"Set 2D View",timestamp:Date.now(),checked:!l,undo:()=>{V(!G.checked)},redo:()=>{V(G.checked)}};a(G),V(!l),e(q=>{q.viewState.autoRotate=!1})},w=()=>{if(l)return;const V=M.getState().setNavigationView,G={name:"Set Navigation View",timestamp:Date.now(),checked:!M.getState().viewState.navigationView,undo:()=>{V(!G.checked)},redo:()=>{V(G.checked)}};a(G),V(!M.getState().viewState.navigationView),e(q=>{q.viewState.autoRotate=!1})},x=()=>{if(l)return;const V={name:"Auto Rotate",timestamp:Date.now(),checked:!M.getState().viewState.autoRotate,undo:()=>{e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=!V.checked})},redo:()=>{e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=V.checked})}};a(V),e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=!G.viewState.autoRotate})},b=(V,G,q)=>{const $=JSON.parse(JSON.stringify(V));if($.cx=G,$.cy=q,V.type===z.SolarPanel&&V.parentType===z.Roof){if(V.parentId&&V.foundationId){const ie=c(V.parentId),Q=c(V.foundationId);if(ie&&Q){const se=bn.getRoofBoundaryVertices(ie),Z=bn.getSolarPanelVerticesOnRoof($,Q);if(!g$e(Z,se)||!m$e($,Q,Z))return!1}}return!0}if(S($))return co(Y.t("message.MoveCancelledBecauseOfOverlap",P)),!1;if($.type===z.SolarPanel){const ie=p(V);if(ie&&!ye.isSolarCollectorWithinHorizontalSurface($,ie))return co(Y.t("message.MoveOutsideBoundaryCancelled",P)),!1}return!0},R=V=>{switch(V.type){case z.Roof:case z.Door:case z.Window:return!1;case z.SolarPanel:case z.Sensor:case z.Light:{const G=V;return G.parentType===z.Wall||G.parentType===z.Roof?!1:G.parentType===z.Cuboid?G.rotation[2]===1:!0}case z.Wall:{const G=V;return!(G.leftJoints.length!==0||G.rightJoints.length!==0)}default:return!0}},H=(V,G)=>{switch(V){case z.Foundation:case z.Cuboid:return G===z.Foundation||G===z.Cuboid;default:return G!==z.Foundation&&G!==z.Cuboid}},F=V=>{const G=M.getState().elements.filter(Q=>Ad(Q)&&Q.parentId===Zo),q=new Set(V.map(Q=>Q.id)),$=new Map;for(const Q of G){const se=ye.fetchFoundationVertexCoordinates(Q);$.set(Q.id,se)}const ie=Q=>{for(const se of G)!q.has(se.id)&&ye.areBasesOverlapped(Q.id,se.id,$)&&(q.add(se.id),V.push(se),se.enableGroupMaster&&ie(se))};for(const Q of V)Q.enableGroupMaster&&ie(Q)},E=()=>{const V=[],G=M.getState().selectedElementIdSet,q=s();if(!q||G.size===0)return V;if(q){const $=q.type,ie=q.parentId,Q=M.getState().elements.filter(se=>H($,se.type)&&R(se)&&se.parentId===ie&&G.has(se.id));V.push(...Q),Ad(q)&&V.length>0&&ie===Zo&&F(V)}return V},N=(V,G,q,$)=>{switch($){case Sl.Left:return[V-q,G];case Sl.Right:return[V+q,G];case Sl.Up:return[V,G+q];case Sl.Down:return[V,G-q]}},U=(V,G)=>{e(q=>{var ie,Q;let $=!1;for(const se of q.elements)if(V.has(se.id)){const Z=V.get(se.id);if(Z!==void 0){const[ee,te]=N(se.cx,se.cy,Z,G);if(se.type===z.Wall){const oe=se,de=new ae(ee-oe.cx,te-oe.cy),he=new ae().fromArray(oe.leftPoint).setZ(0).add(de),pe=new ae().fromArray(oe.rightPoint).setZ(0).add(de);oe.leftPoint=he.toArray(),oe.rightPoint=pe.toArray(),$=!0}se.cx=ee,se.cy=te}}else q.selectedElementIdSet.has(se.id)&&q.selectedElementIdSet.delete(se.id);((ie=q.selectedElement)==null?void 0:ie.type)===z.Cuboid||((Q=q.selectedElement)==null?void 0:Q.type)===z.Foundation?q.groupActionUpdateFlag=!q.groupActionUpdateFlag:$&&(q.updateWallMapOnFoundationFlag=!q.updateWallMapOnFoundationFlag)})},W=(V,G)=>{e(q=>{for(const $ of q.elements)(ye.isFoundationOrCuboid($)||ye.isPlantOrHuman($)&&$.parentId===Zo)&&([$.cx,$.cy]=N($.cx,$.cy,V,G))})},k=V=>V===Sl.Left?Sl.Right:V===Sl.Right?Sl.Left:V===Sl.Up?Sl.Down:V===Sl.Down?Sl.Up:(console.error("Undo direction is possibly incorrect:",V),V),D=(V,G)=>{if(!l)return;const q=E(),$=s(),ie=G*C;if($&&q.length>0){const Q=new Map;for(const Z of q)switch(Z.type){case z.Foundation:case z.Cuboid:case z.Wall:case z.Tree:case z.Flower:case z.Human:{Q.set(Z.id,ie);break}case z.Light:case z.Sensor:{const ee=p($);if(ee){let te=ie/ee.lx;const[oe,de]=N(Z.cx,Z.cy,te,V),he=Z.lx/(2*ee.lx),pe=Z.lx/(2*ee.ly);switch(V){case Sl.Left:case Sl.Right:{const me=ye.clamp(oe,-.5+he,.5-he);te=Math.abs(me-$.cx);break}case Sl.Up:case Sl.Down:{const me=ye.clamp(de,-.5+pe,.5-pe);te=Math.abs(me-$.cy);break}}Q.set(Z.id,te)}break}case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:{const ee=p(Z);if(ee){let te=!0,oe=ie;switch(V){case Sl.Left:case Sl.Right:{oe=ie/ee.lx;break}case Sl.Up:case Sl.Down:{oe=ie/ee.ly;break}}if(Z.type===z.SolarPanel){const[de,he]=N(Z.cx,Z.cy,oe,V);te=b(Z,de,he)}if(te)Q.set(Z.id,oe);else return}break}}U(Q,V);const se={name:`Move Selected Elements ${V} By Key`,timestamp:Date.now(),direction:V,movedElementsDisplacementMap:new Map(Q),undo:()=>{const Z=k(se.direction);U(se.movedElementsDisplacementMap,Z)},redo:()=>{U(se.movedElementsDisplacementMap,se.direction)}};a(se)}else{W(ie,V);const Q={name:`Move All ${V} By Key`,timestamp:Date.now(),direction:V,displacement:ie,undo:()=>{const se=k(Q.direction);W(Q.displacement,se)},redo:()=>{W(Q.displacement,Q.direction)}};a(Q)}},L=V=>{M.getState().set(G=>{G.multiSelectionsMode=V})},j=V=>{const G=s(),q=1;switch(V){case"left":D(Sl.Left,q);break;case"shift+left":D(Sl.Left,q/Z5);break;case"ctrl+shift+left":case"meta+shift+left":D(Sl.Left,q*Z5);break;case"right":D(Sl.Right,q);break;case"shift+right":D(Sl.Right,q/Z5);break;case"ctrl+shift+right":case"meta+shift+right":D(Sl.Right,q*Z5);break;case"down":D(Sl.Down,q);break;case"shift+down":D(Sl.Down,q/Z5);break;case"ctrl+shift+down":case"meta+shift+down":D(Sl.Down,q*Z5);break;case"up":D(Sl.Up,q);break;case"shift+up":D(Sl.Up,q/Z5);break;case"ctrl+shift+up":case"meta+shift+up":D(Sl.Up,q*Z5);break;case"ctrl+[":case"meta+[":xX(.9);break;case"ctrl+]":case"meta+]":xX(1.1);break;case"ctrl+c":case"meta+c":G&&G.type!==z.Roof&&(u(G.id),e($=>{$.selectedElementIdSet.clear(),$.selectedElementIdSet.add(G.id)}),n&&e($=>{$.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:G.id,elementType:G.type}}));break;case"ctrl+x":case"meta+x":if(!G||G.type===z.Roof)break;if(G.locked)gn(Y.t("message.ThisElementIsLocked",P));else{const $=v(G.id,!0);if($.length===0)break;if(ye.isElementTriggerAutoDeletion(G))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",G.id);else{const ie={name:"Cut",timestamp:Date.now(),deletedElements:$,selectedElementId:G.id,undo:()=>{const Q=ie.deletedElements;if(Q.length===0)return;const se=Q.find(Z=>Z.id===ie.selectedElementId);se&&e(Z=>{if(Z.elements.push(...Q),Z.selectedElementIdSet.clear(),Z.selectedElementIdSet.add(se.id),Z.selectedElement=se,se.type===z.Wall){const ee=se;let te=null,oe=null;if(ee.leftJoints.length>0&&(te=ee.leftJoints[0]),ee.rightJoints.length>0&&(oe=ee.rightJoints[0]),te||oe)for(const de of Z.elements)de.id===te&&de.type===z.Wall&&(de.rightJoints[0]=ee.id),de.id===oe&&de.type===z.Wall&&(de.leftJoints[0]=ee.id)}})},redo:()=>{ie.deletedElements&&ie.deletedElements.length>0&&v(ie.deletedElements[0].id,!0)}};a(ie)}}break;case"ctrl+v":case"meta+v":{const $=f();if($.length>0){const ie={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify($)),undo:()=>{for(const Q of ie.pastedElements)d(Q.id,!1)},redo:()=>{e(Q=>{Q.elements.push(...ie.pastedElements),Q.selectedElement=ie.pastedElements[0]})}};a(ie)}break}case"ctrl+alt+h":case"ctrl+home":{if(!l){const $=M.getState().viewState.cameraPosition,ie=M.getState().viewState.panCenter;if($[0]!==$[1]||$[1]!==$[2]||$[0]!==$[2]||ie[0]!==0||ie[1]!==0||ie[2]!==0){const Q={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...$],oldPanCenter:[...ie],undo:()=>{const se=kn.getState().orbitControlsRef;se!=null&&se.current&&(se.current.object.position.set(Q.oldCameraPosition[0],Q.oldCameraPosition[1],Q.oldCameraPosition[2]),se.current.target.set(Q.oldPanCenter[0],Q.oldPanCenter[1],Q.oldPanCenter[2]),se.current.update(),e(Z=>{const ee=Z.viewState;ee.cameraPosition=[...Q.oldCameraPosition],ee.panCenter=[...Q.oldPanCenter]}))},redo:()=>{vX()}};a(Q),e(se=>{se.objectTypeToAdd=z.None,se.groupActionMode=!1,se.viewState.orthographic=!1}),vX()}}break}case"f2":case"ctrl+b":case"meta+b":T();break;case"ctrl+u":case"meta+u":w();break;case"f4":case"ctrl+m":case"meta+m":x();break;case"ctrl+f":case"meta+f":dt.getState().set($=>{$.createNewFileFlag=!0,$.openModelsMap=!1}),e($=>{$.objectTypeToAdd=z.None,$.groupActionMode=!1,window.history.pushState({},document.title,t1),n&&($.actionInfo={name:"Create New File",timestamp:new Date().getTime()})});break;case"ctrl+s":case"meta+s":dt.getState().set($=>{$.saveLocalFileDialogVisible=!0}),n&&e($=>{$.actionInfo={name:"Save Local File",timestamp:new Date().getTime()}});break;case"ctrl+shift+o":case"meta+shift+o":dt.getState().set($=>{$.listCloudFilesFlag=!0,$.openModelsMap=!1}),n&&e($=>{$.actionInfo={name:"List Cloud Files",timestamp:new Date().getTime()}});break;case"ctrl+shift+s":case"meta+shift+s":dt.getState().setSaveCloudFileFlag(!0),n&&e($=>{$.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}});break;case"alt+backspace":case"backspace":case"delete":{const $=M.getState().selectedElementIdSet;if(!G||$.size===0)break;const ie=M.getState().removeSelectedElements();if(ie.length===0)break;if((()=>{const se=ie.filter(te=>te.type===z.Foundation),Z=new Set(se.map(te=>te.id));return!!ie.find(te=>!Z.has(te.parentId)&&ye.isElementTriggerAutoDeletion(te))})())kn.getState().setListenToAutoDeletionByDelete(!0),dt.getState().setPrimitiveStore("selectedElementId",G.id);else{if(ie.length===1){const se={name:"Delete",timestamp:Date.now(),deletedElements:[...ie],selectedElementId:G.id,undo:()=>{const Z=se.deletedElements;if(!Z||Z.length===0)return;const ee=Z.find(te=>te.id===se.selectedElementId);if(ee&&(e(te=>{te.elements.push(...Z),te.selectedElementIdSet.clear(),te.selectedElementIdSet.add(ee.id),te.selectedElement=ee,te.updateWallMapOnFoundationFlag=!te.updateWallMapOnFoundationFlag,te.deletedRoofId=null,te.deletedRoofIdSet.clear()}),ee.type===z.Wall)){const te=ee;te.leftJoints.length>0&&A(te.leftJoints[0],[te.id]),te.rightJoints.length>0&&g(te.rightJoints[0],[te.id])}},redo:()=>{const Z=se.deletedElements;if(!Z||Z.length===0)return;const ee=Z.find(te=>te.id===se.selectedElementId);ee&&v(ee.id,!1)}};a(se)}else{const se={name:"Delete Multiple",timestamp:Date.now(),deletedElements:[...ie],selectedElementId:G.id,selectedElementIdSet:new Set($),undo(){const Z=this.deletedElements;if(!Z||Z.length===0)return;const ee=Z.find(te=>te.id===this.selectedElementId);if(ee){e(te=>{te.elements.push(...Z),te.selectedElement=ee,te.selectedElementIdSet=new Set(this.selectedElementIdSet),te.updateWallMapOnFoundationFlag=!te.updateWallMapOnFoundationFlag,te.deletedRoofId=null,te.deletedRoofIdSet.clear()});for(const te of this.deletedElements)if(te.type===z.Wall){const oe=te;oe.leftJoints.length>0&&A(oe.leftJoints[0],[oe.id]),oe.rightJoints.length>0&&g(oe.rightJoints[0],[oe.id])}}},redo(){e(Z=>{Z.selectedElement=Z.elements.find(ee=>ee.id===this.selectedElementId)??null,Z.selectedElementIdSet=new Set(this.selectedElementIdSet)}),M.getState().removeSelectedElements()}};a(se)}e(se=>{se.selectedElement=null,se.selectedElementIdSet.clear()})}break}case"ctrl+z":case"meta+z":if(i.hasUndo()){const $=i.undo();M.getState().groupActionMode&&e(ie=>{ie.groupActionUpdateFlag=!ie.groupActionUpdateFlag}),$&&gn(Y.t("menu.edit.Undo",P)+": "+$,gG),n&&e(ie=>{ie.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}break;case"ctrl+y":case"meta+y":if(i.hasRedo()){const $=i.redo();$&&gn(Y.t("menu.edit.Redo",P)+": "+$,gG),M.getState().groupActionMode&&e(ie=>{ie.groupActionUpdateFlag=!ie.groupActionUpdateFlag}),n&&e(ie=>{ie.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}break;case"shift":M.getState().viewState.navigationView&&dt.getState().set($=>{$.navigationMoveSpeed=5*M.getState().minimumNavigationMoveSpeed,$.navigationTurnSpeed=5*M.getState().minimumNavigationTurnSpeed}),y(!0);break;case"esc":{const $=M.getState().addedFoundationId,ie=M.getState().addedCuboidId,Q=M.getState().addedWallId,se=M.getState().addedWindowId,Z=M.getState().addedDoorId;$?d($,!1):ie?d(ie,!1):Q?d(Q,!1):se?(d(se,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",se)):Z&&(d(Z,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",Z)),e(ee=>{ee.objectTypeToAdd=z.None,ee.actionModeLock=!1,ee.moveHandleType=null,ee.resizeHandleType=null,ee.groupActionMode=!1}),kn.getState().setEnableOrbitController(!0),o();break}case"ctrl":{L(!0);break}}},B=V=>{switch(V){case"shift":M.getState().viewState.navigationView&&dt.getState().set(G=>{G.navigationMoveSpeed=M.getState().minimumNavigationMoveSpeed,G.navigationTurnSpeed=M.getState().minimumNavigationTurnSpeed}),y(!1);break;case"ctrl+o":case"meta+o":M.getState().localFileDialogRequested||(dt.getState().set(G=>{G.openLocalFileFlag=!0}),e(G=>{G.localFileDialogRequested=!0,n&&(G.actionInfo={name:"Open Local File",timestamp:new Date().getTime()})}));break;case"ctrl":{L(!1);break}}};m.useEffect(()=>()=>{O.current=null},[]);const O=m.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsx(dze,{handleKeys:fze,handleEventType:"keydown",onKeyEvent:(V,G)=>{G.preventDefault(),O.current!==V&&(O.current=V,j(V))}}),h.jsx(dze,{handleKeys:fze,handleEventType:"keyup",onKeyEvent:(V,G)=>{G.preventDefault(),O.current=null,B(V)}}),h.jsx(uAo,{})]})}),fAo="/aladdin/assets/cloud-B68yt6QG.png",hAo=be.memo(()=>{const t=M(pn),e=M(Nwt),{scene:n}=ri();m.useEffect(()=>{const r=n.children.filter(l=>l.name==="Content"),i=[];if(r.length>0){const l=r[0].children;for(const s of l)o(s,i)}const a=[];for(const l of i)a.push(new vf().setFromObject(l));if(a.length>0){const l=new ae,s=new ae;for(const u of a)l.min(u.min),s.max(u.max);let c=Math.abs(l.x);c{u.aabb=new vf(l,s),!isNaN(c)&&isFinite(c)&&(u.sceneRadius=Math.round(Math.max(10,c*1.25)))})}},[e]);const o=(r,i)=>{if(r.userData.aabb&&i.push(r),r.children.length>0)for(const a of r.children)o(a,i)};return h.jsx(h.Fragment,{})}),Gfe=t=>{const e=new ae().subVectors(t.localToWorld(new ae(0,0,1e3)),t.position);return e.x===0&&e.y===0&&t.getWorldDirection(e),e},tP=t=>{const e=document.getElementById("compassCanvas"),n=o=>{dt.getState().set(r=>{r.isCameraUnderGround=o})};if(e){const o=Gfe(t).normalize(),i=(Math.atan2(o.y,o.x)+Math.PI/2)/Math.PI*180;e.style.transform=`rotate(${i}deg)`;const a=t.position.z<.001;a&&!dt.getState().isCameraUnderGround?n(!0):!a&&dt.getState().isCameraUnderGround&&n(!1)}},pAo=be.memo(()=>{const t=M(pn),e=M(Ju),n=M(z4t),o=M(RBe),r=M(FH),i=M(ay),a=M(D4t),l=M(E4t),s=M(Oq)??$F,c=M(Yq),u=dt(Y8t),d=dt(O8t),f=M($Be),p=dt(oYe),g=c&&!e,A=Math.hypot(a[0],a[1],a[2]),y=(e?l*50:A*10)*i,S=m.useMemo(()=>new ae(-y,-y,0),[y]),C=m.useMemo(()=>new ae(y,y,y/2),[y]),{gl:P,invalidate:v,get:T,set:w,camera:x}=ri(),b=m.useMemo(()=>{const L=T().camera;return L.up.set(0,0,1),L},[]),R=m.useMemo(()=>P.domElement,[]),H=m.useRef(null),F=m.useRef(null),E=m.useRef(null);m.useEffect(()=>{kn.setState({canvas:{gl:P,camera:x}}),!e&&F.current&&kn.setState({canvas:{gl:P,camera:F.current}})},[e]),m.useEffect(()=>{M.getState().viewState.cameraPosition2D[2]<100&&t(L=>{L.viewState.cameraPosition2D[2]=150})},[]),m.useEffect(()=>{H&&H.current&&kn.setState({orbitControlsRef:H})},[]),m.useEffect(()=>{H.current&&(H.current.addEventListener("change",N),H.current.addEventListener("start",U),H.current.addEventListener("end",W));const L=H.current;return()=>{L&&(L.removeEventListener("change",N),L.removeEventListener("start",U),L.removeEventListener("end",W))}},[g]),m.useEffect(()=>{const L=M.getState().viewState;if(H.current){if(F.current){if(g){const j=T().camera,B=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(B),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"])}else{const j=k(L.cameraPosition??[0,0,20]),B=k(L.panCenter??[0,0,0]);F.current.position.copy(j),F.current.lookAt(B),F.current.zoom=1,e||(H.current.object=F.current,H.current.target.copy(B))}x.updateMatrixWorld(),tP(T().camera)}if(E.current){const j=k(L.cameraPosition2D??[0,0,1e3]).setZ(1e3),B=k(L.panCenter2D??[0,0,0]);E.current.position.copy(j),E.current.rotation.set(0,0,0),E.current.lookAt(B),E.current.zoom=L.cameraZoom,e&&(H.current.object=E.current,H.current.target.copy(B))}}},[r]),m.useEffect(()=>{if(!E.current||!F.current||!H.current)return;const L=M.getState().viewState,j=H.current,B=E.current,O=F.current;e?(B.rotation.set(0,0,0),j.object=B,j.target.copy(k(L.panCenter2D??[0,0,0])),w({camera:B})):(j.object=O,j.target.copy(k(L.panCenter??[0,0,0])),w({camera:O}),tP(T().camera))},[e]),m.useEffect(()=>{e&&H.current&&(E.current&&(E.current.zoom=l,H.current.object=E.current),N(),H.current.update())},[l]);const N=()=>{v(),M.getState().viewState.orthographic||(tP(T().camera),H.current&&H.current.target.clamp(S,C))},U=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!0})},W=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!1}),t(L=>{if(!H.current)return;const j=L.viewState,B=T().camera,O=B.position,V=H.current.target;j.orthographic?(B.zoom&&!isNaN(B.zoom)?j.cameraZoom=B.zoom:j.cameraZoom=20,j.cameraPosition2D=[O.x,O.y,150],j.panCenter2D=[V.x,V.y,V.z]):g?(j.cameraPositionNav=[O.x,O.y,O.z],j.cameraRotationNav=[B.rotation.x,B.rotation.y,B.rotation.z],L.cameraDirection=Gfe(B)):(j.cameraPosition=[O.x,O.y,O.z],j.panCenter=[V.x,V.y,V.z],L.cameraDirection=Gfe(B))})},k=L=>L&&Array.isArray(L)?new ae(L[0],L[1],L[2]):L&&L.x!==null?new ae(L.x,L.y,L.z):new ae(0,0,5);Z2(()=>{o&&H.current&&H.current.update()});const D=kn(L=>L.compassRef);return m.useEffect(()=>{tP(T().camera)},[D]),m.useEffect(()=>{H.current&&(g&&!p&&!f?H.current.listenToKeyEvents(window):H.current.removeKeyEvents())},[g,p,f]),m.useEffect(()=>{if(!H.current)return;const L=M.getState().viewState;if(g){const j=T().camera,B=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(B),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"]),j.updateMatrixWorld(),tP(T().camera)}else if(H.current&&F.current){const j=k(L.cameraPosition??[0,0,20]),B=k(L.panCenter??[0,0,0]);F.current.position.copy(j),F.current.lookAt(B),F.current.zoom=1,e||(H.current.object=F.current,H.current.target.copy(B)),F.current.updateMatrixWorld(),tP(F.current)}v()},[g]),h.jsxs(h.Fragment,{children:[h.jsx(f4t,{ref:F,fov:lje,far:s,up:[0,0,1]}),h.jsx(u4t,{ref:E,up:[0,0,1]}),h.jsx("myOrbitControls",{ref:H,args:[b,R],autoRotate:o,enableRotate:n,enablePan:!0,enableZoom:!0,enableDamping:!1,maxAzimuthAngle:1/0,minAzimuthAngle:-1/0,maxPolarAngle:Qt,minPolarAngle:0,moveSpeed:u??3,turnSpeed:d??3})]})});var Xfe={exports:{}},Jfe={exports:{}},$k=1e3,Qk=$k*60,Zk=Qk*60,eL=Zk*24,gAo=eL*365.25,mAo=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return yAo(t);if(n==="number"&&isNaN(t)===!1)return e.long?wAo(t):AAo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function yAo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*gAo;case"days":case"day":case"d":return n*eL;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Zk;case"minutes":case"minute":case"mins":case"min":case"m":return n*Qk;case"seconds":case"second":case"secs":case"sec":case"s":return n*$k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AAo(t){return t>=eL?Math.round(t/eL)+"d":t>=Zk?Math.round(t/Zk)+"h":t>=Qk?Math.round(t/Qk)+"m":t>=$k?Math.round(t/$k)+"s":t+"ms"}function wAo(t){return qO(t,eL,"day")||qO(t,Zk,"hour")||qO(t,Qk,"minute")||qO(t,$k,"second")||t+" ms"}function qO(t,e,n){if(!(t=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}};function r(c){var u=this.useColors;if(c[0]=(u?"%c":"")+this.namespace+(u?" %c":" ")+c[0]+(u?"%c ":" ")+"+"+e.humanize(this.diff),!!u){var d="color: "+this.color;c.splice(1,0,d,"color: inherit");var f=0,p=0;c[0].replace(/%[a-zA-Z%]/g,function(g){g!=="%%"&&(f++,g==="%c"&&(p=f))}),c.splice(p,0,d)}}function i(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(c){try{c==null?e.storage.removeItem("debug"):e.storage.debug=c}catch{}}function l(){var c;try{c=e.storage.debug}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}e.enable(l());function s(){try{return window.localStorage}catch{}}})(Xfe,Xfe.exports);var xAo=Xfe.exports,hze=xAo("jsonp"),bAo=PAo,SAo=0;function TAo(){}function PAo(t,e,n){typeof e=="function"&&(n=e,e={}),e||(e={});var o=e.prefix||"__jp",r=e.name||o+SAo++,i=e.param||"callback",a=e.timeout!=null?e.timeout:6e4,l=encodeURIComponent,s=document.getElementsByTagName("script")[0]||document.head,c,u;a&&(u=setTimeout(function(){d(),n&&n(new Error("Timeout"))},a));function d(){c.parentNode&&c.parentNode.removeChild(c),window[r]=TAo,u&&clearTimeout(u)}function f(){window[r]&&d()}return window[r]=function(p){hze("jsonp got",p),d(),n&&n(null,p)},t+=(~t.indexOf("?")?"&":"?")+i+"="+l(r),t=t.replace("?&","?"),hze('jsonp req "%s"',t),c=document.createElement("script"),c.src=t,s.parentNode.insertBefore(c,s),f}const hS=Wi(bAo);var CAo=Object.defineProperty,RAo=Object.defineProperties,HAo=Object.getOwnPropertyDescriptors,FJ=Object.getOwnPropertySymbols,Dat=Object.prototype.hasOwnProperty,Eat=Object.prototype.propertyIsEnumerable,pze=(t,e,n)=>e in t?CAo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lg=(t,e)=>{for(var n in e||(e={}))Dat.call(e,n)&&pze(t,n,e[n]);if(FJ)for(var n of FJ(e))Eat.call(e,n)&&pze(t,n,e[n]);return t},Wee=(t,e)=>RAo(t,HAo(e)),Nee=(t,e)=>{var n={};for(var o in t)Dat.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&FJ)for(var o of FJ(t))e.indexOf(o)<0&&Eat.call(t,o)&&(n[o]=t[o]);return n};function e7(t){return n=>{var o=n,{bgStyle:r={},borderRadius:i=0,iconFillColor:a="white",round:l=!1,size:s=64}=o,c=Nee(o,["bgStyle","borderRadius","iconFillColor","round","size"]);return h.jsxs("svg",Wee(lg({viewBox:"0 0 64 64",width:s,height:s},c),{children:[l?h.jsx("circle",{cx:"32",cy:"32",r:"32",fill:t.color,style:r}):h.jsx("rect",{width:"64",height:"64",rx:i,ry:i,fill:t.color,style:r}),h.jsx("path",{d:t.path,fill:a})]}))}}const MAo=e7({color:"#7f7f7f",networkName:"email",path:"M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z"}),IAo=MAo;function Qs(t){const e=Object.entries(t).filter(([,n])=>n!=null).map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);return e.length>0?`?${e.join("&")}`:""}const zAo=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",DAo=(t,e)=>({left:window.outerWidth/2+(window.screenX||window.screenLeft||0)-t/2,top:window.outerHeight/2+(window.screenY||window.screenTop||0)-e/2}),EAo=(t,e)=>({top:(window.screen.height-e)/2,left:(window.screen.width-t)/2});function FAo(t,e,n){var o=e,{height:r,width:i}=o,a=Nee(o,["height","width"]);const l=lg({height:r,width:i,location:"no",toolbar:"no",status:"no",directories:"no",menubar:"no",scrollbars:"yes",resizable:"no",centerscreen:"yes",chrome:"yes"},a),s=window.open(t,"",Object.keys(l).map(c=>`${c}=${l[c]}`).join(", "));if(n){const c=window.setInterval(()=>{try{(s===null||s.closed)&&(window.clearInterval(c),n(s))}catch(u){console.error(u)}},1e3)}return s}function kAo(t){var e=t,{beforeOnClick:n,children:o,className:r,disabled:i,disabledStyle:a={opacity:.6},forwardedRef:l,htmlTitle:s,networkLink:c,networkName:u,onClick:d,onShareWindowClose:f,openShareDialogOnClick:p=!0,opts:g,resetButtonStyle:A=!0,style:y,url:S,windowHeight:C=400,windowPosition:P="windowCenter",windowWidth:v=550}=e,T=Nee(e,["beforeOnClick","children","className","disabled","disabledStyle","forwardedRef","htmlTitle","networkLink","networkName","onClick","onShareWindowClose","openShareDialogOnClick","opts","resetButtonStyle","style","url","windowHeight","windowPosition","windowWidth"]);const w=async R=>{const H=c(S,g);if(!i){if(R.preventDefault(),n){const F=n();zAo(F)&&await F}if(p){const F=lg({height:C,width:v},P==="windowCenter"?DAo(v,C):EAo(v,C));FAo(H,F,f)}d&&d(R,H)}},x=Xn("react-share__ShareButton",{"react-share__ShareButton--disabled":!!i,disabled:!!i},r),b=lg(lg(A?{backgroundColor:"transparent",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"}:{},y),i&&a);return h.jsx("button",Wee(lg({},T),{className:x,onClick:w,ref:l,style:b,title:s,children:o}))}function A0(t,e,n,o){function r(i,a){const l=n(i),s=lg({},i);return Object.keys(l).forEach(u=>{delete s[u]}),h.jsx(kAo,Wee(lg(lg({},o),s),{forwardedRef:a,networkName:t,networkLink:e,opts:n(i)}))}return r.displayName=`ShareButton-${t}`,m.forwardRef(r)}function LAo(t,{subject:e,body:n,separator:o}){return"mailto:"+Qs({subject:e,body:n?n+o+t:t})}const WAo=A0("email",LAo,t=>({subject:t.subject,body:t.body,separator:t.separator||" "}),{openShareDialogOnClick:!1,onClick:(t,e)=>{window.location.href=e}}),NAo=WAo,UAo=e7({color:"#0965FE",networkName:"facebook",path:"M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z"}),jAo=UAo;function BAo(t,{appId:e,redirectUri:n,to:o}){return"https://www.facebook.com/dialog/send"+Qs({link:t,redirect_uri:n||t,app_id:e,to:o})}A0("facebookmessenger",BAo,t=>({appId:t.appId,redirectUri:t.redirectUri,to:t.to}),{windowWidth:1e3,windowHeight:820});class YAo extends Error{constructor(e){super(e),this.name="AssertionError"}}function i0(t,e){if(!t)throw new YAo(e)}function OAo(t,{hashtag:e}){return i0(t,"facebook.url"),"https://www.facebook.com/sharer/sharer.php"+Qs({u:t,hashtag:e})}const VAo=A0("facebook",OAo,t=>({hashtag:t.hashtag}),{windowWidth:550,windowHeight:400}),_Ao=VAo;function GAo(){const t=m.useRef(!1);return m.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),m.useCallback(()=>t.current,[])}function XAo(t){var e=t,{children:n=f=>f,className:o,getCount:r,url:i}=e,a=Nee(e,["children","className","getCount","url"]);const l=GAo(),[s,c]=m.useState(void 0),[u,d]=m.useState(!1);return m.useEffect(()=>{d(!0),r(i,f=>{l()&&(c(f),d(!1))})},[i]),h.jsx("span",Wee(lg({className:Xn("react-share__ShareCount",o)},a),{children:!u&&s!==void 0&&n(s)}))}function pS(t){const e=n=>h.jsx(XAo,lg({getCount:t},n));return e.displayName=`ShareCount(${t.name})`,e}function JAo(t,e){const n=`https://graph.facebook.com/?id=${t}&fields=og_object{engagement}`;hS(n,(o,r)=>{e(!o&&r&&r.og_object&&r.og_object.engagement?r.og_object.engagement.count:void 0)})}pS(JAo);function KAo(t,{title:e}){return i0(t,"hatena.url"),`http://b.hatena.ne.jp/add?mode=confirm&url=${t}&title=${e}`}A0("hatena",KAo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"});function qAo(t,e){hS("https://bookmark.hatenaapis.com/count/entry"+Qs({url:t}),(o,r)=>{e(r??void 0)})}pS(qAo);function $Ao(t,{title:e,description:n}){return i0(t,"instapaper.url"),"http://www.instapaper.com/hello2"+Qs({url:t,title:e,description:n})}A0("instapaper",$Ao,t=>({title:t.title,description:t.description}),{windowWidth:500,windowHeight:500,windowPosition:"windowCenter"});const QAo=e7({color:"#00b800",networkName:"line",path:"M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z"}),ZAo=QAo;function e4o(t,{title:e}){return i0(t,"line.url"),"https://social-plugins.line.me/lineit/share"+Qs({url:t,text:e})}const t4o=A0("line",e4o,t=>({title:t.title}),{windowWidth:500,windowHeight:500}),n4o=t4o,o4o=e7({color:"#0077B5",networkName:"linkedin",path:"M20.4,44h5.4V26.6h-5.4V44z M23.1,18c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1 c1.7,0,3.1-1.4,3.1-3.1C26.2,19.4,24.8,18,23.1,18z M39.5,26.2c-2.6,0-4.4,1.4-5.1,2.8h-0.1v-2.4h-5.2V44h5.4v-8.6 c0-2.3,0.4-4.5,3.2-4.5c2.8,0,2.8,2.6,2.8,4.6V44H46v-9.5C46,29.8,45,26.2,39.5,26.2z"}),r4o=o4o;function i4o(t,{title:e,summary:n,source:o}){return i0(t,"linkedin.url"),"https://linkedin.com/shareArticle"+Qs({url:t,mini:"true",title:e,summary:n,source:o})}const a4o=A0("linkedin",i4o,({title:t,summary:e,source:n})=>({title:t,summary:e,source:n}),{windowWidth:750,windowHeight:600}),l4o=a4o;function s4o(t,{title:e,description:n}){return i0(t,"livejournal.url"),"https://www.livejournal.com/update.bml"+Qs({subject:e,event:n})}A0("livejournal",s4o,t=>({title:t.title,description:t.description}),{windowWidth:660,windowHeight:460});function c4o(t,{title:e,description:n,imageUrl:o}){return i0(t,"mailru.url"),"https://connect.mail.ru/share"+Qs({url:t,title:e,description:n,image_url:o})}A0("mailru",c4o,t=>({title:t.title,description:t.description,imageUrl:t.imageUrl}),{windowWidth:660,windowHeight:460});function u4o(t,{title:e,description:n,image:o}){return i0(t,"ok.url"),"https://connect.ok.ru/offer"+Qs({url:t,title:e,description:n,imageUrl:o})}A0("ok",u4o,t=>({title:t.title,description:t.description,image:t.image}),{windowWidth:588,windowHeight:480,windowPosition:"screenCenter"});function d4o(t,e){window.OK||(window.OK={Share:{count:function(i,a){var l,s;(s=(l=window.OK.callbacks)[i])==null||s.call(l,a)}},callbacks:[]});const n="https://connect.ok.ru/dk",o=window.OK.callbacks.length;return window.ODKL={updateCount(r,i){var a,l;const s=r===""?0:parseInt(r.replace("react-share-",""),10);(l=(a=window.OK.callbacks)[s])==null||l.call(a,i===""?void 0:parseInt(i,10))}},window.OK.callbacks.push(e),hS(n+Qs({"st.cmd":"extLike",uid:`react-share-${o}`,ref:t}))}pS(d4o);function f4o(t,{media:e,description:n,pinId:o}){return o?`https://pinterest.com/pin/${o}/repin/x/`:(i0(t,"pinterest.url"),i0(e,"pinterest.media"),"https://pinterest.com/pin/create/button/"+Qs({url:t,media:e,description:n}))}A0("pinterest",f4o,t=>({media:t.media,description:t.description,pinId:t.pinId}),{windowWidth:1e3,windowHeight:730});function h4o(t,e){hS("https://api.pinterest.com/v1/urls/count.json"+Qs({url:t}),(o,r)=>{e(r?r.count:void 0)})}pS(h4o);function p4o(t,{title:e}){return i0(t,"pocket.url"),"https://getpocket.com/save"+Qs({url:t,title:e})}A0("pocket",p4o,t=>({title:t.title}),{windowWidth:500,windowHeight:500});const g4o=e7({color:"#FF5700",networkName:"reddit",path:"M 53.34375 32 C 53.277344 30.160156 52.136719 28.53125 50.429688 27.839844 C 48.722656 27.148438 46.769531 27.523438 45.441406 28.800781 C 41.800781 26.324219 37.519531 24.957031 33.121094 24.863281 L 35.199219 14.878906 L 42.046875 16.320312 C 42.214844 17.882812 43.496094 19.09375 45.066406 19.171875 C 46.636719 19.253906 48.03125 18.183594 48.359375 16.644531 C 48.6875 15.105469 47.847656 13.558594 46.382812 12.992188 C 44.914062 12.425781 43.253906 13.007812 42.464844 14.367188 L 34.625 12.800781 C 34.363281 12.742188 34.09375 12.792969 33.871094 12.9375 C 33.648438 13.082031 33.492188 13.308594 33.441406 13.566406 L 31.070312 24.671875 C 26.617188 24.738281 22.277344 26.105469 18.59375 28.609375 C 17.242188 27.339844 15.273438 26.988281 13.570312 27.707031 C 11.863281 28.429688 10.746094 30.089844 10.71875 31.941406 C 10.691406 33.789062 11.757812 35.484375 13.441406 36.257812 C 13.402344 36.726562 13.402344 37.195312 13.441406 37.664062 C 13.441406 44.832031 21.792969 50.65625 32.097656 50.65625 C 42.398438 50.65625 50.753906 44.832031 50.753906 37.664062 C 50.789062 37.195312 50.789062 36.726562 50.753906 36.257812 C 52.363281 35.453125 53.371094 33.800781 53.34375 32 Z M 21.34375 35.199219 C 21.34375 33.433594 22.777344 32 24.542969 32 C 26.3125 32 27.742188 33.433594 27.742188 35.199219 C 27.742188 36.96875 26.3125 38.398438 24.542969 38.398438 C 22.777344 38.398438 21.34375 36.96875 21.34375 35.199219 Z M 39.9375 44 C 37.664062 45.710938 34.871094 46.582031 32.03125 46.464844 C 29.191406 46.582031 26.398438 45.710938 24.128906 44 C 23.847656 43.65625 23.871094 43.15625 24.183594 42.839844 C 24.5 42.527344 25 42.503906 25.34375 42.785156 C 27.269531 44.195312 29.617188 44.90625 32 44.800781 C 34.386719 44.929688 36.746094 44.242188 38.6875 42.847656 C 39.042969 42.503906 39.605469 42.511719 39.953125 42.863281 C 40.296875 43.21875 40.289062 43.785156 39.9375 44.128906 Z M 39.359375 38.527344 C 37.59375 38.527344 36.160156 37.09375 36.160156 35.328125 C 36.160156 33.5625 37.59375 32.128906 39.359375 32.128906 C 41.128906 32.128906 42.558594 33.5625 42.558594 35.328125 C 42.59375 36.203125 42.269531 37.054688 41.65625 37.6875 C 41.046875 38.316406 40.203125 38.664062 39.328125 38.65625 Z M 39.359375 38.527344"}),m4o=g4o;function y4o(t,{title:e}){return i0(t,"reddit.url"),"https://www.reddit.com/web/submit"+Qs({url:t,title:e})}const A4o=A0("reddit",y4o,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"}),w4o=A4o;function v4o(t,{title:e}){return i0(t,"gab.url"),"https://gab.com/compose"+Qs({url:t,text:e})}A0("gab",v4o,t=>({title:t.title}),{windowWidth:660,windowHeight:640,windowPosition:"windowCenter"});function x4o(t,e){const n=`https://www.reddit.com/api/info.json?limit=1&url=${t}`;hS(n,{param:"jsonp"},(o,r)=>{e(!o&&r&&r.data&&r.data.children.length>0&&r.data.children[0].data.score?r.data.children[0].data.score:void 0)})}pS(x4o);const b4o=e7({color:"#25A3E3",networkName:"telegram",path:"m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957"}),S4o=b4o;function T4o(t,{title:e}){return i0(t,"telegram.url"),"https://telegram.me/share/url"+Qs({url:t,text:e})}const P4o=A0("telegram",T4o,t=>({title:t.title}),{windowWidth:550,windowHeight:400}),C4o=P4o;function R4o(t,{title:e,caption:n,tags:o,posttype:r}){return i0(t,"tumblr.url"),"https://www.tumblr.com/widgets/share/tool"+Qs({canonicalUrl:t,title:e,caption:n,tags:o,posttype:r})}A0("tumblr",R4o,t=>({title:t.title,tags:(t.tags||[]).join(","),caption:t.caption,posttype:t.posttype||"link"}),{windowWidth:660,windowHeight:460});function H4o(t,e){return hS("https://api.tumblr.com/v2/share/stats"+Qs({url:t}),(o,r)=>{e(!o&&r&&r.response?r.response.note_count:void 0)})}pS(H4o);function M4o(t,{title:e,via:n,hashtags:o=[],related:r=[]}){return i0(t,"twitter.url"),i0(Array.isArray(o),"twitter.hashtags is not an array"),i0(Array.isArray(r),"twitter.related is not an array"),"https://twitter.com/intent/tweet"+Qs({url:t,text:e,via:n,hashtags:o.length>0?o.join(","):void 0,related:r.length>0?r.join(","):void 0})}const I4o=A0("twitter",M4o,t=>({hashtags:t.hashtags,title:t.title,via:t.via,related:t.related}),{windowWidth:550,windowHeight:400}),z4o=I4o;function D4o(t,{title:e,separator:n}){return i0(t,"viber.url"),"viber://forward"+Qs({text:e?e+n+t:t})}A0("viber",D4o,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:660,windowHeight:460});function E4o(t,{title:e,image:n,noParse:o,noVkLinks:r}){return i0(t,"vk.url"),"https://vk.com/share.php"+Qs({url:t,title:e,image:n,noparse:o?1:0,no_vk_links:r?1:0})}A0("vk",E4o,t=>({title:t.title,image:t.image,noParse:t.noParse,noVkLinks:t.noVkLinks}),{windowWidth:660,windowHeight:460});function F4o(t,e){window.VK||(window.VK={}),window.VK.Share={count:(r,i)=>{var a,l;return(l=(a=window.VK.callbacks)==null?void 0:a[r])==null?void 0:l.call(a,i)}},window.VK.callbacks=[];const n="https://vk.com/share.php",o=window.VK.callbacks.length;return window.VK.callbacks.push(e),hS(n+Qs({act:"count",index:o,url:t}))}pS(F4o);function k4o(t,{title:e,image:n}){return i0(t,"weibo.url"),"http://service.weibo.com/share/share.php"+Qs({url:t,title:e,pic:n})}A0("weibo",k4o,t=>({title:t.title,image:t.image}),{windowWidth:660,windowHeight:550,windowPosition:"screenCenter"});const L4o=e7({color:"#25D366",networkName:"whatsapp",path:"m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915"}),W4o=L4o;function N4o(){return/(android|iphone|ipad|mobile)/i.test(navigator.userAgent)}function U4o(t,{title:e,separator:n}){return i0(t,"whatsapp.url"),"https://"+(N4o()?"api":"web")+".whatsapp.com/send"+Qs({text:e?e+n+t:t})}const j4o=A0("whatsapp",U4o,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:550,windowHeight:400}),B4o=j4o;function Y4o(t,{quote:e,hashtag:n}){return i0(t,"workplace.url"),"https://work.facebook.com/sharer.php"+Qs({u:t,quote:e,hashtag:n})}A0("workplace",Y4o,t=>({quote:t.quote,hashtag:t.hashtag}),{windowWidth:550,windowHeight:400});const O4o=e7({color:"#000000",networkName:"X",path:"M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z"}),V4o=O4o,_4o=Ho.div` + */var nAo=EJ.ServerValue;function oAo(t){iit(t.SDK_VERSION),t.INTERNAL.registerComponent(new Jb("database",function(e,n){var o=n.instanceIdentifier,r=e.getProvider("app").getImmediate(),i=e.getProvider("auth-internal"),a=e.getProvider("app-check-internal");return new EJ(Mat(r,i,a,o),r)},"PUBLIC").setServiceProps({Reference:tx,Query:Iat,Database:EJ,DataSnapshot:qE,enableLogging:cit,INTERNAL:J6o,ServerValue:nAo,TEST_ACCESS:tAo}).setMultipleInstances(!0)),t.registerVersion(B2o,Y2o)}oAo($n);const rAo=be.memo(()=>{const t=M(owt),e=M(rwt),n=M(yp),o=M(zb),r=M(HW),i=M(Xge),a=m.useRef(),l=n.schoolID??sc.UNKNOWN,s=n.classID??Oa.UNKNOWN;return m.useEffect(()=>{const c={apiKey:"AIzaSyD-236qE4ix9TkH2AW_wjKSz8jgK0ukjW0",authDomain:"aladdin-316017.firebaseapp.com",projectId:"aladdin-316017",storageBucket:"aladdin-316017.appspot.com",databaseURL:"https://aladdin-2024.firebaseio.com",messagingSenderId:"169516488625",appId:"1:169516488625:web:bb0ae3c3f7c6e813250f90"};let u;for(const d of $n.apps)if(d.name===fG.LOG_DATA){u=d;break}u||(u=$n.initializeApp(c,fG.LOG_DATA)),u&&(a.current=$n.database(u))},[]),m.useEffect(()=>{e&&n.uid&&(async()=>{if(a.current){const u=e.timestamp+" ("+ul(new Date(e.timestamp)).format("MM-DD-YYYY hh:mm A")+")";await a.current.ref(l+"/"+s+"/"+n.uid+"/"+u).set(r?{project:i??"Untitled",action:JSON.stringify(e)}:{file:o??"Untitled",action:JSON.stringify(e)})}})().catch(u=>{PR("Data logger error: "+e+" - "+u)})},[e]),m.useEffect(()=>{t&&(async()=>{if(a.current){const u=t.timestamp+" ("+ul(new Date(t.timestamp)).format("MM-DD-YYYY hh:mm A")+")";await a.current.ref(l+"/"+s+"/"+n.uid+"/"+u).set(r?{project:i??"Untitled",action:JSON.stringify(t)}:{file:o??"Untitled",action:JSON.stringify(t)})}})().catch(u=>{PR("Data logger error: "+t+" - "+u)})},[t]),h.jsx(h.Fragment,{})}),iAo=be.memo(()=>{const t=M(bBe)??3.5,e=M(xBe)??.2,n=M(Oq)??$F,o=me.getShadowMapSize(),r=M(Lw),i=M(ay),a=2*i,l=i+100,s=M(Cs),c=m.useRef(null);c.current&&(c.current.shadow.camera.left=-l,c.current.shadow.camera.bottom=-l,c.current.shadow.camera.right=l,c.current.shadow.camera.top=l,c.current.shadow.camera.updateProjectionMatrix());const u=r.z>0,d=u?r.normalize().dot(ko):0;return h.jsxs(h.Fragment,{children:[h.jsx("ambientLight",{intensity:oAt+(u?e*d:0),name:"Ambient Light"}),h.jsx("directionalLight",{ref:c,name:"Directional Light",color:"white",position:r.normalize().multiplyScalar(a),intensity:u?t*d:0,castShadow:s,"shadow-bias":0,"shadow-mapSize-height":o,"shadow-mapSize-width":o,"shadow-camera-near":1,"shadow-camera-far":n})]})}),aAo=be.memo(({element:t})=>{const e=M(Uwt),n=M(Ug),o=M(ly),r=M(Kge),i=t.type===z.Roof,a="lightGray",l=r3(hW,mN),s={font:l,height:0,size:.2},c={font:l,height:0,size:.35},u=m.useMemo(()=>r(t,n??o),[n,o]),d=m.useMemo(()=>{const P=-Math.atan2(e.x,e.y)+Math.PI;return new ln(Qt,0,P,"ZXY")},[e.x,e.y]),f=()=>{let P=t.lz;return i&&(P=M.getState().selectedElementHeight),Math.ceil(P)+1},p=()=>{let P=t.lz;return i&&(P=t.rise),P.toFixed(1)+" m"},g=()=>i?M.getState().selectedElementHeight+1:t.lz-.175;if(!n&&!o)return null;const A=f(),y=p(),S=g(),C=new Array(A+1).fill(0);return h.jsxs("group",{position:u,rotation:d,name:"Vertical Ruler",children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[0,0,0],[0,A,0]],color:a}),h.jsxs("mesh",{position:[-1.5,S,0],userData:{unintersectable:!0},children:[h.jsx("textGeometry",{args:[y,c]}),h.jsx("meshBasicMaterial",{attach:"material",color:"white"})]}),C.map((P,v)=>{const T=.2+(v%5===0?.05:0),w=h.jsx("textGeometry",{args:[`${v}`,s]});return h.jsxs("group",{children:[h.jsx(Gn,{userData:{unintersectable:!0},points:[[-T,v,0],[T,v,0]],lineWidth:.5,color:a}),!i&&h.jsxs("mesh",{position:[.4,v-.125,0],userData:{unintersectable:!0},children:[w,h.jsx("meshBasicMaterial",{attach:"material",color:a})]})]},v)})]})}),lAo=be.memo(()=>{const t=M(Ub),e=M(o$),n=M(Ug),o=M(ly),r=M(mA),i=M(ay),a=M(i$),l=M(r$),s=M(v=>{if(v.selectedElement){const T=v.selectedElement.id;return v.elements.find(w=>w.id===T)}}),[c,u]=m.useState(!1),[d,f]=m.useState(2*i),[p,g]=m.useState(2*i);m.useEffect(()=>{const v=Math.floor(i/50)+1,T=Math.round(i/v)*2;f(T*v),g(T)},[i]),m.useEffect(()=>{if(n){const v=me.isTopResizeHandle(n)||n===Mt.UpperLeft&&(s==null?void 0:s.type)===z.Wall||n===Mt.UpperRight&&(s==null?void 0:s.type)===z.Wall;u(!v)}else u(!1)},[n,s==null?void 0:s.type]);const A=()=>{if(!s)return!1;const v=s.type;return v===z.Foundation||v===z.Cuboid||v===z.Tree&&s.parentId===z.Ground||v===z.Human&&s.parentId===z.Ground},y=o===Di.Lower||o===Di.Upper,P=(v=>me.isTopResizeHandle(v)||(s==null?void 0:s.type)===z.Wall&&me.isTopResizeHandleOfWall(v)||(s==null?void 0:s.type)===z.Roof&&me.isRiseHandleOfRoof(v))(n??o);return s?h.jsxs(h.Fragment,{children:[((c||t||me.isMoveHandle(o))&&!r&&A()||a||l)&&h.jsx("gridHelper",{rotation:[Qt,0,0],name:"Grid",args:[d,p,"gray","#444444"]}),(e||y)&&s&&A()&&h.jsx(_ye,{element:s}),P&&h.jsx(aAo,{element:s})]}):null}),dle=120,iv="DarkSlateGray",dD="white",sAo=be.memo(({visible:t=!0})=>{const e=m.useRef(null),n=$t(),o=window.devicePixelRatio,r=dle*o,i=r/150,l=20*i+"px serif";return m.useEffect(()=>{e.current&&kn.setState({compassRef:e})},[]),m.useEffect(()=>{if(!e.current||!t)return;const s=e.current.getContext("2d");if(!s)return;const c=55*i,u=10*i,d=40*i,f=5*i,p=30*i,g=i,A=i,y=15*i,S=r/2;s.clearRect(0,0,r,r),s.beginPath(),s.arc(S,S,d,0,Math.PI*2),s.lineWidth=f,s.strokeStyle=iv,s.stroke(),s.beginPath(),s.arc(S,S,p,0,Math.PI*2),s.lineWidth=g,s.strokeStyle=iv,s.stroke(),s.lineWidth=A,s.beginPath(),s.moveTo(S,S-c),s.lineTo(S-u,S-u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S-c),s.lineTo(S+u,S-u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S+c),s.lineTo(S-u,S+u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S,S+c),s.lineTo(S+u,S+u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S-c,S),s.lineTo(S-u,S-u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S-c,S),s.lineTo(S-u,S+u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S+c,S),s.lineTo(S+u,S-u),s.lineTo(S,S),s.fillStyle=dD,s.stroke(),s.fill(),s.beginPath(),s.moveTo(S+c,S),s.lineTo(S+u,S+u),s.lineTo(S,S),s.fillStyle=iv,s.stroke(),s.fill(),s.font=l,s.fillStyle=dD,s.textAlign="center",s.fillText(`${Y.t("compass.N",n)}`,S,y),s.save(),s.translate(r,r),s.rotate(Math.PI),s.fillText(`${Y.t("compass.S",n)}`,S,y),s.restore(),s.fillStyle=iv,s.save(),s.translate(0,r),s.rotate(-Math.PI/2),s.fillText(`${Y.t("compass.W",n)}`,S,y),s.restore(),s.save(),s.translate(r,0),s.rotate(Math.PI/2),s.fillText(`${Y.t("compass.E",n)}`,S,y),s.restore()},[n,t]),t?h.jsx("canvas",{ref:e,id:"compassCanvas",width:r,height:r,style:{position:"absolute",bottom:"0",right:"0",height:`${dle}px`,width:`${dle}px`,margin:"5px",pointerEvents:"none"}}):null});var zat={exports:{}};(function(t,e){(function(n,o){t.exports=o(m,Bq)})(window,function(n,o){return function(r){var i={};function a(l){if(i[l])return i[l].exports;var s=i[l]={i:l,l:!1,exports:{}};return r[l].call(s.exports,s,s.exports,a),s.l=!0,s.exports}return a.m=r,a.c=i,a.d=function(l,s,c){a.o(l,s)||Object.defineProperty(l,s,{enumerable:!0,get:c})},a.r=function(l){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})},a.t=function(l,s){if(1&s&&(l=a(l)),8&s||4&s&&typeof l=="object"&&l&&l.__esModule)return l;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:l}),2&s&&typeof l!="string")for(var u in l)a.d(c,u,(function(d){return l[d]}).bind(null,u));return c},a.n=function(l){var s=l&&l.__esModule?function(){return l.default}:function(){return l};return a.d(s,"a",s),s},a.o=function(l,s){return Object.prototype.hasOwnProperty.call(l,s)},a.p="",a(a.s=0)}([function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=a(1);Object.defineProperty(i,"default",{enumerable:!0,get:function(){return function(s){return s&&s.__esModule?s:{default:s}}(l).default}}),r.exports=i.default},function(r,i,a){Object.defineProperty(i,"__esModule",{value:!0});var l=Object.assign||function(A){for(var y=1;y0&&p[0]!==this)return!1;var R=S.target===document.body||b,H=this.childrenContainer&&this.childrenContainer.contains(S.target);if(!(x?H:R))return!1;var F=(0,d.findMatchedKey)(S,v);return!!F&&(T(F,S),!0)}},{key:"render",value:function(){var S=this,C=this.props.children,P=Object.assign({},this.props),v=!0,T=!1,w=void 0;try{for(var x,b=Object.keys(y.propTypes)[Symbol.iterator]();!(v=(x=b.next()).done);v=!0)delete P[x.value]}catch(R){T=!0,w=R}finally{try{!v&&b.return&&b.return()}finally{if(T)throw w}}return C?c.default.createElement("span",l({ref:function(R){S.childrenContainer=R}},P),C):null}}]),y}();i.default=g,g.propTypes={handleKeys:u.default.array,handleEventType:u.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:u.default.bool,onKeyEvent:u.default.func,isDisabled:u.default.bool,isExclusive:u.default.bool,children:u.default.any},g.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},r.exports=i.default},function(r,i){r.exports=n},function(r,i){r.exports=o},function(r,i,a){function l(C,P,v){return P in C?Object.defineProperty(C,P,{value:v,enumerable:!0,configurable:!0,writable:!0}):C[P]=v,C}Object.defineProperty(i,"__esModule",{value:!0}),i.matchKeyEvent=S,i.findMatchedKey=function(C,P){var v=P.map(function(T){var w=T.toLowerCase(),x=y[w];return x||[T]}).reduce(function(T,w){return T.concat(w)},[]).find(function(T){return S(C,T)});return!v&&P.includes("all")&&(v="other"),v};var s={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},c=Object.keys(s).reduce(function(C,P){return Object.assign(C,l({},P.toUpperCase(),s[P]))},{}),u="0123456789".split("").reduce(function(C,P,v){return Object.assign(C,l({},P,[v+48,v+96]))},{}),d="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(C,P,v){return Object.assign(C,l({},P.toLowerCase(),[v+65]),l({},P,[v+65]))},{}),f="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(C,P,v){return Object.assign(C,l({},"f"+P,[v+112]))},{}),p={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},g=i.AllKeys=Object.assign({},s,c,u,d,f),A=Object.assign({},u,d),y={all:Object.keys(g),alphanumeric:Object.keys(A),numeric:Object.keys(u),alphabetic:Object.keys(d),function:Object.keys(f)};function S(C,P){var v=C.which||C.keyCode,T=C.type,w=Object.keys(p).filter(function(U){return C[U+"Key"]}).sort(),x=P.toLowerCase().trim(),b=x==="+"?["+"]:x.split(/\s?\+\s?/),R=b.pop(),H=g[R],F=b;if(T==="keypress")return P==String.fromCharCode(v).toLowerCase();if(F.length===0&&w.length===0)return H.indexOf(v)>=0;if(F.length>0&&w.length>0){var E=F.map(function(U){return p[U]}).sort(),N=E.length===w.length&&E.every(function(U,W){return w[W]===U});return H.indexOf(v)>=0&&N}return F.length==0&&w.length===1&&R===w[0]}}])})})(zat);var cAo=zat.exports;const dze=Wi(cAo),uAo=be.memo(()=>{var s,c;const t=M(pn),e=M(Zge),n=M(Qge),o=M(En),r=m.useRef(!1),i=m.useRef(!1);M(TOe),M(POe),dt(u=>u.selectedElementId),m.useEffect(()=>{kn.setState({listenToAutoDeletionByDeleteRef:r,listenToAutoDeletionByCutRef:i})},[]);const a=k2.debounce(()=>{var v,T;const u=dt.getState().selectedElementId,d=M.getState().selectedElementIdSet;if(!u||d.size===0)return;const f=M.getState().getAutoDeletedElements();if(!f)return;const p=M.getState().deletedElements,g=M.getState().elementsToPaste,A=(v=kn.getState().listenToAutoDeletionByCutRef)==null?void 0:v.current,y=(T=kn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:T.current;let S=[],C="";A?(kn.getState().setListenToAutoDeletionByCut(!1),S=[...g,...f],C="Cut"):y&&(kn.getState().setListenToAutoDeletionByDelete(!1),S=[...p,...f],C="Delete");const P={name:C,timestamp:Date.now(),deletedElements:[...S],selectedElementId:u,selectedElementIdSet:new Set(d),undo(){const w=P.deletedElements;if(!w||w.length===0)return;for(const b of this.deletedElements)if(b.type===z.Wall){const R=b;R.leftJoints.length>0&&e(R.leftJoints[0],[R.id]),R.rightJoints.length>0&&n(R.rightJoints[0],[R.id])}else b.type===z.Roof&&t(R=>{R.addedRoofIdSet.add(b.id)});const x=w.find(b=>b.id===this.selectedElementId)??null;t(b=>{b.elements.push(...w),b.selectedElement=x,b.selectedElementIdSet=new Set(this.selectedElementIdSet),b.updateWallMapOnFoundationFlag=!b.updateWallMapOnFoundationFlag,b.deletedRoofId=null,b.autoDeletedRoofs=null,b.deletedRoofIdSet.clear(),b.autoDeletedRoofIdSet.clear(),b.autoDeletedChild=null})},redo(){P.deletedElements.length!==0&&(t(w=>{w.selectedElement=w.elements.find(x=>x.id===this.selectedElementId)??null,w.selectedElementIdSet=new Set(this.selectedElementIdSet)}),M.getState().removeSelectedElements())}};o(P),t(w=>{w.selectedElement=null,w.selectedElementIdSet.clear(),w.deletedRoofId=null,w.deletedRoofIdSet.clear(),w.autoDeletedRoofs=null,w.autoDeletedRoofIdSet.clear(),w.autoDeletedChild=null}),dt.getState().setPrimitiveStore("selectedElementId",null)},50);return(((s=kn.getState().listenToAutoDeletionByCutRef)==null?void 0:s.current)||((c=kn.getState().listenToAutoDeletionByDeleteRef)==null?void 0:c.current))&&M.getState().getAutoDeletedElements()&&a(),null}),fze=["left","up","right","down","shift+left","shift+up","shift+right","shift+down","ctrl+shift+left","ctrl+shift+up","ctrl+shift+right","ctrl+shift+down","meta+shift+left","meta+shift+up","meta+shift+right","meta+shift+down","ctrl+f","meta+f","ctrl+o","meta+o","ctrl+s","meta+s","ctrl+c","meta+c","ctrl+x","meta+x","ctrl+v","meta+v","ctrl+[","meta+[","ctrl+]","meta+]","ctrl+z","meta+z","ctrl+y","meta+y","ctrl+m","meta+m","ctrl+u","meta+u","ctrl+b","meta+b","shift","esc","ctrl+home","ctrl+alt+h","ctrl+shift+o","meta+shift+o","ctrl+shift+s","meta+shift+s","delete","backspace","alt+backspace","f2","f4","ctrl"],dAo=be.memo(({canvas:t})=>{const e=M(pn),n=M(oa),o=M(RW),r=M(m0),i=M(Fge),a=M(En),l=M(Ju)??!1,s=M(Db),c=M(Jn),u=M(BYe),d=M(Ap),f=M(y7t),p=M(Gr),g=M(Qge),A=M(Zge),y=M(P7t),S=M(Nge),C=.1,P=m.useMemo(()=>({lng:r}),[r]),v=(V,G)=>(t&&(t.style.cursor="default"),d(V,G)),T=()=>{if(M.getState().viewState.navigationView)return;const V=M.getState().set2DView,G={name:"Set 2D View",timestamp:Date.now(),checked:!l,undo:()=>{V(!G.checked)},redo:()=>{V(G.checked)}};a(G),V(!l),e(q=>{q.viewState.autoRotate=!1})},w=()=>{if(l)return;const V=M.getState().setNavigationView,G={name:"Set Navigation View",timestamp:Date.now(),checked:!M.getState().viewState.navigationView,undo:()=>{V(!G.checked)},redo:()=>{V(G.checked)}};a(G),V(!M.getState().viewState.navigationView),e(q=>{q.viewState.autoRotate=!1})},x=()=>{if(l)return;const V={name:"Auto Rotate",timestamp:Date.now(),checked:!M.getState().viewState.autoRotate,undo:()=>{e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=!V.checked})},redo:()=>{e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=V.checked})}};a(V),e(G=>{G.objectTypeToAdd=z.None,G.groupActionMode=!1,G.viewState.autoRotate=!G.viewState.autoRotate})},b=(V,G,q)=>{const $=JSON.parse(JSON.stringify(V));if($.cx=G,$.cy=q,V.type===z.SolarPanel&&V.parentType===z.Roof){if(V.parentId&&V.foundationId){const ie=c(V.parentId),Q=c(V.foundationId);if(ie&&Q){const se=bn.getRoofBoundaryVertices(ie),oe=bn.getSolarPanelVerticesOnRoof($,Q);if(!g$e(oe,se)||!m$e($,Q,oe))return!1}}return!0}if(S($))return co(Y.t("message.MoveCancelledBecauseOfOverlap",P)),!1;if($.type===z.SolarPanel){const ie=p(V);if(ie&&!me.isSolarCollectorWithinHorizontalSurface($,ie))return co(Y.t("message.MoveOutsideBoundaryCancelled",P)),!1}return!0},R=V=>{switch(V.type){case z.Roof:case z.Door:case z.Window:return!1;case z.SolarPanel:case z.Sensor:case z.Light:{const G=V;return G.parentType===z.Wall||G.parentType===z.Roof?!1:G.parentType===z.Cuboid?G.rotation[2]===1:!0}case z.Wall:{const G=V;return!(G.leftJoints.length!==0||G.rightJoints.length!==0)}default:return!0}},H=(V,G)=>{switch(V){case z.Foundation:case z.Cuboid:return G===z.Foundation||G===z.Cuboid;default:return G!==z.Foundation&&G!==z.Cuboid}},F=V=>{const G=M.getState().elements.filter(Q=>Ad(Q)&&Q.parentId===Zo),q=new Set(V.map(Q=>Q.id)),$=new Map;for(const Q of G){const se=me.fetchFoundationVertexCoordinates(Q);$.set(Q.id,se)}const ie=Q=>{for(const se of G)!q.has(se.id)&&me.areBasesOverlapped(Q.id,se.id,$)&&(q.add(se.id),V.push(se),se.enableGroupMaster&&ie(se))};for(const Q of V)Q.enableGroupMaster&&ie(Q)},E=()=>{const V=[],G=M.getState().selectedElementIdSet,q=s();if(!q||G.size===0)return V;if(q){const $=q.type,ie=q.parentId,Q=M.getState().elements.filter(se=>H($,se.type)&&R(se)&&se.parentId===ie&&G.has(se.id));V.push(...Q),Ad(q)&&V.length>0&&ie===Zo&&F(V)}return V},N=(V,G,q,$)=>{switch($){case Sl.Left:return[V-q,G];case Sl.Right:return[V+q,G];case Sl.Up:return[V,G+q];case Sl.Down:return[V,G-q]}},U=(V,G)=>{e(q=>{var ie,Q;let $=!1;for(const se of q.elements)if(V.has(se.id)){const oe=V.get(se.id);if(oe!==void 0){const[Z,te]=N(se.cx,se.cy,oe,G);if(se.type===z.Wall){const ee=se,de=new le(Z-ee.cx,te-ee.cy),fe=new le().fromArray(ee.leftPoint).setZ(0).add(de),pe=new le().fromArray(ee.rightPoint).setZ(0).add(de);ee.leftPoint=fe.toArray(),ee.rightPoint=pe.toArray(),$=!0}se.cx=Z,se.cy=te}}else q.selectedElementIdSet.has(se.id)&&q.selectedElementIdSet.delete(se.id);((ie=q.selectedElement)==null?void 0:ie.type)===z.Cuboid||((Q=q.selectedElement)==null?void 0:Q.type)===z.Foundation?q.groupActionUpdateFlag=!q.groupActionUpdateFlag:$&&(q.updateWallMapOnFoundationFlag=!q.updateWallMapOnFoundationFlag)})},W=(V,G)=>{e(q=>{for(const $ of q.elements)(me.isFoundationOrCuboid($)||me.isPlantOrHuman($)&&$.parentId===Zo)&&([$.cx,$.cy]=N($.cx,$.cy,V,G))})},k=V=>V===Sl.Left?Sl.Right:V===Sl.Right?Sl.Left:V===Sl.Up?Sl.Down:V===Sl.Down?Sl.Up:(console.error("Undo direction is possibly incorrect:",V),V),D=(V,G)=>{if(!l)return;const q=E(),$=s(),ie=G*C;if($&&q.length>0){const Q=new Map;for(const oe of q)switch(oe.type){case z.Foundation:case z.Cuboid:case z.Wall:case z.Tree:case z.Flower:case z.Human:{Q.set(oe.id,ie);break}case z.Light:case z.Sensor:{const Z=p($);if(Z){let te=ie/Z.lx;const[ee,de]=N(oe.cx,oe.cy,te,V),fe=oe.lx/(2*Z.lx),pe=oe.lx/(2*Z.ly);switch(V){case Sl.Left:case Sl.Right:{const ye=me.clamp(ee,-.5+fe,.5-fe);te=Math.abs(ye-$.cx);break}case Sl.Up:case Sl.Down:{const ye=me.clamp(de,-.5+pe,.5-pe);te=Math.abs(ye-$.cy);break}}Q.set(oe.id,te)}break}case z.SolarPanel:case z.ParabolicDish:case z.ParabolicTrough:case z.FresnelReflector:case z.Heliostat:{const Z=p(oe);if(Z){let te=!0,ee=ie;switch(V){case Sl.Left:case Sl.Right:{ee=ie/Z.lx;break}case Sl.Up:case Sl.Down:{ee=ie/Z.ly;break}}if(oe.type===z.SolarPanel){const[de,fe]=N(oe.cx,oe.cy,ee,V);te=b(oe,de,fe)}if(te)Q.set(oe.id,ee);else return}break}}U(Q,V);const se={name:`Move Selected Elements ${V} By Key`,timestamp:Date.now(),direction:V,movedElementsDisplacementMap:new Map(Q),undo:()=>{const oe=k(se.direction);U(se.movedElementsDisplacementMap,oe)},redo:()=>{U(se.movedElementsDisplacementMap,se.direction)}};a(se)}else{W(ie,V);const Q={name:`Move All ${V} By Key`,timestamp:Date.now(),direction:V,displacement:ie,undo:()=>{const se=k(Q.direction);W(Q.displacement,se)},redo:()=>{W(Q.displacement,Q.direction)}};a(Q)}},L=V=>{M.getState().set(G=>{G.multiSelectionsMode=V})},j=V=>{const G=s(),q=1;switch(V){case"left":D(Sl.Left,q);break;case"shift+left":D(Sl.Left,q/Z5);break;case"ctrl+shift+left":case"meta+shift+left":D(Sl.Left,q*Z5);break;case"right":D(Sl.Right,q);break;case"shift+right":D(Sl.Right,q/Z5);break;case"ctrl+shift+right":case"meta+shift+right":D(Sl.Right,q*Z5);break;case"down":D(Sl.Down,q);break;case"shift+down":D(Sl.Down,q/Z5);break;case"ctrl+shift+down":case"meta+shift+down":D(Sl.Down,q*Z5);break;case"up":D(Sl.Up,q);break;case"shift+up":D(Sl.Up,q/Z5);break;case"ctrl+shift+up":case"meta+shift+up":D(Sl.Up,q*Z5);break;case"ctrl+[":case"meta+[":xX(.9);break;case"ctrl+]":case"meta+]":xX(1.1);break;case"ctrl+c":case"meta+c":G&&G.type!==z.Roof&&(u(G.id),e($=>{$.selectedElementIdSet.clear(),$.selectedElementIdSet.add(G.id)}),n&&e($=>{$.actionInfo={name:"Copy",timestamp:new Date().getTime(),elementId:G.id,elementType:G.type}}));break;case"ctrl+x":case"meta+x":if(!G||G.type===z.Roof)break;if(G.locked)gn(Y.t("message.ThisElementIsLocked",P));else{const $=v(G.id,!0);if($.length===0)break;if(me.isElementTriggerAutoDeletion(G))kn.getState().setListenToAutoDeletionByCut(!0),dt.getState().setPrimitiveStore("selectedElementId",G.id);else{const ie={name:"Cut",timestamp:Date.now(),deletedElements:$,selectedElementId:G.id,undo:()=>{const Q=ie.deletedElements;if(Q.length===0)return;const se=Q.find(oe=>oe.id===ie.selectedElementId);se&&e(oe=>{if(oe.elements.push(...Q),oe.selectedElementIdSet.clear(),oe.selectedElementIdSet.add(se.id),oe.selectedElement=se,se.type===z.Wall){const Z=se;let te=null,ee=null;if(Z.leftJoints.length>0&&(te=Z.leftJoints[0]),Z.rightJoints.length>0&&(ee=Z.rightJoints[0]),te||ee)for(const de of oe.elements)de.id===te&&de.type===z.Wall&&(de.rightJoints[0]=Z.id),de.id===ee&&de.type===z.Wall&&(de.leftJoints[0]=Z.id)}})},redo:()=>{ie.deletedElements&&ie.deletedElements.length>0&&v(ie.deletedElements[0].id,!0)}};a(ie)}}break;case"ctrl+v":case"meta+v":{const $=f();if($.length>0){const ie={name:"Paste by Key",timestamp:Date.now(),pastedElements:JSON.parse(JSON.stringify($)),undo:()=>{for(const Q of ie.pastedElements)d(Q.id,!1)},redo:()=>{e(Q=>{Q.elements.push(...ie.pastedElements),Q.selectedElement=ie.pastedElements[0]})}};a(ie)}break}case"ctrl+alt+h":case"ctrl+home":{if(!l){const $=M.getState().viewState.cameraPosition,ie=M.getState().viewState.panCenter;if($[0]!==$[1]||$[1]!==$[2]||$[0]!==$[2]||ie[0]!==0||ie[1]!==0||ie[2]!==0){const Q={name:"Reset View",timestamp:Date.now(),oldCameraPosition:[...$],oldPanCenter:[...ie],undo:()=>{const se=kn.getState().orbitControlsRef;se!=null&&se.current&&(se.current.object.position.set(Q.oldCameraPosition[0],Q.oldCameraPosition[1],Q.oldCameraPosition[2]),se.current.target.set(Q.oldPanCenter[0],Q.oldPanCenter[1],Q.oldPanCenter[2]),se.current.update(),e(oe=>{const Z=oe.viewState;Z.cameraPosition=[...Q.oldCameraPosition],Z.panCenter=[...Q.oldPanCenter]}))},redo:()=>{vX()}};a(Q),e(se=>{se.objectTypeToAdd=z.None,se.groupActionMode=!1,se.viewState.orthographic=!1}),vX()}}break}case"f2":case"ctrl+b":case"meta+b":T();break;case"ctrl+u":case"meta+u":w();break;case"f4":case"ctrl+m":case"meta+m":x();break;case"ctrl+f":case"meta+f":dt.getState().set($=>{$.createNewFileFlag=!0,$.openModelsMap=!1}),e($=>{$.objectTypeToAdd=z.None,$.groupActionMode=!1,window.history.pushState({},document.title,t1),n&&($.actionInfo={name:"Create New File",timestamp:new Date().getTime()})});break;case"ctrl+s":case"meta+s":dt.getState().set($=>{$.saveLocalFileDialogVisible=!0}),n&&e($=>{$.actionInfo={name:"Save Local File",timestamp:new Date().getTime()}});break;case"ctrl+shift+o":case"meta+shift+o":dt.getState().set($=>{$.listCloudFilesFlag=!0,$.openModelsMap=!1}),n&&e($=>{$.actionInfo={name:"List Cloud Files",timestamp:new Date().getTime()}});break;case"ctrl+shift+s":case"meta+shift+s":dt.getState().setSaveCloudFileFlag(!0),n&&e($=>{$.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}});break;case"alt+backspace":case"backspace":case"delete":{const $=M.getState().selectedElementIdSet;if(!G||$.size===0)break;const ie=M.getState().removeSelectedElements();if(ie.length===0)break;if((()=>{const se=ie.filter(te=>te.type===z.Foundation),oe=new Set(se.map(te=>te.id));return!!ie.find(te=>!oe.has(te.parentId)&&me.isElementTriggerAutoDeletion(te))})())kn.getState().setListenToAutoDeletionByDelete(!0),dt.getState().setPrimitiveStore("selectedElementId",G.id);else{if(ie.length===1){const se={name:"Delete",timestamp:Date.now(),deletedElements:[...ie],selectedElementId:G.id,undo:()=>{const oe=se.deletedElements;if(!oe||oe.length===0)return;const Z=oe.find(te=>te.id===se.selectedElementId);if(Z&&(e(te=>{te.elements.push(...oe),te.selectedElementIdSet.clear(),te.selectedElementIdSet.add(Z.id),te.selectedElement=Z,te.updateWallMapOnFoundationFlag=!te.updateWallMapOnFoundationFlag,te.deletedRoofId=null,te.deletedRoofIdSet.clear()}),Z.type===z.Wall)){const te=Z;te.leftJoints.length>0&&A(te.leftJoints[0],[te.id]),te.rightJoints.length>0&&g(te.rightJoints[0],[te.id])}},redo:()=>{const oe=se.deletedElements;if(!oe||oe.length===0)return;const Z=oe.find(te=>te.id===se.selectedElementId);Z&&v(Z.id,!1)}};a(se)}else{const se={name:"Delete Multiple",timestamp:Date.now(),deletedElements:[...ie],selectedElementId:G.id,selectedElementIdSet:new Set($),undo(){const oe=this.deletedElements;if(!oe||oe.length===0)return;const Z=oe.find(te=>te.id===this.selectedElementId);if(Z){e(te=>{te.elements.push(...oe),te.selectedElement=Z,te.selectedElementIdSet=new Set(this.selectedElementIdSet),te.updateWallMapOnFoundationFlag=!te.updateWallMapOnFoundationFlag,te.deletedRoofId=null,te.deletedRoofIdSet.clear()});for(const te of this.deletedElements)if(te.type===z.Wall){const ee=te;ee.leftJoints.length>0&&A(ee.leftJoints[0],[ee.id]),ee.rightJoints.length>0&&g(ee.rightJoints[0],[ee.id])}}},redo(){e(oe=>{oe.selectedElement=oe.elements.find(Z=>Z.id===this.selectedElementId)??null,oe.selectedElementIdSet=new Set(this.selectedElementIdSet)}),M.getState().removeSelectedElements()}};a(se)}e(se=>{se.selectedElement=null,se.selectedElementIdSet.clear()})}break}case"ctrl+z":case"meta+z":if(i.hasUndo()){const $=i.undo();M.getState().groupActionMode&&e(ie=>{ie.groupActionUpdateFlag=!ie.groupActionUpdateFlag}),$&&gn(Y.t("menu.edit.Undo",P)+": "+$,gG),n&&e(ie=>{ie.actionInfo={name:"Undo",timestamp:new Date().getTime()}})}break;case"ctrl+y":case"meta+y":if(i.hasRedo()){const $=i.redo();$&&gn(Y.t("menu.edit.Redo",P)+": "+$,gG),M.getState().groupActionMode&&e(ie=>{ie.groupActionUpdateFlag=!ie.groupActionUpdateFlag}),n&&e(ie=>{ie.actionInfo={name:"Redo",timestamp:new Date().getTime()}})}break;case"shift":M.getState().viewState.navigationView&&dt.getState().set($=>{$.navigationMoveSpeed=5*M.getState().minimumNavigationMoveSpeed,$.navigationTurnSpeed=5*M.getState().minimumNavigationTurnSpeed}),y(!0);break;case"esc":{const $=M.getState().addedFoundationId,ie=M.getState().addedCuboidId,Q=M.getState().addedWallId,se=M.getState().addedWindowId,oe=M.getState().addedDoorId;$?d($,!1):ie?d(ie,!1):Q?d(Q,!1):se?(d(se,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",se)):oe&&(d(oe,!1),dt.getState().setPrimitiveStore("elementBeingCanceledId",oe)),e(Z=>{Z.objectTypeToAdd=z.None,Z.actionModeLock=!1,Z.moveHandleType=null,Z.resizeHandleType=null,Z.groupActionMode=!1}),kn.getState().setEnableOrbitController(!0),o();break}case"ctrl":{L(!0);break}}},B=V=>{switch(V){case"shift":M.getState().viewState.navigationView&&dt.getState().set(G=>{G.navigationMoveSpeed=M.getState().minimumNavigationMoveSpeed,G.navigationTurnSpeed=M.getState().minimumNavigationTurnSpeed}),y(!1);break;case"ctrl+o":case"meta+o":M.getState().localFileDialogRequested||(dt.getState().set(G=>{G.openLocalFileFlag=!0}),e(G=>{G.localFileDialogRequested=!0,n&&(G.actionInfo={name:"Open Local File",timestamp:new Date().getTime()})}));break;case"ctrl":{L(!1);break}}};m.useEffect(()=>()=>{O.current=null},[]);const O=m.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsx(dze,{handleKeys:fze,handleEventType:"keydown",onKeyEvent:(V,G)=>{G.preventDefault(),O.current!==V&&(O.current=V,j(V))}}),h.jsx(dze,{handleKeys:fze,handleEventType:"keyup",onKeyEvent:(V,G)=>{G.preventDefault(),O.current=null,B(V)}}),h.jsx(uAo,{})]})}),fAo="/aladdin/assets/cloud-B68yt6QG.png",hAo=be.memo(()=>{const t=M(pn),e=M(Nwt),{scene:n}=ri();m.useEffect(()=>{const r=n.children.filter(l=>l.name==="Content"),i=[];if(r.length>0){const l=r[0].children;for(const s of l)o(s,i)}const a=[];for(const l of i)a.push(new vf().setFromObject(l));if(a.length>0){const l=new le,s=new le;for(const u of a)l.min(u.min),s.max(u.max);let c=Math.abs(l.x);c{u.aabb=new vf(l,s),!isNaN(c)&&isFinite(c)&&(u.sceneRadius=Math.round(Math.max(10,c*1.25)))})}},[e]);const o=(r,i)=>{if(r.userData.aabb&&i.push(r),r.children.length>0)for(const a of r.children)o(a,i)};return h.jsx(h.Fragment,{})}),Gfe=t=>{const e=new le().subVectors(t.localToWorld(new le(0,0,1e3)),t.position);return e.x===0&&e.y===0&&t.getWorldDirection(e),e},tP=t=>{const e=document.getElementById("compassCanvas"),n=o=>{dt.getState().set(r=>{r.isCameraUnderGround=o})};if(e){const o=Gfe(t).normalize(),i=(Math.atan2(o.y,o.x)+Math.PI/2)/Math.PI*180;e.style.transform=`rotate(${i}deg)`;const a=t.position.z<.001;a&&!dt.getState().isCameraUnderGround?n(!0):!a&&dt.getState().isCameraUnderGround&&n(!1)}},pAo=be.memo(()=>{const t=M(pn),e=M(Ju),n=M(z4t),o=M(RBe),r=M(FH),i=M(ay),a=M(D4t),l=M(E4t),s=M(Oq)??$F,c=M(Yq),u=dt(Y8t),d=dt(O8t),f=M($Be),p=dt(oYe),g=c&&!e,A=Math.hypot(a[0],a[1],a[2]),y=(e?l*50:A*10)*i,S=m.useMemo(()=>new le(-y,-y,0),[y]),C=m.useMemo(()=>new le(y,y,y/2),[y]),{gl:P,invalidate:v,get:T,set:w,camera:x}=ri(),b=m.useMemo(()=>{const L=T().camera;return L.up.set(0,0,1),L},[]),R=m.useMemo(()=>P.domElement,[]),H=m.useRef(null),F=m.useRef(null),E=m.useRef(null);m.useEffect(()=>{kn.setState({canvas:{gl:P,camera:x}}),!e&&F.current&&kn.setState({canvas:{gl:P,camera:F.current}})},[e]),m.useEffect(()=>{M.getState().viewState.cameraPosition2D[2]<100&&t(L=>{L.viewState.cameraPosition2D[2]=150})},[]),m.useEffect(()=>{H&&H.current&&kn.setState({orbitControlsRef:H})},[]),m.useEffect(()=>{H.current&&(H.current.addEventListener("change",N),H.current.addEventListener("start",U),H.current.addEventListener("end",W));const L=H.current;return()=>{L&&(L.removeEventListener("change",N),L.removeEventListener("start",U),L.removeEventListener("end",W))}},[g]),m.useEffect(()=>{const L=M.getState().viewState;if(H.current){if(F.current){if(g){const j=T().camera,B=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(B),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"])}else{const j=k(L.cameraPosition??[0,0,20]),B=k(L.panCenter??[0,0,0]);F.current.position.copy(j),F.current.lookAt(B),F.current.zoom=1,e||(H.current.object=F.current,H.current.target.copy(B))}x.updateMatrixWorld(),tP(T().camera)}if(E.current){const j=k(L.cameraPosition2D??[0,0,1e3]).setZ(1e3),B=k(L.panCenter2D??[0,0,0]);E.current.position.copy(j),E.current.rotation.set(0,0,0),E.current.lookAt(B),E.current.zoom=L.cameraZoom,e&&(H.current.object=E.current,H.current.target.copy(B))}}},[r]),m.useEffect(()=>{if(!E.current||!F.current||!H.current)return;const L=M.getState().viewState,j=H.current,B=E.current,O=F.current;e?(B.rotation.set(0,0,0),j.object=B,j.target.copy(k(L.panCenter2D??[0,0,0])),w({camera:B})):(j.object=O,j.target.copy(k(L.panCenter??[0,0,0])),w({camera:O}),tP(T().camera))},[e]),m.useEffect(()=>{e&&H.current&&(E.current&&(E.current.zoom=l,H.current.object=E.current),N(),H.current.update())},[l]);const N=()=>{v(),M.getState().viewState.orthographic||(tP(T().camera),H.current&&H.current.target.clamp(S,C))},U=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!0})},W=()=>{dt.getState().set(L=>{L.duringCameraInteraction=!1}),t(L=>{if(!H.current)return;const j=L.viewState,B=T().camera,O=B.position,V=H.current.target;j.orthographic?(B.zoom&&!isNaN(B.zoom)?j.cameraZoom=B.zoom:j.cameraZoom=20,j.cameraPosition2D=[O.x,O.y,150],j.panCenter2D=[V.x,V.y,V.z]):g?(j.cameraPositionNav=[O.x,O.y,O.z],j.cameraRotationNav=[B.rotation.x,B.rotation.y,B.rotation.z],L.cameraDirection=Gfe(B)):(j.cameraPosition=[O.x,O.y,O.z],j.panCenter=[V.x,V.y,V.z],L.cameraDirection=Gfe(B))})},k=L=>L&&Array.isArray(L)?new le(L[0],L[1],L[2]):L&&L.x!==null?new le(L.x,L.y,L.z):new le(0,0,5);Z2(()=>{o&&H.current&&H.current.update()});const D=kn(L=>L.compassRef);return m.useEffect(()=>{tP(T().camera)},[D]),m.useEffect(()=>{H.current&&(g&&!p&&!f?H.current.listenToKeyEvents(window):H.current.removeKeyEvents())},[g,p,f]),m.useEffect(()=>{if(!H.current)return;const L=M.getState().viewState;if(g){const j=T().camera,B=L.cameraPositionNav??[5,-30,1],O=L.cameraRotationNav??[1.5374753309166491,.16505866097993566,.005476951734475092];j.position.fromArray(B),j.rotation.fromArray([O[0],O[1],O[2],"XYZ"]),j.updateMatrixWorld(),tP(T().camera)}else if(H.current&&F.current){const j=k(L.cameraPosition??[0,0,20]),B=k(L.panCenter??[0,0,0]);F.current.position.copy(j),F.current.lookAt(B),F.current.zoom=1,e||(H.current.object=F.current,H.current.target.copy(B)),F.current.updateMatrixWorld(),tP(F.current)}v()},[g]),h.jsxs(h.Fragment,{children:[h.jsx(f4t,{ref:F,fov:lje,far:s,up:[0,0,1]}),h.jsx(u4t,{ref:E,up:[0,0,1]}),h.jsx("myOrbitControls",{ref:H,args:[b,R],autoRotate:o,enableRotate:n,enablePan:!0,enableZoom:!0,enableDamping:!1,maxAzimuthAngle:1/0,minAzimuthAngle:-1/0,maxPolarAngle:Qt,minPolarAngle:0,moveSpeed:u??3,turnSpeed:d??3})]})});var Xfe={exports:{}},Jfe={exports:{}},$k=1e3,Qk=$k*60,Zk=Qk*60,eL=Zk*24,gAo=eL*365.25,mAo=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return yAo(t);if(n==="number"&&isNaN(t)===!1)return e.long?wAo(t):AAo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function yAo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return n*gAo;case"days":case"day":case"d":return n*eL;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Zk;case"minutes":case"minute":case"mins":case"min":case"m":return n*Qk;case"seconds":case"second":case"secs":case"sec":case"s":return n*$k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AAo(t){return t>=eL?Math.round(t/eL)+"d":t>=Zk?Math.round(t/Zk)+"h":t>=Qk?Math.round(t/Qk)+"m":t>=$k?Math.round(t/$k)+"s":t+"ms"}function wAo(t){return qO(t,eL,"day")||qO(t,Zk,"hour")||qO(t,Qk,"minute")||qO(t,$k,"second")||t+" ms"}function qO(t,e,n){if(!(t=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}};function r(c){var u=this.useColors;if(c[0]=(u?"%c":"")+this.namespace+(u?" %c":" ")+c[0]+(u?"%c ":" ")+"+"+e.humanize(this.diff),!!u){var d="color: "+this.color;c.splice(1,0,d,"color: inherit");var f=0,p=0;c[0].replace(/%[a-zA-Z%]/g,function(g){g!=="%%"&&(f++,g==="%c"&&(p=f))}),c.splice(p,0,d)}}function i(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(c){try{c==null?e.storage.removeItem("debug"):e.storage.debug=c}catch{}}function l(){var c;try{c=e.storage.debug}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}e.enable(l());function s(){try{return window.localStorage}catch{}}})(Xfe,Xfe.exports);var xAo=Xfe.exports,hze=xAo("jsonp"),bAo=PAo,SAo=0;function TAo(){}function PAo(t,e,n){typeof e=="function"&&(n=e,e={}),e||(e={});var o=e.prefix||"__jp",r=e.name||o+SAo++,i=e.param||"callback",a=e.timeout!=null?e.timeout:6e4,l=encodeURIComponent,s=document.getElementsByTagName("script")[0]||document.head,c,u;a&&(u=setTimeout(function(){d(),n&&n(new Error("Timeout"))},a));function d(){c.parentNode&&c.parentNode.removeChild(c),window[r]=TAo,u&&clearTimeout(u)}function f(){window[r]&&d()}return window[r]=function(p){hze("jsonp got",p),d(),n&&n(null,p)},t+=(~t.indexOf("?")?"&":"?")+i+"="+l(r),t=t.replace("?&","?"),hze('jsonp req "%s"',t),c=document.createElement("script"),c.src=t,s.parentNode.insertBefore(c,s),f}const hS=Wi(bAo);var CAo=Object.defineProperty,RAo=Object.defineProperties,HAo=Object.getOwnPropertyDescriptors,FJ=Object.getOwnPropertySymbols,Dat=Object.prototype.hasOwnProperty,Eat=Object.prototype.propertyIsEnumerable,pze=(t,e,n)=>e in t?CAo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lg=(t,e)=>{for(var n in e||(e={}))Dat.call(e,n)&&pze(t,n,e[n]);if(FJ)for(var n of FJ(e))Eat.call(e,n)&&pze(t,n,e[n]);return t},Wee=(t,e)=>RAo(t,HAo(e)),Nee=(t,e)=>{var n={};for(var o in t)Dat.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&FJ)for(var o of FJ(t))e.indexOf(o)<0&&Eat.call(t,o)&&(n[o]=t[o]);return n};function e7(t){return n=>{var o=n,{bgStyle:r={},borderRadius:i=0,iconFillColor:a="white",round:l=!1,size:s=64}=o,c=Nee(o,["bgStyle","borderRadius","iconFillColor","round","size"]);return h.jsxs("svg",Wee(lg({viewBox:"0 0 64 64",width:s,height:s},c),{children:[l?h.jsx("circle",{cx:"32",cy:"32",r:"32",fill:t.color,style:r}):h.jsx("rect",{width:"64",height:"64",rx:i,ry:i,fill:t.color,style:r}),h.jsx("path",{d:t.path,fill:a})]}))}}const MAo=e7({color:"#7f7f7f",networkName:"email",path:"M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z"}),IAo=MAo;function Qs(t){const e=Object.entries(t).filter(([,n])=>n!=null).map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);return e.length>0?`?${e.join("&")}`:""}const zAo=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",DAo=(t,e)=>({left:window.outerWidth/2+(window.screenX||window.screenLeft||0)-t/2,top:window.outerHeight/2+(window.screenY||window.screenTop||0)-e/2}),EAo=(t,e)=>({top:(window.screen.height-e)/2,left:(window.screen.width-t)/2});function FAo(t,e,n){var o=e,{height:r,width:i}=o,a=Nee(o,["height","width"]);const l=lg({height:r,width:i,location:"no",toolbar:"no",status:"no",directories:"no",menubar:"no",scrollbars:"yes",resizable:"no",centerscreen:"yes",chrome:"yes"},a),s=window.open(t,"",Object.keys(l).map(c=>`${c}=${l[c]}`).join(", "));if(n){const c=window.setInterval(()=>{try{(s===null||s.closed)&&(window.clearInterval(c),n(s))}catch(u){console.error(u)}},1e3)}return s}function kAo(t){var e=t,{beforeOnClick:n,children:o,className:r,disabled:i,disabledStyle:a={opacity:.6},forwardedRef:l,htmlTitle:s,networkLink:c,networkName:u,onClick:d,onShareWindowClose:f,openShareDialogOnClick:p=!0,opts:g,resetButtonStyle:A=!0,style:y,url:S,windowHeight:C=400,windowPosition:P="windowCenter",windowWidth:v=550}=e,T=Nee(e,["beforeOnClick","children","className","disabled","disabledStyle","forwardedRef","htmlTitle","networkLink","networkName","onClick","onShareWindowClose","openShareDialogOnClick","opts","resetButtonStyle","style","url","windowHeight","windowPosition","windowWidth"]);const w=async R=>{const H=c(S,g);if(!i){if(R.preventDefault(),n){const F=n();zAo(F)&&await F}if(p){const F=lg({height:C,width:v},P==="windowCenter"?DAo(v,C):EAo(v,C));FAo(H,F,f)}d&&d(R,H)}},x=Xn("react-share__ShareButton",{"react-share__ShareButton--disabled":!!i,disabled:!!i},r),b=lg(lg(A?{backgroundColor:"transparent",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"}:{},y),i&&a);return h.jsx("button",Wee(lg({},T),{className:x,onClick:w,ref:l,style:b,title:s,children:o}))}function A0(t,e,n,o){function r(i,a){const l=n(i),s=lg({},i);return Object.keys(l).forEach(u=>{delete s[u]}),h.jsx(kAo,Wee(lg(lg({},o),s),{forwardedRef:a,networkName:t,networkLink:e,opts:n(i)}))}return r.displayName=`ShareButton-${t}`,m.forwardRef(r)}function LAo(t,{subject:e,body:n,separator:o}){return"mailto:"+Qs({subject:e,body:n?n+o+t:t})}const WAo=A0("email",LAo,t=>({subject:t.subject,body:t.body,separator:t.separator||" "}),{openShareDialogOnClick:!1,onClick:(t,e)=>{window.location.href=e}}),NAo=WAo,UAo=e7({color:"#0965FE",networkName:"facebook",path:"M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z"}),jAo=UAo;function BAo(t,{appId:e,redirectUri:n,to:o}){return"https://www.facebook.com/dialog/send"+Qs({link:t,redirect_uri:n||t,app_id:e,to:o})}A0("facebookmessenger",BAo,t=>({appId:t.appId,redirectUri:t.redirectUri,to:t.to}),{windowWidth:1e3,windowHeight:820});class YAo extends Error{constructor(e){super(e),this.name="AssertionError"}}function i0(t,e){if(!t)throw new YAo(e)}function OAo(t,{hashtag:e}){return i0(t,"facebook.url"),"https://www.facebook.com/sharer/sharer.php"+Qs({u:t,hashtag:e})}const VAo=A0("facebook",OAo,t=>({hashtag:t.hashtag}),{windowWidth:550,windowHeight:400}),_Ao=VAo;function GAo(){const t=m.useRef(!1);return m.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),m.useCallback(()=>t.current,[])}function XAo(t){var e=t,{children:n=f=>f,className:o,getCount:r,url:i}=e,a=Nee(e,["children","className","getCount","url"]);const l=GAo(),[s,c]=m.useState(void 0),[u,d]=m.useState(!1);return m.useEffect(()=>{d(!0),r(i,f=>{l()&&(c(f),d(!1))})},[i]),h.jsx("span",Wee(lg({className:Xn("react-share__ShareCount",o)},a),{children:!u&&s!==void 0&&n(s)}))}function pS(t){const e=n=>h.jsx(XAo,lg({getCount:t},n));return e.displayName=`ShareCount(${t.name})`,e}function JAo(t,e){const n=`https://graph.facebook.com/?id=${t}&fields=og_object{engagement}`;hS(n,(o,r)=>{e(!o&&r&&r.og_object&&r.og_object.engagement?r.og_object.engagement.count:void 0)})}pS(JAo);function KAo(t,{title:e}){return i0(t,"hatena.url"),`http://b.hatena.ne.jp/add?mode=confirm&url=${t}&title=${e}`}A0("hatena",KAo,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"});function qAo(t,e){hS("https://bookmark.hatenaapis.com/count/entry"+Qs({url:t}),(o,r)=>{e(r??void 0)})}pS(qAo);function $Ao(t,{title:e,description:n}){return i0(t,"instapaper.url"),"http://www.instapaper.com/hello2"+Qs({url:t,title:e,description:n})}A0("instapaper",$Ao,t=>({title:t.title,description:t.description}),{windowWidth:500,windowHeight:500,windowPosition:"windowCenter"});const QAo=e7({color:"#00b800",networkName:"line",path:"M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z"}),ZAo=QAo;function e4o(t,{title:e}){return i0(t,"line.url"),"https://social-plugins.line.me/lineit/share"+Qs({url:t,text:e})}const t4o=A0("line",e4o,t=>({title:t.title}),{windowWidth:500,windowHeight:500}),n4o=t4o,o4o=e7({color:"#0077B5",networkName:"linkedin",path:"M20.4,44h5.4V26.6h-5.4V44z M23.1,18c-1.7,0-3.1,1.4-3.1,3.1c0,1.7,1.4,3.1,3.1,3.1 c1.7,0,3.1-1.4,3.1-3.1C26.2,19.4,24.8,18,23.1,18z M39.5,26.2c-2.6,0-4.4,1.4-5.1,2.8h-0.1v-2.4h-5.2V44h5.4v-8.6 c0-2.3,0.4-4.5,3.2-4.5c2.8,0,2.8,2.6,2.8,4.6V44H46v-9.5C46,29.8,45,26.2,39.5,26.2z"}),r4o=o4o;function i4o(t,{title:e,summary:n,source:o}){return i0(t,"linkedin.url"),"https://linkedin.com/shareArticle"+Qs({url:t,mini:"true",title:e,summary:n,source:o})}const a4o=A0("linkedin",i4o,({title:t,summary:e,source:n})=>({title:t,summary:e,source:n}),{windowWidth:750,windowHeight:600}),l4o=a4o;function s4o(t,{title:e,description:n}){return i0(t,"livejournal.url"),"https://www.livejournal.com/update.bml"+Qs({subject:e,event:n})}A0("livejournal",s4o,t=>({title:t.title,description:t.description}),{windowWidth:660,windowHeight:460});function c4o(t,{title:e,description:n,imageUrl:o}){return i0(t,"mailru.url"),"https://connect.mail.ru/share"+Qs({url:t,title:e,description:n,image_url:o})}A0("mailru",c4o,t=>({title:t.title,description:t.description,imageUrl:t.imageUrl}),{windowWidth:660,windowHeight:460});function u4o(t,{title:e,description:n,image:o}){return i0(t,"ok.url"),"https://connect.ok.ru/offer"+Qs({url:t,title:e,description:n,imageUrl:o})}A0("ok",u4o,t=>({title:t.title,description:t.description,image:t.image}),{windowWidth:588,windowHeight:480,windowPosition:"screenCenter"});function d4o(t,e){window.OK||(window.OK={Share:{count:function(i,a){var l,s;(s=(l=window.OK.callbacks)[i])==null||s.call(l,a)}},callbacks:[]});const n="https://connect.ok.ru/dk",o=window.OK.callbacks.length;return window.ODKL={updateCount(r,i){var a,l;const s=r===""?0:parseInt(r.replace("react-share-",""),10);(l=(a=window.OK.callbacks)[s])==null||l.call(a,i===""?void 0:parseInt(i,10))}},window.OK.callbacks.push(e),hS(n+Qs({"st.cmd":"extLike",uid:`react-share-${o}`,ref:t}))}pS(d4o);function f4o(t,{media:e,description:n,pinId:o}){return o?`https://pinterest.com/pin/${o}/repin/x/`:(i0(t,"pinterest.url"),i0(e,"pinterest.media"),"https://pinterest.com/pin/create/button/"+Qs({url:t,media:e,description:n}))}A0("pinterest",f4o,t=>({media:t.media,description:t.description,pinId:t.pinId}),{windowWidth:1e3,windowHeight:730});function h4o(t,e){hS("https://api.pinterest.com/v1/urls/count.json"+Qs({url:t}),(o,r)=>{e(r?r.count:void 0)})}pS(h4o);function p4o(t,{title:e}){return i0(t,"pocket.url"),"https://getpocket.com/save"+Qs({url:t,title:e})}A0("pocket",p4o,t=>({title:t.title}),{windowWidth:500,windowHeight:500});const g4o=e7({color:"#FF5700",networkName:"reddit",path:"M 53.34375 32 C 53.277344 30.160156 52.136719 28.53125 50.429688 27.839844 C 48.722656 27.148438 46.769531 27.523438 45.441406 28.800781 C 41.800781 26.324219 37.519531 24.957031 33.121094 24.863281 L 35.199219 14.878906 L 42.046875 16.320312 C 42.214844 17.882812 43.496094 19.09375 45.066406 19.171875 C 46.636719 19.253906 48.03125 18.183594 48.359375 16.644531 C 48.6875 15.105469 47.847656 13.558594 46.382812 12.992188 C 44.914062 12.425781 43.253906 13.007812 42.464844 14.367188 L 34.625 12.800781 C 34.363281 12.742188 34.09375 12.792969 33.871094 12.9375 C 33.648438 13.082031 33.492188 13.308594 33.441406 13.566406 L 31.070312 24.671875 C 26.617188 24.738281 22.277344 26.105469 18.59375 28.609375 C 17.242188 27.339844 15.273438 26.988281 13.570312 27.707031 C 11.863281 28.429688 10.746094 30.089844 10.71875 31.941406 C 10.691406 33.789062 11.757812 35.484375 13.441406 36.257812 C 13.402344 36.726562 13.402344 37.195312 13.441406 37.664062 C 13.441406 44.832031 21.792969 50.65625 32.097656 50.65625 C 42.398438 50.65625 50.753906 44.832031 50.753906 37.664062 C 50.789062 37.195312 50.789062 36.726562 50.753906 36.257812 C 52.363281 35.453125 53.371094 33.800781 53.34375 32 Z M 21.34375 35.199219 C 21.34375 33.433594 22.777344 32 24.542969 32 C 26.3125 32 27.742188 33.433594 27.742188 35.199219 C 27.742188 36.96875 26.3125 38.398438 24.542969 38.398438 C 22.777344 38.398438 21.34375 36.96875 21.34375 35.199219 Z M 39.9375 44 C 37.664062 45.710938 34.871094 46.582031 32.03125 46.464844 C 29.191406 46.582031 26.398438 45.710938 24.128906 44 C 23.847656 43.65625 23.871094 43.15625 24.183594 42.839844 C 24.5 42.527344 25 42.503906 25.34375 42.785156 C 27.269531 44.195312 29.617188 44.90625 32 44.800781 C 34.386719 44.929688 36.746094 44.242188 38.6875 42.847656 C 39.042969 42.503906 39.605469 42.511719 39.953125 42.863281 C 40.296875 43.21875 40.289062 43.785156 39.9375 44.128906 Z M 39.359375 38.527344 C 37.59375 38.527344 36.160156 37.09375 36.160156 35.328125 C 36.160156 33.5625 37.59375 32.128906 39.359375 32.128906 C 41.128906 32.128906 42.558594 33.5625 42.558594 35.328125 C 42.59375 36.203125 42.269531 37.054688 41.65625 37.6875 C 41.046875 38.316406 40.203125 38.664062 39.328125 38.65625 Z M 39.359375 38.527344"}),m4o=g4o;function y4o(t,{title:e}){return i0(t,"reddit.url"),"https://www.reddit.com/web/submit"+Qs({url:t,title:e})}const A4o=A0("reddit",y4o,t=>({title:t.title}),{windowWidth:660,windowHeight:460,windowPosition:"windowCenter"}),w4o=A4o;function v4o(t,{title:e}){return i0(t,"gab.url"),"https://gab.com/compose"+Qs({url:t,text:e})}A0("gab",v4o,t=>({title:t.title}),{windowWidth:660,windowHeight:640,windowPosition:"windowCenter"});function x4o(t,e){const n=`https://www.reddit.com/api/info.json?limit=1&url=${t}`;hS(n,{param:"jsonp"},(o,r)=>{e(!o&&r&&r.data&&r.data.children.length>0&&r.data.children[0].data.score?r.data.children[0].data.score:void 0)})}pS(x4o);const b4o=e7({color:"#25A3E3",networkName:"telegram",path:"m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957"}),S4o=b4o;function T4o(t,{title:e}){return i0(t,"telegram.url"),"https://telegram.me/share/url"+Qs({url:t,text:e})}const P4o=A0("telegram",T4o,t=>({title:t.title}),{windowWidth:550,windowHeight:400}),C4o=P4o;function R4o(t,{title:e,caption:n,tags:o,posttype:r}){return i0(t,"tumblr.url"),"https://www.tumblr.com/widgets/share/tool"+Qs({canonicalUrl:t,title:e,caption:n,tags:o,posttype:r})}A0("tumblr",R4o,t=>({title:t.title,tags:(t.tags||[]).join(","),caption:t.caption,posttype:t.posttype||"link"}),{windowWidth:660,windowHeight:460});function H4o(t,e){return hS("https://api.tumblr.com/v2/share/stats"+Qs({url:t}),(o,r)=>{e(!o&&r&&r.response?r.response.note_count:void 0)})}pS(H4o);function M4o(t,{title:e,via:n,hashtags:o=[],related:r=[]}){return i0(t,"twitter.url"),i0(Array.isArray(o),"twitter.hashtags is not an array"),i0(Array.isArray(r),"twitter.related is not an array"),"https://twitter.com/intent/tweet"+Qs({url:t,text:e,via:n,hashtags:o.length>0?o.join(","):void 0,related:r.length>0?r.join(","):void 0})}const I4o=A0("twitter",M4o,t=>({hashtags:t.hashtags,title:t.title,via:t.via,related:t.related}),{windowWidth:550,windowHeight:400}),z4o=I4o;function D4o(t,{title:e,separator:n}){return i0(t,"viber.url"),"viber://forward"+Qs({text:e?e+n+t:t})}A0("viber",D4o,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:660,windowHeight:460});function E4o(t,{title:e,image:n,noParse:o,noVkLinks:r}){return i0(t,"vk.url"),"https://vk.com/share.php"+Qs({url:t,title:e,image:n,noparse:o?1:0,no_vk_links:r?1:0})}A0("vk",E4o,t=>({title:t.title,image:t.image,noParse:t.noParse,noVkLinks:t.noVkLinks}),{windowWidth:660,windowHeight:460});function F4o(t,e){window.VK||(window.VK={}),window.VK.Share={count:(r,i)=>{var a,l;return(l=(a=window.VK.callbacks)==null?void 0:a[r])==null?void 0:l.call(a,i)}},window.VK.callbacks=[];const n="https://vk.com/share.php",o=window.VK.callbacks.length;return window.VK.callbacks.push(e),hS(n+Qs({act:"count",index:o,url:t}))}pS(F4o);function k4o(t,{title:e,image:n}){return i0(t,"weibo.url"),"http://service.weibo.com/share/share.php"+Qs({url:t,title:e,pic:n})}A0("weibo",k4o,t=>({title:t.title,image:t.image}),{windowWidth:660,windowHeight:550,windowPosition:"screenCenter"});const L4o=e7({color:"#25D366",networkName:"whatsapp",path:"m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915"}),W4o=L4o;function N4o(){return/(android|iphone|ipad|mobile)/i.test(navigator.userAgent)}function U4o(t,{title:e,separator:n}){return i0(t,"whatsapp.url"),"https://"+(N4o()?"api":"web")+".whatsapp.com/send"+Qs({text:e?e+n+t:t})}const j4o=A0("whatsapp",U4o,t=>({title:t.title,separator:t.separator||" "}),{windowWidth:550,windowHeight:400}),B4o=j4o;function Y4o(t,{quote:e,hashtag:n}){return i0(t,"workplace.url"),"https://work.facebook.com/sharer.php"+Qs({u:t,quote:e,hashtag:n})}A0("workplace",Y4o,t=>({quote:t.quote,hashtag:t.hashtag}),{windowWidth:550,windowHeight:400});const O4o=e7({color:"#000000",networkName:"X",path:"M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z"}),V4o=O4o,_4o=Ho.div` display: flex; flex-direction: column; z-index: 999; -`,G4o=be.memo(({style:t,size:e,margin:n,round:o,handleShareWindowClose:r})=>{const i=M(yp),a=M(zb),s=new URLSearchParams(window.location.search).get("userid"),c=$t(),u=a??Y.t("name.Tagline",c),d="aladdinIFI "+(a?Y.t("name.Tagline",c):"");let f=t1;return a&&(s?f+="?client=web&userid="+s+"&title="+encodeURIComponent(a):i.uid&&(f+="?client=web&userid="+i.uid+"&title="+encodeURIComponent(a))),h.jsxs(_4o,{style:t,children:[h.jsx(NAo,{url:f,subject:u,children:h.jsx(IAo,{size:e,round:o})}),h.jsx(z4o,{url:f,title:u,via:d,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(V4o,{size:e,round:o})}),h.jsx(_Ao,{url:f,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(jAo,{size:e,round:o})}),h.jsx(w4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(m4o,{size:e,round:o})}),h.jsx(C4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(S4o,{size:e,round:o})}),h.jsx(n4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(ZAo,{size:e,round:o})}),h.jsx(l4o,{url:f,title:u,summary:d,source:Y.t("name.IFI",c),style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(r4o,{size:e,round:o})}),h.jsx(B4o,{url:f,title:u,separator:":: ",onShareWindowClose:r,children:h.jsx(W4o,{size:e,round:o})})]})});class pC{constructor(e,n,o){if(this.fitness=Number.NaN,this.chromosome=new Array(e),this.discretizationSteps=o,n)if(o)for(let r=0;re.fitness?1:this.fitness=this.chromosome.length)throw new Error("Gene index out of bound: "+e);this.chromosome[e]=n}getGene(e){if(e<0||e>=this.chromosome.length)throw new Error("Gene index out of bound: "+e);return this.chromosome[e]}copyGenes(e){const n=Math.min(this.chromosome.length,e.chromosome.length);for(let o=0;on.compare(e))}getNicheCount(e,n){let o=0;for(const r of this.individuals){const i=e.distance(r);let a=0;ie&&(e=o.fitness,n=o);return n}evolve(e,n){this.selectSurvivors(e),this.crossover(n)}selectSurvivors(e){this.survivors=[],this.sort();const n=Math.floor(e*this.individuals.length);for(let o=0;o=r){o=l;break}let a=null;do{r=Math.random()*n,i=0;for(const l of this.survivors)if(i+=l.fitness-e,i>=r){l!==o&&(a=l);break}}while(a===null);return o&&a?new gze(o,a):null}selectParentsByTournament(){const e=this.survivors.length;if(e<=1)throw new Error("Must have at least two survivors to be used as parents");const n=e-1;let o=Math.floor(Math.random()*n),r;do r=Math.floor(Math.random()*n);while(r===o);const i=this.survivors[o].fitness>this.survivors[r].fitness?o:r;o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);let a=this.survivors[o].fitness>this.survivors[r].fitness?o:r;for(;a===i;){o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);a=this.survivors[o].fitness>this.survivors[r].fitness?o:r}return new gze(this.survivors[i],this.survivors[a])}mutate(e){if(ye.isZero(e))return;let n=Math.floor(e*(this.individuals.length-1));for(n===0?n=1:n===this.individuals.length-1&&(n=this.individuals.length-2),this.mutants=[];this.mutants.lengthe)return!1}return!0}}class Fat{constructor(e,n,o,r,i,a,l,s,c,u){this.fitnessSharingRadius=.1,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.constraints=[],this.stopped=!0,this.mutationRate=.1,this.crossoverRate=.5,this.selectionRate=.5,this.maximumGenerations=5,this.fittestOfGenerations=[],this.populationOfGenerations=[],this.outsideGenerationCounter=0,this.computeCounter=0,this.converged=!1,this.population=new mze(o,i,a,u),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.maximumGenerations=r,this.searchMethod=s,this.localSearchRadius=c,this.geneNames=new Array(i),this.foundation=e;const d=e.cx,f=e.cy,p=e.lx,g=e.ly;this.minima=new Array(i),this.maxima=new Array(i);for(let A=0;A=this.maximumGenerations}}class tL{static gaussian(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*n)}static twoGaussians(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();const o=new Array(2),r=Math.sqrt(-2*Math.log(e)),i=2*Math.PI*n;return o[0]=r*Math.cos(i),o[1]=r*Math.sin(i),o}static poisson(e){let n=0,o=Math.exp(-e),r=o;const i=Math.random();for(;i>r;)n++,o*=e/n,r+=o;return n}}class nL extends Fat{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,e.length,a,l,s,c),this.solarPanels=e;const u=this.population.individuals[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/Qt);if(u.setGene(d,p),this.searchMethod===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let g=1;g1;)y=tL.gaussian()*this.localSearchRadius+p;A.setGene(d,y)}this.geneNames[d]="Tilt Angle ("+f.id+")"}}applyFittest(){const e=this.population.getFittest();if(e){for(let n=0;n{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(c3),l=M(s3),s=M(l$),c=dt(Kq),u=M(IW),d=M(s$),f=M(bA).geneticAlgorithmParams,p=$t(),g=m.useRef(0),A=m.useRef(!1),y=m.useRef(!1),S=m.useRef(),C=m.useRef(),P=m.useRef(0),v=m.useRef(!1),T=m.useRef([]);m.useEffect(()=>{if(f.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&o===_s.GENETIC_ALGORITHM&&r){w(),g.current=requestAnimationFrame(b);const F=[...T.current];return()=>{cancelAnimationFrame(g.current),A.current||(gn(Y.t("message.EvolutionAborted",p)),dt.getState().set(E=>{E.evolutionInProgress=!1}),F.length>0&&(S.current=F,R(!0)))}}},[r]),m.useEffect(()=>{y.current=i,i?(cancelAnimationFrame(g.current),dt.getState().set(F=>{F.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",p))):(dt.getState().set(F=>{F.evolutionPaused=!1}),b())},[i]);const w=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),A.current=!1;const F=l(z.SolarPanel,a.id);T.current.length=0;for(const N of F)T.current.push(JSON.parse(JSON.stringify(N)));S.current=[];const E=[];for(const N of F)S.current.push(JSON.parse(JSON.stringify(N))),E.push(N.label);S.current.length>0?(C.current=new nL(S.current,a,f.objectiveFunctionType,f.populationSize,f.maximumGenerations,f.selectionMethod,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.selectionRate=f.selectionRate,C.current.crossoverRate=f.crossoverRate,C.current.mutationRate=f.mutationRate,P.current=0,v.current=!1,d(E),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(Y.t("message.EncounterEvolutionError",p))},x=()=>{let F=0;switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:{const E=Cn.getState().dailyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);break}case Po.YEARLY_TOTAL_OUTPUT:{const E=Cn.getState().yearlyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);F*=12/n;break}}return F};m.useEffect(()=>{!C.current||!c||(v.current=C.current.evolveIndividual(P.current%f.populationSize,x()),H(),P.current++,C.current.outsideGenerationCounter=Math.floor(P.current/f.populationSize),g.current=requestAnimationFrame(b))},[c]);const b=()=>{if(C.current&&o===_s.GENETIC_ALGORITHM&&r&&!y.current){if(v.current||C.current.outsideGenerationCounter>=f.maximumGenerations){if(cancelAnimationFrame(g.current),A.current=!0,C.current.applyFittest(),H(),R(!0),gn(Y.t("message.EvolutionCompleted",p)+` -`+(v.current?Y.t("message.ConvergenceThresholdHasBeenReached",p):Y.t("message.MaximumNumberOfGenerationsHasBeenReached",p))),e&&C.current){const F=C.current.population.getFittest();F&&t(E=>{var N;E.actionInfo={name:"Genetic Algorithm for Solar Panel Tilt Angle Completed",result:nL.individualToString(F),steps:(N=C.current)==null?void 0:N.outsideGenerationCounter,timestamp:new Date().getTime()}})}return}C.current.translateIndividual(P.current%f.populationSize),R(!1)}},R=F=>{dt.getState().set(E=>{if(S.current)switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:F?E.runDailySimulationForSolarPanelsLastStep=!0:E.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:F?E.runYearlySimulationForSolarPanelsLastStep=!0:E.runYearlySimulationForSolarPanels=!0;break;default:co(Y.t("message.ObjectiveFunctionTypeError",p),60)}}),t(E=>{if(S.current){switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:E.graphState&&(E.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:E.graphState&&(E.graphState.yearlyPvIndividualOutputs=!1);break;default:co(Y.t("message.ObjectiveFunctionTypeError",p),60)}for(const N of E.elements)if(N.type===z.SolarPanel){const U=N;for(const W of S.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),F&&dt.getState().set(E=>{E.runEvolution=!1,E.evolutionInProgress=!1,E.objectiveEvaluationIndex=0})},H=()=>{var E;if(!C.current)return;const F=[];for(let N=0;N0){const D=C.current.populationOfGenerations[N-1];if(D){let L=0;for(let j=0;j0&&F.push(U)}s(F)};return h.jsx(h.Fragment,{})});class J4o extends Fat{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x){if(super(c,u,d,f,3,p,g,A,y),this.orientation=vr.landscape,this.rowAxis=El.leftRight,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=S,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=v,this.minimumTiltAngle=T,this.maximumTiltAngle=w,this.margin=x,this.setInterRowSpacingBounds(),this.geneNames[0]="Tilt Angle",this.geneNames[1]="Inter-Row Spacing",this.geneNames[2]="Rack Width",a&&a.length>0){const b=a[0];if(a.length>1){const R=this.population.individuals[0],H=this.maximumTiltAngle===this.minimumTiltAngle?0:(b.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);R.setGene(0,H);const F=a[1],E=l?l.interRowSpacing:this.rowAxis===El.upDown?Math.abs(b.cx-F.cx)*this.foundation.lx:Math.abs(b.cy-F.cy)*this.foundation.ly;let N=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(E-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);N<0?N=0:N>1&&(N=1),R.setGene(1,N);const U=l?l.rowsPerRack:Math.max(1,Math.round(b.ly/(b.orientation===vr.portrait?e.length:e.width)));let W=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(U-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);W<0?W=0:W>1&&(W=1),R.setGene(2,W)}}}setInterRowSpacingBounds(){this.bounds=ye.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){const e=this.population.getFittest();e&&console.log("Fittest: "+this.individualToString(e)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:return"kWh";case Po.YEARLY_PROFIT:case Po.DAILY_PROFIT:return"dollars"}return null}individualToString(e){let n="F("+ye.toDegrees(e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return n+=(e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",n+=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",n+" = "+e.fitness.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideGenerationCounter=0,this.computeCounter=0,this.fittestOfGenerations.fill(null),this.setInterRowSpacingBounds()}translateIndividualByIndex(e){return this.translateIndividual(this.population.individuals[e])}translateBest(){const e=this.population.getFittest();return e?this.translateIndividual(e):[]}translateIndividual(e){if(!this.bounds)return[];const n=e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=qR.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=ye.countSolarPanelsOnRack(a,this.pvModel);return i}evolveIndividual(e,n){var r;const o=this.population.individuals.length;if(!this.converged){const i=this.population.individuals[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.fittestOfGenerations[0]=i.getCopy());const a=Math.floor(this.computeCounter/o);console.log("Generation "+(a+1)+", individual "+e+" : "+this.individualToString(i)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.populationOfGenerations[a])==null?void 0:r.individuals[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(Gr),l=M(c3),s=M(s3),c=M(l$),u=dt(Kq),d=M(IW),f=M(s$),p=M(t5),g=M(Vge),A=M(bA).geneticAlgorithmParams,y=M.getState().solarPanelArrayLayoutConstraints,S=M.getState().economicsParams,C=M.getState().solarPanelArrayLayoutParams,P=m.useRef(0),v=m.useRef(!1),T=m.useRef(!1),w=m.useRef(),x=m.useRef(0),b=m.useRef(!1),R=m.useRef([]),H=m.useRef([]),F=$t(),E=l?a(l):void 0;m.useEffect(()=>{if(o===_s.GENETIC_ALGORITHM&&A.problem===Ri.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...H.current];return()=>{cancelAnimationFrame(P.current),v.current||(gn(Y.t("message.EvolutionAborted",F)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&g(l.id,!1),L.length>0&&(R.current=L,k(!0))},100))}}},[r]),m.useEffect(()=>{T.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",F))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!E)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),v.current=!1;const L=s(z.SolarPanel,E.id);H.current.length=0;for(const j of L)H.current.push(JSON.parse(JSON.stringify(j)));w.current=new J4o(p(y.pvModelName??"CS6X-355P-FG"),y.rowAxis??El.leftRight,y.orientation??vr.landscape,y.poleHeight??1,y.poleSpacing??3,H.current,C,l,E,A.objectiveFunctionType,A.populationSize,A.maximumGenerations,A.selectionMethod,A.convergenceThreshold,A.searchMethod,A.localSearchRadius,y.minimumInterRowSpacing,y.maximumInterRowSpacing,y.minimumRowsPerRack,y.maximumRowsPerRack,y.minimumTiltAngle,y.maximumTiltAngle,y.margin??0),w.current.selectionRate=A.selectionRate,w.current.crossoverRate=A.crossoverRate,w.current.mutationRate=A.mutationRate,x.current=0,b.current=!1,f([...w.current.geneNames]),w.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var B;let L=0;switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:{const O=Cn.getState().dailyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);break}case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:{const O=Cn.getState().yearlyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);L*=12/n;break}}const j=(B=w.current)==null?void 0:B.solarPanelCount;switch(A.objectiveFunctionType){case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Po.DAILY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit);break;case Po.YEARLY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit*365);break}return L};m.useEffect(()=>{!w.current||!u||(b.current=w.current.evolveIndividual(x.current%A.populationSize,U()),D(),x.current++,w.current.outsideGenerationCounter=Math.floor(x.current/A.populationSize),P.current=requestAnimationFrame(W))},[u]);const W=()=>{if(w.current&&o===_s.GENETIC_ALGORITHM&&r&&!T.current){if(b.current||w.current.outsideGenerationCounter>=A.maximumGenerations){if(cancelAnimationFrame(P.current),v.current=!0,R.current.length>0&&g(l.id,!1),R.current=w.current.translateBest(),w.current.applyFittest(),D(),k(!0),gn(Y.t("message.EvolutionCompleted",F)+` -`+(b.current?Y.t("message.ConvergenceThresholdHasBeenReached",F):Y.t("message.MaximumNumberOfGenerationsHasBeenReached",F))),w.current){const L=w.current.population.getFittest();if(L){const j=L.getGene(0)*(y.maximumTiltAngle-y.minimumTiltAngle)+y.minimumTiltAngle,B=L.getGene(1)*(y.maximumInterRowSpacing-y.minimumInterRowSpacing)+y.minimumInterRowSpacing,O=Math.floor(L.getGene(2)*(y.maximumRowsPerRack-y.minimumRowsPerRack)+y.minimumRowsPerRack);t(V=>{V.solarPanelArrayLayoutParams.tiltAngle=j,V.solarPanelArrayLayoutParams.interRowSpacing=B,V.solarPanelArrayLayoutParams.rowsPerRack=O,V.solarPanelArrayLayoutParams.orientation=y.orientation,V.solarPanelArrayLayoutParams.poleHeight=y.poleHeight}),e&&t(V=>{var G,q;V.actionInfo={name:"Genetic Algorithm for Solar Panel Array Layout Completed",result:(G=w.current)==null?void 0:G.individualToString(L),steps:(q=w.current)==null?void 0:q.outsideGenerationCounter,timestamp:new Date().getTime()}})}}return}g(l.id,!1),setTimeout(()=>{w.current&&(R.current=w.current.translateIndividualByIndex(x.current%A.populationSize)),k(!1)},100)}},k=L=>{dt.getState().set(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},D=()=>{if(!w.current)return;const L=[];for(let j=0;j0){const G=w.current.populationOfGenerations[j-1];if(G){let q=0;for(let $=0;$0&&L.push(B)}c(L)};return h.jsx(h.Fragment,{})});class q4o{constructor(e,n){this.fitness=Number.NaN,this.position=new Array,this.velocity=new Array,this.bestPositionOfParticle=new Array;for(let o=0;oe.fitness?1:this.fitnessn.compare(e)),Number.isNaN(this.bestFitness)||this.bestFitnesse)return!1}return!0}}class kat{constructor(e,n,o,r,i,a,l,s,c){this.stopped=!0,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.maximumSteps=5,this.bestPositionOfSteps=[],this.bestFitnessOfSteps=[],this.swarmOfSteps=[],this.outsideStepCounter=0,this.computeCounter=0,this.convergenceThreshold=.1,this.converged=!1,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.swarm=new yze(o,a,r),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.searchMethod=s,this.localSearchRadius=c,this.maximumSteps=i,this.foundation=e,this.bestPositionOfSteps=new Array(this.maximumSteps+1),this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps=new Array(this.maximumSteps+1),this.bestFitnessOfSteps.fill(0),this.swarmOfSteps=new Array(this.maximumSteps);for(let u=0;u=this.maximumSteps}}class oL extends kat{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,a,e.length,l,s,c),this.solarPanels=e;const u=this.swarm.particles[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/Qt);if(u.position[d]=p,this.searchMethod===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let g=1;g1;)y=tL.gaussian()*this.localSearchRadius+p;A.position[d]=y}}}applyFittest(){const e=this.swarm.bestPositionOfSwarm;if(e){for(let n=0;ni.fitness&&i.updateBestPosition(),i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+oL.particleToString(i.position,n));const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(c3),l=M(s3),s=M(l$),c=dt(Kq),u=M(IW),d=M(s$),f=M(bA).particleSwarmOptimizationParams,p=$t(),g=m.useRef(0),A=m.useRef(!1),y=m.useRef(!1),S=m.useRef(),C=m.useRef(),P=m.useRef(0),v=m.useRef(!1),T=m.useRef([]);m.useEffect(()=>{if(f.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r){w(),g.current=requestAnimationFrame(b);const F=[...T.current];return()=>{cancelAnimationFrame(g.current),A.current||(gn(Y.t("message.EvolutionAborted",p)),dt.getState().set(E=>{E.evolutionInProgress=!1}),F.length>0&&(S.current=F,R(!0)))}}},[r]),m.useEffect(()=>{y.current=i,i?(cancelAnimationFrame(g.current),dt.getState().set(F=>{F.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",p))):(dt.getState().set(F=>{F.evolutionPaused=!1}),b())},[i]);const w=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),A.current=!1;const F=l(z.SolarPanel,a.id);T.current.length=0;for(const N of F)T.current.push(JSON.parse(JSON.stringify(N)));S.current=[];const E=[];for(const N of F)S.current.push(JSON.parse(JSON.stringify(N))),E.push(N.label);S.current.length>0?(C.current=new oL(S.current,a,f.objectiveFunctionType,f.swarmSize,f.vmax,f.maximumSteps,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.inertia=f.inertia,C.current.cognitiveCoefficient=f.cognitiveCoefficient,C.current.socialCoefficient=f.socialCoefficient,P.current=0,v.current=!1,d(E),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(Y.t("message.EncounterEvolutionError",p))},x=()=>{let F=0;switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:{const E=Cn.getState().dailyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);break}case Po.YEARLY_TOTAL_OUTPUT:{const E=Cn.getState().yearlyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);F*=12/n;break}}return F};m.useEffect(()=>{!C.current||!c||(v.current=C.current.updateParticle(P.current%f.swarmSize,x()),H(),P.current++,C.current.outsideStepCounter=Math.floor(P.current/f.swarmSize),g.current=requestAnimationFrame(b))},[c]);const b=()=>{if(C.current&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r&&!y.current){if(v.current||C.current.outsideStepCounter>=f.maximumSteps){if(cancelAnimationFrame(g.current),A.current=!0,C.current.applyFittest(),H(),R(!0),gn(Y.t("message.EvolutionCompleted",p)+` -`+(v.current?Y.t("message.ConvergenceThresholdHasBeenReached",p):Y.t("message.MaximumNumberOfStepsHasBeenReached",p))),e&&C.current){const F=C.current.swarm.bestPositionOfSwarm,E=C.current.swarm.bestFitness;F&&E&&t(N=>{var U;N.actionInfo={name:"Particle Swarm Optimization for Solar Panel Tilt Angle Completed",result:oL.particleToString(F,E),steps:(U=C.current)==null?void 0:U.outsideStepCounter,timestamp:new Date().getTime()}})}return}C.current.translateParticle(P.current%f.swarmSize),R(!1)}},R=F=>{dt.getState().set(E=>{if(S.current)switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:F?E.runDailySimulationForSolarPanelsLastStep=!0:E.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:F?E.runYearlySimulationForSolarPanelsLastStep=!0:E.runYearlySimulationForSolarPanels=!0;break}}),t(E=>{if(S.current){switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:E.graphState&&(E.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:E.graphState&&(E.graphState.yearlyPvIndividualOutputs=!1);break}for(const N of E.elements)if(N.type===z.SolarPanel){const U=N;for(const W of S.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),F&&dt.getState().set(E=>{E.runEvolution=!1,E.evolutionInProgress=!1,E.objectiveEvaluationIndex=0})},H=()=>{var E;if(!C.current)return;const F=[];for(let N=0;N0){const D=C.current.swarmOfSteps[N-1];if(D){let L=0;for(let j=0;j0&&F.push(U)}s(F)};return h.jsx(h.Fragment,{})});class Q4o extends kat{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x){if(super(c,u,d,f,p,3,g,A,y),this.orientation=vr.landscape,this.rowAxis=El.leftRight,this.relativeMargin=.01,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=S,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=v,this.minimumTiltAngle=T,this.maximumTiltAngle=w,this.margin=x,this.setInterRowSpacingBounds(),a&&a.length>0){const b=a[0];if(a.length>1){const R=this.swarm.particles[0];R.position[0]=this.maximumTiltAngle===this.minimumTiltAngle?0:(b.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);const H=a[1],F=l?l.interRowSpacing:this.rowAxis===El.upDown?Math.abs(b.cx-H.cx)*this.foundation.lx:Math.abs(b.cy-H.cy)*this.foundation.ly;let E=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(F-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);E<0?E=0:E>1&&(E=1),R.position[1]=E;const N=l?l.rowsPerRack:Math.max(1,Math.round(b.ly/(b.orientation===vr.portrait?e.length:e.width)));let U=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(N-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);U<0?U=0:U>1&&(U=1),R.position[2]=U}}}setInterRowSpacingBounds(){this.bounds=ye.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){this.swarm.bestPositionOfSwarm&&console.log("Best: "+this.particleToString(this.swarm.bestPositionOfSwarm,this.swarm.bestFitness)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:return"kWh";case Po.YEARLY_PROFIT:case Po.DAILY_PROFIT:return"dollars"}return null}particleToString(e,n){let o="F("+ye.toDegrees(e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return o+=(e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",o+=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",o+" = "+n.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideStepCounter=0,this.computeCounter=0,this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps.fill(0),this.setInterRowSpacingBounds()}translateParticleByIndex(e){return this.translatePosition(this.swarm.particles[e].position)}translateBest(){return this.swarm.bestPositionOfSwarm?this.translatePosition(this.swarm.bestPositionOfSwarm):[]}translatePosition(e){if(!this.bounds)return[];const n=e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=qR.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=ye.countSolarPanelsOnRack(a,this.pvModel);return i}updateParticle(e,n){var r;const o=this.swarm.particles.length;if(!this.converged){const i=this.swarm.particles[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+this.particleToString(i.position,n)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(Gr),l=M(c3),s=M(s3),c=M(t5),u=M(Vge),d=M(l$),f=dt(Kq),p=M(IW),g=M(s$),A=M(bA).particleSwarmOptimizationParams,y=M.getState().solarPanelArrayLayoutConstraints,S=M.getState().economicsParams,C=M.getState().solarPanelArrayLayoutParams,P=m.useRef(0),v=m.useRef(!1),T=m.useRef(!1),w=m.useRef(),x=m.useRef(0),b=m.useRef(!1),R=m.useRef([]),H=m.useRef([]),F=$t(),E=l?a(l):void 0;m.useEffect(()=>{if(o===_s.PARTICLE_SWARM_OPTIMIZATION&&A.problem===Ri.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...H.current];return()=>{cancelAnimationFrame(P.current),v.current||(gn(Y.t("message.EvolutionAborted",F)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&u(l.id,!1),L.length>0&&(R.current=L,k(!0))},100))}}},[r]),m.useEffect(()=>{T.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",F))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!E)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),v.current=!1;const L=s(z.SolarPanel,E.id);H.current.length=0;for(const j of L)H.current.push(JSON.parse(JSON.stringify(j)));w.current=new Q4o(c(y.pvModelName??"CS6X-355P-FG"),y.rowAxis??El.leftRight,y.orientation??vr.landscape,y.poleHeight??1,y.poleSpacing??3,H.current,C,l,E,A.objectiveFunctionType,A.swarmSize,A.vmax,A.maximumSteps,A.convergenceThreshold,A.searchMethod,A.localSearchRadius,y.minimumInterRowSpacing,y.maximumInterRowSpacing,y.minimumRowsPerRack,y.maximumRowsPerRack,y.minimumTiltAngle,y.maximumTiltAngle,y.margin??0),w.current.inertia=A.inertia,w.current.cognitiveCoefficient=A.cognitiveCoefficient,w.current.socialCoefficient=A.socialCoefficient,x.current=0,b.current=!1,g(["Tilt Angle","Inter-Row Spacing","Rack Width"]),w.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var B;let L=0;switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:{const O=Cn.getState().dailyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);break}case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:{const O=Cn.getState().yearlyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);L*=12/n;break}}const j=(B=w.current)==null?void 0:B.solarPanelCount;switch(A.objectiveFunctionType){case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Po.DAILY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit);break;case Po.YEARLY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit*365);break}return L};m.useEffect(()=>{!w.current||!f||(b.current=w.current.updateParticle(x.current%A.swarmSize,U()),D(),x.current++,w.current.outsideStepCounter=Math.floor(x.current/A.swarmSize),P.current=requestAnimationFrame(W))},[f]);const W=()=>{if(w.current&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r&&!T.current){if(b.current||w.current.outsideStepCounter>=A.maximumSteps){if(cancelAnimationFrame(P.current),v.current=!0,R.current.length>0&&u(l.id,!1),R.current=w.current.translateBest(),w.current.applyFittest(),D(),k(!0),gn(Y.t("message.EvolutionCompleted",F)+` +`,G4o=be.memo(({style:t,size:e,margin:n,round:o,handleShareWindowClose:r})=>{const i=M(yp),a=M(zb),s=new URLSearchParams(window.location.search).get("userid"),c=$t(),u=a??Y.t("name.Tagline",c),d="aladdinIFI "+(a?Y.t("name.Tagline",c):"");let f=t1;return a&&(s?f+="?client=web&userid="+s+"&title="+encodeURIComponent(a):i.uid&&(f+="?client=web&userid="+i.uid+"&title="+encodeURIComponent(a))),h.jsxs(_4o,{style:t,children:[h.jsx(NAo,{url:f,subject:u,children:h.jsx(IAo,{size:e,round:o})}),h.jsx(z4o,{url:f,title:u,via:d,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(V4o,{size:e,round:o})}),h.jsx(_Ao,{url:f,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(jAo,{size:e,round:o})}),h.jsx(w4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(m4o,{size:e,round:o})}),h.jsx(C4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(S4o,{size:e,round:o})}),h.jsx(n4o,{url:f,title:u,style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(ZAo,{size:e,round:o})}),h.jsx(l4o,{url:f,title:u,summary:d,source:Y.t("name.IFI",c),style:{paddingRight:n},onShareWindowClose:r,children:h.jsx(r4o,{size:e,round:o})}),h.jsx(B4o,{url:f,title:u,separator:":: ",onShareWindowClose:r,children:h.jsx(W4o,{size:e,round:o})})]})});class pC{constructor(e,n,o){if(this.fitness=Number.NaN,this.chromosome=new Array(e),this.discretizationSteps=o,n)if(o)for(let r=0;re.fitness?1:this.fitness=this.chromosome.length)throw new Error("Gene index out of bound: "+e);this.chromosome[e]=n}getGene(e){if(e<0||e>=this.chromosome.length)throw new Error("Gene index out of bound: "+e);return this.chromosome[e]}copyGenes(e){const n=Math.min(this.chromosome.length,e.chromosome.length);for(let o=0;on.compare(e))}getNicheCount(e,n){let o=0;for(const r of this.individuals){const i=e.distance(r);let a=0;ie&&(e=o.fitness,n=o);return n}evolve(e,n){this.selectSurvivors(e),this.crossover(n)}selectSurvivors(e){this.survivors=[],this.sort();const n=Math.floor(e*this.individuals.length);for(let o=0;o=r){o=l;break}let a=null;do{r=Math.random()*n,i=0;for(const l of this.survivors)if(i+=l.fitness-e,i>=r){l!==o&&(a=l);break}}while(a===null);return o&&a?new gze(o,a):null}selectParentsByTournament(){const e=this.survivors.length;if(e<=1)throw new Error("Must have at least two survivors to be used as parents");const n=e-1;let o=Math.floor(Math.random()*n),r;do r=Math.floor(Math.random()*n);while(r===o);const i=this.survivors[o].fitness>this.survivors[r].fitness?o:r;o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);let a=this.survivors[o].fitness>this.survivors[r].fitness?o:r;for(;a===i;){o=Math.floor(Math.random()*n);do r=Math.floor(Math.random()*n);while(r===o);a=this.survivors[o].fitness>this.survivors[r].fitness?o:r}return new gze(this.survivors[i],this.survivors[a])}mutate(e){if(me.isZero(e))return;let n=Math.floor(e*(this.individuals.length-1));for(n===0?n=1:n===this.individuals.length-1&&(n=this.individuals.length-2),this.mutants=[];this.mutants.lengthe)return!1}return!0}}class Fat{constructor(e,n,o,r,i,a,l,s,c,u){this.fitnessSharingRadius=.1,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.constraints=[],this.stopped=!0,this.mutationRate=.1,this.crossoverRate=.5,this.selectionRate=.5,this.maximumGenerations=5,this.fittestOfGenerations=[],this.populationOfGenerations=[],this.outsideGenerationCounter=0,this.computeCounter=0,this.converged=!1,this.population=new mze(o,i,a,u),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.maximumGenerations=r,this.searchMethod=s,this.localSearchRadius=c,this.geneNames=new Array(i),this.foundation=e;const d=e.cx,f=e.cy,p=e.lx,g=e.ly;this.minima=new Array(i),this.maxima=new Array(i);for(let A=0;A=this.maximumGenerations}}class tL{static gaussian(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*n)}static twoGaussians(){let e=0,n=0;for(;e===0;)e=Math.random();for(;n===0;)n=Math.random();const o=new Array(2),r=Math.sqrt(-2*Math.log(e)),i=2*Math.PI*n;return o[0]=r*Math.cos(i),o[1]=r*Math.sin(i),o}static poisson(e){let n=0,o=Math.exp(-e),r=o;const i=Math.random();for(;i>r;)n++,o*=e/n,r+=o;return n}}class nL extends Fat{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,e.length,a,l,s,c),this.solarPanels=e;const u=this.population.individuals[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/Qt);if(u.setGene(d,p),this.searchMethod===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let g=1;g1;)y=tL.gaussian()*this.localSearchRadius+p;A.setGene(d,y)}this.geneNames[d]="Tilt Angle ("+f.id+")"}}applyFittest(){const e=this.population.getFittest();if(e){for(let n=0;n{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(c3),l=M(s3),s=M(l$),c=dt(Kq),u=M(IW),d=M(s$),f=M(bA).geneticAlgorithmParams,p=$t(),g=m.useRef(0),A=m.useRef(!1),y=m.useRef(!1),S=m.useRef(),C=m.useRef(),P=m.useRef(0),v=m.useRef(!1),T=m.useRef([]);m.useEffect(()=>{if(f.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&o===_s.GENETIC_ALGORITHM&&r){w(),g.current=requestAnimationFrame(b);const F=[...T.current];return()=>{cancelAnimationFrame(g.current),A.current||(gn(Y.t("message.EvolutionAborted",p)),dt.getState().set(E=>{E.evolutionInProgress=!1}),F.length>0&&(S.current=F,R(!0)))}}},[r]),m.useEffect(()=>{y.current=i,i?(cancelAnimationFrame(g.current),dt.getState().set(F=>{F.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",p))):(dt.getState().set(F=>{F.evolutionPaused=!1}),b())},[i]);const w=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),A.current=!1;const F=l(z.SolarPanel,a.id);T.current.length=0;for(const N of F)T.current.push(JSON.parse(JSON.stringify(N)));S.current=[];const E=[];for(const N of F)S.current.push(JSON.parse(JSON.stringify(N))),E.push(N.label);S.current.length>0?(C.current=new nL(S.current,a,f.objectiveFunctionType,f.populationSize,f.maximumGenerations,f.selectionMethod,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.selectionRate=f.selectionRate,C.current.crossoverRate=f.crossoverRate,C.current.mutationRate=f.mutationRate,P.current=0,v.current=!1,d(E),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(Y.t("message.EncounterEvolutionError",p))},x=()=>{let F=0;switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:{const E=Cn.getState().dailyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);break}case Po.YEARLY_TOTAL_OUTPUT:{const E=Cn.getState().yearlyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);F*=12/n;break}}return F};m.useEffect(()=>{!C.current||!c||(v.current=C.current.evolveIndividual(P.current%f.populationSize,x()),H(),P.current++,C.current.outsideGenerationCounter=Math.floor(P.current/f.populationSize),g.current=requestAnimationFrame(b))},[c]);const b=()=>{if(C.current&&o===_s.GENETIC_ALGORITHM&&r&&!y.current){if(v.current||C.current.outsideGenerationCounter>=f.maximumGenerations){if(cancelAnimationFrame(g.current),A.current=!0,C.current.applyFittest(),H(),R(!0),gn(Y.t("message.EvolutionCompleted",p)+` +`+(v.current?Y.t("message.ConvergenceThresholdHasBeenReached",p):Y.t("message.MaximumNumberOfGenerationsHasBeenReached",p))),e&&C.current){const F=C.current.population.getFittest();F&&t(E=>{var N;E.actionInfo={name:"Genetic Algorithm for Solar Panel Tilt Angle Completed",result:nL.individualToString(F),steps:(N=C.current)==null?void 0:N.outsideGenerationCounter,timestamp:new Date().getTime()}})}return}C.current.translateIndividual(P.current%f.populationSize),R(!1)}},R=F=>{dt.getState().set(E=>{if(S.current)switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:F?E.runDailySimulationForSolarPanelsLastStep=!0:E.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:F?E.runYearlySimulationForSolarPanelsLastStep=!0:E.runYearlySimulationForSolarPanels=!0;break;default:co(Y.t("message.ObjectiveFunctionTypeError",p),60)}}),t(E=>{if(S.current){switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:E.graphState&&(E.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:E.graphState&&(E.graphState.yearlyPvIndividualOutputs=!1);break;default:co(Y.t("message.ObjectiveFunctionTypeError",p),60)}for(const N of E.elements)if(N.type===z.SolarPanel){const U=N;for(const W of S.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),F&&dt.getState().set(E=>{E.runEvolution=!1,E.evolutionInProgress=!1,E.objectiveEvaluationIndex=0})},H=()=>{var E;if(!C.current)return;const F=[];for(let N=0;N0){const D=C.current.populationOfGenerations[N-1];if(D){let L=0;for(let j=0;j0&&F.push(U)}s(F)};return h.jsx(h.Fragment,{})});class J4o extends Fat{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x){if(super(c,u,d,f,3,p,g,A,y),this.orientation=vr.landscape,this.rowAxis=El.leftRight,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=S,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=v,this.minimumTiltAngle=T,this.maximumTiltAngle=w,this.margin=x,this.setInterRowSpacingBounds(),this.geneNames[0]="Tilt Angle",this.geneNames[1]="Inter-Row Spacing",this.geneNames[2]="Rack Width",a&&a.length>0){const b=a[0];if(a.length>1){const R=this.population.individuals[0],H=this.maximumTiltAngle===this.minimumTiltAngle?0:(b.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);R.setGene(0,H);const F=a[1],E=l?l.interRowSpacing:this.rowAxis===El.upDown?Math.abs(b.cx-F.cx)*this.foundation.lx:Math.abs(b.cy-F.cy)*this.foundation.ly;let N=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(E-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);N<0?N=0:N>1&&(N=1),R.setGene(1,N);const U=l?l.rowsPerRack:Math.max(1,Math.round(b.ly/(b.orientation===vr.portrait?e.length:e.width)));let W=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(U-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);W<0?W=0:W>1&&(W=1),R.setGene(2,W)}}}setInterRowSpacingBounds(){this.bounds=me.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){const e=this.population.getFittest();e&&console.log("Fittest: "+this.individualToString(e)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:return"kWh";case Po.YEARLY_PROFIT:case Po.DAILY_PROFIT:return"dollars"}return null}individualToString(e){let n="F("+me.toDegrees(e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return n+=(e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",n+=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",n+" = "+e.fitness.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideGenerationCounter=0,this.computeCounter=0,this.fittestOfGenerations.fill(null),this.setInterRowSpacingBounds()}translateIndividualByIndex(e){return this.translateIndividual(this.population.individuals[e])}translateBest(){const e=this.population.getFittest();return e?this.translateIndividual(e):[]}translateIndividual(e){if(!this.bounds)return[];const n=e.getGene(0)*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e.getGene(1)*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e.getGene(2)*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=qR.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=me.countSolarPanelsOnRack(a,this.pvModel);return i}evolveIndividual(e,n){var r;const o=this.population.individuals.length;if(!this.converged){const i=this.population.individuals[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.fittestOfGenerations[0]=i.getCopy());const a=Math.floor(this.computeCounter/o);console.log("Generation "+(a+1)+", individual "+e+" : "+this.individualToString(i)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.populationOfGenerations[a])==null?void 0:r.individuals[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(Gr),l=M(c3),s=M(s3),c=M(l$),u=dt(Kq),d=M(IW),f=M(s$),p=M(t5),g=M(Vge),A=M(bA).geneticAlgorithmParams,y=M.getState().solarPanelArrayLayoutConstraints,S=M.getState().economicsParams,C=M.getState().solarPanelArrayLayoutParams,P=m.useRef(0),v=m.useRef(!1),T=m.useRef(!1),w=m.useRef(),x=m.useRef(0),b=m.useRef(!1),R=m.useRef([]),H=m.useRef([]),F=$t(),E=l?a(l):void 0;m.useEffect(()=>{if(o===_s.GENETIC_ALGORITHM&&A.problem===Ri.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...H.current];return()=>{cancelAnimationFrame(P.current),v.current||(gn(Y.t("message.EvolutionAborted",F)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&g(l.id,!1),L.length>0&&(R.current=L,k(!0))},100))}}},[r]),m.useEffect(()=>{T.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",F))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!E)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),v.current=!1;const L=s(z.SolarPanel,E.id);H.current.length=0;for(const j of L)H.current.push(JSON.parse(JSON.stringify(j)));w.current=new J4o(p(y.pvModelName??"CS6X-355P-FG"),y.rowAxis??El.leftRight,y.orientation??vr.landscape,y.poleHeight??1,y.poleSpacing??3,H.current,C,l,E,A.objectiveFunctionType,A.populationSize,A.maximumGenerations,A.selectionMethod,A.convergenceThreshold,A.searchMethod,A.localSearchRadius,y.minimumInterRowSpacing,y.maximumInterRowSpacing,y.minimumRowsPerRack,y.maximumRowsPerRack,y.minimumTiltAngle,y.maximumTiltAngle,y.margin??0),w.current.selectionRate=A.selectionRate,w.current.crossoverRate=A.crossoverRate,w.current.mutationRate=A.mutationRate,x.current=0,b.current=!1,f([...w.current.geneNames]),w.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var B;let L=0;switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:{const O=Cn.getState().dailyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);break}case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:{const O=Cn.getState().yearlyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);L*=12/n;break}}const j=(B=w.current)==null?void 0:B.solarPanelCount;switch(A.objectiveFunctionType){case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Po.DAILY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit);break;case Po.YEARLY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit*365);break}return L};m.useEffect(()=>{!w.current||!u||(b.current=w.current.evolveIndividual(x.current%A.populationSize,U()),D(),x.current++,w.current.outsideGenerationCounter=Math.floor(x.current/A.populationSize),P.current=requestAnimationFrame(W))},[u]);const W=()=>{if(w.current&&o===_s.GENETIC_ALGORITHM&&r&&!T.current){if(b.current||w.current.outsideGenerationCounter>=A.maximumGenerations){if(cancelAnimationFrame(P.current),v.current=!0,R.current.length>0&&g(l.id,!1),R.current=w.current.translateBest(),w.current.applyFittest(),D(),k(!0),gn(Y.t("message.EvolutionCompleted",F)+` +`+(b.current?Y.t("message.ConvergenceThresholdHasBeenReached",F):Y.t("message.MaximumNumberOfGenerationsHasBeenReached",F))),w.current){const L=w.current.population.getFittest();if(L){const j=L.getGene(0)*(y.maximumTiltAngle-y.minimumTiltAngle)+y.minimumTiltAngle,B=L.getGene(1)*(y.maximumInterRowSpacing-y.minimumInterRowSpacing)+y.minimumInterRowSpacing,O=Math.floor(L.getGene(2)*(y.maximumRowsPerRack-y.minimumRowsPerRack)+y.minimumRowsPerRack);t(V=>{V.solarPanelArrayLayoutParams.tiltAngle=j,V.solarPanelArrayLayoutParams.interRowSpacing=B,V.solarPanelArrayLayoutParams.rowsPerRack=O,V.solarPanelArrayLayoutParams.orientation=y.orientation,V.solarPanelArrayLayoutParams.poleHeight=y.poleHeight}),e&&t(V=>{var G,q;V.actionInfo={name:"Genetic Algorithm for Solar Panel Array Layout Completed",result:(G=w.current)==null?void 0:G.individualToString(L),steps:(q=w.current)==null?void 0:q.outsideGenerationCounter,timestamp:new Date().getTime()}})}}return}g(l.id,!1),setTimeout(()=>{w.current&&(R.current=w.current.translateIndividualByIndex(x.current%A.populationSize)),k(!1)},100)}},k=L=>{dt.getState().set(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},D=()=>{if(!w.current)return;const L=[];for(let j=0;j0){const G=w.current.populationOfGenerations[j-1];if(G){let q=0;for(let $=0;$0&&L.push(B)}c(L)};return h.jsx(h.Fragment,{})});class q4o{constructor(e,n){this.fitness=Number.NaN,this.position=new Array,this.velocity=new Array,this.bestPositionOfParticle=new Array;for(let o=0;oe.fitness?1:this.fitnessn.compare(e)),Number.isNaN(this.bestFitness)||this.bestFitnesse)return!1}return!0}}class kat{constructor(e,n,o,r,i,a,l,s,c){this.stopped=!0,this.inertia=.8,this.cognitiveCoefficient=.1,this.socialCoefficient=.1,this.maximumSteps=5,this.bestPositionOfSteps=[],this.bestFitnessOfSteps=[],this.swarmOfSteps=[],this.outsideStepCounter=0,this.computeCounter=0,this.convergenceThreshold=.1,this.converged=!1,this.searchMethod=ds.GLOBAL_SEARCH_UNIFORM_SELECTION,this.localSearchRadius=.1,this.swarm=new yze(o,a,r),this.objectiveFunctionType=n,this.convergenceThreshold=l,this.searchMethod=s,this.localSearchRadius=c,this.maximumSteps=i,this.foundation=e,this.bestPositionOfSteps=new Array(this.maximumSteps+1),this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps=new Array(this.maximumSteps+1),this.bestFitnessOfSteps.fill(0),this.swarmOfSteps=new Array(this.maximumSteps);for(let u=0;u=this.maximumSteps}}class oL extends kat{constructor(e,n,o,r,i,a,l,s,c){super(n,o,r,i,a,e.length,l,s,c),this.solarPanels=e;const u=this.swarm.particles[0];for(const[d,f]of e.entries()){const p=.5*(1+f.tiltAngle/Qt);if(u.position[d]=p,this.searchMethod===ds.LOCAL_SEARCH_RANDOM_OPTIMIZATION)for(let g=1;g1;)y=tL.gaussian()*this.localSearchRadius+p;A.position[d]=y}}}applyFittest(){const e=this.swarm.bestPositionOfSwarm;if(e){for(let n=0;ni.fitness&&i.updateBestPosition(),i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+oL.particleToString(i.position,n));const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(c3),l=M(s3),s=M(l$),c=dt(Kq),u=M(IW),d=M(s$),f=M(bA).particleSwarmOptimizationParams,p=$t(),g=m.useRef(0),A=m.useRef(!1),y=m.useRef(!1),S=m.useRef(),C=m.useRef(),P=m.useRef(0),v=m.useRef(!1),T=m.useRef([]);m.useEffect(()=>{if(f.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r){w(),g.current=requestAnimationFrame(b);const F=[...T.current];return()=>{cancelAnimationFrame(g.current),A.current||(gn(Y.t("message.EvolutionAborted",p)),dt.getState().set(E=>{E.evolutionInProgress=!1}),F.length>0&&(S.current=F,R(!0)))}}},[r]),m.useEffect(()=>{y.current=i,i?(cancelAnimationFrame(g.current),dt.getState().set(F=>{F.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",p))):(dt.getState().set(F=>{F.evolutionPaused=!1}),b())},[i]);const w=()=>{if(!a)return;dt.getState().set(N=>{N.evolutionInProgress=!0,N.objectiveEvaluationIndex=0}),A.current=!1;const F=l(z.SolarPanel,a.id);T.current.length=0;for(const N of F)T.current.push(JSON.parse(JSON.stringify(N)));S.current=[];const E=[];for(const N of F)S.current.push(JSON.parse(JSON.stringify(N))),E.push(N.label);S.current.length>0?(C.current=new oL(S.current,a,f.objectiveFunctionType,f.swarmSize,f.vmax,f.maximumSteps,f.convergenceThreshold,f.searchMethod,f.localSearchRadius),C.current.inertia=f.inertia,C.current.cognitiveCoefficient=f.cognitiveCoefficient,C.current.socialCoefficient=f.socialCoefficient,P.current=0,v.current=!1,d(E),C.current.startEvolving(),t(N=>{N.viewState.showEvolutionPanel=!0,N.selectedFloatingWindow="solarPanelOptimizationResult"})):co(Y.t("message.EncounterEvolutionError",p))},x=()=>{let F=0;switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:{const E=Cn.getState().dailyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);break}case Po.YEARLY_TOTAL_OUTPUT:{const E=Cn.getState().yearlyPvYield;for(const N of E)for(const U in N)Object.hasOwn(N,U)&&U==="Total"&&(F+=N[U]);F*=12/n;break}}return F};m.useEffect(()=>{!C.current||!c||(v.current=C.current.updateParticle(P.current%f.swarmSize,x()),H(),P.current++,C.current.outsideStepCounter=Math.floor(P.current/f.swarmSize),g.current=requestAnimationFrame(b))},[c]);const b=()=>{if(C.current&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r&&!y.current){if(v.current||C.current.outsideStepCounter>=f.maximumSteps){if(cancelAnimationFrame(g.current),A.current=!0,C.current.applyFittest(),H(),R(!0),gn(Y.t("message.EvolutionCompleted",p)+` +`+(v.current?Y.t("message.ConvergenceThresholdHasBeenReached",p):Y.t("message.MaximumNumberOfStepsHasBeenReached",p))),e&&C.current){const F=C.current.swarm.bestPositionOfSwarm,E=C.current.swarm.bestFitness;F&&E&&t(N=>{var U;N.actionInfo={name:"Particle Swarm Optimization for Solar Panel Tilt Angle Completed",result:oL.particleToString(F,E),steps:(U=C.current)==null?void 0:U.outsideStepCounter,timestamp:new Date().getTime()}})}return}C.current.translateParticle(P.current%f.swarmSize),R(!1)}},R=F=>{dt.getState().set(E=>{if(S.current)switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:F?E.runDailySimulationForSolarPanelsLastStep=!0:E.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:F?E.runYearlySimulationForSolarPanelsLastStep=!0:E.runYearlySimulationForSolarPanels=!0;break}}),t(E=>{if(S.current){switch(f.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:E.graphState&&(E.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:E.graphState&&(E.graphState.yearlyPvIndividualOutputs=!1);break}for(const N of E.elements)if(N.type===z.SolarPanel){const U=N;for(const W of S.current)if(U.id===W.id){U.tiltAngle=W.tiltAngle;break}}}}),F&&dt.getState().set(E=>{E.runEvolution=!1,E.evolutionInProgress=!1,E.objectiveEvaluationIndex=0})},H=()=>{var E;if(!C.current)return;const F=[];for(let N=0;N0){const D=C.current.swarmOfSteps[N-1];if(D){let L=0;for(let j=0;j0&&F.push(U)}s(F)};return h.jsx(h.Fragment,{})});class Q4o extends kat{constructor(e,n,o,r,i,a,l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x){if(super(c,u,d,f,p,3,g,A,y),this.orientation=vr.landscape,this.rowAxis=El.leftRight,this.relativeMargin=.01,this.poleHeight=2,this.poleSpacing=5,this.solarPanelCount=0,this.solarRackCount=0,this.minimumInterRowSpacing=2,this.maximumInterRowSpacing=10,this.minimumRowsPerRack=1,this.maximumRowsPerRack=6,this.minimumTiltAngle=-Qt,this.maximumTiltAngle=Qt,this.margin=0,this.polygon=s,this.pvModel=e,this.rowAxis=n,this.orientation=o,this.poleHeight=r,this.poleSpacing=i,this.minimumInterRowSpacing=S,this.maximumInterRowSpacing=C,this.minimumRowsPerRack=P,this.maximumRowsPerRack=v,this.minimumTiltAngle=T,this.maximumTiltAngle=w,this.margin=x,this.setInterRowSpacingBounds(),a&&a.length>0){const b=a[0];if(a.length>1){const R=this.swarm.particles[0];R.position[0]=this.maximumTiltAngle===this.minimumTiltAngle?0:(b.tiltAngle-this.minimumTiltAngle)/(this.maximumTiltAngle-this.minimumTiltAngle);const H=a[1],F=l?l.interRowSpacing:this.rowAxis===El.upDown?Math.abs(b.cx-H.cx)*this.foundation.lx:Math.abs(b.cy-H.cy)*this.foundation.ly;let E=this.maximumInterRowSpacing===this.minimumInterRowSpacing?0:(F-this.minimumInterRowSpacing)/(this.maximumInterRowSpacing-this.minimumInterRowSpacing);E<0?E=0:E>1&&(E=1),R.position[1]=E;const N=l?l.rowsPerRack:Math.max(1,Math.round(b.ly/(b.orientation===vr.portrait?e.length:e.width)));let U=this.maximumRowsPerRack===this.minimumRowsPerRack?0:(N-this.minimumRowsPerRack)/(this.maximumRowsPerRack-this.minimumRowsPerRack);U<0?U=0:U>1&&(U=1),R.position[2]=U}}}setInterRowSpacingBounds(){this.bounds=me.calculatePolygonBounds(this.polygon.vertices)}applyFittest(){this.swarm.bestPositionOfSwarm&&console.log("Best: "+this.particleToString(this.swarm.bestPositionOfSwarm,this.swarm.bestFitness)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount)}getObjectiveUnit(){switch(this.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:return"kWh";case Po.YEARLY_PROFIT:case Po.DAILY_PROFIT:return"dollars"}return null}particleToString(e,n){let o="F("+me.toDegrees(e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle).toFixed(3)+"°, ";return o+=(e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing).toFixed(3)+"m, ",o+=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack)+")",o+" = "+n.toFixed(5)+" "+this.getObjectiveUnit()}startEvolving(){this.outsideStepCounter=0,this.computeCounter=0,this.bestPositionOfSteps.fill(null),this.bestFitnessOfSteps.fill(0),this.setInterRowSpacingBounds()}translateParticleByIndex(e){return this.translatePosition(this.swarm.particles[e].position)}translateBest(){return this.swarm.bestPositionOfSwarm?this.translatePosition(this.swarm.bestPositionOfSwarm):[]}translatePosition(e){if(!this.bounds)return[];const n=e[0]*(this.maximumTiltAngle-this.minimumTiltAngle)+this.minimumTiltAngle,o=e[1]*(this.maximumInterRowSpacing-this.minimumInterRowSpacing)+this.minimumInterRowSpacing,r=Math.floor(e[2]*(this.maximumRowsPerRack-this.minimumRowsPerRack)+this.minimumRowsPerRack),i=qR.create(this.polygon,this.foundation,this.pvModel,this.orientation,n,r,o,this.rowAxis,this.poleHeight,this.poleSpacing,this.margin);if(this.solarPanelCount=0,this.solarRackCount=i.length,i.length>0)for(const a of i)this.solarPanelCount+=me.countSolarPanelsOnRack(a,this.pvModel);return i}updateParticle(e,n){var r;const o=this.swarm.particles.length;if(!this.converged){const i=this.swarm.particles[e];i.fitness=n,this.computeCounter===0&&e===0&&(this.bestPositionOfSteps[0]=[...i.position],this.bestFitnessOfSteps[0]=n);const a=Math.floor(this.computeCounter/o);console.log("Step "+(a+1)+", particle "+e+" : "+this.particleToString(i.position,n)+", rack count: "+this.solarRackCount+", panel count: "+this.solarPanelCount);const l=(r=this.swarmOfSteps[a])==null?void 0:r.particles[e];if(l){for(let c=0;c{const t=M(pn),e=M(oa),n=M(zH)??6,o=M(kH),r=dt(n5),i=dt(Jq),a=M(Gr),l=M(c3),s=M(s3),c=M(t5),u=M(Vge),d=M(l$),f=dt(Kq),p=M(IW),g=M(s$),A=M(bA).particleSwarmOptimizationParams,y=M.getState().solarPanelArrayLayoutConstraints,S=M.getState().economicsParams,C=M.getState().solarPanelArrayLayoutParams,P=m.useRef(0),v=m.useRef(!1),T=m.useRef(!1),w=m.useRef(),x=m.useRef(0),b=m.useRef(!1),R=m.useRef([]),H=m.useRef([]),F=$t(),E=l?a(l):void 0;m.useEffect(()=>{if(o===_s.PARTICLE_SWARM_OPTIMIZATION&&A.problem===Ri.SOLAR_PANEL_ARRAY&&r){N(),P.current=requestAnimationFrame(W);const L=[...H.current];return()=>{cancelAnimationFrame(P.current),v.current||(gn(Y.t("message.EvolutionAborted",F)),dt.getState().set(j=>{j.evolutionInProgress=!1,j.runDailySimulationForSolarPanels=!1,j.runYearlySimulationForSolarPanels=!1}),setTimeout(()=>{R.current.length>0&&u(l.id,!1),L.length>0&&(R.current=L,k(!0))},100))}}},[r]),m.useEffect(()=>{T.current=i,i?(cancelAnimationFrame(P.current),dt.getState().set(L=>{L.evolutionPaused=!0}),gn(Y.t("message.EvolutionPaused",F))):(dt.getState().set(L=>{L.evolutionPaused=!1}),W())},[i]);const N=()=>{if(!l||!E)return;dt.getState().set(j=>{j.evolutionInProgress=!0,j.objectiveEvaluationIndex=0}),v.current=!1;const L=s(z.SolarPanel,E.id);H.current.length=0;for(const j of L)H.current.push(JSON.parse(JSON.stringify(j)));w.current=new Q4o(c(y.pvModelName??"CS6X-355P-FG"),y.rowAxis??El.leftRight,y.orientation??vr.landscape,y.poleHeight??1,y.poleSpacing??3,H.current,C,l,E,A.objectiveFunctionType,A.swarmSize,A.vmax,A.maximumSteps,A.convergenceThreshold,A.searchMethod,A.localSearchRadius,y.minimumInterRowSpacing,y.maximumInterRowSpacing,y.minimumRowsPerRack,y.maximumRowsPerRack,y.minimumTiltAngle,y.maximumTiltAngle,y.margin??0),w.current.inertia=A.inertia,w.current.cognitiveCoefficient=A.cognitiveCoefficient,w.current.socialCoefficient=A.socialCoefficient,x.current=0,b.current=!1,g(["Tilt Angle","Inter-Row Spacing","Rack Width"]),w.current.startEvolving(),t(j=>{j.viewState.showEvolutionPanel=!0,j.selectedFloatingWindow="solarPanelOptimizationResult"})},U=()=>{var B;let L=0;switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:{const O=Cn.getState().dailyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);break}case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:{const O=Cn.getState().yearlyPvYield;for(const V of O)for(const G in V)Object.hasOwn(V,G)&&G==="Total"&&(L+=V[G]);L*=12/n;break}}const j=(B=w.current)==null?void 0:B.solarPanelCount;switch(A.objectiveFunctionType){case Po.DAILY_AVERAGE_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:j&&(L/=j);break;case Po.DAILY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit);break;case Po.YEARLY_PROFIT:L=L*S.electricitySellingPrice,j&&(L-=j*S.operationalCostPerUnit*365);break}return L};m.useEffect(()=>{!w.current||!f||(b.current=w.current.updateParticle(x.current%A.swarmSize,U()),D(),x.current++,w.current.outsideStepCounter=Math.floor(x.current/A.swarmSize),P.current=requestAnimationFrame(W))},[f]);const W=()=>{if(w.current&&o===_s.PARTICLE_SWARM_OPTIMIZATION&&r&&!T.current){if(b.current||w.current.outsideStepCounter>=A.maximumSteps){if(cancelAnimationFrame(P.current),v.current=!0,R.current.length>0&&u(l.id,!1),R.current=w.current.translateBest(),w.current.applyFittest(),D(),k(!0),gn(Y.t("message.EvolutionCompleted",F)+` `+(b.current?Y.t("message.ConvergenceThresholdHasBeenReached",F):Y.t("message.MaximumNumberOfStepsHasBeenReached",F))),w.current){const L=w.current.swarm.bestPositionOfSwarm,j=w.current.swarm.bestFitness;if(L&&j){const B=L[0]*(y.maximumTiltAngle-y.minimumTiltAngle)+y.minimumTiltAngle,O=L[1]*(y.maximumInterRowSpacing-y.minimumInterRowSpacing)+y.minimumInterRowSpacing,V=Math.floor(L[2]*(y.maximumRowsPerRack-y.minimumRowsPerRack)+y.minimumRowsPerRack);t(G=>{G.solarPanelArrayLayoutParams.tiltAngle=B,G.solarPanelArrayLayoutParams.interRowSpacing=O,G.solarPanelArrayLayoutParams.rowsPerRack=V,G.solarPanelArrayLayoutParams.orientation=y.orientation,G.solarPanelArrayLayoutParams.poleHeight=y.poleHeight}),e&&t(G=>{var q,$;G.actionInfo={name:"Particle Swarm Optimization for Solar Panel Array Layout Completed",result:(q=w.current)==null?void 0:q.particleToString(L,j),steps:($=w.current)==null?void 0:$.outsideStepCounter,timestamp:new Date().getTime()}})}}return}u(l.id,!1),setTimeout(()=>{w.current&&(R.current=w.current.translateParticleByIndex(x.current%A.swarmSize)),k(!1)},100)}},k=L=>{dt.getState().set(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:L?j.runDailySimulationForSolarPanelsLastStep=!0:j.runDailySimulationForSolarPanels=!0;break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:L?j.runYearlySimulationForSolarPanelsLastStep=!0:j.runYearlySimulationForSolarPanels=!0;break}}),t(j=>{switch(A.objectiveFunctionType){case Po.DAILY_TOTAL_OUTPUT:case Po.DAILY_AVERAGE_OUTPUT:case Po.DAILY_PROFIT:j.graphState&&(j.graphState.dailyPvIndividualOutputs=!1);break;case Po.YEARLY_TOTAL_OUTPUT:case Po.YEARLY_AVERAGE_OUTPUT:case Po.YEARLY_PROFIT:j.graphState&&(j.graphState.yearlyPvIndividualOutputs=!1);break}j.elements.push(...R.current)}),L&&dt.getState().set(j=>{j.runEvolution=!1,j.evolutionInProgress=!1,j.objectiveEvaluationIndex=0})},D=()=>{if(!w.current)return;const L=[];for(let j=0;j0){const G=w.current.swarmOfSteps[j-1];if(G){let q=0;for(let $=0;$0&&L.push(B)}d(L)};return h.jsx(h.Fragment,{})}),e8o=be.memo(()=>{const t=M(n$),e=M(r$),n=M(i$),{gl:o}=ri();return o.domElement.style.cursor=t!==z.None||n||e?"crosshair":"default",null}),Mm=()=>{dt.getState().set(t=>{t.showSolarRadiationHeatmap=!1,t.showHeatFluxes=!1})},t8o=be.memo(({width:t=400,height:e=400})=>{const n=M(pn),o=M(En),r=M(s0),i=M(Mb),a=M(Sge),l=M(F4t),s=M(EBe),[c,u]=m.useState(null),d=100,f=m.useCallback(P=>{u(P)},[]),p=m.useCallback(function(){u(null)},[]),g=()=>{const P=new google.maps.LatLng(r,i);new google.maps.Geocoder().geocode({location:P},function(v,T){if(T===google.maps.GeocoderStatus.OK&&v&&v[0].address_components){n(w=>{w.world.address=v[0].formatted_address});for(const w of v[0].address_components)if(w.types[0]==="country"){n(x=>{x.world.countryCode=w.short_name});break}}}).then(()=>{})},A=k2.throttle(()=>{if(c){const P=c.getCenter();if(P){const v=P.lat(),T=P.lng();if(v!==r||T!==i){g();const w={name:"Set Location",timestamp:Date.now(),oldLatitude:r,newLatitude:v,oldLongitude:i,newLongitude:T,undo:()=>{Mm(),n(x=>{x.world.latitude=w.oldLatitude,x.world.longitude=w.oldLongitude})},redo:()=>{Mm(),n(x=>{x.world.latitude=w.newLatitude,x.world.longitude=w.newLongitude})}};o(w),Mm(),n(x=>{x.world.latitude=v,x.world.longitude=T})}}}},d,{leading:!1,trailing:!0}),y=k2.throttle(()=>{if(c){const P=c.getZoom();if(P!==void 0&&P!==a){g();const v={name:"Zoom Map",timestamp:Date.now(),oldValue:a,newValue:P,undo:()=>{n(T=>{T.viewState.mapZoom=v.oldValue})},redo:()=>{n(T=>{T.viewState.mapZoom=v.newValue})}};o(v),n(T=>{T.viewState.mapZoom=P})}}},d,{leading:!1,trailing:!0}),S=()=>{if(c){const P=c.getTilt();if(P!==void 0&&P!==l){const v={name:"Tilt Map",timestamp:Date.now(),oldValue:l,newValue:P,undo:()=>{n(T=>{T.viewState.mapTilt=v.oldValue})},redo:()=>{n(T=>{T.viewState.mapTilt=v.newValue})}};o(v),n(T=>{T.viewState.mapTilt=P})}}},C=()=>{if(c){const P=c.getMapTypeId();if(P!==void 0&&P!==s){const v={name:"Change Map Type",timestamp:Date.now(),oldValue:s,newValue:P,undo:()=>{n(T=>{T.viewState.mapType=v.oldValue,T.viewState.groundImageType=T.viewState.mapType})},redo:()=>{n(T=>{T.viewState.mapType=v.newValue,T.viewState.groundImageType=T.viewState.mapType})}};o(v),n(T=>{T.viewState.mapType=P,T.viewState.groundImageType=P})}}};return h.jsx(Nrt,{mapContainerStyle:{border:"1px solid",width:t+"px",height:e+"px"},mapTypeId:s,center:{lat:r,lng:i},zoom:a,tilt:l,onLoad:f,onUnmount:p,onCenterChanged:A,onZoomChanged:y,onTiltChanged:S,onMapTypeIdChanged:C})}),n8o=["places"],o8o=Ho.div` position: fixed; top: 40px; @@ -8574,14 +8574,14 @@ FIREBASE: `))},e.prototype.restoreState_=function(){var n,o,r,i;this.tryAuth(),t A`).concat(a,",").concat(a,",0,1,1,").concat(2*l,",").concat(i,` H`).concat(vm,"M").concat(2*l,",").concat(i,` A`).concat(a,",").concat(a,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(o.type==="rect")return be.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(vm/8,"h").concat(vm,"v").concat(vm*3/4,"h").concat(-vm,"z"),className:"recharts-legend-icon"});if(be.isValidElement(o.legendIcon)){var c=P7o({},o);return delete c.legendIcon,be.cloneElement(o.legendIcon,c)}return be.createElement(Zee,{fill:s,cx:i,cy:i,size:vm,sizeType:"diameter",type:o.type})}},{key:"renderItems",value:function(){var o=this,r=this.props,i=r.payload,a=r.iconSize,l=r.layout,s=r.formatter,c=r.inactiveColor,u={x:0,y:0,width:vm,height:vm},d={display:l==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,g){var A=p.formatter||s,y=fl(aL(aL({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",p.inactive));if(p.type==="none")return null;var S=xa(p.value)?null:p.value;O6(!xa(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: `);var C=p.inactive?c:p.color;return be.createElement("li",che({className:y,style:d,key:"legend-item-".concat(g)},rL(o.props,p,g)),be.createElement(ehe,{width:a,height:a,viewBox:u,style:f},o.renderIcon(p)),be.createElement("span",{className:"recharts-legend-item-text",style:{color:C}},A?A(S,p,g):S))})}},{key:"render",value:function(){var o=this.props,r=o.payload,i=o.layout,a=o.align;if(!r||!r.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?a:"left"};return be.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}]),e}(m.PureComponent);aL(D3e,"displayName","Legend");aL(D3e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});function F7o(t,e,n,o){for(var r=t.length,i=n+(o?1:-1);o?i--:++i-1}var G7o=_7o;function X7o(t,e,n){for(var o=-1,r=t==null?0:t.length;++o=svo){var c=e?null:avo(t);if(c)return lvo(c);a=!1,r=ivo,s=new nvo}else s=e?[]:l;e:for(;++o=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function Svo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function Tvo(t){return t.value}function Pvo(t,e){if(be.isValidElement(t))return be.cloneElement(t,e);if(typeof t=="function")return be.createElement(t,e);e.ref;var n=bvo(e,gvo);return be.createElement(D3e,n)}var kze=1,X2=function(t){vvo(e,t);function e(){var n;mvo(this,e);for(var o=arguments.length,r=new Array(o),i=0;ikze||Math.abs(r.height-this.lastBoundingBox.height)>kze)&&(this.lastBoundingBox.width=r.width,this.lastBoundingBox.height=r.height,o&&o(r)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,o&&o(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?av({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(o){var r=this.props,i=r.layout,a=r.align,l=r.verticalAlign,s=r.margin,c=r.chartWidth,u=r.chartHeight,d,f;if(!o||(o.left===void 0||o.left===null)&&(o.right===void 0||o.right===null))if(a==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();d={left:((c||0)-p.width)/2}}else d=a==="right"?{right:s&&s.right||0}:{left:s&&s.left||0};if(!o||(o.top===void 0||o.top===null)&&(o.bottom===void 0||o.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();f={top:((u||0)-g.height)/2}}else f=l==="bottom"?{bottom:s&&s.bottom||0}:{top:s&&s.top||0};return av(av({},d),f)}},{key:"render",value:function(){var o=this,r=this.props,i=r.content,a=r.width,l=r.height,s=r.wrapperStyle,c=r.payloadUniqBy,u=r.payload,d=av(av({position:"absolute",width:a||"auto",height:l||"auto"},this.getDefaultPosition(s)),s);return be.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(p){o.wrapperNode=p}},Pvo(i,av(av({},this.props),{},{payload:hlt(u,c,Tvo)})))}}],[{key:"getWithHeight",value:function(o,r){var i=o.props.layout;return i==="vertical"&&dr(o.props.height)?{height:o.props.height}:i==="horizontal"?{width:o.props.width||r}:null}}]),e}(m.PureComponent);ete(X2,"displayName","Legend");ete(X2,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var Lze=pM,Cvo=W5e,Rvo=xp,Wze=Lze?Lze.isConcatSpreadable:void 0;function Hvo(t){return Rvo(t)||Cvo(t)||!!(Wze&&t&&t[Wze])}var Mvo=Hvo,Ivo=Q5e,zvo=Mvo;function ylt(t,e,n,o,r){var i=-1,a=t.length;for(n||(n=zvo),r||(r=[]);++i0&&n(l)?e>1?ylt(l,e-1,n,o,r):Ivo(r,l):o||(r[r.length]=l)}return r}var Alt=ylt;function Dvo(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}var Evo=Dvo,Nze=SM;function Fvo(t,e){if(t!==e){var n=t!==void 0,o=t===null,r=t===t,i=Nze(t),a=e!==void 0,l=e===null,s=e===e,c=Nze(e);if(!l&&!c&&!i&&t>e||i&&a&&s&&!l&&!c||o&&a&&s||!n&&s||!r)return 1;if(!o&&!i&&!c&&t=l)return s;var c=n[o];return s*(c=="desc"?-1:1)}}return t.index-e.index}var Nvo=Wvo,yle=X5e,Uvo=o9e,jvo=$w,Bvo=Wot,Yvo=Evo,Ovo=eee,Vvo=Nvo,_vo=oS,Gvo=xp;function Xvo(t,e,n){e.length?e=yle(e,function(i){return Gvo(i)?function(a){return Uvo(a,i.length===1?i[0]:i)}:i}):e=[_vo];var o=-1;e=yle(e,Ovo(jvo));var r=Bvo(t,function(i,a,l){var s=yle(e,function(c){return c(i)});return{criteria:s,index:++o,value:i}});return Yvo(r,function(i,a){return Vvo(i,a,n)})}var Jvo=Xvo;function Kvo(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var qvo=Kvo,$vo=qvo,Uze=Math.max;function Qvo(t,e,n){return e=Uze(e===void 0?t.length-1:e,0),function(){for(var o=arguments,r=-1,i=Uze(o.length-e,0),a=Array(i);++r0){if(++e>=axo)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var uxo=cxo,dxo=ixo,fxo=uxo,hxo=fxo(dxo),pxo=hxo,gxo=oS,mxo=Zvo,yxo=pxo;function Axo(t,e){return yxo(mxo(t,e,gxo),t+"")}var wxo=Axo,vxo=tee,xxo=mM,bxo=U5e,Sxo=c5;function Txo(t,e,n){if(!Sxo(n))return!1;var o=typeof e;return(o=="number"?xxo(n)&&bxo(e,n.length):o=="string"&&e in n)?vxo(n[e],t):!1}var tte=Txo,Pxo=Alt,Cxo=Jvo,Rxo=wxo,Bze=tte,Hxo=Rxo(function(t,e){if(t==null)return[];var n=e.length;return n>1&&Bze(t,e[0],e[1])?e=[]:n>2&&Bze(e[0],e[1],e[2])&&(e=[e[0]]),Cxo(t,Pxo(e,1),[])}),Mxo=Hxo;const E3e=Wi(Mxo);function lL(t){"@babel/helpers - typeof";return lL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lL(t)}function fhe(){return fhe=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=e.x),"".concat(fD,"-left"),dr(n)&&e&&dr(e.x)&&n=e.y),"".concat(fD,"-top"),dr(o)&&e&&dr(e.y)&&oA?Math.max(u,s[o]):Math.max(d,s[o])}function Vxo(t){var e=t.translateX,n=t.translateY,o=t.useTranslate3d;return{transform:o?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function _xo(t){var e=t.allowEscapeViewBox,n=t.coordinate,o=t.offsetTopLeft,r=t.position,i=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,s=t.viewBox,c,u,d;return a.height>0&&a.width>0&&n?(u=Vze({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:o,position:r,reverseDirection:i,tooltipDimension:a.width,viewBox:s,viewBoxDimension:s.width}),d=Vze({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:o,position:r,reverseDirection:i,tooltipDimension:a.height,viewBox:s,viewBoxDimension:s.height}),c=Vxo({translateX:u,translateY:d,useTranslate3d:l})):c=Yxo,{cssProperties:c,cssClasses:Oxo({translateX:u,translateY:d,coordinate:n})}}function aH(t){"@babel/helpers - typeof";return aH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aH(t)}function _ze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Gze(t){for(var e=1;eXze||Math.abs(o.height-this.state.lastBoundingBox.height)>Xze)&&this.setState({lastBoundingBox:{width:o.width,height:o.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var o,r;this.props.active&&this.updateBBox(),this.state.dismissed&&(((o=this.props.coordinate)===null||o===void 0?void 0:o.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var o=this,r=this.props,i=r.active,a=r.allowEscapeViewBox,l=r.animationDuration,s=r.animationEasing,c=r.children,u=r.coordinate,d=r.hasPayload,f=r.isAnimationActive,p=r.offset,g=r.position,A=r.reverseDirection,y=r.useTranslate3d,S=r.viewBox,C=r.wrapperStyle,P=_xo({allowEscapeViewBox:a,coordinate:u,offsetTopLeft:p,position:g,reverseDirection:A,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:S}),v=P.cssClasses,T=P.cssProperties,w=Gze(Gze({transition:f&&i?"transform ".concat(l,"ms ").concat(s):void 0},T),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&d?"visible":"hidden",position:"absolute",top:0,left:0},C);return be.createElement("div",{tabIndex:-1,className:v,style:w,ref:function(b){o.wrapperNode=b}},c)}}]),e}(m.PureComponent),ebo=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},j2={isSsr:ebo(),get:function(e){return j2[e]},set:function(e,n){if(typeof e=="string")j2[e]=n;else{var o=Object.keys(e);o&&o.length&&o.forEach(function(r){j2[r]=e[r]})}}};function lH(t){"@babel/helpers - typeof";return lH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lH(t)}function Jze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Kze(t){for(var e=1;e0;return be.createElement(Zxo,{allowEscapeViewBox:a,animationDuration:l,animationEasing:s,isAnimationActive:f,active:i,coordinate:u,hasPayload:w,offset:p,position:y,reverseDirection:S,useTranslate3d:C,viewBox:P,wrapperStyle:v},ubo(c,Kze(Kze({},this.props),{},{payload:T})))}}]),e}(m.PureComponent);F3e(oh,"displayName","Tooltip");F3e(oh,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!j2.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var dbo=l5,fbo=function(){return dbo.Date.now()},hbo=fbo,pbo=/\s/;function gbo(t){for(var e=t.length;e--&&pbo.test(t.charAt(e)););return e}var mbo=gbo,ybo=mbo,Abo=/^\s+/;function wbo(t){return t&&t.slice(0,ybo(t)+1).replace(Abo,"")}var vbo=wbo,xbo=vbo,qze=c5,bbo=SM,$ze=NaN,Sbo=/^[-+]0x[0-9a-f]+$/i,Tbo=/^0b[01]+$/i,Pbo=/^0o[0-7]+$/i,Cbo=parseInt;function Rbo(t){if(typeof t=="number")return t;if(bbo(t))return $ze;if(qze(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=qze(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=xbo(t);var n=Tbo.test(t);return n||Pbo.test(t)?Cbo(t.slice(2),n?2:8):Sbo.test(t)?$ze:+t}var Slt=Rbo,Hbo=c5,wle=hbo,Qze=Slt,Mbo="Expected a function",Ibo=Math.max,zbo=Math.min;function Dbo(t,e,n){var o,r,i,a,l,s,c=0,u=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(Mbo);e=Qze(e)||0,Hbo(n)&&(u=!!n.leading,d="maxWait"in n,i=d?Ibo(Qze(n.maxWait)||0,e):i,f="trailing"in n?!!n.trailing:f);function p(w){var x=o,b=r;return o=r=void 0,c=w,a=t.apply(b,x),a}function g(w){return c=w,l=setTimeout(S,e),u?p(w):a}function A(w){var x=w-s,b=w-c,R=e-x;return d?zbo(R,i-b):R}function y(w){var x=w-s,b=w-c;return s===void 0||x>=e||x<0||d&&b>=i}function S(){var w=wle();if(y(w))return C(w);l=setTimeout(S,A(w))}function C(w){return l=void 0,f&&o?p(w):(o=r=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,o=s=r=l=void 0}function v(){return l===void 0?a:C(wle())}function T(){var w=wle(),x=y(w);if(o=arguments,r=this,s=w,x){if(l===void 0)return g(s);if(d)return clearTimeout(l),l=setTimeout(S,e),p(s)}return l===void 0&&(l=setTimeout(S,e)),a}return T.cancel=P,T.flush=v,T}var Ebo=Dbo,Fbo=Ebo,kbo=c5,Lbo="Expected a function";function Wbo(t,e,n){var o=!0,r=!0;if(typeof t!="function")throw new TypeError(Lbo);return kbo(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),Fbo(t,e,{leading:o,maxWait:e,trailing:r})}var Nbo=Wbo;const Tlt=Wi(Nbo);function cL(t){"@babel/helpers - typeof";return cL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cL(t)}function Zze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ZO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=e.x),"".concat(fD,"-left"),dr(n)&&e&&dr(e.x)&&n=e.y),"".concat(fD,"-top"),dr(o)&&e&&dr(e.y)&&oA?Math.max(u,s[o]):Math.max(d,s[o])}function Vxo(t){var e=t.translateX,n=t.translateY,o=t.useTranslate3d;return{transform:o?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function _xo(t){var e=t.allowEscapeViewBox,n=t.coordinate,o=t.offsetTopLeft,r=t.position,i=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,s=t.viewBox,c,u,d;return a.height>0&&a.width>0&&n?(u=Vze({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:o,position:r,reverseDirection:i,tooltipDimension:a.width,viewBox:s,viewBoxDimension:s.width}),d=Vze({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:o,position:r,reverseDirection:i,tooltipDimension:a.height,viewBox:s,viewBoxDimension:s.height}),c=Vxo({translateX:u,translateY:d,useTranslate3d:l})):c=Yxo,{cssProperties:c,cssClasses:Oxo({translateX:u,translateY:d,coordinate:n})}}function aH(t){"@babel/helpers - typeof";return aH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aH(t)}function _ze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Gze(t){for(var e=1;eXze||Math.abs(o.height-this.state.lastBoundingBox.height)>Xze)&&this.setState({lastBoundingBox:{width:o.width,height:o.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var o,r;this.props.active&&this.updateBBox(),this.state.dismissed&&(((o=this.props.coordinate)===null||o===void 0?void 0:o.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var o=this,r=this.props,i=r.active,a=r.allowEscapeViewBox,l=r.animationDuration,s=r.animationEasing,c=r.children,u=r.coordinate,d=r.hasPayload,f=r.isAnimationActive,p=r.offset,g=r.position,A=r.reverseDirection,y=r.useTranslate3d,S=r.viewBox,C=r.wrapperStyle,P=_xo({allowEscapeViewBox:a,coordinate:u,offsetTopLeft:p,position:g,reverseDirection:A,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:S}),v=P.cssClasses,T=P.cssProperties,w=Gze(Gze({transition:f&&i?"transform ".concat(l,"ms ").concat(s):void 0},T),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&d?"visible":"hidden",position:"absolute",top:0,left:0},C);return be.createElement("div",{tabIndex:-1,className:v,style:w,ref:function(b){o.wrapperNode=b}},c)}}]),e}(m.PureComponent),ebo=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},j2={isSsr:ebo(),get:function(e){return j2[e]},set:function(e,n){if(typeof e=="string")j2[e]=n;else{var o=Object.keys(e);o&&o.length&&o.forEach(function(r){j2[r]=e[r]})}}};function lH(t){"@babel/helpers - typeof";return lH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lH(t)}function Jze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Kze(t){for(var e=1;e0;return be.createElement(Zxo,{allowEscapeViewBox:a,animationDuration:l,animationEasing:s,isAnimationActive:f,active:i,coordinate:u,hasPayload:w,offset:p,position:y,reverseDirection:S,useTranslate3d:C,viewBox:P,wrapperStyle:v},ubo(c,Kze(Kze({},this.props),{},{payload:T})))}}]),e}(m.PureComponent);F3e(rh,"displayName","Tooltip");F3e(rh,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!j2.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var dbo=l5,fbo=function(){return dbo.Date.now()},hbo=fbo,pbo=/\s/;function gbo(t){for(var e=t.length;e--&&pbo.test(t.charAt(e)););return e}var mbo=gbo,ybo=mbo,Abo=/^\s+/;function wbo(t){return t&&t.slice(0,ybo(t)+1).replace(Abo,"")}var vbo=wbo,xbo=vbo,qze=c5,bbo=SM,$ze=NaN,Sbo=/^[-+]0x[0-9a-f]+$/i,Tbo=/^0b[01]+$/i,Pbo=/^0o[0-7]+$/i,Cbo=parseInt;function Rbo(t){if(typeof t=="number")return t;if(bbo(t))return $ze;if(qze(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=qze(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=xbo(t);var n=Tbo.test(t);return n||Pbo.test(t)?Cbo(t.slice(2),n?2:8):Sbo.test(t)?$ze:+t}var Slt=Rbo,Hbo=c5,wle=hbo,Qze=Slt,Mbo="Expected a function",Ibo=Math.max,zbo=Math.min;function Dbo(t,e,n){var o,r,i,a,l,s,c=0,u=!1,d=!1,f=!0;if(typeof t!="function")throw new TypeError(Mbo);e=Qze(e)||0,Hbo(n)&&(u=!!n.leading,d="maxWait"in n,i=d?Ibo(Qze(n.maxWait)||0,e):i,f="trailing"in n?!!n.trailing:f);function p(w){var x=o,b=r;return o=r=void 0,c=w,a=t.apply(b,x),a}function g(w){return c=w,l=setTimeout(S,e),u?p(w):a}function A(w){var x=w-s,b=w-c,R=e-x;return d?zbo(R,i-b):R}function y(w){var x=w-s,b=w-c;return s===void 0||x>=e||x<0||d&&b>=i}function S(){var w=wle();if(y(w))return C(w);l=setTimeout(S,A(w))}function C(w){return l=void 0,f&&o?p(w):(o=r=void 0,a)}function P(){l!==void 0&&clearTimeout(l),c=0,o=s=r=l=void 0}function v(){return l===void 0?a:C(wle())}function T(){var w=wle(),x=y(w);if(o=arguments,r=this,s=w,x){if(l===void 0)return g(s);if(d)return clearTimeout(l),l=setTimeout(S,e),p(s)}return l===void 0&&(l=setTimeout(S,e)),a}return T.cancel=P,T.flush=v,T}var Ebo=Dbo,Fbo=Ebo,kbo=c5,Lbo="Expected a function";function Wbo(t,e,n){var o=!0,r=!0;if(typeof t!="function")throw new TypeError(Lbo);return kbo(n)&&(o="leading"in n?!!n.leading:o,r="trailing"in n?!!n.trailing:r),Fbo(t,e,{leading:o,maxWait:e,trailing:r})}var Nbo=Wbo;const Tlt=Wi(Nbo);function cL(t){"@babel/helpers - typeof";return cL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cL(t)}function Zze(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ZO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&(N=Tlt(N,A,{trailing:!0,leading:!1}));var U=new ResizeObserver(N),W=T.current.getBoundingClientRect(),k=W.width,D=W.height;return F(k,D),U.observe(T.current),function(){U.disconnect()}},[F,A]);var E=m.useMemo(function(){var N=R.containerWidth,U=R.containerHeight;if(N<0||U<0)return null;O6(nx(a)||nx(s),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,a,s),O6(!n||n>0,"The aspect(%s) must be greater than zero.",n);var W=nx(a)?N:a,k=nx(s)?U:s;n&&n>0&&(W?k=W/n:k&&(W=k*n),f&&k>f&&(k=f)),O6(W>0||k>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,W,k,a,s,u,d,n);var D=!Array.isArray(p)&&Kfe.isElement(p)&&Y6(p.type).endsWith("Chart");return be.Children.map(p,function(L){return Kfe.isElement(L)?m.cloneElement(L,ZO({width:W,height:k},D?{style:ZO({height:"100%",width:"100%",maxHeight:k,maxWidth:W},L.props.style)}:{})):L})},[n,p,s,f,d,u,R,a]);return be.createElement("div",{id:y?"".concat(y):void 0,className:fl("recharts-responsive-container",S),style:ZO(ZO({},v),{},{width:a,height:s,minWidth:u,minHeight:d,maxHeight:f}),ref:T},E)}),k3e=function(e){return null};k3e.displayName="Cell";function uL(t){"@babel/helpers - typeof";return uL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uL(t)}function tDe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function yhe(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||j2.isSsr)return{width:0,height:0};var o=Qbo(n),r=JSON.stringify({text:e,copyStyle:o});if(nP.widthCache[r])return nP.widthCache[r];try{var i=document.getElementById(nDe);i||(i=document.createElement("span"),i.setAttribute("id",nDe),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var a=yhe(yhe({},$bo),o);Object.assign(i.style,a),i.textContent="".concat(e);var l=i.getBoundingClientRect(),s={width:l.width,height:l.height};return nP.widthCache[r]=s,++nP.cacheCount>qbo&&(nP.cacheCount=0,nP.widthCache={}),s}catch{return{width:0,height:0}}},Zbo=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function dL(t){"@babel/helpers - typeof";return dL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dL(t)}function GJ(t,e){return oSo(t)||nSo(t,e)||tSo(t,e)||eSo()}function eSo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tSo(t,e){if(t){if(typeof t=="string")return oDe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oDe(t,e)}}function oDe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function ySo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function cDe(t,e){return xSo(t)||vSo(t,e)||wSo(t,e)||ASo()}function ASo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wSo(t,e){if(t){if(typeof t=="string")return uDe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uDe(t,e)}}function uDe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return W.reduce(function(k,D){var L=D.word,j=D.width,B=k[k.length-1];if(B&&(r==null||i||B.width+j+oD.width?k:D})};if(!u)return p;for(var A="…",y=function(W){var k=d.slice(0,W),D=Hlt({breakAll:c,style:s,children:k+A}).wordsWithComputedWidth,L=f(D),j=L.length>a||g(L).width>Number(r);return[j,L]},S=0,C=d.length-1,P=0,v;S<=C&&P<=d.length-1;){var T=Math.floor((S+C)/2),w=T-1,x=y(w),b=cDe(x,2),R=b[0],H=b[1],F=y(T),E=cDe(F,1),N=E[0];if(!R&&!N&&(S=T+1),R&&N&&(C=T-1),!R&&N){v=H;break}P++}return v||p},dDe=function(e){var n=aa(e)?[]:e.toString().split(Rlt);return[{words:n}]},SSo=function(e){var n=e.width,o=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,l=e.maxLines;if((n||o)&&!j2.isSsr){var s,c,u=Hlt({breakAll:a,children:r,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;s=d,c=f}else return dDe(r);return bSo({breakAll:a,children:r,maxLines:l,style:i},s,c,n,o)}return dDe(r)},fDe="#808080",XJ=function(e){var n=e.x,o=n===void 0?0:n,r=e.y,i=r===void 0?0:r,a=e.lineHeight,l=a===void 0?"1em":a,s=e.capHeight,c=s===void 0?"0.71em":s,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,p=f===void 0?"start":f,g=e.verticalAnchor,A=g===void 0?"end":g,y=e.fill,S=y===void 0?fDe:y,C=sDe(e,gSo),P=m.useMemo(function(){return SSo({breakAll:C.breakAll,children:C.children,maxLines:C.maxLines,scaleToFit:d,style:C.style,width:C.width})},[C.breakAll,C.children,C.maxLines,d,C.style,C.width]),v=C.dx,T=C.dy,w=C.angle,x=C.className,b=C.breakAll,R=sDe(C,mSo);if(!Nu(o)||!Nu(i))return null;var H=o+(dr(v)?v:0),F=i+(dr(T)?T:0),E;switch(A){case"start":E=vle("calc(".concat(c,")"));break;case"middle":E=vle("calc(".concat((P.length-1)/2," * -").concat(l," + (").concat(c," / 2))"));break;default:E=vle("calc(".concat(P.length-1," * -").concat(l,")"));break}var N=[];if(d){var U=P[0].width,W=C.width;N.push("scale(".concat((dr(W)?W/U:1)/U,")"))}return w&&N.push("rotate(".concat(w,", ").concat(H,", ").concat(F,")")),N.length&&(R.transform=N.join(" ")),be.createElement("text",Ahe({},ia(R,!0),{x:H,y:F,className:fl("recharts-text",x),textAnchor:p,fill:S.includes("url")?fDe:S}),P.map(function(k,D){var L=k.words.join(b?"":" ");return be.createElement("tspan",{x:H,dy:D===0?E:l,key:L},L)}))};function $8(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function TSo(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function L3e(t){let e,n,o;t.length!==2?(e=$8,n=(l,s)=>$8(t(l),s),o=(l,s)=>t(l)-s):(e=t===$8||t===TSo?t:PSo,n=t,o=t);function r(l,s,c=0,u=l.length){if(c>>1;n(l[d],s)<0?c=d+1:u=d}while(c>>1;n(l[d],s)<=0?c=d+1:u=d}while(cc&&o(l[d-1],s)>-o(l[d],s)?d-1:d}return{left:r,center:a,right:i}}function PSo(){return 0}function Mlt(t){return t===null?NaN:+t}function*CSo(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const RSo=L3e($8),fU=RSo.right;L3e(Mlt).center;class hDe extends Map{constructor(e,n=ISo){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[o,r]of e)this.set(o,r)}get(e){return super.get(pDe(this,e))}has(e){return super.has(pDe(this,e))}set(e,n){return super.set(HSo(this,e),n)}delete(e){return super.delete(MSo(this,e))}}function pDe({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):n}function HSo({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):(t.set(o,n),n)}function MSo({_intern:t,_key:e},n){const o=e(n);return t.has(o)&&(n=t.get(o),t.delete(o)),n}function ISo(t){return t!==null&&typeof t=="object"?t.valueOf():t}function zSo(t=$8){if(t===$8)return Ilt;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const o=t(e,n);return o||o===0?o:(t(n,n)===0)-(t(e,e)===0)}}function Ilt(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const DSo=Math.sqrt(50),ESo=Math.sqrt(10),FSo=Math.sqrt(2);function JJ(t,e,n){const o=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(o)),i=o/Math.pow(10,r),a=i>=DSo?10:i>=ESo?5:i>=FSo?2:1;let l,s,c;return r<0?(c=Math.pow(10,-r)/a,l=Math.round(t*c),s=Math.round(e*c),l/ce&&--s,c=-c):(c=Math.pow(10,r)*a,l=Math.round(t/c),s=Math.round(e/c),l*ce&&--s),s0))return[];if(t===e)return[t];const o=e=r))return[];const l=i-r+1,s=new Array(l);if(o)if(a<0)for(let c=0;c=o)&&(n=o);return n}function mDe(t,e){let n;for(const o of t)o!=null&&(n>o||n===void 0&&o>=o)&&(n=o);return n}function zlt(t,e,n=0,o=1/0,r){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(t.length-1,o)),!(n<=e&&e<=o))return t;for(r=r===void 0?Ilt:zSo(r);o>n;){if(o-n>600){const s=o-n+1,c=e-n+1,u=Math.log(s),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(s-d)/s)*(c-s/2<0?-1:1),p=Math.max(n,Math.floor(e-c*d/s+f)),g=Math.min(o,Math.floor(e+(s-c)*d/s+f));zlt(t,e,p,g,r)}const i=t[e];let a=n,l=o;for(hD(t,n,e),r(t[o],i)>0&&hD(t,n,o);a0;)--l}r(t[n],i)===0?hD(t,n,l):(++l,hD(t,l,o)),l<=e&&(n=l+1),e<=l&&(o=l-1)}return t}function hD(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function kSo(t,e,n){if(t=Float64Array.from(CSo(t)),!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return mDe(t);if(e>=1)return gDe(t);var o,r=(o-1)*e,i=Math.floor(r),a=gDe(zlt(t,i).subarray(0,i+1)),l=mDe(t.subarray(i+1));return a+(l-a)*(r-i)}}function LSo(t,e,n=Mlt){if(!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return+n(t[0],0,t);if(e>=1)return+n(t[o-1],o-1,t);var o,r=(o-1)*e,i=Math.floor(r),a=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return a+(l-a)*(r-i)}}function WSo(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var o=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(r);++o>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?tV(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?tV(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=USo.exec(t))?new Jp(e[1],e[2],e[3],1):(e=jSo.exec(t))?new Jp(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=BSo.exec(t))?tV(e[1],e[2],e[3],e[4]):(e=YSo.exec(t))?tV(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=OSo.exec(t))?SDe(e[1],e[2]/100,e[3]/100,1):(e=VSo.exec(t))?SDe(e[1],e[2]/100,e[3]/100,e[4]):yDe.hasOwnProperty(t)?vDe(yDe[t]):t==="transparent"?new Jp(NaN,NaN,NaN,0):null}function vDe(t){return new Jp(t>>16&255,t>>8&255,t&255,1)}function tV(t,e,n,o){return o<=0&&(t=e=n=NaN),new Jp(t,e,n,o)}function XSo(t){return t instanceof hU||(t=gL(t)),t?(t=t.rgb(),new Jp(t.r,t.g,t.b,t.opacity)):new Jp}function She(t,e,n,o){return arguments.length===1?XSo(t):new Jp(t,e,n,o??1)}function Jp(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}W3e(Jp,She,Elt(hU,{brighter(t){return t=t==null?KJ:Math.pow(KJ,t),new Jp(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?hL:Math.pow(hL,t),new Jp(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Jp(Fx(this.r),Fx(this.g),Fx(this.b),qJ(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xDe,formatHex:xDe,formatHex8:JSo,formatRgb:bDe,toString:bDe}));function xDe(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}`}function JSo(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}${ox((isNaN(this.opacity)?1:this.opacity)*255)}`}function bDe(){const t=qJ(this.opacity);return`${t===1?"rgb(":"rgba("}${Fx(this.r)}, ${Fx(this.g)}, ${Fx(this.b)}${t===1?")":`, ${t})`}`}function qJ(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fx(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ox(t){return t=Fx(t),(t<16?"0":"")+t.toString(16)}function SDe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new w2(t,e,n,o)}function Flt(t){if(t instanceof w2)return new w2(t.h,t.s,t.l,t.opacity);if(t instanceof hU||(t=gL(t)),!t)return new w2;if(t instanceof w2)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,l=i-r,s=(i+r)/2;return l?(e===i?a=(n-o)/l+(n0&&s<1?0:a,new w2(a,l,s,t.opacity)}function KSo(t,e,n,o){return arguments.length===1?Flt(t):new w2(t,e,n,o??1)}function w2(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}W3e(w2,KSo,Elt(hU,{brighter(t){return t=t==null?KJ:Math.pow(KJ,t),new w2(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?hL:Math.pow(hL,t),new w2(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new Jp(xle(t>=240?t-240:t+120,r,o),xle(t,r,o),xle(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new w2(TDe(this.h),nV(this.s),nV(this.l),qJ(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=qJ(this.opacity);return`${t===1?"hsl(":"hsla("}${TDe(this.h)}, ${nV(this.s)*100}%, ${nV(this.l)*100}%${t===1?")":`, ${t})`}`}}));function TDe(t){return t=(t||0)%360,t<0?t+360:t}function nV(t){return Math.max(0,Math.min(1,t||0))}function xle(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const N3e=t=>()=>t;function qSo(t,e){return function(n){return t+n*e}}function $So(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function QSo(t){return(t=+t)==1?klt:function(e,n){return n-e?$So(e,n,t):N3e(isNaN(e)?n:e)}}function klt(t,e){var n=e-t;return n?qSo(t,n):N3e(isNaN(t)?e:t)}const PDe=function t(e){var n=QSo(e);function o(r,i){var a=n((r=She(r)).r,(i=She(i)).r),l=n(r.g,i.g),s=n(r.b,i.b),c=klt(r.opacity,i.opacity);return function(u){return r.r=a(u),r.g=l(u),r.b=s(u),r.opacity=c(u),r+""}}return o.gamma=t,o}(1);function ZSo(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),r;return function(i){for(r=0;rn&&(i=e.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(o=o[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,s.push({i:a,x:$J(o,r)})),n=ble.lastIndex;return ne&&(n=t,t=e,e=n),function(o){return Math.max(t,Math.min(e,o))}}function uTo(t,e,n){var o=t[0],r=t[1],i=e[0],a=e[1];return r2?dTo:uTo,s=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(s||(s=l(t.map(o),e,n)))(o(a(f)))}return d.invert=function(f){return a(r((c||(c=l(e,t.map(o),$J)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,QJ),u()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),n=U3e,u()},d.clamp=function(f){return arguments.length?(a=f?!0:cp,u()):a!==cp},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,p){return o=f,r=p,u()}}function j3e(){return ote()(cp,cp)}function fTo(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function ZJ(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}function sH(t){return t=ZJ(Math.abs(t)),t?t[1]:NaN}function hTo(t,e){return function(n,o){for(var r=n.length,i=[],a=0,l=t[0],s=0;r>0&&l>0&&(s+l+1>o&&(l=Math.max(1,o-s)),i.push(n.substring(r-=l,r+l)),!((s+=l+1)>o));)l=t[a=(a+1)%t.length];return i.reverse().join(e)}}function pTo(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var gTo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mL(t){if(!(e=gTo.exec(t)))throw new Error("invalid format: "+t);var e;return new B3e({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}mL.prototype=B3e.prototype;function B3e(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}B3e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mTo(t){e:for(var e=t.length,n=1,o=-1,r;n0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(r+1):t}var Llt;function yTo(t,e){var n=ZJ(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(Llt=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+ZJ(t,Math.max(0,e+i-1))[0]}function RDe(t,e){var n=ZJ(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}const HDe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:fTo,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>RDe(t*100,e),r:RDe,s:yTo,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function MDe(t){return t}var IDe=Array.prototype.map,zDe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ATo(t){var e=t.grouping===void 0||t.thousands===void 0?MDe:hTo(IDe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",o=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?MDe:pTo(IDe.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",s=t.nan===void 0?"NaN":t.nan+"";function c(d){d=mL(d);var f=d.fill,p=d.align,g=d.sign,A=d.symbol,y=d.zero,S=d.width,C=d.comma,P=d.precision,v=d.trim,T=d.type;T==="n"?(C=!0,T="g"):HDe[T]||(P===void 0&&(P=12),v=!0,T="g"),(y||f==="0"&&p==="=")&&(y=!0,f="0",p="=");var w=A==="$"?n:A==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",x=A==="$"?o:/[%p]/.test(T)?a:"",b=HDe[T],R=/[defgprs%]/.test(T);P=P===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function H(F){var E=w,N=x,U,W,k;if(T==="c")N=b(F)+N,F="";else{F=+F;var D=F<0||1/F<0;if(F=isNaN(F)?s:b(Math.abs(F),P),v&&(F=mTo(F)),D&&+F==0&&g!=="+"&&(D=!1),E=(D?g==="("?g:l:g==="-"||g==="("?"":g)+E,N=(T==="s"?zDe[8+Llt/3]:"")+N+(D&&g==="("?")":""),R){for(U=-1,W=F.length;++Uk||k>57){N=(k===46?r+F.slice(U+1):F.slice(U))+N,F=F.slice(0,U);break}}}C&&!y&&(F=e(F,1/0));var L=E.length+F.length+N.length,j=L>1)+E+F+N+j.slice(L);break;default:F=j+E+F+N;break}return i(F)}return H.toString=function(){return d+""},H}function u(d,f){var p=c((d=mL(d),d.type="f",d)),g=Math.max(-8,Math.min(8,Math.floor(sH(f)/3)))*3,A=Math.pow(10,-g),y=zDe[8+g/3];return function(S){return p(A*S)+y}}return{format:c,formatPrefix:u}}var oV,Y3e,Wlt;wTo({thousands:",",grouping:[3],currency:["$",""]});function wTo(t){return oV=ATo(t),Y3e=oV.format,Wlt=oV.formatPrefix,oV}function vTo(t){return Math.max(0,-sH(Math.abs(t)))}function xTo(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(sH(e)/3)))*3-sH(Math.abs(t)))}function bTo(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,sH(e)-sH(t))+1}function Nlt(t,e,n,o){var r=xhe(t,e,n),i;switch(o=mL(o??",f"),o.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return o.precision==null&&!isNaN(i=xTo(r,a))&&(o.precision=i),Wlt(o,a)}case"":case"e":case"g":case"p":case"r":{o.precision==null&&!isNaN(i=bTo(r,Math.max(Math.abs(t),Math.abs(e))))&&(o.precision=i-(o.type==="e"));break}case"f":case"%":{o.precision==null&&!isNaN(i=vTo(r))&&(o.precision=i-(o.type==="%")*2);break}}return Y3e(o)}function t7(t){var e=t.domain;return t.ticks=function(n){var o=e();return whe(o[0],o[o.length-1],n??10)},t.tickFormat=function(n,o){var r=e();return Nlt(r[0],r[r.length-1],n??10,o)},t.nice=function(n){n==null&&(n=10);var o=e(),r=0,i=o.length-1,a=o[r],l=o[i],s,c,u=10;for(l0;){if(c=vhe(a,l,n),c===s)return o[r]=a,o[i]=l,e(o);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;s=c}return t},t}function yL(){var t=j3e();return t.copy=function(){return pU(t,yL())},gy.apply(t,arguments),t7(t)}function Ult(t){var e;function n(o){return o==null||isNaN(o=+o)?e:o}return n.invert=n,n.domain=n.range=function(o){return arguments.length?(t=Array.from(o,QJ),n):t.slice()},n.unknown=function(o){return arguments.length?(e=o,n):e},n.copy=function(){return Ult(t).unknown(e)},t=arguments.length?Array.from(t,QJ):[0,1],t7(n)}function jlt(t,e){t=t.slice();var n=0,o=t.length-1,r=t[n],i=t[o],a;return iMath.pow(t,e)}function RTo(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function FDe(t){return(e,n)=>-t(-e,n)}function O3e(t){const e=t(DDe,EDe),n=e.domain;let o=10,r,i;function a(){return r=RTo(o),i=CTo(o),n()[0]<0?(r=FDe(r),i=FDe(i),t(STo,TTo)):t(DDe,EDe),e}return e.base=function(l){return arguments.length?(o=+l,a()):o},e.domain=function(l){return arguments.length?(n(l),a()):n()},e.ticks=l=>{const s=n();let c=s[0],u=s[s.length-1];const d=u0){for(;f<=p;++f)for(g=1;gu)break;S.push(A)}}else for(;f<=p;++f)for(g=o-1;g>=1;--g)if(A=f>0?g/i(-f):g*i(f),!(Au)break;S.push(A)}S.length*2{if(l==null&&(l=10),s==null&&(s=o===10?"s":","),typeof s!="function"&&(!(o%1)&&(s=mL(s)).precision==null&&(s.trim=!0),s=Y3e(s)),l===1/0)return s;const c=Math.max(1,o*l/e.ticks().length);return u=>{let d=u/i(Math.round(r(u)));return d*on(jlt(n(),{floor:l=>i(Math.floor(r(l))),ceil:l=>i(Math.ceil(r(l)))})),e}function Blt(){const t=O3e(ote()).domain([1,10]);return t.copy=()=>pU(t,Blt()).base(t.base()),gy.apply(t,arguments),t}function kDe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function LDe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function V3e(t){var e=1,n=t(kDe(e),LDe(e));return n.constant=function(o){return arguments.length?t(kDe(e=+o),LDe(e)):e},t7(n)}function Ylt(){var t=V3e(ote());return t.copy=function(){return pU(t,Ylt()).constant(t.constant())},gy.apply(t,arguments)}function WDe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function HTo(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function MTo(t){return t<0?-t*t:t*t}function _3e(t){var e=t(cp,cp),n=1;function o(){return n===1?t(cp,cp):n===.5?t(HTo,MTo):t(WDe(n),WDe(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,o()):n},t7(e)}function G3e(){var t=_3e(ote());return t.copy=function(){return pU(t,G3e()).exponent(t.exponent())},gy.apply(t,arguments),t}function ITo(){return G3e.apply(null,arguments).exponent(.5)}function NDe(t){return Math.sign(t)*t*t}function zTo(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Olt(){var t=j3e(),e=[0,1],n=!1,o;function r(i){var a=zTo(t(i));return isNaN(a)?o:n?Math.round(a):a}return r.invert=function(i){return t.invert(NDe(i))},r.domain=function(i){return arguments.length?(t.domain(i),r):t.domain()},r.range=function(i){return arguments.length?(t.range((e=Array.from(i,QJ)).map(NDe)),r):e.slice()},r.rangeRound=function(i){return r.range(i).round(!0)},r.round=function(i){return arguments.length?(n=!!i,r):n},r.clamp=function(i){return arguments.length?(t.clamp(i),r):t.clamp()},r.unknown=function(i){return arguments.length?(o=i,r):o},r.copy=function(){return Olt(t.domain(),e).round(n).clamp(t.clamp()).unknown(o)},gy.apply(r,arguments),t7(r)}function Vlt(){var t=[],e=[],n=[],o;function r(){var a=0,l=Math.max(1,e.length);for(n=new Array(l-1);++a0?n[l-1]:t[0],l=n?[o[n-1],e]:[o[c-1],o[c]]},a.unknown=function(s){return arguments.length&&(i=s),a},a.thresholds=function(){return o.slice()},a.copy=function(){return _lt().domain([t,e]).range(r).unknown(i)},gy.apply(t7(a),arguments)}function Glt(){var t=[.5],e=[0,1],n,o=1;function r(i){return i!=null&&i<=i?e[fU(t,i,0,o)]:n}return r.domain=function(i){return arguments.length?(t=Array.from(i),o=Math.min(t.length,e.length-1),r):t.slice()},r.range=function(i){return arguments.length?(e=Array.from(i),o=Math.min(t.length,e.length-1),r):e.slice()},r.invertExtent=function(i){var a=e.indexOf(i);return[t[a-1],t[a]]},r.unknown=function(i){return arguments.length?(n=i,r):n},r.copy=function(){return Glt().domain(t).range(e).unknown(n)},gy.apply(r,arguments)}const Sle=new Date,Tle=new Date;function qu(t,e,n,o){function r(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return r.floor=i=>(t(i=new Date(+i)),i),r.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),r.round=i=>{const a=r(i),l=r.ceil(i);return i-a(e(i=new Date(+i),a==null?1:Math.floor(a)),i),r.range=(i,a,l)=>{const s=[];if(i=r.ceil(i),l=l==null?1:Math.floor(l),!(i0))return s;let c;do s.push(c=new Date(+i)),e(i,l),t(i);while(cqu(a=>{if(a>=a)for(;t(a),!i(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!i(a););else for(;--l>=0;)for(;e(a,1),!i(a););}),n&&(r.count=(i,a)=>(Sle.setTime(+i),Tle.setTime(+a),t(Sle),t(Tle),Math.floor(n(Sle,Tle))),r.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?r.filter(o?a=>o(a)%i===0:a=>r.count(0,a)%i===0):r)),r}const eK=qu(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);eK.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?qu(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):eK);eK.range;const M6=1e3,_m=M6*60,I6=_m*60,uA=I6*24,X3e=uA*7,UDe=uA*30,Ple=uA*365,rx=qu(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*M6)},(t,e)=>(e-t)/M6,t=>t.getUTCSeconds());rx.range;const J3e=qu(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*M6)},(t,e)=>{t.setTime(+t+e*_m)},(t,e)=>(e-t)/_m,t=>t.getMinutes());J3e.range;const K3e=qu(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*_m)},(t,e)=>(e-t)/_m,t=>t.getUTCMinutes());K3e.range;const q3e=qu(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*M6-t.getMinutes()*_m)},(t,e)=>{t.setTime(+t+e*I6)},(t,e)=>(e-t)/I6,t=>t.getHours());q3e.range;const $3e=qu(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*I6)},(t,e)=>(e-t)/I6,t=>t.getUTCHours());$3e.range;const gU=qu(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*_m)/uA,t=>t.getDate()-1);gU.range;const rte=qu(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uA,t=>t.getUTCDate()-1);rte.range;const Xlt=qu(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uA,t=>Math.floor(t/uA));Xlt.range;function mS(t){return qu(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*_m)/X3e)}const ite=mS(0),tK=mS(1),DTo=mS(2),ETo=mS(3),cH=mS(4),FTo=mS(5),kTo=mS(6);ite.range;tK.range;DTo.range;ETo.range;cH.range;FTo.range;kTo.range;function yS(t){return qu(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/X3e)}const ate=yS(0),nK=yS(1),LTo=yS(2),WTo=yS(3),uH=yS(4),NTo=yS(5),UTo=yS(6);ate.range;nK.range;LTo.range;WTo.range;uH.range;NTo.range;UTo.range;const Q3e=qu(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Q3e.range;const Z3e=qu(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Z3e.range;const dA=qu(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());dA.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:qu(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});dA.range;const fA=qu(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());fA.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:qu(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});fA.range;function Jlt(t,e,n,o,r,i){const a=[[rx,1,M6],[rx,5,5*M6],[rx,15,15*M6],[rx,30,30*M6],[i,1,_m],[i,5,5*_m],[i,15,15*_m],[i,30,30*_m],[r,1,I6],[r,3,3*I6],[r,6,6*I6],[r,12,12*I6],[o,1,uA],[o,2,2*uA],[n,1,X3e],[e,1,UDe],[e,3,3*UDe],[t,1,Ple]];function l(c,u,d){const f=uy).right(a,f);if(p===a.length)return t.every(xhe(c/Ple,u/Ple,d));if(p===0)return eK.every(Math.max(xhe(c,u,d),1));const[g,A]=a[f/a[p-1][2]53)return null;"w"in oe||(oe.w=1),"Z"in oe?(he=Rle(pD(oe.y,0,1)),pe=he.getUTCDay(),he=pe>4||pe===0?nK.ceil(he):nK(he),he=rte.offset(he,(oe.V-1)*7),oe.y=he.getUTCFullYear(),oe.m=he.getUTCMonth(),oe.d=he.getUTCDate()+(oe.w+6)%7):(he=Cle(pD(oe.y,0,1)),pe=he.getDay(),he=pe>4||pe===0?tK.ceil(he):tK(he),he=gU.offset(he,(oe.V-1)*7),oe.y=he.getFullYear(),oe.m=he.getMonth(),oe.d=he.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),pe="Z"in oe?Rle(pD(oe.y,0,1)).getUTCDay():Cle(pD(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(pe+5)%7:oe.w+oe.U*7-(pe+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,Rle(oe)):Cle(oe)}}function b(Z,ee,te,oe){for(var de=0,he=ee.length,pe=te.length,me,le;de=pe)return-1;if(me=ee.charCodeAt(de++),me===37){if(me=ee.charAt(de++),le=T[me in jDe?ee.charAt(de++):me],!le||(oe=le(Z,te,oe))<0)return-1}else if(me!=te.charCodeAt(oe++))return-1}return oe}function R(Z,ee,te){var oe=c.exec(ee.slice(te));return oe?(Z.p=u.get(oe[0].toLowerCase()),te+oe[0].length):-1}function H(Z,ee,te){var oe=p.exec(ee.slice(te));return oe?(Z.w=g.get(oe[0].toLowerCase()),te+oe[0].length):-1}function F(Z,ee,te){var oe=d.exec(ee.slice(te));return oe?(Z.w=f.get(oe[0].toLowerCase()),te+oe[0].length):-1}function E(Z,ee,te){var oe=S.exec(ee.slice(te));return oe?(Z.m=C.get(oe[0].toLowerCase()),te+oe[0].length):-1}function N(Z,ee,te){var oe=A.exec(ee.slice(te));return oe?(Z.m=y.get(oe[0].toLowerCase()),te+oe[0].length):-1}function U(Z,ee,te){return b(Z,e,ee,te)}function W(Z,ee,te){return b(Z,n,ee,te)}function k(Z,ee,te){return b(Z,o,ee,te)}function D(Z){return a[Z.getDay()]}function L(Z){return i[Z.getDay()]}function j(Z){return s[Z.getMonth()]}function B(Z){return l[Z.getMonth()]}function O(Z){return r[+(Z.getHours()>=12)]}function V(Z){return 1+~~(Z.getMonth()/3)}function G(Z){return a[Z.getUTCDay()]}function q(Z){return i[Z.getUTCDay()]}function $(Z){return s[Z.getUTCMonth()]}function ie(Z){return l[Z.getUTCMonth()]}function Q(Z){return r[+(Z.getUTCHours()>=12)]}function se(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var ee=w(Z+="",P);return ee.toString=function(){return Z},ee},parse:function(Z){var ee=x(Z+="",!1);return ee.toString=function(){return Z},ee},utcFormat:function(Z){var ee=w(Z+="",v);return ee.toString=function(){return Z},ee},utcParse:function(Z){var ee=x(Z+="",!0);return ee.toString=function(){return Z},ee}}}var jDe={"-":"",_:" ",0:"0"},Nd=/^\s*\d+/,_To=/^%/,GTo=/[\\^$*+?|[\]().{}]/g;function Yl(t,e,n){var o=t<0?"-":"",r=(o?-t:t)+"",i=r.length;return o+(i[e.toLowerCase(),n]))}function JTo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.w=+o[0],n+o[0].length):-1}function KTo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.u=+o[0],n+o[0].length):-1}function qTo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.U=+o[0],n+o[0].length):-1}function $To(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.V=+o[0],n+o[0].length):-1}function QTo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.W=+o[0],n+o[0].length):-1}function BDe(t,e,n){var o=Nd.exec(e.slice(n,n+4));return o?(t.y=+o[0],n+o[0].length):-1}function YDe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.y=+o[0]+(+o[0]>68?1900:2e3),n+o[0].length):-1}function ZTo(t,e,n){var o=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return o?(t.Z=o[1]?0:-(o[2]+(o[3]||"00")),n+o[0].length):-1}function ePo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.q=o[0]*3-3,n+o[0].length):-1}function tPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.m=o[0]-1,n+o[0].length):-1}function ODe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.d=+o[0],n+o[0].length):-1}function nPo(t,e,n){var o=Nd.exec(e.slice(n,n+3));return o?(t.m=0,t.d=+o[0],n+o[0].length):-1}function VDe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.H=+o[0],n+o[0].length):-1}function oPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.M=+o[0],n+o[0].length):-1}function rPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.S=+o[0],n+o[0].length):-1}function iPo(t,e,n){var o=Nd.exec(e.slice(n,n+3));return o?(t.L=+o[0],n+o[0].length):-1}function aPo(t,e,n){var o=Nd.exec(e.slice(n,n+6));return o?(t.L=Math.floor(o[0]/1e3),n+o[0].length):-1}function lPo(t,e,n){var o=_To.exec(e.slice(n,n+1));return o?n+o[0].length:-1}function sPo(t,e,n){var o=Nd.exec(e.slice(n));return o?(t.Q=+o[0],n+o[0].length):-1}function cPo(t,e,n){var o=Nd.exec(e.slice(n));return o?(t.s=+o[0],n+o[0].length):-1}function _De(t,e){return Yl(t.getDate(),e,2)}function uPo(t,e){return Yl(t.getHours(),e,2)}function dPo(t,e){return Yl(t.getHours()%12||12,e,2)}function fPo(t,e){return Yl(1+gU.count(dA(t),t),e,3)}function Klt(t,e){return Yl(t.getMilliseconds(),e,3)}function hPo(t,e){return Klt(t,e)+"000"}function pPo(t,e){return Yl(t.getMonth()+1,e,2)}function gPo(t,e){return Yl(t.getMinutes(),e,2)}function mPo(t,e){return Yl(t.getSeconds(),e,2)}function yPo(t){var e=t.getDay();return e===0?7:e}function APo(t,e){return Yl(ite.count(dA(t)-1,t),e,2)}function qlt(t){var e=t.getDay();return e>=4||e===0?cH(t):cH.ceil(t)}function wPo(t,e){return t=qlt(t),Yl(cH.count(dA(t),t)+(dA(t).getDay()===4),e,2)}function vPo(t){return t.getDay()}function xPo(t,e){return Yl(tK.count(dA(t)-1,t),e,2)}function bPo(t,e){return Yl(t.getFullYear()%100,e,2)}function SPo(t,e){return t=qlt(t),Yl(t.getFullYear()%100,e,2)}function TPo(t,e){return Yl(t.getFullYear()%1e4,e,4)}function PPo(t,e){var n=t.getDay();return t=n>=4||n===0?cH(t):cH.ceil(t),Yl(t.getFullYear()%1e4,e,4)}function CPo(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Yl(e/60|0,"0",2)+Yl(e%60,"0",2)}function GDe(t,e){return Yl(t.getUTCDate(),e,2)}function RPo(t,e){return Yl(t.getUTCHours(),e,2)}function HPo(t,e){return Yl(t.getUTCHours()%12||12,e,2)}function MPo(t,e){return Yl(1+rte.count(fA(t),t),e,3)}function $lt(t,e){return Yl(t.getUTCMilliseconds(),e,3)}function IPo(t,e){return $lt(t,e)+"000"}function zPo(t,e){return Yl(t.getUTCMonth()+1,e,2)}function DPo(t,e){return Yl(t.getUTCMinutes(),e,2)}function EPo(t,e){return Yl(t.getUTCSeconds(),e,2)}function FPo(t){var e=t.getUTCDay();return e===0?7:e}function kPo(t,e){return Yl(ate.count(fA(t)-1,t),e,2)}function Qlt(t){var e=t.getUTCDay();return e>=4||e===0?uH(t):uH.ceil(t)}function LPo(t,e){return t=Qlt(t),Yl(uH.count(fA(t),t)+(fA(t).getUTCDay()===4),e,2)}function WPo(t){return t.getUTCDay()}function NPo(t,e){return Yl(nK.count(fA(t)-1,t),e,2)}function UPo(t,e){return Yl(t.getUTCFullYear()%100,e,2)}function jPo(t,e){return t=Qlt(t),Yl(t.getUTCFullYear()%100,e,2)}function BPo(t,e){return Yl(t.getUTCFullYear()%1e4,e,4)}function YPo(t,e){var n=t.getUTCDay();return t=n>=4||n===0?uH(t):uH.ceil(t),Yl(t.getUTCFullYear()%1e4,e,4)}function OPo(){return"+0000"}function XDe(){return"%"}function JDe(t){return+t}function KDe(t){return Math.floor(+t/1e3)}var oP,Zlt,est;VPo({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function VPo(t){return oP=VTo(t),Zlt=oP.format,oP.parse,est=oP.utcFormat,oP.utcParse,oP}function _Po(t){return new Date(t)}function GPo(t){return t instanceof Date?+t:+new Date(+t)}function e6e(t,e,n,o,r,i,a,l,s,c){var u=j3e(),d=u.invert,f=u.domain,p=c(".%L"),g=c(":%S"),A=c("%I:%M"),y=c("%I %p"),S=c("%a %d"),C=c("%b %d"),P=c("%B"),v=c("%Y");function T(w){return(s(w)e(r/(t.length-1)))},n.quantiles=function(o){return Array.from({length:o+1},(r,i)=>kSo(t,i/o))},n.copy=function(){return rst(e).domain(t)},HA.apply(n,arguments)}function ste(){var t=0,e=.5,n=1,o=1,r,i,a,l,s,c=cp,u,d=!1,f;function p(A){return isNaN(A=+A)?f:(A=.5+((A=+u(A))-i)*(o*Ae}var eCo=ZPo,tCo=sst,nCo=eCo,oCo=oS;function rCo(t){return t&&t.length?tCo(t,oCo,nCo):void 0}var iCo=rCo;const H8=Wi(iCo);function aCo(t,e){return tt.e^i.s<0?1:-1;for(o=i.d.length,r=t.d.length,e=0,n=ot.d[e]^i.s<0?1:-1;return o===r?0:o>r^i.s<0?1:-1};Br.decimalPlaces=Br.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*mc;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Br.dividedBy=Br.div=function(t){return V6(this,new this.constructor(t))};Br.dividedToIntegerBy=Br.idiv=function(t){var e=this,n=e.constructor;return Ds(V6(e,new n(t),0,1),n.precision)};Br.equals=Br.eq=function(t){return!this.cmp(t)};Br.exponent=function(){return cu(this)};Br.greaterThan=Br.gt=function(t){return this.cmp(t)>0};Br.greaterThanOrEqualTo=Br.gte=function(t){return this.cmp(t)>=0};Br.isInteger=Br.isint=function(){return this.e>this.d.length-2};Br.isNegative=Br.isneg=function(){return this.s<0};Br.isPositive=Br.ispos=function(){return this.s>0};Br.isZero=function(){return this.s===0};Br.lessThan=Br.lt=function(t){return this.cmp(t)<0};Br.lessThanOrEqualTo=Br.lte=function(t){return this.cmp(t)<1};Br.logarithm=Br.log=function(t){var e,n=this,o=n.constructor,r=o.precision,i=r+5;if(t===void 0)t=new o(10);else if(t=new o(t),t.s<1||t.eq(fg))throw Error(iy+"NaN");if(n.s<1)throw Error(iy+(n.s?"NaN":"-Infinity"));return n.eq(fg)?new o(0):(Oc=!1,e=V6(AL(n,i),AL(t,i),i),Oc=!0,Ds(e,r))};Br.minus=Br.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?fst(e,t):ust(e,(t.s=-t.s,t))};Br.modulo=Br.mod=function(t){var e,n=this,o=n.constructor,r=o.precision;if(t=new o(t),!t.s)throw Error(iy+"NaN");return n.s?(Oc=!1,e=V6(n,t,0,1).times(t),Oc=!0,n.minus(e)):Ds(new o(n),r)};Br.naturalExponential=Br.exp=function(){return dst(this)};Br.naturalLogarithm=Br.ln=function(){return AL(this)};Br.negated=Br.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Br.plus=Br.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?ust(e,t):fst(e,(t.s=-t.s,t))};Br.precision=Br.sd=function(t){var e,n,o,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(kx+t);if(e=cu(r)+1,o=r.d.length-1,n=o*mc+1,o=r.d[o],o){for(;o%10==0;o/=10)n--;for(o=r.d[0];o>=10;o/=10)n++}return t&&e>n?e:n};Br.squareRoot=Br.sqrt=function(){var t,e,n,o,r,i,a,l=this,s=l.constructor;if(l.s<1){if(!l.s)return new s(0);throw Error(iy+"NaN")}for(t=cu(l),Oc=!1,r=Math.sqrt(+l),r==0||r==1/0?(e=w9(l.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=LM((t+1)/2)-(t<0||t%2),r==1/0?e="5e"+t:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),o=new s(e)):o=new s(r.toString()),n=s.precision,r=a=n+3;;)if(i=o,o=i.plus(V6(l,i,a+2)).times(.5),w9(i.d).slice(0,a)===(e=w9(o.d)).slice(0,a)){if(e=e.slice(a-3,a+1),r==a&&e=="4999"){if(Ds(i,n+1,0),i.times(i).eq(l)){o=i;break}}else if(e!="9999")break;a+=4}return Oc=!0,Ds(o,n)};Br.times=Br.mul=function(t){var e,n,o,r,i,a,l,s,c,u=this,d=u.constructor,f=u.d,p=(t=new d(t)).d;if(!u.s||!t.s)return new d(0);for(t.s*=u.s,n=u.e+t.e,s=f.length,c=p.length,s=0;){for(e=0,r=s+o;r>o;)l=i[r]+p[o]*f[r-o-1]+e,i[r--]=l%vd|0,e=l/vd|0;i[r]=(i[r]+e)%vd|0}for(;!i[--a];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,Oc?Ds(t,d.precision):t};Br.toDecimalPlaces=Br.todp=function(t,e){var n=this,o=n.constructor;return n=new o(n),t===void 0?n:($9(t,0,kM),e===void 0?e=o.rounding:$9(e,0,8),Ds(n,t+cu(n)+1,e))};Br.toExponential=function(t,e){var n,o=this,r=o.constructor;return t===void 0?n=Ab(o,!0):($9(t,0,kM),e===void 0?e=r.rounding:$9(e,0,8),o=Ds(new r(o),t+1,e),n=Ab(o,!0,t+1)),n};Br.toFixed=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?Ab(r):($9(t,0,kM),e===void 0?e=i.rounding:$9(e,0,8),o=Ds(new i(r),t+cu(r)+1,e),n=Ab(o.abs(),!1,t+cu(o)+1),r.isneg()&&!r.isZero()?"-"+n:n)};Br.toInteger=Br.toint=function(){var t=this,e=t.constructor;return Ds(new e(t),cu(t)+1,e.rounding)};Br.toNumber=function(){return+this};Br.toPower=Br.pow=function(t){var e,n,o,r,i,a,l=this,s=l.constructor,c=12,u=+(t=new s(t));if(!t.s)return new s(fg);if(l=new s(l),!l.s){if(t.s<1)throw Error(iy+"Infinity");return l}if(l.eq(fg))return l;if(o=s.precision,t.eq(fg))return Ds(l,o);if(e=t.e,n=t.d.length-1,a=e>=n,i=l.s,a){if((n=u<0?-u:u)<=cst){for(r=new s(fg),e=Math.ceil(o/mc+4),Oc=!1;n%2&&(r=r.times(l),QDe(r.d,e)),n=LM(n/2),n!==0;)l=l.times(l),QDe(l.d,e);return Oc=!0,t.s<0?new s(fg).div(r):Ds(r,o)}}else if(i<0)throw Error(iy+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Oc=!1,r=t.times(AL(l,o+c)),Oc=!0,r=dst(r),r.s=i,r};Br.toPrecision=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?(n=cu(r),o=Ab(r,n<=i.toExpNeg||n>=i.toExpPos)):($9(t,1,kM),e===void 0?e=i.rounding:$9(e,0,8),r=Ds(new i(r),t,e),n=cu(r),o=Ab(r,t<=n||n<=i.toExpNeg,t)),o};Br.toSignificantDigits=Br.tosd=function(t,e){var n=this,o=n.constructor;return t===void 0?(t=o.precision,e=o.rounding):($9(t,1,kM),e===void 0?e=o.rounding:$9(e,0,8)),Ds(new o(n),t,e)};Br.toString=Br.valueOf=Br.val=Br.toJSON=Br[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=cu(t),n=t.constructor;return Ab(t,e<=n.toExpNeg||e>=n.toExpPos)};function ust(t,e){var n,o,r,i,a,l,s,c,u=t.constructor,d=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),Oc?Ds(e,d):e;if(s=t.d,c=e.d,a=t.e,r=e.e,s=s.slice(),i=a-r,i){for(i<0?(o=s,i=-i,l=c.length):(o=c,r=a,l=s.length),a=Math.ceil(d/mc),l=a>l?a+1:l+1,i>l&&(i=l,o.length=1),o.reverse();i--;)o.push(0);o.reverse()}for(l=s.length,i=c.length,l-i<0&&(i=l,o=c,c=s,s=o),n=0;i;)n=(s[--i]=s[i]+c[i]+n)/vd|0,s[i]%=vd;for(n&&(s.unshift(n),++r),l=s.length;s[--l]==0;)s.pop();return e.d=s,e.e=r,Oc?Ds(e,d):e}function $9(t,e,n){if(t!==~~t||tn)throw Error(kx+t)}function w9(t){var e,n,o,r=t.length-1,i="",a=t[0];if(r>0){for(i+=a,e=1;ea?1:-1;else for(l=s=0;lr[l]?1:-1;break}return s}function n(o,r,i){for(var a=0;i--;)o[i]-=a,a=o[i]1;)o.shift()}return function(o,r,i,a){var l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x,b,R=o.constructor,H=o.s==r.s?1:-1,F=o.d,E=r.d;if(!o.s)return new R(o);if(!r.s)throw Error(iy+"Division by zero");for(s=o.e-r.e,x=E.length,T=F.length,p=new R(H),g=p.d=[],c=0;E[c]==(F[c]||0);)++c;if(E[c]>(F[c]||0)&&--s,i==null?C=i=R.precision:a?C=i+(cu(o)-cu(r))+1:C=i,C<0)return new R(0);if(C=C/mc+2|0,c=0,x==1)for(u=0,E=E[0],C++;(c1&&(E=t(E,u),F=t(F,u),x=E.length,T=F.length),v=x,A=F.slice(0,x),y=A.length;y=vd/2&&++w;do u=0,l=e(E,A,x,y),l<0?(S=A[0],x!=y&&(S=S*vd+(A[1]||0)),u=S/w|0,u>1?(u>=vd&&(u=vd-1),d=t(E,u),f=d.length,y=A.length,l=e(d,A,f,y),l==1&&(u--,n(d,x16)throw Error(o6e+cu(t));if(!t.s)return new u(fg);for(e==null?(Oc=!1,l=d):l=e,a=new u(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(o=Math.log(xv(2,c))/Math.LN10*2+5|0,l+=o,n=r=i=new u(fg),u.precision=l;;){if(r=Ds(r.times(t),l),n=n.times(++s),a=i.plus(V6(r,n,l)),w9(a.d).slice(0,l)===w9(i.d).slice(0,l)){for(;c--;)i=Ds(i.times(i),l);return u.precision=d,e==null?(Oc=!0,Ds(i,d)):i}i=a}}function cu(t){for(var e=t.e*mc,n=t.d[0];n>=10;n/=10)e++;return e}function Hle(t,e,n){if(e>t.LN10.sd())throw Oc=!0,n&&(t.precision=n),Error(iy+"LN10 precision limit exceeded");return Ds(new t(t.LN10),e)}function t8(t){for(var e="";t--;)e+="0";return e}function AL(t,e){var n,o,r,i,a,l,s,c,u,d=1,f=10,p=t,g=p.d,A=p.constructor,y=A.precision;if(p.s<1)throw Error(iy+(p.s?"NaN":"-Infinity"));if(p.eq(fg))return new A(0);if(e==null?(Oc=!1,c=y):c=e,p.eq(10))return e==null&&(Oc=!0),Hle(A,c);if(c+=f,A.precision=c,n=w9(g),o=n.charAt(0),i=cu(p),Math.abs(i)<15e14){for(;o<7&&o!=1||o==1&&n.charAt(1)>3;)p=p.times(t),n=w9(p.d),o=n.charAt(0),d++;i=cu(p),o>1?(p=new A("0."+n),i++):p=new A(o+"."+n.slice(1))}else return s=Hle(A,c+2,y).times(i+""),p=AL(new A(o+"."+n.slice(1)),c-f).plus(s),A.precision=y,e==null?(Oc=!0,Ds(p,y)):p;for(l=a=p=V6(p.minus(fg),p.plus(fg),c),u=Ds(p.times(p),c),r=3;;){if(a=Ds(a.times(u),c),s=l.plus(V6(a,new A(r),c)),w9(s.d).slice(0,c)===w9(l.d).slice(0,c))return l=l.times(2),i!==0&&(l=l.plus(Hle(A,c+2,y).times(i+""))),l=V6(l,new A(d),c),A.precision=y,e==null?(Oc=!0,Ds(l,y)):l;l=s,r+=2}}function $De(t,e){var n,o,r;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(o=e.search(/e/i))>0?(n<0&&(n=o),n+=+e.slice(o+1),e=e.substring(0,o)):n<0&&(n=e.length),o=0;e.charCodeAt(o)===48;)++o;for(r=e.length;e.charCodeAt(r-1)===48;)--r;if(e=e.slice(o,r),e){if(r-=o,n=n-o-1,t.e=LM(n/mc),t.d=[],o=(n+1)%mc,n<0&&(o+=mc),ooK||t.e<-oK))throw Error(o6e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Ds(t,e,n){var o,r,i,a,l,s,c,u,d=t.d;for(a=1,i=d[0];i>=10;i/=10)a++;if(o=e-a,o<0)o+=mc,r=e,c=d[u=0];else{if(u=Math.ceil((o+1)/mc),i=d.length,u>=i)return t;for(c=i=d[u],a=1;i>=10;i/=10)a++;o%=mc,r=o-mc+a}if(n!==void 0&&(i=xv(10,a-r-1),l=c/i%10|0,s=e<0||d[u+1]!==void 0||c%i,s=n<4?(l||s)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||s||n==6&&(o>0?r>0?c/xv(10,a-r):0:d[u-1])%10&1||n==(t.s<0?8:7))),e<1||!d[0])return s?(i=cu(t),d.length=1,e=e-i-1,d[0]=xv(10,(mc-e%mc)%mc),t.e=LM(-e/mc)||0):(d.length=1,d[0]=t.e=t.s=0),t;if(o==0?(d.length=u,i=1,u--):(d.length=u+1,i=xv(10,mc-o),d[u]=r>0?(c/xv(10,a-r)%xv(10,r)|0)*i:0),s)for(;;)if(u==0){(d[0]+=i)==vd&&(d[0]=1,++t.e);break}else{if(d[u]+=i,d[u]!=vd)break;d[u--]=0,i=1}for(o=d.length;d[--o]===0;)d.pop();if(Oc&&(t.e>oK||t.e<-oK))throw Error(o6e+cu(t));return t}function fst(t,e){var n,o,r,i,a,l,s,c,u,d,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),Oc?Ds(e,p):e;if(s=t.d,d=e.d,o=e.e,c=t.e,s=s.slice(),a=c-o,a){for(u=a<0,u?(n=s,a=-a,l=d.length):(n=d,o=c,l=s.length),r=Math.max(Math.ceil(p/mc),l)+2,a>r&&(a=r,n.length=1),n.reverse(),r=a;r--;)n.push(0);n.reverse()}else{for(r=s.length,l=d.length,u=r0;--r)s[l++]=0;for(r=d.length;r>a;){if(s[--r]0?i=i.charAt(0)+"."+i.slice(1)+t8(o):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r<0?"e":"e+")+r):r<0?(i="0."+t8(-r-1)+i,n&&(o=n-a)>0&&(i+=t8(o))):r>=a?(i+=t8(r+1-a),n&&(o=n-r-1)>0&&(i=i+"."+t8(o))):((o=r+1)0&&(r+1===a&&(i+="."),i+=t8(o))),t.s<0?"-"+i:i}function QDe(t,e){if(t.length>e)return t.length=e,!0}function hst(t){var e,n,o;function r(i){var a=this;if(!(a instanceof r))return new r(i);if(a.constructor=r,i instanceof r){a.s=i.s,a.e=i.e,a.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(kx+i);if(i>0)a.s=1;else if(i<0)i=-i,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(i===~~i&&i<1e7){a.e=0,a.d=[i];return}return $De(a,i.toString())}else if(typeof i!="string")throw Error(kx+i);if(i.charCodeAt(0)===45?(i=i.slice(1),a.s=-1):a.s=1,bCo.test(i))$De(a,i);else throw Error(kx+i)}if(r.prototype=Br,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=hst,r.config=r.set=SCo,t===void 0&&(t={}),t)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=r[e+1]&&o<=r[e+2])this[n]=o;else throw Error(kx+n+": "+o);if((o=t[n="LN10"])!==void 0)if(o==Math.LN10)this[n]=new this(o);else throw Error(kx+n+": "+o);return this}var r6e=hst(xCo);fg=new r6e(1);const xs=r6e;function TCo(t){return HCo(t)||RCo(t)||CCo(t)||PCo()}function PCo(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wSo(t,e){if(t){if(typeof t=="string")return uDe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uDe(t,e)}}function uDe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return W.reduce(function(k,D){var L=D.word,j=D.width,B=k[k.length-1];if(B&&(r==null||i||B.width+j+oD.width?k:D})};if(!u)return p;for(var A="…",y=function(W){var k=d.slice(0,W),D=Hlt({breakAll:c,style:s,children:k+A}).wordsWithComputedWidth,L=f(D),j=L.length>a||g(L).width>Number(r);return[j,L]},S=0,C=d.length-1,P=0,v;S<=C&&P<=d.length-1;){var T=Math.floor((S+C)/2),w=T-1,x=y(w),b=cDe(x,2),R=b[0],H=b[1],F=y(T),E=cDe(F,1),N=E[0];if(!R&&!N&&(S=T+1),R&&N&&(C=T-1),!R&&N){v=H;break}P++}return v||p},dDe=function(e){var n=aa(e)?[]:e.toString().split(Rlt);return[{words:n}]},SSo=function(e){var n=e.width,o=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,l=e.maxLines;if((n||o)&&!j2.isSsr){var s,c,u=Hlt({breakAll:a,children:r,style:i});if(u){var d=u.wordsWithComputedWidth,f=u.spaceWidth;s=d,c=f}else return dDe(r);return bSo({breakAll:a,children:r,maxLines:l,style:i},s,c,n,o)}return dDe(r)},fDe="#808080",XJ=function(e){var n=e.x,o=n===void 0?0:n,r=e.y,i=r===void 0?0:r,a=e.lineHeight,l=a===void 0?"1em":a,s=e.capHeight,c=s===void 0?"0.71em":s,u=e.scaleToFit,d=u===void 0?!1:u,f=e.textAnchor,p=f===void 0?"start":f,g=e.verticalAnchor,A=g===void 0?"end":g,y=e.fill,S=y===void 0?fDe:y,C=sDe(e,gSo),P=m.useMemo(function(){return SSo({breakAll:C.breakAll,children:C.children,maxLines:C.maxLines,scaleToFit:d,style:C.style,width:C.width})},[C.breakAll,C.children,C.maxLines,d,C.style,C.width]),v=C.dx,T=C.dy,w=C.angle,x=C.className,b=C.breakAll,R=sDe(C,mSo);if(!Nu(o)||!Nu(i))return null;var H=o+(dr(v)?v:0),F=i+(dr(T)?T:0),E;switch(A){case"start":E=vle("calc(".concat(c,")"));break;case"middle":E=vle("calc(".concat((P.length-1)/2," * -").concat(l," + (").concat(c," / 2))"));break;default:E=vle("calc(".concat(P.length-1," * -").concat(l,")"));break}var N=[];if(d){var U=P[0].width,W=C.width;N.push("scale(".concat((dr(W)?W/U:1)/U,")"))}return w&&N.push("rotate(".concat(w,", ").concat(H,", ").concat(F,")")),N.length&&(R.transform=N.join(" ")),be.createElement("text",Ahe({},ia(R,!0),{x:H,y:F,className:fl("recharts-text",x),textAnchor:p,fill:S.includes("url")?fDe:S}),P.map(function(k,D){var L=k.words.join(b?"":" ");return be.createElement("tspan",{x:H,dy:D===0?E:l,key:L},L)}))};function $8(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function TSo(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function L3e(t){let e,n,o;t.length!==2?(e=$8,n=(l,s)=>$8(t(l),s),o=(l,s)=>t(l)-s):(e=t===$8||t===TSo?t:PSo,n=t,o=t);function r(l,s,c=0,u=l.length){if(c>>1;n(l[d],s)<0?c=d+1:u=d}while(c>>1;n(l[d],s)<=0?c=d+1:u=d}while(cc&&o(l[d-1],s)>-o(l[d],s)?d-1:d}return{left:r,center:a,right:i}}function PSo(){return 0}function Mlt(t){return t===null?NaN:+t}function*CSo(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const RSo=L3e($8),fU=RSo.right;L3e(Mlt).center;class hDe extends Map{constructor(e,n=ISo){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[o,r]of e)this.set(o,r)}get(e){return super.get(pDe(this,e))}has(e){return super.has(pDe(this,e))}set(e,n){return super.set(HSo(this,e),n)}delete(e){return super.delete(MSo(this,e))}}function pDe({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):n}function HSo({_intern:t,_key:e},n){const o=e(n);return t.has(o)?t.get(o):(t.set(o,n),n)}function MSo({_intern:t,_key:e},n){const o=e(n);return t.has(o)&&(n=t.get(o),t.delete(o)),n}function ISo(t){return t!==null&&typeof t=="object"?t.valueOf():t}function zSo(t=$8){if(t===$8)return Ilt;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const o=t(e,n);return o||o===0?o:(t(n,n)===0)-(t(e,e)===0)}}function Ilt(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const DSo=Math.sqrt(50),ESo=Math.sqrt(10),FSo=Math.sqrt(2);function JJ(t,e,n){const o=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(o)),i=o/Math.pow(10,r),a=i>=DSo?10:i>=ESo?5:i>=FSo?2:1;let l,s,c;return r<0?(c=Math.pow(10,-r)/a,l=Math.round(t*c),s=Math.round(e*c),l/ce&&--s,c=-c):(c=Math.pow(10,r)*a,l=Math.round(t/c),s=Math.round(e/c),l*ce&&--s),s0))return[];if(t===e)return[t];const o=e=r))return[];const l=i-r+1,s=new Array(l);if(o)if(a<0)for(let c=0;c=o)&&(n=o);return n}function mDe(t,e){let n;for(const o of t)o!=null&&(n>o||n===void 0&&o>=o)&&(n=o);return n}function zlt(t,e,n=0,o=1/0,r){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(t.length-1,o)),!(n<=e&&e<=o))return t;for(r=r===void 0?Ilt:zSo(r);o>n;){if(o-n>600){const s=o-n+1,c=e-n+1,u=Math.log(s),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(s-d)/s)*(c-s/2<0?-1:1),p=Math.max(n,Math.floor(e-c*d/s+f)),g=Math.min(o,Math.floor(e+(s-c)*d/s+f));zlt(t,e,p,g,r)}const i=t[e];let a=n,l=o;for(hD(t,n,e),r(t[o],i)>0&&hD(t,n,o);a0;)--l}r(t[n],i)===0?hD(t,n,l):(++l,hD(t,l,o)),l<=e&&(n=l+1),e<=l&&(o=l-1)}return t}function hD(t,e,n){const o=t[e];t[e]=t[n],t[n]=o}function kSo(t,e,n){if(t=Float64Array.from(CSo(t)),!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return mDe(t);if(e>=1)return gDe(t);var o,r=(o-1)*e,i=Math.floor(r),a=gDe(zlt(t,i).subarray(0,i+1)),l=mDe(t.subarray(i+1));return a+(l-a)*(r-i)}}function LSo(t,e,n=Mlt){if(!(!(o=t.length)||isNaN(e=+e))){if(e<=0||o<2)return+n(t[0],0,t);if(e>=1)return+n(t[o-1],o-1,t);var o,r=(o-1)*e,i=Math.floor(r),a=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return a+(l-a)*(r-i)}}function WSo(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var o=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(r);++o>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?tV(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?tV(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=USo.exec(t))?new Jp(e[1],e[2],e[3],1):(e=jSo.exec(t))?new Jp(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=BSo.exec(t))?tV(e[1],e[2],e[3],e[4]):(e=YSo.exec(t))?tV(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=OSo.exec(t))?SDe(e[1],e[2]/100,e[3]/100,1):(e=VSo.exec(t))?SDe(e[1],e[2]/100,e[3]/100,e[4]):yDe.hasOwnProperty(t)?vDe(yDe[t]):t==="transparent"?new Jp(NaN,NaN,NaN,0):null}function vDe(t){return new Jp(t>>16&255,t>>8&255,t&255,1)}function tV(t,e,n,o){return o<=0&&(t=e=n=NaN),new Jp(t,e,n,o)}function XSo(t){return t instanceof hU||(t=gL(t)),t?(t=t.rgb(),new Jp(t.r,t.g,t.b,t.opacity)):new Jp}function She(t,e,n,o){return arguments.length===1?XSo(t):new Jp(t,e,n,o??1)}function Jp(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}W3e(Jp,She,Elt(hU,{brighter(t){return t=t==null?KJ:Math.pow(KJ,t),new Jp(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?hL:Math.pow(hL,t),new Jp(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Jp(Fx(this.r),Fx(this.g),Fx(this.b),qJ(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xDe,formatHex:xDe,formatHex8:JSo,formatRgb:bDe,toString:bDe}));function xDe(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}`}function JSo(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}${ox((isNaN(this.opacity)?1:this.opacity)*255)}`}function bDe(){const t=qJ(this.opacity);return`${t===1?"rgb(":"rgba("}${Fx(this.r)}, ${Fx(this.g)}, ${Fx(this.b)}${t===1?")":`, ${t})`}`}function qJ(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fx(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ox(t){return t=Fx(t),(t<16?"0":"")+t.toString(16)}function SDe(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new w2(t,e,n,o)}function Flt(t){if(t instanceof w2)return new w2(t.h,t.s,t.l,t.opacity);if(t instanceof hU||(t=gL(t)),!t)return new w2;if(t instanceof w2)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,l=i-r,s=(i+r)/2;return l?(e===i?a=(n-o)/l+(n0&&s<1?0:a,new w2(a,l,s,t.opacity)}function KSo(t,e,n,o){return arguments.length===1?Flt(t):new w2(t,e,n,o??1)}function w2(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}W3e(w2,KSo,Elt(hU,{brighter(t){return t=t==null?KJ:Math.pow(KJ,t),new w2(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?hL:Math.pow(hL,t),new w2(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new Jp(xle(t>=240?t-240:t+120,r,o),xle(t,r,o),xle(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new w2(TDe(this.h),nV(this.s),nV(this.l),qJ(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=qJ(this.opacity);return`${t===1?"hsl(":"hsla("}${TDe(this.h)}, ${nV(this.s)*100}%, ${nV(this.l)*100}%${t===1?")":`, ${t})`}`}}));function TDe(t){return t=(t||0)%360,t<0?t+360:t}function nV(t){return Math.max(0,Math.min(1,t||0))}function xle(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const N3e=t=>()=>t;function qSo(t,e){return function(n){return t+n*e}}function $So(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function QSo(t){return(t=+t)==1?klt:function(e,n){return n-e?$So(e,n,t):N3e(isNaN(e)?n:e)}}function klt(t,e){var n=e-t;return n?qSo(t,n):N3e(isNaN(t)?e:t)}const PDe=function t(e){var n=QSo(e);function o(r,i){var a=n((r=She(r)).r,(i=She(i)).r),l=n(r.g,i.g),s=n(r.b,i.b),c=klt(r.opacity,i.opacity);return function(u){return r.r=a(u),r.g=l(u),r.b=s(u),r.opacity=c(u),r+""}}return o.gamma=t,o}(1);function ZSo(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),r;return function(i){for(r=0;rn&&(i=e.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(o=o[0])===(r=r[0])?l[a]?l[a]+=r:l[++a]=r:(l[++a]=null,s.push({i:a,x:$J(o,r)})),n=ble.lastIndex;return ne&&(n=t,t=e,e=n),function(o){return Math.max(t,Math.min(e,o))}}function uTo(t,e,n){var o=t[0],r=t[1],i=e[0],a=e[1];return r2?dTo:uTo,s=c=null,d}function d(f){return f==null||isNaN(f=+f)?i:(s||(s=l(t.map(o),e,n)))(o(a(f)))}return d.invert=function(f){return a(r((c||(c=l(e,t.map(o),$J)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,QJ),u()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),n=U3e,u()},d.clamp=function(f){return arguments.length?(a=f?!0:cp,u()):a!==cp},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(i=f,d):i},function(f,p){return o=f,r=p,u()}}function j3e(){return ote()(cp,cp)}function fTo(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function ZJ(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}function sH(t){return t=ZJ(Math.abs(t)),t?t[1]:NaN}function hTo(t,e){return function(n,o){for(var r=n.length,i=[],a=0,l=t[0],s=0;r>0&&l>0&&(s+l+1>o&&(l=Math.max(1,o-s)),i.push(n.substring(r-=l,r+l)),!((s+=l+1)>o));)l=t[a=(a+1)%t.length];return i.reverse().join(e)}}function pTo(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var gTo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mL(t){if(!(e=gTo.exec(t)))throw new Error("invalid format: "+t);var e;return new B3e({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}mL.prototype=B3e.prototype;function B3e(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}B3e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function mTo(t){e:for(var e=t.length,n=1,o=-1,r;n0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(r+1):t}var Llt;function yTo(t,e){var n=ZJ(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(Llt=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=o.length;return i===a?o:i>a?o+new Array(i-a+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+ZJ(t,Math.max(0,e+i-1))[0]}function RDe(t,e){var n=ZJ(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}const HDe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:fTo,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>RDe(t*100,e),r:RDe,s:yTo,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function MDe(t){return t}var IDe=Array.prototype.map,zDe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ATo(t){var e=t.grouping===void 0||t.thousands===void 0?MDe:hTo(IDe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",o=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?MDe:pTo(IDe.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",s=t.nan===void 0?"NaN":t.nan+"";function c(d){d=mL(d);var f=d.fill,p=d.align,g=d.sign,A=d.symbol,y=d.zero,S=d.width,C=d.comma,P=d.precision,v=d.trim,T=d.type;T==="n"?(C=!0,T="g"):HDe[T]||(P===void 0&&(P=12),v=!0,T="g"),(y||f==="0"&&p==="=")&&(y=!0,f="0",p="=");var w=A==="$"?n:A==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",x=A==="$"?o:/[%p]/.test(T)?a:"",b=HDe[T],R=/[defgprs%]/.test(T);P=P===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function H(F){var E=w,N=x,U,W,k;if(T==="c")N=b(F)+N,F="";else{F=+F;var D=F<0||1/F<0;if(F=isNaN(F)?s:b(Math.abs(F),P),v&&(F=mTo(F)),D&&+F==0&&g!=="+"&&(D=!1),E=(D?g==="("?g:l:g==="-"||g==="("?"":g)+E,N=(T==="s"?zDe[8+Llt/3]:"")+N+(D&&g==="("?")":""),R){for(U=-1,W=F.length;++Uk||k>57){N=(k===46?r+F.slice(U+1):F.slice(U))+N,F=F.slice(0,U);break}}}C&&!y&&(F=e(F,1/0));var L=E.length+F.length+N.length,j=L>1)+E+F+N+j.slice(L);break;default:F=j+E+F+N;break}return i(F)}return H.toString=function(){return d+""},H}function u(d,f){var p=c((d=mL(d),d.type="f",d)),g=Math.max(-8,Math.min(8,Math.floor(sH(f)/3)))*3,A=Math.pow(10,-g),y=zDe[8+g/3];return function(S){return p(A*S)+y}}return{format:c,formatPrefix:u}}var oV,Y3e,Wlt;wTo({thousands:",",grouping:[3],currency:["$",""]});function wTo(t){return oV=ATo(t),Y3e=oV.format,Wlt=oV.formatPrefix,oV}function vTo(t){return Math.max(0,-sH(Math.abs(t)))}function xTo(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(sH(e)/3)))*3-sH(Math.abs(t)))}function bTo(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,sH(e)-sH(t))+1}function Nlt(t,e,n,o){var r=xhe(t,e,n),i;switch(o=mL(o??",f"),o.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return o.precision==null&&!isNaN(i=xTo(r,a))&&(o.precision=i),Wlt(o,a)}case"":case"e":case"g":case"p":case"r":{o.precision==null&&!isNaN(i=bTo(r,Math.max(Math.abs(t),Math.abs(e))))&&(o.precision=i-(o.type==="e"));break}case"f":case"%":{o.precision==null&&!isNaN(i=vTo(r))&&(o.precision=i-(o.type==="%")*2);break}}return Y3e(o)}function t7(t){var e=t.domain;return t.ticks=function(n){var o=e();return whe(o[0],o[o.length-1],n??10)},t.tickFormat=function(n,o){var r=e();return Nlt(r[0],r[r.length-1],n??10,o)},t.nice=function(n){n==null&&(n=10);var o=e(),r=0,i=o.length-1,a=o[r],l=o[i],s,c,u=10;for(l0;){if(c=vhe(a,l,n),c===s)return o[r]=a,o[i]=l,e(o);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;s=c}return t},t}function yL(){var t=j3e();return t.copy=function(){return pU(t,yL())},gy.apply(t,arguments),t7(t)}function Ult(t){var e;function n(o){return o==null||isNaN(o=+o)?e:o}return n.invert=n,n.domain=n.range=function(o){return arguments.length?(t=Array.from(o,QJ),n):t.slice()},n.unknown=function(o){return arguments.length?(e=o,n):e},n.copy=function(){return Ult(t).unknown(e)},t=arguments.length?Array.from(t,QJ):[0,1],t7(n)}function jlt(t,e){t=t.slice();var n=0,o=t.length-1,r=t[n],i=t[o],a;return iMath.pow(t,e)}function RTo(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function FDe(t){return(e,n)=>-t(-e,n)}function O3e(t){const e=t(DDe,EDe),n=e.domain;let o=10,r,i;function a(){return r=RTo(o),i=CTo(o),n()[0]<0?(r=FDe(r),i=FDe(i),t(STo,TTo)):t(DDe,EDe),e}return e.base=function(l){return arguments.length?(o=+l,a()):o},e.domain=function(l){return arguments.length?(n(l),a()):n()},e.ticks=l=>{const s=n();let c=s[0],u=s[s.length-1];const d=u0){for(;f<=p;++f)for(g=1;gu)break;S.push(A)}}else for(;f<=p;++f)for(g=o-1;g>=1;--g)if(A=f>0?g/i(-f):g*i(f),!(Au)break;S.push(A)}S.length*2{if(l==null&&(l=10),s==null&&(s=o===10?"s":","),typeof s!="function"&&(!(o%1)&&(s=mL(s)).precision==null&&(s.trim=!0),s=Y3e(s)),l===1/0)return s;const c=Math.max(1,o*l/e.ticks().length);return u=>{let d=u/i(Math.round(r(u)));return d*on(jlt(n(),{floor:l=>i(Math.floor(r(l))),ceil:l=>i(Math.ceil(r(l)))})),e}function Blt(){const t=O3e(ote()).domain([1,10]);return t.copy=()=>pU(t,Blt()).base(t.base()),gy.apply(t,arguments),t}function kDe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function LDe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function V3e(t){var e=1,n=t(kDe(e),LDe(e));return n.constant=function(o){return arguments.length?t(kDe(e=+o),LDe(e)):e},t7(n)}function Ylt(){var t=V3e(ote());return t.copy=function(){return pU(t,Ylt()).constant(t.constant())},gy.apply(t,arguments)}function WDe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function HTo(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function MTo(t){return t<0?-t*t:t*t}function _3e(t){var e=t(cp,cp),n=1;function o(){return n===1?t(cp,cp):n===.5?t(HTo,MTo):t(WDe(n),WDe(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,o()):n},t7(e)}function G3e(){var t=_3e(ote());return t.copy=function(){return pU(t,G3e()).exponent(t.exponent())},gy.apply(t,arguments),t}function ITo(){return G3e.apply(null,arguments).exponent(.5)}function NDe(t){return Math.sign(t)*t*t}function zTo(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Olt(){var t=j3e(),e=[0,1],n=!1,o;function r(i){var a=zTo(t(i));return isNaN(a)?o:n?Math.round(a):a}return r.invert=function(i){return t.invert(NDe(i))},r.domain=function(i){return arguments.length?(t.domain(i),r):t.domain()},r.range=function(i){return arguments.length?(t.range((e=Array.from(i,QJ)).map(NDe)),r):e.slice()},r.rangeRound=function(i){return r.range(i).round(!0)},r.round=function(i){return arguments.length?(n=!!i,r):n},r.clamp=function(i){return arguments.length?(t.clamp(i),r):t.clamp()},r.unknown=function(i){return arguments.length?(o=i,r):o},r.copy=function(){return Olt(t.domain(),e).round(n).clamp(t.clamp()).unknown(o)},gy.apply(r,arguments),t7(r)}function Vlt(){var t=[],e=[],n=[],o;function r(){var a=0,l=Math.max(1,e.length);for(n=new Array(l-1);++a0?n[l-1]:t[0],l=n?[o[n-1],e]:[o[c-1],o[c]]},a.unknown=function(s){return arguments.length&&(i=s),a},a.thresholds=function(){return o.slice()},a.copy=function(){return _lt().domain([t,e]).range(r).unknown(i)},gy.apply(t7(a),arguments)}function Glt(){var t=[.5],e=[0,1],n,o=1;function r(i){return i!=null&&i<=i?e[fU(t,i,0,o)]:n}return r.domain=function(i){return arguments.length?(t=Array.from(i),o=Math.min(t.length,e.length-1),r):t.slice()},r.range=function(i){return arguments.length?(e=Array.from(i),o=Math.min(t.length,e.length-1),r):e.slice()},r.invertExtent=function(i){var a=e.indexOf(i);return[t[a-1],t[a]]},r.unknown=function(i){return arguments.length?(n=i,r):n},r.copy=function(){return Glt().domain(t).range(e).unknown(n)},gy.apply(r,arguments)}const Sle=new Date,Tle=new Date;function qu(t,e,n,o){function r(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return r.floor=i=>(t(i=new Date(+i)),i),r.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),r.round=i=>{const a=r(i),l=r.ceil(i);return i-a(e(i=new Date(+i),a==null?1:Math.floor(a)),i),r.range=(i,a,l)=>{const s=[];if(i=r.ceil(i),l=l==null?1:Math.floor(l),!(i0))return s;let c;do s.push(c=new Date(+i)),e(i,l),t(i);while(cqu(a=>{if(a>=a)for(;t(a),!i(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!i(a););else for(;--l>=0;)for(;e(a,1),!i(a););}),n&&(r.count=(i,a)=>(Sle.setTime(+i),Tle.setTime(+a),t(Sle),t(Tle),Math.floor(n(Sle,Tle))),r.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?r.filter(o?a=>o(a)%i===0:a=>r.count(0,a)%i===0):r)),r}const eK=qu(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);eK.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?qu(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):eK);eK.range;const M6=1e3,_m=M6*60,I6=_m*60,uA=I6*24,X3e=uA*7,UDe=uA*30,Ple=uA*365,rx=qu(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*M6)},(t,e)=>(e-t)/M6,t=>t.getUTCSeconds());rx.range;const J3e=qu(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*M6)},(t,e)=>{t.setTime(+t+e*_m)},(t,e)=>(e-t)/_m,t=>t.getMinutes());J3e.range;const K3e=qu(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*_m)},(t,e)=>(e-t)/_m,t=>t.getUTCMinutes());K3e.range;const q3e=qu(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*M6-t.getMinutes()*_m)},(t,e)=>{t.setTime(+t+e*I6)},(t,e)=>(e-t)/I6,t=>t.getHours());q3e.range;const $3e=qu(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*I6)},(t,e)=>(e-t)/I6,t=>t.getUTCHours());$3e.range;const gU=qu(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*_m)/uA,t=>t.getDate()-1);gU.range;const rte=qu(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uA,t=>t.getUTCDate()-1);rte.range;const Xlt=qu(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/uA,t=>Math.floor(t/uA));Xlt.range;function mS(t){return qu(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*_m)/X3e)}const ite=mS(0),tK=mS(1),DTo=mS(2),ETo=mS(3),cH=mS(4),FTo=mS(5),kTo=mS(6);ite.range;tK.range;DTo.range;ETo.range;cH.range;FTo.range;kTo.range;function yS(t){return qu(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/X3e)}const ate=yS(0),nK=yS(1),LTo=yS(2),WTo=yS(3),uH=yS(4),NTo=yS(5),UTo=yS(6);ate.range;nK.range;LTo.range;WTo.range;uH.range;NTo.range;UTo.range;const Q3e=qu(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Q3e.range;const Z3e=qu(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Z3e.range;const dA=qu(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());dA.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:qu(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});dA.range;const fA=qu(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());fA.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:qu(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});fA.range;function Jlt(t,e,n,o,r,i){const a=[[rx,1,M6],[rx,5,5*M6],[rx,15,15*M6],[rx,30,30*M6],[i,1,_m],[i,5,5*_m],[i,15,15*_m],[i,30,30*_m],[r,1,I6],[r,3,3*I6],[r,6,6*I6],[r,12,12*I6],[o,1,uA],[o,2,2*uA],[n,1,X3e],[e,1,UDe],[e,3,3*UDe],[t,1,Ple]];function l(c,u,d){const f=uy).right(a,f);if(p===a.length)return t.every(xhe(c/Ple,u/Ple,d));if(p===0)return eK.every(Math.max(xhe(c,u,d),1));const[g,A]=a[f/a[p-1][2]53)return null;"w"in ee||(ee.w=1),"Z"in ee?(fe=Rle(pD(ee.y,0,1)),pe=fe.getUTCDay(),fe=pe>4||pe===0?nK.ceil(fe):nK(fe),fe=rte.offset(fe,(ee.V-1)*7),ee.y=fe.getUTCFullYear(),ee.m=fe.getUTCMonth(),ee.d=fe.getUTCDate()+(ee.w+6)%7):(fe=Cle(pD(ee.y,0,1)),pe=fe.getDay(),fe=pe>4||pe===0?tK.ceil(fe):tK(fe),fe=gU.offset(fe,(ee.V-1)*7),ee.y=fe.getFullYear(),ee.m=fe.getMonth(),ee.d=fe.getDate()+(ee.w+6)%7)}else("W"in ee||"U"in ee)&&("w"in ee||(ee.w="u"in ee?ee.u%7:"W"in ee?1:0),pe="Z"in ee?Rle(pD(ee.y,0,1)).getUTCDay():Cle(pD(ee.y,0,1)).getDay(),ee.m=0,ee.d="W"in ee?(ee.w+6)%7+ee.W*7-(pe+5)%7:ee.w+ee.U*7-(pe+6)%7);return"Z"in ee?(ee.H+=ee.Z/100|0,ee.M+=ee.Z%100,Rle(ee)):Cle(ee)}}function b(oe,Z,te,ee){for(var de=0,fe=Z.length,pe=te.length,ye,ae;de=pe)return-1;if(ye=Z.charCodeAt(de++),ye===37){if(ye=Z.charAt(de++),ae=T[ye in jDe?Z.charAt(de++):ye],!ae||(ee=ae(oe,te,ee))<0)return-1}else if(ye!=te.charCodeAt(ee++))return-1}return ee}function R(oe,Z,te){var ee=c.exec(Z.slice(te));return ee?(oe.p=u.get(ee[0].toLowerCase()),te+ee[0].length):-1}function H(oe,Z,te){var ee=p.exec(Z.slice(te));return ee?(oe.w=g.get(ee[0].toLowerCase()),te+ee[0].length):-1}function F(oe,Z,te){var ee=d.exec(Z.slice(te));return ee?(oe.w=f.get(ee[0].toLowerCase()),te+ee[0].length):-1}function E(oe,Z,te){var ee=S.exec(Z.slice(te));return ee?(oe.m=C.get(ee[0].toLowerCase()),te+ee[0].length):-1}function N(oe,Z,te){var ee=A.exec(Z.slice(te));return ee?(oe.m=y.get(ee[0].toLowerCase()),te+ee[0].length):-1}function U(oe,Z,te){return b(oe,e,Z,te)}function W(oe,Z,te){return b(oe,n,Z,te)}function k(oe,Z,te){return b(oe,o,Z,te)}function D(oe){return a[oe.getDay()]}function L(oe){return i[oe.getDay()]}function j(oe){return s[oe.getMonth()]}function B(oe){return l[oe.getMonth()]}function O(oe){return r[+(oe.getHours()>=12)]}function V(oe){return 1+~~(oe.getMonth()/3)}function G(oe){return a[oe.getUTCDay()]}function q(oe){return i[oe.getUTCDay()]}function $(oe){return s[oe.getUTCMonth()]}function ie(oe){return l[oe.getUTCMonth()]}function Q(oe){return r[+(oe.getUTCHours()>=12)]}function se(oe){return 1+~~(oe.getUTCMonth()/3)}return{format:function(oe){var Z=w(oe+="",P);return Z.toString=function(){return oe},Z},parse:function(oe){var Z=x(oe+="",!1);return Z.toString=function(){return oe},Z},utcFormat:function(oe){var Z=w(oe+="",v);return Z.toString=function(){return oe},Z},utcParse:function(oe){var Z=x(oe+="",!0);return Z.toString=function(){return oe},Z}}}var jDe={"-":"",_:" ",0:"0"},Nd=/^\s*\d+/,_To=/^%/,GTo=/[\\^$*+?|[\]().{}]/g;function Yl(t,e,n){var o=t<0?"-":"",r=(o?-t:t)+"",i=r.length;return o+(i[e.toLowerCase(),n]))}function JTo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.w=+o[0],n+o[0].length):-1}function KTo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.u=+o[0],n+o[0].length):-1}function qTo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.U=+o[0],n+o[0].length):-1}function $To(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.V=+o[0],n+o[0].length):-1}function QTo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.W=+o[0],n+o[0].length):-1}function BDe(t,e,n){var o=Nd.exec(e.slice(n,n+4));return o?(t.y=+o[0],n+o[0].length):-1}function YDe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.y=+o[0]+(+o[0]>68?1900:2e3),n+o[0].length):-1}function ZTo(t,e,n){var o=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return o?(t.Z=o[1]?0:-(o[2]+(o[3]||"00")),n+o[0].length):-1}function ePo(t,e,n){var o=Nd.exec(e.slice(n,n+1));return o?(t.q=o[0]*3-3,n+o[0].length):-1}function tPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.m=o[0]-1,n+o[0].length):-1}function ODe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.d=+o[0],n+o[0].length):-1}function nPo(t,e,n){var o=Nd.exec(e.slice(n,n+3));return o?(t.m=0,t.d=+o[0],n+o[0].length):-1}function VDe(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.H=+o[0],n+o[0].length):-1}function oPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.M=+o[0],n+o[0].length):-1}function rPo(t,e,n){var o=Nd.exec(e.slice(n,n+2));return o?(t.S=+o[0],n+o[0].length):-1}function iPo(t,e,n){var o=Nd.exec(e.slice(n,n+3));return o?(t.L=+o[0],n+o[0].length):-1}function aPo(t,e,n){var o=Nd.exec(e.slice(n,n+6));return o?(t.L=Math.floor(o[0]/1e3),n+o[0].length):-1}function lPo(t,e,n){var o=_To.exec(e.slice(n,n+1));return o?n+o[0].length:-1}function sPo(t,e,n){var o=Nd.exec(e.slice(n));return o?(t.Q=+o[0],n+o[0].length):-1}function cPo(t,e,n){var o=Nd.exec(e.slice(n));return o?(t.s=+o[0],n+o[0].length):-1}function _De(t,e){return Yl(t.getDate(),e,2)}function uPo(t,e){return Yl(t.getHours(),e,2)}function dPo(t,e){return Yl(t.getHours()%12||12,e,2)}function fPo(t,e){return Yl(1+gU.count(dA(t),t),e,3)}function Klt(t,e){return Yl(t.getMilliseconds(),e,3)}function hPo(t,e){return Klt(t,e)+"000"}function pPo(t,e){return Yl(t.getMonth()+1,e,2)}function gPo(t,e){return Yl(t.getMinutes(),e,2)}function mPo(t,e){return Yl(t.getSeconds(),e,2)}function yPo(t){var e=t.getDay();return e===0?7:e}function APo(t,e){return Yl(ite.count(dA(t)-1,t),e,2)}function qlt(t){var e=t.getDay();return e>=4||e===0?cH(t):cH.ceil(t)}function wPo(t,e){return t=qlt(t),Yl(cH.count(dA(t),t)+(dA(t).getDay()===4),e,2)}function vPo(t){return t.getDay()}function xPo(t,e){return Yl(tK.count(dA(t)-1,t),e,2)}function bPo(t,e){return Yl(t.getFullYear()%100,e,2)}function SPo(t,e){return t=qlt(t),Yl(t.getFullYear()%100,e,2)}function TPo(t,e){return Yl(t.getFullYear()%1e4,e,4)}function PPo(t,e){var n=t.getDay();return t=n>=4||n===0?cH(t):cH.ceil(t),Yl(t.getFullYear()%1e4,e,4)}function CPo(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Yl(e/60|0,"0",2)+Yl(e%60,"0",2)}function GDe(t,e){return Yl(t.getUTCDate(),e,2)}function RPo(t,e){return Yl(t.getUTCHours(),e,2)}function HPo(t,e){return Yl(t.getUTCHours()%12||12,e,2)}function MPo(t,e){return Yl(1+rte.count(fA(t),t),e,3)}function $lt(t,e){return Yl(t.getUTCMilliseconds(),e,3)}function IPo(t,e){return $lt(t,e)+"000"}function zPo(t,e){return Yl(t.getUTCMonth()+1,e,2)}function DPo(t,e){return Yl(t.getUTCMinutes(),e,2)}function EPo(t,e){return Yl(t.getUTCSeconds(),e,2)}function FPo(t){var e=t.getUTCDay();return e===0?7:e}function kPo(t,e){return Yl(ate.count(fA(t)-1,t),e,2)}function Qlt(t){var e=t.getUTCDay();return e>=4||e===0?uH(t):uH.ceil(t)}function LPo(t,e){return t=Qlt(t),Yl(uH.count(fA(t),t)+(fA(t).getUTCDay()===4),e,2)}function WPo(t){return t.getUTCDay()}function NPo(t,e){return Yl(nK.count(fA(t)-1,t),e,2)}function UPo(t,e){return Yl(t.getUTCFullYear()%100,e,2)}function jPo(t,e){return t=Qlt(t),Yl(t.getUTCFullYear()%100,e,2)}function BPo(t,e){return Yl(t.getUTCFullYear()%1e4,e,4)}function YPo(t,e){var n=t.getUTCDay();return t=n>=4||n===0?uH(t):uH.ceil(t),Yl(t.getUTCFullYear()%1e4,e,4)}function OPo(){return"+0000"}function XDe(){return"%"}function JDe(t){return+t}function KDe(t){return Math.floor(+t/1e3)}var oP,Zlt,est;VPo({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function VPo(t){return oP=VTo(t),Zlt=oP.format,oP.parse,est=oP.utcFormat,oP.utcParse,oP}function _Po(t){return new Date(t)}function GPo(t){return t instanceof Date?+t:+new Date(+t)}function e6e(t,e,n,o,r,i,a,l,s,c){var u=j3e(),d=u.invert,f=u.domain,p=c(".%L"),g=c(":%S"),A=c("%I:%M"),y=c("%I %p"),S=c("%a %d"),C=c("%b %d"),P=c("%B"),v=c("%Y");function T(w){return(s(w)e(r/(t.length-1)))},n.quantiles=function(o){return Array.from({length:o+1},(r,i)=>kSo(t,i/o))},n.copy=function(){return rst(e).domain(t)},HA.apply(n,arguments)}function ste(){var t=0,e=.5,n=1,o=1,r,i,a,l,s,c=cp,u,d=!1,f;function p(A){return isNaN(A=+A)?f:(A=.5+((A=+u(A))-i)*(o*Ae}var eCo=ZPo,tCo=sst,nCo=eCo,oCo=oS;function rCo(t){return t&&t.length?tCo(t,oCo,nCo):void 0}var iCo=rCo;const H8=Wi(iCo);function aCo(t,e){return tt.e^i.s<0?1:-1;for(o=i.d.length,r=t.d.length,e=0,n=ot.d[e]^i.s<0?1:-1;return o===r?0:o>r^i.s<0?1:-1};Br.decimalPlaces=Br.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*mc;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Br.dividedBy=Br.div=function(t){return V6(this,new this.constructor(t))};Br.dividedToIntegerBy=Br.idiv=function(t){var e=this,n=e.constructor;return Ds(V6(e,new n(t),0,1),n.precision)};Br.equals=Br.eq=function(t){return!this.cmp(t)};Br.exponent=function(){return cu(this)};Br.greaterThan=Br.gt=function(t){return this.cmp(t)>0};Br.greaterThanOrEqualTo=Br.gte=function(t){return this.cmp(t)>=0};Br.isInteger=Br.isint=function(){return this.e>this.d.length-2};Br.isNegative=Br.isneg=function(){return this.s<0};Br.isPositive=Br.ispos=function(){return this.s>0};Br.isZero=function(){return this.s===0};Br.lessThan=Br.lt=function(t){return this.cmp(t)<0};Br.lessThanOrEqualTo=Br.lte=function(t){return this.cmp(t)<1};Br.logarithm=Br.log=function(t){var e,n=this,o=n.constructor,r=o.precision,i=r+5;if(t===void 0)t=new o(10);else if(t=new o(t),t.s<1||t.eq(fg))throw Error(iy+"NaN");if(n.s<1)throw Error(iy+(n.s?"NaN":"-Infinity"));return n.eq(fg)?new o(0):(Oc=!1,e=V6(AL(n,i),AL(t,i),i),Oc=!0,Ds(e,r))};Br.minus=Br.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?fst(e,t):ust(e,(t.s=-t.s,t))};Br.modulo=Br.mod=function(t){var e,n=this,o=n.constructor,r=o.precision;if(t=new o(t),!t.s)throw Error(iy+"NaN");return n.s?(Oc=!1,e=V6(n,t,0,1).times(t),Oc=!0,n.minus(e)):Ds(new o(n),r)};Br.naturalExponential=Br.exp=function(){return dst(this)};Br.naturalLogarithm=Br.ln=function(){return AL(this)};Br.negated=Br.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Br.plus=Br.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?ust(e,t):fst(e,(t.s=-t.s,t))};Br.precision=Br.sd=function(t){var e,n,o,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(kx+t);if(e=cu(r)+1,o=r.d.length-1,n=o*mc+1,o=r.d[o],o){for(;o%10==0;o/=10)n--;for(o=r.d[0];o>=10;o/=10)n++}return t&&e>n?e:n};Br.squareRoot=Br.sqrt=function(){var t,e,n,o,r,i,a,l=this,s=l.constructor;if(l.s<1){if(!l.s)return new s(0);throw Error(iy+"NaN")}for(t=cu(l),Oc=!1,r=Math.sqrt(+l),r==0||r==1/0?(e=w9(l.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=LM((t+1)/2)-(t<0||t%2),r==1/0?e="5e"+t:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),o=new s(e)):o=new s(r.toString()),n=s.precision,r=a=n+3;;)if(i=o,o=i.plus(V6(l,i,a+2)).times(.5),w9(i.d).slice(0,a)===(e=w9(o.d)).slice(0,a)){if(e=e.slice(a-3,a+1),r==a&&e=="4999"){if(Ds(i,n+1,0),i.times(i).eq(l)){o=i;break}}else if(e!="9999")break;a+=4}return Oc=!0,Ds(o,n)};Br.times=Br.mul=function(t){var e,n,o,r,i,a,l,s,c,u=this,d=u.constructor,f=u.d,p=(t=new d(t)).d;if(!u.s||!t.s)return new d(0);for(t.s*=u.s,n=u.e+t.e,s=f.length,c=p.length,s=0;){for(e=0,r=s+o;r>o;)l=i[r]+p[o]*f[r-o-1]+e,i[r--]=l%vd|0,e=l/vd|0;i[r]=(i[r]+e)%vd|0}for(;!i[--a];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,Oc?Ds(t,d.precision):t};Br.toDecimalPlaces=Br.todp=function(t,e){var n=this,o=n.constructor;return n=new o(n),t===void 0?n:($9(t,0,kM),e===void 0?e=o.rounding:$9(e,0,8),Ds(n,t+cu(n)+1,e))};Br.toExponential=function(t,e){var n,o=this,r=o.constructor;return t===void 0?n=Ab(o,!0):($9(t,0,kM),e===void 0?e=r.rounding:$9(e,0,8),o=Ds(new r(o),t+1,e),n=Ab(o,!0,t+1)),n};Br.toFixed=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?Ab(r):($9(t,0,kM),e===void 0?e=i.rounding:$9(e,0,8),o=Ds(new i(r),t+cu(r)+1,e),n=Ab(o.abs(),!1,t+cu(o)+1),r.isneg()&&!r.isZero()?"-"+n:n)};Br.toInteger=Br.toint=function(){var t=this,e=t.constructor;return Ds(new e(t),cu(t)+1,e.rounding)};Br.toNumber=function(){return+this};Br.toPower=Br.pow=function(t){var e,n,o,r,i,a,l=this,s=l.constructor,c=12,u=+(t=new s(t));if(!t.s)return new s(fg);if(l=new s(l),!l.s){if(t.s<1)throw Error(iy+"Infinity");return l}if(l.eq(fg))return l;if(o=s.precision,t.eq(fg))return Ds(l,o);if(e=t.e,n=t.d.length-1,a=e>=n,i=l.s,a){if((n=u<0?-u:u)<=cst){for(r=new s(fg),e=Math.ceil(o/mc+4),Oc=!1;n%2&&(r=r.times(l),QDe(r.d,e)),n=LM(n/2),n!==0;)l=l.times(l),QDe(l.d,e);return Oc=!0,t.s<0?new s(fg).div(r):Ds(r,o)}}else if(i<0)throw Error(iy+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Oc=!1,r=t.times(AL(l,o+c)),Oc=!0,r=dst(r),r.s=i,r};Br.toPrecision=function(t,e){var n,o,r=this,i=r.constructor;return t===void 0?(n=cu(r),o=Ab(r,n<=i.toExpNeg||n>=i.toExpPos)):($9(t,1,kM),e===void 0?e=i.rounding:$9(e,0,8),r=Ds(new i(r),t,e),n=cu(r),o=Ab(r,t<=n||n<=i.toExpNeg,t)),o};Br.toSignificantDigits=Br.tosd=function(t,e){var n=this,o=n.constructor;return t===void 0?(t=o.precision,e=o.rounding):($9(t,1,kM),e===void 0?e=o.rounding:$9(e,0,8)),Ds(new o(n),t,e)};Br.toString=Br.valueOf=Br.val=Br.toJSON=Br[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=cu(t),n=t.constructor;return Ab(t,e<=n.toExpNeg||e>=n.toExpPos)};function ust(t,e){var n,o,r,i,a,l,s,c,u=t.constructor,d=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),Oc?Ds(e,d):e;if(s=t.d,c=e.d,a=t.e,r=e.e,s=s.slice(),i=a-r,i){for(i<0?(o=s,i=-i,l=c.length):(o=c,r=a,l=s.length),a=Math.ceil(d/mc),l=a>l?a+1:l+1,i>l&&(i=l,o.length=1),o.reverse();i--;)o.push(0);o.reverse()}for(l=s.length,i=c.length,l-i<0&&(i=l,o=c,c=s,s=o),n=0;i;)n=(s[--i]=s[i]+c[i]+n)/vd|0,s[i]%=vd;for(n&&(s.unshift(n),++r),l=s.length;s[--l]==0;)s.pop();return e.d=s,e.e=r,Oc?Ds(e,d):e}function $9(t,e,n){if(t!==~~t||tn)throw Error(kx+t)}function w9(t){var e,n,o,r=t.length-1,i="",a=t[0];if(r>0){for(i+=a,e=1;ea?1:-1;else for(l=s=0;lr[l]?1:-1;break}return s}function n(o,r,i){for(var a=0;i--;)o[i]-=a,a=o[i]1;)o.shift()}return function(o,r,i,a){var l,s,c,u,d,f,p,g,A,y,S,C,P,v,T,w,x,b,R=o.constructor,H=o.s==r.s?1:-1,F=o.d,E=r.d;if(!o.s)return new R(o);if(!r.s)throw Error(iy+"Division by zero");for(s=o.e-r.e,x=E.length,T=F.length,p=new R(H),g=p.d=[],c=0;E[c]==(F[c]||0);)++c;if(E[c]>(F[c]||0)&&--s,i==null?C=i=R.precision:a?C=i+(cu(o)-cu(r))+1:C=i,C<0)return new R(0);if(C=C/mc+2|0,c=0,x==1)for(u=0,E=E[0],C++;(c1&&(E=t(E,u),F=t(F,u),x=E.length,T=F.length),v=x,A=F.slice(0,x),y=A.length;y=vd/2&&++w;do u=0,l=e(E,A,x,y),l<0?(S=A[0],x!=y&&(S=S*vd+(A[1]||0)),u=S/w|0,u>1?(u>=vd&&(u=vd-1),d=t(E,u),f=d.length,y=A.length,l=e(d,A,f,y),l==1&&(u--,n(d,x16)throw Error(o6e+cu(t));if(!t.s)return new u(fg);for(e==null?(Oc=!1,l=d):l=e,a=new u(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(o=Math.log(xv(2,c))/Math.LN10*2+5|0,l+=o,n=r=i=new u(fg),u.precision=l;;){if(r=Ds(r.times(t),l),n=n.times(++s),a=i.plus(V6(r,n,l)),w9(a.d).slice(0,l)===w9(i.d).slice(0,l)){for(;c--;)i=Ds(i.times(i),l);return u.precision=d,e==null?(Oc=!0,Ds(i,d)):i}i=a}}function cu(t){for(var e=t.e*mc,n=t.d[0];n>=10;n/=10)e++;return e}function Hle(t,e,n){if(e>t.LN10.sd())throw Oc=!0,n&&(t.precision=n),Error(iy+"LN10 precision limit exceeded");return Ds(new t(t.LN10),e)}function t8(t){for(var e="";t--;)e+="0";return e}function AL(t,e){var n,o,r,i,a,l,s,c,u,d=1,f=10,p=t,g=p.d,A=p.constructor,y=A.precision;if(p.s<1)throw Error(iy+(p.s?"NaN":"-Infinity"));if(p.eq(fg))return new A(0);if(e==null?(Oc=!1,c=y):c=e,p.eq(10))return e==null&&(Oc=!0),Hle(A,c);if(c+=f,A.precision=c,n=w9(g),o=n.charAt(0),i=cu(p),Math.abs(i)<15e14){for(;o<7&&o!=1||o==1&&n.charAt(1)>3;)p=p.times(t),n=w9(p.d),o=n.charAt(0),d++;i=cu(p),o>1?(p=new A("0."+n),i++):p=new A(o+"."+n.slice(1))}else return s=Hle(A,c+2,y).times(i+""),p=AL(new A(o+"."+n.slice(1)),c-f).plus(s),A.precision=y,e==null?(Oc=!0,Ds(p,y)):p;for(l=a=p=V6(p.minus(fg),p.plus(fg),c),u=Ds(p.times(p),c),r=3;;){if(a=Ds(a.times(u),c),s=l.plus(V6(a,new A(r),c)),w9(s.d).slice(0,c)===w9(l.d).slice(0,c))return l=l.times(2),i!==0&&(l=l.plus(Hle(A,c+2,y).times(i+""))),l=V6(l,new A(d),c),A.precision=y,e==null?(Oc=!0,Ds(l,y)):l;l=s,r+=2}}function $De(t,e){var n,o,r;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(o=e.search(/e/i))>0?(n<0&&(n=o),n+=+e.slice(o+1),e=e.substring(0,o)):n<0&&(n=e.length),o=0;e.charCodeAt(o)===48;)++o;for(r=e.length;e.charCodeAt(r-1)===48;)--r;if(e=e.slice(o,r),e){if(r-=o,n=n-o-1,t.e=LM(n/mc),t.d=[],o=(n+1)%mc,n<0&&(o+=mc),ooK||t.e<-oK))throw Error(o6e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Ds(t,e,n){var o,r,i,a,l,s,c,u,d=t.d;for(a=1,i=d[0];i>=10;i/=10)a++;if(o=e-a,o<0)o+=mc,r=e,c=d[u=0];else{if(u=Math.ceil((o+1)/mc),i=d.length,u>=i)return t;for(c=i=d[u],a=1;i>=10;i/=10)a++;o%=mc,r=o-mc+a}if(n!==void 0&&(i=xv(10,a-r-1),l=c/i%10|0,s=e<0||d[u+1]!==void 0||c%i,s=n<4?(l||s)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||s||n==6&&(o>0?r>0?c/xv(10,a-r):0:d[u-1])%10&1||n==(t.s<0?8:7))),e<1||!d[0])return s?(i=cu(t),d.length=1,e=e-i-1,d[0]=xv(10,(mc-e%mc)%mc),t.e=LM(-e/mc)||0):(d.length=1,d[0]=t.e=t.s=0),t;if(o==0?(d.length=u,i=1,u--):(d.length=u+1,i=xv(10,mc-o),d[u]=r>0?(c/xv(10,a-r)%xv(10,r)|0)*i:0),s)for(;;)if(u==0){(d[0]+=i)==vd&&(d[0]=1,++t.e);break}else{if(d[u]+=i,d[u]!=vd)break;d[u--]=0,i=1}for(o=d.length;d[--o]===0;)d.pop();if(Oc&&(t.e>oK||t.e<-oK))throw Error(o6e+cu(t));return t}function fst(t,e){var n,o,r,i,a,l,s,c,u,d,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new f(t),Oc?Ds(e,p):e;if(s=t.d,d=e.d,o=e.e,c=t.e,s=s.slice(),a=c-o,a){for(u=a<0,u?(n=s,a=-a,l=d.length):(n=d,o=c,l=s.length),r=Math.max(Math.ceil(p/mc),l)+2,a>r&&(a=r,n.length=1),n.reverse(),r=a;r--;)n.push(0);n.reverse()}else{for(r=s.length,l=d.length,u=r0;--r)s[l++]=0;for(r=d.length;r>a;){if(s[--r]0?i=i.charAt(0)+"."+i.slice(1)+t8(o):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r<0?"e":"e+")+r):r<0?(i="0."+t8(-r-1)+i,n&&(o=n-a)>0&&(i+=t8(o))):r>=a?(i+=t8(r+1-a),n&&(o=n-r-1)>0&&(i=i+"."+t8(o))):((o=r+1)0&&(r+1===a&&(i+="."),i+=t8(o))),t.s<0?"-"+i:i}function QDe(t,e){if(t.length>e)return t.length=e,!0}function hst(t){var e,n,o;function r(i){var a=this;if(!(a instanceof r))return new r(i);if(a.constructor=r,i instanceof r){a.s=i.s,a.e=i.e,a.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(kx+i);if(i>0)a.s=1;else if(i<0)i=-i,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(i===~~i&&i<1e7){a.e=0,a.d=[i];return}return $De(a,i.toString())}else if(typeof i!="string")throw Error(kx+i);if(i.charCodeAt(0)===45?(i=i.slice(1),a.s=-1):a.s=1,bCo.test(i))$De(a,i);else throw Error(kx+i)}if(r.prototype=Br,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=hst,r.config=r.set=SCo,t===void 0&&(t={}),t)for(o=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=r[e+1]&&o<=r[e+2])this[n]=o;else throw Error(kx+n+": "+o);if((o=t[n="LN10"])!==void 0)if(o==Math.LN10)this[n]=new this(o);else throw Error(kx+n+": "+o);return this}var r6e=hst(xCo);fg=new r6e(1);const xs=r6e;function TCo(t){return HCo(t)||RCo(t)||CCo(t)||PCo()}function PCo(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CCo(t,e){if(t){if(typeof t=="string")return Che(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Che(t,e)}}function RCo(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function HCo(t){if(Array.isArray(t))return Che(t)}function Che(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n=e?n.apply(void 0,r):t(e-a,ZDe(function(){for(var l=arguments.length,s=new Array(l),c=0;ct.length)&&(e=t.length);for(var n=0,o=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],o=!0,r=!1,i=void 0;try{for(var a=t[Symbol.iterator](),l;!(o=(l=a.next()).done)&&(n.push(l.value),!(e&&n.length===e));o=!0);}catch(s){r=!0,i=s}finally{try{!o&&a.return!=null&&a.return()}finally{if(r)throw i}}return n}}function OCo(t){if(Array.isArray(t))return t}function Ast(t){var e=wL(t,2),n=e[0],o=e[1],r=n,i=o;return n>o&&(r=o,i=n),[r,i]}function wst(t,e,n){if(t.lte(0))return new xs(0);var o=dte.getDigitCount(t.toNumber()),r=new xs(10).pow(o),i=t.div(r),a=o!==1?.05:.1,l=new xs(Math.ceil(i.div(a).toNumber())).add(n).mul(a),s=l.mul(r);return e?s:new xs(Math.ceil(s))}function VCo(t,e,n){var o=1,r=new xs(t);if(!r.isint()&&n){var i=Math.abs(t);i<1?(o=new xs(10).pow(dte.getDigitCount(t)-1),r=new xs(Math.floor(r.div(o).toNumber())).mul(o)):i>1&&(r=new xs(Math.floor(t)))}else t===0?r=new xs(Math.floor((e-1)/2)):n||(r=new xs(Math.floor(t)));var a=Math.floor((e-1)/2),l=DCo(zCo(function(s){return r.add(new xs(s-a).mul(o)).toNumber()}),Rhe);return l(0,e)}function vst(t,e,n,o){var r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new xs(0),tickMin:new xs(0),tickMax:new xs(0)};var i=wst(new xs(e).sub(t).div(n-1),o,r),a;t<=0&&e>=0?a=new xs(0):(a=new xs(t).add(e).div(2),a=a.sub(new xs(a).mod(i)));var l=Math.ceil(a.sub(t).div(i).toNumber()),s=Math.ceil(new xs(e).sub(a).div(i).toNumber()),c=l+s+1;return c>n?vst(t,e,n,o,r+1):(c0?s+(n-c):s,l=e>0?l:l+(n-c)),{step:i,tickMin:a.sub(new xs(l).mul(i)),tickMax:a.add(new xs(s).mul(i))})}function _Co(t){var e=wL(t,2),n=e[0],o=e[1],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(r,2),l=Ast([n,o]),s=wL(l,2),c=s[0],u=s[1];if(c===-1/0||u===1/0){var d=u===1/0?[c].concat(Mhe(Rhe(0,r-1).map(function(){return 1/0}))):[].concat(Mhe(Rhe(0,r-1).map(function(){return-1/0})),[u]);return n>o?Hhe(d):d}if(c===u)return VCo(c,r,i);var f=vst(c,u,a,i),p=f.step,g=f.tickMin,A=f.tickMax,y=dte.rangeStep(g,A.add(new xs(.1).mul(p)),p);return n>o?Hhe(y):y}function GCo(t,e){var n=wL(t,2),o=n[0],r=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Ast([o,r]),l=wL(a,2),s=l[0],c=l[1];if(s===-1/0||c===1/0)return[o,r];if(s===c)return[s];var u=Math.max(e,2),d=wst(new xs(c).sub(s).div(u-1),i,0),f=[].concat(Mhe(dte.rangeStep(new xs(s),new xs(c).sub(new xs(.99).mul(d)),d)),[c]);return o>r?Hhe(f):f}var XCo=mst(_Co),JCo=mst(GCo),KCo="Invariant failed";function wb(t,e){throw new Error(KCo)}var qCo=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function rK(){return rK=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(s)>0){var c=Math.min(i,i+l),u=Math.max(i,i+l),d=Math.min(a,a+s),f=Math.max(a,a+s);return o>=c&&o<=u&&r>=d&&r<=f}return!1},lIo={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},a6e=function(e){var n=BEe(BEe({},lIo),e),o=m.useRef(),r=m.useState(-1),i=QMo(r,2),a=i[0],l=i[1];m.useEffect(function(){if(o.current&&o.current.getTotalLength)try{var v=o.current.getTotalLength();v&&l(v)}catch{}},[]);var s=n.x,c=n.y,u=n.width,d=n.height,f=n.radius,p=n.className,g=n.animationEasing,A=n.animationDuration,y=n.animationBegin,S=n.isAnimationActive,C=n.isUpdateAnimationActive;if(s!==+s||c!==+c||u!==+u||d!==+d||u===0||d===0)return null;var P=fl("recharts-rectangle",p);return C?be.createElement(J2,{canBegin:a>0,from:{width:u,height:d,x:s,y:c},to:{width:u,height:d,x:s,y:c},duration:A,animationEasing:g,isActive:C},function(v){var T=v.width,w=v.height,x=v.x,b=v.y;return be.createElement(J2,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:A,isActive:S,easing:g},be.createElement("path",dK({},ia(n,!0),{className:P,d:YEe(x,b,T,w,f),ref:o})))}):be.createElement("path",dK({},ia(n,!0),{className:P,d:YEe(s,c,u,d,f)}))};function Ghe(){return Ghe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function pIo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}var gIo=function(e,n,o,r,i,a){return"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(n,"h").concat(o)},mIo=function(e){var n=e.x,o=n===void 0?0:n,r=e.y,i=r===void 0?0:r,a=e.top,l=a===void 0?0:a,s=e.left,c=s===void 0?0:s,u=e.width,d=u===void 0?0:u,f=e.height,p=f===void 0?0:f,g=e.className,A=hIo(e,sIo),y=cIo({x:o,y:i,top:l,left:c,width:d,height:p},A);return!dr(o)||!dr(i)||!dr(d)||!dr(p)||!dr(l)||!dr(c)?null:be.createElement("path",Xhe({},ia(y,!0),{className:fl("recharts-cross",g),d:gIo(o,i,d,p,l,c)}))},yIo=PA,AIo=s5,wIo="[object Boolean]";function vIo(t){return t===!0||t===!1||AIo(t)&&yIo(t)==wIo}var xIo=vIo;const bIo=Wi(xIo);function DL(t){"@babel/helpers - typeof";return DL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DL(t)}function fK(){return fK=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:f,x:s,y:c},to:{upperWidth:u,lowerWidth:d,height:f,x:s,y:c},duration:A,animationEasing:g,isActive:S},function(P){var v=P.upperWidth,T=P.lowerWidth,w=P.height,x=P.x,b=P.y;return be.createElement(J2,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:A,easing:g},be.createElement("path",fK({},ia(n,!0),{className:C,d:XEe(x,b,v,T,w),ref:o})))}):be.createElement("g",null,be.createElement("path",fK({},ia(n,!0),{className:C,d:XEe(s,c,u,d,f)})))},EIo=["option","shapeType","propTransformer","activeClassName","isActive"];function EL(t){"@babel/helpers - typeof";return EL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},EL(t)}function FIo(t,e){if(t==null)return{};var n=kIo(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function kIo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function JEe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function hK(t){for(var e=1;e0&&o.handleDrag(r.changedTouches[0])}),$1($5(o),"handleDragEnd",function(){o.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var r=o.props,i=r.endIndex,a=r.onDragEnd,l=r.startIndex;a==null||a({endIndex:i,startIndex:l})}),o.detachDragEndListener()}),$1($5(o),"handleLeaveWrapper",function(){(o.state.isTravellerMoving||o.state.isSlideMoving)&&(o.leaveTimer=window.setTimeout(o.handleDragEnd,o.props.leaveTimeOut))}),$1($5(o),"handleEnterSlideOrTraveller",function(){o.setState({isTextActive:!0})}),$1($5(o),"handleLeaveSlideOrTraveller",function(){o.setState({isTextActive:!1})}),$1($5(o),"handleSlideDragStart",function(r){var i=tFe(r)?r.changedTouches[0]:r;o.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),o.attachDragEndListener()}),o.travellerDragStartHandlers={startX:o.handleTravellerDragStart.bind($5(o),"startX"),endX:o.handleTravellerDragStart.bind($5(o),"endX")},o.state={},o}return pzo(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(o){var r=o.startX,i=o.endX,a=this.state.scaleValues,l=this.props,s=l.gap,c=l.data,u=c.length-1,d=Math.min(r,i),f=Math.max(r,i),p=e.getIndexInRange(a,d),g=e.getIndexInRange(a,f);return{startIndex:p-p%s,endIndex:g===u?u:g-g%s}}},{key:"getTextOfTick",value:function(o){var r=this.props,i=r.data,a=r.tickFormatter,l=r.dataKey,s=Bu(i[o],l,o);return xa(a)?a(s,o):s}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(o){var r=this.state,i=r.slideMoveStartX,a=r.startX,l=r.endX,s=this.props,c=s.x,u=s.width,d=s.travellerWidth,f=s.startIndex,p=s.endIndex,g=s.onChange,A=o.pageX-i;A>0?A=Math.min(A,c+u-d-l,c+u-d-a):A<0&&(A=Math.max(A,c-a,c-l));var y=this.getIndex({startX:a+A,endX:l+A});(y.startIndex!==f||y.endIndex!==p)&&g&&g(y),this.setState({startX:a+A,endX:l+A,slideMoveStartX:o.pageX})}},{key:"handleTravellerDragStart",value:function(o,r){var i=tFe(r)?r.changedTouches[0]:r;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:o,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(o){var r=this.state,i=r.brushMoveStartX,a=r.movingTravellerId,l=r.endX,s=r.startX,c=this.state[a],u=this.props,d=u.x,f=u.width,p=u.travellerWidth,g=u.onChange,A=u.gap,y=u.data,S={startX:this.state.startX,endX:this.state.endX},C=o.pageX-i;C>0?C=Math.min(C,d+f-p-c):C<0&&(C=Math.max(C,d-c)),S[a]=c+C;var P=this.getIndex(S),v=P.startIndex,T=P.endIndex,w=function(){var b=y.length-1;return a==="startX"&&(l>s?v%A===0:T%A===0)||ls?T%A===0:v%A===0)||l>s&&T===b};this.setState($1($1({},a,c+C),"brushMoveStartX",o.pageX),function(){g&&w()&&g(P)})}},{key:"handleTravellerMoveKeyboard",value:function(o,r){var i=this,a=this.state,l=a.scaleValues,s=a.startX,c=a.endX,u=this.state[r],d=l.indexOf(u);if(d!==-1){var f=d+o;if(!(f===-1||f>=l.length)){var p=l[f];r==="startX"&&p>=c||r==="endX"&&p<=s||this.setState($1({},r,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var o=this.props,r=o.x,i=o.y,a=o.width,l=o.height,s=o.fill,c=o.stroke;return be.createElement("rect",{stroke:c,fill:s,x:r,y:i,width:a,height:l})}},{key:"renderPanorama",value:function(){var o=this.props,r=o.x,i=o.y,a=o.width,l=o.height,s=o.data,c=o.children,u=o.padding,d=m.Children.only(c);return d?be.cloneElement(d,{x:r,y:i,width:a,height:l,margin:u,compact:!0,data:s}):null}},{key:"renderTravellerLayer",value:function(o,r){var i,a,l=this,s=this.props,c=s.y,u=s.travellerWidth,d=s.height,f=s.traveller,p=s.ariaLabel,g=s.data,A=s.startIndex,y=s.endIndex,S=Math.max(o,this.props.x),C=Ele(Ele({},ia(this.props,!1)),{},{x:S,y:c,width:u,height:d}),P=p||"Min value: ".concat((i=g[A])===null||i===void 0?void 0:i.name,", Max value: ").concat((a=g[y])===null||a===void 0?void 0:a.name);return be.createElement(Gl,{tabIndex:0,role:"slider","aria-label":P,"aria-valuenow":o,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[r],onTouchStart:this.travellerDragStartHandlers[r],onKeyDown:function(T){["ArrowLeft","ArrowRight"].includes(T.key)&&(T.preventDefault(),T.stopPropagation(),l.handleTravellerMoveKeyboard(T.key==="ArrowRight"?1:-1,r))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(f,C))}},{key:"renderSlide",value:function(o,r){var i=this.props,a=i.y,l=i.height,s=i.stroke,c=i.travellerWidth,u=Math.min(o,r)+c,d=Math.max(Math.abs(r-o)-c,0);return be.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:s,fillOpacity:.2,x:u,y:a,width:d,height:l})}},{key:"renderText",value:function(){var o=this.props,r=o.startIndex,i=o.endIndex,a=o.y,l=o.height,s=o.travellerWidth,c=o.stroke,u=this.state,d=u.startX,f=u.endX,p=5,g={pointerEvents:"none",fill:c};return be.createElement(Gl,{className:"recharts-brush-texts"},be.createElement(XJ,gK({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,f)-p,y:a+l/2},g),this.getTextOfTick(r)),be.createElement(XJ,gK({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,f)+s+p,y:a+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var o=this.props,r=o.data,i=o.className,a=o.children,l=o.x,s=o.y,c=o.width,u=o.height,d=o.alwaysShowText,f=this.state,p=f.startX,g=f.endX,A=f.isTextActive,y=f.isSlideMoving,S=f.isTravellerMoving,C=f.isTravellerFocused;if(!r||!r.length||!dr(l)||!dr(s)||!dr(c)||!dr(u)||c<=0||u<=0)return null;var P=fl("recharts-brush",i),v=be.Children.count(a)===1,T=fzo("userSelect","none");return be.createElement(Gl,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:T},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(A||y||S||C||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(o){var r=o.x,i=o.y,a=o.width,l=o.height,s=o.stroke,c=Math.floor(i+l/2)-1;return be.createElement(be.Fragment,null,be.createElement("rect",{x:r,y:i,width:a,height:l,fill:s,stroke:"none"}),be.createElement("line",{x1:r+1,y1:c,x2:r+a-1,y2:c,fill:"none",stroke:"#fff"}),be.createElement("line",{x1:r+1,y1:c+2,x2:r+a-1,y2:c+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(o,r){var i;return be.isValidElement(o)?i=be.cloneElement(o,r):xa(o)?i=o(r):i=e.renderDefaultTraveller(r),i}},{key:"getDerivedStateFromProps",value:function(o,r){var i=o.data,a=o.width,l=o.x,s=o.travellerWidth,c=o.updateId,u=o.startIndex,d=o.endIndex;if(i!==r.prevData||c!==r.prevUpdateId)return Ele({prevData:i,prevTravellerWidth:s,prevUpdateId:c,prevX:l,prevWidth:a},i&&i.length?wzo({data:i,width:a,x:l,travellerWidth:s,startIndex:u,endIndex:d}):{scale:null,scaleValues:null});if(r.scale&&(a!==r.prevWidth||l!==r.prevX||s!==r.prevTravellerWidth)){r.scale.range([l,l+a-s]);var f=r.scale.domain().map(function(p){return r.scale(p)});return{prevData:i,prevTravellerWidth:s,prevUpdateId:c,prevX:l,prevWidth:a,startX:r.scale(o.startIndex),endX:r.scale(o.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(o,r){for(var i=o.length,a=0,l=i-1;l-a>1;){var s=Math.floor((a+l)/2);o[s]>r?l=s:a=s}return r>=o[l]?l:a}}]),e}(m.PureComponent);$1(pH,"displayName","Brush");$1(pH,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var vzo=r9e;function xzo(t,e){var n;return vzo(t,function(o,r,i){return n=e(o,r,i),!n}),!!n}var bzo=xzo,Szo=wot,Tzo=$w,Pzo=bzo,Czo=xp,Rzo=tte;function Hzo(t,e,n){var o=Czo(t)?Szo:Pzo;return n&&Rzo(t,e,n)&&(e=void 0),o(t,Tzo(e))}var Mzo=Hzo;const Izo=Wi(Mzo);var L9=function(e,n){var o=e.alwaysShow,r=e.ifOverflow;return o&&(r="extendDomain"),r===n},zzo=i9e,Dzo=V5e,Ezo=$w;function Fzo(t,e){var n={};return e=Ezo(e),Dzo(t,function(o,r,i){zzo(n,r,e(o,r,i))}),n}var kzo=Fzo;const Lzo=Wi(kzo);function Wzo(t,e){for(var n=-1,o=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function eDo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function tDo(t,e){var n=t.x,o=t.y,r=Zzo(t,Kzo),i="".concat(n),a=parseInt(i,10),l="".concat(o),s=parseInt(l,10),c="".concat(e.height||r.height),u=parseInt(c,10),d="".concat(e.width||r.width),f=parseInt(d,10);return vD(vD(vD(vD(vD({},e),r),a?{x:a}:{}),s?{y:s}:{}),{},{height:u,width:f,name:e.name,radius:e.radius})}function oFe(t){return be.createElement(Jhe,qhe({shapeType:"rectangle",propTransformer:tDo,activeClassName:"recharts-active-bar"},t))}var nDo=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(o,r){if(typeof e=="number")return e;var i=typeof o=="number";return i?e(o,r):(i||wb(),n)}},oDo=["value","background"],Vst;function gH(t){"@babel/helpers - typeof";return gH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gH(t)}function rDo(t,e){if(t==null)return{};var n=iDo(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function iDo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function yK(){return yK=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(U)0&&Math.abs(N)0&&(N=Math.min((q||0)-(U[$-1]||0),N))}),Number.isFinite(N)){var W=N/E,k=A.layout==="vertical"?o.height:o.width;if(A.padding==="gap"&&(x=W*k/2),A.padding==="no-gap"){var D=mb(e.barCategoryGap,W*k),L=W*k/2;x=L-D-(L-D)/k*D}}}r==="xAxis"?b=[o.left+(P.left||0)+(x||0),o.left+o.width-(P.right||0)-(x||0)]:r==="yAxis"?b=s==="horizontal"?[o.top+o.height-(P.bottom||0),o.top+(P.top||0)]:[o.top+(P.top||0)+(x||0),o.top+o.height-(P.bottom||0)-(x||0)]:b=A.range,T&&(b=[b[1],b[0]]);var j=wRo(A,i,f),B=j.scale,O=j.realScaleType;B.domain(S).range(b),vRo(B);var V=HRo(B,h2(h2({},A),{},{realScaleType:O}));r==="xAxis"?(F=y==="top"&&!v||y==="bottom"&&v,R=o.left,H=d[w]-F*A.height):r==="yAxis"&&(F=y==="left"&&!v||y==="right"&&v,R=d[w]-F*A.width,H=o.top);var G=h2(h2(h2({},A),V),{},{realScaleType:O,x:R,y:H,scale:B,width:r==="xAxis"?o.width:A.width,height:r==="yAxis"?o.height:A.height});return G.bandSize=iK(G,V),!A.hide&&r==="xAxis"?d[w]+=(F?-1:1)*G.height:A.hide||(d[w]+=(F?-1:1)*G.width),h2(h2({},p),{},pte({},g,G))},{})},Jst=function(e,n){var o=e.x,r=e.y,i=n.x,a=n.y;return{x:Math.min(o,i),y:Math.min(r,a),width:Math.abs(i-o),height:Math.abs(a-r)}},gDo=function(e){var n=e.x1,o=e.y1,r=e.x2,i=e.y2;return Jst({x:n,y:o},{x:r,y:i})},Kst=function(){function t(e){fDo(this,t),this.scale=e}return hDo(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=o.bandAware,i=o.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+a}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(r){var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}return this.scale(n)}}},{key:"isInRange",value:function(n){var o=this.range(),r=o[0],i=o[o.length-1];return r<=i?n>=r&&n<=i:n>=i&&n<=r}}],[{key:"create",value:function(n){return new t(n)}}]),t}();pte(Kst,"EPS",1e-4);var l6e=function(e){var n=Object.keys(e).reduce(function(o,r){return h2(h2({},o),{},pte({},r,Kst.create(e[r])))},{});return h2(h2({},n),{},{apply:function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.bandAware,l=i.position;return Lzo(r,function(s,c){return n[c].apply(s,{bandAware:a,position:l})})},isInRange:function(r){return Ost(r,function(i,a){return n[a].isInRange(i)})}})};function mDo(t){return(t%180+180)%180}var yDo=function(e){var n=e.width,o=e.height,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=mDo(r),a=i*Math.PI/180,l=Math.atan(o/n),s=a>l&&a-1?r[i?e[a]:a]:void 0}}var bDo=xDo,SDo=Ust;function TDo(t){var e=SDo(t),n=e%1;return e===e?n?e-n:e:0}var PDo=TDo,CDo=flt,RDo=$w,HDo=PDo,MDo=Math.max;function IDo(t,e,n){var o=t==null?0:t.length;if(!o)return-1;var r=n==null?0:HDo(n);return r<0&&(r=MDo(o+r,0)),CDo(t,RDo(e),r)}var zDo=IDo,DDo=bDo,EDo=zDo,FDo=DDo(EDo),kDo=FDo;const LDo=Wi(kDo);var WDo=Oeo(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),s6e=m.createContext(void 0),c6e=m.createContext(void 0),qst=m.createContext(void 0),$st=m.createContext({}),Qst=m.createContext(void 0),Zst=m.createContext(0),ect=m.createContext(0),sFe=function(e){var n=e.state,o=n.xAxisMap,r=n.yAxisMap,i=n.offset,a=e.clipPathId,l=e.children,s=e.width,c=e.height,u=WDo(i);return be.createElement(s6e.Provider,{value:o},be.createElement(c6e.Provider,{value:r},be.createElement($st.Provider,{value:i},be.createElement(qst.Provider,{value:u},be.createElement(Qst.Provider,{value:a},be.createElement(Zst.Provider,{value:c},be.createElement(ect.Provider,{value:s},l)))))))},NDo=function(){return m.useContext(Qst)},tct=function(e){var n=m.useContext(s6e);n==null&&wb();var o=n[e];return o==null&&wb(),o},UDo=function(){var e=m.useContext(s6e);return d8(e)},jDo=function(){var e=m.useContext(c6e),n=LDo(e,function(o){return Ost(o.domain,Number.isFinite)});return n||d8(e)},nct=function(e){var n=m.useContext(c6e);n==null&&wb();var o=n[e];return o==null&&wb(),o},BDo=function(){var e=m.useContext(qst);return e},YDo=function(){return m.useContext($st)},u6e=function(){return m.useContext(ect)},d6e=function(){return m.useContext(Zst)};function NL(t){"@babel/helpers - typeof";return NL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},NL(t)}function cFe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function uFe(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);nt*r)return!1;var i=n();return t*(e-t*i/2-o)>=0&&t*(e+t*i/2-r)<=0}function cEo(t,e){return oct(t,e+1)}function uEo(t,e,n,o,r){for(var i=(o||[]).slice(),a=e.start,l=e.end,s=0,c=1,u=a,d=function(){var g=o==null?void 0:o[s];if(g===void 0)return{v:oct(o,c)};var A=s,y,S=function(){return y===void 0&&(y=n(g,A)),y},C=g.coordinate,P=s===0||wK(t,C,S,u,l);P||(s=0,u=a,c+=1),P&&(u=C+t*(S()/2+r),s+=c)},f;c<=i.length;)if(f=d(),f)return f.v;return[]}function BL(t){"@babel/helpers - typeof";return BL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},BL(t)}function mFe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function $f(t){for(var e=1;e0?p.coordinate-y*t:p.coordinate})}else i[f]=p=$f($f({},p),{},{tickCoord:p.coordinate});var S=wK(t,p.tickCoord,A,l,s);S&&(s=p.tickCoord-t*(A()/2+r),i[f]=$f($f({},p),{},{isShow:!0}))},u=a-1;u>=0;u--)c(u);return i}function gEo(t,e,n,o,r,i){var a=(o||[]).slice(),l=a.length,s=e.start,c=e.end;if(i){var u=o[l-1],d=n(u,l-1),f=t*(u.coordinate+t*d/2-c);a[l-1]=u=$f($f({},u),{},{tickCoord:f>0?u.coordinate-f*t:u.coordinate});var p=wK(t,u.tickCoord,function(){return d},s,c);p&&(c=u.tickCoord-t*(d/2+r),a[l-1]=$f($f({},u),{},{isShow:!0}))}for(var g=i?l-1:l,A=function(C){var P=a[C],v,T=function(){return v===void 0&&(v=n(P,C)),v};if(C===0){var w=t*(P.coordinate-t*T()/2-s);a[C]=P=$f($f({},P),{},{tickCoord:w<0?P.coordinate-w*t:P.coordinate})}else a[C]=P=$f($f({},P),{},{tickCoord:P.coordinate});var x=wK(t,P.tickCoord,T,s,c);x&&(s=P.tickCoord+t*(T()/2+r),a[C]=$f($f({},P),{},{isShow:!0}))},y=0;y=2?R2(r[1].coordinate-r[0].coordinate):1,S=sEo(i,y,p);return s==="equidistantPreserveStart"?uEo(y,S,A,r,a):(s==="preserveStart"||s==="preserveStartEnd"?f=gEo(y,S,A,r,a,s==="preserveStartEnd"):f=pEo(y,S,A,r,a),f.filter(function(C){return C.isShow}))}var mEo=["viewBox"],yEo=["viewBox"],AEo=["ticks"];function mH(t){"@babel/helpers - typeof";return mH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mH(t)}function mC(){return mC=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function wEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function vEo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AFe(t,e){for(var n=0;n0?s(this.props):s(p)),a<=0||l<=0||!g||!g.length?null:be.createElement(Gl,{className:fl("recharts-cartesian-axis",c),ref:function(y){o.layerReference=y}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),is.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(o,r,i){var a;return be.isValidElement(o)?a=be.cloneElement(o,r):xa(o)?a=o(r):a=be.createElement(XJ,mC({},r,{className:"recharts-cartesian-axis-tick-value"}),i),a}}]),e}(m.Component);h6e(UM,"displayName","CartesianAxis");h6e(UM,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var REo=["x1","y1","x2","y2","key"],HEo=["offset"];function vb(t){"@babel/helpers - typeof";return vb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vb(t)}function wFe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ch(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function DEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}var EEo=function(e){var n=e.fill;if(!n||n==="none")return null;var o=e.fillOpacity,r=e.x,i=e.y,a=e.width,l=e.height;return be.createElement("rect",{x:r,y:i,width:a,height:l,stroke:"none",fill:n,fillOpacity:o,className:"recharts-cartesian-grid-bg"})};function act(t,e){var n;if(be.isValidElement(t))n=be.cloneElement(t,e);else if(xa(t))n=t(e);else{var o=e.x1,r=e.y1,i=e.x2,a=e.y2,l=e.key,s=vFe(e,REo),c=ia(s,!1);c.offset;var u=vFe(c,HEo);n=be.createElement("line",ix({},u,{x1:o,y1:r,x2:i,y2:a,fill:"none",key:l}))}return n}function FEo(t){var e=t.x,n=t.width,o=t.horizontal,r=o===void 0?!0:o,i=t.horizontalPoints;if(!r||!i||!i.length)return null;var a=i.map(function(l,s){var c=ch(ch({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(s),index:s});return act(r,c)});return be.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function kEo(t){var e=t.y,n=t.height,o=t.vertical,r=o===void 0?!0:o,i=t.verticalPoints;if(!r||!i||!i.length)return null;var a=i.map(function(l,s){var c=ch(ch({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(s),index:s});return act(r,c)});return be.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function LEo(t){var e=t.horizontalFill,n=t.fillOpacity,o=t.x,r=t.y,i=t.width,a=t.height,l=t.horizontalPoints,s=t.horizontal,c=s===void 0?!0:s;if(!c||!e||!e.length)return null;var u=l.map(function(f){return Math.round(f+r-r)}).sort(function(f,p){return f-p});r!==u[0]&&u.unshift(0);var d=u.map(function(f,p){var g=!u[p+1],A=g?r+a-f:u[p+1]-f;if(A<=0)return null;var y=p%e.length;return be.createElement("rect",{key:"react-".concat(p),y:f,x:o,height:A,width:i,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function WEo(t){var e=t.vertical,n=e===void 0?!0:e,o=t.verticalFill,r=t.fillOpacity,i=t.x,a=t.y,l=t.width,s=t.height,c=t.verticalPoints;if(!n||!o||!o.length)return null;var u=c.map(function(f){return Math.round(f+i-i)}).sort(function(f,p){return f-p});i!==u[0]&&u.unshift(0);var d=u.map(function(f,p){var g=!u[p+1],A=g?i+l-f:u[p+1]-f;if(A<=0)return null;var y=p%o.length;return be.createElement("rect",{key:"react-".concat(p),x:f,y:a,width:A,height:s,stroke:"none",fill:o[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var NEo=function(e,n){var o=e.xAxis,r=e.width,i=e.height,a=e.offset;return Pst(f6e(ch(ch(ch({},UM.defaultProps),o),{},{ticks:z6(o,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,n)},UEo=function(e,n){var o=e.yAxis,r=e.width,i=e.height,a=e.offset;return Pst(f6e(ch(ch(ch({},UM.defaultProps),o),{},{ticks:z6(o,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,n)},rP={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Cw(t){var e,n,o,r,i,a,l=u6e(),s=d6e(),c=YDo(),u=ch(ch({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:rP.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:rP.fill,horizontal:(o=t.horizontal)!==null&&o!==void 0?o:rP.horizontal,horizontalFill:(r=t.horizontalFill)!==null&&r!==void 0?r:rP.horizontalFill,vertical:(i=t.vertical)!==null&&i!==void 0?i:rP.vertical,verticalFill:(a=t.verticalFill)!==null&&a!==void 0?a:rP.verticalFill,x:dr(t.x)?t.x:c.left,y:dr(t.y)?t.y:c.top,width:dr(t.width)?t.width:c.width,height:dr(t.height)?t.height:c.height}),d=u.x,f=u.y,p=u.width,g=u.height,A=u.syncWithTicks,y=u.horizontalValues,S=u.verticalValues,C=UDo(),P=jDo();if(!dr(p)||p<=0||!dr(g)||g<=0||!dr(d)||d!==+d||!dr(f)||f!==+f)return null;var v=u.verticalCoordinatesGenerator||NEo,T=u.horizontalCoordinatesGenerator||UEo,w=u.horizontalPoints,x=u.verticalPoints;if((!w||!w.length)&&xa(T)){var b=y&&y.length,R=T({yAxis:P?ch(ch({},P),{},{ticks:b?y:P.ticks}):void 0,width:l,height:s,offset:c},b?!0:A);O6(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(vb(R),"]")),Array.isArray(R)&&(w=R)}if((!x||!x.length)&&xa(v)){var H=S&&S.length,F=v({xAxis:C?ch(ch({},C),{},{ticks:H?S:C.ticks}):void 0,width:l,height:s,offset:c},H?!0:A);O6(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(vb(F),"]")),Array.isArray(F)&&(x=F)}return be.createElement("g",{className:"recharts-cartesian-grid"},be.createElement(EEo,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height}),be.createElement(FEo,ix({},u,{offset:c,horizontalPoints:w,xAxis:C,yAxis:P})),be.createElement(kEo,ix({},u,{offset:c,verticalPoints:x,xAxis:C,yAxis:P})),be.createElement(LEo,ix({},u,{horizontalPoints:w})),be.createElement(WEo,ix({},u,{verticalPoints:x})))}Cw.displayName="CartesianGrid";var jEo=["type","layout","connectNulls","ref"];function yH(t){"@babel/helpers - typeof";return yH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yH(t)}function BEo(t,e){if(t==null)return{};var n=YEo(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function YEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function eF(){return eF=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);nd){p=[].concat(iP(s.slice(0,g)),[d-A]);break}var y=p.length%2===0?[0,f]:[f];return[].concat(iP(e.repeat(s,u)),iP(p),y).map(function(S){return"".concat(S,"px")}).join(", ")}),p2(O4(n),"id",gS("recharts-line-")),p2(O4(n),"pathRef",function(a){n.mainCurve=a}),p2(O4(n),"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),p2(O4(n),"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return JEo(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();this.setState({totalLength:o})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();o!==this.state.totalLength&&this.setState({totalLength:o})}}},{key:"getTotalLength",value:function(){var o=this.mainCurve;try{return o&&o.getTotalLength&&o.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(o,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.points,l=i.xAxis,s=i.yAxis,c=i.layout,u=i.children,d=e1(u,WM);if(!d)return null;var f=function(A,y){return{x:A.x,y:A.y,value:A.value,errorVal:Bu(A.payload,y)}},p={clipPath:o?"url(#clipPath-".concat(r,")"):null};return be.createElement(Gl,p,d.map(function(g){return be.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:a,xAxis:l,yAxis:s,layout:c,dataPointFormatter:f})}))}},{key:"renderDots",value:function(o,r,i){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var l=this.props,s=l.dot,c=l.points,u=l.dataKey,d=ia(this.props,!1),f=ia(s,!0),p=c.map(function(A,y){var S=K1(K1(K1({key:"dot-".concat(y),r:3},d),f),{},{value:A.value,dataKey:u,cx:A.x,cy:A.y,index:y,payload:A.payload});return e.renderDotItem(s,S)}),g={clipPath:o?"url(#clipPath-".concat(r?"":"dots-").concat(i,")"):null};return be.createElement(Gl,eF({className:"recharts-line-dots",key:"dots"},g),p)}},{key:"renderCurveStatically",value:function(o,r,i,a){var l=this.props,s=l.type,c=l.layout,u=l.connectNulls;l.ref;var d=BEo(l,jEo),f=K1(K1(K1({},ia(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:r?"url(#clipPath-".concat(i,")"):null,points:o},a),{},{type:s,layout:c,connectNulls:u});return be.createElement(Lx,eF({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(o,r){var i=this,a=this.props,l=a.points,s=a.strokeDasharray,c=a.isAnimationActive,u=a.animationBegin,d=a.animationDuration,f=a.animationEasing,p=a.animationId,g=a.animateNewValues,A=a.width,y=a.height,S=this.state,C=S.prevPoints,P=S.totalLength;return be.createElement(J2,{begin:u,duration:d,isActive:c,easing:f,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(v){var T=v.t;if(C){var w=C.length/l.length,x=l.map(function(E,N){var U=Math.floor(N*w);if(C[U]){var W=C[U],k=W0(W.x,E.x),D=W0(W.y,E.y);return K1(K1({},E),{},{x:k(T),y:D(T)})}if(g){var L=W0(A*2,E.x),j=W0(y/2,E.y);return K1(K1({},E),{},{x:L(T),y:j(T)})}return K1(K1({},E),{},{x:E.x,y:E.y})});return i.renderCurveStatically(x,o,r)}var b=W0(0,P),R=b(T),H;if(s){var F="".concat(s).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});H=i.getStrokeDasharray(R,P,F)}else H=i.generateSimpleStrokeDasharray(P,R);return i.renderCurveStatically(l,o,r,{strokeDasharray:H})})}},{key:"renderCurve",value:function(o,r){var i=this.props,a=i.points,l=i.isAnimationActive,s=this.state,c=s.prevPoints,u=s.totalLength;return l&&a&&a.length&&(!c&&u>0||!yb(c,a))?this.renderCurveWithAnimation(o,r):this.renderCurveStatically(a,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.xAxis,u=r.yAxis,d=r.top,f=r.left,p=r.width,g=r.height,A=r.isAnimationActive,y=r.id;if(i||!l||!l.length)return null;var S=this.state.isAnimationFinished,C=l.length===1,P=fl("recharts-line",s),v=c&&c.allowDataOverflow,T=u&&u.allowDataOverflow,w=v||T,x=aa(y)?this.id:y,b=(o=ia(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=b.r,H=R===void 0?3:R,F=b.strokeWidth,E=F===void 0?2:F,N=jat(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,k=H*2+E;return be.createElement(Gl,{className:P},v||T?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(x)},be.createElement("rect",{x:v?f:f-p/2,y:T?d:d-g/2,width:v?p:p*2,height:T?g:g*2})),!W&&be.createElement("clipPath",{id:"clipPath-dots-".concat(x)},be.createElement("rect",{x:f-k/2,y:d-k/2,width:p+k,height:g+k}))):null,!C&&this.renderCurve(w,x),this.renderErrorBar(w,x),(C||a)&&this.renderDots(w,W,x),(!A||S)&&k9.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,prevPoints:r.curPoints}:o.points!==r.curPoints?{curPoints:o.points}:null}},{key:"repeat",value:function(o,r){for(var i=o.length%2!==0?[].concat(iP(o),[0]):o,a=[],l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function tFo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function ax(){return ax=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!yb(u,a)||!yb(d,l))?this.renderAreaWithAnimation(o,r):this.renderAreaStatically(a,l,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.top,u=r.left,d=r.xAxis,f=r.yAxis,p=r.width,g=r.height,A=r.isAnimationActive,y=r.id;if(i||!l||!l.length)return null;var S=this.state.isAnimationFinished,C=l.length===1,P=fl("recharts-area",s),v=d&&d.allowDataOverflow,T=f&&f.allowDataOverflow,w=v||T,x=aa(y)?this.id:y,b=(o=ia(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=b.r,H=R===void 0?3:R,F=b.strokeWidth,E=F===void 0?2:F,N=jat(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,k=H*2+E;return be.createElement(Gl,{className:P},v||T?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(x)},be.createElement("rect",{x:v?u:u-p/2,y:T?c:c-g/2,width:v?p:p*2,height:T?g:g*2})),!W&&be.createElement("clipPath",{id:"clipPath-dots-".concat(x)},be.createElement("rect",{x:u-k/2,y:c-k/2,width:p+k,height:g+k}))):null,C?null:this.renderArea(w,x),(a||C)&&this.renderDots(w,W,x),(!A||S)&&k9.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,curBaseLine:o.baseLine,prevPoints:r.curPoints,prevBaseLine:r.curBaseLine}:o.points!==r.curPoints||o.baseLine!==r.curBaseLine?{curPoints:o.points,curBaseLine:o.baseLine}:null}}]),e}(m.PureComponent);cct=MA;v9(MA,"displayName","Area");v9(MA,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!j2.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});v9(MA,"getBaseValue",function(t,e,n,o){var r=t.layout,i=t.baseValue,a=e.props.baseValue,l=a??i;if(dr(l)&&typeof l=="number")return l;var s=r==="horizontal"?o:n,c=s.scale.domain();if(s.type==="number"){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return l==="dataMin"?d:l==="dataMax"||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return l==="dataMin"?c[0]:l==="dataMax"?c[1]:c[0]});v9(MA,"getComposedData",function(t){var e=t.props,n=t.item,o=t.xAxis,r=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,l=t.bandSize,s=t.dataKey,c=t.stackedData,u=t.dataStartIndex,d=t.displayedData,f=t.offset,p=e.layout,g=c&&c.length,A=cct.getBaseValue(e,n,o,r),y=p==="horizontal",S=!1,C=d.map(function(v,T){var w;g?w=c[u+T]:(w=Bu(v,s),Array.isArray(w)?S=!0:w=[A,w]);var x=w[1]==null||g&&Bu(v,s)==null;return y?{x:dH({axis:o,ticks:i,bandSize:l,entry:v,index:T}),y:x?null:r.scale(w[1]),value:w,payload:v}:{x:x?null:o.scale(w[1]),y:dH({axis:r,ticks:a,bandSize:l,entry:v,index:T}),value:w,payload:v}}),P;return g||S?P=C.map(function(v){var T=Array.isArray(v.value)?v.value[0]:null;return y?{x:v.x,y:T!=null&&v.y!=null?r.scale(T):null}:{x:T!=null?o.scale(T):null,y:v.y}}):P=y?r.scale(A):o.scale(A),V4({points:C,baseLine:P,layout:p,isRange:S},f)});v9(MA,"renderDotItem",function(t,e){var n;if(be.isValidElement(t))n=be.cloneElement(t,e);else if(xa(t))n=t(e);else{var o=fl("recharts-area-dot",typeof t!="boolean"?t.className:"");n=be.createElement(mU,ax({},e,{className:o}))}return n});var vU=function(){return null};vU.displayName="ZAxis";vU.defaultProps={zAxisId:0,range:[64,64],scale:"auto",type:"number"};var sFo=["option","isActive"];function tF(){return tF=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function uFo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function dFo(t){var e=t.option,n=t.isActive,o=cFo(t,sFo);return typeof e=="string"?be.createElement(Jhe,tF({option:be.createElement(Zee,tF({type:e},o)),isActive:n,shapeType:"symbols"},o)):be.createElement(Jhe,tF({option:e,isActive:n,shapeType:"symbols"},o))}function wH(t){"@babel/helpers - typeof";return wH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wH(t)}function nF(){return nF=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);nt*r)return!1;var i=n();return t*(e-t*i/2-o)>=0&&t*(e+t*i/2-r)<=0}function cEo(t,e){return oct(t,e+1)}function uEo(t,e,n,o,r){for(var i=(o||[]).slice(),a=e.start,l=e.end,s=0,c=1,u=a,d=function(){var g=o==null?void 0:o[s];if(g===void 0)return{v:oct(o,c)};var A=s,y,S=function(){return y===void 0&&(y=n(g,A)),y},C=g.coordinate,P=s===0||wK(t,C,S,u,l);P||(s=0,u=a,c+=1),P&&(u=C+t*(S()/2+r),s+=c)},f;c<=i.length;)if(f=d(),f)return f.v;return[]}function BL(t){"@babel/helpers - typeof";return BL=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},BL(t)}function mFe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Qf(t){for(var e=1;e0?p.coordinate-y*t:p.coordinate})}else i[f]=p=Qf(Qf({},p),{},{tickCoord:p.coordinate});var S=wK(t,p.tickCoord,A,l,s);S&&(s=p.tickCoord-t*(A()/2+r),i[f]=Qf(Qf({},p),{},{isShow:!0}))},u=a-1;u>=0;u--)c(u);return i}function gEo(t,e,n,o,r,i){var a=(o||[]).slice(),l=a.length,s=e.start,c=e.end;if(i){var u=o[l-1],d=n(u,l-1),f=t*(u.coordinate+t*d/2-c);a[l-1]=u=Qf(Qf({},u),{},{tickCoord:f>0?u.coordinate-f*t:u.coordinate});var p=wK(t,u.tickCoord,function(){return d},s,c);p&&(c=u.tickCoord-t*(d/2+r),a[l-1]=Qf(Qf({},u),{},{isShow:!0}))}for(var g=i?l-1:l,A=function(C){var P=a[C],v,T=function(){return v===void 0&&(v=n(P,C)),v};if(C===0){var w=t*(P.coordinate-t*T()/2-s);a[C]=P=Qf(Qf({},P),{},{tickCoord:w<0?P.coordinate-w*t:P.coordinate})}else a[C]=P=Qf(Qf({},P),{},{tickCoord:P.coordinate});var x=wK(t,P.tickCoord,T,s,c);x&&(s=P.tickCoord+t*(T()/2+r),a[C]=Qf(Qf({},P),{},{isShow:!0}))},y=0;y=2?R2(r[1].coordinate-r[0].coordinate):1,S=sEo(i,y,p);return s==="equidistantPreserveStart"?uEo(y,S,A,r,a):(s==="preserveStart"||s==="preserveStartEnd"?f=gEo(y,S,A,r,a,s==="preserveStartEnd"):f=pEo(y,S,A,r,a),f.filter(function(C){return C.isShow}))}var mEo=["viewBox"],yEo=["viewBox"],AEo=["ticks"];function mH(t){"@babel/helpers - typeof";return mH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mH(t)}function mC(){return mC=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function wEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function vEo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AFe(t,e){for(var n=0;n0?s(this.props):s(p)),a<=0||l<=0||!g||!g.length?null:be.createElement(Gl,{className:fl("recharts-cartesian-axis",c),ref:function(y){o.layerReference=y}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),is.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(o,r,i){var a;return be.isValidElement(o)?a=be.cloneElement(o,r):xa(o)?a=o(r):a=be.createElement(XJ,mC({},r,{className:"recharts-cartesian-axis-tick-value"}),i),a}}]),e}(m.Component);h6e(UM,"displayName","CartesianAxis");h6e(UM,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var REo=["x1","y1","x2","y2","key"],HEo=["offset"];function vb(t){"@babel/helpers - typeof";return vb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vb(t)}function wFe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function uh(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function DEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}var EEo=function(e){var n=e.fill;if(!n||n==="none")return null;var o=e.fillOpacity,r=e.x,i=e.y,a=e.width,l=e.height;return be.createElement("rect",{x:r,y:i,width:a,height:l,stroke:"none",fill:n,fillOpacity:o,className:"recharts-cartesian-grid-bg"})};function act(t,e){var n;if(be.isValidElement(t))n=be.cloneElement(t,e);else if(xa(t))n=t(e);else{var o=e.x1,r=e.y1,i=e.x2,a=e.y2,l=e.key,s=vFe(e,REo),c=ia(s,!1);c.offset;var u=vFe(c,HEo);n=be.createElement("line",ix({},u,{x1:o,y1:r,x2:i,y2:a,fill:"none",key:l}))}return n}function FEo(t){var e=t.x,n=t.width,o=t.horizontal,r=o===void 0?!0:o,i=t.horizontalPoints;if(!r||!i||!i.length)return null;var a=i.map(function(l,s){var c=uh(uh({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(s),index:s});return act(r,c)});return be.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function kEo(t){var e=t.y,n=t.height,o=t.vertical,r=o===void 0?!0:o,i=t.verticalPoints;if(!r||!i||!i.length)return null;var a=i.map(function(l,s){var c=uh(uh({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(s),index:s});return act(r,c)});return be.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function LEo(t){var e=t.horizontalFill,n=t.fillOpacity,o=t.x,r=t.y,i=t.width,a=t.height,l=t.horizontalPoints,s=t.horizontal,c=s===void 0?!0:s;if(!c||!e||!e.length)return null;var u=l.map(function(f){return Math.round(f+r-r)}).sort(function(f,p){return f-p});r!==u[0]&&u.unshift(0);var d=u.map(function(f,p){var g=!u[p+1],A=g?r+a-f:u[p+1]-f;if(A<=0)return null;var y=p%e.length;return be.createElement("rect",{key:"react-".concat(p),y:f,x:o,height:A,width:i,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function WEo(t){var e=t.vertical,n=e===void 0?!0:e,o=t.verticalFill,r=t.fillOpacity,i=t.x,a=t.y,l=t.width,s=t.height,c=t.verticalPoints;if(!n||!o||!o.length)return null;var u=c.map(function(f){return Math.round(f+i-i)}).sort(function(f,p){return f-p});i!==u[0]&&u.unshift(0);var d=u.map(function(f,p){var g=!u[p+1],A=g?i+l-f:u[p+1]-f;if(A<=0)return null;var y=p%o.length;return be.createElement("rect",{key:"react-".concat(p),x:f,y:a,width:A,height:s,stroke:"none",fill:o[y],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var NEo=function(e,n){var o=e.xAxis,r=e.width,i=e.height,a=e.offset;return Pst(f6e(uh(uh(uh({},UM.defaultProps),o),{},{ticks:z6(o,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,n)},UEo=function(e,n){var o=e.yAxis,r=e.width,i=e.height,a=e.offset;return Pst(f6e(uh(uh(uh({},UM.defaultProps),o),{},{ticks:z6(o,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,n)},rP={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Cw(t){var e,n,o,r,i,a,l=u6e(),s=d6e(),c=YDo(),u=uh(uh({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:rP.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:rP.fill,horizontal:(o=t.horizontal)!==null&&o!==void 0?o:rP.horizontal,horizontalFill:(r=t.horizontalFill)!==null&&r!==void 0?r:rP.horizontalFill,vertical:(i=t.vertical)!==null&&i!==void 0?i:rP.vertical,verticalFill:(a=t.verticalFill)!==null&&a!==void 0?a:rP.verticalFill,x:dr(t.x)?t.x:c.left,y:dr(t.y)?t.y:c.top,width:dr(t.width)?t.width:c.width,height:dr(t.height)?t.height:c.height}),d=u.x,f=u.y,p=u.width,g=u.height,A=u.syncWithTicks,y=u.horizontalValues,S=u.verticalValues,C=UDo(),P=jDo();if(!dr(p)||p<=0||!dr(g)||g<=0||!dr(d)||d!==+d||!dr(f)||f!==+f)return null;var v=u.verticalCoordinatesGenerator||NEo,T=u.horizontalCoordinatesGenerator||UEo,w=u.horizontalPoints,x=u.verticalPoints;if((!w||!w.length)&&xa(T)){var b=y&&y.length,R=T({yAxis:P?uh(uh({},P),{},{ticks:b?y:P.ticks}):void 0,width:l,height:s,offset:c},b?!0:A);O6(Array.isArray(R),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(vb(R),"]")),Array.isArray(R)&&(w=R)}if((!x||!x.length)&&xa(v)){var H=S&&S.length,F=v({xAxis:C?uh(uh({},C),{},{ticks:H?S:C.ticks}):void 0,width:l,height:s,offset:c},H?!0:A);O6(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(vb(F),"]")),Array.isArray(F)&&(x=F)}return be.createElement("g",{className:"recharts-cartesian-grid"},be.createElement(EEo,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height}),be.createElement(FEo,ix({},u,{offset:c,horizontalPoints:w,xAxis:C,yAxis:P})),be.createElement(kEo,ix({},u,{offset:c,verticalPoints:x,xAxis:C,yAxis:P})),be.createElement(LEo,ix({},u,{horizontalPoints:w})),be.createElement(WEo,ix({},u,{verticalPoints:x})))}Cw.displayName="CartesianGrid";var jEo=["type","layout","connectNulls","ref"];function yH(t){"@babel/helpers - typeof";return yH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yH(t)}function BEo(t,e){if(t==null)return{};var n=YEo(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function YEo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function eF(){return eF=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);nd){p=[].concat(iP(s.slice(0,g)),[d-A]);break}var y=p.length%2===0?[0,f]:[f];return[].concat(iP(e.repeat(s,u)),iP(p),y).map(function(S){return"".concat(S,"px")}).join(", ")}),p2(O4(n),"id",gS("recharts-line-")),p2(O4(n),"pathRef",function(a){n.mainCurve=a}),p2(O4(n),"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),p2(O4(n),"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return JEo(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();this.setState({totalLength:o})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var o=this.getTotalLength();o!==this.state.totalLength&&this.setState({totalLength:o})}}},{key:"getTotalLength",value:function(){var o=this.mainCurve;try{return o&&o.getTotalLength&&o.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(o,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.points,l=i.xAxis,s=i.yAxis,c=i.layout,u=i.children,d=e1(u,WM);if(!d)return null;var f=function(A,y){return{x:A.x,y:A.y,value:A.value,errorVal:Bu(A.payload,y)}},p={clipPath:o?"url(#clipPath-".concat(r,")"):null};return be.createElement(Gl,p,d.map(function(g){return be.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:a,xAxis:l,yAxis:s,layout:c,dataPointFormatter:f})}))}},{key:"renderDots",value:function(o,r,i){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var l=this.props,s=l.dot,c=l.points,u=l.dataKey,d=ia(this.props,!1),f=ia(s,!0),p=c.map(function(A,y){var S=K1(K1(K1({key:"dot-".concat(y),r:3},d),f),{},{value:A.value,dataKey:u,cx:A.x,cy:A.y,index:y,payload:A.payload});return e.renderDotItem(s,S)}),g={clipPath:o?"url(#clipPath-".concat(r?"":"dots-").concat(i,")"):null};return be.createElement(Gl,eF({className:"recharts-line-dots",key:"dots"},g),p)}},{key:"renderCurveStatically",value:function(o,r,i,a){var l=this.props,s=l.type,c=l.layout,u=l.connectNulls;l.ref;var d=BEo(l,jEo),f=K1(K1(K1({},ia(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:r?"url(#clipPath-".concat(i,")"):null,points:o},a),{},{type:s,layout:c,connectNulls:u});return be.createElement(Lx,eF({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(o,r){var i=this,a=this.props,l=a.points,s=a.strokeDasharray,c=a.isAnimationActive,u=a.animationBegin,d=a.animationDuration,f=a.animationEasing,p=a.animationId,g=a.animateNewValues,A=a.width,y=a.height,S=this.state,C=S.prevPoints,P=S.totalLength;return be.createElement(J2,{begin:u,duration:d,isActive:c,easing:f,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(v){var T=v.t;if(C){var w=C.length/l.length,x=l.map(function(E,N){var U=Math.floor(N*w);if(C[U]){var W=C[U],k=W0(W.x,E.x),D=W0(W.y,E.y);return K1(K1({},E),{},{x:k(T),y:D(T)})}if(g){var L=W0(A*2,E.x),j=W0(y/2,E.y);return K1(K1({},E),{},{x:L(T),y:j(T)})}return K1(K1({},E),{},{x:E.x,y:E.y})});return i.renderCurveStatically(x,o,r)}var b=W0(0,P),R=b(T),H;if(s){var F="".concat(s).split(/[,\s]+/gim).map(function(E){return parseFloat(E)});H=i.getStrokeDasharray(R,P,F)}else H=i.generateSimpleStrokeDasharray(P,R);return i.renderCurveStatically(l,o,r,{strokeDasharray:H})})}},{key:"renderCurve",value:function(o,r){var i=this.props,a=i.points,l=i.isAnimationActive,s=this.state,c=s.prevPoints,u=s.totalLength;return l&&a&&a.length&&(!c&&u>0||!yb(c,a))?this.renderCurveWithAnimation(o,r):this.renderCurveStatically(a,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.xAxis,u=r.yAxis,d=r.top,f=r.left,p=r.width,g=r.height,A=r.isAnimationActive,y=r.id;if(i||!l||!l.length)return null;var S=this.state.isAnimationFinished,C=l.length===1,P=fl("recharts-line",s),v=c&&c.allowDataOverflow,T=u&&u.allowDataOverflow,w=v||T,x=aa(y)?this.id:y,b=(o=ia(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=b.r,H=R===void 0?3:R,F=b.strokeWidth,E=F===void 0?2:F,N=jat(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,k=H*2+E;return be.createElement(Gl,{className:P},v||T?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(x)},be.createElement("rect",{x:v?f:f-p/2,y:T?d:d-g/2,width:v?p:p*2,height:T?g:g*2})),!W&&be.createElement("clipPath",{id:"clipPath-dots-".concat(x)},be.createElement("rect",{x:f-k/2,y:d-k/2,width:p+k,height:g+k}))):null,!C&&this.renderCurve(w,x),this.renderErrorBar(w,x),(C||a)&&this.renderDots(w,W,x),(!A||S)&&k9.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,prevPoints:r.curPoints}:o.points!==r.curPoints?{curPoints:o.points}:null}},{key:"repeat",value:function(o,r){for(var i=o.length%2!==0?[].concat(iP(o),[0]):o,a=[],l=0;l=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function tFo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function ax(){return ax=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!yb(u,a)||!yb(d,l))?this.renderAreaWithAnimation(o,r):this.renderAreaStatically(a,l,o,r)}},{key:"render",value:function(){var o,r=this.props,i=r.hide,a=r.dot,l=r.points,s=r.className,c=r.top,u=r.left,d=r.xAxis,f=r.yAxis,p=r.width,g=r.height,A=r.isAnimationActive,y=r.id;if(i||!l||!l.length)return null;var S=this.state.isAnimationFinished,C=l.length===1,P=fl("recharts-area",s),v=d&&d.allowDataOverflow,T=f&&f.allowDataOverflow,w=v||T,x=aa(y)?this.id:y,b=(o=ia(a,!1))!==null&&o!==void 0?o:{r:3,strokeWidth:2},R=b.r,H=R===void 0?3:R,F=b.strokeWidth,E=F===void 0?2:F,N=jat(a)?a:{},U=N.clipDot,W=U===void 0?!0:U,k=H*2+E;return be.createElement(Gl,{className:P},v||T?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(x)},be.createElement("rect",{x:v?u:u-p/2,y:T?c:c-g/2,width:v?p:p*2,height:T?g:g*2})),!W&&be.createElement("clipPath",{id:"clipPath-dots-".concat(x)},be.createElement("rect",{x:u-k/2,y:c-k/2,width:p+k,height:g+k}))):null,C?null:this.renderArea(w,x),(a||C)&&this.renderDots(w,W,x),(!A||S)&&k9.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(o,r){return o.animationId!==r.prevAnimationId?{prevAnimationId:o.animationId,curPoints:o.points,curBaseLine:o.baseLine,prevPoints:r.curPoints,prevBaseLine:r.curBaseLine}:o.points!==r.curPoints||o.baseLine!==r.curBaseLine?{curPoints:o.points,curBaseLine:o.baseLine}:null}}]),e}(m.PureComponent);cct=MA;v9(MA,"displayName","Area");v9(MA,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!j2.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});v9(MA,"getBaseValue",function(t,e,n,o){var r=t.layout,i=t.baseValue,a=e.props.baseValue,l=a??i;if(dr(l)&&typeof l=="number")return l;var s=r==="horizontal"?o:n,c=s.scale.domain();if(s.type==="number"){var u=Math.max(c[0],c[1]),d=Math.min(c[0],c[1]);return l==="dataMin"?d:l==="dataMax"||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return l==="dataMin"?c[0]:l==="dataMax"?c[1]:c[0]});v9(MA,"getComposedData",function(t){var e=t.props,n=t.item,o=t.xAxis,r=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,l=t.bandSize,s=t.dataKey,c=t.stackedData,u=t.dataStartIndex,d=t.displayedData,f=t.offset,p=e.layout,g=c&&c.length,A=cct.getBaseValue(e,n,o,r),y=p==="horizontal",S=!1,C=d.map(function(v,T){var w;g?w=c[u+T]:(w=Bu(v,s),Array.isArray(w)?S=!0:w=[A,w]);var x=w[1]==null||g&&Bu(v,s)==null;return y?{x:dH({axis:o,ticks:i,bandSize:l,entry:v,index:T}),y:x?null:r.scale(w[1]),value:w,payload:v}:{x:x?null:o.scale(w[1]),y:dH({axis:r,ticks:a,bandSize:l,entry:v,index:T}),value:w,payload:v}}),P;return g||S?P=C.map(function(v){var T=Array.isArray(v.value)?v.value[0]:null;return y?{x:v.x,y:T!=null&&v.y!=null?r.scale(T):null}:{x:T!=null?o.scale(T):null,y:v.y}}):P=y?r.scale(A):o.scale(A),V4({points:C,baseLine:P,layout:p,isRange:S},f)});v9(MA,"renderDotItem",function(t,e){var n;if(be.isValidElement(t))n=be.cloneElement(t,e);else if(xa(t))n=t(e);else{var o=fl("recharts-area-dot",typeof t!="boolean"?t.className:"");n=be.createElement(mU,ax({},e,{className:o}))}return n});var vU=function(){return null};vU.displayName="ZAxis";vU.defaultProps={zAxisId:0,range:[64,64],scale:"auto",type:"number"};var sFo=["option","isActive"];function tF(){return tF=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function uFo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function dFo(t){var e=t.option,n=t.isActive,o=cFo(t,sFo);return typeof e=="string"?be.createElement(Jhe,tF({option:be.createElement(Zee,tF({type:e},o)),isActive:n,shapeType:"symbols"},o)):be.createElement(Jhe,tF({option:e,isActive:n,shapeType:"symbols"},o))}function wH(t){"@babel/helpers - typeof";return wH=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wH(t)}function nF(){return nF=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,o=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function BFo(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i=0)&&(n[r]=t[r]);return n}function YFo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OFo(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,o=new Array(e);n0?a:e&&e.length&&dr(r)&&dr(i)?e.slice(r,i+1):[]};function xct(t){return t==="number"?[0,"auto"]:void 0}var fpe=function(e,n,o,r){var i=e.graphicalItems,a=e.tooltipAxis,l=gte(n,e);return o<0||!i||!i.length||o>=l.length?null:i.reduce(function(s,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:n;d&&e.dataStartIndex+e.dataEndIndex!==0&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var p=d===void 0?l:d;f=kJ(p,a.dataKey,r)}else f=d&&d[o]||l[o];return f?[].concat(xH(s),[Rst(c,f)]):s},[])},DFe=function(e,n,o,r){var i=r||{x:e.chartX,y:e.chartY},a=eko(i,o),l=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,u=hRo(a,l,c,s);if(u>=0&&c){var d=c[u]&&c[u].value,f=fpe(e,n,u,d),p=tko(o,l,u,i);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:p}}return null},nko=function(e,n){var o=n.axes,r=n.graphicalItems,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,p=Tst(u,i);return o.reduce(function(g,A){var y,S=A.props,C=S.type,P=S.dataKey,v=S.allowDataOverflow,T=S.allowDuplicatedCategory,w=S.scale,x=S.ticks,b=S.includeHidden,R=A.props[a];if(g[R])return g;var H=gte(e.data,{graphicalItems:r.filter(function(V){return V.props[a]===R}),dataStartIndex:s,dataEndIndex:c}),F=H.length,E,N,U;MFo(A.props.domain,v,C)&&(E=Dhe(A.props.domain,null,v),p&&(C==="number"||w!=="auto")&&(U=QE(H,P,"category")));var W=xct(C);if(!E||E.length===0){var k,D=(k=A.props.domain)!==null&&k!==void 0?k:W;if(P){if(E=QE(H,P,C),C==="category"&&p){var L=R8o(E);T&&L?(N=E,E=pK(0,F)):T||(E=sEe(D,E,A).reduce(function(V,G){return V.indexOf(G)>=0?V:[].concat(xH(V),[G])},[]))}else if(C==="category")T?E=E.filter(function(V){return V!==""&&!aa(V)}):E=sEe(D,E,A).reduce(function(V,G){return V.indexOf(G)>=0||G===""||aa(G)?V:[].concat(xH(V),[G])},[]);else if(C==="number"){var j=ARo(H,r.filter(function(V){return V.props[a]===R&&(b||!V.props.hide)}),P,i,u);j&&(E=j)}p&&(C==="number"||w!=="auto")&&(U=QE(H,P,"category"))}else p?E=pK(0,F):l&&l[R]&&l[R].hasStack&&C==="number"?E=f==="expand"?[0,1]:Cst(l[R].stackGroups,s,c):E=Sst(H,r.filter(function(V){return V.props[a]===R&&(b||!V.props.hide)}),C,u,!0);if(C==="number")E=cpe(d,E,R,i,x),D&&(E=Dhe(D,E,v));else if(C==="category"&&D){var B=D,O=E.every(function(V){return B.indexOf(V)>=0});O&&(E=B)}}return Co(Co({},g),{},Ni({},R,Co(Co({},A.props),{},{axisType:i,domain:E,categoricalDomain:U,duplicateDomain:N,originalDomain:(y=A.props.domain)!==null&&y!==void 0?y:W,isCategorical:p,layout:u})))},{})},oko=function(e,n){var o=n.graphicalItems,r=n.Axis,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=gte(e.data,{graphicalItems:o,dataStartIndex:s,dataEndIndex:c}),p=f.length,g=Tst(u,i),A=-1;return o.reduce(function(y,S){var C=S.props[a],P=xct("number");if(!y[C]){A++;var v;return g?v=pK(0,p):l&&l[C]&&l[C].hasStack?(v=Cst(l[C].stackGroups,s,c),v=cpe(d,v,C,i)):(v=Dhe(P,Sst(f,o.filter(function(T){return T.props[a]===C&&!T.props.hide}),"number",u),r.defaultProps.allowDataOverflow),v=cpe(d,v,C,i)),Co(Co({},y),{},Ni({},C,Co(Co({axisType:i},r.defaultProps),{},{hide:!0,orientation:Xm(QFo,"".concat(i,".").concat(A%2),null),domain:v,originalDomain:P,isCategorical:g,layout:u})))}return y},{})},rko=function(e,n){var o=n.axisType,r=o===void 0?"xAxis":o,i=n.AxisComp,a=n.graphicalItems,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.children,d="".concat(r,"Id"),f=e1(u,i),p={};return f&&f.length?p=nko(e,{axes:f,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(p=oko(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c})),p},iko=function(e){var n=d8(e),o=z6(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:E3e(o,function(r){return r.coordinate}),tooltipAxis:n,tooltipAxisBandSize:iK(n,o)}},EFe=function(e){var n=e.children,o=e.defaultShowTooltip,r=tg(n,pH),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!o}},ako=function(e){return!e||!e.length?!1:e.some(function(n){var o=Y6(n&&n.type);return o&&o.indexOf("Bar")>=0})},FFe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},lko=function(e,n){var o=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,l=e.yAxisMap,s=l===void 0?{}:l,c=o.width,u=o.height,d=o.children,f=o.margin||{},p=tg(d,pH),g=tg(d,X2),A=Object.keys(s).reduce(function(T,w){var x=s[w],b=x.orientation;return!x.mirror&&!x.hide?Co(Co({},T),{},Ni({},b,T[b]+x.width)):T},{left:f.left||0,right:f.right||0}),y=Object.keys(a).reduce(function(T,w){var x=a[w],b=x.orientation;return!x.mirror&&!x.hide?Co(Co({},T),{},Ni({},b,Xm(T,"".concat(b))+x.height)):T},{top:f.top||0,bottom:f.bottom||0}),S=Co(Co({},y),A),C=S.bottom;p&&(S.bottom+=p.props.height||pH.defaultProps.height),g&&n&&(S=mRo(S,r,o,n));var P=c-S.left-S.right,v=u-S.top-S.bottom;return Co(Co({brushBottom:C},S),{},{width:Math.max(P,0),height:Math.max(v,0)})},sko=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},xU=function(e){var n,o=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,l=e.validateTooltipEventTypes,s=l===void 0?["axis"]:l,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,p=function(y,S){var C=S.graphicalItems,P=S.stackGroups,v=S.offset,T=S.updateId,w=S.dataStartIndex,x=S.dataEndIndex,b=y.barSize,R=y.layout,H=y.barGap,F=y.barCategoryGap,E=y.maxBarSize,N=FFe(R),U=N.numericAxisName,W=N.cateAxisName,k=ako(C),D=[];return C.forEach(function(L,j){var B=gte(y.data,{graphicalItems:[L],dataStartIndex:w,dataEndIndex:x}),O=L.props,V=O.dataKey,G=O.maxBarSize,q=L.props["".concat(U,"Id")],$=L.props["".concat(W,"Id")],ie={},Q=c.reduce(function(Se,Re){var De=S["".concat(Re.axisType,"Map")],Ae=L.props["".concat(Re.axisType,"Id")];De&&De[Ae]||Re.axisType==="zAxis"||wb();var ue=De[Ae];return Co(Co({},Se),{},Ni(Ni({},Re.axisType,ue),"".concat(Re.axisType,"Ticks"),z6(ue)))},ie),se=Q[W],Z=Q["".concat(W,"Ticks")],ee=P&&P[q]&&P[q].hasStack&&IRo(L,P[q].stackGroups),te=Y6(L.type).indexOf("Bar")>=0,oe=iK(se,Z),de=[],he=k&&pRo({barSize:b,stackGroups:P,totalSize:sko(Q,W)});if(te){var pe,me,le=aa(G)?E:G,Te=(pe=(me=iK(se,Z,!0))!==null&&me!==void 0?me:le)!==null&&pe!==void 0?pe:0;de=gRo({barGap:H,barCategoryGap:F,bandSize:Te!==oe?Te:oe,sizeList:he[$],maxBarSize:le}),Te!==oe&&(de=de.map(function(Se){return Co(Co({},Se),{},{position:Co(Co({},Se.position),{},{offset:Se.position.offset-Te/2})})}))}var ge=L&&L.type&&L.type.getComposedData;ge&&D.push({props:Co(Co({},ge(Co(Co({},Q),{},{displayedData:B,props:y,dataKey:V,item:L,bandSize:oe,barPosition:de,offset:v,stackedData:ee,layout:R,dataStartIndex:w,dataEndIndex:x}))),{},Ni(Ni(Ni({key:L.key||"item-".concat(j)},U,Q[U]),W,Q[W]),"animationId",T)),childIndex:U8o(L,y.children),item:L})}),D},g=function(y,S){var C=y.props,P=y.dataStartIndex,v=y.dataEndIndex,T=y.updateId;if(!bze({props:C}))return null;var w=C.children,x=C.layout,b=C.stackOffset,R=C.data,H=C.reverseStackOrder,F=FFe(x),E=F.numericAxisName,N=F.cateAxisName,U=e1(w,r),W=RRo(R,U,"".concat(E,"Id"),"".concat(N,"Id"),b,H),k=c.reduce(function(O,V){var G="".concat(V.axisType,"Map");return Co(Co({},O),{},Ni({},G,rko(C,Co(Co({},V),{},{graphicalItems:U,stackGroups:V.axisType===E&&W,dataStartIndex:P,dataEndIndex:v}))))},{}),D=lko(Co(Co({},k),{},{props:C,graphicalItems:U}),S==null?void 0:S.legendBBox);Object.keys(k).forEach(function(O){k[O]=d(C,k[O],D,O.replace("Map",""),o)});var L=k["".concat(N,"Map")],j=iko(L),B=p(C,Co(Co({},k),{},{dataStartIndex:P,dataEndIndex:v,updateId:T,graphicalItems:U,stackGroups:W,offset:D}));return Co(Co({formattedGraphicalItems:B,graphicalItems:U,offset:D,stackGroups:W},j),k)};return n=function(A){XFo(y,A);function y(S){var C,P,v;return YFo(this,y),v=_Fo(this,y,[S]),Ni(Tl(v),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ni(Tl(v),"accessibilityManager",new HFo),Ni(Tl(v),"handleLegendBBoxUpdate",function(T){if(T){var w=v.state,x=w.dataStartIndex,b=w.dataEndIndex,R=w.updateId;v.setState(Co({legendBBox:T},g({props:v.props,dataStartIndex:x,dataEndIndex:b,updateId:R},Co(Co({},v.state),{},{legendBBox:T}))))}}),Ni(Tl(v),"handleReceiveSyncEvent",function(T,w,x){if(v.props.syncId===T){if(x===v.eventEmitterSymbol&&typeof v.props.syncMethod!="function")return;v.applySyncEvent(w)}}),Ni(Tl(v),"handleBrushChange",function(T){var w=T.startIndex,x=T.endIndex;if(w!==v.state.dataStartIndex||x!==v.state.dataEndIndex){var b=v.state.updateId;v.setState(function(){return Co({dataStartIndex:w,dataEndIndex:x},g({props:v.props,dataStartIndex:w,dataEndIndex:x,updateId:b},v.state))}),v.triggerSyncEvent({dataStartIndex:w,dataEndIndex:x})}}),Ni(Tl(v),"handleMouseEnter",function(T){var w=v.getMouseInfo(T);if(w){var x=Co(Co({},w),{},{isTooltipActive:!0});v.setState(x),v.triggerSyncEvent(x);var b=v.props.onMouseEnter;xa(b)&&b(x,T)}}),Ni(Tl(v),"triggeredAfterMouseMove",function(T){var w=v.getMouseInfo(T),x=w?Co(Co({},w),{},{isTooltipActive:!0}):{isTooltipActive:!1};v.setState(x),v.triggerSyncEvent(x);var b=v.props.onMouseMove;xa(b)&&b(x,T)}),Ni(Tl(v),"handleItemMouseEnter",function(T){v.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),Ni(Tl(v),"handleItemMouseLeave",function(){v.setState(function(){return{isTooltipActive:!1}})}),Ni(Tl(v),"handleMouseMove",function(T){T.persist(),v.throttleTriggeredAfterMouseMove(T)}),Ni(Tl(v),"handleMouseLeave",function(T){v.throttleTriggeredAfterMouseMove.cancel();var w={isTooltipActive:!1};v.setState(w),v.triggerSyncEvent(w);var x=v.props.onMouseLeave;xa(x)&&x(w,T)}),Ni(Tl(v),"handleOuterEvent",function(T){var w=N8o(T),x=Xm(v.props,"".concat(w));if(w&&xa(x)){var b,R;/.*touch.*/i.test(w)?R=v.getMouseInfo(T.changedTouches[0]):R=v.getMouseInfo(T),x((b=R)!==null&&b!==void 0?b:{},T)}}),Ni(Tl(v),"handleClick",function(T){var w=v.getMouseInfo(T);if(w){var x=Co(Co({},w),{},{isTooltipActive:!0});v.setState(x),v.triggerSyncEvent(x);var b=v.props.onClick;xa(b)&&b(x,T)}}),Ni(Tl(v),"handleMouseDown",function(T){var w=v.props.onMouseDown;if(xa(w)){var x=v.getMouseInfo(T);w(x,T)}}),Ni(Tl(v),"handleMouseUp",function(T){var w=v.props.onMouseUp;if(xa(w)){var x=v.getMouseInfo(T);w(x,T)}}),Ni(Tl(v),"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),Ni(Tl(v),"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.handleMouseDown(T.changedTouches[0])}),Ni(Tl(v),"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.handleMouseUp(T.changedTouches[0])}),Ni(Tl(v),"triggerSyncEvent",function(T){v.props.syncId!==void 0&&kle.emit(Lle,v.props.syncId,T,v.eventEmitterSymbol)}),Ni(Tl(v),"applySyncEvent",function(T){var w=v.props,x=w.layout,b=w.syncMethod,R=v.state.updateId,H=T.dataStartIndex,F=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)v.setState(Co({dataStartIndex:H,dataEndIndex:F},g({props:v.props,dataStartIndex:H,dataEndIndex:F,updateId:R},v.state)));else if(T.activeTooltipIndex!==void 0){var E=T.chartX,N=T.chartY,U=T.activeTooltipIndex,W=v.state,k=W.offset,D=W.tooltipTicks;if(!k)return;if(typeof b=="function")U=b(D,T);else if(b==="value"){U=-1;for(var L=0;L=0){var ee,te;if(E.dataKey&&!E.allowDuplicatedCategory){var oe=typeof E.dataKey=="function"?Z:"payload.".concat(E.dataKey.toString());ee=kJ(L,oe,U),te=j&&B&&kJ(B,oe,U)}else ee=L==null?void 0:L[N],te=j&&B&&B[N];if($||q){var de=T.props.activeIndex!==void 0?T.props.activeIndex:N;return[m.cloneElement(T,Co(Co(Co({},b.props),Q),{},{activeIndex:de})),null,null]}if(!aa(ee))return[se].concat(xH(v.renderActivePoints({item:b,activePoint:ee,basePoint:te,childIndex:N,isRange:j})))}else{var he,pe=(he=v.getItemByXY(v.state.activeCoordinate))!==null&&he!==void 0?he:{graphicalItem:se},me=pe.graphicalItem,le=me.item,Te=le===void 0?T:le,ge=me.childIndex,Se=Co(Co(Co({},b.props),Q),{},{activeIndex:ge});return[m.cloneElement(Te,Se),null,null]}return j?[se,null,null]:[se,null]}),Ni(Tl(v),"renderCustomized",function(T,w,x){return m.cloneElement(T,Co(Co({key:"recharts-customized-".concat(x)},v.props),v.state))}),Ni(Tl(v),"renderMap",{CartesianGrid:{handler:cV,once:!0},ReferenceArea:{handler:v.renderReferenceElement},ReferenceLine:{handler:cV},ReferenceDot:{handler:v.renderReferenceElement},XAxis:{handler:cV},YAxis:{handler:cV},Brush:{handler:v.renderBrush,once:!0},Bar:{handler:v.renderGraphicChild},Line:{handler:v.renderGraphicChild},Area:{handler:v.renderGraphicChild},Radar:{handler:v.renderGraphicChild},RadialBar:{handler:v.renderGraphicChild},Scatter:{handler:v.renderGraphicChild},Pie:{handler:v.renderGraphicChild},Funnel:{handler:v.renderGraphicChild},Tooltip:{handler:v.renderCursor,once:!0},PolarGrid:{handler:v.renderPolarGrid,once:!0},PolarAngleAxis:{handler:v.renderPolarAxis},PolarRadiusAxis:{handler:v.renderPolarAxis},Customized:{handler:v.renderCustomized}}),v.clipPathId="".concat((C=S.id)!==null&&C!==void 0?C:gS("recharts"),"-clip"),v.throttleTriggeredAfterMouseMove=Tlt(v.triggeredAfterMouseMove,(P=S.throttleDelay)!==null&&P!==void 0?P:1e3/60),v.state={},v}return VFo(y,[{key:"componentDidMount",value:function(){var C,P;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,P=C.children,v=C.data,T=C.height,w=C.layout,x=tg(P,oh);if(x){var b=x.props.defaultIndex;if(!(typeof b!="number"||b<0||b>this.state.tooltipTicks.length)){var R=this.state.tooltipTicks[b]&&this.state.tooltipTicks[b].value,H=fpe(this.state,v,b,R),F=this.state.tooltipTicks[b].coordinate,E=(this.state.offset.top+T)/2,N=w==="horizontal",U=N?{x:F,y:E}:{y:F,x:E},W=this.state.formattedGraphicalItems.find(function(D){var L=D.item;return L.type.name==="Scatter"});W&&(U=Co(Co({},U),W.props.points[b].tooltipPosition),H=W.props.points[b].tooltipPayload);var k={activeTooltipIndex:b,isTooltipActive:!0,activeLabel:R,activePayload:H,activeCoordinate:U};this.setState(k),this.renderCursor(x),this.accessibilityManager.setIndex(b)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,P){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==P.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var v,T;this.accessibilityManager.setDetails({offset:{left:(v=this.props.margin.left)!==null&&v!==void 0?v:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(C){Qfe([tg(C.children,oh)],[tg(this.props.children,oh)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=tg(this.props.children,oh);if(C&&typeof C.props.shared=="boolean"){var P=C.props.shared?"axis":"item";return s.indexOf(P)>=0?P:a}return a}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var P=this.container,v=P.getBoundingClientRect(),T=Zbo(v),w={chartX:Math.round(C.pageX-T.left),chartY:Math.round(C.pageY-T.top)},x=v.width/P.offsetWidth||1,b=this.inRange(w.chartX,w.chartY,x);if(!b)return null;var R=this.state,H=R.xAxisMap,F=R.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&H&&F){var N=d8(H).scale,U=d8(F).scale,W=N&&N.invert?N.invert(w.chartX):null,k=U&&U.invert?U.invert(w.chartY):null;return Co(Co({},w),{},{xValue:W,yValue:k})}var D=DFe(this.state,this.props.data,this.props.layout,b);return D?Co(Co({},w),D):null}},{key:"inRange",value:function(C,P){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,w=C/v,x=P/v;if(T==="horizontal"||T==="vertical"){var b=this.state.offset,R=w>=b.left&&w<=b.left+b.width&&x>=b.top&&x<=b.top+b.height;return R?{x:w,y:x}:null}var H=this.state,F=H.angleAxisMap,E=H.radiusAxisMap;if(F&&E){var N=d8(F);return dEe({x:w,y:x},N)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,P=this.getTooltipEventType(),v=tg(C,oh),T={};v&&P==="axis"&&(v.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var w=LJ(this.props,this.handleOuterEvent);return Co(Co({},w),T)}},{key:"addListener",value:function(){kle.on(Lle,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){kle.removeListener(Lle,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,P,v){for(var T=this.state.formattedGraphicalItems,w=0,x=T.length;w{const r=$t(),[i,a]=m.useState(!1),l=()=>{n==null||n(!t)},s=()=>{o==null||o(!e)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(yw,{checked:t,onClick:l,children:Y.t("menu.graph.ShowHorizontalGridLines",r)}),h.jsx(yw,{checked:e,onClick:s,children:Y.t("menu.graph.ShowHorizontalGridLines",r)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:i?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{a(!0)},onMouseOut:()=>{a(!1)}})})}),bct=be.memo(({type:t,dataSource:e,height:n,dataKeyAxisX:o,labelX:r,labelY:i,unitX:a,unitY:l,yMin:s="auto",yMax:c="auto",fractionDigits:u=2,referenceX:d,color:f})=>{const[p,g]=m.useState(0),[A,y]=m.useState(!0),[S,C]=m.useState(!0),[P,v]=m.useState(null);m.useEffect(()=>{if(!e||e.length===0)return;const R=Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1;p!==R&&g(R)},[e]);const T=m.useMemo(()=>{const R=[];for(let H=0;H{},x=R=>{v(R.dataKey)},b=()=>{v(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"bar-graph-"+r+"-"+i,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(cko,{data:e,onMouseDown:w,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:R=>R.toFixed(u)+" "+l}),h.jsx(Cw,{vertical:S,horizontal:A,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:d,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:o??r,fontSize:"10px",children:h.jsx(is,{value:r+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[s,c],fontSize:"10px",children:h.jsx(is,{dx:-15,value:i+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),T,p>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:b,onMouseEnter:x})]})}),h.jsx(hko,{horizontalGrid:A,verticalGrid:S,changeHorizontalGrid:R=>{y(R)},changeVerticalGrid:R=>{C(R)}})]})})})}),jM=1,pko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,numberOfPoints:a,numberOfSymbols:l,scale:s,fillColor:c}=t,u=a?Math.round(a/l):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*s,y:n-10*s,width:20*s,height:20*s,viewBox:"-10 -10 20 20",children:h.jsx("circle",{cx:"0",cy:"0",r:"3",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},gko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("rect",{x:"-3",y:"-3",width:"6",height:"6",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},uV=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,direction:c,fillColor:u}=t,d=l?Math.round(l/s):1;if(e&&n&&i>0&&i%d===0){let f;switch(c){case 1:f="-4,2.5,4,2.5,0,-3.5";break;case 2:f="2.5,4,2.5,-4,-3.5,0";break;case 3:f="-2.5,4,-2.5,-4,3.5,0";break;default:f="-4,-2.5,4,-2.5,0,3.5"}return h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:f,style:{opacity:o,stroke:r,fill:u??"white",strokeWidth:jM}})})}return null},mko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:"-3,0,0,5,3,0,0,-5",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},yko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.05*a;return h.jsx("svg",{x:e-100*d,y:n-100*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{points:"100,10 40,180 190,60 10,60 160,180",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})})}return null},Ako=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.02*a;return h.jsx("svg",{x:e-150*d,y:n-150*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{className:"hex",points:"300,150 225,280 75,280 0,150 75,20 225,20",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})})}return null},Wx=(t,e,n,o,r,i)=>{switch(t){case"circle":return h.jsx(pko,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"square":return h.jsx(gko,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"triangle up":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:1,opacity:r,fillColor:i});case"triangle down":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:0,opacity:r,fillColor:i});case"triangle right":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:3,opacity:r,fillColor:i});case"triangle left":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:2,opacity:r,fillColor:i});case"star":return h.jsx(yko,{scale:1.25*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"diamond":return h.jsx(mko,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"hexagon":return h.jsx(Ako,{scale:1.3*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i})}},wko=be.memo(({horizontalGrid:t,verticalGrid:e,lineCount:n,lineWidth:o,symbolSize:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s})=>{const c=$t(),[u,d]=m.useState(!1),f=()=>{i==null||i(!t)},p=()=>{a==null||a(!e)},g=y=>{l==null||l(y/2)},A=y=>{s==null||s(y/5)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(kC,{min:0,max:10,value:o*2,onChange:g,children:Y.t("menu.graph.LineWidth",c)+":"}),h.jsx(kC,{min:2,max:12,value:r*5,onChange:A,children:Y.t("menu.graph.SymbolSize",c)+":"}),h.jsx(yw,{checked:t,onClick:f,children:Y.t("menu.graph.ShowHorizontalGridLines",c)}),h.jsx(yw,{checked:e,onClick:p,children:Y.t("menu.graph.ShowHorizontalGridLines",c)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:u?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{d(!0)},onMouseOut:()=>{d(!1)}})})}),Nx=["circle","square","triangle up","triangle down","triangle right","triangle left","star","diamond","hexagon"],Sf=({type:t,chartType:e=Il.Line,selectedIndex:n,dataSource:o,labels:r,height:i,dataKeyAxisX:a,labelX:l,labelY:s,unitX:c,unitY:u,yMin:d="auto",yMax:f="auto",curveType:p="linear",referenceX:g,fractionDigits:A=2,symbolCount:y=12})=>{const[S,C]=m.useState(0),[P,v]=m.useState(!0),[T,w]=m.useState(!0),[x,b]=m.useState(null),[R,H]=m.useState(2),[F,E]=m.useState(1);m.useEffect(()=>{if(!o||o.length===0){C(0);return}const D=Array.isArray(o)?Object.keys(o[0]).length-1:Object.keys(o).length-1;S!==D&&C(D)},[S,o]);const N=m.useMemo(()=>{const D=[];let L;for(let j=0;j0?V||L:!1,isAnimationActive:!1},j))}return D},[t,e,n,p,r,S,R,y,F,x]),U=()=>{},W=D=>{b(D.dataKey)},k=()=>{b(null)};return h.jsx(h.Fragment,{children:o&&h.jsx("div",{id:"line-graph-"+l+"-"+s,style:{width:"100%",height:`${i}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:e===Il.Area?h.jsxs(dko,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:D=>D.toFixed(A)+" "+u}),h.jsx(Cw,{vertical:T,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:a??l,fontSize:"10px",children:h.jsx(is,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[d,f],fontSize:"10px",children:h.jsx(is,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,S>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:k,onMouseEnter:W})]}):h.jsxs(p6e,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:D=>D.toFixed(A)+" "+u}),h.jsx(Cw,{vertical:T,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:a??l,fontSize:"10px",children:h.jsx(is,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[d,f],fontSize:"10px",children:h.jsx(is,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,S>1&&h.jsx(X2,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:k,onMouseEnter:W})]})}),h.jsx(wko,{lineCount:S,symbolSize:F,lineWidth:R,horizontalGrid:P,verticalGrid:T,changeHorizontalGrid:D=>{v(D)},changeVerticalGrid:D=>{w(D)},changeLineWidth:D=>{H(D)},changeSymbolSize:D=>{E(D)}})]})})})},vko=Ho.div` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Act(t,e){if(t){if(typeof t=="string")return dpe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dpe(t,e)}}function KFo(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qFo(t){if(Array.isArray(t))return dpe(t)}function dpe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n0?a:e&&e.length&&dr(r)&&dr(i)?e.slice(r,i+1):[]};function xct(t){return t==="number"?[0,"auto"]:void 0}var fpe=function(e,n,o,r){var i=e.graphicalItems,a=e.tooltipAxis,l=gte(n,e);return o<0||!i||!i.length||o>=l.length?null:i.reduce(function(s,c){var u,d=(u=c.props.data)!==null&&u!==void 0?u:n;d&&e.dataStartIndex+e.dataEndIndex!==0&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var p=d===void 0?l:d;f=kJ(p,a.dataKey,r)}else f=d&&d[o]||l[o];return f?[].concat(xH(s),[Rst(c,f)]):s},[])},DFe=function(e,n,o,r){var i=r||{x:e.chartX,y:e.chartY},a=eko(i,o),l=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,u=hRo(a,l,c,s);if(u>=0&&c){var d=c[u]&&c[u].value,f=fpe(e,n,u,d),p=tko(o,l,u,i);return{activeTooltipIndex:u,activeLabel:d,activePayload:f,activeCoordinate:p}}return null},nko=function(e,n){var o=n.axes,r=n.graphicalItems,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=e.stackOffset,p=Tst(u,i);return o.reduce(function(g,A){var y,S=A.props,C=S.type,P=S.dataKey,v=S.allowDataOverflow,T=S.allowDuplicatedCategory,w=S.scale,x=S.ticks,b=S.includeHidden,R=A.props[a];if(g[R])return g;var H=gte(e.data,{graphicalItems:r.filter(function(V){return V.props[a]===R}),dataStartIndex:s,dataEndIndex:c}),F=H.length,E,N,U;MFo(A.props.domain,v,C)&&(E=Dhe(A.props.domain,null,v),p&&(C==="number"||w!=="auto")&&(U=QE(H,P,"category")));var W=xct(C);if(!E||E.length===0){var k,D=(k=A.props.domain)!==null&&k!==void 0?k:W;if(P){if(E=QE(H,P,C),C==="category"&&p){var L=R8o(E);T&&L?(N=E,E=pK(0,F)):T||(E=sEe(D,E,A).reduce(function(V,G){return V.indexOf(G)>=0?V:[].concat(xH(V),[G])},[]))}else if(C==="category")T?E=E.filter(function(V){return V!==""&&!aa(V)}):E=sEe(D,E,A).reduce(function(V,G){return V.indexOf(G)>=0||G===""||aa(G)?V:[].concat(xH(V),[G])},[]);else if(C==="number"){var j=ARo(H,r.filter(function(V){return V.props[a]===R&&(b||!V.props.hide)}),P,i,u);j&&(E=j)}p&&(C==="number"||w!=="auto")&&(U=QE(H,P,"category"))}else p?E=pK(0,F):l&&l[R]&&l[R].hasStack&&C==="number"?E=f==="expand"?[0,1]:Cst(l[R].stackGroups,s,c):E=Sst(H,r.filter(function(V){return V.props[a]===R&&(b||!V.props.hide)}),C,u,!0);if(C==="number")E=cpe(d,E,R,i,x),D&&(E=Dhe(D,E,v));else if(C==="category"&&D){var B=D,O=E.every(function(V){return B.indexOf(V)>=0});O&&(E=B)}}return Co(Co({},g),{},Ni({},R,Co(Co({},A.props),{},{axisType:i,domain:E,categoricalDomain:U,duplicateDomain:N,originalDomain:(y=A.props.domain)!==null&&y!==void 0?y:W,isCategorical:p,layout:u})))},{})},oko=function(e,n){var o=n.graphicalItems,r=n.Axis,i=n.axisType,a=n.axisIdKey,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.layout,d=e.children,f=gte(e.data,{graphicalItems:o,dataStartIndex:s,dataEndIndex:c}),p=f.length,g=Tst(u,i),A=-1;return o.reduce(function(y,S){var C=S.props[a],P=xct("number");if(!y[C]){A++;var v;return g?v=pK(0,p):l&&l[C]&&l[C].hasStack?(v=Cst(l[C].stackGroups,s,c),v=cpe(d,v,C,i)):(v=Dhe(P,Sst(f,o.filter(function(T){return T.props[a]===C&&!T.props.hide}),"number",u),r.defaultProps.allowDataOverflow),v=cpe(d,v,C,i)),Co(Co({},y),{},Ni({},C,Co(Co({axisType:i},r.defaultProps),{},{hide:!0,orientation:Xm(QFo,"".concat(i,".").concat(A%2),null),domain:v,originalDomain:P,isCategorical:g,layout:u})))}return y},{})},rko=function(e,n){var o=n.axisType,r=o===void 0?"xAxis":o,i=n.AxisComp,a=n.graphicalItems,l=n.stackGroups,s=n.dataStartIndex,c=n.dataEndIndex,u=e.children,d="".concat(r,"Id"),f=e1(u,i),p={};return f&&f.length?p=nko(e,{axes:f,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(p=oko(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:d,stackGroups:l,dataStartIndex:s,dataEndIndex:c})),p},iko=function(e){var n=d8(e),o=z6(n,!1,!0);return{tooltipTicks:o,orderedTooltipTicks:E3e(o,function(r){return r.coordinate}),tooltipAxis:n,tooltipAxisBandSize:iK(n,o)}},EFe=function(e){var n=e.children,o=e.defaultShowTooltip,r=tg(n,pH),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!o}},ako=function(e){return!e||!e.length?!1:e.some(function(n){var o=Y6(n&&n.type);return o&&o.indexOf("Bar")>=0})},FFe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},lko=function(e,n){var o=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,l=e.yAxisMap,s=l===void 0?{}:l,c=o.width,u=o.height,d=o.children,f=o.margin||{},p=tg(d,pH),g=tg(d,X2),A=Object.keys(s).reduce(function(T,w){var x=s[w],b=x.orientation;return!x.mirror&&!x.hide?Co(Co({},T),{},Ni({},b,T[b]+x.width)):T},{left:f.left||0,right:f.right||0}),y=Object.keys(a).reduce(function(T,w){var x=a[w],b=x.orientation;return!x.mirror&&!x.hide?Co(Co({},T),{},Ni({},b,Xm(T,"".concat(b))+x.height)):T},{top:f.top||0,bottom:f.bottom||0}),S=Co(Co({},y),A),C=S.bottom;p&&(S.bottom+=p.props.height||pH.defaultProps.height),g&&n&&(S=mRo(S,r,o,n));var P=c-S.left-S.right,v=u-S.top-S.bottom;return Co(Co({brushBottom:C},S),{},{width:Math.max(P,0),height:Math.max(v,0)})},sko=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},xU=function(e){var n,o=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,a=i===void 0?"axis":i,l=e.validateTooltipEventTypes,s=l===void 0?["axis"]:l,c=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,p=function(y,S){var C=S.graphicalItems,P=S.stackGroups,v=S.offset,T=S.updateId,w=S.dataStartIndex,x=S.dataEndIndex,b=y.barSize,R=y.layout,H=y.barGap,F=y.barCategoryGap,E=y.maxBarSize,N=FFe(R),U=N.numericAxisName,W=N.cateAxisName,k=ako(C),D=[];return C.forEach(function(L,j){var B=gte(y.data,{graphicalItems:[L],dataStartIndex:w,dataEndIndex:x}),O=L.props,V=O.dataKey,G=O.maxBarSize,q=L.props["".concat(U,"Id")],$=L.props["".concat(W,"Id")],ie={},Q=c.reduce(function(Se,Re){var De=S["".concat(Re.axisType,"Map")],Ae=L.props["".concat(Re.axisType,"Id")];De&&De[Ae]||Re.axisType==="zAxis"||wb();var ue=De[Ae];return Co(Co({},Se),{},Ni(Ni({},Re.axisType,ue),"".concat(Re.axisType,"Ticks"),z6(ue)))},ie),se=Q[W],oe=Q["".concat(W,"Ticks")],Z=P&&P[q]&&P[q].hasStack&&IRo(L,P[q].stackGroups),te=Y6(L.type).indexOf("Bar")>=0,ee=iK(se,oe),de=[],fe=k&&pRo({barSize:b,stackGroups:P,totalSize:sko(Q,W)});if(te){var pe,ye,ae=aa(G)?E:G,Te=(pe=(ye=iK(se,oe,!0))!==null&&ye!==void 0?ye:ae)!==null&&pe!==void 0?pe:0;de=gRo({barGap:H,barCategoryGap:F,bandSize:Te!==ee?Te:ee,sizeList:fe[$],maxBarSize:ae}),Te!==ee&&(de=de.map(function(Se){return Co(Co({},Se),{},{position:Co(Co({},Se.position),{},{offset:Se.position.offset-Te/2})})}))}var ge=L&&L.type&&L.type.getComposedData;ge&&D.push({props:Co(Co({},ge(Co(Co({},Q),{},{displayedData:B,props:y,dataKey:V,item:L,bandSize:ee,barPosition:de,offset:v,stackedData:Z,layout:R,dataStartIndex:w,dataEndIndex:x}))),{},Ni(Ni(Ni({key:L.key||"item-".concat(j)},U,Q[U]),W,Q[W]),"animationId",T)),childIndex:U8o(L,y.children),item:L})}),D},g=function(y,S){var C=y.props,P=y.dataStartIndex,v=y.dataEndIndex,T=y.updateId;if(!bze({props:C}))return null;var w=C.children,x=C.layout,b=C.stackOffset,R=C.data,H=C.reverseStackOrder,F=FFe(x),E=F.numericAxisName,N=F.cateAxisName,U=e1(w,r),W=RRo(R,U,"".concat(E,"Id"),"".concat(N,"Id"),b,H),k=c.reduce(function(O,V){var G="".concat(V.axisType,"Map");return Co(Co({},O),{},Ni({},G,rko(C,Co(Co({},V),{},{graphicalItems:U,stackGroups:V.axisType===E&&W,dataStartIndex:P,dataEndIndex:v}))))},{}),D=lko(Co(Co({},k),{},{props:C,graphicalItems:U}),S==null?void 0:S.legendBBox);Object.keys(k).forEach(function(O){k[O]=d(C,k[O],D,O.replace("Map",""),o)});var L=k["".concat(N,"Map")],j=iko(L),B=p(C,Co(Co({},k),{},{dataStartIndex:P,dataEndIndex:v,updateId:T,graphicalItems:U,stackGroups:W,offset:D}));return Co(Co({formattedGraphicalItems:B,graphicalItems:U,offset:D,stackGroups:W},j),k)};return n=function(A){XFo(y,A);function y(S){var C,P,v;return YFo(this,y),v=_Fo(this,y,[S]),Ni(Tl(v),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ni(Tl(v),"accessibilityManager",new HFo),Ni(Tl(v),"handleLegendBBoxUpdate",function(T){if(T){var w=v.state,x=w.dataStartIndex,b=w.dataEndIndex,R=w.updateId;v.setState(Co({legendBBox:T},g({props:v.props,dataStartIndex:x,dataEndIndex:b,updateId:R},Co(Co({},v.state),{},{legendBBox:T}))))}}),Ni(Tl(v),"handleReceiveSyncEvent",function(T,w,x){if(v.props.syncId===T){if(x===v.eventEmitterSymbol&&typeof v.props.syncMethod!="function")return;v.applySyncEvent(w)}}),Ni(Tl(v),"handleBrushChange",function(T){var w=T.startIndex,x=T.endIndex;if(w!==v.state.dataStartIndex||x!==v.state.dataEndIndex){var b=v.state.updateId;v.setState(function(){return Co({dataStartIndex:w,dataEndIndex:x},g({props:v.props,dataStartIndex:w,dataEndIndex:x,updateId:b},v.state))}),v.triggerSyncEvent({dataStartIndex:w,dataEndIndex:x})}}),Ni(Tl(v),"handleMouseEnter",function(T){var w=v.getMouseInfo(T);if(w){var x=Co(Co({},w),{},{isTooltipActive:!0});v.setState(x),v.triggerSyncEvent(x);var b=v.props.onMouseEnter;xa(b)&&b(x,T)}}),Ni(Tl(v),"triggeredAfterMouseMove",function(T){var w=v.getMouseInfo(T),x=w?Co(Co({},w),{},{isTooltipActive:!0}):{isTooltipActive:!1};v.setState(x),v.triggerSyncEvent(x);var b=v.props.onMouseMove;xa(b)&&b(x,T)}),Ni(Tl(v),"handleItemMouseEnter",function(T){v.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),Ni(Tl(v),"handleItemMouseLeave",function(){v.setState(function(){return{isTooltipActive:!1}})}),Ni(Tl(v),"handleMouseMove",function(T){T.persist(),v.throttleTriggeredAfterMouseMove(T)}),Ni(Tl(v),"handleMouseLeave",function(T){v.throttleTriggeredAfterMouseMove.cancel();var w={isTooltipActive:!1};v.setState(w),v.triggerSyncEvent(w);var x=v.props.onMouseLeave;xa(x)&&x(w,T)}),Ni(Tl(v),"handleOuterEvent",function(T){var w=N8o(T),x=Xm(v.props,"".concat(w));if(w&&xa(x)){var b,R;/.*touch.*/i.test(w)?R=v.getMouseInfo(T.changedTouches[0]):R=v.getMouseInfo(T),x((b=R)!==null&&b!==void 0?b:{},T)}}),Ni(Tl(v),"handleClick",function(T){var w=v.getMouseInfo(T);if(w){var x=Co(Co({},w),{},{isTooltipActive:!0});v.setState(x),v.triggerSyncEvent(x);var b=v.props.onClick;xa(b)&&b(x,T)}}),Ni(Tl(v),"handleMouseDown",function(T){var w=v.props.onMouseDown;if(xa(w)){var x=v.getMouseInfo(T);w(x,T)}}),Ni(Tl(v),"handleMouseUp",function(T){var w=v.props.onMouseUp;if(xa(w)){var x=v.getMouseInfo(T);w(x,T)}}),Ni(Tl(v),"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),Ni(Tl(v),"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.handleMouseDown(T.changedTouches[0])}),Ni(Tl(v),"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&v.handleMouseUp(T.changedTouches[0])}),Ni(Tl(v),"triggerSyncEvent",function(T){v.props.syncId!==void 0&&kle.emit(Lle,v.props.syncId,T,v.eventEmitterSymbol)}),Ni(Tl(v),"applySyncEvent",function(T){var w=v.props,x=w.layout,b=w.syncMethod,R=v.state.updateId,H=T.dataStartIndex,F=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)v.setState(Co({dataStartIndex:H,dataEndIndex:F},g({props:v.props,dataStartIndex:H,dataEndIndex:F,updateId:R},v.state)));else if(T.activeTooltipIndex!==void 0){var E=T.chartX,N=T.chartY,U=T.activeTooltipIndex,W=v.state,k=W.offset,D=W.tooltipTicks;if(!k)return;if(typeof b=="function")U=b(D,T);else if(b==="value"){U=-1;for(var L=0;L=0){var Z,te;if(E.dataKey&&!E.allowDuplicatedCategory){var ee=typeof E.dataKey=="function"?oe:"payload.".concat(E.dataKey.toString());Z=kJ(L,ee,U),te=j&&B&&kJ(B,ee,U)}else Z=L==null?void 0:L[N],te=j&&B&&B[N];if($||q){var de=T.props.activeIndex!==void 0?T.props.activeIndex:N;return[m.cloneElement(T,Co(Co(Co({},b.props),Q),{},{activeIndex:de})),null,null]}if(!aa(Z))return[se].concat(xH(v.renderActivePoints({item:b,activePoint:Z,basePoint:te,childIndex:N,isRange:j})))}else{var fe,pe=(fe=v.getItemByXY(v.state.activeCoordinate))!==null&&fe!==void 0?fe:{graphicalItem:se},ye=pe.graphicalItem,ae=ye.item,Te=ae===void 0?T:ae,ge=ye.childIndex,Se=Co(Co(Co({},b.props),Q),{},{activeIndex:ge});return[m.cloneElement(Te,Se),null,null]}return j?[se,null,null]:[se,null]}),Ni(Tl(v),"renderCustomized",function(T,w,x){return m.cloneElement(T,Co(Co({key:"recharts-customized-".concat(x)},v.props),v.state))}),Ni(Tl(v),"renderMap",{CartesianGrid:{handler:cV,once:!0},ReferenceArea:{handler:v.renderReferenceElement},ReferenceLine:{handler:cV},ReferenceDot:{handler:v.renderReferenceElement},XAxis:{handler:cV},YAxis:{handler:cV},Brush:{handler:v.renderBrush,once:!0},Bar:{handler:v.renderGraphicChild},Line:{handler:v.renderGraphicChild},Area:{handler:v.renderGraphicChild},Radar:{handler:v.renderGraphicChild},RadialBar:{handler:v.renderGraphicChild},Scatter:{handler:v.renderGraphicChild},Pie:{handler:v.renderGraphicChild},Funnel:{handler:v.renderGraphicChild},Tooltip:{handler:v.renderCursor,once:!0},PolarGrid:{handler:v.renderPolarGrid,once:!0},PolarAngleAxis:{handler:v.renderPolarAxis},PolarRadiusAxis:{handler:v.renderPolarAxis},Customized:{handler:v.renderCustomized}}),v.clipPathId="".concat((C=S.id)!==null&&C!==void 0?C:gS("recharts"),"-clip"),v.throttleTriggeredAfterMouseMove=Tlt(v.triggeredAfterMouseMove,(P=S.throttleDelay)!==null&&P!==void 0?P:1e3/60),v.state={},v}return VFo(y,[{key:"componentDidMount",value:function(){var C,P;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(C=this.props.margin.left)!==null&&C!==void 0?C:0,top:(P=this.props.margin.top)!==null&&P!==void 0?P:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var C=this.props,P=C.children,v=C.data,T=C.height,w=C.layout,x=tg(P,rh);if(x){var b=x.props.defaultIndex;if(!(typeof b!="number"||b<0||b>this.state.tooltipTicks.length)){var R=this.state.tooltipTicks[b]&&this.state.tooltipTicks[b].value,H=fpe(this.state,v,b,R),F=this.state.tooltipTicks[b].coordinate,E=(this.state.offset.top+T)/2,N=w==="horizontal",U=N?{x:F,y:E}:{y:F,x:E},W=this.state.formattedGraphicalItems.find(function(D){var L=D.item;return L.type.name==="Scatter"});W&&(U=Co(Co({},U),W.props.points[b].tooltipPosition),H=W.props.points[b].tooltipPayload);var k={activeTooltipIndex:b,isTooltipActive:!0,activeLabel:R,activePayload:H,activeCoordinate:U};this.setState(k),this.renderCursor(x),this.accessibilityManager.setIndex(b)}}}},{key:"getSnapshotBeforeUpdate",value:function(C,P){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==P.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==C.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==C.margin){var v,T;this.accessibilityManager.setDetails({offset:{left:(v=this.props.margin.left)!==null&&v!==void 0?v:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(C){Qfe([tg(C.children,rh)],[tg(this.props.children,rh)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var C=tg(this.props.children,rh);if(C&&typeof C.props.shared=="boolean"){var P=C.props.shared?"axis":"item";return s.indexOf(P)>=0?P:a}return a}},{key:"getMouseInfo",value:function(C){if(!this.container)return null;var P=this.container,v=P.getBoundingClientRect(),T=Zbo(v),w={chartX:Math.round(C.pageX-T.left),chartY:Math.round(C.pageY-T.top)},x=v.width/P.offsetWidth||1,b=this.inRange(w.chartX,w.chartY,x);if(!b)return null;var R=this.state,H=R.xAxisMap,F=R.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&H&&F){var N=d8(H).scale,U=d8(F).scale,W=N&&N.invert?N.invert(w.chartX):null,k=U&&U.invert?U.invert(w.chartY):null;return Co(Co({},w),{},{xValue:W,yValue:k})}var D=DFe(this.state,this.props.data,this.props.layout,b);return D?Co(Co({},w),D):null}},{key:"inRange",value:function(C,P){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,w=C/v,x=P/v;if(T==="horizontal"||T==="vertical"){var b=this.state.offset,R=w>=b.left&&w<=b.left+b.width&&x>=b.top&&x<=b.top+b.height;return R?{x:w,y:x}:null}var H=this.state,F=H.angleAxisMap,E=H.radiusAxisMap;if(F&&E){var N=d8(F);return dEe({x:w,y:x},N)}return null}},{key:"parseEventsOfWrapper",value:function(){var C=this.props.children,P=this.getTooltipEventType(),v=tg(C,rh),T={};v&&P==="axis"&&(v.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var w=LJ(this.props,this.handleOuterEvent);return Co(Co({},w),T)}},{key:"addListener",value:function(){kle.on(Lle,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){kle.removeListener(Lle,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(C,P,v){for(var T=this.state.formattedGraphicalItems,w=0,x=T.length;w{const r=$t(),[i,a]=m.useState(!1),l=()=>{n==null||n(!t)},s=()=>{o==null||o(!e)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(yw,{checked:t,onClick:l,children:Y.t("menu.graph.ShowHorizontalGridLines",r)}),h.jsx(yw,{checked:e,onClick:s,children:Y.t("menu.graph.ShowHorizontalGridLines",r)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:i?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{a(!0)},onMouseOut:()=>{a(!1)}})})}),bct=be.memo(({type:t,dataSource:e,height:n,dataKeyAxisX:o,labelX:r,labelY:i,unitX:a,unitY:l,yMin:s="auto",yMax:c="auto",fractionDigits:u=2,referenceX:d,color:f})=>{const[p,g]=m.useState(0),[A,y]=m.useState(!0),[S,C]=m.useState(!0),[P,v]=m.useState(null);m.useEffect(()=>{if(!e||e.length===0)return;const R=Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1;p!==R&&g(R)},[e]);const T=m.useMemo(()=>{const R=[];for(let H=0;H{},x=R=>{v(R.dataKey)},b=()=>{v(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"bar-graph-"+r+"-"+i,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(cko,{data:e,onMouseDown:w,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:R=>R.toFixed(u)+" "+l}),h.jsx(Cw,{vertical:S,horizontal:A,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:d,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:o??r,fontSize:"10px",children:h.jsx(is,{value:r+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[s,c],fontSize:"10px",children:h.jsx(is,{dx:-15,value:i+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),T,p>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:b,onMouseEnter:x})]})}),h.jsx(hko,{horizontalGrid:A,verticalGrid:S,changeHorizontalGrid:R=>{y(R)},changeVerticalGrid:R=>{C(R)}})]})})})}),jM=1,pko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,numberOfPoints:a,numberOfSymbols:l,scale:s,fillColor:c}=t,u=a?Math.round(a/l):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*s,y:n-10*s,width:20*s,height:20*s,viewBox:"-10 -10 20 20",children:h.jsx("circle",{cx:"0",cy:"0",r:"3",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},gko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("rect",{x:"-3",y:"-3",width:"6",height:"6",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},uV=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,direction:c,fillColor:u}=t,d=l?Math.round(l/s):1;if(e&&n&&i>0&&i%d===0){let f;switch(c){case 1:f="-4,2.5,4,2.5,0,-3.5";break;case 2:f="2.5,4,2.5,-4,-3.5,0";break;case 3:f="-2.5,4,-2.5,-4,3.5,0";break;default:f="-4,-2.5,4,-2.5,0,3.5"}return h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:f,style:{opacity:o,stroke:r,fill:u??"white",strokeWidth:jM}})})}return null},mko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;return e&&n&&i>0&&i%u===0?h.jsx("svg",{x:e-10*a,y:n-10*a,width:20*a,height:20*a,viewBox:"-10 -10 20 20",children:h.jsx("polygon",{points:"-3,0,0,5,3,0,0,-5",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})}):null},yko=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.05*a;return h.jsx("svg",{x:e-100*d,y:n-100*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{points:"100,10 40,180 190,60 10,60 160,180",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})})}return null},Ako=t=>{const{cx:e,cy:n,opacity:o,stroke:r,index:i,scale:a,numberOfPoints:l,numberOfSymbols:s,fillColor:c}=t,u=l?Math.round(l/s):1;if(e&&n&&i>0&&i%u===0){const d=.02*a;return h.jsx("svg",{x:e-150*d,y:n-150*d,width:300*d,height:300*d,viewBox:"0 0 300 300",children:h.jsx("polygon",{className:"hex",points:"300,150 225,280 75,280 0,150 75,20 225,20",style:{opacity:o,stroke:r,fill:c??"white",strokeWidth:jM}})})}return null},Wx=(t,e,n,o,r,i)=>{switch(t){case"circle":return h.jsx(pko,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"square":return h.jsx(gko,{scale:e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"triangle up":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:1,opacity:r,fillColor:i});case"triangle down":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:0,opacity:r,fillColor:i});case"triangle right":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:3,opacity:r,fillColor:i});case"triangle left":return h.jsx(uV,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,direction:2,opacity:r,fillColor:i});case"star":return h.jsx(yko,{scale:1.25*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"diamond":return h.jsx(mko,{scale:1.1*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i});case"hexagon":return h.jsx(Ako,{scale:1.3*e,numberOfPoints:n,numberOfSymbols:o,opacity:r,fillColor:i})}},wko=be.memo(({horizontalGrid:t,verticalGrid:e,lineCount:n,lineWidth:o,symbolSize:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s})=>{const c=$t(),[u,d]=m.useState(!1),f=()=>{i==null||i(!t)},p=()=>{a==null||a(!e)},g=y=>{l==null||l(y/2)},A=y=>{s==null||s(y/5)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(kC,{min:0,max:10,value:o*2,onChange:g,children:Y.t("menu.graph.LineWidth",c)+":"}),h.jsx(kC,{min:2,max:12,value:r*5,onChange:A,children:Y.t("menu.graph.SymbolSize",c)+":"}),h.jsx(yw,{checked:t,onClick:f,children:Y.t("menu.graph.ShowHorizontalGridLines",c)}),h.jsx(yw,{checked:e,onClick:p,children:Y.t("menu.graph.ShowHorizontalGridLines",c)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:u?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{d(!0)},onMouseOut:()=>{d(!1)}})})}),Nx=["circle","square","triangle up","triangle down","triangle right","triangle left","star","diamond","hexagon"],Sf=({type:t,chartType:e=Il.Line,selectedIndex:n,dataSource:o,labels:r,height:i,dataKeyAxisX:a,labelX:l,labelY:s,unitX:c,unitY:u,yMin:d="auto",yMax:f="auto",curveType:p="linear",referenceX:g,fractionDigits:A=2,symbolCount:y=12})=>{const[S,C]=m.useState(0),[P,v]=m.useState(!0),[T,w]=m.useState(!0),[x,b]=m.useState(null),[R,H]=m.useState(2),[F,E]=m.useState(1);m.useEffect(()=>{if(!o||o.length===0){C(0);return}const D=Array.isArray(o)?Object.keys(o[0]).length-1:Object.keys(o).length-1;S!==D&&C(D)},[S,o]);const N=m.useMemo(()=>{const D=[];let L;for(let j=0;j0?V||L:!1,isAnimationActive:!1},j))}return D},[t,e,n,p,r,S,R,y,F,x]),U=()=>{},W=D=>{b(D.dataKey)},k=()=>{b(null)};return h.jsx(h.Fragment,{children:o&&h.jsx("div",{id:"line-graph-"+l+"-"+s,style:{width:"100%",height:`${i}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:e===Il.Area?h.jsxs(dko,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:D=>D.toFixed(A)+" "+u}),h.jsx(Cw,{vertical:T,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:a??l,fontSize:"10px",children:h.jsx(is,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[d,f],fontSize:"10px",children:h.jsx(is,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,S>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:k,onMouseEnter:W})]}):h.jsxs(p6e,{data:o,onMouseDown:U,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:D=>D.toFixed(A)+" "+u}),h.jsx(Cw,{vertical:T,horizontal:P,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:a??l,fontSize:"10px",children:h.jsx(is,{value:l+(c?" ("+c+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[d,f],fontSize:"10px",children:h.jsx(is,{dx:-15,value:s+(u?" ("+u+")":""),offset:0,angle:-90,position:"center"})}),N,S>1&&h.jsx(X2,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:k,onMouseEnter:W})]})}),h.jsx(wko,{lineCount:S,symbolSize:F,lineWidth:R,horizontalGrid:P,verticalGrid:T,changeHorizontalGrid:D=>{v(D)},changeVerticalGrid:D=>{w(D)},changeLineWidth:D=>{H(D)},changeSymbolSize:D=>{E(D)}})]})})})},vko=Ho.div` position: fixed; top: 80px; left: 50px; @@ -8705,7 +8705,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho justify-content: space-between; align-items: center; cursor: move; -`,Rko=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=Cn(axt),a=Cn(bOe),l=M($4t),s=M(Ng),c=M(Q4t),u=M(Z4t),d=M(Sc),[f,p]=m.useState(!0),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:l?l.width+40:640,S=g.current?g.current.clientHeight+100:l?l.height+100:600,[C,P]=m.useState({x:l?Math.max(l.x,y-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-S):0}),v=be.useRef(null),T=$t(),w=zs[r.getMonth()];m.useEffect(()=>{P({x:Math.max(l==null?void 0:l.x,y-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-S)})},[l,y,S]),m.useEffect(()=>{const U=()=>{P({x:Math.max(l==null?void 0:l.x,y-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-S)})};return window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[l,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(U=>{g.current&&(U.viewState.yearlyLightSensorPanelRect||(U.viewState.yearlyLightSensorPanelRect=new cr(0,0,600,500)),U.viewState.yearlyLightSensorPanelRect.width=g.current.offsetWidth,U.viewState.yearlyLightSensorPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var U;(U=A.current)==null||U.disconnect()}),[]);const x=(U,W)=>{P({x:Math.max(W.x,y-window.innerWidth),y:Math.min(W.y,window.innerHeight-S)})},b=(U,W)=>{o(k=>{k.viewState.yearlyLightSensorPanelRect||(k.viewState.yearlyLightSensorPanelRect=new cr(0,0,600,500)),k.viewState.yearlyLightSensorPanelRect.x=Math.max(W.x,y-window.innerWidth),k.viewState.yearlyLightSensorPanelRect.y=Math.min(W.y,window.innerHeight-S)})},R=()=>{o(U=>{U.viewState.showYearlyLightSensorPanel=!1,e&&(U.actionInfo={name:"Close Yearly Light Sensor Graph",timestamp:new Date().getTime()})})},{t:H}=Xl(),F=H("word.Month",T),E=H("word.Radiation",T),N=i&&i[0]?Object.keys(i[0]).length===0:!0;return h.jsx(Bi,{nodeRef:v,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:x,onStop:b,onMouseDown:()=>{o(U=>{U.selectedFloatingWindow="yearlyLightSensorPanel"})},children:h.jsx(Tko,{ref:v,style:{zIndex:d==="yearlyLightSensorPanel"?bc:9},children:h.jsxs(Pko,{ref:g,style:{opacity:n,width:(l?l.width:600)+"px",height:(l?l.height:500)+"px"},children:[h.jsxs(Cko,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[H("sensorPanel.LightSensor",T)+": ",h.jsx("span",{style:{fontSize:"10px"},children:H("sensorPanel.WeatherDataFrom",T)+" "+t+" | "+r.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{R()},onMouseDown:()=>{R()},children:H("word.Close",T)})]}),c&&h.jsx(Sf,{type:vi.DaylightData,chartType:Il.Area,dataSource:i.map(U=>({Month:U.Month,Daylight:U.Daylight})),height:100,dataKeyAxisX:"Month",labelX:F,labelY:H("word.Daylight",T),unitY:H("word.Hour",T),yMin:0,curveType:"linear",fractionDigits:1,referenceX:w}),u&&h.jsx(bct,{type:vi.ClearnessData,dataSource:i.map(U=>({Month:U.Month,Clearness:U.Clearness})),height:100,dataKeyAxisX:"Month",labelX:F,labelY:H("yearlyLightSensorPanel.SkyClearness",T),unitY:"%",yMin:0,yMax:100,fractionDigits:1,referenceX:w,color:"#66CDAA"}),f&&h.jsx(Sf,{type:vi.YearlyRadiationSensorData,chartType:Il.Line,dataSource:i.map(({Daylight:U,Clearness:W,...k})=>k),labels:a,height:100,dataKeyAxisX:"Month",labelX:F,labelY:E,unitY:"kWh/m²/"+H("word.Day",T),yMin:0,curveType:"linear",fractionDigits:2,referenceX:w}),h.jsxs(on,{style:{alignSelf:"center",padding:"10px",direction:"ltr"},children:[h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowDaylightResults",T),checked:c,onChange:U=>{o(W=>{W.viewState.yearlyLightSensorPanelShowDaylight=U})}}),H("word.Daylight",T)]}),h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowSkyClearnessResults",T),checked:u,onChange:U=>{o(W=>{W.viewState.yearlyLightSensorPanelShowClearness=U})}}),H("yearlyLightSensorPanel.SkyClearness",T)]}),h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowAverageDailySolarRadiation",T),checked:f,onChange:U=>{p(U)}}),H("word.Radiation",T)]}),h.jsxs(on,{children:[h.jsx(io,{type:"default",icon:N?h.jsx(Th,{}):h.jsx(Rf,{}),title:H(N?"word.Run":"word.Update",T),onClick:()=>{if(s(z.Sensor)===0){gn(H("analysisManager.NoSensorForCollectingData",T));return}gn(H("message.SimulationStarted",T)),setTimeout(()=>{o(W=>{e&&(W.actionInfo={name:"Collect Yearly Data for Sensors",timestamp:new Date().getTime()})}),dt.getState().set(W=>{W.runYearlyLightSensor=!0,W.pauseYearlyLightSensor=!1,W.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:H("word.SaveAsImage",T),onClick:()=>{Ed("line-graph-"+F+"-"+E,"yearly-light-sensor").then(()=>{gn(H("message.ScreenshotSaved",T)),e&&o(U=>{U.actionInfo={name:"Take Screenshot of Yearly Light Sensor Graph",timestamp:new Date().getTime()}})})}}),i&&i.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:H("word.SaveAsCsv",T),onClick:()=>{Sh(i,"yearly-light-sensor.csv"),gn(H("message.CsvFileSaved",T)),e&&o(U=>{U.actionInfo={name:"Export Yearly Light Sensor Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})});//! moment.js +`,Rko=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=Cn(axt),a=Cn(bOe),l=M($4t),s=M(Ng),c=M(Q4t),u=M(Z4t),d=M(Sc),[f,p]=m.useState(!0),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:l?l.width+40:640,S=g.current?g.current.clientHeight+100:l?l.height+100:600,[C,P]=m.useState({x:l?Math.max(l.x,y-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-S):0}),v=be.useRef(null),T=$t(),w=zs[r.getMonth()];m.useEffect(()=>{P({x:Math.max(l==null?void 0:l.x,y-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-S)})},[l,y,S]),m.useEffect(()=>{const U=()=>{P({x:Math.max(l==null?void 0:l.x,y-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-S)})};return window.addEventListener("resize",U),()=>{window.removeEventListener("resize",U)}},[l,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(U=>{g.current&&(U.viewState.yearlyLightSensorPanelRect||(U.viewState.yearlyLightSensorPanelRect=new cr(0,0,600,500)),U.viewState.yearlyLightSensorPanelRect.width=g.current.offsetWidth,U.viewState.yearlyLightSensorPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var U;(U=A.current)==null||U.disconnect()}),[]);const x=(U,W)=>{P({x:Math.max(W.x,y-window.innerWidth),y:Math.min(W.y,window.innerHeight-S)})},b=(U,W)=>{o(k=>{k.viewState.yearlyLightSensorPanelRect||(k.viewState.yearlyLightSensorPanelRect=new cr(0,0,600,500)),k.viewState.yearlyLightSensorPanelRect.x=Math.max(W.x,y-window.innerWidth),k.viewState.yearlyLightSensorPanelRect.y=Math.min(W.y,window.innerHeight-S)})},R=()=>{o(U=>{U.viewState.showYearlyLightSensorPanel=!1,e&&(U.actionInfo={name:"Close Yearly Light Sensor Graph",timestamp:new Date().getTime()})})},{t:H}=Xl(),F=H("word.Month",T),E=H("word.Radiation",T),N=i&&i[0]?Object.keys(i[0]).length===0:!0;return h.jsx(Bi,{nodeRef:v,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:x,onStop:b,onMouseDown:()=>{o(U=>{U.selectedFloatingWindow="yearlyLightSensorPanel"})},children:h.jsx(Tko,{ref:v,style:{zIndex:d==="yearlyLightSensorPanel"?bc:9},children:h.jsxs(Pko,{ref:g,style:{opacity:n,width:(l?l.width:600)+"px",height:(l?l.height:500)+"px"},children:[h.jsxs(Cko,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[H("sensorPanel.LightSensor",T)+": ",h.jsx("span",{style:{fontSize:"10px"},children:H("sensorPanel.WeatherDataFrom",T)+" "+t+" | "+r.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{R()},onMouseDown:()=>{R()},children:H("word.Close",T)})]}),c&&h.jsx(Sf,{type:vi.DaylightData,chartType:Il.Area,dataSource:i.map(U=>({Month:U.Month,Daylight:U.Daylight})),height:100,dataKeyAxisX:"Month",labelX:F,labelY:H("word.Daylight",T),unitY:H("word.Hour",T),yMin:0,curveType:"linear",fractionDigits:1,referenceX:w}),u&&h.jsx(bct,{type:vi.ClearnessData,dataSource:i.map(U=>({Month:U.Month,Clearness:U.Clearness})),height:100,dataKeyAxisX:"Month",labelX:F,labelY:H("yearlyLightSensorPanel.SkyClearness",T),unitY:"%",yMin:0,yMax:100,fractionDigits:1,referenceX:w,color:"#66CDAA"}),f&&h.jsx(Sf,{type:vi.YearlyRadiationSensorData,chartType:Il.Line,dataSource:i.map(({Daylight:U,Clearness:W,...k})=>k),labels:a,height:100,dataKeyAxisX:"Month",labelX:F,labelY:E,unitY:"kWh/m²/"+H("word.Day",T),yMin:0,curveType:"linear",fractionDigits:2,referenceX:w}),h.jsxs(on,{style:{alignSelf:"center",padding:"10px",direction:"ltr"},children:[h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowDaylightResults",T),checked:c,onChange:U=>{o(W=>{W.viewState.yearlyLightSensorPanelShowDaylight=U})}}),H("word.Daylight",T)]}),h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowSkyClearnessResults",T),checked:u,onChange:U=>{o(W=>{W.viewState.yearlyLightSensorPanelShowClearness=U})}}),H("yearlyLightSensorPanel.SkyClearness",T)]}),h.jsxs(on,{children:[h.jsx(vc,{title:H("yearlyLightSensorPanel.ShowAverageDailySolarRadiation",T),checked:f,onChange:U=>{p(U)}}),H("word.Radiation",T)]}),h.jsxs(on,{children:[h.jsx(io,{type:"default",icon:N?h.jsx(Th,{}):h.jsx(Hf,{}),title:H(N?"word.Run":"word.Update",T),onClick:()=>{if(s(z.Sensor)===0){gn(H("analysisManager.NoSensorForCollectingData",T));return}gn(H("message.SimulationStarted",T)),setTimeout(()=>{o(W=>{e&&(W.actionInfo={name:"Collect Yearly Data for Sensors",timestamp:new Date().getTime()})}),dt.getState().set(W=>{W.runYearlyLightSensor=!0,W.pauseYearlyLightSensor=!1,W.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:H("word.SaveAsImage",T),onClick:()=>{Ed("line-graph-"+F+"-"+E,"yearly-light-sensor").then(()=>{gn(H("message.ScreenshotSaved",T)),e&&o(U=>{U.actionInfo={name:"Take Screenshot of Yearly Light Sensor Graph",timestamp:new Date().getTime()}})})}}),i&&i.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:H("word.SaveAsCsv",T),onClick:()=>{Sh(i,"yearly-light-sensor.csv"),gn(H("message.CsvFileSaved",T)),e&&o(U=>{U.actionInfo={name:"Export Yearly Light Sensor Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})});//! moment.js //! version : 2.29.4 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT @@ -8713,7 +8713,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho var Sct;function yr(){return Sct.apply(null,arguments)}function Hko(t){Sct=t}function K2(t){return t instanceof Array||Object.prototype.toString.call(t)==="[object Array]"}function Ux(t){return t!=null&&Object.prototype.toString.call(t)==="[object Object]"}function Bl(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function g6e(t){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(t).length===0;var e;for(e in t)if(Bl(t,e))return!1;return!0}function Fp(t){return t===void 0}function hA(t){return typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]"}function bU(t){return t instanceof Date||Object.prototype.toString.call(t)==="[object Date]"}function Tct(t,e){var n=[],o,r=t.length;for(o=0;o>>0,o;for(o=0;o0)for(n=0;n=0;return(i?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+o}var w6e=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,dV=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ule={},_C={};function pi(t,e,n,o){var r=o;typeof o=="string"&&(r=function(){return this[o]()}),t&&(_C[t]=r),e&&(_C[e[0]]=function(){return Z9(r.apply(this,arguments),e[1],e[2])}),n&&(_C[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function Eko(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Fko(t){var e=t.match(w6e),n,o;for(n=0,o=e.length;n=0&&dV.test(t);)t=t.replace(dV,o),dV.lastIndex=0,n-=1;return t}var kko={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Lko(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(w6e).map(function(o){return o==="MMMM"||o==="MM"||o==="DD"||o==="dddd"?o.slice(1):o}).join(""),this._longDateFormat[t])}var Wko="Invalid date";function Nko(){return this._invalidDate}var Uko="%d",jko=/\d{1,2}/;function Bko(t){return this._ordinal.replace("%d",t)}var Yko={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Oko(t,e,n,o){var r=this._relativeTime[n];return S3(r)?r(t,e,n,o):r.replace(/%d/i,t)}function Vko(t,e){var n=this._relativeTime[t>0?"future":"past"];return S3(n)?n(e):n.replace(/%s/i,e)}var rF={};function Ch(t,e){var n=t.toLowerCase();rF[n]=rF[n+"s"]=rF[e]=t}function yy(t){return typeof t=="string"?rF[t]||rF[t.toLowerCase()]:void 0}function v6e(t){var e={},n,o;for(o in t)Bl(t,o)&&(n=yy(o),n&&(e[n]=t[o]));return e}var Hct={};function Rh(t,e){Hct[t]=e}function _ko(t){var e=[],n;for(n in t)Bl(t,n)&&e.push({unit:n,priority:Hct[n]});return e.sort(function(o,r){return o.priority-r.priority}),e}function yte(t){return t%4===0&&t%100!==0||t%400===0}function zm(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function Wa(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=zm(e)),n}function BM(t,e){return function(n){return n!=null?(Mct(this,t,n),yr.updateOffset(this,e),this):PK(this,t)}}function PK(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function Mct(t,e,n){t.isValid()&&!isNaN(n)&&(e==="FullYear"&&yte(t.year())&&t.month()===1&&t.date()===29?(n=Wa(n),t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),Ste(n,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](n))}function Gko(t){return t=yy(t),S3(this[t])?this[t]():this}function Xko(t,e){if(typeof t=="object"){t=v6e(t);var n=_ko(t),o,r=n.length;for(o=0;o68?1900:2e3)};var Uct=BM("FullYear",!0);function fLo(){return yte(this.year())}function hLo(t,e,n,o,r,i,a){var l;return t<100&&t>=0?(l=new Date(t+400,e,n,o,r,i,a),isFinite(l.getFullYear())&&l.setFullYear(t)):l=new Date(t,e,n,o,r,i,a),l}function VL(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function RK(t,e,n){var o=7+e-n,r=(7+VL(t,0,o).getUTCDay()-e)%7;return-r+o-1}function jct(t,e,n,o,r){var i=(7+n-o)%7,a=RK(t,o,r),l=1+7*(e-1)+i+a,s,c;return l<=0?(s=t-1,c=iF(s)+l):l>iF(t)?(s=t+1,c=l-iF(t)):(s=t,c=l),{year:s,dayOfYear:c}}function _L(t,e,n){var o=RK(t.year(),e,n),r=Math.floor((t.dayOfYear()-o-1)/7)+1,i,a;return r<1?(a=t.year()-1,i=r+_6(a,e,n)):r>_6(t.year(),e,n)?(i=r-_6(t.year(),e,n),a=t.year()+1):(a=t.year(),i=r),{week:i,year:a}}function _6(t,e,n){var o=RK(t,e,n),r=RK(t+1,e,n);return(iF(t)-o+r)/7}pi("w",["ww",2],"wo","week");pi("W",["WW",2],"Wo","isoWeek");Ch("week","w");Ch("isoWeek","W");Rh("week",5);Rh("isoWeek",5);Wr("w",Pc);Wr("ww",Pc,Bg);Wr("W",Pc);Wr("WW",Pc,Bg);PU(["w","ww","W","WW"],function(t,e,n,o){e[o.substr(0,1)]=Wa(t)});function pLo(t){return _L(t,this._week.dow,this._week.doy).week}var gLo={dow:0,doy:6};function mLo(){return this._week.dow}function yLo(){return this._week.doy}function ALo(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function wLo(t){var e=_L(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}pi("d",0,"do","day");pi("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)});pi("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)});pi("dddd",0,0,function(t){return this.localeData().weekdays(this,t)});pi("e",0,0,"weekday");pi("E",0,0,"isoWeekday");Ch("day","d");Ch("weekday","e");Ch("isoWeekday","E");Rh("day",11);Rh("weekday",11);Rh("isoWeekday",11);Wr("d",Pc);Wr("e",Pc);Wr("E",Pc);Wr("dd",function(t,e){return e.weekdaysMinRegex(t)});Wr("ddd",function(t,e){return e.weekdaysShortRegex(t)});Wr("dddd",function(t,e){return e.weekdaysRegex(t)});PU(["dd","ddd","dddd"],function(t,e,n,o){var r=n._locale.weekdaysParse(t,o,n._strict);r!=null?e.d=r:va(n).invalidWeekday=t});PU(["d","e","E"],function(t,e,n,o){e[o]=Wa(t)});function vLo(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function xLo(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function S6e(t,e){return t.slice(e,7).concat(t.slice(0,e))}var bLo="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bct="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),SLo="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),TLo=TU,PLo=TU,CLo=TU;function RLo(t,e){var n=K2(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?S6e(n,this._week.dow):t?n[t.day()]:n}function HLo(t){return t===!0?S6e(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function MLo(t){return t===!0?S6e(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function ILo(t,e,n){var o,r,i,a=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)i=b3([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(i,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(i,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(i,"").toLocaleLowerCase();return n?e==="dddd"?(r=E0.call(this._weekdaysParse,a),r!==-1?r:null):e==="ddd"?(r=E0.call(this._shortWeekdaysParse,a),r!==-1?r:null):(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null):e==="dddd"?(r=E0.call(this._weekdaysParse,a),r!==-1||(r=E0.call(this._shortWeekdaysParse,a),r!==-1)?r:(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null)):e==="ddd"?(r=E0.call(this._shortWeekdaysParse,a),r!==-1||(r=E0.call(this._weekdaysParse,a),r!==-1)?r:(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null)):(r=E0.call(this._minWeekdaysParse,a),r!==-1||(r=E0.call(this._weekdaysParse,a),r!==-1)?r:(r=E0.call(this._shortWeekdaysParse,a),r!==-1?r:null))}function zLo(t,e,n){var o,r,i;if(this._weekdaysParseExact)return ILo.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(r=b3([2e3,1]).day(o),n&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[o]||(i="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[o]=new RegExp(i.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[o].test(t))return o;if(n&&e==="ddd"&&this._shortWeekdaysParse[o].test(t))return o;if(n&&e==="dd"&&this._minWeekdaysParse[o].test(t))return o;if(!n&&this._weekdaysParse[o].test(t))return o}}function DLo(t){if(!this.isValid())return t!=null?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return t!=null?(t=vLo(t,this.localeData()),this.add(t-e,"d")):e}function ELo(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function FLo(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=xLo(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function kLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(Bl(this,"_weekdaysRegex")||(this._weekdaysRegex=TLo),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function LLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Bl(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=PLo),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function WLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Bl(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=CLo),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function T6e(){function t(u,d){return d.length-u.length}var e=[],n=[],o=[],r=[],i,a,l,s,c;for(i=0;i<7;i++)a=b3([2e3,1]).day(i),l=sg(this.weekdaysMin(a,"")),s=sg(this.weekdaysShort(a,"")),c=sg(this.weekdays(a,"")),e.push(l),n.push(s),o.push(c),r.push(l),r.push(s),r.push(c);e.sort(t),n.sort(t),o.sort(t),r.sort(t),this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function P6e(){return this.hours()%12||12}function NLo(){return this.hours()||24}pi("H",["HH",2],0,"hour");pi("h",["hh",2],0,P6e);pi("k",["kk",2],0,NLo);pi("hmm",0,0,function(){return""+P6e.apply(this)+Z9(this.minutes(),2)});pi("hmmss",0,0,function(){return""+P6e.apply(this)+Z9(this.minutes(),2)+Z9(this.seconds(),2)});pi("Hmm",0,0,function(){return""+this.hours()+Z9(this.minutes(),2)});pi("Hmmss",0,0,function(){return""+this.hours()+Z9(this.minutes(),2)+Z9(this.seconds(),2)});function Yct(t,e){pi(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}Yct("a",!0);Yct("A",!1);Ch("hour","h");Rh("hour",13);function Oct(t,e){return e._meridiemParse}Wr("a",Oct);Wr("A",Oct);Wr("H",Pc);Wr("h",Pc);Wr("k",Pc);Wr("HH",Pc,Bg);Wr("hh",Pc,Bg);Wr("kk",Pc,Bg);Wr("hmm",Dct);Wr("hmmss",Ect);Wr("Hmm",Dct);Wr("Hmmss",Ect);Rs(["H","HH"],Uu);Rs(["k","kk"],function(t,e,n){var o=Wa(t);e[Uu]=o===24?0:o});Rs(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t});Rs(["h","hh"],function(t,e,n){e[Uu]=Wa(t),va(n).bigHour=!0});Rs("hmm",function(t,e,n){var o=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o)),va(n).bigHour=!0});Rs("hmmss",function(t,e,n){var o=t.length-4,r=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o,2)),e[E6]=Wa(t.substr(r)),va(n).bigHour=!0});Rs("Hmm",function(t,e,n){var o=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o))});Rs("Hmmss",function(t,e,n){var o=t.length-4,r=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o,2)),e[E6]=Wa(t.substr(r))});function ULo(t){return(t+"").toLowerCase().charAt(0)==="p"}var jLo=/[ap]\.?m?\.?/i,BLo=BM("Hours",!0);function YLo(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var Vct={calendar:zko,longDateFormat:kko,invalidDate:Wko,ordinal:Uko,dayOfMonthOrdinalParse:jko,relativeTime:Yko,months:nLo,monthsShort:Fct,week:gLo,weekdays:bLo,weekdaysMin:SLo,weekdaysShort:Bct,meridiemParse:jLo},kc={},xD={},GL;function OLo(t,e){var n,o=Math.min(t.length,e.length);for(n=0;n0;){if(r=Tte(i.slice(0,n).join("-")),r)return r;if(o&&o.length>=n&&OLo(i,o)>=n-1)break;n--}e++}return GL}function _Lo(t){return t.match("^[^/\\\\]*$")!=null}function Tte(t){var e=null,n;if(kc[t]===void 0&&typeof hh<"u"&&hh&&hh.exports&&_Lo(t))try{e=GL._abbr,n=require,n("./locale/"+t),Q8(e)}catch{kc[t]=null}return kc[t]}function Q8(t,e){var n;return t&&(Fp(e)?n=IA(t):n=C6e(t,e),n?GL=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),GL._abbr}function C6e(t,e){if(e!==null){var n,o=Vct;if(e.abbr=t,kc[t]!=null)Cct("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),o=kc[t]._config;else if(e.parentLocale!=null)if(kc[e.parentLocale]!=null)o=kc[e.parentLocale]._config;else if(n=Tte(e.parentLocale),n!=null)o=n._config;else return xD[e.parentLocale]||(xD[e.parentLocale]=[]),xD[e.parentLocale].push({name:t,config:e}),null;return kc[t]=new A6e(ppe(o,e)),xD[t]&&xD[t].forEach(function(r){C6e(r.name,r.config)}),Q8(t),kc[t]}else return delete kc[t],null}function GLo(t,e){if(e!=null){var n,o,r=Vct;kc[t]!=null&&kc[t].parentLocale!=null?kc[t].set(ppe(kc[t]._config,e)):(o=Tte(t),o!=null&&(r=o._config),e=ppe(r,e),o==null&&(e.abbr=t),n=new A6e(e),n.parentLocale=kc[t],kc[t]=n),Q8(t)}else kc[t]!=null&&(kc[t].parentLocale!=null?(kc[t]=kc[t].parentLocale,t===Q8()&&Q8(t)):kc[t]!=null&&delete kc[t]);return kc[t]}function IA(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return GL;if(!K2(t)){if(e=Tte(t),e)return e;t=[t]}return VLo(t)}function XLo(){return gpe(kc)}function R6e(t){var e,n=t._a;return n&&va(t).overflow===-2&&(e=n[D6]<0||n[D6]>11?D6:n[h9]<1||n[h9]>Ste(n[gh],n[D6])?h9:n[Uu]<0||n[Uu]>24||n[Uu]===24&&(n[H2]!==0||n[E6]!==0||n[lx]!==0)?Uu:n[H2]<0||n[H2]>59?H2:n[E6]<0||n[E6]>59?E6:n[lx]<0||n[lx]>999?lx:-1,va(t)._overflowDayOfYear&&(eh9)&&(e=h9),va(t)._overflowWeeks&&e===-1&&(e=Zko),va(t)._overflowWeekday&&e===-1&&(e=eLo),va(t).overflow=e),t}var JLo=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,KLo=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qLo=/Z|[+-]\d\d(?::?\d\d)?/,fV=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],jle=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],$Lo=/^\/?Date\((-?\d+)/i,QLo=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,ZLo={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function _ct(t){var e,n,o=t._i,r=JLo.exec(o)||KLo.exec(o),i,a,l,s,c=fV.length,u=jle.length;if(r){for(va(t).iso=!0,e=0,n=c;eiF(a)||t._dayOfYear===0)&&(va(t)._overflowDayOfYear=!0),n=VL(a,0,t._dayOfYear),t._a[D6]=n.getUTCMonth(),t._a[h9]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=o[e]=r[e];for(;e<7;e++)t._a[e]=o[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[Uu]===24&&t._a[H2]===0&&t._a[E6]===0&&t._a[lx]===0&&(t._nextDay=!0,t._a[Uu]=0),t._d=(t._useUTC?VL:hLo).apply(null,o),i=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Uu]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==i&&(va(t).weekdayMismatch=!0)}}function lWo(t){var e,n,o,r,i,a,l,s,c;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(i=1,a=4,n=kP(e.GG,t._a[gh],_L(xc(),1,4).year),o=kP(e.W,1),r=kP(e.E,1),(r<1||r>7)&&(s=!0)):(i=t._locale._week.dow,a=t._locale._week.doy,c=_L(xc(),i,a),n=kP(e.gg,t._a[gh],c.year),o=kP(e.w,c.week),e.d!=null?(r=e.d,(r<0||r>6)&&(s=!0)):e.e!=null?(r=e.e+i,(e.e<0||e.e>6)&&(s=!0)):r=i),o<1||o>_6(n,i,a)?va(t)._overflowWeeks=!0:s!=null?va(t)._overflowWeekday=!0:(l=jct(n,o,r,i,a),t._a[gh]=l.year,t._dayOfYear=l.dayOfYear)}yr.ISO_8601=function(){};yr.RFC_2822=function(){};function M6e(t){if(t._f===yr.ISO_8601){_ct(t);return}if(t._f===yr.RFC_2822){Gct(t);return}t._a=[],va(t).empty=!0;var e=""+t._i,n,o,r,i,a,l=e.length,s=0,c,u;for(r=Rct(t._f,t._locale).match(w6e)||[],u=r.length,n=0;n0&&va(t).unusedInput.push(a),e=e.slice(e.indexOf(o)+o.length),s+=o.length),_C[i]?(o?va(t).empty=!1:va(t).unusedTokens.push(i),Qko(i,o,t)):t._strict&&!o&&va(t).unusedTokens.push(i);va(t).charsLeftOver=l-s,e.length>0&&va(t).unusedInput.push(e),t._a[Uu]<=12&&va(t).bigHour===!0&&t._a[Uu]>0&&(va(t).bigHour=void 0),va(t).parsedDateParts=t._a.slice(0),va(t).meridiem=t._meridiem,t._a[Uu]=sWo(t._locale,t._a[Uu],t._meridiem),c=va(t).era,c!==null&&(t._a[gh]=t._locale.erasConvertYear(c,t._a[gh])),H6e(t),R6e(t)}function sWo(t,e,n){var o;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(o=t.isPM(n),o&&e<12&&(e+=12),!o&&e===12&&(e=0)),e)}function cWo(t){var e,n,o,r,i,a,l=!1,s=t._f.length;if(s===0){va(t).invalidFormat=!0,t._d=new Date(NaN);return}for(r=0;rthis?this:t:mte()});function Kct(t,e){var n,o;if(e.length===1&&K2(e[0])&&(e=e[0]),!e.length)return xc();for(n=e[0],o=1;othis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function IWo(){if(!Fp(this._isDSTShifted))return this._isDSTShifted;var t={},e;return y6e(t,this),t=Xct(t),t._a?(e=t._isUTC?b3(t._a):xc(t._a),this._isDSTShifted=this.isValid()&&xWo(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function zWo(){return this.isValid()?!this._isUTC:!1}function DWo(){return this.isValid()?this._isUTC:!1}function $ct(){return this.isValid()?this._isUTC&&this._offset===0:!1}var EWo=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,FWo=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function h5(t,e){var n=t,o=null,r,i,a;return x_(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:hA(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(o=EWo.exec(t))?(r=o[1]==="-"?-1:1,n={y:0,d:Wa(o[h9])*r,h:Wa(o[Uu])*r,m:Wa(o[H2])*r,s:Wa(o[E6])*r,ms:Wa(ype(o[lx]*1e3))*r}):(o=FWo.exec(t))?(r=o[1]==="-"?-1:1,n={y:lv(o[2],r),M:lv(o[3],r),w:lv(o[4],r),d:lv(o[5],r),h:lv(o[6],r),m:lv(o[7],r),s:lv(o[8],r)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(a=kWo(xc(n.from),xc(n.to)),n={},n.ms=a.milliseconds,n.M=a.months),i=new Pte(n),x_(t)&&Bl(t,"_locale")&&(i._locale=t._locale),x_(t)&&Bl(t,"_isValid")&&(i._isValid=t._isValid),i}h5.fn=Pte.prototype;h5.invalid=vWo;function lv(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function NFe(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function kWo(t,e){var n;return t.isValid()&&e.isValid()?(e=z6e(e,t),t.isBefore(e)?n=NFe(t,e):(n=NFe(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Qct(t,e){return function(n,o){var r,i;return o!==null&&!isNaN(+o)&&(Cct(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=o,o=i),r=h5(n,o),Zct(this,r,t),this}}function Zct(t,e,n,o){var r=e._milliseconds,i=ype(e._days),a=ype(e._months);t.isValid()&&(o=o??!0,a&&Lct(t,PK(t,"Month")+a*n),i&&Mct(t,"Date",PK(t,"Date")+i*n),r&&t._d.setTime(t._d.valueOf()+r*n),o&&yr.updateOffset(t,i||a))}var LWo=Qct(1,"add"),WWo=Qct(-1,"subtract");function e0t(t){return typeof t=="string"||t instanceof String}function NWo(t){return q2(t)||bU(t)||e0t(t)||hA(t)||jWo(t)||UWo(t)||t===null||t===void 0}function UWo(t){var e=Ux(t)&&!g6e(t),n=!1,o=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,i,a=o.length;for(r=0;rn.valueOf():n.valueOf()9999?v_(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):S3(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",v_(n,"Z")):v_(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function eNo(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,o,r,i;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",i=e+'[")]',this.format(n+o+r+i)}function tNo(t){t||(t=this.isUtc()?yr.defaultFormatUtc:yr.defaultFormat);var e=v_(this,t);return this.localeData().postformat(e)}function nNo(t,e){return this.isValid()&&(q2(t)&&t.isValid()||xc(t).isValid())?h5({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function oNo(t){return this.from(xc(),t)}function rNo(t,e){return this.isValid()&&(q2(t)&&t.isValid()||xc(t).isValid())?h5({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function iNo(t){return this.to(xc(),t)}function t0t(t){var e;return t===void 0?this._locale._abbr:(e=IA(t),e!=null&&(this._locale=e),this)}var n0t=my("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function o0t(){return this._locale}var HK=1e3,GC=60*HK,MK=60*GC,r0t=(365*400+97)*24*MK;function XC(t,e){return(t%e+e)%e}function i0t(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-r0t:new Date(t,e,n).valueOf()}function a0t(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-r0t:Date.UTC(t,e,n)}function aNo(t){var e,n;if(t=yy(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?a0t:i0t,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=XC(e+(this._isUTC?0:this.utcOffset()*GC),MK);break;case"minute":e=this._d.valueOf(),e-=XC(e,GC);break;case"second":e=this._d.valueOf(),e-=XC(e,HK);break}return this._d.setTime(e),yr.updateOffset(this,!0),this}function lNo(t){var e,n;if(t=yy(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?a0t:i0t,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=MK-XC(e+(this._isUTC?0:this.utcOffset()*GC),MK)-1;break;case"minute":e=this._d.valueOf(),e+=GC-XC(e,GC)-1;break;case"second":e=this._d.valueOf(),e+=HK-XC(e,HK)-1;break}return this._d.setTime(e),yr.updateOffset(this,!0),this}function sNo(){return this._d.valueOf()-(this._offset||0)*6e4}function cNo(){return Math.floor(this.valueOf()/1e3)}function uNo(){return new Date(this.valueOf())}function dNo(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function fNo(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function hNo(){return this.isValid()?this.toISOString():null}function pNo(){return m6e(this)}function gNo(){return z8({},va(this))}function mNo(){return va(this).overflow}function yNo(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pi("N",0,0,"eraAbbr");pi("NN",0,0,"eraAbbr");pi("NNN",0,0,"eraAbbr");pi("NNNN",0,0,"eraName");pi("NNNNN",0,0,"eraNarrow");pi("y",["y",1],"yo","eraYear");pi("y",["yy",2],0,"eraYear");pi("y",["yyy",3],0,"eraYear");pi("y",["yyyy",4],0,"eraYear");Wr("N",D6e);Wr("NN",D6e);Wr("NNN",D6e);Wr("NNNN",HNo);Wr("NNNNN",MNo);Rs(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,o){var r=n._locale.erasParse(t,o,n._strict);r?va(n).era=r:va(n).invalidEra=t});Wr("y",YM);Wr("yy",YM);Wr("yyy",YM);Wr("yyyy",YM);Wr("yo",INo);Rs(["y","yy","yyy","yyyy"],gh);Rs(["yo"],function(t,e,n,o){var r;n._locale._eraYearOrdinalRegex&&(r=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[gh]=n._locale.eraYearOrdinalParse(t,r):e[gh]=parseInt(t,10)});function ANo(t,e){var n,o,r,i=this._eras||IA("en")._eras;for(n=0,o=i.length;n=0)return i[o]}function vNo(t,e){var n=t.since<=t.until?1:-1;return e===void 0?yr(t.since).year():yr(t.since).year()+(e-t.offset)*n}function xNo(){var t,e,n,o=this.localeData().eras();for(t=0,e=o.length;ti&&(e=i),WNo.call(this,t,e,n,o,r))}function WNo(t,e,n,o,r){var i=jct(t,e,n,o,r),a=VL(i.year,0,i.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}pi("Q",0,"Qo","quarter");Ch("quarter","Q");Rh("quarter",7);Wr("Q",Ict);Rs("Q",function(t,e){e[D6]=(Wa(t)-1)*3});function NNo(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}pi("D",["DD",2],"Do","date");Ch("date","D");Rh("date",9);Wr("D",Pc);Wr("DD",Pc,Bg);Wr("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient});Rs(["D","DD"],h9);Rs("Do",function(t,e){e[h9]=Wa(t.match(Pc)[0])});var s0t=BM("Date",!0);pi("DDD",["DDDD",3],"DDDo","dayOfYear");Ch("dayOfYear","DDD");Rh("dayOfYear",4);Wr("DDD",wte);Wr("DDDD",zct);Rs(["DDD","DDDD"],function(t,e,n){n._dayOfYear=Wa(t)});function UNo(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}pi("m",["mm",2],0,"minute");Ch("minute","m");Rh("minute",14);Wr("m",Pc);Wr("mm",Pc,Bg);Rs(["m","mm"],H2);var jNo=BM("Minutes",!1);pi("s",["ss",2],0,"second");Ch("second","s");Rh("second",15);Wr("s",Pc);Wr("ss",Pc,Bg);Rs(["s","ss"],E6);var BNo=BM("Seconds",!1);pi("S",0,0,function(){return~~(this.millisecond()/100)});pi(0,["SS",2],0,function(){return~~(this.millisecond()/10)});pi(0,["SSS",3],0,"millisecond");pi(0,["SSSS",4],0,function(){return this.millisecond()*10});pi(0,["SSSSS",5],0,function(){return this.millisecond()*100});pi(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});pi(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});pi(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});pi(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});Ch("millisecond","ms");Rh("millisecond",16);Wr("S",wte,Ict);Wr("SS",wte,Bg);Wr("SSS",wte,zct);var D8,c0t;for(D8="SSSS";D8.length<=9;D8+="S")Wr(D8,YM);function YNo(t,e){e[lx]=Wa(("0."+t)*1e3)}for(D8="S";D8.length<=9;D8+="S")Rs(D8,YNo);c0t=BM("Milliseconds",!1);pi("z",0,0,"zoneAbbr");pi("zz",0,0,"zoneName");function ONo(){return this._isUTC?"UTC":""}function VNo(){return this._isUTC?"Coordinated Universal Time":""}var $o=SU.prototype;$o.add=LWo;$o.calendar=OWo;$o.clone=VWo;$o.diff=$Wo;$o.endOf=lNo;$o.format=tNo;$o.from=nNo;$o.fromNow=oNo;$o.to=rNo;$o.toNow=iNo;$o.get=Gko;$o.invalidAt=mNo;$o.isAfter=_Wo;$o.isBefore=GWo;$o.isBetween=XWo;$o.isSame=JWo;$o.isSameOrAfter=KWo;$o.isSameOrBefore=qWo;$o.isValid=pNo;$o.lang=n0t;$o.locale=t0t;$o.localeData=o0t;$o.max=pWo;$o.min=hWo;$o.parsingFlags=gNo;$o.set=Xko;$o.startOf=aNo;$o.subtract=WWo;$o.toArray=dNo;$o.toObject=fNo;$o.toDate=uNo;$o.toISOString=ZWo;$o.inspect=eNo;typeof Symbol<"u"&&Symbol.for!=null&&($o[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});$o.toJSON=hNo;$o.toString=QWo;$o.unix=cNo;$o.valueOf=sNo;$o.creationData=yNo;$o.eraName=xNo;$o.eraNarrow=bNo;$o.eraAbbr=SNo;$o.eraYear=TNo;$o.year=Uct;$o.isLeapYear=fLo;$o.weekYear=zNo;$o.isoWeekYear=DNo;$o.quarter=$o.quarters=NNo;$o.month=Wct;$o.daysInMonth=cLo;$o.week=$o.weeks=ALo;$o.isoWeek=$o.isoWeeks=wLo;$o.weeksInYear=kNo;$o.weeksInWeekYear=LNo;$o.isoWeeksInYear=ENo;$o.isoWeeksInISOWeekYear=FNo;$o.date=s0t;$o.day=$o.days=DLo;$o.weekday=ELo;$o.isoWeekday=FLo;$o.dayOfYear=UNo;$o.hour=$o.hours=BLo;$o.minute=$o.minutes=jNo;$o.second=$o.seconds=BNo;$o.millisecond=$o.milliseconds=c0t;$o.utcOffset=SWo;$o.utc=PWo;$o.local=CWo;$o.parseZone=RWo;$o.hasAlignedHourOffset=HWo;$o.isDST=MWo;$o.isLocal=zWo;$o.isUtcOffset=DWo;$o.isUtc=$ct;$o.isUTC=$ct;$o.zoneAbbr=ONo;$o.zoneName=VNo;$o.dates=my("dates accessor is deprecated. Use date instead.",s0t);$o.months=my("months accessor is deprecated. Use month instead",Wct);$o.years=my("years accessor is deprecated. Use year instead",Uct);$o.zone=my("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",TWo);$o.isDSTShifted=my("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",IWo);function _No(t){return xc(t*1e3)}function GNo(){return xc.apply(null,arguments).parseZone()}function u0t(t){return t}var Ol=A6e.prototype;Ol.calendar=Dko;Ol.longDateFormat=Lko;Ol.invalidDate=Nko;Ol.ordinal=Bko;Ol.preparse=u0t;Ol.postformat=u0t;Ol.relativeTime=Oko;Ol.pastFuture=Vko;Ol.set=Iko;Ol.eras=ANo;Ol.erasParse=wNo;Ol.erasConvertYear=vNo;Ol.erasAbbrRegex=CNo;Ol.erasNameRegex=PNo;Ol.erasNarrowRegex=RNo;Ol.months=iLo;Ol.monthsShort=aLo;Ol.monthsParse=sLo;Ol.monthsRegex=dLo;Ol.monthsShortRegex=uLo;Ol.week=pLo;Ol.firstDayOfYear=yLo;Ol.firstDayOfWeek=mLo;Ol.weekdays=RLo;Ol.weekdaysMin=MLo;Ol.weekdaysShort=HLo;Ol.weekdaysParse=zLo;Ol.weekdaysRegex=kLo;Ol.weekdaysShortRegex=LLo;Ol.weekdaysMinRegex=WLo;Ol.isPM=ULo;Ol.meridiem=YLo;function IK(t,e,n,o){var r=IA(),i=b3().set(o,e);return r[n](i,t)}function d0t(t,e,n){if(hA(t)&&(e=t,t=void 0),t=t||"",e!=null)return IK(t,e,n,"month");var o,r=[];for(o=0;o<12;o++)r[o]=IK(t,o,n,"month");return r}function F6e(t,e,n,o){typeof t=="boolean"?(hA(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,hA(e)&&(n=e,e=void 0),e=e||"");var r=IA(),i=t?r._week.dow:0,a,l=[];if(n!=null)return IK(e,(n+i)%7,o,"day");for(a=0;a<7;a++)l[a]=IK(e,(a+i)%7,o,"day");return l}function XNo(t,e){return d0t(t,e,"months")}function JNo(t,e){return d0t(t,e,"monthsShort")}function KNo(t,e,n){return F6e(t,e,n,"weekdays")}function qNo(t,e,n){return F6e(t,e,n,"weekdaysShort")}function $No(t,e,n){return F6e(t,e,n,"weekdaysMin")}Q8("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=Wa(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}});yr.lang=my("moment.lang is deprecated. Use moment.locale instead.",Q8);yr.langData=my("moment.langData is deprecated. Use moment.localeData instead.",IA);var d6=Math.abs;function QNo(){var t=this._data;return this._milliseconds=d6(this._milliseconds),this._days=d6(this._days),this._months=d6(this._months),t.milliseconds=d6(t.milliseconds),t.seconds=d6(t.seconds),t.minutes=d6(t.minutes),t.hours=d6(t.hours),t.months=d6(t.months),t.years=d6(t.years),this}function f0t(t,e,n,o){var r=h5(e,n);return t._milliseconds+=o*r._milliseconds,t._days+=o*r._days,t._months+=o*r._months,t._bubble()}function ZNo(t,e){return f0t(this,t,e,1)}function eUo(t,e){return f0t(this,t,e,-1)}function UFe(t){return t<0?Math.floor(t):Math.ceil(t)}function tUo(){var t=this._milliseconds,e=this._days,n=this._months,o=this._data,r,i,a,l,s;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=UFe(wpe(n)+e)*864e5,e=0,n=0),o.milliseconds=t%1e3,r=zm(t/1e3),o.seconds=r%60,i=zm(r/60),o.minutes=i%60,a=zm(i/60),o.hours=a%24,e+=zm(a/24),s=zm(h0t(e)),n+=s,e-=UFe(wpe(s)),l=zm(n/12),n%=12,o.days=e,o.months=n,o.years=l,this}function h0t(t){return t*4800/146097}function wpe(t){return t*146097/4800}function nUo(t){if(!this.isValid())return NaN;var e,n,o=this._milliseconds;if(t=yy(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+o/864e5,n=this._months+h0t(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(wpe(this._months)),t){case"week":return e/7+o/6048e5;case"day":return e+o/864e5;case"hour":return e*24+o/36e5;case"minute":return e*1440+o/6e4;case"second":return e*86400+o/1e3;case"millisecond":return Math.floor(e*864e5)+o;default:throw new Error("Unknown unit "+t)}}function oUo(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Wa(this._months/12)*31536e6:NaN}function zA(t){return function(){return this.as(t)}}var rUo=zA("ms"),iUo=zA("s"),aUo=zA("m"),lUo=zA("h"),sUo=zA("d"),cUo=zA("w"),uUo=zA("M"),dUo=zA("Q"),fUo=zA("y");function hUo(){return h5(this)}function pUo(t){return t=yy(t),this.isValid()?this[t+"s"]():NaN}function AS(t){return function(){return this.isValid()?this._data[t]:NaN}}var gUo=AS("milliseconds"),mUo=AS("seconds"),yUo=AS("minutes"),AUo=AS("hours"),wUo=AS("days"),vUo=AS("months"),xUo=AS("years");function bUo(){return zm(this.days()/7)}var m6=Math.round,yC={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function SUo(t,e,n,o,r){return r.relativeTime(e||1,!!n,t,o)}function TUo(t,e,n,o){var r=h5(t).abs(),i=m6(r.as("s")),a=m6(r.as("m")),l=m6(r.as("h")),s=m6(r.as("d")),c=m6(r.as("M")),u=m6(r.as("w")),d=m6(r.as("y")),f=i<=n.ss&&["s",i]||i0,f[4]=o,SUo.apply(null,f)}function PUo(t){return t===void 0?m6:typeof t=="function"?(m6=t,!0):!1}function CUo(t,e){return yC[t]===void 0?!1:e===void 0?yC[t]:(yC[t]=e,t==="s"&&(yC.ss=e-1),!0)}function RUo(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,o=yC,r,i;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(o=Object.assign({},yC,e),e.s!=null&&e.ss==null&&(o.ss=e.s-1)),r=this.localeData(),i=TUo(this,!n,o,r),n&&(i=r.pastFuture(+this,i)),r.postformat(i)}var Ble=Math.abs;function aP(t){return(t>0)-(t<0)||+t}function Rte(){if(!this.isValid())return this.localeData().invalidDate();var t=Ble(this._milliseconds)/1e3,e=Ble(this._days),n=Ble(this._months),o,r,i,a,l=this.asSeconds(),s,c,u,d;return l?(o=zm(t/60),r=zm(o/60),t%=60,o%=60,i=zm(n/12),n%=12,a=t?t.toFixed(3).replace(/\.?0+$/,""):"",s=l<0?"-":"",c=aP(this._months)!==aP(l)?"-":"",u=aP(this._days)!==aP(l)?"-":"",d=aP(this._milliseconds)!==aP(l)?"-":"",s+"P"+(i?c+i+"Y":"")+(n?c+n+"M":"")+(e?u+e+"D":"")+(r||o||t?"T":"")+(r?d+r+"H":"")+(o?d+o+"M":"")+(t?d+a+"S":"")):"P0D"}var vl=Pte.prototype;vl.isValid=wWo;vl.abs=QNo;vl.add=ZNo;vl.subtract=eUo;vl.as=nUo;vl.asMilliseconds=rUo;vl.asSeconds=iUo;vl.asMinutes=aUo;vl.asHours=lUo;vl.asDays=sUo;vl.asWeeks=cUo;vl.asMonths=uUo;vl.asQuarters=dUo;vl.asYears=fUo;vl.valueOf=oUo;vl._bubble=tUo;vl.clone=hUo;vl.get=pUo;vl.milliseconds=gUo;vl.seconds=mUo;vl.minutes=yUo;vl.hours=AUo;vl.days=wUo;vl.weeks=bUo;vl.months=vUo;vl.years=xUo;vl.humanize=RUo;vl.toISOString=Rte;vl.toString=Rte;vl.toJSON=Rte;vl.locale=t0t;vl.localeData=o0t;vl.toIsoString=my("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Rte);vl.lang=n0t;pi("X",0,0,"unix");pi("x",0,0,"valueOf");Wr("x",xte);Wr("X",Kko);Rs("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)});Rs("x",function(t,e,n){n._d=new Date(Wa(t))});//! moment.js +`+new Error().stack),n=!1}return e.apply(this,arguments)},e)}var LFe={};function Cct(t,e){yr.deprecationHandler!=null&&yr.deprecationHandler(t,e),LFe[t]||(Pct(e),LFe[t]=!0)}yr.suppressDeprecationWarnings=!1;yr.deprecationHandler=null;function S3(t){return typeof Function<"u"&&t instanceof Function||Object.prototype.toString.call(t)==="[object Function]"}function Iko(t){var e,n;for(n in t)Bl(t,n)&&(e=t[n],S3(e)?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function ppe(t,e){var n=z8({},t),o;for(o in e)Bl(e,o)&&(Ux(t[o])&&Ux(e[o])?(n[o]={},z8(n[o],t[o]),z8(n[o],e[o])):e[o]!=null?n[o]=e[o]:delete n[o]);for(o in t)Bl(t,o)&&!Bl(e,o)&&Ux(t[o])&&(n[o]=z8({},n[o]));return n}function A6e(t){t!=null&&this.set(t)}var gpe;Object.keys?gpe=Object.keys:gpe=function(t){var e,n=[];for(e in t)Bl(t,e)&&n.push(e);return n};var zko={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function Dko(t,e,n){var o=this._calendar[t]||this._calendar.sameElse;return S3(o)?o.call(e,n):o}function Z9(t,e,n){var o=""+Math.abs(t),r=e-o.length,i=t>=0;return(i?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+o}var w6e=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,dV=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ule={},_C={};function pi(t,e,n,o){var r=o;typeof o=="string"&&(r=function(){return this[o]()}),t&&(_C[t]=r),e&&(_C[e[0]]=function(){return Z9(r.apply(this,arguments),e[1],e[2])}),n&&(_C[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function Eko(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Fko(t){var e=t.match(w6e),n,o;for(n=0,o=e.length;n=0&&dV.test(t);)t=t.replace(dV,o),dV.lastIndex=0,n-=1;return t}var kko={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function Lko(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(w6e).map(function(o){return o==="MMMM"||o==="MM"||o==="DD"||o==="dddd"?o.slice(1):o}).join(""),this._longDateFormat[t])}var Wko="Invalid date";function Nko(){return this._invalidDate}var Uko="%d",jko=/\d{1,2}/;function Bko(t){return this._ordinal.replace("%d",t)}var Yko={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function Oko(t,e,n,o){var r=this._relativeTime[n];return S3(r)?r(t,e,n,o):r.replace(/%d/i,t)}function Vko(t,e){var n=this._relativeTime[t>0?"future":"past"];return S3(n)?n(e):n.replace(/%s/i,e)}var rF={};function Ch(t,e){var n=t.toLowerCase();rF[n]=rF[n+"s"]=rF[e]=t}function yy(t){return typeof t=="string"?rF[t]||rF[t.toLowerCase()]:void 0}function v6e(t){var e={},n,o;for(o in t)Bl(t,o)&&(n=yy(o),n&&(e[n]=t[o]));return e}var Hct={};function Rh(t,e){Hct[t]=e}function _ko(t){var e=[],n;for(n in t)Bl(t,n)&&e.push({unit:n,priority:Hct[n]});return e.sort(function(o,r){return o.priority-r.priority}),e}function yte(t){return t%4===0&&t%100!==0||t%400===0}function zm(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function Wa(t){var e=+t,n=0;return e!==0&&isFinite(e)&&(n=zm(e)),n}function BM(t,e){return function(n){return n!=null?(Mct(this,t,n),yr.updateOffset(this,e),this):PK(this,t)}}function PK(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function Mct(t,e,n){t.isValid()&&!isNaN(n)&&(e==="FullYear"&&yte(t.year())&&t.month()===1&&t.date()===29?(n=Wa(n),t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),Ste(n,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](n))}function Gko(t){return t=yy(t),S3(this[t])?this[t]():this}function Xko(t,e){if(typeof t=="object"){t=v6e(t);var n=_ko(t),o,r=n.length;for(o=0;o68?1900:2e3)};var Uct=BM("FullYear",!0);function fLo(){return yte(this.year())}function hLo(t,e,n,o,r,i,a){var l;return t<100&&t>=0?(l=new Date(t+400,e,n,o,r,i,a),isFinite(l.getFullYear())&&l.setFullYear(t)):l=new Date(t,e,n,o,r,i,a),l}function VL(t){var e,n;return t<100&&t>=0?(n=Array.prototype.slice.call(arguments),n[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function RK(t,e,n){var o=7+e-n,r=(7+VL(t,0,o).getUTCDay()-e)%7;return-r+o-1}function jct(t,e,n,o,r){var i=(7+n-o)%7,a=RK(t,o,r),l=1+7*(e-1)+i+a,s,c;return l<=0?(s=t-1,c=iF(s)+l):l>iF(t)?(s=t+1,c=l-iF(t)):(s=t,c=l),{year:s,dayOfYear:c}}function _L(t,e,n){var o=RK(t.year(),e,n),r=Math.floor((t.dayOfYear()-o-1)/7)+1,i,a;return r<1?(a=t.year()-1,i=r+_6(a,e,n)):r>_6(t.year(),e,n)?(i=r-_6(t.year(),e,n),a=t.year()+1):(a=t.year(),i=r),{week:i,year:a}}function _6(t,e,n){var o=RK(t,e,n),r=RK(t+1,e,n);return(iF(t)-o+r)/7}pi("w",["ww",2],"wo","week");pi("W",["WW",2],"Wo","isoWeek");Ch("week","w");Ch("isoWeek","W");Rh("week",5);Rh("isoWeek",5);Wr("w",Pc);Wr("ww",Pc,Bg);Wr("W",Pc);Wr("WW",Pc,Bg);PU(["w","ww","W","WW"],function(t,e,n,o){e[o.substr(0,1)]=Wa(t)});function pLo(t){return _L(t,this._week.dow,this._week.doy).week}var gLo={dow:0,doy:6};function mLo(){return this._week.dow}function yLo(){return this._week.doy}function ALo(t){var e=this.localeData().week(this);return t==null?e:this.add((t-e)*7,"d")}function wLo(t){var e=_L(this,1,4).week;return t==null?e:this.add((t-e)*7,"d")}pi("d",0,"do","day");pi("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)});pi("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)});pi("dddd",0,0,function(t){return this.localeData().weekdays(this,t)});pi("e",0,0,"weekday");pi("E",0,0,"isoWeekday");Ch("day","d");Ch("weekday","e");Ch("isoWeekday","E");Rh("day",11);Rh("weekday",11);Rh("isoWeekday",11);Wr("d",Pc);Wr("e",Pc);Wr("E",Pc);Wr("dd",function(t,e){return e.weekdaysMinRegex(t)});Wr("ddd",function(t,e){return e.weekdaysShortRegex(t)});Wr("dddd",function(t,e){return e.weekdaysRegex(t)});PU(["dd","ddd","dddd"],function(t,e,n,o){var r=n._locale.weekdaysParse(t,o,n._strict);r!=null?e.d=r:va(n).invalidWeekday=t});PU(["d","e","E"],function(t,e,n,o){e[o]=Wa(t)});function vLo(t,e){return typeof t!="string"?t:isNaN(t)?(t=e.weekdaysParse(t),typeof t=="number"?t:null):parseInt(t,10)}function xLo(t,e){return typeof t=="string"?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function S6e(t,e){return t.slice(e,7).concat(t.slice(0,e))}var bLo="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bct="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),SLo="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),TLo=TU,PLo=TU,CLo=TU;function RLo(t,e){var n=K2(this._weekdays)?this._weekdays:this._weekdays[t&&t!==!0&&this._weekdays.isFormat.test(e)?"format":"standalone"];return t===!0?S6e(n,this._week.dow):t?n[t.day()]:n}function HLo(t){return t===!0?S6e(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort}function MLo(t){return t===!0?S6e(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin}function ILo(t,e,n){var o,r,i,a=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)i=b3([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(i,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(i,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(i,"").toLocaleLowerCase();return n?e==="dddd"?(r=E0.call(this._weekdaysParse,a),r!==-1?r:null):e==="ddd"?(r=E0.call(this._shortWeekdaysParse,a),r!==-1?r:null):(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null):e==="dddd"?(r=E0.call(this._weekdaysParse,a),r!==-1||(r=E0.call(this._shortWeekdaysParse,a),r!==-1)?r:(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null)):e==="ddd"?(r=E0.call(this._shortWeekdaysParse,a),r!==-1||(r=E0.call(this._weekdaysParse,a),r!==-1)?r:(r=E0.call(this._minWeekdaysParse,a),r!==-1?r:null)):(r=E0.call(this._minWeekdaysParse,a),r!==-1||(r=E0.call(this._weekdaysParse,a),r!==-1)?r:(r=E0.call(this._shortWeekdaysParse,a),r!==-1?r:null))}function zLo(t,e,n){var o,r,i;if(this._weekdaysParseExact)return ILo.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(r=b3([2e3,1]).day(o),n&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(r,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(r,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(r,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[o]||(i="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[o]=new RegExp(i.replace(".",""),"i")),n&&e==="dddd"&&this._fullWeekdaysParse[o].test(t))return o;if(n&&e==="ddd"&&this._shortWeekdaysParse[o].test(t))return o;if(n&&e==="dd"&&this._minWeekdaysParse[o].test(t))return o;if(!n&&this._weekdaysParse[o].test(t))return o}}function DLo(t){if(!this.isValid())return t!=null?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return t!=null?(t=vLo(t,this.localeData()),this.add(t-e,"d")):e}function ELo(t){if(!this.isValid())return t!=null?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return t==null?e:this.add(t-e,"d")}function FLo(t){if(!this.isValid())return t!=null?this:NaN;if(t!=null){var e=xLo(t,this.localeData());return this.day(this.day()%7?e:e-7)}else return this.day()||7}function kLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(Bl(this,"_weekdaysRegex")||(this._weekdaysRegex=TLo),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function LLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Bl(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=PLo),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function WLo(t){return this._weekdaysParseExact?(Bl(this,"_weekdaysRegex")||T6e.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Bl(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=CLo),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function T6e(){function t(u,d){return d.length-u.length}var e=[],n=[],o=[],r=[],i,a,l,s,c;for(i=0;i<7;i++)a=b3([2e3,1]).day(i),l=sg(this.weekdaysMin(a,"")),s=sg(this.weekdaysShort(a,"")),c=sg(this.weekdays(a,"")),e.push(l),n.push(s),o.push(c),r.push(l),r.push(s),r.push(c);e.sort(t),n.sort(t),o.sort(t),r.sort(t),this._weekdaysRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+n.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+e.join("|")+")","i")}function P6e(){return this.hours()%12||12}function NLo(){return this.hours()||24}pi("H",["HH",2],0,"hour");pi("h",["hh",2],0,P6e);pi("k",["kk",2],0,NLo);pi("hmm",0,0,function(){return""+P6e.apply(this)+Z9(this.minutes(),2)});pi("hmmss",0,0,function(){return""+P6e.apply(this)+Z9(this.minutes(),2)+Z9(this.seconds(),2)});pi("Hmm",0,0,function(){return""+this.hours()+Z9(this.minutes(),2)});pi("Hmmss",0,0,function(){return""+this.hours()+Z9(this.minutes(),2)+Z9(this.seconds(),2)});function Yct(t,e){pi(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}Yct("a",!0);Yct("A",!1);Ch("hour","h");Rh("hour",13);function Oct(t,e){return e._meridiemParse}Wr("a",Oct);Wr("A",Oct);Wr("H",Pc);Wr("h",Pc);Wr("k",Pc);Wr("HH",Pc,Bg);Wr("hh",Pc,Bg);Wr("kk",Pc,Bg);Wr("hmm",Dct);Wr("hmmss",Ect);Wr("Hmm",Dct);Wr("Hmmss",Ect);Rs(["H","HH"],Uu);Rs(["k","kk"],function(t,e,n){var o=Wa(t);e[Uu]=o===24?0:o});Rs(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t});Rs(["h","hh"],function(t,e,n){e[Uu]=Wa(t),va(n).bigHour=!0});Rs("hmm",function(t,e,n){var o=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o)),va(n).bigHour=!0});Rs("hmmss",function(t,e,n){var o=t.length-4,r=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o,2)),e[E6]=Wa(t.substr(r)),va(n).bigHour=!0});Rs("Hmm",function(t,e,n){var o=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o))});Rs("Hmmss",function(t,e,n){var o=t.length-4,r=t.length-2;e[Uu]=Wa(t.substr(0,o)),e[H2]=Wa(t.substr(o,2)),e[E6]=Wa(t.substr(r))});function ULo(t){return(t+"").toLowerCase().charAt(0)==="p"}var jLo=/[ap]\.?m?\.?/i,BLo=BM("Hours",!0);function YLo(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}var Vct={calendar:zko,longDateFormat:kko,invalidDate:Wko,ordinal:Uko,dayOfMonthOrdinalParse:jko,relativeTime:Yko,months:nLo,monthsShort:Fct,week:gLo,weekdays:bLo,weekdaysMin:SLo,weekdaysShort:Bct,meridiemParse:jLo},kc={},xD={},GL;function OLo(t,e){var n,o=Math.min(t.length,e.length);for(n=0;n0;){if(r=Tte(i.slice(0,n).join("-")),r)return r;if(o&&o.length>=n&&OLo(i,o)>=n-1)break;n--}e++}return GL}function _Lo(t){return t.match("^[^/\\\\]*$")!=null}function Tte(t){var e=null,n;if(kc[t]===void 0&&typeof ph<"u"&&ph&&ph.exports&&_Lo(t))try{e=GL._abbr,n=require,n("./locale/"+t),Q8(e)}catch{kc[t]=null}return kc[t]}function Q8(t,e){var n;return t&&(Fp(e)?n=IA(t):n=C6e(t,e),n?GL=n:typeof console<"u"&&console.warn&&console.warn("Locale "+t+" not found. Did you forget to load it?")),GL._abbr}function C6e(t,e){if(e!==null){var n,o=Vct;if(e.abbr=t,kc[t]!=null)Cct("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),o=kc[t]._config;else if(e.parentLocale!=null)if(kc[e.parentLocale]!=null)o=kc[e.parentLocale]._config;else if(n=Tte(e.parentLocale),n!=null)o=n._config;else return xD[e.parentLocale]||(xD[e.parentLocale]=[]),xD[e.parentLocale].push({name:t,config:e}),null;return kc[t]=new A6e(ppe(o,e)),xD[t]&&xD[t].forEach(function(r){C6e(r.name,r.config)}),Q8(t),kc[t]}else return delete kc[t],null}function GLo(t,e){if(e!=null){var n,o,r=Vct;kc[t]!=null&&kc[t].parentLocale!=null?kc[t].set(ppe(kc[t]._config,e)):(o=Tte(t),o!=null&&(r=o._config),e=ppe(r,e),o==null&&(e.abbr=t),n=new A6e(e),n.parentLocale=kc[t],kc[t]=n),Q8(t)}else kc[t]!=null&&(kc[t].parentLocale!=null?(kc[t]=kc[t].parentLocale,t===Q8()&&Q8(t)):kc[t]!=null&&delete kc[t]);return kc[t]}function IA(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return GL;if(!K2(t)){if(e=Tte(t),e)return e;t=[t]}return VLo(t)}function XLo(){return gpe(kc)}function R6e(t){var e,n=t._a;return n&&va(t).overflow===-2&&(e=n[D6]<0||n[D6]>11?D6:n[h9]<1||n[h9]>Ste(n[mh],n[D6])?h9:n[Uu]<0||n[Uu]>24||n[Uu]===24&&(n[H2]!==0||n[E6]!==0||n[lx]!==0)?Uu:n[H2]<0||n[H2]>59?H2:n[E6]<0||n[E6]>59?E6:n[lx]<0||n[lx]>999?lx:-1,va(t)._overflowDayOfYear&&(eh9)&&(e=h9),va(t)._overflowWeeks&&e===-1&&(e=Zko),va(t)._overflowWeekday&&e===-1&&(e=eLo),va(t).overflow=e),t}var JLo=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,KLo=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qLo=/Z|[+-]\d\d(?::?\d\d)?/,fV=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],jle=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],$Lo=/^\/?Date\((-?\d+)/i,QLo=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,ZLo={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function _ct(t){var e,n,o=t._i,r=JLo.exec(o)||KLo.exec(o),i,a,l,s,c=fV.length,u=jle.length;if(r){for(va(t).iso=!0,e=0,n=c;eiF(a)||t._dayOfYear===0)&&(va(t)._overflowDayOfYear=!0),n=VL(a,0,t._dayOfYear),t._a[D6]=n.getUTCMonth(),t._a[h9]=n.getUTCDate()),e=0;e<3&&t._a[e]==null;++e)t._a[e]=o[e]=r[e];for(;e<7;e++)t._a[e]=o[e]=t._a[e]==null?e===2?1:0:t._a[e];t._a[Uu]===24&&t._a[H2]===0&&t._a[E6]===0&&t._a[lx]===0&&(t._nextDay=!0,t._a[Uu]=0),t._d=(t._useUTC?VL:hLo).apply(null,o),i=t._useUTC?t._d.getUTCDay():t._d.getDay(),t._tzm!=null&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[Uu]=24),t._w&&typeof t._w.d<"u"&&t._w.d!==i&&(va(t).weekdayMismatch=!0)}}function lWo(t){var e,n,o,r,i,a,l,s,c;e=t._w,e.GG!=null||e.W!=null||e.E!=null?(i=1,a=4,n=kP(e.GG,t._a[mh],_L(xc(),1,4).year),o=kP(e.W,1),r=kP(e.E,1),(r<1||r>7)&&(s=!0)):(i=t._locale._week.dow,a=t._locale._week.doy,c=_L(xc(),i,a),n=kP(e.gg,t._a[mh],c.year),o=kP(e.w,c.week),e.d!=null?(r=e.d,(r<0||r>6)&&(s=!0)):e.e!=null?(r=e.e+i,(e.e<0||e.e>6)&&(s=!0)):r=i),o<1||o>_6(n,i,a)?va(t)._overflowWeeks=!0:s!=null?va(t)._overflowWeekday=!0:(l=jct(n,o,r,i,a),t._a[mh]=l.year,t._dayOfYear=l.dayOfYear)}yr.ISO_8601=function(){};yr.RFC_2822=function(){};function M6e(t){if(t._f===yr.ISO_8601){_ct(t);return}if(t._f===yr.RFC_2822){Gct(t);return}t._a=[],va(t).empty=!0;var e=""+t._i,n,o,r,i,a,l=e.length,s=0,c,u;for(r=Rct(t._f,t._locale).match(w6e)||[],u=r.length,n=0;n0&&va(t).unusedInput.push(a),e=e.slice(e.indexOf(o)+o.length),s+=o.length),_C[i]?(o?va(t).empty=!1:va(t).unusedTokens.push(i),Qko(i,o,t)):t._strict&&!o&&va(t).unusedTokens.push(i);va(t).charsLeftOver=l-s,e.length>0&&va(t).unusedInput.push(e),t._a[Uu]<=12&&va(t).bigHour===!0&&t._a[Uu]>0&&(va(t).bigHour=void 0),va(t).parsedDateParts=t._a.slice(0),va(t).meridiem=t._meridiem,t._a[Uu]=sWo(t._locale,t._a[Uu],t._meridiem),c=va(t).era,c!==null&&(t._a[mh]=t._locale.erasConvertYear(c,t._a[mh])),H6e(t),R6e(t)}function sWo(t,e,n){var o;return n==null?e:t.meridiemHour!=null?t.meridiemHour(e,n):(t.isPM!=null&&(o=t.isPM(n),o&&e<12&&(e+=12),!o&&e===12&&(e=0)),e)}function cWo(t){var e,n,o,r,i,a,l=!1,s=t._f.length;if(s===0){va(t).invalidFormat=!0,t._d=new Date(NaN);return}for(r=0;rthis?this:t:mte()});function Kct(t,e){var n,o;if(e.length===1&&K2(e[0])&&(e=e[0]),!e.length)return xc();for(n=e[0],o=1;othis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function IWo(){if(!Fp(this._isDSTShifted))return this._isDSTShifted;var t={},e;return y6e(t,this),t=Xct(t),t._a?(e=t._isUTC?b3(t._a):xc(t._a),this._isDSTShifted=this.isValid()&&xWo(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function zWo(){return this.isValid()?!this._isUTC:!1}function DWo(){return this.isValid()?this._isUTC:!1}function $ct(){return this.isValid()?this._isUTC&&this._offset===0:!1}var EWo=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,FWo=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function h5(t,e){var n=t,o=null,r,i,a;return x_(t)?n={ms:t._milliseconds,d:t._days,M:t._months}:hA(t)||!isNaN(+t)?(n={},e?n[e]=+t:n.milliseconds=+t):(o=EWo.exec(t))?(r=o[1]==="-"?-1:1,n={y:0,d:Wa(o[h9])*r,h:Wa(o[Uu])*r,m:Wa(o[H2])*r,s:Wa(o[E6])*r,ms:Wa(ype(o[lx]*1e3))*r}):(o=FWo.exec(t))?(r=o[1]==="-"?-1:1,n={y:lv(o[2],r),M:lv(o[3],r),w:lv(o[4],r),d:lv(o[5],r),h:lv(o[6],r),m:lv(o[7],r),s:lv(o[8],r)}):n==null?n={}:typeof n=="object"&&("from"in n||"to"in n)&&(a=kWo(xc(n.from),xc(n.to)),n={},n.ms=a.milliseconds,n.M=a.months),i=new Pte(n),x_(t)&&Bl(t,"_locale")&&(i._locale=t._locale),x_(t)&&Bl(t,"_isValid")&&(i._isValid=t._isValid),i}h5.fn=Pte.prototype;h5.invalid=vWo;function lv(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function NFe(t,e){var n={};return n.months=e.month()-t.month()+(e.year()-t.year())*12,t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function kWo(t,e){var n;return t.isValid()&&e.isValid()?(e=z6e(e,t),t.isBefore(e)?n=NFe(t,e):(n=NFe(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Qct(t,e){return function(n,o){var r,i;return o!==null&&!isNaN(+o)&&(Cct(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=o,o=i),r=h5(n,o),Zct(this,r,t),this}}function Zct(t,e,n,o){var r=e._milliseconds,i=ype(e._days),a=ype(e._months);t.isValid()&&(o=o??!0,a&&Lct(t,PK(t,"Month")+a*n),i&&Mct(t,"Date",PK(t,"Date")+i*n),r&&t._d.setTime(t._d.valueOf()+r*n),o&&yr.updateOffset(t,i||a))}var LWo=Qct(1,"add"),WWo=Qct(-1,"subtract");function e0t(t){return typeof t=="string"||t instanceof String}function NWo(t){return q2(t)||bU(t)||e0t(t)||hA(t)||jWo(t)||UWo(t)||t===null||t===void 0}function UWo(t){var e=Ux(t)&&!g6e(t),n=!1,o=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],r,i,a=o.length;for(r=0;rn.valueOf():n.valueOf()9999?v_(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):S3(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",v_(n,"Z")):v_(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function eNo(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="",n,o,r,i;return this.isLocal()||(t=this.utcOffset()===0?"moment.utc":"moment.parseZone",e="Z"),n="["+t+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",i=e+'[")]',this.format(n+o+r+i)}function tNo(t){t||(t=this.isUtc()?yr.defaultFormatUtc:yr.defaultFormat);var e=v_(this,t);return this.localeData().postformat(e)}function nNo(t,e){return this.isValid()&&(q2(t)&&t.isValid()||xc(t).isValid())?h5({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function oNo(t){return this.from(xc(),t)}function rNo(t,e){return this.isValid()&&(q2(t)&&t.isValid()||xc(t).isValid())?h5({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function iNo(t){return this.to(xc(),t)}function t0t(t){var e;return t===void 0?this._locale._abbr:(e=IA(t),e!=null&&(this._locale=e),this)}var n0t=my("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return t===void 0?this.localeData():this.locale(t)});function o0t(){return this._locale}var HK=1e3,GC=60*HK,MK=60*GC,r0t=(365*400+97)*24*MK;function XC(t,e){return(t%e+e)%e}function i0t(t,e,n){return t<100&&t>=0?new Date(t+400,e,n)-r0t:new Date(t,e,n).valueOf()}function a0t(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-r0t:Date.UTC(t,e,n)}function aNo(t){var e,n;if(t=yy(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?a0t:i0t,t){case"year":e=n(this.year(),0,1);break;case"quarter":e=n(this.year(),this.month()-this.month()%3,1);break;case"month":e=n(this.year(),this.month(),1);break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":e=n(this.year(),this.month(),this.date());break;case"hour":e=this._d.valueOf(),e-=XC(e+(this._isUTC?0:this.utcOffset()*GC),MK);break;case"minute":e=this._d.valueOf(),e-=XC(e,GC);break;case"second":e=this._d.valueOf(),e-=XC(e,HK);break}return this._d.setTime(e),yr.updateOffset(this,!0),this}function lNo(t){var e,n;if(t=yy(t),t===void 0||t==="millisecond"||!this.isValid())return this;switch(n=this._isUTC?a0t:i0t,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=MK-XC(e+(this._isUTC?0:this.utcOffset()*GC),MK)-1;break;case"minute":e=this._d.valueOf(),e+=GC-XC(e,GC)-1;break;case"second":e=this._d.valueOf(),e+=HK-XC(e,HK)-1;break}return this._d.setTime(e),yr.updateOffset(this,!0),this}function sNo(){return this._d.valueOf()-(this._offset||0)*6e4}function cNo(){return Math.floor(this.valueOf()/1e3)}function uNo(){return new Date(this.valueOf())}function dNo(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function fNo(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function hNo(){return this.isValid()?this.toISOString():null}function pNo(){return m6e(this)}function gNo(){return z8({},va(this))}function mNo(){return va(this).overflow}function yNo(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}pi("N",0,0,"eraAbbr");pi("NN",0,0,"eraAbbr");pi("NNN",0,0,"eraAbbr");pi("NNNN",0,0,"eraName");pi("NNNNN",0,0,"eraNarrow");pi("y",["y",1],"yo","eraYear");pi("y",["yy",2],0,"eraYear");pi("y",["yyy",3],0,"eraYear");pi("y",["yyyy",4],0,"eraYear");Wr("N",D6e);Wr("NN",D6e);Wr("NNN",D6e);Wr("NNNN",HNo);Wr("NNNNN",MNo);Rs(["N","NN","NNN","NNNN","NNNNN"],function(t,e,n,o){var r=n._locale.erasParse(t,o,n._strict);r?va(n).era=r:va(n).invalidEra=t});Wr("y",YM);Wr("yy",YM);Wr("yyy",YM);Wr("yyyy",YM);Wr("yo",INo);Rs(["y","yy","yyy","yyyy"],mh);Rs(["yo"],function(t,e,n,o){var r;n._locale._eraYearOrdinalRegex&&(r=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[mh]=n._locale.eraYearOrdinalParse(t,r):e[mh]=parseInt(t,10)});function ANo(t,e){var n,o,r,i=this._eras||IA("en")._eras;for(n=0,o=i.length;n=0)return i[o]}function vNo(t,e){var n=t.since<=t.until?1:-1;return e===void 0?yr(t.since).year():yr(t.since).year()+(e-t.offset)*n}function xNo(){var t,e,n,o=this.localeData().eras();for(t=0,e=o.length;ti&&(e=i),WNo.call(this,t,e,n,o,r))}function WNo(t,e,n,o,r){var i=jct(t,e,n,o,r),a=VL(i.year,0,i.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}pi("Q",0,"Qo","quarter");Ch("quarter","Q");Rh("quarter",7);Wr("Q",Ict);Rs("Q",function(t,e){e[D6]=(Wa(t)-1)*3});function NNo(t){return t==null?Math.ceil((this.month()+1)/3):this.month((t-1)*3+this.month()%3)}pi("D",["DD",2],"Do","date");Ch("date","D");Rh("date",9);Wr("D",Pc);Wr("DD",Pc,Bg);Wr("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient});Rs(["D","DD"],h9);Rs("Do",function(t,e){e[h9]=Wa(t.match(Pc)[0])});var s0t=BM("Date",!0);pi("DDD",["DDDD",3],"DDDo","dayOfYear");Ch("dayOfYear","DDD");Rh("dayOfYear",4);Wr("DDD",wte);Wr("DDDD",zct);Rs(["DDD","DDDD"],function(t,e,n){n._dayOfYear=Wa(t)});function UNo(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return t==null?e:this.add(t-e,"d")}pi("m",["mm",2],0,"minute");Ch("minute","m");Rh("minute",14);Wr("m",Pc);Wr("mm",Pc,Bg);Rs(["m","mm"],H2);var jNo=BM("Minutes",!1);pi("s",["ss",2],0,"second");Ch("second","s");Rh("second",15);Wr("s",Pc);Wr("ss",Pc,Bg);Rs(["s","ss"],E6);var BNo=BM("Seconds",!1);pi("S",0,0,function(){return~~(this.millisecond()/100)});pi(0,["SS",2],0,function(){return~~(this.millisecond()/10)});pi(0,["SSS",3],0,"millisecond");pi(0,["SSSS",4],0,function(){return this.millisecond()*10});pi(0,["SSSSS",5],0,function(){return this.millisecond()*100});pi(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});pi(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});pi(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});pi(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});Ch("millisecond","ms");Rh("millisecond",16);Wr("S",wte,Ict);Wr("SS",wte,Bg);Wr("SSS",wte,zct);var D8,c0t;for(D8="SSSS";D8.length<=9;D8+="S")Wr(D8,YM);function YNo(t,e){e[lx]=Wa(("0."+t)*1e3)}for(D8="S";D8.length<=9;D8+="S")Rs(D8,YNo);c0t=BM("Milliseconds",!1);pi("z",0,0,"zoneAbbr");pi("zz",0,0,"zoneName");function ONo(){return this._isUTC?"UTC":""}function VNo(){return this._isUTC?"Coordinated Universal Time":""}var $o=SU.prototype;$o.add=LWo;$o.calendar=OWo;$o.clone=VWo;$o.diff=$Wo;$o.endOf=lNo;$o.format=tNo;$o.from=nNo;$o.fromNow=oNo;$o.to=rNo;$o.toNow=iNo;$o.get=Gko;$o.invalidAt=mNo;$o.isAfter=_Wo;$o.isBefore=GWo;$o.isBetween=XWo;$o.isSame=JWo;$o.isSameOrAfter=KWo;$o.isSameOrBefore=qWo;$o.isValid=pNo;$o.lang=n0t;$o.locale=t0t;$o.localeData=o0t;$o.max=pWo;$o.min=hWo;$o.parsingFlags=gNo;$o.set=Xko;$o.startOf=aNo;$o.subtract=WWo;$o.toArray=dNo;$o.toObject=fNo;$o.toDate=uNo;$o.toISOString=ZWo;$o.inspect=eNo;typeof Symbol<"u"&&Symbol.for!=null&&($o[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});$o.toJSON=hNo;$o.toString=QWo;$o.unix=cNo;$o.valueOf=sNo;$o.creationData=yNo;$o.eraName=xNo;$o.eraNarrow=bNo;$o.eraAbbr=SNo;$o.eraYear=TNo;$o.year=Uct;$o.isLeapYear=fLo;$o.weekYear=zNo;$o.isoWeekYear=DNo;$o.quarter=$o.quarters=NNo;$o.month=Wct;$o.daysInMonth=cLo;$o.week=$o.weeks=ALo;$o.isoWeek=$o.isoWeeks=wLo;$o.weeksInYear=kNo;$o.weeksInWeekYear=LNo;$o.isoWeeksInYear=ENo;$o.isoWeeksInISOWeekYear=FNo;$o.date=s0t;$o.day=$o.days=DLo;$o.weekday=ELo;$o.isoWeekday=FLo;$o.dayOfYear=UNo;$o.hour=$o.hours=BLo;$o.minute=$o.minutes=jNo;$o.second=$o.seconds=BNo;$o.millisecond=$o.milliseconds=c0t;$o.utcOffset=SWo;$o.utc=PWo;$o.local=CWo;$o.parseZone=RWo;$o.hasAlignedHourOffset=HWo;$o.isDST=MWo;$o.isLocal=zWo;$o.isUtcOffset=DWo;$o.isUtc=$ct;$o.isUTC=$ct;$o.zoneAbbr=ONo;$o.zoneName=VNo;$o.dates=my("dates accessor is deprecated. Use date instead.",s0t);$o.months=my("months accessor is deprecated. Use month instead",Wct);$o.years=my("years accessor is deprecated. Use year instead",Uct);$o.zone=my("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",TWo);$o.isDSTShifted=my("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",IWo);function _No(t){return xc(t*1e3)}function GNo(){return xc.apply(null,arguments).parseZone()}function u0t(t){return t}var Ol=A6e.prototype;Ol.calendar=Dko;Ol.longDateFormat=Lko;Ol.invalidDate=Nko;Ol.ordinal=Bko;Ol.preparse=u0t;Ol.postformat=u0t;Ol.relativeTime=Oko;Ol.pastFuture=Vko;Ol.set=Iko;Ol.eras=ANo;Ol.erasParse=wNo;Ol.erasConvertYear=vNo;Ol.erasAbbrRegex=CNo;Ol.erasNameRegex=PNo;Ol.erasNarrowRegex=RNo;Ol.months=iLo;Ol.monthsShort=aLo;Ol.monthsParse=sLo;Ol.monthsRegex=dLo;Ol.monthsShortRegex=uLo;Ol.week=pLo;Ol.firstDayOfYear=yLo;Ol.firstDayOfWeek=mLo;Ol.weekdays=RLo;Ol.weekdaysMin=MLo;Ol.weekdaysShort=HLo;Ol.weekdaysParse=zLo;Ol.weekdaysRegex=kLo;Ol.weekdaysShortRegex=LLo;Ol.weekdaysMinRegex=WLo;Ol.isPM=ULo;Ol.meridiem=YLo;function IK(t,e,n,o){var r=IA(),i=b3().set(o,e);return r[n](i,t)}function d0t(t,e,n){if(hA(t)&&(e=t,t=void 0),t=t||"",e!=null)return IK(t,e,n,"month");var o,r=[];for(o=0;o<12;o++)r[o]=IK(t,o,n,"month");return r}function F6e(t,e,n,o){typeof t=="boolean"?(hA(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,hA(e)&&(n=e,e=void 0),e=e||"");var r=IA(),i=t?r._week.dow:0,a,l=[];if(n!=null)return IK(e,(n+i)%7,o,"day");for(a=0;a<7;a++)l[a]=IK(e,(a+i)%7,o,"day");return l}function XNo(t,e){return d0t(t,e,"months")}function JNo(t,e){return d0t(t,e,"monthsShort")}function KNo(t,e,n){return F6e(t,e,n,"weekdays")}function qNo(t,e,n){return F6e(t,e,n,"weekdaysShort")}function $No(t,e,n){return F6e(t,e,n,"weekdaysMin")}Q8("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=Wa(t%100/10)===1?"th":e===1?"st":e===2?"nd":e===3?"rd":"th";return t+n}});yr.lang=my("moment.lang is deprecated. Use moment.locale instead.",Q8);yr.langData=my("moment.langData is deprecated. Use moment.localeData instead.",IA);var d6=Math.abs;function QNo(){var t=this._data;return this._milliseconds=d6(this._milliseconds),this._days=d6(this._days),this._months=d6(this._months),t.milliseconds=d6(t.milliseconds),t.seconds=d6(t.seconds),t.minutes=d6(t.minutes),t.hours=d6(t.hours),t.months=d6(t.months),t.years=d6(t.years),this}function f0t(t,e,n,o){var r=h5(e,n);return t._milliseconds+=o*r._milliseconds,t._days+=o*r._days,t._months+=o*r._months,t._bubble()}function ZNo(t,e){return f0t(this,t,e,1)}function eUo(t,e){return f0t(this,t,e,-1)}function UFe(t){return t<0?Math.floor(t):Math.ceil(t)}function tUo(){var t=this._milliseconds,e=this._days,n=this._months,o=this._data,r,i,a,l,s;return t>=0&&e>=0&&n>=0||t<=0&&e<=0&&n<=0||(t+=UFe(wpe(n)+e)*864e5,e=0,n=0),o.milliseconds=t%1e3,r=zm(t/1e3),o.seconds=r%60,i=zm(r/60),o.minutes=i%60,a=zm(i/60),o.hours=a%24,e+=zm(a/24),s=zm(h0t(e)),n+=s,e-=UFe(wpe(s)),l=zm(n/12),n%=12,o.days=e,o.months=n,o.years=l,this}function h0t(t){return t*4800/146097}function wpe(t){return t*146097/4800}function nUo(t){if(!this.isValid())return NaN;var e,n,o=this._milliseconds;if(t=yy(t),t==="month"||t==="quarter"||t==="year")switch(e=this._days+o/864e5,n=this._months+h0t(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(wpe(this._months)),t){case"week":return e/7+o/6048e5;case"day":return e+o/864e5;case"hour":return e*24+o/36e5;case"minute":return e*1440+o/6e4;case"second":return e*86400+o/1e3;case"millisecond":return Math.floor(e*864e5)+o;default:throw new Error("Unknown unit "+t)}}function oUo(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Wa(this._months/12)*31536e6:NaN}function zA(t){return function(){return this.as(t)}}var rUo=zA("ms"),iUo=zA("s"),aUo=zA("m"),lUo=zA("h"),sUo=zA("d"),cUo=zA("w"),uUo=zA("M"),dUo=zA("Q"),fUo=zA("y");function hUo(){return h5(this)}function pUo(t){return t=yy(t),this.isValid()?this[t+"s"]():NaN}function AS(t){return function(){return this.isValid()?this._data[t]:NaN}}var gUo=AS("milliseconds"),mUo=AS("seconds"),yUo=AS("minutes"),AUo=AS("hours"),wUo=AS("days"),vUo=AS("months"),xUo=AS("years");function bUo(){return zm(this.days()/7)}var m6=Math.round,yC={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function SUo(t,e,n,o,r){return r.relativeTime(e||1,!!n,t,o)}function TUo(t,e,n,o){var r=h5(t).abs(),i=m6(r.as("s")),a=m6(r.as("m")),l=m6(r.as("h")),s=m6(r.as("d")),c=m6(r.as("M")),u=m6(r.as("w")),d=m6(r.as("y")),f=i<=n.ss&&["s",i]||i0,f[4]=o,SUo.apply(null,f)}function PUo(t){return t===void 0?m6:typeof t=="function"?(m6=t,!0):!1}function CUo(t,e){return yC[t]===void 0?!1:e===void 0?yC[t]:(yC[t]=e,t==="s"&&(yC.ss=e-1),!0)}function RUo(t,e){if(!this.isValid())return this.localeData().invalidDate();var n=!1,o=yC,r,i;return typeof t=="object"&&(e=t,t=!1),typeof t=="boolean"&&(n=t),typeof e=="object"&&(o=Object.assign({},yC,e),e.s!=null&&e.ss==null&&(o.ss=e.s-1)),r=this.localeData(),i=TUo(this,!n,o,r),n&&(i=r.pastFuture(+this,i)),r.postformat(i)}var Ble=Math.abs;function aP(t){return(t>0)-(t<0)||+t}function Rte(){if(!this.isValid())return this.localeData().invalidDate();var t=Ble(this._milliseconds)/1e3,e=Ble(this._days),n=Ble(this._months),o,r,i,a,l=this.asSeconds(),s,c,u,d;return l?(o=zm(t/60),r=zm(o/60),t%=60,o%=60,i=zm(n/12),n%=12,a=t?t.toFixed(3).replace(/\.?0+$/,""):"",s=l<0?"-":"",c=aP(this._months)!==aP(l)?"-":"",u=aP(this._days)!==aP(l)?"-":"",d=aP(this._milliseconds)!==aP(l)?"-":"",s+"P"+(i?c+i+"Y":"")+(n?c+n+"M":"")+(e?u+e+"D":"")+(r||o||t?"T":"")+(r?d+r+"H":"")+(o?d+o+"M":"")+(t?d+a+"S":"")):"P0D"}var vl=Pte.prototype;vl.isValid=wWo;vl.abs=QNo;vl.add=ZNo;vl.subtract=eUo;vl.as=nUo;vl.asMilliseconds=rUo;vl.asSeconds=iUo;vl.asMinutes=aUo;vl.asHours=lUo;vl.asDays=sUo;vl.asWeeks=cUo;vl.asMonths=uUo;vl.asQuarters=dUo;vl.asYears=fUo;vl.valueOf=oUo;vl._bubble=tUo;vl.clone=hUo;vl.get=pUo;vl.milliseconds=gUo;vl.seconds=mUo;vl.minutes=yUo;vl.hours=AUo;vl.days=wUo;vl.weeks=bUo;vl.months=vUo;vl.years=xUo;vl.humanize=RUo;vl.toISOString=Rte;vl.toString=Rte;vl.toJSON=Rte;vl.locale=t0t;vl.localeData=o0t;vl.toIsoString=my("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Rte);vl.lang=n0t;pi("X",0,0,"unix");pi("x",0,0,"valueOf");Wr("x",xte);Wr("X",Kko);Rs("X",function(t,e,n){n._d=new Date(parseFloat(t)*1e3)});Rs("x",function(t,e,n){n._d=new Date(Wa(t))});//! moment.js yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3;yr.unix=_No;yr.months=XNo;yr.isDate=bU;yr.locale=Q8;yr.invalid=mte;yr.duration=h5;yr.isMoment=q2;yr.weekdays=KNo;yr.parseZone=GNo;yr.localeData=IA;yr.isDuration=x_;yr.monthsShort=JNo;yr.weekdaysMin=$No;yr.defineLocale=C6e;yr.updateLocale=GLo;yr.locales=XLo;yr.weekdaysShort=qNo;yr.normalizeUnits=yy;yr.relativeTimeRounding=PUo;yr.relativeTimeThreshold=CUo;yr.calendarFormat=YWo;yr.prototype=$o;yr.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const HUo=Ho.div` position: fixed; top: 80px; @@ -8752,7 +8752,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,zUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=Cn(bOe),a=Cn(rxt),l=M(K4t),s=M(Ng),c=M(Sc),u=be.useRef(null),d=m.useRef(null),f=m.useRef(),p=d.current?d.current.clientWidth+40:l?l.width+40:640,g=d.current?d.current.clientHeight+100:l?l.height+100:460,[A,y]=m.useState({x:l?Math.max(l.x,p-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-g):0}),S=$t();m.useEffect(()=>{y({x:Math.max(l==null?void 0:l.x,p-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-g)})},[l,p,g]),m.useEffect(()=>{const b=()=>{y({x:Math.max(l==null?void 0:l.x,p-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-g)})};return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[l,p,g]),m.useEffect(()=>(d.current&&(f.current||(f.current=new ResizeObserver(()=>{o(b=>{d.current&&(b.viewState.dailyLightSensorPanelRect||(b.viewState.dailyLightSensorPanelRect=new cr(0,0,600,360)),b.viewState.dailyLightSensorPanelRect.width=d.current.offsetWidth,b.viewState.dailyLightSensorPanelRect.height=d.current.offsetHeight)})})),f.current.observe(d.current)),()=>{var b;(b=f.current)==null||b.disconnect()}),[]);const C=(b,R)=>{y({x:Math.max(R.x,p-window.innerWidth),y:Math.min(R.y,window.innerHeight-g)})},P=(b,R)=>{o(H=>{H.viewState.dailyLightSensorPanelRect||(H.viewState.dailyLightSensorPanelRect=new cr(0,0,600,360)),H.viewState.dailyLightSensorPanelRect.x=Math.max(R.x,p-window.innerWidth),H.viewState.dailyLightSensorPanelRect.y=Math.min(R.y,window.innerHeight-g)})},v=()=>{o(b=>{b.viewState.showDailyLightSensorPanel=!1,e&&(b.actionInfo={name:"Close Daily Light Sensor Graph",timestamp:new Date().getTime()})})},T=Y.t("word.Hour",S),w=Y.t("word.Radiation",S),x=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:u,handle:".handle",bounds:"parent",axis:"both",position:A,onDrag:C,onStop:P,onMouseDown:()=>{o(b=>{b.selectedFloatingWindow="dailyLightSensorPanel"})},children:h.jsx(HUo,{ref:u,style:{zIndex:c==="dailyLightSensorPanel"?bc:9},children:h.jsxs(MUo,{ref:d,style:{opacity:n,width:(l?l.width:600)+"px",height:(l?l.height:360)+"px"},children:[h.jsxs(IUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("sensorPanel.LightSensor",S)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",S)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{v()},onMouseDown:()=>{v()},children:`${Y.t("word.Close",S)}`})]}),h.jsx(Sf,{type:vi.DailyRadiationSensorData,chartType:Il.Line,dataSource:a,labels:i,height:100,dataKeyAxisX:"Hour",labelX:T,labelY:w,unitY:"kWh/m²",yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[h.jsx(io,{type:"default",icon:x?h.jsx(Th,{}):h.jsx(Rf,{}),title:Y.t(x?"word.Run":"word.Update",S),onClick:()=>{if(s(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",S));return}gn(Y.t("message.SimulationStarted",S)),setTimeout(()=>{o(R=>{e&&(R.actionInfo={name:"Collect Daily Data for Sensors",timestamp:new Date().getTime()})}),dt.getState().set(R=>{R.runDailyLightSensor=!0,R.pauseDailyLightSensor=!1,R.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",S),onClick:()=>{Ed("line-graph-"+T+"-"+w,"daily-light-sensor").then(()=>{gn(Y.t("message.ScreenshotSaved",S)),e&&o(b=>{b.actionInfo={name:"Take Screenshot of Daily Light Sensor Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:Y.t("word.SaveAsCsv",S),onClick:()=>{Sh(a,"daily-light-sensor.csv"),gn(Y.t("message.CsvFileSaved",S)),e&&o(b=>{b.actionInfo={name:"Export Daily Light Sensor Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),DUo=Ho.div` +`,zUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=Cn(bOe),a=Cn(rxt),l=M(K4t),s=M(Ng),c=M(Sc),u=be.useRef(null),d=m.useRef(null),f=m.useRef(),p=d.current?d.current.clientWidth+40:l?l.width+40:640,g=d.current?d.current.clientHeight+100:l?l.height+100:460,[A,y]=m.useState({x:l?Math.max(l.x,p-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-g):0}),S=$t();m.useEffect(()=>{y({x:Math.max(l==null?void 0:l.x,p-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-g)})},[l,p,g]),m.useEffect(()=>{const b=()=>{y({x:Math.max(l==null?void 0:l.x,p-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-g)})};return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[l,p,g]),m.useEffect(()=>(d.current&&(f.current||(f.current=new ResizeObserver(()=>{o(b=>{d.current&&(b.viewState.dailyLightSensorPanelRect||(b.viewState.dailyLightSensorPanelRect=new cr(0,0,600,360)),b.viewState.dailyLightSensorPanelRect.width=d.current.offsetWidth,b.viewState.dailyLightSensorPanelRect.height=d.current.offsetHeight)})})),f.current.observe(d.current)),()=>{var b;(b=f.current)==null||b.disconnect()}),[]);const C=(b,R)=>{y({x:Math.max(R.x,p-window.innerWidth),y:Math.min(R.y,window.innerHeight-g)})},P=(b,R)=>{o(H=>{H.viewState.dailyLightSensorPanelRect||(H.viewState.dailyLightSensorPanelRect=new cr(0,0,600,360)),H.viewState.dailyLightSensorPanelRect.x=Math.max(R.x,p-window.innerWidth),H.viewState.dailyLightSensorPanelRect.y=Math.min(R.y,window.innerHeight-g)})},v=()=>{o(b=>{b.viewState.showDailyLightSensorPanel=!1,e&&(b.actionInfo={name:"Close Daily Light Sensor Graph",timestamp:new Date().getTime()})})},T=Y.t("word.Hour",S),w=Y.t("word.Radiation",S),x=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:u,handle:".handle",bounds:"parent",axis:"both",position:A,onDrag:C,onStop:P,onMouseDown:()=>{o(b=>{b.selectedFloatingWindow="dailyLightSensorPanel"})},children:h.jsx(HUo,{ref:u,style:{zIndex:c==="dailyLightSensorPanel"?bc:9},children:h.jsxs(MUo,{ref:d,style:{opacity:n,width:(l?l.width:600)+"px",height:(l?l.height:360)+"px"},children:[h.jsxs(IUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("sensorPanel.LightSensor",S)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",S)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{v()},onMouseDown:()=>{v()},children:`${Y.t("word.Close",S)}`})]}),h.jsx(Sf,{type:vi.DailyRadiationSensorData,chartType:Il.Line,dataSource:a,labels:i,height:100,dataKeyAxisX:"Hour",labelX:T,labelY:w,unitY:"kWh/m²",yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[h.jsx(io,{type:"default",icon:x?h.jsx(Th,{}):h.jsx(Hf,{}),title:Y.t(x?"word.Run":"word.Update",S),onClick:()=>{if(s(z.Sensor)===0){gn(Y.t("analysisManager.NoSensorForCollectingData",S));return}gn(Y.t("message.SimulationStarted",S)),setTimeout(()=>{o(R=>{e&&(R.actionInfo={name:"Collect Daily Data for Sensors",timestamp:new Date().getTime()})}),dt.getState().set(R=>{R.runDailyLightSensor=!0,R.pauseDailyLightSensor=!1,R.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",S),onClick:()=>{Ed("line-graph-"+T+"-"+w,"daily-light-sensor").then(()=>{gn(Y.t("message.ScreenshotSaved",S)),e&&o(b=>{b.actionInfo={name:"Take Screenshot of Daily Light Sensor Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:Y.t("word.SaveAsCsv",S),onClick:()=>{Sh(a,"daily-light-sensor.csv"),gn(Y.t("message.CsvFileSaved",S)),e&&o(b=>{b.actionInfo={name:"Export Daily Light Sensor Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),DUo=Ho.div` position: fixed; top: 80px; left: 10px; @@ -8818,7 +8818,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; font-size: 12px; flex-direction: column; opacity: 100%; -`,UUo=be.memo(()=>{const t=M(pn),e=M(En),n=M(Lw),o=M(Ju)??!1,r=M(Yq)??!1,i=$t(),a=n.y>0?"navajowhite":"antiquewhite",l=ye.isMac(),s=c=>{t(u=>{u.viewState.navigationView=c,u.viewState.enableRotate=!c})};return h.jsx(WUo,{children:h.jsxs(NUo,{style:{color:a,fontSize:r?"10px":"9px"},children:[r&&h.jsxs("span",{style:{fontSize:"12px",paddingLeft:"6px",paddingRight:"6px",paddingTop:"2px",paddingBottom:"2px",marginBottom:"6px",background:"tomato",border:"1px solid"},children:[h.jsx("b",{children:Y.t("instructionPanel.NavigationMode",i)}),h.jsx(jw,{style:{paddingLeft:"6px",cursor:"pointer"},onClick:()=>{const c={name:"Close Navigation Mode",timestamp:Date.now(),undo:()=>{s(!0)},redo:()=>{s(!1)}};e(c),s(!1)}})]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t(r?"instructionPanel.DisableNavigation":"instructionPanel.EnableNavigation",i)}),": ",Y.t("word.Press",i)," ",l?"⌘":"Ctrl","+U"]}),r&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveForwardBack",i)}),":"," ",Y.t("instructionPanel.MoveForwardBackInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveLeftRight",i)}),":"," ",Y.t("instructionPanel.MoveLeftRightInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveUpDown",i)}),":"," ",Y.t("instructionPanel.MoveUpDownInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Turn",i)}),": ",Y.t("instructionPanel.TurnInstruction",i)]})]}),!o&&!r&&h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Rotate",i)}),": ",Y.t("instructionPanel.DragMouse",i)]}),!r&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Zoom",i)}),":"," ",Y.t(l?"instructionPanel.MouseWheelOrKeysMac":"instructionPanel.MouseWheelOrKeys",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Pan",i)}),":"," ",Y.t(l?"instructionPanel.HoldMetaDragMouse":"instructionPanel.HoldCtrlDragMouse",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t(o?"instructionPanel.Exit2DMode":"instructionPanel.Enter2DMode",i)}),":"," ",Y.t("word.Press",i)," ",l?"⌘":"Ctrl","+B"]})]})]})})}),jUo=Ho.div` +`,UUo=be.memo(()=>{const t=M(pn),e=M(En),n=M(Lw),o=M(Ju)??!1,r=M(Yq)??!1,i=$t(),a=n.y>0?"navajowhite":"antiquewhite",l=me.isMac(),s=c=>{t(u=>{u.viewState.navigationView=c,u.viewState.enableRotate=!c})};return h.jsx(WUo,{children:h.jsxs(NUo,{style:{color:a,fontSize:r?"10px":"9px"},children:[r&&h.jsxs("span",{style:{fontSize:"12px",paddingLeft:"6px",paddingRight:"6px",paddingTop:"2px",paddingBottom:"2px",marginBottom:"6px",background:"tomato",border:"1px solid"},children:[h.jsx("b",{children:Y.t("instructionPanel.NavigationMode",i)}),h.jsx(jw,{style:{paddingLeft:"6px",cursor:"pointer"},onClick:()=>{const c={name:"Close Navigation Mode",timestamp:Date.now(),undo:()=>{s(!0)},redo:()=>{s(!1)}};e(c),s(!1)}})]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t(r?"instructionPanel.DisableNavigation":"instructionPanel.EnableNavigation",i)}),": ",Y.t("word.Press",i)," ",l?"⌘":"Ctrl","+U"]}),r&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveForwardBack",i)}),":"," ",Y.t("instructionPanel.MoveForwardBackInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveLeftRight",i)}),":"," ",Y.t("instructionPanel.MoveLeftRightInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.MoveUpDown",i)}),":"," ",Y.t("instructionPanel.MoveUpDownInstruction",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Turn",i)}),": ",Y.t("instructionPanel.TurnInstruction",i)]})]}),!o&&!r&&h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Rotate",i)}),": ",Y.t("instructionPanel.DragMouse",i)]}),!r&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Zoom",i)}),":"," ",Y.t(l?"instructionPanel.MouseWheelOrKeysMac":"instructionPanel.MouseWheelOrKeys",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t("instructionPanel.Pan",i)}),":"," ",Y.t(l?"instructionPanel.HoldMetaDragMouse":"instructionPanel.HoldCtrlDragMouse",i)]}),h.jsxs("span",{children:[h.jsx("b",{children:Y.t(o?"instructionPanel.Exit2DMode":"instructionPanel.Enter2DMode",i)}),":"," ",Y.t("word.Press",i)," ",l?"⌘":"Ctrl","+B"]})]})]})})}),jUo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -8856,7 +8856,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,OUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(zH)??6,i=new Date(M(Al)),a=Cn(avt),l=M(eOe),s=Cn(tOe),c=M(Ng),u=M(n8t),d=dt(n5),f=M.getState().economicsParams,p=dt(Cf),g=M(Sc),A=be.useRef(null),y=m.useRef(null),S=y.current?y.current.clientWidth+40:640,C=y.current?y.current.clientHeight+100:500,[P,v]=m.useState({x:u?Math.max(u.x,S-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-C):0}),[T,w]=m.useState(0),[x,b]=m.useState(!1),R=m.useRef(new Map),H=m.useRef(),F=zs[i.getMonth()],E=$t(),N=c(z.SolarPanel);m.useEffect(()=>{let Q=0;R.current.clear();for(const se of a)for(const Z in se)Object.hasOwn(se,Z)&&Z!=="Month"&&(Q+=se[Z],R.current.set(Z,(R.current.get(Z)??0)+se[Z]));w(Q),b(!x)},[a]),m.useEffect(()=>{v({x:Math.max(u==null?void 0:u.x,S-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})},[u,S,C]),m.useEffect(()=>{const Q=()=>{v({x:Math.max(u==null?void 0:u.x,S-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})};return window.addEventListener("resize",Q),()=>{window.removeEventListener("resize",Q)}},[u,S,C]),m.useEffect(()=>(y.current&&(H.current||(H.current=new ResizeObserver(()=>{o(Q=>{y.current&&(Q.viewState.yearlyPvYieldPanelRect||(Q.viewState.yearlyPvYieldPanelRect=new cr(0,0,600,400)),Q.viewState.yearlyPvYieldPanelRect.width=y.current.offsetWidth,Q.viewState.yearlyPvYieldPanelRect.height=y.current.offsetHeight)})})),H.current.observe(y.current)),()=>{var Q;(Q=H.current)==null||Q.disconnect()}),[]);const U=(Q,se)=>{v({x:Math.max(se.x,S-window.innerWidth),y:Math.min(se.y,window.innerHeight-C)})},W=(Q,se)=>{o(Z=>{Z.viewState.yearlyPvYieldPanelRect||(Z.viewState.yearlyPvYieldPanelRect=new cr(0,0,600,400)),Z.viewState.yearlyPvYieldPanelRect.x=Math.max(se.x,S-window.innerWidth),Z.viewState.yearlyPvYieldPanelRect.y=Math.min(se.y,window.innerHeight-C)})},k=()=>{o(Q=>{Q.viewState.showYearlyPvYieldPanel=!1,e&&(Q.actionInfo={name:"Close Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()})})};m.useEffect(()=>{N<2&&l&&o(Q=>{Q.graphState&&(Q.graphState.yearlyPvIndividualOutputs=!1)})},[N,l]);const{t:D}=Xl(),L=D("word.Month",E),j=D("solarPanelYieldPanel.Yield",E),B=ye.countAllSolarPanels(),O=12/r,V=T*O,G=B*f.operationalCostPerUnit*365,q=V*f.electricitySellingPrice,$=q-G,ie=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:A,handle:".handle",bounds:"parent",axis:"both",position:P,onDrag:U,onStop:W,onMouseDown:()=>{o(Q=>{Q.selectedFloatingWindow="yearlyPvYieldPanel"})},children:h.jsx(jUo,{ref:A,style:{zIndex:g==="yearlyPvYieldPanel"?bc:9},children:h.jsxs(BUo,{ref:y,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(YUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[D("solarPanelYieldPanel.SolarPanelYearlyYield",E)+": ",h.jsx("span",{style:{fontSize:"10px"},children:D("sensorPanel.WeatherDataFrom",E)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{k()},onMouseDown:()=>{k()},children:D("word.Close",E)})]}),h.jsx(Sf,{type:vi.YearlyPvYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:Q,Clearness:se,...Z})=>Z),labels:s,height:100,dataKeyAxisX:"Month",labelX:L,labelY:j,unitY:D("word.kWh",E),yMin:0,curveType:"linear",fractionDigits:2,referenceX:F}),!p&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&N>1&&R.current.size>0?h.jsx(Ml,{title:D("shared.OutputBreakdown",E),content:[...R.current.entries()].map((Q,se)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:Q[0]+": "}),h.jsx(Ke,{span:8,children:(Q[1]*O).toFixed(2)})]}),se===R.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:D("word.Total",E)+": "+V.toFixed(2)+" "+D("word.kWh",E)})]})]},se)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:D("shared.OutputBreakdown",E)})}):h.jsxs(h.Fragment,{children:[V>0&&h.jsx(on,{children:D("solarPanelYieldPanel.YearlyTotal",E)+": "+V.toFixed(2)+" "+D("word.kWh",E)}),V>0&&h.jsx(Ml,{title:D("shared.MoreResults",E),content:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.ModuleCount",E)+": "}),h.jsx(Ke,{span:10,children:B})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.MeanYield",E)+": "}),h.jsxs(Ke,{span:10,children:[(V/B).toFixed(2)," kWh"]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.TotalCost",E)+": "}),h.jsxs(Ke,{span:10,children:["$",G.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.TotalRevenue",E)+": "}),h.jsxs(Ke,{span:10,children:["$",q.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.Profit",E)+": "}),h.jsx(Ke,{span:10,children:($>0?"$":"-$")+Math.abs($).toFixed(2)})]})]}),children:h.jsx(io,{type:"default",children:D("shared.MoreResults",E)})})]}),!d&&h.jsxs(h.Fragment,{children:[N>1&&h.jsx(vc,{title:D("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",E),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:Q=>{if(N===0){gn(D("analysisManager.NoSolarPanelForAnalysis",E));return}gn(D("message.SimulationStarted",E)),setTimeout(()=>{o(se=>{se.graphState&&(se.graphState.yearlyPvIndividualOutputs=Q),e&&(se.actionInfo={name:"Run Yearly Simulation For Solar Panels: "+(Q?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(se=>{se.simulationInProgress=!0,se.runYearlySimulationForSolarPanels=!0,se.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:ie?h.jsx(Th,{}):h.jsx(Rf,{}),title:D(ie?"word.Run":"word.Update",E),onClick:()=>{if(N===0){gn(D("analysisManager.NoSolarPanelForAnalysis",E));return}gn(D("message.SimulationStarted",E)),setTimeout(()=>{o(Q=>{e&&(Q.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(Q=>{Q.simulationInProgress=!0,Q.runYearlySimulationForSolarPanels=!0,Q.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:D("word.SaveAsImage",E),onClick:()=>{Ed("line-graph-"+L+"-"+j,"yearly-pv-yield").then(()=>{gn(D("message.ScreenshotSaved",E)),e&&o(Q=>{Q.actionInfo={name:"Take Screenshot of Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:D("word.SaveAsCsv",E),onClick:()=>{Sh(a,"yearly-pv-yield.csv"),gn(D("message.CsvFileSaved",E)),e&&o(Q=>{Q.actionInfo={name:"Export Solar Panel Yearly Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),VUo=Ho.div` +`,OUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(zH)??6,i=new Date(M(Al)),a=Cn(avt),l=M(eOe),s=Cn(tOe),c=M(Ng),u=M(n8t),d=dt(n5),f=M.getState().economicsParams,p=dt(Cf),g=M(Sc),A=be.useRef(null),y=m.useRef(null),S=y.current?y.current.clientWidth+40:640,C=y.current?y.current.clientHeight+100:500,[P,v]=m.useState({x:u?Math.max(u.x,S-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-C):0}),[T,w]=m.useState(0),[x,b]=m.useState(!1),R=m.useRef(new Map),H=m.useRef(),F=zs[i.getMonth()],E=$t(),N=c(z.SolarPanel);m.useEffect(()=>{let Q=0;R.current.clear();for(const se of a)for(const oe in se)Object.hasOwn(se,oe)&&oe!=="Month"&&(Q+=se[oe],R.current.set(oe,(R.current.get(oe)??0)+se[oe]));w(Q),b(!x)},[a]),m.useEffect(()=>{v({x:Math.max(u==null?void 0:u.x,S-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})},[u,S,C]),m.useEffect(()=>{const Q=()=>{v({x:Math.max(u==null?void 0:u.x,S-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-C)})};return window.addEventListener("resize",Q),()=>{window.removeEventListener("resize",Q)}},[u,S,C]),m.useEffect(()=>(y.current&&(H.current||(H.current=new ResizeObserver(()=>{o(Q=>{y.current&&(Q.viewState.yearlyPvYieldPanelRect||(Q.viewState.yearlyPvYieldPanelRect=new cr(0,0,600,400)),Q.viewState.yearlyPvYieldPanelRect.width=y.current.offsetWidth,Q.viewState.yearlyPvYieldPanelRect.height=y.current.offsetHeight)})})),H.current.observe(y.current)),()=>{var Q;(Q=H.current)==null||Q.disconnect()}),[]);const U=(Q,se)=>{v({x:Math.max(se.x,S-window.innerWidth),y:Math.min(se.y,window.innerHeight-C)})},W=(Q,se)=>{o(oe=>{oe.viewState.yearlyPvYieldPanelRect||(oe.viewState.yearlyPvYieldPanelRect=new cr(0,0,600,400)),oe.viewState.yearlyPvYieldPanelRect.x=Math.max(se.x,S-window.innerWidth),oe.viewState.yearlyPvYieldPanelRect.y=Math.min(se.y,window.innerHeight-C)})},k=()=>{o(Q=>{Q.viewState.showYearlyPvYieldPanel=!1,e&&(Q.actionInfo={name:"Close Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()})})};m.useEffect(()=>{N<2&&l&&o(Q=>{Q.graphState&&(Q.graphState.yearlyPvIndividualOutputs=!1)})},[N,l]);const{t:D}=Xl(),L=D("word.Month",E),j=D("solarPanelYieldPanel.Yield",E),B=me.countAllSolarPanels(),O=12/r,V=T*O,G=B*f.operationalCostPerUnit*365,q=V*f.electricitySellingPrice,$=q-G,ie=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:A,handle:".handle",bounds:"parent",axis:"both",position:P,onDrag:U,onStop:W,onMouseDown:()=>{o(Q=>{Q.selectedFloatingWindow="yearlyPvYieldPanel"})},children:h.jsx(jUo,{ref:A,style:{zIndex:g==="yearlyPvYieldPanel"?bc:9},children:h.jsxs(BUo,{ref:y,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(YUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[D("solarPanelYieldPanel.SolarPanelYearlyYield",E)+": ",h.jsx("span",{style:{fontSize:"10px"},children:D("sensorPanel.WeatherDataFrom",E)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{k()},onMouseDown:()=>{k()},children:D("word.Close",E)})]}),h.jsx(Sf,{type:vi.YearlyPvYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:Q,Clearness:se,...oe})=>oe),labels:s,height:100,dataKeyAxisX:"Month",labelX:L,labelY:j,unitY:D("word.kWh",E),yMin:0,curveType:"linear",fractionDigits:2,referenceX:F}),!p&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&N>1&&R.current.size>0?h.jsx(Ml,{title:D("shared.OutputBreakdown",E),content:[...R.current.entries()].map((Q,se)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:Q[0]+": "}),h.jsx(Ke,{span:8,children:(Q[1]*O).toFixed(2)})]}),se===R.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:D("word.Total",E)+": "+V.toFixed(2)+" "+D("word.kWh",E)})]})]},se)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:D("shared.OutputBreakdown",E)})}):h.jsxs(h.Fragment,{children:[V>0&&h.jsx(on,{children:D("solarPanelYieldPanel.YearlyTotal",E)+": "+V.toFixed(2)+" "+D("word.kWh",E)}),V>0&&h.jsx(Ml,{title:D("shared.MoreResults",E),content:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.ModuleCount",E)+": "}),h.jsx(Ke,{span:10,children:B})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.MeanYield",E)+": "}),h.jsxs(Ke,{span:10,children:[(V/B).toFixed(2)," kWh"]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.TotalCost",E)+": "}),h.jsxs(Ke,{span:10,children:["$",G.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.TotalRevenue",E)+": "}),h.jsxs(Ke,{span:10,children:["$",q.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:D("solarPanelYieldPanel.Profit",E)+": "}),h.jsx(Ke,{span:10,children:($>0?"$":"-$")+Math.abs($).toFixed(2)})]})]}),children:h.jsx(io,{type:"default",children:D("shared.MoreResults",E)})})]}),!d&&h.jsxs(h.Fragment,{children:[N>1&&h.jsx(vc,{title:D("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",E),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:Q=>{if(N===0){gn(D("analysisManager.NoSolarPanelForAnalysis",E));return}gn(D("message.SimulationStarted",E)),setTimeout(()=>{o(se=>{se.graphState&&(se.graphState.yearlyPvIndividualOutputs=Q),e&&(se.actionInfo={name:"Run Yearly Simulation For Solar Panels: "+(Q?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(se=>{se.simulationInProgress=!0,se.runYearlySimulationForSolarPanels=!0,se.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:ie?h.jsx(Th,{}):h.jsx(Hf,{}),title:D(ie?"word.Run":"word.Update",E),onClick:()=>{if(N===0){gn(D("analysisManager.NoSolarPanelForAnalysis",E));return}gn(D("message.SimulationStarted",E)),setTimeout(()=>{o(Q=>{e&&(Q.actionInfo={name:"Run Yearly Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(Q=>{Q.simulationInProgress=!0,Q.runYearlySimulationForSolarPanels=!0,Q.pauseYearlySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:D("word.SaveAsImage",E),onClick:()=>{Ed("line-graph-"+L+"-"+j,"yearly-pv-yield").then(()=>{gn(D("message.ScreenshotSaved",E)),e&&o(Q=>{Q.actionInfo={name:"Take Screenshot of Solar Panel Yearly Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:D("word.SaveAsCsv",E),onClick:()=>{Sh(a,"yearly-pv-yield.csv"),gn(D("message.CsvFileSaved",E)),e&&o(Q=>{Q.actionInfo={name:"Export Solar Panel Yearly Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),VUo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -8894,7 +8894,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,XUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(rvt),l=M(ZYe),s=M(e8t),c=Cn(tOe),u=dt(n5),d=M.getState().economicsParams,f=dt(Cf),p=M(Sc),g=be.useRef(null),A=m.useRef(null),y=A.current?A.current.offsetWidth+40:s?s.width+40:640,S=A.current?A.current.offsetHeight+100:s?s.height+100:500,[C,P]=m.useState({x:s?Math.max(s.x,y-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=m.useRef(),H=$t();m.useEffect(()=>{let G=0;b.current.clear();for(const q of a)for(const $ in q)Object.hasOwn(q,$)&&$!=="Hour"&&(G+=q[$],b.current.set($,(b.current.get($)??0)+q[$]));T(G),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(s==null?void 0:s.x,y-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-S)})},[s,y,S]),m.useEffect(()=>{const G=()=>{P({x:Math.max(s==null?void 0:s.x,y-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-S)})};return window.addEventListener("resize",G),()=>{window.removeEventListener("resize",G)}},[s,y,S]),m.useEffect(()=>(A.current&&(R.current||(R.current=new ResizeObserver(()=>{o(G=>{A.current&&(G.viewState.dailyPvYieldPanelRect||(G.viewState.dailyPvYieldPanelRect=new cr(0,0,600,400)),G.viewState.dailyPvYieldPanelRect.width=A.current.offsetWidth,G.viewState.dailyPvYieldPanelRect.height=A.current.offsetHeight)})})),R.current.observe(A.current)),()=>{var G;(G=R.current)==null||G.disconnect()}),[]);const F=(G,q)=>{P({x:Math.max(q.x,y-window.innerWidth),y:Math.min(q.y,window.innerHeight-S)})},E=(G,q)=>{o($=>{$.viewState.dailyPvYieldPanelRect||($.viewState.dailyPvYieldPanelRect=new cr(0,0,600,400)),$.viewState.dailyPvYieldPanelRect.x=Math.max(q.x,y-window.innerWidth),$.viewState.dailyPvYieldPanelRect.y=Math.min(q.y,window.innerHeight-S)})},N=()=>{o(G=>{G.viewState.showDailyPvYieldPanel=!1,e&&(G.actionInfo={name:"Close Solar Panel Daily Yield Graph",timestamp:new Date().getTime()})})},U=i(z.SolarPanel);m.useEffect(()=>{U<2&&l&&o(G=>{G.graphState&&(G.graphState.dailyPvIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Hour",H),D=W("solarPanelYieldPanel.YieldPerHour",H),L=ye.countAllSolarPanels(),j=L*d.operationalCostPerUnit,B=v*d.electricitySellingPrice,O=B-j,V=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:g,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(G=>{G.selectedFloatingWindow="dailyPvYieldPanel"})},children:h.jsx(VUo,{ref:g,style:{zIndex:p==="dailyPvYieldPanel"?bc:9},children:h.jsxs(_Uo,{ref:A,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(GUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("solarPanelYieldPanel.SolarPanelDailyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.DailyPvYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!f&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:W("shared.OutputBreakdown",H),content:[...b.current.entries()].map((G,q)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:G[0]+": "}),h.jsx(Ke,{span:8,children:G[1].toFixed(3)})]}),q===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+v.toFixed(3)+" "+W("word.kWh",H)})]})]},q)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(h.Fragment,{children:[v>0&&h.jsx(on,{style:{cursor:"default"},children:W("solarPanelYieldPanel.DailyTotal",H)+": "+v.toFixed(3)+" "+W("word.kWh",H)}),v>0&&h.jsx(Ml,{title:W("shared.MoreResults",H),content:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.ModuleCount",H)+": "}),h.jsx(Ke,{span:10,children:L})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.MeanYield",H)+": "}),h.jsxs(Ke,{span:10,children:[(v/L).toFixed(2)," kWh"]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.TotalCost",H)+": "}),h.jsxs(Ke,{span:10,children:["$",j.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.TotalRevenue",H)+": "}),h.jsxs(Ke,{span:10,children:["$",B.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.Profit",H)+": "}),h.jsx(Ke,{span:10,children:(O>0?"$":"-$")+Math.abs(O).toFixed(2)})]})]}),children:h.jsx(io,{type:"default",children:W("shared.MoreResults",H)})})]}),!u&&h.jsxs(h.Fragment,{children:[U>1&&h.jsx(vc,{title:W("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:G=>{if(U===0){gn(W("analysisManager.NoSolarPanelForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(q=>{q.graphState&&(q.graphState.dailyPvIndividualOutputs=G),e&&(q.actionInfo={name:"Run Daily Simulation For Solar Panels: "+(G?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(q=>{q.simulationInProgress=!0,q.runDailySimulationForSolarPanels=!0,q.pauseDailySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:V?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(V?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoSolarPanelForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(G=>{e&&(G.actionInfo={name:"Run Daily Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(G=>{G.simulationInProgress=!0,G.runDailySimulationForSolarPanels=!0,G.pauseDailySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"daily-pv-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(G=>{G.actionInfo={name:"Take Screenshot of Solar Panel Daily Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"daily-pv-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(G=>{G.actionInfo={name:"Export Solar Panel Daily Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),JUo="/aladdin/assets/light_bulb-D1RiLhYG.png",KUo="/aladdin/assets/diameter-CQ4-OfKR.png",qUo="/aladdin/assets/area-C8e5STKh.png",$Uo=Ho.div` +`,XUo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(rvt),l=M(ZYe),s=M(e8t),c=Cn(tOe),u=dt(n5),d=M.getState().economicsParams,f=dt(Cf),p=M(Sc),g=be.useRef(null),A=m.useRef(null),y=A.current?A.current.offsetWidth+40:s?s.width+40:640,S=A.current?A.current.offsetHeight+100:s?s.height+100:500,[C,P]=m.useState({x:s?Math.max(s.x,y-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=m.useRef(),H=$t();m.useEffect(()=>{let G=0;b.current.clear();for(const q of a)for(const $ in q)Object.hasOwn(q,$)&&$!=="Hour"&&(G+=q[$],b.current.set($,(b.current.get($)??0)+q[$]));T(G),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(s==null?void 0:s.x,y-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-S)})},[s,y,S]),m.useEffect(()=>{const G=()=>{P({x:Math.max(s==null?void 0:s.x,y-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-S)})};return window.addEventListener("resize",G),()=>{window.removeEventListener("resize",G)}},[s,y,S]),m.useEffect(()=>(A.current&&(R.current||(R.current=new ResizeObserver(()=>{o(G=>{A.current&&(G.viewState.dailyPvYieldPanelRect||(G.viewState.dailyPvYieldPanelRect=new cr(0,0,600,400)),G.viewState.dailyPvYieldPanelRect.width=A.current.offsetWidth,G.viewState.dailyPvYieldPanelRect.height=A.current.offsetHeight)})})),R.current.observe(A.current)),()=>{var G;(G=R.current)==null||G.disconnect()}),[]);const F=(G,q)=>{P({x:Math.max(q.x,y-window.innerWidth),y:Math.min(q.y,window.innerHeight-S)})},E=(G,q)=>{o($=>{$.viewState.dailyPvYieldPanelRect||($.viewState.dailyPvYieldPanelRect=new cr(0,0,600,400)),$.viewState.dailyPvYieldPanelRect.x=Math.max(q.x,y-window.innerWidth),$.viewState.dailyPvYieldPanelRect.y=Math.min(q.y,window.innerHeight-S)})},N=()=>{o(G=>{G.viewState.showDailyPvYieldPanel=!1,e&&(G.actionInfo={name:"Close Solar Panel Daily Yield Graph",timestamp:new Date().getTime()})})},U=i(z.SolarPanel);m.useEffect(()=>{U<2&&l&&o(G=>{G.graphState&&(G.graphState.dailyPvIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Hour",H),D=W("solarPanelYieldPanel.YieldPerHour",H),L=me.countAllSolarPanels(),j=L*d.operationalCostPerUnit,B=v*d.electricitySellingPrice,O=B-j,V=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:g,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(G=>{G.selectedFloatingWindow="dailyPvYieldPanel"})},children:h.jsx(VUo,{ref:g,style:{zIndex:p==="dailyPvYieldPanel"?bc:9},children:h.jsxs(_Uo,{ref:A,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(GUo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("solarPanelYieldPanel.SolarPanelDailyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.DailyPvYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!f&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:W("shared.OutputBreakdown",H),content:[...b.current.entries()].map((G,q)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:G[0]+": "}),h.jsx(Ke,{span:8,children:G[1].toFixed(3)})]}),q===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+v.toFixed(3)+" "+W("word.kWh",H)})]})]},q)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(h.Fragment,{children:[v>0&&h.jsx(on,{style:{cursor:"default"},children:W("solarPanelYieldPanel.DailyTotal",H)+": "+v.toFixed(3)+" "+W("word.kWh",H)}),v>0&&h.jsx(Ml,{title:W("shared.MoreResults",H),content:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.ModuleCount",H)+": "}),h.jsx(Ke,{span:10,children:L})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.MeanYield",H)+": "}),h.jsxs(Ke,{span:10,children:[(v/L).toFixed(2)," kWh"]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.TotalCost",H)+": "}),h.jsxs(Ke,{span:10,children:["$",j.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.TotalRevenue",H)+": "}),h.jsxs(Ke,{span:10,children:["$",B.toFixed(2)]})]}),h.jsxs(nn,{style:{width:"200px"},children:[h.jsx(Ke,{span:14,children:W("solarPanelYieldPanel.Profit",H)+": "}),h.jsx(Ke,{span:10,children:(O>0?"$":"-$")+Math.abs(O).toFixed(2)})]})]}),children:h.jsx(io,{type:"default",children:W("shared.MoreResults",H)})})]}),!u&&h.jsxs(h.Fragment,{children:[U>1&&h.jsx(vc,{title:W("solarPanelYieldPanel.ShowOutputsOfIndividualSolarPanels",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:G=>{if(U===0){gn(W("analysisManager.NoSolarPanelForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(q=>{q.graphState&&(q.graphState.dailyPvIndividualOutputs=G),e&&(q.actionInfo={name:"Run Daily Simulation For Solar Panels: "+(G?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(q=>{q.simulationInProgress=!0,q.runDailySimulationForSolarPanels=!0,q.pauseDailySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:V?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(V?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoSolarPanelForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(G=>{e&&(G.actionInfo={name:"Run Daily Simulation For Solar Panels",timestamp:new Date().getTime()})}),dt.getState().set(G=>{G.simulationInProgress=!0,G.runDailySimulationForSolarPanels=!0,G.pauseDailySimulationForSolarPanels=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"daily-pv-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(G=>{G.actionInfo={name:"Take Screenshot of Solar Panel Daily Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"daily-pv-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(G=>{G.actionInfo={name:"Export Solar Panel Daily Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})]})})})}),JUo="/aladdin/assets/light_bulb-D1RiLhYG.png",KUo="/aladdin/assets/diameter-CQ4-OfKR.png",qUo="/aladdin/assets/area-C8e5STKh.png",$Uo=Ho.div` position: absolute; bottom: 40px; left: 0; @@ -8924,7 +8924,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; font-size: 12px; flex-direction: column; opacity: 100%; -`,ZUo=be.memo(()=>{const t=M(Kn),e=M(Ng),n=M(v7t),o=M(Gr),r=M(Lw),i=M(ay),a=M(HW),l=M(S=>S.selectedElement===null?null:S.elements.find(C=>{var P;return C.id===((P=S.selectedElement)==null?void 0:P.id)}));let s=0,c=0,u=0;if(l)if(l.type===z.SolarPanel)s=n(l.id),c=l.dailyYield??0;else if(l.type===z.Polygon){const S=o(l);S&&(s=ye.countAllChildSolarPanels(S.id),c=ye.countAllChildSolarPanelDailyYields(S.id))}else s=ye.countAllChildSolarPanels(l.id),c=ye.countAllChildSolarPanelDailyYields(l.id),u=ye.countAllChildElementsByType(l.id,z.Heliostat);else s=ye.countAllSolarPanels(),c=ye.countAllSolarPanelDailyYields(),u=e(z.Heliostat);const d=$t(),f=r.y>0,p=f?"navajowhite":"antiquewhite",g=f?"invert(85%) sepia(45%) saturate(335%) hue-rotate(329deg) brightness(100%) contrast(101%)":"invert(95%) sepia(7%) saturate(1598%) hue-rotate(312deg) brightness(106%) contrast(96%)",A=l&&l.type===z.Foundation&&!l.notBuilding&&ye.getBuildingCompletionStatus(l,t)===Uc.COMPLETE,y=m.useRef(null);return m.useEffect(()=>{y.current&&kn.setState({solarPanelCountRef:y})},[s]),h.jsx($Uo,{children:h.jsx(QUo,{$projectView:a,children:h.jsxs(on,{direction:"horizontal",style:{color:p,fontSize:"10px"},children:[s>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"Solar panel count",title:Y.t("designInfoPanel.NumberOfSelectedSolarPanels",d),src:Tfe,height:24,width:36,style:{paddingLeft:"10px",cursor:"pointer",filter:"invert(100%) "}}),h.jsx("span",{ref:y,children:s})]}),u>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"Heliostat count",title:Y.t("designInfoPanel.NumberOfSelectedHeliostats",d),src:Pfe,height:24,width:36,style:{paddingLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",filter:"invert(100%) "}}),h.jsx("span",{children:u})]}),c>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.ElectricityGeneratedDailyBySolarPanels",d),alt:"Electricity",src:JUo,height:24,width:24,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsx("span",{children:c.toFixed(1)+" "+Y.t("word.kWh",d)})]}),!l&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.SceneDiameter",d),alt:"Diameter",src:KUo,height:20,width:20,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsx("span",{children:i*2+" "+Y.t("word.MeterAbbreviation",d)})]}),A&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.BuildingArea",d),alt:"Area",src:qUo,height:20,width:20,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsxs("span",{children:[ye.getBuildingArea(l,t).toFixed(2)+" "+Y.t("word.MeterAbbreviation",d),h.jsx("sup",{children:"2"})]})]})]})})})}),ejo="/aladdin/assets/location-_zTaloy5.png",tjo="/aladdin/assets/date-Dqo8FDne.png",njo="/aladdin/assets/thermometer-B30VcfuL.png",ojo=Ho.div` +`,ZUo=be.memo(()=>{const t=M(Kn),e=M(Ng),n=M(v7t),o=M(Gr),r=M(Lw),i=M(ay),a=M(HW),l=M(S=>S.selectedElement===null?null:S.elements.find(C=>{var P;return C.id===((P=S.selectedElement)==null?void 0:P.id)}));let s=0,c=0,u=0;if(l)if(l.type===z.SolarPanel)s=n(l.id),c=l.dailyYield??0;else if(l.type===z.Polygon){const S=o(l);S&&(s=me.countAllChildSolarPanels(S.id),c=me.countAllChildSolarPanelDailyYields(S.id))}else s=me.countAllChildSolarPanels(l.id),c=me.countAllChildSolarPanelDailyYields(l.id),u=me.countAllChildElementsByType(l.id,z.Heliostat);else s=me.countAllSolarPanels(),c=me.countAllSolarPanelDailyYields(),u=e(z.Heliostat);const d=$t(),f=r.y>0,p=f?"navajowhite":"antiquewhite",g=f?"invert(85%) sepia(45%) saturate(335%) hue-rotate(329deg) brightness(100%) contrast(101%)":"invert(95%) sepia(7%) saturate(1598%) hue-rotate(312deg) brightness(106%) contrast(96%)",A=l&&l.type===z.Foundation&&!l.notBuilding&&me.getBuildingCompletionStatus(l,t)===Uc.COMPLETE,y=m.useRef(null);return m.useEffect(()=>{y.current&&kn.setState({solarPanelCountRef:y})},[s]),h.jsx($Uo,{children:h.jsx(QUo,{$projectView:a,children:h.jsxs(on,{direction:"horizontal",style:{color:p,fontSize:"10px"},children:[s>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"Solar panel count",title:Y.t("designInfoPanel.NumberOfSelectedSolarPanels",d),src:Tfe,height:24,width:36,style:{paddingLeft:"10px",cursor:"pointer",filter:"invert(100%) "}}),h.jsx("span",{ref:y,children:s})]}),u>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"Heliostat count",title:Y.t("designInfoPanel.NumberOfSelectedHeliostats",d),src:Pfe,height:24,width:36,style:{paddingLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",filter:"invert(100%) "}}),h.jsx("span",{children:u})]}),c>0&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.ElectricityGeneratedDailyBySolarPanels",d),alt:"Electricity",src:JUo,height:24,width:24,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsx("span",{children:c.toFixed(1)+" "+Y.t("word.kWh",d)})]}),!l&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.SceneDiameter",d),alt:"Diameter",src:KUo,height:20,width:20,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsx("span",{children:i*2+" "+Y.t("word.MeterAbbreviation",d)})]}),A&&h.jsxs(h.Fragment,{children:[h.jsx("img",{title:Y.t("designInfoPanel.BuildingArea",d),alt:"Area",src:qUo,height:20,width:20,style:{filter:g,marginLeft:"10px",marginTop:"4px",marginBottom:"4px",cursor:"pointer",verticalAlign:"middle"}}),h.jsxs("span",{children:[me.getBuildingArea(l,t).toFixed(2)+" "+Y.t("word.MeterAbbreviation",d),h.jsx("sup",{children:"2"})]})]})]})})})}),ejo="/aladdin/assets/location-_zTaloy5.png",tjo="/aladdin/assets/date-Dqo8FDne.png",njo="/aladdin/assets/thermometer-B30VcfuL.png",ojo=Ho.div` position: absolute; top: 75px; left: 0; @@ -8953,7 +8953,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; font-size: 12px; flex-direction: column; opacity: 100%; -`,ijo=be.memo(()=>{const t=M(Al),e=M(_q),n=M(s0),o=M(Mb),r=M(_Be),i=M(V7t),a=M(Lw),l=M(gW)??900,s=M(HW),c=M(HBe),[u,d]=m.useState({low:0,high:20}),[f,p]=m.useState(10),g=new Date(t),A=a.y>0,y=$t();m.useEffect(()=>{if(i){const v=rb(g,i.lowestTemperatures,i.highestTemperatures);d(v);const T=ob(v.high,v.low,r,l,S,ye.minutesIntoDay(g));p(T)}},[t,i]);const S=m.useMemo(()=>dl(g,n),[t,n]),C=A?"navajowhite":"antiquewhite",P=A?"invert(85%) sepia(45%) saturate(335%) hue-rotate(329deg) brightness(100%) contrast(101%)":"invert(95%) sepia(7%) saturate(1598%) hue-rotate(312deg) brightness(106%) contrast(96%)";return h.jsx(ojo,{children:h.jsx(rjo,{$projectView:s,children:h.jsxs(on,{direction:"horizontal",style:{color:C,fontSize:"10px"},children:[h.jsx("img",{title:Y.t("word.Location",y),alt:"Location",src:ejo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),(c?"":e??"")+" ("+Math.abs(n).toFixed(2)+"°"+(n>0?"N":"S")+", "+Math.abs(o).toFixed(2)+"°"+(o>0?"E":"W")+")",h.jsx("img",{title:Y.t("word.Date",y),alt:"Date",src:tjo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),ul(g).format("MM/DD hh:mm A"),h.jsx("img",{title:Y.t("word.Temperature",y),alt:"Temperature",src:njo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),u?f.toFixed(1)+"°C ("+Y.t("siteInfoPanel.Low",y)+":"+u.low.toFixed(1)+"°C, "+Y.t("siteInfoPanel.High",y)+": "+u.high.toFixed(1)+"°C)":""]})})})}),ajo=Ho.div` +`,ijo=be.memo(()=>{const t=M(Al),e=M(_q),n=M(s0),o=M(Mb),r=M(_Be),i=M(V7t),a=M(Lw),l=M(gW)??900,s=M(HW),c=M(HBe),[u,d]=m.useState({low:0,high:20}),[f,p]=m.useState(10),g=new Date(t),A=a.y>0,y=$t();m.useEffect(()=>{if(i){const v=rb(g,i.lowestTemperatures,i.highestTemperatures);d(v);const T=ob(v.high,v.low,r,l,S,me.minutesIntoDay(g));p(T)}},[t,i]);const S=m.useMemo(()=>dl(g,n),[t,n]),C=A?"navajowhite":"antiquewhite",P=A?"invert(85%) sepia(45%) saturate(335%) hue-rotate(329deg) brightness(100%) contrast(101%)":"invert(95%) sepia(7%) saturate(1598%) hue-rotate(312deg) brightness(106%) contrast(96%)";return h.jsx(ojo,{children:h.jsx(rjo,{$projectView:s,children:h.jsxs(on,{direction:"horizontal",style:{color:C,fontSize:"10px"},children:[h.jsx("img",{title:Y.t("word.Location",y),alt:"Location",src:ejo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),(c?"":e??"")+" ("+Math.abs(n).toFixed(2)+"°"+(n>0?"N":"S")+", "+Math.abs(o).toFixed(2)+"°"+(o>0?"E":"W")+")",h.jsx("img",{title:Y.t("word.Date",y),alt:"Date",src:tjo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),ul(g).format("MM/DD hh:mm A"),h.jsx("img",{title:Y.t("word.Temperature",y),alt:"Temperature",src:njo,height:20,width:20,style:{filter:P,cursor:"pointer",verticalAlign:"middle"}}),u?f.toFixed(1)+"°C ("+Y.t("siteInfoPanel.Low",y)+":"+u.low.toFixed(1)+"°C, "+Y.t("siteInfoPanel.High",y)+": "+u.high.toFixed(1)+"°C)":""]})})})}),ajo=Ho.div` position: absolute; left: 0; margin: 0; @@ -9018,7 +9018,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,fjo=be.memo(()=>{const t=M(oa),e=M(pn),n=new Date(M(Al)),o=M(r8t),r=Cn(Z7t),i=M(w7t),a=M(Sc),l=be.useRef(null),s=m.useRef(null),c=m.useRef(),u=s.current?s.current.clientWidth+40:o?o.width+40:640,d=s.current?s.current.clientHeight+100:o?o.height+100:570,[f,p]=m.useState({x:o?Math.max(o.x,u-window.innerWidth):0,y:o?Math.min(o.y,window.innerHeight-d):0}),[g,A]=m.useState([]),y=$t();m.useEffect(()=>{p({x:Math.max(o==null?void 0:o.x,u-window.innerWidth),y:Math.min(o==null?void 0:o.y,window.innerHeight-d)})},[o,u,d]),m.useEffect(()=>{const T=()=>{p({x:Math.max(o==null?void 0:o.x,u-window.innerWidth),y:Math.min(o==null?void 0:o.y,window.innerHeight-d)})};return window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}},[d,o==null?void 0:o.x,o==null?void 0:o.y,u]),m.useEffect(()=>(s.current&&(c.current||(c.current=new ResizeObserver(()=>{e(T=>{s.current&&(T.viewState.visibilityResultsPanelRect||(T.viewState.visibilityResultsPanelRect=new cr(0,0,600,470)),T.viewState.visibilityResultsPanelRect.width=s.current.offsetWidth,T.viewState.visibilityResultsPanelRect.height=s.current.offsetHeight)})})),c.current.observe(s.current)),()=>{var T;(T=c.current)==null||T.disconnect()}),[]),m.useEffect(()=>{if(r){const T=[];r.forEach((w,x)=>{let b=0,R="",H=0;w.forEach((F,E)=>{H++,b+=F,R+=F.toFixed(2)+", "}),T.push({key:x.observer.id,observer:kp.fetchLabel(x.observer.name,y),vantage:"("+x.position.x.toFixed(1)+", "+x.position.y.toFixed(1)+", "+x.position.z.toFixed(1)+") "+v("word.MeterAbbreviation",y),total:b.toFixed(2),itemized:H>1?R.substring(0,R.length-2):"---"})}),A(T)}},[r,y]);const S=(T,w)=>{p({x:Math.max(w.x,u-window.innerWidth),y:Math.min(w.y,window.innerHeight-d)})},C=(T,w)=>{e(x=>{x.viewState.visibilityResultsPanelRect||(x.viewState.visibilityResultsPanelRect=new cr(0,0,600,470)),x.viewState.visibilityResultsPanelRect.x=Math.max(w.x,u-window.innerWidth),x.viewState.visibilityResultsPanelRect.y=Math.min(w.y,window.innerHeight-d)})},P=()=>{e(T=>{T.viewState.showSolarPanelVisibilityResultsPanel=!1,t&&(T.actionInfo={name:"Close Visibility Results Panel",timestamp:new Date().getTime()})})},{t:v}=Xl();return h.jsx(Bi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:f,onDrag:S,onStop:C,onMouseDown:()=>{e(T=>{T.selectedFloatingWindow="visibilityResultsPanel"})},children:h.jsx(cjo,{ref:l,style:{zIndex:a==="visibilityResultsPanel"?bc:8},children:h.jsxs(ujo,{ref:s,style:{width:(o?o.width:600)+"px",height:(o?o.height:470)+"px"},children:[h.jsxs(djo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:v("visibilityPanel.SolarPanelVisibility",y)+" — "+yr(n).format("h:mm A MM/DD")}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{P()},onMouseDown:()=>{P()},children:v("word.Close",y)})]}),h.jsxs(Dd,{id:"visibility-results-table",style:{width:"100%",direction:"ltr"},dataSource:g,pagination:{defaultPageSize:5,showSizeChanger:!0,pageSizeOptions:["5","10","50"]},children:[h.jsx(hV,{title:`${v("visibilityPanel.Observer",y)}`,dataIndex:"observer"},"observer"),h.jsx(hV,{title:`${v("visibilityPanel.VantagePoint",y)}`,dataIndex:"vantage"},"vantage"),h.jsx(hV,{title:`${v("visibilityPanel.TotalVisibility",y)}`,dataIndex:"total"},"total"),h.jsx(hV,{title:`${v("visibilityPanel.ItemizedVisibilityByFields",y)}`,dataIndex:"itemized"},"itemized")]}),h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[h.jsx(io,{type:"default",icon:h.jsx(Rf,{}),title:v("word.Update",y),onClick:()=>{if(i()===0){gn(v("analysisManager.NoObserverForVisibilityAnalysis",y));return}gn(v("message.SimulationStarted",y)),setTimeout(()=>{dt.getState().set(w=>{w.simulationInProgress=!0,w.runSolarPanelVisibilityAnalysis=!0}),e(w=>{t&&(w.actionInfo={name:"Run Visibility Analysis For Solar Panels",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:v("word.SaveAsImage",y),onClick:()=>{Ed("visibility-results-table","visibility-results").then(()=>{gn(v("message.ScreenshotSaved",y))})}})]})]})})})}),hjo=Ho.div` +`,fjo=be.memo(()=>{const t=M(oa),e=M(pn),n=new Date(M(Al)),o=M(r8t),r=Cn(Z7t),i=M(w7t),a=M(Sc),l=be.useRef(null),s=m.useRef(null),c=m.useRef(),u=s.current?s.current.clientWidth+40:o?o.width+40:640,d=s.current?s.current.clientHeight+100:o?o.height+100:570,[f,p]=m.useState({x:o?Math.max(o.x,u-window.innerWidth):0,y:o?Math.min(o.y,window.innerHeight-d):0}),[g,A]=m.useState([]),y=$t();m.useEffect(()=>{p({x:Math.max(o==null?void 0:o.x,u-window.innerWidth),y:Math.min(o==null?void 0:o.y,window.innerHeight-d)})},[o,u,d]),m.useEffect(()=>{const T=()=>{p({x:Math.max(o==null?void 0:o.x,u-window.innerWidth),y:Math.min(o==null?void 0:o.y,window.innerHeight-d)})};return window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}},[d,o==null?void 0:o.x,o==null?void 0:o.y,u]),m.useEffect(()=>(s.current&&(c.current||(c.current=new ResizeObserver(()=>{e(T=>{s.current&&(T.viewState.visibilityResultsPanelRect||(T.viewState.visibilityResultsPanelRect=new cr(0,0,600,470)),T.viewState.visibilityResultsPanelRect.width=s.current.offsetWidth,T.viewState.visibilityResultsPanelRect.height=s.current.offsetHeight)})})),c.current.observe(s.current)),()=>{var T;(T=c.current)==null||T.disconnect()}),[]),m.useEffect(()=>{if(r){const T=[];r.forEach((w,x)=>{let b=0,R="",H=0;w.forEach((F,E)=>{H++,b+=F,R+=F.toFixed(2)+", "}),T.push({key:x.observer.id,observer:kp.fetchLabel(x.observer.name,y),vantage:"("+x.position.x.toFixed(1)+", "+x.position.y.toFixed(1)+", "+x.position.z.toFixed(1)+") "+v("word.MeterAbbreviation",y),total:b.toFixed(2),itemized:H>1?R.substring(0,R.length-2):"---"})}),A(T)}},[r,y]);const S=(T,w)=>{p({x:Math.max(w.x,u-window.innerWidth),y:Math.min(w.y,window.innerHeight-d)})},C=(T,w)=>{e(x=>{x.viewState.visibilityResultsPanelRect||(x.viewState.visibilityResultsPanelRect=new cr(0,0,600,470)),x.viewState.visibilityResultsPanelRect.x=Math.max(w.x,u-window.innerWidth),x.viewState.visibilityResultsPanelRect.y=Math.min(w.y,window.innerHeight-d)})},P=()=>{e(T=>{T.viewState.showSolarPanelVisibilityResultsPanel=!1,t&&(T.actionInfo={name:"Close Visibility Results Panel",timestamp:new Date().getTime()})})},{t:v}=Xl();return h.jsx(Bi,{nodeRef:l,handle:".handle",bounds:"parent",axis:"both",position:f,onDrag:S,onStop:C,onMouseDown:()=>{e(T=>{T.selectedFloatingWindow="visibilityResultsPanel"})},children:h.jsx(cjo,{ref:l,style:{zIndex:a==="visibilityResultsPanel"?bc:8},children:h.jsxs(ujo,{ref:s,style:{width:(o?o.width:600)+"px",height:(o?o.height:470)+"px"},children:[h.jsxs(djo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:v("visibilityPanel.SolarPanelVisibility",y)+" — "+yr(n).format("h:mm A MM/DD")}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{P()},onMouseDown:()=>{P()},children:v("word.Close",y)})]}),h.jsxs(Dd,{id:"visibility-results-table",style:{width:"100%",direction:"ltr"},dataSource:g,pagination:{defaultPageSize:5,showSizeChanger:!0,pageSizeOptions:["5","10","50"]},children:[h.jsx(hV,{title:`${v("visibilityPanel.Observer",y)}`,dataIndex:"observer"},"observer"),h.jsx(hV,{title:`${v("visibilityPanel.VantagePoint",y)}`,dataIndex:"vantage"},"vantage"),h.jsx(hV,{title:`${v("visibilityPanel.TotalVisibility",y)}`,dataIndex:"total"},"total"),h.jsx(hV,{title:`${v("visibilityPanel.ItemizedVisibilityByFields",y)}`,dataIndex:"itemized"},"itemized")]}),h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:v("word.Update",y),onClick:()=>{if(i()===0){gn(v("analysisManager.NoObserverForVisibilityAnalysis",y));return}gn(v("message.SimulationStarted",y)),setTimeout(()=>{dt.getState().set(w=>{w.simulationInProgress=!0,w.runSolarPanelVisibilityAnalysis=!0}),e(w=>{t&&(w.actionInfo={name:"Run Visibility Analysis For Solar Panels",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:v("word.SaveAsImage",y),onClick:()=>{Ed("visibility-results-table","visibility-results").then(()=>{gn(v("message.ScreenshotSaved",y))})}})]})]})})})}),hjo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -9056,7 +9056,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,mjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(gvt),l=M(aOe),s=Cn(lOe),c=M(Ng),u=M(l8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyParabolicTroughYieldPanelRect||(B.viewState.yearlyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyParabolicTroughYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyParabolicTroughYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyParabolicTroughYieldPanelRect||(V.viewState.yearlyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyParabolicTroughYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyParabolicTroughYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyParabolicTroughYieldPanel=!1,e&&(B.actionInfo={name:"Close Parabolic Trough Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.ParabolicTrough);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyParabolicTroughIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("parabolicTroughYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"})},children:h.jsx(hjo,{ref:p,style:{zIndex:f==="yearlyParabolicTroughYieldPanel"?bc:9},children:h.jsxs(pjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(gjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("parabolicTroughYieldPanel.ParabolicTroughYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyParabolicTroughYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("parabolicTroughYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("parabolicTroughYieldPanel.ShowOutputsOfIndividualParabolicTroughs",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoParabolicTroughForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyParabolicTroughIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Parabolic Troughs: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForParabolicTroughs=!0,O.pauseYearlySimulationForParabolicTroughs=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoParabolicTroughForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForParabolicTroughs=!0,B.pauseYearlySimulationForParabolicTroughs=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-parabolic-trough-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Parabolic Trough Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-parabolic-trough-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Parabolic Trough Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),yjo=Ho.div` +`,mjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(gvt),l=M(aOe),s=Cn(lOe),c=M(Ng),u=M(l8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyParabolicTroughYieldPanelRect||(B.viewState.yearlyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyParabolicTroughYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyParabolicTroughYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyParabolicTroughYieldPanelRect||(V.viewState.yearlyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyParabolicTroughYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyParabolicTroughYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyParabolicTroughYieldPanel=!1,e&&(B.actionInfo={name:"Close Parabolic Trough Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.ParabolicTrough);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyParabolicTroughIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("parabolicTroughYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"})},children:h.jsx(hjo,{ref:p,style:{zIndex:f==="yearlyParabolicTroughYieldPanel"?bc:9},children:h.jsxs(pjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(gjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("parabolicTroughYieldPanel.ParabolicTroughYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyParabolicTroughYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("parabolicTroughYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("parabolicTroughYieldPanel.ShowOutputsOfIndividualParabolicTroughs",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoParabolicTroughForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyParabolicTroughIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Parabolic Troughs: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForParabolicTroughs=!0,O.pauseYearlySimulationForParabolicTroughs=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoParabolicTroughForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForParabolicTroughs=!0,B.pauseYearlySimulationForParabolicTroughs=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-parabolic-trough-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Parabolic Trough Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-parabolic-trough-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Parabolic Trough Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),yjo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9094,7 +9094,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,vjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(hvt),l=M(iOe),s=M(i8t),c=Cn(lOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyParabolicTroughYieldPanelRect||(D.viewState.dailyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyParabolicTroughYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyParabolicTroughYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyParabolicTroughYieldPanelRect||(j.viewState.dailyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyParabolicTroughYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyParabolicTroughYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyParabolicTroughYieldPanel=!1,e&&(D.actionInfo={name:"Close Parabolic Trough Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.ParabolicTrough);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyParabolicTroughIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("parabolicTroughYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyParabolicTroughYieldPanel"})},children:h.jsx(yjo,{ref:f,style:{zIndex:d==="dailyParabolicTroughYieldPanel"?bc:9},children:h.jsxs(Ajo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(wjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("parabolicTroughYieldPanel.ParabolicTroughDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyParabolicTroughYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("parabolicTroughYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("parabolicTroughYieldPanel.ShowOutputsOfIndividualParabolicTroughs",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoParabolicTroughForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyParabolicTroughIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Parabolic Troughs: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForParabolicTroughs=!0,L.pauseDailySimulationForParabolicTroughs=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Rf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoParabolicTroughForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForParabolicTroughs=!0,D.pauseDailySimulationForParabolicTroughs=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-parabolic-trough-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Parabolic Trough Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-parabolic-trough-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Parabolic Trough Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),xjo=Ho.div` +`,vjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(hvt),l=M(iOe),s=M(i8t),c=Cn(lOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyParabolicTroughYieldPanelRect||(D.viewState.dailyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyParabolicTroughYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyParabolicTroughYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyParabolicTroughYieldPanelRect||(j.viewState.dailyParabolicTroughYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyParabolicTroughYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyParabolicTroughYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyParabolicTroughYieldPanel=!1,e&&(D.actionInfo={name:"Close Parabolic Trough Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.ParabolicTrough);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyParabolicTroughIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("parabolicTroughYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyParabolicTroughYieldPanel"})},children:h.jsx(yjo,{ref:f,style:{zIndex:d==="dailyParabolicTroughYieldPanel"?bc:9},children:h.jsxs(Ajo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(wjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("parabolicTroughYieldPanel.ParabolicTroughDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyParabolicTroughYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("parabolicTroughYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("parabolicTroughYieldPanel.ShowOutputsOfIndividualParabolicTroughs",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoParabolicTroughForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyParabolicTroughIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Parabolic Troughs: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForParabolicTroughs=!0,L.pauseDailySimulationForParabolicTroughs=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Hf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoParabolicTroughForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Parabolic Troughs",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForParabolicTroughs=!0,D.pauseDailySimulationForParabolicTroughs=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-parabolic-trough-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Parabolic Trough Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-parabolic-trough-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Parabolic Trough Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),xjo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9132,7 +9132,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Tjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn($vt),l=M(yOe),s=M(s8t),c=Cn(wOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyParabolicDishYieldPanelRect||(D.viewState.dailyParabolicDishYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyParabolicDishYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyParabolicDishYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyParabolicDishYieldPanelRect||(j.viewState.dailyParabolicDishYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyParabolicDishYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyParabolicDishYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyParabolicDishYieldPanel=!1,e&&(D.actionInfo={name:"Close Parabolic Dish Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.ParabolicDish);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyParabolicDishIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("parabolicDishYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyParabolicDishYieldPanel"})},children:h.jsx(xjo,{ref:f,style:{zIndex:d==="dailyParabolicDishYieldPanel"?bc:9},children:h.jsxs(bjo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(Sjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("parabolicDishYieldPanel.ParabolicDishDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyParabolicDishYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("parabolicDishYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("parabolicDishYieldPanel.ShowOutputsOfIndividualParabolicDishes",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoParabolicDishForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyParabolicDishIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Parabolic Dishes: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForParabolicDishes=!0,L.pauseDailySimulationForParabolicDishes=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Rf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoParabolicDishForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForParabolicDishes=!0,D.pauseDailySimulationForParabolicDishes=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-parabolic-dish-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Parabolic Dish Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-parabolic-dish-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Parabolic Dish Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Pjo=Ho.div` +`,Tjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn($vt),l=M(yOe),s=M(s8t),c=Cn(wOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyParabolicDishYieldPanelRect||(D.viewState.dailyParabolicDishYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyParabolicDishYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyParabolicDishYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyParabolicDishYieldPanelRect||(j.viewState.dailyParabolicDishYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyParabolicDishYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyParabolicDishYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyParabolicDishYieldPanel=!1,e&&(D.actionInfo={name:"Close Parabolic Dish Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.ParabolicDish);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyParabolicDishIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("parabolicDishYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyParabolicDishYieldPanel"})},children:h.jsx(xjo,{ref:f,style:{zIndex:d==="dailyParabolicDishYieldPanel"?bc:9},children:h.jsxs(bjo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(Sjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("parabolicDishYieldPanel.ParabolicDishDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyParabolicDishYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("parabolicDishYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("parabolicDishYieldPanel.ShowOutputsOfIndividualParabolicDishes",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoParabolicDishForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyParabolicDishIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Parabolic Dishes: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForParabolicDishes=!0,L.pauseDailySimulationForParabolicDishes=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Hf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoParabolicDishForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForParabolicDishes=!0,D.pauseDailySimulationForParabolicDishes=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-parabolic-dish-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Parabolic Dish Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-parabolic-dish-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Parabolic Dish Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Pjo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -9170,7 +9170,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Hjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Zvt),l=M(AOe),s=Cn(wOe),c=M(Ng),u=M(u8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyParabolicDishYieldPanelRect||(B.viewState.yearlyParabolicDishYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyParabolicDishYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyParabolicDishYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyParabolicDishYieldPanelRect||(V.viewState.yearlyParabolicDishYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyParabolicDishYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyParabolicDishYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyParabolicDishYieldPanel=!1,e&&(B.actionInfo={name:"Close Parabolic Dish Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.ParabolicDish);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyParabolicDishIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("parabolicDishYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyParabolicDishYieldPanel"})},children:h.jsx(Pjo,{ref:p,style:{zIndex:f==="yearlyParabolicDishYieldPanel"?bc:9},children:h.jsxs(Cjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(Rjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("parabolicDishYieldPanel.ParabolicDishYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyParabolicDishYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("parabolicDishYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("parabolicDishYieldPanel.ShowOutputsOfIndividualParabolicDishes",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoParabolicDishForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyParabolicDishIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Parabolic Dishes: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForParabolicDishes=!0,O.pauseYearlySimulationForParabolicDishes=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoParabolicDishForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForParabolicDishes=!0,B.pauseYearlySimulationForParabolicDishes=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-parabolic-dish-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Parabolic Dish Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-parabolic-dish-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Parabolic Dish Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Mjo=Ho.div` +`,Hjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Zvt),l=M(AOe),s=Cn(wOe),c=M(Ng),u=M(u8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyParabolicDishYieldPanelRect||(B.viewState.yearlyParabolicDishYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyParabolicDishYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyParabolicDishYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyParabolicDishYieldPanelRect||(V.viewState.yearlyParabolicDishYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyParabolicDishYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyParabolicDishYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyParabolicDishYieldPanel=!1,e&&(B.actionInfo={name:"Close Parabolic Dish Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.ParabolicDish);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyParabolicDishIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("parabolicDishYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyParabolicDishYieldPanel"})},children:h.jsx(Pjo,{ref:p,style:{zIndex:f==="yearlyParabolicDishYieldPanel"?bc:9},children:h.jsxs(Cjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(Rjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("parabolicDishYieldPanel.ParabolicDishYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyParabolicDishYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("parabolicDishYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("parabolicDishYieldPanel.ShowOutputsOfIndividualParabolicDishes",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoParabolicDishForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyParabolicDishIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Parabolic Dishes: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForParabolicDishes=!0,O.pauseYearlySimulationForParabolicDishes=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoParabolicDishForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Parabolic Dishes",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForParabolicDishes=!0,B.pauseYearlySimulationForParabolicDishes=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-parabolic-dish-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Parabolic Dish Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-parabolic-dish-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Parabolic Dish Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Mjo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9208,7 +9208,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Djo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(bvt),l=M(sOe),s=M(d8t),c=Cn(uOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyFresnelReflectorYieldPanelRect||(D.viewState.dailyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyFresnelReflectorYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyFresnelReflectorYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyFresnelReflectorYieldPanelRect||(j.viewState.dailyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyFresnelReflectorYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyFresnelReflectorYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyFresnelReflectorYieldPanel=!1,e&&(D.actionInfo={name:"Close Fresnel Reflector Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.FresnelReflector);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyFresnelReflectorIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("fresnelReflectorYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"})},children:h.jsx(Mjo,{ref:f,style:{zIndex:d==="dailyFresnelReflectorYieldPanel"?bc:9},children:h.jsxs(Ijo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(zjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("fresnelReflectorYieldPanel.FresnelReflectorDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyFresnelReflectorYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("fresnelReflectorYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("fresnelReflectorYieldPanel.ShowOutputsOfIndividualFresnelReflectors",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoFresnelReflectorForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyFresnelReflectorIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Fresnel Reflectors: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForFresnelReflectors=!0,L.pauseDailySimulationForFresnelReflectors=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Rf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoFresnelReflectorForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForFresnelReflectors=!0,D.pauseDailySimulationForFresnelReflectors=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-fresnel-reflector-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Fresnel Reflector Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-fresnel-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Fresnel Reflector Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Ejo=Ho.div` +`,Djo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(bvt),l=M(sOe),s=M(d8t),c=Cn(uOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyFresnelReflectorYieldPanelRect||(D.viewState.dailyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyFresnelReflectorYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyFresnelReflectorYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyFresnelReflectorYieldPanelRect||(j.viewState.dailyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyFresnelReflectorYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyFresnelReflectorYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyFresnelReflectorYieldPanel=!1,e&&(D.actionInfo={name:"Close Fresnel Reflector Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.FresnelReflector);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyFresnelReflectorIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("fresnelReflectorYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"})},children:h.jsx(Mjo,{ref:f,style:{zIndex:d==="dailyFresnelReflectorYieldPanel"?bc:9},children:h.jsxs(Ijo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(zjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("fresnelReflectorYieldPanel.FresnelReflectorDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyFresnelReflectorYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("fresnelReflectorYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("fresnelReflectorYieldPanel.ShowOutputsOfIndividualFresnelReflectors",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoFresnelReflectorForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyFresnelReflectorIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Fresnel Reflectors: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForFresnelReflectors=!0,L.pauseDailySimulationForFresnelReflectors=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Hf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoFresnelReflectorForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForFresnelReflectors=!0,D.pauseDailySimulationForFresnelReflectors=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-fresnel-reflector-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Fresnel Reflector Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-fresnel-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Fresnel Reflector Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Ejo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -9246,7 +9246,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Ljo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Tvt),l=M(cOe),s=Cn(uOe),c=M(Ng),u=M(h8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyFresnelReflectorYieldPanelRect||(B.viewState.yearlyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyFresnelReflectorYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyFresnelReflectorYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyFresnelReflectorYieldPanelRect||(V.viewState.yearlyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyFresnelReflectorYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyFresnelReflectorYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyFresnelReflectorYieldPanel=!1,e&&(B.actionInfo={name:"Close Fresnel Reflector Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.FresnelReflector);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyFresnelReflectorIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("fresnelReflectorYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"})},children:h.jsx(Ejo,{ref:p,style:{zIndex:f==="yearlyFresnelReflectorYieldPanel"?bc:9},children:h.jsxs(Fjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(kjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("fresnelReflectorYieldPanel.FresnelReflectorYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyFresnelReflectorYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("fresnelReflectorYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("fresnelReflectorYieldPanel.ShowOutputsOfIndividualFresnelReflectors",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoFresnelReflectorForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyFresnelReflectorIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Fresnel Reflectors: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForFresnelReflectors=!0,O.pauseYearlySimulationForFresnelReflectors=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoFresnelReflectorForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForFresnelReflectors=!0,B.pauseYearlySimulationForFresnelReflectors=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-fresnel-reflector-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Fresnel Reflector Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-fresnel-reflector-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Fresnel Reflector Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Wjo=Ho.div` +`,Ljo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Tvt),l=M(cOe),s=Cn(uOe),c=M(Ng),u=M(h8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyFresnelReflectorYieldPanelRect||(B.viewState.yearlyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyFresnelReflectorYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyFresnelReflectorYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyFresnelReflectorYieldPanelRect||(V.viewState.yearlyFresnelReflectorYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyFresnelReflectorYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyFresnelReflectorYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyFresnelReflectorYieldPanel=!1,e&&(B.actionInfo={name:"Close Fresnel Reflector Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.FresnelReflector);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyFresnelReflectorIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("fresnelReflectorYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"})},children:h.jsx(Ejo,{ref:p,style:{zIndex:f==="yearlyFresnelReflectorYieldPanel"?bc:9},children:h.jsxs(Fjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(kjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("fresnelReflectorYieldPanel.FresnelReflectorYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyFresnelReflectorYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("fresnelReflectorYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("fresnelReflectorYieldPanel.ShowOutputsOfIndividualFresnelReflectors",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoFresnelReflectorForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyFresnelReflectorIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Fresnel Reflectors: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForFresnelReflectors=!0,O.pauseYearlySimulationForFresnelReflectors=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoFresnelReflectorForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Fresnel Reflectors",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForFresnelReflectors=!0,B.pauseYearlySimulationForFresnelReflectors=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-fresnel-reflector-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Fresnel Reflector Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-fresnel-reflector-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Fresnel Reflector Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Wjo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9284,7 +9284,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,jjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(zvt),l=M(dOe),s=M(p8t),c=Cn(hOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyHeliostatYieldPanelRect||(D.viewState.dailyHeliostatYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyHeliostatYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyHeliostatYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyHeliostatYieldPanelRect||(j.viewState.dailyHeliostatYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyHeliostatYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyHeliostatYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyHeliostatYieldPanel=!1,e&&(D.actionInfo={name:"Close Heliostat Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.Heliostat);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyHeliostatIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("heliostatYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyHeliostatYieldPanel"})},children:h.jsx(Wjo,{ref:f,style:{zIndex:d==="dailyHeliostatYieldPanel"?bc:9},children:h.jsxs(Njo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(Ujo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("heliostatYieldPanel.HeliostatDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyHeliostatYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("heliostatYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("heliostatYieldPanel.ShowOutputsOfIndividualHeliostats",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoHeliostatForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyHeliostatIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Heliostats: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForHeliostats=!0,L.pauseDailySimulationForHeliostats=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Rf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoHeliostatForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForHeliostats=!0,D.pauseDailySimulationForHeliostats=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-heliostat-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Heliostat Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-heliostat-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Heliostat Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Bjo=Ho.div` +`,jjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(Ng),a=Cn(zvt),l=M(dOe),s=M(p8t),c=Cn(hOe),u=dt(Cf),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:s?s.width+40:640,y=p.current?p.current.clientHeight+100:s?s.height+100:500,[S,C]=m.useState({x:s?Math.max(s.x,A-window.innerWidth):0,y:s?Math.min(s.y,window.innerHeight-y):0}),[P,v]=m.useState(0),[T,w]=m.useState(!1),x=m.useRef(new Map),b=$t();m.useEffect(()=>{let D=0;x.current.clear();for(const L of a)for(const j in L)Object.hasOwn(L,j)&&j!=="Hour"&&(D+=L[j],x.current.set(j,(x.current.get(j)??0)+L[j]));v(D),w(!T)},[a]),m.useEffect(()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})},[s,A,y]),m.useEffect(()=>{const D=()=>{C({x:Math.max(s==null?void 0:s.x,A-window.innerWidth),y:Math.min(s==null?void 0:s.y,window.innerHeight-y)})};return window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[s,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{o(D=>{p.current&&(D.viewState.dailyHeliostatYieldPanelRect||(D.viewState.dailyHeliostatYieldPanelRect=new cr(0,0,600,400)),D.viewState.dailyHeliostatYieldPanelRect.width=p.current.offsetWidth,D.viewState.dailyHeliostatYieldPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var D;(D=g.current)==null||D.disconnect()}),[]);const R=(D,L)=>{C({x:Math.max(L.x,A-window.innerWidth),y:Math.min(L.y,window.innerHeight-y)})},H=(D,L)=>{o(j=>{j.viewState.dailyHeliostatYieldPanelRect||(j.viewState.dailyHeliostatYieldPanelRect=new cr(0,0,600,400)),j.viewState.dailyHeliostatYieldPanelRect.x=Math.max(L.x,A-window.innerWidth),j.viewState.dailyHeliostatYieldPanelRect.y=Math.min(L.y,window.innerHeight-y)})},F=()=>{o(D=>{D.viewState.showDailyHeliostatYieldPanel=!1,e&&(D.actionInfo={name:"Close Heliostat Daily Yield Graph",timestamp:new Date().getTime()})})},E=i(z.Heliostat);m.useEffect(()=>{E<2&&l&&o(D=>{D.graphState&&(D.graphState.dailyHeliostatIndividualOutputs=!1)})},[E,l]);const{t:N}=Xl(),U=N("word.Hour",b),W=N("heliostatYieldPanel.YieldPerHour",b),k=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:R,onStop:H,onMouseDown:()=>{o(D=>{D.selectedFloatingWindow="dailyHeliostatYieldPanel"})},children:h.jsx(Wjo,{ref:f,style:{zIndex:d==="dailyHeliostatYieldPanel"?bc:9},children:h.jsxs(Njo,{ref:p,style:{opacity:n,width:(s?s.width:600)+"px",height:(s?s.height:400)+"px"},children:[h.jsxs(Ujo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[N("heliostatYieldPanel.HeliostatDailyYield",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:N("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{F()},onMouseDown:()=>{F()},children:N("word.Close",b)})]}),h.jsx(Sf,{type:vi.DailyHeliostatYield,chartType:l?Il.Line:Il.Area,dataSource:a,labels:c,height:100,dataKeyAxisX:"Hour",labelX:U,labelY:W,unitY:N("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&E>1&&x.current.size>0?h.jsx(Ml,{title:[...x.current.entries()].map((D,L)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:D[0]+": "}),h.jsx(Ke,{span:8,children:D[1].toFixed(3)})]}),L===x.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:N("word.Total",b)+": "+P.toFixed(3)+" "+N("word.kWh",b)})]})]},L)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:N("shared.OutputBreakdown",b)})}):h.jsxs(on,{style:{cursor:"default"},children:[N("heliostatYieldPanel.DailyTotal",b),":",P.toFixed(2)," ",N("word.kWh",b)]}),E>1&&h.jsx(vc,{title:N("heliostatYieldPanel.ShowOutputsOfIndividualHeliostats",b),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:D=>{if(E===0){gn(N("analysisManager.NoHeliostatForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(L=>{L.graphState&&(L.graphState.dailyHeliostatIndividualOutputs=D),e&&(L.actionInfo={name:"Run Daily Simulation For Heliostats: "+(D?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(L=>{L.runDailySimulationForHeliostats=!0,L.pauseDailySimulationForHeliostats=!1,L.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:k?h.jsx(Th,{}):h.jsx(Hf,{}),title:N(k?"word.Run":"word.Update",b),onClick:()=>{if(E===0){gn(N("analysisManager.NoHeliostatForAnalysis",b));return}gn(N("message.SimulationStarted",b)),setTimeout(()=>{o(D=>{e&&(D.actionInfo={name:"Run Daily Simulation For Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(D=>{D.runDailySimulationForHeliostats=!0,D.pauseDailySimulationForHeliostats=!1,D.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:N("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+U+"-"+W,"daily-heliostat-yield").then(()=>{gn(N("message.ScreenshotSaved",b)),e&&o(D=>{D.actionInfo={name:"Take Screenshot of Daily Heliostat Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:N("word.SaveAsCsv",b),onClick:()=>{Sh(a,"daily-heliostat-yield.csv"),gn(N("message.CsvFileSaved",b)),e&&o(D=>{D.actionInfo={name:"Export Daily Heliostat Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),Bjo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -9322,7 +9322,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Vjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Evt),l=M(fOe),s=Cn(hOe),c=M(Ng),u=M(m8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyHeliostatYieldPanelRect||(B.viewState.yearlyHeliostatYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyHeliostatYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyHeliostatYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyHeliostatYieldPanelRect||(V.viewState.yearlyHeliostatYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyHeliostatYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyHeliostatYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyHeliostatYieldPanel=!1,e&&(B.actionInfo={name:"Close Heliostat Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.Heliostat);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyHeliostatIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("heliostatYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyHeliostatYieldPanel"})},children:h.jsx(Bjo,{ref:p,style:{zIndex:f==="yearlyHeliostatYieldPanel"?bc:9},children:h.jsxs(Yjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(Ojo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("heliostatYieldPanel.HeliostatYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyHeliostatYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("heliostatYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("heliostatYieldPanel.ShowOutputsOfIndividualHeliostats",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoHeliostatForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyHeliostatIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Heliostats: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForHeliostats=!0,O.pauseYearlySimulationForHeliostats=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoHeliostatForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForHeliostats=!0,B.pauseYearlySimulationForHeliostats=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-heliostat-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Heliostat Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-heliostat-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Heliostat Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),_jo=be.memo(({dataSource:t,height:e,dataKeyAxisX:n,labelX:o,labelY1:r,labelY2:i,unitX:a,unitY1:l,unitY2:s,yMin1:c="auto",yMax1:u="auto",yMin2:d="auto",yMax2:f="auto",curveType:p="linear",referenceX:g,fractionDigits:A=2,symbolCount:y=12})=>{const[S,C]=m.useState(0),[P,v]=m.useState(null),T=!0,w=!0,x=2,b=1;m.useEffect(()=>{if(!t||t.length===0)return;let N=Array.isArray(t)?Object.keys(t[0]).length-1:Object.keys(t).length-1;N--,S!==N/2&&C(N/2)},[t]);const R=m.useMemo(()=>{const N=[];let U;N.push(h.jsx(Cg,{yAxisId:"left",type:p,name:"T_Ambient",dataKey:"T_Ambient",stroke:ng[0],strokeDasharray:"5 5",opacity:.5,strokeWidth:x,dot:!1,isAnimationActive:!1},"ambient-temperature"));for(let W=0;W0?L||U:!1,isAnimationActive:!1},"left-"+W)),k="V_Tower"+(W+1),D=P===null||P===k?1:.25,L=Wx(Nx[2*W+1],b,t.length,y,D),N.push(h.jsx(Cg,{yAxisId:"right",type:p,name:k,dataKey:k,stroke:ng[2*W+1],opacity:D,strokeWidth:x,dot:y>0?L||U:!1,isAnimationActive:!1},"right-"+W))}return N},[p,S,x,y,b,P]),H=()=>{},F=N=>{v(N.dataKey)},E=()=>{v(null)};return h.jsx(h.Fragment,{children:t&&h.jsx("div",{id:"biaxial-line-graph-"+o+"-"+r+"-"+i,style:{width:"100%",height:`${e}%`,position:"relative",direction:"ltr"},children:h.jsx("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(p6e,{data:t,onMouseDown:H,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:N=>N.toFixed(A)}),h.jsx(Cw,{vertical:w,horizontal:T,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{yAxisId:"left",x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:n??o,fontSize:"10px",children:h.jsx(is,{value:o+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[c,u],yAxisId:"left",fontSize:"10px",children:h.jsx(is,{dx:-15,value:r+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),h.jsx(wh,{domain:[d,f],yAxisId:"right",orientation:"right",fontSize:"10px",children:h.jsx(is,{dx:15,value:i+(s?" ("+s+")":""),offset:0,angle:-90,position:"center"})}),R,S>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:E,onMouseEnter:F})]})})})})})}),Gjo=Ho.div` +`,Vjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(mW)??6,i=new Date(M(Al)),a=Cn(Evt),l=M(fOe),s=Cn(hOe),c=M(Ng),u=M(m8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyHeliostatYieldPanelRect||(B.viewState.yearlyHeliostatYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyHeliostatYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyHeliostatYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyHeliostatYieldPanelRect||(V.viewState.yearlyHeliostatYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyHeliostatYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyHeliostatYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyHeliostatYieldPanel=!1,e&&(B.actionInfo={name:"Close Heliostat Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(z.Heliostat);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyHeliostatIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("heliostatYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlyHeliostatYieldPanel"})},children:h.jsx(Bjo,{ref:p,style:{zIndex:f==="yearlyHeliostatYieldPanel"?bc:9},children:h.jsxs(Yjo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(Ojo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("heliostatYieldPanel.HeliostatYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyHeliostatYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[l&&U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("heliostatYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),U>1&&h.jsx(vc,{title:W("heliostatYieldPanel.ShowOutputsOfIndividualHeliostats",H),checkedChildren:h.jsx(du,{}),unCheckedChildren:h.jsx(du,{}),checked:l,onChange:B=>{if(U===0){gn(W("analysisManager.NoHeliostatForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(O=>{O.graphState&&(O.graphState.yearlyHeliostatIndividualOutputs=B),e&&(O.actionInfo={name:"Run Yearly Simulation For Heliostats: "+(B?"Individual":"Total"),timestamp:new Date().getTime()})}),dt.getState().set(O=>{O.runYearlySimulationForHeliostats=!0,O.pauseYearlySimulationForHeliostats=!1,O.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoHeliostatForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Heliostats",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runYearlySimulationForHeliostats=!0,B.pauseYearlySimulationForHeliostats=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-heliostat-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Heliostat Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-heliostat-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Heliostat Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),_jo=be.memo(({dataSource:t,height:e,dataKeyAxisX:n,labelX:o,labelY1:r,labelY2:i,unitX:a,unitY1:l,unitY2:s,yMin1:c="auto",yMax1:u="auto",yMin2:d="auto",yMax2:f="auto",curveType:p="linear",referenceX:g,fractionDigits:A=2,symbolCount:y=12})=>{const[S,C]=m.useState(0),[P,v]=m.useState(null),T=!0,w=!0,x=2,b=1;m.useEffect(()=>{if(!t||t.length===0)return;let N=Array.isArray(t)?Object.keys(t[0]).length-1:Object.keys(t).length-1;N--,S!==N/2&&C(N/2)},[t]);const R=m.useMemo(()=>{const N=[];let U;N.push(h.jsx(Cg,{yAxisId:"left",type:p,name:"T_Ambient",dataKey:"T_Ambient",stroke:ng[0],strokeDasharray:"5 5",opacity:.5,strokeWidth:x,dot:!1,isAnimationActive:!1},"ambient-temperature"));for(let W=0;W0?L||U:!1,isAnimationActive:!1},"left-"+W)),k="V_Tower"+(W+1),D=P===null||P===k?1:.25,L=Wx(Nx[2*W+1],b,t.length,y,D),N.push(h.jsx(Cg,{yAxisId:"right",type:p,name:k,dataKey:k,stroke:ng[2*W+1],opacity:D,strokeWidth:x,dot:y>0?L||U:!1,isAnimationActive:!1},"right-"+W))}return N},[p,S,x,y,b,P]),H=()=>{},F=N=>{v(N.dataKey)},E=()=>{v(null)};return h.jsx(h.Fragment,{children:t&&h.jsx("div",{id:"biaxial-line-graph-"+o+"-"+r+"-"+i,style:{width:"100%",height:`${e}%`,position:"relative",direction:"ltr"},children:h.jsx("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(p6e,{data:t,onMouseDown:H,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:N=>N.toFixed(A)}),h.jsx(Cw,{vertical:w,horizontal:T,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{yAxisId:"left",x:g,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:n??o,fontSize:"10px",children:h.jsx(is,{value:o+(a?" ("+a+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[c,u],yAxisId:"left",fontSize:"10px",children:h.jsx(is,{dx:-15,value:r+(l?" ("+l+")":""),offset:0,angle:-90,position:"center"})}),h.jsx(vh,{domain:[d,f],yAxisId:"right",orientation:"right",fontSize:"10px",children:h.jsx(is,{dx:15,value:i+(s?" ("+s+")":""),offset:0,angle:-90,position:"center"})}),R,S>1&&h.jsx(X2,{iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:E,onMouseEnter:F})]})})})})})}),Gjo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9360,7 +9360,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Kjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(VYe),a=Cn(Uvt),l=Cn(Nvt),s=M(jvt),c=M(y8t),u=Cn(mOe),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:c?c.width+40:680,S=g.current?g.current.clientHeight+100:c?c.height+100:650,[C,P]=m.useState({x:c?Math.max(c.x,y-window.innerWidth):0,y:c?Math.min(c.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Hour"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(c==null?void 0:c.x,y-window.innerWidth),y:Math.min(c==null?void 0:c.y,window.innerHeight-S)})},[c,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(c==null?void 0:c.x,y-window.innerWidth),y:Math.min(c==null?void 0:c.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[c,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.dailyUpdraftTowerYieldPanelRect||(B.viewState.dailyUpdraftTowerYieldPanelRect=new cr(0,0,640,550)),B.viewState.dailyUpdraftTowerYieldPanelRect.width=g.current.offsetWidth,B.viewState.dailyUpdraftTowerYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const H=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},F=(B,O)=>{o(V=>{V.viewState.dailyUpdraftTowerYieldPanelRect||(V.viewState.dailyUpdraftTowerYieldPanelRect=new cr(0,0,640,550)),V.viewState.dailyUpdraftTowerYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.dailyUpdraftTowerYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},E=()=>{o(B=>{B.viewState.showDailyUpdraftTowerYieldPanel=!1,e&&(B.actionInfo={name:"Close Solar Updraft Tower Daily Yield Graph",timestamp:new Date().getTime()})})},N=i(Dn.UpdraftTower);m.useEffect(()=>{N<2&&s&&o(B=>{B.graphState&&(B.graphState.dailyUpdraftTowerIndividualOutputs=!1)})},[N,s]);const{t:U}=Xl(),W=U("word.Hour",R),k=U("updraftTowerYieldPanel.YieldPerHour",R),D=U("updraftTowerYieldPanel.ChimneyAirTemperature",R),L=U("updraftTowerYieldPanel.ChimneyWindSpeed",R),j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:H,onStop:F,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"})},children:h.jsx(Gjo,{ref:p,style:{zIndex:f==="dailySolarUpdraftTowerYieldPanel"?bc:9},children:h.jsxs(Xjo,{ref:g,style:{opacity:n,width:(c?c.width:640)+"px",height:(c?c.height:550)+"px"},children:[h.jsxs(Jjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[U("updraftTowerYieldPanel.UpdraftTowerDailyYield",R)+": ",h.jsx("span",{style:{fontSize:"10px"},children:U("sensorPanel.WeatherDataFrom",R)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{E()},onMouseDown:()=>{E()},children:U("word.Close",R)})]}),h.jsx(Sf,{type:vi.DailyUpdraftTowerYield,chartType:s?Il.Line:Il.Area,dataSource:a,labels:u,height:100,dataKeyAxisX:"Hour",labelX:W,labelY:k,unitY:U("word.kWh",R),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),h.jsx(_jo,{dataSource:l,height:100,dataKeyAxisX:"Hour",labelX:W,labelY1:D,labelY2:L,unitY1:"°C",unitY2:U("word.MeterPerSecond",R),yMin1:0,yMin2:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[N>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:B[1].toFixed(3)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:U("word.Total",R)+": "+v.toFixed(3)+" "+U("word.kWh",R)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:U("shared.OutputBreakdown",R)})}):h.jsxs(on,{style:{cursor:"default"},children:[U("updraftTowerYieldPanel.DailyTotal",R),":",v.toFixed(2)," ",U("word.kWh",R)]}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:U(j?"word.Run":"word.Update",R),onClick:()=>{if(N===0){gn(U("analysisManager.NoSolarUpdraftTowerForAnalysis",R));return}gn(U("message.SimulationStarted",R)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Daily Simulation For Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runDailySimulationForUpdraftTower=!0,B.pauseDailySimulationForUpdraftTower=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:U("word.SaveAsImage",R),onClick:()=>{Ed("line-graph-"+W+"-"+k,"daily-updraft-tower-yield").then(()=>{gn(U("message.ScreenshotSaved",R)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Daily Updraft Tower Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:U("word.SaveAsCsv",R),onClick:()=>{Sh(a,"daily-updraft-tower-yield.csv"),gn(U("message.CsvFileSaved",R)),e&&o(B=>{B.actionInfo={name:"Export Daily Updraft Tower Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),qjo=Ho.div` +`,Kjo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=new Date(M(Al)),i=M(VYe),a=Cn(Uvt),l=Cn(Nvt),s=M(jvt),c=M(y8t),u=Cn(mOe),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:c?c.width+40:680,S=g.current?g.current.clientHeight+100:c?c.height+100:650,[C,P]=m.useState({x:c?Math.max(c.x,y-window.innerWidth):0,y:c?Math.min(c.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Hour"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(c==null?void 0:c.x,y-window.innerWidth),y:Math.min(c==null?void 0:c.y,window.innerHeight-S)})},[c,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(c==null?void 0:c.x,y-window.innerWidth),y:Math.min(c==null?void 0:c.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[c,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.dailyUpdraftTowerYieldPanelRect||(B.viewState.dailyUpdraftTowerYieldPanelRect=new cr(0,0,640,550)),B.viewState.dailyUpdraftTowerYieldPanelRect.width=g.current.offsetWidth,B.viewState.dailyUpdraftTowerYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const H=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},F=(B,O)=>{o(V=>{V.viewState.dailyUpdraftTowerYieldPanelRect||(V.viewState.dailyUpdraftTowerYieldPanelRect=new cr(0,0,640,550)),V.viewState.dailyUpdraftTowerYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.dailyUpdraftTowerYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},E=()=>{o(B=>{B.viewState.showDailyUpdraftTowerYieldPanel=!1,e&&(B.actionInfo={name:"Close Solar Updraft Tower Daily Yield Graph",timestamp:new Date().getTime()})})},N=i(Dn.UpdraftTower);m.useEffect(()=>{N<2&&s&&o(B=>{B.graphState&&(B.graphState.dailyUpdraftTowerIndividualOutputs=!1)})},[N,s]);const{t:U}=Xl(),W=U("word.Hour",R),k=U("updraftTowerYieldPanel.YieldPerHour",R),D=U("updraftTowerYieldPanel.ChimneyAirTemperature",R),L=U("updraftTowerYieldPanel.ChimneyWindSpeed",R),j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:H,onStop:F,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"})},children:h.jsx(Gjo,{ref:p,style:{zIndex:f==="dailySolarUpdraftTowerYieldPanel"?bc:9},children:h.jsxs(Xjo,{ref:g,style:{opacity:n,width:(c?c.width:640)+"px",height:(c?c.height:550)+"px"},children:[h.jsxs(Jjo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[U("updraftTowerYieldPanel.UpdraftTowerDailyYield",R)+": ",h.jsx("span",{style:{fontSize:"10px"},children:U("sensorPanel.WeatherDataFrom",R)+" "+t+" | "+yr(r).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{E()},onMouseDown:()=>{E()},children:U("word.Close",R)})]}),h.jsx(Sf,{type:vi.DailyUpdraftTowerYield,chartType:s?Il.Line:Il.Area,dataSource:a,labels:u,height:100,dataKeyAxisX:"Hour",labelX:W,labelY:k,unitY:U("word.kWh",R),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),h.jsx(_jo,{dataSource:l,height:100,dataKeyAxisX:"Hour",labelX:W,labelY1:D,labelY2:L,unitY1:"°C",unitY2:U("word.MeterPerSecond",R),yMin1:0,yMin2:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:r.getHours()}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[N>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:B[1].toFixed(3)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:U("word.Total",R)+": "+v.toFixed(3)+" "+U("word.kWh",R)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:U("shared.OutputBreakdown",R)})}):h.jsxs(on,{style:{cursor:"default"},children:[U("updraftTowerYieldPanel.DailyTotal",R),":",v.toFixed(2)," ",U("word.kWh",R)]}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:U(j?"word.Run":"word.Update",R),onClick:()=>{if(N===0){gn(U("analysisManager.NoSolarUpdraftTowerForAnalysis",R));return}gn(U("message.SimulationStarted",R)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Daily Simulation For Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.runDailySimulationForUpdraftTower=!0,B.pauseDailySimulationForUpdraftTower=!1,B.simulationInProgress=!0})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:U("word.SaveAsImage",R),onClick:()=>{Ed("line-graph-"+W+"-"+k,"daily-updraft-tower-yield").then(()=>{gn(U("message.ScreenshotSaved",R)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Daily Updraft Tower Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:U("word.SaveAsCsv",R),onClick:()=>{Sh(a,"daily-updraft-tower-yield.csv"),gn(U("message.CsvFileSaved",R)),e&&o(B=>{B.actionInfo={name:"Export Daily Updraft Tower Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),qjo=Ho.div` position: fixed; top: 80px; left: 10px; @@ -9397,7 +9397,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,Zjo=be.memo(({city:t})=>{const e=M(En),n=M(hu)??g0,o=M(pn),r=M(Al),i=M(s0),a=M(b8t),l=M(_Be)??y2.Sinusoidal,s=M(gW)??900,c=M(O4t),u=M(Sc),d=be.useRef(null),f=m.useRef(null),p=m.useRef(),g=f.current?f.current.clientWidth+40:c?c.width+40:640,A=f.current?f.current.clientHeight+100:c?c.height+100:500,[y,S]=m.useState({x:c?Math.min(c.x,window.innerWidth-g):0,y:c?Math.min(c.y,window.innerHeight-A):0}),[C,P]=m.useState(l),v=new Date(r),T=$t(),w=u1(t);m.useEffect(()=>{S({x:Math.min(c==null?void 0:c.x,window.innerWidth-g),y:Math.min(c==null?void 0:c.y,window.innerHeight-A)})},[c,g,A]),m.useEffect(()=>{const E=()=>{S({x:Math.min(c==null?void 0:c.x,window.innerWidth-g),y:Math.min(c==null?void 0:c.y,window.innerHeight-A)})};return window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)}},[c,g,A]),m.useEffect(()=>(f.current&&(p.current||(p.current=new ResizeObserver(()=>{o(E=>{f.current&&(E.viewState.diurnalTemperaturePanelRect||(E.viewState.diurnalTemperaturePanelRect=new cr(0,0,600,400)),E.viewState.diurnalTemperaturePanelRect.width=f.current.offsetWidth,E.viewState.diurnalTemperaturePanelRect.height=f.current.offsetHeight)})})),p.current.observe(f.current)),()=>{var E;(E=p.current)==null||E.disconnect()}),[]);const x=m.useMemo(()=>{const E=[];if(w){const N=dl(v,i);for(let U=0;U<24;U++){v.setHours(U);const W=rb(v,w.lowestTemperatures,w.highestTemperatures),k=ye.minutesIntoDay(v);E.push({Hour:U,Sinusoidal:ob(W.high,W.low,y2.Sinusoidal,s,N,k),PartonLogan:ob(W.high,W.low,y2.PartonLogan,s,N,k),Ground:wZe(i,ye.dayOfYear(v),k,w.lowestTemperatures,w.highestTemperatures,s,.5*(W.high-W.low),a.thermalDiffusivity??.05,ije)})}}return E},[w,s,r,i,a.thermalDiffusivity]),b=(E,N)=>{S({x:Math.min(N.x,window.innerWidth-g),y:Math.min(N.y,window.innerHeight-A)})},R=(E,N)=>{o(U=>{U.viewState.diurnalTemperaturePanelRect||(U.viewState.diurnalTemperaturePanelRect=new cr(0,0,600,400)),U.viewState.diurnalTemperaturePanelRect.x=Math.min(N.x,window.innerWidth-g),U.viewState.diurnalTemperaturePanelRect.y=Math.min(N.y,window.innerHeight-A)})},H=()=>{const E={name:"Close Diurnal Temperature Panel",timestamp:Date.now(),undo:()=>{o(N=>{N.viewState.showDiurnalTemperaturePanel=!0})},redo:()=>{o(N=>{N.viewState.showDiurnalTemperaturePanel=!1})}};e(E),o(N=>{N.viewState.showDiurnalTemperaturePanel=!1})},F=E=>{const N=C,U=E.target.value,W={name:"Change Diurnal Temperature Model",timestamp:Date.now(),oldValue:N,newValue:U,undo:()=>{P(W.oldValue),o(k=>{k.world.diurnalTemperatureModel=W.oldValue})},redo:()=>{P(W.newValue),o(k=>{k.world.diurnalTemperatureModel=W.newValue})}};e(W),P(U),o(k=>{k.world.diurnalTemperatureModel=U})};return h.jsx(Bi,{nodeRef:d,handle:".handle",bounds:"parent",axis:"both",position:y,onDrag:b,onStop:R,onMouseDown:()=>{o(E=>{E.selectedFloatingWindow="diurnalTemperaturePanel"})},children:h.jsx(qjo,{ref:d,style:{zIndex:u==="diurnalTemperaturePanel"?bc:10},children:h.jsxs($jo,{ref:f,style:{opacity:n,width:(c?c.width:600)+"px",height:(c?c.height:400)+"px"},children:[h.jsxs(Qjo,{className:"handle",children:[h.jsx("span",{children:Y.t("menu.settings.DiurnalTemperature",T)+": "+t+" | "+ul(v).format("MM/DD")}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{H()},onMouseDown:()=>{H()},children:Y.t("word.Close",T)})]}),h.jsx(Sf,{chartType:Il.Line,type:vi.HourlyTemperatures,selectedIndex:C-y2.Sinusoidal,dataSource:x,height:100,dataKeyAxisX:"Hour",labelX:Y.t("word.Hour",T),labelY:Y.t("word.Temperature",T),unitY:"°C",fractionDigits:1,referenceX:v.getHours()}),h.jsxs(on,{style:{alignSelf:"center"},children:[h.jsx(on,{children:Y.t("diurnalTemperaturePanel.SelectAirTemperatureModel",T)}),h.jsxs(Le.Group,{onChange:F,value:C,style:{display:"flex"},children:[h.jsx(Le,{style:{width:"auto"},value:y2.Sinusoidal,children:Y.t("diurnalTemperaturePanel.Sinusoidal",T)}),h.jsx(Le,{style:{width:"auto"},value:y2.PartonLogan,children:"Parton-Logan"})]})]})]})})})}),eBo=Ho.div` +`,Zjo=be.memo(({city:t})=>{const e=M(En),n=M(hu)??g0,o=M(pn),r=M(Al),i=M(s0),a=M(b8t),l=M(_Be)??y2.Sinusoidal,s=M(gW)??900,c=M(O4t),u=M(Sc),d=be.useRef(null),f=m.useRef(null),p=m.useRef(),g=f.current?f.current.clientWidth+40:c?c.width+40:640,A=f.current?f.current.clientHeight+100:c?c.height+100:500,[y,S]=m.useState({x:c?Math.min(c.x,window.innerWidth-g):0,y:c?Math.min(c.y,window.innerHeight-A):0}),[C,P]=m.useState(l),v=new Date(r),T=$t(),w=u1(t);m.useEffect(()=>{S({x:Math.min(c==null?void 0:c.x,window.innerWidth-g),y:Math.min(c==null?void 0:c.y,window.innerHeight-A)})},[c,g,A]),m.useEffect(()=>{const E=()=>{S({x:Math.min(c==null?void 0:c.x,window.innerWidth-g),y:Math.min(c==null?void 0:c.y,window.innerHeight-A)})};return window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)}},[c,g,A]),m.useEffect(()=>(f.current&&(p.current||(p.current=new ResizeObserver(()=>{o(E=>{f.current&&(E.viewState.diurnalTemperaturePanelRect||(E.viewState.diurnalTemperaturePanelRect=new cr(0,0,600,400)),E.viewState.diurnalTemperaturePanelRect.width=f.current.offsetWidth,E.viewState.diurnalTemperaturePanelRect.height=f.current.offsetHeight)})})),p.current.observe(f.current)),()=>{var E;(E=p.current)==null||E.disconnect()}),[]);const x=m.useMemo(()=>{const E=[];if(w){const N=dl(v,i);for(let U=0;U<24;U++){v.setHours(U);const W=rb(v,w.lowestTemperatures,w.highestTemperatures),k=me.minutesIntoDay(v);E.push({Hour:U,Sinusoidal:ob(W.high,W.low,y2.Sinusoidal,s,N,k),PartonLogan:ob(W.high,W.low,y2.PartonLogan,s,N,k),Ground:wZe(i,me.dayOfYear(v),k,w.lowestTemperatures,w.highestTemperatures,s,.5*(W.high-W.low),a.thermalDiffusivity??.05,ije)})}}return E},[w,s,r,i,a.thermalDiffusivity]),b=(E,N)=>{S({x:Math.min(N.x,window.innerWidth-g),y:Math.min(N.y,window.innerHeight-A)})},R=(E,N)=>{o(U=>{U.viewState.diurnalTemperaturePanelRect||(U.viewState.diurnalTemperaturePanelRect=new cr(0,0,600,400)),U.viewState.diurnalTemperaturePanelRect.x=Math.min(N.x,window.innerWidth-g),U.viewState.diurnalTemperaturePanelRect.y=Math.min(N.y,window.innerHeight-A)})},H=()=>{const E={name:"Close Diurnal Temperature Panel",timestamp:Date.now(),undo:()=>{o(N=>{N.viewState.showDiurnalTemperaturePanel=!0})},redo:()=>{o(N=>{N.viewState.showDiurnalTemperaturePanel=!1})}};e(E),o(N=>{N.viewState.showDiurnalTemperaturePanel=!1})},F=E=>{const N=C,U=E.target.value,W={name:"Change Diurnal Temperature Model",timestamp:Date.now(),oldValue:N,newValue:U,undo:()=>{P(W.oldValue),o(k=>{k.world.diurnalTemperatureModel=W.oldValue})},redo:()=>{P(W.newValue),o(k=>{k.world.diurnalTemperatureModel=W.newValue})}};e(W),P(U),o(k=>{k.world.diurnalTemperatureModel=U})};return h.jsx(Bi,{nodeRef:d,handle:".handle",bounds:"parent",axis:"both",position:y,onDrag:b,onStop:R,onMouseDown:()=>{o(E=>{E.selectedFloatingWindow="diurnalTemperaturePanel"})},children:h.jsx(qjo,{ref:d,style:{zIndex:u==="diurnalTemperaturePanel"?bc:10},children:h.jsxs($jo,{ref:f,style:{opacity:n,width:(c?c.width:600)+"px",height:(c?c.height:400)+"px"},children:[h.jsxs(Qjo,{className:"handle",children:[h.jsx("span",{children:Y.t("menu.settings.DiurnalTemperature",T)+": "+t+" | "+ul(v).format("MM/DD")}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{H()},onMouseDown:()=>{H()},children:Y.t("word.Close",T)})]}),h.jsx(Sf,{chartType:Il.Line,type:vi.HourlyTemperatures,selectedIndex:C-y2.Sinusoidal,dataSource:x,height:100,dataKeyAxisX:"Hour",labelX:Y.t("word.Hour",T),labelY:Y.t("word.Temperature",T),unitY:"°C",fractionDigits:1,referenceX:v.getHours()}),h.jsxs(on,{style:{alignSelf:"center"},children:[h.jsx(on,{children:Y.t("diurnalTemperaturePanel.SelectAirTemperatureModel",T)}),h.jsxs(Le.Group,{onChange:F,value:C,style:{display:"flex"},children:[h.jsx(Le,{style:{width:"auto"},value:y2.Sinusoidal,children:Y.t("diurnalTemperaturePanel.Sinusoidal",T)}),h.jsx(Le,{style:{width:"auto"},value:y2.PartonLogan,children:"Parton-Logan"})]})]})]})})})}),eBo=Ho.div` position: fixed; top: 85px; right: 36px; @@ -9435,7 +9435,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,oBo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(GBe)??6,i=new Date(M(Al)),a=Cn(Ovt),l=M(Vvt),s=Cn(mOe),c=M(VYe),u=M(w8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyUpdraftTowerYieldPanelRect||(B.viewState.yearlyUpdraftTowerYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyUpdraftTowerYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyUpdraftTowerYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyUpdraftTowerYieldPanelRect||(V.viewState.yearlyUpdraftTowerYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyUpdraftTowerYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyUpdraftTowerYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyUpdraftTowerYieldPanel=!1,e&&(B.actionInfo={name:"Close Solar Updraft Tower Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(Dn.UpdraftTower);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyUpdraftTowerIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("updraftTowerYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"})},children:h.jsx(eBo,{ref:p,style:{zIndex:f==="yearlySolarUpdraftTowerYieldPanel"?bc:9},children:h.jsxs(tBo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(nBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("updraftTowerYieldPanel.UpdraftTowerYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyUpdraftTowerYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("updraftTowerYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Rf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoSolarUpdraftTowerForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.simulationInProgress=!0,B.runYearlySimulationForUpdraftTower=!0,B.pauseYearlySimulationForUpdraftTower=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-updraft-tower-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Updraft Tower Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-updraft-tower-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Updraft Tower Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),rBo=({dataSource:t,labels:e,height:n,dataKeyAxisX:o,labelX:r,labelY1:i,labelY2:a,unitX:l,unitY1:s,unitY2:c,yMin1:u="auto",yMax1:d="auto",yMin2:f="auto",yMax2:p="auto",curveType:g="linear",referenceX:A,fractionDigits:y=2})=>{const S=M(c$),[C,P]=m.useState(null),v=!0,T=!0,w=2,x=1,b=m.useRef([]),R=m.useMemo(()=>{if(!t||t.length===0)return[];const N=Object.keys(t[0]).length-1,U=t[1]?Object.keys(t[1]).length-1:N,W=t.length,k=[],D=N-1,L=(U-N)/D;let j;b.current.length=0;for(let B=0;B0?G||j:!1,isAnimationActive:!1},"left-"+B)),b.current.push({id:O,type:"line",value:O,color:ng[B]})}else if(B===D){const O="Objective",V=C===null||C===O?1:.25,G=Wx(Nx[B],x,t.length,W,V);k.push(h.jsx(Cg,{yAxisId:"right",type:g,name:O,dataKey:O,stroke:ng[B],opacity:V,strokeWidth:w,dot:W>0?G||j:!1,isAnimationActive:!1},"right")),b.current.push({id:O,type:"line",value:O,color:ng[D]})}else{const O=Math.floor((B-N)/L),V="Individual"+(B+1),G=.5,q=Wx(Nx[O],x*.5,t.length,W,G,ng[O]);k.push(h.jsx(Cg,{yAxisId:"left",type:g,name:V,dataKey:V,opacity:G,stroke:ng[O],strokeWidth:0,dot:q||j,isAnimationActive:!1},"left-"+B))}return k},[t,g,w,x,C]),H=()=>{},F=N=>{P(N.id)},E=()=>{P(null)};return h.jsx(h.Fragment,{children:t&&h.jsx("div",{id:"biaxial-line-graph-"+r+"-"+i+"-"+a,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsx("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(p6e,{data:t,onMouseDown:H,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:N=>N.toFixed(y),content:({active:N,payload:U})=>!N||!U?null:U.map(W=>{var k;if(!((k=W.name)!=null&&k.toString().startsWith("Individual"))){let D;return W.name==="Tilt Angle"?D=ye.toDegrees(W.value*(S.maximumTiltAngle-S.minimumTiltAngle)+S.minimumTiltAngle).toFixed(y)+"°":W.name==="Inter-Row Spacing"?D=(W.value*(S.maximumInterRowSpacing-S.minimumInterRowSpacing)+S.minimumInterRowSpacing).toFixed(y)+"m":W.name==="Rack Width"?D=Math.floor(W.value*(S.maximumRowsPerRack-S.minimumRowsPerRack)+S.minimumRowsPerRack)+" panels":W.name==="Objective"?D=W.value.toFixed(y)+" "+c:D=W.value.toFixed(y),h.jsxs("div",{children:[W.name,": ",D]},W.name)}return null})}),h.jsx(Cw,{vertical:T,horizontal:v,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{yAxisId:"left",x:A,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:o??r,style:{fontSize:"10px"},children:h.jsx(is,{value:r+(l?" ("+l+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[u,d],yAxisId:"left",style:{fontSize:"10px"},children:h.jsx(is,{dx:-20,value:i+(s?" ("+s+")":""),offset:0,angle:-90,position:"center"})}),h.jsx(wh,{domain:[f,p],yAxisId:"right",orientation:"right",style:{fontSize:"10px"},children:h.jsx(is,{dx:30,value:a+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),R,h.jsx(X2,{payload:b.current,iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:E,onMouseEnter:F})]})})})})})},iBo=Ho.div` +`,oBo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(GBe)??6,i=new Date(M(Al)),a=Cn(Ovt),l=M(Vvt),s=Cn(mOe),c=M(VYe),u=M(w8t),d=dt(Cf),f=M(Sc),p=be.useRef(null),g=m.useRef(null),A=m.useRef(),y=g.current?g.current.clientWidth+40:u?u.width+40:640,S=g.current?g.current.clientHeight+100:u?u.height+100:500,[C,P]=m.useState({x:u?Math.max(u.x,y-window.innerWidth):0,y:u?Math.min(u.y,window.innerHeight-S):0}),[v,T]=m.useState(0),[w,x]=m.useState(!1),b=m.useRef(new Map),R=zs[i.getMonth()],H=$t();m.useEffect(()=>{let B=0;b.current.clear();for(const O of a)for(const V in O)Object.hasOwn(O,V)&&V!=="Month"&&(B+=O[V],b.current.set(V,(b.current.get(V)??0)+O[V]));T(B),x(!w)},[a]),m.useEffect(()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})},[u,y,S]),m.useEffect(()=>{const B=()=>{P({x:Math.max(u==null?void 0:u.x,y-window.innerWidth),y:Math.min(u==null?void 0:u.y,window.innerHeight-S)})};return window.addEventListener("resize",B),()=>{window.removeEventListener("resize",B)}},[u,y,S]),m.useEffect(()=>(g.current&&(A.current||(A.current=new ResizeObserver(()=>{o(B=>{g.current&&(B.viewState.yearlyUpdraftTowerYieldPanelRect||(B.viewState.yearlyUpdraftTowerYieldPanelRect=new cr(0,0,600,400)),B.viewState.yearlyUpdraftTowerYieldPanelRect.width=g.current.offsetWidth,B.viewState.yearlyUpdraftTowerYieldPanelRect.height=g.current.offsetHeight)})})),A.current.observe(g.current)),()=>{var B;(B=A.current)==null||B.disconnect()}),[]);const F=(B,O)=>{P({x:Math.max(O.x,y-window.innerWidth),y:Math.min(O.y,window.innerHeight-S)})},E=(B,O)=>{o(V=>{V.viewState.yearlyUpdraftTowerYieldPanelRect||(V.viewState.yearlyUpdraftTowerYieldPanelRect=new cr(0,0,600,400)),V.viewState.yearlyUpdraftTowerYieldPanelRect.x=Math.max(O.x,y-window.innerWidth),V.viewState.yearlyUpdraftTowerYieldPanelRect.y=Math.min(O.y,window.innerHeight-S)})},N=()=>{o(B=>{B.viewState.showYearlyUpdraftTowerYieldPanel=!1,e&&(B.actionInfo={name:"Close Solar Updraft Tower Yearly Yield Graph",timestamp:new Date().getTime()})})},U=c(Dn.UpdraftTower);m.useEffect(()=>{U<2&&l&&o(B=>{B.graphState&&(B.graphState.yearlyUpdraftTowerIndividualOutputs=!1)})},[U,l]);const{t:W}=Xl(),k=W("word.Month",H),D=W("updraftTowerYieldPanel.Yield",H),L=12/r,j=a&&a[0]?Object.keys(a[0]).length===0:!0;return h.jsx(Bi,{nodeRef:p,handle:".handle",bounds:"parent",axis:"both",position:C,onDrag:F,onStop:E,onMouseDown:()=>{o(B=>{B.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"})},children:h.jsx(eBo,{ref:p,style:{zIndex:f==="yearlySolarUpdraftTowerYieldPanel"?bc:9},children:h.jsxs(tBo,{ref:g,style:{opacity:n,width:(u?u.width:600)+"px",height:(u?u.height:400)+"px"},children:[h.jsxs(nBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[W("updraftTowerYieldPanel.UpdraftTowerYearlyYield",H)+": ",h.jsx("span",{style:{fontSize:"10px"},children:W("sensorPanel.WeatherDataFrom",H)+" "+t+" | "+i.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{N()},onMouseDown:()=>{N()},children:W("word.Close",H)})]}),h.jsx(Sf,{type:vi.YearlyUpdraftTowerYield,chartType:l?Il.Line:Il.Area,dataSource:a.map(({Daylight:B,Clearness:O,...V})=>V),labels:s,height:100,dataKeyAxisX:"Month",labelX:k,labelY:D,unitY:W("word.kWh",H),yMin:0,curveType:"linear",fractionDigits:2,referenceX:R}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[U>1&&b.current.size>0?h.jsx(Ml,{title:[...b.current.entries()].map((B,O)=>h.jsxs(be.Fragment,{children:[h.jsxs(nn,{style:{textAlign:"right"},children:[h.jsx(Ke,{span:16,style:{textAlign:"right",paddingRight:"8px"},children:B[0]+": "}),h.jsx(Ke,{span:8,children:(B[1]*L).toFixed(2)})]}),O===b.current.size-1&&h.jsxs(h.Fragment,{children:[h.jsx("hr",{}),h.jsx("div",{style:{textAlign:"right"},children:W("word.Total",H)+": "+(v*L).toFixed(2)+" "+W("word.kWh",H)})]})]},O)),children:h.jsx(on,{style:{cursor:"pointer",border:"2px solid #ccc",padding:"4px"},children:W("shared.OutputBreakdown",H)})}):h.jsxs(on,{children:[W("updraftTowerYieldPanel.YearlyTotal",H),":",(v*L).toFixed(2)," ",W("word.kWh",H)]}),h.jsx(io,{type:"default",icon:j?h.jsx(Th,{}):h.jsx(Hf,{}),title:W(j?"word.Run":"word.Update",H),onClick:()=>{if(U===0){gn(W("analysisManager.NoSolarUpdraftTowerForAnalysis",H));return}gn(W("message.SimulationStarted",H)),setTimeout(()=>{o(B=>{e&&(B.actionInfo={name:"Run Yearly Simulation For Solar Updraft Tower",timestamp:new Date().getTime()})}),dt.getState().set(B=>{B.simulationInProgress=!0,B.runYearlySimulationForUpdraftTower=!0,B.pauseYearlySimulationForUpdraftTower=!1})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:W("word.SaveAsImage",H),onClick:()=>{Ed("line-graph-"+k+"-"+D,"yearly-updraft-tower-yield").then(()=>{gn(W("message.ScreenshotSaved",H)),e&&o(B=>{B.actionInfo={name:"Take Screenshot of Yearly Updraft Tower Yield Graph",timestamp:new Date().getTime()}})})}}),a&&a.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:W("word.SaveAsCsv",H),onClick:()=>{Sh(a,"yearly-updraft-tower-yield.csv"),gn(W("message.CsvFileSaved",H)),e&&o(B=>{B.actionInfo={name:"Export Yearly Updraft Tower Yield Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),rBo=({dataSource:t,labels:e,height:n,dataKeyAxisX:o,labelX:r,labelY1:i,labelY2:a,unitX:l,unitY1:s,unitY2:c,yMin1:u="auto",yMax1:d="auto",yMin2:f="auto",yMax2:p="auto",curveType:g="linear",referenceX:A,fractionDigits:y=2})=>{const S=M(c$),[C,P]=m.useState(null),v=!0,T=!0,w=2,x=1,b=m.useRef([]),R=m.useMemo(()=>{if(!t||t.length===0)return[];const N=Object.keys(t[0]).length-1,U=t[1]?Object.keys(t[1]).length-1:N,W=t.length,k=[],D=N-1,L=(U-N)/D;let j;b.current.length=0;for(let B=0;B0?G||j:!1,isAnimationActive:!1},"left-"+B)),b.current.push({id:O,type:"line",value:O,color:ng[B]})}else if(B===D){const O="Objective",V=C===null||C===O?1:.25,G=Wx(Nx[B],x,t.length,W,V);k.push(h.jsx(Cg,{yAxisId:"right",type:g,name:O,dataKey:O,stroke:ng[B],opacity:V,strokeWidth:w,dot:W>0?G||j:!1,isAnimationActive:!1},"right")),b.current.push({id:O,type:"line",value:O,color:ng[D]})}else{const O=Math.floor((B-N)/L),V="Individual"+(B+1),G=.5,q=Wx(Nx[O],x*.5,t.length,W,G,ng[O]);k.push(h.jsx(Cg,{yAxisId:"left",type:g,name:V,dataKey:V,opacity:G,stroke:ng[O],strokeWidth:0,dot:q||j,isAnimationActive:!1},"left-"+B))}return k},[t,g,w,x,C]),H=()=>{},F=N=>{P(N.id)},E=()=>{P(null)};return h.jsx(h.Fragment,{children:t&&h.jsx("div",{id:"biaxial-line-graph-"+r+"-"+i+"-"+a,style:{width:"100%",height:`${n}%`,position:"relative",direction:"ltr"},children:h.jsx("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(p6e,{data:t,onMouseDown:H,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:N=>N.toFixed(y),content:({active:N,payload:U})=>!N||!U?null:U.map(W=>{var k;if(!((k=W.name)!=null&&k.toString().startsWith("Individual"))){let D;return W.name==="Tilt Angle"?D=me.toDegrees(W.value*(S.maximumTiltAngle-S.minimumTiltAngle)+S.minimumTiltAngle).toFixed(y)+"°":W.name==="Inter-Row Spacing"?D=(W.value*(S.maximumInterRowSpacing-S.minimumInterRowSpacing)+S.minimumInterRowSpacing).toFixed(y)+"m":W.name==="Rack Width"?D=Math.floor(W.value*(S.maximumRowsPerRack-S.minimumRowsPerRack)+S.minimumRowsPerRack)+" panels":W.name==="Objective"?D=W.value.toFixed(y)+" "+c:D=W.value.toFixed(y),h.jsxs("div",{children:[W.name,": ",D]},W.name)}return null})}),h.jsx(Cw,{vertical:T,horizontal:v,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{yAxisId:"left",x:A,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:o??r,style:{fontSize:"10px"},children:h.jsx(is,{value:r+(l?" ("+l+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[u,d],yAxisId:"left",style:{fontSize:"10px"},children:h.jsx(is,{dx:-20,value:i+(s?" ("+s+")":""),offset:0,angle:-90,position:"center"})}),h.jsx(vh,{domain:[f,p],yAxisId:"right",orientation:"right",style:{fontSize:"10px"},children:h.jsx(is,{dx:30,value:a+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),R,h.jsx(X2,{payload:b.current,iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:E,onMouseEnter:F})]})})})})})},iBo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9473,7 +9473,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,sBo=be.memo(()=>{const t=M(oa),e=M(hu)??g0,n=M(pn),o=M(vxt),r=M(IW),i=M(x8t),a=M(c3),l=M(kH),s=M.getState().evolutionaryAlgorithmState,c=dt(Cf),u=dt(_Ye),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:i?i.width+40:680,y=p.current?p.current.clientHeight+100:i?i.height+100:500,[S,C]=m.useState({x:i?Math.max(i.x,A-window.innerWidth):0,y:i?Math.min(i.y,window.innerHeight-y):0}),P=$t();m.useEffect(()=>{C({x:Math.max(i==null?void 0:i.x,A-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-y)})},[i,A,y]),m.useEffect(()=>{const k=()=>{C({x:Math.max(i==null?void 0:i.x,A-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-y)})};return window.addEventListener("resize",k),()=>{window.removeEventListener("resize",k)}},[i,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{n(k=>{p.current&&(k.viewState.evolutionPanelRect||(k.viewState.evolutionPanelRect=new cr(0,0,640,400)),k.viewState.evolutionPanelRect.width=p.current.offsetWidth,k.viewState.evolutionPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var k;(k=g.current)==null||k.disconnect()}),[]);const v=(k,D)=>{C({x:Math.max(D.x,A-window.innerWidth),y:Math.min(D.y,window.innerHeight-y)})},T=(k,D)=>{n(L=>{L.viewState.evolutionPanelRect||(L.viewState.evolutionPanelRect=new cr(0,0,640,400)),L.viewState.evolutionPanelRect.x=Math.max(D.x,A-window.innerWidth),L.viewState.evolutionPanelRect.y=Math.min(D.y,window.innerHeight-y)})},w=()=>{n(k=>{k.viewState.showEvolutionPanel=!1,t&&(k.actionInfo={name:"Close Solar Panel Optimization Graph",timestamp:new Date().getTime()})})},x=m.useMemo(()=>!l||l===_s.GENETIC_ALGORITHM?s.geneticAlgorithmParams:s.particleSwarmOptimizationParams,[l,s]),b=m.useMemo(()=>Y.t(l===_s.GENETIC_ALGORITHM?"optimizationMenu.Generation":"optimizationMenu.Step",P),[l,P]),R=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?Y.t("solarPanelMenu.TiltAngle",P):Y.t("optimizationMenu.NormalizedVariables",P),[x.problem,P]),H=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?"°":"",[x.problem]),F=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_ARRAY&&(x.objectiveFunctionType===Po.DAILY_PROFIT||x.objectiveFunctionType===Po.YEARLY_PROFIT)?Y.t("word.dollar",P):Y.t("word.kWh",P),[x.problem,x.objectiveFunctionType,P]),E=m.useMemo(()=>{switch(x.objectiveFunctionType){case Po.DAILY_PROFIT:return Y.t("optimizationMenu.ObjectiveFunctionDailyProfit",P);case Po.YEARLY_PROFIT:return Y.t("optimizationMenu.ObjectiveFunctionYearlyProfit",P);case Po.DAILY_AVERAGE_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionDailyMeanYield",P);case Po.YEARLY_AVERAGE_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionYearlyMeanYield",P);case Po.DAILY_TOTAL_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionDailyTotalYield",P)}return Y.t("optimizationMenu.ObjectiveFunctionYearlyTotalYield",P)},[x.objectiveFunctionType,P]),N=m.useMemo(()=>a?x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?a.type===z.Foundation:x.problem===Ri.SOLAR_PANEL_ARRAY?a.type===z.Polygon:!1:!1,[x.problem,a]),U=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_ARRAY?Y.t("optimizationMenu.ClickTargetPolygonToActivate",P):Y.t("optimizationMenu.ClickTargetFoundationToActivate",P),[x.problem,P]),W=m.useMemo(()=>{let k="";return x.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&(k+=Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",P)),x.problem===Ri.SOLAR_PANEL_ARRAY&&(k+=Y.t("optimizationMenu.SolarPanelArrayLayout",P)),k+=": ",k+=l===_s.GENETIC_ALGORITHM?Y.t("optimizationMenu.GeneticAlgorithm",P):Y.t("optimizationMenu.ParticleSwarmOptimization",P),k},[x.problem,l,P]);return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:v,onStop:T,onMouseDown:()=>{n(k=>{k.selectedFloatingWindow="solarPanelOptimizationResult"})},children:h.jsx(iBo,{ref:f,style:{zIndex:d==="solarPanelOptimizationResult"?bc:9},children:h.jsxs(aBo,{ref:p,style:{opacity:e,width:(i?i.width:640)+"px",height:(i?i.height:400)+"px"},children:[h.jsxs(lBo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:W}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{w()},onMouseDown:()=>{w()},children:`${Y.t("word.Close",P)}`})]}),h.jsx(rBo,{dataSource:o,labels:r,height:100,dataKeyAxisX:"Step",labelX:b,labelY1:R,labelY2:E,unitY1:H,unitY2:F,curveType:"linear",fractionDigits:2}),!c&&!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[N&&h.jsx(io,{type:"default",icon:h.jsx(kQe,{}),title:Y.t("word.Run",P),onClick:()=>{gn(Y.t("message.EvolutionStarted",P)),setTimeout(()=>{dt.getState().set(k=>{k.runEvolution=!0,k.pauseEvolution=!1,k.evolutionInProgress=!0}),t&&n(k=>{let D;x.problem===Ri.SOLAR_PANEL_ARRAY?l===_s.GENETIC_ALGORITHM?D="Run Genetic Algorithm for Solar Panel Array Layout":l===_s.PARTICLE_SWARM_OPTIMIZATION&&(D="Run Particle Swarm Optimization for Solar Panel Array Layout"):x.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&(l===_s.GENETIC_ALGORITHM?D="Run Genetic Algorithm for Solar Panel Tilt Angle":l===_s.PARTICLE_SWARM_OPTIMIZATION&&(D="Run Particle Swarm Optimization for Solar Panel Tilt Angle")),D&&(k.actionInfo={name:D,timestamp:new Date().getTime()})})},100)}}),!N&&h.jsx("span",{children:U}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",P),onClick:()=>{Ed("biaxial-line-graph-"+b+"-"+R+"-"+E,"solar-panel-tilt-angle-evolution").then(()=>{gn(Y.t("message.ScreenshotSaved",P))})}})]})]})})})}),cBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(a$),o=M(En),[r,i]=m.useState(!1),[a,l]=m.useState(!1),[s,c]=m.useState({left:0,top:0,bottom:0,right:0}),u=m.useRef(null),d=m.useRef(null),f=m.useRef(n.electricitySellingPrice),p=m.useRef(n.operationalCostPerUnit),g=$t();m.useEffect(()=>{var P;(P=d.current)==null||P.focus()},[]);const A=(P,v)=>{if(u.current){const{clientWidth:T,clientHeight:w}=window.document.documentElement,x=u.current.getBoundingClientRect();c({left:-x.left+v.x,right:T-(x.right-v.x),top:-x.top+v.y,bottom:w-((x==null?void 0:x.bottom)-v.y)})}},y=()=>{const P=n.electricitySellingPrice,v=f.current;if(P!==v){const x={name:"Electricity Selling Price",timestamp:Date.now(),oldValue:P,newValue:v,undo:()=>{e(b=>{b.economicsParams.electricitySellingPrice=x.oldValue})},redo:()=>{e(b=>{b.economicsParams.electricitySellingPrice=x.newValue})}};o(x),e(b=>{b.economicsParams.electricitySellingPrice=v})}const T=n.operationalCostPerUnit,w=p.current;if(T!==w){const x={name:"Operational Cost per Unit",timestamp:Date.now(),oldValue:T,newValue:w,undo:()=>{e(b=>{b.economicsParams.operationalCostPerUnit=x.oldValue})},redo:()=>{e(b=>{b.economicsParams.operationalCostPerUnit=x.newValue})}};o(x),e(b=>{b.economicsParams.operationalCostPerUnit=w})}},S=()=>{t(!1)},C=()=>{y(),t(!1)};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>l(!0),onMouseOut:()=>l(!1),children:Y.t("economicsPanel.EconomicsParameters",g)}),footer:[h.jsx(io,{onClick:S,children:Y.t("word.Cancel",g)},"Cancel"),h.jsx(io,{type:"primary",ref:d,onClick:C,children:Y.t("word.OK",g)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:P=>h.jsx(Bi,{disabled:!a,bounds:s,onStart:(v,T)=>A(v,T),children:h.jsx("div",{ref:u,children:P})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("economicsPanel.ElectricitySellingPrice",g)+" ([0.1, 1]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:.1,max:1,style:{width:"100%"},precision:2,value:f.current,step:.01,formatter:P=>`$${P}/kWh`,onChange:P=>{P!==null&&(f.current=P,i(!r))},onBlur:P=>{const v=P.target.value.replace("$","").replace("/kWh",""),T=parseFloat(v);f.current=Number.isNaN(T)?.1:T,i(!r)},onPressEnter:P=>{const v=P.target.value.replace("$","").replace("/kWh",""),T=parseFloat(v);f.current=Number.isNaN(T)?.1:T,i(!r)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("economicsPanel.OperationalCostPerUnit",g)+" ([0.1, 1]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:.1,max:1,style:{width:"100%"},precision:2,value:p.current,step:.01,formatter:P=>`$${P}/day`,onChange:P=>{P!==null&&(p.current=P,i(!r))},onBlur:P=>{const v=P.target.value.replace("$","").replace("/day",""),T=parseFloat(v);p.current=Number.isNaN(T)?.1:T,i(!r)},onPressEnter:P=>{const v=P.target.value.replace("$","").replace("/day",""),T=parseFloat(v);p.current=Number.isNaN(T)?.1:T,i(!r)}})})]})]})}),p0t=(t,e,n)=>{const o=M.getState().elements,r=M(yA),i=M(Jn),a=dt(zge),l=Cn(Ib),s=Cn(_8t),c=Cn(X8t),u=[],d=[],f=m.useRef(new Map),p=m.useRef(new Map),g=m.useRef(new Map);return m.useEffect(()=>{var y,S,C,P,v,T,w,x;if(!e)return;const A=rb(t,e.lowestTemperatures,e.highestTemperatures);f.current.clear(),p.current.clear(),g.current.clear();for(let b=0;b<24;b++){const R={},H=new Map;for(const F of o)if(ye.onBuildingEnvelope(F)){const E=l.get(F.id);if(E){const N=F.type===z.Foundation?F:r(F);if(N&&!N.notBuilding&&ye.getBuildingCompletionStatus(N,o)===Uc.COMPLETE){let U=H.get(N.id);U||(U=n?{heater:0,ac:0,geothermal:0,solarPanel:0,label:(y=N.label)==null?void 0:y.trim()}:{heater:0,ac:0,geothermal:0,label:(S=N.label)==null?void 0:S.trim()},H.set(N.id,U),(C=N.hvacSystem)!=null&&C.id?N.hvacSystem.id&&N.hvacSystem.id.length>0&&!d.includes(N.hvacSystem.id)&&d.push(N.hvacSystem.id):N.label&&N.label.length>0&&!d.includes(N.label)&&d.push(N.label)),F.type===z.Foundation?U.geothermal+=E[b]:E[b]<0?U.heater+=E[b]:U.ac+=E[b]}}}for(const F of o)if(F.type===z.Foundation){const E=F;if(!E.notBuilding&&ye.getBuildingCompletionStatus(E,o)!==Uc.COMPLETE)continue;const N=H.get(F.id);if(N){const U=s.get(F.id);if(U&&(N.heater<0?(N.heater+=U[b],N.heater>0&&(N.heater=0)):N.ac>0&&(N.ac+=U[b])),N.solarPanel!==void 0){const W=c.get(F.id);W&&(N.solarPanel+=W[b])}}}if(H.size>1){let F=1;for(const E of H.keys()){R.Hour=b;const N=H.get(E);if(N){const U=i(E);if(U&&U.type===z.Foundation){const W=U;if(!W.notBuilding&&ye.getBuildingCompletionStatus(W,o)===Uc.COMPLETE){const k=((P=W.hvacSystem)==null?void 0:P.thermostatSetpoint)??20,D=((v=W.hvacSystem)==null?void 0:v.temperatureThreshold)??3,L=((T=W.hvacSystem)==null?void 0:T.id)??(N.label&&N.label!==""?N.label:F.toString());L===F.toString()&&F++;let j=Math.abs(TO(A,N.heater,k,D)),B=TO(A,N.ac,k,D);j>0?(j-=N.geothermal,j<0&&(j=0)):B>0&&(B+=N.geothermal,B<0&&(B=0));const O="Heater "+L;R[O]?R[O]=R[O]+j:R[O]=j;const V="AC "+L;if(R[V]?R[V]=R[V]+B:R[V]=B,N.solarPanel!==void 0){const $="Solar "+L;R[$]?R[$]=R[$]-N.solarPanel:R[$]=-N.solarPanel}const G="Net "+L;R[G]?R[G]=R[G]+j+B-(N.solarPanel??0):R[G]=j+B-(N.solarPanel??0);let q=f.current.get(L);q===void 0&&(q=0),q+=j,f.current.set(L,q),q=p.current.get(L),q===void 0&&(q=0),q+=B,p.current.set(L,q),n&&(q=g.current.get(L),q===void 0&&(q=0),q+=N.solarPanel,g.current.set(L,q))}}}}}else for(const F of H.keys()){R.Hour=b;const E=H.get(F);if(E){const N=i(F);if(N&&N.type===z.Foundation){const U=N;if(!U.notBuilding&&ye.getBuildingCompletionStatus(U,o)===Uc.COMPLETE){const W=((w=U.hvacSystem)==null?void 0:w.thermostatSetpoint)??20,k=((x=U.hvacSystem)==null?void 0:x.temperatureThreshold)??3;let D=Math.abs(TO(A,E.heater,W,k)),L=TO(A,E.ac,W,k);D>0?(D-=E.geothermal,D<0&&(D=0)):L>0&&(L+=E.geothermal,L<0&&(L=0)),R.Heater=D,R.AC=L,E.solarPanel!==void 0&&(R.Solar=-E.solarPanel),R.Net=D+L-(E.solarPanel??0);const j="default";let B=f.current.get(j);B===void 0&&(B=0),B+=D,f.current.set(j,B),B=p.current.get(j),B===void 0&&(B=0),B+=L,p.current.set(j,B),n&&(B=g.current.get(j),B===void 0&&(B=0),B+=E.solarPanel,g.current.set(j,B))}}}}u.push(R)}},[a,e]),{sum:u,sumHeaterMap:f.current,sumAcMap:p.current,sumSolarPanelMap:g.current,dataLabels:d}},uBo=be.memo(({horizontalGrid:t,verticalGrid:e,lineWidth:n,symbolSize:o,barCategoryGap:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s,changeBarCategoryGap:c})=>{const u=$t(),[d,f]=m.useState(!1),p=()=>{i==null||i(!t)},g=()=>{a==null||a(!e)},A=C=>{l==null||l(C/2)},y=C=>{s==null||s(C/5)},S=C=>{c==null||c(C)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(kC,{min:0,max:10,value:n*2,onChange:A,children:Y.t("menu.graph.LineWidth",u)+":"}),h.jsx(kC,{min:2,max:12,value:o*5,onChange:y,children:Y.t("menu.graph.SymbolSize",u)+":"}),h.jsx(kC,{min:0,max:20,value:r,onChange:S,children:Y.t("menu.graph.BarCategoryGap",u)+":"}),h.jsx(yw,{checked:t,onClick:p,children:Y.t("menu.graph.ShowHorizontalGridLines",u)}),h.jsx(yw,{checked:e,onClick:g,children:Y.t("menu.graph.ShowHorizontalGridLines",u)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:d?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{f(!0)},onMouseOut:()=>{f(!1)}})})}),g0t=({type:t,dataSource:e,hasSolarPanels:n,labels:o,height:r,dataKeyAxisX:i,labelX:a,labelY:l,unitX:s,unitY:c,yMin:u="auto",yMax:d="auto",curveType:f="linear",referenceX:p,fractionDigits:g=2,symbolCount:A=12})=>{const[y,S]=m.useState(0),[C,P]=m.useState(),[v,T]=m.useState(!0),[w,x]=m.useState(!0),[b,R]=m.useState(null),[H,F]=m.useState(2),[E,N]=m.useState(1),[U,W]=m.useState(2);m.useEffect(()=>{if(!e||e.length===0)return;const B=n?4:3,O=(Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1)/B;if(y!==O&&S(O),O===1&&e[0]){for(const V in e[0])if(V.startsWith("Heater")){P(V.length>6?V.substring(6).trim():void 0);break}}},[e]);const k=m.useMemo(()=>{const B=[],O=n?4:3;let V;const G="gray",q=1;for(let ie=0;ie1?o[ie*O]:C?"Heater "+C:"Heater";B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#FA8072",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O)),Q=y>1?o[ie*O+1]:C?"AC "+C:"AC",B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#00BFFF",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O+1)),n&&(Q=y>1?o[ie*O+2]:C?"Solar "+C:"Solar",B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#3CB371",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O+2)))}const $=O-1;for(let ie=0;ie1?o[ie*O+$]:C?"Net "+C:"Net",se=b===null||b===Q?1:.25,Z=Wx(Nx[ie],E,e.length,A,se);ie===0&&(V=Z),B.push(h.jsx(Cg,{type:f,name:Q,dataKey:Q,stroke:ng[ie],opacity:b===null||b===Q?1:.25,strokeWidth:H,dot:A>0?Z||V:!1,isAnimationActive:!1},ie*O+$))}return B},[t,f,o,y,C,H,A,E,b]),D=()=>{},L=B=>{R(B.dataKey)},j=()=>{R(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"line-graph-"+a+"-"+l,style:{width:"100%",height:`${r}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(fko,{data:e,stackOffset:"sign",barGap:0,barCategoryGap:U,onMouseDown:D,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(oh,{formatter:B=>B.toFixed(g)+" "+c}),h.jsx(Cw,{vertical:w,horizontal:v,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:p,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:i??a,fontSize:"10px",children:h.jsx(is,{value:a+(s?" ("+s+")":""),offset:0,position:"bottom"})}),h.jsx(wh,{domain:[u,d],fontSize:"10px",children:h.jsx(is,{dx:-15,value:l+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),k,h.jsx(Q9,{y:0,stroke:"#888"}),y>0&&h.jsx(X2,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:j,onMouseEnter:L})]})}),h.jsx(uBo,{symbolSize:E,lineWidth:H,barCategoryGap:U,horizontalGrid:v,verticalGrid:w,changeHorizontalGrid:B=>{T(B)},changeVerticalGrid:B=>{x(B)},changeLineWidth:B=>{F(B)},changeSymbolSize:B=>{N(B)},changeBarCategoryGap:B=>{W(B)}})]})})})},dBo=Ho.div` +`,sBo=be.memo(()=>{const t=M(oa),e=M(hu)??g0,n=M(pn),o=M(vxt),r=M(IW),i=M(x8t),a=M(c3),l=M(kH),s=M.getState().evolutionaryAlgorithmState,c=dt(Cf),u=dt(_Ye),d=M(Sc),f=be.useRef(null),p=m.useRef(null),g=m.useRef(),A=p.current?p.current.clientWidth+40:i?i.width+40:680,y=p.current?p.current.clientHeight+100:i?i.height+100:500,[S,C]=m.useState({x:i?Math.max(i.x,A-window.innerWidth):0,y:i?Math.min(i.y,window.innerHeight-y):0}),P=$t();m.useEffect(()=>{C({x:Math.max(i==null?void 0:i.x,A-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-y)})},[i,A,y]),m.useEffect(()=>{const k=()=>{C({x:Math.max(i==null?void 0:i.x,A-window.innerWidth),y:Math.min(i==null?void 0:i.y,window.innerHeight-y)})};return window.addEventListener("resize",k),()=>{window.removeEventListener("resize",k)}},[i,A,y]),m.useEffect(()=>(p.current&&(g.current||(g.current=new ResizeObserver(()=>{n(k=>{p.current&&(k.viewState.evolutionPanelRect||(k.viewState.evolutionPanelRect=new cr(0,0,640,400)),k.viewState.evolutionPanelRect.width=p.current.offsetWidth,k.viewState.evolutionPanelRect.height=p.current.offsetHeight)})})),g.current.observe(p.current)),()=>{var k;(k=g.current)==null||k.disconnect()}),[]);const v=(k,D)=>{C({x:Math.max(D.x,A-window.innerWidth),y:Math.min(D.y,window.innerHeight-y)})},T=(k,D)=>{n(L=>{L.viewState.evolutionPanelRect||(L.viewState.evolutionPanelRect=new cr(0,0,640,400)),L.viewState.evolutionPanelRect.x=Math.max(D.x,A-window.innerWidth),L.viewState.evolutionPanelRect.y=Math.min(D.y,window.innerHeight-y)})},w=()=>{n(k=>{k.viewState.showEvolutionPanel=!1,t&&(k.actionInfo={name:"Close Solar Panel Optimization Graph",timestamp:new Date().getTime()})})},x=m.useMemo(()=>!l||l===_s.GENETIC_ALGORITHM?s.geneticAlgorithmParams:s.particleSwarmOptimizationParams,[l,s]),b=m.useMemo(()=>Y.t(l===_s.GENETIC_ALGORITHM?"optimizationMenu.Generation":"optimizationMenu.Step",P),[l,P]),R=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?Y.t("solarPanelMenu.TiltAngle",P):Y.t("optimizationMenu.NormalizedVariables",P),[x.problem,P]),H=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?"°":"",[x.problem]),F=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_ARRAY&&(x.objectiveFunctionType===Po.DAILY_PROFIT||x.objectiveFunctionType===Po.YEARLY_PROFIT)?Y.t("word.dollar",P):Y.t("word.kWh",P),[x.problem,x.objectiveFunctionType,P]),E=m.useMemo(()=>{switch(x.objectiveFunctionType){case Po.DAILY_PROFIT:return Y.t("optimizationMenu.ObjectiveFunctionDailyProfit",P);case Po.YEARLY_PROFIT:return Y.t("optimizationMenu.ObjectiveFunctionYearlyProfit",P);case Po.DAILY_AVERAGE_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionDailyMeanYield",P);case Po.YEARLY_AVERAGE_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionYearlyMeanYield",P);case Po.DAILY_TOTAL_OUTPUT:return Y.t("optimizationMenu.ObjectiveFunctionDailyTotalYield",P)}return Y.t("optimizationMenu.ObjectiveFunctionYearlyTotalYield",P)},[x.objectiveFunctionType,P]),N=m.useMemo(()=>a?x.problem===Ri.SOLAR_PANEL_TILT_ANGLE?a.type===z.Foundation:x.problem===Ri.SOLAR_PANEL_ARRAY?a.type===z.Polygon:!1:!1,[x.problem,a]),U=m.useMemo(()=>x.problem===Ri.SOLAR_PANEL_ARRAY?Y.t("optimizationMenu.ClickTargetPolygonToActivate",P):Y.t("optimizationMenu.ClickTargetFoundationToActivate",P),[x.problem,P]),W=m.useMemo(()=>{let k="";return x.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&(k+=Y.t("optimizationMenu.SolarPanelTiltAngleOptimization",P)),x.problem===Ri.SOLAR_PANEL_ARRAY&&(k+=Y.t("optimizationMenu.SolarPanelArrayLayout",P)),k+=": ",k+=l===_s.GENETIC_ALGORITHM?Y.t("optimizationMenu.GeneticAlgorithm",P):Y.t("optimizationMenu.ParticleSwarmOptimization",P),k},[x.problem,l,P]);return h.jsx(Bi,{nodeRef:f,handle:".handle",bounds:"parent",axis:"both",position:S,onDrag:v,onStop:T,onMouseDown:()=>{n(k=>{k.selectedFloatingWindow="solarPanelOptimizationResult"})},children:h.jsx(iBo,{ref:f,style:{zIndex:d==="solarPanelOptimizationResult"?bc:9},children:h.jsxs(aBo,{ref:p,style:{opacity:e,width:(i?i.width:640)+"px",height:(i?i.height:400)+"px"},children:[h.jsxs(lBo,{className:"handle",style:{direction:"ltr"},children:[h.jsx("span",{children:W}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{w()},onMouseDown:()=>{w()},children:`${Y.t("word.Close",P)}`})]}),h.jsx(rBo,{dataSource:o,labels:r,height:100,dataKeyAxisX:"Step",labelX:b,labelY1:R,labelY2:E,unitY1:H,unitY2:F,curveType:"linear",fractionDigits:2}),!c&&!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[N&&h.jsx(io,{type:"default",icon:h.jsx(kQe,{}),title:Y.t("word.Run",P),onClick:()=>{gn(Y.t("message.EvolutionStarted",P)),setTimeout(()=>{dt.getState().set(k=>{k.runEvolution=!0,k.pauseEvolution=!1,k.evolutionInProgress=!0}),t&&n(k=>{let D;x.problem===Ri.SOLAR_PANEL_ARRAY?l===_s.GENETIC_ALGORITHM?D="Run Genetic Algorithm for Solar Panel Array Layout":l===_s.PARTICLE_SWARM_OPTIMIZATION&&(D="Run Particle Swarm Optimization for Solar Panel Array Layout"):x.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&(l===_s.GENETIC_ALGORITHM?D="Run Genetic Algorithm for Solar Panel Tilt Angle":l===_s.PARTICLE_SWARM_OPTIMIZATION&&(D="Run Particle Swarm Optimization for Solar Panel Tilt Angle")),D&&(k.actionInfo={name:D,timestamp:new Date().getTime()})})},100)}}),!N&&h.jsx("span",{children:U}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",P),onClick:()=>{Ed("biaxial-line-graph-"+b+"-"+R+"-"+E,"solar-panel-tilt-angle-evolution").then(()=>{gn(Y.t("message.ScreenshotSaved",P))})}})]})]})})})}),cBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(a$),o=M(En),[r,i]=m.useState(!1),[a,l]=m.useState(!1),[s,c]=m.useState({left:0,top:0,bottom:0,right:0}),u=m.useRef(null),d=m.useRef(null),f=m.useRef(n.electricitySellingPrice),p=m.useRef(n.operationalCostPerUnit),g=$t();m.useEffect(()=>{var P;(P=d.current)==null||P.focus()},[]);const A=(P,v)=>{if(u.current){const{clientWidth:T,clientHeight:w}=window.document.documentElement,x=u.current.getBoundingClientRect();c({left:-x.left+v.x,right:T-(x.right-v.x),top:-x.top+v.y,bottom:w-((x==null?void 0:x.bottom)-v.y)})}},y=()=>{const P=n.electricitySellingPrice,v=f.current;if(P!==v){const x={name:"Electricity Selling Price",timestamp:Date.now(),oldValue:P,newValue:v,undo:()=>{e(b=>{b.economicsParams.electricitySellingPrice=x.oldValue})},redo:()=>{e(b=>{b.economicsParams.electricitySellingPrice=x.newValue})}};o(x),e(b=>{b.economicsParams.electricitySellingPrice=v})}const T=n.operationalCostPerUnit,w=p.current;if(T!==w){const x={name:"Operational Cost per Unit",timestamp:Date.now(),oldValue:T,newValue:w,undo:()=>{e(b=>{b.economicsParams.operationalCostPerUnit=x.oldValue})},redo:()=>{e(b=>{b.economicsParams.operationalCostPerUnit=x.newValue})}};o(x),e(b=>{b.economicsParams.operationalCostPerUnit=w})}},S=()=>{t(!1)},C=()=>{y(),t(!1)};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>l(!0),onMouseOut:()=>l(!1),children:Y.t("economicsPanel.EconomicsParameters",g)}),footer:[h.jsx(io,{onClick:S,children:Y.t("word.Cancel",g)},"Cancel"),h.jsx(io,{type:"primary",ref:d,onClick:C,children:Y.t("word.OK",g)},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:P=>h.jsx(Bi,{disabled:!a,bounds:s,onStart:(v,T)=>A(v,T),children:h.jsx("div",{ref:u,children:P})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("economicsPanel.ElectricitySellingPrice",g)+" ([0.1, 1]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:.1,max:1,style:{width:"100%"},precision:2,value:f.current,step:.01,formatter:P=>`$${P}/kWh`,onChange:P=>{P!==null&&(f.current=P,i(!r))},onBlur:P=>{const v=P.target.value.replace("$","").replace("/kWh",""),T=parseFloat(v);f.current=Number.isNaN(T)?.1:T,i(!r)},onPressEnter:P=>{const v=P.target.value.replace("$","").replace("/kWh",""),T=parseFloat(v);f.current=Number.isNaN(T)?.1:T,i(!r)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("economicsPanel.OperationalCostPerUnit",g)+" ([0.1, 1]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:.1,max:1,style:{width:"100%"},precision:2,value:p.current,step:.01,formatter:P=>`$${P}/day`,onChange:P=>{P!==null&&(p.current=P,i(!r))},onBlur:P=>{const v=P.target.value.replace("$","").replace("/day",""),T=parseFloat(v);p.current=Number.isNaN(T)?.1:T,i(!r)},onPressEnter:P=>{const v=P.target.value.replace("$","").replace("/day",""),T=parseFloat(v);p.current=Number.isNaN(T)?.1:T,i(!r)}})})]})]})}),p0t=(t,e,n)=>{const o=M.getState().elements,r=M(yA),i=M(Jn),a=dt(zge),l=Cn(Ib),s=Cn(_8t),c=Cn(X8t),u=[],d=[],f=m.useRef(new Map),p=m.useRef(new Map),g=m.useRef(new Map);return m.useEffect(()=>{var y,S,C,P,v,T,w,x;if(!e)return;const A=rb(t,e.lowestTemperatures,e.highestTemperatures);f.current.clear(),p.current.clear(),g.current.clear();for(let b=0;b<24;b++){const R={},H=new Map;for(const F of o)if(me.onBuildingEnvelope(F)){const E=l.get(F.id);if(E){const N=F.type===z.Foundation?F:r(F);if(N&&!N.notBuilding&&me.getBuildingCompletionStatus(N,o)===Uc.COMPLETE){let U=H.get(N.id);U||(U=n?{heater:0,ac:0,geothermal:0,solarPanel:0,label:(y=N.label)==null?void 0:y.trim()}:{heater:0,ac:0,geothermal:0,label:(S=N.label)==null?void 0:S.trim()},H.set(N.id,U),(C=N.hvacSystem)!=null&&C.id?N.hvacSystem.id&&N.hvacSystem.id.length>0&&!d.includes(N.hvacSystem.id)&&d.push(N.hvacSystem.id):N.label&&N.label.length>0&&!d.includes(N.label)&&d.push(N.label)),F.type===z.Foundation?U.geothermal+=E[b]:E[b]<0?U.heater+=E[b]:U.ac+=E[b]}}}for(const F of o)if(F.type===z.Foundation){const E=F;if(!E.notBuilding&&me.getBuildingCompletionStatus(E,o)!==Uc.COMPLETE)continue;const N=H.get(F.id);if(N){const U=s.get(F.id);if(U&&(N.heater<0?(N.heater+=U[b],N.heater>0&&(N.heater=0)):N.ac>0&&(N.ac+=U[b])),N.solarPanel!==void 0){const W=c.get(F.id);W&&(N.solarPanel+=W[b])}}}if(H.size>1){let F=1;for(const E of H.keys()){R.Hour=b;const N=H.get(E);if(N){const U=i(E);if(U&&U.type===z.Foundation){const W=U;if(!W.notBuilding&&me.getBuildingCompletionStatus(W,o)===Uc.COMPLETE){const k=((P=W.hvacSystem)==null?void 0:P.thermostatSetpoint)??20,D=((v=W.hvacSystem)==null?void 0:v.temperatureThreshold)??3,L=((T=W.hvacSystem)==null?void 0:T.id)??(N.label&&N.label!==""?N.label:F.toString());L===F.toString()&&F++;let j=Math.abs(TO(A,N.heater,k,D)),B=TO(A,N.ac,k,D);j>0?(j-=N.geothermal,j<0&&(j=0)):B>0&&(B+=N.geothermal,B<0&&(B=0));const O="Heater "+L;R[O]?R[O]=R[O]+j:R[O]=j;const V="AC "+L;if(R[V]?R[V]=R[V]+B:R[V]=B,N.solarPanel!==void 0){const $="Solar "+L;R[$]?R[$]=R[$]-N.solarPanel:R[$]=-N.solarPanel}const G="Net "+L;R[G]?R[G]=R[G]+j+B-(N.solarPanel??0):R[G]=j+B-(N.solarPanel??0);let q=f.current.get(L);q===void 0&&(q=0),q+=j,f.current.set(L,q),q=p.current.get(L),q===void 0&&(q=0),q+=B,p.current.set(L,q),n&&(q=g.current.get(L),q===void 0&&(q=0),q+=N.solarPanel,g.current.set(L,q))}}}}}else for(const F of H.keys()){R.Hour=b;const E=H.get(F);if(E){const N=i(F);if(N&&N.type===z.Foundation){const U=N;if(!U.notBuilding&&me.getBuildingCompletionStatus(U,o)===Uc.COMPLETE){const W=((w=U.hvacSystem)==null?void 0:w.thermostatSetpoint)??20,k=((x=U.hvacSystem)==null?void 0:x.temperatureThreshold)??3;let D=Math.abs(TO(A,E.heater,W,k)),L=TO(A,E.ac,W,k);D>0?(D-=E.geothermal,D<0&&(D=0)):L>0&&(L+=E.geothermal,L<0&&(L=0)),R.Heater=D,R.AC=L,E.solarPanel!==void 0&&(R.Solar=-E.solarPanel),R.Net=D+L-(E.solarPanel??0);const j="default";let B=f.current.get(j);B===void 0&&(B=0),B+=D,f.current.set(j,B),B=p.current.get(j),B===void 0&&(B=0),B+=L,p.current.set(j,B),n&&(B=g.current.get(j),B===void 0&&(B=0),B+=E.solarPanel,g.current.set(j,B))}}}}u.push(R)}},[a,e]),{sum:u,sumHeaterMap:f.current,sumAcMap:p.current,sumSolarPanelMap:g.current,dataLabels:d}},uBo=be.memo(({horizontalGrid:t,verticalGrid:e,lineWidth:n,symbolSize:o,barCategoryGap:r,changeHorizontalGrid:i,changeVerticalGrid:a,changeLineWidth:l,changeSymbolSize:s,changeBarCategoryGap:c})=>{const u=$t(),[d,f]=m.useState(!1),p=()=>{i==null||i(!t)},g=()=>{a==null||a(!e)},A=C=>{l==null||l(C/2)},y=C=>{s==null||s(C/5)},S=C=>{c==null||c(C)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(kC,{min:0,max:10,value:n*2,onChange:A,children:Y.t("menu.graph.LineWidth",u)+":"}),h.jsx(kC,{min:2,max:12,value:o*5,onChange:y,children:Y.t("menu.graph.SymbolSize",u)+":"}),h.jsx(kC,{min:0,max:20,value:r,onChange:S,children:Y.t("menu.graph.BarCategoryGap",u)+":"}),h.jsx(yw,{checked:t,onClick:p,children:Y.t("menu.graph.ShowHorizontalGridLines",u)}),h.jsx(yw,{checked:e,onClick:g,children:Y.t("menu.graph.ShowHorizontalGridLines",u)})]}),children:h.jsx(qme,{style:{position:"absolute",fontSize:"30px",top:"4px",right:"30px",transition:"0.5s",color:d?"darkgray":"lightblue",cursor:"pointer"},onMouseOver:()=>{f(!0)},onMouseOut:()=>{f(!1)}})})}),g0t=({type:t,dataSource:e,hasSolarPanels:n,labels:o,height:r,dataKeyAxisX:i,labelX:a,labelY:l,unitX:s,unitY:c,yMin:u="auto",yMax:d="auto",curveType:f="linear",referenceX:p,fractionDigits:g=2,symbolCount:A=12})=>{const[y,S]=m.useState(0),[C,P]=m.useState(),[v,T]=m.useState(!0),[w,x]=m.useState(!0),[b,R]=m.useState(null),[H,F]=m.useState(2),[E,N]=m.useState(1),[U,W]=m.useState(2);m.useEffect(()=>{if(!e||e.length===0)return;const B=n?4:3,O=(Array.isArray(e)?Object.keys(e[0]).length-1:Object.keys(e).length-1)/B;if(y!==O&&S(O),O===1&&e[0]){for(const V in e[0])if(V.startsWith("Heater")){P(V.length>6?V.substring(6).trim():void 0);break}}},[e]);const k=m.useMemo(()=>{const B=[],O=n?4:3;let V;const G="gray",q=1;for(let ie=0;ie1?o[ie*O]:C?"Heater "+C:"Heater";B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#FA8072",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O)),Q=y>1?o[ie*O+1]:C?"AC "+C:"AC",B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#00BFFF",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O+1)),n&&(Q=y>1?o[ie*O+2]:C?"Solar "+C:"Solar",B.push(h.jsx(B2,{name:Q,dataKey:Q,stroke:G,fill:"#3CB371",opacity:b===null||b===Q?1:.25,strokeWidth:q,isAnimationActive:!1,stackId:"stack"+ie},ie*O+2)))}const $=O-1;for(let ie=0;ie1?o[ie*O+$]:C?"Net "+C:"Net",se=b===null||b===Q?1:.25,oe=Wx(Nx[ie],E,e.length,A,se);ie===0&&(V=oe),B.push(h.jsx(Cg,{type:f,name:Q,dataKey:Q,stroke:ng[ie],opacity:b===null||b===Q?1:.25,strokeWidth:H,dot:A>0?oe||V:!1,isAnimationActive:!1},ie*O+$))}return B},[t,f,o,y,C,H,A,E,b]),D=()=>{},L=B=>{R(B.dataKey)},j=()=>{R(null)};return h.jsx(h.Fragment,{children:e&&h.jsx("div",{id:"line-graph-"+a+"-"+l,style:{width:"100%",height:`${r}%`,position:"relative",direction:"ltr"},children:h.jsxs("div",{style:{userSelect:"none",width:"100%",height:"100%",position:"absolute",top:0,left:0},children:[h.jsx(dU,{width:"100%",height:"100%",children:h.jsxs(fko,{data:e,stackOffset:"sign",barGap:0,barCategoryGap:U,onMouseDown:D,margin:{top:5,right:30,left:20,bottom:30},children:[h.jsx(rh,{formatter:B=>B.toFixed(g)+" "+c}),h.jsx(Cw,{vertical:w,horizontal:v,stroke:"rgba(128, 128, 128, 0.3)"}),h.jsx(Q9,{x:p,stroke:"orange",strokeWidth:2}),h.jsx(l1,{dataKey:i??a,fontSize:"10px",children:h.jsx(is,{value:a+(s?" ("+s+")":""),offset:0,position:"bottom"})}),h.jsx(vh,{domain:[u,d],fontSize:"10px",children:h.jsx(is,{dx:-15,value:l+(c?" ("+c+")":""),offset:0,angle:-90,position:"center"})}),k,h.jsx(Q9,{y:0,stroke:"#888"}),y>0&&h.jsx(X2,{wrapperStyle:{fontSize:"11px"},iconType:"plainline",verticalAlign:"top",height:36,onMouseLeave:j,onMouseEnter:L})]})}),h.jsx(uBo,{symbolSize:E,lineWidth:H,barCategoryGap:U,horizontalGrid:v,verticalGrid:w,changeHorizontalGrid:B=>{T(B)},changeVerticalGrid:B=>{x(B)},changeLineWidth:B=>{F(B)},changeSymbolSize:B=>{N(B)},changeBarCategoryGap:B=>{W(B)}})]})})})},dBo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9511,7 +9511,7 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,pBo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(RW),i=new Date(M(Al)),a=M(G4t),l=dt(zge),s=dt(AW),c=dt(kwt),u=dt(Cf),d=ye.hasSolarPanels(M.getState().elements),f=Cn(nOe),p=Cn(oOe),g=Cn(rOe),A=M(Sc),y=be.useRef(null),S=m.useRef(null),C=m.useRef(),P=S.current?S.current.clientWidth+40:a?a.width+40:640,v=S.current?S.current.clientHeight+100:a?a.height+100:460,[T,w]=m.useState({x:a?Math.max(a.x,P-window.innerWidth):0,y:a?Math.min(a.y,window.innerHeight-v):0}),[x,b]=m.useState([]),[R,H]=m.useState(0),[F,E]=m.useState(0),[N,U]=m.useState(0),[W,k]=m.useState(0),[D,L]=m.useState(["Heater","AC","Net"]),j=$t(),B=u1(t),O=m.useRef([]),V=m.useRef([]),G=m.useRef([]),q=m.useRef([]);m.useEffect(()=>{s&&$()},[s]),m.useEffect(()=>{$()},[c]);const $=()=>{b([]),H(0),E(0),U(0),k(0),L([])},{sum:ie,sumHeaterMap:Q,sumAcMap:se,sumSolarPanelMap:Z,dataLabels:ee}=p0t(i,B,d);m.useEffect(()=>{b(ie);let le=0,Te=0,ge=0;const Se=Q.size>1;if(Q){O.current=[];for(const De of Q.keys()){const Ae=Q.get(De);Ae&&(le+=Ae,Se&&O.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(se){V.current=[];for(const De of se.keys()){const Ae=se.get(De);Ae&&(Te+=Ae,Se&&V.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(Z&&Z.size>0){G.current=[];for(const De of Z.keys()){const Ae=Z.get(De);Ae&&(ge+=Ae,Se&&G.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(Q&&se&&Z){q.current=[];for(const De of Q.keys()){let Ae=0;const ue=Q.get(De),fe=se.get(De),ve=Z.get(De);ue&&(Ae+=ue),fe&&(Ae+=fe),ve&&(Ae-=ve),Se&&q.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j))}}H(le),E(Te),U(ge),k(le+Te-ge),f(le),p(Te),g(ge);const Re=(Object.keys(ie[0]).length-1)/(d?4:3);if(Re>1){const De=[];let Ae=0;for(let ue=0;ue{w({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-v)})},[a,P,v]),m.useEffect(()=>{const le=()=>{w({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-v)})};return window.addEventListener("resize",le),()=>{window.removeEventListener("resize",le)}},[a,P,v]),m.useEffect(()=>(S.current&&(C.current||(C.current=new ResizeObserver(()=>{o(le=>{S.current&&(le.viewState.dailyBuildingEnergyPanelRect||(le.viewState.dailyBuildingEnergyPanelRect=new cr(0,0,600,360)),le.viewState.dailyBuildingEnergyPanelRect.width=S.current.offsetWidth,le.viewState.dailyBuildingEnergyPanelRect.height=S.current.offsetHeight)})})),C.current.observe(S.current)),()=>{var le;(le=C.current)==null||le.disconnect()}),[]);const te=(le,Te)=>{w({x:Math.max(Te.x,P-window.innerWidth),y:Math.min(Te.y,window.innerHeight-v)})},oe=(le,Te)=>{o(ge=>{ge.viewState.dailyBuildingEnergyPanelRect||(ge.viewState.dailyBuildingEnergyPanelRect=new cr(0,0,600,360)),ge.viewState.dailyBuildingEnergyPanelRect.x=Math.max(Te.x,P-window.innerWidth),ge.viewState.dailyBuildingEnergyPanelRect.y=Math.min(Te.y,window.innerHeight-v)})},de=()=>{o(le=>{le.viewState.showDailyBuildingEnergyPanel=!1,e&&(le.actionInfo={name:"Close Daily Building Energy Graph",timestamp:new Date().getTime()})})},he=Y.t("word.Hour",j),pe=Y.t("word.Energy",j),me=x&&x[0]?Object.keys(x[0]).length===0:!0;return h.jsx(Bi,{nodeRef:y,handle:".handle",bounds:"parent",axis:"both",position:T,onDrag:te,onStop:oe,onMouseDown:()=>{o(le=>{le.selectedFloatingWindow="dailyBuildingEnergyPanel"})},children:h.jsx(dBo,{ref:y,style:{zIndex:A==="dailyBuildingEnergyPanel"?bc:9},children:h.jsxs(fBo,{ref:S,style:{opacity:n,width:(a?a.width:600)+"px",height:(a?a.height:360)+"px"},children:[h.jsxs(hBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("buildingEnergyPanel.DailyBuildingEnergy",j)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",j)+" "+t+" | "+yr(i).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{de()},onMouseDown:()=>{de()},children:`${Y.t("word.Close",j)}`})]}),h.jsx(g0t,{type:vi.DailyBuildingEnergy,dataSource:x,hasSolarPanels:d,labels:D,height:100,dataKeyAxisX:"Hour",labelX:he,labelY:pe,unitY:Y.t("word.kWh",j),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:i.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[O.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)}):h.jsx(Ml,{content:O.current.map((le,Te)=>h.jsx("div",{children:le},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)})}),V.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.AC",j)+": "+F.toFixed(1)}):h.jsx(Ml,{content:V.current.map((le,Te)=>h.jsx("div",{children:le},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.AC",j)+": "+F.toFixed(1)})}),N!==0&&h.jsx(h.Fragment,{children:G.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)}):h.jsx(Ml,{content:G.current.map((le,Te)=>h.jsx("div",{children:le},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)})})}),q.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)}):h.jsx(Ml,{content:q.current.map((le,Te)=>h.jsx("div",{children:le},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)})}),h.jsx(io,{type:"default",icon:me?h.jsx(Th,{}):h.jsx(Rf,{}),title:Y.t(me?"word.Run":"word.Update",j),onClick:()=>{const le=M.getState().elements,Te=M.getState().countElementsByType,ge=M.getState().getChildrenOfType,Se=bX(le,Te,ge);if(Se.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",j));return}if(Se.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let Re;switch(Se.buildingCompletion){case Uc.WALL_DISJOINED:Re=Y.t("message.WallsAreNotConnected",j);break;case Uc.WALL_EMPTY:Re=Y.t("message.BuildingContainsEmptyWall",j);break;case Uc.ROOF_MISSING:Re=Y.t("message.BuildingRoofMissing",j);break;default:Re=Y.t("message.UnknownErrors",j)}co(Y.t("message.SimulationWillNotStartDueToErrors",j)+": "+Re);return}Se.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",j)),gn(Y.t("message.SimulationStarted",j)),setTimeout(()=>{r(),dt.getState().set(Re=>{Re.runDailyThermalSimulation=!0,Re.pauseDailyThermalSimulation=!1,Re.simulationInProgress=!0}),o(Re=>{e&&(Re.actionInfo={name:"Run Daily Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",j),onClick:()=>{Ed("line-graph-"+he+"-"+pe,"daily-building-energy").then(()=>{gn(Y.t("message.ScreenshotSaved",j)),e&&o(le=>{le.actionInfo={name:"Take Screenshot of Daily Building Energy Graph",timestamp:new Date().getTime()}})})}}),x&&x.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:Y.t("word.SaveAsCsv",j),onClick:()=>{Sh(x,"daily-building-energy.csv"),gn(Y.t("message.CsvFileSaved",j)),e&&o(le=>{le.actionInfo={name:"Export Daily Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),gBo=Ho.div` +`,pBo=be.memo(({city:t})=>{const e=M(oa),n=M(hu)??g0,o=M(pn),r=M(RW),i=new Date(M(Al)),a=M(G4t),l=dt(zge),s=dt(AW),c=dt(kwt),u=dt(Cf),d=me.hasSolarPanels(M.getState().elements),f=Cn(nOe),p=Cn(oOe),g=Cn(rOe),A=M(Sc),y=be.useRef(null),S=m.useRef(null),C=m.useRef(),P=S.current?S.current.clientWidth+40:a?a.width+40:640,v=S.current?S.current.clientHeight+100:a?a.height+100:460,[T,w]=m.useState({x:a?Math.max(a.x,P-window.innerWidth):0,y:a?Math.min(a.y,window.innerHeight-v):0}),[x,b]=m.useState([]),[R,H]=m.useState(0),[F,E]=m.useState(0),[N,U]=m.useState(0),[W,k]=m.useState(0),[D,L]=m.useState(["Heater","AC","Net"]),j=$t(),B=u1(t),O=m.useRef([]),V=m.useRef([]),G=m.useRef([]),q=m.useRef([]);m.useEffect(()=>{s&&$()},[s]),m.useEffect(()=>{$()},[c]);const $=()=>{b([]),H(0),E(0),U(0),k(0),L([])},{sum:ie,sumHeaterMap:Q,sumAcMap:se,sumSolarPanelMap:oe,dataLabels:Z}=p0t(i,B,d);m.useEffect(()=>{b(ie);let ae=0,Te=0,ge=0;const Se=Q.size>1;if(Q){O.current=[];for(const De of Q.keys()){const Ae=Q.get(De);Ae&&(ae+=Ae,Se&&O.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(se){V.current=[];for(const De of se.keys()){const Ae=se.get(De);Ae&&(Te+=Ae,Se&&V.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(oe&&oe.size>0){G.current=[];for(const De of oe.keys()){const Ae=oe.get(De);Ae&&(ge+=Ae,Se&&G.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j)))}}if(Q&&se&&oe){q.current=[];for(const De of Q.keys()){let Ae=0;const ue=Q.get(De),he=se.get(De),ve=oe.get(De);ue&&(Ae+=ue),he&&(Ae+=he),ve&&(Ae-=ve),Se&&q.current.push(De+": "+Ae.toFixed(2)+" "+Y.t("word.kWh",j))}}H(ae),E(Te),U(ge),k(ae+Te-ge),f(ae),p(Te),g(ge);const Re=(Object.keys(ie[0]).length-1)/(d?4:3);if(Re>1){const De=[];let Ae=0;for(let ue=0;ue{w({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-v)})},[a,P,v]),m.useEffect(()=>{const ae=()=>{w({x:Math.max(a==null?void 0:a.x,P-window.innerWidth),y:Math.min(a==null?void 0:a.y,window.innerHeight-v)})};return window.addEventListener("resize",ae),()=>{window.removeEventListener("resize",ae)}},[a,P,v]),m.useEffect(()=>(S.current&&(C.current||(C.current=new ResizeObserver(()=>{o(ae=>{S.current&&(ae.viewState.dailyBuildingEnergyPanelRect||(ae.viewState.dailyBuildingEnergyPanelRect=new cr(0,0,600,360)),ae.viewState.dailyBuildingEnergyPanelRect.width=S.current.offsetWidth,ae.viewState.dailyBuildingEnergyPanelRect.height=S.current.offsetHeight)})})),C.current.observe(S.current)),()=>{var ae;(ae=C.current)==null||ae.disconnect()}),[]);const te=(ae,Te)=>{w({x:Math.max(Te.x,P-window.innerWidth),y:Math.min(Te.y,window.innerHeight-v)})},ee=(ae,Te)=>{o(ge=>{ge.viewState.dailyBuildingEnergyPanelRect||(ge.viewState.dailyBuildingEnergyPanelRect=new cr(0,0,600,360)),ge.viewState.dailyBuildingEnergyPanelRect.x=Math.max(Te.x,P-window.innerWidth),ge.viewState.dailyBuildingEnergyPanelRect.y=Math.min(Te.y,window.innerHeight-v)})},de=()=>{o(ae=>{ae.viewState.showDailyBuildingEnergyPanel=!1,e&&(ae.actionInfo={name:"Close Daily Building Energy Graph",timestamp:new Date().getTime()})})},fe=Y.t("word.Hour",j),pe=Y.t("word.Energy",j),ye=x&&x[0]?Object.keys(x[0]).length===0:!0;return h.jsx(Bi,{nodeRef:y,handle:".handle",bounds:"parent",axis:"both",position:T,onDrag:te,onStop:ee,onMouseDown:()=>{o(ae=>{ae.selectedFloatingWindow="dailyBuildingEnergyPanel"})},children:h.jsx(dBo,{ref:y,style:{zIndex:A==="dailyBuildingEnergyPanel"?bc:9},children:h.jsxs(fBo,{ref:S,style:{opacity:n,width:(a?a.width:600)+"px",height:(a?a.height:360)+"px"},children:[h.jsxs(hBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("buildingEnergyPanel.DailyBuildingEnergy",j)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",j)+" "+t+" | "+yr(i).format("MM/DD")})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{de()},onMouseDown:()=>{de()},children:`${Y.t("word.Close",j)}`})]}),h.jsx(g0t,{type:vi.DailyBuildingEnergy,dataSource:x,hasSolarPanels:d,labels:D,height:100,dataKeyAxisX:"Hour",labelX:fe,labelY:pe,unitY:Y.t("word.kWh",j),yMin:0,curveType:"linear",fractionDigits:2,symbolCount:24,referenceX:i.getHours()}),!u&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[O.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)}):h.jsx(Ml,{content:O.current.map((ae,Te)=>h.jsx("div",{children:ae},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Heater",j)+": "+R.toFixed(1)})}),V.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.AC",j)+": "+F.toFixed(1)}):h.jsx(Ml,{content:V.current.map((ae,Te)=>h.jsx("div",{children:ae},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.AC",j)+": "+F.toFixed(1)})}),N!==0&&h.jsx(h.Fragment,{children:G.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)}):h.jsx(Ml,{content:G.current.map((ae,Te)=>h.jsx("div",{children:ae},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.SolarPanel",j)+": "+N.toFixed(1)})})}),q.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)}):h.jsx(Ml,{content:q.current.map((ae,Te)=>h.jsx("div",{children:ae},Te)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Net",j)+": "+W.toFixed(1)})}),h.jsx(io,{type:"default",icon:ye?h.jsx(Th,{}):h.jsx(Hf,{}),title:Y.t(ye?"word.Run":"word.Update",j),onClick:()=>{const ae=M.getState().elements,Te=M.getState().countElementsByType,ge=M.getState().getChildrenOfType,Se=bX(ae,Te,ge);if(Se.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",j));return}if(Se.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let Re;switch(Se.buildingCompletion){case Uc.WALL_DISJOINED:Re=Y.t("message.WallsAreNotConnected",j);break;case Uc.WALL_EMPTY:Re=Y.t("message.BuildingContainsEmptyWall",j);break;case Uc.ROOF_MISSING:Re=Y.t("message.BuildingRoofMissing",j);break;default:Re=Y.t("message.UnknownErrors",j)}co(Y.t("message.SimulationWillNotStartDueToErrors",j)+": "+Re);return}Se.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",j)),gn(Y.t("message.SimulationStarted",j)),setTimeout(()=>{r(),dt.getState().set(Re=>{Re.runDailyThermalSimulation=!0,Re.pauseDailyThermalSimulation=!1,Re.simulationInProgress=!0}),o(Re=>{e&&(Re.actionInfo={name:"Run Daily Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",j),onClick:()=>{Ed("line-graph-"+fe+"-"+pe,"daily-building-energy").then(()=>{gn(Y.t("message.ScreenshotSaved",j)),e&&o(ae=>{ae.actionInfo={name:"Take Screenshot of Daily Building Energy Graph",timestamp:new Date().getTime()}})})}}),x&&x.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:Y.t("word.SaveAsCsv",j),onClick:()=>{Sh(x,"daily-building-energy.csv"),gn(Y.t("message.CsvFileSaved",j)),e&&o(ae=>{ae.actionInfo={name:"Export Daily Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),gBo=Ho.div` position: fixed; top: 80px; right: 24px; @@ -9549,12 +9549,12 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: center; cursor: move; -`,ABo=be.memo(({city:t})=>{const e=M.getState().world,n=M(oa),o=M(hu)??g0,r=M(pn),i=M(RW),a=new Date(M(Al)),l=M(J4t),s=dt(zge),c=dt(Xq),u=dt(Lwt),d=dt(Cf),f=ye.hasSolarPanels(M.getState().elements),p=Cn(nOe),g=Cn(oOe),A=Cn(rOe),y=M(Sc),S=m.useRef(null),C=m.useRef(),P=S.current?S.current.clientWidth+40:l?l.width+40:640,v=S.current?S.current.clientHeight+100:l?l.height+100:600,[T,w]=m.useState({x:l?Math.max(l.x,P-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-v):0}),x=be.useRef(null),b=$t(),R=u1(t),H=zs[a.getMonth()],F=e.daysPerYear??6,E=12/F,[N,U]=m.useState(0),[W,k]=m.useState(0),[D,L]=m.useState(0),[j,B]=m.useState(0),[O,V]=m.useState(["Heater","AC","Solar","Net"]),[G,q]=m.useState([]),{sum:$,sumHeaterMap:ie,sumAcMap:Q,sumSolarPanelMap:se,dataLabels:Z}=p0t(a,R,f),ee=m.useRef(new Array(F).fill({})),te=m.useRef(new Array(F).fill(0)),oe=m.useRef(new Array(F).fill(0)),de=m.useRef(new Array(F).fill(0)),he=m.useRef(new Array(F).fill(0)),pe=m.useRef([]),me=m.useRef([]),le=m.useRef([]),Te=m.useRef([]);m.useEffect(()=>{ge()},[F,u]),m.useEffect(()=>{c&&ge()},[c]);const ge=()=>{ee.current=new Array(F).fill({}),te.current=new Array(F).fill(0),oe.current=new Array(F).fill(0),de.current=new Array(F).fill(0),he.current=new Array(F).fill(0),q([]),U(0),k(0),L(0),B(0),V([])};m.useEffect(()=>{const ve=Math.floor(a.getMonth()/E),we=(Object.keys($[0]).length-1)/(f?4:3);if(pe.current=[],me.current=[],Te.current=[],le.current=[],we>1){const Ue=new Map,nt=new Map,We=new Map,Ee=new Map;for(const je of $){let xt=0;for(let gt=0;gt6&&(Ee=" "+je.substring(6).trim());break}const ke="Heater"+Ee,Oe="AC"+Ee,st="Net"+Ee;if(f){const je="Solar"+Ee;let xt=0;V([ke,Oe,je,st]);for(const Ye of $)Ue+=Ye[ke],nt+=Ye[Oe],xt+=Ye[je],We+=Ye[st];const gt={};gt.Month=zs[a.getMonth()],gt[ke]=30*Ue,gt[Oe]=30*nt,gt[je]=30*xt,gt[st]=30*We,ee.current[ve]=gt}else{V([ke,Oe,st]);for(const xt of $)Ue+=xt[ke],nt+=xt[Oe],We+=xt[st];const je={};je.Month=zs[a.getMonth()],je[ke]=30*Ue,je[Oe]=30*nt,je[st]=30*We,ee.current[ve]=je}}q([...ee.current]);let Pe=0;if(ie)for(const Ue of ie.keys())Pe+=ie.get(Ue)??0;let Ie=0;if(Q)for(const Ue of Q.keys())Ie+=Q.get(Ue)??0;let Me=0;if(se&&f)for(const Ue of se.keys())Me+=se.get(Ue)??0;te.current[ve]=Pe*E*30,oe.current[ve]=Ie*E*30,de.current[ve]=Me*E*30,he.current[ve]=te.current[ve]+oe.current[ve]-de.current[ve];const ze=te.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);U(ze);const Ne=oe.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);k(Ne);const Je=de.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);L(Je),B(he.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0)),p(ze),g(Ne),A(Je),dt.getState().showSolarRadiationHeatmap||Cn.getState().clearDataStore()},[s]),m.useEffect(()=>{w({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-v)})},[l,P,v]),m.useEffect(()=>{const ve=()=>{w({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-v)})};return window.addEventListener("resize",ve),()=>{window.removeEventListener("resize",ve)}},[l,P,v]),m.useEffect(()=>(S.current&&(C.current||(C.current=new ResizeObserver(()=>{r(ve=>{S.current&&(ve.viewState.yearlyBuildingEnergyPanelRect||(ve.viewState.yearlyBuildingEnergyPanelRect=new cr(0,0,600,500)),ve.viewState.yearlyBuildingEnergyPanelRect.width=S.current.offsetWidth,ve.viewState.yearlyBuildingEnergyPanelRect.height=S.current.offsetHeight)})})),C.current.observe(S.current)),()=>{var ve;(ve=C.current)==null||ve.disconnect()}),[]);const Se=(ve,we)=>{w({x:Math.max(we.x,P-window.innerWidth),y:Math.min(we.y,window.innerHeight-v)})},Re=(ve,we)=>{r(Pe=>{Pe.viewState.yearlyBuildingEnergyPanelRect||(Pe.viewState.yearlyBuildingEnergyPanelRect=new cr(0,0,600,360)),Pe.viewState.yearlyBuildingEnergyPanelRect.x=Math.max(we.x,P-window.innerWidth),Pe.viewState.yearlyBuildingEnergyPanelRect.y=Math.min(we.y,window.innerHeight-v)})},De=()=>{r(ve=>{ve.viewState.showYearlyBuildingEnergyPanel=!1,n&&(ve.actionInfo={name:"Close Yearly Building Energy Graph",timestamp:new Date().getTime()})})},Ae=Y.t("word.Month",b),ue=Y.t("word.Energy",b),fe=G&&G[0]?Object.keys(G[0]).length===0:!0;return h.jsx(Bi,{nodeRef:x,handle:".handle",bounds:"parent",axis:"both",position:T,onDrag:Se,onStop:Re,onMouseDown:()=>{r(ve=>{ve.selectedFloatingWindow="yearlyBuildingEnergyPanel"})},children:h.jsx(gBo,{ref:x,style:{zIndex:y==="yearlyBuildingEnergyPanel"?bc:9},children:h.jsxs(mBo,{ref:S,style:{opacity:o,width:(l?l.width:600)+"px",height:(l?l.height:400)+"px"},children:[h.jsxs(yBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("buildingEnergyPanel.YearlyBuildingEnergy",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+a.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{De()},onMouseDown:()=>{De()},children:`${Y.t("word.Close",b)}`})]}),h.jsx(g0t,{type:vi.YearlyBuildingEnergy,dataSource:G,hasSolarPanels:f,labels:O,height:100,dataKeyAxisX:"Month",labelX:Ae,labelY:ue,unitY:Y.t("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,referenceX:H}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[pe.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Heater",b)+": "+N.toFixed(0)}):h.jsx(Ml,{content:pe.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Heater",b)+": "+N.toFixed(0)})}),me.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.AC",b)+": "+W.toFixed(0)}):h.jsx(Ml,{content:me.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.AC",b)+": "+W.toFixed(0)})}),D!==0&&h.jsx(h.Fragment,{children:le.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.SolarPanel",b)+": "+D.toFixed(0)}):h.jsx(Ml,{content:le.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.SolarPanel",b)+": "+D.toFixed(0)})})}),Te.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Net",b)+": "+j.toFixed(0)}):h.jsx(Ml,{content:Te.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Net",b)+": "+j.toFixed(0)})}),h.jsx(io,{type:"default",icon:fe?h.jsx(Th,{}):h.jsx(Rf,{}),title:Y.t(fe?"word.Run":"word.Update",b),onClick:()=>{const ve=M.getState().elements,we=M.getState().countElementsByType,Pe=M.getState().getChildrenOfType,Ie=bX(ve,we,Pe);if(Ie.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",b));return}if(Ie.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let Me;switch(Ie.buildingCompletion){case Uc.WALL_DISJOINED:Me=Y.t("message.WallsAreNotConnected",b);break;case Uc.WALL_EMPTY:Me=Y.t("message.BuildingContainsEmptyWall",b);break;case Uc.ROOF_MISSING:Me=Y.t("message.BuildingRoofMissing",b);break;default:Me=Y.t("message.UnknownErrors",b)}co(Y.t("message.SimulationWillNotStartDueToErrors",b)+": "+Me);return}Ie.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",b)),gn(Y.t("message.SimulationStarted",b)),setTimeout(()=>{i(),dt.getState().set(Me=>{Me.runYearlyThermalSimulation=!0,Me.pauseYearlyThermalSimulation=!1,Me.simulationInProgress=!0}),r(Me=>{n&&(Me.actionInfo={name:"Run Yearly Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+Ae+"-"+ue,"yearly-building-energy").then(()=>{gn(Y.t("message.ScreenshotSaved",b)),n&&r(ve=>{ve.actionInfo={name:"Take Screenshot of Yearly Building Energy Graph",timestamp:new Date().getTime()}})})}}),ee.current&&ee.current.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Hf,{}),title:Y.t("word.SaveAsCsv",b),onClick:()=>{Sh(ee.current,"yearly-building-energy.csv"),gn(Y.t("message.CsvFileSaved",b)),n&&r(ve=>{ve.actionInfo={name:"Export Yearly Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),wBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(En),o=M(j8t),r=M(B8t),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=m.useRef(null),p=m.useRef(o),g=m.useRef(r),A=$t();m.useEffect(()=>{var w;(w=f.current)==null||w.focus()},[]);const y=(w,x)=>{if(d.current){const{clientWidth:b,clientHeight:R}=window.document.documentElement,H=d.current.getBoundingClientRect();u({left:-H.left+x.x,right:b-(H.right-x.x),top:-H.top+x.y,bottom:R-((H==null?void 0:H.bottom)-x.y)})}},S=w=>{e(x=>{x.minimumNavigationMoveSpeed=w}),dt.getState().set(x=>{x.navigationMoveSpeed=w})},C=w=>{e(x=>{x.minimumNavigationTurnSpeed=w}),dt.getState().set(x=>{x.navigationTurnSpeed=w})},P=()=>{const w=o,x=p.current;if(w!==x){const H={name:"Minimum Navigation Move Speed",timestamp:Date.now(),oldValue:w,newValue:x,undo:()=>{S(H.oldValue)},redo:()=>{S(H.newValue)}};n(H),S(x)}const b=r,R=g.current;if(b!==R){const H={name:"Minimum Navigation Turn Speed",timestamp:Date.now(),oldValue:b,newValue:R,undo:()=>{C(H.oldValue)},redo:()=>{C(H.newValue)}};n(H),C(R)}},v=()=>{t(!1)},T=()=>{P(),t(!1)};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:`${Y.t("navigationPanel.NavigationParameters",A)}`}),footer:[h.jsx(io,{onClick:v,children:`${Y.t("word.Cancel",A)}`},"Cancel"),h.jsx(io,{type:"primary",ref:f,onClick:T,children:`${Y.t("word.OK",A)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:w=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:(x,b)=>y(x,b),children:h.jsx("div",{ref:d,children:w})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("navigationPanel.MinimumMoveSpeed",A)+" ([1, 10]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:10,style:{width:"100%"},precision:0,value:p.current,step:1,onChange:w=>{p.current=Number(w),a(!i)},onBlur:w=>{const x=w.target.value,b=parseFloat(x);p.current=Number.isNaN(b)?3:b,a(!i)},onPressEnter:w=>{const x=w.target.value,b=parseFloat(x);p.current=Number.isNaN(b)?3:b,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("navigationPanel.MinimumTurnSpeed",A)+" ([1, 5]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:5,style:{width:"100%"},precision:0,value:g.current,step:1,onChange:w=>{g.current=Number(w),a(!i)},onBlur:w=>{const x=w.target.value,b=parseFloat(x);g.current=Number.isNaN(b)?3:b,a(!i)},onPressEnter:w=>{const x=w.target.value,b=parseFloat(x);g.current=Number.isNaN(b)?3:b,a(!i)}})})]})]})}),vBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(En),o=M(Oq),r=ye.getShadowMapSize(),i=4096,a=1e4,[l,s]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState({left:0,top:0,bottom:0,right:0}),p=m.useRef(null),g=m.useRef(null),A=m.useRef(o?Math.round(o)/a:1),y=m.useRef(r?Math.round(r/i):1),S=$t();m.useEffect(()=>{var b;(b=g.current)==null||b.focus()},[]);const C=(b,R)=>{if(p.current){const{clientWidth:H,clientHeight:F}=window.document.documentElement,E=p.current.getBoundingClientRect();f({left:-E.left+R.x,right:H-(E.right-R.x),top:-E.top+R.y,bottom:F-((E==null?void 0:E.bottom)-R.y)})}},P=b=>{e(R=>{R.viewState.shadowCameraFar=b})},v=b=>{localStorage.setItem("aladdin-shadow-map-size",b.toString())},T=()=>{const b=o,R=A.current*a;if(b!==R){const E={name:"Shadow Camera Far Distance",timestamp:Date.now(),oldValue:b,newValue:R,undo:()=>{P(E.oldValue)},redo:()=>{P(E.newValue)}};n(E),P(R)}const H=r,F=y.current*i;if(H!==F){const E={name:"Shadow Map Size",timestamp:Date.now(),oldValue:H,newValue:F,undo:()=>{v(E.oldValue)},redo:()=>{v(E.newValue)}};n(E),v(F)}},w=()=>{t(!1)},x=()=>{T(),t(!1),window.location.reload()};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>u(!0),onMouseOut:()=>u(!1),children:`${Y.t("shadowSettingsPanel.ShadowSettings",S)}`}),footer:[h.jsx(io,{onClick:w,children:`${Y.t("word.Cancel",S)}`},"Cancel"),h.jsx(io,{type:"primary",ref:g,onClick:x,children:`${Y.t("word.OK",S)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:b=>h.jsx(Bi,{disabled:!c,bounds:d,onStart:(R,H)=>C(R,H),children:h.jsx("div",{ref:p,children:b})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:18,children:Y.t("shadowSettingsPanel.ShadowCameraFarDistance",S)+" ([1, 1000]×"+a+"): "}),h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:1,max:1e3,style:{width:"100%"},precision:0,value:A.current,step:1,onChange:b=>{A.current=Number(b),s(!l)},onBlur:b=>{const R=b.target.value,H=parseFloat(R);A.current=Number.isNaN(H)?1:H,s(!l)},onPressEnter:b=>{const R=b.target.value,H=parseFloat(R);A.current=Number.isNaN(H)?1:H,s(!l)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"10px"},children:[h.jsx(Ke,{span:18,children:Y.t("shadowSettingsPanel.ShadowMapSize",S)+" ([1, 4]×"+i+"): "}),h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:1,max:4,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:b=>{y.current=Number(b),s(!l)},onBlur:b=>{const R=b.target.value,H=parseFloat(R);y.current=Number.isNaN(H)?1:H,s(!l)},onPressEnter:b=>{const R=b.target.value,H=parseFloat(R);y.current=Number.isNaN(H)?1:H,s(!l)}})})]}),h.jsx(nn,{style:{fontSize:"10px"},children:h.jsxs(Ke,{span:24,children:[Y.t("shadowSettingsPanel.Notes",S),":",h.jsx("br",{}),h.jsxs("ul",{children:[h.jsx("li",{children:Y.t("shadowSettingsPanel.RefreshPageNote",S)}),h.jsx("li",{children:Y.t("shadowSettingsPanel.MapSizeWarning",S)})]})]})})]})}),{Option:SD}=Uo,xBo=be.memo(({setDialogVisible:t})=>{const e=M(DH),n=M(EH),o=M(ewt),r=M(twt),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=m.useRef("Unknown"),p=m.useRef("Unknown"),g=m.useRef("Monocrystalline"),A=m.useRef(12),y=m.useRef(8),S=m.useRef("Black"),C=m.useRef(1),P=m.useRef(1.5),v=m.useRef(0),T=m.useRef(.2),w=m.useRef(45),x=m.useRef(300),b=m.useRef(-.002),R=m.useRef(.005),H=m.useRef(30),F=m.useRef(30),E=m.useRef(10),N=m.useRef(40),U=m.useRef(15),W=$t(),k=(q,$)=>{if(d.current){const{clientWidth:ie,clientHeight:Q}=window.document.documentElement,se=d.current.getBoundingClientRect();u({left:-se.left+$.x,right:ie-(se.right-$.x),top:-se.top+$.y,bottom:Q-((se==null?void 0:se.bottom)-$.y)})}},D=m.useMemo(()=>{const q=[];for(const $ in n)q.push($);return q},[n]),L=()=>{const q={name:f.current,brand:p.current,cellType:g.current,efficiency:T.current,length:P.current,nominalLength:P.current,width:C.current,nominalWidth:C.current,thickness:R.current,m:A.current,n:y.current,pmax:x.current,vmpp:F.current,impp:E.current,voc:N.current,isc:U.current,pmaxTC:b.current,noct:w.current,weight:H.current,color:S.current,shadeTolerance:m8.PARTIAL,bifacialityFactor:v.current};o(q)},j=()=>{if(f.current.trim()===""){yi.info({title:Y.t("pvModelPanel.CannotAddCustomSolarPanel",W),content:Y.t("pvModelPanel.CustomSolarPanelMustHaveModelName",W)+"."});return}if(e[f.current.trim()]){yi.info({title:Y.t("pvModelPanel.NoNeedToAddThisCustomSolarPanel",W),content:Y.t("pvModelPanel.SolarPanelModelAlreadyProvidedBySystem",W)+" ("+f.current+")."});return}D.includes(f.current)?yi.info({title:Y.t("pvModelPanel.CannotAddCustomSolarPanel",W),content:Y.t("pvModelPanel.CustomSolarPanelExists",W)+': "'+f.current+'"'}):L()},B=q=>{f.current=q.name,p.current=q.brand,g.current=q.cellType,T.current=q.efficiency,P.current=q.length,C.current=q.width,R.current=q.thickness,A.current=q.m,y.current=q.n,x.current=q.pmax,F.current=q.vmpp,E.current=q.impp,N.current=q.voc,U.current=q.isc,b.current=q.pmaxTC,w.current=q.noct,H.current=q.weight,S.current=q.color,v.current=q.bifacialityFactor},O=()=>{yi.confirm({title:Y.t("pvModelPanel.DoYouReallyWantToImportCustomSolarPanel",W)+"?",content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),Y.t("word.Warning",W)+": "+Y.t("pvModelPanel.ExistingSettingsWillBeOverwritten",W)+"."]}),icon:h.jsx(Zx,{}),onOk:()=>{navigator.clipboard.readText().then(q=>{const $=JSON.parse(q);if(!$.cellType||!$.pmax){co(Y.t("pvModelPanel.FailInImportingDataFromClipboard",W));return}B($),a(!i)}).catch(q=>{co(Y.t("pvModelPanel.FailInImportingDataFromClipboard",W)+":"+q)})}})},V=q=>{yi.confirm({title:Y.t("pvModelPanel.DoYouReallyWantToRemoveThisCustomSolarPanel",W)+' "'+q+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),Y.t("word.Warning",W)+": "+Y.t("pvModelPanel.MakeSureThisCustomSolarPanelIsNotUsed",W)+"."]}),icon:h.jsx(Zx,{}),onOk:()=>{r(q)}})},G=[{key:"1",label:Y.t("pvModelPanel.General",W),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.Model",W)+": "}),h.jsx(Ke,{span:10,children:h.jsx(jl,{style:{width:"100%"},value:f.current,onChange:q=>{f.current=q.target.value,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.BrandName",W)+": "}),h.jsx(Ke,{span:10,children:h.jsx(jl,{style:{width:"100%"},value:p.current,onChange:q=>{p.current=q.target.value,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.CellType",W)+":"}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:g.current,onChange:q=>{g.current=q,a(!i)},children:[h.jsx(SD,{value:"Monocrystalline",children:Y.t("pvModelPanel.Monocrystalline",W)},"Monocrystalline"),h.jsx(SD,{value:"Polycrystalline",children:Y.t("pvModelPanel.Polycrystalline",W)},"Polycrystalline"),h.jsx(SD,{value:"Thin Film",children:Y.t("pvModelPanel.ThinFilm",W)},"Thin Film")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Length",W)+" ([0.1, 3]"+Y.t("word.MeterAbbreviation",W)+"): "}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{min:.1,max:3,style:{width:"100%"},precision:3,value:P.current,step:.01,onChange:q=>{q!==null&&(P.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);P.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);P.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Width",W)+" ([0.1, 3]"+Y.t("word.MeterAbbreviation",W)+"): "}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{min:.1,max:3,style:{width:"100%"},precision:3,value:C.current,step:.01,onChange:q=>{q!==null&&(C.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);C.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);C.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.PowerBifaciality",W)+" ([0, 1]):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.01,value:v.current,onChange:q=>{q!==null&&(v.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.Weight",W)+" ("+Y.t("pvModelPanel.Kilogram",W)+"):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:H.current,onChange:q=>{q!==null&&(H.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Thickness",W)+" ("+Y.t("word.MeterAbbreviation",W)+"):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:4,step:1e-4,value:R.current,onChange:q=>{q!==null&&(R.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Color",W)+":"}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:S.current,onChange:q=>{S.current=q,a(!i)},children:[h.jsx(SD,{value:"Black",children:Y.t("pvModelPanel.Black",W)},"Black"),h.jsx(SD,{value:"Blue",children:Y.t("pvModelPanel.Blue",W)},"Blue")]})})]})]})},{key:"2",label:Y.t("pvModelPanel.Electrical",W),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.SolarCellEfficiency",W)+" (%):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:100*T.current,onChange:q=>{q!==null&&(T.current=q*.01,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.CellCountInXDirection",W)+": "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:36,style:{width:"100%"},precision:0,value:A.current,step:1,onChange:q=>{q!==null&&(A.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);A.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);A.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.CellCountInYDirection",W)+": "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:36,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:q=>{q!==null&&(y.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);y.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);y.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.MaximumRatedPower",W)+" Pmax ("+Y.t("word.WattAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:1,value:x.current,onChange:q=>{q!==null&&(x.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.TemperatureCoefficientOfPmax",W)+" (%/°C):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},step:1e-4,value:b.current,onChange:q=>{q!==null&&(b.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.NominalOperatingCellTemperature",W)+" (°C):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},step:1,precision:1,value:w.current,onChange:q=>{q!==null&&(w.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.RatedVoltage",W)+" Vmpp ("+Y.t("word.VoltAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:F.current,onChange:q=>{q!==null&&(F.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.RatedCurrent",W)+" Impp ("+Y.t("word.AmpereAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.1,value:E.current,onChange:q=>{q!==null&&(E.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.OpenCircuitVoltage",W)+" Voc ("+Y.t("word.VoltAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:N.current,onChange:q=>{q!==null&&(N.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.ShortCircuitCurrent",W)+" Isc ("+Y.t("word.AmpereAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.1,value:U.current,onChange:q=>{q!==null&&(U.current=q,a(!i))}})})]})]})}];return h.jsx(yi,{width:720,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:Y.t("menu.settings.CustomizeSolarPanel",W)}),footer:[h.jsx(io,{onClick:()=>t(!1),children:Y.t("word.Close",W)},"Close")],onCancel:()=>t(!1),maskClosable:!1,destroyOnClose:!1,modalRender:q=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:($,ie)=>k($,ie),children:h.jsx("div",{ref:d,children:q})}),children:h.jsxs(nn,{style:{justifyContent:"space-between"},children:[h.jsx(Ke,{flex:3,children:h.jsx(hQ,{defaultActiveKey:"1",type:"card",items:G})}),h.jsx(Ke,{flex:.5,children:h.jsxs(on,{style:{height:"100%",justifyContent:"center",marginLeft:"12px"},direction:"vertical",children:[h.jsx(Vnn,{title:Y.t("word.Add",W),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>j()}),h.jsx(mue,{style:{marginTop:"12px",marginBottom:"12px"}}),h.jsx(Bnn,{title:Y.t("pvModelPanel.ImportCustomSolarPanelFromClipboard",W),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>{O()}})]})}),h.jsx(Ke,{flex:2,children:h.jsx(gk,{style:{marginTop:"56px",marginLeft:"8px"},size:"small",header:h.jsx("div",{style:{fontWeight:"bold"},children:Y.t("pvModelPanel.AddedCustomSolarPanels",W)}),bordered:!0,dataSource:D,renderItem:q=>h.jsxs(gk.Item,{children:[h.jsx(yon,{title:Y.t("pvModelPanel.ExportThisCustomSolarPanel",W),style:{paddingRight:"4px",cursor:"pointer"},onClick:()=>{const $=n[q];navigator.clipboard.writeText(JSON.stringify($)).then(()=>{gn(Y.t("pvModelPanel.CustomSolarPanelExportedToClipboard",W)+" ("+q+").")})}}),h.jsx(eqe,{title:Y.t("word.Delete",W),style:{paddingRight:"6px",cursor:"pointer"},onClick:()=>V(q)}),q]},q)})})]})})}),bBo=be.memo(()=>{const t=M(Tge),e=M(Vq),n=M(FBe),o=M(W4t),r=M(kBe),i=M(LBe),a=M(j4t),l=M(Y4t),s=dt(L8t),c=dt(W8t),u=dt(N8t),d=dt(U8t),f=dt(hs),p=M(WBe),g=M(q4t),A=M(NBe),y=M(t8t),S=M(o8t),C=M(UBe),P=M(a8t),v=M(jBe),T=M(c8t),w=M(BBe),x=M(f8t),b=M(YBe),R=M(g8t),H=M(OBe),F=M(A8t),E=M(_4t),N=M(X4t),U=M(v8t),W=M(HW),k=M(s0),D=M(Mb),L=M(qYe),j=M(KYe),B=M(Jge),O=M(Yq)??!1,[V,G]=m.useState("Boston MA, USA");return m.useEffect(()=>{if(Object.keys(B).length===0)return;const q=L(k,D)??"Boston MA, USA";G(q),j(q)},[k,D,B]),h.jsxs(h.Fragment,{children:[o&&h.jsx(a8o,{}),r&&h.jsx(u8o,{}),i&&h.jsx(LUo,{}),t&&h.jsx(ijo,{}),e&&h.jsx(ZUo,{}),(n||O)&&!W&&h.jsx(UUo,{}),a&&h.jsx(Sko,{city:V,graphs:[vi.MonthlyTemperatures,vi.SunshineHours]}),l&&h.jsx(Zjo,{city:V}),s&&h.jsx(xBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showSolarPanelCustomizationPanel=q})}}),c&&h.jsx(cBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showEconomicsPanel=q})}}),u&&h.jsx(wBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showNavigationPanel=q})}}),d&&h.jsx(vBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showShadowSettings=q})}}),g&&h.jsx(Rko,{city:V}),p&&h.jsx(zUo,{city:V}),y&&h.jsx(OUo,{city:V}),A&&h.jsx(XUo,{city:V}),S&&h.jsx(fjo,{}),P&&h.jsx(mjo,{city:V}),C&&h.jsx(vjo,{city:V}),T&&h.jsx(Hjo,{city:V}),v&&h.jsx(Tjo,{city:V}),w&&h.jsx(Djo,{city:V}),x&&h.jsx(Ljo,{city:V}),b&&h.jsx(jjo,{city:V}),R&&h.jsx(Vjo,{city:V}),H&&h.jsx(Kjo,{city:V}),F&&h.jsx(oBo,{city:V}),E&&h.jsx(pBo,{city:V}),N&&h.jsx(ABo,{city:V}),f&&h.jsx(sjo,{}),U&&h.jsx(sBo,{})]})});class ll{static computeSolarPanelOutput(e,n,o,r,i,a,l,s,c){const u=i.parentType===z.Roof,d=i.parentType===z.Wall;u&&(a=l);const f=d?ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,l,i.lz):ye.absoluteCoordinates(i.cx,i.cy,i.cz,a,void 0,void 0,!0),p=a.rotation[2];let g=i.tiltAngle,A=p+i.relativeAzimuth,y=!0;if(u&&(f.z=i.cz+i.lz+.02+a.cz,ye.isZero(i.rotation[0])?f.z+=i.poleHeight:(g=i.rotation[0],A=p,y=!1)),d&&!ye.isZero(i.tiltAngle)){const $=a,Q=(l?l.rotation[2]+$.relativeAngle:$.relativeAngle)-Qt,se=i.ly*Math.abs(Math.sin(i.tiltAngle))/2;f.x+=se*Math.cos(Q),f.y+=se*Math.sin(Q)}const S=new ae().fromArray(i.normal),C=e.getMonth(),P=ye.dayOfYear(e),v=n.solarRadiationHeatmapGridCellSize??.5;let T,w,x,b,R;n.discretization===Em.EXACT?(T=i.lx,w=i.ly,i.orientation===vr.portrait?(x=Math.max(1,Math.round(i.lx/r.width)),b=Math.max(1,Math.round(i.ly/r.length)),x*=r.n,b*=r.m):(x=Math.max(1,Math.round(i.lx/r.length)),b=Math.max(1,Math.round(i.ly/r.width)),x*=r.m,b*=r.n),R=i.lx/x):(T=i.lx,w=i.ly,x=Math.max(2,Math.round(i.lx/v)),b=Math.max(2,Math.round(i.ly/v)),x%2!==0&&(x+=1),b%2!==0&&(b+=1),R=v);const H=T/x,F=w/b,E=f.x-(T-R)/2,N=f.y-(w-R)/2,U=u||d?f.z:a.lz+i.poleHeight+i.lz,W=new Kt(f.x,f.y),k=new ae,D=Array.from(Array(x),()=>new Array(b));let L=new ln(u&&!y?0:g,0,A,"ZYX");if(i.trackerType!==Ll.NO_TRACKER){const $=p?o.clone().applyAxisAngle(ko,-p):o.clone();switch(i.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const ie=new Ts().setFromUnitVectors(ko,$);L=new ln().setFromQuaternion(ie),L.z+=A;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const ie=new Ts().setFromUnitVectors(ko,new ae($.x,0,$.z).normalize());L=new ln().setFromQuaternion(ie),L.z+=A;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{const ie=new ae($.x,-$.y,0).normalize(),Q=Math.acos(Yc.dot(ie))*Math.sign(ie.x);L=new ln(i.tiltAngle,0,Q+p,"ZYX");break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}S.applyEuler(L),u&&!y&&(L.x=i.rotation[0],L.z=i.rotation[2]+p),d&&(L.x=Qt+i.tiltAngle,L.z=a.relativeAngle+p);const j=xi(o,P,s,li.SPHERE_MODEL),B=qr(n.ground,C,S,j),O=S.dot(o),V=new Kt,G=new ae;for(let $=0;$0&&(V.set(E+$*H,N+ie*F),G.set(V.x-W.x,V.y-W.y,0),G.applyEuler(L),k.set(f.x+G.x,f.y+G.y,U+G.z),c(i.id,k,o)<0&&(D[$][ie]+=O*j));let q=0;switch(r.shadeTolerance){case m8.NONE:{let $=Number.MAX_VALUE;for(let ie=0;ieArray(S).fill(0)),D=Array(y).fill(0).map(()=>Array(S).fill(0));let L;for(let j=0;j0)for(const $ of a){if($.type!==z.Window)continue;const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx*r.lx/2,Z=$.lz*r.lz/2,ee=$;if(ee.windowType===Ci.Arched){const te=T.clone().add(new ae(ee.cx*r.lx,0,ee.cz*r.lz));ll.pointWithinArch(R,ee.lx,ee.lz,ee.archHeight,te)&&(L=!1)}else if(G.x>=ie-se&&G.x=Q-Z&&G.y0)for(const $ of l){if($.type!==z.Door)continue;const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx*r.lx/2,Z=$.lz*r.lz/2,ee=$;if(ee.doorType===Rd.Arched){const te=T.clone().add(new ae(ee.cx*r.lx,0,ee.cz*r.lz));ll.pointWithinArch(R,ee.lx,ee.lz,ee.archHeight,te)&&(L=!1)}else if(G.x>=ie-se&&G.x=Q-Z&&G.y0)for(const $ of s){const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx/2,Z=$.ly/2;if(G.x>=ie-se&&G.x=Q-Z&&G.yc6||ie<0)&&$&&(k[j][B]+=U),W>0&&ie<0&&(D[j][B]+=W*N,$&&(k[j][B]+=W*N))}}}return{intensity:k,unitArea:C*P,heatmap:D}}static computeDoorSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx*i.lx,f=r.lz*i.lz,p=Math.max(2,Math.round(d/u)),g=Math.max(2,Math.round(f/u)),A=d/p,y=f/g,S=a.rotation[2]+i.relativeAngle,P=ye.wallAbsolutePosition(new ae(i.cx,i.cy,i.cz),a).setZ(i.lz/2+a.lz).clone().add(new ae(r.cx*i.lx,0,r.cz*i.lz)),v=new ae(Math.cos(S-Qt),Math.sin(S-Qt),0),T=A*Math.cos(S),w=A*Math.sin(S),x=new ae,b=xi(o,c,l,li.SPHERE_MODEL),R=qr(n.ground,e.getMonth(),v,b),H=v.dot(o),F=Array(p).fill(0).map(()=>Array(g).fill(0));if(r.doorType===Rd.Arched)for(let E=0;E0&&s(r.id,x,o)<0&&(F[E][N]+=H*b))}else for(let E=0;E0){const U=E-p/2+.5,W=N-g/2+.5;x.set(P.x+U*T,P.y+U*w,P.z+W*y),s(r.id,x,o)<0&&(F[E][N]+=H*b)}return{intensity:F,unitArea:A*y}}static pointWithinArch(e,n,o,r,i){if(r>0){const a=.5*n,l=Math.min(r,o,a),s=.5*(l+a*a/l),c=e.x-i.x,u=e.y-i.y,d=c*c+u*u;let f=e.z-i.z;return d-o/2?!0:(f=e.z-(o-s),d+f*fArray(g).fill(0));if(r.windowType===Ci.Arched)for(let E=0;E0&&s(r.id,x,o)<0&&(F[E][N]+=H*b))}else for(let E=0;E0){const U=E-p/2+.5,W=N-g/2+.5;x.set(P.x+U*T,P.y+U*w,P.z+W*y),s(r.id,x,o)<0&&(F[E][N]+=H*b)}return{intensity:F,unitArea:A*y}}static computeRoofWindowSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=ye.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx,f=r.lz,p=Math.max(2,Math.round(d/u)),g=Math.max(2,Math.round(f/u)),A=d/p,y=f/g,S=new ae(r.cx,r.cy,r.cz).applyEuler(new ln(0,0,a.rotation[2]));S.x+=a.cx,S.y+=a.cy,S.z+=a.lz;const C=new ln(r.rotation[0],r.rotation[1],r.rotation[2]+a.rotation[2],"ZXY"),P=new ae(0,0,1).applyEuler(C),v=new ae,T=xi(o,c,l,li.SPHERE_MODEL),w=qr(n.ground,e.getMonth(),P,T),x=P.dot(o),b=Array(p).fill(0).map(()=>Array(g).fill(0));if(r.windowType===Ci.Arched)for(let R=0;R0&&s(r.id,v,o)<0&&(b[R][H]+=x*T))}else for(let R=0;R0){const F=R-p/2+.5,E=H-g/2+.5,N=new ae(F,E,0);N.applyEuler(C),v.set(S.x+N.x,S.y+N.y,S.z+N.z),s(r.id,v,o)<0&&(b[R][H]+=x*T)}return{intensity:b,unitArea:A*y}}static computePyramidRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=n.solarRadiationHeatmapGridCellSize??.5,g=ye.dayOfYear(e),A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,g,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new ae().subVectors(x,w),H=new ae().subVectors(b,w),F=new ae().subVectors(b,x),E=R.length(),N=new ae().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/p)),W=Math.max(2,Math.round(N/p)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize();const D=U*H.dot(R)/E;H.normalize(),F.normalize();const L=new ae().crossVectors(H,F).normalize(),j=R.multiplyScalar(.5*E/U),B=new ae().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ae(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));O.add(j).add(B),j.multiplyScalar(2),B.multiplyScalar(2),C.push(j.length()*B.length());const V=new ae,G=[],q=.01;G.push({x:-q,y:-q}),G.push({x:U+q,y:-q}),G.push({x:D,y:W+q});const $=qr(n.ground,e.getMonth(),L,y),ie=L.dot(o);for(let Q=0;Qc6||te<0)&&(k[Q][Z]+=$),ie>0&&te<0&&(k[Q][Z]+=ie*y)}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeHipRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new ae().subVectors(x,w),H=new ae().subVectors(b,w),F=new ae().subVectors(b,x),E=R.length(),N=new ae().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize();const D=U*H.dot(R)/E;H.normalize(),F.normalize();const L=new ae().crossVectors(H,F).normalize(),j=R.multiplyScalar(.5*E/U),B=new ae().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new ae,V=new ae(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));V.add(j).add(B),j.multiplyScalar(2),B.multiplyScalar(2),C.push(j.length()*B.length());const G=qr(n.ground,e.getMonth(),L,y),q=L.dot(o),$=[];for(const ie of v)$.push({x:ie.x,y:ie.y});if(P%2===0)for(let ie=0;iec6||ee<0)&&(k[ie][se]+=G),q>0&&ee<0&&(k[ie][se]+=q*y)}}}else{const ie=[];ie.push({x:-.01,y:-.01}),ie.push({x:U+.01,y:-.01}),ie.push({x:D,y:W+.01});for(let se=0;sec6||oe<0)&&(k[se][ee]+=G),q>0&&oe<0&&(k[se][ee]+=q*y)}}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeGambrelRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new ae().subVectors(x,w),H=new ae().subVectors(b,w),F=new ae().subVectors(b,x),E=R.length(),N=new ae().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize(),H.normalize(),F.normalize();const D=new ae().crossVectors(H,F).normalize(),L=R.multiplyScalar(.5*E/U),j=new ae().crossVectors(D,R).normalize().multiplyScalar(.5*N/W),B=new ae(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));B.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ae,V=qr(n.ground,e.getMonth(),D,y),G=D.dot(o);for(let q=0;qc6||Q<0)&&(k[q][ie]+=V),G>0&&Q<0&&(k[q][ie]+=G*y)}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeMansardRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=ye.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P;if(P===l.length-1){let w=Number.MAX_VALUE,x=Number.MAX_VALUE,b=-Number.MAX_VALUE,R=-Number.MAX_VALUE;for(const B of v){const O=B.clone().applyEuler(A);O.x>b&&(b=O.x),O.xR&&(R=O.y),O.yArray(E).fill(0));S.push(W);const k=new ae(w+g/2,x+g/2,s.lz+H+k0+(a?r.thickness:0)),D=new ae(0,0,k.z),L=qr(n.ground,e.getMonth(),ko,y),j=ko.dot(o);for(let B=0;Bc6||V<0)&&(W[B][O]+=L),j>0&&V<0&&(W[B][O]+=j*y)}}}else{const w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new ae().subVectors(x,w),H=new ae().subVectors(b,w),F=new ae().subVectors(b,x),E=R.length(),N=new ae().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize(),H.normalize(),F.normalize();const D=new ae().crossVectors(H,F).normalize(),L=R.multiplyScalar(.5*E/U),j=new ae().crossVectors(D,R).normalize().multiplyScalar(.5*N/W),B=new ae(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));B.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new ae,V=qr(n.ground,e.getMonth(),D,y),G=D.dot(o);for(let q=0;qc6||Q<0)&&(k[q][ie]+=V),G>0&&Q<0&&(k[q][ie]+=G*y)}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeFlatRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,g=new ln(0,0,l.rotation[2],"ZYX"),A=xi(o,f,u,li.SPHERE_MODEL),y=[],S=[];let C=Number.MAX_VALUE,P=Number.MAX_VALUE,v=-Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const k of a)for(const D of k){const L=D.clone().applyEuler(g);L.x>v&&(v=L.x),L.xT&&(T=L.y),L.yArray(x).fill(0));y.push(H),S.push(b*R);const F=a[0][0].z,E=new ae(C+p/2,P+p/2,l.lz+F+k0+(i?r.thickness:0)),N=new ae(0,0,E.z),U=qr(n.ground,e.getMonth(),ko,A),W=ko.dot(o);for(let k=0;kc6||L<0)&&(H[k][D]+=U),W>0&&L<0&&(H[k][D]+=W*A)}}return{segmentIntensities:y,segmentUnitArea:S}}static computeGableRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=ye.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,g=new ln(0,0,l.rotation[2],"ZYX"),A=xi(o,f,u,li.SPHERE_MODEL),y=[],S=[];for(const[C,P]of a.entries()){const v=r.id+"-"+C,T=P[0].clone().applyEuler(g),w=P[1].clone().applyEuler(g),x=P[2].clone().applyEuler(g),b=new ae().subVectors(w,T),R=new ae().subVectors(x,T),H=new ae().subVectors(x,w),F=b.length(),E=new ae().crossVectors(R,H).length()/F,N=Math.max(2,Math.round(F/p)),U=Math.max(2,Math.round(E/p)),W=Array(N).fill(0).map(()=>Array(U).fill(0));y.push(W),b.normalize(),R.normalize(),H.normalize();const k=new ae().crossVectors(R,H).normalize(),D=b.multiplyScalar(.5*F/N),L=new ae().crossVectors(k,b).normalize().multiplyScalar(.5*E/U),j=new ae(l.cx+T.x,l.cy+T.y,l.lz+T.z+k0+(i?r.thickness:0));j.add(D).add(L),D.multiplyScalar(2),L.multiplyScalar(2),S.push(D.length()*L.length());const B=new ae,O=qr(n.ground,e.getMonth(),k,A),V=k.dot(o);for(let G=0;Gc6||ie<0)&&(W[G][$]+=O),V>0&&ie<0&&(W[G][$]+=V*A)}}}return{segmentIntensities:y,segmentUnitArea:S}}static isPointRoof(e,n,o,r){if(n&&n.length>0)for(const i of n){const a=bn.getAbsoluteWindowVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}if(o&&o.length>0)for(const i of o){const a=bn.getAbsoluteSolarPanelVerticesOnRoof(i,r),l=ye.getPoints(a);if(ye.isPointInside(e.x,e.y,l))return!1}return!0}}const SBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(yA),r=M(Gr),i=M(s3),a=M(t5),l=Cn(Ige),s=Cn(yW),c=Cn(Dge),u=Cn(V8t),d=Cn(G8t),f=Cn(J8t),p=M(oa),g=dt(AW),A=dt(Ewt),y=dt(Xq),S=dt(Fwt),C=M.getState().world,P=M.getState().elements,v=C.noAnimationForThermalSimulation,T=C.highestTemperatureTimeInMinutes??900,w=m.useRef(0),x=m.useRef(!1),b=m.useRef(new Date(C.date)),R=m.useRef(0),H=m.useRef(!1),F=m.useRef(new Date(C.date)),E=m.useRef(0),N=m.useRef({high:20,low:0}),U=m.useRef(20),W=m.useRef(20),k=m.useRef(new Map),D=m.useRef(new Map),L=m.useRef(new Map),j=m.useRef([]),B=m.useRef([]),O=m.useRef(),V=m.useRef(),G=m.useRef(0),q=m.useRef(new Map),$=$t(),ie=u1(t),Q=new Date(C.date),se=t?ie==null?void 0:ie.elevation:0,Z=C.monthlyIrradianceLosses??new Array(12).fill(.05),ee=C.timesPerHour??4,te=60/ee,oe=C.daysPerYear??6,de=12/oe,{scene:he}=ri(),pe=m.useMemo(()=>new l0,[]),me=()=>a9(1,Xye(Q),yN(Q),ye.toRadians(C.latitude)).normalize(),le=(Be,$e,wt)=>{if(j.current.length>1){B.current.length=0,pe.set($e,wt);const vt=j.current.filter(Rt=>Rt.uuid!==Be);if(pe.intersectObjects(vt,!1,B.current),B.current.length>0)return B.current[0].distance}return-1},Te=()=>{const Be=he.children.filter($e=>$e.name==="Content");if(Be.length>0){const $e=Be[0].children;j.current.length=0;for(const wt of $e)ye.fetchSimulationElements(wt,j.current)}},ge=Be=>{if(ie){N.current=rb(Q,ie.lowestTemperatures,ie.highestTemperatures);const $e=ye.minutesIntoDay(Be);U.current=ob(N.current.high,N.current.low,C.diurnalTemperatureModel??y2.Sinusoidal,T,dl(Be,C.latitude),$e),W.current=wZe(C.latitude,ye.dayOfYear(Q),$e,ie.lowestTemperatures,ie.highestTemperatures,T,.5*(N.current.high-N.current.low),C.ground.thermalDiffusivity??.05,ije)}},Se=(Be,$e)=>{let wt=k.current.get(Be);wt||(wt=new Array(24).fill(0),k.current.set(Be,wt)),wt[Q.getHours()]+=$e},Re=(Be,$e)=>{let wt=D.current.get(Be);wt||(wt=new Array(24).fill(0),D.current.set(Be,wt)),wt[Q.getHours()]+=$e},De=(Be,$e)=>{let wt=L.current.get(Be);wt||(wt=new Array(24).fill(0),L.current.set(Be,wt)),wt[Q.getHours()]+=$e},Ae=()=>{var Be,$e,wt,vt;for(const Rt of P){if(ye.onBuildingEnvelope(Rt)&&((Be=k.current.get(Rt.id))==null||Be.fill(0)),Rt.type===z.Roof)for(const Gt of k.current.keys())Gt!==Rt.id&&Gt.startsWith(Rt.id)&&(($e=k.current.get(Gt))==null||$e.fill(0));Rt.type===z.Foundation&&((wt=D.current.get(Rt.id))==null||wt.fill(0),(vt=L.current.get(Rt.id))==null||vt.fill(0))}},ue=()=>{q.current.clear()};m.useEffect(()=>{if(g)if(v&&!ye.hasMovingParts(P))fe();else return Te(),ve(),w.current=requestAnimationFrame(Pe),()=>{cancelAnimationFrame(w.current),x.current||(gn(Y.t("message.SimulationAborted",$)),e(Be=>{Be.world.date=b.current.toLocaleString("en-US")}),dt.getState().set(Be=>{Be.simulationInProgress=!1,Be.simulationPaused=!1})),H.current=!1}},[g]),m.useEffect(()=>{H.current=A,A?(F.current=new Date(Q.getTime()),cancelAnimationFrame(w.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",$))):(n("simulationPaused",!1),Q.setHours(Q.getHours(),Q.getMinutes()+te),Pe())},[A]);const fe=()=>{Je()},ve=()=>{H.current?(Q.setTime(F.current.getTime()),H.current=!1):(b.current=new Date(C.date),E.current=ye.dayOfYear(Q),Q.setHours(0,te/2)),x.current=!1,Ae(),ue()},we=()=>{for(const Be of P){if(ye.onBuildingEnvelope(Be)||Be.type===z.SolarPanel){const $e=k.current.get(Be.id);$e&&u(Be.id,[...$e]);const wt=q.current.get(Be.id);wt&&l(Be.id,wt.map(vt=>[...vt]))}if(Be.type===z.Roof){for(const $e of k.current.keys())if($e!==Be.id&&$e.startsWith(Be.id)){const wt=k.current.get($e);wt&&u($e,[...wt]);const vt=q.current.get($e);vt&&l($e,vt.map(Rt=>[...Rt]))}}if(Be.type===z.Foundation){let $e=D.current.get(Be.id);$e&&d(Be.id,[...$e]),$e=L.current.get(Be.id),$e&&f(Be.id,[...$e])}}dt.getState().set(Be=>{Be.flagOfDailySimulation=!Be.flagOfDailySimulation,Be.runYearlyThermalSimulation||(Be.showSolarRadiationHeatmap=!0,Be.showHeatFluxes=!0)}),p&&!y&&setTimeout(()=>{e(Be=>{const $e=Cn.getState().totalBuildingHeater,wt=Cn.getState().totalBuildingAc,vt=Cn.getState().totalBuildingSolarPanel;Be.actionInfo={name:"Daily Building Energy Analysis Completed",result:{Heater:$e.toFixed(2),AC:wt.toFixed(2),SolarPanel:vt.toFixed(2),Net:($e+wt-vt).toFixed(2)},timestamp:new Date().getTime()}})},10)},Pe=()=>{if(g&&!H.current){if(Q.getMinutes()+Q.getHours()*60+(ye.dayOfYear(Q)-E.current)*T2+te>T2){Je(),cancelAnimationFrame(w.current),e($e=>{$e.world.date=b.current.toLocaleString("en-US"),$e.viewState.showDailyBuildingEnergyPanel=!0,$e.selectedFloatingWindow="dailyBuildingEnergyPanel"}),dt.getState().set($e=>{$e.runDailyThermalSimulation=!1,$e.simulationPaused=!1,$e.simulationInProgress=!1}),gn(Y.t("message.SimulationCompleted",$)),x.current=!0,we();return}e($e=>{$e.world.date=Q.toLocaleString("en-US")}),Je(),w.current=requestAnimationFrame(Pe),Q.setHours(Q.getHours(),Q.getMinutes()+te)}},[Ie,Me]=m.useState(Q.getMonth());m.useEffect(()=>{setTimeout(()=>{Te()},200)},[Ie]),m.useEffect(()=>{if(y)if(dt.getState().set(Be=>{Be.showSolarRadiationHeatmap=!1,Be.showHeatFluxes=!1}),v&&!ye.hasMovingParts(P))setTimeout(()=>{},50);else return ze(),Me(Q.getMonth()),Te(),w.current=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(w.current),x.current||(gn(Y.t("message.SimulationAborted",$)),e(Be=>{Be.world.date=b.current.toLocaleString("en-US")}),dt.getState().set(Be=>{Be.simulationInProgress=!1,Be.simulationPaused=!1})),H.current=!1}},[y]),m.useEffect(()=>{H.current=S,S?(F.current=new Date(Q.getTime()),cancelAnimationFrame(w.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",$))):(n("simulationPaused",!1),Q.setHours(Q.getHours(),Q.getMinutes()+te),Ne())},[S]);const ze=()=>{H.current?(Q.setTime(F.current.getTime()),H.current=!1):(b.current=new Date(C.date),R.current=0,Q.setMonth(0,22),E.current=ye.dayOfYear(Q),Q.setHours(0,te/2),e(Be=>{Be.viewState.showYearlyBuildingEnergyPanel=!0,Be.selectedFloatingWindow="yearlyBuildingEnergyPanel",Be.world.date=Q.toLocaleString("en-US")})),Ae(),ue(),x.current=!1},Ne=()=>{y&&!H.current&&(Q.getMinutes()+Q.getHours()*60+(ye.dayOfYear(Q)-E.current)*T2{$e.world.date=Q.toLocaleString("en-US")}),Je(),Q.setHours(Q.getHours(),Q.getMinutes()+te),w.current=requestAnimationFrame(Ne)):(we(),R.current++,R.current===oe?(cancelAnimationFrame(w.current),setTimeout(()=>{e($e=>{$e.world.date=b.current.toLocaleString("en-US")})},10),dt.getState().set($e=>{$e.runYearlyThermalSimulation=!1,$e.simulationInProgress=!1,$e.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",$)),x.current=!0,p&&setTimeout(()=>{e($e=>{const wt=Cn.getState().totalBuildingHeater,vt=Cn.getState().totalBuildingAc,Rt=Cn.getState().totalBuildingSolarPanel;$e.actionInfo={name:"Yearly Building Energy Analysis Completed",result:{Heater:wt.toFixed(2),AC:vt.toFixed(2),SolarPanel:Rt.toFixed(2),Net:(wt+vt-Rt).toFixed(2)},timestamp:new Date().getTime()}})},10)):(Q.setMonth(R.current*de,22),Q.setHours(0,te/2),Me(Q.getMonth()),E.current=ye.dayOfYear(Q),Ae(),ue(),w.current=requestAnimationFrame(Ne))))},Je=()=>{ge(Q),V.current=dl(Q,C.latitude);const Be=V.current.daylight()/60;G.current=Be>Et?ie.sunshineHours[Q.getMonth()]/(30*Be*ee):0,O.current=me();for(const $e of P)switch($e.type){case z.Door:{st($e);break}case z.Window:{ke($e),Oe($e);break}case z.Wall:{je($e);break}case z.Roof:{const wt=$e;Ye(wt),xt(wt);break}case z.SolarPanel:{Ee($e);break}}},Ue=(Be,$e)=>{let wt=$e.efficiency;return $e.cellType==="Monocrystalline"&&(wt*=.95),wt*(1+$e.pmaxTC*(Be-25))},nt=()=>{if(!V.current)throw new Error("sun minutes not set");const Be=V.current.daylight()/60;return Be>Et?ie.sunshineHours[Q.getMonth()]/(30*Be*ee):0},We=Be=>{if(!a(Be.pvModelName))throw new Error("PV model not found");return Be.lx*Be.ly*(Be.inverterEfficiency??.95)*(1-Z[Q.getMonth()])},Ee=Be=>{const $e=o(Be);if($e){const wt=r(Be);if(wt){const vt=a(Be.pvModelName);if(O.current&&O.current.z>0){const Rt=ll.computeSolarPanelOutput(Q,C,O.current,vt,Be,wt,$e,se,le),Gt=Ue(U.current,vt)*nt()*We(Be);if(De($e.id,Rt.average*Gt),g){for(let pt=0;pt{var wt;if(Be.interior)return;const $e=o(Be);if($e){const vt=r(Be);if(vt){const Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20,Gt=ye.getWindowArea(Be,Be.parentType===z.Roof?void 0:vt),At=U.current-Rt;Be.empty?Se(Be.id,At*Gt*SO*.001/ee):Se(Be.id,At*Gt*(Be.uValue??X4)*.001/ee)}}},Oe=Be=>{if(Be.interior)return;const $e=o(Be);if($e){const wt=r(Be);if(wt){let vt=0;if(Be.parentType===z.Roof){const Rt=s(wt.id);if(!Rt)return;for(let Gt=0;Gt0){const At=ll.computeRoofWindowSolarRadiationEnergy(Q,C,O.current,Be,wt,$e,se,le);for(let pt=0;pt0){const Rt=ll.computeWallWindowSolarRadiationEnergy(Q,C,O.current,Be,wt,$e,se,le);for(let Gt=0;Gt{var wt;if(Be.interior)return;const $e=o(Be);if($e){const vt=r(Be);if(vt){const Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20,Gt=ye.getDoorArea(Be,vt);if(Be.filled){const At=Z7(Be);let pt=0;if(O.current&&O.current.z>0){const ct=ll.computeDoorSolarRadiationEnergy(Q,C,O.current,Be,vt,$e,se,le);for(let It=0;It{var wt;const $e=o(Be);if($e){const vt=Be.fill!==Fl.Empty&&Be.wallStructure===gc.Default,Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20;if(vt){const Gt=Be.fill===Fl.Partial&&!ye.isPartialWallFull(Be),At=ye.getWallVertices(Be,0),pt=Gt?ye.getPartialWallVertices(Be,0):At,Wt=ye.getPolygonArea(At);let ht=Gt?ye.getPolygonArea(pt):Wt;const ct=i(z.Window,Be.id),It=i(z.Door,Be.id),Ft=Z7(Be);let Ve=0;if(O.current&&O.current.z>0){const at=(Gt?pt.length:At.length)===4,Ge=i(z.SolarPanel,Be.id),yt=ll.computeWallSolarRadiationEnergy(Q,C,O.current,Be,$e,ct,It,Ge,at?0:1,se,le);for(let Pt=0;Pt0)for(const at of ct)ht-=ye.getWindowArea(at,Be);if(It&&It.length>0)for(const at of It)ht-=at.lx*at.lz*Be.lx*Be.lz;const ft=ye.isZero(Ve)||ye.isZero(Ft)?0:Ve*Ft/((Be.volumetricHeatCapacity??.5)*ht*Be.ly);let rt=(U.current+ft-Rt)*ht/(Be.rValue??p6)*.001/ee;Gt&&Be.openToOutside&&(rt+=(U.current-Rt)*(Wt-ht)*SO*.001/ee),Se(Be.id,rt)}else if(Be.openToOutside){const Gt=ye.getWallVertices(Be,0),At=ye.getPolygonArea(Gt),pt=U.current-Rt;Se(Be.id,pt*At*SO*.001/ee)}}},xt=Be=>{var Gt;const $e=o(Be);if(!$e)return;const wt=((Gt=$e.hvacSystem)==null?void 0:Gt.thermostatSetpoint)??20,vt=ye.calculateBuildingArea(Be),Rt=W.current-wt;Se($e.id,Rt*vt/($e.rValue??i8)*.001/ee)},gt=(Be,$e,wt)=>{const vt=1/(Be.rValue??a8),Rt=1/(Be.ceilingRValue??w6);return(vt*$e+Rt*wt)/(vt+Rt)},Ye=Be=>{var Rt;const $e=o(Be);if(!$e)return;const wt=s(Be.id);if(!wt)return;let vt;switch(Be.roofType){case Go.Pyramid:vt=it(Be,wt,$e);break;case Go.Hip:vt=ut(Be,wt,$e);break;case Go.Gable:vt=Ze(Be,wt,$e);break;case Go.Gambrel:vt=Qe(Be,wt,$e);break;case Go.Mansard:vt=lt(Be,wt,$e);break}if(vt){const Gt=((Rt=$e.hvacSystem)==null?void 0:Rt.thermostatSetpoint)??20;let At=0;for(const[pt,Wt]of vt.entries()){const ct=(Wt.surfaceTemperature-(Be.ceiling?gt(Be,Wt.surfaceTemperature,Gt):Gt))*Wt.totalArea/(Be.rValue??a8)*.001/ee;Se(Be.id+"-"+pt,ct),At+=ct}Se(Be.id,At)}},it=(Be,$e,wt)=>{if(Be.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const Ve of $e)for(const ft of Ve)if(Math.abs(ft.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=i(z.Window,Be.id),Wt=[];if(Rt){let Ve=0;for(const ft of $e){const kt=[];for(const rt of ft)kt.push(ye.mapVector3ToPoint2(rt));Ve+=ye.getPolygonArea(kt)}if(pt.length>0){for(const ft of pt)Ve-=ft.lx*ft.lz;Ve<0&&(Ve=0)}Wt.push(Ve)}else for(const Ve of $e){let ft=ye.getTriangleArea(Ve[0],Ve[1],Ve[2]);if(pt.length>0){for(const kt of pt)bn.onSegment(Ve,kt.cx,kt.cy)&&(ft-=kt.lx*kt.lz);ft<0&&(ft=0)}Wt.push(ft)}const ht=Z7(Be),ct=Array(At).fill(0);if(O.current&&O.current.z>0){const Ve=i(z.SolarPanel,Be.id),ft=ll.computePyramidRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,pt,Ve,se,le);for(let kt=0;kt{if(Be.roofType!==Go.Hip)throw new Error("roof is not hip");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const ft of $e)for(const kt of ft)if(Math.abs(kt.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(const ft of $e){let kt=0;if(ft.length===3?kt=ye.getTriangleArea(ft[0],ft[1],ft[2]):ft.length===4&&(kt=ye.getTriangleArea(ft[0],ft[1],ft[2])+ye.getTriangleArea(ft[2],ft[3],ft[0])),Wt.length>0){for(const rt of Wt)bn.onSegment(ft,rt.cx,rt.cy)&&(kt-=rt.lx*rt.lz);kt<0&&(kt=0)}pt.push(kt)}const ht=Rt?[pt.reduce((ft,kt)=>ft+kt,0)]:pt,ct=Z7(Be),It=Array(At).fill(0);if(O.current&&O.current.z>0){const ft=i(z.SolarPanel,Be.id),kt=ll.computeHipRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,ft,se,le);for(let rt=0;rt{if(Be.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const ft of $e)for(const kt of ft)if(Math.abs(kt.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(const ft of $e){let kt=ye.getTriangleArea(ft[0],ft[1],ft[2])+ye.getTriangleArea(ft[2],ft[3],ft[0]);if(Wt.length>0){for(const rt of Wt)bn.onSegment(ft,rt.cx,rt.cy)&&(kt-=rt.lx*rt.lz);kt<0&&(kt=0)}pt.push(kt)}const ht=Rt?[pt.reduce((ft,kt)=>ft+kt,0)]:pt,ct=Z7(Be),It=Array(At).fill(0);if(O.current&&O.current.z>0){const ft=i(z.SolarPanel,Be.id),kt=ll.computeGambrelRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,ft,se,le);for(let rt=0;rt{if(Be.roofType!==Go.Mansard)throw new Error("roof is not mansard");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const at of $e)for(const Ge of at)if(Math.abs(Ge.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(let at=0;at0){for(const Pt of Wt)bn.onSegment(Ge,Pt.cx,Pt.cy)&&(yt-=Pt.lx*Pt.lz);yt<0&&(yt=0)}pt.push(yt)}const ht=$e[vt-1],ct=new Array;for(const at of ht)ct.push({x:at.x,y:at.y});let It=ye.getPolygonArea(ct);if(Wt.length>0){for(let at=Wt.length-1;at>=0;at--){const Ge=Wt[at];bn.onSegment(ht,Ge.cx,Ge.cy)&&(It-=Ge.lx*Ge.lz,Wt.splice(at,1))}It<0&&(It=0)}pt.push(It);const Ft=Rt?[pt.reduce((at,Ge)=>at+Ge,0)]:pt,Ve=Z7(Be),ft=Array(At).fill(0);if(O.current&&O.current.z>0){const at=i(z.SolarPanel,Be.id),Ge=ll.computeMansardRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,at,se,le);for(let yt=0;yt{if(Be.roofType!==Go.Gable)throw new Error("roof is not gable");const vt=$e.length;if(vt===0)return;const Rt=i(z.Window,Be.id),Gt=[];for(const ct of $e){let It=ye.getTriangleArea(ct[0],ct[1],ct[2])+ye.getTriangleArea(ct[2],ct[3],ct[0]);if(Rt.length>0){for(const Ft of Rt)bn.onSegment(ct,Ft.cx,Ft.cy)&&(It-=Ft.lx*Ft.lz);It<0&&(It=0)}Gt.push(It)}const At=Z7(Be),pt=Array(vt).fill(0);if(O.current&&O.current.z>0){const ct=i(z.SolarPanel,Be.id),It=ll.computeGableRoofSolarRadiationEnergy(Q,C,O.current,Be,!0,$e,wt,Rt,ct,se,le);for(let Ft=0;Ft{const e=M.getState().world,n=M.getState().elements,o=M(Gr),r=M(yA),i=Cn(Ige),a=Cn(JBe),l=dt(Lge),s=Cn(Dge),{scene:c}=ri(),u=$t(),d=u1(t),f=new Date(e.date),p=t?d==null?void 0:d.elevation:0,g=60/e.timesPerHour,A=m.useMemo(()=>new l0,[]),y=e.solarRadiationHeatmapGridCellSize??.5,S=m.useRef([]),C=m.useRef([]);m.useEffect(()=>{l&&n&&n.length>0&&(a(),T(),dt.getState().set(B=>{B.runStaticSimulation=!1,B.simulationInProgress=!1,B.showSolarRadiationHeatmap=!0}),gn(Y.t("message.SimulationCompleted",u)))},[l]);const P=(B,O,V)=>{if(S.current.length>1){C.current.length=0,A.set(O,V);const G=S.current.filter(q=>q.uuid!==B);return A.intersectObjects(G,!1,C.current),C.current.length>0}return!1},v=()=>{const B=c.children.filter(O=>O.name==="Content");if(B.length>0){const O=B[0].children;S.current.length=0;for(const V of O)ye.fetchSimulationElements(V,S.current)}},T=()=>{v();for(const B of n)switch(B.type){case z.Foundation:{const O=B;x(O),O.solarStructure===Dn.UpdraftTower&&b(O);break}case z.Cuboid:{w(B);break}case z.SolarPanel:{R(B);break}case z.SolarWaterHeater:{H(B);break}case z.Wall:{F(B);break}case z.Door:{E(B);break}case z.Roof:{const O=B;switch(O.roofType){case Go.Pyramid:N(O);break;case Go.Gable:L(O);break;case Go.Gambrel:W(O);break;case Go.Mansard:U(O);break;case Go.Hip:k(O);break}break}}},w=B=>{const O=f.getFullYear(),V=f.getMonth(),G=f.getDate(),q=ye.dayOfYear(f),$=B.lx,ie=B.ly,Q=B.lz,se=Math.max(2,Math.round($/y)),Z=Math.max(2,Math.round(ie/y)),ee=Math.max(2,Math.round(Q/y)),te=$/se,oe=ie/Z,de=Q/ee,he=o(B);let pe=B.cx,me=B.cy,le=B.cz;if(he&&he.type===z.Cuboid){const ke=ye.getWorldDataById(B.id);pe=ke.pos.x,me=ke.pos.y,le=ke.pos.z}const Te=Array(se).fill(0).map(()=>Array(Z).fill(0)),ge=Array(se).fill(0).map(()=>Array(ee).fill(0)),Se=Array(se).fill(0).map(()=>Array(ee).fill(0));let Re=Array(Z).fill(0).map(()=>Array(ee).fill(0)),De=Array(Z).fill(0).map(()=>Array(ee).fill(0));const Ae=ko,ue=_p.clone().applyAxisAngle(ko,B.rotation[2]),fe=Yc.clone().applyAxisAngle(ko,B.rotation[2]),ve=Vp.clone().applyAxisAngle(ko,B.rotation[2]),we=Op.clone().applyAxisAngle(ko,B.rotation[2]),Pe=new ae;let Ie=0;const Me=new Kt(pe,me),ze=new Kt,Ne=me-ie/2,Je=me+ie/2,Ue=pe-$/2,nt=pe+$/2;for(let ke=0;ke<24;ke++)for(let Oe=0;Oe0){Ie++;const xt=xi(je,q,p,li.SPHERE_MODEL);let gt=qr(e.ground,V,Ae,xt),Ye=Ae.dot(je),it=pe-$/2,ut=me-ie/2;const Qe=le+Q/2;for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,ut+(Ze+.5)*oe),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,Qe),P(B.id,Pe,je)||(Te[lt][Ze]+=Ye*xt));it=pe-$/2,ut=le-Q/2,gt=qr(e.ground,V,ue,xt),Ye=ue.dot(je);for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,Ne),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(ge[lt][Ze]+=Ye*xt));gt=qr(e.ground,V,fe,xt),Ye=fe.dot(je);for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,Je),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(ee-(Ze+.5))*de),P(B.id,Pe,je)||(Se[lt][Ze]+=Ye*xt));it=me-ie/2,ut=le-Q/2,gt=qr(e.ground,V,ve,xt),Ye=ve.dot(je);for(let lt=0;lt0&&(ze.set(Ue,it+(lt+.5)*oe),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(Re[lt][Ze]+=Ye*xt));gt=qr(e.ground,V,we,xt),Ye=we.dot(je);for(let lt=0;lt0&&(ze.set(nt,it+(lt+.5)*oe),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(De[lt][Ze]+=Ye*xt))}}Re=ye.transpose(Re),De=ye.transpose(De);const We=Ie*g/60,Ee=We>Et?d.sunshineHours[V]/(30*We*e.timesPerHour):0;j(Te,Ee),j(ge,Ee),j(Se,Ee),j(Re,Ee),j(De,Ee),i(B.id+"-top",Te),i(B.id+"-south",ge),i(B.id+"-north",Se),i(B.id+"-west",Re),i(B.id+"-east",De)},x=B=>{const O=f.getFullYear(),V=f.getMonth(),G=f.getDate(),q=ye.dayOfYear(f),$=B.lx,ie=B.ly,Q=B.lz,se=Math.max(2,Math.round($/y)),Z=Math.max(2,Math.round(ie/y)),ee=$/se,te=ie/Z,oe=B.cx-$/2,de=B.cy-ie/2,he=new Kt(B.cx,B.cy),pe=new ae,me=Array(se).fill(0).map(()=>Array(Z).fill(0));let le=0;for(let Se=0;Se<24;Se++)for(let Re=0;Re0){le++;const ue=xi(Ae,q,p,li.SPHERE_MODEL),fe=qr(e.ground,V,ko,ue),ve=ko.dot(Ae),we=new Kt;for(let Pe=0;Pe0&&(we.set(oe+(Pe+.5)*ee,de+(Ie+.5)*te),we.rotateAround(he,B.rotation[2]),pe.set(we.x,we.y,Q),P(B.id,pe,Ae)||(me[Pe][Ie]+=ve*ue))}}const Te=le*g/60,ge=Te>Et?d.sunshineHours[V]/(30*Te*e.timesPerHour):0;j(me,ge),i(B.id,me)},b=B=>{const O=B.solarUpdraftTower;if(!O)return;const V=f.getFullYear(),G=f.getMonth(),q=f.getDate(),$=ye.dayOfYear(f),ie=O.collectorRadius,Q=Math.max(2,Math.round(ie*2/y)),se=B.cx-ie+y/2,Z=B.cy-ie+y/2,ee=B.lz+O.collectorHeight,te=Array(Q).fill(0).map(()=>Array(Q).fill(0)),oe=new ae(0,0,ee),de=ie*ie;let he=0,pe,me;for(let ge=0;ge<24;ge++)for(let Se=0;Se0){he++;const Ae=xi(De,$,p,li.SPHERE_MODEL),ue=qr(e.ground,G,ko,Ae),fe=ko.dot(De);for(let ve=0;vede)&&(te[ve][we]+=ue,fe>0&&(P(B.id+"-sut",oe,De)||(te[ve][we]+=fe*Ae)))}}}const le=he*g/60,Te=le>Et?d.sunshineHours[G]/(30*le*e.timesPerHour):0;j(te,Te),i(B.id+"-sut",te)},R=B=>{if(B.trackerType!==Ll.NO_TRACKER)throw new Error("trackers cannot use static simulation");let O=o(B);if(!O)throw new Error("parent of solar panel does not exist");const V=B.parentType===z.Roof,G=B.parentType===z.Wall;if(V&&(O=r(O),!O))throw new Error("foundation of solar panel does not exist");const q=G?ye.absoluteCoordinates(B.cx,B.cy,B.cz,O,r(B),B.lz):ye.absoluteCoordinates(B.cx,B.cy,B.cz,O,void 0,void 0,!0),$=new ae().fromArray(B.normal);G&&$.applyEuler(new ln(0,0,O.relativeAngle));const ie=O.rotation[2];let Q=ie+(G?0:B.relativeAzimuth),se=B.tiltAngle,Z=!0;if(V&&(q.z=B.cz+B.lz+.02+O.cz,ye.isZero(B.rotation[0])?q.z+=B.poleHeight:(se=B.rotation[0],Q=ie,Z=!1)),G&&!ye.isZero(B.tiltAngle)){const Me=O,ze=r(O),Je=(ze?ze.rotation[2]+Me.relativeAngle:Me.relativeAngle)-Qt,Ue=B.ly*Math.abs(Math.sin(B.tiltAngle))/2;q.x+=Ue*Math.cos(Je),q.y+=Ue*Math.sin(Je)}const ee=new ln(V&&!Z?0:se,0,Q,"ZYX");$.applyEuler(ee);const te=f.getFullYear(),oe=f.getMonth(),de=f.getDate(),he=ye.dayOfYear(f),pe=B.lx,me=B.ly,le=Math.max(2,Math.round(B.lx/y)),Te=Math.max(2,Math.round(B.ly/y)),ge=pe/le,Se=me/Te,Re=q.x-(pe-y)/2,De=q.y-(me-y)/2,Ae=V||G?q.z:O.lz+B.poleHeight+B.lz,ue=new Kt(q.x,q.y),fe=new ae,ve=Array(le).fill(0).map(()=>Array(Te).fill(0));let we=0;if(V&&!Z&&(ee.x=B.rotation[0],ee.z=B.rotation[2]+ie),G){const Me=o(B);Me&&(ee.x=Qt+B.tiltAngle,ee.z=O.relativeAngle+Me.rotation[2])}for(let Me=0;Me<24;Me++)for(let ze=0;ze0){we++;const Ue=xi(Je,he,p,li.SPHERE_MODEL),nt=qr(e.ground,oe,$,Ue),We=$.dot(Je),Ee=new Kt,ke=new ae;for(let Oe=0;Oe0&&(Ee.set(Re+Oe*ge,De+st*Se),ke.set(Ee.x-ue.x,Ee.y-ue.y,0),ke.applyEuler(ee),fe.set(q.x+ke.x,q.y+ke.y,Ae+ke.z),P(B.id,fe,Je)||(ve[Oe][st]+=We*Ue))}}const Pe=we*g/60,Ie=Pe>Et?d.sunshineHours[oe]/(30*Pe*e.timesPerHour):0;j(ve,Ie),i(B.id,ve)},H=B=>{const O=o(B);if(!O)throw new Error("parent of solar water heater does not exist");const V=r(O);if(!V)throw new Error("foundation of solar water heater does not exist");const G=ye.absoluteCoordinates(B.cx,B.cy,B.cz,V,void 0,void 0,!0),q=new ln,$=(B.lz-B.waterTankRadius)/2,ie=Math.atan2(B.lz-B.waterTankRadius,B.ly);ye.isZero(B.rotation[0])?(q.set(ie,0,B.relativeAzimuth+V.rotation[2],"ZXY"),G.z+=$):(q.set(B.rotation[0]+ie,0,B.rotation[2]+V.rotation[2],"ZXY"),G.add(new ae(0,0,$).applyEuler(q)));const se=new ae(0,0,1).applyEuler(q),Z=f.getFullYear(),ee=f.getMonth(),te=f.getDate(),oe=ye.dayOfYear(f),de=B.lx,he=Math.hypot(B.ly,B.lz-B.waterTankRadius),pe=Math.max(2,Math.round(B.lx/y)),me=Math.max(2,Math.round(B.ly/y)),le=de/pe,Te=he/me,ge=-(de-y)/2,Se=-(he-y)/2,Re=Array(pe).fill(0).map(()=>Array(me).fill(0));let De=0;for(let fe=0;fe<24;fe++)for(let ve=0;ve0){De++;const Ie=xi(Pe,oe,p,li.SPHERE_MODEL),Me=qr(e.ground,ee,se,Ie),ze=se.dot(Pe),Ne=new Kt,Je=new ae;for(let Ue=0;Ue0&&(Ne.set(ge+Ue*le,Se+nt*Te),Je.set(Ne.x,Ne.y,0).applyEuler(q).add(G),P(B.id,Je,Pe)||(Re[Ue][nt]+=ze*Ie))}}const Ae=De*g/60,ue=Ae>Et?d.sunshineHours[ee]/(30*Ae*e.timesPerHour):0;j(Re,ue),i(B.id,Re)},F=B=>{const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=f.getFullYear(),G=f.getMonth(),q=f.getDate(),$=ye.dayOfYear(f),ie=B.lx,Q=ye.getHighestPointOfWall(B),se=Math.max(2,Math.round(ie/y)),Z=Math.max(2,Math.round(Q/y)),ee=ie/se,te=Q/Z,oe=O.rotation[2]+B.relativeAngle,de=ye.wallAbsolutePosition(new ae(B.cx,B.cy,Q/2),O).setZ(Q/2+O.lz),he=new ae(Math.cos(oe-Qt),Math.sin(oe-Qt),0),pe=new ae,me=Array(se).fill(0).map(()=>Array(Z).fill(0));let le=0;const Te=ee*Math.cos(oe),ge=ee*Math.sin(oe),Se=ye.getWallVertices(B,2),Re=(Q-B.lz)/2;for(let ue=0;ue<24;ue++)for(let fe=0;fe0){le++;const Pe=xi(we,$,p,li.SPHERE_MODEL),Ie=qr(e.ground,G,he,Pe),Me=he.dot(we);for(let ze=0;ze0&&(pe.set(de.x+Je*Te,de.y+Je*ge,de.z+Ue*te),P(B.id,pe,we)||(me[ze][Ne]+=Me*Pe)))}}}const De=le*g/60,Ae=De>Et?d.sunshineHours[G]/(30*De*e.timesPerHour):0;j(me,Ae),i(B.id,me)},E=B=>{const O=r(B);if(!O)throw new Error("foundation of door not found");const V=o(B);if(!V)throw new Error("parent of door not found");const G=V,q=f.getFullYear(),$=f.getMonth(),ie=f.getDate(),Q=ye.dayOfYear(f),se=B.lx*G.lx,Z=B.lz*G.lz,ee=Math.max(2,Math.round(se/y)),te=Math.max(2,Math.round(Z/y)),oe=se/ee,de=Z/te,he=O.rotation[2]+G.relativeAngle,me=ye.wallAbsolutePosition(new ae(G.cx,G.cy,G.cz),O).setZ(G.lz/2+O.lz).clone().add(new ae(B.cx*G.lx,0,B.cz*G.lz)),le=new ae(Math.cos(he-Qt),Math.sin(he-Qt),0),Te=new ae,ge=Array(ee).fill(0).map(()=>Array(te).fill(0));let Se=0;const Re=oe*Math.cos(he),De=oe*Math.sin(he);for(let fe=0;fe<24;fe++)for(let ve=0;ve0){Se++;const Ie=xi(Pe,Q,p,li.SPHERE_MODEL),Me=qr(e.ground,$,le,Ie),ze=le.dot(Pe);if(B.doorType===Rd.Arched)for(let Ne=0;Ne0&&(P(B.id,Te,Pe)||(ge[Ne][Je]+=ze*Ie)))}else for(let Ne=0;Ne0&&(Te.set(me.x+Ue*Re,me.y+Ue*De,me.z+nt*de),P(B.id,Te,Pe)||(ge[Ne][Je]+=ze*Ie))}}}const Ae=Se*g/60,ue=Ae>Et?d.sunshineHours[$]/(30*Ae*e.timesPerHour):0;j(ge,ue),i(B.id,ge)},N=B=>{if(B.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=ye.dayOfYear(f),Z=new ln(0,0,O.rotation[2],"ZYX");for(const[ee,te]of V.entries()){const oe=B.id+"-"+ee,de=te[0].clone().applyEuler(Z),he=te[1].clone().applyEuler(Z),pe=te[2].clone().applyEuler(Z),me=new ae().subVectors(he,de),le=new ae().subVectors(pe,de),Te=new ae().subVectors(pe,he),ge=me.length(),Se=new ae().crossVectors(le,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));me.normalize(),le.normalize(),Te.normalize();const ue=new ae().crossVectors(le,Te).normalize(),fe=me.multiplyScalar(.5*ge/Re),ve=new ae().crossVectors(ue,me).normalize().multiplyScalar(.5*Se/De),we=new ae(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(fe).add(ve),fe.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new ae;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(oe,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(oe,Ae)}}},U=B=>{if(B.roofType!==Go.Mansard)throw new Error("roof is not mansard");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=ye.dayOfYear(f),Z=new ln(0,0,O.rotation[2],"ZYX");for(const[ee,te]of V.entries()){const oe=B.id+"-"+ee;if(ee===V.length-1){let de=Number.MAX_VALUE,he=Number.MAX_VALUE,pe=-Number.MAX_VALUE,me=-Number.MAX_VALUE;for(const Pe of te){const Ie=Pe.clone().applyEuler(Z);Ie.x>pe&&(pe=Ie.x),Ie.xme&&(me=Ie.y),Ie.yArray(ge).fill(0)),Ae=new ae(de+y/2,he+y/2,O.lz+le+k0);let ue=0;const fe=new ae(0,0,Ae.z);for(let Pe=0;Pe<24;Pe++)for(let Ie=0;Ie0){ue++;const Ne=xi(ze,se,p,li.SPHERE_MODEL),Je=qr(e.ground,ie,ko,Ne),Ue=ko.dot(ze);for(let nt=0;nt0&&(fe.y=Ae.y+We*Re,P(oe,fe,ze)||(De[nt][We]+=Ue*Ne))}}}const ve=ue*g/60,we=ve>Et?d.sunshineHours[ie]/(30*ve*e.timesPerHour):0;j(De,we),i(oe,De)}else{const de=te[0].clone().applyEuler(Z),he=te[1].clone().applyEuler(Z),pe=te[2].clone().applyEuler(Z),me=new ae().subVectors(he,de),le=new ae().subVectors(pe,de),Te=new ae().subVectors(pe,he),ge=me.length(),Se=new ae().crossVectors(le,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));me.normalize(),le.normalize(),Te.normalize();const ue=new ae().crossVectors(le,Te).normalize(),fe=me.multiplyScalar(.5*ge/Re),ve=new ae().crossVectors(ue,me).normalize().multiplyScalar(.5*Se/De),we=new ae(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(fe).add(ve),fe.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new ae;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(oe,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(oe,Ae)}}}},W=B=>{if(B.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=ye.dayOfYear(f),Z=new ln(0,0,O.rotation[2],"ZYX");for(const[ee,te]of V.entries()){const oe=B.id+"-"+ee,de=te[0].clone().applyEuler(Z),he=te[1].clone().applyEuler(Z),pe=te[2].clone().applyEuler(Z),me=new ae().subVectors(he,de),le=new ae().subVectors(pe,de),Te=new ae().subVectors(pe,he),ge=me.length(),Se=new ae().crossVectors(le,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));me.normalize(),le.normalize(),Te.normalize();const ue=new ae().crossVectors(le,Te).normalize(),fe=me.multiplyScalar(.5*ge/Re),ve=new ae().crossVectors(ue,me).normalize().multiplyScalar(.5*Se/De),we=new ae(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(fe).add(ve),fe.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new ae;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(oe,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(oe,Ae)}}},k=B=>{if(B.roofType!==Go.Hip)throw new Error("roof is not hip");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=ye.dayOfYear(f),Z=new ln(0,0,O.rotation[2],"ZYX");for(const[ee,te]of V.entries()){const oe=B.id+"-"+ee,de=te[0].clone().applyEuler(Z),he=te[1].clone().applyEuler(Z),pe=te[2].clone().applyEuler(Z),me=new ae().subVectors(he,de),le=new ae().subVectors(pe,de),Te=new ae().subVectors(pe,he),ge=me.length(),Se=new ae().crossVectors(le,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));me.normalize(),le.normalize(),Te.normalize();const ue=new ae().crossVectors(le,Te).normalize(),fe=me.multiplyScalar(.5*ge/Re),ve=new ae().crossVectors(ue,me).normalize().multiplyScalar(.5*Se/De);let we=0;const Pe=new ae,Ie=new ae(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);if(Ie.add(fe).add(ve),fe.multiplyScalar(2),ve.multiplyScalar(2),ee%2===0)for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){we++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Pe.copy(Ie).add(st).add(ve.clone().multiplyScalar(je)),P(oe,Pe,nt)||(Ae[Oe][je]+=ke*We))}}}else for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){we++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Pe.copy(Ie).add(st).add(ve.clone().multiplyScalar(je)),P(oe,Pe,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=we*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(oe,Ae)}}},D=(B,O,V)=>{const G=f.getFullYear(),q=f.getMonth(),$=f.getDate(),ie=ye.dayOfYear(f),Q=new ln(0,0,O.rotation[2],"ZYX"),se=V[0][0].z;let Z=Number.MAX_VALUE,ee=Number.MAX_VALUE,te=-Number.MAX_VALUE,oe=-Number.MAX_VALUE;for(const Ae of V)for(const ue of Ae){const fe=ue.clone().applyEuler(Q);fe.x>te&&(te=fe.x),fe.xoe&&(oe=fe.y),fe.yArray(he).fill(0)),Te=new ae(Z+y/2,ee+y/2,O.lz+se+k0);let ge=0;const Se=new ae(0,0,Te.z);for(let Ae=0;Ae<24;Ae++)for(let ue=0;ue0){ge++;const we=xi(ve,ie,p,li.SPHERE_MODEL),Pe=qr(e.ground,q,ko,we),Ie=ko.dot(ve);for(let Me=0;Me0&&(Se.y=Te.y+ze*me,P(B.id,Se,ve)||(le[Me][ze]+=Ie*we))}}}const Re=ge*g/60,De=Re>Et?d.sunshineHours[q]/(30*Re*e.timesPerHour):0;j(le,De),i(B.id,le)},L=B=>{if(B.roofType!==Go.Gable)throw new Error("roof is not gable");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;const G=f.getFullYear(),q=f.getMonth(),$=f.getDate(),ie=ye.dayOfYear(f),Q=new ln(0,0,O.rotation[2],"ZYX");for(const[se,Z]of V.entries()){const ee=B.id+"-"+se,te=Z[0].clone().applyEuler(Q),oe=Z[1].clone().applyEuler(Q),de=Z[2].clone().applyEuler(Q),he=new ae().subVectors(oe,te),pe=new ae().subVectors(de,te),me=new ae().subVectors(de,oe),le=he.length(),Te=new ae().crossVectors(pe,me).length()/le,ge=Math.max(2,Math.round(le/y)),Se=Math.max(2,Math.round(Te/y)),Re=Array(ge).fill(0).map(()=>Array(Se).fill(0));he.normalize(),pe.normalize(),me.normalize();const De=new ae().crossVectors(pe,me).normalize(),Ae=he.multiplyScalar(.5*le/ge),ue=new ae().crossVectors(De,he).normalize().multiplyScalar(.5*Te/Se),fe=new ae(O.cx+te.x,O.cy+te.y,O.lz+te.z+k0);fe.add(Ae).add(ue),Ae.multiplyScalar(2),ue.multiplyScalar(2);let ve=0;const we=new ae;for(let Me=0;Me<24;Me++)for(let ze=0;ze0){ve++;const Ue=xi(Je,ie,p,li.SPHERE_MODEL),nt=qr(e.ground,q,De,Ue),We=De.dot(Je);for(let Ee=0;Ee0&&(we.copy(fe).add(ke).add(ue.clone().multiplyScalar(Oe)),P(ee,we,Je)||(Re[Ee][Oe]+=We*Ue))}}}const Pe=ve*g/60,Ie=Pe>Et?d.sunshineHours[q]/(30*Pe*e.timesPerHour):0;j(Re,Ie),i(ee,Re)}},j=(B,O)=>{for(let V=0;V{const e=M(pn),n=dt(bh),o=M.getState().world,r=M.getState().elements,i=M(Gr),a=M(yA),l=Cn(Ige),s=Cn(JBe),c=dt(wW),u=dt(Wwt),d=M(xge),f=Cn(Dge),{scene:p}=ri(),g=$t(),A=u1(t),y=new Date(o.date),S=t?A==null?void 0:A.elevation:0,C=60/o.timesPerHour,P=m.useMemo(()=>new l0,[]),v=o.solarRadiationHeatmapGridCellSize??.5,T=m.useRef([]),w=m.useRef([]),x=m.useRef(0),b=m.useRef(!1),R=m.useRef(new Date(o.date)),H=m.useRef(new Map),F=m.useRef(!1),E=m.useRef(new Date(o.date)),N=m.useMemo(()=>dl(y,o.latitude),[o.date,o.latitude]);m.useEffect(()=>{if(c)return U(),x.current=requestAnimationFrame(D),()=>{cancelAnimationFrame(x.current),b.current||(gn(Y.t("message.SimulationAborted",g)),e(le=>{le.world.date=R.current.toLocaleString("en-US")}),n("simulationInProgress",!1))}},[c]),m.useEffect(()=>{F.current=u,u?(E.current=new Date(y.getTime()),cancelAnimationFrame(x.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",g))):(n("simulationPaused",!1),D())},[u]);const U=()=>{n("simulationInProgress",!0),y.setHours(Math.floor(N.sunrise/60),N.sunrise%60),R.current=new Date(o.date),b.current=!1,j();for(const le of r)switch(le.type){case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{H.current.delete(le.id);break}case z.Cuboid:{H.current.delete(le.id+"-top"),H.current.delete(le.id+"-north"),H.current.delete(le.id+"-south"),H.current.delete(le.id+"-west"),H.current.delete(le.id+"-east");break}case z.Roof:{const Te=le,ge=f(Te.id);if(ge){const Se=ge.length;for(let Re=0;Re{s();const le=N.daylight()/60,Te=le>Et?A.sunshineHours[y.getMonth()]/(30*le*o.timesPerHour):0;for(const ge of r){switch(ge.type){case z.Foundation:case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{const Se=H.current.get(ge.id);if(Se){for(let Re=0;Re[...Re]))}break}case z.Cuboid:{k(ge.id,"top",Te),k(ge.id,"south",Te),k(ge.id,"north",Te),k(ge.id,"west",Te),k(ge.id,"east",Te);break}case z.Roof:{const Se=ge,Re=f(Se.id);if(Re&&Re.length>0){if(Se.roofType===Go.Pyramid||Se.roofType===Go.Mansard||Se.roofType===Go.Gambrel||Se.roofType===Go.Hip){let De=!0;const Ae=Re[0][0].z;for(const ue of Re)for(const fe of ue)if(Math.abs(fe.z-Ae)>.01){De=!1;break}if(De){const ue=H.current.get(Se.id);if(ue){for(let fe=0;fe[...fe]))}break}}for(let De=0;De[...fe]))}}}break}}if(ge.type===z.Foundation){const Se=ge;if(Se.solarStructure===Dn.UpdraftTower&&Se.solarUpdraftTower){const Re=ge.id+"-sut",De=H.current.get(Re);if(De){for(let Ae=0;Ae[...Ae]))}}}}},k=(le,Te,ge)=>{const Se=H.current.get(le+"-"+Te);if(Se){for(let Re=0;Re{if(c&&!F.current){if(y.getMinutes()+y.getHours()*60>=N.sunset){cancelAnimationFrame(x.current),dt.getState().set(Te=>{Te.runDynamicSimulation=!1}),e(Te=>{Te.world.date=R.current.toLocaleString("en-US")}),gn(Y.t("message.SimulationCompleted",g)),b.current=!0,W(),setTimeout(()=>{n("simulationInProgress",!1),n("showSolarRadiationHeatmap",!0)},10);return}if(y.setHours(y.getHours(),y.getMinutes()+C),e(Te=>{Te.world.date=y.toLocaleString("en-US")}),d)for(const Te of r)switch(Te.type){case z.FresnelReflector:he(Te);break;case z.Heliostat:pe(Te);break}else for(const Te of r)switch(Te.type){case z.Foundation:{const ge=Te;O(ge),ge.solarStructure===Dn.UpdraftTower&&me(ge);break}case z.Cuboid:{B(Te);break}case z.SolarPanel:{ee(Te);break}case z.SolarWaterHeater:{te(Te);break}case z.ParabolicTrough:{oe(Te);break}case z.ParabolicDish:{de(Te);break}case z.FresnelReflector:{he(Te);break}case z.Heliostat:{pe(Te);break}case z.Wall:{V(Te);break}case z.Door:{G(Te);break}case z.Roof:{const ge=Te;switch(ge.roofType){case Go.Pyramid:$(ge);break;case Go.Gable:Z(ge);break;case Go.Gambrel:Q(ge);break;case Go.Mansard:ie(ge);break;case Go.Hip:se(ge);break}break}}x.current=requestAnimationFrame(D)}},L=(le,Te,ge)=>{if(T.current.length>1){w.current.length=0,P.set(Te,ge);const Se=T.current.filter(Re=>Re.uuid!==le);return P.intersectObjects(Se,!1,w.current),w.current.length>0}return!1},j=()=>{const le=p.children.filter(Te=>Te.name==="Content");if(le.length>0){const Te=le[0].children;T.current.length=0;for(const ge of Te)ye.fetchSimulationElements(ge,T.current)}},B=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=ye.dayOfYear(y),Se=le.lx,Re=le.ly,De=le.lz,Ae=Math.max(2,Math.round(Se/v)),ue=Math.max(2,Math.round(Re/v)),fe=Math.max(2,Math.round(De/v)),ve=Se/Ae,we=Re/ue,Pe=De/fe;let Ie=H.current.get(le.id+"-top");(!Ie||Ie.length!==Ae||Ie[0].length!==ue)&&(Ie=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(le.id+"-top",Ie));let Me=H.current.get(le.id+"-south");(!Me||Me.length!==Ae||Me[0].length!==fe)&&(Me=Array(Ae).fill(0).map(()=>Array(fe).fill(0)),H.current.set(le.id+"-south",Me));let ze=H.current.get(le.id+"-north");(!ze||ze.length!==Ae||ze[0].length!==fe)&&(ze=Array(Ae).fill(0).map(()=>Array(fe).fill(0)),H.current.set(le.id+"-north",ze));let Ne=H.current.get(le.id+"-west");(!Ne||Ne.length!==ue||Ne[0].length!==fe)&&(Ne=Array(ue).fill(0).map(()=>Array(fe).fill(0)),H.current.set(le.id+"-west",Ne));let Je=H.current.get(le.id+"-east");(!Je||Je.length!==ue||Je[0].length!==fe)&&(Je=Array(ue).fill(0).map(()=>Array(fe).fill(0)),H.current.set(le.id+"-east",Je));const Ue=ko,nt=_p.clone().applyAxisAngle(ko,le.rotation[2]),We=Yc.clone().applyAxisAngle(ko,le.rotation[2]),Ee=Vp.clone().applyAxisAngle(ko,le.rotation[2]),ke=Op.clone().applyAxisAngle(ko,le.rotation[2]),Oe=i(le);let st=le.cx,je=le.cy,xt=le.cz;if(Oe&&Oe.type===z.Cuboid){const At=ye.getWorldDataById(le.id);st=At.pos.x,je=At.pos.y,xt=At.pos.z}const gt=new ae,Ye=new Kt(st,je),it=new Kt,ut=je-Re/2,Qe=je+Re/2,lt=st-Se/2,Ze=st+Se/2,Be=xi(Te,ge,S,li.SPHERE_MODEL);let $e=qr(o.ground,y.getMonth(),Ue,Be),wt=Ue.dot(Te),vt=st-Se/2,Rt=je-Re/2;const Gt=xt+De/2;for(let At=0;At0&&(it.set(vt+(At+.5)*ve,Rt+(pt+.5)*we),it.rotateAround(Ye,le.rotation[2]),gt.set(it.x,it.y,Gt),L(le.id,gt,Te)||(Ie[At][pt]+=wt*Be));vt=st-Se/2,Rt=xt-De/2,$e=qr(o.ground,y.getMonth(),nt,Be),wt=nt.dot(Te);for(let At=0;At0&&(it.set(vt+(At+.5)*ve,ut),it.rotateAround(Ye,le.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(le.id,gt,Te)||(Me[At][pt]+=wt*Be));$e=qr(o.ground,y.getMonth(),We,Be),wt=We.dot(Te);for(let At=0;At0&&(it.set(vt+(At+.5)*ve,Qe),it.rotateAround(Ye,le.rotation[2]),gt.set(it.x,it.y,Rt+(fe-(pt+.5))*Pe),L(le.id,gt,Te)||(ze[At][pt]+=wt*Be));vt=je-Re/2,Rt=xt-De/2,$e=qr(o.ground,y.getMonth(),Ee,Be),wt=Ee.dot(Te);for(let At=0;At0&&(it.set(lt,vt+(At+.5)*we),it.rotateAround(Ye,le.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(le.id,gt,Te)||(Ne[At][pt]+=wt*Be));$e=qr(o.ground,y.getMonth(),ke,Be),wt=ke.dot(Te);for(let At=0;At0&&(it.set(Ze,vt+(At+.5)*we),it.rotateAround(Ye,le.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(le.id,gt,Te)||(Je[At][pt]+=wt*Be))},O=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=ye.dayOfYear(y),Se=le.lx,Re=le.ly,De=le.lz,Ae=Math.max(2,Math.round(Se/v)),ue=Math.max(2,Math.round(Re/v)),fe=Se/Ae,ve=Re/ue,we=le.cx-Se/2,Pe=le.cy-Re/2,Ie=new Kt(le.cx,le.cy),Me=new ae;let ze=H.current.get(le.id);(!ze||ze.length!==Ae||ze[0].length!==ue)&&(ze=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(le.id,ze));const Ne=xi(Te,ge,S,li.SPHERE_MODEL),Je=qr(o.ground,y.getMonth(),ko,Ne),Ue=ko.dot(Te),nt=new Kt;for(let We=0;We0&&(nt.set(we+(We+.5)*fe,Pe+(Ee+.5)*ve),nt.rotateAround(Ie,le.rotation[2]),Me.set(nt.x,nt.y,De),L(le.id,Me,Te)||(ze[We][Ee]+=Ue*Ne))},V=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=ye.dayOfYear(y),Re=le.lx,De=ye.getHighestPointOfWall(le),Ae=Math.max(2,Math.round(Re/v)),ue=Math.max(2,Math.round(De/v)),fe=Re/Ae,ve=De/ue,we=ge.rotation[2]+le.relativeAngle,Pe=ye.wallAbsolutePosition(new ae(le.cx,le.cy,le.cz),ge).setZ(De/2+ge.lz),Ie=new ae(Math.cos(we-Qt),Math.sin(we-Qt),0),Me=fe*Math.cos(we),ze=fe*Math.sin(we),Ne=new ae;let Je=H.current.get(le.id);(!Je||Je.length!==Ae||Je[0].length!==ue)&&(Je=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(le.id,Je));const Ue=ye.getWallVertices(le,1),nt=(De-le.lz)/2,We=xi(Te,Se,S,li.SPHERE_MODEL),Ee=qr(o.ground,y.getMonth(),Ie,We),ke=Ie.dot(Te);for(let Oe=0;Oe0&&(Ne.set(Pe.x+je*Me,Pe.y+je*ze,Pe.z+xt*ve),L(le.id,Ne,Te)||(Je[Oe][st]+=ke*We)))}},G=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of door not found");const Se=i(le);if(!Se)throw new Error("parent of door not found");const Re=ye.dayOfYear(y),De=Se,Ae=le.lx*De.lx,ue=le.lz*De.lz,fe=Math.max(2,Math.round(Ae/v)),ve=Math.max(2,Math.round(ue/v)),we=Ae/fe,Pe=ue/ve,Ie=ge.rotation[2]+De.relativeAngle,ze=ye.wallAbsolutePosition(new ae(De.cx,De.cy,De.cz),ge).setZ(De.lz/2+ge.lz).clone().add(new ae(le.cx*De.lx,0,le.cz*De.lz)),Ne=new ae(Math.cos(Ie-Qt),Math.sin(Ie-Qt),0),Je=we*Math.cos(Ie),Ue=we*Math.sin(Ie),nt=new ae;let We=H.current.get(le.id);(!We||We.length!==fe||We[0].length!==ve)&&(We=Array(fe).fill(0).map(()=>Array(ve).fill(0)),H.current.set(le.id,We));const Ee=xi(Te,Re,S,li.SPHERE_MODEL),ke=qr(o.ground,y.getMonth(),Ne,Ee),Oe=Ne.dot(Te);if(le.doorType===Rd.Arched)for(let st=0;st0&&(L(le.id,nt,Te)||(We[st][je]+=Oe*Ee)))}else for(let st=0;st0){const xt=st-fe/2+.5,gt=je-ve/2+.5;nt.set(ze.x+xt*Je,ze.y+xt*Ue,ze.z+gt*Pe),L(le.id,nt,Te)||(We[st][je]+=Oe*Ee)}},q=(le,Te,ge,Se)=>{const Re=Se[0][0].z,De=ye.dayOfYear(y),Ae=xi(le,De,S,li.SPHERE_MODEL),ue=new ln(0,0,ge.rotation[2],"ZYX");let fe=Number.MAX_VALUE,ve=Number.MAX_VALUE,we=-Number.MAX_VALUE,Pe=-Number.MAX_VALUE;for(const ke of Se)for(const Oe of ke){const st=Oe.clone().applyEuler(ue);st.x>we&&(we=st.x),st.xPe&&(Pe=st.y),st.yArray(Me).fill(0)),H.current.set(Te.id,Je));const Ue=new ae(fe+v/2,ve+v/2,ge.lz+Re+k0),nt=new ae(0,0,Ue.z),We=qr(o.ground,y.getMonth(),ko,Ae),Ee=ko.dot(le);for(let ke=0;ke0&&(nt.y=Ue.y+Oe*Ne,L(Te.id,nt,le)||(Je[ke][Oe]+=Ee*Ae))}},$=le=>{if(le.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=f(le.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,le,ge,Se);else{const Ae=ye.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),fe=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=le.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new ae().subVectors(Me,Ie),Je=new ae().subVectors(ze,Ie),Ue=new ae().subVectors(ze,Me),nt=Ne.length(),We=new ae().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new ae().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new ae().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new ae(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new ae,it=qr(o.ground,y.getMonth(),st,fe),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*fe))}}}},ie=le=>{if(le.roofType!==Go.Mansard)throw new Error("roof is not mansard");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=f(le.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,le,ge,Se);else{const Ae=ye.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),fe=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=le.id+"-"+ve;if(ve===Se.length-1){let Ie=Number.MAX_VALUE,Me=Number.MAX_VALUE,ze=-Number.MAX_VALUE,Ne=-Number.MAX_VALUE;for(const gt of we){const Ye=gt.clone().applyEuler(ue);Ye.x>ze&&(ze=Ye.x),Ye.xNe&&(Ne=Ye.y),Ye.yArray(nt).fill(0)),H.current.set(Pe,ke));const Oe=new ae(Ie+v/2,Me+v/2,ge.lz+Je+k0),st=new ae(0,0,Oe.z),je=qr(o.ground,y.getMonth(),ko,fe),xt=ko.dot(Te);for(let gt=0;gt0&&(st.y=Oe.y+Ye*Ee,L(Pe,st,Te)||(ke[gt][Ye]+=xt*fe))}}else{const Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new ae().subVectors(Me,Ie),Je=new ae().subVectors(ze,Ie),Ue=new ae().subVectors(ze,Me),nt=Ne.length(),We=new ae().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new ae().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new ae().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new ae(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new ae,it=qr(o.ground,y.getMonth(),st,fe),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*fe))}}}}},Q=le=>{if(le.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=f(le.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,le,ge,Se);else{const Ae=ye.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),fe=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=le.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new ae().subVectors(Me,Ie),Je=new ae().subVectors(ze,Ie),Ue=new ae().subVectors(ze,Me),nt=Ne.length(),We=new ae().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new ae().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new ae().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new ae(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new ae,it=qr(o.ground,y.getMonth(),st,fe),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*fe))}}}},se=le=>{if(le.roofType!==Go.Hip)throw new Error("roof is not hip");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=f(le.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,le,ge,Se);else{const Ae=ye.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),fe=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=le.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new ae().subVectors(Me,Ie),Je=new ae().subVectors(ze,Ie),Ue=new ae().subVectors(ze,Me),nt=Ne.length(),We=new ae().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new ae().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new ae().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new ae,Ye=new ae(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);Ye.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const it=qr(o.ground,y.getMonth(),st,fe),ut=st.dot(Te);for(let Qe=0;Qe0&&(gt.copy(Ye).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,gt,Te)||(Oe[Qe][Ze]+=ut*fe))}}}},Z=le=>{if(le.roofType!==Go.Gable)throw new Error("roof is not gable");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(le);if(!ge)throw new Error("foundation of wall not found");const Se=f(le.id);if(!Se||Se.length===0)return;const Re=ye.dayOfYear(y),De=new ln(0,0,ge.rotation[2],"ZYX"),Ae=xi(Te,Re,S,li.SPHERE_MODEL);for(const[ue,fe]of Se.entries()){const ve=le.id+"-"+ue,we=fe[0].clone().applyEuler(De),Pe=fe[1].clone().applyEuler(De),Ie=fe[2].clone().applyEuler(De),Me=new ae().subVectors(Pe,we),ze=new ae().subVectors(Ie,we),Ne=new ae().subVectors(Ie,Pe),Je=Me.length(),Ue=new ae().crossVectors(ze,Ne).length()/Je,nt=Math.max(2,Math.round(Je/v)),We=Math.max(2,Math.round(Ue/v));let Ee=H.current.get(ve);(!Ee||Ee.length!==nt||Ee[0].length!==We)&&(Ee=Array(nt).fill(0).map(()=>Array(We).fill(0)),H.current.set(ve,Ee)),Me.normalize(),ze.normalize(),Ne.normalize();const ke=new ae().crossVectors(ze,Ne).normalize(),Oe=Me.multiplyScalar(.5*Je/nt),st=new ae().crossVectors(ke,Me).normalize().multiplyScalar(.5*Ue/We),je=new ae(ge.cx+we.x,ge.cy+we.y,ge.lz+we.z+k0);je.add(Oe).add(st),Oe.multiplyScalar(2),st.multiplyScalar(2);const xt=new ae,gt=qr(o.ground,y.getMonth(),ke,Ae),Ye=ke.dot(Te);for(let it=0;it0&&(xt.copy(je).add(ut).add(st.clone().multiplyScalar(Qe)),L(ve,xt,Te)||(Ee[it][Qe]+=Ye*Ae))}}},ee=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;let ge=i(le);if(!ge)throw new Error("parent of solar panel does not exist");const Se=le.parentType===z.Roof,Re=le.parentType===z.Wall;if(Se&&(ge=a(ge),!ge))throw new Error("foundation of solar panel does not exist");const De=ye.dayOfYear(y),Ae=Re?ye.absoluteCoordinates(le.cx,le.cy,le.cz,ge,a(le),le.lz):ye.absoluteCoordinates(le.cx,le.cy,le.cz,ge,void 0,void 0,!0),ue=ge.rotation[2];let fe=ue+(Re?0:le.relativeAzimuth),ve=le.tiltAngle,we=!0;if(Se&&(Ae.z=le.cz+le.lz+.02+ge.cz,ye.isZero(le.rotation[0])?Ae.z+=le.poleHeight:(ve=le.rotation[0],fe=ue,we=!1)),Re&&!ye.isZero(le.tiltAngle)){const Qe=ge,lt=a(ge),Be=(lt?lt.rotation[2]+Qe.relativeAngle:Qe.relativeAngle)-Qt,$e=le.ly*Math.abs(Math.sin(le.tiltAngle))/2;Ae.x+=$e*Math.cos(Be),Ae.y+=$e*Math.sin(Be)}const Pe=new ae().fromArray(le.normal),Ie=le.lx,Me=le.ly,ze=Math.max(2,Math.round(le.lx/v)),Ne=Math.max(2,Math.round(le.ly/v)),Je=Ie/ze,Ue=Me/Ne,nt=Ae.x-(Ie-v)/2,We=Ae.y-(Me-v)/2,Ee=Se||Re?Ae.z:ge.lz+le.poleHeight+le.lz,ke=new Kt(Ae.x,Ae.y),Oe=new ae;let st=H.current.get(le.id);(!st||st.length!==ze||st[0].length!==Ne)&&(st=Array(ze).fill(0).map(()=>Array(Ne).fill(0)),H.current.set(le.id,st));let je=new ln(Se&&!we?0:ve,0,fe,"ZYX");if(le.trackerType!==Ll.NO_TRACKER){const Qe=ue?Te.clone().applyAxisAngle(ko,-ue):Te.clone();switch(le.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const lt=new Ts().setFromUnitVectors(ko,Qe);je=new ln().setFromQuaternion(lt),je.z+=fe;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const lt=new Ts().setFromUnitVectors(ko,new ae(Qe.x,0,Qe.z).normalize());je=new ln().setFromQuaternion(lt),je.z+=fe;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{if(Math.abs(le.tiltAngle)>.001){const lt=new ae(Qe.x,-Qe.y,0).normalize(),Ze=Math.acos(Yc.dot(lt))*Math.sign(lt.x);je=new ln(le.tiltAngle,0,Ze+ue,"ZYX")}break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}if(Re&&Pe.applyEuler(new ln(0,0,ge.relativeAngle)),Pe.applyEuler(je),Se&&!we&&(je.x=le.rotation[0],je.z=le.rotation[2]+ue),Re){const Qe=i(le);Qe&&(je.x=Qt+le.tiltAngle,je.z=ge.relativeAngle+Qe.rotation[2])}const xt=xi(Te,De,S,li.SPHERE_MODEL),gt=qr(o.ground,y.getMonth(),Pe,xt),Ye=Pe.dot(Te),it=new Kt,ut=new ae;for(let Qe=0;Qe0&&(it.set(nt+Qe*Je,We+lt*Ue),ut.set(it.x-ke.x,it.y-ke.y,0),ut.applyEuler(je),Oe.set(Ae.x+ut.x,Ae.y+ut.y,Ee+ut.z),L(le.id,Oe,Te)||(st[Qe][lt]+=Ye*xt))},te=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(le);if(!ge)throw new Error("parent of solar water heater does not exist");const Se=a(ge);if(!Se)throw new Error("foundation of solar water heater does not exist");const Re=ye.absoluteCoordinates(le.cx,le.cy,le.cz,Se,void 0,void 0,!0),De=new ln,Ae=(le.lz-le.waterTankRadius)/2,ue=Math.atan2(le.lz-le.waterTankRadius,le.ly);ye.isZero(le.rotation[0])?(De.set(ue,0,le.relativeAzimuth+Se.rotation[2],"ZXY"),Re.z+=Ae):(De.set(le.rotation[0]+ue,0,le.rotation[2]+Se.rotation[2],"ZXY"),Re.add(new ae(0,0,Ae).applyEuler(De)));const ve=le.lx,we=Math.hypot(le.ly,le.lz-le.waterTankRadius),Pe=Math.max(2,Math.round(ve/v)),Ie=Math.max(2,Math.round(we/v)),Me=ve/Pe,ze=we/Ie,Ne=-(ve-v)/2,Je=-(we-v)/2;let Ue=H.current.get(le.id);(!Ue||Ue.length!==Pe||Ue[0].length!==Ie)&&(Ue=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(le.id,Ue));const nt=new ae(0,0,1).applyEuler(De),We=xi(Te,ye.dayOfYear(y),S,li.SPHERE_MODEL),Ee=qr(o.ground,y.getMonth(),nt,We),ke=nt.dot(Te),Oe=new Kt,st=new ae;for(let je=0;je0&&(Oe.set(Ne+je*Me,Je+xt*ze),st.set(Oe.x,Oe.y,0).applyEuler(De).add(Re),L(le.id,st,Te)||(Ue[je][xt]+=ke*We))},oe=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(le);if(!ge)throw new Error("parent of parabolic trough does not exist");const Se=ye.dayOfYear(y),Re=ye.absoluteCoordinates(le.cx,le.cy,le.cz,ge),De=new ae().fromArray(le.normal),Ae=De.clone(),ue=le.lx,fe=le.ly,ve=ue*ue/(4*le.latusRectum),we=le.poleHeight+ue/2,Pe=Math.max(2,Math.round(le.lx/v)),Ie=Math.max(2,Math.round(le.ly/v)),Me=ue/Pe,ze=fe/Ie,Ne=Re.x-(ue-v)/2,Je=Re.y-(fe-v)/2,Ue=ge.lz+we+le.lz+ve,nt=new Kt(Re.x,Re.y),We=new ae;let Ee=H.current.get(le.id);(!Ee||Ee.length!==Pe||Ee[0].length!==Ie)&&(Ee=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(le.id,Ee));const ke=ge.rotation[2],Oe=ke+le.relativeAzimuth,st=ye.isZero(Oe),je=st?1:Math.cos(Oe),xt=st?0:Math.sin(Oe),gt=ke?Te.clone().applyAxisAngle(ko,-ke):Te.clone(),Ye=new Ts().setFromUnitVectors(ko,new ae(gt.x*je,gt.x*xt,gt.z).normalize()),it=new ln().setFromQuaternion(Ye);De.copy(Ae.clone().applyEuler(it));const ut=xi(Te,Se,S,li.SPHERE_MODEL),Qe=qr(o.ground,y.getMonth(),De,ut),lt=De.dot(Te),Ze=new Kt,Be=new ae;let $e=0,wt=0,vt=1;const Rt=4/(le.latusRectum*le.latusRectum);for(let Gt=0;Gt0&&(Ze.set($e,Je+At*ze),st||Ze.rotateAround(nt,Oe),Be.set(Ze.x-nt.x,Ze.y-nt.y,0),Be.applyEuler(it),We.set(Re.x+Be.x,Re.y+Be.y,Ue+Be.z),L(le.id,We,Te)||(Ee[Gt][At]+=lt*ut*vt))}},de=le=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(le);if(!ge)throw new Error("parent of parabolic dish does not exist");const Se=ye.dayOfYear(y),Re=ye.absoluteCoordinates(le.cx,le.cy,le.cz,ge),De=new ae().fromArray(le.normal),Ae=De.clone(),ue=le.lx,fe=le.ly,ve=ue*ue/(4*le.latusRectum),we=le.poleHeight+ue/2,Pe=Math.max(2,Math.round(le.lx/v)),Ie=Math.max(2,Math.round(le.ly/v)),Me=ue/Pe,ze=fe/Ie,Ne=Re.x-(ue-v)/2,Je=Re.y-(fe-v)/2,Ue=ge.lz+we+le.lz+ve,nt=new Kt(Re.x,Re.y),We=new ae;let Ee=H.current.get(le.id);(!Ee||Ee.length!==Pe||Ee[0].length!==Ie)&&(Ee=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(le.id,Ee));const ke=ge.rotation[2],Oe=ke+le.relativeAzimuth,st=ye.isZero(Oe),je=ke?Te.clone().applyAxisAngle(ko,-ke):Te.clone(),xt=new Ts().setFromUnitVectors(ko,je),gt=new ln().setFromQuaternion(xt);De.copy(Ae.clone().applyEuler(gt));const Ye=xi(Te,Se,S,li.SPHERE_MODEL),it=qr(o.ground,y.getMonth(),De,Ye),ut=De.dot(Te),Qe=new Kt,lt=new ae;let Ze=0,Be=0,$e=0,wt=0,vt=1;const Rt=4/(le.latusRectum*le.latusRectum);for(let Gt=0;Gtue/2))for(let At=0;Atfe/2)&&(Ee[Gt][At]+=it,ut>0&&(Qe.set(Ze,Be),st||Qe.rotateAround(nt,Oe),lt.set(Qe.x-nt.x,Qe.y-nt.y,0),lt.applyEuler(gt),We.set(Re.x+lt.x,Re.y+lt.y,Ue+lt.z),L(le.id,We,Te)||(vt=1/Math.sqrt(1+($e*$e+wt*wt)*Rt),Ee[Gt][At]+=ut*Ye*vt)))},he=le=>{const Te=ki(y,o.latitude);if(Te.zArray(Me).fill(0)),H.current.set(le.id,ke));const st=ge.rotation[2]+le.relativeAzimuth,je=ye.isZero(st),xt=je?1:Math.cos(st),gt=je?0:Math.sin(st),Ye=Se.solarStructure===Dn.FocusPipe?new ae((Se.cx-Ae.x)*xt,(Se.cy-Ae.y)*gt,Se.cz-Ae.z+Se.lz/2+(Re.absorberHeight??10)):void 0,it=new ae(gt,xt,0),ut=new ae;let Qe,lt;if(Ye){ut.set(Ye.x,Ye.y,Ye.z);const Gt=-Ye.z*(Te.y*it.y+Te.x*it.x)/Te.z;ut.x+=Gt*it.x,ut.y-=Gt*it.y,lt=ut.clone().normalize();let At=lt.add(Te).normalize();ye.isSame(At,ko)&&(At=new ae(-.001,0,1).normalize()),je||At.applyAxisAngle(ko,-st),Qe=new ln(0,Math.atan2(At.x,At.z),st,"ZXY"),ue.copy(fe.clone().applyEuler(Qe))}else lt=new ae(0,0,1),Qe=new ln;const Ze=xi(Te,De,S,li.SPHERE_MODEL),Be=qr(o.ground,y.getMonth(),ue,Ze),$e=ue.dot(Te),wt=new Kt,vt=new ae;let Rt=0;if(d)for(let Gt=0;Gt0&&(wt.set(Rt,Ue+At*Ne),vt.set(wt.x-We.x,wt.y-We.y,0),vt.applyEuler(Qe),Ee.set(Ae.x+vt.x,Ae.y+vt.y,nt+vt.z),!L(le.id,Ee,Te)&&!L(le.id,Ee,lt)&&(ke[Gt][At]+=$e*Ze))}else for(let Gt=0;Gt0&&(wt.set(Rt,Ue+At*Ne),vt.set(wt.x-We.x,wt.y-We.y,0),vt.applyEuler(Qe),Ee.set(Ae.x+vt.x,Ae.y+vt.y,nt+vt.z),L(le.id,Ee,Te)||(ke[Gt][At]+=$e*Ze))}},pe=le=>{const Te=ki(y,o.latitude);if(Te.zArray(Me).fill(0)),H.current.set(le.id,ke));const Oe=ge.rotation[2],st=Se.solarStructure===Dn.FocusTower?new ae(Se.cx-Ae.x,Se.cy-Ae.y,Se.cz-Ae.z+(Re.towerHeight??20)):void 0;let je,xt;if(st){je=st.clone().normalize();let Ze=je.clone().add(Te).normalize();ye.isSame(Ze,ko)&&(Ze=new ae(-.001,0,1).normalize()),Oe&&Ze.applyAxisAngle(ko,-Oe);const Be=Math.hypot(Ze.x,Ze.y);xt=new ln(Math.atan2(Be,Ze.z),0,Math.atan2(Ze.y,Ze.x)+Qt,"ZXY"),ue.copy(fe.clone().applyEuler(xt))}else je=new ae(0,0,1),xt=new ln;const gt=xi(Te,De,S,li.SPHERE_MODEL),Ye=qr(o.ground,y.getMonth(),ue,gt),it=ue.dot(Te),ut=new Kt,Qe=new ae;let lt=0;if(d)for(let Ze=0;Ze0&&(ut.set(lt,Ue+Be*Ne),Qe.set(ut.x-We.x,ut.y-We.y,0),Qe.applyEuler(xt),Ee.set(Ae.x+Qe.x,Ae.y+Qe.y,nt+Qe.z),!L(le.id,Ee,Te)&&!L(le.id,Ee,je)&&(ke[Ze][Be]+=it*gt))}else for(let Ze=0;Ze0&&(ut.set(lt,Ue+Be*Ne),Qe.set(ut.x-We.x,ut.y-We.y,0),Qe.applyEuler(xt),Ee.set(Ae.x+Qe.x,Ae.y+Qe.y,nt+Qe.z),L(le.id,Ee,Te)||(ke[Ze][Be]+=it*gt))}},me=le=>{const Te=le.solarUpdraftTower;if(!Te)return;const ge=ki(y,o.latitude);if(ge.z<=0)return;const Se=ye.dayOfYear(y),Re=new ae().fromArray(le.normal),De=Te.collectorRadius,Ae=Math.max(2,Math.round(De*2/v)),ue=le.cx-De+v/2,fe=le.cy-De+v/2,ve=le.lz+Te.collectorHeight,we=le.id+"-sut";let Pe=H.current.get(we);(!Pe||Pe.length!==Ae||Pe[0].length!==Ae)&&(Pe=Array(Ae).fill(0).map(()=>Array(Ae).fill(0)),H.current.set(we,Pe));const Ie=xi(ge,Se,S,li.SPHERE_MODEL),Me=qr(o.ground,y.getMonth(),Re,Ie),ze=new ae(0,0,ve),Ne=Re.dot(ge),Je=De*De;let Ue,nt;for(let We=0;WeJe)&&(Pe[We][Ee]+=Me,Ne>0&&(L(we,ze,ge)||(Pe[We][Ee]+=Ne*Ie)))}};return h.jsx(h.Fragment,{})}),CBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(pvt),s=M(bW),c=Cn(mvt),u=M(SW),d=M(iOe),f=M(aOe),p=Cn(yvt),g=dt(cvt),A=dt(uvt),y=dt(dvt),S=dt(fvt),C=M(UBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=ye.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),Z())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},Z=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showDailyParabolicTroughYieldPanel=!0,fe.selectedFloatingWindow="dailyParabolicTroughYieldPanel"}),dt.getState().set(fe=>{fe.runDailySimulationForParabolicTroughs=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,ee(),o&&e(fe=>{const ve=Cn.getState().sumDailyParabolicTroughYield();fe.actionInfo={name:"Daily Simulation for Parabolic Troughs Completed",result:{totalYield:ve},details:Cn.getState().dailyParabolicTroughYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(fe=>{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.ParabolicTrough&&me(fe);D.current=requestAnimationFrame(Z)}},ee=()=>{const ue=le();for(const fe of i)if(fe.type===z.ParabolicTrough){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(d){const fe=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.ParabolicTrough){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Trough"+we,ze),Pe.push(Me.label??"Trough"+we);for(let Ne=0;Ne<24;Ne++)fe[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Trough"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const fe=new Array(24).fill(0);for(const we of i)if(we.type===z.ParabolicTrough){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)fe[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:fe[we]});l(ve)}};m.useEffect(()=>{if(A)return oe(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const oe=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.ParabolicTrough&&me(fe);D.current=requestAnimationFrame(de)}else{if(he(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showYearlyParabolicTroughYieldPanel=!0,fe.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"}),dt.getState().set(fe=>{fe.runYearlySimulationForParabolicTroughs=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(fe=>{const ve=Cn.getState().sumYearlyParabolicTroughYield();fe.actionInfo={name:"Yearly Simulation for Parabolic Troughs Completed",result:{totalYield:ve},details:Cn.getState().yearlyParabolicTroughYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},he=()=>{const ue=Te();for(const fe of i)if(fe.type===z.ParabolicTrough){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&ee()},pe=()=>{if(f){const ue=[],fe=[];let ve=0;for(const Pe of i)if(Pe.type===z.ParabolicTrough){const Ie=O.current.get(Pe.id);Ie&&(u(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,fe.push(Pe.label??"Trough"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[fe[Me]]=ze[Pe/F]*Q;we.push(Ie)}c(we),p(fe)}else{const ue=[];for(const ve of i)if(ve.type===z.ParabolicTrough){const we=O.current.get(ve.id);we&&(u(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const fe=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];fe.push({Month:zs[ve],Total:we*Q})}c(fe)}},me=ue=>{const fe=ki(w,r.latitude);if(fe.z0&&(Rt.set(je+Wt*Ee,xt+ht*ke),Ne||Rt.rotateAround(Ye,ze),Gt.set(Rt.x-Ye.x,Rt.y-Ye.y,0),Gt.applyEuler($e),it.set(Pe.x+Gt.x,Pe.y+Gt.y,gt+Gt.z),Se(ue.id,it,fe)||(At+=vt*wt));const pt=B.current.get(ue.id);if(pt){const Wt=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();pt[Wt]+=At/(nt*We)}},le=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>ue.lx*ue.ly*ue.opticalEfficiency*ue.thermalEfficiency*ue.absorptance*ue.reflectance*(1-N[w.getMonth()]),Se=(ue,fe,ve)=>{if(W.current.length>1){k.current.length=0,E.set(fe,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(fe=>fe.name==="Content");if(ue.length>0){const fe=ue[0].children;W.current.length=0;for(const ve of fe)ye.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.ParabolicTrough){const fe=B.current.get(ue.id);fe?fe.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.ParabolicTrough){const fe=O.current.get(ue.id);fe&&fe.length===H?fe.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),RBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Qvt),s=M(bW),c=Cn(ext),u=M(SW),d=M(yOe),f=M(AOe),p=Cn(txt),g=dt(Xvt),A=dt(Jvt),y=dt(Kvt),S=dt(qvt),C=M(jBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=ye.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),Z())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},Z=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showDailyParabolicDishYieldPanel=!0,fe.selectedFloatingWindow="dailyParabolicDishYieldPanel"}),dt.getState().set(fe=>{fe.runDailySimulationForParabolicDishes=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,ee(),o&&e(fe=>{const ve=Cn.getState().sumDailyParabolicDishYield();fe.actionInfo={name:"Daily Simulation for Parabolic Dishes Completed",result:{totalYield:ve},details:Cn.getState().dailyParabolicDishYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(fe=>{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.ParabolicDish&&me(fe);D.current=requestAnimationFrame(Z)}},ee=()=>{const ue=le();for(const fe of i)if(fe.type===z.ParabolicDish){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(d){const fe=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.ParabolicDish){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Dish"+we,ze),Pe.push(Me.label??"Dish"+we);for(let Ne=0;Ne<24;Ne++)fe[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Dish"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const fe=new Array(24).fill(0);for(const we of i)if(we.type===z.ParabolicDish){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)fe[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:fe[we]});l(ve)}};m.useEffect(()=>{if(A)return oe(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const oe=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.ParabolicDish&&me(fe);D.current=requestAnimationFrame(de)}else{if(he(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showYearlyParabolicDishYieldPanel=!0,fe.selectedFloatingWindow="yearlyParabolicDishYieldPanel"}),dt.getState().set(fe=>{fe.runYearlySimulationForParabolicDishes=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(fe=>{const ve=Cn.getState().sumYearlyParabolicDishYield();fe.actionInfo={name:"Yearly Simulation for Parabolic Dishes Completed",result:{totalYield:ve},details:Cn.getState().yearlyParabolicDishYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},he=()=>{const ue=Te();for(const fe of i)if(fe.type===z.ParabolicDish){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&ee()},pe=()=>{if(f){const ue=[],fe=[];let ve=0;for(const Pe of i)if(Pe.type===z.ParabolicDish){const Ie=O.current.get(Pe.id);Ie&&(u(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,fe.push(Pe.label??"Dish"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[fe[Me]]=ze[Pe/F]*Q;we.push(Ie)}c(we),p(fe)}else{const ue=[];for(const ve of i)if(ve.type===z.ParabolicDish){const we=O.current.get(ve.id);we&&(u(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const fe=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];fe.push({Month:zs[ve],Total:we*Q})}c(fe)}},me=ue=>{const fe=ki(w,r.latitude);if(fe.z0&&(wt.set(Oe+At*nt,st+pt*We),ut||wt.rotateAround(xt,it),vt.set(wt.x-xt.x,wt.y-xt.y,0),vt.applyEuler(Ze),gt.set(Pe.x+vt.x,Pe.y+vt.y,je+vt.z),Se(ue.id,gt,fe)||(Rt+=$e*Be));const Gt=B.current.get(ue.id);if(Gt){const At=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();Gt[At]+=Rt/(Je*Ue)}},le=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>ue.lx*ue.ly*ue.opticalEfficiency*ue.thermalEfficiency*ue.absorptance*ue.reflectance*(1-N[w.getMonth()]),Se=(ue,fe,ve)=>{if(W.current.length>1){k.current.length=0,E.set(fe,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(fe=>fe.name==="Content");if(ue.length>0){const fe=ue[0].children;W.current.length=0;for(const ve of fe)ye.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.ParabolicDish){const fe=B.current.get(ue.id);fe?fe.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.ParabolicDish){const fe=O.current.get(ue.id);fe&&fe.length===H?fe.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),HBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Svt),s=M(bW),c=M(sOe),u=Cn(Pvt),d=M(SW),f=M(cOe),p=Cn(Cvt),g=dt(Avt),A=dt(wvt),y=dt(vvt),S=dt(xvt),C=M(BBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=ye.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),Z())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},Z=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showDailyFresnelReflectorYieldPanel=!0,fe.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"}),dt.getState().set(fe=>{fe.runDailySimulationForFresnelReflectors=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,ee(),o&&e(fe=>{const ve=Cn.getState().sumDailyFresnelReflectorYield();fe.actionInfo={name:"Daily Simulation for Fresnel Reflectors Completed",result:{totalYield:ve},details:Cn.getState().dailyFresnelReflectorYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(fe=>{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.FresnelReflector&&me(fe);D.current=requestAnimationFrame(Z)}},ee=()=>{const ue=le();for(const fe of i)if(fe.type===z.FresnelReflector){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(c){const fe=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.FresnelReflector){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Reflector"+we,ze),Pe.push(Me.label??"Reflector"+we);for(let Ne=0;Ne<24;Ne++)fe[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Reflector"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const fe=new Array(24).fill(0);for(const we of i)if(we.type===z.FresnelReflector){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)fe[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:fe[we]});l(ve)}};m.useEffect(()=>{if(A)return oe(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const oe=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.FresnelReflector&&me(fe);D.current=requestAnimationFrame(de)}else{if(he(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showYearlyFresnelReflectorYieldPanel=!0,fe.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"}),dt.getState().set(fe=>{fe.runYearlySimulationForFresnelReflectors=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(fe=>{const ve=Cn.getState().sumYearlyFresnelReflectorYield();fe.actionInfo={name:"Yearly Simulation for Fresnel Reflectors Completed",result:{totalYield:ve},details:Cn.getState().yearlyFresnelReflectorYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},he=()=>{const ue=Te();for(const fe of i)if(fe.type===z.FresnelReflector){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&ee()},pe=()=>{if(f){const ue=[],fe=[];let ve=0;for(const Pe of i)if(Pe.type===z.FresnelReflector){const Ie=O.current.get(Pe.id);Ie&&(d(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,fe.push(Pe.label??"Reflector"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[fe[Me]]=ze[Pe/F]*Q;we.push(Ie)}u(we),p(fe)}else{const ue=[];for(const ve of i)if(ve.type===z.FresnelReflector){const we=O.current.get(ve.id);we&&(d(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const fe=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];fe.push({Month:zs[ve],Total:we*Q})}u(fe)}},me=ue=>{const fe=ki(w,r.latitude);if(fe.z0&&(pt.set(ct,je+Ve*Oe),Wt.set(pt.x-gt.x,pt.y-gt.y,0),Wt.applyEuler(vt),Ye.set(Me.x+Wt.x,Me.y+Wt.y,xt+Wt.z),!Se(ue.id,Ye,fe)&&!Se(ue.id,Ye,Rt)&&(ht+=At*Gt))}const It=B.current.get(ue.id);if(It){const Ft=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();It[Ft]+=ht/(We*Ee)}},le=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>{const fe=a(ue);if(!fe)throw new Error("parent of Fresnel reflector does not exist");let ve=1;if(fe.type===z.Foundation){const Pe=fe.solarAbsorberPipe;ve*=((Pe==null?void 0:Pe.absorberOpticalEfficiency)??.7)*((Pe==null?void 0:Pe.absorberThermalEfficiency)??.3)*((Pe==null?void 0:Pe.absorberAbsorptance)??.95)}return ue.lx*ue.ly*ue.reflectance*ve*(1-N[w.getMonth()])},Se=(ue,fe,ve)=>{if(W.current.length>1){k.current.length=0,E.set(fe,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(fe=>fe.name==="Content");if(ue.length>0){const fe=ue[0].children;W.current.length=0;for(const ve of fe)ye.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.FresnelReflector){const fe=B.current.get(ue.id);fe?fe.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.FresnelReflector){const fe=O.current.get(ue.id);fe&&fe.length===H?fe.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),MBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Dvt),s=M(bW),c=M(dOe),u=Cn(Fvt),d=M(SW),f=M(fOe),p=Cn(kvt),g=dt(Rvt),A=dt(Hvt),y=dt(Mvt),S=dt(Ivt),C=M(YBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=ye.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),Z())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},Z=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showDailyHeliostatYieldPanel=!0,fe.selectedFloatingWindow="dailyHeliostatYieldPanel"}),dt.getState().set(fe=>{fe.runDailySimulationForHeliostats=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,ee(),o&&e(fe=>{const ve=Cn.getState().sumDailyHeliostatYield();fe.actionInfo={name:"Daily Simulation for Heliostats Completed",result:{totalYield:ve},details:Cn.getState().dailyHeliostatYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(fe=>{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.Heliostat&&me(fe);D.current=requestAnimationFrame(Z)}},ee=()=>{const ue=le();for(const fe of i)if(fe.type===z.Heliostat){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(c){const fe=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.Heliostat){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Heliostat"+we,ze),Pe.push(Me.label??"Heliostat"+we);for(let Ne=0;Ne<24;Ne++)fe[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Heliostat"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const fe=new Array(24).fill(0);for(const we of i)if(we.type===z.Heliostat){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)fe[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:fe[we]});l(ve)}};m.useEffect(()=>{if(A)return oe(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const oe=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{fe.world.date=w.toLocaleString("en-US")});for(const fe of i)fe.type===z.Heliostat&&me(fe);D.current=requestAnimationFrame(de)}else{if(he(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(fe=>{fe.world.date=j.current.toLocaleString("en-US"),fe.viewState.showYearlyHeliostatYieldPanel=!0,fe.selectedFloatingWindow="yearlyHeliostatYieldPanel"}),dt.getState().set(fe=>{fe.runYearlySimulationForHeliostats=!1,fe.simulationInProgress=!1,fe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(fe=>{const ve=Cn.getState().sumYearlyHeliostatYield();fe.actionInfo={name:"Yearly Simulation for Heliostats Completed",result:{totalYield:ve},details:Cn.getState().yearlyHeliostatYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},he=()=>{const ue=Te();for(const fe of i)if(fe.type===z.Heliostat){const ve=fe,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&ee()},pe=()=>{if(f){const ue=[],fe=[];let ve=0;for(const Pe of i)if(Pe.type===z.Heliostat){const Ie=O.current.get(Pe.id);Ie&&(d(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,fe.push(Pe.label??"Heliostat"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[fe[Me]]=ze[Pe/F]*Q;we.push(Ie)}u(we),p(fe)}else{const ue=[];for(const ve of i)if(ve.type===z.Heliostat){const we=O.current.get(ve.id);we&&(d(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const fe=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];fe.push({Month:zs[ve],Total:we*Q})}u(fe)}},me=ue=>{const fe=ki(w,r.latitude);if(fe.z0&&($e.set(Rt,je+pt*Oe),wt.set($e.x-gt.x,$e.y-gt.y,0),wt.applyEuler(lt),Ye.set(Me.x+wt.x,Me.y+wt.y,xt+wt.z),!Se(ue.id,Ye,fe)&&!Se(ue.id,Ye,Qe)&&(vt+=Be*Ze))}const Gt=B.current.get(ue.id);if(Gt){const At=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();Gt[At]+=vt/(We*Ee)}},le=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>{const fe=a(ue);if(!fe)throw new Error("parent of heliostat does not exist");let ve=1;if(fe.type===z.Foundation){const Pe=fe.solarPowerTower;ve*=((Pe==null?void 0:Pe.receiverOpticalEfficiency)??.7)*((Pe==null?void 0:Pe.receiverThermalEfficiency)??.3)*((Pe==null?void 0:Pe.receiverAbsorptance)??.95)}return ue.lx*ue.ly*ue.reflectance*ve*(1-N[w.getMonth()])},Se=(ue,fe,ve)=>{if(W.current.length>1){k.current.length=0,E.set(fe,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(fe=>fe.name==="Content");if(ue.length>0){const fe=ue[0].children;W.current.length=0;for(const ve of fe)ye.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.Heliostat){const fe=B.current.get(ue.id);fe?fe.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.Heliostat){const fe=O.current.get(ue.id);fe&&fe.length===H?fe.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),IBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=Cn(Gvt),l=Cn(Bvt),s=Cn(Yvt),c=Cn(_vt),u=dt(pOe),d=dt(Lvt),f=dt(gOe),p=dt(Wvt),g=M(OBe),A=M(XBe),y=M(gW)??900,S=r.sutGridCellSize??1,{scene:C}=ri(),P=$t(),v=u1(t),T=new Date(r.date),w=v?v.elevation:0,x=r.sutTimesPerHour??4,b=60/x,R=r.sutDaysPerYear??6,H=12/R,F=m.useMemo(()=>new l0,[]),E=m.useRef([]),N=m.useRef([]),U=m.useRef(0),W=m.useRef(!1),k=m.useRef(new Date(r.date)),D=m.useRef(new Array(24).fill(0)),L=m.useRef(new Map),j=m.useRef(new Map),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useRef(0),ie=m.useMemo(()=>dl(T,r.latitude),[r.date,r.latitude]),Q=m.useRef(ie),se=ye.daysInYear(T)/12;m.useEffect(()=>{if(u)if(A&&!ye.hasMovingParts(i))Z();else return ee(),U.current=requestAnimationFrame(te),()=>{cancelAnimationFrame(U.current),W.current||(gn(Y.t("message.SimulationAborted",P)),e(we=>{we.world.date=k.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[u]),m.useEffect(()=>{G.current=d,d?(q.current=new Date(T.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",P))):(n("simulationPaused",!1),te())},[d]);const Z=()=>{fe(),ge();for(const we of i)if(we.type===z.Foundation){const Pe=we;Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower&&De(Pe)}e(we=>{we.viewState.showDailyUpdraftTowerYieldPanel=!0,we.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(we=>{we.runDailySimulationForUpdraftTower=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,oe(),o&&e(we=>{const Pe=Cn.getState().sumDailyUpdraftTowerYield();we.actionInfo={name:"Static Daily Simulation for Updraft Tower Completed",result:{totalYield:Pe},details:Cn.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}})},ee=()=>{G.current?(T.setTime(q.current.getTime()),G.current=!1):(k.current=new Date(r.date),$.current=T.getDay(),T.setHours(Math.floor(ie.sunrise/60),-b/2)),W.current=!1,fe(),ge()},te=()=>{if(u&&!G.current){if(T.getMinutes()+T.getHours()*60+(T.getDay()-$.current)*T2+b>=ie.sunset){cancelAnimationFrame(U.current),e(Pe=>{Pe.world.date=k.current.toLocaleString("en-US"),Pe.viewState.showDailyUpdraftTowerYieldPanel=!0,Pe.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Pe=>{Pe.runDailySimulationForUpdraftTower=!1,Pe.simulationInProgress=!1,Pe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,oe(),o&&e(Pe=>{const Ie=Cn.getState().sumDailyUpdraftTowerYield();Pe.actionInfo={name:"Dynamic Daily Simulation for Updraft Tower Completed",result:{totalYield:Ie},details:Cn.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}});return}T.setHours(T.getHours(),T.getMinutes()+b),e(Pe=>{Pe.world.date=T.toLocaleString("en-US")});for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&Re(Ie)}U.current=requestAnimationFrame(te)}},oe=()=>{const we=Ae();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;if(Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower){const Me=Ie.solarUpdraftTower.collectorTransmissivity??.9,ze=Ie.solarUpdraftTower.turbineEfficiency??.3,Ne=Ie.solarUpdraftTower.dischargeCoefficient??.65,Je=Math.PI*Ie.solarUpdraftTower.chimneyRadius*Ie.solarUpdraftTower.chimneyRadius,Ue=Math.PI*Ie.solarUpdraftTower.collectorRadius*Ie.solarUpdraftTower.collectorRadius,nt=mO*zSe*Je,We=2*ISe*Ie.solarUpdraftTower.chimneyHeight,Ee=L.current.get(Pe.id+"-sut"),ke=j.current.get(Pe.id+"-sut"),Oe=B.current.get(Pe.id+"-sut");if(Oe&&Ee&&ke){const st=.5*Ne*ze*mO*Je,je=new Date(r.date);let xt;v&&(xt=rb(je,v.lowestTemperatures,v.highestTemperatures));for(let gt=0;gt0&>>0&&Ee[gt-1]>Ye){const Ze=(Ee[gt-1]+Ye)/2,Be=(r.airConvectiveCoefficient??5)*Ue*(Ze-Ye),$e=Ze+H4,wt=$e*$e*$e*$e,vt=it*it*it*it,Rt=(Ie.solarUpdraftTower.collectorEmissivity??.95)*DSe*Ue*(wt-vt);Oe[gt]-=Be+Rt,Oe[gt]<0&&(Oe[gt]=0)}const ut=Oe[gt]/(nt*it),Qe=it*(1+Math.cbrt(ut*ut/We))-H4,lt=Qe>Ye?Math.sqrt(We*((Qe+H4)/it-1)):0;Oe[gt]=st*lt*lt*lt*.001,Ee[gt]=Qe,ke[gt]=lt}}}}de()},de=()=>{var Ne,Je,Ue;const we=new Map;let Pe=0;const Ie=[];for(const nt of i)if(nt.type===z.Foundation){const We=nt;if(We.solarStructure===Dn.UpdraftTower&&We.solarUpdraftTower){Pe++;const Ee=L.current.get(nt.id+"-sut");Ee&&we.set("Temperature Tower"+Pe,Ee);const ke=j.current.get(nt.id+"-sut");ke&&we.set("Wind Speed Tower"+Pe,ke);const Oe=B.current.get(nt.id+"-sut");Oe&&(we.set("Tower"+Pe,Oe),Ie.push(nt.label?nt.label:"Tower"+Pe))}}const Me=[];for(let nt=0;nt<24;nt++){const We={};We.Hour=nt;for(let Ee=1;Ee<=Pe;Ee++){const ke="Tower"+Ee;We[Ie[Ee-1]]=(Ne=we.get(ke))==null?void 0:Ne[nt]}Me.push(We)}s(Me);const ze=[];for(let nt=0;nt<24;nt++){const We={};We.Hour=nt,We.T_Ambient=D.current[nt];for(let Ee=1;Ee<=Pe;Ee++){let ke="Temperature Tower"+Ee;We["T_"+Ie[Ee-1]]=(Je=we.get(ke))==null?void 0:Je[nt],ke="Wind Speed Tower"+Ee,We["V_"+Ie[Ee-1]]=(Ue=we.get(ke))==null?void 0:Ue[nt]}ze.push(We)}l(ze),a(Ie)};m.useEffect(()=>{if(f)if(A&&!ye.hasMovingParts(i))pe();else return he(),U.current=requestAnimationFrame(me),()=>{cancelAnimationFrame(U.current),W.current||(gn(Y.t("message.SimulationAborted",P)),e(we=>{we.world.date=k.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[f]),m.useEffect(()=>{G.current=p,p?(q.current=new Date(T.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",P))):(n("simulationPaused",!1),me())},[p]);const he=()=>{G.current?(T.setTime(q.current.getTime()),G.current=!1):(k.current=new Date(r.date),V.current=0,T.setMonth(0,22),$.current=T.getDay(),Q.current=dl(T,r.latitude),T.setHours(Math.floor(Q.current.sunrise/60),-b/2),e(we=>{we.world.date=T.toLocaleString("en-US")})),W.current=!1,fe(),ge(),Se()},pe=()=>{fe(),ge(),Se(),k.current=new Date(r.date),V.current=0;for(let we=0;we<12;we+=H){T.setMonth(we,22),Q.current=dl(T,r.latitude),ge();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&De(Ie)}le(),V.current++}e(we=>{we.world.date=k.current.toLocaleString("en-US"),we.viewState.showYearlyUpdraftTowerYieldPanel=!0,we.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(we=>{we.runYearlySimulationForUpdraftTower=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,Te(),o&&e(we=>{const Pe=Cn.getState().sumYearlyUpdraftTowerYield();we.actionInfo={name:"Static Yearly Simulation for Updraft Tower Completed",result:{totalYield:Pe},details:Cn.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}})},me=()=>{if(f&&!G.current)if(T.getMinutes()+T.getHours()*60+(T.getDay()-$.current)*T2+b{Pe.world.date=T.toLocaleString("en-US")});for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&Re(Ie)}U.current=requestAnimationFrame(me)}else{if(le(),V.current++,V.current===R){cancelAnimationFrame(U.current),e(Pe=>{Pe.world.date=k.current.toLocaleString("en-US"),Pe.viewState.showYearlyUpdraftTowerYieldPanel=!0,Pe.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Pe=>{Pe.runYearlySimulationForUpdraftTower=!1,Pe.simulationInProgress=!1,Pe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,Te(),o&&e(Pe=>{const Ie=Cn.getState().sumYearlyUpdraftTowerYield();Pe.actionInfo={name:"Dynamic Yearly Simulation for Updraft Tower Completed",result:{totalYield:Ie},details:Cn.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}});return}T.setMonth(V.current*H,22),$.current=T.getDay(),Q.current=dl(T,r.latitude),T.setHours(Math.floor(Q.current.sunrise/60),-b/2),ge(),U.current=requestAnimationFrame(me)}},le=()=>{const we=ue();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;if(Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower){const Me=B.current.get(Ie.id+"-sut"),ze=L.current.get(Pe.id+"-sut"),Ne=j.current.get(Pe.id+"-sut");if(Me&&ze&&Ne){const Je=Ie.solarUpdraftTower.collectorTransmissivity??.9,Ue=Ie.solarUpdraftTower.turbineEfficiency??.3,nt=Ie.solarUpdraftTower.dischargeCoefficient??.65,We=Math.PI*Ie.solarUpdraftTower.chimneyRadius*Ie.solarUpdraftTower.chimneyRadius,Ee=Math.PI*Ie.solarUpdraftTower.collectorRadius*Ie.solarUpdraftTower.collectorRadius,ke=mO*zSe*We,Oe=2*ISe*Ie.solarUpdraftTower.chimneyHeight,st=.5*nt*Ue*mO*We;let je;v&&(je=rb(T,v.lowestTemperatures,v.highestTemperatures));for(let gt=0;gt0&>>0&&ze[gt-1]>Ye){const Ze=(ze[gt-1]+Ye)/2,Be=(r.airConvectiveCoefficient??5)*Ee*(Ze-Ye),$e=Ze+H4,wt=$e*$e*$e*$e,vt=it*it*it*it,Rt=(Ie.solarUpdraftTower.collectorEmissivity??.95)*DSe*Ee*(wt-vt);Me[gt]-=Be+Rt,Me[gt]<0&&(Me[gt]=0)}const ut=Me[gt]/(ke*it),Qe=it*(1+Math.cbrt(ut*ut/Oe))-H4,lt=Qe>Ye?Math.sqrt(Oe*((Qe+H4)/it-1)):0;Me[gt]=st*lt*lt*lt*.001,ze[gt]=Qe,Ne[gt]=lt}const xt=O.current.get(Ie.id+"-sut");if(xt){const gt=Me.reduce((Ye,it)=>Ye+it,0);xt[V.current]+=gt}}}}g&&de()},Te=()=>{const we=[],Pe=[];let Ie=0;for(const ze of i)if(ze.type===z.Foundation){const Ne=ze;if(Ne.solarStructure===Dn.UpdraftTower&&Ne.solarUpdraftTower){const Je=O.current.get(ze.id+"-sut");Je&&(we.push(Je),Pe.push(ze.label?ze.label:"Tower"+ ++Ie))}}const Me=[];for(let ze=0;ze<12;ze+=H){const Ne={};Ne.Month=zs[ze];for(const[Je,Ue]of we.entries())Ne[Pe[Je]]=Ue[ze/H]*se;Me.push(Ne)}c(Me),a(Pe)},ge=()=>{for(const we of i)if(we.type===z.Foundation){const Pe=we;if(Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower){const Ie=L.current.get(we.id+"-sut");Ie?Ie.fill(0):L.current.set(we.id+"-sut",new Array(24).fill(0));const Me=j.current.get(we.id+"-sut");Me?Me.fill(0):j.current.set(we.id+"-sut",new Array(24).fill(0));const ze=B.current.get(we.id+"-sut");ze?ze.fill(0):B.current.set(we.id+"-sut",new Array(24).fill(0))}}},Se=()=>{for(const we of i)if(we.type===z.Foundation){const Pe=we;if(Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower){const Ie=O.current.get(we.id+"-sut");Ie&&Ie.length===R?Ie.fill(0):O.current.set(we.id+"-sut",new Array(R).fill(0))}}},Re=we=>{const Pe=we.solarUpdraftTower;if(!Pe)return;const Ie=ki(T,r.latitude);if(Ie.zxt)&&(Ye++,gt+=Oe,je>0&&(ve(we.id+"-sut",st,Ie)||(gt+=je*ke)))}Ye&&(gt/=Ye);const Qe=T.getMinutes()>=30?T.getHours()+1===24?0:T.getHours()+1:T.getHours(),lt=Math.PI*Pe.collectorRadius*Pe.collectorRadius;Me[Qe]+=gt*lt}},De=we=>{const Pe=we.solarUpdraftTower;if(!Pe)return;const Ie=B.current.get(we.id+"-sut");if(!Ie)return;const Me=new ae().fromArray(we.normal),ze=T.getFullYear(),Ne=T.getMonth(),Je=T.getDate(),Ue=ye.dayOfYear(T),nt=Pe.collectorRadius,We=Math.max(2,Math.round(nt*2/S)),Ee=we.cx-nt+S/2,ke=we.cy-nt+S/2,Oe=we.lz+Pe.collectorHeight,st=new ae(0,0,Oe),je=nt*nt;let xt=0,gt,Ye;const it=Math.PI*Pe.collectorRadius*Pe.collectorRadius;for(let ut=0;ut<24;ut++){for(let Qe=0;Qe0){const Be=xi(Ze,Ue,w,li.SPHERE_MODEL),$e=qr(r.ground,Ne,ko,Be),wt=Me.dot(Ze);xt=0;for(let vt=0;vtje)&&(xt++,Ie[ut]+=$e,wt>0&&(ve(we.id+"-sut",st,Ze)||(Ie[ut]+=wt*Be)))}}}xt&&(Ie[ut]/=xt),Ie[ut]*=it}},Ae=()=>{const we=ie.daylight()/60;return we>Et?v.sunshineHours[T.getMonth()]/(30*we*x):0},ue=()=>{const we=T.getMonth(),Pe=Q.current.daylight()/60;return Pe>Et?v.sunshineHours[we]/(30*Pe*x):0},fe=()=>{const we=C.children.filter(Pe=>Pe.name==="Content");if(we.length>0){const Pe=we[0].children;E.current.length=0;for(const Ie of Pe)ye.fetchSimulationElements(Ie,E.current)}},ve=(we,Pe,Ie)=>{if(E.current.length>1){N.current.length=0,F.set(Pe,Ie);const Me=E.current.filter(ze=>ze.uuid!==we);return F.intersectObjects(Me,!1,N.current),N.current.length>0}return!1};return h.jsx(h.Fragment,{})});class zBo{constructor(e,n){this.position=e,this.observer=n}}const DBo=be.memo(()=>{const t=M.getState().world,e=M.getState().elements,n=M(pn),o=dt(bh),r=M(Gr),i=M(yA),a=dt(Q7t),{scene:l}=ri(),s=$t(),c=m.useMemo(()=>new l0,[]),u=t.solarPanelVisibilityGridCellSize??.2,d=m.useRef([]),f=m.useRef([]),p=m.useRef([]);m.useEffect(()=>{a&&e&&e.length>0&&(y(),o("runSolarPanelVisibilityAnalysis",!1),n(P=>{P.viewState.showSolarPanelVisibilityResultsPanel=!0,P.selectedFloatingWindow="visibilityResultsPanel"}),gn(Y.t("message.SimulationCompleted",s))),o("simulationInProgress",!1)},[a]);const g=()=>{const P=l.children.filter(v=>v.name==="Content");if(P.length>0){const v=P[0].children;f.current.length=0;for(const T of v)ye.fetchSimulationElements(T,f.current)}},A=()=>{d.current=[];for(const P of e)if(P.type===z.Human){const v=P;if(v.observer){const T=r(v),w=T?ye.absoluteHumanOrTreeCoordinates(v.cx,v.cy,v.cz,T):new ae(v.cx,v.cy,v.cz);w.z+=v.lz,d.current.push(new zBo(w,v))}}},y=()=>{if(Cn.getState().clearSolarPanelVisibilityResults(),A(),d.current.length!==0){g();for(const P of d.current){const v=new Map;for(const T of e)if(T.type===z.SolarPanel){const w=T;v.set(w.parentId,0)}for(const T of e)if(T.type===z.SolarPanel){const w=T;let x=v.get(w.parentId)??0;x+=S(w,P.position)*100,v.set(w.parentId,x)}Cn.getState().setSolarPanelVisibilityResult(P,v)}}},S=(P,v)=>{let T=r(P);if(!T)throw new Error("parent of solar panel does not exist");let w=!1;const x=P.parentType===z.Wall;if(T.type===z.Roof){if(T=i(T),!T)throw new Error("foundation of solar panel does not exist");w=!0}const b=x?ye.absoluteCoordinates(P.cx,P.cy,P.cz,T,i(P),P.lz):ye.absoluteCoordinates(P.cx,P.cy,P.cz,T,void 0,void 0,!0);w&&(b.z=P.cz+T.cz);const R=new ae().fromArray(P.normal);x&&R.applyEuler(new ln(0,0,T.relativeAngle));const H=T.rotation[2]+P.relativeAzimuth;Math.abs(P.tiltAngle)>.001&&R.applyEuler(new ln(P.tiltAngle,0,H,"ZYX"));const F=P.lx,E=P.ly*Math.cos(P.tiltAngle),N=P.ly*Math.abs(Math.sin(P.tiltAngle)),U=Math.max(2,Math.round(P.lx/u)),W=Math.max(2,Math.round(P.ly/u)),k=F/U,D=E/W,L=N/W,j=b.x-F/2,B=b.y-E/2,O=(w?b.z:P.poleHeight+b.z)-N/2,V=new Kt(b.x,b.y);let G=0;const q=new ae,$=new ae;let ie;const Q=new Kt,se=ye.isZero(H);for(let Z=0;Z0&&($.normalize(),C(P.id,q,$)&&(G+=Math.abs($.dot(R))/(ie*ie)));return G*u*u/(4*Math.PI)},C=(P,v,T)=>{if(f.current.length>1){p.current.length=0,c.set(v,T);const w=f.current.filter(x=>x.uuid!==P);if(c.intersectObjects(w,!1,p.current),p.current.length===0)return!0;for(const[x,b]of p.current.entries())if(b.object.name.endsWith("eyeball")&&x===0)return!0;return!1}return!0};return h.jsx(h.Fragment,{})}),EBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=M(yA),s=M(X7t),c=M(K7t),u=Cn(sxt),d=Cn(ixt),f=Cn(lxt),p=dt(vOe),g=dt(nxt),A=dt(xOe),y=dt(oxt),S=M(WBe),C=M(Hge),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=m.useMemo(()=>s(t??"Boston MA, USA"),[t]),b=m.useMemo(()=>c(t??"Boston MA, USA"),[t]),R=t?T==null?void 0:T.elevation:0,H=r.timesPerHour??4,F=60/H,E=m.useMemo(()=>new l0,[]),N=m.useRef([]),U=m.useRef([]),W=m.useRef(0),k=m.useRef(!1),D=m.useRef(new Date(r.date)),L=m.useRef(new Map),j=m.useRef(new Map),B=m.useRef(new Array(12).fill(0)),O=m.useRef(new Array(12).fill(0)),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useRef(0),ie=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),Q=m.useRef(ie);m.useEffect(()=>{if(p)if(C&&!ye.hasMovingParts(i))se();else return Z(),W.current=requestAnimationFrame(ee),()=>{cancelAnimationFrame(W.current),k.current||(gn(Y.t("message.SimulationAborted",v)),e(ve=>{ve.world.date=D.current.toLocaleString("en-US")}),dt.getState().set(ve=>{ve.simulationInProgress=!1,ve.simulationPaused=!1})),G.current=!1}},[p]),m.useEffect(()=>{G.current=g,g?(q.current=new Date(w.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),ee())},[g]);const se=()=>{ue(),Te();for(const ve of i)ve.type===z.Sensor&&Re(ve);e(ve=>{ve.viewState.showDailyLightSensorPanel=!0,ve.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(ve=>{ve.runDailyLightSensor=!1,ve.simulationInProgress=!1,ve.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,te(),o&&e(ve=>{ve.actionInfo={name:"Static Daily Simulation for Sensors Completed",details:Cn.getState().dailyLightSensorData,timestamp:new Date().getTime()}})},Z=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(D.current=new Date(r.date),$.current=w.getDay(),w.setHours(Math.floor(ie.sunrise/60),-F/2)),k.current=!1,ue(),Te()},ee=()=>{if(p&&!G.current){if(w.getMinutes()+w.getHours()*60+(w.getDay()-$.current)*T2+F>=ie.sunset){cancelAnimationFrame(W.current),e(we=>{we.world.date=D.current.toLocaleString("en-US"),we.viewState.showDailyLightSensorPanel=!0,we.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(we=>{we.runDailyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,te(),o&&e(we=>{we.actionInfo={name:"Dynamic Daily Simulation for Sensors Completed",details:Cn.getState().dailyLightSensorData,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+F),e(we=>{we.world.date=w.toLocaleString("en-US")});for(const we of i)we.type===z.Sensor&&Se(we);W.current=requestAnimationFrame(ee)}},te=()=>{const ve=De();for(const we of i)if(we.type===z.Sensor){const Pe=L.current.get(we.id);if(Pe)for(let Ie=0;Ie{var Me;const ve=new Map;let we=0;const Pe=[];for(const ze of i)if(ze.type===z.Sensor){const Ne=L.current.get(ze.id);Ne&&(ve.set("Radiation"+ ++we,Ne),Pe.push(ze.label?ze.label:"Radiation"+we))}const Ie=[];for(let ze=0;ze<24;ze++){const Ne={};Ne.Hour=ze;for(let Je=1;Je<=we;Je++){const Ue="Radiation"+Je;Ne[Pe[Je-1]]=(Me=ve.get(Ue))==null?void 0:Me[ze]}Ie.push(Ne)}d(Ie),u(Pe)};m.useEffect(()=>{if(A)if(C&&!ye.hasMovingParts(i))he();else return de(),W.current=requestAnimationFrame(pe),()=>{cancelAnimationFrame(W.current),k.current||(gn(Y.t("message.SimulationAborted",v)),e(ve=>{ve.world.date=D.current.toLocaleString("en-US")}),dt.getState().set(ve=>{ve.simulationInProgress=!1,ve.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),pe())},[y]);const de=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(D.current=new Date(r.date),V.current=0,w.setMonth(0,22),$.current=w.getDay(),Q.current=dl(w,r.latitude),w.setHours(Math.floor(Q.current.sunrise/60),-F/2),e(ve=>{ve.world.date=w.toLocaleString("en-US")})),k.current=!1,ue(),Te(),ge()},he=()=>{ue(),Te(),ge(),D.current=new Date(r.date),V.current=0;for(let ve=0;ve<12;ve++){w.setMonth(ve,22),Q.current=dl(w,r.latitude),Te();for(const we of i)we.type===z.Sensor&&Re(we);me(),V.current++}e(ve=>{ve.world.date=D.current.toLocaleString("en-US"),ve.viewState.showYearlyLightSensorPanel=!0,ve.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(ve=>{ve.runYearlyLightSensor=!1,ve.simulationInProgress=!1,ve.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,le(),o&&e(ve=>{ve.actionInfo={name:"Static Yearly Simulation for Sensors Completed",details:Cn.getState().yearlyLightSensorData,timestamp:new Date().getTime()}})},pe=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60+(w.getDay()-$.current)*T2+F{we.world.date=w.toLocaleString("en-US")});for(const we of i)we.type===z.Sensor&&Se(we);W.current=requestAnimationFrame(pe)}else{if(me(),V.current++,V.current===12){cancelAnimationFrame(W.current),e(we=>{we.world.date=D.current.toLocaleString("en-US"),we.viewState.showYearlyLightSensorPanel=!0,we.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(we=>{we.runYearlyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,le(),o&&e(we=>{we.actionInfo={name:"Dynamic Yearly Simulation for Sensors Completed",details:Cn.getState().yearlyLightSensorData,timestamp:new Date().getTime()}});return}w.setMonth(V.current,22),$.current=w.getDay(),Q.current=dl(w,r.latitude),w.setHours(Math.floor(Q.current.sunrise/60),-F/2),Te(),W.current=requestAnimationFrame(pe)}},me=()=>{const ve=Ae();for(const we of i)if(we.type===z.Sensor){const Pe=L.current.get(we.id);if(Pe){const Ie=j.current.get(we.id);if(Ie){const Me=Pe.reduce((ze,Ne)=>ze+Ne,0);Ie[V.current]+=Me*ve}}}S&&te()},le=()=>{const ve=[],we=[];let Pe=0,Ie=!1,Me=!1;for(const Ue of i)if(Ue.type===z.Sensor){const nt=j.current.get(Ue.id);nt&&(ve.push(nt),we.push(Ue.label?Ue.label:"Radiation"+ ++Pe),!Ie&&ye.isIdentical(Ue.normal,as)&&(Ie=!0),!Me&&ye.isIdentical(Ue.normal,cAt)&&(Me=!0))}const ze=Ie&&x;ze&&we.push("Measured (Hor.)");const Ne=Me&&b;Ne&&we.push("Measured (Ver.)");const Je=[];for(let Ue=0;Ue<12;Ue++){const nt={};nt.Month=zs[Ue];for(const[We,Ee]of ve.entries())nt.Daylight=B.current[Ue],nt.Clearness=O.current[Ue]*100,ze&&(nt["Measured (Hor.)"]=x.data[Ue]),Ne&&(nt["Measured (Ver.)"]=b.data[Ue]),nt[we[We]]=Ee[Ue];Je.push(nt)}f(Je),u(we)},Te=()=>{for(const ve of i)if(ve.type===z.Sensor){const we=L.current.get(ve.id);we?we.fill(0):L.current.set(ve.id,new Array(24).fill(0))}},ge=()=>{for(const ve of i)if(ve.type===z.Sensor){const we=j.current.get(ve.id);we?we.fill(0):j.current.set(ve.id,new Array(12).fill(0))}},Se=ve=>{const we=ki(w,r.latitude);if(we.z0&&(fe(ve.id,Me,we)||(nt+=Ue*Je));const We=L.current.get(ve.id);if(We){const Ee=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();We[Ee]+=nt}},Re=ve=>{const we=a(ve);if(!we)throw new Error("parent of sensor does not exist");const Pe=L.current.get(ve.id);if(!Pe)return;let Ie=null;we.type===z.Wall&&(Ie=l(ve));const Me=ye.absoluteCoordinates(ve.cx,ve.cy,ve.cz,we,Ie||void 0),ze=new ae().fromArray(ve.normal);ze.applyAxisAngle(ko,we.rotation[2]);const Ne=w.getFullYear(),Je=w.getMonth(),Ue=w.getDate(),nt=ye.dayOfYear(w);for(let We=0;We<24;We++)for(let Ee=0;Ee0){const st=xi(Oe,nt,R,li.SPHERE_MODEL),je=ze.dot(Oe);je>0&&(fe(ve.id,Me,Oe)||(Pe[We]+=je*st)),Pe[We]+=qr(r.ground,Je,ze,st)}}},De=()=>{const ve=ie.daylight()/60;return ve>Et?T.sunshineHours[w.getMonth()]/(30*ve*H):0},Ae=()=>{const ve=w.getMonth(),we=Q.current.daylight()/60;return we>Et?(B.current[ve]=we,O.current[ve]=T.sunshineHours[ve]/(30*we),O.current[ve]/H):(B.current[ve]=0,O.current[ve]=0,0)},ue=()=>{const ve=P.children.filter(we=>we.name==="Content");if(ve.length>0){const we=ve[0].children;N.current.length=0;for(const Pe of we)ye.fetchSimulationElements(Pe,N.current)}},fe=(ve,we,Pe)=>{if(N.current.length>1){U.current.length=0,E.set(we,Pe);const Ie=N.current.filter(Me=>Me.uuid!==ve);return E.intersectObjects(Ie,!1,U.current),U.current.length>0}return!1};return h.jsx(h.Fragment,{})}),jFe=(t,e)=>{let n=e.efficiency;return e.cellType==="Monocrystalline"&&(n*=.95),n*(1+e.pmaxTC*(t-25))},FBo=be.memo(({city:t})=>{const e=M(pn),n=dt(bh),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(t5),l=M(Gr),s=M(yA),c=Cn(ivt),u=M(bW),d=Cn(lvt),f=M(SW),p=M(ZYe),g=M(eOe),A=Cn(svt),y=dt($Ye),S=dt(evt),C=dt(nvt),P=dt(QYe),v=dt(tvt),T=dt(ovt),w=M(NBe),x=M(Mge),b=M(gW)??900,R=dt(n5),{scene:H}=ri(),F=$t(),E=u1(t),N=new Date(r.date),U=t?E==null?void 0:E.elevation:0,W=r.timesPerHour??4,k=60/W,D=r.daysPerYear??6,L=12/D,j=m.useMemo(()=>new l0,[]),B=r.monthlyIrradianceLosses??new Array(12).fill(.05),O=r.pvGridCellSize??.25,V=m.useRef([]),G=m.useRef([]),q=m.useRef(0),$=m.useRef(!1),ie=m.useRef(new Date(r.date)),Q=m.useRef(new Map),se=m.useRef(new Map),Z=m.useRef(0),ee=m.useRef(!1),te=m.useRef(new Date(r.date)),oe=m.useRef(0),de=m.useRef(20),he=m.useMemo(()=>dl(N,r.latitude),[r.date,r.latitude]),pe=m.useRef(he),me=ye.daysInYear(N)/12;m.useEffect(()=>{if(y)if(x&&!ye.hasMovingParts(i))setTimeout(()=>{le(!1)},50);else return Te(),q.current=requestAnimationFrame(ge),()=>{cancelAnimationFrame(q.current),$.current||(gn(Y.t("message.SimulationAborted",F)),e(Ee=>{Ee.world.date=ie.current.toLocaleString("en-US")}),dt.getState().set(Ee=>{Ee.simulationInProgress=!1,Ee.simulationPaused=!1})),ee.current=!1}},[y]),m.useEffect(()=>{S&&x&&!ye.hasMovingParts(i)&&setTimeout(()=>{le(!0)},50)},[S]),m.useEffect(()=>{ee.current=C,C?(te.current=new Date(N.getTime()),cancelAnimationFrame(q.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",F))):(n("simulationPaused",!1),ge())},[C]);const le=Ee=>{We(),Ie();for(const ke of i)ke.type===z.SolarPanel&&we(ke);if(e(ke=>{!R&&!Ee&&(ke.viewState.showDailyPvYieldPanel=!0,ke.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(ke=>{Ee?ke.runDailySimulationForSolarPanelsLastStep=!1:ke.runDailySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,Se(),!R&&!Ee&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumDailyPvYield(),Oe=Cn.getState().getDailyPvProfit(),st=Cn.getState().dailyPvYield;e(je=>{je.actionInfo={name:"Static Daily Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}},Te=()=>{ee.current?(N.setTime(te.current.getTime()),ee.current=!1):(ie.current=new Date(r.date),oe.current=N.getDay(),N.setHours(Math.floor(he.sunrise/60),-k/2)),$.current=!1,We(),Ie()},ge=()=>{if(y&&!ee.current){if(N.getMinutes()+N.getHours()*60+(N.getDay()-oe.current)*T2+k>=he.sunset){if(cancelAnimationFrame(q.current),e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),R||(ke.viewState.showDailyPvYieldPanel=!0,ke.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(ke=>{ke.runDailySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,Se(),!R&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumDailyPvYield(),Oe=Cn.getState().getDailyPvProfit(),st=Cn.getState().dailyPvYield;e(je=>{je.actionInfo={name:"Dynamic Daily Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}return}N.setHours(N.getHours(),N.getMinutes()+k),e(ke=>{ke.world.date=N.toLocaleString("en-US")});for(const ke of i)ke.type===z.SolarPanel&&Pe(ke);q.current=requestAnimationFrame(ge)}},Se=()=>{const Ee=ze();for(const ke of i)if(ke.type===z.SolarPanel){const Oe=ke,st=Q.current.get(ke.id);if(st){const je=Je(Oe)*Ee;for(let xt=0;xt{var Ee;if(p){const ke=new Array(24).fill(0),Oe=new Map;let st=0;const je=[];for(const gt of i)if(gt.type===z.SolarPanel){const Ye=Q.current.get(gt.id);if(Ye){u(gt.id,Ye.reduce((it,ut)=>it+ut,0)),st++,Oe.set("Panel"+st,Ye),je.push(gt.label?gt.label:"Panel"+st);for(let it=0;it<24;it++)ke[it]+=Ye[it]}}const xt=[];for(let gt=0;gt<24;gt++){const Ye={};Ye.Hour=gt;for(let it=1;it<=st;it++){const ut="Panel"+it;Ye[je[it-1]]=(Ee=Oe.get(ut))==null?void 0:Ee[gt]}xt.push(Ye)}c(xt),A(je)}else{const ke=new Array(24).fill(0);for(const st of i)if(st.type===z.SolarPanel){const je=Q.current.get(st.id);if(je){u(st.id,je.reduce((xt,gt)=>xt+gt,0));for(let xt=0;xt<24;xt++)ke[xt]+=je[xt]}}const Oe=[];for(let st=0;st<24;st++)Oe.push({Hour:st,Total:ke[st]});c(Oe)}};m.useEffect(()=>{if(P)if(x&&!ye.hasMovingParts(i))setTimeout(()=>{Ae(!1)},50);else return De(),q.current=requestAnimationFrame(ue),()=>{cancelAnimationFrame(q.current),$.current||(gn(Y.t("message.SimulationAborted",F)),e(Ee=>{Ee.world.date=ie.current.toLocaleString("en-US")}),dt.getState().set(Ee=>{Ee.simulationInProgress=!1,Ee.simulationPaused=!1})),ee.current=!1}},[P]),m.useEffect(()=>{v&&x&&!ye.hasMovingParts(i)&&setTimeout(()=>{Ae(!0)},50)},[v]),m.useEffect(()=>{ee.current=T,T?(te.current=new Date(N.getTime()),cancelAnimationFrame(q.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",F))):(n("simulationPaused",!1),ue())},[T]);const De=()=>{ee.current?(N.setTime(te.current.getTime()),ee.current=!1):(ie.current=new Date(r.date),Z.current=0,N.setMonth(0,22),oe.current=N.getDay(),pe.current=dl(N,r.latitude),N.setHours(Math.floor(pe.current.sunrise/60),-k/2),e(Ee=>{Ee.world.date=N.toLocaleString("en-US")})),$.current=!1,We(),Ie(),Me()},Ae=Ee=>{We(),Ie(),Me(),ie.current=new Date(r.date),Z.current=0;for(let ke=0;ke<12;ke+=L){N.setMonth(ke,22),pe.current=dl(N,r.latitude),Ie();for(const Oe of i)Oe.type===z.SolarPanel&&we(Oe);fe(),Z.current++}if(e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),!R&&!Ee&&(ke.viewState.showYearlyPvYieldPanel=!0,ke.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(ke=>{Ee?ke.runYearlySimulationForSolarPanelsLastStep=!1:ke.runYearlySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,ve(),!R&&!Ee&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumYearlyPvYield(),Oe=Cn.getState().getYearlyPvProfit(),st=Cn.getState().yearlyPvYield;e(je=>{je.actionInfo={name:"Static Yearly Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}},ue=()=>{if(P&&!ee.current)if(N.getMinutes()+N.getHours()*60+(N.getDay()-oe.current)*T2+k{ke.world.date=N.toLocaleString("en-US")});for(const ke of i)ke.type===z.SolarPanel&&Pe(ke);q.current=requestAnimationFrame(ue)}else{if(fe(),Z.current++,Z.current===D){if(cancelAnimationFrame(q.current),e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),R||(ke.viewState.showYearlyPvYieldPanel=!0,ke.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(ke=>{ke.runYearlySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,ve(),!R&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumYearlyPvYield(),Oe=Cn.getState().getYearlyPvProfit(),st=Cn.getState().yearlyPvYield;e(je=>{je.actionInfo={name:"Dynamic Yearly Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}return}N.setMonth(Z.current*L,22),oe.current=N.getDay(),pe.current=dl(N,r.latitude),N.setHours(Math.floor(pe.current.sunrise/60),-k/2),Ie(),q.current=requestAnimationFrame(ue)}},fe=()=>{const Ee=Ne();for(const ke of i)if(ke.type===z.SolarPanel){const Oe=ke,st=Q.current.get(ke.id);if(st){const je=se.current.get(ke.id);if(je){const xt=st.reduce((gt,Ye)=>gt+Ye,0);je[Z.current]+=xt*Ee*Je(Oe)}}}!R&&w&&Se()},ve=()=>{if(g){const Ee=[],ke=[];let Oe=0;for(const je of i)if(je.type===z.SolarPanel){const xt=se.current.get(je.id);xt&&(f(je.id,xt.reduce((gt,Ye)=>gt+Ye,0)*L*me),Ee.push(xt),Oe++,ke.push(je.label??"Panel"+Oe))}const st=[];for(let je=0;je<12;je+=L){const xt={};xt.Month=zs[je];for(const[gt,Ye]of Ee.entries())xt[ke[gt]]=Ye[je/L]*me;st.push(xt)}d(st),A(ke)}else{const Ee=[];for(const Oe of i)if(Oe.type===z.SolarPanel){const st=se.current.get(Oe.id);st&&(f(Oe.id,st.reduce((je,xt)=>je+xt,0)*L*me),Ee.push(st))}const ke=[];for(let Oe=0;Oe<12;Oe+=L){let st=0;for(const je of Ee)st+=je[Oe/L];ke.push({Month:zs[Oe],Total:st*me})}d(ke)}},we=Ee=>{if(Ee.trackerType!==Ll.NO_TRACKER)throw new Error("static simulation is not for solar panel with tracker");let ke=l(Ee);if(!ke)throw new Error("parent of solar panel does not exist");const Oe=Ee.parentType===z.Roof,st=Ee.parentType===z.Wall;if(Oe&&(ke=s(ke),!ke))throw new Error("foundation of solar panel does not exist");const je=a(Ee.pvModelName);if(!je)throw new Error("PV model not found");const xt=Q.current.get(Ee.id);if(!xt)return;const gt=st?ye.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,s(Ee),Ee.lz):ye.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,void 0,void 0,!0),Ye=ke.rotation[2];let it=Ye+Ee.relativeAzimuth,ut=Ee.tiltAngle,Qe=!0;if(Oe&&(gt.z=Ee.cz+Ee.lz+.02+ke.cz,ye.isZero(Ee.rotation[0])?gt.z+=Ee.poleHeight:(ut=Ee.rotation[0],it=Ye,Qe=!1)),st&&!ye.isZero(Ee.tiltAngle)){const at=ke,Ge=s(ke),Pt=(Ge?Ge.rotation[2]+at.relativeAngle:at.relativeAngle)-Qt,ot=Ee.ly*Math.abs(Math.sin(Ee.tiltAngle))/2;gt.x+=ot*Math.cos(Pt),gt.y+=ot*Math.sin(Pt)}const lt=new ae().fromArray(Ee.normal),Ze=new ln(Oe&&!Qe?0:ut,0,it,"ZYX");lt.applyEuler(Ze);const Be=N.getFullYear(),$e=N.getMonth(),wt=N.getDate(),vt=ye.dayOfYear(N);let Rt,Gt,At,pt,Wt;r.discretization===Em.EXACT?(Rt=Ee.lx,Gt=Ee.ly,Ee.orientation===vr.portrait?(At=Math.max(1,Math.round(Ee.lx/je.width)),pt=Math.max(1,Math.round(Ee.ly/je.length)),At*=je.n,pt*=je.m):(At=Math.max(1,Math.round(Ee.lx/je.length)),pt=Math.max(1,Math.round(Ee.ly/je.width)),At*=je.m,pt*=je.n),Wt=Ee.lx/At):(Rt=Ee.lx,Gt=Ee.ly,At=Math.max(2,Math.round(Ee.lx/O)),pt=Math.max(2,Math.round(Ee.ly/O)),At%2!==0&&(At+=1),pt%2!==0&&(pt+=1),Wt=O);const ht=Rt/At,ct=Gt/pt,It=gt.x-(Rt-Wt)/2,Ft=gt.y-(Gt-Wt)/2,Ve=Oe||st?gt.z:ke.lz+Ee.poleHeight+Ee.lz,ft=new Kt(gt.x,gt.y),kt=new ae,rt=Array.from(Array(At),()=>new Array(pt));Oe&&!Qe&&(Ze.x=Ee.rotation[0],Ze.z=Ee.rotation[2]+Ye),st&&(Ze.x=Qt+Ee.tiltAngle,Ze.z=ke.relativeAngle+Ye);for(let at=0;at<24;at++)for(let Ge=0;Ge0){const ot=xi(Pt,vt,U,li.SPHERE_MODEL),bt=qr(r.ground,$e,lt,ot),zt=lt.dot(Pt),Bt=new Kt,tt=new ae;if(je.bifacialityFactor>0){const qt=lt.clone().negate(),un=qr(r.ground,$e,qt,ot),Rn=bt+un*je.bifacialityFactor;for(let yo=0;yo0?zt:-zt*je.bifacialityFactor)*ot)}else for(let qt=0;qt0&&(Bt.set(It+qt*ht,Ft+un*ct),tt.set(Bt.x-ft.x,Bt.y-ft.y,0),tt.applyEuler(Ze),kt.set(gt.x+tt.x,gt.y+tt.y,Ve+tt.z),nt(Ee.id,kt,Pt)||(rt[qt][un]+=zt*ot));let Ht=0;Ue(yt);const _t=jFe(de.current,je);switch(je.shadeTolerance){case m8.NONE:{let qt=Number.MAX_VALUE;for(let un=0;un{let ke=l(Ee);if(!ke)throw new Error("parent of solar panel does not exist");const Oe=Ee.parentType===z.Roof,st=Ee.parentType===z.Wall;if(Oe&&(ke=s(ke),!ke))throw new Error("foundation of solar panel does not exist");const je=a(Ee.pvModelName);if(!je)throw new Error("PV model not found");const xt=ki(N,r.latitude);if(xt.z<=0)return;const gt=st?ye.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,s(Ee),Ee.lz):ye.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,void 0,void 0,!0),Ye=ke.rotation[2];let it=Ee.tiltAngle,ut=Ye+(st?0:Ee.relativeAzimuth),Qe=!0;if(Oe&&(gt.z=Ee.cz+Ee.lz+.02+ke.cz,ye.isZero(Ee.rotation[0])?gt.z+=Ee.poleHeight:(it=Ee.rotation[0],ut=Ye,Qe=!1)),st&&!ye.isZero(Ee.tiltAngle)){const bt=ke,zt=s(ke),tt=(zt?zt.rotation[2]+bt.relativeAngle:bt.relativeAngle)-Qt,Ht=Ee.ly*Math.abs(Math.sin(Ee.tiltAngle))/2;gt.x+=Ht*Math.cos(tt),gt.y+=Ht*Math.sin(tt)}const lt=new ae().fromArray(Ee.normal),Ze=N.getMonth(),Be=ye.dayOfYear(N);let $e,wt,vt,Rt,Gt;r.discretization===Em.EXACT?($e=Ee.lx,wt=Ee.ly,Ee.orientation===vr.portrait?(vt=Math.max(1,Math.round(Ee.lx/je.width)),Rt=Math.max(1,Math.round(Ee.ly/je.length)),vt*=je.n,Rt*=je.m):(vt=Math.max(1,Math.round(Ee.lx/je.length)),Rt=Math.max(1,Math.round(Ee.ly/je.width)),vt*=je.m,Rt*=je.n),Gt=Ee.lx/vt):($e=Ee.lx,wt=Ee.ly,vt=Math.max(2,Math.round(Ee.lx/O)),Rt=Math.max(2,Math.round(Ee.ly/O)),vt%2!==0&&(vt+=1),Rt%2!==0&&(Rt+=1),Gt=O);const At=$e/vt,pt=wt/Rt,Wt=gt.x-($e-Gt)/2,ht=gt.y-(wt-Gt)/2,ct=Oe||st?gt.z:ke.lz+Ee.poleHeight+Ee.lz,It=new Kt(gt.x,gt.y),Ft=new ae,Ve=Array.from(Array(vt),()=>new Array(Rt));let ft=new ln(Oe&&!Qe?0:it,0,ut,"ZYX");if(Ee.trackerType!==Ll.NO_TRACKER){const bt=Ye?xt.clone().applyAxisAngle(ko,-Ye):xt.clone();switch(Ee.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const zt=new Ts().setFromUnitVectors(ko,bt);ft=new ln().setFromQuaternion(zt),ft.z+=ut;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const zt=new Ts().setFromUnitVectors(ko,new ae(bt.x,0,bt.z).normalize());ft=new ln().setFromQuaternion(zt),ft.z+=ut;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{const zt=new ae(bt.x,-bt.y,0).normalize(),Bt=Math.acos(Yc.dot(zt))*Math.sign(zt.x);ft=new ln(Ee.tiltAngle,0,Bt+Ye,"ZYX");break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}if(st&<.applyEuler(new ln(0,0,ke.relativeAngle)),lt.applyEuler(ft),Oe&&!Qe&&(ft.x=Ee.rotation[0],ft.z=Ee.rotation[2]+Ye),st){const bt=l(Ee);bt&&(ft.x=Qt+Ee.tiltAngle,ft.z=ke.relativeAngle+bt.rotation[2])}const kt=xi(xt,Be,U,li.SPHERE_MODEL),rt=qr(r.ground,Ze,lt,kt),at=lt.dot(xt),Ge=new Kt,yt=new ae;if(je.bifacialityFactor>0){const bt=lt.clone().negate(),zt=qr(r.ground,Ze,bt,kt),Bt=rt+zt*je.bifacialityFactor;for(let tt=0;tt0?at:-at*je.bifacialityFactor)*kt)}else for(let bt=0;bt0&&(Ge.set(Wt+bt*At,ht+zt*pt),yt.set(Ge.x-It.x,Ge.y-It.y,0),yt.applyEuler(ft),Ft.set(gt.x+yt.x,gt.y+yt.y,ct+yt.z),nt(Ee.id,Ft,xt)||(Ve[bt][zt]+=at*kt));let Pt=0;switch(je.shadeTolerance){case m8.NONE:{let bt=Number.MAX_VALUE;for(let zt=0;zt=30?N.getHours()+1===24?0:N.getHours()+1:N.getHours();ot[zt]+=bt*Pt/(vt*Rt)}},Ie=()=>{for(const Ee of i)if(Ee.type===z.SolarPanel){const ke=Q.current.get(Ee.id);ke?ke.fill(0):Q.current.set(Ee.id,new Array(24).fill(0))}},Me=()=>{for(const Ee of i)if(Ee.type===z.SolarPanel){const ke=se.current.get(Ee.id);ke&&ke.length===D?ke.fill(0):se.current.set(Ee.id,new Array(D).fill(0))}},ze=()=>{const Ee=he.daylight()/60;return Ee>Et?E.sunshineHours[N.getMonth()]/(30*Ee*W):0},Ne=()=>{const Ee=pe.current.daylight()/60;return Ee>Et?E.sunshineHours[N.getMonth()]/(30*Ee*W):0},Je=Ee=>{if(!a(Ee.pvModelName))throw new Error("PV model not found");return Ee.lx*Ee.ly*(Ee.inverterEfficiency??.95)*(1-B[N.getMonth()])},Ue=Ee=>{if(E){const ke=rb(Ee,E.lowestTemperatures,E.highestTemperatures);de.current=ob(ke.high,ke.low,r.diurnalTemperatureModel,b,dl(Ee,r.latitude),ye.minutesIntoDay(Ee))}},nt=(Ee,ke,Oe)=>{if(V.current.length>1){G.current.length=0,j.set(ke,Oe);const st=V.current.filter(je=>je.uuid!==Ee);return j.intersectObjects(st,!1,G.current),G.current.length>0}return!1},We=()=>{const Ee=H.children.filter(ke=>ke.name==="Content");if(Ee.length>0){const ke=Ee[0].children;V.current.length=0;for(const Oe of ke)ye.fetchSimulationElements(Oe,V.current)}};return h.jsx(h.Fragment,{})}),kBo=be.memo(()=>{const t=M(s0),e=M(Mb),n=M(qYe),o=M(KYe),r=M(Jge),[i,a]=m.useState("Boston MA, USA");return m.useEffect(()=>{if(Object.keys(r).length===0)return;const l=n(t,e)??"Boston MA, USA";a(l),o(l)},[t,e,r]),h.jsxs(h.Fragment,{children:[h.jsx(SBo,{city:i}),h.jsx(TBo,{city:i}),h.jsx(PBo,{city:i}),h.jsx(EBo,{city:i}),h.jsx(FBo,{city:i}),h.jsx(DBo,{}),h.jsx(CBo,{city:i}),h.jsx(RBo,{city:i}),h.jsx(HBo,{city:i}),h.jsx(MBo,{city:i}),h.jsx(IBo,{city:i})]})}),pV="/aladdin/assets/image_fail_try_again-CaxVXMjm.png";var XL=(t=>(t[t.None=0]="None",t[t.Equal=1]="Equal",t[t.LessThan=2]="LessThan",t[t.GreaterThan=3]="GreaterThan",t[t.Between=4]="Between",t))(XL||{});const LBo=5,WBo=be.memo(({yScale:t,tickLength:e,tickIntegers:n,variable:o,name:r,unit:i,type:a,digits:l,min:s,max:c,step:u,value:d,filter:f,hover:p})=>{const g=M(pn),A=M(yp),y=M(En),S=M(m0),C=M(XYe),P=M(Xge),v=M(JYe),T=M(oa),[w,x]=m.useState(!1),b=m.useRef(s),R=m.useRef(c);m.useEffect(()=>{b.current=s},[s]),m.useEffect(()=>{R.current=c},[c]);const H={lng:S},F=A.uid===C,E=t.range(),N=t(s)-t(c),U=40,W=m.useMemo(()=>{const Z=E[0]-E[1],ee=a==="number"?Math.floor(Z/e):1;return(n?t.ticks(ee).filter(oe=>Number.isInteger(oe)):t.ticks(ee)).map(oe=>({value:oe,yOffset:t(oe)}))},[t,e,a,n,E]),k=()=>{g(Z=>{Z.projectState.selectedProperty=Z.projectState.selectedProperty!==o?o:null,T&&(Z.actionInfo={name:"Select Property",timestamp:new Date().getTime(),details:Z.projectState.selectedProperty})}),dt.getState().set(Z=>{Z.updateProjectsFlag=!0})},D=()=>{F&&C&&P?KGn(C,P,v!==o?o:null).then(()=>{k()}):k()},L=(Z,ee)=>h.jsx("span",{style:{display:"block",width:ee+"px"},children:Z}),j=()=>h.jsx("text",{onClick:D,x:0,y:-20,style:{fontSize:"10px",textAnchor:"middle",fill:"dimgray",cursor:"pointer",fontWeight:v===o?"bold":"normal"},children:r}),B=m.useMemo(()=>o==="yearlyProfit"||o==="unitCost"||o==="sellingPrice"||o==="totalYearlyCost",[o]),O=()=>o==="totalYearlyCost"||o==="totalYearlyYield"||o==="meanYearlyYield"||o==="unitCost"||o==="poleHeight"||o==="interRowSpacing"?0:o==="tiltAngle"||o==="latitude"?-90:o==="rowWidth"?1:Number.MIN_SAFE_INTEGER,V=()=>o==="tiltAngle"||o==="latitude"?90:Number.MAX_SAFE_INTEGER,G=Z=>{if(Z===null)return;const ee=b.current,te={name:"Set Minimum: "+r,timestamp:Date.now(),oldValue:ee,newValue:Z,undo:()=>{q(ee)},redo:()=>{q(Z)}};y(te),q(Z)},q=Z=>{g(ee=>{if(ee.projectState.ranges){let te=-1,oe=null;for(const[de,he]of ee.projectState.ranges.entries())if(he.variable===o){te=de,oe=he;break}if(te>=0&&oe)ee.projectState.ranges[te]={variable:oe.variable,minimum:Z,maximum:oe.maximum},A.uid&&ee.projectState.title&&YCe(A.uid,ee.projectState.title,ee.projectState.ranges).then(()=>{});else{const de={variable:o,minimum:Z,maximum:c};ee.projectState.ranges.push(de),A.uid&&ee.projectState.title&&NO(A.uid,ee.projectState.title,de).then(()=>{})}}else{const te={variable:o,minimum:Z,maximum:c};ee.projectState.ranges=[te],A.uid&&ee.projectState.title&&NO(A.uid,ee.projectState.title,te).then(()=>{})}}),b.current=Number(Z),x(!w)},$=Z=>{if(Z===null)return;const ee=R.current,te={name:"Set Maximum: "+r,timestamp:Date.now(),oldValue:ee,newValue:Z,undo:()=>{ie(ee)},redo:()=>{ie(Z)}};y(te),ie(Z)},ie=Z=>{g(ee=>{if(ee.projectState.ranges){let te=-1,oe=null;for(const[de,he]of ee.projectState.ranges.entries())if(he.variable===o){te=de,oe=he;break}if(te>=0&&oe)ee.projectState.ranges[te]={variable:oe.variable,minimum:oe.minimum,maximum:Z},A.uid&&ee.projectState.title&&YCe(A.uid,ee.projectState.title,ee.projectState.ranges).then(()=>{});else{const de={variable:o,minimum:s,maximum:Z};ee.projectState.ranges.push(de),A.uid&&ee.projectState.title&&NO(A.uid,ee.projectState.title,de).then(()=>{})}}else{const te={variable:o,minimum:s,maximum:Z};ee.projectState.ranges=[te],A.uid&&ee.projectState.title&&NO(A.uid,ee.projectState.title,te).then(()=>{})}}),R.current=Number(Z),x(!w)},Q=Z=>{if(!f)return;const ee=[f.lowerBound,f.upperBound],te={name:"Set Filter: "+r,timestamp:Date.now(),oldValue:ee,newValue:Z,undo:()=>{se(ee)},redo:()=>{se(Z)}};y(te),se(Z)},se=Z=>{f&&(f.lowerBound=Z[0],f.upperBound=Z[1],p&&p(-1),g(ee=>{if(ee.projectState.filters){let te=-1;for(const[oe,de]of ee.projectState.filters.entries())if(de.variable===o){te=oe;break}if(te>=0)ee.projectState.filters[te]={variable:f.variable,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};else{const oe={variable:o,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};ee.projectState.filters.push(oe)}}}),x(!w))};return h.jsxs(h.Fragment,{children:[o!=="orientation"?h.jsx(Ml,{content:h.jsxs("div",{children:[h.jsx(Sn,{style:{width:"240px"},addonBefore:L(Y.t("word.Minimum",H)+(B?" $":""),80),addonAfter:i,min:O(),max:R.current-u,step:u,value:b.current,onPressEnter:Z=>G(Number.parseFloat(Z.target.value)),onStep:Z=>G(Z)}),h.jsx("br",{}),h.jsx(Sn,{style:{width:"240px"},addonBefore:L(Y.t("word.Maximum",H)+(B?" $":""),80),addonAfter:i,min:b.current+u,max:V(),step:u,value:R.current,onPressEnter:Z=>$(Number.parseFloat(Z.target.value)),onStep:Z=>$(Z)})]}),children:j()}):h.jsx(h.Fragment,{children:j()}),d!==void 0&&h.jsx("text",{x:0,y:-8,style:{fontSize:"9px",textAnchor:"middle",fill:"dimgray"},children:B?d.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:l})+(o==="yearlyProfit"||o==="totalYearlyCost"?"K":""):(o==="orientation"?Y.t(d===0?"solarPanelMenu.Landscape":"solarPanelMenu.Portrait",H)+(d===0?" (▭)":" (▯)"):d.toFixed(l))+(i!==""?i:"")}),f&&f.type===XL.Between&&h.jsx("rect",{x:-5,y:t(f.upperBound??c),width:10,height:t((f==null?void 0:f.lowerBound)??s)-t((f==null?void 0:f.upperBound)??c),fill:"lightgray"}),h.jsx("rect",{x:-U/2,y:0,width:U,height:N,fill:"gold",fillOpacity:v===o?.25:0}),W.map(({value:Z,yOffset:ee})=>h.jsxs("g",{transform:`translate(0, ${ee})`,shapeRendering:"crispEdges",children:[h.jsx("line",{x1:-LBo,x2:0,stroke:"black",strokeWidth:1}),h.jsx("text",{style:{fontSize:"10px",textAnchor:"start",alignmentBaseline:"central",transform:"translateX(-25px)"},children:o==="orientation"?Z===0?"▭":"▯":Z},Z)]},Z)),h.jsx("line",{x1:0,x2:0,y1:t(s),y2:t(c),stroke:"black",strokeWidth:2}),f&&f.type===XL.Between&&h.jsx("foreignObject",{x:-U/2,y:4,width:U,height:N-3,children:h.jsx(fy,{theme:{components:{Slider:{railBg:"black",railSize:0,handleSize:8}}},children:h.jsx(Iu,{style:{marginLeft:U/2+"px"},min:s,max:c,step:(c-s)/100,value:[f.lowerBound??s,f.upperBound??c],onChange:Z=>se(Z),onChangeComplete:Z=>Q(Z),range:!0,vertical:!0})})})]})}),lP={top:30,right:55,bottom:36,left:55},NBo=["#e0ac2b","#e85252","#6689c6","#9a6fb0","#a53253","#69b3a2","#556b2f","#8b008b","#ff1493","#d2691e","#2f4f4f","#dc143c"],UBo=be.memo(({id:t,width:e,height:n,data:o,types:r,minima:i,maxima:a,filters:l,steps:s,variables:c,titles:u,units:d,digits:f,tickIntegers:p,hover:g,hoveredIndex:A,selectedIndex:y})=>{const S=e-lP.right-lP.left,C=n-lP.top-lP.bottom,P=m.useMemo(()=>[...new Set(o.map(H=>H.group))],[o]),v=m.useMemo(()=>YC().range([0,S]).domain(c).padding(0),[c,S]),T=m.useMemo(()=>{const H={};return c.forEach((F,E)=>{H[F]=yL().range([C,0]).domain([i[E]??0,a[E]??1])}),H},[c,i,a,C]),w=m.useMemo(()=>nte().domain(P).range(NBo),[P]),x=I3e(),b=m.useMemo(()=>o.map((H,F)=>{if(H.invisible)return null;const E=c.map(U=>{const W=T[U],k=v(U)??0,D=W(H[U]);return[k,D]}),N=x(E);if(N)return h.jsx("path",{onMouseOver:()=>{g(F)},d:N,stroke:H.hovered?"red":w(H.group),fill:"none",strokeWidth:H.excluded?.25:H.selected?3:1,strokeDasharray:H.hovered?"3,3":"none"},F)}),[o,c,v,T,w]),R=m.useMemo(()=>c.map((H,F)=>{const E=T[H];return h.jsx("g",{transform:"translate("+v(H)+",0)",children:h.jsx(WBo,{yScale:E,tickLength:40,tickIntegers:p[F],type:r[F]??"number",variable:c[F],name:u[F],unit:d[F],digits:f[F],min:i[F],max:a[F],step:s[F],value:A>=0&&!o[A].invisible?o[A][H]:y>=0&&!o[y].invisible?o[y][H]:void 0,filter:l[F],hover:g})},F)}),[c,o,v,T,p,r,u,d,f,i,a,s,l,y,A]);return h.jsx("svg",{id:t,width:e,height:n,onMouseLeave:()=>{g&&g(-1)},onContextMenu:H=>{H.stopPropagation()},children:h.jsxs("g",{width:S,height:C,transform:`translate(${[lP.left,lP.top].join(",")})`,children:[b,R]})})});var vpe={};(function(t){(function(){var e=t||!1||this||window;e.default=e;var n="http://www.w3.org/2000/xmlns/",o="http://www.w3.org/1999/xhtml",r="http://www.w3.org/2000/svg",i=']>',a=/url\(["']?(.+?)["']?\)/,l={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},s=function(E){return E instanceof HTMLElement||E instanceof SVGElement},c=function(E){if(!s(E))throw new Error("an HTMLElement or SVGElement is required; got "+E)},u=function(E){return new Promise(function(N,U){s(E)?N(E):U(new Error("an HTMLElement or SVGElement is required; got "+E))})},d=function(E){return E&&E.lastIndexOf("http",0)===0&&E.lastIndexOf(window.location.host)===-1},f=function(E){var N=Object.keys(l).filter(function(U){return E.indexOf("."+U)>0}).map(function(U){return l[U]});return N?N[0]:(console.error("Unknown font format for "+E+". Fonts may not be working correctly."),"application/octet-stream")},p=function(E){for(var N="",U=new Uint8Array(E),W=0;W"u"||W===null||isNaN(parseFloat(W))?0:W},A=function(E,N,U,W){if(E.tagName==="svg")return{width:U||g(E,N,"width"),height:W||g(E,N,"height")};if(E.getBBox){var k=E.getBBox(),D=k.x,L=k.y,j=k.width,B=k.height;return{width:D+j,height:L+B}}},y=function(E){return decodeURIComponent(encodeURIComponent(E).replace(/%([0-9A-F]{2})/g,function(N,U){var W=String.fromCharCode("0x"+U);return W==="%"?"%25":W}))},S=function(E){for(var N=window.atob(E.split(",")[1]),U=E.split(",")[0].split(":")[1].split(";")[0],W=new ArrayBuffer(N.length),k=new Uint8Array(W),D=0;D{const e=M.getState().world,n=M(oa),o=M(hu)??g0,r=M(pn),i=M(RW),a=new Date(M(Al)),l=M(J4t),s=dt(zge),c=dt(Xq),u=dt(Lwt),d=dt(Cf),f=me.hasSolarPanels(M.getState().elements),p=Cn(nOe),g=Cn(oOe),A=Cn(rOe),y=M(Sc),S=m.useRef(null),C=m.useRef(),P=S.current?S.current.clientWidth+40:l?l.width+40:640,v=S.current?S.current.clientHeight+100:l?l.height+100:600,[T,w]=m.useState({x:l?Math.max(l.x,P-window.innerWidth):0,y:l?Math.min(l.y,window.innerHeight-v):0}),x=be.useRef(null),b=$t(),R=u1(t),H=zs[a.getMonth()],F=e.daysPerYear??6,E=12/F,[N,U]=m.useState(0),[W,k]=m.useState(0),[D,L]=m.useState(0),[j,B]=m.useState(0),[O,V]=m.useState(["Heater","AC","Solar","Net"]),[G,q]=m.useState([]),{sum:$,sumHeaterMap:ie,sumAcMap:Q,sumSolarPanelMap:se,dataLabels:oe}=p0t(a,R,f),Z=m.useRef(new Array(F).fill({})),te=m.useRef(new Array(F).fill(0)),ee=m.useRef(new Array(F).fill(0)),de=m.useRef(new Array(F).fill(0)),fe=m.useRef(new Array(F).fill(0)),pe=m.useRef([]),ye=m.useRef([]),ae=m.useRef([]),Te=m.useRef([]);m.useEffect(()=>{ge()},[F,u]),m.useEffect(()=>{c&&ge()},[c]);const ge=()=>{Z.current=new Array(F).fill({}),te.current=new Array(F).fill(0),ee.current=new Array(F).fill(0),de.current=new Array(F).fill(0),fe.current=new Array(F).fill(0),q([]),U(0),k(0),L(0),B(0),V([])};m.useEffect(()=>{const ve=Math.floor(a.getMonth()/E),we=(Object.keys($[0]).length-1)/(f?4:3);if(pe.current=[],ye.current=[],Te.current=[],ae.current=[],we>1){const Ue=new Map,nt=new Map,We=new Map,Ee=new Map;for(const je of $){let xt=0;for(let gt=0;gt6&&(Ee=" "+je.substring(6).trim());break}const ke="Heater"+Ee,Oe="AC"+Ee,st="Net"+Ee;if(f){const je="Solar"+Ee;let xt=0;V([ke,Oe,je,st]);for(const Ye of $)Ue+=Ye[ke],nt+=Ye[Oe],xt+=Ye[je],We+=Ye[st];const gt={};gt.Month=zs[a.getMonth()],gt[ke]=30*Ue,gt[Oe]=30*nt,gt[je]=30*xt,gt[st]=30*We,Z.current[ve]=gt}else{V([ke,Oe,st]);for(const xt of $)Ue+=xt[ke],nt+=xt[Oe],We+=xt[st];const je={};je.Month=zs[a.getMonth()],je[ke]=30*Ue,je[Oe]=30*nt,je[st]=30*We,Z.current[ve]=je}}q([...Z.current]);let Pe=0;if(ie)for(const Ue of ie.keys())Pe+=ie.get(Ue)??0;let Ie=0;if(Q)for(const Ue of Q.keys())Ie+=Q.get(Ue)??0;let Me=0;if(se&&f)for(const Ue of se.keys())Me+=se.get(Ue)??0;te.current[ve]=Pe*E*30,ee.current[ve]=Ie*E*30,de.current[ve]=Me*E*30,fe.current[ve]=te.current[ve]+ee.current[ve]-de.current[ve];const ze=te.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);U(ze);const Ne=ee.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);k(Ne);const Je=de.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0);L(Je),B(fe.current.slice(0,ve+1).reduce((Ue,nt)=>Ue+nt,0)),p(ze),g(Ne),A(Je),dt.getState().showSolarRadiationHeatmap||Cn.getState().clearDataStore()},[s]),m.useEffect(()=>{w({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-v)})},[l,P,v]),m.useEffect(()=>{const ve=()=>{w({x:Math.max(l==null?void 0:l.x,P-window.innerWidth),y:Math.min(l==null?void 0:l.y,window.innerHeight-v)})};return window.addEventListener("resize",ve),()=>{window.removeEventListener("resize",ve)}},[l,P,v]),m.useEffect(()=>(S.current&&(C.current||(C.current=new ResizeObserver(()=>{r(ve=>{S.current&&(ve.viewState.yearlyBuildingEnergyPanelRect||(ve.viewState.yearlyBuildingEnergyPanelRect=new cr(0,0,600,500)),ve.viewState.yearlyBuildingEnergyPanelRect.width=S.current.offsetWidth,ve.viewState.yearlyBuildingEnergyPanelRect.height=S.current.offsetHeight)})})),C.current.observe(S.current)),()=>{var ve;(ve=C.current)==null||ve.disconnect()}),[]);const Se=(ve,we)=>{w({x:Math.max(we.x,P-window.innerWidth),y:Math.min(we.y,window.innerHeight-v)})},Re=(ve,we)=>{r(Pe=>{Pe.viewState.yearlyBuildingEnergyPanelRect||(Pe.viewState.yearlyBuildingEnergyPanelRect=new cr(0,0,600,360)),Pe.viewState.yearlyBuildingEnergyPanelRect.x=Math.max(we.x,P-window.innerWidth),Pe.viewState.yearlyBuildingEnergyPanelRect.y=Math.min(we.y,window.innerHeight-v)})},De=()=>{r(ve=>{ve.viewState.showYearlyBuildingEnergyPanel=!1,n&&(ve.actionInfo={name:"Close Yearly Building Energy Graph",timestamp:new Date().getTime()})})},Ae=Y.t("word.Month",b),ue=Y.t("word.Energy",b),he=G&&G[0]?Object.keys(G[0]).length===0:!0;return h.jsx(Bi,{nodeRef:x,handle:".handle",bounds:"parent",axis:"both",position:T,onDrag:Se,onStop:Re,onMouseDown:()=>{r(ve=>{ve.selectedFloatingWindow="yearlyBuildingEnergyPanel"})},children:h.jsx(gBo,{ref:x,style:{zIndex:y==="yearlyBuildingEnergyPanel"?bc:9},children:h.jsxs(mBo,{ref:S,style:{opacity:o,width:(l?l.width:600)+"px",height:(l?l.height:400)+"px"},children:[h.jsxs(yBo,{className:"handle",style:{direction:"ltr"},children:[h.jsxs("span",{children:[Y.t("buildingEnergyPanel.YearlyBuildingEnergy",b)+": ",h.jsx("span",{style:{fontSize:"10px"},children:Y.t("sensorPanel.WeatherDataFrom",b)+" "+t+" | "+a.getFullYear()})]}),h.jsx("span",{style:{cursor:"pointer"},onTouchStart:()=>{De()},onMouseDown:()=>{De()},children:`${Y.t("word.Close",b)}`})]}),h.jsx(g0t,{type:vi.YearlyBuildingEnergy,dataSource:G,hasSolarPanels:f,labels:O,height:100,dataKeyAxisX:"Month",labelX:Ae,labelY:ue,unitY:Y.t("word.kWh",b),yMin:0,curveType:"linear",fractionDigits:2,referenceX:H}),!d&&h.jsxs(on,{style:{alignSelf:"center",direction:"ltr"},children:[pe.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Heater",b)+": "+N.toFixed(0)}):h.jsx(Ml,{content:pe.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Heater",b)+": "+N.toFixed(0)})}),ye.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.AC",b)+": "+W.toFixed(0)}):h.jsx(Ml,{content:ye.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.AC",b)+": "+W.toFixed(0)})}),D!==0&&h.jsx(h.Fragment,{children:ae.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.SolarPanel",b)+": "+D.toFixed(0)}):h.jsx(Ml,{content:ae.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.SolarPanel",b)+": "+D.toFixed(0)})})}),Te.current.length===0?h.jsx(on,{style:{cursor:"default"},children:Y.t("buildingEnergyPanel.Net",b)+": "+j.toFixed(0)}):h.jsx(Ml,{content:Te.current.map((ve,we)=>h.jsx("div",{children:ve},we)),children:h.jsx(on,{style:{cursor:"help"},children:Y.t("buildingEnergyPanel.Net",b)+": "+j.toFixed(0)})}),h.jsx(io,{type:"default",icon:he?h.jsx(Th,{}):h.jsx(Hf,{}),title:Y.t(he?"word.Run":"word.Update",b),onClick:()=>{const ve=M.getState().elements,we=M.getState().countElementsByType,Pe=M.getState().getChildrenOfType,Ie=bX(ve,we,Pe);if(Ie.status===rg.NO_BUILDING){gn(Y.t("analysisManager.NoBuildingForAnalysis",b));return}if(Ie.status===rg.AT_LEAST_ONE_BAD_NO_GOOD){let Me;switch(Ie.buildingCompletion){case Uc.WALL_DISJOINED:Me=Y.t("message.WallsAreNotConnected",b);break;case Uc.WALL_EMPTY:Me=Y.t("message.BuildingContainsEmptyWall",b);break;case Uc.ROOF_MISSING:Me=Y.t("message.BuildingRoofMissing",b);break;default:Me=Y.t("message.UnknownErrors",b)}co(Y.t("message.SimulationWillNotStartDueToErrors",b)+": "+Me);return}Ie.status===rg.AT_LEAST_ONE_BAD_AT_LEAST_ONE_GOOD&&PR(Y.t("message.SimulationWillStartDespiteWarnings",b)),gn(Y.t("message.SimulationStarted",b)),setTimeout(()=>{i(),dt.getState().set(Me=>{Me.runYearlyThermalSimulation=!0,Me.pauseYearlyThermalSimulation=!1,Me.simulationInProgress=!0}),r(Me=>{n&&(Me.actionInfo={name:"Run Yearly Building Energy Analysis",timestamp:new Date().getTime()})})},100)}}),h.jsx(io,{type:"default",icon:h.jsx(_u,{}),title:Y.t("word.SaveAsImage",b),onClick:()=>{Ed("line-graph-"+Ae+"-"+ue,"yearly-building-energy").then(()=>{gn(Y.t("message.ScreenshotSaved",b)),n&&r(ve=>{ve.actionInfo={name:"Take Screenshot of Yearly Building Energy Graph",timestamp:new Date().getTime()}})})}}),Z.current&&Z.current.length>0&&h.jsx(io,{type:"default",icon:h.jsx(Mf,{}),title:Y.t("word.SaveAsCsv",b),onClick:()=>{Sh(Z.current,"yearly-building-energy.csv"),gn(Y.t("message.CsvFileSaved",b)),n&&r(ve=>{ve.actionInfo={name:"Export Yearly Building Energy Result as CSV",timestamp:new Date().getTime()}})}})]})]})})})}),wBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(En),o=M(j8t),r=M(B8t),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=m.useRef(null),p=m.useRef(o),g=m.useRef(r),A=$t();m.useEffect(()=>{var w;(w=f.current)==null||w.focus()},[]);const y=(w,x)=>{if(d.current){const{clientWidth:b,clientHeight:R}=window.document.documentElement,H=d.current.getBoundingClientRect();u({left:-H.left+x.x,right:b-(H.right-x.x),top:-H.top+x.y,bottom:R-((H==null?void 0:H.bottom)-x.y)})}},S=w=>{e(x=>{x.minimumNavigationMoveSpeed=w}),dt.getState().set(x=>{x.navigationMoveSpeed=w})},C=w=>{e(x=>{x.minimumNavigationTurnSpeed=w}),dt.getState().set(x=>{x.navigationTurnSpeed=w})},P=()=>{const w=o,x=p.current;if(w!==x){const H={name:"Minimum Navigation Move Speed",timestamp:Date.now(),oldValue:w,newValue:x,undo:()=>{S(H.oldValue)},redo:()=>{S(H.newValue)}};n(H),S(x)}const b=r,R=g.current;if(b!==R){const H={name:"Minimum Navigation Turn Speed",timestamp:Date.now(),oldValue:b,newValue:R,undo:()=>{C(H.oldValue)},redo:()=>{C(H.newValue)}};n(H),C(R)}},v=()=>{t(!1)},T=()=>{P(),t(!1)};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:`${Y.t("navigationPanel.NavigationParameters",A)}`}),footer:[h.jsx(io,{onClick:v,children:`${Y.t("word.Cancel",A)}`},"Cancel"),h.jsx(io,{type:"primary",ref:f,onClick:T,children:`${Y.t("word.OK",A)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:w=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:(x,b)=>y(x,b),children:h.jsx("div",{ref:d,children:w})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("navigationPanel.MinimumMoveSpeed",A)+" ([1, 10]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:10,style:{width:"100%"},precision:0,value:p.current,step:1,onChange:w=>{p.current=Number(w),a(!i)},onBlur:w=>{const x=w.target.value,b=parseFloat(x);p.current=Number.isNaN(b)?3:b,a(!i)},onPressEnter:w=>{const x=w.target.value,b=parseFloat(x);p.current=Number.isNaN(b)?3:b,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("navigationPanel.MinimumTurnSpeed",A)+" ([1, 5]): "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:5,style:{width:"100%"},precision:0,value:g.current,step:1,onChange:w=>{g.current=Number(w),a(!i)},onBlur:w=>{const x=w.target.value,b=parseFloat(x);g.current=Number.isNaN(b)?3:b,a(!i)},onPressEnter:w=>{const x=w.target.value,b=parseFloat(x);g.current=Number.isNaN(b)?3:b,a(!i)}})})]})]})}),vBo=be.memo(({setDialogVisible:t})=>{const e=M(pn),n=M(En),o=M(Oq),r=me.getShadowMapSize(),i=4096,a=1e4,[l,s]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState({left:0,top:0,bottom:0,right:0}),p=m.useRef(null),g=m.useRef(null),A=m.useRef(o?Math.round(o)/a:1),y=m.useRef(r?Math.round(r/i):1),S=$t();m.useEffect(()=>{var b;(b=g.current)==null||b.focus()},[]);const C=(b,R)=>{if(p.current){const{clientWidth:H,clientHeight:F}=window.document.documentElement,E=p.current.getBoundingClientRect();f({left:-E.left+R.x,right:H-(E.right-R.x),top:-E.top+R.y,bottom:F-((E==null?void 0:E.bottom)-R.y)})}},P=b=>{e(R=>{R.viewState.shadowCameraFar=b})},v=b=>{localStorage.setItem("aladdin-shadow-map-size",b.toString())},T=()=>{const b=o,R=A.current*a;if(b!==R){const E={name:"Shadow Camera Far Distance",timestamp:Date.now(),oldValue:b,newValue:R,undo:()=>{P(E.oldValue)},redo:()=>{P(E.newValue)}};n(E),P(R)}const H=r,F=y.current*i;if(H!==F){const E={name:"Shadow Map Size",timestamp:Date.now(),oldValue:H,newValue:F,undo:()=>{v(E.oldValue)},redo:()=>{v(E.newValue)}};n(E),v(F)}},w=()=>{t(!1)},x=()=>{T(),t(!1),window.location.reload()};return h.jsxs(yi,{width:500,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>u(!0),onMouseOut:()=>u(!1),children:`${Y.t("shadowSettingsPanel.ShadowSettings",S)}`}),footer:[h.jsx(io,{onClick:w,children:`${Y.t("word.Cancel",S)}`},"Cancel"),h.jsx(io,{type:"primary",ref:g,onClick:x,children:`${Y.t("word.OK",S)}`},"OK")],onCancel:()=>{t(!1)},maskClosable:!1,destroyOnClose:!1,modalRender:b=>h.jsx(Bi,{disabled:!c,bounds:d,onStart:(R,H)=>C(R,H),children:h.jsx("div",{ref:p,children:b})}),children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:18,children:Y.t("shadowSettingsPanel.ShadowCameraFarDistance",S)+" ([1, 1000]×"+a+"): "}),h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:1,max:1e3,style:{width:"100%"},precision:0,value:A.current,step:1,onChange:b=>{A.current=Number(b),s(!l)},onBlur:b=>{const R=b.target.value,H=parseFloat(R);A.current=Number.isNaN(H)?1:H,s(!l)},onPressEnter:b=>{const R=b.target.value,H=parseFloat(R);A.current=Number.isNaN(H)?1:H,s(!l)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"10px"},children:[h.jsx(Ke,{span:18,children:Y.t("shadowSettingsPanel.ShadowMapSize",S)+" ([1, 4]×"+i+"): "}),h.jsx(Ke,{span:6,children:h.jsx(Sn,{min:1,max:4,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:b=>{y.current=Number(b),s(!l)},onBlur:b=>{const R=b.target.value,H=parseFloat(R);y.current=Number.isNaN(H)?1:H,s(!l)},onPressEnter:b=>{const R=b.target.value,H=parseFloat(R);y.current=Number.isNaN(H)?1:H,s(!l)}})})]}),h.jsx(nn,{style:{fontSize:"10px"},children:h.jsxs(Ke,{span:24,children:[Y.t("shadowSettingsPanel.Notes",S),":",h.jsx("br",{}),h.jsxs("ul",{children:[h.jsx("li",{children:Y.t("shadowSettingsPanel.RefreshPageNote",S)}),h.jsx("li",{children:Y.t("shadowSettingsPanel.MapSizeWarning",S)})]})]})})]})}),{Option:SD}=Uo,xBo=be.memo(({setDialogVisible:t})=>{const e=M(DH),n=M(EH),o=M(ewt),r=M(twt),[i,a]=m.useState(!1),[l,s]=m.useState(!1),[c,u]=m.useState({left:0,top:0,bottom:0,right:0}),d=m.useRef(null),f=m.useRef("Unknown"),p=m.useRef("Unknown"),g=m.useRef("Monocrystalline"),A=m.useRef(12),y=m.useRef(8),S=m.useRef("Black"),C=m.useRef(1),P=m.useRef(1.5),v=m.useRef(0),T=m.useRef(.2),w=m.useRef(45),x=m.useRef(300),b=m.useRef(-.002),R=m.useRef(.005),H=m.useRef(30),F=m.useRef(30),E=m.useRef(10),N=m.useRef(40),U=m.useRef(15),W=$t(),k=(q,$)=>{if(d.current){const{clientWidth:ie,clientHeight:Q}=window.document.documentElement,se=d.current.getBoundingClientRect();u({left:-se.left+$.x,right:ie-(se.right-$.x),top:-se.top+$.y,bottom:Q-((se==null?void 0:se.bottom)-$.y)})}},D=m.useMemo(()=>{const q=[];for(const $ in n)q.push($);return q},[n]),L=()=>{const q={name:f.current,brand:p.current,cellType:g.current,efficiency:T.current,length:P.current,nominalLength:P.current,width:C.current,nominalWidth:C.current,thickness:R.current,m:A.current,n:y.current,pmax:x.current,vmpp:F.current,impp:E.current,voc:N.current,isc:U.current,pmaxTC:b.current,noct:w.current,weight:H.current,color:S.current,shadeTolerance:m8.PARTIAL,bifacialityFactor:v.current};o(q)},j=()=>{if(f.current.trim()===""){yi.info({title:Y.t("pvModelPanel.CannotAddCustomSolarPanel",W),content:Y.t("pvModelPanel.CustomSolarPanelMustHaveModelName",W)+"."});return}if(e[f.current.trim()]){yi.info({title:Y.t("pvModelPanel.NoNeedToAddThisCustomSolarPanel",W),content:Y.t("pvModelPanel.SolarPanelModelAlreadyProvidedBySystem",W)+" ("+f.current+")."});return}D.includes(f.current)?yi.info({title:Y.t("pvModelPanel.CannotAddCustomSolarPanel",W),content:Y.t("pvModelPanel.CustomSolarPanelExists",W)+': "'+f.current+'"'}):L()},B=q=>{f.current=q.name,p.current=q.brand,g.current=q.cellType,T.current=q.efficiency,P.current=q.length,C.current=q.width,R.current=q.thickness,A.current=q.m,y.current=q.n,x.current=q.pmax,F.current=q.vmpp,E.current=q.impp,N.current=q.voc,U.current=q.isc,b.current=q.pmaxTC,w.current=q.noct,H.current=q.weight,S.current=q.color,v.current=q.bifacialityFactor},O=()=>{yi.confirm({title:Y.t("pvModelPanel.DoYouReallyWantToImportCustomSolarPanel",W)+"?",content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),Y.t("word.Warning",W)+": "+Y.t("pvModelPanel.ExistingSettingsWillBeOverwritten",W)+"."]}),icon:h.jsx(Zx,{}),onOk:()=>{navigator.clipboard.readText().then(q=>{const $=JSON.parse(q);if(!$.cellType||!$.pmax){co(Y.t("pvModelPanel.FailInImportingDataFromClipboard",W));return}B($),a(!i)}).catch(q=>{co(Y.t("pvModelPanel.FailInImportingDataFromClipboard",W)+":"+q)})}})},V=q=>{yi.confirm({title:Y.t("pvModelPanel.DoYouReallyWantToRemoveThisCustomSolarPanel",W)+' "'+q+'"?',content:h.jsxs("span",{style:{color:"red",fontWeight:"bold"},children:[h.jsx(nb,{style:{marginRight:"6px"}}),Y.t("word.Warning",W)+": "+Y.t("pvModelPanel.MakeSureThisCustomSolarPanelIsNotUsed",W)+"."]}),icon:h.jsx(Zx,{}),onOk:()=>{r(q)}})},G=[{key:"1",label:Y.t("pvModelPanel.General",W),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.Model",W)+": "}),h.jsx(Ke,{span:10,children:h.jsx(jl,{style:{width:"100%"},value:f.current,onChange:q=>{f.current=q.target.value,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.BrandName",W)+": "}),h.jsx(Ke,{span:10,children:h.jsx(jl,{style:{width:"100%"},value:p.current,onChange:q=>{p.current=q.target.value,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.CellType",W)+":"}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:g.current,onChange:q=>{g.current=q,a(!i)},children:[h.jsx(SD,{value:"Monocrystalline",children:Y.t("pvModelPanel.Monocrystalline",W)},"Monocrystalline"),h.jsx(SD,{value:"Polycrystalline",children:Y.t("pvModelPanel.Polycrystalline",W)},"Polycrystalline"),h.jsx(SD,{value:"Thin Film",children:Y.t("pvModelPanel.ThinFilm",W)},"Thin Film")]})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Length",W)+" ([0.1, 3]"+Y.t("word.MeterAbbreviation",W)+"): "}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{min:.1,max:3,style:{width:"100%"},precision:3,value:P.current,step:.01,onChange:q=>{q!==null&&(P.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);P.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);P.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Width",W)+" ([0.1, 3]"+Y.t("word.MeterAbbreviation",W)+"): "}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{min:.1,max:3,style:{width:"100%"},precision:3,value:C.current,step:.01,onChange:q=>{q!==null&&(C.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);C.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);C.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.PowerBifaciality",W)+" ([0, 1]):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.01,value:v.current,onChange:q=>{q!==null&&(v.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("pvModelPanel.Weight",W)+" ("+Y.t("pvModelPanel.Kilogram",W)+"):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:H.current,onChange:q=>{q!==null&&(H.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Thickness",W)+" ("+Y.t("word.MeterAbbreviation",W)+"):"}),h.jsx(Ke,{span:10,children:h.jsx(Sn,{style:{width:"100%"},precision:4,step:1e-4,value:R.current,onChange:q=>{q!==null&&(R.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,children:Y.t("word.Color",W)+":"}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:S.current,onChange:q=>{S.current=q,a(!i)},children:[h.jsx(SD,{value:"Black",children:Y.t("pvModelPanel.Black",W)},"Black"),h.jsx(SD,{value:"Blue",children:Y.t("pvModelPanel.Blue",W)},"Blue")]})})]})]})},{key:"2",label:Y.t("pvModelPanel.Electrical",W),children:h.jsxs(h.Fragment,{children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.SolarCellEfficiency",W)+" (%):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:100*T.current,onChange:q=>{q!==null&&(T.current=q*.01,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.CellCountInXDirection",W)+": "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:36,style:{width:"100%"},precision:0,value:A.current,step:1,onChange:q=>{q!==null&&(A.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);A.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);A.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.CellCountInYDirection",W)+": "}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{min:1,max:36,style:{width:"100%"},precision:0,value:y.current,step:1,onChange:q=>{q!==null&&(y.current=q,a(!i))},onBlur:q=>{const $=parseFloat(q.target.value);y.current=Number.isNaN($)?1:$,a(!i)},onPressEnter:q=>{const $=parseFloat(q.target.value);y.current=Number.isNaN($)?1:$,a(!i)}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.MaximumRatedPower",W)+" Pmax ("+Y.t("word.WattAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:1,value:x.current,onChange:q=>{q!==null&&(x.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.TemperatureCoefficientOfPmax",W)+" (%/°C):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},step:1e-4,value:b.current,onChange:q=>{q!==null&&(b.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.NominalOperatingCellTemperature",W)+" (°C):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},step:1,precision:1,value:w.current,onChange:q=>{q!==null&&(w.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.RatedVoltage",W)+" Vmpp ("+Y.t("word.VoltAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:F.current,onChange:q=>{q!==null&&(F.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.RatedCurrent",W)+" Impp ("+Y.t("word.AmpereAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.1,value:E.current,onChange:q=>{q!==null&&(E.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.OpenCircuitVoltage",W)+" Voc ("+Y.t("word.VoltAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:1,step:.1,value:N.current,onChange:q=>{q!==null&&(N.current=q,a(!i))}})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:16,children:Y.t("pvModelPanel.ShortCircuitCurrent",W)+" Isc ("+Y.t("word.AmpereAbbreviation",W)+"):"}),h.jsx(Ke,{span:8,children:h.jsx(Sn,{style:{width:"100%"},precision:2,step:.1,value:U.current,onChange:q=>{q!==null&&(U.current=q,a(!i))}})})]})]})}];return h.jsx(yi,{width:720,open:!0,title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:Y.t("menu.settings.CustomizeSolarPanel",W)}),footer:[h.jsx(io,{onClick:()=>t(!1),children:Y.t("word.Close",W)},"Close")],onCancel:()=>t(!1),maskClosable:!1,destroyOnClose:!1,modalRender:q=>h.jsx(Bi,{disabled:!l,bounds:c,onStart:($,ie)=>k($,ie),children:h.jsx("div",{ref:d,children:q})}),children:h.jsxs(nn,{style:{justifyContent:"space-between"},children:[h.jsx(Ke,{flex:3,children:h.jsx(hQ,{defaultActiveKey:"1",type:"card",items:G})}),h.jsx(Ke,{flex:.5,children:h.jsxs(on,{style:{height:"100%",justifyContent:"center",marginLeft:"12px"},direction:"vertical",children:[h.jsx(Vnn,{title:Y.t("word.Add",W),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>j()}),h.jsx(mue,{style:{marginTop:"12px",marginBottom:"12px"}}),h.jsx(Bnn,{title:Y.t("pvModelPanel.ImportCustomSolarPanelFromClipboard",W),style:{cursor:"pointer",fontSize:"20px",color:"dimgray",border:"2px solid lightgray",borderRadius:"6px",padding:"4px"},onClick:()=>{O()}})]})}),h.jsx(Ke,{flex:2,children:h.jsx(gk,{style:{marginTop:"56px",marginLeft:"8px"},size:"small",header:h.jsx("div",{style:{fontWeight:"bold"},children:Y.t("pvModelPanel.AddedCustomSolarPanels",W)}),bordered:!0,dataSource:D,renderItem:q=>h.jsxs(gk.Item,{children:[h.jsx(yon,{title:Y.t("pvModelPanel.ExportThisCustomSolarPanel",W),style:{paddingRight:"4px",cursor:"pointer"},onClick:()=>{const $=n[q];navigator.clipboard.writeText(JSON.stringify($)).then(()=>{gn(Y.t("pvModelPanel.CustomSolarPanelExportedToClipboard",W)+" ("+q+").")})}}),h.jsx(eqe,{title:Y.t("word.Delete",W),style:{paddingRight:"6px",cursor:"pointer"},onClick:()=>V(q)}),q]},q)})})]})})}),bBo=be.memo(()=>{const t=M(Tge),e=M(Vq),n=M(FBe),o=M(W4t),r=M(kBe),i=M(LBe),a=M(j4t),l=M(Y4t),s=dt(L8t),c=dt(W8t),u=dt(N8t),d=dt(U8t),f=dt(hs),p=M(WBe),g=M(q4t),A=M(NBe),y=M(t8t),S=M(o8t),C=M(UBe),P=M(a8t),v=M(jBe),T=M(c8t),w=M(BBe),x=M(f8t),b=M(YBe),R=M(g8t),H=M(OBe),F=M(A8t),E=M(_4t),N=M(X4t),U=M(v8t),W=M(HW),k=M(s0),D=M(Mb),L=M(qYe),j=M(KYe),B=M(Jge),O=M(Yq)??!1,[V,G]=m.useState("Boston MA, USA");return m.useEffect(()=>{if(Object.keys(B).length===0)return;const q=L(k,D)??"Boston MA, USA";G(q),j(q)},[k,D,B]),h.jsxs(h.Fragment,{children:[o&&h.jsx(a8o,{}),r&&h.jsx(u8o,{}),i&&h.jsx(LUo,{}),t&&h.jsx(ijo,{}),e&&h.jsx(ZUo,{}),(n||O)&&!W&&h.jsx(UUo,{}),a&&h.jsx(Sko,{city:V,graphs:[vi.MonthlyTemperatures,vi.SunshineHours]}),l&&h.jsx(Zjo,{city:V}),s&&h.jsx(xBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showSolarPanelCustomizationPanel=q})}}),c&&h.jsx(cBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showEconomicsPanel=q})}}),u&&h.jsx(wBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showNavigationPanel=q})}}),d&&h.jsx(vBo,{setDialogVisible:q=>{dt.getState().set($=>{$.showShadowSettings=q})}}),g&&h.jsx(Rko,{city:V}),p&&h.jsx(zUo,{city:V}),y&&h.jsx(OUo,{city:V}),A&&h.jsx(XUo,{city:V}),S&&h.jsx(fjo,{}),P&&h.jsx(mjo,{city:V}),C&&h.jsx(vjo,{city:V}),T&&h.jsx(Hjo,{city:V}),v&&h.jsx(Tjo,{city:V}),w&&h.jsx(Djo,{city:V}),x&&h.jsx(Ljo,{city:V}),b&&h.jsx(jjo,{city:V}),R&&h.jsx(Vjo,{city:V}),H&&h.jsx(Kjo,{city:V}),F&&h.jsx(oBo,{city:V}),E&&h.jsx(pBo,{city:V}),N&&h.jsx(ABo,{city:V}),f&&h.jsx(sjo,{}),U&&h.jsx(sBo,{})]})});class ll{static computeSolarPanelOutput(e,n,o,r,i,a,l,s,c){const u=i.parentType===z.Roof,d=i.parentType===z.Wall;u&&(a=l);const f=d?me.absoluteCoordinates(i.cx,i.cy,i.cz,a,l,i.lz):me.absoluteCoordinates(i.cx,i.cy,i.cz,a,void 0,void 0,!0),p=a.rotation[2];let g=i.tiltAngle,A=p+i.relativeAzimuth,y=!0;if(u&&(f.z=i.cz+i.lz+.02+a.cz,me.isZero(i.rotation[0])?f.z+=i.poleHeight:(g=i.rotation[0],A=p,y=!1)),d&&!me.isZero(i.tiltAngle)){const $=a,Q=(l?l.rotation[2]+$.relativeAngle:$.relativeAngle)-Qt,se=i.ly*Math.abs(Math.sin(i.tiltAngle))/2;f.x+=se*Math.cos(Q),f.y+=se*Math.sin(Q)}const S=new le().fromArray(i.normal),C=e.getMonth(),P=me.dayOfYear(e),v=n.solarRadiationHeatmapGridCellSize??.5;let T,w,x,b,R;n.discretization===Em.EXACT?(T=i.lx,w=i.ly,i.orientation===vr.portrait?(x=Math.max(1,Math.round(i.lx/r.width)),b=Math.max(1,Math.round(i.ly/r.length)),x*=r.n,b*=r.m):(x=Math.max(1,Math.round(i.lx/r.length)),b=Math.max(1,Math.round(i.ly/r.width)),x*=r.m,b*=r.n),R=i.lx/x):(T=i.lx,w=i.ly,x=Math.max(2,Math.round(i.lx/v)),b=Math.max(2,Math.round(i.ly/v)),x%2!==0&&(x+=1),b%2!==0&&(b+=1),R=v);const H=T/x,F=w/b,E=f.x-(T-R)/2,N=f.y-(w-R)/2,U=u||d?f.z:a.lz+i.poleHeight+i.lz,W=new Kt(f.x,f.y),k=new le,D=Array.from(Array(x),()=>new Array(b));let L=new ln(u&&!y?0:g,0,A,"ZYX");if(i.trackerType!==Ll.NO_TRACKER){const $=p?o.clone().applyAxisAngle(ko,-p):o.clone();switch(i.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const ie=new Ts().setFromUnitVectors(ko,$);L=new ln().setFromQuaternion(ie),L.z+=A;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const ie=new Ts().setFromUnitVectors(ko,new le($.x,0,$.z).normalize());L=new ln().setFromQuaternion(ie),L.z+=A;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{const ie=new le($.x,-$.y,0).normalize(),Q=Math.acos(Yc.dot(ie))*Math.sign(ie.x);L=new ln(i.tiltAngle,0,Q+p,"ZYX");break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}S.applyEuler(L),u&&!y&&(L.x=i.rotation[0],L.z=i.rotation[2]+p),d&&(L.x=Qt+i.tiltAngle,L.z=a.relativeAngle+p);const j=xi(o,P,s,li.SPHERE_MODEL),B=qr(n.ground,C,S,j),O=S.dot(o),V=new Kt,G=new le;for(let $=0;$0&&(V.set(E+$*H,N+ie*F),G.set(V.x-W.x,V.y-W.y,0),G.applyEuler(L),k.set(f.x+G.x,f.y+G.y,U+G.z),c(i.id,k,o)<0&&(D[$][ie]+=O*j));let q=0;switch(r.shadeTolerance){case m8.NONE:{let $=Number.MAX_VALUE;for(let ie=0;ieArray(S).fill(0)),D=Array(y).fill(0).map(()=>Array(S).fill(0));let L;for(let j=0;j0)for(const $ of a){if($.type!==z.Window)continue;const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx*r.lx/2,oe=$.lz*r.lz/2,Z=$;if(Z.windowType===Ci.Arched){const te=T.clone().add(new le(Z.cx*r.lx,0,Z.cz*r.lz));ll.pointWithinArch(R,Z.lx,Z.lz,Z.archHeight,te)&&(L=!1)}else if(G.x>=ie-se&&G.x=Q-oe&&G.y0)for(const $ of l){if($.type!==z.Door)continue;const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx*r.lx/2,oe=$.lz*r.lz/2,Z=$;if(Z.doorType===Rd.Arched){const te=T.clone().add(new le(Z.cx*r.lx,0,Z.cz*r.lz));ll.pointWithinArch(R,Z.lx,Z.lz,Z.archHeight,te)&&(L=!1)}else if(G.x>=ie-se&&G.x=Q-oe&&G.y0)for(const $ of s){const ie=$.cx*r.lx,Q=$.cz*r.lz,se=$.lx/2,oe=$.ly/2;if(G.x>=ie-se&&G.x=Q-oe&&G.yc6||ie<0)&&$&&(k[j][B]+=U),W>0&&ie<0&&(D[j][B]+=W*N,$&&(k[j][B]+=W*N))}}}return{intensity:k,unitArea:C*P,heatmap:D}}static computeDoorSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=me.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx*i.lx,f=r.lz*i.lz,p=Math.max(2,Math.round(d/u)),g=Math.max(2,Math.round(f/u)),A=d/p,y=f/g,S=a.rotation[2]+i.relativeAngle,P=me.wallAbsolutePosition(new le(i.cx,i.cy,i.cz),a).setZ(i.lz/2+a.lz).clone().add(new le(r.cx*i.lx,0,r.cz*i.lz)),v=new le(Math.cos(S-Qt),Math.sin(S-Qt),0),T=A*Math.cos(S),w=A*Math.sin(S),x=new le,b=xi(o,c,l,li.SPHERE_MODEL),R=qr(n.ground,e.getMonth(),v,b),H=v.dot(o),F=Array(p).fill(0).map(()=>Array(g).fill(0));if(r.doorType===Rd.Arched)for(let E=0;E0&&s(r.id,x,o)<0&&(F[E][N]+=H*b))}else for(let E=0;E0){const U=E-p/2+.5,W=N-g/2+.5;x.set(P.x+U*T,P.y+U*w,P.z+W*y),s(r.id,x,o)<0&&(F[E][N]+=H*b)}return{intensity:F,unitArea:A*y}}static pointWithinArch(e,n,o,r,i){if(r>0){const a=.5*n,l=Math.min(r,o,a),s=.5*(l+a*a/l),c=e.x-i.x,u=e.y-i.y,d=c*c+u*u;let f=e.z-i.z;return d-o/2?!0:(f=e.z-(o-s),d+f*fArray(g).fill(0));if(r.windowType===Ci.Arched)for(let E=0;E0&&s(r.id,x,o)<0&&(F[E][N]+=H*b))}else for(let E=0;E0){const U=E-p/2+.5,W=N-g/2+.5;x.set(P.x+U*T,P.y+U*w,P.z+W*y),s(r.id,x,o)<0&&(F[E][N]+=H*b)}return{intensity:F,unitArea:A*y}}static computeRoofWindowSolarRadiationEnergy(e,n,o,r,i,a,l,s){const c=me.dayOfYear(e),u=n.solarRadiationHeatmapGridCellSize??.5,d=r.lx,f=r.lz,p=Math.max(2,Math.round(d/u)),g=Math.max(2,Math.round(f/u)),A=d/p,y=f/g,S=new le(r.cx,r.cy,r.cz).applyEuler(new ln(0,0,a.rotation[2]));S.x+=a.cx,S.y+=a.cy,S.z+=a.lz;const C=new ln(r.rotation[0],r.rotation[1],r.rotation[2]+a.rotation[2],"ZXY"),P=new le(0,0,1).applyEuler(C),v=new le,T=xi(o,c,l,li.SPHERE_MODEL),w=qr(n.ground,e.getMonth(),P,T),x=P.dot(o),b=Array(p).fill(0).map(()=>Array(g).fill(0));if(r.windowType===Ci.Arched)for(let R=0;R0&&s(r.id,v,o)<0&&(b[R][H]+=x*T))}else for(let R=0;R0){const F=R-p/2+.5,E=H-g/2+.5,N=new le(F,E,0);N.applyEuler(C),v.set(S.x+N.x,S.y+N.y,S.z+N.z),s(r.id,v,o)<0&&(b[R][H]+=x*T)}return{intensity:b,unitArea:A*y}}static computePyramidRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=n.solarRadiationHeatmapGridCellSize??.5,g=me.dayOfYear(e),A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,g,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new le().subVectors(x,w),H=new le().subVectors(b,w),F=new le().subVectors(b,x),E=R.length(),N=new le().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/p)),W=Math.max(2,Math.round(N/p)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize();const D=U*H.dot(R)/E;H.normalize(),F.normalize();const L=new le().crossVectors(H,F).normalize(),j=R.multiplyScalar(.5*E/U),B=new le().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new le(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));O.add(j).add(B),j.multiplyScalar(2),B.multiplyScalar(2),C.push(j.length()*B.length());const V=new le,G=[],q=.01;G.push({x:-q,y:-q}),G.push({x:U+q,y:-q}),G.push({x:D,y:W+q});const $=qr(n.ground,e.getMonth(),L,y),ie=L.dot(o);for(let Q=0;Qc6||te<0)&&(k[Q][oe]+=$),ie>0&&te<0&&(k[Q][oe]+=ie*y)}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeHipRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=me.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new le().subVectors(x,w),H=new le().subVectors(b,w),F=new le().subVectors(b,x),E=R.length(),N=new le().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize();const D=U*H.dot(R)/E;H.normalize(),F.normalize();const L=new le().crossVectors(H,F).normalize(),j=R.multiplyScalar(.5*E/U),B=new le().crossVectors(L,R).normalize().multiplyScalar(.5*N/W),O=new le,V=new le(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));V.add(j).add(B),j.multiplyScalar(2),B.multiplyScalar(2),C.push(j.length()*B.length());const G=qr(n.ground,e.getMonth(),L,y),q=L.dot(o),$=[];for(const ie of v)$.push({x:ie.x,y:ie.y});if(P%2===0)for(let ie=0;iec6||Z<0)&&(k[ie][se]+=G),q>0&&Z<0&&(k[ie][se]+=q*y)}}}else{const ie=[];ie.push({x:-.01,y:-.01}),ie.push({x:U+.01,y:-.01}),ie.push({x:D,y:W+.01});for(let se=0;sec6||ee<0)&&(k[se][Z]+=G),q>0&&ee<0&&(k[se][Z]+=q*y)}}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeGambrelRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=me.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P,w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new le().subVectors(x,w),H=new le().subVectors(b,w),F=new le().subVectors(b,x),E=R.length(),N=new le().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize(),H.normalize(),F.normalize();const D=new le().crossVectors(H,F).normalize(),L=R.multiplyScalar(.5*E/U),j=new le().crossVectors(D,R).normalize().multiplyScalar(.5*N/W),B=new le(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));B.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new le,V=qr(n.ground,e.getMonth(),D,y),G=D.dot(o);for(let q=0;qc6||Q<0)&&(k[q][ie]+=V),G>0&&Q<0&&(k[q][ie]+=G*y)}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeMansardRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d,f){if(i)return ll.computeFlatRoofSolarRadiationEnergy(e,n,o,r,a,l,s,c,u,d,f);const p=me.dayOfYear(e),g=n.solarRadiationHeatmapGridCellSize??.5,A=new ln(0,0,s.rotation[2],"ZYX"),y=xi(o,p,d,li.SPHERE_MODEL),S=[],C=[];for(const[P,v]of l.entries()){const T=r.id+"-"+P;if(P===l.length-1){let w=Number.MAX_VALUE,x=Number.MAX_VALUE,b=-Number.MAX_VALUE,R=-Number.MAX_VALUE;for(const B of v){const O=B.clone().applyEuler(A);O.x>b&&(b=O.x),O.xR&&(R=O.y),O.yArray(E).fill(0));S.push(W);const k=new le(w+g/2,x+g/2,s.lz+H+k0+(a?r.thickness:0)),D=new le(0,0,k.z),L=qr(n.ground,e.getMonth(),ko,y),j=ko.dot(o);for(let B=0;Bc6||V<0)&&(W[B][O]+=L),j>0&&V<0&&(W[B][O]+=j*y)}}}else{const w=v[0].clone().applyEuler(A),x=v[1].clone().applyEuler(A),b=v[2].clone().applyEuler(A),R=new le().subVectors(x,w),H=new le().subVectors(b,w),F=new le().subVectors(b,x),E=R.length(),N=new le().crossVectors(H,F).length()/E,U=Math.max(2,Math.round(E/g)),W=Math.max(2,Math.round(N/g)),k=Array(U).fill(0).map(()=>Array(W).fill(0));S.push(k),R.normalize(),H.normalize(),F.normalize();const D=new le().crossVectors(H,F).normalize(),L=R.multiplyScalar(.5*E/U),j=new le().crossVectors(D,R).normalize().multiplyScalar(.5*N/W),B=new le(s.cx+w.x,s.cy+w.y,s.lz+w.z+k0+(a?r.thickness:0));B.add(L).add(j),L.multiplyScalar(2),j.multiplyScalar(2),C.push(L.length()*j.length());const O=new le,V=qr(n.ground,e.getMonth(),D,y),G=D.dot(o);for(let q=0;qc6||Q<0)&&(k[q][ie]+=V),G>0&&Q<0&&(k[q][ie]+=G*y)}}}}return{segmentIntensities:S,segmentUnitArea:C}}static computeFlatRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=me.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,g=new ln(0,0,l.rotation[2],"ZYX"),A=xi(o,f,u,li.SPHERE_MODEL),y=[],S=[];let C=Number.MAX_VALUE,P=Number.MAX_VALUE,v=-Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const k of a)for(const D of k){const L=D.clone().applyEuler(g);L.x>v&&(v=L.x),L.xT&&(T=L.y),L.yArray(x).fill(0));y.push(H),S.push(b*R);const F=a[0][0].z,E=new le(C+p/2,P+p/2,l.lz+F+k0+(i?r.thickness:0)),N=new le(0,0,E.z),U=qr(n.ground,e.getMonth(),ko,A),W=ko.dot(o);for(let k=0;kc6||L<0)&&(H[k][D]+=U),W>0&&L<0&&(H[k][D]+=W*A)}}return{segmentIntensities:y,segmentUnitArea:S}}static computeGableRoofSolarRadiationEnergy(e,n,o,r,i,a,l,s,c,u,d){const f=me.dayOfYear(e),p=n.solarRadiationHeatmapGridCellSize??.5,g=new ln(0,0,l.rotation[2],"ZYX"),A=xi(o,f,u,li.SPHERE_MODEL),y=[],S=[];for(const[C,P]of a.entries()){const v=r.id+"-"+C,T=P[0].clone().applyEuler(g),w=P[1].clone().applyEuler(g),x=P[2].clone().applyEuler(g),b=new le().subVectors(w,T),R=new le().subVectors(x,T),H=new le().subVectors(x,w),F=b.length(),E=new le().crossVectors(R,H).length()/F,N=Math.max(2,Math.round(F/p)),U=Math.max(2,Math.round(E/p)),W=Array(N).fill(0).map(()=>Array(U).fill(0));y.push(W),b.normalize(),R.normalize(),H.normalize();const k=new le().crossVectors(R,H).normalize(),D=b.multiplyScalar(.5*F/N),L=new le().crossVectors(k,b).normalize().multiplyScalar(.5*E/U),j=new le(l.cx+T.x,l.cy+T.y,l.lz+T.z+k0+(i?r.thickness:0));j.add(D).add(L),D.multiplyScalar(2),L.multiplyScalar(2),S.push(D.length()*L.length());const B=new le,O=qr(n.ground,e.getMonth(),k,A),V=k.dot(o);for(let G=0;Gc6||ie<0)&&(W[G][$]+=O),V>0&&ie<0&&(W[G][$]+=V*A)}}}return{segmentIntensities:y,segmentUnitArea:S}}static isPointRoof(e,n,o,r){if(n&&n.length>0)for(const i of n){const a=bn.getAbsoluteWindowVerticesOnRoof(i,r),l=me.getPoints(a);if(me.isPointInside(e.x,e.y,l))return!1}if(o&&o.length>0)for(const i of o){const a=bn.getAbsoluteSolarPanelVerticesOnRoof(i,r),l=me.getPoints(a);if(me.isPointInside(e.x,e.y,l))return!1}return!0}}const SBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(yA),r=M(Gr),i=M(s3),a=M(t5),l=Cn(Ige),s=Cn(yW),c=Cn(Dge),u=Cn(V8t),d=Cn(G8t),f=Cn(J8t),p=M(oa),g=dt(AW),A=dt(Ewt),y=dt(Xq),S=dt(Fwt),C=M.getState().world,P=M.getState().elements,v=C.noAnimationForThermalSimulation,T=C.highestTemperatureTimeInMinutes??900,w=m.useRef(0),x=m.useRef(!1),b=m.useRef(new Date(C.date)),R=m.useRef(0),H=m.useRef(!1),F=m.useRef(new Date(C.date)),E=m.useRef(0),N=m.useRef({high:20,low:0}),U=m.useRef(20),W=m.useRef(20),k=m.useRef(new Map),D=m.useRef(new Map),L=m.useRef(new Map),j=m.useRef([]),B=m.useRef([]),O=m.useRef(),V=m.useRef(),G=m.useRef(0),q=m.useRef(new Map),$=$t(),ie=u1(t),Q=new Date(C.date),se=t?ie==null?void 0:ie.elevation:0,oe=C.monthlyIrradianceLosses??new Array(12).fill(.05),Z=C.timesPerHour??4,te=60/Z,ee=C.daysPerYear??6,de=12/ee,{scene:fe}=ri(),pe=m.useMemo(()=>new l0,[]),ye=()=>a9(1,Xye(Q),yN(Q),me.toRadians(C.latitude)).normalize(),ae=(Be,$e,wt)=>{if(j.current.length>1){B.current.length=0,pe.set($e,wt);const vt=j.current.filter(Rt=>Rt.uuid!==Be);if(pe.intersectObjects(vt,!1,B.current),B.current.length>0)return B.current[0].distance}return-1},Te=()=>{const Be=fe.children.filter($e=>$e.name==="Content");if(Be.length>0){const $e=Be[0].children;j.current.length=0;for(const wt of $e)me.fetchSimulationElements(wt,j.current)}},ge=Be=>{if(ie){N.current=rb(Q,ie.lowestTemperatures,ie.highestTemperatures);const $e=me.minutesIntoDay(Be);U.current=ob(N.current.high,N.current.low,C.diurnalTemperatureModel??y2.Sinusoidal,T,dl(Be,C.latitude),$e),W.current=wZe(C.latitude,me.dayOfYear(Q),$e,ie.lowestTemperatures,ie.highestTemperatures,T,.5*(N.current.high-N.current.low),C.ground.thermalDiffusivity??.05,ije)}},Se=(Be,$e)=>{let wt=k.current.get(Be);wt||(wt=new Array(24).fill(0),k.current.set(Be,wt)),wt[Q.getHours()]+=$e},Re=(Be,$e)=>{let wt=D.current.get(Be);wt||(wt=new Array(24).fill(0),D.current.set(Be,wt)),wt[Q.getHours()]+=$e},De=(Be,$e)=>{let wt=L.current.get(Be);wt||(wt=new Array(24).fill(0),L.current.set(Be,wt)),wt[Q.getHours()]+=$e},Ae=()=>{var Be,$e,wt,vt;for(const Rt of P){if(me.onBuildingEnvelope(Rt)&&((Be=k.current.get(Rt.id))==null||Be.fill(0)),Rt.type===z.Roof)for(const Gt of k.current.keys())Gt!==Rt.id&&Gt.startsWith(Rt.id)&&(($e=k.current.get(Gt))==null||$e.fill(0));Rt.type===z.Foundation&&((wt=D.current.get(Rt.id))==null||wt.fill(0),(vt=L.current.get(Rt.id))==null||vt.fill(0))}},ue=()=>{q.current.clear()};m.useEffect(()=>{if(g)if(v&&!me.hasMovingParts(P))he();else return Te(),ve(),w.current=requestAnimationFrame(Pe),()=>{cancelAnimationFrame(w.current),x.current||(gn(Y.t("message.SimulationAborted",$)),e(Be=>{Be.world.date=b.current.toLocaleString("en-US")}),dt.getState().set(Be=>{Be.simulationInProgress=!1,Be.simulationPaused=!1})),H.current=!1}},[g]),m.useEffect(()=>{H.current=A,A?(F.current=new Date(Q.getTime()),cancelAnimationFrame(w.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",$))):(n("simulationPaused",!1),Q.setHours(Q.getHours(),Q.getMinutes()+te),Pe())},[A]);const he=()=>{Je()},ve=()=>{H.current?(Q.setTime(F.current.getTime()),H.current=!1):(b.current=new Date(C.date),E.current=me.dayOfYear(Q),Q.setHours(0,te/2)),x.current=!1,Ae(),ue()},we=()=>{for(const Be of P){if(me.onBuildingEnvelope(Be)||Be.type===z.SolarPanel){const $e=k.current.get(Be.id);$e&&u(Be.id,[...$e]);const wt=q.current.get(Be.id);wt&&l(Be.id,wt.map(vt=>[...vt]))}if(Be.type===z.Roof){for(const $e of k.current.keys())if($e!==Be.id&&$e.startsWith(Be.id)){const wt=k.current.get($e);wt&&u($e,[...wt]);const vt=q.current.get($e);vt&&l($e,vt.map(Rt=>[...Rt]))}}if(Be.type===z.Foundation){let $e=D.current.get(Be.id);$e&&d(Be.id,[...$e]),$e=L.current.get(Be.id),$e&&f(Be.id,[...$e])}}dt.getState().set(Be=>{Be.flagOfDailySimulation=!Be.flagOfDailySimulation,Be.runYearlyThermalSimulation||(Be.showSolarRadiationHeatmap=!0,Be.showHeatFluxes=!0)}),p&&!y&&setTimeout(()=>{e(Be=>{const $e=Cn.getState().totalBuildingHeater,wt=Cn.getState().totalBuildingAc,vt=Cn.getState().totalBuildingSolarPanel;Be.actionInfo={name:"Daily Building Energy Analysis Completed",result:{Heater:$e.toFixed(2),AC:wt.toFixed(2),SolarPanel:vt.toFixed(2),Net:($e+wt-vt).toFixed(2)},timestamp:new Date().getTime()}})},10)},Pe=()=>{if(g&&!H.current){if(Q.getMinutes()+Q.getHours()*60+(me.dayOfYear(Q)-E.current)*T2+te>T2){Je(),cancelAnimationFrame(w.current),e($e=>{$e.world.date=b.current.toLocaleString("en-US"),$e.viewState.showDailyBuildingEnergyPanel=!0,$e.selectedFloatingWindow="dailyBuildingEnergyPanel"}),dt.getState().set($e=>{$e.runDailyThermalSimulation=!1,$e.simulationPaused=!1,$e.simulationInProgress=!1}),gn(Y.t("message.SimulationCompleted",$)),x.current=!0,we();return}e($e=>{$e.world.date=Q.toLocaleString("en-US")}),Je(),w.current=requestAnimationFrame(Pe),Q.setHours(Q.getHours(),Q.getMinutes()+te)}},[Ie,Me]=m.useState(Q.getMonth());m.useEffect(()=>{setTimeout(()=>{Te()},200)},[Ie]),m.useEffect(()=>{if(y)if(dt.getState().set(Be=>{Be.showSolarRadiationHeatmap=!1,Be.showHeatFluxes=!1}),v&&!me.hasMovingParts(P))setTimeout(()=>{},50);else return ze(),Me(Q.getMonth()),Te(),w.current=requestAnimationFrame(Ne),()=>{cancelAnimationFrame(w.current),x.current||(gn(Y.t("message.SimulationAborted",$)),e(Be=>{Be.world.date=b.current.toLocaleString("en-US")}),dt.getState().set(Be=>{Be.simulationInProgress=!1,Be.simulationPaused=!1})),H.current=!1}},[y]),m.useEffect(()=>{H.current=S,S?(F.current=new Date(Q.getTime()),cancelAnimationFrame(w.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",$))):(n("simulationPaused",!1),Q.setHours(Q.getHours(),Q.getMinutes()+te),Ne())},[S]);const ze=()=>{H.current?(Q.setTime(F.current.getTime()),H.current=!1):(b.current=new Date(C.date),R.current=0,Q.setMonth(0,22),E.current=me.dayOfYear(Q),Q.setHours(0,te/2),e(Be=>{Be.viewState.showYearlyBuildingEnergyPanel=!0,Be.selectedFloatingWindow="yearlyBuildingEnergyPanel",Be.world.date=Q.toLocaleString("en-US")})),Ae(),ue(),x.current=!1},Ne=()=>{y&&!H.current&&(Q.getMinutes()+Q.getHours()*60+(me.dayOfYear(Q)-E.current)*T2{$e.world.date=Q.toLocaleString("en-US")}),Je(),Q.setHours(Q.getHours(),Q.getMinutes()+te),w.current=requestAnimationFrame(Ne)):(we(),R.current++,R.current===ee?(cancelAnimationFrame(w.current),setTimeout(()=>{e($e=>{$e.world.date=b.current.toLocaleString("en-US")})},10),dt.getState().set($e=>{$e.runYearlyThermalSimulation=!1,$e.simulationInProgress=!1,$e.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",$)),x.current=!0,p&&setTimeout(()=>{e($e=>{const wt=Cn.getState().totalBuildingHeater,vt=Cn.getState().totalBuildingAc,Rt=Cn.getState().totalBuildingSolarPanel;$e.actionInfo={name:"Yearly Building Energy Analysis Completed",result:{Heater:wt.toFixed(2),AC:vt.toFixed(2),SolarPanel:Rt.toFixed(2),Net:(wt+vt-Rt).toFixed(2)},timestamp:new Date().getTime()}})},10)):(Q.setMonth(R.current*de,22),Q.setHours(0,te/2),Me(Q.getMonth()),E.current=me.dayOfYear(Q),Ae(),ue(),w.current=requestAnimationFrame(Ne))))},Je=()=>{ge(Q),V.current=dl(Q,C.latitude);const Be=V.current.daylight()/60;G.current=Be>Et?ie.sunshineHours[Q.getMonth()]/(30*Be*Z):0,O.current=ye();for(const $e of P)switch($e.type){case z.Door:{st($e);break}case z.Window:{ke($e),Oe($e);break}case z.Wall:{je($e);break}case z.Roof:{const wt=$e;Ye(wt),xt(wt);break}case z.SolarPanel:{Ee($e);break}}},Ue=(Be,$e)=>{let wt=$e.efficiency;return $e.cellType==="Monocrystalline"&&(wt*=.95),wt*(1+$e.pmaxTC*(Be-25))},nt=()=>{if(!V.current)throw new Error("sun minutes not set");const Be=V.current.daylight()/60;return Be>Et?ie.sunshineHours[Q.getMonth()]/(30*Be*Z):0},We=Be=>{if(!a(Be.pvModelName))throw new Error("PV model not found");return Be.lx*Be.ly*(Be.inverterEfficiency??.95)*(1-oe[Q.getMonth()])},Ee=Be=>{const $e=o(Be);if($e){const wt=r(Be);if(wt){const vt=a(Be.pvModelName);if(O.current&&O.current.z>0){const Rt=ll.computeSolarPanelOutput(Q,C,O.current,vt,Be,wt,$e,se,ae),Gt=Ue(U.current,vt)*nt()*We(Be);if(De($e.id,Rt.average*Gt),g){for(let pt=0;pt{var wt;if(Be.interior)return;const $e=o(Be);if($e){const vt=r(Be);if(vt){const Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20,Gt=me.getWindowArea(Be,Be.parentType===z.Roof?void 0:vt),At=U.current-Rt;Be.empty?Se(Be.id,At*Gt*SO*.001/Z):Se(Be.id,At*Gt*(Be.uValue??X4)*.001/Z)}}},Oe=Be=>{if(Be.interior)return;const $e=o(Be);if($e){const wt=r(Be);if(wt){let vt=0;if(Be.parentType===z.Roof){const Rt=s(wt.id);if(!Rt)return;for(let Gt=0;Gt0){const At=ll.computeRoofWindowSolarRadiationEnergy(Q,C,O.current,Be,wt,$e,se,ae);for(let pt=0;pt0){const Rt=ll.computeWallWindowSolarRadiationEnergy(Q,C,O.current,Be,wt,$e,se,ae);for(let Gt=0;Gt{var wt;if(Be.interior)return;const $e=o(Be);if($e){const vt=r(Be);if(vt){const Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20,Gt=me.getDoorArea(Be,vt);if(Be.filled){const At=Z7(Be);let pt=0;if(O.current&&O.current.z>0){const ct=ll.computeDoorSolarRadiationEnergy(Q,C,O.current,Be,vt,$e,se,ae);for(let It=0;It{var wt;const $e=o(Be);if($e){const vt=Be.fill!==Fl.Empty&&Be.wallStructure===gc.Default,Rt=((wt=$e.hvacSystem)==null?void 0:wt.thermostatSetpoint)??20;if(vt){const Gt=Be.fill===Fl.Partial&&!me.isPartialWallFull(Be),At=me.getWallVertices(Be,0),pt=Gt?me.getPartialWallVertices(Be,0):At,Wt=me.getPolygonArea(At);let ht=Gt?me.getPolygonArea(pt):Wt;const ct=i(z.Window,Be.id),It=i(z.Door,Be.id),Ft=Z7(Be);let Ve=0;if(O.current&&O.current.z>0){const at=(Gt?pt.length:At.length)===4,Ge=i(z.SolarPanel,Be.id),yt=ll.computeWallSolarRadiationEnergy(Q,C,O.current,Be,$e,ct,It,Ge,at?0:1,se,ae);for(let Pt=0;Pt0)for(const at of ct)ht-=me.getWindowArea(at,Be);if(It&&It.length>0)for(const at of It)ht-=at.lx*at.lz*Be.lx*Be.lz;const ft=me.isZero(Ve)||me.isZero(Ft)?0:Ve*Ft/((Be.volumetricHeatCapacity??.5)*ht*Be.ly);let rt=(U.current+ft-Rt)*ht/(Be.rValue??p6)*.001/Z;Gt&&Be.openToOutside&&(rt+=(U.current-Rt)*(Wt-ht)*SO*.001/Z),Se(Be.id,rt)}else if(Be.openToOutside){const Gt=me.getWallVertices(Be,0),At=me.getPolygonArea(Gt),pt=U.current-Rt;Se(Be.id,pt*At*SO*.001/Z)}}},xt=Be=>{var Gt;const $e=o(Be);if(!$e)return;const wt=((Gt=$e.hvacSystem)==null?void 0:Gt.thermostatSetpoint)??20,vt=me.calculateBuildingArea(Be),Rt=W.current-wt;Se($e.id,Rt*vt/($e.rValue??i8)*.001/Z)},gt=(Be,$e,wt)=>{const vt=1/(Be.rValue??a8),Rt=1/(Be.ceilingRValue??w6);return(vt*$e+Rt*wt)/(vt+Rt)},Ye=Be=>{var Rt;const $e=o(Be);if(!$e)return;const wt=s(Be.id);if(!wt)return;let vt;switch(Be.roofType){case Go.Pyramid:vt=it(Be,wt,$e);break;case Go.Hip:vt=ut(Be,wt,$e);break;case Go.Gable:vt=Ze(Be,wt,$e);break;case Go.Gambrel:vt=Qe(Be,wt,$e);break;case Go.Mansard:vt=lt(Be,wt,$e);break}if(vt){const Gt=((Rt=$e.hvacSystem)==null?void 0:Rt.thermostatSetpoint)??20;let At=0;for(const[pt,Wt]of vt.entries()){const ct=(Wt.surfaceTemperature-(Be.ceiling?gt(Be,Wt.surfaceTemperature,Gt):Gt))*Wt.totalArea/(Be.rValue??a8)*.001/Z;Se(Be.id+"-"+pt,ct),At+=ct}Se(Be.id,At)}},it=(Be,$e,wt)=>{if(Be.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const Ve of $e)for(const ft of Ve)if(Math.abs(ft.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=i(z.Window,Be.id),Wt=[];if(Rt){let Ve=0;for(const ft of $e){const kt=[];for(const rt of ft)kt.push(me.mapVector3ToPoint2(rt));Ve+=me.getPolygonArea(kt)}if(pt.length>0){for(const ft of pt)Ve-=ft.lx*ft.lz;Ve<0&&(Ve=0)}Wt.push(Ve)}else for(const Ve of $e){let ft=me.getTriangleArea(Ve[0],Ve[1],Ve[2]);if(pt.length>0){for(const kt of pt)bn.onSegment(Ve,kt.cx,kt.cy)&&(ft-=kt.lx*kt.lz);ft<0&&(ft=0)}Wt.push(ft)}const ht=Z7(Be),ct=Array(At).fill(0);if(O.current&&O.current.z>0){const Ve=i(z.SolarPanel,Be.id),ft=ll.computePyramidRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,pt,Ve,se,ae);for(let kt=0;kt{if(Be.roofType!==Go.Hip)throw new Error("roof is not hip");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const ft of $e)for(const kt of ft)if(Math.abs(kt.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(const ft of $e){let kt=0;if(ft.length===3?kt=me.getTriangleArea(ft[0],ft[1],ft[2]):ft.length===4&&(kt=me.getTriangleArea(ft[0],ft[1],ft[2])+me.getTriangleArea(ft[2],ft[3],ft[0])),Wt.length>0){for(const rt of Wt)bn.onSegment(ft,rt.cx,rt.cy)&&(kt-=rt.lx*rt.lz);kt<0&&(kt=0)}pt.push(kt)}const ht=Rt?[pt.reduce((ft,kt)=>ft+kt,0)]:pt,ct=Z7(Be),It=Array(At).fill(0);if(O.current&&O.current.z>0){const ft=i(z.SolarPanel,Be.id),kt=ll.computeHipRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,ft,se,ae);for(let rt=0;rt{if(Be.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const ft of $e)for(const kt of ft)if(Math.abs(kt.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(const ft of $e){let kt=me.getTriangleArea(ft[0],ft[1],ft[2])+me.getTriangleArea(ft[2],ft[3],ft[0]);if(Wt.length>0){for(const rt of Wt)bn.onSegment(ft,rt.cx,rt.cy)&&(kt-=rt.lx*rt.lz);kt<0&&(kt=0)}pt.push(kt)}const ht=Rt?[pt.reduce((ft,kt)=>ft+kt,0)]:pt,ct=Z7(Be),It=Array(At).fill(0);if(O.current&&O.current.z>0){const ft=i(z.SolarPanel,Be.id),kt=ll.computeGambrelRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,ft,se,ae);for(let rt=0;rt{if(Be.roofType!==Go.Mansard)throw new Error("roof is not mansard");const vt=$e.length;if(vt===0)return;let Rt=!0;const Gt=$e[0][0].z;for(const at of $e)for(const Ge of at)if(Math.abs(Ge.z-Gt)>.01){Rt=!1;break}const At=Rt?1:vt,pt=[],Wt=i(z.Window,Be.id);for(let at=0;at0){for(const Pt of Wt)bn.onSegment(Ge,Pt.cx,Pt.cy)&&(yt-=Pt.lx*Pt.lz);yt<0&&(yt=0)}pt.push(yt)}const ht=$e[vt-1],ct=new Array;for(const at of ht)ct.push({x:at.x,y:at.y});let It=me.getPolygonArea(ct);if(Wt.length>0){for(let at=Wt.length-1;at>=0;at--){const Ge=Wt[at];bn.onSegment(ht,Ge.cx,Ge.cy)&&(It-=Ge.lx*Ge.lz,Wt.splice(at,1))}It<0&&(It=0)}pt.push(It);const Ft=Rt?[pt.reduce((at,Ge)=>at+Ge,0)]:pt,Ve=Z7(Be),ft=Array(At).fill(0);if(O.current&&O.current.z>0){const at=i(z.SolarPanel,Be.id),Ge=ll.computeMansardRoofSolarRadiationEnergy(Q,C,O.current,Be,Rt,!0,$e,wt,Wt,at,se,ae);for(let yt=0;yt{if(Be.roofType!==Go.Gable)throw new Error("roof is not gable");const vt=$e.length;if(vt===0)return;const Rt=i(z.Window,Be.id),Gt=[];for(const ct of $e){let It=me.getTriangleArea(ct[0],ct[1],ct[2])+me.getTriangleArea(ct[2],ct[3],ct[0]);if(Rt.length>0){for(const Ft of Rt)bn.onSegment(ct,Ft.cx,Ft.cy)&&(It-=Ft.lx*Ft.lz);It<0&&(It=0)}Gt.push(It)}const At=Z7(Be),pt=Array(vt).fill(0);if(O.current&&O.current.z>0){const ct=i(z.SolarPanel,Be.id),It=ll.computeGableRoofSolarRadiationEnergy(Q,C,O.current,Be,!0,$e,wt,Rt,ct,se,ae);for(let Ft=0;Ft{const e=M.getState().world,n=M.getState().elements,o=M(Gr),r=M(yA),i=Cn(Ige),a=Cn(JBe),l=dt(Lge),s=Cn(Dge),{scene:c}=ri(),u=$t(),d=u1(t),f=new Date(e.date),p=t?d==null?void 0:d.elevation:0,g=60/e.timesPerHour,A=m.useMemo(()=>new l0,[]),y=e.solarRadiationHeatmapGridCellSize??.5,S=m.useRef([]),C=m.useRef([]);m.useEffect(()=>{l&&n&&n.length>0&&(a(),T(),dt.getState().set(B=>{B.runStaticSimulation=!1,B.simulationInProgress=!1,B.showSolarRadiationHeatmap=!0}),gn(Y.t("message.SimulationCompleted",u)))},[l]);const P=(B,O,V)=>{if(S.current.length>1){C.current.length=0,A.set(O,V);const G=S.current.filter(q=>q.uuid!==B);return A.intersectObjects(G,!1,C.current),C.current.length>0}return!1},v=()=>{const B=c.children.filter(O=>O.name==="Content");if(B.length>0){const O=B[0].children;S.current.length=0;for(const V of O)me.fetchSimulationElements(V,S.current)}},T=()=>{v();for(const B of n)switch(B.type){case z.Foundation:{const O=B;x(O),O.solarStructure===Dn.UpdraftTower&&b(O);break}case z.Cuboid:{w(B);break}case z.SolarPanel:{R(B);break}case z.SolarWaterHeater:{H(B);break}case z.Wall:{F(B);break}case z.Door:{E(B);break}case z.Roof:{const O=B;switch(O.roofType){case Go.Pyramid:N(O);break;case Go.Gable:L(O);break;case Go.Gambrel:W(O);break;case Go.Mansard:U(O);break;case Go.Hip:k(O);break}break}}},w=B=>{const O=f.getFullYear(),V=f.getMonth(),G=f.getDate(),q=me.dayOfYear(f),$=B.lx,ie=B.ly,Q=B.lz,se=Math.max(2,Math.round($/y)),oe=Math.max(2,Math.round(ie/y)),Z=Math.max(2,Math.round(Q/y)),te=$/se,ee=ie/oe,de=Q/Z,fe=o(B);let pe=B.cx,ye=B.cy,ae=B.cz;if(fe&&fe.type===z.Cuboid){const ke=me.getWorldDataById(B.id);pe=ke.pos.x,ye=ke.pos.y,ae=ke.pos.z}const Te=Array(se).fill(0).map(()=>Array(oe).fill(0)),ge=Array(se).fill(0).map(()=>Array(Z).fill(0)),Se=Array(se).fill(0).map(()=>Array(Z).fill(0));let Re=Array(oe).fill(0).map(()=>Array(Z).fill(0)),De=Array(oe).fill(0).map(()=>Array(Z).fill(0));const Ae=ko,ue=_p.clone().applyAxisAngle(ko,B.rotation[2]),he=Yc.clone().applyAxisAngle(ko,B.rotation[2]),ve=Vp.clone().applyAxisAngle(ko,B.rotation[2]),we=Op.clone().applyAxisAngle(ko,B.rotation[2]),Pe=new le;let Ie=0;const Me=new Kt(pe,ye),ze=new Kt,Ne=ye-ie/2,Je=ye+ie/2,Ue=pe-$/2,nt=pe+$/2;for(let ke=0;ke<24;ke++)for(let Oe=0;Oe0){Ie++;const xt=xi(je,q,p,li.SPHERE_MODEL);let gt=qr(e.ground,V,Ae,xt),Ye=Ae.dot(je),it=pe-$/2,ut=ye-ie/2;const Qe=ae+Q/2;for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,ut+(Ze+.5)*ee),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,Qe),P(B.id,Pe,je)||(Te[lt][Ze]+=Ye*xt));it=pe-$/2,ut=ae-Q/2,gt=qr(e.ground,V,ue,xt),Ye=ue.dot(je);for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,Ne),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(ge[lt][Ze]+=Ye*xt));gt=qr(e.ground,V,he,xt),Ye=he.dot(je);for(let lt=0;lt0&&(ze.set(it+(lt+.5)*te,Je),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Z-(Ze+.5))*de),P(B.id,Pe,je)||(Se[lt][Ze]+=Ye*xt));it=ye-ie/2,ut=ae-Q/2,gt=qr(e.ground,V,ve,xt),Ye=ve.dot(je);for(let lt=0;lt0&&(ze.set(Ue,it+(lt+.5)*ee),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(Re[lt][Ze]+=Ye*xt));gt=qr(e.ground,V,we,xt),Ye=we.dot(je);for(let lt=0;lt0&&(ze.set(nt,it+(lt+.5)*ee),ze.rotateAround(Me,B.rotation[2]),Pe.set(ze.x,ze.y,ut+(Ze+.5)*de),P(B.id,Pe,je)||(De[lt][Ze]+=Ye*xt))}}Re=me.transpose(Re),De=me.transpose(De);const We=Ie*g/60,Ee=We>Et?d.sunshineHours[V]/(30*We*e.timesPerHour):0;j(Te,Ee),j(ge,Ee),j(Se,Ee),j(Re,Ee),j(De,Ee),i(B.id+"-top",Te),i(B.id+"-south",ge),i(B.id+"-north",Se),i(B.id+"-west",Re),i(B.id+"-east",De)},x=B=>{const O=f.getFullYear(),V=f.getMonth(),G=f.getDate(),q=me.dayOfYear(f),$=B.lx,ie=B.ly,Q=B.lz,se=Math.max(2,Math.round($/y)),oe=Math.max(2,Math.round(ie/y)),Z=$/se,te=ie/oe,ee=B.cx-$/2,de=B.cy-ie/2,fe=new Kt(B.cx,B.cy),pe=new le,ye=Array(se).fill(0).map(()=>Array(oe).fill(0));let ae=0;for(let Se=0;Se<24;Se++)for(let Re=0;Re0){ae++;const ue=xi(Ae,q,p,li.SPHERE_MODEL),he=qr(e.ground,V,ko,ue),ve=ko.dot(Ae),we=new Kt;for(let Pe=0;Pe0&&(we.set(ee+(Pe+.5)*Z,de+(Ie+.5)*te),we.rotateAround(fe,B.rotation[2]),pe.set(we.x,we.y,Q),P(B.id,pe,Ae)||(ye[Pe][Ie]+=ve*ue))}}const Te=ae*g/60,ge=Te>Et?d.sunshineHours[V]/(30*Te*e.timesPerHour):0;j(ye,ge),i(B.id,ye)},b=B=>{const O=B.solarUpdraftTower;if(!O)return;const V=f.getFullYear(),G=f.getMonth(),q=f.getDate(),$=me.dayOfYear(f),ie=O.collectorRadius,Q=Math.max(2,Math.round(ie*2/y)),se=B.cx-ie+y/2,oe=B.cy-ie+y/2,Z=B.lz+O.collectorHeight,te=Array(Q).fill(0).map(()=>Array(Q).fill(0)),ee=new le(0,0,Z),de=ie*ie;let fe=0,pe,ye;for(let ge=0;ge<24;ge++)for(let Se=0;Se0){fe++;const Ae=xi(De,$,p,li.SPHERE_MODEL),ue=qr(e.ground,G,ko,Ae),he=ko.dot(De);for(let ve=0;vede)&&(te[ve][we]+=ue,he>0&&(P(B.id+"-sut",ee,De)||(te[ve][we]+=he*Ae)))}}}const ae=fe*g/60,Te=ae>Et?d.sunshineHours[G]/(30*ae*e.timesPerHour):0;j(te,Te),i(B.id+"-sut",te)},R=B=>{if(B.trackerType!==Ll.NO_TRACKER)throw new Error("trackers cannot use static simulation");let O=o(B);if(!O)throw new Error("parent of solar panel does not exist");const V=B.parentType===z.Roof,G=B.parentType===z.Wall;if(V&&(O=r(O),!O))throw new Error("foundation of solar panel does not exist");const q=G?me.absoluteCoordinates(B.cx,B.cy,B.cz,O,r(B),B.lz):me.absoluteCoordinates(B.cx,B.cy,B.cz,O,void 0,void 0,!0),$=new le().fromArray(B.normal);G&&$.applyEuler(new ln(0,0,O.relativeAngle));const ie=O.rotation[2];let Q=ie+(G?0:B.relativeAzimuth),se=B.tiltAngle,oe=!0;if(V&&(q.z=B.cz+B.lz+.02+O.cz,me.isZero(B.rotation[0])?q.z+=B.poleHeight:(se=B.rotation[0],Q=ie,oe=!1)),G&&!me.isZero(B.tiltAngle)){const Me=O,ze=r(O),Je=(ze?ze.rotation[2]+Me.relativeAngle:Me.relativeAngle)-Qt,Ue=B.ly*Math.abs(Math.sin(B.tiltAngle))/2;q.x+=Ue*Math.cos(Je),q.y+=Ue*Math.sin(Je)}const Z=new ln(V&&!oe?0:se,0,Q,"ZYX");$.applyEuler(Z);const te=f.getFullYear(),ee=f.getMonth(),de=f.getDate(),fe=me.dayOfYear(f),pe=B.lx,ye=B.ly,ae=Math.max(2,Math.round(B.lx/y)),Te=Math.max(2,Math.round(B.ly/y)),ge=pe/ae,Se=ye/Te,Re=q.x-(pe-y)/2,De=q.y-(ye-y)/2,Ae=V||G?q.z:O.lz+B.poleHeight+B.lz,ue=new Kt(q.x,q.y),he=new le,ve=Array(ae).fill(0).map(()=>Array(Te).fill(0));let we=0;if(V&&!oe&&(Z.x=B.rotation[0],Z.z=B.rotation[2]+ie),G){const Me=o(B);Me&&(Z.x=Qt+B.tiltAngle,Z.z=O.relativeAngle+Me.rotation[2])}for(let Me=0;Me<24;Me++)for(let ze=0;ze0){we++;const Ue=xi(Je,fe,p,li.SPHERE_MODEL),nt=qr(e.ground,ee,$,Ue),We=$.dot(Je),Ee=new Kt,ke=new le;for(let Oe=0;Oe0&&(Ee.set(Re+Oe*ge,De+st*Se),ke.set(Ee.x-ue.x,Ee.y-ue.y,0),ke.applyEuler(Z),he.set(q.x+ke.x,q.y+ke.y,Ae+ke.z),P(B.id,he,Je)||(ve[Oe][st]+=We*Ue))}}const Pe=we*g/60,Ie=Pe>Et?d.sunshineHours[ee]/(30*Pe*e.timesPerHour):0;j(ve,Ie),i(B.id,ve)},H=B=>{const O=o(B);if(!O)throw new Error("parent of solar water heater does not exist");const V=r(O);if(!V)throw new Error("foundation of solar water heater does not exist");const G=me.absoluteCoordinates(B.cx,B.cy,B.cz,V,void 0,void 0,!0),q=new ln,$=(B.lz-B.waterTankRadius)/2,ie=Math.atan2(B.lz-B.waterTankRadius,B.ly);me.isZero(B.rotation[0])?(q.set(ie,0,B.relativeAzimuth+V.rotation[2],"ZXY"),G.z+=$):(q.set(B.rotation[0]+ie,0,B.rotation[2]+V.rotation[2],"ZXY"),G.add(new le(0,0,$).applyEuler(q)));const se=new le(0,0,1).applyEuler(q),oe=f.getFullYear(),Z=f.getMonth(),te=f.getDate(),ee=me.dayOfYear(f),de=B.lx,fe=Math.hypot(B.ly,B.lz-B.waterTankRadius),pe=Math.max(2,Math.round(B.lx/y)),ye=Math.max(2,Math.round(B.ly/y)),ae=de/pe,Te=fe/ye,ge=-(de-y)/2,Se=-(fe-y)/2,Re=Array(pe).fill(0).map(()=>Array(ye).fill(0));let De=0;for(let he=0;he<24;he++)for(let ve=0;ve0){De++;const Ie=xi(Pe,ee,p,li.SPHERE_MODEL),Me=qr(e.ground,Z,se,Ie),ze=se.dot(Pe),Ne=new Kt,Je=new le;for(let Ue=0;Ue0&&(Ne.set(ge+Ue*ae,Se+nt*Te),Je.set(Ne.x,Ne.y,0).applyEuler(q).add(G),P(B.id,Je,Pe)||(Re[Ue][nt]+=ze*Ie))}}const Ae=De*g/60,ue=Ae>Et?d.sunshineHours[Z]/(30*Ae*e.timesPerHour):0;j(Re,ue),i(B.id,Re)},F=B=>{const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=f.getFullYear(),G=f.getMonth(),q=f.getDate(),$=me.dayOfYear(f),ie=B.lx,Q=me.getHighestPointOfWall(B),se=Math.max(2,Math.round(ie/y)),oe=Math.max(2,Math.round(Q/y)),Z=ie/se,te=Q/oe,ee=O.rotation[2]+B.relativeAngle,de=me.wallAbsolutePosition(new le(B.cx,B.cy,Q/2),O).setZ(Q/2+O.lz),fe=new le(Math.cos(ee-Qt),Math.sin(ee-Qt),0),pe=new le,ye=Array(se).fill(0).map(()=>Array(oe).fill(0));let ae=0;const Te=Z*Math.cos(ee),ge=Z*Math.sin(ee),Se=me.getWallVertices(B,2),Re=(Q-B.lz)/2;for(let ue=0;ue<24;ue++)for(let he=0;he0){ae++;const Pe=xi(we,$,p,li.SPHERE_MODEL),Ie=qr(e.ground,G,fe,Pe),Me=fe.dot(we);for(let ze=0;ze0&&(pe.set(de.x+Je*Te,de.y+Je*ge,de.z+Ue*te),P(B.id,pe,we)||(ye[ze][Ne]+=Me*Pe)))}}}const De=ae*g/60,Ae=De>Et?d.sunshineHours[G]/(30*De*e.timesPerHour):0;j(ye,Ae),i(B.id,ye)},E=B=>{const O=r(B);if(!O)throw new Error("foundation of door not found");const V=o(B);if(!V)throw new Error("parent of door not found");const G=V,q=f.getFullYear(),$=f.getMonth(),ie=f.getDate(),Q=me.dayOfYear(f),se=B.lx*G.lx,oe=B.lz*G.lz,Z=Math.max(2,Math.round(se/y)),te=Math.max(2,Math.round(oe/y)),ee=se/Z,de=oe/te,fe=O.rotation[2]+G.relativeAngle,ye=me.wallAbsolutePosition(new le(G.cx,G.cy,G.cz),O).setZ(G.lz/2+O.lz).clone().add(new le(B.cx*G.lx,0,B.cz*G.lz)),ae=new le(Math.cos(fe-Qt),Math.sin(fe-Qt),0),Te=new le,ge=Array(Z).fill(0).map(()=>Array(te).fill(0));let Se=0;const Re=ee*Math.cos(fe),De=ee*Math.sin(fe);for(let he=0;he<24;he++)for(let ve=0;ve0){Se++;const Ie=xi(Pe,Q,p,li.SPHERE_MODEL),Me=qr(e.ground,$,ae,Ie),ze=ae.dot(Pe);if(B.doorType===Rd.Arched)for(let Ne=0;Ne0&&(P(B.id,Te,Pe)||(ge[Ne][Je]+=ze*Ie)))}else for(let Ne=0;Ne0&&(Te.set(ye.x+Ue*Re,ye.y+Ue*De,ye.z+nt*de),P(B.id,Te,Pe)||(ge[Ne][Je]+=ze*Ie))}}}const Ae=Se*g/60,ue=Ae>Et?d.sunshineHours[$]/(30*Ae*e.timesPerHour):0;j(ge,ue),i(B.id,ge)},N=B=>{if(B.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=me.dayOfYear(f),oe=new ln(0,0,O.rotation[2],"ZYX");for(const[Z,te]of V.entries()){const ee=B.id+"-"+Z,de=te[0].clone().applyEuler(oe),fe=te[1].clone().applyEuler(oe),pe=te[2].clone().applyEuler(oe),ye=new le().subVectors(fe,de),ae=new le().subVectors(pe,de),Te=new le().subVectors(pe,fe),ge=ye.length(),Se=new le().crossVectors(ae,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));ye.normalize(),ae.normalize(),Te.normalize();const ue=new le().crossVectors(ae,Te).normalize(),he=ye.multiplyScalar(.5*ge/Re),ve=new le().crossVectors(ue,ye).normalize().multiplyScalar(.5*Se/De),we=new le(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(he).add(ve),he.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new le;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(ee,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(ee,Ae)}}},U=B=>{if(B.roofType!==Go.Mansard)throw new Error("roof is not mansard");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=me.dayOfYear(f),oe=new ln(0,0,O.rotation[2],"ZYX");for(const[Z,te]of V.entries()){const ee=B.id+"-"+Z;if(Z===V.length-1){let de=Number.MAX_VALUE,fe=Number.MAX_VALUE,pe=-Number.MAX_VALUE,ye=-Number.MAX_VALUE;for(const Pe of te){const Ie=Pe.clone().applyEuler(oe);Ie.x>pe&&(pe=Ie.x),Ie.xye&&(ye=Ie.y),Ie.yArray(ge).fill(0)),Ae=new le(de+y/2,fe+y/2,O.lz+ae+k0);let ue=0;const he=new le(0,0,Ae.z);for(let Pe=0;Pe<24;Pe++)for(let Ie=0;Ie0){ue++;const Ne=xi(ze,se,p,li.SPHERE_MODEL),Je=qr(e.ground,ie,ko,Ne),Ue=ko.dot(ze);for(let nt=0;nt0&&(he.y=Ae.y+We*Re,P(ee,he,ze)||(De[nt][We]+=Ue*Ne))}}}const ve=ue*g/60,we=ve>Et?d.sunshineHours[ie]/(30*ve*e.timesPerHour):0;j(De,we),i(ee,De)}else{const de=te[0].clone().applyEuler(oe),fe=te[1].clone().applyEuler(oe),pe=te[2].clone().applyEuler(oe),ye=new le().subVectors(fe,de),ae=new le().subVectors(pe,de),Te=new le().subVectors(pe,fe),ge=ye.length(),Se=new le().crossVectors(ae,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));ye.normalize(),ae.normalize(),Te.normalize();const ue=new le().crossVectors(ae,Te).normalize(),he=ye.multiplyScalar(.5*ge/Re),ve=new le().crossVectors(ue,ye).normalize().multiplyScalar(.5*Se/De),we=new le(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(he).add(ve),he.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new le;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(ee,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(ee,Ae)}}}},W=B=>{if(B.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=me.dayOfYear(f),oe=new ln(0,0,O.rotation[2],"ZYX");for(const[Z,te]of V.entries()){const ee=B.id+"-"+Z,de=te[0].clone().applyEuler(oe),fe=te[1].clone().applyEuler(oe),pe=te[2].clone().applyEuler(oe),ye=new le().subVectors(fe,de),ae=new le().subVectors(pe,de),Te=new le().subVectors(pe,fe),ge=ye.length(),Se=new le().crossVectors(ae,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));ye.normalize(),ae.normalize(),Te.normalize();const ue=new le().crossVectors(ae,Te).normalize(),he=ye.multiplyScalar(.5*ge/Re),ve=new le().crossVectors(ue,ye).normalize().multiplyScalar(.5*Se/De),we=new le(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);we.add(he).add(ve),he.multiplyScalar(2),ve.multiplyScalar(2);let Pe=0;const Ie=new le;for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){Pe++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Ie.copy(we).add(st).add(ve.clone().multiplyScalar(je)),P(ee,Ie,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=Pe*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(ee,Ae)}}},k=B=>{if(B.roofType!==Go.Hip)throw new Error("roof is not hip");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;let G=!0;const q=V[0][0].z;for(const $ of V)for(const ie of $)if(Math.abs(ie.z-q)>.01){G=!1;break}if(G)D(B,O,V);else{const $=f.getFullYear(),ie=f.getMonth(),Q=f.getDate(),se=me.dayOfYear(f),oe=new ln(0,0,O.rotation[2],"ZYX");for(const[Z,te]of V.entries()){const ee=B.id+"-"+Z,de=te[0].clone().applyEuler(oe),fe=te[1].clone().applyEuler(oe),pe=te[2].clone().applyEuler(oe),ye=new le().subVectors(fe,de),ae=new le().subVectors(pe,de),Te=new le().subVectors(pe,fe),ge=ye.length(),Se=new le().crossVectors(ae,Te).length()/ge,Re=Math.max(2,Math.round(ge/y)),De=Math.max(2,Math.round(Se/y)),Ae=Array(Re).fill(0).map(()=>Array(De).fill(0));ye.normalize(),ae.normalize(),Te.normalize();const ue=new le().crossVectors(ae,Te).normalize(),he=ye.multiplyScalar(.5*ge/Re),ve=new le().crossVectors(ue,ye).normalize().multiplyScalar(.5*Se/De);let we=0;const Pe=new le,Ie=new le(O.cx+de.x,O.cy+de.y,O.lz+de.z+k0);if(Ie.add(he).add(ve),he.multiplyScalar(2),ve.multiplyScalar(2),Z%2===0)for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){we++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Pe.copy(Ie).add(st).add(ve.clone().multiplyScalar(je)),P(ee,Pe,nt)||(Ae[Oe][je]+=ke*We))}}}else for(let Ne=0;Ne<24;Ne++)for(let Je=0;Je0){we++;const We=xi(nt,se,p,li.SPHERE_MODEL),Ee=qr(e.ground,ie,ue,We),ke=ue.dot(nt);for(let Oe=0;Oe0&&(Pe.copy(Ie).add(st).add(ve.clone().multiplyScalar(je)),P(ee,Pe,nt)||(Ae[Oe][je]+=ke*We))}}}const Me=we*g/60,ze=Me>Et?d.sunshineHours[ie]/(30*Me*e.timesPerHour):0;j(Ae,ze),i(ee,Ae)}}},D=(B,O,V)=>{const G=f.getFullYear(),q=f.getMonth(),$=f.getDate(),ie=me.dayOfYear(f),Q=new ln(0,0,O.rotation[2],"ZYX"),se=V[0][0].z;let oe=Number.MAX_VALUE,Z=Number.MAX_VALUE,te=-Number.MAX_VALUE,ee=-Number.MAX_VALUE;for(const Ae of V)for(const ue of Ae){const he=ue.clone().applyEuler(Q);he.x>te&&(te=he.x),he.xee&&(ee=he.y),he.yArray(fe).fill(0)),Te=new le(oe+y/2,Z+y/2,O.lz+se+k0);let ge=0;const Se=new le(0,0,Te.z);for(let Ae=0;Ae<24;Ae++)for(let ue=0;ue0){ge++;const we=xi(ve,ie,p,li.SPHERE_MODEL),Pe=qr(e.ground,q,ko,we),Ie=ko.dot(ve);for(let Me=0;Me0&&(Se.y=Te.y+ze*ye,P(B.id,Se,ve)||(ae[Me][ze]+=Ie*we))}}}const Re=ge*g/60,De=Re>Et?d.sunshineHours[q]/(30*Re*e.timesPerHour):0;j(ae,De),i(B.id,ae)},L=B=>{if(B.roofType!==Go.Gable)throw new Error("roof is not gable");const O=r(B);if(!O)throw new Error("foundation of wall not found");const V=s(B.id);if(!V||V.length===0)return;const G=f.getFullYear(),q=f.getMonth(),$=f.getDate(),ie=me.dayOfYear(f),Q=new ln(0,0,O.rotation[2],"ZYX");for(const[se,oe]of V.entries()){const Z=B.id+"-"+se,te=oe[0].clone().applyEuler(Q),ee=oe[1].clone().applyEuler(Q),de=oe[2].clone().applyEuler(Q),fe=new le().subVectors(ee,te),pe=new le().subVectors(de,te),ye=new le().subVectors(de,ee),ae=fe.length(),Te=new le().crossVectors(pe,ye).length()/ae,ge=Math.max(2,Math.round(ae/y)),Se=Math.max(2,Math.round(Te/y)),Re=Array(ge).fill(0).map(()=>Array(Se).fill(0));fe.normalize(),pe.normalize(),ye.normalize();const De=new le().crossVectors(pe,ye).normalize(),Ae=fe.multiplyScalar(.5*ae/ge),ue=new le().crossVectors(De,fe).normalize().multiplyScalar(.5*Te/Se),he=new le(O.cx+te.x,O.cy+te.y,O.lz+te.z+k0);he.add(Ae).add(ue),Ae.multiplyScalar(2),ue.multiplyScalar(2);let ve=0;const we=new le;for(let Me=0;Me<24;Me++)for(let ze=0;ze0){ve++;const Ue=xi(Je,ie,p,li.SPHERE_MODEL),nt=qr(e.ground,q,De,Ue),We=De.dot(Je);for(let Ee=0;Ee0&&(we.copy(he).add(ke).add(ue.clone().multiplyScalar(Oe)),P(Z,we,Je)||(Re[Ee][Oe]+=We*Ue))}}}const Pe=ve*g/60,Ie=Pe>Et?d.sunshineHours[q]/(30*Pe*e.timesPerHour):0;j(Re,Ie),i(Z,Re)}},j=(B,O)=>{for(let V=0;V{const e=M(pn),n=dt(Rf),o=M.getState().world,r=M.getState().elements,i=M(Gr),a=M(yA),l=Cn(Ige),s=Cn(JBe),c=dt(wW),u=dt(Wwt),d=M(xge),f=Cn(Dge),{scene:p}=ri(),g=$t(),A=u1(t),y=new Date(o.date),S=t?A==null?void 0:A.elevation:0,C=60/o.timesPerHour,P=m.useMemo(()=>new l0,[]),v=o.solarRadiationHeatmapGridCellSize??.5,T=m.useRef([]),w=m.useRef([]),x=m.useRef(0),b=m.useRef(!1),R=m.useRef(new Date(o.date)),H=m.useRef(new Map),F=m.useRef(!1),E=m.useRef(new Date(o.date)),N=m.useMemo(()=>dl(y,o.latitude),[o.date,o.latitude]);m.useEffect(()=>{if(c)return U(),x.current=requestAnimationFrame(D),()=>{cancelAnimationFrame(x.current),b.current||(gn(Y.t("message.SimulationAborted",g)),e(ae=>{ae.world.date=R.current.toLocaleString("en-US")}),n("simulationInProgress",!1))}},[c]),m.useEffect(()=>{F.current=u,u?(E.current=new Date(y.getTime()),cancelAnimationFrame(x.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",g))):(n("simulationPaused",!1),D())},[u]);const U=()=>{n("simulationInProgress",!0),y.setHours(Math.floor(N.sunrise/60),N.sunrise%60),R.current=new Date(o.date),b.current=!1,j();for(const ae of r)switch(ae.type){case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{H.current.delete(ae.id);break}case z.Cuboid:{H.current.delete(ae.id+"-top"),H.current.delete(ae.id+"-north"),H.current.delete(ae.id+"-south"),H.current.delete(ae.id+"-west"),H.current.delete(ae.id+"-east");break}case z.Roof:{const Te=ae,ge=f(Te.id);if(ge){const Se=ge.length;for(let Re=0;Re{s();const ae=N.daylight()/60,Te=ae>Et?A.sunshineHours[y.getMonth()]/(30*ae*o.timesPerHour):0;for(const ge of r){switch(ge.type){case z.Foundation:case z.Wall:case z.Door:case z.SolarPanel:case z.SolarWaterHeater:case z.ParabolicTrough:case z.ParabolicDish:case z.FresnelReflector:case z.Heliostat:{const Se=H.current.get(ge.id);if(Se){for(let Re=0;Re[...Re]))}break}case z.Cuboid:{k(ge.id,"top",Te),k(ge.id,"south",Te),k(ge.id,"north",Te),k(ge.id,"west",Te),k(ge.id,"east",Te);break}case z.Roof:{const Se=ge,Re=f(Se.id);if(Re&&Re.length>0){if(Se.roofType===Go.Pyramid||Se.roofType===Go.Mansard||Se.roofType===Go.Gambrel||Se.roofType===Go.Hip){let De=!0;const Ae=Re[0][0].z;for(const ue of Re)for(const he of ue)if(Math.abs(he.z-Ae)>.01){De=!1;break}if(De){const ue=H.current.get(Se.id);if(ue){for(let he=0;he[...he]))}break}}for(let De=0;De[...he]))}}}break}}if(ge.type===z.Foundation){const Se=ge;if(Se.solarStructure===Dn.UpdraftTower&&Se.solarUpdraftTower){const Re=ge.id+"-sut",De=H.current.get(Re);if(De){for(let Ae=0;Ae[...Ae]))}}}}},k=(ae,Te,ge)=>{const Se=H.current.get(ae+"-"+Te);if(Se){for(let Re=0;Re{if(c&&!F.current){if(y.getMinutes()+y.getHours()*60>=N.sunset){cancelAnimationFrame(x.current),dt.getState().set(Te=>{Te.runDynamicSimulation=!1}),e(Te=>{Te.world.date=R.current.toLocaleString("en-US")}),gn(Y.t("message.SimulationCompleted",g)),b.current=!0,W(),setTimeout(()=>{n("simulationInProgress",!1),n("showSolarRadiationHeatmap",!0)},10);return}if(y.setHours(y.getHours(),y.getMinutes()+C),e(Te=>{Te.world.date=y.toLocaleString("en-US")}),d)for(const Te of r)switch(Te.type){case z.FresnelReflector:fe(Te);break;case z.Heliostat:pe(Te);break}else for(const Te of r)switch(Te.type){case z.Foundation:{const ge=Te;O(ge),ge.solarStructure===Dn.UpdraftTower&&ye(ge);break}case z.Cuboid:{B(Te);break}case z.SolarPanel:{Z(Te);break}case z.SolarWaterHeater:{te(Te);break}case z.ParabolicTrough:{ee(Te);break}case z.ParabolicDish:{de(Te);break}case z.FresnelReflector:{fe(Te);break}case z.Heliostat:{pe(Te);break}case z.Wall:{V(Te);break}case z.Door:{G(Te);break}case z.Roof:{const ge=Te;switch(ge.roofType){case Go.Pyramid:$(ge);break;case Go.Gable:oe(ge);break;case Go.Gambrel:Q(ge);break;case Go.Mansard:ie(ge);break;case Go.Hip:se(ge);break}break}}x.current=requestAnimationFrame(D)}},L=(ae,Te,ge)=>{if(T.current.length>1){w.current.length=0,P.set(Te,ge);const Se=T.current.filter(Re=>Re.uuid!==ae);return P.intersectObjects(Se,!1,w.current),w.current.length>0}return!1},j=()=>{const ae=p.children.filter(Te=>Te.name==="Content");if(ae.length>0){const Te=ae[0].children;T.current.length=0;for(const ge of Te)me.fetchSimulationElements(ge,T.current)}},B=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=me.dayOfYear(y),Se=ae.lx,Re=ae.ly,De=ae.lz,Ae=Math.max(2,Math.round(Se/v)),ue=Math.max(2,Math.round(Re/v)),he=Math.max(2,Math.round(De/v)),ve=Se/Ae,we=Re/ue,Pe=De/he;let Ie=H.current.get(ae.id+"-top");(!Ie||Ie.length!==Ae||Ie[0].length!==ue)&&(Ie=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(ae.id+"-top",Ie));let Me=H.current.get(ae.id+"-south");(!Me||Me.length!==Ae||Me[0].length!==he)&&(Me=Array(Ae).fill(0).map(()=>Array(he).fill(0)),H.current.set(ae.id+"-south",Me));let ze=H.current.get(ae.id+"-north");(!ze||ze.length!==Ae||ze[0].length!==he)&&(ze=Array(Ae).fill(0).map(()=>Array(he).fill(0)),H.current.set(ae.id+"-north",ze));let Ne=H.current.get(ae.id+"-west");(!Ne||Ne.length!==ue||Ne[0].length!==he)&&(Ne=Array(ue).fill(0).map(()=>Array(he).fill(0)),H.current.set(ae.id+"-west",Ne));let Je=H.current.get(ae.id+"-east");(!Je||Je.length!==ue||Je[0].length!==he)&&(Je=Array(ue).fill(0).map(()=>Array(he).fill(0)),H.current.set(ae.id+"-east",Je));const Ue=ko,nt=_p.clone().applyAxisAngle(ko,ae.rotation[2]),We=Yc.clone().applyAxisAngle(ko,ae.rotation[2]),Ee=Vp.clone().applyAxisAngle(ko,ae.rotation[2]),ke=Op.clone().applyAxisAngle(ko,ae.rotation[2]),Oe=i(ae);let st=ae.cx,je=ae.cy,xt=ae.cz;if(Oe&&Oe.type===z.Cuboid){const At=me.getWorldDataById(ae.id);st=At.pos.x,je=At.pos.y,xt=At.pos.z}const gt=new le,Ye=new Kt(st,je),it=new Kt,ut=je-Re/2,Qe=je+Re/2,lt=st-Se/2,Ze=st+Se/2,Be=xi(Te,ge,S,li.SPHERE_MODEL);let $e=qr(o.ground,y.getMonth(),Ue,Be),wt=Ue.dot(Te),vt=st-Se/2,Rt=je-Re/2;const Gt=xt+De/2;for(let At=0;At0&&(it.set(vt+(At+.5)*ve,Rt+(pt+.5)*we),it.rotateAround(Ye,ae.rotation[2]),gt.set(it.x,it.y,Gt),L(ae.id,gt,Te)||(Ie[At][pt]+=wt*Be));vt=st-Se/2,Rt=xt-De/2,$e=qr(o.ground,y.getMonth(),nt,Be),wt=nt.dot(Te);for(let At=0;At0&&(it.set(vt+(At+.5)*ve,ut),it.rotateAround(Ye,ae.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(ae.id,gt,Te)||(Me[At][pt]+=wt*Be));$e=qr(o.ground,y.getMonth(),We,Be),wt=We.dot(Te);for(let At=0;At0&&(it.set(vt+(At+.5)*ve,Qe),it.rotateAround(Ye,ae.rotation[2]),gt.set(it.x,it.y,Rt+(he-(pt+.5))*Pe),L(ae.id,gt,Te)||(ze[At][pt]+=wt*Be));vt=je-Re/2,Rt=xt-De/2,$e=qr(o.ground,y.getMonth(),Ee,Be),wt=Ee.dot(Te);for(let At=0;At0&&(it.set(lt,vt+(At+.5)*we),it.rotateAround(Ye,ae.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(ae.id,gt,Te)||(Ne[At][pt]+=wt*Be));$e=qr(o.ground,y.getMonth(),ke,Be),wt=ke.dot(Te);for(let At=0;At0&&(it.set(Ze,vt+(At+.5)*we),it.rotateAround(Ye,ae.rotation[2]),gt.set(it.x,it.y,Rt+(pt+.5)*Pe),L(ae.id,gt,Te)||(Je[At][pt]+=wt*Be))},O=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=me.dayOfYear(y),Se=ae.lx,Re=ae.ly,De=ae.lz,Ae=Math.max(2,Math.round(Se/v)),ue=Math.max(2,Math.round(Re/v)),he=Se/Ae,ve=Re/ue,we=ae.cx-Se/2,Pe=ae.cy-Re/2,Ie=new Kt(ae.cx,ae.cy),Me=new le;let ze=H.current.get(ae.id);(!ze||ze.length!==Ae||ze[0].length!==ue)&&(ze=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(ae.id,ze));const Ne=xi(Te,ge,S,li.SPHERE_MODEL),Je=qr(o.ground,y.getMonth(),ko,Ne),Ue=ko.dot(Te),nt=new Kt;for(let We=0;We0&&(nt.set(we+(We+.5)*he,Pe+(Ee+.5)*ve),nt.rotateAround(Ie,ae.rotation[2]),Me.set(nt.x,nt.y,De),L(ae.id,Me,Te)||(ze[We][Ee]+=Ue*Ne))},V=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=me.dayOfYear(y),Re=ae.lx,De=me.getHighestPointOfWall(ae),Ae=Math.max(2,Math.round(Re/v)),ue=Math.max(2,Math.round(De/v)),he=Re/Ae,ve=De/ue,we=ge.rotation[2]+ae.relativeAngle,Pe=me.wallAbsolutePosition(new le(ae.cx,ae.cy,ae.cz),ge).setZ(De/2+ge.lz),Ie=new le(Math.cos(we-Qt),Math.sin(we-Qt),0),Me=he*Math.cos(we),ze=he*Math.sin(we),Ne=new le;let Je=H.current.get(ae.id);(!Je||Je.length!==Ae||Je[0].length!==ue)&&(Je=Array(Ae).fill(0).map(()=>Array(ue).fill(0)),H.current.set(ae.id,Je));const Ue=me.getWallVertices(ae,1),nt=(De-ae.lz)/2,We=xi(Te,Se,S,li.SPHERE_MODEL),Ee=qr(o.ground,y.getMonth(),Ie,We),ke=Ie.dot(Te);for(let Oe=0;Oe0&&(Ne.set(Pe.x+je*Me,Pe.y+je*ze,Pe.z+xt*ve),L(ae.id,Ne,Te)||(Je[Oe][st]+=ke*We)))}},G=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of door not found");const Se=i(ae);if(!Se)throw new Error("parent of door not found");const Re=me.dayOfYear(y),De=Se,Ae=ae.lx*De.lx,ue=ae.lz*De.lz,he=Math.max(2,Math.round(Ae/v)),ve=Math.max(2,Math.round(ue/v)),we=Ae/he,Pe=ue/ve,Ie=ge.rotation[2]+De.relativeAngle,ze=me.wallAbsolutePosition(new le(De.cx,De.cy,De.cz),ge).setZ(De.lz/2+ge.lz).clone().add(new le(ae.cx*De.lx,0,ae.cz*De.lz)),Ne=new le(Math.cos(Ie-Qt),Math.sin(Ie-Qt),0),Je=we*Math.cos(Ie),Ue=we*Math.sin(Ie),nt=new le;let We=H.current.get(ae.id);(!We||We.length!==he||We[0].length!==ve)&&(We=Array(he).fill(0).map(()=>Array(ve).fill(0)),H.current.set(ae.id,We));const Ee=xi(Te,Re,S,li.SPHERE_MODEL),ke=qr(o.ground,y.getMonth(),Ne,Ee),Oe=Ne.dot(Te);if(ae.doorType===Rd.Arched)for(let st=0;st0&&(L(ae.id,nt,Te)||(We[st][je]+=Oe*Ee)))}else for(let st=0;st0){const xt=st-he/2+.5,gt=je-ve/2+.5;nt.set(ze.x+xt*Je,ze.y+xt*Ue,ze.z+gt*Pe),L(ae.id,nt,Te)||(We[st][je]+=Oe*Ee)}},q=(ae,Te,ge,Se)=>{const Re=Se[0][0].z,De=me.dayOfYear(y),Ae=xi(ae,De,S,li.SPHERE_MODEL),ue=new ln(0,0,ge.rotation[2],"ZYX");let he=Number.MAX_VALUE,ve=Number.MAX_VALUE,we=-Number.MAX_VALUE,Pe=-Number.MAX_VALUE;for(const ke of Se)for(const Oe of ke){const st=Oe.clone().applyEuler(ue);st.x>we&&(we=st.x),st.xPe&&(Pe=st.y),st.yArray(Me).fill(0)),H.current.set(Te.id,Je));const Ue=new le(he+v/2,ve+v/2,ge.lz+Re+k0),nt=new le(0,0,Ue.z),We=qr(o.ground,y.getMonth(),ko,Ae),Ee=ko.dot(ae);for(let ke=0;ke0&&(nt.y=Ue.y+Oe*Ne,L(Te.id,nt,ae)||(Je[ke][Oe]+=Ee*Ae))}},$=ae=>{if(ae.roofType!==Go.Pyramid)throw new Error("roof is not pyramid");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=f(ae.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,ae,ge,Se);else{const Ae=me.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),he=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=ae.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new le().subVectors(Me,Ie),Je=new le().subVectors(ze,Ie),Ue=new le().subVectors(ze,Me),nt=Ne.length(),We=new le().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new le().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new le().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new le(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new le,it=qr(o.ground,y.getMonth(),st,he),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*he))}}}},ie=ae=>{if(ae.roofType!==Go.Mansard)throw new Error("roof is not mansard");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=f(ae.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,ae,ge,Se);else{const Ae=me.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),he=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=ae.id+"-"+ve;if(ve===Se.length-1){let Ie=Number.MAX_VALUE,Me=Number.MAX_VALUE,ze=-Number.MAX_VALUE,Ne=-Number.MAX_VALUE;for(const gt of we){const Ye=gt.clone().applyEuler(ue);Ye.x>ze&&(ze=Ye.x),Ye.xNe&&(Ne=Ye.y),Ye.yArray(nt).fill(0)),H.current.set(Pe,ke));const Oe=new le(Ie+v/2,Me+v/2,ge.lz+Je+k0),st=new le(0,0,Oe.z),je=qr(o.ground,y.getMonth(),ko,he),xt=ko.dot(Te);for(let gt=0;gt0&&(st.y=Oe.y+Ye*Ee,L(Pe,st,Te)||(ke[gt][Ye]+=xt*he))}}else{const Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new le().subVectors(Me,Ie),Je=new le().subVectors(ze,Ie),Ue=new le().subVectors(ze,Me),nt=Ne.length(),We=new le().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new le().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new le().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new le(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new le,it=qr(o.ground,y.getMonth(),st,he),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*he))}}}}},Q=ae=>{if(ae.roofType!==Go.Gambrel)throw new Error("roof is not gambrel");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=f(ae.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,ae,ge,Se);else{const Ae=me.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),he=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=ae.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new le().subVectors(Me,Ie),Je=new le().subVectors(ze,Ie),Ue=new le().subVectors(ze,Me),nt=Ne.length(),We=new le().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new le().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new le().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new le(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);gt.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const Ye=new le,it=qr(o.ground,y.getMonth(),st,he),ut=st.dot(Te);for(let Qe=0;Qe0&&(Ye.copy(gt).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,Ye,Te)||(Oe[Qe][Ze]+=ut*he))}}}},se=ae=>{if(ae.roofType!==Go.Hip)throw new Error("roof is not hip");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=f(ae.id);if(!Se||Se.length===0)return;let Re=!0;const De=Se[0][0].z;for(const Ae of Se)for(const ue of Ae)if(Math.abs(ue.z-De)>.01){Re=!1;break}if(Re)q(Te,ae,ge,Se);else{const Ae=me.dayOfYear(y),ue=new ln(0,0,ge.rotation[2],"ZYX"),he=xi(Te,Ae,S,li.SPHERE_MODEL);for(const[ve,we]of Se.entries()){const Pe=ae.id+"-"+ve,Ie=we[0].clone().applyEuler(ue),Me=we[1].clone().applyEuler(ue),ze=we[2].clone().applyEuler(ue),Ne=new le().subVectors(Me,Ie),Je=new le().subVectors(ze,Ie),Ue=new le().subVectors(ze,Me),nt=Ne.length(),We=new le().crossVectors(Je,Ue).length()/nt,Ee=Math.max(2,Math.round(nt/v)),ke=Math.max(2,Math.round(We/v));let Oe=H.current.get(Pe);(!Oe||Oe.length!==Ee||Oe[0].length!==ke)&&(Oe=Array(Ee).fill(0).map(()=>Array(ke).fill(0)),H.current.set(Pe,Oe)),Ne.normalize(),Je.normalize(),Ue.normalize();const st=new le().crossVectors(Je,Ue).normalize(),je=Ne.multiplyScalar(.5*nt/Ee),xt=new le().crossVectors(st,Ne).normalize().multiplyScalar(.5*We/ke),gt=new le,Ye=new le(ge.cx+Ie.x,ge.cy+Ie.y,ge.lz+Ie.z+k0);Ye.add(je).add(xt),je.multiplyScalar(2),xt.multiplyScalar(2);const it=qr(o.ground,y.getMonth(),st,he),ut=st.dot(Te);for(let Qe=0;Qe0&&(gt.copy(Ye).add(lt).add(xt.clone().multiplyScalar(Ze)),L(Pe,gt,Te)||(Oe[Qe][Ze]+=ut*he))}}}},oe=ae=>{if(ae.roofType!==Go.Gable)throw new Error("roof is not gable");const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=a(ae);if(!ge)throw new Error("foundation of wall not found");const Se=f(ae.id);if(!Se||Se.length===0)return;const Re=me.dayOfYear(y),De=new ln(0,0,ge.rotation[2],"ZYX"),Ae=xi(Te,Re,S,li.SPHERE_MODEL);for(const[ue,he]of Se.entries()){const ve=ae.id+"-"+ue,we=he[0].clone().applyEuler(De),Pe=he[1].clone().applyEuler(De),Ie=he[2].clone().applyEuler(De),Me=new le().subVectors(Pe,we),ze=new le().subVectors(Ie,we),Ne=new le().subVectors(Ie,Pe),Je=Me.length(),Ue=new le().crossVectors(ze,Ne).length()/Je,nt=Math.max(2,Math.round(Je/v)),We=Math.max(2,Math.round(Ue/v));let Ee=H.current.get(ve);(!Ee||Ee.length!==nt||Ee[0].length!==We)&&(Ee=Array(nt).fill(0).map(()=>Array(We).fill(0)),H.current.set(ve,Ee)),Me.normalize(),ze.normalize(),Ne.normalize();const ke=new le().crossVectors(ze,Ne).normalize(),Oe=Me.multiplyScalar(.5*Je/nt),st=new le().crossVectors(ke,Me).normalize().multiplyScalar(.5*Ue/We),je=new le(ge.cx+we.x,ge.cy+we.y,ge.lz+we.z+k0);je.add(Oe).add(st),Oe.multiplyScalar(2),st.multiplyScalar(2);const xt=new le,gt=qr(o.ground,y.getMonth(),ke,Ae),Ye=ke.dot(Te);for(let it=0;it0&&(xt.copy(je).add(ut).add(st.clone().multiplyScalar(Qe)),L(ve,xt,Te)||(Ee[it][Qe]+=Ye*Ae))}}},Z=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;let ge=i(ae);if(!ge)throw new Error("parent of solar panel does not exist");const Se=ae.parentType===z.Roof,Re=ae.parentType===z.Wall;if(Se&&(ge=a(ge),!ge))throw new Error("foundation of solar panel does not exist");const De=me.dayOfYear(y),Ae=Re?me.absoluteCoordinates(ae.cx,ae.cy,ae.cz,ge,a(ae),ae.lz):me.absoluteCoordinates(ae.cx,ae.cy,ae.cz,ge,void 0,void 0,!0),ue=ge.rotation[2];let he=ue+(Re?0:ae.relativeAzimuth),ve=ae.tiltAngle,we=!0;if(Se&&(Ae.z=ae.cz+ae.lz+.02+ge.cz,me.isZero(ae.rotation[0])?Ae.z+=ae.poleHeight:(ve=ae.rotation[0],he=ue,we=!1)),Re&&!me.isZero(ae.tiltAngle)){const Qe=ge,lt=a(ge),Be=(lt?lt.rotation[2]+Qe.relativeAngle:Qe.relativeAngle)-Qt,$e=ae.ly*Math.abs(Math.sin(ae.tiltAngle))/2;Ae.x+=$e*Math.cos(Be),Ae.y+=$e*Math.sin(Be)}const Pe=new le().fromArray(ae.normal),Ie=ae.lx,Me=ae.ly,ze=Math.max(2,Math.round(ae.lx/v)),Ne=Math.max(2,Math.round(ae.ly/v)),Je=Ie/ze,Ue=Me/Ne,nt=Ae.x-(Ie-v)/2,We=Ae.y-(Me-v)/2,Ee=Se||Re?Ae.z:ge.lz+ae.poleHeight+ae.lz,ke=new Kt(Ae.x,Ae.y),Oe=new le;let st=H.current.get(ae.id);(!st||st.length!==ze||st[0].length!==Ne)&&(st=Array(ze).fill(0).map(()=>Array(Ne).fill(0)),H.current.set(ae.id,st));let je=new ln(Se&&!we?0:ve,0,he,"ZYX");if(ae.trackerType!==Ll.NO_TRACKER){const Qe=ue?Te.clone().applyAxisAngle(ko,-ue):Te.clone();switch(ae.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const lt=new Ts().setFromUnitVectors(ko,Qe);je=new ln().setFromQuaternion(lt),je.z+=he;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const lt=new Ts().setFromUnitVectors(ko,new le(Qe.x,0,Qe.z).normalize());je=new ln().setFromQuaternion(lt),je.z+=he;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{if(Math.abs(ae.tiltAngle)>.001){const lt=new le(Qe.x,-Qe.y,0).normalize(),Ze=Math.acos(Yc.dot(lt))*Math.sign(lt.x);je=new ln(ae.tiltAngle,0,Ze+ue,"ZYX")}break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}if(Re&&Pe.applyEuler(new ln(0,0,ge.relativeAngle)),Pe.applyEuler(je),Se&&!we&&(je.x=ae.rotation[0],je.z=ae.rotation[2]+ue),Re){const Qe=i(ae);Qe&&(je.x=Qt+ae.tiltAngle,je.z=ge.relativeAngle+Qe.rotation[2])}const xt=xi(Te,De,S,li.SPHERE_MODEL),gt=qr(o.ground,y.getMonth(),Pe,xt),Ye=Pe.dot(Te),it=new Kt,ut=new le;for(let Qe=0;Qe0&&(it.set(nt+Qe*Je,We+lt*Ue),ut.set(it.x-ke.x,it.y-ke.y,0),ut.applyEuler(je),Oe.set(Ae.x+ut.x,Ae.y+ut.y,Ee+ut.z),L(ae.id,Oe,Te)||(st[Qe][lt]+=Ye*xt))},te=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(ae);if(!ge)throw new Error("parent of solar water heater does not exist");const Se=a(ge);if(!Se)throw new Error("foundation of solar water heater does not exist");const Re=me.absoluteCoordinates(ae.cx,ae.cy,ae.cz,Se,void 0,void 0,!0),De=new ln,Ae=(ae.lz-ae.waterTankRadius)/2,ue=Math.atan2(ae.lz-ae.waterTankRadius,ae.ly);me.isZero(ae.rotation[0])?(De.set(ue,0,ae.relativeAzimuth+Se.rotation[2],"ZXY"),Re.z+=Ae):(De.set(ae.rotation[0]+ue,0,ae.rotation[2]+Se.rotation[2],"ZXY"),Re.add(new le(0,0,Ae).applyEuler(De)));const ve=ae.lx,we=Math.hypot(ae.ly,ae.lz-ae.waterTankRadius),Pe=Math.max(2,Math.round(ve/v)),Ie=Math.max(2,Math.round(we/v)),Me=ve/Pe,ze=we/Ie,Ne=-(ve-v)/2,Je=-(we-v)/2;let Ue=H.current.get(ae.id);(!Ue||Ue.length!==Pe||Ue[0].length!==Ie)&&(Ue=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(ae.id,Ue));const nt=new le(0,0,1).applyEuler(De),We=xi(Te,me.dayOfYear(y),S,li.SPHERE_MODEL),Ee=qr(o.ground,y.getMonth(),nt,We),ke=nt.dot(Te),Oe=new Kt,st=new le;for(let je=0;je0&&(Oe.set(Ne+je*Me,Je+xt*ze),st.set(Oe.x,Oe.y,0).applyEuler(De).add(Re),L(ae.id,st,Te)||(Ue[je][xt]+=ke*We))},ee=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(ae);if(!ge)throw new Error("parent of parabolic trough does not exist");const Se=me.dayOfYear(y),Re=me.absoluteCoordinates(ae.cx,ae.cy,ae.cz,ge),De=new le().fromArray(ae.normal),Ae=De.clone(),ue=ae.lx,he=ae.ly,ve=ue*ue/(4*ae.latusRectum),we=ae.poleHeight+ue/2,Pe=Math.max(2,Math.round(ae.lx/v)),Ie=Math.max(2,Math.round(ae.ly/v)),Me=ue/Pe,ze=he/Ie,Ne=Re.x-(ue-v)/2,Je=Re.y-(he-v)/2,Ue=ge.lz+we+ae.lz+ve,nt=new Kt(Re.x,Re.y),We=new le;let Ee=H.current.get(ae.id);(!Ee||Ee.length!==Pe||Ee[0].length!==Ie)&&(Ee=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(ae.id,Ee));const ke=ge.rotation[2],Oe=ke+ae.relativeAzimuth,st=me.isZero(Oe),je=st?1:Math.cos(Oe),xt=st?0:Math.sin(Oe),gt=ke?Te.clone().applyAxisAngle(ko,-ke):Te.clone(),Ye=new Ts().setFromUnitVectors(ko,new le(gt.x*je,gt.x*xt,gt.z).normalize()),it=new ln().setFromQuaternion(Ye);De.copy(Ae.clone().applyEuler(it));const ut=xi(Te,Se,S,li.SPHERE_MODEL),Qe=qr(o.ground,y.getMonth(),De,ut),lt=De.dot(Te),Ze=new Kt,Be=new le;let $e=0,wt=0,vt=1;const Rt=4/(ae.latusRectum*ae.latusRectum);for(let Gt=0;Gt0&&(Ze.set($e,Je+At*ze),st||Ze.rotateAround(nt,Oe),Be.set(Ze.x-nt.x,Ze.y-nt.y,0),Be.applyEuler(it),We.set(Re.x+Be.x,Re.y+Be.y,Ue+Be.z),L(ae.id,We,Te)||(Ee[Gt][At]+=lt*ut*vt))}},de=ae=>{const Te=ki(y,o.latitude);if(Te.z<=0)return;const ge=i(ae);if(!ge)throw new Error("parent of parabolic dish does not exist");const Se=me.dayOfYear(y),Re=me.absoluteCoordinates(ae.cx,ae.cy,ae.cz,ge),De=new le().fromArray(ae.normal),Ae=De.clone(),ue=ae.lx,he=ae.ly,ve=ue*ue/(4*ae.latusRectum),we=ae.poleHeight+ue/2,Pe=Math.max(2,Math.round(ae.lx/v)),Ie=Math.max(2,Math.round(ae.ly/v)),Me=ue/Pe,ze=he/Ie,Ne=Re.x-(ue-v)/2,Je=Re.y-(he-v)/2,Ue=ge.lz+we+ae.lz+ve,nt=new Kt(Re.x,Re.y),We=new le;let Ee=H.current.get(ae.id);(!Ee||Ee.length!==Pe||Ee[0].length!==Ie)&&(Ee=Array(Pe).fill(0).map(()=>Array(Ie).fill(0)),H.current.set(ae.id,Ee));const ke=ge.rotation[2],Oe=ke+ae.relativeAzimuth,st=me.isZero(Oe),je=ke?Te.clone().applyAxisAngle(ko,-ke):Te.clone(),xt=new Ts().setFromUnitVectors(ko,je),gt=new ln().setFromQuaternion(xt);De.copy(Ae.clone().applyEuler(gt));const Ye=xi(Te,Se,S,li.SPHERE_MODEL),it=qr(o.ground,y.getMonth(),De,Ye),ut=De.dot(Te),Qe=new Kt,lt=new le;let Ze=0,Be=0,$e=0,wt=0,vt=1;const Rt=4/(ae.latusRectum*ae.latusRectum);for(let Gt=0;Gtue/2))for(let At=0;Athe/2)&&(Ee[Gt][At]+=it,ut>0&&(Qe.set(Ze,Be),st||Qe.rotateAround(nt,Oe),lt.set(Qe.x-nt.x,Qe.y-nt.y,0),lt.applyEuler(gt),We.set(Re.x+lt.x,Re.y+lt.y,Ue+lt.z),L(ae.id,We,Te)||(vt=1/Math.sqrt(1+($e*$e+wt*wt)*Rt),Ee[Gt][At]+=ut*Ye*vt)))},fe=ae=>{const Te=ki(y,o.latitude);if(Te.zArray(Me).fill(0)),H.current.set(ae.id,ke));const st=ge.rotation[2]+ae.relativeAzimuth,je=me.isZero(st),xt=je?1:Math.cos(st),gt=je?0:Math.sin(st),Ye=Se.solarStructure===Dn.FocusPipe?new le((Se.cx-Ae.x)*xt,(Se.cy-Ae.y)*gt,Se.cz-Ae.z+Se.lz/2+(Re.absorberHeight??10)):void 0,it=new le(gt,xt,0),ut=new le;let Qe,lt;if(Ye){ut.set(Ye.x,Ye.y,Ye.z);const Gt=-Ye.z*(Te.y*it.y+Te.x*it.x)/Te.z;ut.x+=Gt*it.x,ut.y-=Gt*it.y,lt=ut.clone().normalize();let At=lt.add(Te).normalize();me.isSame(At,ko)&&(At=new le(-.001,0,1).normalize()),je||At.applyAxisAngle(ko,-st),Qe=new ln(0,Math.atan2(At.x,At.z),st,"ZXY"),ue.copy(he.clone().applyEuler(Qe))}else lt=new le(0,0,1),Qe=new ln;const Ze=xi(Te,De,S,li.SPHERE_MODEL),Be=qr(o.ground,y.getMonth(),ue,Ze),$e=ue.dot(Te),wt=new Kt,vt=new le;let Rt=0;if(d)for(let Gt=0;Gt0&&(wt.set(Rt,Ue+At*Ne),vt.set(wt.x-We.x,wt.y-We.y,0),vt.applyEuler(Qe),Ee.set(Ae.x+vt.x,Ae.y+vt.y,nt+vt.z),!L(ae.id,Ee,Te)&&!L(ae.id,Ee,lt)&&(ke[Gt][At]+=$e*Ze))}else for(let Gt=0;Gt0&&(wt.set(Rt,Ue+At*Ne),vt.set(wt.x-We.x,wt.y-We.y,0),vt.applyEuler(Qe),Ee.set(Ae.x+vt.x,Ae.y+vt.y,nt+vt.z),L(ae.id,Ee,Te)||(ke[Gt][At]+=$e*Ze))}},pe=ae=>{const Te=ki(y,o.latitude);if(Te.zArray(Me).fill(0)),H.current.set(ae.id,ke));const Oe=ge.rotation[2],st=Se.solarStructure===Dn.FocusTower?new le(Se.cx-Ae.x,Se.cy-Ae.y,Se.cz-Ae.z+(Re.towerHeight??20)):void 0;let je,xt;if(st){je=st.clone().normalize();let Ze=je.clone().add(Te).normalize();me.isSame(Ze,ko)&&(Ze=new le(-.001,0,1).normalize()),Oe&&Ze.applyAxisAngle(ko,-Oe);const Be=Math.hypot(Ze.x,Ze.y);xt=new ln(Math.atan2(Be,Ze.z),0,Math.atan2(Ze.y,Ze.x)+Qt,"ZXY"),ue.copy(he.clone().applyEuler(xt))}else je=new le(0,0,1),xt=new ln;const gt=xi(Te,De,S,li.SPHERE_MODEL),Ye=qr(o.ground,y.getMonth(),ue,gt),it=ue.dot(Te),ut=new Kt,Qe=new le;let lt=0;if(d)for(let Ze=0;Ze0&&(ut.set(lt,Ue+Be*Ne),Qe.set(ut.x-We.x,ut.y-We.y,0),Qe.applyEuler(xt),Ee.set(Ae.x+Qe.x,Ae.y+Qe.y,nt+Qe.z),!L(ae.id,Ee,Te)&&!L(ae.id,Ee,je)&&(ke[Ze][Be]+=it*gt))}else for(let Ze=0;Ze0&&(ut.set(lt,Ue+Be*Ne),Qe.set(ut.x-We.x,ut.y-We.y,0),Qe.applyEuler(xt),Ee.set(Ae.x+Qe.x,Ae.y+Qe.y,nt+Qe.z),L(ae.id,Ee,Te)||(ke[Ze][Be]+=it*gt))}},ye=ae=>{const Te=ae.solarUpdraftTower;if(!Te)return;const ge=ki(y,o.latitude);if(ge.z<=0)return;const Se=me.dayOfYear(y),Re=new le().fromArray(ae.normal),De=Te.collectorRadius,Ae=Math.max(2,Math.round(De*2/v)),ue=ae.cx-De+v/2,he=ae.cy-De+v/2,ve=ae.lz+Te.collectorHeight,we=ae.id+"-sut";let Pe=H.current.get(we);(!Pe||Pe.length!==Ae||Pe[0].length!==Ae)&&(Pe=Array(Ae).fill(0).map(()=>Array(Ae).fill(0)),H.current.set(we,Pe));const Ie=xi(ge,Se,S,li.SPHERE_MODEL),Me=qr(o.ground,y.getMonth(),Re,Ie),ze=new le(0,0,ve),Ne=Re.dot(ge),Je=De*De;let Ue,nt;for(let We=0;WeJe)&&(Pe[We][Ee]+=Me,Ne>0&&(L(we,ze,ge)||(Pe[We][Ee]+=Ne*Ie)))}};return h.jsx(h.Fragment,{})}),CBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(pvt),s=M(bW),c=Cn(mvt),u=M(SW),d=M(iOe),f=M(aOe),p=Cn(yvt),g=dt(cvt),A=dt(uvt),y=dt(dvt),S=dt(fvt),C=M(UBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=me.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(oe),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),oe())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},oe=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showDailyParabolicTroughYieldPanel=!0,he.selectedFloatingWindow="dailyParabolicTroughYieldPanel"}),dt.getState().set(he=>{he.runDailySimulationForParabolicTroughs=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,Z(),o&&e(he=>{const ve=Cn.getState().sumDailyParabolicTroughYield();he.actionInfo={name:"Daily Simulation for Parabolic Troughs Completed",result:{totalYield:ve},details:Cn.getState().dailyParabolicTroughYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(he=>{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.ParabolicTrough&&ye(he);D.current=requestAnimationFrame(oe)}},Z=()=>{const ue=ae();for(const he of i)if(he.type===z.ParabolicTrough){const ve=he,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(d){const he=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.ParabolicTrough){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Trough"+we,ze),Pe.push(Me.label??"Trough"+we);for(let Ne=0;Ne<24;Ne++)he[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Trough"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const he=new Array(24).fill(0);for(const we of i)if(we.type===z.ParabolicTrough){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)he[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:he[we]});l(ve)}};m.useEffect(()=>{if(A)return ee(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const ee=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.ParabolicTrough&&ye(he);D.current=requestAnimationFrame(de)}else{if(fe(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showYearlyParabolicTroughYieldPanel=!0,he.selectedFloatingWindow="yearlyParabolicTroughYieldPanel"}),dt.getState().set(he=>{he.runYearlySimulationForParabolicTroughs=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(he=>{const ve=Cn.getState().sumYearlyParabolicTroughYield();he.actionInfo={name:"Yearly Simulation for Parabolic Troughs Completed",result:{totalYield:ve},details:Cn.getState().yearlyParabolicTroughYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},fe=()=>{const ue=Te();for(const he of i)if(he.type===z.ParabolicTrough){const ve=he,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&Z()},pe=()=>{if(f){const ue=[],he=[];let ve=0;for(const Pe of i)if(Pe.type===z.ParabolicTrough){const Ie=O.current.get(Pe.id);Ie&&(u(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,he.push(Pe.label??"Trough"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[he[Me]]=ze[Pe/F]*Q;we.push(Ie)}c(we),p(he)}else{const ue=[];for(const ve of i)if(ve.type===z.ParabolicTrough){const we=O.current.get(ve.id);we&&(u(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const he=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];he.push({Month:zs[ve],Total:we*Q})}c(he)}},ye=ue=>{const he=ki(w,r.latitude);if(he.z0&&(Rt.set(je+Wt*Ee,xt+ht*ke),Ne||Rt.rotateAround(Ye,ze),Gt.set(Rt.x-Ye.x,Rt.y-Ye.y,0),Gt.applyEuler($e),it.set(Pe.x+Gt.x,Pe.y+Gt.y,gt+Gt.z),Se(ue.id,it,he)||(At+=vt*wt));const pt=B.current.get(ue.id);if(pt){const Wt=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();pt[Wt]+=At/(nt*We)}},ae=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>ue.lx*ue.ly*ue.opticalEfficiency*ue.thermalEfficiency*ue.absorptance*ue.reflectance*(1-N[w.getMonth()]),Se=(ue,he,ve)=>{if(W.current.length>1){k.current.length=0,E.set(he,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(he=>he.name==="Content");if(ue.length>0){const he=ue[0].children;W.current.length=0;for(const ve of he)me.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.ParabolicTrough){const he=B.current.get(ue.id);he?he.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.ParabolicTrough){const he=O.current.get(ue.id);he&&he.length===H?he.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),RBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Qvt),s=M(bW),c=Cn(ext),u=M(SW),d=M(yOe),f=M(AOe),p=Cn(txt),g=dt(Xvt),A=dt(Jvt),y=dt(Kvt),S=dt(qvt),C=M(jBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=me.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(oe),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),oe())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},oe=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showDailyParabolicDishYieldPanel=!0,he.selectedFloatingWindow="dailyParabolicDishYieldPanel"}),dt.getState().set(he=>{he.runDailySimulationForParabolicDishes=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,Z(),o&&e(he=>{const ve=Cn.getState().sumDailyParabolicDishYield();he.actionInfo={name:"Daily Simulation for Parabolic Dishes Completed",result:{totalYield:ve},details:Cn.getState().dailyParabolicDishYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(he=>{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.ParabolicDish&&ye(he);D.current=requestAnimationFrame(oe)}},Z=()=>{const ue=ae();for(const he of i)if(he.type===z.ParabolicDish){const ve=he,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(d){const he=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.ParabolicDish){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Dish"+we,ze),Pe.push(Me.label??"Dish"+we);for(let Ne=0;Ne<24;Ne++)he[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Dish"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const he=new Array(24).fill(0);for(const we of i)if(we.type===z.ParabolicDish){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)he[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:he[we]});l(ve)}};m.useEffect(()=>{if(A)return ee(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const ee=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.ParabolicDish&&ye(he);D.current=requestAnimationFrame(de)}else{if(fe(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showYearlyParabolicDishYieldPanel=!0,he.selectedFloatingWindow="yearlyParabolicDishYieldPanel"}),dt.getState().set(he=>{he.runYearlySimulationForParabolicDishes=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(he=>{const ve=Cn.getState().sumYearlyParabolicDishYield();he.actionInfo={name:"Yearly Simulation for Parabolic Dishes Completed",result:{totalYield:ve},details:Cn.getState().yearlyParabolicDishYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},fe=()=>{const ue=Te();for(const he of i)if(he.type===z.ParabolicDish){const ve=he,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&Z()},pe=()=>{if(f){const ue=[],he=[];let ve=0;for(const Pe of i)if(Pe.type===z.ParabolicDish){const Ie=O.current.get(Pe.id);Ie&&(u(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,he.push(Pe.label??"Dish"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[he[Me]]=ze[Pe/F]*Q;we.push(Ie)}c(we),p(he)}else{const ue=[];for(const ve of i)if(ve.type===z.ParabolicDish){const we=O.current.get(ve.id);we&&(u(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const he=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];he.push({Month:zs[ve],Total:we*Q})}c(he)}},ye=ue=>{const he=ki(w,r.latitude);if(he.z0&&(wt.set(Oe+At*nt,st+pt*We),ut||wt.rotateAround(xt,it),vt.set(wt.x-xt.x,wt.y-xt.y,0),vt.applyEuler(Ze),gt.set(Pe.x+vt.x,Pe.y+vt.y,je+vt.z),Se(ue.id,gt,he)||(Rt+=$e*Be));const Gt=B.current.get(ue.id);if(Gt){const At=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();Gt[At]+=Rt/(Je*Ue)}},ae=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>ue.lx*ue.ly*ue.opticalEfficiency*ue.thermalEfficiency*ue.absorptance*ue.reflectance*(1-N[w.getMonth()]),Se=(ue,he,ve)=>{if(W.current.length>1){k.current.length=0,E.set(he,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(he=>he.name==="Content");if(ue.length>0){const he=ue[0].children;W.current.length=0;for(const ve of he)me.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.ParabolicDish){const he=B.current.get(ue.id);he?he.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.ParabolicDish){const he=O.current.get(ue.id);he&&he.length===H?he.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),HBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Svt),s=M(bW),c=M(sOe),u=Cn(Pvt),d=M(SW),f=M(cOe),p=Cn(Cvt),g=dt(Avt),A=dt(wvt),y=dt(vvt),S=dt(xvt),C=M(BBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=me.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(oe),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),oe())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},oe=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showDailyFresnelReflectorYieldPanel=!0,he.selectedFloatingWindow="dailyFresnelReflectorYieldPanel"}),dt.getState().set(he=>{he.runDailySimulationForFresnelReflectors=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,Z(),o&&e(he=>{const ve=Cn.getState().sumDailyFresnelReflectorYield();he.actionInfo={name:"Daily Simulation for Fresnel Reflectors Completed",result:{totalYield:ve},details:Cn.getState().dailyFresnelReflectorYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(he=>{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.FresnelReflector&&ye(he);D.current=requestAnimationFrame(oe)}},Z=()=>{const ue=ae();for(const he of i)if(he.type===z.FresnelReflector){const ve=he,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(c){const he=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.FresnelReflector){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Reflector"+we,ze),Pe.push(Me.label??"Reflector"+we);for(let Ne=0;Ne<24;Ne++)he[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Reflector"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const he=new Array(24).fill(0);for(const we of i)if(we.type===z.FresnelReflector){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)he[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:he[we]});l(ve)}};m.useEffect(()=>{if(A)return ee(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const ee=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.FresnelReflector&&ye(he);D.current=requestAnimationFrame(de)}else{if(fe(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showYearlyFresnelReflectorYieldPanel=!0,he.selectedFloatingWindow="yearlyFresnelReflectorYieldPanel"}),dt.getState().set(he=>{he.runYearlySimulationForFresnelReflectors=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(he=>{const ve=Cn.getState().sumYearlyFresnelReflectorYield();he.actionInfo={name:"Yearly Simulation for Fresnel Reflectors Completed",result:{totalYield:ve},details:Cn.getState().yearlyFresnelReflectorYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},fe=()=>{const ue=Te();for(const he of i)if(he.type===z.FresnelReflector){const ve=he,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&Z()},pe=()=>{if(f){const ue=[],he=[];let ve=0;for(const Pe of i)if(Pe.type===z.FresnelReflector){const Ie=O.current.get(Pe.id);Ie&&(d(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,he.push(Pe.label??"Reflector"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[he[Me]]=ze[Pe/F]*Q;we.push(Ie)}u(we),p(he)}else{const ue=[];for(const ve of i)if(ve.type===z.FresnelReflector){const we=O.current.get(ve.id);we&&(d(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const he=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];he.push({Month:zs[ve],Total:we*Q})}u(he)}},ye=ue=>{const he=ki(w,r.latitude);if(he.z0&&(pt.set(ct,je+Ve*Oe),Wt.set(pt.x-gt.x,pt.y-gt.y,0),Wt.applyEuler(vt),Ye.set(Me.x+Wt.x,Me.y+Wt.y,xt+Wt.z),!Se(ue.id,Ye,he)&&!Se(ue.id,Ye,Rt)&&(ht+=At*Gt))}const It=B.current.get(ue.id);if(It){const Ft=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();It[Ft]+=ht/(We*Ee)}},ae=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>{const he=a(ue);if(!he)throw new Error("parent of Fresnel reflector does not exist");let ve=1;if(he.type===z.Foundation){const Pe=he.solarAbsorberPipe;ve*=((Pe==null?void 0:Pe.absorberOpticalEfficiency)??.7)*((Pe==null?void 0:Pe.absorberThermalEfficiency)??.3)*((Pe==null?void 0:Pe.absorberAbsorptance)??.95)}return ue.lx*ue.ly*ue.reflectance*ve*(1-N[w.getMonth()])},Se=(ue,he,ve)=>{if(W.current.length>1){k.current.length=0,E.set(he,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(he=>he.name==="Content");if(ue.length>0){const he=ue[0].children;W.current.length=0;for(const ve of he)me.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.FresnelReflector){const he=B.current.get(ue.id);he?he.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.FresnelReflector){const he=O.current.get(ue.id);he&&he.length===H?he.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),MBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=Cn(Dvt),s=M(bW),c=M(dOe),u=Cn(Fvt),d=M(SW),f=M(fOe),p=Cn(kvt),g=dt(Rvt),A=dt(Hvt),y=dt(Mvt),S=dt(Ivt),C=M(YBe),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=t?T==null?void 0:T.elevation:0,b=r.cspTimesPerHour??4,R=60/b,H=r.cspDaysPerYear??6,F=12/H,E=m.useMemo(()=>new l0,[]),N=r.monthlyIrradianceLosses??new Array(12).fill(.05),U=r.cspGridCellSize??.5,W=m.useRef([]),k=m.useRef([]),D=m.useRef(0),L=m.useRef(!1),j=m.useRef(new Date(r.date)),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),ie=m.useRef($),Q=me.daysInYear(w)/12;m.useEffect(()=>{if(g)return se(),D.current=requestAnimationFrame(oe),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[g]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),oe())},[y]);const se=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),w.setHours(Math.floor($.sunrise/60),R/2-30)),L.current=!1,Re(),De()},oe=()=>{if(g&&!G.current){if(w.getMinutes()+w.getHours()*60>=$.sunset){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showDailyHeliostatYieldPanel=!0,he.selectedFloatingWindow="dailyHeliostatYieldPanel"}),dt.getState().set(he=>{he.runDailySimulationForHeliostats=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,Z(),o&&e(he=>{const ve=Cn.getState().sumDailyHeliostatYield();he.actionInfo={name:"Daily Simulation for Heliostats Completed",result:{totalYield:ve},details:Cn.getState().dailyHeliostatYield,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+R),e(he=>{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.Heliostat&&ye(he);D.current=requestAnimationFrame(oe)}},Z=()=>{const ue=ae();for(const he of i)if(he.type===z.Heliostat){const ve=he,we=B.current.get(ve.id);if(we){const Pe=ge(ve)*ue;for(let Ie=0;Ie{var ue;if(c){const he=new Array(24).fill(0),ve=new Map;let we=0;const Pe=[];for(const Me of i)if(Me.type===z.Heliostat){const ze=B.current.get(Me.id);if(ze){s(Me.id,ze.reduce((Ne,Je)=>Ne+Je,0)),we++,ve.set("Heliostat"+we,ze),Pe.push(Me.label??"Heliostat"+we);for(let Ne=0;Ne<24;Ne++)he[Ne]+=ze[Ne]}}const Ie=[];for(let Me=0;Me<24;Me++){const ze={};ze.Hour=Me;for(let Ne=1;Ne<=we;Ne++){const Je="Heliostat"+Ne;ze[Pe[Ne-1]]=(ue=ve.get(Je))==null?void 0:ue[Me]}Ie.push(ze)}l(Ie),p(Pe)}else{const he=new Array(24).fill(0);for(const we of i)if(we.type===z.Heliostat){const Pe=B.current.get(we.id);if(Pe){s(we.id,Pe.reduce((Ie,Me)=>Ie+Me,0));for(let Ie=0;Ie<24;Ie++)he[Ie]+=Pe[Ie]}}const ve=[];for(let we=0;we<24;we++)ve.push({Hour:we,Total:he[we]});l(ve)}};m.useEffect(()=>{if(A)return ee(),D.current=requestAnimationFrame(de),()=>{cancelAnimationFrame(D.current),L.current||(gn(Y.t("message.SimulationAborted",v)),e(ue=>{ue.world.date=j.current.toLocaleString("en-US")}),dt.getState().set(ue=>{ue.simulationInProgress=!1,ue.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=S,S?(q.current=new Date(w.getTime()),cancelAnimationFrame(D.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),de())},[S]);const ee=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(j.current=new Date(r.date),V.current=0,w.setMonth(0,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),e(ue=>{ue.world.date=w.toLocaleString("en-US")})),L.current=!1,Re(),De(),Ae()},de=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60{he.world.date=w.toLocaleString("en-US")});for(const he of i)he.type===z.Heliostat&&ye(he);D.current=requestAnimationFrame(de)}else{if(fe(),V.current++,V.current===H){cancelAnimationFrame(D.current),e(he=>{he.world.date=j.current.toLocaleString("en-US"),he.viewState.showYearlyHeliostatYieldPanel=!0,he.selectedFloatingWindow="yearlyHeliostatYieldPanel"}),dt.getState().set(he=>{he.runYearlySimulationForHeliostats=!1,he.simulationInProgress=!1,he.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),L.current=!0,pe(),o&&e(he=>{const ve=Cn.getState().sumYearlyHeliostatYield();he.actionInfo={name:"Yearly Simulation for Heliostats Completed",result:{totalYield:ve},details:Cn.getState().yearlyHeliostatYield,timestamp:new Date().getTime()}});return}w.setMonth(V.current*F,22),ie.current=dl(w,r.latitude),w.setHours(Math.floor(ie.current.sunrise/60),R/2-30),De(),D.current=requestAnimationFrame(de)}},fe=()=>{const ue=Te();for(const he of i)if(he.type===z.Heliostat){const ve=he,we=B.current.get(ve.id);if(we){const Pe=O.current.get(ve.id);if(Pe){const Ie=we.reduce((Me,ze)=>Me+ze,0);Pe[V.current]+=Ie*ue*ge(ve)}}}C&&Z()},pe=()=>{if(f){const ue=[],he=[];let ve=0;for(const Pe of i)if(Pe.type===z.Heliostat){const Ie=O.current.get(Pe.id);Ie&&(d(Pe.id,Ie.reduce((Me,ze)=>Me+ze,0)*F*Q),ue.push(Ie),ve++,he.push(Pe.label??"Heliostat"+ve))}const we=[];for(let Pe=0;Pe<12;Pe+=F){const Ie={};Ie.Month=zs[Pe];for(const[Me,ze]of ue.entries())Ie[he[Me]]=ze[Pe/F]*Q;we.push(Ie)}u(we),p(he)}else{const ue=[];for(const ve of i)if(ve.type===z.Heliostat){const we=O.current.get(ve.id);we&&(d(ve.id,we.reduce((Pe,Ie)=>Pe+Ie,0)*F*Q),ue.push(we))}const he=[];for(let ve=0;ve<12;ve+=F){let we=0;for(const Pe of ue)we+=Pe[ve/F];he.push({Month:zs[ve],Total:we*Q})}u(he)}},ye=ue=>{const he=ki(w,r.latitude);if(he.z0&&($e.set(Rt,je+pt*Oe),wt.set($e.x-gt.x,$e.y-gt.y,0),wt.applyEuler(lt),Ye.set(Me.x+wt.x,Me.y+wt.y,xt+wt.z),!Se(ue.id,Ye,he)&&!Se(ue.id,Ye,Qe)&&(vt+=Be*Ze))}const Gt=B.current.get(ue.id);if(Gt){const At=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();Gt[At]+=vt/(We*Ee)}},ae=()=>{const ue=$.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},Te=()=>{const ue=ie.current.daylight()/60;return ue>Et?T.sunshineHours[w.getMonth()]/(30*ue*b):0},ge=ue=>{const he=a(ue);if(!he)throw new Error("parent of heliostat does not exist");let ve=1;if(he.type===z.Foundation){const Pe=he.solarPowerTower;ve*=((Pe==null?void 0:Pe.receiverOpticalEfficiency)??.7)*((Pe==null?void 0:Pe.receiverThermalEfficiency)??.3)*((Pe==null?void 0:Pe.receiverAbsorptance)??.95)}return ue.lx*ue.ly*ue.reflectance*ve*(1-N[w.getMonth()])},Se=(ue,he,ve)=>{if(W.current.length>1){k.current.length=0,E.set(he,ve);const we=W.current.filter(Pe=>Pe.uuid!==ue);return E.intersectObjects(we,!1,k.current),k.current.length>0}return!1},Re=()=>{const ue=P.children.filter(he=>he.name==="Content");if(ue.length>0){const he=ue[0].children;W.current.length=0;for(const ve of he)me.fetchSimulationElements(ve,W.current)}},De=()=>{for(const ue of i)if(ue.type===z.Heliostat){const he=B.current.get(ue.id);he?he.fill(0):B.current.set(ue.id,new Array(24).fill(0))}},Ae=()=>{for(const ue of i)if(ue.type===z.Heliostat){const he=O.current.get(ue.id);he&&he.length===H?he.fill(0):O.current.set(ue.id,new Array(H).fill(0))}};return h.jsx(h.Fragment,{})}),IBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=Cn(Gvt),l=Cn(Bvt),s=Cn(Yvt),c=Cn(_vt),u=dt(pOe),d=dt(Lvt),f=dt(gOe),p=dt(Wvt),g=M(OBe),A=M(XBe),y=M(gW)??900,S=r.sutGridCellSize??1,{scene:C}=ri(),P=$t(),v=u1(t),T=new Date(r.date),w=v?v.elevation:0,x=r.sutTimesPerHour??4,b=60/x,R=r.sutDaysPerYear??6,H=12/R,F=m.useMemo(()=>new l0,[]),E=m.useRef([]),N=m.useRef([]),U=m.useRef(0),W=m.useRef(!1),k=m.useRef(new Date(r.date)),D=m.useRef(new Array(24).fill(0)),L=m.useRef(new Map),j=m.useRef(new Map),B=m.useRef(new Map),O=m.useRef(new Map),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useRef(0),ie=m.useMemo(()=>dl(T,r.latitude),[r.date,r.latitude]),Q=m.useRef(ie),se=me.daysInYear(T)/12;m.useEffect(()=>{if(u)if(A&&!me.hasMovingParts(i))oe();else return Z(),U.current=requestAnimationFrame(te),()=>{cancelAnimationFrame(U.current),W.current||(gn(Y.t("message.SimulationAborted",P)),e(we=>{we.world.date=k.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[u]),m.useEffect(()=>{G.current=d,d?(q.current=new Date(T.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",P))):(n("simulationPaused",!1),te())},[d]);const oe=()=>{he(),ge();for(const we of i)if(we.type===z.Foundation){const Pe=we;Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower&&De(Pe)}e(we=>{we.viewState.showDailyUpdraftTowerYieldPanel=!0,we.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(we=>{we.runDailySimulationForUpdraftTower=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,ee(),o&&e(we=>{const Pe=Cn.getState().sumDailyUpdraftTowerYield();we.actionInfo={name:"Static Daily Simulation for Updraft Tower Completed",result:{totalYield:Pe},details:Cn.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}})},Z=()=>{G.current?(T.setTime(q.current.getTime()),G.current=!1):(k.current=new Date(r.date),$.current=T.getDay(),T.setHours(Math.floor(ie.sunrise/60),-b/2)),W.current=!1,he(),ge()},te=()=>{if(u&&!G.current){if(T.getMinutes()+T.getHours()*60+(T.getDay()-$.current)*T2+b>=ie.sunset){cancelAnimationFrame(U.current),e(Pe=>{Pe.world.date=k.current.toLocaleString("en-US"),Pe.viewState.showDailyUpdraftTowerYieldPanel=!0,Pe.selectedFloatingWindow="dailySolarUpdraftTowerYieldPanel"}),dt.getState().set(Pe=>{Pe.runDailySimulationForUpdraftTower=!1,Pe.simulationInProgress=!1,Pe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,ee(),o&&e(Pe=>{const Ie=Cn.getState().sumDailyUpdraftTowerYield();Pe.actionInfo={name:"Dynamic Daily Simulation for Updraft Tower Completed",result:{totalYield:Ie},details:Cn.getState().dailyUpdraftTowerYield,timestamp:new Date().getTime()}});return}T.setHours(T.getHours(),T.getMinutes()+b),e(Pe=>{Pe.world.date=T.toLocaleString("en-US")});for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&Re(Ie)}U.current=requestAnimationFrame(te)}},ee=()=>{const we=Ae();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;if(Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower){const Me=Ie.solarUpdraftTower.collectorTransmissivity??.9,ze=Ie.solarUpdraftTower.turbineEfficiency??.3,Ne=Ie.solarUpdraftTower.dischargeCoefficient??.65,Je=Math.PI*Ie.solarUpdraftTower.chimneyRadius*Ie.solarUpdraftTower.chimneyRadius,Ue=Math.PI*Ie.solarUpdraftTower.collectorRadius*Ie.solarUpdraftTower.collectorRadius,nt=mO*zSe*Je,We=2*ISe*Ie.solarUpdraftTower.chimneyHeight,Ee=L.current.get(Pe.id+"-sut"),ke=j.current.get(Pe.id+"-sut"),Oe=B.current.get(Pe.id+"-sut");if(Oe&&Ee&&ke){const st=.5*Ne*ze*mO*Je,je=new Date(r.date);let xt;v&&(xt=rb(je,v.lowestTemperatures,v.highestTemperatures));for(let gt=0;gt0&>>0&&Ee[gt-1]>Ye){const Ze=(Ee[gt-1]+Ye)/2,Be=(r.airConvectiveCoefficient??5)*Ue*(Ze-Ye),$e=Ze+H4,wt=$e*$e*$e*$e,vt=it*it*it*it,Rt=(Ie.solarUpdraftTower.collectorEmissivity??.95)*DSe*Ue*(wt-vt);Oe[gt]-=Be+Rt,Oe[gt]<0&&(Oe[gt]=0)}const ut=Oe[gt]/(nt*it),Qe=it*(1+Math.cbrt(ut*ut/We))-H4,lt=Qe>Ye?Math.sqrt(We*((Qe+H4)/it-1)):0;Oe[gt]=st*lt*lt*lt*.001,Ee[gt]=Qe,ke[gt]=lt}}}}de()},de=()=>{var Ne,Je,Ue;const we=new Map;let Pe=0;const Ie=[];for(const nt of i)if(nt.type===z.Foundation){const We=nt;if(We.solarStructure===Dn.UpdraftTower&&We.solarUpdraftTower){Pe++;const Ee=L.current.get(nt.id+"-sut");Ee&&we.set("Temperature Tower"+Pe,Ee);const ke=j.current.get(nt.id+"-sut");ke&&we.set("Wind Speed Tower"+Pe,ke);const Oe=B.current.get(nt.id+"-sut");Oe&&(we.set("Tower"+Pe,Oe),Ie.push(nt.label?nt.label:"Tower"+Pe))}}const Me=[];for(let nt=0;nt<24;nt++){const We={};We.Hour=nt;for(let Ee=1;Ee<=Pe;Ee++){const ke="Tower"+Ee;We[Ie[Ee-1]]=(Ne=we.get(ke))==null?void 0:Ne[nt]}Me.push(We)}s(Me);const ze=[];for(let nt=0;nt<24;nt++){const We={};We.Hour=nt,We.T_Ambient=D.current[nt];for(let Ee=1;Ee<=Pe;Ee++){let ke="Temperature Tower"+Ee;We["T_"+Ie[Ee-1]]=(Je=we.get(ke))==null?void 0:Je[nt],ke="Wind Speed Tower"+Ee,We["V_"+Ie[Ee-1]]=(Ue=we.get(ke))==null?void 0:Ue[nt]}ze.push(We)}l(ze),a(Ie)};m.useEffect(()=>{if(f)if(A&&!me.hasMovingParts(i))pe();else return fe(),U.current=requestAnimationFrame(ye),()=>{cancelAnimationFrame(U.current),W.current||(gn(Y.t("message.SimulationAborted",P)),e(we=>{we.world.date=k.current.toLocaleString("en-US")}),dt.getState().set(we=>{we.simulationInProgress=!1,we.simulationPaused=!1})),G.current=!1}},[f]),m.useEffect(()=>{G.current=p,p?(q.current=new Date(T.getTime()),cancelAnimationFrame(U.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",P))):(n("simulationPaused",!1),ye())},[p]);const fe=()=>{G.current?(T.setTime(q.current.getTime()),G.current=!1):(k.current=new Date(r.date),V.current=0,T.setMonth(0,22),$.current=T.getDay(),Q.current=dl(T,r.latitude),T.setHours(Math.floor(Q.current.sunrise/60),-b/2),e(we=>{we.world.date=T.toLocaleString("en-US")})),W.current=!1,he(),ge(),Se()},pe=()=>{he(),ge(),Se(),k.current=new Date(r.date),V.current=0;for(let we=0;we<12;we+=H){T.setMonth(we,22),Q.current=dl(T,r.latitude),ge();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&De(Ie)}ae(),V.current++}e(we=>{we.world.date=k.current.toLocaleString("en-US"),we.viewState.showYearlyUpdraftTowerYieldPanel=!0,we.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(we=>{we.runYearlySimulationForUpdraftTower=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,Te(),o&&e(we=>{const Pe=Cn.getState().sumYearlyUpdraftTowerYield();we.actionInfo={name:"Static Yearly Simulation for Updraft Tower Completed",result:{totalYield:Pe},details:Cn.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}})},ye=()=>{if(f&&!G.current)if(T.getMinutes()+T.getHours()*60+(T.getDay()-$.current)*T2+b{Pe.world.date=T.toLocaleString("en-US")});for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower&&Re(Ie)}U.current=requestAnimationFrame(ye)}else{if(ae(),V.current++,V.current===R){cancelAnimationFrame(U.current),e(Pe=>{Pe.world.date=k.current.toLocaleString("en-US"),Pe.viewState.showYearlyUpdraftTowerYieldPanel=!0,Pe.selectedFloatingWindow="yearlySolarUpdraftTowerYieldPanel"}),dt.getState().set(Pe=>{Pe.runYearlySimulationForUpdraftTower=!1,Pe.simulationInProgress=!1,Pe.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",P)),W.current=!0,Te(),o&&e(Pe=>{const Ie=Cn.getState().sumYearlyUpdraftTowerYield();Pe.actionInfo={name:"Dynamic Yearly Simulation for Updraft Tower Completed",result:{totalYield:Ie},details:Cn.getState().yearlyUpdraftTowerYield,timestamp:new Date().getTime()}});return}T.setMonth(V.current*H,22),$.current=T.getDay(),Q.current=dl(T,r.latitude),T.setHours(Math.floor(Q.current.sunrise/60),-b/2),ge(),U.current=requestAnimationFrame(ye)}},ae=()=>{const we=ue();for(const Pe of i)if(Pe.type===z.Foundation){const Ie=Pe;if(Ie.solarStructure===Dn.UpdraftTower&&Ie.solarUpdraftTower){const Me=B.current.get(Ie.id+"-sut"),ze=L.current.get(Pe.id+"-sut"),Ne=j.current.get(Pe.id+"-sut");if(Me&&ze&&Ne){const Je=Ie.solarUpdraftTower.collectorTransmissivity??.9,Ue=Ie.solarUpdraftTower.turbineEfficiency??.3,nt=Ie.solarUpdraftTower.dischargeCoefficient??.65,We=Math.PI*Ie.solarUpdraftTower.chimneyRadius*Ie.solarUpdraftTower.chimneyRadius,Ee=Math.PI*Ie.solarUpdraftTower.collectorRadius*Ie.solarUpdraftTower.collectorRadius,ke=mO*zSe*We,Oe=2*ISe*Ie.solarUpdraftTower.chimneyHeight,st=.5*nt*Ue*mO*We;let je;v&&(je=rb(T,v.lowestTemperatures,v.highestTemperatures));for(let gt=0;gt0&>>0&&ze[gt-1]>Ye){const Ze=(ze[gt-1]+Ye)/2,Be=(r.airConvectiveCoefficient??5)*Ee*(Ze-Ye),$e=Ze+H4,wt=$e*$e*$e*$e,vt=it*it*it*it,Rt=(Ie.solarUpdraftTower.collectorEmissivity??.95)*DSe*Ee*(wt-vt);Me[gt]-=Be+Rt,Me[gt]<0&&(Me[gt]=0)}const ut=Me[gt]/(ke*it),Qe=it*(1+Math.cbrt(ut*ut/Oe))-H4,lt=Qe>Ye?Math.sqrt(Oe*((Qe+H4)/it-1)):0;Me[gt]=st*lt*lt*lt*.001,ze[gt]=Qe,Ne[gt]=lt}const xt=O.current.get(Ie.id+"-sut");if(xt){const gt=Me.reduce((Ye,it)=>Ye+it,0);xt[V.current]+=gt}}}}g&&de()},Te=()=>{const we=[],Pe=[];let Ie=0;for(const ze of i)if(ze.type===z.Foundation){const Ne=ze;if(Ne.solarStructure===Dn.UpdraftTower&&Ne.solarUpdraftTower){const Je=O.current.get(ze.id+"-sut");Je&&(we.push(Je),Pe.push(ze.label?ze.label:"Tower"+ ++Ie))}}const Me=[];for(let ze=0;ze<12;ze+=H){const Ne={};Ne.Month=zs[ze];for(const[Je,Ue]of we.entries())Ne[Pe[Je]]=Ue[ze/H]*se;Me.push(Ne)}c(Me),a(Pe)},ge=()=>{for(const we of i)if(we.type===z.Foundation){const Pe=we;if(Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower){const Ie=L.current.get(we.id+"-sut");Ie?Ie.fill(0):L.current.set(we.id+"-sut",new Array(24).fill(0));const Me=j.current.get(we.id+"-sut");Me?Me.fill(0):j.current.set(we.id+"-sut",new Array(24).fill(0));const ze=B.current.get(we.id+"-sut");ze?ze.fill(0):B.current.set(we.id+"-sut",new Array(24).fill(0))}}},Se=()=>{for(const we of i)if(we.type===z.Foundation){const Pe=we;if(Pe.solarStructure===Dn.UpdraftTower&&Pe.solarUpdraftTower){const Ie=O.current.get(we.id+"-sut");Ie&&Ie.length===R?Ie.fill(0):O.current.set(we.id+"-sut",new Array(R).fill(0))}}},Re=we=>{const Pe=we.solarUpdraftTower;if(!Pe)return;const Ie=ki(T,r.latitude);if(Ie.zxt)&&(Ye++,gt+=Oe,je>0&&(ve(we.id+"-sut",st,Ie)||(gt+=je*ke)))}Ye&&(gt/=Ye);const Qe=T.getMinutes()>=30?T.getHours()+1===24?0:T.getHours()+1:T.getHours(),lt=Math.PI*Pe.collectorRadius*Pe.collectorRadius;Me[Qe]+=gt*lt}},De=we=>{const Pe=we.solarUpdraftTower;if(!Pe)return;const Ie=B.current.get(we.id+"-sut");if(!Ie)return;const Me=new le().fromArray(we.normal),ze=T.getFullYear(),Ne=T.getMonth(),Je=T.getDate(),Ue=me.dayOfYear(T),nt=Pe.collectorRadius,We=Math.max(2,Math.round(nt*2/S)),Ee=we.cx-nt+S/2,ke=we.cy-nt+S/2,Oe=we.lz+Pe.collectorHeight,st=new le(0,0,Oe),je=nt*nt;let xt=0,gt,Ye;const it=Math.PI*Pe.collectorRadius*Pe.collectorRadius;for(let ut=0;ut<24;ut++){for(let Qe=0;Qe0){const Be=xi(Ze,Ue,w,li.SPHERE_MODEL),$e=qr(r.ground,Ne,ko,Be),wt=Me.dot(Ze);xt=0;for(let vt=0;vtje)&&(xt++,Ie[ut]+=$e,wt>0&&(ve(we.id+"-sut",st,Ze)||(Ie[ut]+=wt*Be)))}}}xt&&(Ie[ut]/=xt),Ie[ut]*=it}},Ae=()=>{const we=ie.daylight()/60;return we>Et?v.sunshineHours[T.getMonth()]/(30*we*x):0},ue=()=>{const we=T.getMonth(),Pe=Q.current.daylight()/60;return Pe>Et?v.sunshineHours[we]/(30*Pe*x):0},he=()=>{const we=C.children.filter(Pe=>Pe.name==="Content");if(we.length>0){const Pe=we[0].children;E.current.length=0;for(const Ie of Pe)me.fetchSimulationElements(Ie,E.current)}},ve=(we,Pe,Ie)=>{if(E.current.length>1){N.current.length=0,F.set(Pe,Ie);const Me=E.current.filter(ze=>ze.uuid!==we);return F.intersectObjects(Me,!1,N.current),N.current.length>0}return!1};return h.jsx(h.Fragment,{})});class zBo{constructor(e,n){this.position=e,this.observer=n}}const DBo=be.memo(()=>{const t=M.getState().world,e=M.getState().elements,n=M(pn),o=dt(Rf),r=M(Gr),i=M(yA),a=dt(Q7t),{scene:l}=ri(),s=$t(),c=m.useMemo(()=>new l0,[]),u=t.solarPanelVisibilityGridCellSize??.2,d=m.useRef([]),f=m.useRef([]),p=m.useRef([]);m.useEffect(()=>{a&&e&&e.length>0&&(y(),o("runSolarPanelVisibilityAnalysis",!1),n(P=>{P.viewState.showSolarPanelVisibilityResultsPanel=!0,P.selectedFloatingWindow="visibilityResultsPanel"}),gn(Y.t("message.SimulationCompleted",s))),o("simulationInProgress",!1)},[a]);const g=()=>{const P=l.children.filter(v=>v.name==="Content");if(P.length>0){const v=P[0].children;f.current.length=0;for(const T of v)me.fetchSimulationElements(T,f.current)}},A=()=>{d.current=[];for(const P of e)if(P.type===z.Human){const v=P;if(v.observer){const T=r(v),w=T?me.absoluteHumanOrTreeCoordinates(v.cx,v.cy,v.cz,T):new le(v.cx,v.cy,v.cz);w.z+=v.lz,d.current.push(new zBo(w,v))}}},y=()=>{if(Cn.getState().clearSolarPanelVisibilityResults(),A(),d.current.length!==0){g();for(const P of d.current){const v=new Map;for(const T of e)if(T.type===z.SolarPanel){const w=T;v.set(w.parentId,0)}for(const T of e)if(T.type===z.SolarPanel){const w=T;let x=v.get(w.parentId)??0;x+=S(w,P.position)*100,v.set(w.parentId,x)}Cn.getState().setSolarPanelVisibilityResult(P,v)}}},S=(P,v)=>{let T=r(P);if(!T)throw new Error("parent of solar panel does not exist");let w=!1;const x=P.parentType===z.Wall;if(T.type===z.Roof){if(T=i(T),!T)throw new Error("foundation of solar panel does not exist");w=!0}const b=x?me.absoluteCoordinates(P.cx,P.cy,P.cz,T,i(P),P.lz):me.absoluteCoordinates(P.cx,P.cy,P.cz,T,void 0,void 0,!0);w&&(b.z=P.cz+T.cz);const R=new le().fromArray(P.normal);x&&R.applyEuler(new ln(0,0,T.relativeAngle));const H=T.rotation[2]+P.relativeAzimuth;Math.abs(P.tiltAngle)>.001&&R.applyEuler(new ln(P.tiltAngle,0,H,"ZYX"));const F=P.lx,E=P.ly*Math.cos(P.tiltAngle),N=P.ly*Math.abs(Math.sin(P.tiltAngle)),U=Math.max(2,Math.round(P.lx/u)),W=Math.max(2,Math.round(P.ly/u)),k=F/U,D=E/W,L=N/W,j=b.x-F/2,B=b.y-E/2,O=(w?b.z:P.poleHeight+b.z)-N/2,V=new Kt(b.x,b.y);let G=0;const q=new le,$=new le;let ie;const Q=new Kt,se=me.isZero(H);for(let oe=0;oe0&&($.normalize(),C(P.id,q,$)&&(G+=Math.abs($.dot(R))/(ie*ie)));return G*u*u/(4*Math.PI)},C=(P,v,T)=>{if(f.current.length>1){p.current.length=0,c.set(v,T);const w=f.current.filter(x=>x.uuid!==P);if(c.intersectObjects(w,!1,p.current),p.current.length===0)return!0;for(const[x,b]of p.current.entries())if(b.object.name.endsWith("eyeball")&&x===0)return!0;return!1}return!0};return h.jsx(h.Fragment,{})}),EBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(Gr),l=M(yA),s=M(X7t),c=M(K7t),u=Cn(sxt),d=Cn(ixt),f=Cn(lxt),p=dt(vOe),g=dt(nxt),A=dt(xOe),y=dt(oxt),S=M(WBe),C=M(Hge),{scene:P}=ri(),v=$t(),T=u1(t),w=new Date(r.date),x=m.useMemo(()=>s(t??"Boston MA, USA"),[t]),b=m.useMemo(()=>c(t??"Boston MA, USA"),[t]),R=t?T==null?void 0:T.elevation:0,H=r.timesPerHour??4,F=60/H,E=m.useMemo(()=>new l0,[]),N=m.useRef([]),U=m.useRef([]),W=m.useRef(0),k=m.useRef(!1),D=m.useRef(new Date(r.date)),L=m.useRef(new Map),j=m.useRef(new Map),B=m.useRef(new Array(12).fill(0)),O=m.useRef(new Array(12).fill(0)),V=m.useRef(0),G=m.useRef(!1),q=m.useRef(new Date(r.date)),$=m.useRef(0),ie=m.useMemo(()=>dl(w,r.latitude),[r.date,r.latitude]),Q=m.useRef(ie);m.useEffect(()=>{if(p)if(C&&!me.hasMovingParts(i))se();else return oe(),W.current=requestAnimationFrame(Z),()=>{cancelAnimationFrame(W.current),k.current||(gn(Y.t("message.SimulationAborted",v)),e(ve=>{ve.world.date=D.current.toLocaleString("en-US")}),dt.getState().set(ve=>{ve.simulationInProgress=!1,ve.simulationPaused=!1})),G.current=!1}},[p]),m.useEffect(()=>{G.current=g,g?(q.current=new Date(w.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),Z())},[g]);const se=()=>{ue(),Te();for(const ve of i)ve.type===z.Sensor&&Re(ve);e(ve=>{ve.viewState.showDailyLightSensorPanel=!0,ve.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(ve=>{ve.runDailyLightSensor=!1,ve.simulationInProgress=!1,ve.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,te(),o&&e(ve=>{ve.actionInfo={name:"Static Daily Simulation for Sensors Completed",details:Cn.getState().dailyLightSensorData,timestamp:new Date().getTime()}})},oe=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(D.current=new Date(r.date),$.current=w.getDay(),w.setHours(Math.floor(ie.sunrise/60),-F/2)),k.current=!1,ue(),Te()},Z=()=>{if(p&&!G.current){if(w.getMinutes()+w.getHours()*60+(w.getDay()-$.current)*T2+F>=ie.sunset){cancelAnimationFrame(W.current),e(we=>{we.world.date=D.current.toLocaleString("en-US"),we.viewState.showDailyLightSensorPanel=!0,we.selectedFloatingWindow="dailyLightSensorPanel"}),dt.getState().set(we=>{we.runDailyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,te(),o&&e(we=>{we.actionInfo={name:"Dynamic Daily Simulation for Sensors Completed",details:Cn.getState().dailyLightSensorData,timestamp:new Date().getTime()}});return}w.setHours(w.getHours(),w.getMinutes()+F),e(we=>{we.world.date=w.toLocaleString("en-US")});for(const we of i)we.type===z.Sensor&&Se(we);W.current=requestAnimationFrame(Z)}},te=()=>{const ve=De();for(const we of i)if(we.type===z.Sensor){const Pe=L.current.get(we.id);if(Pe)for(let Ie=0;Ie{var Me;const ve=new Map;let we=0;const Pe=[];for(const ze of i)if(ze.type===z.Sensor){const Ne=L.current.get(ze.id);Ne&&(ve.set("Radiation"+ ++we,Ne),Pe.push(ze.label?ze.label:"Radiation"+we))}const Ie=[];for(let ze=0;ze<24;ze++){const Ne={};Ne.Hour=ze;for(let Je=1;Je<=we;Je++){const Ue="Radiation"+Je;Ne[Pe[Je-1]]=(Me=ve.get(Ue))==null?void 0:Me[ze]}Ie.push(Ne)}d(Ie),u(Pe)};m.useEffect(()=>{if(A)if(C&&!me.hasMovingParts(i))fe();else return de(),W.current=requestAnimationFrame(pe),()=>{cancelAnimationFrame(W.current),k.current||(gn(Y.t("message.SimulationAborted",v)),e(ve=>{ve.world.date=D.current.toLocaleString("en-US")}),dt.getState().set(ve=>{ve.simulationInProgress=!1,ve.simulationPaused=!1})),G.current=!1}},[A]),m.useEffect(()=>{G.current=y,y?(q.current=new Date(w.getTime()),cancelAnimationFrame(W.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",v))):(n("simulationPaused",!1),pe())},[y]);const de=()=>{G.current?(w.setTime(q.current.getTime()),G.current=!1):(D.current=new Date(r.date),V.current=0,w.setMonth(0,22),$.current=w.getDay(),Q.current=dl(w,r.latitude),w.setHours(Math.floor(Q.current.sunrise/60),-F/2),e(ve=>{ve.world.date=w.toLocaleString("en-US")})),k.current=!1,ue(),Te(),ge()},fe=()=>{ue(),Te(),ge(),D.current=new Date(r.date),V.current=0;for(let ve=0;ve<12;ve++){w.setMonth(ve,22),Q.current=dl(w,r.latitude),Te();for(const we of i)we.type===z.Sensor&&Re(we);ye(),V.current++}e(ve=>{ve.world.date=D.current.toLocaleString("en-US"),ve.viewState.showYearlyLightSensorPanel=!0,ve.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(ve=>{ve.runYearlyLightSensor=!1,ve.simulationInProgress=!1,ve.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,ae(),o&&e(ve=>{ve.actionInfo={name:"Static Yearly Simulation for Sensors Completed",details:Cn.getState().yearlyLightSensorData,timestamp:new Date().getTime()}})},pe=()=>{if(A&&!G.current)if(w.getMinutes()+w.getHours()*60+(w.getDay()-$.current)*T2+F{we.world.date=w.toLocaleString("en-US")});for(const we of i)we.type===z.Sensor&&Se(we);W.current=requestAnimationFrame(pe)}else{if(ye(),V.current++,V.current===12){cancelAnimationFrame(W.current),e(we=>{we.world.date=D.current.toLocaleString("en-US"),we.viewState.showYearlyLightSensorPanel=!0,we.selectedFloatingWindow="yearlyLightSensorPanel"}),dt.getState().set(we=>{we.runYearlyLightSensor=!1,we.simulationInProgress=!1,we.simulationPaused=!1}),gn(Y.t("message.SimulationCompleted",v)),k.current=!0,ae(),o&&e(we=>{we.actionInfo={name:"Dynamic Yearly Simulation for Sensors Completed",details:Cn.getState().yearlyLightSensorData,timestamp:new Date().getTime()}});return}w.setMonth(V.current,22),$.current=w.getDay(),Q.current=dl(w,r.latitude),w.setHours(Math.floor(Q.current.sunrise/60),-F/2),Te(),W.current=requestAnimationFrame(pe)}},ye=()=>{const ve=Ae();for(const we of i)if(we.type===z.Sensor){const Pe=L.current.get(we.id);if(Pe){const Ie=j.current.get(we.id);if(Ie){const Me=Pe.reduce((ze,Ne)=>ze+Ne,0);Ie[V.current]+=Me*ve}}}S&&te()},ae=()=>{const ve=[],we=[];let Pe=0,Ie=!1,Me=!1;for(const Ue of i)if(Ue.type===z.Sensor){const nt=j.current.get(Ue.id);nt&&(ve.push(nt),we.push(Ue.label?Ue.label:"Radiation"+ ++Pe),!Ie&&me.isIdentical(Ue.normal,as)&&(Ie=!0),!Me&&me.isIdentical(Ue.normal,cAt)&&(Me=!0))}const ze=Ie&&x;ze&&we.push("Measured (Hor.)");const Ne=Me&&b;Ne&&we.push("Measured (Ver.)");const Je=[];for(let Ue=0;Ue<12;Ue++){const nt={};nt.Month=zs[Ue];for(const[We,Ee]of ve.entries())nt.Daylight=B.current[Ue],nt.Clearness=O.current[Ue]*100,ze&&(nt["Measured (Hor.)"]=x.data[Ue]),Ne&&(nt["Measured (Ver.)"]=b.data[Ue]),nt[we[We]]=Ee[Ue];Je.push(nt)}f(Je),u(we)},Te=()=>{for(const ve of i)if(ve.type===z.Sensor){const we=L.current.get(ve.id);we?we.fill(0):L.current.set(ve.id,new Array(24).fill(0))}},ge=()=>{for(const ve of i)if(ve.type===z.Sensor){const we=j.current.get(ve.id);we?we.fill(0):j.current.set(ve.id,new Array(12).fill(0))}},Se=ve=>{const we=ki(w,r.latitude);if(we.z0&&(he(ve.id,Me,we)||(nt+=Ue*Je));const We=L.current.get(ve.id);if(We){const Ee=w.getMinutes()>=30?w.getHours()+1===24?0:w.getHours()+1:w.getHours();We[Ee]+=nt}},Re=ve=>{const we=a(ve);if(!we)throw new Error("parent of sensor does not exist");const Pe=L.current.get(ve.id);if(!Pe)return;let Ie=null;we.type===z.Wall&&(Ie=l(ve));const Me=me.absoluteCoordinates(ve.cx,ve.cy,ve.cz,we,Ie||void 0),ze=new le().fromArray(ve.normal);ze.applyAxisAngle(ko,we.rotation[2]);const Ne=w.getFullYear(),Je=w.getMonth(),Ue=w.getDate(),nt=me.dayOfYear(w);for(let We=0;We<24;We++)for(let Ee=0;Ee0){const st=xi(Oe,nt,R,li.SPHERE_MODEL),je=ze.dot(Oe);je>0&&(he(ve.id,Me,Oe)||(Pe[We]+=je*st)),Pe[We]+=qr(r.ground,Je,ze,st)}}},De=()=>{const ve=ie.daylight()/60;return ve>Et?T.sunshineHours[w.getMonth()]/(30*ve*H):0},Ae=()=>{const ve=w.getMonth(),we=Q.current.daylight()/60;return we>Et?(B.current[ve]=we,O.current[ve]=T.sunshineHours[ve]/(30*we),O.current[ve]/H):(B.current[ve]=0,O.current[ve]=0,0)},ue=()=>{const ve=P.children.filter(we=>we.name==="Content");if(ve.length>0){const we=ve[0].children;N.current.length=0;for(const Pe of we)me.fetchSimulationElements(Pe,N.current)}},he=(ve,we,Pe)=>{if(N.current.length>1){U.current.length=0,E.set(we,Pe);const Ie=N.current.filter(Me=>Me.uuid!==ve);return E.intersectObjects(Ie,!1,U.current),U.current.length>0}return!1};return h.jsx(h.Fragment,{})}),jFe=(t,e)=>{let n=e.efficiency;return e.cellType==="Monocrystalline"&&(n*=.95),n*(1+e.pmaxTC*(t-25))},FBo=be.memo(({city:t})=>{const e=M(pn),n=dt(Rf),o=M(oa),r=M.getState().world,i=M.getState().elements,a=M(t5),l=M(Gr),s=M(yA),c=Cn(ivt),u=M(bW),d=Cn(lvt),f=M(SW),p=M(ZYe),g=M(eOe),A=Cn(svt),y=dt($Ye),S=dt(evt),C=dt(nvt),P=dt(QYe),v=dt(tvt),T=dt(ovt),w=M(NBe),x=M(Mge),b=M(gW)??900,R=dt(n5),{scene:H}=ri(),F=$t(),E=u1(t),N=new Date(r.date),U=t?E==null?void 0:E.elevation:0,W=r.timesPerHour??4,k=60/W,D=r.daysPerYear??6,L=12/D,j=m.useMemo(()=>new l0,[]),B=r.monthlyIrradianceLosses??new Array(12).fill(.05),O=r.pvGridCellSize??.25,V=m.useRef([]),G=m.useRef([]),q=m.useRef(0),$=m.useRef(!1),ie=m.useRef(new Date(r.date)),Q=m.useRef(new Map),se=m.useRef(new Map),oe=m.useRef(0),Z=m.useRef(!1),te=m.useRef(new Date(r.date)),ee=m.useRef(0),de=m.useRef(20),fe=m.useMemo(()=>dl(N,r.latitude),[r.date,r.latitude]),pe=m.useRef(fe),ye=me.daysInYear(N)/12;m.useEffect(()=>{if(y)if(x&&!me.hasMovingParts(i))setTimeout(()=>{ae(!1)},50);else return Te(),q.current=requestAnimationFrame(ge),()=>{cancelAnimationFrame(q.current),$.current||(gn(Y.t("message.SimulationAborted",F)),e(Ee=>{Ee.world.date=ie.current.toLocaleString("en-US")}),dt.getState().set(Ee=>{Ee.simulationInProgress=!1,Ee.simulationPaused=!1})),Z.current=!1}},[y]),m.useEffect(()=>{S&&x&&!me.hasMovingParts(i)&&setTimeout(()=>{ae(!0)},50)},[S]),m.useEffect(()=>{Z.current=C,C?(te.current=new Date(N.getTime()),cancelAnimationFrame(q.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",F))):(n("simulationPaused",!1),ge())},[C]);const ae=Ee=>{We(),Ie();for(const ke of i)ke.type===z.SolarPanel&&we(ke);if(e(ke=>{!R&&!Ee&&(ke.viewState.showDailyPvYieldPanel=!0,ke.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(ke=>{Ee?ke.runDailySimulationForSolarPanelsLastStep=!1:ke.runDailySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,Se(),!R&&!Ee&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumDailyPvYield(),Oe=Cn.getState().getDailyPvProfit(),st=Cn.getState().dailyPvYield;e(je=>{je.actionInfo={name:"Static Daily Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}},Te=()=>{Z.current?(N.setTime(te.current.getTime()),Z.current=!1):(ie.current=new Date(r.date),ee.current=N.getDay(),N.setHours(Math.floor(fe.sunrise/60),-k/2)),$.current=!1,We(),Ie()},ge=()=>{if(y&&!Z.current){if(N.getMinutes()+N.getHours()*60+(N.getDay()-ee.current)*T2+k>=fe.sunset){if(cancelAnimationFrame(q.current),e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),R||(ke.viewState.showDailyPvYieldPanel=!0,ke.selectedFloatingWindow="dailyPvYieldPanel")}),dt.getState().set(ke=>{ke.runDailySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,Se(),!R&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumDailyPvYield(),Oe=Cn.getState().getDailyPvProfit(),st=Cn.getState().dailyPvYield;e(je=>{je.actionInfo={name:"Dynamic Daily Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}return}N.setHours(N.getHours(),N.getMinutes()+k),e(ke=>{ke.world.date=N.toLocaleString("en-US")});for(const ke of i)ke.type===z.SolarPanel&&Pe(ke);q.current=requestAnimationFrame(ge)}},Se=()=>{const Ee=ze();for(const ke of i)if(ke.type===z.SolarPanel){const Oe=ke,st=Q.current.get(ke.id);if(st){const je=Je(Oe)*Ee;for(let xt=0;xt{var Ee;if(p){const ke=new Array(24).fill(0),Oe=new Map;let st=0;const je=[];for(const gt of i)if(gt.type===z.SolarPanel){const Ye=Q.current.get(gt.id);if(Ye){u(gt.id,Ye.reduce((it,ut)=>it+ut,0)),st++,Oe.set("Panel"+st,Ye),je.push(gt.label?gt.label:"Panel"+st);for(let it=0;it<24;it++)ke[it]+=Ye[it]}}const xt=[];for(let gt=0;gt<24;gt++){const Ye={};Ye.Hour=gt;for(let it=1;it<=st;it++){const ut="Panel"+it;Ye[je[it-1]]=(Ee=Oe.get(ut))==null?void 0:Ee[gt]}xt.push(Ye)}c(xt),A(je)}else{const ke=new Array(24).fill(0);for(const st of i)if(st.type===z.SolarPanel){const je=Q.current.get(st.id);if(je){u(st.id,je.reduce((xt,gt)=>xt+gt,0));for(let xt=0;xt<24;xt++)ke[xt]+=je[xt]}}const Oe=[];for(let st=0;st<24;st++)Oe.push({Hour:st,Total:ke[st]});c(Oe)}};m.useEffect(()=>{if(P)if(x&&!me.hasMovingParts(i))setTimeout(()=>{Ae(!1)},50);else return De(),q.current=requestAnimationFrame(ue),()=>{cancelAnimationFrame(q.current),$.current||(gn(Y.t("message.SimulationAborted",F)),e(Ee=>{Ee.world.date=ie.current.toLocaleString("en-US")}),dt.getState().set(Ee=>{Ee.simulationInProgress=!1,Ee.simulationPaused=!1})),Z.current=!1}},[P]),m.useEffect(()=>{v&&x&&!me.hasMovingParts(i)&&setTimeout(()=>{Ae(!0)},50)},[v]),m.useEffect(()=>{Z.current=T,T?(te.current=new Date(N.getTime()),cancelAnimationFrame(q.current),n("simulationPaused",!0),gn(Y.t("message.SimulationPaused",F))):(n("simulationPaused",!1),ue())},[T]);const De=()=>{Z.current?(N.setTime(te.current.getTime()),Z.current=!1):(ie.current=new Date(r.date),oe.current=0,N.setMonth(0,22),ee.current=N.getDay(),pe.current=dl(N,r.latitude),N.setHours(Math.floor(pe.current.sunrise/60),-k/2),e(Ee=>{Ee.world.date=N.toLocaleString("en-US")})),$.current=!1,We(),Ie(),Me()},Ae=Ee=>{We(),Ie(),Me(),ie.current=new Date(r.date),oe.current=0;for(let ke=0;ke<12;ke+=L){N.setMonth(ke,22),pe.current=dl(N,r.latitude),Ie();for(const Oe of i)Oe.type===z.SolarPanel&&we(Oe);he(),oe.current++}if(e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),!R&&!Ee&&(ke.viewState.showYearlyPvYieldPanel=!0,ke.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(ke=>{Ee?ke.runYearlySimulationForSolarPanelsLastStep=!1:ke.runYearlySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,ve(),!R&&!Ee&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumYearlyPvYield(),Oe=Cn.getState().getYearlyPvProfit(),st=Cn.getState().yearlyPvYield;e(je=>{je.actionInfo={name:"Static Yearly Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}},ue=()=>{if(P&&!Z.current)if(N.getMinutes()+N.getHours()*60+(N.getDay()-ee.current)*T2+k{ke.world.date=N.toLocaleString("en-US")});for(const ke of i)ke.type===z.SolarPanel&&Pe(ke);q.current=requestAnimationFrame(ue)}else{if(he(),oe.current++,oe.current===D){if(cancelAnimationFrame(q.current),e(ke=>{ke.world.date=ie.current.toLocaleString("en-US"),R||(ke.viewState.showYearlyPvYieldPanel=!0,ke.selectedFloatingWindow="yearlyPvYieldPanel")}),dt.getState().set(ke=>{ke.runYearlySimulationForSolarPanels=!1,ke.simulationInProgress=!1,ke.simulationPaused=!1}),$.current=!0,ve(),!R&&(gn(Y.t("message.SimulationCompleted",F)),o)){const ke=Cn.getState().sumYearlyPvYield(),Oe=Cn.getState().getYearlyPvProfit(),st=Cn.getState().yearlyPvYield;e(je=>{je.actionInfo={name:"Dynamic Yearly Simulation for Solar Panels Completed",result:{totalYield:ke.toFixed(2),profit:Oe.toFixed(2)},details:st,timestamp:new Date().getTime()}})}return}N.setMonth(oe.current*L,22),ee.current=N.getDay(),pe.current=dl(N,r.latitude),N.setHours(Math.floor(pe.current.sunrise/60),-k/2),Ie(),q.current=requestAnimationFrame(ue)}},he=()=>{const Ee=Ne();for(const ke of i)if(ke.type===z.SolarPanel){const Oe=ke,st=Q.current.get(ke.id);if(st){const je=se.current.get(ke.id);if(je){const xt=st.reduce((gt,Ye)=>gt+Ye,0);je[oe.current]+=xt*Ee*Je(Oe)}}}!R&&w&&Se()},ve=()=>{if(g){const Ee=[],ke=[];let Oe=0;for(const je of i)if(je.type===z.SolarPanel){const xt=se.current.get(je.id);xt&&(f(je.id,xt.reduce((gt,Ye)=>gt+Ye,0)*L*ye),Ee.push(xt),Oe++,ke.push(je.label??"Panel"+Oe))}const st=[];for(let je=0;je<12;je+=L){const xt={};xt.Month=zs[je];for(const[gt,Ye]of Ee.entries())xt[ke[gt]]=Ye[je/L]*ye;st.push(xt)}d(st),A(ke)}else{const Ee=[];for(const Oe of i)if(Oe.type===z.SolarPanel){const st=se.current.get(Oe.id);st&&(f(Oe.id,st.reduce((je,xt)=>je+xt,0)*L*ye),Ee.push(st))}const ke=[];for(let Oe=0;Oe<12;Oe+=L){let st=0;for(const je of Ee)st+=je[Oe/L];ke.push({Month:zs[Oe],Total:st*ye})}d(ke)}},we=Ee=>{if(Ee.trackerType!==Ll.NO_TRACKER)throw new Error("static simulation is not for solar panel with tracker");let ke=l(Ee);if(!ke)throw new Error("parent of solar panel does not exist");const Oe=Ee.parentType===z.Roof,st=Ee.parentType===z.Wall;if(Oe&&(ke=s(ke),!ke))throw new Error("foundation of solar panel does not exist");const je=a(Ee.pvModelName);if(!je)throw new Error("PV model not found");const xt=Q.current.get(Ee.id);if(!xt)return;const gt=st?me.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,s(Ee),Ee.lz):me.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,void 0,void 0,!0),Ye=ke.rotation[2];let it=Ye+Ee.relativeAzimuth,ut=Ee.tiltAngle,Qe=!0;if(Oe&&(gt.z=Ee.cz+Ee.lz+.02+ke.cz,me.isZero(Ee.rotation[0])?gt.z+=Ee.poleHeight:(ut=Ee.rotation[0],it=Ye,Qe=!1)),st&&!me.isZero(Ee.tiltAngle)){const at=ke,Ge=s(ke),Pt=(Ge?Ge.rotation[2]+at.relativeAngle:at.relativeAngle)-Qt,ot=Ee.ly*Math.abs(Math.sin(Ee.tiltAngle))/2;gt.x+=ot*Math.cos(Pt),gt.y+=ot*Math.sin(Pt)}const lt=new le().fromArray(Ee.normal),Ze=new ln(Oe&&!Qe?0:ut,0,it,"ZYX");lt.applyEuler(Ze);const Be=N.getFullYear(),$e=N.getMonth(),wt=N.getDate(),vt=me.dayOfYear(N);let Rt,Gt,At,pt,Wt;r.discretization===Em.EXACT?(Rt=Ee.lx,Gt=Ee.ly,Ee.orientation===vr.portrait?(At=Math.max(1,Math.round(Ee.lx/je.width)),pt=Math.max(1,Math.round(Ee.ly/je.length)),At*=je.n,pt*=je.m):(At=Math.max(1,Math.round(Ee.lx/je.length)),pt=Math.max(1,Math.round(Ee.ly/je.width)),At*=je.m,pt*=je.n),Wt=Ee.lx/At):(Rt=Ee.lx,Gt=Ee.ly,At=Math.max(2,Math.round(Ee.lx/O)),pt=Math.max(2,Math.round(Ee.ly/O)),At%2!==0&&(At+=1),pt%2!==0&&(pt+=1),Wt=O);const ht=Rt/At,ct=Gt/pt,It=gt.x-(Rt-Wt)/2,Ft=gt.y-(Gt-Wt)/2,Ve=Oe||st?gt.z:ke.lz+Ee.poleHeight+Ee.lz,ft=new Kt(gt.x,gt.y),kt=new le,rt=Array.from(Array(At),()=>new Array(pt));Oe&&!Qe&&(Ze.x=Ee.rotation[0],Ze.z=Ee.rotation[2]+Ye),st&&(Ze.x=Qt+Ee.tiltAngle,Ze.z=ke.relativeAngle+Ye);for(let at=0;at<24;at++)for(let Ge=0;Ge0){const ot=xi(Pt,vt,U,li.SPHERE_MODEL),bt=qr(r.ground,$e,lt,ot),zt=lt.dot(Pt),Bt=new Kt,tt=new le;if(je.bifacialityFactor>0){const qt=lt.clone().negate(),un=qr(r.ground,$e,qt,ot),Rn=bt+un*je.bifacialityFactor;for(let yo=0;yo0?zt:-zt*je.bifacialityFactor)*ot)}else for(let qt=0;qt0&&(Bt.set(It+qt*ht,Ft+un*ct),tt.set(Bt.x-ft.x,Bt.y-ft.y,0),tt.applyEuler(Ze),kt.set(gt.x+tt.x,gt.y+tt.y,Ve+tt.z),nt(Ee.id,kt,Pt)||(rt[qt][un]+=zt*ot));let Ht=0;Ue(yt);const _t=jFe(de.current,je);switch(je.shadeTolerance){case m8.NONE:{let qt=Number.MAX_VALUE;for(let un=0;un{let ke=l(Ee);if(!ke)throw new Error("parent of solar panel does not exist");const Oe=Ee.parentType===z.Roof,st=Ee.parentType===z.Wall;if(Oe&&(ke=s(ke),!ke))throw new Error("foundation of solar panel does not exist");const je=a(Ee.pvModelName);if(!je)throw new Error("PV model not found");const xt=ki(N,r.latitude);if(xt.z<=0)return;const gt=st?me.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,s(Ee),Ee.lz):me.absoluteCoordinates(Ee.cx,Ee.cy,Ee.cz,ke,void 0,void 0,!0),Ye=ke.rotation[2];let it=Ee.tiltAngle,ut=Ye+(st?0:Ee.relativeAzimuth),Qe=!0;if(Oe&&(gt.z=Ee.cz+Ee.lz+.02+ke.cz,me.isZero(Ee.rotation[0])?gt.z+=Ee.poleHeight:(it=Ee.rotation[0],ut=Ye,Qe=!1)),st&&!me.isZero(Ee.tiltAngle)){const bt=ke,zt=s(ke),tt=(zt?zt.rotation[2]+bt.relativeAngle:bt.relativeAngle)-Qt,Ht=Ee.ly*Math.abs(Math.sin(Ee.tiltAngle))/2;gt.x+=Ht*Math.cos(tt),gt.y+=Ht*Math.sin(tt)}const lt=new le().fromArray(Ee.normal),Ze=N.getMonth(),Be=me.dayOfYear(N);let $e,wt,vt,Rt,Gt;r.discretization===Em.EXACT?($e=Ee.lx,wt=Ee.ly,Ee.orientation===vr.portrait?(vt=Math.max(1,Math.round(Ee.lx/je.width)),Rt=Math.max(1,Math.round(Ee.ly/je.length)),vt*=je.n,Rt*=je.m):(vt=Math.max(1,Math.round(Ee.lx/je.length)),Rt=Math.max(1,Math.round(Ee.ly/je.width)),vt*=je.m,Rt*=je.n),Gt=Ee.lx/vt):($e=Ee.lx,wt=Ee.ly,vt=Math.max(2,Math.round(Ee.lx/O)),Rt=Math.max(2,Math.round(Ee.ly/O)),vt%2!==0&&(vt+=1),Rt%2!==0&&(Rt+=1),Gt=O);const At=$e/vt,pt=wt/Rt,Wt=gt.x-($e-Gt)/2,ht=gt.y-(wt-Gt)/2,ct=Oe||st?gt.z:ke.lz+Ee.poleHeight+Ee.lz,It=new Kt(gt.x,gt.y),Ft=new le,Ve=Array.from(Array(vt),()=>new Array(Rt));let ft=new ln(Oe&&!Qe?0:it,0,ut,"ZYX");if(Ee.trackerType!==Ll.NO_TRACKER){const bt=Ye?xt.clone().applyAxisAngle(ko,-Ye):xt.clone();switch(Ee.trackerType){case Ll.ALTAZIMUTH_DUAL_AXIS_TRACKER:{const zt=new Ts().setFromUnitVectors(ko,bt);ft=new ln().setFromQuaternion(zt),ft.z+=ut;break}case Ll.HORIZONTAL_SINGLE_AXIS_TRACKER:{const zt=new Ts().setFromUnitVectors(ko,new le(bt.x,0,bt.z).normalize());ft=new ln().setFromQuaternion(zt),ft.z+=ut;break}case Ll.VERTICAL_SINGLE_AXIS_TRACKER:{const zt=new le(bt.x,-bt.y,0).normalize(),Bt=Math.acos(Yc.dot(zt))*Math.sign(zt.x);ft=new ln(Ee.tiltAngle,0,Bt+Ye,"ZYX");break}case Ll.TILTED_SINGLE_AXIS_TRACKER:break}}if(st&<.applyEuler(new ln(0,0,ke.relativeAngle)),lt.applyEuler(ft),Oe&&!Qe&&(ft.x=Ee.rotation[0],ft.z=Ee.rotation[2]+Ye),st){const bt=l(Ee);bt&&(ft.x=Qt+Ee.tiltAngle,ft.z=ke.relativeAngle+bt.rotation[2])}const kt=xi(xt,Be,U,li.SPHERE_MODEL),rt=qr(r.ground,Ze,lt,kt),at=lt.dot(xt),Ge=new Kt,yt=new le;if(je.bifacialityFactor>0){const bt=lt.clone().negate(),zt=qr(r.ground,Ze,bt,kt),Bt=rt+zt*je.bifacialityFactor;for(let tt=0;tt0?at:-at*je.bifacialityFactor)*kt)}else for(let bt=0;bt0&&(Ge.set(Wt+bt*At,ht+zt*pt),yt.set(Ge.x-It.x,Ge.y-It.y,0),yt.applyEuler(ft),Ft.set(gt.x+yt.x,gt.y+yt.y,ct+yt.z),nt(Ee.id,Ft,xt)||(Ve[bt][zt]+=at*kt));let Pt=0;switch(je.shadeTolerance){case m8.NONE:{let bt=Number.MAX_VALUE;for(let zt=0;zt=30?N.getHours()+1===24?0:N.getHours()+1:N.getHours();ot[zt]+=bt*Pt/(vt*Rt)}},Ie=()=>{for(const Ee of i)if(Ee.type===z.SolarPanel){const ke=Q.current.get(Ee.id);ke?ke.fill(0):Q.current.set(Ee.id,new Array(24).fill(0))}},Me=()=>{for(const Ee of i)if(Ee.type===z.SolarPanel){const ke=se.current.get(Ee.id);ke&&ke.length===D?ke.fill(0):se.current.set(Ee.id,new Array(D).fill(0))}},ze=()=>{const Ee=fe.daylight()/60;return Ee>Et?E.sunshineHours[N.getMonth()]/(30*Ee*W):0},Ne=()=>{const Ee=pe.current.daylight()/60;return Ee>Et?E.sunshineHours[N.getMonth()]/(30*Ee*W):0},Je=Ee=>{if(!a(Ee.pvModelName))throw new Error("PV model not found");return Ee.lx*Ee.ly*(Ee.inverterEfficiency??.95)*(1-B[N.getMonth()])},Ue=Ee=>{if(E){const ke=rb(Ee,E.lowestTemperatures,E.highestTemperatures);de.current=ob(ke.high,ke.low,r.diurnalTemperatureModel,b,dl(Ee,r.latitude),me.minutesIntoDay(Ee))}},nt=(Ee,ke,Oe)=>{if(V.current.length>1){G.current.length=0,j.set(ke,Oe);const st=V.current.filter(je=>je.uuid!==Ee);return j.intersectObjects(st,!1,G.current),G.current.length>0}return!1},We=()=>{const Ee=H.children.filter(ke=>ke.name==="Content");if(Ee.length>0){const ke=Ee[0].children;V.current.length=0;for(const Oe of ke)me.fetchSimulationElements(Oe,V.current)}};return h.jsx(h.Fragment,{})}),kBo=be.memo(()=>{const t=M(s0),e=M(Mb),n=M(qYe),o=M(KYe),r=M(Jge),[i,a]=m.useState("Boston MA, USA");return m.useEffect(()=>{if(Object.keys(r).length===0)return;const l=n(t,e)??"Boston MA, USA";a(l),o(l)},[t,e,r]),h.jsxs(h.Fragment,{children:[h.jsx(SBo,{city:i}),h.jsx(TBo,{city:i}),h.jsx(PBo,{city:i}),h.jsx(EBo,{city:i}),h.jsx(FBo,{city:i}),h.jsx(DBo,{}),h.jsx(CBo,{city:i}),h.jsx(RBo,{city:i}),h.jsx(HBo,{city:i}),h.jsx(MBo,{city:i}),h.jsx(IBo,{city:i})]})}),pV="/aladdin/assets/image_fail_try_again-CaxVXMjm.png";var XL=(t=>(t[t.None=0]="None",t[t.Equal=1]="Equal",t[t.LessThan=2]="LessThan",t[t.GreaterThan=3]="GreaterThan",t[t.Between=4]="Between",t))(XL||{});const LBo=5,WBo=be.memo(({yScale:t,tickLength:e,tickIntegers:n,variable:o,name:r,unit:i,type:a,digits:l,min:s,max:c,step:u,value:d,filter:f,hover:p})=>{const g=M(pn),A=M(yp),y=M(En),S=M(m0),C=M(XYe),P=M(Xge),v=M(JYe),T=M(oa),[w,x]=m.useState(!1),b=m.useRef(s),R=m.useRef(c);m.useEffect(()=>{b.current=s},[s]),m.useEffect(()=>{R.current=c},[c]);const H={lng:S},F=A.uid===C,E=t.range(),N=t(s)-t(c),U=40,W=m.useMemo(()=>{const oe=E[0]-E[1],Z=a==="number"?Math.floor(oe/e):1;return(n?t.ticks(Z).filter(ee=>Number.isInteger(ee)):t.ticks(Z)).map(ee=>({value:ee,yOffset:t(ee)}))},[t,e,a,n,E]),k=()=>{g(oe=>{oe.projectState.selectedProperty=oe.projectState.selectedProperty!==o?o:null,T&&(oe.actionInfo={name:"Select Property",timestamp:new Date().getTime(),details:oe.projectState.selectedProperty})}),dt.getState().set(oe=>{oe.updateProjectsFlag=!0})},D=()=>{F&&C&&P?KGn(C,P,v!==o?o:null).then(()=>{k()}):k()},L=(oe,Z)=>h.jsx("span",{style:{display:"block",width:Z+"px"},children:oe}),j=()=>h.jsx("text",{onClick:D,x:0,y:-20,style:{fontSize:"10px",textAnchor:"middle",fill:"dimgray",cursor:"pointer",fontWeight:v===o?"bold":"normal"},children:r}),B=m.useMemo(()=>o==="yearlyProfit"||o==="unitCost"||o==="sellingPrice"||o==="totalYearlyCost",[o]),O=()=>o==="totalYearlyCost"||o==="totalYearlyYield"||o==="meanYearlyYield"||o==="unitCost"||o==="poleHeight"||o==="interRowSpacing"?0:o==="tiltAngle"||o==="latitude"?-90:o==="rowWidth"?1:Number.MIN_SAFE_INTEGER,V=()=>o==="tiltAngle"||o==="latitude"?90:Number.MAX_SAFE_INTEGER,G=oe=>{if(oe===null)return;const Z=b.current,te={name:"Set Minimum: "+r,timestamp:Date.now(),oldValue:Z,newValue:oe,undo:()=>{q(Z)},redo:()=>{q(oe)}};y(te),q(oe)},q=oe=>{g(Z=>{if(Z.projectState.ranges){let te=-1,ee=null;for(const[de,fe]of Z.projectState.ranges.entries())if(fe.variable===o){te=de,ee=fe;break}if(te>=0&&ee)Z.projectState.ranges[te]={variable:ee.variable,minimum:oe,maximum:ee.maximum},A.uid&&Z.projectState.title&&YCe(A.uid,Z.projectState.title,Z.projectState.ranges).then(()=>{});else{const de={variable:o,minimum:oe,maximum:c};Z.projectState.ranges.push(de),A.uid&&Z.projectState.title&&NO(A.uid,Z.projectState.title,de).then(()=>{})}}else{const te={variable:o,minimum:oe,maximum:c};Z.projectState.ranges=[te],A.uid&&Z.projectState.title&&NO(A.uid,Z.projectState.title,te).then(()=>{})}}),b.current=Number(oe),x(!w)},$=oe=>{if(oe===null)return;const Z=R.current,te={name:"Set Maximum: "+r,timestamp:Date.now(),oldValue:Z,newValue:oe,undo:()=>{ie(Z)},redo:()=>{ie(oe)}};y(te),ie(oe)},ie=oe=>{g(Z=>{if(Z.projectState.ranges){let te=-1,ee=null;for(const[de,fe]of Z.projectState.ranges.entries())if(fe.variable===o){te=de,ee=fe;break}if(te>=0&&ee)Z.projectState.ranges[te]={variable:ee.variable,minimum:ee.minimum,maximum:oe},A.uid&&Z.projectState.title&&YCe(A.uid,Z.projectState.title,Z.projectState.ranges).then(()=>{});else{const de={variable:o,minimum:s,maximum:oe};Z.projectState.ranges.push(de),A.uid&&Z.projectState.title&&NO(A.uid,Z.projectState.title,de).then(()=>{})}}else{const te={variable:o,minimum:s,maximum:oe};Z.projectState.ranges=[te],A.uid&&Z.projectState.title&&NO(A.uid,Z.projectState.title,te).then(()=>{})}}),R.current=Number(oe),x(!w)},Q=oe=>{if(!f)return;const Z=[f.lowerBound,f.upperBound],te={name:"Set Filter: "+r,timestamp:Date.now(),oldValue:Z,newValue:oe,undo:()=>{se(Z)},redo:()=>{se(oe)}};y(te),se(oe)},se=oe=>{f&&(f.lowerBound=oe[0],f.upperBound=oe[1],p&&p(-1),g(Z=>{if(Z.projectState.filters){let te=-1;for(const[ee,de]of Z.projectState.filters.entries())if(de.variable===o){te=ee;break}if(te>=0)Z.projectState.filters[te]={variable:f.variable,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};else{const ee={variable:o,type:f.type,lowerBound:f.lowerBound,upperBound:f.upperBound};Z.projectState.filters.push(ee)}}}),x(!w))};return h.jsxs(h.Fragment,{children:[o!=="orientation"?h.jsx(Ml,{content:h.jsxs("div",{children:[h.jsx(Sn,{style:{width:"240px"},addonBefore:L(Y.t("word.Minimum",H)+(B?" $":""),80),addonAfter:i,min:O(),max:R.current-u,step:u,value:b.current,onPressEnter:oe=>G(Number.parseFloat(oe.target.value)),onStep:oe=>G(oe)}),h.jsx("br",{}),h.jsx(Sn,{style:{width:"240px"},addonBefore:L(Y.t("word.Maximum",H)+(B?" $":""),80),addonAfter:i,min:b.current+u,max:V(),step:u,value:R.current,onPressEnter:oe=>$(Number.parseFloat(oe.target.value)),onStep:oe=>$(oe)})]}),children:j()}):h.jsx(h.Fragment,{children:j()}),d!==void 0&&h.jsx("text",{x:0,y:-8,style:{fontSize:"9px",textAnchor:"middle",fill:"dimgray"},children:B?d.toLocaleString("en-US",{style:"currency",currency:"USD",maximumFractionDigits:l})+(o==="yearlyProfit"||o==="totalYearlyCost"?"K":""):(o==="orientation"?Y.t(d===0?"solarPanelMenu.Landscape":"solarPanelMenu.Portrait",H)+(d===0?" (▭)":" (▯)"):d.toFixed(l))+(i!==""?i:"")}),f&&f.type===XL.Between&&h.jsx("rect",{x:-5,y:t(f.upperBound??c),width:10,height:t((f==null?void 0:f.lowerBound)??s)-t((f==null?void 0:f.upperBound)??c),fill:"lightgray"}),h.jsx("rect",{x:-U/2,y:0,width:U,height:N,fill:"gold",fillOpacity:v===o?.25:0}),W.map(({value:oe,yOffset:Z})=>h.jsxs("g",{transform:`translate(0, ${Z})`,shapeRendering:"crispEdges",children:[h.jsx("line",{x1:-LBo,x2:0,stroke:"black",strokeWidth:1}),h.jsx("text",{style:{fontSize:"10px",textAnchor:"start",alignmentBaseline:"central",transform:"translateX(-25px)"},children:o==="orientation"?oe===0?"▭":"▯":oe},oe)]},oe)),h.jsx("line",{x1:0,x2:0,y1:t(s),y2:t(c),stroke:"black",strokeWidth:2}),f&&f.type===XL.Between&&h.jsx("foreignObject",{x:-U/2,y:4,width:U,height:N-3,children:h.jsx(fy,{theme:{components:{Slider:{railBg:"black",railSize:0,handleSize:8}}},children:h.jsx(Iu,{style:{marginLeft:U/2+"px"},min:s,max:c,step:(c-s)/100,value:[f.lowerBound??s,f.upperBound??c],onChange:oe=>se(oe),onChangeComplete:oe=>Q(oe),range:!0,vertical:!0})})})]})}),lP={top:30,right:55,bottom:36,left:55},NBo=["#e0ac2b","#e85252","#6689c6","#9a6fb0","#a53253","#69b3a2","#556b2f","#8b008b","#ff1493","#d2691e","#2f4f4f","#dc143c"],UBo=be.memo(({id:t,width:e,height:n,data:o,types:r,minima:i,maxima:a,filters:l,steps:s,variables:c,titles:u,units:d,digits:f,tickIntegers:p,hover:g,hoveredIndex:A,selectedIndex:y})=>{const S=e-lP.right-lP.left,C=n-lP.top-lP.bottom,P=m.useMemo(()=>[...new Set(o.map(H=>H.group))],[o]),v=m.useMemo(()=>YC().range([0,S]).domain(c).padding(0),[c,S]),T=m.useMemo(()=>{const H={};return c.forEach((F,E)=>{H[F]=yL().range([C,0]).domain([i[E]??0,a[E]??1])}),H},[c,i,a,C]),w=m.useMemo(()=>nte().domain(P).range(NBo),[P]),x=I3e(),b=m.useMemo(()=>o.map((H,F)=>{if(H.invisible)return null;const E=c.map(U=>{const W=T[U],k=v(U)??0,D=W(H[U]);return[k,D]}),N=x(E);if(N)return h.jsx("path",{onMouseOver:()=>{g(F)},d:N,stroke:H.hovered?"red":w(H.group),fill:"none",strokeWidth:H.excluded?.25:H.selected?3:1,strokeDasharray:H.hovered?"3,3":"none"},F)}),[o,c,v,T,w]),R=m.useMemo(()=>c.map((H,F)=>{const E=T[H];return h.jsx("g",{transform:"translate("+v(H)+",0)",children:h.jsx(WBo,{yScale:E,tickLength:40,tickIntegers:p[F],type:r[F]??"number",variable:c[F],name:u[F],unit:d[F],digits:f[F],min:i[F],max:a[F],step:s[F],value:A>=0&&!o[A].invisible?o[A][H]:y>=0&&!o[y].invisible?o[y][H]:void 0,filter:l[F],hover:g})},F)}),[c,o,v,T,p,r,u,d,f,i,a,s,l,y,A]);return h.jsx("svg",{id:t,width:e,height:n,onMouseLeave:()=>{g&&g(-1)},onContextMenu:H=>{H.stopPropagation()},children:h.jsxs("g",{width:S,height:C,transform:`translate(${[lP.left,lP.top].join(",")})`,children:[b,R]})})});var vpe={};(function(t){(function(){var e=t||!1||this||window;e.default=e;var n="http://www.w3.org/2000/xmlns/",o="http://www.w3.org/1999/xhtml",r="http://www.w3.org/2000/svg",i=']>',a=/url\(["']?(.+?)["']?\)/,l={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},s=function(E){return E instanceof HTMLElement||E instanceof SVGElement},c=function(E){if(!s(E))throw new Error("an HTMLElement or SVGElement is required; got "+E)},u=function(E){return new Promise(function(N,U){s(E)?N(E):U(new Error("an HTMLElement or SVGElement is required; got "+E))})},d=function(E){return E&&E.lastIndexOf("http",0)===0&&E.lastIndexOf(window.location.host)===-1},f=function(E){var N=Object.keys(l).filter(function(U){return E.indexOf("."+U)>0}).map(function(U){return l[U]});return N?N[0]:(console.error("Unknown font format for "+E+". Fonts may not be working correctly."),"application/octet-stream")},p=function(E){for(var N="",U=new Uint8Array(E),W=0;W"u"||W===null||isNaN(parseFloat(W))?0:W},A=function(E,N,U,W){if(E.tagName==="svg")return{width:U||g(E,N,"width"),height:W||g(E,N,"height")};if(E.getBBox){var k=E.getBBox(),D=k.x,L=k.y,j=k.width,B=k.height;return{width:D+j,height:L+B}}},y=function(E){return decodeURIComponent(encodeURIComponent(E).replace(/%([0-9A-F]{2})/g,function(N,U){var W=String.fromCharCode("0x"+U);return W==="%"?"%25":W}))},S=function(E){for(var N=window.atob(E.split(",")[1]),U=E.split(",")[0].split(":")[1].split(";")[0],W=new ArrayBuffer(N.length),k=new Uint8Array(W),D=0;D"u",G=L||[];return b().forEach(function(q){var $=q.rules,ie=q.href;$&&Array.from($).forEach(function(Q){if(typeof Q.style<"u")if(C(E,Q.selectorText))O.push(B(Q.selectorText,Q.style.cssText));else if(V&&Q.cssText.match(/^@font-face/)){var se=P(Q,ie);se&&G.push(se)}else j||O.push(Q.cssText)})}),w(G).then(function(q){return O.join(` -`)+q})},H=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};e.prepareSvg=function(F,E,N){c(F);var U=E||{},W=U.left,k=W===void 0?0:W,D=U.top,L=D===void 0?0:D,j=U.width,B=U.height,O=U.scale,V=O===void 0?1:O,G=U.responsive,q=G===void 0?!1:G,$=U.excludeCss,ie=$===void 0?!1:$;return v(F).then(function(){var Q=F.cloneNode(!0);Q.style.backgroundColor=(E||{}).backgroundColor||F.style.backgroundColor;var se=A(F,Q,j,B),Z=se.width,ee=se.height;if(F.tagName!=="svg")if(F.getBBox){Q.getAttribute("transform")!=null&&Q.setAttribute("transform",Q.getAttribute("transform").replace(/translate\(.*?\)/,""));var te=document.createElementNS("http://www.w3.org/2000/svg","svg");te.appendChild(Q),Q=te}else{console.error("Attempted to render non-SVG element",F);return}if(Q.setAttribute("version","1.1"),Q.setAttribute("viewBox",[k,L,Z,ee].join(" ")),Q.getAttribute("xmlns")||Q.setAttributeNS(n,"xmlns",r),Q.getAttribute("xmlns:xlink")||Q.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),q?(Q.removeAttribute("width"),Q.removeAttribute("height"),Q.setAttribute("preserveAspectRatio","xMinYMin meet")):(Q.setAttribute("width",Z*V),Q.setAttribute("height",ee*V)),Array.from(Q.querySelectorAll("foreignObject > *")).forEach(function(he){he.setAttributeNS(n,"xmlns",he.tagName==="svg"?r:o)}),ie){var oe=document.createElement("div");oe.appendChild(Q);var de=oe.innerHTML;if(typeof N=="function")N(de,Z,ee);else return{src:de,width:Z,height:ee}}else return R(F,E).then(function(he){var pe=document.createElement("style");pe.setAttribute("type","text/css"),pe.innerHTML=``;var me=document.createElement("defs");me.appendChild(pe),Q.insertBefore(me,Q.firstChild);var le=document.createElement("div");le.appendChild(Q);var Te=le.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if(typeof N=="function")N(Te,Z,ee);else return{src:Te,width:Z,height:ee}})})},e.svgAsDataUri=function(F,E,N){return c(F),e.prepareSvg(F,E).then(function(U){var W=U.src,k=U.width,D=U.height,L="data:image/svg+xml;base64,"+window.btoa(y(i+W));return typeof N=="function"&&N(L,k,D),L})},e.svgAsPngUri=function(F,E,N){c(F);var U=E||{},W=U.encoderType,k=W===void 0?"image/png":W,D=U.encoderOptions,L=D===void 0?.8:D,j=U.canvg,B=function(V){var G=V.src,q=V.width,$=V.height,ie=document.createElement("canvas"),Q=ie.getContext("2d"),se=window.devicePixelRatio||1;ie.width=q*se,ie.height=$*se,ie.style.width=ie.width+"px",ie.style.height=ie.height+"px",Q.setTransform(se,0,0,se,0,0),j?j(ie,G):Q.drawImage(G,0,0);var Z=void 0;try{Z=ie.toDataURL(k,L)}catch(ee){if(typeof SecurityError<"u"&&ee instanceof SecurityError||ee.name==="SecurityError"){console.error("Rendered SVG images cannot be downloaded in this browser.");return}else throw ee}return typeof N=="function"&&N(Z,ie.width,ie.height),Promise.resolve(Z)};return j?e.prepareSvg(F,E).then(B):e.svgAsDataUri(F,E).then(function(O){return new Promise(function(V,G){var q=new Image;q.onload=function(){return V(B({src:q,width:q.width,height:q.height}))},q.onerror=function(){G(`There was an error loading the data URI as an image on the following SVG +`)+q})},H=function(){if(!navigator.msSaveOrOpenBlob&&!("download"in document.createElement("a")))return{popup:window.open()}};e.prepareSvg=function(F,E,N){c(F);var U=E||{},W=U.left,k=W===void 0?0:W,D=U.top,L=D===void 0?0:D,j=U.width,B=U.height,O=U.scale,V=O===void 0?1:O,G=U.responsive,q=G===void 0?!1:G,$=U.excludeCss,ie=$===void 0?!1:$;return v(F).then(function(){var Q=F.cloneNode(!0);Q.style.backgroundColor=(E||{}).backgroundColor||F.style.backgroundColor;var se=A(F,Q,j,B),oe=se.width,Z=se.height;if(F.tagName!=="svg")if(F.getBBox){Q.getAttribute("transform")!=null&&Q.setAttribute("transform",Q.getAttribute("transform").replace(/translate\(.*?\)/,""));var te=document.createElementNS("http://www.w3.org/2000/svg","svg");te.appendChild(Q),Q=te}else{console.error("Attempted to render non-SVG element",F);return}if(Q.setAttribute("version","1.1"),Q.setAttribute("viewBox",[k,L,oe,Z].join(" ")),Q.getAttribute("xmlns")||Q.setAttributeNS(n,"xmlns",r),Q.getAttribute("xmlns:xlink")||Q.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink"),q?(Q.removeAttribute("width"),Q.removeAttribute("height"),Q.setAttribute("preserveAspectRatio","xMinYMin meet")):(Q.setAttribute("width",oe*V),Q.setAttribute("height",Z*V)),Array.from(Q.querySelectorAll("foreignObject > *")).forEach(function(fe){fe.setAttributeNS(n,"xmlns",fe.tagName==="svg"?r:o)}),ie){var ee=document.createElement("div");ee.appendChild(Q);var de=ee.innerHTML;if(typeof N=="function")N(de,oe,Z);else return{src:de,width:oe,height:Z}}else return R(F,E).then(function(fe){var pe=document.createElement("style");pe.setAttribute("type","text/css"),pe.innerHTML=``;var ye=document.createElement("defs");ye.appendChild(pe),Q.insertBefore(ye,Q.firstChild);var ae=document.createElement("div");ae.appendChild(Q);var Te=ae.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if(typeof N=="function")N(Te,oe,Z);else return{src:Te,width:oe,height:Z}})})},e.svgAsDataUri=function(F,E,N){return c(F),e.prepareSvg(F,E).then(function(U){var W=U.src,k=U.width,D=U.height,L="data:image/svg+xml;base64,"+window.btoa(y(i+W));return typeof N=="function"&&N(L,k,D),L})},e.svgAsPngUri=function(F,E,N){c(F);var U=E||{},W=U.encoderType,k=W===void 0?"image/png":W,D=U.encoderOptions,L=D===void 0?.8:D,j=U.canvg,B=function(V){var G=V.src,q=V.width,$=V.height,ie=document.createElement("canvas"),Q=ie.getContext("2d"),se=window.devicePixelRatio||1;ie.width=q*se,ie.height=$*se,ie.style.width=ie.width+"px",ie.style.height=ie.height+"px",Q.setTransform(se,0,0,se,0,0),j?j(ie,G):Q.drawImage(G,0,0);var oe=void 0;try{oe=ie.toDataURL(k,L)}catch(Z){if(typeof SecurityError<"u"&&Z instanceof SecurityError||Z.name==="SecurityError"){console.error("Rendered SVG images cannot be downloaded in this browser.");return}else throw Z}return typeof N=="function"&&N(oe,ie.width,ie.height),Promise.resolve(oe)};return j?e.prepareSvg(F,E).then(B):e.svgAsDataUri(F,E).then(function(O){return new Promise(function(V,G){var q=new Image;q.onload=function(){return V(B({src:q,width:q.width,height:q.height}))},q.onerror=function(){G(`There was an error loading the data URI as an image on the following SVG `+window.atob(O.slice(26))+`Open the following link to see browser's diagnosis `+O)},q.src=O})})},e.download=function(F,E,N){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(S(E),F);else{var U=document.createElement("a");if("download"in U){U.download=F,U.style.display="none",document.body.appendChild(U);try{var W=S(E),k=URL.createObjectURL(W);U.href=k,U.onclick=function(){return requestAnimationFrame(function(){return URL.revokeObjectURL(k)})}}catch(D){console.error(D),console.warn("Error while getting object URL. Falling back to string URL."),U.href=E}U.click(),document.body.removeChild(U)}else N&&N.popup&&(N.popup.document.title=F,N.popup.location.replace(E))}},e.saveSvg=function(F,E,N){var U=H();return u(F).then(function(W){return e.svgAsDataUri(W,N||{})}).then(function(W){return e.download(E,W,U)})},e.saveSvgAsPng=function(F,E,N){var U=H();return u(F).then(function(W){return e.svgAsPngUri(W,N||{})}).then(function(W){return e.download(E,W,U)})}})()})(vpe);const jBo=be.memo(({horizontalGrid:t,verticalGrid:e,symbolSize:n,changeHorizontalGrid:o,changeVerticalGrid:r,changeSymbolSize:i})=>{const a=$t(),[l,s]=m.useState(!1),c=()=>{o==null||o(!t)},u=()=>{r==null||r(!e)},d=f=>{i==null||i(f)};return h.jsx(Ml,{content:h.jsxs("div",{style:{width:"200px"},children:[h.jsx(kC,{min:1,max:8,value:n,onChange:d,children:Y.t("menu.graph.SymbolSize",a)+":"}),h.jsx(yw,{checked:t,onClick:c,children:Y.t("menu.graph.ShowHorizontalGridLines",a)}),h.jsx(yw,{checked:e,onClick:u,children:Y.t("menu.graph.ShowHorizontalGridLines",a)})]}),children:h.jsx(Mon,{style:{position:"absolute",fontSize:"20px",top:"10px",right:"10px",transition:"0.5s",color:l?"black":"darkgray",cursor:"pointer"},onMouseOver:()=>{s(!0)},onMouseOut:()=>{s(!1)}})})}),{TextArea:BBo}=jl,{Option:Vh}=Uo,YBo=Ho.div` position: relative; @@ -9615,5 +9615,5 @@ yr.version="2.29.4";Hko(xc);yr.fn=$o;yr.min=gWo;yr.max=mWo;yr.now=yWo;yr.utc=b3; justify-content: space-between; align-items: flex-start; background: white; -`,JBo=be.memo(({relativeWidth:t,canvas:e})=>{const n=M(pn),o=M(yp),r=M(oa),i=M(En),a=M(Fge),l=M(zb),s=M(Xge),c=M(XYe),u=M(H7t),d=M(M7t),f=M(JYe),p=M(R7t),g=M(I7t),A=M(z7t),y=M(N7t),S=M(k7t),C=M(W7t),P=M(L7t),v=M(D7t),T=M(E7t),w=M(F7t),x=M(c$),b=M(a$),[R,H]=m.useState(),[F,E]=m.useState(),[N,U]=m.useState(!1),[W,k]=m.useState(!1),D=m.useRef(!1),L=m.useRef(p??null),j=m.useRef(!1),B=m.useRef(!1),O=m.useRef(g??d9.ALL),V=m.useRef(!1),G=m.useRef(u??[]),q=m.useRef(A??200),$=m.useRef(v??"rowWidth"),ie=m.useRef(T??"rowWidth"),Q=m.useRef(w??5),se=m.useRef(!0),Z=m.useRef(!0);m.useEffect(()=>{$.current=v??"rowWidth"},[v]),m.useEffect(()=>{ie.current=T??"rowWidth"},[T]),m.useEffect(()=>{Q.current=w??5},[w]),m.useEffect(()=>{q.current=A??200},[A]);const{t:ee}=Xl(),te=$t(),oe=o.uid===c;m.useEffect(()=>{if(G.current=[],u){for(const Ht of u)G.current.push(Ht);const tt=f;if(tt){const Ht=S?1:-1;G.current.sort((_t,qt)=>tt?tt==="rowWidth"&&"rowsPerRack"in _t&&"rowsPerRack"in qt?Ht*(_t.rowsPerRack-qt.rowsPerRack):tt==="orientation"?Ht*((_t[tt]==="Landscape"?0:1)-(qt[tt]==="Landscape"?0:1)):tt==="totalYearlyYield"&&"yearlyYield"in _t&&"yearlyYield"in qt?Ht*(_t.yearlyYield-qt.yearlyYield):tt==="meanYearlyYield"&&"yearlyYield"in _t&&"yearlyYield"in qt?Ht*(_t.yearlyYield/_t.panelCount-qt.yearlyYield/qt.panelCount):tt==="totalYearlyCost"?Ht*(ye.calculateCost(_t)-ye.calculateCost(qt)):tt==="yearlyProfit"?Ht*(ye.calculateProfit(_t)-ye.calculateProfit(qt)):tt in _t&&tt in qt?Ht*(_t[tt]-qt[tt]):0:0)}U(!N)}},[u,S,f]),m.useEffect(()=>{if(H(void 0),u){for(const tt of u)if(tt.title===l){H(tt);break}}},[l,u]),m.useEffect(()=>{const tt=()=>{U(!N)};return window.addEventListener("resize",tt),()=>{window.removeEventListener("resize",tt)}},[N]);const de=()=>{n(tt=>{r&&(tt.actionInfo={name:"Close Project",timestamp:new Date().getTime(),details:tt.projectState.title}),tt.projectView=!1,tt.projectState.title=null,tt.projectState.description=null,tt.projectState.owner=null,tt.projectImages.clear()}),H(void 0),a.clear(),dt.getState().set(tt=>{tt.projectImagesUpdateFlag=!tt.projectImagesUpdateFlag})},he=()=>{dt.getState().set(tt=>{tt.curateDesignToProjectFlag=!0}),r&&n(tt=>{tt.actionInfo={name:"Curate Current Design",timestamp:new Date().getTime()}})},pe=()=>{o.uid&&s&&R&&_Gn(o.uid,s,R).then(()=>{n(tt=>{if(tt.projectState.designs){let Ht=-1;for(const[_t,qt]of tt.projectState.designs.entries())if(qt.title===R.title){Ht=_t;break}Ht>=0&&(tt.projectState.designs.splice(Ht,1),r&&(tt.actionInfo={name:"Remove Selected Design",timestamp:new Date().getTime(),details:R.title}))}})})},me=window.innerHeight,le=Math.round(800/q.current),Te=48/le,ge=Math.round(t*window.innerWidth/le-Te),[Se,Re,De,Ae,ue,fe]=m.useMemo(()=>[gd.getVariables(d,y??[]),gd.getTitles(d,te,y??[]),gd.getUnits(d,te,y??[]),gd.getDigits(d,y??[]),gd.getTickIntegers(d,y??[]),gd.getTypes(d,y??[])],[d,y,W,te]),ve=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){const _t={};if(y!=null&&y.includes("rowWidth")||(_t.rowWidth=Ht.rowsPerRack),y!=null&&y.includes("tiltAngle")||(_t.tiltAngle=ye.toDegrees(Ht.tiltAngle)),y!=null&&y.includes("interRowSpacing")||(_t.interRowSpacing=Ht.interRowSpacing),y!=null&&y.includes("latitude")||(_t.latitude=Ht.latitude??42),y!=null&&y.includes("orientation")||(_t.orientation=Ht.orientation===vr.landscape?0:1),y!=null&&y.includes("poleHeight")||(_t.poleHeight=Ht.poleHeight),y!=null&&y.includes("unitCost")||(_t.unitCost=Ht.unitCost),y!=null&&y.includes("sellingPrice")||(_t.sellingPrice=Ht.sellingPrice),y!=null&&y.includes("")||(_t.totalYearlyCost=ye.calculateCost(Ht)),y!=null&&y.includes("totalYearlyYield")||(_t.totalYearlyYield=Ht.yearlyYield*.001),y!=null&&y.includes("meanYearlyYield")||(_t.meanYearlyYield=Ht.yearlyYield/Ht.panelCount),y!=null&&y.includes("yearlyProfit")||(_t.yearlyProfit=ye.calculateProfit(Ht)),_t.group=g===d9.INDIVIDUALS?Ht.title:"default",_t.selected=R===Ht,_t.hovered=F===Ht,_t.invisible=Ht.invisible,_t.excluded=!1,P){for(const qt of P)if(qt.type===XL.Between&&qt.upperBound!==void 0&&qt.lowerBound!==void 0){const un=_t[qt.variable];if(typeof un=="number"&&(un>qt.upperBound||un{n(tt=>{if(tt.projectState.designs)for(const[Ht,_t]of tt.projectState.designs.entries())_t.excluded=ve[Ht].excluded})},[ve]);const we=(tt,Ht)=>{let _t=Ht;if(C){for(const qt of C)if(qt.variable===tt){_t=qt.minimum??Ht;break}}return _t},Pe=(tt,Ht)=>{let _t=Ht;if(C){for(const qt of C)if(qt.variable===tt){_t=qt.maximum??Ht;break}}return _t},Ie=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(we("rowWidth",x.minimumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(we("tiltAngle",ye.toDegrees(x.minimumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(we("interRowSpacing",x.minimumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(we("latitude",-90)),y!=null&&y.includes("orientation")||tt.push(0),y!=null&&y.includes("poleHeight")||tt.push(we("poleHeight",0)),y!=null&&y.includes("unitCost")||tt.push(we("unitCost",.1)),y!=null&&y.includes("sellingPrice")||tt.push(we("sellingPrice",.1)),y!=null&&y.includes("totalYearlyCost")||tt.push(we("totalYearlyCost",0)),y!=null&&y.includes("totalYearlyYield")||tt.push(we("totalYearlyYield",0)),y!=null&&y.includes("meanYearlyYield")||tt.push(we("meanYearlyYield",0)),y!=null&&y.includes("yearlyProfit")||tt.push(we("yearlyProfit",-10)),tt}return[]},[x,d,C,y,W]),Me=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(Pe("rowWidth",x.maximumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(Pe("tiltAngle",ye.toDegrees(x.maximumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(Pe("interRowSpacing",x.maximumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(Pe("latitude",90)),y!=null&&y.includes("orientation")||tt.push(1),y!=null&&y.includes("poleHeight")||tt.push(Pe("poleHeight",5)),y!=null&&y.includes("unitCost")||tt.push(Pe("unitCost",1)),y!=null&&y.includes("sellingPrice")||tt.push(Pe("sellingPrice",.5)),y!=null&&y.includes("totalYearlyCost")||tt.push(Pe("totalYearlyCost",100)),y!=null&&y.includes("totalYearlyYield")||tt.push(Pe("totalYearlyYield",100)),y!=null&&y.includes("meanYearlyYield")||tt.push(Pe("meanYearlyYield",1e3)),y!=null&&y.includes("yearlyProfit")||tt.push(Pe("yearlyProfit",10)),tt}return[]},[x,d,C,y,W]),ze=(tt,Ht)=>{let _t=Ht;if(P){for(const qt of P)if(qt.variable===tt){_t=qt.lowerBound??Ht;break}}return _t},Ne=(tt,Ht)=>{let _t=Ht;if(P){for(const qt of P)if(qt.variable===tt){_t=qt.upperBound??Ht;break}}return _t},Je=(tt,Ht,_t)=>({variable:tt,type:XL.Between,upperBound:Ne(tt,Ht),lowerBound:ze(tt,_t)}),Ue=m.useMemo(()=>{const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(Je("rowWidth",x.maximumRowsPerRack,x.minimumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(Je("tiltAngle",ye.toDegrees(x.maximumTiltAngle),ye.toDegrees(x.minimumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(Je("interRowSpacing",x.maximumInterRowSpacing,x.minimumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(Je("latitude",90,-90)),y!=null&&y.includes("orientation")||tt.push(Je("orientation",1,0)),y!=null&&y.includes("poleHeight")||tt.push(Je("poleHeight",5,0)),y!=null&&y.includes("unitCost")||tt.push(Je("unitCost",1,.1)),y!=null&&y.includes("sellingPrice")||tt.push(Je("sellingPrice",.5,.1)),y!=null&&y.includes("totalYearlyCost")||tt.push(Je("totalYearlyCost",100,0)),y!=null&&y.includes("totalYearlyYield")||tt.push(Je("totalYearlyYield",100,0)),y!=null&&y.includes("meanYearlyYield")||tt.push(Je("meanYearlyYield",1e3,0)),y!=null&&y.includes("yearlyProfit")||tt.push(Je("yearlyProfit",10,-10)),tt},[W,P,y]),nt=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(1),y!=null&&y.includes("tiltAngle")||tt.push(.1),y!=null&&y.includes("interRowSpacing")||tt.push(.1),y!=null&&y.includes("latitude")||tt.push(.1),y!=null&&y.includes("orientation")||tt.push(1),y!=null&&y.includes("poleHeight")||tt.push(.1),y!=null&&y.includes("unitCost")||tt.push(.01),y!=null&&y.includes("sellingPrice")||tt.push(.01),y!=null&&y.includes("totalYearlyCost")||tt.push(.1),y!=null&&y.includes("totalYearlyYield")||tt.push(1),y!=null&&y.includes("meanYearlyYield")||tt.push(1),y!=null&&y.includes("yearlyProfit")||tt.push(.1),tt}return[]},[d,y,W]),We=m.useRef(!(y!=null&&y.includes("rowWidth"))),Ee=m.useRef(!(y!=null&&y.includes("tiltAngle"))),ke=m.useRef(!(y!=null&&y.includes("interRowSpacing"))),Oe=m.useRef(!(y!=null&&y.includes("latitude"))),st=m.useRef(!(y!=null&&y.includes("orientation"))),je=m.useRef(!(y!=null&&y.includes("poleHeight"))),xt=m.useRef(!(y!=null&&y.includes("unitCost"))),gt=m.useRef(!(y!=null&&y.includes("sellingPrice"))),Ye=m.useRef(!(y!=null&&y.includes("totalYearlyCost"))),it=m.useRef(!(y!=null&&y.includes("totalYearlyYield"))),ut=m.useRef(!(y!=null&&y.includes("meanYearlyYield"))),Qe=m.useRef(!(y!=null&&y.includes("yearlyProfit")));m.useEffect(()=>{We.current=!(y!=null&&y.includes("rowWidth")),Ee.current=!(y!=null&&y.includes("tiltAngle")),ke.current=!(y!=null&&y.includes("interRowSpacing")),Oe.current=!(y!=null&&y.includes("latitude")),st.current=!(y!=null&&y.includes("orientation")),je.current=!(y!=null&&y.includes("poleHeight")),xt.current=!(y!=null&&y.includes("unitCost")),gt.current=!(y!=null&&y.includes("sellingPrice")),Ye.current=!(y!=null&&y.includes("totalYearlyCost")),it.current=!(y!=null&&y.includes("totalYearlyYield")),ut.current=!(y!=null&&y.includes("meanYearlyYield")),Qe.current=!(y!=null&&y.includes("yearlyProfit")),U(!N)},[y]),m.useEffect(()=>{L.current=p},[p]);const lt=tt=>{u&&(tt>=0&&tt{n(Ht=>{if(Ht.projectState.designs){for(const _t of Ht.projectState.designs)if(_t.title===tt){_t.invisible=!_t.invisible;break}}})},Be=tt=>{oe?o.uid&&s&&nXn(o.uid,s,tt).then(()=>{Ze(tt.title)}):Ze(tt.title)},$e=tt=>{const Ht={name:"Select Design Visibility",timestamp:Date.now(),checked:!!tt.invisible,property:tt.title,undo:()=>{Be(tt)},redo:()=>{Be(tt)}};i(Ht),Be(tt)},wt=(tt,Ht)=>{n(_t=>{_t.projectState.hiddenParameters&&(tt?_t.projectState.hiddenParameters.includes(Ht)&&_t.projectState.hiddenParameters.splice(_t.projectState.hiddenParameters.indexOf(Ht),1):_t.projectState.hiddenParameters.includes(Ht)||_t.projectState.hiddenParameters.push(Ht))})},vt=(tt,Ht)=>{V.current=!0,oe?o.uid&&s&&GGn(o.uid,s,Ht,!tt).then(()=>{wt(tt,Ht)}):wt(tt,Ht)},Rt=(tt,Ht)=>{const _t={name:"Select Parameter",timestamp:Date.now(),checked:tt,property:Ht,undo:()=>{vt(!tt,Ht)},redo:()=>{vt(tt,Ht)}};i(_t),vt(tt,Ht)},Gt=()=>{n(tt=>{tt.projectState.dataColoring=O.current}),dt.getState().set(tt=>{tt.updateProjectsFlag=!0}),U(!N)},At=tt=>{O.current=tt,oe?o.uid&&s&&JGn(o.uid,s,O.current).then(()=>{Gt()}):Gt()},pt=tt=>{const Ht={name:"Select Data Coloring",timestamp:Date.now(),oldValue:g,newValue:tt,undo:()=>{At(g)},redo:()=>{At(tt)}};i(Ht),At(tt)},Wt=()=>h.jsxs("div",{children:[h.jsx(Li,{style:{width:"100%"},onChange:tt=>{We.current=tt.target.checked,Rt(We.current,"rowWidth"),k(!W)},checked:We.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayRowWidth",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Ee.current=tt.target.checked,Rt(Ee.current,"tiltAngle"),k(!W)},checked:Ee.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTiltAngle",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{ke.current=tt.target.checked,Rt(ke.current,"interRowSpacing"),k(!W)},checked:ke.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayRowSpacing",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Oe.current=tt.target.checked,Rt(Oe.current,"latitude"),k(!W)},checked:Oe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("word.Latitude",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{st.current=tt.target.checked,Rt(st.current,"orientation"),k(!W)},checked:st.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayOrientation",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{je.current=tt.target.checked,Rt(je.current,"poleHeight"),k(!W)},checked:je.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayPoleHeight",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{xt.current=tt.target.checked,Rt(xt.current,"unitCost"),k(!W)},checked:xt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("economicsPanel.UnitCost",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{gt.current=tt.target.checked,Rt(gt.current,"sellingPrice"),k(!W)},checked:gt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("economicsPanel.SellingPrice",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Ye.current=tt.target.checked,Rt(Ye.current,"totalYearlyCost"),k(!W)},checked:Ye.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTotalYearlyCost",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{it.current=tt.target.checked,Rt(it.current,"totalYearlyYield"),k(!W)},checked:it.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTotalYearlyYield",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{ut.current=tt.target.checked,Rt(ut.current,"meanYearlyYield"),k(!W)},checked:ut.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayMeanYearlyYield",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Qe.current=tt.target.checked,Rt(Qe.current,"yearlyProfit"),k(!W)},checked:Qe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayYearlyProfit",te)})})]}),ht=()=>h.jsxs(h.Fragment,{children:[h.jsx(Vh,{value:"rowWidth",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayRowWidth",te)})},"rowWidth"),h.jsx(Vh,{value:"tiltAngle",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTiltAngle",te)})},"tiltAngle"),h.jsx(Vh,{value:"interRowSpacing",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayRowSpacing",te)})},"interRowSpacing"),h.jsx(Vh,{value:"latitude",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("word.Latitude",te)})},"latitude"),h.jsx(Vh,{value:"orientation",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayOrientation",te)})},"orientation"),h.jsx(Vh,{value:"poleHeight",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayPoleHeight",te)})},"poleHeight"),h.jsx(Vh,{value:"unitCost",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("economicsPanel.UnitCost",te)})},"unitCost"),h.jsx(Vh,{value:"sellingPrice",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("economicsPanel.SellingPrice",te)})},"sellingPrice"),h.jsx(Vh,{value:"totalYearlyCost",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTotalYearlyCost",te)})},"totalYearlyCost"),h.jsx(Vh,{value:"totalYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayTotalYearlyYield",te)})},"totalYearlyYield"),h.jsx(Vh,{value:"meanYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayMeanYearlyYield",te)})},"meanYearlyYield"),h.jsx(Vh,{value:"yearlyProfit",children:h.jsx("span",{style:{fontSize:"12px"},children:ee("polygonMenu.SolarPanelArrayYearlyProfit",te)})},"yearlyProfit")]}),ct=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){if(Ht.invisible||Ht===R)continue;const _t={};gd.setScatterData($.current,"x",_t,Ht),gd.setScatterData(ie.current,"y",_t,Ht),tt.push(_t)}return tt},[$.current,ie.current,u,d,R]),It=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){if(Ht!==R)continue;const _t={};gd.setScatterData($.current,"x",_t,Ht),gd.setScatterData(ie.current,"y",_t,Ht),tt.push(_t)}return tt},[$.current,ie.current,u,d,R]),Ft=tt=>{const Ht={min:0,max:1};if(d===Ri.SOLAR_PANEL_ARRAY&&x)switch(tt){case"rowWidth":Ht.min=we("rowWidth",x.minimumRowsPerRack),Ht.max=Pe("rowWidth",x.maximumRowsPerRack);break;case"tiltAngle":Ht.min=we("tiltAngle",ye.toDegrees(x.minimumTiltAngle)),Ht.max=Pe("tiltAngle",ye.toDegrees(x.maximumTiltAngle));break;case"interRowSpacing":Ht.min=we("interRowSpacing",x.minimumInterRowSpacing),Ht.max=Pe("interRowSpacing",x.maximumInterRowSpacing);break;case"latitude":Ht.min=we("latitude",-90),Ht.max=Pe("latitude",90);break;case"orientation":Ht.min=0,Ht.max=1;break;case"poleHeight":Ht.min=we("poleHeight",0),Ht.max=Pe("poleHeight",5);break;case"unitCost":Ht.min=we("unitCost",.1),Ht.max=Pe("unitCost",1);break;case"sellingPrice":Ht.min=we("sellingPrice",.1),Ht.max=Pe("sellingPrice",.5);break;case"totalYearlyCost":Ht.min=we("totalYearlyCost",0),Ht.max=Pe("totalYearlyCost",100);break;case"totalYearlyYield":Ht.min=we("totalYearlyYield",0),Ht.max=Pe("totalYearlyYield",100);break;case"meanYearlyYield":Ht.min=we("meanYearlyYield",0),Ht.max=Pe("meanYearlyYield",1e3);break;case"yearlyProfit":Ht.min=we("yearlyProfit",-10),Ht.max=Pe("yearlyProfit",10);break}return Ht},Ve=m.useMemo(()=>Ft($.current),[$.current,C]),ft=m.useMemo(()=>Ft(ie.current),[ie.current,C]),kt=m.useMemo(()=>gd.getUnit($.current,te),[$.current,te]),rt=m.useMemo(()=>gd.getUnit(ie.current,te),[ie.current,te]),at=tt=>{const Ht=$.current,_t={name:"Change X Axis",timestamp:Date.now(),oldValue:Ht,newValue:tt,undo:()=>{Ge(Ht)},redo:()=>{Ge(tt)}};i(_t),Ge(tt)},Ge=tt=>{$.current=tt,oe&&o.uid&&s&&qGn(o.uid,s,tt).then(()=>{}),U(!N)},yt=tt=>{const Ht=ie.current,_t={name:"Change Y Axis",timestamp:Date.now(),oldValue:Ht,newValue:tt,undo:()=>{Pt(Ht)},redo:()=>{Pt(tt)}};i(_t),Pt(tt)},Pt=tt=>{ie.current=tt,oe&&o.uid&&s&&$Gn(o.uid,s,tt).then(()=>{}),U(!N)},ot=()=>h.jsxs("div",{style:{width:"280px"},children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[ee("projectPanel.SelectXAxis",te),": "]})}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{style:{width:"100%"},value:$.current,onChange:tt=>at(tt),children:ht()})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[ee("projectPanel.SelectYAxis",te),": "]})}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{style:{width:"100%"},value:ie.current,onChange:tt=>yt(tt),children:ht()})})]}),h.jsx(nn,{style:{paddingBottom:"8px"},children:h.jsxs("div",{children:[h.jsxs(uko,{id:"scatter-chart",width:280,height:240,margin:{top:0,right:0,bottom:-10,left:-10},children:[h.jsx(Cw,{strokeWidth:"1",stroke:"gray",horizontal:se.current,vertical:Z.current}),h.jsx(l1,{dataKey:"x",fontSize:10,type:"number",domain:[Ve.min,Ve.max],name:"x",unit:kt,strokeWidth:1,stroke:"gray",tickFormatter:(tt,Ht)=>$.current==="yearlyProfit"||$.current==="unitCost"||$.current==="sellingPrice"?"$"+tt:tt}),h.jsx(wh,{dataKey:"y",fontSize:10,type:"number",domain:[ft.min,ft.max],name:"y",unit:rt,strokeWidth:1,stroke:"gray",tickFormatter:(tt,Ht)=>ie.current==="yearlyProfit"||ie.current==="unitCost"||ie.current==="sellingPrice"?"$"+tt:tt}),h.jsx(oh,{cursor:{strokeDasharray:"3 3"},formatter:tt=>tt.toFixed(2)}),h.jsx(xb,{name:"All",data:ct,fill:"#8884d8",shape:h.jsx(mU,{fill:"#8884d8",r:Q.current})}),R&&h.jsx(xb,{name:"Selected",data:It,fill:"red",shape:"star"})]}),h.jsx(jBo,{symbolSize:Q.current,horizontalGrid:se.current,verticalGrid:Z.current,changeHorizontalGrid:tt=>{se.current=tt,U(!N)},changeVerticalGrid:tt=>{Z.current=tt,U(!N)},changeSymbolSize:tt=>{Q.current=tt,oe&&o.uid&&s&&QGn(o.uid,s,tt).then(()=>{}),U(!N)}})]})}),h.jsx(nn,{children:h.jsx("span",{style:{width:"100%",textAlign:"center"},children:h.jsx(_u,{style:{fontSize:"18px",color:"gray",paddingRight:"8px"},title:ee("projectPanel.ScatterPlotScreenshot",te),onClick:()=>{const tt=document.getElementById("scatter-chart");tt&&vpe.saveSvgAsPng(tt,"scatter-chart-"+s+".png").then(()=>{gn(ee("message.ScreenshotSaved",te)),r&&n(Ht=>{Ht.actionInfo={name:"Scatter chart screenshot",timestamp:new Date().getTime(),details:{image:"scatter-chart-"+s+".png"}}})})}})})})]}),bt=()=>h.jsx("div",{children:h.jsxs(Le.Group,{onChange:tt=>{pt(tt.target.value)},value:g??d9.ALL,children:[h.jsx(Le,{style:{fontSize:"12px",width:"100%"},value:d9.ALL,children:ee("projectPanel.SameColorForAllDesigns",te)}),h.jsx("br",{}),h.jsx(Le,{style:{fontSize:"12px",width:"100%"},value:d9.INDIVIDUALS,children:ee("projectPanel.OneColorForEachDesign",te)})]})}),zt=()=>h.jsx("div",{style:{width:"250px"},onClick:tt=>tt.stopPropagation(),children:h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[ee("projectPanel.ThumbnailImageSize",te),": "]})}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:tt=>{q.current=tt,oe?o.uid&&s&&ZGn(o.uid,s,tt).then(()=>{n(Ht=>{Ht.projectState.thumbnailWidth=q.current})}):n(Ht=>{Ht.projectState.thumbnailWidth=q.current}),U(!N)},children:[h.jsx(Vh,{value:100,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("word.Small",te)})},"small-thumbnail"),h.jsx(Vh,{value:125,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("word.Medium",te)})},"medium-thumbnail"),h.jsx(Vh,{value:200,children:h.jsx("span",{style:{fontSize:"12px"},children:ee("word.Large",te)})},"large-thumbnail")]})})]})}),Bt=[{key:"1",label:h.jsxs(_Bo,{children:[h.jsx("span",{children:ee("projectPanel.ProjectDescription",te)+" | "+ee("projectPanel.ProjectType",te)+": "+d}),h.jsxs("span",{children:[oe&&h.jsxs(h.Fragment,{children:[B.current&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),D.current=!D.current,U(!N)},children:D.current?h.jsx(fon,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.MakeDescriptionNonEditable",te)}):h.jsx(nqe,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.MakeDescriptionEditable",te)})}),h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),he()},children:h.jsx(von,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.CurateCurrentDesign",te)})}),R&&R.title===l&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),e&&o.uid&&s&&l&&oXn(o.uid,d,s,A??200,l,e).then(()=>{U(!N),r&&n(Ht=>{Ht.actionInfo={name:"Update Selected Design",timestamp:new Date().getTime(),details:{design:l}}})})},children:h.jsx(aon,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.UpdateSelectedDesign",te)})}),R&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),pe(),H(void 0)},children:h.jsx(eqe,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.RemoveSelectedDesign",te)})}),R&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{if(tt.stopPropagation(),s){let Ht=t1+"?client=web&userid="+o.uid+"&project="+encodeURIComponent(s);R&&(Ht+="&title="+encodeURIComponent(R.title)),navigator.clipboard.writeText(Ht).then(()=>S2(ee("projectListPanel.ProjectLinkGeneratedInClipBoard",te)+".")),r&&n(_t=>{_t.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:Ht}})}},children:h.jsx(Con,{style:{fontSize:"24px",color:"gray"},title:ee("projectListPanel.GenerateProjectLink",te)})})]}),u&&u.length>1&&f&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),n(Ht=>{Ht.projectState.sortDescending=!Ht.projectState.sortDescending,r&&(Ht.actionInfo={name:"Sort Design",timestamp:new Date().getTime(),details:{descending:!Ht.projectState.sortDescending}})})},children:S?h.jsx(Von,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.ClickToFlipSortingOrder",te)}):h.jsx(Xon,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.ClickToFlipSortingOrder",te)})}),h.jsx(Ml,{title:h.jsx("div",{onClick:tt=>tt.stopPropagation(),children:ee("projectPanel.ProjectSettings",te)}),content:zt,children:h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>tt.stopPropagation(),children:h.jsx(Bon,{style:{fontSize:"24px",color:"gray"}})})})]})]}),children:h.jsx(BBo,{title:D.current?void 0:ee("projectPanel.DoubleClickToMakeDescriptionEditable",te),readOnly:!D.current,value:L.current??void 0,onDoubleClick:()=>{D.current=!D.current,U(!N)},onChange:tt=>{L.current=tt.target.value,j.current=!0,n(Ht=>{Ht.projectState.description=tt.target.value}),U(!N)},onBlur:()=>{D.current=!1,j.current&&o.uid&&oe&&s&&XGn(o.uid,s,L.current).then(()=>{j.current=!1,U(!N)})},style:{paddingLeft:"10px",textAlign:"left",resize:D.current?"vertical":"none",border:D.current?"1px solid gray":"none"}})}];return h.jsx(YBo,{onContextMenu:tt=>{tt.stopPropagation()},children:h.jsxs(OBo,{children:[h.jsxs(VBo,{children:[h.jsx("span",{children:ee(oe?"projectPanel.Project":"projectPanel.ProjectByOtherPeople",te)+": "+s+(oe?"":" ("+ee("word.Owner",te)+": "+(c==null?void 0:c.substring(0,4))+"***)")+" ("+G.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{de()},onTouchStart:()=>{de()},children:h.jsx(jw,{title:ee("word.Close",te)})})]}),h.jsx(fye,{items:Bt,style:{backgroundColor:"white",border:"none"},onChange:tt=>{B.current=tt.length>0,U(!N)}}),G.current.length>0&&h.jsxs(XBo,{children:[h.jsx(gk,{style:{width:"100%",height:me/2-(B.current?160:80),paddingLeft:"4px",paddingRight:"4px",overflowX:"hidden",overflowY:"auto"},grid:{column:le,gutter:1},dataSource:G.current,renderItem:tt=>{var qt;const Ht=tt.title.lastIndexOf(" "),_t=A===100?8:A===125?12:30;return h.jsxs(gk.Item,{style:{marginBottom:"-28px"},onMouseOver:()=>{E(tt)},onMouseLeave:()=>{E(void 0)},children:[h.jsx("img",{loading:"eager",width:ge+"px",height:"auto",onError:un=>{un.target.src=pV},onLoad:un=>{n(Rn=>{Rn.projectImages.set(tt.title,un.target)}),dt.getState().set(Rn=>{Rn.projectImagesUpdateFlag=!Rn.projectImagesUpdateFlag})},alt:tt.title,title:(tt.timestamp?ee("word.LastUpdate",te)+": "+ul(new Date(tt.timestamp)).format("MM-DD-YYYY hh:mm A")+` -`:"")+ee(R===tt?"projectPanel.SingleClickToDeselectDoubleClickToOpen":"projectPanel.SingleClickToSelectDoubleClickToOpen",te),src:(qt=tt.thumbnail)!=null&&qt.startsWith("data:image/png;base64")?tt.thumbnail:pV,style:{transition:".5s ease",opacity:tt.excluded?.25:F===tt?.5:1,padding:"1px",cursor:"pointer",borderRadius:R===tt?"0":"10px",border:R===tt?"2px solid red":"none"},onDoubleClick:un=>{const Rn=un.target;Rn.src===pV&&(Rn.src=tt.thumbnailUrl),H(tt),c&&QX(c,tt.title,!0,!0).then(()=>{r&&n(yo=>{yo.actionInfo={name:"Open Design",timestamp:new Date().getTime(),details:tt.title}})})},onClick:un=>{const Rn=un.target;Rn.src===pV&&(Rn.src=tt.thumbnailUrl),H(tt!==R?tt:void 0),r&&n(yo=>{yo.actionInfo={name:tt!==R?"Select Design":"Deselect Design",timestamp:new Date().getTime(),details:tt==null?void 0:tt.title}})}}),h.jsx("div",{style:{position:"relative",left:"10px",textAlign:"left",bottom:"18px",color:"white",fontSize:"8px",fontWeight:tt.title===l?"bold":"normal"},children:tt.title?tt.title.length>_t?tt.title.substring(0,Math.min(_t,Ht))+"..."+tt.title.substring(Ht):tt.title:"Unknown"}),h.jsxs("div",{style:{position:"relative",right:"10px",textAlign:"right",bottom:"36px",color:"white"},children:[tt.title===l&&h.jsx(BKe,{style:{paddingRight:"4px",fontSize:"16px"}}),tt.invisible?h.jsx(oon,{onClick:()=>{$e(tt)},style:{fontSize:"16px"},title:ee("projectPanel.DesignNotShownInSolutionSpaceClickToShow",te)}):h.jsx(Tme,{onClick:()=>{$e(tt)},style:{fontSize:"16px"},title:ee("projectPanel.DesignShownInSolutionSpaceClickToHide",te)})]})]})}}),h.jsxs(GBo,{children:[h.jsx("span",{style:{paddingLeft:"20px"},children:ee("projectPanel.SolutionSpace",te)}),h.jsxs("span",{children:[d===Ri.SOLAR_PANEL_ARRAY&&h.jsx(Ml,{title:ee("projectPanel.ChooseSolutionSpace",te),onOpenChange:tt=>{V.current&&(tt||dt.getState().set(Ht=>{Ht.updateProjectsFlag=!0}),V.current=!1)},content:Wt(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(eon,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(Ml,{title:ee("projectPanel.ChooseDataColoring",te),content:bt(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(Xnn,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(Ml,{title:ee("projectPanel.GenerateScatterPlot",te),content:ot(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(zWt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(io,{style:{border:"none",paddingRight:"20px",background:"white"},onClick:()=>{const tt=document.getElementById("design-space");tt&&vpe.saveSvgAsPng(tt,"design-space-"+s+".png").then(()=>{gn(ee("message.ScreenshotSaved",te)),r&&n(Ht=>{Ht.actionInfo={name:"Solution space screenshot",timestamp:new Date().getTime(),details:{image:"design-space-"+s+".png"}}})})},children:h.jsx(_u,{style:{fontSize:"24px",color:"gray"},title:ee("projectPanel.SolutionSpaceScreenshot",te)})})]})]}),h.jsx(UBo,{id:"design-space",width:t*window.innerWidth,height:me/2-120,data:ve,types:fe,minima:Ie,maxima:Me,filters:Ue,steps:nt,variables:Se,titles:Re,units:De,digits:Ae,tickIntegers:ue,hover:lt,hoveredIndex:u&&F?u.indexOf(F):-1,selectedIndex:u&&R?u.indexOf(R):-1})]})]})})}),KBo=new Kt,W4=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a);return h.jsx(si,{name:e,args:[i,i,i],position:[n,o,r],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),children:h.jsx("meshStandardMaterial",{color:a})})},gV=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a);return h.jsx(Ps,{name:e,args:[i],position:[n,o,r],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),children:h.jsx("meshStandardMaterial",{color:a})})},BFe=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a),s=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]);return h.jsxs("group",{name:e,position:[n,o,r],rotation:[Qt,0,0],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),scale:i*4,children:[h.jsxs("group",{children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:s}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:s}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:s})]}),h.jsx(ta,{name:e,args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1})]})},qBo=be.memo(({groupedElementsIdSet:t,childCuboidSet:e,initialPosition:n,initialDimension:o,initialRotation:r})=>{const[i,a,l]=n,[s,c,u]=o,d=s===0?1:c/s,f=t.size>1||e.size>0,p=m.useRef(null),g=m.useRef(new ae),A=m.useRef(new ln),y=m.useRef(new Kt),S=m.useRef(new Map),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new ae),H=m.useRef(!1),F=m.useRef(new Map),E=m.useRef(new Map),N=m.useRef(new Map),U=m.useRef(new Map),W=m.useRef(new Map),[k,D]=m.useState(new ae(i,a,l)),[L,j]=m.useState(r),[B,O]=m.useState(s/2),[V,G]=m.useState(c/2),[q,$]=m.useState(u),[ie,Q]=m.useState(!1),[se,Z]=m.useState("Null"),{get:ee}=ri(),te=m.useMemo(()=>new l0,[]),oe=m.useMemo(()=>new Kt,[]),de=M(Ju),he=M(Jn),pe=M(Wge),me=M(pn),le=M(En);m.useEffect(()=>{$(u)},[u]),m.useEffect(()=>{D(new ae(i,a,l)),ge(s,c),j(r)},[n,o,r]);const Te=Ye=>{oe.x=Ye.offsetX/ee().gl.domElement.clientWidth*2-1,oe.y=-(Ye.offsetY/ee().gl.domElement.clientHeight)*2+1,te.setFromCamera(oe,ee().camera)},ge=(Ye,it)=>{O(Ye/2),G(it/2)},Se=Ye=>{Q(!0),kn.getState().setEnableOrbitController(!1),H.current=!0,g.current.set(0,0,0),A.current.set(0,0,0),we(zo.Default),Ye.stopPropagation()},Re=(Ye,it,ut)=>{me(Qe=>{for(const lt of Qe.elements)if(Ad(lt)&&Ye.has(lt.id))[lt.cx,lt.cy,lt.lx,lt.ly]=Ye.get(lt.id);else if(lt.foundationId&&Ye.has(lt.foundationId))switch(lt.type){case z.Wall:{const Ze=it.get(lt.id);if(!Ze)continue;const Be=lt,$e=Ze.slice(0,3),wt=Ze.slice(3);Be.cx=($e[0]+wt[0])/2,Be.cy=($e[1]+wt[1])/2,Be.lx=Math.hypot($e[0]-wt[0]+($e[1]-wt[1])),Be.relativeAngle=Math.atan2(wt[1]-$e[1],wt[0]-$e[0]),Be.leftPoint=[...$e],Be.rightPoint=[...wt];break}case z.Window:{const Ze=lt;if(Ze.parentType!==z.Roof)continue;const Be=ut.get(lt.id);if(!Be)continue;[Ze.cx,Ze.cy]=Be;break}case z.SolarPanel:{const Ze=ut.get(lt.id);if(!Ze)continue;[lt.cx,lt.cy]=Ze;break}}Qe.groupActionUpdateFlag=!Qe.groupActionUpdateFlag,Qe.updateElementOnRoofFlag=!0})},De=(Ye,it)=>{me(ut=>{for(const Qe of ut.elements){if(Ye.has(Qe.id)){const lt=Ye.get(Qe.id);lt!==void 0&&(Qe.type===z.Roof?Qe.rise=lt:Qe.type===z.SolarPanel?Qe.cz=lt:Qe.lz=lt)}if(Qe.type===z.Wall&&it.has(Qe.id)){const lt=Qe,Ze=it.get(lt.id);Ze&&(lt.leftTopPartialHeight=Ze.upperLeft,lt.rightTopPartialHeight=Ze.upperRight,lt.leftUnfilledHeight=Ze.lowerLeft,lt.rightUnfilledHeight=Ze.lowerRight)}}ut.groupActionUpdateFlag=!ut.groupActionUpdateFlag,ut.updateElementOnRoofFlag=!0})},Ae=Ye=>{me(it=>{for(const ut of it.elements)if(Ye.has(ut.id)){const Qe=Ye.get(ut.id);Qe&&(ut.cx=Qe[0],ut.cy=Qe[1],ut.cz=Qe[2],ut.rotation[2]=Qe[3])}it.groupActionUpdateFlag=!it.groupActionUpdateFlag})},ue=()=>{const Ye=new Map;for(const Qe of M.getState().elements)(Ad(Qe)&&t.has(Qe.id)||t.has(Qe.parentId))&&Ye.set(Qe.id,[Qe.cx,Qe.cy,Qe.cz,Qe.rotation[2]]);const ut={name:`${se==="Move"?"Move":"Rotate"} Foundation Group`,timestamp:Date.now(),oldPositionMap:new Map(F.current),newPositionMap:new Map(Ye),undo:()=>{Ae(ut.oldPositionMap)},redo:()=>{Ae(ut.newPositionMap)}};le(ut)},fe=()=>{const Ye=new Map,it=new Map,ut=new Map;for(const lt of M.getState().elements)if(Ad(lt)&&F.current.has(lt.id))Ye.set(lt.id,[lt.cx,lt.cy,lt.lx,lt.ly]);else if(E.current.has(lt.id)){const Ze=lt;it.set(lt.id,[...Ze.leftPoint,...Ze.rightPoint])}else if(W.current.has(lt.id))if(lt.type===z.Window){const Ze=lt;if(Ze.parentType!==z.Roof)continue;ut.set(Ze.id,[Ze.cx,Ze.cy])}else lt.type===z.SolarPanel&&ut.set(lt.id,[lt.cx,lt.cy]);const Qe={name:"Resize Building XY",timestamp:Date.now(),oldFoundationDataMap:new Map(F.current),newFoundationDataMap:new Map(Ye),oldWallPointsMap:new Map(E.current),newWallPointsMap:new Map(it),oldSkylightPosMap:new Map(W.current),newSkylightPosMap:new Map(ut),undo:()=>{Re(Qe.oldFoundationDataMap,Qe.oldWallPointsMap,Qe.oldSkylightPosMap)},redo:()=>{Re(Qe.newFoundationDataMap,Qe.newWallPointsMap,Qe.newSkylightPosMap)}};le(Qe)},ve=()=>{const Ye=new Map,it=new Map;for(const Qe of M.getState().elements)if(N.current.has(Qe.id)&&(Qe.type===z.Roof?Ye.set(Qe.id,Qe.rise):Qe.type===z.SolarPanel?Ye.set(Qe.id,Qe.cz):Ye.set(Qe.id,Qe.lz)),Qe.type===z.Wall&&U.current.has(Qe.id)){const lt=Qe;it.set(lt.id,{lowerLeft:lt.leftUnfilledHeight,lowerRight:lt.rightUnfilledHeight,upperLeft:lt.leftTopPartialHeight,upperRight:lt.rightTopPartialHeight})}const ut={name:"Resize Building Z",timestamp:Date.now(),oldElementHeightMap:new Map(N.current),newElementHeightMap:new Map(Ye),oldPartialWallHeightMap:new Map(U.current),newPartialWallHeightMap:new Map(it),undo:()=>{De(ut.oldElementHeightMap,ut.oldPartialWallHeightMap)},redo:()=>{De(ut.newElementHeightMap,ut.newPartialWallHeightMap)}};le(ut)},we=Ye=>{me(it=>{it.moveHandleType=Ye})},Pe=Ye=>{const it=new Kt(Ye.x,Ye.y),ut=y.current.clone();if(f){const Qe=new Kt().subVectors(it,ut),lt=Math.max(1,Qe.length()),Ze=Math.sqrt(Math.pow(lt,2)/(Math.pow(d,2)+1)),Be=Ze*d,$e=new Kt(Ze*Math.sign(Qe.x),Be*Math.sign(Qe.y)).normalize().multiplyScalar(lt/2).add(ut);D(new ae($e.x,$e.y)),ge(Ze,Be),me(wt=>{const vt=new Map;for(const Rt of wt.elements)if(Ad(Rt)&&(t.has(Rt.id)||e.has(Rt.id))){const Gt=x.current.get(Rt.id),At=b.current.get(Rt.id);if(Gt&&At){const pt=At[0]*Ze,Wt=At[1]*Be;if(Rt.lx=pt,Rt.ly=Wt,Rt.parentId!==Zo){const ht=vt.get(Rt.parentId);if(ht){const{pos:ct,rot:It}=ht,Ft=new ae(Gt[0]*Ze+$e.x,Gt[1]*Be+$e.y),Ve=Ft.clone().sub(ct).applyEuler(new ln(0,0,-It));Rt.cx=Ve.x,Rt.cy=Ve.y,vt.set(Rt.id,{pos:Ft.clone(),rot:Rt.rotation[2]+It})}}else{const ht=Gt[0]*Ze+$e.x,ct=Gt[1]*Be+$e.y;Rt.cx=ht,Rt.cy=ct,vt.set(Rt.id,{pos:new ae(ht,ct),rot:Rt.rotation[2]})}for(const ht of wt.elements)if(ht.foundationId===Rt.id)switch(ht.type){case z.Wall:{const ct=ht,It=C.current.get(ct.id);if(!It)continue;const[Ft,Ve]=It,ft=[Ft.x*pt,Ft.y*Wt,Rt.lz],kt=[Ve.x*pt,Ve.y*Wt,Rt.lz];ct.cx=(ft[0]+kt[0])/2,ct.cy=(ft[1]+kt[1])/2,ct.lx=Math.hypot(ft[0]-kt[0]+(ft[1]-kt[1])),ct.relativeAngle=Math.atan2(kt[1]-ft[1],kt[0]-ft[0]),ct.leftPoint=[...ft],ct.rightPoint=[...kt];break}case z.SolarPanel:{const ct=ht,It=v.current.get(ct.id);if(!It)continue;const Ft=ct.parentType,[Ve,ft,kt]=ct.normal;Ft===z.Foundation||Ft===z.Roof||Ft===z.Cuboid&&ye.isEqual(kt,1)?(ct.cx=It[0]*pt,ct.cy=It[1]*Wt):Ft===z.Cuboid&&(ye.isEqual(Ve,0)&&ye.isEqual(ft,1)?(ct.cx=It[0]*pt,ct.cy=Wt/2):ye.isEqual(Ve,0)&&ye.isEqual(ft,-1)?(ct.cx=It[0]*pt,ct.cy=-Wt/2):ye.isEqual(Ve,-1)&&ye.isEqual(ft,0)?(ct.cx=-pt/2,ct.cy=It[1]*Wt):ye.isEqual(Ve,1)&&ye.isEqual(ft,0)&&(ct.cx=pt/2,ct.cy=It[1]*Wt));break}case z.Window:{const ct=ht;if(ct.parentType!==z.Roof)continue;const It=v.current.get(ct.id);if(!It)continue;ct.cx=It[0]*pt,ct.cy=It[1]*Wt;break}}}}})}else{const Qe=ut.distanceTo(it),lt=Math.atan2(it.x-ut.x,it.y-ut.y)+L,Ze=Math.abs(Qe*Math.sin(lt)),Be=Math.abs(Qe*Math.cos(lt)),$e=new Kt().addVectors(it,ut).multiplyScalar(.5);D(new ae($e.x,$e.y)),ge(Ze,Be),me(wt=>{for(const vt of wt.elements)if(t.has(vt.id))vt.lx=Ze,vt.ly=Be,vt.cx=$e.x,vt.cy=$e.y;else if(vt.foundationId&&t.has(vt.foundationId))switch(vt.type){case z.Wall:{const Rt=vt,Gt=C.current.get(Rt.id);if(!Gt)continue;const[At,pt]=Gt,Wt=[At.x*Ze,At.y*Be,0],ht=[pt.x*Ze,pt.y*Be,0];Rt.cx=(Wt[0]+ht[0])/2,Rt.cy=(Wt[1]+ht[1])/2,Rt.lx=Math.hypot(Wt[0]-ht[0],Wt[1]-ht[1]),Rt.relativeAngle=Math.atan2(ht[1]-Wt[1],ht[0]-Wt[0]),Rt.leftPoint=[...Wt],Rt.rightPoint=[...ht];break}case z.SolarPanel:{const Rt=vt,Gt=v.current.get(Rt.id);if(!Gt)continue;const At=Rt.parentType,[pt,Wt,ht]=Rt.normal;At===z.Foundation||At===z.Roof||At===z.Cuboid&&ye.isEqual(ht,1)?(Rt.cx=Gt[0]*Ze,Rt.cy=Gt[1]*Be):At===z.Cuboid&&(ye.isEqual(pt,0)&&ye.isEqual(Wt,1)?(Rt.cx=Gt[0]*Ze,Rt.cy=Be/2):ye.isEqual(pt,0)&&ye.isEqual(Wt,-1)?(Rt.cx=Gt[0]*Ze,Rt.cy=-Be/2):ye.isEqual(pt,-1)&&ye.isEqual(Wt,0)?(Rt.cx=-Ze/2,Rt.cy=Gt[1]*Be):ye.isEqual(pt,1)&&ye.isEqual(Wt,0)&&(Rt.cx=Ze/2,Rt.cy=Gt[1]*Be));break}case z.Window:{const Rt=vt;if(Rt.parentType!==z.Roof)continue;const Gt=v.current.get(Rt.id);if(!Gt)continue;Rt.cx=Gt[0]*Ze,Rt.cy=Gt[1]*Be}}})}M.getState().updateElementOnRoofFn()},Ie=Ye=>{if(Ye.z<.1)return;const it=Ye.z;$(it),me(ut=>{for(const Qe of ut.elements)if(S.current.has(Qe.id)){if(Qe.type===z.Wall){Qe.lz=it*S.current.get(Qe.id);const lt=Qe;if(lt.fill===Fl.Partial){const Ze=P.current.get(lt.id);Ze&&(lt.leftTopPartialHeight=it*Ze.upperLeft,lt.rightTopPartialHeight=it*Ze.upperRight,lt.leftUnfilledHeight=it*Ze.lowerLeft,lt.rightUnfilledHeight=it*Ze.lowerRight)}}else if(Qe.type===z.Roof)Qe.rise=it*S.current.get(Qe.id);else if(Qe.type===z.Cuboid){const lt=S.current.get(Qe.id);if(lt){const Ze=lt*it;Qe.lz=Ze,Qe.cz=Ze/2}}else if(Qe.type===z.SolarPanel&&Qe.parentType===z.Cuboid&&S.current.has(Qe.parentId)){const lt=S.current.get(Qe.parentId);if(lt){const Ze=lt*it;if(ye.isEqual(Qe.normal[2],1))Qe.cz=Ze/2;else{const Be=S.current.get(Qe.id);Be&&(Qe.cz=Be*Ze)}}}}ut.updateElementOnRoofFlag=!0})},Me=Ye=>{const it=new ae(k.x,k.y),ut=Math.atan2(it.x-Ye.x,Ye.y-it.y)+(se==="Rotate Upper"?0:Math.PI),Qe=Math.abs(ut)>Math.PI?-sa:0,lt=ut+Qe,Ze=new ln(0,0,lt),Be=w.current.size;me($e=>{for(const wt of $e.elements){if(Ad(wt)&&t.has(wt.id)&&!e.has(wt.id)){const vt=T.current.get(wt.id),Rt=Be!==1?w.current.get(wt.id):0;if(vt&&Rt!==void 0){const Gt=vt.clone().applyEuler(Ze);wt.cx=it.x+Gt.x,wt.cy=it.y+Gt.y,wt.rotation=[0,0,Rt+lt]}}if(wt.type!==z.Cuboid&&t.has(wt.parentId)){const vt=Be!==1?w.current.get(wt.parentId):0;vt!==void 0&&(wt.rotation=[0,0,vt+lt])}}}),j(lt)},ze=(Ye,it)=>{const ut=new Kt(k.x,k.y);y.current.set(Ye,it).rotateAround(KBo,L).add(ut),Z("Resize XY"),x.current.clear(),b.current.clear(),C.current.clear(),F.current.clear(),E.current.clear(),v.current.clear(),W.current.clear();const[Qe,lt]=[B*2,V*2];for(const Ze of M.getState().elements)if(Ad(Ze)&&(t.has(Ze.id)||e.has(Ze.id))){const{pos:Be}=ye.getWorldDataById(Ze.id);x.current.set(Ze.id,[(Be.x-k.x)/Qe,(Be.y-k.y)/lt]),b.current.set(Ze.id,[Ze.lx/Qe,Ze.ly/lt]),F.current.set(Ze.id,[Ze.cx,Ze.cy,Ze.lx,Ze.ly])}else if(Ze.foundationId&&(t.has(Ze.foundationId)||e.has(Ze.foundationId))){const Be=he(Ze.foundationId);if(!Be)continue;switch(Ze.type){case z.Wall:{const $e=Ze,wt=new Kt($e.leftPoint[0]/Be.lx,$e.leftPoint[1]/Be.ly),vt=new Kt($e.rightPoint[0]/Be.lx,$e.rightPoint[1]/Be.ly);C.current.set($e.id,[wt,vt]),E.current.set($e.id,[...$e.leftPoint,...$e.rightPoint]);break}case z.SolarPanel:case z.Window:{const $e=Ze;v.current.set($e.id,[$e.cx/Be.lx,$e.cy/Be.ly]),W.current.set($e.id,[$e.cx,$e.cy]);break}}}},Ne=(Ye,it,ut)=>{const{x:Qe,y:lt}=pe();g.current.set(Ye,it,ut),A.current.set(-Qt,0,-Math.atan2(Qe,lt)-L,"ZXY"),Z("Resize Z"),S.current.clear(),N.current.clear(),P.current.clear(),U.current.clear();for(const Ze of M.getState().elements)if(Ze.foundationId&&(t.has(Ze.foundationId)||e.has(Ze.parentId))){if(Ze.type===z.Wall){S.current.set(Ze.id,Ze.lz/q),N.current.set(Ze.id,Ze.lz);const Be=Ze;Be.fill===Fl.Partial&&(U.current.set(Be.id,{upperLeft:Be.leftTopPartialHeight,upperRight:Be.rightTopPartialHeight,lowerLeft:Be.leftUnfilledHeight,lowerRight:Be.rightUnfilledHeight}),P.current.set(Be.id,{upperLeft:Be.leftTopPartialHeight/q,upperRight:Be.rightTopPartialHeight/q,lowerLeft:Be.leftUnfilledHeight/q,lowerRight:Be.rightUnfilledHeight/q}))}else if(Ze.type===z.Roof)S.current.set(Ze.id,Ze.rise/q),N.current.set(Ze.id,Ze.rise);else if(Ze.type===z.SolarPanel&&Ze.parentType===z.Cuboid){const Be=M.getState().elements.find($e=>$e.id===Ze.parentId);Be&&(S.current.set(Ze.id,Ze.cz/Be.lz),N.current.set(Ze.id,Ze.cz))}}else(t.has(Ze.id)||e.has(Ze.id))&&(S.current.set(Ze.id,Ze.lz/q),N.current.set(Ze.id,Ze.lz))},Je=Ye=>{switch(Se(Ye),Ye.object.name){case Mt.UpperLeft:{ze(B,-V);break}case Mt.UpperRight:{ze(-B,-V);break}case Mt.LowerLeft:{ze(B,V);break}case Mt.LowerRight:{ze(-B,V);break}case Mt.UpperLeftTop:{Ne(-B,V,q);break}case Mt.UpperRightTop:{Ne(B,V,q);break}case Mt.LowerLeftTop:{Ne(-B,-V,q);break}case Mt.LowerRightTop:{Ne(B,-V,q);break}}},Ue=Ye=>{if(Se(Ye),Z("Move"),Ye.intersections.length>0){const it=Ye.intersections[0].point.clone().setZ(0);R.current.subVectors(k,it);for(const ut of M.getState().elements)if(Ad(ut)&&t.has(ut.id)){const Qe=new ae(ut.cx,ut.cy),lt=new ae().subVectors(Qe,it);T.current.set(ut.id,lt),F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}}},nt=Ye=>{if(Se(Ye),Ye.object.name===Di.Lower?Z("Rotate Lower"):Ye.object.name===Di.Upper&&Z("Rotate Upper"),Ye.intersections.length>0){const it=new ae(k.x,k.y);for(const ut of M.getState().elements){if(Ad(ut)&&t.has(ut.id)){const Qe=new ae(ut.cx,ut.cy),lt=new ae().subVectors(Qe,it);T.current.set(ut.id,lt),w.current.set(ut.id,ut.rotation[2]),F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}t.has(ut.parentId)&&F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}}},We=()=>{switch(se){case"Move":case"Rotate Lower":case"Rotate Upper":ue();break;case"Resize XY":fe();break;case"Resize Z":ve();break}Q(!1),kn.getState().setEnableOrbitController(!0),H.current=!1,Z("Null"),we(null),me(Ye=>{Ye.groupActionUpdateFlag=!Ye.groupActionUpdateFlag,Ye.updateWallMapOnFoundationFlag=!Ye.updateWallMapOnFoundationFlag,Ye.updateElementOnRoofFlag=!0})},Ee=Ye=>{if(!p.current||!H.current)return;Te(Ye);const it=te.intersectObjects([p.current]);if(it.length>0){const ut=it[0].point;switch(se){case"Resize XY":Pe(ut);break;case"Resize Z":Ie(ut);break;case"Rotate Lower":case"Rotate Upper":Me(ut);break;case"Move":D(new ae().addVectors(ut.clone().setZ(0),R.current)),me(Qe=>{for(const lt of Qe.elements)if(Ad(lt)&&t.has(lt.id)&&!e.has(lt.id)){const Ze=T.current.get(lt.id);Ze&&(lt.cx=ut.x+Ze.x,lt.cy=ut.y+Ze.y)}});break}}},ke=a5(),Oe=ke/2,st=q+Oe-ke/2,je=B+ke,xt=V+ke,gt=V+ke*4;return h.jsxs("group",{name:"Group Master",position:k,rotation:[0,0,L],children:[h.jsxs("group",{name:"Resize Handle Group",onPointerDown:Je,children:[h.jsx(W4,{args:[B,V,Oe,ke],handleType:Mt.UpperRight}),h.jsx(W4,{args:[-B,V,Oe,ke],handleType:Mt.UpperLeft}),h.jsx(W4,{args:[B,-V,Oe,ke],handleType:Mt.LowerRight}),h.jsx(W4,{args:[-B,-V,Oe,ke],handleType:Mt.LowerLeft}),!de&&h.jsxs(h.Fragment,{children:[h.jsx(W4,{args:[B,V,st,ke],handleType:Mt.UpperRightTop}),h.jsx(W4,{args:[-B,V,st,ke],handleType:Mt.UpperLeftTop}),h.jsx(W4,{args:[B,-V,st,ke],handleType:Mt.LowerRightTop}),h.jsx(W4,{args:[-B,-V,st,ke],handleType:Mt.LowerLeftTop})]})]}),h.jsxs("group",{name:"Move Handle Group",onPointerDown:Ue,children:[h.jsx(gV,{args:[0,xt,Oe,ke],handleType:zo.Upper}),h.jsx(gV,{args:[0,-xt,Oe,ke],handleType:zo.Lower}),h.jsx(gV,{args:[je,0,Oe,ke],handleType:zo.Right}),h.jsx(gV,{args:[-je,0,Oe,ke],handleType:zo.Left})]}),h.jsxs("group",{name:"Rotate Handle Group",onPointerDown:nt,children:[h.jsx(BFe,{args:[0,gt,Oe,ke],handleType:Di.Upper}),h.jsx(BFe,{args:[0,-gt,Oe,ke],handleType:Di.Lower})]}),ie&&h.jsx(ta,{name:"Intersection Plane",ref:p,args:[Math.max(B*2.4,1e3),Math.max(B*2.4,1e3)],visible:!1,position:g.current,rotation:A.current,onPointerMove:Ee,onPointerUp:We}),h.jsx("group",{name:"Wireframe Group",position:[0,0,q/2],children:h.jsx(mw,{hx:B,hy:V,hz:q/2,lineColor:"white"})})]})}),$Bo=t=>t.parentId===Zo&&(t.type===z.Foundation||t.type===z.Cuboid),QBo=be.memo(()=>{M(gxt);const t=M(jwt),e=d();if(e.length===0)return null;const{allBaseElements:n,allBaseElementsVerticesMap:o,cuboidParentIdMap:r}=f(),i=new Set(e.map(y=>y.id)),a=[...e];for(const y of e)y.enableGroupMaster&&p(y);const{position:l,dimension:s,rotation:c,childCuboidIdSet:u}=g();function d(){const y=new Set;for(const S of M.getState().elements)t.has(S.id)&&(S.parentId===Zo&&Ad(S)?y.add(S.id):S.foundationId&&y.add(S.foundationId));return y.size===0?[]:M.getState().elements.filter(S=>y.has(S.id))}function f(){const y=[],S=new Map,C=new Map;for(const P of M.getState().elements){if($Bo(P)){const v=ye.fetchFoundationVertexCoordinates(P);y.push(P),S.set(P.id,v)}P.type===z.Cuboid&&P.parentId!==Zo&&C.set(P.id,P.parentId)}return{allBaseElements:y,allBaseElementsVerticesMap:S,cuboidParentIdMap:C}}function p(y){for(const S of n)!i.has(S.id)&&ye.areBasesOverlapped(y.id,S.id,o)&&(i.add(S.id),a.push(S),S.enableGroupMaster&&p(S))}function g(){const y=a.map(R=>ye.fetchFoundationVertexCoordinates(R)).flat(),S=new Set,C=ye.calculatePolygonBounds(y);let P=1,v=1;const T=new Map;for(const R of M.getState().elements)if(R.foundationId&&i.has(R.foundationId))if(R.type===z.Wall){const H=R;P=Math.max(P,H.lz),H.roofId&&(T.get(H.roofId)??0)M(COe)?h.jsx(QBo,{}):null),eYo=be.memo(({showGallery:t,defaultSize:e=50,minWidth:n=25,maxWidth:o=75,children:r,wait:i=50,onChange:a})=>{const[l,s]=r,c=m.useRef(!1),u=p=>{const g=document.querySelector(".split-pane");g&&g.style.setProperty("--percentWidth",p+"%")},d=()=>{c.current=!0},f=m.useCallback(k2.throttle(p=>{if(!c.current)return;const g=Math.max(n,Math.min(o,p.clientX/window.innerWidth*100));u(g),a&&a(g)},i),[]);return m.useEffect(()=>{u(e)},[e]),m.useEffect(()=>{const p=()=>{c.current=!1};return window.addEventListener("pointerup",p),()=>window.removeEventListener("pointerup",p)},[]),m.useEffect(()=>{u(t?e:0)},[t,e]),h.jsxs("div",{className:"split-pane",onPointerMove:f,children:[h.jsx("div",{className:"left-child",children:l}),t&&h.jsx("div",{className:"sash",onPointerDown:d}),h.jsx("div",{className:"right-child",children:s})]})},(t,e)=>t.showGallery===e.showGallery&&t.onChange===e.onChange),Yle=72,YFe=be.memo(({viewOnly:t=!1})=>{const e=M(yp),n=dt(K8t),o=M(oa),r=M(pn),i=dt(KBe),a=M(Ju)??!1,l=M(Oq)??$F,s=M(zb),c=M(HW),u=M(bge),d=M(SBe),f=M(mA),p=M(I4t)??"roadmap",g=dt(Gq),A=M(kH),y=M(bA),[S,C]=m.useState(!0),[P,v]=m.useState(50),[T,w]=m.useState(!1),x=m.useRef(null),b=$t();m.useEffect(()=>{C(!1)},[]),m.useEffect(()=>{n&&w(CC.localeCompare(n)<0)},[n]),m.useEffect(()=>{r(U=>{var W;U.loggable=e&&e.uid?!((W=e.email)!=null&&W.endsWith("@intofuture.org")):!1,e&&(e.noLogging||!e.schoolID||e.schoolID==="UNKNOWN SCHOOL"||!e.classID||e.classID==="UNKNOWN CLASS")&&(U.loggable=!1)})},[e]),console.log("x");const R=e.uid&&new URLSearchParams(window.location.search).get("userid")===e.uid,H=U=>{kn.setState(W=>{if(!x.current)return W;const k=W.pointer;return k.x=U.clientX/x.current.clientWidth*2-1,k.y=-((U.clientY-Yle)/x.current.clientHeight)*2+1,{pointer:k}})},F=U=>{H(U)},E=()=>h.jsxs(m6t,{ref:x,shadows:!0,gl:{preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0},frameloop:"demand",style:{height:"100%",width:"100%",backgroundColor:"black"},camera:{fov:lje,far:l,up:[0,0,1]},onPointerMove:F,children:[h.jsx(e8o,{}),h.jsx(pAo,{}),h.jsx(iAo,{}),h.jsx(Rnn,{}),h.jsx(lAo,{}),h.jsxs(m.Suspense,{fallback:null,children:[h.jsx(Pnn,{}),h.jsx(ZBo,{})]}),h.jsxs(m.Suspense,{fallback:null,children:[u&&h.jsx(stn,{}),h.jsx(ltn,{theme:d}),h.jsx(znn,{}),f&&h.jsx(SXn,{})]}),h.jsx(hAo,{}),h.jsx(kBo,{}),A===_s.GENETIC_ALGORITHM&&y.geneticAlgorithmParams.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&h.jsx(X4o,{}),A===_s.GENETIC_ALGORITHM&&y.geneticAlgorithmParams.problem===Ri.SOLAR_PANEL_ARRAY&&h.jsx(K4o,{}),A===_s.PARTICLE_SWARM_OPTIMIZATION&&y.particleSwarmOptimizationParams.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&h.jsx($4o,{}),A===_s.PARTICLE_SWARM_OPTIMIZATION&&y.particleSwarmOptimizationParams.problem===Ri.SOLAR_PANEL_ARRAY&&h.jsx(Z4o,{})]}),N=m.useMemo(()=>new Kt,[]);return h.jsxs("div",{className:"App",style:{position:"relative",overflow:"hidden"},onContextMenu:U=>U.preventDefault(),children:[h.jsx(bnn,{initializing:S}),h.jsxs("div",{style:{backgroundColor:"lightblue",height:Yle+"px",paddingTop:"10px",textAlign:"start",userSelect:"none",fontSize:"30px"},children:[h.jsx(rXe,{offset:["10px","0px"],count:T?h.jsx(Nnn,{style:{color:"red",cursor:"pointer"},title:Y.t("message.NewVersionAvailable",b)}):void 0,children:h.jsx(on,{style:{marginLeft:"120px",verticalAlign:"middle",cursor:"pointer",userSelect:"none",fontSize:"30px"},title:Y.t("tooltip.visitAladdinHomePage",b),onClick:kQt,children:`${Y.t("name.Aladdin",b)}`})}),s&&!g&&h.jsxs("span",{style:{marginLeft:"20px",fontSize:"14px",verticalAlign:"center",userSelect:"text",color:R?"black":"gray"},children:[h.jsx("img",{title:Y.t("toolbar.CloudFile",b),alt:"Cloud",src:fAo,height:32,width:32,style:{paddingRight:"8px"}}),s+(R&&i?" *":""),!t&&R&&i&&h.jsx(io,{type:"primary",size:"small",style:{marginLeft:"10px"},title:Y.t("menu.file.SaveCloudFile",b),onClick:()=>{dt.getState().setSaveCloudFileFlag(!0),o&&r(U=>{U.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}})},children:`${Y.t("word.Save",b)}`})]})]}),t?h.jsxs("div",{style:{position:"absolute",bottom:"6px",left:"6px",zIndex:999,fontSize:"8px",userSelect:"none",color:f||c?p!=="roadmap"?"antiquewhite":"darkslategrey":"antiquewhite"},children:[h.jsx("img",{alt:"IFI Logo",src:tPe,height:"30px",style:{verticalAlign:"bottom"}})," V "+CC]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"IFI Logo",src:tPe,height:c?"24px":"40px",style:{position:"absolute",bottom:"6px",left:"6px",zIndex:999,userSelect:"none"}}),h.jsxs("div",{style:{position:"absolute",bottom:"4px",left:c?"24px":"44px",zIndex:999,fontSize:"10px",userSelect:"none",pointerEvents:"none",color:f?p!=="roadmap"?"antiquewhite":"darkslategrey":c?"darkslategrey":"antiquewhite"},children:["   ©",new Date().getFullYear()," ",`${Y.t("name.IFI",b)}`," ",Y.t("word.VersionInitial",b)+CC+". "+Y.t("word.AllRightsReserved",b)+". "]})]}),!t&&h.jsx(G4o,{size:16,round:!0,margin:"2px",style:{position:"absolute",right:"0",top:"80px"}}),h.jsx(uXn,{viewOnly:t,canvas:x.current}),h.jsx(U2o,{viewOnly:t,canvas:x.current}),h.jsx(bBo,{}),h.jsx(qgo,{children:h.jsxs("div",{style:{height:`calc(100vh - ${Yle}px)`},children:[h.jsxs(eYo,{showGallery:c,defaultSize:c?50:0,onChange:U=>{v(Math.round(100-U));const W=kn.getState().canvas;if(W){const{gl:k,camera:D}=W,L=(100-U)*window.innerWidth/100;k.getSize(N),k.setSize(L,N.y),D instanceof zu&&(D.aspect=L/N.y,D.updateProjectionMatrix(),op())}},children:[c?h.jsx(JBo,{canvas:x.current,relativeWidth:1-P*.01}):h.jsx(h.Fragment,{}),E()]}),h.jsx(dAo,{canvas:x.current})]})}),h.jsx(sAo,{visible:!a}),!t&&h.jsx(wXn,{}),!t&&o&&h.jsx(rAo,{})]})}),tYo=be.memo(({viewOnly:t=!1})=>{const e=M(pn),n=M(rYe),o=M(kge),r=M(iYe),i=dt(oYe),a=dt(Hwt),l=dt(Mwt),s=M(zb),c=dt(Rwt),u=M(yp),d=M(m0),[f,p]=m.useState(!1),[g,A]=m.useState(!1),[y,S]=m.useState({left:0,top:0,bottom:0,right:0}),C=m.useRef(null),{t:P}=Xl(),v=m.useMemo(()=>({lng:d}),[d]);m.useEffect(()=>{a&&(T(),dt.getState().setCreateNewFileFlag(!1))},[a]),m.useEffect(()=>{l&&(w(),dt.getState().setOpenLocalFileFlag(!1))},[l]);const T=()=>{yi.confirm({title:`${P("message.DoYouWantToSaveChanges",v)}`,icon:h.jsx(ny,{}),okText:`${P("word.Yes",v)}`,cancelText:`${P("word.No",v)}`,onOk:()=>{u.uid?s?(e(N=>{N.localContentToImportAfterCloudFileUpdate="CREATE_NEW_FILE"}),dt.getState().setSaveCloudFileFlag(!0)):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):gn(P("menu.file.ToSaveYourWorkPleaseSignIn",v))},onCancel:()=>{r()}})},w=()=>{!t&&dt.getState().changed?yi.confirm({title:P("message.DoYouWantToSaveChanges",v),icon:h.jsx(ny,{}),onOk:()=>{u.uid?s?x(!0):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):gn(P("menu.file.ToSaveYourWorkPleaseSignIn",v))},onCancel:()=>x(!1),okText:P("word.Yes",v),cancelText:P("word.No",v)}):x(!1)},x=N=>{document.body.onfocus=()=>{e(W=>{W.localFileDialogRequested=!1})};const U=document.getElementById("file-dialog");U.onchange=()=>{if(U.files&&U.files.length>0){dt.getState().set(D=>{D.waiting=!0});const W=new FileReader;W.readAsText(U.files[0]);const k=U.files[0].name;dt.getState().set(D=>{D.localFileName=k}),W.onload=()=>{if(W.result){const D=JSON.parse(W.result.toString());N?s&&(e(L=>{L.localContentToImportAfterCloudFileUpdate=D}),dt.getState().setSaveCloudFileFlag(!0)):o(D)}U.value=""}}},U.click()},b=()=>{let N=c.trim();if(N.length>0){N.endsWith(".ala")||(N+=".ala");const U=new Blob([JSON.stringify(n())],{type:"application/json"});return d$e.saveAs(U,N),dt.getState().set(W=>{W.localFileName=N}),e(W=>{W.cloudFile=void 0}),!0}else return co(P("menu.file.SavingAbortedMustHaveValidFileName",v)+"."),!1},R=(N,U)=>{if(C.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=C.current.getBoundingClientRect();S({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{p(!0),b()&&dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1}),p(!1)},F=()=>{dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1})},E=()=>{s&&dt.getState().set(N=>{N.localFileName=s,N.localFileName.endsWith(".ala")||(N.localFileName+=".ala")})};return h.jsx(h.Fragment,{children:h.jsx(yi,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>A(!0),onMouseOut:()=>A(!1),children:P("menu.file.SaveAsLocalFile",v)}),footer:s?[h.jsx(io,{onClick:E,children:P("menu.file.UseCloudFileName",v)},"Apply"),h.jsx(io,{onClick:F,children:P("word.Cancel",v)},"Cancel"),h.jsx(io,{type:"primary",onClick:H,disabled:!c,children:P("word.OK",v)},"OK")]:[h.jsx(io,{onClick:F,children:P("word.Cancel",v)},"Cancel"),h.jsx(io,{type:"primary",onClick:H,disabled:!c,children:P("word.OK",v)},"OK")],open:i,confirmLoading:f,onCancel:F,modalRender:N=>h.jsx(Bi,{disabled:!g,bounds:y,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:C,children:N})}),children:h.jsx(jl,{placeholder:"File name",value:c,onPressEnter:H,onChange:N=>{dt.getState().set(U=>{U.localFileName=N.target.value})}})})})}),nYo=()=>{const t=M(nwt),e=M(y=>y.world),n=M(y=>y.elements),o=M(y=>y.viewState),r=M(y=>y.notes),i=dt(hs),a=dt(p3),l=dt(q8t),s=dt($8t),c=M(_7t),u=M(G7t),d=M(J7t),f=M(Z8t),p=new URLSearchParams(window.location.search),g=p.get("viewonly")==="true",A=p.get("map")==="true";return m.useEffect(()=>{c(),u(),d(),f(),dt.getState().set(y=>{y.openModelsMap=A,A&&(y.modelsMapFlag=!0,y.modelsMapWeatherStations=!1,y.leaderboardFlag=!0,y.showLeaderboard=!0)})},[]),m.useEffect(()=>{dt.getState().skipChange?s(!1):dt.getState().changed||l(!0)},[e,o,n,r]),m.useEffect(()=>{i&&dt.getState().set(y=>{y.showSolarRadiationHeatmap=!1}),a&&dt.getState().set(y=>{y.showHeatFluxes=!1})},[n]),h.jsx(fy,{locale:t,children:h.jsxs(qen,{children:[g?h.jsx(YFe,{viewOnly:!0}):h.jsx(oYo,{children:h.jsx(YFe,{viewOnly:!1})}),h.jsx(tYo,{viewOnly:g})]})})},oYo=be.memo(({children:t})=>(["iir3sv1kW1Vzbj9sOA46RfLWKCU2"].find(n=>n===M.getState().user.uid),h.jsx(Qen,{onBeforeunload:()=>"",children:t}))),rYo=rWe(document.getElementById("root"));rYo.render(h.jsx(nYo,{}))});export default iYo(); +`,JBo=be.memo(({relativeWidth:t,canvas:e})=>{const n=M(pn),o=M(yp),r=M(oa),i=M(En),a=M(Fge),l=M(zb),s=M(Xge),c=M(XYe),u=M(H7t),d=M(M7t),f=M(JYe),p=M(R7t),g=M(I7t),A=M(z7t),y=M(N7t),S=M(k7t),C=M(W7t),P=M(L7t),v=M(D7t),T=M(E7t),w=M(F7t),x=M(c$),b=M(a$),[R,H]=m.useState(),[F,E]=m.useState(),[N,U]=m.useState(!1),[W,k]=m.useState(!1),D=m.useRef(!1),L=m.useRef(p??null),j=m.useRef(!1),B=m.useRef(!1),O=m.useRef(g??d9.ALL),V=m.useRef(!1),G=m.useRef(u??[]),q=m.useRef(A??200),$=m.useRef(v??"rowWidth"),ie=m.useRef(T??"rowWidth"),Q=m.useRef(w??5),se=m.useRef(!0),oe=m.useRef(!0);m.useEffect(()=>{$.current=v??"rowWidth"},[v]),m.useEffect(()=>{ie.current=T??"rowWidth"},[T]),m.useEffect(()=>{Q.current=w??5},[w]),m.useEffect(()=>{q.current=A??200},[A]);const{t:Z}=Xl(),te=$t(),ee=o.uid===c;m.useEffect(()=>{if(G.current=[],u){for(const Ht of u)G.current.push(Ht);const tt=f;if(tt){const Ht=S?1:-1;G.current.sort((_t,qt)=>tt?tt==="rowWidth"&&"rowsPerRack"in _t&&"rowsPerRack"in qt?Ht*(_t.rowsPerRack-qt.rowsPerRack):tt==="orientation"?Ht*((_t[tt]==="Landscape"?0:1)-(qt[tt]==="Landscape"?0:1)):tt==="totalYearlyYield"&&"yearlyYield"in _t&&"yearlyYield"in qt?Ht*(_t.yearlyYield-qt.yearlyYield):tt==="meanYearlyYield"&&"yearlyYield"in _t&&"yearlyYield"in qt?Ht*(_t.yearlyYield/_t.panelCount-qt.yearlyYield/qt.panelCount):tt==="totalYearlyCost"?Ht*(me.calculateCost(_t)-me.calculateCost(qt)):tt==="yearlyProfit"?Ht*(me.calculateProfit(_t)-me.calculateProfit(qt)):tt in _t&&tt in qt?Ht*(_t[tt]-qt[tt]):0:0)}U(!N)}},[u,S,f]),m.useEffect(()=>{if(H(void 0),u){for(const tt of u)if(tt.title===l){H(tt);break}}},[l,u]),m.useEffect(()=>{const tt=()=>{U(!N)};return window.addEventListener("resize",tt),()=>{window.removeEventListener("resize",tt)}},[N]);const de=()=>{n(tt=>{r&&(tt.actionInfo={name:"Close Project",timestamp:new Date().getTime(),details:tt.projectState.title}),tt.projectView=!1,tt.projectState.title=null,tt.projectState.description=null,tt.projectState.owner=null,tt.projectImages.clear()}),H(void 0),a.clear(),dt.getState().set(tt=>{tt.projectImagesUpdateFlag=!tt.projectImagesUpdateFlag})},fe=()=>{dt.getState().set(tt=>{tt.curateDesignToProjectFlag=!0}),r&&n(tt=>{tt.actionInfo={name:"Curate Current Design",timestamp:new Date().getTime()}})},pe=()=>{o.uid&&s&&R&&_Gn(o.uid,s,R).then(()=>{n(tt=>{if(tt.projectState.designs){let Ht=-1;for(const[_t,qt]of tt.projectState.designs.entries())if(qt.title===R.title){Ht=_t;break}Ht>=0&&(tt.projectState.designs.splice(Ht,1),r&&(tt.actionInfo={name:"Remove Selected Design",timestamp:new Date().getTime(),details:R.title}))}})})},ye=window.innerHeight,ae=Math.round(800/q.current),Te=48/ae,ge=Math.round(t*window.innerWidth/ae-Te),[Se,Re,De,Ae,ue,he]=m.useMemo(()=>[gd.getVariables(d,y??[]),gd.getTitles(d,te,y??[]),gd.getUnits(d,te,y??[]),gd.getDigits(d,y??[]),gd.getTickIntegers(d,y??[]),gd.getTypes(d,y??[])],[d,y,W,te]),ve=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){const _t={};if(y!=null&&y.includes("rowWidth")||(_t.rowWidth=Ht.rowsPerRack),y!=null&&y.includes("tiltAngle")||(_t.tiltAngle=me.toDegrees(Ht.tiltAngle)),y!=null&&y.includes("interRowSpacing")||(_t.interRowSpacing=Ht.interRowSpacing),y!=null&&y.includes("latitude")||(_t.latitude=Ht.latitude??42),y!=null&&y.includes("orientation")||(_t.orientation=Ht.orientation===vr.landscape?0:1),y!=null&&y.includes("poleHeight")||(_t.poleHeight=Ht.poleHeight),y!=null&&y.includes("unitCost")||(_t.unitCost=Ht.unitCost),y!=null&&y.includes("sellingPrice")||(_t.sellingPrice=Ht.sellingPrice),y!=null&&y.includes("")||(_t.totalYearlyCost=me.calculateCost(Ht)),y!=null&&y.includes("totalYearlyYield")||(_t.totalYearlyYield=Ht.yearlyYield*.001),y!=null&&y.includes("meanYearlyYield")||(_t.meanYearlyYield=Ht.yearlyYield/Ht.panelCount),y!=null&&y.includes("yearlyProfit")||(_t.yearlyProfit=me.calculateProfit(Ht)),_t.group=g===d9.INDIVIDUALS?Ht.title:"default",_t.selected=R===Ht,_t.hovered=F===Ht,_t.invisible=Ht.invisible,_t.excluded=!1,P){for(const qt of P)if(qt.type===XL.Between&&qt.upperBound!==void 0&&qt.lowerBound!==void 0){const un=_t[qt.variable];if(typeof un=="number"&&(un>qt.upperBound||un{n(tt=>{if(tt.projectState.designs)for(const[Ht,_t]of tt.projectState.designs.entries())_t.excluded=ve[Ht].excluded})},[ve]);const we=(tt,Ht)=>{let _t=Ht;if(C){for(const qt of C)if(qt.variable===tt){_t=qt.minimum??Ht;break}}return _t},Pe=(tt,Ht)=>{let _t=Ht;if(C){for(const qt of C)if(qt.variable===tt){_t=qt.maximum??Ht;break}}return _t},Ie=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(we("rowWidth",x.minimumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(we("tiltAngle",me.toDegrees(x.minimumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(we("interRowSpacing",x.minimumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(we("latitude",-90)),y!=null&&y.includes("orientation")||tt.push(0),y!=null&&y.includes("poleHeight")||tt.push(we("poleHeight",0)),y!=null&&y.includes("unitCost")||tt.push(we("unitCost",.1)),y!=null&&y.includes("sellingPrice")||tt.push(we("sellingPrice",.1)),y!=null&&y.includes("totalYearlyCost")||tt.push(we("totalYearlyCost",0)),y!=null&&y.includes("totalYearlyYield")||tt.push(we("totalYearlyYield",0)),y!=null&&y.includes("meanYearlyYield")||tt.push(we("meanYearlyYield",0)),y!=null&&y.includes("yearlyProfit")||tt.push(we("yearlyProfit",-10)),tt}return[]},[x,d,C,y,W]),Me=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(Pe("rowWidth",x.maximumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(Pe("tiltAngle",me.toDegrees(x.maximumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(Pe("interRowSpacing",x.maximumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(Pe("latitude",90)),y!=null&&y.includes("orientation")||tt.push(1),y!=null&&y.includes("poleHeight")||tt.push(Pe("poleHeight",5)),y!=null&&y.includes("unitCost")||tt.push(Pe("unitCost",1)),y!=null&&y.includes("sellingPrice")||tt.push(Pe("sellingPrice",.5)),y!=null&&y.includes("totalYearlyCost")||tt.push(Pe("totalYearlyCost",100)),y!=null&&y.includes("totalYearlyYield")||tt.push(Pe("totalYearlyYield",100)),y!=null&&y.includes("meanYearlyYield")||tt.push(Pe("meanYearlyYield",1e3)),y!=null&&y.includes("yearlyProfit")||tt.push(Pe("yearlyProfit",10)),tt}return[]},[x,d,C,y,W]),ze=(tt,Ht)=>{let _t=Ht;if(P){for(const qt of P)if(qt.variable===tt){_t=qt.lowerBound??Ht;break}}return _t},Ne=(tt,Ht)=>{let _t=Ht;if(P){for(const qt of P)if(qt.variable===tt){_t=qt.upperBound??Ht;break}}return _t},Je=(tt,Ht,_t)=>({variable:tt,type:XL.Between,upperBound:Ne(tt,Ht),lowerBound:ze(tt,_t)}),Ue=m.useMemo(()=>{const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(Je("rowWidth",x.maximumRowsPerRack,x.minimumRowsPerRack)),y!=null&&y.includes("tiltAngle")||tt.push(Je("tiltAngle",me.toDegrees(x.maximumTiltAngle),me.toDegrees(x.minimumTiltAngle))),y!=null&&y.includes("interRowSpacing")||tt.push(Je("interRowSpacing",x.maximumInterRowSpacing,x.minimumInterRowSpacing)),y!=null&&y.includes("latitude")||tt.push(Je("latitude",90,-90)),y!=null&&y.includes("orientation")||tt.push(Je("orientation",1,0)),y!=null&&y.includes("poleHeight")||tt.push(Je("poleHeight",5,0)),y!=null&&y.includes("unitCost")||tt.push(Je("unitCost",1,.1)),y!=null&&y.includes("sellingPrice")||tt.push(Je("sellingPrice",.5,.1)),y!=null&&y.includes("totalYearlyCost")||tt.push(Je("totalYearlyCost",100,0)),y!=null&&y.includes("totalYearlyYield")||tt.push(Je("totalYearlyYield",100,0)),y!=null&&y.includes("meanYearlyYield")||tt.push(Je("meanYearlyYield",1e3,0)),y!=null&&y.includes("yearlyProfit")||tt.push(Je("yearlyProfit",10,-10)),tt},[W,P,y]),nt=m.useMemo(()=>{if(d===Ri.SOLAR_PANEL_ARRAY&&x){const tt=[];return y!=null&&y.includes("rowWidth")||tt.push(1),y!=null&&y.includes("tiltAngle")||tt.push(.1),y!=null&&y.includes("interRowSpacing")||tt.push(.1),y!=null&&y.includes("latitude")||tt.push(.1),y!=null&&y.includes("orientation")||tt.push(1),y!=null&&y.includes("poleHeight")||tt.push(.1),y!=null&&y.includes("unitCost")||tt.push(.01),y!=null&&y.includes("sellingPrice")||tt.push(.01),y!=null&&y.includes("totalYearlyCost")||tt.push(.1),y!=null&&y.includes("totalYearlyYield")||tt.push(1),y!=null&&y.includes("meanYearlyYield")||tt.push(1),y!=null&&y.includes("yearlyProfit")||tt.push(.1),tt}return[]},[d,y,W]),We=m.useRef(!(y!=null&&y.includes("rowWidth"))),Ee=m.useRef(!(y!=null&&y.includes("tiltAngle"))),ke=m.useRef(!(y!=null&&y.includes("interRowSpacing"))),Oe=m.useRef(!(y!=null&&y.includes("latitude"))),st=m.useRef(!(y!=null&&y.includes("orientation"))),je=m.useRef(!(y!=null&&y.includes("poleHeight"))),xt=m.useRef(!(y!=null&&y.includes("unitCost"))),gt=m.useRef(!(y!=null&&y.includes("sellingPrice"))),Ye=m.useRef(!(y!=null&&y.includes("totalYearlyCost"))),it=m.useRef(!(y!=null&&y.includes("totalYearlyYield"))),ut=m.useRef(!(y!=null&&y.includes("meanYearlyYield"))),Qe=m.useRef(!(y!=null&&y.includes("yearlyProfit")));m.useEffect(()=>{We.current=!(y!=null&&y.includes("rowWidth")),Ee.current=!(y!=null&&y.includes("tiltAngle")),ke.current=!(y!=null&&y.includes("interRowSpacing")),Oe.current=!(y!=null&&y.includes("latitude")),st.current=!(y!=null&&y.includes("orientation")),je.current=!(y!=null&&y.includes("poleHeight")),xt.current=!(y!=null&&y.includes("unitCost")),gt.current=!(y!=null&&y.includes("sellingPrice")),Ye.current=!(y!=null&&y.includes("totalYearlyCost")),it.current=!(y!=null&&y.includes("totalYearlyYield")),ut.current=!(y!=null&&y.includes("meanYearlyYield")),Qe.current=!(y!=null&&y.includes("yearlyProfit")),U(!N)},[y]),m.useEffect(()=>{L.current=p},[p]);const lt=tt=>{u&&(tt>=0&&tt{n(Ht=>{if(Ht.projectState.designs){for(const _t of Ht.projectState.designs)if(_t.title===tt){_t.invisible=!_t.invisible;break}}})},Be=tt=>{ee?o.uid&&s&&nXn(o.uid,s,tt).then(()=>{Ze(tt.title)}):Ze(tt.title)},$e=tt=>{const Ht={name:"Select Design Visibility",timestamp:Date.now(),checked:!!tt.invisible,property:tt.title,undo:()=>{Be(tt)},redo:()=>{Be(tt)}};i(Ht),Be(tt)},wt=(tt,Ht)=>{n(_t=>{_t.projectState.hiddenParameters&&(tt?_t.projectState.hiddenParameters.includes(Ht)&&_t.projectState.hiddenParameters.splice(_t.projectState.hiddenParameters.indexOf(Ht),1):_t.projectState.hiddenParameters.includes(Ht)||_t.projectState.hiddenParameters.push(Ht))})},vt=(tt,Ht)=>{V.current=!0,ee?o.uid&&s&&GGn(o.uid,s,Ht,!tt).then(()=>{wt(tt,Ht)}):wt(tt,Ht)},Rt=(tt,Ht)=>{const _t={name:"Select Parameter",timestamp:Date.now(),checked:tt,property:Ht,undo:()=>{vt(!tt,Ht)},redo:()=>{vt(tt,Ht)}};i(_t),vt(tt,Ht)},Gt=()=>{n(tt=>{tt.projectState.dataColoring=O.current}),dt.getState().set(tt=>{tt.updateProjectsFlag=!0}),U(!N)},At=tt=>{O.current=tt,ee?o.uid&&s&&JGn(o.uid,s,O.current).then(()=>{Gt()}):Gt()},pt=tt=>{const Ht={name:"Select Data Coloring",timestamp:Date.now(),oldValue:g,newValue:tt,undo:()=>{At(g)},redo:()=>{At(tt)}};i(Ht),At(tt)},Wt=()=>h.jsxs("div",{children:[h.jsx(Li,{style:{width:"100%"},onChange:tt=>{We.current=tt.target.checked,Rt(We.current,"rowWidth"),k(!W)},checked:We.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayRowWidth",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Ee.current=tt.target.checked,Rt(Ee.current,"tiltAngle"),k(!W)},checked:Ee.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTiltAngle",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{ke.current=tt.target.checked,Rt(ke.current,"interRowSpacing"),k(!W)},checked:ke.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayRowSpacing",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Oe.current=tt.target.checked,Rt(Oe.current,"latitude"),k(!W)},checked:Oe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("word.Latitude",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{st.current=tt.target.checked,Rt(st.current,"orientation"),k(!W)},checked:st.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayOrientation",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{je.current=tt.target.checked,Rt(je.current,"poleHeight"),k(!W)},checked:je.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayPoleHeight",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{xt.current=tt.target.checked,Rt(xt.current,"unitCost"),k(!W)},checked:xt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("economicsPanel.UnitCost",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{gt.current=tt.target.checked,Rt(gt.current,"sellingPrice"),k(!W)},checked:gt.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("economicsPanel.SellingPrice",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Ye.current=tt.target.checked,Rt(Ye.current,"totalYearlyCost"),k(!W)},checked:Ye.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTotalYearlyCost",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{it.current=tt.target.checked,Rt(it.current,"totalYearlyYield"),k(!W)},checked:it.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTotalYearlyYield",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{ut.current=tt.target.checked,Rt(ut.current,"meanYearlyYield"),k(!W)},checked:ut.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayMeanYearlyYield",te)})}),h.jsx("br",{}),h.jsx(Li,{style:{width:"100%"},onChange:tt=>{Qe.current=tt.target.checked,Rt(Qe.current,"yearlyProfit"),k(!W)},checked:Qe.current,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayYearlyProfit",te)})})]}),ht=()=>h.jsxs(h.Fragment,{children:[h.jsx(Vh,{value:"rowWidth",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayRowWidth",te)})},"rowWidth"),h.jsx(Vh,{value:"tiltAngle",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTiltAngle",te)})},"tiltAngle"),h.jsx(Vh,{value:"interRowSpacing",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayRowSpacing",te)})},"interRowSpacing"),h.jsx(Vh,{value:"latitude",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("word.Latitude",te)})},"latitude"),h.jsx(Vh,{value:"orientation",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayOrientation",te)})},"orientation"),h.jsx(Vh,{value:"poleHeight",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayPoleHeight",te)})},"poleHeight"),h.jsx(Vh,{value:"unitCost",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("economicsPanel.UnitCost",te)})},"unitCost"),h.jsx(Vh,{value:"sellingPrice",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("economicsPanel.SellingPrice",te)})},"sellingPrice"),h.jsx(Vh,{value:"totalYearlyCost",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTotalYearlyCost",te)})},"totalYearlyCost"),h.jsx(Vh,{value:"totalYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayTotalYearlyYield",te)})},"totalYearlyYield"),h.jsx(Vh,{value:"meanYearlyYield",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayMeanYearlyYield",te)})},"meanYearlyYield"),h.jsx(Vh,{value:"yearlyProfit",children:h.jsx("span",{style:{fontSize:"12px"},children:Z("polygonMenu.SolarPanelArrayYearlyProfit",te)})},"yearlyProfit")]}),ct=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){if(Ht.invisible||Ht===R)continue;const _t={};gd.setScatterData($.current,"x",_t,Ht),gd.setScatterData(ie.current,"y",_t,Ht),tt.push(_t)}return tt},[$.current,ie.current,u,d,R]),It=m.useMemo(()=>{const tt=[];if(u&&d===Ri.SOLAR_PANEL_ARRAY)for(const Ht of u){if(Ht!==R)continue;const _t={};gd.setScatterData($.current,"x",_t,Ht),gd.setScatterData(ie.current,"y",_t,Ht),tt.push(_t)}return tt},[$.current,ie.current,u,d,R]),Ft=tt=>{const Ht={min:0,max:1};if(d===Ri.SOLAR_PANEL_ARRAY&&x)switch(tt){case"rowWidth":Ht.min=we("rowWidth",x.minimumRowsPerRack),Ht.max=Pe("rowWidth",x.maximumRowsPerRack);break;case"tiltAngle":Ht.min=we("tiltAngle",me.toDegrees(x.minimumTiltAngle)),Ht.max=Pe("tiltAngle",me.toDegrees(x.maximumTiltAngle));break;case"interRowSpacing":Ht.min=we("interRowSpacing",x.minimumInterRowSpacing),Ht.max=Pe("interRowSpacing",x.maximumInterRowSpacing);break;case"latitude":Ht.min=we("latitude",-90),Ht.max=Pe("latitude",90);break;case"orientation":Ht.min=0,Ht.max=1;break;case"poleHeight":Ht.min=we("poleHeight",0),Ht.max=Pe("poleHeight",5);break;case"unitCost":Ht.min=we("unitCost",.1),Ht.max=Pe("unitCost",1);break;case"sellingPrice":Ht.min=we("sellingPrice",.1),Ht.max=Pe("sellingPrice",.5);break;case"totalYearlyCost":Ht.min=we("totalYearlyCost",0),Ht.max=Pe("totalYearlyCost",100);break;case"totalYearlyYield":Ht.min=we("totalYearlyYield",0),Ht.max=Pe("totalYearlyYield",100);break;case"meanYearlyYield":Ht.min=we("meanYearlyYield",0),Ht.max=Pe("meanYearlyYield",1e3);break;case"yearlyProfit":Ht.min=we("yearlyProfit",-10),Ht.max=Pe("yearlyProfit",10);break}return Ht},Ve=m.useMemo(()=>Ft($.current),[$.current,C]),ft=m.useMemo(()=>Ft(ie.current),[ie.current,C]),kt=m.useMemo(()=>gd.getUnit($.current,te),[$.current,te]),rt=m.useMemo(()=>gd.getUnit(ie.current,te),[ie.current,te]),at=tt=>{const Ht=$.current,_t={name:"Change X Axis",timestamp:Date.now(),oldValue:Ht,newValue:tt,undo:()=>{Ge(Ht)},redo:()=>{Ge(tt)}};i(_t),Ge(tt)},Ge=tt=>{$.current=tt,ee&&o.uid&&s&&qGn(o.uid,s,tt).then(()=>{}),U(!N)},yt=tt=>{const Ht=ie.current,_t={name:"Change Y Axis",timestamp:Date.now(),oldValue:Ht,newValue:tt,undo:()=>{Pt(Ht)},redo:()=>{Pt(tt)}};i(_t),Pt(tt)},Pt=tt=>{ie.current=tt,ee&&o.uid&&s&&$Gn(o.uid,s,tt).then(()=>{}),U(!N)},ot=()=>h.jsxs("div",{style:{width:"280px"},children:[h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[Z("projectPanel.SelectXAxis",te),": "]})}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{style:{width:"100%"},value:$.current,onChange:tt=>at(tt),children:ht()})})]}),h.jsxs(nn,{gutter:6,style:{paddingBottom:"8px"},children:[h.jsx(Ke,{span:8,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[Z("projectPanel.SelectYAxis",te),": "]})}),h.jsx(Ke,{span:16,children:h.jsx(Uo,{style:{width:"100%"},value:ie.current,onChange:tt=>yt(tt),children:ht()})})]}),h.jsx(nn,{style:{paddingBottom:"8px"},children:h.jsxs("div",{children:[h.jsxs(uko,{id:"scatter-chart",width:280,height:240,margin:{top:0,right:0,bottom:-10,left:-10},children:[h.jsx(Cw,{strokeWidth:"1",stroke:"gray",horizontal:se.current,vertical:oe.current}),h.jsx(l1,{dataKey:"x",fontSize:10,type:"number",domain:[Ve.min,Ve.max],name:"x",unit:kt,strokeWidth:1,stroke:"gray",tickFormatter:(tt,Ht)=>$.current==="yearlyProfit"||$.current==="unitCost"||$.current==="sellingPrice"?"$"+tt:tt}),h.jsx(vh,{dataKey:"y",fontSize:10,type:"number",domain:[ft.min,ft.max],name:"y",unit:rt,strokeWidth:1,stroke:"gray",tickFormatter:(tt,Ht)=>ie.current==="yearlyProfit"||ie.current==="unitCost"||ie.current==="sellingPrice"?"$"+tt:tt}),h.jsx(rh,{cursor:{strokeDasharray:"3 3"},formatter:tt=>tt.toFixed(2)}),h.jsx(xb,{name:"All",data:ct,fill:"#8884d8",shape:h.jsx(mU,{fill:"#8884d8",r:Q.current})}),R&&h.jsx(xb,{name:"Selected",data:It,fill:"red",shape:"star"})]}),h.jsx(jBo,{symbolSize:Q.current,horizontalGrid:se.current,verticalGrid:oe.current,changeHorizontalGrid:tt=>{se.current=tt,U(!N)},changeVerticalGrid:tt=>{oe.current=tt,U(!N)},changeSymbolSize:tt=>{Q.current=tt,ee&&o.uid&&s&&QGn(o.uid,s,tt).then(()=>{}),U(!N)}})]})}),h.jsx(nn,{children:h.jsx("span",{style:{width:"100%",textAlign:"center"},children:h.jsx(_u,{style:{fontSize:"18px",color:"gray",paddingRight:"8px"},title:Z("projectPanel.ScatterPlotScreenshot",te),onClick:()=>{const tt=document.getElementById("scatter-chart");tt&&vpe.saveSvgAsPng(tt,"scatter-chart-"+s+".png").then(()=>{gn(Z("message.ScreenshotSaved",te)),r&&n(Ht=>{Ht.actionInfo={name:"Scatter chart screenshot",timestamp:new Date().getTime(),details:{image:"scatter-chart-"+s+".png"}}})})}})})})]}),bt=()=>h.jsx("div",{children:h.jsxs(Le.Group,{onChange:tt=>{pt(tt.target.value)},value:g??d9.ALL,children:[h.jsx(Le,{style:{fontSize:"12px",width:"100%"},value:d9.ALL,children:Z("projectPanel.SameColorForAllDesigns",te)}),h.jsx("br",{}),h.jsx(Le,{style:{fontSize:"12px",width:"100%"},value:d9.INDIVIDUALS,children:Z("projectPanel.OneColorForEachDesign",te)})]})}),zt=()=>h.jsx("div",{style:{width:"250px"},onClick:tt=>tt.stopPropagation(),children:h.jsxs(nn,{gutter:6,style:{paddingBottom:"4px"},children:[h.jsx(Ke,{span:14,style:{paddingTop:"5px"},children:h.jsxs("span",{style:{fontSize:"12px"},children:[Z("projectPanel.ThumbnailImageSize",te),": "]})}),h.jsx(Ke,{span:10,children:h.jsxs(Uo,{style:{width:"100%"},value:q.current,onChange:tt=>{q.current=tt,ee?o.uid&&s&&ZGn(o.uid,s,tt).then(()=>{n(Ht=>{Ht.projectState.thumbnailWidth=q.current})}):n(Ht=>{Ht.projectState.thumbnailWidth=q.current}),U(!N)},children:[h.jsx(Vh,{value:100,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("word.Small",te)})},"small-thumbnail"),h.jsx(Vh,{value:125,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("word.Medium",te)})},"medium-thumbnail"),h.jsx(Vh,{value:200,children:h.jsx("span",{style:{fontSize:"12px"},children:Z("word.Large",te)})},"large-thumbnail")]})})]})}),Bt=[{key:"1",label:h.jsxs(_Bo,{children:[h.jsx("span",{children:Z("projectPanel.ProjectDescription",te)+" | "+Z("projectPanel.ProjectType",te)+": "+d}),h.jsxs("span",{children:[ee&&h.jsxs(h.Fragment,{children:[B.current&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),D.current=!D.current,U(!N)},children:D.current?h.jsx(fon,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.MakeDescriptionNonEditable",te)}):h.jsx(nqe,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.MakeDescriptionEditable",te)})}),h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),fe()},children:h.jsx(von,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.CurateCurrentDesign",te)})}),R&&R.title===l&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),e&&o.uid&&s&&l&&oXn(o.uid,d,s,A??200,l,e).then(()=>{U(!N),r&&n(Ht=>{Ht.actionInfo={name:"Update Selected Design",timestamp:new Date().getTime(),details:{design:l}}})})},children:h.jsx(aon,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.UpdateSelectedDesign",te)})}),R&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),pe(),H(void 0)},children:h.jsx(eqe,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.RemoveSelectedDesign",te)})}),R&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{if(tt.stopPropagation(),s){let Ht=t1+"?client=web&userid="+o.uid+"&project="+encodeURIComponent(s);R&&(Ht+="&title="+encodeURIComponent(R.title)),navigator.clipboard.writeText(Ht).then(()=>S2(Z("projectListPanel.ProjectLinkGeneratedInClipBoard",te)+".")),r&&n(_t=>{_t.actionInfo={name:"Generate Project Link",timestamp:new Date().getTime(),details:Ht}})}},children:h.jsx(Con,{style:{fontSize:"24px",color:"gray"},title:Z("projectListPanel.GenerateProjectLink",te)})})]}),u&&u.length>1&&f&&h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>{tt.stopPropagation(),n(Ht=>{Ht.projectState.sortDescending=!Ht.projectState.sortDescending,r&&(Ht.actionInfo={name:"Sort Design",timestamp:new Date().getTime(),details:{descending:!Ht.projectState.sortDescending}})})},children:S?h.jsx(Von,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.ClickToFlipSortingOrder",te)}):h.jsx(Xon,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.ClickToFlipSortingOrder",te)})}),h.jsx(Ml,{title:h.jsx("div",{onClick:tt=>tt.stopPropagation(),children:Z("projectPanel.ProjectSettings",te)}),content:zt,children:h.jsx(io,{style:{border:"none",padding:"4px"},onClick:tt=>tt.stopPropagation(),children:h.jsx(Bon,{style:{fontSize:"24px",color:"gray"}})})})]})]}),children:h.jsx(BBo,{title:D.current?void 0:Z("projectPanel.DoubleClickToMakeDescriptionEditable",te),readOnly:!D.current,value:L.current??void 0,onDoubleClick:()=>{D.current=!D.current,U(!N)},onChange:tt=>{L.current=tt.target.value,j.current=!0,n(Ht=>{Ht.projectState.description=tt.target.value}),U(!N)},onBlur:()=>{D.current=!1,j.current&&o.uid&&ee&&s&&XGn(o.uid,s,L.current).then(()=>{j.current=!1,U(!N)})},style:{paddingLeft:"10px",textAlign:"left",resize:D.current?"vertical":"none",border:D.current?"1px solid gray":"none"}})}];return h.jsx(YBo,{onContextMenu:tt=>{tt.stopPropagation()},children:h.jsxs(OBo,{children:[h.jsxs(VBo,{children:[h.jsx("span",{children:Z(ee?"projectPanel.Project":"projectPanel.ProjectByOtherPeople",te)+": "+s+(ee?"":" ("+Z("word.Owner",te)+": "+(c==null?void 0:c.substring(0,4))+"***)")+" ("+G.current.length+")"}),h.jsx("span",{style:{cursor:"pointer"},onMouseDown:()=>{de()},onTouchStart:()=>{de()},children:h.jsx(jw,{title:Z("word.Close",te)})})]}),h.jsx(fye,{items:Bt,style:{backgroundColor:"white",border:"none"},onChange:tt=>{B.current=tt.length>0,U(!N)}}),G.current.length>0&&h.jsxs(XBo,{children:[h.jsx(gk,{style:{width:"100%",height:ye/2-(B.current?160:80),paddingLeft:"4px",paddingRight:"4px",overflowX:"hidden",overflowY:"auto"},grid:{column:ae,gutter:1},dataSource:G.current,renderItem:tt=>{var qt;const Ht=tt.title.lastIndexOf(" "),_t=A===100?8:A===125?12:30;return h.jsxs(gk.Item,{style:{marginBottom:"-28px"},onMouseOver:()=>{E(tt)},onMouseLeave:()=>{E(void 0)},children:[h.jsx("img",{loading:"eager",width:ge+"px",height:"auto",onError:un=>{un.target.src=pV},onLoad:un=>{n(Rn=>{Rn.projectImages.set(tt.title,un.target)}),dt.getState().set(Rn=>{Rn.projectImagesUpdateFlag=!Rn.projectImagesUpdateFlag})},alt:tt.title,title:(tt.timestamp?Z("word.LastUpdate",te)+": "+ul(new Date(tt.timestamp)).format("MM-DD-YYYY hh:mm A")+` +`:"")+Z(R===tt?"projectPanel.SingleClickToDeselectDoubleClickToOpen":"projectPanel.SingleClickToSelectDoubleClickToOpen",te),src:(qt=tt.thumbnail)!=null&&qt.startsWith("data:image/png;base64")?tt.thumbnail:pV,style:{transition:".5s ease",opacity:tt.excluded?.25:F===tt?.5:1,padding:"1px",cursor:"pointer",borderRadius:R===tt?"0":"10px",border:R===tt?"2px solid red":"none"},onDoubleClick:un=>{const Rn=un.target;Rn.src===pV&&(Rn.src=tt.thumbnailUrl),H(tt),c&&QX(c,tt.title,!0,!0).then(()=>{r&&n(yo=>{yo.actionInfo={name:"Open Design",timestamp:new Date().getTime(),details:tt.title}})})},onClick:un=>{const Rn=un.target;Rn.src===pV&&(Rn.src=tt.thumbnailUrl),H(tt!==R?tt:void 0),r&&n(yo=>{yo.actionInfo={name:tt!==R?"Select Design":"Deselect Design",timestamp:new Date().getTime(),details:tt==null?void 0:tt.title}})}}),h.jsx("div",{style:{position:"relative",left:"10px",textAlign:"left",bottom:"18px",color:"white",fontSize:"8px",fontWeight:tt.title===l?"bold":"normal"},children:tt.title?tt.title.length>_t?tt.title.substring(0,Math.min(_t,Ht))+"..."+tt.title.substring(Ht):tt.title:"Unknown"}),h.jsxs("div",{style:{position:"relative",right:"10px",textAlign:"right",bottom:"36px",color:"white"},children:[tt.title===l&&h.jsx(BKe,{style:{paddingRight:"4px",fontSize:"16px"}}),tt.invisible?h.jsx(oon,{onClick:()=>{$e(tt)},style:{fontSize:"16px"},title:Z("projectPanel.DesignNotShownInSolutionSpaceClickToShow",te)}):h.jsx(Tme,{onClick:()=>{$e(tt)},style:{fontSize:"16px"},title:Z("projectPanel.DesignShownInSolutionSpaceClickToHide",te)})]})]})}}),h.jsxs(GBo,{children:[h.jsx("span",{style:{paddingLeft:"20px"},children:Z("projectPanel.SolutionSpace",te)}),h.jsxs("span",{children:[d===Ri.SOLAR_PANEL_ARRAY&&h.jsx(Ml,{title:Z("projectPanel.ChooseSolutionSpace",te),onOpenChange:tt=>{V.current&&(tt||dt.getState().set(Ht=>{Ht.updateProjectsFlag=!0}),V.current=!1)},content:Wt(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(eon,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(Ml,{title:Z("projectPanel.ChooseDataColoring",te),content:bt(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(Xnn,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(Ml,{title:Z("projectPanel.GenerateScatterPlot",te),content:ot(),children:h.jsx(io,{style:{border:"none",paddingRight:0,background:"white"},children:h.jsx(zWt,{style:{fontSize:"24px",color:"gray"}})})}),h.jsx(io,{style:{border:"none",paddingRight:"20px",background:"white"},onClick:()=>{const tt=document.getElementById("design-space");tt&&vpe.saveSvgAsPng(tt,"design-space-"+s+".png").then(()=>{gn(Z("message.ScreenshotSaved",te)),r&&n(Ht=>{Ht.actionInfo={name:"Solution space screenshot",timestamp:new Date().getTime(),details:{image:"design-space-"+s+".png"}}})})},children:h.jsx(_u,{style:{fontSize:"24px",color:"gray"},title:Z("projectPanel.SolutionSpaceScreenshot",te)})})]})]}),h.jsx(UBo,{id:"design-space",width:t*window.innerWidth,height:ye/2-120,data:ve,types:he,minima:Ie,maxima:Me,filters:Ue,steps:nt,variables:Se,titles:Re,units:De,digits:Ae,tickIntegers:ue,hover:lt,hoveredIndex:u&&F?u.indexOf(F):-1,selectedIndex:u&&R?u.indexOf(R):-1})]})]})})}),KBo=new Kt,W4=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a);return h.jsx(si,{name:e,args:[i,i,i],position:[n,o,r],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),children:h.jsx("meshStandardMaterial",{color:a})})},gV=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a);return h.jsx(Ps,{name:e,args:[i],position:[n,o,r],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),children:h.jsx("meshStandardMaterial",{color:a})})},BFe=({args:t,handleType:e})=>{const[n,o,r,i]=t,[a,l]=m.useState($a),s=m.useMemo(()=>h.jsx("meshStandardMaterial",{color:a}),[a]);return h.jsxs("group",{name:e,position:[n,o,r],rotation:[Qt,0,0],onPointerOver:()=>l(ga),onPointerOut:()=>l($a),scale:i*4,children:[h.jsxs("group",{children:[h.jsx(wge,{args:[.15,.05,6,8,3/2*Math.PI],rotation:[Qt,0,Qt],children:s}),h.jsx(xf,{args:[.1,.1,6],rotation:[Qt,0,0],position:[.15,0,.05],children:s}),h.jsx(uR,{args:[.05,6],rotation:[0,Qt,0],position:[0,0,.15],children:s})]}),h.jsx(ta,{name:e,args:[.35,.35],position:[0,.05,0],rotation:[-Qt,0,0],visible:!1})]})},qBo=be.memo(({groupedElementsIdSet:t,childCuboidSet:e,initialPosition:n,initialDimension:o,initialRotation:r})=>{const[i,a,l]=n,[s,c,u]=o,d=s===0?1:c/s,f=t.size>1||e.size>0,p=m.useRef(null),g=m.useRef(new le),A=m.useRef(new ln),y=m.useRef(new Kt),S=m.useRef(new Map),C=m.useRef(new Map),P=m.useRef(new Map),v=m.useRef(new Map),T=m.useRef(new Map),w=m.useRef(new Map),x=m.useRef(new Map),b=m.useRef(new Map),R=m.useRef(new le),H=m.useRef(!1),F=m.useRef(new Map),E=m.useRef(new Map),N=m.useRef(new Map),U=m.useRef(new Map),W=m.useRef(new Map),[k,D]=m.useState(new le(i,a,l)),[L,j]=m.useState(r),[B,O]=m.useState(s/2),[V,G]=m.useState(c/2),[q,$]=m.useState(u),[ie,Q]=m.useState(!1),[se,oe]=m.useState("Null"),{get:Z}=ri(),te=m.useMemo(()=>new l0,[]),ee=m.useMemo(()=>new Kt,[]),de=M(Ju),fe=M(Jn),pe=M(Wge),ye=M(pn),ae=M(En);m.useEffect(()=>{$(u)},[u]),m.useEffect(()=>{D(new le(i,a,l)),ge(s,c),j(r)},[n,o,r]);const Te=Ye=>{ee.x=Ye.offsetX/Z().gl.domElement.clientWidth*2-1,ee.y=-(Ye.offsetY/Z().gl.domElement.clientHeight)*2+1,te.setFromCamera(ee,Z().camera)},ge=(Ye,it)=>{O(Ye/2),G(it/2)},Se=Ye=>{Q(!0),kn.getState().setEnableOrbitController(!1),H.current=!0,g.current.set(0,0,0),A.current.set(0,0,0),we(zo.Default),Ye.stopPropagation()},Re=(Ye,it,ut)=>{ye(Qe=>{for(const lt of Qe.elements)if(Ad(lt)&&Ye.has(lt.id))[lt.cx,lt.cy,lt.lx,lt.ly]=Ye.get(lt.id);else if(lt.foundationId&&Ye.has(lt.foundationId))switch(lt.type){case z.Wall:{const Ze=it.get(lt.id);if(!Ze)continue;const Be=lt,$e=Ze.slice(0,3),wt=Ze.slice(3);Be.cx=($e[0]+wt[0])/2,Be.cy=($e[1]+wt[1])/2,Be.lx=Math.hypot($e[0]-wt[0]+($e[1]-wt[1])),Be.relativeAngle=Math.atan2(wt[1]-$e[1],wt[0]-$e[0]),Be.leftPoint=[...$e],Be.rightPoint=[...wt];break}case z.Window:{const Ze=lt;if(Ze.parentType!==z.Roof)continue;const Be=ut.get(lt.id);if(!Be)continue;[Ze.cx,Ze.cy]=Be;break}case z.SolarPanel:{const Ze=ut.get(lt.id);if(!Ze)continue;[lt.cx,lt.cy]=Ze;break}}Qe.groupActionUpdateFlag=!Qe.groupActionUpdateFlag,Qe.updateElementOnRoofFlag=!0})},De=(Ye,it)=>{ye(ut=>{for(const Qe of ut.elements){if(Ye.has(Qe.id)){const lt=Ye.get(Qe.id);lt!==void 0&&(Qe.type===z.Roof?Qe.rise=lt:Qe.type===z.SolarPanel?Qe.cz=lt:Qe.lz=lt)}if(Qe.type===z.Wall&&it.has(Qe.id)){const lt=Qe,Ze=it.get(lt.id);Ze&&(lt.leftTopPartialHeight=Ze.upperLeft,lt.rightTopPartialHeight=Ze.upperRight,lt.leftUnfilledHeight=Ze.lowerLeft,lt.rightUnfilledHeight=Ze.lowerRight)}}ut.groupActionUpdateFlag=!ut.groupActionUpdateFlag,ut.updateElementOnRoofFlag=!0})},Ae=Ye=>{ye(it=>{for(const ut of it.elements)if(Ye.has(ut.id)){const Qe=Ye.get(ut.id);Qe&&(ut.cx=Qe[0],ut.cy=Qe[1],ut.cz=Qe[2],ut.rotation[2]=Qe[3])}it.groupActionUpdateFlag=!it.groupActionUpdateFlag})},ue=()=>{const Ye=new Map;for(const Qe of M.getState().elements)(Ad(Qe)&&t.has(Qe.id)||t.has(Qe.parentId))&&Ye.set(Qe.id,[Qe.cx,Qe.cy,Qe.cz,Qe.rotation[2]]);const ut={name:`${se==="Move"?"Move":"Rotate"} Foundation Group`,timestamp:Date.now(),oldPositionMap:new Map(F.current),newPositionMap:new Map(Ye),undo:()=>{Ae(ut.oldPositionMap)},redo:()=>{Ae(ut.newPositionMap)}};ae(ut)},he=()=>{const Ye=new Map,it=new Map,ut=new Map;for(const lt of M.getState().elements)if(Ad(lt)&&F.current.has(lt.id))Ye.set(lt.id,[lt.cx,lt.cy,lt.lx,lt.ly]);else if(E.current.has(lt.id)){const Ze=lt;it.set(lt.id,[...Ze.leftPoint,...Ze.rightPoint])}else if(W.current.has(lt.id))if(lt.type===z.Window){const Ze=lt;if(Ze.parentType!==z.Roof)continue;ut.set(Ze.id,[Ze.cx,Ze.cy])}else lt.type===z.SolarPanel&&ut.set(lt.id,[lt.cx,lt.cy]);const Qe={name:"Resize Building XY",timestamp:Date.now(),oldFoundationDataMap:new Map(F.current),newFoundationDataMap:new Map(Ye),oldWallPointsMap:new Map(E.current),newWallPointsMap:new Map(it),oldSkylightPosMap:new Map(W.current),newSkylightPosMap:new Map(ut),undo:()=>{Re(Qe.oldFoundationDataMap,Qe.oldWallPointsMap,Qe.oldSkylightPosMap)},redo:()=>{Re(Qe.newFoundationDataMap,Qe.newWallPointsMap,Qe.newSkylightPosMap)}};ae(Qe)},ve=()=>{const Ye=new Map,it=new Map;for(const Qe of M.getState().elements)if(N.current.has(Qe.id)&&(Qe.type===z.Roof?Ye.set(Qe.id,Qe.rise):Qe.type===z.SolarPanel?Ye.set(Qe.id,Qe.cz):Ye.set(Qe.id,Qe.lz)),Qe.type===z.Wall&&U.current.has(Qe.id)){const lt=Qe;it.set(lt.id,{lowerLeft:lt.leftUnfilledHeight,lowerRight:lt.rightUnfilledHeight,upperLeft:lt.leftTopPartialHeight,upperRight:lt.rightTopPartialHeight})}const ut={name:"Resize Building Z",timestamp:Date.now(),oldElementHeightMap:new Map(N.current),newElementHeightMap:new Map(Ye),oldPartialWallHeightMap:new Map(U.current),newPartialWallHeightMap:new Map(it),undo:()=>{De(ut.oldElementHeightMap,ut.oldPartialWallHeightMap)},redo:()=>{De(ut.newElementHeightMap,ut.newPartialWallHeightMap)}};ae(ut)},we=Ye=>{ye(it=>{it.moveHandleType=Ye})},Pe=Ye=>{const it=new Kt(Ye.x,Ye.y),ut=y.current.clone();if(f){const Qe=new Kt().subVectors(it,ut),lt=Math.max(1,Qe.length()),Ze=Math.sqrt(Math.pow(lt,2)/(Math.pow(d,2)+1)),Be=Ze*d,$e=new Kt(Ze*Math.sign(Qe.x),Be*Math.sign(Qe.y)).normalize().multiplyScalar(lt/2).add(ut);D(new le($e.x,$e.y)),ge(Ze,Be),ye(wt=>{const vt=new Map;for(const Rt of wt.elements)if(Ad(Rt)&&(t.has(Rt.id)||e.has(Rt.id))){const Gt=x.current.get(Rt.id),At=b.current.get(Rt.id);if(Gt&&At){const pt=At[0]*Ze,Wt=At[1]*Be;if(Rt.lx=pt,Rt.ly=Wt,Rt.parentId!==Zo){const ht=vt.get(Rt.parentId);if(ht){const{pos:ct,rot:It}=ht,Ft=new le(Gt[0]*Ze+$e.x,Gt[1]*Be+$e.y),Ve=Ft.clone().sub(ct).applyEuler(new ln(0,0,-It));Rt.cx=Ve.x,Rt.cy=Ve.y,vt.set(Rt.id,{pos:Ft.clone(),rot:Rt.rotation[2]+It})}}else{const ht=Gt[0]*Ze+$e.x,ct=Gt[1]*Be+$e.y;Rt.cx=ht,Rt.cy=ct,vt.set(Rt.id,{pos:new le(ht,ct),rot:Rt.rotation[2]})}for(const ht of wt.elements)if(ht.foundationId===Rt.id)switch(ht.type){case z.Wall:{const ct=ht,It=C.current.get(ct.id);if(!It)continue;const[Ft,Ve]=It,ft=[Ft.x*pt,Ft.y*Wt,Rt.lz],kt=[Ve.x*pt,Ve.y*Wt,Rt.lz];ct.cx=(ft[0]+kt[0])/2,ct.cy=(ft[1]+kt[1])/2,ct.lx=Math.hypot(ft[0]-kt[0]+(ft[1]-kt[1])),ct.relativeAngle=Math.atan2(kt[1]-ft[1],kt[0]-ft[0]),ct.leftPoint=[...ft],ct.rightPoint=[...kt];break}case z.SolarPanel:{const ct=ht,It=v.current.get(ct.id);if(!It)continue;const Ft=ct.parentType,[Ve,ft,kt]=ct.normal;Ft===z.Foundation||Ft===z.Roof||Ft===z.Cuboid&&me.isEqual(kt,1)?(ct.cx=It[0]*pt,ct.cy=It[1]*Wt):Ft===z.Cuboid&&(me.isEqual(Ve,0)&&me.isEqual(ft,1)?(ct.cx=It[0]*pt,ct.cy=Wt/2):me.isEqual(Ve,0)&&me.isEqual(ft,-1)?(ct.cx=It[0]*pt,ct.cy=-Wt/2):me.isEqual(Ve,-1)&&me.isEqual(ft,0)?(ct.cx=-pt/2,ct.cy=It[1]*Wt):me.isEqual(Ve,1)&&me.isEqual(ft,0)&&(ct.cx=pt/2,ct.cy=It[1]*Wt));break}case z.Window:{const ct=ht;if(ct.parentType!==z.Roof)continue;const It=v.current.get(ct.id);if(!It)continue;ct.cx=It[0]*pt,ct.cy=It[1]*Wt;break}}}}})}else{const Qe=ut.distanceTo(it),lt=Math.atan2(it.x-ut.x,it.y-ut.y)+L,Ze=Math.abs(Qe*Math.sin(lt)),Be=Math.abs(Qe*Math.cos(lt)),$e=new Kt().addVectors(it,ut).multiplyScalar(.5);D(new le($e.x,$e.y)),ge(Ze,Be),ye(wt=>{for(const vt of wt.elements)if(t.has(vt.id))vt.lx=Ze,vt.ly=Be,vt.cx=$e.x,vt.cy=$e.y;else if(vt.foundationId&&t.has(vt.foundationId))switch(vt.type){case z.Wall:{const Rt=vt,Gt=C.current.get(Rt.id);if(!Gt)continue;const[At,pt]=Gt,Wt=[At.x*Ze,At.y*Be,0],ht=[pt.x*Ze,pt.y*Be,0];Rt.cx=(Wt[0]+ht[0])/2,Rt.cy=(Wt[1]+ht[1])/2,Rt.lx=Math.hypot(Wt[0]-ht[0],Wt[1]-ht[1]),Rt.relativeAngle=Math.atan2(ht[1]-Wt[1],ht[0]-Wt[0]),Rt.leftPoint=[...Wt],Rt.rightPoint=[...ht];break}case z.SolarPanel:{const Rt=vt,Gt=v.current.get(Rt.id);if(!Gt)continue;const At=Rt.parentType,[pt,Wt,ht]=Rt.normal;At===z.Foundation||At===z.Roof||At===z.Cuboid&&me.isEqual(ht,1)?(Rt.cx=Gt[0]*Ze,Rt.cy=Gt[1]*Be):At===z.Cuboid&&(me.isEqual(pt,0)&&me.isEqual(Wt,1)?(Rt.cx=Gt[0]*Ze,Rt.cy=Be/2):me.isEqual(pt,0)&&me.isEqual(Wt,-1)?(Rt.cx=Gt[0]*Ze,Rt.cy=-Be/2):me.isEqual(pt,-1)&&me.isEqual(Wt,0)?(Rt.cx=-Ze/2,Rt.cy=Gt[1]*Be):me.isEqual(pt,1)&&me.isEqual(Wt,0)&&(Rt.cx=Ze/2,Rt.cy=Gt[1]*Be));break}case z.Window:{const Rt=vt;if(Rt.parentType!==z.Roof)continue;const Gt=v.current.get(Rt.id);if(!Gt)continue;Rt.cx=Gt[0]*Ze,Rt.cy=Gt[1]*Be}}})}M.getState().updateElementOnRoofFn()},Ie=Ye=>{if(Ye.z<.1)return;const it=Ye.z;$(it),ye(ut=>{for(const Qe of ut.elements)if(S.current.has(Qe.id)){if(Qe.type===z.Wall){Qe.lz=it*S.current.get(Qe.id);const lt=Qe;if(lt.fill===Fl.Partial){const Ze=P.current.get(lt.id);Ze&&(lt.leftTopPartialHeight=it*Ze.upperLeft,lt.rightTopPartialHeight=it*Ze.upperRight,lt.leftUnfilledHeight=it*Ze.lowerLeft,lt.rightUnfilledHeight=it*Ze.lowerRight)}}else if(Qe.type===z.Roof)Qe.rise=it*S.current.get(Qe.id);else if(Qe.type===z.Cuboid){const lt=S.current.get(Qe.id);if(lt){const Ze=lt*it;Qe.lz=Ze,Qe.cz=Ze/2}}else if(Qe.type===z.SolarPanel&&Qe.parentType===z.Cuboid&&S.current.has(Qe.parentId)){const lt=S.current.get(Qe.parentId);if(lt){const Ze=lt*it;if(me.isEqual(Qe.normal[2],1))Qe.cz=Ze/2;else{const Be=S.current.get(Qe.id);Be&&(Qe.cz=Be*Ze)}}}}ut.updateElementOnRoofFlag=!0})},Me=Ye=>{const it=new le(k.x,k.y),ut=Math.atan2(it.x-Ye.x,Ye.y-it.y)+(se==="Rotate Upper"?0:Math.PI),Qe=Math.abs(ut)>Math.PI?-sa:0,lt=ut+Qe,Ze=new ln(0,0,lt),Be=w.current.size;ye($e=>{for(const wt of $e.elements){if(Ad(wt)&&t.has(wt.id)&&!e.has(wt.id)){const vt=T.current.get(wt.id),Rt=Be!==1?w.current.get(wt.id):0;if(vt&&Rt!==void 0){const Gt=vt.clone().applyEuler(Ze);wt.cx=it.x+Gt.x,wt.cy=it.y+Gt.y,wt.rotation=[0,0,Rt+lt]}}if(wt.type!==z.Cuboid&&t.has(wt.parentId)){const vt=Be!==1?w.current.get(wt.parentId):0;vt!==void 0&&(wt.rotation=[0,0,vt+lt])}}}),j(lt)},ze=(Ye,it)=>{const ut=new Kt(k.x,k.y);y.current.set(Ye,it).rotateAround(KBo,L).add(ut),oe("Resize XY"),x.current.clear(),b.current.clear(),C.current.clear(),F.current.clear(),E.current.clear(),v.current.clear(),W.current.clear();const[Qe,lt]=[B*2,V*2];for(const Ze of M.getState().elements)if(Ad(Ze)&&(t.has(Ze.id)||e.has(Ze.id))){const{pos:Be}=me.getWorldDataById(Ze.id);x.current.set(Ze.id,[(Be.x-k.x)/Qe,(Be.y-k.y)/lt]),b.current.set(Ze.id,[Ze.lx/Qe,Ze.ly/lt]),F.current.set(Ze.id,[Ze.cx,Ze.cy,Ze.lx,Ze.ly])}else if(Ze.foundationId&&(t.has(Ze.foundationId)||e.has(Ze.foundationId))){const Be=fe(Ze.foundationId);if(!Be)continue;switch(Ze.type){case z.Wall:{const $e=Ze,wt=new Kt($e.leftPoint[0]/Be.lx,$e.leftPoint[1]/Be.ly),vt=new Kt($e.rightPoint[0]/Be.lx,$e.rightPoint[1]/Be.ly);C.current.set($e.id,[wt,vt]),E.current.set($e.id,[...$e.leftPoint,...$e.rightPoint]);break}case z.SolarPanel:case z.Window:{const $e=Ze;v.current.set($e.id,[$e.cx/Be.lx,$e.cy/Be.ly]),W.current.set($e.id,[$e.cx,$e.cy]);break}}}},Ne=(Ye,it,ut)=>{const{x:Qe,y:lt}=pe();g.current.set(Ye,it,ut),A.current.set(-Qt,0,-Math.atan2(Qe,lt)-L,"ZXY"),oe("Resize Z"),S.current.clear(),N.current.clear(),P.current.clear(),U.current.clear();for(const Ze of M.getState().elements)if(Ze.foundationId&&(t.has(Ze.foundationId)||e.has(Ze.parentId))){if(Ze.type===z.Wall){S.current.set(Ze.id,Ze.lz/q),N.current.set(Ze.id,Ze.lz);const Be=Ze;Be.fill===Fl.Partial&&(U.current.set(Be.id,{upperLeft:Be.leftTopPartialHeight,upperRight:Be.rightTopPartialHeight,lowerLeft:Be.leftUnfilledHeight,lowerRight:Be.rightUnfilledHeight}),P.current.set(Be.id,{upperLeft:Be.leftTopPartialHeight/q,upperRight:Be.rightTopPartialHeight/q,lowerLeft:Be.leftUnfilledHeight/q,lowerRight:Be.rightUnfilledHeight/q}))}else if(Ze.type===z.Roof)S.current.set(Ze.id,Ze.rise/q),N.current.set(Ze.id,Ze.rise);else if(Ze.type===z.SolarPanel&&Ze.parentType===z.Cuboid){const Be=M.getState().elements.find($e=>$e.id===Ze.parentId);Be&&(S.current.set(Ze.id,Ze.cz/Be.lz),N.current.set(Ze.id,Ze.cz))}}else(t.has(Ze.id)||e.has(Ze.id))&&(S.current.set(Ze.id,Ze.lz/q),N.current.set(Ze.id,Ze.lz))},Je=Ye=>{switch(Se(Ye),Ye.object.name){case Mt.UpperLeft:{ze(B,-V);break}case Mt.UpperRight:{ze(-B,-V);break}case Mt.LowerLeft:{ze(B,V);break}case Mt.LowerRight:{ze(-B,V);break}case Mt.UpperLeftTop:{Ne(-B,V,q);break}case Mt.UpperRightTop:{Ne(B,V,q);break}case Mt.LowerLeftTop:{Ne(-B,-V,q);break}case Mt.LowerRightTop:{Ne(B,-V,q);break}}},Ue=Ye=>{if(Se(Ye),oe("Move"),Ye.intersections.length>0){const it=Ye.intersections[0].point.clone().setZ(0);R.current.subVectors(k,it);for(const ut of M.getState().elements)if(Ad(ut)&&t.has(ut.id)){const Qe=new le(ut.cx,ut.cy),lt=new le().subVectors(Qe,it);T.current.set(ut.id,lt),F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}}},nt=Ye=>{if(Se(Ye),Ye.object.name===Di.Lower?oe("Rotate Lower"):Ye.object.name===Di.Upper&&oe("Rotate Upper"),Ye.intersections.length>0){const it=new le(k.x,k.y);for(const ut of M.getState().elements){if(Ad(ut)&&t.has(ut.id)){const Qe=new le(ut.cx,ut.cy),lt=new le().subVectors(Qe,it);T.current.set(ut.id,lt),w.current.set(ut.id,ut.rotation[2]),F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}t.has(ut.parentId)&&F.current.set(ut.id,[ut.cx,ut.cy,ut.cz,ut.rotation[2]])}}},We=()=>{switch(se){case"Move":case"Rotate Lower":case"Rotate Upper":ue();break;case"Resize XY":he();break;case"Resize Z":ve();break}Q(!1),kn.getState().setEnableOrbitController(!0),H.current=!1,oe("Null"),we(null),ye(Ye=>{Ye.groupActionUpdateFlag=!Ye.groupActionUpdateFlag,Ye.updateWallMapOnFoundationFlag=!Ye.updateWallMapOnFoundationFlag,Ye.updateElementOnRoofFlag=!0})},Ee=Ye=>{if(!p.current||!H.current)return;Te(Ye);const it=te.intersectObjects([p.current]);if(it.length>0){const ut=it[0].point;switch(se){case"Resize XY":Pe(ut);break;case"Resize Z":Ie(ut);break;case"Rotate Lower":case"Rotate Upper":Me(ut);break;case"Move":D(new le().addVectors(ut.clone().setZ(0),R.current)),ye(Qe=>{for(const lt of Qe.elements)if(Ad(lt)&&t.has(lt.id)&&!e.has(lt.id)){const Ze=T.current.get(lt.id);Ze&&(lt.cx=ut.x+Ze.x,lt.cy=ut.y+Ze.y)}});break}}},ke=a5(),Oe=ke/2,st=q+Oe-ke/2,je=B+ke,xt=V+ke,gt=V+ke*4;return h.jsxs("group",{name:"Group Master",position:k,rotation:[0,0,L],children:[h.jsxs("group",{name:"Resize Handle Group",onPointerDown:Je,children:[h.jsx(W4,{args:[B,V,Oe,ke],handleType:Mt.UpperRight}),h.jsx(W4,{args:[-B,V,Oe,ke],handleType:Mt.UpperLeft}),h.jsx(W4,{args:[B,-V,Oe,ke],handleType:Mt.LowerRight}),h.jsx(W4,{args:[-B,-V,Oe,ke],handleType:Mt.LowerLeft}),!de&&h.jsxs(h.Fragment,{children:[h.jsx(W4,{args:[B,V,st,ke],handleType:Mt.UpperRightTop}),h.jsx(W4,{args:[-B,V,st,ke],handleType:Mt.UpperLeftTop}),h.jsx(W4,{args:[B,-V,st,ke],handleType:Mt.LowerRightTop}),h.jsx(W4,{args:[-B,-V,st,ke],handleType:Mt.LowerLeftTop})]})]}),h.jsxs("group",{name:"Move Handle Group",onPointerDown:Ue,children:[h.jsx(gV,{args:[0,xt,Oe,ke],handleType:zo.Upper}),h.jsx(gV,{args:[0,-xt,Oe,ke],handleType:zo.Lower}),h.jsx(gV,{args:[je,0,Oe,ke],handleType:zo.Right}),h.jsx(gV,{args:[-je,0,Oe,ke],handleType:zo.Left})]}),h.jsxs("group",{name:"Rotate Handle Group",onPointerDown:nt,children:[h.jsx(BFe,{args:[0,gt,Oe,ke],handleType:Di.Upper}),h.jsx(BFe,{args:[0,-gt,Oe,ke],handleType:Di.Lower})]}),ie&&h.jsx(ta,{name:"Intersection Plane",ref:p,args:[Math.max(B*2.4,1e3),Math.max(B*2.4,1e3)],visible:!1,position:g.current,rotation:A.current,onPointerMove:Ee,onPointerUp:We}),h.jsx("group",{name:"Wireframe Group",position:[0,0,q/2],children:h.jsx(mw,{hx:B,hy:V,hz:q/2,lineColor:"white"})})]})}),$Bo=t=>t.parentId===Zo&&(t.type===z.Foundation||t.type===z.Cuboid),QBo=be.memo(()=>{M(gxt);const t=M(jwt),e=d();if(e.length===0)return null;const{allBaseElements:n,allBaseElementsVerticesMap:o,cuboidParentIdMap:r}=f(),i=new Set(e.map(y=>y.id)),a=[...e];for(const y of e)y.enableGroupMaster&&p(y);const{position:l,dimension:s,rotation:c,childCuboidIdSet:u}=g();function d(){const y=new Set;for(const S of M.getState().elements)t.has(S.id)&&(S.parentId===Zo&&Ad(S)?y.add(S.id):S.foundationId&&y.add(S.foundationId));return y.size===0?[]:M.getState().elements.filter(S=>y.has(S.id))}function f(){const y=[],S=new Map,C=new Map;for(const P of M.getState().elements){if($Bo(P)){const v=me.fetchFoundationVertexCoordinates(P);y.push(P),S.set(P.id,v)}P.type===z.Cuboid&&P.parentId!==Zo&&C.set(P.id,P.parentId)}return{allBaseElements:y,allBaseElementsVerticesMap:S,cuboidParentIdMap:C}}function p(y){for(const S of n)!i.has(S.id)&&me.areBasesOverlapped(y.id,S.id,o)&&(i.add(S.id),a.push(S),S.enableGroupMaster&&p(S))}function g(){const y=a.map(R=>me.fetchFoundationVertexCoordinates(R)).flat(),S=new Set,C=me.calculatePolygonBounds(y);let P=1,v=1;const T=new Map;for(const R of M.getState().elements)if(R.foundationId&&i.has(R.foundationId))if(R.type===z.Wall){const H=R;P=Math.max(P,H.lz),H.roofId&&(T.get(H.roofId)??0)M(COe)?h.jsx(QBo,{}):null),eYo=be.memo(({showGallery:t,defaultSize:e=50,minWidth:n=25,maxWidth:o=75,children:r,wait:i=50,onChange:a})=>{const[l,s]=r,c=m.useRef(!1),u=p=>{const g=document.querySelector(".split-pane");g&&g.style.setProperty("--percentWidth",p+"%")},d=()=>{c.current=!0},f=m.useCallback(k2.throttle(p=>{if(!c.current)return;const g=Math.max(n,Math.min(o,p.clientX/window.innerWidth*100));u(g),a&&a(g)},i),[]);return m.useEffect(()=>{u(e)},[e]),m.useEffect(()=>{const p=()=>{c.current=!1};return window.addEventListener("pointerup",p),()=>window.removeEventListener("pointerup",p)},[]),m.useEffect(()=>{u(t?e:0)},[t,e]),h.jsxs("div",{className:"split-pane",onPointerMove:f,children:[h.jsx("div",{className:"left-child",children:l}),t&&h.jsx("div",{className:"sash",onPointerDown:d}),h.jsx("div",{className:"right-child",children:s})]})},(t,e)=>t.showGallery===e.showGallery&&t.onChange===e.onChange),Yle=72,YFe=be.memo(({viewOnly:t=!1})=>{const e=M(yp),n=dt(K8t),o=M(oa),r=M(pn),i=dt(KBe),a=M(Ju)??!1,l=M(Oq)??$F,s=M(zb),c=M(HW),u=M(bge),d=M(SBe),f=M(mA),p=M(I4t)??"roadmap",g=dt(Gq),A=M(kH),y=M(bA),[S,C]=m.useState(!0),[P,v]=m.useState(50),[T,w]=m.useState(!1),x=m.useRef(null),b=$t();m.useEffect(()=>{C(!1)},[]),m.useEffect(()=>{n&&w(CC.localeCompare(n)<0)},[n]),m.useEffect(()=>{r(U=>{var W;U.loggable=e&&e.uid?!((W=e.email)!=null&&W.endsWith("@intofuture.org")):!1,e&&(e.noLogging||!e.schoolID||e.schoolID==="UNKNOWN SCHOOL"||!e.classID||e.classID==="UNKNOWN CLASS")&&(U.loggable=!1)})},[e]),console.log("x");const R=e.uid&&new URLSearchParams(window.location.search).get("userid")===e.uid,H=U=>{kn.setState(W=>{if(!x.current)return W;const k=W.pointer;return k.x=U.clientX/x.current.clientWidth*2-1,k.y=-((U.clientY-Yle)/x.current.clientHeight)*2+1,{pointer:k}})},F=U=>{H(U)},E=()=>h.jsxs(m6t,{ref:x,shadows:!0,gl:{preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0},frameloop:"demand",style:{height:"100%",width:"100%",backgroundColor:"black"},camera:{fov:lje,far:l,up:[0,0,1]},onPointerMove:F,children:[h.jsx(e8o,{}),h.jsx(pAo,{}),h.jsx(iAo,{}),h.jsx(Rnn,{}),h.jsx(lAo,{}),h.jsxs(m.Suspense,{fallback:null,children:[h.jsx(Pnn,{}),h.jsx(ZBo,{})]}),h.jsxs(m.Suspense,{fallback:null,children:[u&&h.jsx(stn,{}),h.jsx(ltn,{theme:d}),h.jsx(znn,{}),f&&h.jsx(SXn,{})]}),h.jsx(hAo,{}),h.jsx(kBo,{}),A===_s.GENETIC_ALGORITHM&&y.geneticAlgorithmParams.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&h.jsx(X4o,{}),A===_s.GENETIC_ALGORITHM&&y.geneticAlgorithmParams.problem===Ri.SOLAR_PANEL_ARRAY&&h.jsx(K4o,{}),A===_s.PARTICLE_SWARM_OPTIMIZATION&&y.particleSwarmOptimizationParams.problem===Ri.SOLAR_PANEL_TILT_ANGLE&&h.jsx($4o,{}),A===_s.PARTICLE_SWARM_OPTIMIZATION&&y.particleSwarmOptimizationParams.problem===Ri.SOLAR_PANEL_ARRAY&&h.jsx(Z4o,{})]}),N=m.useMemo(()=>new Kt,[]);return h.jsxs("div",{className:"App",style:{position:"relative",overflow:"hidden"},onContextMenu:U=>U.preventDefault(),children:[h.jsx(bnn,{initializing:S}),h.jsxs("div",{style:{backgroundColor:"lightblue",height:Yle+"px",paddingTop:"10px",textAlign:"start",userSelect:"none",fontSize:"30px"},children:[h.jsx(rXe,{offset:["10px","0px"],count:T?h.jsx(Nnn,{style:{color:"red",cursor:"pointer"},title:Y.t("message.NewVersionAvailable",b)}):void 0,children:h.jsx(on,{style:{marginLeft:"120px",verticalAlign:"middle",cursor:"pointer",userSelect:"none",fontSize:"30px"},title:Y.t("tooltip.visitAladdinHomePage",b),onClick:kQt,children:`${Y.t("name.Aladdin",b)}`})}),s&&!g&&h.jsxs("span",{style:{marginLeft:"20px",fontSize:"14px",verticalAlign:"center",userSelect:"text",color:R?"black":"gray"},children:[h.jsx("img",{title:Y.t("toolbar.CloudFile",b),alt:"Cloud",src:fAo,height:32,width:32,style:{paddingRight:"8px"}}),s+(R&&i?" *":""),!t&&R&&i&&h.jsx(io,{type:"primary",size:"small",style:{marginLeft:"10px"},title:Y.t("menu.file.SaveCloudFile",b),onClick:()=>{dt.getState().setSaveCloudFileFlag(!0),o&&r(U=>{U.actionInfo={name:"Save Cloud File",timestamp:new Date().getTime()}})},children:`${Y.t("word.Save",b)}`})]})]}),t?h.jsxs("div",{style:{position:"absolute",bottom:"6px",left:"6px",zIndex:999,fontSize:"8px",userSelect:"none",color:f||c?p!=="roadmap"?"antiquewhite":"darkslategrey":"antiquewhite"},children:[h.jsx("img",{alt:"IFI Logo",src:tPe,height:"30px",style:{verticalAlign:"bottom"}})," V "+CC]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:"IFI Logo",src:tPe,height:c?"24px":"40px",style:{position:"absolute",bottom:"6px",left:"6px",zIndex:999,userSelect:"none"}}),h.jsxs("div",{style:{position:"absolute",bottom:"4px",left:c?"24px":"44px",zIndex:999,fontSize:"10px",userSelect:"none",pointerEvents:"none",color:f?p!=="roadmap"?"antiquewhite":"darkslategrey":c?"darkslategrey":"antiquewhite"},children:["   ©",new Date().getFullYear()," ",`${Y.t("name.IFI",b)}`," ",Y.t("word.VersionInitial",b)+CC+". "+Y.t("word.AllRightsReserved",b)+". "]})]}),!t&&h.jsx(G4o,{size:16,round:!0,margin:"2px",style:{position:"absolute",right:"0",top:"80px"}}),h.jsx(uXn,{viewOnly:t,canvas:x.current}),h.jsx(U2o,{viewOnly:t,canvas:x.current}),h.jsx(bBo,{}),h.jsx(qgo,{children:h.jsxs("div",{style:{height:`calc(100vh - ${Yle}px)`},children:[h.jsxs(eYo,{showGallery:c,defaultSize:c?50:0,onChange:U=>{v(Math.round(100-U));const W=kn.getState().canvas;if(W){const{gl:k,camera:D}=W,L=(100-U)*window.innerWidth/100;k.getSize(N),k.setSize(L,N.y),D instanceof zu&&(D.aspect=L/N.y,D.updateProjectionMatrix(),op())}},children:[c?h.jsx(JBo,{canvas:x.current,relativeWidth:1-P*.01}):h.jsx(h.Fragment,{}),E()]}),h.jsx(dAo,{canvas:x.current})]})}),h.jsx(sAo,{visible:!a}),!t&&h.jsx(wXn,{}),!t&&o&&h.jsx(rAo,{})]})}),tYo=be.memo(({viewOnly:t=!1})=>{const e=M(pn),n=M(rYe),o=M(kge),r=M(iYe),i=dt(oYe),a=dt(Hwt),l=dt(Mwt),s=M(zb),c=dt(Rwt),u=M(yp),d=M(m0),[f,p]=m.useState(!1),[g,A]=m.useState(!1),[y,S]=m.useState({left:0,top:0,bottom:0,right:0}),C=m.useRef(null),{t:P}=Xl(),v=m.useMemo(()=>({lng:d}),[d]);m.useEffect(()=>{a&&(T(),dt.getState().setCreateNewFileFlag(!1))},[a]),m.useEffect(()=>{l&&(w(),dt.getState().setOpenLocalFileFlag(!1))},[l]);const T=()=>{yi.confirm({title:`${P("message.DoYouWantToSaveChanges",v)}`,icon:h.jsx(ny,{}),okText:`${P("word.Yes",v)}`,cancelText:`${P("word.No",v)}`,onOk:()=>{u.uid?s?(e(N=>{N.localContentToImportAfterCloudFileUpdate="CREATE_NEW_FILE"}),dt.getState().setSaveCloudFileFlag(!0)):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):gn(P("menu.file.ToSaveYourWorkPleaseSignIn",v))},onCancel:()=>{r()}})},w=()=>{!t&&dt.getState().changed?yi.confirm({title:P("message.DoYouWantToSaveChanges",v),icon:h.jsx(ny,{}),onOk:()=>{u.uid?s?x(!0):e(N=>{N.showCloudFileTitleDialogFlag=!N.showCloudFileTitleDialogFlag,N.showCloudFileTitleDialog=!0}):gn(P("menu.file.ToSaveYourWorkPleaseSignIn",v))},onCancel:()=>x(!1),okText:P("word.Yes",v),cancelText:P("word.No",v)}):x(!1)},x=N=>{document.body.onfocus=()=>{e(W=>{W.localFileDialogRequested=!1})};const U=document.getElementById("file-dialog");U.onchange=()=>{if(U.files&&U.files.length>0){dt.getState().set(D=>{D.waiting=!0});const W=new FileReader;W.readAsText(U.files[0]);const k=U.files[0].name;dt.getState().set(D=>{D.localFileName=k}),W.onload=()=>{if(W.result){const D=JSON.parse(W.result.toString());N?s&&(e(L=>{L.localContentToImportAfterCloudFileUpdate=D}),dt.getState().setSaveCloudFileFlag(!0)):o(D)}U.value=""}}},U.click()},b=()=>{let N=c.trim();if(N.length>0){N.endsWith(".ala")||(N+=".ala");const U=new Blob([JSON.stringify(n())],{type:"application/json"});return d$e.saveAs(U,N),dt.getState().set(W=>{W.localFileName=N}),e(W=>{W.cloudFile=void 0}),!0}else return co(P("menu.file.SavingAbortedMustHaveValidFileName",v)+"."),!1},R=(N,U)=>{if(C.current){const{clientWidth:W,clientHeight:k}=window.document.documentElement,D=C.current.getBoundingClientRect();S({left:-D.left+U.x,right:W-(D.right-U.x),top:-D.top+U.y,bottom:k-((D==null?void 0:D.bottom)-U.y)})}},H=()=>{p(!0),b()&&dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1}),p(!1)},F=()=>{dt.getState().set(N=>{N.saveLocalFileDialogVisible=!1})},E=()=>{s&&dt.getState().set(N=>{N.localFileName=s,N.localFileName.endsWith(".ala")||(N.localFileName+=".ala")})};return h.jsx(h.Fragment,{children:h.jsx(yi,{title:h.jsx("div",{style:{width:"100%",cursor:"move"},onMouseOver:()=>A(!0),onMouseOut:()=>A(!1),children:P("menu.file.SaveAsLocalFile",v)}),footer:s?[h.jsx(io,{onClick:E,children:P("menu.file.UseCloudFileName",v)},"Apply"),h.jsx(io,{onClick:F,children:P("word.Cancel",v)},"Cancel"),h.jsx(io,{type:"primary",onClick:H,disabled:!c,children:P("word.OK",v)},"OK")]:[h.jsx(io,{onClick:F,children:P("word.Cancel",v)},"Cancel"),h.jsx(io,{type:"primary",onClick:H,disabled:!c,children:P("word.OK",v)},"OK")],open:i,confirmLoading:f,onCancel:F,modalRender:N=>h.jsx(Bi,{disabled:!g,bounds:y,onStart:(U,W)=>R(U,W),children:h.jsx("div",{ref:C,children:N})}),children:h.jsx(jl,{placeholder:"File name",value:c,onPressEnter:H,onChange:N=>{dt.getState().set(U=>{U.localFileName=N.target.value})}})})})}),nYo=()=>{const t=M(nwt),e=M(y=>y.world),n=M(y=>y.elements),o=M(y=>y.viewState),r=M(y=>y.notes),i=dt(hs),a=dt(p3),l=dt(q8t),s=dt($8t),c=M(_7t),u=M(G7t),d=M(J7t),f=M(Z8t),p=new URLSearchParams(window.location.search),g=p.get("viewonly")==="true",A=p.get("map")==="true";return m.useEffect(()=>{c(),u(),d(),f(),dt.getState().set(y=>{y.openModelsMap=A,A&&(y.modelsMapFlag=!0,y.modelsMapWeatherStations=!1,y.leaderboardFlag=!0,y.showLeaderboard=!0)})},[]),m.useEffect(()=>{dt.getState().skipChange?s(!1):dt.getState().changed||l(!0)},[e,o,n,r]),m.useEffect(()=>{i&&dt.getState().set(y=>{y.showSolarRadiationHeatmap=!1}),a&&dt.getState().set(y=>{y.showHeatFluxes=!1})},[n]),h.jsx(fy,{locale:t,children:h.jsxs(qen,{children:[g?h.jsx(YFe,{viewOnly:!0}):h.jsx(oYo,{children:h.jsx(YFe,{viewOnly:!1})}),h.jsx(tYo,{viewOnly:g})]})})},oYo=be.memo(({children:t})=>(["iir3sv1kW1Vzbj9sOA46RfLWKCU2"].find(n=>n===M.getState().user.uid),h.jsx(Qen,{onBeforeunload:()=>"",children:t}))),rYo=rWe(document.getElementById("root"));rYo.render(h.jsx(nYo,{}))});export default iYo(); diff --git a/index.html b/index.html index 72f50a12..aadd1272 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@ } Aladdin - +