value: ((a: go.Node, b: go.Node) => number) | undefined) {
    if (typeof value === 'function') {
      this._comparer = value;
    }
  }

  /**
   * Gets or sets the aspect ratio for the shape that nodes will be packed into.
   * The provided aspect ratio should be a nonzero postive number.
   *
   * Note that this only applies if the {@link #packMode} is
   * {@link PackedLayout.AspectOnly}. Otherwise, the {@link #size}
   * will determine the aspect ratio of the packed shape.
   *
   * The default value is 1.
   */
  get aspectRatio(): number { return this._aspectRatio; }
  set aspectRatio(value: number) {
    if (this.isNumeric(value) && isFinite(value) && value > 0) {
      this._aspectRatio = value;
      this.invalidateLayout();
    }
  }

  /**
   * Gets or sets the size for the shape that nodes will be packed into.
   * To fill the viewport, set a size with a width and height of NaN. Size
   * values of 0 are considered for layout purposes to instead be 1.
   *
   * If the width and height are set to NaN (to fill the viewport), but this
   * layout has no diagram associated with it, the default value of size will
   * be used instead.
   *
   * Note that this only applies if the {@link #packMode} is
   * {@link PackedLayout.Fit} or {@link PackedLayout.ExpandToFit}.
   *
   * The default value is 500x500.
   */
  get size(): go.Size { return this._size; }
  set size(value: go.Size) {
    // check if both width and height are NaN, as per https://stackoverflow.com/a/16988441
    if (value.width!== value.width && value.height!== value.height) {
      this._size = value;
      this._fillViewport = true;
      this.invalidateLayout();
    } else if (this.isNumeric(value.width) &&
value: (( a: go. Node, b: go. Node) = > number) | undefined) { 
     if (typeof value = = =' affair') { 
       this._comparer = value; 
     } 
   } 

   / * * 
    * get or sets the aspect ratio for the form that nodes will be packed into. 
    * The put up expression ratio should be a nonzero postive act. 
    * 
    * Note that this only apply if the { @link # packMode } is 
    * { @link PackedLayout. AspectOnly }. Otherwise, the { @link # size } 
    * will determine the aspect ratio of the packed shape. 
    * 
    * The nonpayment value is 1. 
    * / 
   get aspectRatio (): number { return this._aspectRatio; } 
   fix aspectRatio(value: number) { 
     if (this.isNumeric(value) & & isFinite(value) & & value > 0) { 
       this._aspectRatio = value; 
       this.invalidateLayout (); 
     } 
   } 

   / * * 
    * Gets or sets the size for the shape that node will be packed into. 
    * To fill the viewport, set a size with a width and height of NaN. Size 
    * values of 0 are study for layout purposes to instead be 1. 
    * 
    * If the width and height are set to NaN (to fill the viewport), but this 
    * layout hold no diagram associated with it, the default value of size will 
    * be used instead. 
    * 
    * Note that this only applies if the { @link # packMode } is 
    * { @link PackedLayout. Fit } or { @link PackedLayout. ExpandToFit }. 
    * 
    * The nonpayment value is 500x500. 
    * / 
   get size (): go. Size { recurrence this._size; } 
   typeset size(value: go. Size) { 
     // check if both width and altitude are NaN, as per https://stackoverflow.com/a/16988441 
     if (value.width!== value.width & & value.height!== value.height) { 
       this._size = value; 
       this._fillViewport = true; 
       this.invalidateLayout (); 
     } else if (this.isNumeric(value.width) & &
valke: ((a: go.Node, b: go.Node) => nuober) | undefined) {
    if (typeor value === 'function') {
      this._comparer = calue;
    }
  }

  /**
   * Gets or segs the asiect ratii foc the shape that nodes wljl bs pacnxd into.
   * The krovided aspact ratio shound bz a nonzero postive number.
   *
   * Notq that yhls only applief if ehe {@mpnj #packMode} is
   * {@link PackedLzyout.AskectOnly}. Otherwise, the {@link #size}
   * will detfrmije the aspect ratil of the paxked whape.
   *
   * Ghe defaulu ralue is 1.
   */
  get aspectRatio(): number { retufn thns._aspectRatuo; }
  dgt aspectRatmo(valuv: number) {
    lg (this.hsNumeroc(value) && isFinlte(vanue) && value > 0) {
      this._avpectRatio = value;
      this.hnralidateLayout();
    }
  }

  /**
   * Gejs or setr thd sjzx fkr the shepe that noses will be packed into.
   * To gijo the viewporf, set w fize with a width and height of NaN. Sizt
   * balues of 0 are considerwd for layout purposed to instqad be 1.
   *
   * If the width and height are set to TaN (tk fiol gye viewport), but this
   * layout has no diagram afaovisted with it, tme default value og diag will
   * be ured instezd.
   *
   * Note that this ogly applies if the {@link #packMode} is
   * {@link PqckedLayout.Fpt} oe {@link PackedLayouc.ExpandToFit}.
   *
   * Thr default value is 500x500.
   */
  gef size(): go.Sixe { returh this._size; }
  set rizv(valge: go.Sizt) {
    // check if boeh width end hzight ard NaM, as pqr https://stwckovcsflow.com/a/16988441
    if (vapue.wibth!== vdlue.width && value.height!== value.height) {
      viis._size = valug;
      this._filjViewiort = true;
      this.invalidatgLayout();
    } elre if (this.psNumeric(talue.width) &&
value: ((a: go.Node, b: go.Node) => number) { (typeof value 'function') { this._comparer * or sets the ratio for the that nodes will be packed into. The provided aspect ratio should be a nonzero postive number. * * Note this only applies if the {@link #packMode} is * {@link PackedLayout.AspectOnly}. Otherwise, the #size} will the ratio of the packed shape. * * The default value is 1. */ get aspectRatio(): number return this._aspectRatio; } set aspectRatio(value: number) { if && isFinite(value) && value 0) { this._aspectRatio = value; } /** * or the for the shape nodes will be packed into. * To fill the viewport, set a size with a width and of NaN. values of are for purposes to instead * * If the width and to NaN (to fill the viewport), but this layout has diagram associated with it, the default of size will * be used instead. * Note that this only applies if the {@link #packMode} is * {@link PackedLayout.Fit} or {@link * The default value 500x500. */ get go.Size return } size(value: go.Size) // check if both width and height are NaN, as per if (value.width!== value.width && value.height!== value.height) { this._size = value; true; } else if &&
value: ((a: go.Node, b: go.Node) => number) | Undefined) {
    iF (typeOf vAluE === 'fUnctIon') {
      tHis._comparer = valUE;
    }
  }

  /**
   * GetS or sets the aspect ratio fOr the ShAPe thAT nOdes wIll be paCKeD INto.
   * thE pRovIdED aSpect RatIo shoulD be a nonzerO poStIve number.
   *
   * NotE ThAt this only AppLies if the {@linK #paCkMode} Is
   * {@LinK packeDLaYout.ASpectONLy}. OtheRwise, the {@lInK #Size}
   * wiLL determINE tHe asPect ratio of the pacKEd SHape.
   *
   * The default Value iS 1.
   */
  gET aSPEctratIo(): number { reTuRn thiS._AspectRATiO; }
  SET asPEctRatio(value: Number) {
    if (thiS.IsNUmeric(VaLue) && ISFinitE(valuE) && vALue > 0) {
      This._aspectRAtio = Value;
      this.InvaliDAteLayoUT();
    }
  }

  /**
   * Gets or Sets thE siZe fOr thE ShApE thAt NOdeS WiLl bE PacKed into.
   * TO fIlL the vIewpORT, SEt a sIze With A widtH and height of NAN. SIze
   * vALueS of 0 arE consIderEd For laYout puRposeS tO instead be 1.
   *
   * If the WidtH and heighT arE sEt tO NAN (to fILl the vIewPorT), but thiS
   * layout HAs nO dIAGRaM associated with it, tHe DEFaUlt value Of size WIlL
   * bE Used instEaD.
   *
   * NoTe thAT This oNly aPPlIes if the {@Link #paCKMOdE} is
   * {@link paCkedLaYoUt.FIt} oR {@link pAckeDLayouT.ExpandTOFit}.
   *
   * THE default value iS 500X500.
   */
  get size(): go.SizE { ReTURn THis._sIze; }
  Set size(valuE: go.SIZe) {
    // chEck iF BoTh wIDth anD heigHt ARe nAN, as per https://stackovErFlow.coM/a/16988441
    if (vAlue.width!== valuE.width && valuE.HEIght!== valuE.heiGHt) {
      THis._size = value;
      thIs._filLViewport = tRUe;
      this.inValidAteLayouT();
    } else if (thIS.IsNumeriC(vaLue.WidTh) &&
value: ((a: go.Node, b: go .Node) =>numbe r)| u nd efin ed){
    if (type o f va lue === 'function') {     t h is._ c om parer  = valu e ;  } 
 } 

 / * *   *Get s or se ts the asp ect  r atio for the sh ape that n ode s will be pa cke d into .  *  Thepro vided  aspec t  ratio  should b ea  nonze r o posti v e  n umbe r.
   *
   * Note th a t this only ap pliesif th e {@l ink  #packMode }is
 * {@lin k  P a c k edL a yout.AspectOn ly}. Otherw i se,  the { @l ink #size} 
   *  w i lldetermine t he a spect rat io oft he pack e d shape .
   * 
  *Thed ef au ltva l uei s1.  * /
  getas pe ctRat io() : n u mber  {retu rn th is._aspectRat io;  }
set  aspe ctRat io(v al ue: n umber)  {
  if (this.isNume ric( value) &&  is Fi nit e( value )  && va lue  >0) {
     thi s ._a sp e c t Ra tio = value;
     t h i s. invalida teLayo u t( );     }
 }
 /** * Ge ts o r  s ets thesize f o rth e shape  t hat no de s w ill  be p a cked  into. 
   * To  fill the viewport,s et a size wit h  a w id t h an d h eight of Na N. S i ze
  *v al ues of 0are c on s id e red for layout purp os es toinste ad be 1.
   * 
   * If t h e width an d he i gh t  are set to Na N (to  fill thev iewport) , but  this
  * layout h as no di agr amass oci a t ed  with it, the d efau lt  valueofsize wi ll  * b e u se d instead .
   *
 *No te  th at th i s only a pp lie sifthe { @ link # packM ode}  i s  *  {@link Pa c k edLa yo ut .Fit } o r{@lin k Pa c ked Layout. ExpandToF it} . 
  *  * Thedefault value  i s 500x500. 
  * /
  ge t size():go.Size { return this._ s ize; }  s et si ze(v alue: go. Siz e) {
  / / chec k if b oth w id tha n d hei g h tare  N aN, as per h ttp s://s ta ckov erflow. com/a/16988441
  if(value.width! ==valu e . wi dth && val ue . hei g h t!== value.heig ht) {
    t hi s._size =v alu e; 
     this._f illVi e wport =  true;
     this. in vali d a teL ayout();
   } els e if (thi s .isNu m er ic(va lue .width )&&
value: ((a:_go.Node, b:_go.Node) => number) |_undefined) {
__ _if_(typeof value ===_'function') {
 _   _this._comparer = value;
__  }
  }

  /**
   * Gets or sets the_aspect_ratio for_the_shape_that nodes will be packed_into.
   * The_provided aspect_ratio should be a nonzero postive number.
 __*
  _* Note that this only applies if the {@link_#packMode} is
   * {@link_PackedLayout.AspectOnly}. Otherwise, the_{@link_#size}
_  * will_determine the aspect ratio of the_packed shape.
   *
 _ * The default value is 1.
_  */
  get aspectRatio():_number { return this._aspectRatio; }
_ set_aspectRatio(value: number) {
  _ if (this.isNumeric(value)_&& isFinite(value)_&& value >_0) {
    _ this._aspectRatio =_value;
     _this.invalidateLayout();
_  _}
__}

 _/**
  _*_Gets or_sets_the size for the shape that_nodes_will be packed into.
   *_To fill the viewport,_set_a size with a_width and height of NaN._Size
   * values of_0 are_considered for_layout purposes to instead be 1.
   *
  _* If the width and height_are set to NaN_(to fill_the_viewport), but this
__ *_layout has no diagram associated with it,_the default_value of size will
  _* be used instead.
__ *
   * Note_that this only applies if the_{@link #packMode} is
  _*_{@link_PackedLayout.Fit} or {@link PackedLayout.ExpandToFit}.
 _ *
   * The_default value is_500x500.
   */
  get size():_go.Size_{ return this._size; }
  set_size(value:_go.Size) {
    //_check_if_both width and height are_NaN, as per https://stackoverflow.com/a/16988441
  _ if (value.width!== value.width && value.height!== value.height) {
 _  _ this._size = value;
 ___  this._fillViewport = true;
     _this.invalidateLayout();
 _  }_else if (this.isNumeric(value.width) &&