func (t *RichText) SetMovedAt(movedAt *time.Ticket) {
	t.movedAt = movedAt
}
SetMovedAt sets the move time of this Text.
package json
import (
	"fmt"
	"strings"
	"unicode/utf16"
	"go.uber.org/zap"
	"github.com/yorkie-team/yorkie/internal/log"
	"github.com/yorkie-team/yorkie/pkg/document/time"
)
func InitialRichTextNode() *RGATreeSplitNode {
	return NewRGATreeSplitNode(initialNodeID, &RichTextValue{
		attrs: NewRHT(),
		value: "",
	})
}
type RichTextValue struct {
	attrs *RHT
	value string
}
func NewRichTextValue(attrs *RHT, value string) *RichTextValue {
	return &RichTextValue{
		attrs: attrs,
		value: value,
	}
}
func (t *RichTextValue) Attrs() *RHT {
	return t.attrs
}
func (t *RichTextValue) Value() string {
	return t.value
}
func (t *RichTextValue) Len() int {
	encoded := utf16.Encode([]rune(t.value))
	return len(encoded)
}
func (t *RichTextValue) String() string {
	return fmt.Sprintf(`{"attrs":%s,"val":"%s"}`, t.attrs.Marshal(), t.value)
}
func (t *RichTextValue) AnnotatedString() string {
	return fmt.Sprintf(`%s "%s"`, t.attrs.Marshal(), t.value)
}
func (t *RichTextValue) Split(offset int) RGATreeSplitValue {
	value := t.value
	encoded := utf16.Encode([]rune(value))
	t.value = string(utf16.Decode(encoded[0:offset]))
	return NewRichTextValue(t.attrs.DeepCopy(), string(utf16.Decode(encoded[offset:])))
}
func (t *RichTextValue) DeepCopy() RGATreeSplitValue {
	return &RichTextValue{
		attrs: t.attrs.DeepCopy(),
		value: t.value,
	}
}
type RichText struct {
	rgaTreeSplit *RGATreeSplit
	selectionMap map[string]*Selection
	createdAt    *time.Ticket
	movedAt      *time.Ticket
	removedAt    *time.Ticket
}
func NewRichText(elements *RGATreeSplit, createdAt *time.Ticket) *RichText {
	return &RichText{
		rgaTreeSplit: elements,
		selectionMap: make(map[string]*Selection),
		createdAt:    createdAt,
	}
}
func NewInitialRichText(elements *RGATreeSplit, createdAt *time.Ticket) *RichText {
	text := NewRichText(elements, createdAt)
	fromPos, toPos := text.CreateRange(0, 0)
	text.Edit(fromPos, toPos, nil, "\n", nil, createdAt)
	return text
}
func (t *RichText) Marshal() string {
	var values []string
	node := t.rgaTreeSplit.initialHead.next
	for node != nil {
		if node.createdAt().Compare(t.createdAt) == 0 {
		} else if node.removedAt == nil {
			values = append(values, node.String())
		}
		node = node.next
	}
	return fmt.Sprintf("[%s]", strings.Join(values, ","))
}
func (t *RichText) DeepCopy() Element {
	rgaTreeSplit := NewRGATreeSplit(InitialRichTextNode())
	current := rgaTreeSplit.InitialHead()
	for _, node := range t.Nodes() {
		current = rgaTreeSplit.InsertAfter(current, node.DeepCopy())
		insPrevID := node.InsPrevID()
		if insPrevID != nil {
			insPrevNode := rgaTreeSplit.FindNode(insPrevID)
			if insPrevNode == nil {
				log.Logger.Warn("insPrevNode should be presence")
			}
			current.SetInsPrev(insPrevNode)
		}
	}
	return NewRichText(rgaTreeSplit, t.createdAt)
}
func (t *RichText) CreatedAt() *time.Ticket {
	return t.createdAt
}
func (t *RichText) RemovedAt() *time.Ticket {
	return t.removedAt
}
func (t *RichText) MovedAt() *time.Ticket {
	return t.movedAt
}