// Copyright 2018, University of Colorado Boulder

/**
 * Renderer for general equation in vertex form.
 * Vertex form is y = a(x - h)^2 + k
 *
 * @author Andrea Lin
 */
define( function( require ) {
  'use strict';

  // modules
  const GQFont = require( 'GRAPHING_QUADRATICS/common/GQFont' );
  const graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' );
  const inherit = require( 'PHET_CORE/inherit' );
  const MathSymbols = require( 'SCENERY_PHET/MathSymbols' );
  const RichText = require( 'SCENERY/nodes/RichText' );
  const StringUtils = require( 'PHETCOMMON/util/StringUtils' );

  // strings
  const aString = require( 'string!GRAPHING_QUADRATICS/a' );
  const hString = require( 'string!GRAPHING_QUADRATICS/h' );
  const kString = require( 'string!GRAPHING_QUADRATICS/k' );
  const xString = require( 'string!GRAPHING_QUADRATICS/x' );
  const yString = require( 'string!GRAPHING_QUADRATICS/y' );

  /**
   * @param {Object} [options]
   * @constructor
   */
  function VertexFormEquationNode( options ) {

    options = _.extend( {
      font: GQFont.MATH_SYMBOL_FONT
    } );

    const equation = StringUtils.fillIn( '{{y}} {{equals}} {{a}}({{x}} {{minus}} {{h}})<sup>2</sup> {{plus}} {{k}}', {
      x: xString,
      y: yString,
      a: aString,
      h: hString,
      k: kString,
      equals: MathSymbols.EQUAL_TO,
      minus: MathSymbols.MINUS,
      plus: MathSymbols.PLUS
    } );

    RichText.call( this, equation, options );

  }

  graphingQuadratics.register( 'VertexFormEquationNode', VertexFormEquationNode );

  return inherit( RichText, VertexFormEquationNode );
} );

@@ -374,58 +374,8 @@
  );%0A
-  const inherit = require( 'PHET_CORE/inherit' );%0A
   co
@@ -871,16 +871,69 @@
 /y' );%0A%0A
+  class VertexFormEquationNode extends RichText %7B%0A%0A  
   /**%0A  
@@ -933,16 +933,18 @@
  /**%0A   
+ 
+ 
 * @param
@@ -970,62 +970,28 @@
 %0A   
-* @constructor%0A   */%0A  function VertexFormEquationNode
+  */%0A    constructor
 ( op
@@ -997,24 +997,26 @@
 ptions ) %7B%0A%0A
+  
     options 
@@ -1035,16 +1035,18 @@
 %7B%0A      
+  
 font: GQ
@@ -1067,30 +1067,34 @@
 OL_FONT%0A    
+  
 %7D );%0A%0A
+  
     const eq
@@ -1206,16 +1206,18 @@
 %7B%0A      
+ 
+ 
 x: xStri
@@ -1216,24 +1216,26 @@
 x: xString,%0A
+  
       y: ySt
@@ -1246,16 +1246,18 @@
 ,%0A      
+ 
+ 
 a: aStri
@@ -1256,24 +1256,26 @@
 a: aString,%0A
+  
       h: hSt
@@ -1286,16 +1286,18 @@
 ,%0A      
+  
 k: kStri
@@ -1296,24 +1296,26 @@
 k: kString,%0A
+  
       equals
@@ -1344,16 +1344,18 @@
 ,%0A      
+  
 minus: M
@@ -1378,16 +1378,18 @@
 ,%0A      
+ 
+ 
 plus: Ma
@@ -1403,24 +1403,26 @@
 ls.PLUS%0A    
+  
 %7D );%0A%0A    Ri
@@ -1423,28 +1423,16 @@
     
-RichText.call( this,
+  super(
  equ
@@ -1453,16 +1453,21 @@
  );%0A
+    %7D
 %0A  %7D%0A%0A  
 grap
@@ -1462,16 +1462,23 @@
 %0A  %7D%0A%0A  
+return 
 graphing
@@ -1553,63 +1553,8 @@
 e );
-%0A%0A  return inherit( RichText, VertexFormEquationNode );
 %0A%7D )

convert to class