gojs
Version:
Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams
11 lines • 1.11 MB
JavaScript
/**
* @license GoJS
* GoJS v4.0.1 JavaScript Library for Interactive Diagrams, https://gojs.net
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://nwoods.com.
* Copyright 1998-2026 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/4.0.1/license.html.
* DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
*/
(function() {const root=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};root.requestAnimationFrame===void 0&&(root.setImmediate===void 0?root.requestAnimationFrame=w=>root.setTimeout(w,0):root.requestAnimationFrame=root.setImmediate);const Debug={boundsInfoEnabled:!1,drawLocationsEnabled:!1,drawClipEnabled:!1,drawLinkpointsEnabled:!1,nodeInspector:!1,handleMessages:!1,drawFrames:!1,defaultDiagram:null,trace:function(w){root.console&&root.console.log(w)},drawDiagramBounds(w,t,i,e){w.strokeStyle="red",w.fillStyle="red",w.font="8px sans-serif",w.beginPath(),w.moveTo(-10,0),w.lineTo(10,0),w.moveTo(0,-10),w.lineTo(0,10),w.stroke(),w.setTransform(1,0,0,1,0,0),w.scale(i,i),w.transform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy),w.lineWidth=2,w.beginPath(),w.moveTo(e.left,e.top+20),w.lineTo(e.left,e.top),w.lineTo(e.left+20,e.top),w.moveTo(e.right,e.bottom-20),w.lineTo(e.right,e.bottom),w.lineTo(e.right-20,e.bottom),w.stroke(),w.fillText("DB: "+Math.round(e.x)+", "+Math.round(e.y)+", "+Math.round(e.width)+", "+Math.round(e.height),e.left,e.top-5)},attachReadonlyWarnings:function(w){for(const t in w){if(t==="licenseKey")continue;const i=w[t];if(i.prototype===void 0)continue;const e=Object.getOwnPropertyNames(i.prototype);for(let s=0;s<e.length;s++){const n=Object.getOwnPropertyDescriptor(i.prototype,e[s]);n&&n.get!==void 0&&n.set===void 0&&Object.defineProperty(i.prototype,e[s],{set:function(o){U.n("Property "+e[s]+" of "+t+" is read-only.")}})}}}};class U{static kr=root.navigator!==void 0&&root.navigator.platform!==void 0&&root.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Hk(t,i,e){let s=-1;return function(){const n=this,o=arguments;s!==-1&&U.Vc(s),s=U.Sn(()=>{s=-1,e||t.apply(n,o)},i),e&&!s&&t.apply(n,o)}}static Sn(t,i){return root.setTimeout(t,i)}static Vc(t){root.clearTimeout(t)}static Re(t){return root.document.createElement(t)}static n(t){throw new Error(t)}static F(t,i){let e="The object is frozen, so its properties cannot be set: "+t.toString();i!==void 0&&(e+=" to value: "+i),U.n(e)}static s(t,i,e,s){if(!(t instanceof i)){let n=U.zc(e);s!==void 0&&(n+="."+s),U.Ii(t,i,n)}}static i(t,i,e,s){if(typeof t!==i){let n=U.zc(e);s!==void 0&&(n+="."+s),U.Ii(t,i,n)}}static r(t,i,e){if(typeof t!="number"||!isFinite(t)){let s=U.zc(i);e!==void 0&&(s+="."+e),U.n(s+" must be a real number type, and not NaN or Infinity: "+t)}}static zo(t,i,e){if(t===null||typeof t!="object"){let s=U.zc(i);e!==void 0&&(s+="."+e),U.Ii(t,"object",s)}}static C(t,i,e){U.i(t,"function",i,e)}static j(t,i,e){t in i||U.n(`${t} is not a valid value in enumeration: ${e}`)}static Ii(t,i,e,s){const n=" value is not an instance of "+U.zc(i)+": ";let o=U.zc(e);s!==void 0&&(o+="."+s),typeof t=="string"&&(t='"'+t+'"'),U.n(o+n+t)}static q(t,i,e,s){let n=U.zc(e);s!==void 0&&(n+="."+s),U.n(n+" is not in the range "+i+": "+t)}static Je(t){U.n("Collection was modified during iteration: "+t.toString()+`
Perhaps you should iterate over a copy of the collection,
or you could collect items to be removed from the collection after the iteration.`)}static Pr(t,i){U.n("No property to set for this enum value: "+i+" on "+t.toString())}static et(t){root.console&&root.console.log(t)}static st(t){return t!==null&&typeof t=="object"}static at(t){return typeof t=="function"}static vk=[];static ct(){const t=U.vk.pop();return t===void 0?[]:t}static nt(t){t.length=0,U.vk.push(t)}static sV=Object.freeze([]);static zc(t){return t===null?"*":typeof t=="string"?t:U.at(t)?t.name:""}static to(t){return U.at(t)?t.className?t.className:t.name:U.st(t)&&t.constructor?U.to(t.constructor):typeof t}static fa(t,i){return i==null||i===""?null:U.st(t)&&i in t||t[i]?t[i]:null}static toString(t){let i=t;return U.st(t)&&(t.text?i=t.text:t.name?i=t.name:t.key!==void 0?i=t.key:t.id!==void 0?i=t.id:t.constructor===Object&&(t.Text?i=t.Text:t.Name?i=t.Name:t.Key!==void 0?i=t.Key:t.Id!==void 0?i=t.Id:t.ID!==void 0&&(i=t.ID))),i===void 0?"undefined":i===null?"null":i.toString()}static fx(t,i){if(t.hasOwnProperty(i))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Function;){if(e.hasOwnProperty(i))return!0;const s=e.nV;if(s&&s[i])return!0;e=Object.getPrototypeOf(e)}return!1}static kI(t){const i=[];let e=0;for(e=0;e<256;e++)i[e]=e;let s=0,n=0;for(e=0;e<256;e++)s=(s+i[e]+119)%256,n=i[e],i[e]=i[s],i[s]=n;e=0,s=0;let o="";for(let r=0;r<t.length;r++)e=(e+1)%256,s=(s+i[e])%256,n=i[e],i[e]=i[s],i[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^i[(i[e]+i[s])%256]);return o}static MI(t){const i="0123456789abcdef",e=[];for(let r=0;r<256;r++)e[i.charAt(r>>4)+i.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);const s=[];let n=0;for(let r=0;r<t.length;r+=2)s[n++]=e[t.substring(r,r+2)];const o=s.join("");return o===""?"0":o}static Si(t){return U.kI(U.MI(t))}static color1="@COLOR1";static color2="@COLOR2";static ux="32ab5ff3b26f42dc0ed90f21422913b5";static wm(){const t=new Uint32Array(1);return root.crypto.getRandomValues(t),t[0]/4294967296}}U.vfo="2ee646fdb2";class StringBuilder{Wk;constructor(){this.Wk=[]}toString(){return this.Wk.join("")}add(t){t!==""&&this.Wk.push(t)}}class PropertyCollection{}const Figures={None:"None",Rectangle:"Rectangle",Square:"Square",RoundedRectangle:"RoundedRectangle",Border:"Border",RoundedTopRectangle:"RoundedTopRectangle",RoundedBottomRectangle:"RoundedBottomRectangle",RoundedLeftRectangle:"RoundedLeftRectangle",RoundedRightRectangle:"RoundedRightRectangle",Ellipse:"Ellipse",Circle:"Circle",TriangleRight:"TriangleRight",TriangleDown:"TriangleDown",TriangleLeft:"TriangleLeft",TriangleUp:"TriangleUp",Triangle:"Triangle",Diamond:"Diamond",LineH:"LineH",LineV:"LineV",BarH:"BarH",BarV:"BarV",MinusLine:"MinusLine",PlusLine:"PlusLine",XLine:"XLine",LineRight:"LineRight",LineDown:"LineDown",LineLeft:"LineLeft",LineUp:"LineUp",Capsule:"Capsule",Borders:"Borders"},Arrowheads={Standard:"Standard",Backward:"Backward",Triangle:"Triangle",BackwardTriangle:"BackwardTriangle",Boomerang:"Boomerang",BackwardBoomerang:"BackwardBoomerang",SidewaysV:"SidewaysV",BackwardV:"BackwardV",OpenTriangle:"OpenTriangle",BackwardOpenTriangle:"BackwardOpenTriangle",OpenTriangleLine:"OpenTriangleLine",BackwardOpenTriangleLine:"BackwardOpenTriangleLine",OpenTriangleTop:"OpenTriangleTop",BackwardOpenTriangleTop:"BackwardOpenTriangleTop",OpenTriangleBottom:"OpenTriangleBottom",BackwardOpenTriangleBottom:"BackwardOpenTriangleBottom",HalfTriangleTop:"HalfTriangleTop",BackwardHalfTriangleTop:"BackwardHalfTriangleTop",HalfTriangleBottom:"HalfTriangleBottom",BackwardHalfTriangleBottom:"BackwardHalfTriangleBottom",ForwardSemiCircle:"ForwardSemiCircle",BackwardSemiCircle:"BackwardSemiCircle",Feather:"Feather",BackwardFeather:"BackwardFeather",DoubleFeathers:"DoubleFeathers",BackwardDoubleFeathers:"BackwardDoubleFeathers",TripleFeathers:"TripleFeathers",BackwardTripleFeathers:"BackwardTripleFeathers",ForwardSlash:"ForwardSlash",BackSlash:"BackSlash",DoubleForwardSlash:"DoubleForwardSlash",DoubleBackSlash:"DoubleBackSlash",TripleForwardSlash:"TripleForwardSlash",TripleBackSlash:"TripleBackSlash",Fork:"Fork",BackwardFork:"BackwardFork",LineFork:"LineFork",BackwardLineFork:"BackwardLineFork",CircleFork:"CircleFork",BackwardCircleFork:"BackwardCircleFork",CircleLineFork:"CircleLineFork",BackwardCircleLineFork:"BackwardCircleLineFork",Circle:"Circle",Block:"Block",StretchedDiamond:"StretchedDiamond",Diamond:"Diamond",Chevron:"Chevron",StretchedChevron:"StretchedChevron",NormalArrow:"NormalArrow",X:"X",TailedNormalArrow:"TailedNormalArrow",DoubleTriangle:"DoubleTriangle",BigEndArrow:"BigEndArrow",ConcaveTailArrow:"ConcaveTailArrow",RoundedTriangle:"RoundedTriangle",SimpleArrow:"SimpleArrow",AccelerationArrow:"AccelerationArrow",BoxArrow:"BoxArrow",TriangleLine:"TriangleLine",CircleEndedArrow:"CircleEndedArrow",DynamicWidthArrow:"DynamicWidthArrow",EquilibriumArrow:"EquilibriumArrow",FastForward:"FastForward",Kite:"Kite",HalfArrowTop:"HalfArrowTop",HalfArrowBottom:"HalfArrowBottom",OpposingDirectionDoubleArrow:"OpposingDirectionDoubleArrow",PartialDoubleTriangle:"PartialDoubleTriangle",LineCircle:"LineCircle",DoubleLineCircle:"DoubleLineCircle",TripleLineCircle:"TripleLineCircle",CircleLine:"CircleLine",DiamondCircle:"DiamondCircle",PlusCircle:"PlusCircle",OpenRightTriangleTop:"OpenRightTriangleTop",OpenRightTriangleBottom:"OpenRightTriangleBottom",Line:"Line",DoubleLine:"DoubleLine",TripleLine:"TripleLine",PentagonArrow:"PentagonArrow"},PanelTypes={Position:"Position",Horizontal:"Horizontal",Vertical:"Vertical",Spot:"Spot",Auto:"Auto",Table:"Table",Viewbox:"Viewbox",TableRow:"TableRow",TableColumn:"TableColumn",Link:"Link",Grid:"Grid",Graduated:"Graduated"},ToolNames={Action:"Action",Relinking:"Relinking",LinkReshaping:"LinkReshaping",Rotating:"Rotating",Resizing:"Resizing",Linking:"Linking",Dragging:"Dragging",DragSelecting:"DragSelecting",Panning:"Panning",ContextMenu:"ContextMenu",TextEditing:"TextEditing",ClickCreating:"ClickCreating",ClickSelecting:"ClickSelecting"},Builders={Button:"Button",TreeExpanderButton:"TreeExpanderButton",SubGraphExpanderButton:"SubGraphExpanderButton",ToolTip:"ToolTip",ContextMenu:"ContextMenu",ContextMenuButton:"ContextMenuButton",PanelExpanderButton:"PanelExpanderButton",CheckBoxButton:"CheckBoxButton",CheckBox:"CheckBox",AutoRepeatButton:"AutoRepeatButton",ToggleSwitch:"ToggleSwitch",Toggle:"Toggle"},LayerNames={Grid:"Grid",ViewportBackground:"ViewportBackground",Background:"Background",Default:"",Foreground:"Foreground",ViewportForeground:"ViewportForeground",Adornment:"Adornment",Tool:"Tool"};class EmptyIterator{b;constructor(){this.b=[]}[Symbol.iterator](){return this.b.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}zl(){}toString(){return"EmptyIterator"}static instance=new EmptyIterator}class SingletonIterator{constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new SingletonIterator(t(this.value))}filter(t){return t(this.value)?new SingletonIterator(this.value):EmptyIterator.instance}get count(){return 1}zl(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class ListIterator{_t;$s;Jt;Vt;constructor(t){this._t=t,this.$s=null,t.Mr=null,this.Jt=t.dt,this.Vt=-1}[Symbol.iterator](){return this.$s===null?this._t.h.values():this._t.h.filter(this.$s).values()}key;value;get iterator(){return this}get predicate(){return this.$s}set predicate(t){this.$s=t}reset(){const t=this._t;t.Mr=null,this.Jt=t.dt,this.Vt=-1}next(){const t=this._t;if(t.dt!==this.Jt){if(this.key<0)return!1;U.Je(t)}const i=t.h,e=i.length;let s=++this.Vt;const n=this.$s;if(n!==null)for(;s<e;){const o=i[s];if(n(o))return this.Vt=s,this.key=s,this.value=o,!0;s++}else{if(s<e)return this.key=s,this.value=i[s],!0;this.zl()}return!1}hasNext(){return this.next()}first(){const t=this._t;this.Jt=t.dt,this.Vt=0;const i=t.h,e=i.length,s=this.$s;if(s!==null){let n=0;for(;n<e;){const o=i[n];if(s(o))return this.Vt=n,this.key=n,this.value=o,o;n++}return null}else if(e>0){const n=i[0];return this.key=0,this.value=n,n}else return null}any(t){const i=this._t;i.Mr=null;const e=i.dt;this.Vt=-1;const s=i.h,n=s.length,o=this.$s;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(t(l))return!0;i.dt!==e&&U.Je(i)}}return!1}all(t){const i=this._t;i.Mr=null;const e=i.dt;this.Vt=-1;const s=i.h,n=s.length,o=this.$s;for(let r=0;r<n;r++){const l=s[r];if(!(o!==null&&!o(l))){if(!t(l))return!1;i.dt!==e&&U.Je(i)}}return!0}each(t){const i=this._t;i.Mr=null;const e=i.dt;this.Vt=-1;const s=i.h,n=s.length,o=this.$s;for(let r=0;r<n;r++){const l=s[r];o!==null&&!o(l)||(t(l),i.dt!==e&&U.Je(i))}return this}map(t){const i=this._t;i.Mr=null;const e=i.dt;this.Vt=-1;const s=[],n=i.h,o=n.length,r=this.$s;for(let h=0;h<o;h++){const a=n[h];r!==null&&!r(a)||(s.push(t(a)),i.dt!==e&&U.Je(i))}const l=new List;return l.h=s,l.$e(),l.iterator}filter(t){const i=this._t;i.Mr=null;const e=i.dt;this.Vt=-1;const s=[],n=i.h,o=n.length,r=this.$s;for(let h=0;h<o;h++){const a=n[h];r!==null&&!r(a)||(t(a)&&s.push(a),i.dt!==e&&U.Je(i))}const l=new List;return l.h=s,l.$e(),l.iterator}get count(){const t=this.$s;if(t!==null){let i=0;const e=this._t.h,s=e.length;for(let n=0;n<s;n++)t(e[n])&&i++;return i}else return this._t.h.length}zl(){this.key=-1,this.value=null,this.Jt=-1,this.$s=null,this._t.Mr=this}toString(){return"ListIterator@"+this.Vt+"/"+this._t.count}}class ListIteratorBackwards{_t;Jt;Vt;constructor(t){this._t=t,t.Cr=null,this.Jt=t.dt,this.Vt=t.h.length}[Symbol.iterator](){return this._t.h.reverse().values()}key;value;get iterator(){return this}reset(){const t=this._t;t.Cr=null,this.Jt=t.dt,this.Vt=t.h.length}next(){const t=this._t;if(t.dt!==this.Jt){if(this.key<0)return!1;U.Je(t)}const i=--this.Vt;return i>=0?(this.key=i,this.value=t.h[i],!0):(this.zl(),!1)}hasNext(){return this.next()}first(){const t=this._t;this.Jt=t.dt;const i=t.h,e=i.length-1;if(this.Vt=e,e>=0){const s=i[e];return this.key=e,this.value=s,s}else return null}any(t){const i=this._t;i.Cr=null;const e=i.dt,s=i.h,n=s.length;this.Vt=n;for(let o=n-1;o>=0;o--){const r=s[o];if(t(r))return!0;i.dt!==e&&U.Je(i)}return!1}all(t){const i=this._t;i.Cr=null;const e=i.dt,s=i.h,n=s.length;this.Vt=n;for(let o=n-1;o>=0;o--){const r=s[o];if(!t(r))return!1;i.dt!==e&&U.Je(i)}return!0}each(t){const i=this._t;i.Cr=null;const e=i.dt,s=i.h,n=s.length;this.Vt=n;for(let o=n-1;o>=0;o--){const r=s[o];t(r),i.dt!==e&&U.Je(i)}return this}map(t){const i=this._t;i.Cr=null;const e=i.dt,s=[],n=i.h,o=n.length;this.Vt=o;for(let l=o-1;l>=0;l--){const h=n[l];s.push(t(h)),i.dt!==e&&U.Je(i)}const r=new List;return r.h=s,r.$e(),r.iterator}filter(t){const i=this._t;i.Cr=null;const e=i.dt,s=[],n=i.h,o=n.length;this.Vt=o;for(let l=o-1;l>=0;l--){const h=n[l];t(h)&&s.push(h),i.dt!==e&&U.Je(i)}const r=new List;return r.h=s,r.$e(),r.iterator}get count(){return this._t.h.length}zl(){this.key=-1,this.value=null,this.Jt=-1,this._t.Cr=this}toString(){return"ListIteratorBackwards("+this.Vt+"/"+this._t.count+")"}}class List{p;h;dt;Mr;Cr;constructor(t){GSet.se(this),this.p=!1,this.h=[],this.dt=0,this.Mr=null,this.Cr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.h.values()}$e(){let t=this.dt;t++,t>999999999&&(t=0),this.dt=t}S(){return this.p=!0,this}si(){return this.p=!1,this}toString(){return"List()#"+GSet.Cs(this)}add(t){return this.p&&U.F(this,t),this.h.push(t),this.$e(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.p&&U.F(this);const i=this.h;if(t.first){const e=t.iterator;for(;e.next();)i.push(e.value)}else for(const e of t)i.push(e);return this.$e(),this}clear(){this.p&&U.F(this),this.h.length=0,this.$e()}contains(t){return this.has(t)}has(t){return t===null?!1:this.h.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.h.indexOf(t)}elt(t){Debug&&U.r(t,List,"elt:i");const i=this.h;return(t<0||t>=i.length)&&U.q(t,"0 <= i < length",List,"elt:i"),i[t]}get(t){return this.elt(t)}setElt(t,i){Debug&&U.r(t,List,"setElt:i");const e=this.h;(t<0||t>=e.length)&&U.q(t,"0 <= i < length",List,"setElt:i"),this.p&&U.F(this,t),e[t]=i}set(t,i){this.setElt(t,i)}first(){const t=this.h;return t.length===0?null:t[0]}last(){const t=this.h,i=t.length;return i>0?t[i-1]:null}pop(){this.p&&U.F(this);const t=this.h;if(t.length>0){const i=t.pop();return i===void 0?null:i}return null}any(t){const i=this.h,e=this.dt,s=i.length;for(let n=0;n<s;n++){if(t(i[n]))return!0;this.dt!==e&&U.Je(this)}return!1}all(t){const i=this.h,e=this.dt,s=i.length;for(let n=0;n<s;n++){if(!t(i[n]))return!1;this.dt!==e&&U.Je(this)}return!0}each(t){const i=this.h,e=this.dt,s=i.length;for(let n=0;n<s;n++)t(i[n]),this.dt!==e&&U.Je(this);return this}map(t){const i=new List,e=[],s=this.h,n=this.dt,o=s.length;for(let r=0;r<o;r++)e.push(t(s[r])),this.dt!==n&&U.Je(this);return i.h=e,i.$e(),i}filter(t){const i=new List,e=[],s=this.h,n=this.dt,o=s.length;for(let r=0;r<o;r++){const l=s[r];t(l)&&e.push(l),this.dt!==n&&U.Je(this)}return i.h=e,i.$e(),i}insertAt(t,i){Debug&&U.r(t,List,"insertAt:i"),t<0&&U.q(t,">= 0",List,"insertAt:i"),this.p&&U.F(this,t);const e=this.h;t>=e.length?e.push(i):e.splice(t,0,i),this.$e()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.p&&U.F(this,t);const i=this.h,e=i.indexOf(t);return e===-1?!1:(e===i.length-1?i.pop():i.splice(e,1),this.$e(),!0)}removeAt(t){Debug&&U.r(t,List,"removeAt:i");const i=this.h;(t<0||t>=i.length)&&U.q(t,"0 <= i < length",List,"removeAt:i"),this.p&&U.F(this,t),t===i.length-1?i.pop():i.splice(t,1),this.$e()}removeRange(t,i){Debug&&(U.r(t,List,"removeRange:from"),U.r(i,List,"removeRange:to"));const e=this.h,s=e.length;if(t<0)t=0;else if(t>=s)return this;if(i<0)return this;if(i>=s&&(i=s-1),t>i)return this;this.p&&U.F(this);let n=t,o=i+1;for(;o<s;)e[n++]=e[o++];return e.length=s-(i-t+1),this.$e(),this}copy(){const t=new List,i=this.h;return i.length>0&&(t.h=Array.prototype.slice.call(i)),t}toArray(){const t=this.h,i=this.count,e=new Array(i);for(let s=0;s<i;s++)e[s]=t[s];return e}get lT(){return this.h}toSet(){const t=new GSet,i=this.h,e=this.count;for(let s=0;s<e;s++)t.add(i[s]);return t}sort(t){return Debug&&U.C(t,List,"sort:sortfunc"),this.p&&U.F(this),this.h.sort(t),this.$e(),this}sortRange(t,i,e){const s=this.h,n=s.length;i===void 0&&(i=0),e===void 0&&(e=n),Debug&&(U.C(t,List,"sortRange:sortfunc"),U.r(i,List,"sortRange:from"),U.r(e,List,"sortRange:to")),this.p&&U.F(this);const o=e-i;if(o<=1)return this;if((i<0||i>=n-1)&&U.q(i,"0 <= from < length",List,"sortRange:from"),o===2){const r=s[i],l=s[i+1];return t(r,l)>0&&(s[i]=l,s[i+1]=r,this.$e()),this}if(i===0)if(e>=n)s.sort(t);else{const r=s.slice(0,e);r.sort(t);for(let l=0;l<e;l++)s[l]=r[l]}else if(e>=n){const r=s.slice(i);r.sort(t);for(let l=i;l<n;l++)s[l]=r[l-i]}else{const r=s.slice(i,e);r.sort(t);for(let l=i;l<e;l++)s[l]=r[l-i]}return this.$e(),this}reverse(){return this.p&&U.F(this),this.h.reverse(),this.$e(),this}get count(){return this.h.length}get size(){return this.h.length}get length(){return this.h.length}get iterator(){if(this.h.length<=0)return EmptyIterator.instance;const t=this.Mr;return t!==null?(t.reset(),t):new ListIterator(this)}get iteratorBackwards(){if(this.h.length<=0)return EmptyIterator.instance;const t=this.Cr;return t!==null?(t.reset(),t):new ListIteratorBackwards(this)}}class SetIterator{Xo;fi;constructor(t){this.Xo=t,this.fi=t.b.values()}[Symbol.iterator](){return this.Xo.b.values()}key;value;get iterator(){return this}reset(){const t=this.Xo;this.fi=t.b.values()}next(){const t=this.fi.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.Xo.b.size===0?null:(this.fi=this.Xo.b.values(),this.fi.next().value)}any(t){return this.Xo.any(t)}all(t){return this.Xo.all(t)}each(t){return this.Xo.each(t),this}map(t){const i=new List;return this.Xo.b.forEach(e=>i.add(t(e))),i.iterator}filter(t){const i=new List;return this.Xo.b.forEach(e=>{t(e)&&i.add(e)}),i.iterator}get count(){return this.Xo.count}zl(){this.key=null,this.value=null,this.fi=null}toString(){return"SetIterator"}}class GSet{p;b;constructor(t){this.p=!1,this.b=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.b.values()}values(){return this.b.values()}S(){return this.p=!0,this}si(){return this.p=!1,this}toString(){return"Set()#"+GSet.Cs(this)}add(t){return t===null?this:(this.b.add(t),this)}addAll(t){if(t===null)return this;if(this.p&&U.F(this),t.first){const i=t.iterator;for(;i.next();)this.b.add(i.value)}else for(const i of t)this.b.add(i);return this}has(t){return this.b.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;if(t.first){const i=t.iterator;for(;i.next();)if(!this.has(i.value))return!1}else for(const i of t)if(!this.has(i))return!1;return!0}containsAny(t){if(t===null)return!0;if(t.first){const i=t.iterator;for(;i.next();)if(this.has(i.value))return!0}else for(const i of t)if(this.has(i))return!0;return!1}first(){return this.b.size===0?null:this.b.values().next().value}any(t){for(const i of this.b)if(t(i))return!0;return!1}all(t){for(const i of this.b)if(!t(i))return!1;return!0}each(t){for(const i of this.b)t(i);return this}map(t){const i=new GSet;for(const e of this.b)i.add(t(e));return i}filter(t){const i=new GSet;for(const e of this.b)t(e)&&i.add(e);return i}delete(t){return this.p&&U.F(this),this.b.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.p&&U.F(this),t.first){const i=t.iterator;for(;i.next();)this.delete(i.value)}else for(const i of t)this.delete(i);return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.p&&U.F(this);const i=new GSet;i.addAll(t);const e=[];if(t.first){const s=t.iterator;for(;s.next();){const n=s.value;i.has(n)||e.push(n)}}else for(const s of t)i.has(s)||e.push(s);return this.removeAll(e),this}clear(){this.p&&U.F(this),this.b.clear()}copy(){const t=new GSet;return this.b.forEach(i=>t.add(i)),t}toArray(){return Array.from(this.b)}toList(){const t=new List;return this.b.forEach(i=>t.add(i)),t}get count(){return this.b.size}get size(){return this.b.size}get iterator(){return this.b.size<=0?EmptyIterator.instance:new SetIterator(this)}entries(){return this.b.entries()}keys(){return this.b.keys()}forEach(t,i){return this.b.forEach(t,i)}static gx=1;static se(t){t.__gohashid=GSet.gx++}static Cs(t){return t.__gohashid}}class MapKeySetIterator{_;fi;constructor(t){this._=t,this.fi=t.b.keys()}[Symbol.iterator](){return this._.b.keys()}key;value;get iterator(){return this}reset(){const t=this._;this.fi=t.b.keys()}next(){const t=this.fi.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this._.b.size===0?null:(this.fi=this._.b.keys(),this.fi.next().value)}any(t){for(const i of this._.b)if(t(i[0]))return!0;return!1}all(t){for(const i of this._.b)if(!t(i[0]))return!1;return!0}each(t){for(const i of this._.b)t(i[0]);return this}map(t){const i=this._,e=new List;for(const s of i.b)e.add(t(s[0]));return e.iterator}filter(t){const i=this._,e=new List;for(const s of i.b){const n=s[0];t(n)&&e.add(n)}return e.iterator}get count(){return this._.size}zl(){this.key=null,this.value=null,this.fi=null}toString(){return"MapKeySetIterator"}}class MapKeySet extends GSet{_;constructor(t){super(),GSet.se(this),this.p=!0,this._=t}[Symbol.iterator](){return this.b.keys()}values(){return this.b.keys()}S(){return this}si(){return this}toString(){return"MapKeySet("+this._.toString()+")"}add(t){U.n("This Set is read-only: "+this.toString())}has(t){return this._.has(t)}contains(t){return this.has(t)}delete(t){U.n("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){U.n("This Set is read-only: "+this.toString())}first(){return this._.b.size===0?null:this._.b.keys().next().value}any(t){for(const i of this._.b)if(t(i[0]))return!0;return!1}all(t){for(const i of this._.b)if(!t(i[0]))return!1;return!0}each(t){for(const i of this._.b)t(i[0]);return this}map(t){const i=new GSet;for(const e of this._.b)i.add(t(e[0]));return i}filter(t){const i=new GSet;for(const e of this._.b){const s=e[0];t(s)&&i.add(s)}return i}copy(){return new MapKeySet(this._)}toSet(){const t=new GSet,i=this._.b;for(const e of i)t.add(e[0]);return t}toArray(){const t=this._.b,i=new Array(t.size);let e=0;for(const s of t)i[e]=s[0],e++;return i}toList(){const t=new List,i=this._.b;for(const e of i)t.add(e[0]);return t}get count(){return this._.size}get size(){return this._.size}get iterator(){return this._.size<=0?EmptyIterator.instance:new MapKeySetIterator(this._)}}class MapValueSetIterator{_;fi;constructor(t){this._=t,this.fi=t.b.values()}[Symbol.iterator](){return this._.b.values()}key;value;get iterator(){return this}reset(){const t=this._;this.fi=t.b.values()}next(){const t=this.fi.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this._.b.size===0?null:(this.fi=this._.b.values(),this.fi.next().value)}any(t){for(const i of this._.b)if(t(i[1]))return!0;return!1}all(t){for(const i of this._.b)if(!t(i[1]))return!1;return!0}each(t){for(const i of this._.b)t(i[1]);return this}map(t){const i=this._,e=new List;for(const s of i.b)e.add(t(s[1]));return e.iterator}filter(t){const i=this._,e=new List;for(const s of i.b){const n=s[1];t(n)&&e.add(n)}return e.iterator}get count(){return this._.size}zl(){this.key=null,this.value=null,this.fi=null}toString(){return"MapValueSetIterator"}}class KeyValuePair{constructor(t,i){this.key=t,this.value=i}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class MapIterator{_;fi;constructor(t){this._=t,this.fi=t.b.entries()}[Symbol.iterator](){return this._.b.entries()}key;value;get iterator(){return this}reset(){const t=this._;this.fi=t.b.entries()}next(){const t=this.fi.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this._.b.size===0)return null;this.fi=this._.b.entries();const t=this.fi.next().value;return this.key=t[0],this.value=t[1],new KeyValuePair(t[0],t[1])}any(t){return this._.any(t)}all(t){return this._.all(t)}each(t){return this._.each(t),this}map(t){const i=new List;let e=null;return this._.b.forEach((s,n)=>{e===null?e=new KeyValuePair(n,s):(e.key=n,e.value=s),i.add(t(e))}),i.iterator}filter(t){const i=new List;let e=null;return this._.b.forEach((s,n)=>{e===null?e=new KeyValuePair(n,s):(e.key=n,e.value=s),t(e)&&(i.add(e),e=null)}),i.iterator}get count(){return this._.size}zl(){this.key=null,this.value=null,this.fi=null}toString(){return"MapIterator"}}class GMap{p;b;constructor(t){GSet.se(this),this.p=!1,this.b=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.b.entries()}entries(){return this.b.entries()}S(){return this.p=!0,this}si(){return this.p=!1,this}toString(){return"Map()#"+GSet.Cs(this)}set(t,i){return this.p&&U.F(this,t),this.b.set(t,i),this}add(t,i){return this.set(t,i)}addAll(t){if(t===null)return this;if(this.p&&U.F(this),t instanceof GMap){const i=t.iterator;for(;i.next();)this.b.set(i.key,i.value)}else if(t.first){const i=t.iterator;for(;i.next();){const e=i.value;this.b.set(e.key,e.value)}}else for(const i of t){const e=i;Array.isArray(e)?this.b.set(e[0],e[1]):this.b.set(e.key,e.value)}return this}first(){if(this.b.size===0)return null;const t=this.b.entries().next().value;return t?new KeyValuePair(t[0],t[1]):null}any(t){let i=null;for(const[e,s]of this.b)if(i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),t(i))return!0;return!1}all(t){let i=null;for(const[e,s]of this.b)if(i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),!t(i))return!1;return!0}each(t){let i=null;for(const[e,s]of this.b)i===null?i=new KeyValuePair(e,s):(i.key=e,i.value=s),t(i);return this}map(t){const i=new GMap;let e=null;for(const[s,n]of this.b)e===null?e=new KeyValuePair(s,n):(e.key=s,e.value=n),i.set(s,t(e));return i}filter(t){const i=new GMap;let e=null;for(const[s,n]of this.b)e===null?e=new KeyValuePair(s,n):(e.key=s,e.value=n),t(e)&&i.set(s,n);return i}has(t){return this.b.has(t)}contains(t){return this.has(t)}get(t){const i=this.b.get(t);return i===void 0?null:i}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.p&&U.F(this,t),this.b.delete(t))}remove(t){return this.delete(t)}clear(){this.p&&U.F(this),this.b.clear()}copy(){const t=new GMap;return t.b=new Map(this.b),t}toArray(){const t=this.b,i=new Array(t.size);let e=0;for(const s of t)i[e]=new KeyValuePair(s[0],s[1]),e++;return i}toKeySet(){return new MapKeySet(this)}get count(){return this.b.size}get size(){return this.b.size}get iterator(){return this.b.size<=0?EmptyIterator.instance:new MapIterator(this)}get iteratorKeys(){return this.count<=0?EmptyIterator.instance:new MapKeySetIterator(this)}keys(){return this.b.keys()}get iteratorValues(){return this.count<=0?EmptyIterator.instance:new MapValueSetIterator(this)}values(){return this.b.values()}forEach(t,i){return this.b.forEach(t,i)}}class Point{px;py;p;constructor(t,i){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof i=="number"?(this.px=t,this.py=i):U.n("Invalid arguments to Point constructor: "+t+", "+i),this.p=!1}f(t){return this.px=t.px,this.py=t.py,this}e(t,i){return this.px=t,this.py=i,this}setTo(t,i){return Debug&&(U.i(t,"number",Point,"setTo:x"),U.i(i,"number",Point,"setTo:y"),this.tt()),this.px=t,this.py=i,this}set(t){return Debug&&(U.s(t,Point,Point,"set:p"),this.tt()),this.px=t.px,this.py=t.py,this}copy(){const t=new Point;return t.px=this.px,t.py=this.py,t}At(){return this.p=!0,Object.freeze(this),this}T(){return this.p||Object.isFrozen(this)?this:this.copy().S()}S(){return this.p||(this.p=!0),this}tt(t){if(Debug&&this.p){let i="The Point is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;return n=i[e++],n&&(o=parseFloat(n)),new Point(s,o)}else return new Point}static stringify(t){return Debug&&U.s(t,Point),t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return U.i(t,"number",Point,"stringifyFixed:digits"),i=>i.x.toFixed(t)+" "+i.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof Point?this.px===t.x&&this.py===t.y:!1}equalTo(t,i){return this.px===t&&this.py===i}equalsApprox(t){return G.u(this.px,t.x)&&G.u(this.py,t.y)}add(t){return Debug&&(U.s(t,Point,Point,"add:p"),this.tt()),this.px+=t.x,this.py+=t.y,this}subtract(t){return Debug&&(U.s(t,Point,Point,"subtract:p"),this.tt()),this.px-=t.x,this.py-=t.y,this}offset(t,i){return Debug&&(U.r(t,Point,"offset:dx"),U.r(i,Point,"offset:dy"),this.tt()),this.px+=t,this.py+=i,this}rotate(t){if(Debug&&(U.r(t,Point,"rotate:angle"),this.tt()),t===0)return this;const i=this.px,e=this.py;if(i===0&&e===0)return this;let s=0,n=0;if(t=G.qi(t),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{const o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*i-n*e,this.py=n*i+s*e,this}scale(t,i){return Debug&&(U.r(t,Point,"scale:sx"),U.r(i,Point,"scale:sy"),this.tt()),this.px*=t,this.py*=i,this}distanceSquaredPoint(t){Debug&&U.s(t,Point,Point,"distanceSquaredPoint:p");const i=t.x-this.px,e=t.y-this.py;return i*i+e*e}distanceSquared(t,i){Debug&&(U.r(t,Point,"distanceSquared:px"),U.r(i,Point,"distanceSquared:py"));const e=t-this.px,s=i-this.py;return e*e+s*s}normalize(){Debug&&this.tt();const t=this.px,i=this.py,e=Math.sqrt(t*t+i*i);return e>0&&(this.px=t/e,this.py=i/e),this}directionPoint(t){return Debug&&U.s(t,Point,Point,"directionPoint:p"),this.hT(t.x-this.px,t.y-this.py)}direction(t,i){return Debug&&(U.r(t,Point,"direction:px"),U.r(i,Point,"direction:py")),this.hT(t-this.px,i-this.py)}hT(t,i){if(t===0)return i>0?90:i<0?270:0;if(i===0)return t>0?0:180;{if(isNaN(t)||isNaN(i))return 0;let e=Math.atan(Math.abs(i/t))*180/Math.PI;return t<0?i<0?e+=180:e=180-e:i<0&&(e=360-e),e}}static compareWithLineSegment(t,i,e,s,n,o){return Debug&&(U.r(t,Point,"compareWithLineSegment:a1x"),U.r(i,Point,"compareWithLineSegment:a1y"),U.r(e,Point,"compareWithLineSegment:a2x"),U.r(s,Point,"compareWithLineSegment:a2y"),U.r(n,Point,"compareWithLineSegment:b1x"),U.r(o,Point,"compareWithLineSegment:b1y")),G.Eu(t,i,e,s,n,o)}compareWithLineSegmentPoint(t,i){return Debug&&(U.s(t,Point,Point,"compareWithLineSegmentPoint:p"),U.s(i,Point,Point,"compareWithLineSegmentPoint:q")),G.Eu(t.x,t.y,i.x,i.y,this.x,this.y)}static intersectingLineSegments(t,i,e,s,n,o,r,l){return Debug&&(U.r(t,Point,"intersectingLineSegments:a1x"),U.r(i,Point,"intersectingLineSegments:a1y"),U.r(e,Point,"intersectingLineSegments:a2x"),U.r(s,Point,"intersectingLineSegments:a2y"),U.r(n,Point,"intersectingLineSegments:b1x"),U.r(o,Point,"intersectingLineSegments:b1y"),U.r(r,Point,"intersectingLineSegments:b2x"),U.r(l,Point,"intersectingLineSegments:b2y")),G.Nr(t,i,e,s,n,o,r,l)}projectOntoLineSegment(t,i,e,s){return Debug&&(U.r(t,Point,"projectOntoLineSegment:px"),U.r(i,Point,"projectOntoLineSegment:py"),U.r(e,Point,"projectOntoLineSegment:qx"),U.r(s,Point,"projectOntoLineSegment:qy")),G.Xl(t,i,e,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,i){return Debug&&(U.s(t,Point,Point,"projectOntoLineSegmentPoint:p"),U.s(i,Point,Point,"projectOntoLineSegmentPoint:q")),G.Xl(t.x,t.y,i.x,i.y,this.px,this.py,this),this}snapToGrid(t,i,e,s){return Debug&&(U.r(t,Point,"snapToGrid:originx"),U.r(i,Point,"snapToGrid:originy"),U.r(e,Point,"snapToGrid:cellwidth"),U.r(s,Point,"snapToGrid:cellheight")),G.xm(this.px,this.py,t,i,e,s,this),this}snapToGridPoint(t,i){return Debug&&(U.s(t,Point,Point,"snapToGridPoint:p"),U.s(i,Size,Point,"snapToGridPoint:q")),G.xm(this.px,this.py,t.x,t.y,i.width,i.height,this),this}setRectSpot(t,i){return Debug&&(U.s(t,Rect,Point,"setRectSpot:r"),U.s(i,Spot,Point,"setRectSpot:spot"),this.tt()),this.px=t.x+i.x*t.width+i.offsetX,this.py=t.y+i.y*t.height+i.offsetY,this}setSpot(t,i,e,s,n){return Debug&&(U.r(t,Point,"setSpot:x"),U.r(i,Point,"setSpot:y"),U.r(e,Point,"setSpot:w"),U.r(s,Point,"setSpot:h"),(e<0||s<0)&&U.n("Point.setSpot:Width and height cannot be negative"),U.s(n,Spot,Point,"setSpot:spot"),this.tt()),this.px=t+n.x*e+n.offsetX,this.py=i+n.y*s+n.offsetY,this}D(t){return t.Pt(this),this}Ie(t){return t.Oe(this),this}static distanceLineSegmentSquared(t,i,e,s,n,o){Debug&&(U.r(t,Point,"distanceLineSegmentSquared:px"),U.r(i,Point,"distanceLineSegmentSquared:py"),U.r(e,Point,"distanceLineSegmentSquared:ax"),U.r(s,Point,"distanceLineSegmentSquared:ay"),U.r(n,Point,"distanceLineSegmentSquared:bx"),U.r(o,Point,"distanceLineSegmentSquared:by"));let r=n-e,l=o-s;const h=r*r+l*l,a=e-t,c=s-i,f=-a*r-c*l;if(f<=0||f>=h)return r=n-t,l=o-i,Math.min(a*a+c*c,r*r+l*l);{const u=r*c-l*a;return u*u/h}}static distanceSquared(t,i,e,s){Debug&&(U.r(t,Point,"distanceSquared:px"),U.r(i,Point,"distanceSquared:py"),U.r(e,Point,"distanceSquared:qx"),U.r(s,Point,"distanceSquared:qy"));const n=e-t,o=s-i;return n*n+o*o}static direction(t,i,e,s){Debug&&(U.r(t,Point,"direction:px"),U.r(i,Point,"direction:py"),U.r(e,Point,"direction:qx"),U.r(s,Point,"direction:qy"));const n=e-t,o=s-i;if(n===0)return o>0?90:o<0?270:0;if(o===0)return n>0?0:180;{if(isNaN(n)||isNaN(o))return 0;let r=Math.atan(Math.abs(o/n))*180/Math.PI;return n<0?o<0?r+=180:r=180-r:o<0&&(r=360-r),r}}get x(){return this.px}set x(t){Debug&&(U.i(t,"number",Point,"x"),this.tt(t)),this.px=t}get y(){return this.py}set y(t){Debug&&(U.i(t,"number",Point,"y"),this.tt(t)),this.py=t}isReal(){return isFinite(this.x)&&isFinite(this.y)}static kn=new Point(0,0).At();static aT=new Point(-1/0,-1/0).At();static cT=new Point(1/0,1/0).At();static fT=new Point(6,6).At();static Pn=new Point(NaN,NaN).At();static mx=[];static a(){const t=Point.mx.pop();return t===void 0?new Point:t}static Ze(t){const i=Point.mx.pop();return i===void 0?t.copy():i.f(t)}static V(t,i){const e=Point.mx.pop();return e===void 0?new Point(t,i):(e.x=t,e.y=i,e)}static o(t){Point.mx.push(t)}}class Size{sw;sh;p;constructor(t,i){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof i=="number"&&(i>=0||isNaN(i))?(this.sw=t,this.sh=i):U.n("Invalid arguments to Size constructor: "+t+", "+i),this.p=!1}f(t){return this.sw=t.sw,this.sh=t.sh,this}e(t,i){return this.sw=t,this.sh=i,this}setTo(t,i){return Debug&&(U.i(t,"number",Size,"setTo:w"),U.i(i,"number",Size,"setTo:h"),t<0&&U.q(t,">= 0",Size,"setTo:w"),i<0&&U.q(i,">= 0",Size,"setTo:h"),this.tt()),this.sw=t,this.sh=i,this}set(t){return Debug&&(U.s(t,Size,Size,"set:s"),this.tt()),this.sw=t.sw,this.sh=t.sh,this}copy(){const t=new Size;return t.sw=this.sw,t.sh=this.sh,t}At(){return this.p=!0,Object.freeze(this),this}T(){return this.p||Object.isFrozen(this)?this:this.copy().S()}S(){return this.p||(this.p=!0),this}tt(t){if(Debug&&this.p){let i="The Size is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;return n=i[e++],n&&(o=parseFloat(n)),new Size(s,o)}else return new Size}static stringify(t){return Debug&&U.s(t,Size),t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.i(t,"number",Size,"stringifyFixed:digits"),i=>i.width.toFixed(t)+" "+i.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Size?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,i){return this.sw===t&&this.sh===i}equalsApprox(t){return G.u(this.sw,t.width)&&G.u(this.sh,t.height)}inflate(t,i){Debug&&(U.r(t,Size,"inflate:w"),U.r(i,Size,"inflate:h"));const e=this.width+t;this.sw=e>=0?e:0;const s=this.height+i;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){Debug&&(U.i(t,"number",Size,"width"),this.tt(t)),t<0&&U.q(t,">= 0",Size,"width"),this.sw=t}get height(){return this.sh}set height(t){Debug&&(U.i(t,"number",Size,"height"),this.tt(t)),t<0&&U.q(t,">= 0",Size,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static ua=new Size(0,0).At();static jk=new Size(1,1).At();static uT=new Size(6,6).At();static Bu=new Size(8,8).At();static dT=new Size(10,10).At();static yx=new Size(1/0,1/0).At();static wx=new Size(NaN,NaN).At();static gT=[];static a(){const t=Size.gT.pop();return t===void 0?new Size:t}static o(t){Size.gT.push(t)}}class Rect{rx;ry;rw;rh;p;constructor(t,i,e,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof i=="number"&&typeof e=="number"&&(e>=0||isNaN(e))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=i,this.rw=e,this.rh=s;else if(t instanceof Point){const n=t.x,o=t.y;if(i instanceof Point){const r=i.x,l=i.y;this.rx=Math.min(n,r),this.ry=Math.min(o,l),this.rw=Math.abs(n-r),this.rh=Math.abs(o-l)}else i instanceof Size?(this.rx=n,this.ry=o,this.rw=i.width,this.rh=i.height):U.n("Incorrect second argument supplied to Rect constructor "+i)}else U.n("Invalid arguments to Rect constructor: "+t+", "+i+", "+e+", "+s);this.p=!1}f(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}e(t,i,e,s){return this.rx=t,this.ry=i,this.rw=e,this.rh=s,this}io(t,i){return this.rw=t,this.rh=i,this}setTo(t,i,e,s){return Debug&&(U.i(t,"number",Rect,"setTo:x"),U.i(i,"number",Rect,"setTo:y"),U.i(e,"number",Rect,"setTo:w"),U.i(s,"number",Rect,"setTo:h"),e<0&&U.q(e,">= 0",Rect,"setTo:w"),s<0&&U.q(s,">= 0",Rect,"setTo:h"),this.tt()),this.rx=t,this.ry=i,this.rw=e,this.rh=s,this}set(t){return Debug&&(U.s(t,Rect,Rect,"set:r"),this.tt()),this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return Debug&&(U.s(t,Point,Rect,"setPoint:p"),this.tt()),this.rx=t.x,this.ry=t.y,this}setSize(t){return Debug&&(U.s(t,Size,Rect,"setSize:s"),this.tt()),this.rw=t.width,this.rh=t.height,this}copy(){const t=new Rect;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}At(){return this.p=!0,Object.freeze(this),this}T(){return this.p||Object.isFrozen(this)?this:this.copy().S()}S(){return this.p||(this.p=!0),this}si(){return this.p&&(Object.isFrozen(this)&&U.n("cannot thaw constant: "+this),this.p=!1),this}tt(t){if(Debug&&this.p){let i="The Rect is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=0;for(;i[e]==="";)e++;let n=i[e++];n&&(s=parseFloat(n));let o=0;for(;i[e]==="";)e++;n=i[e++],n&&(o=parseFloat(n));let r=0;for(;i[e]==="";)e++;n=i[e++],n&&(r=parseFloat(n));let l=0;for(;i[e]==="";)e++;return n=i[e++],n&&(l=parseFloat(n)),new Rect(s,o,r,l)}else return new Rect}static stringify(t){return Debug&&U.s(t,Rect),t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return U.i(t,"number",Rect,"stringifyFixed:digits"),i=>i.x.toFixed(t)+" "+i.y.toFixed(t)+" "+i.width.toFixed(t)+" "+i.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof Rect?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,i,e,s){return this.rx===t&&this.ry===i&&this.rw===e&&this.rh===s}equalsApprox(t){return G.u(this.rx,t.x)&&G.u(this.ry,t.y)&&G.u(this.rw,t.width)&&G.u(this.rh,t.height)}equalsApproxTo(t,i,e,s){return G.u(this.rx,t)&&G.u(this.ry,i)&&G.u(this.rw,e)&&G.u(this.rh,s)}equalsApproxClose(t){return G.H(this.rx,t.x)&&G.H(this.ry,t.y)&&G.H(this.rw,t.width)&&G.H(this.rh,t.height)}containsPoint(t){return Debug&&U.s(t,Point,Rect,"containsPoint:p"),this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return Debug&&U.s(t,Rect,Rect,"containsRect:r"),this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,i,e,s){return Debug?(U.r(t,Rect,"contains:x"),U.r(i,Rect,"contains:y"),e===void 0?e=0:U.r(e,Rect,"contains:w"),s===void 0?s=0:U.r(s,Rect,"contains:h"),(e<0||s<0)&&U.n("Rect.contains:Width and height cannot be negative")):(e===void 0&&(e=0),s===void 0&&(s=0)),this.rx<=t&&t+e<=this.rx+this.rw&&this.ry<=i&&i+s<=this.ry+this.rh}offset(t,i){return Debug&&(U.r(t,Rect,"offset:dx"),U.r(i,Rect,"offset:dy"),this.tt()),this.rx+=t,this.ry+=i,this}inflate(t,i){return Debug&&(U.r(t,Rect,"inflate:w"),U.r(i,Rect,"inflate:h")),this.xx(i,t,i,t)}addMargin(t){return Debug&&U.s(t,Margin,Rect,"addMargin:m"),this.xx(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return Debug&&U.s(t,Margin,Rect,"subtractMargin:m"),this.xx(-t.top,-t.right,-t.bottom,-t.left)}grow(t,i,e,s){return Debug&&(U.r(t,Rect,"grow:t"),U.r(i,Rect,"grow:r"),U.r(e,Rect,"grow:b"),U.r(s,Rect,"grow:l")),this.xx(t,i,e,s)}xx(t,i,e,s){Debug&&this.tt();const n=this.rw;i+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=i+s);const o=this.rh;return t+e<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+e),this}intersectRect(t){return Debug&&U.s(t,Rect,Rect,"intersectRect:r"),this.mT(t.x,t.y,t.width,t.height)}intersect(t,i,e,s){return Debug&&(U.r(t,Rect,"intersect:x"),U.r(i,Rect,"intersect:y"),U.r(e,Rect,"intersect:w"),U.r(s,Rect,"intersect:h"),(e<0||s<0)&&U.n("Rect.intersect:Width and height cannot be negative")),this.mT(t,i,e,s)}mT(t,i,e,s){Debug&&this.tt();const n=Math.max(this.rx,t),o=Math.max(this.ry,i),r=Math.min(this.rx+this.rw,t+e),l=Math.min(this.ry+this.rh,i+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,l-o),this}intersectsRect(t){return Debug&&U.s(t,Rect,Rect,"intersectsRect:r"),this.intersects(t.x,t.y,t.width,t.height)}intersects(t,i,e,s){Debug&&(U.r(t,Rect,"intersects:x"),U.r(i,Rect,"intersects:y"),U.r(t,Rect,"intersects:w"),U.r(i,Rect,"intersects:h"),(e<0||s<0)&&U.n("Rect.intersects:Width and height cannot be negative"));let n=this.rw;const o=this.rx;if(n!==1/0&&e!==1/0&&(n+=o,e+=t,isNaN(e)||isNaN(n)||o>e||t>n))return!1;let r=this.rh;const l=this.ry;return!(r!==1/0&&s!==1/0&&(r+=l,s+=i,isNaN(s)||isNaN(r)||l>s||i>r))}Jk(t,i){let e=this.rw,s=t.width+i+i;const n=this.rx,o=t.x-i;if(e+=n,s+=o,n>s||o>e)return!1;let r=this.rh,l=t.height+i+i;const h=this.ry,a=t.y-i;return r+=h,l+=a,!(h>l||a>r)}unionPoint(t){return Debug&&U.s(t,Point,Rect,"unionPoint:p"),this.ui(t.x,t.y,0,0)}unionRect(t){return Debug&&U.s(t,Rect,Rect,"unionRect:r"),this.ui(t.rx,t.ry,t.rw,t.rh)}union(t,i,e,s){return Debug?(U.r(t,Rect,"union:x"),U.r(i,Rect,"union:y"),e===void 0?e=0:U.r(e,Rect,"union:w"),s===void 0?s=0:U.r(s,Rect,"union:h"),(e<0||s<0)&&U.n("Rect.union:Width and height cannot be negative"),this.tt()):(e===void 0&&(e=0),s===void 0&&(s=0)),this.ui(t,i,e,s)}ui(t,i,e,s){const n=Math.min(this.rx,t),o=Math.min(this.ry,i),r=Math.max(this.rx+this.rw,t+e),l=Math.max(this.ry+this.rh,i+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=l-o,this}setSpot(t,i,e){return Debug&&(U.r(t,Rect,"setSpot:x"),U.r(i,Rect,"setSpot:y"),U.s(e,Spot,Rect,"setSpot:spot"),this.tt()),this.rx=t-e.offsetX-e.x*this.rw,this.ry=i-e.offsetY-e.y*this.rh,this}nearestSideDirection(t,i){return Debug&&(U.r(t,Rect,"nearestSideDirection:x"),U.r(i,Rect,"nearestSideDirection:y")),G.Sx(this,t,i,!0)}nearestSideDirectionPoint(t){return Debug&&U.s(t,Point,Rect,"unionPoint:p"),G.Sx(this,t.x,t.y,!0)}static contains(t,i,e,s,n,o,r,l){return Debug?(U.r(t,Rect,"contains:rx"),U.r(i,Rect,"contains:ry"),U.r(e,Rect,"contains:rw"),U.r(s,Rect,"contains:rh"),U.r(n,Rect,"contains:x"),U.r(o,Rect,"contains:y"),r===void 0?r=0:U.r(r,Rect,"contains:w"),l===void 0?l=0:U.r(l,Rect,"contains:h"),(e<0||s<0||r<0||l<0)&&U.n("Rect.contains:Width and height cannot be negative")):(r===void 0&&(r=0),l===void 0&&(l=0)),t<=n&&n+r<=t+e&&i<=o&&o+l<=i+s}static intersects(t,i,e,s,n,o,r,l){Debug&&(U.r(t,Rect,"intersects:rx"),U.r(i,Rect,"intersects:ry"),U.r(e,Rect,"intersects:rw"),U.r(s,Rect,"intersects:rh"),U.r(n,Rect,"intersects:x"),U.r(o,Rect,"intersects:y"),U.r(r,Rect,"intersects:w"),U.r(l,Rect,"intersects:h"),(e<0||s<0||r<0||l<0)&&U.n("Rect.intersects:Width and height cannot be negative"));let h=e,a=r;const c=t,f=n;if(h+=c,a+=f,c>a||f>h)return!1;let u=s,d=l;const m=i,g=o;return u+=m,d+=g,!(m>d||g>u)}static intersectsLineSegment(t,i,e,s,n,o,r,l){return Debug&&(U.r(t,Rect,"intersectsLineSegment:x"),U.r(i,Rect,"intersectsLineSegment:y"),U.r(e,Rect,"intersectsLineSegment:w"),U.r(s,Rect,"intersectsLineSegment:h"),U.r(n,Rect,"intersectsLineSegment:p1x"),U.r(o,Rect,"intersectsLineSegment:p1y"),U.r(r,Rect,"intersectsLineSegment:p2x"),U.r(l,Rect,"intersectsLineSegment:p2y"),(e<0||s<0)&&U.n("Rect.intersectsLineSegment: width and height cannot be negative")),G.pT(t,i,e,s,n,o,r,l)}get x(){return this.rx}set x(t){Debug&&(U.i(t,"number",Rect,"x"),this.tt(t)),this.rx=t}get y(){return this.ry}set y(t){Debug&&(U.i(t,"number",Rect,"y"),this.tt(t)),this.ry=t}get width(){return this.rw}set width(t){Debug&&(U.i(t,"number",Rect,"width"),this.tt(t)),t<0&&U.q(t,">= 0",Rect,"width"),this.rw=t}get height(){return this.rh}set height(t){Debug&&(U.i(t,"number",Rect,"height"),this.tt(t)),t<0&&U.q(t,">= 0",Rect,"height"),this.rh=t}get left(){return this.rx}set left(t){Debug&&(U.i(t,"number",Rect,"left"),this.tt(t)),this.rx=t}get top(){return this.ry}set top(t){Debug&&(U.i(t,"number",Rect,"top"),this.tt(t)),this.ry=t}get right(){return this.rx+this.rw}set right(t){Debug&&(U.r(t,Rect,"right"),this.tt(t)),this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){Debug&&(U.r(t,Rect,"top"),this.tt(t)),this.ry+=t-(this.ry+this.rh)}get position(){return new Point(this.rx,this.ry)}set position(t){Debug&&(U.s(t,Point,Rect,"position"),this.tt(t)),this.rx=t.x,this.ry=t.y}get size(){return new Size(this.rw,this.rh)}set size(t){Debug&&(U.s(t,Size,Rect,"size"),this.tt(t)),this.rw=t.width,this.rh=t.height}get center(){return new Point(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){Debug&&(U.s(t,Point,Rect,"center"),this.tt(t)),this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){Debug&&(U.r(t,Rect,"centerX"),this.tt(t)),this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){Debug&&(U.r(t,Rect,"centerY"),this.tt(t)),this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static bm=new Rect(0,0,0,0).At();static CI=new Rect(NaN,NaN,NaN,NaN).At();static kx=[];static a(){const t=Rect.kx.pop();return t===void 0?new Rect:t}static Ze(t){const i=Rect.kx.pop();return i===void 0?t.copy():i.f(t)}static V(t,i,e,s){const n=Rect.kx.pop();return n===void 0?new Rect(t,i,e,s):n.e(t,i,e,s)}static o(t){Rect.kx.push(t)}}class Margin{mt;mr;mb;ml;constructor(t,i,e,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):i===void 0?(i=t,e=t,s=t,this.mt=t,this.mr=i,this.mb=e,this.ml=s):e===void 0?(e=t,s=i,this.mt=t,this.mr=i,this.mb=e,this.ml=s):s!==void 0?(this.mt=t,this.mr=i,this.mb=e,this.ml=s):U.n("Invalid arguments to Margin constructor: "+t+", "+i+", "+e+", "+s)}setTo(t,i,e,s){return Debug&&(U.i(t,"number",Margin,"setTo:t"),U.i(i,"number",Margin,"setTo:r"),U.i(e,"number",Margin,"setTo:b"),U.i(s,"number",Margin,"setTo:l"),this.tt()),this.mt=t,this.mr=i,this.mb=e,this.ml=s,this}set(t){return Debug&&(U.s(t,Margin,Margin,"assign:m"),this.tt()),this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){const t=new Margin;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}At(){return Object.freeze(this),this}T(){return Object.isFrozen(this)?this:this.copy().At()}tt(t){if(Debug&&Object.isFrozen(this)){let i="The Margin is frozen, so its properties cannot be set: "+this.toString();t!==void 0&&(i+=" to value: "+t),U.n(i)}}static parse(t){if(typeof t=="string"){const i=t.split(" ");let e=0,s=NaN;for(;i[e]==="";)e++;let n=i[e++];if(n&&(s=parseFloat(n)),isNaN(s))return new Margin;let o=NaN;for(;i[e]==="";)e++;if(n=i[e++],n&&(o=parseFloat(n)),isNaN(o))return new Margin(s);let r=NaN;for(;i[e]==="";)e++;if(n=i[e++],n&&(r=parseFloat(n)),isNaN(r))return new Margin(s,o);let l=NaN;for(;i[e]==="";)e++;return n=i[e++],n&&(l=parseFloat(n)),isNaN(l)?new Margin(s,o):new Margin(s,o,r,l)}else return new Margin}static stringify(t){retur