func NewEncodeForm(limits Limits) EncodeForm {
	var buf bytes.Buffer
	err := formTemplate.Execute(&buf, templateData{
		MaxSizes: limits.maxSizes(),
		Accept: strings.Join(
			inputExtensions(
				fileformat.WAV(),
				fileformat.MP3(),
				fileformat.FLAC(),
			),
			", "),
		OutFormats: outputExtensions(
			fileformat.WAV(),
			fileformat.MP3(),
		),
		WAV: WAV,
		MP3: MP3,
	})
	if err != nil {
		panic(fmt.Sprintf("failed to parse encode template: %v", err))
	}
	return EncodeForm{
		buf:    buf,
		limits: limits,
	}
}
NewEncodeForm creates new form with provided limits.
package userinput
import (
	"bytes"
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"text/template"
	"pipelined.dev/audio/fileformat"
	"pipelined.dev/phono/encode"
)
var (
	errInputFormat  = errors.New("unsupported input format")
	errOutputFormat = errors.New("unsupported output format")
)
var formTemplate = template.Must(template.New("encode").Parse(encodeHTML))
const FormFileKey = "form-file"
type (
	Limits map[*fileformat.Format]int64
	EncodeForm struct {
		buf    bytes.Buffer
		limits Limits
	}
	templateData struct {
		Accept     string
		OutFormats []string
		WAV        interface{}
		MP3        interface{}
		MaxSizes   map[string]int64
	}
)