diff --git a/docs/assets/index-BDQF4V-l.js b/docs/assets/index-BDQF4V-l.js deleted file mode 100644 index a75f9a8..0000000 --- a/docs/assets/index-BDQF4V-l.js +++ /dev/null @@ -1,66 +0,0 @@ -var vp=Object.defineProperty;var yp=(t,e,n)=>e in t?vp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var re=(t,e,n)=>yp(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();var mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gc={exports:{}},Bl={},Yc={exports:{}},z={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fi=Symbol.for("react.element"),wp=Symbol.for("react.portal"),Sp=Symbol.for("react.fragment"),xp=Symbol.for("react.strict_mode"),Ep=Symbol.for("react.profiler"),Pp=Symbol.for("react.provider"),Tp=Symbol.for("react.context"),kp=Symbol.for("react.forward_ref"),Cp=Symbol.for("react.suspense"),Lp=Symbol.for("react.memo"),Ip=Symbol.for("react.lazy"),va=Symbol.iterator;function Ap(t){return t===null||typeof t!="object"?null:(t=va&&t[va]||t["@@iterator"],typeof t=="function"?t:null)}var qc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Kc=Object.assign,Xc={};function rr(t,e,n){this.props=t,this.context=e,this.refs=Xc,this.updater=n||qc}rr.prototype.isReactComponent={};rr.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};rr.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Zc(){}Zc.prototype=rr.prototype;function Js(t,e,n){this.props=t,this.context=e,this.refs=Xc,this.updater=n||qc}var bs=Js.prototype=new Zc;bs.constructor=Js;Kc(bs,rr.prototype);bs.isPureReactComponent=!0;var ya=Array.isArray,Jc=Object.prototype.hasOwnProperty,eu={current:null},bc={key:!0,ref:!0,__self:!0,__source:!0};function ef(t,e,n){var r,i={},l=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(l=""+e.key),e)Jc.call(e,r)&&!bc.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,oe=C[ee];if(0>>1;eei(ho,M))Xti(ki,ho)?(C[ee]=ki,C[Xt]=M,ee=Xt):(C[ee]=ho,C[Kt]=M,ee=Kt);else if(Xti(ki,M))C[ee]=ki,C[Xt]=M,ee=Xt;else break e}}return N}function i(C,N){var M=C.sortIndex-N.sortIndex;return M!==0?M:C.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var a=[],c=[],f=1,h=null,m=3,v=!1,w=!1,_=!1,I=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(C){for(var N=n(c);N!==null;){if(N.callback===null)r(c);else if(N.startTime<=C)r(c),N.sortIndex=N.expirationTime,e(a,N);else break;N=n(c)}}function y(C){if(_=!1,p(C),!w)if(n(a)!==null)w=!0,co(x);else{var N=n(c);N!==null&&fo(y,N.startTime-C)}}function x(C,N){w=!1,_&&(_=!1,g(L),L=-1),v=!0;var M=m;try{for(p(N),h=n(a);h!==null&&(!(h.expirationTime>N)||C&&!Ne());){var ee=h.callback;if(typeof ee=="function"){h.callback=null,m=h.priorityLevel;var oe=ee(h.expirationTime<=N);N=t.unstable_now(),typeof oe=="function"?h.callback=oe:h===n(a)&&r(a),p(N)}else r(a);h=n(a)}if(h!==null)var Ti=!0;else{var Kt=n(c);Kt!==null&&fo(y,Kt.startTime-N),Ti=!1}return Ti}finally{h=null,m=M,v=!1}}var P=!1,k=null,L=-1,D=5,A=-1;function Ne(){return!(t.unstable_now()-AC||125ee?(C.sortIndex=M,e(c,C),n(a)===null&&C===n(c)&&(_?(g(L),L=-1):_=!0,fo(y,M-ee))):(C.sortIndex=oe,e(a,C),w||v||(w=!0,co(x))),C},t.unstable_shouldYield=Ne,t.unstable_wrapCallback=function(C){var N=m;return function(){var M=m;m=N;try{return C.apply(this,arguments)}finally{m=M}}}})(of);lf.exports=of;var $p=lf.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Hp=O,Re=$p;function S(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qo=Object.prototype.hasOwnProperty,Wp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wa={},Sa={};function Qp(t){return Qo.call(Sa,t)?!0:Qo.call(wa,t)?!1:Wp.test(t)?Sa[t]=!0:(wa[t]=!0,!1)}function Gp(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Yp(t,e,n,r){if(e===null||typeof e>"u"||Gp(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Pe(t,e,n,r,i,l,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=l,this.removeEmptyString=o}var pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){pe[t]=new Pe(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];pe[e]=new Pe(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){pe[t]=new Pe(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){pe[t]=new Pe(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){pe[t]=new Pe(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){pe[t]=new Pe(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){pe[t]=new Pe(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){pe[t]=new Pe(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){pe[t]=new Pe(t,5,!1,t.toLowerCase(),null,!1,!1)});var nu=/[\-:]([a-z])/g;function ru(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(nu,ru);pe[e]=new Pe(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(nu,ru);pe[e]=new Pe(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(nu,ru);pe[e]=new Pe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){pe[t]=new Pe(t,1,!1,t.toLowerCase(),null,!1,!1)});pe.xlinkHref=new Pe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){pe[t]=new Pe(t,1,!1,t.toLowerCase(),null,!0,!0)});function iu(t,e,n,r){var i=pe.hasOwnProperty(e)?pe[e]:null;(i!==null?i.type!==0:r||!(2u||i[o]!==l[u]){var a=` -`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=u);break}}}finally{mo=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?kr(t):""}function qp(t){switch(t.tag){case 5:return kr(t.type);case 16:return kr("Lazy");case 13:return kr("Suspense");case 19:return kr("SuspenseList");case 0:case 2:case 15:return t=vo(t.type,!1),t;case 11:return t=vo(t.type.render,!1),t;case 1:return t=vo(t.type,!0),t;default:return""}}function Ko(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 En:return"Fragment";case xn:return"Portal";case Go:return"Profiler";case lu:return"StrictMode";case Yo:return"Suspense";case qo:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case af:return(t.displayName||"Context")+".Consumer";case uf:return(t._context.displayName||"Context")+".Provider";case ou:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case su:return e=t.displayName||null,e!==null?e:Ko(t.type)||"Memo";case Pt:e=t._payload,t=t._init;try{return Ko(t(e))}catch{}}return null}function Kp(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 Ko(e);case 8:return e===lu?"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 Vt(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ff(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Xp(t){var e=ff(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,l.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ii(t){t._valueTracker||(t._valueTracker=Xp(t))}function df(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=ff(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ul(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 Xo(t,e){var n=e.checked;return J({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Ea(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Vt(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function hf(t,e){e=e.checked,e!=null&&iu(t,"checked",e,!1)}function Zo(t,e){hf(t,e);var n=Vt(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Jo(t,e.type,n):e.hasOwnProperty("defaultValue")&&Jo(t,e.type,Vt(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Pa(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="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 Jo(t,e,n){(e!=="number"||ul(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Cr=Array.isArray;function Un(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ai.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Qr(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Or={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},Zp=["Webkit","ms","Moz","O"];Object.keys(Or).forEach(function(t){Zp.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Or[e]=Or[t]})});function vf(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Or.hasOwnProperty(t)&&Or[t]?(""+e).trim():e+"px"}function yf(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=vf(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var Jp=J({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 ts(t,e){if(e){if(Jp[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(S(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(S(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(S(61))}if(e.style!=null&&typeof e.style!="object")throw Error(S(62))}}function ns(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 rs=null;function uu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var is=null,Dn=null,Fn=null;function Ca(t){if(t=pi(t)){if(typeof is!="function")throw Error(S(280));var e=t.stateNode;e&&(e=Wl(e),is(t.stateNode,t.type,e))}}function _f(t){Dn?Fn?Fn.push(t):Fn=[t]:Dn=t}function wf(){if(Dn){var t=Dn,e=Fn;if(Fn=Dn=null,Ca(t),e)for(t=0;t>>=0,t===0?32:31-(ag(t)/cg|0)|0}var Ni=64,Oi=4194304;function Lr(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 dl(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,l=t.pingedLanes,o=n&268435455;if(o!==0){var u=o&~i;u!==0?r=Lr(u):(l&=o,l!==0&&(r=Lr(l)))}else o=n&~i,o!==0?r=Lr(o):l!==0&&(r=Lr(l));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,l=e&-e,i>=l||i===16&&(l&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function di(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xe(e),t[e]=n}function pg(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 r=t.eventTimes;for(t=t.expirationTimes;0=zr),Ua=" ",Da=!1;function jf(t,e){switch(t){case"keyup":return $g.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Pn=!1;function Wg(t,e){switch(t){case"compositionend":return Vf(e);case"keypress":return e.which!==32?null:(Da=!0,Ua);case"textInput":return t=e.data,t===Ua&&Da?null:t;default:return null}}function Qg(t,e){if(Pn)return t==="compositionend"||!mu&&jf(t,e)?(t=Ff(),Zi=hu=At=null,Pn=!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=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Va(n)}}function Qf(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Qf(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Gf(){for(var t=window,e=ul();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ul(t.document)}return e}function vu(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 em(t){var e=Gf(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Qf(n.ownerDocument.documentElement,n)){if(r!==null&&vu(n)){if(e=r.start,t=r.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 i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!t.extend&&l>r&&(i=r,r=l,l=i),i=$a(n,l);var o=$a(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),l>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.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,Tn=null,cs=null,Ur=null,fs=!1;function Ha(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fs||Tn==null||Tn!==ul(r)||(r=Tn,"selectionStart"in r&&vu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ur&&Zr(Ur,r)||(Ur=r,r=gl(cs,"onSelect"),0Ln||(t.current=vs[Ln],vs[Ln]=null,Ln--)}function Q(t,e){Ln++,vs[Ln]=t.current,t.current=e}var $t={},_e=Gt($t),Le=Gt(!1),sn=$t;function Qn(t,e){var n=t.type.contextTypes;if(!n)return $t;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=e[l];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Ie(t){return t=t.childContextTypes,t!=null}function vl(){q(Le),q(_e)}function Xa(t,e,n){if(_e.current!==$t)throw Error(S(168));Q(_e,e),Q(Le,n)}function td(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(S(108,Kp(t)||"Unknown",i));return J({},n,r)}function yl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||$t,sn=_e.current,Q(_e,t),Q(Le,Le.current),!0}function Za(t,e,n){var r=t.stateNode;if(!r)throw Error(S(169));n?(t=td(t,e,sn),r.__reactInternalMemoizedMergedChildContext=t,q(Le),q(_e),Q(_e,t)):q(Le),Q(Le,n)}var pt=null,Ql=!1,No=!1;function nd(t){pt===null?pt=[t]:pt.push(t)}function dm(t){Ql=!0,nd(t)}function Yt(){if(!No&&pt!==null){No=!0;var t=0,e=$;try{var n=pt;for($=1;t>=o,i-=o,gt=1<<32-Xe(e)+i|n<L?(D=k,k=null):D=k.sibling;var A=m(g,k,p[L],y);if(A===null){k===null&&(k=D);break}t&&k&&A.alternate===null&&e(g,k),d=l(A,d,L),P===null?x=A:P.sibling=A,P=A,k=D}if(L===p.length)return n(g,k),K&&Jt(g,L),x;if(k===null){for(;LL?(D=k,k=null):D=k.sibling;var Ne=m(g,k,A.value,y);if(Ne===null){k===null&&(k=D);break}t&&k&&Ne.alternate===null&&e(g,k),d=l(Ne,d,L),P===null?x=Ne:P.sibling=Ne,P=Ne,k=D}if(A.done)return n(g,k),K&&Jt(g,L),x;if(k===null){for(;!A.done;L++,A=p.next())A=h(g,A.value,y),A!==null&&(d=l(A,d,L),P===null?x=A:P.sibling=A,P=A);return K&&Jt(g,L),x}for(k=r(g,k);!A.done;L++,A=p.next())A=v(k,g,L,A.value,y),A!==null&&(t&&A.alternate!==null&&k.delete(A.key===null?L:A.key),d=l(A,d,L),P===null?x=A:P.sibling=A,P=A);return t&&k.forEach(function(pr){return e(g,pr)}),K&&Jt(g,L),x}function I(g,d,p,y){if(typeof p=="object"&&p!==null&&p.type===En&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Li:e:{for(var x=p.key,P=d;P!==null;){if(P.key===x){if(x=p.type,x===En){if(P.tag===7){n(g,P.sibling),d=i(P,p.props.children),d.return=g,g=d;break e}}else if(P.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Pt&&ec(x)===P.type){n(g,P.sibling),d=i(P,p.props),d.ref=xr(g,P,p),d.return=g,g=d;break e}n(g,P);break}else e(g,P);P=P.sibling}p.type===En?(d=ln(p.props.children,g.mode,y,p.key),d.return=g,g=d):(y=ll(p.type,p.key,p.props,null,g.mode,y),y.ref=xr(g,d,p),y.return=g,g=y)}return o(g);case xn:e:{for(P=p.key;d!==null;){if(d.key===P)if(d.tag===4&&d.stateNode.containerInfo===p.containerInfo&&d.stateNode.implementation===p.implementation){n(g,d.sibling),d=i(d,p.children||[]),d.return=g,g=d;break e}else{n(g,d);break}else e(g,d);d=d.sibling}d=Bo(p,g.mode,y),d.return=g,g=d}return o(g);case Pt:return P=p._init,I(g,d,P(p._payload),y)}if(Cr(p))return w(g,d,p,y);if(vr(p))return _(g,d,p,y);Bi(g,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,d!==null&&d.tag===6?(n(g,d.sibling),d=i(d,p),d.return=g,g=d):(n(g,d),d=Fo(p,g.mode,y),d.return=g,g=d),o(g)):n(g,d)}return I}var Yn=od(!0),sd=od(!1),Sl=Gt(null),xl=null,Nn=null,Su=null;function xu(){Su=Nn=xl=null}function Eu(t){var e=Sl.current;q(Sl),t._currentValue=e}function ws(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function jn(t,e){xl=t,Su=Nn=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ce=!0),t.firstContext=null)}function He(t){var e=t._currentValue;if(Su!==t)if(t={context:t,memoizedValue:e,next:null},Nn===null){if(xl===null)throw Error(S(308));Nn=t,xl.dependencies={lanes:0,firstContext:t}}else Nn=Nn.next=t;return e}var tn=null;function Pu(t){tn===null?tn=[t]:tn.push(t)}function ud(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Pu(e)):(n.next=i.next,i.next=n),e.interleaved=n,wt(t,r)}function wt(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Tt=!1;function Tu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ad(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function vt(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ut(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,U&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,wt(t,n)}return i=r.interleaved,i===null?(e.next=e,Pu(r)):(e.next=i.next,i.next=e),r.interleaved=e,wt(t,n)}function bi(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,cu(t,n)}}function tc(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=o:l=l.next=o,n=n.next}while(n!==null);l===null?i=l=e:l=l.next=e}else i=l=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function El(t,e,n,r){var i=t.updateQueue;Tt=!1;var l=i.firstBaseUpdate,o=i.lastBaseUpdate,u=i.shared.pending;if(u!==null){i.shared.pending=null;var a=u,c=a.next;a.next=null,o===null?l=c:o.next=c,o=a;var f=t.alternate;f!==null&&(f=f.updateQueue,u=f.lastBaseUpdate,u!==o&&(u===null?f.firstBaseUpdate=c:u.next=c,f.lastBaseUpdate=a))}if(l!==null){var h=i.baseState;o=0,f=c=a=null,u=l;do{var m=u.lane,v=u.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:v,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var w=t,_=u;switch(m=e,v=n,_.tag){case 1:if(w=_.payload,typeof w=="function"){h=w.call(v,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=_.payload,m=typeof w=="function"?w.call(v,h,m):w,m==null)break e;h=J({},h,m);break e;case 2:Tt=!0}}u.callback!==null&&u.lane!==0&&(t.flags|=64,m=i.effects,m===null?i.effects=[u]:m.push(u))}else v={eventTime:v,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},f===null?(c=f=v,a=h):f=f.next=v,o|=m;if(u=u.next,u===null){if(u=i.shared.pending,u===null)break;m=u,u=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(f===null&&(a=h),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else l===null&&(i.shared.lanes=0);cn|=o,t.lanes=o,t.memoizedState=h}}function nc(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Mo.transition;Mo.transition={};try{t(!1),e()}finally{$=n,Mo.transition=r}}function kd(){return We().memoizedState}function mm(t,e,n){var r=Ft(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Cd(t))Ld(e,n);else if(n=ud(t,e,n,r),n!==null){var i=Se();Ze(n,t,r,i),Id(n,e,r)}}function vm(t,e,n){var r=Ft(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cd(t))Ld(e,i);else{var l=t.alternate;if(t.lanes===0&&(l===null||l.lanes===0)&&(l=e.lastRenderedReducer,l!==null))try{var o=e.lastRenderedState,u=l(o,n);if(i.hasEagerState=!0,i.eagerState=u,Je(u,o)){var a=e.interleaved;a===null?(i.next=i,Pu(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=ud(t,e,i,r),n!==null&&(i=Se(),Ze(n,t,r,i),Id(n,e,r))}}function Cd(t){var e=t.alternate;return t===Z||e!==null&&e===Z}function Ld(t,e){Dr=Tl=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Id(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,cu(t,n)}}var kl={readContext:He,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useInsertionEffect:ge,useLayoutEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useMutableSource:ge,useSyncExternalStore:ge,useId:ge,unstable_isNewReconciler:!1},ym={readContext:He,useCallback:function(t,e){return tt().memoizedState=[t,e===void 0?null:e],t},useContext:He,useEffect:ic,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,tl(4194308,4,Sd.bind(null,e,t),n)},useLayoutEffect:function(t,e){return tl(4194308,4,t,e)},useInsertionEffect:function(t,e){return tl(4,2,t,e)},useMemo:function(t,e){var n=tt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=tt();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=mm.bind(null,Z,t),[r.memoizedState,t]},useRef:function(t){var e=tt();return t={current:t},e.memoizedState=t},useState:rc,useDebugValue:Mu,useDeferredValue:function(t){return tt().memoizedState=t},useTransition:function(){var t=rc(!1),e=t[0];return t=gm.bind(null,t[1]),tt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Z,i=tt();if(K){if(n===void 0)throw Error(S(407));n=n()}else{if(n=e(),ae===null)throw Error(S(349));an&30||hd(r,e,n)}i.memoizedState=n;var l={value:n,getSnapshot:e};return i.queue=l,ic(gd.bind(null,r,l,t),[t]),r.flags|=2048,li(9,pd.bind(null,r,l,n,e),void 0,null),n},useId:function(){var t=tt(),e=ae.identifierPrefix;if(K){var n=mt,r=gt;n=(r&~(1<<32-Xe(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ri++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[it]=e,t[ei]=r,Bd(t,e,!1,!1),e.stateNode=t;e:{switch(o=ns(n,r),n){case"dialog":G("cancel",t),G("close",t),i=r;break;case"iframe":case"object":case"embed":G("load",t),i=r;break;case"video":case"audio":for(i=0;iXn&&(e.flags|=128,r=!0,Er(l,!1),e.lanes=4194304)}else{if(!r)if(t=Pl(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Er(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!K)return me(e),null}else 2*te()-l.renderingStartTime>Xn&&n!==1073741824&&(e.flags|=128,r=!0,Er(l,!1),e.lanes=4194304);l.isBackwards?(o.sibling=e.child,e.child=o):(n=l.last,n!==null?n.sibling=o:e.child=o,l.last=o)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=te(),e.sibling=null,n=X.current,Q(X,r?n&1|2:n&1),e):(me(e),null);case 22:case 23:return Bu(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Oe&1073741824&&(me(e),e.subtreeFlags&6&&(e.flags|=8192)):me(e),null;case 24:return null;case 25:return null}throw Error(S(156,e.tag))}function km(t,e){switch(_u(e),e.tag){case 1:return Ie(e.type)&&vl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return qn(),q(Le),q(_e),Lu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Cu(e),null;case 13:if(q(X),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(S(340));Gn()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return q(X),null;case 4:return qn(),null;case 10:return Eu(e.type._context),null;case 22:case 23:return Bu(),null;case 24:return null;default:return null}}var Vi=!1,ye=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,T=null;function On(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){b(t,e,r)}else n.current=null}function Is(t,e,n){try{n()}catch(r){b(t,e,r)}}var gc=!1;function Lm(t,e){if(ds=hl,t=Gf(),vu(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var o=0,u=-1,a=-1,c=0,f=0,h=t,m=null;t:for(;;){for(var v;h!==n||i!==0&&h.nodeType!==3||(u=o+i),h!==l||r!==0&&h.nodeType!==3||(a=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)m=h,h=v;for(;;){if(h===t)break t;if(m===n&&++c===i&&(u=o),m===l&&++f===r&&(a=o),(v=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=v}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(hs={focusedElem:t,selectionRange:n},hl=!1,T=e;T!==null;)if(e=T,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,T=t;else for(;T!==null;){e=T;try{var w=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var _=w.memoizedProps,I=w.memoizedState,g=e.stateNode,d=g.getSnapshotBeforeUpdate(e.elementType===e.type?_:Ge(e.type,_),I);g.__reactInternalSnapshotBeforeUpdate=d}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(S(163))}}catch(y){b(e,e.return,y)}if(t=e.sibling,t!==null){t.return=e.return,T=t;break}T=e.return}return w=gc,gc=!1,w}function Fr(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var l=i.destroy;i.destroy=void 0,l!==void 0&&Is(e,n,l)}i=i.next}while(i!==r)}}function ql(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 r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function As(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 $d(t){var e=t.alternate;e!==null&&(t.alternate=null,$d(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[it],delete e[ei],delete e[ms],delete e[cm],delete e[fm])),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 Hd(t){return t.tag===5||t.tag===3||t.tag===4}function mc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Hd(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 Ns(t,e,n){var r=t.tag;if(r===5||r===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=ml));else if(r!==4&&(t=t.child,t!==null))for(Ns(t,e,n),t=t.sibling;t!==null;)Ns(t,e,n),t=t.sibling}function Os(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Os(t,e,n),t=t.sibling;t!==null;)Os(t,e,n),t=t.sibling}var fe=null,Ye=!1;function Et(t,e,n){for(n=n.child;n!==null;)Wd(t,e,n),n=n.sibling}function Wd(t,e,n){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(jl,n)}catch{}switch(n.tag){case 5:ye||On(n,e);case 6:var r=fe,i=Ye;fe=null,Et(t,e,n),fe=r,Ye=i,fe!==null&&(Ye?(t=fe,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):fe.removeChild(n.stateNode));break;case 18:fe!==null&&(Ye?(t=fe,n=n.stateNode,t.nodeType===8?Ao(t.parentNode,n):t.nodeType===1&&Ao(t,n),Kr(t)):Ao(fe,n.stateNode));break;case 4:r=fe,i=Ye,fe=n.stateNode.containerInfo,Ye=!0,Et(t,e,n),fe=r,Ye=i;break;case 0:case 11:case 14:case 15:if(!ye&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,o=l.destroy;l=l.tag,o!==void 0&&(l&2||l&4)&&Is(n,e,o),i=i.next}while(i!==r)}Et(t,e,n);break;case 1:if(!ye&&(On(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){b(n,e,u)}Et(t,e,n);break;case 21:Et(t,e,n);break;case 22:n.mode&1?(ye=(r=ye)||n.memoizedState!==null,Et(t,e,n),ye=r):Et(t,e,n);break;default:Et(t,e,n)}}function vc(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Cm),e.forEach(function(r){var i=Dm.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Qe(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~l}if(r=i,r=te()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Am(r/1960))-r,10t?16:t,Nt===null)var r=!1;else{if(t=Nt,Nt=null,Il=0,U&6)throw Error(S(331));var i=U;for(U|=4,T=t.current;T!==null;){var l=T,o=l.child;if(T.flags&16){var u=l.deletions;if(u!==null){for(var a=0;ate()-Du?rn(t,0):Uu|=n),Ae(t,e)}function Jd(t,e){e===0&&(t.mode&1?(e=Oi,Oi<<=1,!(Oi&130023424)&&(Oi=4194304)):e=1);var n=Se();t=wt(t,e),t!==null&&(di(t,e,n),Ae(t,n))}function Um(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Jd(t,n)}function Dm(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(S(314))}r!==null&&r.delete(e),Jd(t,n)}var bd;bd=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Le.current)Ce=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ce=!1,Pm(t,e,n);Ce=!!(t.flags&131072)}else Ce=!1,K&&e.flags&1048576&&rd(e,wl,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;nl(t,e),t=e.pendingProps;var i=Qn(e,_e.current);jn(e,n),i=Au(null,e,r,t,i,n);var l=Nu();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ie(r)?(l=!0,yl(e)):l=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Tu(e),i.updater=Yl,e.stateNode=i,i._reactInternals=e,xs(e,r,t,n),e=Ts(null,e,r,!0,l,n)):(e.tag=0,K&&l&&yu(e),we(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(nl(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Bm(r),t=Ge(r,t),i){case 0:e=Ps(null,e,r,t,n);break e;case 1:e=dc(null,e,r,t,n);break e;case 11:e=cc(null,e,r,t,n);break e;case 14:e=fc(null,e,r,Ge(r.type,t),n);break e}throw Error(S(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ge(r,i),Ps(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ge(r,i),dc(t,e,r,i,n);case 3:e:{if(Ud(e),t===null)throw Error(S(387));r=e.pendingProps,l=e.memoizedState,i=l.element,ad(t,e),El(e,r,null,n);var o=e.memoizedState;if(r=o.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=l,e.memoizedState=l,e.flags&256){i=Kn(Error(S(423)),e),e=hc(t,e,r,n,i);break e}else if(r!==i){i=Kn(Error(S(424)),e),e=hc(t,e,r,n,i);break e}else for(Me=Rt(e.stateNode.containerInfo.firstChild),ze=e,K=!0,qe=null,n=sd(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gn(),r===i){e=St(t,e,n);break e}we(t,e,r,n)}e=e.child}return e;case 5:return cd(e),t===null&&_s(e),r=e.type,i=e.pendingProps,l=t!==null?t.memoizedProps:null,o=i.children,ps(r,i)?o=null:l!==null&&ps(r,l)&&(e.flags|=32),Rd(t,e),we(t,e,o,n),e.child;case 6:return t===null&&_s(e),null;case 13:return Dd(t,e,n);case 4:return ku(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Yn(e,null,r,n):we(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ge(r,i),cc(t,e,r,i,n);case 7:return we(t,e,e.pendingProps,n),e.child;case 8:return we(t,e,e.pendingProps.children,n),e.child;case 12:return we(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,l=e.memoizedProps,o=i.value,Q(Sl,r._currentValue),r._currentValue=o,l!==null)if(Je(l.value,o)){if(l.children===i.children&&!Le.current){e=St(t,e,n);break e}}else for(l=e.child,l!==null&&(l.return=e);l!==null;){var u=l.dependencies;if(u!==null){o=l.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(l.tag===1){a=vt(-1,n&-n),a.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?a.next=a:(a.next=f.next,f.next=a),c.pending=a}}l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),ws(l.return,n,e),u.lanes|=n;break}a=a.next}}else if(l.tag===10)o=l.type===e.type?null:l.child;else if(l.tag===18){if(o=l.return,o===null)throw Error(S(341));o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),ws(o,n,e),o=l.sibling}else o=l.child;if(o!==null)o.return=l;else for(o=l;o!==null;){if(o===e){o=null;break}if(l=o.sibling,l!==null){l.return=o.return,o=l;break}o=o.return}l=o}we(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,jn(e,n),i=He(i),r=r(i),e.flags|=1,we(t,e,r,n),e.child;case 14:return r=e.type,i=Ge(r,e.pendingProps),i=Ge(r.type,i),fc(t,e,r,i,n);case 15:return Md(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ge(r,i),nl(t,e),e.tag=1,Ie(r)?(t=!0,yl(e)):t=!1,jn(e,n),Ad(e,r,i),xs(e,r,i,n),Ts(null,e,r,!0,t,n);case 19:return Fd(t,e,n);case 22:return zd(t,e,n)}throw Error(S(156,e.tag))};function eh(t,e){return Cf(t,e)}function Fm(t,e,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ve(t,e,n,r){return new Fm(t,e,n,r)}function Vu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Bm(t){if(typeof t=="function")return Vu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ou)return 11;if(t===su)return 14}return 2}function Bt(t,e){var n=t.alternate;return n===null?(n=Ve(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 ll(t,e,n,r,i,l){var o=2;if(r=t,typeof t=="function")Vu(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case En:return ln(n.children,i,l,e);case lu:o=8,i|=8;break;case Go:return t=Ve(12,n,e,i|2),t.elementType=Go,t.lanes=l,t;case Yo:return t=Ve(13,n,e,i),t.elementType=Yo,t.lanes=l,t;case qo:return t=Ve(19,n,e,i),t.elementType=qo,t.lanes=l,t;case cf:return Xl(n,i,l,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case uf:o=10;break e;case af:o=9;break e;case ou:o=11;break e;case su:o=14;break e;case Pt:o=16,r=null;break e}throw Error(S(130,t==null?t:typeof t,""))}return e=Ve(o,n,e,i),e.elementType=t,e.type=r,e.lanes=l,e}function ln(t,e,n,r){return t=Ve(7,t,r,e),t.lanes=n,t}function Xl(t,e,n,r){return t=Ve(22,t,r,e),t.elementType=cf,t.lanes=n,t.stateNode={isHidden:!1},t}function Fo(t,e,n){return t=Ve(6,t,null,e),t.lanes=n,t}function Bo(t,e,n){return e=Ve(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function jm(t,e,n,r,i){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=_o(0),this.expirationTimes=_o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_o(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function $u(t,e,n,r,i,l,o,u,a){return t=new jm(t,e,n,u,a),e===1?(e=1,l===!0&&(e|=8)):e=0,l=Ve(3,null,null,e),t.current=l,l.stateNode=t,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tu(l),t}function Vm(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ih)}catch(t){console.error(t)}}ih(),rf.exports=Ue;var Gm=rf.exports,Tc=Gm;Wo.createRoot=Tc.createRoot,Wo.hydrateRoot=Tc.hydrateRoot;const Ym=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M2 2l11 11M1.5 2.5a1 1 0 110-2 1 1 0 010 2zm12 12a1 1 0 110-2 1 1 0 010 2z",stroke:"currentColor"})),qm=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M13.5.5h-12a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-12a1 1 0 00-1-1z",stroke:"currentColor"})),Km=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M.5 7.5a7 7 0 1014 0 7 7 0 00-14 0z",stroke:"currentColor"})),Xm=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M.5.5l6 14 2-6 6-2-14-6z",stroke:"currentColor",strokeLinejoin:"round"})),Zm=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M13.5 3.5h.5v-.207l-.146-.147-.354.354zm-3-3l.354-.354L10.707 0H10.5v.5zm-7 4V4H3v.5h.5zm2 0H6V4h-.5v.5zm0 2V7H6v-.5h-.5zm-2 0H3V7h.5v-.5zm8-2h.5V4h-.5v.5zm0 2V7h.5v-.5h-.5zm-2 0H9V7h.5v-.5zm0-2V4H9v.5h.5zm-6 6V10H3v.5h.5zm2 0H6V10h-.5v.5zm0 2v.5H6v-.5h-.5zm-2 0H3v.5h.5v-.5zm6-2V10H9v.5h.5zm0 2H9v.5h.5v-.5zm2 0v.5h.5v-.5h-.5zm0-2h.5V10h-.5v.5zm1 3.5h-10v1h10v-1zM2 13.5v-12H1v12h1zm11-10v10h1v-10h-1zM2.5 1h8V0h-8v1zm7.646-.146l3 3 .708-.708-3-3-.708.708zM2.5 14a.5.5 0 01-.5-.5H1A1.5 1.5 0 002.5 15v-1zm10 1a1.5 1.5 0 001.5-1.5h-1a.5.5 0 01-.5.5v1zM2 1.5a.5.5 0 01.5-.5V0A1.5 1.5 0 001 1.5h1zM3.5 5h2V4h-2v1zM5 4.5v2h1v-2H5zM5.5 6h-2v1h2V6zM4 6.5v-2H3v2h1zm7-2v2h1v-2h-1zm.5 1.5h-2v1h2V6zm-1.5.5v-2H9v2h1zM9.5 5h2V4h-2v1zm-6 6h2v-1h-2v1zm1.5-.5v2h1v-2H5zm.5 1.5h-2v1h2v-1zm-1.5.5v-2H3v2h1zm5-2v2h1v-2H9zm.5 2.5h2v-1h-2v1zm2.5-.5v-2h-1v2h1zm-.5-2.5h-2v1h2v-1zm-6-4h4V5h-4v1zM4 6.5v4h1v-4H4zm6 0v4h1v-4h-1zM5.5 12h4v-1h-4v1z",fill:"currentColor"})),Jm=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M4.5 4.5v-3a1 1 0 011-1h8a1 1 0 011 1v8a1 1 0 01-1 1h-3m-6-6h-3a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1v-3m-6-6V7m0-2.5H7m3.5 6H8m2.5 0V8M8 4.5h2.5V7m-6 1v2.5H7",stroke:"currentColor"})),bm=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M13.5 3.5h.5v-.207l-.146-.147-.354.354zm-3-3l.354-.354L10.707 0H10.5v.5zm-8 6V6H2v.5h.5zm0 2H2V9h.5v-.5zm2 0H5V8h-.5v.5zm0 2v.5H5v-.5h-.5zm2-1H6v.207l.146.147L6.5 9.5zm1 1l-.354.354.354.353.354-.353L7.5 10.5zm1-1l.354.354L9 9.707V9.5h-.5zm2-3V6H10v.5h.5zm0 4H10v.5h.5v-.5zm2 0v.5h.5v-.5h-.5zM2 5V1.5H1V5h1zm11-1.5V5h1V3.5h-1zM2.5 1h8V0h-8v1zm7.646-.146l3 3 .708-.708-3-3-.708.708zM2 1.5a.5.5 0 01.5-.5V0A1.5 1.5 0 001 1.5h1zM1 12v1.5h1V12H1zm1.5 3h10v-1h-10v1zM14 13.5V12h-1v1.5h1zM12.5 15a1.5 1.5 0 001.5-1.5h-1a.5.5 0 01-.5.5v1zM1 13.5A1.5 1.5 0 002.5 15v-1a.5.5 0 01-.5-.5H1zM5 6H2.5v1H5V6zm-3 .5v2h1v-2H2zM2.5 9h2V8h-2v1zM4 8.5v2h1v-2H4zm.5 1.5H2v1h2.5v-1zM6 6v3.5h1V6H6zm.146 3.854l1 1 .708-.708-1-1-.708.708zm1.708 1l1-1-.708-.708-1 1 .708.708zM9 9.5V6H8v3.5h1zM13 6h-2.5v1H13V6zm-3 .5v4h1v-4h-1zm.5 4.5h2v-1h-2v1zm2.5-.5v-2h-1v2h1z",fill:"currentColor"})),e0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M7.5 12L0 4h15l-7.5 8z",fill:"currentColor"})),t0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M7.5 3l7.5 8H0l7.5-8z",fill:"currentColor"})),n0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M7.5 4.793L3.293 9h8.414L7.5 4.793z",fill:"currentColor"})),r0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M7.5 10.207L11.707 6H3.293L7.5 10.207z",fill:"currentColor"})),i0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M6.5 2.499l-.354-.354-.353.354.353.353L6.5 2.5zm1-.5H7v1h.5v-1zM2 8.495v-.5H1v.5h1zM8.145.146l-1.999 2 .708.706L8.853.854 8.145.146zM6.146 2.852l2 1.999.707-.707-2-1.999-.707.707zM7.5 3C10.537 3 13 5.461 13 8.496h1A6.499 6.499 0 007.5 2v1zM13 8.495a5.499 5.499 0 01-5.5 5.496v1c3.589 0 6.5-2.909 6.5-6.496h-1zM7.5 13.99A5.499 5.499 0 012 8.495H1a6.499 6.499 0 006.5 6.496v-1z",fill:"currentColor"})),l0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M14 8.495v-.5h-1v.5h1zM7.5 2.999H8v-1h-.5v1zm1-.5l.353.353.354-.353-.354-.354-.353.354zM13 8.495a5.499 5.499 0 01-5.5 5.496v1c3.589 0 6.5-2.909 6.5-6.496h-1zM7.5 13.99A5.499 5.499 0 012 8.495H1a6.499 6.499 0 006.5 6.496v-1zM2 8.495a5.499 5.499 0 015.5-5.496v-1A6.499 6.499 0 001 8.495h1zM6.147.854l2 1.998.706-.707-2-1.999-.706.708zm2 1.291l-2 1.999.706.707 2-1.999-.706-.707z",fill:"currentColor"})),o0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M5.65 12.477a.5.5 0 10-.3-.954l.3.954zm-3.648-2.96l-.484-.128-.254.968.484.127.254-.968zM9 14.5v.5h1v-.5H9zm.063-4.813l-.054-.497a.5.5 0 00-.299.852l.352-.354zM12.5 5.913h.5V5.91l-.5.002zm-.833-2.007l-.466-.18a.5.5 0 00.112.533l.354-.353zm-.05-2.017l.456-.204a.5.5 0 00-.319-.276l-.137.48zm-2.173.792l-.126.484a.5.5 0 00.398-.064l-.272-.42zm-3.888 0l-.272.42a.5.5 0 00.398.064l-.126-.484zM3.383 1.89l-.137-.48a.5.5 0 00-.32.276l.457.204zm-.05 2.017l.354.353a.5.5 0 00.112-.534l-.466.181zM2.5 5.93H3v-.002l-.5.002zm3.438 3.758l.352.355a.5.5 0 00-.293-.851l-.06.496zM5.5 11H6l-.001-.037L5.5 11zM5 14.5v.5h1v-.5H5zm.35-2.977c-.603.19-.986.169-1.24.085-.251-.083-.444-.25-.629-.49a4.8 4.8 0 01-.27-.402c-.085-.139-.182-.302-.28-.447-.191-.281-.473-.633-.929-.753l-.254.968c.08.02.184.095.355.346.082.122.16.252.258.412.094.152.202.32.327.484.253.33.598.663 1.11.832.51.168 1.116.15 1.852-.081l-.3-.954zm4.65-.585c0-.318-.014-.608-.104-.878-.096-.288-.262-.51-.481-.727l-.705.71c.155.153.208.245.237.333.035.105.053.254.053.562h1zm-.884-.753c.903-.097 1.888-.325 2.647-.982.78-.675 1.237-1.729 1.237-3.29h-1c0 1.359-.39 2.1-.892 2.534-.524.454-1.258.653-2.099.743l.107.995zM13 5.91a3.354 3.354 0 00-.98-2.358l-.707.706c.438.44.685 1.034.687 1.655l1-.003zm-.867-1.824c.15-.384.22-.794.21-1.207l-1 .025a2.12 2.12 0 01-.142.82l.932.362zm.21-1.207a3.119 3.119 0 00-.27-1.195l-.913.408c.115.256.177.532.184.812l1-.025zm-.726-.99c.137-.481.137-.482.136-.482h-.003l-.004-.002a.462.462 0 00-.03-.007 1.261 1.261 0 00-.212-.024 2.172 2.172 0 00-.51.054c-.425.091-1.024.317-1.82.832l.542.84c.719-.464 1.206-.634 1.488-.694a1.2 1.2 0 01.306-.03l-.008-.001a.278.278 0 01-.01-.002l-.006-.002h-.003l-.002-.001c-.001 0-.002 0 .136-.482zm-2.047.307a8.209 8.209 0 00-4.14 0l.252.968a7.209 7.209 0 013.636 0l.252-.968zm-3.743.064c-.797-.514-1.397-.74-1.822-.83a2.17 2.17 0 00-.51-.053 1.259 1.259 0 00-.241.03l-.004.002h-.003l.136.481.137.481h-.001l-.002.001-.003.001a.327.327 0 01-.016.004l-.008.001h.008a1.19 1.19 0 01.298.03c.282.06.769.23 1.488.694l.543-.84zm-2.9-.576a3.12 3.12 0 00-.27 1.195l1 .025a2.09 2.09 0 01.183-.812l-.913-.408zm-.27 1.195c-.01.413.06.823.21 1.207l.932-.362a2.12 2.12 0 01-.143-.82l-1-.025zm.322.673a3.354 3.354 0 00-.726 1.091l.924.38c.118-.285.292-.545.51-.765l-.708-.706zm-.726 1.091A3.354 3.354 0 002 5.93l1-.003c0-.31.06-.616.177-.902l-.924-.38zM2 5.93c0 1.553.458 2.597 1.239 3.268.757.65 1.74.88 2.64.987l.118-.993C5.15 9.09 4.416 8.89 3.89 8.438 3.388 8.007 3 7.276 3 5.928H2zm3.585 3.404c-.5.498-.629 1.09-.584 1.704L6 10.963c-.03-.408.052-.683.291-.921l-.705-.709zM5 11v3.5h1V11H5zm5 3.5V13H9v1.5h1zm0-1.5v-2.063H9V13h1z",fill:"currentColor"})),s0=t=>O.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},O.createElement("path",{d:"M3.5 3.5h8v8m-8-8V0m0 3.5H0m11.5 8h-8V6m8 5.5V15m0-3.5H15",stroke:"currentColor"}));var nt=(t=>(t.Line="Line",t.Square="Square",t.Circle="Circle",t.Direction="Direction",t.VectorDocument="VectorDocument",t.LayersDifference="LayersDifference",t.AntiClockwise="AntiClockwise",t.Clockwise="Clockwise",t.Github="Github",t.Crop="Crop",t.Svg="Svg",t.SolidDown="SolidDown",t.SolidUp="SolidUp",t.SolidUpSmall="SolidUpSmall",t.SolidDownSmall="SolidDownSmall",t))(nt||{});const u0={Line:Ym,Square:qm,Circle:Km,Direction:Xm,VectorDocument:Zm,LayersDifference:Jm,AntiClockwise:i0,Clockwise:l0,Github:o0,Crop:s0,Svg:bm,SolidDown:e0,SolidUp:t0,SolidUpSmall:n0,SolidDownSmall:r0},lh=({name:t,className:e})=>{const n=u0[t];return F.jsx("div",{className:"icon w-5"+(e?" "+e:""),children:F.jsx(n,{})})};var W=(t=>(t.Pencil="Pencil",t.Eraser="Eraser",t.Fill="Fill",t.Line="Line",t.Rectangle="Rectangle",t.Circle="Circle",t.Select="Select",t.Pan="Pan",t.Zoom="Zoom",t.Text="Text",t))(W||{});const ve=({label:t,title:e,icon:n,onClick:r,active:i=!1,className:l})=>F.jsx(F.Fragment,{children:F.jsxs("button",{className:"bg-gray-950 text-blue-700 font-semibold py-2 px-2 border border-blue-500 rounded w-10 h-10 flex flex-row justify-center items-center hover:bg-blue-500 hover:text-white hover:border-transparent data-[active=true]:bg-blue-500 data-[active=true]:text-white data-[active=true]:border-transparent"+(l?" "+l:""),"data-active":i,onClick:r,title:e,children:[n&&F.jsx(lh,{name:n}),t&&F.jsx("span",{children:t})]})}),a0=({label:t,title:e,icon:n,className:r,children:i})=>{const[l,o]=O.useState(!1);return F.jsxs("div",{className:"flex flex-row gap-2 relative"+(r?" "+r:""),children:[F.jsx(ve,{icon:n,label:t,title:e,"data-active":l,onClick:()=>o(!l)}),F.jsx(lh,{name:nt.SolidDownSmall,className:"-rotate-45 absolute -bottom-1 left-6 text-blue-700"}),l&&F.jsx("div",{className:"flex flex-row gap-1",onClick:()=>o(!1),children:i})]})},oh=!0,c0=!1,ol={CCW:-1,CW:1,NOT_ORIENTABLE:0},f0=2*Math.PI,Ol=1,sh=0,rt=2,d0=3,h0=4,p0=1,g0=2,Gu=0,Vr=1,$n=2;var Ml=Object.freeze({__proto__:null,BOUNDARY:rt,CCW:oh,CONTAINS:d0,CW:c0,END_VERTEX:$n,INSIDE:Ol,INTERLACE:h0,NOT_VERTEX:Gu,ORIENTATION:ol,OUTSIDE:sh,OVERLAP_OPPOSITE:g0,OVERLAP_SAME:p0,PIx2:f0,START_VERTEX:Vr});let ct=1e-6;function uh(t){ct=t}function ah(){return ct}const m0=3;function Ds(t){return t-ct}function dn(t,e){return t-e-ct}function ch(t,e){return t-e>ct}function v0(t,e){return t-e>-ct}function fh(t,e){return t-e<-ct}function y0(t,e){return t-e(e=e?e.next:this.first,{value:e,done:e===void 0})}}get size(){let e=0;for(let n of this)e++;return e}toArray(e=void 0,n=void 0){let r=[],i=e||this.first,l=n||this.last,o=i;if(o===void 0)return r;do r.push(o),o=o.next;while(o!==l.next);return r}append(e){return this.isEmpty()?this.first=e:(e.prev=this.last,this.last.next=e),this.last=e,this.last.next=void 0,this.first.prev=void 0,this}insert(e,n){if(this.isEmpty())this.first=e,this.last=e;else if(n==null)e.next=this.first,this.first.prev=e,this.first=e;else{let r=n.next;n.next=e,r&&(r.prev=e),e.prev=n,e.next=r,this.last===n&&(this.last=e)}return this.last.next=void 0,this.first.prev=void 0,this}remove(e){return e===this.first&&e===this.last?(this.first=void 0,this.last=void 0):(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this.first&&(this.first=e.next),e===this.last&&(this.last=e.prev)),this}isEmpty(){return this.first===void 0}static testInfiniteLoop(e){let n=e,r=e;do{if(n!=e&&n===r)throw Y.INFINITE_LOOP;n=n.next,r=r.next.next}while(n!=e)}}const kc={stroke:"black"};class w0{constructor(e=kc){for(const n in e)this[n]=e[n];this.stroke=e.stroke??kc.stroke}toAttributesString(){return Object.keys(this).reduce((e,n)=>e+(this[n]!==void 0?this.toAttrString(n,this[n]):""),"")}toAttrString(e,n){const r=e==="className"?"class":this.convertCamelToKebabCase(e);return n===null?`${r} `:`${r}="${n.toString()}" `}convertCamelToKebabCase(e){return e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join("-").toLowerCase()}}function vn(t){return new w0(t).toAttributesString()}function or(t,e){let n=[],[r,i,l]=t.standard,[o,u,a]=e.standard,c=r*u-i*o,f=l*u-i*a,h=r*a-l*o;if(!s.Utils.EQ_0(c)){let m,v;i===0?(m=l/r,v=h/c):u===0?(m=a/o,v=h/c):r===0?(m=f/c,v=l/i):o===0?(m=f/c,v=a/u):(m=f/c,v=h/c),n.push(new s.Point(m,v))}return n}function yn(t,e){let n=[],r=e.pc.projectionOn(t),i=e.pc.distanceTo(r)[0];if(s.Utils.EQ(i,e.r))n.push(r);else if(s.Utils.LT(i,e.r)){let l=Math.sqrt(e.r*e.r-i*i),o,u;o=t.norm.rotate90CCW().multiply(l),u=r.translate(o),n.push(u),o=t.norm.rotate90CW().multiply(l),u=r.translate(o),n.push(u)}return n}function Zn(t,e){let n=[];for(let r of e.toSegments()){let i=mi(r,t);for(let l of i)wh(l,n)||n.push(l)}return n}function to(t,e){let n=[];if(Zn(t,e.box).length===0)return n;let r=new s.Circle(e.pc,e.r),i=yn(t,r);for(let l of i)l.on(e)&&n.push(l);return n}function mi(t,e){let n=[];if(t.ps.on(e)&&n.push(t.ps),t.pe.on(e)&&!t.isZeroLength()&&n.push(t.pe),n.length>0||t.isZeroLength()||t.ps.leftTo(e)&&t.pe.leftTo(e)||!t.ps.leftTo(e)&&!t.pe.leftTo(e))return n;let r=new s.Line(t.ps,t.pe);return or(r,e)}function no(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength())return t.ps.on(e)&&n.push(t.ps),n;if(e.isZeroLength())return e.ps.on(t)&&n.push(e.ps),n;let r=new s.Line(t.ps,t.pe),i=new s.Line(e.ps,e.pe);if(r.incidentTo(i))t.ps.on(e)&&n.push(t.ps),t.pe.on(e)&&n.push(t.pe),e.ps.on(t)&&!e.ps.equalTo(t.ps)&&!e.ps.equalTo(t.pe)&&n.push(e.ps),e.pe.on(t)&&!e.pe.equalTo(t.ps)&&!e.pe.equalTo(t.pe)&&n.push(e.pe);else{let l=or(r,i);l.length>0&&Cc(l[0],t)&&Cc(l[0],e)&&n.push(l[0])}return n}function Cc(t,e){const n=e.box;return s.Utils.LE(t.x,n.xmax)&&s.Utils.GE(t.x,n.xmin)&&s.Utils.LE(t.y,n.ymax)&&s.Utils.GE(t.y,n.ymin)}function ro(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength()){let[l,o]=t.ps.distanceTo(e.pc);return s.Utils.EQ(l,e.r)&&n.push(t.ps),n}let r=new s.Line(t.ps,t.pe),i=yn(r,e);for(let l of i)l.on(t)&&n.push(l);return n}function sr(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength())return t.ps.on(e)&&n.push(t.ps),n;let r=new s.Line(t.ps,t.pe),i=new s.Circle(e.pc,e.r),l=yn(r,i);for(let o of l)o.on(t)&&o.on(e)&&n.push(o);return n}function S0(t,e){let n=[];for(let r of e.toSegments()){let i=no(r,t);for(let l of i)n.push(l)}return n}function dh(t,e){let n=[];if(t.box.not_intersect(e.box))return n;let r=new s.Vector(t.pc,e.pc),i=t.r,l=e.r;if(s.Utils.EQ_0(i)||s.Utils.EQ_0(l))return n;if(s.Utils.EQ_0(r.x)&&s.Utils.EQ_0(r.y)&&s.Utils.EQ(i,l))return n.push(t.pc.translate(-i,0)),n;let o=t.pc.distanceTo(e.pc)[0];if(s.Utils.GT(o,i+l)||s.Utils.LT(o,Math.abs(i-l)))return n;r.x/=o,r.y/=o;let u;if(s.Utils.EQ(o,i+l)||s.Utils.EQ(o,Math.abs(i-l)))return u=t.pc.translate(i*r.x,i*r.y),n.push(u),n;let a=i*i/(2*o)-l*l/(2*o)+o/2,c=t.pc.translate(a*r.x,a*r.y),f=Math.sqrt(i*i-a*a);return u=c.translate(r.rotate90CCW().multiply(f)),n.push(u),u=c.translate(r.rotate90CW().multiply(f)),n.push(u),n}function x0(t,e){let n=[];for(let r of e.toSegments()){let i=ro(r,t);for(let l of i)n.push(l)}return n}function hh(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.pc.equalTo(e.pc)&&s.Utils.EQ(t.r,e.r)){let o;return o=t.start,o.on(e)&&n.push(o),o=t.end,o.on(e)&&n.push(o),o=e.start,o.on(t)&&n.push(o),o=e.end,o.on(t)&&n.push(o),n}let r=new s.Circle(t.pc,t.r),i=new s.Circle(e.pc,e.r),l=r.intersect(i);for(let o of l)o.on(t)&&o.on(e)&&n.push(o);return n}function qu(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(e.pc.equalTo(t.pc)&&s.Utils.EQ(e.r,t.r))return n.push(t.start),n.push(t.end),n;let r=e,i=new s.Circle(t.pc,t.r),l=dh(r,i);for(let o of l)o.on(t)&&n.push(o);return n}function E0(t,e){let n=[];for(let r of e.toSegments()){let i=sr(r,t);for(let l of i)n.push(l)}return n}function ph(t,e){return t.isSegment?no(t.shape,e):sr(e,t.shape)}function gh(t,e){return t.isSegment?sr(t.shape,e):hh(t.shape,e)}function mh(t,e){return t.isSegment?mi(t.shape,e):to(e,t.shape)}function P0(t,e){return t.isSegment?Zu(e,t.shape):Ju(e,t.shape)}function T0(t,e){return t.isSegment?ro(t.shape,e):qu(t.shape,e)}function Ku(t,e){let n=[];for(let r of e.edges)for(let i of ph(r,t))n.push(i);return n}function Xu(t,e){let n=[];for(let r of e.edges)for(let i of gh(r,t))n.push(i);return n}function vi(t,e){let n=[];if(e.isEmpty())return n;for(let r of e.edges)for(let i of mh(r,t))wh(i,n)||n.push(i);return t.sortPoints(n)}function vh(t,e){let n=[];if(e.isEmpty())return n;for(let r of e.edges)for(let i of T0(r,t))n.push(i);return n}function yh(t,e){return t.isSegment?ph(e,t.shape):t.isArc?gh(e,t.shape):t.isLine?mh(e,t.shape):t.isRay?P0(e,t.shape):[]}function _h(t,e){let n=[];if(e.isEmpty()||t.shape.box.not_intersect(e.box))return n;let r=e.edges.search(t.shape.box);for(let i of r)n=[...n,...yh(t,i)];return n}function k0(t,e){let n=[];if(e.isEmpty()||t.size===0)return n;for(let r of t)n=[...n,..._h(r,e)];return n}function C0(t,e){let n=[];if(t.isEmpty()||e.isEmpty()||t.box.not_intersect(e.box))return n;for(let r of t.edges)n=[...n,..._h(r,e)];return n}function L0(t,e){return t instanceof s.Line?vi(t,e):t instanceof s.Segment?Ku(t,e):t instanceof s.Arc?Xu(t,e):[]}function wh(t,e){return e.some(n=>n.equalTo(t))}function Ht(t){return new s.Line(t.start,t.norm)}function Zu(t,e){return mi(e,Ht(t)).filter(n=>t.contains(n))}function Ju(t,e){return to(Ht(t),e).filter(n=>t.contains(n))}function Sh(t,e){return yn(Ht(t),e).filter(n=>t.contains(n))}function I0(t,e){return Zn(Ht(t),e).filter(n=>t.contains(n))}function xh(t,e){return or(Ht(t),e).filter(n=>t.contains(n))}function A0(t,e){return or(Ht(t),Ht(e)).filter(n=>t.contains(n)).filter(n=>e.contains(n))}function Eh(t,e){return vi(Ht(t),e).filter(n=>t.contains(n))}function Ph(t,e){if(t.intersect&&t.intersect instanceof Function)return t.intersect(e);throw Y.UNSUPPORTED_SHAPE_TYPE}function yi(t,e){let n=[];for(let r of e)n=[...n,...Ph(r,r.shape)];return n}function N0(t,e){let n=[];for(let r of t)for(let i of e)n=[...n,...Ph(r,i)];return n}let _n=class Ar extends Yu{constructor(...e){if(super(),this.isInfinite=!1,e.length===1&&e[0]instanceof Array&&e[0].length>0){let n=!1;const r=e[0],i=r.length,l=a=>a instanceof s.Segment||a instanceof s.Arc||a instanceof s.Ray||a instanceof s.Line,o=a=>a instanceof s.Segment||a instanceof s.Arc||a instanceof s.Ray,u=a=>a instanceof s.Segment||a instanceof s.Arc;if(n=i===1&&l(r[0])||i>1&&o(r[0])&&o(r[i-1])&&r.slice(1,i-1).every(u),n){this.isInfinite=r.some(a=>a instanceof s.Ray||a instanceof s.Line);for(let a of r){let c=new s.Edge(a);this.append(c)}this.setArcLength()}else throw s.Errors.ILLEGAL_PARAMETERS}}get edges(){return[...this]}get box(){return this.edges.reduce((e,n)=>e.merge(n.box),new s.Box)}get vertices(){let e=this.edges.map(n=>n.start);return e.push(this.last.end),e}get length(){if(this.isEmpty())return 0;if(this.isInfinite)return Number.POSITIVE_INFINITY;let e=0;for(let n of this)e+=n.length;return e}clone(){return new Ar(this.toShapes())}setArcLength(){for(let e of this)this.setOneEdgeArcLength(e)}setOneEdgeArcLength(e){e===this.first?e.arc_length=0:e.arc_length=e.prev.arc_length+e.prev.length}pointAtLength(e){if(e>this.length||e<0||this.isInfinite)return null;let n=null;for(let r of this)if(e>=r.arc_length&&(r===this.last||en.shape.contains(e));throw s.Errors.UNSUPPORTED_SHAPE_TYPE}translate(e){return new Ar(this.edges.map(n=>n.shape.translate(e)))}rotate(e=0,n=new s.Point){return new Ar(this.edges.map(r=>r.shape.rotate(e,n)))}transform(e=new s.Matrix){return new Ar(this.edges.map(n=>n.shape.transform(e)))}toShapes(){return this.edges.map(e=>e.shape.clone())}toJSON(){return this.edges.map(e=>e.toJSON())}svgPoints(){return this.vertices.map(e=>`${e.x},${e.y}`).join(" ")}dpath(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let n of this)e+=n.svg();return e}svg(e={}){let n=` - -`,n}};s.Multiline=_n;const O0=(...t)=>new s.Multiline(...t);s.multiline=O0;function Jn(t,e,n){let r=n.length,i=t.shape.split(e);if(i.length===0)return;let l=0;i[0]===null?l=0:i[1]===null?l=t.shape.length:l=i[0].length;let o=Gu;dn(l,0)&&(o|=Vr),dn(l,t.shape.length)&&(o|=$n);let u;l===1/0?u=i[0].coord(e):u=o&$n&&t.next&&t.next.arc_length===0?0:t.arc_length+l,n.push({id:r,pt:e,arc_length:u,edge_before:t,edge_after:void 0,face:t.face,is_vertex:o})}function si(t){t.int_points1_sorted=kt(t.int_points1),t.int_points2_sorted=kt(t.int_points2)}function kt(t){let e=new Map,n=0;for(let i of t)e.has(i.face)||(e.set(i.face,n),n++);for(let i of t)i.faceId=e.get(i.face);return t.slice().sort(M0)}function M0(t,e){return t.faceIde.faceId?1:t.arc_lengthe.arc_length?1:0}function bu(t){if(t.int_points1.length<2)return;let e=!1,n,r,i,l;for(let o=0;oo.id>=0),t.int_points2=t.int_points2.filter(o=>o.id>=0),t.int_points1.forEach((o,u)=>o.id=u),t.int_points2.forEach((o,u)=>o.id=u))}function Fs(t){for(let e of t)e.edge_before&&(e.edge_before.bvStart=void 0,e.edge_before.bvEnd=void 0,e.edge_before.bv=void 0,e.edge_before.overlap=void 0),e.edge_after&&(e.edge_after.bvStart=void 0,e.edge_after.bvEnd=void 0,e.edge_after.bv=void 0,e.edge_after.overlap=void 0);for(let e of t)e.edge_before&&(e.edge_before.bvEnd=rt),e.edge_after&&(e.edge_after.bvStart=rt)}function Bs(t,e){for(let n of t)n.edge_before&&n.edge_before.setInclusion(e),n.edge_after&&n.edge_after.setInclusion(e)}function z0(t){let e,n,r,i=t.int_points1.length;for(let l=0;lu.shape)];let l=[];for(let o of r.faces)l=[...l,...[...o.edges].map(u=>u.shape)];return[i,l]}function Vs(t,e){let[n,r]=wi(t,e,hn,!1),i=[];for(let l of n.faces)i=[...i,...[...l.edges].map(o=>o.shape)];return i}function Ch(t,e){let n=t.clone(),r=e.clone(),i=Lh(n,r);si(i),er(n,i.int_points1_sorted),er(r,i.int_points2_sorted),bu(i),si(i);let l=i.int_points1_sorted.map(u=>u.pt),o=i.int_points2_sorted.map(u=>u.pt);return[l,o]}function F0(t,e,n,r){let i=Nc(t,n.int_points1),l=Nc(e,n.int_points2);for(Oc(i,e),Oc(l,t),Fs(n.int_points1),Fs(n.int_points2),Bs(n.int_points1,e),Bs(n.int_points2,t);j0(t,e,n.int_points1,n.int_points1_sorted,n.int_points2,n););z0(n),$s(t,r,n.int_points1_sorted,!0),$s(e,r,n.int_points2_sorted,!1),Mc(t,i,r,!0),Mc(e,l,r,!1)}function B0(t,e,n,r){V0(t,e,r,n.int_points2),$0(t,e,n),Hs(t,n.int_points1),Hs(e,n.int_points2),Ws(t,n.int_points1,n.int_points2),Ws(t,n.int_points2,n.int_points1)}function wi(t,e,n,r){let i=t.clone(),l=e.clone(),o=Lh(i,l);return si(o),er(i,o.int_points1_sorted),er(l,o.int_points2_sorted),bu(o),si(o),F0(i,l,o,n),r&&B0(i,l,o,n),[i,l]}function Lh(t,e){let n={int_points1:[],int_points2:[]};for(let r of t.edges){let i=e.edges.search(r.box);for(let l of i){let o=r.shape.intersect(l.shape);for(let u of o)Jn(r,u,n.int_points1),Jn(l,u,n.int_points2)}}return n}function Nc(t,e){let n=[];for(let r of t.faces)e.find(i=>i.face===r)||n.push(r);return n}function Oc(t,e){for(let n of t)n.first.bv=n.first.bvStart=n.first.bvEnd=void 0,n.first.setInclusion(e)}function j0(t,e,n,r,i,l){let o,u,a,c=r.length,f=!1;for(let h=0;hNe.edge_after===k),A=e.addVertex(L.pt,k);L.edge_before=A,L.edge_after=A.next,D&&(D.edge_after=A),A.bvStart=void 0,A.bvEnd=se,A.bv=void 0,A.setInclusion(t),A.next.bvStart=se,A.next.bvEnd=void 0,A.next.bv=void 0,A.next.setInclusion(t)}si(l),f=!0;break}}p=p.next}if(f)break;throw Y.UNRESOLVED_BOUNDARY_CONFLICT}}return f}function $s(t,e,n,r){if(!n)return;let i,l,o,u;for(let a=0;al.face===i)===void 0&&t.addFace(i.first,i.last)}}function $0(t,e,n){if(n.int_points1.length!==0)for(let r=0;re instanceof Array&&e.length>0?"T":e instanceof Array&&e.length===0?"F":"*").join("")}equal(){return W0.test(this.toString())}intersect(){return Q0.test(this.toString())}touch(){return G0.test(this.toString())}inside(){return Y0.test(this.toString())}covered(){return q0.test(this.toString())}}function $r(t,e){let n,r=new s.Ray(e),i=new s.Line(r.pt,r.norm);const l=new s.Box(r.box.xmin-s.DP_TOL,r.box.ymin-s.DP_TOL,r.box.xmax,r.box.ymax+s.DP_TOL);if(t.box.not_intersect(l))return s.OUTSIDE;let o=t.edges.search(l);if(o.length===0)return s.OUTSIDE;for(let f of o)if(f.shape.contains(e))return s.BOUNDARY;let u=[...t.faces],a=[];for(let f of o)for(let h of r.intersect(f.shape)){if(h.equalTo(e))return s.BOUNDARY;a.push({pt:h,edge:f,face_index:u.indexOf(f.face)})}a.sort((f,h)=>fh(f.pt.x,h.pt.x)?-1:ch(f.pt.x,h.pt.x)?1:f.face_indexh.face_index?1:f.edge.arc_lengthh.edge.arc_length?1:0);let c=0;for(let f=0;f0&&h.pt.equalTo(a[f-1].pt)&&h.face_index===a[f-1].face_index&&h.edge.prev===a[f-1].edge)continue;let m=h.edge.prev;for(;Ds(m.length);)m=m.prev;let v=m.shape.tangentInEnd(),w=h.pt.translate(v),_=h.edge.shape.tangentInStart(),I=h.pt.translate(_),g=w.leftTo(i),d=I.leftTo(i);(g&&!d||!g&&d)&&c++}else if(h.pt.equalTo(h.edge.shape.end)){if(f>0&&h.pt.equalTo(a[f-1].pt)&&h.face_index===a[f-1].face_index&&h.edge.next===a[f-1].edge)continue;let m=h.edge.next;for(;Ds(m.length);)m=m.next;let v=m.shape.tangentInStart(),w=h.pt.translate(v),_=h.edge.shape.tangentInEnd(),I=h.pt.translate(_),g=w.leftTo(i),d=I.leftTo(i);(g&&!d||!g&&d)&&c++}else if(h.edge.shape instanceof s.Segment)c++;else{let m=h.edge.shape.box;dn(h.pt.y,m.ymin)||dn(h.pt.y,m.ymax)||c++}}return n=c%2===1?Ol:sh,n}function K0(t,e){return ar(t,e).equal()}function Ih(t,e){return ar(t,e).intersect()}function X0(t,e){return ar(t,e).touch()}function Z0(t,e){return!Ih(t,e)}function Ah(t,e){return ar(t,e).inside()}function Nh(t,e){return ar(t,e).covered()}function J0(t,e){return Ah(e,t)}function Oh(t,e){return Nh(e,t)}function ar(t,e){if(t instanceof s.Line&&e instanceof s.Line)return b0(t,e);if(t instanceof s.Line&&e instanceof s.Circle)return ev(t,e);if(t instanceof s.Line&&e instanceof s.Box)return tv(t,e);if(t instanceof s.Line&&e instanceof s.Polygon)return nv(t,e);if((t instanceof s.Segment||t instanceof s.Arc)&&e instanceof s.Polygon)return zc(t,e);if((t instanceof s.Segment||t instanceof s.Arc)&&(e instanceof s.Circle||e instanceof s.Box))return zc(t,new s.Polygon(e));if(t instanceof s.Polygon&&e instanceof s.Polygon)return Wi(t,e);if((t instanceof s.Circle||t instanceof s.Box)&&(e instanceof s.Circle||e instanceof s.Box))return Wi(new s.Polygon(t),new s.Polygon(e));if((t instanceof s.Circle||t instanceof s.Box)&&e instanceof s.Polygon)return Wi(new s.Polygon(t),e);if(t instanceof s.Polygon&&(e instanceof s.Circle||e instanceof s.Box))return Wi(t,new s.Polygon(e))}function b0(t,e){let n=new ur,r=or(t,e);return r.length===0?t.contains(e.pt)&&e.contains(t.pt)?(n.I2I=[t],n.I2E=[],n.E2I=[]):(n.I2I=[],n.I2E=[t],n.E2I=[e]):(n.I2I=r,n.I2E=t.split(r),n.E2I=e.split(r)),n}function ev(t,e){let n=new ur,r=yn(t,e);if(r.length===0)n.I2I=[],n.I2B=[],n.I2E=[t],n.E2I=[e];else if(r.length===1)n.I2I=[],n.I2B=r,n.I2E=t.split(r),n.E2I=[e];else{let i=new _n([t]),l=t.sortPoints(r);i.split(l);let o=i.toShapes();n.I2I=[o[1]],n.I2B=l,n.I2E=[o[0],o[2]],n.E2I=new s.Polygon([e.toArc()]).cutWithLine(t)}return n}function tv(t,e){let n=new ur,r=Zn(t,e);if(r.length===0)n.I2I=[],n.I2B=[],n.I2E=[t],n.E2I=[e];else if(r.length===1)n.I2I=[],n.I2B=r,n.I2E=t.split(r),n.E2I=[e];else{let i=new _n([t]),l=t.sortPoints(r);i.split(l);let o=i.toShapes();e.toSegments().some(u=>u.contains(r[0])&&u.contains(r[1]))?(n.I2I=[],n.I2B=[o[1]],n.I2E=[o[0],o[2]],n.E2I=[e]):(n.I2I=[o[1]],n.I2B=l,n.I2E=[o[0],o[2]],n.E2I=new s.Polygon(e.toSegments()).cutWithLine(t))}return n}function nv(t,e){let n=new ur,r=vi(t,e),i=new _n([t]),l=r.length>0?r.slice():t.sortPoints(r);return i.split(l),[...i].forEach(o=>o.setInclusion(e)),n.I2I=[...i].filter(o=>o.bv===s.INSIDE).map(o=>o.shape),n.I2B=[...i].slice(1).map(o=>o.bv===s.BOUNDARY?o.shape:o.shape.start),n.I2E=[...i].filter(o=>o.bv===s.OUTSIDE).map(o=>o.shape),n.E2I=e.cutWithLine(t),n}function zc(t,e){let n=new ur,r=L0(t,e),i=r.length>0?r.slice():t.sortPoints(r),l=new _n([t]);l.split(i),[...l].forEach(o=>o.setInclusion(e)),n.I2I=[...l].filter(o=>o.bv===s.INSIDE).map(o=>o.shape),n.I2B=[...l].slice(1).map(o=>o.bv===s.BOUNDARY?o.shape:o.shape.start),n.I2E=[...l].filter(o=>o.bv===s.OUTSIDE).map(o=>o.shape),n.B2I=[],n.B2B=[],n.B2E=[];for(let o of[t.start,t.end])switch($r(e,o)){case s.INSIDE:n.B2I.push(o);break;case s.BOUNDARY:n.B2B.push(o);break;case s.OUTSIDE:n.B2E.push(o);break}return n}function Wi(t,e){let n=new ur,[r,i]=Ch(t,e),l=Th(t,e),o=js(t,e),u=js(e,t),[a,c]=kh(t,e),f=Vs(t,e),h=Vs(e,t);return n.I2I=l.isEmpty()?[]:[l],n.I2B=c,n.I2E=o.isEmpty()?[]:[o],n.B2I=a,n.B2B=r,n.B2E=f,n.E2I=u.isEmpty()?[]:[u],n.E2B=h,n}var Mh=Object.freeze({__proto__:null,contain:J0,cover:Oh,covered:Nh,disjoint:Z0,equal:K0,inside:Ah,intersect:Ih,relate:ar,touch:X0});class Ke{constructor(e=1,n=0,r=0,i=1,l=0,o=0){this.a=e,this.b=n,this.c=r,this.d=i,this.tx=l,this.ty=o}clone(){return new Ke(this.a,this.b,this.c,this.d,this.tx,this.ty)}transform(e){return[e[0]*this.a+e[1]*this.c+this.tx,e[0]*this.b+e[1]*this.d+this.ty]}multiply(e){return new Ke(this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.tx+this.c*e.ty+this.tx,this.b*e.tx+this.d*e.ty+this.ty)}translate(...e){let n,r;if(e.length==1&&!isNaN(e[0].x)&&!isNaN(e[0].y))n=e[0].x,r=e[0].y;else if(e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number")n=e[0],r=e[1];else throw Y.ILLEGAL_PARAMETERS;return this.multiply(new Ke(1,0,0,1,n,r))}rotate(e,n=0,r=0){let i=Math.cos(e),l=Math.sin(e);return this.translate(n,r).multiply(new Ke(i,l,-l,i,0,0)).translate(-n,-r)}scale(e,n){return this.multiply(new Ke(e,0,0,n,0,0))}equalTo(e){return!(!s.Utils.EQ(this.tx,e.tx)||!s.Utils.EQ(this.ty,e.ty)||!s.Utils.EQ(this.a,e.a)||!s.Utils.EQ(this.b,e.b)||!s.Utils.EQ(this.c,e.c)||!s.Utils.EQ(this.d,e.d))}}s.Matrix=Ke;const rv=(...t)=>new s.Matrix(...t);s.matrix=rv;const iv=class Qs{constructor(e,n){this.low=e,this.high=n}clone(){return new Qs(this.low,this.high)}get max(){return this.clone()}less_than(e){return this.lowe.high?this.high:e.high)}output(){return[this.low,this.high]}static comparable_max(e,n){return e.merge(n)}static comparable_less_than(e,n){return ea&&([u,a]=[a,u]),this.item.key=new iv(u,a)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===j}_value_less_than(e){return this.item.value&&e.item.value&&this.item.value.less_than?this.item.value.less_than(e.item.value):this.item.valuee++),e}get keys(){let e=[];return this.tree_walk(this.root,n=>e.push(n.item.key.output?n.item.key.output():n.item.key)),e}get values(){let e=[];return this.tree_walk(this.root,n=>e.push(n.item.value)),e}get items(){let e=[];return this.tree_walk(this.root,n=>e.push({key:n.item.key.output?n.item.key.output():n.item.key,value:n.item.value})),e}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(e,n=e){if(e===void 0)return;let r=new Zt(e,n,this.nil_node,this.nil_node,null,ce);return this.tree_insert(r),this.recalc_max(r),r}exist(e,n=e){let r=new Zt(e,n);return!!this.tree_search(this.root,r)}remove(e,n=e){let r=new Zt(e,n),i=this.tree_search(this.root,r);return i&&this.tree_delete(i),i}search(e,n=(r,i)=>r===i?i.output():r){let r=new Zt(e),i=[];return this.tree_search_interval(this.root,r,i),i.map(l=>n(l.item.value,l.item.key))}intersect_any(e){let n=new Zt(e);return this.tree_find_any_interval(this.root,n)}forEach(e){this.tree_walk(this.root,n=>e(n.item.key,n.item.value))}map(e){const n=new ui;return this.tree_walk(this.root,r=>n.insert(r.item.key,e(r.item.value,r.item.key))),n}*iterate(e,n=(r,i)=>r===i?i.output():r){let r;for(e?r=this.tree_search_nearest_forward(this.root,new Zt(e)):this.root&&(r=this.local_minimum(this.root));r;)yield n(r.item.value,r.item.key),r=this.tree_successor(r)}recalc_max(e){let n=e;for(;n.parent!=null;)n.parent.update_max(),n=n.parent}tree_insert(e){let n=this.root,r=null;if(this.root==null||this.root===this.nil_node)this.root=e;else{for(;n!==this.nil_node;)r=n,e.less_than(n)?n=n.left:n=n.right;e.parent=r,e.less_than(r)?r.left=e:r.right=e}this.insert_fixup(e)}insert_fixup(e){let n,r;for(n=e;n!==this.root&&n.parent.color===ce;)n.parent===n.parent.parent.left?(r=n.parent.parent.right,r.color===ce?(n.parent.color=j,r.color=j,n.parent.parent.color=ce,n=n.parent.parent):(n===n.parent.right&&(n=n.parent,this.rotate_left(n)),n.parent.color=j,n.parent.parent.color=ce,this.rotate_right(n.parent.parent))):(r=n.parent.parent.left,r.color===ce?(n.parent.color=j,r.color=j,n.parent.parent.color=ce,n=n.parent.parent):(n===n.parent.left&&(n=n.parent,this.rotate_right(n)),n.parent.color=j,n.parent.parent.color=ce,this.rotate_left(n.parent.parent)));this.root.color=j}tree_delete(e){let n,r;e.left===this.nil_node||e.right===this.nil_node?n=e:n=this.tree_successor(e),n.left!==this.nil_node?r=n.left:r=n.right,r.parent=n.parent,n===this.root?this.root=r:(n===n.parent.left?n.parent.left=r:n.parent.right=r,n.parent.update_max()),this.recalc_max(r),n!==e&&(e.copy_data(n),e.update_max(),this.recalc_max(e)),n.color===j&&this.delete_fixup(r)}delete_fixup(e){let n=e,r;for(;n!==this.root&&n.parent!=null&&n.color===j;)n===n.parent.left?(r=n.parent.right,r.color===ce&&(r.color=j,n.parent.color=ce,this.rotate_left(n.parent),r=n.parent.right),r.left.color===j&&r.right.color===j?(r.color=ce,n=n.parent):(r.right.color===j&&(r.color=ce,r.left.color=j,this.rotate_right(r),r=n.parent.right),r.color=n.parent.color,n.parent.color=j,r.right.color=j,this.rotate_left(n.parent),n=this.root)):(r=n.parent.left,r.color===ce&&(r.color=j,n.parent.color=ce,this.rotate_right(n.parent),r=n.parent.left),r.left.color===j&&r.right.color===j?(r.color=ce,n=n.parent):(r.left.color===j&&(r.color=ce,r.right.color=j,this.rotate_left(r),r=n.parent.left),r.color=n.parent.color,n.parent.color=j,r.left.color=j,this.rotate_right(n.parent),n=this.root));n.color=j}tree_search(e,n){if(!(e==null||e===this.nil_node))return n.equal_to(e)?e:n.less_than(e)?this.tree_search(e.left,n):this.tree_search(e.right,n)}tree_search_nearest_forward(e,n){let r,i=e;for(;i&&i!==this.nil_node;)i.less_than(n)?i.intersect(n)?(r=i,i=i.left):i=i.right:((!r||i.less_than(r))&&(r=i),i=i.left);return r||null}tree_search_interval(e,n,r){e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(n)&&this.tree_search_interval(e.left,n,r),e.intersect(n)&&r.push(e),e.right!==this.nil_node&&!e.not_intersect_right_subtree(n)&&this.tree_search_interval(e.right,n,r))}tree_find_any_interval(e,n){let r=!1;return e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(n)&&(r=this.tree_find_any_interval(e.left,n)),r||(r=e.intersect(n)),!r&&e.right!==this.nil_node&&!e.not_intersect_right_subtree(n)&&(r=this.tree_find_any_interval(e.right,n))),r}local_minimum(e){let n=e;for(;n.left!=null&&n.left!==this.nil_node;)n=n.left;return n}local_maximum(e){let n=e;for(;n.right!=null&&n.right!==this.nil_node;)n=n.right;return n}tree_successor(e){let n,r,i;if(e.right!==this.nil_node)n=this.local_minimum(e.right);else{for(r=e,i=e.parent;i!=null&&i.right===r;)r=i,i=i.parent;n=i}return n}rotate_left(e){let n=e.right;e.right=n.left,n.left!==this.nil_node&&(n.left.parent=e),n.parent=e.parent,e===this.root?this.root=n:e===e.parent.left?e.parent.left=n:e.parent.right=n,n.left=e,e.parent=n,e!=null&&e!==this.nil_node&&e.update_max(),n=e.parent,n!=null&&n!==this.nil_node&&n.update_max()}rotate_right(e){let n=e.left;e.left=n.right,n.right!==this.nil_node&&(n.right.parent=e),n.parent=e.parent,e===this.root?this.root=n:e===e.parent.left?e.parent.left=n:e.parent.right=n,n.right=e,e.parent=n,e!==null&&e!==this.nil_node&&e.update_max(),n=e.parent,n!=null&&n!==this.nil_node&&n.update_max()}tree_walk(e,n){e!=null&&e!==this.nil_node&&(this.tree_walk(e.left,n),n(e),this.tree_walk(e.right,n))}testRedBlackProperty(){let e=!0;return this.tree_walk(this.root,function(n){n.color===ce&&(n.left.color===j&&n.right.color===j||(e=!1))}),e}testBlackHeightProperty(e){let n=0,r=0,i=0;if(e.color===j&&n++,e.left!==this.nil_node?r=this.testBlackHeightProperty(e.left):r=1,e.right!==this.nil_node?i=this.testBlackHeightProperty(e.right):i=1,r!==i)throw new Error("Red-black height property violated");return n+=r,n}}class lv extends Set{constructor(e){super(e),this.index=new ui,this.forEach(n=>this.index.insert(n))}add(e){let n=this.size;const{key:r,value:i}=e,l=r||e.box,o=i||e;return super.add(o),this.size>n&&this.index.insert(l,o),this}delete(e){const{key:n,value:r}=e,i=n||e.box,l=r||e;let o=super.delete(l);return o&&this.index.remove(i,l),o}clear(){super.clear(),this.index=new ui}search(e){return this.index.search(e)}hit(e){let n=new s.Box(e.x-1,e.y-1,e.x+1,e.y+1);return this.index.search(n).filter(i=>e.on(i))}svg(){return[...this].reduce((n,r)=>n+r.svg(),"")}}s.PlanarSet=lv;class qt{get name(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}get box(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}clone(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}translate(...e){return this.transform(new Ke().translate(...e))}rotate(e,n=new s.Point){return this.transform(new Ke().rotate(e,n.x,n.y))}scale(e,n){return this.transform(new Ke().scale(e,n))}transform(...e){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}toJSON(){return Object.assign({},this,{name:this.name})}svg(e={}){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}}let H=class zh extends qt{constructor(...e){if(super(),this.x=0,this.y=0,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let n=e[0];if(typeof n[0]=="number"&&typeof n[1]=="number"){this.x=n[0],this.y=n[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="point"){let{x:n,y:r}=e[0];this.x=n,this.y=r;return}if(e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"){this.x=e[0],this.y=e[1];return}throw Y.ILLEGAL_PARAMETERS}}get box(){return new s.Box(this.x,this.y,this.x,this.y)}clone(){return new s.Point(this.x,this.y)}get vertices(){return[this.clone()]}equalTo(e){return s.Utils.EQ(this.x,e.x)&&s.Utils.EQ(this.y,e.y)}lessThan(e){return!!(s.Utils.LT(this.y,e.y)||s.Utils.EQ(this.y,e.y)&&s.Utils.LT(this.x,e.x))}transform(e){return new s.Point(e.transform([this.x,this.y]))}projectionOn(e){if(this.equalTo(e.pt))return this.clone();let n=new s.Vector(this,e.pt);if(s.Utils.EQ_0(n.cross(e.norm)))return e.pt.clone();let r=n.dot(e.norm),i=e.norm.multiply(r);return this.translate(i)}leftTo(e){let n=new s.Vector(e.pt,this);return s.Utils.GT(n.dot(e.norm),0)}distanceTo(e){if(e instanceof zh){let n=e.x-this.x,r=e.y-this.y;return[Math.sqrt(n*n+r*r),new s.Segment(this,e)]}if(e instanceof s.Line)return s.Distance.point2line(this,e);if(e instanceof s.Circle)return s.Distance.point2circle(this,e);if(e instanceof s.Segment)return s.Distance.point2segment(this,e);if(e instanceof s.Arc)return s.Distance.point2arc(this,e);if(e instanceof s.Polygon)return s.Distance.point2polygon(this,e);if(e instanceof s.PlanarSet)return s.Distance.shape2planarSet(this,e);if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}on(e){if(e instanceof s.Point)return this.equalTo(e);if(e.contains&&e.contains instanceof Function)return e.contains(this);throw s.Errors.UNSUPPORTED_SHAPE_TYPE}get name(){return"point"}svg(e={}){const n=e.r??3;return` -`}};s.Point=H;const ea=(...t)=>new s.Point(...t);s.point=ea;let Rh=class extends qt{constructor(...e){if(super(),this.x=0,this.y=0,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let n=e[0];if(typeof n[0]=="number"&&typeof n[1]=="number"){this.x=n[0],this.y=n[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="vector"){let{x:n,y:r}=e[0];this.x=n,this.y=r;return}if(e.length===2){let n=e[0],r=e[1];if(typeof n=="number"&&typeof r=="number"){this.x=n,this.y=r;return}if(n instanceof s.Point&&r instanceof s.Point){this.x=r.x-n.x,this.y=r.y-n.y;return}}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Vector(this.x,this.y)}get slope(){let e=Math.atan2(this.y,this.x);return e<0&&(e=2*Math.PI+e),e}get length(){return Math.sqrt(this.dot(this))}equalTo(e){return s.Utils.EQ(this.x,e.x)&&s.Utils.EQ(this.y,e.y)}multiply(e){return new s.Vector(e*this.x,e*this.y)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}normalize(){if(!s.Utils.EQ_0(this.length))return new s.Vector(this.x/this.length,this.y/this.length);throw Y.ZERO_DIVISION}rotate(e,n=new s.Point){if(n.x===0&&n.y===0)return this.transform(new Ke().rotate(e));throw Y.OPERATION_IS_NOT_SUPPORTED}transform(e){return new s.Vector(e.transform([this.x,this.y]))}rotate90CCW(){return new s.Vector(-this.y,this.x)}rotate90CW(){return new s.Vector(this.y,-this.x)}invert(){return new s.Vector(-this.x,-this.y)}add(e){return new s.Vector(this.x+e.x,this.y+e.y)}subtract(e){return new s.Vector(this.x-e.x,this.y-e.y)}angleTo(e){let n=this.normalize(),r=e.normalize(),i=Math.atan2(n.cross(r),n.dot(r));return i<0&&(i+=2*Math.PI),i}projectionOn(e){let n=e.normalize(),r=this.dot(n);return n.multiply(r)}get name(){return"vector"}};s.Vector=Rh;const Uh=(...t)=>new s.Vector(...t);s.vector=Uh;let sl=class Gs extends qt{constructor(...e){if(super(),this.ps=new s.Point,this.pe=new s.Point,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===4){let n=e[0];this.ps=new s.Point(n[0],n[1]),this.pe=new s.Point(n[2],n[3]);return}if(e.length===1&&e[0]instanceof Object&&e[0].name==="segment"){let{ps:n,pe:r}=e[0];this.ps=new s.Point(n.x,n.y),this.pe=new s.Point(r.x,r.y);return}if(e.length===1&&e[0]instanceof s.Point){this.ps=e[0].clone();return}if(e.length===2&&e[0]instanceof s.Point&&e[1]instanceof s.Point){this.ps=e[0].clone(),this.pe=e[1].clone();return}if(e.length===4){this.ps=new s.Point(e[0],e[1]),this.pe=new s.Point(e[2],e[3]);return}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Segment(this.start,this.end)}get start(){return this.ps}get end(){return this.pe}get vertices(){return[this.ps.clone(),this.pe.clone()]}get length(){return this.start.distanceTo(this.end)[0]}get slope(){return new s.Vector(this.start,this.end).slope}get box(){return new s.Box(Math.min(this.start.x,this.end.x),Math.min(this.start.y,this.end.y),Math.max(this.start.x,this.end.x),Math.max(this.start.y,this.end.y))}equalTo(e){return this.ps.equalTo(e.ps)&&this.pe.equalTo(e.pe)}contains(e){return s.Utils.EQ_0(this.distanceToPoint(e))}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return mi(this,e);if(e instanceof s.Ray)return Zu(e,this);if(e instanceof s.Segment)return no(this,e);if(e instanceof s.Circle)return ro(this,e);if(e instanceof s.Box)return S0(this,e);if(e instanceof s.Arc)return sr(this,e);if(e instanceof s.Polygon)return Ku(this,e);if(e instanceof s.Multiline)return yi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2segment(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.segment2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.segment2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2segment(this,e);return[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.segment2arc(this,e);return[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}tangentInStart(){return new s.Vector(this.start,this.end).normalize()}tangentInEnd(){return new s.Vector(this.end,this.start).normalize()}reverse(){return new Gs(this.end,this.start)}split(e){return this.start.equalTo(e)?[null,this.clone()]:this.end.equalTo(e)?[this.clone(),null]:[new s.Segment(this.start,e),new s.Segment(e,this.end)]}middle(){return new s.Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}pointAtLength(e){if(e>this.length||e<0)return null;if(e==0)return this.start;if(e==this.length)return this.end;let n=e/this.length;return new s.Point((this.end.x-this.start.x)*n+this.start.x,(this.end.y-this.start.y)*n+this.start.y)}distanceToPoint(e){let[n,...r]=s.Distance.point2segment(e,this);return n}definiteIntegral(e=0){let n=this.end.x-this.start.x,r=this.start.y-e,i=this.end.y-e;return n*(r+i)/2}transform(e=new s.Matrix){return new Gs(this.ps.transform(e),this.pe.transform(e))}isZeroLength(){return this.ps.equalTo(this.pe)}sortPoints(e){return new s.Line(this.start,this.end).sortPoints(e)}get name(){return"segment"}svg(e={}){return` -`}};s.Segment=sl;const ov=(...t)=>new s.Segment(...t);s.segment=ov;let{vector:Tr}=s,lo=class Dh extends qt{constructor(...e){if(super(),this.pt=new s.Point,this.norm=new s.Vector(0,1),e.length!==0){if(e.length===1&&e[0]instanceof Object&&e[0].name==="line"){let{pt:n,norm:r}=e[0];this.pt=new s.Point(n),this.norm=new s.Vector(r);return}if(e.length===2){let n=e[0],r=e[1];if(n instanceof s.Point&&r instanceof s.Point){this.pt=n,this.norm=Dh.points2norm(n,r),this.norm.dot(Tr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}if(n instanceof s.Point&&r instanceof s.Vector){if(s.Utils.EQ_0(r.x)&&s.Utils.EQ_0(r.y))throw Y.ILLEGAL_PARAMETERS;this.pt=n.clone(),this.norm=r.clone(),this.norm=this.norm.normalize(),this.norm.dot(Tr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}if(n instanceof s.Vector&&r instanceof s.Point){if(s.Utils.EQ_0(n.x)&&s.Utils.EQ_0(n.y))throw Y.ILLEGAL_PARAMETERS;this.pt=r.clone(),this.norm=n.clone(),this.norm=this.norm.normalize(),this.norm.dot(Tr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Line(this.pt,this.norm)}get start(){}get end(){}get length(){return Number.POSITIVE_INFINITY}get box(){return new s.Box(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}get middle(){}get slope(){return new s.Vector(this.norm.y,-this.norm.x).slope}get standard(){let e=this.norm.x,n=this.norm.y,r=this.norm.dot(Tr(this.pt.x,this.pt.y));return[e,n,r]}parallelTo(e){return s.Utils.EQ_0(this.norm.cross(e.norm))}incidentTo(e){return this.parallelTo(e)&&this.pt.on(e)}contains(e){if(this.pt.equalTo(e))return!0;let n=new s.Vector(this.pt,e);return s.Utils.EQ_0(this.norm.dot(n))}coord(e){return Tr(e.x,e.y).cross(this.norm)}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return or(this,e);if(e instanceof s.Ray)return xh(e,this);if(e instanceof s.Circle)return yn(this,e);if(e instanceof s.Box)return Zn(this,e);if(e instanceof s.Segment)return mi(e,this);if(e instanceof s.Arc)return to(this,e);if(e instanceof s.Polygon)return vi(this,e);if(e instanceof s.Multiline)return yi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2line(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.circle2line(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2line(e,this);return[n,r.reverse()]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2line(e,this);return[n,r.reverse()]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}}split(e){if(e instanceof s.Point)return[new s.Ray(e,this.norm),new s.Ray(e,this.norm)];{let n=new s.Multiline([this]),r=this.sortPoints(e);return n.split(r),n.toShapes()}}rotate(e,n=new s.Point){return new s.Line(this.pt.rotate(e,n),this.norm.rotate(e))}transform(e){return new s.Line(this.pt.transform(e),this.norm.clone())}sortPoints(e){return e.slice().sort((n,r)=>this.coord(n)this.coord(r)?1:0)}get name(){return"line"}svg(e,n={}){let r=Zn(this,e);if(r.length===0)return"";let i=r[0],l=r.length===2?r[1]:r.find(u=>!u.equalTo(i));return l===void 0&&(l=i),new s.Segment(i,l).svg(n)}static points2norm(e,n){if(e.equalTo(n))throw Y.ILLEGAL_PARAMETERS;return new s.Vector(e,n).normalize().rotate90CCW()}};s.Line=lo;const sv=(...t)=>new s.Line(...t);s.line=sv;let uv=class extends qt{constructor(...e){if(super(),this.pc=new s.Point,this.r=1,e.length===1&&e[0]instanceof Object&&e[0].name==="circle"){let{pc:n,r}=e[0];this.pc=new s.Point(n),this.r=r}else{let[n,r]=[...e];n&&n instanceof s.Point&&(this.pc=n.clone()),r!==void 0&&(this.r=r)}}clone(){return new s.Circle(this.pc.clone(),this.r)}get center(){return this.pc}get box(){return new s.Box(this.pc.x-this.r,this.pc.y-this.r,this.pc.x+this.r,this.pc.y+this.r)}contains(e){if(e instanceof s.Point)return s.Utils.LE(e.distanceTo(this.center)[0],this.r);if(e instanceof s.Segment)return s.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&s.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof s.Arc)return this.intersect(e).length===0&&s.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&s.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof s.Circle)return this.intersect(e).length===0&&s.Utils.LE(e.r,this.r)&&s.Utils.LE(e.center.distanceTo(this.center)[0],this.r)}toArc(e=!0){return new s.Arc(this.center,this.r,Math.PI,-Math.PI,e)}scale(e,n){if(e!==n||!(this.pc.x===0&&this.pc.y===0))throw Y.OPERATION_IS_NOT_SUPPORTED;return new s.Circle(this.pc,this.r*e)}transform(e=new s.Matrix){return new s.Circle(this.pc.transform(e),this.r)}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return yn(e,this);if(e instanceof s.Ray)return Sh(e,this);if(e instanceof s.Segment)return ro(e,this);if(e instanceof s.Circle)return dh(e,this);if(e instanceof s.Box)return x0(this,e);if(e instanceof s.Arc)return qu(e,this);if(e instanceof s.Polygon)return vh(this,e);if(e instanceof s.Multiline)return yi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.circle2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.circle2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline){let[n,r]=s.Distance.shape2multiline(this,e);return[n,r]}}get name(){return"circle"}svg(e={}){return` -`}};s.Circle=uv;const Fh=(...t)=>new s.Circle(...t);s.circle=Fh;class Ys extends qt{constructor(...e){if(super(),this.pc=new s.Point,this.r=1,this.startAngle=0,this.endAngle=2*Math.PI,this.counterClockwise=s.CCW,e.length!==0)if(e.length===1&&e[0]instanceof Object&&e[0].name==="arc"){let{pc:n,r,startAngle:i,endAngle:l,counterClockwise:o}=e[0];this.pc=new s.Point(n.x,n.y),this.r=r,this.startAngle=i,this.endAngle=l,this.counterClockwise=o}else{let[n,r,i,l,o]=[...e];n&&n instanceof s.Point&&(this.pc=n.clone()),r!==void 0&&(this.r=r),i!==void 0&&(this.startAngle=i),l!==void 0&&(this.endAngle=l),o!==void 0&&(this.counterClockwise=o)}}clone(){return new s.Arc(this.pc.clone(),this.r,this.startAngle,this.endAngle,this.counterClockwise)}get sweep(){if(s.Utils.EQ(this.startAngle,this.endAngle))return 0;if(s.Utils.EQ(Math.abs(this.startAngle-this.endAngle),s.PIx2))return s.PIx2;let e;return this.counterClockwise?e=s.Utils.GT(this.endAngle,this.startAngle)?this.endAngle-this.startAngle:this.endAngle-this.startAngle+s.PIx2:e=s.Utils.GT(this.startAngle,this.endAngle)?this.startAngle-this.endAngle:this.startAngle-this.endAngle+s.PIx2,s.Utils.GT(e,s.PIx2)&&(e-=s.PIx2),s.Utils.LT(e,0)&&(e+=s.PIx2),e}get start(){return new s.Point(this.pc.x+this.r,this.pc.y).rotate(this.startAngle,this.pc)}get end(){return new s.Point(this.pc.x+this.r,this.pc.y).rotate(this.endAngle,this.pc)}get center(){return this.pc.clone()}get vertices(){return[this.start.clone(),this.end.clone()]}get length(){return Math.abs(this.sweep*this.r)}get box(){let n=this.breakToFunctional().reduce((r,i)=>r.merge(i.start.box),new s.Box);return n=n.merge(this.end.box),n}contains(e){if(!s.Utils.EQ(this.pc.distanceTo(e)[0],this.r))return!1;if(e.equalTo(this.start))return!0;let n=new s.Vector(this.pc,e).slope,r=new s.Arc(this.pc,this.r,this.startAngle,n,this.counterClockwise);return s.Utils.LE(r.length,this.length)}split(e){if(this.start.equalTo(e))return[null,this.clone()];if(this.end.equalTo(e))return[this.clone(),null];let n=new s.Vector(this.pc,e).slope;return[new s.Arc(this.pc,this.r,this.startAngle,n,this.counterClockwise),new s.Arc(this.pc,this.r,n,this.endAngle,this.counterClockwise)]}middle(){let e=this.counterClockwise?this.startAngle+this.sweep/2:this.startAngle-this.sweep/2;return new s.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise).end}pointAtLength(e){if(e>this.length||e<0)return null;if(e===0)return this.start;if(e===this.length)return this.end;let n=e/this.length,r=this.counterClockwise?this.startAngle+this.sweep*n:this.startAngle-this.sweep*n;return new s.Arc(this.pc,this.r,this.startAngle,r,this.counterClockwise).end}chordHeight(){return(1-Math.cos(Math.abs(this.sweep/2)))*this.r}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return to(e,this);if(e instanceof s.Ray)return Ju(e,this);if(e instanceof s.Circle)return qu(this,e);if(e instanceof s.Segment)return sr(e,this);if(e instanceof s.Box)return E0(this,e);if(e instanceof s.Arc)return hh(this,e);if(e instanceof s.Polygon)return Xu(this,e);if(e instanceof s.Multiline)return yi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2arc(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.arc2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.arc2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2arc(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2arc(this,e);return[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}breakToFunctional(){let e=[],n=[0,Math.PI/2,2*Math.PI/2,3*Math.PI/2],r=[this.pc.translate(this.r,0),this.pc.translate(0,this.r),this.pc.translate(-this.r,0),this.pc.translate(0,-this.r)],i=[];for(let l=0;l<4;l++)r[l].on(this)&&i.push(new s.Arc(this.pc,this.r,this.startAngle,n[l],this.counterClockwise));if(i.length===0)e.push(this.clone());else{i.sort((u,a)=>u.length-a.length);for(let u=0;u0?e[e.length-1]:void 0,c;a?c=new s.Arc(this.pc,this.r,a.endAngle,i[u].endAngle,this.counterClockwise):c=new s.Arc(this.pc,this.r,this.startAngle,i[u].endAngle,this.counterClockwise),s.Utils.EQ_0(c.length)||e.push(c.clone())}let l=e.length>0?e[e.length-1]:void 0,o;l?o=new s.Arc(this.pc,this.r,l.endAngle,this.endAngle,this.counterClockwise):o=new s.Arc(this.pc,this.r,this.startAngle,this.endAngle,this.counterClockwise),!s.Utils.EQ_0(o.length)&&!s.Utils.EQ(o.sweep,2*Math.PI)&&e.push(o.clone())}return e}tangentInStart(){let e=new s.Vector(this.pc,this.start),n=this.counterClockwise?Math.PI/2:-Math.PI/2;return e.rotate(n).normalize()}tangentInEnd(){let e=new s.Vector(this.pc,this.end),n=this.counterClockwise?-Math.PI/2:Math.PI/2;return e.rotate(n).normalize()}reverse(){return new s.Arc(this.pc,this.r,this.endAngle,this.startAngle,!this.counterClockwise)}transform(e=new s.Matrix){let n=this.start.transform(e),r=this.end.transform(e),i=this.pc.transform(e),l=this.counterClockwise;return e.a*e.d<0&&(l=!l),s.Arc.arcSE(i,n,r,l)}static arcSE(e,n,r,i){let{vector:l}=s,o=l(e,n).slope,u=l(e,r).slope;s.Utils.EQ(o,u)&&(u+=2*Math.PI,i=!0);let a=l(e,n).length;return new s.Arc(e,a,o,u,i)}definiteIntegral(e=0){return this.breakToFunctional().reduce((i,l)=>i+l.circularSegmentDefiniteIntegral(e),0)}circularSegmentDefiniteIntegral(e){let n=new s.Line(this.start,this.end),r=this.pc.leftTo(n),l=new s.Segment(this.start,this.end).definiteIntegral(e),o=this.circularSegmentArea();return r?l-o:l+o}circularSegmentArea(){return .5*this.r*this.r*(this.sweep-Math.sin(this.sweep))}sortPoints(e){let{vector:n}=s;return e.slice().sort((r,i)=>{let l=n(this.pc,r).slope,o=n(this.pc,i).slope;return lo?1:0})}get name(){return"arc"}svg(e={}){let n=this.sweep<=Math.PI?"0":"1",r=this.counterClockwise?"1":"0";return s.Utils.EQ(this.sweep,2*Math.PI)?new s.Circle(this.pc,this.r).svg(e):` -`}}s.Arc=Ys;const av=(...t)=>new s.Arc(...t);s.arc=av;class jt extends qt{constructor(e=void 0,n=void 0,r=void 0,i=void 0){super(),this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i}clone(){return new jt(this.xmin,this.ymin,this.xmax,this.ymax)}get low(){return new s.Point(this.xmin,this.ymin)}get high(){return new s.Point(this.xmax,this.ymax)}get max(){return this.clone()}get center(){return new s.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)}get width(){return Math.abs(this.xmax-this.xmin)}get height(){return Math.abs(this.ymax-this.ymin)}get box(){return this.clone()}not_intersect(e){return this.xmaxe.xmax||this.ymaxe.ymax}intersect(e){return!this.not_intersect(e)}merge(e){return new jt(this.xmin===void 0?e.xmin:Math.min(this.xmin,e.xmin),this.ymin===void 0?e.ymin:Math.min(this.ymin,e.ymin),this.xmax===void 0?e.xmax:Math.max(this.xmax,e.xmax),this.ymax===void 0?e.ymax:Math.max(this.ymax,e.ymax))}less_than(e){return!!(this.low.lessThan(e.low)||this.low.equalTo(e.low)&&this.high.lessThan(e.high))}equal_to(e){return this.low.equalTo(e.low)&&this.high.equalTo(e.high)}output(){return this.clone()}static comparable_max(e,n){return e.merge(n)}static comparable_less_than(e,n){return e.lessThan(n)}set(e,n,r,i){this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i}toPoints(){return[new s.Point(this.xmin,this.ymin),new s.Point(this.xmax,this.ymin),new s.Point(this.xmax,this.ymax),new s.Point(this.xmin,this.ymax)]}toSegments(){let e=this.toPoints();return[new s.Segment(e[0],e[1]),new s.Segment(e[1],e[2]),new s.Segment(e[2],e[3]),new s.Segment(e[3],e[0])]}rotate(e,n=new s.Point){throw Y.OPERATION_IS_NOT_SUPPORTED}transform(e=new s.Matrix){return this.toPoints().map(r=>r.transform(e)).reduce((r,i)=>r.merge(i.box),new jt)}contains(e){if(e instanceof s.Point)return e.x>=this.xmin&&e.x<=this.xmax&&e.y>=this.ymin&&e.y<=this.ymax;if(e instanceof s.Segment)return e.vertices.every(n=>this.contains(n));if(e instanceof s.Box)return e.toSegments().every(n=>this.contains(n));if(e instanceof s.Circle)return this.contains(e.box);if(e instanceof s.Arc)return e.vertices.every(n=>this.contains(n))&&e.toSegments().every(n=>sr(n,e).length===0);if(e instanceof s.Line||e instanceof s.Ray)return!1;if(e instanceof s.Multiline)return e.toShapes().every(n=>this.contains(n));if(e instanceof s.Polygon)return this.contains(e.box)}distanceTo(e){const n=this.toSegments().map(i=>i.distanceTo(e));let r=[Number.MAX_SAFE_INTEGER,null];return n.forEach(i=>{i[0]`}}s.Box=jt;const cv=(...t)=>new s.Box(...t);s.box=cv;class fv{constructor(e){this.shape=e,this.next=void 0,this.prev=void 0,this.face=void 0,this.arc_length=0,this.bvStart=void 0,this.bvEnd=void 0,this.bv=void 0,this.overlap=void 0}get start(){return this.shape.start}get end(){return this.shape.end}get length(){return this.shape.length}get box(){return this.shape.box}get isSegment(){return this.shape instanceof s.Segment}get isArc(){return this.shape instanceof s.Arc}get isLine(){return this.shape instanceof s.Line}get isRay(){return this.shape instanceof s.Ray}middle(){return this.shape.middle()}pointAtLength(e){return this.shape.pointAtLength(e)}contains(e){return this.shape.contains(e)}setInclusion(e){if(this.bv!==void 0)return this.bv;if(this.shape instanceof s.Line||this.shape instanceof s.Ray)return this.bv=s.OUTSIDE,this.bv;if(this.bvStart===void 0&&(this.bvStart=$r(e,this.start)),this.bvEnd===void 0&&(this.bvEnd=$r(e,this.end)),this.bvStart===s.OUTSIDE||this.bvEnd==s.OUTSIDE)this.bv=s.OUTSIDE;else if(this.bvStart===s.INSIDE||this.bvEnd==s.INSIDE)this.bv=s.INSIDE;else{let n=$r(e,this.middle());this.bv=n}return this.bv}setOverlap(e){let n,r=this.shape,i=e.shape;r instanceof s.Segment&&i instanceof s.Segment?r.start.equalTo(i.start)&&r.end.equalTo(i.end)?n=s.OVERLAP_SAME:r.start.equalTo(i.end)&&r.end.equalTo(i.start)&&(n=s.OVERLAP_OPPOSITE):(r instanceof s.Arc&&i instanceof s.Arc||r instanceof s.Segment&&i instanceof s.Arc||r instanceof s.Arc&&i instanceof s.Segment)&&(r.start.equalTo(i.start)&&r.end.equalTo(i.end)&&r.middle().equalTo(i.middle())?n=s.OVERLAP_SAME:r.start.equalTo(i.end)&&r.end.equalTo(i.start)&&r.middle().equalTo(i.middle())&&(n=s.OVERLAP_OPPOSITE)),this.overlap===void 0&&(this.overlap=n),e.overlap===void 0&&(e.overlap=n)}svg(){if(this.shape instanceof s.Segment)return` L${this.shape.end.x},${this.shape.end.y}`;if(this.shape instanceof s.Arc){let e=this.shape,n,r=e.counterClockwise?"1":"0";if(s.Utils.EQ(e.sweep,2*Math.PI)){let i=e.counterClockwise?1:-1,l=new s.Arc(e.pc,e.r,e.startAngle,e.startAngle+i*Math.PI,e.counterClockwise),o=new s.Arc(e.pc,e.r,e.startAngle+i*Math.PI,e.endAngle,e.counterClockwise);return n="0",` A${l.r},${l.r} 0 ${n},${r} ${l.end.x},${l.end.y} - A${o.r},${o.r} 0 ${n},${r} ${o.end.x},${o.end.y}`}else return n=e.sweep<=Math.PI?"0":"1",` A${e.r},${e.r} 0 ${n},${r} ${e.end.x},${e.end.y}`}}toJSON(){return this.shape.toJSON()}}s.Edge=fv;class dv extends Yu{constructor(e,n){super(e,n),this.setCircularLinks()}setCircularLinks(){this.isEmpty()||(this.last.next=this.first,this.first.prev=this.last)}[Symbol.iterator](){let e;return{next:()=>{let n=e||this.first,r=this.first?e?e===this.first:!1:!0;return e=n?n.next:void 0,{value:n,done:r}}}}append(e){return super.append(e),this.setCircularLinks(),this}insert(e,n){return super.insert(e,n),this.setCircularLinks(),this}remove(e){return super.remove(e),this}}class zn extends dv{constructor(e,...n){if(super(),this._box=void 0,this._orientation=void 0,n.length!==0){if(n.length===1){if(n[0]instanceof Array){let r=n[0];if(r.length===0)return;if(r.every(i=>i instanceof s.Point)){let i=zn.points2segments(r);this.shapes2face(e.edges,i)}else if(r.every(i=>i instanceof Array&&i.length===2)){let i=r.map(o=>new s.Point(o[0],o[1])),l=zn.points2segments(i);this.shapes2face(e.edges,l)}else if(r.every(i=>i instanceof s.Segment||i instanceof s.Arc))this.shapes2face(e.edges,r);else if(r.every(i=>i.name==="segment"||i.name==="arc")){let i=[];for(let l of r){let o;l.name==="segment"?o=new s.Segment(l):o=new s.Arc(l),i.push(o)}this.shapes2face(e.edges,i)}}else if(n[0]instanceof zn){let r=n[0];this.first=r.first,this.last=r.last;for(let i of r)e.edges.add(i)}else if(n[0]instanceof s.Circle)this.shapes2face(e.edges,[n[0].toArc(oh)]);else if(n[0]instanceof s.Box){let r=n[0];this.shapes2face(e.edges,[new s.Segment(new s.Point(r.xmin,r.ymin),new s.Point(r.xmax,r.ymin)),new s.Segment(new s.Point(r.xmax,r.ymin),new s.Point(r.xmax,r.ymax)),new s.Segment(new s.Point(r.xmax,r.ymax),new s.Point(r.xmin,r.ymax)),new s.Segment(new s.Point(r.xmin,r.ymax),new s.Point(r.xmin,r.ymin))])}}n.length===2&&n[0]instanceof s.Edge&&n[1]instanceof s.Edge&&(this.first=n[0],this.last=n[1],this.last.next=this.first,this.first.prev=this.last,this.setArcLength())}}get edges(){return this.toArray()}get shapes(){return this.edges.map(e=>e.shape.clone())}get box(){if(this._box===void 0){let e=new s.Box;for(let n of this)e=e.merge(n.box);this._box=e}return this._box}get perimeter(){return this.last.arc_length+this.last.length}pointAtLength(e){if(e>this.perimeter||e<0)return null;let n=null;for(let r of this)if(e>=r.arc_length&&(r===this.last||e0&&r)break}if(i.length>0&&r)break}return i}findEdgeByPoint(e){let n;for(let r of this)if(!e.equalTo(r.shape.start)&&(e.equalTo(r.shape.end)||r.shape.contains(e))){n=r;break}return n}toPolygon(){return new s.Polygon(this.shapes)}toJSON(){return this.edges.map(e=>e.toJSON())}svg(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let n of this)e+=n.svg();return e+=" z",e}}s.Face=zn;class ta extends qt{constructor(...e){if(super(),this.pt=new s.Point,this.norm=new s.Vector(0,1),e.length!==0&&(e.length>=1&&e[0]instanceof s.Point&&(this.pt=e[0].clone()),e.length!==1)){if(e.length===2&&e[1]instanceof s.Vector){this.norm=e[1].clone();return}throw Y.ILLEGAL_PARAMETERS}}clone(){return new ta(this.pt,this.norm)}get slope(){return new s.Vector(this.norm.y,-this.norm.x).slope}get box(){let e=this.slope;return new s.Box(e>Math.PI/2&&e<3*Math.PI/2?Number.NEGATIVE_INFINITY:this.pt.x,e>=0&&e<=Math.PI?this.pt.y:Number.NEGATIVE_INFINITY,e>=Math.PI/2&&e<=3*Math.PI/2?this.pt.x:Number.POSITIVE_INFINITY,e>=Math.PI&&e<=2*Math.PI||e===0?this.pt.y:Number.POSITIVE_INFINITY)}get start(){return this.pt}get end(){}get length(){return Number.POSITIVE_INFINITY}contains(e){if(this.pt.equalTo(e))return!0;let n=new s.Vector(this.pt,e);return s.Utils.EQ_0(this.norm.dot(n))&&s.Utils.GE(n.cross(this.norm),0)}coord(e){return Uh(e.x,e.y).cross(this.norm)}split(e){return this.contains(e)?this.pt.equalTo(e)?[this]:[new s.Segment(this.pt,e),new s.Ray(e,this.norm)]:[]}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Segment)return Zu(this,e);if(e instanceof s.Arc)return Ju(this,e);if(e instanceof s.Line)return xh(this,e);if(e instanceof s.Ray)return A0(this,e);if(e instanceof s.Circle)return Sh(this,e);if(e instanceof s.Box)return I0(this,e);if(e instanceof s.Polygon)return Eh(this,e)}rotate(e,n=new s.Point){return new s.Ray(this.pt.rotate(e,n),this.norm.rotate(e))}transform(e){return new s.Ray(this.pt.transform(e),this.norm.clone())}get name(){return"ray"}svg(e,n={}){let r=new s.Line(this.pt,this.norm),i=Zn(r,e);return i=i.filter(o=>this.contains(o)),i.length===0||i.length===2?"":new s.Segment(this.pt,i[0]).svg(n)}}s.Ray=ta;const hv=(...t)=>new s.Ray(...t);s.ray=hv;let pv=class Sn{constructor(){this.faces=new s.PlanarSet,this.edges=new s.PlanarSet;let e=[...arguments];if(e.length===1&&(e[0]instanceof Array&&e[0].length>0||e[0]instanceof s.Circle||e[0]instanceof s.Box)){let n=e[0];if(e[0]instanceof Array&&e[0].every(r=>r instanceof Array))if(n.every(r=>r instanceof Array&&r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"))this.faces.add(new s.Face(this,n));else for(let r of n)if(r instanceof Array&&r[0]instanceof Array&&r[0].every(i=>i instanceof Array&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number"))for(let i of r)this.faces.add(new s.Face(this,i));else this.faces.add(new s.Face(this,r));else this.faces.add(new s.Face(this,n))}}get box(){return[...this.faces].reduce((e,n)=>e.merge(n.box),new s.Box)}get vertices(){return[...this.edges].map(e=>e.start)}clone(){let e=new Sn;for(let n of this.faces)e.addFace(n.shapes);return e}isEmpty(){return this.edges.size===0}isValid(){let e=!0;for(let n of this.faces)if(!n.isSimple(this.edges)){e=!1;break}return e}area(){let e=[...this.faces].reduce((n,r)=>n+r.signedArea(),0);return Math.abs(e)}addFace(...e){let n=new s.Face(this,...e);return this.faces.add(n),n}deleteFace(e){for(let n of e)this.edges.delete(n);return this.faces.delete(e)}recreateFaces(){this.faces.clear();for(let r of this.edges)r.face=null;let e,n=!0;for(;n;){n=!1;for(let r of this.edges)if(r.face===null){e=r,n=!0;break}if(n){let r=e;do r=r.next;while(r.next!==e);this.addFace(e,r)}}}removeChain(e,n,r){if(r.next===n){this.deleteFace(e);return}for(let i=n;i!==r.next;i=i.next)if(e.remove(i),this.edges.delete(i),e.isEmpty()){this.deleteFace(e);break}}addVertex(e,n){let r=n.shape.split(e);if(r[0]===null)return n.prev;if(r[1]===null)return n;let i=new s.Edge(r[0]),l=n.prev;return n.face.insert(i,l),this.edges.delete(n),this.edges.add(i),n.shape=r[1],this.edges.add(n),i}removeEndVertex(e){const n=e.next;n!==e&&(e.face.merge_with_next_edge(e),this.edges.delete(n))}cut(e){let n=this.clone(),r={int_points1:[],int_points2:[],int_points1_sorted:[],int_points2_sorted:[]};for(let o of e.edges)for(let u of n.edges){let a=yh(o,u);for(let c of a)Jn(o,c,r.int_points1),Jn(u,c,r.int_points2)}if(r.int_points1.length===0)return n;r.int_points1_sorted=kt(r.int_points1),r.int_points2_sorted=kt(r.int_points2),er(e,r.int_points1_sorted),er(n,r.int_points2_sorted),bu(r),r.int_points1_sorted=kt(r.int_points1),r.int_points2_sorted=kt(r.int_points2),Fs(r.int_points1),Bs(r.int_points1,n);for(let o of r.int_points1_sorted)o.edge_before&&o.edge_after&&o.edge_before.bv===o.edge_after.bv&&(r.int_points2[o.id]=-1,o.id=-1);if(r.int_points1=r.int_points1.filter(o=>o.id>=0),r.int_points2=r.int_points2.filter(o=>o.id>=0),r.int_points1.forEach((o,u)=>{o.id=u}),r.int_points2.forEach((o,u)=>{o.id=u}),r.int_points1.length===0)return n;r.int_points1_sorted=kt(r.int_points1),r.int_points2_sorted=kt(r.int_points2);let i,l;for(let o=1;on.edges.add(f)),c=c.reverse().map(f=>new s.Edge(f.shape.reverse()));for(let f=0;fn.edges.add(f))}return n.recreateFaces(),n}cutWithLine(e){let n=new _n([e]);return this.cut(n)}findEdgeByPoint(e){let n;for(let r of this.faces)if(n=r.findEdgeByPoint(e),n!==void 0)break;return n}splitToIslands(){if(this.isEmpty())return[];let e=this.toArray();e.sort((i,l)=>l.area()-i.area());let n=[...e[0].faces][0].orientation(),r=e.filter(i=>[...i.faces][0].orientation()===n);for(let i of e){let l=[...i.faces][0];if(l.orientation()!==n){for(let o of r)if(l.shapes.every(u=>o.contains(u))){o.addFace(l.shapes);break}}}return r}reverse(){for(let e of this.faces)e.reverse();return this}contains(e){if(e instanceof s.Point){let n=$r(this,e);return n===Ol||n===rt}else return Oh(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2polygon(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle||e instanceof s.Line||e instanceof s.Segment||e instanceof s.Arc){let[n,r]=s.Distance.shape2polygon(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Polygon){let n=[Number.POSITIVE_INFINITY,new s.Segment],r,i;for(let l of this.edges){let o=n[0];[r,i]=s.Distance.shape2planarSet(l.shape,e.edges,o),s.Utils.LT(r,o)&&(n=[r,i])}return n}}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return vi(e,this);if(e instanceof s.Ray)return Eh(e,this);if(e instanceof s.Circle)return vh(e,this);if(e instanceof s.Segment)return Ku(e,this);if(e instanceof s.Arc)return Xu(e,this);if(e instanceof s.Polygon)return C0(e,this);if(e instanceof s.Multiline)return k0(e,this)}translate(e){let n=new Sn;for(let r of this.faces)n.addFace(r.shapes.map(i=>i.translate(e)));return n}rotate(e=0,n=new s.Point){let r=new Sn;for(let i of this.faces)r.addFace(i.shapes.map(l=>l.rotate(e,n)));return r}scale(e,n){let r=new Sn;for(let i of this.faces)r.addFace(i.shapes.map(l=>l.scale(e,n)));return r}transform(e=new s.Matrix){let n=new Sn;for(let r of this.faces)n.addFace(r.shapes.map(i=>i.transform(e)));return n}toJSON(){return[...this.faces].map(e=>e.toJSON())}toArray(){return[...this.faces].map(e=>e.toPolygon())}dpath(){return[...this.faces].reduce((e,n)=>e+n.svg(),"")}svg(e={}){let n=` - -`,n}};s.Polygon=pv;const gv=(...t)=>new s.Polygon(...t);s.polygon=gv;const{Circle:jo,Line:Rc,Point:Uc,Vector:Qi,Utils:Vo}=s;class Hr{constructor(e){this.circle=e}get inversion_circle(){return this.circle}static inversePoint(e,n){const r=new Qi(e.pc,n),i=e.r*e.r,l=r.dot(r);return Vo.EQ_0(l)?new Uc(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY):e.pc.translate(r.multiply(i/l))}static inverseCircle(e,n){const r=e.pc.distanceTo(n.pc)[0];if(Vo.EQ(r,n.r)){let i=e.r*e.r/(2*n.r),l=new Qi(e.pc,n.pc);l=l.normalize();let o=e.pc.translate(l.multiply(i));return new Rc(o,l)}else{let i=new Qi(e.pc,n.pc),l=e.r*e.r/(i.dot(i)-n.r*n.r),o=e.pc.translate(i.multiply(l)),u=Math.abs(l)*n.r;return new jo(o,u)}}static inverseLine(e,n){const[r,i]=e.pc.distanceTo(n);if(Vo.EQ_0(r))return n.clone();{let l=e.r*e.r/(2*r),o=new Qi(e.pc,i.end);return o=o.multiply(l/r),new jo(e.pc.translate(o),l)}}inverse(e){if(e instanceof Uc)return Hr.inversePoint(this.circle,e);if(e instanceof jo)return Hr.inverseCircle(this.circle,e);if(e instanceof Rc)return Hr.inverseLine(this.circle,e)}}s.Inversion=Hr;const mv=t=>new s.Inversion(t);s.inversion=mv;class E{static point2point(e,n){return e.distanceTo(n)}static point2line(e,n){let r=e.projectionOn(n);return[new s.Vector(e,r).length,new s.Segment(e,r)]}static point2circle(e,n){let[r,i]=e.distanceTo(n.center);if(s.Utils.EQ_0(r))return[n.r,new s.Segment(e,n.toArc().start)];{let l=Math.abs(r-n.r),o=new s.Vector(n.pc,e).normalize().multiply(n.r),u=n.pc.translate(o);return[l,new s.Segment(e,u)]}}static point2segment(e,n){if(n.start.equalTo(n.end))return E.point2point(e,n.start);let r=new s.Vector(n.start,n.end),i=new s.Vector(n.start,e),l=new s.Vector(n.end,e),o=r.dot(i),u=-r.dot(l),a,c;if(s.Utils.GE(o,0)&&s.Utils.GE(u,0)){let f=n.tangentInStart();return a=Math.abs(f.cross(i)),c=n.start.translate(f.multiply(f.dot(i))),[a,new s.Segment(e,c)]}else return o<0?e.distanceTo(n.start):e.distanceTo(n.end)}static point2arc(e,n){let r=new s.Circle(n.pc,n.r),i=[],l,o;return[l,o]=E.point2circle(e,r),o.end.on(n)&&i.push(E.point2circle(e,r)),i.push(E.point2point(e,n.start)),i.push(E.point2point(e,n.end)),E.sort(i),i[0]}static point2edge(e,n){return n.shape instanceof s.Segment?E.point2segment(e,n.shape):E.point2arc(e,n.shape)}static segment2line(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=[];return i.push(E.point2line(e.start,n)),i.push(E.point2line(e.end,n)),E.sort(i),i[0]}static segment2segment(e,n){let r=no(e,n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=[],l,o;return[l,o]=E.point2segment(n.start,e),i.push([l,o.reverse()]),[l,o]=E.point2segment(n.end,e),i.push([l,o.reverse()]),i.push(E.point2segment(e.start,n)),i.push(E.point2segment(e.end,n)),E.sort(i),i[0]}static segment2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Line(e.ps,e.pe),[l,o]=E.point2line(n.center,i);if(s.Utils.GE(l,n.r)&&o.end.on(e))return E.point2circle(o.end,n);{let[u,a]=E.point2circle(e.start,n),[c,f]=E.point2circle(e.end,n);return s.Utils.LT(u,c)?[u,a]:[c,f]}}static segment2arc(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Line(e.ps,e.pe),l=new s.Circle(n.pc,n.r),[o,u]=E.point2line(l.center,i);if(s.Utils.GE(o,l.r)&&u.end.on(e)){let[h,m]=E.point2circle(u.end,l);if(m.end.on(n))return[h,m]}let a=[];a.push(E.point2arc(e.start,n)),a.push(E.point2arc(e.end,n));let c,f;return[c,f]=E.point2segment(n.start,e),a.push([c,f.reverse()]),[c,f]=E.point2segment(n.end,e),a.push([c,f.reverse()]),E.sort(a),a[0]}static circle2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];if(e.center.equalTo(n.center)){let i=e.toArc(),l=n.toArc();return E.point2point(i.start,l.start)}else{let i=new s.Line(e.center,n.center),l=i.intersect(e),o=i.intersect(n),u=[];return u.push(E.point2point(l[0],o[0])),u.push(E.point2point(l[0],o[1])),u.push(E.point2point(l[1],o[0])),u.push(E.point2point(l[1],o[1])),E.sort(u),u[0]}}static circle2line(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let[i,l]=E.point2line(e.center,n),[o,u]=E.point2circle(l.end,e);return u=u.reverse(),[o,u]}static arc2line(e,n){let r=n.intersect(e);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),[l,o]=E.point2line(i.center,n);if(s.Utils.GE(l,i.r)){let[u,a]=E.point2circle(o.end,i);if(a.end.on(e))return[u,a]}else{let u=[];return u.push(E.point2line(e.start,n)),u.push(E.point2line(e.end,n)),E.sort(u),u[0]}}static arc2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),[l,o]=E.circle2circle(i,n);if(o.start.on(e))return[l,o];{let u=[];return u.push(E.point2circle(e.start,n)),u.push(E.point2circle(e.end,n)),E.sort(u),u[0]}}static arc2arc(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),l=new s.Circle(n.center,n.r),[o,u]=E.circle2circle(i,l);if(u.start.on(e)&&u.end.on(n))return[o,u];{let a=[],c,f;return[c,f]=E.point2arc(e.start,n),f.end.on(n)&&a.push([c,f]),[c,f]=E.point2arc(e.end,n),f.end.on(n)&&a.push([c,f]),[c,f]=E.point2arc(n.start,e),f.end.on(e)&&a.push([c,f.reverse()]),[c,f]=E.point2arc(n.end,e),f.end.on(e)&&a.push([c,f.reverse()]),[c,f]=E.point2point(e.start,n.start),a.push([c,f]),[c,f]=E.point2point(e.start,n.end),a.push([c,f]),[c,f]=E.point2point(e.end,n.start),a.push([c,f]),[c,f]=E.point2point(e.end,n.end),a.push([c,f]),E.sort(a),a[0]}}static point2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n.edges){let[l,o]=E.point2edge(e,i);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static shape2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n.edges){let[l,o]=e.distanceTo(i.shape);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static polygon2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of e.edges)for(let l of n.edges){let[o,u]=i.shape.distanceTo(l.shape);s.Utils.LT(o,r[0])&&(r=[o,u])}return r}static box2box_minmax(e,n){let r=Math.max(Math.max(e.xmin-n.xmax,0),Math.max(n.xmin-e.xmax,0)),i=Math.max(Math.max(e.ymin-n.ymax,0),Math.max(n.ymin-e.ymax,0)),l=r*r+i*i,o=e.merge(n),u=o.xmax-o.xmin,a=o.ymax-o.ymin,c=u*u+a*a;return[l,c]}static minmax_tree_process_level(e,n,r,i){let l,o;for(let f of n)[l,o]=E.box2box_minmax(e.box,f.item.key),f.item.value instanceof s.Edge?i.insert([l,o],f.item.value.shape):i.insert([l,o],f.item.value),s.Utils.LT(o,r)&&(r=o);if(n.length===0)return r;let u=n.map(f=>f.left.isNil()?void 0:f.left).filter(f=>f!==void 0),a=n.map(f=>f.right.isNil()?void 0:f.right).filter(f=>f!==void 0),c=[...u,...a].filter(f=>{let[h,m]=E.box2box_minmax(e.box,f.max);return s.Utils.LE(h,r)});return r=E.minmax_tree_process_level(e,c,r,i),r}static minmax_tree(e,n,r){let i=new ui,l=[n.index.root],o=rs.Utils.LT(n[0],r[0])?-1:s.Utils.GT(n[0],r[0])?1:0)}static distance(e,n){return e.distanceTo(n)}static shape2multiline(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n){let[l,o]=E.distance(e,i.shape);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static multiline2multiline(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of e)for(let l of n){let[o,u]=E.distance(i.shape,l.shape);s.Utils.LT(o,r[0])&&(r=[o,u])}return r}}s.Distance=E;const{Multiline:vv,Point:Bh,Segment:yv,Polygon:jh}=s;function na(t){return new Bh(t.split(" ").map(Number))}function Vh(t){return t.split(", ").map(na)}function ra(t){const e=Vh(t);let n=[];for(let r=0;r{let o=i.split(", ").map(a=>new Bh(a.split(" ").map(Number)));const u=n.addFace(o);l===0?r=u.orientation():u.orientation()===r&&u.reverse()}),n}function wv(t){const n=t.split(/\)\), \(\(/).map(l=>"(("+l+"))").map($h),r=new jh;return n.reduce((l,o)=>[...l,...o==null?void 0:o.faces],[]).forEach(l=>r.addFace([...l==null?void 0:l.shapes])),r}function Sv(t){if(t.startsWith("POLYGON")){const e=t.replace(/^POLYGON /,"");return $h(e)}else{const e=t.replace(/^MULTIPOLYGON \(\(\((.*)\)\)\)$/,"$1");return wv(e)}}function xv(t){return t.split(` -`).map(n=>n.match(/\(([^)]+)\)/)[1]).map(na)}function Ev(t){return t.split(` -`).map(n=>n.match(/\(([^)]+)\)/)[1]).map(ra).reduce((n,r)=>[...n,...r],[])}function Hh(t){if(t.startsWith("POINT")){const e=t.replace(/^POINT \(/,"").replace(/\)$/,"");return na(e)}else if(t.startsWith("MULTIPOINT")){const e=t.replace(/^MULTIPOINT \(/,"").replace(/\)$/,"");return Vh(e)}else if(t.startsWith("LINESTRING")){const e=t.replace(/^LINESTRING \(/,"").replace(/\)$/,"");return ra(e)}else if(t.startsWith("MULTILINESTRING")){const e=t.replace(/^MULTILINESTRING /,"");return _v(e)}else{if(t.startsWith("POLYGON")||t.startsWith("MULTIPOLYGON"))return Sv(t);if(t.startsWith("GEOMETRYCOLLECTION")){const e=/(?POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \((?:[^\(\)]|\([^\)]*\))*\)/g,n=t.match(e);return n[0].startsWith("GEOMETRYCOLLECTION")&&(n[0]=n[0].replace("GEOMETRYCOLLECTION (","")),n.map(Hh).map(i=>i instanceof Array?i:[i]).reduce((i,l)=>[...i,...l],[])}else{if(Wh(t))return xv(t);if(Qh(t))return Ev(t)}}return[]}function Wh(t){var e;return(e=t.split(` -`))==null?void 0:e.every(n=>n.includes("POINT"))}function Qh(t){var e;return(e=t.split(` -`))==null?void 0:e.every(n=>n.includes("LINESTRING"))}function Pv(t){return t.startsWith("POINT")||Wh(t)||t.startsWith("LINESTRING")||Qh(t)||t.startsWith("MULTILINESTRING")||t.startsWith("POLYGON")||t.startsWith("MULTIPOINT")||t.startsWith("MULTIPOLYGON")||t.startsWith("GEOMETRYCOLLECTION")}s.isWktString=Pv;s.parseWKT=Hh;s.BooleanOperations=H0;s.Relations=Mh;function ft(t){const e=xi(),n=Wt();return new H((t.x-e.x)*n,(t.y-e.y)*n)}function oo(t){const e=xi(),n=Wt();return new H(t.x/n+e.x,t.y/n+e.y)}var V=(t=>(t.canvasSize="canvasSize",t.canvas="canvas",t.context="context",t.screenMouseLocation="screenMouseLocation",t.activeTool="activeTool",t.entities="entities",t.activeEntity="activeEntity",t.shouldDrawCursor="shouldDrawCursor",t.helperEntities="helperEntities",t.debugEntities="debugEntities",t.angleStep="angleStep",t.screenOffset="screenOffset",t.screenScale="screenScale",t.panStartLocation="panStartLocation",t.snapPoint="snapPoint",t.snapPointOnAngleGuide="snapPointOnAngleGuide",t.hoveredSnapPoints="hoveredSnapPoints",t.lastDrawTimestamp="lastDrawTimestamp",t))(V||{});function Tv(){let t=[],e=t.length;function n(){return t[e-1]}return{push:r=>(t.length=e,t[e++]=r,console.log("stack push",JSON.stringify(t,null,2)),n()),replace:r=>(t[e-1]=r,console.log("stack replace",JSON.stringify(t,null,2)),n()),peek:()=>n(),undo:()=>(e>1&&(e-=1),console.log("stack undo",JSON.stringify(t,null,2)),n()),redo:()=>(e{e=e-t.slice(0,e).filter(i=>i.variable===r).length,t=t.filter(i=>i.variable!==r)}}}function pn(t){const e=[];for(const n of t)n&&e.push(n);return e}function kv(t,e,n){return te?n==="asc"?1:-1:0}function so(t,e){return t.slice().sort((n,r)=>{for(let i=0;i!e(l,r))&&n.push(r);return n}function Dc(t){if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(t.toString()!=="[object Object]")return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}const Cv="[object RegExp]",Lv="[object String]",Iv="[object Number]",Av="[object Boolean]",Fc="[object Arguments]",Nv="[object Symbol]",Ov="[object Date]",Mv="[object Map]",zv="[object Set]",Rv="[object Array]",Uv="[object Function]",Dv="[object ArrayBuffer]",$o="[object Object]",Fv="[object Error]",Bv="[object DataView]",jv="[object Uint8Array]",Vv="[object Uint8ClampedArray]",$v="[object Uint16Array]",Hv="[object Uint32Array]",Wv="[object BigUint64Array]",Qv="[object Int8Array]",Gv="[object Int16Array]",Yv="[object Int32Array]",qv="[object BigInt64Array]",Kv="[object Float32Array]",Xv="[object Float64Array]";function Bc(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function jc(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function Zv(t,e){if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return ht(t,e)}return ht(t,e)}function ht(t,e,n){if(Object.is(t,e))return!0;let r=jc(t),i=jc(e);if(r===Fc&&(r=$o),i===Fc&&(i=$o),r!==i)return!1;switch(r){case Lv:return t.toString()===e.toString();case Iv:{const u=t.valueOf(),a=e.valueOf();return u===a||Number.isNaN(u)&&Number.isNaN(a)}case Av:case Ov:case Nv:return Object.is(t.valueOf(),e.valueOf());case Cv:return t.source===e.source&&t.flags===e.flags;case Uv:return t===e}n=n??new Map;const l=n.get(t),o=n.get(e);if(l!=null&&o!=null)return l===e;n.set(t,e),n.set(e,t);try{switch(r){case Mv:{if(t.size!==e.size)return!1;for(const[u,a]of t.entries())if(!e.has(u)||!ht(a,e.get(u),n))return!1;return!0}case zv:{if(t.size!==e.size)return!1;const u=Array.from(t.values()),a=Array.from(e.values());for(let c=0;cht(f,m,n));if(h===-1)return!1;a.splice(h,1)}return!0}case Rv:case jv:case Vv:case $v:case Hv:case Wv:case Qv:case Gv:case Yv:case qv:case Kv:case Xv:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let u=0;uGh,Jv=()=>Yh,ip=()=>ia,lt=()=>qh,xe=()=>ai,Ho=()=>uo,cr=()=>zl,bv=()=>Xh,e1=()=>Zh,t1=()=>Jh,qs=()=>Rl,xi=()=>Ul,Wt=()=>Dl,n1=()=>bh,oa=()=>ep,lp=()=>tp,sa=()=>np,r1=()=>rp,fr=()=>oo(ia),i1=()=>ai.filter(t=>!uo.includes(t.id)),Hn=t=>uo.includes(t.id),ua=t=>Kh.includes(t.id),l1=t=>Gh=t,o1=t=>Yh=t,s1=t=>ia=t,Nr=(t,e=!0)=>{e&&cp(V.activeTool),qh=t},dr=t=>{Ei(V.entities,ai),ai=t},de=t=>{Ei(V.activeEntity,zl),zl=t},ci=t=>Kh=t,Te=t=>uo=t,aa=t=>Xh=t,u1=t=>Zh=t,ca=t=>Jh=t,a1=(t,e=!0)=>{e&&cp(V.activeTool),Ei(V.angleStep,Rl),Rl=t},op=t=>{Ei(V.screenOffset,Ul),Ul=t},c1=t=>{Ei(V.screenScale,Dl),Dl=t},fa=t=>bh=t,f1=t=>ep=t,d1=t=>tp=t,h1=t=>np=t,p1=t=>rp=t,tr=t=>{const e=xe().filter(n=>n.id!==t.id);return dr(e),e},ao=(...t)=>{const e=[...xe(),...t];return dr(e),e},g1=[V.activeTool,V.angleStep],m1=[V.entities,V.activeEntity,V.angleStep,V.screenOffset,V.screenScale],v1=[V.angleStep,V.screenOffset,V.screenScale],Rn=Tv();function Ei(t,e){if(!m1.includes(t))return;const n=Rn.peek();if(!Zv(e,n==null?void 0:n.value)){if(t!==V.activeEntity&&Rn.clear(V.activeEntity),v1.includes(t)&&(n==null?void 0:n.variable)===t){Rn.replace({variable:t,value:e});return}Rn.push({variable:t,value:e})}}function sp(t){const e=t.variable,n=t.value;switch(e){case V.entities:ai=n;break;case V.activeEntity:zl=n;break;case V.angleStep:Rl=n;break;case V.screenOffset:Ul=n;break;case V.screenScale:Dl=n;break}}function up(){const t=Rn.undo();t&&sp(t)}function ap(){const t=Rn.redo();t&&sp(t)}function cp(t){g1.includes(t)&&(console.log("triggering react update for: ",t),window.dispatchEvent(new CustomEvent(t)))}const Ks=1e-6,Gi=10,Yi=30,y1="#111",_1="#fff",w1="#666666",S1="#FFFF00",da=15,x1=15,ha=15,R=15,pa=1e3,E1=3,P1="#b6ff9a",T1="#6899f3",k1=.1;var fp={exports:{}};(function(t,e){(function(n,r){r()})(mr,function(){function n(c,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),f={autoBom:!f}),f.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 r(c,f,h){var m=new XMLHttpRequest;m.open("GET",c),m.responseType="blob",m.onload=function(){a(m.response,f,h)},m.onerror=function(){console.error("could not download file")},m.send()}function i(c){var f=new XMLHttpRequest;f.open("HEAD",c,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function l(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(f)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof mr=="object"&&mr.global===mr?mr:void 0,u=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!u?function(c,f,h){var m=o.URL||o.webkitURL,v=document.createElement("a");f=f||c.name||"download",v.download=f,v.rel="noopener",typeof c=="string"?(v.href=c,v.origin===location.origin?l(v):i(v.href)?r(c,f,h):l(v,v.target="_blank")):(v.href=m.createObjectURL(c),setTimeout(function(){m.revokeObjectURL(v.href)},4e4),setTimeout(function(){l(v)},0))}:"msSaveOrOpenBlob"in navigator?function(c,f,h){if(f=f||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,h),f);else if(i(c))r(c,f,h);else{var m=document.createElement("a");m.href=c,m.target="_blank",setTimeout(function(){l(m)})}}:function(c,f,h,m){if(m=m||open("","_blank"),m&&(m.document.title=m.document.body.innerText="downloading..."),typeof c=="string")return r(c,f,h);var v=c.type==="application/octet-stream",w=/constructor/i.test(o.HTMLElement)||o.safari,_=/CriOS\/[\d]+/.test(navigator.userAgent);if((_||v&&w||u)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var p=I.result;p=_?p:p.replace(/^data:[^;]*;/,"data:attachment/file;"),m?m.location.href=p:location=p,m=null},I.readAsDataURL(c)}else{var g=o.URL||o.webkitURL,d=g.createObjectURL(c);m?m.location=d:location.href=d,m=null,setTimeout(function(){g.revokeObjectURL(d)},4e4)}});o.saveAs=a.saveAs=a,t.exports=a})})(fp);var dp=fp.exports;function hp(t,e){let n=e.x,r=e.y,i=0,l=0;const o=[];t.forEach(f=>{const h=f.getBoundingBox();h&&(n=Math.min(n,h.xmin),r=Math.min(r,h.ymin),i=Math.max(i,h.xmax),l=Math.max(l,h.ymax))}),console.log("exporting svg",o);const u=i-n+Gi*2,a=l-r+Gi*2;return t.forEach(f=>{const h=f.getShape();if(!h)return;const v=h.translate(new Rh(new H(n,r),new H(Gi,Gi))).svg();v&&o.push(v)}),{svgString:` - - - ${o.join("")} - - `,width:u,height:a}}function C1(){const t=xe(),e=la(),n=hp(t,e),r=new Blob([n.svgString],{type:"text/svg;charset=utf-8"});dp.saveAs(r,"open-web-cad--drawing.svg")}function L1(t,e,n,r){return new Promise((i,l)=>{const o=document.createElement("canvas"),u=o.getContext("2d");if(!u)throw new Error("Could not get canvas context");const a=new Image,c=new Blob([t],{type:"image/svg+xml"}),f=URL.createObjectURL(c);a.onload=()=>{o.width=e+r*2,o.height=n+r*2,u.fillStyle="white",u.fillRect(0,0,o.width,o.height),u.drawImage(a,r,r),URL.revokeObjectURL(f),o.toBlob(h=>{h?i(h):l(new Error("Could not convert canvas to blob"))},"image/png")},a.src=f})}async function I1(){const t=xe(),e=la(),n=hp(t,e),r=await L1(n.svgString,n.width,n.height,20);dp.saveAs(r,"open-web-cad--drawing.png")}const A1=()=>{const[t,e]=O.useState(W.Line),[n,r]=O.useState(45),i=O.useCallback(()=>{console.log("fetching state updates from outside: ",{activeTool:lt(),angleStep:qs()}),e(lt()),r(qs())},[]);O.useEffect(()=>(window.addEventListener(V.activeTool,i),window.addEventListener(V.angleStep,i),()=>{window.removeEventListener(V.activeTool,i),window.removeEventListener(V.angleStep,i)}),[i]);const l=O.useCallback(u=>{console.log("set active tool: ",u),e(u),Nr(u,!1),de(null),Te([])},[]),o=O.useCallback(u=>{r(u),a1(u,!1)},[]);return F.jsxs("div",{className:"controls absolute top-0 left-0 flex flex-col gap-1 m-1",children:[F.jsx(ve,{title:"Select (s)",icon:nt.Direction,onClick:()=>l(W.Select),active:t===W.Select}),F.jsx(ve,{title:"Line (l)",icon:nt.Line,onClick:()=>l(W.Line),active:t===W.Line}),F.jsx(ve,{title:"Rectangle (r)",icon:nt.Square,onClick:()=>l(W.Rectangle),active:t===W.Rectangle}),F.jsx(ve,{title:"Circle (c)",icon:nt.Circle,onClick:()=>l(W.Circle),active:t===W.Circle}),F.jsx(ve,{className:"mt-2",title:"Undo (ctrl + z)",icon:nt.AntiClockwise,onClick:()=>up()}),F.jsx(ve,{title:"Redo (ctrl + shift + z)",icon:nt.Clockwise,onClick:()=>ap()}),F.jsx(ve,{className:"mt-2",title:"Delete segments",icon:nt.Crop,onClick:()=>l(W.Eraser),active:t===W.Eraser}),F.jsxs(a0,{className:"mt-2",title:"Snap angles",label:n+"°",children:[F.jsx(ve,{title:"Add guide every 5 degrees",label:"5°",onClick:()=>o(5),active:n===5}),F.jsx(ve,{title:"Add guide every 15 degrees",label:"15°",onClick:()=>o(15),active:n===15}),F.jsx(ve,{title:"Add guide every 30 degrees",label:"30°",onClick:()=>o(30),active:n===30}),F.jsx(ve,{title:"Add guide every 45 degrees",label:"45°",onClick:()=>o(45),active:n===45}),F.jsx(ve,{title:"Add guide every 90 degrees",label:"90°",onClick:()=>o(90),active:n===90})]}),F.jsx(ve,{className:"mt-2",title:"Export SVG",label:"SVG",onClick:()=>C1()}),F.jsx(ve,{title:"Export PNG",label:"PNG",onClick:()=>I1()}),F.jsx(ve,{className:"mt-2",title:"Github",icon:nt.Github,onClick:()=>window.open("https://github.com/bertyhell/openwebcad","_blank")})]})};function N1(){return F.jsx("div",{children:F.jsx(A1,{})})}var B=(t=>(t.AngleGuide="AngleGuide",t.LineEndPoint="LineEndPoint",t.Intersection="Intersection",t.CircleCenter="CircleCenter",t.CircleCardinal="CircleCardinal",t.CircleTangent="CircleTangent",t.LineMidPoint="LineMidPoint",t.Point="Point",t))(B||{}),Fl=(t=>(t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Back=3]="Back",t[t.Forward=4]="Forward",t))(Fl||{});function Vc(t){const e=[];for(let n=0;n{const l=on(i.point,e);lu.type!==B.AngleGuide),e);if(ru.type===B.AngleGuide),e);return l(t.Line="Line",t.Circle="Circle",t.Arc="Arc",t.Rectangle="Rectangle",t.SelectionRectangle="SelectionRectangle",t.Point="Point",t))(je||{});function be(t,e){return Math.abs(t.x-e.x)0:!1}isContainedInBox(e){return this.segment?e.contains(this.segment):!1}getBoundingBox(){return this.segment?this.segment.box:null}getShape(){return this.segment}getSnapPoints(){var e,n;return!((e=this.segment)!=null&&e.start)||!((n=this.segment)!=null&&n.end)?[]:[{point:this.segment.start,type:B.LineEndPoint},{point:this.segment.end,type:B.LineEndPoint},{point:this.segment.middle(),type:B.LineMidPoint}]}getIntersections(e){const n=e.getShape();return!this.segment||!n?[]:this.segment.intersect(n)}getFirstPoint(){return this.startPoint}distanceTo(e){return this.segment?this.segment.distanceTo(e):null}getSvgString(){var e;return((e=this.segment)==null?void 0:e.svg())||null}getType(){return je.Line}containsPointOnLine(e){return this.segment?this.segment.contains(e):!1}cutAtPoints(e){if(!this.segment)return[this];const n=Si([this.segment.start,this.segment.end,...e],be),r=so(n,[l=>on(this.segment.start,l)]),i=[];for(let l=0;l{const i=n*e*(Math.PI/180),l=t.x+Math.cos(i),o=t.y+Math.sin(i);return new nr(new H(t.x-1e4*(l-t.x),t.y-1e4*(o-t.y)),new H(t.x+1e4*(l-t.x),t.y+1e4*(o-t.y)))})}function Pi(t,e){let n=null,r=[Number.MAX_SAFE_INTEGER,null];return e.forEach(i=>{const l=i.distanceTo(t);l&&l[0]{const w=M1(v,r),_=Pi(n,w);_.distancev.getSnapPoints()),...Vc(pn(t)).map(v=>({point:v,type:B.Intersection}))],f=Zs(c,n,i);f&&(l=f);const h=[...u,...Vc([...pn(t),...a]).map(v=>({point:v,type:B.Intersection}))],m=Zs(h,n,i);return m&&(o=m),{angleGuides:a,entitySnapPoint:l,angleSnapPoint:o}}function hr(t,e,n,r=_1,i=[]){t.strokeStyle=r,t.lineWidth=1,t.setLineDash(i),e&&(t.lineWidth=2),n&&t.setLineDash([5,5])}function R1(t,e){e.forEach(n=>{hr(t.context,ua(n),Hn(n)),n.draw(t)})}function U1(t,e){e.forEach(n=>{hr(t.context,ua(n),Hn(n),"#FF5500"),n.draw(t)})}function D1(t,e,n){if(!e)return;const r=ft(e.point);hr(t.context,!1,!1,S1);const i=t.context;switch(n&&(i.beginPath(),i.moveTo(r.x-R/2,r.y),i.lineTo(r.x+R/2,r.y),i.moveTo(r.x,r.y-R/2),i.lineTo(r.x,r.y+R/2),i.stroke()),e.type){case B.LineEndPoint:i.strokeRect(r.x-R/2,r.y-R/2,R,R);break;case B.LineMidPoint:i.beginPath(),i.moveTo(r.x,r.y-R/2),i.lineTo(r.x-R/2,r.y+R/2),i.lineTo(r.x+R/2,r.y+R/2),i.closePath(),i.stroke();break;case B.AngleGuide:i.beginPath(),i.moveTo(r.x-R/2,r.y-R/2),i.lineTo(r.x+R/2,r.y-R/2),i.lineTo(r.x-R/2,r.y+R/2),i.lineTo(r.x+R/2,r.y+R/2),i.closePath(),i.stroke();break;case B.Intersection:i.beginPath(),i.moveTo(r.x-R/2,r.y-R/2),i.lineTo(r.x+R/2,r.y+R/2),i.moveTo(r.x+R/2,r.y-R/2),i.lineTo(r.x-R/2,r.y+R/2),i.stroke();break;case B.CircleCenter:i.beginPath(),i.arc(r.x,r.y,R/2,0,2*Math.PI),i.stroke();break;case B.CircleCardinal:i.beginPath(),i.moveTo(r.x,r.y-R/2),i.lineTo(r.x-R/2,r.y),i.lineTo(r.x,r.y+R/2),i.lineTo(r.x+R/2,r.y),i.closePath(),i.stroke();break}}function F1(t,e){e.forEach(n=>{hr(t.context,ua(n),Hn(n),w1,[1,5]),n.draw(t)})}function B1(t,e){hr(t.context,!1,!1),e==null||e.draw(t)}function j1(t,e){e&&(hr(t.context,!1,!1),t.context.beginPath(),t.context.moveTo(t.screenMouseLocation.x,t.screenMouseLocation.y-Yi),t.context.lineTo(t.screenMouseLocation.x,t.screenMouseLocation.y+Yi),t.context.moveTo(t.screenMouseLocation.x-Yi,t.screenMouseLocation.y),t.context.lineTo(t.screenMouseLocation.x+Yi,t.screenMouseLocation.y),t.context.stroke())}function V1(t){var e,n;t.canvasSize!==null&&t.context&&(t.context.fillStyle=y1,t.context.fillRect(0,0,(e=t.canvasSize)==null?void 0:e.x,(n=t.canvasSize)==null?void 0:n.y))}function $1(t){V1(t),F1(t,e1()),R1(t,xe()),U1(t,t1()),B1(t,cr());const{snapPoint:e}=Xs(pn([oa(),lp()]),fr()),n=!!e&&sa().some(r=>r.milliSecondsHovered>pa&&be(r.snapPoint.point,e.point));D1(t,e,n),j1(t,bv())}function H1(t){const e=xe();let r=cr();r||(r=new nr,de(r)),r.send(t)&&(dr([...e,r]),r=new nr,de(r),r.send(t))}class W1{constructor(){re(this,"id",crypto.randomUUID());re(this,"rectangle",null);re(this,"startPoint",null)}send(e){if(this.startPoint){if(!this.rectangle)return this.rectangle=new jt(Math.min(this.startPoint.x,e.x),Math.min(this.startPoint.y,e.y),Math.max(this.startPoint.x,e.x),Math.max(this.startPoint.y,e.y)),!0}else return this.startPoint=e,!1;return!0}draw(e){if(!this.startPoint&&!this.rectangle)return;let n,r;this.rectangle?(n=this.rectangle.high,r=this.rectangle.low):(n=this.startPoint,r=new H(e.worldMouseLocation.x,e.worldMouseLocation.y));const i=ft(n),l=ft(r);e.context.beginPath(),e.context.strokeRect(i.x,i.y,l.x-i.x,l.y-i.y)}intersectsWithBox(e){return this.rectangle?Mh.relate(this.rectangle,e).B2B.length>0:!1}isContainedInBox(e){return this.rectangle?e.contains(this.rectangle):!1}distanceTo(e){if(!this.rectangle)return null;const n=this.rectangle.toSegments().map(i=>i.distanceTo(e));let r=[Number.MAX_SAFE_INTEGER,null];return n.forEach(i=>{i[0]r.intersect(n))}getFirstPoint(){return this.startPoint}getSvgString(){var n,r;const e=(n=this.rectangle)==null?void 0:n.svg();return((r=e==null?void 0:e.replace(/width=([0-9]+)/g,'width="$1"'))==null?void 0:r.replace(/height=([0-9]+)/g,'height="$1"'))||null}getType(){return je.Rectangle}containsPointOnLine(e){return this.rectangle?this.rectangle.toSegments().some(n=>n.contains(e)):!1}}function Q1(t){const e=xe();let r=cr();r||(r=new W1,de(r)),r.send(new H(t.x,t.y))&&(dr([...e,r]),de(null))}function pp(t,e,n){const r=It.getAngle(e,n),i=t.map(l=>({point:l,angle:(new lo(e,l).slope-r+2*Math.PI)%(2*Math.PI)}));return so(i,[l=>l.angle]).map(l=>l.point)}class It{constructor(e,n,r,i){re(this,"id",crypto.randomUUID());re(this,"arc",null);re(this,"centerPoint",null);re(this,"firstPoint",null);if(e&&(this.centerPoint=e),e&&n&&(this.firstPoint=n),e&&n&&r){const l=It.getAngle(e,n),o=It.getAngle(e,r);this.arc=new Ys(e,on(e,n),l,o,i)}}static getAngle(e,n){return new lo(e,n).slope}send(e){if(this.centerPoint){if(!this.firstPoint)this.firstPoint=new H(e.x,e.y);else if(!this.arc){const n=It.getAngle(this.centerPoint,this.firstPoint),r=It.getAngle(this.centerPoint,e);return this.arc=new Ys(this.centerPoint,on(this.centerPoint,this.firstPoint),n,r,r>n),!0}}else return this.centerPoint=ea(e.x,e.y),!1;return!0}draw(e){var l,o;if(!this.centerPoint)return;let n;if(this.arc)n=this.arc.r.valueOf();else if(this.centerPoint&&this.firstPoint)n=on(this.centerPoint,this.firstPoint);else return;const r=ft(this.centerPoint),i=n*e.screenZoom;e.context.beginPath(),e.context.arc(r.x,r.y,i,((l=this.arc)==null?void 0:l.startAngle)||0,((o=this.arc)==null?void 0:o.endAngle)||2*Math.PI),e.context.stroke()}intersectsWithBox(e){return this.arc?this.arc.intersect(e).length>0:!1}isContainedInBox(e){return this.arc?e.contains(this.arc):!1}getBoundingBox(){return this.arc?this.arc.box:null}getShape(){return this.arc}getSnapPoints(){return this.centerPoint===null||this.arc===null?[]:[{point:this.centerPoint,type:B.CircleCenter},{point:this.arc.start,type:B.LineEndPoint},{point:this.arc.end,type:B.LineEndPoint}]}getIntersections(e){const n=e.getShape();return!this.arc||!n?[]:this.arc.intersect(n)}getFirstPoint(){return this.centerPoint}distanceTo(e){return this.arc?this.arc.distanceTo(e):null}getSvgString(){var e;return((e=this.arc)==null?void 0:e.svg())||null}getType(){return je.Arc}containsPointOnLine(e){return this.arc?this.arc.contains(e):!1}cutAtPoints(e){if(!this.arc)return[this];const n=Si([this.arc.start,this.arc.end,...e],be),r=pp(n,this.arc.center,this.arc.start),i=[];for(let l=0;l0:!1}isContainedInBox(e){return this.circle?e.contains(this.circle):!1}getBoundingBox(){return this.circle?this.circle.box:null}getShape(){return this.circle}getSnapPoints(){return this.centerPoint===null||this.circle===null?[]:[{point:this.centerPoint,type:B.CircleCenter},{point:new H(this.centerPoint.x+this.circle.r,this.centerPoint.y),type:B.CircleCardinal},{point:new H(this.centerPoint.x-this.circle.r,this.centerPoint.y),type:B.CircleCardinal},{point:new H(this.centerPoint.x,this.centerPoint.y+this.circle.r),type:B.CircleCardinal},{point:new H(this.centerPoint.x,this.centerPoint.y-this.circle.r),type:B.CircleCardinal}]}getIntersections(e){const n=e.getShape();return!this.circle||!n?[]:this.circle.intersect(n)}getFirstPoint(){return this.centerPoint}distanceTo(e){return this.circle?this.circle.distanceTo(e):null}getSvgString(){var e;return((e=this.circle)==null?void 0:e.svg())||null}getType(){return je.Circle}containsPointOnLine(e){return this.circle?this.circle.contains(e):!1}cutAtPoints(e){if(!this.circle)return[this];const n=[],r=e.length;for(let i=0;ir.x,l=ft(n),o=ft(r);e.context.setLineDash([5,5]),e.context.strokeStyle=i?P1:T1,e.context.lineWidth=1,e.context.beginPath(),e.context.strokeRect(l.x,l.y,o.x-l.x,o.y-l.y)}isIntersectionSelection(){var e;return!this.rectangle||!this.startPoint?!1:Math.abs(this.startPoint.x-((e=this.rectangle)==null?void 0:e.xmin))>Ks}intersectsWithBox(e){return this.rectangle?this.rectangle.intersect(e):!1}isContainedInBox(e){return this.rectangle?e.contains(this.rectangle):!1}getBoundingBox(){return this.rectangle?this.rectangle:null}getShape(){return this.rectangle}getSnapPoints(){return[]}getIntersections(){return[]}getFirstPoint(){return this.startPoint}distanceTo(){return null}getSvgString(){var e;return((e=this.rectangle)==null?void 0:e.svg())||null}getType(){return je.SelectionRectangle}containsPointOnLine(){return!1}}function q1(t,e,n){const r=cr();let i=null;r instanceof Hc&&(i=r);const l=Pi(t,xe());if(l&&l.distancea!==u.id)):Te([...Ho(),u.id]):Te([...Ho(),u.id]);return}i||(console.log("Start a new selection rectangle drag: ",i),i=new Hc,de(i));const o=i.send(new H(t.x,t.y));if(ci([]),o){console.log("Finish selection: ",i);const u=i.isIntersectionSelection(),a=pn(xe().map(c=>{if(u){if(c.intersectsWithBox(i.getBoundingBox())||c.isContainedInBox(i.getBoundingBox()))return e&&Hn(c)?null:c.id}else if(c.isContainedInBox(i.getBoundingBox()))return e&&Hn(c)?null:c.id;return null}));Te(a),console.log("Set active entity to null"),de(null)}}function K1(t,e,n,r,i){if(!t)return;const l=e.at(-1);let o;l?on(t.point,l.snapPoint.point)=pa?o=[...e,{snapPoint:t,milliSecondsHovered:i}]:o=[...e.slice(0,e.length-1),{snapPoint:t,milliSecondsHovered:i}]:o=[{snapPoint:t,milliSecondsHovered:i}];const u=o.slice(0,E1);n(u)}function X1(t,e,n,r){const i=so(Si([e,...r,t,n],be),[o=>on(e,o)]),l=i.findIndex(o=>be(t,o));if(l===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnLine");return[i[l-1]||e,i[l+1]||n]}class ga{constructor(e,n){re(this,"id",crypto.randomUUID());re(this,"point");n?this.point=new H(e,n):this.point=e}draw(e){const n=ft(this.point);e.context.beginPath(),e.context.arc(n.x,n.y,5,0,Math.PI*2),e.context.stroke()}intersectsWithBox(){return!1}isContainedInBox(e){return this.point?e.contains(this.point):!1}getBoundingBox(){return new jt(this.point.x,this.point.y,this.point.x,this.point.y)}getShape(){return this.point}getSnapPoints(){return this.point?[{point:this.point,type:B.Point}]:[]}getIntersections(){return[]}getFirstPoint(){return this.point}distanceTo(e){return this.point?this.point.distanceTo(e):null}getSvgString(){var e;return((e=this.point)==null?void 0:e.svg())||null}getType(){return je.Point}containsPointOnLine(e){return this.point.equalTo(e)}}function Z1(t,e){const n=t.map(r=>({point:r,angle:new lo(e,r).slope}));return so(n,[r=>r.angle]).map(r=>r.point)}function J1(t,e,n){const r=Z1(Si([...n,t],be),e.getShape().center),i=r.findIndex(l=>be(t,l));if(i===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnCircle");return[r[(i+r.length-1)%r.length],r[(i+r.length+1)%r.length]]}function b1(t,e,n){const r=pp(Si([...n,t],be),e.getShape().center,e.getShape().start),i=r.findIndex(l=>be(t,l));if(i===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnArc");return[r[(i+r.length-1)%r.length],r[(i+r.length+1)%r.length]]}function ey(t){const e=Pi(t,xe());if(!e)return;const n=e.segment.start,r=ty(e.entity,xe());switch(e.entity.getType()){case je.Line:{const i=e.entity;Wc(i,n,r);break}case je.Circle:{const i=e.entity;ny(i,n,r);break}case je.Arc:{const i=e.entity;ry(i,n,r);break}case je.Rectangle:{const i=e.entity,u=i.getShape().toSegments().map(a=>new nr(a));tr(i),ao(...u),u.forEach(a=>Wc(a,n,r));break}case je.SelectionRectangle:break}}function ty(t,e){return pn(e.flatMap(n=>t.id===n.id?null:t.getIntersections(n)))}function Wc(t,e,n){const r=t.getShape(),[i,l]=X1(e,r.start,r.end,n);ca([i,l].map(a=>new ga(a)));const u=t.cutAtPoints([i,l]).filter(a=>!a.containsPointOnLine(e));tr(t),ao(...u)}function ny(t,e,n){const[r,i]=J1(e,t,n);ca([r,i].map(o=>new ga(o)));const l=t.cutAtPoints([r,i]);if(be(r,i))tr(t);else{const o=l.filter(u=>!u.containsPointOnLine(e));tr(t),ao(...o)}}function ry(t,e,n){const[r,i]=b1(e,t,n);ca([r,i].map(o=>new ga(o)));const l=t.cutAtPoints([r,i]);if(be(r,i))tr(t);else{const o=l.filter(u=>!u.containsPointOnLine(e));tr(t),ao(...o)}}Wo.createRoot(document.getElementById("root")).render(F.jsx(Rp.StrictMode,{children:F.jsx(N1,{})}));function iy(){aa(!0)}function ly(t){aa(!0),s1(new H(t.clientX,t.clientY));const e=n1(),n=xi(),r=Wt();if(e){const i=new H(n.x-(t.clientX-e.x)/r,n.y-(t.clientY-e.y)/r);fa(new H(t.clientX,t.clientY)),op(i)}if(fy(),lt()===W.Select){const i=Pi(fr(),xe());i.distancec.milliSecondsHovered>pa).map(c=>c.snapPoint.point);if([W.Line,W.Rectangle,W.Circle].includes(t)){let c=null;n&&!n.getShape()&&n.getFirstPoint()&&(c=n.getFirstPoint());const{angleGuides:f,entitySnapPoint:h,angleSnapPoint:m}=z1(r,pn([c,...a]),l,e,da/i);u1(f),f1(h),d1(m)}}function gp(t,e){const n=la(),r=ip(),i=fr(),l=Wt(),o=xi(),u=r1(),a=e-u;p1(e);const c={context:t,canvasSize:n,worldMouseLocation:i,screenMouseLocation:r,screenOffset:o,screenZoom:l};if(lt()===W.Select){const{distance:f,entity:h}=Pi(oo(r),xe());f{gp(t,f)})}function Qc(){console.log("handle window resize",{width:window.innerWidth,height:window.innerHeight}),l1(new H(window.innerWidth,window.innerHeight));const t=Jv();t&&(t.width=window.innerWidth,t.height=window.innerHeight)}function dy(){const t=document.getElementsByTagName("canvas")[0];if(t){o1(t),t.addEventListener("mousedown",uy),t.addEventListener("mousemove",ly),t.addEventListener("mouseup",ay),t.addEventListener("wheel",sy),t.addEventListener("mouseout",oy),t.addEventListener("mouseenter",iy),document.addEventListener("keyup",cy),window.addEventListener("resize",Qc),Qc();const e=t.getContext("2d");if(!e)return;gp(e,0)}}document.addEventListener("DOMContentLoaded",()=>{dy()}); diff --git a/docs/assets/index-Dp0fdRyL.css b/docs/assets/index-BXAbKdOH.css similarity index 70% rename from docs/assets/index-Dp0fdRyL.css rename to docs/assets/index-BXAbKdOH.css index e52ad11..5efc817 100644 --- a/docs/assets/index-Dp0fdRyL.css +++ b/docs/assets/index-BXAbKdOH.css @@ -1 +1 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.static{position:static}.absolute{position:absolute}.relative{position:relative}.-bottom-1{bottom:-.25rem}.left-0{left:0}.left-6{left:1.5rem}.top-0{top:0}.m-1{margin:.25rem}.mt-2{margin-top:.5rem}.flex{display:flex}.h-10{height:2.5rem}.w-10{width:2.5rem}.w-5{width:1.25rem}.-rotate-45{--tw-rotate: -45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.rounded{border-radius:.25rem}.border{border-width:1px}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.bg-gray-950{--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity))}.px-2{padding-left:.5rem;padding-right:.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.font-semibold{font-weight:600}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}canvas{display:block;background-color:#000;cursor:none}.hover\:border-transparent:hover{border-color:transparent}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.data-\[active\=true\]\:border-transparent[data-active=true]{border-color:transparent}.data-\[active\=true\]\:bg-blue-500[data-active=true]{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.data-\[active\=true\]\:text-white[data-active=true]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}body,html{margin:0;padding:0;overflow:hidden;width:100%;height:100%} +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-1{bottom:-.25rem}.left-0{left:0}.left-6{left:1.5rem}.top-0{top:0}.m-1{margin:.25rem}.mt-2{margin-top:.5rem}.flex{display:flex}.h-10{height:2.5rem}.w-10{width:2.5rem}.w-5{width:1.25rem}.-rotate-45{--tw-rotate: -45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.rounded{border-radius:.25rem}.border{border-width:1px}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.bg-gray-950{--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity))}.px-2{padding-left:.5rem;padding-right:.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.font-semibold{font-weight:600}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.opacity-0{opacity:0}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}canvas{display:block;background-color:#000;cursor:none}.hover\:border-transparent:hover{border-color:transparent}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.data-\[active\=true\]\:border-transparent[data-active=true]{border-color:transparent}.data-\[active\=true\]\:bg-blue-500[data-active=true]{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.data-\[active\=true\]\:text-white[data-active=true]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}body,html{margin:0;padding:0;overflow:hidden;width:100%;height:100%} diff --git a/docs/assets/index-DVQh3I_U.js b/docs/assets/index-DVQh3I_U.js new file mode 100644 index 0000000..68e76aa --- /dev/null +++ b/docs/assets/index-DVQh3I_U.js @@ -0,0 +1,66 @@ +var xp=Object.defineProperty;var Sp=(t,e,n)=>e in t?xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ie=(t,e,n)=>Sp(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ep(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xc={exports:{}},jl={},Jc={exports:{}},R={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var di=Symbol.for("react.element"),Pp=Symbol.for("react.portal"),Tp=Symbol.for("react.fragment"),kp=Symbol.for("react.strict_mode"),Cp=Symbol.for("react.profiler"),Lp=Symbol.for("react.provider"),Ip=Symbol.for("react.context"),Ap=Symbol.for("react.forward_ref"),Np=Symbol.for("react.suspense"),Op=Symbol.for("react.memo"),Mp=Symbol.for("react.lazy"),_a=Symbol.iterator;function zp(t){return t===null||typeof t!="object"?null:(t=_a&&t[_a]||t["@@iterator"],typeof t=="function"?t:null)}var Zc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},bc=Object.assign,ef={};function ir(t,e,n){this.props=t,this.context=e,this.refs=ef,this.updater=n||Zc}ir.prototype.isReactComponent={};ir.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};ir.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tf(){}tf.prototype=ir.prototype;function tu(t,e,n){this.props=t,this.context=e,this.refs=ef,this.updater=n||Zc}var nu=tu.prototype=new tf;nu.constructor=tu;bc(nu,ir.prototype);nu.isPureReactComponent=!0;var xa=Array.isArray,nf=Object.prototype.hasOwnProperty,ru={current:null},rf={key:!0,ref:!0,__self:!0,__source:!0};function lf(t,e,n){var r,i={},l=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(l=""+e.key),e)nf.call(e,r)&&!rf.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(u===1)i.children=n;else if(1>>1,se=C[te];if(0>>1;tei(mo,M))bti(Ci,mo)?(C[te]=Ci,C[bt]=M,te=bt):(C[te]=mo,C[Zt]=M,te=Zt);else if(bti(Ci,M))C[te]=Ci,C[bt]=M,te=bt;else break e}}return O}function i(C,O){var M=C.sortIndex-O.sortIndex;return M!==0?M:C.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var o=Date,u=o.now();t.unstable_now=function(){return o.now()-u}}var a=[],c=[],f=1,h=null,m=3,v=!1,_=!1,w=!1,I=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(C){for(var O=n(c);O!==null;){if(O.callback===null)r(c);else if(O.startTime<=C)r(c),O.sortIndex=O.expirationTime,e(a,O);else break;O=n(c)}}function y(C){if(w=!1,p(C),!_)if(n(a)!==null)_=!0,po(S);else{var O=n(c);O!==null&&go(y,O.startTime-C)}}function S(C,O){_=!1,w&&(w=!1,g(L),L=-1),v=!0;var M=m;try{for(p(O),h=n(a);h!==null&&(!(h.expirationTime>O)||C&&!Oe());){var te=h.callback;if(typeof te=="function"){h.callback=null,m=h.priorityLevel;var se=te(h.expirationTime<=O);O=t.unstable_now(),typeof se=="function"?h.callback=se:h===n(a)&&r(a),p(O)}else r(a);h=n(a)}if(h!==null)var ki=!0;else{var Zt=n(c);Zt!==null&&go(y,Zt.startTime-O),ki=!1}return ki}finally{h=null,m=M,v=!1}}var P=!1,k=null,L=-1,B=5,A=-1;function Oe(){return!(t.unstable_now()-AC||125te?(C.sortIndex=M,e(c,C),n(a)===null&&C===n(c)&&(w?(g(L),L=-1):w=!0,go(y,M-te))):(C.sortIndex=se,e(a,C),_||v||(_=!0,po(S))),C},t.unstable_shouldYield=Oe,t.unstable_wrapCallback=function(C){var O=m;return function(){var M=m;m=O;try{return C.apply(this,arguments)}finally{m=M}}}})(cf);af.exports=cf;var Gp=af.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Yp=N,Ue=Gp;function x(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qo=Object.prototype.hasOwnProperty,qp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Ea={},Pa={};function Kp(t){return qo.call(Pa,t)?!0:qo.call(Ea,t)?!1:qp.test(t)?Pa[t]=!0:(Ea[t]=!0,!1)}function Xp(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Jp(t,e,n,r){if(e===null||typeof e>"u"||Xp(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Te(t,e,n,r,i,l,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=l,this.removeEmptyString=o}var me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){me[t]=new Te(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];me[e]=new Te(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){me[t]=new Te(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){me[t]=new Te(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){me[t]=new Te(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){me[t]=new Te(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){me[t]=new Te(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){me[t]=new Te(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){me[t]=new Te(t,5,!1,t.toLowerCase(),null,!1,!1)});var lu=/[\-:]([a-z])/g;function ou(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(lu,ou);me[e]=new Te(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(lu,ou);me[e]=new Te(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(lu,ou);me[e]=new Te(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){me[t]=new Te(t,1,!1,t.toLowerCase(),null,!1,!1)});me.xlinkHref=new Te("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){me[t]=new Te(t,1,!1,t.toLowerCase(),null,!0,!0)});function su(t,e,n,r){var i=me.hasOwnProperty(e)?me[e]:null;(i!==null?i.type!==0:r||!(2u||i[o]!==l[u]){var a=` +`+i[o].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=o&&0<=u);break}}}finally{wo=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Cr(t):""}function Zp(t){switch(t.tag){case 5:return Cr(t.type);case 16:return Cr("Lazy");case 13:return Cr("Suspense");case 19:return Cr("SuspenseList");case 0:case 2:case 15:return t=_o(t.type,!1),t;case 11:return t=_o(t.type.render,!1),t;case 1:return t=_o(t.type,!0),t;default:return""}}function Zo(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 Tn:return"Fragment";case Pn:return"Portal";case Ko:return"Profiler";case uu:return"StrictMode";case Xo:return"Suspense";case Jo:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case hf:return(t.displayName||"Context")+".Consumer";case df:return(t._context.displayName||"Context")+".Provider";case au:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case cu:return e=t.displayName||null,e!==null?e:Zo(t.type)||"Memo";case Ct:e=t._payload,t=t._init;try{return Zo(t(e))}catch{}}return null}function bp(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 Zo(e);case 8:return e===uu?"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 Ht(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function gf(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function eg(t){var e=gf(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,l.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ai(t){t._valueTracker||(t._valueTracker=eg(t))}function mf(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=gf(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function al(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 bo(t,e){var n=e.checked;return b({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function ka(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ht(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function vf(t,e){e=e.checked,e!=null&&su(t,"checked",e,!1)}function es(t,e){vf(t,e);var n=Ht(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?ts(t,e.type,n):e.hasOwnProperty("defaultValue")&&ts(t,e.type,Ht(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Ca(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="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 ts(t,e,n){(e!=="number"||al(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Lr=Array.isArray;function Fn(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Ni.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Gr(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Mr={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},tg=["Webkit","ms","Moz","O"];Object.keys(Mr).forEach(function(t){tg.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Mr[e]=Mr[t]})});function xf(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Mr.hasOwnProperty(t)&&Mr[t]?(""+e).trim():e+"px"}function Sf(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=xf(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var ng=b({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 is(t,e){if(e){if(ng[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(x(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(x(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(x(61))}if(e.style!=null&&typeof e.style!="object")throw Error(x(62))}}function ls(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 os=null;function fu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ss=null,Bn=null,jn=null;function Aa(t){if(t=gi(t)){if(typeof ss!="function")throw Error(x(280));var e=t.stateNode;e&&(e=Ql(e),ss(t.stateNode,t.type,e))}}function Ef(t){Bn?jn?jn.push(t):jn=[t]:Bn=t}function Pf(){if(Bn){var t=Bn,e=jn;if(jn=Bn=null,Aa(t),e)for(t=0;t>>=0,t===0?32:31-(hg(t)/pg|0)|0}var Oi=64,Mi=4194304;function Ir(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 hl(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,l=t.pingedLanes,o=n&268435455;if(o!==0){var u=o&~i;u!==0?r=Ir(u):(l&=o,l!==0&&(r=Ir(l)))}else o=n&~i,o!==0?r=Ir(o):l!==0&&(r=Ir(l));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,l=e&-e,i>=l||i===16&&(l&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function hi(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Je(e),t[e]=n}function yg(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 r=t.eventTimes;for(t=t.expirationTimes;0=Rr),Ba=" ",ja=!1;function Wf(t,e){switch(t){case"keyup":return Gg.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var kn=!1;function qg(t,e){switch(t){case"compositionend":return Qf(e);case"keypress":return e.which!==32?null:(ja=!0,Ba);case"textInput":return t=e.data,t===Ba&&ja?null:t;default:return null}}function Kg(t,e){if(kn)return t==="compositionend"||!wu&&Wf(t,e)?(t=$f(),Zi=mu=Ot=null,kn=!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=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Wa(n)}}function Kf(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Kf(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Xf(){for(var t=window,e=al();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=al(t.document)}return e}function _u(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 im(t){var e=Xf(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&Kf(n.ownerDocument.documentElement,n)){if(r!==null&&_u(n)){if(e=r.start,t=r.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 i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!t.extend&&l>r&&(i=r,r=l,l=i),i=Qa(n,l);var o=Qa(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),l>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.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,Cn=null,hs=null,Dr=null,ps=!1;function Ga(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ps||Cn==null||Cn!==al(r)||(r=Cn,"selectionStart"in r&&_u(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&Zr(Dr,r)||(Dr=r,r=ml(hs,"onSelect"),0An||(t.current=_s[An],_s[An]=null,An--)}function Q(t,e){An++,_s[An]=t.current,t.current=e}var Wt={},_e=Kt(Wt),Ie=Kt(!1),an=Wt;function Yn(t,e){var n=t.type.contextTypes;if(!n)return Wt;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=e[l];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Ae(t){return t=t.childContextTypes,t!=null}function yl(){q(Ie),q(_e)}function ba(t,e,n){if(_e.current!==Wt)throw Error(x(168));Q(_e,e),Q(Ie,n)}function ld(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(x(108,bp(t)||"Unknown",i));return b({},n,r)}function wl(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Wt,an=_e.current,Q(_e,t),Q(Ie,Ie.current),!0}function ec(t,e,n){var r=t.stateNode;if(!r)throw Error(x(169));n?(t=ld(t,e,an),r.__reactInternalMemoizedMergedChildContext=t,q(Ie),q(_e),Q(_e,t)):q(Ie),Q(Ie,n)}var gt=null,Gl=!1,zo=!1;function od(t){gt===null?gt=[t]:gt.push(t)}function mm(t){Gl=!0,od(t)}function Xt(){if(!zo&>!==null){zo=!0;var t=0,e=H;try{var n=gt;for(H=1;t>=o,i-=o,mt=1<<32-Je(e)+i|n<L?(B=k,k=null):B=k.sibling;var A=m(g,k,p[L],y);if(A===null){k===null&&(k=B);break}t&&k&&A.alternate===null&&e(g,k),d=l(A,d,L),P===null?S=A:P.sibling=A,P=A,k=B}if(L===p.length)return n(g,k),K&&tn(g,L),S;if(k===null){for(;LL?(B=k,k=null):B=k.sibling;var Oe=m(g,k,A.value,y);if(Oe===null){k===null&&(k=B);break}t&&k&&Oe.alternate===null&&e(g,k),d=l(Oe,d,L),P===null?S=Oe:P.sibling=Oe,P=Oe,k=B}if(A.done)return n(g,k),K&&tn(g,L),S;if(k===null){for(;!A.done;L++,A=p.next())A=h(g,A.value,y),A!==null&&(d=l(A,d,L),P===null?S=A:P.sibling=A,P=A);return K&&tn(g,L),S}for(k=r(g,k);!A.done;L++,A=p.next())A=v(k,g,L,A.value,y),A!==null&&(t&&A.alternate!==null&&k.delete(A.key===null?L:A.key),d=l(A,d,L),P===null?S=A:P.sibling=A,P=A);return t&&k.forEach(function(gr){return e(g,gr)}),K&&tn(g,L),S}function I(g,d,p,y){if(typeof p=="object"&&p!==null&&p.type===Tn&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Ii:e:{for(var S=p.key,P=d;P!==null;){if(P.key===S){if(S=p.type,S===Tn){if(P.tag===7){n(g,P.sibling),d=i(P,p.props.children),d.return=g,g=d;break e}}else if(P.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ct&&rc(S)===P.type){n(g,P.sibling),d=i(P,p.props),d.ref=Er(g,P,p),d.return=g,g=d;break e}n(g,P);break}else e(g,P);P=P.sibling}p.type===Tn?(d=un(p.props.children,g.mode,y,p.key),d.return=g,g=d):(y=ol(p.type,p.key,p.props,null,g.mode,y),y.ref=Er(g,d,p),y.return=g,g=y)}return o(g);case Pn:e:{for(P=p.key;d!==null;){if(d.key===P)if(d.tag===4&&d.stateNode.containerInfo===p.containerInfo&&d.stateNode.implementation===p.implementation){n(g,d.sibling),d=i(d,p.children||[]),d.return=g,g=d;break e}else{n(g,d);break}else e(g,d);d=d.sibling}d=$o(p,g.mode,y),d.return=g,g=d}return o(g);case Ct:return P=p._init,I(g,d,P(p._payload),y)}if(Lr(p))return _(g,d,p,y);if(yr(p))return w(g,d,p,y);ji(g,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,d!==null&&d.tag===6?(n(g,d.sibling),d=i(d,p),d.return=g,g=d):(n(g,d),d=Vo(p,g.mode,y),d.return=g,g=d),o(g)):n(g,d)}return I}var Kn=cd(!0),fd=cd(!1),Sl=Kt(null),El=null,Mn=null,Pu=null;function Tu(){Pu=Mn=El=null}function ku(t){var e=Sl.current;q(Sl),t._currentValue=e}function Es(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function $n(t,e){El=t,Pu=Mn=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Le=!0),t.firstContext=null)}function We(t){var e=t._currentValue;if(Pu!==t)if(t={context:t,memoizedValue:e,next:null},Mn===null){if(El===null)throw Error(x(308));Mn=t,El.dependencies={lanes:0,firstContext:t}}else Mn=Mn.next=t;return e}var ln=null;function Cu(t){ln===null?ln=[t]:ln.push(t)}function dd(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,Cu(e)):(n.next=i.next,i.next=n),e.interleaved=n,St(t,r)}function St(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Lt=!1;function Lu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hd(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function yt(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ft(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,St(t,n)}return i=r.interleaved,i===null?(e.next=e,Cu(r)):(e.next=i.next,i.next=e),r.interleaved=e,St(t,n)}function el(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,hu(t,n)}}function ic(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=o:l=l.next=o,n=n.next}while(n!==null);l===null?i=l=e:l=l.next=e}else i=l=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Pl(t,e,n,r){var i=t.updateQueue;Lt=!1;var l=i.firstBaseUpdate,o=i.lastBaseUpdate,u=i.shared.pending;if(u!==null){i.shared.pending=null;var a=u,c=a.next;a.next=null,o===null?l=c:o.next=c,o=a;var f=t.alternate;f!==null&&(f=f.updateQueue,u=f.lastBaseUpdate,u!==o&&(u===null?f.firstBaseUpdate=c:u.next=c,f.lastBaseUpdate=a))}if(l!==null){var h=i.baseState;o=0,f=c=a=null,u=l;do{var m=u.lane,v=u.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:v,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var _=t,w=u;switch(m=e,v=n,w.tag){case 1:if(_=w.payload,typeof _=="function"){h=_.call(v,h,m);break e}h=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=w.payload,m=typeof _=="function"?_.call(v,h,m):_,m==null)break e;h=b({},h,m);break e;case 2:Lt=!0}}u.callback!==null&&u.lane!==0&&(t.flags|=64,m=i.effects,m===null?i.effects=[u]:m.push(u))}else v={eventTime:v,lane:m,tag:u.tag,payload:u.payload,callback:u.callback,next:null},f===null?(c=f=v,a=h):f=f.next=v,o|=m;if(u=u.next,u===null){if(u=i.shared.pending,u===null)break;m=u,u=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);if(f===null&&(a=h),i.baseState=a,i.firstBaseUpdate=c,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else l===null&&(i.shared.lanes=0);dn|=o,t.lanes=o,t.memoizedState=h}}function lc(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Uo.transition;Uo.transition={};try{t(!1),e()}finally{H=n,Uo.transition=r}}function Ad(){return Qe().memoizedState}function _m(t,e,n){var r=jt(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Nd(t))Od(e,n);else if(n=dd(t,e,n,r),n!==null){var i=Ee();Ze(n,t,r,i),Md(n,e,r)}}function xm(t,e,n){var r=jt(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Nd(t))Od(e,i);else{var l=t.alternate;if(t.lanes===0&&(l===null||l.lanes===0)&&(l=e.lastRenderedReducer,l!==null))try{var o=e.lastRenderedState,u=l(o,n);if(i.hasEagerState=!0,i.eagerState=u,be(u,o)){var a=e.interleaved;a===null?(i.next=i,Cu(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}n=dd(t,e,i,r),n!==null&&(i=Ee(),Ze(n,t,r,i),Md(n,e,r))}}function Nd(t){var e=t.alternate;return t===Z||e!==null&&e===Z}function Od(t,e){Fr=kl=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Md(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,hu(t,n)}}var Cl={readContext:We,useCallback:ve,useContext:ve,useEffect:ve,useImperativeHandle:ve,useInsertionEffect:ve,useLayoutEffect:ve,useMemo:ve,useReducer:ve,useRef:ve,useState:ve,useDebugValue:ve,useDeferredValue:ve,useTransition:ve,useMutableSource:ve,useSyncExternalStore:ve,useId:ve,unstable_isNewReconciler:!1},Sm={readContext:We,useCallback:function(t,e){return nt().memoizedState=[t,e===void 0?null:e],t},useContext:We,useEffect:sc,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,nl(4194308,4,Td.bind(null,e,t),n)},useLayoutEffect:function(t,e){return nl(4194308,4,t,e)},useInsertionEffect:function(t,e){return nl(4,2,t,e)},useMemo:function(t,e){var n=nt();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=nt();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=_m.bind(null,Z,t),[r.memoizedState,t]},useRef:function(t){var e=nt();return t={current:t},e.memoizedState=t},useState:oc,useDebugValue:Uu,useDeferredValue:function(t){return nt().memoizedState=t},useTransition:function(){var t=oc(!1),e=t[0];return t=wm.bind(null,t[1]),nt().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Z,i=nt();if(K){if(n===void 0)throw Error(x(407));n=n()}else{if(n=e(),fe===null)throw Error(x(349));fn&30||vd(r,e,n)}i.memoizedState=n;var l={value:n,getSnapshot:e};return i.queue=l,sc(wd.bind(null,r,l,t),[t]),r.flags|=2048,oi(9,yd.bind(null,r,l,n,e),void 0,null),n},useId:function(){var t=nt(),e=fe.identifierPrefix;if(K){var n=vt,r=mt;n=(r&~(1<<32-Je(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ii++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[lt]=e,t[ti]=r,Hd(t,e,!1,!1),e.stateNode=t;e:{switch(o=ls(n,r),n){case"dialog":G("cancel",t),G("close",t),i=r;break;case"iframe":case"object":case"embed":G("load",t),i=r;break;case"video":case"audio":for(i=0;iZn&&(e.flags|=128,r=!0,Pr(l,!1),e.lanes=4194304)}else{if(!r)if(t=Tl(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Pr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!K)return ye(e),null}else 2*ne()-l.renderingStartTime>Zn&&n!==1073741824&&(e.flags|=128,r=!0,Pr(l,!1),e.lanes=4194304);l.isBackwards?(o.sibling=e.child,e.child=o):(n=l.last,n!==null?n.sibling=o:e.child=o,l.last=o)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ne(),e.sibling=null,n=X.current,Q(X,r?n&1|2:n&1),e):(ye(e),null);case 22:case 23:return $u(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Me&1073741824&&(ye(e),e.subtreeFlags&6&&(e.flags|=8192)):ye(e),null;case 24:return null;case 25:return null}throw Error(x(156,e.tag))}function Am(t,e){switch(Su(e),e.tag){case 1:return Ae(e.type)&&yl(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Xn(),q(Ie),q(_e),Nu(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Au(e),null;case 13:if(q(X),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(x(340));qn()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return q(X),null;case 4:return Xn(),null;case 10:return ku(e.type._context),null;case 22:case 23:return $u(),null;case 24:return null;default:return null}}var $i=!1,we=!1,Nm=typeof WeakSet=="function"?WeakSet:Set,T=null;function zn(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ee(t,e,r)}else n.current=null}function Os(t,e,n){try{n()}catch(r){ee(t,e,r)}}var yc=!1;function Om(t,e){if(gs=pl,t=Xf(),_u(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var o=0,u=-1,a=-1,c=0,f=0,h=t,m=null;t:for(;;){for(var v;h!==n||i!==0&&h.nodeType!==3||(u=o+i),h!==l||r!==0&&h.nodeType!==3||(a=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)m=h,h=v;for(;;){if(h===t)break t;if(m===n&&++c===i&&(u=o),m===l&&++f===r&&(a=o),(v=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=v}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(ms={focusedElem:t,selectionRange:n},pl=!1,T=e;T!==null;)if(e=T,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,T=t;else for(;T!==null;){e=T;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var w=_.memoizedProps,I=_.memoizedState,g=e.stateNode,d=g.getSnapshotBeforeUpdate(e.elementType===e.type?w:Ye(e.type,w),I);g.__reactInternalSnapshotBeforeUpdate=d}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(x(163))}}catch(y){ee(e,e.return,y)}if(t=e.sibling,t!==null){t.return=e.return,T=t;break}T=e.return}return _=yc,yc=!1,_}function Br(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var l=i.destroy;i.destroy=void 0,l!==void 0&&Os(e,n,l)}i=i.next}while(i!==r)}}function Kl(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 r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Ms(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 Gd(t){var e=t.alternate;e!==null&&(t.alternate=null,Gd(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[lt],delete e[ti],delete e[ws],delete e[pm],delete e[gm])),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 Yd(t){return t.tag===5||t.tag===3||t.tag===4}function wc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Yd(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 zs(t,e,n){var r=t.tag;if(r===5||r===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=vl));else if(r!==4&&(t=t.child,t!==null))for(zs(t,e,n),t=t.sibling;t!==null;)zs(t,e,n),t=t.sibling}function Rs(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Rs(t,e,n),t=t.sibling;t!==null;)Rs(t,e,n),t=t.sibling}var he=null,qe=!1;function kt(t,e,n){for(n=n.child;n!==null;)qd(t,e,n),n=n.sibling}function qd(t,e,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Vl,n)}catch{}switch(n.tag){case 5:we||zn(n,e);case 6:var r=he,i=qe;he=null,kt(t,e,n),he=r,qe=i,he!==null&&(qe?(t=he,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):he.removeChild(n.stateNode));break;case 18:he!==null&&(qe?(t=he,n=n.stateNode,t.nodeType===8?Mo(t.parentNode,n):t.nodeType===1&&Mo(t,n),Xr(t)):Mo(he,n.stateNode));break;case 4:r=he,i=qe,he=n.stateNode.containerInfo,qe=!0,kt(t,e,n),he=r,qe=i;break;case 0:case 11:case 14:case 15:if(!we&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,o=l.destroy;l=l.tag,o!==void 0&&(l&2||l&4)&&Os(n,e,o),i=i.next}while(i!==r)}kt(t,e,n);break;case 1:if(!we&&(zn(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ee(n,e,u)}kt(t,e,n);break;case 21:kt(t,e,n);break;case 22:n.mode&1?(we=(r=we)||n.memoizedState!==null,kt(t,e,n),we=r):kt(t,e,n);break;default:kt(t,e,n)}}function _c(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Nm),e.forEach(function(r){var i=Vm.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ge(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~l}if(r=i,r=ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zm(r/1960))-r,10t?16:t,Mt===null)var r=!1;else{if(t=Mt,Mt=null,Al=0,F&6)throw Error(x(331));var i=F;for(F|=4,T=t.current;T!==null;){var l=T,o=l.child;if(T.flags&16){var u=l.deletions;if(u!==null){for(var a=0;ane()-ju?sn(t,0):Bu|=n),Ne(t,e)}function nh(t,e){e===0&&(t.mode&1?(e=Mi,Mi<<=1,!(Mi&130023424)&&(Mi=4194304)):e=1);var n=Ee();t=St(t,e),t!==null&&(hi(t,e,n),Ne(t,n))}function jm(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),nh(t,n)}function Vm(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(x(314))}r!==null&&r.delete(e),nh(t,n)}var rh;rh=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Ie.current)Le=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Le=!1,Lm(t,e,n);Le=!!(t.flags&131072)}else Le=!1,K&&e.flags&1048576&&sd(e,xl,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;rl(t,e),t=e.pendingProps;var i=Yn(e,_e.current);$n(e,n),i=Mu(null,e,r,t,i,n);var l=zu();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ae(r)?(l=!0,wl(e)):l=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Lu(e),i.updater=ql,e.stateNode=i,i._reactInternals=e,Ts(e,r,t,n),e=Ls(null,e,r,!0,l,n)):(e.tag=0,K&&l&&xu(e),Se(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(rl(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Hm(r),t=Ye(r,t),i){case 0:e=Cs(null,e,r,t,n);break e;case 1:e=gc(null,e,r,t,n);break e;case 11:e=hc(null,e,r,t,n);break e;case 14:e=pc(null,e,r,Ye(r.type,t),n);break e}throw Error(x(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ye(r,i),Cs(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ye(r,i),gc(t,e,r,i,n);case 3:e:{if(jd(e),t===null)throw Error(x(387));r=e.pendingProps,l=e.memoizedState,i=l.element,hd(t,e),Pl(e,r,null,n);var o=e.memoizedState;if(r=o.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=l,e.memoizedState=l,e.flags&256){i=Jn(Error(x(423)),e),e=mc(t,e,r,n,i);break e}else if(r!==i){i=Jn(Error(x(424)),e),e=mc(t,e,r,n,i);break e}else for(ze=Dt(e.stateNode.containerInfo.firstChild),Re=e,K=!0,Ke=null,n=fd(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qn(),r===i){e=Et(t,e,n);break e}Se(t,e,r,n)}e=e.child}return e;case 5:return pd(e),t===null&&Ss(e),r=e.type,i=e.pendingProps,l=t!==null?t.memoizedProps:null,o=i.children,vs(r,i)?o=null:l!==null&&vs(r,l)&&(e.flags|=32),Bd(t,e),Se(t,e,o,n),e.child;case 6:return t===null&&Ss(e),null;case 13:return Vd(t,e,n);case 4:return Iu(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Kn(e,null,r,n):Se(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ye(r,i),hc(t,e,r,i,n);case 7:return Se(t,e,e.pendingProps,n),e.child;case 8:return Se(t,e,e.pendingProps.children,n),e.child;case 12:return Se(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,l=e.memoizedProps,o=i.value,Q(Sl,r._currentValue),r._currentValue=o,l!==null)if(be(l.value,o)){if(l.children===i.children&&!Ie.current){e=Et(t,e,n);break e}}else for(l=e.child,l!==null&&(l.return=e);l!==null;){var u=l.dependencies;if(u!==null){o=l.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(l.tag===1){a=yt(-1,n&-n),a.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?a.next=a:(a.next=f.next,f.next=a),c.pending=a}}l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),Es(l.return,n,e),u.lanes|=n;break}a=a.next}}else if(l.tag===10)o=l.type===e.type?null:l.child;else if(l.tag===18){if(o=l.return,o===null)throw Error(x(341));o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Es(o,n,e),o=l.sibling}else o=l.child;if(o!==null)o.return=l;else for(o=l;o!==null;){if(o===e){o=null;break}if(l=o.sibling,l!==null){l.return=o.return,o=l;break}o=o.return}l=o}Se(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,$n(e,n),i=We(i),r=r(i),e.flags|=1,Se(t,e,r,n),e.child;case 14:return r=e.type,i=Ye(r,e.pendingProps),i=Ye(r.type,i),pc(t,e,r,i,n);case 15:return Dd(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ye(r,i),rl(t,e),e.tag=1,Ae(r)?(t=!0,wl(e)):t=!1,$n(e,n),zd(e,r,i),Ts(e,r,i,n),Ls(null,e,r,!0,t,n);case 19:return $d(t,e,n);case 22:return Fd(t,e,n)}throw Error(x(156,e.tag))};function ih(t,e){return Nf(t,e)}function $m(t,e,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $e(t,e,n,r){return new $m(t,e,n,r)}function Wu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Hm(t){if(typeof t=="function")return Wu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===au)return 11;if(t===cu)return 14}return 2}function Vt(t,e){var n=t.alternate;return n===null?(n=$e(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 ol(t,e,n,r,i,l){var o=2;if(r=t,typeof t=="function")Wu(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Tn:return un(n.children,i,l,e);case uu:o=8,i|=8;break;case Ko:return t=$e(12,n,e,i|2),t.elementType=Ko,t.lanes=l,t;case Xo:return t=$e(13,n,e,i),t.elementType=Xo,t.lanes=l,t;case Jo:return t=$e(19,n,e,i),t.elementType=Jo,t.lanes=l,t;case pf:return Jl(n,i,l,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case df:o=10;break e;case hf:o=9;break e;case au:o=11;break e;case cu:o=14;break e;case Ct:o=16,r=null;break e}throw Error(x(130,t==null?t:typeof t,""))}return e=$e(o,n,e,i),e.elementType=t,e.type=r,e.lanes=l,e}function un(t,e,n,r){return t=$e(7,t,r,e),t.lanes=n,t}function Jl(t,e,n,r){return t=$e(22,t,r,e),t.elementType=pf,t.lanes=n,t.stateNode={isHidden:!1},t}function Vo(t,e,n){return t=$e(6,t,null,e),t.lanes=n,t}function $o(t,e,n){return e=$e(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Wm(t,e,n,r,i){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=So(0),this.expirationTimes=So(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=So(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Qu(t,e,n,r,i,l,o,u,a){return t=new Wm(t,e,n,u,a),e===1?(e=1,l===!0&&(e|=8)):e=0,l=$e(3,null,null,e),t.current=l,l.stateNode=t,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lu(l),t}function Qm(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uh)}catch(t){console.error(t)}}uh(),uf.exports=De;var Xm=uf.exports,Lc=Xm;Yo.createRoot=Lc.createRoot,Yo.hydrateRoot=Lc.hydrateRoot;const Jm=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M2 2l11 11M1.5 2.5a1 1 0 110-2 1 1 0 010 2zm12 12a1 1 0 110-2 1 1 0 010 2z",stroke:"currentColor"})),Zm=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M13.5.5h-12a1 1 0 00-1 1v12a1 1 0 001 1h12a1 1 0 001-1v-12a1 1 0 00-1-1z",stroke:"currentColor"})),bm=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M.5 7.5a7 7 0 1014 0 7 7 0 00-14 0z",stroke:"currentColor"})),e0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M.5.5l6 14 2-6 6-2-14-6z",stroke:"currentColor",strokeLinejoin:"round"})),t0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M13.5 3.5h.5v-.207l-.146-.147-.354.354zm-3-3l.354-.354L10.707 0H10.5v.5zm-7 4V4H3v.5h.5zm2 0H6V4h-.5v.5zm0 2V7H6v-.5h-.5zm-2 0H3V7h.5v-.5zm8-2h.5V4h-.5v.5zm0 2V7h.5v-.5h-.5zm-2 0H9V7h.5v-.5zm0-2V4H9v.5h.5zm-6 6V10H3v.5h.5zm2 0H6V10h-.5v.5zm0 2v.5H6v-.5h-.5zm-2 0H3v.5h.5v-.5zm6-2V10H9v.5h.5zm0 2H9v.5h.5v-.5zm2 0v.5h.5v-.5h-.5zm0-2h.5V10h-.5v.5zm1 3.5h-10v1h10v-1zM2 13.5v-12H1v12h1zm11-10v10h1v-10h-1zM2.5 1h8V0h-8v1zm7.646-.146l3 3 .708-.708-3-3-.708.708zM2.5 14a.5.5 0 01-.5-.5H1A1.5 1.5 0 002.5 15v-1zm10 1a1.5 1.5 0 001.5-1.5h-1a.5.5 0 01-.5.5v1zM2 1.5a.5.5 0 01.5-.5V0A1.5 1.5 0 001 1.5h1zM3.5 5h2V4h-2v1zM5 4.5v2h1v-2H5zM5.5 6h-2v1h2V6zM4 6.5v-2H3v2h1zm7-2v2h1v-2h-1zm.5 1.5h-2v1h2V6zm-1.5.5v-2H9v2h1zM9.5 5h2V4h-2v1zm-6 6h2v-1h-2v1zm1.5-.5v2h1v-2H5zm.5 1.5h-2v1h2v-1zm-1.5.5v-2H3v2h1zm5-2v2h1v-2H9zm.5 2.5h2v-1h-2v1zm2.5-.5v-2h-1v2h1zm-.5-2.5h-2v1h2v-1zm-6-4h4V5h-4v1zM4 6.5v4h1v-4H4zm6 0v4h1v-4h-1zM5.5 12h4v-1h-4v1z",fill:"currentColor"})),n0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M4.5 4.5v-3a1 1 0 011-1h8a1 1 0 011 1v8a1 1 0 01-1 1h-3m-6-6h-3a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1v-3m-6-6V7m0-2.5H7m3.5 6H8m2.5 0V8M8 4.5h2.5V7m-6 1v2.5H7",stroke:"currentColor"})),r0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M13.5 3.5h.5v-.207l-.146-.147-.354.354zm-3-3l.354-.354L10.707 0H10.5v.5zm-8 6V6H2v.5h.5zm0 2H2V9h.5v-.5zm2 0H5V8h-.5v.5zm0 2v.5H5v-.5h-.5zm2-1H6v.207l.146.147L6.5 9.5zm1 1l-.354.354.354.353.354-.353L7.5 10.5zm1-1l.354.354L9 9.707V9.5h-.5zm2-3V6H10v.5h.5zm0 4H10v.5h.5v-.5zm2 0v.5h.5v-.5h-.5zM2 5V1.5H1V5h1zm11-1.5V5h1V3.5h-1zM2.5 1h8V0h-8v1zm7.646-.146l3 3 .708-.708-3-3-.708.708zM2 1.5a.5.5 0 01.5-.5V0A1.5 1.5 0 001 1.5h1zM1 12v1.5h1V12H1zm1.5 3h10v-1h-10v1zM14 13.5V12h-1v1.5h1zM12.5 15a1.5 1.5 0 001.5-1.5h-1a.5.5 0 01-.5.5v1zM1 13.5A1.5 1.5 0 002.5 15v-1a.5.5 0 01-.5-.5H1zM5 6H2.5v1H5V6zm-3 .5v2h1v-2H2zM2.5 9h2V8h-2v1zM4 8.5v2h1v-2H4zm.5 1.5H2v1h2.5v-1zM6 6v3.5h1V6H6zm.146 3.854l1 1 .708-.708-1-1-.708.708zm1.708 1l1-1-.708-.708-1 1 .708.708zM9 9.5V6H8v3.5h1zM13 6h-2.5v1H13V6zm-3 .5v4h1v-4h-1zm.5 4.5h2v-1h-2v1zm2.5-.5v-2h-1v2h1z",fill:"currentColor"})),i0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M7.5 12L0 4h15l-7.5 8z",fill:"currentColor"})),l0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M7.5 3l7.5 8H0l7.5-8z",fill:"currentColor"})),o0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M7.5 4.793L3.293 9h8.414L7.5 4.793z",fill:"currentColor"})),s0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M7.5 10.207L11.707 6H3.293L7.5 10.207z",fill:"currentColor"})),u0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M6.5 2.499l-.354-.354-.353.354.353.353L6.5 2.5zm1-.5H7v1h.5v-1zM2 8.495v-.5H1v.5h1zM8.145.146l-1.999 2 .708.706L8.853.854 8.145.146zM6.146 2.852l2 1.999.707-.707-2-1.999-.707.707zM7.5 3C10.537 3 13 5.461 13 8.496h1A6.499 6.499 0 007.5 2v1zM13 8.495a5.499 5.499 0 01-5.5 5.496v1c3.589 0 6.5-2.909 6.5-6.496h-1zM7.5 13.99A5.499 5.499 0 012 8.495H1a6.499 6.499 0 006.5 6.496v-1z",fill:"currentColor"})),a0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M14 8.495v-.5h-1v.5h1zM7.5 2.999H8v-1h-.5v1zm1-.5l.353.353.354-.353-.354-.354-.353.354zM13 8.495a5.499 5.499 0 01-5.5 5.496v1c3.589 0 6.5-2.909 6.5-6.496h-1zM7.5 13.99A5.499 5.499 0 012 8.495H1a6.499 6.499 0 006.5 6.496v-1zM2 8.495a5.499 5.499 0 015.5-5.496v-1A6.499 6.499 0 001 8.495h1zM6.147.854l2 1.998.706-.707-2-1.999-.706.708zm2 1.291l-2 1.999.706.707 2-1.999-.706-.707z",fill:"currentColor"})),c0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M5.65 12.477a.5.5 0 10-.3-.954l.3.954zm-3.648-2.96l-.484-.128-.254.968.484.127.254-.968zM9 14.5v.5h1v-.5H9zm.063-4.813l-.054-.497a.5.5 0 00-.299.852l.352-.354zM12.5 5.913h.5V5.91l-.5.002zm-.833-2.007l-.466-.18a.5.5 0 00.112.533l.354-.353zm-.05-2.017l.456-.204a.5.5 0 00-.319-.276l-.137.48zm-2.173.792l-.126.484a.5.5 0 00.398-.064l-.272-.42zm-3.888 0l-.272.42a.5.5 0 00.398.064l-.126-.484zM3.383 1.89l-.137-.48a.5.5 0 00-.32.276l.457.204zm-.05 2.017l.354.353a.5.5 0 00.112-.534l-.466.181zM2.5 5.93H3v-.002l-.5.002zm3.438 3.758l.352.355a.5.5 0 00-.293-.851l-.06.496zM5.5 11H6l-.001-.037L5.5 11zM5 14.5v.5h1v-.5H5zm.35-2.977c-.603.19-.986.169-1.24.085-.251-.083-.444-.25-.629-.49a4.8 4.8 0 01-.27-.402c-.085-.139-.182-.302-.28-.447-.191-.281-.473-.633-.929-.753l-.254.968c.08.02.184.095.355.346.082.122.16.252.258.412.094.152.202.32.327.484.253.33.598.663 1.11.832.51.168 1.116.15 1.852-.081l-.3-.954zm4.65-.585c0-.318-.014-.608-.104-.878-.096-.288-.262-.51-.481-.727l-.705.71c.155.153.208.245.237.333.035.105.053.254.053.562h1zm-.884-.753c.903-.097 1.888-.325 2.647-.982.78-.675 1.237-1.729 1.237-3.29h-1c0 1.359-.39 2.1-.892 2.534-.524.454-1.258.653-2.099.743l.107.995zM13 5.91a3.354 3.354 0 00-.98-2.358l-.707.706c.438.44.685 1.034.687 1.655l1-.003zm-.867-1.824c.15-.384.22-.794.21-1.207l-1 .025a2.12 2.12 0 01-.142.82l.932.362zm.21-1.207a3.119 3.119 0 00-.27-1.195l-.913.408c.115.256.177.532.184.812l1-.025zm-.726-.99c.137-.481.137-.482.136-.482h-.003l-.004-.002a.462.462 0 00-.03-.007 1.261 1.261 0 00-.212-.024 2.172 2.172 0 00-.51.054c-.425.091-1.024.317-1.82.832l.542.84c.719-.464 1.206-.634 1.488-.694a1.2 1.2 0 01.306-.03l-.008-.001a.278.278 0 01-.01-.002l-.006-.002h-.003l-.002-.001c-.001 0-.002 0 .136-.482zm-2.047.307a8.209 8.209 0 00-4.14 0l.252.968a7.209 7.209 0 013.636 0l.252-.968zm-3.743.064c-.797-.514-1.397-.74-1.822-.83a2.17 2.17 0 00-.51-.053 1.259 1.259 0 00-.241.03l-.004.002h-.003l.136.481.137.481h-.001l-.002.001-.003.001a.327.327 0 01-.016.004l-.008.001h.008a1.19 1.19 0 01.298.03c.282.06.769.23 1.488.694l.543-.84zm-2.9-.576a3.12 3.12 0 00-.27 1.195l1 .025a2.09 2.09 0 01.183-.812l-.913-.408zm-.27 1.195c-.01.413.06.823.21 1.207l.932-.362a2.12 2.12 0 01-.143-.82l-1-.025zm.322.673a3.354 3.354 0 00-.726 1.091l.924.38c.118-.285.292-.545.51-.765l-.708-.706zm-.726 1.091A3.354 3.354 0 002 5.93l1-.003c0-.31.06-.616.177-.902l-.924-.38zM2 5.93c0 1.553.458 2.597 1.239 3.268.757.65 1.74.88 2.64.987l.118-.993C5.15 9.09 4.416 8.89 3.89 8.438 3.388 8.007 3 7.276 3 5.928H2zm3.585 3.404c-.5.498-.629 1.09-.584 1.704L6 10.963c-.03-.408.052-.683.291-.921l-.705-.709zM5 11v3.5h1V11H5zm5 3.5V13H9v1.5h1zm0-1.5v-2.063H9V13h1z",fill:"currentColor"})),f0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M3.5 3.5h8v8m-8-8V0m0 3.5H0m11.5 8h-8V6m8 5.5V15m0-3.5H15",stroke:"currentColor"})),d0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M.5 12.5v-10a1 1 0 011-1h4l2 2h6a1 1 0 011 1v8a1 1 0 01-1 1h-12a1 1 0 01-1-1z",stroke:"currentColor"})),h0=t=>N.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{d:"M4.5 14.5v-3a1 1 0 011-1h4a1 1 0 011 1v3m3 0h-12a1 1 0 01-1-1v-12a1 1 0 011-1h8.586a1 1 0 01.707.293l3.414 3.414a1 1 0 01.293.707V13.5a1 1 0 01-1 1z",stroke:"currentColor"}));var Be=(t=>(t.Line="Line",t.Square="Square",t.Circle="Circle",t.Direction="Direction",t.VectorDocument="VectorDocument",t.LayersDifference="LayersDifference",t.AntiClockwise="AntiClockwise",t.Clockwise="Clockwise",t.Github="Github",t.Crop="Crop",t.Folder="Folder",t.Save="Save",t.Svg="Svg",t.SolidDown="SolidDown",t.SolidUp="SolidUp",t.SolidUpSmall="SolidUpSmall",t.SolidDownSmall="SolidDownSmall",t))(Be||{});const p0={Line:Jm,Square:Zm,Circle:bm,Direction:e0,VectorDocument:t0,LayersDifference:n0,AntiClockwise:u0,Clockwise:a0,Github:c0,Crop:f0,Folder:d0,Save:h0,Svg:r0,SolidDown:i0,SolidUp:l0,SolidUpSmall:o0,SolidDownSmall:s0},ah=({name:t,className:e})=>{const n=p0[t];return U.jsx("div",{className:"icon w-5"+(e?" "+e:""),children:U.jsx(n,{})})};var W=(t=>(t.Pencil="Pencil",t.Eraser="Eraser",t.Fill="Fill",t.Line="Line",t.Rectangle="Rectangle",t.Circle="Circle",t.Select="Select",t.Pan="Pan",t.Zoom="Zoom",t.Text="Text",t))(W||{});const ue=({label:t,title:e,icon:n,onClick:r,active:i=!1,children:l,className:o})=>U.jsx(U.Fragment,{children:U.jsxs("button",{className:"bg-gray-950 text-blue-700 font-semibold py-2 px-2 border border-blue-500 rounded w-10 h-10 flex flex-row justify-center items-center hover:bg-blue-500 hover:text-white hover:border-transparent data-[active=true]:bg-blue-500 data-[active=true]:text-white data-[active=true]:border-transparent"+(o?" "+o:""),"data-active":i,onClick:r,title:e,children:[n&&U.jsx(ah,{name:n}),t&&U.jsx("span",{children:t}),l]})}),g0=({label:t,title:e,icon:n,className:r,children:i})=>{const[l,o]=N.useState(!1);return U.jsxs("div",{className:"flex flex-row gap-2 relative"+(r?" "+r:""),children:[U.jsx(ue,{icon:n,label:t,title:e,"data-active":l,onClick:()=>o(!l)}),U.jsx(ah,{name:Be.SolidDownSmall,className:"-rotate-45 absolute -bottom-1 left-6 text-blue-700"}),l&&U.jsx("div",{className:"flex flex-row gap-1",onClick:()=>o(!1),children:i})]})},ch=!0,m0=!1,sl={CCW:-1,CW:1,NOT_ORIENTABLE:0},v0=2*Math.PI,Ml=1,fh=0,rt=2,y0=3,w0=4,_0=1,x0=2,Ku=0,$r=1,Wn=2;var zl=Object.freeze({__proto__:null,BOUNDARY:rt,CCW:ch,CONTAINS:y0,CW:m0,END_VERTEX:Wn,INSIDE:Ml,INTERLACE:w0,NOT_VERTEX:Ku,ORIENTATION:sl,OUTSIDE:fh,OVERLAP_OPPOSITE:x0,OVERLAP_SAME:_0,PIx2:v0,START_VERTEX:$r});let ft=1e-6;function dh(t){ft=t}function hh(){return ft}const S0=3;function js(t){return t-ft}function pn(t,e){return t-e-ft}function ph(t,e){return t-e>ft}function E0(t,e){return t-e>-ft}function gh(t,e){return t-e<-ft}function P0(t,e){return t-e(e=e?e.next:this.first,{value:e,done:e===void 0})}}get size(){let e=0;for(let n of this)e++;return e}toArray(e=void 0,n=void 0){let r=[],i=e||this.first,l=n||this.last,o=i;if(o===void 0)return r;do r.push(o),o=o.next;while(o!==l.next);return r}append(e){return this.isEmpty()?this.first=e:(e.prev=this.last,this.last.next=e),this.last=e,this.last.next=void 0,this.first.prev=void 0,this}insert(e,n){if(this.isEmpty())this.first=e,this.last=e;else if(n==null)e.next=this.first,this.first.prev=e,this.first=e;else{let r=n.next;n.next=e,r&&(r.prev=e),e.prev=n,e.next=r,this.last===n&&(this.last=e)}return this.last.next=void 0,this.first.prev=void 0,this}remove(e){return e===this.first&&e===this.last?(this.first=void 0,this.last=void 0):(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this.first&&(this.first=e.next),e===this.last&&(this.last=e.prev)),this}isEmpty(){return this.first===void 0}static testInfiniteLoop(e){let n=e,r=e;do{if(n!=e&&n===r)throw Y.INFINITE_LOOP;n=n.next,r=r.next.next}while(n!=e)}}const Ic={stroke:"black"};class k0{constructor(e=Ic){for(const n in e)this[n]=e[n];this.stroke=e.stroke??Ic.stroke}toAttributesString(){return Object.keys(this).reduce((e,n)=>e+(this[n]!==void 0?this.toAttrString(n,this[n]):""),"")}toAttrString(e,n){const r=e==="className"?"class":this.convertCamelToKebabCase(e);return n===null?`${r} `:`${r}="${n.toString()}" `}convertCamelToKebabCase(e){return e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).join("-").toLowerCase()}}function yn(t){return new k0(t).toAttributesString()}function sr(t,e){let n=[],[r,i,l]=t.standard,[o,u,a]=e.standard,c=r*u-i*o,f=l*u-i*a,h=r*a-l*o;if(!s.Utils.EQ_0(c)){let m,v;i===0?(m=l/r,v=h/c):u===0?(m=a/o,v=h/c):r===0?(m=f/c,v=l/i):o===0?(m=f/c,v=a/u):(m=f/c,v=h/c),n.push(new s.Point(m,v))}return n}function wn(t,e){let n=[],r=e.pc.projectionOn(t),i=e.pc.distanceTo(r)[0];if(s.Utils.EQ(i,e.r))n.push(r);else if(s.Utils.LT(i,e.r)){let l=Math.sqrt(e.r*e.r-i*i),o,u;o=t.norm.rotate90CCW().multiply(l),u=r.translate(o),n.push(u),o=t.norm.rotate90CW().multiply(l),u=r.translate(o),n.push(u)}return n}function bn(t,e){let n=[];for(let r of e.toSegments()){let i=vi(r,t);for(let l of i)Ph(l,n)||n.push(l)}return n}function no(t,e){let n=[];if(bn(t,e.box).length===0)return n;let r=new s.Circle(e.pc,e.r),i=wn(t,r);for(let l of i)l.on(e)&&n.push(l);return n}function vi(t,e){let n=[];if(t.ps.on(e)&&n.push(t.ps),t.pe.on(e)&&!t.isZeroLength()&&n.push(t.pe),n.length>0||t.isZeroLength()||t.ps.leftTo(e)&&t.pe.leftTo(e)||!t.ps.leftTo(e)&&!t.pe.leftTo(e))return n;let r=new s.Line(t.ps,t.pe);return sr(r,e)}function ro(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength())return t.ps.on(e)&&n.push(t.ps),n;if(e.isZeroLength())return e.ps.on(t)&&n.push(e.ps),n;let r=new s.Line(t.ps,t.pe),i=new s.Line(e.ps,e.pe);if(r.incidentTo(i))t.ps.on(e)&&n.push(t.ps),t.pe.on(e)&&n.push(t.pe),e.ps.on(t)&&!e.ps.equalTo(t.ps)&&!e.ps.equalTo(t.pe)&&n.push(e.ps),e.pe.on(t)&&!e.pe.equalTo(t.ps)&&!e.pe.equalTo(t.pe)&&n.push(e.pe);else{let l=sr(r,i);l.length>0&&Ac(l[0],t)&&Ac(l[0],e)&&n.push(l[0])}return n}function Ac(t,e){const n=e.box;return s.Utils.LE(t.x,n.xmax)&&s.Utils.GE(t.x,n.xmin)&&s.Utils.LE(t.y,n.ymax)&&s.Utils.GE(t.y,n.ymin)}function io(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength()){let[l,o]=t.ps.distanceTo(e.pc);return s.Utils.EQ(l,e.r)&&n.push(t.ps),n}let r=new s.Line(t.ps,t.pe),i=wn(r,e);for(let l of i)l.on(t)&&n.push(l);return n}function ur(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.isZeroLength())return t.ps.on(e)&&n.push(t.ps),n;let r=new s.Line(t.ps,t.pe),i=new s.Circle(e.pc,e.r),l=wn(r,i);for(let o of l)o.on(t)&&o.on(e)&&n.push(o);return n}function C0(t,e){let n=[];for(let r of e.toSegments()){let i=ro(r,t);for(let l of i)n.push(l)}return n}function mh(t,e){let n=[];if(t.box.not_intersect(e.box))return n;let r=new s.Vector(t.pc,e.pc),i=t.r,l=e.r;if(s.Utils.EQ_0(i)||s.Utils.EQ_0(l))return n;if(s.Utils.EQ_0(r.x)&&s.Utils.EQ_0(r.y)&&s.Utils.EQ(i,l))return n.push(t.pc.translate(-i,0)),n;let o=t.pc.distanceTo(e.pc)[0];if(s.Utils.GT(o,i+l)||s.Utils.LT(o,Math.abs(i-l)))return n;r.x/=o,r.y/=o;let u;if(s.Utils.EQ(o,i+l)||s.Utils.EQ(o,Math.abs(i-l)))return u=t.pc.translate(i*r.x,i*r.y),n.push(u),n;let a=i*i/(2*o)-l*l/(2*o)+o/2,c=t.pc.translate(a*r.x,a*r.y),f=Math.sqrt(i*i-a*a);return u=c.translate(r.rotate90CCW().multiply(f)),n.push(u),u=c.translate(r.rotate90CW().multiply(f)),n.push(u),n}function L0(t,e){let n=[];for(let r of e.toSegments()){let i=io(r,t);for(let l of i)n.push(l)}return n}function vh(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(t.pc.equalTo(e.pc)&&s.Utils.EQ(t.r,e.r)){let o;return o=t.start,o.on(e)&&n.push(o),o=t.end,o.on(e)&&n.push(o),o=e.start,o.on(t)&&n.push(o),o=e.end,o.on(t)&&n.push(o),n}let r=new s.Circle(t.pc,t.r),i=new s.Circle(e.pc,e.r),l=r.intersect(i);for(let o of l)o.on(t)&&o.on(e)&&n.push(o);return n}function Ju(t,e){let n=[];if(t.box.not_intersect(e.box))return n;if(e.pc.equalTo(t.pc)&&s.Utils.EQ(e.r,t.r))return n.push(t.start),n.push(t.end),n;let r=e,i=new s.Circle(t.pc,t.r),l=mh(r,i);for(let o of l)o.on(t)&&n.push(o);return n}function I0(t,e){let n=[];for(let r of e.toSegments()){let i=ur(r,t);for(let l of i)n.push(l)}return n}function yh(t,e){return t.isSegment?ro(t.shape,e):ur(e,t.shape)}function wh(t,e){return t.isSegment?ur(t.shape,e):vh(t.shape,e)}function _h(t,e){return t.isSegment?vi(t.shape,e):no(e,t.shape)}function A0(t,e){return t.isSegment?ea(e,t.shape):ta(e,t.shape)}function N0(t,e){return t.isSegment?io(t.shape,e):Ju(t.shape,e)}function Zu(t,e){let n=[];for(let r of e.edges)for(let i of yh(r,t))n.push(i);return n}function bu(t,e){let n=[];for(let r of e.edges)for(let i of wh(r,t))n.push(i);return n}function yi(t,e){let n=[];if(e.isEmpty())return n;for(let r of e.edges)for(let i of _h(r,t))Ph(i,n)||n.push(i);return t.sortPoints(n)}function xh(t,e){let n=[];if(e.isEmpty())return n;for(let r of e.edges)for(let i of N0(r,t))n.push(i);return n}function Sh(t,e){return t.isSegment?yh(e,t.shape):t.isArc?wh(e,t.shape):t.isLine?_h(e,t.shape):t.isRay?A0(e,t.shape):[]}function Eh(t,e){let n=[];if(e.isEmpty()||t.shape.box.not_intersect(e.box))return n;let r=e.edges.search(t.shape.box);for(let i of r)n=[...n,...Sh(t,i)];return n}function O0(t,e){let n=[];if(e.isEmpty()||t.size===0)return n;for(let r of t)n=[...n,...Eh(r,e)];return n}function M0(t,e){let n=[];if(t.isEmpty()||e.isEmpty()||t.box.not_intersect(e.box))return n;for(let r of t.edges)n=[...n,...Eh(r,e)];return n}function z0(t,e){return t instanceof s.Line?yi(t,e):t instanceof s.Segment?Zu(t,e):t instanceof s.Arc?bu(t,e):[]}function Ph(t,e){return e.some(n=>n.equalTo(t))}function Qt(t){return new s.Line(t.start,t.norm)}function ea(t,e){return vi(e,Qt(t)).filter(n=>t.contains(n))}function ta(t,e){return no(Qt(t),e).filter(n=>t.contains(n))}function Th(t,e){return wn(Qt(t),e).filter(n=>t.contains(n))}function R0(t,e){return bn(Qt(t),e).filter(n=>t.contains(n))}function kh(t,e){return sr(Qt(t),e).filter(n=>t.contains(n))}function U0(t,e){return sr(Qt(t),Qt(e)).filter(n=>t.contains(n)).filter(n=>e.contains(n))}function Ch(t,e){return yi(Qt(t),e).filter(n=>t.contains(n))}function Lh(t,e){if(t.intersect&&t.intersect instanceof Function)return t.intersect(e);throw Y.UNSUPPORTED_SHAPE_TYPE}function wi(t,e){let n=[];for(let r of e)n=[...n,...Lh(r,r.shape)];return n}function D0(t,e){let n=[];for(let r of t)for(let i of e)n=[...n,...Lh(r,i)];return n}let _n=class Nr extends Xu{constructor(...e){if(super(),this.isInfinite=!1,e.length===1&&e[0]instanceof Array&&e[0].length>0){let n=!1;const r=e[0],i=r.length,l=a=>a instanceof s.Segment||a instanceof s.Arc||a instanceof s.Ray||a instanceof s.Line,o=a=>a instanceof s.Segment||a instanceof s.Arc||a instanceof s.Ray,u=a=>a instanceof s.Segment||a instanceof s.Arc;if(n=i===1&&l(r[0])||i>1&&o(r[0])&&o(r[i-1])&&r.slice(1,i-1).every(u),n){this.isInfinite=r.some(a=>a instanceof s.Ray||a instanceof s.Line);for(let a of r){let c=new s.Edge(a);this.append(c)}this.setArcLength()}else throw s.Errors.ILLEGAL_PARAMETERS}}get edges(){return[...this]}get box(){return this.edges.reduce((e,n)=>e.merge(n.box),new s.Box)}get vertices(){let e=this.edges.map(n=>n.start);return e.push(this.last.end),e}get length(){if(this.isEmpty())return 0;if(this.isInfinite)return Number.POSITIVE_INFINITY;let e=0;for(let n of this)e+=n.length;return e}clone(){return new Nr(this.toShapes())}setArcLength(){for(let e of this)this.setOneEdgeArcLength(e)}setOneEdgeArcLength(e){e===this.first?e.arc_length=0:e.arc_length=e.prev.arc_length+e.prev.length}pointAtLength(e){if(e>this.length||e<0||this.isInfinite)return null;let n=null;for(let r of this)if(e>=r.arc_length&&(r===this.last||en.shape.contains(e));throw s.Errors.UNSUPPORTED_SHAPE_TYPE}translate(e){return new Nr(this.edges.map(n=>n.shape.translate(e)))}rotate(e=0,n=new s.Point){return new Nr(this.edges.map(r=>r.shape.rotate(e,n)))}transform(e=new s.Matrix){return new Nr(this.edges.map(n=>n.shape.transform(e)))}toShapes(){return this.edges.map(e=>e.shape.clone())}toJSON(){return this.edges.map(e=>e.toJSON())}svgPoints(){return this.vertices.map(e=>`${e.x},${e.y}`).join(" ")}dpath(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let n of this)e+=n.svg();return e}svg(e={}){let n=` + +`,n}};s.Multiline=_n;const F0=(...t)=>new s.Multiline(...t);s.multiline=F0;function er(t,e,n){let r=n.length,i=t.shape.split(e);if(i.length===0)return;let l=0;i[0]===null?l=0:i[1]===null?l=t.shape.length:l=i[0].length;let o=Ku;pn(l,0)&&(o|=$r),pn(l,t.shape.length)&&(o|=Wn);let u;l===1/0?u=i[0].coord(e):u=o&Wn&&t.next&&t.next.arc_length===0?0:t.arc_length+l,n.push({id:r,pt:e,arc_length:u,edge_before:t,edge_after:void 0,face:t.face,is_vertex:o})}function ui(t){t.int_points1_sorted=It(t.int_points1),t.int_points2_sorted=It(t.int_points2)}function It(t){let e=new Map,n=0;for(let i of t)e.has(i.face)||(e.set(i.face,n),n++);for(let i of t)i.faceId=e.get(i.face);return t.slice().sort(B0)}function B0(t,e){return t.faceIde.faceId?1:t.arc_lengthe.arc_length?1:0}function na(t){if(t.int_points1.length<2)return;let e=!1,n,r,i,l;for(let o=0;oo.id>=0),t.int_points2=t.int_points2.filter(o=>o.id>=0),t.int_points1.forEach((o,u)=>o.id=u),t.int_points2.forEach((o,u)=>o.id=u))}function Vs(t){for(let e of t)e.edge_before&&(e.edge_before.bvStart=void 0,e.edge_before.bvEnd=void 0,e.edge_before.bv=void 0,e.edge_before.overlap=void 0),e.edge_after&&(e.edge_after.bvStart=void 0,e.edge_after.bvEnd=void 0,e.edge_after.bv=void 0,e.edge_after.overlap=void 0);for(let e of t)e.edge_before&&(e.edge_before.bvEnd=rt),e.edge_after&&(e.edge_after.bvStart=rt)}function $s(t,e){for(let n of t)n.edge_before&&n.edge_before.setInclusion(e),n.edge_after&&n.edge_after.setInclusion(e)}function j0(t){let e,n,r,i=t.int_points1.length;for(let l=0;lu.shape)];let l=[];for(let o of r.faces)l=[...l,...[...o.edges].map(u=>u.shape)];return[i,l]}function Ws(t,e){let[n,r]=xi(t,e,gn,!1),i=[];for(let l of n.faces)i=[...i,...[...l.edges].map(o=>o.shape)];return i}function Nh(t,e){let n=t.clone(),r=e.clone(),i=Oh(n,r);ui(i),nr(n,i.int_points1_sorted),nr(r,i.int_points2_sorted),na(i),ui(i);let l=i.int_points1_sorted.map(u=>u.pt),o=i.int_points2_sorted.map(u=>u.pt);return[l,o]}function W0(t,e,n,r){let i=zc(t,n.int_points1),l=zc(e,n.int_points2);for(Rc(i,e),Rc(l,t),Vs(n.int_points1),Vs(n.int_points2),$s(n.int_points1,e),$s(n.int_points2,t);G0(t,e,n.int_points1,n.int_points1_sorted,n.int_points2,n););j0(n),Qs(t,r,n.int_points1_sorted,!0),Qs(e,r,n.int_points2_sorted,!1),Uc(t,i,r,!0),Uc(e,l,r,!1)}function Q0(t,e,n,r){Y0(t,e,r,n.int_points2),q0(t,e,n),Gs(t,n.int_points1),Gs(e,n.int_points2),Ys(t,n.int_points1,n.int_points2),Ys(t,n.int_points2,n.int_points1)}function xi(t,e,n,r){let i=t.clone(),l=e.clone(),o=Oh(i,l);return ui(o),nr(i,o.int_points1_sorted),nr(l,o.int_points2_sorted),na(o),ui(o),W0(i,l,o,n),r&&Q0(i,l,o,n),[i,l]}function Oh(t,e){let n={int_points1:[],int_points2:[]};for(let r of t.edges){let i=e.edges.search(r.box);for(let l of i){let o=r.shape.intersect(l.shape);for(let u of o)er(r,u,n.int_points1),er(l,u,n.int_points2)}}return n}function zc(t,e){let n=[];for(let r of t.faces)e.find(i=>i.face===r)||n.push(r);return n}function Rc(t,e){for(let n of t)n.first.bv=n.first.bvStart=n.first.bvEnd=void 0,n.first.setInclusion(e)}function G0(t,e,n,r,i,l){let o,u,a,c=r.length,f=!1;for(let h=0;hOe.edge_after===k),A=e.addVertex(L.pt,k);L.edge_before=A,L.edge_after=A.next,B&&(B.edge_after=A),A.bvStart=void 0,A.bvEnd=ae,A.bv=void 0,A.setInclusion(t),A.next.bvStart=ae,A.next.bvEnd=void 0,A.next.bv=void 0,A.next.setInclusion(t)}ui(l),f=!0;break}}p=p.next}if(f)break;throw Y.UNRESOLVED_BOUNDARY_CONFLICT}}return f}function Qs(t,e,n,r){if(!n)return;let i,l,o,u;for(let a=0;al.face===i)===void 0&&t.addFace(i.first,i.last)}}function q0(t,e,n){if(n.int_points1.length!==0)for(let r=0;re instanceof Array&&e.length>0?"T":e instanceof Array&&e.length===0?"F":"*").join("")}equal(){return X0.test(this.toString())}intersect(){return J0.test(this.toString())}touch(){return Z0.test(this.toString())}inside(){return b0.test(this.toString())}covered(){return ev.test(this.toString())}}function Hr(t,e){let n,r=new s.Ray(e),i=new s.Line(r.pt,r.norm);const l=new s.Box(r.box.xmin-s.DP_TOL,r.box.ymin-s.DP_TOL,r.box.xmax,r.box.ymax+s.DP_TOL);if(t.box.not_intersect(l))return s.OUTSIDE;let o=t.edges.search(l);if(o.length===0)return s.OUTSIDE;for(let f of o)if(f.shape.contains(e))return s.BOUNDARY;let u=[...t.faces],a=[];for(let f of o)for(let h of r.intersect(f.shape)){if(h.equalTo(e))return s.BOUNDARY;a.push({pt:h,edge:f,face_index:u.indexOf(f.face)})}a.sort((f,h)=>gh(f.pt.x,h.pt.x)?-1:ph(f.pt.x,h.pt.x)?1:f.face_indexh.face_index?1:f.edge.arc_lengthh.edge.arc_length?1:0);let c=0;for(let f=0;f0&&h.pt.equalTo(a[f-1].pt)&&h.face_index===a[f-1].face_index&&h.edge.prev===a[f-1].edge)continue;let m=h.edge.prev;for(;js(m.length);)m=m.prev;let v=m.shape.tangentInEnd(),_=h.pt.translate(v),w=h.edge.shape.tangentInStart(),I=h.pt.translate(w),g=_.leftTo(i),d=I.leftTo(i);(g&&!d||!g&&d)&&c++}else if(h.pt.equalTo(h.edge.shape.end)){if(f>0&&h.pt.equalTo(a[f-1].pt)&&h.face_index===a[f-1].face_index&&h.edge.next===a[f-1].edge)continue;let m=h.edge.next;for(;js(m.length);)m=m.next;let v=m.shape.tangentInStart(),_=h.pt.translate(v),w=h.edge.shape.tangentInEnd(),I=h.pt.translate(w),g=_.leftTo(i),d=I.leftTo(i);(g&&!d||!g&&d)&&c++}else if(h.edge.shape instanceof s.Segment)c++;else{let m=h.edge.shape.box;pn(h.pt.y,m.ymin)||pn(h.pt.y,m.ymax)||c++}}return n=c%2===1?Ml:fh,n}function tv(t,e){return cr(t,e).equal()}function Mh(t,e){return cr(t,e).intersect()}function nv(t,e){return cr(t,e).touch()}function rv(t,e){return!Mh(t,e)}function zh(t,e){return cr(t,e).inside()}function Rh(t,e){return cr(t,e).covered()}function iv(t,e){return zh(e,t)}function Uh(t,e){return Rh(e,t)}function cr(t,e){if(t instanceof s.Line&&e instanceof s.Line)return lv(t,e);if(t instanceof s.Line&&e instanceof s.Circle)return ov(t,e);if(t instanceof s.Line&&e instanceof s.Box)return sv(t,e);if(t instanceof s.Line&&e instanceof s.Polygon)return uv(t,e);if((t instanceof s.Segment||t instanceof s.Arc)&&e instanceof s.Polygon)return Dc(t,e);if((t instanceof s.Segment||t instanceof s.Arc)&&(e instanceof s.Circle||e instanceof s.Box))return Dc(t,new s.Polygon(e));if(t instanceof s.Polygon&&e instanceof s.Polygon)return Qi(t,e);if((t instanceof s.Circle||t instanceof s.Box)&&(e instanceof s.Circle||e instanceof s.Box))return Qi(new s.Polygon(t),new s.Polygon(e));if((t instanceof s.Circle||t instanceof s.Box)&&e instanceof s.Polygon)return Qi(new s.Polygon(t),e);if(t instanceof s.Polygon&&(e instanceof s.Circle||e instanceof s.Box))return Qi(t,new s.Polygon(e))}function lv(t,e){let n=new ar,r=sr(t,e);return r.length===0?t.contains(e.pt)&&e.contains(t.pt)?(n.I2I=[t],n.I2E=[],n.E2I=[]):(n.I2I=[],n.I2E=[t],n.E2I=[e]):(n.I2I=r,n.I2E=t.split(r),n.E2I=e.split(r)),n}function ov(t,e){let n=new ar,r=wn(t,e);if(r.length===0)n.I2I=[],n.I2B=[],n.I2E=[t],n.E2I=[e];else if(r.length===1)n.I2I=[],n.I2B=r,n.I2E=t.split(r),n.E2I=[e];else{let i=new _n([t]),l=t.sortPoints(r);i.split(l);let o=i.toShapes();n.I2I=[o[1]],n.I2B=l,n.I2E=[o[0],o[2]],n.E2I=new s.Polygon([e.toArc()]).cutWithLine(t)}return n}function sv(t,e){let n=new ar,r=bn(t,e);if(r.length===0)n.I2I=[],n.I2B=[],n.I2E=[t],n.E2I=[e];else if(r.length===1)n.I2I=[],n.I2B=r,n.I2E=t.split(r),n.E2I=[e];else{let i=new _n([t]),l=t.sortPoints(r);i.split(l);let o=i.toShapes();e.toSegments().some(u=>u.contains(r[0])&&u.contains(r[1]))?(n.I2I=[],n.I2B=[o[1]],n.I2E=[o[0],o[2]],n.E2I=[e]):(n.I2I=[o[1]],n.I2B=l,n.I2E=[o[0],o[2]],n.E2I=new s.Polygon(e.toSegments()).cutWithLine(t))}return n}function uv(t,e){let n=new ar,r=yi(t,e),i=new _n([t]),l=r.length>0?r.slice():t.sortPoints(r);return i.split(l),[...i].forEach(o=>o.setInclusion(e)),n.I2I=[...i].filter(o=>o.bv===s.INSIDE).map(o=>o.shape),n.I2B=[...i].slice(1).map(o=>o.bv===s.BOUNDARY?o.shape:o.shape.start),n.I2E=[...i].filter(o=>o.bv===s.OUTSIDE).map(o=>o.shape),n.E2I=e.cutWithLine(t),n}function Dc(t,e){let n=new ar,r=z0(t,e),i=r.length>0?r.slice():t.sortPoints(r),l=new _n([t]);l.split(i),[...l].forEach(o=>o.setInclusion(e)),n.I2I=[...l].filter(o=>o.bv===s.INSIDE).map(o=>o.shape),n.I2B=[...l].slice(1).map(o=>o.bv===s.BOUNDARY?o.shape:o.shape.start),n.I2E=[...l].filter(o=>o.bv===s.OUTSIDE).map(o=>o.shape),n.B2I=[],n.B2B=[],n.B2E=[];for(let o of[t.start,t.end])switch(Hr(e,o)){case s.INSIDE:n.B2I.push(o);break;case s.BOUNDARY:n.B2B.push(o);break;case s.OUTSIDE:n.B2E.push(o);break}return n}function Qi(t,e){let n=new ar,[r,i]=Nh(t,e),l=Ih(t,e),o=Hs(t,e),u=Hs(e,t),[a,c]=Ah(t,e),f=Ws(t,e),h=Ws(e,t);return n.I2I=l.isEmpty()?[]:[l],n.I2B=c,n.I2E=o.isEmpty()?[]:[o],n.B2I=a,n.B2B=r,n.B2E=f,n.E2I=u.isEmpty()?[]:[u],n.E2B=h,n}var Dh=Object.freeze({__proto__:null,contain:iv,cover:Uh,covered:Rh,disjoint:rv,equal:tv,inside:zh,intersect:Mh,relate:cr,touch:nv});class Xe{constructor(e=1,n=0,r=0,i=1,l=0,o=0){this.a=e,this.b=n,this.c=r,this.d=i,this.tx=l,this.ty=o}clone(){return new Xe(this.a,this.b,this.c,this.d,this.tx,this.ty)}transform(e){return[e[0]*this.a+e[1]*this.c+this.tx,e[0]*this.b+e[1]*this.d+this.ty]}multiply(e){return new Xe(this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.tx+this.c*e.ty+this.tx,this.b*e.tx+this.d*e.ty+this.ty)}translate(...e){let n,r;if(e.length==1&&!isNaN(e[0].x)&&!isNaN(e[0].y))n=e[0].x,r=e[0].y;else if(e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number")n=e[0],r=e[1];else throw Y.ILLEGAL_PARAMETERS;return this.multiply(new Xe(1,0,0,1,n,r))}rotate(e,n=0,r=0){let i=Math.cos(e),l=Math.sin(e);return this.translate(n,r).multiply(new Xe(i,l,-l,i,0,0)).translate(-n,-r)}scale(e,n){return this.multiply(new Xe(e,0,0,n,0,0))}equalTo(e){return!(!s.Utils.EQ(this.tx,e.tx)||!s.Utils.EQ(this.ty,e.ty)||!s.Utils.EQ(this.a,e.a)||!s.Utils.EQ(this.b,e.b)||!s.Utils.EQ(this.c,e.c)||!s.Utils.EQ(this.d,e.d))}}s.Matrix=Xe;const av=(...t)=>new s.Matrix(...t);s.matrix=av;const cv=class qs{constructor(e,n){this.low=e,this.high=n}clone(){return new qs(this.low,this.high)}get max(){return this.clone()}less_than(e){return this.lowe.high?this.high:e.high)}output(){return[this.low,this.high]}static comparable_max(e,n){return e.merge(n)}static comparable_less_than(e,n){return ea&&([u,a]=[a,u]),this.item.key=new cv(u,a)}this.max=this.item.key?this.item.key.max:void 0}isNil(){return this.item.key===void 0&&this.item.value===void 0&&this.left===null&&this.right===null&&this.color===V}_value_less_than(e){return this.item.value&&e.item.value&&this.item.value.less_than?this.item.value.less_than(e.item.value):this.item.valuee++),e}get keys(){let e=[];return this.tree_walk(this.root,n=>e.push(n.item.key.output?n.item.key.output():n.item.key)),e}get values(){let e=[];return this.tree_walk(this.root,n=>e.push(n.item.value)),e}get items(){let e=[];return this.tree_walk(this.root,n=>e.push({key:n.item.key.output?n.item.key.output():n.item.key,value:n.item.value})),e}isEmpty(){return this.root==null||this.root===this.nil_node}clear(){this.root=null}insert(e,n=e){if(e===void 0)return;let r=new en(e,n,this.nil_node,this.nil_node,null,de);return this.tree_insert(r),this.recalc_max(r),r}exist(e,n=e){let r=new en(e,n);return!!this.tree_search(this.root,r)}remove(e,n=e){let r=new en(e,n),i=this.tree_search(this.root,r);return i&&this.tree_delete(i),i}search(e,n=(r,i)=>r===i?i.output():r){let r=new en(e),i=[];return this.tree_search_interval(this.root,r,i),i.map(l=>n(l.item.value,l.item.key))}intersect_any(e){let n=new en(e);return this.tree_find_any_interval(this.root,n)}forEach(e){this.tree_walk(this.root,n=>e(n.item.key,n.item.value))}map(e){const n=new ai;return this.tree_walk(this.root,r=>n.insert(r.item.key,e(r.item.value,r.item.key))),n}*iterate(e,n=(r,i)=>r===i?i.output():r){let r;for(e?r=this.tree_search_nearest_forward(this.root,new en(e)):this.root&&(r=this.local_minimum(this.root));r;)yield n(r.item.value,r.item.key),r=this.tree_successor(r)}recalc_max(e){let n=e;for(;n.parent!=null;)n.parent.update_max(),n=n.parent}tree_insert(e){let n=this.root,r=null;if(this.root==null||this.root===this.nil_node)this.root=e;else{for(;n!==this.nil_node;)r=n,e.less_than(n)?n=n.left:n=n.right;e.parent=r,e.less_than(r)?r.left=e:r.right=e}this.insert_fixup(e)}insert_fixup(e){let n,r;for(n=e;n!==this.root&&n.parent.color===de;)n.parent===n.parent.parent.left?(r=n.parent.parent.right,r.color===de?(n.parent.color=V,r.color=V,n.parent.parent.color=de,n=n.parent.parent):(n===n.parent.right&&(n=n.parent,this.rotate_left(n)),n.parent.color=V,n.parent.parent.color=de,this.rotate_right(n.parent.parent))):(r=n.parent.parent.left,r.color===de?(n.parent.color=V,r.color=V,n.parent.parent.color=de,n=n.parent.parent):(n===n.parent.left&&(n=n.parent,this.rotate_right(n)),n.parent.color=V,n.parent.parent.color=de,this.rotate_left(n.parent.parent)));this.root.color=V}tree_delete(e){let n,r;e.left===this.nil_node||e.right===this.nil_node?n=e:n=this.tree_successor(e),n.left!==this.nil_node?r=n.left:r=n.right,r.parent=n.parent,n===this.root?this.root=r:(n===n.parent.left?n.parent.left=r:n.parent.right=r,n.parent.update_max()),this.recalc_max(r),n!==e&&(e.copy_data(n),e.update_max(),this.recalc_max(e)),n.color===V&&this.delete_fixup(r)}delete_fixup(e){let n=e,r;for(;n!==this.root&&n.parent!=null&&n.color===V;)n===n.parent.left?(r=n.parent.right,r.color===de&&(r.color=V,n.parent.color=de,this.rotate_left(n.parent),r=n.parent.right),r.left.color===V&&r.right.color===V?(r.color=de,n=n.parent):(r.right.color===V&&(r.color=de,r.left.color=V,this.rotate_right(r),r=n.parent.right),r.color=n.parent.color,n.parent.color=V,r.right.color=V,this.rotate_left(n.parent),n=this.root)):(r=n.parent.left,r.color===de&&(r.color=V,n.parent.color=de,this.rotate_right(n.parent),r=n.parent.left),r.left.color===V&&r.right.color===V?(r.color=de,n=n.parent):(r.left.color===V&&(r.color=de,r.right.color=V,this.rotate_left(r),r=n.parent.left),r.color=n.parent.color,n.parent.color=V,r.left.color=V,this.rotate_right(n.parent),n=this.root));n.color=V}tree_search(e,n){if(!(e==null||e===this.nil_node))return n.equal_to(e)?e:n.less_than(e)?this.tree_search(e.left,n):this.tree_search(e.right,n)}tree_search_nearest_forward(e,n){let r,i=e;for(;i&&i!==this.nil_node;)i.less_than(n)?i.intersect(n)?(r=i,i=i.left):i=i.right:((!r||i.less_than(r))&&(r=i),i=i.left);return r||null}tree_search_interval(e,n,r){e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(n)&&this.tree_search_interval(e.left,n,r),e.intersect(n)&&r.push(e),e.right!==this.nil_node&&!e.not_intersect_right_subtree(n)&&this.tree_search_interval(e.right,n,r))}tree_find_any_interval(e,n){let r=!1;return e!=null&&e!==this.nil_node&&(e.left!==this.nil_node&&!e.not_intersect_left_subtree(n)&&(r=this.tree_find_any_interval(e.left,n)),r||(r=e.intersect(n)),!r&&e.right!==this.nil_node&&!e.not_intersect_right_subtree(n)&&(r=this.tree_find_any_interval(e.right,n))),r}local_minimum(e){let n=e;for(;n.left!=null&&n.left!==this.nil_node;)n=n.left;return n}local_maximum(e){let n=e;for(;n.right!=null&&n.right!==this.nil_node;)n=n.right;return n}tree_successor(e){let n,r,i;if(e.right!==this.nil_node)n=this.local_minimum(e.right);else{for(r=e,i=e.parent;i!=null&&i.right===r;)r=i,i=i.parent;n=i}return n}rotate_left(e){let n=e.right;e.right=n.left,n.left!==this.nil_node&&(n.left.parent=e),n.parent=e.parent,e===this.root?this.root=n:e===e.parent.left?e.parent.left=n:e.parent.right=n,n.left=e,e.parent=n,e!=null&&e!==this.nil_node&&e.update_max(),n=e.parent,n!=null&&n!==this.nil_node&&n.update_max()}rotate_right(e){let n=e.left;e.left=n.right,n.right!==this.nil_node&&(n.right.parent=e),n.parent=e.parent,e===this.root?this.root=n:e===e.parent.left?e.parent.left=n:e.parent.right=n,n.right=e,e.parent=n,e!==null&&e!==this.nil_node&&e.update_max(),n=e.parent,n!=null&&n!==this.nil_node&&n.update_max()}tree_walk(e,n){e!=null&&e!==this.nil_node&&(this.tree_walk(e.left,n),n(e),this.tree_walk(e.right,n))}testRedBlackProperty(){let e=!0;return this.tree_walk(this.root,function(n){n.color===de&&(n.left.color===V&&n.right.color===V||(e=!1))}),e}testBlackHeightProperty(e){let n=0,r=0,i=0;if(e.color===V&&n++,e.left!==this.nil_node?r=this.testBlackHeightProperty(e.left):r=1,e.right!==this.nil_node?i=this.testBlackHeightProperty(e.right):i=1,r!==i)throw new Error("Red-black height property violated");return n+=r,n}}class fv extends Set{constructor(e){super(e),this.index=new ai,this.forEach(n=>this.index.insert(n))}add(e){let n=this.size;const{key:r,value:i}=e,l=r||e.box,o=i||e;return super.add(o),this.size>n&&this.index.insert(l,o),this}delete(e){const{key:n,value:r}=e,i=n||e.box,l=r||e;let o=super.delete(l);return o&&this.index.remove(i,l),o}clear(){super.clear(),this.index=new ai}search(e){return this.index.search(e)}hit(e){let n=new s.Box(e.x-1,e.y-1,e.x+1,e.y+1);return this.index.search(n).filter(i=>e.on(i))}svg(){return[...this].reduce((n,r)=>n+r.svg(),"")}}s.PlanarSet=fv;class Jt{get name(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}get box(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}clone(){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}translate(...e){return this.transform(new Xe().translate(...e))}rotate(e,n=new s.Point){return this.transform(new Xe().rotate(e,n.x,n.y))}scale(e,n){return this.transform(new Xe().scale(e,n))}transform(...e){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}toJSON(){return Object.assign({},this,{name:this.name})}svg(e={}){throw Y.CANNOT_INVOKE_ABSTRACT_METHOD}}let z=class Fh extends Jt{constructor(...e){if(super(),this.x=0,this.y=0,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let n=e[0];if(typeof n[0]=="number"&&typeof n[1]=="number"){this.x=n[0],this.y=n[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="point"){let{x:n,y:r}=e[0];this.x=n,this.y=r;return}if(e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"){this.x=e[0],this.y=e[1];return}throw Y.ILLEGAL_PARAMETERS}}get box(){return new s.Box(this.x,this.y,this.x,this.y)}clone(){return new s.Point(this.x,this.y)}get vertices(){return[this.clone()]}equalTo(e){return s.Utils.EQ(this.x,e.x)&&s.Utils.EQ(this.y,e.y)}lessThan(e){return!!(s.Utils.LT(this.y,e.y)||s.Utils.EQ(this.y,e.y)&&s.Utils.LT(this.x,e.x))}transform(e){return new s.Point(e.transform([this.x,this.y]))}projectionOn(e){if(this.equalTo(e.pt))return this.clone();let n=new s.Vector(this,e.pt);if(s.Utils.EQ_0(n.cross(e.norm)))return e.pt.clone();let r=n.dot(e.norm),i=e.norm.multiply(r);return this.translate(i)}leftTo(e){let n=new s.Vector(e.pt,this);return s.Utils.GT(n.dot(e.norm),0)}distanceTo(e){if(e instanceof Fh){let n=e.x-this.x,r=e.y-this.y;return[Math.sqrt(n*n+r*r),new s.Segment(this,e)]}if(e instanceof s.Line)return s.Distance.point2line(this,e);if(e instanceof s.Circle)return s.Distance.point2circle(this,e);if(e instanceof s.Segment)return s.Distance.point2segment(this,e);if(e instanceof s.Arc)return s.Distance.point2arc(this,e);if(e instanceof s.Polygon)return s.Distance.point2polygon(this,e);if(e instanceof s.PlanarSet)return s.Distance.shape2planarSet(this,e);if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}on(e){if(e instanceof s.Point)return this.equalTo(e);if(e.contains&&e.contains instanceof Function)return e.contains(this);throw s.Errors.UNSUPPORTED_SHAPE_TYPE}get name(){return"point"}svg(e={}){const n=e.r??3;return` +`}};s.Point=z;const ra=(...t)=>new s.Point(...t);s.point=ra;let Bh=class extends Jt{constructor(...e){if(super(),this.x=0,this.y=0,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===2){let n=e[0];if(typeof n[0]=="number"&&typeof n[1]=="number"){this.x=n[0],this.y=n[1];return}}if(e.length===1&&e[0]instanceof Object&&e[0].name==="vector"){let{x:n,y:r}=e[0];this.x=n,this.y=r;return}if(e.length===2){let n=e[0],r=e[1];if(typeof n=="number"&&typeof r=="number"){this.x=n,this.y=r;return}if(n instanceof s.Point&&r instanceof s.Point){this.x=r.x-n.x,this.y=r.y-n.y;return}}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Vector(this.x,this.y)}get slope(){let e=Math.atan2(this.y,this.x);return e<0&&(e=2*Math.PI+e),e}get length(){return Math.sqrt(this.dot(this))}equalTo(e){return s.Utils.EQ(this.x,e.x)&&s.Utils.EQ(this.y,e.y)}multiply(e){return new s.Vector(e*this.x,e*this.y)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}normalize(){if(!s.Utils.EQ_0(this.length))return new s.Vector(this.x/this.length,this.y/this.length);throw Y.ZERO_DIVISION}rotate(e,n=new s.Point){if(n.x===0&&n.y===0)return this.transform(new Xe().rotate(e));throw Y.OPERATION_IS_NOT_SUPPORTED}transform(e){return new s.Vector(e.transform([this.x,this.y]))}rotate90CCW(){return new s.Vector(-this.y,this.x)}rotate90CW(){return new s.Vector(this.y,-this.x)}invert(){return new s.Vector(-this.x,-this.y)}add(e){return new s.Vector(this.x+e.x,this.y+e.y)}subtract(e){return new s.Vector(this.x-e.x,this.y-e.y)}angleTo(e){let n=this.normalize(),r=e.normalize(),i=Math.atan2(n.cross(r),n.dot(r));return i<0&&(i+=2*Math.PI),i}projectionOn(e){let n=e.normalize(),r=this.dot(n);return n.multiply(r)}get name(){return"vector"}};s.Vector=Bh;const jh=(...t)=>new s.Vector(...t);s.vector=jh;let ul=class Ks extends Jt{constructor(...e){if(super(),this.ps=new s.Point,this.pe=new s.Point,e.length!==0){if(e.length===1&&e[0]instanceof Array&&e[0].length===4){let n=e[0];this.ps=new s.Point(n[0],n[1]),this.pe=new s.Point(n[2],n[3]);return}if(e.length===1&&e[0]instanceof Object&&e[0].name==="segment"){let{ps:n,pe:r}=e[0];this.ps=new s.Point(n.x,n.y),this.pe=new s.Point(r.x,r.y);return}if(e.length===1&&e[0]instanceof s.Point){this.ps=e[0].clone();return}if(e.length===2&&e[0]instanceof s.Point&&e[1]instanceof s.Point){this.ps=e[0].clone(),this.pe=e[1].clone();return}if(e.length===4){this.ps=new s.Point(e[0],e[1]),this.pe=new s.Point(e[2],e[3]);return}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Segment(this.start,this.end)}get start(){return this.ps}get end(){return this.pe}get vertices(){return[this.ps.clone(),this.pe.clone()]}get length(){return this.start.distanceTo(this.end)[0]}get slope(){return new s.Vector(this.start,this.end).slope}get box(){return new s.Box(Math.min(this.start.x,this.end.x),Math.min(this.start.y,this.end.y),Math.max(this.start.x,this.end.x),Math.max(this.start.y,this.end.y))}equalTo(e){return this.ps.equalTo(e.ps)&&this.pe.equalTo(e.pe)}contains(e){return s.Utils.EQ_0(this.distanceToPoint(e))}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return vi(this,e);if(e instanceof s.Ray)return ea(e,this);if(e instanceof s.Segment)return ro(this,e);if(e instanceof s.Circle)return io(this,e);if(e instanceof s.Box)return C0(this,e);if(e instanceof s.Arc)return ur(this,e);if(e instanceof s.Polygon)return Zu(this,e);if(e instanceof s.Multiline)return wi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2segment(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.segment2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.segment2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2segment(this,e);return[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.segment2arc(this,e);return[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}tangentInStart(){return new s.Vector(this.start,this.end).normalize()}tangentInEnd(){return new s.Vector(this.end,this.start).normalize()}reverse(){return new Ks(this.end,this.start)}split(e){return this.start.equalTo(e)?[null,this.clone()]:this.end.equalTo(e)?[this.clone(),null]:[new s.Segment(this.start,e),new s.Segment(e,this.end)]}middle(){return new s.Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}pointAtLength(e){if(e>this.length||e<0)return null;if(e==0)return this.start;if(e==this.length)return this.end;let n=e/this.length;return new s.Point((this.end.x-this.start.x)*n+this.start.x,(this.end.y-this.start.y)*n+this.start.y)}distanceToPoint(e){let[n,...r]=s.Distance.point2segment(e,this);return n}definiteIntegral(e=0){let n=this.end.x-this.start.x,r=this.start.y-e,i=this.end.y-e;return n*(r+i)/2}transform(e=new s.Matrix){return new Ks(this.ps.transform(e),this.pe.transform(e))}isZeroLength(){return this.ps.equalTo(this.pe)}sortPoints(e){return new s.Line(this.start,this.end).sortPoints(e)}get name(){return"segment"}svg(e={}){return` +`}};s.Segment=ul;const dv=(...t)=>new s.Segment(...t);s.segment=dv;let{vector:kr}=s,oo=class Vh extends Jt{constructor(...e){if(super(),this.pt=new s.Point,this.norm=new s.Vector(0,1),e.length!==0){if(e.length===1&&e[0]instanceof Object&&e[0].name==="line"){let{pt:n,norm:r}=e[0];this.pt=new s.Point(n),this.norm=new s.Vector(r);return}if(e.length===2){let n=e[0],r=e[1];if(n instanceof s.Point&&r instanceof s.Point){this.pt=n,this.norm=Vh.points2norm(n,r),this.norm.dot(kr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}if(n instanceof s.Point&&r instanceof s.Vector){if(s.Utils.EQ_0(r.x)&&s.Utils.EQ_0(r.y))throw Y.ILLEGAL_PARAMETERS;this.pt=n.clone(),this.norm=r.clone(),this.norm=this.norm.normalize(),this.norm.dot(kr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}if(n instanceof s.Vector&&r instanceof s.Point){if(s.Utils.EQ_0(n.x)&&s.Utils.EQ_0(n.y))throw Y.ILLEGAL_PARAMETERS;this.pt=r.clone(),this.norm=n.clone(),this.norm=this.norm.normalize(),this.norm.dot(kr(this.pt.x,this.pt.y))>=0&&this.norm.invert();return}}throw Y.ILLEGAL_PARAMETERS}}clone(){return new s.Line(this.pt,this.norm)}get start(){}get end(){}get length(){return Number.POSITIVE_INFINITY}get box(){return new s.Box(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}get middle(){}get slope(){return new s.Vector(this.norm.y,-this.norm.x).slope}get standard(){let e=this.norm.x,n=this.norm.y,r=this.norm.dot(kr(this.pt.x,this.pt.y));return[e,n,r]}parallelTo(e){return s.Utils.EQ_0(this.norm.cross(e.norm))}incidentTo(e){return this.parallelTo(e)&&this.pt.on(e)}contains(e){if(this.pt.equalTo(e))return!0;let n=new s.Vector(this.pt,e);return s.Utils.EQ_0(this.norm.dot(n))}coord(e){return kr(e.x,e.y).cross(this.norm)}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return sr(this,e);if(e instanceof s.Ray)return kh(e,this);if(e instanceof s.Circle)return wn(this,e);if(e instanceof s.Box)return bn(this,e);if(e instanceof s.Segment)return vi(e,this);if(e instanceof s.Arc)return no(this,e);if(e instanceof s.Polygon)return yi(this,e);if(e instanceof s.Multiline)return wi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2line(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.circle2line(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2line(e,this);return[n,r.reverse()]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2line(e,this);return[n,r.reverse()]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}}split(e){if(e instanceof s.Point)return[new s.Ray(e,this.norm),new s.Ray(e,this.norm)];{let n=new s.Multiline([this]),r=this.sortPoints(e);return n.split(r),n.toShapes()}}rotate(e,n=new s.Point){return new s.Line(this.pt.rotate(e,n),this.norm.rotate(e))}transform(e){return new s.Line(this.pt.transform(e),this.norm.clone())}sortPoints(e){return e.slice().sort((n,r)=>this.coord(n)this.coord(r)?1:0)}get name(){return"line"}svg(e,n={}){let r=bn(this,e);if(r.length===0)return"";let i=r[0],l=r.length===2?r[1]:r.find(u=>!u.equalTo(i));return l===void 0&&(l=i),new s.Segment(i,l).svg(n)}static points2norm(e,n){if(e.equalTo(n))throw Y.ILLEGAL_PARAMETERS;return new s.Vector(e,n).normalize().rotate90CCW()}};s.Line=oo;const hv=(...t)=>new s.Line(...t);s.line=hv;let $h=class extends Jt{constructor(...e){if(super(),this.pc=new s.Point,this.r=1,e.length===1&&e[0]instanceof Object&&e[0].name==="circle"){let{pc:n,r}=e[0];this.pc=new s.Point(n),this.r=r}else{let[n,r]=[...e];n&&n instanceof s.Point&&(this.pc=n.clone()),r!==void 0&&(this.r=r)}}clone(){return new s.Circle(this.pc.clone(),this.r)}get center(){return this.pc}get box(){return new s.Box(this.pc.x-this.r,this.pc.y-this.r,this.pc.x+this.r,this.pc.y+this.r)}contains(e){if(e instanceof s.Point)return s.Utils.LE(e.distanceTo(this.center)[0],this.r);if(e instanceof s.Segment)return s.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&s.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof s.Arc)return this.intersect(e).length===0&&s.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&s.Utils.LE(e.end.distanceTo(this.center)[0],this.r);if(e instanceof s.Circle)return this.intersect(e).length===0&&s.Utils.LE(e.r,this.r)&&s.Utils.LE(e.center.distanceTo(this.center)[0],this.r)}toArc(e=!0){return new s.Arc(this.center,this.r,Math.PI,-Math.PI,e)}scale(e,n){if(e!==n||!(this.pc.x===0&&this.pc.y===0))throw Y.OPERATION_IS_NOT_SUPPORTED;return new s.Circle(this.pc,this.r*e)}transform(e=new s.Matrix){return new s.Circle(this.pc.transform(e),this.r)}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return wn(e,this);if(e instanceof s.Ray)return Th(e,this);if(e instanceof s.Segment)return io(e,this);if(e instanceof s.Circle)return mh(e,this);if(e instanceof s.Box)return L0(this,e);if(e instanceof s.Arc)return Ju(e,this);if(e instanceof s.Polygon)return xh(this,e);if(e instanceof s.Multiline)return wi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.circle2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.circle2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2circle(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline){let[n,r]=s.Distance.shape2multiline(this,e);return[n,r]}}get name(){return"circle"}svg(e={}){return` +`}};s.Circle=$h;const Hh=(...t)=>new s.Circle(...t);s.circle=Hh;class Xs extends Jt{constructor(...e){if(super(),this.pc=new s.Point,this.r=1,this.startAngle=0,this.endAngle=2*Math.PI,this.counterClockwise=s.CCW,e.length!==0)if(e.length===1&&e[0]instanceof Object&&e[0].name==="arc"){let{pc:n,r,startAngle:i,endAngle:l,counterClockwise:o}=e[0];this.pc=new s.Point(n.x,n.y),this.r=r,this.startAngle=i,this.endAngle=l,this.counterClockwise=o}else{let[n,r,i,l,o]=[...e];n&&n instanceof s.Point&&(this.pc=n.clone()),r!==void 0&&(this.r=r),i!==void 0&&(this.startAngle=i),l!==void 0&&(this.endAngle=l),o!==void 0&&(this.counterClockwise=o)}}clone(){return new s.Arc(this.pc.clone(),this.r,this.startAngle,this.endAngle,this.counterClockwise)}get sweep(){if(s.Utils.EQ(this.startAngle,this.endAngle))return 0;if(s.Utils.EQ(Math.abs(this.startAngle-this.endAngle),s.PIx2))return s.PIx2;let e;return this.counterClockwise?e=s.Utils.GT(this.endAngle,this.startAngle)?this.endAngle-this.startAngle:this.endAngle-this.startAngle+s.PIx2:e=s.Utils.GT(this.startAngle,this.endAngle)?this.startAngle-this.endAngle:this.startAngle-this.endAngle+s.PIx2,s.Utils.GT(e,s.PIx2)&&(e-=s.PIx2),s.Utils.LT(e,0)&&(e+=s.PIx2),e}get start(){return new s.Point(this.pc.x+this.r,this.pc.y).rotate(this.startAngle,this.pc)}get end(){return new s.Point(this.pc.x+this.r,this.pc.y).rotate(this.endAngle,this.pc)}get center(){return this.pc.clone()}get vertices(){return[this.start.clone(),this.end.clone()]}get length(){return Math.abs(this.sweep*this.r)}get box(){let n=this.breakToFunctional().reduce((r,i)=>r.merge(i.start.box),new s.Box);return n=n.merge(this.end.box),n}contains(e){if(!s.Utils.EQ(this.pc.distanceTo(e)[0],this.r))return!1;if(e.equalTo(this.start))return!0;let n=new s.Vector(this.pc,e).slope,r=new s.Arc(this.pc,this.r,this.startAngle,n,this.counterClockwise);return s.Utils.LE(r.length,this.length)}split(e){if(this.start.equalTo(e))return[null,this.clone()];if(this.end.equalTo(e))return[this.clone(),null];let n=new s.Vector(this.pc,e).slope;return[new s.Arc(this.pc,this.r,this.startAngle,n,this.counterClockwise),new s.Arc(this.pc,this.r,n,this.endAngle,this.counterClockwise)]}middle(){let e=this.counterClockwise?this.startAngle+this.sweep/2:this.startAngle-this.sweep/2;return new s.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise).end}pointAtLength(e){if(e>this.length||e<0)return null;if(e===0)return this.start;if(e===this.length)return this.end;let n=e/this.length,r=this.counterClockwise?this.startAngle+this.sweep*n:this.startAngle-this.sweep*n;return new s.Arc(this.pc,this.r,this.startAngle,r,this.counterClockwise).end}chordHeight(){return(1-Math.cos(Math.abs(this.sweep/2)))*this.r}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return no(e,this);if(e instanceof s.Ray)return ta(e,this);if(e instanceof s.Circle)return Ju(this,e);if(e instanceof s.Segment)return ur(e,this);if(e instanceof s.Box)return I0(this,e);if(e instanceof s.Arc)return vh(this,e);if(e instanceof s.Polygon)return bu(this,e);if(e instanceof s.Multiline)return wi(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2arc(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle){let[n,r]=s.Distance.arc2circle(this,e);return[n,r]}if(e instanceof s.Line){let[n,r]=s.Distance.arc2line(this,e);return[n,r]}if(e instanceof s.Segment){let[n,r]=s.Distance.segment2arc(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Arc){let[n,r]=s.Distance.arc2arc(this,e);return[n,r]}if(e instanceof s.Polygon){let[n,r]=s.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof s.PlanarSet){let[n,r]=s.Distance.shape2planarSet(this,e);return[n,r]}if(e instanceof s.Multiline)return s.Distance.shape2multiline(this,e)}breakToFunctional(){let e=[],n=[0,Math.PI/2,2*Math.PI/2,3*Math.PI/2],r=[this.pc.translate(this.r,0),this.pc.translate(0,this.r),this.pc.translate(-this.r,0),this.pc.translate(0,-this.r)],i=[];for(let l=0;l<4;l++)r[l].on(this)&&i.push(new s.Arc(this.pc,this.r,this.startAngle,n[l],this.counterClockwise));if(i.length===0)e.push(this.clone());else{i.sort((u,a)=>u.length-a.length);for(let u=0;u0?e[e.length-1]:void 0,c;a?c=new s.Arc(this.pc,this.r,a.endAngle,i[u].endAngle,this.counterClockwise):c=new s.Arc(this.pc,this.r,this.startAngle,i[u].endAngle,this.counterClockwise),s.Utils.EQ_0(c.length)||e.push(c.clone())}let l=e.length>0?e[e.length-1]:void 0,o;l?o=new s.Arc(this.pc,this.r,l.endAngle,this.endAngle,this.counterClockwise):o=new s.Arc(this.pc,this.r,this.startAngle,this.endAngle,this.counterClockwise),!s.Utils.EQ_0(o.length)&&!s.Utils.EQ(o.sweep,2*Math.PI)&&e.push(o.clone())}return e}tangentInStart(){let e=new s.Vector(this.pc,this.start),n=this.counterClockwise?Math.PI/2:-Math.PI/2;return e.rotate(n).normalize()}tangentInEnd(){let e=new s.Vector(this.pc,this.end),n=this.counterClockwise?-Math.PI/2:Math.PI/2;return e.rotate(n).normalize()}reverse(){return new s.Arc(this.pc,this.r,this.endAngle,this.startAngle,!this.counterClockwise)}transform(e=new s.Matrix){let n=this.start.transform(e),r=this.end.transform(e),i=this.pc.transform(e),l=this.counterClockwise;return e.a*e.d<0&&(l=!l),s.Arc.arcSE(i,n,r,l)}static arcSE(e,n,r,i){let{vector:l}=s,o=l(e,n).slope,u=l(e,r).slope;s.Utils.EQ(o,u)&&(u+=2*Math.PI,i=!0);let a=l(e,n).length;return new s.Arc(e,a,o,u,i)}definiteIntegral(e=0){return this.breakToFunctional().reduce((i,l)=>i+l.circularSegmentDefiniteIntegral(e),0)}circularSegmentDefiniteIntegral(e){let n=new s.Line(this.start,this.end),r=this.pc.leftTo(n),l=new s.Segment(this.start,this.end).definiteIntegral(e),o=this.circularSegmentArea();return r?l-o:l+o}circularSegmentArea(){return .5*this.r*this.r*(this.sweep-Math.sin(this.sweep))}sortPoints(e){let{vector:n}=s;return e.slice().sort((r,i)=>{let l=n(this.pc,r).slope,o=n(this.pc,i).slope;return lo?1:0})}get name(){return"arc"}svg(e={}){let n=this.sweep<=Math.PI?"0":"1",r=this.counterClockwise?"1":"0";return s.Utils.EQ(this.sweep,2*Math.PI)?new s.Circle(this.pc,this.r).svg(e):` +`}}s.Arc=Xs;const pv=(...t)=>new s.Arc(...t);s.arc=pv;class wt extends Jt{constructor(e=void 0,n=void 0,r=void 0,i=void 0){super(),this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i}clone(){return new wt(this.xmin,this.ymin,this.xmax,this.ymax)}get low(){return new s.Point(this.xmin,this.ymin)}get high(){return new s.Point(this.xmax,this.ymax)}get max(){return this.clone()}get center(){return new s.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)}get width(){return Math.abs(this.xmax-this.xmin)}get height(){return Math.abs(this.ymax-this.ymin)}get box(){return this.clone()}not_intersect(e){return this.xmaxe.xmax||this.ymaxe.ymax}intersect(e){return!this.not_intersect(e)}merge(e){return new wt(this.xmin===void 0?e.xmin:Math.min(this.xmin,e.xmin),this.ymin===void 0?e.ymin:Math.min(this.ymin,e.ymin),this.xmax===void 0?e.xmax:Math.max(this.xmax,e.xmax),this.ymax===void 0?e.ymax:Math.max(this.ymax,e.ymax))}less_than(e){return!!(this.low.lessThan(e.low)||this.low.equalTo(e.low)&&this.high.lessThan(e.high))}equal_to(e){return this.low.equalTo(e.low)&&this.high.equalTo(e.high)}output(){return this.clone()}static comparable_max(e,n){return e.merge(n)}static comparable_less_than(e,n){return e.lessThan(n)}set(e,n,r,i){this.xmin=e,this.ymin=n,this.xmax=r,this.ymax=i}toPoints(){return[new s.Point(this.xmin,this.ymin),new s.Point(this.xmax,this.ymin),new s.Point(this.xmax,this.ymax),new s.Point(this.xmin,this.ymax)]}toSegments(){let e=this.toPoints();return[new s.Segment(e[0],e[1]),new s.Segment(e[1],e[2]),new s.Segment(e[2],e[3]),new s.Segment(e[3],e[0])]}rotate(e,n=new s.Point){throw Y.OPERATION_IS_NOT_SUPPORTED}transform(e=new s.Matrix){return this.toPoints().map(r=>r.transform(e)).reduce((r,i)=>r.merge(i.box),new wt)}contains(e){if(e instanceof s.Point)return e.x>=this.xmin&&e.x<=this.xmax&&e.y>=this.ymin&&e.y<=this.ymax;if(e instanceof s.Segment)return e.vertices.every(n=>this.contains(n));if(e instanceof s.Box)return e.toSegments().every(n=>this.contains(n));if(e instanceof s.Circle)return this.contains(e.box);if(e instanceof s.Arc)return e.vertices.every(n=>this.contains(n))&&e.toSegments().every(n=>ur(n,e).length===0);if(e instanceof s.Line||e instanceof s.Ray)return!1;if(e instanceof s.Multiline)return e.toShapes().every(n=>this.contains(n));if(e instanceof s.Polygon)return this.contains(e.box)}distanceTo(e){const n=this.toSegments().map(i=>i.distanceTo(e));let r=[Number.MAX_SAFE_INTEGER,null];return n.forEach(i=>{i[0]`}}s.Box=wt;const gv=(...t)=>new s.Box(...t);s.box=gv;class mv{constructor(e){this.shape=e,this.next=void 0,this.prev=void 0,this.face=void 0,this.arc_length=0,this.bvStart=void 0,this.bvEnd=void 0,this.bv=void 0,this.overlap=void 0}get start(){return this.shape.start}get end(){return this.shape.end}get length(){return this.shape.length}get box(){return this.shape.box}get isSegment(){return this.shape instanceof s.Segment}get isArc(){return this.shape instanceof s.Arc}get isLine(){return this.shape instanceof s.Line}get isRay(){return this.shape instanceof s.Ray}middle(){return this.shape.middle()}pointAtLength(e){return this.shape.pointAtLength(e)}contains(e){return this.shape.contains(e)}setInclusion(e){if(this.bv!==void 0)return this.bv;if(this.shape instanceof s.Line||this.shape instanceof s.Ray)return this.bv=s.OUTSIDE,this.bv;if(this.bvStart===void 0&&(this.bvStart=Hr(e,this.start)),this.bvEnd===void 0&&(this.bvEnd=Hr(e,this.end)),this.bvStart===s.OUTSIDE||this.bvEnd==s.OUTSIDE)this.bv=s.OUTSIDE;else if(this.bvStart===s.INSIDE||this.bvEnd==s.INSIDE)this.bv=s.INSIDE;else{let n=Hr(e,this.middle());this.bv=n}return this.bv}setOverlap(e){let n,r=this.shape,i=e.shape;r instanceof s.Segment&&i instanceof s.Segment?r.start.equalTo(i.start)&&r.end.equalTo(i.end)?n=s.OVERLAP_SAME:r.start.equalTo(i.end)&&r.end.equalTo(i.start)&&(n=s.OVERLAP_OPPOSITE):(r instanceof s.Arc&&i instanceof s.Arc||r instanceof s.Segment&&i instanceof s.Arc||r instanceof s.Arc&&i instanceof s.Segment)&&(r.start.equalTo(i.start)&&r.end.equalTo(i.end)&&r.middle().equalTo(i.middle())?n=s.OVERLAP_SAME:r.start.equalTo(i.end)&&r.end.equalTo(i.start)&&r.middle().equalTo(i.middle())&&(n=s.OVERLAP_OPPOSITE)),this.overlap===void 0&&(this.overlap=n),e.overlap===void 0&&(e.overlap=n)}svg(){if(this.shape instanceof s.Segment)return` L${this.shape.end.x},${this.shape.end.y}`;if(this.shape instanceof s.Arc){let e=this.shape,n,r=e.counterClockwise?"1":"0";if(s.Utils.EQ(e.sweep,2*Math.PI)){let i=e.counterClockwise?1:-1,l=new s.Arc(e.pc,e.r,e.startAngle,e.startAngle+i*Math.PI,e.counterClockwise),o=new s.Arc(e.pc,e.r,e.startAngle+i*Math.PI,e.endAngle,e.counterClockwise);return n="0",` A${l.r},${l.r} 0 ${n},${r} ${l.end.x},${l.end.y} + A${o.r},${o.r} 0 ${n},${r} ${o.end.x},${o.end.y}`}else return n=e.sweep<=Math.PI?"0":"1",` A${e.r},${e.r} 0 ${n},${r} ${e.end.x},${e.end.y}`}}toJSON(){return this.shape.toJSON()}}s.Edge=mv;class vv extends Xu{constructor(e,n){super(e,n),this.setCircularLinks()}setCircularLinks(){this.isEmpty()||(this.last.next=this.first,this.first.prev=this.last)}[Symbol.iterator](){let e;return{next:()=>{let n=e||this.first,r=this.first?e?e===this.first:!1:!0;return e=n?n.next:void 0,{value:n,done:r}}}}append(e){return super.append(e),this.setCircularLinks(),this}insert(e,n){return super.insert(e,n),this.setCircularLinks(),this}remove(e){return super.remove(e),this}}class Un extends vv{constructor(e,...n){if(super(),this._box=void 0,this._orientation=void 0,n.length!==0){if(n.length===1){if(n[0]instanceof Array){let r=n[0];if(r.length===0)return;if(r.every(i=>i instanceof s.Point)){let i=Un.points2segments(r);this.shapes2face(e.edges,i)}else if(r.every(i=>i instanceof Array&&i.length===2)){let i=r.map(o=>new s.Point(o[0],o[1])),l=Un.points2segments(i);this.shapes2face(e.edges,l)}else if(r.every(i=>i instanceof s.Segment||i instanceof s.Arc))this.shapes2face(e.edges,r);else if(r.every(i=>i.name==="segment"||i.name==="arc")){let i=[];for(let l of r){let o;l.name==="segment"?o=new s.Segment(l):o=new s.Arc(l),i.push(o)}this.shapes2face(e.edges,i)}}else if(n[0]instanceof Un){let r=n[0];this.first=r.first,this.last=r.last;for(let i of r)e.edges.add(i)}else if(n[0]instanceof s.Circle)this.shapes2face(e.edges,[n[0].toArc(ch)]);else if(n[0]instanceof s.Box){let r=n[0];this.shapes2face(e.edges,[new s.Segment(new s.Point(r.xmin,r.ymin),new s.Point(r.xmax,r.ymin)),new s.Segment(new s.Point(r.xmax,r.ymin),new s.Point(r.xmax,r.ymax)),new s.Segment(new s.Point(r.xmax,r.ymax),new s.Point(r.xmin,r.ymax)),new s.Segment(new s.Point(r.xmin,r.ymax),new s.Point(r.xmin,r.ymin))])}}n.length===2&&n[0]instanceof s.Edge&&n[1]instanceof s.Edge&&(this.first=n[0],this.last=n[1],this.last.next=this.first,this.first.prev=this.last,this.setArcLength())}}get edges(){return this.toArray()}get shapes(){return this.edges.map(e=>e.shape.clone())}get box(){if(this._box===void 0){let e=new s.Box;for(let n of this)e=e.merge(n.box);this._box=e}return this._box}get perimeter(){return this.last.arc_length+this.last.length}pointAtLength(e){if(e>this.perimeter||e<0)return null;let n=null;for(let r of this)if(e>=r.arc_length&&(r===this.last||e0&&r)break}if(i.length>0&&r)break}return i}findEdgeByPoint(e){let n;for(let r of this)if(!e.equalTo(r.shape.start)&&(e.equalTo(r.shape.end)||r.shape.contains(e))){n=r;break}return n}toPolygon(){return new s.Polygon(this.shapes)}toJSON(){return this.edges.map(e=>e.toJSON())}svg(){let e=`M${this.first.start.x},${this.first.start.y}`;for(let n of this)e+=n.svg();return e+=" z",e}}s.Face=Un;class ia extends Jt{constructor(...e){if(super(),this.pt=new s.Point,this.norm=new s.Vector(0,1),e.length!==0&&(e.length>=1&&e[0]instanceof s.Point&&(this.pt=e[0].clone()),e.length!==1)){if(e.length===2&&e[1]instanceof s.Vector){this.norm=e[1].clone();return}throw Y.ILLEGAL_PARAMETERS}}clone(){return new ia(this.pt,this.norm)}get slope(){return new s.Vector(this.norm.y,-this.norm.x).slope}get box(){let e=this.slope;return new s.Box(e>Math.PI/2&&e<3*Math.PI/2?Number.NEGATIVE_INFINITY:this.pt.x,e>=0&&e<=Math.PI?this.pt.y:Number.NEGATIVE_INFINITY,e>=Math.PI/2&&e<=3*Math.PI/2?this.pt.x:Number.POSITIVE_INFINITY,e>=Math.PI&&e<=2*Math.PI||e===0?this.pt.y:Number.POSITIVE_INFINITY)}get start(){return this.pt}get end(){}get length(){return Number.POSITIVE_INFINITY}contains(e){if(this.pt.equalTo(e))return!0;let n=new s.Vector(this.pt,e);return s.Utils.EQ_0(this.norm.dot(n))&&s.Utils.GE(n.cross(this.norm),0)}coord(e){return jh(e.x,e.y).cross(this.norm)}split(e){return this.contains(e)?this.pt.equalTo(e)?[this]:[new s.Segment(this.pt,e),new s.Ray(e,this.norm)]:[]}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Segment)return ea(this,e);if(e instanceof s.Arc)return ta(this,e);if(e instanceof s.Line)return kh(this,e);if(e instanceof s.Ray)return U0(this,e);if(e instanceof s.Circle)return Th(this,e);if(e instanceof s.Box)return R0(this,e);if(e instanceof s.Polygon)return Ch(this,e)}rotate(e,n=new s.Point){return new s.Ray(this.pt.rotate(e,n),this.norm.rotate(e))}transform(e){return new s.Ray(this.pt.transform(e),this.norm.clone())}get name(){return"ray"}svg(e,n={}){let r=new s.Line(this.pt,this.norm),i=bn(r,e);return i=i.filter(o=>this.contains(o)),i.length===0||i.length===2?"":new s.Segment(this.pt,i[0]).svg(n)}}s.Ray=ia;const yv=(...t)=>new s.Ray(...t);s.ray=yv;let wv=class En{constructor(){this.faces=new s.PlanarSet,this.edges=new s.PlanarSet;let e=[...arguments];if(e.length===1&&(e[0]instanceof Array&&e[0].length>0||e[0]instanceof s.Circle||e[0]instanceof s.Box)){let n=e[0];if(e[0]instanceof Array&&e[0].every(r=>r instanceof Array))if(n.every(r=>r instanceof Array&&r.length===2&&typeof r[0]=="number"&&typeof r[1]=="number"))this.faces.add(new s.Face(this,n));else for(let r of n)if(r instanceof Array&&r[0]instanceof Array&&r[0].every(i=>i instanceof Array&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number"))for(let i of r)this.faces.add(new s.Face(this,i));else this.faces.add(new s.Face(this,r));else this.faces.add(new s.Face(this,n))}}get box(){return[...this.faces].reduce((e,n)=>e.merge(n.box),new s.Box)}get vertices(){return[...this.edges].map(e=>e.start)}clone(){let e=new En;for(let n of this.faces)e.addFace(n.shapes);return e}isEmpty(){return this.edges.size===0}isValid(){let e=!0;for(let n of this.faces)if(!n.isSimple(this.edges)){e=!1;break}return e}area(){let e=[...this.faces].reduce((n,r)=>n+r.signedArea(),0);return Math.abs(e)}addFace(...e){let n=new s.Face(this,...e);return this.faces.add(n),n}deleteFace(e){for(let n of e)this.edges.delete(n);return this.faces.delete(e)}recreateFaces(){this.faces.clear();for(let r of this.edges)r.face=null;let e,n=!0;for(;n;){n=!1;for(let r of this.edges)if(r.face===null){e=r,n=!0;break}if(n){let r=e;do r=r.next;while(r.next!==e);this.addFace(e,r)}}}removeChain(e,n,r){if(r.next===n){this.deleteFace(e);return}for(let i=n;i!==r.next;i=i.next)if(e.remove(i),this.edges.delete(i),e.isEmpty()){this.deleteFace(e);break}}addVertex(e,n){let r=n.shape.split(e);if(r[0]===null)return n.prev;if(r[1]===null)return n;let i=new s.Edge(r[0]),l=n.prev;return n.face.insert(i,l),this.edges.delete(n),this.edges.add(i),n.shape=r[1],this.edges.add(n),i}removeEndVertex(e){const n=e.next;n!==e&&(e.face.merge_with_next_edge(e),this.edges.delete(n))}cut(e){let n=this.clone(),r={int_points1:[],int_points2:[],int_points1_sorted:[],int_points2_sorted:[]};for(let o of e.edges)for(let u of n.edges){let a=Sh(o,u);for(let c of a)er(o,c,r.int_points1),er(u,c,r.int_points2)}if(r.int_points1.length===0)return n;r.int_points1_sorted=It(r.int_points1),r.int_points2_sorted=It(r.int_points2),nr(e,r.int_points1_sorted),nr(n,r.int_points2_sorted),na(r),r.int_points1_sorted=It(r.int_points1),r.int_points2_sorted=It(r.int_points2),Vs(r.int_points1),$s(r.int_points1,n);for(let o of r.int_points1_sorted)o.edge_before&&o.edge_after&&o.edge_before.bv===o.edge_after.bv&&(r.int_points2[o.id]=-1,o.id=-1);if(r.int_points1=r.int_points1.filter(o=>o.id>=0),r.int_points2=r.int_points2.filter(o=>o.id>=0),r.int_points1.forEach((o,u)=>{o.id=u}),r.int_points2.forEach((o,u)=>{o.id=u}),r.int_points1.length===0)return n;r.int_points1_sorted=It(r.int_points1),r.int_points2_sorted=It(r.int_points2);let i,l;for(let o=1;on.edges.add(f)),c=c.reverse().map(f=>new s.Edge(f.shape.reverse()));for(let f=0;fn.edges.add(f))}return n.recreateFaces(),n}cutWithLine(e){let n=new _n([e]);return this.cut(n)}findEdgeByPoint(e){let n;for(let r of this.faces)if(n=r.findEdgeByPoint(e),n!==void 0)break;return n}splitToIslands(){if(this.isEmpty())return[];let e=this.toArray();e.sort((i,l)=>l.area()-i.area());let n=[...e[0].faces][0].orientation(),r=e.filter(i=>[...i.faces][0].orientation()===n);for(let i of e){let l=[...i.faces][0];if(l.orientation()!==n){for(let o of r)if(l.shapes.every(u=>o.contains(u))){o.addFace(l.shapes);break}}}return r}reverse(){for(let e of this.faces)e.reverse();return this}contains(e){if(e instanceof s.Point){let n=Hr(this,e);return n===Ml||n===rt}else return Uh(this,e)}distanceTo(e){if(e instanceof s.Point){let[n,r]=s.Distance.point2polygon(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Circle||e instanceof s.Line||e instanceof s.Segment||e instanceof s.Arc){let[n,r]=s.Distance.shape2polygon(e,this);return r=r.reverse(),[n,r]}if(e instanceof s.Polygon){let n=[Number.POSITIVE_INFINITY,new s.Segment],r,i;for(let l of this.edges){let o=n[0];[r,i]=s.Distance.shape2planarSet(l.shape,e.edges,o),s.Utils.LT(r,o)&&(n=[r,i])}return n}}intersect(e){if(e instanceof s.Point)return this.contains(e)?[e]:[];if(e instanceof s.Line)return yi(e,this);if(e instanceof s.Ray)return Ch(e,this);if(e instanceof s.Circle)return xh(e,this);if(e instanceof s.Segment)return Zu(e,this);if(e instanceof s.Arc)return bu(e,this);if(e instanceof s.Polygon)return M0(e,this);if(e instanceof s.Multiline)return O0(e,this)}translate(e){let n=new En;for(let r of this.faces)n.addFace(r.shapes.map(i=>i.translate(e)));return n}rotate(e=0,n=new s.Point){let r=new En;for(let i of this.faces)r.addFace(i.shapes.map(l=>l.rotate(e,n)));return r}scale(e,n){let r=new En;for(let i of this.faces)r.addFace(i.shapes.map(l=>l.scale(e,n)));return r}transform(e=new s.Matrix){let n=new En;for(let r of this.faces)n.addFace(r.shapes.map(i=>i.transform(e)));return n}toJSON(){return[...this.faces].map(e=>e.toJSON())}toArray(){return[...this.faces].map(e=>e.toPolygon())}dpath(){return[...this.faces].reduce((e,n)=>e+n.svg(),"")}svg(e={}){let n=` + +`,n}};s.Polygon=wv;const _v=(...t)=>new s.Polygon(...t);s.polygon=_v;const{Circle:Ho,Line:Fc,Point:Bc,Vector:Gi,Utils:Wo}=s;class Wr{constructor(e){this.circle=e}get inversion_circle(){return this.circle}static inversePoint(e,n){const r=new Gi(e.pc,n),i=e.r*e.r,l=r.dot(r);return Wo.EQ_0(l)?new Bc(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY):e.pc.translate(r.multiply(i/l))}static inverseCircle(e,n){const r=e.pc.distanceTo(n.pc)[0];if(Wo.EQ(r,n.r)){let i=e.r*e.r/(2*n.r),l=new Gi(e.pc,n.pc);l=l.normalize();let o=e.pc.translate(l.multiply(i));return new Fc(o,l)}else{let i=new Gi(e.pc,n.pc),l=e.r*e.r/(i.dot(i)-n.r*n.r),o=e.pc.translate(i.multiply(l)),u=Math.abs(l)*n.r;return new Ho(o,u)}}static inverseLine(e,n){const[r,i]=e.pc.distanceTo(n);if(Wo.EQ_0(r))return n.clone();{let l=e.r*e.r/(2*r),o=new Gi(e.pc,i.end);return o=o.multiply(l/r),new Ho(e.pc.translate(o),l)}}inverse(e){if(e instanceof Bc)return Wr.inversePoint(this.circle,e);if(e instanceof Ho)return Wr.inverseCircle(this.circle,e);if(e instanceof Fc)return Wr.inverseLine(this.circle,e)}}s.Inversion=Wr;const xv=t=>new s.Inversion(t);s.inversion=xv;class E{static point2point(e,n){return e.distanceTo(n)}static point2line(e,n){let r=e.projectionOn(n);return[new s.Vector(e,r).length,new s.Segment(e,r)]}static point2circle(e,n){let[r,i]=e.distanceTo(n.center);if(s.Utils.EQ_0(r))return[n.r,new s.Segment(e,n.toArc().start)];{let l=Math.abs(r-n.r),o=new s.Vector(n.pc,e).normalize().multiply(n.r),u=n.pc.translate(o);return[l,new s.Segment(e,u)]}}static point2segment(e,n){if(n.start.equalTo(n.end))return E.point2point(e,n.start);let r=new s.Vector(n.start,n.end),i=new s.Vector(n.start,e),l=new s.Vector(n.end,e),o=r.dot(i),u=-r.dot(l),a,c;if(s.Utils.GE(o,0)&&s.Utils.GE(u,0)){let f=n.tangentInStart();return a=Math.abs(f.cross(i)),c=n.start.translate(f.multiply(f.dot(i))),[a,new s.Segment(e,c)]}else return o<0?e.distanceTo(n.start):e.distanceTo(n.end)}static point2arc(e,n){let r=new s.Circle(n.pc,n.r),i=[],l,o;return[l,o]=E.point2circle(e,r),o.end.on(n)&&i.push(E.point2circle(e,r)),i.push(E.point2point(e,n.start)),i.push(E.point2point(e,n.end)),E.sort(i),i[0]}static point2edge(e,n){return n.shape instanceof s.Segment?E.point2segment(e,n.shape):E.point2arc(e,n.shape)}static segment2line(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=[];return i.push(E.point2line(e.start,n)),i.push(E.point2line(e.end,n)),E.sort(i),i[0]}static segment2segment(e,n){let r=ro(e,n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=[],l,o;return[l,o]=E.point2segment(n.start,e),i.push([l,o.reverse()]),[l,o]=E.point2segment(n.end,e),i.push([l,o.reverse()]),i.push(E.point2segment(e.start,n)),i.push(E.point2segment(e.end,n)),E.sort(i),i[0]}static segment2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Line(e.ps,e.pe),[l,o]=E.point2line(n.center,i);if(s.Utils.GE(l,n.r)&&o.end.on(e))return E.point2circle(o.end,n);{let[u,a]=E.point2circle(e.start,n),[c,f]=E.point2circle(e.end,n);return s.Utils.LT(u,c)?[u,a]:[c,f]}}static segment2arc(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Line(e.ps,e.pe),l=new s.Circle(n.pc,n.r),[o,u]=E.point2line(l.center,i);if(s.Utils.GE(o,l.r)&&u.end.on(e)){let[h,m]=E.point2circle(u.end,l);if(m.end.on(n))return[h,m]}let a=[];a.push(E.point2arc(e.start,n)),a.push(E.point2arc(e.end,n));let c,f;return[c,f]=E.point2segment(n.start,e),a.push([c,f.reverse()]),[c,f]=E.point2segment(n.end,e),a.push([c,f.reverse()]),E.sort(a),a[0]}static circle2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];if(e.center.equalTo(n.center)){let i=e.toArc(),l=n.toArc();return E.point2point(i.start,l.start)}else{let i=new s.Line(e.center,n.center),l=i.intersect(e),o=i.intersect(n),u=[];return u.push(E.point2point(l[0],o[0])),u.push(E.point2point(l[0],o[1])),u.push(E.point2point(l[1],o[0])),u.push(E.point2point(l[1],o[1])),E.sort(u),u[0]}}static circle2line(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let[i,l]=E.point2line(e.center,n),[o,u]=E.point2circle(l.end,e);return u=u.reverse(),[o,u]}static arc2line(e,n){let r=n.intersect(e);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),[l,o]=E.point2line(i.center,n);if(s.Utils.GE(l,i.r)){let[u,a]=E.point2circle(o.end,i);if(a.end.on(e))return[u,a]}else{let u=[];return u.push(E.point2line(e.start,n)),u.push(E.point2line(e.end,n)),E.sort(u),u[0]}}static arc2circle(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),[l,o]=E.circle2circle(i,n);if(o.start.on(e))return[l,o];{let u=[];return u.push(E.point2circle(e.start,n)),u.push(E.point2circle(e.end,n)),E.sort(u),u[0]}}static arc2arc(e,n){let r=e.intersect(n);if(r.length>0)return[0,new s.Segment(r[0],r[0])];let i=new s.Circle(e.center,e.r),l=new s.Circle(n.center,n.r),[o,u]=E.circle2circle(i,l);if(u.start.on(e)&&u.end.on(n))return[o,u];{let a=[],c,f;return[c,f]=E.point2arc(e.start,n),f.end.on(n)&&a.push([c,f]),[c,f]=E.point2arc(e.end,n),f.end.on(n)&&a.push([c,f]),[c,f]=E.point2arc(n.start,e),f.end.on(e)&&a.push([c,f.reverse()]),[c,f]=E.point2arc(n.end,e),f.end.on(e)&&a.push([c,f.reverse()]),[c,f]=E.point2point(e.start,n.start),a.push([c,f]),[c,f]=E.point2point(e.start,n.end),a.push([c,f]),[c,f]=E.point2point(e.end,n.start),a.push([c,f]),[c,f]=E.point2point(e.end,n.end),a.push([c,f]),E.sort(a),a[0]}}static point2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n.edges){let[l,o]=E.point2edge(e,i);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static shape2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n.edges){let[l,o]=e.distanceTo(i.shape);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static polygon2polygon(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of e.edges)for(let l of n.edges){let[o,u]=i.shape.distanceTo(l.shape);s.Utils.LT(o,r[0])&&(r=[o,u])}return r}static box2box_minmax(e,n){let r=Math.max(Math.max(e.xmin-n.xmax,0),Math.max(n.xmin-e.xmax,0)),i=Math.max(Math.max(e.ymin-n.ymax,0),Math.max(n.ymin-e.ymax,0)),l=r*r+i*i,o=e.merge(n),u=o.xmax-o.xmin,a=o.ymax-o.ymin,c=u*u+a*a;return[l,c]}static minmax_tree_process_level(e,n,r,i){let l,o;for(let f of n)[l,o]=E.box2box_minmax(e.box,f.item.key),f.item.value instanceof s.Edge?i.insert([l,o],f.item.value.shape):i.insert([l,o],f.item.value),s.Utils.LT(o,r)&&(r=o);if(n.length===0)return r;let u=n.map(f=>f.left.isNil()?void 0:f.left).filter(f=>f!==void 0),a=n.map(f=>f.right.isNil()?void 0:f.right).filter(f=>f!==void 0),c=[...u,...a].filter(f=>{let[h,m]=E.box2box_minmax(e.box,f.max);return s.Utils.LE(h,r)});return r=E.minmax_tree_process_level(e,c,r,i),r}static minmax_tree(e,n,r){let i=new ai,l=[n.index.root],o=rs.Utils.LT(n[0],r[0])?-1:s.Utils.GT(n[0],r[0])?1:0)}static distance(e,n){return e.distanceTo(n)}static shape2multiline(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of n){let[l,o]=E.distance(e,i.shape);s.Utils.LT(l,r[0])&&(r=[l,o])}return r}static multiline2multiline(e,n){let r=[Number.POSITIVE_INFINITY,new s.Segment];for(let i of e)for(let l of n){let[o,u]=E.distance(i.shape,l.shape);s.Utils.LT(o,r[0])&&(r=[o,u])}return r}}s.Distance=E;const{Multiline:Sv,Point:Wh,Segment:Ev,Polygon:Qh}=s;function la(t){return new Wh(t.split(" ").map(Number))}function Gh(t){return t.split(", ").map(la)}function oa(t){const e=Gh(t);let n=[];for(let r=0;r{let o=i.split(", ").map(a=>new Wh(a.split(" ").map(Number)));const u=n.addFace(o);l===0?r=u.orientation():u.orientation()===r&&u.reverse()}),n}function Tv(t){const n=t.split(/\)\), \(\(/).map(l=>"(("+l+"))").map(Yh),r=new Qh;return n.reduce((l,o)=>[...l,...o==null?void 0:o.faces],[]).forEach(l=>r.addFace([...l==null?void 0:l.shapes])),r}function kv(t){if(t.startsWith("POLYGON")){const e=t.replace(/^POLYGON /,"");return Yh(e)}else{const e=t.replace(/^MULTIPOLYGON \(\(\((.*)\)\)\)$/,"$1");return Tv(e)}}function Cv(t){return t.split(` +`).map(n=>n.match(/\(([^)]+)\)/)[1]).map(la)}function Lv(t){return t.split(` +`).map(n=>n.match(/\(([^)]+)\)/)[1]).map(oa).reduce((n,r)=>[...n,...r],[])}function qh(t){if(t.startsWith("POINT")){const e=t.replace(/^POINT \(/,"").replace(/\)$/,"");return la(e)}else if(t.startsWith("MULTIPOINT")){const e=t.replace(/^MULTIPOINT \(/,"").replace(/\)$/,"");return Gh(e)}else if(t.startsWith("LINESTRING")){const e=t.replace(/^LINESTRING \(/,"").replace(/\)$/,"");return oa(e)}else if(t.startsWith("MULTILINESTRING")){const e=t.replace(/^MULTILINESTRING /,"");return Pv(e)}else{if(t.startsWith("POLYGON")||t.startsWith("MULTIPOLYGON"))return kv(t);if(t.startsWith("GEOMETRYCOLLECTION")){const e=/(?POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \((?:[^\(\)]|\([^\)]*\))*\)/g,n=t.match(e);return n[0].startsWith("GEOMETRYCOLLECTION")&&(n[0]=n[0].replace("GEOMETRYCOLLECTION (","")),n.map(qh).map(i=>i instanceof Array?i:[i]).reduce((i,l)=>[...i,...l],[])}else{if(Kh(t))return Cv(t);if(Xh(t))return Lv(t)}}return[]}function Kh(t){var e;return(e=t.split(` +`))==null?void 0:e.every(n=>n.includes("POINT"))}function Xh(t){var e;return(e=t.split(` +`))==null?void 0:e.every(n=>n.includes("LINESTRING"))}function Iv(t){return t.startsWith("POINT")||Kh(t)||t.startsWith("LINESTRING")||Xh(t)||t.startsWith("MULTILINESTRING")||t.startsWith("POLYGON")||t.startsWith("MULTIPOINT")||t.startsWith("MULTIPOLYGON")||t.startsWith("GEOMETRYCOLLECTION")}s.isWktString=Iv;s.parseWKT=qh;s.BooleanOperations=K0;s.Relations=Dh;function dt(t){const e=Ei(),n=Gt();return new z((t.x-e.x)*n,(t.y-e.y)*n)}function so(t){const e=Ei(),n=Gt();return new z(t.x/n+e.x,t.y/n+e.y)}var $=(t=>(t.canvasSize="canvasSize",t.canvas="canvas",t.context="context",t.screenMouseLocation="screenMouseLocation",t.activeTool="activeTool",t.entities="entities",t.activeEntity="activeEntity",t.shouldDrawCursor="shouldDrawCursor",t.helperEntities="helperEntities",t.debugEntities="debugEntities",t.angleStep="angleStep",t.screenOffset="screenOffset",t.screenScale="screenScale",t.panStartLocation="panStartLocation",t.snapPoint="snapPoint",t.snapPointOnAngleGuide="snapPointOnAngleGuide",t.hoveredSnapPoints="hoveredSnapPoints",t.lastDrawTimestamp="lastDrawTimestamp",t))($||{});function Av(){let t=[],e=t.length;function n(){return t[e-1]}return{push:r=>(t.length=e,t[e++]=r,console.log("stack push",JSON.stringify(t,null,2)),n()),replace:r=>(t[e-1]=r,console.log("stack replace",JSON.stringify(t,null,2)),n()),peek:()=>n(),undo:()=>(e>1&&(e-=1),console.log("stack undo",JSON.stringify(t,null,2)),n()),redo:()=>(e{e=e-t.slice(0,e).filter(i=>i.variable===r).length,t=t.filter(i=>i.variable!==r)}}}function Pt(t){const e=[];for(const n of t)n&&e.push(n);return e}function Nv(t,e,n){return te?n==="asc"?1:-1:0}function uo(t,e){return t.slice().sort((n,r)=>{for(let i=0;i!e(l,r))&&n.push(r);return n}function Ov(){}function jc(t){if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;if(t.toString()!=="[object Object]")return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}const Mv="[object RegExp]",zv="[object String]",Rv="[object Number]",Uv="[object Boolean]",Vc="[object Arguments]",Dv="[object Symbol]",Fv="[object Date]",Bv="[object Map]",jv="[object Set]",Vv="[object Array]",$v="[object Function]",Hv="[object ArrayBuffer]",Qo="[object Object]",Wv="[object Error]",Qv="[object DataView]",Gv="[object Uint8Array]",Yv="[object Uint8ClampedArray]",qv="[object Uint16Array]",Kv="[object Uint32Array]",Xv="[object BigUint64Array]",Jv="[object Int8Array]",Zv="[object Int16Array]",bv="[object Int32Array]",e1="[object BigInt64Array]",t1="[object Float32Array]",n1="[object Float64Array]";function $c(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function Hc(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}function r1(t,e){if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return pt(t,e)}return pt(t,e)}function pt(t,e,n){if(Object.is(t,e))return!0;let r=Hc(t),i=Hc(e);if(r===Vc&&(r=Qo),i===Vc&&(i=Qo),r!==i)return!1;switch(r){case zv:return t.toString()===e.toString();case Rv:{const u=t.valueOf(),a=e.valueOf();return u===a||Number.isNaN(u)&&Number.isNaN(a)}case Uv:case Fv:case Dv:return Object.is(t.valueOf(),e.valueOf());case Mv:return t.source===e.source&&t.flags===e.flags;case $v:return t===e}n=n??new Map;const l=n.get(t),o=n.get(e);if(l!=null&&o!=null)return l===e;n.set(t,e),n.set(e,t);try{switch(r){case Bv:{if(t.size!==e.size)return!1;for(const[u,a]of t.entries())if(!e.has(u)||!pt(a,e.get(u),n))return!1;return!0}case jv:{if(t.size!==e.size)return!1;const u=Array.from(t.values()),a=Array.from(e.values());for(let c=0;cpt(f,m,n));if(h===-1)return!1;a.splice(h,1)}return!0}case Vv:case Gv:case Yv:case qv:case Kv:case Xv:case Jv:case Zv:case bv:case e1:case t1:case n1:{if(typeof Buffer<"u"&&Buffer.isBuffer(t)!==Buffer.isBuffer(e)||t.length!==e.length)return!1;for(let u=0;uJh,i1=()=>Zh,ap=()=>sa,ot=()=>bh,xe=()=>ci,Go=()=>ao,fr=()=>Rl,l1=()=>tp,o1=()=>np,s1=()=>rp,Js=()=>Ul,Ei=()=>Dl,Gt=()=>Fl,u1=()=>ip,aa=()=>lp,cp=()=>op,ca=()=>sp,a1=()=>up,dr=()=>so(sa),c1=()=>ci.filter(t=>!ao.includes(t.id)),Qn=t=>ao.includes(t.id),fa=t=>ep.includes(t.id),f1=t=>Jh=t,d1=t=>Zh=t,h1=t=>sa=t,Or=(t,e=!0)=>{e&&gp($.activeTool),bh=t},xn=t=>{Pi($.entities,ci),ci=t},pe=t=>{Pi($.activeEntity,Rl),Rl=t},fi=t=>ep=t,ke=t=>ao=t,da=t=>tp=t,p1=t=>np=t,ha=t=>rp=t,g1=(t,e=!0)=>{e&&gp($.activeTool),Pi($.angleStep,Ul),Ul=t},fp=t=>{Pi($.screenOffset,Dl),Dl=t},m1=t=>{Pi($.screenScale,Fl),Fl=t},pa=t=>ip=t,v1=t=>lp=t,y1=t=>op=t,w1=t=>sp=t,_1=t=>up=t,rr=t=>{const e=xe().filter(n=>n.id!==t.id);return xn(e),e},co=(...t)=>{const e=[...xe(),...t];return xn(e),e},x1=[$.activeTool,$.angleStep],S1=[$.entities,$.activeEntity,$.angleStep,$.screenOffset,$.screenScale],E1=[$.angleStep,$.screenOffset,$.screenScale],Dn=Av();function Pi(t,e){if(!S1.includes(t))return;const n=Dn.peek();if(!r1(e,n==null?void 0:n.value)){if(t!==$.activeEntity&&Dn.clear($.activeEntity),E1.includes(t)&&(n==null?void 0:n.variable)===t){Dn.replace({variable:t,value:e});return}Dn.push({variable:t,value:e})}}function dp(t){const e=t.variable,n=t.value;switch(e){case $.entities:ci=n;break;case $.activeEntity:Rl=n;break;case $.angleStep:Ul=n;break;case $.screenOffset:Dl=n;break;case $.screenScale:Fl=n;break}}function hp(){const t=Dn.undo();t&&dp(t)}function pp(){const t=Dn.redo();t&&dp(t)}function gp(t){x1.includes(t)&&(console.log("triggering react update for: ",t),window.dispatchEvent(new CustomEvent(t)))}const Zs=1e-6,Yi=10,qi=30,P1="#111",T1="#fff",k1="#666666",C1="#FFFF00",ga=15,L1=15,ma=15,D=15,va=1e3,I1=3,A1="#b6ff9a",N1="#6899f3",O1=.1;var mp={exports:{}};(function(t,e){(function(n,r){r()})(vr,function(){function n(c,f){return typeof f>"u"?f={autoBom:!1}:typeof f!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),f={autoBom:!f}),f.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 r(c,f,h){var m=new XMLHttpRequest;m.open("GET",c),m.responseType="blob",m.onload=function(){a(m.response,f,h)},m.onerror=function(){console.error("could not download file")},m.send()}function i(c){var f=new XMLHttpRequest;f.open("HEAD",c,!1);try{f.send()}catch{}return 200<=f.status&&299>=f.status}function l(c){try{c.dispatchEvent(new MouseEvent("click"))}catch{var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),c.dispatchEvent(f)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof vr=="object"&&vr.global===vr?vr:void 0,u=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!u?function(c,f,h){var m=o.URL||o.webkitURL,v=document.createElement("a");f=f||c.name||"download",v.download=f,v.rel="noopener",typeof c=="string"?(v.href=c,v.origin===location.origin?l(v):i(v.href)?r(c,f,h):l(v,v.target="_blank")):(v.href=m.createObjectURL(c),setTimeout(function(){m.revokeObjectURL(v.href)},4e4),setTimeout(function(){l(v)},0))}:"msSaveOrOpenBlob"in navigator?function(c,f,h){if(f=f||c.name||"download",typeof c!="string")navigator.msSaveOrOpenBlob(n(c,h),f);else if(i(c))r(c,f,h);else{var m=document.createElement("a");m.href=c,m.target="_blank",setTimeout(function(){l(m)})}}:function(c,f,h,m){if(m=m||open("","_blank"),m&&(m.document.title=m.document.body.innerText="downloading..."),typeof c=="string")return r(c,f,h);var v=c.type==="application/octet-stream",_=/constructor/i.test(o.HTMLElement)||o.safari,w=/CriOS\/[\d]+/.test(navigator.userAgent);if((w||v&&_||u)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var p=I.result;p=w?p:p.replace(/^data:[^;]*;/,"data:attachment/file;"),m?m.location.href=p:location=p,m=null},I.readAsDataURL(c)}else{var g=o.URL||o.webkitURL,d=g.createObjectURL(c);m?m.location=d:location.href=d,m=null,setTimeout(function(){g.revokeObjectURL(d)},4e4)}});o.saveAs=a.saveAs=a,t.exports=a})})(mp);var ya=mp.exports;function vp(t,e){let n=e.x,r=e.y,i=0,l=0;const o=[];t.forEach(f=>{const h=f.getBoundingBox();h&&(n=Math.min(n,h.xmin),r=Math.min(r,h.ymin),i=Math.max(i,h.xmax),l=Math.max(l,h.ymax))}),console.log("exporting svg",o);const u=i-n+Yi*2,a=l-r+Yi*2;return t.forEach(f=>{const h=f.getShape();if(!h)return;const v=h.translate(new Bh(new z(n,r),new z(Yi,Yi))).svg();v&&o.push(v)}),{svgString:` + + + ${o.join("")} + + `,width:u,height:a}}function M1(){const t=xe(),e=ua(),n=vp(t,e),r=new Blob([n.svgString],{type:"text/svg;charset=utf-8"});ya.saveAs(r,"open-web-cad--drawing.svg")}function z1(t,e,n,r){return new Promise((i,l)=>{const o=document.createElement("canvas"),u=o.getContext("2d");if(!u)throw new Error("Could not get canvas context");const a=new Image,c=new Blob([t],{type:"image/svg+xml"}),f=URL.createObjectURL(c);a.onload=()=>{o.width=e+r*2,o.height=n+r*2,u.fillStyle="white",u.fillRect(0,0,o.width,o.height),u.drawImage(a,r,r),URL.revokeObjectURL(f),o.toBlob(h=>{h?i(h):l(new Error("Could not convert canvas to blob"))},"image/png")},a.src=f})}async function R1(){const t=xe(),e=ua(),n=vp(t,e),r=await z1(n.svgString,n.width,n.height,20);ya.saveAs(r,"open-web-cad--drawing.png")}function U1(){const t=xe(),n={entities:Pt(t.map(l=>l.toJson()))},r=JSON.stringify(n,null,2),i=new Blob([r],{type:"text/json;charset=utf-8"});ya.saveAs(i,"open-web-cad--drawing.json")}var J=(t=>(t.Line="Line",t.Circle="Circle",t.Arc="Arc",t.Rectangle="Rectangle",t.SelectionRectangle="SelectionRectangle",t.Point="Point",t))(J||{}),j=(t=>(t.AngleGuide="AngleGuide",t.LineEndPoint="LineEndPoint",t.Intersection="Intersection",t.CircleCenter="CircleCenter",t.CircleCardinal="CircleCardinal",t.CircleTangent="CircleTangent",t.LineMidPoint="LineMidPoint",t.Point="Point",t))(j||{}),Bl=(t=>(t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Back=3]="Back",t[t.Forward=4]="Forward",t))(Bl||{});class fo{constructor(e,n){ie(this,"id",crypto.randomUUID());ie(this,"rectangle",null);ie(this,"startPoint",null);e&&(this.startPoint=e),e&&n&&(this.rectangle=new wt(Math.min(e.x,n.x),Math.min(e.y,n.y),Math.max(e.x,n.x),Math.max(e.y,n.y)))}send(e){if(this.startPoint){if(!this.rectangle)return this.rectangle=new wt(Math.min(this.startPoint.x,e.x),Math.min(this.startPoint.y,e.y),Math.max(this.startPoint.x,e.x),Math.max(this.startPoint.y,e.y)),!0}else return this.startPoint=e,!1;return!0}draw(e){if(!this.startPoint&&!this.rectangle)return;let n,r;this.rectangle?(n=this.rectangle.high,r=this.rectangle.low):(n=this.startPoint,r=new z(e.worldMouseLocation.x,e.worldMouseLocation.y));const i=dt(n),l=dt(r);e.context.beginPath(),e.context.strokeRect(i.x,i.y,l.x-i.x,l.y-i.y)}intersectsWithBox(e){return this.rectangle?Dh.relate(this.rectangle,e).B2B.length>0:!1}isContainedInBox(e){return this.rectangle?e.contains(this.rectangle):!1}distanceTo(e){if(!this.rectangle)return null;const n=this.rectangle.toSegments().map(i=>i.distanceTo(e));let r=[Number.MAX_SAFE_INTEGER,null];return n.forEach(i=>{i[0]r.intersect(n))}getFirstPoint(){return this.startPoint}getSvgString(){var n,r;const e=(n=this.rectangle)==null?void 0:n.svg();return((r=e==null?void 0:e.replace(/width=([0-9]+)/g,'width="$1"'))==null?void 0:r.replace(/height=([0-9]+)/g,'height="$1"'))||null}getType(){return J.Rectangle}containsPointOnShape(e){return this.rectangle?this.rectangle.toSegments().some(n=>n.contains(e)):!1}toJson(){return this.rectangle?{id:this.id,type:J.Rectangle,shapeData:{xmin:this.rectangle.xmin,ymin:this.rectangle.ymin,xmax:this.rectangle.xmax,ymax:this.rectangle.ymax}}:null}fromJson(e){const n=new z(e.shapeData.xmin,e.shapeData.ymin),r=new z(e.shapeData.xmax,e.shapeData.ymax),i=new fo(n,r);return i.id=e.id,i}}function $t(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function et(t,e){return Math.abs(t.x-e.x)({point:l,angle:(new oo(e,l).slope-r+2*Math.PI)%(2*Math.PI)}));return uo(i,[l=>l.angle]).map(l=>l.point)}class it{constructor(e,n,r,i){ie(this,"id",crypto.randomUUID());ie(this,"arc",null);ie(this,"centerPoint",null);ie(this,"firstPoint",null);if(e&&(this.centerPoint=e),e&&n&&(this.firstPoint=n),e&&n&&r){const l=it.getAngle(e,n),o=it.getAngle(e,r);this.arc=new Xs(e,$t(e,n),l,o,i)}}static getAngle(e,n){return new oo(e,n).slope}send(e){if(this.centerPoint){if(!this.firstPoint)this.firstPoint=new z(e.x,e.y);else if(!this.arc){const n=it.getAngle(this.centerPoint,this.firstPoint),r=it.getAngle(this.centerPoint,e);return this.arc=new Xs(this.centerPoint,$t(this.centerPoint,this.firstPoint),n,r,r>n),!0}}else return this.centerPoint=ra(e.x,e.y),!1;return!0}draw(e){var l,o;if(!this.centerPoint)return;let n;if(this.arc)n=this.arc.r.valueOf();else if(this.centerPoint&&this.firstPoint)n=$t(this.centerPoint,this.firstPoint);else return;const r=dt(this.centerPoint),i=n*e.screenZoom;e.context.beginPath(),e.context.arc(r.x,r.y,i,((l=this.arc)==null?void 0:l.startAngle)||0,((o=this.arc)==null?void 0:o.endAngle)||2*Math.PI),e.context.stroke()}intersectsWithBox(e){return this.arc?this.arc.intersect(e).length>0:!1}isContainedInBox(e){return this.arc?e.contains(this.arc):!1}getBoundingBox(){return this.arc?this.arc.box:null}getShape(){return this.arc}getSnapPoints(){return this.centerPoint===null||this.arc===null?[]:[{point:this.centerPoint,type:j.CircleCenter},{point:this.arc.start,type:j.LineEndPoint},{point:this.arc.end,type:j.LineEndPoint}]}getIntersections(e){const n=e.getShape();return!this.arc||!n?[]:this.arc.intersect(n)}getFirstPoint(){return this.centerPoint}distanceTo(e){return this.arc?this.arc.distanceTo(e):null}getSvgString(){var e;return((e=this.arc)==null?void 0:e.svg())||null}getType(){return J.Arc}containsPointOnShape(e){return this.arc?this.arc.contains(e):!1}cutAtPoints(e){if(!this.arc)return[this];const n=Si([this.arc.start,this.arc.end,...e],et),r=yp(n,this.arc.center,this.arc.start),i=[];for(let l=0;l0:!1}isContainedInBox(e){return this.circle?e.contains(this.circle):!1}getBoundingBox(){return this.circle?this.circle.box:null}getShape(){return this.circle}getSnapPoints(){return this.centerPoint===null||this.circle===null?[]:[{point:this.centerPoint,type:j.CircleCenter},{point:new z(this.centerPoint.x+this.circle.r,this.centerPoint.y),type:j.CircleCardinal},{point:new z(this.centerPoint.x-this.circle.r,this.centerPoint.y),type:j.CircleCardinal},{point:new z(this.centerPoint.x,this.centerPoint.y+this.circle.r),type:j.CircleCardinal},{point:new z(this.centerPoint.x,this.centerPoint.y-this.circle.r),type:j.CircleCardinal}]}getIntersections(e){const n=e.getShape();return!this.circle||!n?[]:this.circle.intersect(n)}getFirstPoint(){return this.centerPoint}distanceTo(e){return this.circle?this.circle.distanceTo(e):null}getSvgString(){var e;return((e=this.circle)==null?void 0:e.svg())||null}getType(){return J.Circle}containsPointOnShape(e){return this.circle?this.circle.contains(e):!1}cutAtPoints(e){if(!this.circle)return[this];const n=[],r=e.length;for(let i=0;i0:!1}isContainedInBox(e){return this.segment?e.contains(this.segment):!1}getBoundingBox(){return this.segment?this.segment.box:null}getShape(){return this.segment}getSnapPoints(){var e,n;return!((e=this.segment)!=null&&e.start)||!((n=this.segment)!=null&&n.end)?[]:[{point:this.segment.start,type:j.LineEndPoint},{point:this.segment.end,type:j.LineEndPoint},{point:this.segment.middle(),type:j.LineMidPoint}]}getIntersections(e){const n=e.getShape();return!this.segment||!n?[]:this.segment.intersect(n)}getFirstPoint(){return this.startPoint}distanceTo(e){return this.segment?this.segment.distanceTo(e):null}getSvgString(){var e;return((e=this.segment)==null?void 0:e.svg())||null}getType(){return J.Line}containsPointOnShape(e){return this.segment?this.segment.contains(e):!1}cutAtPoints(e){if(!this.segment)return[this];const n=Si([this.segment.start,this.segment.end,...e],et),r=uo(n,[l=>$t(this.segment.start,l)]),i=[];for(let l=0;l{if(!t)return;const r=new FileReader;r.addEventListener("load",async()=>{const i=r.result,l=JSON.parse(i);l.entities||n(new Error("Invalid JSON file"));const o=Pt(l.entities.map(u=>{switch(u.type){case J.Arc:return new it().fromJson(u);case J.Circle:return new ho().fromJson(u);case J.Line:return new Yt().fromJson(u);case J.Point:return new hr().fromJson(u);case J.Rectangle:return new fo().fromJson(u);default:n(new Error("Invalid entity type: "+u.type))}}));xn(o),e()}),r.readAsText(t,"utf-8")})}const F1=()=>{const[t,e]=N.useState(W.Line),[n,r]=N.useState(45),i=N.useCallback(()=>{console.log("fetching state updates from outside: ",{activeTool:ot(),angleStep:Js()}),e(ot()),r(Js())},[]);N.useEffect(()=>(window.addEventListener($.activeTool,i),window.addEventListener($.angleStep,i),()=>{window.removeEventListener($.activeTool,i),window.removeEventListener($.angleStep,i)}),[i]);const l=N.useCallback(u=>{console.log("set active tool: ",u),e(u),Or(u,!1),pe(null),ke([])},[]),o=N.useCallback(u=>{r(u),g1(u,!1)},[]);return U.jsxs("div",{className:"controls absolute top-0 left-0 flex flex-col gap-1 m-1",children:[U.jsx(ue,{title:"Select (s)",icon:Be.Direction,onClick:()=>l(W.Select),active:t===W.Select}),U.jsx(ue,{title:"Line (l)",icon:Be.Line,onClick:()=>l(W.Line),active:t===W.Line}),U.jsx(ue,{title:"Rectangle (r)",icon:Be.Square,onClick:()=>l(W.Rectangle),active:t===W.Rectangle}),U.jsx(ue,{title:"Circle (c)",icon:Be.Circle,onClick:()=>l(W.Circle),active:t===W.Circle}),U.jsx(ue,{className:"mt-2",title:"Undo (ctrl + z)",icon:Be.AntiClockwise,onClick:()=>hp()}),U.jsx(ue,{title:"Redo (ctrl + shift + z)",icon:Be.Clockwise,onClick:()=>pp()}),U.jsx(ue,{className:"mt-2",title:"Delete segments",icon:Be.Crop,onClick:()=>l(W.Eraser),active:t===W.Eraser}),U.jsxs(g0,{className:"mt-2",title:"Snap angles",label:n+"°",children:[U.jsx(ue,{title:"Add guide every 5 degrees",label:"5°",onClick:()=>o(5),active:n===5}),U.jsx(ue,{title:"Add guide every 15 degrees",label:"15°",onClick:()=>o(15),active:n===15}),U.jsx(ue,{title:"Add guide every 30 degrees",label:"30°",onClick:()=>o(30),active:n===30}),U.jsx(ue,{title:"Add guide every 45 degrees",label:"45°",onClick:()=>o(45),active:n===45}),U.jsx(ue,{title:"Add guide every 90 degrees",label:"90°",onClick:()=>o(90),active:n===90})]}),U.jsx(ue,{className:"relative mt-2",title:"Load from JSON file",icon:Be.Folder,onClick:Ov,children:U.jsx("input",{className:"absolute inset-0 opacity-0",type:"file",accept:"*.json",onChange:async u=>{var a;await D1((a=u.target.files)==null?void 0:a[0]),u.target.files=null}})}),U.jsx(ue,{title:"Save to JSON file",icon:Be.Save,onClick:()=>U1()}),U.jsx(ue,{title:"Export to SVG file",label:"SVG",onClick:()=>M1()}),U.jsx(ue,{title:"Export to PNG file",label:"PNG",onClick:()=>R1()}),U.jsx(ue,{className:"mt-2",title:"Github",icon:Be.Github,onClick:()=>window.open("https://github.com/bertyhell/openwebcad","_blank")})]})};function B1(){return U.jsx("div",{children:U.jsx(F1,{})})}function Gc(t){const e=[];for(let n=0;n{const l=$t(i.point,e);lu.type!==j.AngleGuide),e);if(ru.type===j.AngleGuide),e);return l{const i=n*e*(Math.PI/180),l=t.x+Math.cos(i),o=t.y+Math.sin(i);return new Yt(new z(t.x-1e4*(l-t.x),t.y-1e4*(o-t.y)),new z(t.x+1e4*(l-t.x),t.y+1e4*(o-t.y)))})}function Ti(t,e){let n=null,r=[Number.MAX_SAFE_INTEGER,null];return e.forEach(i=>{const l=i.distanceTo(t);l&&l[0]{const _=V1(v,r),w=Ti(n,_);w.distancev.getSnapPoints()),...Gc(Pt(t)).map(v=>({point:v,type:j.Intersection}))],f=eu(c,n,i);f&&(l=f);const h=[...u,...Gc([...Pt(t),...a]).map(v=>({point:v,type:j.Intersection}))],m=eu(h,n,i);return m&&(o=m),{angleGuides:a,entitySnapPoint:l,angleSnapPoint:o}}function pr(t,e,n,r=T1,i=[]){t.strokeStyle=r,t.lineWidth=1,t.setLineDash(i),e&&(t.lineWidth=2),n&&t.setLineDash([5,5])}function H1(t,e){e.forEach(n=>{pr(t.context,fa(n),Qn(n)),n.draw(t)})}function W1(t,e){e.forEach(n=>{pr(t.context,fa(n),Qn(n),"#FF5500"),n.draw(t)})}function Q1(t,e,n){if(!e)return;const r=dt(e.point);pr(t.context,!1,!1,C1);const i=t.context;switch(n&&(i.beginPath(),i.moveTo(r.x-D/2,r.y),i.lineTo(r.x+D/2,r.y),i.moveTo(r.x,r.y-D/2),i.lineTo(r.x,r.y+D/2),i.stroke()),e.type){case j.LineEndPoint:i.strokeRect(r.x-D/2,r.y-D/2,D,D);break;case j.LineMidPoint:i.beginPath(),i.moveTo(r.x,r.y-D/2),i.lineTo(r.x-D/2,r.y+D/2),i.lineTo(r.x+D/2,r.y+D/2),i.closePath(),i.stroke();break;case j.AngleGuide:i.beginPath(),i.moveTo(r.x-D/2,r.y-D/2),i.lineTo(r.x+D/2,r.y-D/2),i.lineTo(r.x-D/2,r.y+D/2),i.lineTo(r.x+D/2,r.y+D/2),i.closePath(),i.stroke();break;case j.Intersection:i.beginPath(),i.moveTo(r.x-D/2,r.y-D/2),i.lineTo(r.x+D/2,r.y+D/2),i.moveTo(r.x+D/2,r.y-D/2),i.lineTo(r.x-D/2,r.y+D/2),i.stroke();break;case j.CircleCenter:i.beginPath(),i.arc(r.x,r.y,D/2,0,2*Math.PI),i.stroke();break;case j.CircleCardinal:i.beginPath(),i.moveTo(r.x,r.y-D/2),i.lineTo(r.x-D/2,r.y),i.lineTo(r.x,r.y+D/2),i.lineTo(r.x+D/2,r.y),i.closePath(),i.stroke();break}}function G1(t,e){e.forEach(n=>{pr(t.context,fa(n),Qn(n),k1,[1,5]),n.draw(t)})}function Y1(t,e){pr(t.context,!1,!1),e==null||e.draw(t)}function q1(t,e){e&&(pr(t.context,!1,!1),t.context.beginPath(),t.context.moveTo(t.screenMouseLocation.x,t.screenMouseLocation.y-qi),t.context.lineTo(t.screenMouseLocation.x,t.screenMouseLocation.y+qi),t.context.moveTo(t.screenMouseLocation.x-qi,t.screenMouseLocation.y),t.context.lineTo(t.screenMouseLocation.x+qi,t.screenMouseLocation.y),t.context.stroke())}function K1(t){var e,n;t.canvasSize!==null&&t.context&&(t.context.fillStyle=P1,t.context.fillRect(0,0,(e=t.canvasSize)==null?void 0:e.x,(n=t.canvasSize)==null?void 0:n.y))}function X1(t){K1(t),G1(t,o1()),H1(t,xe()),W1(t,s1()),Y1(t,fr());const{snapPoint:e}=bs(Pt([aa(),cp()]),dr()),n=!!e&&ca().some(r=>r.milliSecondsHovered>va&&et(r.snapPoint.point,e.point));Q1(t,e,n),q1(t,l1())}function J1(t){const e=xe();let r=fr();r||(r=new Yt,pe(r)),r.send(t)&&(xn([...e,r]),r=new Yt,pe(r),r.send(t))}function Z1(t){const e=xe();let r=fr();r||(r=new fo,pe(r)),r.send(new z(t.x,t.y))&&(xn([...e,r]),pe(null))}function b1(t){const e=xe();let r=fr();r||(r=new ho,pe(r)),r.send(t)&&(xn([...e,r]),pe(null))}class Yc{constructor(){ie(this,"id",crypto.randomUUID());ie(this,"rectangle",null);ie(this,"startPoint",null)}send(e){if(this.startPoint){if(!this.rectangle)return this.rectangle=new wt(Math.min(this.startPoint.x,e.x),Math.min(this.startPoint.y,e.y),Math.max(this.startPoint.x,e.x),Math.max(this.startPoint.y,e.y)),!0}else return this.startPoint=e,!1;return!0}draw(e){if(!this.startPoint&&!this.rectangle)return;let n,r;this.rectangle?(n=this.rectangle.high,r=this.rectangle.low):(n=this.startPoint,r=new z(e.worldMouseLocation.x,e.worldMouseLocation.y));const i=n.x>r.x,l=dt(n),o=dt(r);e.context.setLineDash([5,5]),e.context.strokeStyle=i?A1:N1,e.context.lineWidth=1,e.context.beginPath(),e.context.strokeRect(l.x,l.y,o.x-l.x,o.y-l.y)}isIntersectionSelection(){var e;return!this.rectangle||!this.startPoint?!1:Math.abs(this.startPoint.x-((e=this.rectangle)==null?void 0:e.xmin))>Zs}intersectsWithBox(e){return this.rectangle?this.rectangle.intersect(e):!1}isContainedInBox(e){return this.rectangle?e.contains(this.rectangle):!1}getBoundingBox(){return this.rectangle?this.rectangle:null}getShape(){return this.rectangle}getSnapPoints(){return[]}getIntersections(){return[]}getFirstPoint(){return this.startPoint}distanceTo(){return null}getSvgString(){var e;return((e=this.rectangle)==null?void 0:e.svg())||null}getType(){return J.SelectionRectangle}containsPointOnShape(){return!1}toJson(){return null}fromJson(){return null}}function ey(t,e,n){const r=fr();let i=null;r instanceof Yc&&(i=r);const l=Ti(t,xe());if(l&&l.distancea!==u.id)):ke([...Go(),u.id]):ke([...Go(),u.id]);return}i||(console.log("Start a new selection rectangle drag: ",i),i=new Yc,pe(i));const o=i.send(new z(t.x,t.y));if(fi([]),o){console.log("Finish selection: ",i);const u=i.isIntersectionSelection(),a=Pt(xe().map(c=>{if(u){if(c.intersectsWithBox(i.getBoundingBox())||c.isContainedInBox(i.getBoundingBox()))return e&&Qn(c)?null:c.id}else if(c.isContainedInBox(i.getBoundingBox()))return e&&Qn(c)?null:c.id;return null}));ke(a),console.log("Set active entity to null"),pe(null)}}function ty(t,e,n,r,i){if(!t)return;const l=e.at(-1);let o;l?$t(t.point,l.snapPoint.point)=va?o=[...e,{snapPoint:t,milliSecondsHovered:i}]:o=[...e.slice(0,e.length-1),{snapPoint:t,milliSecondsHovered:i}]:o=[{snapPoint:t,milliSecondsHovered:i}];const u=o.slice(0,I1);n(u)}function ny(t,e,n,r){const i=uo(Si([e,...r,t,n],et),[o=>$t(e,o)]),l=i.findIndex(o=>et(t,o));if(l===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnLine");return[i[l-1]||e,i[l+1]||n]}function ry(t,e){const n=t.map(r=>({point:r,angle:new oo(e,r).slope}));return uo(n,[r=>r.angle]).map(r=>r.point)}function iy(t,e,n){const r=ry(Si([...n,t],et),e.getShape().center),i=r.findIndex(l=>et(t,l));if(i===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnCircle");return[r[(i+r.length-1)%r.length],r[(i+r.length+1)%r.length]]}function ly(t,e,n){const r=yp(Si([...n,t],et),e.getShape().center,e.getShape().start),i=r.findIndex(l=>et(t,l));if(i===-1)throw new Error("Clicked point not found on line in function findNeighboringPointsOnArc");return[r[(i+r.length-1)%r.length],r[(i+r.length+1)%r.length]]}function oy(t){const e=Ti(t,xe());if(!e)return;const n=e.segment.start,r=sy(e.entity,xe());switch(e.entity.getType()){case J.Line:{const i=e.entity;qc(i,n,r);break}case J.Circle:{const i=e.entity;uy(i,n,r);break}case J.Arc:{const i=e.entity;ay(i,n,r);break}case J.Rectangle:{const i=e.entity,u=i.getShape().toSegments().map(a=>new Yt(a));rr(i),co(...u),u.forEach(a=>qc(a,n,r));break}case J.SelectionRectangle:break}}function sy(t,e){return Pt(e.flatMap(n=>t.id===n.id?null:t.getIntersections(n)))}function qc(t,e,n){const r=t.getShape(),[i,l]=ny(e,r.start,r.end,n);ha([i,l].map(a=>new hr(a)));const u=t.cutAtPoints([i,l]).filter(a=>!a.containsPointOnShape(e));rr(t),co(...u)}function uy(t,e,n){const[r,i]=iy(e,t,n);ha([r,i].map(o=>new hr(o)));const l=t.cutAtPoints([r,i]);if(et(r,i))rr(t);else{const o=l.filter(u=>!u.containsPointOnShape(e));rr(t),co(...o)}}function ay(t,e,n){const[r,i]=ly(e,t,n);ha([r,i].map(o=>new hr(o)));const l=t.cutAtPoints([r,i]);if(et(r,i))rr(t);else{const o=l.filter(u=>!u.containsPointOnShape(e));rr(t),co(...o)}}Yo.createRoot(document.getElementById("root")).render(U.jsx(Bp.StrictMode,{children:U.jsx(B1,{})}));function cy(){da(!0)}function fy(t){da(!0),h1(new z(t.clientX,t.clientY));const e=u1(),n=Ei(),r=Gt();if(e){const i=new z(n.x-(t.clientX-e.x)/r,n.y-(t.clientY-e.y)/r);pa(new z(t.clientX,t.clientY)),fp(i)}if(vy(),ot()===W.Select){const i=Ti(dr(),xe());i.distancec.milliSecondsHovered>va).map(c=>c.snapPoint.point);if([W.Line,W.Rectangle,W.Circle].includes(t)){let c=null;n&&!n.getShape()&&n.getFirstPoint()&&(c=n.getFirstPoint());const{angleGuides:f,entitySnapPoint:h,angleSnapPoint:m}=$1(r,Pt([c,...a]),l,e,ga/i);p1(f),v1(h),y1(m)}}function wp(t,e){const n=ua(),r=ap(),i=dr(),l=Gt(),o=Ei(),u=a1(),a=e-u;_1(e);const c={context:t,canvasSize:n,worldMouseLocation:i,screenMouseLocation:r,screenOffset:o,screenZoom:l};if(ot()===W.Select){const{distance:f,entity:h}=Ti(so(r),xe());f{wp(t,f)})}function Kc(){console.log("handle window resize",{width:window.innerWidth,height:window.innerHeight}),f1(new z(window.innerWidth,window.innerHeight));const t=i1();t&&(t.width=window.innerWidth,t.height=window.innerHeight)}function yy(){const t=document.getElementsByTagName("canvas")[0];if(t){d1(t),t.addEventListener("mousedown",py),t.addEventListener("mousemove",fy),t.addEventListener("mouseup",gy),t.addEventListener("wheel",hy),t.addEventListener("mouseout",dy),t.addEventListener("mouseenter",cy),document.addEventListener("keyup",my),window.addEventListener("resize",Kc),Kc();const e=t.getContext("2d");if(!e)return;wp(e,0)}}document.addEventListener("DOMContentLoaded",()=>{yy()}); diff --git a/docs/index.html b/docs/index.html index 4470fb7..a1d5f8b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,8 +6,8 @@ Open WebCAD - - + +
diff --git a/src/components/Toolbar.tsx b/src/components/Toolbar.tsx index 65988ac..001837c 100644 --- a/src/components/Toolbar.tsx +++ b/src/components/Toolbar.tsx @@ -150,14 +150,9 @@ export const Toolbar: FC = () => { active={angleStepLocal === 90} /> + +