throw new Exception('User not found', 404);

throw new Exception('Failed to remove file from DB', 500);

$tokens = $user->getAttribute('tokens', []);

throw new Exception('Failed saving reserved id to DB', 500);

<?php

global $request;

use Utopia\Config\Config;
use Appwrite\Database\Database;

$providers = Config::getParam('providers');

$collections = [
    'console' => [
        '$id' => 'console',
        '$collection' => 'projects',
        '$permissions' => ['read' => ['*']],
        'name' => 'Appwrite',
        'description' => 'Appwrite core engine',
        'logo' => '',
        'teamId' => -1,
        'webhooks' => [],
        'keys' => [],
        'platforms' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS,
                'name' => 'Production',
                'type' => 'web',
                'hostname' => 'appwrite.io',
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS,
                'name' => 'Development',
                'type' => 'web',
                'hostname' => 'appwrite.test',
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS,
                'name' => 'Localhost',
                'type' => 'web',
                'hostname' => 'localhost',
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_PLATFORMS,
                'name' => 'Current Host',
                'type' => 'web',
                'hostname' => \parse_url('https://'.$request->getServer('HTTP_HOST'), PHP_URL_HOST),
            ],
        ],
        'legalName' => '',
        'legalCountry' => '',
        'legalState' => '',
        'legalCity' => '',
        'legalAddress' => '',
        'legalTaxId' => '',
        'authWhitelistEmails' => (!empty($request->getServer('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', $request->getServer('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [],
        'authWhitelistIPs' => (!empty($request->getServer('_APP_CONSOLE_WHITELIST_IPS', null))) ? \explode(',', $request->getServer('_APP_CONSOLE_WHITELIST_IPS', null)) : [],
        'authWhitelistDomains' => (!empty($request->getServer('_APP_CONSOLE_WHITELIST_DOMAINS', null))) ? \explode(',', $request->getServer('_APP_CONSOLE_WHITELIST_DOMAINS', null)) : [],
    ],
    Database::SYSTEM_COLLECTION_COLLECTIONS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Collections',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Created',
                'key' => 'dateCreated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Updated',
                'key' => 'dateUpdated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Structure',
                'key' => 'structure',
                'type' => 'boolean',
                'default' => false,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Rules',
                'key' => 'rules',
                'type' => 'document',
                'default' => [],
                'required' => true,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_RULES],
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_RULES => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_RULES,
        '$permissions' => ['read' => ['*']],
        'name' => 'Collections Rule',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Label',
                'key' => 'label',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Key',
                'key' => 'key',
                'type' => 'key',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Type',
                'key' => 'type',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Default',
                'key' => 'default',
                'type' => 'wildcard',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Required',
                'key' => 'required',
                'type' => 'boolean',
                'default' => true,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Array',
                'key' => 'array',
                'type' => 'boolean',
                'default' => true,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'list',
                'key' => 'list',
                'type' => 'text',
                //'default' => '',
                'required' => false,
                'array' => true,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_USERS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_USERS,
        '$permissions' => ['read' => ['*']],
        'name' => 'User',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Email',
                'key' => 'email',
                'type' => 'email',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Status',
                'key' => 'status',
                'type' => 'numeric',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Password',
                'key' => 'password',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Password Update Date',
                'key' => 'password-update',
                'type' => 'numeric',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Prefs',
                'key' => 'prefs',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Registration Date',
                'key' => 'registration',
                'type' => 'numeric',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Email Verification Status',
                'key' => 'emailVerification',
                'type' => 'boolean',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Reset',
                'key' => 'reset',
                'type' => 'boolean',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Tokens',
                'key' => 'tokens',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_TOKENS],
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Memberships',
                'key' => 'memberships',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_MEMBERSHIPS],
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_TOKENS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_TOKENS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Token',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Type',
                'key' => 'type',
                'type' => 'numeric',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Secret',
                'key' => 'secret',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Expire',
                'key' => 'expire',
                'type' => 'numeric',
                'default' => 0,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'User Agent',
                'key' => 'userAgent',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'IP',
                'key' => 'ip',
                'type' => 'ip',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_MEMBERSHIPS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_MEMBERSHIPS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Membership',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Team ID',
                'key' => 'teamId',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'User ID',
                'key' => 'userId',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Roles',
                'key' => 'roles',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => true,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Invited',
                'key' => 'invited',
                'type' => 'numeric',
                'default' => 0,
                'required' => false, //FIXME SHOULD BE REQUIRED
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Joined',
                'key' => 'joined',
                'type' => 'numeric',
                'default' => 0,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Confirm',
                'key' => 'confirm',
                'type' => 'boolean',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Secret',
                'key' => 'secret',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_TEAMS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_TEAMS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Team',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Created',
                'key' => 'dateCreated',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Sum',
                'key' => 'sum',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_PROJECTS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_PROJECTS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Project',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Description',
                'key' => 'description',
                'type' => 'text',
                'default' => null,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Logo',
                'key' => 'logo',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'URL',
                'key' => 'url',
                'type' => 'url',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Team ID',
                'key' => 'teamId',
                'type' => 'text',
                'default' => 0,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal Name',
                'key' => 'legalName',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal Country',
                'key' => 'legalCountry',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal State',
                'key' => 'legalState',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal City',
                'key' => 'legalCity',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal Address',
                'key' => 'legalAddress',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Legal Tax ID',
                'key' => 'legalTaxId',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Webhooks',
                'key' => 'webhooks',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_WEBHOOKS],
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'API Keys',
                'key' => 'keys',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_KEYS],
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Tasks',
                'key' => 'tasks',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_TASKS],
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Platforms',
                'key' => 'platforms',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_PLATFORMS],
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Domains',
                'key' => 'domains',
                'type' => 'document',
                'default' => [],
                'required' => false,
                'array' => true,
                'list' => [Database::SYSTEM_COLLECTION_DOMAINS],
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_WEBHOOKS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_WEBHOOKS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Webhook',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Events',
                'key' => 'events',
                'type' => 'text',
                'default' => null,
                'required' => false,
                'array' => true,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'URL',
                'key' => 'url',
                'type' => 'url',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Security',
                'key' => 'security',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP User',
                'key' => 'httpUser',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP Password',
                'key' => 'httpPass',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_KEYS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_KEYS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Key',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Scopes',
                'key' => 'scopes',
                'type' => 'text',
                'default' => null,
                'required' => false,
                'array' => true,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Secret',
                'key' => 'secret',
                'type' => 'text',
                'default' => '',
                'required' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_TASKS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_TASKS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Task',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Status',
                'key' => 'status',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Updated',
                'key' => 'updated',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Schedule',
                'key' => 'schedule',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Previous',
                'key' => 'previous',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Next',
                'key' => 'next',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Duration',
                'key' => 'duration',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Delay',
                'key' => 'delay',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Security',
                'key' => 'security',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP Method',
                'key' => 'httpMethod',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP URL',
                'key' => 'httpUrl',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP Headers',
                'key' => 'httpHeaders',
                'type' => 'text',
                'default' => null,
                'required' => false,
                'array' => true,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP User',
                'key' => 'httpUser',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'HTTP Password',
                'key' => 'httpPass',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Log',
                'key' => 'log',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Failures',
                'key' => 'failures',
                'type' => 'numeric',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_PLATFORMS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_PLATFORMS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Platform',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Type',
                'key' => 'type',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Created',
                'key' => 'dateCreated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Updated',
                'key' => 'dateUpdated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Key',
                'key' => 'key',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Store',
                'key' => 'store',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Hostname',
                'key' => 'hostname',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_DOMAINS => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_DOMAINS,
        '$permissions' => ['read' => ['*']],
        'name' => 'Domains',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Domain',
                'key' => 'domain',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Updated',
                'key' => 'updated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Top Level Domain',
                'key' => 'tld',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Registerable Domain',
                'key' => 'registerable',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Verification',
                'key' => 'verification',
                'type' => 'boolean',
                'default' => false,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Certificate ID',
                'key' => 'certificateId',
                'type' => 'key',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_CERTIFICATES => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_CERTIFICATES,
        '$permissions' => ['read' => ['*']],
        'name' => 'Certificates',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Domain',
                'key' => 'domain',
                'type' => 'text',
                'default' => null,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Issue Date',
                'key' => 'issueDate',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Renew Date',
                'key' => 'renewDate',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Attempts',
                'key' => 'attempts',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Log',
                'key' => 'log',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
    Database::SYSTEM_COLLECTION_FILES => [
        '$collection' => Database::SYSTEM_COLLECTION_COLLECTIONS,
        '$id' => Database::SYSTEM_COLLECTION_FILES,
        '$permissions' => ['read' => ['*']],
        'name' => 'File',
        'structure' => true,
        'rules' => [
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Date Created',
                'key' => 'dateCreated',
                'type' => 'numeric',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Folder ID',
                'key' => 'folderId',
                'type' => 'key',
                'default' => 0,
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Name',
                'key' => 'name',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Path',
                'key' => 'path',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Signature',
                'key' => 'signature',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Mime Type',
                'key' => 'mimeType',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Original Size',
                'key' => 'sizeOriginal',
                'type' => 'numeric',
                'default' => 0,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Actual Size',
                'key' => 'sizeActual',
                'type' => 'numeric',
                'default' => 0,
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Algorithm',
                'key' => 'algorithm',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Token',
                'key' => 'token',
                'type' => 'text',
                'default' => '',
                'required' => true,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'Comment',
                'key' => 'comment',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'File OpenSSL Version',
                'key' => 'fileOpenSSLVersion',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'File OpenSSL Cipher',
                'key' => 'fileOpenSSLCipher',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'File OpenSSL Tag',
                'key' => 'fileOpenSSLTag',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
            [
                '$collection' => Database::SYSTEM_COLLECTION_RULES,
                'label' => 'File OpenSSL IV',
                'key' => 'fileOpenSSLIV',
                'type' => 'text',
                'default' => '',
                'required' => false,
                'array' => false,
            ],
        ],
    ],
];

/*
 * Add enabled OAuth2 providers to default data rules
 */
foreach ($providers as $index => $provider) {
    if (!$provider['enabled']) {
        continue;
    }

    $collections[Database::SYSTEM_COLLECTION_PROJECTS]['rules'][] = [
        '$collection' => Database::SYSTEM_COLLECTION_RULES,
        'label' => 'OAuth2 '.\ucfirst($index).' ID',
        'key' => 'usersOauth2'.\ucfirst($index).'Appid',
        'type' => 'text',
        'default' => '',
        'required' => false,
        'array' => false,
    ];

    $collections[Database::SYSTEM_COLLECTION_PROJECTS]['rules'][] = [
        '$collection' => Database::SYSTEM_COLLECTION_RULES,
        'label' => 'OAuth2 '.\ucfirst($index).' Secret',
        'key' => 'usersOauth2'.\ucfirst($index).'Secret',
        'type' => 'text',
        'default' => '',
        'required' => false,
        'array' => false,
    ];

    $collections[Database::SYSTEM_COLLECTION_USERS]['rules'][] = [
        '$collection' => Database::SYSTEM_COLLECTION_RULES,
        'label' => 'OAuth2 '.\ucfirst($index).' ID',
        'key' => 'oauth2'.\ucfirst($index),
        'type' => 'text',
        'default' => '',
        'required' => false,
        'array' => false,
    ];

    $collections[Database::SYSTEM_COLLECTION_USERS]['rules'][] = [
        '$collection' => Database::SYSTEM_COLLECTION_RULES,
        'label' => 'OAuth2 '.\ucfirst($index).' Access Token',
        'key' => 'oauth2'.\ucfirst($index).'AccessToken',
        'type' => 'text',
        'default' => '',
        'required' => false,
        'array' => false,
    ];
}

return $collections;


let sdk = new Appwrite();

sdk
    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
    .setProject('5df5acd0d48c2') // Your project ID
;

let result = sdk.storage.getFilePreview('[FILE_ID]');

console.log(result); // Resource URL


    مرحبا {{name}},

    اتبع هذا الرابط للتحقق من عنوان بريدك الإلكتروني.

{{cta}}

    إذا لم تطلب التحقق من هذا العنوان، فيمكنك تجاهل هذه الرسالة.

    Thanks,

    فريق {{project}}


from appwrite.client import Client
from appwrite.services.users import Users

client = Client()

(client
  .set_endpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
  .set_project('5df5acd0d48c2') # Your project ID
  .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
)

users = Users(client)

result = users.get_sessions('[USER_ID]')


throw new Exception('Failed to remove token from DB', 500);

keep keep keep keep add keep keep keep keep

throw new Exception('Failed to remove team membership from DB', 500);

<?php

namespace Appwrite\Database;

use Exception;
use Appwrite\Database\Validator\Authorization;
use Appwrite\Database\Validator\Structure;
use Appwrite\Database\Exception\Authorization as AuthorizationException;
use Appwrite\Database\Exception\Structure as StructureException;

class Database
{
    // System Core
    const SYSTEM_COLLECTION_COLLECTIONS = 0;
    const SYSTEM_COLLECTION_RULES = 'rules';

    // Project
    const SYSTEM_COLLECTION_PROJECTS = 'projects';
    const SYSTEM_COLLECTION_WEBHOOKS = 'webhooks';
    const SYSTEM_COLLECTION_KEYS = 'keys';
    const SYSTEM_COLLECTION_TASKS = 'tasks';
    const SYSTEM_COLLECTION_PLATFORMS = 'platforms';
    const SYSTEM_COLLECTION_USAGES = 'usages'; //TODO add structure
    const SYSTEM_COLLECTION_DOMAINS = 'domains';
    const SYSTEM_COLLECTION_CERTIFICATES = 'certificates';

    // Auth, Account and Users (private to user)
    const SYSTEM_COLLECTION_USERS = 'users';
    const SYSTEM_COLLECTION_TOKENS = 'tokens';

    // Teams (shared among team members)
    const SYSTEM_COLLECTION_MEMBERSHIPS = 'memberships';
    const SYSTEM_COLLECTION_TEAMS = 'teams';

    // Storage
    const SYSTEM_COLLECTION_FILES = 'files';

    /**
     * @var array
     */
    protected $mocks = [];

    /**
     * @var Adapter
     */
    protected $adapter;

    /**
     * Set Adapter.
     *
     * @param Adapter $adapter
     *
     * @return $this
     */
    public function setAdapter(Adapter $adapter)
    {
        $this->adapter = $adapter;

        return $this;
    }

    /**
     * Set Namespace.
     *
     * Set namespace to divide different scope of data sets
     *
     * @param $namespace
     *
     * @return $this
     *
     * @throws Exception
     */
    public function setNamespace($namespace)
    {
        $this->adapter->setNamespace($namespace);

        return $this;
    }

    /**
     * Get Namespace.
     *
     * Get namespace of current set scope
     *
     * @return string
     *
     * @throws Exception
     */
    public function getNamespace()
    {
        return $this->adapter->getNamespace();
    }

    /**
     * Create Namespace.
     *
     * @param int $namespace
     *
     * @return bool
     */
    public function createNamespace($namespace)
    {
        return $this->adapter->createNamespace($namespace);
    }

    /**
     * Delete Namespace.
     *
     * @param int $namespace
     *
     * @return bool
     */
    public function deleteNamespace($namespace)
    {
        return $this->adapter->deleteNamespace($namespace);
    }

    /**
     * @param array $options
     *
     * @return Document[]|Document
     */
    public function getCollection(array $options)
    {
        $options = \array_merge([
            'offset' => 0,
            'limit' => 15,
            'search' => '',
            'relations' => true,
            'orderField' => '$id',
            'orderType' => 'ASC',
            'orderCast' => 'int',
            'first' => false,
            'last' => false,
            'filters' => [],
        ], $options);

        $results = $this->adapter->getCollection($options);

        foreach ($results as &$node) {
            $node = new Document($node);
        }

        if ($options['first']) {
            $results = \reset($results);
        }

        if ($options['last']) {
            $results = \end($results);
        }

        return $results;
    }

    /**
     * @param int  $id
     * @param bool $mock is mocked data allowed?
     *
     * @return Document
     */
    public function getDocument($id, $mock = true)
    {
        if (\is_null($id)) {
            return new Document([]);
        }

        $document = new Document((isset($this->mocks[$id]) && $mock) ? $this->mocks[$id] : $this->adapter->getDocument($id));
        $validator = new Authorization($document, 'read');

        if (!$validator->isValid($document->getPermissions())) { // Check if user has read access to this document
            return new Document([]);
        }

        return $document;
    }

    /**
     * @param array $data
     *
     * @return Document|bool
     *
     * @throws AuthorizationException
     * @throws StructureException
     */
    public function createDocument(array $data, array $unique = [])
    {
        $document = new Document($data);

        $validator = new Authorization($document, 'write');

        if (!$validator->isValid($document->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription());
        }

        $validator = new Structure($this);

        if (!$validator->isValid($document)) {
            throw new StructureException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        return new Document($this->adapter->createDocument($data, $unique));
    }

    /**
     * @param array $data
     *
     * @return Document|false
     *
     * @throws Exception
     */
    public function updateDocument(array $data)
    {
        if (!isset($data['$id'])) {
            throw new Exception('Must define $id attribute');
        }

        $document = $this->getDocument($data['$id']); // TODO make sure user don\'t need read permission for write operations

        // Make sure reserved keys stay constant
        $data['$id'] = $document->getId();
        $data['$collection'] = $document->getCollection();

        $validator = new Authorization($document, 'write');

        if (!$validator->isValid($document->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        $new = new Document($data);

        if (!$validator->isValid($new->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        $validator = new Structure($this);

        if (!$validator->isValid($new)) { // Make sure updated structure still apply collection rules (if any)
            throw new StructureException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        return new Document($this->adapter->updateDocument($data));
    }

    /**
     * @param array $data
     *
     * @return Document|false
     *
     * @throws Exception
     */
    public function overwriteDocument(array $data)
    {
        if (!isset($data['$id'])) {
            throw new Exception('Must define $id attribute');
        }

        $document = $this->getDocument($data['$id']); // TODO make sure user don\'t need read permission for write operations

        $validator = new Authorization($document, 'write');

        if (!$validator->isValid($document->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        $new = new Document($data);

        if (!$validator->isValid($new->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        $validator = new Structure($this);

        if (!$validator->isValid($new)) { // Make sure updated structure still apply collection rules (if any)
            throw new StructureException($validator->getDescription()); // var_dump($validator->getDescription()); return false;
        }

        return new Document($this->adapter->updateDocument($data));
    }

    /**
     * @param int $id
     *
     * @return Document|false
     *
     * @throws AuthorizationException
     */
    public function deleteDocument($id)
    {
        $document = $this->getDocument($id);

        $validator = new Authorization($document, 'write');

        if (!$validator->isValid($document->getPermissions())) { // Check if user has write access to this document
            throw new AuthorizationException($validator->getDescription());
        }

        return new Document($this->adapter->deleteDocument($id));
    }

    /**
     * @return array
     */
    public function getDebug()
    {
        return $this->adapter->getDebug();
    }

    /**
     * @return int
     */
    public function getSum()
    {
        $debug = $this->getDebug();

        return (isset($debug['sum'])) ? $debug['sum'] : 0;
    }

    /**
     * @param array $options
     *
     * @return int
     */
    public function getCount(array $options)
    {
        $options = \array_merge([
            'filters' => [],
        ], $options);

        $results = $this->adapter->getCount($options);

        return $results;
    }

    /**
     * @param string $key
     * @param string $value
     *
     * @return array
     */
    public function setMock($key, $value)
    {
        $this->mocks[$key] = $value;

        return $this;
    }

    /**
     * @param string $mocks
     *
     * @return array
     */
    public function setMocks(array $mocks)
    {
        $this->mocks = $mocks;

        return $this;
    }

    /**
     * @return array
     */
    public function getMocks()
    {
        return $this->mocks;
    }

    /**
     * Get Last Modified.
     *
     * Return unix timestamp of last time a node queried in current session has been changed
     *
     * @return int
     */
    public function lastModified()
    {
        return $this->adapter->lastModified();
    }
}


    Salut {{name}},

    Accesează link-ul următor pentru a-ți reseta parola din proiectul {{project}}.

{{cta}}

    Dacă nu ai solicitat acest mail, te rugăm frumos să îl ignori.

    Cu drag,

    Echipa {{project}}


import { Client } from "./client.ts";

export abstract class Service {

    client: Client;

    /**
     * @param client
     */
    constructor(client: Client) {
        this.client = client;
    }
}


<?php

use Appwrite\Client;
use Appwrite\Services\Storage;

$client = new Client();

$client
    ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
    ->setProject('5df5acd0d48c2') // Your project ID
    ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;

$storage = new Storage($client);

$result = $storage->updateFile('[FILE_ID]', [], []);


const SYSTEM_COLLECTION_PLATFORMS = 'platforms';

const SYSTEM_COLLECTION_USAGES = 'usages'; //TODO add structure

const SYSTEM_COLLECTION_DOMAINS = 'domains';

const SYSTEM_COLLECTION_CERTIFICATES = 'certificates';

// Auth, Account and Users (private to user)

const SYSTEM_COLLECTION_USERS = 'users';

const SYSTEM_COLLECTION_TOKENS = 'tokens';

const SYSTEM_COLLECTION_RESERVED = 'reserved';


    Γεια,

    Έλαβες αυτό το email επειδή ο {{owner}} σε προσκάλεσε να γίνεις μέλος της ομάδας {{team}} στο {{project}}.

    Ακολούθησε αυτό τον σύνδεσμο για να γίνεις μέλος της ομάδας {{team}}:

{{cta}}

    Άν δεν ενδιαφέρεσαι, μπορείς να αγνοήσεις αυτό το μήνυμα.

    Ευχαριστούμε,

    Η ομάδα του {{project}}


<?php

return [
    'settings.inspire' => '"សិល្បៈនៃប្រាជ្ញាគឺជាសិល្បៈនៃការស្គាល់ពីអ្វីដែលត្រូវមើលរំលង។"', // This is the line printed in the homepage and console 'view-source'
    'settings.locale' => 'km',
    'settings.direction' => 'ltr',

    // Service - Users
    'account.emails.team' => 'ក្រុម %s',
    'account.emails.verification.title' => 'ការផ្ទៀងផ្ទាត់គណនី',
    'account.emails.verification.body' => 'km.email.auth.confirm.tpl',
    'account.emails.recovery.title' => 'កំណត់ពាក្យសម្ងាត់ឡើងវិញ',
    'account.emails.recovery.body' => 'km.email.auth.recovery.tpl',
    'account.emails.invitation.title' => 'ការអញ្ជើញចូលក្នុងក្រុម %s នៅ %s',
    'account.emails.invitation.body' => 'km.email.auth.invitation.tpl',

    'locale.country.unknown' => 'មិនស្គាល់',

    'countries' => include 'km.countries.php',
    'continents' => include 'km.continents.php',
];


require 'appwrite'

client = Appwrite::Client.new()

client
    .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
    .set_project('5df5acd0d48c2') # Your project ID
    .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
;

storage = Appwrite::Storage.new(client);

response = storage.get_file_preview(file_id: '[FILE_ID]');

puts response


function generateApiItems (locale: string) {

introduction

getting-started

installation frequently-asked-questions wireframes unit-testing browser-support upgrade-guide release-notes contributing

features

aliasing application-layout blueprints display-and-platform global-configuration icon-fonts internationalization sass-variables theme treeshaking

styles

components

explorer

api

directives

click-outside intersect mutate resize ripple scroll touch

labs

bottom-sheets

data-iterators

data-tables

basics headers selection sorting pagination filtering grouping slots virtual-tables server-side-tables

dates

date-pickers

infinite-scroller

otp-input

skeleton-loaders

steppers

resources

jobs-for-vue ui-kits themes search-engine brand-kit

about


<template>
  <v-form>
    <v-container>
      <v-row>
        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your product or service"
            model-value="Grocery delivery"
            hint="For example, flowers or used cars"
          ></v-text-field>
        </v-col>

        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your landing page"
            hint="www.example.com/page"
            persistent-hint
          ></v-text-field>
        </v-col>

        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your product or service"
            model-value="Grocery delivery"
            hint="For example, flowers or used cars"
            variant="solo"
          ></v-text-field>
        </v-col>

        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your landing page"
            hint="www.example.com/page"
            persistent-hint
            variant="solo"
          ></v-text-field>
        </v-col>

        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your product or service"
            model-value="Grocery delivery"
            hint="For example, flowers or used cars"
            variant="outlined"
          ></v-text-field>
        </v-col>

        <v-col
          cols="12"
          sm="6"
        >
          <v-text-field
            label="Your landing page"
            hint="www.example.com/page"
            persistent-hint
            variant="outlined"
          ></v-text-field>
        </v-col>
      </v-row>
    </v-container>
  </v-form>
</template>


// Utilities
import { createSimpleFunctional } from '@/util'

export const VStepperHeader = createSimpleFunctional('v-stepper-header')

export type VStepperHeader = InstanceType<typeof VStepperHeader>


// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VSparkline.ts should position labels correctly 1`] = `
<svg display="block"
     stroke-width="20"
     viewbox="0 0 300 85.5"
     class="primary--text"
>
  <defs>
    <linearGradient id="35"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="8"
          y="76.25"
          font-size="7"
    >
      1
    </text>
    <text x="150"
          y="76.25"
          font-size="7"
    >
      7
    </text>
    <text x="292"
          y="76.25"
          font-size="7"
    >
      42
    </text>
  </g>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#35)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render bar component with all values 0 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="39"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-39-clip">
    <rect x="48"
          y="75"
          width="4"
          height="0"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="75"
          width="4"
          height="0"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="75"
          width="4"
          height="0"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-39-clip)"
     fill="url(#39)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="1"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#1)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with bars and auto-line-width and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="21"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-21-clip">
    <rect x="5.333333333333336"
          y="73.21428571428571"
          width="89.33333333333333"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="105.33333333333334"
          y="62.5"
          width="89.33333333333333"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="205.33333333333334"
          y="0"
          width="89.33333333333333"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-21-clip)"
     fill="url(#21)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and auto-line-width with custom padding and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="27"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-27-clip">
    <rect x="8"
          y="73.21428571428571"
          width="84"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="108"
          y="62.5"
          width="84"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="208"
          y="0"
          width="84"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-27-clip)"
     fill="url(#27)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and correct bar lengths 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="37"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-37-clip">
    <rect x="73"
          y="37.5"
          width="4"
          height="37.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="223"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-37-clip)"
     fill="url(#37)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and correct bar lengths 2`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="37"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-37-clip">
    <rect x="73"
          y="0"
          width="4"
          height="37.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="223"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-37-clip)"
     fill="url(#37)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and custom label size and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 97.5"
>
  <defs>
    <linearGradient id="29"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-29-clip">
    <rect x="48"
          y="73.21428571428571"
          width="4"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="62.5"
          width="4"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="50"
          y="86.25"
          font-size="15"
    >
      Value 1
    </text>
    <text x="150"
          y="86.25"
          font-size="15"
    >
      Value 2
    </text>
    <text x="250"
          y="86.25"
          font-size="15"
    >
      Value 3
    </text>
  </g>
  <g clip-path="url(#sparkline-bar-29-clip)"
     fill="url(#29)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and custom padding and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="25"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-25-clip">
    <rect x="48"
          y="73.21428571428571"
          width="4"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="62.5"
          width="4"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-25-clip)"
     fill="url(#25)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and gradient and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="17"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="rgba(80, 160, 240, 0.5)"
      >
      </stop>
      <stop offset="0.5"
            stop-color="red"
      >
      </stop>
      <stop offset="1"
            stop-color="#000"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-17-clip">
    <rect x="48"
          y="73.21428571428571"
          width="4"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="62.5"
          width="4"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-17-clip)"
     fill="url(#17)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and labels and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 85.5"
>
  <defs>
    <linearGradient id="19"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-19-clip">
    <rect x="48"
          y="73.21428571428571"
          width="4"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="62.5"
          width="4"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="50"
          y="80.25"
          font-size="7"
    >
      Value 1
    </text>
    <text x="150"
          y="80.25"
          font-size="7"
    >
      Value 2
    </text>
    <text x="250"
          y="80.25"
          font-size="7"
    >
      Value 3
    </text>
  </g>
  <g clip-path="url(#sparkline-bar-19-clip)"
     fill="url(#19)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and line width and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="23"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-23-clip">
    <rect x="46"
          y="73.21428571428571"
          width="8"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="146"
          y="62.5"
          width="8"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="246"
          y="0"
          width="8"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-23-clip)"
     fill="url(#23)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="13"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-13-clip">
    <rect x="48"
          y="73.21428571428571"
          width="4"
          height="1.7857142857142858"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="148"
          y="62.5"
          width="4"
          height="12.5"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="248"
          y="0"
          width="4"
          height="75"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-13-clip)"
     fill="url(#13)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with bars and negative and match a snapshot 1`] = `
<svg display="block"
     viewbox="0 0 300 75"
>
  <defs>
    <linearGradient id="15"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <clipPath id="sparkline-bar-15-clip">
    <rect x="35.5"
          y="73.25581395348837"
          width="4"
          height="1.744186046511628"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="110.5"
          y="71.51162790697674"
          width="4"
          height="1.744186046511628"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="185.5"
          y="61.04651162790697"
          width="4"
          height="12.209302325581396"
          rx="0"
          ry="0"
    >
    </rect>
    <rect x="260.5"
          y="0"
          width="4"
          height="73.25581395348837"
          rx="0"
          ry="0"
    >
    </rect>
  </clipPath>
  <g clip-path="url(#sparkline-bar-15-clip)"
     fill="url(#15)"
  >
    <rect x="0"
          y="0"
          width="300"
          height="75"
    >
    </rect>
  </g>
</svg>
`;

exports[`VSparkline.ts should render component with gradient and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="9"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="rgba(80, 160, 240, 0.5)"
      >
      </stop>
      <stop offset="0.5"
            stop-color="red"
      >
      </stop>
      <stop offset="1"
            stop-color="#000"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#9)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with label size and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 96"
     class="primary--text"
>
  <defs>
    <linearGradient id="33"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="8"
          y="81.5"
          font-size="14"
    >
      1
    </text>
    <text x="150"
          y="81.5"
          font-size="14"
    >
      7
    </text>
    <text x="292"
          y="81.5"
          font-size="14"
    >
      42
    </text>
  </g>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#33)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with line width and match a snapshot 1`] = `
<svg display="block"
     stroke-width="42"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="7"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#7)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with padding and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="3"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M20 55L150 49.8780487804878S150 49.8780487804878 150 49.8780487804878L280 20"
        fill="none"
        stroke="url(#3)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with string labels and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 85.5"
     class="primary--text"
>
  <defs>
    <linearGradient id="11"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="8"
          y="76.25"
          font-size="7"
    >
      1
    </text>
    <text x="150"
          y="76.25"
          font-size="7"
    >
      7
    </text>
    <text x="292"
          y="76.25"
          font-size="7"
    >
      42
    </text>
  </g>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#11)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with string labels and match a snapshot 2`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 85.5"
     class="primary--text"
>
  <defs>
    <linearGradient id="11"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="8"
          y="76.25"
          font-size="7"
    >
      2
    </text>
    <text x="150"
          y="76.25"
          font-size="7"
    >
      8
    </text>
    <text x="292"
          y="76.25"
          font-size="7"
    >
      43
    </text>
  </g>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#11)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with string labels and match a snapshot 3`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 85.5"
     class="primary--text"
>
  <defs>
    <linearGradient id="11"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <g style="font-size: 8; text-anchor: middle; dominant-baseline: mathematical; fill: currentColor;">
    <text x="8"
          y="76.25"
          font-size="7"
    >
      foo
    </text>
    <text x="150"
          y="76.25"
          font-size="7"
    >
      bar
    </text>
    <text x="292"
          y="76.25"
          font-size="7"
    >
      baz
    </text>
  </g>
  <path d="M8 67L150 58.36585365853659S150 58.36585365853659 150 58.36585365853659L292 8"
        fill="none"
        stroke="url(#11)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render component with trend and equal values and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="31"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M8 67L150 67L292 67"
        fill="none"
        stroke="url(#31)"
  >
  </path>
</svg>
`;

exports[`VSparkline.ts should render smooth component and match a snapshot 1`] = `
<svg display="block"
     stroke-width="4"
     viewbox="0 0 300 75"
     class="primary--text"
>
  <defs>
    <linearGradient id="5"
                    gradientunits="userSpaceOnUse"
                    x1="0"
                    y1="100%"
                    x2="0"
                    y2="0"
    >
      <stop offset="0"
            stop-color="currentColor"
      >
      </stop>
    </linearGradient>
  </defs>
  <path d="M8 67L130.03686887894946 59.57968883834626S150 58.36585365853659 168.84944344392306 51.680161334300735L292 8"
        fill="none"
        stroke="url(#5)"
  >
  </path>
</svg>
`;


keep keep keep replace keep keep keep keep keep

? routes.find((route: { path: string }) => route.path.endsWith(`/${locale}/${path}/${litem.routeMatch}/`))

: routes.find((route: { path: string }) => route.path.endsWith(`/${locale}/${path}/${litem.title}/`))

<template>
  <v-list
    v-model:opened="opened"
    :nav="nav"
    :items="computedItems"
    :lines="false"
    color="primary"
    density="compact"
    item-props
  >
    <template #divider>
      <slot name="divider" />

      <v-divider
        v-if="!$slots.divider"
        class="my-3 mb-4 ms-2 me-n2"
      />
    </template>

    <template #title="{ item }">
      {{ item.title }}

      <v-badge
        v-if="item.emphasized"
        class="ms-n1"
        color="success"
        dot
        inline
      />
    </template>

    <template #subtitle="{ item }">
      <span v-if="item.subtitle" class="text-high-emphasis">
        {{ item.subtitle }}
      </span>
    </template>

    <template #subheader="{ props: subheaderProps }">
      <slot
        name="subheader"
        v-bind="{ subheaderProps }"
      />

      <v-list-subheader
        v-if="!$slots.subheader"
        class="text-high-emphasis text-uppercase font-weight-black"
      >
        {{ subheaderProps.title }}
      </v-list-subheader>
    </template>
  </v-list>
</template>

<script setup lang="ts">
  // Composables
  import { useI18n } from 'vue-i18n'

  // Utiltities
  import { computed, ref } from 'vue'
  import { generatedRoutes as routes } from '@/util/routes'
  import { RouteLocationRaw, RouteRecordRaw } from 'vue-router'

  // Types
  import type { Prop } from 'vue'

  export type Item = {
    title?: string
    subtitle?: string
    appendIcon?: string
    activeIcon?: string
    inactiveIcon?: string
    items?: (string | Item)[]
    subheader?: string
    divider?: boolean
    to?: RouteLocationRaw
    href?: string
    subfolder?: string
    disabled?: boolean
  }

  function generateApiItems (locale: string) {
    return (routes as RouteRecordRaw[])
      .filter(route => route.path.includes(`${locale}/api/`))
      .map(route => {
        return {
          title: (route.meta!.title as string).slice(0, -4),
          to: route.path,
        }
      })
      .sort((a, b) => a.title.localeCompare(b.title))
  }

  function generateListItem (item: string | Item, path = '', locale = 'en', t = (key: string) => key): any {
    const isString = typeof item === 'string'
    const isLink = !isString && (item.to || item.href)
    const isParent = !isString && item.items
    const isType = !isString && (item.divider || item.subheader)

    if (isString || (!isLink && !isParent && !isType)) {
      const litem = isString ? { title: item } : item

      if (litem.subfolder) path = litem.subfolder

      const route = routes.find((route: { path: string }) => route.path.endsWith(`/${locale}/${path}/${litem.title}/`))

      return {
        title: route?.meta?.nav ?? route?.meta?.title ?? litem.title,
        subtitle: litem.subtitle && te(litem.subtitle) ? t(litem.subtitle) : litem.subtitle,
        emphasized: route?.meta?.emphasized ?? false,
        to: route?.path,
        disabled: !route,
      }
    } else if (item.divider) {
      return {
        type: 'divider',
      }
    } else if (item.subheader) {
      return {
        title: t(item.subheader!),
        type: 'subheader',
      }
    } else if (item.items) {
      const p = item.subfolder ? `${item.subfolder}/${item.title}` : path
      return {
        title: t(item.title!),
        children: item.items.map(item => generateListItem(item, p, locale, t)),
      }
    }

    return item
  }

  function generateListItems (item: Item, path: string, locale: string, t: (key: string) => string): any {
    if (!item.items) return undefined

    return item.items.map(child => generateListItem(child, path, locale, t))
  }

  const props = defineProps({
    items: {
      type: Array,
      default: () => ([]),
    } as Prop<Item[]>,
    nav: Boolean,
  })

  const { t, te, locale } = useI18n()
  const opened = ref<string[]>([])

  const computedItems = computed(() => props.items?.map(item => {
    if (item.divider || item.subheader) return generateListItem(item)

    const title = item.title && te(item.title) ? t(item.title) : item.title

    return {
      ...generateListItem({
        title,
        to: item?.to,
        href: item?.href,
      }),
      rel: item.href ? 'noopener noreferrer' : undefined,
      target: item.href ? '_blank' : undefined,
      children: item.title === 'api' ? generateApiItems(locale.value) : generateListItems(item, item.title!, locale.value, t),
      prependIcon: opened.value.includes(title ?? '') ? item.activeIcon : item.inactiveIcon,
      value: title,
      appendIcon: item.appendIcon,
      disabled: item.disabled,
    }
  }))
</script>


/// <reference types="../../types/cypress" />
import '../../src/styles/main.sass'
import type { VueWrapper } from '@vue/test-utils'
import { mount as cyMount } from 'cypress/vue'
import { createVuetify } from '../../src/framework'
import { mergeDeep } from '../../src/util'
import { aliases } from '../../src/iconsets/mdi-svg'

/**
 * @example
 * cy.mount(<VBtn>My button</VBtn>)
 */
Cypress.Commands.add('mount', (component, options, vuetifyOptions) => {
  const root = document.getElementById('cy-root')!

  // add the v-application class that allows Vuetify styles to work
  if (!root.classList.contains('v-locale--is-rtl')) {
    root.classList.add('v-locale--is-ltr')
  }

  const vuetify = createVuetify(mergeDeep({
    icons: { aliases },
  }, vuetifyOptions))
  const defaultOptions = {
    global: {
      stubs: {
        transition: false,
        'transition-group': false,
      },
      plugins: [vuetify],
    },
  }

  const mountOptions = mergeDeep(defaultOptions, options!, (a, b) => a.concat(b))

  return cyMount(component, mountOptions)
    .then(({ wrapper }) => {
      cy.wrap(wrapper).as('wrapper')
    })
})

Cypress.Commands.add('vue', () => {
  return cy.get<VueWrapper<any>>('@wrapper')
})

/**
 * Update the props and wait for Vue to re-render.
 * Must be chained of a chain that starts with `cy.mount`.
 *
 * @example
 * cy.mount(<VBtn>My button</VBtn>)
 *   .get('button').
 *   .should('not.have.class', 'v-btn--disabled')
 *   .setProps({ disabled: true }).
 *   .get('button')
 *   .should('have.class', 'v-btn--disabled')
 */

Cypress.Commands.add('setProps', (props: Record<string, unknown> = {}) => {
  return cy.get<VueWrapper<any>>('@wrapper').then(async wrapper => {
    await wrapper.setProps(props)
    return wrapper
  })
})

Cypress.Commands.add('emitted', (selector: Parameters<VueWrapper['getComponent']>[0], event?: string) => {
  return cy.get<VueWrapper<any>>('@wrapper').then(wrapper => {
    const cmp = wrapper.findComponent<any>(selector)

    if (!cmp) return cy.wrap({})

    return cy.wrap(event ? cmp.emitted(event) : cmp.emitted())
  })
})


<template>
  <usage-example
    v-model="model"
    :code="code"
    :options="options"
    :name="name"
  >
    <div>
      <v-select v-bind="props"></v-select>
    </div>

    <template v-slot:configuration>
      <v-checkbox v-model="clear" label="Clearable"></v-checkbox>

      <v-checkbox v-model="chips" label="Chips"></v-checkbox>

      <v-checkbox v-model="multiple" label="Multiple"></v-checkbox>
    </template>
  </usage-example>
</template>

<script setup>
  // Utilities
  import { computed, ref } from 'vue'
  import { propsToString } from '@/util/helpers'

  const name = 'v-select'
  const model = ref('default')
  const clear = ref(false)
  const chips = ref(false)
  const multiple = ref(false)
  const options = ['outlined', 'underlined', 'solo', 'solo-filled', 'solo-inverted']
  const props = computed(() => {
    return {
      clearable: clear.value || undefined,
      chips: chips.value || undefined,
      label: 'Select',
      items: ['California', 'Colorado', 'Florida', 'Georgia', 'Texas', 'Wyoming'],
      multiple: multiple.value || undefined,
      variant: model.value === 'default' ? undefined : model.value,
    }
  })

  const slots = computed(() => {
    return ``
  })

  const code = computed(() => {
    return `<${name}${propsToString(props.value)}>${slots.value}</${name}>`
  })
</script>


<template>
  <v-window
    v-model="onboarding"
    show-arrows="hover"
  >
    <v-window-item
      v-for="n in length"
      :key="`card-${n}`"
    >
      <v-card
        elevation="2"
        height="200"
        class="d-flex align-center justify-center ma-2"
      >
        <h1
          class="text-h2"
        >
          Slide {{ n }}
        </h1>
      </v-card>
    </v-window-item>
  </v-window>
</template>

<script setup>
  import { ref } from 'vue'

  const length = ref(3)
  const onboarding = ref(0)
</script>

<script>
  export default {
    data: () => ({
      length: 3,
      onboarding: 0,
    }),
  }
</script>


keep keep keep keep replace keep keep keep keep keep


// Styles
import './VDateRangePicker.sass'

// Components
import { VBtn } from '@/components/VBtn'
import { VTextField } from '@/components/VTextField'
import { VPicker } from '@/labs/VPicker'

// Composables
import { createDatePicker } from '../VDatePicker/composables'
import { makeTransitionProps } from '@/composables/transition'
import { useDate } from '@/labs/date'
import { makeVPickerProps } from '@/labs/VPicker/VPicker'

// Utilities
import { ref, watch } from 'vue'
import { genericComponent, propsFactory, useRender } from '@/util'

// Types
import { makeVDateRangePickerHeaderProps, VDateRangePickerHeader } from './VDateRangePickerHeader'
import { makeVDateRangePickerMonthProps, VDateRangePickerMonth } from './VDateRangePickerMonth'
import { makeDateProps } from '../VDateInput/composables'

export const makeVDateRangePickerProps = propsFactory({
  ...makeDateProps(),
  ...makeVPickerProps(),
  ...makeVDateRangePickerHeaderProps(),
  ...makeVDateRangePickerMonthProps(),
  ...makeTransitionProps({ transition: 'fade' }),
}, 'VDateRangePicker')

export const VDateRangePicker = genericComponent()({
  name: 'VDateRangePicker',

  props: makeVDateRangePickerProps(),

  emits: {
    'update:modelValue': (date: any) => true,
    'update:viewMode': (mode: 'month' | 'year') => true,
    'update:inputMode': (input: string) => true,
    'update:displayDate': (date: any) => true,
    save: (date: any) => true,
    cancel: () => true,
  },

  setup (props, { emit }) {
    const adapter = useDate()
    createDatePicker(props)

    const selected = ref(props.modelValue)
    const inputModel = ref(props.modelValue[0] ? adapter.format(props.modelValue[0], 'keyboardDate') : '')

    // watch(() => props.modelValue, newValue => {
    //   if (!newValue?.length) return

    //   inputModel.value = adapter.format(newValue[0], 'keyboardDate')
    // })

    watch(inputModel, () => {
      const { isValid, date } = adapter

      selected.value = isValid(inputModel.value) ? [date(inputModel.value)] : []
    })

    // watch(selected, () => {
    //   if (!props.showActions) {
    //     emit('update:modelValue', selected.value)
    //   }
    // })

    // function handleInput (value: any, index: number) {
    //   if (value.length === 10 && adapter.isValid(value)) {
    //     const modelValue = props.modelValue.slice()
    //     modelValue.splice(index, value)
    //     emit('update:modelValue', modelValue)
    //   }
    // }

    const handleCancel = () => emit('cancel')
    const handleSave = () => {
      emit('update:modelValue', selected.value)
      emit('save', selected.value)
    }

    useRender(() => {
      const [pickerProps] = VPicker.filterProps(props)
      const [dateRangePickerHeaderProps] = VDateRangePickerHeader.filterProps(props)
      const [dateRangePickerMonthProps] = VDateRangePickerMonth.filterProps(props)

      return (
        <VPicker
          { ...pickerProps }
          key={ props.inputMode }
          class={[
            'v-date-range-picker',
            `v-date-range-picker--${props.inputMode}`,
          ]}
          width={ 328 }
          v-slots={{
            header: () => (
              <VDateRangePickerHeader
                { ...dateRangePickerHeaderProps }
                modelValue={ selected.value }
                onUpdate:displayDate={ displayDate => emit('update:displayDate', displayDate) }
                onUpdate:inputMode={ inputMode => emit('update:inputMode', inputMode) }
                onCancel={ handleCancel }
                onSave={ handleSave }
              />
            ),
            default: () => props.inputMode === 'calendar' ? (
              <VDateRangePickerMonth
                { ...dateRangePickerMonthProps }
                v-model={ selected.value }
              />
            ) : (

                <VTextField
                  label="From"
                  placeholder="yyyy/mm/dd"
                  v-model={ inputModel.value }
                />
                <VTextField
                  label="To"
                  placeholder="yyyy/mm/dd"
                  v-model={ inputModel.value }
                />

            ),
            actions: props.inputMode === 'keyboard' ? () => (

                <VBtn variant="text" color={ props.color } onClick={ handleCancel }>Cancel</VBtn>
                <VBtn variant="text" color={ props.color } onClick={ handleSave }>Ok</VBtn>

            ) : undefined,
          }}
        />
      )
    })
  },
})

export type VDateRangePicker = InstanceType<typeof VDateRangePicker>