protected function prepare_sections() {
		$this->sections = wp_list_sort( $this->sections, [
			'priority'        => 'ASC',
			'instance_number' => 'ASC',
		], 'ASC', true );

		$sections = [];

		foreach ( $this->sections as $section ) {
			if ( ! $section->check_capabilities() ) {
				continue;
			}

			// Top-level section.
			if ( ! $this instanceof Has_Panel || ! $section->panel ) {
				$sections[ $section->id ] = $section;
				continue;
			}

			// This section belongs to a panel.
			if ( isset( $this->panels [ $section->panel ] ) ) {
				$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
			}
		}

		// Update the sections.
		$this->sections = $sections;
	}