text:
[![NPM version](http://img.shields.io/npm/v/terra-time-input.svg)](https://www.npmjs.org/package/terra-time-input)
[![Build Status](https://travis-ci.org/cerner/terra-core.svg?branch=master)](https://travis-ci.org/cerner/terra-core)

The terra-time-input component is a controlled input component for entering time. It is a controlled component because it manages the state of the value in the input. Because this is a controlled input component, it cannot accept the defaultValue prop as it always uses the value prop. React does not allow having both the defaultValue and value props.

The currently supported time format is the 24-hour format (hh:mm). The time input enforces the entry that masks to the format. The hour input only accepts values between 00 and 23 and the minute input only accepts values between 00 and 59. For example, a time of 25:65 cannot be entered. A 0 will automatically be prepended to the hour if the entered hour is greater than 2. Likewise, a 0 will automatically be prepended to the minute if the entered minute is greater than 5.

- [Getting Started](#getting-started)
- [Documentation](https://github.com/cerner/terra-core/tree/master/packages/terra-time-input/docs)
- [LICENSE](#license)

## Getting Started

- Install from [npmjs](https://www.npmjs.com): `npm install terra-time-input`

## LICENSE

Copyright 2017 Cerner Innovation, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


text:
/*
 * Do not modify this file. This file is generated from the config-2014-11-12.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

using Amazon.Runtime;
using Amazon.Runtime.Internal;

namespace Amazon.ConfigService.Model
{
    /// <summary>
    /// Container for the parameters to the DescribeConfigRuleEvaluationStatus operation.
    /// Returns status information for each of your AWS managed Config rules. The status includes
    /// information such as the last time AWS Config invoked the rule, the last time AWS Config
    /// failed to invoke the rule, and the related error for the last failure.
    /// </summary>
    public partial class DescribeConfigRuleEvaluationStatusRequest : AmazonConfigServiceRequest
    {
        private List<string> _configRuleNames = new List<string>();

        /// <summary>
        /// Gets and sets the property ConfigRuleNames.
        /// <para>
        /// The name of the AWS managed Config rules for which you want status information. If
        /// you do not specify any names, AWS Config returns status information for all AWS managed
        /// Config rules that you use.
        /// </para>
        /// </summary>
        public List<string> ConfigRuleNames
        {
            get { return this._configRuleNames; }
            set { this._configRuleNames = value; }
        }

        // Check to see if ConfigRuleNames property is set
        internal bool IsSetConfigRuleNames()
        {
            return this._configRuleNames != null && this._configRuleNames.Count > 0;
        }

    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace po = boost::program_options;
namespace bf = boost::filesystem;
using namespace v4r;

int main(int argc, const char * argv[]) {
    typedef pcl::PointXYZRGB PointT;
    std::string test_dir, out_dir, view_prefix = "cloud_", obj_indices_prefix = "object_indices_", pose_prefix = "pose_";
    float chop_z = std::numeric_limits<float>::max();
    bool visualize=false, use_object_mask = false, use_pose_file = false, debug = false;

    google::InitGoogleLogging(argv[0]);

    NMBasedCloudIntegration<PointT>::Parameter nm_int_param;
    nm_int_param.min_points_per_voxel_ = 1;
    nm_int_param.octree_resolution_ = 0.002f;

    NguyenNoiseModel<PointT>::Parameter nm_param;

    int normal_method = 2;

    po::options_description desc("Noise model based cloud integration\n======================================\n**Allowed options");
    desc.add_options()
            ("help,h", "produce help message")
            ("input_dir,i", po::value<std::string>(&test_dir)->required(), "directory containing point clouds")
            ("out_dir,o", po::value<std::string>(&out_dir), "output directory where the registered cloud will be stored. If not set, nothing will be written to distk")
            ("view_prefix", po::value<std::string>(&view_prefix)->default_value(view_prefix), "view filename prefix for each point cloud (used when using object mask)")
            ("obj_indices_prefix", po::value<std::string>(&obj_indices_prefix)->default_value(obj_indices_prefix), "filename prefix for each object mask file(used when using object mask)")
            ("pose_prefix", po::value<std::string>(&pose_prefix)->default_value(pose_prefix), "filename prefix for each camera pose (used when using use_pose_file)")
            ("resolution,r", po::value<float>(&nm_int_param.octree_resolution_)->default_value(nm_int_param.octree_resolution_), "")
            ("min_points_per_voxel", po::value<int>(&nm_int_param.min_points_per_voxel_)->default_value(nm_int_param.min_points_per_voxel_), "")
//            ("threshold_explained", po::value<float>(&nm_int_param.threshold_explained_)->default_value(nm_int_param.threshold_explained_), "")
            ("use_depth_edges", po::value<bool>(&nm_param.use_depth_edges_)->default_value(nm_param.use_depth_edges_), "")
            ("edge_radius", po::value<int>(&nm_param.edge_radius_)->default_value(nm_param.edge_radius_), "")
            ("focal_length,f", po::value<float>(&nm_param.focal_length_)->default_value(nm_param.focal_length_), "")
            ("normal_method,n", po::value<int>(&normal_method)->default_value(normal_method), "method used for normal computation")
            ("chop_z,z", po::value<float>(&chop_z)->default_value(chop_z), "cut of distance in m ")
            ("visualize,v", po::bool_switch(&visualize), "turn visualization on")
            ("use_object_mask,m", po::bool_switch(&use_object_mask), "reads mask file and only extracts those indices (only if file exists)")
            ("use_pose_file,p", po::bool_switch(&use_pose_file), "reads pose from seperate pose file instead of extracting it directly from .pcd file (only if file exists)")
            ("debug,d", po::bool_switch(&debug), "saves debug information (e.g. point properties) if output dir is set")
      ;
    po::variables_map vm;
    po::store(po::parse_command_line(argc, argv, desc), vm);
    if (vm.count("help"))
    {
        std::cout << desc << std::endl;
        return false;
    }

    try
    { po::notify(vm); }
    catch(std::exception& e)
    {
        std::cerr << "Error: " << e.what() << std::endl << std::endl << desc << std::endl;
        return false;
    }

    nm_int_param.edge_radius_px_ = nm_param.edge_radius_;
    std::vector< std::string> folder_names  = io::getFoldersInDirectory( test_dir );

    if( folder_names.empty() )
        folder_names.push_back("");

    int vp1, vp2;
    boost::shared_ptr<pcl::visualization::PCLVisualizer> vis;

    for (const std::string &sub_folder : folder_names)
    {
        const std::string test_seq = test_dir + "/" + sub_folder;
        std::vector< std::string > views = io::getFilesInDirectory(test_seq, ".*.pcd", false);

        pcl::PointCloud<PointT>::Ptr big_cloud_unfiltered (new pcl::PointCloud<PointT>);
        std::vector< pcl::PointCloud<PointT>::Ptr > clouds (views.size());
        std::vector< pcl::PointCloud<pcl::Normal>::Ptr > normals (views.size());
        std::vector<std::vector<std::vector<float> > > pt_properties (views.size());
        std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > camera_transforms (views.size());
        std::vector<std::vector<int> > obj_indices (views.size());

        for (size_t v_id=0; v_id<views.size(); v_id++)
        {
            std::stringstream txt;
            txt << "processing view " << v_id;
            pcl::ScopeTime t(txt.str().c_str());
            clouds[v_id].reset ( new pcl::PointCloud<PointT>);
            normals[v_id].reset ( new pcl::PointCloud<pcl::Normal>);

            pcl::io::loadPCDFile(test_seq + "/" + views[ v_id ], *clouds[v_id]);

            std::string obj_fn (views[v_id]);
            boost::replace_first (obj_fn, view_prefix, obj_indices_prefix);
            boost::replace_last (obj_fn, ".pcd", ".txt");

            if(use_object_mask)
            {
                bf::path object_indices_fn = test_seq;
                object_indices_fn /= obj_fn;
                if( io::existsFile( object_indices_fn.string() ) )
                {
                    ifstream f((test_seq+"/"+obj_fn).c_str());
                    int idx;
                    while (f >> idx)
                        obj_indices[v_id].push_back(idx);
                    f.close();
                }
                else
                    std::cerr << "Parameter use_object_mask is set but object indices file " <<
                                 object_indices_fn.string() << " not found! " << std::endl;
            }

            std::string pose_fn (views[v_id]);
            boost::replace_first (pose_fn, view_prefix, pose_prefix);
            boost::replace_last (pose_fn, ".pcd", ".txt");

            if(io::existsFile(test_seq + "/" + pose_fn) && use_pose_file)
                camera_transforms[v_id] = io::readMatrixFromFile(test_seq + "/" + pose_fn);
            else
                camera_transforms[v_id] = RotTrans2Mat4f(clouds[v_id]->sensor_orientation_, clouds[v_id]->sensor_origin_);

            // reset view point otherwise pcl visualization is potentially messed up
            clouds[v_id]->sensor_orientation_ = Eigen::Quaternionf::Identity();
            clouds[v_id]->sensor_origin_ = Eigen::Vector4f::Zero();

            pcl::PassThrough<PointT> pass;
            pass.setInputCloud (clouds[v_id]);
            pass.setFilterFieldName ("z");
            pass.setFilterLimits (0.f, chop_z);
            pass.setKeepOrganized(true);
            pass.filter (*clouds[v_id]);

            {
                pcl::ScopeTime tt("Computing normals");
                computeNormals<PointT>( clouds[v_id], normals[v_id], normal_method);
            }

            {
                pcl::ScopeTime tt("Computing noise model parameter for cloud");
                NguyenNoiseModel<PointT> nm (nm_param);
                nm.setInputCloud(clouds[v_id]);
                nm.setInputNormals(normals[v_id]);
                nm.compute();
                pt_properties[v_id] = nm.getPointProperties();

            }

            pcl::PointCloud<PointT> object_cloud, object_aligned;
            if( use_object_mask )
                pcl::copyPointCloud(*clouds[v_id], obj_indices[v_id], object_cloud);
            else
                pcl::copyPointCloud(*clouds[v_id], object_cloud);

            pcl::transformPointCloud( object_cloud, object_aligned, camera_transforms[v_id]);
            *big_cloud_unfiltered += object_aligned;
        }

        pcl::PointCloud<PointT>::Ptr octree_cloud(new pcl::PointCloud<PointT>);
        NMBasedCloudIntegration<PointT> nmIntegration (nm_int_param);
        nmIntegration.setInputClouds(clouds);
        nmIntegration.setPointProperties(pt_properties);
        nmIntegration.setTransformations(camera_transforms);
        nmIntegration.setInputNormals(normals);
        nmIntegration.setIndices(obj_indices);
        nmIntegration.compute(octree_cloud);
        std::vector< pcl::PointCloud<PointT>::Ptr > clouds_used;
        nmIntegration.getInputCloudsUsed(clouds_used);

        std::cout << "Size cloud unfiltered: " << big_cloud_unfiltered->points.size() << ", filtered: " << octree_cloud->points.size() << std::endl;

        if(vm.count("out_dir"))
        {
            const std::string out_path = out_dir + "/" + sub_folder;
            io::createDirIfNotExist(out_path);
            pcl::io::savePCDFileBinary(out_path + "/registered_cloud_filtered.pcd", *octree_cloud);
            pcl::io::savePCDFileBinary(out_path + "/registered_cloud_unfiltered.pcd", *big_cloud_unfiltered);

            for(size_t v_id=0; v_id<clouds_used.size(); v_id++)
            {
                if(debug)
                {
                    std::stringstream fn; fn << out_path << "/filtered_input_" << setfill('0') << setw(5) << v_id << ".pcd";
                    pcl::io::savePCDFileBinary(fn.str(), *clouds_used[v_id]);

                    fn.str(""); fn << out_path << "/distance_to_edge_px_" << setfill('0') << setw(5) << v_id << ".txt";
                    std::ofstream f (fn.str());
                    for (size_t pt_id = 0; pt_id < clouds_used[v_id]->points.size (); pt_id++) {
                        f << pt_properties[v_id][pt_id][2] << std::endl;

                        PointT &pt_tmp = clouds_used[v_id]->points[pt_id];
                        if( !pcl::isFinite( pt_tmp ) )  // set background color for nan points
                            pt_tmp.r = pt_tmp.g = pt_tmp.b = 255.f;
                    }
                    f.close();

                    fn.str(""); fn << out_path << "/filter_input_image" << setfill('0') << setw(5) << v_id << ".png";
                    PCLOpenCVConverter<PointT> pcl_opencv_converter;
                    pcl_opencv_converter.setInputCloud( clouds_used[v_id] );
                    cv::imwrite(fn.str(), pcl_opencv_converter.getRGBImage() );
                }
            }
        }

        if(visualize)
        {
            if(!vis)
            {
                vis.reset( new pcl::visualization::PCLVisualizer("registered cloud") );
                vis->createViewPort(0,0,0.5,1,vp1);
                    vis->createViewPort(0.5,0,1,1,vp2);
            }
            vis->removeAllPointClouds(vp1);
            vis->removeAllPointClouds(vp2);
            vis->addPointCloud(big_cloud_unfiltered, "unfiltered_cloud", vp1);
            vis->addPointCloud(octree_cloud, "filtered_cloud", vp2);
            vis->spin();
        }
    }
}


text:
#include "pch.h"
#include "MainPage.xaml.h"

using namespace ColorScrollWithValueConverter;

using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;

MainPage::MainPage()
{
    InitializeComponent();
}

void MainPage::OnSliderValueChanged(Object^ sender, RangeBaseValueChangedEventArgs^ args)
{
    unsigned char r = unsigned char(redSlider->Value);
    unsigned char g = unsigned char(greenSlider->Value);
    unsigned char b = unsigned char(blueSlider->Value);

    brushResult->Color = ColorHelper::FromArgb(255, r, g, b);
}


text:
2. `composer require hammer/config-manager:dev-master`
3. Enable the module: `bin/magento module:enable Hammer_ConfigManager`
4. `bin/magento setup:upgrade`

## How to use it?

Set the environment you are working on (example: local, dev, stage, preprod, prod) using the following command

`bin/magento hammer:environment:set [local, dev, stage, preprod, prod]`

This one create a new entry to env.php (app/etc/env.php)

`'hammer_environment' => 'local'`

that it's used by the Config Manager in order to know where to find the correct file with the information that correspond to each environment. Local configuration should be a config file in app/etc/custom_config/local/config.json

For other environments (dev, stage, preprod and prod) the file should be located in app/etc/custom_config/config.json.

All these files contains the data for the values that change in each environment.

For example:

```
{
  "Hammer_PaymentSetup::paypal/wpp/api_username": "direct-facilitator_api1.testmerchant.com",
  "Hammer_PaymentSetup::paypal/wpp/api_password": "FOCQ5TD5JRNH8TDG",
  "Hammer_PaymentSetup::paypal/wpp/api_signature": "AFcWxV21C7fe9m3bPOFHRpSSRl31AOsbMi0t56rdj7bZ7m9EkAVQQ1gr",
  "Hammer_PaymentSetup::paypal/wpp/sandbox_flag": 1
}
```

To use this we should inject the dependencies like

```
public function __construct(
    EncryptorInterface $encryptor,
    Config $config,
    \Hammer\ConfigManager\Helper\ConfigManager $configManager)
    {
    //var initialization
}
```

after that we will be able to get the value like so:

`$sandboxFlag = $this->configManager->getProperty('Hammer_PaymentSetup::paypal/wpp/sandbox_flag');`


text:
import { MonikerParams, Moniker } from 'vscode-languageserver-protocol';
import type { Feature, _Languages, ServerRequestHandler } from './server';
/**
 * Shape of the moniker feature
 *
 * @since 3.16.0
 */
export interface MonikerFeatureShape {
    moniker: {
        on(handler: ServerRequestHandler<MonikerParams, Moniker[] | null, Moniker[], void>): void;
    };
}
export declare const MonikerFeature: Feature<_Languages, MonikerFeatureShape>;


text:
'use strict';

// Utilities:
var _ = require('lodash');
var Promise = require('bluebird');

// Module:
var Core = require('../Core');

// Dependencies:
var camelcase = require('change-case').camel;
var pascalcase = require('change-case').pascal;
require('../Components/Notifier/NotifierService');
require('../Services/ValidationService');

var VariableNameValidator = function (
    $rootScope,
    notifierService,
    validationService
) {
    var ModelChangeEvent = 'VariableNameValidator:ModelChange';

    return {
        restrict: 'A',

        require: 'ngModel',

        scope: {
            variableValue: '=ngModel',
            allVariableNames: '&'
        },

        link: link
    };

    function link ($scope, element, attrs, ngModelController) {
        var destroy = $rootScope.$on(ModelChangeEvent, function (event, changing) {
            if (ngModelController !== changing) {
                ngModelController.$validate();
            }
        });

        $scope.$watch('variableValue', function () {
            $rootScope.$broadcast(ModelChangeEvent, ngModelController);
        });

        $scope.$on('$destroy', function () {
            destroy();
        });

        ngModelController.$validators.variableNameUnique = function (value) {
            var variableName = $scope.$parent.isClass ? pascalcase(value) : camelcase(value);
            var allVariableNames = $scope.allVariableNames();
            var result = !_.contains(allVariableNames, variableName);
            return result;
        };

        ngModelController.$validators.variableNameValid = function (value) {
            var variableName = $scope.$parent.isClass ? pascalcase(value) : camelcase(value);
            if (variableName.length === 0) {
                return false;
            }
            return validationService.validateVariableName(variableName);
        };
    }
};

Core.directive('variableName', VariableNameValidator);


text:
<?php

require '../autoloader.php';

$yaml = new Yampee_Yaml_Yaml();

// Parse
$array = $yaml->parse(file_get_contents('/path/to/file.yaml'));

// Dump
$yamlString = $yaml->dump($array);


text:
const QDateTime TransactionFilterProxy::MIN_DATE = QDateTime::fromTime_t(0);
// Last date that can be represented (far in the future)
const QDateTime TransactionFilterProxy::MAX_DATE = QDateTime::fromTime_t(0xFFFFFFFF);

TransactionFilterProxy::TransactionFilterProxy(QObject *parent)
        : QSortFilterProxyModel(parent),
          dateFrom(MIN_DATE),
          dateTo(MAX_DATE),
          addrPrefix(),
          typeFilter(ALL_TYPES),
          minAmount(0),
          limitRows(-1)
{
}

bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
	QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);

	int type = index.data(TransactionTableModel::TypeRole).toInt();
	QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
	QString address = index.data(TransactionTableModel::AddressRole).toString();
	QString label = index.data(TransactionTableModel::LabelRole).toString();
	qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());

	if (!(TYPE(type) & typeFilter))
		return false;
	if (datetime < dateFrom || datetime > dateTo)
		return false;
	if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive))
		return false;
	if (amount < minAmount)
		return false;

	return true;
}

void TransactionFilterProxy::setDateRange(const QDateTime &from, const QDateTime &to)
{
	this->dateFrom = from;
	this->dateTo = to;
	invalidateFilter();
}

void TransactionFilterProxy::setAddressPrefix(const QString &addrPrefix)
{
	this->addrPrefix = addrPrefix;
	invalidateFilter();
}

void TransactionFilterProxy::setTypeFilter(quint32 modes)
{
	this->typeFilter = modes;
	invalidateFilter();
}

void TransactionFilterProxy::setMinAmount(qint64 minimum)
{
	this->minAmount = minimum;
	invalidateFilter();
}

void TransactionFilterProxy::setLimit(int limit)
{
	this->limitRows = limit;
}

int TransactionFilterProxy::rowCount(const QModelIndex &parent) const
{
	if (limitRows != -1) {
		return std::min(QSortFilterProxyModel::rowCount(parent), limitRows);
	} else {
		return QSortFilterProxyModel::rowCount(parent);
	}
}


text:
    -- Love Frames - A GUI library for LOVE --
    -- Copyright (c) 2013 Kenny Shields --
--]]------------------------------------------------

-- skin path
local path = (...):sub(0, -6)
local dir = string.gsub(path, "%.", "/")

return function(loveframes)

-- skin table
local skin = {}

-- skin info (you always need this in a skin)
skin.name = "Snap"
skin.author = "unek.czarnawol.ga"
skin.version = "1.1"
skin.base = "Blue"

-- color definitions
local rgb = require(path .. ".color").rgb

local darkcolor = rgb(68/255, 68/255, 68/255)
local bodycolor = rgb(236/255, 232/255, 232/255)
local textcolor = rgb(32/255, 32/255, 32/255)

local redcolor   = rgb(232/255, 67/255, 57/255)
local whitecolor = rgb(1,1,1)

-- fonts
local smallfont     = love.graphics.newFont(dir .. "/font/Roboto-Light.ttf", 12)
local boldfont      = love.graphics.newFont(dir .. "/font/RobotoCondensed-Bold.ttf", 12)

loveframes.basicfontsmall = smallfont
loveframes.basicfont = smallfont

-- controls
skin.controls = {}

-- frame
skin.controls.frame_body_color                      = bodycolor
skin.controls.frame_top_color                       = darkcolor
skin.controls.frame_name_color                      = whitecolor
skin.controls.frame_name_font                       = boldfont
skin.controls.frame_shadow_right_color              = bodycolor:darken(5)
skin.controls.frame_shadow_bottom_color             = bodycolor:darken(15)
skin.controls.frame_shadow_size                     = 3 -- increase to 3-5 for a cool 3d effect

-- button
skin.controls.button_text_nohover_color             = textcolor
skin.controls.button_text_down_color                = textcolor
skin.controls.button_text_hover_color               = textcolor
skin.controls.button_text_nonclickable_color        = textcolor:lighten(15)
skin.controls.button_body_nohover_color             = bodycolor:darken(5)
skin.controls.button_body_down_color                = bodycolor:darken(10)
skin.controls.button_body_hover_color               = bodycolor:darken(3)
skin.controls.button_body_nonclickable_color        = bodycolor:lighten(10)
skin.controls.button_body_shadow_color              = bodycolor:darken(10)
skin.controls.button_text_font                      = smallfont

-- checkbox
skin.controls.checkbox_body_nohover_color           = bodycolor:darken(5)
skin.controls.checkbox_body_hover_color             = bodycolor:darken(3)
skin.controls.checkbox_body_shadow_color            = bodycolor:darken(10)
skin.controls.checkbox_check_color                  = darkcolor
skin.controls.checkbox_text_font                    = smallfont

-- radiobutton
skin.controls.radiobutton_body_color                = bodycolor:darken(5)
skin.controls.radiobutton_check_color               = darkcolor
skin.controls.radiobutton_inner_border_color        = bodycolor:darken(3)
skin.controls.radiobutton_text_font                 = smallfont

-- closebutton
skin.controls.closebutton_body_nohover_color        = redcolor
skin.controls.closebutton_body_down_color           = redcolor:darken(5)
skin.controls.closebutton_body_hover_color          = redcolor:lighten(5)

-- columnlist
skin.controls.columnlist_body_color                 = bodycolor:darken(5)

-- columlistarea
skin.controls.columnlistarea_body_color             = bodycolor

-- columnlistheader
skin.controls.columnlistheader_body_color           = darkcolor:lighten(15)
skin.controls.columnlistheader_text_color           = whitecolor
skin.controls.columnlistheader_text_font            = boldfont

-- columnlistrow
skin.controls.columnlistrow_body1_color             = whitecolor
skin.controls.columnlistrow_body2_color             = whitecolor:darken(5)
skin.controls.columnlistrow_body_selected_color     = darkcolor
skin.controls.columnlistrow_text_color              = darkcolor
skin.controls.columnlistrow_text_selected_color     = bodycolor

-- scrollbar
skin.controls.scrollbar_body_nohover_color          = darkcolor:lighten(15)
skin.controls.scrollbar_body_hover_color            = darkcolor:lighten(20)
skin.controls.scrollbar_body_down_color             = darkcolor:lighten(10)

-- slider
skin.controls.slider_body_color                     = bodycolor:darken(10)
skin.controls.slider_value_color                    = redcolor
skin.controls.slider_button_body_nohover_color      = whitecolor
skin.controls.slider_button_body_hover_color        = whitecolor
skin.controls.slider_button_body_down_color         = whitecolor:darken(3)
skin.controls.slider_button_body_nonclickable_color = bodycolor:lighten(5)

-- multichoice
skin.controls.multichoice_body_nohover_color        = bodycolor:darken(5)
skin.controls.multichoice_body_hover_color          = bodycolor:darken(3)
skin.controls.multichoice_body_shadow_color         = bodycolor:darken(10)
skin.controls.multichoice_text_color                = textcolor
skin.controls.multichoice_text_font                 = smallfont

-- multichoicelist
skin.controls.multichoicelist_body_color            = bodycolor:darken(5)

-- multichoicerow
skin.controls.multichoicerow_body_nohover_color     = bodycolor:darken(5)
skin.controls.multichoicerow_body_hover_color       = darkcolor
skin.controls.multichoicerow_text_nohover_color     = textcolor
skin.controls.multichoicerow_text_hover_color       = bodycolor
skin.controls.multichoicerow_text_font              = smallfont

-- textinput
skin.controls.textinput_body_color                  = whitecolor:darken(3)
skin.controls.textinput_indicator_color             = textcolor
skin.controls.textinput_text_normal_color           = textcolor
skin.controls.textinput_text_placeholder_color      = bodycolor:darken(20)
skin.controls.textinput_text_selected_color         = whitecolor
skin.controls.textinput_highlight_bar_color         = darkcolor

-- tabpanel
skin.controls.tabpanel_body_color                   = bodycolor

-- tabbutton
skin.controls.tab_text_color                        = textcolor
skin.controls.tab_body_color                        = bodycolor:darken(10)
skin.controls.tab_body_active_color                 = bodycolor
skin.controls.tab_text_font                         = smallfont

-- tooltip
skin.controls.tooltip_body_color                    = bodycolor:darken(10)

-- collapsiblecategory
skin.controls.collapsiblecategory_text_color        = textcolor

-- panel
skin.controls.panel_body_color                      = bodycolor

-- progressbar
skin.controls.progressbar_body_color                = bodycolor:darken(10)
skin.controls.progressbar_bar_color                 = redcolor
skin.controls.progressbar_text_color                = textcolor
skin.controls.progressbar_text_font                 = smallfont

-- linenumberspanel
skin.controls.linenumberspanel_text_color           = textcolor
skin.controls.linenumberspanel_body_color           = bodycolor

-- form
skin.controls.form_text_color                       = textcolor:lighten(10)
skin.controls.form_text_font                        = smallfont

-- menu
skin.controls.menu_body_color                       = bodycolor:darken(3)

-- menuoption
skin.controls.menuoption_body_hover_color           = bodycolor:darken(15)
skin.controls.menuoption_text_hover_color           = textcolor
skin.controls.menuoption_text_color                 = textcolor

function skin.OutlinedRectangle(x, y, width, height, ovt, ovb, ovl, ovr)
    -- borders are so 2012
end

function skin.RoundedRectangle(x, y, w, h, r)
   r = r or 15
   love.graphics.rectangle("fill", x, y+r, w, h-r*2)
   love.graphics.rectangle("fill", x+r, y, w-r*2, r)
   love.graphics.rectangle("fill", x+r, y+h-r, w-r*2, r)
   love.graphics.arc("fill", x+r, y+r, r, math.pi, math.pi * 1.5)
   love.graphics.arc("fill", x + w-r, y+r, r, -math.pi * 0.5, 0)
   love.graphics.arc("fill", x + w-r, y + h-r, r, 0, math.pi * 0.5)
   love.graphics.arc("fill", x+r, y + h-r, r, math.pi * 0.5, math.pi)
end
-- very shitty
function skin.Triangle(x, y, side, rot)
    if rot then
        love.graphics.polygon("fill", x, y, x - side, y + side, x + side, y + side)
    else
        love.graphics.polygon("fill", x - side, y, x + side, y, x, y + side)
    end
end

--[[---------------------------------------------------------
    - func: DrawFrame(object)
    - desc: draws the frame object
--]]---------------------------------------------------------
function skin.frame(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local name = object:GetName()
    local icon = object:GetIcon()
    local bodycolor = skin.controls.frame_body_color
    local topcolor = skin.controls.frame_top_color
    local namecolor = skin.controls.frame_name_color
    local font = skin.controls.frame_name_font
    local shadowrightcolor = skin.controls.frame_shadow_right_color
    local shadowbottomcolor = skin.controls.frame_shadow_bottom_color
    local shadowsize = skin.controls.frame_shadow_size

    -- frame body
    if shadowsize > 0 then
        love.graphics.setColor(topcolor)
        love.graphics.polygon("fill"
            , x + width, y
            , x + width + shadowsize, y + shadowsize
            , x + width + shadowsize, y + shadowsize + 25
            , x + width, y + shadowsize + 25)
        love.graphics.setColor(shadowrightcolor)
        love.graphics.polygon("fill"
            , x + width, y + 25
            , x + width + shadowsize, y + shadowsize + 25
            , x + width + shadowsize, y + height + shadowsize
            , x + width, y + height)

        love.graphics.setColor(shadowbottomcolor)
        love.graphics.polygon("fill"
            , x, y + height
            , x + shadowsize, y + height + shadowsize
            , x + width + shadowsize, y + height + shadowsize
            , x + width, y + height)
    end

    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)

    -- frame top bar
    love.graphics.setColor(topcolor)
    love.graphics.rectangle("fill", x, y, width, 25)

    -- frame name section
    love.graphics.setFont(font)

    if icon then
        local iconwidth = icon:getWidth()
        local iconheight = icon:getHeight()
        icon:setFilter("nearest", "nearest")
        love.graphics.setColor(1, 1, 1, 1)
        love.graphics.draw(icon, x + 5, y + 5)
        love.graphics.setColor(namecolor)
        love.graphics.print(name, x + iconwidth + 10, y + 4)
    else
        love.graphics.setColor(namecolor)
        love.graphics.print(name, x + 5, y + 4)
    end

end

function skin.numberboxbutton(object)

    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local hover = object:GetHover()
    local text = object:GetText()
    local down = object.down
    local enabled = object:GetEnabled()
    local clickable = object:GetClickable()
    local textdowncolor = skin.controls.button_text_down_color
    local texthovercolor = skin.controls.button_text_hover_color
    local textnohovercolor = skin.controls.button_text_nohover_color
    local textnonclickablecolor = skin.controls.button_text_nonclickable_color
    local bodydowncolor = skin.controls.button_body_down_color
    local bodyhovercolor = skin.controls.button_body_hover_color
    local bodynohovercolor = skin.controls.button_body_nohover_color
    local bodynonclickablecolor = skin.controls.button_body_nonclickable_color
    local bodyshadowcolor = skin.controls.button_body_shadow_color

    if not enabled or not clickable then
        love.graphics.setColor(bodynonclickablecolor)
    end

    if down then
        love.graphics.setColor(bodydowncolor)
    elseif hover then
        love.graphics.setColor(bodyhovercolor)
    else
        love.graphics.setColor(bodynohovercolor)
    end

    love.graphics.rectangle("fill", x, y, width, height)

    local arrowx = math.floor(x + width/2) + 1
    local arrowy = math.floor(y) + 4
    if text == "+" then
        love.graphics.setColor(bodyshadowcolor)
        skin.Triangle(arrowx + 1, arrowy + 1, 4, true)
        love.graphics.setColor(1, 1, 1, 1)
        skin.Triangle(arrowx, arrowy, 4, true)
    elseif text == "-" then
        love.graphics.setColor(bodyshadowcolor)
        skin.Triangle(arrowx + 1, arrowy + 1, 4)
        love.graphics.setColor(1, 1, 1, 1)
        skin.Triangle(arrowx, arrowy, 4)
    end
end

--[[---------------------------------------------------------
    - func: DrawButton(object)
    - desc: draws the button object
--]]---------------------------------------------------------
function skin.button(object)

    local skin = object:GetSkin()
    local parent = object:GetParent()
    if parent.type == "numberbox" then
        skin.numberboxbutton(object)
        return
    end

    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local hover = object:GetHover()
    local text = object:GetText()
    local font = skin.controls.button_text_font
    local twidth = font:getWidth(object.text)
    local theight = font:getHeight(object.text)
    local down = object.down
    local enabled = object:GetEnabled()
    local clickable = object:GetClickable()
    local textdowncolor = skin.controls.button_text_down_color
    local texthovercolor = skin.controls.button_text_hover_color
    local textnohovercolor = skin.controls.button_text_nohover_color
    local textnonclickablecolor = skin.controls.button_text_nonclickable_color
    local bodydowncolor = skin.controls.button_body_down_color
    local bodyhovercolor = skin.controls.button_body_hover_color
    local bodynohovercolor = skin.controls.button_body_nohover_color
    local bodynonclickablecolor = skin.controls.button_body_nonclickable_color
    local bodyshadowcolor = skin.controls.button_body_shadow_color
    local radius = 3

    if not enabled or not clickable then
        -- button body
        love.graphics.setColor(bodynonclickablecolor)
        love.graphics.rectangle("fill", x, y, width, height)
        -- button text
        love.graphics.setFont(font)
        love.graphics.setColor(textnonclickablecolor)
        love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
        return
    end

    if down then
        -- button body
        love.graphics.setColor(bodyshadowcolor)
        skin.RoundedRectangle(x, y + radius, width, height, radius)
        love.graphics.setColor(bodydowncolor)
        skin.RoundedRectangle(x, y + radius, width, height - radius, radius)
        -- button text
        love.graphics.setFont(font)
        love.graphics.setColor(textdowncolor)
        love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2 + radius)
    elseif hover then
        -- button body
        love.graphics.setColor(bodyshadowcolor)
        skin.RoundedRectangle(x, y + radius, width, height, radius)
        love.graphics.setColor(bodyhovercolor)
        skin.RoundedRectangle(x, y, width, height, radius)
        -- button text
        love.graphics.setFont(font)
        love.graphics.setColor(texthovercolor)
        love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
    else
        -- button body
        love.graphics.setColor(bodyshadowcolor)
        skin.RoundedRectangle(x, y + radius, width, height, radius)
        love.graphics.setColor(bodynohovercolor)
        skin.RoundedRectangle(x, y, width, height, radius)
        -- button text
        love.graphics.setFont(font)
        love.graphics.setColor(textnohovercolor)
        love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
    end

end

--[[---------------------------------------------------------
    - func: DrawCloseButton(object)
    - desc: draws the close button object
--]]---------------------------------------------------------
function skin.closebutton(object)

    local skin = object:GetSkin()
    local parent = object.parent
    local parentwidth = parent:GetWidth()
    object.y = parent.y
    local x = object:GetX()
    local y = object:GetY()
    local hover = object:GetHover()
    local down = object.down
    local bodydowncolor = skin.controls.closebutton_body_down_color
    local bodyhovercolor = skin.controls.closebutton_body_hover_color
    local bodynohovercolor = skin.controls.closebutton_body_nohover_color

    if down then
        -- button body
        love.graphics.setColor(bodydowncolor)
        love.graphics.rectangle("fill", x, y, 15, 5)
    elseif hover then
        -- button body
        love.graphics.setColor(bodyhovercolor)
        love.graphics.rectangle("fill", x, y, 15, 5)
    else
        -- button body
        love.graphics.setColor(bodynohovercolor)
        love.graphics.rectangle("fill", x, y, 15, 5)
    end

    object:SetPos(parentwidth - 20, 4)
    object:SetSize(16, 16)

end

--[[---------------------------------------------------------
    - func: skin.DrawCheckBox(object)
    - desc: draws the check box object
--]]---------------------------------------------------------
function skin.checkbox(object)

    local skin = object:GetSkin()
    local x = object:GetX() + 2
    local y = object:GetY() + 1
    local width = object:GetBoxWidth() - 2
    local height = object:GetBoxHeight() - 3
    local checked = object:GetChecked()
    local bodynohovercolor = skin.controls.checkbox_body_nohover_color
    local bodyhovercolor = skin.controls.checkbox_body_hover_color
    local checkcolor = skin.controls.checkbox_check_color
    local shadowcolor = skin.controls.checkbox_body_shadow_color
    local radius = 2

    love.graphics.setColor(shadowcolor)
    skin.RoundedRectangle(x, y, width, height + radius, radius)
    if hover then
        love.graphics.setColor(bodyhovercolor)
    else
        love.graphics.setColor(bodynohovercolor)
    end
    skin.RoundedRectangle(x, y, width, height, 3)

    if checked then
        local image = skin.images["check.png"]
        local scalex = width / image:getWidth()
        local scaley = height / image:getHeight()
        love.graphics.setColor(checkcolor)
        love.graphics.draw(image, x, y, 0, scalex, scaley)
    end

end

--[[---------------------------------------------------------
    - func: skin.DrawColumnList(object)
    - desc: draws the column list object
--]]---------------------------------------------------------
function skin.columnlist(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local bodycolor = skin.controls.columnlist_body_color

    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)

end

--[[---------------------------------------------------------
    - func: skin.DrawColumnListHeader(object)
    - desc: draws the column list header object
--]]---------------------------------------------------------
function skin.columnlistheader(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local name = object:GetName()
    local down = object.down
    local font = skin.controls.columnlistheader_text_font
    local twidth = font:getWidth(object.name)
    local theight = font:getHeight(object.name) + 2
    local bodycolor = skin.controls.columnlistheader_body_color
    local textcolor = skin.controls.columnlistheader_text_color

    -- header body
    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)
    -- header name
    love.graphics.setFont(font)
    love.graphics.setColor(textcolor)
    love.graphics.print(name, x + width/2 - twidth/2, y + height/2 - theight/2)

end

--[[---------------------------------------------------------
    - func: skin.DrawColumnListArea(object)
    - desc: draws the column list area object
--]]---------------------------------------------------------
function skin.columnlistarea(object)

end

--[[---------------------------------------------------------
    - func: skin.DrawOverColumnListArea(object)
    - desc: draws over the column list area object
--]]---------------------------------------------------------
function skin.columnlistarea_over(object)

end

--[[---------------------------------------------------------
    - func: skin.DrawColumnListRow(object)
    - desc: draws the column list row object
--]]---------------------------------------------------------
function skin.columnlistrow(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local colorindex = object:GetColorIndex()
    local font = object:GetFont()
    local columndata = object:GetColumnData()
    local textx = object:GetTextX()
    local texty = object:GetTextY()
    local parent = object:GetParent()
    local cwidth, cheight = parent:GetParent():GetColumnSize()
    local theight = font:getHeight()
    local hover = object:GetHover()
    local selected = object:GetSelected()
    local body1color = skin.controls.columnlistrow_body1_color
    local body2color = skin.controls.columnlistrow_body2_color
    local bodyselectedcolor = skin.controls.columnlistrow_body_selected_color
    local textcolor = skin.controls.columnlistrow_text_color
    local textselectedcolor = skin.controls.columnlistrow_text_selected_color

    object:SetTextPos(5, height/2 - theight/2)

    if selected then
        love.graphics.setColor(bodyselectedcolor)
    elseif colorindex == 1 then
        love.graphics.setColor(body1color)
    else
        love.graphics.setColor(body2color)
    end

    love.graphics.rectangle("fill", x, y, width, height)

    for k, v in ipairs(columndata) do
        love.graphics.setFont(font)
        if selected then
            love.graphics.setColor(textselectedcolor)
        else
            love.graphics.setColor(textcolor)
        end
        local text = v
        love.graphics.print(text, x + textx, y + texty)
        x = x + cwidth
    end

end

--[[---------------------------------------------------------
    - func: DrawScrollArea(object)
    - desc: draws the scroll area object
--]]---------------------------------------------------------
function skin.scrollarea(object)

end

--[[---------------------------------------------------------
    - func: DrawScrollBar(object)
    - desc: draws the scroll bar object
--]]---------------------------------------------------------
function skin.scrollbar(object)

    local skin = object:GetSkin()
    local x = object:GetX() + 4
    local y = object:GetY() + 4
    local width = object:GetWidth() - 8
    local height = object:GetHeight() - 8
    local dragging = object:IsDragging()
    local hover = object:GetHover()
    local bodydowncolor = skin.controls.scrollbar_body_down_color
    local bodyhovercolor = skin.controls.scrollbar_body_hover_color
    local bodynohovercolor = skin.controls.scrollbar_body_nohover_color

    if dragging then
        love.graphics.setColor(bodydowncolor)
    elseif hover then
        love.graphics.setColor(bodyhovercolor)
    else
        love.graphics.setColor(bodynohovercolor)
    end

    love.graphics.rectangle("fill", x, y, width, height)

end

--[[---------------------------------------------------------
    - func: DrawScrollBody(object)
    - desc: draws the scroll body object
--]]---------------------------------------------------------
function skin.scrollbody(object)

end

--[[---------------------------------------------------------
    - func: DrawScrollButton(object)
    - desc: draws the scroll button object
--]]---------------------------------------------------------
function skin.scrollbutton(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local hover = object:GetHover()
    local down = object.down
    local bodycolor = skin.controls.scrollbody_body_color
    local bodydowncolor = skin.controls.scrollbar_body_down_color
    local bodyhovercolor = skin.controls.scrollbar_body_hover_color
    local bodynohovercolor = skin.controls.scrollbar_body_nohover_color

    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)

    if dragging then
        love.graphics.setColor(bodydowncolor)
    elseif hover then
        love.graphics.setColor(bodyhovercolor)
    else
        love.graphics.setColor(bodynohovercolor)
    end

    love.graphics.rectangle("fill", x+4, y+4, width-8, height-8)

end

--[[---------------------------------------------------------
    - func: skin.DrawSlider(object)
    - desc: draws the slider object
--]]---------------------------------------------------------
function skin.slider(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local slidtype = object:GetSlideType()
    local bodycolor = skin.controls.slider_body_color
    local valuecolor = skin.controls.slider_value_color
    local value = object:GetValue()
    local button = object.internals[1]
    local buttonx = button:GetX()
    local buttony = button:GetY()
    local buttonradius = math.min(button:GetWidth(), button:GetHeight()) / 2

    if slidtype == "horizontal" then
        love.graphics.setColor(bodycolor)
        skin.RoundedRectangle(x, y + height/2 - 2, width, 4, 2)
        love.graphics.setColor(valuecolor)
        skin.RoundedRectangle(x, y + height/2 - 2, buttonx - x + buttonradius, 4, 2)
    elseif slidtype == "vertical" then
        love.graphics.setColor(bodycolor)
        skin.RoundedRectangle(x + width/2 - 2, y, 4, height, 2)
        love.graphics.setColor(valuecolor)
        skin.RoundedRectangle(x + width/2 - 2, buttony, 4, height - buttony + y, 2)
    end

end

--[[---------------------------------------------------------
    - func: skin.DrawSliderButton(object)
    - desc: draws the slider button object
--]]---------------------------------------------------------
function skin.sliderbutton(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local hover = object:GetHover()
    local down = object.down
    local parent = object:GetParent()
    local enabled = parent:GetEnabled()
    local bodydowncolor = skin.controls.slider_button_body_down_color
    local bodyhovercolor = skin.controls.slider_button_body_hover_color
    local bodynohovercolor = skin.controls.slider_button_body_nohover_color
    local bodynonclickablecolor = skin.controls.slider_button_body_nonclickable_color
    local radius = math.min(width, height) / 2

    if not enabled then
        -- button body
        love.graphics.setColor(bodynonclickablecolor)
        love.graphics.circle("fill", x + width / 2, y + height / 2, radius)
        return
    end

    if down then
        -- button body
        love.graphics.setColor(bodydowncolor)
        love.graphics.circle("fill", x + width / 2, y + height / 2, radius)
    elseif hover then
        -- button body
        love.graphics.setColor(bodyhovercolor)
        love.graphics.circle("fill", x + width / 2, y + height / 2, radius)
    else
        -- button body
        love.graphics.setColor(bodynohovercolor)
        love.graphics.circle("fill", x + width / 2, y + height / 2, radius)
    end

end

--[[---------------------------------------------------------
    - func: DrawMultiChoice(object)
    - desc: draws the multi choice object
--]]---------------------------------------------------------
function skin.multichoice(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local text = object:GetText()
    local choice = object:GetChoice()
    local hover = object:GetHover()
    local font = skin.controls.multichoice_text_font
    local theight = font:getHeight()
    local bodynohovercolor = skin.controls.multichoice_body_nohover_color
    local bodyhovercolor = skin.controls.multichoice_body_hover_color
    local textcolor = skin.controls.multichoice_text_color
    local shadowcolor = skin.controls.multichoice_body_shadow_color
    local radius = 3

    love.graphics.setColor(shadowcolor)
    skin.RoundedRectangle(x, y, width, height + radius, radius)
    if hover then
        love.graphics.setColor(bodyhovercolor)
    else
        love.graphics.setColor(bodynohovercolor)
    end
    skin.RoundedRectangle(x, y, width, height, radius)

    love.graphics.setColor(textcolor)
    love.graphics.setFont(font)

    love.graphics.print(choice == "" and text or choice, x + 5, y + height/2 - theight/2)

    love.graphics.setColor(shadowcolor)
    skin.Triangle(x + width - 14, y + 11, 5)
    love.graphics.setColor(1, 1, 1)
    skin.Triangle(x + width - 15, y + 10, 5)

end

--[[---------------------------------------------------------
    - func: DrawMultiChoiceList(object)
    - desc: draws the multi choice list object
--]]---------------------------------------------------------
function skin.multichoicelist(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local bodycolor = skin.controls.multichoicelist_body_color

    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)

end

--[[---------------------------------------------------------
    - func: DrawOverMultiChoiceList(object)
    - desc: draws over the multi choice list object
--]]---------------------------------------------------------
function skin.multichoicelist_over(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()

end

--[[---------------------------------------------------------
    - func: DrawMultiChoiceRow(object)
    - desc: draws the multi choice row object
--]]---------------------------------------------------------
function skin.multichoicerow(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local text = object:GetText()
    local font = skin.controls.multichoicerow_text_font
    local bodyhovecolor = skin.controls.multichoicerow_body_hover_color
    local texthovercolor = skin.controls.multichoicerow_text_hover_color
    local bodynohovercolor = skin.controls.multichoicerow_body_nohover_color
    local textnohovercolor = skin.controls.multichoicerow_text_nohover_color

    love.graphics.setFont(font)

    if object.hover then
        love.graphics.setColor(bodyhovecolor)
        love.graphics.rectangle("fill", x, y, width, height)
        love.graphics.setColor(texthovercolor)
        love.graphics.print(text, x + 5, y + 5)
    else
        love.graphics.setColor(bodynohovercolor)
        love.graphics.rectangle("fill", x, y, width, height)
        love.graphics.setColor(textnohovercolor)
        love.graphics.print(text, x + 5, y + 5)
    end

end

--[[---------------------------------------------------------
    - func: DrawTabButton(object)
    - desc: draws the tab button object
--]]---------------------------------------------------------
function skin.tabbutton(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local hover = object:GetHover()
    local text = object:GetText()
    local image = object:GetImage()
    local tabnumber = object:GetTabNumber()
    local parent = object:GetParent()
    local ptabnumber = parent:GetTabNumber()
    local font = skin.controls.tab_text_font
    local twidth = font:getWidth(object.text)
    local theight = font:getHeight(object.text)
    local imagewidth = 0
    local imageheight = 0
    local bodycolor = skin.controls.tab_body_color
    local bodyactivecolor = skin.controls.tab_body_active_color
    local textcolor = skin.controls.tab_text_color
    local width  = object:GetWidth()
    local height = object:GetHeight()

    if image then
        image:setFilter("nearest", "nearest")
        imagewidth = image:getWidth()
        imageheight = image:getHeight()
        object.width = imagewidth + 15 + twidth
        if imageheight > theight then
            parent:SetTabHeight(imageheight + 5)
            object.height = imageheight + 5
        else
            object.height = parent.tabheight
        end
    else
        object.width = 10 + twidth
        object.height = parent.tabheight
    end

    if tabnumber == ptabnumber then
        -- button body
        love.graphics.setColor(bodyactivecolor)
        love.graphics.rectangle("fill", x, y, width, height + 3)
        if image then
            -- button image
            love.graphics.setColor(1, 1, 1, 1)
            love.graphics.draw(image, x + 5, y + height/2 - imageheight/2)
            -- button text
            love.graphics.setFont(font)
            love.graphics.setColor(textcolor)
            love.graphics.print(text, x + imagewidth + 10, y + height/2 - theight/2)
        else
            -- button text
            love.graphics.setFont(font)
            love.graphics.setColor(textcolor)
            love.graphics.print(text, x + 5, y + height/2 - theight/2)
        end
    else
        -- button body
        love.graphics.setColor(bodycolor)
        love.graphics.rectangle("fill", x, y, width, height)
        if image then
            -- button image
            love.graphics.setColor(1, 1, 1, 150/255)
            love.graphics.draw(image, x + 5, y + height/2 - imageheight/2)
            -- button text
            love.graphics.setFont(font)
            love.graphics.setColor(textcolor)
            love.graphics.print(text, x + imagewidth + 10, y + height/2 - theight/2)
        else
            -- button text
            love.graphics.setFont(font)
            love.graphics.setColor(textcolor)
            love.graphics.print(text, x + 5, y + height/2 - theight/2)
        end
    end

end

--[[---------------------------------------------------------
    - func: DrawProgressBar(object)
    - desc: draws the progress bar object
--]]---------------------------------------------------------
function skin.progressbar(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local value = object:GetValue()
    local max = object:GetMax()
    local barwidth = object:GetBarWidth()
    local font = skin.controls.progressbar_text_font
    local text = value .. "/" ..max
    local twidth = font:getWidth(text)
    local theight = font:getHeight()
    local bodycolor = skin.controls.progressbar_body_color
    local barcolor = skin.controls.progressbar_bar_color
    local textcolor = skin.controls.progressbar_text_color

    -- progress bar body
    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)
    love.graphics.setColor(barcolor)
    love.graphics.rectangle("fill", x + 2, y + 2, math.max(0, barwidth - 4), height - 4)
    love.graphics.setFont(font)
    love.graphics.setColor(textcolor)
    love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)

end

--[[---------------------------------------------------------
    - func: skin.DrawCollapsibleCategory(object)
    - desc: draws the collapsible category object
--]]---------------------------------------------------------
function skin.collapsiblecategory(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local text = object:GetText()
    local open = object:GetOpen()
    local textcolor = skin.controls.collapsiblecategory_text_color
    local font = smallfont

    if open then
        love.graphics.setColor(0, 0, 0, 30/255)
        skin.Triangle(x + 10 + 1, y + 10 + 1, 5)
        love.graphics.setColor(1, 1, 1, 1)
        skin.Triangle(x + 10, y + 10, 5)
    else
        love.graphics.setColor(0, 0, 0, 30/255)
        skin.Triangle(x + 10 + 1, y + 10 + 1, 5, true)
        love.graphics.setColor(1, 1, 1, 1)
        skin.Triangle(x + 10, y + 10, 5, true)
    end

    love.graphics.setFont(font)
    love.graphics.setColor(textcolor)
    love.graphics.print(text, x + 23, y + 3)

end

--[[---------------------------------------------------------
    - func: skin.DrawForm(object)
    - desc: draws the form object
--]]---------------------------------------------------------
function skin.form(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local topmargin = object.topmargin
    local name = object.name
    local font = skin.controls.form_text_font
    local textcolor = skin.controls.form_text_color

    love.graphics.setFont(font)
    love.graphics.setColor(textcolor)
    love.graphics.print(name, x + 7, y)

end

--[[---------------------------------------------------------
    - func: skin.DrawMenu(object)
    - desc: draws the menu object
--]]---------------------------------------------------------
function skin.menu(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local bodycolor = skin.controls.menu_body_color

    love.graphics.setColor(bodycolor)
    love.graphics.rectangle("fill", x, y, width, height)

end

--[[---------------------------------------------------------
    - func: skin.DrawMenuOption(object)
    - desc: draws the menuoption object
--]]---------------------------------------------------------
function skin.menuoption(object)

    local skin = object:GetSkin()
    local x = object:GetX()
    local y = object:GetY()
    local width = object:GetWidth()
    local height = object:GetHeight()
    local hover = object:GetHover()
    local text = object:GetText()
    local icon = object:GetIcon()
    local option_type = object.option_type
    local body_hover_color = skin.controls.menuoption_body_hover_color
    local text_hover_color = skin.controls.menuoption_text_hover_color
    local text_color = skin.controls.menuoption_text_color
    local twidth = smallfont:getWidth(text)

    if option_type == "divider" then
        love.graphics.setColor(body_hover_color)
        love.graphics.rectangle("fill", x + 4, y + 2, width - 8, 1)
        object.contentheight = 10
    else
        love.graphics.setFont(smallfont)
        if hover then
            love.graphics.setColor(body_hover_color)
            love.graphics.rectangle("fill", x, y, width, height)
            love.graphics.setColor(text_hover_color)
            love.graphics.print(text, x + 26, y + 5)
        else
            love.graphics.setColor(text_color)
            love.graphics.print(text, x + 26, y + 5)
        end
        if icon then
            love.graphics.setColor(1, 1, 1, 1)
            love.graphics.draw(icon, x + 5, y + 5)
        end
        object.contentwidth = twidth + 31
        object.contentheight = 25
    end

end

-- register the skin
loveframes.RegisterSkin(skin)

end


text:
import * as core from '../core';

/**
 * The ParticleContainer class is a really fast version of the Container built solely for speed,
 * so use when you need a lot of sprites or particles. The tradeoff of the ParticleContainer is that advanced
 * functionality will not work. ParticleContainer implements only the basic object transform (position, scale, rotation).
 * Any other functionality like tinting, masking, etc will not work on sprites in this batch.
 *
 * It's extremely easy to use :
 *
 * ```js
 * let container = new ParticleContainer();
 *
 * for (let i = 0; i < 100; ++i)
 * {
 *     let sprite = new PIXI.Sprite.fromImage("myImage.png");
 *     container.addChild(sprite);
 * }
 * ```
 *
 * And here you have a hundred sprites that will be renderer at the speed of light.
 *
 * @class
 * @extends PIXI.Container
 * @memberof PIXI.particles
 */
export default class ParticleContainer extends core.Container
{
    /**
     * @param {number} [maxSize=15000] - The maximum number of particles that can be renderer by the container.
     * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied.
     * @param {boolean} [properties.scale=false] - When true, scale be uploaded and applied.
     * @param {boolean} [properties.position=true] - When true, position be uploaded and applied.
     * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied.
     * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied.
     * @param {boolean} [properties.alpha=false] - When true, alpha be uploaded and applied.
     * @param {number} [batchSize=15000] - Number of particles per batch.
     */
    constructor(maxSize = 1500, properties, batchSize = 16384)
    {
        super();

        // Making sure the batch size is valid
        // 65535 is max vertex index in the index buffer (see ParticleRenderer)
        // so max number of particles is 65536 / 4 = 16384
        const maxBatchSize = 16384;

        if (batchSize > maxBatchSize)
        {
            batchSize = maxBatchSize;
        }

        if (batchSize > maxSize)
        {
            batchSize = maxSize;
        }

        /**
         * Set properties to be dynamic (true) / static (false)
         *
         * @member {boolean[]}
         * @private
         */
        this._properties = [false, true, false, false, false];

        /**
         * @member {number}
         * @private
         */
        this._maxSize = maxSize;

        /**
         * @member {number}
         * @private
         */
        this._batchSize = batchSize;

        /**
         * @member {WebGLBuffer}
         * @private
         */
        this._glBuffers = [];

        /**
         * @member {number}
         * @private
         */
        this._bufferToUpdate = 0;

        /**
         * @member {boolean}
         *
         */
        this.interactiveChildren = false;

        /**
         * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL`
         * to reset the blend mode.
         *
         * @member {number}
         * @default PIXI.BLEND_MODES.NORMAL
         * @see PIXI.BLEND_MODES
         */
        this.blendMode = core.BLEND_MODES.NORMAL;

        /**
         * Used for canvas renderering. If true then the elements will be positioned at the
         * nearest pixel. This provides a nice speed boost.
         *
         * @member {boolean}
         * @default true;
         */
        this.roundPixels = true;

        /**
         * The texture used to render the children.
         *
         * @readonly
         * @member {BaseTexture}
         */
        this.baseTexture = null;

        this.setProperties(properties);
    }

    /**
     * Sets the private properties array to dynamic / static based on the passed properties object
     *
     * @param {object} properties - The properties to be uploaded
     */
    setProperties(properties)
    {
        if (properties)
        {
            this._properties[0] = 'scale' in properties ? !!properties.scale : this._properties[0];
            this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1];
            this._properties[2] = 'rotation' in properties ? !!properties.rotation : this._properties[2];
            this._properties[3] = 'uvs' in properties ? !!properties.uvs : this._properties[3];
            this._properties[4] = 'alpha' in properties ? !!properties.alpha : this._properties[4];
        }
    }

    /**
     * Updates the object transform for rendering
     *
     * @private
     */
    updateTransform()
    {
        // TODO don't need to!
        this.displayObjectUpdateTransform();
        //  PIXI.Container.prototype.updateTransform.call( this );
    }

    /**
     * Renders the container using the WebGL renderer
     *
     * @private
     * @param {PIXI.WebGLRenderer} renderer - The webgl renderer
     */
    renderWebGL(renderer)
    {
        if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)
        {
            return;
        }

        if (!this.baseTexture)
        {
            this.baseTexture = this.children[0]._texture.baseTexture;
            if (!this.baseTexture.hasLoaded)
            {
                this.baseTexture.once('update', () => this.onChildrenChange(0));
            }
        }

        renderer.setObjectRenderer(renderer.plugins.particle);
        renderer.plugins.particle.render(this);
    }

    /**
     * Set the flag that static data should be updated to true
     *
     * @private
     * @param {number} smallestChildIndex - The smallest child index
     */
    onChildrenChange(smallestChildIndex)
    {
        const bufferIndex = Math.floor(smallestChildIndex / this._batchSize);

        if (bufferIndex < this._bufferToUpdate)
        {
            this._bufferToUpdate = bufferIndex;
        }
    }

    /**
     * Renders the object using the Canvas renderer
     *
     * @private
     * @param {PIXI.CanvasRenderer} renderer - The canvas renderer
     */
    renderCanvas(renderer)
    {
        if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)
        {
            return;
        }

        const context = renderer.context;
        const transform = this.worldTransform;
        let isRotated = true;

        let positionX = 0;
        let positionY = 0;

        let finalWidth = 0;
        let finalHeight = 0;

        const compositeOperation = renderer.blendModes[this.blendMode];

        if (compositeOperation !== context.globalCompositeOperation)
        {
            context.globalCompositeOperation = compositeOperation;
        }

        context.globalAlpha = this.worldAlpha;

        this.displayObjectUpdateTransform();

        for (let i = 0; i < this.children.length; ++i)
        {
            const child = this.children[i];

            if (!child.visible)
            {
                continue;
            }

            const frame = child.texture.frame;

            context.globalAlpha = this.worldAlpha * child.alpha;

            if (child.rotation % (Math.PI * 2) === 0)
            {
                // this is the fastest  way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call
                if (isRotated)
                {
                    context.setTransform(
                        transform.a,
                        transform.b,
                        transform.c,
                        transform.d,
                        transform.tx * renderer.resolution,
                        transform.ty * renderer.resolution
                    );

                    isRotated = false;
                }

                positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5;
                positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5;

                finalWidth = frame.width * child.scale.x;
                finalHeight = frame.height * child.scale.y;
            }
            else
            {
                if (!isRotated)
                {
                    isRotated = true;
                }

                child.displayObjectUpdateTransform();

                const childTransform = child.worldTransform;

                if (renderer.roundPixels)
                {
                    context.setTransform(
                        childTransform.a,
                        childTransform.b,
                        childTransform.c,
                        childTransform.d,
                        (childTransform.tx * renderer.resolution) | 0,
                        (childTransform.ty * renderer.resolution) | 0
                    );
                }
                else
                {
                    context.setTransform(
                        childTransform.a,
                        childTransform.b,
                        childTransform.c,
                        childTransform.d,
                        childTransform.tx * renderer.resolution,
                        childTransform.ty * renderer.resolution
                    );
                }

                positionX = ((child.anchor.x) * (-frame.width)) + 0.5;
                positionY = ((child.anchor.y) * (-frame.height)) + 0.5;

                finalWidth = frame.width;
                finalHeight = frame.height;
            }

            const resolution = child.texture.baseTexture.resolution;

            context.drawImage(
                child.texture.baseTexture.source,
                frame.x * resolution,
                frame.y * resolution,
                frame.width * resolution,
                frame.height * resolution,
                positionX * resolution,
                positionY * resolution,
                finalWidth * resolution,
                finalHeight * resolution
            );
        }
    }

    /**
     * Destroys the container
     *
     * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
     *  have been set to that value
     * @param {boolean} [options.children=false] - if set to true, all the children will have their
     *  destroy method called as well. 'options' will be passed on to those calls.
     */
    destroy(options)
    {
        super.destroy(options);

        if (this._buffers)
        {
            for (let i = 0; i < this._buffers.length; ++i)
            {
                this._buffers[i].destroy();
            }
        }

        this._properties = null;
        this._buffers = null;
    }
}


text:
"""Vera tests."""
from unittest.mock import MagicMock

import pytest
import pyvera as pv
from requests.exceptions import RequestException

from homeassistant.components.vera import (
    CONF_CONTROLLER,
    CONF_EXCLUDE,
    CONF_LIGHTS,
    DOMAIN,
)
from homeassistant.config_entries import ENTRY_STATE_NOT_LOADED
from homeassistant.core import HomeAssistant

from .common import ComponentFactory, ConfigSource, new_simple_controller_config

from tests.common import MockConfigEntry, mock_registry

async def test_init(
    hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
    """Test function."""
    vera_device1 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device1.device_id = 1
    vera_device1.vera_device_id = vera_device1.device_id
    vera_device1.name = "first_dev"
    vera_device1.is_tripped = False
    entity1_id = "binary_sensor.first_dev_1"

    await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(
            config={CONF_CONTROLLER: "http://127.0.0.1:111"},
            config_source=ConfigSource.CONFIG_FLOW,
            serial_number="first_serial",
            devices=(vera_device1,),
        ),
    )

    entity_registry = await hass.helpers.entity_registry.async_get_registry()
    entry1 = entity_registry.async_get(entity1_id)
    assert entry1
    assert entry1.unique_id == "vera_first_serial_1"

async def test_init_from_file(
    hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
    """Test function."""
    vera_device1 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device1.device_id = 1
    vera_device1.vera_device_id = vera_device1.device_id
    vera_device1.name = "first_dev"
    vera_device1.is_tripped = False
    entity1_id = "binary_sensor.first_dev_1"

    await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(
            config={CONF_CONTROLLER: "http://127.0.0.1:111"},
            config_source=ConfigSource.FILE,
            serial_number="first_serial",
            devices=(vera_device1,),
        ),
    )

    entity_registry = await hass.helpers.entity_registry.async_get_registry()
    entry1 = entity_registry.async_get(entity1_id)
    assert entry1
    assert entry1.unique_id == "vera_first_serial_1"

async def test_multiple_controllers_with_legacy_one(
    hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
    """Test multiple controllers with one legacy controller."""
    vera_device1 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device1.device_id = 1
    vera_device1.vera_device_id = vera_device1.device_id
    vera_device1.name = "first_dev"
    vera_device1.is_tripped = False
    entity1_id = "binary_sensor.first_dev_1"

    vera_device2 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device2.device_id = 2
    vera_device2.vera_device_id = vera_device2.device_id
    vera_device2.name = "second_dev"
    vera_device2.is_tripped = False
    entity2_id = "binary_sensor.second_dev_2"

    # Add existing entity registry entry from previous setup.
    entity_registry = mock_registry(hass)
    entity_registry.async_get_or_create(
        domain="switch", platform=DOMAIN, unique_id="12"
    )

    await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(
            config={CONF_CONTROLLER: "http://127.0.0.1:111"},
            config_source=ConfigSource.FILE,
            serial_number="first_serial",
            devices=(vera_device1,),
        ),
    )

    await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(
            config={CONF_CONTROLLER: "http://127.0.0.1:222"},
            config_source=ConfigSource.CONFIG_FLOW,
            serial_number="second_serial",
            devices=(vera_device2,),
        ),
    )

    entity_registry = await hass.helpers.entity_registry.async_get_registry()

    entry1 = entity_registry.async_get(entity1_id)
    assert entry1
    assert entry1.unique_id == "1"

    entry2 = entity_registry.async_get(entity2_id)
    assert entry2
    assert entry2.unique_id == "vera_second_serial_2"

async def test_unload(
    hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
    """Test function."""
    vera_device1 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device1.device_id = 1
    vera_device1.vera_device_id = vera_device1.device_id
    vera_device1.name = "first_dev"
    vera_device1.is_tripped = False

    await vera_component_factory.configure_component(
        hass=hass, controller_config=new_simple_controller_config()
    )

    entries = hass.config_entries.async_entries(DOMAIN)
    assert entries

    for config_entry in entries:
        assert await hass.config_entries.async_unload(config_entry.entry_id)
        assert config_entry.state == ENTRY_STATE_NOT_LOADED

async def test_async_setup_entry_error(
    hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
    """Test function."""

    def setup_callback(controller: pv.VeraController) -> None:
        controller.get_devices.side_effect = RequestException()
        controller.get_scenes.side_effect = RequestException()

    await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(setup_callback=setup_callback),
    )

    entry = MockConfigEntry(
        domain=DOMAIN,
        data={CONF_CONTROLLER: "http://127.0.0.1"},
        options={},
        unique_id="12345",
    )
    entry.add_to_hass(hass)

    assert not await hass.config_entries.async_setup(entry.entry_id)

@pytest.mark.parametrize(
    ["options"],
    [
        [{CONF_LIGHTS: [4, 10, 12, "AAA"], CONF_EXCLUDE: [1, "BBB"]}],
        [{CONF_LIGHTS: ["4", "10", "12", "AAA"], CONF_EXCLUDE: ["1", "BBB"]}],
    ],
)
async def test_exclude_and_light_ids(
    hass: HomeAssistant, vera_component_factory: ComponentFactory, options
) -> None:
    """Test device exclusion, marking switches as lights and fixing the data type."""
    vera_device1 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device1.device_id = 1
    vera_device1.vera_device_id = 1
    vera_device1.name = "dev1"
    vera_device1.is_tripped = False
    entity_id1 = "binary_sensor.dev1_1"

    vera_device2 = MagicMock(spec=pv.VeraBinarySensor)  # type: pv.VeraBinarySensor
    vera_device2.device_id = 2
    vera_device2.vera_device_id = 2
    vera_device2.name = "dev2"
    vera_device2.is_tripped = False
    entity_id2 = "binary_sensor.dev2_2"

    vera_device3 = MagicMock(spec=pv.VeraSwitch)  # type: pv.VeraSwitch
    vera_device3.device_id = 3
    vera_device3.vera_device_id = 3
    vera_device3.name = "dev3"
    vera_device3.category = pv.CATEGORY_SWITCH
    vera_device3.is_switched_on = MagicMock(return_value=False)

    entity_id3 = "switch.dev3_3"

    vera_device4 = MagicMock(spec=pv.VeraSwitch)  # type: pv.VeraSwitch
    vera_device4.device_id = 4
    vera_device4.vera_device_id = 4
    vera_device4.name = "dev4"
    vera_device4.category = pv.CATEGORY_SWITCH
    vera_device4.is_switched_on = MagicMock(return_value=False)
    vera_device4.get_brightness = MagicMock(return_value=0)
    vera_device4.get_color = MagicMock(return_value=[0, 0, 0])
    vera_device4.is_dimmable = True

    entity_id4 = "light.dev4_4"

    component_data = await vera_component_factory.configure_component(
        hass=hass,
        controller_config=new_simple_controller_config(
            config_source=ConfigSource.CONFIG_ENTRY,
            devices=(vera_device1, vera_device2, vera_device3, vera_device4),
            config={**{CONF_CONTROLLER: "http://127.0.0.1:123"}, **options},
        ),
    )

    # Assert the entries were setup correctly.
    config_entry = next(iter(hass.config_entries.async_entries(DOMAIN)))
    assert config_entry.options[CONF_LIGHTS] == [4, 10, 12]
    assert config_entry.options[CONF_EXCLUDE] == [1]

    update_callback = component_data.controller_data[0].update_callback

    update_callback(vera_device1)
    update_callback(vera_device2)
    update_callback(vera_device3)
    update_callback(vera_device4)
    await hass.async_block_till_done()

    assert hass.states.get(entity_id1) is None
    assert hass.states.get(entity_id2) is not None
    assert hass.states.get(entity_id3) is not None
    assert hass.states.get(entity_id4) is not None